@eigenpal/docx-editor-agents 1.0.1 → 1.0.2

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function p(s,r){return s.map((e,l)=>{let n="";const o=[];for(const t of e.parts??[])if(t.type==="text")n+=t.text??"";else if(t.type.startsWith("tool-")){const u=t.state==="output-available"?"done":t.state==="output-error"?"error":"running";o.push({id:t.toolCallId??`${e.id}-tc-${o.length}`,name:t.type.slice(5),input:t.input,result:typeof t.output=="string"?t.output:void 0,error:t.errorText,status:u})}const a=l===s.length-1,i=e.role==="assistant"&&a&&(r==="streaming"||r==="submitted");return{id:e.id,role:e.role==="user"?"user":"assistant",text:n,toolCalls:o.length>0?o:void 0,status:i?"streaming":"done"}})}exports.toAgentMessages=p;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e,t){return e.map((n,r)=>{let i=``,a=[];for(let e of n.parts??[])if(e.type===`text`)i+=e.text??``;else if(e.type.startsWith(`tool-`)){let t=e.state===`output-available`?`done`:e.state===`output-error`?`error`:`running`;a.push({id:e.toolCallId??`${n.id}-tc-${a.length}`,name:e.type.slice(5),input:e.input,result:typeof e.output==`string`?e.output:void 0,error:e.errorText,status:t})}let o=r===e.length-1,s=n.role===`assistant`&&o&&(t===`streaming`||t===`submitted`);return{id:n.id,role:n.role===`user`?`user`:`assistant`,text:i,toolCalls:a.length>0?a:void 0,status:s?`streaming`:`done`}})}exports.toAgentMessages=e;
@@ -1,31 +1,28 @@
1
- function p(s, r) {
2
- return s.map((e, l) => {
3
- let n = "";
4
- const o = [];
5
- for (const t of e.parts ?? [])
6
- if (t.type === "text")
7
- n += t.text ?? "";
8
- else if (t.type.startsWith("tool-")) {
9
- const u = t.state === "output-available" ? "done" : t.state === "output-error" ? "error" : "running";
10
- o.push({
11
- id: t.toolCallId ?? `${e.id}-tc-${o.length}`,
12
- name: t.type.slice(5),
13
- input: t.input,
14
- result: typeof t.output == "string" ? t.output : void 0,
15
- error: t.errorText,
16
- status: u
17
- });
18
- }
19
- const a = l === s.length - 1, i = e.role === "assistant" && a && (r === "streaming" || r === "submitted");
20
- return {
21
- id: e.id,
22
- role: e.role === "user" ? "user" : "assistant",
23
- text: n,
24
- toolCalls: o.length > 0 ? o : void 0,
25
- status: i ? "streaming" : "done"
26
- };
27
- });
1
+ //#region src/ai-sdk/shared.ts
2
+ function e(e, t) {
3
+ return e.map((n, r) => {
4
+ let i = "", a = [];
5
+ for (let e of n.parts ?? []) if (e.type === "text") i += e.text ?? "";
6
+ else if (e.type.startsWith("tool-")) {
7
+ let t = e.state === "output-available" ? "done" : e.state === "output-error" ? "error" : "running";
8
+ a.push({
9
+ id: e.toolCallId ?? `${n.id}-tc-${a.length}`,
10
+ name: e.type.slice(5),
11
+ input: e.input,
12
+ result: typeof e.output == "string" ? e.output : void 0,
13
+ error: e.errorText,
14
+ status: t
15
+ });
16
+ }
17
+ let o = r === e.length - 1, s = n.role === "assistant" && o && (t === "streaming" || t === "submitted");
18
+ return {
19
+ id: n.id,
20
+ role: n.role === "user" ? "user" : "assistant",
21
+ text: i,
22
+ toolCalls: a.length > 0 ? a : void 0,
23
+ status: s ? "streaming" : "done"
24
+ };
25
+ });
28
26
  }
29
- export {
30
- p as toAgentMessages
31
- };
27
+ //#endregion
28
+ export { e as toAgentMessages };
package/dist/bridge.js CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkJH5VOTEK_js=require('./chunk-JH5VOTEK.js'),chunkTFIRB2ZB_js=require('./chunk-TFIRB2ZB.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js');Object.defineProperty(exports,"createEditorBridge",{enumerable:true,get:function(){return chunkJH5VOTEK_js.a}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunkTFIRB2ZB_js.m}});Object.defineProperty(exports,"agentTools",{enumerable:true,get:function(){return chunkRI5S75JY_js.a}});Object.defineProperty(exports,"executeToolCall",{enumerable:true,get:function(){return chunkRI5S75JY_js.b}});Object.defineProperty(exports,"getToolSchemas",{enumerable:true,get:function(){return chunkRI5S75JY_js.d}});
1
+ 'use strict';var chunkW6AWGFM4_js=require('./chunk-W6AWGFM4.js'),chunk6Z6UJ4RC_js=require('./chunk-6Z6UJ4RC.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js');Object.defineProperty(exports,"createEditorBridge",{enumerable:true,get:function(){return chunkW6AWGFM4_js.a}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunk6Z6UJ4RC_js.m}});Object.defineProperty(exports,"agentTools",{enumerable:true,get:function(){return chunkRI5S75JY_js.a}});Object.defineProperty(exports,"executeToolCall",{enumerable:true,get:function(){return chunkRI5S75JY_js.b}});Object.defineProperty(exports,"getToolSchemas",{enumerable:true,get:function(){return chunkRI5S75JY_js.d}});
package/dist/bridge.mjs CHANGED
@@ -1 +1 @@
1
- export{a as createEditorBridge}from'./chunk-DZYPK4JQ.mjs';export{m as createReviewerBridge}from'./chunk-DEDOV3KL.mjs';export{a as agentTools,b as executeToolCall,d as getToolSchemas}from'./chunk-24MVJKCP.mjs';
1
+ export{a as createEditorBridge}from'./chunk-J2BSSNNF.mjs';export{m as createReviewerBridge}from'./chunk-EKCQF23W.mjs';export{a as agentTools,b as executeToolCall,d as getToolSchemas}from'./chunk-24MVJKCP.mjs';
@@ -1,6 +1,6 @@
1
1
  import {o,n}from'./chunk-X4YGLGUM.mjs';import St from'jszip';import {xml2js,js2xml}from'xml-js';function E(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function F(e){return e==null||!Number.isFinite(e)?"0":String(Math.round(e))}var nn=1e5;function yt(){nn=1e5;}function rn(e){return e!=null&&e!==""&&e!==0?String(e):String(nn++)}function xt(e){if(!e)return "";if(e.rgb)return `<a:srgbClr val="${e.rgb.replace("#","")}"/>`;if(e.themeColor){let t=`<a:schemeClr val="${e.themeColor}"`;return e.themeTint?t+=`><a:tint val="${e.themeTint}"/></a:schemeClr>`:e.themeShade?t+=`><a:shade val="${e.themeShade}"/></a:schemeClr>`:t+="/>",t}return ""}function Go(e){if(!e||e.type==="none")return "<a:noFill/>";if(e.type==="solid"&&e.color)return `<a:solidFill>${xt(e.color)}</a:solidFill>`;if(e.type==="gradient"&&e.gradient){let t=e.gradient,n=t.stops.map(o=>`<a:gs pos="${o.position}">${xt(o.color)}</a:gs>`).join(""),r=t.type==="linear"?`<a:lin ang="${(t.angle||0)*6e4}" scaled="1"/>`:"";return `<a:gradFill><a:gsLst>${n}</a:gsLst>${r}</a:gradFill>`}return ""}function on(e){if(!e)return "";let t=[];e.width!=null&&t.push(`w="${e.width}"`),e.cap&&t.push(`cap="${e.cap}"`);let n=[];return e.color&&n.push(`<a:solidFill>${xt(e.color)}</a:solidFill>`),e.style&&e.style!=="solid"&&n.push(`<a:prstDash val="${e.style}"/>`),e.headEnd&&n.push(`<a:headEnd type="${e.headEnd.type}"${e.headEnd.width?` w="${e.headEnd.width}"`:""}${e.headEnd.length?` len="${e.headEnd.length}"`:""}/>`),e.tailEnd&&n.push(`<a:tailEnd type="${e.tailEnd.type}"${e.tailEnd.width?` w="${e.tailEnd.width}"`:""}${e.tailEnd.length?` len="${e.tailEnd.length}"`:""}/>`),n.length===0&&t.length===0?"":`<a:ln${t.length?" "+t.join(" "):""}>${n.join("")}</a:ln>`}function an(e){let t=[],n=e.horizontal;t.push(`<wp:positionH relativeFrom="${n.relativeTo}">`),n.alignment?t.push(`<wp:align>${n.alignment}</wp:align>`):t.push(`<wp:posOffset>${F(n.posOffset)}</wp:posOffset>`),t.push("</wp:positionH>");let r=e.vertical;return t.push(`<wp:positionV relativeFrom="${r.relativeTo}">`),r.alignment?t.push(`<wp:align>${r.alignment}</wp:align>`):t.push(`<wp:posOffset>${F(r.posOffset)}</wp:posOffset>`),t.push("</wp:positionV>"),t.join("")}function sn(e){let t=e.wrapText?` wrapText="${e.wrapText}"`:' wrapText="bothSides"';switch(e.type){case "square":return `<wp:wrapSquare${t}/>`;case "tight":return `<wp:wrapTight${t}><wp:wrapPolygon edited="0"><wp:start x="0" y="0"/><wp:lineTo x="0" y="21600"/><wp:lineTo x="21600" y="21600"/><wp:lineTo x="21600" y="0"/><wp:lineTo x="0" y="0"/></wp:wrapPolygon></wp:wrapTight>`;case "through":return `<wp:wrapThrough${t}><wp:wrapPolygon edited="0"><wp:start x="0" y="0"/><wp:lineTo x="0" y="21600"/><wp:lineTo x="21600" y="21600"/><wp:lineTo x="21600" y="0"/><wp:lineTo x="0" y="0"/></wp:wrapPolygon></wp:wrapThrough>`;case "topAndBottom":return "<wp:wrapTopAndBottom/>";case "behind":case "inFront":return "<wp:wrapNone/>";default:return "<wp:wrapNone/>"}}function Zo(e,t){let n=e.size.width,r=e.size.height,o=e.rId||"rId1",i=t,a=e.filename||`image${i}`,s="";e.transform?.rotation&&(s+=` rot="${Math.round(e.transform.rotation*6e4)}"`),e.transform?.flipH&&(s+=' flipH="1"'),e.transform?.flipV&&(s+=' flipV="1"');let c=e.opacity!==void 0&&e.opacity<1?`<a:alphaModFix amt="${Math.round(Math.max(0,Math.min(1,e.opacity))*1e5)}"/>`:"",f=c?`<a:blip r:embed="${o}">${c}</a:blip>`:`<a:blip r:embed="${o}"/>`,p=[];e.crop?.left&&p.push(`l="${Math.round(e.crop.left*1e5)}"`),e.crop?.top&&p.push(`t="${Math.round(e.crop.top*1e5)}"`),e.crop?.right&&p.push(`r="${Math.round(e.crop.right*1e5)}"`),e.crop?.bottom&&p.push(`b="${Math.round(e.crop.bottom*1e5)}"`);let m=p.length>0?`<a:srcRect ${p.join(" ")}/>`:"";return ['<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">','<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">','<pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">',"<pic:nvPicPr>",`<pic:cNvPr id="${i}" name="${E(a)}"${e.alt?` descr="${E(e.alt)}"`:""}/>`,"<pic:cNvPicPr/>","</pic:nvPicPr>","<pic:blipFill>",f,m,"<a:stretch><a:fillRect/></a:stretch>","</pic:blipFill>","<pic:spPr>",`<a:xfrm${s}>`,'<a:off x="0" y="0"/>',`<a:ext cx="${F(n)}" cy="${F(r)}"/>`,"</a:xfrm>",'<a:prstGeom prst="rect"><a:avLst/></a:prstGeom>',e.outline?on(e.outline):"","</pic:spPr>","</pic:pic>","</a:graphicData>","</a:graphic>"].join("")}function ln(e){let t=e.image,n=t.wrap.type!=="inline",r=t.size.width,o=t.size.height,i=t.wrap.distT??0,a=t.wrap.distB??0,s=t.wrap.distL??0,c=t.wrap.distR??0,f=t.padding?.left??0,p=t.padding?.top??0,m=t.padding?.right??0,g=t.padding?.bottom??0,b=`<wp:effectExtent l="${F(f)}" t="${F(p)}" r="${F(m)}" b="${F(g)}"/>`,d=rn(t.id),y=t.title||t.filename||`Picture ${d}`,T=Zo(t,d);if(!n)return ["<w:drawing>",`<wp:inline distT="${F(i)}" distB="${F(a)}" distL="${F(s)}" distR="${F(c)}">`,`<wp:extent cx="${F(r)}" cy="${F(o)}"/>`,b,`<wp:docPr id="${d}" name="${E(y)}"${t.alt?` descr="${E(t.alt)}"`:""}${t.decorative?' hidden="1"':""}/>`,'<wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/></wp:cNvGraphicFramePr>',T,"</wp:inline>","</w:drawing>"].join("");let I=t.wrap.type==="behind"?"1":"0",v=t.position?an(t.position):'<wp:positionH relativeFrom="column"><wp:posOffset>0</wp:posOffset></wp:positionH><wp:positionV relativeFrom="paragraph"><wp:posOffset>0</wp:posOffset></wp:positionV>',S=sn(t.wrap);return ["<w:drawing>",`<wp:anchor distT="${F(i)}" distB="${F(a)}" distL="${F(s)}" distR="${F(c)}" simplePos="0" relativeHeight="251658240" behindDoc="${I}" locked="0" layoutInCell="${t.layoutInCell===false?"0":"1"}" allowOverlap="${t.allowOverlap===false?"0":"1"}">`,'<wp:simplePos x="0" y="0"/>',v,`<wp:extent cx="${F(r)}" cy="${F(o)}"/>`,b,S,`<wp:docPr id="${d}" name="${E(y)}"${t.alt?` descr="${E(t.alt)}"`:""}/>`,'<wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/></wp:cNvGraphicFramePr>',T,"</wp:anchor>","</w:drawing>"].join("")}function qo(e){return e.map(t=>le(t)).join("")}function cn(e){let t=e.shape,n=t.size.width,r=t.size.height,o=t.shapeType==="textBox",i=t.wrap&&t.wrap.type!=="inline",a=t.wrap?.distT??0,s=t.wrap?.distB??0,c=t.wrap?.distL??0,f=t.wrap?.distR??0,p=rn(t.id),m=t.name||(o?`TextBox ${p}`:`Shape ${p}`),g="";t.transform?.rotation&&(g+=` rot="${Math.round(t.transform.rotation*6e4)}"`),t.transform?.flipH&&(g+=' flipH="1"'),t.transform?.flipV&&(g+=' flipV="1"');let b=["<wps:spPr>",`<a:xfrm${g}>`,'<a:off x="0" y="0"/>',`<a:ext cx="${F(n)}" cy="${F(r)}"/>`,"</a:xfrm>",`<a:prstGeom prst="${t.shapeType==="textBox"?"rect":t.shapeType}"><a:avLst/></a:prstGeom>`,Go(t.fill),on(t.outline),"</wps:spPr>"].join(""),d="";if(t.textBody){let w=t.textBody,x=['rot="0"','vert="horz"'];w.anchor&&x.push(`anchor="${w.anchor==="middle"?"ctr":w.anchor}"`),w.anchorCenter&&x.push('anchorCtr="1"'),w.margins&&(w.margins.left!=null&&x.push(`lIns="${F(w.margins.left)}"`),w.margins.top!=null&&x.push(`tIns="${F(w.margins.top)}"`),w.margins.right!=null&&x.push(`rIns="${F(w.margins.right)}"`),w.margins.bottom!=null&&x.push(`bIns="${F(w.margins.bottom)}"`)),o?d=["<wps:txbx><w:txbxContent>",qo(w.content),"</w:txbxContent></wps:txbx>",`<wps:bodyPr ${x.join(" ")}/>`].join(""):d=[`<wps:bodyPr ${x.join(" ")}/>`].join("");}let T=['<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">','<a:graphicData uri="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">',["<wps:wsp>",`<wps:cNvSpPr${o?' txBox="1"':""}/>`,b,d,"</wps:wsp>"].join(""),"</a:graphicData>","</a:graphic>"].join("");if(!i)return ["<w:drawing>",`<wp:inline distT="${F(a)}" distB="${F(s)}" distL="${F(c)}" distR="${F(f)}">`,`<wp:extent cx="${F(n)}" cy="${F(r)}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',`<wp:docPr id="${p}" name="${E(m)}"/>`,"<wp:cNvGraphicFramePr/>",T,"</wp:inline>","</w:drawing>"].join("");let I=t.wrap?.type==="behind"?"1":"0",v=t.position?an(t.position):'<wp:positionH relativeFrom="column"><wp:posOffset>0</wp:posOffset></wp:positionH><wp:positionV relativeFrom="paragraph"><wp:posOffset>0</wp:posOffset></wp:positionV>',S=sn(t.wrap);return ["<w:drawing>",`<wp:anchor distT="${F(a)}" distB="${F(s)}" distL="${F(c)}" distR="${F(f)}" simplePos="0" relativeHeight="251658240" behindDoc="${I}" locked="0" layoutInCell="1" allowOverlap="1">`,'<wp:simplePos x="0" y="0"/>',v,`<wp:extent cx="${F(n)}" cy="${F(r)}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',S,`<wp:docPr id="${p}" name="${E(m)}"/>`,"<wp:cNvGraphicFramePr/>",T,"</wp:anchor>","</w:drawing>"].join("")}var Yo=new Set(["black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","red","white","yellow"]);function Jo(e){if(!e)return "";let t=[];return e.auto?t.push('w:val="auto"'):e.rgb&&t.push(`w:val="${e.rgb}"`),e.themeColor&&t.push(`w:themeColor="${e.themeColor}"`),e.themeTint&&t.push(`w:themeTint="${e.themeTint}"`),e.themeShade&&t.push(`w:themeShade="${e.themeShade}"`),t.length===0?"":`<w:color ${t.join(" ")}/>`}function Ko(e){if(!e)return "";let t=[];return e.pattern?t.push(`w:val="${e.pattern}"`):t.push('w:val="clear"'),e.color?.rgb?t.push(`w:color="${e.color.rgb}"`):e.color?.auto&&t.push('w:color="auto"'),e.fill?.rgb?t.push(`w:fill="${e.fill.rgb}"`):e.fill?.auto&&t.push('w:fill="auto"'),e.fill?.themeColor&&t.push(`w:themeFill="${e.fill.themeColor}"`),e.fill?.themeTint&&t.push(`w:themeFillTint="${e.fill.themeTint}"`),e.fill?.themeShade&&t.push(`w:themeFillShade="${e.fill.themeShade}"`),t.length===0?"":`<w:shd ${t.join(" ")}/>`}function pe(e){if(!e)return "";let t=[];if(e.styleId&&t.push(`<w:rStyle w:val="${E(e.styleId)}"/>`),e.fontFamily){let o=[];e.fontFamily.ascii&&o.push(`w:ascii="${E(e.fontFamily.ascii)}"`),e.fontFamily.hAnsi&&o.push(`w:hAnsi="${E(e.fontFamily.hAnsi)}"`),e.fontFamily.eastAsia&&o.push(`w:eastAsia="${E(e.fontFamily.eastAsia)}"`),e.fontFamily.cs&&o.push(`w:cs="${E(e.fontFamily.cs)}"`),e.fontFamily.asciiTheme&&o.push(`w:asciiTheme="${e.fontFamily.asciiTheme}"`),e.fontFamily.hAnsiTheme&&o.push(`w:hAnsiTheme="${e.fontFamily.hAnsiTheme}"`),e.fontFamily.eastAsiaTheme&&o.push(`w:eastAsiaTheme="${e.fontFamily.eastAsiaTheme}"`),e.fontFamily.csTheme&&o.push(`w:csTheme="${e.fontFamily.csTheme}"`),o.length>0&&t.push(`<w:rFonts ${o.join(" ")}/>`);}e.bold===true?t.push("<w:b/>"):e.bold===false&&t.push('<w:b w:val="0"/>'),e.boldCs===true?t.push("<w:bCs/>"):e.boldCs===false&&t.push('<w:bCs w:val="0"/>'),e.italic===true?t.push("<w:i/>"):e.italic===false&&t.push('<w:i w:val="0"/>'),e.italicCs===true?t.push("<w:iCs/>"):e.italicCs===false&&t.push('<w:iCs w:val="0"/>'),e.allCaps&&t.push("<w:caps/>"),e.smallCaps&&t.push("<w:smallCaps/>"),e.strike&&t.push("<w:strike/>"),e.doubleStrike&&t.push("<w:dstrike/>"),e.outline&&t.push("<w:outline/>"),e.shadow&&t.push("<w:shadow/>"),e.emboss&&t.push("<w:emboss/>"),e.imprint&&t.push("<w:imprint/>"),e.hidden&&t.push("<w:vanish/>");let n=Jo(e.color);if(n&&t.push(n),e.spacing!==void 0&&t.push(`<w:spacing w:val="${F(e.spacing)}"/>`),e.scale!==void 0&&t.push(`<w:w w:val="${F(e.scale)}"/>`),e.kerning!==void 0&&t.push(`<w:kern w:val="${F(e.kerning)}"/>`),e.position!==void 0&&t.push(`<w:position w:val="${F(e.position)}"/>`),e.fontSize!==void 0&&t.push(`<w:sz w:val="${F(e.fontSize)}"/>`),e.fontSizeCs!==void 0&&t.push(`<w:szCs w:val="${F(e.fontSizeCs)}"/>`),e.highlight&&e.highlight!=="none"){if(Yo.has(e.highlight))t.push(`<w:highlight w:val="${e.highlight}"/>`);else if(!e.shading){let o=e.highlight.replace(/^#/,"");/^[0-9a-fA-F]{6}$/.test(o)&&t.push(`<w:shd w:val="clear" w:color="auto" w:fill="${o}"/>`);}}if(e.underline){let o=[`w:val="${e.underline.style}"`];e.underline.color&&(e.underline.color.rgb&&o.push(`w:color="${e.underline.color.rgb}"`),e.underline.color.themeColor&&o.push(`w:themeColor="${e.underline.color.themeColor}"`),e.underline.color.themeTint&&o.push(`w:themeTint="${e.underline.color.themeTint}"`),e.underline.color.themeShade&&o.push(`w:themeShade="${e.underline.color.themeShade}"`)),t.push(`<w:u ${o.join(" ")}/>`);}e.effect&&e.effect!=="none"&&t.push(`<w:effect w:val="${e.effect}"/>`),e.emphasisMark&&e.emphasisMark!=="none"&&t.push(`<w:em w:val="${e.emphasisMark}"/>`);let r=Ko(e.shading);return r&&t.push(r),e.vertAlign&&e.vertAlign!=="baseline"&&t.push(`<w:vertAlign w:val="${e.vertAlign}"/>`),e.rtl&&t.push("<w:rtl/>"),e.cs&&t.push("<w:cs/>"),t.length===0?"":`<w:rPr>${t.join("")}</w:rPr>`}function Qo(e){return !e.startsWith("<w:rPr>")||!e.endsWith("</w:rPr>")?"":e.slice(7,-8)}function ei(e){let t=Number.isInteger(e.info.id)&&e.info.id>=0?e.info.id:0,n=typeof e.info.author=="string"?e.info.author.trim():"",r=n.length>0?n:"Unknown",o=typeof e.info.date=="string"?e.info.date.trim():void 0,i=typeof e.info.rsid=="string"?e.info.rsid.trim():void 0,a=[`w:id="${t}"`,`w:author="${E(r)}"`];o&&a.push(`w:date="${E(o)}"`),i&&a.push(`w:rsid="${E(i)}"`);let s=pe(e.previousFormatting)||"<w:rPr/>";return `<w:rPrChange ${a.join(" ")}>${s}</w:rPrChange>`}function ti(e,t){let n=pe(e),r=n?Qo(n):"",o=(t??[]).map(ei).join(""),i=`${r}${o}`;return i?`<w:rPr>${i}</w:rPr>`:""}function ni(e){return `<w:t${e.preserveSpace||e.text.startsWith(" ")||e.text.endsWith(" ")||e.text.includes(" ")?' xml:space="preserve"':""}>${E(e.text)}</w:t>`}function ri(e){return "<w:tab/>"}function oi(e){let t=[];return e.breakType==="page"?t.push('w:type="page"'):e.breakType==="column"?t.push('w:type="column"'):e.breakType==="textWrapping"&&(t.push('w:type="textWrapping"'),e.clear&&e.clear!=="none"&&t.push(`w:clear="${e.clear}"`)),t.length===0?"<w:br/>":`<w:br ${t.join(" ")}/>`}function ii(e){return `<w:sym w:font="${E(e.font)}" w:char="${E(e.char)}"/>`}function ai(e){return e.type==="footnoteRef"?`<w:footnoteReference w:id="${e.id}"/>`:`<w:endnoteReference w:id="${e.id}"/>`}function si(e){let t=[`w:fldCharType="${e.charType}"`];return e.fldLock&&t.push('w:fldLock="true"'),e.dirty&&t.push('w:dirty="true"'),`<w:fldChar ${t.join(" ")}/>`}function li(e){return `<w:instrText${e.text.startsWith(" ")||e.text.endsWith(" ")||e.text.includes(" ")?' xml:space="preserve"':""}>${E(e.text)}</w:instrText>`}function ci(e){return "<w:softHyphen/>"}function ui(e){return "<w:noBreakHyphen/>"}function fi(e){switch(e.type){case "text":return ni(e);case "tab":return ri();case "break":return oi(e);case "symbol":return ii(e);case "footnoteRef":case "endnoteRef":return ai(e);case "fieldChar":return si(e);case "instrText":return li(e);case "softHyphen":return ci();case "noBreakHyphen":return ui();case "drawing":return ln(e);case "shape":return cn(e);default:return ""}}function re(e){let t=[],n=ti(e.formatting,e.propertyChanges);n&&t.push(n);for(let r of e.content){let o=fi(r);o&&t.push(o);}return `<w:r>${t.join("")}</w:r>`}function pi(e,t){if(!e||e.style==="none"||e.style==="nil")return "";let n=[`w:val="${e.style}"`];return e.size!==void 0&&n.push(`w:sz="${F(e.size)}"`),e.space!==void 0&&n.push(`w:space="${F(e.space)}"`),e.color&&(e.color.auto?n.push('w:color="auto"'):e.color.rgb&&n.push(`w:color="${e.color.rgb}"`),e.color.themeColor&&n.push(`w:themeColor="${e.color.themeColor}"`),e.color.themeTint&&n.push(`w:themeTint="${e.color.themeTint}"`),e.color.themeShade&&n.push(`w:themeShade="${e.color.themeShade}"`)),e.shadow&&n.push('w:shadow="true"'),e.frame&&n.push('w:frame="true"'),`<w:${t} ${n.join(" ")}/>`}var di=["top","left","bottom","right","between","bar"];function un(e){if(!e)return "";let t=[];for(let n of di){let r=pi(e[n],n);r&&t.push(r);}return t.length===0?"":`<w:pBdr>${t.join("")}</w:pBdr>`}function fn(e){if(!e)return "";let t=[];return e.pattern?t.push(`w:val="${e.pattern}"`):t.push('w:val="clear"'),e.color?.rgb?t.push(`w:color="${e.color.rgb}"`):e.color?.auto&&t.push('w:color="auto"'),e.fill?.rgb?t.push(`w:fill="${e.fill.rgb}"`):e.fill?.auto&&t.push('w:fill="auto"'),e.fill?.themeColor&&t.push(`w:themeFill="${e.fill.themeColor}"`),e.fill?.themeTint&&t.push(`w:themeFillTint="${e.fill.themeTint}"`),e.fill?.themeShade&&t.push(`w:themeFillShade="${e.fill.themeShade}"`),t.length===0?"":`<w:shd ${t.join(" ")}/>`}function pn(e){return !e||e.length===0?"":`<w:tabs>${e.map(n=>{let r=[`w:val="${n.alignment}"`,`w:pos="${F(n.position)}"`];return n.leader&&n.leader!=="none"&&r.push(`w:leader="${n.leader}"`),`<w:tab ${r.join(" ")}/>`}).join("")}</w:tabs>`}function dn(e){let t=[];return e.spaceBefore!==void 0&&t.push(`w:before="${F(e.spaceBefore)}"`),e.spaceAfter!==void 0&&t.push(`w:after="${F(e.spaceAfter)}"`),e.lineSpacing!==void 0&&t.push(`w:line="${F(e.lineSpacing)}"`),e.lineSpacingRule&&t.push(`w:lineRule="${e.lineSpacingRule}"`),e.beforeAutospacing&&t.push('w:beforeAutospacing="1"'),e.afterAutospacing&&t.push('w:afterAutospacing="1"'),t.length===0?"":`<w:spacing ${t.join(" ")}/>`}function mn(e){let t=[];return e.indentLeft!==void 0&&t.push(`w:left="${F(e.indentLeft)}"`),e.indentRight!==void 0&&t.push(`w:right="${F(e.indentRight)}"`),e.indentFirstLine!==void 0&&(e.hangingIndent?t.push(`w:hanging="${F(Math.abs(e.indentFirstLine))}"`):e.indentFirstLine!==0&&t.push(`w:firstLine="${F(e.indentFirstLine)}"`)),t.length===0?"":`<w:ind ${t.join(" ")}/>`}function gn(e){if(!e)return "";let t=[];return e.ilvl!==void 0&&t.push(`<w:ilvl w:val="${F(e.ilvl)}"/>`),e.numId!==void 0&&t.push(`<w:numId w:val="${F(e.numId)}"/>`),t.length===0?"":`<w:numPr>${t.join("")}</w:numPr>`}function hn(e){if(!e)return "";let t=[];return e.width!==void 0&&t.push(`w:w="${F(e.width)}"`),e.height!==void 0&&t.push(`w:h="${F(e.height)}"`),e.hAnchor&&t.push(`w:hAnchor="${e.hAnchor}"`),e.vAnchor&&t.push(`w:vAnchor="${e.vAnchor}"`),e.x!==void 0&&t.push(`w:x="${F(e.x)}"`),e.y!==void 0&&t.push(`w:y="${F(e.y)}"`),e.xAlign&&t.push(`w:xAlign="${e.xAlign}"`),e.yAlign&&t.push(`w:yAlign="${e.yAlign}"`),e.wrap&&t.push(`w:wrap="${e.wrap}"`),t.length===0?"":`<w:framePr ${t.join(" ")}/>`}function xn(e){let t=[`w:id="${e.id}"`,`w:name="${E(e.name)}"`];return e.colFirst!==void 0&&t.push(`w:colFirst="${e.colFirst}"`),e.colLast!==void 0&&t.push(`w:colLast="${e.colLast}"`),`<w:bookmarkStart ${t.join(" ")}/>`}function yn(e){return `<w:bookmarkEnd w:id="${e.id}"/>`}function bt(e){let t=[];e.rId&&t.push(`r:id="${e.rId}"`),e.anchor&&t.push(`w:anchor="${E(e.anchor)}"`),e.tooltip&&t.push(`w:tooltip="${E(e.tooltip)}"`),e.target&&t.push(`w:tgtFrame="${E(e.target)}"`),e.history===false&&t.push('w:history="0"'),e.docLocation&&t.push(`w:docLocation="${E(e.docLocation)}"`);let n=e.children.map(o=>o.type==="run"?re(o):o.type==="bookmarkStart"?xn(o):o.type==="bookmarkEnd"?yn(o):"").join("");return `<w:hyperlink${t.length>0?" "+t.join(" "):""}>${n}</w:hyperlink>`}function bn(e){let t=[],n=e.content.find(s=>s.type==="run"),r=n?.formatting?pe(n.formatting):"",o=['w:fldCharType="begin"'];e.fldLock&&o.push('w:fldLock="true"'),t.push(`<w:r>${r}<w:fldChar ${o.join(" ")}/></w:r>`);let a=e.instruction.startsWith(" ")||e.instruction.endsWith(" ")||e.instruction.includes(" ")?' xml:space="preserve"':"";t.push(`<w:r>${r}<w:instrText${a}>${E(e.instruction)}</w:instrText></w:r>`),t.push(`<w:r>${r}<w:fldChar w:fldCharType="separate"/></w:r>`);for(let s of e.content)s.type==="run"&&t.push(re(s));return t.push(`<w:r>${r}<w:fldChar w:fldCharType="end"/></w:r>`),t.join("")}function Tn(e){let t=[],n=e.fieldResult?.[0]?.formatting,r=n?pe(n):"",o=['w:fldCharType="begin"'];if(e.fldLock&&o.push('w:fldLock="true"'),t.push(`<w:r>${r}<w:fldChar ${o.join(" ")}/></w:r>`),e.fieldCode.length>0)t.push(...e.fieldCode.map(i=>re(i)));else {let a=e.instruction.startsWith(" ")||e.instruction.endsWith(" ")||e.instruction.includes(" ")?' xml:space="preserve"':"";t.push(`<w:r>${r}<w:instrText${a}>${E(e.instruction)}</w:instrText></w:r>`);}return t.push(`<w:r>${r}<w:fldChar w:fldCharType="separate"/></w:r>`),t.push(...e.fieldResult.map(i=>re(i))),t.push(`<w:r>${r}<w:fldChar w:fldCharType="end"/></w:r>`),t.join("")}function Cn(e){let t=e.properties,n=[];switch(t.alias&&n.push(`<w:alias w:val="${E(t.alias)}"/>`),t.tag&&n.push(`<w:tag w:val="${E(t.tag)}"/>`),t.lock&&t.lock!=="unlocked"&&n.push(`<w:lock w:val="${t.lock}"/>`),t.showingPlaceholder&&n.push("<w:showingPlcHdr/>"),t.sdtType){case "plainText":n.push("<w:text/>");break;case "date":t.dateFormat?n.push(`<w:date w:fullDate="${E(t.dateFormat)}"/>`):n.push("<w:date/>");break;case "dropdown":{let o=(t.listItems??[]).map(i=>`<w:listItem w:displayText="${E(i.displayText)}" w:value="${E(i.value)}"/>`).join("");n.push(`<w:dropDownList>${o}</w:dropDownList>`);break}case "comboBox":{let o=(t.listItems??[]).map(i=>`<w:listItem w:displayText="${E(i.displayText)}" w:value="${E(i.value)}"/>`).join("");n.push(`<w:comboBox>${o}</w:comboBox>`);break}case "checkbox":n.push(`<w14:checkbox><w14:checked w14:val="${t.checked?"1":"0"}"/></w14:checkbox>`);break;case "picture":n.push("<w:picture/>");break}let r=e.content.map(o=>{switch(o.type){case "run":return re(o);case "hyperlink":return bt(o);case "simpleField":return bn(o);case "complexField":return Tn(o);case "inlineSdt":return Cn(o);case "mathEquation":return o.ommlXml||"";default:return o}}).join("");return `<w:sdt><w:sdtPr>${n.join("")}</w:sdtPr><w:sdtContent>${r}</w:sdtContent></w:sdt>`}function wn(e,t){let n=[`w:id="${t.id}"`,`w:name="${E(t.name)}"`];return `<w:${e} ${n.join(" ")}/>`}function $e(e,t){let n=t.info,r=Number.isInteger(n.id)&&n.id>=0?n.id:0,o=typeof n.author=="string"?n.author.trim():"",i=o.length>0?o:"Unknown",a=typeof n.date=="string"?n.date.trim():void 0,s=[`w:id="${r}"`,`w:author="${E(i)}"`];a&&s.push(`w:date="${E(a)}"`);let c=t.content.map(f=>f.type==="run"?e==="del"||e==="moveFrom"?re(f).replace(/<w:t\b/g,"<w:delText").replace(/<\/w:t>/g,"</w:delText>").replace(/<w:instrText\b/g,"<w:delInstrText").replace(/<\/w:instrText>/g,"</w:delInstrText>"):re(f):f.type==="hyperlink"?bt(f):"").join("");return `<w:${e} ${s.join(" ")}>${c}</w:${e}>`}function Fn(e){switch(e.type){case "run":return re(e);case "hyperlink":return bt(e);case "bookmarkStart":return xn(e);case "bookmarkEnd":return yn(e);case "simpleField":return bn(e);case "complexField":return Tn(e);case "inlineSdt":return Cn(e);case "commentRangeStart":return `<w:commentRangeStart w:id="${e.id}"/>`;case "commentRangeEnd":return `<w:commentRangeEnd w:id="${e.id}"/><w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:commentReference w:id="${e.id}"/></w:r>`;case "insertion":return $e("ins",e);case "deletion":return $e("del",e);case "moveFrom":return $e("moveFrom",e);case "moveTo":return $e("moveTo",e);case "moveFromRangeStart":return wn("moveFromRangeStart",e);case "moveFromRangeEnd":return `<w:moveFromRangeEnd w:id="${e.id}"/>`;case "moveToRangeStart":return wn("moveToRangeStart",e);case "moveToRangeEnd":return `<w:moveToRangeEnd w:id="${e.id}"/>`;case "mathEquation":return e.ommlXml||"";default:return ""}}function Pn(e,t){let n=[];if(e){e.styleId&&n.push(`<w:pStyle w:val="${E(e.styleId)}"/>`),e.keepNext&&n.push("<w:keepNext/>"),e.keepLines&&n.push("<w:keepLines/>"),e.contextualSpacing&&n.push("<w:contextualSpacing/>"),e.pageBreakBefore&&n.push("<w:pageBreakBefore/>");let r=hn(e.frame);r&&n.push(r),e.widowControl===false?n.push('<w:widowControl w:val="0"/>'):e.widowControl===true&&n.push("<w:widowControl/>");let o=gn(e.numPr);o&&n.push(o);let i=un(e.borders);i&&n.push(i);let a=fn(e.shading);a&&n.push(a);let s=pn(e.tabs);s&&n.push(s),e.suppressLineNumbers&&n.push("<w:suppressLineNumbers/>"),e.suppressAutoHyphens&&n.push("<w:suppressAutoHyphens/>");let c=dn(e);c&&n.push(c);let f=mn(e);if(f&&n.push(f),e.bidi&&n.push("<w:bidi/>"),e.alignment&&n.push(`<w:jc w:val="${e.alignment}"/>`),e.outlineLevel!==void 0&&n.push(`<w:outlineLvl w:val="${e.outlineLevel}"/>`),e.runProperties){let p=pe(e.runProperties);p&&n.push(p);}}return t&&t.length>0&&n.push(...t.map(r=>gi(r))),n.length===0?"":`<w:pPr>${n.join("")}</w:pPr>`}function mi(e){return !e.startsWith("<w:pPr>")||!e.endsWith("</w:pPr>")?"":e.slice(7,-8)}function gi(e){let t=Number.isInteger(e.info.id)&&e.info.id>=0?e.info.id:0,n=typeof e.info.author=="string"?e.info.author.trim():"",r=n.length>0?n:"Unknown",o=typeof e.info.date=="string"?e.info.date.trim():void 0,i=typeof e.info.rsid=="string"?e.info.rsid.trim():void 0,a=[`w:id="${t}"`,`w:author="${E(r)}"`];o&&a.push(`w:date="${E(o)}"`),i&&a.push(`w:rsid="${E(i)}"`);let s=Pn(e.previousFormatting)||"<w:pPr/>",c=mi(s),f=c.length>0?`<w:pPr>${c}</w:pPr>`:"<w:pPr/>";return `<w:pPrChange ${a.join(" ")}>${f}</w:pPrChange>`}function le(e){let t=[],n=[];e.paraId&&n.push(`w14:paraId="${e.paraId}"`),e.textId&&n.push(`w14:textId="${e.textId}"`);let r=n.length>0?" "+n.join(" "):"",o=Pn(e.formatting,e.propertyChanges);o&&t.push(o);let i=!!e.renderedPageBreakBefore;for(let a of e.content){let s=Fn(a);if(s){if(i){let c=hi(s);c&&(s=c,i=false);}t.push(s);}}return `<w:p${r}>${t.join("")}</w:p>`}function hi(e){let t=/<w:r(?=[\s>/])[^>]*>/;return t.test(e)?e.replace(t,n=>`${n}<w:lastRenderedPageBreak/>`):null}function wi(e){let t=Number.isInteger(e.id)&&e.id>=0?e.id:0,n=typeof e.author=="string"?e.author.trim():"",r=n.length>0?n:"Unknown",o=typeof e.date=="string"?e.date.trim():void 0;return {id:t,author:r,date:o}}function ue(e,t){let n=wi(e),r=[`w:id="${n.id}"`,`w:author="${E(n.author)}"`];return n.date&&r.push(`w:date="${E(n.date)}"`),t&&t.trim().length>0&&r.push(`w:rsid="${E(t.trim())}"`),r.join(" ")}function ce(e,t){if(!e)return "";let n=[`w:w="${F(e.value)}"`,`w:type="${e.type}"`];return `<w:${t} ${n.join(" ")}/>`}function we(e,t){if(!e||e.style==="none"||e.style==="nil")return "";let n=[`w:val="${e.style}"`];return e.size!==void 0&&n.push(`w:sz="${F(e.size)}"`),e.space!==void 0&&n.push(`w:space="${F(e.space)}"`),e.color&&(e.color.auto?n.push('w:color="auto"'):e.color.rgb&&n.push(`w:color="${e.color.rgb}"`),e.color.themeColor&&n.push(`w:themeColor="${e.color.themeColor}"`),e.color.themeTint&&n.push(`w:themeTint="${e.color.themeTint}"`),e.color.themeShade&&n.push(`w:themeShade="${e.color.themeShade}"`)),e.shadow&&n.push('w:shadow="true"'),e.frame&&n.push('w:frame="true"'),`<w:${t} ${n.join(" ")}/>`}function Sn(e,t){if(!e)return "";let n=[];if(e.top){let r=we(e.top,"top");r&&n.push(r);}if(e.left){let r=we(e.left,"left");r&&n.push(r);}if(e.bottom){let r=we(e.bottom,"bottom");r&&n.push(r);}if(e.right){let r=we(e.right,"right");r&&n.push(r);}if(e.insideH){let r=we(e.insideH,"insideH");r&&n.push(r);}if(e.insideV){let r=we(e.insideV,"insideV");r&&n.push(r);}return n.length===0?"":`<w:${t}>${n.join("")}</w:${t}>`}function kn(e,t){if(!e)return "";let n=[];return e.top&&n.push(ce(e.top,"top")),e.left&&n.push(ce(e.left,"left")),e.bottom&&n.push(ce(e.bottom,"bottom")),e.right&&n.push(ce(e.right,"right")),n.length===0?"":`<w:${t}>${n.join("")}</w:${t}>`}function vn(e){if(!e)return "";let t=[];return e.pattern?t.push(`w:val="${e.pattern}"`):t.push('w:val="clear"'),e.color?.rgb?t.push(`w:color="${e.color.rgb}"`):e.color?.auto&&t.push('w:color="auto"'),e.fill?.rgb?t.push(`w:fill="${e.fill.rgb}"`):e.fill?.auto&&t.push('w:fill="auto"'),e.fill?.themeColor&&t.push(`w:themeFill="${e.fill.themeColor}"`),e.fill?.themeTint&&t.push(`w:themeFillTint="${e.fill.themeTint}"`),e.fill?.themeShade&&t.push(`w:themeFillShade="${e.fill.themeShade}"`),t.length===0?"":`<w:shd ${t.join(" ")}/>`}function xi(e){if(!e)return "";let t=[];return e.firstRow&&t.push('w:firstRow="1"'),e.lastRow&&t.push('w:lastRow="1"'),e.firstColumn&&t.push('w:firstColumn="1"'),e.lastColumn&&t.push('w:lastColumn="1"'),e.noHBand&&t.push('w:noHBand="1"'),e.noVBand&&t.push('w:noVBand="1"'),t.length===0?"":`<w:tblLook ${t.join(" ")}/>`}function yi(e){if(!e)return "";let t=[];return e.horzAnchor&&t.push(`w:horzAnchor="${e.horzAnchor}"`),e.vertAnchor&&t.push(`w:vertAnchor="${e.vertAnchor}"`),e.tblpX!==void 0&&t.push(`w:tblpX="${F(e.tblpX)}"`),e.tblpXSpec&&t.push(`w:tblpXSpec="${e.tblpXSpec}"`),e.tblpY!==void 0&&t.push(`w:tblpY="${F(e.tblpY)}"`),e.tblpYSpec&&t.push(`w:tblpYSpec="${e.tblpYSpec}"`),e.topFromText!==void 0&&t.push(`w:topFromText="${F(e.topFromText)}"`),e.bottomFromText!==void 0&&t.push(`w:bottomFromText="${F(e.bottomFromText)}"`),e.leftFromText!==void 0&&t.push(`w:leftFromText="${F(e.leftFromText)}"`),e.rightFromText!==void 0&&t.push(`w:rightFromText="${F(e.rightFromText)}"`),t.length===0?"":`<w:tblpPr ${t.join(" ")}/>`}function Rn(e,t){let n=[];if(e){e.styleId&&n.push(`<w:tblStyle w:val="${E(e.styleId)}"/>`);let r=yi(e.floating);r&&n.push(r),e.bidi&&n.push("<w:bidiVisual/>");let o=ce(e.width,"tblW");o&&n.push(o),e.justification&&n.push(`<w:jc w:val="${e.justification}"/>`);let i=ce(e.cellSpacing,"tblCellSpacing");i&&n.push(i);let a=ce(e.indent,"tblInd");a&&n.push(a);let s=Sn(e.borders,"tblBorders");s&&n.push(s);let c=kn(e.cellMargins,"tblCellMar");c&&n.push(c),e.layout&&n.push(`<w:tblLayout w:type="${e.layout}"/>`);let f=vn(e.shading);f&&n.push(f);let p=xi(e.look);p&&n.push(p),e.overlap&&n.push(`<w:tblOverlap w:val="${e.overlap}"/>`);}return t&&t.length>0&&n.push(...t.map(r=>Ti(r))),n.length===0?"":`<w:tblPr>${n.join("")}</w:tblPr>`}function bi(e){return !e.startsWith("<w:tblPr>")||!e.endsWith("</w:tblPr>")?"":e.slice(9,-10)}function Ti(e){let t=ue(e.info,e.info.rsid),n=Rn(e.previousFormatting)||"<w:tblPr/>",r=bi(n),o=r.length>0?`<w:tblPr>${r}</w:tblPr>`:"<w:tblPr/>";return `<w:tblPrChange ${t}>${o}</w:tblPrChange>`}function In(e,t,n){let r=[];if(e){if(e.cantSplit&&r.push("<w:cantSplit/>"),e.header&&r.push("<w:tblHeader/>"),e.height){let o=[`w:val="${F(e.height.value)}"`];e.heightRule&&o.push(`w:hRule="${e.heightRule}"`),r.push(`<w:trHeight ${o.join(" ")}/>`);}e.justification&&r.push(`<w:jc w:val="${e.justification}"/>`),e.hidden&&r.push("<w:hidden/>");}return n&&(n.type==="tableRowInsertion"?r.push(`<w:ins ${ue(n.info)}/>`):n.type==="tableRowDeletion"&&r.push(`<w:del ${ue(n.info)}/>`)),t&&t.length>0&&r.push(...t.map(o=>Fi(o))),r.length===0?"":`<w:trPr>${r.join("")}</w:trPr>`}function Ci(e){return !e.startsWith("<w:trPr>")||!e.endsWith("</w:trPr>")?"":e.slice(8,-9)}function Fi(e){let t=ue(e.info,e.info.rsid),n=In(e.previousFormatting)||"<w:trPr/>",r=Ci(n),o=r.length>0?`<w:trPr>${r}</w:trPr>`:"<w:trPr/>";return `<w:trPrChange ${t}>${o}</w:trPrChange>`}function Pi(e){if(!e)return "";let n=[e.firstRow?"1":"0",e.lastRow?"1":"0",e.firstColumn?"1":"0",e.lastColumn?"1":"0",e.oddVBand?"1":"0",e.evenVBand?"1":"0",e.oddHBand?"1":"0",e.evenHBand?"1":"0",e.nwCell?"1":"0",e.neCell?"1":"0",e.swCell?"1":"0",e.seCell?"1":"0"].join("");return n==="000000000000"?"":`<w:cnfStyle w:val="${n}"/>`}function En(e,t,n){let r=[];if(e){let o=Pi(e.conditionalFormat);o&&r.push(o);let i=ce(e.width,"tcW");i&&r.push(i),e.gridSpan&&e.gridSpan>1&&r.push(`<w:gridSpan w:val="${F(e.gridSpan)}"/>`),e.vMerge&&(e.vMerge==="restart"?r.push('<w:vMerge w:val="restart"/>'):r.push("<w:vMerge/>"));let a=Sn(e.borders,"tcBorders");a&&r.push(a);let s=vn(e.shading);s&&r.push(s),e.noWrap&&r.push("<w:noWrap/>");let c=kn(e.margins,"tcMar");c&&r.push(c),e.textDirection&&r.push(`<w:textDirection w:val="${e.textDirection}"/>`),e.fitText&&r.push("<w:tcFitText/>"),e.verticalAlign&&r.push(`<w:vAlign w:val="${e.verticalAlign}"/>`),e.hideMark&&r.push("<w:hideMark/>");}return n&&(n.type==="tableCellInsertion"?r.push(`<w:cellIns ${ue(n.info)}/>`):n.type==="tableCellDeletion"?r.push(`<w:cellDel ${ue(n.info)}/>`):n.type==="tableCellMerge"&&r.push(`<w:cellMerge ${ue(n.info)}/>`)),t&&t.length>0&&r.push(...t.map(o=>ki(o))),r.length===0?"":`<w:tcPr>${r.join("")}</w:tcPr>`}function Si(e){return !e.startsWith("<w:tcPr>")||!e.endsWith("</w:tcPr>")?"":e.slice(8,-9)}function ki(e){let t=ue(e.info,e.info.rsid),n=En(e.previousFormatting)||"<w:tcPr/>",r=Si(n),o=r.length>0?`<w:tcPr>${r}</w:tcPr>`:"<w:tcPr/>";return `<w:tcPrChange ${t}>${o}</w:tcPrChange>`}function vi(e){return !e||e.length===0?"":`<w:tblGrid>${e.map(n=>`<w:gridCol w:w="${F(n)}"/>`).join("")}</w:tblGrid>`}function Ri(e){let t=[];for(let n of e)n.type==="paragraph"?t.push(le(n)):n.type==="table"&&t.push(Se(n));return t.length===0&&t.push("<w:p/>"),t.join("")}function Ii(e){let t=[],n=En(e.formatting,e.propertyChanges,e.structuralChange);return n&&t.push(n),t.push(Ri(e.content)),`<w:tc>${t.join("")}</w:tc>`}function Ei(e){let t=[],n=In(e.formatting,e.propertyChanges,e.structuralChange);n&&t.push(n);for(let r of e.cells)t.push(Ii(r));return `<w:tr>${t.join("")}</w:tr>`}function Se(e){let t=[],n=Rn(e.formatting,e.propertyChanges);n&&t.push(n);let r=vi(e.columnWidths);r&&t.push(r);for(let o of e.rows)t.push(Ei(o));return `<w:tbl>${t.join("")}</w:tbl>`}var U={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"};function Ai(){let e={wpc:U.wpc,mc:U.mc,o:U.o,r:U.r,m:U.m,v:U.v,wp14:U.wp14,wp:U.wp,w10:U.w10,w:U.w,w14:U.w14,w15:U.w15,wpg:U.wpg,wps:U.wps};return Object.entries(e).map(([t,n])=>`xmlns:${t}="${n}"`).join(" ")}function De(e,t){if(!e||e.style==="none"||e.style==="nil")return "";let n=[`w:val="${e.style}"`];return e.size!==void 0&&n.push(`w:sz="${F(e.size)}"`),e.space!==void 0&&n.push(`w:space="${F(e.space)}"`),e.color&&(e.color.auto?n.push('w:color="auto"'):e.color.rgb&&n.push(`w:color="${e.color.rgb}"`),e.color.themeColor&&n.push(`w:themeColor="${e.color.themeColor}"`),e.color.themeTint&&n.push(`w:themeTint="${e.color.themeTint}"`),e.color.themeShade&&n.push(`w:themeShade="${e.color.themeShade}"`)),e.shadow&&n.push('w:shadow="true"'),e.frame&&n.push('w:frame="true"'),`<w:${t} ${n.join(" ")}/>`}function Mi(e){return `<w:headerReference ${[`w:type="${e.type}"`,`r:id="${e.rId}"`].join(" ")}/>`}function Bi(e){return `<w:footerReference ${[`w:type="${e.type}"`,`r:id="${e.rId}"`].join(" ")}/>`}function $i(e){if(!e)return "";let t=[];return e.position&&t.push(`<w:pos w:val="${e.position}"/>`),e.numFmt&&t.push(`<w:numFmt w:val="${e.numFmt}"/>`),e.numStart!==void 0&&t.push(`<w:numStart w:val="${e.numStart}"/>`),e.numRestart&&t.push(`<w:numRestart w:val="${e.numRestart}"/>`),t.length===0?"":`<w:footnotePr>${t.join("")}</w:footnotePr>`}function Di(e){if(!e)return "";let t=[];return e.position&&t.push(`<w:pos w:val="${e.position}"/>`),e.numFmt&&t.push(`<w:numFmt w:val="${e.numFmt}"/>`),e.numStart!==void 0&&t.push(`<w:numStart w:val="${e.numStart}"/>`),e.numRestart&&t.push(`<w:numRestart w:val="${e.numRestart}"/>`),t.length===0?"":`<w:endnotePr>${t.join("")}</w:endnotePr>`}function Ni(e){let t=[];return e.pageWidth!==void 0&&t.push(`w:w="${F(e.pageWidth)}"`),e.pageHeight!==void 0&&t.push(`w:h="${F(e.pageHeight)}"`),e.orientation==="landscape"&&t.push('w:orient="landscape"'),t.length===0?"":`<w:pgSz ${t.join(" ")}/>`}function Li(e){let t=[];return e.marginTop!==void 0&&t.push(`w:top="${F(e.marginTop)}"`),e.marginRight!==void 0&&t.push(`w:right="${F(e.marginRight)}"`),e.marginBottom!==void 0&&t.push(`w:bottom="${F(e.marginBottom)}"`),e.marginLeft!==void 0&&t.push(`w:left="${F(e.marginLeft)}"`),e.headerDistance!==void 0&&t.push(`w:header="${F(e.headerDistance)}"`),e.footerDistance!==void 0&&t.push(`w:footer="${F(e.footerDistance)}"`),e.gutter!==void 0&&t.push(`w:gutter="${F(e.gutter)}"`),t.length===0?"":`<w:pgMar ${t.join(" ")}/>`}function Hi(e){if(!e.columnCount&&!e.columns?.length)return "";let t=[];e.columnCount!==void 0&&e.columnCount>1&&t.push(`w:num="${F(e.columnCount)}"`),e.columnSpace!==void 0&&t.push(`w:space="${F(e.columnSpace)}"`),e.equalWidth!==void 0&&t.push(`w:equalWidth="${e.equalWidth?"1":"0"}"`),e.separator&&t.push('w:sep="1"');let n="";return e.columns&&e.columns.length>0&&(n=e.columns.map(o=>{let i=[];return o.width!==void 0&&i.push(`w:w="${F(o.width)}"`),o.space!==void 0&&i.push(`w:space="${F(o.space)}"`),`<w:col ${i.join(" ")}/>`}).join("")),t.length===0&&!n?"":`<w:cols${t.length>0?" "+t.join(" "):""}>${n}</w:cols>`}function Xi(e){if(!e.lineNumbers)return "";let t=e.lineNumbers,n=[];return t.countBy!==void 0&&n.push(`w:countBy="${F(t.countBy)}"`),t.start!==void 0&&n.push(`w:start="${F(t.start)}"`),t.distance!==void 0&&n.push(`w:distance="${F(t.distance)}"`),t.restart&&n.push(`w:restart="${t.restart}"`),n.length===0?"":`<w:lnNumType ${n.join(" ")}/>`}function Oi(e){if(!e.pageBorders)return "";let t=e.pageBorders,n=[],r=[];if(t.display&&n.push(`w:display="${t.display}"`),t.offsetFrom&&n.push(`w:offsetFrom="${t.offsetFrom}"`),t.zOrder&&n.push(`w:zOrder="${t.zOrder}"`),t.top){let i=De(t.top,"top");i&&r.push(i);}if(t.left){let i=De(t.left,"left");i&&r.push(i);}if(t.bottom){let i=De(t.bottom,"bottom");i&&r.push(i);}if(t.right){let i=De(t.right,"right");i&&r.push(i);}return r.length===0?"":`<w:pgBorders${n.length>0?" "+n.join(" "):""}>${r.join("")}</w:pgBorders>`}function zi(e){if(!e.docGrid)return "";let t=e.docGrid,n=[];return t.type&&n.push(`w:type="${t.type}"`),t.linePitch!==void 0&&n.push(`w:linePitch="${t.linePitch}"`),t.charSpace!==void 0&&n.push(`w:charSpace="${t.charSpace}"`),n.length===0?"":`<w:docGrid ${n.join(" ")}/>`}function An(e){if(!e)return "";let t=[];if(e.headerReferences)for(let p of e.headerReferences)t.push(Mi(p));if(e.footerReferences)for(let p of e.footerReferences)t.push(Bi(p));let n=$i(e.footnotePr);n&&t.push(n);let r=Di(e.endnotePr);r&&t.push(r),e.sectionStart&&t.push(`<w:type w:val="${e.sectionStart}"/>`);let o=Ni(e);o&&t.push(o);let i=Li(e);if(i&&t.push(i),e.paperSrcFirst!==void 0||e.paperSrcOther!==void 0){let p=[];e.paperSrcFirst!==void 0&&p.push(`w:first="${e.paperSrcFirst}"`),e.paperSrcOther!==void 0&&p.push(`w:other="${e.paperSrcOther}"`),t.push(`<w:paperSrc ${p.join(" ")}/>`);}let a=Oi(e);a&&t.push(a);let s=Xi(e);s&&t.push(s);let c=Hi(e);c&&t.push(c);let f=zi(e);return f&&t.push(f),e.verticalAlign&&t.push(`<w:vAlign w:val="${e.verticalAlign}"/>`),e.bidi&&t.push("<w:bidi/>"),e.titlePg&&t.push("<w:titlePg/>"),e.evenAndOddHeaders&&t.push("<w:evenAndOddHeaders/>"),t.length===0?"":`<w:sectPr>${t.join("")}</w:sectPr>`}function Mn(e){if(e.type==="paragraph")return le(e);if(e.type==="table")return Se(e);if(e.type==="blockSdt"){let t=e.content.map(o=>Mn(o)).join(""),n=e.properties,r=[];return n.alias&&r.push(`<w:alias w:val="${n.alias}"/>`),n.tag&&r.push(`<w:tag w:val="${n.tag}"/>`),`<w:sdt><w:sdtPr>${r.join("")}</w:sdtPr><w:sdtContent>${t}</w:sdtContent></w:sdt>`}return ""}function ji(e){return e.map(t=>Mn(t)).join("")}function Bn(e){let t=[];return t.push(ji(e.content)),e.finalSectionProperties&&t.push(An(e.finalSectionProperties)),t.join("")}function ke(e){yt();let t=[];t.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>');let n=Ai();return t.push(`<w:document ${n} mc:Ignorable="w14 w15 wp14">`),t.push("<w:body>"),t.push(Bn(e.package.document)),t.push("</w:body>"),t.push("</w:document>"),t.join("")}function G(e){return xml2js(e,{compact:false,ignoreComment:true,ignoreInstruction:true,ignoreDoctype:true,alwaysArray:false,trim:false,captureSpacesBetweenElements:true,attributesKey:"attributes",textKey:"text"})}function $n(e){return js2xml({elements:[e]},{compact:false,spaces:0})}function oe(e){try{let t=G(e);return t.elements&&t.elements.length>0?t.elements.find(n=>n.type==="element")??null:t}catch(t){return console.warn("Failed to parse XML:",t),null}}function q(e){let t=e.indexOf(":");return t>=0?e.substring(t+1):e}function Wi(e,t,n){if(!e.name)return false;let r=`${t}:${n}`;return e.name===r||q(e.name)===n}function u(e,t,n){if(!e||!e.elements)return null;let r=`${t}:${n}`;for(let o of e.elements)if(o.type==="element"&&(o.name===r||q(o.name||"")===n))return o;return null}function H(e,t,n){if(!e||!e.elements)return [];let r=`${t}:${n}`,o=[];for(let i of e.elements)i.type==="element"&&(i.name===r||q(i.name||"")===n)&&o.push(i);return o}function N(e,t){if(!e||!e.elements)return null;for(let n of e.elements)if(n.type==="element"&&n.name===t)return n;return null}function D(e){return !e||!e.elements?[]:e.elements.filter(t=>t.type==="element")}function l(e,t,n){if(!e||!e.attributes)return null;let r=e.attributes;if(t){let o=`${t}:${n}`;if(o in r)return r[o]}return n in r?r[n]:null}function ie(e){if(!e)return "";if("text"in e&&typeof e.text=="string")return e.text;if(!e.elements)return "";let t="";for(let n of e.elements)n.type==="text"&&"text"in n?t+=n.text??"":n.type==="element"&&(t+=ie(n));return t}function h(e,t,n,r=1){let o=l(e,t,n);if(o===null)return;let i=parseInt(o,10);if(!isNaN(i))return i*r}function k(e,t="w"){if(!e)return false;let n=l(e,t,"val");return n===null?true:!(n==="0"||n==="false"||n==="off")}function Tt(e,t,n){if(!e)return null;if(Wi(e,t,n))return e;if(e.elements)for(let r of e.elements){if(r.type!=="element")continue;let o=Tt(r,t,n);if(o)return o}return null}var j={image:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",hyperlink:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",header:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",footer:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",comments:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",commentsExtended:"http://schemas.microsoft.com/office/2011/relationships/commentsExtended",commentsIds:"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds",commentsExtensible:"http://schemas.microsoft.com/office/2018/08/relationships/commentsExtensible"};function Ne(e){let t=new Map;if(!e||e.trim().length===0)return t;let n=oe(e);if(!n)return console.warn("Failed to parse relationships XML"),t;let r=D(n);for(let o of r){let i=o.name||"";if(!i.endsWith("Relationship")&&!i.includes(":Relationship"))continue;let a=l(o,null,"Id"),s=l(o,null,"Type"),c=l(o,null,"Target"),f=l(o,null,"TargetMode");if(!a||!s||!c){console.warn("Relationship missing required attributes:",{id:a,type:s,target:c});continue}let p={id:a,type:s,target:c};f==="External"?p.targetMode="External":f==="Internal"&&(p.targetMode="Internal"),t.set(a,p);}return t}function Ct(e,t){return e.get(t)?.target}var Ui=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
2
  <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`;function Ft(e){return e.startsWith("/")?e.slice(1):`word/${e}`}function Nn(e){let t=[{relsPath:"word/_rels/document.xml.rels",blocks:e.package.document.content}],n=e.package.relationships;if(!n)return t;let r=(o,i)=>{if(o)for(let[a,s]of o.entries()){let c=n.get(a);if(!c||c.type!==i||!c.target)continue;let p=Ft(c.target).replace(/^word\//,"");t.push({relsPath:`word/_rels/${p}.rels`,blocks:s.content});}};return r(e.package.headers,j.header),r(e.package.footers,j.footer),t}async function xe(e,t){let n=e.file(t);return (n?await n.async("text"):Ui).replace(/<Relationships([^>]*)\/>/,"<Relationships$1></Relationships>")}function te(e){let t=0;for(let n of e.matchAll(/Id="rId(\d+)"/g)){let r=parseInt(n[1],10);r>t&&(t=r);}return t}function Ln(e,t){return {png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",tif:"image/tiff",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp",wmf:"image/x-wmf",emf:"image/x-emf"}[e]||"application/octet-stream"}function Hn(e){let t=[];for(let n of e)if(n.type==="paragraph"){for(let r of n.content)if(r.type==="run")for(let o of r.content)o.type==="drawing"&&o.image.src?.startsWith("data:")&&t.push(o.image);}else if(n.type==="table")for(let r of n.rows)for(let o of r.cells)t.push(...Hn(o.content));return t}var Gi={"image/png":"png","image/jpeg":"jpeg","image/gif":"gif","image/bmp":"bmp","image/tiff":"tiff","image/webp":"webp","image/svg+xml":"svg"};function Zi(e){let t=e.match(/^data:([^;]+);base64,(.+)$/);if(!t)throw new Error("Invalid data URL");let n=atob(t[2]),r=new Uint8Array(n.length);for(let o=0;o<n.length;o++)r[o]=n.charCodeAt(o);return {data:r.buffer,extension:Gi[t[1]]||"png"}}async function qi(e,t,n){if(t.size===0)return;let r=e.file("[Content_Types].xml");if(!r)return;let o=await r.async("text"),i=false;for(let a of t)if(!o.includes(`Extension="${a}"`)){let s=Ln(a);o=o.replace("</Types>",`<Default Extension="${a}" ContentType="${s}"/></Types>`),i=true;}i&&e.file("[Content_Types].xml",o,{compression:"DEFLATE",compressionOptions:{level:n}});}function Yi(e){let t=0;return e.forEach(n=>{let r=n.match(/^word\/media\/image(\d+)\./);if(r){let o=parseInt(r[1],10);o>t&&(t=o);}}),t}async function Xn(e,t,n){let r=Yi(t),o=new Set;for(let{relsPath:i,blocks:a}of e){let s=Hn(a);if(s.length===0)continue;let c=await xe(t,i),f=te(c),p=[];for(let g of s){let{data:b,extension:d}=Zi(g.src);r++,f++;let y=`image${r}.${d}`,T=`rId${f}`;t.file(`word/media/${y}`,b,{compression:"DEFLATE",compressionOptions:{level:n}}),p.push(`<Relationship Id="${T}" Type="${j.image}" Target="media/${y}"/>`),o.add(d),g.rId=T;}let m=c.replace("</Relationships>",p.join("")+"</Relationships>");t.file(i,m,{compression:"DEFLATE",compressionOptions:{level:n}});}await qi(t,o,n);}function On(e){let t=[];for(let n of e)if(n.type==="paragraph")for(let r of n.content)r.type==="hyperlink"&&r.href&&!r.rId&&!r.anchor&&t.push(r);else if(n.type==="table")for(let r of n.rows)for(let o of r.cells)t.push(...On(o.content));return t}async function zn(e,t,n){for(let{relsPath:r,blocks:o}of e){let i=On(o);if(i.length===0)continue;let a=await xe(t,r),s=te(a),c=[];for(let p of i){s++;let m=`rId${s}`;c.push(`<Relationship Id="${m}" Type="${j.hyperlink}" Target="${E(p.href)}" TargetMode="External"/>`),p.rId=m;}let f=a.replace("</Relationships>",c.join("")+"</Relationships>");t.file(r,f,{compression:"DEFLATE",compressionOptions:{level:n}});}}var Ji={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"};function Ki(){return Object.entries(Ji).map(([e,t])=>`xmlns:${e}="${t}"`).join(" ")}function Qi(e){return e.type==="paragraph"?le(e):e.type==="table"?Se(e):""}function jn(e){let t=e.type==="header"?"w:hdr":"w:ftr",n=Ki(),r=e.content.map(o=>Qi(o)).join("");return r||(r="<w:p><w:pPr/></w:p>"),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
3
- <${t} ${n}>${r}</${t}>`}function Pt(){return Math.floor(Math.random()*4294967296).toString(16).toUpperCase().padStart(8,"0")}var Le='xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16du="http://schemas.microsoft.com/office/word/2023/wordml/word16du" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16sdtfl="http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape"',He='mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"';function Un(e){let t="<w:r>",n=[];e.formatting?.bold&&n.push("<w:b/>"),e.formatting?.italic&&n.push("<w:i/>"),n.length>0&&(t+=`<w:rPr>${n.join("")}</w:rPr>`);for(let r of e.content)if(r.type==="text"){let o=r.text!==r.text.trim()||r.text.includes(" ");t+=o?`<w:t xml:space="preserve">${E(r.text)}</w:t>`:`<w:t>${E(r.text)}</w:t>`;}else r.type==="break"&&(t+="<w:br/>");return t+="</w:r>",t}function Vn(e,t){let n=t?`<w:p w14:paraId="${t}">`:"<w:p>";for(let r of e.content)r.type==="run"&&(n+=Un(r));return n+="</w:p>",n}function _n(e,t){let n=t?`<w:p w14:paraId="${t}">`:"<w:p>";n+='<w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:annotationRef/></w:r>';for(let r of e.content)r.type==="run"&&(n+=Un(r));return n+="</w:p>",n}function Wn(e,t){let n=Pt(),r=[`w:id="${e.id}"`];if(e.author&&r.push(`w:author="${E(e.author)}"`),e.initials?r.push(`w:initials="${E(e.initials)}"`):r.push('w:initials=""'),e.date){let i=e.date.replace(/\.\d{3}Z$/,"Z");r.push(`w:date="${E(i)}"`);}let o=`<w:comment ${r.join(" ")}>`;if(e.content&&e.content.length>0)if(e.content.length===1)o+=_n(e.content[0],n);else {o+=_n(e.content[0]);for(let i=1;i<e.content.length-1;i++)o+=Vn(e.content[i]);o+=Vn(e.content[e.content.length-1],n);}else o+=`<w:p w14:paraId="${n}"><w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:annotationRef/></w:r></w:p>`;return o+="</w:comment>",t.push({commentId:e.id,lastParaId:n,durableId:Pt(),parentId:e.parentId,done:e.done}),o}function Xe(e){if(!e||e.length===0)return {xml:"",paraInfos:[]};let t=[],n=[];for(let i of e)(i.parentId==null?t:n).push(i);let r=[],o=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:comments ${Le} ${He}>`;for(let i of t)o+=Wn(i,r);for(let i of n)o+=Wn(i,r);return o+="</w:comments>",{xml:o,paraInfos:r}}function Oe(e){if(e.length===0)return "";let t=new Map;for(let r of e)t.set(r.commentId,r.lastParaId);let n=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w15:commentsEx ${Le} ${He}>`;for(let r of e){let o=`w15:paraId="${r.lastParaId}" w15:done="${r.done?"1":"0"}"`;if(r.parentId!=null){let i=t.get(r.parentId);i&&(o+=` w15:paraIdParent="${i}"`);}n+=`<w15:commentEx ${o} />`;}return n+="</w15:commentsEx>",n}function ze(e){if(e.length===0)return "";let t=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w16cid:commentsIds ${Le} ${He}>`;for(let n of e)t+=`<w16cid:commentId w16cid:paraId="${n.lastParaId}" w16cid:durableId="${n.durableId}" />`;return t+="</w16cid:commentsIds>",t}function je(e,t){if(e.length===0)return "";let n=new Map;for(let o of t)n.set(o.id,o);let r=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w16cex:commentsExtensible ${Le} ${He}>`;for(let o of e){let i=n.get(o.commentId);if(!i?.date)continue;let a=o.durableId,s=(i.date.endsWith("Z")?i.date:i.date+"Z").replace(/\.\d{3}Z$/,"Z");r+=`<w16cex:commentExtensible w16cex:durableId="${a}" w16cex:dateUtc="${s}"/>`;}return r+="</w16cex:commentsExtensible>",r}var ea="application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",ta="application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",Ve="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",_e="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",We="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml",Ue="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml";async function Gn(e,t,n){let r=e.package.relationships;if(!r)return;let o=[];for(let[f,p]of r){if(!p.target)continue;let m=p.type===j.header?ea:p.type===j.footer?ta:null;m&&o.push({rId:f,target:p.target.replace(/^(\/?word\/)/,""),contentType:m,relType:p.type});}if(o.length===0)return;let i=t.file("[Content_Types].xml");if(i){let f=await i.async("text"),p=false;for(let{target:m,contentType:g}of o){let b=`/word/${m}`;f.includes(`PartName="${b}"`)||(f=f.replace("</Types>",`<Override PartName="${b}" ContentType="${g}"/></Types>`),p=true);}p&&t.file("[Content_Types].xml",f,{compression:"DEFLATE",compressionOptions:{level:n}});}let a="word/_rels/document.xml.rels",s=await xe(t,a),c=false;for(let{rId:f,relType:p,target:m}of o)s.includes(`Id="${f}"`)||(s=s.replace("</Relationships>",`<Relationship Id="${f}" Type="${p}" Target="${m}"/></Relationships>`),c=true);c&&t.file(a,s,{compression:"DEFLATE",compressionOptions:{level:n}});}async function na(e,t){let n=[{partName:"/word/comments.xml",contentType:Ve,target:"comments.xml",relType:j.comments},{partName:"/word/commentsExtended.xml",contentType:_e,target:"commentsExtended.xml",relType:j.commentsExtended},{partName:"/word/commentsIds.xml",contentType:We,target:"commentsIds.xml",relType:j.commentsIds},{partName:"/word/commentsExtensible.xml",contentType:Ue,target:"commentsExtensible.xml",relType:j.commentsExtensible}],r=e.file("[Content_Types].xml");if(r){let a=await r.async("text"),s=false;for(let{partName:c,contentType:f}of n)a.includes(c)||(a=a.replace("</Types>",`<Override PartName="${c}" ContentType="${f}"/></Types>`),s=true);s&&e.file("[Content_Types].xml",a,{compression:"DEFLATE",compressionOptions:{level:t}});}let o="word/_rels/document.xml.rels",i=e.file(o);if(i){let a=await i.async("text"),s=false;for(let{target:c,relType:f}of n)if(!a.includes(c)){let p=`rId${te(a)+1}`;a=a.replace("</Relationships>",`<Relationship Id="${p}" Type="${f}" Target="${c}"/></Relationships>`),s=true;}s&&e.file(o,a,{compression:"DEFLATE",compressionOptions:{level:t}});}}async function Zn(e,t,n){let r=e.package.document.comments;if(!r||r.length===0)return;let{xml:o,paraInfos:i}=Xe(r);t.file("word/comments.xml",o,{compression:"DEFLATE",compressionOptions:{level:n}});let a=Oe(i);a&&t.file("word/commentsExtended.xml",a,{compression:"DEFLATE",compressionOptions:{level:n}});let s=ze(i);s&&t.file("word/commentsIds.xml",s,{compression:"DEFLATE",compressionOptions:{level:n}});let c=je(i,r);c&&t.file("word/commentsExtensible.xml",c,{compression:"DEFLATE",compressionOptions:{level:n}}),await na(t,n);}function Ge(e){let t=new Map,n=e.package.relationships;if(!n)return t;let r=[{map:e.package.headers,type:j.header},{map:e.package.footers,type:j.footer}];for(let{map:o,type:i}of r)if(o)for(let[a,s]of o.entries()){let c=n.get(a);c&&c.type===i&&c.target&&t.set(Ft(c.target),jn(s));}return t}function qn(e,t,n){let r={level:n};for(let[o,i]of Ge(e))t.file(o,i,{compression:"DEFLATE",compressionOptions:r});}async function Yn(){let e=new St;e.file("[Content_Types].xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
3
+ <${t} ${n}>${r}</${t}>`}function Pt(){return Math.floor(Math.random()*2147483647).toString(16).toUpperCase().padStart(8,"0")}var Le='xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16du="http://schemas.microsoft.com/office/word/2023/wordml/word16du" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16sdtfl="http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape"',He='mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"';function Un(e){let t="<w:r>",n=[];e.formatting?.bold&&n.push("<w:b/>"),e.formatting?.italic&&n.push("<w:i/>"),n.length>0&&(t+=`<w:rPr>${n.join("")}</w:rPr>`);for(let r of e.content)if(r.type==="text"){let o=r.text!==r.text.trim()||r.text.includes(" ");t+=o?`<w:t xml:space="preserve">${E(r.text)}</w:t>`:`<w:t>${E(r.text)}</w:t>`;}else r.type==="break"&&(t+="<w:br/>");return t+="</w:r>",t}function Vn(e,t){let n=t?`<w:p w14:paraId="${t}">`:"<w:p>";for(let r of e.content)r.type==="run"&&(n+=Un(r));return n+="</w:p>",n}function _n(e,t){let n=t?`<w:p w14:paraId="${t}">`:"<w:p>";n+='<w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:annotationRef/></w:r>';for(let r of e.content)r.type==="run"&&(n+=Un(r));return n+="</w:p>",n}function Wn(e,t){let n=Pt(),r=[`w:id="${e.id}"`];if(e.author&&r.push(`w:author="${E(e.author)}"`),e.initials?r.push(`w:initials="${E(e.initials)}"`):r.push('w:initials=""'),e.date){let i=e.date.replace(/\.\d{3}Z$/,"Z");r.push(`w:date="${E(i)}"`);}let o=`<w:comment ${r.join(" ")}>`;if(e.content&&e.content.length>0)if(e.content.length===1)o+=_n(e.content[0],n);else {o+=_n(e.content[0]);for(let i=1;i<e.content.length-1;i++)o+=Vn(e.content[i]);o+=Vn(e.content[e.content.length-1],n);}else o+=`<w:p w14:paraId="${n}"><w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:annotationRef/></w:r></w:p>`;return o+="</w:comment>",t.push({commentId:e.id,lastParaId:n,durableId:Pt(),parentId:e.parentId,done:e.done}),o}function Xe(e){if(!e||e.length===0)return {xml:"",paraInfos:[]};let t=[],n=[];for(let i of e)(i.parentId==null?t:n).push(i);let r=[],o=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:comments ${Le} ${He}>`;for(let i of t)o+=Wn(i,r);for(let i of n)o+=Wn(i,r);return o+="</w:comments>",{xml:o,paraInfos:r}}function Oe(e){if(e.length===0)return "";let t=new Map;for(let r of e)t.set(r.commentId,r.lastParaId);let n=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w15:commentsEx ${Le} ${He}>`;for(let r of e){let o=`w15:paraId="${r.lastParaId}" w15:done="${r.done?"1":"0"}"`;if(r.parentId!=null){let i=t.get(r.parentId);i&&(o+=` w15:paraIdParent="${i}"`);}n+=`<w15:commentEx ${o} />`;}return n+="</w15:commentsEx>",n}function ze(e){if(e.length===0)return "";let t=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w16cid:commentsIds ${Le} ${He}>`;for(let n of e)t+=`<w16cid:commentId w16cid:paraId="${n.lastParaId}" w16cid:durableId="${n.durableId}" />`;return t+="</w16cid:commentsIds>",t}function je(e,t){if(e.length===0)return "";let n=new Map;for(let o of t)n.set(o.id,o);let r=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w16cex:commentsExtensible ${Le} ${He}>`;for(let o of e){let i=n.get(o.commentId);if(!i?.date)continue;let a=o.durableId,s=(i.date.endsWith("Z")?i.date:i.date+"Z").replace(/\.\d{3}Z$/,"Z");r+=`<w16cex:commentExtensible w16cex:durableId="${a}" w16cex:dateUtc="${s}"/>`;}return r+="</w16cex:commentsExtensible>",r}var ea="application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",ta="application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",Ve="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",_e="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",We="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml",Ue="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml";async function Gn(e,t,n){let r=e.package.relationships;if(!r)return;let o=[];for(let[f,p]of r){if(!p.target)continue;let m=p.type===j.header?ea:p.type===j.footer?ta:null;m&&o.push({rId:f,target:p.target.replace(/^(\/?word\/)/,""),contentType:m,relType:p.type});}if(o.length===0)return;let i=t.file("[Content_Types].xml");if(i){let f=await i.async("text"),p=false;for(let{target:m,contentType:g}of o){let b=`/word/${m}`;f.includes(`PartName="${b}"`)||(f=f.replace("</Types>",`<Override PartName="${b}" ContentType="${g}"/></Types>`),p=true);}p&&t.file("[Content_Types].xml",f,{compression:"DEFLATE",compressionOptions:{level:n}});}let a="word/_rels/document.xml.rels",s=await xe(t,a),c=false;for(let{rId:f,relType:p,target:m}of o)s.includes(`Id="${f}"`)||(s=s.replace("</Relationships>",`<Relationship Id="${f}" Type="${p}" Target="${m}"/></Relationships>`),c=true);c&&t.file(a,s,{compression:"DEFLATE",compressionOptions:{level:n}});}async function na(e,t){let n=[{partName:"/word/comments.xml",contentType:Ve,target:"comments.xml",relType:j.comments},{partName:"/word/commentsExtended.xml",contentType:_e,target:"commentsExtended.xml",relType:j.commentsExtended},{partName:"/word/commentsIds.xml",contentType:We,target:"commentsIds.xml",relType:j.commentsIds},{partName:"/word/commentsExtensible.xml",contentType:Ue,target:"commentsExtensible.xml",relType:j.commentsExtensible}],r=e.file("[Content_Types].xml");if(r){let a=await r.async("text"),s=false;for(let{partName:c,contentType:f}of n)a.includes(c)||(a=a.replace("</Types>",`<Override PartName="${c}" ContentType="${f}"/></Types>`),s=true);s&&e.file("[Content_Types].xml",a,{compression:"DEFLATE",compressionOptions:{level:t}});}let o="word/_rels/document.xml.rels",i=e.file(o);if(i){let a=await i.async("text"),s=false;for(let{target:c,relType:f}of n)if(!a.includes(c)){let p=`rId${te(a)+1}`;a=a.replace("</Relationships>",`<Relationship Id="${p}" Type="${f}" Target="${c}"/></Relationships>`),s=true;}s&&e.file(o,a,{compression:"DEFLATE",compressionOptions:{level:t}});}}async function Zn(e,t,n){let r=e.package.document.comments;if(!r||r.length===0)return;let{xml:o,paraInfos:i}=Xe(r);t.file("word/comments.xml",o,{compression:"DEFLATE",compressionOptions:{level:n}});let a=Oe(i);a&&t.file("word/commentsExtended.xml",a,{compression:"DEFLATE",compressionOptions:{level:n}});let s=ze(i);s&&t.file("word/commentsIds.xml",s,{compression:"DEFLATE",compressionOptions:{level:n}});let c=je(i,r);c&&t.file("word/commentsExtensible.xml",c,{compression:"DEFLATE",compressionOptions:{level:n}}),await na(t,n);}function Ge(e){let t=new Map,n=e.package.relationships;if(!n)return t;let r=[{map:e.package.headers,type:j.header},{map:e.package.footers,type:j.footer}];for(let{map:o,type:i}of r)if(o)for(let[a,s]of o.entries()){let c=n.get(a);c&&c.type===i&&c.target&&t.set(Ft(c.target),jn(s));}return t}function qn(e,t,n){let r={level:n};for(let[o,i]of Ge(e))t.file(o,i,{compression:"DEFLATE",compressionOptions:r});}async function Yn(){let e=new St;e.file("[Content_Types].xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
4
4
  <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
5
5
  <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
6
6
  <Default Extension="xml" ContentType="application/xml"/>
@@ -1,5 +1,5 @@
1
- 'use strict';var chunkDQH7AV5E_js=require('./chunk-DQH7AV5E.js');function h(s){return s.type==="insertion"||s.type==="deletion"||s.type==="moveFrom"||s.type==="moveTo"}function x(s){let n=[];for(let o of s)o.type==="run"?n.push(chunkDQH7AV5E_js.H(o)):o.type==="hyperlink"&&n.push(chunkDQH7AV5E_js.I(o));return n.join("")}function K(s,n){let o=0;for(let t of s.content)if(t.type==="paragraph"){if(o===n)return t;o++;}else if(t.type==="table"){for(let r of t.rows)for(let e of r.cells)for(let a of e.content)if(a.type==="paragraph"){if(o===n)return a;o++;}}else o++;throw new Error(`Paragraph index ${n} out of bounds (max: ${o-1})`)}function R(s,n){let o=0;for(let t of s.content)if(t.type==="paragraph"){if(n(t,o)===false)return;o++;}else if(t.type==="table"){for(let r of t.rows)for(let e of r.cells)for(let a of e.content)if(a.type==="paragraph"){if(n(a,o)===false)return;o++;}}else o++;}function V(s,n={}){let{fromIndex:o,toIndex:t,includeTrackedChanges:r=true,includeCommentAnchors:e=true}=n,a=[],i=0;for(let c of s.content)if(c.type==="paragraph")w(i,o,t)&&a.push(L(c,i,r,e)),i++;else if(c.type==="table"){w(i,o,t)&&a.push(H(c,i,r,e));for(let l of c.rows)for(let u of l.cells)for(let p of u.content)p.type==="paragraph"&&i++;}else i++;return a}function w(s,n,o){return (n===void 0||s>=n)&&(o===void 0||s<=o)}function L(s,n,o,t){let r=B(s,o,t),e=s.formatting?.styleId,a=s.paraId;return chunkDQH7AV5E_js.U(e)?{type:"heading",index:n,paraId:a,level:chunkDQH7AV5E_js.V(e)??1,text:r}:s.listRendering?{type:"list-item",index:n,paraId:a,text:r,listLevel:s.listRendering.level??0,listType:s.listRendering.isBullet?"bullet":"number"}:{type:"paragraph",index:n,paraId:a,text:r}}function H(s,n,o,t){let r=[],e=[];for(let a of s.rows){let i=[],c=[];for(let l of a.cells){let u=[],p;for(let g of l.content)g.type==="paragraph"&&(p===void 0&&(p=g.paraId),u.push(B(g,o,t)));i.push(u.join(`
1
+ 'use strict';var chunkONK67NAB_js=require('./chunk-ONK67NAB.js');function h(s){return s.type==="insertion"||s.type==="deletion"||s.type==="moveFrom"||s.type==="moveTo"}function x(s){let n=[];for(let o of s)o.type==="run"?n.push(chunkONK67NAB_js.H(o)):o.type==="hyperlink"&&n.push(chunkONK67NAB_js.I(o));return n.join("")}function K(s,n){let o=0;for(let t of s.content)if(t.type==="paragraph"){if(o===n)return t;o++;}else if(t.type==="table"){for(let r of t.rows)for(let e of r.cells)for(let a of e.content)if(a.type==="paragraph"){if(o===n)return a;o++;}}else o++;throw new Error(`Paragraph index ${n} out of bounds (max: ${o-1})`)}function R(s,n){let o=0;for(let t of s.content)if(t.type==="paragraph"){if(n(t,o)===false)return;o++;}else if(t.type==="table"){for(let r of t.rows)for(let e of r.cells)for(let a of e.content)if(a.type==="paragraph"){if(n(a,o)===false)return;o++;}}else o++;}function V(s,n={}){let{fromIndex:o,toIndex:t,includeTrackedChanges:r=true,includeCommentAnchors:e=true}=n,a=[],i=0;for(let c of s.content)if(c.type==="paragraph")w(i,o,t)&&a.push(L(c,i,r,e)),i++;else if(c.type==="table"){w(i,o,t)&&a.push(H(c,i,r,e));for(let l of c.rows)for(let u of l.cells)for(let p of u.content)p.type==="paragraph"&&i++;}else i++;return a}function w(s,n,o){return (n===void 0||s>=n)&&(o===void 0||s<=o)}function L(s,n,o,t){let r=B(s,o,t),e=s.formatting?.styleId,a=s.paraId;return chunkONK67NAB_js.U(e)?{type:"heading",index:n,paraId:a,level:chunkONK67NAB_js.V(e)??1,text:r}:s.listRendering?{type:"list-item",index:n,paraId:a,text:r,listLevel:s.listRendering.level??0,listType:s.listRendering.isBullet?"bullet":"number"}:{type:"paragraph",index:n,paraId:a,text:r}}function H(s,n,o,t){let r=[],e=[];for(let a of s.rows){let i=[],c=[];for(let l of a.cells){let u=[],p;for(let g of l.content)g.type==="paragraph"&&(p===void 0&&(p=g.paraId),u.push(B(g,o,t)));i.push(u.join(`
2
2
  `)),c.push(p);}r.push(i),e.push(c);}return {type:"table",index:n,rows:r,cellParaIds:e}}function Y(s){let n=[],o=t=>t.paraId?t.paraId:String(t.index);for(let t of s)switch(t.type){case "heading":n.push(`[${o(t)}] (h${t.level}) ${t.text}`);break;case "paragraph":n.push(`[${o(t)}] ${t.text}`);break;case "list-item":{let r=" ".repeat(t.listLevel),e=t.listType==="bullet"?"\u2022":"-";n.push(`[${o(t)}] ${r}${e} ${t.text}`);break}case "table":{let r=t.index;for(let e=0;e<t.rows.length;e++)for(let a=0;a<t.rows[e].length;a++){let c=t.rows[e][a].split(`
3
3
  `),l=t.cellParaIds?.[e]?.[a];for(let u=0;u<c.length;u++){let p=u===0&&l?l:String(r);n.push(`[${p}] (table, row ${e+1}, col ${a+1}) ${c[u]}`),r++;}}break}}return n.join(`
4
- `)}function B(s,n,o){let t=[],r=new Set;for(let e of s.content){if(e.type==="commentRangeStart"&&o){r.add(e.id),t.push(`[comment:${e.id}]`);continue}if(e.type==="commentRangeEnd"&&o){r.has(e.id)&&(r.delete(e.id),t.push("[/comment]"));continue}if(e.type==="run")t.push(chunkDQH7AV5E_js.H(e));else if(e.type==="hyperlink")t.push(chunkDQH7AV5E_js.I(e));else if(h(e)){let a=x(e.content);e.type==="insertion"||e.type==="moveTo"?n&&t.push(`[+${a}+]{by:${e.info.author}}`):n?t.push(`[-${a}-]{by:${e.info.author}}`):t.push(a);}}return t.join("")}var y=class extends Error{constructor(n,o){let t=o!==void 0?` in paragraph ${o}`:" in document";super(`Text not found${t}: "${n}"`),this.name="TextNotFoundError";}},M=class extends Error{constructor(n){super(`Tracked change not found: id=${n}`),this.name="ChangeNotFoundError";}},F=class extends Error{constructor(n){super(`Comment not found: id=${n}`),this.name="CommentNotFoundError";}};function E(s){let n=[],o=0;for(let t=0;t<s.content.length;t++){let r=s.content[t];if(r.type==="run"){let e=chunkDQH7AV5E_js.H(r);n.push({contentIndex:t,run:r,text:e,startPos:o}),o+=e.length;}else if(r.type==="hyperlink")for(let e=0;e<r.children.length;e++){let a=r.children[e];if(a.type==="run"){let i=chunkDQH7AV5E_js.H(a);n.push({contentIndex:t,run:a,text:i,startPos:o}),o+=i.length;}}else if(h(r)){if(r.type==="insertion"||r.type==="moveTo")continue;for(let e=0;e<r.content.length;e++){let a=r.content[e];if(a.type==="run"){let i=chunkDQH7AV5E_js.H(a);n.push({contentIndex:t,run:a,text:i,startPos:o}),o+=i.length;}else if(a.type==="hyperlink"){for(let i of a.children)if(i.type==="run"){let c=chunkDQH7AV5E_js.H(i);n.push({contentIndex:t,run:i,text:c,startPos:o}),o+=c.length;}}}}}return n}function k(s){return E(s).map(n=>n.text).join("")}function G(s,n,o){let t=E(s),r=t.map(u=>u.text).join(""),e=W(r,n);if(!e)throw new y(n,o);let a=-1,i=0;for(let u=0;u<t.length;u++)if(e.start<t[u].startPos+t[u].text.length){a=u,i=e.start-t[u].startPos;break}let c=-1,l=0;for(let u=t.length-1;u>=0;u--)if(e.end>t[u].startPos){c=u,l=e.end-t[u].startPos;break}if(a===-1||c===-1)throw new y(n,o);return {startRunIndex:t[a].contentIndex,startOffset:i,endRunIndex:t[c].contentIndex,endOffset:l}}function te(s,n,o){let t=G(s,n,o),{startRunIndex:r,endRunIndex:e}=t,{startOffset:a,endOffset:i}=t,c=s.content[e];if(c.type==="run"){let u=chunkDQH7AV5E_js.H(c);if(i<u.length){let p=D(u.slice(i),c);$(c,u.slice(0,i)),s.content.splice(e+1,0,p);}}let l=s.content[r];if(l.type==="run"&&a>0){let u=chunkDQH7AV5E_js.H(l),p=D(u.slice(0,a),l);$(l,u.slice(a)),s.content.splice(r,0,p),r++,e++;}return {startIndex:r,endIndex:e}}function D(s,n){return {type:"run",content:[{type:"text",text:s}],formatting:n.formatting?{...n.formatting}:void 0}}function $(s,n){let o=s.content.find(t=>t.type==="text");o&&(o.text=n);}function O(s){let n=[],o=[],t=true;for(let r=0;r<s.length;r++){let e=s[r];if(!"\u200B\u200C\u200D\uFEFF\xAD".includes(e)){if("\u201C\u201D\u201E\u201F".includes(e)&&(e='"'),"\u2018\u2019\u201A\u201B".includes(e)&&(e="'"),"\u2013\u2014\u2012\u2015".includes(e)&&(e="-"),e==="\u2026"){n.push(".",".","."),o.push(r,r,r),t=false;continue}if(/\s/.test(e)||e==="\xA0"){t||(n.push(" "),o.push(r),t=true);continue}n.push(e.toLowerCase()),o.push(r),t=false;}}return n.length>0&&n[n.length-1]===" "&&(n.pop(),o.pop()),{text:n.join(""),posMap:o}}function S(s,n,o,t){let r=s.posMap[n],e=s.posMap[n+o-1]+1;for(;e<t.length&&"\u200B\u200C\u200D\uFEFF\xAD".includes(t[e]);)e++;return {start:r,end:e}}function W(s,n){if(!n||!s)return null;let o=s.indexOf(n);if(o!==-1)return {start:o,end:o+n.length};let t=O(s),r=O(n);if(!r.text)return null;let e=t.text.indexOf(r.text);if(e!==-1)return S(t,e,r.text.length,s);let a=r.text.split(" ");if(a.length>=3)for(let i=1;i<=Math.min(2,a.length-2);i++){let c=a.slice(0,-i).join(" "),l=t.text.indexOf(c);if(l!==-1)return S(t,l,c.length,s)}return null}function se(s,n){let o=new Map;return R(s,(r,e)=>{let a=null;for(let i of r.content)if(h(i)){a===null&&(a=k(r));let c=x(i.content),l=i.info.id,u=o.get(l);u&&u.paragraphIndex===e?u.text+=c:o.set(l,{id:l,type:i.type,author:i.info.author,date:i.info.date??null,text:c,context:a,paragraphIndex:e});}}),Array.from(o.values()).filter(r=>!(n?.author&&r.author!==n.author||n?.type&&r.type!==n.type))}function ae(s,n){let o=s.comments??[];if(o.length===0)return [];let t=z(s),r=[],e=new Map;for(let i of o)if(i.parentId!==void 0){let c=e.get(i.parentId)??[];c.push(i),e.set(i.parentId,c);}else r.push(i);return r.map(i=>{let c=t.get(i.id),l=(e.get(i.id)??[]).map(u=>({id:u.id,author:u.author,date:u.date??null,text:A(u)}));return {id:i.id,author:i.author,date:i.date??null,text:A(i),anchoredText:c?.text??"",paragraphIndex:c?.paragraphIndex??-1,replies:l,done:i.done??false}}).filter(i=>!(n?.author&&i.author!==n.author||n?.done!==void 0&&i.done!==n.done))}function A(s){return s.content.map(n=>k(n)).join(`
5
- `)}function z(s){let n=new Map,o=new Map;return R(s,(t,r)=>{for(let e of t.content)if(e.type==="commentRangeStart")o.set(e.id,{paragraphIndex:r,parts:[]});else if(e.type==="commentRangeEnd"){let a=o.get(e.id);a&&(n.set(e.id,{text:a.parts.join(""),paragraphIndex:a.paragraphIndex}),o.delete(e.id));}else if(e.type==="run"){let a=chunkDQH7AV5E_js.H(e);for(let i of o.values())i.parts.push(a);}else if(e.type==="hyperlink"){let a=e.children.filter(i=>i.type==="run").map(chunkDQH7AV5E_js.H).join("");for(let i of o.values())i.parts.push(a);}else if(h(e)){if(e.type==="insertion"||e.type==="moveTo")continue;let a=x(e.content);for(let i of o.values())i.parts.push(a);}}),n}function N(s){let n=s.toDocument().package?.document;if(!n)return new Map;let o=new Map,t=0;for(let r of n.content)if(r.type==="paragraph"){let e=r.paraId;e&&o.set(e,t),t++;}else if(r.type==="table")for(let e of r.rows)for(let a of e.cells)for(let i of a.content)i.type==="paragraph"&&t++;else t++;return o}function X(s){let n=[],o=t=>{for(let r of t.content)r.type==="text"&&n.push(r.text??"");};for(let t of s.content)if(t.type==="run")o(t);else if(t.type==="hyperlink")for(let r of t.children)r.type==="run"&&o(r);else if(t.type==="deletion"||t.type==="moveFrom"){for(let r of t.content)if(r.type==="run")o(r);else if(r.type==="hyperlink")for(let e of r.children)e.type==="run"&&o(e);}return n.join("")}function ce(s){let n=new Set,o=null;function t(){return o===null&&(o=N(s)),o}function r(){if(n.size===0)return;let e=s.getComments(),a=s.getChanges(),i={commentCount:e.length,changeCount:a.length,comments:e,changes:a};for(let c of n)try{c(i);}catch(l){console.error("reviewerBridge content listener threw:",l);}}return {getContentAsText(e){return s.getContentAsText(e)},getContent(e){return s.getContent(e)},getComments(e){return s.getComments(e)},getChanges(e){return s.getChanges(e)},findText(e,a){if(!e)return [];let i=a?.caseSensitive??false,c=a?.limit??20,l=i?e:e.toLowerCase(),u=s.toDocument().package?.document;if(!u)return [];let p=[],g=40;for(let P of u.content){if(p.length>=c)break;if(P.type!=="paragraph")continue;let C=P;if(!C.paraId)continue;let m=X(C),v=i?m:m.toLowerCase(),d=v.indexOf(l);if(d===-1||v.indexOf(l,d+1)!==-1)continue;let j=m.slice(d,d+e.length);p.push({paraId:C.paraId,match:j,before:m.slice(Math.max(0,d-g),d),after:m.slice(d+e.length,d+e.length+g)});}return p},getSelection(){return null},addComment(e){let a=t().get(e.paraId);if(a===void 0)return null;try{let i=s.addComment({paragraphIndex:a,text:e.text,author:e.author,search:e.search});return r(),i}catch{return null}},replyTo(e,a){try{let i=s.replyTo(e,a);return r(),i}catch{return null}},resolveComment(e){let i=s.toDocument().package?.document?.comments?.find(c=>c.id===e);i&&(i.done=true,r());},proposeChange(e){let a=t().get(e.paraId);if(a===void 0)return false;let i=e.search==="",c=e.replaceWith==="";if(i&&c)return false;try{return i?s.proposeInsertion({paragraphIndex:a,insertText:e.replaceWith,author:e.author}):c?s.proposeDeletion({paragraphIndex:a,search:e.search,author:e.author}):s.replace({paragraphIndex:a,search:e.search,replaceWith:e.replaceWith,author:e.author}),r(),true}catch{return false}},scrollTo(e){return t().has(e)},applyFormatting(){return false},setParagraphStyle(){return false},getPage(){return null},getPages(){return []},getTotalPages(){return 0},getCurrentPage(){return 0},onContentChange(e){return n.add(e),()=>{n.delete(e);}},onSelectionChange(){return ()=>{}}}}exports.a=h;exports.b=K;exports.c=R;exports.d=V;exports.e=Y;exports.f=y;exports.g=M;exports.h=F;exports.i=G;exports.j=te;exports.k=se;exports.l=ae;exports.m=ce;
4
+ `)}function B(s,n,o){let t=[],r=new Set;for(let e of s.content){if(e.type==="commentRangeStart"&&o){r.add(e.id),t.push(`[comment:${e.id}]`);continue}if(e.type==="commentRangeEnd"&&o){r.has(e.id)&&(r.delete(e.id),t.push("[/comment]"));continue}if(e.type==="run")t.push(chunkONK67NAB_js.H(e));else if(e.type==="hyperlink")t.push(chunkONK67NAB_js.I(e));else if(h(e)){let a=x(e.content);e.type==="insertion"||e.type==="moveTo"?n&&t.push(`[+${a}+]{by:${e.info.author}}`):n?t.push(`[-${a}-]{by:${e.info.author}}`):t.push(a);}}return t.join("")}var y=class extends Error{constructor(n,o){let t=o!==void 0?` in paragraph ${o}`:" in document";super(`Text not found${t}: "${n}"`),this.name="TextNotFoundError";}},M=class extends Error{constructor(n){super(`Tracked change not found: id=${n}`),this.name="ChangeNotFoundError";}},F=class extends Error{constructor(n){super(`Comment not found: id=${n}`),this.name="CommentNotFoundError";}};function E(s){let n=[],o=0;for(let t=0;t<s.content.length;t++){let r=s.content[t];if(r.type==="run"){let e=chunkONK67NAB_js.H(r);n.push({contentIndex:t,run:r,text:e,startPos:o}),o+=e.length;}else if(r.type==="hyperlink")for(let e=0;e<r.children.length;e++){let a=r.children[e];if(a.type==="run"){let i=chunkONK67NAB_js.H(a);n.push({contentIndex:t,run:a,text:i,startPos:o}),o+=i.length;}}else if(h(r)){if(r.type==="insertion"||r.type==="moveTo")continue;for(let e=0;e<r.content.length;e++){let a=r.content[e];if(a.type==="run"){let i=chunkONK67NAB_js.H(a);n.push({contentIndex:t,run:a,text:i,startPos:o}),o+=i.length;}else if(a.type==="hyperlink"){for(let i of a.children)if(i.type==="run"){let c=chunkONK67NAB_js.H(i);n.push({contentIndex:t,run:i,text:c,startPos:o}),o+=c.length;}}}}}return n}function k(s){return E(s).map(n=>n.text).join("")}function G(s,n,o){let t=E(s),r=t.map(u=>u.text).join(""),e=W(r,n);if(!e)throw new y(n,o);let a=-1,i=0;for(let u=0;u<t.length;u++)if(e.start<t[u].startPos+t[u].text.length){a=u,i=e.start-t[u].startPos;break}let c=-1,l=0;for(let u=t.length-1;u>=0;u--)if(e.end>t[u].startPos){c=u,l=e.end-t[u].startPos;break}if(a===-1||c===-1)throw new y(n,o);return {startRunIndex:t[a].contentIndex,startOffset:i,endRunIndex:t[c].contentIndex,endOffset:l}}function te(s,n,o){let t=G(s,n,o),{startRunIndex:r,endRunIndex:e}=t,{startOffset:a,endOffset:i}=t,c=s.content[e];if(c.type==="run"){let u=chunkONK67NAB_js.H(c);if(i<u.length){let p=D(u.slice(i),c);$(c,u.slice(0,i)),s.content.splice(e+1,0,p);}}let l=s.content[r];if(l.type==="run"&&a>0){let u=chunkONK67NAB_js.H(l),p=D(u.slice(0,a),l);$(l,u.slice(a)),s.content.splice(r,0,p),r++,e++;}return {startIndex:r,endIndex:e}}function D(s,n){return {type:"run",content:[{type:"text",text:s}],formatting:n.formatting?{...n.formatting}:void 0}}function $(s,n){let o=s.content.find(t=>t.type==="text");o&&(o.text=n);}function O(s){let n=[],o=[],t=true;for(let r=0;r<s.length;r++){let e=s[r];if(!"\u200B\u200C\u200D\uFEFF\xAD".includes(e)){if("\u201C\u201D\u201E\u201F".includes(e)&&(e='"'),"\u2018\u2019\u201A\u201B".includes(e)&&(e="'"),"\u2013\u2014\u2012\u2015".includes(e)&&(e="-"),e==="\u2026"){n.push(".",".","."),o.push(r,r,r),t=false;continue}if(/\s/.test(e)||e==="\xA0"){t||(n.push(" "),o.push(r),t=true);continue}n.push(e.toLowerCase()),o.push(r),t=false;}}return n.length>0&&n[n.length-1]===" "&&(n.pop(),o.pop()),{text:n.join(""),posMap:o}}function S(s,n,o,t){let r=s.posMap[n],e=s.posMap[n+o-1]+1;for(;e<t.length&&"\u200B\u200C\u200D\uFEFF\xAD".includes(t[e]);)e++;return {start:r,end:e}}function W(s,n){if(!n||!s)return null;let o=s.indexOf(n);if(o!==-1)return {start:o,end:o+n.length};let t=O(s),r=O(n);if(!r.text)return null;let e=t.text.indexOf(r.text);if(e!==-1)return S(t,e,r.text.length,s);let a=r.text.split(" ");if(a.length>=3)for(let i=1;i<=Math.min(2,a.length-2);i++){let c=a.slice(0,-i).join(" "),l=t.text.indexOf(c);if(l!==-1)return S(t,l,c.length,s)}return null}function se(s,n){let o=new Map;return R(s,(r,e)=>{let a=null;for(let i of r.content)if(h(i)){a===null&&(a=k(r));let c=x(i.content),l=i.info.id,u=o.get(l);u&&u.paragraphIndex===e?u.text+=c:o.set(l,{id:l,type:i.type,author:i.info.author,date:i.info.date??null,text:c,context:a,paragraphIndex:e});}}),Array.from(o.values()).filter(r=>!(n?.author&&r.author!==n.author||n?.type&&r.type!==n.type))}function ae(s,n){let o=s.comments??[];if(o.length===0)return [];let t=z(s),r=[],e=new Map;for(let i of o)if(i.parentId!==void 0){let c=e.get(i.parentId)??[];c.push(i),e.set(i.parentId,c);}else r.push(i);return r.map(i=>{let c=t.get(i.id),l=(e.get(i.id)??[]).map(u=>({id:u.id,author:u.author,date:u.date??null,text:A(u)}));return {id:i.id,author:i.author,date:i.date??null,text:A(i),anchoredText:c?.text??"",paragraphIndex:c?.paragraphIndex??-1,replies:l,done:i.done??false}}).filter(i=>!(n?.author&&i.author!==n.author||n?.done!==void 0&&i.done!==n.done))}function A(s){return s.content.map(n=>k(n)).join(`
5
+ `)}function z(s){let n=new Map,o=new Map;return R(s,(t,r)=>{for(let e of t.content)if(e.type==="commentRangeStart")o.set(e.id,{paragraphIndex:r,parts:[]});else if(e.type==="commentRangeEnd"){let a=o.get(e.id);a&&(n.set(e.id,{text:a.parts.join(""),paragraphIndex:a.paragraphIndex}),o.delete(e.id));}else if(e.type==="run"){let a=chunkONK67NAB_js.H(e);for(let i of o.values())i.parts.push(a);}else if(e.type==="hyperlink"){let a=e.children.filter(i=>i.type==="run").map(chunkONK67NAB_js.H).join("");for(let i of o.values())i.parts.push(a);}else if(h(e)){if(e.type==="insertion"||e.type==="moveTo")continue;let a=x(e.content);for(let i of o.values())i.parts.push(a);}}),n}function N(s){let n=s.toDocument().package?.document;if(!n)return new Map;let o=new Map,t=0;for(let r of n.content)if(r.type==="paragraph"){let e=r.paraId;e&&o.set(e,t),t++;}else if(r.type==="table")for(let e of r.rows)for(let a of e.cells)for(let i of a.content)i.type==="paragraph"&&t++;else t++;return o}function X(s){let n=[],o=t=>{for(let r of t.content)r.type==="text"&&n.push(r.text??"");};for(let t of s.content)if(t.type==="run")o(t);else if(t.type==="hyperlink")for(let r of t.children)r.type==="run"&&o(r);else if(t.type==="deletion"||t.type==="moveFrom"){for(let r of t.content)if(r.type==="run")o(r);else if(r.type==="hyperlink")for(let e of r.children)e.type==="run"&&o(e);}return n.join("")}function ce(s){let n=new Set,o=null;function t(){return o===null&&(o=N(s)),o}function r(){if(n.size===0)return;let e=s.getComments(),a=s.getChanges(),i={commentCount:e.length,changeCount:a.length,comments:e,changes:a};for(let c of n)try{c(i);}catch(l){console.error("reviewerBridge content listener threw:",l);}}return {getContentAsText(e){return s.getContentAsText(e)},getContent(e){return s.getContent(e)},getComments(e){return s.getComments(e)},getChanges(e){return s.getChanges(e)},findText(e,a){if(!e)return [];let i=a?.caseSensitive??false,c=a?.limit??20,l=i?e:e.toLowerCase(),u=s.toDocument().package?.document;if(!u)return [];let p=[],g=40;for(let P of u.content){if(p.length>=c)break;if(P.type!=="paragraph")continue;let C=P;if(!C.paraId)continue;let m=X(C),v=i?m:m.toLowerCase(),d=v.indexOf(l);if(d===-1||v.indexOf(l,d+1)!==-1)continue;let j=m.slice(d,d+e.length);p.push({paraId:C.paraId,match:j,before:m.slice(Math.max(0,d-g),d),after:m.slice(d+e.length,d+e.length+g)});}return p},getSelection(){return null},addComment(e){let a=t().get(e.paraId);if(a===void 0)return null;try{let i=s.addComment({paragraphIndex:a,text:e.text,author:e.author,search:e.search});return r(),i}catch{return null}},replyTo(e,a){try{let i=s.replyTo(e,a);return r(),i}catch{return null}},resolveComment(e){let i=s.toDocument().package?.document?.comments?.find(c=>c.id===e);i&&(i.done=true,r());},proposeChange(e){let a=t().get(e.paraId);if(a===void 0)return false;let i=e.search==="",c=e.replaceWith==="";if(i&&c)return false;try{return i?s.proposeInsertion({paragraphIndex:a,insertText:e.replaceWith,author:e.author}):c?s.proposeDeletion({paragraphIndex:a,search:e.search,author:e.author}):s.replace({paragraphIndex:a,search:e.search,replaceWith:e.replaceWith,author:e.author}),r(),true}catch{return false}},scrollTo(e){return t().has(e)},applyFormatting(){return false},setParagraphStyle(){return false},getPage(){return null},getPages(){return []},getTotalPages(){return 0},getCurrentPage(){return 0},onContentChange(e){return n.add(e),()=>{n.delete(e);}},onSelectionChange(){return ()=>{}}}}exports.a=h;exports.b=K;exports.c=R;exports.d=V;exports.e=Y;exports.f=y;exports.g=M;exports.h=F;exports.i=G;exports.j=te;exports.k=se;exports.l=ae;exports.m=ce;
@@ -1,4 +1,4 @@
1
- import {U,V as V$1,H as H$1,I}from'./chunk-NX2KNBB6.mjs';function h(s){return s.type==="insertion"||s.type==="deletion"||s.type==="moveFrom"||s.type==="moveTo"}function x(s){let n=[];for(let o of s)o.type==="run"?n.push(H$1(o)):o.type==="hyperlink"&&n.push(I(o));return n.join("")}function K(s,n){let o=0;for(let t of s.content)if(t.type==="paragraph"){if(o===n)return t;o++;}else if(t.type==="table"){for(let r of t.rows)for(let e of r.cells)for(let a of e.content)if(a.type==="paragraph"){if(o===n)return a;o++;}}else o++;throw new Error(`Paragraph index ${n} out of bounds (max: ${o-1})`)}function R(s,n){let o=0;for(let t of s.content)if(t.type==="paragraph"){if(n(t,o)===false)return;o++;}else if(t.type==="table"){for(let r of t.rows)for(let e of r.cells)for(let a of e.content)if(a.type==="paragraph"){if(n(a,o)===false)return;o++;}}else o++;}function V(s,n={}){let{fromIndex:o,toIndex:t,includeTrackedChanges:r=true,includeCommentAnchors:e=true}=n,a=[],i=0;for(let c of s.content)if(c.type==="paragraph")w(i,o,t)&&a.push(L(c,i,r,e)),i++;else if(c.type==="table"){w(i,o,t)&&a.push(H(c,i,r,e));for(let l of c.rows)for(let u of l.cells)for(let p of u.content)p.type==="paragraph"&&i++;}else i++;return a}function w(s,n,o){return (n===void 0||s>=n)&&(o===void 0||s<=o)}function L(s,n,o,t){let r=B(s,o,t),e=s.formatting?.styleId,a=s.paraId;return U(e)?{type:"heading",index:n,paraId:a,level:V$1(e)??1,text:r}:s.listRendering?{type:"list-item",index:n,paraId:a,text:r,listLevel:s.listRendering.level??0,listType:s.listRendering.isBullet?"bullet":"number"}:{type:"paragraph",index:n,paraId:a,text:r}}function H(s,n,o,t){let r=[],e=[];for(let a of s.rows){let i=[],c=[];for(let l of a.cells){let u=[],p;for(let g of l.content)g.type==="paragraph"&&(p===void 0&&(p=g.paraId),u.push(B(g,o,t)));i.push(u.join(`
1
+ import {U,V as V$1,H as H$1,I}from'./chunk-4UY5MI2V.mjs';function h(s){return s.type==="insertion"||s.type==="deletion"||s.type==="moveFrom"||s.type==="moveTo"}function x(s){let n=[];for(let o of s)o.type==="run"?n.push(H$1(o)):o.type==="hyperlink"&&n.push(I(o));return n.join("")}function K(s,n){let o=0;for(let t of s.content)if(t.type==="paragraph"){if(o===n)return t;o++;}else if(t.type==="table"){for(let r of t.rows)for(let e of r.cells)for(let a of e.content)if(a.type==="paragraph"){if(o===n)return a;o++;}}else o++;throw new Error(`Paragraph index ${n} out of bounds (max: ${o-1})`)}function R(s,n){let o=0;for(let t of s.content)if(t.type==="paragraph"){if(n(t,o)===false)return;o++;}else if(t.type==="table"){for(let r of t.rows)for(let e of r.cells)for(let a of e.content)if(a.type==="paragraph"){if(n(a,o)===false)return;o++;}}else o++;}function V(s,n={}){let{fromIndex:o,toIndex:t,includeTrackedChanges:r=true,includeCommentAnchors:e=true}=n,a=[],i=0;for(let c of s.content)if(c.type==="paragraph")w(i,o,t)&&a.push(L(c,i,r,e)),i++;else if(c.type==="table"){w(i,o,t)&&a.push(H(c,i,r,e));for(let l of c.rows)for(let u of l.cells)for(let p of u.content)p.type==="paragraph"&&i++;}else i++;return a}function w(s,n,o){return (n===void 0||s>=n)&&(o===void 0||s<=o)}function L(s,n,o,t){let r=B(s,o,t),e=s.formatting?.styleId,a=s.paraId;return U(e)?{type:"heading",index:n,paraId:a,level:V$1(e)??1,text:r}:s.listRendering?{type:"list-item",index:n,paraId:a,text:r,listLevel:s.listRendering.level??0,listType:s.listRendering.isBullet?"bullet":"number"}:{type:"paragraph",index:n,paraId:a,text:r}}function H(s,n,o,t){let r=[],e=[];for(let a of s.rows){let i=[],c=[];for(let l of a.cells){let u=[],p;for(let g of l.content)g.type==="paragraph"&&(p===void 0&&(p=g.paraId),u.push(B(g,o,t)));i.push(u.join(`
2
2
  `)),c.push(p);}r.push(i),e.push(c);}return {type:"table",index:n,rows:r,cellParaIds:e}}function Y(s){let n=[],o=t=>t.paraId?t.paraId:String(t.index);for(let t of s)switch(t.type){case "heading":n.push(`[${o(t)}] (h${t.level}) ${t.text}`);break;case "paragraph":n.push(`[${o(t)}] ${t.text}`);break;case "list-item":{let r=" ".repeat(t.listLevel),e=t.listType==="bullet"?"\u2022":"-";n.push(`[${o(t)}] ${r}${e} ${t.text}`);break}case "table":{let r=t.index;for(let e=0;e<t.rows.length;e++)for(let a=0;a<t.rows[e].length;a++){let c=t.rows[e][a].split(`
3
3
  `),l=t.cellParaIds?.[e]?.[a];for(let u=0;u<c.length;u++){let p=u===0&&l?l:String(r);n.push(`[${p}] (table, row ${e+1}, col ${a+1}) ${c[u]}`),r++;}}break}}return n.join(`
4
4
  `)}function B(s,n,o){let t=[],r=new Set;for(let e of s.content){if(e.type==="commentRangeStart"&&o){r.add(e.id),t.push(`[comment:${e.id}]`);continue}if(e.type==="commentRangeEnd"&&o){r.has(e.id)&&(r.delete(e.id),t.push("[/comment]"));continue}if(e.type==="run")t.push(H$1(e));else if(e.type==="hyperlink")t.push(I(e));else if(h(e)){let a=x(e.content);e.type==="insertion"||e.type==="moveTo"?n&&t.push(`[+${a}+]{by:${e.info.author}}`):n?t.push(`[-${a}-]{by:${e.info.author}}`):t.push(a);}}return t.join("")}var y=class extends Error{constructor(n,o){let t=o!==void 0?` in paragraph ${o}`:" in document";super(`Text not found${t}: "${n}"`),this.name="TextNotFoundError";}},M=class extends Error{constructor(n){super(`Tracked change not found: id=${n}`),this.name="ChangeNotFoundError";}},F=class extends Error{constructor(n){super(`Comment not found: id=${n}`),this.name="CommentNotFoundError";}};function E(s){let n=[],o=0;for(let t=0;t<s.content.length;t++){let r=s.content[t];if(r.type==="run"){let e=H$1(r);n.push({contentIndex:t,run:r,text:e,startPos:o}),o+=e.length;}else if(r.type==="hyperlink")for(let e=0;e<r.children.length;e++){let a=r.children[e];if(a.type==="run"){let i=H$1(a);n.push({contentIndex:t,run:a,text:i,startPos:o}),o+=i.length;}}else if(h(r)){if(r.type==="insertion"||r.type==="moveTo")continue;for(let e=0;e<r.content.length;e++){let a=r.content[e];if(a.type==="run"){let i=H$1(a);n.push({contentIndex:t,run:a,text:i,startPos:o}),o+=i.length;}else if(a.type==="hyperlink"){for(let i of a.children)if(i.type==="run"){let c=H$1(i);n.push({contentIndex:t,run:i,text:c,startPos:o}),o+=c.length;}}}}}return n}function k(s){return E(s).map(n=>n.text).join("")}function G(s,n,o){let t=E(s),r=t.map(u=>u.text).join(""),e=W(r,n);if(!e)throw new y(n,o);let a=-1,i=0;for(let u=0;u<t.length;u++)if(e.start<t[u].startPos+t[u].text.length){a=u,i=e.start-t[u].startPos;break}let c=-1,l=0;for(let u=t.length-1;u>=0;u--)if(e.end>t[u].startPos){c=u,l=e.end-t[u].startPos;break}if(a===-1||c===-1)throw new y(n,o);return {startRunIndex:t[a].contentIndex,startOffset:i,endRunIndex:t[c].contentIndex,endOffset:l}}function te(s,n,o){let t=G(s,n,o),{startRunIndex:r,endRunIndex:e}=t,{startOffset:a,endOffset:i}=t,c=s.content[e];if(c.type==="run"){let u=H$1(c);if(i<u.length){let p=D(u.slice(i),c);$(c,u.slice(0,i)),s.content.splice(e+1,0,p);}}let l=s.content[r];if(l.type==="run"&&a>0){let u=H$1(l),p=D(u.slice(0,a),l);$(l,u.slice(a)),s.content.splice(r,0,p),r++,e++;}return {startIndex:r,endIndex:e}}function D(s,n){return {type:"run",content:[{type:"text",text:s}],formatting:n.formatting?{...n.formatting}:void 0}}function $(s,n){let o=s.content.find(t=>t.type==="text");o&&(o.text=n);}function O(s){let n=[],o=[],t=true;for(let r=0;r<s.length;r++){let e=s[r];if(!"\u200B\u200C\u200D\uFEFF\xAD".includes(e)){if("\u201C\u201D\u201E\u201F".includes(e)&&(e='"'),"\u2018\u2019\u201A\u201B".includes(e)&&(e="'"),"\u2013\u2014\u2012\u2015".includes(e)&&(e="-"),e==="\u2026"){n.push(".",".","."),o.push(r,r,r),t=false;continue}if(/\s/.test(e)||e==="\xA0"){t||(n.push(" "),o.push(r),t=true);continue}n.push(e.toLowerCase()),o.push(r),t=false;}}return n.length>0&&n[n.length-1]===" "&&(n.pop(),o.pop()),{text:n.join(""),posMap:o}}function S(s,n,o,t){let r=s.posMap[n],e=s.posMap[n+o-1]+1;for(;e<t.length&&"\u200B\u200C\u200D\uFEFF\xAD".includes(t[e]);)e++;return {start:r,end:e}}function W(s,n){if(!n||!s)return null;let o=s.indexOf(n);if(o!==-1)return {start:o,end:o+n.length};let t=O(s),r=O(n);if(!r.text)return null;let e=t.text.indexOf(r.text);if(e!==-1)return S(t,e,r.text.length,s);let a=r.text.split(" ");if(a.length>=3)for(let i=1;i<=Math.min(2,a.length-2);i++){let c=a.slice(0,-i).join(" "),l=t.text.indexOf(c);if(l!==-1)return S(t,l,c.length,s)}return null}function se(s,n){let o=new Map;return R(s,(r,e)=>{let a=null;for(let i of r.content)if(h(i)){a===null&&(a=k(r));let c=x(i.content),l=i.info.id,u=o.get(l);u&&u.paragraphIndex===e?u.text+=c:o.set(l,{id:l,type:i.type,author:i.info.author,date:i.info.date??null,text:c,context:a,paragraphIndex:e});}}),Array.from(o.values()).filter(r=>!(n?.author&&r.author!==n.author||n?.type&&r.type!==n.type))}function ae(s,n){let o=s.comments??[];if(o.length===0)return [];let t=z(s),r=[],e=new Map;for(let i of o)if(i.parentId!==void 0){let c=e.get(i.parentId)??[];c.push(i),e.set(i.parentId,c);}else r.push(i);return r.map(i=>{let c=t.get(i.id),l=(e.get(i.id)??[]).map(u=>({id:u.id,author:u.author,date:u.date??null,text:A(u)}));return {id:i.id,author:i.author,date:i.date??null,text:A(i),anchoredText:c?.text??"",paragraphIndex:c?.paragraphIndex??-1,replies:l,done:i.done??false}}).filter(i=>!(n?.author&&i.author!==n.author||n?.done!==void 0&&i.done!==n.done))}function A(s){return s.content.map(n=>k(n)).join(`
@@ -1,2 +1,2 @@
1
- import {l,k,d,e}from'./chunk-DEDOV3KL.mjs';function y(n){return !n||n.length===0?"":n.map(i=>{let s=i;return s?.content?s.content.map(e=>e.content?.map(t=>t.text||"").join("")||"").join(""):""}).join(`
1
+ import {l,k,d,e}from'./chunk-EKCQF23W.mjs';function y(n){return !n||n.length===0?"":n.map(i=>{let s=i;return s?.content?s.content.map(e=>e.content?.map(t=>t.text||"").join("")||"").join(""):""}).join(`
2
2
  `)}function u(n){let i=n.getEditorRef();if(i){let e=i.getDocument();if(e?.package?.document)return e.package.document}return n.getDocument()?.package?.document??null}function T(n,i="AI"){function s(e){return e??i}return {getContentAsText(e$1){let t=u(n);return t?e(d(t,e$1)):""},getContent(e){let t=u(n);return t?d(t,e):[]},getComments(e){let t=u(n);if(!t)return [];let r=l(t,e);if(r.length>0)return r;let l$1=n.getComments();if(l$1.length===0)return [];let a=new Map,g=[];for(let o of l$1)if(o.parentId){let c=a.get(o.parentId);c?c.push(o):a.set(o.parentId,[o]);}else g.push(o);let m=[];for(let o of g){if(e?.author&&o.author!==e.author||e?.done!==void 0&&(o.done??false)!==e.done)continue;let c=a.get(o.id)??[];m.push({id:o.id,author:o.author,date:o.date??null,text:y(o.content),anchoredText:"",paragraphIndex:-1,replies:c.map(p=>({id:p.id,author:p.author,date:p.date??null,text:y(p.content)})),done:o.done??false});}return m},getChanges(e){let t=u(n);return t?k(t,e):[]},findText(e,t){return n.findInDocument(e,t)},getSelection(){return n.getSelectionInfo()},addComment(e){return n.addComment({paraId:e.paraId,text:e.text,author:s(e.author),search:e.search})},replyTo(e,t){return n.replyToComment(e,t.text,s(t.author))},resolveComment(e){n.resolveComment(e);},proposeChange(e){return n.proposeChange({paraId:e.paraId,search:e.search,replaceWith:e.replaceWith,author:s(e.author)})},applyFormatting(e){return n.applyFormatting({paraId:e.paraId,search:e.search,marks:e.marks})},setParagraphStyle(e){return n.setParagraphStyle({paraId:e.paraId,styleId:e.styleId})},getPage(e){return n.getPageContent(e)},getPages(e){let t=n.getTotalPages(),r=Math.max(1,Math.min(e.from,t)),l=Math.max(r,Math.min(e.to,t)),a=[];for(let g=r;g<=l;g++){let m=n.getPageContent(g);m&&a.push(m);}return a},getTotalPages(){return n.getTotalPages()},getCurrentPage(){return n.getCurrentPage()},scrollTo(e){return n.scrollToParaId(e)},onContentChange(e){return n.onContentChange(()=>{let t=u(n),r=t?l(t):[],l$1=t?k(t):[];try{e({commentCount:r.length,changeCount:l$1.length,comments:r,changes:l$1});}catch(a){console.error("onContentChange listener threw:",a);}})},onSelectionChange(e){return n.onSelectionChange(()=>{try{e(n.getSelectionInfo());}catch(t){console.error("onSelectionChange listener threw:",t);}})}}}export{T as a};
@@ -1 +1 @@
1
- import {d,e,k as k$1,l,b,i,h,c,j,g as g$1,a}from'./chunk-DEDOV3KL.mjs';import {w as w$1}from'./chunk-NX2KNBB6.mjs';function g(o,e){let{paragraphIndex:t,author:n="AI",text:s,search:a}=e,r=b(o,t),i$1=(o.comments??[]).map(m=>m.id),p=i$1.length>0?Math.max(...i$1)+1:1,c={id:p,author:n,date:new Date().toISOString(),content:[{type:"paragraph",content:[{type:"run",content:[{type:"text",text:s}]}],formatting:{}}]};if(o.comments||(o.comments=[]),o.comments.push(c),a){let m=i(r,a,t);r.content.splice(m.endRunIndex+1,0,{type:"commentRangeEnd",id:p}),r.content.splice(m.startRunIndex,0,{type:"commentRangeStart",id:p});}else r.content.unshift({type:"commentRangeStart",id:p}),r.content.push({type:"commentRangeEnd",id:p});return p}function y(o,e,t){let n=o.comments??[];if(!n.find(p=>p.id===e))throw new h(e);let a=n.map(p=>p.id),r=Math.max(...a)+1,i={id:r,author:t.author??"AI",date:new Date().toISOString(),parentId:e,content:[{type:"paragraph",content:[{type:"run",content:[{type:"text",text:t.text}]}],formatting:{}}]};return n.push(i),r}function E(o,e){let t=o.comments??[],n=t.find(r=>r.id===e);if(!n)throw new h(e);let s=n.parentId!==void 0,a=new Set([e]);if(!s)for(let r of t)r.parentId===e&&a.add(r.id);o.comments=t.filter(r=>!a.has(r.id)),!s&&c(o,r=>{for(let i=r.content.length-1;i>=0;i--){let p=r.content[i];(p.type==="commentRangeStart"||p.type==="commentRangeEnd")&&p.id===e&&r.content.splice(i,1);}});}function C(o,e){if(!W(o,e,"accept"))throw new g$1(e)}function I(o,e){if(!W(o,e,"reject"))throw new g$1(e)}function k(o){return M(o,"accept")}function F(o){return M(o,"reject")}function M(o,e){let t=0;return c(o,n=>{for(let s=n.content.length-1;s>=0;s--){let a$1=n.content[s];a(a$1)&&(G(n,s,a$1,e),t++);}}),t}function W(o,e,t){let n=false;return c(o,s=>{for(let a$1=s.content.length-1;a$1>=0;a$1--){let r=s.content[a$1];a(r)&&r.info.id===e&&(G(s,a$1,r,t),n=true);}if(n)return false}),n}function G(o,e,t,n){if(t.type==="insertion"&&n==="accept"||t.type==="deletion"&&n==="reject"||t.type==="moveTo"&&n==="accept"||t.type==="moveFrom"&&n==="reject"){let a=t.content;o.content.splice(e,1,...a);}else o.content.splice(e,1);}function x(o,e){let{paragraphIndex:t,search:n,author:s="AI",replaceWith:a}=e,r=b(o,t),{startIndex:i,endIndex:p}=j(r,n,t),c=new Date().toISOString(),m=w(o),h=r.content.slice(i,p+1),R={type:"deletion",info:{id:m,author:s,date:c},content:h},v={type:"insertion",info:{id:m+1,author:s,date:c},content:[{type:"run",content:[{type:"text",text:a}]}]};r.content.splice(i,p-i+1,R,v);}function H(o,e){let{paragraphIndex:t,author:n="AI",insertText:s,position:a="after",search:r}=e,i=b(o,t),p=new Date().toISOString(),m={type:"insertion",info:{id:w(o),author:n,date:p},content:[{type:"run",content:[{type:"text",text:s}]}]};if(r){let{startIndex:h,endIndex:R}=j(i,r,t),v=a==="after"?R+1:h;i.content.splice(v,0,m);}else a==="before"?i.content.unshift(m):i.content.push(m);}function L(o,e){let{paragraphIndex:t,search:n,author:s="AI"}=e,a=b(o,t),{startIndex:r,endIndex:i}=j(a,n,t),p=new Date().toISOString(),c=w(o),m=a.content.slice(r,i+1),h={type:"deletion",info:{id:c,author:s,date:p},content:m};a.content.splice(r,i-r+1,h);}var S=new WeakMap;function w(o){let e=S.get(o);e===void 0&&(e=0,c(o,n=>{for(let s of n.content)a(s)&&(e=Math.max(e,s.info.id));}));let t=e+1;return S.set(o,t+1),t}function N(o,e,t="AI"){let n=[],s=0,a=0,r=0,i=0,p=0;for(let c of e.accept??[])try{C(o,c),s++;}catch(m){n.push({operation:"accept",id:c,error:m.message});}for(let c of e.reject??[])try{I(o,c),a++;}catch(m){n.push({operation:"reject",id:c,error:m.message});}for(let c of e.comments??[])try{g(o,{...c,author:c.author??t}),r++;}catch(m){n.push({operation:"comment",search:c.search,error:m.message});}for(let c of e.replies??[])try{y(o,c.commentId,{author:c.author??t,text:c.text}),i++;}catch(m){n.push({operation:"reply",id:c.commentId,error:m.message});}for(let c of e.proposals??[])try{x(o,{...c,author:c.author??t}),p++;}catch(m){n.push({operation:"proposal",search:c.search,error:m.message});}return {accepted:s,rejected:a,commentsAdded:r,repliesAdded:i,proposalsAdded:p,errors:n}}var U=class o{constructor(e,t="AI",n){let s=n??e.originalBuffer,{originalBuffer:a,...r}=e;this.doc=structuredClone(r),s&&(this.doc.originalBuffer=s),this.author=t;}static async fromBuffer(e,t="AI"){let n=await w$1(e,{preloadFonts:false});return new o(n,t,e)}get body(){return this.doc.package.document}resolveAuthor(e){return e??this.author}getContent(e){return d(this.body,e)}getContentAsText(e$1){return e(d(this.body,e$1))}getChanges(e){return k$1(this.body,e)}getComments(e){return l(this.body,e)}addComment(e,t){let n=typeof e=="number"?{paragraphIndex:e,text:t,author:this.author}:{...e,author:this.resolveAuthor(e.author)};return g(this.body,n)}replyTo(e,t){let n=typeof t=="string"?{text:t,author:this.author}:{...t,author:this.resolveAuthor(t.author)};return y(this.body,e,n)}removeComment(e){E(this.body,e);}replace(e,t,n){let s=typeof e=="number"?{paragraphIndex:e,search:t,replaceWith:n,author:this.author}:{...e,author:this.resolveAuthor(e.author)};x(this.body,s);}proposeReplacement(e){this.replace(e);}proposeInsertion(e){H(this.body,{...e,author:this.resolveAuthor(e.author)});}proposeDeletion(e){L(this.body,{...e,author:this.resolveAuthor(e.author)});}acceptChange(e){C(this.body,e);}rejectChange(e){I(this.body,e);}acceptAll(){return k(this.body)}rejectAll(){return F(this.body)}applyReview(e){return N(this.body,e,this.author)}toDocument(){return this.doc}async toBuffer(){if(!this.doc.originalBuffer)throw new Error("Cannot create buffer: no original DOCX buffer was provided. Use DocxReviewer.fromBuffer() or pass originalBuffer to the constructor.");let{repackDocx:e}=await import('./headless-J5TF46GZ.mjs');return e(this.doc)}};export{U as a};
1
+ import {d,e,k as k$1,l,b,i,h,c,j,g as g$1,a}from'./chunk-EKCQF23W.mjs';import {w as w$1}from'./chunk-4UY5MI2V.mjs';function g(o,e){let{paragraphIndex:t,author:n="AI",text:s,search:a}=e,r=b(o,t),i$1=(o.comments??[]).map(m=>m.id),p=i$1.length>0?Math.max(...i$1)+1:1,c={id:p,author:n,date:new Date().toISOString(),content:[{type:"paragraph",content:[{type:"run",content:[{type:"text",text:s}]}],formatting:{}}]};if(o.comments||(o.comments=[]),o.comments.push(c),a){let m=i(r,a,t);r.content.splice(m.endRunIndex+1,0,{type:"commentRangeEnd",id:p}),r.content.splice(m.startRunIndex,0,{type:"commentRangeStart",id:p});}else r.content.unshift({type:"commentRangeStart",id:p}),r.content.push({type:"commentRangeEnd",id:p});return p}function y(o,e,t){let n=o.comments??[];if(!n.find(p=>p.id===e))throw new h(e);let a=n.map(p=>p.id),r=Math.max(...a)+1,i={id:r,author:t.author??"AI",date:new Date().toISOString(),parentId:e,content:[{type:"paragraph",content:[{type:"run",content:[{type:"text",text:t.text}]}],formatting:{}}]};return n.push(i),r}function E(o,e){let t=o.comments??[],n=t.find(r=>r.id===e);if(!n)throw new h(e);let s=n.parentId!==void 0,a=new Set([e]);if(!s)for(let r of t)r.parentId===e&&a.add(r.id);o.comments=t.filter(r=>!a.has(r.id)),!s&&c(o,r=>{for(let i=r.content.length-1;i>=0;i--){let p=r.content[i];(p.type==="commentRangeStart"||p.type==="commentRangeEnd")&&p.id===e&&r.content.splice(i,1);}});}function C(o,e){if(!W(o,e,"accept"))throw new g$1(e)}function I(o,e){if(!W(o,e,"reject"))throw new g$1(e)}function k(o){return M(o,"accept")}function F(o){return M(o,"reject")}function M(o,e){let t=0;return c(o,n=>{for(let s=n.content.length-1;s>=0;s--){let a$1=n.content[s];a(a$1)&&(G(n,s,a$1,e),t++);}}),t}function W(o,e,t){let n=false;return c(o,s=>{for(let a$1=s.content.length-1;a$1>=0;a$1--){let r=s.content[a$1];a(r)&&r.info.id===e&&(G(s,a$1,r,t),n=true);}if(n)return false}),n}function G(o,e,t,n){if(t.type==="insertion"&&n==="accept"||t.type==="deletion"&&n==="reject"||t.type==="moveTo"&&n==="accept"||t.type==="moveFrom"&&n==="reject"){let a=t.content;o.content.splice(e,1,...a);}else o.content.splice(e,1);}function x(o,e){let{paragraphIndex:t,search:n,author:s="AI",replaceWith:a}=e,r=b(o,t),{startIndex:i,endIndex:p}=j(r,n,t),c=new Date().toISOString(),m=w(o),h=r.content.slice(i,p+1),R={type:"deletion",info:{id:m,author:s,date:c},content:h},v={type:"insertion",info:{id:m+1,author:s,date:c},content:[{type:"run",content:[{type:"text",text:a}]}]};r.content.splice(i,p-i+1,R,v);}function H(o,e){let{paragraphIndex:t,author:n="AI",insertText:s,position:a="after",search:r}=e,i=b(o,t),p=new Date().toISOString(),m={type:"insertion",info:{id:w(o),author:n,date:p},content:[{type:"run",content:[{type:"text",text:s}]}]};if(r){let{startIndex:h,endIndex:R}=j(i,r,t),v=a==="after"?R+1:h;i.content.splice(v,0,m);}else a==="before"?i.content.unshift(m):i.content.push(m);}function L(o,e){let{paragraphIndex:t,search:n,author:s="AI"}=e,a=b(o,t),{startIndex:r,endIndex:i}=j(a,n,t),p=new Date().toISOString(),c=w(o),m=a.content.slice(r,i+1),h={type:"deletion",info:{id:c,author:s,date:p},content:m};a.content.splice(r,i-r+1,h);}var S=new WeakMap;function w(o){let e=S.get(o);e===void 0&&(e=0,c(o,n=>{for(let s of n.content)a(s)&&(e=Math.max(e,s.info.id));}));let t=e+1;return S.set(o,t+1),t}function N(o,e,t="AI"){let n=[],s=0,a=0,r=0,i=0,p=0;for(let c of e.accept??[])try{C(o,c),s++;}catch(m){n.push({operation:"accept",id:c,error:m.message});}for(let c of e.reject??[])try{I(o,c),a++;}catch(m){n.push({operation:"reject",id:c,error:m.message});}for(let c of e.comments??[])try{g(o,{...c,author:c.author??t}),r++;}catch(m){n.push({operation:"comment",search:c.search,error:m.message});}for(let c of e.replies??[])try{y(o,c.commentId,{author:c.author??t,text:c.text}),i++;}catch(m){n.push({operation:"reply",id:c.commentId,error:m.message});}for(let c of e.proposals??[])try{x(o,{...c,author:c.author??t}),p++;}catch(m){n.push({operation:"proposal",search:c.search,error:m.message});}return {accepted:s,rejected:a,commentsAdded:r,repliesAdded:i,proposalsAdded:p,errors:n}}var U=class o{constructor(e,t="AI",n){let s=n??e.originalBuffer,{originalBuffer:a,...r}=e;this.doc=structuredClone(r),s&&(this.doc.originalBuffer=s),this.author=t;}static async fromBuffer(e,t="AI"){let n=await w$1(e,{preloadFonts:false});return new o(n,t,e)}get body(){return this.doc.package.document}resolveAuthor(e){return e??this.author}getContent(e){return d(this.body,e)}getContentAsText(e$1){return e(d(this.body,e$1))}getChanges(e){return k$1(this.body,e)}getComments(e){return l(this.body,e)}addComment(e,t){let n=typeof e=="number"?{paragraphIndex:e,text:t,author:this.author}:{...e,author:this.resolveAuthor(e.author)};return g(this.body,n)}replyTo(e,t){let n=typeof t=="string"?{text:t,author:this.author}:{...t,author:this.resolveAuthor(t.author)};return y(this.body,e,n)}removeComment(e){E(this.body,e);}replace(e,t,n){let s=typeof e=="number"?{paragraphIndex:e,search:t,replaceWith:n,author:this.author}:{...e,author:this.resolveAuthor(e.author)};x(this.body,s);}proposeReplacement(e){this.replace(e);}proposeInsertion(e){H(this.body,{...e,author:this.resolveAuthor(e.author)});}proposeDeletion(e){L(this.body,{...e,author:this.resolveAuthor(e.author)});}acceptChange(e){C(this.body,e);}rejectChange(e){I(this.body,e);}acceptAll(){return k(this.body)}rejectAll(){return F(this.body)}applyReview(e){return N(this.body,e,this.author)}toDocument(){return this.doc}async toBuffer(){if(!this.doc.originalBuffer)throw new Error("Cannot create buffer: no original DOCX buffer was provided. Use DocxReviewer.fromBuffer() or pass originalBuffer to the constructor.");let{repackDocx:e}=await import('./headless-2IWI27NG.mjs');return e(this.doc)}};export{U as a};