@docx-editor.dev/editor-api 2.16.2 → 2.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.mjs CHANGED
@@ -1 +1 @@
1
- import {createBrowserAutomationHost}from'@docx-editor.dev/core/editor';import {createServerAutomationHost}from'@docx-editor.dev/core/automation';var Tt=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. An object an item accessor answered is usable after the next await context.sync(); an object whose run has ended is released for good, unless context.trackedObjects.add(...) kept it.",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:"this document host does not support that operation.",NotImplemented:"this version does not implement that yet.",ConflictingChanges:"two changes in this batch affect the same paragraph. Split them across two context.sync() calls.",InvalidRequestContext:"the request context has finished. Start another run to continue.",RuntimeDisposed:"the runtime has been disposed.",StaleDocument:"the document changed after this context read it, so nothing was applied.",DocumentUnavailable:"the document is not available right now.",GeneralException:"the document could not complete the request."}),u=class extends Error{code;limit;target;expectedRevision;actualRevision;constructor(t){let e=t.target?`${Tt[t.code]} (${t.target})`:Tt[t.code];super(e),this.name="DocxEditorError",this.code=t.code,t.limit!==void 0&&(this.limit=t.limit),t.target!==void 0&&(this.target=t.target),t.expectedRevision!==void 0&&(this.expectedRevision=t.expectedRevision),t.actualRevision!==void 0&&(this.actualRevision=t.actualRevision);}};function ne(n){return n instanceof u?true:typeof n=="object"&&n!==null&&n.name==="DocxEditorError"&&typeof n.code=="string"}function a(n){throw new u(n)}var F=Symbol("docx-editor.runtime.internals"),mt=Symbol("docx-editor.runtime.release"),gt=Symbol("docx-editor.runtime.rebind");function H(n){return n[F]}var re=new Set(["select","expand","top","skip"]),ie=/^[A-Za-z][A-Za-z0-9]*$/;function Et(n,t){if(n===void 0)return [];let e=typeof n=="string"?n.split(",").map(r=>r.trim()):Array.isArray(n)?n.map(r=>typeof r=="string"?r.trim():r):a({code:"InvalidArgument",target:t}),o=[];for(let r of e)(typeof r!="string"||!ie.test(r))&&a({code:"InvalidArgument",target:t}),o.includes(r)||o.push(r);return o.length===0&&a({code:"InvalidArgument",target:t}),o}function Nt(n,t){return (typeof n!="number"||!Number.isInteger(n)||n<0)&&a({code:"InvalidArgument",target:t}),n}function ae(n,t){n===void 0||Array.isArray(n)&&n.length===0||a({code:"InvalidArgument",target:t});}function qt(n,t){if(n===void 0)return {select:[]};if(typeof n=="string"||Array.isArray(n))return {select:Et(n,t)};(typeof n!="object"||n===null)&&a({code:"InvalidArgument",target:t});let e=n;for(let o of Object.keys(e))re.has(o)||a({code:"InvalidArgument",target:`${t}.${o}`});return ae(e.expand,`${t}.expand`),{select:Et(e.select,`${t}.select`),...e.top===void 0?{}:{top:Nt(e.top,`${t}.top`)},...e.skip===void 0?{}:{skip:Nt(e.skip,`${t}.skip`)}}}var T=class{#t;#e;#o;#n;#r=new Map;constructor(t,e,o={}){this.#t=t,this.#e=t[F],this.#o=e,this.#n=o.nullable===true,this.#e.register(this);}get context(){return this.#t}get isNullObject(){return this.#o.isReleased&&a({code:"InvalidObjectPath",target:this.#o.label}),this.#n?(this.#o.isPending&&a({code:"PropertyNotLoaded",target:`${this.#o.label}.isNullObject`}),this.#o.isNull):false}load(t){return this.requireAddressable(),this.onLoad(qt(t,this.#o.label)),this}get path(){return this.#o}get internals(){return this.#e}handle(){return this.#o.handle()}requireAddressable(){this.#o.isAddressable||a({code:"InvalidObjectPath",target:this.#o.label}),this.#e.assertUsable(this.#o.label);}enqueue(t){this.requireAddressable(),this.#e.queue.push(t);}loadedProperty(t){return this.#o.isReleased&&!this.#r.has(t)&&a({code:"InvalidObjectPath",target:this.#o.label}),this.#r.has(t)||a({code:"PropertyNotLoaded",target:`${this.#o.label}.${t}`}),this.#r.get(t)}hasLoadedProperty(t){return this.#r.has(t)}setLoadedProperty(t,e){this.#r.set(t,e);}[mt](){this.#o.release();}[gt](t){this.#t=t,this.#e=t[F];}};var Pt=class n{#t=false;#e;#o;constructor(t){this.#o=t;}get value(){return this.#t||a({code:"ValueNotLoaded",target:this.#o}),this.#e}get isLoaded(){return this.#t}static create(t){let e=new n(t);return {result:e,fill(o){e.#t=true,e.#e=o;}}}};function O(n){return new u({code:"GeneralException",target:n})}function b(n,t){if(n.kind!=="text")throw O(t);return n.text}function f(n,t){if(n.kind!=="handle")throw O(t);return n.handle}function P(n,t){if(n.kind!=="handles")throw O(t);return n.handles}function x(n,t){if(n.kind!=="span")throw O(t);return n.span}function ft(n,t){if(n.kind!=="spans")throw O(t);return n.spans}function kt(n,t){if(n.kind!=="font")throw O(t);return n.font}function It(n,t){if(n.kind!=="paragraphFormat")throw O(t);return n.format}function at(n,t){if(n.kind!=="style")throw O(t);return n.name}function yt(n,t){if(n.kind!=="number")throw O(t);return n.value}function M(n,t){if(n.kind!=="flag")throw O(t);return n.value}function St(n,t){if(n.kind!=="pageSetup")throw O(t);return n.setup}function C(n,t){if(n.kind!=="applied")throw O(t)}var l=class n{label;#t;#e;constructor(t,e,o=null){this.label=t,this.#t=e,this.#e=o;}static of(t,e){return new n(t,{status:"resolved",address:{kind:"handle",handle:e}})}static ofSpan(t,e){return new n(t,{status:"resolved",address:{kind:"span",span:e}})}static pending(t){return new n(t,{status:"pending"})}static derived(t,e){return new n(t,{status:"pending"},e)}get state(){return this.#e?this.#e.state:this.#t}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 t=this.state;if(t.status==="resolved")return t.address;a({code:"InvalidObjectPath",target:this.label});}handle(){let t=this.address();return t.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.label}),t.handle}span(){let t=this.address();return t.kind!=="span"&&a({code:"InvalidObjectPath",target:this.label}),t.span}resolveTo(t){this.#o({kind:"handle",handle:t});}resolveToSpan(t){this.#o({kind:"span",span:t});}resolveNull(){this.#t.status!=="released"&&(this.#t={status:"null"});}release(){this.#e||(this.#t={status:"released"});}#o(t){this.#t.status!=="released"&&(this.#t={status:"resolved",address:t});}};function Dt(n){let t=[],e=false,o=false;for(let r of n)t.push(r.plan()),r.sort==="write"?o=true:e=true;return {operations:t,hasRead:e,hasWrite:o}}var se=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 bt(n,t={}){let e=se[n.code]??"GeneralException",o=e==="StaleDocument";return new u({code:e,...t.target===void 0?{}:{target:t.target},...o&&t.expectedRevision!==void 0?{expectedRevision:t.expectedRevision}:{},...o&&t.actualRevision!==void 0?{actualRevision:t.actualRevision}:{}})}function $t(n,t,e){for(let o=0;o<n.results.length;o+=1){let r=n.results[o];if(r?.status!=="error")continue;let i=t[o]?.label;return bt(r.error,{...i===void 0?{}:{target:i},...e===void 0?{}:{expectedRevision:e},actualRevision:n.revision})}return new u({code:"GeneralException"})}function Bt(n,t){if(t.results.length!==n.length)throw new u({code:"GeneralException"});for(let e=0;e<n.length;e+=1){let o=t.results[e],r=n[e];if(o.status!=="ok")throw new u({code:"GeneralException",target:r.label});r.settle(o.value);}}var xt=class{#t=[];get size(){return this.#t.length}get pending(){return this.#t}push(t){this.#t.push(t);}take(){let t=this.#t;return this.#t=[],t}clear(){this.#t=[];}};function Ft(n,t){if(Array.isArray(n)){for(let e of n)t(e);return}t(n);}var st=class{#t;#e;constructor(t,e){this.#t=t,this.#e=e;}add(t){this.#t.assertUsable(),Ft(t,e=>{this.#o(e),this.#t.track(e);});}remove(t){this.#t.assertUsable(),Ft(t,e=>{this.#o(e),this.#t.untrack(e);});}#o(t){this.#e(t)||a({code:"InvalidObjectPath"});}};var dt=class n{#t;#e=new xt;#o=new Set;#n=new Set;#r;#s;#i;#a=false;#d=null;constructor(t){this.#t=t,this.#r={host:t.host,capabilities:t.capabilities,...t.author===void 0?{}:{author:t.author},revisionTextView:t.revisionTextView,queue:this.#e,session:t.id,roots:()=>t.roots(),assertUsable:e=>{this.#t.assertLive(e),this.#a&&a({code:"InvalidRequestContext",...e===void 0?{}:{target:e}});},isFinished:()=>this.#a,readRevision:()=>this.#d,register:e=>{this.#o.add(e);},track:e=>{this.#n.add(e);},untrack:e=>{this.#n.delete(e);},isTracked:e=>this.#n.has(e),disown:e=>{this.#o.delete(e),this.#n.delete(e);}},this.#s=new st(this.#r,e=>this.#o.has(e));}get document(){return this.#r.assertUsable("document"),this.#i??=this.#t.openDocument(this),this.#i}get capabilities(){return this.#t.capabilities}get trackedObjects(){return this.#s}async sync(){this.#r.assertUsable();let t=this.#e.take();if(t.length===0)return;let e=Dt(t),r=e.hasWrite&&this.#d!==null?this.#d:void 0,i={operations:e.operations,...r===void 0?{}:{expectedRevision:r}},s=this.#t.host.execute(i);if(!s.ok)throw $t(s,t,r);Bt(t,s),(e.hasRead||e.hasWrite)&&(this.#d=s.revision);}get[F](){return this.#r}static begin(t){let e=new n(t);return {context:e,adopt(o){for(let r of o)e.#l(r);},finish(){e.#p();}}}#l(t){let e=t.context;if(e===this)return;let o=e[F];if(o.session!==this.#t.id)throw new u({code:"InvalidObjectPath"});if(!o.isFinished())throw new u({code:"ObjectInUse"});if(!o.isTracked(t))throw new u({code:"InvalidObjectPath"});let r=o.readRevision();o.disown(t),t[gt](this),this.#o.add(t),this.#n.add(t),r!==null&&this.#c(r);}#c(t){this.#d=this.#d===null?t:Math.min(this.#d,t);}#p(){if(!this.#a){this.#a=true,this.#e.clear();for(let t of this.#o)this.#n.has(t)||t[mt]();this.#o.clear();}}};function lt(n,t,e){if(n.select.length===0)return t;for(let o of n.select)t.includes(o)||a({code:"InvalidArgument",target:`${e}.${o}`});return n.select}var Q=class extends T{#t;#e=[];constructor(t,e){super(t,e);}get items(){return this.loadedProperty("items")}fill(t,e){this.setLoadedProperty("items",this.#n(t,e,0,void 0)),this.#t={value:t,label:e};let o=this.#e.splice(0,this.#e.length);for(let r of o)this.#o(r,t);}onLoad(t){lt(t,["items"],this.path.label);let e=this.listing();if(!e)return;let o=`${this.path.label}.items`,r=t.skip??0,i=t.top;this.enqueue({sort:"read",label:o,plan:()=>e,settle:s=>{this.setLoadedProperty("items",this.#n(s,o,r,i));}});}edge(t,e,o){let r=`${this.path.label}.${e}()`,i=this.promised(r,o),s=this.listing();if(!s){let d={edge:t,target:r,nullable:o,item:i};return this.#t?this.#o(d,this.#t.value):this.#e.push(d),i}return this.enqueue({sort:"read",label:r,plan:()=>s,settle:d=>{this.#o({edge:t,target:r,nullable:o,item:i},d);}}),i}#o(t,e){let{edge:o,target:r,nullable:i,item:s}=t,d=this.size(e,r);if(d===0){i||a({code:"ItemNotFound",target:r}),s.hydrateNull();return}let c=this.addressAt(e,r,o==="first"?0:d-1);c||a({code:"ItemNotFound",target:r}),s.hydrateAddress(c);}#n(t,e,o,r){let i=this.size(t,e),s=r===void 0?i:Math.min(i,o+r),d=[];for(let c=o;c<s;c+=1){let g=this.addressAt(t,e,c);g&&d.push(this.itemAt(`${e}[${String(c)}]`,g));}return d}},y=class extends Q{size(t,e){return P(t,e).length}addressAt(t,e,o){let r=P(t,e)[o];return r?{kind:"handle",handle:r}:void 0}};var de=["Replace","Start","End"],le=["Start","End"],ce=["Replace","Start","End"],pe=["Before","After"],he=["Replace","Start","End","Before","After"],ue=["Select","Start","End"];function X(n,t,e){return (typeof n!="string"||!t.includes(n))&&a({code:"InvalidArgument",target:e}),n}var Ht=(n,t)=>X(n,de,t),Mt=(n,t)=>X(n,le,t),Vt=(n,t)=>X(n,ce,t),Wt=(n,t)=>X(n,pe,t),wt=(n,t)=>X(n,he,t),Ct=(n,t)=>n===void 0?"Select":X(n,ue,t);function A(n,t){return typeof n!="string"&&a({code:"InvalidArgument",target:t}),/[\r\n\v\f\u2028\u2029]/.test(n)&&a({code:"InvalidArgument",target:t}),n}var p=class extends T{revisionTextView(){return H(this.context).revisionTextView}loadTextInto(t,e){let o=`${this.path.label}.${t}`;this.enqueue({sort:"read",label:o,plan:e,settle:r=>{this.setLoadedProperty(t,b(r,o));}});}command(t,e){let o=`${this.path.label}.${t}`;this.enqueue({sort:"write",label:o,plan:e,settle:r=>C(r,o)});}commandDiscarding(t,e){let o=`${this.path.label}.${t}`;this.enqueue({sort:"write",label:o,plan:e,settle:()=>{}});}commandAnswering(t,e,o){this.enqueue({sort:"write",label:t,plan:e,settle:o});}read(t,e,o){this.enqueue({sort:"read",label:t,plan:e,settle:o});}selection(t,e){return lt(t,e,this.path.label)}onLoad(t){this.selection(t,[]);}};var me=8,L=class n extends p{#t;static at(t,e,o){return o.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new n(t,l.of(e,o.handle),false)}static promised(t,e,o){return new n(t,l.pending(e),o)}constructor(t,e,o){super(t,e,{nullable:o});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get id(){return this.loadedProperty("id")}get paragraphs(){return this.#t??=v.overListing(this.context,`${this.path.label}.paragraphs`,this.path,()=>({op:"getListParagraphs",list:this.#e()})),this.#t}getLevelParagraphs(t){let e=`${this.path.label}.getLevelParagraphs`,o=zt(t,e),r=this.#e();return v.overListing(this.context,e,this.path,()=>({op:"getListParagraphs",list:r,level:o}))}insertParagraph(t,e){let o=`${this.path.label}.insertParagraph`,r=A(t,o);e!=="Start"&&e!=="End"&&e!=="Before"&&e!=="After"&&a({code:"InvalidArgument",target:o});let i=this.#e(),s=R.promised(this.context,o,false);return this.commandAnswering(o,()=>({op:"insertListParagraph",list:i,where:e==="Start"||e==="Before"?"start":"end",text:r}),d=>{s.hydrateAddress({kind:"handle",handle:f(d,o)});}),s}onLoad(t){if(!this.selection(t,["id"]).includes("id"))return;let e=`${this.path.label}.id`,o=this.#e();this.read(e,()=>({op:"getListId",list:o}),r=>{this.setLoadedProperty("id",yt(r,e));});}#e(){return this.requireAddressable(),this.path.handle()}},K=class n extends y{#t;static of(t,e,o,r){return new n(t,l.derived(e,o),r)}constructor(t,e,o){super(t,e),this.#t=o;}getFirst(){return this.edge("first","getFirst",false)}getById(t){let e=`${this.path.label}.getById`,o=ge(t,e),r=this.#t,i=L.promised(this.context,e,false);return this.enqueue({sort:"read",label:e,plan:()=>({op:"getListById",body:r,id:o}),settle:s=>{i.hydrateAddress({kind:"handle",handle:f(s,e)});}}),i}listing(){return {op:"getLists",body:this.#t}}itemAt(t,e){return L.at(this.context,t,e)}promised(t,e){return L.promised(this.context,t,e)}},Z=class n extends p{static of(t,e,o){return new n(t,l.derived(e,o))}constructor(t,e){super(t,e);}get level(){return this.loadedProperty("level")}set level(t){let e=`${this.path.label}.level`,o=zt(t,e),r=this.#t();this.commandAnswering(e,()=>({op:"setListLevel",paragraph:r,level:o}),i=>{C(i,e);});}onLoad(t){if(!this.selection(t,["level"]).includes("level"))return;let e=`${this.path.label}.level`,o=this.#t();this.read(e,()=>({op:"getListLevel",paragraph:o}),r=>{this.setLoadedProperty("level",yt(r,e));});}#t(){this.requireAddressable();let t=this.path.address();return t.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.path.label}),t.handle}};function zt(n,t){return (!Number.isInteger(n)||n<0||n>me)&&a({code:"InvalidArgument",target:t}),n}function ge(n,t){return (!Number.isInteger(n)||n<=0)&&a({code:"InvalidArgument",target:t}),n}function E(n,t){let e=n.address();return t==="span"?(e.kind!=="span"&&a({code:"InvalidObjectPath",target:n.label}),{start:e.span.start,end:e.span.end}):(e.kind!=="handle"&&a({code:"InvalidObjectPath",target:n.label}),t==="body"?{body:e.handle}:{paragraph:e.handle})}function Y(n,t){return (typeof n!="string"||n.trim().length===0||n.length>255)&&a({code:"InvalidArgument",target:t}),n}var fe=["bold","italic","color","name","size"],I=class n extends p{#t;#e;static of(t,e,o,r){return new n(t,l.derived(e,o),r)}constructor(t,e,o){super(t,e),this.#t=o;}get bold(){return this.loadedProperty("bold")}set bold(t){this.#o("bold",Ut(t,`${this.path.label}.bold`));}get italic(){return this.loadedProperty("italic")}set italic(t){this.#o("italic",Ut(t,`${this.path.label}.italic`));}get color(){return this.loadedProperty("color")}set color(t){this.#o("color",Gt(t,`${this.path.label}.color`));}get name(){return this.loadedProperty("name")}set name(t){this.#o("name",Gt(t,`${this.path.label}.name`));}get size(){return this.loadedProperty("size")}set size(t){this.#o("size",ye(t,`${this.path.label}.size`));}onLoad(t){let e=this.selection(t,fe);if(e.length===0)return;let o=`${this.path.label}.font`;this.read(o,()=>({op:"getFont",span:this.#n()}),r=>{let i=kt(r,o);for(let s of e)this.setLoadedProperty(s,i[s]);});}#o(t,e){if(this.requireAddressable(),this.#e){this.#e[t]=e;return}let o={[t]:e};this.#e=o;let r=`${this.path.label}.${t}`;this.commandAnswering(this.path.label,()=>(this.#e=void 0,{op:"setFont",span:this.#n(),font:o}),i=>{C(i,r);});}#n(){return this.requireAddressable(),E(this.path,this.#t)}};function Ut(n,t){return typeof n!="boolean"&&a({code:"InvalidArgument",target:t}),n}function ye(n,t){return (typeof n!="number"||!Number.isFinite(n))&&a({code:"InvalidArgument",target:t}),n}function Gt(n,t){return (typeof n!="string"||n.length===0)&&a({code:"InvalidArgument",target:t}),n}var be=16,R=class n extends p{#t;#e;#o;#n;static at(t,e,o){return o.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new n(t,l.of(e,o.handle),false)}static promised(t,e,o){return new n(t,l.pending(e),o)}constructor(t,e,o){super(t,e,{nullable:o});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get text(){return this.loadedProperty("text")}get uniqueLocalId(){return this.loadedProperty("uniqueLocalId")}get style(){return this.loadedProperty("style")}set style(t){this.#r("style",Y(t,`${this.path.label}.style`));}get font(){return this.#t??=I.of(this.context,`${this.path.label}.font`,this.path,"paragraph"),this.#t}get alignment(){return this.loadedProperty("alignment")}set alignment(t){this.#r("alignment",Ce(t,`${this.path.label}.alignment`));}get firstLineIndent(){return this.loadedProperty("firstLineIndent")}set firstLineIndent(t){this.#r("firstLineIndent",J(t,`${this.path.label}.firstLineIndent`));}get leftIndent(){return this.loadedProperty("leftIndent")}set leftIndent(t){this.#r("leftIndent",J(t,`${this.path.label}.leftIndent`));}get rightIndent(){return this.loadedProperty("rightIndent")}set rightIndent(t){this.#r("rightIndent",J(t,`${this.path.label}.rightIndent`));}get lineSpacing(){return this.loadedProperty("lineSpacing")}set lineSpacing(t){this.#r("lineSpacing",J(t,`${this.path.label}.lineSpacing`));}get spaceBefore(){return this.loadedProperty("spaceBefore")}set spaceBefore(t){this.#r("spaceBefore",J(t,`${this.path.label}.spaceBefore`));}get spaceAfter(){return this.loadedProperty("spaceAfter")}set spaceAfter(t){this.#r("spaceAfter",J(t,`${this.path.label}.spaceAfter`));}get list(){return this.#e??=this.#s(`${this.path.label}.list`),this.#e}get listItem(){return this.#o??=Z.of(this.context,`${this.path.label}.listItem`,this.path),this.#o}clear(){let t=this.#i();this.commandDiscarding("clear",()=>({op:"replaceSpan",span:{paragraph:t},text:""}));}delete(){let t=this.#i();this.command("delete",()=>({op:"deleteParagraph",paragraph:t}));}insertText(t,e){let o=`${this.path.label}.insertText`,r=A(t,o),i=Vt(e,o),s=this.#i(),d=m.promised(this.context,o,false);return this.commandAnswering(o,()=>i==="Replace"?{op:"replaceSpan",span:{paragraph:s},text:r}:{op:"insertText",at:{paragraph:s,at:i==="Start"?"start":"end"},text:r},c=>{d.hydrateAddress({kind:"span",span:x(c,o)});}),d}insertParagraph(t,e){let o=`${this.path.label}.insertParagraph`,r=A(t,o),i=Wt(e,o),s=this.#i(),d=n.promised(this.context,o,false);return this.commandAnswering(o,()=>({op:"insertParagraph",anchor:{paragraph:s},where:i==="Before"?"before":"after",text:r}),c=>{c.kind!=="handle"&&a({code:"GeneralException",target:o}),d.hydrateAddress({kind:"handle",handle:c.handle});}),d}split(t,e,o){let r=`${this.path.label}.split`,i=Ae(t,r),s=Xt(e,`${r}.trimDelimiters`),d=Xt(o,`${r}.trimSpacing`),c=this.#i(),g=S.answered(this.context,r,this.path);return this.commandAnswering(r,()=>({op:"splitParagraph",paragraph:c,delimiters:i,...s?{trimDelimiters:true}:{},...d?{trimSpacing:true}:{}}),w=>{g.fill(w,r);}),g}onLoad(t){let e=this.selection(t,["text","uniqueLocalId",...Qt]),o=this.#i();e.includes("text")&&this.loadTextInto("text",()=>({op:"getText",target:o,projection:this.revisionTextView()})),e.includes("uniqueLocalId")&&this.loadTextInto("uniqueLocalId",()=>({op:"getParagraphId",paragraph:o}));let r=Qt.filter(s=>e.includes(s));if(r.length===0)return;let i=`${this.path.label}.paragraphFormat`;this.read(i,()=>({op:"getParagraphFormat",paragraph:{paragraph:o}}),s=>{let d=It(s,i);for(let c of r)this.setLoadedProperty(c,d[c]);});}#r(t,e){if(this.requireAddressable(),this.#n){this.#n[t]=e;return}let o={[t]:e};this.#n=o;let r=this.#i(),i=`${this.path.label}.${t}`;this.commandAnswering(`${this.path.label}.paragraphFormat`,()=>(this.#n=void 0,{op:"setParagraphFormat",paragraph:{paragraph:r},format:o}),s=>{C(s,i);});}#s(t){let e=this.#i(),o=L.promised(this.context,t,false);return this.read(t,()=>({op:"getParagraphList",paragraph:e}),r=>{o.hydrateAddress({kind:"handle",handle:f(r,t)});}),o}#i(){return this.requireAddressable(),this.path.handle()}},Qt=["style","alignment","firstLineIndent","leftIndent","rightIndent","lineSpacing","spaceBefore","spaceAfter"],xe=["Left","Centered","Right","Justified"];function Ce(n,t){return xe.includes(n)||a({code:"InvalidArgument",target:t}),n}function J(n,t){return (typeof n!="number"||!Number.isFinite(n))&&a({code:"InvalidArgument",target:t}),n}function Ae(n,t){(!Array.isArray(n)||n.length===0||n.length>be)&&a({code:"InvalidArgument",target:t});for(let e of n)(typeof e!="string"||e.length===0)&&a({code:"InvalidArgument",target:t});return [...n]}function Xt(n,t){return n!==void 0&&typeof n!="boolean"&&a({code:"InvalidArgument",target:t}),n===true}var v=class n extends Q{#t;static of(t,e,o){return new n(t,l.derived(e,o),null)}static overListing(t,e,o,r){return new n(t,l.derived(e,o),r)}constructor(t,e,o){super(t,e),this.#t=o;}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.#t)return this.#t();let t=this.path.address();return t.kind==="handle"?{op:"getParagraphs",body:t.handle}:{op:"getSpanParagraphs",span:t.span}}size(t,e){return P(t,e).length}addressAt(t,e,o){let r=P(t,e)[o];return r?{kind:"handle",handle:r}:void 0}itemAt(t,e){return R.at(this.context,t,e)}promised(t,e){return R.promised(this.context,t,e)}},S=class n extends Q{#t;static of(t,e,o,r){return new n(t,l.derived(e,o),r)}static answered(t,e,o){return new n(t,l.derived(e,o),null)}constructor(t,e,o){super(t,e),this.#t=o;}getFirst(){return this.edge("first","getFirst",false)}getLast(){return this.edge("last","getLast",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}listing(){return this.#t?this.#t():null}size(t,e){return ft(t,e).length}addressAt(t,e,o){let r=ft(t,e)[o];return r?{kind:"span",span:r}:void 0}itemAt(t,e){return m.at(this.context,t,e)}promised(t,e){return m.promised(this.context,t,e)}};function ve(n,t){return t<1||t>12?0:t===2?n%4===0&&n%100!==0||n%400===0?29:28:t===4||t===6||t===9||t===11?30:31}function Kt(n){if(n.length===0)return null;let t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,9}))?(Z|[+-]\d{2}:\d{2})$/.exec(n.trim());if(!t)return null;let e=Number(t[1]),o=Number(t[2]),r=Number(t[3]),i=ve(e,o);if(e===0||i===0||r<1||r>i)return null;let s=Number(t[4]),d=Number(t[5]),c=Number(t[6]);if(s>23||d>59||c>59)return null;let g=t[7],w=g===void 0?0:Number(g.padEnd(3,"0").slice(0,3));if(Number.isNaN(w))return null;let U=`${t[1]}-${t[2]}-${t[3]}T${t[4]}:${t[5]}:${t[6]}.${String(w).padStart(3,"0")}Z`,ht=Date.parse(U);if(Number.isNaN(ht))return null;let h=t[8];if(h==="Z")return new Date(ht);let B=Number(h.slice(1,3)),G=Number(h.slice(4,6));if(G>59||B>14||B===14&&G!==0)return null;let Ot=h[0]==="+"?1:-1,ut=new Date(ht-Ot*(B*36e5+G*6e4));return Number.isNaN(ut.getTime())?null:ut}var At=class extends p{hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.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 text(){return this.loadedProperty("text")}delete(){let t=this.commentHandle();this.command("delete",()=>({op:"deleteComment",comment:t}));}loadCommentFields(t,e){let o=this.selection(t,["authorName","creationDate","id","text",...e]),r=this.commentHandle();if(o.includes("authorName")&&this.loadTextInto("authorName",()=>({op:"getCommentAuthor",comment:r})),o.includes("text")&&this.loadTextInto("text",()=>({op:"getCommentText",comment:r})),o.includes("id")&&this.loadTextInto("id",()=>({op:"getCommentId",comment:r})),o.includes("creationDate")){let s=`${this.path.label}.creationDate`;this.read(s,()=>({op:"getCommentDate",comment:r}),d=>{this.setLoadedProperty("creationDate",Kt(b(d,s)));});}if(!o.includes("resolved"))return;let i=`${this.path.label}.resolved`;this.read(i,()=>({op:"getCommentResolved",comment:r}),s=>{this.setLoadedProperty("resolved",M(s,i));});}commentHandle(){return this.requireAddressable(),this.path.handle()}},V=class n extends At{static at(t,e,o){return o.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new n(t,l.of(e,o.handle),false)}static promised(t,e,o){return new n(t,l.pending(e),o)}constructor(t,e,o){super(t,e,{nullable:o});}onLoad(t){this.loadCommentFields(t,[]);}},ct=class n extends y{#t;static of(t,e,o,r){return new n(t,l.derived(e,o),r)}constructor(t,e,o){super(t,e),this.#t=o;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#t()}itemAt(t,e){return V.at(this.context,t,e)}promised(t,e){return V.promised(this.context,t,e)}},N=class n extends At{#t;static at(t,e,o){return o.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new n(t,l.of(e,o.handle),false)}static promised(t,e,o){return new n(t,l.pending(e),o)}constructor(t,e,o){super(t,e,{nullable:o});}get resolved(){return this.loadedProperty("resolved")}set resolved(t){let e=`${this.path.label}.resolved`;typeof t!="boolean"&&a({code:"InvalidArgument",target:e});let o=this.commentHandle();this.commandAnswering(e,()=>({op:"setCommentResolved",comment:o,resolved:t}),r=>{C(r,e);});}get replies(){return this.#t??=ct.of(this.context,`${this.path.label}.replies`,this.path,()=>({op:"getCommentReplies",comment:this.commentHandle()})),this.#t}getRange(){let t=`${this.path.label}.getRange`,e=this.commentHandle(),o=m.promised(this.context,t,false);return this.read(t,()=>({op:"getCommentRange",comment:e}),r=>{o.hydrateAddress({kind:"span",span:x(r,t)});}),o}reply(t){let e=`${this.path.label}.reply`;(typeof t!="string"||t.length===0)&&a({code:"InvalidArgument",target:e});let o=this.internals.author;(typeof o!="string"||o.trim().length===0)&&a({code:"NotSupported",target:e});let r=this.commentHandle(),i=V.promised(this.context,e,false);return this.commandAnswering(e,()=>({op:"replyToComment",comment:r,text:t,author:o}),s=>{i.hydrateAddress({kind:"handle",handle:f(s,e)});}),i}onLoad(t){this.loadCommentFields(t,["resolved"]);}},q=class n extends y{#t;static of(t,e,o,r){return new n(t,l.derived(e,o),r)}constructor(t,e,o){super(t,e),this.#t=o;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#t()}itemAt(t,e){return N.at(this.context,t,e)}promised(t,e){return N.promised(this.context,t,e)}},_=class n extends p{static at(t,e,o){return o.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new n(t,l.of(e,o.handle),false)}static promised(t,e,o){return new n(t,l.pending(e),o)}constructor(t,e,o){super(t,e,{nullable:o});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.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(){let t=`${this.path.label}.range`,e=this.#t(),o=m.promised(this.context,t,false);return this.read(t,()=>({op:"getRevisionRange",revision:e}),r=>{o.hydrateAddress({kind:"span",span:x(r,t)});}),o}accept(){let t=this.#t();this.command("accept",()=>({op:"acceptRevision",revision:t}));}reject(){let t=this.#t();this.command("reject",()=>({op:"rejectRevision",revision:t}));}onLoad(t){let e=this.selection(t,["author","date","type"]),o=this.#t();if(e.includes("author")&&this.loadTextInto("author",()=>({op:"getRevisionAuthor",revision:o})),e.includes("type")&&this.loadTextInto("type",()=>({op:"getRevisionType",revision:o})),!e.includes("date"))return;let r=`${this.path.label}.date`;this.read(r,()=>({op:"getRevisionDate",revision:o}),i=>{this.setLoadedProperty("date",Kt(b(i,r)));});}#t(){return this.requireAddressable(),this.path.handle()}},D=class n extends y{#t;static of(t,e,o,r){return new n(t,l.derived(e,o),r)}constructor(t,e,o){super(t,e),this.#t=o;}acceptAll(){let t=this.#t;this.commandOn("acceptAll",()=>({op:"acceptAllRevisions",body:t}));}rejectAll(){let t=this.#t;this.commandOn("rejectAll",()=>({op:"rejectAllRevisions",body:t}));}listing(){return {op:"getRevisions",body:this.#t}}itemAt(t,e){return _.at(this.context,t,e)}promised(t,e){return _.promised(this.context,t,e)}commandOn(t,e){let o=`${this.path.label}.${t}`;this.enqueue({sort:"write",label:o,plan:e,settle:r=>{C(r,o);}});}};var Re=new Set(["matchCase","matchWholeWord","ignorePunct","ignoreSpace","matchWildcards"]);function vt(n,t){if(n===void 0)return;typeof n!="object"&&a({code:"InvalidArgument",target:t});for(let[o,r]of Object.entries(n))Re.has(o)||a({code:"InvalidArgument",target:`${t}.${o}`}),r!==void 0&&typeof r!="boolean"&&a({code:"InvalidArgument",target:`${t}.${o}`});let e={...n.matchCase===void 0?{}:{matchCase:n.matchCase},...n.matchWholeWord===void 0?{}:{matchWholeWord:n.matchWholeWord},...n.ignorePunct===void 0?{}:{ignorePunct:n.ignorePunct},...n.ignoreSpace===void 0?{}:{ignoreSpace:n.ignoreSpace},...n.matchWildcards===void 0?{}:{matchWildcards:n.matchWildcards}};return Object.keys(e).length===0?void 0:e}var m=class n extends p{#t;#e;#o;static at(t,e,o){return o.kind!=="span"&&a({code:"InvalidObjectPath",target:e}),new n(t,l.ofSpan(e,o.span),false)}static promised(t,e,o){return new n(t,l.pending(e),o)}constructor(t,e,o){super(t,e,{nullable:o});}hydrateAddress(t){t.kind==="span"?this.path.resolveToSpan(t.span):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get text(){return this.loadedProperty("text")}get font(){return this.#e??=I.of(this.context,`${this.path.label}.font`,this.path,"span"),this.#e}get paragraphs(){return this.#t??=v.of(this.context,`${this.path.label}.paragraphs`,this.path),this.#t}get style(){return this.loadedProperty("style")}set style(t){let e=`${this.path.label}.style`,o=Y(t,e);this.requireAddressable(),this.command("style",()=>({op:"setStyle",span:E(this.path,"span"),name:o}));}get hyperlink(){return this.loadedProperty("hyperlink")}set hyperlink(t){let e=`${this.path.label}.hyperlink`;(typeof t!="string"||t.length>2048)&&a({code:"InvalidArgument",target:e});let o=this.#n();this.command("hyperlink",()=>({op:"setHyperlink",span:o,target:t}));}get bookmarks(){let t=this.#n();return this.#o??=$.of(this.context,`${this.path.label}.bookmarks`,this.path,()=>({op:"getBookmarks",scope:{start:t.start,end:t.end}})),this.#o}search(t,e){let o=`${this.path.label}.search`;typeof t!="string"&&a({code:"InvalidArgument",target:o});let r=vt(e,o),i=this.#n();return S.of(this.context,o,this.path,()=>({op:"search",scope:i,text:t,options:{...r??{},projection:this.revisionTextView()}}))}insertText(t,e){let o=`${this.path.label}.insertText`,r=A(t,o),i=wt(e,o),s=this.#n(),d=n.promised(this.context,o,false);return this.commandAnswering(o,()=>i==="Replace"?{op:"replaceSpan",span:s,text:r}:{op:"insertText",at:i==="Start"||i==="Before"?s.start:s.end,text:r},c=>{d.hydrateAddress({kind:"span",span:x(c,o)});}),d}delete(){let t=this.#n();this.commandDiscarding("delete",()=>({op:"replaceSpan",span:t,text:""}));}clear(){let t=this.#n();this.commandDiscarding("clear",()=>({op:"replaceSpan",span:t,text:""}));}insertComment(t){let e=`${this.path.label}.insertComment`;(typeof t!="string"||t.length===0)&&a({code:"InvalidArgument",target:e});let o=this.internals.author;(typeof o!="string"||o.trim().length===0)&&a({code:"NotSupported",target:e});let r=this.#n(),i=N.promised(this.context,e,false);return this.commandAnswering(e,()=>({op:"insertComment",span:r,text:t,author:o}),s=>{s.kind!=="handle"&&a({code:"GeneralException",target:e}),i.hydrateAddress(s);}),i}insertParagraph(t,e){let o=`${this.path.label}.insertParagraph`,r=A(t,o),i=wt(e,o);i!=="Before"&&i!=="After"&&a({code:"InvalidArgument",target:o});let s=this.#n(),d=i==="Before"?s.start.paragraph:s.end.paragraph,c=R.promised(this.context,o,false);return this.commandAnswering(o,()=>({op:"insertParagraph",anchor:{paragraph:d},where:i==="Before"?"before":"after",text:r}),g=>{g.kind!=="handle"&&a({code:"GeneralException",target:o}),c.hydrateAddress({kind:"handle",handle:g.handle});}),c}select(t){let e=`${this.path.label}.select`,o=Ct(t,e);this.requireAddressable(),this.internals.capabilities.selection||a({code:"NotSupported",target:e});let r=this.#n();this.command("select",()=>({op:"selectSpan",span:r,mode:o==="Select"?"select":o==="Start"?"start":"end"}));}onLoad(t){let e=this.selection(t,["text","style","hyperlink"]);if(e.includes("hyperlink")){let r=this.#n();this.loadTextInto("hyperlink",()=>({op:"getHyperlink",span:r}));}if(e.includes("text")){let r=this.#n(),i=`${this.path.label}.text`;this.read(i,()=>({op:"getSpanText",span:r,projection:this.revisionTextView()}),s=>{this.setLoadedProperty("text",b(s,i));});}if(!e.includes("style"))return;let o=`${this.path.label}.style`;this.requireAddressable(),this.read(o,()=>({op:"getStyle",span:E(this.path,"span")}),r=>{this.setLoadedProperty("style",at(r,o));});}#n(){return this.requireAddressable(),this.path.span()}};var tt=class n extends p{#t;static at(t,e,o){return o.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new n(t,l.of(e,o.handle),false)}static promised(t,e,o){return new n(t,l.pending(e),o)}constructor(t,e,o){super(t,e,{nullable:o});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get name(){return this.loadedProperty("name")}get range(){return this.#t??=this.#e(`${this.path.label}.range`),this.#t}select(t){let e=`${this.path.label}.select`,o=Ct(t,e);this.requireAddressable(),this.internals.capabilities.selection||a({code:"NotSupported",target:e});let r=this.#o();this.command("select",()=>({op:"selectBookmark",bookmark:r,mode:o==="Select"?"select":o==="Start"?"start":"end"}));}onLoad(t){if(!this.selection(t,["name"]).includes("name"))return;let e=`${this.path.label}.name`,o=this.#o();this.read(e,()=>({op:"getBookmarkName",bookmark:o}),r=>{this.setLoadedProperty("name",b(r,e));});}#e(t){let e=this.#o(),o=m.promised(this.context,t,false);return this.read(t,()=>({op:"getBookmarkRange",bookmark:e}),r=>{o.hydrateAddress({kind:"span",span:x(r,t)});}),o}#o(){return this.requireAddressable(),this.path.handle()}},$=class n extends y{#t;static of(t,e,o,r){return new n(t,l.derived(e,o),r)}constructor(t,e,o){super(t,e),this.#t=o;}listing(){return this.#t()}itemAt(t,e){return tt.at(this.context,t,e)}promised(t,e){return tt.promised(this.context,t,e)}};var Yt=4096,W=class n extends p{#t=new Map;#e;#o;static at(t,e,o){return o.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new n(t,l.of(e,o.handle),false)}static promised(t,e,o){return new n(t,l.pending(e),o)}constructor(t,e,o){super(t,e,{nullable:o});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get id(){return this.loadedProperty("id")}get tag(){return this.loadedProperty("tag")}set tag(t){this.#r("tag",{tag:Lt(t,`${this.path.label}.tag`)});}get title(){return this.loadedProperty("title")}set title(t){this.#r("title",{title:Lt(t,`${this.path.label}.title`)});}get subtype(){return this.loadedProperty("subtype")}get isBound(){return this.loadedProperty("isBound")}get cannotDelete(){let t=this.loadedProperty("lock");return t==="sdtLocked"||t==="sdtContentLocked"}set cannotDelete(t){this.#s(t,this.cannotEdit,`${this.path.label}.cannotDelete`);}get cannotEdit(){let t=this.loadedProperty("lock");return t==="contentLocked"||t==="sdtContentLocked"}set cannotEdit(t){this.#s(this.cannotDelete,t,`${this.path.label}.cannotEdit`);}get placeholderShown(){return this.loadedProperty("placeholderShown")}get temporary(){return this.loadedProperty("temporary")}get text(){return this.loadedProperty("text")}get paragraphs(){return this.#e??=v.overListing(this.context,`${this.path.label}.paragraphs`,this.path,()=>({op:"getContentControlParagraphs",contentControl:this.#i()})),this.#e}get contentControls(){return this.#o??=j.of(this.context,`${this.path.label}.contentControls`,this.path,{contentControl:this.#i()}),this.#o}getRange(t){let e=`${this.path.label}.getRange`,o=Oe(t??"Whole",e),r=this.#t.get(o);if(r)return r;let i=this.#n(e,o);return this.#t.set(o,i),i}setValue(t){let e=`${this.path.label}.setValue`,o=Pe(t,e),r=this.#i();this.command("setValue",()=>({op:"setContentControlValue",contentControl:r,value:o}));}insertText(t,e){let o=`${this.path.label}.insertText`,r=A(t,o),i=e==="Replace"?"replace":e==="Start"?"start":e==="End"?"end":a({code:"InvalidArgument",target:o}),s=this.#i(),d=m.promised(this.context,o,false);return this.commandAnswering(o,()=>({op:"insertContentControlText",contentControl:s,text:r,at:i}),c=>{d.hydrateAddress({kind:"span",span:x(c,o)});}),d}delete(t){let e=`${this.path.label}.delete`;typeof t!="boolean"&&a({code:"InvalidArgument",target:e});let o=this.#i();this.command("delete",()=>({op:"deleteContentControl",contentControl:o,keepContent:t}));}onLoad(t){let e=this.selection(t,["id","tag","title","subtype","isBound","text","cannotDelete","cannotEdit","placeholderShown","temporary"]),o=this.#i();if(e.includes("id")&&this.loadTextInto("id",()=>({op:"getContentControlFileId",contentControl:o})),e.includes("tag")&&this.loadTextInto("tag",()=>({op:"getContentControlTag",contentControl:o})),e.includes("title")&&this.loadTextInto("title",()=>({op:"getContentControlTitle",contentControl:o})),e.includes("subtype")&&this.loadTextInto("subtype",()=>({op:"getContentControlSubtype",contentControl:o})),e.includes("isBound")){let i=`${this.path.label}.isBound`;this.read(i,()=>({op:"getContentControlIsBound",contentControl:o}),s=>{this.setLoadedProperty("isBound",M(s,i));});}if(e.includes("text")&&this.loadTextInto("text",()=>({op:"getContentControlText",contentControl:o,projection:this.revisionTextView()})),e.includes("cannotDelete")||e.includes("cannotEdit")){let i=`${this.path.label}.lock`;this.read(i,()=>({op:"getContentControlLock",contentControl:o}),s=>{this.setLoadedProperty("lock",b(s,i));});}if(e.includes("placeholderShown")){let i=`${this.path.label}.placeholderShown`;this.read(i,()=>({op:"getContentControlPlaceholderShown",contentControl:o}),s=>{this.setLoadedProperty("placeholderShown",M(s,i));});}if(!e.includes("temporary"))return;let r=`${this.path.label}.temporary`;this.read(r,()=>({op:"getContentControlTemporary",contentControl:o}),i=>{this.setLoadedProperty("temporary",M(i,r));});}#n(t,e){let o=this.#i(),r=m.promised(this.context,t,false);return this.read(t,()=>({op:"getContentControlRange",contentControl:o,location:e}),i=>{r.hydrateAddress({kind:"span",span:x(i,t)});}),r}#r(t,e){let o=this.#i();this.command(t,()=>({op:"setContentControlProperties",contentControl:o,...e}));}#s(t,e,o){(typeof t!="boolean"||typeof e!="boolean")&&a({code:"InvalidArgument",target:o});let r=t&&e?"sdtContentLocked":t?"sdtLocked":e?"contentLocked":"unlocked",i=this.#i();this.command(o,()=>({op:"setContentControlProperties",contentControl:i,lock:r}));}#i(){return this.requireAddressable(),this.path.handle()}},j=class n extends y{#t;#e;static of(t,e,o,r){return new n(t,l.derived(e,o),r,()=>({op:"getContentControls",scope:r}))}constructor(t,e,o,r){super(t,e),this.#t=o,this.#e=r;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}getById(t){let e=`${this.path.label}.getById`;Number.isInteger(t)||a({code:"InvalidArgument",target:e});let o=this.#t,r=W.promised(this.context,e,false);return this.enqueue({sort:"read",label:e,plan:()=>({op:"getContentControlById",scope:o,id:t}),settle:i=>{r.hydrateAddress({kind:"handle",handle:f(i,e)});}}),r}getByTag(t){let e=`${this.path.label}.getByTag`,o=Zt(t,e),r=this.#t;return new n(this.context,l.derived(e,this.path),r,()=>({op:"getContentControlsByTag",scope:r,tag:o}))}getByTitle(t){let e=`${this.path.label}.getByTitle`,o=Zt(t,e),r=this.#t;return new n(this.context,l.derived(e,this.path),r,()=>({op:"getContentControlsByTitle",scope:r,title:o}))}listing(){return this.#e()}itemAt(t,e){return W.at(this.context,t,e)}promised(t,e){return W.promised(this.context,t,e)}};function Lt(n,t){return (typeof n!="string"||n.length>Yt)&&a({code:"InvalidArgument",target:t}),n}function Zt(n,t){let e=Lt(n,t);return e.length===0&&a({code:"InvalidArgument",target:t}),e}function Oe(n,t){switch(n){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:t})}}function Pe(n,t){(typeof n!="object"||n===null)&&a({code:"InvalidArgument",target:t});let e=n;if(e.kind==="text"||e.kind==="listItem"){let o=e.kind==="text"?e.text:e.value;return (typeof o!="string"||o.length>Yt)&&a({code:"InvalidArgument",target:t}),e.kind==="text"?{kind:"text",text:o}:{kind:"listItem",value:o}}if(e.kind==="checkbox")return typeof e.checked!="boolean"&&a({code:"InvalidArgument",target:t}),{kind:"checkbox",checked:e.checked};if(e.kind==="date")return (typeof e.iso!="string"||e.iso.length>64)&&a({code:"InvalidArgument",target:t}),{kind:"date",iso:e.iso};a({code:"InvalidArgument",target:t});}var k=class n extends p{#t;#e;#o;#n;#r;#s;static main(t,e){return new n(t,l.of(e,H(t).roots().body))}static promisedStory(t,e){return new n(t,l.pending(e))}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}constructor(t,e){super(t,e);}get text(){return this.loadedProperty("text")}get paragraphs(){return this.#t??=this.paragraphsUnder(`${this.path.label}.paragraphs`),this.#t}get bookmarks(){let t=this.#a();return this.#e??=$.of(this.context,`${this.path.label}.bookmarks`,this.path,()=>({op:"getBookmarks",scope:{body:t}})),this.#e}get font(){return this.#o??=I.of(this.context,`${this.path.label}.font`,this.path,"body"),this.#o}paragraphsUnder(t){return v.of(this.context,t,this.path)}get style(){return this.loadedProperty("style")}set style(t){let e=`${this.path.label}.style`,o=Y(t,e);this.requireAddressable(),this.command("style",()=>({op:"setStyle",span:E(this.path,"body"),name:o}));}get lists(){return this.#n??=K.of(this.context,`${this.path.label}.lists`,this.path,this.#a()),this.#n}get contentControls(){return this.#r??=j.of(this.context,`${this.path.label}.contentControls`,this.path,{body:this.#a()}),this.#r}getComments(){let t=`${this.path.label}.getComments`,e=this.#a();return q.of(this.context,t,this.path,()=>({op:"getComments",scope:{body:e}}))}get revisions(){return this.#s??=D.of(this.context,`${this.path.label}.revisions`,this.path,this.#a()),this.#s}search(t,e){let o=`${this.path.label}.search`;typeof t!="string"&&a({code:"InvalidArgument",target:o});let r=vt(e,o),i=this.#a();return S.of(this.context,o,this.path,()=>({op:"search",scope:{body:i},text:t,options:{...r??{},projection:this.revisionTextView()}}))}clear(){let t=this.#a();this.commandDiscarding("clear",()=>({op:"replaceSpan",span:{body:t},text:""}));}insertText(t,e){let o=`${this.path.label}.insertText`,r=A(t,o),i=Ht(e,o),s=this.#a(),d=m.promised(this.context,o,false);return this.commandAnswering(o,()=>i==="Replace"?{op:"replaceSpan",span:{body:s},text:r}:{op:"insertText",at:{body:s,at:i==="Start"?"start":"end"},text:r},c=>{d.hydrateAddress({kind:"span",span:x(c,o)});}),d}insertParagraph(t,e){let o=`${this.path.label}.insertParagraph`,r=A(t,o),i=Mt(e,o),s=this.#a(),d=R.promised(this.context,o,false);return this.commandAnswering(o,()=>({op:"insertParagraph",anchor:{body:s,at:i==="Start"?"first":"last"},where:i==="Start"?"before":"after",text:r}),c=>{c.kind!=="handle"&&a({code:"GeneralException",target:o}),d.hydrateAddress({kind:"handle",handle:c.handle});}),d}onLoad(t){let e=this.selection(t,["text","style"]);if(e.includes("text")){let o=this.#a();this.loadTextInto("text",()=>({op:"getText",target:o,projection:this.revisionTextView()}));}e.includes("style")&&this.#i();}#i(){let t=`${this.path.label}.style`;this.requireAddressable(),this.read(t,()=>({op:"getStyle",span:E(this.path,"body")}),e=>{this.setLoadedProperty("style",at(e,t));});}#a(){return this.requireAddressable(),this.path.handle()}};function ke(n){return n==="endnote"?"Endnote":"Footnote"}var et=class n extends p{#t;static at(t,e,o){return o.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new n(t,l.of(e,o.handle),false)}static promised(t,e,o){return new n(t,l.pending(e),o)}constructor(t,e,o){super(t,e,{nullable:o});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get type(){return this.loadedProperty("type")}get text(){return this.loadedProperty("text")}get body(){if(this.#t)return this.#t;let t=`${this.path.label}.body`,e=this.#e(),o=k.promisedStory(this.context,t);return this.read(t,()=>({op:"getNoteBody",note:e}),r=>{o.hydrateAddress({kind:"handle",handle:f(r,t)});}),this.#t=o,o}delete(){let t=this.#e();this.command("delete",()=>({op:"deleteNote",note:t}));}getNext(){let t=`${this.path.label}.getNext`,e=this.#e(),o=n.promised(this.context,t,false),r=this.internals.roots().document,i=`${t}.type`,s="footnote";return this.read(i,()=>({op:"getNoteKind",note:e}),d=>{s=b(d,i)==="endnote"?"endnote":"footnote";}),this.read(t,()=>({op:"getNotes",document:r,noteKind:s}),d=>{let c=P(d,t),g=c.findIndex(U=>U.ref===e.ref),w=g<0?void 0:c[g+1];w||a({code:"ItemNotFound",target:t}),o.hydrateAddress({kind:"handle",handle:w});}),o}onLoad(t){let e=this.selection(t,["text","type"]);if(e.includes("text")){let o=this.#e();this.loadTextInto("text",()=>({op:"getNoteText",note:o,projection:this.revisionTextView()}));}if(e.includes("type")){let o=`${this.path.label}.type`,r=this.#e();this.read(o,()=>({op:"getNoteKind",note:r}),i=>{this.setLoadedProperty("type",ke(b(i,o)));});}}#e(){return this.requireAddressable(),this.path.handle()}},z=class n extends y{#t;static of(t,e,o,r){return new n(t,l.derived(e,o),r)}constructor(t,e,o){super(t,e),this.#t=o;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#t()}itemAt(t,e){return et.at(this.context,t,e)}promised(t,e){return et.promised(this.context,t,e)}};var Ie=Object.freeze({Primary:"default",FirstPage:"first",EvenPages:"even"}),Se=["pageWidth","pageHeight","orientation","topMargin","rightMargin","bottomMargin","leftMargin"],pt=class n extends p{#t;static of(t,e,o){return new n(t,l.derived(e,o))}constructor(t,e){super(t,e);}get pageWidth(){return this.loadedProperty("pageWidth")}set pageWidth(t){this.#e("pageWidth",ot(t,`${this.path.label}.pageWidth`));}get pageHeight(){return this.loadedProperty("pageHeight")}set pageHeight(t){this.#e("pageHeight",ot(t,`${this.path.label}.pageHeight`));}get orientation(){return this.loadedProperty("orientation")}set orientation(t){let e=`${this.path.label}.orientation`;t!=="Portrait"&&t!=="Landscape"&&a({code:"InvalidArgument",target:e}),this.#e("orientation",t==="Portrait"?"portrait":"landscape");}get topMargin(){return this.loadedProperty("topMargin")}set topMargin(t){this.#e("topMargin",ot(t,`${this.path.label}.topMargin`));}get bottomMargin(){return this.loadedProperty("bottomMargin")}set bottomMargin(t){this.#e("bottomMargin",ot(t,`${this.path.label}.bottomMargin`));}get leftMargin(){return this.loadedProperty("leftMargin")}set leftMargin(t){this.#e("leftMargin",ot(t,`${this.path.label}.leftMargin`));}get rightMargin(){return this.loadedProperty("rightMargin")}set rightMargin(t){this.#e("rightMargin",ot(t,`${this.path.label}.rightMargin`));}onLoad(t){let e=this.selection(t,Se);if(e.length===0)return;let o=`${this.path.label}.pageSetup`,r=this.#o();this.read(o,()=>({op:"getPageSetup",section:r}),i=>{let s=St(i,o);for(let d of e)this.setLoadedProperty(d,d==="orientation"?s.orientation==="landscape"?"Landscape":"Portrait":s[d]);});}#e(t,e){if(this.requireAddressable(),this.#t){this.#t[t]=e;return}let o={[t]:e};this.#t=o;let r=this.#o(),i=`${this.path.label}.${t}`;this.commandAnswering(`${this.path.label}.pageSetup`,()=>(this.#t=void 0,{op:"setPageSetup",section:r,setup:o}),s=>{C(s,i);});}#o(){this.requireAddressable();let t=this.path.address();return t.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.path.label}),t.handle}},nt=class n extends p{#t;#e;static at(t,e,o){return o.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new n(t,l.of(e,o.handle),false)}static promised(t,e,o){return new n(t,l.pending(e),o)}constructor(t,e,o){super(t,e,{nullable:o});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get body(){return this.#e??=k.main(this.context,`${this.path.label}.body`),this.#e}get pageSetup(){return this.#t??=pt.of(this.context,`${this.path.label}.pageSetup`,this.path),this.#t}getHeader(t){return this.#o("header",t,"getHeader")}getFooter(t){return this.#o("footer",t,"getFooter")}getNext(){let t=`${this.path.label}.getNext`,e=this.#n(),o=n.promised(this.context,t,false),r=this.internals.roots().document;return this.read(t,()=>({op:"getSections",document:r}),i=>{let s=P(i,t),d=s.findIndex(g=>g.ref===e.ref),c=d<0?void 0:s[d+1];c||a({code:"ItemNotFound",target:t}),o.hydrateAddress({kind:"handle",handle:c});}),o}onLoad(t){this.selection(t,[]);}#o(t,e,o){let r=`${this.path.label}.${o}`,i=Ie[e];i===void 0&&a({code:"InvalidArgument",target:r});let s=this.#n(),d=k.promisedStory(this.context,r);return this.read(r,()=>({op:"getFurniture",section:s,kind:t,variant:i}),c=>{d.hydrateAddress({kind:"handle",handle:f(c,r)});}),d}#n(){return this.requireAddressable(),this.path.handle()}},rt=class n extends y{#t;static of(t,e,o,r){return new n(t,l.derived(e,o),r)}constructor(t,e,o){super(t,e),this.#t=o;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#t()}itemAt(t,e){return nt.at(this.context,t,e)}promised(t,e){return nt.promised(this.context,t,e)}};function ot(n,t){return (typeof n!="number"||!Number.isFinite(n)||n<0)&&a({code:"InvalidArgument",target:t}),n}var it=class n extends p{#t;#e;#o;#n;#r;#s;#i;#a;static open(t){return new n(t)}constructor(t){super(t,l.of("document",H(t).roots().document));}get changeTrackingMode(){return this.loadedProperty("changeTrackingMode")}set changeTrackingMode(t){["Off","TrackAll","TrackMineOnly"].includes(t)||a({code:"InvalidArgument",target:"document.changeTrackingMode"});let e=this.internals.author;this.commandAnswering("document.changeTrackingMode",()=>({op:"setChangeTrackingMode",mode:t,...e===void 0?{}:{author:e}}),()=>this.setLoadedProperty("changeTrackingMode",t));}get body(){return this.#t??=k.main(this.context,"document.body"),this.#t}get paragraphs(){return this.#e??=this.body.paragraphsUnder("document.paragraphs"),this.#e}get sections(){let t=this.path.handle();return this.#o??=rt.of(this.context,"document.sections",this.path,()=>({op:"getSections",document:t})),this.#o}get contentControls(){return this.#s??=j.of(this.context,"document.contentControls",this.path,{body:this.internals.roots().body}),this.#s}get comments(){return this.#n??=q.of(this.context,"document.comments",this.path,()=>({op:"getComments",scope:{body:this.internals.roots().body}})),this.#n}get revisions(){return this.#r??=D.of(this.context,"document.revisions",this.path,this.internals.roots().body),this.#r}get footnotes(){let t=this.path.handle();return this.#i??=z.of(this.context,"document.footnotes",this.path,()=>({op:"getNotes",document:t,noteKind:"footnote"})),this.#i}get endnotes(){let t=this.path.handle();return this.#a??=z.of(this.context,"document.endnotes",this.path,()=>({op:"getNotes",document:t,noteKind:"endnote"})),this.#a}onLoad(t){if(t.select.length===0)return;this.selection(t,["changeTrackingMode"]).includes("changeTrackingMode")&&this.loadTextInto("changeTrackingMode",()=>({op:"getChangeTrackingMode"}));}};function Rt(n){let t=n.host,e=Object.freeze({...t.capabilities,save:n.save&&t.capabilities.save}),o=typeof n.author=="string"&&n.author.trim().length>0?n.author:void 0,r=n.revisionTextView??"allMarkup";r!=="allMarkup"&&r!=="original"&&a({code:"InvalidArgument",target:"revisionTextView"});let i=false,s=null,d=h=>{i&&a({code:"RuntimeDisposed",...h===void 0?{}:{target:h}});},c=()=>{if(s)return s;d("document");let h=Jt(t.execute({operations:[{op:"getDocument"}]}),"document"),B=Jt(t.execute({operations:[{op:"getBody",document:h}]}),"document.body");return s={document:h,body:B},s},g={host:t,capabilities:e,...o===void 0?{}:{author:o},revisionTextView:r,id:{},roots:c,assertLive:d,openDocument:h=>it.open(h)};try{c();}catch{s=null;}async function w(h,B){d();let G=typeof h=="function"?h:B,Ot=typeof h=="function"?[]:Array.isArray(h)?h:[h];typeof G!="function"&&a({code:"InvalidArgument",target:"run"});let{context:ut,adopt:ee,finish:oe}=dt.begin(g);try{return ee(Ot),await G(ut)}finally{oe();}}let U={capabilities:e,run:w,dispose(){i||(i=true,s=null,t.dispose());}};return n.save?{...U,async save(){d("save"),e.save||a({code:"NotSupported",target:"save"});let h=t.save();if(!h.ok)throw bt(h.error,{target:"save"});return h.bytes}}:U}function Jt(n,t){let e=n.results[0];if(e?.status==="error")throw bt(e.error,{target:t});if(e?.status!=="ok")throw new u({code:"GeneralException",target:t});return f(e.value,t)}function _t(n,t={}){return Rt({host:createBrowserAutomationHost(n),save:false,...t.author===void 0?{}:{author:t.author},...t.revisionTextView===void 0?{}:{revisionTextView:t.revisionTextView}})}function je(n){if(n){for(let t of n)if(t.collaboration)return t.collaboration}}function Te(n){let t=[n?.zip?.maxEntries,n?.zip?.maxTotalBytes,n?.xml?.maxBytes,n?.xml?.maxElements,n?.maxXmlParts,n?.maxRelationships],e=n?.zip?.maxRatio;(t.some(o=>o!==void 0&&(!Number.isInteger(o)||o<0))||e!==void 0&&(!Number.isFinite(e)||e<0))&&a({code:"InvalidArgument",target:"createServer"});}async function jt(n,t={}){Te(t.limits);let e=je(t.modules),o=createServerAutomationHost(n,{...t.limits===void 0?{}:{limits:t.limits},...e===void 0?{}:{collaborationModel:e}});if(!o.ok){let r={"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"},i=o.limit??r[o.reason];a({code:i===void 0?"InvalidArgument":"ResourceLimitExceeded",target:"createServer",...i===void 0?{}:{limit:i}});}return Rt({host:o.host,save:true,...t.author===void 0?{}:{author:t.author},...t.revisionTextView===void 0?{}:{revisionTextView:t.revisionTextView}})}function te(n,t,e={}){return jt(n,{...e,modules:[...e.modules??[],{id:"collaboration",collaboration:{session:t}}]})}var Fr=Object.freeze({createBrowser:_t,createServer:jt,createCollaborative:te});export{k as Body,tt as Bookmark,$ as BookmarkCollection,T as ClientObject,Pt as ClientResult,N as Comment,q as CommentCollection,V as CommentReply,ct as CommentReplyCollection,W as ContentControl,j as ContentControlCollection,it as Document,Fr as DocxEditor,u as DocxEditorError,I as Font,L as List,K as ListCollection,Z as ListItem,et as NoteItem,z as NoteItemCollection,pt as PageSetup,R as Paragraph,v as ParagraphCollection,m as Range,S as RangeCollection,dt as RequestContext,_ as Revision,D as RevisionCollection,nt as Section,rt as SectionCollection,st as TrackedObjects,ne as isDocxEditorError};
1
+ import {createBrowserAutomationHost}from'@docx-editor.dev/core/editor';import {createServerAutomationHost,createAutomationPaginationProvider}from'@docx-editor.dev/core/automation';var le=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 this document or host\u2019s supported capabilities.",NotImplemented:"this version does not implement that yet.",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 changed after this context read it, so nothing was applied.",DocumentUnavailable:"the document is not available right now.",GeneralException:"the document could not complete the request."}),C=class extends Error{code;limit;target;expectedRevision;actualRevision;constructor(t){let e=t.target?`${le[t.code]} (${t.target})`:le[t.code];super(e),this.name="DocxEditorError",this.code=t.code,t.limit!==void 0&&(this.limit=t.limit),t.target!==void 0&&(this.target=t.target),t.expectedRevision!==void 0&&(this.expectedRevision=t.expectedRevision),t.actualRevision!==void 0&&(this.actualRevision=t.actualRevision);}};function Se(o){return o instanceof C?true:typeof o=="object"&&o!==null&&o.name==="DocxEditorError"&&typeof o.code=="string"}function a(o){throw new C(o)}var Y=Symbol("docx-editor.runtime.internals"),St=Symbol("docx-editor.runtime.release"),jt=Symbol("docx-editor.runtime.rebind");function J(o){return o[Y]}var je=new Set(["select","expand","top","skip"]),Te=/^[A-Za-z][A-Za-z0-9]*$/;function ce(o,t){if(o===void 0)return [];let e=typeof o=="string"?o.split(",").map(r=>r.trim()):Array.isArray(o)?o.map(r=>typeof r=="string"?r.trim():r):a({code:"InvalidArgument",target:t}),n=[];for(let r of e)(typeof r!="string"||!Te.test(r))&&a({code:"InvalidArgument",target:t}),n.includes(r)||n.push(r);return n.length===0&&a({code:"InvalidArgument",target:t}),n}function he(o,t){return (typeof o!="number"||!Number.isInteger(o)||o<0)&&a({code:"InvalidArgument",target:t}),o}function Ee(o,t){o===void 0||Array.isArray(o)&&o.length===0||a({code:"InvalidArgument",target:t});}function pe(o,t){if(o===void 0)return {select:[]};if(typeof o=="string"||Array.isArray(o))return {select:ce(o,t)};(typeof o!="object"||o===null)&&a({code:"InvalidArgument",target:t});let e=o;for(let n of Object.keys(e))je.has(n)||a({code:"InvalidArgument",target:`${t}.${n}`});return Ee(e.expand,`${t}.expand`),{select:ce(e.select,`${t}.select`),...e.top===void 0?{}:{top:he(e.top,`${t}.top`)},...e.skip===void 0?{}:{skip:he(e.skip,`${t}.skip`)}}}var B=class{#t;#n;#e;#o;#i=new Map;#s=false;constructor(t,e,n={}){this.#t=t,this.#n=t[Y],this.#e=e,this.#o=n.nullable===true,this.#n.register(this);}get context(){return this.#t}get isNullObject(){return this.#e.isReleased&&a({code:"InvalidObjectPath",target:this.#e.label}),this.#o?(this.#e.isPending&&a({code:"PropertyNotLoaded",target:`${this.#e.label}.isNullObject`}),this.#e.isNull):false}load(t){this.#s=true;try{return this.requireUsablePath(),this.onLoad(pe(t,this.#e.label)),this}finally{this.#s=false;}}get path(){return this.#e}get internals(){return this.#n}handle(){return this.#e.handle()}requireAddressable(){this.#e.isAddressable||a({code:"InvalidObjectPath",target:this.#e.label}),this.#n.assertUsable(this.#e.label);}requireUsablePath(){(this.#e.isReleased||this.#e.isNull&&!(this.#s&&this.#o))&&a({code:"InvalidObjectPath",target:this.#e.label}),this.#n.assertUsable(this.#e.label);}enqueue(t){this.requireUsablePath(),this.#n.queue.push({...t,dependencies:[...t.dependencies??[],this.#e],...this.#s&&this.#o&&t.sort==="read"?{nullableLoad:this.#e}:{}});}loadedProperty(t){return this.#e.isReleased&&!this.#i.has(t)&&a({code:"InvalidObjectPath",target:this.#e.label}),this.#i.has(t)||a({code:"PropertyNotLoaded",target:`${this.#e.label}.${t}`}),this.#i.get(t)}hasLoadedProperty(t){return this.#i.has(t)}setLoadedProperty(t,e){this.#i.set(t,e);}[St](){this.#e.release();}[jt](t){this.#t=t,this.#n=t[Y];}};var Vt=class o{#t=false;#n;#e;constructor(t){this.#e=t;}get value(){return this.#t||a({code:"ValueNotLoaded",target:this.#e}),this.#n}get isLoaded(){return this.#t}static create(t){let e=new o(t);return {result:e,fill(n){e.#t=true,e.#n=n;}}}};function S(o){return new C({code:"GeneralException",target:o})}function O(o,t){if(o.kind!=="text")throw S(t);return o.text}function u(o,t){if(o.kind!=="handle")throw S(t);return o.handle}function v(o,t){if(o.kind!=="handles")throw S(t);return o.handles}function P(o,t){if(o.kind!=="span")throw S(t);return o.span}function Tt(o,t){if(o.kind!=="spans")throw S(t);return o.spans}function Wt(o,t){if(o.kind!=="font")throw S(t);return o.font}function Ut(o,t){if(o.kind!=="paragraphFormat")throw S(t);return o.format}function xt(o,t){if(o.kind!=="style")throw S(t);return o.name}function Et(o,t){if(o.kind!=="number")throw S(t);return o.value}function _(o,t){if(o.kind!=="flag")throw S(t);return o.value}function Gt(o,t){if(o.kind!=="pageSetup")throw S(t);return o.setup}function m(o,t){if(o.kind!=="applied")throw S(t)}var c=class o{label;#t;#n;constructor(t,e,n=null){this.label=t,this.#t=e,this.#n=n;}static of(t,e){return new o(t,{status:"resolved",address:{kind:"handle",handle:e}})}static ofSpan(t,e){return new o(t,{status:"resolved",address:{kind:"span",span:e}})}static pending(t){return new o(t,{status:"pending"})}static derived(t,e){return new o(t,{status:"pending"},e)}get state(){return this.#n?this.#n.state:this.#t}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 t=this.state;if(t.status==="resolved")return t.address;a({code:"InvalidObjectPath",target:this.label});}handle(){let t=this.address();return t.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.label}),t.handle}span(){let t=this.address();return t.kind!=="span"&&a({code:"InvalidObjectPath",target:this.label}),t.span}resolveTo(t){this.#e({kind:"handle",handle:t});}resolveToSpan(t){this.#e({kind:"span",span:t});}resolveNull(){this.#t.status!=="released"&&(this.#t={status:"null"});}release(){this.#n||(this.#t={status:"released"});}#e(t){this.#t.status!=="released"&&(this.#t={status:"resolved",address:t});}};function ue(o){let t=[],e=false,n=false;for(let r of o)t.push(r.plan()),r.sort==="write"?n=true:e=true;return {operations:t,hasRead:e,hasWrite:n}}var Ne=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 Nt(o,t={}){let e=Ne[o.code]??"GeneralException",n=e==="StaleDocument";return new C({code:e,...t.target===void 0?{}:{target:t.target},...n&&t.expectedRevision!==void 0?{expectedRevision:t.expectedRevision}:{},...n&&t.actualRevision!==void 0?{actualRevision:t.actualRevision}:{}})}function zt(o,t,e){for(let n=0;n<o.results.length;n+=1){let r=o.results[n];if(r?.status!=="error")continue;let i=t[n]?.label;return Nt(r.error,{...i===void 0?{}:{target:i},...e===void 0?{}:{expectedRevision:e},actualRevision:o.revision})}return new C({code:"GeneralException"})}function Qt(o,t){if(t.results.length!==o.length)throw new C({code:"GeneralException"});for(let e=0;e<o.length;e+=1){let n=t.results[e],r=o[e];if(n.status!=="ok")throw new C({code:"GeneralException",target:r.label});r.settle(n.value);}}var Dt=class{#t=[];get size(){return this.#t.length}get pending(){return this.#t}push(t){this.#t.push(t);}take(){let t=this.#t;this.#t=[];for(let e of t)e.capture?.();return t}clear(){for(let t of this.#t)t.dispose?.();this.#t=[];}};function me(o,t){if(Array.isArray(o)){for(let e of o)t(e);return}t(o);}var Ct=class{#t;#n;constructor(t,e){this.#t=t,this.#n=e;}add(t){this.#t.assertUsable(),me(t,e=>{this.#e(e),this.#t.track(e);});}remove(t){this.#t.assertUsable(),me(t,e=>{this.#e(e),this.#t.untrack(e);});}#e(t){this.#n(t)||a({code:"InvalidObjectPath"});}};var At=class o{#t;#n=new Dt;#e=new Set;#o=new Set;#i;#s;#r;#a=false;#l=null;#c=false;constructor(t){this.#t=t,this.#i={host:t.host,capabilities:t.capabilities,...t.author===void 0?{}:{author:t.author},revisionTextView:t.revisionTextView,queue:this.#n,session:t.id,roots:()=>t.roots(),assertUsable:e=>{this.#t.assertLive(e),this.#a&&a({code:"InvalidRequestContext",...e===void 0?{}:{target:e}});},isFinished:()=>this.#a,readRevision:()=>this.#l,register:e=>{this.#e.add(e);},track:e=>{this.#o.add(e);},untrack:e=>{this.#o.delete(e);},isTracked:e=>this.#o.has(e),disown:e=>{this.#e.delete(e),this.#o.delete(e);}},this.#s=new Ct(this.#i,e=>this.#e.has(e));}get document(){return this.#i.assertUsable("document"),this.#r??=this.#t.openDocument(this),this.#r}get capabilities(){return this.#t.capabilities}get trackedObjects(){return this.#s}async sync(){this.#i.assertUsable(),this.#c&&a({code:"InvalidRequestContext"});let t=this.#n.take();if(t.length!==0){this.#c=true;try{let e=t.filter(s=>!s.nullableLoad?.isNull),n=t.some(s=>s.sort==="write"),r,i=s=>s.dependencies?.some(d=>!d.isAddressable)??false;for(;e.some(i);){r??=n&&this.#l!==null?this.#l:this.#t.host.revision();let s=e.filter(h=>h.sort==="read"&&!i(h));s.length===0&&a({code:"InvalidObjectPath",target:e.find(i)?.label}),await this.#d(s,r);let d=new Set(s);e=e.filter(h=>!d.has(h)&&!h.nullableLoad?.isNull);}if(e.length){let s=r??(n&&this.#l!==null?this.#l:void 0);await this.#d(e,s);}}finally{for(let e of t)e.dispose?.();this.#c=false;}}}async#d(t,e){let n=ue(t),r={operations:n.operations,...e===void 0?{}:{expectedRevision:e}};if(this.#t.host.prepare){let s={...r,expectedRevision:r.expectedRevision??this.#t.host.revision()};await this.#t.host.prepare(s);let d=this.#t.host.execute(s);if(!d.ok)throw zt(d,t,s.expectedRevision);Qt(t,d),this.#l=d.revision;return}let i=this.#t.host.execute(r);if(!i.ok)throw zt(i,t,e);Qt(t,i),(n.hasRead||n.hasWrite)&&(this.#l=i.revision);}get[Y](){return this.#i}static begin(t){let e=new o(t);return {context:e,adopt(n){for(let r of n)e.#h(r);},finish(){e.#u();}}}#h(t){let e=t.context;if(e===this)return;let n=e[Y];if(n.session!==this.#t.id)throw new C({code:"InvalidObjectPath"});if(!n.isFinished())throw new C({code:"ObjectInUse"});if(!n.isTracked(t))throw new C({code:"InvalidObjectPath"});let r=n.readRevision();n.disown(t),t[jt](this),this.#e.add(t),this.#o.add(t),r!==null&&this.#p(r);}#p(t){this.#l=this.#l===null?t:Math.min(this.#l,t);}#u(){if(!this.#a){this.#a=true,this.#n.clear();for(let t of this.#e)this.#o.has(t)||t[St]();this.#e.clear();}}};function vt(o,t,e){if(o.select.length===0)return t;for(let n of o.select)t.includes(n)||a({code:"InvalidArgument",target:`${e}.${n}`});return o.select}function R(o,t){let e=o.address();return t==="span"?(e.kind!=="span"&&a({code:"InvalidObjectPath",target:o.label}),{start:e.span.start,end:e.span.end}):(e.kind!=="handle"&&a({code:"InvalidObjectPath",target:o.label}),t==="body"?{body:e.handle}:{paragraph:e.handle})}function it(o,t){return (typeof o!="string"||o.trim().length===0||o.length>255)&&a({code:"InvalidArgument",target:t}),o}var p=class extends B{revisionTextView(){return J(this.context).revisionTextView}loadTextInto(t,e){let n=`${this.path.label}.${t}`;this.enqueue({sort:"read",label:n,plan:e,settle:r=>{this.setLoadedProperty(t,O(r,n));}});}command(t,e,n){let r=`${this.path.label}.${t}`;this.enqueue({sort:"write",label:r,plan:e,settle:i=>m(i,r),...n?{capture:n,dispose:n}:{}});}commandDiscarding(t,e){let n=`${this.path.label}.${t}`;this.enqueue({sort:"write",label:n,plan:e,settle:()=>{}});}commandAnswering(t,e,n,r){this.enqueue({sort:"write",label:t,plan:e,settle:n,...r?{capture:r,dispose:r}:{}});}read(t,e,n){this.enqueue({sort:"read",label:t,plan:e,settle:n});}selection(t,e){return vt(t,e,this.path.label)}onLoad(t){this.selection(t,[]);}};var T=class extends B{#t;#n=[];constructor(t,e){super(t,e);}get items(){return this.loadedProperty("items")}fill(t,e){this.setLoadedProperty("items",this.#o(t,e,0,void 0)),this.#t={value:t,label:e};let n=this.#n.splice(0,this.#n.length);for(let r of n)this.#e(r,t);}onLoad(t){vt(t,["items"],this.path.label);let e=this.path.isPending?void 0:this.listing();if(e===null)return;let n=`${this.path.label}.items`,r=t.skip??0,i=t.top;this.enqueue({sort:"read",label:n,plan:()=>{let s=e??this.listing();return s||a({code:"InvalidObjectPath",target:this.path.label}),s},settle:s=>{this.setLoadedProperty("items",this.#o(s,n,r,i));}});}edge(t,e,n){let r=`${this.path.label}.${e}()`,i=this.promised(r,n),s=this.path.isPending?void 0:this.listing();if(s===null){let d={edge:t,target:r,nullable:n,item:i};return this.#t?this.#e(d,this.#t.value):this.#n.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.#e({edge:t,target:r,nullable:n,item:i},d);}}),i}#e(t,e){let{edge:n,target:r,nullable:i,item:s}=t,d=this.size(e,r);if(d===0){i||a({code:"ItemNotFound",target:r}),s.hydrateNull();return}let h=this.addressAt(e,r,n==="first"?0:d-1);h||a({code:"ItemNotFound",target:r}),s.hydrateAddress(h);}#o(t,e,n,r){let i=this.size(t,e),s=r===void 0?i:Math.min(i,n+r),d=[];for(let h=n;h<s;h+=1){let A=this.addressAt(t,e,h);A&&d.push(this.itemAt(`${e}[${String(h)}]`,A));}return d}},x=class extends T{size(t,e){return v(t,e).length}addressAt(t,e,n){let r=v(t,e)[n];return r?{kind:"handle",handle:r}:void 0}};var H=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get code(){return this.loadedProperty("code")}set code(t){if(this.requireUsablePath(),(typeof t!="string"||t.length===0)&&a({code:"InvalidArgument",target:`${this.path.label}.code`}),this.#t){this.#t.code=t;return}let e={code:t};this.#t=e,this.commandAnswering(this.path.label,()=>({op:"setFieldCode",field:this.#e(),code:e.code}),n=>m(n,this.path.label),()=>{this.#t===e&&(this.#t=void 0);});}delete(){this.#n("deleteField");}updateResult(){this.#n("updateFieldResult");}#n(t){this.requireUsablePath(),this.commandAnswering(this.path.label,()=>({op:t,field:this.#e()}),e=>m(e,this.path.label));}onLoad(t){this.selection(t,["code"]).length!==0&&this.read(this.path.label,()=>({op:"getField",field:this.#e()}),e=>{e.kind!=="field"&&a({code:"GeneralException",target:this.path.label}),this.setLoadedProperty("code",e.field.code);});}#e(){this.requireAddressable();let t=this.path.address();return t.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.path.label}),t.handle}},M=class o extends T{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=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:R(this.path,this.#t)}}size(t,e){return v(t,e).length}addressAt(t,e,n){let r=v(t,e)[n];return r?{kind:"handle",handle:r}:void 0}itemAt(t,e){return H.at(this.context,t,e)}promised(t,e){return H.promised(this.context,t,e)}};var De=["width","height","lockAspectRatio","altTextDescription"],F=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get width(){return this.loadedProperty("width")}set width(t){this.#n("width",t);}get height(){return this.loadedProperty("height")}set height(t){this.#n("height",t);}get lockAspectRatio(){return this.loadedProperty("lockAspectRatio")}set lockAspectRatio(t){typeof t!="boolean"&&a({code:"InvalidArgument",target:`${this.path.label}.lockAspectRatio`}),this.#e({lockAspectRatio:t});}get altTextDescription(){return this.loadedProperty("altTextDescription")}set altTextDescription(t){typeof t!="string"&&a({code:"InvalidArgument",target:`${this.path.label}.altTextDescription`}),this.#e({altTextDescription:t});}delete(){let t=`${this.path.label}.delete`;this.commandAnswering(t,()=>({op:"deleteInlinePicture",picture:this.#o()}),e=>m(e,t));}onLoad(t){let e=this.selection(t,De);e.length&&this.read(this.path.label,()=>({op:"getInlinePicture",picture:this.#o()}),n=>{n.kind!=="inlinePicture"&&a({code:"GeneralException",target:this.path.label});for(let r of e)this.setLoadedProperty(r,n.picture[r]);});}#n(t,e){(typeof e!="number"||!Number.isFinite(e)||e<=0)&&a({code:"InvalidArgument",target:`${this.path.label}.${t}`}),this.#e({[t]:e});}#e(t){if(this.requireUsablePath(),this.#t){Object.assign(this.#t,t);return}let e=t;this.#t=e,this.commandAnswering(this.path.label,()=>({op:"setInlinePicture",picture:this.#o(),properties:e}),n=>m(n,this.path.label),()=>{this.#t===e&&(this.#t=void 0);});}#o(){this.requireAddressable();let t=this.path.address();return t.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.path.label}),t.handle}},V=class o extends T{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=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:R(this.path,this.#t)}}size(t,e){return v(t,e).length}addressAt(t,e,n){let r=v(t,e)[n];return r?{kind:"handle",handle:r}:void 0}itemAt(t,e){return F.at(this.context,t,e)}promised(t,e){return F.promised(this.context,t,e)}};function D(o,t,e=0){return (!Number.isInteger(o)||o<e)&&a({code:"InvalidArgument",target:t}),o}function Xt(o,t){return (!Array.isArray(o)||o.some(e=>!Array.isArray(e)||e.some(n=>typeof n!="string")))&&a({code:"InvalidArgument",target:t}),o.map(e=>[...e])}function ge(o,t){return o!=="Start"&&o!=="End"&&a({code:"InvalidArgument",target:t}),o==="Start"?"start":"end"}var W=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n=false){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get values(){return this.loadedProperty("values")}set values(t){let e=Xt(t,`${this.path.label}.values`);this.command("values",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"values",values:e}}));}get style(){return this.loadedProperty("style")}set style(t){typeof t!="string"&&a({code:"InvalidArgument",target:`${this.path.label}.style`}),this.command("style",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"properties",styleId:t}}));}get headerRowCount(){return this.loadedProperty("headerRowCount")}set headerRowCount(t){D(t,`${this.path.label}.headerRowCount`),this.command("headerRowCount",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"properties",headerRowCount:t}}));}get rowCount(){return this.loadedProperty("rowCount")}get columnCount(){return this.loadedProperty("columnCount")}get rows(){return this.#t??=st.of(this.context,`${this.path.label}.rows`,this.path,()=>({op:"getTableRows",table:this.path.handle()}))}getCell(t,e){let n=`${this.path.label}.getCell`;D(t,n),D(e,n);let r=tt.promised(this.context,n);return this.read(n,()=>({op:"getTableCell",table:this.path.handle(),rowIndex:t,cellIndex:e}),i=>r.hydrateAddress({kind:"handle",handle:u(i,n)})),r}addRows(t,e,n){let r=`${this.path.label}.addRows`,i=ge(t,r);D(e,r,1);let s=n===void 0?void 0:Xt(n,r),d=st.of(this.context,r,this.path,()=>null);return this.commandAnswering(r,()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"addRows",location:i,count:e,...s?{values:s}:{}}}),h=>d.fill(h,r)),d}addColumns(t,e,n){let r=`${this.path.label}.addColumns`,i=ge(t,r);D(e,r,1);let s=n===void 0?void 0:Xt(n,r);this.command("addColumns",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"addColumns",location:i,count:e,...s?{values:s}:{}}}));}deleteRows(t,e){e===void 0&&(e=1),D(t,this.path.label),D(e,this.path.label,1),this.command("deleteRows",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"deleteRows",index:t,count:e}}));}deleteColumns(t,e){e===void 0&&(e=1),D(t,this.path.label),D(e,this.path.label,1),this.command("deleteColumns",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"deleteColumns",index:t,count:e}}));}delete(){this.command("delete",()=>({op:"updateTable",table:this.path.handle(),mutation:{kind:"delete"}}));}onLoad(t){let e=this.selection(t,["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 e)this.setLoadedProperty(r,n.table[r]);});}},at=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n=false){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get cells(){return this.#t??=Pt.of(this.context,`${this.path.label}.cells`,this.path,()=>({op:"getTableCells",row:this.path.handle()}))}},tt=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n=false){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get body(){if(this.#t)return this.#t;let t=`${this.path.label}.body`,e=I.promisedStory(this.context,t);return this.read(t,()=>({op:"getTableCellBody",cell:this.path.handle()}),n=>e.hydrateAddress({kind:"handle",handle:u(n,t)})),this.#t=e,e}get value(){return this.loadedProperty("value")}set value(t){typeof t!="string"&&a({code:"InvalidArgument",target:`${this.path.label}.value`}),this.command("value",()=>({op:"updateTableCell",cell:this.path.handle(),properties:{value:t}}));}get columnWidth(){return this.loadedProperty("columnWidth")}set columnWidth(t){(typeof t!="number"||!Number.isFinite(t)||t<=0)&&a({code:"InvalidArgument",target:`${this.path.label}.columnWidth`}),this.command("columnWidth",()=>({op:"updateTableCell",cell:this.path.handle(),properties:{columnWidth:t}}));}get shadingColor(){return this.loadedProperty("shadingColor")}set shadingColor(t){typeof t!="string"&&a({code:"InvalidArgument",target:`${this.path.label}.shadingColor`}),this.command("shadingColor",()=>({op:"updateTableCell",cell:this.path.handle(),properties:{shadingColor:t}}));}get verticalAlignment(){return this.loadedProperty("verticalAlignment")}set verticalAlignment(t){t!=="Top"&&t!=="Center"&&t!=="Bottom"&&a({code:"InvalidArgument",target:`${this.path.label}.verticalAlignment`}),this.command("verticalAlignment",()=>({op:"updateTableCell",cell:this.path.handle(),properties:{verticalAlignment:t}}));}onLoad(t){let e=this.selection(t,["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 e)this.setLoadedProperty(r,n.cell[r]);});}},U=class o extends x{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}static over(t,e,n,r){return o.of(t,e,n,()=>({op:"getTables",scope:r()}))}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}listing(){return this.#t()}itemAt(t,e){return W.at(this.context,t,e)}promised(t,e){return W.promised(this.context,t,e)}},st=class o extends x{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}listing(){return this.#t()}itemAt(t,e){return at.at(this.context,t,e)}promised(t,e){return at.promised(this.context,t,e)}},Pt=class o extends x{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}listing(){return this.#t()}itemAt(t,e){return tt.at(this.context,t,e)}promised(t,e){return tt.promised(this.context,t,e)}};var Kt=(i=>(i.replace="Replace",i.start="Start",i.end="End",i.before="Before",i.after="After",i))(Kt||{}),Zt=(s=>(s.mixed="Mixed",s.unknown="Unknown",s.left="Left",s.centered="Centered",s.right="Right",s.justified="Justified",s))(Zt||{}),Yt=(e=>(e.portrait="Portrait",e.landscape="Landscape",e))(Yt||{}),Jt=(n=>(n.off="Off",n.trackAll="TrackAll",n.trackMineOnly="TrackMineOnly",n))(Jt||{}),_t=(r=>(r.mixed="Mixed",r.top="Top",r.center="Center",r.bottom="Bottom",r))(_t||{}),te=(d=>(d.line="Line",d.page="Page",d.next="Next",d.sectionNext="SectionNext",d.sectionContinuous="SectionContinuous",d.sectionEven="SectionEven",d.sectionOdd="SectionOdd",d))(te||{}),ee=(y=>(y.unknown="Unknown",y.richText="RichText",y.plainText="PlainText",y.picture="Picture",y.buildingBlockGallery="BuildingBlockGallery",y.checkBox="CheckBox",y.comboBox="ComboBox",y.datePicker="DatePicker",y.dropDownList="DropDownList",y.group="Group",y.repeatingSection="RepeatingSection",y.plainTextInline="PlainTextInline",y.plainTextParagraph="PlainTextParagraph",y.richTextInline="RichTextInline",y.richTextParagraphs="RichTextParagraphs",y.richTextTable="RichTextTable",y.richTextTableCell="RichTextTableCell",y.richTextTableRow="RichTextTableRow",y))(ee||{});var qe=["Replace","Start","End"],$e=["Start","End"],Be=["Replace","Start","End"],He=["Before","After"],Me=["Replace","Start","End","Before","After"],Fe=["Select","Start","End"];function dt(o,t,e){return (typeof o!="string"||!t.includes(o))&&a({code:"InvalidArgument",target:e}),o}var fe=(o,t)=>dt(o,qe,t),be=(o,t)=>dt(o,$e,t),ye=(o,t)=>dt(o,Be,t),xe=(o,t)=>dt(o,He,t),Ot=(o,t)=>dt(o,Me,t),qt=(o,t)=>o===void 0?"Select":dt(o,Fe,t);function k(o,t){return typeof o!="string"&&a({code:"InvalidArgument",target:t}),/[\r\n\v\f\u2028\u2029]/.test(o)&&a({code:"InvalidArgument",target:t}),o}var Ve=8,oe=(d=>(d.custom="Custom",d.solid="Solid",d.hollow="Hollow",d.square="Square",d.diamonds="Diamonds",d.arrow="Arrow",d.checkmark="Checkmark",d))(oe||{}),re=(s=>(s.none="None",s.arabic="Arabic",s.upperRoman="UpperRoman",s.lowerRoman="LowerRoman",s.upperLetter="UpperLetter",s.lowerLetter="LowerLetter",s))(re||{}),j=class o extends p{#t;#n=new Map;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get id(){return this.loadedProperty("id")}get paragraphs(){return this.#t??=L.overListing(this.context,`${this.path.label}.paragraphs`,this.path,()=>({op:"getListParagraphs",list:this.#o()})),this.#t}getLevelParagraphs(t){let e=`${this.path.label}.getLevelParagraphs`,n=ne(t,e);return L.overListing(this.context,e,this.path,()=>({op:"getListParagraphs",list:this.#o(),level:n}))}insertParagraph(t,e){let n=`${this.path.label}.insertParagraph`,r=k(t,n);e!=="Start"&&e!=="End"&&e!=="Before"&&e!=="After"&&a({code:"InvalidArgument",target:n});let i=w.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"insertListParagraph",list:this.#o(),where:e==="Start"||e==="Before"?"start":"end",text:r}),s=>{i.hydrateAddress({kind:"handle",handle:u(s,n)});}),i}setLevelBullet(t,e,n,r){this.#e(t,{bullet:e,...n===void 0?{}:{charCode:n},...r===void 0?{}:{fontName:r}});}setLevelNumbering(t,e,n){this.#e(t,{numbering:e,...n===void 0?{}:{formatString:[...n]}});}setLevelStartingNumber(t,e){this.#e(t,{startingNumber:e});}setLevelIndents(t,e,n){this.#e(t,{textIndent:e,bulletNumberPictureIndent:n});}#e(t,e){let n=`${this.path.label}.levelFormat`,r=ne(t,n);this.requireUsablePath();let i=this.#n.get(r);if(i){Object.assign(i,e),"bullet"in e&&(delete i.numbering,delete i.formatString),"numbering"in e&&(delete i.bullet,delete i.charCode,delete i.fontName);return}let s={...e};this.#n.set(r,s),this.commandAnswering(n,()=>({op:"setListLevelFormat",list:this.#o(),level:r,format:s}),d=>{m(d,n);},()=>{this.#n.get(r)===s&&this.#n.delete(r);});}onLoad(t){if(!this.selection(t,["id"]).includes("id"))return;let e=`${this.path.label}.id`;this.read(e,()=>({op:"getListId",list:this.#o()}),n=>{this.setLoadedProperty("id",Et(n,e));});}#o(){return this.requireAddressable(),this.path.handle()}},lt=class o extends x{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}getById(t){let e=`${this.path.label}.getById`,n=We(t,e),r=this.#t,i=j.promised(this.context,e,false);return this.enqueue({sort:"read",label:e,plan:()=>({op:"getListById",body:r,id:n}),settle:s=>{i.hydrateAddress({kind:"handle",handle:u(s,e)});}}),i}listing(){return {op:"getLists",body:this.#t}}itemAt(t,e){return j.at(this.context,t,e)}promised(t,e){return j.promised(this.context,t,e)}},ct=class o extends p{static of(t,e,n){return new o(t,c.derived(e,n))}constructor(t,e){super(t,e);}get level(){return this.loadedProperty("level")}set level(t){let e=`${this.path.label}.level`,n=ne(t,e);this.commandAnswering(e,()=>({op:"setListLevel",paragraph:this.#t(),level:n}),r=>{m(r,e);});}onLoad(t){if(!this.selection(t,["level"]).includes("level"))return;let e=`${this.path.label}.level`;this.read(e,()=>({op:"getListLevel",paragraph:this.#t()}),n=>{this.setLoadedProperty("level",Et(n,e));});}#t(){this.requireAddressable();let t=this.path.address();return t.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.path.label}),t.handle}};function ne(o,t){return (!Number.isInteger(o)||o<0||o>Ve)&&a({code:"InvalidArgument",target:t}),o}function We(o,t){return (!Number.isInteger(o)||o<=0)&&a({code:"InvalidArgument",target:t}),o}var ie=(f=>(f.mixed="Mixed",f.none="None",f.hidden="Hidden",f.dotLine="DotLine",f.single="Single",f.word="Word",f.double="Double",f.thick="Thick",f.dotted="Dotted",f.dottedHeavy="DottedHeavy",f.dashLine="DashLine",f.dashLineHeavy="DashLineHeavy",f.dashLineLong="DashLineLong",f.dashLineLongHeavy="DashLineLongHeavy",f.dotDashLine="DotDashLine",f.dotDashLineHeavy="DotDashLineHeavy",f.twoDotDashLine="TwoDotDashLine",f.twoDotDashLineHeavy="TwoDotDashLineHeavy",f.wave="Wave",f.waveHeavy="WaveHeavy",f.waveDouble="WaveDouble",f))(ie||{}),Ue=["bold","italic","color","name","size","underline","strikeThrough","highlightColor","subscript","superscript"],E=class o extends p{#t;#n;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}get bold(){return this.loadedProperty("bold")}set bold(t){this.#e("bold",Rt(t,`${this.path.label}.bold`));}get italic(){return this.loadedProperty("italic")}set italic(t){this.#e("italic",Rt(t,`${this.path.label}.italic`));}get color(){return this.loadedProperty("color")}set color(t){this.#e("color",$t(t,`${this.path.label}.color`));}get name(){return this.loadedProperty("name")}set name(t){this.#e("name",$t(t,`${this.path.label}.name`));}get size(){return this.loadedProperty("size")}set size(t){this.#e("size",Ge(t,`${this.path.label}.size`));}get underline(){return this.loadedProperty("underline")}set underline(t){this.#e("underline",$t(t,`${this.path.label}.underline`));}get highlightColor(){return this.loadedProperty("highlightColor")}set highlightColor(t){this.#e("highlightColor",t===null?null:$t(t,`${this.path.label}.highlightColor`));}get strikeThrough(){return this.loadedProperty("strikeThrough")}set strikeThrough(t){this.#e("strikeThrough",Rt(t,`${this.path.label}.strikeThrough`));}get subscript(){return this.loadedProperty("subscript")}set subscript(t){this.#e("subscript",Rt(t,`${this.path.label}.subscript`));}get superscript(){return this.loadedProperty("superscript")}set superscript(t){this.#e("superscript",Rt(t,`${this.path.label}.superscript`));}onLoad(t){let e=this.selection(t,Ue);if(e.length===0)return;let n=`${this.path.label}.font`;this.read(n,()=>({op:"getFont",span:this.#o()}),r=>{let i=Wt(r,n);for(let s of e)this.setLoadedProperty(s,i[s]);});}#e(t,e){if(this.requireUsablePath(),this.#n){this.#n[t]=e,t==="subscript"&&e===true&&(this.#n.superscript=false),t==="superscript"&&e===true&&(this.#n.subscript=false);return}let n={[t]:e};t==="subscript"&&e===true&&(n.superscript=false),t==="superscript"&&e===true&&(n.subscript=false),this.#n=n;let r=`${this.path.label}.${t}`;this.commandAnswering(this.path.label,()=>({op:"setFont",span:this.#o(),font:n}),i=>{m(i,r);},()=>{this.#n===n&&(this.#n=void 0);});}#o(){return this.requireAddressable(),R(this.path,this.#t)}};function Rt(o,t){return typeof o!="boolean"&&a({code:"InvalidArgument",target:t}),o}function Ge(o,t){return (typeof o!="number"||!Number.isFinite(o))&&a({code:"InvalidArgument",target:t}),o}function $t(o,t){return (typeof o!="string"||o.length===0)&&a({code:"InvalidArgument",target:t}),o}var ze=16,w=class o extends p{#t;#n;#e;#o;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get text(){return this.loadedProperty("text")}get uniqueLocalId(){return this.loadedProperty("uniqueLocalId")}get style(){return this.loadedProperty("style")}set style(t){this.#i("style",it(t,`${this.path.label}.style`));}get font(){return this.#t??=E.of(this.context,`${this.path.label}.font`,this.path,"paragraph"),this.#t}get alignment(){return this.loadedProperty("alignment")}set alignment(t){this.#i("alignment",Xe(t,`${this.path.label}.alignment`));}get firstLineIndent(){return this.loadedProperty("firstLineIndent")}set firstLineIndent(t){this.#i("firstLineIndent",ht(t,`${this.path.label}.firstLineIndent`));}get leftIndent(){return this.loadedProperty("leftIndent")}set leftIndent(t){this.#i("leftIndent",ht(t,`${this.path.label}.leftIndent`));}get rightIndent(){return this.loadedProperty("rightIndent")}set rightIndent(t){this.#i("rightIndent",ht(t,`${this.path.label}.rightIndent`));}get lineSpacing(){return this.loadedProperty("lineSpacing")}set lineSpacing(t){this.#i("lineSpacing",ht(t,`${this.path.label}.lineSpacing`));}get spaceBefore(){return this.loadedProperty("spaceBefore")}set spaceBefore(t){this.#i("spaceBefore",ht(t,`${this.path.label}.spaceBefore`));}get spaceAfter(){return this.loadedProperty("spaceAfter")}set spaceAfter(t){this.#i("spaceAfter",ht(t,`${this.path.label}.spaceAfter`));}get list(){return this.#n??=this.#s(`${this.path.label}.list`),this.#n}getRange(t="Whole"){let e=`${this.path.label}.getRange`;["Whole","Content","Start","End","Before","After"].includes(t)||a({code:"InvalidArgument",target:e});let n=b.promised(this.context,e,false);return this.read(e,()=>({op:"getRange",span:{paragraph:this.#r()},location:t}),r=>{n.hydrateAddress({kind:"span",span:P(r,e)});}),n}startNewList(){let t=`${this.path.label}.startNewList`,e=j.promised(this.context,t,false);return this.commandAnswering(t,()=>({op:"startNewList",paragraph:this.#r()}),n=>{e.hydrateAddress({kind:"handle",handle:u(n,t)});}),e}attachToList(t,e){let n=`${this.path.label}.attachToList`;(!Number.isSafeInteger(t)||t<=0||!Number.isInteger(e)||e<0||e>8)&&a({code:"InvalidArgument",target:n});let r=j.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"attachToList",paragraph:this.#r(),listId:t,level:e}),i=>{r.hydrateAddress({kind:"handle",handle:u(i,n)});}),r}detachFromList(){let t=`${this.path.label}.detachFromList`;this.commandAnswering(t,()=>({op:"detachFromList",paragraph:this.#r()}),e=>{m(e,t);});}get listItem(){return this.#e??=ct.of(this.context,`${this.path.label}.listItem`,this.path),this.#e}clear(){this.commandDiscarding("clear",()=>({op:"replaceSpan",span:{paragraph:this.#r()},text:""}));}delete(){this.command("delete",()=>({op:"deleteParagraph",paragraph:this.#r()}));}insertText(t,e){let n=`${this.path.label}.insertText`,r=k(t,n),i=ye(e,n),s=b.promised(this.context,n,false);return this.commandAnswering(n,()=>i==="Replace"?{op:"replaceSpan",span:{paragraph:this.#r()},text:r}:{op:"insertText",at:{paragraph:this.#r(),at:i==="Start"?"start":"end"},text:r},d=>{s.hydrateAddress({kind:"span",span:P(d,n)});}),s}insertParagraph(t,e){let n=`${this.path.label}.insertParagraph`,r=k(t,n),i=xe(e,n),s=o.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"insertParagraph",anchor:{paragraph:this.#r()},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(t,e,n){let r=`${this.path.label}.split`,i=Ke(t,r),s=Ae(e,`${r}.trimDelimiters`),d=Ae(n,`${r}.trimSpacing`),h=N.answered(this.context,r,this.path);return this.commandAnswering(r,()=>({op:"splitParagraph",paragraph:this.#r(),delimiters:i,...s?{trimDelimiters:true}:{},...d?{trimSpacing:true}:{}}),A=>{h.fill(A,r);}),h}onLoad(t){let e=this.selection(t,["text","uniqueLocalId",...Ce]);e.includes("text")&&this.loadTextInto("text",()=>({op:"getText",target:this.#r(),projection:this.revisionTextView()})),e.includes("uniqueLocalId")&&this.loadTextInto("uniqueLocalId",()=>({op:"getParagraphId",paragraph:this.#r()}));let n=Ce.filter(i=>e.includes(i));if(n.length===0)return;let r=`${this.path.label}.paragraphFormat`;this.read(r,()=>({op:"getParagraphFormat",paragraph:{paragraph:this.#r()}}),i=>{let s=Ut(i,r);for(let d of n)this.setLoadedProperty(d,s[d]);});}#i(t,e){if(this.requireUsablePath(),this.#o){this.#o[t]=e;return}let n={[t]:e};this.#o=n;let r=`${this.path.label}.${t}`;this.commandAnswering(`${this.path.label}.paragraphFormat`,()=>({op:"setParagraphFormat",paragraph:{paragraph:this.#r()},format:n}),i=>{m(i,r);},()=>{this.#o===n&&(this.#o=void 0);});}#s(t){let e=j.promised(this.context,t,false);return this.read(t,()=>({op:"getParagraphList",paragraph:this.#r()}),n=>{e.hydrateAddress({kind:"handle",handle:u(n,t)});}),e}#r(){return this.requireAddressable(),this.path.handle()}},Ce=["style","alignment","firstLineIndent","leftIndent","rightIndent","lineSpacing","spaceBefore","spaceAfter"],Qe=["Left","Centered","Right","Justified"];function Xe(o,t){return Qe.includes(o)||a({code:"InvalidArgument",target:t}),o}function ht(o,t){return (typeof o!="number"||!Number.isFinite(o))&&a({code:"InvalidArgument",target:t}),o}function Ke(o,t){(!Array.isArray(o)||o.length===0||o.length>ze)&&a({code:"InvalidArgument",target:t});for(let e of o)(typeof e!="string"||e.length===0)&&a({code:"InvalidArgument",target:t});return [...o]}function Ae(o,t){return o!==void 0&&typeof o!="boolean"&&a({code:"InvalidArgument",target:t}),o===true}var L=class o extends T{#t;static of(t,e,n){return new o(t,c.derived(e,n),null)}static overListing(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=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.#t)return this.#t();let t=this.path.address();return t.kind==="handle"?{op:"getParagraphs",body:t.handle}:{op:"getSpanParagraphs",span:t.span}}size(t,e){return v(t,e).length}addressAt(t,e,n){let r=v(t,e)[n];return r?{kind:"handle",handle:r}:void 0}itemAt(t,e){return w.at(this.context,t,e)}promised(t,e){return w.promised(this.context,t,e)}},N=class o extends T{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}static answered(t,e,n){return new o(t,c.derived(e,n),null)}constructor(t,e,n){super(t,e),this.#t=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.#t?this.#t():null}size(t,e){return Tt(t,e).length}addressAt(t,e,n){let r=Tt(t,e)[n];return r?{kind:"span",span:r}:void 0}itemAt(t,e){return b.at(this.context,t,e)}promised(t,e){return b.promised(this.context,t,e)}};var Pe=4096,q=class o extends p{#t;#n=new Map;#e;#o;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get id(){return this.loadedProperty("id")}get tag(){return this.loadedProperty("tag")}set tag(t){this.#s("tag",{tag:ae(t,`${this.path.label}.tag`)});}get title(){return this.loadedProperty("title")}set title(t){this.#s("title",{title:ae(t,`${this.path.label}.title`)});}get subtype(){return this.loadedProperty("subtype")}get isBound(){return this.loadedProperty("isBound")}get cannotDelete(){let t=this.loadedProperty("lock");return t==="sdtLocked"||t==="sdtContentLocked"}set cannotDelete(t){this.#r("cannotDelete",t);}get cannotEdit(){let t=this.loadedProperty("lock");return t==="contentLocked"||t==="sdtContentLocked"}set cannotEdit(t){this.#r("cannotEdit",t);}get placeholderShown(){return this.loadedProperty("placeholderShown")}get temporary(){return this.loadedProperty("temporary")}get text(){return this.loadedProperty("text")}get paragraphs(){return this.#e??=L.overListing(this.context,`${this.path.label}.paragraphs`,this.path,()=>({op:"getContentControlParagraphs",contentControl:this.#a()})),this.#e}get contentControls(){return this.#o??=$.of(this.context,`${this.path.label}.contentControls`,this.path,{contentControl:this.#a()}),this.#o}getRange(t){let e=`${this.path.label}.getRange`,n=Ze(t??"Whole",e),r=this.#n.get(n);if(r)return r;let i=this.#i(e,n);return this.#n.set(n,i),i}setValue(t){let e=`${this.path.label}.setValue`,n=Ye(t,e);this.command("setValue",()=>({op:"setContentControlValue",contentControl:this.#a(),value:n}));}insertText(t,e){let n=`${this.path.label}.insertText`,r=k(t,n),i=e==="Replace"?"replace":e==="Start"?"start":e==="End"?"end":a({code:"InvalidArgument",target:n}),s=b.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"insertContentControlText",contentControl:this.#a(),text:r,at:i}),d=>{s.hydrateAddress({kind:"span",span:P(d,n)});}),s}delete(t){let e=`${this.path.label}.delete`;typeof t!="boolean"&&a({code:"InvalidArgument",target:e}),this.command("delete",()=>({op:"deleteContentControl",contentControl:this.#a(),keepContent:t}));}onLoad(t){let e=this.selection(t,["id","tag","title","subtype","isBound","text","cannotDelete","cannotEdit","placeholderShown","temporary"]);if(e.includes("id")&&this.loadTextInto("id",()=>({op:"getContentControlFileId",contentControl:this.#a()})),e.includes("tag")&&this.loadTextInto("tag",()=>({op:"getContentControlTag",contentControl:this.#a()})),e.includes("title")&&this.loadTextInto("title",()=>({op:"getContentControlTitle",contentControl:this.#a()})),e.includes("subtype")&&this.loadTextInto("subtype",()=>({op:"getContentControlSubtype",contentControl:this.#a()})),e.includes("isBound")){let r=`${this.path.label}.isBound`;this.read(r,()=>({op:"getContentControlIsBound",contentControl:this.#a()}),i=>{this.setLoadedProperty("isBound",_(i,r));});}if(e.includes("text")&&this.loadTextInto("text",()=>({op:"getContentControlText",contentControl:this.#a(),projection:this.revisionTextView()})),e.includes("cannotDelete")||e.includes("cannotEdit")){let r=`${this.path.label}.lock`;this.read(r,()=>({op:"getContentControlLock",contentControl:this.#a()}),i=>{this.setLoadedProperty("lock",O(i,r));});}if(e.includes("placeholderShown")){let r=`${this.path.label}.placeholderShown`;this.read(r,()=>({op:"getContentControlPlaceholderShown",contentControl:this.#a()}),i=>{this.setLoadedProperty("placeholderShown",_(i,r));});}if(!e.includes("temporary"))return;let n=`${this.path.label}.temporary`;this.read(n,()=>({op:"getContentControlTemporary",contentControl:this.#a()}),r=>{this.setLoadedProperty("temporary",_(r,n));});}#i(t,e){let n=b.promised(this.context,t,false);return this.read(t,()=>({op:"getContentControlRange",contentControl:this.#a(),location:e}),r=>{n.hydrateAddress({kind:"span",span:P(r,t)});}),n}#s(t,e){this.command(t,()=>({op:"setContentControlProperties",contentControl:this.#a(),...e}));}#r(t,e){let n=`${this.path.label}.${t}`;if(typeof e!="boolean"&&a({code:"InvalidArgument",target:n}),this.requireUsablePath(),this.#t){this.#t[t]=e;return}let r={[t]:e};this.#t=r,this.command(t,()=>({op:"setContentControlProperties",contentControl:this.#a(),...r}),()=>{this.#t===r&&(this.#t=void 0);});}#a(){return this.requireAddressable(),this.path.handle()}},$=class o extends x{#t;#n;static of(t,e,n,r){return new o(t,c.derived(e,n),r,()=>({op:"getContentControls",scope:r}))}constructor(t,e,n,r){super(t,e),this.#t=n,this.#n=r;}getFirst(){return this.edge("first","getFirst",false)}getFirstOrNullObject(){return this.edge("first","getFirstOrNullObject",true)}getById(t){let e=`${this.path.label}.getById`;Number.isInteger(t)||a({code:"InvalidArgument",target:e});let n=this.#t,r=q.promised(this.context,e,false);return this.enqueue({sort:"read",label:e,plan:()=>({op:"getContentControlById",scope:n,id:t}),settle:i=>{r.hydrateAddress({kind:"handle",handle:u(i,e)});}}),r}getByTag(t){let e=`${this.path.label}.getByTag`,n=ve(t,e),r=this.#t;return new o(this.context,c.derived(e,this.path),r,()=>({op:"getContentControlsByTag",scope:r,tag:n}))}getByTitle(t){let e=`${this.path.label}.getByTitle`,n=ve(t,e),r=this.#t;return new o(this.context,c.derived(e,this.path),r,()=>({op:"getContentControlsByTitle",scope:r,title:n}))}listing(){return this.#n()}itemAt(t,e){return q.at(this.context,t,e)}promised(t,e){return q.promised(this.context,t,e)}};function ae(o,t){return (typeof o!="string"||o.length>Pe)&&a({code:"InvalidArgument",target:t}),o}function ve(o,t){let e=ae(o,t);return e.length===0&&a({code:"InvalidArgument",target:t}),e}function Ze(o,t){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:t})}}function Ye(o,t){(typeof o!="object"||o===null)&&a({code:"InvalidArgument",target:t});let e=o;if(e.kind==="text"||e.kind==="listItem"){let n=e.kind==="text"?e.text:e.value;return (typeof n!="string"||n.length>Pe)&&a({code:"InvalidArgument",target:t}),e.kind==="text"?{kind:"text",text:n}:{kind:"listItem",value:n}}if(e.kind==="checkbox")return typeof e.checked!="boolean"&&a({code:"InvalidArgument",target:t}),{kind:"checkbox",checked:e.checked};if(e.kind==="date")return (typeof e.iso!="string"||e.iso.length>64)&&a({code:"InvalidArgument",target:t}),{kind:"date",iso:e.iso};a({code:"InvalidArgument",target:t});}function Je(o,t){return t<1||t>12?0:t===2?o%4===0&&o%100!==0||o%400===0?29:28:t===4||t===6||t===9||t===11?30:31}function Oe(o){if(o.length===0)return null;let t=/^(\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(!t)return null;let e=Number(t[1]),n=Number(t[2]),r=Number(t[3]),i=Je(e,n);if(e===0||i===0||r<1||r>i)return null;let s=Number(t[4]),d=Number(t[5]),h=Number(t[6]);if(s>23||d>59||h>59)return null;let A=t[7],K=A===void 0?0:Number(A.padEnd(3,"0").slice(0,3));if(Number.isNaN(K))return null;let ot=`${t[1]}-${t[2]}-${t[3]}T${t[4]}:${t[5]}:${t[6]}.${String(K).padStart(3,"0")}Z`,Lt=Date.parse(ot);if(Number.isNaN(Lt))return null;let g=t[8];if(g==="Z")return new Date(Lt);let Z=Number(g.slice(1,3)),rt=Number(g.slice(4,6));if(rt>59||Z>14||Z===14&&rt!==0)return null;let Ft=g[0]==="+"?1:-1,wt=new Date(Lt-Ft*(Z*36e5+rt*6e4));return Number.isNaN(wt.getTime())?null:wt}var Bt=class extends p{hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.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 text(){return this.loadedProperty("text")}delete(){this.command("delete",()=>({op:"deleteComment",comment:this.commentHandle()}));}loadCommentFields(t,e){let n=this.selection(t,["authorName","creationDate","id","text",...e]);if(n.includes("authorName")&&this.loadTextInto("authorName",()=>({op:"getCommentAuthor",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",Oe(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",_(i,r));});}commentHandle(){return this.requireAddressable(),this.path.handle()}},et=class o extends Bt{static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}onLoad(t){this.loadCommentFields(t,[]);}},It=class o extends x{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#t()}itemAt(t,e){return et.at(this.context,t,e)}promised(t,e){return et.promised(this.context,t,e)}},G=class o extends Bt{#t;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}get resolved(){return this.loadedProperty("resolved")}set resolved(t){let e=`${this.path.label}.resolved`;typeof t!="boolean"&&a({code:"InvalidArgument",target:e}),this.commandAnswering(e,()=>({op:"setCommentResolved",comment:this.commentHandle(),resolved:t}),n=>{m(n,e);});}get replies(){return this.#t??=It.of(this.context,`${this.path.label}.replies`,this.path,()=>({op:"getCommentReplies",comment:this.commentHandle()})),this.#t}getRange(){let t=`${this.path.label}.getRange`,e=b.promised(this.context,t,false);return this.read(t,()=>({op:"getCommentRange",comment:this.commentHandle()}),n=>{e.hydrateAddress({kind:"span",span:P(n,t)});}),e}reply(t){let e=`${this.path.label}.reply`;(typeof t!="string"||t.length===0)&&a({code:"InvalidArgument",target:e});let n=this.internals.author;(typeof n!="string"||n.trim().length===0)&&a({code:"NotSupported",target:e});let r=et.promised(this.context,e,false);return this.commandAnswering(e,()=>({op:"replyToComment",comment:this.commentHandle(),text:t,author:n}),i=>{r.hydrateAddress({kind:"handle",handle:u(i,e)});}),r}onLoad(t){this.loadCommentFields(t,["resolved"]);}},z=class o extends x{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#t()}itemAt(t,e){return G.at(this.context,t,e)}promised(t,e){return G.promised(this.context,t,e)}},pt=class o extends p{static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.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(){let t=`${this.path.label}.range`,e=b.promised(this.context,t,false);return this.read(t,()=>({op:"getRevisionRange",revision:this.#t()}),n=>{e.hydrateAddress({kind:"span",span:P(n,t)});}),e}accept(){this.command("accept",()=>({op:"acceptRevision",revision:this.#t()}));}reject(){this.command("reject",()=>({op:"rejectRevision",revision:this.#t()}));}onLoad(t){let e=this.selection(t,["author","date","type"]);if(e.includes("author")&&this.loadTextInto("author",()=>({op:"getRevisionAuthor",revision:this.#t()})),e.includes("type")&&this.loadTextInto("type",()=>({op:"getRevisionType",revision:this.#t()})),!e.includes("date"))return;let n=`${this.path.label}.date`;this.read(n,()=>({op:"getRevisionDate",revision:this.#t()}),r=>{this.setLoadedProperty("date",Oe(O(r,n)));});}#t(){return this.requireAddressable(),this.path.handle()}},Q=class o extends x{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}acceptAll(){let t=this.#t;this.commandOn("acceptAll",()=>({op:"acceptAllRevisions",body:t}));}rejectAll(){let t=this.#t;this.commandOn("rejectAll",()=>({op:"rejectAllRevisions",body:t}));}listing(){return {op:"getRevisions",body:this.#t}}itemAt(t,e){return pt.at(this.context,t,e)}promised(t,e){return pt.promised(this.context,t,e)}commandOn(t,e){let n=`${this.path.label}.${t}`;this.enqueue({sort:"write",label:n,plan:e,settle:r=>{m(r,n);}});}};var _e=new Set(["matchCase","matchWholeWord","ignorePunct","ignoreSpace","matchWildcards"]);function Ht(o,t){if(o===void 0)return;typeof o!="object"&&a({code:"InvalidArgument",target:t});for(let[n,r]of Object.entries(o))_e.has(n)||a({code:"InvalidArgument",target:`${t}.${n}`}),r!==void 0&&typeof r!="boolean"&&a({code:"InvalidArgument",target:`${t}.${n}`});let e={...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(e).length===0?void 0:e}var b=class o extends p{#t;#n;#e;#o;#i;#s;static at(t,e,n){return n.kind!=="span"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.ofSpan(e,n.span),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="span"?this.path.resolveToSpan(t.span):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get text(){return this.loadedProperty("text")}get font(){return this.#i??=E.of(this.context,`${this.path.label}.font`,this.path,"span"),this.#i}get paragraphs(){return this.#o??=L.of(this.context,`${this.path.label}.paragraphs`,this.path),this.#o}get style(){return this.loadedProperty("style")}set style(t){let e=`${this.path.label}.style`,n=it(t,e);this.requireAddressable(),this.command("style",()=>({op:"setStyle",span:R(this.path,"span"),name:n}));}get hyperlink(){return this.loadedProperty("hyperlink")}set hyperlink(t){let e=`${this.path.label}.hyperlink`;(typeof t!="string"||t.length>2048)&&a({code:"InvalidArgument",target:e}),this.requireUsablePath(),this.command("hyperlink",()=>({op:"setHyperlink",span:this.#r(),target:t}));}get bookmarks(){let t=this.#r();return this.#s??=X.of(this.context,`${this.path.label}.bookmarks`,this.path,()=>({op:"getBookmarks",scope:{start:t.start,end:t.end}})),this.#s}search(t,e){let n=`${this.path.label}.search`;typeof t!="string"&&a({code:"InvalidArgument",target:n});let r=Ht(e,n),i=this.#r();return N.of(this.context,n,this.path,()=>({op:"search",scope:i,text:t,options:{...r??{},projection:this.revisionTextView()}}))}insertText(t,e){let n=`${this.path.label}.insertText`,r=k(t,n),i=Ot(e,n);this.requireUsablePath();let s=o.promised(this.context,n,false);return this.commandAnswering(n,()=>{let d=this.#r();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.#r(),text:""}));}clear(){let t=this.#r();this.commandDiscarding("clear",()=>({op:"replaceSpan",span:t,text:""}));}insertComment(t){let e=`${this.path.label}.insertComment`;(typeof t!="string"||t.length===0)&&a({code:"InvalidArgument",target:e});let n=this.internals.author;(typeof n!="string"||n.trim().length===0)&&a({code:"NotSupported",target:e});let r=G.promised(this.context,e,false);return this.commandAnswering(e,()=>({op:"insertComment",span:this.#r(),text:t,author:n}),i=>{i.kind!=="handle"&&a({code:"GeneralException",target:e}),r.hydrateAddress(i);}),r}insertContentControl(t){let e=`${this.path.label}.insertContentControl`,n=t??"RichText";n!=="RichText"&&n!=="PlainText"&&a({code:"NotSupported",target:e});let r=q.promised(this.context,e,false);return this.commandAnswering(e,()=>({op:"insertContentControl",span:this.#r(),subtype:n==="PlainText"?"plainText":"richText",returnHandle:true}),i=>{i.kind!=="handle"&&a({code:"GeneralException",target:e}),r.hydrateAddress(i);}),r}get tables(){return this.requireUsablePath(),this.#t??=U.over(this.context,`${this.path.label}.tables`,this.path,()=>R(this.path,"span"))}get fields(){return this.requireUsablePath(),this.#n??=M.of(this.context,`${this.path.label}.fields`,this.path,"span")}insertField(t,e,n,r){let i=`${this.path.label}.insertField`;(e!==void 0&&typeof e!="string"||n!==void 0&&typeof n!="string"||r!==void 0&&typeof r!="boolean")&&a({code:"InvalidArgument",target:i});let s=Ot(t,i);this.requireUsablePath();let d=H.promised(this.context,i,false);return this.commandAnswering(i,()=>({op:"insertField",span:this.#r(),location:s,...e===void 0?{}:{fieldType:e},...n===void 0?{}:{text:n},...r===void 0?{}:{removeFormatting:r}}),h=>d.hydrateAddress({kind:"handle",handle:u(h,i)})),d}get inlinePictures(){return this.requireUsablePath(),this.#e??=V.of(this.context,`${this.path.label}.inlinePictures`,this.path,"span")}insertInlinePictureFromBase64(t,e){let n=`${this.path.label}.insertInlinePictureFromBase64`;(typeof t!="string"||t.length===0)&&a({code:"InvalidArgument",target:n});let r=Ot(e,n);this.requireUsablePath();let i=F.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"insertInlinePicture",span:this.#r(),base64:t,location:r}),s=>{i.hydrateAddress({kind:"handle",handle:u(s,n)});}),i}insertBreak(t,e){let n=`${this.path.label}.insertBreak`;e!=="Before"&&e!=="After"&&a({code:"InvalidArgument",target:n});let r=e;this.requireUsablePath(),this.commandAnswering(n,()=>({op:"insertBreak",span:this.#r(),breakType:t,location:r}),i=>m(i,n));}insertTable(t,e,n,r){let i=`${this.path.label}.insertTable`;(!Number.isInteger(t)||!Number.isInteger(e)||t<1||e<1||!["Before","After"].includes(n))&&a({code:"InvalidArgument",target:i}),r!==void 0&&(!Array.isArray(r)||r.some(h=>!Array.isArray(h)||h.some(A=>typeof A!="string")))&&a({code:"InvalidArgument",target:i});let s=r?.map(h=>[...h]),d=W.promised(this.context,i);return this.commandAnswering(i,()=>({op:"insertTable",span:R(this.path,"span"),location:n,rowCount:t,columnCount:e,...s?{values:s}:{}}),h=>{h.kind!=="handle"&&a({code:"GeneralException",target:i}),d.hydrateAddress({kind:"handle",handle:h.handle});}),d}insertParagraph(t,e){let n=`${this.path.label}.insertParagraph`,r=k(t,n),i=Ot(e,n);i!=="Before"&&i!=="After"&&a({code:"InvalidArgument",target:n});let s=this.#r(),d=i==="Before"?s.start.paragraph:s.end.paragraph,h=w.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"insertParagraph",anchor:{paragraph:d},where:i==="Before"?"before":"after",text:r}),A=>{A.kind!=="handle"&&a({code:"GeneralException",target:n}),h.hydrateAddress({kind:"handle",handle:A.handle});}),h}select(t){let e=`${this.path.label}.select`,n=qt(t,e);this.requireAddressable(),this.internals.capabilities.selection||a({code:"NotSupported",target:e});let r=this.#r();this.command("select",()=>({op:"selectSpan",span:r,mode:n==="Select"?"select":n==="Start"?"start":"end"}));}onLoad(t){let e=this.selection(t,["text","style","hyperlink"]);if(e.includes("hyperlink")&&this.loadTextInto("hyperlink",()=>({op:"getHyperlink",span:this.#r()})),e.includes("text")){let r=`${this.path.label}.text`;this.read(r,()=>({op:"getSpanText",span:this.#r(),projection:this.revisionTextView()}),i=>{this.setLoadedProperty("text",O(i,r));});}if(!e.includes("style"))return;let n=`${this.path.label}.style`;this.requireUsablePath(),this.read(n,()=>({op:"getStyle",span:R(this.path,"span")}),r=>{this.setLoadedProperty("style",xt(r,n));});}#r(){return this.requireAddressable(),this.path.span()}};var ut=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get name(){return this.loadedProperty("name")}get range(){return this.#t??=this.#n(`${this.path.label}.range`),this.#t}select(t){let e=`${this.path.label}.select`,n=qt(t,e);this.requireUsablePath(),this.internals.capabilities.selection||a({code:"NotSupported",target:e}),this.command("select",()=>({op:"selectBookmark",bookmark:this.#e(),mode:n==="Select"?"select":n==="Start"?"start":"end"}));}onLoad(t){if(!this.selection(t,["name"]).includes("name"))return;let e=`${this.path.label}.name`;this.read(e,()=>({op:"getBookmarkName",bookmark:this.#e()}),n=>{this.setLoadedProperty("name",O(n,e));});}#n(t){let e=b.promised(this.context,t,false);return this.read(t,()=>({op:"getBookmarkRange",bookmark:this.#e()}),n=>{e.hydrateAddress({kind:"span",span:P(n,t)});}),e}#e(){return this.requireAddressable(),this.path.handle()}},X=class o extends x{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}listing(){return this.#t()}itemAt(t,e){return ut.at(this.context,t,e)}promised(t,e){return ut.promised(this.context,t,e)}};var I=class o extends p{#t;#n;#e;#o;#i;#s;#r;#a;#l;static main(t,e){return new o(t,c.of(e,J(t).roots().body))}static promisedStory(t,e){return new o(t,c.pending(e))}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}constructor(t,e){super(t,e);}get text(){return this.loadedProperty("text")}get paragraphs(){return this.#o??=this.paragraphsUnder(`${this.path.label}.paragraphs`),this.#o}get bookmarks(){let t=this.#d();return this.#i??=X.of(this.context,`${this.path.label}.bookmarks`,this.path,()=>({op:"getBookmarks",scope:{body:t}})),this.#i}get font(){return this.#s??=E.of(this.context,`${this.path.label}.font`,this.path,"body"),this.#s}paragraphsUnder(t){return L.of(this.context,t,this.path)}get style(){return this.loadedProperty("style")}set style(t){let e=`${this.path.label}.style`,n=it(t,e);this.requireAddressable(),this.command("style",()=>({op:"setStyle",span:R(this.path,"body"),name:n}));}get lists(){return this.#r??=lt.of(this.context,`${this.path.label}.lists`,this.path,this.#d()),this.#r}get contentControls(){return this.#a??=$.of(this.context,`${this.path.label}.contentControls`,this.path,{body:this.#d()}),this.#a}getComments(){let t=`${this.path.label}.getComments`,e=this.#d();return z.of(this.context,t,this.path,()=>({op:"getComments",scope:{body:e}}))}get revisions(){return this.#l??=Q.of(this.context,`${this.path.label}.revisions`,this.path,this.#d()),this.#l}getRange(t="Whole"){let e=`${this.path.label}.getRange`;this.requireUsablePath();let n=b.promised(this.context,e,false);return this.read(e,()=>({op:"getRange",span:{body:this.path.handle()},location:t}),r=>{n.hydrateAddress({kind:"span",span:P(r,e)});}),n}search(t,e){let n=`${this.path.label}.search`;typeof t!="string"&&a({code:"InvalidArgument",target:n});let r=Ht(e,n),i=this.#d();return N.of(this.context,n,this.path,()=>({op:"search",scope:{body:i},text:t,options:{...r??{},projection:this.revisionTextView()}}))}clear(){let t=this.#d();this.commandDiscarding("clear",()=>({op:"replaceSpan",span:{body:t},text:""}));}insertText(t,e){let n=`${this.path.label}.insertText`,r=k(t,n),i=fe(e,n);this.requireUsablePath();let s=b.promised(this.context,n,false);return this.commandAnswering(n,()=>i==="Replace"?{op:"replaceSpan",span:{body:this.#d()},text:r}:{op:"insertText",at:{body:this.#d(),at:i==="Start"?"start":"end"},text:r},d=>{s.hydrateAddress({kind:"span",span:P(d,n)});}),s}insertParagraph(t,e){let n=`${this.path.label}.insertParagraph`,r=k(t,n),i=be(e,n),s=this.#d(),d=w.promised(this.context,n,false);return this.commandAnswering(n,()=>({op:"insertParagraph",anchor:{body:s,at:i==="Start"?"first":"last"},where:i==="Start"?"before":"after",text:r}),h=>{h.kind!=="handle"&&a({code:"GeneralException",target:n}),d.hydrateAddress({kind:"handle",handle:h.handle});}),d}onLoad(t){let e=this.selection(t,["text","style"]);e.includes("text")&&this.loadTextInto("text",()=>({op:"getText",target:this.#d(),projection:this.revisionTextView()})),e.includes("style")&&this.#c();}#c(){let t=`${this.path.label}.style`;this.requireUsablePath(),this.read(t,()=>({op:"getStyle",span:R(this.path,"body")}),e=>{this.setLoadedProperty("style",xt(e,t));});}get fields(){return this.requireUsablePath(),this.#n??=M.of(this.context,`${this.path.label}.fields`,this.path,"body")}get inlinePictures(){return this.requireUsablePath(),this.#e??=V.of(this.context,`${this.path.label}.inlinePictures`,this.path,"body")}get tables(){return this.requireUsablePath(),this.#t??=U.over(this.context,`${this.path.label}.tables`,this.path,()=>({body:this.#d()}))}#d(){return this.requireAddressable(),this.path.handle()}};function tn(o){return o==="endnote"?"Endnote":"Footnote"}var mt=class o extends p{#t;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get type(){return this.loadedProperty("type")}get text(){return this.loadedProperty("text")}get body(){if(this.#t)return this.#t;let t=`${this.path.label}.body`,e=I.promisedStory(this.context,t);return this.read(t,()=>({op:"getNoteBody",note:this.#n()}),n=>{e.hydrateAddress({kind:"handle",handle:u(n,t)});}),this.#t=e,e}delete(){this.command("delete",()=>({op:"deleteNote",note:this.#n()}));}getNext(){let t=`${this.path.label}.getNext`,e=o.promised(this.context,t,false),n=this.internals.roots().document,r=`${t}.type`,i="footnote",s=c.pending(r);return this.read(r,()=>({op:"getNoteKind",note:this.#n()}),d=>{i=O(d,r)==="endnote"?"endnote":"footnote",s.resolveTo(this.#n());}),this.enqueue({sort:"read",label:t,dependencies:[s],plan:()=>({op:"getNotes",document:n,noteKind:i}),settle:d=>{let h=v(d,t),A=h.findIndex(ot=>ot.ref===this.#n().ref),K=A<0?void 0:h[A+1];K||a({code:"ItemNotFound",target:t}),e.hydrateAddress({kind:"handle",handle:K});}}),e}onLoad(t){let e=this.selection(t,["text","type"]);if(e.includes("text")&&this.loadTextInto("text",()=>({op:"getNoteText",note:this.#n(),projection:this.revisionTextView()})),e.includes("type")){let n=`${this.path.label}.type`;this.read(n,()=>({op:"getNoteKind",note:this.#n()}),r=>{this.setLoadedProperty("type",tn(O(r,n)));});}}#n(){return this.requireAddressable(),this.path.handle()}},nt=class o extends x{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#t()}itemAt(t,e){return mt.at(this.context,t,e)}promised(t,e){return mt.promised(this.context,t,e)}};var en=Object.freeze({Primary:"default",FirstPage:"first",EvenPages:"even"}),nn=["pageWidth","pageHeight","orientation","topMargin","rightMargin","bottomMargin","leftMargin"],kt=class o extends p{#t;static of(t,e,n){return new o(t,c.derived(e,n))}constructor(t,e){super(t,e);}get pageWidth(){return this.loadedProperty("pageWidth")}set pageWidth(t){this.#n("pageWidth",gt(t,`${this.path.label}.pageWidth`));}get pageHeight(){return this.loadedProperty("pageHeight")}set pageHeight(t){this.#n("pageHeight",gt(t,`${this.path.label}.pageHeight`));}get orientation(){return this.loadedProperty("orientation")}set orientation(t){let e=`${this.path.label}.orientation`;t!=="Portrait"&&t!=="Landscape"&&a({code:"InvalidArgument",target:e}),this.#n("orientation",t==="Portrait"?"portrait":"landscape");}get topMargin(){return this.loadedProperty("topMargin")}set topMargin(t){this.#n("topMargin",gt(t,`${this.path.label}.topMargin`));}get bottomMargin(){return this.loadedProperty("bottomMargin")}set bottomMargin(t){this.#n("bottomMargin",gt(t,`${this.path.label}.bottomMargin`));}get leftMargin(){return this.loadedProperty("leftMargin")}set leftMargin(t){this.#n("leftMargin",gt(t,`${this.path.label}.leftMargin`));}get rightMargin(){return this.loadedProperty("rightMargin")}set rightMargin(t){this.#n("rightMargin",gt(t,`${this.path.label}.rightMargin`));}onLoad(t){let e=this.selection(t,nn);if(e.length===0)return;let n=`${this.path.label}.pageSetup`;this.read(n,()=>({op:"getPageSetup",section:this.#e()}),r=>{let i=Gt(r,n);for(let s of e)this.setLoadedProperty(s,s==="orientation"?i.orientation==="landscape"?"Landscape":"Portrait":i[s]);});}#n(t,e){if(this.requireUsablePath(),this.#t){this.#t[t]=e;return}let n={[t]:e};this.#t=n;let r=`${this.path.label}.${t}`;this.commandAnswering(`${this.path.label}.pageSetup`,()=>({op:"setPageSetup",section:this.#e(),setup:n}),i=>{m(i,r);},()=>{this.#t===n&&(this.#t=void 0);});}#e(){this.requireAddressable();let t=this.path.address();return t.kind!=="handle"&&a({code:"InvalidObjectPath",target:this.path.label}),t.handle}},ft=class o extends p{#t;#n;static at(t,e,n){return n.kind!=="handle"&&a({code:"InvalidObjectPath",target:e}),new o(t,c.of(e,n.handle),false)}static promised(t,e,n){return new o(t,c.pending(e),n)}constructor(t,e,n){super(t,e,{nullable:n});}hydrateAddress(t){t.kind==="handle"?this.path.resolveTo(t.handle):this.path.resolveNull();}hydrateNull(){this.path.resolveNull();}get body(){return this.#n??=I.main(this.context,`${this.path.label}.body`),this.#n}get pageSetup(){return this.#t??=kt.of(this.context,`${this.path.label}.pageSetup`,this.path),this.#t}getHeader(t){return this.#e("header",t,"getHeader")}getFooter(t){return this.#e("footer",t,"getFooter")}getNext(){let t=`${this.path.label}.getNext`,e=o.promised(this.context,t,false),n=this.internals.roots().document;return this.read(t,()=>({op:"getSections",document:n}),r=>{let i=v(r,t),s=i.findIndex(h=>h.ref===this.#o().ref),d=s<0?void 0:i[s+1];d||a({code:"ItemNotFound",target:t}),e.hydrateAddress({kind:"handle",handle:d});}),e}onLoad(t){this.selection(t,[]);}#e(t,e,n){let r=`${this.path.label}.${n}`,i=en[e];i===void 0&&a({code:"InvalidArgument",target:r});let s=I.promisedStory(this.context,r);return this.read(r,()=>({op:"getFurniture",section:this.#o(),kind:t,variant:i}),d=>{s.hydrateAddress({kind:"handle",handle:u(d,r)});}),s}#o(){return this.requireAddressable(),this.path.handle()}},bt=class o extends x{#t;static of(t,e,n,r){return new o(t,c.derived(e,n),r)}constructor(t,e,n){super(t,e),this.#t=n;}getFirst(){return this.edge("first","getFirst",false)}listing(){return this.#t()}itemAt(t,e){return ft.at(this.context,t,e)}promised(t,e){return ft.promised(this.context,t,e)}};function gt(o,t){return (typeof o!="number"||!Number.isFinite(o)||o<0)&&a({code:"InvalidArgument",target:t}),o}var yt=class o extends p{#t;#n;#e;#o;#i;#s;#r;#a;static open(t){return new o(t)}constructor(t){super(t,c.of("document",J(t).roots().document));}get changeTrackingMode(){return this.loadedProperty("changeTrackingMode")}set changeTrackingMode(t){["Off","TrackAll","TrackMineOnly"].includes(t)||a({code:"InvalidArgument",target:"document.changeTrackingMode"});let e=this.internals.author;this.commandAnswering("document.changeTrackingMode",()=>({op:"setChangeTrackingMode",mode:t,...e===void 0?{}:{author:e}}),()=>this.setLoadedProperty("changeTrackingMode",t));}get body(){return this.#t??=I.main(this.context,"document.body"),this.#t}get paragraphs(){return this.#n??=this.body.paragraphsUnder("document.paragraphs"),this.#n}get sections(){let t=this.path.handle();return this.#e??=bt.of(this.context,"document.sections",this.path,()=>({op:"getSections",document:t})),this.#e}get contentControls(){return this.#s??=$.of(this.context,"document.contentControls",this.path,{body:this.internals.roots().body}),this.#s}get comments(){return this.#o??=z.of(this.context,"document.comments",this.path,()=>({op:"getComments",scope:{body:this.internals.roots().body}})),this.#o}get revisions(){return this.#i??=Q.of(this.context,"document.revisions",this.path,this.internals.roots().body),this.#i}get footnotes(){let t=this.path.handle();return this.#r??=nt.of(this.context,"document.footnotes",this.path,()=>({op:"getNotes",document:t,noteKind:"footnote"})),this.#r}get endnotes(){let t=this.path.handle();return this.#a??=nt.of(this.context,"document.endnotes",this.path,()=>({op:"getNotes",document:t,noteKind:"endnote"})),this.#a}onLoad(t){if(t.select.length===0)return;this.selection(t,["changeTrackingMode"]).includes("changeTrackingMode")&&this.loadTextInto("changeTrackingMode",()=>({op:"getChangeTrackingMode"}));}};function Mt(o){let t=o.host,e=Object.freeze({...t.capabilities,save:o.save&&t.capabilities.save}),n=typeof o.author=="string"&&o.author.trim().length>0?o.author:void 0,r=o.revisionTextView??"allMarkup";r!=="allMarkup"&&r!=="original"&&a({code:"InvalidArgument",target:"revisionTextView"});let i=false,s=null,d=g=>{i&&a({code:"RuntimeDisposed",...g===void 0?{}:{target:g}});},h=()=>{if(s)return s;d("document");let g=Re(t.execute({operations:[{op:"getDocument"}]}),"document"),Z=Re(t.execute({operations:[{op:"getBody",document:g}]}),"document.body");return s={document:g,body:Z},s},A={host:t,capabilities:e,...n===void 0?{}:{author:n},revisionTextView:r,id:{},roots:h,assertLive:d,openDocument:g=>yt.open(g)};try{h();}catch{s=null;}async function K(g,Z){d();let rt=typeof g=="function"?g:Z,Ft=typeof g=="function"?[]:Array.isArray(g)?g:[g];typeof rt!="function"&&a({code:"InvalidArgument",target:"run"});let{context:wt,adopt:y,finish:we}=At.begin(A);try{return y(Ft),await rt(wt)}finally{we();}}let ot={capabilities:e,run:K,dispose(){i||(i=true,s=null,t.dispose());}};return o.save?{...ot,async save(){d("save"),e.save||a({code:"NotSupported",target:"save"});let g=t.save();if(!g.ok)throw Nt(g.error,{target:"save"});return g.bytes}}:ot}function Re(o,t){let e=o.results[0];if(e?.status==="error")throw Nt(e.error,{target:t});if(e?.status!=="ok")throw new C({code:"GeneralException",target:t});return u(e.value,t)}function Ie(o,t={}){return Mt({host:createBrowserAutomationHost(o),save:false,...t.author===void 0?{}:{author:t.author},...t.revisionTextView===void 0?{}:{revisionTextView:t.revisionTextView}})}function ke(o){return createAutomationPaginationProvider(o)}function sn(o){if(o){for(let t of o)if(t.collaboration)return t.collaboration}}function dn(o){let t=[o?.zip?.maxEntries,o?.zip?.maxTotalBytes,o?.xml?.maxBytes,o?.xml?.maxElements,o?.maxXmlParts,o?.maxRelationships],e=o?.zip?.maxRatio;(t.some(n=>n!==void 0&&(!Number.isInteger(n)||n<0))||e!==void 0&&(!Number.isFinite(e)||e<0))&&a({code:"InvalidArgument",target:"createServer"});}async function se(o,t={}){dn(t.limits);let e=sn(t.modules),n=createServerAutomationHost(o,{...t.pagination?{pagination:ke(t.pagination)}:{},...t.limits===void 0?{}:{limits:t.limits},...e===void 0?{}:{collaborationModel:e}});if(!n.ok){let r={"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"},i=n.limit??r[n.reason];a({code:i===void 0?"InvalidArgument":"ResourceLimitExceeded",target:"createServer",...i===void 0?{}:{limit:i}});}return Mt({host:n.host,save:true,...t.author===void 0?{}:{author:t.author},...t.revisionTextView===void 0?{}:{revisionTextView:t.revisionTextView}})}function Le(o,t,e={}){return se(o,{...e,modules:[...e.modules??[],{id:"collaboration",collaboration:{session:t}}]})}var de=(l=>(l.addin="Addin",l.addressBlock="AddressBlock",l.advance="Advance",l.ask="Ask",l.author="Author",l.autoText="AutoText",l.autoTextList="AutoTextList",l.barCode="BarCode",l.bibliography="Bibliography",l.bidiOutline="BidiOutline",l.citation="Citation",l.comments="Comments",l.compare="Compare",l.createDate="CreateDate",l.data="Data",l.database="Database",l.date="Date",l.displayBarcode="DisplayBarcode",l.docProperty="DocProperty",l.docVariable="DocVariable",l.editTime="EditTime",l.embedded="Embedded",l.empty="Empty",l.eq="EQ",l.expression="Expression",l.fileName="FileName",l.fileSize="FileSize",l.fillIn="FillIn",l.formCheckbox="FormCheckbox",l.formDropdown="FormDropdown",l.formText="FormText",l.gotoButton="GotoButton",l.greetingLine="GreetingLine",l.hyperlink="Hyperlink",l.if="If",l.import="Import",l.include="Include",l.includePicture="IncludePicture",l.includeText="IncludeText",l.index="Index",l.info="Info",l.keywords="Keywords",l.lastSavedBy="LastSavedBy",l.link="Link",l.listNum="ListNum",l.macroButton="MacroButton",l.mergeBarcode="MergeBarcode",l.mergeField="MergeField",l.mergeRec="MergeRec",l.mergeSeq="MergeSeq",l.next="Next",l.nextIf="NextIf",l.noteRef="NoteRef",l.numChars="NumChars",l.numPages="NumPages",l.numWords="NumWords",l.ocx="OCX",l.others="Others",l.page="Page",l.pageRef="PageRef",l.print="Print",l.printDate="PrintDate",l.private="Private",l.quote="Quote",l.rd="RD",l.ref="Ref",l.revNum="RevNum",l.saveDate="SaveDate",l.section="Section",l.sectionPages="SectionPages",l.seq="Seq",l.set="Set",l.shape="Shape",l.skipIf="SkipIf",l.styleRef="StyleRef",l.subject="Subject",l.subscriber="Subscriber",l.symbol="Symbol",l.ta="TA",l.tc="TC",l.template="Template",l.time="Time",l.title="Title",l.toa="TOA",l.toc="TOC",l.undefined="Undefined",l.userAddress="UserAddress",l.userInitials="UserInitials",l.userName="UserName",l.xe="XE",l))(de||{});var zi=Object.freeze({createBrowser:Ie,createServer:se,createCollaborative:Le});export{Zt as Alignment,I as Body,ut as Bookmark,X as BookmarkCollection,te as BreakType,Jt as ChangeTrackingMode,B as ClientObject,Vt as ClientResult,G as Comment,z as CommentCollection,et as CommentReply,It as CommentReplyCollection,q as ContentControl,$ as ContentControlCollection,ee as ContentControlType,yt as Document,zi as DocxEditor,C as DocxEditorError,H as Field,M as FieldCollection,de as FieldType,E as Font,F as InlinePicture,V as InlinePictureCollection,Kt as InsertLocation,j as List,oe as ListBullet,lt as ListCollection,ct as ListItem,re as ListNumbering,mt as NoteItem,nt as NoteItemCollection,Yt as PageOrientation,kt as PageSetup,w as Paragraph,L as ParagraphCollection,b as Range,N as RangeCollection,At as RequestContext,pt as Revision,Q as RevisionCollection,ft as Section,bt as SectionCollection,W as Table,tt as TableCell,Pt as TableCellCollection,U as TableCollection,at as TableRow,st as TableRowCollection,Ct as TrackedObjects,ie as UnderlineType,_t as VerticalAlignment,Se as isDocxEditorError};
package/dist/index.d.mts CHANGED
@@ -59,8 +59,8 @@
59
59
  * @public
60
60
  */
61
61
  import { EditorCollaborationSession } from '@docx-editor.dev/core/collaboration';
62
- import { C as CreateServerOptions, D as DocxEditorServerRuntime, a as CreateCollaborativeOptions } from './server-Dszoi8AN.mjs';
63
- export { B as BesideLocation, b as Body, c as BodyInsertParagraphLocation, d as BodyInsertTextLocation, e as Bookmark, f as BookmarkCollection, g as ChangeTrackingMode, h as ClientObject, i as ClientResult, j as Comment, k as CommentCollection, l as CommentReply, m as CommentReplyCollection, n as ContentControl, o as ContentControlCollection, p as ContentControlLockState, q as ContentControlSubtype, r as ContentControlValue, s as Document, t as DocumentCapabilities, u as DocumentLimits, v as DocumentXmlLimits, w as DocumentZipLimits, x as DocxEditorError, y as DocxEditorErrorCode, z as DocxEditorErrorInit, A as DocxEditorRuntime, E as EditorModule, F as Font, H as HeaderFooterType, I as InsertLocation, L as List, G as ListCollection, J as ListItem, K as LoadOption, M as LoadQueryOptions, N as NoteItem, O as NoteItemCollection, P as NoteItemType, Q as PageOrientation, R as PageSetup, S as Paragraph, T as ParagraphAlignment, U as ParagraphCollection, V as ParagraphInsertTextLocation, W as Range, X as RangeCollection, Y as RangeInsertTextLocation, Z as RequestContext, _ as Revision, $ as RevisionCollection, a0 as RevisionTextView, a1 as RevisionType, a2 as RunCallback, a3 as SearchOptions, a4 as Section, a5 as SectionCollection, a6 as SelectionMode, a7 as TrackedObjects, a8 as isDocxEditorError } from './server-Dszoi8AN.mjs';
62
+ import { C as CreateServerOptions, D as DocxEditorServerRuntime, a as CreateCollaborativeOptions } from './server-wsxDd90b.mjs';
63
+ export { A as Alignment, B as BesideLocation, b as Body, c as BodyInsertParagraphLocation, d as BodyInsertTextLocation, e as Bookmark, f as BookmarkCollection, g as BreakType, h as ChangeTrackingMode, i as ClientObject, j as ClientResult, k as Comment, l as CommentCollection, m as CommentReply, n as CommentReplyCollection, o as ContentControl, p as ContentControlCollection, q as ContentControlLockState, r as ContentControlSubtype, s as ContentControlType, t as ContentControlValue, u as Document, v as DocumentCapabilities, w as DocumentLimits, x as DocumentXmlLimits, y as DocumentZipLimits, z as DocxEditorError, E as DocxEditorErrorCode, F as DocxEditorErrorInit, G as DocxEditorRuntime, H as EditorModule, I as Field, J as FieldCollection, K as FieldType, L as FieldTypeLiteral, M as Font, N as HeaderFooterType, O as InlinePicture, P as InlinePictureCollection, Q as InsertLocation, R as List, S as ListBullet, T as ListCollection, U as ListItem, V as ListNumbering, W as LoadOption, X as LoadQueryOptions, Y as NoteItem, Z as NoteItemCollection, _ as NoteItemType, $ as PageOrientation, a0 as PageSetup, a1 as Paragraph, a2 as ParagraphAlignment, a3 as ParagraphCollection, a4 as ParagraphInsertTextLocation, a5 as Range, a6 as RangeCollection, a7 as RangeInsertTextLocation, a8 as RequestContext, a9 as Revision, aa as RevisionCollection, ab as RevisionTextView, ac as RevisionType, ad as RunCallback, ae as SearchOptions, af as Section, ag as SectionCollection, ah as SelectionMode, ai as ServerPaginationOptions, aj as Table, ak as TableCell, al as TableCellCollection, am as TableCollection, an as TableRow, ao as TableRowCollection, ap as TrackedObjects, aq as UnderlineType, ar as VerticalAlignment, as as isDocxEditorError } from './server-wsxDd90b.mjs';
64
64
  import '@docx-editor.dev/core/automation';
65
65
 
66
66
  /**
package/dist/index.d.ts CHANGED
@@ -59,8 +59,8 @@
59
59
  * @public
60
60
  */
61
61
  import { EditorCollaborationSession } from '@docx-editor.dev/core/collaboration';
62
- import { C as CreateServerOptions, D as DocxEditorServerRuntime, a as CreateCollaborativeOptions } from './server-Dszoi8AN.js';
63
- export { B as BesideLocation, b as Body, c as BodyInsertParagraphLocation, d as BodyInsertTextLocation, e as Bookmark, f as BookmarkCollection, g as ChangeTrackingMode, h as ClientObject, i as ClientResult, j as Comment, k as CommentCollection, l as CommentReply, m as CommentReplyCollection, n as ContentControl, o as ContentControlCollection, p as ContentControlLockState, q as ContentControlSubtype, r as ContentControlValue, s as Document, t as DocumentCapabilities, u as DocumentLimits, v as DocumentXmlLimits, w as DocumentZipLimits, x as DocxEditorError, y as DocxEditorErrorCode, z as DocxEditorErrorInit, A as DocxEditorRuntime, E as EditorModule, F as Font, H as HeaderFooterType, I as InsertLocation, L as List, G as ListCollection, J as ListItem, K as LoadOption, M as LoadQueryOptions, N as NoteItem, O as NoteItemCollection, P as NoteItemType, Q as PageOrientation, R as PageSetup, S as Paragraph, T as ParagraphAlignment, U as ParagraphCollection, V as ParagraphInsertTextLocation, W as Range, X as RangeCollection, Y as RangeInsertTextLocation, Z as RequestContext, _ as Revision, $ as RevisionCollection, a0 as RevisionTextView, a1 as RevisionType, a2 as RunCallback, a3 as SearchOptions, a4 as Section, a5 as SectionCollection, a6 as SelectionMode, a7 as TrackedObjects, a8 as isDocxEditorError } from './server-Dszoi8AN.js';
62
+ import { C as CreateServerOptions, D as DocxEditorServerRuntime, a as CreateCollaborativeOptions } from './server-wsxDd90b.js';
63
+ export { A as Alignment, B as BesideLocation, b as Body, c as BodyInsertParagraphLocation, d as BodyInsertTextLocation, e as Bookmark, f as BookmarkCollection, g as BreakType, h as ChangeTrackingMode, i as ClientObject, j as ClientResult, k as Comment, l as CommentCollection, m as CommentReply, n as CommentReplyCollection, o as ContentControl, p as ContentControlCollection, q as ContentControlLockState, r as ContentControlSubtype, s as ContentControlType, t as ContentControlValue, u as Document, v as DocumentCapabilities, w as DocumentLimits, x as DocumentXmlLimits, y as DocumentZipLimits, z as DocxEditorError, E as DocxEditorErrorCode, F as DocxEditorErrorInit, G as DocxEditorRuntime, H as EditorModule, I as Field, J as FieldCollection, K as FieldType, L as FieldTypeLiteral, M as Font, N as HeaderFooterType, O as InlinePicture, P as InlinePictureCollection, Q as InsertLocation, R as List, S as ListBullet, T as ListCollection, U as ListItem, V as ListNumbering, W as LoadOption, X as LoadQueryOptions, Y as NoteItem, Z as NoteItemCollection, _ as NoteItemType, $ as PageOrientation, a0 as PageSetup, a1 as Paragraph, a2 as ParagraphAlignment, a3 as ParagraphCollection, a4 as ParagraphInsertTextLocation, a5 as Range, a6 as RangeCollection, a7 as RangeInsertTextLocation, a8 as RequestContext, a9 as Revision, aa as RevisionCollection, ab as RevisionTextView, ac as RevisionType, ad as RunCallback, ae as SearchOptions, af as Section, ag as SectionCollection, ah as SelectionMode, ai as ServerPaginationOptions, aj as Table, ak as TableCell, al as TableCellCollection, am as TableCollection, an as TableRow, ao as TableRowCollection, ap as TrackedObjects, aq as UnderlineType, ar as VerticalAlignment, as as isDocxEditorError } from './server-wsxDd90b.js';
64
64
  import '@docx-editor.dev/core/automation';
65
65
 
66
66
  /**