@reviseio/engine 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/assets/{historyMaterializeWorker-Kl0syEbc.js → historyMaterializeWorker-BMHTnStL.js} +131 -130
- package/chunks/{AgentHtmlConverter-CnnB8-WI.js → AgentHtmlConverter-B5qstcmM.js} +129 -128
- package/chunks/{AgentPageRenderer-DLgUGrGy.js → AgentPageRenderer-JMhCw-hi.js} +4 -4
- package/chunks/BlockDiff-C8eiZ-sf.js +45 -0
- package/chunks/{CanvasRenderer-C1Vegx9Y.js → CanvasRenderer-C2vAzLWM.js} +12 -12
- package/chunks/DocumentCompare-DX4RWeSV.js +10 -0
- package/chunks/{DocumentLayoutEngine-C62pyGVf.js → DocumentLayoutEngine-BhcWXkeu.js} +45 -45
- package/chunks/{DocumentMutator-Bat_oLBQ.js → DocumentMutator-FEFU1YM0.js} +6 -6
- package/chunks/DocumentOutline-BOZoTohH.js +4 -0
- package/chunks/{DocumentScrubber-BZQn_z92.js → DocumentScrubber-C4N3Qagm.js} +1 -1
- package/chunks/{DocumentSession-BDcazSEv.js → DocumentSession-gZHWP7By.js} +1 -1
- package/chunks/{DocxConverter-BC31uYIL.js → DocxConverter-BOyLn5eZ.js} +709 -703
- package/chunks/{DocxGraft-L10HXM3U.js → DocxGraft-BbE-AaM5.js} +2 -2
- package/chunks/{HtmlConverter-C5ihhZ6G.js → HtmlConverter-BlzwsPEn.js} +3 -3
- package/chunks/MarkdownConverter-BHVskVXI.js +59 -0
- package/chunks/{OdtConverter-c1fTWoAt.js → OdtConverter-BdmBFOD1.js} +1 -1
- package/chunks/{OfficeImportShared-CrOpHpJ-.js → OfficeImportShared-B2XJgnDO.js} +4 -4
- package/chunks/{PdfConverter-DX7fsRH5.js → PdfConverter-DZMCHDAo.js} +6 -6
- package/chunks/{RtfConverter-hbJ2529G.js → RtfConverter-RqE-xZcW.js} +2 -2
- package/chunks/{TableBorders-DVhdvo6f.js → TableBorders-ARyTi49V.js} +1 -1
- package/chunks/{TxtConverter-YHv5FXWb.js → TxtConverter-EPQtb6A6.js} +1 -1
- package/chunks/{Typography-B4gndEdB.js → Typography-XR6scRNV.js} +9 -9
- package/chunks/{XmlConverter-BRRluy9k.js → XmlConverter-9sFRFaza.js} +1 -1
- package/chunks/{capture-i_dPkQIS.js → capture-DhGn0CWA.js} +1 -1
- package/chunks/{carrier-pYM9xf6x.js → carrier-D58g-gw4.js} +1 -1
- package/chunks/{chromeImageLayout-BiQ3Iz1-.js → chromeImageLayout-DeYYS8YP.js} +1 -1
- package/chunks/{engine-LMUnxdm2.js → engine-C5fxuZJo.js} +139 -139
- package/chunks/{footnoteFlatten-EE85Hjre.js → footnoteFlatten-coCVFd3c.js} +1 -1
- package/chunks/{graftExport-G-dG7Vcc.js → graftExport-FBGE2qvt.js} +1 -1
- package/chunks/{index-BLb10wQt.js → index-Cezk1s_y.js} +4 -4
- package/chunks/{serverDocumentSession-DGDU5Lh3.js → serverDocumentSession-LMu3kocH.js} +559 -560
- package/chunks/{signatures-DTNDS2PH.js → signatures-DsJnnIqV.js} +1 -1
- package/chunks/textExtraction-Bqaqt1Kg.js +2 -0
- package/engine.js +2 -2
- package/package.json +2 -2
- package/chunks/BlockDiff-B6-aJxHo.js +0 -42
- package/chunks/DocumentCompare-C8295s35.js +0 -6
- package/chunks/MarkdownConverter-DofaSeC4.js +0 -57
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.1.0
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **Numbered headings stay headings.** Word numbers clause headings through
|
|
8
|
+
the heading styles; those paragraphs keep their heading level, so the
|
|
9
|
+
outline and section navigation see them, titled with their numbers.
|
|
10
|
+
- **Agent HTML** carries `data-heading` on numbered headings, reads a
|
|
11
|
+
`<del>` with a `data-change-id` as text to leave out and its `<ins>` as
|
|
12
|
+
plain text, and reads other `<del>` elements as strikethrough.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- **Editing one paragraph of a Word file** no longer changes the fonts or
|
|
17
|
+
sizes of it or its neighbors in the saved file.
|
|
18
|
+
- **Tracked changes in headers and footers** are saved as `w:ins` and
|
|
19
|
+
`w:del`, and ones in a Word file open as pending changes.
|
|
20
|
+
- **Compare** treats two copies of a numbered document as identical, and
|
|
21
|
+
ignores Word's paragraph ids, font fallbacks, and restated default sizes.
|
|
22
|
+
- **A paragraph that turns its style's numbering off** (`numId 0`) is no
|
|
23
|
+
longer numbered.
|
|
24
|
+
- **Markdown export** numbers nested list items per level and writes
|
|
25
|
+
numbered headings with their numbers.
|
|
26
|
+
|
|
3
27
|
## 3.0.1
|
|
4
28
|
|
|
5
29
|
### Fixed
|
package/assets/{historyMaterializeWorker-Kl0syEbc.js → historyMaterializeWorker-BMHTnStL.js}
RENAMED
|
@@ -486,133 +486,134 @@ kind:"float"},{attr:"spaceAfter",kind:"float"},{attr:"contextualSpacing",kind:"b
|
|
|
486
486
|
kind:"string"},{attr:"shading",kind:"string"},{attr:"oxmlAttrs",kind:"string"},{attr:"oxmlPPr",kind:"string"},{attr:"leftIndent",kind:"float"},{attr:"firstLineIndent",kind:"float"},...G,...R],children:"\
|
|
487
487
|
text"},{type:"list",attrs:[{attr:"variant",kind:"string"},{attr:"startNumber",kind:"int"},{attr:"numberingChainId",kind:"string"},{attr:"numberingFormat",kind:"string"},...Jn.map(e=>({attr:e,kind:"flo\
|
|
488
488
|
at"})),{attr:"contextualSpacing",kind:"boolean"},...G,...R],children:"list-items"},{type:"list-item",attrs:[...Jn.map(e=>({attr:e,kind:"float"})),{attr:"checked",kind:"boolean"},{attr:"indentLevel",kind:"\
|
|
489
|
-
int",validate:e=>e>0},{attr:"direction",kind:"string"},...G],children:"text"},{type:"table",attrs:[{attr:"columnWidths",kind:"json"},{attr:"
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
attr:"padding",kind:"int"},...G,...R],children:"blocks"},{type:"header-footer",attrs:[{attr:"side",kind:"enum",enum:["header","footer"]},{attr:"slot",kind:"
|
|
495
|
-
sectionIndex",kind:"int",validate:e=>e>=0}],children:"blocks"},{type:"footnote",attrs:[{attr:"noteKind",kind:"enum",enum:["endnote"]},...G,...R],children:"
|
|
496
|
-
kind:"string"},{attr:"toolCallId",kind:"string"},{attr:"renderDiagram",kind:"boolean"},{attr:"showDiagramSource",kind:"boolean"},...R,...G],children:"
|
|
497
|
-
kind:"enum",enum:["inline","block"]},{attr:"align",kind:"enum",enum:["left","center","right"]},{attr:"showDiagramSource",kind:"boolean"},...R,...G],children:"
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
...R,{attr:"structuralSuggestionRecord",kind:"string"}],children:"none"},{type:"docx-raw",attrs:[{attr:"xml",kind:"string"},{attr:"tagName",kind:"string"},{attr:"
|
|
501
|
-
kind:"enum",enum:["run","body"]},...G,...R],children:"none"},{type:"section-break",attrs:[{attr:"layout",kind:"json"},{attr:"breakType",kind:"enum",enum:["
|
|
502
|
-
|
|
503
|
-
1&&e<=6},{attr:"instr",kind:"string"},{attr:"fontFamily",kind:"string"},{attr:"fontSize",kind:"float",validate:e=>e>=Ll&&e<=Rl},{attr:"color",kind:"string"},...R,
|
|
504
|
-
string"}],children:"none"},{type:"placeholder",attrs:[{attr:"height",kind:"int"}],children:"none"}].map(e=>[e.type,e])),Hl={image:{src:"",width:200,height:200},
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
"true"?!0:void 0;case"json":try{return JSON.parse(t)}catch{return}case"enum":return e.enum?.includes(t)?t:void 0}}function ql(e){const t=[],n=$s(e);for(const r of n){
|
|
508
|
-
const s=r.attributes||{},i={type:"text",text:r.insert,marks:Zs(s)};t.push(i)}return Qs(t)}function ri(e){for(let t=0;t<e.length;t++){const n=e.get(t);if(Jl(n))return n}
|
|
509
|
-
e,"_emptyTextMarks");let n={fontFamily:Gl};if(t)try{n=JSON.parse(t)}catch{}return[{type:"text",text:"",marks:n}]}function $l(e){const t=ri(e);if(!t)return si(e);const n=ql(
|
|
510
|
-
function Kl(e,t){for(const[n,r]of[["leftIndent",!1],["firstLineIndent",!0]])if(typeof e[n]=="number"){if(e[n]===0)continue;const s=ei(e[n],{indentStepPx:t.indentStepPx,storedAsUnits:t.
|
|
511
|
-
s===void 0?delete e[n]:e[n]=s}}function Ke(e,t,n,r){const s=e.nodeName,i=Xn[s]??Xn.paragraph,o=Xn[s]?s:"paragraph",c={type:o,id:$e(e,"id")||we()};for(const d of i.attrs){const a=Xl(
|
|
512
|
-
void 0&&(c[d.field??d.attr]=a)}o==="paragraph"&&Ks(c,$e(e,"pagination"));const l=Hl[o];if(l)for(const[d,a]of Object.entries(l))c[d]===void 0&&(c[d]=a);switch(i.children){case"text":
|
|
513
|
-
rawtext":{const d=ri(e);c.content=d?d.toString():"";break}case"blocks":{const d=[];for(const a of e.toArray())if(Hn(a)){const h=Ke(a,t);h&&d.push(h)}c.children=d;break}case"
|
|
514
|
-
toArray())if(Hn(a)&&a.nodeName==="list-item"){const h=Ke(a,t);h&&d.push(h)}c.children=d;break}case"table-rows":{const d=[];for(const a of e.toArray())if(Hn(a)&&
|
|
515
|
-
h&&d.push(h)}c.children=d,c.columnWidths===void 0&&(c.columnWidths=[]);break}}return(o==="paragraph"||i.children==="text")&&Kl(c,t),c}function Yl(e){return!!e?.
|
|
516
|
-
trim()!=="")}function Zl(e){const t=e.children,n=[2,1,0].find(s=>Yl(t[s]))??-1;if(n===-1)return;const r=[];for(let s=0;s<=n;s++){s>0&&r.push({type:"text",text:"
|
|
517
|
-
type==="text"&&i.text&&r.push(i)}return{type:"paragraph",id:e.id?`${e.id}-zone`:we(),children:r}}function Ql(e){const t={},n={};for(const r of e){if(r.type!=="
|
|
518
|
-
const s=Zl(r);if(!s)continue;const i=r.side==="header"?t:n;i[r.slot]=[s]}return{...Object.keys(t).length>0?{headers:t}:{},...Object.keys(n).length>0?{footers:n}:
|
|
519
|
-
|
|
520
|
-
void 0)return;if(typeof e=="string")try{e=JSON.parse(e)}catch{return}if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n={offsetFrom:t.offsetFrom==="
|
|
521
|
-
"firstPage"||t.display==="notFirstPage"?t.display:"allPages",zOrder:t.zOrder==="back"?"back":"front"};for(const r of ea){const s=t[r];if(s!=null){if(!na.includes(
|
|
522
|
-
test(s.color)||typeof s.widthPt!="number"||!Number.isFinite(s.widthPt)||s.widthPt<.25||s.widthPt>12||typeof s.spacePt!="number"||!Number.isFinite(
|
|
523
|
-
style,color:s.color.toLowerCase(),widthPt:s.widthPt,spacePt:s.spacePt}}}return n}const Se=(e,t,n)=>typeof e=="number"&&Number.isFinite(e)&&e>=
|
|
524
|
-
|
|
525
|
-
countBy=="number"&&Number.isFinite(t.countBy)&&t.countBy>=1?Math.round(t.countBy):1,r=typeof t.start=="number"&&Number.isFinite(t.start)&&t.start>=1?Math.
|
|
526
|
-
restart==="continuous"?t.restart:"newPage",i=typeof t.distancePx=="number"&&Number.isFinite(t.distancePx)&&t.distancePx>=0?t.distancePx:void 0;return{countBy:n,
|
|
527
|
-
{}}}function ci(e){const t=qn(e);if(!t)return null;const n=Se(t.rows,1,200),r=Se(t.pitchPx,8,96);if(n===void 0||r===void 0)return null;const s=Se(t.firstBaselinePx,
|
|
528
|
-
fontFamily=="string"&&t.fontFamily.trim()!==""&&t.fontFamily.length<=200?t.fontFamily.trim():void 0,c=Se(t.fontSizePx,4,96);return{rows:Math.round(n),pitchPx:r
|
|
529
|
-
void 0?{distancePx:i}:{},...o!==void 0?{fontFamily:o}:{},...c!==void 0?{fontSizePx:c}:{}}}function sa(e){const t=qn(e);return t?ci({rows:t.gridLines,pitchPx:t.
|
|
530
|
-
const ia=1,w={pageBorders:"pageBorders",pageSize:"pageSize",orientation:"pageOrientation",marginPx:"pageMarginPx",marginTopPx:"pageMarginTopPx",marginRightPx:"
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
lineNumbering",pleadingGrid:"pleadingGrid",columnCount:"columnCount",columnGapTwips:"columnGapTwips",oxmlSectPr:"oxmlSectPr"},oa=["top-left","top-right","bottom-left",
|
|
534
|
-
"string"&&oa.includes(e)}const ai={letter:{width:8.5,height:11},tabloid:{width:11,height:17},legal:{width:8.5,height:14},statement:{width:5.5,height:8.5},
|
|
535
|
-
height:13},a3:{width:11.6929,height:16.5354},a4:{width:8.2677,height:11.6929},a5:{width:5.8268,height:8.2677},b4:{width:9.8425,height:13.8976},b5:{width:6.9291,
|
|
536
|
-
e,t])=>({pageSize:e,width:Math.min(t.width,t.height),height:Math.max(t.width,t.height)}));function di(e){return typeof e=="string"&&Object.prototype.hasOwnProperty.
|
|
537
|
-
Zt,da=2*Zt,ha=0,ua=2*Zt,ga=12,fa=1,pa=99999,ot={pageSize:"letter",orientation:"portrait",marginLeftPx:jl,indentStepPx:Gn,blockSpacingPx:ga,pageNumberPosition:"top
|
|
538
|
-
decimal",columnCount:1,columnGapTwips:720};function Qt(e,t,n){return Math.max(t,Math.min(n,e))}function _e(e){return typeof e!="number"||!Number.isFinite(e)?
|
|
539
|
-
return typeof e!="number"||!Number.isFinite(e)?ot.indentStepPx:Qt(e,aa,da)}function ba(e){return typeof e!="number"||!Number.isFinite(e)?ot.blockSpacingPx:Qt(
|
|
540
|
-
pageNumberPosition}function wa(e){return typeof e!="number"||!Number.isFinite(e)?ot.pageNumberStart:Qt(Math.round(e),fa,pa)}function ka(e){return typeof e!="
|
|
541
|
-
Qt(Math.round(e),1,12)}function Sa(e){return typeof e!="number"||!Number.isFinite(e)?ot.columnGapTwips:Qt(Math.round(e),0,14400)}function $n(e){const t=e?.pageSize&&
|
|
542
|
-
n=e?.orientation==="landscape"||e?.orientation==="portrait"?e.orientation:ot.orientation,r=_e(e?.marginPx);return{pageSize:t,orientation:n,pageBorders:oi(e?.pageBorders),
|
|
543
|
-
r),marginRightPx:_e(e?.marginRightPx??r),marginBottomPx:_e(e?.marginBottomPx??r),marginLeftPx:_e(e?.marginLeftPx??r),indentStepPx:ma(e?.indentStepPx),blockSpacingPx:ba(e?.
|
|
544
|
-
showPageNumbers===!0,pageNumberPosition:ya(e?.pageNumberPosition),pageNumberStart:wa(e?.pageNumberStart),pageNumberFormat:ii(e?.pageNumberFormat)?e.pageNumberFormat:
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
{}})()}}const _a=[w.pageBorders,w.pageSize,w.orientation,w.marginTopPx,w.marginRightPx,w.marginBottomPx,w.marginLeftPx,w.marginPx,w.indentStepPx,
|
|
548
|
-
w.pageNumberStart,w.pageNumberFormat,w.pageNumberRestart,w.hyphenationEnabled,w.lineNumbering,w.pleadingGrid,w.columnCount,w.columnGapTwips,w.oxmlSectPr];
|
|
549
|
-
const t=e.get(w.pageSize),n=e.get(w.orientation),r=e.get(w.marginTopPx),s=e.get(w.marginRightPx),i=e.get(w.marginBottomPx),o=e.get(w.marginLeftPx),c=e.get(
|
|
550
|
-
|
|
551
|
-
k=e.get(w.columnGapTwips),b=e.get(w.oxmlSectPr),M=di(t)?t:void 0;return $n({pageSize:M,orientation:n==="portrait"||n==="landscape"?n:void 0,marginTopPx:typeof r==
|
|
552
|
-
"number"?
|
|
553
|
-
"number"?d:void 0,showPageNumbers:typeof a=="boolean"?a:void 0,pageNumberPosition:li(h)?h:void 0,pageNumberStart:typeof u=="number"?u:void 0,pageNumberFormat:ii(
|
|
554
|
-
void 0,pageNumberRestart:e.get(w.pageNumberRestart)===!0?!0:void 0,hyphenationEnabled:typeof g=="boolean"?g:void 0,pageBorders:oi(e.get(w.pageBorders)),
|
|
555
|
-
"string"?p:void 0,columnCount:typeof _=="number"?_:void 0,columnGapTwips:typeof k=="number"?k:void 0,oxmlSectPr:typeof b=="string"&&b?b:
|
|
556
|
-
constructor?.name===t}function Kn(e){return e instanceof st||xa(e,"YXmlElement")&&typeof e.nodeName=="string"&&typeof e.getAttribute=="
|
|
557
|
-
|
|
558
|
-
share.has("content")?e.getXmlFragment("content").length>0:!1}function Da(e){return!!(Aa(e)||Ea(e))}const hi={indentStepPx:$n(void 0).
|
|
559
|
-
indentStepPx,storedAsUnits:t.storedAsUnits,firstLine:n})}function gi(e){const t=e.getMap("metadata"),n=t?.get("title"),
|
|
560
|
-
t)},o=e.getXmlFragment("content");let c;if(o.length>0){c=[];for(const C of o.toArray())if(Kn(C)){const v=Yn(C,i);v&&c.push(
|
|
561
|
-
C.forEach(xt=>{const Q=ve(xt,v,i);Q&&c.push(Q)})}const l={type:"doc",children:c};n&&(l.title=n),r!==void 0&&(l.pageless=r),
|
|
562
|
-
keys(d).length>0&&(l.coreProperties={...d});const a=t?.get("fontSubstitutes");a&&typeof a=="object"&&Object.keys(a).length>
|
|
563
|
-
"chrome"),u=[];for(const C of h.toArray())if(Kn(C)){const v=Yn(C,i);v&&v.type==="header-footer"&&u.push(v)}u.length>0&&(l.chrome=
|
|
564
|
-
C)){const v=Yn(C,i);v&&v.type==="footnote"&&f.push(v)}const p=l.children.filter(C=>C.type==="footnote");p.length>0&&(l.children=
|
|
565
|
-
f,Dl(l));const _=Ql(u),k=t?.get("headers"),b=t?.get("footers"),M=_.headers??(k&&Object.keys(k).length>0?k:void 0),Z=_.footers??
|
|
566
|
-
getMap("comments");if(xe.size>0){const C=[];xe.forEach(v=>{v&&typeof v=="object"&&C.push(v)}),C.length>0&&(C.sort((v,xt)=>(v.
|
|
567
|
-
"sdt-wrappers");if(te.size>0){const C=[];if(te.forEach(v=>{v&&typeof v=="object"&&C.push(v)}),C.length>0){const v=new Map;
|
|
568
|
-
Q.startBlockId??"";C.sort((Q,Qe)=>(v.get(xt(Q))??Number.MAX_SAFE_INTEGER)-(v.get(xt(Qe))??Number.MAX_SAFE_INTEGER)||Q.id.
|
|
569
|
-
0){const C=[];ee.forEach(v=>{v&&typeof v=="object"&&C.push(v)}),C.length>0&&(C.sort((v,xt)=>v.id.localeCompare(xt.id)),
|
|
570
|
-
Vt.length>0&&(l.stylesXml=Vt);const Bt=e.getMap("metadata").get("stylesheet");Bt&&typeof Bt=="object"&&Array.isArray(
|
|
571
|
-
|
|
572
|
-
e);return bi&&(l.chromeImages=bi),l}function Yn(e,t=hi){return Ke(e,t)}function ve(e,t,n=hi){const r=e.get("
|
|
573
|
-
id:s};{const o=e.get("diffState"),c=e.get("suggestionId");(o==="insert"||o==="delete"||o==="equal")&&(i.diffState=
|
|
574
|
-
section-break",id:s},c=e.get("layout");if(typeof c=="string")try{o.layout=JSON.parse(c)}catch{}const l=e.get("
|
|
575
|
-
l);const d=e.get("diffState"),a=e.get("suggestionId");return(d==="insert"||d==="delete"||d==="equal")&&(o.diffState=
|
|
576
|
-
get("levels");typeof c=="number"&&c>=1&&c<=6&&(o.levels=c);const l=e.get("instr");typeof l=="string"&&l!==""&&(o.instr=
|
|
577
|
-
d),(a==="left"||a==="center"||a==="right"||a==="justify")&&(o.align=a);const h=e.get("fontFamily");typeof h=="string"&&
|
|
578
|
-
u);const g=e.get("color");typeof g=="string"&&g!==""&&(o.color=g);const f=e.get("diffState"),p=e.get("
|
|
579
|
-
(o.suggestionId=p),o}case"placeholder":return{type:"placeholder",id:s,height:e.get("height")||100};case"image":{
|
|
580
|
-
get("width")||200,height:e.get("height")||200,alt:e.get("alt")||void 0,align:e.get("align")||void 0},c=e.get(
|
|
581
|
-
c),typeof l=="string"&&(o.suggestionId=l);const d=e.get("uploading");d!==void 0&&(o.uploading=d);const a=e.
|
|
582
|
-
|
|
583
|
-
forEach(u=>{const g=Pa(u);g&&c.push(g)});const l={type:"list",id:s,variant:e.get("variant")||"
|
|
584
|
-
d");
|
|
585
|
-
|
|
586
|
-
type:"container",id:s,children:c},d=e.get("borderColor");d&&(l.borderColor=d);const a=e.get(
|
|
587
|
-
b=>{const M=b.get("id")||we(),Z=b.get("children"),xe=[];Z&&Z.forEach(Bt=>{const zt=ve(Bt,
|
|
588
|
-
ee&&(te.oxmlAttrs=ee);const Vt=b.get("oxmlTrPr");typeof Vt=="string"&&Vt&&(te.oxmlTrPr=Vt),
|
|
589
|
-
|
|
590
|
-
(d.align=h),u&&(d.borderColor=u),g!==void 0&&(d.borderWidth=g),typeof f=="string"&&f&&(d.borders=
|
|
591
|
-
"string"&&k&&(d.oxmlTblPr=k),d}case"table-cell":{const o=e.get("children"),c=[];o&&o.forEach(_=>{
|
|
592
|
-
|
|
593
|
-
e.get("colSpan")),f=Number(e.get("rowSpan"));Number.isFinite(g)&&g>1&&(l.colSpan=g),Number.isFinite(
|
|
594
|
-
code":{const o=e.get("renderDiagram"),c=e.get("showDiagramSource"),l={type:"code",id:s,content:e.get(
|
|
595
|
-
"boolean"?c:void 0},d=e.get("diffState"),a=e.get("suggestionId");return(d==="
|
|
596
|
-
|
|
597
|
-
get("
|
|
598
|
-
const o={type:"paragraph",id:s,children:[]},c=e.get("heading"),l=e.get("
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
(
|
|
603
|
-
|
|
604
|
-
0)o.
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
{
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
for(
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
489
|
+
int",validate:e=>e>0},{attr:"direction",kind:"string"},{attr:"heading",kind:"int",validate:e=>e>=1&&e<=6},...G],children:"text"},{type:"table",attrs:[{attr:"columnWidths",kind:"json"},{attr:"tableWidt\
|
|
490
|
+
h",kind:"int"},{attr:"align",kind:"enum",enum:["left","center","right"]},{attr:"borderColor",kind:"string"},{attr:"borderWidth",kind:"int"},{attr:"borders",kind:"string"},{attr:"cellPadding",kind:"int"},
|
|
491
|
+
{attr:"hasHeader",kind:"booleanTrue"},{attr:"docxTablePropertyOverrides",kind:"string"},{attr:"oxmlTblPr",kind:"string"},...G,...R],children:"table-rows"},{type:"table-row",attrs:[{attr:"oxmlAttrs",kind:"\
|
|
492
|
+
string"},{attr:"oxmlTrPr",kind:"string"},...R,...G],children:"blocks"},{type:"table-cell",attrs:[{attr:"verticalAlign",kind:"string"},{attr:"backgroundColor",kind:"string"},{attr:"borders",kind:"strin\
|
|
493
|
+
g"},{attr:"padding",kind:"string"},{attr:"colSpan",kind:"int",validate:e=>e>1},{attr:"rowSpan",kind:"int",validate:e=>e>1},{attr:"oxmlTcPr",kind:"string"},...R,...G],children:"blocks"},{type:"containe\
|
|
494
|
+
r",attrs:[{attr:"borderColor",kind:"string"},{attr:"padding",kind:"int"},...G,...R],children:"blocks"},{type:"header-footer",attrs:[{attr:"side",kind:"enum",enum:["header","footer"]},{attr:"slot",kind:"\
|
|
495
|
+
enum",enum:["default","first","even"]},{attr:"sectionIndex",kind:"int",validate:e=>e>=0}],children:"blocks"},{type:"footnote",attrs:[{attr:"noteKind",kind:"enum",enum:["endnote"]},...G,...R],children:"\
|
|
496
|
+
blocks"},{type:"code",attrs:[{attr:"language",kind:"string"},{attr:"toolCallId",kind:"string"},{attr:"renderDiagram",kind:"boolean"},{attr:"showDiagramSource",kind:"boolean"},...R,...G],children:"rawt\
|
|
497
|
+
ext"},{type:"math",attrs:[{attr:"displayMode",kind:"enum",enum:["inline","block"]},{attr:"align",kind:"enum",enum:["left","center","right"]},{attr:"showDiagramSource",kind:"boolean"},...R,...G],children:"\
|
|
498
|
+
rawtext"},{type:"image",attrs:[{attr:"src",kind:"string"},{attr:"sourceUrl",kind:"string"},{attr:"width",kind:"int"},{attr:"height",kind:"int"},{attr:"alt",kind:"string"},{attr:"align",kind:"string"},
|
|
499
|
+
{attr:"uploading",kind:"boolean"},{attr:"tempId",kind:"string"},{attr:"originalFormat",kind:"enum",enum:["emf","wmf"]},{attr:"originalDataUrl",kind:"string"},{attr:"anchorXml",kind:"string"},...R,...G],
|
|
500
|
+
children:"none"},{type:"page-break",attrs:[...R,{attr:"structuralSuggestionRecord",kind:"string"}],children:"none"},{type:"docx-raw",attrs:[{attr:"xml",kind:"string"},{attr:"tagName",kind:"string"},{attr:"\
|
|
501
|
+
detail",kind:"string"},{attr:"origin",kind:"enum",enum:["run","body"]},...G,...R],children:"none"},{type:"section-break",attrs:[{attr:"layout",kind:"json"},{attr:"breakType",kind:"enum",enum:["nextPag\
|
|
502
|
+
e","continuous","evenPage","oddPage"]},...R],children:"none"},{type:"toc",attrs:[{attr:"direction",kind:"enum",enum:["rtl","ltr"]},{attr:"align",kind:"enum",enum:["left","center","right","justify"]},{
|
|
503
|
+
attr:"levels",kind:"int",validate:e=>e>=1&&e<=6},{attr:"instr",kind:"string"},{attr:"fontFamily",kind:"string"},{attr:"fontSize",kind:"float",validate:e=>e>=Ll&&e<=Rl},{attr:"color",kind:"string"},...R,
|
|
504
|
+
{attr:"structuralSuggestionRecord",kind:"string"}],children:"none"},{type:"placeholder",attrs:[{attr:"height",kind:"int"}],children:"none"}].map(e=>[e.type,e])),Hl={image:{src:"",width:200,height:200},
|
|
505
|
+
code:{content:""},math:{displayMode:"block"},placeholder:{height:100},list:{variant:"unordered"}};function Xl(e,t){if(!(t==null||t===""))switch(e.kind){case"string":return t;case"int":{const n=parseInt(
|
|
506
|
+
t,10);return Number.isNaN(n)||e.validate&&!e.validate(n)?void 0:n}case"float":{const n=parseFloat(t);return Number.isNaN(n)||e.validate&&!e.validate(n)?void 0:n}case"boolean":return t==="true"?!0:t===
|
|
507
|
+
"false"?!1:void 0;case"booleanTrue":return t==="true"?!0:void 0;case"json":try{return JSON.parse(t)}catch{return}case"enum":return e.enum?.includes(t)?t:void 0}}function ql(e){const t=[],n=$s(e);for(const r of n){
|
|
508
|
+
if(typeof r.insert!="string")continue;const s=r.attributes||{},i={type:"text",text:r.insert,marks:Zs(s)};t.push(i)}return Qs(t)}function ri(e){for(let t=0;t<e.length;t++){const n=e.get(t);if(Jl(n))return n}
|
|
509
|
+
return null}function si(e){const t=$e(e,"_emptyTextMarks");let n={fontFamily:Gl};if(t)try{n=JSON.parse(t)}catch{}return[{type:"text",text:"",marks:n}]}function $l(e){const t=ri(e);if(!t)return si(e);const n=ql(
|
|
510
|
+
t);return n.length>0?n:si(e)}function Kl(e,t){for(const[n,r]of[["leftIndent",!1],["firstLineIndent",!0]])if(typeof e[n]=="number"){if(e[n]===0)continue;const s=ei(e[n],{indentStepPx:t.indentStepPx,storedAsUnits:t.
|
|
511
|
+
storedAsUnits,firstLine:r});s===void 0?delete e[n]:e[n]=s}}function Ke(e,t,n,r){const s=e.nodeName,i=Xn[s]??Xn.paragraph,o=Xn[s]?s:"paragraph",c={type:o,id:$e(e,"id")||we()};for(const d of i.attrs){const a=Xl(
|
|
512
|
+
d,$e(e,d.attr));a!==void 0&&(c[d.field??d.attr]=a)}o==="paragraph"&&Ks(c,$e(e,"pagination"));const l=Hl[o];if(l)for(const[d,a]of Object.entries(l))c[d]===void 0&&(c[d]=a);switch(i.children){case"text":
|
|
513
|
+
c.children=$l(e);break;case"rawtext":{const d=ri(e);c.content=d?d.toString():"";break}case"blocks":{const d=[];for(const a of e.toArray())if(Hn(a)){const h=Ke(a,t);h&&d.push(h)}c.children=d;break}case"\
|
|
514
|
+
list-items":{const d=[];for(const a of e.toArray())if(Hn(a)&&a.nodeName==="list-item"){const h=Ke(a,t);h&&d.push(h)}c.children=d;break}case"table-rows":{const d=[];for(const a of e.toArray())if(Hn(a)&&
|
|
515
|
+
a.nodeName==="table-row"){const h=Ke(a,t);h&&d.push(h)}c.children=d,c.columnWidths===void 0&&(c.columnWidths=[]);break}}return(o==="paragraph"||i.children==="text")&&Kl(c,t),c}function Yl(e){return!!e?.
|
|
516
|
+
children.some(t=>t.type==="text"&&t.text.trim()!=="")}function Zl(e){const t=e.children,n=[2,1,0].find(s=>Yl(t[s]))??-1;if(n===-1)return;const r=[];for(let s=0;s<=n;s++){s>0&&r.push({type:"text",text:"\
|
|
517
|
+
"});for(const i of t[s]?.children??[])i.type==="text"&&i.text&&r.push(i)}return{type:"paragraph",id:e.id?`${e.id}-zone`:we(),children:r}}function Ql(e){const t={},n={};for(const r of e){if(r.type!=="\
|
|
518
|
+
header-footer"||r.sectionIndex!==void 0)continue;const s=Zl(r);if(!s)continue;const i=r.side==="header"?t:n;i[r.slot]=[s]}return{...Object.keys(t).length>0?{headers:t}:{},...Object.keys(n).length>0?{footers:n}:
|
|
519
|
+
{}}}const ta=["decimal","lowerRoman","upperRoman"];function ii(e){return typeof e=="string"&&ta.includes(e)}const ea=["top","right","bottom","left"],na=["single","double","dotted","dashed"];function oi(e){
|
|
520
|
+
if(e===null||e==="")return null;if(e===void 0)return;if(typeof e=="string")try{e=JSON.parse(e)}catch{return}if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n={offsetFrom:t.offsetFrom==="p\
|
|
521
|
+
age"?"page":"text",display:t.display==="firstPage"||t.display==="notFirstPage"?t.display:"allPages",zOrder:t.zOrder==="back"?"back":"front"};for(const r of ea){const s=t[r];if(s!=null){if(!na.includes(
|
|
522
|
+
s.style)||typeof s.color!="string"||!/^#[0-9a-f]{6}$/i.test(s.color)||typeof s.widthPt!="number"||!Number.isFinite(s.widthPt)||s.widthPt<.25||s.widthPt>12||typeof s.spacePt!="number"||!Number.isFinite(
|
|
523
|
+
s.spacePt)||s.spacePt<0||s.spacePt>31)return;n[r]={style:s.style,color:s.color.toLowerCase(),widthPt:s.widthPt,spacePt:s.spacePt}}}return n}const Se=(e,t,n)=>typeof e=="number"&&Number.isFinite(e)&&e>=
|
|
524
|
+
t&&e<=n?e:void 0;function qn(e){let t=e;if(typeof e=="string"){const n=e.trim();if(n==="")return null;try{t=JSON.parse(n)}catch{return null}}return!t||typeof t!="object"||Array.isArray(t)?null:t}function ra(e){
|
|
525
|
+
const t=qn(e);if(!t)return null;const n=typeof t.countBy=="number"&&Number.isFinite(t.countBy)&&t.countBy>=1?Math.round(t.countBy):1,r=typeof t.start=="number"&&Number.isFinite(t.start)&&t.start>=1?Math.
|
|
526
|
+
round(t.start):1,s=t.restart==="newSection"||t.restart==="continuous"?t.restart:"newPage",i=typeof t.distancePx=="number"&&Number.isFinite(t.distancePx)&&t.distancePx>=0?t.distancePx:void 0;return{countBy:n,
|
|
527
|
+
start:r,restart:s,...i!==void 0?{distancePx:i}:{}}}function ci(e){const t=qn(e);if(!t)return null;const n=Se(t.rows,1,200),r=Se(t.pitchPx,8,96);if(n===void 0||r===void 0)return null;const s=Se(t.firstBaselinePx,
|
|
528
|
+
0,2e3),i=Se(t.distancePx,0,400),o=typeof t.fontFamily=="string"&&t.fontFamily.trim()!==""&&t.fontFamily.length<=200?t.fontFamily.trim():void 0,c=Se(t.fontSizePx,4,96);return{rows:Math.round(n),pitchPx:r,
|
|
529
|
+
...s!==void 0?{firstBaselinePx:s}:{},...i!==void 0?{distancePx:i}:{},...o!==void 0?{fontFamily:o}:{},...c!==void 0?{fontSizePx:c}:{}}}function sa(e){const t=qn(e);return t?ci({rows:t.gridLines,pitchPx:t.
|
|
530
|
+
gridPitchPx,fontFamily:t.fontFamily}):null}const ia=1,w={pageBorders:"pageBorders",pageSize:"pageSize",orientation:"pageOrientation",marginPx:"pageMarginPx",marginTopPx:"pageMarginTopPx",marginRightPx:"\
|
|
531
|
+
pageMarginRightPx",marginBottomPx:"pageMarginBottomPx",marginLeftPx:"pageMarginLeftPx",indentStepPx:"indentStepPx",blockSpacingPx:"blockSpacingPx",showPageNumbers:"showPageNumbers",pageNumberPosition:"\
|
|
532
|
+
pageNumberPosition",pageNumberStart:"pageNumberStart",pageNumberFormat:"pageNumberFormat",pageNumberRestart:"pageNumberRestart",paragraphIndentStorageVersion:"paragraphIndentStorageVersion",hyphenationEnabled:"\
|
|
533
|
+
hyphenationEnabled",lineNumbering:"lineNumbering",pleadingGrid:"pleadingGrid",columnCount:"columnCount",columnGapTwips:"columnGapTwips",oxmlSectPr:"oxmlSectPr"},oa=["top-left","top-right","bottom-left",
|
|
534
|
+
"bottom-right"];function li(e){return typeof e=="string"&&oa.includes(e)}const ai={letter:{width:8.5,height:11},tabloid:{width:11,height:17},legal:{width:8.5,height:14},statement:{width:5.5,height:8.5},
|
|
535
|
+
executive:{width:7.25,height:10.5},folio:{width:8.5,height:13},a3:{width:11.6929,height:16.5354},a4:{width:8.2677,height:11.6929},a5:{width:5.8268,height:8.2677},b4:{width:9.8425,height:13.8976},b5:{width:6.9291,
|
|
536
|
+
height:9.8425}};Object.entries(ai).map(([e,t])=>({pageSize:e,width:Math.min(t.width,t.height),height:Math.max(t.width,t.height)}));function di(e){return typeof e=="string"&&Object.prototype.hasOwnProperty.
|
|
537
|
+
call(ai,e)}const ca=0,la=3*Zt,aa=.125*Zt,da=2*Zt,ha=0,ua=2*Zt,ga=12,fa=1,pa=99999,ot={pageSize:"letter",orientation:"portrait",marginLeftPx:jl,indentStepPx:Gn,blockSpacingPx:ga,pageNumberPosition:"top\
|
|
538
|
+
-right",pageNumberStart:1,pageNumberFormat:"decimal",columnCount:1,columnGapTwips:720};function Qt(e,t,n){return Math.max(t,Math.min(n,e))}function _e(e){return typeof e!="number"||!Number.isFinite(e)?
|
|
539
|
+
ot.marginLeftPx:Qt(e,ca,la)}function ma(e){return typeof e!="number"||!Number.isFinite(e)?ot.indentStepPx:Qt(e,aa,da)}function ba(e){return typeof e!="number"||!Number.isFinite(e)?ot.blockSpacingPx:Qt(
|
|
540
|
+
e,ha,ua)}function ya(e){return li(e)?e:ot.pageNumberPosition}function wa(e){return typeof e!="number"||!Number.isFinite(e)?ot.pageNumberStart:Qt(Math.round(e),fa,pa)}function ka(e){return typeof e!="n\
|
|
541
|
+
umber"||!Number.isFinite(e)?ot.columnCount:Qt(Math.round(e),1,12)}function Sa(e){return typeof e!="number"||!Number.isFinite(e)?ot.columnGapTwips:Qt(Math.round(e),0,14400)}function $n(e){const t=e?.pageSize&&
|
|
542
|
+
di(e.pageSize)?e.pageSize:ot.pageSize,n=e?.orientation==="landscape"||e?.orientation==="portrait"?e.orientation:ot.orientation,r=_e(e?.marginPx);return{pageSize:t,orientation:n,pageBorders:oi(e?.pageBorders),
|
|
543
|
+
marginTopPx:_e(e?.marginTopPx??r),marginRightPx:_e(e?.marginRightPx??r),marginBottomPx:_e(e?.marginBottomPx??r),marginLeftPx:_e(e?.marginLeftPx??r),indentStepPx:ma(e?.indentStepPx),blockSpacingPx:ba(e?.
|
|
544
|
+
blockSpacingPx),showPageNumbers:e?.showPageNumbers===!0,pageNumberPosition:ya(e?.pageNumberPosition),pageNumberStart:wa(e?.pageNumberStart),pageNumberFormat:ii(e?.pageNumberFormat)?e.pageNumberFormat:
|
|
545
|
+
ot.pageNumberFormat,...e?.pageNumberRestart===!0?{pageNumberRestart:!0}:{},noteMode:e?.noteMode==="endnotes"?"endnotes":"footnotes",columnCount:ka(e?.columnCount),columnGapTwips:Sa(e?.columnGapTwips),
|
|
546
|
+
hyphenationEnabled:e?.hyphenationEnabled===!0,...(()=>{const s=e?.lineNumbering,i=e?.pleadingGrid,o=sa(s),c=i!==void 0?ci(i):o;return{lineNumbering:o||c?null:ra(s),pleadingGrid:c}})(),...(()=>{const s=e?.
|
|
547
|
+
oxmlSectPr;return typeof s=="string"&&s?{oxmlSectPr:s}:{}})()}}const _a=[w.pageBorders,w.pageSize,w.orientation,w.marginTopPx,w.marginRightPx,w.marginBottomPx,w.marginLeftPx,w.marginPx,w.indentStepPx,
|
|
548
|
+
w.blockSpacingPx,w.showPageNumbers,w.pageNumberPosition,w.pageNumberStart,w.pageNumberFormat,w.pageNumberRestart,w.hyphenationEnabled,w.lineNumbering,w.pleadingGrid,w.columnCount,w.columnGapTwips,w.oxmlSectPr];
|
|
549
|
+
function va(e){if(!_a.some(Z=>e.has(Z)))return;const t=e.get(w.pageSize),n=e.get(w.orientation),r=e.get(w.marginTopPx),s=e.get(w.marginRightPx),i=e.get(w.marginBottomPx),o=e.get(w.marginLeftPx),c=e.get(
|
|
550
|
+
w.marginPx),l=e.get(w.indentStepPx),d=e.get(w.blockSpacingPx),a=e.get(w.showPageNumbers),h=e.get(w.pageNumberPosition),u=e.get(w.pageNumberStart),g=e.get(w.hyphenationEnabled),f=e.get(w.lineNumbering),
|
|
551
|
+
p=e.get(w.pleadingGrid),_=e.get(w.columnCount),k=e.get(w.columnGapTwips),b=e.get(w.oxmlSectPr),M=di(t)?t:void 0;return $n({pageSize:M,orientation:n==="portrait"||n==="landscape"?n:void 0,marginTopPx:typeof r==
|
|
552
|
+
"number"?r:void 0,marginRightPx:typeof s=="number"?s:void 0,marginBottomPx:typeof i=="number"?i:void 0,marginLeftPx:typeof o=="number"?o:void 0,marginPx:typeof c=="number"?c:void 0,indentStepPx:typeof l==
|
|
553
|
+
"number"?l:void 0,blockSpacingPx:typeof d=="number"?d:void 0,showPageNumbers:typeof a=="boolean"?a:void 0,pageNumberPosition:li(h)?h:void 0,pageNumberStart:typeof u=="number"?u:void 0,pageNumberFormat:ii(
|
|
554
|
+
e.get(w.pageNumberFormat))?e.get(w.pageNumberFormat):void 0,pageNumberRestart:e.get(w.pageNumberRestart)===!0?!0:void 0,hyphenationEnabled:typeof g=="boolean"?g:void 0,pageBorders:oi(e.get(w.pageBorders)),
|
|
555
|
+
lineNumbering:typeof f=="string"?f:void 0,pleadingGrid:typeof p=="string"?p:void 0,columnCount:typeof _=="number"?_:void 0,columnGapTwips:typeof k=="number"?k:void 0,oxmlSectPr:typeof b=="string"&&b?b:
|
|
556
|
+
void 0})}function xa(e,t){return typeof e=="object"&&e!==null&&e.constructor?.name===t}function Kn(e){return e instanceof st||xa(e,"YXmlElement")&&typeof e.nodeName=="string"&&typeof e.getAttribute=="\
|
|
557
|
+
function"&&typeof e.setAttribute=="function"&&typeof e.get=="function"&&typeof e.length=="number"}function Ca(e){return e.get(w.paragraphIndentStorageVersion)===ia}function Ea(e){return e.share.has("p\
|
|
558
|
+
aragraphs")?e.getArray("paragraphs").length>0:!1}function Aa(e){return e.share.has("content")?e.getXmlFragment("content").length>0:!1}function Da(e){return!!(Aa(e)||Ea(e))}const hi={indentStepPx:$n(void 0).
|
|
559
|
+
indentStepPx,storedAsUnits:!1};function ui(e,t,n=!1){return ei(e,{indentStepPx:t.indentStepPx,storedAsUnits:t.storedAsUnits,firstLine:n})}function gi(e){const t=e.getMap("metadata"),n=t?.get("title"),
|
|
560
|
+
r=t?.get("pageless"),s=va(t),i={indentStepPx:$n(s).indentStepPx,storedAsUnits:Ca(t)},o=e.getXmlFragment("content");let c;if(o.length>0){c=[];for(const C of o.toArray())if(Kn(C)){const v=Yn(C,i);v&&c.push(
|
|
561
|
+
v)}}else{const C=e.getArray("paragraphs"),v=t?.get("defaultFontFamily");c=[],C.forEach(xt=>{const Q=ve(xt,v,i);Q&&c.push(Q)})}const l={type:"doc",children:c};n&&(l.title=n),r!==void 0&&(l.pageless=r),
|
|
562
|
+
s&&(l.pageLayout=s);const d=t?.get("coreProperties");d&&typeof d=="object"&&Object.keys(d).length>0&&(l.coreProperties={...d});const a=t?.get("fontSubstitutes");a&&typeof a=="object"&&Object.keys(a).length>
|
|
563
|
+
0&&(l.fontSubstitutes={...a},Ml(l.fontSubstitutes));const h=e.getXmlFragment("chrome"),u=[];for(const C of h.toArray())if(Kn(C)){const v=Yn(C,i);v&&v.type==="header-footer"&&u.push(v)}u.length>0&&(l.chrome=
|
|
564
|
+
u);const g=e.getXmlFragment("notes"),f=[];for(const C of g.toArray())if(Kn(C)){const v=Yn(C,i);v&&v.type==="footnote"&&f.push(v)}const p=l.children.filter(C=>C.type==="footnote");p.length>0&&(l.children=
|
|
565
|
+
l.children.filter(C=>C.type!=="footnote"),f.push(...p)),f.length>0&&(l.notes=f,Dl(l));const _=Ql(u),k=t?.get("headers"),b=t?.get("footers"),M=_.headers??(k&&Object.keys(k).length>0?k:void 0),Z=_.footers??
|
|
566
|
+
(b&&Object.keys(b).length>0?b:void 0);M&&(l.headers=M),Z&&(l.footers=Z);const xe=e.getMap("comments");if(xe.size>0){const C=[];xe.forEach(v=>{v&&typeof v=="object"&&C.push(v)}),C.length>0&&(C.sort((v,xt)=>(v.
|
|
567
|
+
createdAt??"").localeCompare(xt.createdAt??"")),l.comments=C)}const te=e.getMap("sdt-wrappers");if(te.size>0){const C=[];if(te.forEach(v=>{v&&typeof v=="object"&&C.push(v)}),C.length>0){const v=new Map;
|
|
568
|
+
l.children.forEach((Q,Qe)=>{Q.id&&v.set(Q.id,Qe)});const xt=Q=>Q.blockIds?.[0]??Q.startBlockId??"";C.sort((Q,Qe)=>(v.get(xt(Q))??Number.MAX_SAFE_INTEGER)-(v.get(xt(Qe))??Number.MAX_SAFE_INTEGER)||Q.id.
|
|
569
|
+
localeCompare(Qe.id)),l.sdtWrappers=C}}const ee=e.getMap("oxml-ranges");if(ee.size>0){const C=[];ee.forEach(v=>{v&&typeof v=="object"&&C.push(v)}),C.length>0&&(C.sort((v,xt)=>v.id.localeCompare(xt.id)),
|
|
570
|
+
l.oxmlRanges=C)}const Vt=e.getMap("metadata").get("stylesXml");typeof Vt=="string"&&Vt.length>0&&(l.stylesXml=Vt);const Bt=e.getMap("metadata").get("stylesheet");Bt&&typeof Bt=="object"&&Array.isArray(
|
|
571
|
+
Bt.paragraphStyles)&&Bt.paragraphStyles.length>0&&(l.stylesheet=Bt);const zt=e.getMap("metadata").get("docxSource");zt&&typeof zt=="object"&&Array.isArray(zt.spans)&&(l.docxSource=zt);const Zn=e.getMap(
|
|
572
|
+
"metadata").get("watermark");typeof Zn=="string"&&Zn.length>0&&(l.watermark=Zn);const bi=gl(e);return bi&&(l.chromeImages=bi),l}function Yn(e,t=hi){return Ke(e,t)}function ve(e,t,n=hi){const r=e.get("\
|
|
573
|
+
type")||"paragraph",s=e.get("id")||we();switch(r){case"page-break":const i={type:"page-break",id:s};{const o=e.get("diffState"),c=e.get("suggestionId");(o==="insert"||o==="delete"||o==="equal")&&(i.diffState=
|
|
574
|
+
o),typeof c=="string"&&(i.suggestionId=c)}return i;case"section-break":{const o={type:"section-break",id:s},c=e.get("layout");if(typeof c=="string")try{o.layout=JSON.parse(c)}catch{}const l=e.get("bre\
|
|
575
|
+
akType");(l==="nextPage"||l==="continuous"||l==="evenPage"||l==="oddPage")&&(o.breakType=l);const d=e.get("diffState"),a=e.get("suggestionId");return(d==="insert"||d==="delete"||d==="equal")&&(o.diffState=
|
|
576
|
+
d),typeof a=="string"&&(o.suggestionId=a),o}case"toc":{const o={type:"toc",id:s},c=e.get("levels");typeof c=="number"&&c>=1&&c<=6&&(o.levels=c);const l=e.get("instr");typeof l=="string"&&l!==""&&(o.instr=
|
|
577
|
+
l);const d=e.get("direction"),a=e.get("align");(d==="rtl"||d==="ltr")&&(o.direction=d),(a==="left"||a==="center"||a==="right"||a==="justify")&&(o.align=a);const h=e.get("fontFamily");typeof h=="string"&&
|
|
578
|
+
h!==""&&(o.fontFamily=h);const u=e.get("fontSize");typeof u=="number"&&u>0&&(o.fontSize=u);const g=e.get("color");typeof g=="string"&&g!==""&&(o.color=g);const f=e.get("diffState"),p=e.get("suggestion\
|
|
579
|
+
Id");return(f==="insert"||f==="delete"||f==="equal")&&(o.diffState=f),typeof p=="string"&&(o.suggestionId=p),o}case"placeholder":return{type:"placeholder",id:s,height:e.get("height")||100};case"image":{
|
|
580
|
+
const o={type:"image",id:s,src:e.get("src")||"",sourceUrl:e.get("sourceUrl")||void 0,width:e.get("width")||200,height:e.get("height")||200,alt:e.get("alt")||void 0,align:e.get("align")||void 0},c=e.get(
|
|
581
|
+
"diffState"),l=e.get("suggestionId");(c==="insert"||c==="delete"||c==="equal")&&(o.diffState=c),typeof l=="string"&&(o.suggestionId=l);const d=e.get("uploading");d!==void 0&&(o.uploading=d);const a=e.
|
|
582
|
+
get("tempId");a&&(o.tempId=a);const h=e.get("originalFormat");(h==="emf"||h==="wmf")&&(o.originalFormat=h);const u=e.get("originalDataUrl");typeof u=="string"&&u&&(o.originalDataUrl=u);const g=e.get("\
|
|
583
|
+
anchorXml");return typeof g=="string"&&g&&(o.anchorXml=g),o}case"list":{const o=e.get("items"),c=[];o&&o.forEach(u=>{const g=Pa(u);g&&c.push(g)});const l={type:"list",id:s,variant:e.get("variant")||"u\
|
|
584
|
+
nordered",children:c},d=e.get("startNumber");d!==void 0&&(l.startNumber=d);const a=e.get("numberingChainId");a&&(l.numberingChainId=a);const h=e.get("numberingFormat");return h&&(l.numberingFormat=h),
|
|
585
|
+
l}case"footnote":{const o=e.get("children"),c=[];o&&o.forEach(d=>{const a=ve(d,t,n);a&&c.push(a)});const l={type:"footnote",id:s,children:c};return e.get("noteKind")==="endnote"&&(l.noteKind="endnote"),
|
|
586
|
+
l}case"container":{const o=e.get("children"),c=[];o&&o.forEach(h=>{const u=ve(h,t,n);u&&c.push(u)});const l={type:"container",id:s,children:c},d=e.get("borderColor");d&&(l.borderColor=d);const a=e.get(
|
|
587
|
+
"padding");return typeof a=="number"&&(l.padding=a),l}case"table":{const o=e.get("children"),c=[];o&&o.forEach(b=>{const M=b.get("id")||we(),Z=b.get("children"),xe=[];Z&&Z.forEach(Bt=>{const zt=ve(Bt,
|
|
588
|
+
t,n);zt&&xe.push(zt)});const te={type:"table-row",id:M,children:xe},ee=b.get("oxmlAttrs");typeof ee=="string"&&ee&&(te.oxmlAttrs=ee);const Vt=b.get("oxmlTrPr");typeof Vt=="string"&&Vt&&(te.oxmlTrPr=Vt),
|
|
589
|
+
c.push(te)});const l=e.get("columnWidths")||[],d={type:"table",id:s,children:c,columnWidths:l},a=e.get("tableWidth"),h=e.get("align"),u=e.get("borderColor"),g=e.get("borderWidth"),f=e.get("borders"),p=e.
|
|
590
|
+
get("cellPadding"),_=e.get("hasHeader");a!==void 0&&(d.tableWidth=a),(h==="left"||h==="center"||h==="right")&&(d.align=h),u&&(d.borderColor=u),g!==void 0&&(d.borderWidth=g),typeof f=="string"&&f&&(d.borders=
|
|
591
|
+
f),p!==void 0&&(d.cellPadding=p),_!==void 0&&(d.hasHeader=_);const k=e.get("oxmlTblPr");return typeof k=="string"&&k&&(d.oxmlTblPr=k),d}case"table-cell":{const o=e.get("children"),c=[];o&&o.forEach(_=>{
|
|
592
|
+
const k=ve(_,t,n);k&&c.push(k)});const l={type:"table-cell",id:s,children:c},d=e.get("verticalAlign"),a=e.get("backgroundColor");d&&(l.verticalAlign=d),a&&(l.backgroundColor=a);const h=e.get("borders"),
|
|
593
|
+
u=e.get("padding");typeof h=="string"&&h&&(l.borders=h),typeof u=="string"&&u&&(l.padding=u);const g=Number(e.get("colSpan")),f=Number(e.get("rowSpan"));Number.isFinite(g)&&g>1&&(l.colSpan=g),Number.isFinite(
|
|
594
|
+
f)&&f>1&&(l.rowSpan=f);const p=e.get("oxmlTcPr");return typeof p=="string"&&p&&(l.oxmlTcPr=p),l}case"code":{const o=e.get("renderDiagram"),c=e.get("showDiagramSource"),l={type:"code",id:s,content:e.get(
|
|
595
|
+
"content")||"",language:e.get("language")||void 0,renderDiagram:typeof o=="boolean"?o:void 0,showDiagramSource:typeof c=="boolean"?c:void 0},d=e.get("diffState"),a=e.get("suggestionId");return(d==="in\
|
|
596
|
+
sert"||d==="delete"||d==="equal")&&(l.diffState=d),typeof a=="string"&&(l.suggestionId=a),l}case"math":{const o=e.get("displayMode")||"block",c={type:"math",id:s,content:e.get("content")||"",displayMode:o},
|
|
597
|
+
l=e.get("align");(l==="left"||l==="center"||l==="right"||l==="justify")&&(c.align=l);const d=e.get("diffState"),a=e.get("suggestionId");return(d==="insert"||d==="delete"||d==="equal")&&(c.diffState=d),
|
|
598
|
+
typeof a=="string"&&(c.suggestionId=a),e.get("showDiagramSource")===!0&&(c.showDiagramSource=!0),c}case"paragraph":default:{const o={type:"paragraph",id:s,children:[]},c=e.get("heading"),l=e.get("alig\
|
|
599
|
+
n"),d=e.get("lineSpacing"),a=e.get("leftIndent"),h=e.get("firstLineIndent"),u=e.get("structuralSuggestionId"),g=e.get("structuralSuggestionKind"),f=e.get("structuralSuggestionRole");c!==void 0&&(o.heading=
|
|
600
|
+
c),l!==void 0&&(o.align=l),d!==void 0&&(o.lineSpacing=d),Ks(o,e.get("pagination"));{const b=e.get("styleId");typeof b=="string"&&b&&(o.styleId=b)}{const b=e.get("direction");(b==="rtl"||b==="ltr")&&(o.
|
|
601
|
+
direction=b)}{const b=e.get("tabStops");typeof b=="string"&&b&&(o.tabStops=b)}{const b=e.get("borders");typeof b=="string"&&b&&(o.borders=b)}{const b=e.get("shading");typeof b=="string"&&b&&(o.shading=
|
|
602
|
+
b)}{const b=e.get("oxmlAttrs");typeof b=="string"&&b&&(o.oxmlAttrs=b);const M=e.get("oxmlPPr");typeof M=="string"&&M&&(o.oxmlPPr=M)}typeof u=="string"&&(o.structuralSuggestionId=u),(g==="insert"||g===
|
|
603
|
+
"delete"||g==="split"||g==="merge"||g==="change")&&(o.structuralSuggestionKind=g),(f==="before"||f==="after")&&(o.structuralSuggestionRole=f);const p=ui(a,n);a===0?o.leftIndent=0:p!==void 0&&(o.leftIndent=
|
|
604
|
+
p);const _=ui(h,n,!0);h===0?o.firstLineIndent=0:_!==void 0&&(o.firstLineIndent=_);const k=e.get("content");if(k){const b=fi(k);if(b.length>0)o.children=b;else{const M=e.get("_emptyTextMarks"),Z={type:"\
|
|
605
|
+
text",text:""};M&&Object.keys(M).length>0?Z.marks=M:Z.marks={fontFamily:ke},o.children=[Z]}}else o.children=[{type:"text",text:"",marks:{fontFamily:ke}}];return t&&o.children.forEach(b=>{b.type==="tex\
|
|
606
|
+
t"&&(b.marks={fontFamily:t,...b.marks||{}})}),o}}}function Pa(e){if(!e)return null;const t={type:"list-item",id:e.get("id")||we(),children:[]},n=e.get("checked");n!==void 0&&(t.checked=n);const r=e.get(
|
|
607
|
+
"indentLevel");typeof r=="number"&&r>0&&(t.indentLevel=r);for(const o of Jn){const c=e.get(o);typeof c=="number"&&Number.isFinite(c)&&c>=0&&(t[o]=c)}const s=e.get("direction");(s==="rtl"||s==="ltr")&&
|
|
608
|
+
(t.direction=s);const i=e.get("content");if(i){const o=fi(i);if(o.length>0)t.children=o;else{const c=e.get("_emptyTextMarks");t.children=[{type:"text",text:"",marks:c||{fontFamily:ke}}]}}else t.children=
|
|
609
|
+
[{type:"text",text:"",marks:{fontFamily:ke}}];return t}function fi(e){const t=[];return $s(e).forEach(n=>{if(typeof n.insert=="string"){const r=n.attributes||{},s={type:"text",text:n.insert};s.marks=Zs(
|
|
610
|
+
r),t.push(s)}}),Qs(t)}function jt(e,t){let n=e;for(let r=0;r<t.length;r++)n^=t.charCodeAt(r),n=Math.imul(n,16777619);return n>>>0}function pi(e,t){if(!e||typeof e!="object")return t;let n=t;if(typeof e.
|
|
611
|
+
type=="string"&&(n=jt(n,e.type)),typeof e.text=="string"&&(n=jt(n,e.text)),typeof e.content=="string"&&(n=jt(n,e.content)),typeof e.language=="string"&&(n=jt(n,e.language)),e.marks&&(n=jt(n,JSON.stringify(
|
|
612
|
+
e.marks))),Array.isArray(e.children)){n=jt(n,"[");for(const r of e.children)n=pi(r,n);n=jt(n,"]")}return n>>>0}function Na(e){return pi(e,2166136261)}function Ye(e){const t=atob(e),n=new Uint8Array(t.
|
|
613
|
+
length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function Ze(e,t){try{Ir(e,t),Da(e)||mi(e,t)}catch{mi(e,t)}}function mi(e,t){const n=sl;if(typeof n.applyUpdateV2=="function")try{n.applyUpdateV2(
|
|
614
|
+
e,t)}catch(r){console.warn("[HistoryWorker] Failed to apply V2 update:",r)}}function Ia(e){const t=new rt({gc:!1});try{const n=Ye(e.snapshotB64);Ze(t,n);const r=e.uptoIndex<0?e.updatesB64.length:e.uptoIndex;
|
|
615
|
+
for(let s=0;s<r&&s<e.updatesB64.length;s++)Ze(t,Ye(e.updatesB64[s]));return gi(t)}finally{t.destroy()}}function Ma(e){const t=new Set(e.candidateIds),n=[];let r=null;for(const s of e.segments){const i=new rt(
|
|
616
|
+
{gc:!1});try{Ze(i,Ye(s.snapshotB64));for(let o=0;o<s.updatesB64.length;o++){Ze(i,Ye(s.updatesB64[o]));const c=s.startUpdateId+o;if(!t.has(c))continue;const l=Na(gi(i));l!==r&&(r=l,n.push(c))}}finally{
|
|
617
|
+
i.destroy()}}return n}self.onmessage=e=>{const t=e.data;try{if(t.kind==="filterDistinct"){const s=Ma(t),i={id:t.id,kind:"filterDistinct",success:!0,distinctIds:s};self.postMessage(i);return}const n=Ia(
|
|
618
|
+
t),r={id:t.id,success:!0,doc:n};self.postMessage(r)}catch(n){const r={id:t.id,kind:t.kind==="filterDistinct"?"filterDistinct":"materialize",success:!1,error:n instanceof Error?n.message:String(n)};self.
|
|
619
|
+
postMessage(r)}}})();
|