revise 2.0.1 → 2.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 +101 -0
- package/README.md +4 -1
- package/assets/historyMaterializeWorker-C4uxcZEh.js +607 -3
- package/backend.js +3 -1
- package/chunks/{AgentPageRenderer-BIf_Fza8.js → AgentPageRenderer-BFB0arQL.js} +1 -1
- package/chunks/{AgentPageRenderer-DT9sNxEn.js → AgentPageRenderer-Dn6SaRjW.js} +1 -1
- package/chunks/AttachmentDocumentImporter-BHDJAdky.js +1 -0
- package/chunks/AttachmentDocumentImporter-CxOZqzt1.js +1 -0
- package/chunks/BidiText-C8PBPSQY.js +160 -0
- package/chunks/ColorParserFull-BKH72fK8.js +446 -1
- package/chunks/DocumentMutator-4vBJQ74L.js +31 -0
- package/chunks/{DocumentScrubber-DrgzBlx4.js → DocumentScrubber-COPepQKE.js} +1 -1
- package/chunks/{DocumentScrubber-W0EfGmL-.js → DocumentScrubber-Cf_QqHhF.js} +1 -1
- package/chunks/DocumentScrubber-DS4LFDKS.js +18 -0
- package/chunks/DocumentStylesheet-byN5dtC6.js +7 -1
- package/chunks/DocxConverter-BCEB7jWY.js +1083 -0
- package/chunks/{DocxConverter-CGYMfz-j.js → DocxConverter-C3NflpDr.js} +2 -2
- package/chunks/{DocxConverter-DabDLfsu.js → DocxConverter-D9ZNn4nX.js} +2 -2
- package/chunks/{DocxGraft-B6W7fbh4.js → DocxGraft-Ba63IRP4.js} +1 -1
- package/chunks/DocxGraft-DjERgl-z.js +7 -0
- package/chunks/{DocxGraft-Cj7v78BO.js → DocxGraft-cYlmw4Ab.js} +1 -1
- package/chunks/{FileImporter-CjUX2S4s.js → FileImporter-CHXj9sNX.js} +1 -1
- package/chunks/{FileImporter-DtkbI6rF.js → FileImporter-DetvRoJc.js} +1 -1
- package/chunks/HorizontalRuleOrnaments-gmUZ3R7Q.js +3 -1
- package/chunks/HtmlConverter-Sd9t49vH.js +267 -0
- package/chunks/ListNumbering-Qlu6AuRZ.js +23 -1
- package/chunks/MarkdownConverter-BdJgh8xt.js +57 -0
- package/chunks/MathRenderer-B0Y1h1JU.js +36 -7
- package/chunks/{OdtConverter-Cnda9T0q.js → OdtConverter-BKtyx012.js} +1 -1
- package/chunks/{OdtConverter-WdwwXKVM.js → OdtConverter-Ce9j8PRt.js} +1 -1
- package/chunks/OdtConverter-D709qfYb.js +31 -0
- package/chunks/ParagraphDiffAnalysis-DrmStvmz.js +36 -0
- package/chunks/PdfConverter-BA8XLTAM.js +21 -0
- package/chunks/PdfConverter-CkDClffR.js +438 -0
- package/chunks/PdfConverter-CxLxd-LJ.js +21 -0
- package/chunks/{PdfImportService-Dj1-3L2B.js → PdfImportService-CQCgsRX1.js} +2 -2
- package/chunks/{PdfImportService-OE9G383I.js → PdfImportService-xl7fstr-.js} +2 -2
- package/chunks/{RtfConverter-D-oqPWNl.js → RtfConverter-BZOnMUGH.js} +1 -1
- package/chunks/{RtfConverter-D9zhE07-.js → RtfConverter-Bs81AfXt.js} +1 -1
- package/chunks/RtfConverter-DfuE5olb.js +45 -0
- package/chunks/TableBorders-Cdkc62cX.js +30 -0
- package/chunks/TableGrid-DbroRucl.js +12 -0
- package/chunks/TextFileDecoder--rsVs3NR.js +9 -2
- package/chunks/{TxtConverter-BYazsp6P.js → TxtConverter-C-oiFUAp.js} +5 -2
- package/chunks/UnicodeUtils-CXtusU4g.js +10 -0
- package/chunks/XmlConverter-C0FnrVYk.js +70 -0
- package/chunks/XmlConverter-CQa8baOF.js +2 -0
- package/chunks/XmlConverter-DjEYaIyf.js +2 -0
- package/chunks/_commonjsHelpers-DaMA6jEr.js +2 -1
- package/chunks/_revise-sdk-lazy-harfbuzz-CDWdjF9f.js +1 -1
- package/chunks/_revise-sdk-lazy-harfbuzz-X8gnYTZL.js +1 -1
- package/chunks/ar-BdmGnaKI.js +14 -0
- package/chunks/backend-BIhAX-Gi.js +484 -0
- package/chunks/base64-Qx0OzT4p.js +196 -0
- package/chunks/browser-module-CFmqfGkE.js +1791 -3
- package/chunks/{browser-module-BbaxnHNK.js → browser-module-CYGCfEyx.js} +1 -1
- package/chunks/{browser-module-D2ixluMg.js → browser-module-DgvTMhpA.js} +1 -1
- package/chunks/bundle.min-DRpfgV69.js +779 -5
- package/chunks/capture-BAJ2in5p.js +9 -0
- package/chunks/carrier-C5VZRMxZ.js +6 -0
- package/chunks/de-DldIXRFC.js +14 -0
- package/chunks/es-CnyKlSPK.js +14 -0
- package/chunks/footnoteFlatten-Bekh8ZfM.js +6 -0
- package/chunks/graftExport-CRRm1Oe_.js +82 -0
- package/chunks/html2canvas.esm-CntiHiYW.js +994 -2
- package/chunks/index-B1idHquf.js +1094 -0
- package/chunks/index-BWdRWxoH.js +1796 -13
- package/chunks/index-C-4H81OE.js +378 -0
- package/chunks/index-iZC8xN0t.js +378 -0
- package/chunks/{index.es-mTU7Sl3w.js → index.es-Bwt05m_b.js} +1 -1
- package/chunks/index.es-CI0QPo8w.js +780 -5
- package/chunks/{index.es-B97tjxvW.js → index.es-DAQD57G4.js} +1 -1
- package/chunks/{jspdf.es.min-Mykp4BZO.js → jspdf.es.min-CnNRolk9.js} +1 -1
- package/chunks/jspdf.es.min-DU74zN8b.js +1747 -32
- package/chunks/{jspdf.es.min-DGiD4mlU.js → jspdf.es.min-DlTF8uTw.js} +1 -1
- package/chunks/jszip.min-CPW0h1Kx.js +476 -2
- package/chunks/katex-DWj8TvwO.js +1209 -8
- package/chunks/pdf-BLWDCiFF.js +1826 -10
- package/chunks/{pseudoLocale-C90lXrPg.js → pseudoLocale-BoJwIubw.js} +1 -1
- package/chunks/{pseudoLocale-UA_TkGrH.js → pseudoLocale-DWAm7Dpa.js} +1 -1
- package/chunks/purify.es-BwLardii.js +107 -2
- package/chunks/serverDocumentSession-DASrQAbW.js +15 -0
- package/chunks/signatures-CBF7NZUy.js +17 -0
- package/chunks/tree-sitter-D6zWWUMP.js +1 -1
- package/chunks/web-tree-sitter-BXGZGnNj.js +2 -1
- package/full.js +1 -1
- package/index.d.ts +31 -12
- package/index.js +1 -1
- package/package.json +1 -1
- package/root.js +2 -2
- package/serverToolContract.d.ts +21 -3
- package/serverToolInputs.generated.d.ts +23 -2
- package/style.css +1 -1
- package/chunks/AttachmentDocumentImporter-BUavYRxO.js +0 -1
- package/chunks/AttachmentDocumentImporter-DGwfDJSH.js +0 -1
- package/chunks/BidiText-D7LYTAUL.js +0 -1
- package/chunks/DocumentMutator-CjN7Kk-X.js +0 -31
- package/chunks/DocumentScrubber-C9ZZEcYW.js +0 -1
- package/chunks/DocxConverter-Be3uPNcD.js +0 -11
- package/chunks/DocxGraft-Duvo2cpy.js +0 -1
- package/chunks/HtmlConverter-ikXImzTY.js +0 -61
- package/chunks/MarkdownConverter-CFrcLyO_.js +0 -17
- package/chunks/OdtConverter-BFT_P8SI.js +0 -1
- package/chunks/PdfConverter-D7UM58vc.js +0 -21
- package/chunks/PdfConverter-TB-QPw29.js +0 -21
- package/chunks/PdfConverter-wVP63986.js +0 -21
- package/chunks/RtfConverter-DZgwU-_R.js +0 -14
- package/chunks/TableBorders-BorZS8aZ.js +0 -1
- package/chunks/TableGrid-DVWaRZv0.js +0 -1
- package/chunks/ar-C8zx2RwP.js +0 -8
- package/chunks/backend-MFpDFVrD.js +0 -1
- package/chunks/base64-BNMNG-lN.js +0 -1
- package/chunks/capture-qC26xmfy.js +0 -1
- package/chunks/carrier-BWONvrA7.js +0 -1
- package/chunks/de-ByQFqecF.js +0 -8
- package/chunks/es-PHpJXv5S.js +0 -8
- package/chunks/footnoteFlatten-Bdnn_bz1.js +0 -1
- package/chunks/graftExport-CP3h2T88.js +0 -2
- package/chunks/index-CjeGoI2g.js +0 -351
- package/chunks/index-D7V8zn4w.js +0 -36
- package/chunks/index-DyOcu9mD.js +0 -351
- package/chunks/serverDocumentSession-CRZSb5SO.js +0 -11
- package/chunks/signatures-CsL_TjvW.js +0 -1
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
import*as w from"yjs";import"y-protocols/awareness";const ir=[{id:"markdown",label:"Markdown",extensions:[".md",".markdown"],mimeType:"text/markdown",binary:!1,import:!0,export:!0},{id:"txt",label:"Pl\
|
|
2
|
+
ain text",extensions:[".txt"],mimeType:"text/plain",binary:!1,import:!0,export:!0},{id:"html",label:"HTML",extensions:[".html",".htm"],mimeType:"text/html",binary:!1,import:!0,export:!0},{id:"docx",label:"\
|
|
3
|
+
Word (DOCX)",extensions:[".docx"],mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",binary:!0,import:!0,export:!0},{id:"pdf",label:"PDF",extensions:[".pdf"],mimeType:"\
|
|
4
|
+
application/pdf",binary:!0,import:!1,export:!0},{id:"rtf",label:"Rich Text Format (RTF)",extensions:[".rtf"],mimeType:"application/rtf",binary:!1,import:!0,export:!1},{id:"xml",label:"XML",extensions:[
|
|
5
|
+
".xml"],mimeType:"application/xml",binary:!1,import:!0,export:!1},{id:"odt",label:"OpenDocument Text (ODT)",extensions:[".odt"],mimeType:"application/vnd.oasis.opendocument.text",binary:!0,import:!0,export:!1}];
|
|
6
|
+
function ar(e){return ir.find(t=>t.extensions.some(n=>e.toLowerCase().endsWith(n)))}async function sr(e,t,n,r){const i={name:t||`document.${n}`,arrayBuffer:async()=>new Uint8Array(e).buffer},s=async()=>(await import("./TextFileDecoder--rsVs3NR.js")).
|
|
7
|
+
decodeTextBytes(e,{kind:n==="html"?"html":"plain",mimeType:r});switch(n){case"xml":return(await import("./XmlConverter-C0FnrVYk.js")).XmlConverter.fromBytes(e);case"markdown":return(await import("./MarkdownConverter-BdJgh8xt.js")).
|
|
8
|
+
MarkdownConverter.fromMarkdown(await s());case"txt":return(await import("./TxtConverter-C-oiFUAp.js")).TxtConverter.fromText(await s());case"html":{const o=await s(),{htmlHasMathMl:a,loadMathMlToLatex:c}=await import("./MathRenderer-B0Y1h1JU.js").
|
|
9
|
+
then(u=>u.f);a(o)&&await c();const{cssNeedsFullColorParser:l,loadFullColorParser:d}=await Promise.resolve().then(()=>_o);return l(o)&&await d(),(await import("./HtmlConverter-Sd9t49vH.js")).HtmlConverter.
|
|
10
|
+
fromHtml(o)}case"docx":{const o=await(await import("./DocxConverter-BCEB7jWY.js")).DocxConverter.parseFile(i,{retainSource:!0}),a=new Uint8Array(e);return o.pendingDocxCarrier={bytes:a,hash:await(await import("./DocxGraft-DjERgl-z.js")).
|
|
11
|
+
hashBytes(a)},o}case"rtf":return(await import("./RtfConverter-DfuE5olb.js")).RtfConverter.parseFile(i);case"odt":return(await import("./OdtConverter-D709qfYb.js")).OdtConverter.parseFile(i);default:throw new Error(
|
|
12
|
+
"This format does not support headless import: "+n)}}async function Xt(e,t,n={}){switch(t){case"markdown":return(await import("./MarkdownConverter-BdJgh8xt.js")).MarkdownConverter.toMarkdown(e);case"t\
|
|
13
|
+
xt":return(await import("./TxtConverter-C-oiFUAp.js")).TxtConverter.toText(e,n.text);case"html":return(await import("./HtmlConverter-Sd9t49vH.js")).HtmlConverter.toStyledHtml(e,n.html);case"docx":return(await import("./DocxConverter-BCEB7jWY.js")).
|
|
14
|
+
DocxConverter.toBlob(e,n.syntaxTheme,n.docx);case"pdf":return(await import("./PdfConverter-CkDClffR.js")).PdfConverter.toBlob(e,n.title,n.syntaxTheme);default:throw new Error("This format is import-on\
|
|
15
|
+
ly: "+t)}}class cr extends Error{constructor(t){super(t.message),this.failure=t,this.name="ReviseToolError",this.callId=t.callId,this.tool=t.tool,this.code=t.code}}const ae=["lineSpacing","spaceBefore",
|
|
16
|
+
"spaceAfter"];function lr(e,t){for(const n of ae)t[n]!==void 0?e.setAttribute(n,String(t[n])):e.doc&&e.removeAttribute(n)}const $t=128,ur=1<<29,j=(e,t)=>e>>>t|e<<32-t,dr=e=>j(e,2)^j(e,13)^j(e,22),fr=e=>j(
|
|
17
|
+
e,6)^j(e,11)^j(e,25),gr=e=>j(e,7)^j(e,18)^e>>>3,pr=e=>j(e,17)^j(e,19)^e>>>10,mr=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,
|
|
18
|
+
607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,
|
|
19
|
+
3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,
|
|
20
|
+
430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),hr=new Uint32Array([1779033703,
|
|
21
|
+
3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class br{constructor(){const t=new ArrayBuffer(320);this._H=new Uint32Array(t,0,8),this._H.set(hr),this._W=new Uint32Array(
|
|
22
|
+
t,64,64)}_updateHash(){const t=this._H,n=this._W;for(let u=16;u<64;u++)n[u]=pr(n[u-2])+n[u-7]+gr(n[u-15])+n[u-16];let r=t[0],i=t[1],s=t[2],o=t[3],a=t[4],c=t[5],l=t[6],d=t[7];for(let u=0,g,p;u<64;u++)g=
|
|
23
|
+
d+fr(a)+(a&c^~a&l)+mr[u]+n[u]>>>0,p=dr(r)+(r&i^r&s^i&s)>>>0,d=l,l=c,c=a,a=o+g>>>0,o=s,s=i,i=r,r=g+p>>>0;t[0]+=r,t[1]+=i,t[2]+=s,t[3]+=o,t[4]+=a,t[5]+=c,t[6]+=l,t[7]+=d}digest(t){let n=0;for(;n+56<=t.length;){
|
|
24
|
+
let o=0;for(;o<16&&n+3<t.length;o++)this._W[o]=t[n++]<<24|t[n++]<<16|t[n++]<<8|t[n++];if(n%64!==0){for(this._W.fill(0,o,16);n<t.length;)this._W[o]|=t[n]<<(3-n%4)*8,n++;this._W[o]|=$t<<(3-n%4)*8}this._updateHash()}
|
|
25
|
+
const r=n%64!==0;this._W.fill(0,0,16);let i=0;for(;n<t.length;i++)for(let o=3;o>=0&&n<t.length;o--)this._W[i]|=t[n++]<<o*8;r||(this._W[i-(n%4===0?0:1)]|=$t<<(3-n%4)*8),this._W[14]=t.byteLength/ur,this.
|
|
26
|
+
_W[15]=t.byteLength*8,this._updateHash();const s=new Uint8Array(32);for(let o=0;o<this._H.length;o++)for(let a=0;a<4;a++)s[o*4+a]=this._H[o]>>>(3-a)*8;return s}}const yr=e=>new br().digest(e),ve="revi\
|
|
27
|
+
se:styles:v1",zt="sharedStylesVersion",xr=Symbol.for("revise.shared-styles.migration"),E="_reviseTextStyle",Pe="_reviseParagraphStyle",wr=Object.freeze({_reviseStyleUnset:1}),z=new Set(["fontFamily","\
|
|
28
|
+
fontSize","bold","italic","underline","strikethrough","doubleStrikethrough","smallCaps","allCaps","superscript","subscript","hidden","color","backgroundColor","letterSpacing","lang","code","docxRunPro\
|
|
29
|
+
pertyResets","oxmlRPr"]),se=new Set(["align","lineSpacing","spaceBefore","spaceAfter","contextualSpacing","direction","tabStops","borders","shading","leftIndent","firstLineIndent","pagination"]);class J extends Error{constructor(){
|
|
30
|
+
super(...arguments),this.name="SharedStyleError"}}function qe(e){return JSON.stringify(Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null).sort(([t],[n])=>t<n?-1:t>n?1:0)))}function Dt(e,t){return`${e}\
|
|
31
|
+
:${Array.from(yr(new TextEncoder().encode(t)).subarray(0,16),n=>n.toString(16).padStart(2,"0")).join("")}`}function D(e){return!!e?.share.has("metadata")&&e.getMap("metadata").get(zt)===1}function Ve(e,t,n){
|
|
32
|
+
const r=qe(n),i=Dt(t,r),s=e.getMap(ve),o=s.get(i);if(o!==void 0&&o!==r)throw new J("Shared style identity collision or modified definition");return o===void 0&&s.set(i,r),i}const Gt=new WeakMap;function Je(e,t,n){
|
|
33
|
+
if(t==null)return{};if(!e||typeof t!="string"||!t.startsWith(`${n}:`))throw new J("Invalid shared style reference");const r=e.getMap(ve).get(t);if(typeof r!="string")throw new J("Missing shared style \
|
|
34
|
+
definition; resync the document");let i=Gt.get(e);i||Gt.set(e,i=new Map);const s=i.get(t);if(s?.json===r)return s.marks;if(Dt(n,r)!==t)throw new J("Modified shared style definition");const o=JSON.parse(
|
|
35
|
+
r),a=n==="t"?z:se;if(!o||typeof o!="object"||Array.isArray(o)||Object.entries(o).some(([c,l])=>!a.has(c)||!["string","number","boolean"].includes(typeof l)))throw new J("Invalid shared style propertie\
|
|
36
|
+
s");return Object.freeze(o),i.size>=4096&&i.clear(),i.set(t,{json:r,marks:o}),o}function kr(e,t={}){const n={...Je(e.doc,t[E],"t"),...t};delete n[E];for(const[r,i]of Object.entries(t))z.has(r)&&i!==null&&
|
|
37
|
+
typeof i=="object"&&i._reviseStyleUnset===1&&Object.keys(i).length===1&&delete n[r];return n}function ce(e){if(!D(e.doc))return e.toDelta();const t=[];for(const n of e.toDelta()){const r=kr(e,n.attributes),
|
|
38
|
+
i={...n};Object.keys(r).length?i.attributes=r:delete i.attributes;const s=t[t.length-1];s&&typeof s.insert=="string"&&typeof i.insert=="string"&&qe(s.attributes??{})===qe(i.attributes??{})?s.insert+=i.
|
|
39
|
+
insert:t.push(i)}return t}function Wt(e,t,n,r){if(E in r)throw new J("Existing style bases are immutable");if(!e.doc||!D(e.doc)||!Object.keys(r).some(i=>z.has(i))){e.format(t,n,r);return}e.doc.transact(
|
|
40
|
+
()=>{let i=t;for(const s of _t(e,t,n,r))e.format(i,s.retain,s.attributes),i+=s.retain})}function _t(e,t,n,r){if(!Object.entries(r).some(([o,a])=>z.has(o)&&a===null))return[{retain:n,attributes:r}];const i=[];
|
|
41
|
+
let s=0;for(const o of e.toDelta()){const a=s+(typeof o.insert=="string"?o.insert.length:1),c=Math.min(a,t+n)-Math.max(s,t);if(c>0){const l=Je(e.doc,o.attributes?.[E],"t");i.push({retain:c,attributes:Object.
|
|
42
|
+
fromEntries(Object.entries(r).map(([d,u])=>[d,z.has(d)&&u===null&&d in l?wr:u]))})}if(s=a,s>=t+n)break}return i}function Ae(e,t){const n=Object.fromEntries(Object.entries(t).filter(([i,s])=>z.has(i)&&
|
|
43
|
+
s!==null&&s!==void 0));if(Object.keys(n).length<2)return{...t};const r=Object.fromEntries(Object.entries(t).filter(([i])=>!z.has(i)));return r[E]=Ve(e,"t",n),r}function le(e,t,n,r){if(!r||!e.doc||!D(e.
|
|
44
|
+
doc)){e.insert(t,n,r);return}e.doc.transact(()=>e.insert(t,n,Ae(e.doc,r)))}function Sr(e,t,n){if(!e.doc||!D(e.doc)){e.applyDelta(t,n);return}e.doc.transact(()=>{let r=0;const i=t.flatMap(s=>{const o=r;
|
|
45
|
+
return s.retain!==void 0?r+=s.retain:s.delete!==void 0&&(r+=s.delete),s.attributes?s.insert!==void 0?[{...s,attributes:Ae(e.doc,s.attributes)}]:s.retain!==void 0?_t(e,o,s.retain,s.attributes):[s]:[s]});
|
|
46
|
+
e.applyDelta(i,n)})}function K(e,t){const n=e.getAttribute(t);return n!=null||!se.has(t)||!e.doc?n:Je(e.doc,e.getAttribute(Pe),"p")[t]}function Ke(e,t){e.doc&&D(e.doc)&&se.has(t)?e.setAttribute(t,""):
|
|
47
|
+
e.removeAttribute(t)}function vr(e,t){const n=Object.fromEntries(Object.entries(t).filter(([r,i])=>se.has(r)&&i!==""));return Object.keys(n).length<2?t:{...Object.fromEntries(Object.entries(t).filter(
|
|
48
|
+
([r])=>!(r in n))),[Pe]:Ve(e,"p",n)}}function Pr(e,t){if(!t.exclusive)throw new J("Shared style migration requires exclusive access");let n=0,r=0;const i=e.getMap(ve).size;return e.transact(()=>{D(e)||
|
|
49
|
+
e.getMap("metadata").set(zt,1);const s=o=>{if(o?.constructor?.name==="YXmlText"||o?.constructor?.name==="YText"){let a=0;for(const c of o.toDelta()){const l=typeof c.insert=="string"?c.insert.length:1,
|
|
50
|
+
d=c.attributes??{};if(!d[E]){const u=Ae(e,d);if(u[E]){const g={[E]:u[E]};for(const p of Object.keys(d))z.has(p)&&(g[p]=null);o.format(a,l,g),n++}}a+=l}}else if(typeof o?.toArray=="function"){if(o.nodeName===
|
|
51
|
+
"paragraph"&&!o.getAttribute(Pe)){const a={};for(const c of se){const l=o.getAttribute(c);typeof l=="string"&&l!==""&&(a[c]=l)}if(Object.keys(a).length>=2){o.setAttribute(Pe,Ve(e,"p",a));for(const c of Object.
|
|
52
|
+
keys(a))o.removeAttribute(c);r++}}for(const a of o.toArray())s(a)}};for(const o of["content","chrome","notes"])e.share.has(o)&&s(e.getXmlFragment(o))},xr),{textSpans:n,paragraphs:r,definitions:e.getMap(
|
|
53
|
+
ve).size-i}}const Ar=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]];function Ut(e){if(!Number.isFinite(e)||e<1)return"";let t=Math.
|
|
54
|
+
floor(e),n="";for(const[r,i]of Ar)for(;t>=r;)n+=i,t-=r;return n}function Nr(e){if(!/^[mdclxvi]+$/.test(e))return null;const t={m:1e3,d:500,c:100,l:50,x:10,v:5,i:1};let n=0;for(let r=0;r<e.length;r++){
|
|
55
|
+
const i=t[e[r]],s=t[e[r+1]]??0;n+=i<s?-i:i}return Ut(n)===e?n:null}function Ir(e,t){return t==="endnote"?Ut(e):String(e)}function Mr(e){return/^\d+$/.test(e)?"footnote":Nr(e)!==null?"endnote":"footnot\
|
|
56
|
+
e"}const Ht=10*(96/72);function Cr(e){const t=n=>{if(!n||typeof n!="object")return;if(Array.isArray(n)){n.forEach(t);return}const r=n;if(r.type==="text"){typeof r.marks?.fontSize!="number"&&(r.marks={
|
|
57
|
+
...r.marks??{},fontSize:Ht});return}t(r.children)};t(e)}function qt(e){const t=e.notes;if(!t||t.length===0)return;const n=new Map;let r;const i=a=>{if(!a||typeof a!="object")return;if(Array.isArray(a)){
|
|
58
|
+
for(const l of a)i(l);return}const c=a;if(c.type==="text"){r===void 0&&typeof c.text=="string"&&c.text.length>0&&(r=c.marks?.fontFamily),c.marks?.footnoteRef&&!n.has(c.marks.footnoteRef)&&n.set(c.marks.
|
|
59
|
+
footnoteRef,c.marks?.fontFamily);return}c.children&&i(c.children)};i(e.children);let s=!1;const o=t.map(a=>{const c=a.id,l=n.has(c)?n.get(c)??r:r;let d=!1;const u=a.children.map(g=>{if(g.type!=="parag\
|
|
60
|
+
raph"||!Array.isArray(g.children))return g;let p=!1;const f=g.children.map(h=>{if(h.type!=="text")return h;const b=h.marks??{};if(b.fontFamily===l||l===void 0&&b.fontFamily===void 0)return h;p=!0;const x={
|
|
61
|
+
...b};return l===void 0?delete x.fontFamily:x.fontFamily=l,{...h,marks:x}});return p?(d=!0,{...g,children:f}):g});return d?(s=!0,{...a,children:u}):a});s&&(e.notes=o)}const Vt=["bold","italic","underl\
|
|
62
|
+
ine","strikethrough","doubleStrikethrough","smallCaps","allCaps","hidden","letterSpacing","lang","code","latex","superscript","subscript","fontSize","color","backgroundColor","fontFamily","link","foot\
|
|
63
|
+
noteRef","footnotePendingBody","footnotePendingKind","sdtInline"],Fr=[...Vt,"aiGenerated","comment","field","bookmark","fieldInstr","oxmlRange","docxRunPropertyResets","oxmlRPr","__htmlClassName"],Tr=[
|
|
64
|
+
"bold","italic","underline","strikethrough","doubleStrikethrough","smallCaps","allCaps","hidden","letterSpacing","code","latex","superscript","subscript","fontFamily","fontSize","color","backgroundCol\
|
|
65
|
+
or","link","footnotePendingBody"],Rr=["bold","italic","underline","strikethrough","doubleStrikethrough","smallCaps","allCaps","letterSpacing","code","superscript","subscript","fontSize","color","backg\
|
|
66
|
+
roundColor","fontFamily","oxmlRPr"];function Or(e){if(!e)return;const t={};for(const n of Rr)n in e&&e[n]!==void 0&&e[n]!==!1&&(t[n]=e[n]);return e.footnoteRef&&delete t.superscript,Object.keys(t).length>
|
|
67
|
+
0?t:void 0}const jr=["align","heading","leftIndent","firstLineIndent","lineSpacing","spaceBefore","spaceAfter","contextualSpacing","keepNext","keepLines","widowControl","styleId","direction","borders",
|
|
68
|
+
"shading","tabStops"];function Lr(e,t){return jr.every(n=>e[n]===t[n])}const ue={style:"single",width:1,color:"#A6A6A6"};function Jt(e={}){return JSON.stringify({bottom:{...ue,...e}})}const Er={thin:{},
|
|
69
|
+
thick:{width:3},double:{style:"double"},dashed:{style:"dashed"},dotted:{style:"dotted",width:2},stars:{style:"stars"},diamonds:{style:"diamonds"}},Br=[{pattern:/^-\*\*-$/,style:"stars",contexts:["typi\
|
|
70
|
+
ng","markdown"]},{pattern:/^-<>-$/,style:"diamonds",contexts:["typing","markdown"]},{pattern:/^-{3,}$/,style:"thin",contexts:["typing"]},{pattern:/^_{3,}$/,style:"thick",contexts:["typing"]},{pattern:/^={3,}$/,
|
|
71
|
+
style:"double",contexts:["typing"]},{pattern:/^\*{3,}$/,style:"dotted",contexts:["typing"]},{pattern:/^([-*_])[ \t]*(?:\1[ \t]*){2,}$/,style:"thin",contexts:["markdown"]}];function Xr(e,t){let n;{if(/^ {4,}/.
|
|
72
|
+
test(e))return null;n=e.trim()}for(const r of Br)if(r.contexts.includes(t)&&r.pattern.test(n))return r.style;return null}const $r=new Set(["single","dashed","dotted","double","none","stars","diamonds"]);
|
|
73
|
+
function Kt(e){if(e.type!=="paragraph"||!e.borders||e.shading!==void 0||e.heading!==void 0||e.styleId!==void 0||e.align!==void 0||e.leftIndent!==void 0||e.firstLineIndent!==void 0||e.tabStops!==void 0||
|
|
74
|
+
e.children.some(s=>s.text!==""))return null;let t;try{t=JSON.parse(e.borders)}catch{return null}const n=s=>s!=null&&s.style!=="none",r=t?.bottom;if(!n(r)||n(t.top)||n(t.left)||n(t.right))return null;const i=r.
|
|
75
|
+
style;return{style:i&&$r.has(i)?i:ue.style,width:r.width??ue.width,color:r.color??ue.color}}const zr=e=>Kt(e)!==null,Dr=new Set(["left","right","center","decimal"]),Gr=new Set(["dot","hyphen","undersc\
|
|
76
|
+
ore"]),Ne=new Map,Wr=512;function _r(e){if(!e)return null;const t=Ne.get(e);if(t!==void 0)return t;let n=null;try{const r=JSON.parse(e);if(Array.isArray(r)){const i=[];for(const s of r)if(s&&typeof s==
|
|
77
|
+
"object"&&typeof s.pos=="number"&&Number.isFinite(s.pos)&&s.pos>=0&&typeof s.align=="string"&&Dr.has(s.align)){const o={pos:s.pos,align:s.align};typeof s.leader=="string"&&Gr.has(s.leader)&&(o.leader=
|
|
78
|
+
s.leader),i.push(o)}i.length>0&&(i.sort((s,o)=>s.pos-o.pos),n=i)}}catch{n=null}return Ne.size>=Wr&&Ne.clear(),Ne.set(e,n),n}function Ie(e){const t=[];return e.keepNext&&t.push("keepNext"),e.keepLines&&
|
|
79
|
+
t.push("keepLines"),e.widowControl===!1&&t.push("noWidow"),t.length>0?t.join(","):void 0}function Me(e,t){if(!t)return;const n=new Set(t.split(","));n.has("keepNext")&&(e.keepNext=!0),n.has("keepLines")&&
|
|
80
|
+
(e.keepLines=!0),n.has("noWidow")&&(e.widowControl=!1)}function Ur(e,t){return e.variant===t.variant&&e.startNumber===t.startNumber&&e.numberingChainId===t.numberingChainId&&e.numberingFormat===t.numberingFormat&&
|
|
81
|
+
e.lineSpacing===t.lineSpacing&&e.spaceBefore===t.spaceBefore&&e.spaceAfter===t.spaceAfter&&e.contextualSpacing===t.contextualSpacing}const Yt=e=>"type"in e&&e.type==="doc",Hr=e=>Yt(e)?!0:"type"in e?e.
|
|
82
|
+
type==="container"||e.type==="footnote"||e.type==="header-footer"||e.type==="table-cell":!1;function P(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let t="";for(let n=0;n<
|
|
83
|
+
6;n++)t+=e.charAt(Math.floor(Math.random()*e.length));return t}function qr(e=[{type:"text",text:"",marks:{}}]){return{type:"paragraph",id:P(),children:e}}function Vr(e,t={}){return{type:"math",id:P(),
|
|
84
|
+
content:e,displayMode:t.displayMode??"block",align:t.align??"center"}}function Jr(e){return{type:"paragraph",id:P(),children:[{type:"text",text:"",marks:{}}],borders:Jt(e)}}const Ye=[{value:"arial",label:"\
|
|
85
|
+
Arial",cssValue:"Arial, sans-serif"},{value:"helvetica",label:"Helvetica",cssValue:"Helvetica, Arial, sans-serif"},{value:"times",label:"Times New Roman",cssValue:"'Times New Roman', Times, serif"},{value:"\
|
|
86
|
+
computermodern",label:"Computer Modern",cssValue:"KaTeX_Main, 'Times New Roman', serif"},{value:"georgia",label:"Georgia",cssValue:"Georgia, serif"},{value:"sourceserif4",label:"Source Serif 4",cssValue:"\
|
|
87
|
+
'Source Serif 4', serif"},{value:"garamond",label:"Garamond",cssValue:"Garamond, 'Times New Roman', serif"},{value:"palatino",label:"Palatino",cssValue:"'Palatino Linotype', Palatino, serif"},{value:"\
|
|
88
|
+
bookman",label:"Bookman",cssValue:"'Bookman Old Style', Bookman, serif"},{value:"verdana",label:"Verdana",cssValue:"Verdana, Geneva, sans-serif"},{value:"trebuchet",label:"Trebuchet MS",cssValue:"'Tre\
|
|
89
|
+
buchet MS', Helvetica, sans-serif"},{value:"courier",label:"Courier New",cssValue:"'Courier New', Courier, monospace"},{value:"lucida",label:"Lucida Console",cssValue:"'Lucida Console', Monaco, monosp\
|
|
90
|
+
ace"},{value:"impact",label:"Impact",cssValue:"Impact, Charcoal, sans-serif"},{value:"comicsans",label:"Comic Sans MS",cssValue:"'Comic Sans MS', cursive"}];function Kr(e){if(!e||e==="default")return"\
|
|
91
|
+
Arial, sans-serif";const t=Ye.find(n=>n.value.includes(e.split(",")[0].trim()));return t?t.cssValue:"inherit"}const Qt={calibri:"'Calibri', 'Carlito', 'Helvetica Neue', Arial, sans-serif",cambria:"'Ca\
|
|
92
|
+
mbria', 'Caladea', Georgia, serif",aptos:"'Aptos', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif","segoe ui":"'Segoe UI', 'Helvetica Neue', Arial, sans-serif",candara:"'Candara', 'Trebuchet MS', san\
|
|
93
|
+
s-serif",constantia:"'Constantia', Georgia, serif",corbel:"'Corbel', 'Segoe UI', sans-serif",tahoma:"Tahoma, 'Segoe UI', Geneva, sans-serif","franklin gothic":"'Franklin Gothic', 'Franklin Gothic Medi\
|
|
94
|
+
um', 'Arial Narrow', sans-serif","franklin gothic medium":"'Franklin Gothic Medium', 'Arial Narrow', sans-serif","century gothic":"'Century Gothic', 'Avant Garde', 'Futura', sans-serif","book antiqua":"\
|
|
95
|
+
'Book Antiqua', 'Palatino Linotype', Palatino, serif","century schoolbook":"'Century Schoolbook', 'New Century Schoolbook', serif","sitka text":"'Sitka Text', Georgia, serif",consolas:"Consolas, Menlo\
|
|
96
|
+
, Monaco, 'Courier New', monospace","helvetica neue":"'Helvetica Neue', Helvetica, Arial, sans-serif",avenir:"Avenir, 'Avenir Next', 'Century Gothic', sans-serif","avenir next":"'Avenir Next', Avenir,\
|
|
97
|
+
'Century Gothic', sans-serif",futura:"Futura, 'Century Gothic', sans-serif","gill sans":"'Gill Sans', 'Gill Sans MT', Calibri, sans-serif",optima:"Optima, Candara, 'Segoe UI', sans-serif",baskerville:"\
|
|
98
|
+
Baskerville, 'Libre Baskerville', Georgia, serif",didot:"Didot, 'Bodoni MT', Georgia, serif","hoefler text":"'Hoefler Text', Baskerville, Georgia, serif",charter:"Charter, 'Bitstream Charter', Georgia\
|
|
99
|
+
, serif","american typewriter":"'American Typewriter', 'Courier New', monospace",menlo:"Menlo, Consolas, Monaco, monospace",monaco:"Monaco, Menlo, Consolas, monospace",seravek:"Seravek, 'Segoe UI', sa\
|
|
100
|
+
ns-serif",roboto:"Roboto, 'Helvetica Neue', Arial, sans-serif","open sans":"'Open Sans', 'Segoe UI', Arial, sans-serif",lato:"Lato, 'Helvetica Neue', Arial, sans-serif",montserrat:"Montserrat, 'Centur\
|
|
101
|
+
y Gothic', sans-serif",inter:"Inter, 'Helvetica Neue', Arial, sans-serif","source sans pro":"'Source Sans Pro', 'Segoe UI', sans-serif","noto sans":"'Noto Sans', 'Helvetica Neue', Arial, sans-serif","\
|
|
102
|
+
noto serif":"'Noto Serif', Georgia, serif","pt serif":"'PT Serif', Georgia, serif","pt sans":"'PT Sans', 'Helvetica Neue', Arial, sans-serif",merriweather:"Merriweather, Georgia, serif","liberation sa\
|
|
103
|
+
ns":"'Liberation Sans', Arial, sans-serif","liberation serif":"'Liberation Serif', 'Times New Roman', serif",carlito:"'Carlito', 'Calibri', 'Helvetica Neue', sans-serif",caladea:"'Caladea', 'Cambria',\
|
|
104
|
+
Georgia, serif"},Yr=["times","georgia","garamond","cambria","palatino","antiqua","baskerville","didot","bodoni","hoefler","charter","constantia","caladea","schoolbook","sitka","minion","merriweather",
|
|
105
|
+
"playfair","caslon","sabon","utopia","serif"],Qr=["mono","courier","consol","menlo","monaco","typewriter","code","andale"];function Qe(e){const t=e.toLowerCase();return Qr.some(n=>t.includes(n))?"mono\
|
|
106
|
+
space":Yr.some(n=>t.includes(n))?"serif":"sans-serif"}function G(e){return e.trim().replace(/^["']|["']$/g,"")}function Ze(e){return/[^a-zA-Z0-9-]/.test(e)?`'${e}'`:e}const et=new Map,Zr=["'Revise Not\
|
|
107
|
+
o SC'","'Revise Noto JP'","'Revise Noto KR'","'Revise Han Ext B'","'Revise Noto Arabic'","'Revise Noto Hebrew'","'Revise Noto Devanagari'","'Revise Noto Bengali'","'Revise Noto Gurmukhi'","'Revise Not\
|
|
108
|
+
o Gujarati'","'Revise Noto Oriya'","'Revise Noto Tamil'","'Revise Noto Telugu'","'Revise Noto Kannada'","'Revise Noto Malayalam'","'Revise Noto Sinhala'","'Revise Noto Thai'","'Revise Noto Lao'","'Rev\
|
|
109
|
+
ise Noto Khmer'","'Revise Noto Myanmar'","'Revise Noto Armenian'","'Revise Noto Kartvelian'","'Revise Noto Ethiopic'","'Revise Noto Syriac'","'Revise Noto Thaana'","'Revise Noto Tibetan'","'Revise Not\
|
|
110
|
+
o Symbols'","'Revise Noto Symbols 2'","'Revise Noto Emoji'"],Zt=Zr.join(", ");function eo(e){const t=e?.toLowerCase().split(/[-_]/)[0];if(t==="ja")return"'Revise Noto JP'";if(t==="ko")return"'Revise N\
|
|
111
|
+
oto KR'";if(t==="zh")return"'Revise Noto SC'"}function to(e){if(e.includes("Revise Noto"))return e;const t=e.split(","),n=t.at(-1)?.trim();return n&&Ce.has(G(n).toLowerCase())?`${t.slice(0,-1).join(",")}\
|
|
112
|
+
, ${Zt}, ${n}`:`${e}, ${Zt}`}let tt={};function en(e){!e||Object.keys(e).length===0||(tt={...tt,...e},et.clear())}function no(e){const t=tt[e.toLowerCase()];if(!t)return;const n=[Ze(e)];if(t.alt&&t.alt.
|
|
113
|
+
toLowerCase()!==e.toLowerCase()){const r=Qt[t.alt.toLowerCase()];n.push(r??Ze(t.alt))}return n.push(t.generic??Qe(e)),ro(n.join(", "))}function ro(e){const t=e.split(",").map(a=>a.trim()).filter(Boolean),
|
|
114
|
+
n=t.filter(a=>Ce.has(G(a).toLowerCase())),r=t.filter(a=>!Ce.has(G(a).toLowerCase())),i=new Set,s=r.filter(a=>{const c=G(a).toLowerCase();return i.has(c)?!1:(i.add(c),!0)}),o=n.at(-1);return o?[...s,o].
|
|
115
|
+
join(", "):s.join(", ")}function oo(e){const t=et.get(e);if(t!==void 0)return t;let n;if(e.includes(","))n=e;else{const r=G(e);n=Qt[r.toLowerCase()]??no(r)??`${Ze(r)}, ${Qe(r)}`}return n=to(n),et.set(
|
|
116
|
+
e,n),n}const Ce=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]),tn="mmmmmmmmmmlliWQ@#0123456789",nn=72;let Q;function io(){
|
|
117
|
+
if(Q!==void 0)return Q;if(typeof document>"u")return Q=null,null;try{const e=document.createElement("canvas");e.width=4,e.height=4,Q=e.getContext("2d")}catch{Q=null}return Q??null}const rn=new Map;function ao(e){
|
|
118
|
+
const t=G(e.split(",")[0]);if(!t)return!1;if(Ce.has(t.toLowerCase()))return!0;const n=t.toLowerCase(),r=rn.get(n);if(r!==void 0)return r;const i=io();if(!i)return!1;let s=!1;try{for(const o of["monosp\
|
|
119
|
+
ace","sans-serif","serif"]){i.font=`${nn}px ${o}`;const a=i.measureText(tn).width;i.font=`${nn}px '${t}', ${o}`;const c=i.measureText(tn).width;if(a>0&&Math.abs(c-a)>.5){s=!0;break}}}catch{s=!1}return rn.
|
|
120
|
+
set(n,s),s}function so(){return typeof window<"u"&&"queryLocalFonts"in window}let de=null;async function co(){if(de)return de;const e=await window.queryLocalFonts();return de=e,e}async function lo(){if(!so())
|
|
121
|
+
return"denied";try{return(await navigator.permissions.query({name:"local-fonts"})).state}catch{return"prompt"}}async function uo(){return de?!0:await lo()==="granted"}async function fo(){return de||(await uo()?
|
|
122
|
+
await co():null)}function go(e){if(e.length<4)return"unknown";const t=String.fromCharCode(e[0],e[1],e[2],e[3]);return t==="OTTO"?"otf":t==="ttcf"?"ttc":t==="true"||e[0]===0&&e[1]===1&&e[2]===0&&e[3]===
|
|
123
|
+
0?"ttf":"unknown"}function po(e){const t=(e??"").toLowerCase();return{bold:t.includes("bold")||t.includes("black")||t.includes("heavy"),italic:t.includes("italic")||t.includes("oblique")}}const mo=new Set(
|
|
124
|
+
Ye.map(e=>G(e.cssValue.split(",")[0]).toLowerCase()));function ho(e){const t=new Map,n=i=>{const s=i.marks?.fontFamily;if(!s)return;const o=G(s.split(",")[0]);if(!o)return;const a=o.toLowerCase();t.has(
|
|
125
|
+
a)||t.set(a,{value:s,family:o,available:ao(o),builtin:mo.has(a)})},r=i=>{if(!(!i||typeof i!="object")){if(i.type==="text"){n(i);return}if(Array.isArray(i.children))for(const s of i.children)r(s)}};for(const i of e.
|
|
126
|
+
children)r(i);for(const i of e.chrome??[])r(i);for(const i of e.notes??[])r(i);return Array.from(t.values())}const Fe=["bold","italic","underline","strikethrough","doubleStrikethrough","smallCaps","al\
|
|
127
|
+
lCaps","hidden","superscript","subscript"],bo=new Set(["color","highlight"]);function yo(e){return Fe.filter(t=>e[t]===!1)}function on(e){const t=Array.from(new Set((e??"").split(",").map(n=>n.trim()).
|
|
128
|
+
filter(n=>bo.has(n)))).sort();return t.length>0?t.join(","):void 0}function xo(e,t,n){const r=new Set((t??"").split(",").map(s=>s.trim()).filter(Boolean));for(const s of Fe)r.has(s)&&(e[s]=!1);const i=on(
|
|
129
|
+
n);i&&(e.docxRunPropertyResets=i)}const fe="Arial, sans-serif",wo=new Set(Fe);function nt(e){const t=an(e);for(const n of wo)e?.[n]===!1&&(t[n]=!1);return t}function an(e){const t={};for(const[n,r]of Object.
|
|
130
|
+
entries(e??{}))r===!0?t[n]=!0:(typeof r=="string"&&r!==""||typeof r=="number")&&(t[n]=r);return t.fontFamily||(t.fontFamily=fe),t}function ko(e){const t=e;return JSON.stringify(Object.keys(t).sort().map(
|
|
131
|
+
n=>[n,t[n]]))}function sn(e){const t=[];let n=null;for(const r of e){const i=ko(r.marks??{}),s=t[t.length-1];if(s&&i===n){t[t.length-1]={...s,text:s.text+r.text};continue}t.push(r),n=i}return t}const So=72/
|
|
132
|
+
96,vo={paddingPx:16,borderColor:"#cccccc",borderWidthPx:1},Po={cellPaddingPx:8,borderColor:"#cccccc",borderWidthPx:1},Ao={maxIndentLevel:2,sublistIndentPx:20,markerWidthPx:20,variantIndentPx:{todo:35,
|
|
133
|
+
ordered:30,unordered:25},todoCheckboxSizePx:16,todoCheckboxRadiusPx:3,todoCheckboxOffsetPx:4},No={fontSizePx:14,lineHeightMultiplier:1.5,paddingPx:12,borderRadiusPx:4,diagramMinHeightPx:120,diagramSourceGapPx:10},
|
|
134
|
+
Io={gutterPx:26,verticalPaddingPx:4,blockSpacingPx:2,separatorSpacePx:18,inlineEndnoteGapPx:10,separatorToContentPx:12,newPageSeparatorOffsetPx:6,minimumBodyLinesBeforeFootnotes:2,bodyKeepSlackPx:6,separatorWidthMinPx:96,
|
|
135
|
+
separatorWidthFraction:.3},W={paddingYPx:10,levelIndentPx:24,pageNumberGapPx:6,labelClipGapPx:12,leaderStartGapPx:4,minimumLeaderWidthPx:8},Mo={displayHeightPx:20,indicatorInsetXPx:0,indicatorWidthPx:36,
|
|
136
|
+
caretOffsetXPx:12,iconInsetXPx:2,iconInsetYPx:2},Co={blockInsertMarkerMarginXPx:16,blockInsertMarkerOffsetYPx:13,blockInsertMarkerArmPx:4,blockInsertMarkerLineWidthPx:2,breakTintOpacity:.12,breakIconOpacity:.55,
|
|
137
|
+
tocTintOpacity:.08,placeholderTintOpacity:.25,tableTintOpacity:{insert:.08,delete:.06},tableRowTintOpacity:{insert:.2,delete:.15},tableRowRailOpacity:.8,tableCellRailWidthPx:2,pendingBreakLabelFontSizePx:10,
|
|
138
|
+
pendingBreakRuleStartPx:24,pendingBreakLabelGapPx:8,pendingBreakDashPx:3,pendingBreakRuleOpacity:.65,pendingBreakLabelOpacity:.9};let Z=null,rt=null;function cn(){return Z?Promise.resolve(Z):(rt||(rt=
|
|
139
|
+
import("./ColorParserFull-BKH72fK8.js").then(e=>(Z=e.parseCssColorFull,Z))),rt)}const Fo=/\b(?:hwb|lab|lch|oklab|oklch|color|color-mix|device-cmyk|calc|var)\s*\(|\b(?:rgba?|hsla?)\s*\([^)]*(?:%|deg|rad|grad|turn|none)/i;
|
|
140
|
+
function To(e){return Fo.test(e)}const Ro=Object.fromEntries("aliceblue:f0f8ff,antiquewhite:faebd7,aqua:00ffff,aquamarine:7fffd4,azure:f0ffff,beige:f5f5dc,bisque:ffe4c4,black:000000,blanchedalmond:ffe\
|
|
141
|
+
bcd,blue:0000ff,blueviolet:8a2be2,brown:a52a2a,burlywood:deb887,cadetblue:5f9ea0,chartreuse:7fff00,chocolate:d2691e,coral:ff7f50,cornflowerblue:6495ed,cornsilk:fff8dc,crimson:dc143c,cyan:00ffff,darkbl\
|
|
142
|
+
ue:00008b,darkcyan:008b8b,darkgoldenrod:b8860b,darkgray:a9a9a9,darkgreen:006400,darkgrey:a9a9a9,darkkhaki:bdb76b,darkmagenta:8b008b,darkolivegreen:556b2f,darkorange:ff8c00,darkorchid:9932cc,darkred:8b\
|
|
143
|
+
0000,darksalmon:e9967a,darkseagreen:8fbc8f,darkslateblue:483d8b,darkslategray:2f4f4f,darkslategrey:2f4f4f,darkturquoise:00ced1,darkviolet:9400d3,deeppink:ff1493,deepskyblue:00bfff,dimgray:696969,dimgr\
|
|
144
|
+
ey:696969,dodgerblue:1e90ff,firebrick:b22222,floralwhite:fffaf0,forestgreen:228b22,fuchsia:ff00ff,gainsboro:dcdcdc,ghostwhite:f8f8ff,gold:ffd700,goldenrod:daa520,gray:808080,green:008000,greenyellow:a\
|
|
145
|
+
dff2f,grey:808080,honeydew:f0fff0,hotpink:ff69b4,indianred:cd5c5c,indigo:4b0082,ivory:fffff0,khaki:f0e68c,lavender:e6e6fa,lavenderblush:fff0f5,lawngreen:7cfc00,lemonchiffon:fffacd,lightblue:add8e6,lig\
|
|
146
|
+
htcoral:f08080,lightcyan:e0ffff,lightgoldenrodyellow:fafad2,lightgray:d3d3d3,lightgreen:90ee90,lightgrey:d3d3d3,lightpink:ffb6c1,lightsalmon:ffa07a,lightseagreen:20b2aa,lightskyblue:87cefa,lightslateg\
|
|
147
|
+
ray:778899,lightslategrey:778899,lightsteelblue:b0c4de,lightyellow:ffffe0,lime:00ff00,limegreen:32cd32,linen:faf0e6,magenta:ff00ff,maroon:800000,mediumaquamarine:66cdaa,mediumblue:0000cd,mediumorchid:\
|
|
148
|
+
ba55d3,mediumpurple:9370db,mediumseagreen:3cb371,mediumslateblue:7b68ee,mediumspringgreen:00fa9a,mediumturquoise:48d1cc,mediumvioletred:c71585,midnightblue:191970,mintcream:f5fffa,mistyrose:ffe4e1,moc\
|
|
149
|
+
casin:ffe4b5,navajowhite:ffdead,navy:000080,oldlace:fdf5e6,olive:808000,olivedrab:6b8e23,orange:ffa500,orangered:ff4500,orchid:da70d6,palegoldenrod:eee8aa,palegreen:98fb98,paleturquoise:afeeee,palevio\
|
|
150
|
+
letred:db7093,papayawhip:ffefd5,peachpuff:ffdab9,peru:cd853f,pink:ffc0cb,plum:dda0dd,powderblue:b0e0e6,purple:800080,rebeccapurple:663399,red:ff0000,rosybrown:bc8f8f,royalblue:4169e1,saddlebrown:8b451\
|
|
151
|
+
3,salmon:fa8072,sandybrown:f4a460,seagreen:2e8b57,seashell:fff5ee,sienna:a0522d,silver:c0c0c0,skyblue:87ceeb,slateblue:6a5acd,slategray:708090,slategrey:708090,snow:fffafa,springgreen:00ff7f,steelblue\
|
|
152
|
+
:4682b4,tan:d2b48c,teal:008080,thistle:d8bfd8,tomato:ff6347,turquoise:40e0d0,violet:ee82ee,wheat:f5deb3,white:ffffff,whitesmoke:f5f5f5,yellow:ffff00,yellowgreen:9acd32".split(",").map(e=>e.split(":"))),
|
|
153
|
+
A="(-?\\d+(?:\\.\\d+)?|-?\\.\\d+)",Oo=new RegExp(`^rgba?\\(\\s*${A}\\s*,\\s*${A}\\s*,\\s*${A}\\s*(?:,\\s*${A}\\s*)?\\)$`,"i"),jo=new RegExp(`^rgba?\\(\\s*${A}\\s+${A}\\s+${A}\\s*(?:\\/\\s*${A}\\s*)?\\)$`,
|
|
154
|
+
"i"),Lo=new RegExp(`^hsla?\\(\\s*${A}\\s*,\\s*${A}%\\s*,\\s*${A}%\\s*(?:,\\s*${A}\\s*)?\\)$`,"i"),Eo=new RegExp(`^hsla?\\(\\s*${A}\\s+${A}%\\s+${A}%\\s*(?:\\/\\s*${A}\\s*)?\\)$`,"i"),ot=e=>Math.max(0,
|
|
155
|
+
Math.min(255,Math.round(e))),Te=e=>Math.max(0,Math.min(1,e));function ln(e){const t=e.length;if(t!==3&&t!==4&&t!==6&&t!==8||!/^[0-9a-f]+$/i.test(e))return null;const n=t<=4?e.split("").map(a=>a+a).join(
|
|
156
|
+
""):e,r=parseInt(n.slice(0,2),16),i=parseInt(n.slice(2,4),16),s=parseInt(n.slice(4,6),16),o=n.length===8?parseInt(n.slice(6,8),16)/255:1;return{r,g:i,b:s,a:o}}function Bo(e){if(e[0]==="#")return ln(e.
|
|
157
|
+
slice(1));const t=e.toLowerCase();if(t==="transparent")return{r:0,g:0,b:0,a:0};const n=Ro[t];if(n)return ln(n);if(/^[a-z]+$/.test(t))return null;let r=t.match(Oo)??t.match(jo);if(r)return{r:ot(Number(
|
|
158
|
+
r[1])),g:ot(Number(r[2])),b:ot(Number(r[3])),a:r[4]===void 0?1:Te(Number(r[4]))};if(r=t.match(Lo)??t.match(Eo),r){const i=(Number(r[1])%360+360)%360/360;return{...at(i,Te(Number(r[2])/100),Te(Number(r[3])/
|
|
159
|
+
100)),a:r[4]===void 0?1:Te(Number(r[4]))}}}function ge(e){const t=e.trim();if(!t)return null;const n=Bo(t);return n!==void 0?n:Z?Z(t):(cn(),null)}function pe(e){const t=ge(e);return t?{r:t.r,g:t.g,b:t.
|
|
160
|
+
b}:null}function it({r:e,g:t,b:n}){const r=e/255,i=t/255,s=n/255,o=Math.max(r,i,s),a=Math.min(r,i,s),c=(o+a)/2;if(o===a)return{h:0,s:0,l:c};const l=o-a,d=c>.5?l/(2-o-a):l/(o+a);let u;return o===r?u=((i-
|
|
161
|
+
s)/l+(i<s?6:0))/6:o===i?u=((s-r)/l+2)/6:u=((r-i)/l+4)/6,{h:u,s:d,l:c}}function at(e,t,n){if(t===0){const o=Math.round(n*255);return{r:o,g:o,b:o}}const r=(o,a,c)=>(c<0&&(c+=1),c>1&&(c-=1),c<1/6?o+(a-o)*
|
|
162
|
+
6*c:c<1/2?a:c<2/3?o+(a-o)*(2/3-c)*6:o),i=n<.5?n*(1+t):n+t-n*t,s=2*n-i;return{r:Math.round(r(s,i,e+1/3)*255),g:Math.round(r(s,i,e)*255),b:Math.round(r(s,i,e-1/3)*255)}}function st({r:e,g:t,b:n}){const r=i=>i.
|
|
163
|
+
toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function ct(e){if(!e)return;const t=ge(e);return t&&t.a>0?st(t):void 0}const Xo=.08,$o=.2,zo=.85;function lt(e){const t=pe(e);if(!t)return!0;
|
|
164
|
+
const{s:n,l:r}=it(t);return n<=Xo&&(r<=$o||r>=zo)}const un=.3,Do=.8,dn=new Map;function fn(e,t){const n=`${e}|${t?1:0}`,r=dn.get(n);if(r!==void 0)return r;const i=Go(e,t);return dn.set(n,i),i}function Go(e,t){
|
|
165
|
+
const n=pe(e);if(!n||lt(e))return null;if(!t)return e;const{h:r,s:i,l:s}=it(n),o=1-s,a=un+o*(Do-un);return st(at(r,i,a))}function Wo({r:e,g:t,b:n}){const r=i=>{const s=i/255;return s<=.03928?s/12.92:((s+
|
|
166
|
+
.055)/1.055)**2.4};return .2126*r(e)+.7152*r(t)+.0722*r(n)}function gn(e,t){if(!t)return;const n=ge(t);if(!(!n||n.a<.5))return e&&pe(e)?e:Wo(n)>.179?"#000000":"#ffffff"}const _o=Object.freeze(Object.defineProperty(
|
|
167
|
+
{__proto__:null,cssNeedsFullColorParser:To,hslToRgb:at,isEffectivelyDefaultInk:lt,loadFullColorParser:cn,normalizeTextColor:ct,parseCssColor:pe,parseCssColorWithAlpha:ge,resolveTextColorOnFill:gn,resolveThemedTextColor:fn,
|
|
168
|
+
rgbToHex:st,rgbToHsl:it},Symbol.toStringTag,{value:"Module"})),ut=3,dt=6,ft=96;function pn(e){return typeof e=="number"&&Number.isFinite(e)&&e>=dt&&e<=ft}function Uo(e){const t={};if(!e)return t;const n=e.
|
|
169
|
+
match(/font-family:\s*([^;]+)/i);n&&(t.fontFamily=n[1].trim());const r=e.match(/font-size:\s*(\d+(?:\.\d+)?)px/i);if(r){const o=parseFloat(r[1]);pn(o)&&(t.fontSize=o)}const i=e.match(/(?:^|;)\s*color\s*:\s*([^;]+)/i),
|
|
170
|
+
s=i?ct(i[1].trim()):null;return s&&(t.color=s),t}function Ho(e){const t=e.style,n=t?.direction||e.getAttribute("dir"),r=t?.textAlign,i={};return(n==="rtl"||n==="ltr")&&(i.direction=n),(r==="left"||r===
|
|
171
|
+
"right"||r==="center"||r==="justify")&&(i.align=r),r==="start"&&(i.align=n==="rtl"?"right":"left"),r==="end"&&(i.align=n==="rtl"?"left":"right"),i}function qo(e,t,n,r,i,s,o=1){const a=e.direction==="r\
|
|
172
|
+
tl",c=e.align&&e.align!=="justify"?e.align:a?"right":"left",l=n+r,d=(t.level-1)*W.levelIndentPx*o,u=s(i),g=a?n:l-u,p=i?(W.pageNumberGapPx+W.labelClipGapPx)*o:0,f=a?n+u+p:n+d,h=a?l-d:l-u-p,b=Math.max(h-
|
|
173
|
+
f,0);let x=t.text;if(s(x)>b){const R=Array.from(x);for(;R.length&&s(R.join("")+"…")>b;)R.pop();x=s("…")<=b?R.join("")+"…":""}const y=s(x),v=c==="right"?h:c==="center"?(f+h)/2:f,T=c==="right"?v-y:
|
|
174
|
+
c==="center"?v-y/2:v,U=a?g+u+W.pageNumberGapPx*o:T+y+W.leaderStartGapPx*o,X=a?T-W.leaderStartGapPx*o:g-W.pageNumberGapPx*o;return{text:x,textX:v,align:c,numberX:g,leaderStart:U,leaderEnd:X,rtl:a}}function Vo(e){
|
|
175
|
+
return`TOC \\o "1-${e}" \\h \\z \\u`}function mn(e){const t=e?.match(/\\o\s+"?(\d)\s*-\s*(\d)"?/);if(!t)return ut;const n=parseInt(t[2],10);return Number.isFinite(n)?Math.min(Math.max(n,1),6):ut}function hn(e){
|
|
176
|
+
return typeof e.levels=="number"&&Number.isFinite(e.levels)?Math.min(Math.max(Math.round(e.levels),1),6):e.instr?mn(e.instr):ut}function Jo(e){return e.instr??Vo(hn(e))}function Ko(e,t){const n=[];if(!e)
|
|
177
|
+
return n;const r=i=>{for(const s of i)if(s.type==="paragraph"){const o=s.heading;if(typeof o=="number"&&o>=1&&o<=t){const a=s.children.map(c=>c.type==="text"?c.text:"").join("").trim();a.length>0&&s.id&&
|
|
178
|
+
n.push({blockId:s.id,text:a,level:o})}}else if(s.type==="container")r(s.children);else if(s.type==="table")for(const o of s.children)for(const a of o.children)r(a.children)};return r(e.children),n}const C=96,
|
|
179
|
+
Yo=1,Qo=Yo*C,Zo="'Source Code Pro', Consolas, Monaco, 'Courier New', monospace",ei=.5,L=C*ei,bn=1,ti=1,ni=/^(-?\d+(?:\.\d+)?)(px|pt|in|cm|mm)?$/i;function ri(e){return typeof e!="number"||!Number.isFinite(
|
|
180
|
+
e)?0:Math.max(0,e)}function gt(e){return typeof e!="number"||!Number.isFinite(e)?0:Math.max(0,Math.round(e))}function pt(e){if(typeof e!="number"||!Number.isFinite(e))return 0;const t=Math.round(e);return t<
|
|
181
|
+
0?-1:t>0?1:0}function Re(e){const t=gt(e);return t>0?t:void 0}function Oe(e){const t=pt(e);return t===0?void 0:t}function oi(e){return gt(e.leftIndent)}function ii(e){return pt(e.firstLineIndent)}function yn(e,t=L){
|
|
182
|
+
return ht(oi(e),t)}function xn(e,t=L){const n=ii(e);return Math.sign(n)*ht(Math.abs(n),t)}function mt(e,t,n=L){const r=yn(e,n),i=xn(e,n);return r+(t===0?i:0)}function ai(e,t,n,r=L){return n==="rtl"?0:
|
|
183
|
+
mt(e,t,r)}function si(e,t,n,r=L){return Math.max(ti,e-mt(t,n,r))}function wn(e,t=L){return!Number.isFinite(t)||t<=0?0:Math.max(0,Math.round(ri(e)/t))}function ht(e,t=L){return!Number.isFinite(t)||t<=0?
|
|
184
|
+
0:Math.max(0,Math.round(e))*t}function ee(e,t){const n=t?.indentStepPx??L;if(t?.firstLine){const i=t?.storedAsUnits?pt(e):e&&e<0?-1:wn(e,n)>0?bn:0;return i===0?void 0:i}const r=t?.storedAsUnits?gt(e):
|
|
185
|
+
wn(e,n);return r>0?r:void 0}function ci(e){if(!e)return;const t=e.trim().match(ni);if(!t)return;const n=Number.parseFloat(t[1]);if(!Number.isFinite(n))return;const r=(t[2]||"px").toLowerCase(),i={px:1,
|
|
186
|
+
pt:C/72,in:C,cm:C/2.54,mm:C/25.4};return n*i[r]}function li(e,t){const n=ci(e);if(n!==void 0)return n===0?0:t?.firstLine?n<0?-1:bn:ee(n,{indentStepPx:t?.indentStepPx,storedAsUnits:!1,firstLine:t?.firstLine})}
|
|
187
|
+
function kn(e,t){return typeof e=="object"&&e!==null&&e.constructor?.name===t}function bt(e){return e instanceof w.XmlElement||kn(e,"YXmlElement")&&typeof e.nodeName=="string"&&typeof e.getAttribute==
|
|
188
|
+
"function"}function ui(e){return e instanceof w.XmlText||kn(e,"YXmlText")&&typeof e.toDelta=="function"}const di="Arial, sans-serif",F=[{attr:"structuralSuggestionId",kind:"string"},{attr:"structuralS\
|
|
189
|
+
uggestionKind",kind:"enum",enum:["insert","delete","split","merge","change"]},{attr:"structuralSuggestionRole",kind:"enum",enum:["before","after"]},{attr:"structuralSuggestionLabel",kind:"string"},{attr:"\
|
|
190
|
+
structuralSuggestionRecord",kind:"string"},{attr:"structuralSuggestionRecords",kind:"string"}],I=[{attr:"diffState",kind:"enum",enum:["insert","delete","equal"]},{attr:"suggestionId",kind:"string"}];function fi(e){
|
|
191
|
+
return(_[e]?.attrs??[]).map(t=>t.attr)}const gi=[...F.map(e=>e.attr),...I.map(e=>e.attr)],_=Object.fromEntries([{type:"paragraph",attrs:[{attr:"heading",kind:"int"},{attr:"align",kind:"string"},{attr:"\
|
|
192
|
+
lineSpacing",kind:"float"},{attr:"spaceBefore",kind:"float"},{attr:"spaceAfter",kind:"float"},{attr:"contextualSpacing",kind:"boolean"},{attr:"styleId",kind:"string"},{attr:"direction",kind:"string"},
|
|
193
|
+
{attr:"tabStops",kind:"string"},{attr:"borders",kind:"string"},{attr:"shading",kind:"string"},{attr:"oxmlAttrs",kind:"string"},{attr:"oxmlPPr",kind:"string"},{attr:"leftIndent",kind:"float"},{attr:"fi\
|
|
194
|
+
rstLineIndent",kind:"float"},...F,...I],children:"text"},{type:"list",attrs:[{attr:"variant",kind:"string"},{attr:"startNumber",kind:"int"},{attr:"numberingChainId",kind:"string"},{attr:"numberingForm\
|
|
195
|
+
at",kind:"string"},...ae.map(e=>({attr:e,kind:"float"})),{attr:"contextualSpacing",kind:"boolean"},...F,...I],children:"list-items"},{type:"list-item",attrs:[...ae.map(e=>({attr:e,kind:"float"})),{attr:"\
|
|
196
|
+
checked",kind:"boolean"},{attr:"indentLevel",kind:"int",validate:e=>e>0},{attr:"direction",kind:"string"},...F],children:"text"},{type:"table",attrs:[{attr:"columnWidths",kind:"json"},{attr:"tableWidt\
|
|
197
|
+
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"},
|
|
198
|
+
{attr:"hasHeader",kind:"booleanTrue"},{attr:"docxTablePropertyOverrides",kind:"string"},{attr:"oxmlTblPr",kind:"string"},...F,...I],children:"table-rows"},{type:"table-row",attrs:[{attr:"oxmlAttrs",kind:"\
|
|
199
|
+
string"},{attr:"oxmlTrPr",kind:"string"},...I,...F],children:"blocks"},{type:"table-cell",attrs:[{attr:"verticalAlign",kind:"string"},{attr:"backgroundColor",kind:"string"},{attr:"borders",kind:"strin\
|
|
200
|
+
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"},...I,...F],children:"blocks"},{type:"containe\
|
|
201
|
+
r",attrs:[{attr:"borderColor",kind:"string"},{attr:"padding",kind:"int"},...F,...I],children:"blocks"},{type:"header-footer",attrs:[{attr:"side",kind:"enum",enum:["header","footer"]},{attr:"slot",kind:"\
|
|
202
|
+
enum",enum:["default","first","even"]},{attr:"sectionIndex",kind:"int",validate:e=>e>=0}],children:"blocks"},{type:"footnote",attrs:[{attr:"noteKind",kind:"enum",enum:["endnote"]},...F,...I],children:"\
|
|
203
|
+
blocks"},{type:"code",attrs:[{attr:"language",kind:"string"},{attr:"toolCallId",kind:"string"},{attr:"renderDiagram",kind:"boolean"},{attr:"showDiagramSource",kind:"boolean"},...I,...F],children:"rawt\
|
|
204
|
+
ext"},{type:"math",attrs:[{attr:"displayMode",kind:"enum",enum:["inline","block"]},{attr:"align",kind:"enum",enum:["left","center","right"]},{attr:"showDiagramSource",kind:"boolean"},...I,...F],children:"\
|
|
205
|
+
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"},
|
|
206
|
+
{attr:"uploading",kind:"boolean"},{attr:"tempId",kind:"string"},{attr:"originalFormat",kind:"enum",enum:["emf","wmf"]},{attr:"originalDataUrl",kind:"string"},{attr:"anchorXml",kind:"string"},...I,...F],
|
|
207
|
+
children:"none"},{type:"page-break",attrs:[...I],children:"none"},{type:"docx-raw",attrs:[{attr:"xml",kind:"string"},{attr:"tagName",kind:"string"},{attr:"detail",kind:"string"},{attr:"origin",kind:"e\
|
|
208
|
+
num",enum:["run","body"]},...F,...I],children:"none"},{type:"section-break",attrs:[{attr:"layout",kind:"json"},{attr:"breakType",kind:"enum",enum:["nextPage","continuous","evenPage","oddPage"]},...I],
|
|
209
|
+
children:"none"},{type:"toc",attrs:[{attr:"direction",kind:"enum",enum:["rtl","ltr"]},{attr:"align",kind:"enum",enum:["left","center","right","justify"]},{attr:"levels",kind:"int",validate:e=>e>=1&&e<=
|
|
210
|
+
6},{attr:"instr",kind:"string"},{attr:"fontFamily",kind:"string"},{attr:"fontSize",kind:"float",validate:e=>e>=dt&&e<=ft},{attr:"color",kind:"string"},...I],children:"none"},{type:"placeholder",attrs:[
|
|
211
|
+
{attr:"height",kind:"int"}],children:"none"}].map(e=>[e.type,e])),pi={image:{src:"",width:200,height:200},code:{content:""},math:{displayMode:"block"},placeholder:{height:100},list:{variant:"unordered"}};
|
|
212
|
+
function mi(e,t){if(!(t==null||t===""))switch(e.kind){case"string":return t;case"int":{const n=parseInt(t,10);return Number.isNaN(n)||e.validate&&!e.validate(n)?void 0:n}case"float":{const n=parseFloat(
|
|
213
|
+
t);return Number.isNaN(n)||e.validate&&!e.validate(n)?void 0:n}case"boolean":return t==="true"?!0:t==="false"?!1:void 0;case"booleanTrue":return t==="true"?!0:void 0;case"json":try{return JSON.parse(t)}catch{
|
|
214
|
+
return}case"enum":return e.enum?.includes(t)?t:void 0}}function Sn(e,t){if(t==null)return null;switch(e.kind){case"string":case"enum":return typeof t=="string"&&t!==""?t:null;case"int":case"float":return typeof t==
|
|
215
|
+
"number"?String(t):null;case"boolean":return typeof t=="boolean"?String(t):null;case"booleanTrue":return t===!0?"true":null;case"json":return JSON.stringify(t)}}function hi(e){const t=[],n=ce(e);for(const r of n){
|
|
216
|
+
if(typeof r.insert!="string")continue;const i=r.attributes||{},s={type:"text",text:r.insert,marks:nt(i)};t.push(s)}return sn(t)}function vn(e){for(let t=0;t<e.length;t++){const n=e.get(t);if(ui(n))return n}
|
|
217
|
+
return null}function Pn(e){const t=K(e,"_emptyTextMarks");let n={fontFamily:di};if(t)try{n=JSON.parse(t)}catch{}return[{type:"text",text:"",marks:n}]}function bi(e){const t=vn(e);if(!t)return Pn(e);const n=hi(
|
|
218
|
+
t);return n.length>0?n:Pn(e)}function yi(e,t){for(const[n,r]of[["leftIndent",!1],["firstLineIndent",!0]])if(typeof e[n]=="number"){if(e[n]===0)continue;const i=ee(e[n],{indentStepPx:t.indentStepPx,storedAsUnits:t.
|
|
219
|
+
storedAsUnits,firstLine:r});i===void 0?delete e[n]:e[n]=i}}function me(e,t,n,r){const i=e.nodeName,s=_[i]??_.paragraph,o=_[i]?i:"paragraph",a={type:o,id:K(e,"id")||P()};for(const l of s.attrs){const d=mi(
|
|
220
|
+
l,K(e,l.attr));d!==void 0&&(a[l.field??l.attr]=d)}o==="paragraph"&&Me(a,K(e,"pagination"));const c=pi[o];if(c)for(const[l,d]of Object.entries(c))a[l]===void 0&&(a[l]=d);switch(s.children){case"text":a.
|
|
221
|
+
children=bi(e);break;case"rawtext":{const l=vn(e);a.content=l?l.toString():"";break}case"blocks":{const l=[];for(const d of e.toArray())if(bt(d)){const u=r?r(d):me(d,t);u&&l.push(u)}a.children=l;break}case"\
|
|
222
|
+
list-items":{const l=[];for(const d of e.toArray())if(bt(d)&&d.nodeName==="list-item"){const u=r?r(d):me(d,t);u&&l.push(u)}a.children=l;break}case"table-rows":{const l=[];for(const d of e.toArray())if(bt(
|
|
223
|
+
d)&&d.nodeName==="table-row"){const u=r?r(d):me(d,t);u&&l.push(u)}a.children=l,a.columnWidths===void 0&&(a.columnWidths=[]);break}}return(o==="paragraph"||s.children==="text")&&yi(a,t),a}function xi(e,t){
|
|
224
|
+
const n=new w.XmlText,r=new Set;for(const o of e){const a=o;if(a?.type==="text"&&a.marks)for(const c of Object.keys(a.marks))r.add(c)}let i=0;for(const o of e){const a=o;if(a?.type!=="text"||!a.text)continue;
|
|
225
|
+
const c=a.marks??{};if(t&&D(t)){n.insert(i,a.text,Ae(t,c)),i+=a.text.length;continue}le(n,i,a.text);for(const l of r)Wt(n,i,a.text.length,{[l]:l in c?c[l]:null});i+=a.text.length}let s=null;if(i===0){
|
|
226
|
+
const o=e.find(a=>a?.type==="text"&&a.text.length===0&&a.marks&&Object.keys(a.marks).length>0);o?.marks&&(s=o.marks)}return{yText:n,emptyMarks:s}}function wi(e,t,n){const r=_[t.type];if(!r)return;let i={
|
|
227
|
+
id:String(t.id??P())};for(const s of r.attrs){const o=s.field??s.attr;let a=t[o];o==="leftIndent"&&typeof a=="number"?a=a===0?0:Re(a):o==="firstLineIndent"&&typeof a=="number"&&(a=a===0?0:Oe(a));const c=Sn(
|
|
228
|
+
s,a);c!==null&&(i[s.attr]=c)}if(r.type==="paragraph"){const s=Ie(t);s!==void 0&&(i.pagination=s)}t.type==="paragraph"&&n&&D(n)&&(i=vr(n,i));for(const[s,o]of Object.entries(i))e.setAttribute(s,o)}function ki(e,t){
|
|
229
|
+
const n=t,r=_[n.type];if(!r)return;const i=String(n.id??P());e.getAttribute("id")!==i&&e.setAttribute("id",i);for(const s of r.attrs){const o=s.field??s.attr;let a=n[o];o==="leftIndent"&&typeof a=="nu\
|
|
230
|
+
mber"?a=a===0?0:Re(a):o==="firstLineIndent"&&typeof a=="number"&&(a=a===0?0:Oe(a));const c=Sn(s,a);if(c===null){const l=K(e,s.attr);l!==void 0&&l!==""&&Ke(e,s.attr)}else K(e,s.attr)!==c&&e.setAttribute(
|
|
231
|
+
s.attr,c)}if(r.type==="paragraph"){const s=Ie(n);s===void 0?Ke(e,"pagination"):e.setAttribute("pagination",s)}}function An(e,t){const n=e.children;if(!Array.isArray(n))return e;const r=n.flatMap(i=>{if(i?.
|
|
232
|
+
type==="text"){const s=t(i);return Array.isArray(s)?s:[s]}return[An(i,t)]});return{...e,children:r}}function yt(e,t){const n=e,r=_[n.type]??_.paragraph,i=new w.XmlElement(r.type);wi(i,n,t);let s=0;switch(r.
|
|
233
|
+
children){case"text":{const{yText:o,emptyMarks:a}=xi(n.children??[],t);i.insert(s++,[o]),a&&i.setAttribute("_emptyTextMarks",JSON.stringify(a));break}case"rawtext":{const o=new w.XmlText,a=typeof n.content==
|
|
234
|
+
"string"?n.content:"";a&&le(o,0,a),i.insert(s++,[o]);break}case"blocks":case"list-items":case"table-rows":{const o=n.children??[];for(const a of o)i.insert(s++,[yt(a,t)]);break}}return i}function he(e,t,n,r){
|
|
235
|
+
const i=s=>e.find(o=>o.type==="header-footer"&&o.side===t&&o.slot===n&&o.sectionIndex===s);if(r!==void 0){const s=i(r);if(s)return s}return i(void 0)}function Si(e,t,n,r){if(n===1){const i=he(e,t,"fir\
|
|
236
|
+
st",r);if(i)return i}if(n%2===0){const i=he(e,t,"even",r);if(i)return i}return he(e,t,"default",r)}const be=[void 0,"center","right"];function vi(e,t){const n=be[e];return{type:"paragraph",id:P(),children:[
|
|
237
|
+
{type:"text",text:"",...t?{marks:{fontFamily:t}}:{}}],...n?{align:n}:{}}}function Pi(e,t){if(!t)return e;let n=!1;const r=e.children.map(i=>i.type!=="text"||i.marks?.fontFamily?i:(n=!0,{...i,marks:{...i.
|
|
238
|
+
marks??{},fontFamily:t}}));return n?{...e,children:r}:e}function Ai(e,t){const n=be[t];return!n||e.align?e:{...e,align:n}}function Nn(e,t,n,r,i){const s=n??[],o=a=>s[a]?Pi(Ai(s[a],a),r):vi(a,r);return{
|
|
239
|
+
type:"header-footer",id:P(),side:e,slot:t,...i!==void 0?{sectionIndex:i}:{},children:[o(0),o(1),o(2)]}}function In(e){return!!e?.children.some(t=>t.type==="text"&&t.text.trim()!=="")}function Ni(e){return e.
|
|
240
|
+
children.some(t=>In(t))}function Mn(e){const t=e.children,n=[2,1,0].find(i=>In(t[i]))??-1;if(n===-1)return;const r=[];for(let i=0;i<=n;i++){i>0&&r.push({type:"text",text:" "});for(const s of t[i]?.children??
|
|
241
|
+
[])s.type==="text"&&s.text&&r.push(s)}return{type:"paragraph",id:e.id?`${e.id}-zone`:P(),children:r}}function Cn(e){const t=[[],[],[]],n=e?.[0],r=!!n?.children.some(o=>o.type==="text"&&o.text.includes(
|
|
242
|
+
" "));let i=!r&&n?.align==="right"?2:!r&&n?.align==="center"?1:0;const s=n?.children??[];for(const o of s)o.type==="text"&&o.text.split(" ").forEach((a,c)=>{c>0&&i<2&&(i+=1),a&&t[i].push({type:"text",
|
|
243
|
+
text:a,...o.marks?{marks:{...o.marks}}:{}})});for(const o of e?.slice(1)??[])for(const a of o.children)a.type==="text"&&a.text&&t[0].push({...a});return t.map((o,a)=>({type:"paragraph",id:P(),children:o.
|
|
244
|
+
length>0?o:[{type:"text",text:""}],...be[a]?{align:be[a]}:{}}))}function Fn(e){const t={},n={};for(const r of e){if(r.type!=="header-footer"||r.sectionIndex!==void 0)continue;const i=Mn(r);if(!i)continue;
|
|
245
|
+
const s=r.side==="header"?t:n;s[r.slot]=[i]}return{...Object.keys(t).length>0?{headers:t}:{},...Object.keys(n).length>0?{footers:n}:{}}}function Ii(e,t){const n={},r={};for(const i of["header","footer"])
|
|
246
|
+
for(const s of["default","first","even"]){const o=he(e,i,s,t);if(!o)continue;const a=Mn(o);if(!a)continue;const c=i==="header"?n:r;c[s]=[a]}return{...Object.keys(n).length>0?{headers:n}:{},...Object.keys(
|
|
247
|
+
r).length>0?{footers:r}:{}}}function Mi(e){return e.some(t=>t.type==="header-footer"&&t.sectionIndex!==void 0)}function xt(e,t,n){const r=[];for(const[i,s]of[["header",e],["footer",t]])if(s)for(const o of[
|
|
248
|
+
"default","first","even"]){const a=s[o];!a||a.length===0||r.push(Nn(i,o,Cn(a),n))}return r}function Ci(e){for(const t of e)if(!(t.type==="header-footer"||t.type==="footnote")){if(t.type==="paragraph"){
|
|
249
|
+
for(const n of t.children)if(n.type==="text"&&n.marks?.fontFamily)return n.marks.fontFamily}else if(t.type==="list"){for(const n of t.children)for(const r of n.children)if(r.type==="text"&&r.marks?.fontFamily)
|
|
250
|
+
return r.marks.fontFamily}}}function Fi(e,t){const n=[...e.chrome??[],...e.children.filter(r=>r.type==="header-footer")];for(const r of n){if(r.id===t)return{block:r,columnIndex:0};const i=r.children.
|
|
251
|
+
findIndex(s=>s.id===t);if(i!==-1)return{block:r,columnIndex:i}}return null}const Tn=["decimal","lowerRoman","upperRoman"],Ti=3999,Ri=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,
|
|
252
|
+
"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function wt(e){return typeof e=="string"&&Tn.includes(e)}function Oi(e){let t=e,n="";for(const[r,i]of Ri)for(;t>=r;)n+=i,t-=r;return n}function Rn(e,t="\
|
|
253
|
+
decimal"){if(!Number.isFinite(e))return"";const n=Math.round(e);if((t==="lowerRoman"||t==="upperRoman")&&n>=1&&n<=Ti){const r=Oi(n);return t==="lowerRoman"?r.toLowerCase():r}return String(n)}const kt=[
|
|
254
|
+
"top","right","bottom","left"],ji=["single","double","dotted","dashed"];function te(e){if(e===null||e==="")return null;if(e===void 0)return;if(typeof e=="string")try{e=JSON.parse(e)}catch{return}if(!e||
|
|
255
|
+
typeof e!="object"||Array.isArray(e))return;const t=e,n={offsetFrom:t.offsetFrom==="page"?"page":"text",display:t.display==="firstPage"||t.display==="notFirstPage"?t.display:"allPages",zOrder:t.zOrder===
|
|
256
|
+
"back"?"back":"front"};for(const r of kt){const i=t[r];if(i!=null){if(!ji.includes(i.style)||typeof i.color!="string"||!/^#[0-9a-f]{6}$/i.test(i.color)||typeof i.widthPt!="number"||!Number.isFinite(i.
|
|
257
|
+
widthPt)||i.widthPt<.25||i.widthPt>12||typeof i.spacePt!="number"||!Number.isFinite(i.spacePt)||i.spacePt<0||i.spacePt>31)return;n[r]={style:i.style,color:i.color.toLowerCase(),widthPt:i.widthPt,spacePt:i.
|
|
258
|
+
spacePt}}}return n}function Li(e){const t=te(e);return t===void 0?void 0:t===null?"":JSON.stringify(t)}function Ei(e,t,n,r,i){if(!e||e.display==="firstPage"&&!i||e.display==="notFirstPage"&&i)return[];
|
|
259
|
+
const s=u=>{const g=e[u]?.spacePt??0,p=(e[u]?.widthPt??0)/2;return e.offsetFrom==="page"?g+p:r[u]-g-p},o=Math.max(0,s("left")),a=Math.min(t,t-s("right")),c=Math.max(0,s("top")),l=Math.min(n,n-s("botto\
|
|
260
|
+
m")),d={top:[o,c,a,c],right:[a,c,a,l],bottom:[o,l,a,l],left:[o,c,o,l]};return kt.flatMap(u=>{const g=e[u];if(!g)return[];const[p,f,h,b]=d[u];return[{...g,x1:p,y1:f,x2:h,y2:b}]})}function Bi(e){if(!e)return;
|
|
261
|
+
const t={offsetFrom:e.getAttribute("w:offsetFrom")==="page"?"page":"text",display:e.getAttribute("w:display")||"allPages",zOrder:e.getAttribute("w:zOrder")==="back"?"back":"front"};for(const n of kt){
|
|
262
|
+
const r=Array.from(e.children).find(o=>o.localName===n);if(!r)continue;const i=r.getAttribute("w:val");if(i==="none"||i==="nil")continue;if(r.hasAttribute("w:themeColor")||["1","true","on"].includes(r.
|
|
263
|
+
getAttribute("w:shadow")??"")||["1","true","on"].includes(r.getAttribute("w:frame")??"")||Array.from(r.attributes).some(o=>o.namespaceURI==="http://schemas.openxmlformats.org/officeDocument/2006/relat\
|
|
264
|
+
ionships"))return;const s=r.getAttribute("w:color")||"auto";t[n]={style:i,color:s==="auto"?"#000000":`#${s}`,widthPt:Number(r.getAttribute("w:sz")||8)/8,spacePt:Number(r.getAttribute("w:space")||0)}}return te(
|
|
265
|
+
t)??void 0}function On(e){const t=te(e?.pageBorders),n=e?.oxmlSectPr||"";if(t===void 0)return n||void 0;const r=n.replace(/<w:pgBorders\b[^>]*(?:\/>|>[\s\S]*?<\/w:pgBorders>)/g,"");if(t===null)return r||
|
|
266
|
+
void 0;const i=["top","left","bottom","right"].map(s=>{const o=t[s];return o?`<w:${s} w:val="${o.style}" w:color="${o.color.slice(1).toUpperCase()}" w:sz="${Math.round(o.widthPt*8)}" w:space="${Math.round(
|
|
267
|
+
o.spacePt)}"/>`:""}).join("");return`${r}<w:pgBorders w:offsetFrom="${t.offsetFrom}" w:display="${t.display}" w:zOrder="${t.zOrder}">${i}</w:pgBorders>`}function Xi(e,t){const n=/<w:pgBorders\b/.test(
|
|
268
|
+
t?.oxmlSectPr??"");return On({pageBorders:t?.pageBorders!==void 0?t.pageBorders:n?void 0:e?.pageBorders,oxmlSectPr:t?.oxmlSectPr})}function jn(e){let t=e;if(typeof e=="string"){const a=e.trim();if(a===
|
|
269
|
+
"")return null;try{t=JSON.parse(a)}catch{return null}}if(!t||typeof t!="object"||Array.isArray(t))return null;const n=t,r=typeof n.countBy=="number"&&Number.isFinite(n.countBy)&&n.countBy>=1?Math.round(
|
|
270
|
+
n.countBy):1,i=typeof n.start=="number"&&Number.isFinite(n.start)&&n.start>=1?Math.round(n.start):1,s=n.restart==="newSection"||n.restart==="continuous"?n.restart:"newPage",o=typeof n.distancePx=="num\
|
|
271
|
+
ber"&&Number.isFinite(n.distancePx)&&n.distancePx>=0?n.distancePx:void 0;return{countBy:r,start:i,restart:s,...o!==void 0?{distancePx:o}:{}}}function Ln(e){if(e)return JSON.stringify({countBy:e.countBy,
|
|
272
|
+
start:e.start,restart:e.restart,...e.distancePx!==void 0?{distancePx:e.distancePx}:{}})}const St=1,m={pageBorders:"pageBorders",pageSize:"pageSize",orientation:"pageOrientation",marginPx:"pageMarginPx",
|
|
273
|
+
marginTopPx:"pageMarginTopPx",marginRightPx:"pageMarginRightPx",marginBottomPx:"pageMarginBottomPx",marginLeftPx:"pageMarginLeftPx",indentStepPx:"indentStepPx",blockSpacingPx:"blockSpacingPx",showPageNumbers:"\
|
|
274
|
+
showPageNumbers",pageNumberPosition:"pageNumberPosition",pageNumberStart:"pageNumberStart",pageNumberFormat:"pageNumberFormat",pageNumberRestart:"pageNumberRestart",paragraphIndentStorageVersion:"para\
|
|
275
|
+
graphIndentStorageVersion",hyphenationEnabled:"hyphenationEnabled",lineNumbering:"lineNumbering",columnCount:"columnCount",columnGapTwips:"columnGapTwips",oxmlSectPr:"oxmlSectPr"},$i=["top-left","top-\
|
|
276
|
+
right","bottom-left","bottom-right"];function vt(e){return typeof e=="string"&&$i.includes(e)}const je={letter:{width:8.5,height:11},tabloid:{width:11,height:17},legal:{width:8.5,height:14},statement:{
|
|
277
|
+
width:5.5,height:8.5},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,
|
|
278
|
+
height:13.8976},b5:{width:6.9291,height:9.8425}},zi=["apa7"],Di=2.54,Gi=Object.entries(je).map(([e,t])=>({pageSize:e,width:Math.min(t.width,t.height),height:Math.max(t.width,t.height)}));function Wi(e){
|
|
279
|
+
return typeof e=="string"&&zi.includes(e)}function Pt(e){return typeof e=="string"&&Object.prototype.hasOwnProperty.call(je,e)}function _i(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e!=
|
|
280
|
+
"string")return;const t=e.trim().match(/^(-?(?:\d+(?:\.\d+)?|\.\d+))\s*(px|in|cm)?$/i);if(!t)return;const n=Number.parseFloat(t[1]);if(Number.isFinite(n))switch((t[2]??"px").toLowerCase()){case"px":return n;case"\
|
|
281
|
+
in":return Y(n);case"cm":return Y(n/Di);default:return}}function Ui(e,t){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0)return;const n=e>t?"landscape":"portrait",r=Le(Math.min(e,t)),i=Le(Math.
|
|
282
|
+
max(e,t));let s=M.pageSize,o=Number.POSITIVE_INFINITY;for(const a of Gi){const c=Math.abs(r-a.width)+Math.abs(i-a.height);c<o&&(o=c,s=a.pageSize)}return{pageSize:s,orientation:n}}const Hi=0,qi=3*C,Vi=.125*
|
|
283
|
+
C,Ji=2*C,Ki=0,Yi=2*C,Qi=12,En=1,Zi=99999,M={pageSize:"letter",orientation:"portrait",marginLeftPx:Qo,indentStepPx:L,blockSpacingPx:Qi,pageNumberPosition:"top-right",pageNumberStart:1,pageNumberFormat:"\
|
|
284
|
+
decimal",columnCount:1,columnGapTwips:720};function ne(e,t,n){return Math.max(t,Math.min(n,e))}function ye(e){return typeof e!="number"||!Number.isFinite(e)?M.marginLeftPx:ne(e,Hi,qi)}function ea(e){return typeof e!=
|
|
285
|
+
"number"||!Number.isFinite(e)?M.indentStepPx:ne(e,Vi,Ji)}function ta(e){return typeof e!="number"||!Number.isFinite(e)?M.blockSpacingPx:ne(e,Ki,Yi)}function na(e){return vt(e)?e:M.pageNumberPosition}function ra(e){
|
|
286
|
+
return typeof e!="number"||!Number.isFinite(e)?M.pageNumberStart:ne(Math.round(e),En,Zi)}function oa(e){return typeof e!="number"||!Number.isFinite(e)?M.columnCount:ne(Math.round(e),1,12)}function ia(e){
|
|
287
|
+
return typeof e!="number"||!Number.isFinite(e)?M.columnGapTwips:ne(Math.round(e),0,14400)}function B(e){const t=e?.pageSize&&Pt(e.pageSize)?e.pageSize:M.pageSize,n=e?.orientation==="landscape"||e?.orientation===
|
|
288
|
+
"portrait"?e.orientation:M.orientation,r=ye(e?.marginPx);return{pageSize:t,orientation:n,pageBorders:te(e?.pageBorders),marginTopPx:ye(e?.marginTopPx??r),marginRightPx:ye(e?.marginRightPx??r),marginBottomPx:ye(
|
|
289
|
+
e?.marginBottomPx??r),marginLeftPx:ye(e?.marginLeftPx??r),indentStepPx:ea(e?.indentStepPx),blockSpacingPx:ta(e?.blockSpacingPx),showPageNumbers:e?.showPageNumbers===!0,pageNumberPosition:na(e?.pageNumberPosition),
|
|
290
|
+
pageNumberStart:ra(e?.pageNumberStart),pageNumberFormat:wt(e?.pageNumberFormat)?e.pageNumberFormat:M.pageNumberFormat,...e?.pageNumberRestart===!0?{pageNumberRestart:!0}:{},noteMode:e?.noteMode==="end\
|
|
291
|
+
notes"?"endnotes":"footnotes",columnCount:oa(e?.columnCount),columnGapTwips:ia(e?.columnGapTwips),hyphenationEnabled:e?.hyphenationEnabled===!0,lineNumbering:jn(e?.lineNumbering),...(()=>{const i=e?.oxmlSectPr;
|
|
292
|
+
return typeof i=="string"&&i?{oxmlSectPr:i}:{}})()}}function aa(e){const t=je[e.pageSize],n=t.width*C,r=t.height*C;return e.orientation==="landscape"?{pageWidth:r,pageHeight:n}:{pageWidth:n,pageHeight:r}}
|
|
293
|
+
function Le(e){return Number.isFinite(e)?e/C:0}function Y(e){return Number.isFinite(e)?e*C:0}const Ee=1440,sa=72;function Bn(e){return Y(e/Ee)}function ca(e){return Le(e)*Ee}function la(e){return e/Ee*
|
|
294
|
+
sa}function ua(e){return e/Ee}const da=Bn(M.columnGapTwips),fa=[1,2,3];function ga(e){return typeof e=="number"&&fa.includes(e)}function Xn(e,t){if(!t)return e??void 0;const n={...e??{}};for(const[r,i]of Object.
|
|
295
|
+
entries(t))i!==void 0&&(n[r]=i);return t.pageBorders===void 0&&/<w:pgBorders\b/.test(t.oxmlSectPr??"")&&delete n.pageBorders,n}function pa(e,t){return B(Xn(e,t))}function $n(e,t){return Math.max(En,e.
|
|
296
|
+
pageNumberStart+t)}function ma(e,t){return Rn($n(e,t),e.pageNumberFormat)}function ha(e){switch(e){case"apa7":return{pageLayout:B({pageSize:"letter",orientation:"portrait",marginTopPx:Y(1),marginRightPx:Y(
|
|
297
|
+
1),marginBottomPx:Y(1),marginLeftPx:Y(1),indentStepPx:L,blockSpacingPx:0,showPageNumbers:!0,pageNumberPosition:"top-right",pageNumberStart:1}),pageless:!1}}}function ba(e){const t=e.startsWith("top"),
|
|
298
|
+
n=e.endsWith("right");return{side:t?"headers":"footers",paragraph:{type:"paragraph",id:`pgnum-${Math.random().toString(36).slice(2,8)}`,...n?{align:"right"}:{},children:[{type:"text",text:"1",marks:{field:"\
|
|
299
|
+
page"}}]}}}const ya=[m.pageBorders,m.pageSize,m.orientation,m.marginTopPx,m.marginRightPx,m.marginBottomPx,m.marginLeftPx,m.marginPx,m.indentStepPx,m.blockSpacingPx,m.showPageNumbers,m.pageNumberPosition,
|
|
300
|
+
m.pageNumberStart,m.pageNumberFormat,m.pageNumberRestart,m.hyphenationEnabled,m.lineNumbering,m.columnCount,m.columnGapTwips,m.oxmlSectPr];function At(e,t){if(e.set(m.paragraphIndentStorageVersion,St),
|
|
301
|
+
!t)return;const n=B(t),r=Li(n.pageBorders);r!==void 0?e.set(m.pageBorders,r):e.delete(m.pageBorders),e.set(m.pageSize,n.pageSize),e.set(m.orientation,n.orientation),e.set(m.marginTopPx,n.marginTopPx),
|
|
302
|
+
e.set(m.marginRightPx,n.marginRightPx),e.set(m.marginBottomPx,n.marginBottomPx),e.set(m.marginLeftPx,n.marginLeftPx),n.marginTopPx===n.marginRightPx&&n.marginTopPx===n.marginBottomPx&&n.marginTopPx===
|
|
303
|
+
n.marginLeftPx?e.set(m.marginPx,n.marginTopPx):e.delete(m.marginPx),e.set(m.indentStepPx,n.indentStepPx),e.set(m.blockSpacingPx,n.blockSpacingPx),e.set(m.showPageNumbers,n.showPageNumbers),e.set(m.pageNumberPosition,
|
|
304
|
+
n.pageNumberPosition),e.set(m.pageNumberStart,n.pageNumberStart),n.pageNumberFormat!==M.pageNumberFormat?e.set(m.pageNumberFormat,n.pageNumberFormat):e.delete(m.pageNumberFormat),n.pageNumberRestart===
|
|
305
|
+
!0?e.set(m.pageNumberRestart,!0):e.delete(m.pageNumberRestart),n.hyphenationEnabled?e.set(m.hyphenationEnabled,!0):e.delete(m.hyphenationEnabled);const i=Ln(n.lineNumbering);i!==void 0?e.set(m.lineNumbering,
|
|
306
|
+
i):e.delete(m.lineNumbering),n.columnCount!==M.columnCount?e.set(m.columnCount,n.columnCount):e.delete(m.columnCount),n.columnGapTwips!==M.columnGapTwips?e.set(m.columnGapTwips,n.columnGapTwips):e.delete(
|
|
307
|
+
m.columnGapTwips),n.oxmlSectPr?e.set(m.oxmlSectPr,n.oxmlSectPr):e.delete(m.oxmlSectPr)}function Be(e){if(!ya.some(v=>e.has(v)))return;const t=e.get(m.pageSize),n=e.get(m.orientation),r=e.get(m.marginTopPx),
|
|
308
|
+
i=e.get(m.marginRightPx),s=e.get(m.marginBottomPx),o=e.get(m.marginLeftPx),a=e.get(m.marginPx),c=e.get(m.indentStepPx),l=e.get(m.blockSpacingPx),d=e.get(m.showPageNumbers),u=e.get(m.pageNumberPosition),
|
|
309
|
+
g=e.get(m.pageNumberStart),p=e.get(m.hyphenationEnabled),f=e.get(m.lineNumbering),h=e.get(m.columnCount),b=e.get(m.columnGapTwips),x=e.get(m.oxmlSectPr),y=Pt(t)?t:void 0;return B({pageSize:y,orientation:n===
|
|
310
|
+
"portrait"||n==="landscape"?n:void 0,marginTopPx:typeof r=="number"?r:void 0,marginRightPx:typeof i=="number"?i:void 0,marginBottomPx:typeof s=="number"?s:void 0,marginLeftPx:typeof o=="number"?o:void 0,
|
|
311
|
+
marginPx:typeof a=="number"?a:void 0,indentStepPx:typeof c=="number"?c:void 0,blockSpacingPx:typeof l=="number"?l:void 0,showPageNumbers:typeof d=="boolean"?d:void 0,pageNumberPosition:vt(u)?u:void 0,
|
|
312
|
+
pageNumberStart:typeof g=="number"?g:void 0,pageNumberFormat:wt(e.get(m.pageNumberFormat))?e.get(m.pageNumberFormat):void 0,pageNumberRestart:e.get(m.pageNumberRestart)===!0?!0:void 0,hyphenationEnabled:typeof p==
|
|
313
|
+
"boolean"?p:void 0,pageBorders:te(e.get(m.pageBorders)),lineNumbering:typeof f=="string"?f:void 0,columnCount:typeof h=="number"?h:void 0,columnGapTwips:typeof b=="number"?b:void 0,oxmlSectPr:typeof x==
|
|
314
|
+
"string"&&x?x:void 0})}function zn(e,t){for(const[n,r]of e.afterState){const i=e.beforeState.get(n)??0;if(i>=r)continue;const s=e.doc.store.clients.get(n);if(s)for(let o=w.findIndexSS(s,i);o<s.length&&
|
|
315
|
+
s[o].id.clock<r;o++){const a=s[o];a instanceof w.Item&&t(a)}}}function xe(e,t){return typeof e=="object"&&e!==null&&e.constructor?.name===t}function N(e){return e instanceof w.XmlElement||xe(e,"YXmlEl\
|
|
316
|
+
ement")&&typeof e.nodeName=="string"&&typeof e.getAttribute=="function"&&typeof e.setAttribute=="function"&&typeof e.get=="function"&&typeof e.length=="number"}function xa(e){return e instanceof w.XmlText||
|
|
317
|
+
xe(e,"YXmlText")&&typeof e.insert=="function"&&typeof e.toDelta=="function"&&typeof e.toString=="function"}function Dn(e){return e instanceof w.Map||xe(e,"YMap")&&typeof e.get=="function"&&typeof e.set==
|
|
318
|
+
"function"&&typeof e.forEach=="function"}function wa(e){return e instanceof w.Array||xe(e,"YArray")&&typeof e.get=="function"&&typeof e.insert=="function"&&typeof e.delete=="function"&&typeof e.length==
|
|
319
|
+
"number"}function ka(e){return e instanceof w.YXmlEvent||xe(e,"YXmlEvent")&&typeof e.childListChanged=="boolean"}function Nt(e){return e.get(m.paragraphIndentStorageVersion)===St}const It=new WeakMap;
|
|
320
|
+
function Sa(e){let t=It.get(e);if(!t){const n=new Map,r=[ze(e),e.getXmlFragment("chrome"),e.getXmlFragment("notes")];let i=new WeakMap,s=new WeakMap;const o=u=>{const g=u.getAttribute("id");g&&(n.set(
|
|
321
|
+
g,u),s.set(u,g));const p=new Set(u.toArray().filter(N));i.set(u,p);for(const f of p)o(f)},a=u=>{const g=s.get(u);g&&n.get(g)===u&&n.delete(g);for(const p of i.get(u)??[])a(p);i.delete(u),s.delete(u)},
|
|
322
|
+
c=u=>{const g=i.get(u)??new Set,p=new Set(u.toArray().filter(N));for(const f of g)p.has(f)||a(f);for(const f of p)g.has(f)||o(f);i.set(u,p)},l=()=>{n.clear(),i=new WeakMap,s=new WeakMap;for(const u of r)
|
|
323
|
+
c(u)};l();const d=u=>{for(const g of u){if(!ka(g))continue;const p=g.target;if(g.changes.added.size||g.changes.deleted.size){const f=i.get(p)??new Set;for(const h of g.changes.deleted)for(const b of h.
|
|
324
|
+
content.getContent())N(b)&&f.delete(b)&&a(b);for(const h of g.changes.added)for(const b of h.content.getContent())N(b)&&!f.has(b)&&(f.add(b),o(b));i.set(p,f)}if(N(p)&&g.changes.keys.has("id")){const f=s.
|
|
325
|
+
get(p);f&&n.get(f)===p&&n.delete(f),s.delete(p);const h=p.getAttribute("id");h&&(n.set(h,p),s.set(p,h))}}};for(const u of r)u.observeDeep(d);t={index:n,observer:d,rebuild:l},It.set(e,t)}return t.index}
|
|
326
|
+
function Xe(e){return e.share.has("paragraphs")?e.getArray("paragraphs").length>0:!1}function Mt(e){return e.share.has("content")?e.getXmlFragment("content").length>0:!1}function Ct(e){return!!(Mt(e)||
|
|
327
|
+
Xe(e))}function va(e){if(!Xe(e)||Mt(e))return;const t=e.getArray("paragraphs"),n=e.getXmlFragment("content"),r=e.getMap("metadata"),i=r?.get("defaultFontFamily"),s=Be(r),o=B(s).indentStepPx,a=Nt(r);e.
|
|
328
|
+
transact(()=>{t.forEach(c=>{const l=Ft(c,i,o,a);l&&n.push([l])}),t.delete(0,t.length)})}function Ft(e,t,n,r=!1){const i=e.get("type")||"paragraph",s=e.get("id")||P();switch(i){case"page-break":{const o=new w.
|
|
329
|
+
XmlElement("page-break");o.setAttribute("id",s);const a=e.get("diffState"),c=e.get("suggestionId");return(a==="insert"||a==="delete"||a==="equal")&&o.setAttribute("diffState",a),typeof c=="string"&&o.
|
|
330
|
+
setAttribute("suggestionId",c),o}case"section-break":{const o=new w.XmlElement("section-break");o.setAttribute("id",s);const a=e.get("layout");typeof a=="string"&&o.setAttribute("layout",a);const c=e.
|
|
331
|
+
get("breakType");typeof c=="string"&&o.setAttribute("breakType",c);const l=e.get("diffState"),d=e.get("suggestionId");return(l==="insert"||l==="delete"||l==="equal")&&o.setAttribute("diffState",l),typeof d==
|
|
332
|
+
"string"&&o.setAttribute("suggestionId",d),o}case"toc":{const o=new w.XmlElement("toc");o.setAttribute("id",s);const a=e.get("levels");typeof a=="number"&&a>=1&&a<=6&&o.setAttribute("levels",String(a));
|
|
333
|
+
const c=e.get("instr");typeof c=="string"&&c!==""&&o.setAttribute("instr",c);const l=e.get("direction"),d=e.get("align");(l==="rtl"||l==="ltr")&&o.setAttribute("direction",l),(d==="left"||d==="center"||
|
|
334
|
+
d==="right"||d==="justify")&&o.setAttribute("align",d);const u=e.get("fontFamily");typeof u=="string"&&u!==""&&o.setAttribute("fontFamily",u);const g=e.get("fontSize");typeof g=="number"&&g>0&&o.setAttribute(
|
|
335
|
+
"fontSize",String(g));const p=e.get("color");typeof p=="string"&&p!==""&&o.setAttribute("color",p);const f=e.get("diffState"),h=e.get("suggestionId");return(f==="insert"||f==="delete"||f==="equal")&&o.
|
|
336
|
+
setAttribute("diffState",f),typeof h=="string"&&o.setAttribute("suggestionId",h),o}case"placeholder":{const o=new w.XmlElement("placeholder");return o.setAttribute("id",s),o.setAttribute("height",String(
|
|
337
|
+
e.get("height")||100)),o}case"image":{const o=new w.XmlElement("image");o.setAttribute("id",s);const a=e.get("diffState"),c=e.get("suggestionId");return(a==="insert"||a==="delete"||a==="equal")&&o.setAttribute(
|
|
338
|
+
"diffState",a),typeof c=="string"&&o.setAttribute("suggestionId",c),o.setAttribute("src",e.get("src")||""),e.get("sourceUrl")&&o.setAttribute("sourceUrl",e.get("sourceUrl")),o.setAttribute("width",String(
|
|
339
|
+
e.get("width")||200)),o.setAttribute("height",String(e.get("height")||200)),e.get("alt")&&o.setAttribute("alt",e.get("alt")),e.get("align")&&o.setAttribute("align",e.get("align")),e.get("uploading")!==
|
|
340
|
+
void 0&&o.setAttribute("uploading",String(e.get("uploading"))),e.get("tempId")&&o.setAttribute("tempId",e.get("tempId")),e.get("originalFormat")&&o.setAttribute("originalFormat",e.get("originalFormat")),
|
|
341
|
+
e.get("originalDataUrl")&&o.setAttribute("originalDataUrl",e.get("originalDataUrl")),e.get("anchorXml")&&o.setAttribute("anchorXml",e.get("anchorXml")),o}case"list":{const o=new w.XmlElement("list");o.
|
|
342
|
+
setAttribute("id",s),o.setAttribute("variant",e.get("variant")||"unordered"),e.get("startNumber")!==void 0&&o.setAttribute("startNumber",String(e.get("startNumber"))),e.get("numberingChainId")&&o.setAttribute(
|
|
343
|
+
"numberingChainId",e.get("numberingChainId")),e.get("numberingFormat")&&o.setAttribute("numberingFormat",e.get("numberingFormat"));const a=e.get("items");return a&&a.forEach(c=>{const l=Pa(c,t);l&&o.push(
|
|
344
|
+
[l])}),o}case"footnote":{const o=new w.XmlElement("footnote");o.setAttribute("id",s),e.get("noteKind")==="endnote"&&o.setAttribute("noteKind","endnote");const a=e.get("children");return a&&a.forEach(c=>{
|
|
345
|
+
const l=Ft(c,t,n,r);l&&o.push([l])}),o}case"container":{const o=new w.XmlElement("container");o.setAttribute("id",s),e.get("borderColor")&&o.setAttribute("borderColor",e.get("borderColor")),typeof e.get(
|
|
346
|
+
"padding")=="number"&&o.setAttribute("padding",String(e.get("padding")));const a=e.get("children");return a&&a.forEach(c=>{const l=Ft(c,t,n,r);l&&o.push([l])}),o}case"paragraph":default:{const o=new w.
|
|
347
|
+
XmlElement("paragraph");o.setAttribute("id",s),e.get("heading")!==void 0&&o.setAttribute("heading",String(e.get("heading"))),e.get("align")!==void 0&&o.setAttribute("align",e.get("align")),e.get("line\
|
|
348
|
+
Spacing")!==void 0&&o.setAttribute("lineSpacing",String(e.get("lineSpacing")));{const f={};Me(f,e.get("pagination"));const h=Ie(f);h!==void 0&&o.setAttribute("pagination",h)}{const f=e.get("styleId");
|
|
349
|
+
typeof f=="string"&&f&&o.setAttribute("styleId",f)}{const f=e.get("direction");(f==="rtl"||f==="ltr")&&o.setAttribute("direction",f)}{const f=e.get("tabStops");typeof f=="string"&&f&&o.setAttribute("t\
|
|
350
|
+
abStops",f)}{const f=e.get("borders");typeof f=="string"&&f&&o.setAttribute("borders",f)}{const f=e.get("shading");typeof f=="string"&&f&&o.setAttribute("shading",f)}const a=e.get("leftIndent"),c=a===
|
|
351
|
+
0?0:Re(ee(a,{indentStepPx:n,storedAsUnits:r}));c!==void 0&&o.setAttribute("leftIndent",String(c));const l=e.get("firstLineIndent"),d=l===0?0:Oe(ee(l,{indentStepPx:n,storedAsUnits:r,firstLine:!0}));d!==
|
|
352
|
+
void 0&&o.setAttribute("firstLineIndent",String(d));const u=e.get("content"),g=new w.XmlText;if(u){const f=ce(u);let h=0;for(const b of f)if(typeof b.insert=="string"){const x=b.attributes||{};t&&!x.fontFamily&&
|
|
353
|
+
(x.fontFamily=t),le(g,h,b.insert,x),h+=b.insert.length}}const p=e.get("_emptyTextMarks");return p&&o.setAttribute("_emptyTextMarks",JSON.stringify(p)),o.push([g]),o}}}function Pa(e,t){if(!e)return null;
|
|
354
|
+
const n=new w.XmlElement("list-item");n.setAttribute("id",e.get("id")||P()),e.get("checked")!==void 0&&n.setAttribute("checked",String(e.get("checked"))),typeof e.get("indentLevel")=="number"&&e.get("\
|
|
355
|
+
indentLevel")>0&&n.setAttribute("indentLevel",String(e.get("indentLevel"))),(e.get("direction")==="rtl"||e.get("direction")==="ltr")&&n.setAttribute("direction",e.get("direction"));const r=e.get("cont\
|
|
356
|
+
ent"),i=new w.XmlText;if(r){const o=ce(r);let a=0;for(const c of o)if(typeof c.insert=="string"){const l=c.attributes||{};t&&!l.fontFamily&&(l.fontFamily=t),le(i,a,c.insert,l),a+=c.insert.length}}const s=e.
|
|
357
|
+
get("_emptyTextMarks");return s&&n.setAttribute("_emptyTextMarks",JSON.stringify(s)),n.push([i]),n}const Gn={indentStepPx:B(void 0).indentStepPx,storedAsUnits:!1};function Wn(e,t,n=!1){return ee(e,{indentStepPx:t.
|
|
358
|
+
indentStepPx,storedAsUnits:t.storedAsUnits,firstLine:n})}function Aa(e,t){return Na(e,t)}function Na(e,t){const n=new w.Doc({gc:!0,autoLoad:!1,shouldLoad:!1}),r=n.getXmlFragment("content"),i=n.getMap(
|
|
359
|
+
"metadata");if(t?.sharedStyles&&i.set("sharedStylesVersion",1),e.title&&i.set("title",e.title),e.pageless!==void 0?i.set("pageless",e.pageless):i.has("pageless")||i.set("pageless",!1),At(i,e.pageLayout),
|
|
360
|
+
e.coreProperties&&Object.keys(e.coreProperties).length>0&&i.set("coreProperties",e.coreProperties),e.fontSubstitutes&&Object.keys(e.fontSubstitutes).length>0&&i.set("fontSubstitutes",e.fontSubstitutes),
|
|
361
|
+
e.comments&&e.comments.length>0){const s=n.getMap("comments");for(const o of e.comments)s.set(o.id,o)}if(e.sdtWrappers&&e.sdtWrappers.length>0){const s=n.getMap("sdt-wrappers");for(const o of e.sdtWrappers)
|
|
362
|
+
s.set(o.id,o)}if(e.oxmlRanges&&e.oxmlRanges.length>0){const s=n.getMap("oxml-ranges");for(const o of e.oxmlRanges)s.set(o.id,o)}return e.stylesXml&&i.set("stylesXml",e.stylesXml),e.stylesheet&&e.stylesheet.
|
|
363
|
+
paragraphStyles.length>0&&i.set("stylesheet",e.stylesheet),e.docxSource&&i.set("docxSource",e.docxSource),e.watermark&&i.set("watermark",e.watermark),e.chromeImages&&e.chromeImages.length>0&&i.set("ch\
|
|
364
|
+
romeImages",e.chromeImages),n.transact(()=>{const s=n.getXmlFragment("chrome"),o=e.chrome&&e.chrome.length>0?e.chrome:e.children.some(l=>l.type==="header-footer")?e.children.filter(l=>l.type==="header\
|
|
365
|
+
-footer"):xt(e.headers,e.footers),a=n.getXmlFragment("notes"),c=e.notes&&e.notes.length>0?e.notes:e.children.filter(l=>l.type==="footnote");e.children.forEach(l=>{l.type==="header-footer"||l.type==="f\
|
|
366
|
+
ootnote"||re(l,r)}),o.forEach(l=>{re(l,s)}),c.forEach(l=>{re(l,a)})}),n}function _n(e,t){const n=e.getXmlFragment("content"),r=e.getMap("metadata");e.transact(()=>{if(t.title&&r.set("title",t.title),t.
|
|
367
|
+
pageless!==void 0&&r.set("pageless",t.pageless),At(r,t.pageLayout),t.coreProperties&&Object.keys(t.coreProperties).length>0&&r.set("coreProperties",t.coreProperties),t.fontSubstitutes&&Object.keys(t.fontSubstitutes).
|
|
368
|
+
length>0&&r.set("fontSubstitutes",t.fontSubstitutes),t.comments&&t.comments.length>0){const c=e.getMap("comments");for(const l of t.comments)c.set(l.id,l)}if(t.sdtWrappers&&t.sdtWrappers.length>0){const c=e.
|
|
369
|
+
getMap("sdt-wrappers");for(const l of t.sdtWrappers)c.set(l.id,l)}if(t.oxmlRanges&&t.oxmlRanges.length>0){const c=e.getMap("oxml-ranges");for(const l of t.oxmlRanges)c.set(l.id,l)}t.stylesXml&&r.set("\
|
|
370
|
+
stylesXml",t.stylesXml),t.stylesheet&&t.stylesheet.paragraphStyles.length>0&&r.set("stylesheet",t.stylesheet),t.docxSource&&r.set("docxSource",t.docxSource),t.watermark&&r.set("watermark",t.watermark),
|
|
371
|
+
t.chromeImages&&t.chromeImages.length>0&&r.set("chromeImages",t.chromeImages);const i=e.getXmlFragment("chrome"),s=t.chrome&&t.chrome.length>0?t.chrome:t.children.some(c=>c.type==="header-footer")?t.children.
|
|
372
|
+
filter(c=>c.type==="header-footer"):xt(t.headers,t.footers),o=e.getXmlFragment("notes"),a=t.notes&&t.notes.length>0?t.notes:t.children.filter(c=>c.type==="footnote");t.children.forEach(c=>{c.type==="h\
|
|
373
|
+
eader-footer"||c.type==="footnote"||re(c,n)}),s.forEach(c=>{re(c,i)}),a.forEach(c=>{re(c,o)})})}function Ia(e,t){const n=Kn(e,t);if(!n)return null;const r=e.getMap("metadata"),i=B(Be(r));return $e(n,{
|
|
374
|
+
indentStepPx:i.indentStepPx,storedAsUnits:Nt(r)})}function Un(e){const t=e.getMap("metadata"),n=t?.get("title"),r=t?.get("pageless"),i=Be(t),s={indentStepPx:B(i).indentStepPx,storedAsUnits:Nt(t)},o=e.
|
|
375
|
+
getXmlFragment("content");let a;if(o.length>0){a=[];for(const S of o.toArray())if(N(S)){const k=$e(S,s);k&&a.push(k)}}else{const S=e.getArray("paragraphs"),k=t?.get("defaultFontFamily");a=[],S.forEach(
|
|
376
|
+
$=>{const O=we($,k,s);O&&a.push(O)})}const c={type:"doc",children:a};n&&(c.title=n),r!==void 0&&(c.pageless=r),i&&(c.pageLayout=i);const l=t?.get("coreProperties");l&&typeof l=="object"&&Object.keys(l).
|
|
377
|
+
length>0&&(c.coreProperties={...l});const d=t?.get("fontSubstitutes");d&&typeof d=="object"&&Object.keys(d).length>0&&(c.fontSubstitutes={...d},en(c.fontSubstitutes));const u=e.getXmlFragment("chrome"),
|
|
378
|
+
g=[];for(const S of u.toArray())if(N(S)){const k=$e(S,s);k&&k.type==="header-footer"&&g.push(k)}g.length>0&&(c.chrome=g);const p=e.getXmlFragment("notes"),f=[];for(const S of p.toArray())if(N(S)){const k=$e(
|
|
379
|
+
S,s);k&&k.type==="footnote"&&f.push(k)}const h=c.children.filter(S=>S.type==="footnote");h.length>0&&(c.children=c.children.filter(S=>S.type!=="footnote"),f.push(...h)),f.length>0&&(c.notes=f,qt(c));const b=Fn(
|
|
380
|
+
g),x=t?.get("headers"),y=t?.get("footers"),v=b.headers??(x&&Object.keys(x).length>0?x:void 0),T=b.footers??(y&&Object.keys(y).length>0?y:void 0);v&&(c.headers=v),T&&(c.footers=T);const U=e.getMap("com\
|
|
381
|
+
ments");if(U.size>0){const S=[];U.forEach(k=>{k&&typeof k=="object"&&S.push(k)}),S.length>0&&(S.sort((k,$)=>(k.createdAt??"").localeCompare($.createdAt??"")),c.comments=S)}const X=e.getMap("sdt-wrappe\
|
|
382
|
+
rs");if(X.size>0){const S=[];if(X.forEach(k=>{k&&typeof k=="object"&&S.push(k)}),S.length>0){const k=new Map;c.children.forEach((O,Se)=>{O.id&&k.set(O.id,Se)});const $=O=>O.blockIds?.[0]??O.startBlockId??
|
|
383
|
+
"";S.sort((O,Se)=>(k.get($(O))??Number.MAX_SAFE_INTEGER)-(k.get($(Se))??Number.MAX_SAFE_INTEGER)||O.id.localeCompare(Se.id)),c.sdtWrappers=S}}const R=e.getMap("oxml-ranges");if(R.size>0){const S=[];R.
|
|
384
|
+
forEach(k=>{k&&typeof k=="object"&&S.push(k)}),S.length>0&&(S.sort((k,$)=>k.id.localeCompare($.id)),c.oxmlRanges=S)}const H=e.getMap("metadata").get("stylesXml");typeof H=="string"&&H.length>0&&(c.stylesXml=
|
|
385
|
+
H);const q=e.getMap("metadata").get("stylesheet");q&&typeof q=="object"&&Array.isArray(q.paragraphStyles)&&q.paragraphStyles.length>0&&(c.stylesheet=q);const V=e.getMap("metadata").get("docxSource");V&&
|
|
386
|
+
typeof V=="object"&&Array.isArray(V.spans)&&(c.docxSource=V);const Ue=e.getMap("metadata").get("watermark");typeof Ue=="string"&&Ue.length>0&&(c.watermark=Ue);const He=e.getMap("metadata").get("chrome\
|
|
387
|
+
Images");return Array.isArray(He)&&He.length>0&&(c.chromeImages=He),c}function re(e,t){t.push([yt(e,t.doc??void 0)])}function $e(e,t=Gn){return me(e,t)}function we(e,t,n=Gn){const r=e.get("type")||"pa\
|
|
388
|
+
ragraph",i=e.get("id")||P();switch(r){case"page-break":const s={type:"page-break",id:i};{const o=e.get("diffState"),a=e.get("suggestionId");(o==="insert"||o==="delete"||o==="equal")&&(s.diffState=o),typeof a==
|
|
389
|
+
"string"&&(s.suggestionId=a)}return s;case"section-break":{const o={type:"section-break",id:i},a=e.get("layout");if(typeof a=="string")try{o.layout=JSON.parse(a)}catch{}const c=e.get("breakType");(c===
|
|
390
|
+
"nextPage"||c==="continuous"||c==="evenPage"||c==="oddPage")&&(o.breakType=c);const l=e.get("diffState"),d=e.get("suggestionId");return(l==="insert"||l==="delete"||l==="equal")&&(o.diffState=l),typeof d==
|
|
391
|
+
"string"&&(o.suggestionId=d),o}case"toc":{const o={type:"toc",id:i},a=e.get("levels");typeof a=="number"&&a>=1&&a<=6&&(o.levels=a);const c=e.get("instr");typeof c=="string"&&c!==""&&(o.instr=c);const l=e.
|
|
392
|
+
get("direction"),d=e.get("align");(l==="rtl"||l==="ltr")&&(o.direction=l),(d==="left"||d==="center"||d==="right"||d==="justify")&&(o.align=d);const u=e.get("fontFamily");typeof u=="string"&&u!==""&&(o.
|
|
393
|
+
fontFamily=u);const g=e.get("fontSize");typeof g=="number"&&g>0&&(o.fontSize=g);const p=e.get("color");typeof p=="string"&&p!==""&&(o.color=p);const f=e.get("diffState"),h=e.get("suggestionId");return(f===
|
|
394
|
+
"insert"||f==="delete"||f==="equal")&&(o.diffState=f),typeof h=="string"&&(o.suggestionId=h),o}case"placeholder":return{type:"placeholder",id:i,height:e.get("height")||100};case"image":{const o={type:"\
|
|
395
|
+
image",id:i,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},a=e.get("diffState"),
|
|
396
|
+
c=e.get("suggestionId");(a==="insert"||a==="delete"||a==="equal")&&(o.diffState=a),typeof c=="string"&&(o.suggestionId=c);const l=e.get("uploading");l!==void 0&&(o.uploading=l);const d=e.get("tempId");
|
|
397
|
+
d&&(o.tempId=d);const u=e.get("originalFormat");(u==="emf"||u==="wmf")&&(o.originalFormat=u);const g=e.get("originalDataUrl");typeof g=="string"&&g&&(o.originalDataUrl=g);const p=e.get("anchorXml");return typeof p==
|
|
398
|
+
"string"&&p&&(o.anchorXml=p),o}case"list":{const o=e.get("items"),a=[];o&&o.forEach(g=>{const p=Ma(g);p&&a.push(p)});const c={type:"list",id:i,variant:e.get("variant")||"unordered",children:a},l=e.get(
|
|
399
|
+
"startNumber");l!==void 0&&(c.startNumber=l);const d=e.get("numberingChainId");d&&(c.numberingChainId=d);const u=e.get("numberingFormat");return u&&(c.numberingFormat=u),c}case"footnote":{const o=e.get(
|
|
400
|
+
"children"),a=[];o&&o.forEach(l=>{const d=we(l,t,n);d&&a.push(d)});const c={type:"footnote",id:i,children:a};return e.get("noteKind")==="endnote"&&(c.noteKind="endnote"),c}case"container":{const o=e.get(
|
|
401
|
+
"children"),a=[];o&&o.forEach(u=>{const g=we(u,t,n);g&&a.push(g)});const c={type:"container",id:i,children:a},l=e.get("borderColor");l&&(c.borderColor=l);const d=e.get("padding");return typeof d=="num\
|
|
402
|
+
ber"&&(c.padding=d),c}case"table":{const o=e.get("children"),a=[];o&&o.forEach(y=>{const v=y.get("id")||P(),T=y.get("children"),U=[];T&&T.forEach(q=>{const V=we(q,t,n);V&&U.push(V)});const X={type:"ta\
|
|
403
|
+
ble-row",id:v,children:U},R=y.get("oxmlAttrs");typeof R=="string"&&R&&(X.oxmlAttrs=R);const H=y.get("oxmlTrPr");typeof H=="string"&&H&&(X.oxmlTrPr=H),a.push(X)});const c=e.get("columnWidths")||[],l={type:"\
|
|
404
|
+
table",id:i,children:a,columnWidths:c},d=e.get("tableWidth"),u=e.get("align"),g=e.get("borderColor"),p=e.get("borderWidth"),f=e.get("borders"),h=e.get("cellPadding"),b=e.get("hasHeader");d!==void 0&&(l.
|
|
405
|
+
tableWidth=d),(u==="left"||u==="center"||u==="right")&&(l.align=u),g&&(l.borderColor=g),p!==void 0&&(l.borderWidth=p),typeof f=="string"&&f&&(l.borders=f),h!==void 0&&(l.cellPadding=h),b!==void 0&&(l.
|
|
406
|
+
hasHeader=b);const x=e.get("oxmlTblPr");return typeof x=="string"&&x&&(l.oxmlTblPr=x),l}case"table-cell":{const o=e.get("children"),a=[];o&&o.forEach(b=>{const x=we(b,t,n);x&&a.push(x)});const c={type:"\
|
|
407
|
+
table-cell",id:i,children:a},l=e.get("verticalAlign"),d=e.get("backgroundColor");l&&(c.verticalAlign=l),d&&(c.backgroundColor=d);const u=e.get("borders"),g=e.get("padding");typeof u=="string"&&u&&(c.borders=
|
|
408
|
+
u),typeof g=="string"&&g&&(c.padding=g);const p=Number(e.get("colSpan")),f=Number(e.get("rowSpan"));Number.isFinite(p)&&p>1&&(c.colSpan=p),Number.isFinite(f)&&f>1&&(c.rowSpan=f);const h=e.get("oxmlTcP\
|
|
409
|
+
r");return typeof h=="string"&&h&&(c.oxmlTcPr=h),c}case"code":{const o=e.get("renderDiagram"),a=e.get("showDiagramSource"),c={type:"code",id:i,content:e.get("content")||"",language:e.get("language")||
|
|
410
|
+
void 0,renderDiagram:typeof o=="boolean"?o:void 0,showDiagramSource:typeof a=="boolean"?a:void 0},l=e.get("diffState"),d=e.get("suggestionId");return(l==="insert"||l==="delete"||l==="equal")&&(c.diffState=
|
|
411
|
+
l),typeof d=="string"&&(c.suggestionId=d),c}case"math":{const o=e.get("displayMode")||"block",a={type:"math",id:i,content:e.get("content")||"",displayMode:o},c=e.get("align");(c==="left"||c==="center"||
|
|
412
|
+
c==="right"||c==="justify")&&(a.align=c);const l=e.get("diffState"),d=e.get("suggestionId");return(l==="insert"||l==="delete"||l==="equal")&&(a.diffState=l),typeof d=="string"&&(a.suggestionId=d),e.get(
|
|
413
|
+
"showDiagramSource")===!0&&(a.showDiagramSource=!0),a}case"paragraph":default:{const o={type:"paragraph",id:i,children:[]},a=e.get("heading"),c=e.get("align"),l=e.get("lineSpacing"),d=e.get("leftInden\
|
|
414
|
+
t"),u=e.get("firstLineIndent"),g=e.get("structuralSuggestionId"),p=e.get("structuralSuggestionKind"),f=e.get("structuralSuggestionRole");a!==void 0&&(o.heading=a),c!==void 0&&(o.align=c),l!==void 0&&(o.
|
|
415
|
+
lineSpacing=l),Me(o,e.get("pagination"));{const y=e.get("styleId");typeof y=="string"&&y&&(o.styleId=y)}{const y=e.get("direction");(y==="rtl"||y==="ltr")&&(o.direction=y)}{const y=e.get("tabStops");typeof y==
|
|
416
|
+
"string"&&y&&(o.tabStops=y)}{const y=e.get("borders");typeof y=="string"&&y&&(o.borders=y)}{const y=e.get("shading");typeof y=="string"&&y&&(o.shading=y)}{const y=e.get("oxmlAttrs");typeof y=="string"&&
|
|
417
|
+
y&&(o.oxmlAttrs=y);const v=e.get("oxmlPPr");typeof v=="string"&&v&&(o.oxmlPPr=v)}typeof g=="string"&&(o.structuralSuggestionId=g),(p==="insert"||p==="delete"||p==="split"||p==="merge"||p==="change")&&
|
|
418
|
+
(o.structuralSuggestionKind=p),(f==="before"||f==="after")&&(o.structuralSuggestionRole=f);const h=Wn(d,n);d===0?o.leftIndent=0:h!==void 0&&(o.leftIndent=h);const b=Wn(u,n,!0);u===0?o.firstLineIndent=
|
|
419
|
+
0:b!==void 0&&(o.firstLineIndent=b);const x=e.get("content");if(x){const y=Hn(x);if(y.length>0)o.children=y;else{const v=e.get("_emptyTextMarks"),T={type:"text",text:""};v&&Object.keys(v).length>0?T.marks=
|
|
420
|
+
v:T.marks={fontFamily:fe},o.children=[T]}}else o.children=[{type:"text",text:"",marks:{fontFamily:fe}}];return t&&o.children.forEach(y=>{y.type==="text"&&(y.marks={fontFamily:t,...y.marks||{}})}),o}}}
|
|
421
|
+
function Ma(e){if(!e)return null;const t={type:"list-item",id:e.get("id")||P(),children:[]},n=e.get("checked");n!==void 0&&(t.checked=n);const r=e.get("indentLevel");typeof r=="number"&&r>0&&(t.indentLevel=
|
|
422
|
+
r);for(const o of ae){const a=e.get(o);typeof a=="number"&&Number.isFinite(a)&&a>=0&&(t[o]=a)}const i=e.get("direction");(i==="rtl"||i==="ltr")&&(t.direction=i);const s=e.get("content");if(s){const o=Hn(
|
|
423
|
+
s);if(o.length>0)t.children=o;else{const a=e.get("_emptyTextMarks");t.children=[{type:"text",text:"",marks:a||{fontFamily:fe}}]}}else t.children=[{type:"text",text:"",marks:{fontFamily:fe}}];return t}
|
|
424
|
+
function Hn(e){const t=[];return ce(e).forEach(n=>{if(typeof n.insert=="string"){const r=n.attributes||{},i={type:"text",text:n.insert};i.marks=nt(r),t.push(i)}}),sn(t)}function ze(e){return e.getXmlFragment(
|
|
425
|
+
"content")}const qn="block-id-repair";function Ca(e,t){let n=0;const r=i=>{for(const s of i.toArray())N(s)&&(s.getAttribute("id")===t&&n++,r(s))};for(const i of["content","chrome","notes"])e.share.has(
|
|
426
|
+
i)&&r(e.getXmlFragment(i));return n}function Fa(e){const t=new Set,n=r=>{if(r instanceof w.XmlFragment){if(N(r)){const i=r.getAttribute("id");i&&t.add(i)}for(const i of r.toArray())n(i)}};return zn(e,
|
|
427
|
+
r=>{if(r.deleted)return;const i=r.content;if(i instanceof w.ContentType)n(i.type);else if(r.parentSub==="id"&&N(r.parent)){const s=r.parent.getAttribute("id");s&&t.add(s)}}),t}function De(e,t,n){if(Array.
|
|
428
|
+
isArray(e))return e.map(i=>De(i,t,n));if(!e||typeof e!="object")return e;const r=e;return Object.fromEntries(Object.entries(r).map(([i,s])=>{const o=i==="id"&&typeof r.type=="string"&&!["block-change",
|
|
429
|
+
"block-insert","block-delete","table-change","inline-text","inline-format","paragraph-split","paragraph-merge"].includes(r.type);return s===t&&(o||/^(blockId|tableId|rowId|cellId|itemId|firstBlockId|secondBlockId|anchorBlockId|insertedBlockId|cleanupTrailingParagraphId)$/.
|
|
430
|
+
test(i))?[i,n]:(i==="blockIds"||i==="sequenceBlockIds")&&Array.isArray(s)?[i,s.map(a=>a===t?n:a)]:[i,De(s,t,n)]}))}function Ta(e,t,n){for(const r of["structuralSuggestionRecord","structuralSuggestionR\
|
|
431
|
+
ecords"]){const i=e.getAttribute(r);if(i)try{const s=De(JSON.parse(i),t,n);e.setAttribute(r,JSON.stringify(s));const o=e.doc?.share.get("liveSuggestions");if(Dn(o))for(const a of Array.isArray(s)?s:[s])
|
|
432
|
+
a?.id&&o.has(a.id)&&o.set(a.id,De(o.get(a.id),t,n))}catch{}}}function Ra(e){let t=P();for(;e.has(t);)t=P();return t}function Vn(e,t,n,r,i){const s=e.toArray();for(let o=s.length-1;o>=0;o--){const a=s[o];
|
|
433
|
+
N(a)&&i.has(a)&&e.delete(o,1)}for(const o of e.toArray()){if(!N(o))continue;const a=o.getAttribute("id");if(a)if(t.has(a)){const c=o._item.id,l=`dup_${c.client.toString(36)}_${c.clock.toString(36)}`;let d=l;
|
|
434
|
+
for(let u=1;r.has(d);u++)d=`${l}_${u}`;r.add(d),o.setAttribute("id",d),Ta(o,a,d),n.push({oldId:a,newId:d}),t.add(d)}else t.add(a);Vn(o,t,n,r,i)}}function Jn(e,t,n){for(const r of e.toArray()){if(!Dn(r))
|
|
435
|
+
continue;const i=r.get("id");if(typeof i=="string"&&i.length>0)if(t.has(i)){const s=Ra(t);r.set("id",s),n.push({oldId:i,newId:s}),t.add(s)}else t.add(i);r.forEach(s=>{wa(s)&&Jn(s,t,n)})}}function Oa(e,t={}){
|
|
436
|
+
const n=new Set,r=[],i=[],s={duplicatesFound:0,remappedIds:r,droppedIds:i},o=e.share.has("paragraphs")&&e.getArray("paragraphs").length>0,a=t.transaction?Fa(t.transaction):null;if(a&&a.size===0&&!o)return s;
|
|
437
|
+
const c=["content","chrome","notes"].filter(f=>e.share.has(f)).map(f=>e.getXmlFragment(f)),l=new Set,d=new Map;let u=!1;const g=f=>{for(const h of f.toArray()){if(!N(h))continue;const b=h.getAttribute(
|
|
438
|
+
"id");if(b&&(l.has(b)&&(u=!0),l.add(b),!a||a.has(b))){const x=d.get(b);x?x.push(h):d.set(b,[h])}g(h)}};if(c.forEach(g),!u&&!o)return s;const p=new Set;if(t.shouldDrop)for(const f of d.values()){if(f.length<
|
|
439
|
+
2)continue;const h=f.filter(b=>t.shouldDrop(b));if(!(h.length===0||h.length===f.length))for(const b of h)p.add(b),i.push(b.getAttribute("id"))}return e.transact(()=>{for(const f of c)Vn(f,n,r,l,p);if(o){
|
|
440
|
+
const f=e.getArray("paragraphs");Jn(f,n,r)}},qn),{duplicatesFound:r.length+i.length,remappedIds:r,droppedIds:i}}function ja(e){return Mt(e)?ze(e).length:Xe(e)?e.getArray("paragraphs").length:0}function Kn(e,t){
|
|
441
|
+
const n=Sa(e),r=n.get(t)??null,i=r?r._item:null;return r&&!i?.deleted&&r.getAttribute("id")===t?r:(It.get(e).rebuild(),n.get(t)??null)}function oe(e,t){const n=e.toArray();for(let r=0;r<n.length;r++){
|
|
442
|
+
const i=n[r];if(N(i)){if(i.getAttribute("id")===t)return{yBlock:i,yParent:e,index:r};if(i.nodeName==="list"||i.nodeName==="container"||i.nodeName==="footnote"||i.nodeName==="header-footer"||i.nodeName===
|
|
443
|
+
"table-cell"){const s=oe(i,t);if(s)return s}if(i.nodeName==="table"){const s=i.toArray();for(let o=0;o<s.length;o++){const a=s[o];if(N(a)&&a.nodeName==="table-row"){if(a.getAttribute("id")===t)return{
|
|
444
|
+
yBlock:a,yParent:i,index:o};const c=oe(a,t);if(c)return c}}}if(i.nodeName==="table-row"){const s=oe(i,t);if(s)return s}}}return null}function La(e,t){const n=ze(e),r=oe(n,t);return r||oe(e.getXmlFragment(
|
|
445
|
+
"chrome"),t)||oe(e.getXmlFragment("notes"),t)}function Ea(e){for(const t of e.toArray())if(xa(t))return t;return null}let Ba=0;function Xa(){const e=Date.now().toString(36),t=Math.random().toString(36).
|
|
446
|
+
substring(2,9),n=(Ba++).toString(36);return`${e}-${t}-${n}`}const Yn="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function Qn(){const e=new Uint8Array(8);crypto.getRandomValues(e);
|
|
447
|
+
let t="";for(let n=0;n<8;n++)t+=Yn[e[n]%Yn.length];return t}const Tt="seed-claims",$a="revise:seed-race-repair";function Rt(e){const t=[];for(const n of e.toArray())if(n instanceof w.XmlElement){const r=n.
|
|
448
|
+
getAttribute("id");r&&t.push(r)}return t}function Zn(e){return{blockIds:Rt(e.getXmlFragment("content")),chromeIds:Rt(e.getXmlFragment("chrome")),noteIds:Rt(e.getXmlFragment("notes")),commentIds:[...e.
|
|
449
|
+
getMap("comments").keys()],sdtIds:[...e.getMap("sdt-wrappers").keys()],oxmlRangeIds:[...e.getMap("oxml-ranges").keys()]}}function ie(e,t){const n=new Set(t);return e.filter(r=>!n.has(r))}function er(e,t){
|
|
450
|
+
const n=Zn(e);e.transact(()=>{_n(e,t);const r=Zn(e),i={clientId:e.clientID,blockIds:ie(r.blockIds,n.blockIds),chromeIds:ie(r.chromeIds,n.chromeIds),noteIds:ie(r.noteIds,n.noteIds),commentIds:ie(r.commentIds,
|
|
451
|
+
n.commentIds),sdtIds:ie(r.sdtIds,n.sdtIds),oxmlRangeIds:ie(r.oxmlRangeIds,n.oxmlRangeIds)},s=`${Date.now().toString(36).padStart(9,"0")}-${Qn()}`;e.getMap("metadata").set("seedNonce",s),e.getMap(Tt).set(
|
|
452
|
+
s,i)})}function tr(e){const t=e._item;return typeof t?.id?.client=="number"?t.id.client:null}function Ot(e,t,n,r){if(t.size===0)return 0;const i=new Set,s=[],o=new Set;if(r!==void 0){for(const a of e.
|
|
453
|
+
toArray())if(a instanceof w.XmlElement&&tr(a)===r){const c=a.getAttribute("id");c&&o.add(c)}}for(let a=0;a<e.length;a++){const c=e.get(a);if(!(c instanceof w.XmlElement))continue;const l=c.getAttribute(
|
|
454
|
+
"id")??"";t.has(l)&&(n.has(l)&&(r!==void 0&&o.has(l)?tr(c)===r&&!i.has(l):!i.has(l))?i.add(l):s.push(a))}for(let a=s.length-1;a>=0;a--)e.delete(s[a],1);return s.length}function jt(e){const t=e.getMap(
|
|
455
|
+
Tt);if(t.size<2)return null;const n=e.getMap("metadata").get("seedNonce"),r=[...t.keys()].sort(),i=typeof n=="string"&&t.has(n)?n:r[0],s=[i,...r.filter(d=>d!==i)],o=t.get(s[0]),a=new Set([...o?.blockIds??
|
|
456
|
+
[],...o?.chromeIds??[],...o?.noteIds??[]]),c=s.slice(1);let l=0;return e.transact(()=>{for(const d of c){const u=t.get(d);if(u){l+=Ot(e.getXmlFragment("content"),new Set(u.blockIds??[]),a,o?.clientId),
|
|
457
|
+
Ot(e.getXmlFragment("chrome"),new Set(u.chromeIds??[]),a,o?.clientId),Ot(e.getXmlFragment("notes"),new Set(u.noteIds??[]),a,o?.clientId);const g=new Set([...o?.commentIds??[],...o?.sdtIds??[],...o?.oxmlRangeIds??
|
|
458
|
+
[]]);for(const p of u.commentIds??[])g.has(p)||e.getMap("comments").delete(p);for(const p of u.sdtIds??[])g.has(p)||e.getMap("sdt-wrappers").delete(p);for(const p of u.oxmlRangeIds??[])g.has(p)||e.getMap(
|
|
459
|
+
"oxml-ranges").delete(p)}t.delete(d)}},$a),{losingClaims:c.length,removedBlocks:l}}function za(e,t){const n=e.getMap(Tt),r=()=>{const i=jt(e);i&&t&&t(i)};return n.observe(r),r(),()=>n.unobserve(r)}const nr=[
|
|
460
|
+
"content","chrome","notes","comments","annotations","metadata","sdt-wrappers","paragraphs","docx-carrier","oxml-ranges","seed-claims"];function Lt(){return new w.Doc({gc:!0,autoLoad:!1,shouldLoad:!1})}
|
|
461
|
+
function Da(e){const t=nr.filter(n=>e.share.has(n));if(!(t.length===0||e.share.has("content")||e.share.has("paragraphs")))throw new Error(`Revise collaboration: this Y.Doc already uses ${t.map(n=>`"${n}\
|
|
462
|
+
"`).join(", ")}, which the editor reserves for its own document. Give the editor its own document — pass \`connect\` and let it build one — or keep your data in a separate Y.Doc.`)}const Et=["wind\
|
|
463
|
+
ow","document","DOMParser","XMLSerializer","Node","Element","HTMLElement","NodeFilter","XPathResult","File"];let Ge=null;function Ga(e){const t=globalThis;if(t.__reviseServerRuntime=!0,Et.every(r=>t[r]))
|
|
464
|
+
return;const n=e().window;for(const r of Et)t[r]??(t[r]=n[r]);t.navigator??(t.navigator=n.navigator)}function ke(){if(!Ge){const e=Wa();e.catch(()=>{Ge=null}),Ge=e}return Ge}async function Wa(){const e=globalThis;
|
|
465
|
+
if(e.__reviseServerRuntime=!0,!e.File){const{File:i}=await import("node:buffer");i&&(e.File=i)}if(Et.every(i=>e[i]))return;let t;try{t=await import("jsdom")}catch(i){const s=new Error("revise/server n\
|
|
466
|
+
eeds the optional peer dependency jsdom in Node. Install it with: npm i jsdom");throw s.cause=i,s}const{JSDOM:n,VirtualConsole:r}=t;Ga(()=>new n("<!doctype html><html><body></body></html>",{virtualConsole:new r,
|
|
467
|
+
url:"https://headless.revise-sdk.invalid/"}))}function _a(e){const t=ar(e);if(t&&["docx","markdown","txt","html"].includes(t.id))return t.id;throw new Error(`Revise: cannot read "${e}" on the server. \
|
|
468
|
+
Readable formats: .docx, .md, .txt, .html.`)}async function Bt(e,t){await ke();const n=_a(t);return sr(e,t,n)}async function We(e,t){await ke();const n=await Xt(e,"docx",{docx:t?.originalDocx?{graft:{
|
|
469
|
+
originalDocx:t.originalDocx}}:void 0});return new Uint8Array(await n.arrayBuffer())}async function Ua(e,t){const n=await Bt(e,t),r=Lt();return er(r,n),await rr(r,n,e),r}async function rr(e,t,n){if(!t.
|
|
470
|
+
docxSource?.sourceHash)return;const{storeDocxCarrier:r}=await import("./DocxGraft-DjERgl-z.js");await r(e,n,{hash:t.docxSource.sourceHash})}async function Ha(e,t,n){if(Ct(e))return jt(e),!1;const r=await Bt(
|
|
471
|
+
t,n);return er(e,r),await rr(e,r,t),!0}function _e(e){return Un(e)}async function or(e){const{loadDocxCarrier:t}=await import("./DocxGraft-DjERgl-z.js"),n=t(e);return We(_e(e),{...n?{originalDocx:n.bytes}:
|
|
472
|
+
{}})}async function qa(e,t={}){await ke();const{format:n="docx",mode:r="review",title:i}=t,s=typeof e.getXmlFragment=="function";if(n==="docx"&&r==="review")return s?or(e):We(e);let o=s?_e(e):e;if(r===
|
|
473
|
+
"final"){const{scrubDocument:l}=await import("./DocumentScrubber-DS4LFDKS.js");o=l(o,{removeComments:!0,resolveSuggestions:"accept"}).doc}if(n==="docx")return We(o);const{DocumentMutator:a}=await import("./DocumentMutator-4vBJQ74L.js").
|
|
474
|
+
then(l=>l.x);o=a.materializeAcceptedSuggestions(o);const c=await Xt(o,n,n==="html"?{html:{title:i,includeWrapper:!0}}:{});return typeof c=="string"?new TextEncoder().encode(c):new Uint8Array(await c.arrayBuffer())}
|
|
475
|
+
async function Va(e){const{computeSourceFidelity:t,getDocxCarrierMeta:n}=await import("./DocxGraft-DjERgl-z.js");return t(_e(e),n(e))}function Ja(e){return Ct(e)}function Ka(e){return w.encodeStateAsUpdate(
|
|
476
|
+
e)}function Ya(e){const t=Lt();return w.applyUpdate(t,e,"revise-backend"),t}async function Qa(e,t){await ke();const{createServerDocumentSession:n}=await import("./serverDocumentSession-DASrQAbW.js");return n(
|
|
477
|
+
e,t)}export{An as $,Ho as A,Uo as B,qr as C,xo as D,Be as E,St as F,me as G,ue as H,Fn as I,qt as J,Fe as K,Ke as L,yt as M,La as N,ce as O,m as P,le as Q,cr as R,Ye as S,Or as T,Kn as U,ze as V,Wt as W,
|
|
478
|
+
Ea as X,Fr as Y,pa as Z,Sr as _,aa as a,Bi as a$,Ie as a0,Lr as a1,pn as a2,dt as a3,ft as a4,Vt as a5,zn as a6,fi as a7,gi as a8,Ci as a9,Wi as aA,ha as aB,Pt as aC,_i as aD,ga as aE,vt as aF,jn as aG,
|
|
479
|
+
Ln as aH,Ui as aI,At as aJ,Oa as aK,Me as aL,va as aM,ca as aN,ee as aO,Ko as aP,zr as aQ,Cr as aR,Mr as aS,Xr as aT,Jr as aU,Er as aV,Vr as aW,Kr as aX,je as aY,en as aZ,Cn as a_,be as aa,xt as ab,he as ac,
|
|
480
|
+
Nn as ad,Ii as ae,ba as af,Ni as ag,Xa as ah,Ir as ai,Ht as aj,Xe as ak,ja as al,lr as am,Ur as an,ae as ao,Tr as ap,Ca as aq,ki as ar,Ia as as,_n as at,qn as au,Fi as av,Xn as aw,te as ax,wt as ay,Tn as az,
|
|
481
|
+
ke as b,Mi as b0,Xi as b1,On as b2,Jo as b3,mn as b4,_r as b5,an as b6,nt as b7,So as b8,Ao as b9,gn as bA,fn as bB,ai as bC,yn as bD,xn as bE,Mo as bF,ge as bG,Bt as bH,We as bI,Ua as bJ,Ha as bK,_e as bL,
|
|
482
|
+
or as bM,qa as bN,Va as bO,Ja as bP,Ka as bQ,Ya as bR,Qa as bS,jt as bT,Lt as bU,Da as bV,nr as bW,go as ba,ho as bb,la as bc,Rn as bd,Ei as be,ma as bf,mt as bg,Io as bh,W as bi,qo as bj,vo as bk,Po as bl,
|
|
483
|
+
No as bm,fo as bn,po as bo,Qe as bp,pe as bq,Si as br,da as bs,Co as bt,Qn as bu,Hr as bv,oo as bw,eo as bx,Zo as by,si as bz,ua as c,Aa as d,yo as e,hn as f,$n as g,Ct as h,Yt as i,Kt as j,ct as k,lt as l,
|
|
484
|
+
Pr as m,on as n,za as o,Le as p,li as q,B as r,Re as s,Bn as t,ht as u,Oe as v,P as w,K as x,Un as y,Jt as z};
|