@docx-editor.dev/core 2.21.0 → 2.21.1
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/README.md +31 -31
- package/dist/automation.cjs +1 -1
- package/dist/automation.d.ts +10 -10
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.ts +8 -8
- package/dist/binding.js +1 -1
- package/dist/chunk-25OQBAKA.js +2 -0
- package/dist/chunk-3B3DQMSL.js +11 -0
- package/dist/chunk-3P3DNJYM.js +5 -0
- package/dist/chunk-3PA64KPK.js +5 -0
- package/dist/{chunk-4EHMMSFR.cjs → chunk-4TYA4RLP.cjs} +1 -1
- package/dist/chunk-7N77EN2Z.cjs +2 -0
- package/dist/{chunk-TE43S3LX.cjs → chunk-AGWWNVIJ.cjs} +1 -1
- package/dist/{chunk-Q2B6HX3R.js → chunk-BF2TOG2V.js} +1 -1
- package/dist/chunk-DFTVN25X.cjs +5 -0
- package/dist/{chunk-BQXF2PFF.js → chunk-DGONGMAV.js} +1 -1
- package/dist/{chunk-BDAY2ETZ.js → chunk-DZYKU2HG.js} +1 -1
- package/dist/chunk-E5OUYRNM.cjs +5 -0
- package/dist/{chunk-S35UK656.cjs → chunk-F4H3LC6M.cjs} +1 -1
- package/dist/{chunk-X5QNSISI.js → chunk-FPDIJ4RF.js} +1 -1
- package/dist/chunk-IUTTOBQW.cjs +20 -0
- package/dist/{chunk-WQFNWLNY.cjs → chunk-IYCXQAFT.cjs} +2 -2
- package/dist/chunk-JL3SI5SZ.js +18 -0
- package/dist/chunk-OFWUHH52.js +20 -0
- package/dist/chunk-OKY6JRJL.js +4 -0
- package/dist/{chunk-XZY4Q6PJ.cjs → chunk-P24FHMQW.cjs} +1 -1
- package/dist/chunk-QBKAOSVF.cjs +18 -0
- package/dist/{chunk-PYXMAUNR.cjs → chunk-RA2TDTEQ.cjs} +1 -1
- package/dist/{chunk-Z2ETEZRU.cjs → chunk-T5B4NMKF.cjs} +1 -1
- package/dist/{chunk-VUNFWXHF.js → chunk-U5GUJKTS.js} +1 -1
- package/dist/chunk-XRYSPKKC.js +1 -0
- package/dist/chunk-ZZRCVDQU.cjs +11 -0
- package/dist/collaboration/replication.cjs +1 -1
- package/dist/collaboration/replication.d.ts +4 -4
- package/dist/collaboration/replication.js +1 -1
- package/dist/collaboration.d.ts +3 -3
- package/dist/contracts/document.d.ts +2 -2
- package/dist/contracts/editor.d.ts +8 -8
- package/dist/contracts/modules.d.ts +6 -6
- package/dist/contracts/types.d.ts +1 -1
- package/dist/{custom-node-writes-05qS32px.d.ts → custom-node-writes-CncR6KfC.d.ts} +2 -2
- package/dist/{document-protection-Cr59VKLO.d.ts → document-protection-DM6mA8Rf.d.ts} +1 -1
- package/dist/{editor-BsLSz_7y.d.ts → editor-BRh7GuZF.d.ts} +10 -6
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +1 -1
- package/dist/editor.d.ts +25 -25
- package/dist/editor.js +1 -1
- package/dist/export.cjs +2 -2
- package/dist/export.d.ts +12 -12
- package/dist/export.js +1 -1
- package/dist/{font-resolver-CzwdBJDE.d.ts → font-resolver-DwuQYj3P.d.ts} +1 -1
- package/dist/{headless-document-view-B7nAiR7P.d.ts → headless-document-view-C3fc_jV0.d.ts} +2 -2
- package/dist/{image-resources-C4ilLzog.d.ts → image-resources-DxF-SN_8.d.ts} +1 -1
- package/dist/{index-zkvqBQ9o.d.ts → index-3pNnG4z4.d.ts} +19 -18
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +17 -17
- package/dist/index.js +1 -1
- package/dist/{layout-shaping-BJKVTI6i.d.ts → layout-shaping-_GGjhhVc.d.ts} +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +19 -17
- package/dist/layout.js +1 -1
- package/dist/{note-properties-MNztEj5s.d.ts → note-properties-CjT31AuP.d.ts} +1 -1
- package/dist/{omml-equation-CbnW9yXd.d.ts → omml-equation-Bk3OP1fv.d.ts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.ts +7 -7
- package/dist/output.js +1 -1
- package/dist/{protocol-Co_r0SZQ.d.ts → protocol-CrbTIW2Z.d.ts} +2 -2
- package/dist/{review-paragraph-order-EFaU7TqH.d.ts → review-paragraph-order-D3KZohIL.d.ts} +1 -1
- package/dist/{revision-projection-DEIvpxiq.d.ts → revision-projection-kVd7p6Wd.d.ts} +1 -1
- package/dist/{semantic-cell-selection-DXmfnDCw.d.ts → semantic-cell-selection-CkSsZHDL.d.ts} +6 -4
- package/dist/{semantic-interaction-BLu3M6Nn.d.ts → semantic-interaction-Z2Xa68U5.d.ts} +1 -1
- package/dist/{semantic-paint-CPsihA6k.d.ts → semantic-paint-BHKprI9P.d.ts} +2 -2
- package/dist/{semantic-records-CqD0b5Ex.d.ts → semantic-records-StH-AnHK.d.ts} +11 -8
- package/dist/store.cjs +1 -1
- package/dist/store.d.ts +19 -25
- package/dist/store.js +1 -1
- package/dist/{tree-package-fragment-CwJDixNs.d.ts → tree-package-fragment-CpEV1gl3.d.ts} +2 -2
- package/dist/{tree-session-contract-D9RRWE0C.d.ts → tree-session-contract-CTT9nM7Z.d.ts} +10 -5
- package/dist/{types-barrel-DLB11iSY.d.ts → types-barrel-PwcfEkaX.d.ts} +8 -4
- package/package.json +2 -2
- package/dist/chunk-44LQJIKH.cjs +0 -20
- package/dist/chunk-AFG7Q622.cjs +0 -2
- package/dist/chunk-AYMSP25Q.js +0 -4
- package/dist/chunk-B4KZSKF7.cjs +0 -5
- package/dist/chunk-BNZF6DYC.cjs +0 -18
- package/dist/chunk-GIHKVXEO.js +0 -2
- package/dist/chunk-ITNK6C5M.cjs +0 -3
- package/dist/chunk-MP3K4LC5.js +0 -1
- package/dist/chunk-MXOO7KRI.cjs +0 -11
- package/dist/chunk-NG6IQ4SI.js +0 -11
- package/dist/chunk-Q5JPPUNR.js +0 -5
- package/dist/chunk-VH2DLEZK.js +0 -20
- package/dist/chunk-WZX4UGRQ.js +0 -3
- package/dist/chunk-XS4FOHH6.js +0 -18
package/dist/chunk-Q5JPPUNR.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import {c,e,b as b$2}from'./chunk-X5QNSISI.js';import {d}from'./chunk-BDAY2ETZ.js';import {a as a$2}from'./chunk-VP7SDFCM.js';import {O,Za,ea,ia,ha,$ as $$1,_,Z,X,Y,fa,Xa,a,Fa,Ia as Ia$1,Sa,b as b$3}from'./chunk-WZX4UGRQ.js';import {b as b$1,a as a$1}from'./chunk-Q2B6HX3R.js';import {vg,b,yd,Ha,ec,Lb,Ca,tf,sf,Ih,Uh,zf,_e,Af,Xf,Wf,Hg,Rd,fc,Di,Pd,Od,E as E$1,Kg,Lg,Td,Cd,Ud,Zd,Bd,bb,da,Ef,mg,Nb,Ia,la,na,ka,ma,bg,Ed,Gd,Fb,Eb,Mg,Ue as Ue$1,fe,Ld,Ad,Md,ud,id,kd,_c,Wd,ib,Ta}from'./chunk-NG6IQ4SI.js';import {Schema}from'prosemirror-model';import {EditorState,TextSelection}from'prosemirror-state';import {EditorView}from'prosemirror-view';import {keymap}from'prosemirror-keymap';import {joinBackward,deleteSelection,joinForward,splitBlock,selectTextblockEnd,selectTextblockStart,baseKeymap}from'prosemirror-commands';function z(t){return t.attributes?.val}function $(t){let e=z(t);return e===void 0||!(e==="0"||e==="false"||e==="off")}var xo=/^[0-9A-Fa-f]{6}$/,Se=/^\d{1,6}$/,ko=/^-?\d{1,6}$/;function We(t){return t===void 0||t==="auto"?null:xo.test(t)?`#${t}`:null}var Oo={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"},Po={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 So(t){return !t||!/^[\w \-.+]{1,64}$/.test(t)?null:`"${t}"`}function U(t,e=false){return t===void 0||!(e?ko:Se).test(t)?null:`${Number(t)/20}pt`}function bn(t){let e=[],n=[],o=null,s=null;for(let a of t)switch(a.localName){case "b":e.push(`font-weight:${$(a)?"bold":"normal"}`);break;case "i":e.push(`font-style:${$(a)?"italic":"normal"}`);break;case "u":{let r=z(a)??"single";if(r==="none"||!$(a))break;n.push("underline"),o=Oo[r]??"solid",s=We(a.attributes?.color);break}case "strike":$(a)&&n.push("line-through");break;case "dstrike":$(a)&&n.push("line-through");break;case "caps":$(a)&&e.push("text-transform:uppercase");break;case "smallCaps":$(a)&&e.push("font-variant:small-caps");break;case "vertAlign":{let r=z(a);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=We(z(a));r&&e.push(`color:${r}`);break}case "highlight":{let r=Po[z(a)??""];r&&e.push(`background-color:${r}`);break}case "sz":{let r=z(a);r!==void 0&&Se.test(r)&&e.push(`font-size:${Number(r)/2}pt`);break}case "rFonts":{let r=So(a.attributes?.ascii??a.attributes?.hAnsi);r&&e.push(`font-family:${r}`);break}case "spacing":{let r=U(z(a),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 bo={left:"left",start:"left",right:"right",end:"right",center:"center",both:"justify",distribute:"justify"};function Rn(t){let e=[];for(let n of t)switch(n.localName){case "jc":{let o=bo[z(n)??""];o&&e.push(`text-align:${o}`);break}case "ind":{let o=U(n.attributes?.left??n.attributes?.start,true),s=U(n.attributes?.right??n.attributes?.end,true),a=U(n.attributes?.firstLine),r=U(n.attributes?.hanging);o&&e.push(`margin-left:${o}`),s&&e.push(`margin-right:${s}`),a?e.push(`text-indent:${a}`):r&&e.push(`text-indent:-${r}`);break}case "spacing":{let o=U(n.attributes?.before),s=U(n.attributes?.after);o&&e.push(`margin-top:${o}`),s&&e.push(`margin-bottom:${s}`);let a=n.attributes?.line,r=n.attributes?.lineRule;a!==void 0&&Se.test(a)&&r!=="exact"&&r!=="atLeast"?e.push(`line-height:${(Number(a)/240).toFixed(3)}`):a!==void 0&&Se.test(a)&&e.push(`line-height:${Number(a)/20}pt`);break}case "shd":{let o=We(n.attributes?.fill);o&&e.push(`background-color:${o}`);break}case "pageBreakBefore":$(n)&&e.push("break-before:page");break;}return e.join(";")}var E=new Schema({nodes:{doc:{content:"paragraph+"},paragraph:{content:"inline*",group:"block",attrs:{nodeId:{default:null},props:{default:[]}},toDOM:t=>{let e=Rn(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=bn(e);return ["span",{"data-run-props":vo(e),...n?{style:n}:{}},0]},parseDOM:[{tag:"span[data-run-props]",getAttrs:t=>{if(typeof t=="string")return false;let e=To(t.getAttribute("data-run-props"));return e?{props:e}:false}}]}}});function vo(t){return JSON.stringify(Array.isArray(t)?t:[])}function To(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 Je(t){for(let e of t.marks)if(e.type.name==="runProps")return e.attrs.props??[];return []}function be(t,e){return JSON.stringify(Re(t))===JSON.stringify(Re(e))}function Re(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 Ye(t){if(!t||t.kind==="textValue")return [];let e=[];for(let n of t.children){if(n.kind==="textValue"||n.localName==="rPrChange"||n.localName==="pPrChange")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 vn(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 A(t){if(t.kind==="textValue")return [];let e=[],n=a=>{if(a.kind!=="run")return;let r=a.children.find(u=>u.kind==="runProperties"),d=Ye(r);for(let u of a.children)if(u.kind!=="runProperties"){if(u.kind==="tab"){e.push({kind:"tab"});continue}if(u.kind==="hardBreak"){e.push(Wd(u)?{kind:"pageBreak"}:{kind:"hardBreak"});continue}if(u.kind==="text"){let p="";for(let m of u.children)m.kind==="textValue"&&(p+=m.value);p.length>0&&e.push({kind:"text",text:p,props:d});continue}e.push({kind:"unknown",nodeId:u.id,label:vn(u),modelLength:u.kind==="drawing"||ib(u)||Ta(u)?1:0});}},o=a=>{if(a.kind==="run"){n(a);return}e.push({kind:"unknown",nodeId:a.id,label:vn(a),modelLength:0});},s=(a,r)=>{for(let d of a)if(!(d.kind==="textValue"||d.kind==="paragraphProperties")&&!(r>=la)){if(na(d)&&!ka(d.kind)&&r<la){s(d.children.filter(u=>!bg(d,u)),ma(d,r));continue}if(Ed(d)){let u=Gd(d);u&&s(u,ma(d,r));continue}o(d);}};return s(t.children,0),e}function te(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}var Tn=vg(16),Nn=new WeakMap;function No(t,e){let n=Nn.get(t);if(!n){let o=[];Cd([t],o,0),n=Object.freeze(o),Nn.set(t,n);}for(let o of n)e.push(o);}function F(t){let e=Tn.get(t);if(e)return e;let n=[];for(let o of yd(t))if(o.root.kind!=="textValue")for(let s of o.root.children)No(s,n);return Tn.set(t,n),n}function G(t){let e=te(t).map(n=>{let o=n.kind==="textValue"?void 0:n.children.find(a=>a.kind==="paragraphProperties"),s=A(n).map(a=>{switch(a.kind){case "text":return E.text(a.text,a.props.length>0?[E.marks.runProps.create({props:a.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:a.nodeId,label:a.label})}});return E.node("paragraph",{nodeId:n.id,props:Ye(o)},s)});return E.node("doc",null,e.length>0?e:[E.node("paragraph")])}function Io(t,e){let n=[];return t.forEach(o=>{if(o.isText&&o.text){n.push({kind:"text",text:o.text,props:Je(o)});return}o.type.name==="tab"?n.push({kind:"tab"}):o.type.name==="hardBreak"?n.push({kind:"hardBreak"}):o.type.name==="pageBreak"?n.push({kind:"pageBreak"}):o.type.name==="unknownInline"&&n.push({kind:"unknown",nodeId:String(o.attrs.nodeId??""),label:String(o.attrs.label??""),modelLength:e.has(String(o.attrs.nodeId??""))?1:0});}),n}function C(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+=Ud:n.modelLength===1&&(e+=Zd);return e}function B(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}`),n+=o.modelLength);return e}function Eo(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,a=e.length;for(;s>n&&a>n&&t[s-1]===e[a-1];)s-=1,a-=1;return {start:n,endBefore:s,endAfter:a}}function In(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]??[]):n.kind==="unknown"&&n.modelLength===1&&e.push([]);return e}function Mo(t,e,n,o,s){let a=[],r=C(e),d=C(n),u=Eo(r,d),p=[],m=0,O=false;for(let x of e){if(x.kind!=="unknown"){m+=x.kind==="text"?x.text.length:1;continue}let c=m;x.modelLength===1&&u&&(u.start<m+1&&u.endBefore>m&&(O=true),u.endBefore<=m&&(c+=u.endAfter-u.endBefore)),p.push(`${x.nodeId}@${c}`),m+=x.modelLength;}if(O||JSON.stringify(p)!==JSON.stringify(B(n)))return {ok:false,reason:"unknown-content-moved",detail:t};if(be(o,s)||a.push({op:"setParagraphProperties",paragraphId:t,properties:Re(s)}),u&&(u.endBefore>u.start&&a.push({op:"deleteText",paragraphId:t,start:u.start,end:u.endBefore}),u.endAfter>u.start)){let x=d.slice(u.start,u.endAfter),c=u.start,g="",k=()=>{g.length!==0&&(a.push({op:"insertText",paragraphId:t,offset:c,text:g}),c+=g.length,g="");};for(let S of x)S===" "?(k(),a.push({op:"insertTab",paragraphId:t,offset:c}),c+=1):S===`
|
|
3
|
-
`?(k(),a.push({op:"insertHardBreak",paragraphId:t,offset:c}),c+=1):S===Ud?(k(),a.push({op:"insertPageBreak",paragraphId:t,offset:c}),c+=1):g+=S;k();}if(!u){let x=In(e),c=In(n),g=0;for(;g<c.length;){if(be(x[g]??[],c[g])){g+=1;continue}let k=g,S=c[g];for(;g<c.length&&be(c[g],S)&&!be(x[g]??[],c[g]);)g+=1;a.push({op:"setRunProperties",paragraphId:t,start:k,end:g,properties:Re(S)});}}return {ok:true,ops:a}}function Ue(t,e){let n=te(t),o=new Set;for(let d of n)for(let u of A(d))u.kind==="unknown"&&u.modelLength===1&&o.add(u.nodeId);let s=d=>Io(d,o),a=[];if(e.forEach(d=>{d.type.name==="paragraph"&&a.push(d);}),a.length!==e.childCount)return {ok:false,reason:"unsupported-node"};let r=a.length-n.length;if(r===0){let d=[];for(let[u,p]of a.entries()){let m=n[u];if(p.attrs.nodeId!==m.id)return {ok:false,reason:"paragraph-reordered",detail:String(p.attrs.nodeId)};let O=Mo(m.id,A(m),s(p),Ye(m.kind==="textValue"?void 0:m.children.find(x=>x.kind==="paragraphProperties")),p.attrs.props??[]);if(!O.ok)return O;d.push(...O.ops);}return {ok:true,ops:d}}return r===1?wo(n,a,s):r===-1?Co(n,a,s):{ok:false,reason:"paragraph-count-unexplained",detail:String(r)}}function wo(t,e,n){for(let o=0;o<t.length;o+=1){let s=t[o],a=e[o],r=e[o+1];if(!a||!r||a.attrs.nodeId!==s.id)continue;let d=r.attrs.nodeId;if(d!==null&&d!==s.id)continue;let u=n(a),p=n(r),m=A(s),O=C(u);if(O+C(p)===C(m)&&JSON.stringify(B([...u,...p]))===JSON.stringify(B(m))&&En(t,e,o,n)&&Mn(t,e,o+1,o+2,n))return {ok:true,ops:[{op:"splitParagraph",paragraphId:s.id,offset:O.length}]}}return {ok:false,reason:"split-not-clean"}}function Co(t,e,n){for(let o=0;o+1<t.length;o+=1){let s=t[o],a=t[o+1],r=e[o];if(!r||r.attrs.nodeId!==s.id)continue;let d=[...A(s),...A(a)],u=n(r);if(C(u)===C(d)&&JSON.stringify(B(u))===JSON.stringify(B(d))&&En(t,e,o,n)&&Mn(t,e,o+2,o+1,n))return {ok:true,ops:[{op:"joinParagraphs",firstId:s.id,secondId:a.id}]}}return {ok:false,reason:"join-not-clean"}}function En(t,e,n,o){for(let s=0;s<n;s+=1){let a=e[s],r=t[s];if(!a||a.attrs.nodeId!==r.id||C(o(a))!==C(A(r))||JSON.stringify(B(o(a)))!==JSON.stringify(B(A(r))))return false}return true}function Mn(t,e,n,o,s){for(let a=0;n+a<t.length;a+=1){let r=t[n+a],d=e[o+a];if(!d||d.attrs.nodeId!==r.id||C(s(d))!==C(A(r))||JSON.stringify(B(s(d)))!==JSON.stringify(B(A(r))))return false}return true}function Do(t,e){return Ha(t,e)!==null}function Ge(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(u=>{let p=u.attrs.nodeId;typeof p=="string"&&o.set(p,u);});let s=new Set(n.dirty),a=te(e);if(a.length!==t.childCount)return G(e);let r=G(e),d=[];for(let[u,p]of a.entries()){let m=o.get(p.id);d.push(m&&!s.has(p.id)?m:r.child(u));}return E.node("doc",null,d)}function Cn(t){return F(t).map(e=>Di(t,e.id)??"").join(`
|
|
4
|
-
`)}var Ao=64,wn=new WeakMap;function Ke(t,e=0){if(e>Ao)return false;let n=wn.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"||Ke(s,e+1))){o=true;break}return wn.set(t,o),o}function Fo(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 Dn(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||Fn(s,n)||o.add(Fa(s));for(let s of e)if(o.has(Fa(s)))return false;return true}function An(t,e,n,o){let s=e.get(n);if(s===void 0)return [...t];let a=[],r=null;for(let d of t){if(d.kind==="revision"&&Fn(d,n)){r===null&&(r=a.length);continue}if(r===null){let u=Fo(d,e);u!==null&&u>s&&(r=a.length);}a.push(d);}if(r===null&&(r=a.length),o.length>0){let d=o.length<2?[...o]:[...o].sort((u,p)=>Ia$1(u,e)-Ia$1(p,e));a.splice(r,0,...d);}return Sa(a)}function Fn(t,e){return t.ranges.length>0&&t.ranges.every(n=>n.start.paragraphId===e&&n.end.paragraphId===e)}function Bo(t,e){return t.range?t.range.start.paragraphId===e||t.range.end.paragraphId===e:false}function Lo(t,e){return t.revisionKind==="structural"&&t.ranges.some(n=>n.start.paragraphId===e||n.end.paragraphId===e)}function _o(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 Bn(t,e,n,o,s,a,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!==a)return null;let d=t.dirty[0],u=Ha(o,d);if(!u||u.kind!=="paragraph")return null;let p=Ia(o,d);if(p){let m=p.children.findIndex(x=>x.id===d),O=p.children[m-1];if(O?.kind==="paragraph"&&Ih({...o,root:O}).some(x=>x.paragraphMark))return null}for(let m of n){if(m.kind==="comment"){if(Bo(m,d))return null;continue}if(m.kind==="custom"){if(m.range?.start.paragraphId===d)return null;continue}if(Lo(m,d)||_o(m,d))return null}return d}var jn=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u,jo=["ascii","hAnsi","cs","eastAsia"],Ho=["asciiTheme","hAnsiTheme","cstheme","eastAsiaTheme"],$o=128,zo=/[\u0000-\u001F\u007F-\u009F]/;function D(t){return t.kind!=="textValue"}function K(t,e){return t.attributes.find(n=>n.localName===e)?.value}function Hn(t,e){let n=new Map;for(let s of t)for(let a of s.children)if(D(a))for(let[r,d]of Wn(a,e))n.has(r)||n.set(r,d);let o=[...n.values()];return o.sort((s,a)=>s<a?-1:s>a?1:0),o}var Xe=new WeakMap,$n=16,zn=32;function Wn(t,e,n=0){let o=e?.major??null,s=e?.minor??null,a=e?.majorEastAsia??null,r=e?.minorEastAsia??null,d=e?.majorBidi??null,u=e?.minorBidi??null,p=Xe.get(t);if(p&&p.major===o&&p.minor===s&&p.majorEastAsia===a&&p.minorEastAsia===r&&p.majorBidi===d&&p.minorBidi===u)return p.byFold;if(t.children.length>=$n&&n<zn&&t.localName!=="rFonts"){let c=new Map;for(let g of t.children)if(D(g))for(let[k,S]of Wn(g,e,n+1))c.has(k)||c.set(k,S);return Xe.set(t,{major:o,minor:s,majorEastAsia:a,minorEastAsia:r,majorBidi:d,minorBidi:u,byFold:c}),c}let m=new Map,O=c=>{if(!c||!jn.test(c))return;let g=c.toLowerCase();m.has(g)||m.set(g,c);},x=[t];for(;x.length>0;){let c=x.pop();if(D(c)){if(c.localName==="rFonts"){for(let g of jo)O(K(c,g));if(e)for(let g of Ho)O(b$3(K(c,g),e));}for(let g=c.children.length-1;g>=0;g-=1)x.push(c.children[g]);}}return Xe.set(t,{major:o,minor:s,majorEastAsia:a,minorEastAsia:r,majorBidi:d,minorBidi:u,byFold:m}),m}function Jn(t){let e=new Map;for(let o of t)for(let s of o.children)if(D(s))for(let[a,r]of Yn(s))e.has(a)||e.set(a,r);let n=[...e.values()];return n.sort((o,s)=>o<s?-1:o>s?1:0),n}var Ln=new WeakMap,Wo=new Map;function Yn(t,e=0){let n=Ln.get(t);if(n)return n;let o=r=>{let d=r.size===0?Wo:r;return Ln.set(t,d),d},s=new Map;if(t.children.length>=$n&&e<zn&&t.localName!=="sym"){for(let r of t.children)if(D(r))for(let[d,u]of Yn(r,e+1))s.has(d)||s.set(d,u);return o(s)}let a=[t];for(;a.length>0;){let r=a.pop();if(D(r)){if(r.localName==="sym"&&r.namespaceUri===da){let d=r.attributes.find(p=>p.localName==="font"&&(p.namespaceUri===da||p.namespaceUri===""))?.value,u=b$2(d);u!==null&&!s.has(u.toLowerCase())&&s.set(u.toLowerCase(),u);}for(let d=r.children.length-1;d>=0;d-=1)a.push(r.children[d]);}}return o(s)}function Un(t){let e=[...t];for(;e.length>0;){let n=e.pop();if(D(n)){if(n.localName==="t"&&n.namespaceUri===da){for(let o of n.children)if(!D(o)&&o.value.length>0)return true;continue}for(let o of n.children)e.push(o);}}return false}var Jo=new Set(["paragraph","character","table","numbering"]),Yo=/^[0-9A-Fa-f]{6}$/,Uo=16,_n=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 Gn(t){return t.children}function Ve(t,e){for(let n of Gn(t))if(D(n)&&n.localName===e)return n}function Go(t){return _n.get(t.name.toLowerCase())??_n.get(t.styleId.toLowerCase())??Number.MAX_SAFE_INTEGER}function Qe(t){return t===void 0||t.length===0||t.length>$o||zo.test(t)?null:t}function Kn(t,e){if(!t)return [];let n=new Map;for(let a of t.children){if(!D(a)||a.localName!=="style")continue;let r=Qe(K(a,"styleId"));r!==null&&!n.has(r)&&n.set(r,a);}let o=a=>{let r=false,d=false,u=null,p=false,m=false,O=new Set,x=a;for(let k=0;k<Uo&&x!==null&&!O.has(x);k+=1){O.add(x);let S=n.get(x);if(!S)break;let R=Ve(S,"rPr");for(let T of R?Gn(R):[]){if(!D(T))continue;let v=K(T,"val"),M=v!=="0"&&v!=="false"&&v!=="off";T.localName==="b"&&!p?(r=M,p=true):T.localName==="i"&&!m?(d=M,m=true):T.localName==="color"&&u===null&&v&&Yo.test(v)&&(u=v);}let b=Ve(S,"basedOn");x=b?Qe(K(b,"val")):null;}let c=e?.(a),g=c?.fontFamily??null;return {fontFamily:g!==null&&jn.test(g)?g:null,fontSizePt:c?.fontSizeHalfPoints!=null&&c.fontSizeHalfPoints>0?c.fontSizeHalfPoints/2:null,bold:r,italic:d,color:u}},s=[];for(let[a,r]of n){let d=K(r,"type");if(d===void 0||!Jo.has(d))continue;let u=Ve(r,"name"),p=Qe(u?K(u,"val"):void 0);s.push({styleId:a,name:p??a,type:d,preview:o(a)});}return s.map((a,r)=>({entry:a,index:r,rank:Go(a)})).sort((a,r)=>a.rank-r.rank||a.index-r.index).map(a=>a.entry)}var Ko=128,Xo=/[\u0000-\u001F\u007F-\u009F]/,Vo=/[\u0000-\u001F\u007F-\u009F]/g,Qo=200;function qe(t){return t.kind!=="textValue"}function Xn(t,e){for(let n of t.children)if(qe(n)&&n.localName===e)return n}function Ze(t,e){return t.attributes.find(n=>n.localName===e)?.value}function Zo(t){let e=new Map;if(!t)return e;for(let n of t.children){if(!qe(n)||n.localName!=="style"||Ze(n,"type")!=="paragraph")continue;let o=Ze(n,"styleId");if(o===void 0||o.length===0||o.length>Ko||Xo.test(o))continue;let s=a$2(n);s!==null&&e.set(o,s);}return e}function et(t){let e=Xn(t,"pPr"),n=e?Xn(e,"pStyle"):void 0;return n?Ze(n,"val"):void 0}function Vn(t,e){let n=Zo(e);if(n.size===0)return [];let o=[];for(let s of te(t)){if(!qe(s))continue;let a=et(s);if(a===void 0)continue;let r=n.get(a);if(r===void 0)continue;let u=(Di(t,s.id)??"").replace(Vo," ").trim().slice(0,Qo);u.length!==0&&o.push({text:u,level:r,blockId:s.id});}return o}function qo(t,e,n){let o=new Map,s=n(t);for(let a of s){let r=o.get(a.hostParagraphId);r?r.push(a):o.set(a.hostParagraphId,[a]);}return o}function er(t,e,n){let o=[];for(let s of Bd(t.root)){let a=e.get(s.id);if(a)for(let r of a)o.push(r);}return o}function Qn(t,e,n=Mg){let o=[],s=new Map;for(let a of t){if(o.push(a),a.scope?.kind==="note")continue;let r=s.get(a.part);r||(r=qo(a.part,e,n),s.set(a.part,r));for(let d of er(a,r)){let u=a.scope;o.push({part:a.part,root:d.root,scope:{kind:"frame",id:d.root.id,drawingNodeId:d.drawingNodeId,hostParagraphId:d.hostParagraphId,...u?.kind==="headerFooter"?{owner:u}:{}}});}}return o}var ve=48,tr=/[\u0000-\u001F\u007F-\u009F]/g;function nr(t){let e=[],n=Ue$1(t),o=new Map;for(let s of n.segments)fe(s.node)&&o.set(s.node.id,s.formatRunIds??[]);return Ld(t.children,0,s=>{if(s.kind==="run"){e.push({id:s.id,start:n.spanOf(s)?.start??0});return}if(fe(s))for(let a of o.get(s.id)??[]){let r=n.spanOf(a);r&&e.push({id:a,start:r.start});}},{descendRevisions:true}),e}function or(t){let e=Ad(t);return e?[{part:t,root:e}]:[]}function rr(t,e){let n=[];for(let o of ["header","footer"])for(let s of t){let a=o==="header"?s.headers:s.footers;for(let[r,d]of a){if(!Md(s,r)||e.has(d.part))continue;e.add(d.part);let u=yd(d.part).find(p=>p.kind===o);u&&n.push({part:d.part,root:u.root,scope:{kind:"headerFooter",rId:d.rId}});}}return n}function Zn(t,e,n){if(!t)return [];let o=[];for(let s of ud(t.root)){let a=id(s);!kd(s)||a===null||!n.has(a)||o.push({part:t,root:s,scope:{kind:"note",id:_c(e,a)}});}return o}function ar(t,e){let n=or(t);if(e){let o=new Set;for(let s of rr(e.headerFooterBySection,o))n.push(s);for(let s of Zn(e.footnotes,"footnote",e.referencedNoteIds.footnote))n.push(s);for(let s of Zn(e.endnotes,"endnote",e.referencedNoteIds.endnote))n.push(s);}return Qn(n)}function qn(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].start;if(e>=o)return {index:n,offset:e-o}}return {index:0,offset:e}}function sr(t,e,n){let o=t.findIndex(s=>s.id===e);return o<0?null:{index:o,offset:n}}function tt(t,e){return t.replace(tr," ").slice(0,e)}function eo(t,e,n={},o){let s={matches:[],truncated:false};if(!Xa(e))return s;let a=n.limit!==void 0&&Number.isInteger(n.limit)&&n.limit>0?Math.min(n.limit,2e3):2e3,r={...n.matchCase===void 0?{}:{matchCase:n.matchCase},...n.wholeWord===void 0?{}:{wholeWord:n.wholeWord}},d$1=[],u=n.stories==="body"?void 0:o;for(let p of ar(t,u)){let m=0;for(let O of Bd(p.root)){if(O.kind!=="paragraph")continue;let x=m;m+=1;let c=Di(p.part,O.id)??"",g=d(O,c);if(g.text.length===0)continue;let k=a-d$1.length,S=g.findOccurrences(e,Math.max(k,1),r);if(k===0&&S.matches.length>0)return {matches:d$1,truncated:true};let R=null;for(let b of S.matches){let T=b.start+b.length;R??=nr(O);let v=g.resultRunAddressAt(b.start),M=v?sr(R,v.runId,v.offset)??qn(R,b.rawStart):qn(R,b.rawStart);d$1.push({blockId:O.id,start:b.rawStart,length:b.rawEnd-b.rawStart,paragraphIndex:x,runIndex:M.index,runOffset:M.offset,...p.scope?{scope:p.scope}:{},text:tt(g.text.slice(b.start,T),256),contextBefore:tt(g.text.slice(Math.max(0,b.start-ve),b.start),ve),contextAfter:tt(g.text.slice(T,T+ve),ve)});}if(S.truncated)return {matches:d$1,truncated:true}}}return {matches:d$1,truncated:false}}var ir=["lt1","dk1","lt2","dk2","accent1","accent2","accent3","accent4","accent5","accent6"];function ne(t,e=null){return a(t,e)}function to(t){let e=bb(t),n=[];for(let o of ir){let s=e.get(o);if(!s)return [];n.push({slot:o,hex:s});}return n}var no=new WeakMap;function ot(t){let e=no.get(t);if(e!==void 0)return e;let n=Fb(t),o=n===null||!Eb(n)?null:n;return no.set(t,o),o}var nt=class{#e;#t;constructor(e,n){this.#e=e,this.#t=n;}get size(){return this.#e.size}get(e){if(this.#e.has(e))return this.#t.find(n=>e.startsWith(`${n.name}#`))}has(e){return this.get(e)!==void 0}*entries(){for(let e of this.#e.keys()){let n=this.get(e);n&&(yield [e,n]);}}keys(){return this.#e.keys()}*values(){for(let[,e]of this.entries())yield e;}[Symbol.iterator](){return this.entries()}forEach(e,n){for(let[o,s]of this.entries())e.call(n,s,o,this);}};function oo(t,e){return Object.freeze({...t,partByNode:new nt(t.ordinalByNode,e)})}function ro(t){let e=new Map,n=new Map,o=new Map,s=new Set,a=new Map,r=new Map,d=0;for(let u of t)for(let p of F(u)){o.set(p.id,d),a.set(p.id,u),d+=1;let m=ot(p);if(m===null)continue;e.set(p.id,m);let O=m.toUpperCase(),x=r.get(O);x?(x.push(p.id),s.add(O)):(r.set(O,[p.id]),n.set(O,p.id));}return Object.freeze({paraIdByNode:e,nodeByParaId:n,ordinalByNode:o,ambiguousParaIds:s,partByNode:a,claimantsByParaId:r})}function ao(t,e){let n=t.indexOf("#");if(n<=0)return null;let o=t.slice(0,n),s=e.body.name===o?e.body:void 0;s??=e.openStories.find(d=>d.name===o);let a=s?void 0:e.otherStories.find(d=>d.name===o);if(s??=a?e.normalize(a):void 0,!s)return null;let r=Ha(s,t);return r?.kind==="paragraph"?ot(r):null}var so={committed:false,rejected:false,opCount:0};function W(t,e){return e===void 0?{committed:false,rejected:true,opCount:t}:{committed:false,rejected:true,opCount:t,reason:e}}function io(t,e,n={}){let o=e.filter(p=>p.ops.length>0),s=o.reduce((p,m)=>p+m.ops.length,0);if(s===0)return n.packageEdits?.length?W(0,"invalidArgs"):so;if(o.some(p=>p.ops.some(Ef))||o.some(p=>p.ops.some(mg)))return W(s,"invalidArgs");let[a,...r]=o,d=[];for(let p of r){let m=t.partFor(p.scope);if(!m)return W(s,"unknown-part");d.push({partName:m.name,ops:p.ops});}let u=t.transact(a.scope,p=>{for(let m of n.packageEdits??[])p.applyPackage(m);for(let m of a.ops)p.apply(m);for(let m of d)for(let O of m.ops)p.applyTo(m.partName,O);},n);return u.ok?{committed:true,rejected:false,opCount:s}:W(s,u.reason)}function lo(t,e,n,o,s,a){if(e.length===0&&!a.packageEdits?.length)return so;let r=e.filter(p=>Ef(p)||mg(p)).length;if(r>0){if(a.packageEdits?.length||r!==e.length||e.length!==1)return W(e.length,"invalidArgs");let p=Nb(a.actorId,()=>t.applyLifecycleOp(e[0]));return p.ok?{committed:true,rejected:false,opCount:1}:W(1,p.detail??p.reason)}let d=a.recordsHistory===false&&a.actorId&&a.operationId?t.partFor(s)?.name:void 0,u=t.transact(s,p=>{n!==void 0&&p.selectionBefore(n),o!==void 0&&p.selectionAfter(o);for(let m of a.packageEdits??[])p.applyPackage(m);for(let m of e)p.apply(m);d&&p.applyPackage(m=>a$1(m,d,e));},a);return u.ok?{committed:true,rejected:false,opCount:e.length}:W(e.length,u.reason)}var lr=Object.freeze([]);function dr(t,e$1={}){let n=ec(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 a=Lb(s),r=new O(o,Za(o,a)),d=null,u=null,p=null,m=null,O$1=null;r.subscribe(i=>{m=i,O$1=r.currentPackage();});let x=()=>r.bodyStore(),c$1=()=>r.currentPackage(),g=Object.freeze({kind:"body"}),k=(i,l)=>{let f=l?.find(h=>h.type==="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings");if(!f)return;let y=E$1(f);return y.mode==="Internal"&&y.target.ok?i.parts.get(y.target.partName):void 0},S=(i,l,f)=>{if(i.mainRelationships!==f||i.settingsPart!==k(l,f))return false;for(let y of i.resolution)for(let h of [y.headers,y.footers])for(let P of h.values())if(l.parts.get(P.partName)!==P.part)return false;return true},R=()=>{let i=c$1(),l=i.relationships.get(i.mainDocumentPart);if(d&&m&&O$1===i&&S(d,i,l)&&d.packageRevision===m.fromRevision&&r.packageRevision===m.toRevision&&m.story?.kind==="body"&&m.impact==="text-local"&&m.created.length===0&&m.deleted.length===0&&m.splitJoin.length===0&&(d={...d,packageRevision:r.packageRevision,pkg:i,mainRelationships:l,settingsPart:k(i,l)}),!d||d.packageRevision!==r.packageRevision||d.pkg!==i){let f=Pd(i);d={packageRevision:r.packageRevision,pkg:i,mainRelationships:l,settingsPart:k(i,l),resolution:f,parts:Od(f)};}return d},b="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",T="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",v=null,M=()=>{let i=c$1(),l=(i.relationships.get(i.mainDocumentPart)??[]).find(h=>h.type===b),f;if(l){let h=E$1(l);h.mode==="Internal"&&h.target.ok&&(f=i.parts.get(h.target.partName));}f??=i.parts.get("/word/styles.xml");let y=f?.root??null;return y!==v&&(v=y,ie=null,Y$1=null),v},X$1=null,L=null,oe=()=>{let i=c$1();if(X$1===i)return L;X$1=i;let l=(i.relationships.get(i.mainDocumentPart)??[]).find(y=>y.type===T),f;if(l){let y=E$1(l);y.mode==="Internal"&&y.target.ok&&(f=i.parts.get(y.target.partName));}return f??=i.parts.get("/word/numbering.xml"),L=f?.root??null,L},Te="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",rt=null,ue=null,J=()=>{let i=c$1();if(rt===i)return ue;rt=i;let l=(i.relationships.get(i.mainDocumentPart)??[]).find(h=>h.type===Te),f;if(l){let h=E$1(l);h.mode==="Internal"&&h.target.ok&&(f=i.parts.get(h.target.partName));}f??=i.parts.get("/word/settings.xml");let y=f?.root??null;return y!==ue&&(ue=y,me=null,ie=null,Y$1=null),ue},uo="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",po="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",at=(i,l)=>{let f=c$1(),y=(f.relationships.get("/")??[]).find(P=>P.type===i),h;if(y){let P=E$1(y);P.mode==="Internal"&&P.target.ok&&(h=f.parts.get(P.target.partName));}return h??f.parts.get(l)},st=null,Ne=Kg,fo=()=>{let i=c$1();if(st===i)return Ne;st=i;let l=at(uo,"/docProps/core.xml"),f=at(po,"/docProps/app.xml");return Ne=Lg(l?.root??null,f?.root??null),Ne},mo="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",it=null,pe=null,V=()=>{let i=c$1();if(it===i)return pe;it=i;let l=(i.relationships.get(i.mainDocumentPart)??[]).find(h=>h.type===mo),f;if(l){let h=E$1(l);h.mode==="Internal"&&h.target.ok&&(f=i.parts.get(h.target.partName));}f??=i.parts.get("/word/theme/theme1.xml");let y=f?.root??null;return y!==pe&&(pe=y,me=null,Ie=null,ie=null,Y$1=null),pe},go="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",fe=null,yo=()=>{if(fe)return fe;let i=c$1(),l=(i.relationships.get(i.mainDocumentPart)??[]).find(y=>y.type===go),f;if(l){let y=E$1(l);y.mode==="Internal"&&y.target.ok&&(f=i.parts.get(y.target.partName));}return f??=i.parts.get("/word/fontTable.xml"),fe=Object.freeze(Td(i,f)),fe},re=null,Q=null,ae=null,se=null,ie=null,Ie=null,me=null,lt=()=>{let i=[x().part.root],l=new Set;for(let f of _$1())l.has(f)||(l.add(f),i.push(f.root));return i},Ee=()=>{let i=lt(),l=M();return l&&i.splice(1,0,l),i},Y$1=null,ge=null,le=null,de=null,Z$1=null,dt=new WeakMap,ye=null,ct=i=>{let l=dt.get(i);if(l)return l;let f=Lb(i);return dt.set(i,f),f},ut=()=>{let i=r.packageRevision,l=r.openStoryToken();if(!Z$1||Z$1.revision!==i||Z$1.openStories!==l){let f=r.openStoryParts(),y=new Set(f.map(w=>w.name)),h=_$1().filter(w=>!y.has(w.name)).map(ct),P=[x().part,...f,...h],N=Z$1,I=N!==null&&m!==null&&N.openStories===l&&N.revision===m.fromRevision&&i===m.toRevision&&m.impact==="text-local"&&m.created.length===0&&m.deleted.length===0&&m.splitJoin.length===0&&N.parts.length===P.length&&N.parts.every((w,q)=>w.name===P[q]?.name);Z$1={revision:i,openStories:l,parts:P,index:I&&N?oo(N.index,P):ro(P)};}return Z$1.index},pt=()=>{let i=x().part.name,l=new Map;for(let f of [x().part,..._$1()])for(let[y,h]of fa(c$1(),f.name,i))l.set(y,h);return l},ho=()=>[x().part,..._$1()],_$1=()=>{let i=[],l=new Set;for(let y of R().parts)for(let h of [y.headers,y.footers])for(let P of h.values())l.has(P)||(l.add(P),i.push(P));let f=c$1();for(let y of ["footnote","endnote"]){let h=Wf(f,y);!h||l.has(h)||(l.add(h),i.push(h));}return i};return {ok:true,session:{editable:F(x().part).length>0,paragraphIds:()=>F(x().part).map(i=>i.id),paragraphIdsIn(i=g){let l=r.partFor(i);return l?F(l).map(f=>f.id):[]},part:()=>x().part,partFor:i=>r.partFor(i),currentPackage:c$1,collaborationPort:i=>b$1(r,{documentId:i}),applyTreeOps(i,l,f,y=g,h={}){return lo(r,i,l,f,y,h)},applyTreeOpsAtomic(i,l={}){return io(r,i,l)},projectDoc:()=>G(x().part),reconcile:i=>Ge(i,x().part,m),lastCommitWasStructural:()=>m!==null&&(m.created.length>0||m.deleted.length>0||m.splitJoin.length>0||m.impact==="global"),applyPmDoc(i){let l=x(),f=Ue(l.part,i);if(!f.ok)return {committed:false,rejected:true,opCount:0,reason:f.reason};if(f.ops.length===0)return {committed:false,rejected:false,opCount:0};let y=r.transact(g,h=>{for(let P of f.ops)h.apply(P);});return y.ok?{committed:true,rejected:false,opCount:f.ops.length}:{committed:false,rejected:true,opCount:f.ops.length,reason:y.reason}},storyParts:ho,bodyText:()=>Cn(x().part),storyText(i){let l=r.partFor(i);return l?F(l).map(f=>Di(l,f.id)??"").join(`
|
|
5
|
-
`):null},revision:()=>x().revision,revisionFor:i=>r.revisionFor(i),packageRevision:()=>r.packageRevision,canUndo:()=>r.canUndo,canRedo:()=>r.canRedo,undo:()=>{let i=r.selectionForUndo();return r.undo()===null?null:i},redo:()=>{let i=r.selectionForRedo();return r.redo()===null?null:i},beginComposition:(i=g)=>{r.beginComposition(i);},endComposition:()=>r.endComposition(),subscribe(i){return r.subscribe(i)},save(){return fc(c$1())},headerFooterParts:()=>{let i=R().parts;return i[i.length-1]??Rd(c$1())},headerFooterPartsBySection:()=>R().parts,headerFooterResolutionBySection:()=>R().resolution,documentFonts(){return re&&re.revision===r.packageRevision||(re={revision:r.packageRevision,fonts:Hn(Ee(),ne(V(),J()))}),re.fonts},symbolFontFamilies(){return ae&&ae.revision===r.packageRevision||(ae={revision:r.packageRevision,fonts:Jn(Ee())}),ae.fonts},renderedFontFamilies(){let i=M();return Q&&Q.revision===r.packageRevision&&Q.styles===i||(Q={revision:r.packageRevision,styles:i,families:e(lt(),i,ne(V(),J()))}),Q.families},rendersText(){return se&&se.revision===r.packageRevision||(se={revision:r.packageRevision,rendersText:Un(Ee())}),se.rendersText},documentStyles(){let i=M(),l=V(),f=J();Y$1??=c(i,ne(l,f));let y=Y$1;return ie??=Kn(i,h=>y(h)),ie},stylesRoot:()=>M(),documentThemeFonts(){let i=V(),l=J();return me??=ne(i,l),me},numberingRoot:()=>oe(),settingsRoot:()=>J(),documentProperties:()=>fo(),trackingSettings:()=>Hg(J()),documentThemeColors(){let i=V();return Ie??=to(i),Ie},effectiveRunDefaults(i,l){let f=M(),y=V(),h=J();Y$1??=c(f,ne(y,h));let P=x();if(!ge||ge.revision!==P.revision){let N=new Map;for(let I of F(P.part))I.kind!=="textValue"&&N.set(I.id,et(I)??null);ge={revision:P.revision,byId:N};}return Y$1(ge.byId.get(i)??null,l)},documentOutline(){let i=x();return le&&le.revision===i.revision||(le={revision:i.revision,outline:Vn(i.part,M())}),le.outline},findText(i,l){let f=x(),y=r.packageRevision,h=`${l?.matchCase===true?"c":""}${l?.wholeWord===true?"w":""}${l?.limit??""}:${l?.stories??"all"}\0${i}`;if(de&&de.revision===y&&de.key===h)return de.result;let P=c$1(),N={footnote:new Set,endnote:new Set};for(let w of Xf(f.part))N[w.noteKind].add(w.noteId);let I=eo(f.part,i,l??{},{headerFooterBySection:R().resolution,footnotes:Wf(P,"footnote")??null,endnotes:Wf(P,"endnote")??null,referencedNoteIds:N});return de={revision:y,key:h,result:I},I},embeddedFonts:yo,paragraphAnchors:ut,paraIdOf:i=>ao(i,{body:x().part,openStories:r.openStoryParts(),otherStories:_$1(),normalize:ct}),nodeIdOf:i=>ut().nodeByParaId.get(i.toUpperCase())??null,relationshipTarget:(i,l=g)=>{let f=c$1(),y=r.partFor(l);return y?Af(f,y.name,i):null},bookmarks:()=>{let i=r.packageRevision;if(!ye||ye.revision!==i){let l=new Map(_e(x().part));for(let f of _$1())for(let[y,h]of _e(f))l.has(y)||l.set(y,h);ye={revision:i,index:l};}return ye.index},ensureHyperlinkRelationship(i,l=g){let f=r.partFor(l);return f?Ca(r,()=>{let y=c$1(),h=zf(y,i,f.name);return h?(h.pkg!==y&&r.replacePackageShell(h.pkg),h.relationshipId):null},y=>y!==null):null},reviewItems(){let i=e$1.reviewModel;if(!i)return lr;let l=x(),f=`${r.packageRevision}:${l.revision}`;if(u&&u.revisionKey===f)return u.items;let y=c$1(),h=y.parts.get(X(y,l.part.name)),P=y.parts.get(Y(y,l.part.name)),N=_$1(),I=u&&m?Bn(m,u,u.items,l.part,h,P,r.packageRevision):null,w,q;if(I&&u){let ft=i.revisionItemsOfParagraph(l.part,I);Dn(u.items,ft,I)?(w=An(u.items,u.paragraphOrder,I,ft),q=u.paragraphOrder):(q=Uh(l.part),w=i.collectReviewItems({storyPart:l.part,furnitureParts:N,commentsPart:h,commentsExtendedPart:P,customNodePayloads:pt()}));}else q=Uh(l.part),w=i.collectReviewItems({storyPart:l.part,furnitureParts:N,commentsPart:h,commentsExtendedPart:P,customNodePayloads:pt()});return u={revisionKey:f,bodyRevision:l.revision,packageRevision:r.packageRevision,items:w,paragraphOrder:q,commentsPart:h,commentsExtendedPart:P},u.items},hasReviewContent(){let i=r.packageRevision;if(!p||p.revision!==i){let l=[x().part,..._$1()];p={revision:i,present:l.some(f=>Ih(f).length>0||Ke(f.root))};}return p.present},replyToComment(i,l,f,y,h,P=g,N){let I=Z(r,{anchor:{paragraphId:l.paragraphId,start:l.start,end:l.end,...l.endParagraphId===void 0?{}:{endParagraphId:l.endParagraphId}},author:y,text:f,...h===void 0?{}:{date:h},...i===null?{}:{replyToCommentId:i},...N===void 0?{}:{actorId:N}},P);return I.ok?I.commentId:null},setCommentResolved(i,l){return _(r,i,l).ok},deleteComment(i,l=g,f){return this.deleteComments([{commentId:i}],l,f)},deleteComments(i,l=g,f){return $$1(r,i,l,f)},insertCustomNode(i,l=g){return ha(r,i,l)},removeCustomNode(i,l=g){return ia(r,i,l)},sweepCustomNodePayloads(i){return Ca(r,()=>{let l=x(),f=ea(r.currentPackage(),l.part.name,i);return f.ok?f.removed.length===0?{ok:true,removed:[]}:(r.replacePackageShell(f.pkg),{ok:true,removed:f.removed}):{ok:false,reason:f.reason}},l=>l.ok&&l.removed.length>0)},ensureListDefinition(i){return Ca(r,()=>{let l=sf(c$1(),i);return l?(r.replacePackageShell(l.pkg),X$1=null,L=null,l.numId):null},l=>l!==null)},ensureNumberingLevel(i,l,f){return Ca(r,()=>{let y=c$1(),h=tf(y,i,l,f);return h?h!==y?(r.replacePackageShell(h),X$1=null,L=null,{ok:true,changed:true}):{ok:true,changed:false}:{ok:false,changed:false}},y=>y.changed).ok},insertImage(i,l){return r.insertImage(i,l)},replaceImage(i,l,f,y,h,P){return r.replaceImage(i,l,f,y,h,P)},deleteImage(i,l){return r.deleteImage(i,l)},deleteImageTracked(i,l,f){return r.deleteImageTracked(i,l,f)},applyImageProperties(i,l){return r.applyImageProperties(i,l)},applyFragmentPaste(i,l){return r.applyFragmentPaste(i,l)}}}}var cr=b.projection;function Pr(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 Sr(t,e,n={}){let o=null,s=false,a=()=>n.onChange?.(r()),r=()=>({revision:e.revision(),canUndo:e.canUndo(),canRedo:e.canRedo(),lastRejection:o}),d=c=>{s=true;let g=p.state.tr.replaceWith(0,p.state.doc.content.size,c.content);g.setMeta("addToHistory",false),p.dispatch(g),s=false;},u=c=>()=>(c()&&(d(e.projectDoc()),a()),true),p=new EditorView(t,{state:EditorState.create({doc:e.projectDoc(),plugins:[keymap({...baseKeymap,Home:selectTextblockStart,End:selectTextblockEnd,"Mod-z":u(()=>e.undo()!==null),"Mod-y":u(()=>e.redo()!==null),"Shift-Mod-z":u(()=>e.redo()!==null),"Mod-b":(c,g)=>x(c,g,"b"),"Mod-i":(c,g)=>x(c,g,"i"),"Mod-u":(c,g)=>x(c,g,"u",{val:"single"})})]}),editable:()=>e.editable,handleDOMEvents:{keydown:c=>(m(c),false),beforeinput:(c,g)=>{let k=g;if(c.composing)return false;m(c);let S=k.inputType;if(S==="insertText"&&k.data!=null){k.preventDefault();let{from:R,to:b}=c.state.selection;return c.dispatch(c.state.tr.insertText(k.data,R,b)),true}if(S==="deleteContentBackward"){k.preventDefault();let{from:R,empty:b}=c.state.selection;return b?R>0?c.dispatch(c.state.tr.delete(R-1,R)):joinBackward(c.state,c.dispatch):deleteSelection(c.state,c.dispatch),true}if(S==="deleteContentForward"){k.preventDefault();let{from:R,to:b,empty:T}=c.state.selection;return T?b<c.state.doc.content.size?c.dispatch(c.state.tr.delete(R,R+1)):joinForward(c.state,c.dispatch):deleteSelection(c.state,c.dispatch),true}return S==="insertParagraph"?(k.preventDefault(),splitBlock(c.state,c.dispatch),true):false},compositionstart:()=>(e.beginComposition(),false),compositionend:()=>(e.endComposition(),a(),false)},dispatchTransaction(c){let g=p.state.apply(c);if(s||!c.docChanged){p.updateState(g);return}let k=e.applyPmDoc(g.doc);if(k.rejected){o=String(k.reason??"rejected"),p.updateState(g),d(e.projectDoc()),a();return}o=null,p.updateState(k.committed&&e.lastCommitWasStructural()?O(g):g),a();}});function m(c){if(c.composing||s)return;let g=c.dom.ownerDocument.getSelection(),k=g?.anchorNode,S=g?.focusNode;if(!(!g||!k||!S)&&!(!c.dom.contains(k)||!c.dom.contains(S)))try{let R=c.posAtDOM(k,g.anchorOffset),b=c.posAtDOM(S,g.focusOffset),T=c.state.selection;if(T.anchor===R&&T.head===b)return;let v=TextSelection.create(c.state.doc,R,b);c.dispatch(c.state.tr.setSelection(v).setMeta("addToHistory",!1));}catch{}}function O(c){let g=e.paragraphIds(),k=c.tr,S=false,R=0;return c.doc.forEach((b,T)=>{let v=g[R];R+=1,!(b.type.name!=="paragraph"||v===void 0)&&b.attrs.nodeId!==v&&(k=k.setNodeMarkup(T,void 0,{...b.attrs,nodeId:v}),S=true);}),S?c.apply(k.setMeta("addToHistory",false)):c}function x(c,g,k,S){let R=E.marks.runProps;if(!g)return true;let{from:b,to:T,empty:v}=c.selection;if(v)return true;let X=c.doc.resolve(b).marks().find(Te=>Te.type===R)?.attrs.props??[],L=Pr(X,k,S),oe=c.tr;return oe.removeMark(b,T,R),L.length>0&&oe.addMark(b,T,R.create({props:L})),g(oe),true}return {view:p,state:r,undo:()=>u(()=>e.undo()!==null)(),redo:()=>u(()=>e.redo()!==null)(),toggleRunProperty(c,g){x(p.state,p.dispatch.bind(p),c,g);},destroy:()=>p.destroy()}}export{E as a,Je as b,te as c,F as d,G as e,Ue as f,Do as g,Ge as h,et as i,dr as j,cr as k,Sr as l};
|