@docx-editor.dev/editor-api 2.37.0 → 2.38.0-canary.20261113032851.sha-e2cbc55

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/index.js CHANGED
@@ -3,4 +3,4 @@ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
3
  Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
4
  Production use requires a commercial agreement: licensing@eigenpal.com
5
5
  */
6
- 'use strict';var automation=require('@docx-editor.dev/core/automation');function Ut(o){return automation.createAutomationPaginationProvider(o)}var Un=Object.freeze({PropertyNotLoaded:"the property has not been loaded. Call load(...) and await context.sync() before reading it.",ValueNotLoaded:"the result has not been filled in yet. Await context.sync() before reading it.",InvalidObjectPath:"the object cannot be addressed. Await context.sync() after creating an object with an edit. Keep proxies within their run, or use context.trackedObjects.add(...) before the run ends.",ObjectInUse:"the object still belongs to a run that has not finished. Await that run before passing the object to another one.",InvalidArgument:"the argument is not one this API accepts.",ResourceLimitExceeded:"the document exceeds a supported resource limit.",ItemNotFound:"the collection has no such item.",NotSupported:"the operation or argument is outside the supported subset for this host, mode, or content.",NotImplemented:"this API does not implement that operation for this target.",ConflictingChanges:"these operations cannot share one atomic batch. Split them across separate context.sync() calls.",InvalidRequestContext:"the request context has finished. Start another run to continue.",RuntimeDisposed:"the runtime has been disposed.",StaleDocument:"the document or a range changed after this context read it, so nothing was applied. The change can come from another writer or from an earlier sync of this context.",DocumentUnavailable:"the document is not available right now.",PreviewActive:"a preview is open over the document. Commit or discard it before writing or opening another.",PreviewEnded:"the preview has ended. Start another preview to show other wording.",GeneralException:"the document could not complete the request."}),Wn="the object no longer exists in the document. An edit removed or merged it. Read the document again to get a fresh object.";function zn(o,e){return o==="InvalidObjectPath"&&e==="edit.stale-target"?Wn:Un[o]}var x=class extends Error{code;limit;target;expectedRevision;actualRevision;debugInfo;constructor(e){let t=zn(e.code,e.diagnostic),n=e.target?`${t} (${e.target})`:t;super(n),this.name="DocxEditorError",this.code=e.code,this.debugInfo=Object.freeze({code:e.code,message:n,...e.target===void 0?{}:{errorLocation:e.target},...e.diagnostic===void 0?{}:{innerError:Object.freeze({code:e.diagnostic,message:automation.explainDiagnostic(e.diagnostic).hint})}}),e.limit!==void 0&&(this.limit=e.limit),e.target!==void 0&&(this.target=e.target),e.expectedRevision!==void 0&&(this.expectedRevision=e.expectedRevision),e.actualRevision!==void 0&&(this.actualRevision=e.actualRevision);}};function Ue(o){return o instanceof x?true:typeof o=="object"&&o!==null&&o.name==="DocxEditorError"&&typeof o.code=="string"}function a(o){throw new x(o)}var me=Symbol("docx-editor.runtime.internals"),ot=Symbol("docx-editor.runtime.release"),rt=Symbol("docx-editor.runtime.rebind"),Wt=Symbol.for("@docx-editor.dev/editor-api/author"),zt=Symbol.for("@docx-editor.dev/editor-api/queue");function Y(o){return o[me]}var Qn=new Set(["select","expand","top","skip"]),Qt=/^[A-Za-z][A-Za-z0-9]*$/,Kn="items/",Kt=4,Xn=64;function Zn(o,e){if(typeof o!="string"&&a({code:"InvalidArgument",target:e}),Qt.test(o))return {own:o};let t=o.split("/",Kt+1);if(t.length<=Kt&&t.every(r=>r.length<=Xn&&Qt.test(r))||a({code:"InvalidArgument",target:e}),t.length===2&&o.startsWith(Kn))return {item:t[1]};a({code:"InvalidArgument",target:`${e}.${o}`});}function Xt(o,e){if(o===void 0)return {own:[],items:[]};let t=typeof o=="string"?o.split(",").map(i=>i.trim()):Array.isArray(o)?o.map(i=>typeof i=="string"?i.trim():i):a({code:"InvalidArgument",target:e}),n=[],r=[];for(let i of t){let s=Zn(i,e);s.own!==void 0&&!n.includes(s.own)&&n.push(s.own),s.item!==void 0&&!r.includes(s.item)&&r.push(s.item);}return n.length===0&&r.length===0&&a({code:"InvalidArgument",target:e}),{own:n,items:r}}function Zt(o){return {select:o.own,itemSelect:o.items}}function Yt(o,e){return (typeof o!="number"||!Number.isInteger(o)||o<0)&&a({code:"InvalidArgument",target:e}),o}function Yn(o,e){o===void 0||Array.isArray(o)&&o.length===0||a({code:"InvalidArgument",target:e});}function Jt(o,e){if(o===void 0)return {select:[],itemSelect:[]};if(typeof o=="string"||Array.isArray(o))return Zt(Xt(o,e));(typeof o!="object"||o===null)&&a({code:"InvalidArgument",target:e});let t=o;for(let n of Object.keys(t))Qn.has(n)||a({code:"InvalidArgument",target:`${e}.${n}`});return Yn(t.expand,`${e}.expand`),{...Zt(Xt(t.select,`${e}.select`)),...t.top===void 0?{}:{top:Yt(t.top,`${e}.top`)},...t.skip===void 0?{}:{skip:Yt(t.skip,`${e}.skip`)}}}var z=class{#e;#t;#n;#r;#s=new Map;#a=false;constructor(e,t,n={}){this.#e=e,this.#t=e[me],this.#n=t,this.#r=n.nullable===true,this.#t.register(this);}get context(){return this.#e}get isNullObject(){return this.#n.isReleased&&a({code:"InvalidObjectPath",target:this.#n.label}),this.#r?(this.#n.isPending&&a({code:"PropertyNotLoaded",target:`${this.#n.label}.isNullObject`}),this.#n.isNull):false}load(e){this.#a=true;try{this.requireUsablePath();let t=Jt(e,this.#n.label),n=t.itemSelect[0];return n!==void 0&&!this.loadsItemPaths&&a({code:"InvalidArgument",target:`${this.#n.label}.items/${n}`}),this.onLoad(t),this}finally{this.#a=false;}}get loadsItemPaths(){return false}get path(){return this.#n}get internals(){return this.#t}handle(){return this.#n.handle()}requireAddressable(){this.#n.isAddressable||a({code:"InvalidObjectPath",target:this.#n.label}),this.#t.assertUsable(this.#n.label);}requireUsablePath(){(this.#n.isReleased||this.#n.isNull&&!(this.#a&&this.#r))&&a({code:"InvalidObjectPath",target:this.#n.label}),this.#t.assertUsable(this.#n.label);}enqueue(e){this.requireUsablePath(),this.#t.queue.push({...e,dependencies:[...e.dependencies??[],this.#n],...this.#a&&this.#r&&e.sort==="read"?{nullableLoad:this.#n}:{}});}loadedProperty(e){return this.#n.isReleased&&!this.#s.has(e)&&a({code:"InvalidObjectPath",target:this.#n.label}),this.#s.has(e)||a({code:"PropertyNotLoaded",target:`${this.#n.label}.${e}`}),this.#s.get(e)}hasLoadedProperty(e){return this.#s.has(e)}setLoadedProperty(e,t){this.#s.set(e,t);}[ot](){this.#n.release();}[rt](e){this.#e=e,this.#t=e[me];}};var We=class o{#e=false;#t;#n;constructor(e){this.#n=e;}get value(){return this.#e||a({code:"ValueNotLoaded",target:this.#n}),this.#t}get isLoaded(){return this.#e}static create(e){let t=new o(e);return {result:t,fill(n){t.#e=true,t.#t=n;}}}};function G(o){return We.create(o)}function D(o){return new x({code:"GeneralException",target:o})}function P(o,e){if(o.kind!=="text")throw D(e);return o.text}function v(o,e){if(o.kind!=="handle")throw D(e);return o.handle}function O(o,e){if(o.kind!=="handles")throw D(e);return o.handles}function w(o,e){if(o.kind!=="span")throw D(e);return o.span}function te(o,e){if(o.kind!=="spans")throw D(e);return o.spans}function pt(o,e){if(o.kind!=="font")throw D(e);return o.font}function mt(o,e){if(o.kind!=="paragraphFormat")throw D(e);return o.format}function ze(o,e){if(o.kind!=="style")throw D(e);return o.name}function Qe(o,e){if(o.kind!=="styles")throw D(e);return o.styles}function ve(o,e){if(o.kind!=="number")throw D(e);return o.value}function ge(o,e){if(o.kind!=="flag")throw D(e);return o.value}function gt(o,e){if(o.kind!=="pageSetup")throw D(e);return o.setup}function R(o,e){if(o.kind!=="applied")throw D(e)}function U(o){a({code:"NotImplemented",target:o,diagnostic:"edit.field-result-unsupported"});}var u=class o{label;#e;#t;isFieldResult;constructor(e,t,n=null,r=false){this.label=e,this.#e=t,this.#t=n,this.isFieldResult=r;}static fieldResult(e,t){return new o(e,{status:"pending"},t,true)}static of(e,t){return new o(e,{status:"resolved",address:{kind:"handle",handle:t}})}static ofSpan(e,t){return new o(e,{status:"resolved",address:{kind:"span",span:t}})}static pending(e){return new o(e,{status:"pending"})}static derived(e,t){return new o(e,{status:"pending"},t)}get state(){if(!this.#t)return this.#e;let e=this.#t.state;return !this.isFieldResult||e.status!=="resolved"||e.address.kind!=="handle"?e:{status:"resolved",address:{kind:"fieldResult",field:e.address.handle}}}get origin(){return this.#t?this.#t.origin:this}get isAddressable(){return this.state.status==="resolved"}get isPending(){return this.state.status==="pending"}get isNull(){return this.state.status==="null"}get isReleased(){return this.state.status==="released"}address(){let e=this.state;if(e.status==="resolved")return e.address;a({code:"InvalidObjectPath",target:this.label});}handle(){let e=this.address();return e.kind==="fieldResult"&&U(this.label),e.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.label}),e.handle}span(){let e=this.address();return e.kind==="fieldResult"&&U(this.label),e.kind!=="span"&&a({code:"InvalidObjectPath",target:this.label}),e.span}resolveTo(e){this.#n({kind:"handle",handle:e});}resolveToSpan(e){this.#n({kind:"span",span:e});}resolveNull(){this.#e.status!=="released"&&(this.#e={status:"null"});}release(){this.#t||(this.#e={status:"released"});}#n(e){this.#e.status!=="released"&&(this.#e={status:"resolved",address:e});}};function en(o){let e=[],t=false,n=false;for(let r of o)e.push(r.plan()),r.sort==="write"?n=true:t=true;return {operations:e,hasRead:t,hasWrite:n}}var eo=Object.freeze({"stale-revision":"StaleDocument","invalid-handle":"InvalidObjectPath","invalid-offset":"InvalidArgument","unsupported-capability":"NotSupported",disposed:"RuntimeDisposed","transaction-refused":"GeneralException","unknown-operation":"NotSupported","unsupported-content":"InvalidArgument","unsupported-revision":"NotImplemented","ambiguous-document":"GeneralException","conflicting-operations":"ConflictingChanges","document-unavailable":"DocumentUnavailable"});function Re(o,e={}){let t=eo[o.code]??"GeneralException",n=t==="StaleDocument",r=automation.reviewSkipOfReason(o.detail),i=o.detail===void 0?null:automation.storeEditDiagnosticCode(o.detail)??r?.code??null,s=new x({code:t,...i===null?{}:{diagnostic:i},...e.target===void 0?{}:{target:e.target},...n&&e.expectedRevision!==void 0?{expectedRevision:e.expectedRevision}:{},...n&&e.actualRevision!==void 0?{actualRevision:e.actualRevision}:{}}),d=o.detail!==void 0&&!o.detail.includes(":"),l=r?r.cause??(d?automation.diagnosticCause(o.detail):void 0):automation.diagnosticCause(o.detail);return l&&tn.set(s,l),s}var tn=new WeakMap;function nn(o){return tn.get(o)}function ft(o,e,t){for(let n=0;n<o.results.length;n+=1){let r=o.results[n];if(r?.status!=="error")continue;let i=e[n]?.label;return Re(r.error,{...i===void 0?{}:{target:i},...t===void 0?{}:{expectedRevision:t},actualRevision:o.revision})}return new x({code:"GeneralException"})}function bt(o,e){if(e.results.length!==o.length)throw new x({code:"GeneralException"});for(let t=0;t<o.length;t+=1){let n=e.results[t],r=o[t];if(n.status!=="ok")throw new x({code:"GeneralException",target:r.label});r.settle(n.value);}}var it=class{#e=[];#t=null;#n=[];get size(){return this.#e.length}get pending(){return this.#e}push(e){(this.#t??this.#e).push(e);}collect(e){let t=this.#t,n=[];this.#t=n;try{e();}finally{this.#t=t;}return n}continuing(e){this.#n.push(...this.collect(e));}takeContinuations(){let e=this.#n;this.#n=[];for(let t of e)t.capture?.();return e}take(){let e=this.#e;this.#e=[];for(let t of e)t.capture?.();return e}clear(){for(let e of this.#e)e.dispose?.();for(let e of this.#n)e.dispose?.();this.#e=[],this.#n=[];}};function on(o,e){if(Array.isArray(o)){for(let t of o)e(t);return}e(o);}var Ke=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t;}add(e){this.#e.assertUsable(),on(e,t=>{this.#n(t),this.#e.track(t);});}remove(e){this.#e.assertUsable(),on(e,t=>{this.#n(t),this.#e.untrack(t);});}#n(e){this.#t(e)||a({code:"InvalidObjectPath"});}};var Ae=class o{#e;#t=new it;#n=new Set;#r=new Set;#s;#a;#d;#i=false;#o=null;#c=false;constructor(e){this.#e=e,this.#s={host:e.host,capabilities:e.capabilities,...e.author===void 0?{}:{author:e.author},revisionTextView:e.revisionTextView,queue:this.#t,session:e.id,roots:()=>e.roots(),assertUsable:t=>{this.#e.assertLive(t),this.#i&&a({code:"InvalidRequestContext",...t===void 0?{}:{target:t}});},isFinished:()=>this.#i,readRevision:()=>this.#o,register:t=>{this.#n.add(t);},track:t=>{this.#r.add(t);},untrack:t=>{this.#r.delete(t);},isTracked:t=>this.#r.has(t),disown:t=>{this.#n.delete(t),this.#r.delete(t);}},this.#a=new Ke(this.#s,t=>this.#n.has(t)),Object.defineProperty(this,Wt,{get:()=>e.author}),Object.defineProperty(this,zt,{value:Object.freeze({writes:()=>this.#t.pending.filter(t=>t.sort==="write"&&!t.runtimeSetting).length})});}get document(){return this.#s.assertUsable("document"),this.#d??=this.#e.openDocument(this),this.#d}get capabilities(){return this.#e.capabilities}get trackedObjects(){return this.#a}async sync(){this.#s.assertUsable(),this.#c&&a({code:"InvalidRequestContext"});let e=this.#t.take();if(e.length!==0){this.#c=true;try{let t=e.filter(m=>!m.nullableLoad?.isNull),n=e.some(m=>m.sort==="write"),r,i=n&&this.#o!==null?this.#o:void 0,s=m=>m.dependencies?.some(b=>!b.isAddressable)??false,d=new Set(e.flatMap(m=>m.sort==="write"?m.produces??[]:[])),l=m=>m.sort==="read"&&(m.dependencies?.some(b=>!b.isAddressable&&d.has(b.origin))??false),h=d.size?t.filter(l):[];if(h.length){let m=new Set(h);t=t.filter(b=>!m.has(b));}for(;t.some(s);){r??=n&&this.#o!==null?this.#o:this.#e.host.revision();let m=t.filter(j=>j.sort==="read"&&!s(j));m.length===0&&a({code:"InvalidObjectPath",target:t.find(s)?.label}),await this.#p(m,r,i),await this.#h(r,i);let b=new Set(m);t=t.filter(j=>!b.has(j)&&!j.nullableLoad?.isNull);}let y=n?t.filter(m=>typeof m.continues=="function"?m.continues():m.continues===true):[];if(y.length){r??=this.#o!==null?this.#o:this.#e.host.revision(),await this.#p(y,r,i),await this.#h(r,i);let m=new Set(y);t=t.filter(b=>!m.has(b)&&!b.nullableLoad?.isNull);}if(t.length){let m=r??(n&&this.#o!==null?this.#o:void 0);await this.#p(t,m,i),await this.#h(this.#o??void 0,i);}h.length&&await this.#u(h,s);}finally{for(let t of e)t.dispose?.();for(let t of this.#t.takeContinuations())t.dispose?.();this.#c=false;}}}async#u(e,t){let n=e;try{for(;n.length;){let r=n.filter(d=>!t(d));r.length===0&&a({code:"InvalidObjectPath",target:n.find(t)?.label});let i=this.#o??void 0;await this.#p(r,i,void 0),await this.#h(i,void 0);let s=new Set(r);n=n.filter(d=>!s.has(d)&&!d.nullableLoad?.isNull);}}catch(r){throw Ue(r)?new x({code:r.code,...r.target===void 0?{}:{target:r.target},...r.expectedRevision===void 0?{}:{expectedRevision:r.expectedRevision},...r.actualRevision===void 0?{}:{actualRevision:r.actualRevision},diagnostic:"edit.read-after-commit"}):r}}async#h(e,t){let n=this.#t.takeContinuations();if(n.length!==0)try{await this.#p(n,e,t);}finally{for(let r of n)r.dispose?.();}}async#p(e,t,n){let r=en(e);try{await this.#l(e,r,t,n);}catch(i){if(!Ue(i))try{this.#e.onException?.(i,r.operations);}catch{}throw i}}async#l(e,t,n,r){let i={operations:t.operations,...n===void 0?{}:{expectedRevision:n}};if(this.#e.host.prepare){let d={...i,expectedRevision:i.expectedRevision??this.#e.host.revision()};try{await this.#e.host.prepare(d);}catch(h){throw Ue(h)?this.#m(h,t.operations):h}let l=this.#e.host.execute(d);if(!l.ok)throw this.#m(ft(l,e,r),t.operations);bt(e,l),this.#o=l.revision;return}let s=this.#e.host.execute(i);if(!s.ok)throw this.#m(ft(s,e,r),t.operations);bt(e,s),(t.hasRead||t.hasWrite)&&(this.#o=s.revision);}#m(e,t){try{this.#e.onRefusal?.(e,t);}catch{}return e}get[me](){return this.#s}static begin(e){let t=new o(e);return {context:t,adopt(n){for(let r of n)t.#g(r);},finish(){t.#b();}}}#g(e){let t=e.context;if(t===this)return;let n=t[me];if(n.session!==this.#e.id)throw new x({code:"InvalidObjectPath"});if(!n.isFinished())throw new x({code:"ObjectInUse"});if(!n.isTracked(e))throw new x({code:"InvalidObjectPath"});let r=n.readRevision();n.disown(e),e[rt](this),this.#n.add(e),this.#r.add(e),r!==null&&this.#f(r);}#f(e){this.#o=this.#o===null?e:Math.min(this.#o,e);}#b(){if(!this.#i){this.#i=true,this.#t.clear();for(let e of this.#n)this.#r.has(e)||e[ot]();this.#n.clear();}}};function Xe(o,e,t){if(o.select.length===0)return e;for(let n of o.select)e.includes(n)||a({code:"InvalidArgument",target:`${t}.${n}`});return o.select}var p=class extends z{revisionTextView(){return Y(this.context).revisionTextView}loadTextInto(e,t){let n=`${this.path.label}.${e}`;this.enqueue({sort:"read",label:n,plan:t,settle:r=>{this.setLoadedProperty(e,P(r,n));}});}command(e,t,n){let r=`${this.path.label}.${e}`;this.enqueue({sort:"write",label:r,plan:t,settle:i=>R(i,r),...n?{capture:n,dispose:n}:{}});}commandDiscarding(e,t){let n=`${this.path.label}.${e}`;this.enqueue({sort:"write",label:n,plan:t,settle:()=>{}});}commandAnswering(e,t,n,r){this.enqueue({sort:"write",label:e,plan:t,settle:n,...r?{capture:r,dispose:r}:{}});}commandCreating(e,t,n,r,i){this.enqueue({sort:"write",label:t,plan:n,settle:r,produces:[e.path],...i?{capture:i,dispose:i}:{}});}read(e,t,n){this.enqueue({sort:"read",label:e,plan:t,settle:n});}selection(e,t){return Xe(e,t,this.path.label)}onLoad(e){this.selection(e,[]);}};var to=["author","title","subject","keywords","comments","category","lastAuthor"],Ce=class o extends p{#e;static of(e,t){return new o(e,u.derived("document.properties",t))}constructor(e,t){super(e,t);}get lastAuthor(){return this.loadedProperty("lastAuthor")}get author(){return this.loadedProperty("author")}set author(e){this.#t("author",e);}get title(){return this.loadedProperty("title")}set title(e){this.#t("title",e);}get subject(){return this.loadedProperty("subject")}set subject(e){this.#t("subject",e);}get keywords(){return this.loadedProperty("keywords")}set keywords(e){this.#t("keywords",e);}get comments(){return this.loadedProperty("comments")}set comments(e){this.#t("comments",e);}get category(){return this.loadedProperty("category")}set category(e){this.#t("category",e);}onLoad(e){for(let t of this.selection(e,to))this.read(`${this.path.label}.${t}`,()=>({op:"getDocumentProperty",name:t}),n=>this.setLoadedProperty(t,P(n,this.path.label)));}#t(e,t){if(this.requireUsablePath(),(typeof t!="string"||t.length>4096)&&a({code:"InvalidArgument",target:`${this.path.label}.${e}`}),this.#e){this.#e[e]=t;return}let n={[e]:t};this.#e=n,this.commandAnswering(this.path.label,()=>({op:"setDocumentProperties",values:n}),r=>{R(r,this.path.label);},()=>{this.#e===n&&(this.#e=void 0);});}};function I(o,e){let t=o.address();return t.kind==="fieldResult"&&U(o.label),e==="span"?(t.kind!=="span"&&a({code:"InvalidObjectPath",target:o.label}),{start:t.span.start,end:t.span.end}):(t.kind!=="handle"&&a({code:"InvalidObjectPath",target:o.label}),e==="body"?{body:t.handle}:{paragraph:t.handle})}function Pe(o,e){return (typeof o!="string"||o.trim().length===0||o.length>255)&&a({code:"InvalidArgument",target:e}),o}function yt(o){return [...new Set([...o.select.filter(e=>e!=="items"),...o.itemSelect])]}var Ze=class{#e;#t=new Set;join(e,t,n){this.#e??=new Set;for(let r of e)this.#e.add(r);return this.#t.has(rn(t,n))}open(e,t,n){let r=this.#e??=new Set,i=rn(e,t);this.#t.add(i);let s=false,d=()=>{s||(s=true,this.#t.delete(i),this.#t.size===0&&(this.#e=void 0));};try{n(r,d);}catch(l){throw d(),l}}};function rn(o,e){return `${String(o)}:${e===void 0?"":String(e)}`}function xt(o,e,t){return t===void 0?o:Math.min(o,e+t)}var M=class extends z{#e;#t=[];#n=new Ze;constructor(e,t){super(e,t);}get items(){return this.loadedProperty("items")}fill(e,t){this.setLoadedProperty("items",this.#a(e,t,0,void 0)),this.#e={value:e,label:t};let n=this.#t.splice(0,this.#t.length);for(let r of n)this.#s(r,e);}get loadsItemPaths(){return true}onLoad(e){let t=yt(e);t.length>0&&this.#r(t);let n=this.path.isPending?void 0:this.listing(),r=`${this.path.label}.items`,i=e.skip??0,s=e.top,d=e.skip!==void 0||s!==void 0;if(n===null){if(t.length===0&&!d)return;let l=this.#e;l||a({code:"NotImplemented",target:r});let h=this.#a(l.value,l.label,i,s);if(this.setLoadedProperty("items",h),t.length>0)for(let y of h)y.load(t);return}this.#n.join(t,i,s)||this.#n.open(i,s,(l,h)=>this.enqueue({sort:"read",label:r,continues:()=>l.size>0,capture:h,dispose:h,plan:()=>{let y=n??this.listing();return y||a({code:"InvalidObjectPath",target:this.path.label}),y},settle:y=>{let m=this.#a(y,r,i,s);this.setLoadedProperty("items",m);let b=[...l];b.length!==0&&this.internals.queue.continuing(()=>{for(let j of m)j.load(b);});}}));}#r(e){let t=this.promised(`${this.path.label}.items`,false),n=this.internals.queue.collect(()=>{try{t.load(e);}catch(r){if(r.code==="InvalidArgument")throw r}});for(let r of n)r.dispose?.();}edge(e,t,n){let r=`${this.path.label}.${t}()`,i=this.promised(r,n),s=this.path.isPending?void 0:this.listing();if(s===null){let d={edge:e,target:r,nullable:n,item:i};return this.#e?this.#s(d,this.#e.value):this.#t.push(d),i}return this.enqueue({sort:"read",label:r,plan:()=>{let d=s??this.listing();return d||a({code:"InvalidObjectPath",target:this.path.label}),d},settle:d=>{this.#s({edge:e,target:r,nullable:n,item:i},d);}}),i}#s(e,t){let{edge:n,target:r,nullable:i,item:s}=e,d=this.size(t,r);if(d===0){i||a({code:"ItemNotFound",target:r}),s.hydrateNull();return}let l=this.addressAt(t,r,n==="first"?0:d-1);l||a({code:"ItemNotFound",target:r}),s.hydrateAddress(l);}#a(e,t,n,r){let i=this.size(e,t),s=xt(i,n,r),d=[];for(let l=n;l<s;l+=1){let h=this.addressAt(e,t,l);h&&d.push(this.itemAt(`${t}[${String(l)}]`,h));}return d}},k=class extends M{size(e,t){return O(e,t).length}addressAt(e,t,n){let r=O(e,t)[n];return r?{kind:"handle",handle:r}:void 0}};var st=(s=>(s.unsupported="Unsupported",s.textBox="TextBox",s.geometricShape="GeometricShape",s.group="Group",s.picture="Picture",s.canvas="Canvas",s))(st||{}),no=["id","name","type"],sn=new Set(Object.values(st)),Oe=class o extends p{#e;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,u.of(t,n.handle),false)}static promised(e,t,n){return new o(e,u.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get id(){return this.loadedProperty("id")}get name(){return this.loadedProperty("name")}get type(){return this.loadedProperty("type")}get body(){if(this.#e)return this.#e;let e=`${this.path.label}.body`,t=E.promisedStory(this.context,e);return this.read(e,()=>({op:"getShapeBody",shape:this.#t()}),n=>{t.hydrateAddress({kind:"handle",handle:v(n,e)});}),this.#e=t,t}onLoad(e){let t=this.selection(e,no);t.length&&this.read(this.path.label,()=>({op:"getShape",shape:this.#t()}),n=>{(n.kind!=="shape"||!sn.has(n.shape.type))&&a({code:"GeneralException",target:this.path.label});for(let r of t)this.setLoadedProperty(r,n.shape[r]);});}#t(){return this.requireAddressable(),this.path.handle()}},ne=class o extends M{#e;#t;static of(e,t,n,r,i){return new o(e,u.derived(t,n),r,i)}constructor(e,t,n,r){super(e,t),this.#e=n,this.#t=r;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}getByTypes(e){let t=`${this.path.label}.getByTypes`;(!Array.isArray(e)||e.some(r=>!sn.has(r)))&&a({code:"InvalidArgument",target:t});let n=this.#t?this.#t.filter(r=>e.includes(r)):[...e];return o.of(this.context,t,this.path,this.#e,n)}listing(){let e=I(this.path,this.#e);return this.#t?{op:"getShapes",span:e,types:this.#t}:{op:"getShapes",span:e}}size(e,t){return O(e,t).length}addressAt(e,t,n){let r=O(e,t)[n];return r?{kind:"handle",handle:r}:void 0}itemAt(e,t){return Oe.at(this.context,e,t)}promised(e,t){return Oe.promised(this.context,e,t)}};function oo(o){return o==="endnote"?"Endnote":"Footnote"}var we=class o extends p{#e;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,u.of(t,n.handle),false)}static promised(e,t,n){return new o(e,u.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get type(){return this.loadedProperty("type")}get text(){return this.loadedProperty("text")}get body(){if(this.#e)return this.#e;let e=`${this.path.label}.body`,t=E.promisedStory(this.context,e);return this.read(e,()=>({op:"getNoteBody",note:this.#t()}),n=>{t.hydrateAddress({kind:"handle",handle:v(n,e)});}),this.#e=t,t}delete(){this.command("delete",()=>({op:"deleteNote",note:this.#t()}));}getNext(){let e=`${this.path.label}.getNext`,t=o.promised(this.context,e,false),n=this.internals.roots().document,r=`${e}.type`,i="footnote",s=u.pending(r);return this.read(r,()=>({op:"getNoteKind",note:this.#t()}),d=>{i=P(d,r)==="endnote"?"endnote":"footnote",s.resolveTo(this.#t());}),this.enqueue({sort:"read",label:e,dependencies:[s],plan:()=>({op:"getNotes",document:n,noteKind:i}),settle:d=>{let l=O(d,e),h=l.findIndex(m=>m.ref===this.#t().ref),y=h<0?void 0:l[h+1];y||a({code:"ItemNotFound",target:e}),t.hydrateAddress({kind:"handle",handle:y});}}),t}onLoad(e){let t=this.selection(e,["text","type"]);if(t.includes("text")&&this.loadTextInto("text",()=>({op:"getNoteText",note:this.#t(),projection:this.revisionTextView()})),t.includes("type")){let n=`${this.path.label}.type`;this.read(n,()=>({op:"getNoteKind",note:this.#t()}),r=>{this.setLoadedProperty("type",oo(P(r,n)));});}}#t(){return this.requireAddressable(),this.path.handle()}},Q=class o extends k{#e;static of(e,t,n,r){return new o(e,u.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#e()}itemAt(e,t){return we.at(this.context,e,t)}promised(e,t){return we.promised(this.context,e,t)}};var vt=(i=>(i.replace="Replace",i.start="Start",i.end="End",i.before="Before",i.after="After",i))(vt||{}),Rt=(s=>(s.whole="Whole",s.start="Start",s.end="End",s.before="Before",s.after="After",s.content="Content",s))(Rt||{}),At=(t=>(t.original="Original",t.current="Current",t))(At||{}),Ct=(s=>(s.mixed="Mixed",s.unknown="Unknown",s.left="Left",s.centered="Centered",s.right="Right",s.justified="Justified",s))(Ct||{}),Pt=(t=>(t.portrait="Portrait",t.landscape="Landscape",t))(Pt||{}),Ot=(n=>(n.off="Off",n.trackAll="TrackAll",n.trackMineOnly="TrackMineOnly",n))(Ot||{}),wt=(r=>(r.mixed="Mixed",r.top="Top",r.center="Center",r.bottom="Bottom",r))(wt||{}),kt=(d=>(d.line="Line",d.page="Page",d.next="Next",d.sectionNext="SectionNext",d.sectionContinuous="SectionContinuous",d.sectionEven="SectionEven",d.sectionOdd="SectionOdd",d))(kt||{}),St=(S=>(S.unknown="Unknown",S.richText="RichText",S.plainText="PlainText",S.picture="Picture",S.buildingBlockGallery="BuildingBlockGallery",S.checkBox="CheckBox",S.comboBox="ComboBox",S.datePicker="DatePicker",S.dropDownList="DropDownList",S.group="Group",S.repeatingSection="RepeatingSection",S.plainTextInline="PlainTextInline",S.plainTextParagraph="PlainTextParagraph",S.richTextInline="RichTextInline",S.richTextParagraphs="RichTextParagraphs",S.richTextTable="RichTextTable",S.richTextTableCell="RichTextTableCell",S.richTextTableRow="RichTextTableRow",S))(St||{}),It=(f=>(f.all="All",f.atMentions="AtMentions",f.commentReactions="CommentReactions",f.comments="Comments",f.contentType="ContentType",f.documentIntelligence="DocumentIntelligence",f.documentManagementPolicy="DocumentManagementPolicy",f.documentProperties="DocumentProperties",f.documentServerProperties="DocumentServerProperties",f.documentTasks="DocumentTasks",f.documentWorkspace="DocumentWorkspace",f.emailHeader="EmailHeader",f.inkAnnotations="InkAnnotations",f.removePersonalInformation="RemovePersonalInformation",f.revisions="Revisions",f.routingSlip="RoutingSlip",f.sendForReview="SendForReview",f.taskpaneWebExtensions="TaskpaneWebExtensions",f.template="Template",f.versions="Versions",f))(It||{}),Tt=(n=>(n.compareTargetCurrent="CompareTargetCurrent",n.compareTargetNew="CompareTargetNew",n.compareTargetSelected="CompareTargetSelected",n))(Tt||{});var ro=["Replace","Start","End"],io=["Start","End"],so=["Replace","Start","End"],ao=["Before","After"],lo=["Replace","Start","End","Before","After"],co=["Select","Start","End"];function ke(o,e,t){return (typeof o!="string"||!e.includes(o))&&a({code:"InvalidArgument",target:t}),o}var an=(o,e)=>ke(o,ro,e),dn=(o,e)=>ke(o,io,e),ln=(o,e)=>ke(o,so,e),cn=(o,e)=>ke(o,ao,e),oe=(o,e)=>ke(o,lo,e),at=(o,e)=>o===void 0?"Select":ke(o,co,e);function K(o,e){return typeof o!="string"&&a({code:"InvalidArgument",target:e}),/[\r\n\f\u2028\u2029]/.test(o)&&a({code:"InvalidArgument",target:e}),o}function Se(o,e){return typeof o!="string"&&a({code:"InvalidArgument",target:e}),/[\f\u2028\u2029]/.test(o)&&a({code:"InvalidArgument",target:e}),o}function un(o){let e=o.address();return e.kind!=="fieldResult"&&a({code:"InvalidObjectPath",target:o.label}),e.field}function hn(o,e){return ()=>({op:"getFieldResult",field:un(o),projection:e})}function pn(o,e,t,n){oe(t,n)!=="Replace"&&U(n),(typeof e!="string"||/[\r\n\f\u2028\u2029]/.test(e))&&a({code:"InvalidArgument",target:n,diagnostic:"edit.invalid-argument"});let r=e;return ()=>({op:"setFieldResult",field:un(o),text:r})}var uo=["width","height","lockAspectRatio","altTextDescription"],re=class o extends p{#e;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,u.of(t,n.handle),false)}static promised(e,t,n){return new o(e,u.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get width(){return this.loadedProperty("width")}set width(e){this.#t("width",e);}get height(){return this.loadedProperty("height")}set height(e){this.#t("height",e);}get lockAspectRatio(){return this.loadedProperty("lockAspectRatio")}set lockAspectRatio(e){typeof e!="boolean"&&a({code:"InvalidArgument",target:`${this.path.label}.lockAspectRatio`}),this.#n({lockAspectRatio:e});}get altTextDescription(){return this.loadedProperty("altTextDescription")}set altTextDescription(e){typeof e!="string"&&a({code:"InvalidArgument",target:`${this.path.label}.altTextDescription`}),this.#n({altTextDescription:e});}delete(){let e=`${this.path.label}.delete`;this.commandAnswering(e,()=>({op:"deleteInlinePicture",picture:this.#r()}),t=>R(t,e));}onLoad(e){let t=this.selection(e,uo);t.length&&this.read(this.path.label,()=>({op:"getInlinePicture",picture:this.#r()}),n=>{n.kind!=="inlinePicture"&&a({code:"GeneralException",target:this.path.label});for(let r of t)this.setLoadedProperty(r,n.picture[r]);});}#t(e,t){(typeof t!="number"||!Number.isFinite(t)||t<=0)&&a({code:"InvalidArgument",target:`${this.path.label}.${e}`}),this.#n({[e]:t});}#n(e){if(this.requireUsablePath(),this.#e){Object.assign(this.#e,e);return}let t=e;this.#e=t,this.commandAnswering(this.path.label,()=>({op:"setInlinePicture",picture:this.#r(),properties:t}),n=>R(n,this.path.label),()=>{this.#e===t&&(this.#e=void 0);});}#r(){this.requireAddressable();let e=this.path.address();return e.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.path.label}),e.handle}},ie=class o extends M{#e;static of(e,t,n,r){return new o(e,u.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}getLast(){return this.edge("last","getLast",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}getLastOrNullObject(){return this.edge("last","getLastOrNullObject",true)}listing(){return {op:"getInlinePictures",span:I(this.path,this.#e)}}size(e,t){return O(e,t).length}addressAt(e,t,n){let r=O(e,t)[n];return r?{kind:"handle",handle:r}:void 0}itemAt(e,t){return re.at(this.context,e,t)}promised(e,t){return re.promised(this.context,e,t)}};function L(o,e,t=0){return (!Number.isInteger(o)||o<t)&&a({code:"InvalidArgument",target:e}),o}function Ye(o,e){return (!Array.isArray(o)||o.some(t=>!Array.isArray(t)||t.some(n=>typeof n!="string")))&&a({code:"InvalidArgument",target:e}),o.map(t=>[...t])}function Te(o,e,t,n,r,i,s){L(r,e,1),L(i,e,1);let d=s===void 0?void 0:Ye(s,e),l=fe.promised(o,e);return {table:l,plan:()=>({op:"insertTable",span:t(),location:n,rowCount:r,columnCount:i,...d?{values:d}:{}}),settle:h=>{h.kind!=="handle"&&a({code:"GeneralException",target:e}),l.hydrateAddress({kind:"handle",handle:h.handle});}}}function mn(o,e){return o!=="Start"&&o!=="End"&&a({code:"InvalidArgument",target:e}),o==="Start"?"start":"end"}var fe=class o extends p{#e;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,u.of(t,n.handle),false)}static promised(e,t,n=false){return new o(e,u.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get values(){return this.loadedProperty("values")}set values(e){let t=Ye(e,`${this.path.label}.values`);this.command("values",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"values",values:t}}));}get style(){return this.loadedProperty("style")}set style(e){typeof e!="string"&&a({code:"InvalidArgument",target:`${this.path.label}.style`}),this.command("style",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"properties",styleId:e}}));}get headerRowCount(){return this.loadedProperty("headerRowCount")}set headerRowCount(e){L(e,`${this.path.label}.headerRowCount`),this.command("headerRowCount",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"properties",headerRowCount:e}}));}get rowCount(){return this.loadedProperty("rowCount")}get columnCount(){return this.loadedProperty("columnCount")}get rows(){return this.#e??=be.of(this.context,`${this.path.label}.rows`,this.path,()=>({op:"getTableRows",table:this.path.handle()}))}getCell(e,t){let n=`${this.path.label}.getCell`;L(e,n),L(t,n);let r=se.promised(this.context,n);return this.read(n,()=>({op:"getTableCell",table:this.path.handle(),rowIndex:e,cellIndex:t}),i=>r.hydrateAddress({kind:"handle",handle:v(i,n)})),r}addRows(e,t,n){let r=`${this.path.label}.addRows`,i=mn(e,r);L(t,r,1);let s=n===void 0?void 0:Ye(n,r),d=be.of(this.context,r,this.path,()=>null);return this.commandAnswering(r,()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"addRows",location:i,count:t,...s?{values:s}:{}}}),l=>d.fill(l,r)),d}addColumns(e,t,n){let r=`${this.path.label}.addColumns`,i=mn(e,r);L(t,r,1);let s=n===void 0?void 0:Ye(n,r);this.command("addColumns",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"addColumns",location:i,count:t,...s?{values:s}:{}}}));}deleteRows(e,t){t===void 0&&(t=1),L(e,this.path.label),L(t,this.path.label,1),this.command("deleteRows",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"deleteRows",index:e,count:t}}));}deleteColumns(e,t){t===void 0&&(t=1),L(e,this.path.label),L(t,this.path.label,1),this.command("deleteColumns",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"deleteColumns",index:e,count:t}}));}mergeCells(e,t,n,r){let i=`${this.path.label}.mergeCells`;L(e,i),L(t,i),L(n,i),L(r,i),n<e&&a({code:"InvalidArgument",target:i});let s=se.promised(this.context,i);return this.read(i,()=>({op:"getMergedTableCell",table:this.path.handle(),topRow:e,firstCell:t,bottomRow:n,lastCell:r}),d=>s.hydrateAddress({kind:"handle",handle:v(d,i)})),this.command("mergeCells",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"mergeCells",topRow:e,firstCell:t,bottomRow:n,lastCell:r}})),s}delete(){this.command("delete",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"delete"}}));}onLoad(e){let t=this.selection(e,["values","style","headerRowCount","rowCount","columnCount"]);this.read(this.path.label,()=>({op:"getTable",table:this.path.handle()}),n=>{n.kind!=="table"&&a({code:"GeneralException",target:this.path.label});for(let r of t)this.setLoadedProperty(r,n.table[r]);});}},Ie=class o extends p{#e;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,u.of(t,n.handle),false)}static promised(e,t,n=false){return new o(e,u.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}insertRows(e,t,n){let r=`${this.path.label}.insertRows`;e!=="Before"&&e!=="After"&&a({code:"InvalidArgument",target:r}),L(t,r,1);let i=n===void 0?void 0:Ye(n,r),s=be.of(this.context,r,this.path,()=>null);return this.commandAnswering(r,()=>({op:"insertTableRows",row:this.path.handle(),location:e==="Before"?"before":"after",count:t,...i?{values:i}:{}}),d=>s.fill(d,r)),s}get cells(){return this.#e??=Je.of(this.context,`${this.path.label}.cells`,this.path,()=>({op:"getTableCells",row:this.path.handle()}))}},se=class o extends p{#e;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,u.of(t,n.handle),false)}static promised(e,t,n=false){return new o(e,u.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get body(){if(this.#e)return this.#e;let e=`${this.path.label}.body`,t=E.promisedStory(this.context,e);return this.read(e,()=>({op:"getTableCellBody",cell:this.path.handle()}),n=>t.hydrateAddress({kind:"handle",handle:v(n,e)})),this.#e=t,t}get value(){return this.loadedProperty("value")}set value(e){typeof e!="string"&&a({code:"InvalidArgument",target:`${this.path.label}.value`}),this.command("value",()=>({op:"updateTableCell",cell:this.path.handle(),properties:{value:e}}));}get columnWidth(){return this.loadedProperty("columnWidth")}set columnWidth(e){(typeof e!="number"||!Number.isFinite(e)||e<=0)&&a({code:"InvalidArgument",target:`${this.path.label}.columnWidth`}),this.command("columnWidth",()=>({op:"updateTableCell",cell:this.path.handle(),properties:{columnWidth:e}}));}get shadingColor(){return this.loadedProperty("shadingColor")}set shadingColor(e){typeof e!="string"&&a({code:"InvalidArgument",target:`${this.path.label}.shadingColor`}),this.command("shadingColor",()=>({op:"updateTableCell",cell:this.path.handle(),properties:{shadingColor:e}}));}get verticalAlignment(){return this.loadedProperty("verticalAlignment")}set verticalAlignment(e){e!=="Top"&&e!=="Center"&&e!=="Bottom"&&a({code:"InvalidArgument",target:`${this.path.label}.verticalAlignment`}),this.command("verticalAlignment",()=>({op:"updateTableCell",cell:this.path.handle(),properties:{verticalAlignment:e}}));}split(e,t){let n=`${this.path.label}.split`;L(e,n,1),L(t,n,1),(e>63||t>63||e*t<2)&&a({code:"InvalidArgument",target:n}),this.command("split",()=>({op:"splitTableCell",cell:this.path.handle(),rowCount:e,columnCount:t}));}onLoad(e){let t=this.selection(e,["value","columnWidth","shadingColor","verticalAlignment"]);this.read(this.path.label,()=>({op:"getTableCellProperties",cell:this.path.handle()}),n=>{n.kind!=="tableCell"&&a({code:"GeneralException",target:this.path.label});for(let r of t)this.setLoadedProperty(r,n.cell[r]);});}},ae=class o extends k{#e;static of(e,t,n,r){return new o(e,u.derived(t,n),r)}static over(e,t,n,r){return o.of(e,t,n,()=>({op:"getTables",scope:r()}))}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}listing(){return this.#e()}itemAt(e,t){return fe.at(this.context,e,t)}promised(e,t){return fe.promised(this.context,e,t)}},be=class o extends k{#e;static of(e,t,n,r){return new o(e,u.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}listing(){return this.#e()}itemAt(e,t){return Ie.at(this.context,e,t)}promised(e,t){return Ie.promised(this.context,e,t)}},Je=class o extends k{#e;static of(e,t,n,r){return new o(e,u.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}listing(){return this.#e()}itemAt(e,t){return se.at(this.context,e,t)}promised(e,t){return se.promised(this.context,e,t)}};var fn=4096,J=class o extends p{#e;#t=new Map;#n;#r;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,u.of(t,n.handle),false)}static promised(e,t,n){return new o(e,u.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get id(){return this.loadedProperty("id")}get tag(){return this.loadedProperty("tag")}set tag(e){this.#a("tag",{tag:Lt(e,`${this.path.label}.tag`)});}get title(){return this.loadedProperty("title")}set title(e){this.#a("title",{title:Lt(e,`${this.path.label}.title`)});}get subtype(){return this.loadedProperty("subtype")}get isBound(){return this.loadedProperty("isBound")}get cannotDelete(){let e=this.loadedProperty("lock");return e==="sdtLocked"||e==="sdtContentLocked"}set cannotDelete(e){this.#d("cannotDelete",e);}get cannotEdit(){let e=this.loadedProperty("lock");return e==="contentLocked"||e==="sdtContentLocked"}set cannotEdit(e){this.#d("cannotEdit",e);}get placeholderShown(){return this.loadedProperty("placeholderShown")}get temporary(){return this.loadedProperty("temporary")}get text(){return this.loadedProperty("text")}get paragraphs(){return this.#n??=q.overListing(this.context,`${this.path.label}.paragraphs`,this.path,()=>({op:"getContentControlParagraphs",contentControl:this.#i()})),this.#n}get contentControls(){return this.#r??=N.of(this.context,`${this.path.label}.contentControls`,this.path,{contentControl:this.#i()}),this.#r}getRange(e){let t=`${this.path.label}.getRange`,n=ho(e??"Whole",t),r=this.#t.get(n);if(r)return r;let i=this.#s(t,n);return this.#t.set(n,i),i}setValue(e){let t=`${this.path.label}.setValue`,n=po(e,t);this.command("setValue",()=>({op:"setContentControlValue",contentControl:this.#i(),value:n}));}insertText(e,t){let n=`${this.path.label}.insertText`,r=K(e,n),i=t==="Replace"?"replace":t==="Start"?"start":t==="End"?"end":a({code:"InvalidArgument",target:n}),s=A.promised(this.context,n,false);return this.commandCreating(s,n,()=>({op:"insertContentControlText",contentControl:this.#i(),text:r,at:i}),d=>{s.hydrateAddress({kind:"span",span:w(d,n)});}),s}delete(e){let t=`${this.path.label}.delete`;typeof e!="boolean"&&a({code:"InvalidArgument",target:t}),this.command("delete",()=>({op:"deleteContentControl",contentControl:this.#i(),keepContent:e}));}onLoad(e){let t=this.selection(e,["id","tag","title","subtype","isBound","text","cannotDelete","cannotEdit","placeholderShown","temporary"]);if(t.includes("id")&&this.loadTextInto("id",()=>({op:"getContentControlFileId",contentControl:this.#i()})),t.includes("tag")&&this.loadTextInto("tag",()=>({op:"getContentControlTag",contentControl:this.#i()})),t.includes("title")&&this.loadTextInto("title",()=>({op:"getContentControlTitle",contentControl:this.#i()})),t.includes("subtype")&&this.loadTextInto("subtype",()=>({op:"getContentControlSubtype",contentControl:this.#i()})),t.includes("isBound")){let r=`${this.path.label}.isBound`;this.read(r,()=>({op:"getContentControlIsBound",contentControl:this.#i()}),i=>{this.setLoadedProperty("isBound",ge(i,r));});}if(t.includes("text")&&this.loadTextInto("text",()=>({op:"getContentControlText",contentControl:this.#i(),projection:this.revisionTextView()})),t.includes("cannotDelete")||t.includes("cannotEdit")){let r=`${this.path.label}.lock`;this.read(r,()=>({op:"getContentControlLock",contentControl:this.#i()}),i=>{this.setLoadedProperty("lock",P(i,r));});}if(t.includes("placeholderShown")){let r=`${this.path.label}.placeholderShown`;this.read(r,()=>({op:"getContentControlPlaceholderShown",contentControl:this.#i()}),i=>{this.setLoadedProperty("placeholderShown",ge(i,r));});}if(!t.includes("temporary"))return;let n=`${this.path.label}.temporary`;this.read(n,()=>({op:"getContentControlTemporary",contentControl:this.#i()}),r=>{this.setLoadedProperty("temporary",ge(r,n));});}#s(e,t){let n=A.promised(this.context,e,false);return this.read(e,()=>({op:"getContentControlRange",contentControl:this.#i(),location:t}),r=>{n.hydrateAddress({kind:"span",span:w(r,e)});}),n}#a(e,t){this.command(e,()=>({op:"setContentControlProperties",contentControl:this.#i(),...t}));}#d(e,t){let n=`${this.path.label}.${e}`;if(typeof t!="boolean"&&a({code:"InvalidArgument",target:n}),this.requireUsablePath(),this.#e){this.#e[e]=t;return}let r={[e]:t};this.#e=r,this.command(e,()=>({op:"setContentControlProperties",contentControl:this.#i(),...r}),()=>{this.#e===r&&(this.#e=void 0);});}#i(){return this.requireAddressable(),this.path.handle()}},N=class o extends k{#e;#t;static of(e,t,n,r){let i=typeof r=="function"?r:()=>r;return new o(e,u.derived(t,n),i,()=>({op:"getContentControls",scope:i()}))}constructor(e,t,n,r){super(e,t),this.#e=n,this.#t=r;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}getById(e){let t=`${this.path.label}.getById`;Number.isInteger(e)||a({code:"InvalidArgument",target:t});let n=this.#e,r=J.promised(this.context,t,false);return this.enqueue({sort:"read",label:t,plan:()=>({op:"getContentControlById",scope:n(),id:e}),settle:i=>{r.hydrateAddress({kind:"handle",handle:v(i,t)});}}),r}getByTag(e){let t=`${this.path.label}.getByTag`,n=gn(e,t),r=this.#e;return new o(this.context,u.derived(t,this.path),r,()=>({op:"getContentControlsByTag",scope:r(),tag:n}))}getByTitle(e){let t=`${this.path.label}.getByTitle`,n=gn(e,t),r=this.#e;return new o(this.context,u.derived(t,this.path),r,()=>({op:"getContentControlsByTitle",scope:r(),title:n}))}listing(){return this.#t()}itemAt(e,t){return J.at(this.context,e,t)}promised(e,t){return J.promised(this.context,e,t)}};function Lt(o,e){return (typeof o!="string"||o.length>fn)&&a({code:"InvalidArgument",target:e}),o}function gn(o,e){let t=Lt(o,e);return t.length===0&&a({code:"InvalidArgument",target:e}),t}function ho(o,e){switch(o){case "Whole":return "whole";case "Content":return "content";case "Start":return "start";case "End":return "end";case "Before":return "before";case "After":return "after";default:return a({code:"InvalidArgument",target:e})}}function po(o,e){(typeof o!="object"||o===null)&&a({code:"InvalidArgument",target:e});let t=o;if(t.kind==="text"||t.kind==="listItem"){let n=t.kind==="text"?t.text:t.value;return (typeof n!="string"||n.length>fn)&&a({code:"InvalidArgument",target:e}),t.kind==="text"?{kind:"text",text:n}:{kind:"listItem",value:n}}if(t.kind==="checkbox")return typeof t.checked!="boolean"&&a({code:"InvalidArgument",target:e}),{kind:"checkbox",checked:t.checked};if(t.kind==="date")return (typeof t.iso!="string"||t.iso.length>64)&&a({code:"InvalidArgument",target:e}),{kind:"date",iso:t.iso};a({code:"InvalidArgument",target:e});}var mo=8,Et=(d=>(d.custom="Custom",d.solid="Solid",d.hollow="Hollow",d.square="Square",d.diamonds="Diamonds",d.arrow="Arrow",d.checkmark="Checkmark",d))(Et||{}),Dt=(s=>(s.none="None",s.arabic="Arabic",s.upperRoman="UpperRoman",s.lowerRoman="LowerRoman",s.upperLetter="UpperLetter",s.lowerLetter="LowerLetter",s))(Dt||{}),W=class o extends p{#e;#t=new Map;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,u.of(t,n.handle),false)}static promised(e,t,n){return new o(e,u.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get id(){return this.loadedProperty("id")}get paragraphs(){return this.#e??=q.overListing(this.context,`${this.path.label}.paragraphs`,this.path,()=>({op:"getListParagraphs",list:this.#r()})),this.#e}getLevelParagraphs(e){let t=`${this.path.label}.getLevelParagraphs`,n=jt(e,t);return q.overListing(this.context,t,this.path,()=>({op:"getListParagraphs",list:this.#r(),level:n}))}insertParagraph(e,t){let n=`${this.path.label}.insertParagraph`,r=K(e,n);t!=="Start"&&t!=="End"&&t!=="Before"&&t!=="After"&&a({code:"InvalidArgument",target:n});let i=B.promised(this.context,n,false);return this.commandCreating(i,n,()=>({op:"insertListParagraph",list:this.#r(),where:t==="Start"||t==="Before"?"start":"end",text:r}),s=>{i.hydrateAddress({kind:"handle",handle:v(s,n)});}),i}setLevelBullet(e,t,n,r){this.#n(e,{bullet:t,...n===void 0?{}:{charCode:n},...r===void 0?{}:{fontName:r}});}setLevelNumbering(e,t,n){this.#n(e,{numbering:t,...n===void 0?{}:{formatString:[...n]}});}setLevelStartingNumber(e,t){this.#n(e,{startingNumber:t});}setLevelIndents(e,t,n){this.#n(e,{textIndent:t,bulletNumberPictureIndent:n});}#n(e,t){let n=`${this.path.label}.levelFormat`,r=jt(e,n);this.requireUsablePath();let i=this.#t.get(r);if(i){Object.assign(i,t),"bullet"in t&&(delete i.numbering,delete i.formatString),"numbering"in t&&(delete i.bullet,delete i.charCode,delete i.fontName);return}let s={...t};this.#t.set(r,s),this.commandAnswering(n,()=>({op:"setListLevelFormat",list:this.#r(),level:r,format:s}),d=>{R(d,n);},()=>{this.#t.get(r)===s&&this.#t.delete(r);});}onLoad(e){if(!this.selection(e,["id"]).includes("id"))return;let t=`${this.path.label}.id`;this.read(t,()=>({op:"getListId",list:this.#r()}),n=>{this.setLoadedProperty("id",ve(n,t));});}#r(){return this.requireAddressable(),this.path.handle()}},Le=class o extends k{#e;static of(e,t,n,r){return new o(e,u.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}getById(e){let t=`${this.path.label}.getById`,n=go(e,t),r=this.#e,i=W.promised(this.context,t,false);return this.enqueue({sort:"read",label:t,plan:()=>({op:"getListById",body:r,id:n}),settle:s=>{i.hydrateAddress({kind:"handle",handle:v(s,t)});}}),i}listing(){return {op:"getLists",body:this.#e}}itemAt(e,t){return W.at(this.context,e,t)}promised(e,t){return W.promised(this.context,e,t)}},je=class o extends p{static of(e,t,n){return new o(e,u.derived(t,n))}constructor(e,t){super(e,t);}get level(){return this.loadedProperty("level")}set level(e){let t=`${this.path.label}.level`,n=jt(e,t);this.commandAnswering(t,()=>({op:"setListLevel",paragraph:this.#e(),level:n}),r=>{R(r,t);});}onLoad(e){if(!this.selection(e,["level"]).includes("level"))return;let t=`${this.path.label}.level`;this.read(t,()=>({op:"getListLevel",paragraph:this.#e()}),n=>{this.setLoadedProperty("level",ve(n,t));});}#e(){this.requireAddressable();let e=this.path.address();return e.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.path.label}),e.handle}};function jt(o,e){return (!Number.isInteger(o)||o<0||o>mo)&&a({code:"InvalidArgument",target:e}),o}function go(o,e){return (!Number.isInteger(o)||o<=0)&&a({code:"InvalidArgument",target:e}),o}var Nt=(g=>(g.mixed="Mixed",g.none="None",g.hidden="Hidden",g.dotLine="DotLine",g.single="Single",g.word="Word",g.double="Double",g.thick="Thick",g.dotted="Dotted",g.dottedHeavy="DottedHeavy",g.dashLine="DashLine",g.dashLineHeavy="DashLineHeavy",g.dashLineLong="DashLineLong",g.dashLineLongHeavy="DashLineLongHeavy",g.dotDashLine="DotDashLine",g.dotDashLineHeavy="DotDashLineHeavy",g.twoDotDashLine="TwoDotDashLine",g.twoDotDashLineHeavy="TwoDotDashLineHeavy",g.wave="Wave",g.waveHeavy="WaveHeavy",g.waveDouble="WaveDouble",g))(Nt||{}),fo=["bold","italic","color","name","size","underline","strikeThrough","highlightColor","subscript","superscript"],X=class o extends p{#e;#t;static of(e,t,n,r){return new o(e,u.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}get bold(){return this.loadedProperty("bold")}set bold(e){this.#n("bold",_e(e,`${this.path.label}.bold`));}get italic(){return this.loadedProperty("italic")}set italic(e){this.#n("italic",_e(e,`${this.path.label}.italic`));}get color(){return this.loadedProperty("color")}set color(e){this.#n("color",dt(e,`${this.path.label}.color`));}get name(){return this.loadedProperty("name")}set name(e){this.#n("name",dt(e,`${this.path.label}.name`));}get size(){return this.loadedProperty("size")}set size(e){this.#n("size",bo(e,`${this.path.label}.size`));}get underline(){return this.loadedProperty("underline")}set underline(e){this.#n("underline",dt(e,`${this.path.label}.underline`));}get highlightColor(){return this.loadedProperty("highlightColor")}set highlightColor(e){this.#n("highlightColor",e===null?null:dt(e,`${this.path.label}.highlightColor`));}get strikeThrough(){return this.loadedProperty("strikeThrough")}set strikeThrough(e){this.#n("strikeThrough",_e(e,`${this.path.label}.strikeThrough`));}get subscript(){return this.loadedProperty("subscript")}set subscript(e){this.#n("subscript",_e(e,`${this.path.label}.subscript`));}get superscript(){return this.loadedProperty("superscript")}set superscript(e){this.#n("superscript",_e(e,`${this.path.label}.superscript`));}onLoad(e){let t=this.selection(e,fo);if(t.length===0)return;let n=`${this.path.label}.font`;this.read(n,()=>({op:"getFont",span:this.#r()}),r=>{let i=pt(r,n);for(let s of t)this.setLoadedProperty(s,i[s]);});}#n(e,t){if(this.requireUsablePath(),this.#t){this.#t[e]=t,e==="subscript"&&t===true&&(this.#t.superscript=false),e==="superscript"&&t===true&&(this.#t.subscript=false);return}let n={[e]:t};e==="subscript"&&t===true&&(n.superscript=false),e==="superscript"&&t===true&&(n.subscript=false),this.#t=n;let r=`${this.path.label}.${e}`;this.commandAnswering(this.path.label,()=>({op:"setFont",span:this.#r(),font:n}),i=>{R(i,r);},()=>{this.#t===n&&(this.#t=void 0);});}#r(){return this.requireAddressable(),I(this.path,this.#e)}};function _e(o,e){return typeof o!="boolean"&&a({code:"InvalidArgument",target:e}),o}function bo(o,e){return (typeof o!="number"||!Number.isFinite(o))&&a({code:"InvalidArgument",target:e}),o}function dt(o,e){return (typeof o!="string"||o.length===0)&&a({code:"InvalidArgument",target:e}),o}var yo=new Set(["matchCase","matchWholeWord","ignorePunct","ignoreSpace","matchWildcards"]);function Ee(o,e){if(o===void 0)return;typeof o!="object"&&a({code:"InvalidArgument",target:e});for(let[n,r]of Object.entries(o))yo.has(n)||a({code:"InvalidArgument",target:`${e}.${n}`}),r!==void 0&&typeof r!="boolean"&&a({code:"InvalidArgument",target:`${e}.${n}`});let t={...o.matchCase===void 0?{}:{matchCase:o.matchCase},...o.matchWholeWord===void 0?{}:{matchWholeWord:o.matchWholeWord},...o.ignorePunct===void 0?{}:{ignorePunct:o.ignorePunct},...o.ignoreSpace===void 0?{}:{ignoreSpace:o.ignoreSpace},...o.matchWildcards===void 0?{}:{matchWildcards:o.matchWildcards}};return Object.keys(t).length===0?void 0:t}var xo=32,vo=32;function lt(o,e){(!Array.isArray(o)||o.length===0||o.length>xo)&&a({code:"InvalidArgument",target:e});for(let t of o)(typeof t!="string"||t.length===0||t.length>vo||Ro(t))&&a({code:"InvalidArgument",target:e});return [...o]}function Ro(o){for(let e=0;e<o.length;e+=1){let t=o.charCodeAt(e);if(t>=55296&&t<=56319){let n=o.charCodeAt(e+1);if(!(n>=56320&&n<=57343))return true;e+=1;}else if(t>=56320&&t<=57343)return true}return false}function ct(o,e){return o!==void 0&&typeof o!="boolean"&&a({code:"InvalidArgument",target:e}),o===true}function ut(o,e){if(o===void 0||o==="Current")return "current";if(o==="Original")return "original";a({code:"InvalidArgument",target:e});}function bn(o,e){return o===void 0?"Whole":(o==="After"&&a({code:"NotSupported",target:e}),o!=="Whole"&&o!=="Start"&&o!=="End"&&o!=="Content"&&a({code:"InvalidArgument",target:e}),o)}var Ao=16,B=class o extends p{#e;#t;#n;#r;#s;#a;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,u.of(t,n.handle),false)}static promised(e,t,n){return new o(e,u.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get text(){return this.loadedProperty("text")}get contentControls(){return this.requireUsablePath(),this.#a??=N.of(this.context,`${this.path.label}.contentControls`,this.path,()=>({span:{paragraph:this.#o()}})),this.#a}get uniqueLocalId(){return this.loadedProperty("uniqueLocalId")}get style(){return this.loadedProperty("style")}set style(e){this.#d("style",Pe(e,`${this.path.label}.style`));}get shapes(){return this.#t??=ne.of(this.context,`${this.path.label}.shapes`,this.path,"paragraph"),this.#t}get font(){return this.#e??=X.of(this.context,`${this.path.label}.font`,this.path,"paragraph"),this.#e}get alignment(){return this.loadedProperty("alignment")}set alignment(e){this.#d("alignment",Po(e,`${this.path.label}.alignment`));}get readingOrder(){return this.loadedProperty("readingOrder")}set readingOrder(e){this.#d("readingOrder",Oo(e,`${this.path.label}.readingOrder`));}get firstLineIndent(){return this.loadedProperty("firstLineIndent")}set firstLineIndent(e){this.#d("firstLineIndent",De(e,`${this.path.label}.firstLineIndent`));}get leftIndent(){return this.loadedProperty("leftIndent")}set leftIndent(e){this.#d("leftIndent",De(e,`${this.path.label}.leftIndent`));}get rightIndent(){return this.loadedProperty("rightIndent")}set rightIndent(e){this.#d("rightIndent",De(e,`${this.path.label}.rightIndent`));}get lineSpacing(){return this.loadedProperty("lineSpacing")}set lineSpacing(e){this.#d("lineSpacing",De(e,`${this.path.label}.lineSpacing`));}get spaceBefore(){return this.loadedProperty("spaceBefore")}set spaceBefore(e){this.#d("spaceBefore",De(e,`${this.path.label}.spaceBefore`));}get spaceAfter(){return this.loadedProperty("spaceAfter")}set spaceAfter(e){this.#d("spaceAfter",De(e,`${this.path.label}.spaceAfter`));}get list(){return this.#n??=this.#i(`${this.path.label}.list`),this.#n}getRange(e="Whole"){let t=`${this.path.label}.getRange`;["Whole","Content","Start","End","Before","After"].includes(e)||a({code:"InvalidArgument",target:t});let n=A.promised(this.context,t,false);return this.read(t,()=>({op:"getRange",span:{paragraph:this.#o()},location:e}),r=>{n.hydrateAddress({kind:"span",span:w(r,t)});}),n}search(e,t){let n=`${this.path.label}.search`;typeof e!="string"&&a({code:"InvalidArgument",target:n});let r=Ee(t,n);return this.requireUsablePath(),$.of(this.context,n,this.path,()=>({op:"search",scope:{paragraph:this.#o()},text:e,options:{...r??{},projection:this.revisionTextView()}}))}getTextRanges(e,t){let n=`${this.path.label}.getTextRanges`,r=lt(e,n),i=ct(t,n);return this.requireUsablePath(),$.of(this.context,n,this.path,()=>({op:"getTextRanges",scope:{paragraph:this.#o()},endingMarks:r,...i?{trimSpacing:true}:{},projection:this.revisionTextView()}))}getReviewedText(e){let t=`${this.path.label}.getReviewedText`,n=ut(e,t);this.requireUsablePath();let{result:r,fill:i}=G(t);return this.read(t,()=>({op:"getReviewedText",span:{paragraph:this.#o()},version:n}),s=>i(P(s,t))),r}startNewList(){let e=`${this.path.label}.startNewList`,t=W.promised(this.context,e,false);return this.commandCreating(t,e,()=>({op:"startNewList",paragraph:this.#o()}),n=>{t.hydrateAddress({kind:"handle",handle:v(n,e)});}),t}attachToList(e,t){let n=`${this.path.label}.attachToList`;(!Number.isSafeInteger(e)||e<=0||!Number.isInteger(t)||t<0||t>8)&&a({code:"InvalidArgument",target:n});let r=W.promised(this.context,n,false);return this.commandCreating(r,n,()=>({op:"attachToList",paragraph:this.#o(),listId:e,level:t}),i=>{r.hydrateAddress({kind:"handle",handle:v(i,n)});}),r}detachFromList(){let e=`${this.path.label}.detachFromList`;this.commandAnswering(e,()=>({op:"detachFromList",paragraph:this.#o()}),t=>{R(t,e);});}get listItem(){return this.#r??=je.of(this.context,`${this.path.label}.listItem`,this.path),this.#r}clear(){this.commandDiscarding("clear",()=>({op:"replaceSpan",span:{paragraph:this.#o()},text:""}));}delete(){let e=`${this.path.label}.delete`;this.commandAnswering(e,()=>({op:"deleteParagraph",paragraph:this.#o()}),t=>{t.kind!=="applied"&&t.kind!=="span"&&a({code:"GeneralException",target:e});});}insertText(e,t){let n=`${this.path.label}.insertText`,r=Se(e,n),i=ln(t,n),s=A.promised(this.context,n,false);return this.commandCreating(s,n,()=>i==="Replace"?{op:"replaceSpan",span:{paragraph:this.#o()},text:r}:{op:"insertText",at:{paragraph:this.#o(),at:i==="Start"?"start":"end"},text:r},d=>{s.hydrateAddress({kind:"span",span:w(d,n)});}),s}insertTable(e,t,n,r){let i=`${this.path.label}.insertTable`;n!=="Before"&&n!=="After"&&a({code:"InvalidArgument",target:i}),this.requireUsablePath();let{table:s,plan:d,settle:l}=Te(this.context,i,()=>I(this.path,"paragraph"),n,e,t,r);return this.commandCreating(s,i,d,l),s}insertParagraph(e,t){let n=`${this.path.label}.insertParagraph`,r=K(e,n),i=cn(t,n),s=o.promised(this.context,n,false);return this.commandCreating(s,n,()=>({op:"insertParagraph",anchor:{paragraph:this.#o()},where:i==="Before"?"before":"after",text:r}),d=>{d.kind!=="handle"&&a({code:"GeneralException",target:n}),s.hydrateAddress({kind:"handle",handle:d.handle});}),s}split(e,t,n){let r=`${this.path.label}.split`,i=wo(e,r),s=xn(t,`${r}.trimDelimiters`),d=xn(n,`${r}.trimSpacing`),l=$.answered(this.context,r,this.path);return this.commandAnswering(r,()=>({op:"splitParagraph",paragraph:this.#o(),delimiters:i,...s?{trimDelimiters:true}:{},...d?{trimSpacing:true}:{}}),h=>{l.fill(h,r);}),l}onLoad(e){let t=this.selection(e,["text","uniqueLocalId",...yn]);t.includes("text")&&this.loadTextInto("text",()=>({op:"getText",target:this.#o(),projection:this.revisionTextView()})),t.includes("uniqueLocalId")&&this.loadTextInto("uniqueLocalId",()=>({op:"getParagraphId",paragraph:this.#o()}));let n=yn.filter(i=>t.includes(i));if(n.length===0)return;let r=`${this.path.label}.paragraphFormat`;this.read(r,()=>({op:"getParagraphFormat",paragraph:{paragraph:this.#o()}}),i=>{let s=mt(i,r);for(let d of n)this.setLoadedProperty(d,s[d]);});}#d(e,t){if(this.requireUsablePath(),this.#s){this.#s[e]=t;return}let n={[e]:t};this.#s=n;let r=`${this.path.label}.${e}`;this.commandAnswering(`${this.path.label}.paragraphFormat`,()=>({op:"setParagraphFormat",paragraph:{paragraph:this.#o()},format:n}),i=>{R(i,r);},()=>{this.#s===n&&(this.#s=void 0);});}#i(e){let t=W.promised(this.context,e,false);return this.read(e,()=>({op:"getParagraphList",paragraph:this.#o()}),n=>{t.hydrateAddress({kind:"handle",handle:v(n,e)});}),t}#o(){return this.requireAddressable(),this.path.handle()}},yn=["style","alignment","firstLineIndent","leftIndent","rightIndent","lineSpacing","spaceBefore","spaceAfter","readingOrder"],Co=["Left","Centered","Right","Justified"];function Po(o,e){return Co.includes(o)||a({code:"InvalidArgument",target:e}),o}function Oo(o,e){return o!=="LeftToRight"&&o!=="RightToLeft"&&a({code:"InvalidArgument",target:e}),o}function De(o,e){return (typeof o!="number"||!Number.isFinite(o))&&a({code:"InvalidArgument",target:e}),o}function wo(o,e){(!Array.isArray(o)||o.length===0||o.length>Ao)&&a({code:"InvalidArgument",target:e});for(let t of o)(typeof t!="string"||t.length===0)&&a({code:"InvalidArgument",target:e});return [...o]}function xn(o,e){return o!==void 0&&typeof o!="boolean"&&a({code:"InvalidArgument",target:e}),o===true}var q=class o extends M{#e;static of(e,t,n){return new o(e,u.derived(t,n),null)}static overListing(e,t,n,r){return new o(e,u.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}getLast(){return this.edge("last","getLast",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}getLastOrNullObject(){return this.edge("last","getLastOrNullObject",true)}listing(){if(this.#e)return this.#e();let e=this.path.address();return e.kind==="fieldResult"&&U(this.path.label),e.kind==="handle"?{op:"getParagraphs",body:e.handle}:{op:"getSpanParagraphs",span:e.span}}size(e,t){return O(e,t).length}addressAt(e,t,n){let r=O(e,t)[n];return r?{kind:"handle",handle:r}:void 0}itemAt(e,t){return B.at(this.context,e,t)}promised(e,t){return B.promised(this.context,e,t)}},$=class o extends M{#e;static of(e,t,n,r){return new o(e,u.derived(t,n),r)}static answered(e,t,n){return new o(e,u.derived(t,n),null)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}getLast(){return this.edge("last","getLast",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}listing(){return this.#e?this.#e():null}size(e,t){return te(e,t).length}addressAt(e,t,n){let r=te(e,t)[n];return r?{kind:"span",span:r}:void 0}itemAt(e,t){return A.at(this.context,e,t)}promised(e,t){return A.promised(this.context,e,t)}};var Ne=class o extends p{#e;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,u.of(t,n.handle),false)}static promised(e,t,n){return new o(e,u.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get name(){return this.loadedProperty("name")}get range(){return this.#e??=this.#t(`${this.path.label}.range`),this.#e}select(e){let t=`${this.path.label}.select`,n=at(e,t);this.requireUsablePath(),this.internals.capabilities.selection||a({code:"NotSupported",target:t}),this.command("select",()=>({op:"selectBookmark",bookmark:this.#n(),mode:n==="Select"?"select":n==="Start"?"start":"end"}));}delete(){this.requireUsablePath(),this.command("delete",()=>({op:"deleteBookmark",target:{bookmark:this.#n()}}));}onLoad(e){if(!this.selection(e,["name"]).includes("name"))return;let t=`${this.path.label}.name`;this.read(t,()=>({op:"getBookmarkName",bookmark:this.#n()}),n=>{this.setLoadedProperty("name",P(n,t));});}#t(e){let t=A.promised(this.context,e,false);return this.read(e,()=>({op:"getBookmarkRange",bookmark:this.#n()}),n=>{t.hydrateAddress({kind:"span",span:w(n,e)});}),t}#n(){return this.requireAddressable(),this.path.handle()}},de=class o extends k{#e;static of(e,t,n,r){return new o(e,u.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}listing(){return this.#e()}itemAt(e,t){return Ne.at(this.context,e,t)}promised(e,t){return Ne.promised(this.context,e,t)}};function ko(o,e){return e<1||e>12?0:e===2?o%4===0&&o%100!==0||o%400===0?29:28:e===4||e===6||e===9||e===11?30:31}function vn(o){if(o.length===0)return null;let e=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,9}))?(Z|[+-]\d{2}:\d{2})$/.exec(o.trim());if(!e)return null;let t=Number(e[1]),n=Number(e[2]),r=Number(e[3]),i=ko(t,n);if(t===0||i===0||r<1||r>i)return null;let s=Number(e[4]),d=Number(e[5]),l=Number(e[6]);if(s>23||d>59||l>59)return null;let h=e[7],y=h===void 0?0:Number(h.padEnd(3,"0").slice(0,3));if(Number.isNaN(y))return null;let m=`${e[1]}-${e[2]}-${e[3]}T${e[4]}:${e[5]}:${e[6]}.${String(y).padStart(3,"0")}Z`,b=Date.parse(m);if(Number.isNaN(b))return null;let j=e[8];if(j==="Z")return new Date(b);let H=Number(j.slice(1,3)),ee=Number(j.slice(4,6));if(ee>59||H>14||H===14&&ee!==0)return null;let xe=j[0]==="+"?1:-1,Ve=new Date(b-xe*(H*36e5+ee*6e4));return Number.isNaN(Ve.getTime())?null:Ve}var ht=class extends p{hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get authorName(){return this.loadedProperty("authorName")}get creationDate(){return this.loadedProperty("creationDate")}get id(){return this.loadedProperty("id")}get content(){return this.loadedProperty("content")}set content(e){let t=`${this.path.label}.content`;(typeof e!="string"||e.length===0)&&a({code:"InvalidArgument",target:t});let n=this.internals.author;(typeof n!="string"||n.trim().length===0)&&a({code:"NotSupported",target:t,diagnostic:"edit.comment-author-required"}),this.commandAnswering(t,()=>({op:"setCommentText",comment:this.commentHandle(),text:e,author:n}),r=>R(r,t));}get text(){return this.loadedProperty("text")}delete(){this.command("delete",()=>({op:"deleteComment",comment:this.commentHandle()}));}loadCommentFields(e,t){let n=this.selection(e,["authorName","creationDate","id","text","content",...t]);if(n.includes("authorName")&&this.loadTextInto("authorName",()=>({op:"getCommentAuthor",comment:this.commentHandle()})),n.includes("content")&&this.loadTextInto("content",()=>({op:"getCommentText",comment:this.commentHandle()})),n.includes("text")&&this.loadTextInto("text",()=>({op:"getCommentText",comment:this.commentHandle()})),n.includes("id")&&this.loadTextInto("id",()=>({op:"getCommentId",comment:this.commentHandle()})),n.includes("creationDate")){let i=`${this.path.label}.creationDate`;this.read(i,()=>({op:"getCommentDate",comment:this.commentHandle()}),s=>{this.setLoadedProperty("creationDate",vn(P(s,i)));});}if(!n.includes("resolved"))return;let r=`${this.path.label}.resolved`;this.read(r,()=>({op:"getCommentResolved",comment:this.commentHandle()}),i=>{this.setLoadedProperty("resolved",ge(i,r));});}commentHandle(){return this.requireAddressable(),this.path.handle()}},ye=class o extends ht{static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,u.of(t,n.handle),false)}static promised(e,t,n){return new o(e,u.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}onLoad(e){this.loadCommentFields(e,[]);}},et=class o extends k{#e;static of(e,t,n,r){return new o(e,u.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#e()}itemAt(e,t){return ye.at(this.context,e,t)}promised(e,t){return ye.promised(this.context,e,t)}},le=class o extends ht{#e;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,u.of(t,n.handle),false)}static promised(e,t,n){return new o(e,u.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}get resolved(){return this.loadedProperty("resolved")}set resolved(e){let t=`${this.path.label}.resolved`;typeof e!="boolean"&&a({code:"InvalidArgument",target:t}),this.commandAnswering(t,()=>({op:"setCommentResolved",comment:this.commentHandle(),resolved:e}),n=>{R(n,t);});}get replies(){return this.#e??=et.of(this.context,`${this.path.label}.replies`,this.path,()=>({op:"getCommentReplies",comment:this.commentHandle()})),this.#e}getRange(){let e=`${this.path.label}.getRange`,t=A.promised(this.context,e,false);return this.read(e,()=>({op:"getCommentRange",comment:this.commentHandle()}),n=>{t.hydrateAddress({kind:"span",span:w(n,e)});}),t}reply(e){let t=`${this.path.label}.reply`;(typeof e!="string"||e.length===0)&&a({code:"InvalidArgument",target:t});let n=this.internals.author;(typeof n!="string"||n.trim().length===0)&&a({code:"NotSupported",target:t,diagnostic:"edit.comment-author-required"});let r=ye.promised(this.context,t,false);return this.commandCreating(r,t,()=>({op:"replyToComment",comment:this.commentHandle(),text:e,author:n}),i=>{r.hydrateAddress({kind:"handle",handle:v(i,t)});}),r}onLoad(e){this.loadCommentFields(e,["resolved"]);}},ce=class o extends k{#e;static of(e,t,n,r){return new o(e,u.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#e()}itemAt(e,t){return le.at(this.context,e,t)}promised(e,t){return le.promised(this.context,e,t)}},_=class o extends p{static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,u.of(t,n.handle),false)}static promised(e,t,n){return new o(e,u.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get author(){return this.loadedProperty("author")}get date(){return this.loadedProperty("date")}get type(){return this.loadedProperty("type")}get range(){if(this.#e)return this.#e;let e=`${this.path.label}.range`,t=A.promised(this.context,e,false);return this.read(e,()=>({op:"getRevisionRange",revision:this.#t()}),n=>{t.hydrateAddress({kind:"span",span:w(n,e)});}),this.#e=t,t}#e;accept(){this.command("accept",()=>({op:"acceptRevision",revision:this.#t()}));}reject(){this.command("reject",()=>({op:"rejectRevision",revision:this.#t()}));}onLoad(e){let t=this.selection(e,["author","date","type"]);if(t.includes("author")&&this.loadTextInto("author",()=>({op:"getRevisionAuthor",revision:this.#t()})),t.includes("type")&&this.loadTextInto("type",()=>({op:"getRevisionType",revision:this.#t()})),!t.includes("date"))return;let n=`${this.path.label}.date`;this.read(n,()=>({op:"getRevisionDate",revision:this.#t()}),r=>{this.setLoadedProperty("date",vn(P(r,n)));});}static batchHandle(e,t,n="RevisionCollection.resolve"){return (!(e instanceof o)||e.context!==t)&&a({code:"InvalidArgument",target:n}),e.#t()}#t(){return this.requireAddressable(),this.path.handle()}},F=class o extends k{#e;static of(e,t,n,r){return new o(e,u.derived(t,n),{body:r})}static inSpan(e,t,n,r){return new o(e,u.derived(t,n),{span:r})}static ofReviewKey(e,t,n,r){return new o(e,u.derived(t,n),{key:r})}constructor(e,t,n){super(e,t),this.#e=n;}acceptAll(){this.commandOn("acceptAll",()=>this.#t("acceptAllRevisions"));}rejectAll(){this.commandOn("rejectAll",()=>this.#t("rejectAllRevisions"));}#t(e){return {op:e,...this.#n()}}#n(){let e=this.#e;return "span"in e?{scope:e.span()}:"key"in e?{key:e.key}:{body:e.body()}}#r(e){let t=this.#e;return "body"in t||a({code:"NotSupported",target:`${this.path.label}.${e}`}),t.body}resolve(e,t){let n=`${this.path.label}.resolve`;(!["accept","reject"].includes(e)||t!==void 0&&!Array.isArray(t))&&a({code:"InvalidArgument",target:n});let r=this.#r("resolve"),i=t===void 0?void 0:[...t],{result:s,fill:d}=G(n);return this.enqueue({sort:"write",label:n,plan:()=>({op:"resolveRevisionBatch",body:r(),action:e,...i===void 0?{}:{revisions:i.map(l=>_.batchHandle(l,this.context))}}),settle:l=>{l.kind!=="revisionBatch"&&a({code:"GeneralException",target:n}),d(l.result);}}),s}setAuthor(e,t,n){let r=`${this.path.label}.setAuthor`,i=n?.date,s=Array.isArray(t)?t:void 0,d=t!==void 0&&!Array.isArray(t)?t?.authors:void 0;(typeof e!="string"||e.trim().length===0||t!==void 0&&!Array.isArray(t)&&(typeof t!="object"||t===null||!Array.isArray(d)||d.some(b=>typeof b!="string"))||n!==void 0&&(typeof n!="object"||n===null)||i!==void 0&&(!(i instanceof Date)||Number.isNaN(i.getTime()))||s?.some(b=>!(b instanceof _)||b.context!==this.context))&&a({code:"InvalidArgument",target:r});let l=this.#r("setAuthor"),h=s===void 0?void 0:[...s],{result:y,fill:m}=G(r);return this.enqueue({sort:"write",label:r,plan:()=>({op:"setRevisionAuthorBatch",body:l(),author:e,...i===void 0?{}:{date:`${i.toISOString().slice(0,19)}Z`},...d===void 0?{}:{authors:[...d]},...h===void 0?{}:{revisions:h.map(b=>_.batchHandle(b,this.context,r))}}),settle:b=>{b.kind!=="revisionAuthors"&&a({code:"GeneralException",target:r}),m(b.result);}}),y}listing(){return {op:"getRevisions",...this.#n()}}itemAt(e,t){return _.at(this.context,e,t)}promised(e,t){return _.promised(this.context,e,t)}commandOn(e,t){let n=`${this.path.label}.${e}`;this.enqueue({sort:"write",label:n,plan:t,settle:r=>{R(r,n);}});}};var A=class o extends p{#e;#t;#n;#r;#s;#a;#d;#i;static at(e,t,n){return n.kind!=="span"&&a({code:"InvalidObjectPath",target:t}),new o(e,u.ofSpan(t,n.span),false)}static promised(e,t,n){return new o(e,u.pending(t),n)}static ofFieldResult(e,t,n){return new o(e,u.fieldResult(t,n),false)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="span"?this.path.resolveToSpan(e.span):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get text(){return this.loadedProperty("text")}get font(){return this.#s??=X.of(this.context,`${this.path.label}.font`,this.path,"span"),this.#s}get paragraphs(){return this.#r??=q.of(this.context,`${this.path.label}.paragraphs`,this.path),this.#r}get style(){return this.loadedProperty("style")}set style(e){let t=`${this.path.label}.style`,n=Pe(e,t);this.requireAddressable(),this.command("style",()=>({op:"setStyle",span:I(this.path,"span"),name:n}));}get hyperlink(){return this.loadedProperty("hyperlink")}set hyperlink(e){let t=`${this.path.label}.hyperlink`;(typeof e!="string"||e.length>2048)&&a({code:"InvalidArgument",target:t}),this.requireUsablePath(),this.command("hyperlink",()=>({op:"setHyperlink",span:this.#o(),target:e}));}get contentControls(){return this.requireUsablePath(),this.#i??=N.of(this.context,`${this.path.label}.contentControls`,this.path,()=>({span:this.#o()})),this.#i}get bookmarks(){let e=this.#o();return this.#a??=de.of(this.context,`${this.path.label}.bookmarks`,this.path,()=>({op:"getBookmarks",scope:{start:e.start,end:e.end}})),this.#a}insertBookmark(e){let t=`${this.path.label}.insertBookmark`;this.requireUsablePath(),this.command("insertBookmark",()=>((typeof e!="string"||e.length===0)&&a({code:"InvalidArgument",target:t}),{op:"insertBookmark",span:this.#o(),name:e}));}getBookmarks(e,t){let n=`${this.path.label}.getBookmarks`,{result:r,fill:i}=G(n);return this.read(n,()=>((e!==void 0&&typeof e!="boolean"||t!==void 0&&typeof t!="boolean")&&a({code:"InvalidArgument",target:n}),{op:"getBookmarkNames",scope:this.#o(),includeHidden:e===true,includeAdjacent:t===true}),s=>{s.kind!=="texts"&&a({code:"GeneralException",target:n}),i([...s.texts]);}),r}get revisions(){return this.#d??=F.inSpan(this.context,`${this.path.label}.revisions`,this.path,()=>I(this.path,"span")),this.#d}search(e,t){let n=`${this.path.label}.search`;typeof e!="string"&&a({code:"InvalidArgument",target:n});let r=Ee(t,n),i=this.#o();return $.of(this.context,n,this.path,()=>({op:"search",scope:i,text:e,options:{...r??{},projection:this.revisionTextView()}}))}getTextRanges(e,t){let n=`${this.path.label}.getTextRanges`,r=lt(e,n),i=ct(t,n);return this.requireUsablePath(),$.of(this.context,n,this.path,()=>({op:"getTextRanges",scope:this.#o(),endingMarks:r,...i?{trimSpacing:true}:{},projection:this.revisionTextView()}))}expandTo(e){let t=`${this.path.label}.expandTo`;(!(e instanceof o)||e.context!==this.context)&&a({code:"InvalidArgument",target:t}),this.requireUsablePath(),e.requireUsablePath();let n=o.promised(this.context,t,false);return this.enqueue({sort:"read",label:t,dependencies:[e.path],plan:()=>({op:"expandSpan",span:this.#o(),to:e.#o()}),settle:r=>{n.hydrateAddress({kind:"span",span:w(r,t)});}}),n}getRange(e){let t=`${this.path.label}.getRange`,n=bn(e,t);this.requireUsablePath();let r=o.promised(this.context,t,false);return this.read(t,()=>({op:"getRange",span:this.#o(),location:n}),i=>{r.hydrateAddress({kind:"span",span:w(i,t)});}),r}getReviewedText(e){let t=`${this.path.label}.getReviewedText`,n=ut(e,t);this.requireUsablePath();let{result:r,fill:i}=G(t);return this.read(t,()=>({op:"getReviewedText",span:this.#o(),version:n}),s=>i(P(s,t))),r}insertText(e,t){let n=`${this.path.label}.insertText`;if(this.path.isFieldResult)return this.requireUsablePath(),this.command("insertText",pn(this.path,e,t,n)),o.ofFieldResult(this.context,n,this.path);let r=Se(e,n),i=oe(t,n);this.requireUsablePath();let s=o.promised(this.context,n,false);return this.commandCreating(s,n,()=>{let d=this.#o();return i==="Replace"?{op:"replaceSpan",span:d,text:r}:{op:"insertText",at:i==="Start"||i==="Before"?d.start:d.end,text:r}},d=>{s.hydrateAddress({kind:"span",span:w(d,n)});}),s}delete(){this.requireUsablePath(),this.commandDiscarding("delete",()=>({op:"replaceSpan",span:this.#o(),text:""}));}clear(){let e=this.#o();this.commandDiscarding("clear",()=>({op:"replaceSpan",span:e,text:""}));}insertComment(e){let t=`${this.path.label}.insertComment`;(typeof e!="string"||e.length===0)&&a({code:"InvalidArgument",target:t});let n=this.internals.author;(typeof n!="string"||n.trim().length===0)&&a({code:"NotSupported",target:t,diagnostic:"edit.comment-author-required"});let r=le.promised(this.context,t,false);return this.commandCreating(r,t,()=>({op:"insertComment",span:this.#o(),text:e,author:n}),i=>{i.kind!=="handle"&&a({code:"GeneralException",target:t}),r.hydrateAddress(i);}),r}insertContentControl(e){let t=`${this.path.label}.insertContentControl`,n=e??"RichText";n!=="RichText"&&n!=="PlainText"&&n!=="DatePicker"&&a({code:"NotSupported",target:t});let r=J.promised(this.context,t,false);return this.commandCreating(r,t,()=>({op:"insertContentControl",span:this.#o(),subtype:n==="DatePicker"?"date":n==="PlainText"?"plainText":"richText",returnHandle:true}),i=>{i.kind!=="handle"&&a({code:"GeneralException",target:t}),r.hydrateAddress(i);}),r}get tables(){return this.requireUsablePath(),this.#e??=ae.over(this.context,`${this.path.label}.tables`,this.path,()=>I(this.path,"span"))}get fields(){return this.requireUsablePath(),this.#t??=he.of(this.context,`${this.path.label}.fields`,this.path,"span")}insertField(e,t,n,r){let i=`${this.path.label}.insertField`;(t!==void 0&&typeof t!="string"||n!==void 0&&typeof n!="string"||r!==void 0&&typeof r!="boolean")&&a({code:"InvalidArgument",target:i});let s=oe(e,i);this.requireUsablePath();let d=ue.promised(this.context,i,false);return this.commandCreating(d,i,()=>({op:"insertField",span:this.#o(),location:s,...t===void 0?{}:{fieldType:t},...n===void 0?{}:{text:n},...r===void 0?{}:{removeFormatting:r}}),l=>d.hydrateAddress({kind:"handle",handle:v(l,i)})),d}insertOoxml(e,t){let n=`${this.path.label}.insertOoxml`;typeof e!="string"&&a({code:"InvalidArgument",target:n});let r=oe(t,n);this.requireUsablePath();let i=o.promised(this.context,n,false);return this.commandCreating(i,n,()=>({op:"insertOoxml",span:this.#o(),location:r,ooxml:e}),s=>i.hydrateAddress({kind:"span",span:w(s,n)})),i}get inlinePictures(){return this.requireUsablePath(),this.#n??=ie.of(this.context,`${this.path.label}.inlinePictures`,this.path,"span")}insertInlinePictureFromBase64(e,t){let n=`${this.path.label}.insertInlinePictureFromBase64`;(typeof e!="string"||e.length===0)&&a({code:"InvalidArgument",target:n});let r=oe(t,n);this.requireUsablePath();let i=re.promised(this.context,n,false);return this.commandCreating(i,n,()=>({op:"insertInlinePicture",span:this.#o(),base64:e,location:r}),s=>{i.hydrateAddress({kind:"handle",handle:v(s,n)});}),i}insertBreak(e,t){let n=`${this.path.label}.insertBreak`;t!=="Before"&&t!=="After"&&a({code:"InvalidArgument",target:n}),this.requireUsablePath(),this.commandAnswering(n,()=>({op:"insertBreak",span:this.#o(),breakType:e,location:t}),r=>R(r,n));}insertTable(e,t,n,r){let i=`${this.path.label}.insertTable`;n!=="Before"&&n!=="After"&&a({code:"InvalidArgument",target:i});let{table:s,plan:d,settle:l}=Te(this.context,i,()=>I(this.path,"span"),n,e,t,r);return this.commandCreating(s,i,d,l),s}insertParagraph(e,t){let n=`${this.path.label}.insertParagraph`,r=K(e,n),i=oe(t,n);i!=="Before"&&i!=="After"&&a({code:"InvalidArgument",target:n});let s=this.#o(),d=i==="Before"?s.start.paragraph:s.end.paragraph,l=B.promised(this.context,n,false);return this.commandCreating(l,n,()=>({op:"insertParagraph",anchor:{paragraph:d},where:i==="Before"?"before":"after",text:r}),h=>{h.kind!=="handle"&&a({code:"GeneralException",target:n}),l.hydrateAddress({kind:"handle",handle:h.handle});}),l}select(e){let t=`${this.path.label}.select`,n=at(e,t);this.requireAddressable(),this.internals.capabilities.selection||a({code:"NotSupported",target:t});let r=this.#o();this.command("select",()=>({op:"selectSpan",span:r,mode:n==="Select"?"select":n==="Start"?"start":"end"}));}onLoad(e){let t=this.path.isFieldResult&&e.select.length===0?["text"]:this.selection(e,["text","style","hyperlink"]);if(t.includes("hyperlink")&&this.loadTextInto("hyperlink",()=>({op:"getHyperlink",span:this.#o()})),t.includes("text")){let r=`${this.path.label}.text`;this.read(r,this.path.isFieldResult?hn(this.path,this.revisionTextView()):()=>({op:"getSpanText",span:this.#o(),projection:this.revisionTextView()}),i=>{this.setLoadedProperty("text",P(i,r));});}if(!t.includes("style"))return;let n=`${this.path.label}.style`;this.requireUsablePath(),this.read(n,()=>({op:"getStyle",span:I(this.path,"span")}),r=>{this.setLoadedProperty("style",ze(r,n));});}#o(){return this.path.isFieldResult&&U(this.path.label),this.requireAddressable(),this.path.span()}};var ue=class o extends p{#e;#t;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,u.of(t,n.handle),false)}static promised(e,t,n){return new o(e,u.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get code(){return this.loadedProperty("code")}get result(){return this.requireUsablePath(),this.#t??=A.ofFieldResult(this.context,`${this.path.label}.result`,this.path)}set code(e){if(this.requireUsablePath(),(typeof e!="string"||e.length===0)&&a({code:"InvalidArgument",target:`${this.path.label}.code`}),this.#e){this.#e.code=e;return}let t={code:e};this.#e=t,this.commandAnswering(`${this.path.label}.code`,()=>({op:"setFieldCode",field:this.#r(),code:t.code}),n=>R(n,`${this.path.label}.code`),()=>{this.#e===t&&(this.#e=void 0);});}delete(){this.#n("deleteField");}updateResult(){this.#n("updateFieldResult");}#n(e){this.requireUsablePath(),this.commandAnswering(`${this.path.label}.${e==="deleteField"?"delete":"updateResult"}`,()=>({op:e,field:this.#r()}),t=>R(t,this.path.label));}onLoad(e){let t=e.select.length===0?["code"]:this.selection(e,["code","result"]);t.includes("result")&&this.result.load("text"),t.includes("code")&&this.read(this.path.label,()=>({op:"getField",field:this.#r()}),n=>{n.kind!=="field"&&a({code:"GeneralException",target:this.path.label}),this.setLoadedProperty("code",n.field.code);});}#r(){this.requireAddressable();let e=this.path.address();return e.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.path.label}),e.handle}},he=class o extends M{#e;static of(e,t,n,r){return new o(e,u.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}getLast(){return this.edge("last","getLast",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}getLastOrNullObject(){return this.edge("last","getLastOrNullObject",true)}listing(){return {op:"getFields",span:I(this.path,this.#e)}}size(e,t){return O(e,t).length}addressAt(e,t,n){let r=O(e,t)[n];return r?{kind:"handle",handle:r}:void 0}itemAt(e,t){return ue.at(this.context,e,t)}promised(e,t){return ue.promised(this.context,e,t)}};var E=class o extends p{#e;#t;get footnotes(){return this.#e??=Q.of(this.context,`${this.path.label}.footnotes`,this.path,()=>({op:"getNotes",document:this.internals.roots().document,scope:this.#l(),noteKind:"footnote"}))}get endnotes(){return this.#t??=Q.of(this.context,`${this.path.label}.endnotes`,this.path,()=>({op:"getNotes",document:this.internals.roots().document,scope:this.#l(),noteKind:"endnote"}))}#n;#r;#s;#a;#d;#i;#o;#c;#u;#h;static main(e,t){return new o(e,u.of(t,Y(e).roots().body))}static promisedStory(e,t){return new o(e,u.pending(t))}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}constructor(e,t){super(e,t);}get text(){return this.loadedProperty("text")}get paragraphs(){return this.#d??=this.paragraphsUnder(`${this.path.label}.paragraphs`),this.#d}get bookmarks(){let e=this.#l();return this.#i??=de.of(this.context,`${this.path.label}.bookmarks`,this.path,()=>({op:"getBookmarks",scope:{body:e}})),this.#i}get font(){return this.#o??=X.of(this.context,`${this.path.label}.font`,this.path,"body"),this.#o}paragraphsUnder(e){return q.of(this.context,e,this.path)}get style(){return this.loadedProperty("style")}set style(e){let t=`${this.path.label}.style`,n=Pe(e,t);this.requireAddressable(),this.command("style",()=>({op:"setStyle",span:I(this.path,"body"),name:n}));}get lists(){return this.#c??=Le.of(this.context,`${this.path.label}.lists`,this.path,this.#l()),this.#c}get contentControls(){return this.#u??=N.of(this.context,`${this.path.label}.contentControls`,this.path,{body:this.#l()}),this.#u}getComments(){let e=`${this.path.label}.getComments`,t=this.#l();return ce.of(this.context,e,this.path,()=>({op:"getComments",scope:{body:t}}))}get revisions(){return this.#h??=F.of(this.context,`${this.path.label}.revisions`,this.path,()=>this.#l()),this.#h}getRange(e="Whole"){let t=`${this.path.label}.getRange`;this.requireUsablePath();let n=A.promised(this.context,t,false);return this.read(t,()=>({op:"getRange",span:{body:this.path.handle()},location:e}),r=>{n.hydrateAddress({kind:"span",span:w(r,t)});}),n}search(e,t){let n=`${this.path.label}.search`;typeof e!="string"&&a({code:"InvalidArgument",target:n});let r=Ee(t,n),i=this.#l();return $.of(this.context,n,this.path,()=>({op:"search",scope:{body:i},text:e,options:{...r??{},projection:this.revisionTextView()}}))}clear(){let e=this.#l();this.commandDiscarding("clear",()=>({op:"replaceSpan",span:{body:e},text:""}));}insertText(e,t){let n=`${this.path.label}.insertText`,r=Se(e,n),i=an(t,n);this.requireUsablePath();let s=A.promised(this.context,n,false);return this.commandCreating(s,n,()=>i==="Replace"?{op:"replaceSpan",span:{body:this.#l()},text:r}:{op:"insertText",at:{body:this.#l(),at:i==="Start"?"start":"end"},text:r},d=>{s.hydrateAddress({kind:"span",span:w(d,n)});}),s}insertParagraph(e,t){let n=`${this.path.label}.insertParagraph`,r=K(e,n),i=dn(t,n),s=this.#l(),d=B.promised(this.context,n,false);return this.commandCreating(d,n,()=>({op:"insertParagraph",anchor:{body:s,at:i==="Start"?"first":"last"},where:i==="Start"?"before":"after",text:r}),l=>{l.kind!=="handle"&&a({code:"GeneralException",target:n}),d.hydrateAddress({kind:"handle",handle:l.handle});}),d}insertTable(e,t,n,r){let i=`${this.path.label}.insertTable`;n!=="Start"&&n!=="End"&&a({code:"InvalidArgument",target:i}),this.requireUsablePath();let{table:s,plan:d,settle:l}=Te(this.context,i,()=>({body:this.#l()}),n==="Start"?"Before":"After",e,t,r);return this.commandCreating(s,i,d,l),s}onLoad(e){let t=this.selection(e,["text","style"]);t.includes("text")&&this.loadTextInto("text",()=>({op:"getText",target:this.#l(),projection:this.revisionTextView()})),t.includes("style")&&this.#p();}#p(){let e=`${this.path.label}.style`;this.requireUsablePath(),this.read(e,()=>({op:"getStyle",span:I(this.path,"body")}),t=>{this.setLoadedProperty("style",ze(t,e));});}get fields(){return this.requireUsablePath(),this.#r??=he.of(this.context,`${this.path.label}.fields`,this.path,"body")}get inlinePictures(){return this.requireUsablePath(),this.#s??=ie.of(this.context,`${this.path.label}.inlinePictures`,this.path,"body")}get shapes(){return this.requireUsablePath(),this.#a??=ne.of(this.context,`${this.path.label}.shapes`,this.path,"body")}get tables(){return this.requireUsablePath(),this.#n??=ae.over(this.context,`${this.path.label}.tables`,this.path,()=>({body:this.#l()}))}#l(){return this.requireAddressable(),this.path.handle()}};var So=Object.freeze({Primary:"default",FirstPage:"first",EvenPages:"even"}),Io=["pageWidth","pageHeight","orientation","topMargin","rightMargin","bottomMargin","leftMargin"],tt=class o extends p{#e;static of(e,t,n){return new o(e,u.derived(t,n))}constructor(e,t){super(e,t);}get pageWidth(){return this.loadedProperty("pageWidth")}set pageWidth(e){this.#t("pageWidth",qe(e,`${this.path.label}.pageWidth`));}get pageHeight(){return this.loadedProperty("pageHeight")}set pageHeight(e){this.#t("pageHeight",qe(e,`${this.path.label}.pageHeight`));}get orientation(){return this.loadedProperty("orientation")}set orientation(e){let t=`${this.path.label}.orientation`;e!=="Portrait"&&e!=="Landscape"&&a({code:"InvalidArgument",target:t}),this.#t("orientation",e==="Portrait"?"portrait":"landscape");}get topMargin(){return this.loadedProperty("topMargin")}set topMargin(e){this.#t("topMargin",qe(e,`${this.path.label}.topMargin`));}get bottomMargin(){return this.loadedProperty("bottomMargin")}set bottomMargin(e){this.#t("bottomMargin",qe(e,`${this.path.label}.bottomMargin`));}get leftMargin(){return this.loadedProperty("leftMargin")}set leftMargin(e){this.#t("leftMargin",qe(e,`${this.path.label}.leftMargin`));}get rightMargin(){return this.loadedProperty("rightMargin")}set rightMargin(e){this.#t("rightMargin",qe(e,`${this.path.label}.rightMargin`));}onLoad(e){let t=this.selection(e,Io);if(t.length===0)return;let n=`${this.path.label}.pageSetup`;this.read(n,()=>({op:"getPageSetup",section:this.#n()}),r=>{let i=gt(r,n);for(let s of t)this.setLoadedProperty(s,s==="orientation"?i.orientation==="landscape"?"Landscape":"Portrait":i[s]);});}#t(e,t){if(this.requireUsablePath(),this.#e){this.#e[e]=t;return}let n={[e]:t};this.#e=n;let r=`${this.path.label}.${e}`;this.commandAnswering(`${this.path.label}.pageSetup`,()=>({op:"setPageSetup",section:this.#n(),setup:n}),i=>{R(i,r);},()=>{this.#e===n&&(this.#e=void 0);});}#n(){this.requireAddressable();let e=this.path.address();return e.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.path.label}),e.handle}},Be=class o extends p{#e;#t;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,u.of(t,n.handle),false)}static promised(e,t,n){return new o(e,u.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get body(){return this.#t??=E.main(this.context,`${this.path.label}.body`),this.#t}get pageSetup(){return this.#e??=tt.of(this.context,`${this.path.label}.pageSetup`,this.path),this.#e}getHeader(e){return this.#n("header",e,"getHeader")}getFooter(e){return this.#n("footer",e,"getFooter")}getNext(){let e=`${this.path.label}.getNext`,t=o.promised(this.context,e,false),n=this.internals.roots().document;return this.read(e,()=>({op:"getSections",document:n}),r=>{let i=O(r,e),s=i.findIndex(l=>l.ref===this.#r().ref),d=s<0?void 0:i[s+1];d||a({code:"ItemNotFound",target:e}),t.hydrateAddress({kind:"handle",handle:d});}),t}onLoad(e){this.selection(e,[]);}#n(e,t,n){let r=`${this.path.label}.${n}`,i=So[t];i===void 0&&a({code:"InvalidArgument",target:r});let s=E.promisedStory(this.context,r);return this.read(r,()=>({op:"getFurniture",section:this.#r(),kind:e,variant:i}),d=>{s.hydrateAddress({kind:"handle",handle:v(d,r)});}),s}#r(){return this.requireAddressable(),this.path.handle()}},$e=class o extends k{#e;static of(e,t,n,r){return new o(e,u.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#e()}itemAt(e,t){return Be.at(this.context,e,t)}promised(e,t){return Be.promised(this.context,e,t)}};function qe(o,e){return (typeof o!="number"||!Number.isFinite(o)||o<0)&&a({code:"InvalidArgument",target:e}),o}var Bt=(r=>(r.character="Character",r.list="List",r.paragraph="Paragraph",r.table="Table",r))(Bt||{}),qt=["nameLocal","type","builtIn","baseStyle","nextParagraphStyle","linked","visibility","priority","quickStyle","unhideWhenUsed"],To=99,Lo=Object.freeze({paragraph:"Paragraph",character:"Character",table:"Table",numbering:"List"});function jo(o,e){switch(e){case "nameLocal":return o.name;case "type":return Lo[o.type];case "builtIn":return o.builtIn;case "baseStyle":return o.basedOn??"";case "nextParagraphStyle":return o.next??"";case "linked":return o.linked;case "visibility":return !o.hidden;case "priority":return o.uiPriority??To;case "quickStyle":return o.quickStyle;case "unhideWhenUsed":return o.unhideWhenUsed}}var He=class o extends p{#e;#t;#n;static listed(e,t,n,r){let i=new o(e,u.derived(t,n),false);return i.#e=r.id,i}static promised(e,t){let n=new o(e,u.pending(t),true);return n.#t=new Set,n}constructor(e,t,n){super(e,t,{nullable:n});}get nameLocal(){return this.loadedProperty("nameLocal")}get type(){return this.loadedProperty("type")}get builtIn(){return this.loadedProperty("builtIn")}get baseStyle(){return this.loadedProperty("baseStyle")}get nextParagraphStyle(){return this.loadedProperty("nextParagraphStyle")}get linked(){return this.loadedProperty("linked")}get visibility(){return this.loadedProperty("visibility")}get priority(){return this.loadedProperty("priority")}get quickStyle(){return this.loadedProperty("quickStyle")}get unhideWhenUsed(){return this.loadedProperty("unhideWhenUsed")}hydrateFound(e){this.#e=e.id,this.path.resolveTo(this.internals.roots().document);let t=this.#n??this.#t;this.#n=void 0,this.#t=void 0,t&&this.hydrateProperties(e,[...t]);}hydrateNull(){this.#n=void 0,this.#t=void 0,this.path.resolveNull();}lookupCaptured(){this.#n=this.#t,this.#t=void 0;}lookupEnded(){this.#n=void 0,this.#t=void 0;}hydrateProperties(e,t){for(let n of t)this.setLoadedProperty(n,jo(e,n));}onLoad(e){let t=this.selection(e,qt);if(this.#t){for(let r of t)this.#t.add(r);return}let n=this.path.label;this.read(n,()=>{let r=this.#e;return r===void 0&&a({code:"ItemNotFound",target:n}),{op:"getStyles",id:r}},r=>{let i=Qe(r,n)[0];i||a({code:"ItemNotFound",target:n}),this.hydrateProperties(i,t);});}},Me=class o extends p{#e=new Ze;static of(e,t,n){return new o(e,u.derived(t,n))}constructor(e,t){super(e,t);}get items(){return this.loadedProperty("items")}getCount(){let e=`${this.path.label}.getCount`,{result:t,fill:n}=G(e);return this.read(e,()=>({op:"getStyles",count:true}),r=>n(ve(r,e))),t}getByNameOrNullObject(e){let t=`${this.path.label}.getByNameOrNullObject`;typeof e!="string"&&a({code:"InvalidArgument",target:t});let n=He.promised(this.context,t);return this.enqueue({sort:"read",label:t,plan:()=>({op:"getStyles",name:e}),settle:r=>{let i=Qe(r,t)[0];i?n.hydrateFound(i):n.hydrateNull();},capture:()=>n.lookupCaptured(),dispose:()=>n.lookupEnded()}),n}get loadsItemPaths(){return true}onLoad(e){let t=`${this.path.label}.items`,n=yt(e),r=n.length>0?Xe({select:n},qt,t):qt,i=e.skip??0,s=e.top;this.#e.join(r,i,s)||this.#e.open(i,s,(d,l)=>this.enqueue({sort:"read",label:t,capture:l,dispose:l,plan:()=>({op:"getStyles"}),settle:h=>{let y=Qe(h,t),m=[...d],b=xt(y.length,i,s),j=[];for(let H=i;H<b;H+=1){let ee=y[H],xe=He.listed(this.context,`${t}[${String(H)}]`,this.path,ee);xe.hydrateProperties(ee,m),j.push(xe);}this.setLoadedProperty("items",Object.freeze(j));}}));}};var Fe=class o extends p{#e;#t;#n;#r;#s;#a;#d;#i;#o;static open(e){return new o(e)}constructor(e){super(e,u.of("document",Y(e).roots().document));}get changeTrackingMode(){return this.loadedProperty("changeTrackingMode")}set changeTrackingMode(e){["Off","TrackAll","TrackMineOnly"].includes(e)||a({code:"InvalidArgument",target:"document.changeTrackingMode"});let t=this.internals.author;this.enqueue({sort:"write",label:"document.changeTrackingMode",plan:()=>({op:"setChangeTrackingMode",mode:e,...t===void 0?{}:{author:t}}),settle:()=>this.setLoadedProperty("changeTrackingMode",e),...e==="TrackAll"?{}:{runtimeSetting:true}});}get body(){return this.#t??=E.main(this.context,"document.body"),this.#t}removeDocumentInformation(e){this.command(`${this.path.label}.removeDocumentInformation`,()=>({op:"removeDocumentInformation",removeDocInfoType:e}));}compareFromBase64(e,t){let n=`${this.path.label}.compareFromBase64`,r=t??{};this.command("compareFromBase64",()=>{(typeof e!="string"||e.length===0)&&a({code:"InvalidArgument",target:n});for(let i of ["detectFormatChanges","removeDateAndTime","removePersonalInformation","addToRecentFiles","ignoreAllComparisonWarnings"])r[i]!==void 0&&typeof r[i]!="boolean"&&a({code:"InvalidArgument",target:`${n}.${i}`});return r.compareTarget!==void 0&&!["CompareTargetCurrent","CompareTargetNew","CompareTargetSelected"].includes(r.compareTarget)&&a({code:"InvalidArgument",target:`${n}.compareTarget`}),r.compareTarget!==void 0&&r.compareTarget!=="CompareTargetCurrent"&&a({code:"NotSupported",target:`${n}.compareTarget`}),r.removePersonalInformation===true&&a({code:"NotSupported",target:`${n}.removePersonalInformation`}),r.authorName!==void 0&&typeof r.authorName!="string"&&a({code:"InvalidArgument",target:`${n}.authorName`}),{op:"compareFromBase64",base64:e,...r.authorName===void 0?{}:{authorName:r.authorName},...r.detectFormatChanges===void 0?{}:{detectFormatChanges:r.detectFormatChanges},...r.removeDateAndTime===void 0?{}:{removeDateAndTime:r.removeDateAndTime}}});}compare(e,t){let n=`${this.path.label}.compare`;this.command("compare",()=>a({code:"NotSupported",target:n}));}get properties(){return this.#e??=Ce.of(this.context,this.path),this.#e}getStyles(){return Me.of(this.context,`${this.path.label}.getStyles()`,this.path)}get paragraphs(){return this.#n??=this.body.paragraphsUnder("document.paragraphs"),this.#n}get sections(){let e=this.path.handle();return this.#r??=$e.of(this.context,"document.sections",this.path,()=>({op:"getSections",document:e})),this.#r}get contentControls(){return this.#d??=N.of(this.context,"document.contentControls",this.path,{body:this.internals.roots().body}),this.#d}get comments(){return this.#s??=ce.of(this.context,"document.comments",this.path,()=>({op:"getComments",scope:{body:this.internals.roots().body}})),this.#s}get revisions(){return this.#a??=F.of(this.context,"document.revisions",this.path,()=>this.internals.roots().body),this.#a}get footnotes(){let e=this.path.handle();return this.#i??=Q.of(this.context,"document.footnotes",this.path,()=>({op:"getNotes",document:e,noteKind:"footnote"})),this.#i}get endnotes(){let e=this.path.handle();return this.#o??=Q.of(this.context,"document.endnotes",this.path,()=>({op:"getNotes",document:e,noteKind:"endnote"})),this.#o}deleteBookmark(e){let t=`${this.path.label}.deleteBookmark`,n=this.path.handle();this.command("deleteBookmark",()=>(typeof e!="string"&&a({code:"InvalidArgument",target:t}),{op:"deleteBookmark",target:{document:n,name:e}}));}getBookmarkRange(e){return this.#c(e,"getBookmarkRange",false)}getBookmarkRangeOrNullObject(e){return this.#c(e,"getBookmarkRangeOrNullObject",true)}#c(e,t,n){let r=`${this.path.label}.${t}`,i=this.path.handle(),s=A.promised(this.context,r,n);return this.read(r,()=>(typeof e!="string"&&a({code:"InvalidArgument",target:r}),{op:"getBookmarkRangeByName",document:i,name:e}),d=>{let h=te(d,r)[0];if(!h){n||a({code:"ItemNotFound",target:r}),s.hydrateNull();return}s.hydrateAddress({kind:"span",span:h});}),s}onLoad(e){if(e.select.length===0)return;this.selection(e,["changeTrackingMode"]).includes("changeTrackingMode")&&this.loadTextInto("changeTrackingMode",()=>({op:"getChangeTrackingMode"}));}};var Rn=o=>typeof o=="object"&&o!==null&&typeof o.kind=="string"&&typeof o.ref=="string";function Cn(o){let e=[],t=n=>{if(Array.isArray(n))return n.forEach(t);if(n===null||typeof n!="object")return;let r=n;if(Z(n))return;let i=Object.keys(r),s=i.length===1&&(i[0]==="paragraph"||i[0]==="body")&&Rn(r[i[0]]),d=typeof r.start=="object"&&r.start!==null&&Z(r.start)&&typeof r.end=="object"&&r.end!==null&&Z(r.end);if(s||d){e.push({op:"getSpanText",span:d?{start:r.start,end:r.end}:n,projection:"model"});return}if(Rn(n)&&n.kind==="paragraph"){e.push({op:"getText",target:n,projection:"model"});return}Object.values(r).forEach(t);};for(let n of o){if(!automation.isAutomationCommand(n)||n.op==="setChangeTrackingMode")continue;let r=n.key;typeof r=="string"&&e.push({op:"getReviewItemRange",key:r}),t(n);}return e}var Do=new Set(["getRevisionDate","getCommentDate","getCommentId","getParagraphId"]),T=class extends Error{};function Ht(o,e,t,n){let r=new $t(t,n),i=false;try{for(let s of o){if(!s.response.ok)continue;if(r.revision(s.before,e.revision()),s.guards){let l=e.execute(r.translate(s.guards.request));if(l===null||l.ok!==s.guards.response.ok)throw new T;if(l.results.length!==s.guards.response.results.length)throw new T;s.guards.response.results.forEach((h,y)=>r.agree(h,l.results[y],false));}let d=e.execute(r.translate(s.request));if(d===null)throw new T;if(!d.ok){let l=d.results.find(h=>h.status==="error");throw l?.status==="error"?Re(l.error,{target:"preview"}):new x({code:"GeneralException",target:"preview"})}if(d.changed&&(i=true),d.results.length!==s.response.results.length)throw new T;s.request.operations.forEach((l,h)=>r.agree(s.response.results[h],d.results[h],Do.has(l.op))),r.revision(s.response.revision,d.revision);}}catch(s){if(s instanceof x)return {ok:false,refusal:s,wrote:i};if(s instanceof T)return {ok:false,refusal:null,wrote:i};throw s}return {ok:true}}function Z(o){let e=o;return typeof e.offset=="number"&&typeof e.paragraph=="object"&&e.paragraph!==null&&typeof e.paragraph.ref=="string"}var An=o=>`${o.paragraph.ref}\0${o.offset}\0${o.readAt??""}`,$t=class{#e=new Map;#t=new Map;#n=new Map;#r=new Map;constructor(e,t){this.#n.set(e,t);}revision(e,t){let n=this.#n.get(e);if(n!==void 0&&n!==t)throw new T;this.#n.set(e,t);}translate(e){if(Array.isArray(e))return e.map(r=>this.translate(r));if(e===null||typeof e!="object")return e;let t=Z(e)?this.#i(e):void 0,n={};for(let[r,i]of Object.entries(e))if(r==="ref"&&typeof i=="string"){let s=this.#e.get(i);if(s===void 0)throw new T;n[r]=s;}else if((r==="readAt"||r==="expectedRevision")&&typeof i=="number"){let s=this.#n.get(i);if(s===void 0)throw new T;n[r]=s;}else r==="offset"&&t!==void 0?n[r]=t:n[r]=this.translate(i);return n}agree(e,t,n){if(Array.isArray(e)){if(!Array.isArray(t)||t.length!==e.length)throw new T;e.forEach((s,d)=>this.agree(s,t[d],n));return}if(e===null||typeof e!="object"){if(!n&&e!==t)throw new T;return}if(t===null||typeof t!="object"||Array.isArray(t))throw new T;let r=t,i=Z(e);if(i){if(!Z(r))throw new T;this.#d(e,r.offset);}this.#s(e,r);for(let[s,d]of Object.entries(e))if(s==="ref"&&typeof d=="string"){let l=r[s];if(typeof l!="string")throw new T;this.#a(d,l);}else {if(s==="readAt"||s==="date"||s==="offset"&&i)continue;this.agree(d,r[s],n);}}#s(e,t){let[n,r,i,s]=[e.start,e.end,t.start,t.end];if(!(typeof n!="object"||n===null||!Z(n))&&!(typeof r!="object"||r===null||!Z(r))&&n.paragraph.ref===r.paragraph.ref&&!(typeof i!="object"||i===null||!Z(i))&&!(typeof s!="object"||s===null||!Z(s))&&s.offset-i.offset!==r.offset-n.offset)throw new T}#a(e,t){let n=this.#e.get(e),r=this.#t.get(t);if(n!==void 0&&n!==t||r!==void 0&&r!==e)throw new T;this.#e.set(e,t),this.#t.set(t,e);}#d(e,t){let n=An(e),r=this.#r.get(n);if(r!==void 0&&r!==t)throw new T;this.#r.set(n,t);}#i(e){let t=this.#r.get(An(e));if(t!==void 0)return t;if(e.readAt!==void 0)throw new T;return e.offset}};var qo=new Set(["setChangeTrackingMode","insertText","replaceSpan","insertParagraph","splitParagraph","deleteParagraph","setFont","setParagraphFormat","setStyle","proposeInsertion","proposeDeletion","proposeReplacement","insertComment","replyToComment","setCommentResolved","deleteComment","acceptRevision","rejectRevision","acceptAllRevisions","rejectAllRevisions","resolveRevisionBatch","setRevisionAuthorBatch"]);function Bo(o){return automation.isAutomationCommand(o)?o.op==="insertBreak"?o.breakType==="Line":qo.has(o.op):true}function $o(o,e){return {...o,execute(t){let n=Array.isArray(t?.operations)?t.operations:[],r=n.findIndex(h=>!Bo(h));if(r>=0)return {ok:false,results:n.map((h,y)=>y===r?{status:"error",error:{code:"unsupported-capability",message:"a preview cannot show this operation",detail:"preview-operation-unsupported"}}:{status:"skipped"}),revision:o.revision(),changed:false};let i=o.revision(),s=Cn(n),d=s.length>0?{request:{operations:s},response:o.execute({operations:s})}:void 0,l=o.execute(t);return e.push({request:t,response:l,before:i,...d?{guards:d}:{}}),l}}}function Pn(o){switch(o){case "preview-active":return new x({code:"PreviewActive",diagnostic:"edit.preview-active"});case "no-document":return new x({code:"DocumentUnavailable"});case "viewing":return new x({code:"NotSupported",target:"preview",diagnostic:"edit.read-only"});case "blocked":return new x({code:"NotSupported",target:"preview",diagnostic:"edit.refresh-in-progress"});case "composing":return new x({code:"NotSupported",target:"preview",diagnostic:"edit.preview-composing"})}}async function On(o,e){let t=o.port.begin();if(!t.ok)throw Pn(t.reason);let n=t.fork;try{let r=o.host.revision();wn(o,n.host);let i=n.host.revision(),s=[],d=await o.runOn($o(n.host,s),e);return n.ended&&a({code:"PreviewEnded",target:"preview"}),n.show()||a({code:"GeneralException",target:"preview"}),new Mt(o,n,s,r,i,d)}catch(r){throw n.end(),r}}function wn(o,e){let n=o.host.execute({operations:[{op:"getChangeTrackingMode"}]}).results[0];n?.status!=="ok"||n.value.kind!=="text"||n.value.text!=="TrackMineOnly"||o.author===void 0||e.execute({operations:[{op:"setChangeTrackingMode",mode:"TrackMineOnly",author:o.author}]});}var Mt=class{constructor(e,t,n,r,i,s){this.runtime=e;this.fork=t;this.log=n;this.base=r;this.forkBase=i;this.result=s;this.#s=e.host.subscribe(d=>{this.#e==="active"&&d.revision!==r&&this.#c("stale");}),this.#a=t.onEnd(()=>this.#u()),e.host.revision()!==r&&this.#c("stale");}runtime;fork;log;base;forkBase;result;#e="active";#t=false;#n=[];#r=new Set;#s;#a;get status(){return this.#e}onStatusChanged(e){return this.#r.add(e),()=>this.#r.delete(e)}discard(){this.#u();}reveal(){return this.#e!=="ended"&&this.fork.reveal()}async commit(e={}){this.#e==="ended"&&a({code:"PreviewEnded",target:"preview"}),this.#t=true;try{let t=e?.rebase===true,n=this.runtime.host.revision(),r=n!==this.base;r&&this.#c("stale"),r&&!t&&a({code:"StaleDocument",target:"preview",expectedRevision:this.base,actualRevision:n}),this.fork.deferEvents(()=>{this.#u(),this.#d(n,r),this.#i(n,r);});}finally{this.#t=false;for(let t of this.#n.splice(0))t();}}#d(e,t){let n=this.runtime.port.begin();if(!n.ok)throw Pn(n.reason);let r=n.fork;try{wn(this.runtime,r.host);let i=Ht(this.log,{execute:s=>r.host.execute(s),revision:()=>r.host.revision()},this.forkBase,r.host.revision());i.ok||this.#o(i.refusal,e,t);}finally{r.end();}}#i(e,t){let{runtime:n}=this,r=n.port.beginHistoryGroup(),i=n.groupRun(r),s;try{s=Ht(this.log,{execute:d=>i?i.execute(d):n.host.execute(d),revision:()=>n.host.revision()},this.forkBase,e);}finally{i?.finish(),r.end();}s.ok||(s.wrote&&!n.port.undo()&&a({code:"GeneralException",target:"preview.rollback"}),this.#o(s.refusal,e,t));}#o(e,t,n){if(e)throw e;a(n?{code:"StaleDocument",target:"preview",expectedRevision:this.base,actualRevision:t,diagnostic:"edit.preview-diverged"}:{code:"GeneralException",target:"preview",diagnostic:"edit.preview-diverged"});}#c(e){if(!(this.#e===e||this.#e==="ended")){this.#e=e;for(let t of [...this.#r]){let n=()=>{try{t(e);}catch{}};this.#t?this.#n.push(n):n();}}}#u(){this.#e!=="ended"&&(this.#s?.(),this.#a?.(),this.fork.end(),this.#c("ended"),this.#r.clear());}};function Mo(o,e){let t=r=>r===void 0?[]:Array.isArray(r)?r:[r];if(typeof o=="function")return {callback:o,adopted:[],historyGroup:void 0};if(o instanceof z||Array.isArray(o))return {callback:e,adopted:t(o),historyGroup:void 0};(o===null||typeof o!="object")&&a({code:"InvalidArgument",target:"run"});let n=o;return {callback:e,adopted:t(n.previousObjects),historyGroup:n.historyGroup}}function Fo(o,e){return {...o,execute(t){let n=e.execute(t);return n===null&&a({code:"InvalidArgument",target:"historyGroup"}),n}}}function Sn(o){let e=o.host,t=Object.freeze({...e.capabilities,save:o.save&&e.capabilities.save,preview:o.preview!==void 0}),n=typeof o.author=="string"&&o.author.trim().length>0?o.author.trim():void 0,r=o.revisionTextView??"allMarkup";r!=="allMarkup"&&r!=="original"&&a({code:"InvalidArgument",target:"revisionTextView"});let i=false,s=null,d=C=>{i&&a({code:"RuntimeDisposed",...C===void 0?{}:{target:C}});},l=()=>s||(d("document"),s=h(e),s),h=C=>{let f=pe=>{try{return C.execute({operations:pe})}catch(Ge){try{o.onException?.(Ge,pe);}catch{}throw Ge}},g=kn(f([{op:"getDocument"}]),"document"),V=kn(f([{op:"getBody",document:g}]),"document.body");return {document:g,body:V}},y={host:e,capabilities:t,...n===void 0?{}:{author:n},revisionTextView:r,...o.onRefusal?{onRefusal:o.onRefusal}:{},...o.onException?{onException:o.onException}:{},id:{},roots:l,assertLive:d,openDocument:C=>Fe.open(C)},m=C=>{let f=o.preview;return f?{...C,execute(g){return f.active()&&g.operations.some(V=>automation.isAutomationCommand(V))&&a({code:"PreviewActive",diagnostic:"edit.preview-active"}),C.execute(g)}}:C},b=o.preview?{...y,host:m(e)}:y,j=async(C,f)=>{let g=null,{context:V,finish:pe}=Ae.begin({...y,host:C,capabilities:Object.freeze({...C.capabilities,preview:false}),id:{},roots:()=>g??=h(C)});try{return await f(V)}finally{pe();}},H=new Set;async function ee(C){d("preview"),typeof C!="function"&&a({code:"InvalidArgument",target:"preview"});let f=o.preview;f||a({code:"NotSupported",target:"preview"});let g=await On({port:f,host:e,...n===void 0?{}:{author:n},groupRun:V=>o.historyGroups?.begin(V)??null,runOn:j},C);return H.add(g),g.onStatusChanged(V=>{V==="ended"&&H.delete(g);}),g}try{l();}catch{s=null;}async function xe(C,f){d();let{callback:g,adopted:V,historyGroup:pe}=Mo(C,f);typeof g!="function"&&a({code:"InvalidArgument",target:"run"});let Ge=b,nt=null;pe!==void 0&&(o.historyGroups||a({code:"NotSupported",target:"historyGroup"}),nt=o.historyGroups.begin(pe),nt===null&&a({code:"InvalidArgument",target:"historyGroup"}),Ge={...y,host:m(Fo(e,nt))});let{context:Hn,adopt:Mn,finish:Fn}=Ae.begin(Ge);try{return Mn(V),await g(Hn)}finally{Fn(),nt?.finish();}}let Ve={capabilities:t,run:xe,preview:ee,dispose(){if(!i){i=true,s=null;for(let C of [...H])C.discard();e.dispose();}}};return o.save?{...Ve,async save(){d("save"),t.save||a({code:"NotSupported",target:"save"});let C=e.save();if(!C.ok)throw Re(C.error,{target:"save"});return C.bytes}}:Ve}function kn(o,e){let t=o.results[0];if(t?.status==="error")throw Re(t.error,{target:e});if(t?.status!=="ok")throw new x({code:"GeneralException",target:e});return v(t.value,e)}var zo={StaleDocument:"edit.stale-target",ItemNotFound:"edit.stale-target",InvalidObjectPath:"edit.stale-target",InvalidArgument:"edit.invalid-argument",ResourceLimitExceeded:"edit.resource-limit",NotSupported:"edit.operation-unsupported",NotImplemented:"edit.operation-unsupported"};function Qo(o){try{let e=o.execute({operations:[{op:"getChangeTrackingMode"}]}),t=e.ok?e.results[0]:void 0;return t?.status==="ok"&&t.value.kind==="text"&&t.value.text!=="Off"}catch{return false}}function Ln(o,e){return e.some(n=>n.op==="setChangeTrackingMode"&&n.mode!=="Off")||Qo(o)}function Ko(o,e,t){let n=o.debugInfo.innerError?.code;return {code:n?.startsWith("edit.")?n:zo[o.code]??"edit.refused",tracked:Ln(e,t)}}function Xo(o){for(let e of o)switch(e.op){case "acceptRevision":case "acceptAllRevisions":return "accept";case "rejectRevision":case "rejectAllRevisions":return "reject";case "resolveRevisionBatch":return e.action;case "setRevisionAuthorBatch":return "reassign"}}function Zo(o){let e=o.debugInfo.innerError?.code;return e?.startsWith("review.")?e:null}function jn(o){if(o.length===0)return null;let{deliver:e}=automation.createDiagnosticEmitter(()=>o);return {openRejected(t,n,r,i){let s=automation.diagnosticCause(n),d=automation.documentPartKind(i);e({kind:"document.open",outcome:"rejected",code:automation.openDiagnosticCode(n,r),sizeBucket:automation.byteSizeBucket(t.byteLength),...s?{cause:s}:{},...d?{part:d}:{}});},openCrashed(t,n){e({kind:"document.open",outcome:"rejected",code:"open.failed",sizeBucket:automation.byteSizeBucket(t.byteLength),cause:automation.exceptionCause(),errorName:automation.diagnosticErrorName(n)});},opened(t,n){e({kind:"document.open",outcome:"opened",sizeBucket:automation.byteSizeBucket(t.byteLength),durationMs:Math.max(0,Math.round(n))});},crashed(t,n,r){e({kind:"edit.rejected",code:"edit.internal-invariant",origin:"automation",tracked:Ln(n,r),cause:automation.exceptionCause(),errorName:automation.diagnosticErrorName(t),stage:"automation"});},refused(t,n,r){let i=nn(t),s=Zo(t);if(s){let d=Xo(r);e({kind:"review.skipped",code:s,count:1,...d?{operation:d}:{},...i?{cause:i}:{}});return}e({kind:"edit.rejected",origin:"automation",...Ko(t,n,r),...i?{cause:i}:{}});}}}function _o(o){if(o){for(let e of o)if(e.collaboration)return e.collaboration}}function er(o){let e=[o?.zip?.maxEntries,o?.zip?.maxTotalBytes,o?.xml?.maxBytes,o?.xml?.maxElements,o?.maxXmlParts,o?.maxRelationships],t=o?.zip?.maxRatio;(e.some(n=>n!==void 0&&(!Number.isInteger(n)||n<0))||t!==void 0&&(!Number.isFinite(t)||t<0))&&a({code:"InvalidArgument",target:"createServer"});}async function Vt(o,e={}){let t=jn((e.modules??[]).flatMap(d=>d.onDiagnostic?[d.onDiagnostic]:[])),n=Date.now();try{er(e.limits);}catch(d){throw t?.openRejected(o,"invalid-limits"),d}let r=_o(e.modules),i=e.modules?.find(d=>d.review?.compareDocuments)?.review?.compareDocuments,s;try{s=automation.createServerAutomationHost(o,{...e.pagination?{pagination:Ut(e.pagination)}:{},...e.limits===void 0?{}:{limits:e.limits},...r===void 0?{}:{collaborationModel:r},...i===void 0?{}:{compareDocuments:i}});}catch(d){throw t?.openCrashed(o,d),d}if(!s.ok){let d={"too-many-entries":"zip.maxEntries","too-large":"xml.maxBytes","too-many-elements":"xml.maxElements","too-deep":"xml.maxDepth","too-many-xml-parts":"maxXmlParts","too-many-relationships":"maxRelationships"},l=s.limit??d[s.reason];t?.openRejected(o,s.reason,s.limit,s.detail),a({code:l===void 0?"InvalidArgument":"ResourceLimitExceeded",target:"createServer",...l===void 0?{}:{limit:l},diagnostic:automation.openDiagnosticCode(s.reason,s.limit)});}return t?.opened(o,Date.now()-n),Sn({host:s.host,save:true,...e.author===void 0?{}:{author:e.author},...e.revisionTextView===void 0?{}:{revisionTextView:e.revisionTextView},...t?{onRefusal:(d,l)=>t.refused(d,s.host,l),onException:(d,l)=>t.crashed(d,s.host,l)}:{}})}function En(o,e,t={}){return Vt(o,{...t,modules:[...t.modules??[],{id:"collaboration",collaboration:{session:e}}]})}function Dn(o,e,t,n){let r=typeof o=="object"&&o!==null?Y(o):void 0;return r||a({code:"InvalidArgument",target:t}),(typeof e!="string"||e.length===0)&&a({code:"InvalidArgument",target:t}),n.some(i=>e.startsWith(i))&&a({code:"NotSupported",target:t}),r.assertUsable(t),r}function Nn(o,e,t){let n=t?"getReviewItemRangeOrNullObject":"getReviewItemRange",r=Dn(o,e,n,["custom-"]),i=A.promised(o,n,t);return r.queue.push({sort:"read",label:n,plan:()=>({op:"getReviewItemRange",key:e}),settle:s=>{let[d]=te(s,n);d?i.hydrateAddress({kind:"span",span:d}):t?i.hydrateNull():a({code:"ItemNotFound",target:n});}}),i}function qn(o,e){let t="getReviewItemRevisions",n=Dn(o,e,t,["custom-","comment-"]);return F.ofReviewKey(o,t,u.of("document",n.roots().document),e)}function Bn(o,e){return Nn(o,e,false)}function $n(o,e){return Nn(o,e,true)}var Gt=(c=>(c.addin="Addin",c.addressBlock="AddressBlock",c.advance="Advance",c.ask="Ask",c.author="Author",c.autoText="AutoText",c.autoTextList="AutoTextList",c.barCode="BarCode",c.bibliography="Bibliography",c.bidiOutline="BidiOutline",c.citation="Citation",c.comments="Comments",c.compare="Compare",c.createDate="CreateDate",c.data="Data",c.database="Database",c.date="Date",c.displayBarcode="DisplayBarcode",c.docProperty="DocProperty",c.docVariable="DocVariable",c.editTime="EditTime",c.embedded="Embedded",c.empty="Empty",c.eq="EQ",c.expression="Expression",c.fileName="FileName",c.fileSize="FileSize",c.fillIn="FillIn",c.formCheckbox="FormCheckbox",c.formDropdown="FormDropdown",c.formText="FormText",c.gotoButton="GotoButton",c.greetingLine="GreetingLine",c.hyperlink="Hyperlink",c.if="If",c.import="Import",c.include="Include",c.includePicture="IncludePicture",c.includeText="IncludeText",c.index="Index",c.info="Info",c.keywords="Keywords",c.lastSavedBy="LastSavedBy",c.link="Link",c.listNum="ListNum",c.macroButton="MacroButton",c.mergeBarcode="MergeBarcode",c.mergeField="MergeField",c.mergeRec="MergeRec",c.mergeSeq="MergeSeq",c.next="Next",c.nextIf="NextIf",c.noteRef="NoteRef",c.numChars="NumChars",c.numPages="NumPages",c.numWords="NumWords",c.ocx="OCX",c.others="Others",c.page="Page",c.pageRef="PageRef",c.print="Print",c.printDate="PrintDate",c.private="Private",c.quote="Quote",c.rd="RD",c.ref="Ref",c.revNum="RevNum",c.saveDate="SaveDate",c.section="Section",c.sectionPages="SectionPages",c.seq="Seq",c.set="Set",c.shape="Shape",c.skipIf="SkipIf",c.styleRef="StyleRef",c.subject="Subject",c.subscriber="Subscriber",c.symbol="Symbol",c.ta="TA",c.tc="TC",c.template="Template",c.time="Time",c.title="Title",c.toa="TOA",c.toc="TOC",c.undefined="Undefined",c.userAddress="UserAddress",c.userInitials="UserInitials",c.userName="UserName",c.xe="XE",c))(Gt||{});var Vd=Object.freeze({createServer:Vt,createCollaborative:En});exports.Alignment=Ct;exports.Body=E;exports.Bookmark=Ne;exports.BookmarkCollection=de;exports.BreakType=kt;exports.ChangeTrackingMode=Ot;exports.ChangeTrackingVersion=At;exports.ClientObject=z;exports.ClientResult=We;exports.Comment=le;exports.CommentCollection=ce;exports.CommentReply=ye;exports.CommentReplyCollection=et;exports.CompareTarget=Tt;exports.ContentControl=J;exports.ContentControlCollection=N;exports.ContentControlType=St;exports.Document=Fe;exports.DocumentProperties=Ce;exports.DocxEditor=Vd;exports.DocxEditorError=x;exports.Field=ue;exports.FieldCollection=he;exports.FieldType=Gt;exports.Font=X;exports.InlinePicture=re;exports.InlinePictureCollection=ie;exports.InsertLocation=vt;exports.List=W;exports.ListBullet=Et;exports.ListCollection=Le;exports.ListItem=je;exports.ListNumbering=Dt;exports.NoteItem=we;exports.NoteItemCollection=Q;exports.PageOrientation=Pt;exports.PageSetup=tt;exports.Paragraph=B;exports.ParagraphCollection=q;exports.Range=A;exports.RangeCollection=$;exports.RangeLocation=Rt;exports.RemoveDocInfoType=It;exports.RequestContext=Ae;exports.Revision=_;exports.RevisionCollection=F;exports.Section=Be;exports.SectionCollection=$e;exports.Shape=Oe;exports.ShapeCollection=ne;exports.ShapeType=st;exports.Style=He;exports.StyleCollection=Me;exports.StyleType=Bt;exports.Table=fe;exports.TableCell=se;exports.TableCellCollection=Je;exports.TableCollection=ae;exports.TableRow=Ie;exports.TableRowCollection=be;exports.TrackedObjects=Ke;exports.UnderlineType=Nt;exports.VerticalAlignment=wt;exports.getReviewItemRange=Bn;exports.getReviewItemRangeOrNullObject=$n;exports.getReviewItemRevisions=qn;exports.isDocxEditorError=Ue;
6
+ 'use strict';var automation=require('@docx-editor.dev/core/automation');function Kt(o){return automation.createAutomationPaginationProvider(o)}var Kn=Object.freeze({PropertyNotLoaded:"the property has not been loaded. Call load(...) and await context.sync() before reading it.",ValueNotLoaded:"the result has not been filled in yet. Await context.sync() before reading it.",InvalidObjectPath:"the object cannot be addressed. Await context.sync() after creating an object with an edit. Keep proxies within their run, or use context.trackedObjects.add(...) before the run ends.",ObjectInUse:"the object still belongs to a run that has not finished. Await that run before passing the object to another one.",InvalidArgument:"the argument is not one this API accepts.",ResourceLimitExceeded:"the document exceeds a supported resource limit.",ItemNotFound:"the collection has no such item.",NotSupported:"the operation or argument is outside the supported subset for this host, mode, or content.",NotImplemented:"this API does not implement that operation for this target.",ConflictingChanges:"these operations cannot share one atomic batch. Split them across separate context.sync() calls.",InvalidRequestContext:"the request context has finished. Start another run to continue.",RuntimeDisposed:"the runtime has been disposed.",StaleDocument:"the document or a range changed after this context read it, so nothing was applied. The change can come from another writer or from an earlier sync of this context.",DocumentUnavailable:"the document is not available right now.",PreviewActive:"a preview is open over the document. Commit or discard it before writing or opening another.",PreviewEnded:"the preview has ended. Start another preview to show other wording.",GeneralException:"the document could not complete the request."}),Xn="the object no longer exists in the document. An edit removed or merged it. Read the document again to get a fresh object.";function Zn(o,e){return o==="InvalidObjectPath"&&e==="edit.stale-target"?Xn:Kn[o]}var x=class extends Error{code;limit;target;expectedRevision;actualRevision;debugInfo;constructor(e){let t=Zn(e.code,e.diagnostic),n=e.target?`${t} (${e.target})`:t;super(n),this.name="DocxEditorError",this.code=e.code,this.debugInfo=Object.freeze({code:e.code,message:n,...e.target===void 0?{}:{errorLocation:e.target},...e.diagnostic===void 0?{}:{innerError:Object.freeze({code:e.diagnostic,message:automation.explainDiagnostic(e.diagnostic).hint})}}),e.limit!==void 0&&(this.limit=e.limit),e.target!==void 0&&(this.target=e.target),e.expectedRevision!==void 0&&(this.expectedRevision=e.expectedRevision),e.actualRevision!==void 0&&(this.actualRevision=e.actualRevision);}};function Ue(o){return o instanceof x?true:typeof o=="object"&&o!==null&&o.name==="DocxEditorError"&&typeof o.code=="string"}function a(o){throw new x(o)}var me=Symbol("docx-editor.runtime.internals"),rt=Symbol("docx-editor.runtime.release"),it=Symbol("docx-editor.runtime.rebind"),Xt=Symbol.for("@docx-editor.dev/editor-api/author"),Zt=Symbol.for("@docx-editor.dev/editor-api/queue");function Y(o){return o[me]}var Yn=new Set(["select","expand","top","skip"]),Yt=/^[A-Za-z][A-Za-z0-9]*$/,Jn="items/",Jt=4,_n=64;function eo(o,e){if(typeof o!="string"&&a({code:"InvalidArgument",target:e}),Yt.test(o))return {own:o};let t=o.split("/",Jt+1);if(t.length<=Jt&&t.every(r=>r.length<=_n&&Yt.test(r))||a({code:"InvalidArgument",target:e}),t.length===2&&o.startsWith(Jn))return {item:t[1]};a({code:"InvalidArgument",target:`${e}.${o}`});}function _t(o,e){if(o===void 0)return {own:[],items:[]};let t=typeof o=="string"?o.split(",").map(i=>i.trim()):Array.isArray(o)?o.map(i=>typeof i=="string"?i.trim():i):a({code:"InvalidArgument",target:e}),n=[],r=[];for(let i of t){let s=eo(i,e);s.own!==void 0&&!n.includes(s.own)&&n.push(s.own),s.item!==void 0&&!r.includes(s.item)&&r.push(s.item);}return n.length===0&&r.length===0&&a({code:"InvalidArgument",target:e}),{own:n,items:r}}function en(o){return {select:o.own,itemSelect:o.items}}function tn(o,e){return (typeof o!="number"||!Number.isInteger(o)||o<0)&&a({code:"InvalidArgument",target:e}),o}function to(o,e){o===void 0||Array.isArray(o)&&o.length===0||a({code:"InvalidArgument",target:e});}function nn(o,e){if(o===void 0)return {select:[],itemSelect:[]};if(typeof o=="string"||Array.isArray(o))return en(_t(o,e));(typeof o!="object"||o===null)&&a({code:"InvalidArgument",target:e});let t=o;for(let n of Object.keys(t))Yn.has(n)||a({code:"InvalidArgument",target:`${e}.${n}`});return to(t.expand,`${e}.expand`),{...en(_t(t.select,`${e}.select`)),...t.top===void 0?{}:{top:tn(t.top,`${e}.top`)},...t.skip===void 0?{}:{skip:tn(t.skip,`${e}.skip`)}}}var z=class{#e;#t;#n;#r;#s=new Map;#a=false;constructor(e,t,n={}){this.#e=e,this.#t=e[me],this.#n=t,this.#r=n.nullable===true,this.#t.register(this);}get context(){return this.#e}get isNullObject(){return this.#n.isReleased&&a({code:"InvalidObjectPath",target:this.#n.label}),this.#r?(this.#n.isPending&&a({code:"PropertyNotLoaded",target:`${this.#n.label}.isNullObject`}),this.#n.isNull):false}load(e){this.#a=true;try{this.requireUsablePath();let t=nn(e,this.#n.label),n=t.itemSelect[0];return n!==void 0&&!this.loadsItemPaths&&a({code:"InvalidArgument",target:`${this.#n.label}.items/${n}`}),this.onLoad(t),this}finally{this.#a=false;}}get loadsItemPaths(){return false}get path(){return this.#n}get internals(){return this.#t}handle(){return this.#n.handle()}requireAddressable(){this.#n.isAddressable||a({code:"InvalidObjectPath",target:this.#n.label}),this.#t.assertUsable(this.#n.label);}requireUsablePath(){(this.#n.isReleased||this.#n.isNull&&!(this.#a&&this.#r))&&a({code:"InvalidObjectPath",target:this.#n.label}),this.#t.assertUsable(this.#n.label);}enqueue(e){this.requireUsablePath(),this.#t.queue.push({...e,dependencies:[...e.dependencies??[],this.#n],...this.#a&&this.#r&&e.sort==="read"?{nullableLoad:this.#n}:{}});}loadedProperty(e){return this.#n.isReleased&&!this.#s.has(e)&&a({code:"InvalidObjectPath",target:this.#n.label}),this.#s.has(e)||a({code:"PropertyNotLoaded",target:`${this.#n.label}.${e}`}),this.#s.get(e)}hasLoadedProperty(e){return this.#s.has(e)}setLoadedProperty(e,t){this.#s.set(e,t);}[rt](){this.#n.release();}[it](e){this.#e=e,this.#t=e[me];}};var ze=class o{#e=false;#t;#n;constructor(e){this.#n=e;}get value(){return this.#e||a({code:"ValueNotLoaded",target:this.#n}),this.#t}get isLoaded(){return this.#e}static create(e){let t=new o(e);return {result:t,fill(n){t.#e=true,t.#t=n;}}}};function W(o){return ze.create(o)}function D(o){return new x({code:"GeneralException",target:o})}function O(o,e){if(o.kind!=="text")throw D(e);return o.text}function A(o,e){if(o.kind!=="handle")throw D(e);return o.handle}function w(o,e){if(o.kind!=="handles")throw D(e);return o.handles}function P(o,e){if(o.kind!=="span")throw D(e);return o.span}function te(o,e){if(o.kind!=="spans")throw D(e);return o.spans}function mt(o,e){if(o.kind!=="font")throw D(e);return o.font}function gt(o,e){if(o.kind!=="shapeFill")throw D(e);return o.fill}function ft(o,e){if(o.kind!=="paragraphFormat")throw D(e);return o.format}function Qe(o,e){if(o.kind!=="style")throw D(e);return o.name}function Ke(o,e){if(o.kind!=="styles")throw D(e);return o.styles}function ve(o,e){if(o.kind!=="number")throw D(e);return o.value}function ge(o,e){if(o.kind!=="flag")throw D(e);return o.value}function bt(o,e){if(o.kind!=="pageSetup")throw D(e);return o.setup}function v(o,e){if(o.kind!=="applied")throw D(e)}function G(o){a({code:"NotImplemented",target:o,diagnostic:"edit.field-result-unsupported"});}var c=class o{label;#e;#t;isFieldResult;constructor(e,t,n=null,r=false){this.label=e,this.#e=t,this.#t=n,this.isFieldResult=r;}static fieldResult(e,t){return new o(e,{status:"pending"},t,true)}static of(e,t){return new o(e,{status:"resolved",address:{kind:"handle",handle:t}})}static ofSpan(e,t){return new o(e,{status:"resolved",address:{kind:"span",span:t}})}static pending(e){return new o(e,{status:"pending"})}static derived(e,t){return new o(e,{status:"pending"},t)}get state(){if(!this.#t)return this.#e;let e=this.#t.state;return !this.isFieldResult||e.status!=="resolved"||e.address.kind!=="handle"?e:{status:"resolved",address:{kind:"fieldResult",field:e.address.handle}}}get origin(){return this.#t?this.#t.origin:this}get isAddressable(){return this.state.status==="resolved"}get isPending(){return this.state.status==="pending"}get isNull(){return this.state.status==="null"}get isReleased(){return this.state.status==="released"}address(){let e=this.state;if(e.status==="resolved")return e.address;a({code:"InvalidObjectPath",target:this.label});}handle(){let e=this.address();return e.kind==="fieldResult"&&G(this.label),e.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.label}),e.handle}span(){let e=this.address();return e.kind==="fieldResult"&&G(this.label),e.kind!=="span"&&a({code:"InvalidObjectPath",target:this.label}),e.span}resolveTo(e){this.#n({kind:"handle",handle:e});}resolveToSpan(e){this.#n({kind:"span",span:e});}resolveNull(){this.#e.status!=="released"&&(this.#e={status:"null"});}release(){this.#t||(this.#e={status:"released"});}#n(e){this.#e.status!=="released"&&(this.#e={status:"resolved",address:e});}};function rn(o){let e=[],t=false,n=false;for(let r of o)e.push(r.plan()),r.sort==="write"?n=true:t=true;return {operations:e,hasRead:t,hasWrite:n}}var ro=Object.freeze({"stale-revision":"StaleDocument","invalid-handle":"InvalidObjectPath","invalid-offset":"InvalidArgument","unsupported-capability":"NotSupported",disposed:"RuntimeDisposed","transaction-refused":"GeneralException","unknown-operation":"NotSupported","unsupported-content":"InvalidArgument","unsupported-revision":"NotImplemented","ambiguous-document":"GeneralException","conflicting-operations":"ConflictingChanges","document-unavailable":"DocumentUnavailable"});function Re(o,e={}){let t=ro[o.code]??"GeneralException",n=t==="StaleDocument",r=automation.reviewSkipOfReason(o.detail),i=o.detail===void 0?null:automation.storeEditDiagnosticCode(o.detail)??r?.code??null,s=new x({code:t,...i===null?{}:{diagnostic:i},...e.target===void 0?{}:{target:e.target},...n&&e.expectedRevision!==void 0?{expectedRevision:e.expectedRevision}:{},...n&&e.actualRevision!==void 0?{actualRevision:e.actualRevision}:{}}),d=o.detail!==void 0&&!o.detail.includes(":"),l=r?r.cause??(d?automation.diagnosticCause(o.detail):void 0):automation.diagnosticCause(o.detail);return l&&sn.set(s,l),s}var sn=new WeakMap;function an(o){return sn.get(o)}function yt(o,e,t){for(let n=0;n<o.results.length;n+=1){let r=o.results[n];if(r?.status!=="error")continue;let i=e[n]?.label;return Re(r.error,{...i===void 0?{}:{target:i},...t===void 0?{}:{expectedRevision:t},actualRevision:o.revision})}return new x({code:"GeneralException"})}function xt(o,e){if(e.results.length!==o.length)throw new x({code:"GeneralException"});for(let t=0;t<o.length;t+=1){let n=e.results[t],r=o[t];if(n.status!=="ok")throw new x({code:"GeneralException",target:r.label});r.settle(n.value);}}var st=class{#e=[];#t=null;#n=[];get size(){return this.#e.length}get pending(){return this.#e}push(e){(this.#t??this.#e).push(e);}collect(e){let t=this.#t,n=[];this.#t=n;try{e();}finally{this.#t=t;}return n}continuing(e){this.#n.push(...this.collect(e));}takeContinuations(){let e=this.#n;this.#n=[];for(let t of e)t.capture?.();return e}take(){let e=this.#e;this.#e=[];for(let t of e)t.capture?.();return e}clear(){for(let e of this.#e)e.dispose?.();for(let e of this.#n)e.dispose?.();this.#e=[],this.#n=[];}};function dn(o,e){if(Array.isArray(o)){for(let t of o)e(t);return}e(o);}var Xe=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t;}add(e){this.#e.assertUsable(),dn(e,t=>{this.#n(t),this.#e.track(t);});}remove(e){this.#e.assertUsable(),dn(e,t=>{this.#n(t),this.#e.untrack(t);});}#n(e){this.#t(e)||a({code:"InvalidObjectPath"});}};var Ae=class o{#e;#t=new st;#n=new Set;#r=new Set;#s;#a;#d;#i=false;#o=null;#c=false;constructor(e){this.#e=e,this.#s={host:e.host,capabilities:e.capabilities,...e.author===void 0?{}:{author:e.author},revisionTextView:e.revisionTextView,queue:this.#t,session:e.id,roots:()=>e.roots(),assertUsable:t=>{this.#e.assertLive(t),this.#i&&a({code:"InvalidRequestContext",...t===void 0?{}:{target:t}});},isFinished:()=>this.#i,readRevision:()=>this.#o,register:t=>{this.#n.add(t);},track:t=>{this.#r.add(t);},untrack:t=>{this.#r.delete(t);},isTracked:t=>this.#r.has(t),disown:t=>{this.#n.delete(t),this.#r.delete(t);}},this.#a=new Xe(this.#s,t=>this.#n.has(t)),Object.defineProperty(this,Xt,{get:()=>e.author}),Object.defineProperty(this,Zt,{value:Object.freeze({writes:()=>this.#t.pending.filter(t=>t.sort==="write"&&!t.runtimeSetting).length})});}get document(){return this.#s.assertUsable("document"),this.#d??=this.#e.openDocument(this),this.#d}get capabilities(){return this.#e.capabilities}get trackedObjects(){return this.#a}async sync(){this.#s.assertUsable(),this.#c&&a({code:"InvalidRequestContext"});let e=this.#t.take();if(e.length!==0){this.#c=true;try{let t=e.filter(m=>!m.nullableLoad?.isNull),n=e.some(m=>m.sort==="write"),r,i=n&&this.#o!==null?this.#o:void 0,s=m=>m.dependencies?.some(b=>!b.isAddressable)??false,d=new Set(e.flatMap(m=>m.sort==="write"?m.produces??[]:[])),l=m=>m.sort==="read"&&(m.dependencies?.some(b=>!b.isAddressable&&d.has(b.origin))??false),h=d.size?t.filter(l):[];if(h.length){let m=new Set(h);t=t.filter(b=>!m.has(b));}for(;t.some(s);){r??=n&&this.#o!==null?this.#o:this.#e.host.revision();let m=t.filter(j=>j.sort==="read"&&!s(j));m.length===0&&a({code:"InvalidObjectPath",target:t.find(s)?.label}),await this.#p(m,r,i),await this.#h(r,i);let b=new Set(m);t=t.filter(j=>!b.has(j)&&!j.nullableLoad?.isNull);}let y=n?t.filter(m=>typeof m.continues=="function"?m.continues():m.continues===true):[];if(y.length){r??=this.#o!==null?this.#o:this.#e.host.revision(),await this.#p(y,r,i),await this.#h(r,i);let m=new Set(y);t=t.filter(b=>!m.has(b)&&!b.nullableLoad?.isNull);}if(t.length){let m=r??(n&&this.#o!==null?this.#o:void 0);await this.#p(t,m,i),await this.#h(this.#o??void 0,i);}h.length&&await this.#u(h,s);}finally{for(let t of e)t.dispose?.();for(let t of this.#t.takeContinuations())t.dispose?.();this.#c=false;}}}async#u(e,t){let n=e;try{for(;n.length;){let r=n.filter(d=>!t(d));r.length===0&&a({code:"InvalidObjectPath",target:n.find(t)?.label});let i=this.#o??void 0;await this.#p(r,i,void 0),await this.#h(i,void 0);let s=new Set(r);n=n.filter(d=>!s.has(d)&&!d.nullableLoad?.isNull);}}catch(r){throw Ue(r)?new x({code:r.code,...r.target===void 0?{}:{target:r.target},...r.expectedRevision===void 0?{}:{expectedRevision:r.expectedRevision},...r.actualRevision===void 0?{}:{actualRevision:r.actualRevision},diagnostic:"edit.read-after-commit"}):r}}async#h(e,t){let n=this.#t.takeContinuations();if(n.length!==0)try{await this.#p(n,e,t);}finally{for(let r of n)r.dispose?.();}}async#p(e,t,n){let r=rn(e);try{await this.#l(e,r,t,n);}catch(i){if(!Ue(i))try{this.#e.onException?.(i,r.operations);}catch{}throw i}}async#l(e,t,n,r){let i={operations:t.operations,...n===void 0?{}:{expectedRevision:n}};if(this.#e.host.prepare){let d={...i,expectedRevision:i.expectedRevision??this.#e.host.revision()};try{await this.#e.host.prepare(d);}catch(h){throw Ue(h)?this.#m(h,t.operations):h}let l=this.#e.host.execute(d);if(!l.ok)throw this.#m(yt(l,e,r),t.operations);xt(e,l),this.#o=l.revision;return}let s=this.#e.host.execute(i);if(!s.ok)throw this.#m(yt(s,e,r),t.operations);xt(e,s),(t.hasRead||t.hasWrite)&&(this.#o=s.revision);}#m(e,t){try{this.#e.onRefusal?.(e,t);}catch{}return e}get[me](){return this.#s}static begin(e){let t=new o(e);return {context:t,adopt(n){for(let r of n)t.#g(r);},finish(){t.#b();}}}#g(e){let t=e.context;if(t===this)return;let n=t[me];if(n.session!==this.#e.id)throw new x({code:"InvalidObjectPath"});if(!n.isFinished())throw new x({code:"ObjectInUse"});if(!n.isTracked(e))throw new x({code:"InvalidObjectPath"});let r=n.readRevision();n.disown(e),e[it](this),this.#n.add(e),this.#r.add(e),r!==null&&this.#f(r);}#f(e){this.#o=this.#o===null?e:Math.min(this.#o,e);}#b(){if(!this.#i){this.#i=true,this.#t.clear();for(let e of this.#n)this.#r.has(e)||e[rt]();this.#n.clear();}}};function Ze(o,e,t){if(o.select.length===0)return e;for(let n of o.select)e.includes(n)||a({code:"InvalidArgument",target:`${t}.${n}`});return o.select}var p=class extends z{revisionTextView(){return Y(this.context).revisionTextView}loadTextInto(e,t){let n=`${this.path.label}.${e}`;this.enqueue({sort:"read",label:n,plan:t,settle:r=>{this.setLoadedProperty(e,O(r,n));}});}command(e,t,n){let r=`${this.path.label}.${e}`;this.enqueue({sort:"write",label:r,plan:t,settle:i=>v(i,r),...n?{capture:n,dispose:n}:{}});}commandDiscarding(e,t){let n=`${this.path.label}.${e}`;this.enqueue({sort:"write",label:n,plan:t,settle:()=>{}});}commandAnswering(e,t,n,r){this.enqueue({sort:"write",label:e,plan:t,settle:n,...r?{capture:r,dispose:r}:{}});}commandCreating(e,t,n,r,i){this.enqueue({sort:"write",label:t,plan:n,settle:r,produces:[e.path],...i?{capture:i,dispose:i}:{}});}read(e,t,n){this.enqueue({sort:"read",label:e,plan:t,settle:n});}selection(e,t){return Ze(e,t,this.path.label)}onLoad(e){this.selection(e,[]);}};var io=["author","title","subject","keywords","comments","category","lastAuthor"],Ce=class o extends p{#e;static of(e,t){return new o(e,c.derived("document.properties",t))}constructor(e,t){super(e,t);}get lastAuthor(){return this.loadedProperty("lastAuthor")}get author(){return this.loadedProperty("author")}set author(e){this.#t("author",e);}get title(){return this.loadedProperty("title")}set title(e){this.#t("title",e);}get subject(){return this.loadedProperty("subject")}set subject(e){this.#t("subject",e);}get keywords(){return this.loadedProperty("keywords")}set keywords(e){this.#t("keywords",e);}get comments(){return this.loadedProperty("comments")}set comments(e){this.#t("comments",e);}get category(){return this.loadedProperty("category")}set category(e){this.#t("category",e);}onLoad(e){for(let t of this.selection(e,io))this.read(`${this.path.label}.${t}`,()=>({op:"getDocumentProperty",name:t}),n=>this.setLoadedProperty(t,O(n,this.path.label)));}#t(e,t){if(this.requireUsablePath(),(typeof t!="string"||t.length>4096)&&a({code:"InvalidArgument",target:`${this.path.label}.${e}`}),this.#e){this.#e[e]=t;return}let n={[e]:t};this.#e=n,this.commandAnswering(this.path.label,()=>({op:"setDocumentProperties",values:n}),r=>{v(r,this.path.label);},()=>{this.#e===n&&(this.#e=void 0);});}};function I(o,e){let t=o.address();return t.kind==="fieldResult"&&G(o.label),e==="span"?(t.kind!=="span"&&a({code:"InvalidObjectPath",target:o.label}),{start:t.span.start,end:t.span.end}):(t.kind!=="handle"&&a({code:"InvalidObjectPath",target:o.label}),e==="body"?{body:t.handle}:{paragraph:t.handle})}function Pe(o,e){return (typeof o!="string"||o.trim().length===0||o.length>255)&&a({code:"InvalidArgument",target:e}),o}function vt(o){return [...new Set([...o.select.filter(e=>e!=="items"),...o.itemSelect])]}var Ye=class{#e;#t=new Set;join(e,t,n){this.#e??=new Set;for(let r of e)this.#e.add(r);return this.#t.has(ln(t,n))}open(e,t,n){let r=this.#e??=new Set,i=ln(e,t);this.#t.add(i);let s=false,d=()=>{s||(s=true,this.#t.delete(i),this.#t.size===0&&(this.#e=void 0));};try{n(r,d);}catch(l){throw d(),l}}};function ln(o,e){return `${String(o)}:${e===void 0?"":String(e)}`}function Rt(o,e,t){return t===void 0?o:Math.min(o,e+t)}var F=class extends z{#e;#t=[];#n=new Ye;constructor(e,t){super(e,t);}get items(){return this.loadedProperty("items")}fill(e,t){this.setLoadedProperty("items",this.#a(e,t,0,void 0)),this.#e={value:e,label:t};let n=this.#t.splice(0,this.#t.length);for(let r of n)this.#s(r,e);}get loadsItemPaths(){return true}onLoad(e){let t=vt(e);t.length>0&&this.#r(t);let n=this.path.isPending?void 0:this.listing(),r=`${this.path.label}.items`,i=e.skip??0,s=e.top,d=e.skip!==void 0||s!==void 0;if(n===null){if(t.length===0&&!d)return;let l=this.#e;l||a({code:"NotImplemented",target:r});let h=this.#a(l.value,l.label,i,s);if(this.setLoadedProperty("items",h),t.length>0)for(let y of h)y.load(t);return}this.#n.join(t,i,s)||this.#n.open(i,s,(l,h)=>this.enqueue({sort:"read",label:r,continues:()=>l.size>0,capture:h,dispose:h,plan:()=>{let y=n??this.listing();return y||a({code:"InvalidObjectPath",target:this.path.label}),y},settle:y=>{let m=this.#a(y,r,i,s);this.setLoadedProperty("items",m);let b=[...l];b.length!==0&&this.internals.queue.continuing(()=>{for(let j of m)j.load(b);});}}));}#r(e){let t=this.promised(`${this.path.label}.items`,false),n=this.internals.queue.collect(()=>{try{t.load(e);}catch(r){if(r.code==="InvalidArgument")throw r}});for(let r of n)r.dispose?.();}edge(e,t,n){let r=`${this.path.label}.${t}()`,i=this.promised(r,n),s=this.path.isPending?void 0:this.listing();if(s===null){let d={edge:e,target:r,nullable:n,item:i};return this.#e?this.#s(d,this.#e.value):this.#t.push(d),i}return this.enqueue({sort:"read",label:r,plan:()=>{let d=s??this.listing();return d||a({code:"InvalidObjectPath",target:this.path.label}),d},settle:d=>{this.#s({edge:e,target:r,nullable:n,item:i},d);}}),i}#s(e,t){let{edge:n,target:r,nullable:i,item:s}=e,d=this.size(t,r);if(d===0){i||a({code:"ItemNotFound",target:r}),s.hydrateNull();return}let l=this.addressAt(t,r,n==="first"?0:d-1);l||a({code:"ItemNotFound",target:r}),s.hydrateAddress(l);}#a(e,t,n,r){let i=this.size(e,t),s=Rt(i,n,r),d=[];for(let l=n;l<s;l+=1){let h=this.addressAt(e,t,l);h&&d.push(this.itemAt(`${t}[${String(l)}]`,h));}return d}},k=class extends F{size(e,t){return w(e,t).length}addressAt(e,t,n){let r=w(e,t)[n];return r?{kind:"handle",handle:r}:void 0}};var At=(d=>(d.noFill="NoFill",d.solid="Solid",d.gradient="Gradient",d.pattern="Pattern",d.picture="Picture",d.texture="Texture",d.mixed="Mixed",d))(At||{}),so=["type","foregroundColor","transparency"],Oe=class o extends p{#e;#t;static of(e,t,n,r){return new o(e,c.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}get type(){return this.loadedProperty("type")}get foregroundColor(){return this.loadedProperty("foregroundColor")}set foregroundColor(e){this.#n({color:cn(e,`${this.path.label}.foregroundColor`)});}get transparency(){return this.loadedProperty("transparency")}set transparency(e){(typeof e!="number"||!(e>=0&&e<=1))&&a({code:"InvalidArgument",target:`${this.path.label}.transparency`}),this.#n({transparency:e});}clear(){this.#n({clear:true});}get backgroundColor(){return a({code:"NotSupported",target:`${this.path.label}.backgroundColor`})}set backgroundColor(e){a({code:"NotSupported",target:`${this.path.label}.backgroundColor`});}set(e){a({code:"NotSupported",target:`${this.path.label}.set`});}setSolidColor(e){this.#n({color:cn(e,`${this.path.label}.setSolidColor`)});}onLoad(e){let t=this.selection(e,so);t.length&&this.read(this.path.label,()=>({op:"getShapeFill",shape:this.#e()}),n=>{let r=gt(n,this.path.label);for(let i of t)this.setLoadedProperty(i,r[i]);});}#n(e){if(this.requireUsablePath(),this.#t){"clear"in e||"clear"in this.#t?this.#r(e):Object.assign(this.#t,e);return}let t={value:{...e}};this.#t=t.value,this.#r=n=>{t.value={...n},this.#t=t.value;},this.commandAnswering(this.path.label,()=>({op:"setShapeFill",shape:this.#e(),fill:t.value}),n=>v(n,this.path.label),()=>{this.#t===t.value&&(this.#t=void 0);});}#r=()=>{}};function cn(o,e){return (typeof o!="string"||o.length===0||o.length>32)&&a({code:"InvalidArgument",target:e}),o}var at=(s=>(s.unsupported="Unsupported",s.textBox="TextBox",s.geometricShape="GeometricShape",s.group="Group",s.picture="Picture",s.canvas="Canvas",s))(at||{}),ao=["id","name","type"],un=new Set(Object.values(at)),we=class o extends p{#e;#t;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,c.of(t,n.handle),false)}static promised(e,t,n){return new o(e,c.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get id(){return this.loadedProperty("id")}get name(){return this.loadedProperty("name")}get type(){return this.loadedProperty("type")}get body(){if(this.#e)return this.#e;let e=`${this.path.label}.body`,t=E.promisedStory(this.context,e);return this.read(e,()=>({op:"getShapeBody",shape:this.#n()}),n=>{t.hydrateAddress({kind:"handle",handle:A(n,e)});}),this.#e=t,t}get fill(){return this.#t??=Oe.of(this.context,`${this.path.label}.fill`,this.path,()=>this.#n()),this.#t}onLoad(e){let t=this.selection(e,ao);t.length&&this.read(this.path.label,()=>({op:"getShape",shape:this.#n()}),n=>{(n.kind!=="shape"||!un.has(n.shape.type))&&a({code:"GeneralException",target:this.path.label});for(let r of t)this.setLoadedProperty(r,n.shape[r]);});}#n(){return this.requireAddressable(),this.path.handle()}},ne=class o extends F{#e;#t;static of(e,t,n,r,i){return new o(e,c.derived(t,n),r,i)}constructor(e,t,n,r){super(e,t),this.#e=n,this.#t=r;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}getByTypes(e){let t=`${this.path.label}.getByTypes`;(!Array.isArray(e)||e.some(r=>!un.has(r)))&&a({code:"InvalidArgument",target:t});let n=this.#t?this.#t.filter(r=>e.includes(r)):[...e];return o.of(this.context,t,this.path,this.#e,n)}listing(){let e=I(this.path,this.#e);return this.#t?{op:"getShapes",span:e,types:this.#t}:{op:"getShapes",span:e}}size(e,t){return w(e,t).length}addressAt(e,t,n){let r=w(e,t)[n];return r?{kind:"handle",handle:r}:void 0}itemAt(e,t){return we.at(this.context,e,t)}promised(e,t){return we.promised(this.context,e,t)}};function lo(o){return o==="endnote"?"Endnote":"Footnote"}var ke=class o extends p{#e;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,c.of(t,n.handle),false)}static promised(e,t,n){return new o(e,c.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get type(){return this.loadedProperty("type")}get text(){return this.loadedProperty("text")}get body(){if(this.#e)return this.#e;let e=`${this.path.label}.body`,t=E.promisedStory(this.context,e);return this.read(e,()=>({op:"getNoteBody",note:this.#t()}),n=>{t.hydrateAddress({kind:"handle",handle:A(n,e)});}),this.#e=t,t}delete(){this.command("delete",()=>({op:"deleteNote",note:this.#t()}));}getNext(){let e=`${this.path.label}.getNext`,t=o.promised(this.context,e,false),n=this.internals.roots().document,r=`${e}.type`,i="footnote",s=c.pending(r);return this.read(r,()=>({op:"getNoteKind",note:this.#t()}),d=>{i=O(d,r)==="endnote"?"endnote":"footnote",s.resolveTo(this.#t());}),this.enqueue({sort:"read",label:e,dependencies:[s],plan:()=>({op:"getNotes",document:n,noteKind:i}),settle:d=>{let l=w(d,e),h=l.findIndex(m=>m.ref===this.#t().ref),y=h<0?void 0:l[h+1];y||a({code:"ItemNotFound",target:e}),t.hydrateAddress({kind:"handle",handle:y});}}),t}onLoad(e){let t=this.selection(e,["text","type"]);if(t.includes("text")&&this.loadTextInto("text",()=>({op:"getNoteText",note:this.#t(),projection:this.revisionTextView()})),t.includes("type")){let n=`${this.path.label}.type`;this.read(n,()=>({op:"getNoteKind",note:this.#t()}),r=>{this.setLoadedProperty("type",lo(O(r,n)));});}}#t(){return this.requireAddressable(),this.path.handle()}},Q=class o extends k{#e;static of(e,t,n,r){return new o(e,c.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#e()}itemAt(e,t){return ke.at(this.context,e,t)}promised(e,t){return ke.promised(this.context,e,t)}};var Ct=(i=>(i.replace="Replace",i.start="Start",i.end="End",i.before="Before",i.after="After",i))(Ct||{}),Pt=(s=>(s.whole="Whole",s.start="Start",s.end="End",s.before="Before",s.after="After",s.content="Content",s))(Pt||{}),Ot=(t=>(t.original="Original",t.current="Current",t))(Ot||{}),wt=(s=>(s.mixed="Mixed",s.unknown="Unknown",s.left="Left",s.centered="Centered",s.right="Right",s.justified="Justified",s))(wt||{}),kt=(t=>(t.portrait="Portrait",t.landscape="Landscape",t))(kt||{}),St=(n=>(n.off="Off",n.trackAll="TrackAll",n.trackMineOnly="TrackMineOnly",n))(St||{}),It=(r=>(r.mixed="Mixed",r.top="Top",r.center="Center",r.bottom="Bottom",r))(It||{}),Lt=(d=>(d.line="Line",d.page="Page",d.next="Next",d.sectionNext="SectionNext",d.sectionContinuous="SectionContinuous",d.sectionEven="SectionEven",d.sectionOdd="SectionOdd",d))(Lt||{}),Tt=(S=>(S.unknown="Unknown",S.richText="RichText",S.plainText="PlainText",S.picture="Picture",S.buildingBlockGallery="BuildingBlockGallery",S.checkBox="CheckBox",S.comboBox="ComboBox",S.datePicker="DatePicker",S.dropDownList="DropDownList",S.group="Group",S.repeatingSection="RepeatingSection",S.plainTextInline="PlainTextInline",S.plainTextParagraph="PlainTextParagraph",S.richTextInline="RichTextInline",S.richTextParagraphs="RichTextParagraphs",S.richTextTable="RichTextTable",S.richTextTableCell="RichTextTableCell",S.richTextTableRow="RichTextTableRow",S))(Tt||{}),jt=(f=>(f.all="All",f.atMentions="AtMentions",f.commentReactions="CommentReactions",f.comments="Comments",f.contentType="ContentType",f.documentIntelligence="DocumentIntelligence",f.documentManagementPolicy="DocumentManagementPolicy",f.documentProperties="DocumentProperties",f.documentServerProperties="DocumentServerProperties",f.documentTasks="DocumentTasks",f.documentWorkspace="DocumentWorkspace",f.emailHeader="EmailHeader",f.inkAnnotations="InkAnnotations",f.removePersonalInformation="RemovePersonalInformation",f.revisions="Revisions",f.routingSlip="RoutingSlip",f.sendForReview="SendForReview",f.taskpaneWebExtensions="TaskpaneWebExtensions",f.template="Template",f.versions="Versions",f))(jt||{}),Et=(n=>(n.compareTargetCurrent="CompareTargetCurrent",n.compareTargetNew="CompareTargetNew",n.compareTargetSelected="CompareTargetSelected",n))(Et||{});var co=["Replace","Start","End"],uo=["Start","End"],ho=["Replace","Start","End"],po=["Before","After"],mo=["Replace","Start","End","Before","After"],go=["Select","Start","End"];function Se(o,e,t){return (typeof o!="string"||!e.includes(o))&&a({code:"InvalidArgument",target:t}),o}var Dt=(o,e)=>Se(o,co,e),hn=(o,e)=>Se(o,uo,e),pn=(o,e)=>Se(o,ho,e),mn=(o,e)=>Se(o,po,e),oe=(o,e)=>Se(o,mo,e),dt=(o,e)=>o===void 0?"Select":Se(o,go,e);function K(o,e){return typeof o!="string"&&a({code:"InvalidArgument",target:e}),/[\r\n\f\u2028\u2029]/.test(o)&&a({code:"InvalidArgument",target:e}),o}function Ie(o,e){return typeof o!="string"&&a({code:"InvalidArgument",target:e}),/[\f\u2028\u2029]/.test(o)&&a({code:"InvalidArgument",target:e}),o}function gn(o){let e=o.address();return e.kind!=="fieldResult"&&a({code:"InvalidObjectPath",target:o.label}),e.field}function fn(o,e){return ()=>({op:"getFieldResult",field:gn(o),projection:e})}function bn(o,e,t,n){oe(t,n)!=="Replace"&&G(n),(typeof e!="string"||/[\r\n\f\u2028\u2029]/.test(e))&&a({code:"InvalidArgument",target:n,diagnostic:"edit.invalid-argument"});let r=e;return ()=>({op:"setFieldResult",field:gn(o),text:r})}var fo=["width","height","lockAspectRatio","altTextDescription"],re=class o extends p{#e;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,c.of(t,n.handle),false)}static promised(e,t,n){return new o(e,c.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get width(){return this.loadedProperty("width")}set width(e){this.#t("width",e);}get height(){return this.loadedProperty("height")}set height(e){this.#t("height",e);}get lockAspectRatio(){return this.loadedProperty("lockAspectRatio")}set lockAspectRatio(e){typeof e!="boolean"&&a({code:"InvalidArgument",target:`${this.path.label}.lockAspectRatio`}),this.#n({lockAspectRatio:e});}get altTextDescription(){return this.loadedProperty("altTextDescription")}set altTextDescription(e){typeof e!="string"&&a({code:"InvalidArgument",target:`${this.path.label}.altTextDescription`}),this.#n({altTextDescription:e});}delete(){let e=`${this.path.label}.delete`;this.commandAnswering(e,()=>({op:"deleteInlinePicture",picture:this.#r()}),t=>v(t,e));}onLoad(e){let t=this.selection(e,fo);t.length&&this.read(this.path.label,()=>({op:"getInlinePicture",picture:this.#r()}),n=>{n.kind!=="inlinePicture"&&a({code:"GeneralException",target:this.path.label});for(let r of t)this.setLoadedProperty(r,n.picture[r]);});}#t(e,t){(typeof t!="number"||!Number.isFinite(t)||t<=0)&&a({code:"InvalidArgument",target:`${this.path.label}.${e}`}),this.#n({[e]:t});}#n(e){if(this.requireUsablePath(),this.#e){Object.assign(this.#e,e);return}let t=e;this.#e=t,this.commandAnswering(this.path.label,()=>({op:"setInlinePicture",picture:this.#r(),properties:t}),n=>v(n,this.path.label),()=>{this.#e===t&&(this.#e=void 0);});}#r(){this.requireAddressable();let e=this.path.address();return e.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.path.label}),e.handle}},ie=class o extends F{#e;static of(e,t,n,r){return new o(e,c.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}getLast(){return this.edge("last","getLast",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}getLastOrNullObject(){return this.edge("last","getLastOrNullObject",true)}listing(){return {op:"getInlinePictures",span:I(this.path,this.#e)}}size(e,t){return w(e,t).length}addressAt(e,t,n){let r=w(e,t)[n];return r?{kind:"handle",handle:r}:void 0}itemAt(e,t){return re.at(this.context,e,t)}promised(e,t){return re.promised(this.context,e,t)}};function T(o,e,t=0){return (!Number.isInteger(o)||o<t)&&a({code:"InvalidArgument",target:e}),o}function Je(o,e){return (!Array.isArray(o)||o.some(t=>!Array.isArray(t)||t.some(n=>typeof n!="string")))&&a({code:"InvalidArgument",target:e}),o.map(t=>[...t])}function Te(o,e,t,n,r,i,s){T(r,e,1),T(i,e,1);let d=s===void 0?void 0:Je(s,e),l=fe.promised(o,e);return {table:l,plan:()=>({op:"insertTable",span:t(),location:n,rowCount:r,columnCount:i,...d?{values:d}:{}}),settle:h=>{h.kind!=="handle"&&a({code:"GeneralException",target:e}),l.hydrateAddress({kind:"handle",handle:h.handle});}}}function yn(o,e){return o!=="Start"&&o!=="End"&&a({code:"InvalidArgument",target:e}),o==="Start"?"start":"end"}var fe=class o extends p{#e;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,c.of(t,n.handle),false)}static promised(e,t,n=false){return new o(e,c.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get values(){return this.loadedProperty("values")}set values(e){let t=Je(e,`${this.path.label}.values`);this.command("values",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"values",values:t}}));}get style(){return this.loadedProperty("style")}set style(e){typeof e!="string"&&a({code:"InvalidArgument",target:`${this.path.label}.style`}),this.command("style",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"properties",styleId:e}}));}get headerRowCount(){return this.loadedProperty("headerRowCount")}set headerRowCount(e){T(e,`${this.path.label}.headerRowCount`),this.command("headerRowCount",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"properties",headerRowCount:e}}));}get rowCount(){return this.loadedProperty("rowCount")}get columnCount(){return this.loadedProperty("columnCount")}get rows(){return this.#e??=be.of(this.context,`${this.path.label}.rows`,this.path,()=>({op:"getTableRows",table:this.path.handle()}))}getCell(e,t){let n=`${this.path.label}.getCell`;T(e,n),T(t,n);let r=se.promised(this.context,n);return this.read(n,()=>({op:"getTableCell",table:this.path.handle(),rowIndex:e,cellIndex:t}),i=>r.hydrateAddress({kind:"handle",handle:A(i,n)})),r}addRows(e,t,n){let r=`${this.path.label}.addRows`,i=yn(e,r);T(t,r,1);let s=n===void 0?void 0:Je(n,r),d=be.of(this.context,r,this.path,()=>null);return this.commandAnswering(r,()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"addRows",location:i,count:t,...s?{values:s}:{}}}),l=>d.fill(l,r)),d}addColumns(e,t,n){let r=`${this.path.label}.addColumns`,i=yn(e,r);T(t,r,1);let s=n===void 0?void 0:Je(n,r);this.command("addColumns",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"addColumns",location:i,count:t,...s?{values:s}:{}}}));}deleteRows(e,t){t===void 0&&(t=1),T(e,this.path.label),T(t,this.path.label,1),this.command("deleteRows",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"deleteRows",index:e,count:t}}));}deleteColumns(e,t){t===void 0&&(t=1),T(e,this.path.label),T(t,this.path.label,1),this.command("deleteColumns",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"deleteColumns",index:e,count:t}}));}mergeCells(e,t,n,r){let i=`${this.path.label}.mergeCells`;T(e,i),T(t,i),T(n,i),T(r,i),n<e&&a({code:"InvalidArgument",target:i});let s=se.promised(this.context,i);return this.read(i,()=>({op:"getMergedTableCell",table:this.path.handle(),topRow:e,firstCell:t,bottomRow:n,lastCell:r}),d=>s.hydrateAddress({kind:"handle",handle:A(d,i)})),this.command("mergeCells",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"mergeCells",topRow:e,firstCell:t,bottomRow:n,lastCell:r}})),s}delete(){this.command("delete",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"delete"}}));}onLoad(e){let t=this.selection(e,["values","style","headerRowCount","rowCount","columnCount"]);this.read(this.path.label,()=>({op:"getTable",table:this.path.handle()}),n=>{n.kind!=="table"&&a({code:"GeneralException",target:this.path.label});for(let r of t)this.setLoadedProperty(r,n.table[r]);});}},Le=class o extends p{#e;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,c.of(t,n.handle),false)}static promised(e,t,n=false){return new o(e,c.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}insertRows(e,t,n){let r=`${this.path.label}.insertRows`;e!=="Before"&&e!=="After"&&a({code:"InvalidArgument",target:r}),T(t,r,1);let i=n===void 0?void 0:Je(n,r),s=be.of(this.context,r,this.path,()=>null);return this.commandAnswering(r,()=>({op:"insertTableRows",row:this.path.handle(),location:e==="Before"?"before":"after",count:t,...i?{values:i}:{}}),d=>s.fill(d,r)),s}get cells(){return this.#e??=_e.of(this.context,`${this.path.label}.cells`,this.path,()=>({op:"getTableCells",row:this.path.handle()}))}},se=class o extends p{#e;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,c.of(t,n.handle),false)}static promised(e,t,n=false){return new o(e,c.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get body(){if(this.#e)return this.#e;let e=`${this.path.label}.body`,t=E.promisedStory(this.context,e);return this.read(e,()=>({op:"getTableCellBody",cell:this.path.handle()}),n=>t.hydrateAddress({kind:"handle",handle:A(n,e)})),this.#e=t,t}get value(){return this.loadedProperty("value")}set value(e){typeof e!="string"&&a({code:"InvalidArgument",target:`${this.path.label}.value`}),this.command("value",()=>({op:"updateTableCell",cell:this.path.handle(),properties:{value:e}}));}get columnWidth(){return this.loadedProperty("columnWidth")}set columnWidth(e){(typeof e!="number"||!Number.isFinite(e)||e<=0)&&a({code:"InvalidArgument",target:`${this.path.label}.columnWidth`}),this.command("columnWidth",()=>({op:"updateTableCell",cell:this.path.handle(),properties:{columnWidth:e}}));}get shadingColor(){return this.loadedProperty("shadingColor")}set shadingColor(e){typeof e!="string"&&a({code:"InvalidArgument",target:`${this.path.label}.shadingColor`}),this.command("shadingColor",()=>({op:"updateTableCell",cell:this.path.handle(),properties:{shadingColor:e}}));}get verticalAlignment(){return this.loadedProperty("verticalAlignment")}set verticalAlignment(e){e!=="Top"&&e!=="Center"&&e!=="Bottom"&&a({code:"InvalidArgument",target:`${this.path.label}.verticalAlignment`}),this.command("verticalAlignment",()=>({op:"updateTableCell",cell:this.path.handle(),properties:{verticalAlignment:e}}));}split(e,t){let n=`${this.path.label}.split`;T(e,n,1),T(t,n,1),(e>63||t>63||e*t<2)&&a({code:"InvalidArgument",target:n}),this.command("split",()=>({op:"splitTableCell",cell:this.path.handle(),rowCount:e,columnCount:t}));}onLoad(e){let t=this.selection(e,["value","columnWidth","shadingColor","verticalAlignment"]);this.read(this.path.label,()=>({op:"getTableCellProperties",cell:this.path.handle()}),n=>{n.kind!=="tableCell"&&a({code:"GeneralException",target:this.path.label});for(let r of t)this.setLoadedProperty(r,n.cell[r]);});}},ae=class o extends k{#e;static of(e,t,n,r){return new o(e,c.derived(t,n),r)}static over(e,t,n,r){return o.of(e,t,n,()=>({op:"getTables",scope:r()}))}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}listing(){return this.#e()}itemAt(e,t){return fe.at(this.context,e,t)}promised(e,t){return fe.promised(this.context,e,t)}},be=class o extends k{#e;static of(e,t,n,r){return new o(e,c.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}listing(){return this.#e()}itemAt(e,t){return Le.at(this.context,e,t)}promised(e,t){return Le.promised(this.context,e,t)}},_e=class o extends k{#e;static of(e,t,n,r){return new o(e,c.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}listing(){return this.#e()}itemAt(e,t){return se.at(this.context,e,t)}promised(e,t){return se.promised(this.context,e,t)}};var vn=4096,J=class o extends p{#e;#t=new Map;#n;#r;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,c.of(t,n.handle),false)}static promised(e,t,n){return new o(e,c.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get id(){return this.loadedProperty("id")}get tag(){return this.loadedProperty("tag")}set tag(e){this.#a("tag",{tag:Nt(e,`${this.path.label}.tag`)});}get title(){return this.loadedProperty("title")}set title(e){this.#a("title",{title:Nt(e,`${this.path.label}.title`)});}get subtype(){return this.loadedProperty("subtype")}get isBound(){return this.loadedProperty("isBound")}get cannotDelete(){let e=this.loadedProperty("lock");return e==="sdtLocked"||e==="sdtContentLocked"}set cannotDelete(e){this.#d("cannotDelete",e);}get cannotEdit(){let e=this.loadedProperty("lock");return e==="contentLocked"||e==="sdtContentLocked"}set cannotEdit(e){this.#d("cannotEdit",e);}get placeholderShown(){return this.loadedProperty("placeholderShown")}get temporary(){return this.loadedProperty("temporary")}get text(){return this.loadedProperty("text")}get paragraphs(){return this.#n??=q.overListing(this.context,`${this.path.label}.paragraphs`,this.path,()=>({op:"getContentControlParagraphs",contentControl:this.#i()})),this.#n}get contentControls(){return this.#r??=N.of(this.context,`${this.path.label}.contentControls`,this.path,{contentControl:this.#i()}),this.#r}getRange(e){let t=`${this.path.label}.getRange`,n=bo(e??"Whole",t),r=this.#t.get(n);if(r)return r;let i=this.#s(t,n);return this.#t.set(n,i),i}setValue(e){let t=`${this.path.label}.setValue`,n=yo(e,t);this.command("setValue",()=>({op:"setContentControlValue",contentControl:this.#i(),value:n}));}insertText(e,t){let n=`${this.path.label}.insertText`,r=K(e,n),i=t==="Replace"?"replace":t==="Start"?"start":t==="End"?"end":a({code:"InvalidArgument",target:n}),s=R.promised(this.context,n,false);return this.commandCreating(s,n,()=>({op:"insertContentControlText",contentControl:this.#i(),text:r,at:i}),d=>{s.hydrateAddress({kind:"span",span:P(d,n)});}),s}delete(e){let t=`${this.path.label}.delete`;typeof e!="boolean"&&a({code:"InvalidArgument",target:t}),this.command("delete",()=>({op:"deleteContentControl",contentControl:this.#i(),keepContent:e}));}onLoad(e){let t=this.selection(e,["id","tag","title","subtype","isBound","text","cannotDelete","cannotEdit","placeholderShown","temporary"]);if(t.includes("id")&&this.loadTextInto("id",()=>({op:"getContentControlFileId",contentControl:this.#i()})),t.includes("tag")&&this.loadTextInto("tag",()=>({op:"getContentControlTag",contentControl:this.#i()})),t.includes("title")&&this.loadTextInto("title",()=>({op:"getContentControlTitle",contentControl:this.#i()})),t.includes("subtype")&&this.loadTextInto("subtype",()=>({op:"getContentControlSubtype",contentControl:this.#i()})),t.includes("isBound")){let r=`${this.path.label}.isBound`;this.read(r,()=>({op:"getContentControlIsBound",contentControl:this.#i()}),i=>{this.setLoadedProperty("isBound",ge(i,r));});}if(t.includes("text")&&this.loadTextInto("text",()=>({op:"getContentControlText",contentControl:this.#i(),projection:this.revisionTextView()})),t.includes("cannotDelete")||t.includes("cannotEdit")){let r=`${this.path.label}.lock`;this.read(r,()=>({op:"getContentControlLock",contentControl:this.#i()}),i=>{this.setLoadedProperty("lock",O(i,r));});}if(t.includes("placeholderShown")){let r=`${this.path.label}.placeholderShown`;this.read(r,()=>({op:"getContentControlPlaceholderShown",contentControl:this.#i()}),i=>{this.setLoadedProperty("placeholderShown",ge(i,r));});}if(!t.includes("temporary"))return;let n=`${this.path.label}.temporary`;this.read(n,()=>({op:"getContentControlTemporary",contentControl:this.#i()}),r=>{this.setLoadedProperty("temporary",ge(r,n));});}#s(e,t){let n=R.promised(this.context,e,false);return this.read(e,()=>({op:"getContentControlRange",contentControl:this.#i(),location:t}),r=>{n.hydrateAddress({kind:"span",span:P(r,e)});}),n}#a(e,t){this.command(e,()=>({op:"setContentControlProperties",contentControl:this.#i(),...t}));}#d(e,t){let n=`${this.path.label}.${e}`;if(typeof t!="boolean"&&a({code:"InvalidArgument",target:n}),this.requireUsablePath(),this.#e){this.#e[e]=t;return}let r={[e]:t};this.#e=r,this.command(e,()=>({op:"setContentControlProperties",contentControl:this.#i(),...r}),()=>{this.#e===r&&(this.#e=void 0);});}#i(){return this.requireAddressable(),this.path.handle()}},N=class o extends k{#e;#t;static of(e,t,n,r){let i=typeof r=="function"?r:()=>r;return new o(e,c.derived(t,n),i,()=>({op:"getContentControls",scope:i()}))}constructor(e,t,n,r){super(e,t),this.#e=n,this.#t=r;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}getById(e){let t=`${this.path.label}.getById`;Number.isInteger(e)||a({code:"InvalidArgument",target:t});let n=this.#e,r=J.promised(this.context,t,false);return this.enqueue({sort:"read",label:t,plan:()=>({op:"getContentControlById",scope:n(),id:e}),settle:i=>{r.hydrateAddress({kind:"handle",handle:A(i,t)});}}),r}getByTag(e){let t=`${this.path.label}.getByTag`,n=xn(e,t),r=this.#e;return new o(this.context,c.derived(t,this.path),r,()=>({op:"getContentControlsByTag",scope:r(),tag:n}))}getByTitle(e){let t=`${this.path.label}.getByTitle`,n=xn(e,t),r=this.#e;return new o(this.context,c.derived(t,this.path),r,()=>({op:"getContentControlsByTitle",scope:r(),title:n}))}listing(){return this.#t()}itemAt(e,t){return J.at(this.context,e,t)}promised(e,t){return J.promised(this.context,e,t)}};function Nt(o,e){return (typeof o!="string"||o.length>vn)&&a({code:"InvalidArgument",target:e}),o}function xn(o,e){let t=Nt(o,e);return t.length===0&&a({code:"InvalidArgument",target:e}),t}function bo(o,e){switch(o){case "Whole":return "whole";case "Content":return "content";case "Start":return "start";case "End":return "end";case "Before":return "before";case "After":return "after";default:return a({code:"InvalidArgument",target:e})}}function yo(o,e){(typeof o!="object"||o===null)&&a({code:"InvalidArgument",target:e});let t=o;if(t.kind==="text"||t.kind==="listItem"){let n=t.kind==="text"?t.text:t.value;return (typeof n!="string"||n.length>vn)&&a({code:"InvalidArgument",target:e}),t.kind==="text"?{kind:"text",text:n}:{kind:"listItem",value:n}}if(t.kind==="checkbox")return typeof t.checked!="boolean"&&a({code:"InvalidArgument",target:e}),{kind:"checkbox",checked:t.checked};if(t.kind==="date")return (typeof t.iso!="string"||t.iso.length>64)&&a({code:"InvalidArgument",target:e}),{kind:"date",iso:t.iso};a({code:"InvalidArgument",target:e});}var xo=8,Bt=(d=>(d.custom="Custom",d.solid="Solid",d.hollow="Hollow",d.square="Square",d.diamonds="Diamonds",d.arrow="Arrow",d.checkmark="Checkmark",d))(Bt||{}),$t=(s=>(s.none="None",s.arabic="Arabic",s.upperRoman="UpperRoman",s.lowerRoman="LowerRoman",s.upperLetter="UpperLetter",s.lowerLetter="LowerLetter",s))($t||{}),U=class o extends p{#e;#t=new Map;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,c.of(t,n.handle),false)}static promised(e,t,n){return new o(e,c.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get id(){return this.loadedProperty("id")}get paragraphs(){return this.#e??=q.overListing(this.context,`${this.path.label}.paragraphs`,this.path,()=>({op:"getListParagraphs",list:this.#r()})),this.#e}getLevelParagraphs(e){let t=`${this.path.label}.getLevelParagraphs`,n=qt(e,t);return q.overListing(this.context,t,this.path,()=>({op:"getListParagraphs",list:this.#r(),level:n}))}insertParagraph(e,t){let n=`${this.path.label}.insertParagraph`,r=K(e,n);t!=="Start"&&t!=="End"&&t!=="Before"&&t!=="After"&&a({code:"InvalidArgument",target:n});let i=B.promised(this.context,n,false);return this.commandCreating(i,n,()=>({op:"insertListParagraph",list:this.#r(),where:t==="Start"||t==="Before"?"start":"end",text:r}),s=>{i.hydrateAddress({kind:"handle",handle:A(s,n)});}),i}setLevelBullet(e,t,n,r){this.#n(e,{bullet:t,...n===void 0?{}:{charCode:n},...r===void 0?{}:{fontName:r}});}setLevelNumbering(e,t,n){this.#n(e,{numbering:t,...n===void 0?{}:{formatString:[...n]}});}setLevelStartingNumber(e,t){this.#n(e,{startingNumber:t});}setLevelIndents(e,t,n){this.#n(e,{textIndent:t,bulletNumberPictureIndent:n});}#n(e,t){let n=`${this.path.label}.levelFormat`,r=qt(e,n);this.requireUsablePath();let i=this.#t.get(r);if(i){Object.assign(i,t),"bullet"in t&&(delete i.numbering,delete i.formatString),"numbering"in t&&(delete i.bullet,delete i.charCode,delete i.fontName);return}let s={...t};this.#t.set(r,s),this.commandAnswering(n,()=>({op:"setListLevelFormat",list:this.#r(),level:r,format:s}),d=>{v(d,n);},()=>{this.#t.get(r)===s&&this.#t.delete(r);});}onLoad(e){if(!this.selection(e,["id"]).includes("id"))return;let t=`${this.path.label}.id`;this.read(t,()=>({op:"getListId",list:this.#r()}),n=>{this.setLoadedProperty("id",ve(n,t));});}#r(){return this.requireAddressable(),this.path.handle()}},je=class o extends k{#e;static of(e,t,n,r){return new o(e,c.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}getById(e){let t=`${this.path.label}.getById`,n=vo(e,t),r=this.#e,i=U.promised(this.context,t,false);return this.enqueue({sort:"read",label:t,plan:()=>({op:"getListById",body:r,id:n}),settle:s=>{i.hydrateAddress({kind:"handle",handle:A(s,t)});}}),i}listing(){return {op:"getLists",body:this.#e}}itemAt(e,t){return U.at(this.context,e,t)}promised(e,t){return U.promised(this.context,e,t)}},Ee=class o extends p{static of(e,t,n){return new o(e,c.derived(t,n))}constructor(e,t){super(e,t);}get level(){return this.loadedProperty("level")}set level(e){let t=`${this.path.label}.level`,n=qt(e,t);this.commandAnswering(t,()=>({op:"setListLevel",paragraph:this.#e(),level:n}),r=>{v(r,t);});}onLoad(e){if(!this.selection(e,["level"]).includes("level"))return;let t=`${this.path.label}.level`;this.read(t,()=>({op:"getListLevel",paragraph:this.#e()}),n=>{this.setLoadedProperty("level",ve(n,t));});}#e(){this.requireAddressable();let e=this.path.address();return e.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.path.label}),e.handle}};function qt(o,e){return (!Number.isInteger(o)||o<0||o>xo)&&a({code:"InvalidArgument",target:e}),o}function vo(o,e){return (!Number.isInteger(o)||o<=0)&&a({code:"InvalidArgument",target:e}),o}var Ht=(g=>(g.mixed="Mixed",g.none="None",g.hidden="Hidden",g.dotLine="DotLine",g.single="Single",g.word="Word",g.double="Double",g.thick="Thick",g.dotted="Dotted",g.dottedHeavy="DottedHeavy",g.dashLine="DashLine",g.dashLineHeavy="DashLineHeavy",g.dashLineLong="DashLineLong",g.dashLineLongHeavy="DashLineLongHeavy",g.dotDashLine="DotDashLine",g.dotDashLineHeavy="DotDashLineHeavy",g.twoDotDashLine="TwoDotDashLine",g.twoDotDashLineHeavy="TwoDotDashLineHeavy",g.wave="Wave",g.waveHeavy="WaveHeavy",g.waveDouble="WaveDouble",g))(Ht||{}),Ro=["bold","italic","color","name","size","underline","strikeThrough","highlightColor","subscript","superscript"],X=class o extends p{#e;#t;static of(e,t,n,r){return new o(e,c.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}get bold(){return this.loadedProperty("bold")}set bold(e){this.#n("bold",et(e,`${this.path.label}.bold`));}get italic(){return this.loadedProperty("italic")}set italic(e){this.#n("italic",et(e,`${this.path.label}.italic`));}get color(){return this.loadedProperty("color")}set color(e){this.#n("color",lt(e,`${this.path.label}.color`));}get name(){return this.loadedProperty("name")}set name(e){this.#n("name",lt(e,`${this.path.label}.name`));}get size(){return this.loadedProperty("size")}set size(e){this.#n("size",Ao(e,`${this.path.label}.size`));}get underline(){return this.loadedProperty("underline")}set underline(e){this.#n("underline",lt(e,`${this.path.label}.underline`));}get highlightColor(){return this.loadedProperty("highlightColor")}set highlightColor(e){this.#n("highlightColor",e===null?null:lt(e,`${this.path.label}.highlightColor`));}get strikeThrough(){return this.loadedProperty("strikeThrough")}set strikeThrough(e){this.#n("strikeThrough",et(e,`${this.path.label}.strikeThrough`));}get subscript(){return this.loadedProperty("subscript")}set subscript(e){this.#n("subscript",et(e,`${this.path.label}.subscript`));}get superscript(){return this.loadedProperty("superscript")}set superscript(e){this.#n("superscript",et(e,`${this.path.label}.superscript`));}onLoad(e){let t=this.selection(e,Ro);if(t.length===0)return;let n=`${this.path.label}.font`;this.read(n,()=>({op:"getFont",span:this.#r()}),r=>{let i=mt(r,n);for(let s of t)this.setLoadedProperty(s,i[s]);});}#n(e,t){if(this.requireUsablePath(),this.#t){this.#t[e]=t,e==="subscript"&&t===true&&(this.#t.superscript=false),e==="superscript"&&t===true&&(this.#t.subscript=false);return}let n={[e]:t};e==="subscript"&&t===true&&(n.superscript=false),e==="superscript"&&t===true&&(n.subscript=false),this.#t=n;let r=`${this.path.label}.${e}`;this.commandAnswering(this.path.label,()=>({op:"setFont",span:this.#r(),font:n}),i=>{v(i,r);},()=>{this.#t===n&&(this.#t=void 0);});}#r(){return this.requireAddressable(),I(this.path,this.#e)}};function et(o,e){return typeof o!="boolean"&&a({code:"InvalidArgument",target:e}),o}function Ao(o,e){return (typeof o!="number"||!Number.isFinite(o))&&a({code:"InvalidArgument",target:e}),o}function lt(o,e){return (typeof o!="string"||o.length===0)&&a({code:"InvalidArgument",target:e}),o}var Co=new Set(["matchCase","matchWholeWord","ignorePunct","ignoreSpace","matchWildcards"]);function De(o,e){if(o===void 0)return;typeof o!="object"&&a({code:"InvalidArgument",target:e});for(let[n,r]of Object.entries(o))Co.has(n)||a({code:"InvalidArgument",target:`${e}.${n}`}),r!==void 0&&typeof r!="boolean"&&a({code:"InvalidArgument",target:`${e}.${n}`});let t={...o.matchCase===void 0?{}:{matchCase:o.matchCase},...o.matchWholeWord===void 0?{}:{matchWholeWord:o.matchWholeWord},...o.ignorePunct===void 0?{}:{ignorePunct:o.ignorePunct},...o.ignoreSpace===void 0?{}:{ignoreSpace:o.ignoreSpace},...o.matchWildcards===void 0?{}:{matchWildcards:o.matchWildcards}};return Object.keys(t).length===0?void 0:t}var Po=32,Oo=32;function ct(o,e){(!Array.isArray(o)||o.length===0||o.length>Po)&&a({code:"InvalidArgument",target:e});for(let t of o)(typeof t!="string"||t.length===0||t.length>Oo||wo(t))&&a({code:"InvalidArgument",target:e});return [...o]}function wo(o){for(let e=0;e<o.length;e+=1){let t=o.charCodeAt(e);if(t>=55296&&t<=56319){let n=o.charCodeAt(e+1);if(!(n>=56320&&n<=57343))return true;e+=1;}else if(t>=56320&&t<=57343)return true}return false}function ut(o,e){return o!==void 0&&typeof o!="boolean"&&a({code:"InvalidArgument",target:e}),o===true}function ht(o,e){if(o===void 0||o==="Current")return "current";if(o==="Original")return "original";a({code:"InvalidArgument",target:e});}function Rn(o,e){return o===void 0?"Whole":(o==="After"&&a({code:"NotSupported",target:e}),o!=="Whole"&&o!=="Start"&&o!=="End"&&o!=="Content"&&a({code:"InvalidArgument",target:e}),o)}var ko=16,B=class o extends p{#e;#t;#n;#r;#s;#a;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,c.of(t,n.handle),false)}static promised(e,t,n){return new o(e,c.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get text(){return this.loadedProperty("text")}get contentControls(){return this.requireUsablePath(),this.#a??=N.of(this.context,`${this.path.label}.contentControls`,this.path,()=>({span:{paragraph:this.#o()}})),this.#a}get uniqueLocalId(){return this.loadedProperty("uniqueLocalId")}get style(){return this.loadedProperty("style")}set style(e){this.#d("style",Pe(e,`${this.path.label}.style`));}get shapes(){return this.#t??=ne.of(this.context,`${this.path.label}.shapes`,this.path,"paragraph"),this.#t}get font(){return this.#e??=X.of(this.context,`${this.path.label}.font`,this.path,"paragraph"),this.#e}get alignment(){return this.loadedProperty("alignment")}set alignment(e){this.#d("alignment",Io(e,`${this.path.label}.alignment`));}get readingOrder(){return this.loadedProperty("readingOrder")}set readingOrder(e){this.#d("readingOrder",Lo(e,`${this.path.label}.readingOrder`));}get firstLineIndent(){return this.loadedProperty("firstLineIndent")}set firstLineIndent(e){this.#d("firstLineIndent",Ne(e,`${this.path.label}.firstLineIndent`));}get leftIndent(){return this.loadedProperty("leftIndent")}set leftIndent(e){this.#d("leftIndent",Ne(e,`${this.path.label}.leftIndent`));}get rightIndent(){return this.loadedProperty("rightIndent")}set rightIndent(e){this.#d("rightIndent",Ne(e,`${this.path.label}.rightIndent`));}get lineSpacing(){return this.loadedProperty("lineSpacing")}set lineSpacing(e){this.#d("lineSpacing",Ne(e,`${this.path.label}.lineSpacing`));}get spaceBefore(){return this.loadedProperty("spaceBefore")}set spaceBefore(e){this.#d("spaceBefore",Ne(e,`${this.path.label}.spaceBefore`));}get spaceAfter(){return this.loadedProperty("spaceAfter")}set spaceAfter(e){this.#d("spaceAfter",Ne(e,`${this.path.label}.spaceAfter`));}get list(){return this.#n??=this.#i(`${this.path.label}.list`),this.#n}getRange(e="Whole"){let t=`${this.path.label}.getRange`;["Whole","Content","Start","End","Before","After"].includes(e)||a({code:"InvalidArgument",target:t});let n=R.promised(this.context,t,false);return this.read(t,()=>({op:"getRange",span:{paragraph:this.#o()},location:e}),r=>{n.hydrateAddress({kind:"span",span:P(r,t)});}),n}search(e,t){let n=`${this.path.label}.search`;typeof e!="string"&&a({code:"InvalidArgument",target:n});let r=De(t,n);return this.requireUsablePath(),$.of(this.context,n,this.path,()=>({op:"search",scope:{paragraph:this.#o()},text:e,options:{...r??{},projection:this.revisionTextView()}}))}getTextRanges(e,t){let n=`${this.path.label}.getTextRanges`,r=ct(e,n),i=ut(t,n);return this.requireUsablePath(),$.of(this.context,n,this.path,()=>({op:"getTextRanges",scope:{paragraph:this.#o()},endingMarks:r,...i?{trimSpacing:true}:{},projection:this.revisionTextView()}))}getReviewedText(e){let t=`${this.path.label}.getReviewedText`,n=ht(e,t);this.requireUsablePath();let{result:r,fill:i}=W(t);return this.read(t,()=>({op:"getReviewedText",span:{paragraph:this.#o()},version:n}),s=>i(O(s,t))),r}startNewList(){let e=`${this.path.label}.startNewList`,t=U.promised(this.context,e,false);return this.commandCreating(t,e,()=>({op:"startNewList",paragraph:this.#o()}),n=>{t.hydrateAddress({kind:"handle",handle:A(n,e)});}),t}attachToList(e,t){let n=`${this.path.label}.attachToList`;(!Number.isSafeInteger(e)||e<=0||!Number.isInteger(t)||t<0||t>8)&&a({code:"InvalidArgument",target:n});let r=U.promised(this.context,n,false);return this.commandCreating(r,n,()=>({op:"attachToList",paragraph:this.#o(),listId:e,level:t}),i=>{r.hydrateAddress({kind:"handle",handle:A(i,n)});}),r}detachFromList(){let e=`${this.path.label}.detachFromList`;this.commandAnswering(e,()=>({op:"detachFromList",paragraph:this.#o()}),t=>{v(t,e);});}get listItem(){return this.#r??=Ee.of(this.context,`${this.path.label}.listItem`,this.path),this.#r}clear(){this.commandDiscarding("clear",()=>({op:"replaceSpan",span:{paragraph:this.#o()},text:""}));}delete(){let e=`${this.path.label}.delete`;this.commandAnswering(e,()=>({op:"deleteParagraph",paragraph:this.#o()}),t=>{t.kind!=="applied"&&t.kind!=="span"&&a({code:"GeneralException",target:e});});}insertText(e,t){let n=`${this.path.label}.insertText`,r=Ie(e,n),i=pn(t,n),s=R.promised(this.context,n,false);return this.commandCreating(s,n,()=>i==="Replace"?{op:"replaceSpan",span:{paragraph:this.#o()},text:r}:{op:"insertText",at:{paragraph:this.#o(),at:i==="Start"?"start":"end"},text:r},d=>{s.hydrateAddress({kind:"span",span:P(d,n)});}),s}insertTable(e,t,n,r){let i=`${this.path.label}.insertTable`;n!=="Before"&&n!=="After"&&a({code:"InvalidArgument",target:i}),this.requireUsablePath();let{table:s,plan:d,settle:l}=Te(this.context,i,()=>I(this.path,"paragraph"),n,e,t,r);return this.commandCreating(s,i,d,l),s}insertParagraph(e,t){let n=`${this.path.label}.insertParagraph`,r=K(e,n),i=mn(t,n),s=o.promised(this.context,n,false);return this.commandCreating(s,n,()=>({op:"insertParagraph",anchor:{paragraph:this.#o()},where:i==="Before"?"before":"after",text:r}),d=>{d.kind!=="handle"&&a({code:"GeneralException",target:n}),s.hydrateAddress({kind:"handle",handle:d.handle});}),s}split(e,t,n){let r=`${this.path.label}.split`,i=To(e,r),s=Cn(t,`${r}.trimDelimiters`),d=Cn(n,`${r}.trimSpacing`),l=$.answered(this.context,r,this.path);return this.commandAnswering(r,()=>({op:"splitParagraph",paragraph:this.#o(),delimiters:i,...s?{trimDelimiters:true}:{},...d?{trimSpacing:true}:{}}),h=>{l.fill(h,r);}),l}onLoad(e){let t=this.selection(e,["text","uniqueLocalId",...An]);t.includes("text")&&this.loadTextInto("text",()=>({op:"getText",target:this.#o(),projection:this.revisionTextView()})),t.includes("uniqueLocalId")&&this.loadTextInto("uniqueLocalId",()=>({op:"getParagraphId",paragraph:this.#o()}));let n=An.filter(i=>t.includes(i));if(n.length===0)return;let r=`${this.path.label}.paragraphFormat`;this.read(r,()=>({op:"getParagraphFormat",paragraph:{paragraph:this.#o()}}),i=>{let s=ft(i,r);for(let d of n)this.setLoadedProperty(d,s[d]);});}#d(e,t){if(this.requireUsablePath(),this.#s){this.#s[e]=t;return}let n={[e]:t};this.#s=n;let r=`${this.path.label}.${e}`;this.commandAnswering(`${this.path.label}.paragraphFormat`,()=>({op:"setParagraphFormat",paragraph:{paragraph:this.#o()},format:n}),i=>{v(i,r);},()=>{this.#s===n&&(this.#s=void 0);});}#i(e){let t=U.promised(this.context,e,false);return this.read(e,()=>({op:"getParagraphList",paragraph:this.#o()}),n=>{t.hydrateAddress({kind:"handle",handle:A(n,e)});}),t}#o(){return this.requireAddressable(),this.path.handle()}},An=["style","alignment","firstLineIndent","leftIndent","rightIndent","lineSpacing","spaceBefore","spaceAfter","readingOrder"],So=["Left","Centered","Right","Justified"];function Io(o,e){return So.includes(o)||a({code:"InvalidArgument",target:e}),o}function Lo(o,e){return o!=="LeftToRight"&&o!=="RightToLeft"&&a({code:"InvalidArgument",target:e}),o}function Ne(o,e){return (typeof o!="number"||!Number.isFinite(o))&&a({code:"InvalidArgument",target:e}),o}function To(o,e){(!Array.isArray(o)||o.length===0||o.length>ko)&&a({code:"InvalidArgument",target:e});for(let t of o)(typeof t!="string"||t.length===0)&&a({code:"InvalidArgument",target:e});return [...o]}function Cn(o,e){return o!==void 0&&typeof o!="boolean"&&a({code:"InvalidArgument",target:e}),o===true}var q=class o extends F{#e;static of(e,t,n){return new o(e,c.derived(t,n),null)}static overListing(e,t,n,r){return new o(e,c.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}getLast(){return this.edge("last","getLast",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}getLastOrNullObject(){return this.edge("last","getLastOrNullObject",true)}listing(){if(this.#e)return this.#e();let e=this.path.address();return e.kind==="fieldResult"&&G(this.path.label),e.kind==="handle"?{op:"getParagraphs",body:e.handle}:{op:"getSpanParagraphs",span:e.span}}size(e,t){return w(e,t).length}addressAt(e,t,n){let r=w(e,t)[n];return r?{kind:"handle",handle:r}:void 0}itemAt(e,t){return B.at(this.context,e,t)}promised(e,t){return B.promised(this.context,e,t)}},$=class o extends F{#e;static of(e,t,n,r){return new o(e,c.derived(t,n),r)}static answered(e,t,n){return new o(e,c.derived(t,n),null)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}getLast(){return this.edge("last","getLast",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}listing(){return this.#e?this.#e():null}size(e,t){return te(e,t).length}addressAt(e,t,n){let r=te(e,t)[n];return r?{kind:"span",span:r}:void 0}itemAt(e,t){return R.at(this.context,e,t)}promised(e,t){return R.promised(this.context,e,t)}};var qe=class o extends p{#e;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,c.of(t,n.handle),false)}static promised(e,t,n){return new o(e,c.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get name(){return this.loadedProperty("name")}get range(){return this.#e??=this.#t(`${this.path.label}.range`),this.#e}select(e){let t=`${this.path.label}.select`,n=dt(e,t);this.requireUsablePath(),this.internals.capabilities.selection||a({code:"NotSupported",target:t}),this.command("select",()=>({op:"selectBookmark",bookmark:this.#n(),mode:n==="Select"?"select":n==="Start"?"start":"end"}));}delete(){this.requireUsablePath(),this.command("delete",()=>({op:"deleteBookmark",target:{bookmark:this.#n()}}));}onLoad(e){if(!this.selection(e,["name"]).includes("name"))return;let t=`${this.path.label}.name`;this.read(t,()=>({op:"getBookmarkName",bookmark:this.#n()}),n=>{this.setLoadedProperty("name",O(n,t));});}#t(e){let t=R.promised(this.context,e,false);return this.read(e,()=>({op:"getBookmarkRange",bookmark:this.#n()}),n=>{t.hydrateAddress({kind:"span",span:P(n,e)});}),t}#n(){return this.requireAddressable(),this.path.handle()}},de=class o extends k{#e;static of(e,t,n,r){return new o(e,c.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}listing(){return this.#e()}itemAt(e,t){return qe.at(this.context,e,t)}promised(e,t){return qe.promised(this.context,e,t)}};function jo(o,e){return e<1||e>12?0:e===2?o%4===0&&o%100!==0||o%400===0?29:28:e===4||e===6||e===9||e===11?30:31}function Pn(o){if(o.length===0)return null;let e=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,9}))?(Z|[+-]\d{2}:\d{2})$/.exec(o.trim());if(!e)return null;let t=Number(e[1]),n=Number(e[2]),r=Number(e[3]),i=jo(t,n);if(t===0||i===0||r<1||r>i)return null;let s=Number(e[4]),d=Number(e[5]),l=Number(e[6]);if(s>23||d>59||l>59)return null;let h=e[7],y=h===void 0?0:Number(h.padEnd(3,"0").slice(0,3));if(Number.isNaN(y))return null;let m=`${e[1]}-${e[2]}-${e[3]}T${e[4]}:${e[5]}:${e[6]}.${String(y).padStart(3,"0")}Z`,b=Date.parse(m);if(Number.isNaN(b))return null;let j=e[8];if(j==="Z")return new Date(b);let H=Number(j.slice(1,3)),ee=Number(j.slice(4,6));if(ee>59||H>14||H===14&&ee!==0)return null;let xe=j[0]==="+"?1:-1,We=new Date(b-xe*(H*36e5+ee*6e4));return Number.isNaN(We.getTime())?null:We}var pt=class extends p{hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get authorName(){return this.loadedProperty("authorName")}get creationDate(){return this.loadedProperty("creationDate")}get id(){return this.loadedProperty("id")}get content(){return this.loadedProperty("content")}set content(e){let t=`${this.path.label}.content`;(typeof e!="string"||e.length===0)&&a({code:"InvalidArgument",target:t});let n=this.internals.author;(typeof n!="string"||n.trim().length===0)&&a({code:"NotSupported",target:t,diagnostic:"edit.comment-author-required"}),this.commandAnswering(t,()=>({op:"setCommentText",comment:this.commentHandle(),text:e,author:n}),r=>v(r,t));}get text(){return this.loadedProperty("text")}delete(){this.command("delete",()=>({op:"deleteComment",comment:this.commentHandle()}));}loadCommentFields(e,t){let n=this.selection(e,["authorName","creationDate","id","text","content",...t]);if(n.includes("authorName")&&this.loadTextInto("authorName",()=>({op:"getCommentAuthor",comment:this.commentHandle()})),n.includes("content")&&this.loadTextInto("content",()=>({op:"getCommentText",comment:this.commentHandle()})),n.includes("text")&&this.loadTextInto("text",()=>({op:"getCommentText",comment:this.commentHandle()})),n.includes("id")&&this.loadTextInto("id",()=>({op:"getCommentId",comment:this.commentHandle()})),n.includes("creationDate")){let i=`${this.path.label}.creationDate`;this.read(i,()=>({op:"getCommentDate",comment:this.commentHandle()}),s=>{this.setLoadedProperty("creationDate",Pn(O(s,i)));});}if(!n.includes("resolved"))return;let r=`${this.path.label}.resolved`;this.read(r,()=>({op:"getCommentResolved",comment:this.commentHandle()}),i=>{this.setLoadedProperty("resolved",ge(i,r));});}commentHandle(){return this.requireAddressable(),this.path.handle()}},ye=class o extends pt{static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,c.of(t,n.handle),false)}static promised(e,t,n){return new o(e,c.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}onLoad(e){this.loadCommentFields(e,[]);}},tt=class o extends k{#e;static of(e,t,n,r){return new o(e,c.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#e()}itemAt(e,t){return ye.at(this.context,e,t)}promised(e,t){return ye.promised(this.context,e,t)}},le=class o extends pt{#e;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,c.of(t,n.handle),false)}static promised(e,t,n){return new o(e,c.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}get resolved(){return this.loadedProperty("resolved")}set resolved(e){let t=`${this.path.label}.resolved`;typeof e!="boolean"&&a({code:"InvalidArgument",target:t}),this.commandAnswering(t,()=>({op:"setCommentResolved",comment:this.commentHandle(),resolved:e}),n=>{v(n,t);});}get replies(){return this.#e??=tt.of(this.context,`${this.path.label}.replies`,this.path,()=>({op:"getCommentReplies",comment:this.commentHandle()})),this.#e}getRange(){let e=`${this.path.label}.getRange`,t=R.promised(this.context,e,false);return this.read(e,()=>({op:"getCommentRange",comment:this.commentHandle()}),n=>{t.hydrateAddress({kind:"span",span:P(n,e)});}),t}reply(e){let t=`${this.path.label}.reply`;(typeof e!="string"||e.length===0)&&a({code:"InvalidArgument",target:t});let n=this.internals.author;(typeof n!="string"||n.trim().length===0)&&a({code:"NotSupported",target:t,diagnostic:"edit.comment-author-required"});let r=ye.promised(this.context,t,false);return this.commandCreating(r,t,()=>({op:"replyToComment",comment:this.commentHandle(),text:e,author:n}),i=>{r.hydrateAddress({kind:"handle",handle:A(i,t)});}),r}onLoad(e){this.loadCommentFields(e,["resolved"]);}},ce=class o extends k{#e;static of(e,t,n,r){return new o(e,c.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#e()}itemAt(e,t){return le.at(this.context,e,t)}promised(e,t){return le.promised(this.context,e,t)}},_=class o extends p{static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,c.of(t,n.handle),false)}static promised(e,t,n){return new o(e,c.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get author(){return this.loadedProperty("author")}get date(){return this.loadedProperty("date")}get type(){return this.loadedProperty("type")}get range(){if(this.#e)return this.#e;let e=`${this.path.label}.range`,t=R.promised(this.context,e,false);return this.read(e,()=>({op:"getRevisionRange",revision:this.#t()}),n=>{t.hydrateAddress({kind:"span",span:P(n,e)});}),this.#e=t,t}#e;accept(){this.command("accept",()=>({op:"acceptRevision",revision:this.#t()}));}reject(){this.command("reject",()=>({op:"rejectRevision",revision:this.#t()}));}onLoad(e){let t=this.selection(e,["author","date","type"]);if(t.includes("author")&&this.loadTextInto("author",()=>({op:"getRevisionAuthor",revision:this.#t()})),t.includes("type")&&this.loadTextInto("type",()=>({op:"getRevisionType",revision:this.#t()})),!t.includes("date"))return;let n=`${this.path.label}.date`;this.read(n,()=>({op:"getRevisionDate",revision:this.#t()}),r=>{this.setLoadedProperty("date",Pn(O(r,n)));});}static batchHandle(e,t,n="RevisionCollection.resolve"){return (!(e instanceof o)||e.context!==t)&&a({code:"InvalidArgument",target:n}),e.#t()}#t(){return this.requireAddressable(),this.path.handle()}},M=class o extends k{#e;static of(e,t,n,r){return new o(e,c.derived(t,n),{body:r})}static inSpan(e,t,n,r){return new o(e,c.derived(t,n),{span:r})}static ofReviewKey(e,t,n,r){return new o(e,c.derived(t,n),{key:r})}constructor(e,t,n){super(e,t),this.#e=n;}acceptAll(){this.commandOn("acceptAll",()=>this.#t("acceptAllRevisions"));}rejectAll(){this.commandOn("rejectAll",()=>this.#t("rejectAllRevisions"));}#t(e){return {op:e,...this.#n()}}#n(){let e=this.#e;return "span"in e?{scope:e.span()}:"key"in e?{key:e.key}:{body:e.body()}}#r(e){let t=this.#e;return "body"in t||a({code:"NotSupported",target:`${this.path.label}.${e}`}),t.body}resolve(e,t){let n=`${this.path.label}.resolve`;(!["accept","reject"].includes(e)||t!==void 0&&!Array.isArray(t))&&a({code:"InvalidArgument",target:n});let r=this.#r("resolve"),i=t===void 0?void 0:[...t],{result:s,fill:d}=W(n);return this.enqueue({sort:"write",label:n,plan:()=>({op:"resolveRevisionBatch",body:r(),action:e,...i===void 0?{}:{revisions:i.map(l=>_.batchHandle(l,this.context))}}),settle:l=>{l.kind!=="revisionBatch"&&a({code:"GeneralException",target:n}),d(l.result);}}),s}setAuthor(e,t,n){let r=`${this.path.label}.setAuthor`,i=n?.date,s=Array.isArray(t)?t:void 0,d=t!==void 0&&!Array.isArray(t)?t?.authors:void 0;(typeof e!="string"||e.trim().length===0||t!==void 0&&!Array.isArray(t)&&(typeof t!="object"||t===null||!Array.isArray(d)||d.some(b=>typeof b!="string"))||n!==void 0&&(typeof n!="object"||n===null)||i!==void 0&&(!(i instanceof Date)||Number.isNaN(i.getTime()))||s?.some(b=>!(b instanceof _)||b.context!==this.context))&&a({code:"InvalidArgument",target:r});let l=this.#r("setAuthor"),h=s===void 0?void 0:[...s],{result:y,fill:m}=W(r);return this.enqueue({sort:"write",label:r,plan:()=>({op:"setRevisionAuthorBatch",body:l(),author:e,...i===void 0?{}:{date:`${i.toISOString().slice(0,19)}Z`},...d===void 0?{}:{authors:[...d]},...h===void 0?{}:{revisions:h.map(b=>_.batchHandle(b,this.context,r))}}),settle:b=>{b.kind!=="revisionAuthors"&&a({code:"GeneralException",target:r}),m(b.result);}}),y}listing(){return {op:"getRevisions",...this.#n()}}itemAt(e,t){return _.at(this.context,e,t)}promised(e,t){return _.promised(this.context,e,t)}commandOn(e,t){let n=`${this.path.label}.${e}`;this.enqueue({sort:"write",label:n,plan:t,settle:r=>{v(r,n);}});}};var R=class o extends p{#e;#t;#n;#r;#s;#a;#d;#i;static at(e,t,n){return n.kind!=="span"&&a({code:"InvalidObjectPath",target:t}),new o(e,c.ofSpan(t,n.span),false)}static promised(e,t,n){return new o(e,c.pending(t),n)}static ofFieldResult(e,t,n){return new o(e,c.fieldResult(t,n),false)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="span"?this.path.resolveToSpan(e.span):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get text(){return this.loadedProperty("text")}get font(){return this.#s??=X.of(this.context,`${this.path.label}.font`,this.path,"span"),this.#s}get paragraphs(){return this.#r??=q.of(this.context,`${this.path.label}.paragraphs`,this.path),this.#r}get style(){return this.loadedProperty("style")}set style(e){let t=`${this.path.label}.style`,n=Pe(e,t);this.requireAddressable(),this.command("style",()=>({op:"setStyle",span:I(this.path,"span"),name:n}));}get hyperlink(){return this.loadedProperty("hyperlink")}set hyperlink(e){let t=`${this.path.label}.hyperlink`;(typeof e!="string"||e.length>2048)&&a({code:"InvalidArgument",target:t}),this.requireUsablePath(),this.command("hyperlink",()=>({op:"setHyperlink",span:this.#o(),target:e}));}get contentControls(){return this.requireUsablePath(),this.#i??=N.of(this.context,`${this.path.label}.contentControls`,this.path,()=>({span:this.#o()})),this.#i}get bookmarks(){let e=this.#o();return this.#a??=de.of(this.context,`${this.path.label}.bookmarks`,this.path,()=>({op:"getBookmarks",scope:{start:e.start,end:e.end}})),this.#a}insertBookmark(e){let t=`${this.path.label}.insertBookmark`;this.requireUsablePath(),this.command("insertBookmark",()=>((typeof e!="string"||e.length===0)&&a({code:"InvalidArgument",target:t}),{op:"insertBookmark",span:this.#o(),name:e}));}getBookmarks(e,t){let n=`${this.path.label}.getBookmarks`,{result:r,fill:i}=W(n);return this.read(n,()=>((e!==void 0&&typeof e!="boolean"||t!==void 0&&typeof t!="boolean")&&a({code:"InvalidArgument",target:n}),{op:"getBookmarkNames",scope:this.#o(),includeHidden:e===true,includeAdjacent:t===true}),s=>{s.kind!=="texts"&&a({code:"GeneralException",target:n}),i([...s.texts]);}),r}get revisions(){return this.#d??=M.inSpan(this.context,`${this.path.label}.revisions`,this.path,()=>I(this.path,"span")),this.#d}search(e,t){let n=`${this.path.label}.search`;typeof e!="string"&&a({code:"InvalidArgument",target:n});let r=De(t,n),i=this.#o();return $.of(this.context,n,this.path,()=>({op:"search",scope:i,text:e,options:{...r??{},projection:this.revisionTextView()}}))}getTextRanges(e,t){let n=`${this.path.label}.getTextRanges`,r=ct(e,n),i=ut(t,n);return this.requireUsablePath(),$.of(this.context,n,this.path,()=>({op:"getTextRanges",scope:this.#o(),endingMarks:r,...i?{trimSpacing:true}:{},projection:this.revisionTextView()}))}expandTo(e){let t=`${this.path.label}.expandTo`;(!(e instanceof o)||e.context!==this.context)&&a({code:"InvalidArgument",target:t}),this.requireUsablePath(),e.requireUsablePath();let n=o.promised(this.context,t,false);return this.enqueue({sort:"read",label:t,dependencies:[e.path],plan:()=>({op:"expandSpan",span:this.#o(),to:e.#o()}),settle:r=>{n.hydrateAddress({kind:"span",span:P(r,t)});}}),n}getRange(e){let t=`${this.path.label}.getRange`,n=Rn(e,t);this.requireUsablePath();let r=o.promised(this.context,t,false);return this.read(t,()=>({op:"getRange",span:this.#o(),location:n}),i=>{r.hydrateAddress({kind:"span",span:P(i,t)});}),r}getReviewedText(e){let t=`${this.path.label}.getReviewedText`,n=ht(e,t);this.requireUsablePath();let{result:r,fill:i}=W(t);return this.read(t,()=>({op:"getReviewedText",span:this.#o(),version:n}),s=>i(O(s,t))),r}insertText(e,t){let n=`${this.path.label}.insertText`;if(this.path.isFieldResult)return this.requireUsablePath(),this.command("insertText",bn(this.path,e,t,n)),o.ofFieldResult(this.context,n,this.path);let r=Ie(e,n),i=oe(t,n);this.requireUsablePath();let s=o.promised(this.context,n,false);return this.commandCreating(s,n,()=>{let d=this.#o();return i==="Replace"?{op:"replaceSpan",span:d,text:r}:{op:"insertText",at:i==="Start"||i==="Before"?d.start:d.end,text:r}},d=>{s.hydrateAddress({kind:"span",span:P(d,n)});}),s}delete(){this.requireUsablePath(),this.commandDiscarding("delete",()=>({op:"replaceSpan",span:this.#o(),text:""}));}clear(){let e=this.#o();this.commandDiscarding("clear",()=>({op:"replaceSpan",span:e,text:""}));}insertComment(e){let t=`${this.path.label}.insertComment`;(typeof e!="string"||e.length===0)&&a({code:"InvalidArgument",target:t});let n=this.internals.author;(typeof n!="string"||n.trim().length===0)&&a({code:"NotSupported",target:t,diagnostic:"edit.comment-author-required"});let r=le.promised(this.context,t,false);return this.commandCreating(r,t,()=>({op:"insertComment",span:this.#o(),text:e,author:n}),i=>{i.kind!=="handle"&&a({code:"GeneralException",target:t}),r.hydrateAddress(i);}),r}insertContentControl(e){let t=`${this.path.label}.insertContentControl`,n=e??"RichText";n!=="RichText"&&n!=="PlainText"&&n!=="DatePicker"&&a({code:"NotSupported",target:t});let r=J.promised(this.context,t,false);return this.commandCreating(r,t,()=>({op:"insertContentControl",span:this.#o(),subtype:n==="DatePicker"?"date":n==="PlainText"?"plainText":"richText",returnHandle:true}),i=>{i.kind!=="handle"&&a({code:"GeneralException",target:t}),r.hydrateAddress(i);}),r}get tables(){return this.requireUsablePath(),this.#e??=ae.over(this.context,`${this.path.label}.tables`,this.path,()=>I(this.path,"span"))}get fields(){return this.requireUsablePath(),this.#t??=he.of(this.context,`${this.path.label}.fields`,this.path,"span")}insertField(e,t,n,r){let i=`${this.path.label}.insertField`;(t!==void 0&&typeof t!="string"||n!==void 0&&typeof n!="string"||r!==void 0&&typeof r!="boolean")&&a({code:"InvalidArgument",target:i});let s=oe(e,i);this.requireUsablePath();let d=ue.promised(this.context,i,false);return this.commandCreating(d,i,()=>({op:"insertField",span:this.#o(),location:s,...t===void 0?{}:{fieldType:t},...n===void 0?{}:{text:n},...r===void 0?{}:{removeFormatting:r}}),l=>d.hydrateAddress({kind:"handle",handle:A(l,i)})),d}insertOoxml(e,t){let n=`${this.path.label}.insertOoxml`;typeof e!="string"&&a({code:"InvalidArgument",target:n});let r=oe(t,n);this.requireUsablePath();let i=o.promised(this.context,n,false);return this.commandCreating(i,n,()=>({op:"insertOoxml",span:this.#o(),location:r,ooxml:e}),s=>i.hydrateAddress({kind:"span",span:P(s,n)})),i}get inlinePictures(){return this.requireUsablePath(),this.#n??=ie.of(this.context,`${this.path.label}.inlinePictures`,this.path,"span")}insertInlinePictureFromBase64(e,t){let n=`${this.path.label}.insertInlinePictureFromBase64`;(typeof e!="string"||e.length===0)&&a({code:"InvalidArgument",target:n});let r=oe(t,n);this.requireUsablePath();let i=re.promised(this.context,n,false);return this.commandCreating(i,n,()=>({op:"insertInlinePicture",span:this.#o(),base64:e,location:r}),s=>{i.hydrateAddress({kind:"handle",handle:A(s,n)});}),i}insertBreak(e,t){let n=`${this.path.label}.insertBreak`;t!=="Before"&&t!=="After"&&a({code:"InvalidArgument",target:n}),this.requireUsablePath(),this.commandAnswering(n,()=>({op:"insertBreak",span:this.#o(),breakType:e,location:t}),r=>v(r,n));}insertTable(e,t,n,r){let i=`${this.path.label}.insertTable`;n!=="Before"&&n!=="After"&&a({code:"InvalidArgument",target:i});let{table:s,plan:d,settle:l}=Te(this.context,i,()=>I(this.path,"span"),n,e,t,r);return this.commandCreating(s,i,d,l),s}insertParagraph(e,t){let n=`${this.path.label}.insertParagraph`,r=K(e,n),i=oe(t,n);i!=="Before"&&i!=="After"&&a({code:"InvalidArgument",target:n});let s=this.#o(),d=i==="Before"?s.start.paragraph:s.end.paragraph,l=B.promised(this.context,n,false);return this.commandCreating(l,n,()=>({op:"insertParagraph",anchor:{paragraph:d},where:i==="Before"?"before":"after",text:r}),h=>{h.kind!=="handle"&&a({code:"GeneralException",target:n}),l.hydrateAddress({kind:"handle",handle:h.handle});}),l}select(e){let t=`${this.path.label}.select`,n=dt(e,t);this.requireAddressable(),this.internals.capabilities.selection||a({code:"NotSupported",target:t});let r=this.#o();this.command("select",()=>({op:"selectSpan",span:r,mode:n==="Select"?"select":n==="Start"?"start":"end"}));}onLoad(e){let t=this.path.isFieldResult&&e.select.length===0?["text"]:this.selection(e,["text","style","hyperlink"]);if(t.includes("hyperlink")&&this.loadTextInto("hyperlink",()=>({op:"getHyperlink",span:this.#o()})),t.includes("text")){let r=`${this.path.label}.text`;this.read(r,this.path.isFieldResult?fn(this.path,this.revisionTextView()):()=>({op:"getSpanText",span:this.#o(),projection:this.revisionTextView()}),i=>{this.setLoadedProperty("text",O(i,r));});}if(!t.includes("style"))return;let n=`${this.path.label}.style`;this.requireUsablePath(),this.read(n,()=>({op:"getStyle",span:I(this.path,"span")}),r=>{this.setLoadedProperty("style",Qe(r,n));});}#o(){return this.path.isFieldResult&&G(this.path.label),this.requireAddressable(),this.path.span()}};var ue=class o extends p{#e;#t;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,c.of(t,n.handle),false)}static promised(e,t,n){return new o(e,c.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get code(){return this.loadedProperty("code")}get result(){return this.requireUsablePath(),this.#t??=R.ofFieldResult(this.context,`${this.path.label}.result`,this.path)}set code(e){if(this.requireUsablePath(),(typeof e!="string"||e.length===0)&&a({code:"InvalidArgument",target:`${this.path.label}.code`}),this.#e){this.#e.code=e;return}let t={code:e};this.#e=t,this.commandAnswering(`${this.path.label}.code`,()=>({op:"setFieldCode",field:this.#r(),code:t.code}),n=>v(n,`${this.path.label}.code`),()=>{this.#e===t&&(this.#e=void 0);});}delete(){this.#n("deleteField");}updateResult(){this.#n("updateFieldResult");}#n(e){this.requireUsablePath(),this.commandAnswering(`${this.path.label}.${e==="deleteField"?"delete":"updateResult"}`,()=>({op:e,field:this.#r()}),t=>v(t,this.path.label));}onLoad(e){let t=e.select.length===0?["code"]:this.selection(e,["code","result"]);t.includes("result")&&this.result.load("text"),t.includes("code")&&this.read(this.path.label,()=>({op:"getField",field:this.#r()}),n=>{n.kind!=="field"&&a({code:"GeneralException",target:this.path.label}),this.setLoadedProperty("code",n.field.code);});}#r(){this.requireAddressable();let e=this.path.address();return e.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.path.label}),e.handle}},he=class o extends F{#e;static of(e,t,n,r){return new o(e,c.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}getLast(){return this.edge("last","getLast",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}getLastOrNullObject(){return this.edge("last","getLastOrNullObject",true)}listing(){return {op:"getFields",span:I(this.path,this.#e)}}size(e,t){return w(e,t).length}addressAt(e,t,n){let r=w(e,t)[n];return r?{kind:"handle",handle:r}:void 0}itemAt(e,t){return ue.at(this.context,e,t)}promised(e,t){return ue.promised(this.context,e,t)}};var E=class o extends p{#e;#t;get footnotes(){return this.#e??=Q.of(this.context,`${this.path.label}.footnotes`,this.path,()=>({op:"getNotes",document:this.internals.roots().document,scope:this.#l(),noteKind:"footnote"}))}get endnotes(){return this.#t??=Q.of(this.context,`${this.path.label}.endnotes`,this.path,()=>({op:"getNotes",document:this.internals.roots().document,scope:this.#l(),noteKind:"endnote"}))}#n;#r;#s;#a;#d;#i;#o;#c;#u;#h;static main(e,t){return new o(e,c.of(t,Y(e).roots().body))}static promisedStory(e,t){return new o(e,c.pending(t))}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}constructor(e,t){super(e,t);}get text(){return this.loadedProperty("text")}get paragraphs(){return this.#d??=this.paragraphsUnder(`${this.path.label}.paragraphs`),this.#d}get bookmarks(){let e=this.#l();return this.#i??=de.of(this.context,`${this.path.label}.bookmarks`,this.path,()=>({op:"getBookmarks",scope:{body:e}})),this.#i}get font(){return this.#o??=X.of(this.context,`${this.path.label}.font`,this.path,"body"),this.#o}paragraphsUnder(e){return q.of(this.context,e,this.path)}get style(){return this.loadedProperty("style")}set style(e){let t=`${this.path.label}.style`,n=Pe(e,t);this.requireAddressable(),this.command("style",()=>({op:"setStyle",span:I(this.path,"body"),name:n}));}get lists(){return this.#c??=je.of(this.context,`${this.path.label}.lists`,this.path,this.#l()),this.#c}get contentControls(){return this.#u??=N.of(this.context,`${this.path.label}.contentControls`,this.path,{body:this.#l()}),this.#u}getComments(){let e=`${this.path.label}.getComments`,t=this.#l();return ce.of(this.context,e,this.path,()=>({op:"getComments",scope:{body:t}}))}get revisions(){return this.#h??=M.of(this.context,`${this.path.label}.revisions`,this.path,()=>this.#l()),this.#h}getRange(e="Whole"){let t=`${this.path.label}.getRange`;this.requireUsablePath();let n=R.promised(this.context,t,false);return this.read(t,()=>({op:"getRange",span:{body:this.path.handle()},location:e}),r=>{n.hydrateAddress({kind:"span",span:P(r,t)});}),n}search(e,t){let n=`${this.path.label}.search`;typeof e!="string"&&a({code:"InvalidArgument",target:n});let r=De(t,n),i=this.#l();return $.of(this.context,n,this.path,()=>({op:"search",scope:{body:i},text:e,options:{...r??{},projection:this.revisionTextView()}}))}clear(){let e=this.#l();this.commandDiscarding("clear",()=>({op:"replaceSpan",span:{body:e},text:""}));}insertText(e,t){let n=`${this.path.label}.insertText`,r=Ie(e,n),i=Dt(t,n);this.requireUsablePath();let s=R.promised(this.context,n,false);return this.commandCreating(s,n,()=>i==="Replace"?{op:"replaceSpan",span:{body:this.#l()},text:r}:{op:"insertText",at:{body:this.#l(),at:i==="Start"?"start":"end"},text:r},d=>{s.hydrateAddress({kind:"span",span:P(d,n)});}),s}insertFileFromBase64(e,t){let n=`${this.path.label}.insertFileFromBase64`;this.requireUsablePath();let r=R.promised(this.context,n,false);return this.commandCreating(r,n,()=>((typeof e!="string"||e.length===0)&&a({code:"InvalidArgument",target:n}),Dt(t,n)!=="Replace"&&a({code:"NotSupported",target:n}),this.path.handle().ref!==this.internals.roots().body.ref&&a({code:"NotSupported",target:n}),{op:"replaceDocumentFromBase64",base64:e}),i=>{r.hydrateAddress({kind:"span",span:P(i,n)});}),r}insertParagraph(e,t){let n=`${this.path.label}.insertParagraph`,r=K(e,n),i=hn(t,n),s=this.#l(),d=B.promised(this.context,n,false);return this.commandCreating(d,n,()=>({op:"insertParagraph",anchor:{body:s,at:i==="Start"?"first":"last"},where:i==="Start"?"before":"after",text:r}),l=>{l.kind!=="handle"&&a({code:"GeneralException",target:n}),d.hydrateAddress({kind:"handle",handle:l.handle});}),d}insertTable(e,t,n,r){let i=`${this.path.label}.insertTable`;n!=="Start"&&n!=="End"&&a({code:"InvalidArgument",target:i}),this.requireUsablePath();let{table:s,plan:d,settle:l}=Te(this.context,i,()=>({body:this.#l()}),n==="Start"?"Before":"After",e,t,r);return this.commandCreating(s,i,d,l),s}onLoad(e){let t=this.selection(e,["text","style"]);t.includes("text")&&this.loadTextInto("text",()=>({op:"getText",target:this.#l(),projection:this.revisionTextView()})),t.includes("style")&&this.#p();}#p(){let e=`${this.path.label}.style`;this.requireUsablePath(),this.read(e,()=>({op:"getStyle",span:I(this.path,"body")}),t=>{this.setLoadedProperty("style",Qe(t,e));});}get fields(){return this.requireUsablePath(),this.#r??=he.of(this.context,`${this.path.label}.fields`,this.path,"body")}get inlinePictures(){return this.requireUsablePath(),this.#s??=ie.of(this.context,`${this.path.label}.inlinePictures`,this.path,"body")}get shapes(){return this.requireUsablePath(),this.#a??=ne.of(this.context,`${this.path.label}.shapes`,this.path,"body")}get tables(){return this.requireUsablePath(),this.#n??=ae.over(this.context,`${this.path.label}.tables`,this.path,()=>({body:this.#l()}))}#l(){return this.requireAddressable(),this.path.handle()}};var Eo=Object.freeze({Primary:"default",FirstPage:"first",EvenPages:"even"}),Do=["pageWidth","pageHeight","orientation","topMargin","rightMargin","bottomMargin","leftMargin"],nt=class o extends p{#e;static of(e,t,n){return new o(e,c.derived(t,n))}constructor(e,t){super(e,t);}get pageWidth(){return this.loadedProperty("pageWidth")}set pageWidth(e){this.#t("pageWidth",Be(e,`${this.path.label}.pageWidth`));}get pageHeight(){return this.loadedProperty("pageHeight")}set pageHeight(e){this.#t("pageHeight",Be(e,`${this.path.label}.pageHeight`));}get orientation(){return this.loadedProperty("orientation")}set orientation(e){let t=`${this.path.label}.orientation`;e!=="Portrait"&&e!=="Landscape"&&a({code:"InvalidArgument",target:t}),this.#t("orientation",e==="Portrait"?"portrait":"landscape");}get topMargin(){return this.loadedProperty("topMargin")}set topMargin(e){this.#t("topMargin",Be(e,`${this.path.label}.topMargin`));}get bottomMargin(){return this.loadedProperty("bottomMargin")}set bottomMargin(e){this.#t("bottomMargin",Be(e,`${this.path.label}.bottomMargin`));}get leftMargin(){return this.loadedProperty("leftMargin")}set leftMargin(e){this.#t("leftMargin",Be(e,`${this.path.label}.leftMargin`));}get rightMargin(){return this.loadedProperty("rightMargin")}set rightMargin(e){this.#t("rightMargin",Be(e,`${this.path.label}.rightMargin`));}onLoad(e){let t=this.selection(e,Do);if(t.length===0)return;let n=`${this.path.label}.pageSetup`;this.read(n,()=>({op:"getPageSetup",section:this.#n()}),r=>{let i=bt(r,n);for(let s of t)this.setLoadedProperty(s,s==="orientation"?i.orientation==="landscape"?"Landscape":"Portrait":i[s]);});}#t(e,t){if(this.requireUsablePath(),this.#e){this.#e[e]=t;return}let n={[e]:t};this.#e=n;let r=`${this.path.label}.${e}`;this.commandAnswering(`${this.path.label}.pageSetup`,()=>({op:"setPageSetup",section:this.#n(),setup:n}),i=>{v(i,r);},()=>{this.#e===n&&(this.#e=void 0);});}#n(){this.requireAddressable();let e=this.path.address();return e.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.path.label}),e.handle}},$e=class o extends p{#e;#t;static at(e,t,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:t}),new o(e,c.of(t,n.handle),false)}static promised(e,t,n){return new o(e,c.pending(t),n)}constructor(e,t,n){super(e,t,{nullable:n});}hydrateAddress(e){e.kind==="handle"?this.path.resolveTo(e.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get body(){return this.#t??=E.main(this.context,`${this.path.label}.body`),this.#t}get pageSetup(){return this.#e??=nt.of(this.context,`${this.path.label}.pageSetup`,this.path),this.#e}getHeader(e){return this.#n("header",e,"getHeader")}getFooter(e){return this.#n("footer",e,"getFooter")}getNext(){let e=`${this.path.label}.getNext`,t=o.promised(this.context,e,false),n=this.internals.roots().document;return this.read(e,()=>({op:"getSections",document:n}),r=>{let i=w(r,e),s=i.findIndex(l=>l.ref===this.#r().ref),d=s<0?void 0:i[s+1];d||a({code:"ItemNotFound",target:e}),t.hydrateAddress({kind:"handle",handle:d});}),t}onLoad(e){this.selection(e,[]);}#n(e,t,n){let r=`${this.path.label}.${n}`,i=Eo[t];i===void 0&&a({code:"InvalidArgument",target:r});let s=E.promisedStory(this.context,r);return this.read(r,()=>({op:"getFurniture",section:this.#r(),kind:e,variant:i}),d=>{s.hydrateAddress({kind:"handle",handle:A(d,r)});}),s}#r(){return this.requireAddressable(),this.path.handle()}},He=class o extends k{#e;static of(e,t,n,r){return new o(e,c.derived(t,n),r)}constructor(e,t,n){super(e,t),this.#e=n;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#e()}itemAt(e,t){return $e.at(this.context,e,t)}promised(e,t){return $e.promised(this.context,e,t)}};function Be(o,e){return (typeof o!="number"||!Number.isFinite(o)||o<0)&&a({code:"InvalidArgument",target:e}),o}var Mt=(r=>(r.character="Character",r.list="List",r.paragraph="Paragraph",r.table="Table",r))(Mt||{}),Ft=["nameLocal","type","builtIn","baseStyle","nextParagraphStyle","linked","visibility","priority","quickStyle","unhideWhenUsed"],No=99,qo=Object.freeze({paragraph:"Paragraph",character:"Character",table:"Table",numbering:"List"});function Bo(o,e){switch(e){case "nameLocal":return o.name;case "type":return qo[o.type];case "builtIn":return o.builtIn;case "baseStyle":return o.basedOn??"";case "nextParagraphStyle":return o.next??"";case "linked":return o.linked;case "visibility":return !o.hidden;case "priority":return o.uiPriority??No;case "quickStyle":return o.quickStyle;case "unhideWhenUsed":return o.unhideWhenUsed}}var Fe=class o extends p{#e;#t;#n;static listed(e,t,n,r){let i=new o(e,c.derived(t,n),false);return i.#e=r.id,i}static promised(e,t){let n=new o(e,c.pending(t),true);return n.#t=new Set,n}constructor(e,t,n){super(e,t,{nullable:n});}get nameLocal(){return this.loadedProperty("nameLocal")}get type(){return this.loadedProperty("type")}get builtIn(){return this.loadedProperty("builtIn")}get baseStyle(){return this.loadedProperty("baseStyle")}get nextParagraphStyle(){return this.loadedProperty("nextParagraphStyle")}get linked(){return this.loadedProperty("linked")}get visibility(){return this.loadedProperty("visibility")}get priority(){return this.loadedProperty("priority")}get quickStyle(){return this.loadedProperty("quickStyle")}get unhideWhenUsed(){return this.loadedProperty("unhideWhenUsed")}hydrateFound(e){this.#e=e.id,this.path.resolveTo(this.internals.roots().document);let t=this.#n??this.#t;this.#n=void 0,this.#t=void 0,t&&this.hydrateProperties(e,[...t]);}hydrateNull(){this.#n=void 0,this.#t=void 0,this.path.resolveNull();}lookupCaptured(){this.#n=this.#t,this.#t=void 0;}lookupEnded(){this.#n=void 0,this.#t=void 0;}hydrateProperties(e,t){for(let n of t)this.setLoadedProperty(n,Bo(e,n));}onLoad(e){let t=this.selection(e,Ft);if(this.#t){for(let r of t)this.#t.add(r);return}let n=this.path.label;this.read(n,()=>{let r=this.#e;return r===void 0&&a({code:"ItemNotFound",target:n}),{op:"getStyles",id:r}},r=>{let i=Ke(r,n)[0];i||a({code:"ItemNotFound",target:n}),this.hydrateProperties(i,t);});}},Me=class o extends p{#e=new Ye;static of(e,t,n){return new o(e,c.derived(t,n))}constructor(e,t){super(e,t);}get items(){return this.loadedProperty("items")}getCount(){let e=`${this.path.label}.getCount`,{result:t,fill:n}=W(e);return this.read(e,()=>({op:"getStyles",count:true}),r=>n(ve(r,e))),t}getByNameOrNullObject(e){let t=`${this.path.label}.getByNameOrNullObject`;typeof e!="string"&&a({code:"InvalidArgument",target:t});let n=Fe.promised(this.context,t);return this.enqueue({sort:"read",label:t,plan:()=>({op:"getStyles",name:e}),settle:r=>{let i=Ke(r,t)[0];i?n.hydrateFound(i):n.hydrateNull();},capture:()=>n.lookupCaptured(),dispose:()=>n.lookupEnded()}),n}get loadsItemPaths(){return true}onLoad(e){let t=`${this.path.label}.items`,n=vt(e),r=n.length>0?Ze({select:n},Ft,t):Ft,i=e.skip??0,s=e.top;this.#e.join(r,i,s)||this.#e.open(i,s,(d,l)=>this.enqueue({sort:"read",label:t,capture:l,dispose:l,plan:()=>({op:"getStyles"}),settle:h=>{let y=Ke(h,t),m=[...d],b=Rt(y.length,i,s),j=[];for(let H=i;H<b;H+=1){let ee=y[H],xe=Fe.listed(this.context,`${t}[${String(H)}]`,this.path,ee);xe.hydrateProperties(ee,m),j.push(xe);}this.setLoadedProperty("items",Object.freeze(j));}}));}};var Ve=class o extends p{#e;#t;#n;#r;#s;#a;#d;#i;#o;static open(e){return new o(e)}constructor(e){super(e,c.of("document",Y(e).roots().document));}get changeTrackingMode(){return this.loadedProperty("changeTrackingMode")}set changeTrackingMode(e){["Off","TrackAll","TrackMineOnly"].includes(e)||a({code:"InvalidArgument",target:"document.changeTrackingMode"});let t=this.internals.author;this.enqueue({sort:"write",label:"document.changeTrackingMode",plan:()=>({op:"setChangeTrackingMode",mode:e,...t===void 0?{}:{author:t}}),settle:()=>this.setLoadedProperty("changeTrackingMode",e),...e==="TrackAll"?{}:{runtimeSetting:true}});}get body(){return this.#t??=E.main(this.context,"document.body"),this.#t}removeDocumentInformation(e){this.command(`${this.path.label}.removeDocumentInformation`,()=>({op:"removeDocumentInformation",removeDocInfoType:e}));}compareFromBase64(e,t){let n=`${this.path.label}.compareFromBase64`,r=t??{};this.command("compareFromBase64",()=>{(typeof e!="string"||e.length===0)&&a({code:"InvalidArgument",target:n});for(let i of ["detectFormatChanges","removeDateAndTime","removePersonalInformation","addToRecentFiles","ignoreAllComparisonWarnings"])r[i]!==void 0&&typeof r[i]!="boolean"&&a({code:"InvalidArgument",target:`${n}.${i}`});return r.compareTarget!==void 0&&!["CompareTargetCurrent","CompareTargetNew","CompareTargetSelected"].includes(r.compareTarget)&&a({code:"InvalidArgument",target:`${n}.compareTarget`}),r.compareTarget!==void 0&&r.compareTarget!=="CompareTargetCurrent"&&a({code:"NotSupported",target:`${n}.compareTarget`}),r.removePersonalInformation===true&&a({code:"NotSupported",target:`${n}.removePersonalInformation`}),r.authorName!==void 0&&typeof r.authorName!="string"&&a({code:"InvalidArgument",target:`${n}.authorName`}),{op:"compareFromBase64",base64:e,...r.authorName===void 0?{}:{authorName:r.authorName},...r.detectFormatChanges===void 0?{}:{detectFormatChanges:r.detectFormatChanges},...r.removeDateAndTime===void 0?{}:{removeDateAndTime:r.removeDateAndTime}}});}compare(e,t){let n=`${this.path.label}.compare`;this.command("compare",()=>a({code:"NotSupported",target:n}));}get properties(){return this.#e??=Ce.of(this.context,this.path),this.#e}getStyles(){return Me.of(this.context,`${this.path.label}.getStyles()`,this.path)}get paragraphs(){return this.#n??=this.body.paragraphsUnder("document.paragraphs"),this.#n}get sections(){let e=this.path.handle();return this.#r??=He.of(this.context,"document.sections",this.path,()=>({op:"getSections",document:e})),this.#r}get contentControls(){return this.#d??=N.of(this.context,"document.contentControls",this.path,{body:this.internals.roots().body}),this.#d}get comments(){return this.#s??=ce.of(this.context,"document.comments",this.path,()=>({op:"getComments",scope:{body:this.internals.roots().body}})),this.#s}get revisions(){return this.#a??=M.of(this.context,"document.revisions",this.path,()=>this.internals.roots().body),this.#a}get footnotes(){let e=this.path.handle();return this.#i??=Q.of(this.context,"document.footnotes",this.path,()=>({op:"getNotes",document:e,noteKind:"footnote"})),this.#i}get endnotes(){let e=this.path.handle();return this.#o??=Q.of(this.context,"document.endnotes",this.path,()=>({op:"getNotes",document:e,noteKind:"endnote"})),this.#o}deleteBookmark(e){let t=`${this.path.label}.deleteBookmark`,n=this.path.handle();this.command("deleteBookmark",()=>(typeof e!="string"&&a({code:"InvalidArgument",target:t}),{op:"deleteBookmark",target:{document:n,name:e}}));}getBookmarkRange(e){return this.#c(e,"getBookmarkRange",false)}getBookmarkRangeOrNullObject(e){return this.#c(e,"getBookmarkRangeOrNullObject",true)}#c(e,t,n){let r=`${this.path.label}.${t}`,i=this.path.handle(),s=R.promised(this.context,r,n);return this.read(r,()=>(typeof e!="string"&&a({code:"InvalidArgument",target:r}),{op:"getBookmarkRangeByName",document:i,name:e}),d=>{let h=te(d,r)[0];if(!h){n||a({code:"ItemNotFound",target:r}),s.hydrateNull();return}s.hydrateAddress({kind:"span",span:h});}),s}onLoad(e){if(e.select.length===0)return;this.selection(e,["changeTrackingMode"]).includes("changeTrackingMode")&&this.loadTextInto("changeTrackingMode",()=>({op:"getChangeTrackingMode"}));}};var On=o=>typeof o=="object"&&o!==null&&typeof o.kind=="string"&&typeof o.ref=="string";function kn(o){let e=[],t=n=>{if(Array.isArray(n))return n.forEach(t);if(n===null||typeof n!="object")return;let r=n;if(Z(n))return;let i=Object.keys(r),s=i.length===1&&(i[0]==="paragraph"||i[0]==="body")&&On(r[i[0]]),d=typeof r.start=="object"&&r.start!==null&&Z(r.start)&&typeof r.end=="object"&&r.end!==null&&Z(r.end);if(s||d){e.push({op:"getSpanText",span:d?{start:r.start,end:r.end}:n,projection:"model"});return}if(On(n)&&n.kind==="paragraph"){e.push({op:"getText",target:n,projection:"model"});return}Object.values(r).forEach(t);};for(let n of o){if(!automation.isAutomationCommand(n)||n.op==="setChangeTrackingMode")continue;let r=n.key;typeof r=="string"&&e.push({op:"getReviewItemRange",key:r}),t(n);}return e}var Ho=new Set(["getRevisionDate","getCommentDate","getCommentId","getParagraphId"]),L=class extends Error{};function Wt(o,e,t,n){let r=new Vt(t,n),i=false;try{for(let s of o){if(!s.response.ok)continue;if(r.revision(s.before,e.revision()),s.guards){let l=e.execute(r.translate(s.guards.request));if(l===null||l.ok!==s.guards.response.ok)throw new L;if(l.results.length!==s.guards.response.results.length)throw new L;s.guards.response.results.forEach((h,y)=>r.agree(h,l.results[y],false));}let d=e.execute(r.translate(s.request));if(d===null)throw new L;if(!d.ok){let l=d.results.find(h=>h.status==="error");throw l?.status==="error"?Re(l.error,{target:"preview"}):new x({code:"GeneralException",target:"preview"})}if(d.changed&&(i=true),d.results.length!==s.response.results.length)throw new L;s.request.operations.forEach((l,h)=>r.agree(s.response.results[h],d.results[h],Ho.has(l.op))),r.revision(s.response.revision,d.revision);}}catch(s){if(s instanceof x)return {ok:false,refusal:s,wrote:i};if(s instanceof L)return {ok:false,refusal:null,wrote:i};throw s}return {ok:true}}function Z(o){let e=o;return typeof e.offset=="number"&&typeof e.paragraph=="object"&&e.paragraph!==null&&typeof e.paragraph.ref=="string"}var wn=o=>`${o.paragraph.ref}\0${o.offset}\0${o.readAt??""}`,Vt=class{#e=new Map;#t=new Map;#n=new Map;#r=new Map;constructor(e,t){this.#n.set(e,t);}revision(e,t){let n=this.#n.get(e);if(n!==void 0&&n!==t)throw new L;this.#n.set(e,t);}translate(e){if(Array.isArray(e))return e.map(r=>this.translate(r));if(e===null||typeof e!="object")return e;let t=Z(e)?this.#i(e):void 0,n={};for(let[r,i]of Object.entries(e))if(r==="ref"&&typeof i=="string"){let s=this.#e.get(i);if(s===void 0)throw new L;n[r]=s;}else if((r==="readAt"||r==="expectedRevision")&&typeof i=="number"){let s=this.#n.get(i);if(s===void 0)throw new L;n[r]=s;}else r==="offset"&&t!==void 0?n[r]=t:n[r]=this.translate(i);return n}agree(e,t,n){if(Array.isArray(e)){if(!Array.isArray(t)||t.length!==e.length)throw new L;e.forEach((s,d)=>this.agree(s,t[d],n));return}if(e===null||typeof e!="object"){if(!n&&e!==t)throw new L;return}if(t===null||typeof t!="object"||Array.isArray(t))throw new L;let r=t,i=Z(e);if(i){if(!Z(r))throw new L;this.#d(e,r.offset);}this.#s(e,r);for(let[s,d]of Object.entries(e))if(s==="ref"&&typeof d=="string"){let l=r[s];if(typeof l!="string")throw new L;this.#a(d,l);}else {if(s==="readAt"||s==="date"||s==="offset"&&i)continue;this.agree(d,r[s],n);}}#s(e,t){let[n,r,i,s]=[e.start,e.end,t.start,t.end];if(!(typeof n!="object"||n===null||!Z(n))&&!(typeof r!="object"||r===null||!Z(r))&&n.paragraph.ref===r.paragraph.ref&&!(typeof i!="object"||i===null||!Z(i))&&!(typeof s!="object"||s===null||!Z(s))&&s.offset-i.offset!==r.offset-n.offset)throw new L}#a(e,t){let n=this.#e.get(e),r=this.#t.get(t);if(n!==void 0&&n!==t||r!==void 0&&r!==e)throw new L;this.#e.set(e,t),this.#t.set(t,e);}#d(e,t){let n=wn(e),r=this.#r.get(n);if(r!==void 0&&r!==t)throw new L;this.#r.set(n,t);}#i(e){let t=this.#r.get(wn(e));if(t!==void 0)return t;if(e.readAt!==void 0)throw new L;return e.offset}};var Mo=new Set(["setChangeTrackingMode","insertText","replaceSpan","insertParagraph","splitParagraph","deleteParagraph","setFont","setParagraphFormat","setStyle","proposeInsertion","proposeDeletion","proposeReplacement","insertComment","replyToComment","setCommentResolved","deleteComment","acceptRevision","rejectRevision","acceptAllRevisions","rejectAllRevisions","resolveRevisionBatch","setRevisionAuthorBatch"]);function Vo(o){return automation.isAutomationCommand(o)?o.op==="insertBreak"?o.breakType==="Line":Mo.has(o.op):true}function Wo(o,e){return {...o,execute(t){let n=Array.isArray(t?.operations)?t.operations:[],r=n.findIndex(h=>!Vo(h));if(r>=0)return {ok:false,results:n.map((h,y)=>y===r?{status:"error",error:{code:"unsupported-capability",message:"a preview cannot show this operation",detail:"preview-operation-unsupported"}}:{status:"skipped"}),revision:o.revision(),changed:false};let i=o.revision(),s=kn(n),d=s.length>0?{request:{operations:s},response:o.execute({operations:s})}:void 0,l=o.execute(t);return e.push({request:t,response:l,before:i,...d?{guards:d}:{}}),l}}}function Sn(o){switch(o){case "preview-active":return new x({code:"PreviewActive",diagnostic:"edit.preview-active"});case "no-document":return new x({code:"DocumentUnavailable"});case "viewing":return new x({code:"NotSupported",target:"preview",diagnostic:"edit.read-only"});case "blocked":return new x({code:"NotSupported",target:"preview",diagnostic:"edit.refresh-in-progress"});case "composing":return new x({code:"NotSupported",target:"preview",diagnostic:"edit.preview-composing"})}}async function In(o,e){let t=o.port.begin();if(!t.ok)throw Sn(t.reason);let n=t.fork;try{let r=o.host.revision();Ln(o,n.host);let i=n.host.revision(),s=[],d=await o.runOn(Wo(n.host,s),e);return n.ended&&a({code:"PreviewEnded",target:"preview"}),n.show()||a({code:"GeneralException",target:"preview"}),new Gt(o,n,s,r,i,d)}catch(r){throw n.end(),r}}function Ln(o,e){let n=o.host.execute({operations:[{op:"getChangeTrackingMode"}]}).results[0];n?.status!=="ok"||n.value.kind!=="text"||n.value.text!=="TrackMineOnly"||o.author===void 0||e.execute({operations:[{op:"setChangeTrackingMode",mode:"TrackMineOnly",author:o.author}]});}var Gt=class{constructor(e,t,n,r,i,s){this.runtime=e;this.fork=t;this.log=n;this.base=r;this.forkBase=i;this.result=s;this.#s=e.host.subscribe(d=>{this.#e==="active"&&d.revision!==r&&this.#c("stale");}),this.#a=t.onEnd(()=>this.#u()),e.host.revision()!==r&&this.#c("stale");}runtime;fork;log;base;forkBase;result;#e="active";#t=false;#n=[];#r=new Set;#s;#a;get status(){return this.#e}onStatusChanged(e){return this.#r.add(e),()=>this.#r.delete(e)}discard(){this.#u();}reveal(){return this.#e!=="ended"&&this.fork.reveal()}async commit(e={}){this.#e==="ended"&&a({code:"PreviewEnded",target:"preview"}),this.#t=true;try{let t=e?.rebase===true,n=this.runtime.host.revision(),r=n!==this.base;r&&this.#c("stale"),r&&!t&&a({code:"StaleDocument",target:"preview",expectedRevision:this.base,actualRevision:n}),this.fork.deferEvents(()=>{this.#u(),this.#d(n,r),this.#i(n,r);});}finally{this.#t=false;for(let t of this.#n.splice(0))t();}}#d(e,t){let n=this.runtime.port.begin();if(!n.ok)throw Sn(n.reason);let r=n.fork;try{Ln(this.runtime,r.host);let i=Wt(this.log,{execute:s=>r.host.execute(s),revision:()=>r.host.revision()},this.forkBase,r.host.revision());i.ok||this.#o(i.refusal,e,t);}finally{r.end();}}#i(e,t){let{runtime:n}=this,r=n.port.beginHistoryGroup(),i=n.groupRun(r),s;try{s=Wt(this.log,{execute:d=>i?i.execute(d):n.host.execute(d),revision:()=>n.host.revision()},this.forkBase,e);}finally{i?.finish(),r.end();}s.ok||(s.wrote&&!n.port.undo()&&a({code:"GeneralException",target:"preview.rollback"}),this.#o(s.refusal,e,t));}#o(e,t,n){if(e)throw e;a(n?{code:"StaleDocument",target:"preview",expectedRevision:this.base,actualRevision:t,diagnostic:"edit.preview-diverged"}:{code:"GeneralException",target:"preview",diagnostic:"edit.preview-diverged"});}#c(e){if(!(this.#e===e||this.#e==="ended")){this.#e=e;for(let t of [...this.#r]){let n=()=>{try{t(e);}catch{}};this.#t?this.#n.push(n):n();}}}#u(){this.#e!=="ended"&&(this.#s?.(),this.#a?.(),this.fork.end(),this.#c("ended"),this.#r.clear());}};function Uo(o,e){let t=r=>r===void 0?[]:Array.isArray(r)?r:[r];if(typeof o=="function")return {callback:o,adopted:[],historyGroup:void 0};if(o instanceof z||Array.isArray(o))return {callback:e,adopted:t(o),historyGroup:void 0};(o===null||typeof o!="object")&&a({code:"InvalidArgument",target:"run"});let n=o;return {callback:e,adopted:t(n.previousObjects),historyGroup:n.historyGroup}}function zo(o,e){return {...o,execute(t){let n=e.execute(t);return n===null&&a({code:"InvalidArgument",target:"historyGroup"}),n}}}function jn(o){let e=o.host,t=Object.freeze({...e.capabilities,save:o.save&&e.capabilities.save,preview:o.preview!==void 0}),n=typeof o.author=="string"&&o.author.trim().length>0?o.author.trim():void 0,r=o.revisionTextView??"allMarkup";r!=="allMarkup"&&r!=="original"&&a({code:"InvalidArgument",target:"revisionTextView"});let i=false,s=null,d=C=>{i&&a({code:"RuntimeDisposed",...C===void 0?{}:{target:C}});},l=()=>s||(d("document"),s=h(e),s),h=C=>{let f=pe=>{try{return C.execute({operations:pe})}catch(Ge){try{o.onException?.(Ge,pe);}catch{}throw Ge}},g=Tn(f([{op:"getDocument"}]),"document"),V=Tn(f([{op:"getBody",document:g}]),"document.body");return {document:g,body:V}},y={host:e,capabilities:t,...n===void 0?{}:{author:n},revisionTextView:r,...o.onRefusal?{onRefusal:o.onRefusal}:{},...o.onException?{onException:o.onException}:{},id:{},roots:l,assertLive:d,openDocument:C=>Ve.open(C)},m=C=>{let f=o.preview;return f?{...C,execute(g){return f.active()&&g.operations.some(V=>automation.isAutomationCommand(V))&&a({code:"PreviewActive",diagnostic:"edit.preview-active"}),C.execute(g)}}:C},b=o.preview?{...y,host:m(e)}:y,j=async(C,f)=>{let g=null,{context:V,finish:pe}=Ae.begin({...y,host:C,capabilities:Object.freeze({...C.capabilities,preview:false}),id:{},roots:()=>g??=h(C)});try{return await f(V)}finally{pe();}},H=new Set;async function ee(C){d("preview"),typeof C!="function"&&a({code:"InvalidArgument",target:"preview"});let f=o.preview;f||a({code:"NotSupported",target:"preview"});let g=await In({port:f,host:e,...n===void 0?{}:{author:n},groupRun:V=>o.historyGroups?.begin(V)??null,runOn:j},C);return H.add(g),g.onStatusChanged(V=>{V==="ended"&&H.delete(g);}),g}try{l();}catch{s=null;}async function xe(C,f){d();let{callback:g,adopted:V,historyGroup:pe}=Uo(C,f);typeof g!="function"&&a({code:"InvalidArgument",target:"run"});let Ge=b,ot=null;pe!==void 0&&(o.historyGroups||a({code:"NotSupported",target:"historyGroup"}),ot=o.historyGroups.begin(pe),ot===null&&a({code:"InvalidArgument",target:"historyGroup"}),Ge={...y,host:m(zo(e,ot))});let{context:Wn,adopt:Gn,finish:Un}=Ae.begin(Ge);try{return Gn(V),await g(Wn)}finally{Un(),ot?.finish();}}let We={capabilities:t,run:xe,preview:ee,dispose(){if(!i){i=true,s=null;for(let C of [...H])C.discard();e.dispose();}}};return o.save?{...We,async save(){d("save"),t.save||a({code:"NotSupported",target:"save"});let C=e.save();if(!C.ok)throw Re(C.error,{target:"save"});return C.bytes}}:We}function Tn(o,e){let t=o.results[0];if(t?.status==="error")throw Re(t.error,{target:e});if(t?.status!=="ok")throw new x({code:"GeneralException",target:e});return A(t.value,e)}var Yo={StaleDocument:"edit.stale-target",ItemNotFound:"edit.stale-target",InvalidObjectPath:"edit.stale-target",InvalidArgument:"edit.invalid-argument",ResourceLimitExceeded:"edit.resource-limit",NotSupported:"edit.operation-unsupported",NotImplemented:"edit.operation-unsupported"};function Jo(o){try{let e=o.execute({operations:[{op:"getChangeTrackingMode"}]}),t=e.ok?e.results[0]:void 0;return t?.status==="ok"&&t.value.kind==="text"&&t.value.text!=="Off"}catch{return false}}function Nn(o,e){return e.some(n=>n.op==="setChangeTrackingMode"&&n.mode!=="Off")||Jo(o)}function _o(o,e,t){let n=o.debugInfo.innerError?.code;return {code:n?.startsWith("edit.")?n:Yo[o.code]??"edit.refused",tracked:Nn(e,t)}}function er(o){for(let e of o)switch(e.op){case "acceptRevision":case "acceptAllRevisions":return "accept";case "rejectRevision":case "rejectAllRevisions":return "reject";case "resolveRevisionBatch":return e.action;case "setRevisionAuthorBatch":return "reassign"}}function tr(o){let e=o.debugInfo.innerError?.code;return e?.startsWith("review.")?e:null}function qn(o){if(o.length===0)return null;let{deliver:e}=automation.createDiagnosticEmitter(()=>o);return {openRejected(t,n,r,i){let s=automation.diagnosticCause(n),d=automation.documentPartKind(i);e({kind:"document.open",outcome:"rejected",code:automation.openDiagnosticCode(n,r),sizeBucket:automation.byteSizeBucket(t.byteLength),...s?{cause:s}:{},...d?{part:d}:{}});},openCrashed(t,n){e({kind:"document.open",outcome:"rejected",code:"open.failed",sizeBucket:automation.byteSizeBucket(t.byteLength),cause:automation.exceptionCause(),errorName:automation.diagnosticErrorName(n)});},opened(t,n){e({kind:"document.open",outcome:"opened",sizeBucket:automation.byteSizeBucket(t.byteLength),durationMs:Math.max(0,Math.round(n))});},crashed(t,n,r){e({kind:"edit.rejected",code:"edit.internal-invariant",origin:"automation",tracked:Nn(n,r),cause:automation.exceptionCause(),errorName:automation.diagnosticErrorName(t),stage:"automation"});},refused(t,n,r){let i=an(t),s=tr(t);if(s){let d=er(r);e({kind:"review.skipped",code:s,count:1,...d?{operation:d}:{},...i?{cause:i}:{}});return}e({kind:"edit.rejected",origin:"automation",..._o(t,n,r),...i?{cause:i}:{}});}}}function rr(o){if(o){for(let e of o)if(e.collaboration)return e.collaboration}}function ir(o){let e=[o?.zip?.maxEntries,o?.zip?.maxTotalBytes,o?.xml?.maxBytes,o?.xml?.maxElements,o?.maxXmlParts,o?.maxRelationships],t=o?.zip?.maxRatio;(e.some(n=>n!==void 0&&(!Number.isInteger(n)||n<0))||t!==void 0&&(!Number.isFinite(t)||t<0))&&a({code:"InvalidArgument",target:"createServer"});}async function zt(o,e={}){let t=qn((e.modules??[]).flatMap(d=>d.onDiagnostic?[d.onDiagnostic]:[])),n=Date.now();try{ir(e.limits);}catch(d){throw t?.openRejected(o,"invalid-limits"),d}let r=rr(e.modules),i=e.modules?.find(d=>d.review?.compareDocuments)?.review?.compareDocuments,s;try{s=automation.createServerAutomationHost(o,{...e.pagination?{pagination:Kt(e.pagination)}:{},...e.limits===void 0?{}:{limits:e.limits},...r===void 0?{}:{collaborationModel:r},...i===void 0?{}:{compareDocuments:i}});}catch(d){throw t?.openCrashed(o,d),d}if(!s.ok){let d={"too-many-entries":"zip.maxEntries","too-large":"xml.maxBytes","too-many-elements":"xml.maxElements","too-deep":"xml.maxDepth","too-many-xml-parts":"maxXmlParts","too-many-relationships":"maxRelationships"},l=s.limit??d[s.reason];t?.openRejected(o,s.reason,s.limit,s.detail),a({code:l===void 0?"InvalidArgument":"ResourceLimitExceeded",target:"createServer",...l===void 0?{}:{limit:l},diagnostic:automation.openDiagnosticCode(s.reason,s.limit)});}return t?.opened(o,Date.now()-n),jn({host:s.host,save:true,...e.author===void 0?{}:{author:e.author},...e.revisionTextView===void 0?{}:{revisionTextView:e.revisionTextView},...t?{onRefusal:(d,l)=>t.refused(d,s.host,l),onException:(d,l)=>t.crashed(d,s.host,l)}:{}})}function Bn(o,e,t={}){return zt(o,{...t,modules:[...t.modules??[],{id:"collaboration",collaboration:{session:e}}]})}function $n(o,e,t,n){let r=typeof o=="object"&&o!==null?Y(o):void 0;return r||a({code:"InvalidArgument",target:t}),(typeof e!="string"||e.length===0)&&a({code:"InvalidArgument",target:t}),n.some(i=>e.startsWith(i))&&a({code:"NotSupported",target:t}),r.assertUsable(t),r}function Hn(o,e,t){let n=t?"getReviewItemRangeOrNullObject":"getReviewItemRange",r=$n(o,e,n,["custom-"]),i=R.promised(o,n,t);return r.queue.push({sort:"read",label:n,plan:()=>({op:"getReviewItemRange",key:e}),settle:s=>{let[d]=te(s,n);d?i.hydrateAddress({kind:"span",span:d}):t?i.hydrateNull():a({code:"ItemNotFound",target:n});}}),i}function Fn(o,e){let t="getReviewItemRevisions",n=$n(o,e,t,["custom-","comment-"]);return M.ofReviewKey(o,t,c.of("document",n.roots().document),e)}function Mn(o,e){return Hn(o,e,false)}function Vn(o,e){return Hn(o,e,true)}var Qt=(u=>(u.addin="Addin",u.addressBlock="AddressBlock",u.advance="Advance",u.ask="Ask",u.author="Author",u.autoText="AutoText",u.autoTextList="AutoTextList",u.barCode="BarCode",u.bibliography="Bibliography",u.bidiOutline="BidiOutline",u.citation="Citation",u.comments="Comments",u.compare="Compare",u.createDate="CreateDate",u.data="Data",u.database="Database",u.date="Date",u.displayBarcode="DisplayBarcode",u.docProperty="DocProperty",u.docVariable="DocVariable",u.editTime="EditTime",u.embedded="Embedded",u.empty="Empty",u.eq="EQ",u.expression="Expression",u.fileName="FileName",u.fileSize="FileSize",u.fillIn="FillIn",u.formCheckbox="FormCheckbox",u.formDropdown="FormDropdown",u.formText="FormText",u.gotoButton="GotoButton",u.greetingLine="GreetingLine",u.hyperlink="Hyperlink",u.if="If",u.import="Import",u.include="Include",u.includePicture="IncludePicture",u.includeText="IncludeText",u.index="Index",u.info="Info",u.keywords="Keywords",u.lastSavedBy="LastSavedBy",u.link="Link",u.listNum="ListNum",u.macroButton="MacroButton",u.mergeBarcode="MergeBarcode",u.mergeField="MergeField",u.mergeRec="MergeRec",u.mergeSeq="MergeSeq",u.next="Next",u.nextIf="NextIf",u.noteRef="NoteRef",u.numChars="NumChars",u.numPages="NumPages",u.numWords="NumWords",u.ocx="OCX",u.others="Others",u.page="Page",u.pageRef="PageRef",u.print="Print",u.printDate="PrintDate",u.private="Private",u.quote="Quote",u.rd="RD",u.ref="Ref",u.revNum="RevNum",u.saveDate="SaveDate",u.section="Section",u.sectionPages="SectionPages",u.seq="Seq",u.set="Set",u.shape="Shape",u.skipIf="SkipIf",u.styleRef="StyleRef",u.subject="Subject",u.subscriber="Subscriber",u.symbol="Symbol",u.ta="TA",u.tc="TC",u.template="Template",u.time="Time",u.title="Title",u.toa="TOA",u.toc="TOC",u.undefined="Undefined",u.userAddress="UserAddress",u.userInitials="UserInitials",u.userName="UserName",u.xe="XE",u))(Qt||{});var Jd=Object.freeze({createServer:zt,createCollaborative:Bn});exports.Alignment=wt;exports.Body=E;exports.Bookmark=qe;exports.BookmarkCollection=de;exports.BreakType=Lt;exports.ChangeTrackingMode=St;exports.ChangeTrackingVersion=Ot;exports.ClientObject=z;exports.ClientResult=ze;exports.Comment=le;exports.CommentCollection=ce;exports.CommentReply=ye;exports.CommentReplyCollection=tt;exports.CompareTarget=Et;exports.ContentControl=J;exports.ContentControlCollection=N;exports.ContentControlType=Tt;exports.Document=Ve;exports.DocumentProperties=Ce;exports.DocxEditor=Jd;exports.DocxEditorError=x;exports.Field=ue;exports.FieldCollection=he;exports.FieldType=Qt;exports.Font=X;exports.InlinePicture=re;exports.InlinePictureCollection=ie;exports.InsertLocation=Ct;exports.List=U;exports.ListBullet=Bt;exports.ListCollection=je;exports.ListItem=Ee;exports.ListNumbering=$t;exports.NoteItem=ke;exports.NoteItemCollection=Q;exports.PageOrientation=kt;exports.PageSetup=nt;exports.Paragraph=B;exports.ParagraphCollection=q;exports.Range=R;exports.RangeCollection=$;exports.RangeLocation=Pt;exports.RemoveDocInfoType=jt;exports.RequestContext=Ae;exports.Revision=_;exports.RevisionCollection=M;exports.Section=$e;exports.SectionCollection=He;exports.Shape=we;exports.ShapeCollection=ne;exports.ShapeFill=Oe;exports.ShapeFillType=At;exports.ShapeType=at;exports.Style=Fe;exports.StyleCollection=Me;exports.StyleType=Mt;exports.Table=fe;exports.TableCell=se;exports.TableCellCollection=_e;exports.TableCollection=ae;exports.TableRow=Le;exports.TableRowCollection=be;exports.TrackedObjects=Xe;exports.UnderlineType=Ht;exports.VerticalAlignment=It;exports.getReviewItemRange=Mn;exports.getReviewItemRangeOrNullObject=Vn;exports.getReviewItemRevisions=Fn;exports.isDocxEditorError=Ue;