@zeke-02/docx-editor 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +204 -0
- package/dist/FindReplaceDialog-7SQOVQWH.js +1 -0
- package/dist/FindReplaceDialog-RK3A7MSK.mjs +1 -0
- package/dist/{FootnotePropertiesDialog-XQ7NIFIU.js → FootnotePropertiesDialog-2Q2SHVMR.js} +1 -1
- package/dist/{FootnotePropertiesDialog-TNVJJCY6.mjs → FootnotePropertiesDialog-ZKQXW3YO.mjs} +1 -1
- package/dist/{HyperlinkDialog-FR4IZZ7E.mjs → HyperlinkDialog-QV3CVFQU.mjs} +1 -1
- package/dist/HyperlinkDialog-XVAF7FVN.js +1 -0
- package/dist/{ImagePositionDialog-JSZSIKF5.mjs → ImagePositionDialog-EGRH3HPP.mjs} +1 -1
- package/dist/{ImagePositionDialog-2YXRAGZS.js → ImagePositionDialog-HIVHUTBT.js} +1 -1
- package/dist/ImagePropertiesDialog-67WLFIIZ.mjs +1 -0
- package/dist/ImagePropertiesDialog-HSM3JJ22.js +1 -0
- package/dist/KeyboardShortcutsDialog-5D_FoAp6.d.ts +395 -0
- package/dist/KeyboardShortcutsDialog-D7ihAj18.d.mts +395 -0
- package/dist/PageSetupDialog-642IAVG2.js +1 -0
- package/dist/PageSetupDialog-ERUQDHAY.mjs +1 -0
- package/dist/{SplitCellDialog-NP3JJYHD.mjs → SplitCellDialog-GFWCFCTD.mjs} +1 -1
- package/dist/{SplitCellDialog-JIAC3RYV.js → SplitCellDialog-M7WF7ANE.js} +1 -1
- package/dist/{TablePropertiesDialog-TIK4AA5M.mjs → TablePropertiesDialog-TZ7VCL6V.mjs} +1 -1
- package/dist/{TablePropertiesDialog-T7D4HSVP.js → TablePropertiesDialog-ZKU2FTUX.js} +1 -1
- package/dist/agentApi-C41hiW-n.d.mts +486 -0
- package/dist/agentApi-D4AZmNfB.d.ts +486 -0
- package/dist/chunk-2XXILKEQ.js +1 -0
- package/dist/chunk-35DG3R42.js +2 -0
- package/dist/chunk-47VJOBJD.mjs +60 -0
- package/dist/chunk-5UX5CD4C.js +1 -0
- package/dist/chunk-7QQSDIWK.mjs +2 -0
- package/dist/chunk-AW5TISUL.js +3 -0
- package/dist/chunk-AYMGSTNG.js +1 -0
- package/dist/chunk-B45ECEGY.js +18 -0
- package/dist/chunk-B7CCL7SL.mjs +2 -0
- package/dist/chunk-BRMTZRLJ.js +2 -0
- package/dist/chunk-D47GTKGU.js +2 -0
- package/dist/chunk-E6MQXELR.js +1 -0
- package/dist/chunk-F5SERL7X.mjs +2 -0
- package/dist/chunk-FWPVBFKQ.mjs +1 -0
- package/dist/chunk-GGQK26JO.js +2 -0
- package/dist/chunk-GM2S2WMT.mjs +1 -0
- package/dist/chunk-ILYKDR3C.js +1 -0
- package/dist/chunk-IP5NAYHL.js +60 -0
- package/dist/chunk-JPF5R2ZM.mjs +1 -0
- package/dist/chunk-KOXCF3CL.mjs +1 -0
- package/dist/chunk-KRLNX56Y.mjs +2 -0
- package/dist/chunk-LUJ6HCMH.mjs +1 -0
- package/dist/chunk-MKNSJOCN.js +70 -0
- package/dist/chunk-NIBCC7WQ.js +1 -0
- package/dist/chunk-NLFXR2VH.js +2 -0
- package/dist/chunk-ONIYA2FU.mjs +2 -0
- package/dist/chunk-ONNHQWAX.mjs +1 -0
- package/dist/chunk-RCIZ7OM3.mjs +70 -0
- package/dist/{chunk-EHFEG3TX.js → chunk-SNZ57XBI.js} +1 -1
- package/dist/chunk-SOTWG3KJ.mjs +1 -0
- package/dist/chunk-TYPGB4KF.js +1 -0
- package/dist/chunk-U7ZW2DOO.mjs +2 -0
- package/dist/{chunk-PKEOQIQO.mjs → chunk-WPI3YRFO.mjs} +1 -1
- package/dist/chunk-XQZTWWRF.mjs +18 -0
- package/dist/chunk-ZVAFVHWR.mjs +3 -0
- package/dist/chunk-ZXPCJWVY.js +2 -0
- package/dist/{agentApi-DLt94vXk.d.mts → content-B2MzIMwA.d.mts} +8 -755
- package/dist/{agentApi-DLt94vXk.d.ts → content-B2MzIMwA.d.ts} +8 -755
- package/dist/dialogs.d.mts +25 -0
- package/dist/dialogs.d.ts +25 -0
- package/dist/dialogs.js +1 -0
- package/dist/dialogs.mjs +1 -0
- package/dist/document-DZ_ZeZEH.d.ts +294 -0
- package/dist/document-Di1qGqLS.d.mts +294 -0
- package/dist/executor-EPEB53SJ.js +1 -0
- package/dist/executor-TVJ6K6MW.mjs +1 -0
- package/dist/findReplace-CpIoILbP.d.mts +138 -0
- package/dist/findReplace-pkMskVJU.d.ts +138 -0
- package/dist/hooks.d.mts +598 -0
- package/dist/hooks.d.ts +598 -0
- package/dist/hooks.js +1 -0
- package/dist/hooks.mjs +1 -0
- package/dist/index.d.mts +1013 -483
- package/dist/index.d.ts +1013 -483
- package/dist/index.js +40 -120
- package/dist/index.mjs +40 -120
- package/dist/layout-bridge-5GYGYKM5.mjs +1 -0
- package/dist/layout-bridge-QQDA7ELH.js +1 -0
- package/dist/plugin-api.d.mts +176 -0
- package/dist/plugin-api.d.ts +176 -0
- package/dist/plugin-api.js +260 -0
- package/dist/plugin-api.mjs +260 -0
- package/dist/processTemplate-BTBTR7AM.js +1 -0
- package/dist/{processTemplate-W2C5PXZB.mjs → processTemplate-MBX2KDLE.mjs} +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.d.mts +18 -0
- package/dist/styles.d.ts +18 -0
- package/dist/styles.js +1 -0
- package/dist/styles.mjs +1 -0
- package/dist/types-Bd_YzkhG.d.mts +281 -0
- package/dist/types-Bd_YzkhG.d.ts +281 -0
- package/dist/types-CkfDgB0O.d.mts +39 -0
- package/dist/types-DZUhB7Ao.d.mts +18 -0
- package/dist/types-DZUhB7Ao.d.ts +18 -0
- package/dist/types-DcxHFUSc.d.ts +39 -0
- package/dist/ui.d.mts +111 -552
- package/dist/ui.d.ts +111 -552
- package/dist/ui.js +111 -1
- package/dist/ui.mjs +111 -1
- package/dist/useFindReplace-DDs533b-.d.mts +261 -0
- package/dist/useFindReplace-eyhMSZZf.d.ts +261 -0
- package/package.json +41 -43
- package/dist/ClipboardManager-CVKX0v9q.d.ts +0 -464
- package/dist/ClipboardManager-V3aaMnWE.d.mts +0 -464
- package/dist/DocumentAgent-BWflKHpH.d.mts +0 -442
- package/dist/DocumentAgent-DsdXtetF.d.ts +0 -442
- package/dist/FindReplaceDialog-L3YF5HIS.mjs +0 -1
- package/dist/FindReplaceDialog-SEBWC5P7.js +0 -1
- package/dist/HyperlinkDialog-WEK6JSAC.js +0 -1
- package/dist/ImagePropertiesDialog-527MFLQO.mjs +0 -1
- package/dist/ImagePropertiesDialog-HG4K3IE7.js +0 -1
- package/dist/PageSetupDialog-GALVJMUB.js +0 -1
- package/dist/PageSetupDialog-TGQIAMI7.mjs +0 -1
- package/dist/TableToolbar-DUgmob2I.d.ts +0 -1273
- package/dist/TableToolbar-YL74HNS1.d.mts +0 -1273
- package/dist/chunk-23SXXIZS.js +0 -111
- package/dist/chunk-3F52AP2Q.js +0 -1
- package/dist/chunk-42O5GXM5.mjs +0 -82
- package/dist/chunk-54ULJEHM.mjs +0 -1
- package/dist/chunk-5XK326FI.mjs +0 -1
- package/dist/chunk-6WPRCJ5A.mjs +0 -1
- package/dist/chunk-76IYR7C7.mjs +0 -1
- package/dist/chunk-AGRIVA4G.js +0 -1
- package/dist/chunk-BTCQ2QI3.mjs +0 -3
- package/dist/chunk-BUEMG4NW.js +0 -1
- package/dist/chunk-BXRC4U3X.mjs +0 -2
- package/dist/chunk-CPAYKE6X.mjs +0 -1
- package/dist/chunk-DACWLFKI.mjs +0 -1
- package/dist/chunk-EPBFWE36.js +0 -2
- package/dist/chunk-FXES3YDB.js +0 -82
- package/dist/chunk-HI66BSGS.mjs +0 -9
- package/dist/chunk-INTPVEO6.mjs +0 -9
- package/dist/chunk-IOAGVW6Q.mjs +0 -2
- package/dist/chunk-JCEWC5QL.mjs +0 -4
- package/dist/chunk-JTIUFACT.js +0 -1
- package/dist/chunk-LUF7PWIC.js +0 -10
- package/dist/chunk-MGEN6GOE.mjs +0 -2
- package/dist/chunk-MOE2ZGUE.js +0 -18
- package/dist/chunk-MWLHJWB6.js +0 -9
- package/dist/chunk-OFYVDN3U.mjs +0 -2
- package/dist/chunk-P4VSHBGZ.js +0 -2
- package/dist/chunk-P5FQHIES.mjs +0 -1
- package/dist/chunk-PBC7XAYZ.js +0 -3
- package/dist/chunk-PEMB6SZT.js +0 -2
- package/dist/chunk-PQMSZTBB.js +0 -9
- package/dist/chunk-Q7UDQXAF.js +0 -1
- package/dist/chunk-QGTAIC5E.js +0 -1
- package/dist/chunk-QVPR2W5S.js +0 -1
- package/dist/chunk-R3QMYPL5.mjs +0 -59
- package/dist/chunk-RBUTXXQJ.mjs +0 -18
- package/dist/chunk-RRWYZ2TS.mjs +0 -111
- package/dist/chunk-S3STEPVO.js +0 -182
- package/dist/chunk-SFUM35DH.js +0 -2
- package/dist/chunk-SNLC6EK2.js +0 -1
- package/dist/chunk-TMTLIGLZ.js +0 -59
- package/dist/chunk-TSE2PWFX.mjs +0 -10
- package/dist/chunk-UKESXQS5.mjs +0 -182
- package/dist/chunk-UWYD42WV.js +0 -4
- package/dist/chunk-UXVACQCY.mjs +0 -1
- package/dist/chunk-W4EIKDM6.mjs +0 -2
- package/dist/chunk-W53SI3XW.mjs +0 -1
- package/dist/chunk-WNS2RBQD.js +0 -2
- package/dist/chunk-Z3KMSHUP.js +0 -1
- package/dist/core-plugins-reexport.d.mts +0 -31
- package/dist/core-plugins-reexport.d.ts +0 -31
- package/dist/core-plugins-reexport.js +0 -1
- package/dist/core-plugins-reexport.mjs +0 -1
- package/dist/core-reexport.d.mts +0 -340
- package/dist/core-reexport.d.ts +0 -340
- package/dist/core-reexport.js +0 -1
- package/dist/core-reexport.mjs +0 -1
- package/dist/documentSerializer-DtS_-oGA.d.mts +0 -664
- package/dist/documentSerializer-Wj1p2ASa.d.ts +0 -664
- package/dist/executor-C3VXF7QA.mjs +0 -1
- package/dist/executor-GDBV3AGV.js +0 -1
- package/dist/headless-reexport.d.mts +0 -197
- package/dist/headless-reexport.d.ts +0 -197
- package/dist/headless-reexport.js +0 -1
- package/dist/headless-reexport.mjs +0 -1
- package/dist/insertOperations-BTH1Asas.d.mts +0 -176
- package/dist/insertOperations-CbUnXAXH.d.ts +0 -176
- package/dist/layout-bridge-EA4DJ227.js +0 -1
- package/dist/layout-bridge-XDPSO6GO.mjs +0 -1
- package/dist/mcp-reexport.d.mts +0 -156
- package/dist/mcp-reexport.d.ts +0 -156
- package/dist/mcp-reexport.js +0 -16
- package/dist/mcp-reexport.mjs +0 -16
- package/dist/processTemplate-MJ2PCSO5.js +0 -1
- package/dist/react-B0W16SV6.d.ts +0 -1330
- package/dist/react-D0Pn1nww.d.mts +0 -1330
- package/dist/react.css +0 -1
- package/dist/react.d.mts +0 -10
- package/dist/react.d.ts +0 -10
- package/dist/react.js +0 -1
- package/dist/react.mjs +0 -1
- package/dist/registry-CH9V-IX0.d.ts +0 -165
- package/dist/registry-CWBKYlNW.d.mts +0 -165
- package/dist/types-UDsUq8D3.d.mts +0 -310
- package/dist/types-jbivc9Lj.d.ts +0 -310
- package/dist/variableDetector-CdQ7ZTzA.d.mts +0 -204
- package/dist/variableDetector-DsRV3A9z.d.ts +0 -204
- package/i18n/de.json +0 -792
- package/i18n/en.json +0 -792
- package/i18n/he.json +0 -792
- package/i18n/pl.json +0 -792
- package/i18n/pt-BR.json +0 -792
- package/i18n/tr.json +0 -792
- package/i18n/zh-CN.json +0 -792
- /package/dist/{chunk-YC5KZSYD.js → chunk-ESZ6JRTW.js} +0 -0
- /package/dist/{chunk-LVGJKS7Y.mjs → chunk-TZMMD6RR.mjs} +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use strict';var chunkIFPN3NT3_js=require('./chunk-IFPN3NT3.js'),chunkB45ECEGY_js=require('./chunk-B45ECEGY.js'),chunkGGQK26JO_js=require('./chunk-GGQK26JO.js'),chunkE6MQXELR_js=require('./chunk-E6MQXELR.js'),chunkH5NTJZO4_js=require('./chunk-H5NTJZO4.js');var H=class{constructor(t){chunkH5NTJZO4_js.d(this,"listeners",new Set);chunkH5NTJZO4_js.d(this,"snapshot");chunkH5NTJZO4_js.d(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t);}));chunkH5NTJZO4_js.d(this,"getSnapshot",()=>this.snapshot);this.snapshot=t;}setSnapshot(t){this.snapshot=t,this.notify();}notify(){for(let t of this.listeners)t();}};var ut="docx-editor-autosave",In=3e4,En=1440*60*1e3,An=2e3,pt=1;function ft(){try{let e="__docx_editor_test__";return localStorage.setItem(e,"test"),localStorage.removeItem(e),!0}catch{return false}}function ct(e){return JSON.stringify({...e,originalBuffer:null})}function Dn(e){try{let t=JSON.parse(e);return !t||typeof t!="object"||!t.document||!t.savedAt?null:(t.version!==pt&&console.warn("Auto-save data version mismatch, may need migration"),t)}catch{return null}}function Rn(e,t){let n=new Date(e).getTime();return Date.now()-n>t}var ue=class extends H{constructor(n={}){super({status:"idle",lastSaveTime:null,hasRecoveryData:false,isEnabled:true});chunkH5NTJZO4_js.d(this,"storageKey");chunkH5NTJZO4_js.d(this,"interval");chunkH5NTJZO4_js.d(this,"maxAge");chunkH5NTJZO4_js.d(this,"saveOnChange");chunkH5NTJZO4_js.d(this,"debounceDelay");chunkH5NTJZO4_js.d(this,"onSaveCallback");chunkH5NTJZO4_js.d(this,"onErrorCallback");chunkH5NTJZO4_js.d(this,"onRecoveryAvailableCallback");chunkH5NTJZO4_js.d(this,"storageAvailable");chunkH5NTJZO4_js.d(this,"currentDocument",null);chunkH5NTJZO4_js.d(this,"lastSavedJson",null);chunkH5NTJZO4_js.d(this,"intervalTimer",null);chunkH5NTJZO4_js.d(this,"debounceTimer",null);chunkH5NTJZO4_js.d(this,"status","idle");chunkH5NTJZO4_js.d(this,"lastSaveTime",null);chunkH5NTJZO4_js.d(this,"_hasRecoveryData",false);chunkH5NTJZO4_js.d(this,"_isEnabled");this.storageKey=n.storageKey??ut,this.interval=n.interval??In,this.maxAge=n.maxAge??En,this.saveOnChange=n.saveOnChange??true,this.debounceDelay=n.debounceDelay??An,this.onSaveCallback=n.onSave,this.onErrorCallback=n.onError,this.onRecoveryAvailableCallback=n.onRecoveryAvailable,this._isEnabled=true,this.storageAvailable=ft(),this.checkRecoveryData();}onDocumentChanged(n){this.currentDocument=n,this._isEnabled&&this.saveOnChange&&n&&this.storageAvailable&&this.debounceSave();}async save(){if(!this.storageAvailable)return this.onErrorCallback?.(new Error("localStorage is not available")),false;let n=this.currentDocument;if(!n)return false;this.updateStatus("saving");try{let r=ct(n);if(r===this.lastSavedJson)return this.updateStatus("saved"),!0;this.persistToStorage(r),this.lastSavedJson=r;let o=new Date;return this.lastSaveTime=o,this.updateStatus("saved"),this.onSaveCallback?.(o),!0}catch(r){return console.error("Auto-save failed:",r),this.updateStatus("error"),this.onErrorCallback?.(r),false}}clear(){if(this.storageAvailable)try{localStorage.removeItem(this.storageKey),this._hasRecoveryData=!1,this.lastSavedJson=null,this.emitSnapshot();}catch(n){console.error("Failed to clear auto-save:",n);}}getRecoveryData(){if(!this.storageAvailable)return null;try{let n=localStorage.getItem(this.storageKey);if(!n)return null;let r=Dn(n);return r?Rn(r.savedAt,this.maxAge)?(this.clear(),null):r:null}catch{return null}}acceptRecovery(){let n=this.getRecoveryData();return n?(this._hasRecoveryData=false,this.emitSnapshot(),n.document):null}dismissRecovery(){this.clear(),this._hasRecoveryData=false,this.emitSnapshot();}enable(){this._isEnabled=true,this.startInterval(),this.emitSnapshot();}disable(){this._isEnabled=false,this.stopTimers(),this.emitSnapshot();}startInterval(){this.stopTimers(),!(!this._isEnabled||!this.storageAvailable)&&(this.intervalTimer=setInterval(()=>{this.save();},this.interval));}destroy(){if(this.stopTimers(),this._isEnabled&&this.currentDocument&&this.storageAvailable)try{this.persistToStorage(ct(this.currentDocument));}catch(n){console.error("Failed to save on destroy:",n);}}checkRecoveryData(){if(!this.storageAvailable)return;let n=this.getRecoveryData();n&&(this._hasRecoveryData=true,this.emitSnapshot(),this.onRecoveryAvailableCallback?.(n));}persistToStorage(n){let r={document:JSON.parse(n),savedAt:new Date().toISOString(),version:pt};localStorage.setItem(this.storageKey,JSON.stringify(r));}debounceSave(){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.save();},this.debounceDelay);}stopTimers(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null),this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null);}updateStatus(n){this.status=n,this.emitSnapshot();}emitSnapshot(){this.setSnapshot({status:this.status,lastSaveTime:this.lastSaveTime,hasRecoveryData:this._hasRecoveryData,isEnabled:this._isEnabled});}};function mt(e){if(!e)return "Never";let n=new Date().getTime()-e.getTime(),r=Math.floor(n/1e3),o=Math.floor(r/60),i=Math.floor(o/60);return r<10?"Just now":r<60?`${r} seconds ago`:o<60?`${o} minute${o===1?"":"s"} ago`:i<24?`${i} hour${i===1?"":"s"} ago`:e.toLocaleDateString()}function dt(e){return {idle:"Ready",saving:"Saving...",saved:"Saved",error:"Save failed"}[e]}function ht(e=ut){try{let t=localStorage.getItem(e);return t?new Blob([t]).size:0}catch{return 0}}function gt(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function wt(){return ft()}var yt={TABLE_INDEX:"data-table-index",ROW_INDEX:"data-row",COLUMN_INDEX:"data-col",TABLE_CELL:"data-table-cell"};function xt(e,t){if(!e.package?.document?.content)return null;let n=0;for(let r of e.package.document.content)if(r.type==="table"){if(n===t)return r;n++;}return null}function bt(e,t,n){if(!e.package?.document?.content)return e;let r=0,o=e.package.document.content.map(i=>{if(i.type==="table"){if(r===t)return r++,n;r++;}return i});return {...e,package:{...e.package,document:{...e.package.document,content:o}}}}function Tt(e,t){if(!e.package?.document?.content)return e;let n=0,r=e.package.document.content.filter(o=>{if(o.type==="table"){let i=n===t;return n++,!i}return true});return {...e,package:{...e.package,document:{...e.package.document,content:r}}}}var pe=class extends H{constructor(){super({selectedCell:null});}selectCell(t){this.setSnapshot({selectedCell:t});}clearSelection(){this.setSnapshot({selectedCell:null});}isCellSelected(t,n,r){let{selectedCell:o}=this.getSnapshot();return o?o.tableIndex===t&&o.rowIndex===n&&o.columnIndex===r:false}getSelectedCell(){return this.getSnapshot().selectedCell}};function St(e){if(!e||e==="transparent"||e==="inherit")return null;if(e.startsWith("#"))return e.slice(1).toUpperCase();let t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(t){let n=parseInt(t[1]).toString(16).padStart(2,"0"),r=parseInt(t[2]).toString(16).padStart(2,"0"),o=parseInt(t[3]).toString(16).padStart(2,"0");return (n+r+o).toUpperCase()}return null}function Ae(e){let t=window.getComputedStyle(e),n={};(t.fontWeight==="bold"||parseInt(t.fontWeight)>=700)&&(n.bold=true),t.fontStyle==="italic"&&(n.italic=true);let r=t.textDecoration||t.textDecorationLine;r&&r.includes("underline")&&(n.underline={style:"single"}),r&&r.includes("line-through")&&(n.strike=true);let o=parseFloat(t.fontSize);!isNaN(o)&&o>0&&(n.fontSize=Math.round(o/1.333*2));let i=t.fontFamily.replace(/["']/g,"").split(",")[0].trim();i&&(n.fontFamily={ascii:i});let s=t.color;if(s&&s!=="rgb(0, 0, 0)"){let l=St(s);l&&(n.color={rgb:l});}let a=t.backgroundColor;if(a&&a!=="transparent"&&a!=="rgba(0, 0, 0, 0)"){let l=Re(a);l&&(n.shading={fill:{rgb:l}});}return Object.keys(n).length>0?n:void 0}function kn(e,t){let n=document.createRange();n.selectNodeContents(e);let r=t.compareBoundaryPoints(Range.START_TO_START,n)>=0&&t.compareBoundaryPoints(Range.START_TO_END,n)<=0,o=t.compareBoundaryPoints(Range.END_TO_START,n)>=0&&t.compareBoundaryPoints(Range.END_TO_END,n)<=0;if(r&&o)return t.toString();if(r){let i=document.createRange();return i.setStart(t.startContainer,t.startOffset),i.selectNodeContents(e),i.setEnd(n.endContainer,n.endOffset),i.toString()}else if(o){let i=document.createRange();return i.selectNodeContents(e),i.setEnd(t.endContainer,t.endOffset),i.setStart(n.startContainer,n.startOffset),i.toString()}else if(t.intersectsNode(e))return e.textContent||"";return ""}function vt(e){let t=e;for(;t;){if(t.nodeType===Node.ELEMENT_NODE){let n=t;if(n.hasAttribute("data-paragraph-index"))return n}t=t.parentNode;}return null}function De(){let e=window.getSelection();if(!e||e.isCollapsed)return [];let t=[],n=e.getRangeAt(0),r=n.commonAncestorContainer,o=r.nodeType===Node.ELEMENT_NODE?r:r.parentElement;if(!o)return t;if(o.querySelectorAll(".docx-run").forEach(s=>{if(n.intersectsNode(s)){let a=kn(s,n);if(a){let l=Ae(s);t.push({type:"run",formatting:l,content:[{type:"text",text:a}]});}}}),t.length===0){let s=e.toString();s&&t.push({type:"run",content:[{type:"text",text:s}]});}return t}function Ct(){let e=window.getSelection();if(!e||e.isCollapsed)return null;let t=De();if(t.length===0)return null;let n=e.toString(),r=e.getRangeAt(0),o=vt(r.startContainer),i=vt(r.endContainer),s=o?parseInt(o.getAttribute("data-paragraph-index")||"0",10):0,a=i?parseInt(i.getAttribute("data-paragraph-index")||"0",10):0;return {text:n,runs:t,startParagraphIndex:s,startRunIndex:0,startOffset:r.startOffset,endParagraphIndex:a,endRunIndex:0,endOffset:r.endOffset,isMultiParagraph:s!==a}}var Re=St;var fe=class extends H{constructor(){super({notifications:[]});chunkH5NTJZO4_js.d(this,"notifications",[]);chunkH5NTJZO4_js.d(this,"idCounter",0);chunkH5NTJZO4_js.d(this,"timers",new Set);}showError(n,r){return this.addNotification(n,"error",r)}showWarning(n,r){return this.addNotification(n,"warning",r)}showInfo(n,r){return this.addNotification(n,"info",r)}dismiss(n){this.notifications=this.notifications.map(o=>o.id===n?{...o,dismissed:true}:o),this.emitSnapshot();let r=setTimeout(()=>{this.timers.delete(r),this.notifications=this.notifications.filter(o=>o.id!==n),this.emitSnapshot();},300);this.timers.add(r);}clearAll(){this.notifications=[];for(let n of this.timers)clearTimeout(n);this.timers.clear(),this.emitSnapshot();}destroy(){for(let n of this.timers)clearTimeout(n);this.timers.clear(),this.notifications=[];}addNotification(n,r,o){let i=`error-${++this.idCounter}-${Date.now()}`,s={id:i,message:n,severity:r,details:o,timestamp:Date.now()};if(this.notifications=[...this.notifications,s],this.emitSnapshot(),r!=="error"){let a=setTimeout(()=>{this.timers.delete(a),this.dismiss(i);},5e3);this.timers.add(a);}return i}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};function Pt(e,t){let n=`plugin-styles-${e}`,r=document.getElementById(n);r&&r.remove();let o=document.createElement("style");return o.id=n,o.textContent=t,document.head.appendChild(o),()=>{let i=document.getElementById(n);i&&i.remove();}}var me=class extends H{constructor(){super({states:new Map,version:0});chunkH5NTJZO4_js.d(this,"plugins",[]);chunkH5NTJZO4_js.d(this,"pluginStates",new Map);chunkH5NTJZO4_js.d(this,"version",0);}initialize(n,r){this.destroyPlugins(),this.plugins=n;for(let o of n)o.initialize&&!this.pluginStates.has(o.id)&&this.pluginStates.set(o.id,o.initialize(r));this.emitSnapshot();}updateStates(n){let r=false;for(let o of this.plugins)if(o.onStateChange){let i=o.onStateChange(n);i!==void 0&&(this.pluginStates.set(o.id,i),r=true);}return r&&(this.version++,this.emitSnapshot()),r}getPluginState(n){return this.pluginStates.get(n)}setPluginState(n,r){this.pluginStates.set(n,r),this.version++,this.emitSnapshot();}destroy(){this.destroyPlugins(),this.emitSnapshot();}destroyPlugins(){for(let n of this.plugins)n.destroy&&n.destroy();this.pluginStates.clear(),this.plugins=[];}emitSnapshot(){this.setSnapshot({states:new Map(this.pluginStates),version:this.version});}};var $t=chunkH5NTJZO4_js.c(chunkIFPN3NT3_js.a());async function Ft(e){let t=await $t.default.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,commentsExtensibleXml:null,commentsExtendedXml: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[r,o]of Object.entries(t.files)){if(o.dir)continue;let i=r.toLowerCase();if(i.endsWith(".xml")||i.endsWith(".rels")){let s=await o.async("text");if(n.allXml.set(r,s),i==="word/document.xml")n.documentXml=s;else if(i==="word/styles.xml")n.stylesXml=s;else if(i==="word/theme/theme1.xml")n.themeXml=s;else if(i==="word/numbering.xml")n.numberingXml=s;else if(i==="word/fonttable.xml")n.fontTableXml=s;else if(i==="word/settings.xml")n.settingsXml=s;else if(i==="word/websettings.xml")n.webSettingsXml=s;else if(i==="word/footnotes.xml")n.footnotesXml=s;else if(i==="word/endnotes.xml")n.endnotesXml=s;else if(i==="word/comments.xml")n.commentsXml=s;else if(i==="word/commentsextensible.xml")n.commentsExtensibleXml=s;else if(i==="word/commentsextended.xml")n.commentsExtendedXml=s;else if(i==="word/_rels/document.xml.rels")n.documentRels=s;else if(i==="_rels/.rels")n.packageRels=s;else if(i==="[content_types].xml")n.contentTypesXml=s;else if(i==="docprops/core.xml")n.corePropsXml=s;else if(i==="docprops/app.xml")n.appPropsXml=s;else if(i==="docprops/custom.xml")n.customPropsXml=s;else if(i.match(/^word\/header\d+\.xml$/)){let a=r.split("/").pop()||r;n.headers.set(a,s);}else if(i.match(/^word\/footer\d+\.xml$/)){let a=r.split("/").pop()||r;n.footers.set(a,s);}}else if(i.startsWith("word/media/")){let s=await o.async("arraybuffer");n.media.set(r,s);}else if(i.startsWith("word/fonts/")){let s=await o.async("arraybuffer");n.fonts.set(r,s);}}return n}function It(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 de(e,t){if(!e)return;let n={},r=chunkB45ECEGY_js.d(e,"w","b");r&&(n.bold=chunkB45ECEGY_js.i(r));let o=chunkB45ECEGY_js.d(e,"w","bCs");o&&(n.boldCs=chunkB45ECEGY_js.i(o));let i=chunkB45ECEGY_js.d(e,"w","i");i&&(n.italic=chunkB45ECEGY_js.i(i));let s=chunkB45ECEGY_js.d(e,"w","iCs");s&&(n.italicCs=chunkB45ECEGY_js.i(s));let a=chunkB45ECEGY_js.d(e,"w","u");if(a){let T=chunkB45ECEGY_js.g(a,"w","val");if(T){n.underline={style:T};let z=chunkB45ECEGY_js.g(a,"w","color"),O=chunkB45ECEGY_js.g(a,"w","themeColor");(z||O)&&(n.underline.color=ke(z,O,chunkB45ECEGY_js.g(a,"w","themeTint"),chunkB45ECEGY_js.g(a,"w","themeShade")));}}let l=chunkB45ECEGY_js.d(e,"w","strike");l&&(n.strike=chunkB45ECEGY_js.i(l));let u=chunkB45ECEGY_js.d(e,"w","dstrike");u&&(n.doubleStrike=chunkB45ECEGY_js.i(u));let m=chunkB45ECEGY_js.d(e,"w","vertAlign");if(m){let T=chunkB45ECEGY_js.g(m,"w","val");(T==="superscript"||T==="subscript"||T==="baseline")&&(n.vertAlign=T);}let h=chunkB45ECEGY_js.d(e,"w","smallCaps");h&&(n.smallCaps=chunkB45ECEGY_js.i(h));let g=chunkB45ECEGY_js.d(e,"w","caps");g&&(n.allCaps=chunkB45ECEGY_js.i(g));let x=chunkB45ECEGY_js.d(e,"w","vanish");x&&(n.hidden=chunkB45ECEGY_js.i(x));let p=chunkB45ECEGY_js.d(e,"w","color");p&&(n.color=ke(chunkB45ECEGY_js.g(p,"w","val"),chunkB45ECEGY_js.g(p,"w","themeColor"),chunkB45ECEGY_js.g(p,"w","themeTint"),chunkB45ECEGY_js.g(p,"w","themeShade")));let y=chunkB45ECEGY_js.d(e,"w","highlight");if(y){let T=chunkB45ECEGY_js.g(y,"w","val");T&&(n.highlight=T);}let C=chunkB45ECEGY_js.d(e,"w","shd");C&&(n.shading=he(C));let E=chunkB45ECEGY_js.d(e,"w","sz");if(E){let T=chunkB45ECEGY_js.h(E,"w","val");T!==void 0&&(n.fontSize=T);}let D=chunkB45ECEGY_js.d(e,"w","szCs");if(D){let T=chunkB45ECEGY_js.h(D,"w","val");T!==void 0&&(n.fontSizeCs=T);}let A=chunkB45ECEGY_js.d(e,"w","rFonts");if(A){n.fontFamily={ascii:chunkB45ECEGY_js.g(A,"w","ascii")??void 0,hAnsi:chunkB45ECEGY_js.g(A,"w","hAnsi")??void 0,eastAsia:chunkB45ECEGY_js.g(A,"w","eastAsia")??void 0,cs:chunkB45ECEGY_js.g(A,"w","cs")??void 0};let T=chunkB45ECEGY_js.g(A,"w","asciiTheme");T&&(n.fontFamily.asciiTheme=T,t&&!n.fontFamily.ascii&&(n.fontFamily.ascii=chunkB45ECEGY_js.m(t,T)));let z=chunkB45ECEGY_js.g(A,"w","hAnsiTheme");z&&(n.fontFamily.hAnsiTheme=z,t&&!n.fontFamily.hAnsi&&(n.fontFamily.hAnsi=chunkB45ECEGY_js.m(t,z)));let O=chunkB45ECEGY_js.g(A,"w","eastAsiaTheme");O&&(n.fontFamily.eastAsiaTheme=O,t&&!n.fontFamily.eastAsia&&(n.fontFamily.eastAsia=chunkB45ECEGY_js.m(t,O)));let Fe=chunkB45ECEGY_js.g(A,"w","cstheme");Fe&&(n.fontFamily.csTheme=Fe,t&&!n.fontFamily.cs&&(n.fontFamily.cs=chunkB45ECEGY_js.m(t,Fe)));}let v=chunkB45ECEGY_js.d(e,"w","spacing");if(v){let T=chunkB45ECEGY_js.h(v,"w","val");T!==void 0&&(n.spacing=T);}let b=chunkB45ECEGY_js.d(e,"w","position");if(b){let T=chunkB45ECEGY_js.h(b,"w","val");T!==void 0&&(n.position=T);}let P=chunkB45ECEGY_js.d(e,"w","w");if(P){let T=chunkB45ECEGY_js.h(P,"w","val");T!==void 0&&(n.scale=T);}let I=chunkB45ECEGY_js.d(e,"w","kern");if(I){let T=chunkB45ECEGY_js.h(I,"w","val");T!==void 0&&(n.kerning=T);}let B=chunkB45ECEGY_js.d(e,"w","effect");if(B){let T=chunkB45ECEGY_js.g(B,"w","val");T&&(n.effect=T);}let R=chunkB45ECEGY_js.d(e,"w","em");if(R){let T=chunkB45ECEGY_js.g(R,"w","val");T&&(n.emphasisMark=T);}let k=chunkB45ECEGY_js.d(e,"w","emboss");k&&(n.emboss=chunkB45ECEGY_js.i(k));let N=chunkB45ECEGY_js.d(e,"w","imprint");N&&(n.imprint=chunkB45ECEGY_js.i(N));let q=chunkB45ECEGY_js.d(e,"w","outline");q&&(n.outline=chunkB45ECEGY_js.i(q));let K=chunkB45ECEGY_js.d(e,"w","shadow");K&&(n.shadow=chunkB45ECEGY_js.i(K));let V=chunkB45ECEGY_js.d(e,"w","rtl");V&&(n.rtl=chunkB45ECEGY_js.i(V));let L=chunkB45ECEGY_js.d(e,"w","cs");L&&(n.cs=chunkB45ECEGY_js.i(L));let _=chunkB45ECEGY_js.d(e,"w","rStyle");if(_){let T=chunkB45ECEGY_js.g(_,"w","val");T&&(n.styleId=T);}return Object.keys(n).length>0?n:void 0}function ke(e,t,n,r){let o={};return e&&e!=="auto"?o.rgb=e:e==="auto"&&(o.auto=true),t&&(o.themeColor=t),n&&(o.themeTint=n),r&&(o.themeShade=r),o}function he(e){if(!e)return;let t={},n=chunkB45ECEGY_js.g(e,"w","color");n&&n!=="auto"&&(t.color={rgb:n});let r=chunkB45ECEGY_js.g(e,"w","fill");r&&r!=="auto"&&(t.fill={rgb:r});let o=chunkB45ECEGY_js.g(e,"w","themeFill");o&&(t.fill=t.fill||{},t.fill.themeColor=o);let i=chunkB45ECEGY_js.g(e,"w","themeFillTint");i&&t.fill&&(t.fill.themeTint=i);let s=chunkB45ECEGY_js.g(e,"w","themeFillShade");s&&t.fill&&(t.fill.themeShade=s);let a=chunkB45ECEGY_js.g(e,"w","val");return a&&(t.pattern=a),Object.keys(t).length>0?t:void 0}function j(e){if(!e)return;let t=chunkB45ECEGY_js.g(e,"w","val");if(!t)return;let n={style:t},r=chunkB45ECEGY_js.g(e,"w","color"),o=chunkB45ECEGY_js.g(e,"w","themeColor");(r||o)&&(n.color=ke(r,o,chunkB45ECEGY_js.g(e,"w","themeTint"),chunkB45ECEGY_js.g(e,"w","themeShade")));let i=chunkB45ECEGY_js.h(e,"w","sz");i!==void 0&&(n.size=i);let s=chunkB45ECEGY_js.h(e,"w","space");s!==void 0&&(n.space=s);let a=chunkB45ECEGY_js.g(e,"w","shadow");a&&(n.shadow=a==="1"||a==="true");let l=chunkB45ECEGY_js.g(e,"w","frame");return l&&(n.frame=l==="1"||l==="true"),n}function Ln(e){if(!e)return;let t=chunkB45ECEGY_js.e(e,"w","tab");if(t.length===0)return;let n=[];for(let r of t){let o=chunkB45ECEGY_js.h(r,"w","pos"),i=chunkB45ECEGY_js.g(r,"w","val");if(o!==void 0&&i){let s={position:o,alignment:i},a=chunkB45ECEGY_js.g(r,"w","leader");a&&(s.leader=a),n.push(s);}}return n.length>0?n:void 0}function Be(e,t){if(!e)return;let n={},r=chunkB45ECEGY_js.d(e,"w","jc");if(r){let b=chunkB45ECEGY_js.g(r,"w","val");b&&(n.alignment=b);}let o=chunkB45ECEGY_js.d(e,"w","bidi");o&&(n.bidi=chunkB45ECEGY_js.i(o));let i=chunkB45ECEGY_js.d(e,"w","spacing");if(i){let b=chunkB45ECEGY_js.h(i,"w","before");b!==void 0&&(n.spaceBefore=b);let P=chunkB45ECEGY_js.h(i,"w","after");P!==void 0&&(n.spaceAfter=P);let I=chunkB45ECEGY_js.h(i,"w","line");I!==void 0&&(n.lineSpacing=I);let B=chunkB45ECEGY_js.g(i,"w","lineRule");B&&(n.lineSpacingRule=B);let R=chunkB45ECEGY_js.g(i,"w","beforeAutospacing");R&&(n.beforeAutospacing=R==="1"||R==="true");let k=chunkB45ECEGY_js.g(i,"w","afterAutospacing");k&&(n.afterAutospacing=k==="1"||k==="true");}let s=chunkB45ECEGY_js.d(e,"w","ind");if(s){let b=chunkB45ECEGY_js.h(s,"w","left");b!==void 0&&(n.indentLeft=b);let P=chunkB45ECEGY_js.h(s,"w","right");P!==void 0&&(n.indentRight=P);let I=chunkB45ECEGY_js.h(s,"w","firstLine");I!==void 0&&(n.indentFirstLine=I);let B=chunkB45ECEGY_js.h(s,"w","hanging");B!==void 0&&(n.indentFirstLine=-B,n.hangingIndent=true);}let a=chunkB45ECEGY_js.d(e,"w","pBdr");if(a){let b={},P=j(chunkB45ECEGY_js.d(a,"w","top"));P&&(b.top=P);let I=j(chunkB45ECEGY_js.d(a,"w","bottom"));I&&(b.bottom=I);let B=j(chunkB45ECEGY_js.d(a,"w","left"));B&&(b.left=B);let R=j(chunkB45ECEGY_js.d(a,"w","right"));R&&(b.right=R);let k=j(chunkB45ECEGY_js.d(a,"w","between"));k&&(b.between=k);let N=j(chunkB45ECEGY_js.d(a,"w","bar"));N&&(b.bar=N),Object.keys(b).length>0&&(n.borders=b);}let l=chunkB45ECEGY_js.d(e,"w","shd");l&&(n.shading=he(l));let u=chunkB45ECEGY_js.d(e,"w","tabs");u&&(n.tabs=Ln(u));let m=chunkB45ECEGY_js.d(e,"w","keepNext");m&&(n.keepNext=chunkB45ECEGY_js.i(m));let h=chunkB45ECEGY_js.d(e,"w","keepLines");h&&(n.keepLines=chunkB45ECEGY_js.i(h));let g=chunkB45ECEGY_js.d(e,"w","widowControl");g&&(n.widowControl=chunkB45ECEGY_js.i(g));let x=chunkB45ECEGY_js.d(e,"w","pageBreakBefore");x&&(n.pageBreakBefore=chunkB45ECEGY_js.i(x));let p=chunkB45ECEGY_js.d(e,"w","contextualSpacing");p&&(n.contextualSpacing=chunkB45ECEGY_js.i(p));let y=chunkB45ECEGY_js.d(e,"w","numPr");if(y){let b=chunkB45ECEGY_js.d(y,"w","numId"),P=chunkB45ECEGY_js.d(y,"w","ilvl");if(b||P){if(n.numPr={},b){let I=chunkB45ECEGY_js.h(b,"w","val");I!==void 0&&(n.numPr.numId=I);}if(P){let I=chunkB45ECEGY_js.h(P,"w","val");I!==void 0&&(n.numPr.ilvl=I);}}}let C=chunkB45ECEGY_js.d(e,"w","outlineLvl");if(C){let b=chunkB45ECEGY_js.h(C,"w","val");b!==void 0&&(n.outlineLevel=b);}let E=chunkB45ECEGY_js.d(e,"w","pStyle");if(E){let b=chunkB45ECEGY_js.g(E,"w","val");b&&(n.styleId=b);}let D=chunkB45ECEGY_js.d(e,"w","suppressLineNumbers");D&&(n.suppressLineNumbers=chunkB45ECEGY_js.i(D));let A=chunkB45ECEGY_js.d(e,"w","suppressAutoHyphens");A&&(n.suppressAutoHyphens=chunkB45ECEGY_js.i(A));let v=chunkB45ECEGY_js.d(e,"w","rPr");return v&&(n.runProperties=de(v,t)),Object.keys(n).length>0?n:void 0}function U(e){if(!e)return;let t=chunkB45ECEGY_js.h(e,"w","w"),n=chunkB45ECEGY_js.g(e,"w","type");if(t!==void 0&&n)return {value:t,type:n}}function Rt(e){if(!e)return;let t={},n=j(chunkB45ECEGY_js.d(e,"w","top"));n&&(t.top=n);let r=j(chunkB45ECEGY_js.d(e,"w","bottom"));r&&(t.bottom=r);let o=j(chunkB45ECEGY_js.d(e,"w","left"));o&&(t.left=o);let i=j(chunkB45ECEGY_js.d(e,"w","right"));i&&(t.right=i);let s=j(chunkB45ECEGY_js.d(e,"w","insideH"));s&&(t.insideH=s);let a=j(chunkB45ECEGY_js.d(e,"w","insideV"));return a&&(t.insideV=a),Object.keys(t).length>0?t:void 0}function kt(e){if(!e)return;let t={},n=U(chunkB45ECEGY_js.d(e,"w","top"));n&&(t.top=n);let r=U(chunkB45ECEGY_js.d(e,"w","bottom"));r&&(t.bottom=r);let o=U(chunkB45ECEGY_js.d(e,"w","left"));o&&(t.left=o);let i=U(chunkB45ECEGY_js.d(e,"w","right"));return i&&(t.right=i),Object.keys(t).length>0?t:void 0}function Mn(e){if(!e)return;let t={},n=chunkB45ECEGY_js.g(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 r=chunkB45ECEGY_js.g(e,"w","firstColumn");r&&(t.firstColumn=r==="1");let o=chunkB45ECEGY_js.g(e,"w","firstRow");o&&(t.firstRow=o==="1");let i=chunkB45ECEGY_js.g(e,"w","lastColumn");i&&(t.lastColumn=i==="1");let s=chunkB45ECEGY_js.g(e,"w","lastRow");s&&(t.lastRow=s==="1");let a=chunkB45ECEGY_js.g(e,"w","noHBand");a&&(t.noHBand=a==="1");let l=chunkB45ECEGY_js.g(e,"w","noVBand");return l&&(t.noVBand=l==="1"),Object.keys(t).length>0?t:void 0}function Et(e,t){if(!e)return;let n={},r=chunkB45ECEGY_js.d(e,"w","tblW");r&&(n.width=U(r));let o=chunkB45ECEGY_js.d(e,"w","jc");if(o){let p=chunkB45ECEGY_js.g(o,"w","val");(p==="left"||p==="center"||p==="right")&&(n.justification=p);}let i=chunkB45ECEGY_js.d(e,"w","tblCellSpacing");i&&(n.cellSpacing=U(i));let s=chunkB45ECEGY_js.d(e,"w","tblInd");s&&(n.indent=U(s));let a=chunkB45ECEGY_js.d(e,"w","tblBorders");a&&(n.borders=Rt(a));let l=chunkB45ECEGY_js.d(e,"w","tblCellMar");l&&(n.cellMargins=kt(l));let u=chunkB45ECEGY_js.d(e,"w","tblLayout");if(u){let p=chunkB45ECEGY_js.g(u,"w","type");(p==="fixed"||p==="autofit")&&(n.layout=p);}let m=chunkB45ECEGY_js.d(e,"w","tblStyle");if(m){let p=chunkB45ECEGY_js.g(m,"w","val");p&&(n.styleId=p);}let h=chunkB45ECEGY_js.d(e,"w","tblLook");h&&(n.look=Mn(h));let g=chunkB45ECEGY_js.d(e,"w","shd");g&&(n.shading=he(g));let x=chunkB45ECEGY_js.d(e,"w","bidiVisual");return x&&(n.bidi=chunkB45ECEGY_js.i(x)),Object.keys(n).length>0?n:void 0}function At(e){if(!e)return;let t={},n=chunkB45ECEGY_js.d(e,"w","trHeight");if(n){t.height=U(n);let a=chunkB45ECEGY_js.g(n,"w","hRule");a&&(t.heightRule=a);}let r=chunkB45ECEGY_js.d(e,"w","tblHeader");r&&(t.header=chunkB45ECEGY_js.i(r));let o=chunkB45ECEGY_js.d(e,"w","cantSplit");o&&(t.cantSplit=chunkB45ECEGY_js.i(o));let i=chunkB45ECEGY_js.d(e,"w","jc");if(i){let a=chunkB45ECEGY_js.g(i,"w","val");(a==="left"||a==="center"||a==="right")&&(t.justification=a);}let s=chunkB45ECEGY_js.d(e,"w","hidden");return s&&(t.hidden=chunkB45ECEGY_js.i(s)),Object.keys(t).length>0?t:void 0}function Dt(e,t){if(!e)return;let n={},r=chunkB45ECEGY_js.d(e,"w","tcW");r&&(n.width=U(r));let o=chunkB45ECEGY_js.d(e,"w","tcBorders");o&&(n.borders=Rt(o));let i=chunkB45ECEGY_js.d(e,"w","tcMar");i&&(n.margins=kt(i));let s=chunkB45ECEGY_js.d(e,"w","shd");s&&(n.shading=he(s));let a=chunkB45ECEGY_js.d(e,"w","vAlign");if(a){let p=chunkB45ECEGY_js.g(a,"w","val");(p==="top"||p==="center"||p==="bottom")&&(n.verticalAlign=p);}let l=chunkB45ECEGY_js.d(e,"w","textDirection");if(l){let p=chunkB45ECEGY_js.g(l,"w","val");p&&(n.textDirection=p);}let u=chunkB45ECEGY_js.d(e,"w","gridSpan");if(u){let p=chunkB45ECEGY_js.h(u,"w","val");p!==void 0&&(n.gridSpan=p);}let m=chunkB45ECEGY_js.d(e,"w","vMerge");if(m){let p=chunkB45ECEGY_js.g(m,"w","val");n.vMerge=p==="restart"?"restart":"continue";}let h=chunkB45ECEGY_js.d(e,"w","tcFitText");h&&(n.fitText=chunkB45ECEGY_js.i(h));let g=chunkB45ECEGY_js.d(e,"w","noWrap");g&&(n.noWrap=chunkB45ECEGY_js.i(g));let x=chunkB45ECEGY_js.d(e,"w","hideMark");return x&&(n.hideMark=chunkB45ECEGY_js.i(x)),Object.keys(n).length>0?n:void 0}function Nn(e,t){let n={styleId:chunkB45ECEGY_js.g(e,"w","styleId")??"",type:chunkB45ECEGY_js.g(e,"w","type")??"paragraph"},r=chunkB45ECEGY_js.g(e,"w","default");r&&(n.default=r==="1"||r==="true");let o=chunkB45ECEGY_js.d(e,"w","name");o&&(n.name=chunkB45ECEGY_js.g(o,"w","val")??void 0);let i=chunkB45ECEGY_js.d(e,"w","basedOn");i&&(n.basedOn=chunkB45ECEGY_js.g(i,"w","val")??void 0);let s=chunkB45ECEGY_js.d(e,"w","next");s&&(n.next=chunkB45ECEGY_js.g(s,"w","val")??void 0);let a=chunkB45ECEGY_js.d(e,"w","link");a&&(n.link=chunkB45ECEGY_js.g(a,"w","val")??void 0);let l=chunkB45ECEGY_js.d(e,"w","uiPriority");if(l){let v=chunkB45ECEGY_js.h(l,"w","val");v!==void 0&&(n.uiPriority=v);}let u=chunkB45ECEGY_js.d(e,"w","hidden");u&&(n.hidden=chunkB45ECEGY_js.i(u));let m=chunkB45ECEGY_js.d(e,"w","semiHidden");m&&(n.semiHidden=chunkB45ECEGY_js.i(m));let h=chunkB45ECEGY_js.d(e,"w","unhideWhenUsed");h&&(n.unhideWhenUsed=chunkB45ECEGY_js.i(h));let g=chunkB45ECEGY_js.d(e,"w","qFormat");g&&(n.qFormat=chunkB45ECEGY_js.i(g));let x=chunkB45ECEGY_js.d(e,"w","personal");x&&(n.personal=chunkB45ECEGY_js.i(x));let p=chunkB45ECEGY_js.d(e,"w","pPr");p&&(n.pPr=Be(p,t));let y=chunkB45ECEGY_js.d(e,"w","rPr");y&&(n.rPr=de(y,t));let C=chunkB45ECEGY_js.d(e,"w","tblPr");C&&(n.tblPr=Et(C));let E=chunkB45ECEGY_js.d(e,"w","trPr");E&&(n.trPr=At(E));let D=chunkB45ECEGY_js.d(e,"w","tcPr");D&&(n.tcPr=Dt(D));let A=chunkB45ECEGY_js.e(e,"w","tblStylePr");if(A.length>0){n.tblStylePr=[];for(let v of A){let b=chunkB45ECEGY_js.g(v,"w","type");if(b){let P={type:b},I=chunkB45ECEGY_js.d(v,"w","pPr");I&&(P.pPr=Be(I,t));let B=chunkB45ECEGY_js.d(v,"w","rPr");B&&(P.rPr=de(B,t));let R=chunkB45ECEGY_js.d(v,"w","tblPr");R&&(P.tblPr=Et(R));let k=chunkB45ECEGY_js.d(v,"w","trPr");k&&(P.trPr=At(k));let N=chunkB45ECEGY_js.d(v,"w","tcPr");N&&(P.tcPr=Dt(N)),n.tblStylePr.push(P);}}}return n}function On(e,t){if(!e)return;let n={},r=chunkB45ECEGY_js.d(e,"w","rPrDefault");if(r){let i=chunkB45ECEGY_js.d(r,"w","rPr");i&&(n.rPr=de(i,t));}let o=chunkB45ECEGY_js.d(e,"w","pPrDefault");if(o){let i=chunkB45ECEGY_js.d(o,"w","pPr");i&&(n.pPr=Be(i,t));}return n.rPr||n.pPr?n:void 0}function Xn(e,t){if(!t)return e;if(!e)return t?{...t}:void 0;let n={...e};for(let r of Object.keys(t)){let o=t[r];if(o!==void 0)if(r==="runProperties")n.runProperties=chunkB45ECEGY_js.n(n.runProperties,t.runProperties);else if(r==="borders"||r==="numPr"||r==="frame"){let i=n[r],s=o;n[r]={...i||{},...s||{}};}else r==="tabs"&&Array.isArray(o)?n.tabs=[...o]:n[r]=o;}return n}function Bt(e,t,n,r=new Set){if(r.has(e.styleId)||(r.add(e.styleId),!e.basedOn))return e;let o=t.get(e.basedOn);if(!o)return e;let i=Bt(o,t,n,r),s={...e,pPr:Xn(i.pPr,e.pPr),rPr:chunkB45ECEGY_js.n(i.rPr,e.rPr)};return e.type==="table"&&((i.tblPr||e.tblPr)&&(s.tblPr={...i.tblPr||{},...e.tblPr||{}}),(i.trPr||e.trPr)&&(s.trPr={...i.trPr||{},...e.trPr||{}}),(i.tcPr||e.tcPr)&&(s.tcPr={...i.tcPr||{},...e.tcPr||{}})),s}function Le(e,t){let n=new Map;try{let r=chunkB45ECEGY_js.c(e);if(!r)return n;let o=chunkB45ECEGY_js.e(r,"w","style");for(let i of o){let s=Nn(i,t);s.styleId&&n.set(s.styleId,s);}for(let[i,s]of n){let a=Bt(s,n,t);n.set(i,a);}}catch(r){console.warn("Failed to parse styles:",r);}return n}function Lt(e,t){let n={styles:[]};try{let r=chunkB45ECEGY_js.c(e);if(!r)return n;let o=chunkB45ECEGY_js.d(r,"w","docDefaults");n.docDefaults=On(o,t);let i=chunkB45ECEGY_js.d(r,"w","latentStyles");i&&(n.latentStyles={defLockedState:chunkB45ECEGY_js.g(i,"w","defLockedState")==="1",defUIPriority:chunkB45ECEGY_js.h(i,"w","defUIPriority"),defSemiHidden:chunkB45ECEGY_js.g(i,"w","defSemiHidden")==="1",defUnhideWhenUsed:chunkB45ECEGY_js.g(i,"w","defUnhideWhenUsed")==="1",defQFormat:chunkB45ECEGY_js.g(i,"w","defQFormat")==="1",count:chunkB45ECEGY_js.h(i,"w","count")});let s=Le(e,t);n.styles=Array.from(s.values());}catch(r){console.warn("Failed to parse style definitions:",r);}return n}function Mt(e){let t={abstractNums:[],nums:[]};if(!e)return Me(t);let n=chunkB45ECEGY_js.c(e);if(!n)return Me(t);let r=chunkB45ECEGY_js.e(n,"w","abstractNum");for(let i of r){let s=zn(i);s&&t.abstractNums.push(s);}let o=chunkB45ECEGY_js.e(n,"w","num");for(let i of o){let s=_n(i);s&&t.nums.push(s);}return Me(t)}function zn(e){let t=chunkB45ECEGY_js.g(e,"w","abstractNumId");if(t===null)return null;let n=parseInt(t,10);if(isNaN(n))return null;let r={abstractNumId:n,levels:[]},o=chunkB45ECEGY_js.d(e,"w","multiLevelType");if(o){let u=chunkB45ECEGY_js.g(o,"w","val");(u==="hybridMultilevel"||u==="multilevel"||u==="singleLevel")&&(r.multiLevelType=u);}let i=chunkB45ECEGY_js.d(e,"w","name");i&&(r.name=chunkB45ECEGY_js.g(i,"w","val")??void 0);let s=chunkB45ECEGY_js.d(e,"w","numStyleLink");s&&(r.numStyleLink=chunkB45ECEGY_js.g(s,"w","val")??void 0);let a=chunkB45ECEGY_js.d(e,"w","styleLink");a&&(r.styleLink=chunkB45ECEGY_js.g(a,"w","val")??void 0);let l=chunkB45ECEGY_js.e(e,"w","lvl");for(let u of l){let m=Nt(u);m&&r.levels.push(m);}return r.levels.sort((u,m)=>u.ilvl-m.ilvl),r}function _n(e){let t=chunkB45ECEGY_js.g(e,"w","numId");if(t===null)return null;let n=parseInt(t,10);if(isNaN(n))return null;let r=chunkB45ECEGY_js.d(e,"w","abstractNumId");if(!r)return null;let o=chunkB45ECEGY_js.g(r,"w","val");if(o===null)return null;let i=parseInt(o,10);if(isNaN(i))return null;let s={numId:n,abstractNumId:i},a=chunkB45ECEGY_js.e(e,"w","lvlOverride");if(a.length>0){s.levelOverrides=[];for(let l of a){let u=chunkB45ECEGY_js.g(l,"w","ilvl");if(u===null)continue;let m=parseInt(u,10);if(isNaN(m))continue;let h={ilvl:m},g=chunkB45ECEGY_js.d(l,"w","startOverride");if(g){let p=chunkB45ECEGY_js.g(g,"w","val");if(p!==null){let y=parseInt(p,10);isNaN(y)||(h.startOverride=y);}}let x=chunkB45ECEGY_js.d(l,"w","lvl");x&&(h.lvl=Nt(x)??void 0),s.levelOverrides.push(h);}}return s}function Nt(e){let t=chunkB45ECEGY_js.g(e,"w","ilvl");if(t===null)return null;let n=parseInt(t,10);if(isNaN(n)||n<0||n>8)return null;let r={ilvl:n,numFmt:"decimal",lvlText:""},o=chunkB45ECEGY_js.d(e,"w","start");if(o){let p=chunkB45ECEGY_js.g(o,"w","val");if(p!==null){let y=parseInt(p,10);isNaN(y)||(r.start=y);}}let i=chunkB45ECEGY_js.d(e,"w","numFmt");if(i){let p=chunkB45ECEGY_js.g(i,"w","val");p&&(r.numFmt=jn(p));}let s=chunkB45ECEGY_js.d(e,"w","lvlText");s&&(r.lvlText=chunkB45ECEGY_js.g(s,"w","val")??"");let a=chunkB45ECEGY_js.d(e,"w","lvlJc");if(a){let p=chunkB45ECEGY_js.g(a,"w","val");(p==="left"||p==="center"||p==="right")&&(r.lvlJc=p);}let l=chunkB45ECEGY_js.d(e,"w","suff");if(l){let p=chunkB45ECEGY_js.g(l,"w","val");(p==="tab"||p==="space"||p==="nothing")&&(r.suffix=p);}let u=chunkB45ECEGY_js.d(e,"w","isLgl");u&&(r.isLgl=chunkB45ECEGY_js.i(u));let m=chunkB45ECEGY_js.d(e,"w","lvlRestart");if(m){let p=chunkB45ECEGY_js.g(m,"w","val");if(p!==null){let y=parseInt(p,10);isNaN(y)||(r.lvlRestart=y);}}let h=chunkB45ECEGY_js.d(e,"w","legacy");h&&(r.legacy={legacy:chunkB45ECEGY_js.i(h),legacySpace:chunkB45ECEGY_js.h(h,"w","legacySpace"),legacyIndent:chunkB45ECEGY_js.h(h,"w","legacyIndent")});let g=chunkB45ECEGY_js.d(e,"w","pPr");g&&(r.pPr=Hn(g));let x=chunkB45ECEGY_js.d(e,"w","rPr");return x&&(r.rPr=Un(x)),r}function jn(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 Hn(e){let t={},n=chunkB45ECEGY_js.d(e,"w","ind");if(n){let o=chunkB45ECEGY_js.h(n,"w","left"),i=chunkB45ECEGY_js.h(n,"w","right"),s=chunkB45ECEGY_js.h(n,"w","start"),a=chunkB45ECEGY_js.h(n,"w","end"),l=chunkB45ECEGY_js.h(n,"w","firstLine"),u=chunkB45ECEGY_js.h(n,"w","hanging"),m=o??s,h=i??a;m!==void 0&&(t.indentLeft=m),h!==void 0&&(t.indentRight=h),u!==void 0?(t.indentFirstLine=-u,t.hangingIndent=true):l!==void 0&&(t.indentFirstLine=l);}let r=chunkB45ECEGY_js.d(e,"w","tabs");if(r){t.tabs=[];let o=chunkB45ECEGY_js.e(r,"w","tab");for(let i of o){let s=chunkB45ECEGY_js.h(i,"w","pos"),a=chunkB45ECEGY_js.g(i,"w","val"),l=chunkB45ECEGY_js.g(i,"w","leader");s!==void 0&&a&&t.tabs.push({position:s,alignment:Vn(a),leader:Wn(l)});}}return t}function Vn(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 Wn(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 Un(e){let t={},n=chunkB45ECEGY_js.d(e,"w","rFonts");n&&(t.fontFamily={ascii:chunkB45ECEGY_js.g(n,"w","ascii")??void 0,hAnsi:chunkB45ECEGY_js.g(n,"w","hAnsi")??void 0,eastAsia:chunkB45ECEGY_js.g(n,"w","eastAsia")??void 0,cs:chunkB45ECEGY_js.g(n,"w","cs")??void 0});let r=chunkB45ECEGY_js.d(e,"w","sz");if(r){let l=chunkB45ECEGY_js.h(r,"w","val");l!==void 0&&(t.fontSize=l);}let o=chunkB45ECEGY_js.d(e,"w","color");if(o){let l=chunkB45ECEGY_js.g(o,"w","val"),u=chunkB45ECEGY_js.g(o,"w","themeColor");l==="auto"?t.color={auto:true}:u?t.color={themeColor:u,themeTint:chunkB45ECEGY_js.g(o,"w","themeTint")??void 0,themeShade:chunkB45ECEGY_js.g(o,"w","themeShade")??void 0}:l&&(t.color={rgb:l});}let i=chunkB45ECEGY_js.d(e,"w","b");i&&(t.bold=chunkB45ECEGY_js.i(i));let s=chunkB45ECEGY_js.d(e,"w","i");s&&(t.italic=chunkB45ECEGY_js.i(s));let a=chunkB45ECEGY_js.d(e,"w","vanish");return a&&(t.hidden=chunkB45ECEGY_js.i(a)),t}function Me(e){let t=new Map;for(let r of e.abstractNums)t.set(r.abstractNumId,r);let n=new Map;for(let r of e.nums)n.set(r.numId,r);return {definitions:e,getLevel(r,o){let i=n.get(r);if(!i)return null;if(i.levelOverrides){let a=i.levelOverrides.find(l=>l.ilvl===o);if(a){if(a.lvl)return a.lvl;let l=t.get(i.abstractNumId);if(l){let u=l.levels.find(m=>m.ilvl===o);if(u&&a.startOverride!==void 0)return {...u,start:a.startOverride}}}}let s=t.get(i.abstractNumId);if(!s)return null;if(s.numStyleLink&&s.levels.length===0){for(let a of t.values())if(a.styleLink===s.numStyleLink&&a.levels.length>0){s=a;break}}return s.levels.find(a=>a.ilvl===o)??null},getAbstract(r){return t.get(r)??null},getInstance(r){return n.get(r)??null},hasNumbering(r){return n.has(r)}}}function Zn(e){let t=new Map,n=chunkB45ECEGY_js.b(e);if(!n)return t;let r=chunkB45ECEGY_js.d(n,"w16cex","commentsExtensible")??n;for(let o of chunkB45ECEGY_js.f(r)){if((o.name?.replace(/^.*:/,"")??"")!=="comment")continue;let s=chunkB45ECEGY_js.g(o,"w16cex","paraId")??chunkB45ECEGY_js.g(o,"w15","paraId")??o.attributes?.["w16cex:paraId"]??o.attributes?.["w15:paraId"],a=chunkB45ECEGY_js.g(o,"w16cex","dateUtc")??chunkB45ECEGY_js.g(o,"w15","dateUtc")??o.attributes?.["w16cex:dateUtc"]??o.attributes?.["w15:dateUtc"];s&&a&&t.set(String(s).toUpperCase(),String(a));}return t}function Gn(e){let t=new Map,n=new Map,r=chunkB45ECEGY_js.b(e);if(!r)return {parentByParaId:t,doneByParaId:n};let o=chunkB45ECEGY_js.d(r,"w15","commentsEx")??r;for(let i of chunkB45ECEGY_js.f(o)){if((i.name?.replace(/^.*:/,"")??"")!=="commentEx")continue;let a=chunkB45ECEGY_js.g(i,"w15","paraId")??i.attributes?.["w15:paraId"],l=chunkB45ECEGY_js.g(i,"w15","paraIdParent")??i.attributes?.["w15:paraIdParent"],u=chunkB45ECEGY_js.g(i,"w15","done")??i.attributes?.["w15:done"];if(a){let m=String(a).toUpperCase();l&&t.set(m,String(l).toUpperCase()),u==="1"&&n.set(m,true);}}return {parentByParaId:t,doneByParaId:n}}function Ot(e,t,n,r,o,i,s){if(!e)return [];let a=chunkB45ECEGY_js.b(e);if(!a)return [];let l=i?Zn(i):new Map,u=s?Gn(s):null,m=chunkB45ECEGY_js.d(a,"w","comments")??a,h=chunkB45ECEGY_js.f(m),g=[],x=[];for(let p of h){if((p.name?.replace(/^.*:/,"")??"")!=="comment")continue;let C=parseInt(chunkB45ECEGY_js.g(p,"w","id")??"0",10),E=chunkB45ECEGY_js.g(p,"w","author")??"Unknown",D=chunkB45ECEGY_js.g(p,"w","initials"),A=D!=null?String(D):void 0,v=chunkB45ECEGY_js.g(p,"w","date"),b=v!=null?String(v):void 0,P=chunkB45ECEGY_js.g(p,"w14","paraId")??p.attributes?.["w14:paraId"]??chunkB45ECEGY_js.g(p,"w","paraId"),B=(P?l.get(String(P).toUpperCase()):void 0)??b,R=chunkB45ECEGY_js.g(p,"w","done")??p.attributes?.["w:done"],k=R==="1"||R==="true"?true:void 0,N=chunkB45ECEGY_js.g(p,"w16cid","parentId")??chunkB45ECEGY_js.g(p,"w","parentId")??p.attributes?.["w16cid:parentId"]??p.attributes?.["w:parentId"],q=N!=null?parseInt(String(N),10):void 0,K=[],V="";for(let L of chunkB45ECEGY_js.f(p))if((L.name?.replace(/^.*:/,"")??"")==="p"){let T=chunkB45ECEGY_js.s(L,t,n,null,r,o);K.push(T);let z=chunkB45ECEGY_js.g(L,"w14","paraId")??L.attributes?.["w14:paraId"];z&&(V=String(z).toUpperCase());}k==null&&u&&V&&u.doneByParaId.get(V)&&(k=true),x.push(V),g.push({id:C,author:E,initials:A,date:B,content:K,...k!=null?{done:k}:{},...q!=null&&!isNaN(q)?{parentId:q}:{}});}if(u&&u.parentByParaId.size>0){let p=new Map;for(let y=0;y<g.length;y++){let C=x[y];C&&p.set(C,g[y].id);}for(let y=0;y<g.length;y++){if(g[y].parentId!=null)continue;let C=x[y];if(!C)continue;let E=u.parentByParaId.get(C);if(!E)continue;let D=p.get(E);D!=null&&(g[y]={...g[y],parentId:D});}}return g}async function Ne(e,t={}){let n=e instanceof ArrayBuffer?e:await chunkGGQK26JO_js.a(e),{onProgress:r=()=>{},preloadFonts:o=true,parseHeadersFooters:i=true,parseNotes:s=true,detectVariables:a=true}=t,l=[];try{let g=function(L,_){let T=performance.now(),z=_(),O=performance.now()-T;return h.push({stage:L,ms:O}),O>1e3&&console.warn(`[parseDocx] ${L} took ${Math.round(O)}ms`),z};var u=g;let m=performance.now(),h=[];async function x(L,_){let T=performance.now(),z=await _(),O=performance.now()-T;return h.push({stage:L,ms:O}),O>1e3&&console.warn(`[parseDocx] ${L} took ${Math.round(O)}ms`),z}r("Extracting DOCX...",0);let p=await x("unzip",()=>Ft(n));r("Extracted DOCX",10),r("Parsing relationships...",10);let y=g("relationships",()=>p.documentRels?chunkB45ECEGY_js.k(p.documentRels):new Map);r("Parsed relationships",15),r("Parsing theme...",15);let C=g("theme",()=>chunkB45ECEGY_js.l(p.themeXml));r("Parsed theme",20),r("Parsing styles...",20);let E=null,D;g("styles",()=>{p.stylesXml&&(E=Le(p.stylesXml,C),D=Lt(p.stylesXml,C));}),r("Parsed styles",30),r("Parsing numbering...",30);let A=g("numbering",()=>Mt(p.numberingXml));r("Parsed numbering",35),r("Processing media files...",35);let v=g("media",()=>Jn(p,y));r("Processed media",40),r("Parsing document body...",40);let b={content:[]};g("documentBody",()=>{p.documentXml?b=chunkB45ECEGY_js.u(p.documentXml,E,C,A,y,v):l.push("No document.xml found in DOCX");}),r("Parsed document body",55);let P,I;if(i){r("Parsing headers/footers...",55);let L=g("headersFooters",()=>Yn(p,E,C,A,y,v));P=L.headers,I=L.footers,r("Parsed headers/footers",65);}else r("Skipping headers/footers",65);let B,R;if(s){r("Parsing footnotes/endnotes...",65);let L=g("footnotesEndnotes",()=>qn(p,E,C,A,y,v));B=L.footnotes,R=L.endnotes,r("Parsed footnotes/endnotes",75);}else r("Skipping footnotes/endnotes",75);r("Parsing comments...",75);let k=g("comments",()=>Ot(p.commentsXml,E,C,y,v,p.commentsExtensibleXml,p.commentsExtendedXml));k.length>0&&(b.comments=k);let N;a?(r("Detecting template variables...",75),N=g("variables",()=>chunkB45ECEGY_js.t(b.content)),r("Detected variables",80)):r("Skipping variable detection",80),o?(r("Loading fonts...",80),await x("fonts",()=>Kn(C,D,b)),r("Loaded fonts",95)):r("Skipping font loading",95),r("Assembling document...",95);let K={package:{document:b,styles:D,theme:C,numbering:A.definitions,headers:P,footers:I,footnotes:B,endnotes:R,relationships:y,media:v},originalBuffer:n,templateVariables:N,warnings:l.length>0?l:void 0},V=performance.now()-m;if(V>2e3){let L=h.filter(_=>_.ms>100).map(_=>`${_.stage}: ${Math.round(_.ms)}ms`).join(", ");console.warn(`[parseDocx] Total: ${Math.round(V)}ms`+(L?` (${L})`:""));}return r("Complete",100),K}catch(m){let h=m instanceof Error?m.message:String(m);throw console.error("[parseDocx] Failed to parse DOCX:",h,m),new Error(`Failed to parse DOCX: ${h}`)}}function Jn(e,t){let n=new Map;for(let[r,o]of e.media.entries()){let i=r.split("/").pop()||r,s=It(r),a=new Uint8Array(o),l="";for(let x=0;x<a.length;x++)l+=String.fromCharCode(a[x]);let u=btoa(l),m=`data:${s};base64,${u}`,h={path:r,filename:i,mimeType:s,data:o,dataUrl:m};n.set(r,h);let g=r.replace(/^word\//,"");g!==r&&n.set(g,h);}return n}function ge(e,t){let n=t.toLowerCase();for(let[r,o]of e.entries())if(r.toLowerCase()===n)return o}function Yn(e,t,n,r,o,i){let s=new Map,a=new Map;for(let[l,u]of o.entries())if(u.type===chunkB45ECEGY_js.j.header&&u.target){let m=u.target.split("/").pop()||u.target,h=ge(e.headers,m);if(h){let g=`word/_rels/${m}.rels`,x=ge(e.allXml,g),p=x?chunkB45ECEGY_js.k(x):o,y=chunkB45ECEGY_js.o(h,"default",t,n,r,p,i);s.set(l,y);}}else if(u.type===chunkB45ECEGY_js.j.footer&&u.target){let m=u.target.split("/").pop()||u.target,h=ge(e.footers,m);if(h){let g=`word/_rels/${m}.rels`,x=ge(e.allXml,g),p=x?chunkB45ECEGY_js.k(x):o,y=chunkB45ECEGY_js.p(h,"default",t,n,r,p,i);a.set(l,y);}}return {headers:s,footers:a}}function qn(e,t,n,r,o,i){let s=chunkB45ECEGY_js.q(e.footnotesXml,t,n,r,o,i),a=chunkB45ECEGY_js.r(e.endnotesXml,t,n,r,o,i);return {footnotes:s.getNormalFootnotes(),endnotes:a.getNormalEndnotes()}}async function Kn(e,t,n){let r=new Set;if(e?.fontScheme){let{majorFont:o,minorFont:i}=e.fontScheme;o?.latin&&r.add(o.latin),i?.latin&&r.add(i.latin);}if(t?.docDefaults?.rPr?.fontFamily?.ascii&&r.add(t.docDefaults.rPr.fontFamily.ascii),t?.styles)for(let o of t.styles)o.rPr?.fontFamily?.ascii&&r.add(o.rPr.fontFamily.ascii),o.rPr?.fontFamily?.hAnsi&&r.add(o.rPr.fontFamily.hAnsi);if(n.content){for(let o of n.content)if(o.type==="paragraph")for(let i of o.content)i.type==="run"&&i.formatting?.fontFamily&&(i.formatting.fontFamily.ascii&&r.add(i.formatting.fontFamily.ascii),i.formatting.fontFamily.hAnsi&&r.add(i.formatting.fontFamily.hAnsi));}if(r.size>0)try{await chunkGGQK26JO_js.c(Array.from(r));}catch(o){console.warn("Failed to load some fonts:",o);}}function w(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function d(e){return e==null||!Number.isFinite(e)?"0":String(Math.round(e))}var Xt=1e5;function zt(){Xt=1e5;}function _t(e){return e!=null&&e!==""&&e!==0?String(e):String(Xt++)}var Qn=new Set(["black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","red","white","yellow"]);function er(e){if(!e)return "";let t=[];return e.auto?t.push('w:val="auto"'):e.rgb&&t.push(`w:val="${e.rgb}"`),e.themeColor&&t.push(`w:themeColor="${e.themeColor}"`),e.themeTint&&t.push(`w:themeTint="${e.themeTint}"`),e.themeShade&&t.push(`w:themeShade="${e.themeShade}"`),t.length===0?"":`<w:color ${t.join(" ")}/>`}function tr(e){if(!e)return "";let t=[];return e.pattern?t.push(`w:val="${e.pattern}"`):t.push('w:val="clear"'),e.color?.rgb?t.push(`w:color="${e.color.rgb}"`):e.color?.auto&&t.push('w:color="auto"'),e.fill?.rgb?t.push(`w:fill="${e.fill.rgb}"`):e.fill?.auto&&t.push('w:fill="auto"'),e.fill?.themeColor&&t.push(`w:themeFill="${e.fill.themeColor}"`),e.fill?.themeTint&&t.push(`w:themeFillTint="${e.fill.themeTint}"`),e.fill?.themeShade&&t.push(`w:themeFillShade="${e.fill.themeShade}"`),t.length===0?"":`<w:shd ${t.join(" ")}/>`}function Q(e){if(!e)return "";let t=[];if(e.styleId&&t.push(`<w:rStyle w:val="${w(e.styleId)}"/>`),e.fontFamily){let o=[];e.fontFamily.ascii&&o.push(`w:ascii="${w(e.fontFamily.ascii)}"`),e.fontFamily.hAnsi&&o.push(`w:hAnsi="${w(e.fontFamily.hAnsi)}"`),e.fontFamily.eastAsia&&o.push(`w:eastAsia="${w(e.fontFamily.eastAsia)}"`),e.fontFamily.cs&&o.push(`w:cs="${w(e.fontFamily.cs)}"`),e.fontFamily.asciiTheme&&o.push(`w:asciiTheme="${e.fontFamily.asciiTheme}"`),e.fontFamily.hAnsiTheme&&o.push(`w:hAnsiTheme="${e.fontFamily.hAnsiTheme}"`),e.fontFamily.eastAsiaTheme&&o.push(`w:eastAsiaTheme="${e.fontFamily.eastAsiaTheme}"`),e.fontFamily.csTheme&&o.push(`w:csTheme="${e.fontFamily.csTheme}"`),o.length>0&&t.push(`<w:rFonts ${o.join(" ")}/>`);}e.bold===true?t.push("<w:b/>"):e.bold===false&&t.push('<w:b w:val="0"/>'),e.boldCs===true?t.push("<w:bCs/>"):e.boldCs===false&&t.push('<w:bCs w:val="0"/>'),e.italic===true?t.push("<w:i/>"):e.italic===false&&t.push('<w:i w:val="0"/>'),e.italicCs===true?t.push("<w:iCs/>"):e.italicCs===false&&t.push('<w:iCs w:val="0"/>'),e.allCaps&&t.push("<w:caps/>"),e.smallCaps&&t.push("<w:smallCaps/>"),e.strike&&t.push("<w:strike/>"),e.doubleStrike&&t.push("<w:dstrike/>"),e.outline&&t.push("<w:outline/>"),e.shadow&&t.push("<w:shadow/>"),e.emboss&&t.push("<w:emboss/>"),e.imprint&&t.push("<w:imprint/>"),e.hidden&&t.push("<w:vanish/>");let n=er(e.color);if(n&&t.push(n),e.spacing!==void 0&&t.push(`<w:spacing w:val="${d(e.spacing)}"/>`),e.scale!==void 0&&t.push(`<w:w w:val="${d(e.scale)}"/>`),e.kerning!==void 0&&t.push(`<w:kern w:val="${d(e.kerning)}"/>`),e.position!==void 0&&t.push(`<w:position w:val="${d(e.position)}"/>`),e.fontSize!==void 0&&t.push(`<w:sz w:val="${d(e.fontSize)}"/>`),e.fontSizeCs!==void 0&&t.push(`<w:szCs w:val="${d(e.fontSizeCs)}"/>`),e.highlight&&e.highlight!=="none"){if(Qn.has(e.highlight))t.push(`<w:highlight w:val="${e.highlight}"/>`);else if(!e.shading){let o=e.highlight.replace(/^#/,"");/^[0-9a-fA-F]{6}$/.test(o)&&t.push(`<w:shd w:val="clear" w:color="auto" w:fill="${o}"/>`);}}if(e.underline){let o=[`w:val="${e.underline.style}"`];e.underline.color&&(e.underline.color.rgb&&o.push(`w:color="${e.underline.color.rgb}"`),e.underline.color.themeColor&&o.push(`w:themeColor="${e.underline.color.themeColor}"`),e.underline.color.themeTint&&o.push(`w:themeTint="${e.underline.color.themeTint}"`),e.underline.color.themeShade&&o.push(`w:themeShade="${e.underline.color.themeShade}"`)),t.push(`<w:u ${o.join(" ")}/>`);}e.effect&&e.effect!=="none"&&t.push(`<w:effect w:val="${e.effect}"/>`),e.emphasisMark&&e.emphasisMark!=="none"&&t.push(`<w:em w:val="${e.emphasisMark}"/>`);let r=tr(e.shading);return r&&t.push(r),e.vertAlign&&e.vertAlign!=="baseline"&&t.push(`<w:vertAlign w:val="${e.vertAlign}"/>`),e.rtl&&t.push("<w:rtl/>"),e.cs&&t.push("<w:cs/>"),t.length===0?"":`<w:rPr>${t.join("")}</w:rPr>`}function nr(e){return !e.startsWith("<w:rPr>")||!e.endsWith("</w:rPr>")?"":e.slice(7,-8)}function rr(e){let t=Number.isInteger(e.info.id)&&e.info.id>=0?e.info.id:0,n=typeof e.info.author=="string"?e.info.author.trim():"",r=n.length>0?n:"Unknown",o=typeof e.info.date=="string"?e.info.date.trim():void 0,i=typeof e.info.rsid=="string"?e.info.rsid.trim():void 0,s=[`w:id="${t}"`,`w:author="${w(r)}"`];o&&s.push(`w:date="${w(o)}"`),i&&s.push(`w:rsid="${w(i)}"`);let a=Q(e.previousFormatting)||"<w:rPr/>";return `<w:rPrChange ${s.join(" ")}>${a}</w:rPrChange>`}function or(e,t){let n=Q(e),r=n?nr(n):"",o=(t??[]).map(rr).join(""),i=`${r}${o}`;return i?`<w:rPr>${i}</w:rPr>`:""}function ir(e){return `<w:t${e.preserveSpace||e.text.startsWith(" ")||e.text.endsWith(" ")||e.text.includes(" ")?' xml:space="preserve"':""}>${w(e.text)}</w:t>`}function sr(e){return "<w:tab/>"}function ar(e){let t=[];return e.breakType==="page"?t.push('w:type="page"'):e.breakType==="column"?t.push('w:type="column"'):e.breakType==="textWrapping"&&(t.push('w:type="textWrapping"'),e.clear&&e.clear!=="none"&&t.push(`w:clear="${e.clear}"`)),t.length===0?"<w:br/>":`<w:br ${t.join(" ")}/>`}function lr(e){return `<w:sym w:font="${w(e.font)}" w:char="${w(e.char)}"/>`}function cr(e){return e.type==="footnoteRef"?`<w:footnoteReference w:id="${e.id}"/>`:`<w:endnoteReference w:id="${e.id}"/>`}function ur(e){let t=[`w:fldCharType="${e.charType}"`];return e.fldLock&&t.push('w:fldLock="true"'),e.dirty&&t.push('w:dirty="true"'),`<w:fldChar ${t.join(" ")}/>`}function pr(e){return `<w:instrText${e.text.startsWith(" ")||e.text.endsWith(" ")||e.text.includes(" ")?' xml:space="preserve"':""}>${w(e.text)}</w:instrText>`}function fr(e){return "<w:softHyphen/>"}function mr(e){return "<w:noBreakHyphen/>"}function Oe(e){if(!e)return "";if(e.rgb)return `<a:srgbClr val="${e.rgb.replace("#","")}"/>`;if(e.themeColor){let t=`<a:schemeClr val="${e.themeColor}"`;return e.themeTint?t+=`><a:tint val="${e.themeTint}"/></a:schemeClr>`:e.themeShade?t+=`><a:shade val="${e.themeShade}"/></a:schemeClr>`:t+="/>",t}return ""}function dr(e){if(!e||e.type==="none")return "<a:noFill/>";if(e.type==="solid"&&e.color)return `<a:solidFill>${Oe(e.color)}</a:solidFill>`;if(e.type==="gradient"&&e.gradient){let t=e.gradient,n=t.stops.map(o=>`<a:gs pos="${o.position}">${Oe(o.color)}</a:gs>`).join(""),r=t.type==="linear"?`<a:lin ang="${(t.angle||0)*6e4}" scaled="1"/>`:"";return `<a:gradFill><a:gsLst>${n}</a:gsLst>${r}</a:gradFill>`}return ""}function jt(e){if(!e)return "";let t=[];e.width!=null&&t.push(`w="${e.width}"`),e.cap&&t.push(`cap="${e.cap}"`);let n=[];return e.color&&n.push(`<a:solidFill>${Oe(e.color)}</a:solidFill>`),e.style&&e.style!=="solid"&&n.push(`<a:prstDash val="${e.style}"/>`),e.headEnd&&n.push(`<a:headEnd type="${e.headEnd.type}"${e.headEnd.width?` w="${e.headEnd.width}"`:""}${e.headEnd.length?` len="${e.headEnd.length}"`:""}/>`),e.tailEnd&&n.push(`<a:tailEnd type="${e.tailEnd.type}"${e.tailEnd.width?` w="${e.tailEnd.width}"`:""}${e.tailEnd.length?` len="${e.tailEnd.length}"`:""}/>`),n.length===0&&t.length===0?"":`<a:ln${t.length?" "+t.join(" "):""}>${n.join("")}</a:ln>`}function Ht(e){let t=[],n=e.horizontal;t.push(`<wp:positionH relativeFrom="${n.relativeTo}">`),n.alignment?t.push(`<wp:align>${n.alignment}</wp:align>`):t.push(`<wp:posOffset>${d(n.posOffset)}</wp:posOffset>`),t.push("</wp:positionH>");let r=e.vertical;return t.push(`<wp:positionV relativeFrom="${r.relativeTo}">`),r.alignment?t.push(`<wp:align>${r.alignment}</wp:align>`):t.push(`<wp:posOffset>${d(r.posOffset)}</wp:posOffset>`),t.push("</wp:positionV>"),t.join("")}function Vt(e){let t=e.wrapText?` wrapText="${e.wrapText}"`:' wrapText="bothSides"';switch(e.type){case "square":return `<wp:wrapSquare${t}/>`;case "tight":return `<wp:wrapTight${t}><wp:wrapPolygon edited="0"><wp:start x="0" y="0"/><wp:lineTo x="0" y="21600"/><wp:lineTo x="21600" y="21600"/><wp:lineTo x="21600" y="0"/><wp:lineTo x="0" y="0"/></wp:wrapPolygon></wp:wrapTight>`;case "through":return `<wp:wrapThrough${t}><wp:wrapPolygon edited="0"><wp:start x="0" y="0"/><wp:lineTo x="0" y="21600"/><wp:lineTo x="21600" y="21600"/><wp:lineTo x="21600" y="0"/><wp:lineTo x="0" y="0"/></wp:wrapPolygon></wp:wrapThrough>`;case "topAndBottom":return "<wp:wrapTopAndBottom/>";case "behind":case "inFront":return "<wp:wrapNone/>";default:return "<wp:wrapNone/>"}}function hr(e,t){let n=e.size.width,r=e.size.height,o=e.rId||"rId1",i=t,s=e.filename||`image${i}`,a="";e.transform?.rotation&&(a+=` rot="${Math.round(e.transform.rotation*6e4)}"`),e.transform?.flipH&&(a+=' flipH="1"'),e.transform?.flipV&&(a+=' flipV="1"');let l=e.opacity!==void 0&&e.opacity<1?`<a:alphaModFix amt="${Math.round(Math.max(0,Math.min(1,e.opacity))*1e5)}"/>`:"",u=l?`<a:blip r:embed="${o}">${l}</a:blip>`:`<a:blip r:embed="${o}"/>`,m=[];e.crop?.left&&m.push(`l="${Math.round(e.crop.left*1e5)}"`),e.crop?.top&&m.push(`t="${Math.round(e.crop.top*1e5)}"`),e.crop?.right&&m.push(`r="${Math.round(e.crop.right*1e5)}"`),e.crop?.bottom&&m.push(`b="${Math.round(e.crop.bottom*1e5)}"`);let h=m.length>0?`<a:srcRect ${m.join(" ")}/>`:"";return ['<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">','<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">','<pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">',"<pic:nvPicPr>",`<pic:cNvPr id="${i}" name="${w(s)}"${e.alt?` descr="${w(e.alt)}"`:""}/>`,"<pic:cNvPicPr/>","</pic:nvPicPr>","<pic:blipFill>",u,h,"<a:stretch><a:fillRect/></a:stretch>","</pic:blipFill>","<pic:spPr>",`<a:xfrm${a}>`,'<a:off x="0" y="0"/>',`<a:ext cx="${d(n)}" cy="${d(r)}"/>`,"</a:xfrm>",'<a:prstGeom prst="rect"><a:avLst/></a:prstGeom>',e.outline?jt(e.outline):"","</pic:spPr>","</pic:pic>","</a:graphicData>","</a:graphic>"].join("")}function gr(e){let t=e.image,n=t.wrap.type!=="inline",r=t.size.width,o=t.size.height,i=t.wrap.distT??0,s=t.wrap.distB??0,a=t.wrap.distL??0,l=t.wrap.distR??0,u=t.padding?.left??0,m=t.padding?.top??0,h=t.padding?.right??0,g=t.padding?.bottom??0,x=`<wp:effectExtent l="${d(u)}" t="${d(m)}" r="${d(h)}" b="${d(g)}"/>`,p=_t(t.id),y=t.title||t.filename||`Picture ${p}`,C=hr(t,p);if(!n)return ["<w:drawing>",`<wp:inline distT="${d(i)}" distB="${d(s)}" distL="${d(a)}" distR="${d(l)}">`,`<wp:extent cx="${d(r)}" cy="${d(o)}"/>`,x,`<wp:docPr id="${p}" name="${w(y)}"${t.alt?` descr="${w(t.alt)}"`:""}${t.decorative?' hidden="1"':""}/>`,'<wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/></wp:cNvGraphicFramePr>',C,"</wp:inline>","</w:drawing>"].join("");let E=t.wrap.type==="behind"?"1":"0",D=t.position?Ht(t.position):'<wp:positionH relativeFrom="column"><wp:posOffset>0</wp:posOffset></wp:positionH><wp:positionV relativeFrom="paragraph"><wp:posOffset>0</wp:posOffset></wp:positionV>',A=Vt(t.wrap);return ["<w:drawing>",`<wp:anchor distT="${d(i)}" distB="${d(s)}" distL="${d(a)}" distR="${d(l)}" simplePos="0" relativeHeight="251658240" behindDoc="${E}" locked="0" layoutInCell="${t.layoutInCell===false?"0":"1"}" allowOverlap="${t.allowOverlap===false?"0":"1"}">`,'<wp:simplePos x="0" y="0"/>',D,`<wp:extent cx="${d(r)}" cy="${d(o)}"/>`,x,A,`<wp:docPr id="${p}" name="${w(y)}"${t.alt?` descr="${w(t.alt)}"`:""}/>`,'<wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/></wp:cNvGraphicFramePr>',C,"</wp:anchor>","</w:drawing>"].join("")}function wr(e){return e.map(t=>G(t)).join("")}function yr(e){let t=e.shape,n=t.size.width,r=t.size.height,o=t.shapeType==="textBox",i=t.wrap&&t.wrap.type!=="inline",s=t.wrap?.distT??0,a=t.wrap?.distB??0,l=t.wrap?.distL??0,u=t.wrap?.distR??0,m=_t(t.id),h=t.name||(o?`TextBox ${m}`:`Shape ${m}`),g="";t.transform?.rotation&&(g+=` rot="${Math.round(t.transform.rotation*6e4)}"`),t.transform?.flipH&&(g+=' flipH="1"'),t.transform?.flipV&&(g+=' flipV="1"');let x=["<wps:spPr>",`<a:xfrm${g}>`,'<a:off x="0" y="0"/>',`<a:ext cx="${d(n)}" cy="${d(r)}"/>`,"</a:xfrm>",`<a:prstGeom prst="${t.shapeType==="textBox"?"rect":t.shapeType}"><a:avLst/></a:prstGeom>`,dr(t.fill),jt(t.outline),"</wps:spPr>"].join(""),p="";if(t.textBody){let v=t.textBody,b=['rot="0"','vert="horz"'];v.anchor&&b.push(`anchor="${v.anchor==="middle"?"ctr":v.anchor}"`),v.anchorCenter&&b.push('anchorCtr="1"'),v.margins&&(v.margins.left!=null&&b.push(`lIns="${d(v.margins.left)}"`),v.margins.top!=null&&b.push(`tIns="${d(v.margins.top)}"`),v.margins.right!=null&&b.push(`rIns="${d(v.margins.right)}"`),v.margins.bottom!=null&&b.push(`bIns="${d(v.margins.bottom)}"`)),o?p=["<wps:txbx><w:txbxContent>",wr(v.content),"</w:txbxContent></wps:txbx>",`<wps:bodyPr ${b.join(" ")}/>`].join(""):p=[`<wps:bodyPr ${b.join(" ")}/>`].join("");}let C=['<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">','<a:graphicData uri="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">',["<wps:wsp>",`<wps:cNvSpPr${o?' txBox="1"':""}/>`,x,p,"</wps:wsp>"].join(""),"</a:graphicData>","</a:graphic>"].join("");if(!i)return ["<w:drawing>",`<wp:inline distT="${d(s)}" distB="${d(a)}" distL="${d(l)}" distR="${d(u)}">`,`<wp:extent cx="${d(n)}" cy="${d(r)}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',`<wp:docPr id="${m}" name="${w(h)}"/>`,"<wp:cNvGraphicFramePr/>",C,"</wp:inline>","</w:drawing>"].join("");let E=t.wrap?.type==="behind"?"1":"0",D=t.position?Ht(t.position):'<wp:positionH relativeFrom="column"><wp:posOffset>0</wp:posOffset></wp:positionH><wp:positionV relativeFrom="paragraph"><wp:posOffset>0</wp:posOffset></wp:positionV>',A=Vt(t.wrap);return ["<w:drawing>",`<wp:anchor distT="${d(s)}" distB="${d(a)}" distL="${d(l)}" distR="${d(u)}" simplePos="0" relativeHeight="251658240" behindDoc="${E}" locked="0" layoutInCell="1" allowOverlap="1">`,'<wp:simplePos x="0" y="0"/>',D,`<wp:extent cx="${d(n)}" cy="${d(r)}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',A,`<wp:docPr id="${m}" name="${w(h)}"/>`,"<wp:cNvGraphicFramePr/>",C,"</wp:anchor>","</w:drawing>"].join("")}function xr(e){switch(e.type){case "text":return ir(e);case "tab":return sr();case "break":return ar(e);case "symbol":return lr(e);case "footnoteRef":case "endnoteRef":return cr(e);case "fieldChar":return ur(e);case "instrText":return pr(e);case "softHyphen":return fr();case "noBreakHyphen":return mr();case "drawing":return gr(e);case "shape":return yr(e);default:return ""}}function Z(e){let t=[],n=or(e.formatting,e.propertyChanges);n&&t.push(n);for(let r of e.content){let o=xr(r);o&&t.push(o);}return `<w:r>${t.join("")}</w:r>`}function ee(e,t){if(!e||e.style==="none"||e.style==="nil")return "";let n=[`w:val="${e.style}"`];return e.size!==void 0&&n.push(`w:sz="${d(e.size)}"`),e.space!==void 0&&n.push(`w:space="${d(e.space)}"`),e.color&&(e.color.auto?n.push('w:color="auto"'):e.color.rgb&&n.push(`w:color="${e.color.rgb}"`),e.color.themeColor&&n.push(`w:themeColor="${e.color.themeColor}"`),e.color.themeTint&&n.push(`w:themeTint="${e.color.themeTint}"`),e.color.themeShade&&n.push(`w:themeShade="${e.color.themeShade}"`)),e.shadow&&n.push('w:shadow="true"'),e.frame&&n.push('w:frame="true"'),`<w:${t} ${n.join(" ")}/>`}function br(e){if(!e)return "";let t=[];if(e.top){let n=ee(e.top,"top");n&&t.push(n);}if(e.left){let n=ee(e.left,"left");n&&t.push(n);}if(e.bottom){let n=ee(e.bottom,"bottom");n&&t.push(n);}if(e.right){let n=ee(e.right,"right");n&&t.push(n);}if(e.between){let n=ee(e.between,"between");n&&t.push(n);}if(e.bar){let n=ee(e.bar,"bar");n&&t.push(n);}return t.length===0?"":`<w:pBdr>${t.join("")}</w:pBdr>`}function Tr(e){if(!e)return "";let t=[];return e.pattern?t.push(`w:val="${e.pattern}"`):t.push('w:val="clear"'),e.color?.rgb?t.push(`w:color="${e.color.rgb}"`):e.color?.auto&&t.push('w:color="auto"'),e.fill?.rgb?t.push(`w:fill="${e.fill.rgb}"`):e.fill?.auto&&t.push('w:fill="auto"'),e.fill?.themeColor&&t.push(`w:themeFill="${e.fill.themeColor}"`),e.fill?.themeTint&&t.push(`w:themeFillTint="${e.fill.themeTint}"`),e.fill?.themeShade&&t.push(`w:themeFillShade="${e.fill.themeShade}"`),t.length===0?"":`<w:shd ${t.join(" ")}/>`}function vr(e){return !e||e.length===0?"":`<w:tabs>${e.map(n=>{let r=[`w:val="${n.alignment}"`,`w:pos="${d(n.position)}"`];return n.leader&&n.leader!=="none"&&r.push(`w:leader="${n.leader}"`),`<w:tab ${r.join(" ")}/>`}).join("")}</w:tabs>`}function Sr(e){let t=[];return e.spaceBefore!==void 0&&t.push(`w:before="${d(e.spaceBefore)}"`),e.spaceAfter!==void 0&&t.push(`w:after="${d(e.spaceAfter)}"`),e.lineSpacing!==void 0&&t.push(`w:line="${d(e.lineSpacing)}"`),e.lineSpacingRule&&t.push(`w:lineRule="${e.lineSpacingRule}"`),e.beforeAutospacing&&t.push('w:beforeAutospacing="1"'),e.afterAutospacing&&t.push('w:afterAutospacing="1"'),t.length===0?"":`<w:spacing ${t.join(" ")}/>`}function Cr(e){let t=[];return e.indentLeft!==void 0&&t.push(`w:left="${d(e.indentLeft)}"`),e.indentRight!==void 0&&t.push(`w:right="${d(e.indentRight)}"`),e.indentFirstLine!==void 0&&(e.hangingIndent?t.push(`w:hanging="${d(Math.abs(e.indentFirstLine))}"`):e.indentFirstLine!==0&&t.push(`w:firstLine="${d(e.indentFirstLine)}"`)),t.length===0?"":`<w:ind ${t.join(" ")}/>`}function Pr(e){if(!e)return "";let t=[];return e.ilvl!==void 0&&t.push(`<w:ilvl w:val="${d(e.ilvl)}"/>`),e.numId!==void 0&&t.push(`<w:numId w:val="${d(e.numId)}"/>`),t.length===0?"":`<w:numPr>${t.join("")}</w:numPr>`}function $r(e){if(!e)return "";let t=[];return e.width!==void 0&&t.push(`w:w="${d(e.width)}"`),e.height!==void 0&&t.push(`w:h="${d(e.height)}"`),e.hAnchor&&t.push(`w:hAnchor="${e.hAnchor}"`),e.vAnchor&&t.push(`w:vAnchor="${e.vAnchor}"`),e.x!==void 0&&t.push(`w:x="${d(e.x)}"`),e.y!==void 0&&t.push(`w:y="${d(e.y)}"`),e.xAlign&&t.push(`w:xAlign="${e.xAlign}"`),e.yAlign&&t.push(`w:yAlign="${e.yAlign}"`),e.wrap&&t.push(`w:wrap="${e.wrap}"`),t.length===0?"":`<w:framePr ${t.join(" ")}/>`}function Ut(e,t){let n=[];if(e){e.styleId&&n.push(`<w:pStyle w:val="${w(e.styleId)}"/>`),e.keepNext&&n.push("<w:keepNext/>"),e.keepLines&&n.push("<w:keepLines/>"),e.contextualSpacing&&n.push("<w:contextualSpacing/>"),e.pageBreakBefore&&n.push("<w:pageBreakBefore/>");let r=$r(e.frame);r&&n.push(r),e.widowControl===false?n.push('<w:widowControl w:val="0"/>'):e.widowControl===true&&n.push("<w:widowControl/>");let o=Pr(e.numPr);o&&n.push(o);let i=br(e.borders);i&&n.push(i);let s=Tr(e.shading);s&&n.push(s);let a=vr(e.tabs);a&&n.push(a),e.suppressLineNumbers&&n.push("<w:suppressLineNumbers/>"),e.suppressAutoHyphens&&n.push("<w:suppressAutoHyphens/>");let l=Sr(e);l&&n.push(l);let u=Cr(e);if(u&&n.push(u),e.bidi&&n.push("<w:bidi/>"),e.alignment&&n.push(`<w:jc w:val="${e.alignment}"/>`),e.outlineLevel!==void 0&&n.push(`<w:outlineLvl w:val="${e.outlineLevel}"/>`),e.runProperties){let m=Q(e.runProperties);m&&n.push(m);}}return t&&t.length>0&&n.push(...t.map(r=>Ir(r))),n.length===0?"":`<w:pPr>${n.join("")}</w:pPr>`}function Fr(e){return !e.startsWith("<w:pPr>")||!e.endsWith("</w:pPr>")?"":e.slice(7,-8)}function Ir(e){let t=Number.isInteger(e.info.id)&&e.info.id>=0?e.info.id:0,n=typeof e.info.author=="string"?e.info.author.trim():"",r=n.length>0?n:"Unknown",o=typeof e.info.date=="string"?e.info.date.trim():void 0,i=typeof e.info.rsid=="string"?e.info.rsid.trim():void 0,s=[`w:id="${t}"`,`w:author="${w(r)}"`];o&&s.push(`w:date="${w(o)}"`),i&&s.push(`w:rsid="${w(i)}"`);let a=Ut(e.previousFormatting)||"<w:pPr/>",l=Fr(a),u=l.length>0?`<w:pPr>${l}</w:pPr>`:"<w:pPr/>";return `<w:pPrChange ${s.join(" ")}>${u}</w:pPrChange>`}function Xe(e){let t=[];e.rId&&t.push(`r:id="${e.rId}"`),e.anchor&&t.push(`w:anchor="${w(e.anchor)}"`),e.tooltip&&t.push(`w:tooltip="${w(e.tooltip)}"`),e.target&&t.push(`w:tgtFrame="${w(e.target)}"`),e.history===false&&t.push('w:history="0"'),e.docLocation&&t.push(`w:docLocation="${w(e.docLocation)}"`);let n=e.children.map(o=>o.type==="run"?Z(o):o.type==="bookmarkStart"?Zt(o):o.type==="bookmarkEnd"?Gt(o):"").join("");return `<w:hyperlink${t.length>0?" "+t.join(" "):""}>${n}</w:hyperlink>`}function Zt(e){let t=[`w:id="${e.id}"`,`w:name="${w(e.name)}"`];return e.colFirst!==void 0&&t.push(`w:colFirst="${e.colFirst}"`),e.colLast!==void 0&&t.push(`w:colLast="${e.colLast}"`),`<w:bookmarkStart ${t.join(" ")}/>`}function Gt(e){return `<w:bookmarkEnd w:id="${e.id}"/>`}function Jt(e){let t=[],n=e.content.find(a=>a.type==="run"),r=n?.formatting?Q(n.formatting):"",o=['w:fldCharType="begin"'];e.fldLock&&o.push('w:fldLock="true"'),t.push(`<w:r>${r}<w:fldChar ${o.join(" ")}/></w:r>`);let s=e.instruction.startsWith(" ")||e.instruction.endsWith(" ")||e.instruction.includes(" ")?' xml:space="preserve"':"";t.push(`<w:r>${r}<w:instrText${s}>${w(e.instruction)}</w:instrText></w:r>`),t.push(`<w:r>${r}<w:fldChar w:fldCharType="separate"/></w:r>`);for(let a of e.content)a.type==="run"&&t.push(Z(a));return t.push(`<w:r>${r}<w:fldChar w:fldCharType="end"/></w:r>`),t.join("")}function Yt(e){let t=[],n=e.fieldResult?.[0]?.formatting,r=n?Q(n):"",o=['w:fldCharType="begin"'];if(e.fldLock&&o.push('w:fldLock="true"'),t.push(`<w:r>${r}<w:fldChar ${o.join(" ")}/></w:r>`),e.fieldCode.length>0)t.push(...e.fieldCode.map(i=>Z(i)));else {let s=e.instruction.startsWith(" ")||e.instruction.endsWith(" ")||e.instruction.includes(" ")?' xml:space="preserve"':"";t.push(`<w:r>${r}<w:instrText${s}>${w(e.instruction)}</w:instrText></w:r>`);}return t.push(`<w:r>${r}<w:fldChar w:fldCharType="separate"/></w:r>`),t.push(...e.fieldResult.map(i=>Z(i))),t.push(`<w:r>${r}<w:fldChar w:fldCharType="end"/></w:r>`),t.join("")}function qt(e){let t=e.properties,n=[];switch(t.alias&&n.push(`<w:alias w:val="${w(t.alias)}"/>`),t.tag&&n.push(`<w:tag w:val="${w(t.tag)}"/>`),t.lock&&t.lock!=="unlocked"&&n.push(`<w:lock w:val="${t.lock}"/>`),t.showingPlaceholder&&n.push("<w:showingPlcHdr/>"),t.sdtType){case "plainText":n.push("<w:text/>");break;case "date":t.dateFormat?n.push(`<w:date w:fullDate="${w(t.dateFormat)}"/>`):n.push("<w:date/>");break;case "dropdown":{let o=(t.listItems??[]).map(i=>`<w:listItem w:displayText="${w(i.displayText)}" w:value="${w(i.value)}"/>`).join("");n.push(`<w:dropDownList>${o}</w:dropDownList>`);break}case "comboBox":{let o=(t.listItems??[]).map(i=>`<w:listItem w:displayText="${w(i.displayText)}" w:value="${w(i.value)}"/>`).join("");n.push(`<w:comboBox>${o}</w:comboBox>`);break}case "checkbox":n.push(`<w14:checkbox><w14:checked w14:val="${t.checked?"1":"0"}"/></w14:checkbox>`);break;case "picture":n.push("<w:picture/>");break}let r=e.content.map(o=>{switch(o.type){case "run":return Z(o);case "hyperlink":return Xe(o);case "simpleField":return Jt(o);case "complexField":return Yt(o);case "inlineSdt":return qt(o);case "mathEquation":return o.ommlXml||"";default:return o}}).join("");return `<w:sdt><w:sdtPr>${n.join("")}</w:sdtPr><w:sdtContent>${r}</w:sdtContent></w:sdt>`}function Wt(e,t){let n=[`w:id="${t.id}"`,`w:name="${w(t.name)}"`];return `<w:${e} ${n.join(" ")}/>`}function we(e,t){let n=t.info,r=Number.isInteger(n.id)&&n.id>=0?n.id:0,o=typeof n.author=="string"?n.author.trim():"",i=o.length>0?o:"Unknown",s=typeof n.date=="string"?n.date.trim():void 0,a=[`w:id="${r}"`,`w:author="${w(i)}"`];s&&a.push(`w:date="${w(s)}"`);let l=t.content.map(u=>u.type==="run"?e==="del"||e==="moveFrom"?Z(u).replace(/<w:t\b/g,"<w:delText").replace(/<\/w:t>/g,"</w:delText>").replace(/<w:instrText\b/g,"<w:delInstrText").replace(/<\/w:instrText>/g,"</w:delInstrText>"):Z(u):u.type==="hyperlink"?Xe(u):"").join("");return `<w:${e} ${a.join(" ")}>${l}</w:${e}>`}function Er(e){switch(e.type){case "run":return Z(e);case "hyperlink":return Xe(e);case "bookmarkStart":return Zt(e);case "bookmarkEnd":return Gt(e);case "simpleField":return Jt(e);case "complexField":return Yt(e);case "inlineSdt":return qt(e);case "commentRangeStart":return `<w:commentRangeStart w:id="${e.id}"/>`;case "commentRangeEnd":return `<w:commentRangeEnd w:id="${e.id}"/><w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:commentReference w:id="${e.id}"/></w:r>`;case "insertion":return we("ins",e);case "deletion":return we("del",e);case "moveFrom":return we("moveFrom",e);case "moveTo":return we("moveTo",e);case "moveFromRangeStart":return Wt("moveFromRangeStart",e);case "moveFromRangeEnd":return `<w:moveFromRangeEnd w:id="${e.id}"/>`;case "moveToRangeStart":return Wt("moveToRangeStart",e);case "moveToRangeEnd":return `<w:moveToRangeEnd w:id="${e.id}"/>`;case "mathEquation":return e.ommlXml||"";default:return ""}}function G(e){let t=[],n=[];e.paraId&&n.push(`w14:paraId="${e.paraId}"`),e.textId&&n.push(`w14:textId="${e.textId}"`);let r=n.length>0?" "+n.join(" "):"",o=Ut(e.formatting,e.propertyChanges);o&&t.push(o);let i=!!e.renderedPageBreakBefore;for(let s of e.content){let a=Er(s);if(a){if(i){let l=Ar(a);l&&(a=l,i=false);}t.push(a);}}return `<w:p${r}>${t.join("")}</w:p>`}function Ar(e){let t=/<w:r(?=[\s>/])[^>]*>/;return t.test(e)?e.replace(t,n=>`${n}<w:lastRenderedPageBreak/>`):null}function Dr(e){let t=Number.isInteger(e.id)&&e.id>=0?e.id:0,n=typeof e.author=="string"?e.author.trim():"",r=n.length>0?n:"Unknown",o=typeof e.date=="string"?e.date.trim():void 0;return {id:t,author:r,date:o}}function Y(e,t){let n=Dr(e),r=[`w:id="${n.id}"`,`w:author="${w(n.author)}"`];return n.date&&r.push(`w:date="${w(n.date)}"`),t&&t.trim().length>0&&r.push(`w:rsid="${w(t.trim())}"`),r.join(" ")}function J(e,t){if(!e)return "";let n=[`w:w="${d(e.value)}"`,`w:type="${e.type}"`];return `<w:${t} ${n.join(" ")}/>`}function te(e,t){if(!e||e.style==="none"||e.style==="nil")return "";let n=[`w:val="${e.style}"`];return e.size!==void 0&&n.push(`w:sz="${d(e.size)}"`),e.space!==void 0&&n.push(`w:space="${d(e.space)}"`),e.color&&(e.color.auto?n.push('w:color="auto"'):e.color.rgb&&n.push(`w:color="${e.color.rgb}"`),e.color.themeColor&&n.push(`w:themeColor="${e.color.themeColor}"`),e.color.themeTint&&n.push(`w:themeTint="${e.color.themeTint}"`),e.color.themeShade&&n.push(`w:themeShade="${e.color.themeShade}"`)),e.shadow&&n.push('w:shadow="true"'),e.frame&&n.push('w:frame="true"'),`<w:${t} ${n.join(" ")}/>`}function Kt(e,t){if(!e)return "";let n=[];if(e.top){let r=te(e.top,"top");r&&n.push(r);}if(e.left){let r=te(e.left,"left");r&&n.push(r);}if(e.bottom){let r=te(e.bottom,"bottom");r&&n.push(r);}if(e.right){let r=te(e.right,"right");r&&n.push(r);}if(e.insideH){let r=te(e.insideH,"insideH");r&&n.push(r);}if(e.insideV){let r=te(e.insideV,"insideV");r&&n.push(r);}return n.length===0?"":`<w:${t}>${n.join("")}</w:${t}>`}function Qt(e,t){if(!e)return "";let n=[];return e.top&&n.push(J(e.top,"top")),e.left&&n.push(J(e.left,"left")),e.bottom&&n.push(J(e.bottom,"bottom")),e.right&&n.push(J(e.right,"right")),n.length===0?"":`<w:${t}>${n.join("")}</w:${t}>`}function en(e){if(!e)return "";let t=[];return e.pattern?t.push(`w:val="${e.pattern}"`):t.push('w:val="clear"'),e.color?.rgb?t.push(`w:color="${e.color.rgb}"`):e.color?.auto&&t.push('w:color="auto"'),e.fill?.rgb?t.push(`w:fill="${e.fill.rgb}"`):e.fill?.auto&&t.push('w:fill="auto"'),e.fill?.themeColor&&t.push(`w:themeFill="${e.fill.themeColor}"`),e.fill?.themeTint&&t.push(`w:themeFillTint="${e.fill.themeTint}"`),e.fill?.themeShade&&t.push(`w:themeFillShade="${e.fill.themeShade}"`),t.length===0?"":`<w:shd ${t.join(" ")}/>`}function Rr(e){if(!e)return "";let t=[];return e.firstRow&&t.push('w:firstRow="1"'),e.lastRow&&t.push('w:lastRow="1"'),e.firstColumn&&t.push('w:firstColumn="1"'),e.lastColumn&&t.push('w:lastColumn="1"'),e.noHBand&&t.push('w:noHBand="1"'),e.noVBand&&t.push('w:noVBand="1"'),t.length===0?"":`<w:tblLook ${t.join(" ")}/>`}function kr(e){if(!e)return "";let t=[];return e.horzAnchor&&t.push(`w:horzAnchor="${e.horzAnchor}"`),e.vertAnchor&&t.push(`w:vertAnchor="${e.vertAnchor}"`),e.tblpX!==void 0&&t.push(`w:tblpX="${d(e.tblpX)}"`),e.tblpXSpec&&t.push(`w:tblpXSpec="${e.tblpXSpec}"`),e.tblpY!==void 0&&t.push(`w:tblpY="${d(e.tblpY)}"`),e.tblpYSpec&&t.push(`w:tblpYSpec="${e.tblpYSpec}"`),e.topFromText!==void 0&&t.push(`w:topFromText="${d(e.topFromText)}"`),e.bottomFromText!==void 0&&t.push(`w:bottomFromText="${d(e.bottomFromText)}"`),e.leftFromText!==void 0&&t.push(`w:leftFromText="${d(e.leftFromText)}"`),e.rightFromText!==void 0&&t.push(`w:rightFromText="${d(e.rightFromText)}"`),t.length===0?"":`<w:tblpPr ${t.join(" ")}/>`}function tn(e,t){let n=[];if(e){e.styleId&&n.push(`<w:tblStyle w:val="${w(e.styleId)}"/>`);let r=kr(e.floating);r&&n.push(r),e.bidi&&n.push("<w:bidiVisual/>");let o=J(e.width,"tblW");o&&n.push(o),e.justification&&n.push(`<w:jc w:val="${e.justification}"/>`);let i=J(e.cellSpacing,"tblCellSpacing");i&&n.push(i);let s=J(e.indent,"tblInd");s&&n.push(s);let a=Kt(e.borders,"tblBorders");a&&n.push(a);let l=Qt(e.cellMargins,"tblCellMar");l&&n.push(l),e.layout&&n.push(`<w:tblLayout w:type="${e.layout}"/>`);let u=en(e.shading);u&&n.push(u);let m=Rr(e.look);m&&n.push(m),e.overlap&&n.push(`<w:tblOverlap w:val="${e.overlap}"/>`);}return t&&t.length>0&&n.push(...t.map(r=>Lr(r))),n.length===0?"":`<w:tblPr>${n.join("")}</w:tblPr>`}function Br(e){return !e.startsWith("<w:tblPr>")||!e.endsWith("</w:tblPr>")?"":e.slice(9,-10)}function Lr(e){let t=Y(e.info,e.info.rsid),n=tn(e.previousFormatting)||"<w:tblPr/>",r=Br(n),o=r.length>0?`<w:tblPr>${r}</w:tblPr>`:"<w:tblPr/>";return `<w:tblPrChange ${t}>${o}</w:tblPrChange>`}function nn(e,t,n){let r=[];if(e){if(e.cantSplit&&r.push("<w:cantSplit/>"),e.header&&r.push("<w:tblHeader/>"),e.height){let o=[`w:val="${d(e.height.value)}"`];e.heightRule&&o.push(`w:hRule="${e.heightRule}"`),r.push(`<w:trHeight ${o.join(" ")}/>`);}e.justification&&r.push(`<w:jc w:val="${e.justification}"/>`),e.hidden&&r.push("<w:hidden/>");}return n&&(n.type==="tableRowInsertion"?r.push(`<w:ins ${Y(n.info)}/>`):n.type==="tableRowDeletion"&&r.push(`<w:del ${Y(n.info)}/>`)),t&&t.length>0&&r.push(...t.map(o=>Nr(o))),r.length===0?"":`<w:trPr>${r.join("")}</w:trPr>`}function Mr(e){return !e.startsWith("<w:trPr>")||!e.endsWith("</w:trPr>")?"":e.slice(8,-9)}function Nr(e){let t=Y(e.info,e.info.rsid),n=nn(e.previousFormatting)||"<w:trPr/>",r=Mr(n),o=r.length>0?`<w:trPr>${r}</w:trPr>`:"<w:trPr/>";return `<w:trPrChange ${t}>${o}</w:trPrChange>`}function Or(e){if(!e)return "";let n=[e.firstRow?"1":"0",e.lastRow?"1":"0",e.firstColumn?"1":"0",e.lastColumn?"1":"0",e.oddVBand?"1":"0",e.evenVBand?"1":"0",e.oddHBand?"1":"0",e.evenHBand?"1":"0",e.nwCell?"1":"0",e.neCell?"1":"0",e.swCell?"1":"0",e.seCell?"1":"0"].join("");return n==="000000000000"?"":`<w:cnfStyle w:val="${n}"/>`}function rn(e,t,n){let r=[];if(e){let o=Or(e.conditionalFormat);o&&r.push(o);let i=J(e.width,"tcW");i&&r.push(i),e.gridSpan&&e.gridSpan>1&&r.push(`<w:gridSpan w:val="${d(e.gridSpan)}"/>`),e.vMerge&&(e.vMerge==="restart"?r.push('<w:vMerge w:val="restart"/>'):r.push("<w:vMerge/>"));let s=Kt(e.borders,"tcBorders");s&&r.push(s);let a=en(e.shading);a&&r.push(a),e.noWrap&&r.push("<w:noWrap/>");let l=Qt(e.margins,"tcMar");l&&r.push(l),e.textDirection&&r.push(`<w:textDirection w:val="${e.textDirection}"/>`),e.fitText&&r.push("<w:tcFitText/>"),e.verticalAlign&&r.push(`<w:vAlign w:val="${e.verticalAlign}"/>`),e.hideMark&&r.push("<w:hideMark/>");}return n&&(n.type==="tableCellInsertion"?r.push(`<w:cellIns ${Y(n.info)}/>`):n.type==="tableCellDeletion"?r.push(`<w:cellDel ${Y(n.info)}/>`):n.type==="tableCellMerge"&&r.push(`<w:cellMerge ${Y(n.info)}/>`)),t&&t.length>0&&r.push(...t.map(o=>zr(o))),r.length===0?"":`<w:tcPr>${r.join("")}</w:tcPr>`}function Xr(e){return !e.startsWith("<w:tcPr>")||!e.endsWith("</w:tcPr>")?"":e.slice(8,-9)}function zr(e){let t=Y(e.info,e.info.rsid),n=rn(e.previousFormatting)||"<w:tcPr/>",r=Xr(n),o=r.length>0?`<w:tcPr>${r}</w:tcPr>`:"<w:tcPr/>";return `<w:tcPrChange ${t}>${o}</w:tcPrChange>`}function _r(e){return !e||e.length===0?"":`<w:tblGrid>${e.map(n=>`<w:gridCol w:w="${d(n)}"/>`).join("")}</w:tblGrid>`}function jr(e){let t=[];for(let n of e)n.type==="paragraph"?t.push(G(n)):n.type==="table"&&t.push(ie(n));return t.length===0&&t.push("<w:p/>"),t.join("")}function Hr(e){let t=[],n=rn(e.formatting,e.propertyChanges,e.structuralChange);return n&&t.push(n),t.push(jr(e.content)),`<w:tc>${t.join("")}</w:tc>`}function Vr(e){let t=[],n=nn(e.formatting,e.propertyChanges,e.structuralChange);n&&t.push(n);for(let r of e.cells)t.push(Hr(r));return `<w:tr>${t.join("")}</w:tr>`}function ie(e){let t=[],n=tn(e.formatting,e.propertyChanges);n&&t.push(n);let r=_r(e.columnWidths);r&&t.push(r);for(let o of e.rows)t.push(Vr(o));return `<w:tbl>${t.join("")}</w:tbl>`}var X={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"};function Wr(){let e={wpc:X.wpc,mc:X.mc,o:X.o,r:X.r,m:X.m,v:X.v,wp14:X.wp14,wp:X.wp,w10:X.w10,w:X.w,w14:X.w14,w15:X.w15,wpg:X.wpg,wps:X.wps};return Object.entries(e).map(([t,n])=>`xmlns:${t}="${n}"`).join(" ")}function ye(e,t){if(!e||e.style==="none"||e.style==="nil")return "";let n=[`w:val="${e.style}"`];return e.size!==void 0&&n.push(`w:sz="${d(e.size)}"`),e.space!==void 0&&n.push(`w:space="${d(e.space)}"`),e.color&&(e.color.auto?n.push('w:color="auto"'):e.color.rgb&&n.push(`w:color="${e.color.rgb}"`),e.color.themeColor&&n.push(`w:themeColor="${e.color.themeColor}"`),e.color.themeTint&&n.push(`w:themeTint="${e.color.themeTint}"`),e.color.themeShade&&n.push(`w:themeShade="${e.color.themeShade}"`)),e.shadow&&n.push('w:shadow="true"'),e.frame&&n.push('w:frame="true"'),`<w:${t} ${n.join(" ")}/>`}function Ur(e){return `<w:headerReference ${[`w:type="${e.type}"`,`r:id="${e.rId}"`].join(" ")}/>`}function Zr(e){return `<w:footerReference ${[`w:type="${e.type}"`,`r:id="${e.rId}"`].join(" ")}/>`}function Gr(e){if(!e)return "";let t=[];return e.position&&t.push(`<w:pos w:val="${e.position}"/>`),e.numFmt&&t.push(`<w:numFmt w:val="${e.numFmt}"/>`),e.numStart!==void 0&&t.push(`<w:numStart w:val="${e.numStart}"/>`),e.numRestart&&t.push(`<w:numRestart w:val="${e.numRestart}"/>`),t.length===0?"":`<w:footnotePr>${t.join("")}</w:footnotePr>`}function Jr(e){if(!e)return "";let t=[];return e.position&&t.push(`<w:pos w:val="${e.position}"/>`),e.numFmt&&t.push(`<w:numFmt w:val="${e.numFmt}"/>`),e.numStart!==void 0&&t.push(`<w:numStart w:val="${e.numStart}"/>`),e.numRestart&&t.push(`<w:numRestart w:val="${e.numRestart}"/>`),t.length===0?"":`<w:endnotePr>${t.join("")}</w:endnotePr>`}function Yr(e){let t=[];return e.pageWidth!==void 0&&t.push(`w:w="${d(e.pageWidth)}"`),e.pageHeight!==void 0&&t.push(`w:h="${d(e.pageHeight)}"`),e.orientation==="landscape"&&t.push('w:orient="landscape"'),t.length===0?"":`<w:pgSz ${t.join(" ")}/>`}function qr(e){let t=[];return e.marginTop!==void 0&&t.push(`w:top="${d(e.marginTop)}"`),e.marginRight!==void 0&&t.push(`w:right="${d(e.marginRight)}"`),e.marginBottom!==void 0&&t.push(`w:bottom="${d(e.marginBottom)}"`),e.marginLeft!==void 0&&t.push(`w:left="${d(e.marginLeft)}"`),e.headerDistance!==void 0&&t.push(`w:header="${d(e.headerDistance)}"`),e.footerDistance!==void 0&&t.push(`w:footer="${d(e.footerDistance)}"`),e.gutter!==void 0&&t.push(`w:gutter="${d(e.gutter)}"`),t.length===0?"":`<w:pgMar ${t.join(" ")}/>`}function Kr(e){if(!e.columnCount&&!e.columns?.length)return "";let t=[];e.columnCount!==void 0&&e.columnCount>1&&t.push(`w:num="${d(e.columnCount)}"`),e.columnSpace!==void 0&&t.push(`w:space="${d(e.columnSpace)}"`),e.equalWidth!==void 0&&t.push(`w:equalWidth="${e.equalWidth?"1":"0"}"`),e.separator&&t.push('w:sep="1"');let n="";return e.columns&&e.columns.length>0&&(n=e.columns.map(o=>{let i=[];return o.width!==void 0&&i.push(`w:w="${d(o.width)}"`),o.space!==void 0&&i.push(`w:space="${d(o.space)}"`),`<w:col ${i.join(" ")}/>`}).join("")),t.length===0&&!n?"":`<w:cols${t.length>0?" "+t.join(" "):""}>${n}</w:cols>`}function Qr(e){if(!e.lineNumbers)return "";let t=e.lineNumbers,n=[];return t.countBy!==void 0&&n.push(`w:countBy="${d(t.countBy)}"`),t.start!==void 0&&n.push(`w:start="${d(t.start)}"`),t.distance!==void 0&&n.push(`w:distance="${d(t.distance)}"`),t.restart&&n.push(`w:restart="${t.restart}"`),n.length===0?"":`<w:lnNumType ${n.join(" ")}/>`}function eo(e){if(!e.pageBorders)return "";let t=e.pageBorders,n=[],r=[];if(t.display&&n.push(`w:display="${t.display}"`),t.offsetFrom&&n.push(`w:offsetFrom="${t.offsetFrom}"`),t.zOrder&&n.push(`w:zOrder="${t.zOrder}"`),t.top){let i=ye(t.top,"top");i&&r.push(i);}if(t.left){let i=ye(t.left,"left");i&&r.push(i);}if(t.bottom){let i=ye(t.bottom,"bottom");i&&r.push(i);}if(t.right){let i=ye(t.right,"right");i&&r.push(i);}return r.length===0?"":`<w:pgBorders${n.length>0?" "+n.join(" "):""}>${r.join("")}</w:pgBorders>`}function to(e){if(!e.docGrid)return "";let t=e.docGrid,n=[];return t.type&&n.push(`w:type="${t.type}"`),t.linePitch!==void 0&&n.push(`w:linePitch="${t.linePitch}"`),t.charSpace!==void 0&&n.push(`w:charSpace="${t.charSpace}"`),n.length===0?"":`<w:docGrid ${n.join(" ")}/>`}function no(e){if(!e)return "";let t=[];if(e.headerReferences)for(let m of e.headerReferences)t.push(Ur(m));if(e.footerReferences)for(let m of e.footerReferences)t.push(Zr(m));let n=Gr(e.footnotePr);n&&t.push(n);let r=Jr(e.endnotePr);r&&t.push(r),e.sectionStart&&t.push(`<w:type w:val="${e.sectionStart}"/>`);let o=Yr(e);o&&t.push(o);let i=qr(e);if(i&&t.push(i),e.paperSrcFirst!==void 0||e.paperSrcOther!==void 0){let m=[];e.paperSrcFirst!==void 0&&m.push(`w:first="${e.paperSrcFirst}"`),e.paperSrcOther!==void 0&&m.push(`w:other="${e.paperSrcOther}"`),t.push(`<w:paperSrc ${m.join(" ")}/>`);}let s=eo(e);s&&t.push(s);let a=Qr(e);a&&t.push(a);let l=Kr(e);l&&t.push(l);let u=to(e);return u&&t.push(u),e.verticalAlign&&t.push(`<w:vAlign w:val="${e.verticalAlign}"/>`),e.bidi&&t.push("<w:bidi/>"),e.titlePg&&t.push("<w:titlePg/>"),e.evenAndOddHeaders&&t.push("<w:evenAndOddHeaders/>"),t.length===0?"":`<w:sectPr>${t.join("")}</w:sectPr>`}function on(e){if(e.type==="paragraph")return G(e);if(e.type==="table")return ie(e);if(e.type==="blockSdt"){let t=e.content.map(o=>on(o)).join(""),n=e.properties,r=[];return n.alias&&r.push(`<w:alias w:val="${n.alias}"/>`),n.tag&&r.push(`<w:tag w:val="${n.tag}"/>`),`<w:sdt><w:sdtPr>${r.join("")}</w:sdtPr><w:sdtContent>${t}</w:sdtContent></w:sdt>`}return ""}function ro(e){return e.map(t=>on(t)).join("")}function oo(e){let t=[];return t.push(ro(e.content)),e.finalSectionProperties&&t.push(no(e.finalSectionProperties)),t.join("")}function xe(e){zt();let t=[];t.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>');let n=Wr();return t.push(`<w:document ${n} mc:Ignorable="w14 w15 wp14">`),t.push("<w:body>"),t.push(oo(e.package.document)),t.push("</w:body>"),t.push("</w:document>"),t.join("")}var $e=chunkH5NTJZO4_js.c(chunkIFPN3NT3_js.a());var io={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"};function so(){return Object.entries(io).map(([e,t])=>`xmlns:${e}="${t}"`).join(" ")}function ao(e){return e.type==="paragraph"?G(e):e.type==="table"?ie(e):""}function sn(e){let t=e.type==="header"?"w:hdr":"w:ftr",n=so(),r=e.content.map(o=>ao(o)).join("");return r||(r="<w:p><w:pPr/></w:p>"),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
2
|
+
<${t} ${n}>${r}</${t}>`}var be='xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16du="http://schemas.microsoft.com/office/word/2023/wordml/word16du" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16sdtfl="http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape"',Te='mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"';function un(e){let t="<w:r>",n=[];e.formatting?.bold&&n.push("<w:b/>"),e.formatting?.italic&&n.push("<w:i/>"),n.length>0&&(t+=`<w:rPr>${n.join("")}</w:rPr>`);for(let r of e.content)if(r.type==="text"){let o=r.text!==r.text.trim()||r.text.includes(" ");t+=o?`<w:t xml:space="preserve">${w(r.text)}</w:t>`:`<w:t>${w(r.text)}</w:t>`;}else r.type==="break"&&(t+="<w:br/>");return t+="</w:r>",t}function an(e,t){let n=t?`<w:p w14:paraId="${t}">`:"<w:p>";for(let r of e.content)r.type==="run"&&(n+=un(r));return n+="</w:p>",n}function ln(e,t){let n=t?`<w:p w14:paraId="${t}">`:"<w:p>";n+='<w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:annotationRef/></w:r>';for(let r of e.content)r.type==="run"&&(n+=un(r));return n+="</w:p>",n}function cn(e,t){let n=chunkB45ECEGY_js.a(),r=[`w:id="${e.id}"`];if(e.author&&r.push(`w:author="${w(e.author)}"`),e.initials?r.push(`w:initials="${w(e.initials)}"`):r.push('w:initials=""'),e.date){let i=e.date.replace(/\.\d{3}Z$/,"Z");r.push(`w:date="${w(i)}"`);}let o=`<w:comment ${r.join(" ")}>`;if(e.content&&e.content.length>0)if(e.content.length===1)o+=ln(e.content[0],n);else {o+=ln(e.content[0]);for(let i=1;i<e.content.length-1;i++)o+=an(e.content[i]);o+=an(e.content[e.content.length-1],n);}else o+=`<w:p w14:paraId="${n}"><w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:annotationRef/></w:r></w:p>`;return o+="</w:comment>",t.push({commentId:e.id,lastParaId:n,durableId:chunkB45ECEGY_js.a(),parentId:e.parentId,done:e.done}),o}function ve(e){if(!e||e.length===0)return {xml:"",paraInfos:[]};let t=[],n=[];for(let i of e)(i.parentId==null?t:n).push(i);let r=[],o=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:comments ${be} ${Te}>`;for(let i of t)o+=cn(i,r);for(let i of n)o+=cn(i,r);return o+="</w:comments>",{xml:o,paraInfos:r}}function Se(e){if(e.length===0)return "";let t=new Map;for(let r of e)t.set(r.commentId,r.lastParaId);let n=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w15:commentsEx ${be} ${Te}>`;for(let r of e){let o=`w15:paraId="${r.lastParaId}" w15:done="${r.done?"1":"0"}"`;if(r.parentId!=null){let i=t.get(r.parentId);i&&(o+=` w15:paraIdParent="${i}"`);}n+=`<w15:commentEx ${o} />`;}return n+="</w15:commentsEx>",n}function Ce(e){if(e.length===0)return "";let t=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w16cid:commentsIds ${be} ${Te}>`;for(let n of e)t+=`<w16cid:commentId w16cid:paraId="${n.lastParaId}" w16cid:durableId="${n.durableId}" />`;return t+="</w16cid:commentsIds>",t}function Pe(e,t){if(e.length===0)return "";let n=new Map;for(let o of t)n.set(o.id,o);let r=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w16cex:commentsExtensible ${be} ${Te}>`;for(let o of e){let i=n.get(o.commentId);if(!i?.date)continue;let s=o.durableId,a=(i.date.endsWith("Z")?i.date:i.date+"Z").replace(/\.\d{3}Z$/,"Z");r+=`<w16cex:commentExtensible w16cex:durableId="${s}" w16cex:dateUtc="${a}"/>`;}return r+="</w16cex:commentsExtensible>",r}function se(e){let t=0;for(let n of e.matchAll(/Id="rId(\d+)"/g)){let r=parseInt(n[1],10);r>t&&(t=r);}return t}async function lo(e,t,n){let r=e.package.document.comments;if(!r||r.length===0)return;let{xml:o,paraInfos:i}=ve(r);t.file("word/comments.xml",o,{compression:"DEFLATE",compressionOptions:{level:n}});let s=Se(i);s&&t.file("word/commentsExtended.xml",s,{compression:"DEFLATE",compressionOptions:{level:n}});let a=Ce(i);a&&t.file("word/commentsIds.xml",a,{compression:"DEFLATE",compressionOptions:{level:n}});let l=Pe(i,r);l&&t.file("word/commentsExtensible.xml",l,{compression:"DEFLATE",compressionOptions:{level:n}}),await To(t,n);}function pn(e){let t=[];for(let n of e)if(n.type==="paragraph"){for(let r of n.content)if(r.type==="run")for(let o of r.content)o.type==="drawing"&&o.image.src?.startsWith("data:")&&t.push(o.image);}else if(n.type==="table")for(let r of n.rows)for(let o of r.cells)t.push(...pn(o.content));return t}var co={"image/png":"png","image/jpeg":"jpeg","image/gif":"gif","image/bmp":"bmp","image/tiff":"tiff","image/webp":"webp","image/svg+xml":"svg"};function uo(e){let t=e.match(/^data:([^;]+);base64,(.+)$/);if(!t)throw new Error("Invalid data URL");let n=atob(t[2]),r=new Uint8Array(n.length);for(let o=0;o<n.length;o++)r[o]=n.charCodeAt(o);return {data:r.buffer,extension:co[t[1]]||"png"}}var po=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
3
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`;function fn(e){return e.startsWith("/")?e.slice(1):`word/${e}`}function fo(e){let t=[{relsPath:"word/_rels/document.xml.rels",blocks:e.package.document.content}],n=e.package.relationships;if(!n)return t;let r=(o,i)=>{if(o)for(let[s,a]of o.entries()){let l=n.get(s);if(!l||l.type!==i||!l.target)continue;let m=fn(l.target).replace(/^word\//,"");t.push({relsPath:`word/_rels/${m}.rels`,blocks:a.content});}};return r(e.package.headers,chunkB45ECEGY_js.j.header),r(e.package.footers,chunkB45ECEGY_js.j.footer),t}async function ze(e,t){let n=e.file(t);return (n?await n.async("text"):po).replace(/<Relationships([^>]*)\/>/,"<Relationships$1></Relationships>")}async function mo(e,t,n){if(t.size===0)return;let r=e.file("[Content_Types].xml");if(!r)return;let o=await r.async("text"),i=false;for(let s of t)if(!o.includes(`Extension="${s}"`)){let a=So(s);o=o.replace("</Types>",`<Default Extension="${s}" ContentType="${a}"/></Types>`),i=true;}i&&e.file("[Content_Types].xml",o,{compression:"DEFLATE",compressionOptions:{level:n}});}function ho(e){let t=0;return e.forEach(n=>{let r=n.match(/^word\/media\/image(\d+)\./);if(r){let o=parseInt(r[1],10);o>t&&(t=o);}}),t}async function go(e,t,n){let r=ho(t),o=new Set;for(let{relsPath:i,blocks:s}of e){let a=pn(s);if(a.length===0)continue;let l=await ze(t,i),u=se(l),m=[];for(let g of a){let{data:x,extension:p}=uo(g.src);r++,u++;let y=`image${r}.${p}`,C=`rId${u}`;t.file(`word/media/${y}`,x,{compression:"DEFLATE",compressionOptions:{level:n}}),m.push(`<Relationship Id="${C}" Type="${chunkB45ECEGY_js.j.image}" Target="media/${y}"/>`),o.add(p),g.rId=C;}let h=l.replace("</Relationships>",m.join("")+"</Relationships>");t.file(i,h,{compression:"DEFLATE",compressionOptions:{level:n}});}await mo(t,o,n);}function mn(e){let t=[];for(let n of e)if(n.type==="paragraph")for(let r of n.content)r.type==="hyperlink"&&r.href&&!r.rId&&!r.anchor&&t.push(r);else if(n.type==="table")for(let r of n.rows)for(let o of r.cells)t.push(...mn(o.content));return t}async function wo(e,t,n){for(let{relsPath:r,blocks:o}of e){let i=mn(o);if(i.length===0)continue;let s=await ze(t,r),a=se(s),l=[];for(let m of i){a++;let h=`rId${a}`;l.push(`<Relationship Id="${h}" Type="${chunkB45ECEGY_js.j.hyperlink}" Target="${w(m.href)}" TargetMode="External"/>`),m.rId=h;}let u=s.replace("</Relationships>",l.join("")+"</Relationships>");t.file(r,u,{compression:"DEFLATE",compressionOptions:{level:n}});}}async function _e(e,t={}){if(!e.originalBuffer)throw new Error("Cannot repack document: no original buffer for round-trip. Use createDocx() for new documents.");let{compressionLevel:n=6,updateModifiedDate:r=true,modifiedBy:o}=t,i=e,s=await $e.default.loadAsync(e.originalBuffer),a=new $e.default;for(let[h,g]of Object.entries(s.files)){if(g.dir){a.folder(h.replace(/\/$/,""));continue}let x=await g.async("arraybuffer");a.file(h,x,{compression:"DEFLATE",compressionOptions:{level:n}});}let l=fo(i);await go(l,a,n),await wo(l,a,n);let u=xe(i);if(a.file("word/document.xml",u,{compression:"DEFLATE",compressionOptions:{level:n}}),vo(i,a,n),await bo(i,a,n),await lo(i,a,n),r){let h="docProps/core.xml",g=s.file(h);if(g){let x=await g.async("text"),p=Ze(x,{updateModifiedDate:r,modifiedBy:o});a.file(h,p,{compression:"DEFLATE",compressionOptions:{level:n}});}}return await a.generateAsync({type:"arraybuffer",compression:"DEFLATE",compressionOptions:{level:n}})}var yo="application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",xo="application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",je="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",He="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",Ve="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml",We="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml";async function bo(e,t,n){let r=e.package.relationships;if(!r)return;let o=[];for(let[u,m]of r){if(!m.target)continue;let h=m.type===chunkB45ECEGY_js.j.header?yo:m.type===chunkB45ECEGY_js.j.footer?xo:null;h&&o.push({rId:u,target:m.target.replace(/^(\/?word\/)/,""),contentType:h,relType:m.type});}if(o.length===0)return;let i=t.file("[Content_Types].xml");if(i){let u=await i.async("text"),m=false;for(let{target:h,contentType:g}of o){let x=`/word/${h}`;u.includes(`PartName="${x}"`)||(u=u.replace("</Types>",`<Override PartName="${x}" ContentType="${g}"/></Types>`),m=true);}m&&t.file("[Content_Types].xml",u,{compression:"DEFLATE",compressionOptions:{level:n}});}let s="word/_rels/document.xml.rels",a=await ze(t,s),l=false;for(let{rId:u,relType:m,target:h}of o)a.includes(`Id="${u}"`)||(a=a.replace("</Relationships>",`<Relationship Id="${u}" Type="${m}" Target="${h}"/></Relationships>`),l=true);l&&t.file(s,a,{compression:"DEFLATE",compressionOptions:{level:n}});}async function To(e,t){let n=[{partName:"/word/comments.xml",contentType:je,target:"comments.xml",relType:chunkB45ECEGY_js.j.comments},{partName:"/word/commentsExtended.xml",contentType:He,target:"commentsExtended.xml",relType:chunkB45ECEGY_js.j.commentsExtended},{partName:"/word/commentsIds.xml",contentType:Ve,target:"commentsIds.xml",relType:chunkB45ECEGY_js.j.commentsIds},{partName:"/word/commentsExtensible.xml",contentType:We,target:"commentsExtensible.xml",relType:chunkB45ECEGY_js.j.commentsExtensible}],r=e.file("[Content_Types].xml");if(r){let s=await r.async("text"),a=false;for(let{partName:l,contentType:u}of n)s.includes(l)||(s=s.replace("</Types>",`<Override PartName="${l}" ContentType="${u}"/></Types>`),a=true);a&&e.file("[Content_Types].xml",s,{compression:"DEFLATE",compressionOptions:{level:t}});}let o="word/_rels/document.xml.rels",i=e.file(o);if(i){let s=await i.async("text"),a=false;for(let{target:l,relType:u}of n)if(!s.includes(l)){let m=`rId${se(s)+1}`;s=s.replace("</Relationships>",`<Relationship Id="${m}" Type="${u}" Target="${l}"/></Relationships>`),a=true;}a&&e.file(o,s,{compression:"DEFLATE",compressionOptions:{level:t}});}}async function dn(e,t,n={}){let{compressionLevel:r=6}=n;for(let[o,i]of t)e.file(o,i,{compression:"DEFLATE",compressionOptions:{level:r}});return e.generateAsync({type:"arraybuffer",compression:"DEFLATE",compressionOptions:{level:r}})}function Ue(e){let t=new Map,n=e.package.relationships;if(!n)return t;let r=[{map:e.package.headers,type:chunkB45ECEGY_js.j.header},{map:e.package.footers,type:chunkB45ECEGY_js.j.footer}];for(let{map:o,type:i}of r)if(o)for(let[s,a]of o.entries()){let l=n.get(s);l&&l.type===i&&l.target&&t.set(fn(l.target),sn(a));}return t}function vo(e,t,n){let r={level:n};for(let[o,i]of Ue(e))t.file(o,i,{compression:"DEFLATE",compressionOptions:r});}function Ze(e,t){let n=e;if(t.updateModifiedDate){let r=new Date().toISOString();n.includes("<dcterms:modified")?n=n.replace(/<dcterms:modified[^>]*>[^<]*<\/dcterms:modified>/,`<dcterms:modified xsi:type="dcterms:W3CDTF">${r}</dcterms:modified>`):n=n.replace("</cp:coreProperties>",`<dcterms:modified xsi:type="dcterms:W3CDTF">${r}</dcterms:modified></cp:coreProperties>`);}return t.modifiedBy&&(n.includes("<cp:lastModifiedBy")?n=n.replace(/<cp:lastModifiedBy>[^<]*<\/cp:lastModifiedBy>/,`<cp:lastModifiedBy>${w(t.modifiedBy)}</cp:lastModifiedBy>`):n=n.replace("</cp:coreProperties>",`<cp:lastModifiedBy>${w(t.modifiedBy)}</cp:lastModifiedBy></cp:coreProperties>`)),n}function So(e,t){return {png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",tif:"image/tiff",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp",wmf:"image/x-wmf",emf:"image/x-emf"}[e]||"application/octet-stream"}async function Co(){let e=new $e.default;e.file("[Content_Types].xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
4
|
+
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
|
|
5
|
+
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
|
|
6
|
+
<Default Extension="xml" ContentType="application/xml"/>
|
|
7
|
+
<Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>
|
|
8
|
+
<Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/>
|
|
9
|
+
<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
|
|
10
|
+
<Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
|
|
11
|
+
</Types>`),e.file("_rels/.rels",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
12
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
13
|
+
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
|
|
14
|
+
<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>
|
|
15
|
+
<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
|
|
16
|
+
</Relationships>`),e.file("word/_rels/document.xml.rels",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
17
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
18
|
+
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
|
|
19
|
+
</Relationships>`),e.file("word/document.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
20
|
+
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
|
|
21
|
+
<w:body>
|
|
22
|
+
<w:p>
|
|
23
|
+
<w:r>
|
|
24
|
+
<w:t></w:t>
|
|
25
|
+
</w:r>
|
|
26
|
+
</w:p>
|
|
27
|
+
<w:sectPr>
|
|
28
|
+
<w:pgSz w:w="12240" w:h="15840"/>
|
|
29
|
+
<w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/>
|
|
30
|
+
</w:sectPr>
|
|
31
|
+
</w:body>
|
|
32
|
+
</w:document>`),e.file("word/styles.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
33
|
+
<w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
|
|
34
|
+
<w:docDefaults>
|
|
35
|
+
<w:rPrDefault>
|
|
36
|
+
<w:rPr>
|
|
37
|
+
<w:rFonts w:ascii="Calibri" w:hAnsi="Calibri"/>
|
|
38
|
+
<w:sz w:val="22"/>
|
|
39
|
+
</w:rPr>
|
|
40
|
+
</w:rPrDefault>
|
|
41
|
+
<w:pPrDefault>
|
|
42
|
+
<w:pPr>
|
|
43
|
+
<w:spacing w:after="200" w:line="276" w:lineRule="auto"/>
|
|
44
|
+
</w:pPr>
|
|
45
|
+
</w:pPrDefault>
|
|
46
|
+
</w:docDefaults>
|
|
47
|
+
<w:style w:type="paragraph" w:default="1" w:styleId="Normal">
|
|
48
|
+
<w:name w:val="Normal"/>
|
|
49
|
+
</w:style>
|
|
50
|
+
</w:styles>`);let t=new Date().toISOString();return e.file("docProps/core.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
51
|
+
<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
52
|
+
<dc:creator>EigenPal DOCX Editor</dc:creator>
|
|
53
|
+
<dcterms:created xsi:type="dcterms:W3CDTF">${t}</dcterms:created>
|
|
54
|
+
<dcterms:modified xsi:type="dcterms:W3CDTF">${t}</dcterms:modified>
|
|
55
|
+
</cp:coreProperties>`),e.file("docProps/app.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
56
|
+
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties">
|
|
57
|
+
<Application>EigenPal DOCX Editor</Application>
|
|
58
|
+
<AppVersion>1.0.0</AppVersion>
|
|
59
|
+
</Properties>`),e.generateAsync({type:"arraybuffer",compression:"DEFLATE",compressionOptions:{level:6}})}async function hn(e){let t=await Co(),n={...e,originalBuffer:t};return _e(n)}function yn(e,t){let n=Fo(t),r=new RegExp(`<w:p[\\s][^>]*w14:paraId="${n}"`,"g"),o=[],i;for(;(i=r.exec(e))!==null;)o.push(i.index);if(o.length===0||o.length>1)return null;let s=o[0],a=s,l=0;for(;a<e.length;){let u=e.indexOf("<",a);if(u===-1)break;if(e.startsWith("<w:p",u)){let m=e[u+4];if(m===">"||m===" "||m==="/"){let h=e.indexOf(">",u);if(h===-1)break;if(e[h-1]==="/"){if(l===0)return {start:s,end:h+1};a=h+1;}else l++,a=h+1;}else a=u+1;}else if(e.startsWith("</w:p>",u)){if(l--,l===0)return {start:s,end:u+6};a=u+6;}else a=u+1;}return null}function Po(e,t){let n=yn(e,t);return n?e.substring(n.start,n.end):null}function gn(e){let t=0,n=/<w:p[\s>]/g,r;for(;(r=n.exec(e))!==null;){let o=r.index,i=e[o+4];(i===">"||i===" ")&&t++;}return t}function wn(e){let t=new Map,n=/w14:paraId="([^"]+)"/g,r;for(;(r=n.exec(e))!==null;){let o=r[1];t.set(o,(t.get(o)||0)+1);}return t}function $o(e,t,n){if(n.size===0)return {safe:true};let r=wn(e),o=wn(t);for(let a of n){let l=r.get(a)||0;if(l===0)return {safe:false,reason:`paraId-not-found-in-original: ${a}`};if(l>1)return {safe:false,reason:`duplicate-paraId-in-original: ${a}`}}for(let a of n){let l=o.get(a)||0;if(l===0)return {safe:false,reason:`paraId-not-found-in-serialized: ${a}`};if(l>1)return {safe:false,reason:`duplicate-paraId-in-serialized: ${a}`}}let i=gn(e),s=gn(t);return i!==s?{safe:false,reason:`paragraph-count-mismatch: original=${i}, serialized=${s}`}:{safe:true}}function xn(e,t,n){if(n.size===0)return e;if(!$o(e,t,n).safe)return null;let o=[];for(let s of n){let a=yn(e,s);if(!a)return null;let l=Po(t,s);if(!l)return null;o.push({start:a.start,end:a.end,newXml:l});}o.sort((s,a)=>a.start-s.start);let i=e;for(let{start:s,end:a,newXml:l}of o)i=i.substring(0,s)+l+i.substring(a);return i}function Fo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bn(e){for(let t of e)if(t.type==="paragraph"){for(let n of t.content)if(n.type==="run"){for(let r of n.content)if(r.type==="drawing"&&r.image?.src?.startsWith("data:")&&!r.image?.rId)return true}else if(n.type==="hyperlink"&&n.href&&!n.rId&&!n.anchor)return true}else if(t.type==="table"){for(let n of t.rows)for(let r of n.cells)if(bn(r.content))return true}return false}async function Tn(e,t,n){let{changedParaIds:r,structuralChange:o,hasUntrackedChanges:i}=n;if(o||i||!t)return null;let s=e.package.document.content;if(bn(s))return null;let a=e.package.document.comments,l=a&&a.length>0,u=Ue(e);try{let h=await(await import('./lib-U35UU4OU.js')).default.loadAsync(t),g=new Map;if(r.size>0){let p=h.file("word/document.xml");if(!p)return null;let y=await p.async("text"),C=xe(e),E=xn(y,C,r);if(!E)return null;g.set("word/document.xml",E);}if(l){let{xml:p,paraInfos:y}=ve(a);g.set("word/comments.xml",p);let C=Se(y);C&&g.set("word/commentsExtended.xml",C);let E=Ce(y);E&&g.set("word/commentsIds.xml",E);let D=Pe(y,a);D&&g.set("word/commentsExtensible.xml",D);let A=h.file("[Content_Types].xml");if(A){let P=g.get("[Content_Types].xml")??await A.async("text"),I=!1,B=[["/word/comments.xml",je],["/word/commentsExtended.xml",He],["/word/commentsIds.xml",Ve],["/word/commentsExtensible.xml",We]];for(let[R,k]of B)P.includes(R)||(P=P.replace("</Types>",`<Override PartName="${R}" ContentType="${k}"/></Types>`),I=!0);I&&g.set("[Content_Types].xml",P);}let v="word/_rels/document.xml.rels",b=h.file(v);if(b){let P=g.get(v)??await b.async("text"),I=!1,B=[["comments.xml",chunkB45ECEGY_js.j.comments],["commentsExtended.xml",chunkB45ECEGY_js.j.commentsExtended],["commentsIds.xml",chunkB45ECEGY_js.j.commentsIds],["commentsExtensible.xml",chunkB45ECEGY_js.j.commentsExtensible]];for(let[R,k]of B)if(!P.includes(R)){let N=se(P);P=P.replace("</Relationships>",`<Relationship Id="rId${N+1}" Type="${k}" Target="${R}"/></Relationships>`),I=!0;}I&&g.set(v,P);}}for(let[p,y]of u)g.set(p,y);let x=h.file("docProps/core.xml");if(x){let p=await x.async("text");g.set("docProps/core.xml",Ze(p,{updateModifiedDate:!0}));}return await dn(h,g)}catch{return null}}function Cn(e){return Io(e).variables}function Io(e){let t=[],n={body:[],headers:[],footers:[],footnotes:[],endnotes:[],textBoxes:[]};if(e.package?.document){let o=Eo(e.package.document);o.forEach(i=>{t.push({name:i,location:"body"});}),n.body=Array.from(new Set(o)).sort();}if(e.package?.document?.sections&&e.package.document.sections.forEach((o,i)=>{o.properties.headerReferences&&o.properties.headerReferences.forEach(s=>{});}),e.package?.footnotes){let o=Sn(e.package.footnotes);o.forEach(i=>{t.push({name:i,location:"footnote"});}),n.footnotes=Array.from(new Set(o)).sort();}if(e.package?.endnotes){let o=Sn(e.package.endnotes);o.forEach(i=>{t.push({name:i,location:"endnote"});}),n.endnotes=Array.from(new Set(o)).sort();}e.templateVariables&&e.templateVariables.forEach(o=>{t.some(i=>i.name===o)||t.push({name:o,location:"body"});});let r=new Set;return t.forEach(o=>r.add(o.name)),{variables:Array.from(r).sort(),totalOccurrences:t.length,byLocation:n,occurrences:t}}function Eo(e){let t=[];if(e.content&&t.push(...vn(e.content)),e.sections)for(let n of e.sections)n.content&&t.push(...vn(n.content));return t}function vn(e){let t=[];for(let n of e)n.type==="paragraph"?t.push(...Ge(n)):n.type==="table"&&t.push(...Pn(n));return t}function Ge(e){let t=[];if(!e.content)return t;for(let n of e.content)n.type==="run"?t.push(...ae(n)):n.type==="hyperlink"?t.push(...Ao(n)):n.type==="simpleField"?t.push(...Do(n)):n.type==="complexField"&&t.push(...Ro(n));return t}function ae(e){let t=[];if(!e.content)return t;for(let n of e.content)n.type==="text"&&n.text&&t.push(...$n(n.text));return t}function Ao(e){let t=[];if(!e.children)return t;for(let n of e.children)n.type==="run"&&t.push(...ae(n));return t}function Do(e){let t=[];if(e.instruction&&t.push(...$n(e.instruction)),e.content)for(let n of e.content)n.type==="run"&&t.push(...ae(n));return t}function Ro(e){let t=[];if(e.fieldCode)for(let n of e.fieldCode)n.type==="run"&&t.push(...ae(n));if(e.fieldResult)for(let n of e.fieldResult)n.type==="run"&&t.push(...ae(n));return t}function Pn(e){let t=[];if(!e.rows)return t;for(let n of e.rows)if(n.cells)for(let r of n.cells)t.push(...ko(r));return t}function ko(e){let t=[];if(!e.content)return t;for(let n of e.content)n.type==="paragraph"?t.push(...Ge(n)):n.type==="table"&&t.push(...Pn(n));return t}function Sn(e){let t=[];for(let n of e)if(n.content)for(let r of n.content)r.type==="paragraph"&&t.push(...Ge(r));return t}var Bo=/\{([a-zA-Z_][a-zA-Z0-9_\-\.]*)\}/g;function $n(e){if(!e)return [];let t=[],n=new RegExp(Bo),r;for(;(r=n.exec(e))!==null;)t.push(r[1]);return t}var Fn=class e{constructor(t){chunkH5NTJZO4_js.d(this,"_document");chunkH5NTJZO4_js.d(this,"_pendingVariables");t instanceof ArrayBuffer||ArrayBuffer.isView(t)?this._document={package:{document:{content:[]}},originalBuffer:t instanceof ArrayBuffer?t:t.buffer}:this._document=t,this._pendingVariables={};}static async fromBuffer(t){let n=await Ne(t);return new e(n)}static fromDocument(t){return new e(t)}getDocument(){return this._document}getText(){let t=this._document.package.document;return this._getBodyText(t)}getFormattedText(){let t=[],n=this._document.package.document;for(let r of n.content)r.type==="paragraph"&&this._extractParagraphSegments(r,t);return t}getVariables(){return Cn(this._document)}getStyles(){let t=this._document.package.styles;if(!t?.styles)return [];let n=[];for(let[r,o]of Object.entries(t.styles))if(typeof o=="object"&&o!==null){let i=o;n.push({id:r,name:i.name||r,type:i.type==="numbering"?"paragraph":i.type||"paragraph",builtIn:i.default});}return n}getPageCount(){let t=this.getWordCount();return Math.max(1,Math.ceil(t/500))}getWordCount(){return this.getText().split(/\s+/).filter(r=>r.length>0).length}getCharacterCount(t=true){let n=this.getText();return t?n.length:n.replace(/\s/g,"").length}getParagraphCount(){return this._document.package.document.content.filter(t=>t.type==="paragraph").length}getTableCount(){return this._document.package.document.content.filter(t=>t.type==="table").length}getAgentContext(t=100){let n=this._document.package.document,r=n.content.filter(s=>s.type==="paragraph"),o=r.map((s,a)=>{let l=this._getParagraphText(s),u=s.formatting?.styleId;return {index:a,preview:l.slice(0,t),style:u,isHeading:u?.toLowerCase().includes("heading")||false,headingLevel:this._parseHeadingLevel(u),isListItem:!!s.listRendering,isEmpty:l.trim().length===0}}),i=(n.sections||[]).map((s,a)=>({index:a,paragraphCount:s.content?.length||0,pageSize:s.properties?.pageWidth&&s.properties?.pageHeight?{width:s.properties.pageWidth,height:s.properties.pageHeight}:void 0,isLandscape:s.properties?.orientation==="landscape",hasHeader:!!s.properties?.headerReferences?.length,hasFooter:!!s.properties?.footerReferences?.length}));return {paragraphCount:r.length,wordCount:this.getWordCount(),characterCount:this.getCharacterCount(),variables:this.getVariables(),variableCount:this.getVariables().length,availableStyles:this.getStyles(),outline:o,sections:i,hasTables:this.getTableCount()>0,hasImages:this._hasImages(),hasHyperlinks:this._hasHyperlinks()}}insertText(t,n,r={}){let o={type:"insertText",position:t,text:n,formatting:r.formatting};return this._executeCommand(o)}replaceRange(t,n,r={}){let o={type:"replaceText",range:t,text:n,formatting:r.formatting};return this._executeCommand(o)}deleteRange(t){let n={type:"deleteText",range:t};return this._executeCommand(n)}applyFormatting(t,n){let r={type:"formatText",range:t,formatting:n};return this._executeCommand(r)}applyStyle(t,n){let r={type:"applyStyle",paragraphIndex:t,styleId:n};return this._executeCommand(r)}applyParagraphFormatting(t,n){let r={type:"formatParagraph",paragraphIndex:t,formatting:n};return this._executeCommand(r)}insertTable(t,n,r,o={}){let i={type:"insertTable",position:t,rows:n,columns:r,data:o.data,hasHeader:o.hasHeader};return this._executeCommand(i)}insertImage(t,n,r={}){let o={type:"insertImage",position:t,src:n,width:r.width,height:r.height,alt:r.alt};return this._executeCommand(o)}insertHyperlink(t,n,r={}){let o={type:"insertHyperlink",range:t,url:n,displayText:r.displayText,tooltip:r.tooltip};return this._executeCommand(o)}removeHyperlink(t){let n={type:"removeHyperlink",range:t};return this._executeCommand(n)}insertParagraphBreak(t){let n={type:"insertParagraphBreak",position:t};return this._executeCommand(n)}mergeParagraphs(t,n){let r={type:"mergeParagraphs",paragraphIndex:t,count:n};return this._executeCommand(r)}setVariable(t,n){return this._pendingVariables[t]=n,this}setVariables(t){for(let[n,r]of Object.entries(t))this._pendingVariables[n]=r;return this}getPendingVariables(){return {...this._pendingVariables}}clearPendingVariables(){return this._pendingVariables={},this}async applyVariables(t){let n={...this._pendingVariables,...t};if(Object.keys(n).length===0)return this;let r=this._document.originalBuffer;if(!r)throw new Error("Cannot apply variables: no original buffer for processing");let{processTemplate:o}=await import('./processTemplate-BTBTR7AM.js'),i=o(r,n),s=await Ne(i),a=new e(s);return a._pendingVariables={},a}async toBuffer(t){if(this._document.originalBuffer){if(t?.selective){let r=await Tn(this._document,this._document.originalBuffer,t.selective);if(r)return this._document.originalBuffer=r,r}let n=await _e(this._document);return this._document.originalBuffer=n,n}return hn(this._document)}async toBlob(t="application/vnd.openxmlformats-officedocument.wordprocessingml.document"){let n=await this.toBuffer();return new Blob([n],{type:t})}executeCommands(t){return new e(chunkE6MQXELR_js.b(this._document,t))}_executeCommand(t){let n=new e(chunkE6MQXELR_js.a(this._document,t));return n._pendingVariables={...this._pendingVariables},n}_getBodyText(t){let n=[];for(let r of t.content)r.type==="paragraph"?n.push(this._getParagraphText(r)):r.type==="table"&&n.push(this._getTableText(r));return n.join(`
|
|
60
|
+
`)}_getParagraphText(t){let n=[];for(let r of t.content)r.type==="run"?n.push(this._getRunText(r)):r.type==="hyperlink"&&n.push(this._getHyperlinkText(r));return n.join("")}_getRunText(t){return t.content.filter(n=>n.type==="text").map(n=>n.text).join("")}_getHyperlinkText(t){let n=[];for(let r of t.children)r.type==="run"&&n.push(this._getRunText(r));return n.join("")}_getTableText(t){let n=[];for(let r of t.rows)for(let o of r.cells)for(let i of o.content)i.type==="paragraph"&&n.push(this._getParagraphText(i));return n.join(" ")}_extractParagraphSegments(t,n){for(let r of t.content)if(r.type==="run"){let o=this._getRunText(r);o&&n.push({text:o,formatting:r.formatting});}else if(r.type==="hyperlink"){let o=r.href||"";for(let i of r.children)if(i.type==="run"){let s=this._getRunText(i);s&&n.push({text:s,formatting:i.formatting,isHyperlink:true,hyperlinkUrl:o});}}}_parseHeadingLevel(t){if(!t)return;let n=t.match(/heading\s*(\d)/i);if(n)return parseInt(n[1],10)}_hasImages(){let t=this._document.package.document;for(let n of t.content)if(n.type==="paragraph"){for(let r of n.content)if(r.type==="run"){for(let o of r.content)if(o.type==="drawing")return true}}return false}_hasHyperlinks(){let t=this._document.package.document;for(let n of t.content)if(n.type==="paragraph"){for(let r of n.content)if(r.type==="hyperlink")return true}return false}};function fs(e,t){if(!t||!t.trim())return null;let n=null;return e.descendants((r,o)=>n!==null?false:r.attrs?.paraId===t&&r.isTextblock?(n=o,false):true),n}exports.a=Ne;exports.b=Fn;exports.c=fs;exports.d=ue;exports.e=mt;exports.f=dt;exports.g=ht;exports.h=gt;exports.i=wt;exports.j=yt;exports.k=xt;exports.l=bt;exports.m=Tt;exports.n=pe;exports.o=De;exports.p=Ct;exports.q=fe;exports.r=Pt;exports.s=me;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {c}from'./chunk-7QQSDIWK.mjs';import {useState,useRef,useEffect,useCallback}from'react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var ue={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"transparent",display:"flex",alignItems:"flex-start",justifyContent:"flex-end",zIndex:1e4,pointerEvents:"none"},fe={backgroundColor:"white",borderRadius:"4px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.2)",minWidth:"360px",maxWidth:"440px",width:"100%",margin:"60px 20px 20px 20px",pointerEvents:"auto"},xe={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg-subtle)",borderTopLeftRadius:"4px",borderTopRightRadius:"4px"},ge={margin:0,fontSize:"14px",fontWeight:600,color:"var(--doc-text)"},Se={background:"none",border:"none",fontSize:"18px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"2px 6px",lineHeight:1},be={padding:"16px"},V={display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px"},j={width:"60px",fontSize:"13px",color:"var(--doc-text)",flexShrink:0},k={flex:1,padding:"8px 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"13px",boxSizing:"border-box",outline:"none"},X={...k,borderColor:"var(--doc-link)",boxShadow:"0 0 0 2px rgba(5, 99, 193, 0.1)"},me={display:"flex",flexDirection:"column",gap:"6px",marginLeft:"8px"},I={padding:"6px 12px",borderRadius:"3px",fontSize:"12px",fontWeight:500,cursor:"pointer",border:"1px solid var(--doc-border-input)",backgroundColor:"var(--doc-bg-input)",color:"var(--doc-text)",minWidth:"80px",textAlign:"center"},$={...I,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text-placeholder)",cursor:"not-allowed"},N={padding:"6px 10px",borderRadius:"3px",fontSize:"14px",cursor:"pointer",border:"1px solid var(--doc-border-input)",backgroundColor:"var(--doc-bg-input)",color:"var(--doc-text)"},q={...N,color:"var(--doc-border-input)",cursor:"not-allowed"},he={display:"flex",gap:"16px",marginTop:"4px",marginLeft:"68px"},L={display:"flex",alignItems:"center",gap:"6px",fontSize:"12px",color:"var(--doc-text-muted)",cursor:"pointer"},J={width:"14px",height:"14px",cursor:"pointer"},Q={marginLeft:"68px",fontSize:"12px",color:"var(--doc-text-muted)",marginBottom:"8px"},ve={...Q,color:"var(--doc-error)"},ye=({style:x})=>jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:x,children:jsx("polyline",{points:"18 15 12 9 6 15"})}),Re=({style:x})=>jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:x,children:jsx("polyline",{points:"6 9 12 15 18 9"})});function Te({isOpen:x,onClose:b,onFind:m,onFindNext:F,onFindPrevious:P,onReplace:_,onReplaceAll:O,onHighlightMatches:g,onClearHighlights:r,initialSearchText:v="",replaceMode:y=false,currentResult:R,className:Z,style:H}){let{t:n}=c(),[a,D]=useState(""),[h,w]=useState(""),[T,A]=useState(y),[d,ee]=useState(false),[p,te]=useState(false),[t,u]=useState(null),[oe,B]=useState(false),[ne,Y]=useState(false),C=useRef(null),U=useRef(null);useEffect(()=>{R!==void 0&&u(R);},[R]),useEffect(()=>{if(x){if(D(v),w(""),A(y),u(null),setTimeout(()=>{C.current?.focus(),C.current?.select();},100),v){let e=m(v,{matchCase:d,matchWholeWord:p});u(e),e?.matches&&g&&g(e.matches);}}else r&&r();},[x,v,y]);let i=useCallback(()=>{if(!a.trim()){u(null),r&&r();return}let e=m(a,{matchCase:d,matchWholeWord:p});u(e),e?.matches&&g?g(e.matches):r&&r();},[a,d,p,m,g,r]);useEffect(()=>{x&&a.trim()&&i();},[d,p]);let ae=useCallback(e=>{D(e.target.value);},[]),le=useCallback(e=>{e.key==="Enter"?(e.preventDefault(),e.shiftKey?M():t?K():i()):e.key==="Escape"&&b();},[t,i,b]),re=useCallback(e=>{e.key==="Enter"?(e.preventDefault(),W()):e.key==="Escape"&&b();},[b]),K=useCallback(()=>{if(!a.trim()){i();return}if(!t){i();return}if(F()&&t){let c=(t.currentIndex+1)%t.totalCount;u({...t,currentIndex:c});}},[a,t,i,F]),M=useCallback(()=>{if(!a.trim()){i();return}if(!t){i();return}if(P()&&t){let c=t.currentIndex===0?t.totalCount-1:t.currentIndex-1;u({...t,currentIndex:c});}},[a,t,i,P]),W=useCallback(()=>{if(!t||t.totalCount===0)return;if(_(h)){let c=m(a,{matchCase:d,matchWholeWord:p});u(c),c?.matches&&g&&g(c.matches);}},[t,h,a,d,p,_,m,g]),ie=useCallback(()=>{if(!a.trim())return;O(a,h,{matchCase:d,matchWholeWord:p})>0&&(u({matches:[],totalCount:0,currentIndex:-1}),r&&r());},[a,h,d,p,O,r]),ce=useCallback(()=>{A(e=>{let c=!e;return c&&setTimeout(()=>U.current?.focus(),100),c});},[]),se=useCallback(e=>{e.target,e.currentTarget;},[]),de=useCallback(e=>{e.key==="Escape"&&b();},[b]);if(!x)return null;let f=t&&t.totalCount>0,pe=t&&t.totalCount===0&&a.trim();return jsx("div",{className:`docx-find-replace-dialog-overlay ${Z||""}`,style:{...ue,...H},onClick:se,onKeyDown:de,children:jsxs("div",{className:"docx-find-replace-dialog","data-testid":"find-replace-dialog",style:fe,role:"dialog","aria-modal":"false","aria-labelledby":"find-replace-dialog-title",children:[jsxs("div",{className:"docx-find-replace-dialog-header",style:xe,children:[jsx("h2",{id:"find-replace-dialog-title",style:ge,children:n(T?"dialogs.findReplace.titleFindReplace":"dialogs.findReplace.titleFind")}),jsx("button",{type:"button",className:"docx-find-replace-dialog-close",style:Se,onClick:b,"aria-label":n("common.closeDialog"),children:"\xD7"})]}),jsxs("div",{className:"docx-find-replace-dialog-body",style:be,children:[jsxs("div",{className:"docx-find-replace-dialog-row",style:V,children:[jsx("label",{htmlFor:"find-text",style:j,children:n("dialogs.findReplace.findLabel")}),jsx("input",{ref:C,id:"find-text",type:"text",className:"docx-find-replace-dialog-input",style:oe?X:k,value:a,onChange:ae,onKeyDown:le,onFocus:()=>B(true),onBlur:()=>{B(false),a.trim()&&!t&&i();},placeholder:n("dialogs.findReplace.findPlaceholder"),"aria-label":n("dialogs.findReplace.findAriaLabel")}),jsxs("div",{style:{display:"flex",gap:"4px"},children:[jsx("button",{type:"button",className:"docx-find-replace-dialog-nav",style:f?N:q,onClick:M,disabled:!f,"aria-label":n("dialogs.findReplace.findPrevious"),title:n("dialogs.findReplace.findPreviousTitle"),children:jsx(ye,{})}),jsx("button",{type:"button",className:"docx-find-replace-dialog-nav",style:f?N:q,onClick:K,disabled:!f,"aria-label":n("dialogs.findReplace.findNext"),title:n("dialogs.findReplace.findNextTitle"),children:jsx(Re,{})})]})]}),f&&jsx("div",{className:"docx-find-replace-dialog-status",style:Q,children:n("dialogs.findReplace.matchCount",{current:t.currentIndex+1,total:t.totalCount})}),pe&&jsx("div",{className:"docx-find-replace-dialog-status",style:ve,children:n("dialogs.findReplace.noResults")}),T&&jsx(Fragment,{children:jsxs("div",{className:"docx-find-replace-dialog-row",style:V,children:[jsx("label",{htmlFor:"replace-text",style:j,children:n("dialogs.findReplace.replaceLabel")}),jsx("input",{ref:U,id:"replace-text",type:"text",className:"docx-find-replace-dialog-input",style:ne?X:k,value:h,onChange:e=>w(e.target.value),onKeyDown:re,onFocus:()=>Y(true),onBlur:()=>Y(false),placeholder:n("dialogs.findReplace.replacePlaceholder"),"aria-label":n("dialogs.findReplace.replaceAriaLabel")}),jsxs("div",{style:me,children:[jsx("button",{type:"button",className:"docx-find-replace-dialog-button",style:f?I:$,onClick:W,disabled:!f,title:n("dialogs.findReplace.replaceCurrentTitle"),children:n("dialogs.findReplace.replaceButton")}),jsx("button",{type:"button",className:"docx-find-replace-dialog-button",style:f?I:$,onClick:ie,disabled:!f,title:n("dialogs.findReplace.replaceAllTitle"),children:n("dialogs.findReplace.replaceAllButton")})]})]})}),jsxs("div",{className:"docx-find-replace-dialog-options",style:he,children:[jsxs("label",{className:"docx-find-replace-dialog-option",style:L,children:[jsx("input",{type:"checkbox",style:J,checked:d,onChange:e=>ee(e.target.checked)}),n("dialogs.findReplace.matchCase")]}),jsxs("label",{className:"docx-find-replace-dialog-option",style:L,children:[jsx("input",{type:"checkbox",style:J,checked:p,onChange:e=>te(e.target.checked)}),n("dialogs.findReplace.wholeWords")]}),!T&&jsx("button",{type:"button",style:{...L,background:"none",border:"none",cursor:"pointer",color:"var(--doc-link)",padding:0},onClick:ce,children:n("dialogs.findReplace.toggleReplace")})]})]})]})})}var Me=Te;export{Te as a,Me as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {d}from'./chunk-TAUMSKRE.mjs';var g=class{constructor(t,n=1){d(this,"pagesContainer");d(this,"zoom");this.pagesContainer=t,this.zoom=n;}getCoordinatesForPosition(t){let n=this.pagesContainer.getBoundingClientRect(),s=this.pagesContainer.querySelectorAll("span[data-pm-start][data-pm-end]");for(let a of Array.from(s)){let e=a,o=Number(e.dataset.pmStart),m=Number(e.dataset.pmEnd);if(e.classList.contains("layout-run-tab")){if(t>=o&&t<m){let c=e.getBoundingClientRect(),r=e.closest(".layout-line"),l=r?r.offsetHeight:16;return {x:(c.left-n.left)/this.zoom,y:(c.top-n.top)/this.zoom,height:l/this.zoom}}continue}if(t>=o&&t<=m&&a.firstChild?.nodeType===Node.TEXT_NODE){let c=a.firstChild,r=Math.min(t-o,c.length),l=e.ownerDocument;if(!l)continue;let u=l.createRange();u.setStart(c,r),u.setEnd(c,r);let h=u.getBoundingClientRect(),i=e.closest(".layout-line"),f=i?i.offsetHeight:16;return {x:(h.left-n.left)/this.zoom,y:(h.top-n.top)/this.zoom,height:f/this.zoom}}}let p=this.pagesContainer.querySelectorAll(".layout-empty-run");for(let a of Array.from(p)){let e=a.closest(".layout-paragraph");if(!e)continue;let o=Number(e.dataset.pmStart),m=Number(e.dataset.pmEnd);if(t>=o&&t<=m){let c=a.getBoundingClientRect(),r=a.closest(".layout-line"),l=r?r.offsetHeight:16;return {x:(c.left-n.left)/this.zoom,y:(c.top-n.top)/this.zoom,height:l/this.zoom}}}return null}findElementsForRange(t,n){let s=[],p=this.pagesContainer.querySelectorAll("span[data-pm-start][data-pm-end]");for(let a of Array.from(p)){let e=a,o=Number(e.dataset.pmStart);Number(e.dataset.pmEnd)>t&&o<n&&s.push(e);}return s}getRectsForRange(t,n){let s=this.pagesContainer.getBoundingClientRect(),p=[],a=this.pagesContainer.querySelectorAll("span[data-pm-start][data-pm-end]");for(let e of Array.from(a)){let o=e,m=Number(o.dataset.pmStart);if(Number(o.dataset.pmEnd)>t&&m<n){if(o.classList.contains("layout-run-tab")){let i=o.getBoundingClientRect();p.push({x:(i.left-s.left)/this.zoom,y:(i.top-s.top)/this.zoom,width:i.width/this.zoom,height:i.height/this.zoom});continue}if(e.firstChild?.nodeType!==Node.TEXT_NODE)continue;let r=e.firstChild,l=o.ownerDocument;if(!l)continue;let u=Math.max(0,t-m),h=Math.min(r.length,n-m);if(u<h){let i=l.createRange();i.setStart(r,u),i.setEnd(r,h);let f=i.getClientRects();for(let d of Array.from(f))p.push({x:(d.left-s.left)/this.zoom,y:(d.top-s.top)/this.zoom,width:d.width/this.zoom,height:d.height/this.zoom});}}}return p}getContainerOffset(){let t=this.pagesContainer.parentElement;if(!t)return {x:0,y:0};let n=this.pagesContainer.getBoundingClientRect(),s=t.getBoundingClientRect();return {x:(n.left-s.left)/this.zoom,y:(n.top-s.top)/this.zoom}}};function C(y,t=1){return new g(y,t)}export{g as a,C as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {c}from'./chunk-7QQSDIWK.mjs';import {i}from'./chunk-ONIYA2FU.mjs';import {useRef,useState,useEffect,useCallback,useMemo}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var x=[{id:"formatted",labelKey:"dialogs.pasteSpecial.keepFormatting",descriptionKey:"dialogs.pasteSpecial.keepFormattingDescription",shortcutKey:"dialogs.pasteSpecial.keepFormattingShortcut"},{id:"plainText",labelKey:"dialogs.pasteSpecial.plainText",descriptionKey:"dialogs.pasteSpecial.plainTextDescription",shortcutKey:"dialogs.pasteSpecial.plainTextShortcut"}],j=()=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M4 4h12v2H4V4zM4 8h8v2H4V8zM4 12h10v2H4v-2zM4 16h6v2H4v-2z",fill:"currentColor"}),jsx("path",{d:"M14 10l3 3-3 3v-2h-2v-2h2v-2z",fill:"currentColor",opacity:"0.6"})]}),Z=()=>jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M4 4h12v1H4V4zM4 7h12v1H4V7zM4 10h12v1H4v-1zM4 13h12v1H4v-1zM4 16h8v1H4v-1z",fill:"currentColor"})});function _(e){switch(e){case "formatted":return jsx(j,{});case "plainText":return jsx(Z,{});default:return null}}var V=({option:e,isSelected:t,onClick:l,onMouseEnter:u})=>jsxs("button",{type:"button",className:`docx-paste-special-option ${t?"docx-paste-special-option-selected":""}`,onClick:l,onMouseEnter:u,role:"menuitem","aria-selected":t,style:{display:"flex",alignItems:"center",gap:"12px",width:"100%",padding:"12px 16px",border:"none",background:t?"var(--doc-primary-light)":"transparent",cursor:"pointer",textAlign:"left",borderRadius:"4px",transition:"background-color 0.15s ease"},children:[jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"4px",background:t?"var(--doc-primary)":"var(--doc-bg-hover)",color:t?"white":"var(--doc-text-muted)"},children:_(e.id)}),jsxs("div",{style:{flex:1},children:[jsx("div",{style:{fontSize:"14px",fontWeight:500,color:"var(--doc-text)",marginBottom:"2px"},children:e.label}),jsx("div",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:e.description})]}),jsx("span",{style:{fontSize:"11px",color:"var(--doc-text-subtle)",fontFamily:"monospace"},children:e.shortcut})]}),X=({isOpen:e,onClose:t,onPaste:l,position:u,className:y=""})=>{let{t:o}=c(),b=useRef(null),[h,p]=useState(0),[i$1,v]=useState(null),[w,C]=useState(false),[s,r]=useState(null),n=x.map(c=>({id:c.id,label:o(c.labelKey),description:o(c.descriptionKey),shortcut:o(c.shortcutKey)}));useEffect(()=>{if(!e){v(null),r(null),p(0);return}(async()=>{C(true),r(null);try{let g=await i({cleanWordFormatting:!0});v(g),g||r(o("dialogs.pasteSpecial.noContent"));}catch{r(o("dialogs.pasteSpecial.clipboardError"));}finally{C(false);}})();},[e]),useEffect(()=>{if(!e)return;let c=g=>{b.current&&!b.current.contains(g.target)&&t();};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[e,t]),useEffect(()=>{if(!e)return;let c=g=>{switch(g.key){case "Escape":g.preventDefault(),t();break;case "ArrowDown":g.preventDefault(),p(f=>(f+1)%x.length);break;case "ArrowUp":g.preventDefault(),p(f=>(f-1+x.length)%x.length);break;case "Enter":g.preventDefault(),m(x[h].id);break}};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,h,t]);let m=useCallback(c=>{if(!i$1){r(o("dialogs.pasteSpecial.noContent"));return}l(i$1,c==="plainText"),t();},[i$1,l,t]),U=useCallback(()=>{let f=u?.x??(typeof window<"u"?window.innerWidth/2-160:100),D=u?.y??(typeof window<"u"?window.innerHeight/2-200/2:100);return typeof window<"u"&&(f+320>window.innerWidth&&(f=window.innerWidth-320-10),D+200>window.innerHeight&&(D=window.innerHeight-200-10),f<10&&(f=10),D<10&&(D=10)),{position:"fixed",top:D,left:f,width:320,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",zIndex:10001,overflow:"hidden"}},[u]);return e?jsxs("div",{ref:b,className:`docx-paste-special-dialog ${y}`,style:U(),role:"dialog","aria-label":o("dialogs.pasteSpecial.title"),children:[jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsx("span",{style:{fontSize:"14px",fontWeight:600,color:"var(--doc-text)"},children:o("dialogs.pasteSpecial.title")}),jsx("button",{type:"button",onClick:t,"aria-label":o("common.closeDialog"),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",border:"none",background:"transparent",cursor:"pointer",borderRadius:"4px",color:"var(--doc-text-muted)"},children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),jsx("div",{style:{padding:"8px"},children:w?jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--doc-text-muted)",fontSize:"13px"},children:o("dialogs.pasteSpecial.readingClipboard")}):s?jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--doc-error)",fontSize:"13px"},children:s}):jsx("div",{role:"menu",children:n.map((c,g)=>jsx(V,{option:c,isSelected:g===h,onClick:()=>m(c.id),onMouseEnter:()=>p(g)},c.id))})}),i$1&&!w&&!s&&jsxs("div",{style:{padding:"8px 16px 12px",borderTop:"1px solid var(--doc-border)"},children:[jsx("div",{style:{fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px"},children:o("dialogs.pasteSpecial.preview")}),jsxs("div",{style:{fontSize:"12px",color:"var(--doc-text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"6px 8px",background:"var(--doc-bg)",borderRadius:"4px"},children:['"',i$1.plainText.slice(0,50),i$1.plainText.length>50?"...":"",'"']})]})]}):null};function ee(e={}){let{onPaste:t,enabled:l=true}=e,[u,y]=useState(false),o=useCallback(()=>{l&&y(true);},[l]),b=useCallback(()=>{y(false);},[]),h=useCallback(async()=>{if(!(!l||!t))try{let i$1=await i({cleanWordFormatting:!0});i$1&&t(i$1,!0);}catch(i){console.error("Failed to paste as plain text:",i);}},[l,t]),p=useCallback(i=>l&&(i.ctrlKey||i.metaKey)&&i.shiftKey&&i.key.toLowerCase()==="v"?(i.preventDefault(),o(),true):false,[l,o]);return {isOpen:u,openDialog:o,closeDialog:b,handleKeyDown:p,pasteAsPlainText:h}}function te(e){return x.find(t=>t.id===e)}function oe(){return [...x]}function re(){return "formatted"}function ie(e){return (e.ctrlKey||e.metaKey)&&e.shiftKey&&e.key.toLowerCase()==="v"}var H={editing:"dialogs.keyboardShortcuts.categories.editing",formatting:"dialogs.keyboardShortcuts.categories.formatting",navigation:"dialogs.keyboardShortcuts.categories.navigation",clipboard:"dialogs.keyboardShortcuts.categories.clipboard",selection:"dialogs.keyboardShortcuts.categories.selection",view:"dialogs.keyboardShortcuts.categories.view",file:"dialogs.keyboardShortcuts.categories.file",other:"dialogs.keyboardShortcuts.categories.other"},F=["file","editing","clipboard","formatting","selection","navigation","view","other"],I=[{id:"save",name:"Save",nameKey:"dialogs.keyboardShortcuts.shortcuts.save",description:"Save document",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.saveDescription",keys:"Ctrl+S",category:"file",common:true},{id:"print",name:"Print",nameKey:"dialogs.keyboardShortcuts.shortcuts.print",description:"Print document",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.printDescription",keys:"Ctrl+P",category:"file"},{id:"undo",name:"Undo",nameKey:"dialogs.keyboardShortcuts.shortcuts.undo",description:"Undo last action",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.undoDescription",keys:"Ctrl+Z",category:"editing",common:true},{id:"redo",name:"Redo",nameKey:"dialogs.keyboardShortcuts.shortcuts.redo",description:"Redo last action",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.redoDescription",keys:"Ctrl+Y",altKeys:"Ctrl+Shift+Z",category:"editing",common:true},{id:"delete",name:"Delete",nameKey:"dialogs.keyboardShortcuts.shortcuts.delete",description:"Delete selected text",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.deleteDescription",keys:"Del",altKeys:"Backspace",category:"editing"},{id:"find",name:"Find",nameKey:"dialogs.keyboardShortcuts.shortcuts.find",description:"Find text in document",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.findDescription",keys:"Ctrl+F",category:"editing",common:true},{id:"replace",name:"Find & Replace",nameKey:"dialogs.keyboardShortcuts.shortcuts.findReplace",description:"Find and replace text",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.findReplaceDescription",keys:"Ctrl+H",category:"editing"},{id:"cut",name:"Cut",nameKey:"dialogs.keyboardShortcuts.shortcuts.cut",description:"Cut selected text",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.cutDescription",keys:"Ctrl+X",category:"clipboard",common:true},{id:"copy",name:"Copy",nameKey:"dialogs.keyboardShortcuts.shortcuts.copy",description:"Copy selected text",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.copyDescription",keys:"Ctrl+C",category:"clipboard",common:true},{id:"paste",name:"Paste",nameKey:"dialogs.keyboardShortcuts.shortcuts.paste",description:"Paste from clipboard",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.pasteDescription",keys:"Ctrl+V",category:"clipboard",common:true},{id:"paste-plain",name:"Paste as Plain Text",nameKey:"dialogs.keyboardShortcuts.shortcuts.pastePlainText",description:"Paste without formatting",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.pastePlainTextDescription",keys:"Ctrl+Shift+V",category:"clipboard"},{id:"bold",name:"Bold",nameKey:"dialogs.keyboardShortcuts.shortcuts.bold",description:"Toggle bold formatting",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.boldDescription",keys:"Ctrl+B",category:"formatting",common:true},{id:"italic",name:"Italic",nameKey:"dialogs.keyboardShortcuts.shortcuts.italic",description:"Toggle italic formatting",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.italicDescription",keys:"Ctrl+I",category:"formatting",common:true},{id:"underline",name:"Underline",nameKey:"dialogs.keyboardShortcuts.shortcuts.underline",description:"Toggle underline formatting",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.underlineDescription",keys:"Ctrl+U",category:"formatting",common:true},{id:"strikethrough",name:"Strikethrough",nameKey:"dialogs.keyboardShortcuts.shortcuts.strikethrough",description:"Toggle strikethrough",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.strikethroughDescription",keys:"Ctrl+Shift+X",category:"formatting"},{id:"subscript",name:"Subscript",nameKey:"dialogs.keyboardShortcuts.shortcuts.subscript",description:"Toggle subscript",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.subscriptDescription",keys:"Ctrl+=",category:"formatting"},{id:"superscript",name:"Superscript",nameKey:"dialogs.keyboardShortcuts.shortcuts.superscript",description:"Toggle superscript",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.superscriptDescription",keys:"Ctrl+Shift+=",category:"formatting"},{id:"align-left",name:"Align Left",nameKey:"dialogs.keyboardShortcuts.shortcuts.alignLeft",description:"Left align paragraph",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.alignLeftDescription",keys:"Ctrl+L",category:"formatting"},{id:"align-center",name:"Align Center",nameKey:"dialogs.keyboardShortcuts.shortcuts.alignCenter",description:"Center align paragraph",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.alignCenterDescription",keys:"Ctrl+E",category:"formatting"},{id:"align-right",name:"Align Right",nameKey:"dialogs.keyboardShortcuts.shortcuts.alignRight",description:"Right align paragraph",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.alignRightDescription",keys:"Ctrl+R",category:"formatting"},{id:"align-justify",name:"Justify",nameKey:"dialogs.keyboardShortcuts.shortcuts.justify",description:"Justify paragraph",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.justifyDescription",keys:"Ctrl+J",category:"formatting"},{id:"indent",name:"Increase Indent",nameKey:"dialogs.keyboardShortcuts.shortcuts.increaseIndent",description:"Increase paragraph indent",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.increaseIndentDescription",keys:"Tab",category:"formatting"},{id:"outdent",name:"Decrease Indent",nameKey:"dialogs.keyboardShortcuts.shortcuts.decreaseIndent",description:"Decrease paragraph indent",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.decreaseIndentDescription",keys:"Shift+Tab",category:"formatting"},{id:"select-all",name:"Select All",nameKey:"dialogs.keyboardShortcuts.shortcuts.selectAll",description:"Select all content",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.selectAllDescription",keys:"Ctrl+A",category:"selection",common:true},{id:"select-word",name:"Select Word",nameKey:"dialogs.keyboardShortcuts.shortcuts.selectWord",description:"Select current word",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.selectWordDescription",keys:"Double-click",category:"selection"},{id:"select-paragraph",name:"Select Paragraph",nameKey:"dialogs.keyboardShortcuts.shortcuts.selectParagraph",description:"Select current paragraph",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.selectParagraphDescription",keys:"Triple-click",category:"selection"},{id:"extend-selection-word",name:"Extend Selection by Word",nameKey:"dialogs.keyboardShortcuts.shortcuts.extendSelectionByWord",description:"Extend selection to next/previous word",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.extendSelectionByWordDescription",keys:"Ctrl+Shift+Arrow",category:"selection"},{id:"extend-selection-line",name:"Extend Selection to Line Edge",nameKey:"dialogs.keyboardShortcuts.shortcuts.extendSelectionToLineEdge",description:"Extend selection to line start/end",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.extendSelectionToLineEdgeDescription",keys:"Shift+Home/End",category:"selection"},{id:"move-word",name:"Move by Word",nameKey:"dialogs.keyboardShortcuts.shortcuts.moveByWord",description:"Move cursor to next/previous word",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.moveByWordDescription",keys:"Ctrl+Arrow",category:"navigation"},{id:"move-line-start",name:"Move to Line Start",nameKey:"dialogs.keyboardShortcuts.shortcuts.moveToLineStart",description:"Move cursor to start of line",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.moveToLineStartDescription",keys:"Home",category:"navigation"},{id:"move-line-end",name:"Move to Line End",nameKey:"dialogs.keyboardShortcuts.shortcuts.moveToLineEnd",description:"Move cursor to end of line",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.moveToLineEndDescription",keys:"End",category:"navigation"},{id:"move-doc-start",name:"Move to Document Start",nameKey:"dialogs.keyboardShortcuts.shortcuts.moveToDocumentStart",description:"Move cursor to start of document",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.moveToDocumentStartDescription",keys:"Ctrl+Home",category:"navigation"},{id:"move-doc-end",name:"Move to Document End",nameKey:"dialogs.keyboardShortcuts.shortcuts.moveToDocumentEnd",description:"Move cursor to end of document",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.moveToDocumentEndDescription",keys:"Ctrl+End",category:"navigation"},{id:"page-up",name:"Page Up",nameKey:"dialogs.keyboardShortcuts.shortcuts.pageUp",description:"Scroll up one page",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.pageUpDescription",keys:"Page Up",category:"navigation"},{id:"page-down",name:"Page Down",nameKey:"dialogs.keyboardShortcuts.shortcuts.pageDown",description:"Scroll down one page",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.pageDownDescription",keys:"Page Down",category:"navigation"},{id:"zoom-in",name:"Zoom In",nameKey:"dialogs.keyboardShortcuts.shortcuts.zoomIn",description:"Increase zoom level",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.zoomInDescription",keys:"Ctrl++",altKeys:"Ctrl+Scroll Up",category:"view"},{id:"zoom-out",name:"Zoom Out",nameKey:"dialogs.keyboardShortcuts.shortcuts.zoomOut",description:"Decrease zoom level",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.zoomOutDescription",keys:"Ctrl+-",altKeys:"Ctrl+Scroll Down",category:"view"},{id:"zoom-reset",name:"Reset Zoom",nameKey:"dialogs.keyboardShortcuts.shortcuts.resetZoom",description:"Reset zoom to 100%",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.resetZoomDescription",keys:"Ctrl+0",category:"view"},{id:"shortcuts",name:"Keyboard Shortcuts",nameKey:"dialogs.keyboardShortcuts.shortcuts.keyboardShortcuts",description:"Show this help dialog",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.keyboardShortcutsDescription",keys:"Ctrl+/",altKeys:"F1",category:"view"}];function Y(){return typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)}function O(e){return Y()?e.replace(/Ctrl\+/g,"\u2318").replace(/Alt\+/g,"\u2325").replace(/Shift\+/g,"\u21E7"):e}var J=({shortcut:e,translatedName:t,translatedDescription:l})=>{let u=O(e.keys),y=e.altKeys?O(e.altKeys):null;return jsxs("div",{className:"docx-shortcut-item",style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 0",borderBottom:"1px solid var(--doc-border-light)"},children:[jsxs("div",{style:{flex:1},children:[jsx("div",{style:{fontSize:"13px",fontWeight:500,color:"var(--doc-text)"},children:t}),jsx("div",{style:{fontSize:"11px",color:"var(--doc-text-muted)",marginTop:"2px"},children:l})]}),jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[jsx("kbd",{style:{display:"inline-flex",alignItems:"center",padding:"4px 8px",fontSize:"12px",fontFamily:"monospace",color:"var(--doc-text)",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",border:"1px solid var(--doc-border-light)",boxShadow:"0 1px 1px rgba(0,0,0,0.1)"},children:u}),y&&jsxs(Fragment,{children:[jsx("span",{style:{color:"var(--doc-text-subtle)",fontSize:"11px"},children:"or"}),jsx("kbd",{style:{display:"inline-flex",alignItems:"center",padding:"4px 8px",fontSize:"12px",fontFamily:"monospace",color:"var(--doc-text)",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",border:"1px solid var(--doc-border-light)",boxShadow:"0 1px 1px rgba(0,0,0,0.1)"},children:y})]})]})]})},le=({isOpen:e,onClose:t,customShortcuts:l=[],showSearch:u=true,className:y=""})=>{let{t:o}=c(),b=useRef(null),h=useRef(null),[p,i]=useState(""),v=useMemo(()=>{let s=[...I];for(let r of l){let n=s.findIndex(m=>m.id===r.id);n>=0?s[n]=r:s.push(r);}return s},[l]),w=useMemo(()=>{if(!p.trim())return v;let s=p.toLowerCase();return v.filter(r=>{let n=r.nameKey?o(r.nameKey):r.name,m=r.descriptionKey?o(r.descriptionKey):r.description;return n.toLowerCase().includes(s)||m.toLowerCase().includes(s)||r.keys.toLowerCase().includes(s)||r.altKeys&&r.altKeys.toLowerCase().includes(s)})},[v,p,o]),C=useMemo(()=>{let s=new Map;for(let n of w){let m=s.get(n.category)||[];m.push(n),s.set(n.category,m);}let r=[];for(let n of F){let m=s.get(n);m&&m.length>0&&r.push({category:n,shortcuts:m});}return r},[w]);return useEffect(()=>{e&&u&&h.current&&setTimeout(()=>h.current?.focus(),0);},[e,u]),useEffect(()=>{e||i("");},[e]),useEffect(()=>{if(!e)return;let s=r=>{b.current&&!b.current.contains(r.target)&&t();};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[e,t]),useEffect(()=>{if(!e)return;let s=r=>{r.key==="Escape"&&t();};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,t]),e?jsx("div",{className:"docx-shortcuts-overlay",style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10001},children:jsxs("div",{ref:b,className:`docx-shortcuts-dialog ${y}`,style:{width:"600px",maxWidth:"90vw",maxHeight:"80vh",backgroundColor:"white",borderRadius:"12px",boxShadow:"0 4px 24px rgba(0, 0, 0, 0.2)",display:"flex",flexDirection:"column",overflow:"hidden"},role:"dialog","aria-label":o("dialogs.keyboardShortcuts.ariaLabel"),children:[jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},children:[jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},children:o("dialogs.keyboardShortcuts.ariaLabel")}),jsx("button",{type:"button",onClick:t,"aria-label":o("common.closeDialog"),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"none",background:"transparent",cursor:"pointer",borderRadius:"50%",color:"var(--doc-text-muted)"},children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M5 5l10 10M15 5L5 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),u&&jsx("div",{style:{padding:"12px 20px",borderBottom:"1px solid var(--doc-border)"},children:jsx("input",{ref:h,type:"text",value:p,onChange:s=>i(s.target.value),placeholder:o("dialogs.keyboardShortcuts.searchPlaceholder"),style:{width:"100%",padding:"10px 12px",fontSize:"14px",border:"1px solid var(--doc-border-light)",borderRadius:"6px",outline:"none"}})}),jsx("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:C.length===0?jsx("div",{style:{textAlign:"center",padding:"32px",color:"var(--doc-text-muted)"},children:o("dialogs.keyboardShortcuts.noResults",{query:p})}):C.map(({category:s,shortcuts:r})=>jsxs("div",{style:{marginBottom:"24px"},children:[jsx("h3",{style:{margin:"0 0 12px 0",fontSize:"13px",fontWeight:600,color:"var(--doc-primary)",textTransform:"uppercase",letterSpacing:"0.5px"},children:o(H[s])}),jsx("div",{children:r.map(n=>jsx(J,{shortcut:n,translatedName:n.nameKey?o(n.nameKey):n.name,translatedDescription:n.descriptionKey?o(n.descriptionKey):n.description},n.id))})]},s))}),jsx("div",{style:{padding:"12px 20px",borderTop:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg)",fontSize:"12px",color:"var(--doc-text-muted)",textAlign:"center"},children:(()=>{let r=o("dialogs.keyboardShortcuts.pressEscToClose",{key:"Esc"}).split("Esc");return jsxs(Fragment,{children:[r[0],jsx("kbd",{style:{padding:"2px 6px",backgroundColor:"white",borderRadius:"4px",border:"1px solid var(--doc-border-light)"},children:"Esc"}),r[1]]})})()})]})}):null};function pe(e={}){let{enabled:t=true,openShortcut:l="Ctrl+/"}=e,[u,y]=useState(false),o=useCallback(()=>{t&&y(true);},[t]),b=useCallback(()=>{y(false);},[]),h=useCallback(()=>{y(i=>!i);},[]),p=useCallback(i=>{if(!t)return;if((i.ctrlKey||i.metaKey)&&(i.key==="/"||i.key==="?")){i.preventDefault(),h();return}if(i.key==="F1"){i.preventDefault(),o();return}},[t,h,o]);return useEffect(()=>{if(t)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t,p]),{isOpen:u,open:o,close:b,toggle:h,handleKeyDown:p}}function ue(){return [...I]}function ge(e){return I.filter(t=>t.category===e)}function ye(){return I.filter(e=>e.common)}function he(e){return H[e]}function me(){return [...F]}function be(e){return O(e)}
|
|
2
|
+
export{X as a,ee as b,te as c,oe as d,re as e,ie as f,le as g,pe as h,ue as i,ge as j,ye as k,he as l,me as m,be as n};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {e,h,i,n as n$1,f,m as m$1,k as k$1,l as l$1,j}from'./chunk-U7ZW2DOO.mjs';import {n,k,l,m}from'./chunk-47VJOBJD.mjs';import {Ha}from'./chunk-XQZTWWRF.mjs';import {d}from'./chunk-TAUMSKRE.mjs';import {useMemo,useState,useCallback,useRef,useEffect}from'react';import {TextSelection}from'prosemirror-state';function gt({document:o,onChange:r,onSelectionChange:a}){let m$2=useMemo(()=>new n,[]),[t,S]=useState({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null}),x=useCallback((l,n,e$1)=>{if(!o)return;let u=k(o,l);if(!u){m$2.clearSelection(),S({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null});return}m$2.selectCell({tableIndex:l,rowIndex:n,columnIndex:e$1});let y=e(u,{tableIndex:l,rowIndex:n,columnIndex:e$1});S({context:y,table:u,tableIndex:l,rowIndex:n,columnIndex:e$1}),a?.(y);},[o,m$2,a]),b=useCallback(()=>{m$2.clearSelection(),S({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null}),a?.(null);},[m$2,a]),i$1=useCallback(()=>!t.table||t.rowIndex===null||t.columnIndex===null?null:h(t.table,t.rowIndex,t.columnIndex),[t.columnIndex,t.rowIndex,t.table]),f$1=useCallback((l$1,n)=>{if(!o||!t.table||t.tableIndex===null||t.rowIndex===null||t.columnIndex===null)return;let e=i(t.table,t.rowIndex,t.columnIndex,l$1,n);if(e===t.table)return;let u=l(o,t.tableIndex,e);r?.(u),u&&x(t.tableIndex,t.rowIndex,t.columnIndex);},[o,x,r,t.columnIndex,t.rowIndex,t.table,t.tableIndex]),d=useCallback(l$2=>{if(!o||!t.context||t.tableIndex===null||t.rowIndex===null||t.columnIndex===null)return;let n=t.table;if(!n)return;let e=null,u=null,c=t.rowIndex,y=t.columnIndex;switch(l$2){case "addRowAbove":e=j(n,t.rowIndex,"before"),c=t.rowIndex+1;break;case "addRowBelow":e=j(n,t.rowIndex,"after");break;case "addColumnLeft":e=l$1(n,t.columnIndex,"before"),y=t.columnIndex+1;break;case "addColumnRight":e=l$1(n,t.columnIndex,"after");break;case "deleteRow":n.rows.length>1&&(e=k$1(n,t.rowIndex),c>=e.rows.length&&(c=e.rows.length-1));break;case "deleteColumn":{if(f(n)>1){e=m$1(n,t.columnIndex);let p=f(e);y>=p&&(y=p-1);}break}case "mergeCells":t.context.selection.selectedCells&&(e=n$1(n,t.context.selection));break;case "splitCell":break;case "deleteTable":u=m(o,t.tableIndex),b(),r?.(u);return}e&&(u=l(o,t.tableIndex,e),r?.(u),u&&x(t.tableIndex,c,y));},[o,t,r,b,x]),s=useCallback((l,n,e)=>m$2.isCellSelected(l,n,e),[m$2,t]);return {state:t,handleCellClick:x,handleAction:d,getSplitCellConfig:i$1,applySplitCell:f$1,clearSelection:b,isCellSelected:s,tableContext:t.context}}function lt(o,r){return JSON.stringify(o)===JSON.stringify(r)}function at(o,r={}){let{maxEntries:a=100,groupingInterval:m=500,enableKeyboardShortcuts:t=true,isEqual:S=lt,onUndo:x,onRedo:b,containerRef:i}=r,[f,d]=useState(o),[s,l]=useState([]),[n,e]=useState([]),u=useRef(0),c=useRef(false),y=useCallback((h,g)=>{if(S(f,h))return;if(c.current){d(h);return}let T=Date.now();T-u.current<m&&s.length>0?l(V=>{let A=[...V];return A[A.length-1]={state:f,timestamp:T,description:g||A[A.length-1].description},A}):l(V=>{let A={state:f,timestamp:T,description:g},v=[...V,A];return v.length>a?v.slice(v.length-a):v}),e([]),d(h),u.current=T;},[f,S,m,a,s.length]),E=useCallback(()=>{if(s.length===0)return;c.current=true;let h=s[s.length-1];return l(g=>g.slice(0,-1)),e(g=>[...g,{state:f,timestamp:Date.now()}]),d(h.state),setTimeout(()=>{c.current=false;},0),x?.(h.state),h.state},[s,f,x]),p=useCallback(()=>{if(n.length===0)return;c.current=true;let h=n[n.length-1];return e(g=>g.slice(0,-1)),l(g=>[...g,{state:f,timestamp:Date.now()}]),d(h.state),setTimeout(()=>{c.current=false;},0),b?.(h.state),h.state},[n,f,b]),L=useCallback(()=>{l([]),e([]);},[]),w=useCallback(h=>{d(h??o),l([]),e([]),u.current=0;},[o]),M=useCallback(()=>[...s],[s]),k=useCallback(()=>[...n],[n]),H=useCallback(h=>{d(g=>h(g)),l(g=>g.map(T=>({...T,state:h(T.state)}))),e(g=>g.map(T=>({...T,state:h(T.state)})));},[]);return useEffect(()=>{if(!t)return;let h=T=>{if((T.ctrlKey||T.metaKey)&&T.key==="z"&&!T.shiftKey){T.preventDefault(),E();return}if((T.ctrlKey||T.metaKey)&&T.key==="y"||(T.ctrlKey||T.metaKey)&&T.key==="z"&&T.shiftKey){T.preventDefault(),p();return}},g=i?.current||document;return g.addEventListener("keydown",h),()=>{g.removeEventListener("keydown",h);}},[t,E,p,i]),{state:f,canUndo:s.length>0,canRedo:n.length>0,undoCount:s.length,redoCount:n.length,push:y,undo:E,redo:p,clear:L,reset:w,getUndoStack:M,getRedoStack:k,transformAll:H}}function Et(o,r={}){let a=at(o,r);return useEffect(()=>{a.push(o);},[o]),a}function wt(o,r={}){let a=useCallback((m,t)=>!(m?.package?.document!==t?.package?.document&&JSON.stringify(m?.package?.document)!==JSON.stringify(t?.package?.document)||m?.package?.headers!==t?.package?.headers||m?.package?.footers!==t?.package?.footers),[]);return at(o,{...r,isEqual:a})}var rt=class{constructor(r,a={}){d(this,"undoStack",[]);d(this,"redoStack",[]);d(this,"currentState");d(this,"maxEntries");d(this,"groupingInterval");d(this,"lastPushTime",0);d(this,"isEqual");this.currentState=r,this.maxEntries=a.maxEntries??100,this.groupingInterval=a.groupingInterval??500,this.isEqual=a.isEqual??lt;}get state(){return this.currentState}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}push(r,a){if(this.isEqual(this.currentState,r))return;let m=Date.now();m-this.lastPushTime<this.groupingInterval&&this.undoStack.length>0?this.undoStack[this.undoStack.length-1].timestamp=m:(this.undoStack.push({state:this.currentState,timestamp:m,description:a}),this.undoStack.length>this.maxEntries&&(this.undoStack=this.undoStack.slice(-this.maxEntries))),this.redoStack=[],this.currentState=r,this.lastPushTime=m;}undo(){if(this.undoStack.length===0)return;let r=this.undoStack.pop();return this.redoStack.push({state:this.currentState,timestamp:Date.now()}),this.currentState=r.state,r.state}redo(){if(this.redoStack.length===0)return;let r=this.redoStack.pop();return this.undoStack.push({state:this.currentState,timestamp:Date.now()}),this.currentState=r.state,r.state}clear(){this.undoStack=[],this.redoStack=[];}reset(r){this.currentState=r??this.currentState,this.undoStack=[],this.redoStack=[],this.lastPushTime=0;}};function N(o){let r=o.parentElement;for(;r&&r!==document.documentElement;){let{overflowY:a}=getComputedStyle(r);if((a==="auto"||a==="scroll")&&r.scrollHeight>r.clientHeight+1)return r;r=r.parentElement;}return null}function Ct(o){return N(o)??document.documentElement}var ut=".layout-page-content .layout-line";function dt(o){let r=N(o);if(!r)return;let a=o.getBoundingClientRect(),m=r.getBoundingClientRect(),t=40;a.bottom>m.bottom-t?r.scrollTop+=a.bottom-m.bottom+t:a.top<m.top+t&&(r.scrollTop-=m.top-a.top+t);}function Mt({pagesContainerRef:o}){let r=useRef(null),a=useRef(-1),m=useCallback(b=>{if(!o.current)return null;let i=Ha(o.current);for(let d of i){let s=Number(d.dataset.pmStart),l=Number(d.dataset.pmEnd);if(d.classList.contains("layout-run-tab")){if(b>=s&&b<l)return d.getBoundingClientRect().left;continue}if(b>=s&&b<=l&&d.firstChild?.nodeType===Node.TEXT_NODE){let n=d.firstChild,e=Math.min(b-s,n.length),u=d.ownerDocument;if(!u)continue;let c=u.createRange();return c.setStart(n,e),c.setEnd(n,e),c.getBoundingClientRect().left}}let f=o.current.querySelectorAll(".layout-empty-run");for(let d of Array.from(f)){let s=d.closest(".layout-paragraph");if(!s)continue;let l=Number(s.dataset.pmStart),n=Number(s.dataset.pmEnd);if(b>=l&&b<=n)return d.getBoundingClientRect().left}return null},[o]),t=useCallback(b=>{if(!o.current)return null;let i=o.current.querySelectorAll(ut);for(let f of Array.from(i)){let d=f,s=d.querySelectorAll("span[data-pm-start][data-pm-end]");for(let l of Array.from(s)){let n=l,e=Number(n.dataset.pmStart),u=Number(n.dataset.pmEnd);if(b>=e&&b<=u)return d}}for(let f of Array.from(i)){let d=f,s=d.closest(".layout-paragraph");if(!s)continue;let l=Number(s.dataset.pmStart),n=Number(s.dataset.pmEnd);if(b>=l&&b<=n&&s.querySelector(".layout-line")===d)return d}return null},[o]),S=useCallback((b,i)=>{let f=b.querySelectorAll("span[data-pm-start][data-pm-end]");if(f.length===0){let n=b.closest(".layout-paragraph");return n?.dataset.pmStart?Number(n.dataset.pmStart)+1:null}for(let n of Array.from(f)){let e=n,u=e.getBoundingClientRect(),c=Number(e.dataset.pmStart),y=Number(e.dataset.pmEnd);if(e.classList.contains("layout-run-tab")){if(i>=u.left&&i<=u.right){let E=(u.left+u.right)/2;return i<E?c:y}continue}if(i>=u.left&&i<=u.right){let E=e.firstChild;if(!E||E.nodeType!==Node.TEXT_NODE)return c;let p=E,L=e.ownerDocument;if(!L)return c;let w=0,M=p.length;for(;w<M;){let k=Math.floor((w+M)/2),H=L.createRange();H.setStart(p,k),H.setEnd(p,k),i<H.getBoundingClientRect().left?M=k:w=k+1;}if(w>0&&w<=p.length){let k=L.createRange();k.setStart(p,w-1),k.setEnd(p,w-1);let H=k.getBoundingClientRect().left;k.setStart(p,Math.min(w,p.length)),k.setEnd(p,Math.min(w,p.length));let h=k.getBoundingClientRect().left;if(Math.abs(i-H)<Math.abs(i-h))return c+(w-1)}return c+Math.min(w,y-c)}}let d=null,s=1/0;for(let n of Array.from(f)){let e=n,u=e.getBoundingClientRect(),c=i<u.left?u.left-i:i-u.right;c<s&&(s=c,d=e);}if(!d)return null;let l=d.getBoundingClientRect();return i<l.left?Number(d.dataset.pmStart):Number(d.dataset.pmEnd)},[]),x=useCallback((b,i)=>{if(i.key!=="ArrowUp"&&i.key!=="ArrowDown")return (["ArrowLeft","ArrowRight","Home","End"].includes(i.key)||i.key.length===1&&!i.ctrlKey&&!i.metaKey)&&(r.current=null,a.current=-1),false;if(i.ctrlKey||i.metaKey)return r.current=null,a.current=-1,false;if(!o.current)return false;let f=Array.from(o.current.querySelectorAll(ut));if(f.length===0)return false;let{from:d,anchor:s}=b.state.selection;if(r.current===null){let p=m(d);if(p===null)return false;r.current=p;}let l;if(a.current>=0&&a.current<f.length)l=a.current;else {let p=t(d);if(!p||(l=f.indexOf(p),l===-1))return false}let n=i.key==="ArrowUp"?l-1:l+1;if(n<0||n>=f.length)return a.current=-1,false;let e=f[n],u=S(e,r.current);if(u===null)return false;a.current=n;let{state:c,dispatch:y}=b,E=Math.max(0,Math.min(u,c.doc.content.size));try{let p=i.shiftKey?TextSelection.create(c.doc,s,E):TextSelection.create(c.doc,E);y(c.tr.setSelection(p));}catch{let p=c.doc.resolve(E),L=i.shiftKey?TextSelection.between(c.doc.resolve(s),p):TextSelection.near(p);y(c.tr.setSelection(L));}return dt(e),true},[o,m,t,S]);return {stickyXRef:r,lastVisualLineIndexRef:a,getCaretClientX:m,findLineElementAtPosition:t,findPositionOnLineAtClientX:S,handlePMKeyDown:x}}var R=40,B=12;function Ut({pagesContainerRef:o,onScrollExtendSelection:r}){let a=useRef(null),m=useRef({x:0,y:0}),t=useRef(false),S=useRef(null),x=useCallback(()=>{if(S.current)return S.current;let s=o.current;return s?(S.current=N(s),S.current):null},[o]),b=useCallback(()=>{t.current=false,a.current!==null&&(cancelAnimationFrame(a.current),a.current=null);},[]),i=useCallback(()=>{if(!t.current)return;let s=x();if(!s)return;let l=s.getBoundingClientRect(),{x:n,y:e}=m.current,u=0;if(e<l.top+R){let c=Math.max(0,l.top+R-e);u=-Math.min(B,c/R*B);}else if(e>l.bottom-R){let c=Math.max(0,e-(l.bottom-R));u=Math.min(B,c/R*B);}u!==0&&(s.scrollTop+=u,r(n,e)),a.current=requestAnimationFrame(i);},[x,r]),f=useCallback(()=>{t.current||(t.current=true,a.current=requestAnimationFrame(i));},[i]);return {updateMousePosition:useCallback((s,l)=>{if(m.current={x:s,y:l},!t.current){let n=x();if(!n)return;let e=n.getBoundingClientRect();(l<e.top+R||l>e.bottom-R)&&f();}},[x,f]),stopAutoScroll:b}}export{gt as a,at as b,Et as c,wt as d,rt as e,Ct as f,Mt as g,Ut as h};
|