@docx-editor.dev/core 2.4.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automation.cjs +1 -1
- package/dist/automation.d.cts +6 -6
- package/dist/automation.d.ts +6 -6
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.cts +12 -12
- package/dist/binding.d.ts +12 -12
- package/dist/binding.js +1 -1
- package/dist/chunk-2GSRLGUI.cjs +10 -0
- package/dist/chunk-2QIA75K3.js +2 -0
- package/dist/chunk-32NXPFYL.js +5 -0
- package/dist/chunk-3C533HSQ.cjs +18 -0
- package/dist/{chunk-YMIMLEX4.cjs → chunk-3FRSOOND.cjs} +1 -1
- package/dist/chunk-45FL7KH4.js +1 -0
- package/dist/chunk-7GYF33B5.cjs +2 -0
- package/dist/chunk-H3DZP4LE.cjs +5 -0
- package/dist/chunk-IJ4V3LGV.cjs +2 -0
- package/dist/chunk-JDHTCMFA.cjs +2 -0
- package/dist/chunk-L2GMLEHX.cjs +14 -0
- package/dist/chunk-LJIX4ZDF.js +10 -0
- package/dist/chunk-QUZM6LWQ.js +14 -0
- package/dist/chunk-T252F4US.js +18 -0
- package/dist/chunk-UVIUNAQ6.js +2 -0
- package/dist/chunk-YTZIGUXT.js +2 -0
- package/dist/{content-control-walk-CbTqHq6O.d.cts → content-control-walk-BeAFh6Xi.d.cts} +1 -1
- package/dist/{content-control-walk-D06GijR0.d.ts → content-control-walk-CQp8l6eS.d.ts} +1 -1
- package/dist/contracts/editor.d.cts +9 -9
- package/dist/contracts/editor.d.ts +9 -9
- package/dist/contracts/interaction.d.cts +9 -9
- package/dist/contracts/interaction.d.ts +9 -9
- package/dist/contracts/modules.d.cts +5 -5
- package/dist/contracts/modules.d.ts +5 -5
- package/dist/{custom-node-writes-BkMgMXxs.d.ts → custom-node-writes-2clI36T9.d.ts} +22 -7
- package/dist/{custom-node-writes-C5YRoPcc.d.cts → custom-node-writes-CIC_-wad.d.cts} +22 -7
- package/dist/{editor-DYvC9CZs.d.cts → editor-CUul9IuY.d.cts} +22 -5
- package/dist/{editor-D1qHfzOt.d.ts → editor-DIwctMcU.d.ts} +22 -5
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +32 -0
- package/dist/editor.d.cts +24 -24
- package/dist/editor.d.ts +24 -24
- package/dist/editor.js +1 -1
- package/dist/{hf-references-CgEOSw3i.d.cts → hf-references-BPET4tlK.d.cts} +2 -2
- package/dist/{hf-references-BdjsQNE_.d.ts → hf-references-CAp1xTv6.d.ts} +2 -2
- package/dist/{image-resources-DXvPZvXD.d.cts → image-resources-CSlQmPIm.d.cts} +10 -10
- package/dist/{image-resources-BG9DLyW7.d.ts → image-resources-e13t-pgy.d.ts} +10 -10
- package/dist/{index-Bb-QAg_f.d.cts → index-8t44iXTY.d.cts} +79 -14
- package/dist/{index-DpY3WZuP.d.ts → index-BUsYjxF5.d.ts} +79 -14
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +18 -18
- package/dist/index.d.ts +18 -18
- package/dist/index.js +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.cts +114 -50
- package/dist/layout.d.ts +114 -50
- package/dist/layout.js +1 -1
- package/dist/{note-nodes-C6DLxlvj.d.cts → note-nodes-B2wWES2L.d.cts} +1 -1
- package/dist/{note-nodes-BPSTVDMr.d.ts → note-nodes-CZQXU6Fg.d.ts} +1 -1
- package/dist/{review-reads-CQmU9Lcl.d.ts → note-properties-BS66XmcC.d.ts} +91 -67
- package/dist/{review-reads-CxgN62yp.d.cts → note-properties-Dhqkro--.d.cts} +91 -67
- package/dist/{ooxml-package-D_CtywTW.d.ts → ooxml-package-BrxTmTsZ.d.ts} +115 -115
- package/dist/{ooxml-package-CR5us6ad.d.cts → ooxml-package-Cmbe_M04.d.cts} +115 -115
- package/dist/{ooxml-tree-BU0e3DVi.d.cts → ooxml-tree-CG0odFyi.d.cts} +1 -1
- package/dist/{ooxml-tree-BU0e3DVi.d.ts → ooxml-tree-CG0odFyi.d.ts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.cts +7 -7
- package/dist/output.d.ts +7 -7
- package/dist/output.js +1 -1
- package/dist/{protocol-CD7slqvl.d.cts → protocol-B5oSt08P.d.cts} +2 -2
- package/dist/{protocol-DsbfgBwA.d.ts → protocol-ooK7PAXz.d.ts} +2 -2
- package/dist/{review-support-DgXTIYBW.d.ts → review-support-Bl9sN8cv.d.ts} +47 -3
- package/dist/{review-support-BJ-YjGmD.d.cts → review-support-CHuJxHmz.d.cts} +47 -3
- package/dist/{revision-projection-DHAkcD_L.d.ts → revision-projection-DRZMzoLD.d.cts} +54 -3
- package/dist/{revision-projection-72ZApe-g.d.cts → revision-projection-u4nT52xT.d.ts} +54 -3
- package/dist/{semantic-cell-selection-DZtyMXkH.d.ts → semantic-cell-selection-CdNQ-a9-.d.cts} +8 -5
- package/dist/{semantic-cell-selection--ezfezTe.d.cts → semantic-cell-selection-Dc-_enhm.d.ts} +8 -5
- package/dist/{semantic-interaction-DrgbgKg6.d.ts → semantic-interaction-CCVwyw2A.d.ts} +2 -30
- package/dist/{semantic-interaction-2yxdv7q0.d.cts → semantic-interaction-DgaWs-5w.d.cts} +2 -30
- package/dist/{semantic-paint-BYjE0Xbl.d.cts → semantic-paint-6iIB4fhx.d.cts} +2 -2
- package/dist/{semantic-paint-BedBxkyY.d.ts → semantic-paint-CKIbFkQ7.d.ts} +2 -2
- package/dist/{semantic-records-CR5hTqMK.d.ts → semantic-records-B-qbrnp2.d.ts} +107 -9
- package/dist/{semantic-records-DSD8WENa.d.cts → semantic-records-Dq8SlCY8.d.cts} +107 -9
- package/dist/{shaped-measurer-BL8g4AcW.d.ts → shaped-measurer-BT4FqYe9.d.ts} +1 -1
- package/dist/{shaped-measurer-CBOTJTV_.d.cts → shaped-measurer-Dx4llNhK.d.cts} +1 -1
- package/dist/store.cjs +1 -1
- package/dist/store.d.cts +254 -231
- package/dist/store.d.ts +254 -231
- package/dist/store.js +1 -1
- package/dist/{tree-op-types-8a6xyRCN.d.ts → tree-op-types-CZw9QhWX.d.ts} +219 -219
- package/dist/{tree-op-types-EZXbR8bW.d.cts → tree-op-types-DOYNkKqD.d.cts} +219 -219
- package/dist/{tree-session-SucW0znF.d.ts → tree-session-CF_EOhTW.d.ts} +14 -8
- package/dist/{tree-session-DrMm8Cj2.d.cts → tree-session-CtK3KgFU.d.cts} +14 -8
- package/dist/{tree-store-BoM6eXaL.d.ts → tree-store-9TaX-L0V.d.ts} +31 -4
- package/dist/{tree-store-UYrGKF_Q.d.cts → tree-store-Jg-q7fyf.d.cts} +31 -4
- package/package.json +3 -3
- package/dist/chunk-33F6TRXO.js +0 -2
- package/dist/chunk-4WWEDTTE.js +0 -2
- package/dist/chunk-BS554B6D.cjs +0 -2
- package/dist/chunk-DQ5HGUWG.cjs +0 -12
- package/dist/chunk-EQO762XH.cjs +0 -10
- package/dist/chunk-F6WNPYOM.js +0 -2
- package/dist/chunk-FL4GWK76.js +0 -12
- package/dist/chunk-GWG5IVVX.cjs +0 -5
- package/dist/chunk-IZIL6BAW.cjs +0 -12
- package/dist/chunk-LIJPSHRA.js +0 -5
- package/dist/chunk-MHDO6HLI.cjs +0 -2
- package/dist/chunk-SG7OH2EK.js +0 -12
- package/dist/chunk-TCX3PVWR.js +0 -10
- package/dist/chunk-YTYKNA6X.cjs +0 -2
- package/dist/chunk-ZACHY6OS.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {re as re$1,Fa,Yd,nd,qd,od,xd,Ub,Tb,Vf,Uf,Sd,ve,pe,te as te$1,Lf,Mf,Of,Nf,Vc,Ua,Xc,Sa,Od,Qd,gg,eg,jg,fg,kg,Pd,Bg,Cg,Lc,Kc,Ee,Ad,of,Ge,Gf,pg,ma,Ga,Sf,Tf,Ke,Le,Je,qg,ng,X,Fe,Oc,Ra,Ff}from'./chunk-LJIX4ZDF.js';var Ht=Object.freeze(["default","first","even"]),ct=Object.freeze({kind:"body"});function B(n){switch(n.kind){case "body":return "body";case "note":return `note:${n.noteKind}:${String(n.noteId)}`;default:return `${n.kind}:${String(n.sectionIndex)}:${n.variant}`}}function tn(n){if(typeof n!="object"||n===null)return false;let e=n;return e.kind==="body"?true:e.kind==="note"?(e.noteKind==="footnote"||e.noteKind==="endnote")&&Number.isInteger(e.noteId):e.kind!=="header"&&e.kind!=="footer"?false:Number.isInteger(e.sectionIndex)&&e.sectionIndex>=0&&Ht.includes(e.variant)}var rr=["getDocument","getBody","getParagraphs","getSpanParagraphs","getText","getSpanText","getParagraphId","search","getFont","getParagraphFormat","getStyle","getSections","getPageSetup","getFurniture","getNotes","getNoteBody","getNoteText","getNoteKind","getLists","getListId","getListById","getListParagraphs","getParagraphList","getListLevel","getHyperlink","getBookmarks","getBookmarkName","getBookmarkRange","getComments","getCommentReplies","getCommentId","getCommentAuthor","getCommentDate","getCommentText","getCommentRange","getCommentResolved","getRevisions","getRevisionType","getRevisionAuthor","getRevisionDate","getRevisionRange","getContentControls","getContentControlById","getContentControlsByTag","getContentControlsByTitle","getContentControlTag","getContentControlTitle","getContentControlFileId","getContentControlSubtype","getContentControlLock","getContentControlIsBound","getContentControlPlaceholderShown","getContentControlTemporary","getContentControlText","getContentControlParagraphs","getContentControlRange"],qn=["insertText","replaceSpan","insertParagraph","splitParagraph","deleteParagraph","selectSpan","selectBookmark","setFont","setParagraphFormat","setStyle","setPageSetup","deleteNote","setListLevel","insertListParagraph","setHyperlink","insertComment","setCommentResolved","replyToComment","deleteComment","acceptRevision","rejectRevision","acceptAllRevisions","rejectAllRevisions","setContentControlValue","setContentControlProperties","deleteContentControl","insertContentControlText","insertContentControl","insertCustomNode"],to=["deleteNote","insertComment","setCommentResolved","replyToComment","insertCustomNode"],eo=new Set(to);function Yt(n){return eo.has(n.op)}var no=new Set(qn);function Gt(n){return no.has(n.op)}function oo(){let n=globalThis.crypto,e=n?.getRandomValues;if(typeof e!="function")throw new Error("automation: no secure random source. globalThis.crypto.getRandomValues is required to scope document handles to one host.");let s=e.call(n,new Uint8Array(16)),a="";for(let l of s)a+=l.toString(16).padStart(2,"0");return a}function ro(n){return typeof n=="object"&&n!==null&&"kind"in n&&"ref"in n}function en(){let n=new Map,e=new Map,s=new Map,a=new Map,l=oo(),u=null,f=(m,y)=>{let v=(a.get(m)??0)+1;a.set(m,v);let g=`${m}:${l}:${String(v)}`;return n.set(g,y),Object.freeze({kind:m,ref:g})},k=(m,y,v)=>{let g=`${m}\0${y}`,I=s.get(g);if(I)return Object.freeze({kind:m,ref:I});let C=f(m,v);return s.set(g,C.ref),C};return {document(){return u??=f("document",{kind:"document"}),u},body(m){return k("body",B(m),{kind:"body",story:m})},paragraph(m,y){let v=e.get(m);if(v)return Object.freeze({kind:"paragraph",ref:v});let g=f("paragraph",{kind:"paragraph",paragraphId:m,story:y});return e.set(m,g.ref),g},section(m){return k("section",String(m),{kind:"section",index:m})},note(m,y){return k("note",`${m}:${String(y)}`,{kind:"note",noteKind:m,noteId:y})},comment(m,y){return k("comment",`${B(y)}\0${m}`,{kind:"comment",commentId:m,story:y})},revision(m,y){return k("revision",`${B(y)}\0${m}`,{kind:"revision",revisionId:m,story:y})},bookmark(m,y){return k("bookmark",`${B(y)}\0${m}`,{kind:"bookmark",name:m,story:y})},list(m,y){return k("list",`${B(y)}\0${m}`,{kind:"list",numId:m,story:y})},contentControl(m,y){return k("contentControl",`${B(y)}\0${m}`,{kind:"contentControl",nodeId:m,story:y})},retarget(m,y){let v=e.get(m);if(!v||m===y)return;let g=n.get(v);!g||g.kind!=="paragraph"||(e.delete(m),n.set(v,{kind:"paragraph",paragraphId:y,story:g.story}),e.has(y)||e.set(y,v));},resolve(m,y){if(!ro(m)||m.kind!==y||typeof m.ref!="string")return null;let v=n.get(m.ref);return !v||v.kind!==y?null:v}}}var ao=255,so=Object.freeze({nameOf:()=>null,idOf:()=>null,defaultId:null,present:false});function nn(n){let e=Lc(n);if(!e)return so;let s=new Map,a=new Map,l=null;for(let u of Kc(e).values())if(u.type==="paragraph"){if(s.set(u.styleId,u.name),u.name!==null){let f=u.name.trim().toLowerCase();a.has(f)||a.set(f,u.styleId);}u.isDefault&&l===null&&(l=u.styleId);}return Object.freeze({nameOf:u=>s.get(u)??null,idOf:u=>a.get(u.trim().toLowerCase())??null,defaultId:l,present:true})}function Lt(n,e,s){let a=Fa(n,e);if(!a||a.kind!=="paragraph")return null;let l=io(Qd(Od(a),"pStyle"));return l!==null?s.nameOf(l):s.defaultId===null?null:s.nameOf(s.defaultId)}function io(n){if(!n)return null;for(let e of n.attributes)if(e.localName==="val")return e.value;return null}function Et(n,e){if(typeof n!="string"||n.trim().length===0)return {ok:false,detail:"style: not a name"};if(n.length>ao)return {ok:false,detail:"style: name too long"};if(!X(n))return {ok:false,detail:"style: not valid XML text"};if(!e.present)return {ok:false,detail:"style: this document defines no styles"};let s=e.idOf(n);return s===null?{ok:false,detail:"style: this document defines no paragraph style with that name"}:{ok:true,styleId:s}}var rn=20,lo=31680,uo=1999,co=Object.freeze({bold:null,italic:null,name:null,size:null,color:null});function G(n,e){if(!n)return null;for(let s of n.attributes)if(s.localName===e)return s.value;return null}function Jt(n){if(!n)return null;let e=G(n,"val");if(e===null)return true;let s=e.trim().toLowerCase();return !(s==="0"||s==="false"||s==="off"||s==="none")}function po(n){if(n===null)return null;let e=n.trim();return /^[0-9a-fA-F]{6}$/.test(e)?`#${e.toUpperCase()}`:null}function mo(n){if(n===null)return null;let e=Number(n.trim());return !Number.isFinite(e)||e<=0?null:e/2}function mt(n){if(n===null)return null;let e=Number(n.trim());return Number.isFinite(e)?e/rn:null}function Rt(n){if(n.length===0)return null;let e=n[0];if(e===null)return null;for(let s of n)if(s!==e)return null;return e}function an(n,e){let s=[];for(let a of e)for(let l of kg(n,a.paragraphId,a.start,a.end))s.push(Pd(l));return s.length===0?co:{bold:Rt(s.map(a=>Jt(Qd(a,"b")))),italic:Rt(s.map(a=>Jt(Qd(a,"i")))),name:Rt(s.map(a=>{let l=Qd(a,"rFonts"),u=G(l,"ascii");return u===null||u.length===0?null:u})),size:Rt(s.map(a=>mo(G(Qd(a,"sz"),"val")))),color:Rt(s.map(a=>po(G(Qd(a,"color"),"val"))))}}var fo=Object.freeze({left:"Left",start:"Left",center:"Centered",right:"Right",end:"Right",both:"Justified",distribute:"Justified"}),yo=Object.freeze({Left:"left",Centered:"center",Right:"right",Justified:"both"});function go(n){let e=G(Qd(n,"jc"),"val");return e===null?"Unknown":fo[e.trim().toLowerCase()]??"Unknown"}function sn(n,e,s){let a=Fa(n,e);if(!a||a.kind!=="paragraph")return null;let l=Od(a),u=Qd(l,"spacing"),f=Qd(l,"ind");return {alignment:go(l),style:Lt(n,e,s),firstLineIndent:ho(f),leftIndent:mt(G(f,"left")??G(f,"start")),rightIndent:mt(G(f,"right")??G(f,"end")),lineSpacing:mt(G(u,"line")),spaceBefore:mt(G(u,"before")),spaceAfter:mt(G(u,"after")),widowControl:Jt(Qd(l,"widowControl"))}}function ho(n){let e=mt(G(n,"firstLine"));if(e!==null)return e;let s=mt(G(n,"hanging"));return s===null?null:-s}function Mt(n,e){if(typeof n!="number"||!Number.isFinite(n))return {ok:false,detail:`${e}: not a measurement`};let s=Math.round(n*rn);return Math.abs(s)>lo?{ok:false,detail:`${e}: out of range`}:{ok:true,value:s}}function dn(n){let e=[];if(n.bold!==void 0){if(typeof n.bold!="boolean")return {ok:false,detail:"bold: not a boolean"};e.push({localName:"b",...n.bold?{}:{attributes:{val:"0"}}});}if(n.italic!==void 0){if(typeof n.italic!="boolean")return {ok:false,detail:"italic: not a boolean"};e.push({localName:"i",...n.italic?{}:{attributes:{val:"0"}}});}if(n.name!==void 0){let s=n.name;if(typeof s!="string"||s.length===0||s.length>128)return {ok:false,detail:"name: not a font name"};if(!X(s))return {ok:false,detail:"name: not valid XML text"};e.push({localName:"rFonts",attributes:{ascii:s,hAnsi:s,cs:s}});}if(n.size!==void 0){let s=n.size;if(typeof s!="number"||!Number.isFinite(s)||s<=0)return {ok:false,detail:"size: not a positive number of points"};let a=Math.round(s*2);if(a<1||a>uo)return {ok:false,detail:"size: out of range"};e.push({localName:"sz",attributes:{val:String(a)}}),e.push({localName:"szCs",attributes:{val:String(a)}});}if(n.color!==void 0){let s=n.color;if(typeof s!="string"||!/^#[0-9a-fA-F]{6}$/.test(s.trim()))return {ok:false,detail:"color: not a #RRGGBB triplet"};e.push({localName:"color",attributes:{val:s.trim().slice(1).toUpperCase()}});}return e.length===0?{ok:false,detail:"no formatting was asked for"}:{ok:true,value:e}}function ln(n,e,s,a){let l=Fa(n,e);if(!l||l.kind!=="paragraph")return {ok:false,detail:"not a paragraph"};let u=Od(l),f=[];if(s.style!==void 0){let C=Et(s.style,a);if(!C.ok)return {ok:false,detail:C.detail};f.push({localName:"pStyle",attributes:{val:C.styleId}});}if(s.alignment!==void 0){let C=yo[s.alignment];if(C===void 0)return {ok:false,detail:`alignment: ${String(s.alignment)}`};f.push({localName:"jc",attributes:{val:C}});}let k=Qd(u,"ind"),m=on(k),y=false;if(s.firstLineIndent!==void 0){let C=Mt(s.firstLineIndent,"firstLineIndent");if(!C.ok)return C;delete m.firstLine,delete m.hanging,C.value<0?m.hanging=String(-C.value):m.firstLine=String(C.value),y=true;}for(let[C,R,N]of [["leftIndent","left","start"],["rightIndent","right","end"]]){let P=s[C];if(P===void 0)continue;let L=Mt(P,C);if(!L.ok)return L;delete m[N],m[R]=String(L.value),y=true;}y&&f.push({localName:"ind",attributes:m});let v=Qd(u,"spacing"),g=on(v),I=false;for(let[C,R]of [["spaceBefore","before"],["spaceAfter","after"]]){let N=s[C];if(N===void 0)continue;let P=Mt(N,C);if(!P.ok)return P;if(P.value<0)return {ok:false,detail:`${C}: out of range`};g[R]=String(P.value),I=true;}if(s.lineSpacing!==void 0){let C=Mt(s.lineSpacing,"lineSpacing");if(!C.ok)return C;if(C.value<=0)return {ok:false,detail:"lineSpacing: out of range"};g.line=String(C.value),g.lineRule??="auto",I=true;}if(I&&f.push({localName:"spacing",attributes:g}),s.widowControl!==void 0){if(typeof s.widowControl!="boolean")return {ok:false,detail:"widowControl: not a boolean"};f.push({localName:"widowControl",...s.widowControl?{}:{attributes:{val:"0"}}});}return f.length===0?{ok:false,detail:"no formatting was asked for"}:{ok:true,value:gg(eg(n,e),f)}}function on(n){let e=Object.create(null);if(!n)return e;for(let s of n.attributes)e[s.localName]=s.value;return e}function un(){let n=false,e=false,s=false;return {conflict(a){let l=Gt(a),u=Yt(a),f=a.op==="deleteComment";return u&&n||e&&l?{message:"that command commits on its own and cannot share a batch",detail:a.op}:f&&n&&!s||s&&l&&!f?{message:"comment deletions may share a batch only with other comment deletions",detail:a.op}:null},note(a){Gt(a)&&(n=true,Yt(a)&&(e=true),a.op==="deleteComment"&&(s=true));},get hasCommands(){return n}}}var cn=20,ko=63360;function lt(n){return Math.round(n/cn*100)/100}function Ao(n,e){if(typeof n!="number"||!Number.isFinite(n))return null;let s=Math.round(n*cn);return s>ko||s<0||s===0&&!e?null:s}var vo=[["pageWidth","pageWidthTwips",false],["pageHeight","pageHeightTwips",false],["topMargin","marginTopTwips",true],["rightMargin","marginRightTwips",true],["bottomMargin","marginBottomTwips",true],["leftMargin","marginLeftTwips",true]];function pn(n){if(typeof n!="object"||n===null)return {ok:false,reason:"that is not a page setup",detail:"not-an-object"};let e=n,s={},a=0;for(let[u,f,k]of vo){let m=e[u];if(m===void 0)continue;let y=Ao(m,k);if(y===null)return {ok:false,reason:`that is not a value for ${u}`,detail:String(m)};s[f]=y,a+=1;}let l=e.orientation;if(l!==void 0){if(l!=="portrait"&&l!=="landscape")return {ok:false,reason:"that is not an orientation",detail:String(l)};s.orientation=l,a+=1;}return a===0?{ok:false,reason:"that page setup names nothing to write",detail:"empty"}:{ok:true,value:s}}function bo(n){let e=of(n),s=e.widthTwips>e.heightTwips?"landscape":"portrait";return Object.freeze({pageWidth:lt(e.widthTwips),pageHeight:lt(e.heightTwips),orientation:s,topMargin:lt(e.topTwips),rightMargin:lt(e.rightTwips),bottomMargin:lt(e.bottomTwips),leftMargin:lt(e.leftTwips),headerDistance:lt(e.headerTwips),footerDistance:lt(e.footerTwips),gutter:lt(e.gutterTwips)})}function Io(n,e){if(!e)return null;let s=null,a=(l,u,f)=>{if(s!==null||l.kind==="textValue"||f>64)return;let k=l.kind==="paragraph"?l.id:u;if(l.id===e.id){s=k;return}for(let m of l.children)a(m,k,f+1);};return a(n.root,null,0),s}function mn(n,e,s){let a=Tb(e.root);return Object.freeze(a.map((l,u)=>{let f=s[u];return Object.freeze({index:u,markParagraphId:Io(e,l),pageSetup:bo(l),titlePage:f?.titlePage??false,evenAndOddHeaders:f?.evenAndOddHeaders??false})}))}var Zt="\r",xo=Object.freeze({nameOf:()=>null,idOf:()=>null,defaultId:null,present:false}),So=Object.freeze([]),Ro=Object.freeze([]),fn=Object.freeze([]),Co=Object.freeze({package:null,body:null,story:()=>null,storyOf:()=>null,sections:()=>Ro,furniture:()=>fn,noteIds:()=>({ok:true,ids:gn}),styles:()=>xo});function Oo(n){return n.kind==="textValue"?So:Object.freeze(n.children.filter(e=>e.kind!=="textValue").map(e=>{let s=[];Ge([e],s,0);let a=e.kind==="paragraph"?"paragraph":e.kind==="table"?"table":"other",l=e.kind==="paragraph"&&Qd(Od(e),"sectPr")!==void 0;return Object.freeze({id:e.id,kind:a,paragraphIds:Object.freeze(s.map(u=>u.id)),removable:a!=="other"&&!l})}))}function Qt(n,e,s,a,l){let u=Fe(a),f=Object.freeze(u.map(g=>g.id)),k=new Map,m=new Map;u.forEach((g,I)=>{k.set(g.id,I),m.set(g.id,g);});let y=new Map,v=g=>{if(!k.has(g))return null;let I=y.get(g);if(I!==void 0)return I;let C=Ff(e,g)??"";return y.set(g,C),C};return {story:n,part:e,root:a,scope:s,paragraphIds:f,blocks:Oo(a),has:g=>k.has(g),indexOf:g=>k.get(g)??-1,paragraph(g){let I=m.get(g);return I?{nodeId:g,paraId:Oc(I),text:v(g)??""}:null},node:g=>m.get(g)??null,paragraphText:v,text:()=>f.map(g=>v(g)??"").join(Zt),styles:l}}function yn(n){let e=n.parts.get(n.mainDocumentPart);if(!e)return Co;let s,a=()=>s??=nn(n),l,u=()=>l??=Ub(n),f,k=new Map,m=new Map,y=R=>{let N=m.get(R);if(N)return N;let P=Yd(n,R);if(!P){let X={ok:true,ids:gn};return m.set(R,X),X}let L=[],M=new Set,j=new Set,Z=0,U=false;for(let X of P.root.children){if(nd(X)!==R)continue;if(Z+=1,X.kind!=="note"){U=true;continue}if(!qd(X))continue;let et=od(X);if(et===null){U=true;continue}M.has(et)?j.add(et):(M.add(et),L.push(et));}let E=Z>xd?{ok:false,reason:"truncated"}:U?{ok:false,reason:"malformed"}:j.size>0?{ok:false,reason:"duplicates",duplicateIds:Object.freeze([...j])}:{ok:true,ids:Object.freeze(L)};return m.set(R,E),E},v=R=>{let N=u()[R.sectionIndex];return N?(R.kind==="header"?N.headers:N.footers).get(R.variant)??null:null},g=R=>{if(R.kind==="body"){let P=Ee(e);return P?Qt(R,e,{kind:"body"},P,a):null}if(R.kind==="note"){let P=y(R.noteKind);if(!P.ok||!P.ids.includes(R.noteId))return null;let L=Yd(n,R.noteKind);if(!L)return null;let M=Ad(L.root,R.noteId);return !M||!qd(M)?null:Qt(R,L,{kind:"notesPart",noteKind:R.noteKind},M,a)}let N=v(R);return N?Qt(R,N.part,{kind:"headerFooter",rId:N.rId},N.part.root,a):null},I=R=>{let N=B(R);if(k.has(N))return k.get(N)??null;let P=g(R);return k.set(N,P),P};return {package:n,get body(){return I(ct)},story:I,storyOf:R=>{if(I(ct)?.has(R))return ct;for(let[P]of u().entries())for(let L of ["header","footer"])for(let M of Ht){let j={kind:L,sectionIndex:P,variant:M};if(I(j)?.has(R))return j}for(let P of ["footnote","endnote"]){let L=y(P);if(L.ok)for(let M of L.ids){let j={kind:"note",noteKind:P,noteId:M};if(I(j)?.has(R))return j}}return null},sections:()=>f??=mn(n,e,u()),furniture(R){let N=u()[R];if(!N)return fn;let P=[];for(let L of ["header","footer"]){let M=L==="header"?N.headers:N.footers;for(let j of Ht){let Z=M.get(j);Z&&P.push(Object.freeze({kind:L,variant:j,declared:!Z.inherited}));}}return Object.freeze(P)},noteIds:y,styles:a}}var gn=Object.freeze([]);function ot(n,e){return {ok:false,code:n,detail:e}}function rt(n){return {ok:true,value:n}}function K(n,e,s,a){let l=s.resolve(n,e);if(!l||l.kind!=="body"&&l.kind!=="paragraph")return ot("invalid-handle",`not-a-${e}-handle`);let u=a.story(l.story);return u?rt(u):ot("invalid-handle",`no-such-story:${B(l.story)}`)}function Q(n,e,s){let a=e.resolve(n,"paragraph");if(!a||a.kind!=="paragraph")return ot("invalid-handle","not-a-paragraph-handle");let l=s.story(a.story);if(!l)return ot("invalid-handle",`no-such-story:${B(a.story)}`);let u=l.indexOf(a.paragraphId);return u<0?ot("invalid-handle","paragraph-not-in-body"):rt({story:a.story,paragraphId:a.paragraphId,index:u,offset:0})}function Po(n,e,s){let a=Q(n.paragraph,e,s);if(!a.ok)return a;let u=(s.story(a.value.story)?.paragraphText(a.value.paragraphId)??"").length,{offset:f}=n;return !Number.isInteger(f)||f<0||f>u?ot("invalid-offset",`offset ${String(f)} outside 0..${String(u)}`):rt({...a.value,offset:f})}function gt(n,e,s){if("paragraph"in n){if(!("at"in n))return Po(n,e,s);let k=Q(n.paragraph,e,s);if(!k.ok||n.at==="start")return k;let y=(s.story(k.value.story)?.paragraphText(k.value.paragraphId)??"").length;return rt({...k.value,offset:y})}let a=K(n.body,"body",e,s);if(!a.ok)return a;let l=a.value.paragraphIds;if(l.length===0)return ot("invalid-offset","empty-story");if(n.at==="start")return rt({story:a.value.story,paragraphId:l[0],index:0,offset:0});let u=l.length-1,f=l[u];return rt({story:a.value.story,paragraphId:f,index:u,offset:(a.value.paragraphText(f)??"").length})}function wo(n,e){return n.index<e.index||n.index===e.index&&n.offset<=e.offset}function To(n){let e=n.paragraphIds;if(e.length===0)return null;let s=e.length-1,a=e[s];return {start:{story:n.story,paragraphId:e[0],index:0,offset:0},end:{story:n.story,paragraphId:a,index:s,offset:(n.paragraphText(a)??"").length}}}function W(n,e,s){if("body"in n){let u=K(n.body,"body",e,s);return u.ok?rt(To(u.value)):u}if("paragraph"in n){let u=Q(n.paragraph,e,s);if(!u.ok)return u;let k=(s.story(u.value.story)?.paragraphText(u.value.paragraphId)??"").length;return rt({start:u.value,end:{...u.value,offset:k}})}let a=gt(n.start,e,s);if(!a.ok)return a;let l=gt(n.end,e,s);return l.ok?B(a.value.story)!==B(l.value.story)?ot("invalid-handle","span-crosses-stories"):wo(a.value,l.value)?rt({start:a.value,end:l.value}):ot("invalid-offset","span-start-after-end"):l}function q(n,e,s){if("body"in n)return K(n.body,"body",e,s);if("paragraph"in n)return K(n.paragraph,"paragraph",e,s);let a=n.start;return "paragraph"in a?K(a.paragraph,"paragraph",e,s):K(a.body,"body",e,s)}function _t(n,e,s){if("paragraph"in n)return Q(n.paragraph,e,s);let a=K(n.body,"body",e,s);if(!a.ok)return a;let l=a.value.paragraphIds;if(l.length===0)return ot("invalid-offset","empty-story");let u=n.at==="first"?0:l.length-1;return rt({story:a.value.story,paragraphId:l[u],index:u,offset:0})}function at(n,e){return n?e.paragraphIds.slice(n.start.index,n.end.index+1):[]}function qt(n,e){if(!n)return [];let s=at(n,e),a=s.length-1;return s.map((l,u)=>{let f=(e.paragraphText(l)??"").length,k=u===0?n.start.offset:0,m=u===a?n.end.offset:f;return {paragraphId:l,start:k,end:m,whole:k===0&&m===f}})}function hn(n,e,s){if(!n)return "";let a=at(n,e);return a.length===1?(e.paragraphText(n.start.paragraphId)??"").slice(n.start.offset,n.end.offset):a.map((l,u)=>{let f=e.paragraphText(l)??"";return u===0?f.slice(n.start.offset):u===a.length-1?f.slice(0,n.end.offset):f}).join(s)}function te(n,e){return {start:{paragraph:e.paragraph(n.start.paragraphId,n.start.story),offset:n.start.offset},end:{paragraph:e.paragraph(n.end.paragraphId,n.end.story),offset:n.end.offset}}}var No=256,kn=1e4;function ee(n,e){if(n.kind!=="textValue"){for(let s of n.attributes)if(s.namespaceUri===ma&&s.localName===e)return s.value}}function Ho(n){return n.startsWith("_")}function ne(n){let e=new Map,s=[],a=new Set;for(let l of n.paragraphIds){let u=n.node(l);if(u?.kind!=="paragraph")continue;let f=Sd(u),k=m=>{if(m.kind!=="textValue"){if(m.kind==="bookmarkStart"){if(s.length>=kn||e.size>=kn)return;let y=ee(m,"id"),v=ee(m,"name");if(y===void 0||v===void 0||v.length===0||v.length>No||Ho(v)||a.has(v)||e.has(y))return;let g=f.spanOf(m)?.start??0;e.set(y,{name:v,start:{paragraphId:l,offset:g}});return}if(m.kind==="bookmarkEnd"){let y=ee(m,"id");if(y===void 0)return;let v=e.get(y);if(!v)return;e.delete(y),a.add(v.name);let g=f.spanOf(m)?.start??0;s.push(Object.freeze({name:v.name,start:v.start,end:{paragraphId:l,offset:g}}));return}for(let y of m.children)k(y);}};for(let m of u.children)k(m);}return Object.freeze(s)}function oe(n,e){return ne(n).find(s=>s.name===e)??null}function An(n,e){let s=n.node(e);if(s?.kind!=="paragraph")return Object.freeze([]);let a=Sd(s),l=[],u=(f,k)=>{if(!(f.kind==="textValue"||k>32)){if(Ra(f)){let m=a.spanOf(f);m&&l.push(Object.freeze({id:f.id,paragraphId:e,start:m.start,end:m.end}));return}for(let m of f.children)u(m,k+1);}};for(let f of s.children)u(f,0);return Object.freeze(l)}function vn(n,e,s){let a=Ua(s,l=>Xc(n,e,l));if(a.kind==="external")return a.href;if(a.kind==="internal"){let l=Sa(s);return l===void 0||l.length===0?null:`#${l}`}return null}var ht=8;function bn(n){if(!n||n.kind==="textValue")return null;for(let e of n.attributes)if(e.namespaceUri===ma&&e.localName==="val")return e.value;return null}function In(n){let e=Qd(Od(n),"numPr");if(!e)return null;let s=bn(Qd(e,"numId"));if(s===null||!/^\d{1,10}$/.test(s)||s==="0")return null;let a=bn(Qd(e,"ilvl")),l=a===null?0:Number(a);return !Number.isInteger(l)||l<0||l>ht?null:{numId:s,level:l}}function Bt(n){let e=new Map;for(let s of n.paragraphIds){let a=n.node(s);if(!a)continue;let l=In(a);if(!l)continue;let u=e.get(l.numId);u?u.push(s):e.set(l.numId,[s]);}return Object.freeze([...e].map(([s,a])=>Object.freeze({numId:s,paragraphIds:Object.freeze(a)})))}function Ct(n,e){let s=n.node(e);return s?In(s):null}var Lo={insert:"Insert",delete:"Delete",replace:"Replace",moveFrom:"MovedFrom",moveTo:"MovedTo",format:"Property",paragraphMark:"ParagraphProperty"};function Eo(n){return n.kind==="note"}function Mo(n,e){return e.length===0?!Eo(n.story):e.every(s=>n.has(s.start.paragraphId))}function _o(n){return Object.freeze(pg(n.part).filter(e=>Mo(n,e.ranges)))}function re(n){let e=[];for(let s of _o(n)){if(s.readOnly||s.revisionKind==="structural")continue;let a=Lo[s.revisionKind];a!==void 0&&e.push(Object.freeze({id:s.id,type:a,author:s.author,date:s.date??"",item:s}));}return Object.freeze(e)}function Bo(n,e){let s=n;for(let a=0;s!==void 0&&a<=64;a+=1){if(s.parentId===void 0)return s.range!==null;s=e.get(s.parentId);}return false}var Fo=Object.freeze({items:Object.freeze([]),roots:Object.freeze([]),byId:()=>null,textOf:()=>""});function xn(n,e){let s=n.parts.get(Sf(n,e.part.name));if(!s)return Fo;let a=n.parts.get(Tf(n,e.part.name)),l=Ke(s),u=a?Le(a):new Map,f=Je(e.part).filter(g=>e.has(g.start.paragraphId)),k=qg(l,f,u),m=new Map(k.map(g=>[g.id,g])),y=k.filter(g=>Bo(g,m)),v=new Map(y.map(g=>[g.id,g]));return Object.freeze({items:Object.freeze(y),roots:Object.freeze(y.filter(g=>g.parentId===void 0)),byId:g=>v.get(g)??null,textOf:g=>{let I=v.get(g);return I?ng(I.comment):""}})}function Sn(n,e,s){if("body"in n){let a=K(n.body,"body",e,s);return a.ok?{ok:true,reads:a.value}:{ok:false,code:a.code,message:"that handle does not name a body",detail:a.detail}}return e.resolve(n.document,"document")?s.body?{ok:true,reads:s.body}:{ok:false,code:"document-unavailable",message:"this host holds no document"}:{ok:false,code:"invalid-handle",message:"that handle does not name a document",detail:"document"}}function Rn(n,e){let s=n.op==="acceptAllRevisions",a=e.story.kind==="note"?{scopeRootId:e.root.id}:{};return [s?{op:"acceptAllRevisions",...a}:{op:"rejectAllRevisions",...a}]}var jo=/[\r\n\u2028\u2029]/u,On=Object.freeze({kind:"applied"});function kt(n,e,s){return {ok:false,error:Object.freeze(s===void 0?{code:n,message:e}:{code:n,message:e,detail:s})}}function ae(n,e){return kt("unsupported-content",n==="author"?"a comment records who wrote it":n==="date"?"a comment date must be a valid ISO-8601 instant":e==="reply"?"a reply says something":"a comment says something",n)}function se(n){return Lf(n.author)?ae("author",n.kind):Mf(n.text)?ae("text",n.kind):typeof n.text=="string"&&jo.test(n.text)?kt("unsupported-content",n.kind==="reply"?"a reply is one paragraph in this slice":"a comment is one paragraph in this slice","text"):Of(n.date)?ae("date",n.kind):null}function ie(n){if(n===void 0)return;let e=Nf(n);return e.ok?e.value:void 0}function Cn(n,e){let s=Fa(n.part,e);for(;s;){if(s.kind==="tableCell"||s.kind!=="textValue"&&s.namespaceUri===ma&&s.localName==="tc")return s.id;s=Ga(n.part,s.id);}return null}function Pn(n,e,s,a){let l=se({author:n.author,text:n.text,date:n.date,kind:"comment"});if(l)return l;let u=W(n.span,e,s);if(!u.ok)return kt(u.code,"that span is not a place",u.detail);if(u.value===null)return kt("invalid-handle","an empty story has no comment anchor");let f=q(n.span,e,s);if(!f.ok)return kt(f.code,"that span is not a place",f.detail);let k=u.value;if(Cn(f.value,k.start.paragraphId)!==Cn(f.value,k.end.paragraphId))return kt("unsupported-content","a comment range cannot cross a table-cell boundary");let m=a(f.value);if(m)return m;let y=ie(n.date);return {ok:true,kind:"commentWrite",write:{kind:"create",anchor:{paragraphId:k.start.paragraphId,start:k.start.offset,end:k.end.offset,...k.end.paragraphId===k.start.paragraphId?{}:{endParagraphId:k.end.paragraphId}},text:n.text,author:n.author,...y===void 0?{}:{date:y}},story:f.value.story,answer:(g,I)=>I===void 0?On:{kind:"handle",handle:e.comment(I,f.value.story)}}}function wn(n,e,s){let a=s(e);if(a)return a;let l=e.story;return {ok:true,kind:"commentWrite",write:{kind:"delete",commentId:n.id,...n.parentId===void 0?{}:{parentCommentId:n.parentId},...l.kind==="note"?{noteId:l.noteId}:{}},story:l,answer:()=>On}}var Do=1e4;function Tn(n,e){let s=[],a=e.kind==="contentControl"?pe(e):e;if(!a)return s;for(let l of te$1(a))if(!(l.ancestors.length>0)){if(s.length>=Do)break;s.push(En(n,l.node));}return s}function Nn(n,e){for(let s of te$1(n.root))if(s.node.id===e)return En(n,s.node);return null}function Hn(n,e){for(let s of te$1(n.root))if(s.node.id===e)return s.node;return null}function de(n,e){let s=Mn(e);if(s.length>0){let a=s[0],l=s[s.length-1],u=n.paragraphText(l);return u===null||!n.has(a)?null:{start:{paragraphId:a,offset:0},end:{paragraphId:l,offset:u.length}}}for(let a of n.paragraphIds){let l=n.node(a);if(!l||l.kind!=="paragraph"||!l.children.some(f=>f.id===e.id))continue;let u=Sd(l).spanOf(e);return u?{start:{paragraphId:a,offset:u.start},end:{paragraphId:a,offset:u.end}}:null}return null}function Ln(n){return ve(n)}function En(n,e){return {nodeId:e.id,properties:re$1(e),lock:Gf(n.part,e.id),paragraphIds:Mn(e)}}function Mn(n){let e=pe(n);if(!e)return [];let s=[];return Ge(e.children,s,0),s.map(a=>a.id)}var Wo=new Set(["unlocked","sdtLocked","contentLocked","sdtContentLocked"]),zo=4096,_n=64;function Bn(n){if(n===void 0)return {ok:true,value:null};if(typeof n!="object"||n===null)return {ok:false,field:"payload"};let e=n;for(let s of ["namespaceUri","rootLocalName","nodeId"]){let a=e[s];if(typeof a!="string"||a.length===0||a.length>zo)return {ok:false,field:s}}return typeof e.label!="string"||e.label.length>Vf?{ok:false,field:"label"}:typeof e.data!="string"||e.data.length===0||e.data.length>Uf?{ok:false,field:"data"}:{ok:true,value:{namespaceUri:e.namespaceUri,rootLocalName:e.rootLocalName,nodeId:e.nodeId,label:e.label,data:e.data}}}function Fn(n){let e=n.at!==void 0,s=n.span!==void 0;return e===s?{message:"a custom node goes at a position or over a span, not both",detail:e?"at+span":"no-place"}:typeof n.tag!="string"||n.tag.length===0?{message:"a custom node carries its identity in its tag",detail:"tag"}:n.tag.length>_n?{message:`w:tag caps at ${String(_n)} characters; a longer payload belongs in the store`,detail:"tag"}:typeof n.text!="string"||n.text.length===0?{message:"a custom node shows some text",detail:"text"}:n.lock!==void 0&&!Wo.has(n.lock)?{message:"that is not a lock",detail:String(n.lock)}:null}function jn(n,e,s,a){return {paragraphId:e.paragraphId,offset:e.offset,...s.offset>e.offset?{replaceUntil:s.offset}:{},tag:n.tag,text:n.text,...n.title===void 0?{}:{alias:n.title},...n.lock===void 0||n.lock==="unlocked"?{}:{lock:n.lock},...a===null?{}:{payload:a}}}function Dn(n,e,s){if(n.span){let l=W(n.span,e,s);return l.ok?l.value?l.value.start.paragraphId!==l.value.end.paragraphId?{code:"unsupported-content",message:"a custom node wraps text inside one paragraph",detail:"multi-paragraph"}:{range:l.value}:{code:"invalid-offset",message:"that story holds nothing to wrap",detail:"empty-story"}:{code:l.code,message:"that span is not a place",detail:l.detail}}let a=gt(n.at,e,s);return a.ok?{range:{start:a.value,end:a.value}}:{code:a.code,message:"that is not a place",detail:a.detail}}var Ft=/[\r\n\v\f\u2028\u2029]/,Ko=16,Vo=64,Wn=/\s/;function $o(n,e,s){return Object.freeze(s===void 0?{code:n,message:e}:{code:n,message:e,detail:s})}function d(n,e,s){return {ok:false,error:$o(n,e,s)}}var F=Object.freeze({kind:"applied"});function b(n){return {ok:true,kind:"query",value:n}}function zn(n){let e=n.kind==="contentControl"?pe(n):n;return e?te$1(e).map(s=>s.node):[]}var Uo=new Set(["unlocked","sdtLocked","contentLocked","sdtContentLocked"]),Xo=new Set(["whole","content","start","end","before","after"]),Yo=new Set(["richText","plainText","dropDownList","comboBox","date"]),Go=4096;function Jo(n){let e=(l,u)=>({ok:false,code:"unsupported-content",message:l,detail:u});if(typeof n!="object"||n===null||!("kind"in n))return e("a control value states its kind","value");let s=n,a=s.kind;if(a==="text"||a==="listItem"){let l=a==="text"?s.text:s.value;return typeof l!="string"?e("that value is not a string",String(a)):l.length>Go?e("that value is too long",String(l.length)):{ok:true,value:a==="text"?{kind:"text",text:l}:{kind:"listItem",value:l}}}if(a==="checkbox"){let l=s.checked;return typeof l!="boolean"?e("a checkbox is checked or not","checked"):{ok:true,value:{kind:"checkbox",checked:l}}}if(a==="date"){let l=s.iso;return typeof l!="string"?e("a date is an ISO-8601 string","iso"):l.length>64?e("that is not a date",String(l.length)):{ok:true,value:{kind:"date",iso:l}}}return e("that is not a value any control accepts",String(a))}function Qo(n,e){let s=[],a=0;for(;a<n.length;){let l=null;for(let u of e){let f=n.indexOf(u,a);f<0||(!l||f<l.start||f===l.start&&u.length>l.length)&&(l={start:f,length:u.length});}if(!l)break;s.push(l),a=l.start+l.length;}return s}function Zo(n,e,s){let a=e[s]?.markParagraphId??null;if(a!==null)return a;let l=n.paragraphIds,u=l[l.length-1];return u===void 0||new Set(e.map(k=>k.markParagraphId).filter(k=>k!==null)).has(u)?null:u}function qo(n,e){for(let s of [n.start,n.end]){let a=e.paragraphText(s.paragraphId);if(a===null||s.offset>a.length)return false}return true}function tr(n,e,s){let a=e,l=s;for(;a<l&&Wn.test(n[a]);)a+=1;for(;l>a&&Wn.test(n[l-1]);)l-=1;return [a,l]}function Kn(n){let{handles:e,capabilities:s}=n,a=n.reads,l=new Map,u=r=>{let t=B(r.story),o=l.get(t);if(o)return o;let i=new Map,c=r.paragraphIds.map(h=>{let A={id:h};return i.set(h,A),A}),p={reads:r,order:c,slotById:i,created:[],restructured:new Set,touched:new Set,formatted:new Set,selected:new Set,retargets:[]};return l.set(t,p),p},f=[],k=un(),m=null,y=r=>m===null?(m=r,null):m===r?null:d("conflicting-operations","one batch writes into one story",`${B(m.reads.story)} then ${B(r.reads.story)}`),v=r=>y(u(r)),g=r=>{let t=a.package;return t===null?null:xn(t,r)},I=r=>{let t=e.resolve(r,"comment");if(!t||t.kind!=="comment")return {ok:false,planned:d("invalid-handle","that handle does not name a comment","comment")};let o=a.story(t.story);if(!o)return {ok:false,planned:d("invalid-handle","that story is not in this document")};let c=g(o)?.byId(t.commentId)??null;return c?{ok:true,reads:o,item:c}:{ok:false,planned:d("invalid-handle","this document no longer holds that comment",t.commentId)}},C=r=>{let t=e.resolve(r,"revision");if(!t||t.kind!=="revision")return {ok:false,planned:d("invalid-handle","that handle does not name a tracked change","revision")};let o=a.story(t.story);if(!o)return {ok:false,planned:d("invalid-handle","that story is not in this document")};let i=re(o).find(c=>c.id===t.revisionId)??null;return i?{ok:true,reads:o,item:i}:{ok:false,planned:d("invalid-handle","this document no longer holds that tracked change",t.revisionId)}},R=(r,t)=>{let o=r.paragraphText(t.start.paragraphId),i=r.paragraphText(t.end.paragraphId);if(o===null||i===null)return null;let c={story:r.story,paragraphId:t.start.paragraphId,index:r.indexOf(t.start.paragraphId),offset:Math.min(t.start.offset,o.length)},p={story:r.story,paragraphId:t.end.paragraphId,index:r.indexOf(t.end.paragraphId),offset:Math.min(t.end.offset,i.length)};return U({start:c,end:p})},N=(r,t)=>r.order.indexOf(t),P=(r,t)=>r.selected.has(t)?d("conflicting-operations","this batch selects a paragraph it also edits",t):null,L=(r,t)=>{let o=P(r,t);return o||(r.restructured.has(t)||r.touched.has(t)?d("conflicting-operations","another operation in this batch already changes that paragraph",t):(r.restructured.add(t),r.touched.add(t),null))},M=(r,t)=>{let o=P(r,t);return o||(r.restructured.has(t)?d("conflicting-operations","another operation in this batch restructures that paragraph",t):(r.touched.add(t),null))},j=(r,t,o)=>{let i=`${o}:${t}`;if(r.formatted.has(i))return d("conflicting-operations","another operation in this batch already writes that formatting",t);let c=M(r,t);return c||(r.formatted.add(i),null)},Z=(r,t)=>{let o={id:null};return r.order.splice(t,0,o),r.created.push(o),o},U=r=>te(r,e),E=r=>r===null?null:a.story(r.start.story),X=(r,t,o,i)=>{if(i?.matchWildcards===true)return d("unsupported-capability","wildcard search is not implemented","matchWildcards");if(i?.ignorePunct===true)return d("unsupported-capability","ignoring punctuation is not implemented","ignorePunct");if(i?.ignoreSpace===true)return d("unsupported-capability","ignoring whitespace is not implemented","ignoreSpace");if(!Bg(o))return d("unsupported-content","that is not a query this host will scan for","text");let c=i?.limit;if(c!==void 0&&(!Number.isInteger(c)||c<0))return d("invalid-offset","limit must be a non-negative integer",String(c));let p=Math.min(c??2e3,2e3),h=[],A=at(t,r),x=A.length-1;for(let[w,T]of A.entries()){if(p<=0)break;let _=r.paragraphText(T)??"",O=Cg(_,o,p,{matchCase:i?.matchCase===true,wholeWord:i?.matchWholeWord===true,...w===0&&t?{from:t.start.offset}:{},...w===x&&t?{to:t.end.offset}:{}});for(let S of O.matches){let Y=e.paragraph(T,r.story);h.push({start:{paragraph:Y,offset:S.start},end:{paragraph:Y,offset:S.start+S.length}});}p-=O.matches.length;}return b({kind:"spans",spans:h})},et=(r,t,o)=>{if(typeof o!="string")return d("unsupported-content","insertText needs text","text");if(Ft.test(o))return d("unsupported-content","text carrying a paragraph mark is not written by this host","paragraph-mark-in-text");let i=y(r);if(i)return i;let c=M(r,t.paragraphId);if(c)return c;let p=o.length===0?[]:[{op:"insertText",paragraphId:t.paragraphId,offset:t.offset,text:o}],h=()=>({kind:"span",span:U({start:t,end:{...t,offset:t.offset+o.length}})});return {ok:true,kind:"command",ops:p,story:r.reads.story,answer:h}},At=(r,t,o)=>{let i=r.reads;if(typeof o!="string")return d("unsupported-content","replaceSpan needs text","text");if(Ft.test(o))return d("unsupported-content","text carrying a paragraph mark is not written by this host","paragraph-mark-in-text");let c=at(t,i),p=t.start.paragraphId,h=[],A=y(r);if(A)return A;if(c.length===1){let T=M(r,p);if(T)return T;t.end.offset>t.start.offset&&h.push({op:"deleteText",paragraphId:p,start:t.start.offset,end:t.end.offset});}else {for(let O of c){let S=L(r,O);if(S)return S}let T=t.end.paragraphId,_=(i.paragraphText(p)??"").length;t.start.offset<_&&h.push({op:"deleteText",paragraphId:p,start:t.start.offset,end:_}),t.end.offset>0&&h.push({op:"deleteText",paragraphId:T,start:0,end:t.end.offset});for(let O of c.slice(1,-1))h.push({op:"deleteBlock",blockId:O});h.push({op:"joinParagraphs",firstId:p,secondId:T});for(let O of c.slice(1)){let S=r.slotById.get(O);S&&r.order.splice(N(r,S),1);}}o.length>0&&h.push({op:"insertText",paragraphId:p,offset:t.start.offset,text:o});let x={...t.start,paragraphId:p},w=()=>({kind:"span",span:U({start:x,end:{...x,offset:x.offset+o.length}})});return {ok:true,kind:"command",ops:h,story:r.reads.story,answer:w}},Ot=(r,t)=>{let o=r.reads;if(typeof t!="string")return d("unsupported-content","replaceSpan needs text","text");if(Ft.test(t))return d("unsupported-content","text carrying a paragraph mark is not written by this host","paragraph-mark-in-text");let i=o.blocks,c=i.filter(S=>S.removable),p=i.filter(S=>!S.removable).flatMap(S=>S.paragraphIds),h=p.length===0?c.find(S=>S.kind==="paragraph"):void 0;if(!h&&p.length===0)return d("invalid-offset","that story holds no paragraph this host can write into","no-top-level-paragraph");let A=y(r);if(A)return A;for(let S of o.paragraphIds){let Y=L(r,S);if(Y)return Y}let x=[],w=(h?[h.id]:[...p]).sort((S,Y)=>o.indexOf(S)-o.indexOf(Y)),T=w[0];for(let S of w){let Y=(o.paragraphText(S)??"").length;Y>0&&x.push({op:"deleteText",paragraphId:S,start:0,end:Y});}for(let S of c)S.id!==h?.id&&x.push({op:"deleteBlock",blockId:S.id});t.length>0&&x.push({op:"insertText",paragraphId:T,offset:0,text:t});for(let S of c)if(S.id!==h?.id)for(let Y of S.paragraphIds){let Pt=r.slotById.get(Y);Pt&&r.order.splice(N(r,Pt),1);}let _={story:o.story,paragraphId:T,index:o.indexOf(T),offset:0},O=()=>({kind:"span",span:U({start:_,end:{..._,offset:t.length}})});return {ok:true,kind:"command",ops:x,story:o.story,answer:O}},jt=(r,t,o,i)=>{let c=r.reads;if(typeof i!="string")return d("unsupported-content","insertParagraph needs text","text");if(Ft.test(i))return d("unsupported-content","a paragraph mark inside a paragraph\u2019s text is not written by this host","paragraph-mark-in-text");let p=y(r);if(p)return p;let h=L(r,t.paragraphId);if(h)return h;let A=r.slotById.get(t.paragraphId);if(!A)return d("invalid-handle","that paragraph is not in the body");let x=(c.paragraphText(t.paragraphId)??"").length,w=[];o==="after"?(i.length>0&&w.push({op:"insertText",paragraphId:t.paragraphId,offset:x,text:i}),w.push({op:"splitParagraph",paragraphId:t.paragraphId,offset:x})):(i.length>0&&w.push({op:"insertText",paragraphId:t.paragraphId,offset:0,text:i}),w.push({op:"splitParagraph",paragraphId:t.paragraphId,offset:i.length}));let T=Z(r,N(r,A)+1);o==="before"&&r.retargets.push({from:t.paragraphId,slot:T});let _=()=>{let O=o==="after"?T.id:t.paragraphId;return O===null?F:{kind:"handle",handle:e.paragraph(O,c.story)}};return {ok:true,kind:"command",ops:w,story:c.story,answer:_}},H=(r,t,o,i,c)=>{let p=r.reads;if(!Array.isArray(o)||o.length===0)return d("unsupported-content","split needs at least one delimiter","delimiters");if(o.length>Ko)return d("unsupported-content","too many delimiters",String(o.length));for(let V of o){if(typeof V!="string"||V.length===0)return d("unsupported-content","a delimiter must be a non-empty string","delimiters");if(V.length>Vo)return d("unsupported-content","that delimiter is too long","delimiters")}let h=y(r);if(h)return h;let A=L(r,t.paragraphId);if(A)return A;let x=r.slotById.get(t.paragraphId);if(!x)return d("invalid-handle","that paragraph is not in the body");let w=p.paragraphText(t.paragraphId)??"",T=Qo(w,o),_=[],O=[],S=[];if(T.length===0)S.push(w);else if(i){for(let $ of [...T].reverse())_.push({op:"deleteText",paragraphId:t.paragraphId,start:$.start,end:$.start+$.length});let V=0,ut=0;for(let $ of T){let zt=$.start-V;O.push(zt),S.push(w.slice(ut,$.start)),ut=$.start+$.length,V+=$.length;}S.push(w.slice(ut));}else {let V=0;for(let ut of T){let $=ut.start+ut.length;O.push($),S.push(w.slice(V,$)),V=$;}S.push(w.slice(V));}O.length>0&&_.push({op:"splitParagraphMany",paragraphId:t.paragraphId,offsets:O});let Y=[x];for(let V=0;V<O.length;V+=1)Y.push(Z(r,N(r,x)+1+V));let Pt=V=>{let ut=V.story(p.story),$=[];return Y.forEach((zt,Jn)=>{let Kt=zt.id;if(Kt===null)return;let Vt=ut?.paragraphText(Kt)??S[Jn]??"",[Qn,Zn]=c?tr(Vt,0,Vt.length):[0,Vt.length],pe=e.paragraph(Kt,p.story);$.push({start:{paragraph:pe,offset:Qn},end:{paragraph:pe,offset:Zn}});}),{kind:"spans",spans:$}};return {ok:true,kind:"command",ops:_,story:p.story,answer:Pt}},z=(r,t)=>{let o=y(r);if(o)return o;let i=L(r,t.paragraphId);if(i)return i;let c=r.slotById.get(t.paragraphId);return c&&r.order.splice(N(r,c),1),{ok:true,kind:"command",ops:[{op:"deleteBlock",blockId:t.paragraphId}],story:r.reads.story,answer:()=>F}},st=(r,t,o)=>{let i=r.reads,c=i.part,p=y(r);if(p)return p;let h=dn(o??{});if(!h.ok)return d("unsupported-content","that is not formatting this host writes",h.detail);let A=[];for(let x of qt(t,i)){if(x.end<=x.start&&!x.whole)continue;let w=j(r,x.paragraphId,"runs");if(w)return w;for(let T of jg(c,x.paragraphId,x.start,x.end,h.value))A.push({op:"setRunProperties",paragraphId:x.paragraphId,start:T.start,end:T.end,properties:T.properties,...T.targetRunIds?{targetRunIds:T.targetRunIds}:{}});x.whole&&A.push({op:"setParagraphMarkProperties",paragraphId:x.paragraphId,properties:gg(fg(c,x.paragraphId),h.value)});}return A.length===0?d("invalid-offset","that range covers no characters to format","collapsed-range"):{ok:true,kind:"command",ops:A,story:i.story,answer:()=>F}},vt=(r,t,o)=>{let i=r.reads,c=i.part,p=y(r);if(p)return p;let h=Et(o,i.styles());if(!h.ok)return d("unsupported-content","that is not a style this document has",h.detail);let A={localName:"pStyle",attributes:{val:h.styleId}},x=[];for(let w of at(t,i)){let T=j(r,w,"paragraph");if(T)return T;x.push({op:"setParagraphProperties",paragraphId:w,properties:gg(eg(c,w),A)});}return x.length===0?d("invalid-offset","that story holds no paragraph to style","empty-story"):{ok:true,kind:"command",ops:x,story:i.story,answer:()=>F}},pt=(r,t,o)=>{let i=r.reads,c=i.part,p=y(r);if(p)return p;let h=ln(c,t.paragraphId,o??{},i.styles());if(!h.ok)return d("unsupported-content","that is not paragraph formatting this host writes",h.detail);let A=j(r,t.paragraphId,"paragraph");return A||{ok:true,kind:"command",ops:[{op:"setParagraphProperties",paragraphId:t.paragraphId,properties:h.value}],story:i.story,answer:()=>F}},Vn=(r,t)=>{let o=a.body;if(!o)return d("document-unavailable","this host holds no document right now");let i=a.sections();if(!i[r])return d("invalid-handle","that section is not in this document");let p=pn(t);if(!p.ok)return d("unsupported-content",p.reason,p.detail);let h=Zo(o,i,r);if(h===null)return d("unsupported-content","that section holds no paragraph to address it by","no-anchor");let A=u(o),x=y(A);return x||{ok:true,kind:"command",ops:[{op:"setSectionProperties",...p.value,anchorParagraphId:h}],story:ct,answer:()=>F}},$n=(r,t)=>({ok:true,kind:"command",ops:[{op:"deleteNote",noteKind:r,noteId:t}],story:ct,lifecycle:true,answer:()=>F}),Dt=r=>{let t=e.resolve(r,"list");if(!t||t.kind!=="list")return d("invalid-handle","that handle does not name a list","list");let o=a.story(t.story);if(!o)return d("invalid-handle","that story is not in this document");let i=Bt(o).find(c=>c.numId===t.numId);return i?{ok:true,plan:u(o),list:i}:d("invalid-handle","this story numbers nothing with that list",t.numId)},Wt=r=>{if(typeof r!="object"||r===null)return d("invalid-handle","that is not a scope a control lives in","scope");let t=r;if("body"in r){let o=K(t.body,"body",e,a);return o.ok?{reads:o.value,node:o.value.root}:d(o.code,"that handle does not name a body",o.detail)}if("contentControl"in r){let o=nt(t.contentControl);return "control"in o?{reads:o.reads,node:o.node}:o}return d("invalid-handle","that is not a scope a control lives in","scope")},nt=r=>{let t=e.resolve(r,"contentControl");if(!t||t.kind!=="contentControl")return d("invalid-handle","that handle does not name a content control","contentControl");let o=a.story(t.story);if(!o)return d("invalid-handle","that story is not in this document");let i=Nn(o,t.nodeId),c=Hn(o,t.nodeId);return !i||!c?d("invalid-handle","this document no longer holds that content control"):{reads:o,control:i,node:c}},Un=(r,t,o)=>{if(!Number.isInteger(o)||o<0||o>ht)return d("invalid-offset",`a list level is 0 to ${String(ht)}`,String(o));if(!Ct(r.reads,t))return d("unsupported-content","that paragraph is not in a list",t);let i=y(r);if(i)return i;let c=j(r,t,"paragraph");return c||{ok:true,kind:"command",ops:[{op:"setListLevel",paragraphId:t,level:o}],story:r.reads.story,answer:()=>F}},Xn=(r,t,o,i)=>{if(o!=="start"&&o!=="end")return d("unknown-operation","a list takes an item at its start or its end",String(o));let c=r.reads,p=o==="start"?t.paragraphIds[0]:t.paragraphIds[t.paragraphIds.length-1];if(p===void 0)return d("invalid-handle","that list holds no paragraph");let h={story:c.story,paragraphId:p,index:c.indexOf(p)};return jt(r,h,o==="start"?"before":"after",i)},le=(r,t)=>{if(t.start.paragraphId!==t.end.paragraphId)return null;for(let o of An(r,t.start.paragraphId))if(o.start<=t.start.offset&&o.end>=t.end.offset)return o;return null},Yn=(r,t,o)=>{if(typeof o!="string")return d("unsupported-content","a hyperlink target is a string","target");let i=r.reads,c=le(i,t),p=t.start.paragraphId===t.end.paragraphId&&t.start.offset===t.end.offset;if(o.length===0){if(!c)return d("unsupported-content","that text is not a link","no-link");let O=y(r);if(O)return O;let S=M(r,c.paragraphId);return S||{ok:true,kind:"command",ops:[{op:"removeHyperlink",linkId:c.id}],story:i.story,answer:()=>F}}let h={},A=null;if(o.startsWith("#")){let O=o.slice(1);if(O.length===0||!oe(i,O))return d("unsupported-content","this document declares no such bookmark",o);h={anchor:O};}else {if(Vc(o)===null)return d("unsupported-content","this engine will not author that target","target");A=o;}let x=y(r);if(x)return x;let w=O=>A===null?{ok:true,kind:"command",ops:[O(h)],story:i.story,answer:()=>F}:{ok:true,kind:"command",ops:[],relate:{url:A,ops:S=>[O({relationshipId:S})]},story:i.story,answer:()=>F};if(c){let O=M(r,c.paragraphId);return O||w(S=>({op:"setHyperlinkTarget",linkId:c.id,...S}))}if(p)return d("unsupported-content","a link with no text has nothing to click","collapsed");if(t.start.paragraphId!==t.end.paragraphId)return d("unsupported-content","a link lives inside one paragraph","crosses-paragraph-mark");let T=M(r,t.start.paragraphId);if(T)return T;let _=i.styles().idOf("hyperlink");return w(O=>({op:"insertHyperlink",paragraphId:t.start.paragraphId,start:t.start.offset,end:t.end.offset,...O,..._===null?{}:{styleId:_}}))},ue=(r,t,o)=>{let i=r.reads;if(!s.selection||!n.select)return d("unsupported-capability","this host has no reader to move","selection");if(o!=="select"&&o!=="start"&&o!=="end")return d("unknown-operation","that is not a selection mode",String(o));let c=at(t,i);for(let p of c)if(r.touched.has(p))return d("conflicting-operations","this batch edits a paragraph the selection covers",p);for(let p of c)r.selected.add(p);return f.push({range:t,mode:o}),{ok:true,kind:"command",ops:[],story:i.story,answer:()=>F}},ce=r=>{let t=e.resolve(r,"bookmark");if(!t||t.kind!=="bookmark")return d("invalid-handle","that handle does not name a bookmark","bookmark");let o=a.story(t.story);if(!o)return d("invalid-handle","that story is not in this document");let i=oe(o,t.name);if(!i)return d("invalid-handle","this document no longer declares that bookmark",t.name);let c=p=>({story:o.story,paragraphId:p.paragraphId,index:o.indexOf(p.paragraphId),offset:p.offset});return {reads:o,range:{start:c(i.start),end:c(i.end)}}},Gn=r=>{switch(r.op){case "getDocument":return b({kind:"handle",handle:e.document()});case "getBody":return e.resolve(r.document,"document")?a.body?b({kind:"handle",handle:e.body(ct)}):d("document-unavailable","this host holds no document right now"):d("invalid-handle","that handle does not name a document","document");case "getParagraphs":{let t=K(r.body,"body",e,a);return t.ok?b({kind:"handles",handles:t.value.paragraphIds.map(o=>e.paragraph(o,t.value.story))}):d(t.code,"that handle does not name a body",t.detail)}case "getSpanParagraphs":{let t=W(r.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);let o=q(r.span,e,a);return o.ok?b({kind:"handles",handles:at(t.value,o.value).map(i=>e.paragraph(i,o.value.story))}):d(o.code,"that span is not a place",o.detail)}case "getText":{if(e.resolve(r.target,"body")){let c=K(r.target,"body",e,a);return c.ok?b({kind:"text",text:c.value.text()}):d(c.code,"that handle does not name a body",c.detail)}let o=Q(r.target,e,a);if(!o.ok)return d(o.code,"that handle does not name a body or a paragraph",o.detail);let i=a.story(o.value.story);return b({kind:"text",text:i?.paragraphText(o.value.paragraphId)??""})}case "getSpanText":{let t=W(r.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);let o=q(r.span,e,a);return o.ok?b({kind:"text",text:hn(t.value,o.value,Zt)}):d(o.code,"that span is not a place",o.detail)}case "getParagraphId":{let t=Q(r.paragraph,e,a);if(!t.ok)return d(t.code,"that handle does not name a paragraph",t.detail);let i=a.story(t.value.story)?.paragraph(t.value.paragraphId);return b({kind:"text",text:i?.paraId??""})}case "search":{let t=W(r.scope,e,a);if(!t.ok)return d(t.code,"that is not a scope to search",t.detail);let o=q(r.scope,e,a);return o.ok?X(o.value,t.value,r.text,r.options):d(o.code,"that is not a scope to search",o.detail)}case "insertText":{let t=gt(r.at,e,a);if(!t.ok)return d(t.code,"that is not a place to insert at",t.detail);let o=a.story(t.value.story);return o?et(u(o),t.value,r.text):d("invalid-handle","that story is not in this document")}case "replaceSpan":{if("body"in r.span){let i=K(r.span.body,"body",e,a);return i.ok?Ot(u(i.value),r.text):d(i.code,"that handle does not name a body",i.detail)}let t=W(r.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);if(!t.value)return d("invalid-offset","that story holds no paragraph to write into","empty-story");let o=E(t.value);return o?At(u(o),t.value,r.text):d("invalid-handle","that story is not in this document")}case "insertParagraph":{let t=_t(r.anchor,e,a);if(!t.ok)return d(t.code,"that is not a paragraph to insert beside",t.detail);if(r.where!=="before"&&r.where!=="after")return d("unknown-operation","that is not a place to insert",String(r.where));let o=a.story(t.value.story);return o?jt(u(o),t.value,r.where,r.text):d("invalid-handle","that story is not in this document")}case "splitParagraph":{let t=Q(r.paragraph,e,a);if(!t.ok)return d(t.code,"that handle does not name a paragraph",t.detail);let o=a.story(t.value.story);return o?H(u(o),t.value,r.delimiters,r.trimDelimiters===true,r.trimSpacing===true):d("invalid-handle","that story is not in this document")}case "getFont":{let t=W(r.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);let o=q(r.span,e,a);return o.ok?b({kind:"font",font:an(o.value.part,qt(t.value,o.value))}):d(o.code,"that span is not a place",o.detail)}case "setFont":{let t=W(r.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);if(!t.value)return d("invalid-offset","that story holds no paragraph to format","empty-story");let o=E(t.value);return o?st(u(o),t.value,r.font):d("invalid-handle","that story is not in this document")}case "getStyle":{let t=W(r.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);let o=q(r.span,e,a);if(!o.ok)return d(o.code,"that span is not a place",o.detail);let i=o.value.part,c=o.value.styles(),p=at(t.value,o.value).map(A=>Lt(i,A,c)),h=p.length>0&&p.every(A=>A!==null&&A===p[0])?p[0]:null;return b({kind:"style",name:h})}case "setStyle":{let t=W(r.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);if(!t.value)return d("invalid-offset","that story holds no paragraph to style","empty-story");let o=E(t.value);return o?vt(u(o),t.value,r.name):d("invalid-handle","that story is not in this document")}case "getParagraphFormat":{let t=_t(r.paragraph,e,a);if(!t.ok)return d(t.code,"that is not a paragraph",t.detail);let o=a.story(t.value.story);if(!o)return d("document-unavailable","this host holds no document right now");let i=sn(o.part,t.value.paragraphId,o.styles());return i?b({kind:"paragraphFormat",format:i}):d("invalid-handle","that handle does not name a paragraph")}case "setParagraphFormat":{let t=_t(r.paragraph,e,a);if(!t.ok)return d(t.code,"that is not a paragraph",t.detail);let o=a.story(t.value.story);return o?pt(u(o),t.value,r.format):d("invalid-handle","that story is not in this document")}case "deleteParagraph":{let t=Q(r.paragraph,e,a);if(!t.ok)return d(t.code,"that handle does not name a paragraph",t.detail);let o=a.story(t.value.story);return o?z(u(o),t.value):d("invalid-handle","that story is not in this document")}case "getSections":return e.resolve(r.document,"document")?b({kind:"handles",handles:a.sections().map(t=>e.section(t.index))}):d("invalid-handle","that handle does not name a document","document");case "getPageSetup":{let t=e.resolve(r.section,"section");if(!t||t.kind!=="section")return d("invalid-handle","that handle does not name a section","section");let o=a.sections()[t.index];return o?b({kind:"pageSetup",setup:o.pageSetup}):d("invalid-handle","that section is not in this document")}case "setPageSetup":{let t=e.resolve(r.section,"section");return !t||t.kind!=="section"?d("invalid-handle","that handle does not name a section","section"):Vn(t.index,r.setup)}case "getFurniture":{let t=e.resolve(r.section,"section");if(!t||t.kind!=="section")return d("invalid-handle","that handle does not name a section","section");if(r.kind!=="header"&&r.kind!=="footer")return d("unknown-operation","that is not furniture",String(r.kind));let o={kind:r.kind,sectionIndex:t.index,variant:r.variant};return tn(o)?a.story(o)?b({kind:"handle",handle:e.body(o)}):d("invalid-handle","this document declares no such header or footer",B(o)):d("unknown-operation","that is not a furniture variant",String(r.variant))}case "getNotes":{if(!e.resolve(r.document,"document"))return d("invalid-handle","that handle does not name a document","document");if(r.noteKind!=="footnote"&&r.noteKind!=="endnote")return d("unknown-operation","that is not a kind of note",String(r.noteKind));let t=r.noteKind,o=a.noteIds(t);return o.ok?b({kind:"handles",handles:o.ids.map(i=>e.note(t,i))}):d("ambiguous-document",`${t} identities are not completely and unambiguously enumerable`,o.reason==="duplicates"?o.duplicateIds.join(","):o.reason)}case "getNoteBody":case "getNoteText":{let t=e.resolve(r.note,"note");if(!t||t.kind!=="note")return d("invalid-handle","that handle does not name a note","note");let o=t,i=a.story(o);return i?r.op==="getNoteText"?b({kind:"text",text:i.text()}):b({kind:"handle",handle:e.body(o)}):d("invalid-handle","that note is not in this document",B(o))}case "getNoteKind":{let t=e.resolve(r.note,"note");return !t||t.kind!=="note"?d("invalid-handle","that handle does not name a note","note"):b({kind:"text",text:t.noteKind})}case "deleteNote":{let t=e.resolve(r.note,"note");if(!t||t.kind!=="note")return d("invalid-handle","that handle does not name a note","note");let o=a.noteIds(t.noteKind);return o.ok?o.ids.includes(t.noteId)?$n(t.noteKind,t.noteId):d("invalid-handle","that note is not in this document"):d("ambiguous-document",`${t.noteKind} identities are not completely and unambiguously enumerable`,o.reason==="duplicates"?o.duplicateIds.join(","):o.reason)}case "getLists":{let t=K(r.body,"body",e,a);return t.ok?b({kind:"handles",handles:Bt(t.value).map(o=>e.list(o.numId,t.value.story))}):d(t.code,"that handle does not name a body",t.detail)}case "getListId":{let t=Dt(r.list);return "list"in t?b({kind:"number",value:Number(t.list.numId)}):t}case "getListById":{let t=K(r.body,"body",e,a);if(!t.ok)return d(t.code,"that handle does not name a body",t.detail);if(!Number.isInteger(r.id)||r.id<=0)return d("unsupported-content","a list is numbered from one",String(r.id));let o=String(r.id),i=Bt(t.value).find(c=>c.numId===o);return i?b({kind:"handle",handle:e.list(i.numId,t.value.story)}):d("invalid-handle","no list in that story carries that number",o)}case "getListParagraphs":{let t=Dt(r.list);if(!("list"in t))return t;let o=r.level;if(o!==void 0&&(!Number.isInteger(o)||o<0||o>ht))return d("invalid-offset",`a list level is 0 to ${String(ht)}`,String(o));let i=t.plan.reads,c=o===void 0?t.list.paragraphIds:t.list.paragraphIds.filter(p=>Ct(i,p)?.level===o);return b({kind:"handles",handles:c.map(p=>e.paragraph(p,i.story))})}case "getParagraphList":{let t=Q(r.paragraph,e,a);if(!t.ok)return d(t.code,"that handle does not name a paragraph",t.detail);let o=a.story(t.value.story);if(!o)return d("invalid-handle","that story is not in this document");let i=Ct(o,t.value.paragraphId);return i?b({kind:"handle",handle:e.list(i.numId,o.story)}):d("unsupported-content","that paragraph is not in a list",t.value.paragraphId)}case "getListLevel":{let t=Q(r.paragraph,e,a);if(!t.ok)return d(t.code,"that handle does not name a paragraph",t.detail);let o=a.story(t.value.story);if(!o)return d("invalid-handle","that story is not in this document");let i=Ct(o,t.value.paragraphId);return i?b({kind:"number",value:i.level}):d("unsupported-content","that paragraph is not in a list",t.value.paragraphId)}case "setListLevel":{let t=Q(r.paragraph,e,a);if(!t.ok)return d(t.code,"that handle does not name a paragraph",t.detail);let o=a.story(t.value.story);return o?Un(u(o),t.value.paragraphId,r.level):d("invalid-handle","that story is not in this document")}case "insertListParagraph":{let t=Dt(r.list);return "list"in t?Xn(t.plan,t.list,r.where,r.text):t}case "getHyperlink":{let t=W(r.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);let o=q(r.span,e,a);if(!o.ok)return d(o.code,"that span is not a place",o.detail);let i=a.package;if(!i||!t.value)return b({kind:"text",text:""});let c=le(o.value,t.value);if(!c)return b({kind:"text",text:""});let p=Fa(o.value.part,c.id),h=p?vn(i,o.value.part.name,p):null;return b({kind:"text",text:h??""})}case "setHyperlink":{let t=W(r.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);if(!t.value)return d("invalid-offset","that story holds no text to link","empty-story");let o=E(t.value);return o?Yn(u(o),t.value,r.target):d("invalid-handle","that story is not in this document")}case "getBookmarks":{let t=W(r.scope,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);let o=q(r.scope,e,a);if(!o.ok)return d(o.code,"that span is not a place",o.detail);let i=o.value,c=t.value,p=c===null?null:new Set(at(c,i)),h=ne(i).filter(A=>{if(!p||!p.has(A.start.paragraphId)&&!p.has(A.end.paragraphId)||c===null)return false;let x=A.start.paragraphId===c.end.paragraphId&&A.start.offset>c.end.offset,w=A.end.paragraphId===c.start.paragraphId&&A.end.offset<c.start.offset;return !x&&!w});return b({kind:"handles",handles:h.map(A=>e.bookmark(A.name,i.story))})}case "getBookmarkName":{let t=e.resolve(r.bookmark,"bookmark");return !t||t.kind!=="bookmark"?d("invalid-handle","that handle does not name a bookmark","bookmark"):b({kind:"text",text:t.name})}case "getBookmarkRange":{let t=ce(r.bookmark);return "reads"in t?b({kind:"span",span:U(t.range)}):t}case "getComments":{let t=W(r.scope,e,a);if(!t.ok)return d(t.code,"that scope is not a place",t.detail);let o=q(r.scope,e,a);if(!o.ok)return d(o.code,"that scope names no story",o.detail);let i=o.value,c=g(i);if(!c)return d("document-unavailable","this host holds no document");let p=t.value,h=c.roots.filter(A=>{if(!p)return true;let x=A.range;if(!x)return false;let w=i.indexOf(x.start.paragraphId),T=i.indexOf(x.end.paragraphId),_=i.indexOf(p.start.paragraphId),O=i.indexOf(p.end.paragraphId);return T<_||w>O?false:T===_&&w===_&&O===_?x.end.offset>p.start.offset&&x.start.offset<p.end.offset:true});return b({kind:"handles",handles:h.map(A=>e.comment(A.id,i.story))})}case "getCommentReplies":{let t=I(r.comment);return t.ok?b({kind:"handles",handles:t.item.replyIds.map(o=>e.comment(o,t.reads.story))}):t.planned}case "getCommentId":{let t=I(r.comment);return t.ok?b({kind:"text",text:t.item.id}):t.planned}case "getCommentAuthor":{let t=I(r.comment);return t.ok?b({kind:"text",text:t.item.comment.author}):t.planned}case "getCommentDate":{let t=I(r.comment);return t.ok?b({kind:"text",text:t.item.comment.date??""}):t.planned}case "getCommentText":{let t=I(r.comment);if(!t.ok)return t.planned;let o=g(t.reads);return b({kind:"text",text:o?.textOf(t.item.id)??""})}case "getCommentRange":{let t=I(r.comment);if(!t.ok)return t.planned;let o=t.item.range;if(!o||t.item.orphaned)return d("invalid-handle","that comment has no range in this document");let i=R(t.reads,o);return i?b({kind:"span",span:i}):d("invalid-handle","that comment\u2019s range is no longer in the story")}case "getCommentResolved":{let t=I(r.comment);return t.ok?b({kind:"flag",value:t.item.resolved}):t.planned}case "insertComment":return Pn(r,e,a,v);case "setCommentResolved":{let t=I(r.comment);if(!t.ok)return t.planned;if(typeof r.resolved!="boolean")return d("unsupported-content","resolved is a yes or a no",String(r.resolved));let o=y(u(t.reads));return o||{ok:true,kind:"commentWrite",write:{kind:"resolve",commentId:t.item.id,resolved:r.resolved},story:t.reads.story,answer:()=>F}}case "replyToComment":{let t=I(r.comment);if(!t.ok)return t.planned;let o=se({author:r.author,text:r.text,date:r.date,kind:"reply"});if(o)return o;let i=t.item.range;if(!i||t.item.orphaned)return d("invalid-handle","that comment has no range to reply over");let c=y(u(t.reads));if(c)return c;let p=t.reads.story,h=ie(r.date);return {ok:true,kind:"commentWrite",write:{kind:"reply",parentCommentId:t.item.id,anchor:{paragraphId:i.start.paragraphId,start:i.start.offset,end:i.end.offset,...i.end.paragraphId===i.start.paragraphId?{}:{endParagraphId:i.end.paragraphId}},text:r.text,author:r.author,...h===void 0?{}:{date:h}},story:t.reads.story,answer:(A,x)=>x===void 0?F:{kind:"handle",handle:e.comment(x,p)}}}case "deleteComment":{let t=I(r.comment);return t.ok?wn(t.item,t.reads,o=>y(u(o))):t.planned}case "getRevisions":{let t=K(r.body,"body",e,a);if(!t.ok)return d(t.code,"that handle does not name a body",t.detail);let o=t.value;return b({kind:"handles",handles:re(o).map(i=>e.revision(i.id,o.story))})}case "getRevisionType":{let t=C(r.revision);return t.ok?b({kind:"text",text:t.item.type}):t.planned}case "getRevisionAuthor":{let t=C(r.revision);return t.ok?b({kind:"text",text:t.item.author}):t.planned}case "getRevisionDate":{let t=C(r.revision);return t.ok?b({kind:"text",text:t.item.date}):t.planned}case "getRevisionRange":{let t=C(r.revision);if(!t.ok)return t.planned;let[o]=t.item.item.ranges;if(!o)return d("invalid-handle","that change covers no characters");let i=R(t.reads,o);return i?b({kind:"span",span:i}):d("invalid-handle","that change\u2019s range is no longer in the story")}case "acceptRevision":case "rejectRevision":{let t=C(r.revision);if(!t.ok)return t.planned;let o=u(t.reads),i=y(o);if(i)return i;let c=r.op==="acceptRevision";return {ok:true,kind:"command",story:t.reads.story,ops:t.item.item.addresses.map(p=>c?{op:"acceptRevision",revision:p}:{op:"rejectRevision",revision:p}),answer:()=>F}}case "acceptAllRevisions":case "rejectAllRevisions":{let t=Sn(r,e,a);if(!t.ok)return d(t.code,t.message,t.detail);let o=u(t.reads),i=y(o);if(i)return i;let c=Rn(r,t.reads);return {ok:true,kind:"command",story:t.reads.story,ops:c,answer:()=>F}}case "selectSpan":{let t=W(r.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);if(!t.value)return d("invalid-offset","that story holds no paragraph to select","empty-story");let o=E(t.value);return o?ue(u(o),t.value,r.mode):d("invalid-handle","that story is not in this document")}case "selectBookmark":{let t=ce(r.bookmark);return "reads"in t?ue(u(t.reads),t.range,r.mode):t}case "getContentControls":{let t=Wt(r.scope);return "reads"in t?b({kind:"handles",handles:Tn(t.reads,t.node).map(o=>e.contentControl(o.nodeId,t.reads.story))}):t}case "getContentControlById":{let t=Wt(r.scope);if(!("reads"in t))return t;if(!Number.isInteger(r.id))return d("unsupported-content","a control id is a whole number",String(r.id));let o=zn(t.node).find(i=>re$1(i).id===r.id);return o?b({kind:"handle",handle:e.contentControl(o.id,t.reads.story)}):d("invalid-handle","no control in that scope carries that id",String(r.id))}case "getContentControlsByTag":case "getContentControlsByTitle":{let t=Wt(r.scope);if(!("reads"in t))return t;let o=r.op==="getContentControlsByTag"?r.tag:r.title;if(typeof o!="string"||o.length===0)return d("unsupported-content","a tag or title to match is required",r.op);let i=zn(t.node).filter(c=>{let p=re$1(c);return r.op==="getContentControlsByTag"?p.tag===o:p.alias===o});return b({kind:"handles",handles:i.map(c=>e.contentControl(c.id,t.reads.story))})}case "getContentControlTag":case "getContentControlTitle":case "getContentControlFileId":case "getContentControlSubtype":case "getContentControlLock":{let t=nt(r.contentControl);if(!("control"in t))return t;let o=t.control.properties;if(r.op==="getContentControlLock")return b({kind:"text",text:t.control.lock});if(r.op==="getContentControlSubtype")return b({kind:"text",text:o.type});if(r.op==="getContentControlFileId")return b({kind:"text",text:o.id===void 0?"":String(o.id)});let i=r.op==="getContentControlTag"?o.tag:o.alias;return b({kind:"text",text:i??""})}case "getContentControlIsBound":case "getContentControlPlaceholderShown":case "getContentControlTemporary":{let t=nt(r.contentControl);if(!("control"in t))return t;let o=r.op==="getContentControlIsBound"?t.control.properties.dataBinding!==void 0:r.op==="getContentControlPlaceholderShown"?t.control.properties.showingPlaceholder:t.control.properties.temporary;return b({kind:"flag",value:o})}case "getContentControlText":{let t=nt(r.contentControl);return "control"in t?b({kind:"text",text:Ln(t.node)}):t}case "getContentControlParagraphs":{let t=nt(r.contentControl);return "control"in t?b({kind:"handles",handles:t.control.paragraphIds.map(o=>e.paragraph(o,t.reads.story))}):t}case "getContentControlRange":{let t=nt(r.contentControl);if(!("control"in t))return t;let o=r.location??"whole";if(!Xo.has(o))return d("unsupported-content","that is not a place in a control",o);let i=de(t.reads,t.node);if(!i)return d("unsupported-content","that control holds nothing addressable","empty");let c=o==="start"||o==="before"?i.start:i.end,p=o!=="whole"&&o!=="content",h=A=>({story:t.reads.story,paragraphId:A.paragraphId,index:t.reads.indexOf(A.paragraphId),offset:A.offset});return b({kind:"span",span:te(p?{start:h(c),end:h(c)}:{start:h(i.start),end:h(i.end)},e)})}case "setContentControlValue":{let t=nt(r.contentControl);if(!("control"in t))return t;let o=Jo(r.value);if(!o.ok)return d(o.code,o.message,o.detail);let i=u(t.reads),c=y(i);return c||{ok:true,kind:"command",story:t.reads.story,ops:[{op:"setContentControlValue",controlId:t.control.nodeId,value:o.value}],answer:()=>F}}case "setContentControlProperties":{let t=nt(r.contentControl);if(!("control"in t))return t;if(r.tag===void 0&&r.title===void 0&&r.lock===void 0)return d("unsupported-content","nothing to write","no-properties");if(r.lock!==void 0&&!Uo.has(r.lock))return d("unsupported-content","that is not a lock this schema declares",r.lock);let o=u(t.reads),i=y(o);return i||{ok:true,kind:"command",story:t.reads.story,ops:[{op:"setContentControlProperties",controlId:t.control.nodeId,...r.tag===void 0?{}:{tag:r.tag},...r.title===void 0?{}:{alias:r.title},...r.lock===void 0?{}:{lock:r.lock}}],answer:()=>F}}case "insertContentControlText":{let t=nt(r.contentControl);if(!("control"in t))return t;if(typeof r.text!="string")return d("unsupported-content","text is required","text");if(r.at!=="replace"&&r.at!=="start"&&r.at!=="end")return d("unsupported-content","that is not a place to insert at",String(r.at));let o=u(t.reads),i=y(o);if(i)return i;let c=de(t.reads,t.node);if(!c)return d("unsupported-content","that control holds nothing addressable","empty");let p=r.at==="end"?c.end:c.start,h=()=>({kind:"span",span:U({start:{story:t.reads.story,paragraphId:p.paragraphId,index:t.reads.indexOf(p.paragraphId),offset:p.offset},end:{story:t.reads.story,paragraphId:p.paragraphId,index:t.reads.indexOf(p.paragraphId),offset:p.offset+r.text.length}})});return r.at==="replace"?{ok:true,kind:"command",story:t.reads.story,ops:[{op:"setContentControlValue",controlId:t.control.nodeId,value:{kind:"text",text:r.text}}],answer:h}:{ok:true,kind:"command",story:t.reads.story,ops:r.text.length===0?[]:[{op:"insertText",paragraphId:p.paragraphId,offset:p.offset,text:r.text,inside:t.node.id}],answer:h}}case "deleteContentControl":{let t=nt(r.contentControl);if(!("control"in t))return t;if(typeof r.keepContent!="boolean")return d("unsupported-content","keepContent is required","keepContent");let o=u(t.reads),i=y(o);return i||{ok:true,kind:"command",story:t.reads.story,ops:[{op:"removeContentControl",controlId:t.control.nodeId,keepContent:r.keepContent}],answer:()=>F}}case "insertContentControl":{let t=W(r.span,e,a);if(!t.ok)return d(t.code,"that span is not a place",t.detail);if(!t.value)return d("invalid-offset","that story holds nothing to wrap","empty-story");let o=E(t.value);if(!o)return d("invalid-handle","that story is not in this document");let i=t.value;if(i.start.paragraphId!==i.end.paragraphId)return d("unsupported-content","wrapping several paragraphs in one control is not supported here","multi-paragraph");if(!Yo.has(r.subtype))return d("unsupported-content","that control type cannot be inserted",r.subtype);let c=u(o),p=y(c);return p||{ok:true,kind:"command",story:o.story,ops:[{op:"insertContentControl",paragraphId:i.start.paragraphId,start:i.start.offset,end:i.end.offset,type:r.subtype,...r.tag===void 0?{}:{tag:r.tag},...r.title===void 0?{}:{alias:r.title}}],answer:()=>F}}case "insertCustomNode":{let t=Fn(r);if(t)return d("unsupported-content",t.message,t.detail);let o=Bn(r.payload);if(!o.ok)return d("unsupported-content","that payload cannot be written",o.field);let i=Dn(r,e,a);if("code"in i)return d(i.code,i.message,i.detail);let{start:c,end:p}=i.range,h=E(i.range);if(!h)return d("invalid-handle","that story is not in this document");let A=y(u(h));return A||{ok:true,kind:"customNodeWrite",story:h.story,write:jn(r,c,p,o.value),answer:()=>F}}default:return d("unknown-operation","this host does not implement that operation",String(r.op))}};return {plan(r){let t=k.conflict(r);if(t)return d("conflicting-operations",t.message,t.detail);let o=Gn(r);return o.ok&&k.note(r),o},get hasCommands(){return k.hasCommands},get writeScope(){return m?.reads.scope??null},settle(r){let t=m;if(t){let o=r.story(t.reads.story);if(!o)return {ok:false,detail:`the story this batch wrote is gone: ${B(t.reads.story)}`};let i=new Set(t.reads.paragraphIds),c=o.paragraphIds.filter(h=>!i.has(h));if(c.length!==t.created.length)return {ok:false,detail:`planned ${String(t.created.length)} new paragraphs, the transaction made ${String(c.length)}`};t.order.filter(h=>h.id===null).forEach((h,A)=>{h.id=c[A]??null;});for(let h of t.retargets)h.slot.id&&e.retarget(h.from,h.slot.id);}for(let o of f){let i=r.story(o.range.start.story);!i||!qo(o.range,i)||n.select?.(o.range,o.mode);}return {ok:true}}}}var er=Object.freeze({status:"skipped"});function J(n,e,s){return Object.freeze(s===void 0?{code:n,message:e}:{code:n,message:e,detail:s})}function nr(n){let e=n==="unsupported-revision"||n.startsWith("unsupported-revision:");return J(e?"unsupported-revision":"transaction-refused",e?"that story contains a tracked change this engine cannot resolve":"the document store refused the transaction",n)}function tt(n,e,s,a){return {ok:false,results:n.map((l,u)=>u===e?{status:"error",error:s}:er),revision:a,changed:false}}function Ma(n){let{port:e}=n,s=Object.freeze({...n.capabilities}),a=en(),l=new Set,u=false,f=null,k=s.events?e.subscribe(()=>{if(u)return;let v=Object.freeze({revision:e.revision()});for(let g of [...l])g(v);}):()=>{},m=v=>{if(f&&f.pkg===v)return f.value;let g=yn(v);return f={pkg:v,value:g},g};return {capabilities:s,revision:()=>e.revision(),execute:v=>{let g=Array.isArray(v?.operations)?v.operations:[],I=e.revision();if(u)return tt(g,0,J("disposed","this host was disposed"),I);if(!s.document)return tt(g,0,J("unsupported-capability","this host has no document","document"),I);let C=e.currentPackage();if(!C)return tt(g,0,J("document-unavailable","this host holds no document right now"),I);if(v.expectedRevision!==void 0&&v.expectedRevision!==I)return tt(g,0,J("stale-revision","the document moved since that revision",`expected ${String(v.expectedRevision)}, at ${I}`),I);let R=Kn({handles:a,reads:m(C),capabilities:s,...e.select?{select:e.select.bind(e)}:{}}),N=[],P=[],L=null,M=[],j=null,Z,U=null,E=-1;for(let H=0;H<g.length;H+=1){let z=R.plan(g[H]);if(!z.ok)return tt(g,H,z.error,I);if(N.push(z),z.kind==="command")if(E<0&&(E=H),z.lifecycle)L=z.ops[0]??null;else if(z.relate){let st=z.relate;P.push(vt=>{let pt=vt(st.url);return pt===null?null:st.ops(pt)});}else {let{ops:st}=z;P.push(()=>st);}else z.kind==="commentWrite"?(E<0&&(E=H),M.push(z.write),j=R.writeScope??{kind:"body"}):z.kind==="customNodeWrite"&&(E<0&&(E=H),U={write:z.write,scope:R.writeScope??{kind:"body"}});}let X=false;if(M.length>0){let H=e.applyCommentWrites(M,j??{kind:"body"});if(!H.ok)return tt(g,E<0?0:E,J("transaction-refused","the document store refused the comment write",H.reason),I);X=H.changed,Z=H.commentId;}if(U){let H=e.applyCustomNodeWrite(U.write,U.scope);if(!H.ok)return tt(g,E<0?0:E,J("transaction-refused","the document store refused the custom-node write",H.reason),I);X=H.changed;}if(L){let H=e.applyLifecycle(L);if(!H.ok)return tt(g,E<0?0:E,J("transaction-refused","the document store refused the transaction",H.reason),I);X=H.changed;}if(P.length>0){let H=e.apply(z=>{let st=[];for(let vt of P){let pt=vt(z);if(pt===null)return null;st.push(...pt);}return st},R.writeScope??{kind:"body"});if(!H.ok)return tt(g,E<0?0:E,nr(H.reason),I);X=H.changed;}let et=e.currentPackage();if(!et)return tt(g,0,J("document-unavailable","this host holds no document right now"),I);let At=m(et),Ot=R.settle(At);return Ot.ok?{ok:true,results:N.map(H=>({status:"ok",value:H.kind==="query"?H.value:H.kind==="customNodeWrite"?H.answer(At):H.answer(At,Z)})),revision:e.revision(),changed:X}:tt(g,E<0?0:E,J("transaction-refused","the transaction did not produce the document the batch planned",Ot.detail),e.revision())},save(){if(u)return {ok:false,error:J("disposed","this host was disposed")};if(!s.save)return {ok:false,error:J("unsupported-capability","this host cannot save","save")};let v=e.save();return v?{ok:true,bytes:v}:{ok:false,error:J("document-unavailable","this host holds no document right now")}},subscribe(v){return u||!s.events?()=>{}:(l.add(v),()=>{l.delete(v);})},dispose(){u||(u=true,l.clear(),k(),e.dispose(),f=null);}}}export{Ht as a,rr as b,qn as c,to as d,Yt as e,Gt as f,Ma as g};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunk3C533HSQ_cjs=require('./chunk-3C533HSQ.cjs');var Me=8;function ee(t,e){if(t===void 0||t.length===0)return null;let n=t[t.length-1],o=t.some(i=>i.kind==="delete"||i.kind==="moveFrom"),r=n.kind,a=r==="delete"||r==="moveFrom"?"line-through":r==="insert"||r==="moveTo"?"underline":null;return {attribution:n,line:o&&a==="underline"?"line-through":a,decorationStyle:r==="moveFrom"||r==="moveTo"?"double":r==="insert"?"dashed":"solid",color:o?"var(--doc-revision-deletion)":"var(--doc-revision-insertion)",authorColor:`var(--doc-review-author-${(0)%Me})`,deleted:o}}function te(t,e,n,o,r,a){for(let i of [n.footnotes,n.endnotes])i&&e.append(He(t,n,i,o,r,a));}function He(t,e,n,o,r,a){let i=t.createElement("div");if(i.className="docx-notes",i.dataset.docxNotes=n.kind,i.dataset.docxNotesPlacement=n.placement,i.style.position="absolute",i.style.left=`${(n.box.x-e.box.x)*o.scale}px`,i.style.top=`${(n.box.y-e.box.y)*o.scale}px`,i.style.width=`${n.box.width*o.scale}px`,i.style.height=`${n.box.height*o.scale}px`,n.separator){let s=t.createElement("div");s.className="docx-note-separator",s.dataset.docxNoteSeparator=n.separator.kind,s.setAttribute("contenteditable","false"),s.setAttribute("aria-hidden","true"),s.style.position="absolute",s.style.left=`${(n.separator.box.x-n.box.x)*o.scale}px`,s.style.top=`${(n.separator.box.y-n.box.y)*o.scale}px`,s.style.width=`${n.separator.box.width*o.scale}px`,s.style.height=`${Math.max(n.separator.box.height,.75)*o.scale}px`;let d=n.separator.ruleStyle;if(d||n.separator.synthetic||n.separator.fragments.length===0)Fe(s,t,d??"single",o.scale);else for(let l of n.separator.fragments)s.append(l.kind==="table"?a(t,l,o):r(t,l,o));i.append(s);}for(let s of n.notes){let d=t.createElement("div");d.className="docx-note",d.dataset.docxNote=s.noteKind,d.dataset.docxNoteId=String(s.noteId),d.dataset.docxNoteScope=s.scopeId,s.mark!==null&&(d.dataset.docxNoteMark=s.mark),s.continuation&&(d.dataset.docxNoteContinuation=""),d.setAttribute("role","doc-footnote"),d.style.position="absolute",d.style.left=`${(s.box.x-n.box.x)*o.scale}px`,d.style.top=`${(s.box.y-n.box.y)*o.scale}px`,d.style.width=`${s.box.width*o.scale}px`,d.style.height=`${s.box.height*o.scale}px`;for(let l of s.fragments)d.append(l.kind==="table"?a(t,l,o):r(t,l,o));i.append(d);}return i}function Fe(t,e,n,o){t.dataset.docxNoteRule=n;let r=Math.max(1,o*.75);if(n==="single"){t.style.borderTop=`${r}px solid currentColor`,t.style.opacity="0.85";return}t.style.opacity="0.85";let a=Math.max(1,o*1.25);for(let i of [0,r+a]){let s=e.createElement("div");s.setAttribute("aria-hidden","true"),s.style.position="absolute",s.style.left="0",s.style.right="0",s.style.top=`${i}px`,s.style.height="0",s.style.borderTop=`${r}px solid currentColor`,t.append(s);}}var ne=Object.freeze({"image/svg+xml":"SVG","image/tiff":"TIFF","image/x-emf":"EMF","image/x-wmf":"WMF",unknown:"Unknown"}),C=new WeakMap,O=new WeakMap,Ce=256;function re(t,e){let n=C.get(t);if(n)return n;let o=new Map,r=new Map;return n=Object.freeze({urlForReady(a,i){let s=o.get(a.resourceKey);if(s)return s;let d=e.create(a,i);return o.set(a.resourceKey,d),d},imageFor(a,i,s){let d=r.get(a);if(d&&d.resourceKey===i)return d.element;let l=s.createElement("img");return r.size<Ce&&r.set(a,{element:l,resourceKey:i,...d?.readyElement?{readyElement:d.readyElement}:{}}),l},imageForPending(a){return r.get(a)?.element??null},readyElementFor(a){return r.get(a)?.readyElement??null},rememberReadyElement(a,i){let s=r.get(a);s&&r.set(a,{...s,readyElement:i});},reconcile(a,i){for(let[s,d]of o)a.has(s)||(e.revoke(d),o.delete(s));for(let[s,d]of r)i.has(s)||(d.element.removeAttribute("src"),r.delete(s));},revokeAll(){for(let a of o.values())e.revoke(a);o.clear();for(let a of r.values())a.element.removeAttribute("src");r.clear();}}),C.set(t,n),n}function U(t,e){return `${e.paintInstance??""}|${t.drawingNodeId}`}function Ht(t){C.get(t)?.revokeAll(),C.delete(t);}function S(t){return Number.isFinite(t)?String(t):"0"}function ae(t,e){if(t.length<3||e.width<=0||e.height<=0)return null;let n=[];for(let o of t){if(!Number.isFinite(o.x)||!Number.isFinite(o.y))return null;let r=(o.x-e.x)/e.width*100,a=(o.y-e.y)/e.height*100;n.push(`${S(r)}% ${S(a)}%`);}return `polygon(${n.join(", ")})`}function ie(t){let e=t.geometry.contentBounds;return chunk3C533HSQ_cjs.pb({transform:t.transform,contentWidth:e.width,contentHeight:e.height})}function se(t){let{effects:e}=t,n=[];if(e.grayscale&&n.push("grayscale(1)"),e.brightness!==0&&Number.isFinite(e.brightness)){let o=1+e.brightness/100;Number.isFinite(o)&&n.push(`brightness(${S(Math.max(0,o))})`);}if(e.contrast!==0&&Number.isFinite(e.contrast)){let o=1+e.contrast/100;Number.isFinite(o)&&n.push(`contrast(${S(Math.max(0,o))})`);}return n.length>0?n.join(" "):void 0}function le(t,e){let{crop:n}=t,o=Math.max(0,Math.min(1,n.left)),r=Math.max(0,Math.min(1,n.top)),a=Math.max(0,Math.min(1,n.right)),i=Math.max(0,Math.min(1,n.bottom)),s=Math.max(1e-4,1-o-a),d=Math.max(1e-4,1-r-i);return Object.freeze({width:`${S(1/s*100)}%`,height:`${S(1/d*100)}%`,left:`${S(-o/s*100)}%`,top:`${S(-r/d*100)}%`})}function Ne(t,e){let{resource:n}=t;switch(n.kind){case "external":return e.externalResource;case "missing":return e.missingResource;case "pending":return e.pendingResource;case "unrenderable":switch(n.reason){case "unsupported-format":return e.unsupportedFormat(ne[n.mime]??ne.unknown);case "non-picture-graphic":return e.nonPictureGraphic(t.placeholderGraphicKind??"graphic");case "signature-mismatch":return e.contentMismatch;case "decode-failed":return e.decodeFailed;case "resource-limit":return e.resourceLimit;default:return e.invalidResource}default:return e.invalidResource}}function E(t,e,n){let{accessibility:o}=e;o.hidden||(t.setAttribute("role",n?"link":"img"),o.label?t.setAttribute("aria-label",o.label):n||t.setAttribute("aria-hidden","true"));}function I(t,e,n,o){let r=o?.x??0,a=o?.y??0;t.style.position="absolute",t.style.left=`${(e.x-r)*n}px`,t.style.top=`${(e.y-a)*n}px`,t.style.width=`${e.width*n}px`,t.style.height=`${e.height*n}px`,t.style.boxSizing="border-box",t.style.overflow="hidden",t.style.pointerEvents="auto";}function Be(t,e,n,o,r){let a=t.paintBounds,i=t.geometry.contentBounds,s=le(t);return [o,n.scale,r?.x??0,r?.y??0,a.x,a.y,a.width,a.height,i.x,i.y,i.width,i.height,ae(t.geometry.clipPolygon??[],a)??"",se(t)??"",ie(t)??"",s.width,s.height,s.left,s.top,n.inertLinks?"":t.hyperlinkHref??"",t.accessibility.label??""].join("|")}function k(t,e,n,o){let r=t.createElement("div");r.className="docx-drawing docx-drawing-placeholder",r.dataset.drawingNodeId=e.drawingNodeId,I(r,e.paintBounds,n.scale,o);let a=t.createElement("div");a.className="docx-drawing-placeholder-card";let i=t.createElement("span");return i.className="docx-drawing-placeholder-label",i.textContent=Ne(e,n.strings),a.append(i),r.append(a),e.hyperlinkHref&&!n.inertLinks?(r.dataset.docxDrawingLink=e.drawingNodeId,r.dataset.docxDrawingLinkKind="external",r.dataset.docxDrawingLinkHref=e.hyperlinkHref,r.setAttribute("tabindex","-1"),E(r,e,true)):E(r,e,false),r}function Oe(t,e,n,o,r,a){let i=e.resource;if(i.kind!=="ready")return k(t,e,n,a);let s=U(e,n),d=r?.readyElementFor?.(s)??t.createElement("div"),l=Be(e,i,n,o,a);if(O.get(d)===l)return d;d.className="docx-drawing docx-drawing-ready",d.style.cssText="",d.dataset.drawingNodeId=e.drawingNodeId,delete d.dataset.docxDrawingLink,delete d.dataset.docxDrawingLinkKind,delete d.dataset.docxDrawingLinkHref,d.removeAttribute("aria-hidden"),d.removeAttribute("aria-label"),d.removeAttribute("role"),d.removeAttribute("tabindex"),I(d,e.paintBounds,n.scale,a);let c=ae(e.geometry.clipPolygon??[],e.paintBounds);c&&(d.style.clipPath=c);let h=t.createElement("div");h.className="docx-drawing-image-frame",h.style.position="absolute";let y=e.geometry.contentBounds,p=e.paintBounds;h.style.left=`${(y.x-p.x)*n.scale}px`,h.style.top=`${(y.y-p.y)*n.scale}px`,h.style.width=`${y.width*n.scale}px`,h.style.height=`${y.height*n.scale}px`;let u=se(e);u&&(h.style.filter=u);let w=t.createElement("div");w.className="docx-drawing-transform-stage",w.style.position="relative",w.style.width="100%",w.style.height="100%";let D=ie(e);D&&(w.style.transform=D,w.style.transformOrigin="0 0");let R=t.createElement("div");R.className="docx-drawing-crop-viewport",R.style.position="relative",R.style.width="100%",R.style.height="100%",R.style.overflow="hidden";let v=r?.imageFor?.(s,i.resourceKey,t)??t.createElement("img");v.className="docx-drawing-image",v.setAttribute("draggable","false"),v.getAttribute("src")!==o&&v.setAttribute("src",o),v.setAttribute("alt","");let f=le(e);return v.style.position="absolute",v.style.width=f.width,v.style.height=f.height,v.style.left=f.left,v.style.top=f.top,v.style.maxWidth="none",v.style.maxHeight="none",R.append(v),w.append(R),h.append(w),d.replaceChildren(h),e.hyperlinkHref&&!n.inertLinks?(d.dataset.docxDrawingLink=e.drawingNodeId,d.dataset.docxDrawingLinkKind="external",d.dataset.docxDrawingLinkHref=e.hyperlinkHref,d.setAttribute("tabindex","-1"),E(d,e,true)):E(d,e,false),r?.rememberReadyElement?.(s,d),O.set(d,l),d}var oe="http://www.w3.org/2000/svg";function Ue(t,e,n,o){let r=e.vectorShape,a=t.createElement("div");a.className="docx-drawing docx-drawing-shape",a.dataset.drawingNodeId=e.drawingNodeId,I(a,e.paintBounds,n.scale,o);let i=e.geometry.contentBounds,s=e.paintBounds,d=t.createElement("div");d.className="docx-drawing-image-frame",d.style.position="absolute",d.style.left=`${(i.x-s.x)*n.scale}px`,d.style.top=`${(i.y-s.y)*n.scale}px`,d.style.width=`${i.width*n.scale}px`,d.style.height=`${i.height*n.scale}px`;let l=t.createElementNS(oe,"svg");l.setAttribute("viewBox",`0 0 ${S(Math.max(1,r.extentEmu.cx))} ${S(Math.max(1,r.extentEmu.cy))}`),l.setAttribute("preserveAspectRatio","none"),l.setAttribute("width","100%"),l.setAttribute("height","100%"),l.style.display="block";let c=t.createElementNS(oe,"path"),h=r.subpathsEmu.map(y=>`M${y.map(p=>`${S(p.x)} ${S(p.y)}`).join("L")}Z`).join("");return c.setAttribute("d",h),c.setAttribute("fill",r.fillHex!==null?`#${r.fillHex}`:"none"),c.setAttribute("fill-rule","evenodd"),r.strokeHex!==null&&(c.setAttribute("stroke",`#${r.strokeHex}`),c.setAttribute("stroke-width",S(Math.max(1,r.strokeWidthEmu)))),l.append(c),d.append(l),a.append(d),e.hyperlinkHref&&!n.inertLinks?(a.dataset.docxDrawingLink=e.drawingNodeId,a.dataset.docxDrawingLinkKind="external",a.dataset.docxDrawingLinkHref=e.hyperlinkHref,a.setAttribute("tabindex","-1"),E(a,e,true)):E(a,e,false),a}function ze(t,e,n,o,r){let a=o.scale,i=t.createElement("div");i.className="docx-drawing docx-drawing-textbox",i.dataset.drawingNodeId=e.drawingNodeId,i.setAttribute("contenteditable","false"),I(i,e.paintBounds,o.scale,r),i.style.overflow="hidden";let s=(e.x-e.paintBounds.x)*a,d=(e.y-e.paintBounds.y)*a;if(n.fillHex!==null||n.strokeHex!==null){let c=t.createElement("div");c.className="docx-drawing-textbox-box",c.style.position="absolute",c.style.left=`${s}px`,c.style.top=`${d}px`,c.style.width=`${e.width*a}px`,c.style.height=`${e.height*a}px`,c.style.boxSizing="border-box",n.fillHex!==null&&(c.style.backgroundColor=`#${n.fillHex}`),n.strokeHex!==null&&(c.style.border=`${Math.max(n.strokeWidthPt*a,.5)}px solid #${n.strokeHex}`),i.append(c);}let l=t.createElement("div");l.className="docx-drawing-textbox-content",l.style.position="absolute",l.style.left=`${s+n.contentOffset.x*a}px`,l.style.top=`${d+n.contentOffset.y*a}px`,l.style.width=`${n.contentWidth*a}px`,l.style.height=`${Math.max(0,n.contentHeight)*a}px`,l.style.overflow="hidden";for(let c of n.fragments)l.append(o.paintStoryFragment(t,c));for(let c of l.querySelectorAll("[data-paragraph-id]"))delete c.dataset.paragraphId;return i.append(l),E(i,e,false),i}function de(t,e,n,o,r){if(e.accessibility.hidden||e.paintBounds.width<=0||e.paintBounds.height<=0)return null;if(e.kind==="anchoredDrawing"&&e.textboxStory!==void 0&&n.paintStoryFragment!==void 0)return ze(t,e,e.textboxStory,n,r);if(e.vectorShape&&e.vectorShape.subpathsEmu.length>0)return Ue(t,e,n,r);let{resource:a}=e;if(a.kind==="ready"){if(!n.imageUrlPort||!o)return k(t,e,n,r);let i=o.urlForReady(a.validatedHandle,a.mime);return i?Oe(t,e,n,i,o,r):k(t,e,n,r)}if(a.kind==="pending"){let i=o?.readyElementFor?.(U(e,n))??o?.imageForPending?.(U(e,n))?.closest(".docx-drawing-ready");return i?(O.delete(i),i.dataset.drawingNodeId=e.drawingNodeId,I(i,e.paintBounds,n.scale,r),i):k(t,e,n,r)}return k(t,e,n,r)}function ce(t,e,n,o,r){let a=[];for(let i of e.drawings??[]){let s=de(t,i,n,o,r);s&&a.push(s);}return Object.freeze(a)}function ye(t,e,n,o,r,a){let i=[];for(let s of e){if(chunk3C533HSQ_cjs.qb(s)!==n)continue;let d=de(t,s,o,r,a);d&&(d.dataset.drawingLayer=n,i.push(d));}return Object.freeze(i)}function pe(t){let e=new Set,n=i=>{i.resource.kind==="ready"&&e.add(i.resource.resourceKey);},o=i=>{for(let s of i.drawings??[])n(s);},r=i=>{for(let s of i.lines)o(s);},a=i=>{if(i.kind==="table"){for(let s of i.rows)for(let d of s.cells)for(let l of d.blocks)a(l);return}r(i);};for(let i of t.pages){for(let s of i.anchoredDrawings??[])n(s);for(let s of i.fragments)a(s);for(let s of [i.header,i.footer])if(s){for(let d of s.anchoredDrawings??[])n(d);for(let d of s.fragments)a(d);}}return e}function he(t){let e=new Set,n=(r,a)=>{e.add(`p${r}|${a.drawingNodeId}`);},o=(r,a)=>{if(a.kind==="table"){for(let i of a.rows)for(let s of i.cells)for(let d of s.blocks)o(r,d);return}for(let i of a.lines)for(let s of i.drawings??[])n(r,s);};for(let r of t.pages){for(let a of r.anchoredDrawings??[])n(r.index,a);for(let a of r.fragments)o(r.index,a);for(let a of [r.header,r.footer])if(a){for(let i of a.anchoredDrawings??[])n(r.index,i);for(let i of a.fragments)o(r.index,i);}}return e}function ue(t){return [t.missingResource,t.externalResource,t.invalidResource,t.contentMismatch,t.decodeFailed,t.resourceLimit,t.pendingResource,t.unsupportedFormat("probe"),t.nonPictureGraphic("probe")].join("\0")}var z=Object.freeze({unsupportedFormat:t=>`Unsupported image format (${t})`,nonPictureGraphic:t=>`Unsupported graphic (${t})`,missingResource:"Image missing",externalResource:"External image not loaded",invalidResource:"Invalid image",contentMismatch:"Image content does not match its type",decodeFailed:"Image could not be decoded",resourceLimit:"Image exceeds size limits",pendingResource:"Loading image"});function Ft(t){return Object.freeze({unsupportedFormat:e=>t("image.unsupportedFormat",{format:e}),nonPictureGraphic:e=>t("image.nonPictureGraphic",{kind:e}),missingResource:t("image.missingResource"),externalResource:t("image.externalResource"),invalidResource:t("image.invalidResource"),contentMismatch:t("image.contentMismatch"),decodeFailed:t("image.decodeFailed"),resourceLimit:t("image.resourceLimit"),pendingResource:t("image.pendingResource")})}var _e=/^[0-9A-Fa-f]{6}$/;function Ke(t){switch(t){case "dashed":return "dashed";case "dotted":return "dotted";case "double":case "triple":return "solid";default:return "solid"}}function ge(t){return t&&_e.test(t)?t:"000000"}function _(t,e){let n=t.createElement("div");return n.className=e,n.setAttribute("aria-hidden","true"),n.setAttribute("contenteditable","false"),n.style.position="absolute",n.style.left="0",n.style.top="0",n.style.right="0",n.style.bottom="0",n.style.overflow="visible",n.style.pointerEvents="none",n.style.boxSizing="border-box",n}function N(t,e,n,o){if(!n)return;let r=`#${ge(n.color)}`,a=`${Math.max(0,n.widthPt*o)}px`;if(t.style[`border${e}Width`]=a,t.style[`border${e}Color`]=r,n.style==="double"||n.style==="triple"){t.style[`border${e}Style`]="none";return}t.style[`border${e}Style`]=Ke(n.style);}function K(t,e,n,o,r){let a=t.createElement("div");a.className=r,a.dataset.edge=n.side,a.dataset.stroke=n.role,a.style.position="absolute",a.style.left=`${n.x*o}px`,a.style.top=`${n.y*o}px`,a.style.width=`${n.width*o}px`,a.style.height=`${n.height*o}px`,a.style.pointerEvents="none",a.style.backgroundColor=`#${ge(n.color)}`,n.cssStyle!=="solid"&&(a.dataset.cssStyle=n.cssStyle),e.append(a);}function Ge(t){let e=new Set;for(let n of t)e.add(`${n.side}\0${n.role}`);return e}function je(t,e,n,o){let r=Ge(n),a=y=>r.has(`${y}\0middle`),i=_(t,"docx-table-border-double"),s=_(t,"docx-table-border-triple"),d=_(t,"docx-table-border-edge"),l=false,c=false,h=false;for(let y of n){if(y.role==="edge"){h=true,K(t,d,y,o,"docx-table-border-edge-stroke");continue}if(a(y.side)){c=true,K(t,s,y,o,"docx-table-border-triple-stroke");continue}(y.role==="outer"||y.role==="inner")&&(l=true,K(t,i,y,o,"docx-table-border-double-stroke"));}l&&e.append(i),c&&e.append(s),h&&e.append(d);}function xe(t,e,n,o){N(e,"Top",n?.top,o),N(e,"Right",n?.right,o),N(e,"Bottom",n?.bottom,o),N(e,"Left",n?.left,o),n?.strokes&&n.strokes.length>0&&je(t,e,n.strokes,o);}var G="when-selected",fe=new WeakMap,be=0;function We(t){let e=fe.get(t);return e||(be+=1,e=`alias${be}`,fe.set(t,e)),e}function Pe(t){return {...t,drawingStrings:t.drawingStrings??z,urlRegistry:t.urlRegistry??null}}function Ve(t){let e={...t,inertLinks:true};return Object.freeze({scale:t.scale,strings:t.drawingStrings,...t.imageUrlPort?{imageUrlPort:t.imageUrlPort}:{},...t.inertLinks?{inertLinks:true}:{},...t.paintInstance?{paintInstance:t.paintInstance}:{},paintStoryFragment:(n,o)=>o.kind==="table"?A(n,o,e):T(n,o,e)})}function Ee(t){return Object.freeze({ctx:Ve(t),urlRegistry:t.urlRegistry})}function me(t,e,n,o,r,a){B(t,e,chunk3C533HSQ_cjs.U(n),o,r,a);}function B(t,e,n,o,r,a,i=true){if(n.length===0)return;let s=Ee(o),d=t.createElement("div");d.className=a==="behind"?"docx-drawing-layer docx-drawing-layer-behind":"docx-drawing-layer docx-drawing-layer-front",d.style.position="absolute",d.style.inset="0",d.style.pointerEvents="none";for(let l of ye(t,n,a,s.ctx,s.urlRegistry,r)){if(l.style.pointerEvents=i?"auto":"none",!i)for(let c of l.querySelectorAll(".docx-drawing"))c.style.pointerEvents="none";d.append(l);}d.childElementCount>0&&e.append(d);}function Le(t){return t.horizontalFrame==="page"||t.verticalFrame==="page"}function ke(t,e,n){let o=e.paintBounds,r=e.horizontalFrame==="page"?n.x+(o.x-e.horizontalFrameOrigin):t.box.x+o.x,a=e.verticalFrame==="page"?n.y+(o.y-e.verticalFrameOrigin):t.box.y+o.y,i=r-o.x,s=a-o.y,d=l=>Object.freeze({x:l.x+i,y:l.y+s,width:l.width,height:l.height});return Object.freeze({...e,x:e.x+i,y:e.y+s,paintBounds:d(o),hitBounds:d(e.hitBounds),geometry:Object.freeze({...e.geometry,contentBounds:d(e.geometry.contentBounds),paintBounds:d(e.geometry.paintBounds),...e.geometry.clipPolygon?{clipPolygon:Object.freeze(e.geometry.clipPolygon.map(l=>Object.freeze({x:l.x+i,y:l.y+s})))}:{}})})}function Xe(t,e,n,o,r,a){let i=o.map(d=>ke(n,d,a)),s=t.createElement("div");s.className="docx-hf-behind-layer",s.dataset.docxHfBehind=n.kind,s.setAttribute("contenteditable","false"),s.style.position="absolute",s.style.inset="0",s.style.overflow="hidden",s.style.pointerEvents="none",B(t,s,i,r,a,"behind",false),s.childElementCount>0&&e.append(s);}function Ye(t,e,n,o,r,a,i,s=false){let d=o.filter(Le).map(l=>ke(n,l,a));B(t,e,d,r,a,i,s);}var L=/^[0-9A-Fa-f]{6}$/,ve=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u,qe=new Map(Object.entries({single:"solid",words:"solid",thick:"solid",double:"double",dotted:"dotted",dottedHeavy:"dotted",dash:"dashed",dashedHeavy:"dashed",dashLong:"dashed",dashLongHeavy:"dashed",dotDash:"dashed",dashDotHeavy:"dashed",dotDotDash:"dashed",dashDotDotHeavy:"dashed",wave:"wavy",wavyHeavy:"wavy",wavyDouble:"wavy"})),Ze=new Map(Object.entries({black:"#000000",blue:"#0000ff",cyan:"#00ffff",darkBlue:"#000080",darkCyan:"#008080",darkGray:"#808080",darkGreen:"#008000",darkMagenta:"#800080",darkRed:"#800000",darkYellow:"#808000",green:"#00ff00",lightGray:"#c0c0c0",magenta:"#ff00ff",red:"#ff0000",yellow:"#ffff00",white:"#ffffff"}));function Je(t){return t.doubleStrike?"double":t.strike?"single":"none"}function Qe(t){return t==="thick"||t.endsWith("Heavy")}function Ie(t){if(!t.underline)return null;let e=t.underline.color&&L.test(t.underline.color)?t.underline.color:null;return {cssStyle:qe.get(t.underline.variant)??"solid",color:e,heavy:Qe(t.underline.variant)}}function Te(t,e,n,o){t.textDecorationLine=e,t.textDecorationStyle=n,o.color&&(t.textDecorationColor=`#${o.color}`),o.heavy&&(t.textDecorationThickness=`max(${2*o.scale}px, 0.12em)`);}function we(t,e,n){e!=="none"&&Te(t,"line-through",e==="double"?"double":"solid",{scale:n});}function Re(t,e,n){Te(t,"underline",e.cssStyle,{color:e.color,heavy:e.heavy,scale:n});}function et(t,e,n){let o=e.color?`#${e.color}`:"currentColor";t.borderBottomWidth=`${(e.heavy?2:1)*n}px`,t.borderBottomStyle=e.cssStyle==="wavy"?"solid":e.cssStyle,t.borderBottomColor=o;}function j(t,e,n){let o=t.style,r=n.scale,a=e.verticalAlign==="baseline"?1:.75;o.fontSize=`${e.fontSizePt*a*r}px`,e.bold&&(o.fontWeight="bold"),e.italic&&(o.fontStyle="italic");let i=e.fontFamily&&ve.test(e.fontFamily)?e.fontFamily:n.defaultFontFamily&&ve.test(n.defaultFontFamily)?n.defaultFontFamily:null;if(i){let l=n.fontAlias?.(i);o.fontFamily=l?`"${l}", "${i}", ${chunk3C533HSQ_cjs.pd}`:`"${i}", ${chunk3C533HSQ_cjs.pd}`;}e.color&&L.test(e.color)&&(o.color=`#${e.color}`);let s=e.highlight?Ze.get(e.highlight):void 0;s?(o.backgroundColor=s,t.dataset.highlight=e.highlight??""):e.shading&&L.test(e.shading)&&(o.backgroundColor=`#${e.shading}`),e.caps&&(o.textTransform="uppercase"),e.smallCaps&&(o.fontVariant="small-caps");let d=chunk3C533HSQ_cjs.bb(e);d!==0&&(o.position="relative",o.top=`${-d*r}px`),e.characterSpacingPt!==0&&(o.letterSpacing=`${e.characterSpacingPt*r}px`),e.horizontalScalePercent!==100&&(o.transformOrigin="left",o.transform=`scaleX(${e.horizontalScalePercent/100})`);}function Ae(t,e,n,o,r){let a=n===" "?null:Ie(o),i=Je(o),s=e;if(a&&i!=="none"){let d=t.createElement("span");d.dataset.docxDeco="underline",Re(d.style,a,r);let l=t.createElement("span");l.dataset.docxDeco="strike",we(l.style,i,r),d.append(l),e.append(d),s=l;}else a?Re(e.style,a,r):i!=="none"&&we(e.style,i,r);s.textContent=n;}function P(t,e,n,o){let r=t.createElement(e);return r.style.position="absolute",r.style.left=`${n.x*o}px`,r.style.top=`${n.y*o}px`,r.style.width=`${n.width*o}px`,r.style.height=`${n.height*o}px`,r}function tt(t,e,n){let o=e.fieldAtom;!o||(t.dataset.fieldAtom=o.formField?"form":"field",!(o.formField?n.shadeFormFields!==false:(n.fieldShading??G)!=="never"))||(t.classList.add("docx-field-atom"),(o.formField||(n.fieldShading??G)==="always")&&t.classList.add("docx-field-atom--shaded"));}function nt(t,e){let n=chunk3C533HSQ_cjs.jb(e.props),o=ee(e.revisions);if(!(!o&&!n)){if(o){let{attribution:r}=o;t.classList.add("docx-revision",`docx-revision-${r.kind}`),t.dataset.revisionKind=r.kind,t.dataset.revisionId=r.id,t.dataset.revisionAuthor=r.author,r.date!==void 0&&(t.dataset.revisionDate=r.date),t.style.color=o.color,t.style.backgroundColor=o.deleted?"var(--doc-revision-deletion-wash)":"var(--doc-revision-insertion-wash)",o.line&&(t.style.textDecorationLine=o.line,t.style.textDecorationStyle=o.decorationStyle,t.style.textDecorationColor=o.color);return}t.classList.add("docx-revision","docx-revision-format"),t.dataset.revisionKind="format",t.dataset.revisionId=n.id,t.dataset.revisionAuthor=n.author,n.date!==void 0&&(t.dataset.revisionDate=n.date);}}function ot(t,e,n){let o=chunk3C533HSQ_cjs.gb(e),r=t.createElement("span");r.className=`docx-revision-pmark docx-revision-pmark-${o.kind}`,r.setAttribute("aria-hidden","true"),r.contentEditable="false",r.dataset.revisionKind=o.kind,r.dataset.revisionId=o.id,r.dataset.revisionAuthor=o.author,r.dataset.revisionIds=e.map(i=>i.id).join(" "),r.dataset.revisionKinds=e.map(i=>i.kind).join(" "),r.textContent="\xB6",r.style.position="absolute",r.style.pointerEvents="none",r.style.marginLeft=`${2*n}px`;let a=chunk3C533HSQ_cjs.hb(o);return r.style.color=a?"var(--doc-revision-deletion)":"var(--doc-revision-insertion)",a&&(r.style.textDecorationLine="line-through"),r}function rt(t,e,n){let o=[],r=e.lines[e.lines.length-1];for(let i of e.lines){let s=[...i.spans.flatMap(y=>y.revisions??[]),...i===r?e.markRevisions??[]:[]];if(s.length===0)continue;let d=s.some(y=>y.kind==="delete"||y.kind==="moveFrom"),l=i.box.y-e.box.y,c=l+i.box.height,h=o[o.length-1];if(h&&h.deleted===d&&l<=h.bottom+.5){h.bottom=Math.max(h.bottom,c);continue}o.push({top:l,bottom:c,deleted:d});}if(o.length===0)return null;let a=t.createElement("div");a.className="docx-change-bars",a.setAttribute("aria-hidden","true"),a.style.position="absolute",a.style.inset="0",a.style.pointerEvents="none";for(let i of o){let s=t.createElement("div");s.className=`docx-change-bar docx-change-bar-${i.deleted?"deletion":"insertion"}`,s.style.position="absolute",s.style.top=`${i.top*n}px`,s.style.height=`${(i.bottom-i.top)*n}px`,s.style.left=`${(-e.box.x-at)*n}px`,s.style.width=`${it*n}px`,s.style.pointerEvents="none",s.style.backgroundColor=i.deleted?"var(--doc-revision-deletion)":"var(--doc-revision-insertion)",a.append(s);}return a}var at=7.5,it=1.5;function st(t,e,n,o,r){let a=t.createElement("span");if(a.className="layout-run layout-run-text",a.style.display="inline-block",a.style.verticalAlign="baseline",a.style.boxSizing="border-box",a.style.height=`${o*n.scale}px`,a.style.paddingTop=`${r*n.scale}px`,a.style.lineHeight=`${(o-r)*n.scale}px`,e.range.end>e.range.start?(a.dataset.paragraphId=e.range.paragraphId,a.dataset.start=String(e.range.start),a.dataset.end=String(e.range.end)):(a.setAttribute("aria-hidden","true"),a.contentEditable="false"),j(a,e.style,n),tt(a,e,n),nt(a,e),(e.style.horizontalScalePercent!==100||e.text===" ")&&(a.style.width=`${e.box.width*n.scale}px`),e.text===" "){a.style.overflow="hidden",a.style.verticalAlign="top";let i=Ie(e.style);i&&(a.dataset.docxTabUnderline="",et(a.style,i,n.scale));}return Ae(t,a,e.text,e.style,n.scale),e.projected&&(a.dataset.docxField="",a.setAttribute("contenteditable","false"),e.noteNav?(a.style.userSelect="none",e.noteNav.direction==="to-note"?(a.dataset.docxNoteRef="",a.dataset.docxNoteScope=e.noteNav.scopeId,e.text.length>0&&a.setAttribute("aria-description",e.text)):(a.dataset.docxNoteMarkBack="",a.dataset.docxNoteScope=e.noteNav.scopeId)):(a.style.pointerEvents="none",a.style.userSelect="none")),a}function Se(t,e,n){let o=t.createElement("a");return o.className="docx-hyperlink",o.dataset.docxLink=e.id,o.dataset.docxLinkKind=e.kind,o.setAttribute("tabindex","-1"),!n.inertLinks&&e.href&&(o.setAttribute("href",e.href),e.kind==="external"&&o.setAttribute("rel","noopener noreferrer")),e.tooltip&&o.setAttribute("title",e.tooltip),o.style.display="inline-block",o.style.verticalAlign="baseline",o.style.textDecoration="none",o.style.color="inherit",o}function lt(t,e,n){let o=n.scale,r=t.createElement("div");r.className="docx-line layout-line",r.dataset.lineId=e.id,r.dataset.paragraphId=e.range.paragraphId,r.style.position="absolute",r.style.top=`${e.box.y*o}px`,r.style.left=`${e.contentX*o}px`,r.style.height=`${e.box.height*o}px`,r.style.fontSize="0",r.style.whiteSpace="pre",r.style.overflow="visible";let a=e.leading??0,i=Math.min(Math.max(a,...e.spans.map(f=>f.box.height+a),e.spans.length===0?e.box.height-(e.trailingSpacing??0):0),e.box.height),s=Math.max(0,e.box.height-i);r.style.boxSizing="border-box",r.style.paddingBottom=`${s*o}px`,r.style.lineHeight=`${(e.box.height-s)*o}px`;let d=null,l=null,c=null,h=new Map;for(let[f,b]of chunk3C533HSQ_cjs.gc(e).entries())h.set(b.paragraphId,f);let y=f=>h.get(f)??0,p=[...e.drawings??[]].sort((f,b)=>y(f.paragraphId)-y(b.paragraphId)||f.start-b.start),u=0,w=(f,b)=>{for(;u<p.length&&(y(p[u].paragraphId)<y(f)||y(p[u].paragraphId)===y(f)&&p[u].start<b);){let x=p[u],g=Math.max(0,x.advanceEnd-x.advanceStart),m=t.createElement("span");m.className="docx-inline-drawing-advance",m.dataset.docxMarker="",m.setAttribute("contenteditable","false"),m.setAttribute("aria-hidden","true"),m.style.display="inline-block",m.style.width=`${g*o}px`,m.style.height=`${x.baselineOffset*o}px`,m.style.lineHeight="0",m.style.pointerEvents="none",m.style.verticalAlign="baseline",r.append(m),u+=1,d=null,l=null;}},D=f=>{let b=f.wrapAdvanceBefore??0;if(b<=.001)return;let x=t.createElement("span");x.className="docx-wrap-advance",x.dataset.docxMarker="",x.setAttribute("contenteditable","false"),x.setAttribute("aria-hidden","true"),x.style.display="inline-block",x.style.width=`${b*o}px`,x.style.height="0",x.style.lineHeight="0",x.style.pointerEvents="none",x.style.verticalAlign="baseline",r.append(x),d=null,l=null;};for(let[f,b]of e.spans.entries()){w(b.range.paragraphId,b.range.start),D(b);let x=Math.min(b.box.height+a,e.box.height),g=st(t,b,n,x,a),m=dt(e,f);m>0&&(g.style.marginLeft=`${m*o}px`);let $=b.link;if(!$){d=null,l=null,c=null,r.append(g);continue}if(b.fieldAtom){d!==null&&l===$.id&&c===b.range.start||(d=Se(t,$,n),l=$.id,c=b.range.start,r.append(d)),d.append(g);continue}(!d||l!==$.id||c!==null)&&(d=Se(t,$,n),l=$.id,c=null,r.append(d)),d.append(g);}if(w(chunk3C533HSQ_cjs.gc(e)[chunk3C533HSQ_cjs.gc(e).length-1]?.paragraphId??e.range.paragraphId,Number.POSITIVE_INFINITY),e.spans.length===0){let f=t.createElement("br");f.style.lineHeight=`${e.box.height*o}px`,r.append(f);}let R=Object.freeze({x:e.contentX,y:e.box.y,width:e.box.width,height:e.box.height}),v=Ee(Pe(n));if(e.drawings&&e.drawings.length>0)for(let f of ce(t,e,v.ctx,v.urlRegistry,R))r.append(f);return r}function dt(t,e){if(e<=0)return 0;let n=t.spans[e-1],o=t.spans[e];if(t.drawings?.some(i=>i.start>=n.range.end&&i.start<o.range.start))return 0;let a=o.box.x-(n.box.x+n.box.width)-(o.wrapAdvanceBefore??0);return a>.25?a:0}function T(t,e,n){let o=n.scale,r=P(t,"div",e.box,o);r.className="docx-paragraph-fragment layout-paragraph",r.dataset.paragraphId=e.paragraphId,r.dataset.fragmentIndex=String(e.fragmentIndex),n.readOnlyParagraphIds?.has(e.paragraphId)&&(r.classList.add("docx-generated-region"),r.dataset.docxReadOnly="",r.setAttribute("contenteditable","false"),r.setAttribute("aria-readonly","true")),n.emptyTocPlaceholderIds?.has(e.paragraphId)&&(r.classList.add("docx-toc-empty-placeholder"),r.dataset.docxTocEmpty=""),e.shading&&L.test(e.shading)&&e.shadingBox&&r.append(ht(t,e,o)),e.marker&&r.append(ct(t,e,n));for(let i of e.lines)for(let s of i.spans){if(!s.tabLeader)continue;let d=pt(t,e,i,s,n);d&&r.append(d);}let a=rt(t,e,o);if(a&&r.append(a),e.markRevisions&&e.markRevisions.length>0){let i=ot(t,e.markRevisions,o),s=e.lines[e.lines.length-1];if(s){let d=s.spans[s.spans.length-1];i.style.top=`${(s.box.y-e.box.y)*o}px`,i.style.left=`${((d?d.box.x+d.box.width:s.contentX)-e.box.x)*o}px`,r.append(i);}}for(let i of e.lines){let s=lt(t,i,n);s.style.top=`${(i.box.y-e.box.y)*o}px`,s.style.left=`${(i.contentX-e.box.x)*o}px`,r.append(s);}if(e.borders)for(let i of e.borders)r.append($e(t,e,i,o));else e.bottomBorder&&r.append($e(t,e,{side:"bottom",edge:e.bottomBorder.edge,box:e.bottomBorder.box},o));return r}function ct(t,e,n){let o=e.marker,r=n.scale,a=e.lines[0]?.leading??0,i=P(t,"span",o.box,r);i.className="docx-list-marker",i.dataset.docxMarker="",i.setAttribute("contenteditable","false"),i.setAttribute("aria-hidden","true"),i.style.left=`${(o.box.x-e.box.x)*r}px`,i.style.top=`${(o.box.y-e.box.y)*r}px`,i.style.display="block",i.style.overflow="visible",i.style.whiteSpace="pre";let s=e.lines[0],d=s?Math.max(a,...s.spans.map(y=>y.box.height+a),s.spans.length===0?s.box.height-(s.trailingSpacing??0):0):o.box.height,l=Math.min(d,o.box.height),c=Math.max(0,o.box.height-l);i.style.fontSize="0",i.style.boxSizing="border-box",i.style.paddingBottom=`${c*r}px`,i.style.lineHeight=`${l*r}px`;let h=t.createElement("span");return h.style.display="inline-block",h.style.verticalAlign="baseline",h.style.boxSizing="border-box",h.style.height=`${l*r}px`,h.style.paddingTop=`${a*r}px`,h.style.lineHeight=`${(l-a)*r}px`,j(h,o.style,n),Ae(t,h,o.text,o.style,r),i.append(h),i}var yt=512;function pt(t,e,n,o,r){let a=o.tabLeader?chunk3C533HSQ_cjs.Da.get(o.tabLeader):void 0;if(!a||o.box.width<=0)return null;let i=r.scale,s=t.createElement("div");s.className="docx-tab-leader",s.dataset.docxTabLeader="",s.setAttribute("contenteditable","false"),s.setAttribute("aria-hidden","true"),s.style.position="absolute",s.style.left=`${(o.box.x-e.box.x)*i}px`,s.style.top=`${(n.box.y-e.box.y)*i}px`,s.style.width=`${o.box.width*i}px`,s.style.height=`${n.box.height*i}px`,s.style.overflow="hidden",s.style.whiteSpace="pre",s.style.pointerEvents="none",s.style.userSelect="none";let d=n.leading??0,l=Math.min(o.box.height+d,n.box.height),c=Math.max(0,n.box.height-l);s.style.fontSize="0",s.style.boxSizing="border-box",s.style.paddingBottom=`${c*i}px`,s.style.lineHeight=`${(n.box.height-c)*i}px`;let h=t.createElement("span");h.style.display="inline-block",h.style.verticalAlign="baseline",j(h,o.style,r),h.style.boxSizing="border-box",h.style.height=`${l*i}px`,h.style.paddingTop=`${d*i}px`,h.style.lineHeight=`${(l-d)*i}px`,o.tabLeader==="heavy"&&(h.style.fontWeight="bold");let y=o.tabLeaderAdvancePt&&o.tabLeaderAdvancePt>0?o.tabLeaderAdvancePt:Math.max(.5,o.style.fontSizePt*.2),p=Math.min(yt,Math.max(1,Math.floor(o.box.width/y)+2));return h.textContent=a.repeat(p),h.style.letterSpacing="0",s.append(h),s}function ht(t,e,n){let o=e.shadingBox,r=P(t,"div",o,n);return r.className="docx-paragraph-shading",r.setAttribute("aria-hidden","true"),r.style.left=`${(o.x-e.box.x)*n}px`,r.style.top=`${(o.y-e.box.y)*n}px`,r.style.backgroundColor=`#${e.shading}`,r}function $e(t,e,n,o){let r=P(t,"div",n.box,o);r.className=`docx-paragraph-border docx-paragraph-border-${n.side}`,r.setAttribute("aria-hidden","true");let a=(n.box.x-e.box.x)*o,i=(n.box.y-e.box.y)*o,s=n.side==="left"||n.side==="right"||n.side==="bar",d=(s?n.box.width:n.box.height)*o,c=ut(n.edge.val)?d:Math.max(1,d);r.style.left=`${n.side==="right"?a-(c-d):a}px`,r.style.top=`${n.side==="bottom"?i-(c-d):i}px`,s?r.style.width=`${c}px`:r.style.height=`${c}px`;let h=n.edge.color&&L.test(n.edge.color)?n.edge.color:"000000";return r.style.backgroundColor=`#${h}`,gt(r,n.edge.val,h,s,c,o),r}function ut(t){return t==="double"||t==="triple"||t==="doubleWave"||t.startsWith("thinThick")||t.startsWith("thickThin")}function gt(t,e,n,o,r,a){switch(e){case "dashed":case "dashSmallGap":case "dotDash":case "dotDotDash":case "dashDotStroked":{let i=Math.max(4,4*a);t.style.backgroundImage=`linear-gradient(to ${o?"bottom":"right"}, #${n} 60%, transparent 60%)`,t.style.backgroundSize=o?`100% ${i}px`:`${i}px 100%`;return}case "dotted":{let i=Math.max(3,3*a);t.style.backgroundImage=`linear-gradient(to ${o?"bottom":"right"}, #${n} 35%, transparent 35%)`,t.style.backgroundSize=o?`100% ${i}px`:`${i}px 100%`;return}case "double":case "doubleWave":case "triple":case "thinThickSmallGap":case "thickThinSmallGap":case "thinThickThinSmallGap":case "thinThickMediumGap":case "thickThinMediumGap":case "thinThickThinMediumGap":case "thinThickLargeGap":case "thickThinLargeGap":case "thinThickThinLargeGap":{let i=Math.max(1,r/3);t.style.backgroundColor="transparent",o?(t.style.borderLeft=`${i}px solid #${n}`,t.style.borderRight=`${i}px solid #${n}`):(t.style.borderTop=`${i}px solid #${n}`,t.style.borderBottom=`${i}px solid #${n}`),t.style.boxSizing="border-box";return}case "threeDEmboss":case "ridge":{t.style.backgroundColor="transparent";let i=o?"borderLeft":"borderTop";t.style[i]=`${Math.max(1,r)}px ridge #${n}`,o?t.style.width="0px":t.style.height="0px";return}case "threeDEngrave":case "groove":{t.style.backgroundColor="transparent";let i=o?"borderLeft":"borderTop";t.style[i]=`${Math.max(1,r)}px groove #${n}`,o?t.style.width="0px":t.style.height="0px";return}case "inset":{t.style.backgroundColor="transparent";let i=o?"borderLeft":"borderTop";t.style[i]=`${Math.max(1,r)}px inset #${n}`,o?t.style.width="0px":t.style.height="0px";return}case "outset":{t.style.backgroundColor="transparent";let i=o?"borderLeft":"borderTop";t.style[i]=`${Math.max(1,r)}px outset #${n}`,o?t.style.width="0px":t.style.height="0px";return}default:return}}function xt(t,e,n,o){let r=o.scale,a=P(t,"div",e.box,r);if(a.className="docx-table-cell",a.style.left=`${(e.box.x-n.x)*r}px`,a.style.top=`${(e.box.y-n.y)*r}px`,a.style.boxSizing="border-box",a.style.overflow="visible",a.dataset.cellId=e.id,a.dataset.gridColumn=String(e.gridColumn),a.dataset.gridSpan=String(e.gridSpan),e.rowSpan&&e.rowSpan>1&&(a.dataset.rowSpan=String(e.rowSpan)),e.paintInert||e.vMergeContinue)return a.dataset.vMergeContinue="true",a.style.border="none",a.style.backgroundColor="transparent",a;a.style.border="none",xe(t,a,e.borders,r),e.shading&&L.test(e.shading)&&(a.style.backgroundColor=`#${e.shading}`);for(let i of e.blocks){let s=i.kind==="table"?A(t,i,o):T(t,i,o);s.style.left=`${(i.box.x-e.box.x)*r}px`,s.style.top=`${(i.box.y-e.box.y)*r}px`,a.append(s);}return a}function A(t,e,n){let o=n.scale,r=P(t,"div",e.box,o);r.className="docx-table-fragment layout-table",r.dataset.tableId=e.tableId,r.dataset.fragmentIndex=String(e.fragmentIndex),r.style.overflow="visible";for(let a of e.rows){let i=P(t,"div",a.box,o);i.className="docx-table-row",a.revisionKind&&(i.classList.add("docx-table-row--revision",a.revisionKind==="insert"?"layout-revision-ins":"layout-revision-del"),i.dataset.revisionKind=a.revisionKind,a.revisionId!==void 0&&(i.dataset.revisionId=a.revisionId),a.revisionAuthor!==void 0&&(i.dataset.revisionAuthor=a.revisionAuthor),a.revisionDate!==void 0&&(i.dataset.revisionDate=a.revisionDate)),i.dataset.rowId=a.id,a.isHeaderRepeat&&(i.dataset.headerRepeat="true"),i.style.left=`${(a.box.x-e.box.x)*o}px`,i.style.top=`${(a.box.y-e.box.y)*o}px`,i.style.overflow="visible";for(let s of a.cells)i.append(xt(t,s,a.box,n));r.append(i);}return r}function ft(t,e,n,o){let r={...n,paintInstance:`p${e.index}`},a=P(t,"div",e.box,r.scale);if(a.className="docx-page",a.style.fontFamily=chunk3C533HSQ_cjs.pd,a.dataset.pageIndex=String(e.index),r.ariaHidden&&(a.setAttribute("aria-hidden","true"),a.setAttribute("role","presentation")),a.dataset.materialized=String(o),!o)return a;let i=Object.freeze({x:e.box.x,y:e.box.y,width:e.box.width,height:e.box.height}),s=Object.freeze({x:-(e.contentBox.x-e.box.x),y:-(e.contentBox.y-e.box.y),width:e.box.width,height:e.box.height});me(t,a,e,r,s,"behind");for(let l of [e.header,e.footer])l?.anchoredDrawings?.length&&Xe(t,a,l,l.anchoredDrawings,r,{x:e.box.x,y:e.box.y,width:e.box.width,height:e.box.height});let d=t.createElement("div");d.className="docx-page-content",d.style.position="absolute",d.style.left=`${(e.contentBox.x-e.box.x)*r.scale}px`,d.style.top=`${(e.contentBox.y-e.box.y)*r.scale}px`,d.style.width=`${e.contentBox.width*r.scale}px`,d.style.height=`${e.contentBox.height*r.scale}px`,r.activeHeaderFooterRId&&d.setAttribute("contenteditable","false");for(let l of e.columnSeparators??[]){let c=t.createElement("div");c.className="docx-column-separator",c.setAttribute("contenteditable","false"),c.style.position="absolute",c.style.left=`${l.x*r.scale}px`,c.style.top=`${l.y*r.scale}px`,c.style.width=`${l.width*r.scale}px`,c.style.height=`${l.height*r.scale}px`,c.style.backgroundColor="currentColor",c.style.pointerEvents="none",d.append(c);}for(let l of e.fragments)d.append(l.kind==="table"?A(t,l,r):T(t,l,r));a.append(d),me(t,a,e,r,s,"inFront"),te(t,a,e,r,T,A);for(let l of ["header","footer"]){if(e[l])continue;let c=t.createElement("div");c.className="docx-hf docx-hf--placeholder",c.dataset.docxHf=l,c.setAttribute("contenteditable","false");let h=l==="header"?e.contentBox.y-e.box.y:e.box.y+e.box.height-(e.contentBox.y+e.contentBox.height),y=Math.min(h,bt);if(y<=0)continue;let p=Math.max(0,Math.min(mt,h-y)),u=l==="header"?p:e.box.height-p-y;c.style.position="absolute",c.style.left=`${(e.contentBox.x-e.box.x)*r.scale}px`,c.style.top=`${u*r.scale}px`,c.style.width=`${e.contentBox.width*r.scale}px`,c.style.height=`${y*r.scale}px`,a.append(c);}for(let l of [e.header,e.footer]){if(!l)continue;let c=l.anchoredDrawings??[],h=!!r.activeHeaderFooterRId&&!!l.rId&&r.activeHeaderFooterRId===l.rId&&(r.activeHeaderFooterPageIndex===void 0||r.activeHeaderFooterPageIndex===e.index),y=t.createElement("div");y.className="docx-hf",y.dataset.docxHf=l.kind,l.rId&&(y.dataset.docxRId=l.rId),h?(y.dataset.docxHfActive="",y.setAttribute("contenteditable","true")):y.setAttribute("contenteditable","false"),y.style.position="absolute",y.style.left=`${(l.box.x-e.box.x)*r.scale}px`,y.style.top=`${(l.box.y-e.box.y)*r.scale}px`,y.style.width=`${l.box.width*r.scale}px`;let p=h?l.kind==="footer"?Math.max(l.box.height,e.box.y+e.box.height-l.box.y):Math.max(l.box.height,e.contentBox.y-l.box.y):l.box.height;y.style.height=`${p*r.scale}px`,y.style.overflow="visible";let u=(e.box.x-l.box.x)*r.scale,w=(e.box.y-l.box.y)*r.scale,D=u+e.box.width*r.scale,R=w+e.box.height*r.scale;y.style.clipPath=`polygon(${u}px ${w}px, ${D}px ${w}px, ${D}px ${R}px, ${u}px ${R}px)`;let v=Object.freeze({x:0,y:0,width:l.box.width,height:l.box.height}),f=c.filter(g=>!Le(g)),b={...r,inertLinks:true};for(let g of l.fragments)y.append(g.kind==="table"?A(t,g,b):T(t,g,b));B(t,y,f,Pe(r),v,"inFront",h),a.append(y);let x=t.createElement("div");x.className="docx-hf-edit-hint",x.dataset.docxHfHint=l.kind,x.setAttribute("contenteditable","false"),x.style.position="absolute",x.style.left=y.style.left,x.style.width=y.style.width,x.style.top=l.kind==="header"?`${(l.box.y+l.box.height-e.box.y)*r.scale}px`:`${(l.box.y-e.box.y)*r.scale}px`,l.kind==="footer"&&(x.style.transform="translateY(-100%)"),a.append(x),Ye(t,a,l,c,r,i,"inFront",h);}return Rt(t,a,e,r),a}var bt=30,mt=36,vt=16,wt=new Set(["dropdown","comboBox","date","checkbox"]);function Rt(t,e,n,o){let r=o.contentControlChrome,a=r?.suppressedIds,i=(n.contentControls??[]).filter(y=>a?.has(y.id)!==true),s=[...i,...(r?.additionalBoundaries??[]).filter(y=>a?.has(y.id)!==true&&!i.some(p=>p.id===y.id))];if(s.length===0)return;let d=r?.showAll===true,l=r?.activeIds,c=r?.hoverIds,h=r?.tocControlIds;for(let y of s){let p=h?.has(y.id)===true,u=!p&&l?.has(y.id)===true,w=c?.has(y.id)===true;e.append(St(t,n,y,o.scale,u,w,d||u||p&&w,r?.checkedIds?.has(y.id),p));}}function St(t,e,n,o,r,a,i,s,d){let l=t.createElement("div");l.className="docx-content-control-chrome",l.dataset.docxContentControl=n.id,l.dataset.docxMarker="",l.dataset.controlType=n.controlType,l.dataset.lock=n.effectiveLock,n.bound&&(l.dataset.bound=""),n.placeholder&&(l.dataset.placeholder=""),d&&(l.dataset.docxToc=""),r&&(l.dataset.active=""),a&&(l.dataset.hover=""),i&&(l.dataset.boundaryVisible=""),l.setAttribute("contenteditable","false"),l.setAttribute("role","group"),n.alias&&(l.dataset.alias=n.alias),n.tag&&(l.dataset.tag=n.tag),n.alias&&l.setAttribute("aria-label",n.alias),l.style.position="absolute",l.style.inset="0",l.style.pointerEvents="none",l.style.zIndex="2";let c=e.contentBox.x-e.box.x,h=e.contentBox.y-e.box.y;for(let p of n.fragments){if(p.pageIndex!==e.index)continue;let u=t.createElement("div");u.className="docx-content-control-boundary",u.dataset.docxMarker="",u.setAttribute("contenteditable","false"),u.setAttribute("aria-hidden","true"),u.style.position="absolute",u.style.left=`${(c+p.box.x)*o}px`,u.style.top=`${(h+p.box.y)*o}px`,u.style.width=`${Math.max(p.box.width,1)*o}px`,u.style.height=`${Math.max(p.box.height,1)*o}px`,u.style.pointerEvents="none",l.append(u);}let y=n.fragments.find(p=>p.pageIndex===e.index);if(y&&n.alias){let p=t.createElement("div");p.className="docx-content-control-label",p.dataset.docxMarker="",p.setAttribute("contenteditable","false"),p.setAttribute("aria-hidden","true"),p.textContent=n.alias,p.style.position="absolute",p.style.left=`${(c+y.box.x)*o}px`,p.style.top=`${Math.max(0,(h+y.box.y)*o-vt)}px`,p.style.pointerEvents="none",l.append(p);}if(y&&wt.has(n.controlType)){let p=t.createElement("button");p.type="button",p.className="docx-content-control-widget",p.dataset.docxMarker="",p.dataset.docxCcWidget=n.controlType,p.dataset.docxCcId=n.id,p.setAttribute("contenteditable","false"),p.setAttribute("tabindex","-1"),n.controlType==="checkbox"?p.setAttribute("role","checkbox"):n.controlType==="dropdown"||n.controlType==="comboBox"?p.setAttribute("role","listbox"):n.controlType==="date"&&p.setAttribute("role","button"),n.alias&&(p.dataset.name=n.alias),n.alias&&p.setAttribute("aria-label",n.alias),n.controlType==="checkbox"&&(p.setAttribute("data-checked",s?"true":"false"),p.setAttribute("aria-checked",s?"true":"false")),(n.effectiveLock==="contentLocked"||n.effectiveLock==="sdtContentLocked"||n.bound)&&(p.disabled=true,p.dataset.disabledReason=n.bound?"bound":"locked",p.setAttribute("aria-disabled","true")),p.style.position="absolute",p.style.left=`${(c+y.box.x+y.box.width)*o-18}px`,p.style.top=`${(h+y.box.y)*o}px`,p.style.width="16px",p.style.height="16px",p.style.pointerEvents="auto",p.style.padding="0",p.style.margin="0",p.style.cursor=p.disabled?"not-allowed":"pointer",l.append(p);}return l}var De=new WeakMap;function $t(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Dt(t,e,n,o){let r=t.element;return !t.materialized&&$t(t.record.box,e.box)&&r.style.left===`${e.box.x*n}px`&&r.style.top===`${e.box.y*n}px`&&r.style.width===`${e.box.width*n}px`&&r.style.height===`${e.box.height*n}px`&&r.getAttribute("aria-hidden")===(o?"true":null)}function Pt(t,e,n={}){let o=n.contentControlChrome,r=o?`${o.showAll===true?"1":"0"}:${o.activeIds?[...o.activeIds].sort().join(","):""}:${o.checkedIds?[...o.checkedIds].sort().join(","):""}:${o.tocControlIds?[...o.tocControlIds].sort().join(","):""}:${o.suppressedIds?[...o.suppressedIds].sort().join(","):""}`:"",a=n.drawingStrings??z,i=n.imageUrlPort!==void 0?re(t,n.imageUrlPort):null,s=o?.additionalBoundaries?o.additionalBoundaries.flatMap(g=>g.fragments.map(m=>`${g.id}:${m.pageIndex}:${m.box.x}:${m.box.y}:${m.box.width}:${m.box.height}`)).sort().join(","):"",d=n.readOnlyParagraphIds?[...n.readOnlyParagraphIds].sort().join(","):"",l=n.emptyTocPlaceholderIds?[...n.emptyTocPlaceholderIds].sort().join(","):"",c=o?.tocControlIds?[...o.tocControlIds].sort().join(","):"",h={scale:n.scale??96/72,ariaHidden:n.ariaHidden??true,drawingStrings:a,urlRegistry:i,...n.fontAlias?{fontAlias:n.fontAlias}:{},...n.readOnlyParagraphIds?{readOnlyParagraphIds:n.readOnlyParagraphIds}:{},...n.emptyTocPlaceholderIds?{emptyTocPlaceholderIds:n.emptyTocPlaceholderIds}:{},...n.defaultFontFamily?{defaultFontFamily:n.defaultFontFamily}:{},...n.fieldShading?{fieldShading:n.fieldShading}:{},...n.shadeFormFields!==void 0?{shadeFormFields:n.shadeFormFields}:{},...n.imageUrlPort?{imageUrlPort:n.imageUrlPort}:{},...n.activeHeaderFooterRId?{activeHeaderFooterRId:n.activeHeaderFooterRId}:{},...n.activeHeaderFooterPageIndex!==void 0?{activeHeaderFooterPageIndex:n.activeHeaderFooterPageIndex}:{},...o?{contentControlChrome:o}:{}},y=t.ownerDocument,p=`${h.scale}|${h.ariaHidden}|${h.fontAlias?We(h.fontAlias):""}|${h.defaultFontFamily??""}|${h.activeHeaderFooterRId??""}|${h.activeHeaderFooterPageIndex??""}|cc:${r}:${s}|toc:${c}|ro:${d}|tocEmpty:${l}|${n.imageUrlPort?"url":""}|${ue(a)}`,u=De.get(t),D=u?.parameters===p?new Map(u.pages.map(g=>[g.record,g])):null,R=u?new Map(u.pages.map(g=>[g.record.index,g])):null,v=e.pages.map(g=>{let m=n.materialize?.has(g.index)??true,$=D?.get(g);if($&&$.materialized===m)return $;let M=m?null:R?.get(g.index);return M&&Dt(M,g,h.scale,h.ariaHidden)?{record:g,materialized:false,element:M.element}:{record:g,materialized:m,element:ft(y,g,h,m)}});De.set(t,{parameters:p,pages:v}),t.dataset.revision=String(e.revision),i&&i.reconcile(pe(e),he(e));let f=new Set(v.map(g=>g.element)),b=t.firstChild;for(;b;){let g=b.nextSibling;f.has(b)||b.remove(),b=g;}let x=t.firstChild;for(let g of v){if(g.element===x){x=x.nextSibling;continue}t.insertBefore(g.element,x);}}function Et(t,e,n,o){let r=t.ownerDocument,a=o.scale,i=[];for(let s of n){let d=e.pages[s.pageIndex];if(!d)continue;let l=r.createElement("div");l.className=s.className??o.className??"docx-cell-selection-rect",l.style.position="absolute";let c=o.pageOffsetX?.get(s.pageIndex)??0;l.style.left=`${(d.contentBox.x+s.x+c)*a}px`,l.style.top=`${(d.contentBox.y+s.y)*a}px`,l.style.width=`${s.width*a}px`,l.style.height=`${s.height*a}px`,i.push(l);}t.replaceChildren(...i);}
|
|
2
|
+
exports.a=Ht;exports.b=z;exports.c=Ft;exports.d=G;exports.e=Pt;exports.f=Et;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
'use strict';var chunkIJ4V3LGV_cjs=require('./chunk-IJ4V3LGV.cjs'),chunkJDHTCMFA_cjs=require('./chunk-JDHTCMFA.cjs'),chunk2GSRLGUI_cjs=require('./chunk-2GSRLGUI.cjs'),prosemirrorModel=require('prosemirror-model'),prosemirrorState=require('prosemirror-state'),prosemirrorView=require('prosemirror-view'),prosemirrorKeymap=require('prosemirror-keymap'),prosemirrorCommands=require('prosemirror-commands');function j(t){return t.attributes?.val}function H(t){let e=j(t);return e===void 0||!(e==="0"||e==="false"||e==="off")}var Rn=/^[0-9A-Fa-f]{6}$/,ye=/^\d{1,6}$/,In=/^-?\d{1,6}$/;function Le(t){return t===void 0||t==="auto"?null:Rn.test(t)?`#${t}`:null}var Tn={single:"solid",words:"solid",thick:"solid",double:"double",dotted:"dotted",dottedHeavy:"dotted",dash:"dashed",dashedHeavy:"dashed",dashLong:"dashed",dashLongHeavy:"dashed",dotDash:"dashed",dashDotHeavy:"dashed",dotDotDash:"dashed",dashDotDotHeavy:"dashed",wave:"wavy",wavyHeavy:"wavy",wavyDouble:"wavy"},Nn={black:"#000000",blue:"#0000ff",cyan:"#00ffff",darkBlue:"#000080",darkCyan:"#008080",darkGray:"#808080",darkGreen:"#008000",darkMagenta:"#800080",darkRed:"#800000",darkYellow:"#808000",green:"#00ff00",lightGray:"#c0c0c0",magenta:"#ff00ff",red:"#ff0000",yellow:"#ffff00",white:"#ffffff"};function En(t){return !t||!/^[\w \-.+]{1,64}$/.test(t)?null:`"${t}"`}function Y(t,e=false){return t===void 0||!(e?In:ye).test(t)?null:`${Number(t)/20}pt`}function $t(t){let e=[],n=[],o=null,s=null;for(let l of t)switch(l.localName){case "b":e.push(`font-weight:${H(l)?"bold":"normal"}`);break;case "i":e.push(`font-style:${H(l)?"italic":"normal"}`);break;case "u":{let r=j(l)??"single";if(r==="none"||!H(l))break;n.push("underline"),o=Tn[r]??"solid",s=Le(l.attributes?.color);break}case "strike":H(l)&&n.push("line-through");break;case "dstrike":H(l)&&n.push("line-through");break;case "caps":H(l)&&e.push("text-transform:uppercase");break;case "smallCaps":H(l)&&e.push("font-variant:small-caps");break;case "vertAlign":{let r=j(l);r==="superscript"?e.push("vertical-align:super","font-size:0.75em"):r==="subscript"&&e.push("vertical-align:sub","font-size:0.75em");break}case "color":{let r=Le(j(l));r&&e.push(`color:${r}`);break}case "highlight":{let r=Nn[j(l)??""];r&&e.push(`background-color:${r}`);break}case "sz":{let r=j(l);r!==void 0&&ye.test(r)&&e.push(`font-size:${Number(r)/2}pt`);break}case "rFonts":{let r=En(l.attributes?.ascii??l.attributes?.hAnsi);r&&e.push(`font-family:${r}`);break}case "spacing":{let r=Y(j(l),true);r&&e.push(`letter-spacing:${r}`);break}}return n.length>0&&(e.push(`text-decoration-line:${[...new Set(n)].join(" ")}`),o&&e.push(`text-decoration-style:${o}`),s&&e.push(`text-decoration-color:${s}`)),e.join(";")}var Dn={left:"left",start:"left",right:"right",end:"right",center:"center",both:"justify",distribute:"justify"};function zt(t){let e=[];for(let n of t)switch(n.localName){case "jc":{let o=Dn[j(n)??""];o&&e.push(`text-align:${o}`);break}case "ind":{let o=Y(n.attributes?.left??n.attributes?.start,true),s=Y(n.attributes?.right??n.attributes?.end,true),l=Y(n.attributes?.firstLine),r=Y(n.attributes?.hanging);o&&e.push(`margin-left:${o}`),s&&e.push(`margin-right:${s}`),l?e.push(`text-indent:${l}`):r&&e.push(`text-indent:-${r}`);break}case "spacing":{let o=Y(n.attributes?.before),s=Y(n.attributes?.after);o&&e.push(`margin-top:${o}`),s&&e.push(`margin-bottom:${s}`);let l=n.attributes?.line,r=n.attributes?.lineRule;l!==void 0&&ye.test(l)&&r!=="exact"&&r!=="atLeast"?e.push(`line-height:${(Number(l)/240).toFixed(3)}`):l!==void 0&&ye.test(l)&&e.push(`line-height:${Number(l)/20}pt`);break}case "shd":{let o=Le(n.attributes?.fill);o&&e.push(`background-color:${o}`);break}case "pageBreakBefore":H(n)&&e.push("break-before:page");break;}return e.join(";")}var E=new prosemirrorModel.Schema({nodes:{doc:{content:"paragraph+"},paragraph:{content:"inline*",group:"block",attrs:{nodeId:{default:null},props:{default:[]}},toDOM:t=>{let e=zt(t.attrs.props??[]);return ["p",{"data-node-id":String(t.attrs.nodeId??""),...e?{style:e}:{}},0]},parseDOM:[{tag:"p",getAttrs:t=>typeof t=="string"?null:{nodeId:t.getAttribute("data-node-id")||null,props:[]}}]},text:{group:"inline"},tab:{inline:true,group:"inline",atom:true,selectable:false,toDOM:()=>["span",{"data-token":"tab",class:"docx-tab"},"\u2192"],parseDOM:[{tag:'span[data-token="tab"]'}]},hardBreak:{inline:true,group:"inline",atom:true,selectable:false,toDOM:()=>["br"],parseDOM:[{tag:"br"}]},pageBreak:{inline:true,group:"inline",atom:true,selectable:false,toDOM:()=>["span",{"data-token":"page-break",class:"docx-page-break"}],parseDOM:[{tag:'span[data-token="page-break"]'}]},unknownInline:{inline:true,group:"inline",atom:true,selectable:false,draggable:false,attrs:{nodeId:{default:null},label:{default:""}},toDOM:t=>["span",{"data-token":"unknown","data-node-id":String(t.attrs.nodeId??""),contenteditable:"false",class:"docx-unknown-inline",title:String(t.attrs.label||"Content this editor cannot edit yet. It is preserved.")}],parseDOM:[{tag:'span[data-token="unknown"]',getAttrs:t=>typeof t=="string"?false:{nodeId:t.getAttribute("data-node-id")||null,label:""}}]}},marks:{runProps:{attrs:{props:{default:[]}},excludes:"runProps",toDOM:t=>{let e=t.attrs.props??[],n=$t(e);return ["span",{"data-run-props":Mn(e),...n?{style:n}:{}},0]},parseDOM:[{tag:"span[data-run-props]",getAttrs:t=>{if(typeof t=="string")return false;let e=wn(t.getAttribute("data-run-props"));return e?{props:e}:false}}]}}});function Mn(t){return JSON.stringify(Array.isArray(t)?t:[])}function wn(t){if(!t)return null;try{let e=JSON.parse(t);if(!Array.isArray(e))return null;let n=[];for(let o of e){if(typeof o!="object"||o===null)return null;let s=o;if(typeof s.localName!="string"||s.attributes!==void 0&&(typeof s.attributes!="object"||s.attributes===null))return null;n.push(s.attributes===void 0?{localName:s.localName}:{localName:s.localName,attributes:s.attributes});}return n}catch{return null}}function _e(t){for(let e of t.marks)if(e.type.name==="runProps")return e.attrs.props??[];return []}function he(t,e){return JSON.stringify(ke(t))===JSON.stringify(ke(e))}function ke(t){return [...t].map(e=>({localName:e.localName,attributes:Object.fromEntries(Object.entries(e.attributes??{}).sort(([n],[o])=>n<o?-1:1))})).sort((e,n)=>e.localName<n.localName?-1:1)}function Be(t){if(!t||t.kind==="textValue")return [];let e=[];for(let n of t.children){if(n.kind==="textValue")continue;let o={};for(let s of n.attributes)o[s.localName]=s.value;e.push(Object.keys(o).length>0?{localName:n.localName,attributes:o}:{localName:n.localName});}return e}function Ut(t){return t.kind==="textValue"?"":`${{drawing:"Picture",pict:"Picture",object:"Embedded object",fldSimple:"Field",hyperlink:"Hyperlink",sdt:"Content control",tbl:"Table"}[t.localName]??t.localName} \u2014 preserved, not editable yet`}function X(t){if(t.kind==="textValue")return [];let e=[],n=o=>{if(o.kind!=="run")return;let s=o.children.find(r=>r.kind==="runProperties"),l=Be(s);for(let r of o.children)if(r.kind!=="runProperties"){if(r.kind==="tab"){e.push({kind:"tab"});continue}if(r.kind==="hardBreak"){e.push(chunk2GSRLGUI_cjs.Zb(r)?{kind:"pageBreak"}:{kind:"hardBreak"});continue}if(r.kind==="text"){let p="";for(let m of r.children)m.kind==="textValue"&&(p+=m.value);p.length>0&&e.push({kind:"text",text:p,props:l});continue}e.push({kind:"unknown",nodeId:r.id,label:Ut(r)});}};return chunk2GSRLGUI_cjs.Sb(t.children,0,o=>{if(o.kind==="run"){n(o);return}e.push({kind:"unknown",nodeId:o.id,label:Ut(o)});}),e}function M(t){let e=[],n=o=>{if(o.kind!=="textValue"){if(o.kind==="body"){for(let s of o.children)s.kind==="paragraph"&&e.push(s);return}for(let s of o.children)n(s);}};return n(t.root),e}function $(t){let e=[];for(let n of chunk2GSRLGUI_cjs.De(t))n.root.kind!=="textValue"&&chunk2GSRLGUI_cjs.Ge(n.root.children,e,0);return e}function G(t){let e=M(t).map(n=>{let o=n.kind==="textValue"?void 0:n.children.find(l=>l.kind==="paragraphProperties"),s=X(n).map(l=>{switch(l.kind){case "text":return E.text(l.text,l.props.length>0?[E.marks.runProps.create({props:l.props})]:[]);case "tab":return E.node("tab");case "hardBreak":return E.node("hardBreak");case "pageBreak":return E.node("pageBreak");default:return E.node("unknownInline",{nodeId:l.nodeId,label:l.label})}});return E.node("paragraph",{nodeId:n.id,props:Be(o)},s)});return E.node("doc",null,e.length>0?e:[E.node("paragraph")])}function Q(t){let e=[];return t.forEach(n=>{if(n.isText&&n.text){e.push({kind:"text",text:n.text,props:_e(n)});return}n.type.name==="tab"?e.push({kind:"tab"}):n.type.name==="hardBreak"?e.push({kind:"hardBreak"}):n.type.name==="pageBreak"?e.push({kind:"pageBreak"}):n.type.name==="unknownInline"&&e.push({kind:"unknown",nodeId:String(n.attrs.nodeId??""),label:String(n.attrs.label??"")});}),e}function D(t){let e="";for(let n of t)n.kind==="text"?e+=n.text:n.kind==="tab"?e+=" ":n.kind==="hardBreak"?e+=`
|
|
2
|
+
`:n.kind==="pageBreak"&&(e+=chunk2GSRLGUI_cjs.Xb);return e}function Wt(t){let e=[],n=0;for(let o of t)o.kind==="text"?n+=o.text.length:o.kind==="tab"||o.kind==="hardBreak"||o.kind==="pageBreak"?n+=1:e.push(`${o.nodeId}@${n}`);return e}function Fn(t,e){if(t===e)return null;let n=0,o=Math.min(t.length,e.length);for(;n<o&&t[n]===e[n];)n+=1;let s=t.length,l=e.length;for(;s>n&&l>n&&t[s-1]===e[l-1];)s-=1,l-=1;return {start:n,endBefore:s,endAfter:l}}function Yt(t){let e=[];for(let n of t)if(n.kind==="text")for(let o=0;o<n.text.length;o+=1)e.push(n.props);else (n.kind==="tab"||n.kind==="hardBreak"||n.kind==="pageBreak")&&e.push(e[e.length-1]??[]);return e}function An(t,e,n,o,s){let l=[],r=Wt(e),p=Wt(n);if(JSON.stringify(r)!==JSON.stringify(p))return {ok:false,reason:"unknown-content-moved",detail:t};he(o,s)||l.push({op:"setParagraphProperties",paragraphId:t,properties:ke(s)});let m=D(e),f=D(n),h=Fn(m,f);if(h&&(h.endBefore>h.start&&l.push({op:"deleteText",paragraphId:t,start:h.start,end:h.endBefore}),h.endAfter>h.start)){let b=f.slice(h.start,h.endAfter),g=h.start,i="",y=()=>{i.length!==0&&(l.push({op:"insertText",paragraphId:t,offset:g,text:i}),g+=i.length,i="");};for(let k of b)k===" "?(y(),l.push({op:"insertTab",paragraphId:t,offset:g}),g+=1):k===`
|
|
3
|
+
`?(y(),l.push({op:"insertHardBreak",paragraphId:t,offset:g}),g+=1):k===chunk2GSRLGUI_cjs.Xb?(y(),l.push({op:"insertPageBreak",paragraphId:t,offset:g}),g+=1):i+=k;y();}if(!h){let b=Yt(e),g=Yt(n),i=0;for(;i<g.length;){if(he(b[i]??[],g[i])){i+=1;continue}let y=i,k=g[i];for(;i<g.length&&he(g[i],k)&&!he(b[i]??[],g[i]);)i+=1;l.push({op:"setRunProperties",paragraphId:t,start:y,end:i,properties:ke(k)});}}return {ok:true,ops:l}}function He(t,e){let n=M(t),o=[];if(e.forEach(l=>{l.type.name==="paragraph"&&o.push(l);}),o.length!==e.childCount)return {ok:false,reason:"unsupported-node"};let s=o.length-n.length;if(s===0){let l=[];for(let[r,p]of o.entries()){let m=n[r];if(p.attrs.nodeId!==m.id)return {ok:false,reason:"paragraph-reordered",detail:String(p.attrs.nodeId)};let f=An(m.id,X(m),Q(p),Be(m.kind==="textValue"?void 0:m.children.find(h=>h.kind==="paragraphProperties")),p.attrs.props??[]);if(!f.ok)return f;l.push(...f.ops);}return {ok:true,ops:l}}return s===1?Ln(n,o):s===-1?_n(n,o):{ok:false,reason:"paragraph-count-unexplained",detail:String(s)}}function Ln(t,e){for(let n=0;n<t.length;n+=1){let o=t[n],s=e[n],l=e[n+1];if(!s||!l||s.attrs.nodeId!==o.id)continue;let r=l.attrs.nodeId;if(r!==null&&r!==o.id)continue;let p=D(Q(s));if(p+D(Q(l))===D(X(o))&&Gt(t,e,n)&&Xt(t,e,n+1,n+2))return {ok:true,ops:[{op:"splitParagraph",paragraphId:o.id,offset:p.length}]}}return {ok:false,reason:"split-not-clean"}}function _n(t,e){for(let n=0;n+1<t.length;n+=1){let o=t[n],s=t[n+1],l=e[n];if(!l||l.attrs.nodeId!==o.id)continue;let r=D(X(o))+D(X(s));if(D(Q(l))===r&&Gt(t,e,n)&&Xt(t,e,n+2,n+1))return {ok:true,ops:[{op:"joinParagraphs",firstId:o.id,secondId:s.id}]}}return {ok:false,reason:"join-not-clean"}}function Gt(t,e,n){for(let o=0;o<n;o+=1){let s=e[o],l=t[o];if(!s||s.attrs.nodeId!==l.id||D(Q(s))!==D(X(l)))return false}return true}function Xt(t,e,n,o){for(let s=0;n+s<t.length;s+=1){let l=t[n+s],r=e[o+s];if(!r||r.attrs.nodeId!==l.id||D(Q(r))!==D(X(l)))return false}return true}function Bn(t,e){return chunk2GSRLGUI_cjs.Fa(t,e)!==null}function je(t,e,n){if(!n||n.created.length>0||n.deleted.length>0||n.splitJoin.length>0)return G(e);let o=new Map;t.forEach(m=>{let f=m.attrs.nodeId;typeof f=="string"&&o.set(f,m);});let s=new Set(n.dirty),l=M(e);if(l.length!==t.childCount)return G(e);let r=G(e),p=[];for(let[m,f]of l.entries()){let h=o.get(f.id);p.push(h&&!s.has(f.id)?h:r.child(m));}return E.node("doc",null,p)}function Hn(t,e){let n=t.kind==="revision"?t.ranges[0]??null:t.range;if(!n)return null;let o=e.get(n.start.paragraphId);return o===void 0?null:o}function Kt(t,e,n){for(let s of e)if(s.ranges.length===0)return false;let o=new Set;for(let s of t)s.kind!=="revision"||s.ranges.length>0||Zt(s,n)||o.add(chunkIJ4V3LGV_cjs.b(s));for(let s of e)if(o.has(chunkIJ4V3LGV_cjs.b(s)))return false;return true}function Jt(t,e,n,o){let s=e.get(n);if(s===void 0)return [...t];let l=[],r=null;for(let p of t){if(p.kind==="revision"&&Zt(p,n)){r===null&&(r=l.length);continue}if(r===null){let m=Hn(p,e);m!==null&&m>s&&(r=l.length);}l.push(p);}if(r===null&&(r=l.length),o.length>0){let p=o.length<2?[...o]:[...o].sort((m,f)=>chunkIJ4V3LGV_cjs.g(m,e)-chunkIJ4V3LGV_cjs.g(f,e));l.splice(r,0,...p);}return chunk2GSRLGUI_cjs.sg(l)}function Zt(t,e){return t.ranges.length>0&&t.ranges.every(n=>n.start.paragraphId===e&&n.end.paragraphId===e)}function jn(t,e){return t.range?t.range.start.paragraphId===e||t.range.end.paragraphId===e:false}function $n(t,e){return t.revisionKind==="structural"&&t.ranges.some(n=>n.start.paragraphId===e||n.end.paragraphId===e)}function zn(t,e){return t.ranges.length===0||!t.ranges.some(o=>o.start.paragraphId===e||o.end.paragraphId===e)?false:!t.ranges.every(o=>o.start.paragraphId===e&&o.end.paragraphId===e)}function Qt(t,e,n,o,s,l,r){if(t.fromRevision!==e.bodyRevision||r!==e.packageRevision+1||t.story!==void 0&&t.story.kind!=="body"||t.impact!=="text-local"||t.dirty.length!==1||t.created.length>0||t.deleted.length>0||t.splitJoin.length>0||e.commentsPart!==s||e.commentsExtendedPart!==l)return null;let p=t.dirty[0],m=chunk2GSRLGUI_cjs.Fa(o,p);if(!m||m.kind!=="paragraph")return null;for(let f of n){if(f.kind==="comment"){if(jn(f,p))return null;continue}if(f.kind==="custom"){if(f.range?.start.paragraphId===p)return null;continue}if($n(f,p)||zn(f,p))return null}return p}var Vt=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u,Un=["ascii","hAnsi","cs","eastAsia"],Wn=["asciiTheme","hAnsiTheme","cstheme","eastAsiaTheme"];var Yn=/[\u0000-\u001F\u007F-\u009F]/;function xe(t){return t.kind!=="textValue"}function K(t,e){return t.attributes.find(n=>n.localName===e)?.value}function en(t,e){let n=new Map,o=r=>{if(!r||!Vt.test(r))return;let p=r.toLowerCase();n.has(p)||n.set(p,r);},s=[...t].reverse();for(;s.length>0;){let r=s.pop();if(xe(r)){if(r.localName==="rFonts"){for(let p of Un)o(K(r,p));if(e)for(let p of Wn){let m=K(r,p);m!==void 0&&(m.startsWith("major")?o(e.major):m.startsWith("minor")&&o(e.minor));}}for(let p=r.children.length-1;p>=0;p-=1)s.push(r.children[p]);}}let l=[...n.values()];return l.sort((r,p)=>r<p?-1:r>p?1:0),l}var Gn=new Set(["paragraph","character","table","numbering"]),Xn=/^[0-9A-Fa-f]{6}$/,Kn=16,qt=new Map([["normal",0],["title",1],["subtitle",2],["heading 1",11],["heading 2",12],["heading 3",13],["heading 4",14],["heading 5",15],["heading 6",16],["heading 7",17],["heading 8",18],["heading 9",19]]);function tn(t){return t.children}function $e(t,e){for(let n of tn(t))if(xe(n)&&n.localName===e)return n}function Jn(t){return qt.get(t.name.toLowerCase())??qt.get(t.styleId.toLowerCase())??Number.MAX_SAFE_INTEGER}function ze(t){return t===void 0||t.length===0||t.length>128||Yn.test(t)?null:t}function nn(t,e){if(!t)return [];let n=new Map;for(let l of t.children){if(!xe(l)||l.localName!=="style")continue;let r=ze(K(l,"styleId"));r!==null&&!n.has(r)&&n.set(r,l);}let o=l=>{let r=false,p=false,m=null,f=false,h=false,b=new Set,g=l;for(let k=0;k<Kn&&g!==null&&!b.has(g);k+=1){b.add(g);let I=n.get(g);if(!I)break;let O=$e(I,"rPr");for(let T of O?tn(O):[]){if(!xe(T))continue;let v=K(T,"val"),B=v!=="0"&&v!=="false"&&v!=="off";T.localName==="b"&&!f?(r=B,f=true):T.localName==="i"&&!h?(p=B,h=true):T.localName==="color"&&m===null&&v&&Xn.test(v)&&(m=v);}let S=$e(I,"basedOn");g=S?ze(K(S,"val")):null;}let i=e?.(l),y=i?.fontFamily??null;return {fontFamily:y!==null&&Vt.test(y)?y:null,fontSizePt:i?.fontSizeHalfPoints!=null&&i.fontSizeHalfPoints>0?i.fontSizeHalfPoints/2:null,bold:r,italic:p,color:m}},s=[];for(let[l,r]of n){let p=K(r,"type");if(p===void 0||!Gn.has(p))continue;let m=$e(r,"name"),f=ze(m?K(m,"val"):void 0);s.push({styleId:l,name:f??l,type:p,preview:o(l)});}return s.map((l,r)=>({entry:l,index:r,rank:Jn(l)})).sort((l,r)=>l.rank-r.rank||l.index-r.index).map(l=>l.entry)}var Zn=128,Qn=/[\u0000-\u001F\u007F-\u009F]/,qn=/[\u0000-\u001F\u007F-\u009F]/g,Vn=200,er=/^heading ([1-9])$/i;function Ue(t){return t.kind!=="textValue"}function oe(t,e){for(let n of t.children)if(Ue(n)&&n.localName===e)return n}function re(t,e){return t.attributes.find(n=>n.localName===e)?.value}function tr(t){let e=new Map;if(!t)return e;for(let n of t.children){if(!Ue(n)||n.localName!=="style"||re(n,"type")!=="paragraph")continue;let o=re(n,"styleId");if(o===void 0||o.length===0||o.length>Zn||Qn.test(o))continue;let s=oe(n,"name"),l=s?re(s,"val"):void 0,r=l!==void 0?er.exec(l):null;if(r){e.set(o,Number(r[1])-1);continue}let p=oe(n,"pPr"),m=p?oe(p,"outlineLvl"):void 0,f=m?re(m,"val"):void 0;f!==void 0&&/^[0-8]$/.test(f)&&e.set(o,Number(f));}return e}function We(t){let e=oe(t,"pPr"),n=e?oe(e,"pStyle"):void 0;return n?re(n,"val"):void 0}function rn(t,e){let n=tr(e);if(n.size===0)return [];let o=[];for(let s of M(t)){if(!Ue(s))continue;let l=We(s);if(l===void 0)continue;let r=n.get(l);if(r===void 0)continue;let m=(chunk2GSRLGUI_cjs.Ff(t,s.id)??"").replace(qn," ").trim().slice(0,Vn);m.length!==0&&o.push({text:m,level:r,blockId:s.id});}return o}var be=48,nr=/[\u0000-\u001F\u007F-\u009F]/g;function on(t){return t.kind!=="textValue"}function Pe(t){if(t.kind==="textValue")return t.value.length;if(t.kind==="tab"||t.kind==="hardBreak")return 1;if(t.kind==="runProperties"||t.kind==="generic")return 0;if(t.kind==="hyperlink"||chunk2GSRLGUI_cjs.Lb(t)){let n=0,o=t.kind==="hyperlink"?t.children:chunk2GSRLGUI_cjs.Nb(t)??[];for(let s of o)n+=Pe(s);return n}let e=0;for(let n of t.children)e+=Pe(n);return e}function rr(t){let e=[],n=0;return on(t)&&chunk2GSRLGUI_cjs.Sb(t.children,0,o=>{if(o.kind==="run"){e.push(n),n+=Pe(o);return}n+=Pe(o);}),e}function or(t,e){if(t.length===0)return {index:0,offset:e};for(let n=t.length-1;n>=0;n-=1){let o=t[n];if(e>=o)return {index:n,offset:e-o}}return {index:0,offset:e}}function Ye(t,e){return t.replace(nr," ").slice(0,e)}function an(t,e,n={}){let o={matches:[],truncated:false};if(!chunk2GSRLGUI_cjs.Bg(e))return o;let s=n.limit!==void 0&&Number.isInteger(n.limit)&&n.limit>0?Math.min(n.limit,2e3):2e3,l={...n.matchCase===void 0?{}:{matchCase:n.matchCase},...n.wholeWord===void 0?{}:{wholeWord:n.wholeWord}},r=[],p=0;for(let m of M(t)){if(!on(m))continue;let f=p;p+=1;let h=chunk2GSRLGUI_cjs.Ff(t,m.id)??"";if(h.length===0)continue;let b=chunk2GSRLGUI_cjs.Cg(h,e,s-r.length,l),g=null;for(let i of b.matches){let y=i.start+i.length;g??=rr(m);let k=or(g,i.start);r.push({blockId:m.id,start:i.start,length:i.length,paragraphIndex:f,runIndex:k.index,runOffset:k.offset,text:Ye(h.slice(i.start,y),256),contextBefore:Ye(h.slice(Math.max(0,i.start-be),i.start),be),contextAfter:Ye(h.slice(y,y+be),be)});}if(b.truncated)return {matches:r,truncated:true}}return {matches:r,truncated:false}}var ar=["lt1","dk1","lt2","dk2","accent1","accent2","accent3","accent4","accent5","accent6"],lr=/^[0-9A-Fa-f]{6}$/,ln={windowText:"000000",window:"FFFFFF"};function un(t){return t.kind!=="textValue"}function Oe(t,e){return t.attributes.find(n=>n.localName===e)?.value}function cn(t,e){let n=[t];for(;n.length>0;){let o=n.pop();if(un(o)){if(o.localName===e)return o;for(let s=o.children.length-1;s>=0;s-=1)n.push(o.children[s]);}}return null}function Se(t,e){for(let n of t.children)if(un(n)&&(e===void 0||n.localName===e))return n;return null}function sr(t){let e=Se(t);if(!e)return null;let n;if(e.localName==="srgbClr")n=Oe(e,"val");else if(e.localName==="sysClr"){let o=Oe(e,"val")??"";n=Oe(e,"lastClr")??(Object.prototype.hasOwnProperty.call(ln,o)?ln[o]:void 0);}return n===void 0||!lr.test(n)?null:n.toUpperCase()}var ir=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function sn(t,e){let n=Se(t,e),o=n?Se(n,"latin"):null,s=o?Oe(o,"typeface"):void 0;return s!==void 0&&ir.test(s)?s:null}function ae(t){if(!t)return {major:null,minor:null};let e=cn(t,"fontScheme");return e?{major:sn(e,"majorFont"),minor:sn(e,"minorFont")}:{major:null,minor:null}}function dn(t){if(!t)return [];let e=cn(t,"clrScheme");if(!e)return [];let n=[];for(let o of ar){let s=Se(e,o),l=s?sr(s):null;if(l===null)return [];n.push({slot:o,hex:l});}return n}var ur=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;var cr=/[\u0000-\u001F\u007F-\u009F]/;function fn(t){return t.kind!=="textValue"}function J(t,e){for(let n of t.children)if(fn(n)&&n.localName===e)return n}function Z(t,e){return t.attributes.find(n=>n.localName===e)?.value}function pn(t){return t===void 0||t.length===0||t.length>128||cr.test(t)?null:t}function ve(t,e){return t==="minorAscii"||t==="minorHAnsi"?e.minor:t==="majorAscii"||t==="majorHAnsi"?e.major:null}function dr(t,e){let n=ve(Z(t,"asciiTheme"),e)??ve(Z(t,"hAnsiTheme"),e);if(n!==null)return n;let o=Z(t,"ascii")??Z(t,"hAnsi");return o===void 0?null:ur.test(o)?o:null}function mn(t,e){if(!t)return {fontFamily:null,fontSizeHalfPoints:null};let n=J(t,"rFonts"),o=J(t,"sz"),s=o?Z(o,"val"):void 0,l=s!==void 0&&/^\d{1,4}$/.test(s)?Number(s):null;return {fontFamily:n?dr(n,e):null,fontSizeHalfPoints:l!==null&&l>=2&&l<=3276?l:null}}function Ge(t,e){let n=new Map,o={fontFamily:null,fontSizeHalfPoints:null};if(t){let r=J(t,"docDefaults"),p=r?J(r,"rPrDefault"):void 0;o=mn(p?J(p,"rPr"):void 0,e);for(let m of t.children){if(!fn(m)||m.localName!=="style")continue;let f=pn(Z(m,"styleId"));if(f===null||n.has(f))continue;let h=J(m,"basedOn");n.set(f,{basedOn:pn(h?Z(h,"val"):void 0),own:mn(J(m,"rPr"),e)});}}let s=new Map,l=r=>{let p=r??"",m=s.get(p);if(m)return m;let f=null,h=null,b=new Set,g=r;for(let y=0;g!==null&&y<16&&!b.has(g);y+=1){b.add(g);let k=n.get(g);if(!k)break;f??=k.own.fontFamily,h??=k.own.fontSizeHalfPoints,g=k.basedOn;}let i={fontFamily:f??o.fontFamily,fontSizeHalfPoints:h??o.fontSizeHalfPoints};return s.set(p,i),i};return (r,p)=>{let m=l(r),f=p?.find(b=>b.localName==="rFonts"),h=f?ve(f.attributes?.asciiTheme,e)??ve(f.attributes?.hAnsiTheme,e):null;return h===null?m:{...m,fontFamily:h}}}function gn(t){let e=new Map,n=new Map,o=new Map;return $(t).forEach((s,l)=>{o.set(s.id,l);let r=chunk2GSRLGUI_cjs.Oc(s);if(r===null||!chunk2GSRLGUI_cjs.Nc(r))return;e.set(s.id,r);let p=r.toUpperCase();n.has(p)||n.set(p,s.id);}),Object.freeze({paraIdByNode:e,nodeByParaId:n,ordinalByNode:o})}var pr=Object.freeze([]);function mr(t,e={}){let n=chunk2GSRLGUI_cjs.yb(t);if(!n.ok)return {ok:false,reason:n.reason,...n.detail?{detail:n.detail}:{}};let o=n.package,s=o.parts.get(o.mainDocumentPart);if(!s)return {ok:false,reason:"no-main-document-tree",detail:o.mainDocumentPart};let l=chunk2GSRLGUI_cjs.Uc(s),r=new chunk2GSRLGUI_cjs.Kf(o,l),p=null,m=null,f=null,h=null;r.subscribe(a=>{h=a;});let b=()=>r.bodyStore(),g=()=>r.currentPackage(),i=Object.freeze({kind:"body"}),y=(a,u)=>{let c=r.currentPackage(),d=a.checkpoint();a.graftPackage(()=>r.currentPackage());let x=u();return x.ok&&(a.restoreHistoryStacks(d),r.replacePackageShell(a.package),r.adoptPackageUnit(c),r.publishStoryWrite(x.change)),x},k=()=>{if(!p||p.packageRevision!==r.packageRevision){let a=chunk2GSRLGUI_cjs.Ub(g());p={packageRevision:r.packageRevision,resolution:a,parts:chunk2GSRLGUI_cjs.Vb(g())};}return p},I="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",O="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",S=false,T=null,v=()=>{if(S)return T;S=true;let a=g(),u=(a.relationships.get(a.mainDocumentPart)??[]).find(d=>d.type===I),c;if(u){let d=chunk2GSRLGUI_cjs.O(u);d.mode==="Internal"&&d.target.ok&&(c=a.parts.get(d.target.partName));}return c??=a.parts.get("/word/styles.xml"),T=c?.root??null,T},B=false,z=null,le=()=>{if(B)return z;B=true;let a=g(),u=(a.relationships.get(a.mainDocumentPart)??[]).find(d=>d.type===O),c;if(u){let d=chunk2GSRLGUI_cjs.O(u);d.mode==="Internal"&&d.target.ok&&(c=a.parts.get(d.target.partName));}return c??=a.parts.get("/word/numbering.xml"),z=c?.root??null,z},q="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",se=-1,Re=null,Xe=()=>{if(se===r.packageRevision)return Re;se=r.packageRevision;let a=g(),u=(a.relationships.get(a.mainDocumentPart)??[]).find(d=>d.type===q),c;if(u){let d=chunk2GSRLGUI_cjs.O(u);d.mode==="Internal"&&d.target.ok&&(c=a.parts.get(d.target.partName));}return c??=a.parts.get("/word/settings.xml"),Re=c?.root??null,Re},xn="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",bn="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",Ke=(a,u)=>{let c=g(),d=(c.relationships.get("/")??[]).find(P=>P.type===a),x;if(d){let P=chunk2GSRLGUI_cjs.O(d);P.mode==="Internal"&&P.target.ok&&(x=c.parts.get(P.target.partName));}return x??c.parts.get(u)},Je=-1,Ie=chunkJDHTCMFA_cjs.R,Pn=()=>{if(Je===r.packageRevision)return Ie;Je=r.packageRevision;let a=Ke(xn,"/docProps/core.xml"),u=Ke(bn,"/docProps/app.xml");return Ie=chunkJDHTCMFA_cjs.S(a?.root??null,u?.root??null),Ie},On="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",Ze=false,Te=null,V=()=>{if(Ze)return Te;Ze=true;let a=g(),u=(a.relationships.get(a.mainDocumentPart)??[]).find(d=>d.type===On),c;if(u){let d=chunk2GSRLGUI_cjs.O(u);d.mode==="Internal"&&d.target.ok&&(c=a.parts.get(d.target.partName));}return c??=a.parts.get("/word/theme/theme1.xml"),Te=c?.root??null,Te},Sn="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",ie=null,vn=()=>{if(ie)return ie;let a=g(),u=(a.relationships.get(a.mainDocumentPart)??[]).find(d=>d.type===Sn),c;if(u){let d=chunk2GSRLGUI_cjs.O(u);d.mode==="Internal"&&d.target.ok&&(c=a.parts.get(d.target.partName));}return c??=a.parts.get("/word/fontTable.xml"),ie=Object.freeze(chunkJDHTCMFA_cjs.G(a,c)),ie},ee=null,Qe=null,qe=null,Ve=null,ue=null,ce=null,te=null,ne=null,de=null,pe=null,Ne=()=>{let a=b();return (!de||de.revision!==a.revision)&&(de={revision:a.revision,index:gn(a.part)}),de.index};return {ok:true,session:{editable:$(b().part).length>0,paragraphIds:()=>$(b().part).map(a=>a.id),paragraphIdsIn(a=i){let u=r.partFor(a);return u?$(u).map(c=>c.id):[]},part:()=>b().part,partFor:a=>r.partFor(a),currentPackage:g,applyTreeOps(a,u,c,d=i){if(a.length===0)return {committed:false,rejected:false,opCount:0};let x=a.filter(R=>chunk2GSRLGUI_cjs.Yc(R)||chunk2GSRLGUI_cjs.ce(R)).length;if(x>0){if(x!==a.length||a.length!==1)return {committed:false,rejected:true,opCount:a.length,reason:"invalidArgs"};let R=r.applyLifecycleOp(a[0]);return R.ok?{committed:true,rejected:false,opCount:1}:{committed:false,rejected:true,opCount:1,reason:R.detail??R.reason}}let P=r.transact(d,R=>{u!==void 0&&R.selectionBefore(u),c!==void 0&&R.selectionAfter(c);for(let N of a)R.apply(N);});return P.ok?{committed:true,rejected:false,opCount:a.length}:{committed:false,rejected:true,opCount:a.length,reason:P.reason}},projectDoc:()=>G(b().part),reconcile:a=>je(a,b().part,h),lastCommitWasStructural:()=>h!==null&&(h.created.length>0||h.deleted.length>0||h.splitJoin.length>0||h.impact==="global"),applyPmDoc(a){let u=b(),c=He(u.part,a);if(!c.ok)return {committed:false,rejected:true,opCount:0,reason:c.reason};if(c.ops.length===0)return {committed:false,rejected:false,opCount:0};let d=r.transact(i,x=>{for(let P of c.ops)x.apply(P);});return d.ok?{committed:true,rejected:false,opCount:c.ops.length}:{committed:false,rejected:true,opCount:c.ops.length,reason:d.reason}},bodyText:()=>fr(b().part),storyText(a){let u=r.partFor(a);return u?$(u).map(c=>chunk2GSRLGUI_cjs.Ff(u,c.id)??"").join(`
|
|
4
|
+
`):null},revision:()=>b().revision,revisionFor:a=>r.revisionFor(a),packageRevision:()=>r.packageRevision,canUndo:()=>r.canUndo,canRedo:()=>r.canRedo,undo:()=>{let a=r.selectionForUndo();return r.undo()===null?null:a},redo:()=>{let a=r.selectionForRedo();return r.redo()===null?null:a},beginComposition:(a=i)=>{r.beginComposition(a);},endComposition:()=>r.endComposition(),subscribe(a){return r.subscribe(a)},save(){return chunk2GSRLGUI_cjs.zb(g())},headerFooterParts:()=>{let a=k().parts;return a[a.length-1]??chunk2GSRLGUI_cjs.Wb(g())},headerFooterPartsBySection:()=>k().parts,headerFooterResolutionBySection:()=>k().resolution,documentFonts(){if(ee&&ee.revision===r.packageRevision)return ee.fonts;let a=k().parts,u=[b().part.root],c=v();c&&u.push(c);let d=new Set;for(let x of a){for(let P of x.headers.values())d.has(P)||(d.add(P),u.push(P.root));for(let P of x.footers.values())d.has(P)||(d.add(P),u.push(P.root));}return ee={revision:r.packageRevision,fonts:en(u,ae(V()))},ee.fonts},documentStyles(){ue??=Ge(v(),ae(V()));let a=ue;return Qe??=nn(v(),u=>a(u)),Qe},stylesRoot:()=>v(),documentThemeFonts(){return Ve??=ae(V()),Ve},numberingRoot:()=>le(),settingsRoot:()=>Xe(),documentProperties:()=>Pn(),trackingSettings:()=>chunkJDHTCMFA_cjs.O(Xe()),documentThemeColors(){return qe??=dn(V()),qe},effectiveRunDefaults(a,u){ue??=Ge(v(),ae(V()));let c=b();if(!ce||ce.revision!==c.revision){let d=new Map;for(let x of $(c.part))x.kind!=="textValue"&&d.set(x.id,We(x)??null);ce={revision:c.revision,byId:d};}return ue(ce.byId.get(a)??null,u)},documentOutline(){let a=b();return te&&te.revision===a.revision||(te={revision:a.revision,outline:rn(a.part,v())}),te.outline},findText(a,u){let c=b(),d=`${u?.matchCase===true?"c":""}${u?.wholeWord===true?"w":""}${u?.limit??""}\0${a}`;if(ne&&ne.revision===c.revision&&ne.key===d)return ne.result;let x=an(c.part,a,u??{});return ne={revision:c.revision,key:d,result:x},x},embeddedFonts:vn,paragraphAnchors:Ne,paraIdOf:a=>Ne().paraIdByNode.get(a)??null,nodeIdOf:a=>Ne().nodeByParaId.get(a.toUpperCase())??null,relationshipTarget:(a,u=i)=>{let c=g(),d=r.partFor(u);return d?chunk2GSRLGUI_cjs.Xc(c,d.name,a):null},bookmarks:()=>{let a=b();return (!pe||pe.revision!==a.revision)&&(pe={revision:a.revision,index:chunk2GSRLGUI_cjs.Cc(a.part)}),pe.index},ensureHyperlinkRelationship(a,u=i){let c=r.partFor(u);if(!c)return null;let d=g(),x=chunk2GSRLGUI_cjs.Wc(d,a,c.name);return x?(x.pkg!==d&&r.replacePackageShell(x.pkg),x.relationshipId):null},reviewItems(){let a=e.reviewModel;if(!a)return pr;let u=b(),c=`${r.packageRevision}:${u.revision}`;if(m&&m.revisionKey===c)return m.items;let d=g(),x=d.parts.get(chunk2GSRLGUI_cjs.Sf(d,u.part.name)),P=d.parts.get(chunk2GSRLGUI_cjs.Tf(d,u.part.name)),R=[],N=new Set;for(let A of k().parts)for(let L of [A.headers,A.footers])for(let _ of L.values())N.has(_)||(N.add(_),R.push(_));for(let A of ["footnote","endnote"]){let L=chunk2GSRLGUI_cjs.Yd(d,A);!L||N.has(L)||(N.add(L),R.push(L));}let w=m&&h?Qt(h,m,m.items,u.part,x,P,r.packageRevision):null,F,C;if(w&&m){let A=a.revisionItemsOfParagraph(u.part,w);Kt(m.items,A,w)?(F=Jt(m.items,m.paragraphOrder,w,A),C=m.paragraphOrder):(C=chunk2GSRLGUI_cjs.tg(u.part),F=a.collectReviewItems({storyPart:u.part,furnitureParts:R,commentsPart:x,commentsExtendedPart:P,customNodePayloads:chunk2GSRLGUI_cjs.Zf(g(),u.part.name)}));}else C=chunk2GSRLGUI_cjs.tg(u.part),F=a.collectReviewItems({storyPart:u.part,furnitureParts:R,commentsPart:x,commentsExtendedPart:P,customNodePayloads:chunk2GSRLGUI_cjs.Zf(g(),u.part.name)});return m={revisionKey:c,bodyRevision:u.revision,packageRevision:r.packageRevision,items:F,paragraphOrder:C,commentsPart:x,commentsExtendedPart:P},m.items},hasReviewContent(){let a=b();return (!f||f.revision!==a.revision)&&(f={revision:a.revision,present:chunk2GSRLGUI_cjs.kf(a.part).length>0||hn(a.part.root)}),f.present},replyToComment(a,u,c,d,x,P=i){let R=P.kind==="body"?null:r.resolveStory(P),N=R?.ok?R.store:b(),w=r.currentPackage(),F=N.checkpoint();N.graftPackage(()=>r.currentPackage());let C=chunk2GSRLGUI_cjs.Pf(N,{anchor:{paragraphId:u.paragraphId,start:u.start,end:u.end,...u.endParagraphId===void 0?{}:{endParagraphId:u.endParagraphId}},author:d,text:c,...x===void 0?{}:{date:x},...a===null?{}:{replyToCommentId:a}});return C.ok?(N.restoreHistoryStacks(F),r.replacePackageShell(N.package),r.adoptPackageUnit(w),r.publishStoryWrite(C.change),C.commentId):null},setCommentResolved(a,u){let c=b(),d=r.currentPackage(),x=c.checkpoint();c.graftPackage(()=>r.currentPackage());let P=chunk2GSRLGUI_cjs.Qf(c,a,u);return P.ok?(P.changed&&(c.restoreHistoryStacks(x),r.replacePackageShell(c.package),r.adoptPackageUnit(d),r.publishStoryWrite(P.change)),true):false},deleteComment(a,u=i,c){return this.deleteComments([{commentId:a}],u,c)},deleteComments(a,u=i,c){if(a.length===0)return false;let d=u.kind==="body"?b().part:r.partFor(u);if(!d)return false;let x={storyPartName:d.name,...c===void 0?{}:{noteId:c}},P=b(),R=r.currentPackage(),N=P.checkpoint();P.graftPackage(()=>r.currentPackage());let w=false,F=false,C=P.transact(A=>{A.applyPackage(L=>{let _=L;for(let me of a){let Ee=me.parentCommentId===void 0?chunk2GSRLGUI_cjs.Oe(_,me.commentId,x):chunk2GSRLGUI_cjs.Pe(_,me.commentId,me.parentCommentId,x);if(Ee===null)return w=true,L;F||=Ee!==_,_=Ee;}return _});});return w||!C.ok||!F?false:(P.restoreHistoryStacks(N),r.installPackageSnapshot(P.package),r.adoptPackageUnit(R),r.publishStoryWrite(C.change),true)},insertCustomNode(a,u=i){let c=u.kind==="body"?null:r.resolveStory(u),d=c?.ok?c.store:b();return y(d,()=>chunk2GSRLGUI_cjs.Wf(d,a,b().part.name))},removeCustomNode(a,u=i){let c=u.kind==="body"?null:r.resolveStory(u),d=c?.ok?c.store:b();return y(d,()=>chunk2GSRLGUI_cjs.Xf(d,a))},sweepCustomNodePayloads(a){let u=b(),c=chunk2GSRLGUI_cjs.Yf(r.currentPackage(),u.part.name,a);return c.ok?c.removed.length===0?{ok:true,removed:[]}:(r.replacePackageShell(c.pkg),{ok:true,removed:c.removed}):{ok:false,reason:c.reason}},ensureListDefinition(a){let u=chunkJDHTCMFA_cjs.L(g(),a);return u?(r.replacePackageShell(u.pkg),B=false,z=null,u.numId):null},ensureNumberingLevel(a,u,c){let d=g(),x=chunkJDHTCMFA_cjs.M(d,a,u,c);return x?(x!==d&&(r.replacePackageShell(x),B=false,z=null),true):false},insertImage(a,u){return r.insertImage(a,u)},replaceImage(a,u,c,d,x,P){return r.replaceImage(a,u,c,d,x,P)},deleteImage(a,u){return r.deleteImage(a,u)},applyImageProperties(a,u){return r.applyImageProperties(a,u)}}}}function fr(t){return M(t).map(e=>chunk2GSRLGUI_cjs.Ff(t,e.id)??"").join(`
|
|
5
|
+
`)}var yn=new WeakMap;function hn(t,e=0){if(e>64)return false;let n=yn.get(t);if(n!==void 0)return n;let o=false;for(let s of t.children)if(s.kind!=="textValue"&&(s.kind==="commentRangeStart"||s.kind==="commentReference"||hn(s,e+1))){o=true;break}return yn.set(t,o),o}var gr=chunk2GSRLGUI_cjs.t.projection;function Ir(t,e,n){let o=t.filter(s=>s.localName!==e);return o.length!==t.length?o:[...o,n?{localName:e,attributes:n}:{localName:e}]}function Tr(t,e,n={}){let o=null,s=false,l=()=>n.onChange?.(r()),r=()=>({revision:e.revision(),canUndo:e.canUndo(),canRedo:e.canRedo(),lastRejection:o}),p=i=>{s=true;let y=f.state.tr.replaceWith(0,f.state.doc.content.size,i.content);y.setMeta("addToHistory",false),f.dispatch(y),s=false;},m=i=>()=>(i()&&(p(e.projectDoc()),l()),true),f=new prosemirrorView.EditorView(t,{state:prosemirrorState.EditorState.create({doc:e.projectDoc(),plugins:[prosemirrorKeymap.keymap({...prosemirrorCommands.baseKeymap,Home:prosemirrorCommands.selectTextblockStart,End:prosemirrorCommands.selectTextblockEnd,"Mod-z":m(()=>e.undo()!==null),"Mod-y":m(()=>e.redo()!==null),"Shift-Mod-z":m(()=>e.redo()!==null),"Mod-b":(i,y)=>g(i,y,"b"),"Mod-i":(i,y)=>g(i,y,"i"),"Mod-u":(i,y)=>g(i,y,"u",{val:"single"})})]}),editable:()=>e.editable,handleDOMEvents:{keydown:i=>(h(i),false),beforeinput:(i,y)=>{let k=y;if(i.composing)return false;h(i);let I=k.inputType;if(I==="insertText"&&k.data!=null){k.preventDefault();let{from:O,to:S}=i.state.selection;return i.dispatch(i.state.tr.insertText(k.data,O,S)),true}if(I==="deleteContentBackward"){k.preventDefault();let{from:O,empty:S}=i.state.selection;return S?O>0?i.dispatch(i.state.tr.delete(O-1,O)):prosemirrorCommands.joinBackward(i.state,i.dispatch):prosemirrorCommands.deleteSelection(i.state,i.dispatch),true}if(I==="deleteContentForward"){k.preventDefault();let{from:O,to:S,empty:T}=i.state.selection;return T?S<i.state.doc.content.size?i.dispatch(i.state.tr.delete(O,O+1)):prosemirrorCommands.joinForward(i.state,i.dispatch):prosemirrorCommands.deleteSelection(i.state,i.dispatch),true}return I==="insertParagraph"?(k.preventDefault(),prosemirrorCommands.splitBlock(i.state,i.dispatch),true):false},compositionstart:()=>(e.beginComposition(),false),compositionend:()=>(e.endComposition(),l(),false)},dispatchTransaction(i){let y=f.state.apply(i);if(s||!i.docChanged){f.updateState(y);return}let k=e.applyPmDoc(y.doc);if(k.rejected){o=String(k.reason??"rejected"),f.updateState(y),p(e.projectDoc()),l();return}o=null,f.updateState(k.committed&&e.lastCommitWasStructural()?b(y):y),l();}});function h(i){if(i.composing||s)return;let y=i.dom.ownerDocument.getSelection(),k=y?.anchorNode,I=y?.focusNode;if(!(!y||!k||!I)&&!(!i.dom.contains(k)||!i.dom.contains(I)))try{let O=i.posAtDOM(k,y.anchorOffset),S=i.posAtDOM(I,y.focusOffset),T=i.state.selection;if(T.anchor===O&&T.head===S)return;let v=prosemirrorState.TextSelection.create(i.state.doc,O,S);i.dispatch(i.state.tr.setSelection(v).setMeta("addToHistory",!1));}catch{}}function b(i){let y=e.paragraphIds(),k=i.tr,I=false,O=0;return i.doc.forEach((S,T)=>{let v=y[O];O+=1,!(S.type.name!=="paragraph"||v===void 0)&&S.attrs.nodeId!==v&&(k=k.setNodeMarkup(T,void 0,{...S.attrs,nodeId:v}),I=true);}),I?i.apply(k.setMeta("addToHistory",false)):i}function g(i,y,k,I){let O=E.marks.runProps;if(!y)return true;let{from:S,to:T,empty:v}=i.selection;if(v)return true;let z=i.doc.resolve(S).marks().find(se=>se.type===O)?.attrs.props??[],le=Ir(z,k,I),q=i.tr;return q.removeMark(S,T,O),le.length>0&&q.addMark(S,T,O.create({props:le})),y(q),true}return {view:f,state:r,undo:()=>m(()=>e.undo()!==null)(),redo:()=>m(()=>e.redo()!==null)(),toggleRunProperty(i,y){g(f.state,f.dispatch.bind(f),i,y);},destroy:()=>f.destroy()}}exports.a=E;exports.b=_e;exports.c=M;exports.d=$;exports.e=G;exports.f=He;exports.g=Bn;exports.h=je;exports.i=We;exports.j=mr;exports.k=gr;exports.l=Tr;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var x="http://schemas.microsoft.com/office/word/2012/wordml";function b(e){return `${e.kind}-${e.id}`}function P(e){let i=[],o=n=>{if(n.kind==="textValue"){i.push(n.value);return}for(let r of n.children)o(r);};for(let n of e.blocks)o(n);return i.join("")}function k(e){if(e.initials&&e.initials.trim().length>0)return e.initials.trim();let i=e.author.trim().split(/\s+/).filter(Boolean);return i.length===0?"?":i.slice(0,2).map(o=>o[0].toUpperCase()).join("")}function l(e){return e.kind==="revision"?e.ranges:e.range?[e.range]:[]}function m(e){return l(e)[0]??null}function A(e,i){let o=m(e);if(!o)return Number.MAX_SAFE_INTEGER;let n=i.get(o.start.paragraphId);return n===void 0?Number.MAX_SAFE_INTEGER:n*1e6+Math.min(o.start.offset,999999)}function u(e,i){let o=i.get(e.start.paragraphId),n=i.get(e.end.paragraphId);return o===void 0||n===void 0?Number.MAX_SAFE_INTEGER:(n-o)*1e6+(e.end.offset-e.start.offset)}var y=0,p=1,f=2;function c(e,i,o){let n=o.get(i.paragraphId),r=o.get(e.start.paragraphId),t=o.get(e.end.paragraphId);return n===void 0||r===void 0||t===void 0||n<r||n>t||n===r&&i.offset<e.start.offset||n===t&&i.offset>e.end.offset?null:r===t&&e.start.offset===e.end.offset?y:n===t&&i.offset===e.end.offset?f:p}function R(e,i,o){let n=null;for(let r of l(e)){let t=c(r,i,o);if(t===null)continue;let a=u(r,o);(n===null||t<n.grip||t===n.grip&&a<n.width)&&(n={grip:t,width:a});}return n}var s={comment:0,custom:1,revision:2};function v(e,i,o){let n=[];for(let r of e){let t=R(r,i,o);t!==null&&n.push({item:r,grip:t.grip,width:t.width});}return n.sort((r,t)=>r.grip!==t.grip?r.grip-t.grip:r.width!==t.width?r.width-t.width:r.item.kind!==t.item.kind?s[r.item.kind]-s[t.item.kind]:r.item.kind==="revision"&&t.item.kind==="revision"?t.item.nesting-r.item.nesting:0).map(r=>r.item)}function C(e,i,o){let r=v(e,i,o).filter(t=>!(t.kind==="comment"&&t.resolved))[0];return r?r.kind==="comment"?g(e,r):r:null}function T(e,i){return g(e,i)}function g(e,i){let o=new Map,n=new Map;for(let a of e)a.kind==="comment"?o.set(a.id,a):a.kind==="revision"&&n.set(a.id,a);let r=new Set([i.id]),t=i;for(;t.parentId!==void 0;){let a=o.get(t.parentId);if(!a||r.has(a.id))break;r.add(a.id),t=a;}if(t.parentRevisionId!==void 0){let a=n.get(t.parentRevisionId);if(a)return a}return t}function I(e,i,o){let n=e.lines?.find(r=>{let t=r.spans;if(!t)return o<r.range.end;let a=t.filter(d=>d.range.paragraphId===i);return a.length===t.length?o<r.range.end:a.length>0&&o<a[a.length-1].range.end});return n?n.box.y:e.fragmentY}function M(e,i){let o=new Map;for(let n of e.pages)for(let r of i(n)){let t=new Set([r.paragraphId]);for(let a of r.lines??[])for(let d of a.spans??[])t.add(d.range.paragraphId);for(let a of t)o.has(a)||o.set(a,{pageIndex:n.index,contentY:n.contentBox.y,fragmentY:r.box.y,...r.lines?{lines:r.lines}:{}});}return o}function N(e,i){let o=m(e);if(!o)return null;let n=i.get(o.start.paragraphId);return n?{pageIndex:n.pageIndex,y:n.contentY+I(n,o.start.paragraphId,o.start.offset)}:null}
|
|
2
|
+
exports.a=x;exports.b=b;exports.c=P;exports.d=k;exports.e=l;exports.f=m;exports.g=A;exports.h=v;exports.i=C;exports.j=T;exports.k=I;exports.l=M;exports.m=N;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunk2GSRLGUI_cjs=require('./chunk-2GSRLGUI.cjs'),fflate=require('fflate');var Ft=["extension","capability","command","query","schema","dependencyKey","runtimePort","result","origin"],Lt=/^[a-z0-9]+(?:-[a-z0-9]+)*(?:\.[a-z0-9]+(?:-[a-z0-9]+)*)+$/,Bt=/^@[a-z0-9.-]+\/[a-z0-9.-]+(?:#[a-z0-9]+(?:[/._-][a-z0-9]+)*)?$/;function ot(e){return Lt.test(e)||Bt.test(e)}function J(e,t){if(!ot(e))throw new Error(`invalid ${t??"registry"} id ${JSON.stringify(e)}: must be reverse-domain (dev.docx-editor.core.x) or package-owned (@scope/pkg#kind/name)`)}var Ut=/^(\d+)\.(\d+)\.(\d+)$/;function S(e){let t=Ut.exec(e);if(!t)throw new Error(`invalid semantic version: ${JSON.stringify(e)}`);return {major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3])}}function q(e,t){return e.major!==t.major?e.major<t.major?-1:1:e.minor!==t.minor?e.minor<t.minor?-1:1:e.patch!==t.patch?e.patch<t.patch?-1:1:0}function Q(e,t){let n=S(e),r=t.trim();if(r==="*")return true;if(r.startsWith("^")){let o=S(r.slice(1));return q(n,o)<0?false:o.major>0?n.major===o.major:o.minor>0?n.major===0&&n.minor===o.minor:n.major===0&&n.minor===0}if(r.includes(" ")){let o=r.split(/\s+/);if(o.length!==2)throw new Error(`unsupported version range: ${JSON.stringify(t)}`);let s=true;for(let a of o){let i=a.startsWith(">=")?">=":a.startsWith("<")?"<":null;if(!i)throw new Error(`unsupported version range: ${JSON.stringify(t)}`);let d=S(a.slice(i.length)),l=q(n,d);i===">="?s=s&&l>=0:s=s&&l<0;}return s}return q(n,S(r))===0}var h=class extends Error{constructor(n,r,o=[]){super(r);this.code=n;this.responsible=o;this.name="RegistryError";}code;responsible},$e=(e,t)=>`${e}:${t}`;function Ht(e,t={}){let n=new Map;for(let l of e){if(J(l.id,"extension"),it(l.version,l.id),n.has(l.id))throw new h("duplicate-extension",`duplicate extension id ${l.id}`,[l.id]);n.set(l.id,l);for(let c of l.contributions)J(c.id,c.kind),it(c.version,`${l.id} \u2192 ${c.id}`),c.replaces&&Xt(c.replaces.targetRange,`${l.id} \u2192 replaces ${c.replaces.targetId}`);}for(let l of e){for(let c of l.dependencies??[])if(!n.has(c))throw new h("missing-dependency",`${l.id} requires missing extension ${c}`,[l.id,c]);for(let c of l.conflicts??[])if(n.has(c)){let p=[l.id,c].sort();throw new h("conflict",`extensions ${p[0]} and ${p[1]} conflict`,p)}}jt(n);let r=new Set(t.availablePorts??[]);for(let l of e)for(let c of l.contributions)c.kind==="runtimePort"&&r.add(c.id);for(let l of e)for(let c of l.requiredPorts??[])if(!r.has(c))throw new h("missing-port",`${l.id} requires unavailable port ${c}`,[l.id,c]);let o=new Map,s=new Map,a=new Map;for(let l of e)for(let c of l.contributions){let p=$e(c.kind,c.id);if(c.replaces){let u=$e(c.kind,c.replaces.targetId),m=a.get(u)??[];m.push({ext:l.id,c}),a.set(u,m);continue}if(s.has(p)){let u=[o.get(p),l.id].sort();throw new h("id-collision",`${c.kind} id ${c.id} registered by both ${u[0]} and ${u[1]}`,u)}s.set(p,c),o.set(p,l.id);}let i=new Map(s);for(let[l,c]of a){let p=s.get(l);if(!p){let f=c[0];throw new h("replacement-target-missing",`${f.ext} replaces missing target ${f.c.replaces.targetId}`,[f.ext,f.c.replaces.targetId])}let u=p.replaceable??{kind:"none"};for(let{ext:f,c:y}of c){if(!Q(p.version,y.replaces.targetRange))throw new h("replacement-version-mismatch",`${f} replaces ${y.replaces.targetId}@${p.version} outside range ${y.replaces.targetRange}`,[f,y.replaces.targetId]);if(u.kind==="none")throw new h("unauthorized-replacement",`${y.replaces.targetId} does not authorize replacement (attempted by ${f})`,[f,y.replaces.targetId])}let m=Vt(p,c);i.set(l,m);}return {extensions:n,contributions:i,get:(l,c)=>i.get($e(l,c))}}function Vt(e,t){let n=e.replaceable??{kind:"none"};if(t.length===1)return t[0].c;if(n.kind==="priority"){let o=[...t].sort((i,d)=>(d.c.replaces.priority??0)-(i.c.replaces.priority??0)),s=o[0].c.replaces.priority??0,a=o.filter(i=>(i.c.replaces.priority??0)===s);if(a.length>1){let i=a.map(d=>d.ext).sort();throw new h("ambiguous-replacement",`multiple replacers of ${e.id} share top priority ${s}: ${i.join(", ")}`,i)}return o[0].c}let r=t.map(o=>o.ext).sort();throw new h("ambiguous-replacement",`multiple replacers of ${e.id}: ${r.join(", ")}`,r)}function jt(e){let o=new Map,s=[],a=i=>{o.set(i,1),s.push(i);let d=[...e.get(i)?.dependencies??[]].sort();for(let l of d){let c=o.get(l)??0;if(c===1){let p=s.indexOf(l),u=[...s.slice(p),l];throw new h("dependency-cycle",`dependency cycle: ${u.join(" -> ")}`,u)}c===0&&a(l);}s.pop(),o.set(i,2);};for(let i of [...e.keys()].sort())(o.get(i)??0)===0&&a(i);}function it(e,t){try{S(e);}catch{throw new h("invalid-version",`invalid version ${JSON.stringify(e)} in ${t}`,[t])}}function Xt(e,t){try{Q("0.0.0",e);}catch{throw new h("invalid-version",`invalid version range ${JSON.stringify(e)} in ${t}`,[t])}}var v=class extends Error{constructor(t){super(t),this.name="BudgetError";}},B=class e{constructor(t,n){this.label=t;this.capacity=n;this.used=new chunk2GSRLGUI_cjs.H(`${t}.budget`,n);}label;capacity;used;children=new Set;activeReservations=0;cleanups=[];disposed=false;carveAmount=0;parent;get inUse(){return this.used.current}get available(){return this.used.remaining}get isDisposed(){return this.disposed}reserve(t){this.assertLive(),this.used.add(t),this.activeReservations+=1;let n=false,r=this;return {amount:t,get released(){return n},release(){n||(n=true,r.used.release(t),r.activeReservations-=1);}}}child(t,n){this.assertLive(),this.used.add(n);let r=new e(t,n);return r.parent=this,r.carveAmount=n,this.children.add(r),r}onRelease(t){this.assertLive(),this.cleanups.push(t);}dispose(){if(this.disposed)return;if(this.children.size>0)throw new v(`${this.label}: cannot release with ${this.children.size} child budget(s) outstanding`);if(this.activeReservations>0)throw new v(`${this.label}: cannot release with ${this.activeReservations} reservation(s) outstanding`);let t=[];for(let n=this.cleanups.length-1;n>=0;n--)try{this.cleanups[n]();}catch(r){t.push(r);}if(this.disposed=true,this.parent&&(this.parent.children.delete(this),this.parent.used.release(this.carveAmount),this.parent=void 0),t.length>0)throw new v(`${this.label}: ${t.length} cleanup error(s); first: ${String(t[0])}`)}assertLive(){if(this.disposed)throw new v(`${this.label}: budget already released`)}};var Z=class extends Error{constructor(n,r){super(r?`cancelled: ${r}`:"cancelled");this.derivedOnly=n;this.name="CancellationError";}derivedOnly},U=class{_cancelled=false;_phase="pre-publication";_reason;cancel(t){this._cancelled=true,t!==void 0&&(this._reason=t);}markPublished(){this._phase="post-publication";}get isCancelled(){return this._cancelled}get phase(){return this._phase}get isPublished(){return this._phase==="post-publication"}get derivedOnly(){return this._cancelled&&this._phase==="post-publication"}get token(){let t=this;return {get isCancelled(){return t._cancelled},get phase(){return t._phase},get derivedOnly(){return t.derivedOnly},checkpoint(){if(t._cancelled)throw new Z(t.derivedOnly,t._reason)}}}};var ee=class extends Error{constructor(n){super(`runtime port not available: ${n}`);this.portId=n;this.name="PortResolutionError";}portId},De=class{ports=new Map;provide(t,n){return this.ports.set(t,n),this}has(t){return this.ports.has(t)}resolve(t){if(!this.ports.has(t))throw new ee(t);return this.ports.get(t)}missing(t){return t.filter(n=>!this.ports.has(n))}availablePorts(){return [...this.ports.keys()]}clock(){return this.resolve(chunk2GSRLGUI_cjs.x.clock)}identity(){return this.resolve(chunk2GSRLGUI_cjs.x.identity)}},Me=class{constructor(t=0,n=1){this.step=n;this.t=t;}step;t;now(){let t=this.t;return this.t+=this.step,t}},Fe=class{constructor(t="id"){this.prefix=t;}prefix;n=0;newId(){return this.n+=1,`${this.prefix}-${this.n}`}};function Kt(e){let t=chunk2GSRLGUI_cjs.C(e.limits),n=Object.freeze({...e.config??{}}),r=e.capacity??t.maxDecompressedBytes,o=e.id??"op",s={id:o,limits:t,config:n,ports:e.ports,budget:new B(`op:${o}`,r),cancellation:new U};return Object.freeze(s)}function Gt(e){e.budget.dispose();}var Be=Object.freeze({maxRecursionDepth:{unit:"depth",phase:"xml-parse"},maxElementCount:{unit:"count",phase:"xml-parse"},maxPartCount:{unit:"count",phase:"package-read"},maxDecompressedBytes:{unit:"bytes",phase:"package-read"},maxCompressedBytes:{unit:"bytes",phase:"package-read"},maxCompressionRatio:{unit:"ratio",phase:"package-read"},maxChunkBytes:{unit:"bytes",phase:"package-read"},maxPaginationPasses:{unit:"passes",phase:"layout"},maxQueueDepth:{unit:"count",phase:"output"}}),at=Object.keys(Be);function zt(e,t){return new chunk2GSRLGUI_cjs.H(`${Be[t].phase}:${t}`,e[t])}var Le=class{counter;current=0;peak=0;constructor(t){this.counter=new chunk2GSRLGUI_cjs.H("memory",t);}allocate(t){this.counter.add(t),this.current+=t,this.current>this.peak&&(this.peak=this.current);}free(t){this.counter.release(t),this.current=Math.max(0,this.current-t);}get currentBytes(){return this.current}get peakBytes(){return this.peak}reset(){this.counter.release(this.current),this.current=0;}};function Wt(){for(let e of at){let t=chunk2GSRLGUI_cjs.B[e],n=chunk2GSRLGUI_cjs.A[e];if(!Number.isFinite(t)||t<=0)throw new Error(`default ${e} must be finite > 0`);if(!Number.isFinite(n)||n<=0)throw new Error(`ceiling ${e} must be finite > 0`);if(t>n)throw new Error(`default ${e} exceeds ceiling`)}}function H(e,t=new Set){let n=new WeakSet,r=o=>{if(o===null)return "null";let s=typeof o;if(s==="boolean")return o?"true":"false";if(s==="number"){let a=o;if(!Number.isFinite(a))throw new Error(`non-finite number is not comparable: ${a}`);return Object.is(a,-0)?"0":String(a)}if(s==="string")return JSON.stringify(o);if(s==="bigint")return `${o.toString()}n`;if(Array.isArray(o))return `[${o.map(r).join(",")}]`;if(s==="object"){let a=o;if(n.has(a))throw new Error("cannot canonicalize a cyclic structure");n.add(a);let d=Object.keys(a).filter(l=>!t.has(l)).sort().map(l=>`${JSON.stringify(l)}:${r(a[l])}`).join(",");return n.delete(a),`{${d}}`}throw new Error(`unsupported value type in comparator input: ${s}`)};return r(e)}function Ue(e,t){let n=H(e,t),r=0xcbf29ce484222325n,o=0x100000001b3n,s=0xffffffffffffffffn;for(let a=0;a<n.length;a++)r^=BigInt(n.charCodeAt(a)),r=r*o&s;return r.toString(16).padStart(16,"0")}var R="dev.docx-editor.core.comparator",He={authoredState:{id:`${R}.authored-state`,mode:"canonical-exact",ephemera:["revision","provenance","producedAt","commitId"],note:"canonical normalized authored records; ephemera excluded"},anchor:{id:`${R}.anchor`,mode:"exact",ephemera:[],note:"internal anchor identity/affinity compares exactly"},yjsStateVector:{id:`${R}.yjs-state-vector`,mode:"sync-optimization-only",ephemera:[],note:"exchange optimization only; never proves update or delete-set coverage"},shapedRun:{id:`${R}.shaped-run`,mode:"exact",ephemera:[],note:"glyph ids, clusters, and fixed-point advances compare exactly"},paginationFingerprint:{id:`${R}.pagination-fingerprint`,mode:"exact",ephemera:[],note:"page/column boundaries, break causes, fixed-point geometry compare exactly"},semanticTree:{id:`${R}.semantic-tree`,mode:"exact",ephemera:[],note:"reading order, roles, headings, alt text compare exactly"},hitTest:{id:`${R}.hit-test`,mode:"exact",ephemera:[],note:"resolved hit target and cluster affinity compare exactly"},pdfSemantics:{id:`${R}.pdf-semantics`,mode:"canonical-exact",ephemera:["objectNumber","producer","creationDate","modDate","subsetTag"],note:"canonical semantic PDF objects; container ephemera excluded"},rasterCheckpoint:{id:`${R}.raster-checkpoint`,mode:"tolerance",ephemera:[],note:"documented unavoidable raster comparison; explicit tolerance only"},benchmarkEvidence:{id:`${R}.benchmark-evidence`,mode:"sync-optimization-only",ephemera:[],note:"diagnostic evidence, not an equivalence basis"}};function Ve(e,t,n,r={}){let o=He[e];switch(o.mode){case "sync-optimization-only":throw new Error(`${o.id} is not an equivalence basis (${o.note})`);case "tolerance":{if(r.epsilon===void 0)throw new Error(`${o.id} requires an explicit epsilon`);return {equal:st(t,n,r.epsilon)}}case "exact":case "canonical-exact":{let s=o.mode==="canonical-exact"?new Set(o.ephemera):new Set,a=H(t,s),i=H(n,s);return a===i?{equal:true}:{equal:false,left:a,right:i}}}}function je(e,t){let n=He[e];if(n.mode==="tolerance"||n.mode==="sync-optimization-only")throw new Error(`${n.id} has no canonical fingerprint (${n.mode})`);let r=n.mode==="canonical-exact"?new Set(n.ephemera):void 0;return Ue(t,r)}function st(e,t,n){return typeof e=="number"&&typeof t=="number"?Number.isFinite(e)&&Number.isFinite(t)&&Math.abs(e-t)<=n:Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((r,o)=>st(r,t[o],n)):false}var ct=new Set([...chunk2GSRLGUI_cjs.u,...chunk2GSRLGUI_cjs.v]),lt=/^[0-9a-f]{16}$/,Yt=/^[0-9a-f]*$/;function Xe(e){let t=[],n=o=>t.push(o);e.formatVersion!==1&&n(`unsupported formatVersion ${e.formatVersion}`),e.documentId||n("documentId is required"),e.source.kind==="docx"&&!/^[0-9a-f]{64}$/.test(e.source.sha256)&&n("docx source requires a 64-hex sha256");let r=-1;e.steps.forEach((o,s)=>{let a=`step[${s}]`;ct.has(o.origin)||n(`${a}: unknown origin ${o.origin}`),(!Number.isInteger(o.baseRevision)||o.baseRevision<0)&&n(`${a}: baseRevision must be a non-negative integer`),o.baseRevision<r&&n(`${a}: baseRevision regressed below ${r}`);let i=o.expect;i.outcome==="applied"?(i.committedRevision===void 0?n(`${a}: applied step needs committedRevision`):i.committedRevision<=o.baseRevision?n(`${a}: committedRevision ${i.committedRevision} must exceed baseRevision ${o.baseRevision}`):r=i.committedRevision,i.modelChange&&Jt(i.modelChange,a,n)):(i.committedRevision!==void 0&&n(`${a}: ${i.outcome} step must not commit a revision`),i.authoredStateHash!==void 0&&n(`${a}: ${i.outcome} step must not change authored state`)),i.authoredStateHash!==void 0&&!lt.test(i.authoredStateHash)&&n(`${a}: authoredStateHash must be 16-hex`),i.outputHash!==void 0&&!lt.test(i.outputHash)&&n(`${a}: outputHash must be 16-hex`);});for(let o of [...e.snapshots??[],...e.updates??[]])o.documentId!==e.documentId&&n(`envelope documentId ${o.documentId} != ${e.documentId}`),Yt.test(o.bytesHex)||n("envelope bytesHex must be hex"),o.bytesHex.length!==o.byteLength*2&&n(`envelope byteLength ${o.byteLength} disagrees with ${o.bytesHex.length/2} decoded bytes`);return {valid:t.length===0,errors:t}}function Jt(e,t,n){ct.has(e.origin)||n(`${t}: modelChange origin ${e.origin} unknown`),e.toRevision<=e.fromRevision&&n(`${t}: modelChange revision must advance`);}function qt(e,t){let n=Xe(e);if(!n.valid)return {ok:false,mismatches:n.errors};let r=[];return t.init(e),e.steps.forEach((o,s)=>{let a=`step[${s}]`,i=t.applyStep(o),d=o.expect;if(i.outcome!==d.outcome){r.push(`${a}: outcome ${i.outcome} != expected ${d.outcome}`);return}if(d.outcome==="applied"&&(i.committedRevision!==d.committedRevision&&r.push(`${a}: revision ${i.committedRevision} != expected ${d.committedRevision}`),d.authoredStateHash!==void 0))if(i.authoredState===void 0)r.push(`${a}: store returned no authored state to hash`);else {Ve("authoredState",i.authoredState,i.authoredState).equal||r.push(`${a}: authored state is not self-consistent`);let c=dt(i.authoredState);c!==d.authoredStateHash&&r.push(`${a}: authoredStateHash ${c} != expected ${d.authoredStateHash}`);}}),{ok:r.length===0,mismatches:r}}function dt(e){return je("authoredState",e)}var Qt=new Map([["embedRegular","regular"],["embedBold","bold"],["embedItalic","italic"],["embedBoldItalic","boldItalic"]]),Zt=32;function mt(e,t){let n=t.replace(/[^0-9a-fA-F]/g,"");if(n.length!==32)return null;let r=new Uint8Array(16);for(let a=0;a<16;a+=1){let i=Number.parseInt(n.slice(a*2,a*2+2),16);if(Number.isNaN(i))return null;r[15-a]=i;}let o=new Uint8Array(e),s=Math.min(Zt,o.length);for(let a=0;a<s;a+=1)o[a]=o[a]^r[a%16];return o}var Ke=(e,t)=>{if(!(e.kind==="textValue"||!("attributes"in e))){for(let n of e.attributes??[])if(n.localName===t)return n.value}},pt=e=>e.kind==="textValue"?[]:e.children??[],ut=e=>e.kind==="textValue"||!("localName"in e)?"":e.localName;function en(e,t,n){for(let r of e.relationships.get(t)??[]){if(r.id!==n)continue;if(r.targetMode==="External")return null;let o=chunk2GSRLGUI_cjs.r(t,r.rawTarget);return o.ok?o.partName:null}return null}function tn(e,t,n={}){if(!t)return [];let r=n.maxFontBytes??16*1024*1024,o=n.maxFonts??64,s=[],a=new Map,i=d=>{if(!(s.length>=o)){if(ut(d)==="font"){let l=Ke(d,"name");if(l&&l.length<=128)for(let c of pt(d)){if(s.length>=o)return;let p=Qt.get(ut(c));if(!p)continue;let u=Ke(c,"id"),m=Ke(c,"fontKey");if(!u||!m)continue;let f=en(e,t.name,u);if(!f)continue;let y=e.partBytes.get(f);if(!y||y.length===0||y.length>r)continue;let g=a.get(f);if(g){s.push({family:l,style:p,bytes:g,partName:f});continue}let O=mt(y,m);O&&(a.set(f,O),s.push({family:l,style:p,bytes:O,partName:f}));}}for(let l of pt(d))i(l);}};return i(t.root),s}function ft(e){if(e.kind!=="textValue")for(let t of e.children){if(t.kind==="textValue")continue;if(t.kind==="hyperlink"){let r=chunk2GSRLGUI_cjs.Sa(t);if(r!==void 0&&r.length>0)return r}let n=ft(t);if(n!==void 0)return n}}function nn(e){let t="",n=false,r=o=>{if(!(n||o.kind==="textValue")){if(o.kind==="tab"||o.localName==="ptab"||o.localName==="tab"){n=true;return}if(o.kind==="text"||o.localName==="t"){for(let s of o.children)s.kind==="textValue"&&(t+=s.value);return}for(let s of o.children)r(s);}};return r(e),chunk2GSRLGUI_cjs.Hc(t)}function rn(e,t,n,r){let o=n.filter(d=>{if(r.has(d.blockId))return false;let l=d.level+1;return l>=t.instruction.outlineStart&&l<=t.instruction.outlineEnd}),s=new Set(o.map(d=>d.blockId)),a=chunk2GSRLGUI_cjs.Cc(e),i=new Map;for(let d of o){let l=chunk2GSRLGUI_cjs.Hc(d.text),c=i.get(l);c?c.push(d.blockId):i.set(l,[d.blockId]);}return t.resultParagraphIds.map(d=>{let l=chunk2GSRLGUI_cjs.Fa(e,d);if(!l||l.kind==="textValue")return null;let c=ft(l),p=c===void 0?void 0:a.get(c);if(p&&s.has(p.paragraphId)){let f=i.get(chunk2GSRLGUI_cjs.Hc(o.find(g=>g.blockId===p.paragraphId)?.text??"")),y=f?.indexOf(p.paragraphId)??-1;return f&&y>=0&&f.splice(y,1),p.paragraphId}let u=nn(l);if(u.length===0)return null;let m=i.get(u);return !m||m.length===0?null:m.shift()??null})}function C(e){return e.namespaceUri===chunk2GSRLGUI_cjs.ma?e.localName:`{${e.namespaceUri}}${e.localName}`}function I(e){let t=[];for(let n of e.attributes)t.push(n.namespaceUri===""||n.namespaceUri===chunk2GSRLGUI_cjs.ma?`${n.localName}=${n.value}`:`{${n.namespaceUri}}${n.localName}=${n.value}`);return t.sort(),t}function gt(e,t){let n=I(e),r=n.length>0?`${C(e)}(${n.join(",")})`:C(e);if(t>=chunk2GSRLGUI_cjs.ca)return r;let o=[];for(let s of e.children){if(s.kind==="textValue"){s.value!==""&&o.push(`#${s.value}`);continue}o.push(gt(s,t+1));}return o.sort(),o.length>0?`${r}[${o.join(",")}]`:r}function yt(e){if(!e)return [];let t=[];for(let n of e.children)n.namespaceUri===chunk2GSRLGUI_cjs.ma&&t.push(gt(n,1));return t.sort(),t}function Ge(e){if(e.kind==="textValue")return e.value;if(e.kind==="tab")return " ";if(e.kind==="hardBreak")return chunk2GSRLGUI_cjs._b(e);if(e.kind==="drawing")return chunk2GSRLGUI_cjs.mc();if(e.kind==="runProperties"||e.kind==="paragraphProperties"||e.kind==="generic")return "";if(e.kind==="hyperlink"||chunk2GSRLGUI_cjs.Lb(e)){let n="",r=e.kind==="hyperlink"?e.children:chunk2GSRLGUI_cjs.Nb(e)??[];for(let o of r)n+=Ge(o);return n}let t="";for(let n of e.children)t+=Ge(n);return t}function x(e,t){let n=new Map(e);for(let r of t.namespaceBindings)n.set(r.prefix,r.namespaceUri);return n}function V(e,t){try{return chunk2GSRLGUI_cjs.wa(e,t)}catch(n){if(n instanceof chunk2GSRLGUI_cjs.qa&&n.reason==="undeclared-prefix")return `generic-refusal:undeclared-prefix:{${e.namespaceUri}}${e.localName}`;throw n}}function ze(e,t,n=chunk2GSRLGUI_cjs.va){if(e.kind==="textValue")return;if(e.kind==="runProperties"||e.kind==="paragraphProperties"){let o=x(n,e),s=[];for(let a of e.children)a.namespaceUri!==chunk2GSRLGUI_cjs.ma&&s.push(V(a,o));s.sort(),t.push(...s);return}if(e.kind==="generic"){t.push(V(e,n));return}if(chunk2GSRLGUI_cjs.Lb(e)){t.push(chunk2GSRLGUI_cjs.xa(e));return}if(e.kind==="bookmarkStart"||e.kind==="bookmarkEnd"){t.push(chunk2GSRLGUI_cjs.wa(e,n));return}if(e.kind==="drawing"){t.push(ht(e));return}if(chunk2GSRLGUI_cjs.la(e.kind))return;let r=x(n,e);for(let o of e.children)ze(o,t,r);}function on(e){return `hyperlink(${e.attributes.map(n=>`${n.namespaceUri}|${n.localName}=${n.value}`).sort().join(",")})`}function an(e){for(let t of e.children)if(t.kind==="pictureBlipFill")for(let n of t.children){if(n.kind!=="pictureBlip")continue;let r=n.attributes.find(s=>s.localName==="embed"&&s.namespaceUri===chunk2GSRLGUI_cjs.pa)?.value,o=n.attributes.find(s=>s.localName==="link"&&s.namespaceUri===chunk2GSRLGUI_cjs.pa)?.value;if(r!==void 0)return `embed=${r}`;if(o!==void 0)return `link=${o}`}}function te(e,t,n){if(e.kind==="textValue")return `#${e.value}`;if(t>=chunk2GSRLGUI_cjs.ca)return C(e);let r=x(n,e);if(e.kind==="generic")return V(e,r);let o=I(e),s=o.length>0?`${C(e)}(${o.join(",")})`:C(e),a=[];for(let i of e.children)i.kind!=="textValue"&&a.push(te(i,t+1,r));return a.sort(),a.length>0?`${s}[${a.join(",")}]`:s}function sn(e,t,n){let r=x(n,e),o=[];for(let s of e.children)if(s.kind!=="textValue"){if(s.kind==="pictureBlipFill"){let a=s.children,i=a.find(l=>l.kind==="pictureBlip"),d=a.filter(l=>l.kind!=="pictureBlip").map(l=>te(l,t+1,r));if(d.sort(),i&&i.kind==="pictureBlip"){let l=I(i),c=l.length>0?`pictureBlip(${l.join(",")})`:"pictureBlip";o.push(d.length>0?`${c}[${d.join(",")}]`:c);}else for(let l of a)o.push(te(l,t+1,r));continue}o.push(te(s,t+1,r));}return o.sort(),o}function We(e,t,n){if(e.kind==="textValue")return `#${e.value}`;if(t>=chunk2GSRLGUI_cjs.ca)return C(e);let r=x(n,e);if(e.kind==="drawingDocPr"){let i=I(e);return i.length>0?`docPr(${i.join(",")})`:"docPr"}if(e.kind==="picture"){let i=an(e),d=sn(e,t+1,r),l=i===void 0?"picture":`picture(${i})`;return d.length>0?`${l}[${d.join(",")}]`:l}let o=I(e),s=o.length>0?`${C(e)}(${o.join(",")})`:C(e),a=[];for(let i of e.children){if(i.kind==="picture"){a.push(We(i,t+1,r));continue}if(i.kind==="generic"){a.push(V(i,r));continue}i.kind!=="textValue"&&a.push(We(i,t+1,r));}return a.length>0?`${s}[${a.join(",")}]`:s}function ht(e){let t=x(chunk2GSRLGUI_cjs.va,e),n=e.children.find(i=>i.kind==="inlineDrawing"||i.kind==="anchoredDrawing");if(!n||n.kind==="textValue")return `drawing(${I(e).join(",")})`;let r=x(t,n),o=I(n),s=o.length>0?`${n.kind}(${o.join(",")})`:n.kind,a=[];for(let i of n.children){if(i.kind==="generic"){a.push(V(i,r));continue}i.kind!=="textValue"&&a.push(We(i,1,r));}return a.length>0?`drawing[${s};${a.join(";")}]`:`drawing[${s}]`}function ln(e,t,n){let r=e.children.find(c=>c.kind==="paragraphProperties"),o=[],s="",a=[],i=x(chunk2GSRLGUI_cjs.va,e),d=(c,p)=>{if(c.kind==="run"){let u=x(p,c),m=c.children.find(f=>f.kind==="runProperties");o.push(yt(m)),s+=Ge(c);for(let f of c.children)ze(f,a,u);return}if(c.kind==="drawing"){a.push(ht(c));return}if(c.kind==="hyperlink"){a.push(on(c));let u=x(p,c);for(let m of c.children)d(m,u);return}if(c.kind==="contentControl"){a.push(chunk2GSRLGUI_cjs.xa({...c,children:c.children.filter(m=>m.kind!=="contentControlContent")}));let u=x(p,c);for(let m of c.children){if(m.kind!=="contentControlContent")continue;let f=x(u,m);for(let y of m.children)d(y,f);}return}ze(c,a,p);};for(let c of e.children)d(c,i);let l=chunk2GSRLGUI_cjs.Oc(e);return {ordinal:t,path:n,paraId:l===null?null:l.toUpperCase(),text:s,paragraphProperties:yt(r),runProperties:o,genericStructure:a}}function cn(e){if(e.localName==="hdr"||e.localName==="ftr"||e.kind==="body")return e;for(let t of e.children)if(t.kind!=="textValue"&&(t.kind==="body"||t.localName==="hdr"||t.localName==="ftr"))return t;return e}function xt(e,t,n,r,o,s){if(s>chunk2GSRLGUI_cjs.ca)return;let a=0;for(let i of e.children){if(i.kind==="textValue"){i.value.trim()!==""&&o.push(`${t}/#text ${i.value}`);continue}let d=t===""?String(a):`${t}/${a}`;if(a+=1,i.kind==="paragraph"){n.push(i),r.push(d),o.push(`${d} p`);continue}let l=I(i);o.push(l.length>0?`${d} ${C(i)}(${l.join(",")})`:`${d} ${C(i)}`),xt(i,d,n,r,o,s+1);}}function Nt(e){let t=cn(e.root),n=[],r=[],o=[];xt(t,"",n,r,o,0);let s=n.map((a,i)=>ln(a,i,r[i]));return {partName:e.name,paragraphs:s,structure:o}}function dn(e){let t=[];for(let n of e){let r=Nt(n);r&&t.push(r);}return {stories:t}}function pn(e,t){let n=[],r=(s,a,i)=>{n.push({path:s,before:JSON.stringify(a)??"undefined",after:JSON.stringify(i)??"undefined"});};e.stories.length!==t.stories.length&&r("stories.length",e.stories.length,t.stories.length);let o=Math.min(e.stories.length,t.stories.length);for(let s=0;s<o;s+=1){let a=e.stories[s],i=t.stories[s],d=p=>`${a.partName}${p}`;a.paragraphs.length!==i.paragraphs.length&&r(d(".paragraphs.length"),a.paragraphs.length,i.paragraphs.length);let l=Math.min(a.paragraphs.length,i.paragraphs.length);for(let p=0;p<l;p+=1){let u=a.paragraphs[p],m=i.paragraphs[p];u.text!==m.text&&r(d(`.p[${p}].text`),u.text,m.text),u.path!==m.path&&r(d(`.p[${p}].path`),u.path,m.path),u.paraId!==m.paraId&&r(d(`.p[${p}].paraId`),u.paraId,m.paraId),JSON.stringify(u.paragraphProperties)!==JSON.stringify(m.paragraphProperties)&&r(d(`.p[${p}].paragraphProperties`),u.paragraphProperties,m.paragraphProperties),JSON.stringify(u.runProperties)!==JSON.stringify(m.runProperties)&&r(d(`.p[${p}].runProperties`),u.runProperties,m.runProperties),JSON.stringify(u.genericStructure)!==JSON.stringify(m.genericStructure)&&r(d(`.p[${p}].genericStructure`),u.genericStructure,m.genericStructure);}a.structure.length!==i.structure.length&&r(d(".structure.length"),a.structure.length,i.structure.length);let c=Math.min(a.structure.length,i.structure.length);for(let p=0;p<c;p+=1)a.structure[p]!==i.structure[p]&&r(d(`.structure[${p}]`),a.structure[p],i.structure[p]);}return n}var j="http://schemas.openxmlformats.org/wordprocessingml/2006/main",fn="http://schemas.openxmlformats.org/package/2006/relationships",Ot="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",_="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",yn="application/vnd.openxmlformats-package.relationships+xml",gn="http://schemas.openxmlformats.org/package/2006/content-types",Rt="/[Content_Types].xml",E="/word/numbering.xml",Ct=[{text:"\uF0B7",font:"Symbol"},{text:"o",font:"Courier New"},{text:"\uF0A7",font:"Wingdings"}],bt=["decimal","lowerLetter","lowerRoman"],Ye=9;function St(e,t){let n=720*(t+1),r='<w:start w:val="1"/>';if(e==="bullet"){let a=Ct[t%Ct.length];return `<w:lvl w:ilvl="${t}">${r}<w:numFmt w:val="bullet"/><w:lvlText w:val="${a.text}"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="${n}" w:hanging="360"/></w:pPr><w:rPr><w:rFonts w:ascii="${a.font}" w:hAnsi="${a.font}" w:hint="default"/></w:rPr></w:lvl>`}let o=bt[t%bt.length],s=o==="lowerRoman";return `<w:lvl w:ilvl="${t}">${r}<w:numFmt w:val="${o}"/><w:lvlText w:val="%${t+1}."/><w:lvlJc w:val="${s?"right":"left"}"/><w:pPr><w:ind w:left="${n}" w:hanging="${s?180:360}"/></w:pPr></w:lvl>`}function hn(e,t){let n=Array.from({length:Ye},(r,o)=>St(e,o)).join("");return `<w:abstractNum w:abstractNumId="${t}"><w:multiLevelType w:val="${e==="bullet"?"hybridMultilevel":"multilevel"}"/>${n}</w:abstractNum>`}function xn(){let e=chunk2GSRLGUI_cjs.Ba(`<w:numbering xmlns:w="${j}"></w:numbering>`,{name:E,contentType:_});return e.ok?e.part:null}var b=(e,t)=>{let n=[];for(let r of e.children)r.kind==="textValue"||r.localName!==t||r.namespaceUri===j&&n.push(r);return n},N=(e,t)=>e.attributes.find(n=>n.localName===t)?.value;function vt(e,t){let n=chunk2GSRLGUI_cjs.Ba(`<w:numbering xmlns:w="${j}">${e}</w:numbering>`,{name:E,contentType:_});if(!n.ok)return null;let r=[];for(let o of n.part.root.children)o.kind!=="textValue"&&r.push(o);if(r.length!==t.length)return null;for(let o=0;o<t.length;o+=1){let s=r[o],a=t[o];if(s.namespaceUri!==j||s.localName!==a.localName||a.attribute&&N(s,a.attribute.localName)!==a.attribute.value)return null}return r}var Et=["numPicBullet","abstractNum","num","numIdMacAtCleanup"];function Pt(e,t,n){let r=t.indexOf(n);if(r===-1)return e.length;let o=0;return e.forEach((s,a)=>{if(s.kind==="textValue")return;let i=t.indexOf(s.localName);i!==-1&&i<=r&&(o=a+1);}),o}function It(e,t){let n=0;for(let r of e){let o=N(r,t);!o||!/^\d{1,9}$/.test(o)||(n=Math.max(n,Number(o)));}return n+1}function Nn(e,t){let n=e.parts.get(E),r=n??xn();if(!r)return null;let o=r.root,s=b(o,"abstractNum"),a=b(o,"num"),i=t==="bullet"?"bullet":"decimal";for(let O of a){let $=N(O,"numId"),qe=b(O,"abstractNumId")[0],Qe=qe?N(qe,"val"):void 0;if(!$||!Qe)continue;let Ze=s.find(X=>N(X,"abstractNumId")===Qe);if(!Ze)continue;let et=b(Ze,"lvl").find(X=>N(X,"ilvl")==="0"||N(X,"ilvl")===void 0),tt=et?b(et,"numFmt")[0]:void 0;if(tt&&N(tt,"val")===i)return {pkg:e,numId:$}}let d=It(s,"abstractNumId"),l=It(a,"numId"),c=vt(hn(t,d)+`<w:num w:numId="${l}"><w:abstractNumId w:val="${d}"/></w:num>`,[{localName:"abstractNum",attribute:{localName:"abstractNumId",value:String(d)}},{localName:"num",attribute:{localName:"numId",value:String(l)}}]);if(!c)return null;let p=chunk2GSRLGUI_cjs.Da(r),[u,m]=c.map(O=>ne(O,p));if(!u||!m)return null;let f=chunk2GSRLGUI_cjs.Ia(r,o.id,Pt(o.children,Et,"abstractNum"),[u]);if(!f.ok)return null;let y=chunk2GSRLGUI_cjs.Ia(f.part,o.id,Pt(f.part.root.children,Et,"num"),[m]);if(!y.ok)return null;let g=Object.freeze({...e,parts:new Map([...e.parts,[E,y.part]])});if(!n){let O=bn(g);if(!O)return null;let $=kn(O);if(!$)return null;g=$;}return {pkg:g,numId:String(l)}}var On=["nsid","multiLevelType","tmpl","name","styleLink","numStyleLink","lvl"];function Tt(e){let t=N(e,"ilvl");return t===void 0||!/^\d{1,9}$/.test(t)?null:Number(t)}function Rn(e,t){let n=0;return e.forEach((r,o)=>{if(r.kind!=="textValue"){if(r.localName==="lvl"&&r.namespaceUri===j){(Tt(r)??0)<t&&(n=o+1);return}On.includes(r.localName)&&(n=o+1);}}),n}function Cn(e,t,n,r){if(!Number.isInteger(n)||n<0||n>=Ye||t.length===0||t.length>64)return null;let o=e.parts.get(E);if(!o)return null;let s=o.root,a=b(s,"num").find(f=>N(f,"numId")===t),i=a?b(a,"abstractNumId")[0]:void 0,d=i?N(i,"val"):void 0;if(!d)return null;let l=b(s,"abstractNum").find(f=>N(f,"abstractNumId")===d);if(!l||b(l,"numStyleLink").length>0)return null;let c=b(l,"lvl");if(c.some(f=>Tt(f)===n))return e;if(c.length>=Ye)return null;let p=vt(St(r,n),[{localName:"lvl",attribute:{localName:"ilvl",value:String(n)}}]);if(!p)return null;let u=chunk2GSRLGUI_cjs.Da(o),m=chunk2GSRLGUI_cjs.Ia(o,l.id,Rn(l.children,n),[ne(p[0],u)]);return m.ok?Object.freeze({...e,parts:new Map([...e.parts,[E,m.part]])}):null}function ne(e,t){return e.kind==="textValue"?{...e,id:t()}:{...e,id:t(),children:e.children.map(n=>ne(n,t))}}function bn(e){let t=e.mainDocumentPart,n=En(t),r=e.parts.get(n),o=Pn(e),s=chunk2GSRLGUI_cjs.Ba(`<Relationships xmlns="${fn}"><Relationship Id="${o}" Type="${Ot}" Target="numbering.xml"/></Relationships>`,{name:n,contentType:yn});if(!s.ok)return null;let a=e.relationships.get(t)??[],i={ownerPart:t,id:o,type:Ot,rawTarget:"numbering.xml",targetMode:"Internal",order:a.reduce((u,m)=>Math.max(u,m.order),-1)+1},d=new Map([...e.relationships,[t,[...a,i]]]);if(!r)return Object.freeze({...e,parts:new Map([...e.parts,[n,s.part]]),relationships:d});let l=chunk2GSRLGUI_cjs.Da(r),c=s.part.root.children[0];if(!c)return null;let p=chunk2GSRLGUI_cjs.Ia(r,r.root.id,r.root.children.length,[ne(c,l)]);return p.ok?Object.freeze({...e,parts:new Map([...e.parts,[n,p.part]]),relationships:d}):null}function En(e){let t=e.lastIndexOf("/");return `${e.slice(0,t)}/_rels/${e.slice(t+1)}.rels`}function Pn(e){let t=0;for(let n of e.relationships.values())for(let r of n){let o=/^rId(\d{1,9})$/.exec(r.id);o&&(t=Math.max(t,Number(o[1])));}for(let n of e.externalTargets){let r=/^rId(\d{1,9})$/.exec(n.id);r&&(t=Math.max(t,Number(r[1])));}return `rId${t+1}`}var In=`<Override PartName="${E}" ContentType="${_}"/>`;function kn(e){let t=e.contentTypes.overrides.get(chunk2GSRLGUI_cjs.p(E));if(t===_)return e;if(t!==void 0)return null;let n=e.partBytes.get(Rt);if(!n)return null;let r=fflate.strFromU8(n),o=kt(r);if(!o)return null;let s=r.lastIndexOf(`</${o.rootName}>`);if(s===-1)return null;let a=r.slice(0,s)+In+r.slice(s),i=kt(a);if(!i||i.rootName!==o.rootName)return null;let d=[...o.children,wt("Override",{PartName:E,ContentType:_})];return i.children.length!==d.length||i.children.some((l,c)=>l!==d[c])?null:Object.freeze({...e,partBytes:new Map([...e.partBytes,[Rt,fflate.strToU8(a)]]),contentTypes:Object.freeze({defaults:e.contentTypes.defaults,overrides:new Map([...e.contentTypes.overrides,[chunk2GSRLGUI_cjs.p(E),_]])})})}function kt(e){let t=chunk2GSRLGUI_cjs.da(e);if(!t.ok)return null;let n=t.nodes.filter(i=>i.type==="element");if(n.length!==1)return null;let r=n[0],o=r.name.indexOf(":"),s=o===-1?"":r.name.slice(0,o);if(r.name.slice(o+1)!=="Types"||r.attributes[s?`xmlns:${s}`:"xmlns"]!==gn)return null;let a=[];for(let i of r.children)i.type==="element"&&a.push(wt(i.name,i.attributes));return {rootName:r.name,children:a}}function wt(e,t){let n=Object.entries(t).map(([r,o])=>`${r}=${o}`).sort();return [e,...n].join("")}function re(e){return e!=null&&e.kind!=="textValue"}function Je(e,t){for(let n of e.children)if(n.kind!=="textValue"&&n.namespaceUri===chunk2GSRLGUI_cjs.ma&&n.localName===t)return n;return null}function oe(e,t){for(let n of e.attributes)if(n.namespaceUri===chunk2GSRLGUI_cjs.ma&&n.localName===t)return n.value}function A(e,t){let n=Je(e,t);if(!n)return false;let r=oe(n,"val");return r===void 0?true:r!=="0"&&r!=="false"&&r!=="off"}var _t=Object.freeze({trackRevisions:false,restrictedToTrackedChanges:false,doNotTrackMoves:false,doNotTrackFormatting:false});function Sn(e){if(!re(e))return _t;let t=Je(e,"documentProtection"),n=t===null?void 0:oe(t,"enforcement"),r=n!==void 0&&n!=="0"&&n!=="false"&&n!=="off";return {trackRevisions:A(e,"trackRevisions"),restrictedToTrackedChanges:r&&t!==null&&oe(t,"edit")==="trackedChanges",doNotTrackMoves:A(e,"doNotTrackMoves"),doNotTrackFormatting:A(e,"doNotTrackFormatting")}}var At=Object.freeze({doNotShadeFormData:false});function vn(e){return re(e)?{doNotShadeFormData:A(e,"doNotShadeFormData")}:At}function Tn(e,t){let n=e.parts.get(t.storyPartName);if(!n)return {ok:false,reason:`no story part named ${t.storyPartName}`};let r=[];for(let d of chunk2GSRLGUI_cjs.te(n.root)){let l=chunk2GSRLGUI_cjs.re(d.node).tag;if(l===void 0||l.length===0)continue;let c=t.decide(l);c!=="keep"&&r.push({nodeId:d.node.id,policy:c});}let o=n,s=0,a=0;for(let{nodeId:d,policy:l}of r){let c=chunk2GSRLGUI_cjs.Ga(o,d);if(!c)continue;if(l==="remove"){let g=chunk2GSRLGUI_cjs.Ka(o,d,{deferValidation:true});if(!g.ok)return {ok:false,reason:`a node could not be removed: ${$t(g)}`};o=g.part,a+=1;continue}let p=c.children.find(g=>g.id===d);if(!p)continue;let u=chunk2GSRLGUI_cjs.pe(p),m=u?u.children:[],f=c.children.flatMap(g=>g.id===d?m:[g]),y=chunk2GSRLGUI_cjs.Ha(o,c.id,f,{deferValidation:true});if(!y.ok)return {ok:false,reason:`a node could not be unwrapped: ${$t(y)}`};o=y.part,s+=1;}let i=o===n?e:chunk2GSRLGUI_cjs.Ab(e,o);if(!i.parts.has(t.storyPartName))return {ok:false,reason:"the story went missing during the export"};for(let d of t.namespaces)for(let l of _n(i,t.storyPartName,d)){let c=chunk2GSRLGUI_cjs.if(i,l.itemId),p=chunk2GSRLGUI_cjs.cf(i,l.partName,c);if(p.pkg===i&&p.removed.length===0&&!wn(i,l.partName,c))return {ok:false,reason:`the payloads in ${d} could not be removed`};if(i=p.pkg,c.size>0)continue;let u=An(i,l);if(!u.ok)return {ok:false,reason:`the payload store for ${d} could not be removed`};i=u.pkg;}return {ok:true,pkg:i,unwrapped:s,removed:a}}function wn(e,t,n){return chunk2GSRLGUI_cjs._e(e,t).every(r=>n.has(r.id))}function $t(e){return e.issues.map(t=>t.code).join(", ")||"the edit was refused"}function _n(e,t,n){return chunk2GSRLGUI_cjs.We(e,t).filter(r=>r.namespaceUri===n)}function An(e,t){let n=chunk2GSRLGUI_cjs.Gb(e,t.partName);if(!n.ok)return {pkg:e,ok:false};let r=chunk2GSRLGUI_cjs.Gb(n.pkg,t.propsPartName);return r.ok?{pkg:r.pkg,ok:true}:{pkg:e,ok:false}}var ie="http://purl.org/dc/elements/1.1/",Dt="http://schemas.openxmlformats.org/package/2006/metadata/core-properties",Mt="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties";var sp=Object.freeze({});function k(e,t,n){if(e.kind!=="textValue")for(let r of e.children){if(r.kind==="textValue"||r.namespaceUri!==t||r.localName!==n)continue;let o=r.children.find(a=>a.kind==="textValue");if(!o||o.kind!=="textValue")return;let s=o.value.trim();return s.length===0?void 0:s.length>4096?s.slice(0,4096):s}}function lp(e,t){let n={};if(e&&e.kind!=="textValue"){let r=k(e,ie,"title");r!==void 0&&(n.title=r);let o=k(e,ie,"creator");o!==void 0&&(n.creator=o);let s=k(e,ie,"subject");s!==void 0&&(n.subject=s);let a=k(e,ie,"description");a!==void 0&&(n.description=a);let i=k(e,Dt,"keywords");i!==void 0&&(n.keywords=i);let d=k(e,Dt,"lastModifiedBy");d!==void 0&&(n.lastModifiedBy=d);}if(t&&t.kind!=="textValue"){let r=k(t,Mt,"Company");r!==void 0&&(n.company=r);let o=k(t,Mt,"Manager");o!==void 0&&(n.manager=o);}return n}
|
|
2
|
+
exports.A=Ve;exports.B=je;exports.C=Xe;exports.D=qt;exports.E=dt;exports.F=mt;exports.G=tn;exports.H=rn;exports.I=Nt;exports.J=dn;exports.K=pn;exports.L=Nn;exports.M=Cn;exports.N=_t;exports.O=Sn;exports.P=At;exports.Q=vn;exports.R=sp;exports.S=lp;exports.T=Tn;exports.a=Ft;exports.b=ot;exports.c=J;exports.d=S;exports.e=q;exports.f=Q;exports.g=h;exports.h=Ht;exports.i=v;exports.j=B;exports.k=Z;exports.l=U;exports.m=ee;exports.n=De;exports.o=Me;exports.p=Fe;exports.q=Kt;exports.r=Gt;exports.s=Be;exports.t=at;exports.u=zt;exports.v=Le;exports.w=Wt;exports.x=H;exports.y=Ue;exports.z=He;
|