@betteroffice/pptx 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-O2XFH626.js';var re=3e3;var S=["#B3261E","#7B1FA2","#3949AB","#00796B","#2E7D32","#A84400","#C2185B","#00695C"],X=/^#[0-9a-fA-F]+$/;function G(e){return S[Math.abs(e)%S.length]}function E(e,t){return typeof t=="string"&&(t.length===4||t.length===7)&&X.test(t)?t:G(e)}function se(e,t){if(t&&(typeof t.name!="string"||t.name.trim().length===0))throw new TypeError("Collaboration user name must be a non-empty string");if(t?.color!==void 0&&typeof t.color!="string")throw new TypeError("Collaboration user color must be a string");let n=t?.name.trim().slice(0,1024)||`Guest ${e.toString(36).toUpperCase()}`,r=E(e,t?.color);return {name:n,color:r}}function D(e){return e.slideId.length<=1024&&(e.shapeId===void 0||e.shapeId.length<=1024)}function oe(e,t){if(typeof e!="object"||e===null)return false;let n=e;return typeof n.slideId=="string"&&n.slideId.length>0&&(n.shapeId===void 0||typeof n.shapeId=="string"&&n.shapeId.length>0)&&D(n)&&new TextEncoder().encode(n.slideId+(n.shapeId??"")).byteLength<=t}function Y(e,t){return e?.slideId===t?.slideId&&e?.shapeId===t?.shapeId}var _=class{constructor(t,n={}){a(this,"localClientId",t);a(this,"states",new Map);a(this,"clocks",new Map);a(this,"maxTrackedIds");if(this.maxTrackedIds=n.maxTrackedIds??4096,!Number.isSafeInteger(this.maxTrackedIds)||this.maxTrackedIds<1)throw new RangeError("Presence tracked id limit must be a positive integer")}get peers(){return [...this.states.values()].sort((t,n)=>t.state.clientId-n.state.clientId).map($)}get trackedIdCount(){return this.clocks.size}get nextExpiryAt(){let t;for(let n of this.states.values()){let r=n.lastSeen+45e3;t=t===void 0?r:Math.min(t,r);}for(let n of this.clocks.values()){let r=n.updatedAt+3e5;t=t===void 0?r:Math.min(t,r);}return t}apply(t,n){let r=this.expire(n);for(let s of t){if(s.clientId===this.localClientId)continue;let o=this.clocks.get(s.clientId);if(o&&s.clock<=o.clock)continue;if(!o&&this.clocks.size>=this.maxTrackedIds&&(r=this.evictOldest()||r),this.clocks.delete(s.clientId),this.clocks.set(s.clientId,{clock:s.clock,updatedAt:n}),!s.state){r=this.states.delete(s.clientId)||r;continue}let a=this.states.get(s.clientId),c=a&&Y(a.state.cursor,s.state.cursor)?a.cursorMovedAt:n;this.states.set(s.clientId,{state:x(s.state),lastSeen:n,cursorMovedAt:c}),r=true;}return r}expire(t,n=45e3){let r=false;for(let[s,o]of this.states)t-o.lastSeen<n||(this.states.delete(s),r=true);for(let[s,o]of this.clocks)t-o.updatedAt<3e5||(this.clocks.delete(s),r=this.states.delete(s)||r);return r}clear(){let t=this.states.size>0;return this.states.clear(),this.clocks.clear(),t}evictOldest(){let t=this.clocks.keys().next();return t.done?false:(this.clocks.delete(t.value),this.states.delete(t.value))}};function x(e){return {clientId:e.clientId,clock:e.clock,user:{...e.user},cursor:e.cursor?{...e.cursor}:null}}function $(e){return {state:x(e.state),lastSeen:e.lastSeen,cursorMovedAt:e.cursorMovedAt}}var l=16777216,b=4096,C=0,N=1,j=2,T=3,R=0,k=1,O=2,H=0,K=Number.MAX_SAFE_INTEGER,W=10,m=new TextEncoder().encode("\0betteroffice-document-fingerprint-v1\0"),i=class extends Error{constructor(t){super(t),this.name="ProtocolError";}},A=class{constructor(t){a(this,"bytes",t);a(this,"offset",0);}get done(){return this.offset===this.bytes.byteLength}readVarUint(){let t=0,n=1,r=0;for(;;){if(this.offset>=this.bytes.byteLength)throw new i("Truncated varUint");let s=this.bytes[this.offset++],o=s&127;if(o>Math.floor((K-t)/n))throw new i("varUint exceeds Number.MAX_SAFE_INTEGER");if(t+=o*n,r+=1,(s&128)===0){if(r>1&&o===0)throw new i("Non-canonical varUint");return t}if(r>=8)throw new i("varUint exceeds Number.MAX_SAFE_INTEGER");n*=128;}}readVarUint8Array(){let t=this.readVarUint(),n=this.bytes.byteLength-this.offset;if(t>n)throw new i("Truncated varUint8Array");let r=this.bytes.slice(this.offset,this.offset+t);return this.offset+=t,r}readVarString(){let t=this.readVarUint8Array();try{return new TextDecoder("utf-8",{fatal:!0}).decode(t)}catch(n){throw new i(`Invalid UTF-8 string${n instanceof Error?`: ${n.message}`:""}`)}}};function u(e){if(!Number.isSafeInteger(e)||e<0)throw new i("varUint value must be a non-negative safe integer");let t=[],n=e;for(;n>=128;)t.push(n%128|128),n=Math.floor(n/128);return t.push(n),Uint8Array.from(t)}function z(e){let t=new TextEncoder().encode(e);return f([u(t.byteLength),t],l)}function f(e,t){let n=0;for(let o of e)if(n+=o.byteLength,n>t)throw new i(`Frame exceeds ${t} bytes`);let r=new Uint8Array(n),s=0;for(let o of e)r.set(o,s),s+=o.byteLength;return r}function P(e,t,n){return f([u(C),u(e),u(t.byteLength),t],n)}function pe(e,t=l){return P(R,e,t)}function fe(e,t=l){return P(k,e,t)}function le(e,t=l){return P(O,e,t)}function ye(e,t=l){if(e.length>b)throw new i(`Awareness update exceeds ${b} entries`);let n=[u(e.length)];for(let s of e){F(s);let o=JSON.stringify(s.state);if(o===void 0)throw new i("Awareness state is not JSON serializable");n.push(u(s.clientId),u(s.clock),z(o));}let r=f(n,t);return f([u(N),u(r.byteLength),r],t)}function he(e=l){return f([u(T)],e)}function be(e,t=b){if(!(e instanceof Uint8Array))throw new i("Awareness update must be a Uint8Array");if(!Number.isSafeInteger(t)||t<1)throw new i("Awareness entry limit must be a positive integer");let n=new A(e),r=n.readVarUint();if(r>t)throw new i(`Awareness update exceeds ${t} entries`);let s=[];for(let o=0;o<r;o+=1){let a=n.readVarUint(),c=n.readVarUint(),d;try{d=JSON.parse(n.readVarString());}catch(h){throw h instanceof i?h:new i(`Invalid awareness JSON${h instanceof Error?`: ${h.message}`:""}`)}let y={clientId:a,clock:c,state:B(d,a,c)};F(y),s.push(y);}if(!n.done)throw new i("Awareness update has trailing bytes");return s}function M(e){let t=m.byteLength+32,n=e.byteLength-t;if(n<0)return e;for(let r=0;r<m.byteLength;r+=1)if(e[n+r]!==m[r])return e;return e.subarray(0,n)}var L=Number.MAX_SAFE_INTEGER-1,v=BigInt(L),J=65536;function V(e){let t=0,n=()=>{let a=0n;for(let c=0;c<W&&t<e.byteLength;c+=1){let d=e[t++];if(a|=BigInt(d&127)<<BigInt(7*c),d<128)return a}},r=n();if(r===void 0)return;let s=t,o=[];for(let a=r;a>0n;a-=1n){let c=t,d=n(),y=n();if(d===void 0||y===void 0)return;o.push({client:d,clock:y,start:c,end:t});}return t===e.byteLength?{header:s,entries:o}:void 0}function Ae(e){let t=M(e),n=V(t);if(!n)return e;let{header:r,entries:s}=n;if(!(s.length>=J||s.some(({client:o})=>o===v)))return f([u(s.length+1),t.subarray(r),u(L),u(0),e.subarray(t.byteLength)],Number.MAX_SAFE_INTEGER)}function Ee(e){let t=M(e),n=V(t);if(!n)return {stateVector:e,open:false};let r=n.entries.filter(({client:s,clock:o})=>s!==v||o!==0n);return r.length===n.entries.length?{stateVector:e,open:false}:{stateVector:f([u(r.length),...r.map(({start:s,end:o})=>t.subarray(s,o)),e.subarray(t.byteLength)],Number.MAX_SAFE_INTEGER),open:true}}function me(e,t=l,n=b){if(!(e instanceof Uint8Array))throw new i("Frame must be a Uint8Array");if(e.byteLength===0)throw new i("Frame is empty");if(e.byteLength>t)throw new i(`Frame exceeds ${t} bytes`);if(!Number.isSafeInteger(n)||n<1)throw new i("Message limit must be a positive integer");let r=new A(e),s=[];for(;!r.done;){if(s.length>=n)throw new i(`Frame exceeds ${n} messages`);let o=r.readVarUint();switch(o){case C:{let a=r.readVarUint(),c=r.readVarUint8Array();if(a===R)s.push({type:"sync-step-1",stateVector:c});else if(a===k)s.push({type:"sync-step-2",update:c});else if(a===O)s.push({type:"update",update:c});else throw new i(`Unknown sync message type ${a}`);break}case N:s.push({type:"awareness",update:r.readVarUint8Array()});break;case j:{let a=r.readVarUint();if(a!==H)throw new i(`Unknown auth message type ${a}`);s.push({type:"auth",reason:r.readVarString()});break}case T:s.push({type:"query-awareness"});break;default:throw new i(`Unknown top-level message type ${o}`)}}return s}function B(e,t,n){if(e===null)return null;if(!w(e))throw new i("Awareness state must be an object or null");if(e.clientId!==t||e.clock!==n)throw new i("Awareness state identity does not match its entry");if(!w(e.user))throw new i("Awareness user must be an object");let r=g(e.user.name,"Awareness user name"),s=E(t,e.user.color);return {clientId:t,clock:n,user:{name:r,color:s},cursor:Q(e.cursor)}}function Q(e){if(e==null)return null;if(!w(e))throw new i("Awareness cursor must be an object or null");let t=g(e.slideId,"Awareness slideId"),n=e.shapeId===void 0?void 0:g(e.shapeId,"Awareness shapeId");return n?{slideId:t,shapeId:n}:{slideId:t}}function F(e){U(e.clientId,"Awareness clientId"),U(e.clock,"Awareness clock"),e.state!==null&&B(e.state,e.clientId,e.clock);}function U(e,t){if(!Number.isSafeInteger(e)||e<0)throw new i(`${t} must be a non-negative safe integer`)}function g(e,t){if(typeof e!="string"||e.length===0||e.length>1024)throw new i(`${t} must be between 1 and ${1024} characters`);return e}function w(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Pe(e){let t=[];for(let n of e)n.op==="event"&&n.event.type==="message"&&t.push(n.event.data);return t}function Se(e){return e.buffer instanceof ArrayBuffer&&e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.slice().buffer}var Z=new Set(["backpressure","protocol","replica","transport"]);var ee=e=>Number.isSafeInteger(e)&&e>=0;function te(e){let t=e;return typeof t=="object"&&t!==null&&Z.has(t.code)&&typeof t.message=="string"}function ne(e,t){if(typeof e!="object"||e===null)return false;let n=e;switch(n.type){case "open":return true;case "message":return n.data instanceof ArrayBuffer&&n.data.byteLength<=t;case "close":return n.reason===void 0||typeof n.reason=="string";default:return false}}function _e(e,t,n){if(typeof e!="object"||e===null)return false;let{provider:r,ops:s}=e;return !Number.isSafeInteger(r)||r<0||!Array.isArray(s)||s.length===0?false:s.every(o=>{if(typeof o!="object"||o===null)return false;let a=o;if(!ee(a.seq))return false;switch(a.op){case "create":return typeof a.options=="object"&&a.options!==null&&Object.keys(a.options).every(c=>n.optionKeys.has(c));case "connect":case "disconnect":case "destroy":return true;case "fail":return te(a.error);case "cursor":return typeof a.broadcast=="boolean"&&(a.cursor===null||n.validCursor(a.cursor,t));case "event":return ne(a.event,t);default:return false}})}function xe(){let e=globalThis.performance;return typeof e?.now!="function"?0:typeof e.timeOrigin=="number"?e.timeOrigin:Date.now()-e.now()}export{re as a,G as b,se as c,D as d,oe as e,Y as f,_ as g,l as h,b as i,pe as j,fe as k,le as l,ye as m,he as n,be as o,M as p,L as q,Ae as r,Ee as s,me as t,Pe as u,Se as v,_e as w,xe as x};
@@ -0,0 +1 @@
1
+ import'./chunk-O2XFH626.js';function R(t,c,p,g){for(let i of C(c)){let h=i.width===void 0||g!==0?0:t.measureText(i.fitText??i.text)?.width,a=h&&h>0?(i.width??0)/h:1;(Math.abs(a-1)<.001||a<.75||a>1.33)&&(a=1),a===1?t.fillText(i.text,i.x,p):(t.save(),t.translate(i.x,p),t.scale(a,1),t.fillText(i.text,0,0),t.restore());}}function C(t){if(t.glyphs.length===0)return [{text:t.text,x:t.x}];let c=t.glyphs.find(e=>e.cluster!==t.glyphs[0].cluster);if(c&&c.x<t.glyphs[0].x){let e=t.text.split(" "),s=[],n=-1;for(let f of e)n+=f.length+1,s.push(n);let u=e.map(()=>1/0);for(let f of t.glyphs){let l=f.cluster-t.start,o=0,r=s.length-1;for(;o<r;){let d=o+r>>1;s[d]<l?o=d+1:r=d;}l>=0&&l<s[o]&&(u[o]=Math.min(u[o],f.x));}return e.flatMap((f,l)=>f.length>0&&u[l]<1/0?[{text:f,x:u[l]}]:[])}let p=[],g=e=>/^[\p{M}\u200c\u200d]/u.test(t.text.slice(e))||t.text[e-1]==="\u200D",i=(e,s)=>/\s/u.test(t.text[e-1])||w(t.text.codePointAt(e))||w(P(t.text,e))||s&&/\s/u.test(t.text[e]),h=e=>{let s=t.glyphs[e-1],n=s?Math.fround(Math.fround(s.x)+Math.fround(s.advance)):t.x;return Math.abs(t.glyphs[e].x-n)>1e-4},y=!(!t.letterSpacingPx&&t.glyphs.some((e,s)=>{let n=e.cluster-t.start;return n>0&&n<t.text.length&&h(s)&&!g(n)&&!i(n,true)}))&&!M.test(t.text)&&t.glyphs.every((e,s)=>s===0||e.cluster>=t.glyphs[s-1].cluster),b=0,x=y&&t.glyphs[0].cluster===t.start?t.glyphs[0].x:t.x,k=0,v=(e,s,n)=>{let u=t.text.slice(b,e),f={text:u,x};if(y&&!u.includes(" ")){let l=u.trimEnd(),o=n-x,r=0,d=x;for(let T=k;T<s;T++){let m=t.glyphs[T];if(m.cluster-t.start>=b+l.length){o=m.x-x,f.fitText=l;break}r+=m.advance,d=Math.max(d,m.x);}f.width=Number.isFinite(o)&&o>0&&o>=d-x?o:r;}p.push(f);};for(let[e,s]of t.glyphs.entries()){let n=s.cluster-t.start;n>b&&n<t.text.length&&(y?!g(n)&&i(n,h(e)):h(e))&&(v(n,e,s.x),b=n,k=e,x=s.x);}return v(t.text.length,t.glyphs.length,t.x+t.width),p}var M=/[\u0590-\u08ff\ufb1d-\ufdff\ufe70-\ufefc]/u;function P(t,c){return t.codePointAt(c-(/[\ud800-\udbff][\udc00-\udfff]$/.test(t.slice(0,c))?2:1))}function w(t){return /[\u3000-\u3098\u309b-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef\u{20000}-\u{2ffff}]/u.test(String.fromCodePoint(t??0))}export{R as paintTextChunks};
@@ -1 +1 @@
1
- import {a,L,N,J,O,b,W,F,E,R,B,s,g,h,i,Y,Q,C,D,S,U,m,V as V$1,e}from'./chunk-4FWJR3UX.js';function fe(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(t.length<10)return;let r=0,i=0;if(t.length>=24&&e.getUint32(0)===2303741511&&e.getUint32(4)===218765834&&e.getUint32(12)===1229472850)r=e.getUint32(16),i=e.getUint32(20);else if(e.getUint32(0)===1195984440&&[55,57].includes(t[4])&&t[5]===97)r=e.getUint16(6,true),i=e.getUint16(8,true);else if(t.length>=26&&e.getUint16(0,true)===19778)e.getUint32(14,true)===12?(r=e.getUint16(18,true),i=e.getUint16(20,true)):(r=e.getInt32(18,true),i=Math.abs(e.getInt32(22,true)));else if(t.length>=20&&e.getUint32(0)===1380533830&&e.getUint32(8)===1464156752){let s=e.getUint32(12);if(s===1448097880&&t.length>=30)r=1+t[24]+(t[25]<<8)+(t[26]<<16),i=1+t[27]+(t[28]<<8)+(t[29]<<16);else if(s===1448097868&&t.length>=25&&t[20]===47){let n=e.getUint32(21,true);r=1+(n&16383),i=1+(n>>>14&16383);}else s===1448097824&&t.length>=30&&t[23]===157&&t[24]===1&&t[25]===42&&(r=e.getUint16(26,true)&16383,i=e.getUint16(28,true)&16383);}else if(e.getUint16(0)===65496){let s=false;for(let n=2;n+4<=t.length;){if(t[n++]!==255)return;for(;t[n]===255;)n+=1;let o=t[n++];if(o===217||o===218)break;if(o===1||o>=208&&o<=216)continue;if(n+2>t.length)return;let l=e.getUint16(n);if(l<2||n+l>t.length)return;o===225&&(s=s||Se(t.subarray(n+2,n+l))),o>=192&&o<=207&&![196,200,204].includes(o)&&l>=7&&(i=e.getUint16(n+3),r=e.getUint16(n+5)),n+=l;}s&&([r,i]=[i,r]);}return r>0&&i>0?{width:r,height:i}:void 0}function Se(t){if(t.length<14||![69,120,105,102,0,0].every((n,o)=>t[o]===n))return false;let e=new DataView(t.buffer,t.byteOffset+6,t.byteLength-6),r=e.getUint16(0)===18761;if(!r&&e.getUint16(0)!==19789||e.getUint16(2,r)!==42)return false;let i=e.getUint32(4,r);if(i>e.byteLength-2)return false;let s=e.getUint16(i,r);for(let n=0;n<s;n+=1){let o=i+2+n*12;if(o>e.byteLength-12)return false;if(e.getUint16(o,r)===274&&e.getUint16(o+2,r)===3&&e.getUint32(o+4,r)===1)return [5,6,7,8].includes(e.getUint16(o+8,r))}return false}var ke=33554432,ue="image/svg+xml",be=4194304,Ue=4096,pe=new WeakMap;function Ne(t){return pe.get(t)??{x:1,y:1}}function We(t,e){pe.set(t,e);}function Ae(t){if(a(t))throw new Error("TIFF images require worker conversion");let e=Ce(t)??Be(t);return e?new Blob([e],{type:"image/bmp"}):Me(t)??new Blob([t.slice()])}function Ie(t){return t.type===ue}async function Ke(t,e,r={}){let i=Ae(t);return Oe(i,e,r)}async function Oe(t,e,r={}){let i=r.maxDimension??Ue;if(!Number.isSafeInteger(i)||i<1)throw new Error("invalid image dimension limit");if(typeof createImageBitmap=="function"&&!Ie(t)){let n=fe(new Uint8Array(await t.arrayBuffer()));if(n&&Math.max(n.width,n.height)>i){let l=i/Math.max(n.width,n.height),u=await createImageBitmap(t,{resizeWidth:Math.max(1,Math.floor(n.width*l)),resizeHeight:Math.max(1,Math.floor(n.height*l))});return K(u,n,i)}let o=await createImageBitmap(t);return K(o,{width:o.width,height:o.height},i)}let s=URL.createObjectURL(t);try{let n=await new Promise((o,l)=>{let u=new Image;u.onload=()=>o(u),u.onerror=()=>l(new Error(e)),u.src=s;});return await K(n,{width:n.naturalWidth,height:n.naturalHeight},i)}finally{URL.revokeObjectURL(s);}}async function K(t,e,r){let i="naturalWidth"in t?t.naturalWidth:t.width,s="naturalHeight"in t?t.naturalHeight:t.height,n=t;if(Math.max(i,s)>r){let u=r/Math.max(i,s),f={width:Math.max(1,Math.floor(i*u)),height:Math.max(1,Math.floor(s*u))},d,m;try{typeof OffscreenCanvas=="function"&&(d=new OffscreenCanvas(f.width,f.height),m=d.getContext("2d"));}catch{d=void 0;}if(!m&&typeof document<"u")try{d=document.createElement("canvas"),d.width=f.width,d.height=f.height,m=d.getContext("2d");}catch{d=void 0;}if(d&&m){m.drawImage(t,0,0,f.width,f.height),"close"in t&&typeof t.close=="function"&&t.close();try{n=typeof createImageBitmap=="function"?await createImageBitmap(d):d;}catch{n=d;}}}let o="naturalWidth"in n?n.naturalWidth:n.width,l="naturalHeight"in n?n.naturalHeight:n.height;return (e.width!==o||e.height!==l)&&We(n,{x:e.width/o,y:e.height/l}),n}function Me(t){if(t.byteLength>be)return;let e;try{e=new TextDecoder("utf-8",{fatal:!0}).decode(t).replace(/^\ufeff/,"");}catch{return}if(!(!/^\s*</.test(e)||!e.slice(0,1024).includes("<svg")))return new Blob([Fe(e)],{type:ue})}function Fe(t){let e=Te(t);if(!e||/\s(?:width|height)\s*=/.test(t.slice(e.start,e.end)))return t;let r=t.slice(e.start,e.end).match(/\sviewBox\s*=\s*(["'])\s*[-+.\deE]+[\s,]+[-+.\deE]+[\s,]+([-+.\deE]+)[\s,]+([-+.\deE]+)\s*\1/),[i,s]=[Number(r?.[2]),Number(r?.[3])];if(!(i>0)||!(s>0))return t;let n=e.start+4;return `${t.slice(0,n)} width="${i}" height="${s}"${t.slice(n)}`}function Te(t){let e=0;for(;e<t.length;){if(/\s/.test(t[e]))e+=1;else if(t.startsWith("<!--",e))e=j(t.indexOf("-->",e+4),3);else if(t.startsWith("<?",e))e=j(t.indexOf("?>",e+2),2);else if(t.startsWith("<!",e))e=j(le(t,e+2),1);else break;if(e<0)return}if(!/^<svg[\s/>]/.test(t.slice(e,e+5)))return;let r=le(t,e+4);return r<0?void 0:{start:e,end:r}}function j(t,e){return t<0?-1:t+e}function le(t,e){let r="",i=false;for(let s=e;s<t.length;s+=1){let n=t[s];if(r)n===r&&(r="");else if(i&&t.startsWith("<!--",s)){if(s=j(t.indexOf("-->",s+4),2),s<0)return -1}else if(i&&t.startsWith("<?",s)){if(s=j(t.indexOf("?>",s+2),1),s<0)return -1}else if(n==='"'||n==="'")r=n;else if(n==="[")i=true;else if(n==="]")i=false;else if(n===">"&&!i)return s}return -1}function Be(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(e.byteLength<108||e.getUint32(0,true)!==1||e.getUint32(40,true)!==1179469088)return;let r=e.getUint32(4,true);if(r<88||r%4||r>e.byteLength-8)return;let i=e.getInt32(16,true)-e.getInt32(8,true)+1,s=e.getInt32(20,true)-e.getInt32(12,true)+1,n=e.getUint32(r+4,true);if(e.getUint32(r,true)!==81||n<80||n>e.byteLength-r-8)return;let o=m=>e.getInt32(r+m,true),l=e.getUint32(r+48,true),u=e.getUint32(r+56,true),f=e.getUint32(r+60,true);if(o(24)!==e.getInt32(8,true)||o(28)!==e.getInt32(12,true)||o(72)!==i||o(76)!==s||o(32)!==0||o(36)!==0||o(40)!==i||o(44)!==s||e.getUint32(r+64,true)!==0||e.getUint32(r+68,true)!==13369376||l<80||l+e.getUint32(r+52,true)!==u||u+f!==n)return;let d=r+n;if(!(e.getUint32(d,true)!==14||e.getUint32(d+4,true)!==e.byteLength-d))return me(t.subarray(r+l,d),i,s)}function Ce(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(e.byteLength<18)return;let r=e.getUint32(0,true)===2596720087?22:0;if(e.byteLength<r+18||![1,2].includes(e.getUint16(r,true))||e.getUint16(r+2,true)!==9||e.getUint16(r+4,true)!==768||e.getUint32(r+6,true)*2!==e.byteLength-r)return;let i=0,s=0,n=0,o=0,l=false,u;for(let f=r+18;f+6<=e.byteLength;){let d=e.getUint32(f,true)*2,m=e.getUint16(f+4,true);if(d<6||d>e.byteLength-f)return;if(m===0)return d===6&&f+d===e.byteLength?u:void 0;if(u)return;if(m===259){if(d<8||e.getUint16(f+6,true)!==8)return;l=true;}else if(m===263){if(d<8||![1,2,3,4].includes(e.getUint16(f+6,true)))return}else if(m===523||m===524){if(d!==10)return;let E=e.getInt16(f+6,true),U=e.getInt16(f+8,true);if(m===523)i=U,s=E;else {if(!l)return;n=U,o=E;}}else if(m===2881){if(d<66||e.getUint32(f+6,true)!==13369376||e.getInt16(f+14,true)!==0||e.getInt16(f+16,true)!==0||e.getInt16(f+18,true)!==o||e.getInt16(f+20,true)!==n||e.getInt16(f+22,true)!==s||e.getInt16(f+24,true)!==i||!n||!o||(u=me(t.subarray(f+26,f+d),e.getInt16(f+12,true),e.getInt16(f+10,true)),!u))return}else return;f+=d;}}function me(t,e,r){if(t.length<40)return;let i=new DataView(t.buffer,t.byteOffset,t.byteLength),s=i.getInt32(4,true),n=i.getInt32(8,true),o=i.getUint16(14,true);if(i.getUint32(0,true)!==40||s<1||!n||s*Math.abs(n)>ke||e!==s||r!==Math.abs(n)||i.getUint16(12,true)!==1||![24,32].includes(o)||i.getUint32(16,true)!==0||i.getUint32(32,true)!==0)return;let l=Math.ceil(s*o/32)*4*Math.abs(n),u=i.getUint32(20,true);if(40+l!==t.length||u!==0&&u!==l)return;let f=new Uint8Array(14+t.length),d=new DataView(f.buffer);return d.setUint16(0,19778,true),d.setUint32(2,f.length,true),d.setUint32(10,54,true),f.set(t,14),f}var Le=6e4;function ge(t){try{t.post({protocol:1,kind:"wasm-compile"});}catch(e){try{t.close();}catch{}throw e}}function V(t,e){let r=new Map,i=new Map,s=new Set,n=new Set(Object.keys(e.methods)),o=e.now??Date.now,l=e.timer??((a,h)=>{let w=setTimeout(a,h);return ()=>clearTimeout(w)}),u=e.silenceMs??Le,f=1,d,m,E,U=()=>{},k=()=>{};function x(){m?.(),m=void 0;}function P(a,h,w=false){for(let W of [...a])if(!(!a.has(W)||w&&d))try{W(h);}catch{}}function b(a,h=true){if(!d){d=a,x(),U(),k();for(let w of r.values())w.reject(a);if(r.clear(),i.clear(),h){try{t.close();}catch{}P(s,a);}s.clear();}}function y(){if(x(),r.size===0||d)return;let a=o();m=l(()=>b(new N("silence",`Session received no message within ${u}ms`,`Waiting for ${r.size} call(s); silent for ${o()-a}ms`)),u);}function v(a,h,w=[]){if(d)return Promise.reject(d);if(!n.has(a))return Promise.reject(new Error(`Unknown session method: ${a}`));let W=f++;return new Promise((F,g)=>{let c=r.size===0;r.set(W,{resolve:F,reject:g}),c&&y();try{t.post({protocol:1,kind:"call",id:W,method:a,args:h},w);}catch(p){r.delete(W),r.size===0&&x(),g(p instanceof Error?p:new Error(`Session call could not be posted: ${String(p)}`));}})}U=t.listen(a=>{if(!d)if(y(),L(a))if(a.kind==="failure")b(new N(a.code,a.message,a.diagnostics));else if(a.kind==="wasm-module"){try{e.onWasmModule?.(a.url,a.module);}catch{}try{e.onWasmModuleMessage?.(a);}catch{}}else {if(a.kind==="progress")return;if(a.kind==="event"){let h=i.get(a.name);h&&P(h,a.payload,true);}else {let h=r.get(a.id);if(!h)return;if(r.delete(a.id),r.size===0&&x(),a.ok)h.resolve(a.value);else {let w=new Error(a.error.message);w.name=a.error.name,J(a.error,"refusal")&&Object.assign(w,{refusal:a.error.refusal}),h.reject(w);}}}else {if(a!==null&&typeof a=="object"&&"kind"in a&&a.kind==="wasm-module")return;b(new N("message","Session received a malformed host message"));}}),k=t.onError(a=>b(a instanceof N?a:new N("crash",a instanceof Error?a.message:String(a))));let M=Object.create(null);for(let a of n)Object.defineProperty(M,a,{enumerable:true,value:(...h)=>v(a,h)});return {call:M,callWithTransfer:(a,h,w)=>v(a,h,w),on(a,h){if(d)return ()=>{};let w=i.get(a)??new Set;i.set(a,w);let W=h;return w.add(W),()=>{w.delete(W);}},onFailure(a){return d||s.add(a),()=>{s.delete(a);}},get failure(){return d},dispose(){if(E)return E;let a=d!==void 0;return b(new N("disposed","Session was disposed"),false),E=new Promise(h=>{if(!a)try{t.post({protocol:1,kind:"dispose"});}catch{}setTimeout(()=>{try{t.close();}catch{}h();},0);}),E}}}var z=new Map;function $(t){return ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength).slice():new Uint8Array(t).slice()}function ye(t,e){for(let{assetId:s,bytes:n}of t.media)e.set(s,new Uint8Array(n));let r=JSON.parse(new TextDecoder().decode(t.displayList)),i=new Map;for(let s of Q(r)){let n=e.get(s);n!==void 0&&i.set(s,n);}return {...t,displayList:r,media:i}}function he(t,e){return t?.map(r=>{let i=$(r.bytes).buffer;return e.push(i),{family:r.family,bytes:i,bold:r.bold,italic:r.italic}})}function we(t,e){let r=$(t).buffer,i=[r],s={clientId:e.clientId,fonts:he(e.fonts,i),fallbackFonts:he(e.fallbackFonts,i)};if(e.initialUpdate!==void 0){let n=$(e.initialUpdate);s.initialUpdate=n,i.push(n.buffer);}return e.wasm instanceof ArrayBuffer?(s.wasm=e.wasm.slice(0),i.push(s.wasm)):e.wasm!==void 0?s.wasm=e.wasm:e.worker||(s.wasm=z.get(b().href)),{document:r,input:s,transfer:i}}function Pe(t,e,r){try{let{document:i,input:s,transfer:n}=we(t,e);e.wasm===void 0&&delete s.wasm;let o=V(r,{methods:S}),l=new Map,u=!1,f={get failure(){return o.failure},onFailure:d=>o.onFailure(d),begin:()=>o.callWithTransfer("beginEditor",[i,s],n),frame:async d=>{if(u)throw new E;let m=await o.call.editorFrame(d);if(u)throw new E;return {...ye(m,l),slideId:m.slideId,sequence:m.sequence}},dispose:async()=>{u=!0;try{await o.dispose();}finally{l.clear();}}};return R.set(f,{client:o,peerAttached:!1}),f}catch(i){try{r.close();}catch{}throw i}}async function nt(t,e={}){let r=O(e.worker?e.worker():new Worker(new URL("./pptxSessionWorker.mjs",import.meta.url),{type:"module"}));return !e.worker&&e.wasm===void 0&&!z.has(b().href)&&ge(r),Re(t,e,r)}async function Re(t,e,r){let i,s,n,o;try{(({document:i,input:s,transfer:n}=we(t,e))),o=V(r,{methods:W,onWasmModule:e.wasm===void 0&&!e.worker?(y,v)=>{y===b().href&&!z.has(y)&&z.set(y,v);}:void 0});}catch(y){try{r.close();}catch{}throw y}let l;o.on("changed",y=>{l={...l,...y};}),o.onFailure(()=>{l={...l,stage:"failed"};});try{l=await o.callWithTransfer("open",[i,s],n);}catch(y){throw await o.dispose(),y}let u=new Map,{version:f,readContent:d,findText:m,validateEdits:E,applyEdits:U,frame:k,slides:x,slideSize:P,save:b$1}=o.call;return {get state(){return l},call:{version:f,readContent:d,findText:m,validateEdits:E,applyEdits:U,slides:x,slideSize:P,save:b$1,frame:async y=>ye(await k(y),u)},save:async()=>new Uint8Array(await b$1()),on:(y,v)=>o.on(y,v),onFailure:y=>o.onFailure(y),get failure(){return o.failure},dispose:async()=>{try{await o.dispose();}finally{u.clear();}}}}var _=new WeakMap;var je=["snapshot","story","anchorCaret","resolveCaretAnchor","version","readContent","findText","validateEdits","searchText","isProposalsAvailable","listProposals","layoutSlide","hitTest","mediaBytes","comments","canUndo","canRedo","undoCaptureMode","onUpdate"];function He(t){let e=structuredClone(t),r=new WeakSet;function i(s){if(typeof s=="number"&&!Number.isFinite(s))throw new B("arguments","Editor arguments must be finite");if(s!==null&&typeof s=="object"){if(r.has(s))throw new B("arguments","Editor arguments must be acyclic");r.add(s);for(let n of Object.values(s))i(n);r.delete(s),Object.freeze(s);}}return i(e),e}function xe(t){let{peer:e$1,session:r}=t,i=R.get(r);if(!i)throw new TypeError("Presentation session does not support editor replay");if(i.peerAttached)throw new B("attachment","Presentation peer is already attached");let{client:s}=i,n=0,o=0,l=e$1.version(),u,f=false,d=false,m$1=Promise.resolve(),E$1,U$1=new Promise((g,c)=>{E$1=c;});U$1.catch(()=>{});function k(g){u||f||(u=g instanceof D?g:new D(Y(g)),E$1(u),t.onFailure(u));}function x(){if(t.guard(),f)throw new E;if(s.failure&&k(s.failure),u)throw u}function P(g){let c=m$1.then(async()=>{x();let p=await Promise.race([g(),U$1]);return x(),p}).catch(p=>{throw k(p),u??p});return m$1=c.then(()=>{},()=>{}),Promise.race([c,U$1])}function b(g){if(x(),d)throw new B("reentrant","Presentation editor mutation cannot reenter");d=true;let c=false,p=false;try{let S={sequence:n+1,baseVersion:l,op:He(g)};return p=!0,m(e$1,S,A=>{if(c=!0,!A.consumed)return;n=A.sequence,l=A.version;let N=Object.freeze({...S,expectedOutcome:A.outcome});P(async()=>{let L=await s.call.replay(N);if(!V$1(A,L))throw new B("ack-mismatch","Presentation replay acknowledgement differs");o=L.sequence,t.onProgress(n,o,L.projection);}).catch(()=>{}),t.onProgress(n,o);})}catch(S){throw (c||p&&!(S instanceof e&&["arguments","invalidJson","method"].includes(S.code)))&&k(S),u??S}finally{d=false;}}function y(g){try{x();}catch(S){return Promise.reject(S)}let c=n,p=l;return P(async()=>{let S=await s.call.flush(c,p);if(S.sequence!==c||S.version!==p||o!==c)throw new B("ack-mismatch","Presentation flush acknowledgement differs");return g(c,p)})}let v={};function M(g,c){return (...p)=>(x(),g[c](...p))}Object.defineProperty(v,"clientId",{enumerable:true,get:()=>(x(),e$1.clientId)});for(let g of je)Object.defineProperty(v,g,{enumerable:true,value:M(e$1,g)});let a=Symbol.for("@betteroffice/pptx/slide-layout-cache"),h=e$1[a],w=Object.freeze(Object.fromEntries(["snapshot","key","activate","hitTest"].map(g=>[g,M(h,g)])));Object.defineProperty(v,"interaction",{enumerable:true,value:w}),Object.defineProperty(v,a,{value:w});for(let g of Object.keys(U))Object.defineProperty(v,g,{enumerable:true,value:(...c)=>b({method:g,args:c}).outcome.result});let W=s.onFailure(k),F={access:Object.freeze(v),get sequence(){return n},get acknowledgedSequence(){return o},get version(){return l},apply:b,flush:()=>y(async()=>{}),saveAsync:()=>y(async(g,c)=>new Uint8Array(await s.call.editorSave(g,c))),dispose(){f||(f=true,E$1(new E),W());}};return i.peerAttached=true,_.set(F,{fail:k,whenAcknowledged:()=>{try{x();}catch(g){return Promise.reject(g)}return Promise.race([m$1,U$1])}}),F}function xt(t,e={}){ve(e);let r=O(e.worker?e.worker():new Worker(new URL("./pptxSessionWorker.mjs",import.meta.url),{type:"module"}));return De(t,e,r)}function ve(t){if(t.collaboration!=null)throw new F;if(t.signal?.aborted)throw new E}function Ee(t){return t?.map(e=>({...e,bytes:new Uint8Array(e.bytes).slice()}))}function De(t,e,r){ve(e);let i$1,s$1,n;try{s$1=ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength).slice():new Uint8Array(t).slice(),n={fonts:Ee(e.fonts),fallbackFonts:Ee(e.fallbackFonts),initialUpdate:e.initialUpdate?.slice()},i$1=Pe(s$1,{...e,...n},r);}catch(c){try{r.close();}catch{}throw c}let o={stage:"opening",sequence:0,acknowledgedSequence:0},l,u,f,d,m,E$1=new Set,U,k=new Promise((c,p)=>{U=p;});k.catch(()=>{});function x(c){o=Object.freeze({...o,...c});for(let p of [...E$1])if(E$1.has(p))try{p(o);}catch{}}function P(){if(o.stage==="disposed")throw new E;if(o.failure)throw o.failure}function b(){if(P(),o.stage!=="ready"||!f)throw new C;return f}function y(){let c=u;u=void 0,l===c&&(l=void 0);try{c?.dispose();}catch{}}function v(c){if(o.failure||o.stage==="disposed")return;let p=c instanceof D?c:new D(c);y(),x({stage:"failed",failure:p}),U(p),f&&_.get(f)?.fail(p);try{e.onError?.(p);}catch{}i$1.dispose();}function M(){if(!d){if(!l)throw new C;d=new Uint8Array(l.save()).slice();}return o.stage==="disposed"&&l&&(l.dispose(),l=void 0),d.slice()}let{client:a}=R.get(i$1),h$1=i$1.onFailure(v),w=()=>new Promise(c=>setTimeout(c,0)),W=(async()=>{try{let c=await Promise.race([i$1.begin(),k]);if(P(),c.sequence!==0)throw new B("sequence","Editor baseline is not at zero");if(x({stage:"hydrating",projection:c.state,version:c.version}),P(),await s(c.module),await w(),P(),u=g(s$1,c.hydration,n),await w(),P(),await h(u),await w(),P(),i(u),u.version()!==c.version)throw new B("version","Hydrated peer version differs");let p=await Promise.race([a.call.attachPeer(u.version(),0),k]);if(P(),p.sequence!==0||p.version!==u.version())throw new B("attachment","Worker attachment acknowledgement differs");let S=c.state.slides[0]?.id,A=S===void 0?void 0:await Promise.race([i$1.frame(S),k]);if(P(),A&&(A.sequence!==0||A.version!==c.version||A.slideId!==S))throw new B("frame","Initial worker frame differs");l=u,f=xe({peer:l,session:i$1,guard:()=>{b();},onFailure:v,onProgress:(N,L,X)=>{o.stage==="ready"&&x({sequence:N,acknowledgedSequence:L,version:f?.version,...X?{projection:X}:{}});}}),u=void 0,x({stage:"ready",initialFrame:A}),P();}catch(c){let p=Y(c);throw v(p),o.stage==="disposed"?new E:o.failure??p}finally{y();}})();W.catch(()=>{});let F={get state(){return o},get hydrated(){return o.stage==="ready"},get failure(){return o.failure},subscribe(c){if(o.stage==="disposed")throw new E;return E$1.add(c),()=>{E$1.delete(c);}},whenHydrated:async()=>{P(),await Promise.race([W,k]),P();},handleAsync:async()=>(await F.whenHydrated(),b().access),apply:c=>b().apply(c),flush:async()=>b().flush(),saveAsync:async()=>b().saveAsync(),frame:async c=>{if(P(),!o.projection)throw new C;try{let p=await Promise.race([i$1.frame(c),k]);return P(),p}catch(p){throw P(),p instanceof Error&&p.name==="RangeError"||(v(p),P()),p}},recoverySave:async()=>{if(o.stage==="recovering")throw new B("stage","Recovery is already in progress");if(o.stage!=="disposed"&&!o.failure)throw new C;o.stage==="disposed"||x({stage:"recovering"});try{return {bytes:M(),recovery:!0}}finally{o.stage!=="disposed"&&x({stage:"failed"});}},dispose(){if(m)return m;let c,p;m=new Promise((S,A)=>{c=S,p=A;}),x({stage:"disposed"}),y(),U(new E),f?.dispose(),h$1(),e.signal?.removeEventListener("abort",g$1);try{l&&M();}catch{}return E$1.clear(),i$1.dispose().then(c,p),m}},g$1=()=>{F.dispose();};return e.signal?.addEventListener("abort",g$1,{once:true}),e.signal?.aborted&&g$1(),F}export{Ne as a,We as b,Ae as c,Ie as d,Ke as e,Oe as f,ge as g,V as h,nt as i,xt as j};
1
+ import {a,L,N,J,O,b,W,F,E,R,B,s,g,h,i,Y,Q,C,D,S,U,m,V as V$1,e}from'./chunk-DDNX2Z7E.js';function fe(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(t.length<10)return;let r=0,i=0;if(t.length>=24&&e.getUint32(0)===2303741511&&e.getUint32(4)===218765834&&e.getUint32(12)===1229472850)r=e.getUint32(16),i=e.getUint32(20);else if(e.getUint32(0)===1195984440&&[55,57].includes(t[4])&&t[5]===97)r=e.getUint16(6,true),i=e.getUint16(8,true);else if(t.length>=26&&e.getUint16(0,true)===19778)e.getUint32(14,true)===12?(r=e.getUint16(18,true),i=e.getUint16(20,true)):(r=e.getInt32(18,true),i=Math.abs(e.getInt32(22,true)));else if(t.length>=20&&e.getUint32(0)===1380533830&&e.getUint32(8)===1464156752){let s=e.getUint32(12);if(s===1448097880&&t.length>=30)r=1+t[24]+(t[25]<<8)+(t[26]<<16),i=1+t[27]+(t[28]<<8)+(t[29]<<16);else if(s===1448097868&&t.length>=25&&t[20]===47){let n=e.getUint32(21,true);r=1+(n&16383),i=1+(n>>>14&16383);}else s===1448097824&&t.length>=30&&t[23]===157&&t[24]===1&&t[25]===42&&(r=e.getUint16(26,true)&16383,i=e.getUint16(28,true)&16383);}else if(e.getUint16(0)===65496){let s=false;for(let n=2;n+4<=t.length;){if(t[n++]!==255)return;for(;t[n]===255;)n+=1;let o=t[n++];if(o===217||o===218)break;if(o===1||o>=208&&o<=216)continue;if(n+2>t.length)return;let l=e.getUint16(n);if(l<2||n+l>t.length)return;o===225&&(s=s||Se(t.subarray(n+2,n+l))),o>=192&&o<=207&&![196,200,204].includes(o)&&l>=7&&(i=e.getUint16(n+3),r=e.getUint16(n+5)),n+=l;}s&&([r,i]=[i,r]);}return r>0&&i>0?{width:r,height:i}:void 0}function Se(t){if(t.length<14||![69,120,105,102,0,0].every((n,o)=>t[o]===n))return false;let e=new DataView(t.buffer,t.byteOffset+6,t.byteLength-6),r=e.getUint16(0)===18761;if(!r&&e.getUint16(0)!==19789||e.getUint16(2,r)!==42)return false;let i=e.getUint32(4,r);if(i>e.byteLength-2)return false;let s=e.getUint16(i,r);for(let n=0;n<s;n+=1){let o=i+2+n*12;if(o>e.byteLength-12)return false;if(e.getUint16(o,r)===274&&e.getUint16(o+2,r)===3&&e.getUint32(o+4,r)===1)return [5,6,7,8].includes(e.getUint16(o+8,r))}return false}var ke=33554432,ue="image/svg+xml",be=4194304,Ue=4096,pe=new WeakMap;function Ne(t){return pe.get(t)??{x:1,y:1}}function We(t,e){pe.set(t,e);}function Ae(t){if(a(t))throw new Error("TIFF images require worker conversion");let e=Ce(t)??Be(t);return e?new Blob([e],{type:"image/bmp"}):Me(t)??new Blob([t.slice()])}function Ie(t){return t.type===ue}async function Ke(t,e,r={}){let i=Ae(t);return Oe(i,e,r)}async function Oe(t,e,r={}){let i=r.maxDimension??Ue;if(!Number.isSafeInteger(i)||i<1)throw new Error("invalid image dimension limit");if(typeof createImageBitmap=="function"&&!Ie(t)){let n=fe(new Uint8Array(await t.arrayBuffer()));if(n&&Math.max(n.width,n.height)>i){let l=i/Math.max(n.width,n.height),u=await createImageBitmap(t,{resizeWidth:Math.max(1,Math.floor(n.width*l)),resizeHeight:Math.max(1,Math.floor(n.height*l))});return K(u,n,i)}let o=await createImageBitmap(t);return K(o,{width:o.width,height:o.height},i)}let s=URL.createObjectURL(t);try{let n=await new Promise((o,l)=>{let u=new Image;u.onload=()=>o(u),u.onerror=()=>l(new Error(e)),u.src=s;});return await K(n,{width:n.naturalWidth,height:n.naturalHeight},i)}finally{URL.revokeObjectURL(s);}}async function K(t,e,r){let i="naturalWidth"in t?t.naturalWidth:t.width,s="naturalHeight"in t?t.naturalHeight:t.height,n=t;if(Math.max(i,s)>r){let u=r/Math.max(i,s),f={width:Math.max(1,Math.floor(i*u)),height:Math.max(1,Math.floor(s*u))},d,m;try{typeof OffscreenCanvas=="function"&&(d=new OffscreenCanvas(f.width,f.height),m=d.getContext("2d"));}catch{d=void 0;}if(!m&&typeof document<"u")try{d=document.createElement("canvas"),d.width=f.width,d.height=f.height,m=d.getContext("2d");}catch{d=void 0;}if(d&&m){m.drawImage(t,0,0,f.width,f.height),"close"in t&&typeof t.close=="function"&&t.close();try{n=typeof createImageBitmap=="function"?await createImageBitmap(d):d;}catch{n=d;}}}let o="naturalWidth"in n?n.naturalWidth:n.width,l="naturalHeight"in n?n.naturalHeight:n.height;return (e.width!==o||e.height!==l)&&We(n,{x:e.width/o,y:e.height/l}),n}function Me(t){if(t.byteLength>be)return;let e;try{e=new TextDecoder("utf-8",{fatal:!0}).decode(t).replace(/^\ufeff/,"");}catch{return}if(!(!/^\s*</.test(e)||!e.slice(0,1024).includes("<svg")))return new Blob([Fe(e)],{type:ue})}function Fe(t){let e=Te(t);if(!e||/\s(?:width|height)\s*=/.test(t.slice(e.start,e.end)))return t;let r=t.slice(e.start,e.end).match(/\sviewBox\s*=\s*(["'])\s*[-+.\deE]+[\s,]+[-+.\deE]+[\s,]+([-+.\deE]+)[\s,]+([-+.\deE]+)\s*\1/),[i,s]=[Number(r?.[2]),Number(r?.[3])];if(!(i>0)||!(s>0))return t;let n=e.start+4;return `${t.slice(0,n)} width="${i}" height="${s}"${t.slice(n)}`}function Te(t){let e=0;for(;e<t.length;){if(/\s/.test(t[e]))e+=1;else if(t.startsWith("<!--",e))e=j(t.indexOf("-->",e+4),3);else if(t.startsWith("<?",e))e=j(t.indexOf("?>",e+2),2);else if(t.startsWith("<!",e))e=j(le(t,e+2),1);else break;if(e<0)return}if(!/^<svg[\s/>]/.test(t.slice(e,e+5)))return;let r=le(t,e+4);return r<0?void 0:{start:e,end:r}}function j(t,e){return t<0?-1:t+e}function le(t,e){let r="",i=false;for(let s=e;s<t.length;s+=1){let n=t[s];if(r)n===r&&(r="");else if(i&&t.startsWith("<!--",s)){if(s=j(t.indexOf("-->",s+4),2),s<0)return -1}else if(i&&t.startsWith("<?",s)){if(s=j(t.indexOf("?>",s+2),1),s<0)return -1}else if(n==='"'||n==="'")r=n;else if(n==="[")i=true;else if(n==="]")i=false;else if(n===">"&&!i)return s}return -1}function Be(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(e.byteLength<108||e.getUint32(0,true)!==1||e.getUint32(40,true)!==1179469088)return;let r=e.getUint32(4,true);if(r<88||r%4||r>e.byteLength-8)return;let i=e.getInt32(16,true)-e.getInt32(8,true)+1,s=e.getInt32(20,true)-e.getInt32(12,true)+1,n=e.getUint32(r+4,true);if(e.getUint32(r,true)!==81||n<80||n>e.byteLength-r-8)return;let o=m=>e.getInt32(r+m,true),l=e.getUint32(r+48,true),u=e.getUint32(r+56,true),f=e.getUint32(r+60,true);if(o(24)!==e.getInt32(8,true)||o(28)!==e.getInt32(12,true)||o(72)!==i||o(76)!==s||o(32)!==0||o(36)!==0||o(40)!==i||o(44)!==s||e.getUint32(r+64,true)!==0||e.getUint32(r+68,true)!==13369376||l<80||l+e.getUint32(r+52,true)!==u||u+f!==n)return;let d=r+n;if(!(e.getUint32(d,true)!==14||e.getUint32(d+4,true)!==e.byteLength-d))return me(t.subarray(r+l,d),i,s)}function Ce(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(e.byteLength<18)return;let r=e.getUint32(0,true)===2596720087?22:0;if(e.byteLength<r+18||![1,2].includes(e.getUint16(r,true))||e.getUint16(r+2,true)!==9||e.getUint16(r+4,true)!==768||e.getUint32(r+6,true)*2!==e.byteLength-r)return;let i=0,s=0,n=0,o=0,l=false,u;for(let f=r+18;f+6<=e.byteLength;){let d=e.getUint32(f,true)*2,m=e.getUint16(f+4,true);if(d<6||d>e.byteLength-f)return;if(m===0)return d===6&&f+d===e.byteLength?u:void 0;if(u)return;if(m===259){if(d<8||e.getUint16(f+6,true)!==8)return;l=true;}else if(m===263){if(d<8||![1,2,3,4].includes(e.getUint16(f+6,true)))return}else if(m===523||m===524){if(d!==10)return;let E=e.getInt16(f+6,true),U=e.getInt16(f+8,true);if(m===523)i=U,s=E;else {if(!l)return;n=U,o=E;}}else if(m===2881){if(d<66||e.getUint32(f+6,true)!==13369376||e.getInt16(f+14,true)!==0||e.getInt16(f+16,true)!==0||e.getInt16(f+18,true)!==o||e.getInt16(f+20,true)!==n||e.getInt16(f+22,true)!==s||e.getInt16(f+24,true)!==i||!n||!o||(u=me(t.subarray(f+26,f+d),e.getInt16(f+12,true),e.getInt16(f+10,true)),!u))return}else return;f+=d;}}function me(t,e,r){if(t.length<40)return;let i=new DataView(t.buffer,t.byteOffset,t.byteLength),s=i.getInt32(4,true),n=i.getInt32(8,true),o=i.getUint16(14,true);if(i.getUint32(0,true)!==40||s<1||!n||s*Math.abs(n)>ke||e!==s||r!==Math.abs(n)||i.getUint16(12,true)!==1||![24,32].includes(o)||i.getUint32(16,true)!==0||i.getUint32(32,true)!==0)return;let l=Math.ceil(s*o/32)*4*Math.abs(n),u=i.getUint32(20,true);if(40+l!==t.length||u!==0&&u!==l)return;let f=new Uint8Array(14+t.length),d=new DataView(f.buffer);return d.setUint16(0,19778,true),d.setUint32(2,f.length,true),d.setUint32(10,54,true),f.set(t,14),f}var Le=6e4;function ge(t){try{t.post({protocol:1,kind:"wasm-compile"});}catch(e){try{t.close();}catch{}throw e}}function V(t,e){let r=new Map,i=new Map,s=new Set,n=new Set(Object.keys(e.methods)),o=e.now??Date.now,l=e.timer??((a,h)=>{let w=setTimeout(a,h);return ()=>clearTimeout(w)}),u=e.silenceMs??Le,f=1,d,m,E,U=()=>{},k=()=>{};function x(){m?.(),m=void 0;}function P(a,h,w=false){for(let W of [...a])if(!(!a.has(W)||w&&d))try{W(h);}catch{}}function b(a,h=true){if(!d){d=a,x(),U(),k();for(let w of r.values())w.reject(a);if(r.clear(),i.clear(),h){try{t.close();}catch{}P(s,a);}s.clear();}}function y(){if(x(),r.size===0||d)return;let a=o();m=l(()=>b(new N("silence",`Session received no message within ${u}ms`,`Waiting for ${r.size} call(s); silent for ${o()-a}ms`)),u);}function v(a,h,w=[]){if(d)return Promise.reject(d);if(!n.has(a))return Promise.reject(new Error(`Unknown session method: ${a}`));let W=f++;return new Promise((F,g)=>{let c=r.size===0;r.set(W,{resolve:F,reject:g}),c&&y();try{t.post({protocol:1,kind:"call",id:W,method:a,args:h},w);}catch(p){r.delete(W),r.size===0&&x(),g(p instanceof Error?p:new Error(`Session call could not be posted: ${String(p)}`));}})}U=t.listen(a=>{if(!d)if(y(),L(a))if(a.kind==="failure")b(new N(a.code,a.message,a.diagnostics));else if(a.kind==="wasm-module"){try{e.onWasmModule?.(a.url,a.module);}catch{}try{e.onWasmModuleMessage?.(a);}catch{}}else {if(a.kind==="progress")return;if(a.kind==="event"){let h=i.get(a.name);h&&P(h,a.payload,true);}else {let h=r.get(a.id);if(!h)return;if(r.delete(a.id),r.size===0&&x(),a.ok)h.resolve(a.value);else {let w=new Error(a.error.message);w.name=a.error.name,J(a.error,"refusal")&&Object.assign(w,{refusal:a.error.refusal}),h.reject(w);}}}else {if(a!==null&&typeof a=="object"&&"kind"in a&&a.kind==="wasm-module")return;b(new N("message","Session received a malformed host message"));}}),k=t.onError(a=>b(a instanceof N?a:new N("crash",a instanceof Error?a.message:String(a))));let M=Object.create(null);for(let a of n)Object.defineProperty(M,a,{enumerable:true,value:(...h)=>v(a,h)});return {call:M,callWithTransfer:(a,h,w)=>v(a,h,w),on(a,h){if(d)return ()=>{};let w=i.get(a)??new Set;i.set(a,w);let W=h;return w.add(W),()=>{w.delete(W);}},onFailure(a){return d||s.add(a),()=>{s.delete(a);}},get failure(){return d},dispose(){if(E)return E;let a=d!==void 0;return b(new N("disposed","Session was disposed"),false),E=new Promise(h=>{if(!a)try{t.post({protocol:1,kind:"dispose"});}catch{}setTimeout(()=>{try{t.close();}catch{}h();},0);}),E}}}var z=new Map;function $(t){return ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength).slice():new Uint8Array(t).slice()}function ye(t,e){for(let{assetId:s,bytes:n}of t.media)e.set(s,new Uint8Array(n));let r=JSON.parse(new TextDecoder().decode(t.displayList)),i=new Map;for(let s of Q(r)){let n=e.get(s);n!==void 0&&i.set(s,n);}return {...t,displayList:r,media:i}}function he(t,e){return t?.map(r=>{let i=$(r.bytes).buffer;return e.push(i),{family:r.family,bytes:i,bold:r.bold,italic:r.italic}})}function we(t,e){let r=$(t).buffer,i=[r],s={clientId:e.clientId,fonts:he(e.fonts,i),fallbackFonts:he(e.fallbackFonts,i)};if(e.initialUpdate!==void 0){let n=$(e.initialUpdate);s.initialUpdate=n,i.push(n.buffer);}return e.wasm instanceof ArrayBuffer?(s.wasm=e.wasm.slice(0),i.push(s.wasm)):e.wasm!==void 0?s.wasm=e.wasm:e.worker||(s.wasm=z.get(b().href)),{document:r,input:s,transfer:i}}function Pe(t,e,r){try{let{document:i,input:s,transfer:n}=we(t,e);e.wasm===void 0&&delete s.wasm;let o=V(r,{methods:S}),l=new Map,u=!1,f={get failure(){return o.failure},onFailure:d=>o.onFailure(d),begin:()=>o.callWithTransfer("beginEditor",[i,s],n),frame:async d=>{if(u)throw new E;let m=await o.call.editorFrame(d);if(u)throw new E;return {...ye(m,l),slideId:m.slideId,sequence:m.sequence}},dispose:async()=>{u=!0;try{await o.dispose();}finally{l.clear();}}};return R.set(f,{client:o,peerAttached:!1}),f}catch(i){try{r.close();}catch{}throw i}}async function nt(t,e={}){let r=O(e.worker?e.worker():new Worker(new URL("./pptxSessionWorker.mjs",import.meta.url),{type:"module"}));return !e.worker&&e.wasm===void 0&&!z.has(b().href)&&ge(r),Re(t,e,r)}async function Re(t,e,r){let i,s,n,o;try{(({document:i,input:s,transfer:n}=we(t,e))),o=V(r,{methods:W,onWasmModule:e.wasm===void 0&&!e.worker?(y,v)=>{y===b().href&&!z.has(y)&&z.set(y,v);}:void 0});}catch(y){try{r.close();}catch{}throw y}let l;o.on("changed",y=>{l={...l,...y};}),o.onFailure(()=>{l={...l,stage:"failed"};});try{l=await o.callWithTransfer("open",[i,s],n);}catch(y){throw await o.dispose(),y}let u=new Map,{version:f,readContent:d,findText:m,validateEdits:E,applyEdits:U,frame:k,slides:x,slideSize:P,save:b$1}=o.call;return {get state(){return l},call:{version:f,readContent:d,findText:m,validateEdits:E,applyEdits:U,slides:x,slideSize:P,save:b$1,frame:async y=>ye(await k(y),u)},save:async()=>new Uint8Array(await b$1()),on:(y,v)=>o.on(y,v),onFailure:y=>o.onFailure(y),get failure(){return o.failure},dispose:async()=>{try{await o.dispose();}finally{u.clear();}}}}var _=new WeakMap;var je=["snapshot","story","anchorCaret","resolveCaretAnchor","version","readContent","findText","validateEdits","searchText","isProposalsAvailable","listProposals","layoutSlide","hitTest","mediaBytes","comments","canUndo","canRedo","undoCaptureMode","onUpdate"];function He(t){let e=structuredClone(t),r=new WeakSet;function i(s){if(typeof s=="number"&&!Number.isFinite(s))throw new B("arguments","Editor arguments must be finite");if(s!==null&&typeof s=="object"){if(r.has(s))throw new B("arguments","Editor arguments must be acyclic");r.add(s);for(let n of Object.values(s))i(n);r.delete(s),Object.freeze(s);}}return i(e),e}function xe(t){let{peer:e$1,session:r}=t,i=R.get(r);if(!i)throw new TypeError("Presentation session does not support editor replay");if(i.peerAttached)throw new B("attachment","Presentation peer is already attached");let{client:s}=i,n=0,o=0,l=e$1.version(),u,f=false,d=false,m$1=Promise.resolve(),E$1,U$1=new Promise((g,c)=>{E$1=c;});U$1.catch(()=>{});function k(g){u||f||(u=g instanceof D?g:new D(Y(g)),E$1(u),t.onFailure(u));}function x(){if(t.guard(),f)throw new E;if(s.failure&&k(s.failure),u)throw u}function P(g){let c=m$1.then(async()=>{x();let p=await Promise.race([g(),U$1]);return x(),p}).catch(p=>{throw k(p),u??p});return m$1=c.then(()=>{},()=>{}),Promise.race([c,U$1])}function b(g){if(x(),d)throw new B("reentrant","Presentation editor mutation cannot reenter");d=true;let c=false,p=false;try{let S={sequence:n+1,baseVersion:l,op:He(g)};return p=!0,m(e$1,S,A=>{if(c=!0,!A.consumed)return;n=A.sequence,l=A.version;let N=Object.freeze({...S,expectedOutcome:A.outcome});P(async()=>{let L=await s.call.replay(N);if(!V$1(A,L))throw new B("ack-mismatch","Presentation replay acknowledgement differs");o=L.sequence,t.onProgress(n,o,L.projection);}).catch(()=>{}),t.onProgress(n,o);})}catch(S){throw (c||p&&!(S instanceof e&&["arguments","invalidJson","method"].includes(S.code)))&&k(S),u??S}finally{d=false;}}function y(g){try{x();}catch(S){return Promise.reject(S)}let c=n,p=l;return P(async()=>{let S=await s.call.flush(c,p);if(S.sequence!==c||S.version!==p||o!==c)throw new B("ack-mismatch","Presentation flush acknowledgement differs");return g(c,p)})}let v={};function M(g,c){return (...p)=>(x(),g[c](...p))}Object.defineProperty(v,"clientId",{enumerable:true,get:()=>(x(),e$1.clientId)});for(let g of je)Object.defineProperty(v,g,{enumerable:true,value:M(e$1,g)});let a=Symbol.for("@betteroffice/pptx/slide-layout-cache"),h=e$1[a],w=Object.freeze(Object.fromEntries(["snapshot","key","activate","hitTest"].map(g=>[g,M(h,g)])));Object.defineProperty(v,"interaction",{enumerable:true,value:w}),Object.defineProperty(v,a,{value:w});for(let g of Object.keys(U))Object.defineProperty(v,g,{enumerable:true,value:(...c)=>b({method:g,args:c}).outcome.result});let W=s.onFailure(k),F={access:Object.freeze(v),get sequence(){return n},get acknowledgedSequence(){return o},get version(){return l},apply:b,flush:()=>y(async()=>{}),saveAsync:()=>y(async(g,c)=>new Uint8Array(await s.call.editorSave(g,c))),dispose(){f||(f=true,E$1(new E),W());}};return i.peerAttached=true,_.set(F,{fail:k,whenAcknowledged:()=>{try{x();}catch(g){return Promise.reject(g)}return Promise.race([m$1,U$1])}}),F}function xt(t,e={}){ve(e);let r=O(e.worker?e.worker():new Worker(new URL("./pptxSessionWorker.mjs",import.meta.url),{type:"module"}));return De(t,e,r)}function ve(t){if(t.collaboration!=null)throw new F;if(t.signal?.aborted)throw new E}function Ee(t){return t?.map(e=>({...e,bytes:new Uint8Array(e.bytes).slice()}))}function De(t,e,r){ve(e);let i$1,s$1,n;try{s$1=ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength).slice():new Uint8Array(t).slice(),n={fonts:Ee(e.fonts),fallbackFonts:Ee(e.fallbackFonts),initialUpdate:e.initialUpdate?.slice()},i$1=Pe(s$1,{...e,...n},r);}catch(c){try{r.close();}catch{}throw c}let o={stage:"opening",sequence:0,acknowledgedSequence:0},l,u,f,d,m,E$1=new Set,U,k=new Promise((c,p)=>{U=p;});k.catch(()=>{});function x(c){o=Object.freeze({...o,...c});for(let p of [...E$1])if(E$1.has(p))try{p(o);}catch{}}function P(){if(o.stage==="disposed")throw new E;if(o.failure)throw o.failure}function b(){if(P(),o.stage!=="ready"||!f)throw new C;return f}function y(){let c=u;u=void 0,l===c&&(l=void 0);try{c?.dispose();}catch{}}function v(c){if(o.failure||o.stage==="disposed")return;let p=c instanceof D?c:new D(c);y(),x({stage:"failed",failure:p}),U(p),f&&_.get(f)?.fail(p);try{e.onError?.(p);}catch{}i$1.dispose();}function M(){if(!d){if(!l)throw new C;d=new Uint8Array(l.save()).slice();}return o.stage==="disposed"&&l&&(l.dispose(),l=void 0),d.slice()}let{client:a}=R.get(i$1),h$1=i$1.onFailure(v),w=()=>new Promise(c=>setTimeout(c,0)),W=(async()=>{try{let c=await Promise.race([i$1.begin(),k]);if(P(),c.sequence!==0)throw new B("sequence","Editor baseline is not at zero");if(x({stage:"hydrating",projection:c.state,version:c.version}),P(),await s(c.module),await w(),P(),u=g(s$1,c.hydration,n),await w(),P(),await h(u),await w(),P(),i(u),u.version()!==c.version)throw new B("version","Hydrated peer version differs");let p=await Promise.race([a.call.attachPeer(u.version(),0),k]);if(P(),p.sequence!==0||p.version!==u.version())throw new B("attachment","Worker attachment acknowledgement differs");let S=c.state.slides[0]?.id,A=S===void 0?void 0:await Promise.race([i$1.frame(S),k]);if(P(),A&&(A.sequence!==0||A.version!==c.version||A.slideId!==S))throw new B("frame","Initial worker frame differs");l=u,f=xe({peer:l,session:i$1,guard:()=>{b();},onFailure:v,onProgress:(N,L,X)=>{o.stage==="ready"&&x({sequence:N,acknowledgedSequence:L,version:f?.version,...X?{projection:X}:{}});}}),u=void 0,x({stage:"ready",initialFrame:A}),P();}catch(c){let p=Y(c);throw v(p),o.stage==="disposed"?new E:o.failure??p}finally{y();}})();W.catch(()=>{});let F={get state(){return o},get hydrated(){return o.stage==="ready"},get failure(){return o.failure},subscribe(c){if(o.stage==="disposed")throw new E;return E$1.add(c),()=>{E$1.delete(c);}},whenHydrated:async()=>{P(),await Promise.race([W,k]),P();},handleAsync:async()=>(await F.whenHydrated(),b().access),apply:c=>b().apply(c),flush:async()=>b().flush(),saveAsync:async()=>b().saveAsync(),frame:async c=>{if(P(),!o.projection)throw new C;try{let p=await Promise.race([i$1.frame(c),k]);return P(),p}catch(p){throw P(),p instanceof Error&&p.name==="RangeError"||(v(p),P()),p}},recoverySave:async()=>{if(o.stage==="recovering")throw new B("stage","Recovery is already in progress");if(o.stage!=="disposed"&&!o.failure)throw new C;o.stage==="disposed"||x({stage:"recovering"});try{return {bytes:M(),recovery:!0}}finally{o.stage!=="disposed"&&x({stage:"failed"});}},dispose(){if(m)return m;let c,p;m=new Promise((S,A)=>{c=S,p=A;}),x({stage:"disposed"}),y(),U(new E),f?.dispose(),h$1(),e.signal?.removeEventListener("abort",g$1);try{l&&M();}catch{}return E$1.clear(),i$1.dispose().then(c,p),m}},g$1=()=>{F.dispose();};return e.signal?.addEventListener("abort",g$1,{once:true}),e.signal?.aborted&&g$1(),F}export{Ne as a,We as b,Ae as c,Ie as d,Ke as e,Oe as f,ge as g,V as h,nt as i,xt as j};
@@ -0,0 +1 @@
1
+ import {q as q$1}from'./chunk-2CPM3HRW.js';import {a}from'./chunk-O2XFH626.js';function me(){return new URL("./generated/pptx_wasm_bg.wasm",import.meta.url)}var Q=class extends Error{constructor(t){super(`Proposal targets changed: ${t.join(", ")}`);a(this,"targets");this.name="StaleProposalError",this.targets=t;}};var ee=class extends Error{constructor(t){super(t.message);a(this,"failure");this.name="PptxExportError",this.failure=t;}};var v=class d{static __wrap(e){let t=Object.create(d.prototype);return t.__wbg_ptr=e,ye.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,ye.unregister(this),e}free(){let e=this.__destroy_into_raw();n.__wbg_pptxdocument_free(e,0);}acceptProposalJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_acceptProposalJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}addCommentJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_addCommentJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}addPictureJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_addPictureJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}addShapeJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_addShapeJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}addTextBoxJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_addTextBoxJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}addTextBoxProfiledJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_addTextBoxProfiledJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}addUndoBoundary(){n.pptxdocument_addUndoBoundary(this.__wbg_ptr);}adoptPeerIdentity(){let e=n.pptxdocument_adoptPeerIdentity(this.__wbg_ptr);if(e[1])throw _(e[0])}anchorCaretJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_anchorCaretJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}applyEditsJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_applyEditsJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}applyUpdateJson(e){let t,i;try{let a=J(e,n.__wbindgen_malloc),l=u,s=n.pptxdocument_applyUpdateJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}bringShapeForwardJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_bringShapeForwardJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}bringShapeToFrontJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_bringShapeToFrontJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}canRedo(){return n.pptxdocument_canRedo(this.__wbg_ptr)!==0}canUndo(){return n.pptxdocument_canUndo(this.__wbg_ptr)!==0}checkTableEditJson(e){let t=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),i=u,r=n.pptxdocument_checkTableEditJson(this.__wbg_ptr,t,i);if(r[1])throw _(r[0])}clearUpdateObservation(){n.pptxdocument_clearUpdateObservation(this.__wbg_ptr);}get clientId(){return n.pptxdocument_clientId(this.__wbg_ptr)}commentsJson(){let e,t;try{let o=n.pptxdocument_commentsJson(this.__wbg_ptr);var i=o[0],r=o[1];if(o[3])throw i=0,r=0,_(o[2]);return e=i,t=r,f(i,r)}finally{n.__wbindgen_free(e,t,1);}}deleteSlideJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_deleteSlideJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}deleteTableColumnJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_deleteTableColumnJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}deleteTableRowJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_deleteTableRowJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}deleteTextJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_deleteTextJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}deleteTextProfiledJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_deleteTextProfiledJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}documentVersion(){let e,t;try{let i=n.pptxdocument_documentVersion(this.__wbg_ptr);return e=i[0],t=i[1],f(i[0],i[1])}finally{n.__wbindgen_free(e,t,1);}}drainUpdateEvent(){let e=n.pptxdocument_drainUpdateEvent(this.__wbg_ptr);var t=F(e[0],e[1]).slice();return n.__wbindgen_free(e[0],e[1]*1,1),t}duplicateSlideJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_duplicateSlideJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}encodeDiff(e){let t=J(e,n.__wbindgen_malloc),i=u,r=n.pptxdocument_encodeDiff(this.__wbg_ptr,t,i);if(r[3])throw _(r[2]);var o=F(r[0],r[1]).slice();return n.__wbindgen_free(r[0],r[1]*1,1),o}encodeStateAsUpdate(){let e=n.pptxdocument_encodeStateAsUpdate(this.__wbg_ptr);var t=F(e[0],e[1]).slice();return n.__wbindgen_free(e[0],e[1]*1,1),t}encodeStateVector(){let e=n.pptxdocument_encodeStateVector(this.__wbg_ptr);var t=F(e[0],e[1]).slice();return n.__wbindgen_free(e[0],e[1]*1,1),t}exportMarkdownJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_exportMarkdownJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}exportStructuredJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_exportStructuredJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}findTextJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_findTextJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}formatTextJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_formatTextJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}insertParagraphBreakJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_insertParagraphBreakJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}insertSlideJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_insertSlideJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}insertSlideProfiledJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_insertSlideProfiledJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}insertTableColumnJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_insertTableColumnJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}insertTableRowJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_insertTableRowJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}insertTextJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_insertTextJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}insertTextProfiledJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_insertTextProfiledJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}listProposalsJson(){let e,t;try{let o=n.pptxdocument_listProposalsJson(this.__wbg_ptr);var i=o[0],r=o[1];if(o[3])throw i=0,r=0,_(o[2]);return e=i,t=r,f(i,r)}finally{n.__wbindgen_free(e,t,1);}}mediaBytes(e){let t=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),i=u,r=n.pptxdocument_mediaBytes(this.__wbg_ptr,t,i);if(r[3])throw _(r[2]);var o=F(r[0],r[1]).slice();return n.__wbindgen_free(r[0],r[1]*1,1),o}moveShapeJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_moveShapeJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}moveShapeProfiledJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_moveShapeProfiledJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}moveSlideJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_moveSlideJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}static openCollaborativeFromUpdate(e,t,i){let r=J(e,n.__wbindgen_malloc),o=u;var a=M(i)?0:J(i,n.__wbindgen_malloc),l=u;let s=n.pptxdocument_openCollaborativeFromUpdate(r,o,t,a,l);if(s[2])throw _(s[1]);return d.__wrap(s[0])}static openCollaborative(e,t){let i=J(e,n.__wbindgen_malloc),r=u,o=n.pptxdocument_openCollaborative(i,r,t);if(o[2])throw _(o[1]);return d.__wrap(o[0])}static openPeerDeckJson(e,t,i){let r=J(e,n.__wbindgen_malloc),o=u,a=m(t,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u;var s=M(i)?0:J(i,n.__wbindgen_malloc),h=u;let w=n.pptxdocument_openPeerDeckJson(r,o,a,l,s,h);if(w[2])throw _(w[1]);return d.__wrap(w[0])}static openReplayBaseline(e,t,i){let r=J(e,n.__wbindgen_malloc),o=u;var a=M(i)?0:J(i,n.__wbindgen_malloc),l=u;let s=n.pptxdocument_openReplayBaseline(r,o,!M(t),M(t)?0:t,a,l);if(s[2])throw _(s[1]);return d.__wrap(s[0])}peerHydrationJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_peerHydrationJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}previewProposalJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_previewProposalJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}proposeJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_proposeJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}readCommandContentJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_readCommandContentJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}readContentJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_readContentJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}redoJson(){let e,t;try{let o=n.pptxdocument_redoJson(this.__wbg_ptr);var i=o[0],r=o[1];if(o[3])throw i=0,r=0,_(o[2]);return e=i,t=r,f(i,r)}finally{n.__wbindgen_free(e,t,1);}}redoReceiptJson(){let e,t;try{let o=n.pptxdocument_redoReceiptJson(this.__wbg_ptr);var i=o[0],r=o[1];if(o[3])throw i=0,r=0,_(o[2]);return e=i,t=r,f(i,r)}finally{n.__wbindgen_free(e,t,1);}}registerPeerFontsJson(e){let t=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),i=u,r=n.pptxdocument_registerPeerFontsJson(this.__wbg_ptr,t,i);if(r[1])throw _(r[0])}rejectProposalJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_rejectProposalJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}removeCommentJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_removeCommentJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}removeShapeJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_removeShapeJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}replayJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_replayJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}replyToCommentJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_replyToCommentJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}resizeShapeJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_resizeShapeJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}resolveCaretAnchorJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_resolveCaretAnchorJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}saveBytes(){let e=n.pptxdocument_saveBytes(this.__wbg_ptr);if(e[3])throw _(e[2]);var t=F(e[0],e[1]).slice();return n.__wbindgen_free(e[0],e[1]*1,1),t}searchTextJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_searchTextJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}sendShapeBackwardJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_sendShapeBackwardJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}sendShapeToBackJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_sendShapeToBackJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}sessionMetadataJson(){let e,t;try{let o=n.pptxdocument_sessionMetadataJson(this.__wbg_ptr);var i=o[0],r=o[1];if(o[3])throw i=0,r=0,_(o[2]);return e=i,t=r,f(i,r)}finally{n.__wbindgen_free(e,t,1);}}setCollaborative(){let e=n.pptxdocument_setCollaborative(this.__wbg_ptr);if(e[1])throw _(e[0])}setCommentFlavorJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_setCommentFlavorJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}setCommentPositionJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_setCommentPositionJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}setCommentStatusJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_setCommentStatusJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}setParagraphAlignmentJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_setParagraphAlignmentJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}setShapeAdjustJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_setShapeAdjustJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}setShapeFillJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_setShapeFillJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}setShapeRectJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_setShapeRectJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}setShapeStrokeJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_setShapeStrokeJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}setSlideLayoutJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_setSlideLayoutJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}setSlideNotesJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_setSlideNotesJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}setStoryParagraphsJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_setStoryParagraphsJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}setUndoCaptureMode(e){let t=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),i=u,r=n.pptxdocument_setUndoCaptureMode(this.__wbg_ptr,t,i);if(r[1])throw _(r[0])}snapshotJson(){let e,t;try{let o=n.pptxdocument_snapshotJson(this.__wbg_ptr);var i=o[0],r=o[1];if(o[3])throw i=0,r=0,_(o[2]);return e=i,t=r,f(i,r)}finally{n.__wbindgen_free(e,t,1);}}startUpdateObservation(){let e=n.pptxdocument_startUpdateObservation(this.__wbg_ptr);if(e[1])throw _(e[0])}storyFormattingJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_storyFormattingJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}storyJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_storyJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}undoCaptureMode(){let e,t;try{let i=n.pptxdocument_undoCaptureMode(this.__wbg_ptr);return e=i[0],t=i[1],f(i[0],i[1])}finally{n.__wbindgen_free(e,t,1);}}undoJson(){let e,t;try{let o=n.pptxdocument_undoJson(this.__wbg_ptr);var i=o[0],r=o[1];if(o[3])throw i=0,r=0,_(o[2]);return e=i,t=r,f(i,r)}finally{n.__wbindgen_free(e,t,1);}}undoProfiledJson(){let e,t;try{let o=n.pptxdocument_undoProfiledJson(this.__wbg_ptr);var i=o[0],r=o[1];if(o[3])throw i=0,r=0,_(o[2]);return e=i,t=r,f(i,r)}finally{n.__wbindgen_free(e,t,1);}}undoReceiptJson(){let e,t;try{let o=n.pptxdocument_undoReceiptJson(this.__wbg_ptr);var i=o[0],r=o[1];if(o[3])throw i=0,r=0,_(o[2]);return e=i,t=r,f(i,r)}finally{n.__wbindgen_free(e,t,1);}}validateEditsJson(e){let t,i;try{let a=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=n.pptxdocument_validateEditsJson(this.__wbg_ptr,a,l);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,_(s[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}static version(){let e,t;try{let i=n.pptxdocument_version();return e=i[0],t=i[1],f(i[0],i[1])}finally{n.__wbindgen_free(e,t,1);}}};Symbol.dispose&&(v.prototype[Symbol.dispose]=v.prototype.free);var N=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,be.unregister(this),e}free(){let e=this.__destroy_into_raw();n.__wbg_pptxrenderer_free(e,0);}hitTestJson(e,t){let i,r;try{let l=n.pptxrenderer_hitTestJson(this.__wbg_ptr,e,t);var o=l[0],a=l[1];if(l[3])throw o=0,a=0,_(l[2]);return i=o,r=a,f(o,a)}finally{n.__wbindgen_free(i,r,1);}}hitTestSlideJson(e,t,i,r){let o,a;try{A(e,v);let h=m(t,n.__wbindgen_malloc,n.__wbindgen_realloc),w=u,E=n.pptxrenderer_hitTestSlideJson(this.__wbg_ptr,e.__wbg_ptr,h,w,i,r);var l=E[0],s=E[1];if(E[3])throw l=0,s=0,_(E[2]);return o=l,a=s,f(l,s)}finally{n.__wbindgen_free(o,a,1);}}layoutProposalDiffSlideJson(e,t,i){let r,o;try{A(e,v);let s=m(t,n.__wbindgen_malloc,n.__wbindgen_realloc),h=u,w=n.pptxrenderer_layoutProposalDiffSlideJson(this.__wbg_ptr,e.__wbg_ptr,s,h,i);var a=w[0],l=w[1];if(w[3])throw a=0,l=0,_(w[2]);return r=a,o=l,f(a,l)}finally{n.__wbindgen_free(r,o,1);}}layoutProposalSlideJson(e,t,i){let r,o;try{A(e,v);let s=m(t,n.__wbindgen_malloc,n.__wbindgen_realloc),h=u,w=n.pptxrenderer_layoutProposalSlideJson(this.__wbg_ptr,e.__wbg_ptr,s,h,i);var a=w[0],l=w[1];if(w[3])throw a=0,l=0,_(w[2]);return r=a,o=l,f(a,l)}finally{n.__wbindgen_free(r,o,1);}}layoutSlideJson(e,t){let i,r;try{A(e,v);let l=n.pptxrenderer_layoutSlideJson(this.__wbg_ptr,e.__wbg_ptr,t);var o=l[0],a=l[1];if(l[3])throw o=0,a=0,_(l[2]);return i=o,r=a,f(o,a)}finally{n.__wbindgen_free(i,r,1);}}layoutSlideProfiledJson(e,t){let i,r;try{A(e,v);let l=n.pptxrenderer_layoutSlideProfiledJson(this.__wbg_ptr,e.__wbg_ptr,t);var o=l[0],a=l[1];if(l[3])throw o=0,a=0,_(l[2]);return i=o,r=a,f(o,a)}finally{n.__wbindgen_free(i,r,1);}}constructor(){let e=n.pptxrenderer_new();return this.__wbg_ptr=e,be.register(this,this.__wbg_ptr,this),this}registerFallbackFont(e,t,i,r){let o=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),a=u,l=J(r,n.__wbindgen_malloc),s=u,h=n.pptxrenderer_registerFallbackFont(this.__wbg_ptr,o,a,t,i,l,s);if(h[2])throw _(h[1]);return h[0]>>>0}registerFont(e,t,i,r){let o=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),a=u,l=J(r,n.__wbindgen_malloc),s=u,h=n.pptxrenderer_registerFont(this.__wbg_ptr,o,a,t,i,l,s);if(h[2])throw _(h[1]);return h[0]>>>0}saveBytes(e){A(e,v);let t=n.pptxrenderer_saveBytes(this.__wbg_ptr,e.__wbg_ptr);if(t[3])throw _(t[2]);var i=F(t[0],t[1]).slice();return n.__wbindgen_free(t[0],t[1]*1,1),i}setActiveSlide(e,t,i){A(e,v);let r=m(t,n.__wbindgen_malloc,n.__wbindgen_realloc),o=u,a=m(i,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u;return n.pptxrenderer_setActiveSlide(this.__wbg_ptr,e.__wbg_ptr,r,o,a,l)!==0}slideLayoutKey(e,t){let i,r;try{A(e,v);let l=n.pptxrenderer_slideLayoutKey(this.__wbg_ptr,e.__wbg_ptr,t);var o=l[0],a=l[1];if(l[3])throw o=0,a=0,_(l[2]);return i=o,r=a,f(o,a)}finally{n.__wbindgen_free(i,r,1);}}snapshotWithLayoutKeysJson(e){let t,i;try{A(e,v);let a=n.pptxrenderer_snapshotWithLayoutKeysJson(this.__wbg_ptr,e.__wbg_ptr);var r=a[0],o=a[1];if(a[3])throw r=0,o=0,_(a[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}};Symbol.dispose&&(N.prototype[Symbol.dispose]=N.prototype.free);function we(d){let e=J(d,n.__wbindgen_malloc),t=u,i=n.decodeTiffPng(e,t);if(i[3])throw _(i[2]);var r=F(i[0],i[1]).slice();return n.__wbindgen_free(i[0],i[1]*1,1),r}function he(d,e){let t,i;try{let a=J(d,n.__wbindgen_malloc),l=u,s=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),h=u,w=n.exportPptxMarkdownJson(a,l,s,h);var r=w[0],o=w[1];if(w[3])throw r=0,o=0,_(w[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}function xe(d,e){let t,i;try{let a=J(d,n.__wbindgen_malloc),l=u,s=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),h=u,w=n.exportPptxStructuredJson(a,l,s,h);var r=w[0],o=w[1];if(w[3])throw r=0,o=0,_(w[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}function Pe(d){let e,t;try{let o=J(d,n.__wbindgen_malloc),a=u,l=n.parsePptxJson(o,a);var i=l[0],r=l[1];if(l[3])throw i=0,r=0,_(l[2]);return e=i,t=r,f(i,r)}finally{n.__wbindgen_free(e,t,1);}}function Se(d){let e,t;try{let o=J(d,n.__wbindgen_malloc),a=u,l=n.parsePptxJsonWithoutMedia(o,a);var i=l[0],r=l[1];if(l[3])throw i=0,r=0,_(l[2]);return e=i,t=r,f(i,r)}finally{n.__wbindgen_free(e,t,1);}}function ve(d,e){let t,i;try{let a=m(d,n.__wbindgen_malloc,n.__wbindgen_realloc),l=u,s=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),h=u,w=n.renderPptxMarkdownJson(a,l,s,h);var r=w[0],o=w[1];if(w[3])throw r=0,o=0,_(w[2]);return t=r,i=o,f(r,o)}finally{n.__wbindgen_free(t,i,1);}}function Re(){let d,e;try{let t=n.rendererVersion();return d=t[0],e=t[1],f(t[0],t[1])}finally{n.__wbindgen_free(d,e,1);}}function ze(){return {__proto__:null,"./pptx_wasm_bg.js":{__proto__:null,__wbg___wbindgen_is_function_1f9d30630b8b1d3d:function(e){return typeof e=="function"},__wbg___wbindgen_is_undefined_8865fb403f8fe9d8:function(e){return e===void 0},__wbg___wbindgen_throw_41e9ee4f547fc59a:function(e,t){throw new Error(f(e,t))},__wbg_call_6137034ef55c9d0f:function(){return te(function(e,t){return e.call(t)},arguments)},__wbg_getRandomValues_a608c4436c19407a:function(){return te(function(e,t){globalThis.crypto.getRandomValues(F(e,t));},arguments)},__wbg_get_31af05bd4842a84f:function(){return te(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_new_343a093a3c2ffb4e:function(e,t){return new Error(f(e,t))},__wbg_now_811cf3ae387774cf:function(){return performance.now()},__wbg_now_a11c1f81480929eb:function(){return performance.now()},__wbg_now_aa4ccb83129e9e55:function(){return Date.now()},__wbg_random_5a4cafd2f02395ff:function(){return Math.random()},__wbg_set_145a351398b48c65:function(){return te(function(e,t,i){return Reflect.set(e,t,i)},arguments)},__wbg_set_name_2c630595dc90a7aa:function(e,t,i){e.name=f(t,i);},__wbg_static_accessor_GLOBAL_266715b9d96ba635:function(){let e=typeof global>"u"?null:global;return M(e)?0:q(e)},__wbg_static_accessor_GLOBAL_THIS_10fb7dc1ae063179:function(){let e=typeof globalThis>"u"?null:globalThis;return M(e)?0:q(e)},__wbg_static_accessor_SELF_0b583911f537483a:function(){let e=typeof self>"u"?null:self;return M(e)?0:q(e)},__wbg_static_accessor_WINDOW_d7f903d1508cbdc4:function(){let e=typeof window>"u"?null:window;return M(e)?0:q(e)},__wbindgen_generic_0000000000000001:function(e,t){return f(e,t)},__wbindgen_init_externref_table:function(){let e=n.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,true),e.set(t+3,false);}}}}var ye=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(d=>n.__wbg_pptxdocument_free(d,1)),be=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(d=>n.__wbg_pptxrenderer_free(d,1));function q(d){let e=n.__externref_table_alloc();return n.__wbindgen_externrefs.set(e,d),e}function A(d,e){if(!(d instanceof e))throw new Error(`expected instance of ${e.name}`)}function F(d,e){return d=d>>>0,B().subarray(d/1,d/1+e)}function f(d,e){return $e(d>>>0,e)}var K=null;function B(){return (K===null||K.byteLength===0)&&(K=new Uint8Array(n.memory.buffer)),K}function te(d,e){try{return d.apply(this,e)}catch(t){let i=q(t);n.__wbindgen_exn_store(i);}}function M(d){return d==null}function J(d,e){let t=e(d.length*1,1)>>>0;return B().set(d,t/1),u=d.length,t}function m(d,e,t){if(t===void 0){let l=V.encode(d),s=e(l.length,1)>>>0;return B().subarray(s,s+l.length).set(l),u=l.length,s}let i=d.length,r=e(i,1)>>>0,o=B(),a=0;for(;a<i;a++){let l=d.charCodeAt(a);if(l>127)break;o[r+a]=l;}if(a!==i){a!==0&&(d=d.slice(a)),r=t(r,i,i=a+d.length*3,1)>>>0;let l=B().subarray(r+a,r+i),s=V.encodeInto(d,l);a+=s.written,r=t(r,i,a,1)>>>0;}return u=a,r}function _(d){let e=n.__wbindgen_externrefs.get(d);return n.__externref_table_dealloc(d),e}var re=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true});re.decode();var Ze=2146435072,de=0;function $e(d,e){return de+=e,de>=Ze&&(re=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}),re.decode(),de=e),re.decode(B().subarray(d,d+e))}var V=new TextEncoder;"encodeInto"in V||(V.encodeInto=function(d,e){let t=V.encode(d);return e.set(t),{read:d.length,written:t.length}});var u=0,n;function Xe(d,e){return n=d.exports,K=null,n.__wbindgen_start(),n}async function Qe(d,e){if(typeof Response=="function"&&d instanceof Response){if(!d.ok)throw new Error(`failed to fetch Wasm: ${d.status} ${d.statusText} fetching '${d.url}'`);if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(d,e)}catch(r){if(t(d.type)&&d.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}let i=await d.arrayBuffer();return await WebAssembly.instantiate(i,e)}else {let i=await WebAssembly.instantiate(d,e);return i instanceof WebAssembly.Instance?{instance:i,module:d}:i}function t(i){switch(i){case "basic":case "cors":case "default":return true}return false}}async function Te(d){if(n!==void 0)return n;if(d!==void 0&&(Object.getPrototypeOf(d)===Object.prototype?{module_or_path:d}=d:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),d===void 0)throw new Error("pptx-wasm requires an explicit module or URL");let e=ze();(typeof d=="string"||typeof Request=="function"&&d instanceof Request||typeof URL=="function"&&d instanceof URL)&&(d=fetch(d));let{instance:t,module:i}=await Qe(await d,e);return Xe(t)}var le=false,k=class extends Error{constructor(t,i){super(i);a(this,"code",t);this.name="PresentationPeerError";}},et=["insertText","deleteText","formatText","setStoryParagraphs","insertParagraphBreak","setParagraphAlignment","insertTableRow","deleteTableRow","insertTableColumn","deleteTableColumn","insertSlide","duplicateSlide","deleteSlide","moveSlide","setSlideNotes","setSlideLayout","addTextBox","addShape","addPicture","removeShape","moveShape","resizeShape","setShapeRect","setShapeFill","setShapeStroke","setShapeAdjust","bringShapeToFront","sendShapeToBack","bringShapeForward","sendShapeBackward","addComment","replyToComment","setCommentStatus","setCommentPosition","removeComment","setCommentFlavor","propose","acceptProposal","rejectProposal","applyEdits","addUndoBoundary","undo","redo"],Ee=new WeakMap;function j(d){let e=Ee.get(d);if(!e)throw new k("stage","Presentation is not a retained replay handle");return e}function yt(d,e={}){try{return ue(d,e,{kind:"baseline"})}catch(t){throw ne(t)}}function bt(d,e,t={}){try{return ue(d,t,{kind:"peer",identity:e})}catch(i){throw ne(i)}}function wt(d){return j(d).registerFonts()}function ht(d){j(d).adopt();}function xt(d){return j(d).hydration()}function Pt(d){return j(d).metadata()}function St(d,e){return j(d).displayListJson(e)}function vt(d,e,t){return j(d).replay(e,t)}var ke=new WeakMap,Ce=new WeakMap,Ie=new WeakMap,Oe=new WeakMap;function Rt(d,e){let t=Ie.get(d);if(!t)throw new Error("Presentation story formatting is unavailable");return t(e)}function Tt(d,e,t,i){let r=Oe.get(d);if(!r)throw new Error("Presentation paragraph joining is unavailable");return r(e,t,i)}function Jt(d){let e=Ce.get(d);if(!e)throw new Error("Presentation metadata is unavailable");return e()}function Et(d,e){let t=ke.get(d);if(!t)throw new Error("Presentation display list is unavailable");return t(e)}function Je(){return typeof v.prototype.proposeJson=="function"&&typeof N.prototype.layoutProposalSlideJson=="function"}var z;function ce(d=me()){return le?Promise.resolve():z||(z=Te({module_or_path:d}).then(()=>{le=true;},e=>{throw z=void 0,D(e)}),z)}function kt(){return typeof WebAssembly=="object"}function Ct(){return oe(),Re()}function tt(d,e={}){return oe(),ot(()=>e.includeMedia===false?Se(d):Pe(d))}function _e(d){let e=Fe(d);if(!e.ok)throw new ee(e.failure);return e.content}async function It(d,e={}){await ce();let t=I(e);return _e(()=>xe(d,t))}async function Ot(d,e={}){await ce();let t=I(e);return _e(()=>he(d,t))}async function At(d,e={}){await ce();let t=I(e);return _e(()=>ve(JSON.stringify(d),t))}function Ft(d){return oe(),pe(()=>we(d))}function rt(d,e={}){return ue(d,e)}function ue(d,e,t){if(oe(),e.clientId!==void 0&&e.clientId>=q$1){let p="client id must be a positive safe integer below Number.MAX_SAFE_INTEGER - 1";throw t?new k("clientId",p):new Error(p)}let i=t?[...(e.fonts??[]).map(p=>({...p,bytes:new Uint8Array(p.bytes),fallback:false})),...(e.fallbackFonts??[]).map(p=>({...p,bytes:new Uint8Array(p.bytes),fallback:true}))]:[],r=t&&e.initialUpdate!==void 0?new Uint8Array(e.initialUpdate):void 0,o=t?e.clientId:e.clientId??nt(),a=pe(()=>t?t.kind==="baseline"?v.openReplayBaseline(new Uint8Array(d),o,r):v.openPeerDeckJson(new Uint8Array(d),t.identity,r):e.initialUpdate===void 0?v.openCollaborative(d,o):v.openCollaborativeFromUpdate(e.initialUpdate.slice(),o,d.slice())),l;try{l=pe(()=>new N);}catch(p){if(t){try{a.free();}catch{}throw ne(p)}throw p}if(!t){for(let p of e.fonts??[])Z(l,p);for(let p of e.fallbackFonts??[])Z(l,p,true);}let s=new Map,h=[],w=0,E=false,U=false,Y=0,G=false,X=()=>{if(E)throw new Error("presentation handle is disposed")},We=()=>{if(!(E||G||Y!==0)){G=true;try{for(;!E&&h.length>0;){let p=h.shift();if(!p)break;for(let[c,y]of [...s]){if(E)return;if(s.get(c)===y)try{y(p.update.slice(),p.origin);}catch{}}}}finally{G=false,E&&(h.length=0);}}},qe=()=>{if(!(!U||E))for(;;){let p=a.drainUpdateEvent();if(p.byteLength===0)return;let c=p[0];if(c!==0&&c!==1)throw new Error(`pptx wasm returned unknown update origin ${c}`);h.push({update:p.subarray(1),origin:c===0?"local":"remote"});}},x=(p,c=false)=>{X(),Y+=1;try{let y,b,T=!1;try{y=p();}catch(P){b=P,T=!0;}if(c)try{qe();}catch(P){T||(b=P,T=!0);}if(T)throw D(b);return y}finally{Y-=1,Y===0&&We();}},g=(p,c=false)=>x(()=>JSON.parse(p()),c),Ke=()=>{U||(x(()=>a.startUpdateObservation()),U=true);},Ve=()=>{!U||s.size>0||E||(h.length=0,x(()=>a.clearUpdateObservation()),U=false);},ge=new Uint8Array(d),ie=false,O={fork(){X();let p=rt(ge,{initialUpdate:O.encodeStateAsUpdate()});return ie&&p.setCollaborative(),p},setCollaborative(){ie=true,x(()=>a.setCollaborative());},isCollaborative(){return ie},layouts(){X();let p=y=>y.flatMap(b=>[...b.placeholder?[{id:String(b.id),name:b.name,type:b.placeholder.placeholderType,idx:b.placeholder.index}]:[],...p(b.children??[])]),c=tt(ge,{includeMedia:false});return c.layouts.map(y=>({id:y.partPath,name:y.name,type:y.layoutType,masterId:y.masterPartPath??c.masters.find(b=>b.layoutPartPaths.includes(y.partPath))?.partPath??null,placeholders:p(y.shapes)}))},isProposalsAvailable:Je,propose(p,c,y){return g(()=>a.proposeJson(JSON.stringify({agentId:p,note:c,edits:y})))},listProposals(){return Je()?g(()=>a.listProposalsJson()):[]},previewProposal(p){return g(()=>a.previewProposalJson(JSON.stringify({id:p})))},layoutProposalDiffSlide(p,c){return g(()=>l.layoutProposalDiffSlideJson(a,p,c))},layoutProposalSlide(p,c){return g(()=>l.layoutProposalSlideJson(a,p,c))},acceptProposal(p,c){return g(()=>a.acceptProposalJson(JSON.stringify({id:p,force:c?.force??false})),true)},rejectProposal(p){return g(()=>a.rejectProposalJson(JSON.stringify({id:p})))},get clientId(){return x(()=>a.clientId)},snapshot(){return g(()=>a.snapshotJson())},story(p){return g(()=>a.storyJson(JSON.stringify({storyId:p})))},anchorCaret(p,c){return g(()=>a.anchorCaretJson(JSON.stringify({storyId:p,index:c})))},resolveCaretAnchor(p){return g(()=>a.resolveCaretAnchorJson(JSON.stringify({storyId:p.storyId,position:p.position})))},version(){return x(()=>a.documentVersion())},readContent(p={}){let c=I(p);return g(()=>a.readContentJson(c))},readCommandContent(p={}){let c=I(p);return g(()=>a.readCommandContentJson(c))},historyStep(p){return g(()=>p==="undo"?a.undoReceiptJson():a.redoReceiptJson(),true)},findText(p){let c=I(p);return g(()=>a.findTextJson(c))},exportStructured(p={}){let c=I(p);return g(()=>a.exportStructuredJson(c))},exportMarkdown(p={}){let c=I(p);return g(()=>a.exportMarkdownJson(c))},validateEdits(p){let c=I(p);return g(()=>a.validateEditsJson(c))},applyEdits(p){let c=I(p);return g(()=>a.applyEditsJson(c),true)},searchText(p,c={}){if(!p)return [];let y=c.limit??Number.POSITIVE_INFINITY;if(!Number.isSafeInteger(y)&&y!==Number.POSITIVE_INFINITY||y<0)throw new RangeError("search limit must be a non-negative safe integer");return g(()=>a.searchTextJson(JSON.stringify({query:p,caseSensitive:c.caseSensitive??false,limit:Number.isFinite(y)?Math.min(y,4294967295):void 0})))},registerFont(p){return x(()=>Z(l,p))},registerFallbackFont(p){return x(()=>Z(l,p,!0))},layoutSlide(p){return g(()=>l.layoutSlideJson(a,p))},layoutSlideProfiled(p){return g(()=>l.layoutSlideProfiledJson(a,p))},hitTest(p,c){return g(()=>l.hitTestJson(p,c))},mediaBytes(p){return x(()=>a.mediaBytes(p))},save(){return x(()=>l.saveBytes(a))},insertText(p,c,y,b={}){return g(()=>a.insertTextJson(JSON.stringify({storyId:p,index:c,text:y,style:b})),true)},insertTextProfiled(p,c,y,b={}){return g(()=>a.insertTextProfiledJson(JSON.stringify({storyId:p,index:c,text:y,style:b})),true)},deleteText(p,c,y){return g(()=>a.deleteTextJson(JSON.stringify({storyId:p,start:c,end:y})),true)},deleteTextProfiled(p,c,y){return g(()=>a.deleteTextProfiledJson(JSON.stringify({storyId:p,start:c,end:y})),true)},formatText(p,c,y,b){return g(()=>a.formatTextJson(JSON.stringify({storyId:p,start:c,end:y,patch:b})),true)},insertParagraphBreak(p,c){return g(()=>a.insertParagraphBreakJson(JSON.stringify({storyId:p,index:c})),true)},setParagraphAlignment(p,c,y,b){return g(()=>a.setParagraphAlignmentJson(JSON.stringify({storyId:p,start:c,end:y,alignment:b})),true)},insertTableRow(p,c,y,b,T){return g(()=>a.insertTableRowJson(JSON.stringify({slideId:p,shapeId:c,index:y,position:b,cells:T})),true)},checkTableEdit(p,c,y,b,T,P,S){let C={insertTableRow:"insertRow",deleteTableRow:"deleteRow",insertTableColumn:"insertColumn",deleteTableColumn:"deleteColumn"}[p];x(()=>a.checkTableEditJson(JSON.stringify({edit:C,slideId:c,shapeId:y,index:b,position:T,cells:P,width:S})));},deleteTableRow(p,c,y){return g(()=>a.deleteTableRowJson(JSON.stringify({slideId:p,shapeId:c,index:y})),true)},insertTableColumn(p,c,y,b,T,P){return g(()=>a.insertTableColumnJson(JSON.stringify({slideId:p,shapeId:c,index:y,position:b,cells:T,width:P})),true)},deleteTableColumn(p,c,y){return g(()=>a.deleteTableColumnJson(JSON.stringify({slideId:p,shapeId:c,index:y})),true)},insertSlide(p,c){return g(()=>a.insertSlideJson(JSON.stringify({index:p,layoutPartPath:c??null})),true)},setStoryParagraphs(p,c){return g(()=>a.setStoryParagraphsJson(JSON.stringify({storyId:p,paragraphs:c})),true)},duplicateSlide(p,c){return g(()=>a.duplicateSlideJson(JSON.stringify({slideId:p,toIndex:c})),true)},insertSlideProfiled(p,c){return g(()=>a.insertSlideProfiledJson(JSON.stringify({index:p,layoutPartPath:c??null})),true)},deleteSlide(p){return g(()=>a.deleteSlideJson(JSON.stringify({slideId:p})),true)},moveSlide(p,c){return g(()=>a.moveSlideJson(JSON.stringify({slideId:p,toIndex:c})),true)},setSlideLayout(p,c,y=[]){let b=y.map(([T,P])=>{if(!/^\d+$/u.test(P)||!Number.isSafeInteger(Number(P))||Number(P)>4294967295)throw new Error("Invalid layout placeholder ID");return [T,Number(P)]});g(()=>a.setSlideLayoutJson(JSON.stringify({slideId:p,layoutPartPath:c,mapping:b})),true);},setSlideNotes(p,c){g(()=>a.setSlideNotesJson(JSON.stringify({slideId:p,text:c})),true);},addComment(p,c){return g(()=>a.addCommentJson(JSON.stringify({slideId:p,author:c.author,initials:c.initials??"",text:c.text,created:c.created,xEmu:c.xEmu??0,yEmu:c.yEmu??0})),true)},replyToComment(p,c){return g(()=>a.replyToCommentJson(JSON.stringify({commentId:p,author:c.author,initials:c.initials??"",text:c.text,created:c.created})),true)},setCommentPosition(p,c){if(!Number.isSafeInteger(c.xEmu)||!Number.isSafeInteger(c.yEmu))throw new Error("Comment coordinates must be safe integer EMU");return g(()=>a.setCommentPositionJson(JSON.stringify({commentId:p,...c})),true)},setCommentStatus(p,c){return g(()=>a.setCommentStatusJson(JSON.stringify({commentId:p,resolved:c})),true)},removeComment(p){return g(()=>a.removeCommentJson(JSON.stringify({commentId:p})),true)},setCommentFlavor(p){return g(()=>a.setCommentFlavorJson(JSON.stringify({flavor:p})),true)},comments(){return g(()=>a.commentsJson())},addTextBox(p,c){return g(()=>a.addTextBoxJson(JSON.stringify({slideId:p,draft:c})),true)},addTextBoxProfiled(p,c){return g(()=>a.addTextBoxProfiledJson(JSON.stringify({slideId:p,draft:c})),true)},addShape(p,c){return g(()=>a.addShapeJson(JSON.stringify({slideId:p,draft:c})),true)},addPicture(p,c){return g(()=>a.addPictureJson(JSON.stringify({slideId:p,...c})),true)},setShapeFill(p,c,y){return g(()=>a.setShapeFillJson(JSON.stringify({slideId:p,shapeId:c,color:y})),true)},setShapeStroke(p,c,y){return g(()=>a.setShapeStrokeJson(JSON.stringify({slideId:p,shapeId:c,stroke:y})),true)},setShapeAdjust(p,c,y){return g(()=>a.setShapeAdjustJson(JSON.stringify({slideId:p,shapeId:c,adjustments:y})),true)},removeShape(p,c){return g(()=>a.removeShapeJson(JSON.stringify({slideId:p,shapeId:c})),true)},bringShapeToFront(p,c){return g(()=>a.bringShapeToFrontJson(JSON.stringify({slideId:p,shapeId:c})),true)},sendShapeToBack(p,c){return g(()=>a.sendShapeToBackJson(JSON.stringify({slideId:p,shapeId:c})),true)},bringShapeForward(p,c){return g(()=>a.bringShapeForwardJson(JSON.stringify({slideId:p,shapeId:c})),true)},sendShapeBackward(p,c){return g(()=>a.sendShapeBackwardJson(JSON.stringify({slideId:p,shapeId:c})),true)},moveShape(p,c,y,b){return g(()=>a.moveShapeJson(JSON.stringify({slideId:p,shapeId:c,x:y,y:b})),true)},moveShapeProfiled(p,c,y,b){return g(()=>a.moveShapeProfiledJson(JSON.stringify({slideId:p,shapeId:c,x:y,y:b})),true)},resizeShape(p,c,y,b){return g(()=>a.resizeShapeJson(JSON.stringify({slideId:p,shapeId:c,width:y,height:b})),true)},setShapeRect(p,c,y){return g(()=>a.setShapeRectJson(JSON.stringify({slideId:p,shapeId:c,rect:y})),true)},canUndo(){return x(()=>a.canUndo())},canRedo(){return x(()=>a.canRedo())},undoCaptureMode(){return x(()=>a.undoCaptureMode())},setUndoCaptureMode(p){x(()=>a.setUndoCaptureMode(p));},addUndoBoundary(){x(()=>a.addUndoBoundary());},undo(){return g(()=>a.undoJson(),true)},undoProfiled(){return g(()=>a.undoProfiledJson(),true)},redo(){return g(()=>a.redoJson(),true)},encodeStateVector(){return x(()=>a.encodeStateVector())},encodeStateAsUpdate(p){return x(()=>p===void 0?a.encodeStateAsUpdate():a.encodeDiff(p))},encodeDiff(p){return x(()=>a.encodeDiff(p))},applyUpdate(p){return g(()=>a.applyUpdateJson(p),true)},onUpdate(p){if(X(),typeof p!="function")throw new TypeError("update listener must be a function");let c=w++;s.set(c,p);try{Ke();}catch(b){throw s.delete(c),b}let y=true;return ()=>{y&&(y=false,s.delete(c),Ve());}},dispose(){if(E)return;E=true,i.length=0,s.clear(),h.length=0;let p;if(U){try{a.clearUpdateObservation();}catch(c){p=c;}U=false;}try{l.free();}catch(c){p??(p=c);}try{a.free();}catch(c){p??(p=c);}if(p!==void 0)throw D(p)}};if(ke.set(O,p=>x(()=>l.layoutSlideJson(a,p))),Ce.set(O,()=>g(()=>a.sessionMetadataJson())),Ie.set(O,p=>g(()=>a.storyFormattingJson(JSON.stringify({slideId:p.slideId,shapeId:p.shapeId,storyId:p.storyId})))),t||Oe.set(O,(p,c,y)=>g(()=>a.deleteTextJson(JSON.stringify({storyId:p,start:c,end:y,allowParagraphJoin:true})),true)),Object.defineProperty(O,Symbol.for("@betteroffice/pptx/slide-layout-cache"),{value:{snapshot:()=>g(()=>l.snapshotWithLayoutKeysJson(a)),key:p=>x(()=>l.slideLayoutKey(a,p)),activate:(p,c)=>x(()=>l.setActiveSlide(a,p,c)),hitTest:(p,c,y)=>g(()=>l.hitTestSlideJson(a,p,c,y))}}),t){let p="deck",c="",y,b=false,T=S=>{p="failed",i.length=0;try{O.dispose();}catch{}throw ne(S)},P=S=>{if(E||p!==S)throw new k("stage",`Presentation peer requires ${S} stage`)};Ee.set(O,{metadata(){return P("ready"),g(()=>a.sessionMetadataJson())},displayListJson(S){return P("ready"),x(()=>l.layoutSlideJson(a,S))},async registerFonts(){try{P("deck"),p="registering";let S=[];for(let C of i){let se=await globalThis.crypto.subtle.digest("SHA-256",C.bytes);P("registering"),S.push({family:C.family,bold:C.bold??!1,italic:C.italic??!1,fallback:C.fallback,fingerprint:Array.from(new Uint8Array(se),W=>W.toString(16).padStart(2,"0")).join("")});}c=JSON.stringify(S),x(()=>{for(let C of i)Z(l,C,C.fallback);t.kind==="peer"&&a.registerPeerFontsJson(c);}),i.length=0,p="fonts";}catch(S){return T(S)}},adopt(){try{if(P("fonts"),t.kind!=="peer")throw new k("stage","Only a peer can adopt identity");x(()=>a.adoptPeerIdentity()),p="ready";}catch(S){return T(S)}},hydration(){if(t.kind!=="baseline")throw new k("stage","Only the worker baseline can capture hydration");if(y!==void 0)return P("ready"),y;try{return P("fonts"),y=x(()=>a.peerHydrationJson(c)),p="ready",y}catch(S){return T(S)}},replay(S,C){if(P("ready"),b||G)throw new k("stage","Presentation replay cannot reenter");b=true;try{let se=I(S);return x(()=>{let W=JSON.parse(a.replayJson(se));return Ae(W),C?.(W),W},!0)}finally{b=false;}}});for(let S of [...et,"insertTextProfiled","deleteTextProfiled","insertSlideProfiled","addTextBoxProfiled","moveShapeProfiled","undoProfiled","applyUpdate","setUndoCaptureMode","registerFont","registerFallbackFont","historyStep","readCommandContent"])Object.defineProperty(O,S,{value:()=>{throw new k("stage","Retained presentations require ordered replay")}});}return O}function Ae(d){if(!(d===null||typeof d!="object")){for(let e of Object.values(d))Ae(e);Object.freeze(d);}}function ne(d){let e=D(d);return e instanceof k?e:new k("engine",e.message)}function I(d){return JSON.stringify(d,(e,t)=>{if(typeof t=="number"&&!Number.isFinite(t))throw new RangeError("host requests must not contain NaN or infinite numbers");return t})}function Z(d,e,t=false){try{return (t?d.registerFallbackFont:d.registerFont).call(d,e.family,e.bold??!1,e.italic??!1,e.bytes)}catch(i){throw D(i)}}function oe(){if(!le)throw new Error("pptx wasm is not initialized; call initWasm() first")}function nt(){let d=globalThis.crypto;if(!d||typeof d.getRandomValues!="function")throw new Error("crypto.getRandomValues is required to generate a collaboration client ID");let e=new Uint32Array(2),t;do d.getRandomValues(e),t=(e[0]&2097151)*4294967296+e[1];while(t===0||t>=q$1);return t}function pe(d){try{return d()}catch(e){throw D(e)}}function Fe(d){try{return JSON.parse(d())}catch(e){throw D(e)}}function ot(d){return Fe(d)}function D(d){if(d instanceof k)return d;if(d!==null&&typeof d=="object"&&"name"in d&&d.name==="PresentationPeerError"&&"code"in d&&typeof d.code=="string"&&"message"in d&&typeof d.message=="string")return new k(d.code,d.message);if(d instanceof Error)return d;if(typeof d=="string")try{let e=JSON.parse(d);if(e.code==="staleProposal"&&Array.isArray(e.targets)&&e.targets.every(t=>typeof t=="string"))return new Q(e.targets)}catch{}return Object.assign(new Error(typeof d=="string"?d:String(d)),{cause:d})}var L=class extends Error{constructor(t,i,r){super(i);a(this,"code",t);a(this,"cause",r);a(this,"refusal");this.name="PptxPeerHydrationError",this.refusal={code:t};}},Me=class extends Error{constructor(){super("Presentation editor is not ready");a(this,"code","peer-not-ready");this.name="PptxPeerNotReadyError";}},Ue=class extends Error{constructor(t){super(`Presentation worker editor failed: ${t instanceof Error?t.message:String(t)}`);a(this,"cause",t);a(this,"code","editor-failed");this.name="PptxWorkerEditorFailedError";}},Ne=class extends Error{constructor(){super("Presentation worker editor is disposed");a(this,"code","editor-disposed");this.name="PptxWorkerEditorDisposedError";}},De=class extends Error{constructor(){super("Collaboration is unavailable in the presentation worker editor");a(this,"code","collaboration-unavailable");this.name="PptxWorkerEditorCollaborationError";}};var Bt="SessionSuperseded",H=class extends Error{constructor(t,i,r){super(i);a(this,"code",t);a(this,"diagnostics",r);this.name="SessionFailure";}};function Be(d,e){let t=new Set,i=false;function r(o,a){if(i)return ()=>{};d.addEventListener(o,a);let l=()=>{d.removeEventListener(o,a),t.delete(l);};return t.add(l),d.start?.(),l}return {post(o,a=[]){if(i)throw new H("disposed","Session transport is closed");d.postMessage(o,a);},listen(o){return r("message",a=>o(a.data))},onError(o){let a=r("error",s=>o(new H("crash",s.message||"Session worker crashed"))),l=r("messageerror",()=>o(new H("message","Session transport received an unreadable message")));return ()=>{a(),l();}},close(){if(!i){i=true;for(let o of [...t])o();e();}}}}function Wt(d){return Be(d,()=>d.terminate())}function qt(d){return Be(d,()=>d.close?.())}function Vt(d){let e=new Set,t=i=>{for(let r of i)r.kind==="image"&&r.assetId?e.add(r.assetId):(r.kind==="chart"||r.kind==="table")&&t(r.primitives);};return t(d.primitives),e}function Zt(d){return d.length>=4&&(d[0]===73&&d[1]===73&&d[2]===42&&d[3]===0||d[0]===77&&d[1]===77&&d[2]===0&&d[3]===42)}var Le=Symbol("session-transfer"),it=Symbol("session-deferred");function Yt(d){return $(d)&&d[it]===true}function Gt(d,e){return {[Le]:true,value:d,transfer:e}}function Xt(d){return $(d)&&d[Le]===true}function je(d,e){return Object.prototype.hasOwnProperty.call(d,e)}function $(d){return d!==null&&typeof d=="object"}function fe(d){return typeof d=="number"&&Number.isSafeInteger(d)&&d>0}function Qt(d){return !$(d)||d.protocol!==1?false:d.kind==="wasm-compile"||d.kind==="dispose"||d.kind==="call"&&fe(d.id)&&typeof d.method=="string"&&Array.isArray(d.args)}function er(d){if(!$(d)||d.protocol!==1)return false;switch(d.kind){case "wasm-module":try{return typeof d.url=="string"&&(d.hydration===void 0||typeof d.hydration=="string")&&Object.prototype.toString.call(d.module)==="[object WebAssembly.Module]"}catch{return false}case "reply":return fe(d.id)&&(d.ok===true&&je(d,"value")||d.ok===false&&$(d.error)&&typeof d.error.name=="string"&&typeof d.error.message=="string");case "event":return typeof d.name=="string"&&je(d,"payload");case "progress":return fe(d.id);case "failure":return ["crash","trap","out-of-memory","message","silence","disposed"].includes(d.code)&&typeof d.message=="string"&&(d.diagnostics===void 0||typeof d.diagnostics=="string");default:return false}}var rr=new WeakMap,nr={beginEditor:true,attachPeer:true,replay:true,flush:true,editorFrame:true,editorSave:true},or={beginEditor:{lane:"interactive"},attachPeer:{lane:"interactive"},replay:{lane:"input",mutates:true,userInput:true},flush:{lane:"interactive"},editorFrame:{lane:"interactive",reframes:true},editorSave:{lane:"interactive"}},ir={insertText:true,deleteText:true,formatText:true,setStoryParagraphs:true,insertParagraphBreak:true,setParagraphAlignment:true,insertSlide:true,duplicateSlide:true,deleteSlide:true,moveSlide:true,setSlideNotes:true,setSlideLayout:true,addTextBox:true,addShape:true,addPicture:true,removeShape:true,moveShape:true,resizeShape:true,setShapeRect:true,setShapeFill:true,setShapeStroke:true,setShapeAdjust:true,bringShapeToFront:true,sendShapeToBack:true,bringShapeForward:true,sendShapeBackward:true,addComment:true,replyToComment:true,setCommentStatus:true,setCommentPosition:true,removeComment:true,setCommentFlavor:true,propose:true,acceptProposal:true,rejectProposal:true,applyEdits:true,addUndoBoundary:true,undo:true,redo:true};function He(d,e){if(Object.is(d,e))return true;if(!d||!e||typeof d!="object"||typeof e!="object"||Array.isArray(d)!==Array.isArray(e))return false;let t=Object.keys(d),i=Object.keys(e);return t.length===i.length&&t.every(r=>Object.prototype.hasOwnProperty.call(e,r)&&He(d[r],e[r]))}function sr(d,e){return e.consumed===true&&d.sequence===e.sequence&&d.revision===e.revision&&d.version===e.version&&d.engineVersion===e.engineVersion&&He(d.outcome,e.outcome)}var dr={open:true,version:true,readContent:true,findText:true,validateEdits:true,applyEdits:true,frame:true,slides:true,slideSize:true,save:true,dispose:true},lr={open:{lane:"interactive"},version:{lane:"interactive"},readContent:{lane:"interactive"},findText:{lane:"interactive"},validateEdits:{lane:"interactive"},applyEdits:{lane:"input",mutates:true,userInput:true},frame:{lane:"interactive",reframes:true,key:"frame",replaceableBy:"frame"},slides:{lane:"interactive"},slideSize:{lane:"interactive"},save:{lane:"interactive"},dispose:{lane:"interactive"}};function ur(d){if(d instanceof L)return d;if(d instanceof k)return new L(d.code,d.message,d);if(d instanceof Error&&"refusal"in d){let e=d.refusal;if(e!==null&&typeof e=="object"&&"code"in e&&typeof e.code=="string")return new L(e.code,d.message,d)}return d}export{rt as A,L as B,Me as C,Ue as D,Ne as E,De as F,Yt as G,Gt as H,Xt as I,je as J,Qt as K,er as L,Bt as M,H as N,Wt as O,qt as P,Vt as Q,rr as R,nr as S,or as T,ir as U,sr as V,dr as W,lr as X,ur as Y,Zt as a,me as b,Q as c,ee as d,k as e,yt as f,bt as g,wt as h,ht as i,xt as j,Pt as k,St as l,vt as m,Rt as n,Tt as o,Jt as p,Et as q,Je as r,ce as s,kt as t,Ct as u,tt as v,It as w,Ot as x,At as y,Ft as z};
@@ -0,0 +1 @@
1
+ import {c,g as g$1,h,i,d as d$1,f,m,r,j as j$1,n,l as l$1,t,s,p as p$1,k,o,u,x}from'./chunk-2CPM3HRW.js';import {a}from'./chunk-O2XFH626.js';var O=new WeakMap;function ee(n,e){O.set(n,e);}function D(n){return O.get(n)}var l=class extends Error{constructor(t,r,s){super(r);a(this,"code");a(this,"cause");this.name="CollaborationError",this.code=t,this.cause=s;}};function G(n){return n instanceof Error&&n.message?n.message:typeof n=="string"&&n?n:"Unknown error"}var $=["backpressure","protocol","replica","transport"],g=64,Q=250;function X(n){if(n[0]!==0||n[1]!==2)return false;let e=0;for(let t=2,r=0;t<Math.min(n.byteLength,7);t++,r+=7)if(e+=(n[t]&127)*2**r,n[t]<128)return t+1+e===n.byteLength;return false}var y=class{constructor(e,t,r){a(this,"transport",t);a(this,"options",r);a(this,"endpoint");a(this,"statusListeners",new Map);a(this,"errorListeners",new Map);a(this,"peerListeners",new Map);a(this,"nextListenerId",0);a(this,"connectionStatus","disconnected");a(this,"isSynced",false);a(this,"peerList",[]);a(this,"seq",0);a(this,"floor",0);a(this,"sendFloor",0);a(this,"inboundBytes",0);a(this,"flushingFrames",false);a(this,"queue",[]);a(this,"posting",false);a(this,"flushQueued",false);a(this,"heldTimer",null);a(this,"urgent",false);a(this,"unsubscribeTransport",null);a(this,"subscription",0);a(this,"wantsConnection",false);a(this,"connectAttempt",0);a(this,"leaveFrame",null);a(this,"pendingFrames",[]);a(this,"queuedBytes",0);a(this,"isDestroyed",false);a(this,"closed",false);this.endpoint=e.open(s=>this.receive(s),s=>this.lose(s)),this.enqueue({op:"create",seq:++this.seq,options:r.worker});}get status(){return this.connectionStatus}get synced(){return this.isSynced}get pendingBytes(){return this.queuedBytes}get peers(){return this.peerList}setCursor(e,t){this.isDestroyed||this.enqueue({op:"cursor",seq:++this.seq,cursor:e,broadcast:t});}onPeers(e){if(this.isDestroyed)return ()=>{};let t=this.nextListenerId++;return this.peerListeners.set(t,e),e(this.peers),()=>this.peerListeners.delete(t)}onStatus(e){if(this.isDestroyed)return ()=>{};let t=this.nextListenerId++;return this.statusListeners.set(t,e),()=>this.statusListeners.delete(t)}onError(e){if(this.isDestroyed)return ()=>{};let t=this.nextListenerId++;return this.errorListeners.set(t,e),()=>this.errorListeners.delete(t)}connect(){if(this.isDestroyed||this.connectionStatus==="connected"||this.connectionStatus==="connecting")return;if(this.closed){this.report(this.options.makeError("replica","Collaboration replica is retired"));return}this.wantsConnection=true,this.floor=++this.seq,this.enqueue({op:"connect",seq:this.floor});let e=++this.connectAttempt;if(this.setStatus("connecting",false),!(!this.wantsConnection||this.isDestroyed||e!==this.connectAttempt)){if(!this.unsubscribeTransport){let t=++this.subscription,r;try{if(r=this.transport.onEvent(s=>this.forward(t,s)),typeof r!="function")throw new TypeError("Transport event subscription must return a function")}catch(s){this.subscription+=1,this.fail(this.transportError("Failed to subscribe to transport events",s));return}if(!this.wantsConnection||this.isDestroyed||e!==this.connectAttempt||t!==this.subscription){try{r();}catch(s){this.isDestroyed||this.report(this.transportError("Failed to unsubscribe from stale transport events",s));}return}this.unsubscribeTransport=r;}try{let t=this.transport.connect();t&&t.catch(r=>{!this.isDestroyed&&this.wantsConnection&&this.connectAttempt===e&&this.fail(this.transportError("Transport connect failed",r));});}catch(t){this.fail(this.transportError("Transport connect failed",t));}}}disconnect(){if(this.isDestroyed)return;if(this.closed){this.setStatus("disconnected",false);return}if(!(this.wantsConnection||this.unsubscribeTransport!==null||this.connectionStatus!=="disconnected"))return;this.sendLeave(),this.floor=++this.seq,this.enqueue({op:"disconnect",seq:this.floor});let t=this.release(true);this.setStatus("disconnected",false);for(let r of t)this.report(r);}destroy(){if(this.isDestroyed)return;let e=!this.closed&&(this.wantsConnection||this.unsubscribeTransport!==null||this.connectionStatus==="connecting"||this.connectionStatus==="connected");e&&this.sendLeave(),this.floor=++this.seq,this.enqueue({op:"destroy",seq:this.floor});let t=this.closed?[]:this.release(e);this.isDestroyed=true,this.setStatus("destroyed",false);for(let r of t)this.report(r);this.statusListeners.clear(),this.errorListeners.clear(),this.peerListeners.clear();}transportError(e,t){return this.options.normalize("transport",e,t)}release(e){this.wantsConnection=false,this.connectAttempt+=1,this.leaveFrame=null,this.clearQueue(),this.clearPeers();let t=[],r=this.unsubscribeTransport;if(this.unsubscribeTransport=null,this.subscription+=1,r)try{r();}catch(s){t.push(this.transportError("Failed to unsubscribe from transport events",s));}if(!e)return t;try{let s=this.transport.disconnect();s&&s.catch(o=>{this.isDestroyed||this.report(this.transportError("Transport disconnect failed",o));});}catch(s){t.push(this.transportError("Transport disconnect failed",s));}return t}fail(e){if(this.isDestroyed||!this.wantsConnection)return;let t=e.code;this.floor=++this.seq,this.enqueue({op:"fail",seq:this.floor,error:{code:typeof t=="string"&&$.includes(t)?t:"transport",message:e.message}});let r=this.release(true);this.setStatus("disconnected",false),this.report(e);for(let s of r)this.report(s);}sendLeave(){let e=this.leaveFrame;if(this.leaveFrame=null,!(!e||!this.options.hasUser||!this.unsubscribeTransport||this.connectionStatus!=="connected"))try{this.transport.send(e);}catch(t){this.report(this.transportError("Failed to send awareness leave",t));}}enqueue(e,t=false){this.closed||(this.queue.push(e),this.schedule(t));}schedule(e){if(e||(this.urgent=true),!(this.posting||this.flushQueued)){if(e){this.heldTimer??(this.heldTimer=setTimeout(()=>{this.heldTimer=null,this.flush();},Q));return}this.flushQueued=true,queueMicrotask(()=>{this.flushQueued=false,this.flush();});}}flush(){if(this.posting||this.closed||this.queue.length===0)return;this.heldTimer!==null&&(clearTimeout(this.heldTimer),this.heldTimer=null);let e=this.queue;this.queue=[],this.urgent=false,this.posting=true;let t=e.some(o=>o.op==="destroy"),r=e.reduce((o,a)=>a.op==="event"&&a.event.type==="message"?o+a.event.data.byteLength+g:o,0),s;try{s=this.endpoint.post(e,u(e));}catch(o){s=Promise.reject(o);}s.then(()=>{this.posting=false,this.inboundBytes-=r,t?this.close():this.urgent?this.flush():this.queue.length>0&&this.schedule(true);},o=>{this.posting=false,this.inboundBytes-=r,this.lose(G(o));});}forward(e,t){if(!(this.closed||this.isDestroyed||e!==this.subscription))switch(t.type){case "message":if(this.inboundBytes===0?t.data.byteLength>this.options.maxPendingBytes:t.data.byteLength+g>this.options.maxPendingBytes-this.inboundBytes){this.fail(this.options.makeError("backpressure","Pending replica data exceeds the byte limit"));return}this.inboundBytes+=t.data.byteLength+g,this.enqueue({op:"event",seq:++this.seq,event:{type:"message",data:t.data.slice().buffer}},!this.isSynced&&X(t.data)&&this.inboundBytes<=this.options.maxPendingBytes/2);return;case "open":case "close":this.clearQueue(),t.type==="close"&&(this.connectAttempt+=1,this.leaveFrame=null),this.sendFloor=++this.seq,this.enqueue({op:"event",seq:this.sendFloor,event:t.type==="open"?{type:"open"}:{type:"close",...t.reason!==void 0&&{reason:t.reason}}}),t.type==="close"&&(this.clearPeers(),this.setStatus("disconnected",false));return;case "drain":this.flushPending();return;case "error":this.fail(this.transportError("Transport error",t.error));return;default:this.fail(this.options.makeError("transport","Unknown transport event"));}}receive(e){for(let t of e){if(this.closed||this.isDestroyed)return;if(t.do==="lost"){this.lose("Collaboration replica is retired");return}if(!(t.through<this.floor))switch(t.do){case "unsubscribe":{let r=this.release(false);for(let s of r)this.report(s);break}case "disconnect":{this.wantsConnection=false;let r=this.release(true);for(let s of r)this.report(s);break}case "send":t.through>=this.sendFloor&&this.send(new Uint8Array(t.data));break;case "leave":t.through>=this.sendFloor&&(this.leaveFrame=t.data?new Uint8Array(t.data):null);break;case "status":t.through>=this.sendFloor&&this.setStatus(t.status,t.synced);break;case "peers":{if(t.through<this.sendFloor||t.peers.length===0&&this.peerList.length===0)break;let r=this.options.rebasePeer,s=t.timeOrigin-x();this.peerList=r?t.peers.map(o=>r(o,s)):t.peers,this.emitPeers();break}case "error":this.report(this.options.makeError(t.error.code,t.error.message));break}}}send(e){if(!this.unsubscribeTransport)return;if(this.pendingFrames.length>0){this.queueFrame(e);return}let t=this.sendFloor,r;try{r=this.transport.send(e.slice());}catch(s){this.fail(this.transportError("Transport send failed",s));return}if(typeof r!="boolean"){this.fail(this.options.makeError("transport","Transport send must return a boolean"));return}!r&&this.unsubscribeTransport!==null&&t===this.sendFloor&&this.queueFrame(e);}queueFrame(e){if(e.byteLength>this.options.maxPendingBytes-this.queuedBytes){this.fail(this.options.makeError("backpressure",`Pending collaboration data exceeds ${this.options.maxPendingBytes} bytes`));return}this.pendingFrames.push(e),this.queuedBytes+=e.byteLength;}flushPending(){if(!this.flushingFrames){this.flushingFrames=true;try{for(;this.unsubscribeTransport&&this.pendingFrames.length>0;){let e=this.pendingFrames[0],t;try{t=this.transport.send(e.slice());}catch(r){this.fail(this.transportError("Transport send failed",r));return}if(typeof t!="boolean"){this.fail(this.options.makeError("transport","Transport send must return a boolean"));return}if(!t||this.pendingFrames[0]!==e)return;this.pendingFrames.shift(),this.queuedBytes-=e.byteLength;}}finally{this.flushingFrames=false;}}}clearQueue(){this.pendingFrames.length=0,this.queuedBytes=0;}lose(e){if(this.closed||(this.close(),this.isDestroyed))return;this.sendLeave();let t=this.release(this.wantsConnection||this.connectionStatus!=="disconnected");setTimeout(()=>{if(!this.isDestroyed){this.setStatus("disconnected",false),this.report(this.options.makeError("replica",e));for(let r of t)this.report(r);}},0);}close(){this.closed||(this.closed=true,this.queue=[],this.heldTimer!==null&&(clearTimeout(this.heldTimer),this.heldTimer=null),this.endpoint.close());}clearPeers(){this.peerList.length!==0&&(this.peerList=[],this.emitPeers());}setStatus(e,t){if(!(this.connectionStatus===e&&this.isSynced===t)){this.connectionStatus=e,t&&!this.isSynced&&this.queue.length>0&&this.schedule(false),this.isSynced=t;for(let[r,s]of [...this.statusListeners])if(this.statusListeners.get(r)===s)try{s({status:e,synced:t});}catch{}}}emitPeers(){let e=this.peers;for(let[t,r]of [...this.peerListeners])if(this.peerListeners.get(t)===r)try{r(e);}catch{}}report(e){for(let[t,r]of [...this.errorListeners])if(this.errorListeners.get(t)===r)try{r(e);}catch{}}};var j=16*1024*1024,Y=16*1024*1024;function C(n,e,t){if(!Number.isSafeInteger(e)||e<(t?0:1))throw new RangeError(`${n} must be ${t?"a non-negative":"a positive"} integer`);return e}function J(n){return n instanceof Error&&n.message?n.message:typeof n=="string"&&n?n:"Unknown error"}function p(n,e,t){return t instanceof l?t:new l(n,`${e}: ${J(t)}`,t)}function d(n,e){if(!(n instanceof Uint8Array))throw new TypeError(`${e} must return a Uint8Array`);return n.slice()}function T(n){typeof n=="object"&&n&&"unref"in n&&n.unref();}function K(n){if(!Number.isSafeInteger(n)||n<0)throw new RangeError("Replica clientId must be a non-negative safe integer");return n}function Z(n){if(n===null)return null;if(!n||typeof n.slideId!="string"||n.slideId.length===0)throw new TypeError("Presence cursor slideId must be a non-empty string");if(n.shapeId!==void 0&&(typeof n.shapeId!="string"||n.shapeId.length===0))throw new TypeError("Presence cursor shapeId must be a non-empty string");return n.shapeId?{slideId:n.slideId,shapeId:n.shapeId}:{slideId:n.slideId}}var _=new WeakMap,N=new WeakMap;function ue(n){return _.get(n)()}function de(n){return N.get(n)()}var M=class{constructor(e,t,r={}){a(this,"piped");a(this,"openEpoch",0);a(this,"replica");a(this,"transport");a(this,"maxFrameBytes");a(this,"maxMessagesPerFrame");a(this,"maxPendingBytes");a(this,"localClientId");a(this,"localUser");a(this,"remotePresence");a(this,"statusListeners",new Map);a(this,"errorListeners",new Map);a(this,"presenceListeners",new Map);a(this,"pendingFrames",[]);a(this,"unsubscribeReplica");a(this,"unsubscribeTransport",()=>{});a(this,"hasTransportSubscription",false);a(this,"connectionStatus","disconnected");a(this,"isSynced",false);a(this,"wantsConnection",false);a(this,"isOpen",false);a(this,"isDestroyed",false);a(this,"epoch",0);a(this,"connectAttempt",0);a(this,"nextListenerId",0);a(this,"queuedBytes",0);a(this,"incoming",[]);a(this,"incomingBytes",0);a(this,"incomingBusy",false);a(this,"asyncReplica",false);a(this,"incomingGeneration",0);a(this,"isFlushing",false);a(this,"localClock",0);a(this,"reportedClockExhaustion",false);a(this,"localCursor",null);a(this,"applyingArrival");a(this,"lastAwarenessSentAt",0);a(this,"cursorTimer",null);a(this,"heartbeatTimer",null);a(this,"expiryTimer",null);this.replica=e,"setCollaborative"in e&&e.setCollaborative?.(),this.transport=t,this.localClientId=K(e.clientId),this.localUser=c(this.localClientId,r.user),this.remotePresence=new g$1(this.localClientId),this.maxFrameBytes=C("maxFrameBytes",r.maxFrameBytes??h,false),this.maxMessagesPerFrame=C("maxMessagesPerFrame",r.maxMessagesPerFrame??i,false),this.maxPendingBytes=C("maxPendingBytes",r.maxPendingBytes??j,true),_.set(this,()=>this.beginArrival()),N.set(this,()=>this.leaveFrame());let s=D(e);if(s){this.unsubscribeReplica=()=>{},this.piped=new y(s,t,{worker:{maxFrameBytes:this.maxFrameBytes,maxMessagesPerFrame:this.maxMessagesPerFrame,user:{...this.localUser}},maxPendingBytes:this.maxPendingBytes,hasUser:true,makeError:(o,a,c)=>new l(o,a,c),normalize:p});return}try{this.unsubscribeReplica=e.onUpdate((o,a)=>{a==="local"&&this.forwardLocalUpdate(o);});}catch(o){throw p("replica","Failed to observe replica updates",o)}}get status(){return this.piped?this.piped.status:this.connectionStatus}get synced(){return this.piped?this.piped.synced:this.isSynced}get pendingBytes(){return this.piped?this.piped.pendingBytes:this.queuedBytes}get peers(){return this.piped?this.piped.peers:this.remotePresence.peers}setCursor(e){if(this.isDestroyed||this.piped?.status==="destroyed")return;let t=Z(e),r=!t||d$1(t)?t:null;if(t&&!r){let s=new l("protocol",`Presence cursor identifiers exceed ${1024} characters; cursor dropped`);this.report(s);}if(!f(this.localCursor,r)){if(this.localCursor=r,this.piped)return this.piped.setCursor(r,true);this.isOpen&&this.wantsConnection&&this.scheduleCursorBroadcast();}}connect(){if(this.piped)return this.piped.connect();if(this.isDestroyed||this.isOpen||this.connectionStatus==="connecting")return;this.wantsConnection=true;let e=this.hasTransportSubscription?this.epoch:++this.epoch,t=++this.connectAttempt;if(this.setStatus("connecting",false),!!this.isCurrent(e)){if(!this.hasTransportSubscription){let r;try{if(r=this.transport.onEvent(s=>this.handleTransportEvent(e,s)),typeof r!="function")throw new TypeError("Transport event subscription must return a function")}catch(s){this.failConnection(e,p("transport","Failed to subscribe to transport events",s));return}if(!this.isCurrent(e)){try{r();}catch(s){this.isDestroyed||this.report(p("transport","Failed to unsubscribe from stale transport events",s));}return}this.unsubscribeTransport=r,this.hasTransportSubscription=true;}try{let r=this.transport.connect();r&&r.catch(s=>{this.isCurrent(e)&&this.connectAttempt===t&&this.failConnection(e,p("transport","Transport connect failed",s));});}catch(r){this.failConnection(e,p("transport","Transport connect failed",r));}}}disconnect(){if(this.piped)return this.piped.disconnect();if(this.isDestroyed||!(this.wantsConnection||this.isOpen||this.hasTransportSubscription||this.connectionStatus!=="disconnected"))return;if(this.isOpen&&this.wantsConnection){let s=this.epoch;if(this.broadcastLocalPresence(true),!this.isCurrent(s))return}this.stopPresenceTimers(),this.wantsConnection=false,this.isOpen=false,this.epoch+=1,this.connectAttempt+=1;let t=this.takeTransportSubscription();this.clearPending(),this.clearRemotePresence();let r=this.cleanupTransport(t,true);this.setStatus("disconnected",false);for(let s of r)this.report(s);}destroy(){if(this.piped){this.piped.destroy(),this.isDestroyed=true,this.errorListeners.clear();return}if(this.isDestroyed||(this.isOpen&&this.wantsConnection&&this.broadcastLocalPresence(true),this.isDestroyed))return;let e=this.wantsConnection||this.isOpen||this.hasTransportSubscription||this.connectionStatus==="connecting"||this.connectionStatus==="connected";this.stopPresenceTimers(),this.isDestroyed=true,this.wantsConnection=false,this.isOpen=false,this.epoch+=1,this.connectAttempt+=1;let t=this.takeTransportSubscription();this.clearPending(),this.clearRemotePresence();let r=this.cleanupTransport(t,e);this.setStatus("destroyed",false);for(let s of r)this.report(s);try{this.unsubscribeReplica();}catch(s){this.report(p("replica","Failed to unsubscribe from replica updates",s));}this.unsubscribeReplica=()=>{},this.statusListeners.clear(),this.errorListeners.clear(),this.presenceListeners.clear();}onStatus(e){if(this.isDestroyed)return ()=>{};if(typeof e!="function")throw new TypeError("status listener must be a function");if(this.piped)return this.piped.onStatus(e);let t=this.nextListenerId++;return this.statusListeners.set(t,e),()=>this.statusListeners.delete(t)}onError(e){if(this.isDestroyed)return ()=>{};if(typeof e!="function")throw new TypeError("error listener must be a function");if(this.piped){let r=this.piped.onError(e),s=this.nextListenerId++;return this.errorListeners.set(s,e),()=>{r(),this.errorListeners.delete(s);}}let t=this.nextListenerId++;return this.errorListeners.set(t,e),()=>this.errorListeners.delete(t)}onPresence(e){if(this.isDestroyed)return ()=>{};if(typeof e!="function")throw new TypeError("presence listener must be a function");if(this.piped)return this.piped.onPeers(r=>{try{e(r);}catch{}});let t=this.nextListenerId++;this.presenceListeners.set(t,e);try{e(this.peers);}catch{}return ()=>this.presenceListeners.delete(t)}beginArrival(){let e=this.epoch,t=this.openEpoch,r=this.applyingArrival;r&&(r.deferred=true);let s=false,o=a=>{s||(s=true,this.isCurrent(e)&&this.isOpen&&this.openEpoch===t&&a());};return {settle:()=>o(()=>{r?.synced&&this.setStatus("connected",true);}),fail:a=>o(()=>this.failConnection(e,p("replica","Failed to apply remote update",a)))}}leaveFrame(){if(!this.isOpen||this.isDestroyed||!this.wantsConnection||this.localClock>=Number.MAX_SAFE_INTEGER)return null;try{let e=this.localClock+1;return {clock:e,frame:m([{clientId:this.localClientId,clock:e,state:null}],this.maxFrameBytes)}}catch{return null}}isCurrent(e){return !this.isDestroyed&&this.wantsConnection&&e===this.epoch}failConnection(e,t){if(!this.isCurrent(e))return;this.wantsConnection=false,this.isOpen=false,this.epoch+=1,this.connectAttempt+=1,this.stopPresenceTimers();let r=this.takeTransportSubscription();this.clearPending(),this.clearRemotePresence();let s=this.cleanupTransport(r,true);this.setStatus("disconnected",false),this.report(t);for(let o of s)this.report(o);}takeTransportSubscription(){let e=this.unsubscribeTransport;return this.unsubscribeTransport=()=>{},this.hasTransportSubscription=false,e}cleanupTransport(e,t){let r=[];try{e();}catch(s){r.push(p("transport","Failed to unsubscribe from transport events",s));}if(!t)return r;try{let s=this.transport.disconnect();s&&s.catch(o=>{this.isDestroyed||this.report(p("transport","Transport disconnect failed",o));});}catch(s){r.push(p("transport","Transport disconnect failed",s));}return r}handleTransportEvent(e,t){if(this.isCurrent(e))switch(t.type){case "open":this.handleOpen(e);break;case "message":this.isOpen&&this.enqueueMessage(e,t.data);break;case "close":this.isOpen=false,this.connectAttempt+=1,this.stopPresenceTimers(),this.clearPending(),this.clearRemotePresence(),this.setStatus("disconnected",false);break;case "error":this.failConnection(e,p("transport","Transport error",t.error));break;case "drain":this.isOpen&&this.flushPending();break;default:this.failConnection(e,new l("transport","Unknown transport event"));}}handleOpen(e){if(this.isOpen||(this.isOpen=true,this.openEpoch+=1,this.clearPending(),this.setStatus("connected",false),!this.isCurrent(e)||!this.isOpen))return;let t=this.connectAttempt;this.replicaResult(e,t,()=>this.replica.encodeStateVector(),r$1=>{try{let s=d(r$1,"encodeStateVector"),o=r(s);if(this.sendFrame(j$1(o??s,this.maxFrameBytes)),!this.isCurrent(e)||!this.isOpen||(o||this.sendFullUpdate(e,t),!this.isCurrent(e)||!this.isOpen)||(this.startPresenceTimers(),this.broadcastLocalPresence(!1),!this.isCurrent(e)||!this.isOpen))return;this.sendFrame(n(this.maxFrameBytes));}catch(s){this.failConnection(e,p("protocol","Failed to encode handshake",s));}});}sendFullUpdate(e,t){this.replicaResult(e,t,()=>this.replica.encodeStateAsUpdate(),r=>{try{this.sendFrame(l$1(d(r,"encodeStateAsUpdate"),this.maxFrameBytes));}catch(s){this.failConnection(e,p("protocol","Failed to encode handshake",s));}});}replicaResult(e,t,r,s){let o=c=>{this.isCurrent(e)&&this.isOpen&&this.connectAttempt===t&&s(c);},a=c=>{this.isCurrent(e)&&this.isOpen&&this.connectAttempt===t&&this.failConnection(e,p("replica","Collaboration replica operation failed",c));};try{let c=r();if(c instanceof Promise)return this.asyncReplica=!0,c.then(o,a).catch(a);o(c);}catch(c){a(c);}}handleMessage(e,t$1){let r;try{r=t(t$1.slice(),this.maxFrameBytes,this.maxMessagesPerFrame);}catch(a){this.failConnection(e,p("protocol","Invalid collaboration frame",a));return}let s=this.connectAttempt,o$1=a=>{for(;a<r.length;a++){if(!this.isCurrent(e)||!this.isOpen||this.connectAttempt!==s)return;let c=r[a],h;switch(c.type){case "sync-step-1":h=this.answerSyncStep1(e,s,c.stateVector);break;case "sync-step-2":case "update":{let u={deferred:false,synced:c.type==="sync-step-2"};h=this.replicaResult(e,s,()=>{let V=this.applyingArrival;this.applyingArrival=u;try{return this.replica.applyUpdate(p$1(c.update).slice())}finally{this.applyingArrival=V;}},()=>{u.synced&&!u.deferred&&this.setStatus("connected",true);});break}case "awareness":try{let u=o(c.update,this.maxMessagesPerFrame);this.remotePresence.apply(u,Date.now())&&this.emitPresence(),this.schedulePresenceExpiry();}catch(u){this.report(p("protocol","Invalid awareness update",u));}break;case "auth":this.failConnection(e,new l("protocol",c.reason?`Authentication denied: ${c.reason}`:"Authentication denied"));return;case "query-awareness":this.broadcastLocalPresence(false);break}if(h instanceof Promise)return h.then(()=>o$1(a+1))}};return o$1(0)}answerSyncStep1(e,t,r){let s$1=s(r),o=this.replicaResult(e,t,()=>this.replica.encodeStateAsUpdate(p$1(s$1.stateVector).slice()),c=>{try{this.sendFrame(k(d(c,"encodeStateAsUpdate"),this.maxFrameBytes));}catch(h){this.failConnection(e,p("protocol","Failed to encode SyncStep2",h));}});if(!s$1.open)return o;let a=()=>{if(!(!this.isCurrent(e)||!this.isOpen||this.connectAttempt!==t))return this.replicaResult(e,t,()=>this.replica.encodeStateVector(),c=>{try{this.sendFrame(j$1(d(c,"encodeStateVector"),this.maxFrameBytes));}catch(h){this.failConnection(e,p("protocol","Failed to encode handshake",h));}})};return o instanceof Promise?o.then(a):a()}enqueueMessage(e,t){if(this.asyncReplica&&this.incomingBytes+t.byteLength>this.maxPendingBytes){this.failConnection(e,new l("backpressure","Incoming collaboration queue is full"));return}this.incoming.push({token:e,data:t.slice()}),this.incomingBytes+=t.byteLength,this.drainIncoming();}drainIncoming(){if(this.incomingBusy)return;let e=this.incomingGeneration;for(;this.incoming.length;){let t=this.takeUpdateBatch(),r=t?.items??[this.incoming.shift()],s=r.reduce((a,c)=>a+c.data.byteLength,0);this.incomingBusy=true;let o=t?this.applyUpdateBatch(r[0].token,t.updates):this.handleMessage(r[0].token,r[0].data);if(e!==this.incomingGeneration)return;if(o instanceof Promise){o.finally(()=>{e===this.incomingGeneration&&(this.incomingBusy=false,this.incomingBytes-=s,this.drainIncoming());}).catch(()=>{});return}this.incomingBusy=false,this.incomingBytes-=s;}}takeUpdateBatch(){if(!this.asyncReplica||typeof this.replica.applyUpdateChunks!="function")return null;let e=[],t=[],r=Math.min(this.maxFrameBytes,Y),s=0;for(let o of this.incoming){if(o.token!==this.incoming[0].token)break;let a=this.remoteUpdates(o.data),c=a?.reduce((h,u)=>h+u.byteLength,0)??0;if(!a?.length||e.length&&s+c>r)break;e.push(o),t.push(...a),s+=c;}return e.length<2?null:(this.incoming.splice(0,e.length),{items:e,updates:t})}remoteUpdates(e){try{let t$1=t(e.slice(),this.maxFrameBytes,this.maxMessagesPerFrame);return t$1.every(r=>r.type==="update")?t$1.map(r=>p$1(r.update).slice()):null}catch{return null}}applyUpdateBatch(e,t){if(!this.isCurrent(e)||!this.isOpen)return;let r=this.replica;return this.replicaResult(e,this.connectAttempt,()=>r.applyUpdateChunks(t),()=>{})}forwardLocalUpdate(e){if(this.isDestroyed||!this.isOpen||!this.wantsConnection)return;let t=this.epoch,r;try{r=d(e,"Replica update");}catch(s){this.failConnection(t,p("replica","Invalid replica update",s));return}try{this.sendFrame(l$1(r,this.maxFrameBytes));}catch(s){this.failConnection(t,p("protocol","Failed to encode update",s));}}scheduleCursorBroadcast(){if(this.cursorTimer)return;let e=Math.max(0,80-(Date.now()-this.lastAwarenessSentAt));if(e===0){this.broadcastLocalPresence(false);return}this.cursorTimer=setTimeout(()=>{this.cursorTimer=null,this.broadcastLocalPresence(false);},e),T(this.cursorTimer);}broadcastLocalPresence(e){if(!this.isOpen||this.isDestroyed||!this.wantsConnection)return;if(this.localClock>=Number.MAX_SAFE_INTEGER){this.reportedClockExhaustion||(this.reportedClockExhaustion=true,this.report(new l("protocol","Awareness clock exceeds Number.MAX_SAFE_INTEGER")));return}this.localClock+=1;let t=this.localClock,r=e?null:{clientId:this.localClientId,clock:t,user:{...this.localUser},cursor:this.localCursor?{...this.localCursor}:null};this.cursorTimer&&clearTimeout(this.cursorTimer),this.cursorTimer=null,this.lastAwarenessSentAt=Date.now();try{let s=m([{clientId:this.localClientId,clock:t,state:r}],this.maxFrameBytes);e?this.sendLeaveFrameBestEffort(s):this.sendFrame(s);}catch(s){this.report(p("protocol","Failed to encode awareness update",s));}}sendLeaveFrameBestEffort(e){try{this.transport.send(e.slice());}catch{}}startPresenceTimers(){this.stopPresenceTimers(),this.heartbeatTimer=setInterval(()=>{this.broadcastLocalPresence(false);},2e4),T(this.heartbeatTimer),this.schedulePresenceExpiry();}stopPresenceTimers(){this.cursorTimer&&clearTimeout(this.cursorTimer),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.expiryTimer&&clearTimeout(this.expiryTimer),this.cursorTimer=null,this.heartbeatTimer=null,this.expiryTimer=null;}schedulePresenceExpiry(){if(this.expiryTimer&&clearTimeout(this.expiryTimer),this.expiryTimer=null,!this.isOpen||this.isDestroyed)return;let e=this.remotePresence.nextExpiryAt;e!==void 0&&(this.expiryTimer=setTimeout(()=>{this.expiryTimer=null,this.remotePresence.expire(Date.now())&&this.emitPresence(),this.schedulePresenceExpiry();},Math.max(0,e-Date.now())),T(this.expiryTimer));}clearRemotePresence(){this.remotePresence.clear()&&this.emitPresence();}emitPresence(){let e=this.peers;for(let[t,r]of [...this.presenceListeners])if(this.presenceListeners.get(t)===r)try{r(e);}catch{}}sendFrame(e){if(!this.isOpen||this.isDestroyed||!this.wantsConnection)return;let t=this.epoch;if(this.pendingFrames.length>0){this.queueFrame(t,e);return}let r;try{r=this.transport.send(e.slice());}catch(s){this.failConnection(t,p("transport","Transport send failed",s));return}if(typeof r!="boolean"){this.failConnection(t,new l("transport","Transport send must return a boolean"));return}!r&&this.isCurrent(t)&&this.isOpen&&this.queueFrame(t,e);}queueFrame(e,t){if(t.byteLength>this.maxPendingBytes-this.queuedBytes){this.failConnection(e,new l("backpressure",`Pending collaboration data exceeds ${this.maxPendingBytes} bytes`));return}let r=t.slice();this.pendingFrames.push(r),this.queuedBytes+=r.byteLength;}flushPending(){if(!this.isFlushing){this.isFlushing=true;try{for(;this.isOpen&&!this.isDestroyed&&this.pendingFrames.length>0;){let e=this.epoch,t=this.pendingFrames[0],r;try{r=this.transport.send(t.slice());}catch(s){this.failConnection(e,p("transport","Transport send failed",s));return}if(typeof r!="boolean"){this.failConnection(e,new l("transport","Transport send must return a boolean"));return}if(!r||!this.isOpen||this.pendingFrames[0]!==t)return;this.pendingFrames.shift(),this.queuedBytes-=t.byteLength;}}finally{this.isFlushing=false;}}}clearPending(){this.incoming.length=0,this.incomingBytes=0,this.incomingBusy=false,this.incomingGeneration+=1,this.pendingFrames.length=0,this.queuedBytes=0;}setStatus(e,t){if(this.connectionStatus===e&&this.isSynced===t)return;this.connectionStatus=e,this.isSynced=t;let r={status:e,synced:t};for(let[s,o]of [...this.statusListeners])if(this.statusListeners.get(s)===o)try{o(r);}catch{}}report(e){for(let[t,r]of [...this.errorListeners])if(this.errorListeners.get(t)===r)try{r(e);}catch{}}};export{ee as a,D as b,l as c,ue as d,de as e,M as f};
@@ -1,3 +1,3 @@
1
- import {J as J$1}from'./chunk-4FWJR3UX.js';import {a}from'./chunk-H3SEEI4U.js';var W={bold:false,italic:false,underline:"none",fontSizePt:24,color:"#111827",fontFamily:"Arial"};function D(e,n,r,o){let i=Z(e,n,r,o),a=S(i,"underline");return {bold:S(i,"bold"),italic:S(i,"italic"),underline:a===void 0?void 0:a!=="none",fontSize:S(i,"fontSizePt"),textColor:S(i,"color"),fontFamily:S(i,"fontFamily")}}function de(e,n){return D(e,0,e.length,n)}function J(e,n,r,o){let i=D(e,n,r,o);return {bold:i.bold??o.bold,italic:i.italic??o.italic,underline:i.underline===void 0?o.underline:i.underline?"sng":"none",fontSizePt:i.fontSize??o.fontSizePt,color:i.textColor??o.color,fontFamily:i.fontFamily??o.fontFamily}}function Y(e,n,r,o){return {...J(e,n,r,W),...o}}function me(e,n,r,o){if(n!==r)return null;let i={...Y(e,n,r,o),caps:null},a=s=>[...new Set([...Object.keys(s),...Object.keys(i)])].every(m=>(s[m]??null)===(i[m]??null)),t=0;for(let s of e.paragraphs){let d;for(let m of s.runs){let l=t;if(t+=m.text.length,t!==l){if(n>=l&&n<t)return !a(m.style)||n===l&&d&&!a(d.style)?null:{neighbour:"after",start:l,end:t,paragraphId:s.id};d={style:m.style,start:l,end:t};}}if(n===t&&d&&a(d.style))return {neighbour:"before",start:d.start,end:d.end,paragraphId:s.id};t+=1;}return null}function Z(e,n,r,o){let i=$(e,o);if(i.length===0)return [o];let a=Math.min(n,r),t=Math.max(n,r);if(a===t){let m=i.find(p=>a>=p.start&&a<p.end);return m?[m.style]:[[...i].reverse().find(p=>p.end<=a)?.style??i[0].style]}let s=i.filter(m=>m.end>a&&m.start<t).map(m=>m.style);return s.length>0?s:[[...i].reverse().find(m=>m.end<=a)?.style??i[0].style]}function $(e,n){let r=[],o=0;return e.paragraphs.forEach((i,a)=>{for(let t of i.runs){let s=o;o+=t.text.length,o>s&&r.push({start:s,end:o,style:ee(t.style,n)});}a<e.paragraphs.length-1&&(o+=1);}),r}function ee(e,n){return {bold:e.bold??n.bold,italic:e.italic??n.italic,underline:e.underline??n.underline,fontSizePt:e.fontSizePt??n.fontSizePt,color:e.color??n.color,fontFamily:e.fontFamily??n.fontFamily}}function S(e,n){let r=e[0]?.[n];return e.every(o=>o[n]===r)?r:void 0}var le=["insertTableRow","deleteTableRow","insertTableColumn","deleteTableColumn","setShapeFill","setShapeStroke","setShapeAdjust","removeShape","bringShapeToFront","sendShapeToBack","bringShapeForward","sendShapeBackward","insertSlide","deleteSlide","moveSlide","setSlideNotes","addComment","replyToComment","setCommentStatus","setCommentPosition","removeComment","setCommentFlavor","propose","acceptProposal","rejectProposal"],ue=Object.freeze({setChangeObserver:"mode",invoke:"local-write",applyRemoteUpdate:"remote-update",collabPipe:"remote-update",applyEdits:"local-write",registerFont:"local-write",insertTextBox:"local-write",insertShape:"local-write",insertPicture:"local-write",moveShape:"local-write",setShapeRect:"local-write",undo:"local-write",redo:"local-write",insertText:"local-write",replaceText:"local-write",formatText:"local-write",setParagraphAlignment:"local-write",deleteBackward:"local-write",deleteForward:"local-write",paragraphBreak:"local-write",compositionStart:"local-write",compositionCommit:"local-write",activateSlide:"view",selectObject:"view",moveSelection:"view",selectAtPoint:"view",setSelection:"view",compositionEnd:"view",setReadOnly:"mode"}),N=class extends Error{constructor(r,o){super(o);a(this,"seq",r);a(this,"refusal");this.name="CommandOutcomeUnknown",this.refusal={seq:r,reason:"unknown-outcome"};}},ce={openCommandEditor:true,command:true,thumbnailFrame:true,flushCommandEditor:true,saveCommandEditor:true,readEditor:true,prepareCommandPicture:true,accessCommandEditor:true,checkpointCommandEditor:true};function g(e,n){return (e[n]?.columnOffset??0)-(e[0]?.columnOffset??0)}var I,G;function Pe(e,n,r){return r==="word"?ne(e,n):te(e,n)}function ne(e,n){let r=M(e,n);I??(I=new Intl.Segmenter(void 0,{granularity:"word"}));let o=[...I.segment(e)],i=o.find(a=>r>=a.index&&r<a.index+a.segment.length)??o[o.length-1];return i?{start:i.index,end:i.index+i.segment.length}:{start:r,end:r}}function te(e,n){let r=M(e,n),o=e.lastIndexOf(`
1
+ import {J as J$1}from'./chunk-DDNX2Z7E.js';import {a}from'./chunk-O2XFH626.js';var W={bold:false,italic:false,underline:"none",fontSizePt:24,color:"#111827",fontFamily:"Arial"};function D(e,n,r,o){let i=Z(e,n,r,o),a=S(i,"underline");return {bold:S(i,"bold"),italic:S(i,"italic"),underline:a===void 0?void 0:a!=="none",fontSize:S(i,"fontSizePt"),textColor:S(i,"color"),fontFamily:S(i,"fontFamily")}}function de(e,n){return D(e,0,e.length,n)}function J(e,n,r,o){let i=D(e,n,r,o);return {bold:i.bold??o.bold,italic:i.italic??o.italic,underline:i.underline===void 0?o.underline:i.underline?"sng":"none",fontSizePt:i.fontSize??o.fontSizePt,color:i.textColor??o.color,fontFamily:i.fontFamily??o.fontFamily}}function Y(e,n,r,o){return {...J(e,n,r,W),...o}}function me(e,n,r,o){if(n!==r)return null;let i={...Y(e,n,r,o),caps:null},a=s=>[...new Set([...Object.keys(s),...Object.keys(i)])].every(m=>(s[m]??null)===(i[m]??null)),t=0;for(let s of e.paragraphs){let d;for(let m of s.runs){let l=t;if(t+=m.text.length,t!==l){if(n>=l&&n<t)return !a(m.style)||n===l&&d&&!a(d.style)?null:{neighbour:"after",start:l,end:t,paragraphId:s.id};d={style:m.style,start:l,end:t};}}if(n===t&&d&&a(d.style))return {neighbour:"before",start:d.start,end:d.end,paragraphId:s.id};t+=1;}return null}function Z(e,n,r,o){let i=$(e,o);if(i.length===0)return [o];let a=Math.min(n,r),t=Math.max(n,r);if(a===t){let m=i.find(p=>a>=p.start&&a<p.end);return m?[m.style]:[[...i].reverse().find(p=>p.end<=a)?.style??i[0].style]}let s=i.filter(m=>m.end>a&&m.start<t).map(m=>m.style);return s.length>0?s:[[...i].reverse().find(m=>m.end<=a)?.style??i[0].style]}function $(e,n){let r=[],o=0;return e.paragraphs.forEach((i,a)=>{for(let t of i.runs){let s=o;o+=t.text.length,o>s&&r.push({start:s,end:o,style:ee(t.style,n)});}a<e.paragraphs.length-1&&(o+=1);}),r}function ee(e,n){return {bold:e.bold??n.bold,italic:e.italic??n.italic,underline:e.underline??n.underline,fontSizePt:e.fontSizePt??n.fontSizePt,color:e.color??n.color,fontFamily:e.fontFamily??n.fontFamily}}function S(e,n){let r=e[0]?.[n];return e.every(o=>o[n]===r)?r:void 0}var le=["insertTableRow","deleteTableRow","insertTableColumn","deleteTableColumn","setShapeFill","setShapeStroke","setShapeAdjust","removeShape","bringShapeToFront","sendShapeToBack","bringShapeForward","sendShapeBackward","insertSlide","deleteSlide","moveSlide","setSlideNotes","addComment","replyToComment","setCommentStatus","setCommentPosition","removeComment","setCommentFlavor","propose","acceptProposal","rejectProposal"],ue=Object.freeze({setChangeObserver:"mode",invoke:"local-write",applyRemoteUpdate:"remote-update",collabPipe:"remote-update",applyEdits:"local-write",registerFont:"local-write",insertTextBox:"local-write",insertShape:"local-write",insertPicture:"local-write",moveShape:"local-write",setShapeRect:"local-write",undo:"local-write",redo:"local-write",insertText:"local-write",replaceText:"local-write",formatText:"local-write",setParagraphAlignment:"local-write",deleteBackward:"local-write",deleteForward:"local-write",paragraphBreak:"local-write",compositionStart:"local-write",compositionCommit:"local-write",activateSlide:"view",selectObject:"view",moveSelection:"view",selectAtPoint:"view",setSelection:"view",compositionEnd:"view",setReadOnly:"mode"}),N=class extends Error{constructor(r,o){super(o);a(this,"seq",r);a(this,"refusal");this.name="CommandOutcomeUnknown",this.refusal={seq:r,reason:"unknown-outcome"};}},ce={openCommandEditor:true,command:true,thumbnailFrame:true,flushCommandEditor:true,saveCommandEditor:true,readEditor:true,prepareCommandPicture:true,accessCommandEditor:true,checkpointCommandEditor:true};function g(e,n){return (e[n]?.columnOffset??0)-(e[0]?.columnOffset??0)}var I,G;function Pe(e,n,r){return r==="word"?ne(e,n):te(e,n)}function ne(e,n){let r=M(e,n);I??(I=new Intl.Segmenter(void 0,{granularity:"word"}));let o=[...I.segment(e)],i=o.find(a=>r>=a.index&&r<a.index+a.segment.length)??o[o.length-1];return i?{start:i.index,end:i.index+i.segment.length}:{start:r,end:r}}function te(e,n){let r=M(e,n),o=e.lastIndexOf(`
2
2
  `,Math.max(0,r-1))+1,i=e.indexOf(`
3
3
  `,r);return {start:o,end:i===-1?e.length:i}}function Se(e,n){return n.start<e.start?{anchor:e.end,focus:n.start}:n.end>e.end?{anchor:e.start,focus:n.end}:{anchor:e.start,focus:e.end}}function M(e,n){return Number.isFinite(n)?Math.max(0,Math.min(e.length,Math.trunc(n))):0}function oe(e,n){let o=e[A(e,n)]?.caretStops.find(i=>i.position===n.position)?.x;return o===void 0?void 0:o-g(e,A(e,n))}function H(e,n,r,o){if(e.length===0)return {position:n.position,lineIndex:0};let i=A(e,n),a=i+(r==="up"?-1:1),t=e[a];if(!t)return {position:n.position,lineIndex:i};let s=o??oe(e,n),d=s===void 0?void 0:s+g(e,a);return d===void 0?{position:t.start,lineIndex:a}:{position:t.caretStops.reduce((l,p)=>l===null||Math.abs(p.x-d)<Math.abs(l.x-d)?p:l,null)?.position??t.start,lineIndex:a}}function z(e,n,r){let o=M(e,n);I??(I=new Intl.Segmenter(void 0,{granularity:"word"}));let i=[...I.segment(e)].filter(t=>t.isWordLike).flatMap(t=>[t.index,t.index+t.segment.length]),a=r<0?i.filter(t=>t<o):i.filter(t=>t>o);return a.length===0?r<0?0:e.length:r<0?Math.max(...a):Math.min(...a)}function A(e,n){let r=n.lineIndex;if(r!==void 0&&r>=0&&r<e.length&&n.position>=e[r].start&&n.position<=e[r].end)return r;let o=-1;for(let i=0;i<e.length;i+=1){let a=e[i];n.position>=a.start&&n.position<=a.end&&(o=i);}return o===-1?Math.max(0,e.length-1):o}function K(e){return G??(G=new Intl.Segmenter(void 0,{granularity:"grapheme"})),new Set([...[...G.segment(e)].map(n=>n.index),e.length])}var j=new WeakMap;function ge(e){let n=j.get(e);return n||(n=JSON.parse(new TextDecoder().decode(e.displayList)),j.set(e,n)),n}function E(e,n){return JSON.stringify([e,n])}function V(e){return e.paragraphs.reduce((n,r)=>n+r.runs.reduce((o,i)=>o+i.text.length,0),Math.max(0,e.paragraphs.length-1))}function Ee(e){let n={hits:[],lines:new Map};function r(o,i,a){for(let t of o){let s=[...i,t];if(t.shapeId&&n.hits.push({primitive:t,transforms:s,clips:a,...t.kind==="textBox"?{textLength:V(t)}:{}}),t.kind==="textBox"&&t.shapeId&&t.storyId){let d=E(t.shapeId,t.storyId),m=n.lines.get(d)??[];for(let l of t.lines)m.push({box:t,line:l,transforms:s});n.lines.set(d,m);}else (t.kind==="chart"||t.kind==="table")&&r(t.primitives,s,[...a,t]);}}return r(e.primitives,[],[]),n}function ke(e){let n={hits:[],lines:new Map,size:{width:e.width,height:e.height}};function r(o,i,a){for(let t of o){let s={kind:t.kind,shapeId:t.shapeId,x:t.x,y:t.y,w:t.w,h:t.h,...t.transform?{transform:{...t.transform}}:{}},d=[...i,s];if(t.shapeId&&n.hits.push({primitive:s,transforms:d,clips:a,...t.kind==="textBox"?{textLength:V(t)}:{}}),t.kind==="textBox"&&t.shapeId&&t.storyId){s.storyId=t.storyId,s.lines=t.lines.map(p=>({columnOffset:p.columnOffset,x:p.x,y:p.y,height:p.height,start:p.start,end:p.end,caretStops:p.caretStops.map(u=>({position:u.position,x:u.x}))}));let m=E(t.shapeId,t.storyId),l=n.lines.get(m)??[];for(let p of s.lines)l.push({line:p});n.lines.set(m,l);}else (t.kind==="chart"||t.kind==="table")&&r(t.primitives,d,[...a,s]);}}return r(e.primitives,[],[]),n}function q(e,n){if(!n||n.kind==="object")return null;let r=e.lines.get(E(n.shapeId,n.storyId))??[];return r.find(({line:o})=>n.focus>=o.start&&(n.focus<o.end||n.focus===o.end&&n.affinity==="upstream"))??r.find(({line:o})=>n.focus>=o.start&&n.focus<=o.end)??r[r.length-1]??null}function _(e,n,r=false){let o=e.x+e.w/2,i=e.y+e.h/2,a=(e.transform?.rotationDeg??0)*Math.PI/180,t=Math.cos(a),s=Math.sin(a),d=n.x-o,m=n.y-i;if(r){let l=d*t+m*s;m=m*t-d*s,d=l;}return e.transform?.flipH&&(d=-d),e.transform?.flipV&&(m=-m),r?{x:o+d,y:i+m}:{x:o+d*t-m*s,y:i+d*s+m*t}}function U(e,n){let r=[{x:n.x,y:n.y},{x:n.x+n.width,y:n.y},{x:n.x,y:n.y+n.height},{x:n.x+n.width,y:n.y+n.height}];for(let a=e.length-1;a>=0;a-=1)for(let t=0;t<r.length;t+=1)r[t]=_(e[a],r[t]);let o=Math.min(...r.map(a=>a.x)),i=Math.min(...r.map(a=>a.y));return {x:o,y:i,width:Math.max(...r.map(a=>a.x))-o,height:Math.max(...r.map(a=>a.y))-i}}function v(e,n){let r=e.caretStops[0];return r?e.caretStops.reduce((o,i)=>Math.abs(i.position-n)<Math.abs(o.position-n)?i:o,r).x:e.x}function Ie(e,n){let r=q(e,n);if(!r||!n)return {caret:null,selectionRects:[]};let o=U(r.transforms,{x:v(r.line,n.focus),y:r.line.y,width:1,height:r.line.height}),i=[],a=Math.min(n.anchor,n.focus),t=Math.max(n.anchor,n.focus);for(let s of e.lines.get(E(n.shapeId,n.storyId))??[]){if(t<=s.line.start||a>=s.line.end)continue;let d=v(s.line,Math.max(a,s.line.start)),m=v(s.line,Math.min(t,s.line.end));i.push(U(s.transforms,{x:Math.min(d,m),y:s.line.y,width:Math.abs(m-d),height:s.line.height}));}return {caret:o,selectionRects:i}}function ve(e,n,r,o){for(let i=e.hits.length-1;i>=0;i-=1){let a=e.hits[i],t=n,s=false;for(let m of a.transforms)if(t=_(m,t,true),a.clips.includes(m)&&!Q(m,t)&&(s=true,!r))break;let d=a.primitive;if(!(r&&(d.shapeId!==r.shapeId||d.storyId!==r.storyId))&&!(!r&&(s||!Q(d,t))||!d.shapeId)){if(!r&&o!==void 0){let m=Math.min(6/o,d.w/3,d.h/3);if(t.x-d.x<=m||d.x+d.w-t.x<=m||t.y-d.y<=m||d.y+d.h-t.y<=m)return {kind:"shape",shapeId:d.shapeId}}if(d.kind==="textBox"&&d.storyId){let m=r||a.clips.some(c=>"kind"in c&&c.kind==="table"),l=d.lines?.some((c,f,C)=>f>0&&(c.columnOffset??0)!==(C[f-1].columnOffset??0)),p=Number.POSITIVE_INFINITY,u=d.lines?.reduce((c,f)=>{if(!m&&(t.y<f.y||t.y>f.y+f.height))return c;let X=(P=>{let T=P.x,R=P.x;for(let L of P.caretStops)T=Math.min(T,L.x),R=Math.max(R,L.x);let B=Math.max(T-t.x,t.x-R,0),F=Math.max(P.y-t.y,t.y-P.y-P.height,0);return l?B*B+F*F:F})(f);return !c||X<p?(p=X,f):c},void 0),y=u?.caretStops[0];if(u&&y){let c=u.caretStops.reduce((f,C)=>Math.abs(C.x-t.x)<Math.abs(f.x-t.x)?C:f,y);return {kind:"text",shapeId:d.shapeId,storyId:d.storyId,position:c.position,affinity:c.position===u.end?"upstream":"downstream"}}}return {kind:"shape",shapeId:d.shapeId}}}return null}function Q(e,n){return n.x>=e.x&&n.x<=e.x+e.w&&n.y>=e.y&&n.y<=e.y+e.h}function re(e,n,r){if(!n||n.kind==="object")return null;let o=s=>"kind"in s&&s.kind==="table",i=e.find(({primitive:s})=>s.kind==="textBox"&&s.shapeId===n.shapeId&&s.storyId===n.storyId)?.clips.filter(o).pop();if(!i)return null;let a=[];for(let{primitive:s,clips:d,textLength:m}of e){let l=s.storyId;s.kind!=="textBox"||!l||s.shapeId!==n.shapeId||d.filter(o).pop()!==i||a.some(p=>p.storyId===l)||a.push({storyId:l,end:m??0});}let t=a[a.findIndex(s=>s.storyId===n.storyId)+(r?-1:1)];return t?{slideId:n.slideId,shapeId:n.shapeId,storyId:t.storyId,anchor:0,focus:t.end,affinity:t.end>0?"upstream":"downstream"}:{...n}}function Te(e,n,r,o,i){if(r==="nextCell"||r==="previousCell")return e.hits?re(e.hits,n,r==="previousCell"):null;let a=q(e,n);if(!a||!n||n.kind==="object")return null;let t=e.lines.get(E(n.shapeId,n.storyId))??[],s=n.focus,d=a,m;if(!o&&n.anchor!==n.focus&&(r==="left"||r==="right"))s=r==="left"?Math.min(n.anchor,n.focus):Math.max(n.anchor,n.focus);else if(r==="wordLeft"||r==="wordRight"){if(i===void 0)return null;s=z(i,s,r==="wordLeft"?-1:1);}else if(r==="storyStart")d=t[0],s=0;else if(r==="storyEnd")d=t[t.length-1],s=i?.length??d.line.end;else if(r==="lineStart"||r==="lineEnd"){let p=a.line.caretStops;if(!p.length)return null;s=r==="lineStart"?p[0].position:p[p.length-1].position;}else if(r==="left"||r==="right"){let u=(i===void 0?t.flatMap(({line:y})=>y.caretStops.map(c=>c.position)):[...K(i)]).filter(y=>r==="left"?y<s:y>s);u.length&&(s=r==="left"?Math.max(...u):Math.min(...u));}else if(r==="up"||r==="down"){let p=t.map(({line:y})=>y);m=n.goalX??v(a.line,s)-g(p,t.indexOf(a));let u=H(p,{position:s,lineIndex:t.indexOf(a)},r,m);d=t[u.lineIndex],s=u.position;}(r==="left"||r==="right"||r==="wordLeft"||r==="wordRight")&&(d=q(e,{...n,focus:s,affinity:r==="left"||r==="wordLeft"?"upstream":"downstream"})??a);let l={...n,anchor:o?n.anchor:s,focus:s,affinity:s===d.line.end?"upstream":"downstream"};return m===void 0?delete l.goalX:l.goalX=m,l}function Fe(){let e=0,n=new Map;function r(o){for(let[i,a]of n)if(a===o)return {version:o,clock:i}}return {get version(){return e},initialize(o){n.set(e,o);},commit(o){n.set(++e,o);},retain(o){let i=new Set(o);for(let[a,t]of n)a!==e&&!i.has(t)&&n.delete(a);},envelope(o,i){let a=n.get(o.basis.version);if(a===void 0)for(a="unretained";r(a);)a+="\0";return {...i,seq:o.seq,basis:{epoch:o.basis.epoch,version:a},...o.afterSeq===void 0?{}:{afterSeq:o.afterSeq},kind:o.kind,payload:o.payload}},ack(o,i){let a=o.frame?{coversThroughSeq:o.frame.coversThroughSeq,revision:o.frame.epoch,payload:o.frame}:void 0;return {session:o.session,incarnation:0,epoch:o.epoch,throughSeq:o.throughSeq,version:e,selection:o.selection,editState:o.editState,outcomes:o.outcomes.map(({committed:t,...s})=>t?s:{...s,committed:false}),...a?{frame:a}:{},pptx:{incarnation:o.incarnation,version:o.version,outcomes:o.outcomes,dirtySlideIds:o.dirtySlideIds,activeSlideId:o.activeSlideId,historyThroughSeq:o.historyThroughSeq,...o.creation?{creation:o.creation}:{},...o.change?{change:o.change}:{},..."mutationResult"in o?{mutationResult:o.mutationResult}:{},...o.updates?{updates:o.updates}:{},...o.editResult?{editResult:o.editResult}:{},...o.fontId!==void 0?{fontId:o.fontId}:{},...o.slides?{slides:o.slides,size:o.size}:{},...i===void 0?{}:{retainedBasis:r(i)}}}},dispose(){n.clear();}}}function we(e){let n=new Map,r=new Set,o=new Map,i=-1;function a(t){if(t.throughSeq<i)return;for(i=t.throughSeq,n.set(t.pptx.version,t.version),r.add(t.pptx.version);r.size>256;)r.delete(r.values().next().value);for(t.frame&&o.set(t.frame.revision,t.pptx.version);o.size>257;)o.delete(o.keys().next().value);let s=new Set([...r,...o.values(),t.pptx.version]);t.pptx.retainedBasis&&(s.add(t.pptx.retainedBasis.version),n.set(t.pptx.retainedBasis.version,t.pptx.retainedBasis.clock));for(let d of n.keys())s.has(d)||n.delete(d);}return a(e),{envelope(t){return {session:t.session,incarnation:e.incarnation,seq:t.seq,basis:{epoch:t.basis.epoch,version:n.get(t.basis.version)??-1},...t.afterSeq===void 0?{}:{afterSeq:t.afterSeq},kind:t.kind,payload:t.payload}},ack(t){return a(t),{session:t.session,incarnation:t.pptx.incarnation,epoch:t.epoch,throughSeq:t.throughSeq,version:t.pptx.version,selection:t.selection,editState:t.editState,outcomes:t.pptx.outcomes,dirtySlideIds:t.pptx.dirtySlideIds,activeSlideId:t.pptx.activeSlideId,historyThroughSeq:t.pptx.historyThroughSeq,...t.pptx.creation?{creation:t.pptx.creation}:{},...t.pptx.change?{change:t.pptx.change}:{},..."mutationResult"in t.pptx?{mutationResult:t.pptx.mutationResult}:{},...t.pptx.updates?{updates:t.pptx.updates}:{},...t.pptx.editResult?{editResult:t.pptx.editResult}:{},...t.pptx.fontId!==void 0?{fontId:t.pptx.fontId}:{},...t.pptx.slides?{slides:t.pptx.slides,size:t.pptx.size}:{},...t.frame?{frame:t.frame.payload}:t.pptx.activeSlideId===null?{frame:null}:{}}}}}var ie="CommandOutcomeUnknown";function Me(e){return x(e)&&typeof e.session=="string"&&h(e.incarnation)&&k(e.seq)&&x(e.basis)&&h(e.basis.epoch)&&b(e.basis.version)&&(e.afterSeq===void 0||k(e.afterSeq))&&(e.expectVersion===void 0||typeof e.expectVersion=="boolean")&&typeof e.kind=="string"&&J$1(e,"payload")&&(e.inputTime===void 0||b(e.inputTime))&&(e.lastInputTime===void 0||b(e.lastInputTime))&&(e.group===void 0||typeof e.group=="string")&&(e.replay===void 0||e.replay===true)}function qe(e){return x(e)&&typeof e.session=="string"&&h(e.incarnation)&&h(e.epoch)&&h(e.throughSeq)&&b(e.version)&&Array.isArray(e.outcomes)&&e.outcomes.every(ae)&&(e.frame===void 0||se(e.frame))&&(e.revisions===void 0||x(e.revisions)&&h(e.revisions.selection)&&h(e.revisions.layout))}function Xe(e){return e instanceof Error&&e.name===ie&&x(e)&&x(e.refusal)&&k(e.refusal.seq)}function x(e){return e!==null&&typeof e=="object"}function b(e){return typeof e=="number"&&Number.isFinite(e)}function h(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function k(e){return h(e)&&e>0}function ae(e){return x(e)&&k(e.seq)&&(e.status==="applied"||e.status==="noop"||e.status==="refused"||e.status==="cancelled"||e.status==="duplicate")&&(e.reason===void 0||typeof e.reason=="string")&&(e.committed===void 0||e.committed===false)&&(e.affectedSeqs===void 0||Array.isArray(e.affectedSeqs)&&e.affectedSeqs.every(k))}function se(e){return x(e)&&h(e.coversThroughSeq)&&b(e.revision)&&(e.baseRevision===void 0||b(e.baseRevision))&&J$1(e,"payload")}export{W as a,D as b,de as c,J as d,me as e,Me as f,qe as g,Xe as h,Fe as i,we as j,le as k,ue as l,N as m,ce as n,Pe as o,Se as p,K as q,ge as r,Ee as s,ke as t,q as u,U as v,Ie as w,ve as x,Te as y};
@@ -0,0 +1 @@
1
+ var d=Object.defineProperty;var e=(b,a,c)=>a in b?d(b,a,{enumerable:true,configurable:true,writable:true,value:c}):b[a]=c;var f=(b,a,c)=>e(b,typeof a!="symbol"?a+"":a,c);export{f as a};
@@ -1 +1 @@
1
- import'./chunk-YMIVEAXD.js';export{c as CollaborationError,f as CollaborationProvider,a as attachCollaborationPipe,b as collaborationPipeFor}from'./chunk-LIYNXEQC.js';export{b as PRESENCE_LABEL_DURATION_MS,c as presenceColorForClientId}from'./chunk-H3SEEI4U.js';
1
+ import'./chunk-YMIVEAXD.js';export{c as CollaborationError,f as CollaborationProvider,a as attachCollaborationPipe,b as collaborationPipeFor}from'./chunk-JZOLK2OC.js';export{a as PRESENCE_LABEL_DURATION_MS,b as presenceColorForClientId}from'./chunk-2CPM3HRW.js';import'./chunk-O2XFH626.js';
@@ -183,7 +183,14 @@ interface InheritedGeometry {
183
183
  flipH: boolean;
184
184
  flipV: boolean;
185
185
  }
186
+ interface SlideLayoutSnapshot {
187
+ name: string | null;
188
+ type: string | null;
189
+ }
186
190
  interface SlideSnapshot {
191
+ title?: string | null;
192
+ hidden?: boolean | null;
193
+ layout?: SlideLayoutSnapshot | null;
187
194
  id: string;
188
195
  sourcePartPath: string | null;
189
196
  layoutPartPath: string | null;
@@ -755,16 +762,6 @@ interface ValidationSuccess<Preview> {
755
762
  previews: Preview[];
756
763
  }
757
764
 
758
- /**
759
- * Versioned reads and version-checked edit batches over one presentation session. Every shape
760
- * here is plain JSON so it can cross a worker boundary unchanged; the semantics live in Rust.
761
- *
762
- * Text offsets are half-open, story-local UTF-16 positions. A story reads as its paragraphs'
763
- * text joined by `\n` with no trailing separator; soft line breaks read as `\n` too, and
764
- * `PptxParagraphText` tells them apart. Slide, shape, story and paragraph ids anchor targets
765
- * within one session; they are not promised to survive save and reopen.
766
- */
767
-
768
765
  /** Provenance only: it selects neither permissions nor history. */
769
766
  type PptxEditSource = 'host' | 'agent';
770
767
  /** `separate`: exactly one undo step. `none`: outside undo history, keeping existing entries. */
@@ -922,6 +919,7 @@ interface PptxTextField {
922
919
  fieldType?: string;
923
920
  }
924
921
  interface PptxParagraphText {
922
+ list?: PptxExportList | null;
925
923
  paragraphId: string;
926
924
  /** Story offsets of the paragraph's text; a following separator sits at `end`. */
927
925
  start: number;
@@ -1405,10 +1403,10 @@ interface PresentationHandle extends CollaborationReplica {
1405
1403
  setParagraphAlignment(storyId: string, start: number, end: number, alignment: ParagraphAlignment | null): TextReceipt;
1406
1404
  insertTableRow(slideId: string, shapeId: string, index: number, position: 'before' | 'after', cells?: readonly string[]): TableReceipt;
1407
1405
  deleteTableRow(slideId: string, shapeId: string, index: number): TableReceipt;
1408
- insertTableColumn(slideId: string, shapeId: string, index: number, position: 'before' | 'after', cells?: readonly string[]): TableReceipt;
1406
+ insertTableColumn(slideId: string, shapeId: string, index: number, position: 'before' | 'after', cells?: readonly string[], width?: 'split' | 'copy'): TableReceipt;
1409
1407
  deleteTableColumn(slideId: string, shapeId: string, index: number): TableReceipt;
1410
1408
  /** Throws the refusal the matching table edit would throw, without changing the deck. */
1411
- checkTableEdit(method: 'insertTableRow' | 'deleteTableRow' | 'insertTableColumn' | 'deleteTableColumn', slideId: string, shapeId: string, index: number, position?: 'before' | 'after', cells?: readonly string[]): void;
1409
+ checkTableEdit(method: 'insertTableRow' | 'deleteTableRow' | 'insertTableColumn' | 'deleteTableColumn', slideId: string, shapeId: string, index: number, position?: 'before' | 'after', cells?: readonly string[], width?: 'split' | 'copy'): void;
1412
1410
  insertSlide(index: number, layoutPartPath?: string): SlideReceipt;
1413
1411
  insertSlideProfiled(index: number, layoutPartPath?: string): Profiled<SlideReceipt>;
1414
1412
  duplicateSlide(slideId: string, toIndex: number): SlideReceipt;
@@ -1750,4 +1748,4 @@ interface PptxWorkerEditorSession {
1750
1748
  }
1751
1749
  declare function createPptxWorkerEditorSession(bytes: Uint8Array | ArrayBuffer, options?: PptxWorkerEditorOptions): PptxWorkerEditorSession;
1752
1750
 
1753
- export { type PptxExportDiagnostic as $, type PptxAnchor as A, type BlipEffect as B, type CanvasImageResolver as C, type DeckSnapshot as D, type EditProfile as E, type PptxAnchorScope as F, type GeometryPathCommand as G, type HistoryProfile as H, type ImageCrop as I, type PptxCaretAnchor as J, type PptxEditFailure as K, type LayoutProfile as L, type MarkdownAnchor as M, type PptxEditFailureCode as N, type OpenPresentationOptions as O, type Paint as P, type PptxEditHistory as Q, type PptxEditPreview as R, type SlideDisplayList as S, type PptxEditReceipt as T, type PptxEditRefusal as U, type PptxEditRequest as V, type PptxEditResult as W, type PptxEditSource as X, type PptxEditStep as Y, type PptxEditTarget as Z, type PptxExportComment as _, type CaretStop as a, type ShapeKind as a$, type PptxExportDiagnosticCode as a0, PptxExportError as a1, type PptxExportFailure as a2, type PptxExportFailureCode as a3, type PptxExportList as a4, type PptxExportMark as a5, type PptxExportNotes as a6, type PptxExportObject as a7, type PptxExportObjectKind as a8, type PptxExportOptions as a9, type PptxStructuredContent as aA, type PptxTextField as aB, type PptxTextGuard as aC, type PptxTextMatch as aD, type PptxTextRange as aE, type PptxTextSearchOptions as aF, type PptxTextSpan as aG, type PptxTextTarget as aH, type PptxValidationResult as aI, PptxWorkerEditorDisposedError as aJ, type PresentationHandle as aK, type PresetShapeDraft as aL, type PrimitiveTransform as aM, type Profiled as aN, type ProfiledLayout as aO, type Proposal as aP, type ProposalAcceptance as aQ, type ProposalChange as aR, type ProposalDiffSlide as aS, type ProposalEdit as aT, type ProposalPreview as aU, type ProposalTextChange as aV, type ShapeAdjustReceipt as aW, type ShapeDraft as aX, type ShapeFill as aY, type ShapeFillReceipt as aZ, type ShapeGradient as a_, type PptxExportParagraph as aa, type PptxExportRefusal as ab, type PptxExportResult as ac, type PptxExportRun as ad, type PptxExportShape as ae, type PptxExportShapeKind as af, type PptxExportSlide as ag, type PptxExportStory as ah, type PptxExportTable as ai, type PptxExportTableCell as aj, type PptxFindMatch as ak, type PptxFindRequest as al, type PptxFindResult as am, type PptxFindScope as an, type PptxFontFace as ao, type PptxMarkdownContent as ap, type PptxMarkdownOptions as aq, type PptxParagraphText as ar, PptxPeerNotReadyError as as, type PptxReadRequest as at, type PptxReadResult as au, type PptxShapeTarget as av, type PptxSlideTarget as aw, type PptxSourceProvenance as ax, type PptxStoryTarget as ay, type PptxStoryText as az, type ColorTransform as b, type PresentationSessionEvents as b$, type ShapeLineEnd as b0, type ShapeOutline as b1, type ShapePrimitive as b2, type ShapeReceipt as b3, type ShapeRect as b4, type ShapeSnapshot as b5, type ShapeStroke as b6, type ShapeStrokeReceipt as b7, type ShapeZOrderReceipt as b8, type SlideCanvasLike as b9, isWasmAvailable as bA, openPresentation as bB, openPresentationSession as bC, paintSlide as bD, renderPptxMarkdown as bE, sizeCanvasForSlide as bF, wasmVersion as bG, type PresentationSlideSummary as bH, type PresentationWireFrame as bI, SessionFailure as bJ, type PresentationSessionOpenOptions as bK, type OpenPresentationSessionOptions as bL, PptxWorkerEditorFailedError as bM, PptxPeerHydrationError as bN, type PptxWorkerEditorAccess as bO, PptxWorkerEditorCollaborationError as bP, type PptxWorkerEditorFrame as bQ, type PptxWorkerEditorInteractionAccess as bR, type PptxWorkerEditorOperation as bS, type PptxWorkerEditorOptions as bT, type PptxWorkerEditorRecovery as bU, type PptxWorkerEditorReply as bV, type PptxWorkerEditorSession as bW, type PptxWorkerEditorStage as bX, type PptxWorkerEditorState as bY, type PresentationFrame as bZ, type PresentationSession as b_, type SlidePrimitive as ba, type SlideReceipt as bb, type SlideSnapshot as bc, StaleProposalError as bd, type StorySnapshot as be, type Stroke as bf, type StrokeEnd as bg, type TableReceipt as bh, type TextBoxPrimitive as bi, type TextParagraphDraft as bj, type TextReceipt as bk, type TextRunSnapshot as bl, type TextStyle as bm, type TextStylePatch as bn, type TextStyleSnapshot as bo, type TransformReceipt as bp, type UndoCaptureMode as bq, type UpdateEvent as br, type ValidationSuccess as bs, type WasmInitInput as bt, createPptxWorkerEditorSession as bu, exportPptxMarkdown as bv, exportPptxStructured as bw, initWasm as bx, inspectPresentation as by, isProposalsAvailable as bz, type ColorValue as c, type PresentationSessionFont as c0, type PresentationSessionMethods as c1, type PresentationSessionState as c2, type CommentFlavor as d, type CommentReceipt as e, type CommentSnapshot as f, type EditSuccess as g, type ExportCompletion as h, type ExportDiagnostic as i, type ExportSeverity as j, type HistoryResult as k, type HitTestResult as l, type ImageEffect as m, type ImagePrimitive as n, type InheritedGeometry as o, type InspectPresentationOptions as p, type OperationFailure as q, type OperationRefusal as r, type PaintSlideOptions as s, type ParagraphAlignment as t, type ParagraphSnapshot as u, type PictureDraft as v, type PlaceholderPrimitive as w, type PositionedGlyph as x, type PositionedTextLine as y, type PositionedTextRun as z };
1751
+ export { type PptxExportDiagnostic as $, type PptxAnchor as A, type BlipEffect as B, type CanvasImageResolver as C, type DeckSnapshot as D, type EditProfile as E, type PptxAnchorScope as F, type GeometryPathCommand as G, type HistoryProfile as H, type ImageCrop as I, type PptxCaretAnchor as J, type PptxEditFailure as K, type LayoutProfile as L, type MarkdownAnchor as M, type PptxEditFailureCode as N, type OpenPresentationOptions as O, type Paint as P, type PptxEditHistory as Q, type PptxEditPreview as R, type SlideDisplayList as S, type PptxEditReceipt as T, type PptxEditRefusal as U, type PptxEditRequest as V, type PptxEditResult as W, type PptxEditSource as X, type PptxEditStep as Y, type PptxEditTarget as Z, type PptxExportComment as _, type CaretStop as a, type ShapeKind as a$, type PptxExportDiagnosticCode as a0, PptxExportError as a1, type PptxExportFailure as a2, type PptxExportFailureCode as a3, type PptxExportList as a4, type PptxExportMark as a5, type PptxExportNotes as a6, type PptxExportObject as a7, type PptxExportObjectKind as a8, type PptxExportOptions as a9, type PptxStructuredContent as aA, type PptxTextField as aB, type PptxTextGuard as aC, type PptxTextMatch as aD, type PptxTextRange as aE, type PptxTextSearchOptions as aF, type PptxTextSpan as aG, type PptxTextTarget as aH, type PptxValidationResult as aI, PptxWorkerEditorDisposedError as aJ, type PresentationHandle as aK, type PresetShapeDraft as aL, type PrimitiveTransform as aM, type Profiled as aN, type ProfiledLayout as aO, type Proposal as aP, type ProposalAcceptance as aQ, type ProposalChange as aR, type ProposalDiffSlide as aS, type ProposalEdit as aT, type ProposalPreview as aU, type ProposalTextChange as aV, type ShapeAdjustReceipt as aW, type ShapeDraft as aX, type ShapeFill as aY, type ShapeFillReceipt as aZ, type ShapeGradient as a_, type PptxExportParagraph as aa, type PptxExportRefusal as ab, type PptxExportResult as ac, type PptxExportRun as ad, type PptxExportShape as ae, type PptxExportShapeKind as af, type PptxExportSlide as ag, type PptxExportStory as ah, type PptxExportTable as ai, type PptxExportTableCell as aj, type PptxFindMatch as ak, type PptxFindRequest as al, type PptxFindResult as am, type PptxFindScope as an, type PptxFontFace as ao, type PptxMarkdownContent as ap, type PptxMarkdownOptions as aq, type PptxParagraphText as ar, PptxPeerNotReadyError as as, type PptxReadRequest as at, type PptxReadResult as au, type PptxShapeTarget as av, type PptxSlideTarget as aw, type PptxSourceProvenance as ax, type PptxStoryTarget as ay, type PptxStoryText as az, type ColorTransform as b, type PresentationSession as b$, type ShapeLineEnd as b0, type ShapeOutline as b1, type ShapePrimitive as b2, type ShapeReceipt as b3, type ShapeRect as b4, type ShapeSnapshot as b5, type ShapeStroke as b6, type ShapeStrokeReceipt as b7, type ShapeZOrderReceipt as b8, type SlideCanvasLike as b9, isProposalsAvailable as bA, isWasmAvailable as bB, openPresentation as bC, openPresentationSession as bD, paintSlide as bE, renderPptxMarkdown as bF, sizeCanvasForSlide as bG, wasmVersion as bH, type PresentationSlideSummary as bI, type PresentationWireFrame as bJ, SessionFailure as bK, type PresentationSessionOpenOptions as bL, type OpenPresentationSessionOptions as bM, PptxWorkerEditorFailedError as bN, PptxPeerHydrationError as bO, type PptxWorkerEditorAccess as bP, PptxWorkerEditorCollaborationError as bQ, type PptxWorkerEditorFrame as bR, type PptxWorkerEditorInteractionAccess as bS, type PptxWorkerEditorOperation as bT, type PptxWorkerEditorOptions as bU, type PptxWorkerEditorRecovery as bV, type PptxWorkerEditorReply as bW, type PptxWorkerEditorSession as bX, type PptxWorkerEditorStage as bY, type PptxWorkerEditorState as bZ, type PresentationFrame as b_, type SlideLayoutSnapshot as ba, type SlidePrimitive as bb, type SlideReceipt as bc, type SlideSnapshot as bd, StaleProposalError as be, type StorySnapshot as bf, type Stroke as bg, type StrokeEnd as bh, type TableReceipt as bi, type TextBoxPrimitive as bj, type TextParagraphDraft as bk, type TextReceipt as bl, type TextRunSnapshot as bm, type TextStyle as bn, type TextStylePatch as bo, type TextStyleSnapshot as bp, type TransformReceipt as bq, type UndoCaptureMode as br, type UpdateEvent as bs, type ValidationSuccess as bt, type WasmInitInput as bu, createPptxWorkerEditorSession as bv, exportPptxMarkdown as bw, exportPptxStructured as bx, initWasm as by, inspectPresentation as bz, type ColorValue as c, type PresentationSessionEvents as c0, type PresentationSessionFont as c1, type PresentationSessionMethods as c2, type PresentationSessionState as c3, type CommentFlavor as d, type CommentReceipt as e, type CommentSnapshot as f, type EditSuccess as g, type ExportCompletion as h, type ExportDiagnostic as i, type ExportSeverity as j, type HistoryResult as k, type HitTestResult as l, type ImageEffect as m, type ImagePrimitive as n, type InheritedGeometry as o, type InspectPresentationOptions as p, type OperationFailure as q, type OperationRefusal as r, type PaintSlideOptions as s, type ParagraphAlignment as t, type ParagraphSnapshot as u, type PictureDraft as v, type PlaceholderPrimitive as w, type PositionedGlyph as x, type PositionedTextLine as y, type PositionedTextRun as z };
Binary file
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CanvasImageResolver, S as SlideDisplayList } from './editorSession-Cuqxkg-B.js';
2
- export { B as BlipEffect, a as CaretStop, b as ColorTransform, c as ColorValue, d as CommentFlavor, e as CommentReceipt, f as CommentSnapshot, D as DeckSnapshot, E as EditProfile, g as EditSuccess, h as ExportCompletion, i as ExportDiagnostic, j as ExportSeverity, G as GeometryPathCommand, H as HistoryProfile, k as HistoryResult, l as HitTestResult, I as ImageCrop, m as ImageEffect, n as ImagePrimitive, o as InheritedGeometry, p as InspectPresentationOptions, L as LayoutProfile, M as MarkdownAnchor, O as OpenPresentationOptions, q as OperationFailure, r as OperationRefusal, P as Paint, s as PaintSlideOptions, t as ParagraphAlignment, u as ParagraphSnapshot, v as PictureDraft, w as PlaceholderPrimitive, x as PositionedGlyph, y as PositionedTextLine, z as PositionedTextRun, A as PptxAnchor, F as PptxAnchorScope, J as PptxCaretAnchor, K as PptxEditFailure, N as PptxEditFailureCode, Q as PptxEditHistory, R as PptxEditPreview, T as PptxEditReceipt, U as PptxEditRefusal, V as PptxEditRequest, W as PptxEditResult, X as PptxEditSource, Y as PptxEditStep, Z as PptxEditTarget, _ as PptxExportComment, $ as PptxExportDiagnostic, a0 as PptxExportDiagnosticCode, a1 as PptxExportError, a2 as PptxExportFailure, a3 as PptxExportFailureCode, a4 as PptxExportList, a5 as PptxExportMark, a6 as PptxExportNotes, a7 as PptxExportObject, a8 as PptxExportObjectKind, a9 as PptxExportOptions, aa as PptxExportParagraph, ab as PptxExportRefusal, ac as PptxExportResult, ad as PptxExportRun, ae as PptxExportShape, af as PptxExportShapeKind, ag as PptxExportSlide, ah as PptxExportStory, ai as PptxExportTable, aj as PptxExportTableCell, ak as PptxFindMatch, al as PptxFindRequest, am as PptxFindResult, an as PptxFindScope, ao as PptxFontFace, ap as PptxMarkdownContent, aq as PptxMarkdownOptions, ar as PptxParagraphText, as as PptxPeerNotReadyError, at as PptxReadRequest, au as PptxReadResult, av as PptxShapeTarget, aw as PptxSlideTarget, ax as PptxSourceProvenance, ay as PptxStoryTarget, az as PptxStoryText, aA as PptxStructuredContent, aB as PptxTextField, aC as PptxTextGuard, aD as PptxTextMatch, aE as PptxTextRange, aF as PptxTextSearchOptions, aG as PptxTextSpan, aH as PptxTextTarget, aI as PptxValidationResult, aJ as PptxWorkerEditorDisposedError, aK as PresentationHandle, aL as PresetShapeDraft, aM as PrimitiveTransform, aN as Profiled, aO as ProfiledLayout, aP as Proposal, aQ as ProposalAcceptance, aR as ProposalChange, aS as ProposalDiffSlide, aT as ProposalEdit, aU as ProposalPreview, aV as ProposalTextChange, aW as ShapeAdjustReceipt, aX as ShapeDraft, aY as ShapeFill, aZ as ShapeFillReceipt, a_ as ShapeGradient, a$ as ShapeKind, b0 as ShapeLineEnd, b1 as ShapeOutline, b2 as ShapePrimitive, b3 as ShapeReceipt, b4 as ShapeRect, b5 as ShapeSnapshot, b6 as ShapeStroke, b7 as ShapeStrokeReceipt, b8 as ShapeZOrderReceipt, b9 as SlideCanvasLike, ba as SlidePrimitive, bb as SlideReceipt, bc as SlideSnapshot, bd as StaleProposalError, be as StorySnapshot, bf as Stroke, bg as StrokeEnd, bh as TableReceipt, bi as TextBoxPrimitive, bj as TextParagraphDraft, bk as TextReceipt, bl as TextRunSnapshot, bm as TextStyle, bn as TextStylePatch, bo as TextStyleSnapshot, bp as TransformReceipt, bq as UndoCaptureMode, br as UpdateEvent, bs as ValidationSuccess, bt as WasmInitInput, bu as createPptxWorkerEditorSession, bv as exportPptxMarkdown, bw as exportPptxStructured, bx as initWasm, by as inspectPresentation, bz as isProposalsAvailable, bA as isWasmAvailable, bB as openPresentation, bC as openPresentationSession, bD as paintSlide, bE as renderPptxMarkdown, bF as sizeCanvasForSlide, bG as wasmVersion } from './editorSession-Cuqxkg-B.js';
1
+ import { C as CanvasImageResolver, S as SlideDisplayList } from './editorSession-Cl_EWgAi.js';
2
+ export { B as BlipEffect, a as CaretStop, b as ColorTransform, c as ColorValue, d as CommentFlavor, e as CommentReceipt, f as CommentSnapshot, D as DeckSnapshot, E as EditProfile, g as EditSuccess, h as ExportCompletion, i as ExportDiagnostic, j as ExportSeverity, G as GeometryPathCommand, H as HistoryProfile, k as HistoryResult, l as HitTestResult, I as ImageCrop, m as ImageEffect, n as ImagePrimitive, o as InheritedGeometry, p as InspectPresentationOptions, L as LayoutProfile, M as MarkdownAnchor, O as OpenPresentationOptions, q as OperationFailure, r as OperationRefusal, P as Paint, s as PaintSlideOptions, t as ParagraphAlignment, u as ParagraphSnapshot, v as PictureDraft, w as PlaceholderPrimitive, x as PositionedGlyph, y as PositionedTextLine, z as PositionedTextRun, A as PptxAnchor, F as PptxAnchorScope, J as PptxCaretAnchor, K as PptxEditFailure, N as PptxEditFailureCode, Q as PptxEditHistory, R as PptxEditPreview, T as PptxEditReceipt, U as PptxEditRefusal, V as PptxEditRequest, W as PptxEditResult, X as PptxEditSource, Y as PptxEditStep, Z as PptxEditTarget, _ as PptxExportComment, $ as PptxExportDiagnostic, a0 as PptxExportDiagnosticCode, a1 as PptxExportError, a2 as PptxExportFailure, a3 as PptxExportFailureCode, a4 as PptxExportList, a5 as PptxExportMark, a6 as PptxExportNotes, a7 as PptxExportObject, a8 as PptxExportObjectKind, a9 as PptxExportOptions, aa as PptxExportParagraph, ab as PptxExportRefusal, ac as PptxExportResult, ad as PptxExportRun, ae as PptxExportShape, af as PptxExportShapeKind, ag as PptxExportSlide, ah as PptxExportStory, ai as PptxExportTable, aj as PptxExportTableCell, ak as PptxFindMatch, al as PptxFindRequest, am as PptxFindResult, an as PptxFindScope, ao as PptxFontFace, ap as PptxMarkdownContent, aq as PptxMarkdownOptions, ar as PptxParagraphText, as as PptxPeerNotReadyError, at as PptxReadRequest, au as PptxReadResult, av as PptxShapeTarget, aw as PptxSlideTarget, ax as PptxSourceProvenance, ay as PptxStoryTarget, az as PptxStoryText, aA as PptxStructuredContent, aB as PptxTextField, aC as PptxTextGuard, aD as PptxTextMatch, aE as PptxTextRange, aF as PptxTextSearchOptions, aG as PptxTextSpan, aH as PptxTextTarget, aI as PptxValidationResult, aJ as PptxWorkerEditorDisposedError, aK as PresentationHandle, aL as PresetShapeDraft, aM as PrimitiveTransform, aN as Profiled, aO as ProfiledLayout, aP as Proposal, aQ as ProposalAcceptance, aR as ProposalChange, aS as ProposalDiffSlide, aT as ProposalEdit, aU as ProposalPreview, aV as ProposalTextChange, aW as ShapeAdjustReceipt, aX as ShapeDraft, aY as ShapeFill, aZ as ShapeFillReceipt, a_ as ShapeGradient, a$ as ShapeKind, b0 as ShapeLineEnd, b1 as ShapeOutline, b2 as ShapePrimitive, b3 as ShapeReceipt, b4 as ShapeRect, b5 as ShapeSnapshot, b6 as ShapeStroke, b7 as ShapeStrokeReceipt, b8 as ShapeZOrderReceipt, b9 as SlideCanvasLike, ba as SlideLayoutSnapshot, bb as SlidePrimitive, bc as SlideReceipt, bd as SlideSnapshot, be as StaleProposalError, bf as StorySnapshot, bg as Stroke, bh as StrokeEnd, bi as TableReceipt, bj as TextBoxPrimitive, bk as TextParagraphDraft, bl as TextReceipt, bm as TextRunSnapshot, bn as TextStyle, bo as TextStylePatch, bp as TextStyleSnapshot, bq as TransformReceipt, br as UndoCaptureMode, bs as UpdateEvent, bt as ValidationSuccess, bu as WasmInitInput, bv as createPptxWorkerEditorSession, bw as exportPptxMarkdown, bx as exportPptxStructured, by as initWasm, bz as inspectPresentation, bA as isProposalsAvailable, bB as isWasmAvailable, bC as openPresentation, bD as openPresentationSession, bE as paintSlide, bF as renderPptxMarkdown, bG as sizeCanvasForSlide, bH as wasmVersion } from './editorSession-Cl_EWgAi.js';
3
3
  export { C as CollaborationProvider, P as PRESENCE_LABEL_DURATION_MS, p as presenceColorForClientId } from './presence-C1o8TDwu.js';
4
4
  export { A as AsyncCollaborationReplica, b as CollaborationError, c as CollaborationErrorCode, d as CollaborationErrorListener, e as CollaborationProviderOptions, C as CollaborationReplica, f as CollaborationStatus, g as CollaborationStatusChange, h as CollaborationStatusListener, i as CollaborationTransport, j as CollaborationTransportEvent, k as CollaborationUpdateOrigin, l as CollaborationUser, m as PptxPresence, P as PptxPresenceCursor, n as PptxPresenceListener, a as PptxPresencePeer, o as PptxPresenceState, p as PptxPresenceUser } from './types-ui_ARP0o.js';
5
5