@eigenpal/docx-js-editor 0.0.6 → 0.0.7

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.
Files changed (42) hide show
  1. package/README.md +9 -1
  2. package/dist/{chunk-H2UMX5CK.js → chunk-AEANV5BR.js} +6 -6
  3. package/dist/chunk-CDSUWDYP.cjs +11 -0
  4. package/dist/chunk-NZ7XUW4I.cjs +1 -0
  5. package/dist/{chunk-FXILBPZI.cjs → chunk-PYAIJMEG.cjs} +6 -6
  6. package/dist/{chunk-AOL255XD.js → chunk-VFBM3YKJ.js} +2 -2
  7. package/dist/chunk-W2TDS3UO.js +1 -0
  8. package/dist/{chunk-D2GERZ7M.cjs → chunk-ZRXLWSRP.cjs} +2 -2
  9. package/dist/chunk-ZZNWTYMW.js +11 -0
  10. package/dist/{colorResolver-DrNkos_H.d.ts → colorResolver-CQcFBxHC.d.ts} +27 -7
  11. package/dist/{colorResolver-WsUxFs5p.d.cts → colorResolver-Di-JRsr9.d.cts} +27 -7
  12. package/dist/core-plugins.cjs +1 -1
  13. package/dist/core-plugins.d.cts +3 -3
  14. package/dist/core-plugins.d.ts +3 -3
  15. package/dist/core-plugins.js +1 -1
  16. package/dist/headless.cjs +2 -2
  17. package/dist/headless.d.cts +4 -4
  18. package/dist/headless.d.ts +4 -4
  19. package/dist/headless.js +1 -1
  20. package/dist/index.cjs +25 -25
  21. package/dist/index.d.cts +60 -8
  22. package/dist/index.d.ts +60 -8
  23. package/dist/index.js +25 -25
  24. package/dist/mcp-cli.js +17 -17
  25. package/dist/mcp.cjs +2 -2
  26. package/dist/mcp.d.cts +1 -1
  27. package/dist/mcp.d.ts +1 -1
  28. package/dist/mcp.js +2 -2
  29. package/dist/{registry-BWDZlJx6.d.cts → registry-CrAzNdUO.d.cts} +1 -1
  30. package/dist/{registry-DifIQR1O.d.ts → registry-aux2uuQs.d.ts} +1 -1
  31. package/dist/selectionRects-5TGQE33Q.cjs +1 -0
  32. package/dist/selectionRects-JSPKYXPU.js +1 -0
  33. package/dist/styles.css +1 -1
  34. package/dist/{types-XVRXTi4o.d.cts → types-BnShY2aQ.d.cts} +2 -0
  35. package/dist/{types-XVRXTi4o.d.ts → types-BnShY2aQ.d.ts} +2 -0
  36. package/package.json +1 -1
  37. package/dist/chunk-BBGDBZJY.cjs +0 -1
  38. package/dist/chunk-DQHQWQHL.cjs +0 -11
  39. package/dist/chunk-HGOIKOKZ.js +0 -1
  40. package/dist/chunk-I2C6ENCR.js +0 -11
  41. package/dist/selectionRects-M7QY6HKR.cjs +0 -1
  42. package/dist/selectionRects-O6YQMMCP.js +0 -1
@@ -0,0 +1,11 @@
1
+ import Zt from'jszip';import {xml2js,js2xml}from'xml-js';var _=new Set,ne=new Map,ye=new Set,be=false;function Pe(e,t=[400,700],n=["normal","italic"]){let o=encodeURIComponent(e),r=[];for(let a of n){let c=a==="italic"?1:0;for(let f of t)r.push(`${c},${f}`);}r.sort();let i=r.join(";");return `https://fonts.googleapis.com/css2?family=${o}:ital,wght@${i}&display=swap`}async function Ae(e,t){let n=e.trim();if(_.has(n))return true;let o=ne.get(n);if(o)return o;let r=(async()=>{be=true;try{let i=Pe(n,t?.weights,t?.styles),a=document.createElement("link");return a.rel="stylesheet",a.href=i,await new Promise(f=>{a.onload=()=>f(!0),a.onerror=()=>f(!1),document.head.appendChild(a),setTimeout(()=>f(!1),5e3);})?(await Ne(n,3e3),_.add(n),Be([n]),!0):!1}catch(i){return console.warn(`Failed to load font "${n}":`,i),false}finally{ne.delete(n),ne.size===0&&(be=false);}})();return ne.set(n,r),r}async function Vt(e,t){let n=e.filter(o=>!_.has(o.trim()));n.length!==0&&await Promise.all(n.map(o=>Ae(o,t)));}function Io(e){return _.has(e.trim())}function Lo(){return be}function Do(){return Array.from(_)}function Ho(e){return ye.add(e),()=>{ye.delete(e);}}function Be(e){for(let t of ye)try{t(e);}catch(n){console.warn("Font load callback error:",n);}}async function Ne(e,t){if("fonts"in document)try{let n=`400 16px "${e}"`;return await Promise.race([document.fonts.load(n),new Promise(o=>setTimeout(o,t))]),document.fonts.check(n)}catch{}return await new Promise(n=>setTimeout(n,100)),true}function Oo(e,t="sans-serif"){if(typeof document>"u")return false;let n=(r,i)=>{let c=document.createElement("canvas").getContext("2d");if(!c)return false;c.textBaseline="top";let f="abcdefghijklmnopqrstuvwxyz0123456789";c.font=`72px ${i}`;let u=c.measureText(f).width;return c.font=`72px "${r}", ${i}`,c.measureText(f).width!==u};return n(e,t)?true:n(e,t==="sans-serif"?"serif":"sans-serif")}async function jo(e,t,n){let o=e.trim();if(_.has(o))return true;try{let r=new Blob([t],{type:"font/ttf"}),i=URL.createObjectURL(r),a=document.createElement("style");return a.textContent=`
2
+ @font-face {
3
+ font-family: "${o}";
4
+ src: url(${i}) format('truetype');
5
+ font-weight: ${n?.weight??"normal"};
6
+ font-style: ${n?.style??"normal"};
7
+ font-display: swap;
8
+ }
9
+ `,document.head.appendChild(a),await Ne(o,3e3),_.add(o),Be([o]),!0}catch(r){return console.warn(`Failed to load font "${o}" from buffer:`,r),false}}var zt={Calibri:"Carlito",Cambria:"Caladea",Arial:"Arimo","Times New Roman":"Tinos","Courier New":"Cousine",Garamond:"EB Garamond","Book Antiqua":"EB Garamond",Georgia:"Tinos",Verdana:"Open Sans",Tahoma:"Open Sans","Trebuchet MS":"Source Sans Pro","Century Gothic":"Poppins","Franklin Gothic":"Libre Franklin",Palatino:"EB Garamond","Palatino Linotype":"EB Garamond","Lucida Sans":"Open Sans","Segoe UI":"Open Sans",Impact:"Anton","Comic Sans MS":"Comic Neue",Consolas:"Inconsolata","Lucida Console":"Inconsolata",Monaco:"Fira Code"};function Ut(e){let t=e.trim();return zt[t]||t}async function $t(e){let t=e.trim(),n=Ut(t);return n!==t?(await _t(t,n),_.add(t),_.add(n),true):Ae(n)}async function _t(e,t){let n=`font-alias-${e.toLowerCase().replace(/\s+/g,"-")}`;if(!document.getElementById(n))try{let o=Pe(t,[400,700],["normal","italic"]),r=await fetch(o);if(!r.ok){console.warn(`Failed to fetch Google Fonts CSS for "${t}": ${r.status}`);return}let i=await r.text(),a=new RegExp(`font-family:\\s*['"]${Gt(t)}['"]`,"gi"),c=i.replace(a,`font-family: '${e}'`),f=document.createElement("style");f.id=n,f.textContent=c,document.head.appendChild(f);}catch(o){console.warn(`Failed to create font alias for "${e}":`,o);}}function Gt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async function xe(e){let t=[...new Set(e.map(n=>n.trim()))];await Promise.all(t.map(n=>$t(n)));}async function Wo(){await Vt(["Carlito","Caladea","Arimo","Tinos","Cousine","EB Garamond"]);}function qt(e){let t=new Set,n=e;if(!n?.package)return t;let o=n.package?.document?.content;if(Array.isArray(o)){for(let i of o)if(i?.type==="paragraph"&&Array.isArray(i.content)){for(let a of i.content)if(a?.type==="run"&&a.formatting?.fontFamily){let{ascii:c,hAnsi:f}=a.formatting.fontFamily;c&&t.add(c),f&&f!==c&&t.add(f);}}}let r=n.package?.styles?.styles;if(Array.isArray(r)){for(let i of r)if(i?.runProperties?.fontFamily){let{ascii:a,hAnsi:c}=i.runProperties.fontFamily;a&&t.add(a),c&&c!==a&&t.add(c);}}return t}async function Vo(e){let t=qt(e);t.size!==0&&await xe(Array.from(t));}async function Xe(e){if(e instanceof ArrayBuffer)return e;if(e instanceof Uint8Array){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),t}if(e instanceof Blob)return e.arrayBuffer();throw new TypeError(`Unsupported DocxInput type: ${typeof e}`)}async function Ie(e){let t=await Zt.loadAsync(e),n={documentXml:null,stylesXml:null,themeXml:null,numberingXml:null,fontTableXml:null,settingsXml:null,webSettingsXml:null,headers:new Map,footers:new Map,footnotesXml:null,endnotesXml:null,commentsXml:null,documentRels:null,packageRels:null,contentTypesXml:null,corePropsXml:null,appPropsXml:null,customPropsXml:null,media:new Map,fonts:new Map,allXml:new Map,originalZip:t,originalBuffer:e};for(let[o,r]of Object.entries(t.files)){if(r.dir)continue;let i=o.toLowerCase();if(i.endsWith(".xml")||i.endsWith(".rels")){let a=await r.async("text");if(n.allXml.set(o,a),i==="word/document.xml")n.documentXml=a;else if(i==="word/styles.xml")n.stylesXml=a;else if(i==="word/theme/theme1.xml")n.themeXml=a;else if(i==="word/numbering.xml")n.numberingXml=a;else if(i==="word/fonttable.xml")n.fontTableXml=a;else if(i==="word/settings.xml")n.settingsXml=a;else if(i==="word/websettings.xml")n.webSettingsXml=a;else if(i==="word/footnotes.xml")n.footnotesXml=a;else if(i==="word/endnotes.xml")n.endnotesXml=a;else if(i==="word/comments.xml")n.commentsXml=a;else if(i==="word/_rels/document.xml.rels")n.documentRels=a;else if(i==="_rels/.rels")n.packageRels=a;else if(i==="[content_types].xml")n.contentTypesXml=a;else if(i==="docprops/core.xml")n.corePropsXml=a;else if(i==="docprops/app.xml")n.appPropsXml=a;else if(i==="docprops/custom.xml")n.customPropsXml=a;else if(i.match(/^word\/header\d+\.xml$/)){let c=o.split("/").pop()||o;n.headers.set(c,a);}else if(i.match(/^word\/footer\d+\.xml$/)){let c=o.split("/").pop()||o;n.footers.set(c,a);}}else if(i.startsWith("word/media/")){let a=await r.async("arraybuffer");n.media.set(o,a);}else if(i.startsWith("word/fonts/")){let a=await r.async("arraybuffer");n.fonts.set(o,a);}}return n}function Le(e){switch(e.toLowerCase().split(".").pop()){case "png":return "image/png";case "jpg":case "jpeg":return "image/jpeg";case "gif":return "image/gif";case "bmp":return "image/bmp";case "tif":case "tiff":return "image/tiff";case "wmf":return "image/x-wmf";case "emf":return "image/x-emf";case "svg":return "image/svg+xml";case "webp":return "image/webp";default:return "application/octet-stream"}}function V(e){return xml2js(e,{compact:false,ignoreComment:true,ignoreInstruction:true,ignoreDoctype:true,alwaysArray:false,trim:false,captureSpacesBetweenElements:true,attributesKey:"attributes",textKey:"text"})}function De(e){return js2xml({elements:[e]},{compact:false,spaces:0})}function G(e){try{let t=V(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 oe(e){let t=e.indexOf(":");return t>=0?e.substring(t+1):e}function l(e,t,n){if(!e||!e.elements)return null;let o=`${t}:${n}`;for(let r of e.elements)if(r.type==="element"&&(r.name===o||oe(r.name||"")===n))return r;return null}function N(e,t,n){if(!e||!e.elements)return [];let o=`${t}:${n}`,r=[];for(let i of e.elements)i.type==="element"&&(i.name===o||oe(i.name||"")===n)&&r.push(i);return r}function H(e){return !e||!e.elements?[]:e.elements.filter(t=>t.type==="element")}function s(e,t,n){if(!e||!e.attributes)return null;let o=e.attributes;if(t){let r=`${t}:${n}`;if(r in o)return o[r]}return n in o?o[n]:null}function re(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+=re(n));return t}function g(e,t,n,o=1){let r=s(e,t,n);if(r===null)return;let i=parseInt(r,10);if(!isNaN(i))return i*o}function T(e,t="w"){if(!e)return false;let n=s(e,t,"val");return n===null?true:!(n==="0"||n==="false"||n==="off")}var ie={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"};function ae(e){let t=new Map;if(!e||e.trim().length===0)return t;let n=G(e);if(!n)return console.warn("Failed to parse relationships XML"),t;let o=H(n);for(let r of o){let i=r.name||"";if(!i.endsWith("Relationship")&&!i.includes(":Relationship"))continue;let a=s(r,null,"Id"),c=s(r,null,"Type"),f=s(r,null,"Target"),u=s(r,null,"TargetMode");if(!a||!c||!f){console.warn("Relationship missing required attributes:",{id:a,type:c,target:f});continue}let d={id:a,type:c,target:f};u==="External"?d.targetMode="External":u==="Internal"&&(d.targetMode="Internal"),t.set(a,d);}return t}function He(e){return e.type===ie.hyperlink&&e.targetMode==="External"}var We={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},se={majorFont:{latin:"Calibri Light",ea:"",cs:"",fonts:{}},minorFont:{latin:"Calibri",ea:"",cs:"",fonts:{}}},Te={name:"Office Theme",colorScheme:We,fontScheme:se},Jt=["dk1","lt1","dk2","lt2","accent1","accent2","accent3","accent4","accent5","accent6","hlink","folHlink"];function Qt(e){if(!e)return null;switch(oe(e.name||"")){case "srgbClr":return s(e,"a","val")??s(e,null,"val")??null;case "sysClr":{let n=s(e,"a","lastClr")??s(e,null,"lastClr");if(n)return n;switch(s(e,"a","val")??s(e,null,"val")){case "windowText":case "menuText":case "captionText":case "btnText":return "000000";case "window":case "menu":case "btnFace":case "btnHighlight":return "FFFFFF";case "highlight":return "0078D7";case "highlightText":return "FFFFFF";case "grayText":return "808080";default:return null}}case "schemeClr":{s(e,"a","val")??s(e,null,"val");return null}default:return null}}function en(e){let t={...We};if(!e)return t;for(let n of Jt){let o=l(e,"a",n);if(o){let r=H(o);if(r.length>0){let i=Qt(r[0]);i&&(t[n]=i);}}}return t}function Oe(e){let t={latin:"",ea:"",cs:"",fonts:{}};if(!e)return t;let n=l(e,"a","latin");n&&(t.latin=s(n,"a","typeface")??s(n,null,"typeface")??"");let o=l(e,"a","ea");o&&(t.ea=s(o,"a","typeface")??s(o,null,"typeface")??"");let r=l(e,"a","cs");r&&(t.cs=s(r,"a","typeface")??s(r,null,"typeface")??"");let i=N(e,"a","font");for(let a of i){let c=s(a,"a","script")??s(a,null,"script"),f=s(a,"a","typeface")??s(a,null,"typeface");c&&f&&(t.fonts=t.fonts||{},t.fonts[c]=f);}return t}function tn(e){let t={...se};if(!e)return t;let n=l(e,"a","majorFont");n&&(t.majorFont=Oe(n));let o=l(e,"a","minorFont");return o&&(t.minorFont=Oe(o)),t}function Ve(e){if(!e)return {...Te};try{let t=G(e);if(!t)return {...Te};let n=s(t,"a","name")??s(t,null,"name")??"Office Theme",o=l(t,"a","themeElements"),r=l(o,"a","clrScheme"),i=en(r),a=l(o,"a","fontScheme"),c=tn(a);return {name:n,colorScheme:i,fontScheme:c}}catch(t){return console.warn("Failed to parse theme:",t),{...Te}}}function nn(e,t="latin"){if(!e?.fontScheme?.majorFont)return se.majorFont?.latin??"Calibri Light";let n=e.fontScheme.majorFont;return t==="latin"?n.latin||"Calibri Light":t==="ea"?n.ea||"":t==="cs"?n.cs||"":n.fonts?.[t]?n.fonts[t]:n.latin||"Calibri Light"}function je(e,t="latin"){if(!e?.fontScheme?.minorFont)return se.minorFont?.latin??"Calibri";let n=e.fontScheme.minorFont;return t==="latin"?n.latin||"Calibri":t==="ea"?n.ea||"":t==="cs"?n.cs||"":n.fonts?.[t]?n.fonts[t]:n.latin||"Calibri"}function $(e,t){if(!t)return "Calibri";let n=t.toLowerCase().includes("major"),o=t.toLowerCase().includes("minor"),r="latin",i=t.toLowerCase();return i.includes("eastasia")?r="ea":(i.includes("bidi")||i.includes("cs"))&&(r="cs"),n?nn(e,r):o?je(e,r):je(e,"latin")}function le(e,t){if(!e)return;let n={},o=l(e,"w","b");o&&(n.bold=T(o));let r=l(e,"w","bCs");r&&(n.boldCs=T(r));let i=l(e,"w","i");i&&(n.italic=T(i));let a=l(e,"w","iCs");a&&(n.italicCs=T(a));let c=l(e,"w","u");if(c){let M=s(c,"w","val");if(M){n.underline={style:M};let S=s(c,"w","color"),L=s(c,"w","themeColor");(S||L)&&(n.underline.color=Fe(S,L,s(c,"w","themeTint"),s(c,"w","themeShade")));}}let f=l(e,"w","strike");f&&(n.strike=T(f));let u=l(e,"w","dstrike");u&&(n.doubleStrike=T(u));let d=l(e,"w","vertAlign");if(d){let M=s(d,"w","val");(M==="superscript"||M==="subscript"||M==="baseline")&&(n.vertAlign=M);}let m=l(e,"w","smallCaps");m&&(n.smallCaps=T(m));let y=l(e,"w","caps");y&&(n.allCaps=T(y));let b=l(e,"w","vanish");b&&(n.hidden=T(b));let p=l(e,"w","color");p&&(n.color=Fe(s(p,"w","val"),s(p,"w","themeColor"),s(p,"w","themeTint"),s(p,"w","themeShade")));let x=l(e,"w","highlight");if(x){let M=s(x,"w","val");M&&(n.highlight=M);}let A=l(e,"w","shd");A&&(n.shading=ce(A));let E=l(e,"w","sz");if(E){let M=g(E,"w","val");M!==void 0&&(n.fontSize=M);}let R=l(e,"w","szCs");if(R){let M=g(R,"w","val");M!==void 0&&(n.fontSizeCs=M);}let C=l(e,"w","rFonts");if(C){n.fontFamily={ascii:s(C,"w","ascii")??void 0,hAnsi:s(C,"w","hAnsi")??void 0,eastAsia:s(C,"w","eastAsia")??void 0,cs:s(C,"w","cs")??void 0};let M=s(C,"w","asciiTheme");M&&(n.fontFamily.asciiTheme=M,t&&!n.fontFamily.ascii&&(n.fontFamily.ascii=$(t,M)));let S=s(C,"w","hAnsiTheme");S&&(n.fontFamily.hAnsiTheme=S,t&&!n.fontFamily.hAnsi&&(n.fontFamily.hAnsi=$(t,S)));let L=s(C,"w","eastAsiaTheme");L&&(n.fontFamily.eastAsiaTheme=L,t&&!n.fontFamily.eastAsia&&(n.fontFamily.eastAsia=$(t,L)));let U=s(C,"w","cstheme");U&&(n.fontFamily.csTheme=U,t&&!n.fontFamily.cs&&(n.fontFamily.cs=$(t,U)));}let h=l(e,"w","spacing");if(h){let M=g(h,"w","val");M!==void 0&&(n.spacing=M);}let F=l(e,"w","position");if(F){let M=g(F,"w","val");M!==void 0&&(n.position=M);}let w=l(e,"w","w");if(w){let M=g(w,"w","val");M!==void 0&&(n.scale=M);}let k=l(e,"w","kern");if(k){let M=g(k,"w","val");M!==void 0&&(n.kerning=M);}let v=l(e,"w","effect");if(v){let M=s(v,"w","val");M&&(n.effect=M);}let P=l(e,"w","em");if(P){let M=s(P,"w","val");M&&(n.emphasisMark=M);}let B=l(e,"w","emboss");B&&(n.emboss=T(B));let X=l(e,"w","imprint");X&&(n.imprint=T(X));let j=l(e,"w","outline");j&&(n.outline=T(j));let K=l(e,"w","shadow");K&&(n.shadow=T(K));let Y=l(e,"w","rtl");Y&&(n.rtl=T(Y));let D=l(e,"w","cs");D&&(n.cs=T(D));let O=l(e,"w","rStyle");if(O){let M=s(O,"w","val");M&&(n.styleId=M);}return Object.keys(n).length>0?n:void 0}function Fe(e,t,n,o){let r={};return e&&e!=="auto"?r.rgb=e:e==="auto"&&(r.auto=true),t&&(r.themeColor=t),n&&(r.themeTint=n),o&&(r.themeShade=o),r}function ce(e){if(!e)return;let t={},n=s(e,"w","color");n&&n!=="auto"&&(t.color={rgb:n});let o=s(e,"w","fill");o&&o!=="auto"&&(t.fill={rgb:o});let r=s(e,"w","themeFill");r&&(t.fill=t.fill||{},t.fill.themeColor=r);let i=s(e,"w","themeFillTint");i&&t.fill&&(t.fill.themeTint=i);let a=s(e,"w","themeFillShade");a&&t.fill&&(t.fill.themeShade=a);let c=s(e,"w","val");return c&&(t.pattern=c),Object.keys(t).length>0?t:void 0}function W(e){if(!e)return;let t=s(e,"w","val");if(!t)return;let n={style:t},o=s(e,"w","color"),r=s(e,"w","themeColor");(o||r)&&(n.color=Fe(o,r,s(e,"w","themeTint"),s(e,"w","themeShade")));let i=g(e,"w","sz");i!==void 0&&(n.size=i);let a=g(e,"w","space");a!==void 0&&(n.space=a);let c=s(e,"w","shadow");c&&(n.shadow=c==="1"||c==="true");let f=s(e,"w","frame");return f&&(n.frame=f==="1"||f==="true"),n}function on(e){if(!e)return;let t=N(e,"w","tab");if(t.length===0)return;let n=[];for(let o of t){let r=g(o,"w","pos"),i=s(o,"w","val");if(r!==void 0&&i){let a={position:r,alignment:i},c=s(o,"w","leader");c&&(a.leader=c),n.push(a);}}return n.length>0?n:void 0}function Ce(e,t){if(!e)return;let n={},o=l(e,"w","jc");if(o){let h=s(o,"w","val");h&&(n.alignment=h);}let r=l(e,"w","bidi");r&&(n.bidi=T(r));let i=l(e,"w","spacing");if(i){let h=g(i,"w","before");h!==void 0&&(n.spaceBefore=h);let F=g(i,"w","after");F!==void 0&&(n.spaceAfter=F);let w=g(i,"w","line");w!==void 0&&(n.lineSpacing=w);let k=s(i,"w","lineRule");k&&(n.lineSpacingRule=k);let v=s(i,"w","beforeAutospacing");v&&(n.beforeAutospacing=v==="1"||v==="true");let P=s(i,"w","afterAutospacing");P&&(n.afterAutospacing=P==="1"||P==="true");}let a=l(e,"w","ind");if(a){let h=g(a,"w","left");h!==void 0&&(n.indentLeft=h);let F=g(a,"w","right");F!==void 0&&(n.indentRight=F);let w=g(a,"w","firstLine");w!==void 0&&(n.indentFirstLine=w);let k=g(a,"w","hanging");k!==void 0&&(n.indentFirstLine=-k,n.hangingIndent=true);}let c=l(e,"w","pBdr");if(c){let h={},F=W(l(c,"w","top"));F&&(h.top=F);let w=W(l(c,"w","bottom"));w&&(h.bottom=w);let k=W(l(c,"w","left"));k&&(h.left=k);let v=W(l(c,"w","right"));v&&(h.right=v);let P=W(l(c,"w","between"));P&&(h.between=P);let B=W(l(c,"w","bar"));B&&(h.bar=B),Object.keys(h).length>0&&(n.borders=h);}let f=l(e,"w","shd");f&&(n.shading=ce(f));let u=l(e,"w","tabs");u&&(n.tabs=on(u));let d=l(e,"w","keepNext");d&&(n.keepNext=T(d));let m=l(e,"w","keepLines");m&&(n.keepLines=T(m));let y=l(e,"w","widowControl");y&&(n.widowControl=T(y));let b=l(e,"w","pageBreakBefore");b&&(n.pageBreakBefore=T(b));let p=l(e,"w","numPr");if(p){let h=l(p,"w","numId"),F=l(p,"w","ilvl");if(h||F){if(n.numPr={},h){let w=g(h,"w","val");w!==void 0&&(n.numPr.numId=w);}if(F){let w=g(F,"w","val");w!==void 0&&(n.numPr.ilvl=w);}}}let x=l(e,"w","outlineLvl");if(x){let h=g(x,"w","val");h!==void 0&&(n.outlineLevel=h);}let A=l(e,"w","pStyle");if(A){let h=s(A,"w","val");h&&(n.styleId=h);}let E=l(e,"w","suppressLineNumbers");E&&(n.suppressLineNumbers=T(E));let R=l(e,"w","suppressAutoHyphens");R&&(n.suppressAutoHyphens=T(R));let C=l(e,"w","rPr");return C&&(n.runProperties=le(C,t)),Object.keys(n).length>0?n:void 0}function q(e){if(!e)return;let t=g(e,"w","w"),n=s(e,"w","type");if(t!==void 0&&n)return {value:t,type:n}}function _e(e){if(!e)return;let t={},n=W(l(e,"w","top"));n&&(t.top=n);let o=W(l(e,"w","bottom"));o&&(t.bottom=o);let r=W(l(e,"w","left"));r&&(t.left=r);let i=W(l(e,"w","right"));i&&(t.right=i);let a=W(l(e,"w","insideH"));a&&(t.insideH=a);let c=W(l(e,"w","insideV"));return c&&(t.insideV=c),Object.keys(t).length>0?t:void 0}function Ge(e){if(!e)return;let t={},n=q(l(e,"w","top"));n&&(t.top=n);let o=q(l(e,"w","bottom"));o&&(t.bottom=o);let r=q(l(e,"w","left"));r&&(t.left=r);let i=q(l(e,"w","right"));return i&&(t.right=i),Object.keys(t).length>0?t:void 0}function rn(e){if(!e)return;let t={},n=s(e,"w","val");if(n){let u=parseInt(n,16);isNaN(u)||(t.firstRow=(u&32)!==0,t.lastRow=(u&64)!==0,t.firstColumn=(u&128)!==0,t.lastColumn=(u&256)!==0,t.noHBand=(u&512)!==0,t.noVBand=(u&1024)!==0);}let o=s(e,"w","firstColumn");o&&(t.firstColumn=o==="1");let r=s(e,"w","firstRow");r&&(t.firstRow=r==="1");let i=s(e,"w","lastColumn");i&&(t.lastColumn=i==="1");let a=s(e,"w","lastRow");a&&(t.lastRow=a==="1");let c=s(e,"w","noHBand");c&&(t.noHBand=c==="1");let f=s(e,"w","noVBand");return f&&(t.noVBand=f==="1"),Object.keys(t).length>0?t:void 0}function ze(e,t){if(!e)return;let n={},o=l(e,"w","tblW");o&&(n.width=q(o));let r=l(e,"w","jc");if(r){let p=s(r,"w","val");(p==="left"||p==="center"||p==="right")&&(n.justification=p);}let i=l(e,"w","tblCellSpacing");i&&(n.cellSpacing=q(i));let a=l(e,"w","tblInd");a&&(n.indent=q(a));let c=l(e,"w","tblBorders");c&&(n.borders=_e(c));let f=l(e,"w","tblCellMar");f&&(n.cellMargins=Ge(f));let u=l(e,"w","tblLayout");if(u){let p=s(u,"w","type");(p==="fixed"||p==="autofit")&&(n.layout=p);}let d=l(e,"w","tblStyle");if(d){let p=s(d,"w","val");p&&(n.styleId=p);}let m=l(e,"w","tblLook");m&&(n.look=rn(m));let y=l(e,"w","shd");y&&(n.shading=ce(y));let b=l(e,"w","bidiVisual");return b&&(n.bidi=T(b)),Object.keys(n).length>0?n:void 0}function Ue(e){if(!e)return;let t={},n=l(e,"w","trHeight");if(n){t.height=q(n);let c=s(n,"w","hRule");c&&(t.heightRule=c);}let o=l(e,"w","tblHeader");o&&(t.header=T(o));let r=l(e,"w","cantSplit");r&&(t.cantSplit=T(r));let i=l(e,"w","jc");if(i){let c=s(i,"w","val");(c==="left"||c==="center"||c==="right")&&(t.justification=c);}let a=l(e,"w","hidden");return a&&(t.hidden=T(a)),Object.keys(t).length>0?t:void 0}function $e(e,t){if(!e)return;let n={},o=l(e,"w","tcW");o&&(n.width=q(o));let r=l(e,"w","tcBorders");r&&(n.borders=_e(r));let i=l(e,"w","tcMar");i&&(n.margins=Ge(i));let a=l(e,"w","shd");a&&(n.shading=ce(a));let c=l(e,"w","vAlign");if(c){let p=s(c,"w","val");(p==="top"||p==="center"||p==="bottom")&&(n.verticalAlign=p);}let f=l(e,"w","textDirection");if(f){let p=s(f,"w","val");p&&(n.textDirection=p);}let u=l(e,"w","gridSpan");if(u){let p=g(u,"w","val");p!==void 0&&(n.gridSpan=p);}let d=l(e,"w","vMerge");if(d){let p=s(d,"w","val");n.vMerge=p==="restart"?"restart":"continue";}let m=l(e,"w","tcFitText");m&&(n.fitText=T(m));let y=l(e,"w","noWrap");y&&(n.noWrap=T(y));let b=l(e,"w","hideMark");return b&&(n.hideMark=T(b)),Object.keys(n).length>0?n:void 0}function an(e,t){let n={styleId:s(e,"w","styleId")??"",type:s(e,"w","type")??"paragraph"},o=s(e,"w","default");o&&(n.default=o==="1"||o==="true");let r=l(e,"w","name");r&&(n.name=s(r,"w","val")??void 0);let i=l(e,"w","basedOn");i&&(n.basedOn=s(i,"w","val")??void 0);let a=l(e,"w","next");a&&(n.next=s(a,"w","val")??void 0);let c=l(e,"w","link");c&&(n.link=s(c,"w","val")??void 0);let f=l(e,"w","uiPriority");if(f){let h=g(f,"w","val");h!==void 0&&(n.uiPriority=h);}let u=l(e,"w","hidden");u&&(n.hidden=T(u));let d=l(e,"w","semiHidden");d&&(n.semiHidden=T(d));let m=l(e,"w","unhideWhenUsed");m&&(n.unhideWhenUsed=T(m));let y=l(e,"w","qFormat");y&&(n.qFormat=T(y));let b=l(e,"w","personal");b&&(n.personal=T(b));let p=l(e,"w","pPr");p&&(n.pPr=Ce(p,t));let x=l(e,"w","rPr");x&&(n.rPr=le(x,t));let A=l(e,"w","tblPr");A&&(n.tblPr=ze(A));let E=l(e,"w","trPr");E&&(n.trPr=Ue(E));let R=l(e,"w","tcPr");R&&(n.tcPr=$e(R));let C=N(e,"w","tblStylePr");if(C.length>0){n.tblStylePr=[];for(let h of C){let F=s(h,"w","type");if(F){let w={type:F},k=l(h,"w","pPr");k&&(w.pPr=Ce(k,t));let v=l(h,"w","rPr");v&&(w.rPr=le(v,t));let P=l(h,"w","tblPr");P&&(w.tblPr=ze(P));let B=l(h,"w","trPr");B&&(w.trPr=Ue(B));let X=l(h,"w","tcPr");X&&(w.tcPr=$e(X)),n.tblStylePr.push(w);}}}return n}function sn(e,t){if(!e)return;let n={},o=l(e,"w","rPrDefault");if(o){let i=l(o,"w","rPr");i&&(n.rPr=le(i,t));}let r=l(e,"w","pPrDefault");if(r){let i=l(r,"w","pPr");i&&(n.pPr=Ce(i,t));}return n.rPr||n.pPr?n:void 0}function qe(e,t){if(!t)return e;if(!e)return t?{...t}:void 0;let n={...e};for(let o of Object.keys(t)){let r=t[o];r!==void 0&&(n[o]=typeof r=="object"&&r!==null?{...n[o]||{},...r}:r);}return n}function ln(e,t){if(!t)return e;if(!e)return t?{...t}:void 0;let n={...e};for(let o of Object.keys(t)){let r=t[o];if(r!==void 0)if(o==="runProperties")n.runProperties=qe(n.runProperties,t.runProperties);else if(o==="borders"||o==="numPr"||o==="frame"){let i=n[o],a=r;n[o]={...i||{},...a||{}};}else o==="tabs"&&Array.isArray(r)?n.tabs=[...r]:n[o]=r;}return n}function Ze(e,t,n,o=new Set){if(o.has(e.styleId)||(o.add(e.styleId),!e.basedOn))return e;let r=t.get(e.basedOn);if(!r)return e;let i=Ze(r,t,n,o),a={...e,pPr:ln(i.pPr,e.pPr),rPr:qe(i.rPr,e.rPr)};return e.type==="table"&&((i.tblPr||e.tblPr)&&(a.tblPr={...i.tblPr||{},...e.tblPr||{}}),(i.trPr||e.trPr)&&(a.trPr={...i.trPr||{},...e.trPr||{}}),(i.tcPr||e.tcPr)&&(a.tcPr={...i.tcPr||{},...e.tcPr||{}})),a}function Se(e,t){let n=new Map;try{let o=G(e);if(!o)return n;let r=N(o,"w","style");for(let i of r){let a=an(i,t);a.styleId&&n.set(a.styleId,a);}for(let[i,a]of n){let c=Ze(a,n,t);n.set(i,c);}}catch(o){console.warn("Failed to parse styles:",o);}return n}function Ye(e,t){let n={styles:[]};try{let o=G(e);if(!o)return n;let r=l(o,"w","docDefaults");n.docDefaults=sn(r,t);let i=l(o,"w","latentStyles");i&&(n.latentStyles={defLockedState:s(i,"w","defLockedState")==="1",defUIPriority:g(i,"w","defUIPriority"),defSemiHidden:s(i,"w","defSemiHidden")==="1",defUnhideWhenUsed:s(i,"w","defUnhideWhenUsed")==="1",defQFormat:s(i,"w","defQFormat")==="1",count:g(i,"w","count")});let a=Se(e,t);n.styles=Array.from(a.values());}catch(o){console.warn("Failed to parse style definitions:",o);}return n}function Ke(e){let t={abstractNums:[],nums:[]};if(!e)return ke(t);let n=G(e);if(!n)return ke(t);let o=N(n,"w","abstractNum");for(let i of o){let a=cn(i);a&&t.abstractNums.push(a);}let r=N(n,"w","num");for(let i of r){let a=fn(i);a&&t.nums.push(a);}return ke(t)}function cn(e){let t=s(e,"w","abstractNumId");if(t===null)return null;let n=parseInt(t,10);if(isNaN(n))return null;let o={abstractNumId:n,levels:[]},r=l(e,"w","multiLevelType");if(r){let u=s(r,"w","val");(u==="hybridMultilevel"||u==="multilevel"||u==="singleLevel")&&(o.multiLevelType=u);}let i=l(e,"w","name");i&&(o.name=s(i,"w","val")??void 0);let a=l(e,"w","numStyleLink");a&&(o.numStyleLink=s(a,"w","val")??void 0);let c=l(e,"w","styleLink");c&&(o.styleLink=s(c,"w","val")??void 0);let f=N(e,"w","lvl");for(let u of f){let d=Je(u);d&&o.levels.push(d);}return o.levels.sort((u,d)=>u.ilvl-d.ilvl),o}function fn(e){let t=s(e,"w","numId");if(t===null)return null;let n=parseInt(t,10);if(isNaN(n))return null;let o=l(e,"w","abstractNumId");if(!o)return null;let r=s(o,"w","val");if(r===null)return null;let i=parseInt(r,10);if(isNaN(i))return null;let a={numId:n,abstractNumId:i},c=N(e,"w","lvlOverride");if(c.length>0){a.levelOverrides=[];for(let f of c){let u=s(f,"w","ilvl");if(u===null)continue;let d=parseInt(u,10);if(isNaN(d))continue;let m={ilvl:d},y=l(f,"w","startOverride");if(y){let p=s(y,"w","val");if(p!==null){let x=parseInt(p,10);isNaN(x)||(m.startOverride=x);}}let b=l(f,"w","lvl");b&&(m.lvl=Je(b)??void 0),a.levelOverrides.push(m);}}return a}function Je(e){let t=s(e,"w","ilvl");if(t===null)return null;let n=parseInt(t,10);if(isNaN(n)||n<0||n>8)return null;let o={ilvl:n,numFmt:"decimal",lvlText:""},r=l(e,"w","start");if(r){let p=s(r,"w","val");if(p!==null){let x=parseInt(p,10);isNaN(x)||(o.start=x);}}let i=l(e,"w","numFmt");if(i){let p=s(i,"w","val");p&&(o.numFmt=un(p));}let a=l(e,"w","lvlText");a&&(o.lvlText=s(a,"w","val")??"");let c=l(e,"w","lvlJc");if(c){let p=s(c,"w","val");(p==="left"||p==="center"||p==="right")&&(o.lvlJc=p);}let f=l(e,"w","suff");if(f){let p=s(f,"w","val");(p==="tab"||p==="space"||p==="nothing")&&(o.suffix=p);}let u=l(e,"w","isLgl");u&&(o.isLgl=T(u));let d=l(e,"w","lvlRestart");if(d){let p=s(d,"w","val");if(p!==null){let x=parseInt(p,10);isNaN(x)||(o.lvlRestart=x);}}let m=l(e,"w","legacy");m&&(o.legacy={legacy:T(m),legacySpace:g(m,"w","legacySpace"),legacyIndent:g(m,"w","legacyIndent")});let y=l(e,"w","pPr");y&&(o.pPr=dn(y));let b=l(e,"w","rPr");return b&&(o.rPr=gn(b)),o}function un(e){return {decimal:"decimal",upperRoman:"upperRoman",lowerRoman:"lowerRoman",upperLetter:"upperLetter",lowerLetter:"lowerLetter",ordinal:"ordinal",cardinalText:"cardinalText",ordinalText:"ordinalText",hex:"hex",chicago:"chicago",bullet:"bullet",none:"none",decimalZero:"decimalZero",ganada:"ganada",chosung:"chosung",ideographDigital:"ideographDigital",japaneseCounting:"japaneseCounting",aiueo:"aiueo",iroha:"iroha",decimalFullWidth:"decimalFullWidth",decimalHalfWidth:"decimalHalfWidth",japaneseLegal:"japaneseLegal",japaneseDigitalTenThousand:"japaneseDigitalTenThousand",decimalEnclosedCircle:"decimalEnclosedCircle",decimalFullWidth2:"decimalFullWidth2",aiueoFullWidth:"aiueoFullWidth",irohaFullWidth:"irohaFullWidth",decimalEnclosedFullstop:"decimalEnclosedFullstop",decimalEnclosedParen:"decimalEnclosedParen",decimalEnclosedCircleChinese:"decimalEnclosedCircleChinese",ideographEnclosedCircle:"ideographEnclosedCircle",ideographTraditional:"ideographTraditional",ideographZodiac:"ideographZodiac",ideographZodiacTraditional:"ideographZodiacTraditional",taiwaneseCounting:"taiwaneseCounting",ideographLegalTraditional:"ideographLegalTraditional",taiwaneseCountingThousand:"taiwaneseCountingThousand",taiwaneseDigital:"taiwaneseDigital",chineseCounting:"chineseCounting",chineseLegalSimplified:"chineseLegalSimplified",chineseCountingThousand:"chineseCountingThousand",koreanDigital:"koreanDigital",koreanCounting:"koreanCounting",koreanLegal:"koreanLegal",koreanDigital2:"koreanDigital2",vietnameseCounting:"vietnameseCounting",russianLower:"russianLower",russianUpper:"russianUpper",numberInDash:"numberInDash",hebrew1:"hebrew1",hebrew2:"hebrew2",arabicAlpha:"arabicAlpha",arabicAbjad:"arabicAbjad",hindiVowels:"hindiVowels",hindiConsonants:"hindiConsonants",hindiNumbers:"hindiNumbers",hindiCounting:"hindiCounting",thaiLetters:"thaiLetters",thaiNumbers:"thaiNumbers",thaiCounting:"thaiCounting"}[e]??"decimal"}function dn(e){let t={},n=l(e,"w","ind");if(n){let r=g(n,"w","left"),i=g(n,"w","right"),a=g(n,"w","firstLine"),c=g(n,"w","hanging");r!==void 0&&(t.indentLeft=r),i!==void 0&&(t.indentRight=i),c!==void 0?(t.indentFirstLine=-c,t.hangingIndent=true):a!==void 0&&(t.indentFirstLine=a);}let o=l(e,"w","tabs");if(o){t.tabs=[];let r=N(o,"w","tab");for(let i of r){let a=g(i,"w","pos"),c=s(i,"w","val"),f=s(i,"w","leader");a!==void 0&&c&&t.tabs.push({position:a,alignment:pn(c),leader:mn(f)});}}return t}function pn(e){switch(e){case "left":return "left";case "center":return "center";case "right":return "right";case "decimal":return "decimal";case "bar":return "bar";case "clear":return "clear";case "num":return "num";default:return "left"}}function mn(e){if(e)switch(e){case "none":return "none";case "dot":return "dot";case "hyphen":return "hyphen";case "underscore":return "underscore";case "heavy":return "heavy";case "middleDot":return "middleDot";default:return}}function gn(e){let t={},n=l(e,"w","rFonts");n&&(t.fontFamily={ascii:s(n,"w","ascii")??void 0,hAnsi:s(n,"w","hAnsi")??void 0,eastAsia:s(n,"w","eastAsia")??void 0,cs:s(n,"w","cs")??void 0});let o=l(e,"w","sz");if(o){let c=g(o,"w","val");c!==void 0&&(t.fontSize=c);}let r=l(e,"w","color");if(r){let c=s(r,"w","val"),f=s(r,"w","themeColor");c==="auto"?t.color={auto:true}:f?t.color={themeColor:f,themeTint:s(r,"w","themeTint")??void 0,themeShade:s(r,"w","themeShade")??void 0}:c&&(t.color={rgb:c});}let i=l(e,"w","b");i&&(t.bold=T(i));let a=l(e,"w","i");return a&&(t.italic=T(a)),t}function ke(e){let t=new Map;for(let o of e.abstractNums)t.set(o.abstractNumId,o);let n=new Map;for(let o of e.nums)n.set(o.numId,o);return {definitions:e,getLevel(o,r){let i=n.get(o);if(!i)return null;if(i.levelOverrides){let c=i.levelOverrides.find(f=>f.ilvl===r);if(c){if(c.lvl)return c.lvl;let f=t.get(i.abstractNumId);if(f){let u=f.levels.find(d=>d.ilvl===r);if(u&&c.startOverride!==void 0)return {...u,start:c.startOverride}}}}let a=t.get(i.abstractNumId);return a?a.levels.find(c=>c.ilvl===r)??null:null},getAbstract(o){return t.get(o)??null},hasNumbering(o){return n.has(o)}}}var hn=914400,wn=96;function ir(e){return e==null||isNaN(e)?0:Math.round(e*wn/hn)}function yn(e){if(!e)return;let t=parseInt(e,10);if(!isNaN(t))return t/6e4}function I(e,t){let n=H(e);for(let o of n)if(o.name===t)return o;return null}function bn(e,t){let n=H(e);for(let o of n)if(t.includes(o.name||""))return o;return null}function Qe(e){if(!e)return {width:0,height:0};let t=g(e,null,"cx")??0,n=g(e,null,"cy")??0;return {width:t,height:n}}function et(e){if(!e)return;let t=g(e,null,"l")??0,n=g(e,null,"t")??0,o=g(e,null,"r")??0,r=g(e,null,"b")??0;if(!(t===0&&n===0&&o===0&&r===0))return {left:t,top:n,right:o,bottom:r}}function tt(e){if(!e)return {};let t=s(e,null,"id")??void 0,n=s(e,null,"name")??void 0,o=s(e,null,"descr")??void 0,r=s(e,null,"title")??void 0,i=s(e,null,"decorative")==="1";return {id:t,name:n,alt:o,title:r,decorative:i||void 0}}function xn(e){if(!e)return;let t=s(e,null,"relativeFrom")??"column",n=I(e,"wp:align");if(n){let r=n.elements?.[0]?.text??null;return {relativeTo:t,alignment:r}}let o=I(e,"wp:posOffset");if(o){let r=String(o.elements?.[0]?.text??"0"),i=parseInt(r,10);return {relativeTo:t,posOffset:isNaN(i)?0:i}}return {relativeTo:t}}function Tn(e){if(!e)return;let t=s(e,null,"relativeFrom")??"paragraph",n=I(e,"wp:align");if(n){let r=n.elements?.[0]?.text??null;return {relativeTo:t,alignment:r}}let o=I(e,"wp:posOffset");if(o){let r=String(o.elements?.[0]?.text??"0"),i=parseInt(r,10);return {relativeTo:t,posOffset:isNaN(i)?0:i}}return {relativeTo:t}}var Fn=["wp:wrapNone","wp:wrapSquare","wp:wrapTight","wp:wrapThrough","wp:wrapTopAndBottom"];function Cn(e,t){if(!e)return {type:t?"behind":"inFront"};let o=(e.name||"").replace("wp:",""),r=g(e,null,"distT")??void 0,i=g(e,null,"distB")??void 0,a=g(e,null,"distL")??void 0,c=g(e,null,"distR")??void 0,f=s(e,null,"wrapText")??void 0,u;switch(o){case "wrapNone":u=t?"behind":"inFront";break;case "wrapSquare":u="square";break;case "wrapTight":u="tight";break;case "wrapThrough":u="through";break;case "wrapTopAndBottom":u="topAndBottom";break;default:u="square";}let d={type:u};return f&&(d.wrapText=f),r!==void 0&&(d.distT=r),i!==void 0&&(d.distB=i),a!==void 0&&(d.distL=a),c!==void 0&&(d.distR=c),d}function nt(e){if(!e)return;let t=s(e,null,"rot"),n=s(e,null,"flipH")==="1",o=s(e,null,"flipV")==="1",r=yn(t);if(r===void 0&&!n&&!o)return;let i={};return r!==void 0&&(i.rotation=r),n&&(i.flipH=true),o&&(i.flipV=true),i}function ot(e){let t=I(e,"a:graphic");if(!t)return null;let n=I(t,"a:graphicData");if(!n)return null;let o=I(n,"pic:pic");if(!o)return null;let r=I(o,"pic:blipFill");return r?I(r,"a:blip"):null}function rt(e){if(!e)return "";let t=s(e,"r","embed");if(t)return t;let n=s(e,null,"embed");if(n)return n;let o=s(e,"r","link");return o||""}function it(e){let t=I(e,"a:graphic");if(!t)return null;let n=I(t,"a:graphicData");if(!n)return null;let o=I(n,"pic:pic");if(!o)return null;let r=I(o,"pic:spPr");return r?I(r,"a:xfrm"):null}function Sn(e){if(!e)return e;let t=e.replace(/^\/+/,"");return t.startsWith("media/")?t=`word/${t}`:t.startsWith("word/")||(t=`word/${t}`),t}function kn(e){let t=e.split(".").pop()?.toLowerCase()??"";return {png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",tiff:"image/tiff",tif:"image/tiff",webp:"image/webp",svg:"image/svg+xml",emf:"image/x-emf",wmf:"image/x-wmf"}[t]??"application/octet-stream"}function at(e,t,n){if(!e||!t)return {};let o=t.get(e);if(!o)return {};let r=o.target;if(!r)return {};let i=Sn(r),a=r.split("/").pop(),c=(f,u)=>{let d=u.toLowerCase();for(let[m,y]of f.entries())if(m.toLowerCase()===d)return y};if(n){let f=c(n,i);if(f)return {src:f.dataUrl||f.base64,mimeType:f.mimeType,filename:a};let u=r.replace(/^\/+/,""),d=c(n,u);if(d)return {src:d.dataUrl||d.base64,mimeType:d.mimeType,filename:a};let m=`word/${u}`,y=c(n,m);if(y)return {src:y.dataUrl||y.base64,mimeType:y.mimeType,filename:a}}return {mimeType:kn(r),filename:a}}function Mn(e,t,n){let o=I(e,"wp:extent"),r=Qe(o),i=I(e,"wp:effectExtent"),a=et(i),c=I(e,"wp:docPr"),f=tt(c),u=ot(e),d=rt(u),m=at(d,t,n),y=it(e),b=nt(y),p={type:"image",rId:d,size:r,wrap:{type:"inline"}};return f.id&&(p.id=f.id),f.alt&&(p.alt=f.alt),f.title&&(p.title=f.title),f.decorative&&(p.decorative=true),m.src&&(p.src=m.src),m.mimeType&&(p.mimeType=m.mimeType),m.filename&&(p.filename=m.filename),a&&(p.padding=a),b&&(p.transform=b),p}function vn(e,t,n){let o=I(e,"wp:extent"),r=Qe(o),i=I(e,"wp:effectExtent"),a=et(i),c=I(e,"wp:docPr"),f=tt(c),u=s(e,null,"behindDoc")==="1",d=bn(e,Fn),m=Cn(d,u),y=I(e,"wp:positionH"),b=I(e,"wp:positionV"),p=xn(y),x=Tn(b),A;(p||x)&&(A={horizontal:p??{relativeTo:"column"},vertical:x??{relativeTo:"paragraph"}});let E=ot(e),R=rt(E),C=at(R,t,n),h=it(e),F=nt(h),w={type:"image",rId:R,size:r,wrap:m};return f.id&&(w.id=f.id),f.alt&&(w.alt=f.alt),f.title&&(w.title=f.title),f.decorative&&(w.decorative=true),C.src&&(w.src=C.src),C.mimeType&&(w.mimeType=C.mimeType),C.filename&&(w.filename=C.filename),A&&(w.position=A),a&&(w.padding=a),F&&(w.transform=F),w}function En(e,t,n){let o=H(e);for(let r of o){let i=r.name||"";if(i==="wp:inline")return Mn(r,t,n);if(i==="wp:anchor")return vn(r,t,n)}return null}function st(e,t,n){return En(e,t,n)}function lt(e,t,n,o){let r={};return e&&e!=="auto"?r.rgb=e:e==="auto"&&(r.auto=true),t&&(r.themeColor=t),n&&(r.themeTint=n),o&&(r.themeShade=o),r}function Rn(e){if(!e)return;let t={},n=s(e,"w","color");n&&n!=="auto"&&(t.color={rgb:n});let o=s(e,"w","fill");o&&o!=="auto"&&(t.fill={rgb:o});let r=s(e,"w","themeFill");r&&(t.fill=t.fill||{},t.fill.themeColor=r);let i=s(e,"w","themeFillTint");i&&t.fill&&(t.fill.themeTint=i);let a=s(e,"w","themeFillShade");a&&t.fill&&(t.fill.themeShade=a);let c=s(e,"w","val");return c&&(t.pattern=c),Object.keys(t).length>0?t:void 0}function Me(e,t,n){if(!e)return;let o={},r=l(e,"w","b");r&&(o.bold=T(r));let i=l(e,"w","bCs");i&&(o.boldCs=T(i));let a=l(e,"w","i");a&&(o.italic=T(a));let c=l(e,"w","iCs");c&&(o.italicCs=T(c));let f=l(e,"w","u");if(f){let S=s(f,"w","val");if(S){o.underline={style:S};let L=s(f,"w","color"),U=s(f,"w","themeColor");(L||U)&&(o.underline.color=lt(L,U,s(f,"w","themeTint"),s(f,"w","themeShade")));}}let u=l(e,"w","strike");u&&(o.strike=T(u));let d=l(e,"w","dstrike");d&&(o.doubleStrike=T(d));let m=l(e,"w","vertAlign");if(m){let S=s(m,"w","val");(S==="superscript"||S==="subscript"||S==="baseline")&&(o.vertAlign=S);}let y=l(e,"w","smallCaps");y&&(o.smallCaps=T(y));let b=l(e,"w","caps");b&&(o.allCaps=T(b));let p=l(e,"w","vanish");p&&(o.hidden=T(p));let x=l(e,"w","color");x&&(o.color=lt(s(x,"w","val"),s(x,"w","themeColor"),s(x,"w","themeTint"),s(x,"w","themeShade")));let A=l(e,"w","highlight");if(A){let S=s(A,"w","val");S&&(o.highlight=S);}let E=l(e,"w","shd");E&&(o.shading=Rn(E));let R=l(e,"w","sz");if(R){let S=g(R,"w","val");S!==void 0&&(o.fontSize=S);}let C=l(e,"w","szCs");if(C){let S=g(C,"w","val");S!==void 0&&(o.fontSizeCs=S);}let h=l(e,"w","rFonts");if(h){o.fontFamily={ascii:s(h,"w","ascii")??void 0,hAnsi:s(h,"w","hAnsi")??void 0,eastAsia:s(h,"w","eastAsia")??void 0,cs:s(h,"w","cs")??void 0};let S=s(h,"w","asciiTheme");S&&(o.fontFamily.asciiTheme=S,t&&!o.fontFamily.ascii&&(o.fontFamily.ascii=$(t,S)));let L=s(h,"w","hAnsiTheme");L&&(o.fontFamily.hAnsiTheme=L,t&&!o.fontFamily.hAnsi&&(o.fontFamily.hAnsi=$(t,L)));let U=s(h,"w","eastAsiaTheme");U&&(o.fontFamily.eastAsiaTheme=U,t&&!o.fontFamily.eastAsia&&(o.fontFamily.eastAsia=$(t,U)));let we=s(h,"w","cstheme");we&&(o.fontFamily.csTheme=we,t&&!o.fontFamily.cs&&(o.fontFamily.cs=$(t,we)));}let F=l(e,"w","spacing");if(F){let S=g(F,"w","val");S!==void 0&&(o.spacing=S);}let w=l(e,"w","position");if(w){let S=g(w,"w","val");S!==void 0&&(o.position=S);}let k=l(e,"w","w");if(k){let S=g(k,"w","val");S!==void 0&&(o.scale=S);}let v=l(e,"w","kern");if(v){let S=g(v,"w","val");S!==void 0&&(o.kerning=S);}let P=l(e,"w","effect");if(P){let S=s(P,"w","val");S&&(o.effect=S);}let B=l(e,"w","em");if(B){let S=s(B,"w","val");S&&(o.emphasisMark=S);}let X=l(e,"w","emboss");X&&(o.emboss=T(X));let j=l(e,"w","imprint");j&&(o.imprint=T(j));let K=l(e,"w","outline");K&&(o.outline=T(K));let Y=l(e,"w","shadow");Y&&(o.shadow=T(Y));let D=l(e,"w","rtl");D&&(o.rtl=T(D));let O=l(e,"w","cs");O&&(o.cs=T(O));let M=l(e,"w","rStyle");if(M){let S=s(M,"w","val");S&&(o.styleId=S);}return Object.keys(o).length>0?o:void 0}function Pn(e){let t=re(e),n=s(e,"xml","space")==="preserve";return {type:"text",text:t,preserveSpace:n||void 0}}function An(){return {type:"tab"}}function Bn(e){let t=s(e,"w","type"),n=s(e,"w","clear"),o={type:"break"};return (t==="page"||t==="column"||t==="textWrapping")&&(o.breakType=t),(n==="none"||n==="left"||n==="right"||n==="all")&&(o.clear=n),o}function Nn(e){let t=s(e,"w","font")??"",n=s(e,"w","char")??"";return {type:"symbol",font:t,char:n}}function Xn(e){return {type:"footnoteRef",id:g(e,"w","id")??0}}function In(e){return {type:"endnoteRef",id:g(e,"w","id")??0}}function Ln(e){let t=s(e,"w","fldCharType"),n=s(e,"w","fldLock")==="true"||s(e,"w","fldLock")==="1",o=s(e,"w","dirty")==="true"||s(e,"w","dirty")==="1",r="begin";return t==="separate"?r="separate":t==="end"&&(r="end"),{type:"fieldChar",charType:r,fldLock:n||void 0,dirty:o||void 0}}function Dn(e){return {type:"instrText",text:re(e)}}function Hn(e,t,n){let o=st(e,t??void 0,n??void 0);return o?{type:"drawing",image:o}:null}function On(e){if(!e)return "";let t=e.indexOf(":");return t>=0?e.substring(t+1):e}function jn(e,t,n){let o=[],r=H(e);for(let i of r)switch(On(i.name)){case "t":o.push(Pn(i));break;case "tab":o.push(An());break;case "br":o.push(Bn(i));break;case "sym":o.push(Nn(i));break;case "footnoteReference":o.push(Xn(i));break;case "endnoteReference":o.push(In(i));break;case "fldChar":o.push(Ln(i));break;case "instrText":o.push(Dn(i));break;case "softHyphen":o.push({type:"softHyphen"});break;case "noBreakHyphen":o.push({type:"noBreakHyphen"});break;case "drawing":let c=Hn(i,t,n);c&&o.push(c);break;case "pict":case "object":break;case "rPr":break;case "lastRenderedPageBreak":break;case "cr":o.push({type:"break",breakType:"textWrapping"});break;}return o}function ee(e,t,n,o=null,r=null){let i={type:"run",content:[]},a=l(e,"w","rPr");return a&&(i.formatting=Me(a,n)),i.content=jn(e,o,r),i}function Wn(e){if(!e)return "";let t=e.indexOf(":");return t>=0?e.substring(t+1):e}function Vn(e){let t=g(e,"w","id")??0,n=s(e,"w","name")??"",o={type:"bookmarkStart",id:t,name:n},r=g(e,"w","colFirst");r!==void 0&&(o.colFirst=r);let i=g(e,"w","colLast");return i!==void 0&&(o.colLast=i),o}function zn(e){return {type:"bookmarkEnd",id:g(e,"w","id")??0}}function ct(e,t,n=null,o=null,r=null){let i={type:"hyperlink",children:[]},a=s(e,"r","id");if(a&&(i.rId=a,t)){let b=t.get(a);b&&(He(b),i.href=b.target);}let c=s(e,"w","anchor");c&&(i.anchor=c,i.href||(i.href=`#${c}`));let f=s(e,"w","tooltip");f&&(i.tooltip=f);let u=s(e,"w","tgtFrame");u&&(i.target=u);let d=s(e,"w","history");(d==="1"||d==="true")&&(i.history=true);let m=s(e,"w","docLocation");m&&(i.docLocation=m);let y=H(e);for(let b of y)switch(Wn(b.name)){case "r":i.children.push(ee(b,n,o,t,r));break;case "bookmarkStart":i.children.push(Vn(b));break;case "bookmarkEnd":i.children.push(zn(b));break}return i}function ft(e){let t=g(e,"w","id")??0,n=s(e,"w","name")??"",o={type:"bookmarkStart",id:t,name:n},r=g(e,"w","colFirst");r!==void 0&&(o.colFirst=r);let i=g(e,"w","colLast");return i!==void 0&&(o.colLast=i),o}function ut(e){return {type:"bookmarkEnd",id:g(e,"w","id")??0}}function Un(e){if(!e)return;let t=g(e,"w","w")??0,n=s(e,"w","type")??"dxa",o="dxa";return (n==="auto"||n==="dxa"||n==="nil"||n==="pct")&&(o=n),{value:t,type:o}}function Z(e){return Un(e)}function J(e){if(!e)return;let o={style:s(e,"w","val")??"none"},r=g(e,"w","sz");r!==void 0&&(o.size=r);let i=g(e,"w","space");i!==void 0&&(o.space=i);let a=s(e,"w","color"),c=s(e,"w","themeColor"),f=s(e,"w","themeTint"),u=s(e,"w","themeShade");(a||c||f||u)&&(o.color={rgb:a??void 0,themeColor:c,themeTint:f??void 0,themeShade:u??void 0});let d=s(e,"w","shadow");(d==="1"||d==="true")&&(o.shadow=true);let m=s(e,"w","frame");return (m==="1"||m==="true")&&(o.frame=true),o}function dt(e){if(!e)return;let t={},n=J(l(e,"w","top"));n&&(t.top=n);let o=J(l(e,"w","bottom"));o&&(t.bottom=o);let r=J(l(e,"w","left")??l(e,"w","start"));r&&(t.left=r);let i=J(l(e,"w","right")??l(e,"w","end"));i&&(t.right=i);let a=J(l(e,"w","insideH"));a&&(t.insideH=a);let c=J(l(e,"w","insideV"));if(c&&(t.insideV=c),Object.keys(t).length!==0)return t}function pt(e){if(!e)return;let t={},n=Z(l(e,"w","top"));n&&(t.top=n);let o=Z(l(e,"w","bottom"));o&&(t.bottom=o);let r=Z(l(e,"w","left")??l(e,"w","start"));r&&(t.left=r);let i=Z(l(e,"w","right")??l(e,"w","end"));if(i&&(t.right=i),Object.keys(t).length!==0)return t}function mt(e){if(!e)return;let t={},n=s(e,"w","fill");n&&n!=="auto"&&(t.fill={rgb:n});let o=s(e,"w","themeFill");if(o){t.fill={themeColor:o};let a=s(e,"w","themeFillTint");a&&t.fill&&(t.fill.themeTint=a);let c=s(e,"w","themeFillShade");c&&t.fill&&(t.fill.themeShade=c);}let r=s(e,"w","color");r&&r!=="auto"&&(t.color={rgb:r});let i=s(e,"w","val");if(i&&(t.pattern=i),Object.keys(t).length!==0)return t}function $n(e){if(!e)return;let t={},n=s(e,"w","firstRow");(n==="1"||n==="true")&&(t.firstRow=true);let o=s(e,"w","lastRow");(o==="1"||o==="true")&&(t.lastRow=true);let r=s(e,"w","firstColumn");(r==="1"||r==="true")&&(t.firstColumn=true);let i=s(e,"w","lastColumn");(i==="1"||i==="true")&&(t.lastColumn=true);let a=s(e,"w","noHBand");(a==="1"||a==="true")&&(t.noHBand=true);let c=s(e,"w","noVBand");(c==="1"||c==="true")&&(t.noVBand=true);let f=s(e,"w","val");if(f){let u=parseInt(f,16);isNaN(u)||(u&32&&(t.firstRow=true),u&64&&(t.lastRow=true),u&128&&(t.firstColumn=true),u&256&&(t.lastColumn=true),u&512&&(t.noHBand=true),u&1024&&(t.noVBand=true));}if(Object.keys(t).length!==0)return t}function _n(e){if(!e)return;let t={},n=s(e,"w","horzAnchor");(n==="margin"||n==="page"||n==="text")&&(t.horzAnchor=n);let o=s(e,"w","vertAnchor");(o==="margin"||o==="page"||o==="text")&&(t.vertAnchor=o);let r=g(e,"w","tblpX");r!==void 0&&(t.tblpX=r);let i=s(e,"w","tblpXSpec");i&&(t.tblpXSpec=i);let a=g(e,"w","tblpY");a!==void 0&&(t.tblpY=a);let c=s(e,"w","tblpYSpec");c&&(t.tblpYSpec=c);let f=g(e,"w","topFromText");f!==void 0&&(t.topFromText=f);let u=g(e,"w","bottomFromText");u!==void 0&&(t.bottomFromText=u);let d=g(e,"w","leftFromText");d!==void 0&&(t.leftFromText=d);let m=g(e,"w","rightFromText");if(m!==void 0&&(t.rightFromText=m),Object.keys(t).length!==0)return t}function Gn(e){if(!e)return;let t={},n=Z(l(e,"w","tblW"));n&&(t.width=n);let o=l(e,"w","jc");if(o){let x=s(o,"w","val");(x==="left"||x==="center"||x==="right"||x==="start")&&(t.justification=x==="start"?"left":x);}let r=Z(l(e,"w","tblCellSpacing"));r&&(t.cellSpacing=r);let i=Z(l(e,"w","tblInd"));i&&(t.indent=i);let a=dt(l(e,"w","tblBorders"));a&&(t.borders=a);let c=pt(l(e,"w","tblCellMar"));c&&(t.cellMargins=c);let f=l(e,"w","tblLayout");if(f){let x=s(f,"w","type");(x==="fixed"||x==="autofit")&&(t.layout=x);}let u=l(e,"w","tblStyle");if(u){let x=s(u,"w","val");x&&(t.styleId=x);}let d=$n(l(e,"w","tblLook"));d&&(t.look=d);let m=mt(l(e,"w","shd"));m&&(t.shading=m);let y=l(e,"w","tblOverlap");if(y){let x=s(y,"w","val");(x==="never"||x==="overlap")&&(t.overlap=x);}let b=_n(l(e,"w","tblpPr"));if(b&&(t.floating=b),T(l(e,"w","bidiVisual"))&&(t.bidi=true),Object.keys(t).length!==0)return t}function qn(e){if(!e)return;let t={},n=l(e,"w","trHeight");if(n){let f=Z(n);f&&(t.height=f);let u=s(n,"w","hRule");(u==="auto"||u==="atLeast"||u==="exact")&&(t.heightRule=u);}T(l(e,"w","tblHeader"))&&(t.header=true),T(l(e,"w","cantSplit"))&&(t.cantSplit=true);let i=l(e,"w","jc");if(i){let f=s(i,"w","val");(f==="left"||f==="center"||f==="right")&&(t.justification=f);}T(l(e,"w","hidden"))&&(t.hidden=true);let c=gt(l(e,"w","cnfStyle"));if(c&&(t.conditionalFormat=c),Object.keys(t).length!==0)return t}function gt(e){if(!e)return;let t={},n=s(e,"w","firstRow");(n==="1"||n==="true")&&(t.firstRow=true);let o=s(e,"w","lastRow");(o==="1"||o==="true")&&(t.lastRow=true);let r=s(e,"w","firstColumn");(r==="1"||r==="true")&&(t.firstColumn=true);let i=s(e,"w","lastColumn");(i==="1"||i==="true")&&(t.lastColumn=true);let a=s(e,"w","oddHBand");(a==="1"||a==="true")&&(t.oddHBand=true);let c=s(e,"w","evenHBand");(c==="1"||c==="true")&&(t.evenHBand=true);let f=s(e,"w","oddVBand");(f==="1"||f==="true")&&(t.oddVBand=true);let u=s(e,"w","evenVBand");(u==="1"||u==="true")&&(t.evenVBand=true);let d=s(e,"w","firstRowFirstColumn");(d==="1"||d==="true")&&(t.nwCell=true);let m=s(e,"w","firstRowLastColumn");(m==="1"||m==="true")&&(t.neCell=true);let y=s(e,"w","lastRowFirstColumn");(y==="1"||y==="true")&&(t.swCell=true);let b=s(e,"w","lastRowLastColumn");(b==="1"||b==="true")&&(t.seCell=true);let p=s(e,"w","val");if(p&&p.length===12&&(p[0]==="1"&&(t.firstRow=true),p[1]==="1"&&(t.lastRow=true),p[2]==="1"&&(t.firstColumn=true),p[3]==="1"&&(t.lastColumn=true),p[4]==="1"&&(t.oddVBand=true),p[5]==="1"&&(t.evenVBand=true),p[6]==="1"&&(t.oddHBand=true),p[7]==="1"&&(t.evenHBand=true),p[8]==="1"&&(t.nwCell=true),p[9]==="1"&&(t.neCell=true),p[10]==="1"&&(t.swCell=true),p[11]==="1"&&(t.seCell=true)),Object.keys(t).length!==0)return t}function Zn(e){if(!e)return;let t={},n=Z(l(e,"w","tcW"));n&&(t.width=n);let o=dt(l(e,"w","tcBorders"));o&&(t.borders=o);let r=pt(l(e,"w","tcMar"));r&&(t.margins=r);let i=mt(l(e,"w","shd"));i&&(t.shading=i);let a=l(e,"w","vAlign");if(a){let p=s(a,"w","val");(p==="top"||p==="center"||p==="bottom")&&(t.verticalAlign=p);}let c=l(e,"w","textDirection");if(c){let p=s(c,"w","val");p&&(t.textDirection=p);}let f=l(e,"w","gridSpan");if(f){let p=g(f,"w","val");p!==void 0&&p>1&&(t.gridSpan=p);}let u=l(e,"w","vMerge");u&&(s(u,"w","val")==="restart"?t.vMerge="restart":t.vMerge="continue"),T(l(e,"w","tcFitText"))&&(t.fitText=true),T(l(e,"w","noWrap"))&&(t.noWrap=true),T(l(e,"w","hideMark"))&&(t.hideMark=true);let b=gt(l(e,"w","cnfStyle"));if(b&&(t.conditionalFormat=b),Object.keys(t).length!==0)return t}function Yn(e,t,n,o,r,i){let a=[],c=e.elements||[];for(let f of c){if(!f.name)continue;let u=f.name.split(":").pop();if(u==="p"){let d=z(f,t,n,o,r,i);a.push(d);}else if(u==="tbl"){let d=te(f,t,n,o,r,i);a.push(d);}}return a.length===0&&a.push({type:"paragraph",content:[]}),a}function Kn(e,t,n,o,r,i){let a={type:"tableCell",content:[]},c=Zn(l(e,"w","tcPr"));return c&&(a.formatting=c),a.content=Yn(e,t,n,o,r,i),a}function Jn(e,t,n,o,r,i){let a={type:"tableRow",cells:[]},c=qn(l(e,"w","trPr"));c&&(a.formatting=c);let f=N(e,"w","tc");for(let u of f){let d=Kn(u,t,n,o,r,i);a.cells.push(d);}return a}function Qn(e){if(!e)return;let t=[],n=N(e,"w","gridCol");for(let o of n){let r=g(o,"w","w")??0;t.push(r);}return t.length>0?t:void 0}function te(e,t,n,o,r,i){let a={type:"table",rows:[]},c=Gn(l(e,"w","tblPr"));c&&(a.formatting=c);let f=Qn(l(e,"w","tblGrid"));f&&(a.columnWidths=f);let u=N(e,"w","tr");for(let d of u){let m=Jn(d,t,n,o,r,i);a.rows.push(m);}return a}function ht(e){switch(e){case "first":return "first";case "even":return "even";default:return "default"}}function wt(e){let t=s(e,"w","type"),n=s(e,"r","id")??"";return {type:ht(t),rId:n}}function yt(e){let t=s(e,"w","type"),n=s(e,"r","id")??"";return {type:ht(t),rId:n}}function ve(e,t,n,o,r,i){let a=[],c=e.elements??[];for(let f of c){if(f.type!=="element")continue;let u=f.name??"";if(u==="w:p"||u.endsWith(":p")){let d=z(f,t,n,o,r,i);a.push(d);}else if(u==="w:tbl"||u.endsWith(":tbl")){let d=te(f,t,n,o,r,i);a.push(d);}else if(u==="w:sdt"||u.endsWith(":sdt")){let d=(f.elements??[]).find(m=>m.type==="element"&&(m.name==="w:sdtContent"||m.name?.endsWith(":sdtContent")));if(d){let m=ve(d,t,n,o,r,i);a.push(...m);}}}return a}function bt(e,t="default",n=null,o=null,r=null,i=null,a=null){let c={type:"header",hdrFtrType:t,content:[]};if(!e)return c;let f=V(e);if(!f)return c;let u=f.elements?.find(d=>d.type==="element"&&(d.name==="w:hdr"||d.name?.endsWith(":hdr")));return u&&(c.content=ve(u,n,o,r,i,a)),c}function xt(e,t="default",n=null,o=null,r=null,i=null,a=null){let c={type:"footer",hdrFtrType:t,content:[]};if(!e)return c;let f=V(e);if(!f)return c;let u=f.elements?.find(d=>d.type==="element"&&(d.name==="w:ftr"||d.name?.endsWith(":ftr")));return u&&(c.content=ve(u,n,o,r,i,a)),c}function Tt(e){switch(e){case "separator":return "separator";case "continuationSeparator":return "continuationSeparator";case "continuationNotice":return "continuationNotice";default:return "normal"}}function eo(e,t,n,o,r,i){let a=g(e,"w","id")??0,c=s(e,"w","type"),f=Tt(c),d=N(e,"w","p").map(m=>z(m,t,n,o,r));return {type:"footnote",id:a,noteType:f,content:d}}function Ft(e,t=null,n=null,o=null,r=null,i=null){let a=new Map,c=[];if(!e)return fe(a,c);let f=V(e);if(!f)return fe(a,c);let u=f.elements?.find(m=>m.type==="element"&&(m.name==="w:footnotes"||m.name?.endsWith(":footnotes")));if(!u)return fe(a,c);let d=N(u,"w","footnote");for(let m of d){let y=eo(m,t,n,o,r);a.set(y.id,y),c.push(y);}return fe(a,c)}function fe(e,t){return {byId:e,footnotes:t,getFootnote(n){return e.get(n)},hasFootnote(n){return e.has(n)},getNormalFootnotes(){return t.filter(n=>n.noteType==="normal")},getSeparator(){return t.find(n=>n.noteType==="separator")},getContinuationSeparator(){return t.find(n=>n.noteType==="continuationSeparator")}}}function to(e,t,n,o,r,i){let a=g(e,"w","id")??0,c=s(e,"w","type"),f=Tt(c),d=N(e,"w","p").map(m=>z(m,t,n,o,r));return {type:"endnote",id:a,noteType:f,content:d}}function Ct(e,t=null,n=null,o=null,r=null,i=null){let a=new Map,c=[];if(!e)return ue(a,c);let f=V(e);if(!f)return ue(a,c);let u=f.elements?.find(m=>m.type==="element"&&(m.name==="w:endnotes"||m.name?.endsWith(":endnotes")));if(!u)return ue(a,c);let d=N(u,"w","endnote");for(let m of d){let y=to(m,t,n,o,r);a.set(y.id,y),c.push(y);}return ue(a,c)}function ue(e,t){return {byId:e,endnotes:t,getEndnote(n){return e.get(n)},hasEndnote(n){return e.has(n)},getNormalEndnotes(){return t.filter(n=>n.noteType==="normal")},getSeparator(){return t.find(n=>n.noteType==="separator")},getContinuationSeparator(){return t.find(n=>n.noteType==="continuationSeparator")}}}function St(e){return e?{decimal:"decimal",upperRoman:"upperRoman",lowerRoman:"lowerRoman",upperLetter:"upperLetter",lowerLetter:"lowerLetter",ordinal:"ordinal",cardinalText:"cardinalText",ordinalText:"ordinalText",bullet:"bullet",chicago:"chicago",none:"none"}[e]:void 0}function no(e){switch(e){case "pageBottom":return "pageBottom";case "beneathText":return "beneathText";case "sectEnd":return "sectEnd";case "docEnd":return "docEnd";default:return}}function oo(e){switch(e){case "sectEnd":return "sectEnd";case "docEnd":return "docEnd";default:return}}function kt(e){switch(e){case "continuous":return "continuous";case "eachSect":return "eachSect";case "eachPage":return "eachPage";default:return}}function Mt(e){let t={};if(!e)return t;let n=l(e,"w","pos");if(n){let a=s(n,"w","val");t.position=no(a);}let o=l(e,"w","numFmt");if(o){let a=s(o,"w","val");t.numFmt=St(a);}let r=l(e,"w","numStart");r&&(t.numStart=g(r,"w","val")??void 0);let i=l(e,"w","numRestart");if(i){let a=s(i,"w","val");t.numRestart=kt(a);}return t}function vt(e){let t={};if(!e)return t;let n=l(e,"w","pos");if(n){let a=s(n,"w","val");t.position=oo(a);}let o=l(e,"w","numFmt");if(o){let a=s(o,"w","val");t.numFmt=St(a);}let r=l(e,"w","numStart");r&&(t.numStart=g(r,"w","val")??void 0);let i=l(e,"w","numRestart");if(i){let a=s(i,"w","val");t.numRestart=kt(a);}return t}function ro(e,t,n,o){if(!e&&!t)return;let r={};return e&&e!=="auto"?r.rgb=e:e==="auto"&&(r.auto=true),t&&(r.themeColor=t),n&&(r.themeTint=n),o&&(r.themeShade=o),Object.keys(r).length>0?r:void 0}function de(e){if(!e)return;let o={style:s(e,"w","val")??"none"},r=g(e,"w","sz");r!==void 0&&(o.size=r);let i=g(e,"w","space");i!==void 0&&(o.space=i);let a=s(e,"w","color"),c=s(e,"w","themeColor"),f=s(e,"w","themeTint"),u=s(e,"w","themeShade"),d=ro(a,c,f,u);d&&(o.color=d);let m=s(e,"w","shadow");(m==="1"||m==="true")&&(o.shadow=true);let y=s(e,"w","frame");return (y==="1"||y==="true")&&(o.frame=true),o}function io(e){switch(e){case "landscape":return "landscape";case "portrait":return "portrait";default:return}}function ao(e){switch(e){case "continuous":return "continuous";case "nextPage":return "nextPage";case "oddPage":return "oddPage";case "evenPage":return "evenPage";case "nextColumn":return "nextColumn";default:return}}function so(e){switch(e){case "top":return "top";case "center":return "center";case "both":return "both";case "bottom":return "bottom";default:return}}function lo(e){switch(e){case "continuous":return "continuous";case "newPage":return "newPage";case "newSection":return "newSection";default:return}}function pe(e,t){let n={};if(!e)return n;let o=l(e,"w","pgSz");if(o){let h=g(o,"w","w");h!==void 0&&(n.pageWidth=h);let F=g(o,"w","h");F!==void 0&&(n.pageHeight=F);let w=s(o,"w","orient"),k=io(w);k&&(n.orientation=k);}let r=l(e,"w","pgMar");if(r){let h=g(r,"w","top");h!==void 0&&(n.marginTop=h);let F=g(r,"w","bottom");F!==void 0&&(n.marginBottom=F);let w=g(r,"w","left");w!==void 0&&(n.marginLeft=w);let k=g(r,"w","right");k!==void 0&&(n.marginRight=k);let v=g(r,"w","header");v!==void 0&&(n.headerDistance=v);let P=g(r,"w","footer");P!==void 0&&(n.footerDistance=P);let B=g(r,"w","gutter");B!==void 0&&(n.gutter=B);}let i=l(e,"w","cols");if(i){let h=g(i,"w","num");h!==void 0&&(n.columnCount=h);let F=g(i,"w","space");F!==void 0&&(n.columnSpace=F);let w=s(i,"w","equalWidth");w==="1"||w==="true"?n.equalWidth=true:(w==="0"||w==="false")&&(n.equalWidth=false);let k=s(i,"w","sep");(k==="1"||k==="true")&&(n.separator=true);let v=N(i,"w","col");if(v.length>0){n.columns=[];for(let P of v){let B={},X=g(P,"w","w");X!==void 0&&(B.width=X);let j=g(P,"w","space");j!==void 0&&(B.space=j),n.columns.push(B);}}}let a=l(e,"w","type");if(a){let h=s(a,"w","val"),F=ao(h);F&&(n.sectionStart=F);}let c=l(e,"w","vAlign");if(c){let h=s(c,"w","val"),F=so(h);F&&(n.verticalAlign=F);}let f=l(e,"w","bidi");f&&(n.bidi=T(f));let u=N(e,"w","headerReference");u.length>0&&(n.headerReferences=u.map(h=>wt(h)));let d=N(e,"w","footerReference");d.length>0&&(n.footerReferences=d.map(h=>yt(h)));let m=l(e,"w","titlePg");m&&(n.titlePg=T(m));let y=l(e,"w","evenAndOddHeaders");y&&(n.evenAndOddHeaders=T(y));let b=l(e,"w","lnNumType");if(b){n.lineNumbers={};let h=g(b,"w","start");h!==void 0&&(n.lineNumbers.start=h);let F=g(b,"w","countBy");F!==void 0&&(n.lineNumbers.countBy=F);let w=g(b,"w","distance");w!==void 0&&(n.lineNumbers.distance=w);let k=s(b,"w","restart"),v=lo(k);v&&(n.lineNumbers.restart=v);}let p=l(e,"w","pgBorders");if(p){n.pageBorders={};let h=de(l(p,"w","top"));h&&(n.pageBorders.top=h);let F=de(l(p,"w","bottom"));F&&(n.pageBorders.bottom=F);let w=de(l(p,"w","left"));w&&(n.pageBorders.left=w);let k=de(l(p,"w","right"));k&&(n.pageBorders.right=k);let v=s(p,"w","display");(v==="allPages"||v==="firstPage"||v==="notFirstPage")&&(n.pageBorders.display=v);let P=s(p,"w","offsetFrom");(P==="page"||P==="text")&&(n.pageBorders.offsetFrom=P);let B=s(p,"w","zOrder");(B==="front"||B==="back")&&(n.pageBorders.zOrder=B);}let x=l(e,"w","background");if(x){n.background={};let h=s(x,"w","color");h&&h!=="auto"&&(n.background.color={rgb:h});let F=s(x,"w","themeColor");F&&(n.background.themeColor=F);let w=s(x,"w","themeTint");w&&(n.background.themeTint=w);let k=s(x,"w","themeShade");k&&(n.background.themeShade=k);}let A=l(e,"w","footnotePr");if(A){let h=Mt(A);Object.keys(h).length>0&&(n.footnotePr=h);}let E=l(e,"w","endnotePr");if(E){let h=vt(E);Object.keys(h).length>0&&(n.endnotePr=h);}let R=l(e,"w","docGrid");if(R){n.docGrid={};let h=s(R,"w","type");(h==="default"||h==="lines"||h==="linesAndChars"||h==="snapToChars")&&(n.docGrid.type=h);let F=g(R,"w","linePitch");F!==void 0&&(n.docGrid.linePitch=F);let w=g(R,"w","charSpace");w!==void 0&&(n.docGrid.charSpace=w);}let C=l(e,"w","paperSrc");if(C){let h=g(C,"w","first");h!==void 0&&(n.paperSrcFirst=h);let F=g(C,"w","other");F!==void 0&&(n.paperSrcOther=F);}return n}function Et(){return {pageWidth:12240,pageHeight:15840,orientation:"portrait",marginTop:1440,marginBottom:1440,marginLeft:1440,marginRight:1440,headerDistance:720,footerDistance:720,gutter:0,columnCount:1,columnSpace:720,equalWidth:true,sectionStart:"nextPage",verticalAlign:"top"}}function co(e,t){return !e&&!t?true:!(!e||!t||e.bold!==t.bold||e.boldCs!==t.boldCs||e.italic!==t.italic||e.italicCs!==t.italicCs||e.strike!==t.strike||e.doubleStrike!==t.doubleStrike||e.smallCaps!==t.smallCaps||e.allCaps!==t.allCaps||e.hidden!==t.hidden||e.emboss!==t.emboss||e.imprint!==t.imprint||e.outline!==t.outline||e.shadow!==t.shadow||e.rtl!==t.rtl||e.cs!==t.cs||e.fontSize!==t.fontSize||e.fontSizeCs!==t.fontSizeCs||e.spacing!==t.spacing||e.position!==t.position||e.scale!==t.scale||e.kerning!==t.kerning||e.vertAlign!==t.vertAlign||e.highlight!==t.highlight||e.effect!==t.effect||e.emphasisMark!==t.emphasisMark||e.styleId!==t.styleId||!fo(e.underline,t.underline)||!me(e.color,t.color)||!uo(e.shading,t.shading)||!po(e.fontFamily,t.fontFamily))}function fo(e,t){return !e&&!t?true:!e||!t||e.style!==t.style?false:me(e.color,t.color)}function me(e,t){return !e&&!t?true:!e||!t?false:e.rgb===t.rgb&&e.auto===t.auto&&e.themeColor===t.themeColor&&e.themeTint===t.themeTint&&e.themeShade===t.themeShade}function uo(e,t){return !e&&!t?true:!(!e||!t||e.pattern!==t.pattern||!me(e.color,t.color)||!me(e.fill,t.fill))}function po(e,t){return !e&&!t?true:!e||!t?false:e.ascii===t.ascii&&e.hAnsi===t.hAnsi&&e.eastAsia===t.eastAsia&&e.cs===t.cs&&e.asciiTheme===t.asciiTheme&&e.hAnsiTheme===t.hAnsiTheme&&e.eastAsiaTheme===t.eastAsiaTheme&&e.csTheme===t.csTheme}function mo(e){return e.type==="text"||e.type==="softHyphen"||e.type==="noBreakHyphen"}function Rt(e){return e.content.length===0?true:e.content.every(mo)}function go(e,t){let n=[];for(let o of e)n.push(o);if(n.length>0&&t.length>0&&n[n.length-1].type==="text"&&t[0].type==="text"){let o=n[n.length-1],r=t[0];n[n.length-1]={type:"text",text:o.text+r.text,preserveSpace:o.preserveSpace||r.preserveSpace||void 0};for(let i=1;i<t.length;i++)n.push(t[i]);}else for(let o of t)n.push(o);return n}function ho(e){if(e.length<=1)return e;let t=[],n=null;for(let o of e)if(o.content.length!==0){if(n===null){n={...o,content:[...o.content]};continue}Rt(n)&&Rt(o)&&co(n.formatting,o.formatting)?n={type:"run",formatting:n.formatting,content:go(n.content,o.content)}:(t.push(n),n={...o,content:[...o.content]});}return n!==null&&t.push(n),t}function Ee(e){if(e.length<=1)return e;let t=[],n=[];function o(){if(n.length>0){let r=ho(n);t.push(...r),n.length=0;}}for(let r of e)if(r.type==="run")n.push(r);else if(o(),r.type==="hyperlink"){let i={...r,children:Ee(r.children)};t.push(i);}else t.push(r);return o(),t}function wo(e){let t={sdtType:"richText"};if(!e||!e.elements)return t;for(let n of e.elements){if(n.type!=="element")continue;switch(n.name?.replace(/^w:/,"")??""){case "alias":t.alias=s(n,"w","val")??void 0;break;case "tag":t.tag=s(n,"w","val")??void 0;break;case "lock":t.lock=s(n,"w","val")??"unlocked";break;case "placeholder":{let r=l(n,"w","docPart");if(r){let i=l(r,"w","val");t.placeholder=i?s(i,"w","val")??void 0:void 0;}break}case "showingPlcHdr":t.showingPlaceholder=true;break;case "text":t.sdtType="plainText";break;case "date":t.sdtType="date",t.dateFormat=s(n,"w","fullDate")??void 0;break;case "dropDownList":t.sdtType="dropdown",t.listItems=Pt(n);break;case "comboBox":t.sdtType="comboBox",t.listItems=Pt(n);break;case "checkbox":{t.sdtType="checkbox";let r=l(n,"w14","checked")??l(n,"w","checked");t.checked=r?s(r,"w14","val")==="1"||s(r,"w","val")==="1":false;break}case "picture":t.sdtType="picture";break;case "docPartObj":t.sdtType="buildingBlockGallery";break;case "group":t.sdtType="group";break}}return t}function Pt(e){let t=[];for(let n of e.elements??[])n.type==="element"&&(n.name==="w:listItem"||n.name?.endsWith(":listItem"))&&t.push({displayText:s(n,"w","displayText")??"",value:s(n,"w","value")??""});return t}function At(e){let t="";if(e.type==="text"&&typeof e.text=="string")return e.text;if(e.elements)for(let n of e.elements)if((n.name?.replace(/^.*:/,"")??"")==="t"&&n.elements)for(let r of n.elements)r.type==="text"&&typeof r.text=="string"&&(t+=r.text);else t+=At(n);return t}function yo(e,t,n,o){let r={};return e&&e!=="auto"?r.rgb=e:e==="auto"&&(r.auto=true),t&&(r.themeColor=t),n&&(r.themeTint=n),o&&(r.themeShade=o),r}function bo(e){if(!e)return;let t={},n=s(e,"w","color");n&&n!=="auto"&&(t.color={rgb:n});let o=s(e,"w","fill");o&&o!=="auto"&&(t.fill={rgb:o});let r=s(e,"w","themeFill");r&&(t.fill=t.fill||{},t.fill.themeColor=r);let i=s(e,"w","themeFillTint");i&&t.fill&&(t.fill.themeTint=i);let a=s(e,"w","themeFillShade");a&&t.fill&&(t.fill.themeShade=a);let c=s(e,"w","val");return c&&(t.pattern=c),Object.keys(t).length>0?t:void 0}function Q(e){if(!e)return;let t=s(e,"w","val");if(!t)return;let n={style:t},o=s(e,"w","color"),r=s(e,"w","themeColor");(o||r)&&(n.color=yo(o,r,s(e,"w","themeTint"),s(e,"w","themeShade")));let i=g(e,"w","sz");i!==void 0&&(n.size=i);let a=g(e,"w","space");a!==void 0&&(n.space=a);let c=s(e,"w","shadow");c&&(n.shadow=c==="1"||c==="true");let f=s(e,"w","frame");return f&&(n.frame=f==="1"||f==="true"),n}function xo(e){if(!e)return;let t=N(e,"w","tab");if(t.length===0)return;let n=[];for(let o of t){let r=g(o,"w","pos"),i=s(o,"w","val");if(r!==void 0&&i){let a={position:r,alignment:i},c=s(o,"w","leader");c&&(a.leader=c),n.push(a);}}return n.length>0?n:void 0}function To(e){if(!e)return;let t={},n=g(e,"w","w");n!==void 0&&(t.width=n);let o=g(e,"w","h");o!==void 0&&(t.height=o);let r=s(e,"w","hAnchor");(r==="text"||r==="margin"||r==="page")&&(t.hAnchor=r);let i=s(e,"w","vAnchor");(i==="text"||i==="margin"||i==="page")&&(t.vAnchor=i);let a=g(e,"w","x");a!==void 0&&(t.x=a);let c=g(e,"w","y");c!==void 0&&(t.y=c);let f=s(e,"w","xAlign");f&&(t.xAlign=f);let u=s(e,"w","yAlign");u&&(t.yAlign=u);let d=s(e,"w","wrap");return d&&(t.wrap=d),Object.keys(t).length>0?t:void 0}function Fo(e,t,n){if(!e)return;let o={},r=l(e,"w","jc");if(r){let w=s(r,"w","val");w&&(o.alignment=w);}let i=l(e,"w","bidi");i&&(o.bidi=T(i));let a=l(e,"w","spacing");if(a){let w=g(a,"w","before");w!==void 0&&(o.spaceBefore=w);let k=g(a,"w","after");k!==void 0&&(o.spaceAfter=k);let v=g(a,"w","line");v!==void 0&&(o.lineSpacing=v);let P=s(a,"w","lineRule");P&&(o.lineSpacingRule=P);let B=s(a,"w","beforeAutospacing");B&&(o.beforeAutospacing=B==="1"||B==="true");let X=s(a,"w","afterAutospacing");X&&(o.afterAutospacing=X==="1"||X==="true");}let c=l(e,"w","ind");if(c){let w=g(c,"w","left");w!==void 0&&(o.indentLeft=w);let k=g(c,"w","right");k!==void 0&&(o.indentRight=k);let v=g(c,"w","firstLine");v!==void 0&&(o.indentFirstLine=v);let P=g(c,"w","hanging");P!==void 0&&(o.indentFirstLine=-P,o.hangingIndent=true);let B=g(c,"w","start");B!==void 0&&o.indentLeft===void 0&&(o.indentLeft=B);let X=g(c,"w","end");X!==void 0&&o.indentRight===void 0&&(o.indentRight=X);}let f=l(e,"w","pBdr");if(f){let w={},k=Q(l(f,"w","top"));k&&(w.top=k);let v=Q(l(f,"w","bottom"));v&&(w.bottom=v);let P=Q(l(f,"w","left"));P&&(w.left=P);let B=Q(l(f,"w","right"));B&&(w.right=B);let X=Q(l(f,"w","between"));X&&(w.between=X);let j=Q(l(f,"w","bar"));j&&(w.bar=j),Object.keys(w).length>0&&(o.borders=w);}let u=l(e,"w","shd");u&&(o.shading=bo(u));let d=l(e,"w","tabs");d&&(o.tabs=xo(d));let m=l(e,"w","keepNext");m&&(o.keepNext=T(m));let y=l(e,"w","keepLines");y&&(o.keepLines=T(y));let b=l(e,"w","widowControl");b&&(o.widowControl=T(b));let p=l(e,"w","pageBreakBefore");p&&(o.pageBreakBefore=T(p));let x=l(e,"w","numPr");if(x){let w=l(x,"w","numId"),k=l(x,"w","ilvl");if(w||k){if(o.numPr={},w){let v=g(w,"w","val");v!==void 0&&(o.numPr.numId=v);}if(k){let v=g(k,"w","val");v!==void 0&&(o.numPr.ilvl=v);}}}let A=l(e,"w","outlineLvl");if(A){let w=g(A,"w","val");w!==void 0&&(o.outlineLevel=w);}let E=l(e,"w","pStyle");if(E){let w=s(E,"w","val");w&&(o.styleId=w);}let R=l(e,"w","framePr");R&&(o.frame=To(R));let C=l(e,"w","suppressLineNumbers");C&&(o.suppressLineNumbers=T(C));let h=l(e,"w","suppressAutoHyphens");h&&(o.suppressAutoHyphens=T(h));let F=l(e,"w","rPr");return F&&(o.runProperties=Me(F,t)),Object.keys(o).length>0?o:void 0}function Bt(e){if(!e)return "";let t=e.indexOf(":");return t>=0?e.substring(t+1):e}function Co(e,t,n,o,r){return ct(e,t,n,o,r)}function So(e){return ft(e)}function ko(e){return ut(e)}function Nt(e){let t=e.trim().match(/^\\?([A-Z]+)/i);if(!t)return "UNKNOWN";let n=t[1].toUpperCase();return ["PAGE","NUMPAGES","NUMWORDS","NUMCHARS","DATE","TIME","CREATEDATE","SAVEDATE","PRINTDATE","AUTHOR","TITLE","SUBJECT","KEYWORDS","COMMENTS","FILENAME","FILESIZE","TEMPLATE","DOCPROPERTY","DOCVARIABLE","REF","PAGEREF","NOTEREF","HYPERLINK","TOC","TOA","INDEX","SEQ","STYLEREF","AUTONUM","AUTONUMLGL","AUTONUMOUT","IF","MERGEFIELD","NEXT","NEXTIF","ASK","SET","QUOTE","INCLUDETEXT","INCLUDEPICTURE","SYMBOL","ADVANCE","EDITTIME","REVNUM","SECTION","SECTIONPAGES","USERADDRESS","USERNAME","USERINITIALS"].includes(n)?n:"UNKNOWN"}function Mo(e,t,n,o,r){let i=s(e,"w","instr")??"",a=Nt(i),c={type:"simpleField",instruction:i,fieldType:a,content:[]},f=s(e,"w","fldLock");(f==="1"||f==="true")&&(c.fldLock=true);let u=s(e,"w","dirty");(u==="1"||u==="true")&&(c.dirty=true);let d=H(e);for(let m of d)Bt(m.name)==="r"&&c.content.push(ee(m,t,n,o,r));return c}function ge(e,t,n,o,r,i){let a=[],c=H(e),f=false,u="",d=[],m=[],y=false,b=false,p=false;for(let x of c){let A=Bt(x.name);switch(A){case "r":{let E=ee(x,t,n,r,i),R=false,C=false,h=false,F="";for(let w of E.content)w.type==="fieldChar"?w.charType==="begin"?(R=true,w.fldLock&&(b=true),w.dirty&&(p=true)):w.charType==="separate"?C=true:w.charType==="end"&&(h=true):w.type==="instrText"&&(F+=w.text);if(R&&(f=true,y=false,u="",d=[],m=[],b=false,p=false),f){if(F&&(u+=F),C&&(y=true),y&&!h?C||m.push(E):!y&&!R&&d.push(E),h){let w={type:"complexField",instruction:u.trim(),fieldType:Nt(u),fieldCode:d,fieldResult:m};b&&(w.fldLock=true),p&&(w.dirty=true),a.push(w),f=false;}}else a.push(E);break}case "hyperlink":a.push(Co(x,r,t,n,i));break;case "bookmarkStart":a.push(So(x));break;case "bookmarkEnd":a.push(ko(x));break;case "fldSimple":a.push(Mo(x,t,n,r,i));break;case "pPr":break;case "proofErr":case "permStart":case "permEnd":case "customXml":break;case "sdt":{let E=(x.elements??[]).find(C=>C.type==="element"&&(C.name==="w:sdtPr"||C.name?.endsWith(":sdtPr"))),R=(x.elements??[]).find(C=>C.type==="element"&&(C.name==="w:sdtContent"||C.name?.endsWith(":sdtContent")));if(R){let C=ge(R,t,n,null,r,i),F={type:"inlineSdt",properties:wo(E??null),content:C.filter(w=>w.type==="run"||w.type==="hyperlink")};a.push(F);}break}case "ins":{let E={id:parseInt(s(x,"w","id")??"0",10),author:s(x,"w","author")??"Unknown",date:s(x,"w","date")??void 0},R=ge(x,t,n,null,r,i),C={type:"insertion",info:E,content:R.filter(h=>h.type==="run"||h.type==="hyperlink")};a.push(C);break}case "del":{let E={id:parseInt(s(x,"w","id")??"0",10),author:s(x,"w","author")??"Unknown",date:s(x,"w","date")??void 0},R=ge(x,t,n,null,r,i),C={type:"deletion",info:E,content:R.filter(h=>h.type==="run"||h.type==="hyperlink")};a.push(C);break}case "smartTag":case "moveTo":case "moveFrom":break;case "commentRangeStart":{let E=parseInt(s(x,"w","id")??"0",10);a.push({type:"commentRangeStart",id:E});break}case "commentRangeEnd":{let E=parseInt(s(x,"w","id")??"0",10);a.push({type:"commentRangeEnd",id:E});break}case "oMath":case "oMathPara":{let E=A==="oMathPara",R=De(x),C=At(x),h={type:"mathEquation",display:E?"block":"inline",ommlXml:R,plainText:C||void 0};a.push(h);break}}}return a}function z(e,t,n,o,r=null,i=null){let a={type:"paragraph",content:[]},c=s(e,"w14","paraId")??s(e,"w","paraId");c&&(a.paraId=c);let f=s(e,"w14","textId")??s(e,"w","textId");f&&(a.textId=f);let u=l(e,"w","pPr");if(u){a.formatting=Fo(u,n);let m=l(u,"w","sectPr");m&&(a.sectionProperties=pe(m));}let d=ge(e,t,n,o,r,i);if(a.content=Ee(d),a.formatting?.numPr&&o){let{numId:m,ilvl:y=0}=a.formatting.numPr;if(m!==void 0&&m!==0){let b=o.getLevel(m,y);b&&(a.listRendering={level:y,numId:m,marker:b.lvlText,isBullet:b.numFmt==="bullet",numFmt:b.numFmt},b.pPr&&(a.formatting||(a.formatting={}),b.pPr.indentLeft!==void 0&&(a.formatting.indentLeft=b.pPr.indentLeft),b.pPr.indentFirstLine!==void 0&&(a.formatting.indentFirstLine=b.pPr.indentFirstLine),b.pPr.hangingIndent!==void 0&&(a.formatting.hangingIndent=b.pPr.hangingIndent)));}}return a}function Re(e){let t="";for(let n of e.content)if(n.type==="run")for(let o of n.content)o.type==="text"?t+=o.text:o.type==="tab"?t+=" ":o.type==="break"&&(o.breakType==="page"?t+="\f":t+=`
10
+ `);else if(n.type==="hyperlink"){for(let o of n.children)if(o.type==="run")for(let r of o.content)r.type==="text"&&(t+=r.text);}else if(n.type==="simpleField"){for(let o of n.content)if(o.type==="run")for(let r of o.content)r.type==="text"&&(t+=r.text);}else if(n.type==="complexField")for(let o of n.fieldResult)for(let r of o.content)r.type==="text"&&(t+=r.text);return t}function vo(e){if(!e||e.trim()==="")return "\u2022";let t=e.charCodeAt(0),n={183:"\u2022",111:"\u25CB",167:"\u25A0",252:"\u2713",110:"\u25A0",113:"\u25CB",117:"\u25C6",118:"\u2756",168:"\u2713",251:"\u2713",254:"\u2713",61623:"\u2022",61550:"\u25A0",61551:"\u25CB",61607:"\u25A0",61692:"\u2713",8226:"\u2022",9679:"\u25CF",9675:"\u25CB",9632:"\u25A0",9633:"\u25A1",9670:"\u25C6",9671:"\u25C7",8211:"\u2013",8212:"\u2014",62:">",45:"-"};return n[t]?n[t]:t>=57344&&t<=63743||t<32||t>=127&&t<160?"\u2022":e}function Eo(e,t,n){let o=e.listRendering;if(!o||!t)return;let{numId:r,level:i}=o;if(r===void 0||r===0)return;n.has(r)||n.set(r,new Array(9).fill(0));let a=n.get(r);a[i]=(a[i]||0)+1;for(let u=i+1;u<a.length;u++)a[u]=0;let c=o.marker;if(o.isBullet){let u=c||"";o.marker=vo(u);return}let f=c;for(let u=0;u<=i;u++){let d=`%${u+1}`;if(f.includes(d)){let m=a[u],y=t.getLevel(r,u),b=Ro(m,y?.numFmt||"decimal");f=f.replace(d,b);}}o.marker=f;}function Ro(e,t){switch(t){case "decimal":case "decimalZero":return String(e);case "lowerLetter":return String.fromCharCode(96+(e-1)%26+1);case "upperLetter":return String.fromCharCode(64+(e-1)%26+1);case "lowerRoman":return Xt(e).toLowerCase();case "upperRoman":return Xt(e);case "bullet":return "\u2022";default:return String(e)}}function Xt(e){let t=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],n="";for(let[o,r]of t)for(;e>=o;)n+=r,e-=o;return n}var It=/\{\{([^{}]+)\}\}/g;function Lt(e){let t=[],n;for(It.lastIndex=0;(n=It.exec(e))!==null;){let o=n[1].trim();o&&!t.includes(o)&&t.push(o);}return t}function Dt(e){let t=[];for(let n of e)if(n.type==="paragraph"){let o=Re(n),r=Lt(o);for(let i of r)t.includes(i)||t.push(i);}else if(n.type==="table"){let o=Ht(n);for(let r of o)t.includes(r)||t.push(r);}return t}function Ht(e){let t=[];for(let n of e.rows)for(let o of n.cells)for(let r of o.content)if(r.type==="paragraph"){let i=Re(r),a=Lt(i);for(let c of a)t.includes(c)||t.push(c);}else if(r.type==="table"){let i=Ht(r);for(let a of i)t.includes(a)||t.push(a);}return t}function Ot(e,t,n,o,r,i){let a=[],c=H(e),f=new Map;for(let u of c){let d=u.name??"";if(d==="w:p"||d.endsWith(":p")){let m=z(u,t,n,o,r,i);Eo(m,o,f),a.push(m);}else if(d==="w:tbl"||d.endsWith(":tbl")){let m=te(u,t,n,o,r,i);a.push(m);}else if(d==="w:sdt"||d.endsWith(":sdt")){let m=(u.elements??[]).find(y=>y.type==="element"&&(y.name==="w:sdtContent"||y.name?.endsWith(":sdtContent")));if(m){let y=Ot(m,t,n,o,r,i);a.push(...y);}}}return a}function Po(e,t){let n=[],o=[];for(let r of e)o.push(r),r.type==="paragraph"&&r.sectionProperties&&(n.push({properties:r.sectionProperties,content:o}),o=[]);return (o.length>0||n.length===0)&&n.push({properties:t??Et(),content:o}),n}function jt(e,t=null,n=null,o=null,r=null,i=null){let a={content:[]};if(!e)return a;let c=V(e);if(!c)return a;let f=(c.elements??[]).find(m=>m.type==="element"&&(m.name==="w:document"||m.name?.endsWith(":document")));if(!f)return a;let u=l(f,"w","body");if(!u)return a;a.content=Ot(u,t,n,o,r,i);let d=l(u,"w","sectPr");return d&&(a.finalSectionProperties=pe(d)),a.sections=Po(a.content,a.finalSectionProperties),a}function Wt(e,t,n,o,r){if(!e)return [];let i=V(e);if(!i)return [];let a=l(i,"w","comments")??i,c=H(a),f=[];for(let u of c){if((u.name?.replace(/^.*:/,"")??"")!=="comment")continue;let m=parseInt(s(u,"w","id")??"0",10),y=s(u,"w","author")??"Unknown",b=s(u,"w","initials")??void 0,p=s(u,"w","date")??void 0,x=[];for(let A of H(u))if((A.name?.replace(/^.*:/,"")??"")==="p"){let R=z(A,t,n,null,o,r);x.push(R);}f.push({id:m,author:y,initials:b,date:p,content:x});}return f}async function ri(e,t={}){let n=e instanceof ArrayBuffer?e:await Xe(e),{onProgress:o=()=>{},preloadFonts:r=true,parseHeadersFooters:i=true,parseNotes:a=true,detectVariables:c=true}=t,f=[];try{let y=function(D,O){let M=performance.now(),S=O(),L=performance.now()-M;return m.push({stage:D,ms:L}),L>1e3&&console.warn(`[parseDocx] ${D} took ${Math.round(L)}ms`),S};var u=y;let d=performance.now(),m=[];async function b(D,O){let M=performance.now(),S=await O(),L=performance.now()-M;return m.push({stage:D,ms:L}),L>1e3&&console.warn(`[parseDocx] ${D} took ${Math.round(L)}ms`),S}o("Extracting DOCX...",0);let p=await b("unzip",()=>Ie(n));o("Extracted DOCX",10),o("Parsing relationships...",10);let x=y("relationships",()=>p.documentRels?ae(p.documentRels):new Map);o("Parsed relationships",15),o("Parsing theme...",15);let A=y("theme",()=>Ve(p.themeXml));o("Parsed theme",20),o("Parsing styles...",20);let E=null,R;y("styles",()=>{p.stylesXml&&(E=Se(p.stylesXml,A),R=Ye(p.stylesXml,A));}),o("Parsed styles",30),o("Parsing numbering...",30);let C=y("numbering",()=>Ke(p.numberingXml));o("Parsed numbering",35),o("Processing media files...",35);let h=y("media",()=>Ao(p,x));o("Processed media",40),o("Parsing document body...",40);let F={content:[]};y("documentBody",()=>{p.documentXml?F=jt(p.documentXml,E,A,C,x,h):f.push("No document.xml found in DOCX");}),o("Parsed document body",55);let w,k;if(i){o("Parsing headers/footers...",55);let D=y("headersFooters",()=>Bo(p,E,A,C,x,h));w=D.headers,k=D.footers,o("Parsed headers/footers",65);}else o("Skipping headers/footers",65);let v,P;if(a){o("Parsing footnotes/endnotes...",65);let D=y("footnotesEndnotes",()=>No(p,E,A,C,x,h));v=D.footnotes,P=D.endnotes,o("Parsed footnotes/endnotes",75);}else o("Skipping footnotes/endnotes",75);o("Parsing comments...",75);let B=y("comments",()=>Wt(p.commentsXml,E,A,x,h));B.length>0&&(F.comments=B);let X;c?(o("Detecting template variables...",75),X=y("variables",()=>Dt(F.content)),o("Detected variables",80)):o("Skipping variable detection",80),r?(o("Loading fonts...",80),await b("fonts",()=>Xo(A,R,F)),o("Loaded fonts",95)):o("Skipping font loading",95),o("Assembling document...",95);let K={package:{document:F,styles:R,theme:A,numbering:C.definitions,headers:w,footers:k,footnotes:v,endnotes:P,relationships:x,media:h},originalBuffer:n,templateVariables:X,warnings:f.length>0?f:void 0},Y=performance.now()-d;if(Y>2e3){let D=m.filter(O=>O.ms>100).map(O=>`${O.stage}: ${Math.round(O.ms)}ms`).join(", ");console.warn(`[parseDocx] Total: ${Math.round(Y)}ms`+(D?` (${D})`:""));}return o("Complete",100),K}catch(d){let m=d instanceof Error?d.message:String(d);throw console.error("[parseDocx] Failed to parse DOCX:",m,d),new Error(`Failed to parse DOCX: ${m}`)}}function Ao(e,t){let n=new Map;for(let[o,r]of e.media.entries()){let i=o.split("/").pop()||o,a=Le(o),c=new Uint8Array(r),f="";for(let b=0;b<c.length;b++)f+=String.fromCharCode(c[b]);let u=btoa(f),d=`data:${a};base64,${u}`,m={path:o,filename:i,mimeType:a,data:r,dataUrl:d};n.set(o,m);let y=o.replace(/^word\//,"");y!==o&&n.set(y,m);}return n}function he(e,t){let n=t.toLowerCase();for(let[o,r]of e.entries())if(o.toLowerCase()===n)return r}function Bo(e,t,n,o,r,i){let a=new Map,c=new Map;for(let[f,u]of r.entries())if(u.type===ie.header&&u.target){let d=u.target.split("/").pop()||u.target,m=he(e.headers,d);if(m){let y=`word/_rels/${d}.rels`,b=he(e.allXml,y),p=b?ae(b):r,x=bt(m,"default",t,n,o,p,i);a.set(f,x);}}else if(u.type===ie.footer&&u.target){let d=u.target.split("/").pop()||u.target,m=he(e.footers,d);if(m){let y=`word/_rels/${d}.rels`,b=he(e.allXml,y),p=b?ae(b):r,x=xt(m,"default",t,n,o,p,i);c.set(f,x);}}return {headers:a,footers:c}}function No(e,t,n,o,r,i){let a=Ft(e.footnotesXml,t,n,o,r,i),c=Ct(e.endnotesXml,t,n,o,r,i);return {footnotes:a.getNormalFootnotes(),endnotes:c.getNormalEndnotes()}}async function Xo(e,t,n){let o=new Set;if(e?.fontScheme){let{majorFont:r,minorFont:i}=e.fontScheme;r?.latin&&o.add(r.latin),i?.latin&&o.add(i.latin);}if(t?.docDefaults?.rPr?.fontFamily?.ascii&&o.add(t.docDefaults.rPr.fontFamily.ascii),t?.styles)for(let r of t.styles)r.rPr?.fontFamily?.ascii&&o.add(r.rPr.fontFamily.ascii),r.rPr?.fontFamily?.hAnsi&&o.add(r.rPr.fontFamily.hAnsi);if(n.content){for(let r of n.content)if(r.type==="paragraph")for(let i of r.content)i.type==="run"&&i.formatting?.fontFamily&&(i.formatting.fontFamily.ascii&&o.add(i.formatting.fontFamily.ascii),i.formatting.fontFamily.hAnsi&&o.add(i.formatting.fontFamily.hAnsi));}if(o.size>0)try{await xe(Array.from(o));}catch(r){console.warn("Failed to load some fonts:",r);}}
11
+ export{ir as a,Ae as b,Vt as c,Io as d,Lo as e,Do as f,Ho as g,Oo as h,jo as i,Wo as j,Vo as k,Xe as l,ri as m};
@@ -1,4 +1,24 @@
1
- import { h as Document, T as TextFormatting, a6 as StyleInfo, k as AgentContext, g as Position, Y as Range, U as ParagraphFormatting, j as AgentCommand, a2 as SelectionContext, D as DocumentBody, a1 as SectionProperties, al as ColorValue, ab as Theme, am as ThemeColorSlot } from './types-XVRXTi4o.js';
1
+ import { h as Document, T as TextFormatting, a6 as StyleInfo, k as AgentContext, g as Position, Y as Range, U as ParagraphFormatting, j as AgentCommand, a2 as SelectionContext, D as DocumentBody, a1 as SectionProperties, al as ColorValue, ab as Theme, am as ThemeColorSlot } from './types-BnShY2aQ.js';
2
+
3
+ /**
4
+ * Flexible input types for DOCX documents.
5
+ *
6
+ * Accepts any common binary format so consumers don't need to manually
7
+ * convert before passing data to the editor or parser.
8
+ */
9
+ /**
10
+ * Any binary representation of a DOCX file that the editor can consume.
11
+ *
12
+ * - `ArrayBuffer` — from `FileReader.readAsArrayBuffer()` or `fetch().arrayBuffer()`
13
+ * - `Uint8Array` — from Node.js `fs.readFile()` or streaming APIs
14
+ * - `Blob` — from drag-and-drop or `<input type="file">`
15
+ * - `File` — subclass of Blob, from `<input type="file">`
16
+ */
17
+ type DocxInput = ArrayBuffer | Uint8Array | Blob | File;
18
+ /**
19
+ * Normalize any {@link DocxInput} into an `ArrayBuffer` for internal use.
20
+ */
21
+ declare function toArrayBuffer(input: DocxInput): Promise<ArrayBuffer>;
2
22
 
3
23
  /**
4
24
  * DocumentAgent - High-level fluent API for programmatic document manipulation
@@ -94,12 +114,12 @@ declare class DocumentAgent {
94
114
  */
95
115
  constructor(source: Document | ArrayBuffer);
96
116
  /**
97
- * Create a DocumentAgent from an ArrayBuffer (async)
117
+ * Create a DocumentAgent from a DOCX buffer (async)
98
118
  *
99
- * @param buffer - DOCX file as ArrayBuffer
119
+ * @param buffer - DOCX file as ArrayBuffer, Uint8Array, Blob, or File
100
120
  * @returns Promise resolving to DocumentAgent
101
121
  */
102
- static fromBuffer(buffer: ArrayBuffer): Promise<DocumentAgent>;
122
+ static fromBuffer(buffer: DocxInput): Promise<DocumentAgent>;
103
123
  /**
104
124
  * Create a DocumentAgent from a Document object
105
125
  *
@@ -598,12 +618,12 @@ interface ParseOptions {
598
618
  /**
599
619
  * Parse a DOCX file into a complete Document model
600
620
  *
601
- * @param buffer - DOCX file as ArrayBuffer
621
+ * @param input - DOCX file as ArrayBuffer, Uint8Array, Blob, or File
602
622
  * @param options - Parsing options
603
623
  * @returns Promise resolving to Document
604
624
  * @throws Error if parsing fails
605
625
  */
606
- declare function parseDocx(buffer: ArrayBuffer, options?: ParseOptions): Promise<Document>;
626
+ declare function parseDocx(input: DocxInput, options?: ParseOptions): Promise<Document>;
607
627
 
608
628
  /**
609
629
  * Document Serializer - Serialize complete document.xml
@@ -1003,4 +1023,4 @@ declare function blendColors(color1: ColorValue | undefined | null, color2: Colo
1003
1023
  */
1004
1024
  declare function colorsEqual(color1: ColorValue | undefined | null, color2: ColorValue | undefined | null, theme: Theme | null | undefined): boolean;
1005
1025
 
1006
- export { resolveColor as $, type AgentContextOptions as A, getDocumentSummary as B, type CreateEmptyDocumentOptions as C, DocumentAgent as D, type ExtendedSelectionContext as E, type FormattedTextSegment as F, getMissingVariables as G, getSelectionFormattingSummary as H, type InsertHyperlinkOptions as I, getTemplateTags as J, halfPointsToPixels as K, isBlack as L, isWhite as M, lightenColor as N, parseColorString as O, type ProcessTemplateOptions as P, parseDocx as Q, pixelsToEmu as R, type SelectionContextOptions$1 as S, type TemplateError as T, pixelsToTwips as U, pointsToPixels as V, previewTemplate as W, processTemplate as X, processTemplateAdvanced as Y, processTemplateAsBlob as Z, processTemplateDetailed as _, type FormattingSummary as a, resolveHighlightColor as a0, resolveShadingColor as a1, serializeDocumentBody as a2, serializeDocument as a3, serializeSectionProperties as a4, twipsToEmu as a5, twipsToPixels as a6, validateTemplate as a7, type InsertImageOptions as b, type InsertTableOptions as c, type InsertTextOptions as d, type ProcessTemplateResult as e, type SelectionContextOptions as f, blendColors as g, buildExtendedSelectionContext as h, buildSelectionContext as i, buildSelectionContext$1 as j, colorsEqual as k, createAgent as l, createAgentFromDocument as m, createDocumentWithText as n, createEmptyDocument as o, createRgbColor as p, createTemplateProcessor as q, createThemeColor as r, darkenColor as s, emuToPixels as t, emuToTwips as u, executeCommand as v, executeCommands as w, formatPx as x, getAgentContext as y, getContrastingColor as z };
1026
+ export { resolveColor as $, type AgentContextOptions as A, getDocumentSummary as B, type CreateEmptyDocumentOptions as C, DocumentAgent as D, type ExtendedSelectionContext as E, type FormattedTextSegment as F, getMissingVariables as G, getSelectionFormattingSummary as H, type InsertHyperlinkOptions as I, getTemplateTags as J, halfPointsToPixels as K, isBlack as L, isWhite as M, lightenColor as N, parseColorString as O, type ProcessTemplateOptions as P, parseDocx as Q, pixelsToEmu as R, type SelectionContextOptions$1 as S, type TemplateError as T, pixelsToTwips as U, pointsToPixels as V, previewTemplate as W, processTemplate as X, processTemplateAdvanced as Y, processTemplateAsBlob as Z, processTemplateDetailed as _, type FormattingSummary as a, resolveHighlightColor as a0, resolveShadingColor as a1, serializeDocumentBody as a2, serializeDocument as a3, serializeSectionProperties as a4, twipsToEmu as a5, twipsToPixels as a6, validateTemplate as a7, type DocxInput as a8, toArrayBuffer as a9, type InsertImageOptions as b, type InsertTableOptions as c, type InsertTextOptions as d, type ProcessTemplateResult as e, type SelectionContextOptions as f, blendColors as g, buildExtendedSelectionContext as h, buildSelectionContext as i, buildSelectionContext$1 as j, colorsEqual as k, createAgent as l, createAgentFromDocument as m, createDocumentWithText as n, createEmptyDocument as o, createRgbColor as p, createTemplateProcessor as q, createThemeColor as r, darkenColor as s, emuToPixels as t, emuToTwips as u, executeCommand as v, executeCommands as w, formatPx as x, getAgentContext as y, getContrastingColor as z };
@@ -1,4 +1,24 @@
1
- import { h as Document, T as TextFormatting, a6 as StyleInfo, k as AgentContext, g as Position, Y as Range, U as ParagraphFormatting, j as AgentCommand, a2 as SelectionContext, D as DocumentBody, a1 as SectionProperties, al as ColorValue, ab as Theme, am as ThemeColorSlot } from './types-XVRXTi4o.cjs';
1
+ import { h as Document, T as TextFormatting, a6 as StyleInfo, k as AgentContext, g as Position, Y as Range, U as ParagraphFormatting, j as AgentCommand, a2 as SelectionContext, D as DocumentBody, a1 as SectionProperties, al as ColorValue, ab as Theme, am as ThemeColorSlot } from './types-BnShY2aQ.cjs';
2
+
3
+ /**
4
+ * Flexible input types for DOCX documents.
5
+ *
6
+ * Accepts any common binary format so consumers don't need to manually
7
+ * convert before passing data to the editor or parser.
8
+ */
9
+ /**
10
+ * Any binary representation of a DOCX file that the editor can consume.
11
+ *
12
+ * - `ArrayBuffer` — from `FileReader.readAsArrayBuffer()` or `fetch().arrayBuffer()`
13
+ * - `Uint8Array` — from Node.js `fs.readFile()` or streaming APIs
14
+ * - `Blob` — from drag-and-drop or `<input type="file">`
15
+ * - `File` — subclass of Blob, from `<input type="file">`
16
+ */
17
+ type DocxInput = ArrayBuffer | Uint8Array | Blob | File;
18
+ /**
19
+ * Normalize any {@link DocxInput} into an `ArrayBuffer` for internal use.
20
+ */
21
+ declare function toArrayBuffer(input: DocxInput): Promise<ArrayBuffer>;
2
22
 
3
23
  /**
4
24
  * DocumentAgent - High-level fluent API for programmatic document manipulation
@@ -94,12 +114,12 @@ declare class DocumentAgent {
94
114
  */
95
115
  constructor(source: Document | ArrayBuffer);
96
116
  /**
97
- * Create a DocumentAgent from an ArrayBuffer (async)
117
+ * Create a DocumentAgent from a DOCX buffer (async)
98
118
  *
99
- * @param buffer - DOCX file as ArrayBuffer
119
+ * @param buffer - DOCX file as ArrayBuffer, Uint8Array, Blob, or File
100
120
  * @returns Promise resolving to DocumentAgent
101
121
  */
102
- static fromBuffer(buffer: ArrayBuffer): Promise<DocumentAgent>;
122
+ static fromBuffer(buffer: DocxInput): Promise<DocumentAgent>;
103
123
  /**
104
124
  * Create a DocumentAgent from a Document object
105
125
  *
@@ -598,12 +618,12 @@ interface ParseOptions {
598
618
  /**
599
619
  * Parse a DOCX file into a complete Document model
600
620
  *
601
- * @param buffer - DOCX file as ArrayBuffer
621
+ * @param input - DOCX file as ArrayBuffer, Uint8Array, Blob, or File
602
622
  * @param options - Parsing options
603
623
  * @returns Promise resolving to Document
604
624
  * @throws Error if parsing fails
605
625
  */
606
- declare function parseDocx(buffer: ArrayBuffer, options?: ParseOptions): Promise<Document>;
626
+ declare function parseDocx(input: DocxInput, options?: ParseOptions): Promise<Document>;
607
627
 
608
628
  /**
609
629
  * Document Serializer - Serialize complete document.xml
@@ -1003,4 +1023,4 @@ declare function blendColors(color1: ColorValue | undefined | null, color2: Colo
1003
1023
  */
1004
1024
  declare function colorsEqual(color1: ColorValue | undefined | null, color2: ColorValue | undefined | null, theme: Theme | null | undefined): boolean;
1005
1025
 
1006
- export { resolveColor as $, type AgentContextOptions as A, getDocumentSummary as B, type CreateEmptyDocumentOptions as C, DocumentAgent as D, type ExtendedSelectionContext as E, type FormattedTextSegment as F, getMissingVariables as G, getSelectionFormattingSummary as H, type InsertHyperlinkOptions as I, getTemplateTags as J, halfPointsToPixels as K, isBlack as L, isWhite as M, lightenColor as N, parseColorString as O, type ProcessTemplateOptions as P, parseDocx as Q, pixelsToEmu as R, type SelectionContextOptions$1 as S, type TemplateError as T, pixelsToTwips as U, pointsToPixels as V, previewTemplate as W, processTemplate as X, processTemplateAdvanced as Y, processTemplateAsBlob as Z, processTemplateDetailed as _, type FormattingSummary as a, resolveHighlightColor as a0, resolveShadingColor as a1, serializeDocumentBody as a2, serializeDocument as a3, serializeSectionProperties as a4, twipsToEmu as a5, twipsToPixels as a6, validateTemplate as a7, type InsertImageOptions as b, type InsertTableOptions as c, type InsertTextOptions as d, type ProcessTemplateResult as e, type SelectionContextOptions as f, blendColors as g, buildExtendedSelectionContext as h, buildSelectionContext as i, buildSelectionContext$1 as j, colorsEqual as k, createAgent as l, createAgentFromDocument as m, createDocumentWithText as n, createEmptyDocument as o, createRgbColor as p, createTemplateProcessor as q, createThemeColor as r, darkenColor as s, emuToPixels as t, emuToTwips as u, executeCommand as v, executeCommands as w, formatPx as x, getAgentContext as y, getContrastingColor as z };
1026
+ export { resolveColor as $, type AgentContextOptions as A, getDocumentSummary as B, type CreateEmptyDocumentOptions as C, DocumentAgent as D, type ExtendedSelectionContext as E, type FormattedTextSegment as F, getMissingVariables as G, getSelectionFormattingSummary as H, type InsertHyperlinkOptions as I, getTemplateTags as J, halfPointsToPixels as K, isBlack as L, isWhite as M, lightenColor as N, parseColorString as O, type ProcessTemplateOptions as P, parseDocx as Q, pixelsToEmu as R, type SelectionContextOptions$1 as S, type TemplateError as T, pixelsToTwips as U, pointsToPixels as V, previewTemplate as W, processTemplate as X, processTemplateAdvanced as Y, processTemplateAsBlob as Z, processTemplateDetailed as _, type FormattingSummary as a, resolveHighlightColor as a0, resolveShadingColor as a1, serializeDocumentBody as a2, serializeDocument as a3, serializeSectionProperties as a4, twipsToEmu as a5, twipsToPixels as a6, validateTemplate as a7, type DocxInput as a8, toArrayBuffer as a9, type InsertImageOptions as b, type InsertTableOptions as c, type InsertTextOptions as d, type ProcessTemplateResult as e, type SelectionContextOptions as f, blendColors as g, buildExtendedSelectionContext as h, buildSelectionContext as i, buildSelectionContext$1 as j, colorsEqual as k, createAgent as l, createAgentFromDocument as m, createDocumentWithText as n, createEmptyDocument as o, createRgbColor as p, createTemplateProcessor as q, createThemeColor as r, darkenColor as s, emuToPixels as t, emuToTwips as u, executeCommand as v, executeCommands as w, formatPx as x, getAgentContext as y, getContrastingColor as z };
@@ -1 +1 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkD2GERZ7M_cjs=require('./chunk-D2GERZ7M.cjs');require('./chunk-DQHQWQHL.cjs');var chunkXVFMG77A_cjs=require('./chunk-XVFMG77A.cjs');require('./chunk-RTESADL3.cjs');Object.defineProperty(exports,"docxtemplaterPlugin",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.x}});Object.defineProperty(exports,"isZodSchema",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.w}});Object.defineProperty(exports,"PluginRegistry",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.a}});Object.defineProperty(exports,"createPluginRegistrar",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.d}});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.b}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.b}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.c}});
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkZRXLWSRP_cjs=require('./chunk-ZRXLWSRP.cjs');require('./chunk-CDSUWDYP.cjs');var chunkXVFMG77A_cjs=require('./chunk-XVFMG77A.cjs');require('./chunk-RTESADL3.cjs');Object.defineProperty(exports,"docxtemplaterPlugin",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.x}});Object.defineProperty(exports,"isZodSchema",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.w}});Object.defineProperty(exports,"PluginRegistry",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.a}});Object.defineProperty(exports,"createPluginRegistrar",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.d}});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.b}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.b}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.c}});
@@ -1,6 +1,6 @@
1
- import { C as CorePlugin } from './types-XVRXTi4o.cjs';
2
- export { b as CommandHandler, o as CommandResult, aF as ExtractCommand, J as JsonSchema, y as LoadedDocument, d as McpSession, z as McpToolAnnotations, G as McpToolContent, K as McpToolContext, M as McpToolDefinition, aG as McpToolExample, N as McpToolHandler, O as McpToolResult, W as PluginCommand, b as PluginCommandHandler, X as PluginEvent, c as PluginEventListener, P as PluginOptions, a as PluginRegistrationResult, M as ToolDefinition, N as ToolHandler, O as ToolResult, aH as TypedCommandHandler, ac as ZodSchemaLike, ak as isZodSchema } from './types-XVRXTi4o.cjs';
3
- export { P as PluginRegistry, c as createPluginRegistrar, p as default, p as pluginRegistry, r as registerPlugins } from './registry-BWDZlJx6.cjs';
1
+ import { C as CorePlugin } from './types-BnShY2aQ.cjs';
2
+ export { b as CommandHandler, o as CommandResult, aF as ExtractCommand, J as JsonSchema, y as LoadedDocument, d as McpSession, z as McpToolAnnotations, G as McpToolContent, K as McpToolContext, M as McpToolDefinition, aG as McpToolExample, N as McpToolHandler, O as McpToolResult, W as PluginCommand, b as PluginCommandHandler, X as PluginEvent, c as PluginEventListener, P as PluginOptions, a as PluginRegistrationResult, M as ToolDefinition, N as ToolHandler, O as ToolResult, aH as TypedCommandHandler, ac as ZodSchemaLike, ak as isZodSchema } from './types-BnShY2aQ.cjs';
3
+ export { P as PluginRegistry, c as createPluginRegistrar, p as default, p as pluginRegistry, r as registerPlugins } from './registry-CrAzNdUO.cjs';
4
4
 
5
5
  /**
6
6
  * Docxtemplater Plugin
@@ -1,6 +1,6 @@
1
- import { C as CorePlugin } from './types-XVRXTi4o.js';
2
- export { b as CommandHandler, o as CommandResult, aF as ExtractCommand, J as JsonSchema, y as LoadedDocument, d as McpSession, z as McpToolAnnotations, G as McpToolContent, K as McpToolContext, M as McpToolDefinition, aG as McpToolExample, N as McpToolHandler, O as McpToolResult, W as PluginCommand, b as PluginCommandHandler, X as PluginEvent, c as PluginEventListener, P as PluginOptions, a as PluginRegistrationResult, M as ToolDefinition, N as ToolHandler, O as ToolResult, aH as TypedCommandHandler, ac as ZodSchemaLike, ak as isZodSchema } from './types-XVRXTi4o.js';
3
- export { P as PluginRegistry, c as createPluginRegistrar, p as default, p as pluginRegistry, r as registerPlugins } from './registry-DifIQR1O.js';
1
+ import { C as CorePlugin } from './types-BnShY2aQ.js';
2
+ export { b as CommandHandler, o as CommandResult, aF as ExtractCommand, J as JsonSchema, y as LoadedDocument, d as McpSession, z as McpToolAnnotations, G as McpToolContent, K as McpToolContext, M as McpToolDefinition, aG as McpToolExample, N as McpToolHandler, O as McpToolResult, W as PluginCommand, b as PluginCommandHandler, X as PluginEvent, c as PluginEventListener, P as PluginOptions, a as PluginRegistrationResult, M as ToolDefinition, N as ToolHandler, O as ToolResult, aH as TypedCommandHandler, ac as ZodSchemaLike, ak as isZodSchema } from './types-BnShY2aQ.js';
3
+ export { P as PluginRegistry, c as createPluginRegistrar, p as default, p as pluginRegistry, r as registerPlugins } from './registry-aux2uuQs.js';
4
4
 
5
5
  /**
6
6
  * Docxtemplater Plugin
@@ -1 +1 @@
1
- export{x as docxtemplaterPlugin,w as isZodSchema}from'./chunk-AOL255XD.js';import'./chunk-I2C6ENCR.js';export{a as PluginRegistry,d as createPluginRegistrar,b as default,b as pluginRegistry,c as registerPlugins}from'./chunk-QHWHCIUW.js';import'./chunk-3IYNTJO5.js';
1
+ export{x as docxtemplaterPlugin,w as isZodSchema}from'./chunk-VFBM3YKJ.js';import'./chunk-ZZNWTYMW.js';export{a as PluginRegistry,d as createPluginRegistrar,b as default,b as pluginRegistry,c as registerPlugins}from'./chunk-QHWHCIUW.js';import'./chunk-3IYNTJO5.js';
package/dist/headless.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkFXILBPZI_cjs=require('./chunk-FXILBPZI.cjs'),chunkD2GERZ7M_cjs=require('./chunk-D2GERZ7M.cjs'),chunkTL3YTVN2_cjs=require('./chunk-TL3YTVN2.cjs'),chunkDQHQWQHL_cjs=require('./chunk-DQHQWQHL.cjs'),chunkFOU7PS3K_cjs=require('./chunk-FOU7PS3K.cjs'),chunkXVFMG77A_cjs=require('./chunk-XVFMG77A.cjs');require('./chunk-RTESADL3.cjs');function p(n){let e=[];for(let t of n.content)t.type==="run"?e.push(c(t)):t.type==="hyperlink"&&e.push(g(t));return e.join("")}function c(n){return n.content.filter(e=>e.type==="text").map(e=>e.text).join("")}function g(n){let e=[];for(let t of n.children)t.type==="run"&&e.push(c(t));return e.join("")}function x(n){let e=[];for(let t of n.rows)for(let o of t.cells)for(let r of o.content)r.type==="paragraph"&&e.push(p(r));return e.join(" ")}function Me(n){let e=[];for(let t of n.content)t.type==="paragraph"?e.push(p(t)):t.type==="table"&&e.push(x(t));return e.join(`
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkPYAIJMEG_cjs=require('./chunk-PYAIJMEG.cjs'),chunkZRXLWSRP_cjs=require('./chunk-ZRXLWSRP.cjs'),chunkTL3YTVN2_cjs=require('./chunk-TL3YTVN2.cjs'),chunkCDSUWDYP_cjs=require('./chunk-CDSUWDYP.cjs'),chunkFOU7PS3K_cjs=require('./chunk-FOU7PS3K.cjs'),chunkXVFMG77A_cjs=require('./chunk-XVFMG77A.cjs');require('./chunk-RTESADL3.cjs');function p(n){let e=[];for(let t of n.content)t.type==="run"?e.push(c(t)):t.type==="hyperlink"&&e.push(g(t));return e.join("")}function c(n){return n.content.filter(e=>e.type==="text").map(e=>e.text).join("")}function g(n){let e=[];for(let t of n.children)t.type==="run"&&e.push(c(t));return e.join("")}function x(n){let e=[];for(let t of n.rows)for(let o of t.cells)for(let r of o.content)r.type==="paragraph"&&e.push(p(r));return e.join(" ")}function Me(n){let e=[];for(let t of n.content)t.type==="paragraph"?e.push(p(t)):t.type==="table"&&e.push(x(t));return e.join(`
2
2
  `)}function f(n){return n.split(/\s+/).filter(t=>t.length>0).length}function je(n,e=true){return e?n.length:n.replace(/\s/g,"").length}function We(n){let e=0;for(let t of n.content)t.type==="paragraph"?e+=f(p(t)):t.type==="table"&&(e+=ze(t));return e}function ze(n){let e=0;for(let t of n.rows)for(let o of t.cells)for(let r of o.content)r.type==="paragraph"&&(e+=f(p(r)));return e}function Ne(n){let e=0;for(let t of n.content)t.type==="paragraph"?e+=p(t).length:t.type==="table"&&(e+=qe(t));return e}function qe(n){let e=0;for(let t of n.rows)for(let o of t.cells)for(let r of o.content)r.type==="paragraph"&&(e+=p(r).length);return e}function Ze(n,e,t){let o=[],r=0,i=n[e.paragraphIndex];if(i){let s=p(i).slice(0,e.offset);o.unshift(s),r+=s.length;}for(let l=e.paragraphIndex-1;l>=0&&r<t;l--){let s=n[l];if(!s)continue;let u=p(s);o.unshift(u),r+=u.length;}let a=o.join(`
3
3
  `);return a.length>t?"..."+a.slice(-t):a}function _e(n,e,t){let o=[],r=0,i=n[e.paragraphIndex];if(i){let s=p(i).slice(e.offset);o.push(s),r+=s.length;}for(let l=e.paragraphIndex+1;l<n.length&&r<t;l++){let s=n[l];if(!s)continue;let u=p(s);o.push(u),r+=u.length;}let a=o.join(`
4
- `);return a.length>t?a.slice(0,t)+"...":a}function Je(n,e){let t=0;for(let o of n.content)if(o.type==="run"){let r=c(o),i=t+r.length;if(e>=t&&e<i)return o.formatting||{};t=i;}else if(o.type==="hyperlink"){let r=g(o),i=t+r.length;if(e>=t&&e<i){for(let a of o.children)if(a.type==="run")return a.formatting||{}}t=i;}return {}}function Ue(n,e){let t=0;for(let o of n.content)if(o.type==="run"){let r=c(o);t+=r.length;}else if(o.type==="hyperlink"){let r=g(o),i=t,a=t+r.length;if(e>=i&&e<a)return true;t=a;}return false}function Ge(n,e){let t=0;for(let o of n.content)if(o.type==="run"){let r=c(o);t+=r.length;}else if(o.type==="hyperlink"){let r=g(o),i=t,a=t+r.length;if(e>=i&&e<a)return o;t=a;}}function Ke(n){return n?n.toLowerCase().includes("heading"):false}function Qe(n){if(!n)return;let e=n.match(/heading\s*(\d)/i);if(e)return parseInt(e[1],10)}function Xe(n){for(let e of n.content)if(e.type==="paragraph"){for(let t of e.content)if(t.type==="run"){for(let o of t.content)if(o.type==="drawing")return true}}return false}function Ye(n){for(let e of n.content)if(e.type==="paragraph"){for(let t of e.content)if(t.type==="hyperlink")return true}return false}function $e(n){return n.content.some(e=>e.type==="table")}function y(n){return n.content.filter(e=>e.type==="paragraph")}function et(n,e){return y(n)[e]}function tt(n,e){let t=0;for(let o=0;o<n.content.length;o++)if(n.content[o].type==="paragraph"){if(t===e)return o;t++;}return -1}var ot="0.0.2";Object.defineProperty(exports,"DEFAULT_AI_ACTIONS",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.P}});Object.defineProperty(exports,"DocumentAgent",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.y}});Object.defineProperty(exports,"blendColors",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.l}});Object.defineProperty(exports,"buildExtendedSelectionContext",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.F}});Object.defineProperty(exports,"buildSelectionContext",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.E}});Object.defineProperty(exports,"buildSelectionContextFromContext",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.C}});Object.defineProperty(exports,"colorsEqual",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.m}});Object.defineProperty(exports,"comparePositions",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.M}});Object.defineProperty(exports,"createAgent",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.z}});Object.defineProperty(exports,"createAgentFromDocument",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.A}});Object.defineProperty(exports,"createCollapsedRange",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.J}});Object.defineProperty(exports,"createCommand",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.Q}});Object.defineProperty(exports,"createDocumentWithText",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.I}});Object.defineProperty(exports,"createEmptyDocument",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.H}});Object.defineProperty(exports,"createRange",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.K}});Object.defineProperty(exports,"createRgbColor",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.i}});Object.defineProperty(exports,"createThemeColor",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.h}});Object.defineProperty(exports,"darkenColor",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.j}});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.y}});Object.defineProperty(exports,"emuToPixels",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.p}});Object.defineProperty(exports,"emuToTwips",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.r}});Object.defineProperty(exports,"formatPx",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.x}});Object.defineProperty(exports,"getActionDescription",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.O}});Object.defineProperty(exports,"getActionLabel",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.N}});Object.defineProperty(exports,"getAgentContext",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.B}});Object.defineProperty(exports,"getContrastingColor",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.f}});Object.defineProperty(exports,"getDocumentSummary",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.D}});Object.defineProperty(exports,"getSelectionFormattingSummary",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.G}});Object.defineProperty(exports,"halfPointsToPixels",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.u}});Object.defineProperty(exports,"isBlack",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.d}});Object.defineProperty(exports,"isPositionInRange",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.L}});Object.defineProperty(exports,"isWhite",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.e}});Object.defineProperty(exports,"lightenColor",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.k}});Object.defineProperty(exports,"parseColorString",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.g}});Object.defineProperty(exports,"pixelsToEmu",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.q}});Object.defineProperty(exports,"pixelsToTwips",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.o}});Object.defineProperty(exports,"pointsToPixels",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.t}});Object.defineProperty(exports,"resolveColor",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.a}});Object.defineProperty(exports,"resolveHighlightColor",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.b}});Object.defineProperty(exports,"resolveShadingColor",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.c}});Object.defineProperty(exports,"twipsToEmu",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.s}});Object.defineProperty(exports,"twipsToPixels",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.n}});Object.defineProperty(exports,"createTemplateProcessor",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.v}});Object.defineProperty(exports,"detectVariables",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.a}});Object.defineProperty(exports,"detectVariablesDetailed",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.b}});Object.defineProperty(exports,"detectVariablesInBody",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.c}});Object.defineProperty(exports,"detectVariablesInParagraph",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.d}});Object.defineProperty(exports,"documentHasVariables",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.m}});Object.defineProperty(exports,"extractVariablesFromText",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.e}});Object.defineProperty(exports,"formatVariable",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.i}});Object.defineProperty(exports,"getMissingVariables",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.s}});Object.defineProperty(exports,"getTemplateTags",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.q}});Object.defineProperty(exports,"hasTemplateVariables",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.f}});Object.defineProperty(exports,"isValidVariableName",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.g}});Object.defineProperty(exports,"isZodSchema",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.w}});Object.defineProperty(exports,"parseVariable",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.j}});Object.defineProperty(exports,"previewTemplate",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.t}});Object.defineProperty(exports,"processTemplate",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.n}});Object.defineProperty(exports,"processTemplateAdvanced",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.u}});Object.defineProperty(exports,"processTemplateAsBlob",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.p}});Object.defineProperty(exports,"processTemplateDetailed",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.o}});Object.defineProperty(exports,"removeVariables",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.l}});Object.defineProperty(exports,"replaceVariables",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.k}});Object.defineProperty(exports,"sanitizeVariableName",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.h}});Object.defineProperty(exports,"validateTemplate",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.r}});Object.defineProperty(exports,"createDocx",{enumerable:true,get:function(){return chunkTL3YTVN2_cjs.e}});Object.defineProperty(exports,"repackDocx",{enumerable:true,get:function(){return chunkTL3YTVN2_cjs.d}});Object.defineProperty(exports,"serializeDocumentBody",{enumerable:true,get:function(){return chunkTL3YTVN2_cjs.b}});Object.defineProperty(exports,"serializeDocx",{enumerable:true,get:function(){return chunkTL3YTVN2_cjs.c}});Object.defineProperty(exports,"serializeSectionProperties",{enumerable:true,get:function(){return chunkTL3YTVN2_cjs.a}});Object.defineProperty(exports,"parseDocx",{enumerable:true,get:function(){return chunkDQHQWQHL_cjs.l}});Object.defineProperty(exports,"executeCommand",{enumerable:true,get:function(){return chunkFOU7PS3K_cjs.a}});Object.defineProperty(exports,"executeCommands",{enumerable:true,get:function(){return chunkFOU7PS3K_cjs.b}});Object.defineProperty(exports,"PluginRegistry",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.a}});Object.defineProperty(exports,"createPluginRegistrar",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.d}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.b}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.c}});exports.VERSION=ot;exports.countCharacters=je;exports.countWords=f;exports.getBlockIndexForParagraph=tt;exports.getBodyCharacterCount=Ne;exports.getBodyText=Me;exports.getBodyWordCount=We;exports.getFormattingAtPosition=Je;exports.getHyperlinkAtPosition=Ge;exports.getHyperlinkText=g;exports.getParagraphAtIndex=et;exports.getParagraphText=p;exports.getParagraphs=y;exports.getRunText=c;exports.getTableText=x;exports.getTextAfter=_e;exports.getTextBefore=Ze;exports.hasHyperlinks=Ye;exports.hasImages=Xe;exports.hasTables=$e;exports.isHeadingStyle=Ke;exports.isPositionInHyperlink=Ue;exports.parseHeadingLevel=Qe;
4
+ `);return a.length>t?a.slice(0,t)+"...":a}function Je(n,e){let t=0;for(let o of n.content)if(o.type==="run"){let r=c(o),i=t+r.length;if(e>=t&&e<i)return o.formatting||{};t=i;}else if(o.type==="hyperlink"){let r=g(o),i=t+r.length;if(e>=t&&e<i){for(let a of o.children)if(a.type==="run")return a.formatting||{}}t=i;}return {}}function Ue(n,e){let t=0;for(let o of n.content)if(o.type==="run"){let r=c(o);t+=r.length;}else if(o.type==="hyperlink"){let r=g(o),i=t,a=t+r.length;if(e>=i&&e<a)return true;t=a;}return false}function Ge(n,e){let t=0;for(let o of n.content)if(o.type==="run"){let r=c(o);t+=r.length;}else if(o.type==="hyperlink"){let r=g(o),i=t,a=t+r.length;if(e>=i&&e<a)return o;t=a;}}function Ke(n){return n?n.toLowerCase().includes("heading"):false}function Qe(n){if(!n)return;let e=n.match(/heading\s*(\d)/i);if(e)return parseInt(e[1],10)}function Xe(n){for(let e of n.content)if(e.type==="paragraph"){for(let t of e.content)if(t.type==="run"){for(let o of t.content)if(o.type==="drawing")return true}}return false}function Ye(n){for(let e of n.content)if(e.type==="paragraph"){for(let t of e.content)if(t.type==="hyperlink")return true}return false}function $e(n){return n.content.some(e=>e.type==="table")}function y(n){return n.content.filter(e=>e.type==="paragraph")}function et(n,e){return y(n)[e]}function tt(n,e){let t=0;for(let o=0;o<n.content.length;o++)if(n.content[o].type==="paragraph"){if(t===e)return o;t++;}return -1}var ot="0.0.2";Object.defineProperty(exports,"DEFAULT_AI_ACTIONS",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.P}});Object.defineProperty(exports,"DocumentAgent",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.y}});Object.defineProperty(exports,"blendColors",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.l}});Object.defineProperty(exports,"buildExtendedSelectionContext",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.F}});Object.defineProperty(exports,"buildSelectionContext",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.E}});Object.defineProperty(exports,"buildSelectionContextFromContext",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.C}});Object.defineProperty(exports,"colorsEqual",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.m}});Object.defineProperty(exports,"comparePositions",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.M}});Object.defineProperty(exports,"createAgent",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.z}});Object.defineProperty(exports,"createAgentFromDocument",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.A}});Object.defineProperty(exports,"createCollapsedRange",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.J}});Object.defineProperty(exports,"createCommand",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.Q}});Object.defineProperty(exports,"createDocumentWithText",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.I}});Object.defineProperty(exports,"createEmptyDocument",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.H}});Object.defineProperty(exports,"createRange",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.K}});Object.defineProperty(exports,"createRgbColor",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.i}});Object.defineProperty(exports,"createThemeColor",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.h}});Object.defineProperty(exports,"darkenColor",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.j}});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.y}});Object.defineProperty(exports,"emuToPixels",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.p}});Object.defineProperty(exports,"emuToTwips",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.r}});Object.defineProperty(exports,"formatPx",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.x}});Object.defineProperty(exports,"getActionDescription",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.O}});Object.defineProperty(exports,"getActionLabel",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.N}});Object.defineProperty(exports,"getAgentContext",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.B}});Object.defineProperty(exports,"getContrastingColor",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.f}});Object.defineProperty(exports,"getDocumentSummary",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.D}});Object.defineProperty(exports,"getSelectionFormattingSummary",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.G}});Object.defineProperty(exports,"halfPointsToPixels",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.u}});Object.defineProperty(exports,"isBlack",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.d}});Object.defineProperty(exports,"isPositionInRange",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.L}});Object.defineProperty(exports,"isWhite",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.e}});Object.defineProperty(exports,"lightenColor",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.k}});Object.defineProperty(exports,"parseColorString",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.g}});Object.defineProperty(exports,"pixelsToEmu",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.q}});Object.defineProperty(exports,"pixelsToTwips",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.o}});Object.defineProperty(exports,"pointsToPixels",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.t}});Object.defineProperty(exports,"resolveColor",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.a}});Object.defineProperty(exports,"resolveHighlightColor",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.b}});Object.defineProperty(exports,"resolveShadingColor",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.c}});Object.defineProperty(exports,"twipsToEmu",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.s}});Object.defineProperty(exports,"twipsToPixels",{enumerable:true,get:function(){return chunkPYAIJMEG_cjs.n}});Object.defineProperty(exports,"createTemplateProcessor",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.v}});Object.defineProperty(exports,"detectVariables",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.a}});Object.defineProperty(exports,"detectVariablesDetailed",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.b}});Object.defineProperty(exports,"detectVariablesInBody",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.c}});Object.defineProperty(exports,"detectVariablesInParagraph",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.d}});Object.defineProperty(exports,"documentHasVariables",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.m}});Object.defineProperty(exports,"extractVariablesFromText",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.e}});Object.defineProperty(exports,"formatVariable",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.i}});Object.defineProperty(exports,"getMissingVariables",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.s}});Object.defineProperty(exports,"getTemplateTags",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.q}});Object.defineProperty(exports,"hasTemplateVariables",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.f}});Object.defineProperty(exports,"isValidVariableName",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.g}});Object.defineProperty(exports,"isZodSchema",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.w}});Object.defineProperty(exports,"parseVariable",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.j}});Object.defineProperty(exports,"previewTemplate",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.t}});Object.defineProperty(exports,"processTemplate",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.n}});Object.defineProperty(exports,"processTemplateAdvanced",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.u}});Object.defineProperty(exports,"processTemplateAsBlob",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.p}});Object.defineProperty(exports,"processTemplateDetailed",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.o}});Object.defineProperty(exports,"removeVariables",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.l}});Object.defineProperty(exports,"replaceVariables",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.k}});Object.defineProperty(exports,"sanitizeVariableName",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.h}});Object.defineProperty(exports,"validateTemplate",{enumerable:true,get:function(){return chunkZRXLWSRP_cjs.r}});Object.defineProperty(exports,"createDocx",{enumerable:true,get:function(){return chunkTL3YTVN2_cjs.e}});Object.defineProperty(exports,"repackDocx",{enumerable:true,get:function(){return chunkTL3YTVN2_cjs.d}});Object.defineProperty(exports,"serializeDocumentBody",{enumerable:true,get:function(){return chunkTL3YTVN2_cjs.b}});Object.defineProperty(exports,"serializeDocx",{enumerable:true,get:function(){return chunkTL3YTVN2_cjs.c}});Object.defineProperty(exports,"serializeSectionProperties",{enumerable:true,get:function(){return chunkTL3YTVN2_cjs.a}});Object.defineProperty(exports,"parseDocx",{enumerable:true,get:function(){return chunkCDSUWDYP_cjs.m}});Object.defineProperty(exports,"executeCommand",{enumerable:true,get:function(){return chunkFOU7PS3K_cjs.a}});Object.defineProperty(exports,"executeCommands",{enumerable:true,get:function(){return chunkFOU7PS3K_cjs.b}});Object.defineProperty(exports,"PluginRegistry",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.a}});Object.defineProperty(exports,"createPluginRegistrar",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.d}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.b}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.c}});exports.VERSION=ot;exports.countCharacters=je;exports.countWords=f;exports.getBlockIndexForParagraph=tt;exports.getBodyCharacterCount=Ne;exports.getBodyText=Me;exports.getBodyWordCount=We;exports.getFormattingAtPosition=Je;exports.getHyperlinkAtPosition=Ge;exports.getHyperlinkText=g;exports.getParagraphAtIndex=et;exports.getParagraphText=p;exports.getParagraphs=y;exports.getRunText=c;exports.getTableText=x;exports.getTextAfter=_e;exports.getTextBefore=Ze;exports.hasHyperlinks=Ye;exports.hasImages=Xe;exports.hasTables=$e;exports.isHeadingStyle=Ke;exports.isPositionInHyperlink=Ue;exports.parseHeadingLevel=Qe;
@@ -1,7 +1,7 @@
1
- export { A as AgentContextOptions, S as ContextSelectionOptions, C as CreateEmptyDocumentOptions, D as DocumentAgent, E as ExtendedSelectionContext, F as FormattedTextSegment, a as FormattingSummary, I as InsertHyperlinkOptions, b as InsertImageOptions, c as InsertTableOptions, d as InsertTextOptions, P as ProcessTemplateOptions, e as ProcessTemplateResult, f as SelectionContextOptions, T as TemplateError, g as blendColors, h as buildExtendedSelectionContext, i as buildSelectionContext, j as buildSelectionContextFromContext, k as colorsEqual, l as createAgent, m as createAgentFromDocument, n as createDocumentWithText, o as createEmptyDocument, p as createRgbColor, q as createTemplateProcessor, r as createThemeColor, s as darkenColor, D as default, t as emuToPixels, u as emuToTwips, v as executeCommand, w as executeCommands, x as formatPx, y as getAgentContext, z as getContrastingColor, B as getDocumentSummary, G as getMissingVariables, H as getSelectionFormattingSummary, J as getTemplateTags, K as halfPointsToPixels, L as isBlack, M as isWhite, N as lightenColor, O as parseColorString, Q as parseDocx, R as pixelsToEmu, U as pixelsToTwips, V as pointsToPixels, W as previewTemplate, X as processTemplate, Y as processTemplateAdvanced, Z as processTemplateAsBlob, _ as processTemplateDetailed, $ as resolveColor, a0 as resolveHighlightColor, a1 as resolveShadingColor, a2 as serializeDocumentBody, a3 as serializeDocx, a4 as serializeSectionProperties, a5 as twipsToEmu, a6 as twipsToPixels, a7 as validateTemplate } from './colorResolver-WsUxFs5p.cjs';
2
- import { D as DocumentBody, e as Paragraph, T as TextFormatting, H as Hyperlink, R as Run, f as Table, g as Position, h as Document } from './types-XVRXTi4o.cjs';
3
- export { A as AIAction, i as AIActionRequest, j as AgentCommand, k as AgentContext, l as AgentResponse, m as ApplyStyleCommand, n as ApplyVariablesCommand, B as BlockContent, b as CommandHandler, o as CommandResult, C as CorePlugin, p as DEFAULT_AI_ACTIONS, q as DeleteTextCommand, r as DocxPackage, E as Endnote, F as Footnote, s as FormatParagraphCommand, t as FormatTextCommand, I as Image, u as InsertHyperlinkCommand, v as InsertImageCommand, w as InsertTableCommand, x as InsertTextCommand, J as JsonSchema, L as ListLevel, y as LoadedDocument, d as McpSession, z as McpToolAnnotations, G as McpToolContent, K as McpToolContext, M as McpToolDefinition, N as McpToolHandler, O as McpToolResult, Q as NumberingDefinitions, S as ParagraphContext, U as ParagraphFormatting, V as ParagraphOutline, C as Plugin, W as PluginCommand, b as PluginCommandHandler, X as PluginEvent, c as PluginEventListener, P as PluginOptions, a as PluginRegistrationResult, Y as Range, Z as Relationship, _ as ReplaceTextCommand, $ as RunContent, a0 as SectionInfo, a1 as SectionProperties, a2 as SelectionContext, a3 as SetVariableCommand, a4 as Style, a5 as StyleDefinitions, a6 as StyleInfo, a7 as SuggestedAction, a8 as TableCell, a9 as TableRow, aa as TextContent, ab as Theme, M as ToolDefinition, N as ToolHandler, O as ToolResult, ac as ZodSchemaLike, ad as comparePositions, ae as createCollapsedRange, af as createCommand, ag as createRange, ah as getActionDescription, ai as getActionLabel, aj as isPositionInRange, ak as isZodSchema } from './types-XVRXTi4o.cjs';
4
- export { P as PluginRegistry, c as createPluginRegistrar, p as pluginRegistry, r as registerPlugins } from './registry-BWDZlJx6.cjs';
1
+ export { A as AgentContextOptions, S as ContextSelectionOptions, C as CreateEmptyDocumentOptions, D as DocumentAgent, E as ExtendedSelectionContext, F as FormattedTextSegment, a as FormattingSummary, I as InsertHyperlinkOptions, b as InsertImageOptions, c as InsertTableOptions, d as InsertTextOptions, P as ProcessTemplateOptions, e as ProcessTemplateResult, f as SelectionContextOptions, T as TemplateError, g as blendColors, h as buildExtendedSelectionContext, i as buildSelectionContext, j as buildSelectionContextFromContext, k as colorsEqual, l as createAgent, m as createAgentFromDocument, n as createDocumentWithText, o as createEmptyDocument, p as createRgbColor, q as createTemplateProcessor, r as createThemeColor, s as darkenColor, D as default, t as emuToPixels, u as emuToTwips, v as executeCommand, w as executeCommands, x as formatPx, y as getAgentContext, z as getContrastingColor, B as getDocumentSummary, G as getMissingVariables, H as getSelectionFormattingSummary, J as getTemplateTags, K as halfPointsToPixels, L as isBlack, M as isWhite, N as lightenColor, O as parseColorString, Q as parseDocx, R as pixelsToEmu, U as pixelsToTwips, V as pointsToPixels, W as previewTemplate, X as processTemplate, Y as processTemplateAdvanced, Z as processTemplateAsBlob, _ as processTemplateDetailed, $ as resolveColor, a0 as resolveHighlightColor, a1 as resolveShadingColor, a2 as serializeDocumentBody, a3 as serializeDocx, a4 as serializeSectionProperties, a5 as twipsToEmu, a6 as twipsToPixels, a7 as validateTemplate } from './colorResolver-Di-JRsr9.cjs';
2
+ import { D as DocumentBody, e as Paragraph, T as TextFormatting, H as Hyperlink, R as Run, f as Table, g as Position, h as Document } from './types-BnShY2aQ.cjs';
3
+ export { A as AIAction, i as AIActionRequest, j as AgentCommand, k as AgentContext, l as AgentResponse, m as ApplyStyleCommand, n as ApplyVariablesCommand, B as BlockContent, b as CommandHandler, o as CommandResult, C as CorePlugin, p as DEFAULT_AI_ACTIONS, q as DeleteTextCommand, r as DocxPackage, E as Endnote, F as Footnote, s as FormatParagraphCommand, t as FormatTextCommand, I as Image, u as InsertHyperlinkCommand, v as InsertImageCommand, w as InsertTableCommand, x as InsertTextCommand, J as JsonSchema, L as ListLevel, y as LoadedDocument, d as McpSession, z as McpToolAnnotations, G as McpToolContent, K as McpToolContext, M as McpToolDefinition, N as McpToolHandler, O as McpToolResult, Q as NumberingDefinitions, S as ParagraphContext, U as ParagraphFormatting, V as ParagraphOutline, C as Plugin, W as PluginCommand, b as PluginCommandHandler, X as PluginEvent, c as PluginEventListener, P as PluginOptions, a as PluginRegistrationResult, Y as Range, Z as Relationship, _ as ReplaceTextCommand, $ as RunContent, a0 as SectionInfo, a1 as SectionProperties, a2 as SelectionContext, a3 as SetVariableCommand, a4 as Style, a5 as StyleDefinitions, a6 as StyleInfo, a7 as SuggestedAction, a8 as TableCell, a9 as TableRow, aa as TextContent, ab as Theme, M as ToolDefinition, N as ToolHandler, O as ToolResult, ac as ZodSchemaLike, ad as comparePositions, ae as createCollapsedRange, af as createCommand, ag as createRange, ah as getActionDescription, ai as getActionLabel, aj as isPositionInRange, ak as isZodSchema } from './types-BnShY2aQ.cjs';
4
+ export { P as PluginRegistry, c as createPluginRegistrar, p as pluginRegistry, r as registerPlugins } from './registry-CrAzNdUO.cjs';
5
5
 
6
6
  /**
7
7
  * Shared Text Utilities for Agent Module
@@ -1,7 +1,7 @@
1
- export { A as AgentContextOptions, S as ContextSelectionOptions, C as CreateEmptyDocumentOptions, D as DocumentAgent, E as ExtendedSelectionContext, F as FormattedTextSegment, a as FormattingSummary, I as InsertHyperlinkOptions, b as InsertImageOptions, c as InsertTableOptions, d as InsertTextOptions, P as ProcessTemplateOptions, e as ProcessTemplateResult, f as SelectionContextOptions, T as TemplateError, g as blendColors, h as buildExtendedSelectionContext, i as buildSelectionContext, j as buildSelectionContextFromContext, k as colorsEqual, l as createAgent, m as createAgentFromDocument, n as createDocumentWithText, o as createEmptyDocument, p as createRgbColor, q as createTemplateProcessor, r as createThemeColor, s as darkenColor, D as default, t as emuToPixels, u as emuToTwips, v as executeCommand, w as executeCommands, x as formatPx, y as getAgentContext, z as getContrastingColor, B as getDocumentSummary, G as getMissingVariables, H as getSelectionFormattingSummary, J as getTemplateTags, K as halfPointsToPixels, L as isBlack, M as isWhite, N as lightenColor, O as parseColorString, Q as parseDocx, R as pixelsToEmu, U as pixelsToTwips, V as pointsToPixels, W as previewTemplate, X as processTemplate, Y as processTemplateAdvanced, Z as processTemplateAsBlob, _ as processTemplateDetailed, $ as resolveColor, a0 as resolveHighlightColor, a1 as resolveShadingColor, a2 as serializeDocumentBody, a3 as serializeDocx, a4 as serializeSectionProperties, a5 as twipsToEmu, a6 as twipsToPixels, a7 as validateTemplate } from './colorResolver-DrNkos_H.js';
2
- import { D as DocumentBody, e as Paragraph, T as TextFormatting, H as Hyperlink, R as Run, f as Table, g as Position, h as Document } from './types-XVRXTi4o.js';
3
- export { A as AIAction, i as AIActionRequest, j as AgentCommand, k as AgentContext, l as AgentResponse, m as ApplyStyleCommand, n as ApplyVariablesCommand, B as BlockContent, b as CommandHandler, o as CommandResult, C as CorePlugin, p as DEFAULT_AI_ACTIONS, q as DeleteTextCommand, r as DocxPackage, E as Endnote, F as Footnote, s as FormatParagraphCommand, t as FormatTextCommand, I as Image, u as InsertHyperlinkCommand, v as InsertImageCommand, w as InsertTableCommand, x as InsertTextCommand, J as JsonSchema, L as ListLevel, y as LoadedDocument, d as McpSession, z as McpToolAnnotations, G as McpToolContent, K as McpToolContext, M as McpToolDefinition, N as McpToolHandler, O as McpToolResult, Q as NumberingDefinitions, S as ParagraphContext, U as ParagraphFormatting, V as ParagraphOutline, C as Plugin, W as PluginCommand, b as PluginCommandHandler, X as PluginEvent, c as PluginEventListener, P as PluginOptions, a as PluginRegistrationResult, Y as Range, Z as Relationship, _ as ReplaceTextCommand, $ as RunContent, a0 as SectionInfo, a1 as SectionProperties, a2 as SelectionContext, a3 as SetVariableCommand, a4 as Style, a5 as StyleDefinitions, a6 as StyleInfo, a7 as SuggestedAction, a8 as TableCell, a9 as TableRow, aa as TextContent, ab as Theme, M as ToolDefinition, N as ToolHandler, O as ToolResult, ac as ZodSchemaLike, ad as comparePositions, ae as createCollapsedRange, af as createCommand, ag as createRange, ah as getActionDescription, ai as getActionLabel, aj as isPositionInRange, ak as isZodSchema } from './types-XVRXTi4o.js';
4
- export { P as PluginRegistry, c as createPluginRegistrar, p as pluginRegistry, r as registerPlugins } from './registry-DifIQR1O.js';
1
+ export { A as AgentContextOptions, S as ContextSelectionOptions, C as CreateEmptyDocumentOptions, D as DocumentAgent, E as ExtendedSelectionContext, F as FormattedTextSegment, a as FormattingSummary, I as InsertHyperlinkOptions, b as InsertImageOptions, c as InsertTableOptions, d as InsertTextOptions, P as ProcessTemplateOptions, e as ProcessTemplateResult, f as SelectionContextOptions, T as TemplateError, g as blendColors, h as buildExtendedSelectionContext, i as buildSelectionContext, j as buildSelectionContextFromContext, k as colorsEqual, l as createAgent, m as createAgentFromDocument, n as createDocumentWithText, o as createEmptyDocument, p as createRgbColor, q as createTemplateProcessor, r as createThemeColor, s as darkenColor, D as default, t as emuToPixels, u as emuToTwips, v as executeCommand, w as executeCommands, x as formatPx, y as getAgentContext, z as getContrastingColor, B as getDocumentSummary, G as getMissingVariables, H as getSelectionFormattingSummary, J as getTemplateTags, K as halfPointsToPixels, L as isBlack, M as isWhite, N as lightenColor, O as parseColorString, Q as parseDocx, R as pixelsToEmu, U as pixelsToTwips, V as pointsToPixels, W as previewTemplate, X as processTemplate, Y as processTemplateAdvanced, Z as processTemplateAsBlob, _ as processTemplateDetailed, $ as resolveColor, a0 as resolveHighlightColor, a1 as resolveShadingColor, a2 as serializeDocumentBody, a3 as serializeDocx, a4 as serializeSectionProperties, a5 as twipsToEmu, a6 as twipsToPixels, a7 as validateTemplate } from './colorResolver-CQcFBxHC.js';
2
+ import { D as DocumentBody, e as Paragraph, T as TextFormatting, H as Hyperlink, R as Run, f as Table, g as Position, h as Document } from './types-BnShY2aQ.js';
3
+ export { A as AIAction, i as AIActionRequest, j as AgentCommand, k as AgentContext, l as AgentResponse, m as ApplyStyleCommand, n as ApplyVariablesCommand, B as BlockContent, b as CommandHandler, o as CommandResult, C as CorePlugin, p as DEFAULT_AI_ACTIONS, q as DeleteTextCommand, r as DocxPackage, E as Endnote, F as Footnote, s as FormatParagraphCommand, t as FormatTextCommand, I as Image, u as InsertHyperlinkCommand, v as InsertImageCommand, w as InsertTableCommand, x as InsertTextCommand, J as JsonSchema, L as ListLevel, y as LoadedDocument, d as McpSession, z as McpToolAnnotations, G as McpToolContent, K as McpToolContext, M as McpToolDefinition, N as McpToolHandler, O as McpToolResult, Q as NumberingDefinitions, S as ParagraphContext, U as ParagraphFormatting, V as ParagraphOutline, C as Plugin, W as PluginCommand, b as PluginCommandHandler, X as PluginEvent, c as PluginEventListener, P as PluginOptions, a as PluginRegistrationResult, Y as Range, Z as Relationship, _ as ReplaceTextCommand, $ as RunContent, a0 as SectionInfo, a1 as SectionProperties, a2 as SelectionContext, a3 as SetVariableCommand, a4 as Style, a5 as StyleDefinitions, a6 as StyleInfo, a7 as SuggestedAction, a8 as TableCell, a9 as TableRow, aa as TextContent, ab as Theme, M as ToolDefinition, N as ToolHandler, O as ToolResult, ac as ZodSchemaLike, ad as comparePositions, ae as createCollapsedRange, af as createCommand, ag as createRange, ah as getActionDescription, ai as getActionLabel, aj as isPositionInRange, ak as isZodSchema } from './types-BnShY2aQ.js';
4
+ export { P as PluginRegistry, c as createPluginRegistrar, p as pluginRegistry, r as registerPlugins } from './registry-aux2uuQs.js';
5
5
 
6
6
  /**
7
7
  * Shared Text Utilities for Agent Module
package/dist/headless.js CHANGED
@@ -1,4 +1,4 @@
1
- export{P as DEFAULT_AI_ACTIONS,y as DocumentAgent,l as blendColors,F as buildExtendedSelectionContext,E as buildSelectionContext,C as buildSelectionContextFromContext,m as colorsEqual,M as comparePositions,z as createAgent,A as createAgentFromDocument,J as createCollapsedRange,Q as createCommand,I as createDocumentWithText,H as createEmptyDocument,K as createRange,i as createRgbColor,h as createThemeColor,j as darkenColor,y as default,p as emuToPixels,r as emuToTwips,x as formatPx,O as getActionDescription,N as getActionLabel,B as getAgentContext,f as getContrastingColor,D as getDocumentSummary,G as getSelectionFormattingSummary,u as halfPointsToPixels,d as isBlack,L as isPositionInRange,e as isWhite,k as lightenColor,g as parseColorString,q as pixelsToEmu,o as pixelsToTwips,t as pointsToPixels,a as resolveColor,b as resolveHighlightColor,c as resolveShadingColor,s as twipsToEmu,n as twipsToPixels}from'./chunk-H2UMX5CK.js';export{v as createTemplateProcessor,a as detectVariables,b as detectVariablesDetailed,c as detectVariablesInBody,d as detectVariablesInParagraph,m as documentHasVariables,e as extractVariablesFromText,i as formatVariable,s as getMissingVariables,q as getTemplateTags,f as hasTemplateVariables,g as isValidVariableName,w as isZodSchema,j as parseVariable,t as previewTemplate,n as processTemplate,u as processTemplateAdvanced,p as processTemplateAsBlob,o as processTemplateDetailed,l as removeVariables,k as replaceVariables,h as sanitizeVariableName,r as validateTemplate}from'./chunk-AOL255XD.js';export{e as createDocx,d as repackDocx,b as serializeDocumentBody,c as serializeDocx,a as serializeSectionProperties}from'./chunk-2CFVFSUH.js';export{l as parseDocx}from'./chunk-I2C6ENCR.js';export{a as executeCommand,b as executeCommands}from'./chunk-AQ35GWDV.js';export{a as PluginRegistry,d as createPluginRegistrar,b as pluginRegistry,c as registerPlugins}from'./chunk-QHWHCIUW.js';import'./chunk-3IYNTJO5.js';function p(n){let e=[];for(let t of n.content)t.type==="run"?e.push(c(t)):t.type==="hyperlink"&&e.push(g(t));return e.join("")}function c(n){return n.content.filter(e=>e.type==="text").map(e=>e.text).join("")}function g(n){let e=[];for(let t of n.children)t.type==="run"&&e.push(c(t));return e.join("")}function x(n){let e=[];for(let t of n.rows)for(let o of t.cells)for(let r of o.content)r.type==="paragraph"&&e.push(p(r));return e.join(" ")}function Me(n){let e=[];for(let t of n.content)t.type==="paragraph"?e.push(p(t)):t.type==="table"&&e.push(x(t));return e.join(`
1
+ export{P as DEFAULT_AI_ACTIONS,y as DocumentAgent,l as blendColors,F as buildExtendedSelectionContext,E as buildSelectionContext,C as buildSelectionContextFromContext,m as colorsEqual,M as comparePositions,z as createAgent,A as createAgentFromDocument,J as createCollapsedRange,Q as createCommand,I as createDocumentWithText,H as createEmptyDocument,K as createRange,i as createRgbColor,h as createThemeColor,j as darkenColor,y as default,p as emuToPixels,r as emuToTwips,x as formatPx,O as getActionDescription,N as getActionLabel,B as getAgentContext,f as getContrastingColor,D as getDocumentSummary,G as getSelectionFormattingSummary,u as halfPointsToPixels,d as isBlack,L as isPositionInRange,e as isWhite,k as lightenColor,g as parseColorString,q as pixelsToEmu,o as pixelsToTwips,t as pointsToPixels,a as resolveColor,b as resolveHighlightColor,c as resolveShadingColor,s as twipsToEmu,n as twipsToPixels}from'./chunk-AEANV5BR.js';export{v as createTemplateProcessor,a as detectVariables,b as detectVariablesDetailed,c as detectVariablesInBody,d as detectVariablesInParagraph,m as documentHasVariables,e as extractVariablesFromText,i as formatVariable,s as getMissingVariables,q as getTemplateTags,f as hasTemplateVariables,g as isValidVariableName,w as isZodSchema,j as parseVariable,t as previewTemplate,n as processTemplate,u as processTemplateAdvanced,p as processTemplateAsBlob,o as processTemplateDetailed,l as removeVariables,k as replaceVariables,h as sanitizeVariableName,r as validateTemplate}from'./chunk-VFBM3YKJ.js';export{e as createDocx,d as repackDocx,b as serializeDocumentBody,c as serializeDocx,a as serializeSectionProperties}from'./chunk-2CFVFSUH.js';export{m as parseDocx}from'./chunk-ZZNWTYMW.js';export{a as executeCommand,b as executeCommands}from'./chunk-AQ35GWDV.js';export{a as PluginRegistry,d as createPluginRegistrar,b as pluginRegistry,c as registerPlugins}from'./chunk-QHWHCIUW.js';import'./chunk-3IYNTJO5.js';function p(n){let e=[];for(let t of n.content)t.type==="run"?e.push(c(t)):t.type==="hyperlink"&&e.push(g(t));return e.join("")}function c(n){return n.content.filter(e=>e.type==="text").map(e=>e.text).join("")}function g(n){let e=[];for(let t of n.children)t.type==="run"&&e.push(c(t));return e.join("")}function x(n){let e=[];for(let t of n.rows)for(let o of t.cells)for(let r of o.content)r.type==="paragraph"&&e.push(p(r));return e.join(" ")}function Me(n){let e=[];for(let t of n.content)t.type==="paragraph"?e.push(p(t)):t.type==="table"&&e.push(x(t));return e.join(`
2
2
  `)}function f(n){return n.split(/\s+/).filter(t=>t.length>0).length}function je(n,e=true){return e?n.length:n.replace(/\s/g,"").length}function We(n){let e=0;for(let t of n.content)t.type==="paragraph"?e+=f(p(t)):t.type==="table"&&(e+=ze(t));return e}function ze(n){let e=0;for(let t of n.rows)for(let o of t.cells)for(let r of o.content)r.type==="paragraph"&&(e+=f(p(r)));return e}function Ne(n){let e=0;for(let t of n.content)t.type==="paragraph"?e+=p(t).length:t.type==="table"&&(e+=qe(t));return e}function qe(n){let e=0;for(let t of n.rows)for(let o of t.cells)for(let r of o.content)r.type==="paragraph"&&(e+=p(r).length);return e}function Ze(n,e,t){let o=[],r=0,i=n[e.paragraphIndex];if(i){let s=p(i).slice(0,e.offset);o.unshift(s),r+=s.length;}for(let l=e.paragraphIndex-1;l>=0&&r<t;l--){let s=n[l];if(!s)continue;let u=p(s);o.unshift(u),r+=u.length;}let a=o.join(`
3
3
  `);return a.length>t?"..."+a.slice(-t):a}function _e(n,e,t){let o=[],r=0,i=n[e.paragraphIndex];if(i){let s=p(i).slice(e.offset);o.push(s),r+=s.length;}for(let l=e.paragraphIndex+1;l<n.length&&r<t;l++){let s=n[l];if(!s)continue;let u=p(s);o.push(u),r+=u.length;}let a=o.join(`
4
4
  `);return a.length>t?a.slice(0,t)+"...":a}function Je(n,e){let t=0;for(let o of n.content)if(o.type==="run"){let r=c(o),i=t+r.length;if(e>=t&&e<i)return o.formatting||{};t=i;}else if(o.type==="hyperlink"){let r=g(o),i=t+r.length;if(e>=t&&e<i){for(let a of o.children)if(a.type==="run")return a.formatting||{}}t=i;}return {}}function Ue(n,e){let t=0;for(let o of n.content)if(o.type==="run"){let r=c(o);t+=r.length;}else if(o.type==="hyperlink"){let r=g(o),i=t,a=t+r.length;if(e>=i&&e<a)return true;t=a;}return false}function Ge(n,e){let t=0;for(let o of n.content)if(o.type==="run"){let r=c(o);t+=r.length;}else if(o.type==="hyperlink"){let r=g(o),i=t,a=t+r.length;if(e>=i&&e<a)return o;t=a;}}function Ke(n){return n?n.toLowerCase().includes("heading"):false}function Qe(n){if(!n)return;let e=n.match(/heading\s*(\d)/i);if(e)return parseInt(e[1],10)}function Xe(n){for(let e of n.content)if(e.type==="paragraph"){for(let t of e.content)if(t.type==="run"){for(let o of t.content)if(o.type==="drawing")return true}}return false}function Ye(n){for(let e of n.content)if(e.type==="paragraph"){for(let t of e.content)if(t.type==="hyperlink")return true}return false}function $e(n){return n.content.some(e=>e.type==="table")}function y(n){return n.content.filter(e=>e.type==="paragraph")}function et(n,e){return y(n)[e]}function tt(n,e){let t=0;for(let o=0;o<n.content.length;o++)if(n.content[o].type==="paragraph"){if(t===e)return o;t++;}return -1}var ot="0.0.2";export{ot as VERSION,je as countCharacters,f as countWords,tt as getBlockIndexForParagraph,Ne as getBodyCharacterCount,Me as getBodyText,We as getBodyWordCount,Je as getFormattingAtPosition,Ge as getHyperlinkAtPosition,g as getHyperlinkText,et as getParagraphAtIndex,p as getParagraphText,y as getParagraphs,c as getRunText,x as getTableText,_e as getTextAfter,Ze as getTextBefore,Ye as hasHyperlinks,Xe as hasImages,$e as hasTables,Ke as isHeadingStyle,Ue as isPositionInHyperlink,Qe as parseHeadingLevel};