@betteroffice/pptx 0.5.1 → 0.6.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.
Files changed (57) hide show
  1. package/LICENSES/MIT-ruzstd.txt +21 -0
  2. package/LICENSES/MIT-twox-hash.txt +21 -0
  3. package/LICENSES/MIT-wuff.txt +20 -0
  4. package/README.md +24 -5
  5. package/dist/chunk-2XA2UH2O.js +1 -0
  6. package/dist/chunk-4WP5ZWYV.js +1 -0
  7. package/dist/chunk-65A2TX24.js +1 -0
  8. package/dist/chunk-663FARNX.js +1 -0
  9. package/dist/chunk-AYLLA7XR.js +1 -0
  10. package/dist/chunk-AZDGFDN2.js +1 -0
  11. package/dist/chunk-CCVGR3MS.js +1 -0
  12. package/dist/chunk-COS6CTH7.js +2 -0
  13. package/dist/chunk-G54T5CXF.js +1 -0
  14. package/dist/chunk-GAM2OAAP.js +2 -0
  15. package/dist/chunk-GHET7GIK.js +1 -0
  16. package/dist/chunk-GR7EGQ2Z.js +1 -0
  17. package/dist/chunk-HZODDD5T.js +1 -0
  18. package/dist/chunk-J54GRQWZ.js +1 -0
  19. package/dist/chunk-JJV35WHH.js +2 -0
  20. package/dist/chunk-KGEED2XY.js +1 -0
  21. package/dist/chunk-OUNTNO7R.js +1 -0
  22. package/dist/chunk-QRAGGQDN.js +1 -0
  23. package/dist/chunk-QWRXUT7T.js +1 -0
  24. package/dist/chunk-RNJM2LKC.js +3 -0
  25. package/dist/chunk-S6HKAO2F.js +1 -0
  26. package/dist/chunk-S6UYP4BX.js +1 -0
  27. package/dist/chunk-T6VUFMNC.js +1 -0
  28. package/dist/chunk-TRT2B252.js +10 -0
  29. package/dist/collaboration.js +1 -1
  30. package/dist/{editorSession-Cl_EWgAi.d.ts → editorSession-qQaVvMVR.d.ts} +346 -6
  31. package/dist/generated/metafile_svg_wasm_bg.wasm +0 -0
  32. package/dist/generated/pptx_wasm_bg.wasm +0 -0
  33. package/dist/generated/pptx_wasm_lean_bg.wasm +0 -0
  34. package/dist/generated/preflight/pptx_preflight_bg.wasm +0 -0
  35. package/dist/index.d.ts +21 -18
  36. package/dist/index.js +1 -1
  37. package/dist/pptxSessionWorker.mjs +13 -9
  38. package/dist/pptxSessionWorker.node.mjs +1 -0
  39. package/dist/pptxWorkerStart.d.ts +5 -0
  40. package/dist/pptxWorkerStart.js +1 -0
  41. package/dist/sessionWorker.missing.d.ts +3 -0
  42. package/dist/sessionWorker.missing.js +1 -0
  43. package/dist/sessionWorker.node.d.ts +3 -0
  44. package/dist/sessionWorker.node.js +1 -0
  45. package/dist/transport-BcduBS8X.d.ts +16 -0
  46. package/dist/wasm-preflight.d.ts +26 -0
  47. package/dist/wasm-preflight.js +1 -0
  48. package/dist/worker.d.ts +122 -22
  49. package/dist/worker.js +1 -1
  50. package/package.json +18 -5
  51. package/dist/chunk-2CPM3HRW.js +0 -1
  52. package/dist/chunk-3TTZUGDD.js +0 -1
  53. package/dist/chunk-B6OFSXHM.js +0 -1
  54. package/dist/chunk-DDNX2Z7E.js +0 -1
  55. package/dist/chunk-JZOLK2OC.js +0 -1
  56. package/dist/chunk-NWXUJY6L.js +0 -3
  57. /package/dist/{pptxSessionWorker.d.ts → pptxSessionWorker.node.d.ts} +0 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Moritz Borcherding
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Jake Goulding
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013-2017 by the WOFF2 Authors.
2
+ Copyright (c) 2025 by Nico Burns.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
package/README.md CHANGED
@@ -50,6 +50,21 @@ export async function renderFirstSlide(
50
50
  below. The React editor in [`@betteroffice/pptx-react`](https://www.npmjs.com/package/@betteroffice/pptx-react)
51
51
  manages rendering and user input.
52
52
 
53
+ Hosts loading bundled bytes themselves can import `preparePresentationFontDecoder` from
54
+ `@betteroffice/pptx/worker` to decode in a worker; the editor session for the same `file` object
55
+ then reuses that worker. Call `release()` on the prepared decoder if no session adopts it. Pass the
56
+ `defaultFonts` and `activeSlideIndex` the editor will use: unless `defaultFonts` is false, the worker also
57
+ starts fetching the CJK coverage faces of the opening slide while you load your fonts.
58
+
59
+ ```ts
60
+ import { preparePresentationFontDecoder } from '@betteroffice/pptx/worker';
61
+ import { loadBundledFontBytes, resolveMetricCompatFace } from '@betteroffice/fonts';
62
+
63
+ const { decoder, release } = preparePresentationFontDecoder(file, { activeSlideIndex: 0 });
64
+ const face = resolveMetricCompatFace('Arial', false, false)!;
65
+ const bytes = await loadBundledFontBytes(face, { baseUrl }, { decoder });
66
+ ```
67
+
53
68
  ## Entry points
54
69
 
55
70
  All entry points below are exported from `@betteroffice/pptx`.
@@ -57,18 +72,15 @@ All entry points below are exported from `@betteroffice/pptx`.
57
72
  | entry point | description |
58
73
  | --- | --- |
59
74
  | `initWasm(input?)` | Initialize WebAssembly before opening or inspecting a file. Browsers can omit the input; Node hosts can pass WASM bytes. |
75
+ | `decodeFontFace(bytes, { codec, dict?, maxOutput? })` | Asynchronously decode a packed font with the engine into `{ font, payload? }` ArrayBuffers; rejects on invalid options or decode errors without retrying another decoder. |
60
76
  | `openPresentation(bytes, options?)` | Open a synchronous `PresentationHandle` for reads, edits, layout, and saving. |
61
77
  | `inspectPresentation(bytes, options?)` | Inspect parsed content without opening an editing handle; `includeMedia: false` omits media. |
62
78
  | `sizeCanvasForSlide(canvas, frame, dpr, scale?)` | Set canvas backing dimensions and CSS size for a slide. |
63
79
  | `paintSlide(context, frame, dpr?, scale?, options?)` | Paint a display list asynchronously onto a canvas. |
64
- | `slideToPng(frame, options?)` | Return a PNG `Blob` asynchronously using a browser canvas backend. |
65
80
  | `exportPptxStructured(bytes, options?)` | Export structured content asynchronously without fonts or a DOM. |
66
81
  | `exportPptxMarkdown(bytes, options?)` | Export Markdown and source anchors asynchronously. |
67
82
  | `renderPptxMarkdown(content, options?)` | Render structured content as Markdown asynchronously. |
68
83
 
69
- `openPresentationSession(bytes, options?)` from `@betteroffice/pptx/worker` opens an experimental asynchronous
70
- worker session.
71
-
72
84
  `openPresentation` accepts `fonts`, `fallbackFonts`, `clientId`, and `initialUpdate`. Fallback fonts
73
85
  supply glyphs missing from a run's own face. When opening from a collaboration update, retain the
74
86
  source file bytes used to seed it so the handle can save.
@@ -76,6 +88,13 @@ source file bytes used to seed it so the handle can save.
76
88
  The core's directly owned handle is synchronous. The React editor runs its engine in a Web Worker
77
89
  by default and exposes promise-returning reads and exports.
78
90
 
91
+ ## Worker sessions
92
+
93
+ Node.js >= 20.16 / 22.3 runs worker sessions on `worker_threads`, keeping the process alive until the session is disposed.
94
+
95
+ `openPresentationSession(bytes, options?)` from `@betteroffice/pptx/worker` opens an asynchronous
96
+ worker session; its API can change in minor releases.
97
+
79
98
  ## Layout and rendering
80
99
 
81
100
  `layoutSlide(index)` uses a zero-based slide index. `snapshot()` returns the deck model, and
@@ -85,7 +104,7 @@ UTF-16 code units.
85
104
 
86
105
  For embedded images, pass `paintSlide` an options object with `resolveImage`, a function mapping an
87
106
  asset ID to a canvas image source or a promise for one. It may return `null` for an unavailable image.
88
- `slideToPng` accepts the same resolver and an optional `scale`.
107
+ `await handle.renderPng({ slide }, options?)` draws a slide (zero-based index or slide ID) as PNG bytes with the same painter, on a canvas. Options are `{ scale, background, maxShadowPixels, signal, fonts }`; `background` is `'slide'` (white under the slide), `'transparent'` or a `#rrggbb` color. It lays the slide out again with the faces the presentation registered, any new family in `fonts`, and the bundled faces for the rest, as `@betteroffice/pptx-native` does, so both engines break lines alike. It rejects with `PngExportError` (`font-unavailable`) when a face the slide needs cannot load, rather than paint a substitute font. Where there is no canvas it names `@betteroffice/pptx-native`.
89
108
 
90
109
  ## Saving and ownership
91
110
 
@@ -0,0 +1 @@
1
+ import {a as a$1,b as b$1}from'./chunk-J54GRQWZ.js';import {B as B$1,l,i,H}from'./chunk-COS6CTH7.js';import {a}from'./chunk-CCVGR3MS.js';import'./chunk-S6UYP4BX.js';import'./chunk-65A2TX24.js';import'./chunk-O2XFH626.js';var J,U=()=>J??(J=i().catch(e=>{throw J=void 0,e})),S=new WeakMap,j=4,h=e=>e.trim().toLowerCase(),F=(e,t=false,n=false)=>JSON.stringify([h(e),t,n]),b=e=>e.weight===700,w=e=>e.style==="italic";function v(e,t,n){let r=t.bold??false,o=t.italic??false,s=n?e.renderer.registerFallbackFont(t.family,r,o,t.bytes):e.renderer.registerFont(t.family,r,o,t.bytes);e.faces.push({id:s,family:t.family,bold:r,italic:o,bytes:t.bytes,fallback:n}),(n?e.fallback:e.primary).add(F(t.family,r,o));}function O(e,t,n){let r={renderer:new l,fontCdn:n,measured:e,sources:e.map(o=>o.bytes),faces:[],owned:new Set,primary:new Set,fallback:new Set,requested:new Set,queue:Promise.resolve(),users:0,released:false};try{let o=new Set(t.map(s=>h(s.family)));for(let s of [...e,...t]){let d="fallback"in s&&s.fallback===!0;v(r,s,d);let a=h(s.family);!d&&!o.has(a)&&r.owned.add(a);}}catch(o){throw r.renderer.free(),o}return r}async function M(e,t,n,r){let o=[],s=a=>{a&&!o.some(f=>f.family===a.family&&b(f)===b(a)&&w(f)===w(a))&&o.push(a);},d=r?void 0:await t(e.resolveBundledFamilyFace(n.family,n.bold,n.italic));s(d);for(let a of n.scripts??[])s(await t(e.resolveScriptFallbackFace(a,n.bold,n.italic,n.family)));if(s(await t(e.resolveGlyphFallbackFace(n.family,n.bold,n.italic,"powerpoint"))),!r){let a=e.resolveLastResortChoice(n.family,n.bold,n.italic,"powerpoint");(!a.onlyIfPrimaryFails||!d)&&s(await t(a.face)),o.length||s(e.BASE_LATIN_FONTS.find(f=>b(f)===n.bold&&w(f)===n.italic));}return o}var R=e=>JSON.stringify([h(e.family),e.bold,e.italic,e.scripts??[]]),_=(e,t)=>e.owned.has(h(t.family))||e.primary.has(F(t.family,t.bold,t.italic)),K=(e,t)=>e.fallback.has(F(t.family,b(t),w(t)));function T(e,t,n){let{faces:r}=JSON.parse(e.renderer.requestedFontFacesJson(t,n));return r.filter(o=>!e.requested.has(R(o)))}async function $(e,t,n,r,o,s){let d=await U(),a$2=async y=>y&&!r.has(y.file)&&await d.bundledFaceInstalled(y).catch(()=>true)?y:void 0,f=async(y,l)=>{try{return new Uint8Array(await d.loadBundledFontBytes(y,void 0,{decoder:H,strict:!0}))}catch(c){if(a$1(c)&&(c.diagnostic.pack==="cjk"||c.diagnostic.pack==="intl")){r.add(y.file),o.has(c)||(o.add(c),b$1(c));return}let i=c instanceof Error?c.message:String(c);throw new a("font-unavailable",`${y.family} for ${l} could not load: ${i}`)}},u=new Map,p=(y,l)=>{let c=u.get(y.file);return c||(c=f(y,l),u.set(y.file,c)),c};for(;;){let y=await Promise.all(t.map(async i=>({request:i,faces:await M(d,a$2,i,n.has(F(i.family,i.bold,i.italic)))}))),l=r.size,c=await Promise.all(y.map(async({request:i,faces:x})=>{let g=_(e,i),E=await Promise.all(x.map((m,P)=>P===0&&!g||!K(e,m)?p(m,i.family):void 0));return {request:i,faces:x,bytes:E}}));if(s?.throwIfAborted(),r.size===l)return c}}function z(e,t){for(let{request:n,faces:r,bytes:o}of t){if(e.requested.has(R(n)))continue;let s=_(e,n);for(let[d,a]of r.entries()){let f=o[d];d===0&&!s?f&&v(e,{family:n.family,bold:n.bold,italic:n.italic,bytes:f},false):K(e,a)||f&&v(e,{family:a.family,bold:b(a),italic:w(a),bytes:f},true);}e.requested.add(R(n));}}var V=(e,t)=>e.measured.length===t.length&&t.every((n,r)=>e.measured[r]===n&&e.sources[r]===n.bytes);function B(e,t){let{slides:n}=JSON.parse(e.snapshotJson()),r=n.findIndex(o=>o.id===t);if(r<0)throw new RangeError(`no slide with ID ${JSON.stringify(t)}`);return r}function G(e){e.released=true,e.users===0&&e.renderer.free();}function W(e){if(!e)return B$1();e.throwIfAborted();let t,n=new Promise((r,o)=>{t=()=>o(e.reason);});return e.addEventListener("abort",t,{once:true}),Promise.race([B$1(),n]).finally(()=>e.removeEventListener("abort",t))}async function te(e,t,n,r,o){B(e,t);let s=new Set(n.map(l=>F(l.family,l.bold,l.italic))),d=r?.filter(l=>!s.has(F(l.family,l.bold,l.italic)))??[],a$1=new Set(d.map(l=>F(l.family,l.bold,l.italic))),f=await W(o);o?.throwIfAborted();let u=d.length?void 0:S.get(e);u&&(u.fontCdn!==f||!V(u,n))&&(X(e),u=void 0),u||(u=O(n,d,f),d.length?u.released=true:S.set(e,u));let p=u;p.users+=1;let y=p.queue.then(async()=>{let l=new Set,c=new Set,i=p;try{for(let g=0;;g+=1){let E=e.documentVersion();B(e,t);let m=T(i,e,t);if(!m.length)break;if(g===j)throw new a("font-unavailable","the faces this slide needs kept changing while they loaded; export again");let P=await $(i,m,a$1,l,c,o);if(l.size&&!d.length&&i===p&&(i=O([],p.faces,f),i.owned=new Set(p.owned),i.requested=new Set(p.requested)),z(i,P),e.documentVersion()===E)break}return o?.throwIfAborted(),{list:JSON.parse(i.renderer.exportSlideJson(e,B(e,t))),fonts:[...i.faces]}}finally{i!==p&&i.renderer.free();}});p.queue=y.catch(()=>{});try{return await y}finally{p.users-=1,p.released&&p.users===0&&p.renderer.free();}}function X(e){let t=S.get(e);S.delete(e),t&&G(t);}export{te as defaultFontLayout,X as releaseDefaultFontLayout};
@@ -0,0 +1 @@
1
+ function c(o){try{let t=new DataView(o.buffer,o.byteOffset,o.byteLength);if(t.byteLength<12)return;let n=0;if(t.getUint32(0)===1953784678){let e=t.getUint32(4),r=t.getUint32(8);if(e!==65536&&e!==131072||r===0||12+r*4+(e===131072?12:0)>t.byteLength)return;n=t.getUint32(12);}if(n+12>t.byteLength)return;let u=t.getUint32(n);if(u!==65536&&u!==1953658213&&u!==1330926671)return;let l=t.getUint16(n+4);if(n+12+l*16>t.byteLength)return;let i,f;for(let e=0;e<l;e++){let r=n+12+e*16,a=t.getUint32(r),g=t.getUint32(r+8),s=t.getUint32(r+12);if(g+s>t.byteLength)return;if(a===1330851634){if(i)return;i={offset:g,length:s};}else if(a===1751474532){if(f)return;f={offset:g,length:s};}}if(i){if(i.length<64)return;let e=t.getUint16(i.offset+62);return {weight:Math.max(1,Math.min(1e3,t.getUint16(i.offset+4))),bold:(e&32)!==0,italic:(e&1)!==0,oblique:(e&512)!==0}}if(f){if(f.length<46)return;let e=t.getUint16(f.offset+44);return {weight:e&1?700:400,bold:(e&1)!==0,italic:(e&2)!==0,oblique:!1}}}catch{return}}export{c as a};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-O2XFH626.js';var Z=3e3;var m=["#B3261E","#7B1FA2","#3949AB","#00796B","#2E7D32","#A84400","#C2185B","#00695C"],D=/^#[0-9a-fA-F]+$/;function Y(e){return m[Math.abs(e)%m.length]}function w(e,t){return typeof t=="string"&&(t.length===4||t.length===7)&&D.test(t)?t:Y(e)}function ee(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=w(e,t?.color);return {name:n,color:r}}function $(e){return e.slideId.length<=1024&&(e.shapeId===void 0||e.shapeId.length<=1024)}function te(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)&&$(n)&&new TextEncoder().encode(n.slideId+(n.shapeId??"")).byteLength<=t}function v(e,t){return e?.slideId===t?.slideId&&e?.shapeId===t?.shapeId}var P=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(B)}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&&v(a.state.cursor,s.state.cursor)?a.cursorMovedAt:n;this.states.set(s.clientId,{state:I(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 I(e){return {clientId:e.clientId,clock:e.clock,user:{...e.user},cursor:e.cursor?{...e.cursor}:null}}function B(e){return {state:I(e.state),lastSeen:e.lastSeen,cursorMovedAt:e.cursorMovedAt}}var f=16777216,E=4096,N=0,T=1,W=2,R=3,C=0,k=1,M=2,q=0,z=Number.MAX_SAFE_INTEGER,j=10,b=new TextEncoder().encode("\0betteroffice-document-fingerprint-v1\0"),i=class extends Error{constructor(t){super(t),this.name="ProtocolError";}},y=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((z-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 K(e){let t=new TextEncoder().encode(e);return p([u(t.byteLength),t],f)}function p(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 g(e,t,n){return p([u(N),u(e),u(t.byteLength),t],n)}function ae(e,t=f){return g(C,e,t)}function ce(e,t=f){return g(k,e,t)}function ue(e,t=f){return g(M,e,t)}function de(e,t=f){if(e.length>E)throw new i(`Awareness update exceeds ${E} entries`);let n=[u(e.length)];for(let s of e){G(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),K(o));}let r=p(n,t);return p([u(T),u(r.byteLength),r],t)}function le(e=f){return p([u(R)],e)}function pe(e,t=E){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 y(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(A){throw A instanceof i?A:new i(`Invalid awareness JSON${A instanceof Error?`: ${A.message}`:""}`)}let h={clientId:a,clock:c,state:F(d,a,c)};G(h),s.push(h);}if(!n.done)throw new i("Awareness update has trailing bytes");return s}function L(e){let t=b.byteLength+32,n=e.byteLength-t;if(n<0)return e;for(let r=0;r<b.byteLength;r+=1)if(e[n+r]!==b[r])return e;return e.subarray(0,n)}var O=Number.MAX_SAFE_INTEGER-1,V=BigInt(O),J=65536;function X(e){let t=0,n=()=>{let a=0n;for(let c=0;c<j&&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(),h=n();if(d===void 0||h===void 0)return;o.push({client:d,clock:h,start:c,end:t});}return t===e.byteLength?{header:s,entries:o}:void 0}function fe(e){let t=L(e),n=X(t);if(!n)return e;let{header:r,entries:s}=n;if(!(s.length>=J||s.some(({client:o})=>o===V)))return p([u(s.length+1),t.subarray(r),u(O),u(0),e.subarray(t.byteLength)],Number.MAX_SAFE_INTEGER)}function he(e){let t=L(e),n=X(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:p([u(r.length),...r.map(({start:s,end:o})=>t.subarray(s,o)),e.subarray(t.byteLength)],Number.MAX_SAFE_INTEGER),open:true}}function Ae(e,t=f,n=E){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 y(e),s=[];for(;!r.done;){if(s.length>=n)throw new i(`Frame exceeds ${n} messages`);let o=r.readVarUint();switch(o){case N:{let a=r.readVarUint(),c=r.readVarUint8Array();if(a===C)s.push({type:"sync-step-1",stateVector:c});else if(a===k)s.push({type:"sync-step-2",update:c});else if(a===M)s.push({type:"update",update:c});else throw new i(`Unknown sync message type ${a}`);break}case T:s.push({type:"awareness",update:r.readVarUint8Array()});break;case W:{let a=r.readVarUint();if(a!==q)throw new i(`Unknown auth message type ${a}`);s.push({type:"auth",reason:r.readVarString()});break}case R:s.push({type:"query-awareness"});break;default:throw new i(`Unknown top-level message type ${o}`)}}return s}function F(e,t,n){if(e===null)return null;if(!_(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(!_(e.user))throw new i("Awareness user must be an object");let r=S(e.user.name,"Awareness user name"),s=w(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(!_(e))throw new i("Awareness cursor must be an object or null");let t=S(e.slideId,"Awareness slideId"),n=e.shapeId===void 0?void 0:S(e.shapeId,"Awareness shapeId");return n?{slideId:t,shapeId:n}:{slideId:t}}function G(e){x(e.clientId,"Awareness clientId"),x(e.clock,"Awareness clock"),e.state!==null&&F(e.state,e.clientId,e.clock);}function x(e,t){if(!Number.isSafeInteger(e)||e<0)throw new i(`${t} must be a non-negative safe integer`)}function S(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 _(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}export{Z as a,Y as b,ee as c,$ as d,te as e,v as f,P as g,f as h,E as i,ae as j,ce as k,ue as l,de as m,le as n,pe as o,L as p,O as q,fe as r,he as s,Ae as t};
@@ -0,0 +1 @@
1
+ import'./chunk-O2XFH626.js';function $(n,t,o,a){let{chunks:p,fitted:h}=j(t);for(let u of p){let x=X(u,a,T=>n.measureText(T)?.width,h?L:F);x===1?n.fillText(u.text,u.x,o):(n.save(),n.translate(u.x,o),n.scale(x,1),n.fillText(u.text,0,0),n.restore());}}var F=1.33,L=1.45;function X(n,t,o,a){let h=Array.from(n.text).some(x=>v(x.codePointAt(0)))||n.width===void 0||t!==0?0:o(n.fitText??n.text),u=h&&h>0?(n.width??0)/h:1;return (Math.abs(u-1)<.001||u<.75||u>a)&&(u=1),u}function q(n,t){let{chunks:o,fitted:a}=j(n);return a?o.map(p=>({start:p.start,scale:X(p,n.letterSpacingPx??0,t,L)})):null}function W(n){let t=Math.fround;return {...n,x:t(n.x),width:t(n.width),glyphs:n.glyphs.map(o=>({...o,x:t(o.x),advance:t(o.advance),xOffset:t(o.xOffset)}))}}function j(n){let t=W(n);if(t.glyphs.length===0)return {chunks:[{text:t.text,x:n.x,start:0}],fitted:false};let o=new Map;for(let e of t.glyphs)o.set(e.cluster,Math.min(o.get(e.cluster)??1/0,e.x));let[a,...p]=o.values(),h=p.find(e=>Math.abs(e-a)>.01);if(h!==void 0&&h<a){let e=t.text.split(" "),s=[],r=-1;for(let i of e)r+=i.length+1,s.push(r);let l=e.map(()=>1/0);for(let[i,f]of t.glyphs.entries()){let y=f.cluster-t.start,c=0,g=s.length-1;for(;c<g;){let d=c+g>>1;s[d]<y?c=d+1:g=d;}y>=0&&y<s[c]&&(l[c]=Math.min(l[c],n.glyphs[i].x));}let b=e.map((i,f)=>f?s[f-1]+1:0);return {chunks:e.flatMap((i,f)=>i.length>0&&l[f]<1/0?[{text:i,x:l[f],start:b[f]}]:[]),fitted:false}}let u=[],x=e=>/^[\p{M}\u200c\u200d]/u.test(t.text.slice(e))||t.text[e-1]==="\u200D",T=(e,s)=>/\s/u.test(t.text[e-1])||v(t.text.codePointAt(e))||v(N(t.text,e))||s&&/\s/u.test(t.text[e]),w=e=>{let s=t.glyphs[e-1];return s?Math.fround(s.x+s.advance):t.x},k=e=>Math.abs(t.glyphs[e].x-w(e))>1e-4,R=e=>{if(e>0&&t.glyphs[e-1].cluster===t.glyphs[e].cluster)return false;let s=w(e),r=Math.max(Math.fround(1e-4),Math.fround(Math.abs(s)*2**-21));return Math.abs(Math.fround(t.glyphs[e].x-s))>r},A=!t.letterSpacingPx&&t.glyphs.some((e,s)=>{let r=e.cluster-t.start;return r>0&&r<t.text.length&&k(s)&&!x(r)&&!T(r,true)}),I=t.glyphs.every((e,s)=>s===0||e.cluster>=t.glyphs[s-1].cluster),P=A&&I&&t.glyphs.some((e,s)=>{let r=e.cluster-t.start;return s>0&&t.glyphs[s-1].advance>0&&r>0&&r<t.text.length&&R(s)&&!x(r)&&!T(r,true)}),C=!A&&!G.test(t.text)&&I,M=0,S=C&&t.glyphs[0].cluster===t.start,m=S?t.glyphs[0].x:t.x,_=S?n.glyphs[0].x:n.x,D=0,E=(e,s,r)=>{let l=t.text.slice(M,e),b={text:l,x:_,start:M};if(C&&!l.includes(" ")){let i=l.trimEnd(),f=r-m,y=0,c=m;for(let g=D;g<s;g++){let d=t.glyphs[g];if(d.cluster-t.start>=M+i.length){f=d.x-m,b.fitText=i;break}y+=d.advance,c=Math.max(c,d.x);}b.width=Number.isFinite(f)&&f>0&&f>=c-m?f:y;}else P&&!l.includes(" ")&&r>m&&(b.width=r-m);u.push(b);};for(let[e,s]of t.glyphs.entries()){let r=s.cluster-t.start;r>M&&r<t.text.length&&(C?!x(r)&&T(r,k(e)):P?R(e):k(e))&&(E(r,e,s.x),M=r,D=e,m=s.x,_=n.glyphs[e].x);}return E(t.text.length,t.glyphs.length,t.x+t.width),{chunks:u,fitted:P}}var G=/[\u0590-\u08ff\ufb1d-\ufdff\ufe70-\ufefc]/u;function N(n,t){return n.codePointAt(t-(/[\ud800-\udbff][\udc00-\udfff]$/.test(n.slice(0,t))?2:1))}function v(n){return /[\u3000-\u3098\u309b-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef\u{20000}-\u{2ffff}]/u.test(String.fromCodePoint(n??0))}export{q as fittedPieceDecisions,$ as paintTextChunks};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-S6UYP4BX.js';function d(e,t){let n,r;try{let a=W(e,i.__wbindgen_malloc),A=b,c=i.font_preflight(a,A,t);var s=c[0],o=c[1];if(c[3])throw s=0,o=0,R(c[2]);return n=s,r=o,m(s,o)}finally{i.__wbindgen_free(n,r,1);}}function P(){return {__proto__:null,"./pptx_preflight_bg.js":{__proto__:null,__wbindgen_generic_0000000000000001:function(t,n){return m(t,n)},__wbindgen_init_externref_table:function(){let t=i.__wbindgen_externrefs,n=t.grow(4);t.set(0,void 0),t.set(n+0,void 0),t.set(n+1,null),t.set(n+2,true),t.set(n+3,false);}}}}function m(e,t){return F(e>>>0,t)}var f=null;function y(){return (f===null||f.byteLength===0)&&(f=new Uint8Array(i.memory.buffer)),f}function W(e,t){let n=t(e.length*1,1)>>>0;return y().set(e,n/1),b=e.length,n}function R(e){let t=i.__wbindgen_externrefs.get(e);return i.__externref_table_dealloc(e),t}var l=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true});l.decode();var U=2146435072,u=0;function F(e,t){return u+=t,u>=U&&(l=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}),l.decode(),u=t),l.decode(y().subarray(e,e+t))}var b=0,i;function S(e,t){return i=e.exports,f=null,i.__wbindgen_start(),i}async function I(e,t){if(typeof Response=="function"&&e instanceof Response){if(!e.ok)throw new Error(`failed to fetch Wasm: ${e.status} ${e.statusText} fetching '${e.url}'`);if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(s){if(n(e.type)&&e.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",s);else throw s}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else {let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}function n(r){switch(r){case "basic":case "cors":case "default":return true}return false}}async function p(e){if(i!==void 0)return i;if(e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),e===void 0)throw new Error("ooxml-font-preflight requires an explicit module or URL");let t=P();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await I(await e,t);return S(n)}var w="wasm";function _(){return new URL("./generated/preflight/pptx_preflight_bg.wasm",import.meta.url)}function h(e){let t=false,n,r;return {status(){return t?"ready":n?"loading":"idle"},memory(){return r},preload(s){if(t)return Promise.resolve();if(e.engineKind==="native")return t=true,Promise.resolve();if(n)return n;let o=e.assetUrl();return n=Promise.resolve().then(()=>e.initAsync({module_or_path:s??a(o)??o})).then(a=>{r=a.memory,t=true;}).catch(a=>{throw n=void 0,a instanceof Error?a:new Error(String(a))}),n}}}var x=h({assetUrl:_,engineKind:w,initAsync:p});function C(e){return x.preload(e)}async function N(e,t=0){if(!Number.isInteger(t)||t<0||t>4294967295)throw new RangeError("activeSlide must be an unsigned slide index");return await x.preload(),JSON.parse(d(e,t))}export{x as a,C as b,N as c};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-OUNTNO7R.js';function t(e){let o=globalThis.process;if(typeof o?.getBuiltinModule!="function")throw a(e);let n=o.getBuiltinModule("node:worker_threads");if(!n)throw a(e);return n}function i(){let e=t("the in-thread API").parentPort;if(!e)throw a("the in-thread API");return e}export{t as a,i as b};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-O2XFH626.js';var t=class extends Error{constructor(a$1,i){super(i);a(this,"code");this.name="PngExportError",this.code=a$1;}};export{t as a};
@@ -0,0 +1,2 @@
1
+ import {a as a$1}from'./chunk-CCVGR3MS.js';import {b,c}from'./chunk-S6UYP4BX.js';import {q}from'./chunk-65A2TX24.js';import {a}from'./chunk-O2XFH626.js';function de(t){return t.length>=4&&(t[0]===73&&t[1]===73&&t[2]===42&&t[3]===0||t[0]===77&&t[1]===77&&t[2]===0&&t[3]===42)}function _t(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(t.length<10)return;let n=0,o=0;if(t.length>=24&&e.getUint32(0)===2303741511&&e.getUint32(4)===218765834&&e.getUint32(12)===1229472850)n=e.getUint32(16),o=e.getUint32(20);else if(e.getUint32(0)===1195984440&&[55,57].includes(t[4])&&t[5]===97)n=e.getUint16(6,true),o=e.getUint16(8,true);else if(t.length>=26&&e.getUint16(0,true)===19778)e.getUint32(14,true)===12?(n=e.getUint16(18,true),o=e.getUint16(20,true)):(n=e.getInt32(18,true),o=Math.abs(e.getInt32(22,true)));else if(t.length>=20&&e.getUint32(0)===1380533830&&e.getUint32(8)===1464156752){let r=e.getUint32(12);if(r===1448097880&&t.length>=30)n=1+t[24]+(t[25]<<8)+(t[26]<<16),o=1+t[27]+(t[28]<<8)+(t[29]<<16);else if(r===1448097868&&t.length>=25&&t[20]===47){let i=e.getUint32(21,true);n=1+(i&16383),o=1+(i>>>14&16383);}else r===1448097824&&t.length>=30&&t[23]===157&&t[24]===1&&t[25]===42&&(n=e.getUint16(26,true)&16383,o=e.getUint16(28,true)&16383);}else if(e.getUint16(0)===65496){let r=false;for(let i=2;i+4<=t.length;){if(t[i++]!==255)return;for(;t[i]===255;)i+=1;let a=t[i++];if(a===217||a===218)break;if(a===1||a>=208&&a<=216)continue;if(i+2>t.length)return;let l=e.getUint16(i);if(l<2||i+l>t.length)return;a===225&&(r=r||pn(t.subarray(i+2,i+l))),a>=192&&a<=207&&![196,200,204].includes(a)&&l>=7&&(o=e.getUint16(i+3),n=e.getUint16(i+5)),i+=l;}r&&([n,o]=[o,n]);}return n>0&&o>0?{width:n,height:o}:void 0}function pn(t){if(t.length<14||![69,120,105,102,0,0].every((i,a)=>t[a]===i))return false;let e=new DataView(t.buffer,t.byteOffset+6,t.byteLength-6),n=e.getUint16(0)===18761;if(!n&&e.getUint16(0)!==19789||e.getUint16(2,n)!==42)return false;let o=e.getUint32(4,n);if(o>e.byteLength-2)return false;let r=e.getUint16(o,n);for(let i=0;i<r;i+=1){let a=o+2+i*12;if(a>e.byteLength-12)return false;if(e.getUint16(a,n)===274&&e.getUint16(a+2,n)===3&&e.getUint32(a+4,n)===1)return [5,6,7,8].includes(e.getUint16(a+8,n))}return false}var un=33554432,ht="image/svg+xml",gn=4194304,_n=4096,bt=new WeakMap;function ce(t){return bt.get(t)??{x:1,y:1}}function _e(t,e){bt.set(t,e);}function De(t){if(de(t))throw new Error("TIFF images require worker conversion");let e=St(t)??Pt(t);return e?new Blob([e],{type:"image/bmp"}):hn(t)??new Blob([t.slice()])}function Be(t){return t.type===ht}async function yt(t,e,n={}){let o=De(t);return mn(o,e,n)}async function mn(t,e,n={}){let o=n.maxDimension??_n;if(!Number.isSafeInteger(o)||o<1)throw new Error("invalid image dimension limit");if(typeof createImageBitmap=="function"&&!Be(t)){let i=_t(new Uint8Array(await t.arrayBuffer()));if(i&&Math.max(i.width,i.height)>o){let l=o/Math.max(i.width,i.height),s=await createImageBitmap(t,{resizeWidth:Math.max(1,Math.floor(i.width*l)),resizeHeight:Math.max(1,Math.floor(i.height*l))});return Oe(s,i,o)}let a=await createImageBitmap(t);return Oe(a,{width:a.width,height:a.height},o)}let r=URL.createObjectURL(t);try{let i=await new Promise((a,l)=>{let s=new Image;s.onload=()=>a(s),s.onerror=()=>l(new Error(e)),s.src=r;});return await Oe(i,{width:i.naturalWidth,height:i.naturalHeight},o)}finally{URL.revokeObjectURL(r);}}async function Oe(t,e,n){let o="naturalWidth"in t?t.naturalWidth:t.width,r="naturalHeight"in t?t.naturalHeight:t.height,i=t;if(Math.max(o,r)>n){let s=n/Math.max(o,r),u={width:Math.max(1,Math.floor(o*s)),height:Math.max(1,Math.floor(r*s))},f,b;try{typeof OffscreenCanvas=="function"&&(f=new OffscreenCanvas(u.width,u.height),b=f.getContext("2d"));}catch{f=void 0;}if(!b&&typeof document<"u")try{f=document.createElement("canvas"),f.width=u.width,f.height=u.height,b=f.getContext("2d");}catch{f=void 0;}if(f&&b){b.drawImage(t,0,0,u.width,u.height),"close"in t&&typeof t.close=="function"&&t.close();try{i=typeof createImageBitmap=="function"?await createImageBitmap(f):f;}catch{i=f;}}}let a="naturalWidth"in i?i.naturalWidth:i.width,l="naturalHeight"in i?i.naturalHeight:i.height;return (e.width!==a||e.height!==l)&&_e(i,{x:e.width/a,y:e.height/l}),i}function hn(t){if(t.byteLength>gn)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([bn(e)],{type:ht})}function bn(t){let e=yn(t);if(!e||/\s(?:width|height)\s*=/.test(t.slice(e.start,e.end)))return t;let n=t.slice(e.start,e.end).match(/\sviewBox\s*=\s*(["'])\s*[-+.\deE]+[\s,]+[-+.\deE]+[\s,]+([-+.\deE]+)[\s,]+([-+.\deE]+)\s*\1/),[o,r]=[Number(n?.[2]),Number(n?.[3])];if(!(o>0)||!(r>0))return t;let i=e.start+4;return `${t.slice(0,i)} width="${o}" height="${r}"${t.slice(i)}`}function yn(t){let e=0;for(;e<t.length;){if(/\s/.test(t[e]))e+=1;else if(t.startsWith("<!--",e))e=le(t.indexOf("-->",e+4),3);else if(t.startsWith("<?",e))e=le(t.indexOf("?>",e+2),2);else if(t.startsWith("<!",e))e=le(mt(t,e+2),1);else break;if(e<0)return}if(!/^<svg[\s/>]/.test(t.slice(e,e+5)))return;let n=mt(t,e+4);return n<0?void 0:{start:e,end:n}}function le(t,e){return t<0?-1:t+e}function mt(t,e){let n="",o=false;for(let r=e;r<t.length;r+=1){let i=t[r];if(n)i===n&&(n="");else if(o&&t.startsWith("<!--",r)){if(r=le(t.indexOf("-->",r+4),2),r<0)return -1}else if(o&&t.startsWith("<?",r)){if(r=le(t.indexOf("?>",r+2),1),r<0)return -1}else if(i==='"'||i==="'")n=i;else if(i==="[")o=true;else if(i==="]")o=false;else if(i===">"&&!o)return r}return -1}function me(t,e){return !e||!wt(t)&&xt(t)<0||St(t,true)||Pt(t,true)?t:e()??new Uint8Array}function wt(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength);return e.byteLength>=44&&e.getUint32(0,true)===1&&e.getUint32(40,true)===1179469088?e:void 0}function xt(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength),n=e.byteLength>=4&&e.getUint32(0,true)===2596720087?22:0;return e.byteLength>=n+18&&[1,2].includes(e.getUint16(n,true))&&e.getUint16(n+2,true)===9&&e.getUint16(n+4,true)===768?n:-1}function Pt(t,e){let n=wt(t);if(!n||n.byteLength<108)return;let o=n.getUint32(4,true);if(o<88||o%4||o>n.byteLength-8)return;let r=n.getInt32(16,true)-n.getInt32(8,true)+1,i=n.getInt32(20,true)-n.getInt32(12,true)+1,a=n.getUint32(o+4,true);if(n.getUint32(o,true)!==81||a<80||a>n.byteLength-o-8)return;let l=P=>n.getInt32(o+P,true),s=n.getUint32(o+48,true),u=n.getUint32(o+56,true),f=n.getUint32(o+60,true);if(l(24)!==n.getInt32(8,true)||l(28)!==n.getInt32(12,true)||l(72)!==r||l(76)!==i||l(32)!==0||l(36)!==0||l(40)!==r||l(44)!==i||n.getUint32(o+64,true)!==0||n.getUint32(o+68,true)!==13369376||s<80||s+n.getUint32(o+52,true)!==u||u+f!==a)return;let b=o+a;if(!(n.getUint32(b,true)!==14||n.getUint32(b+4,true)!==n.byteLength-b))return vt(t.subarray(o+s,b),r,i,e)}function St(t,e){let n=new DataView(t.buffer,t.byteOffset,t.byteLength),o=xt(t);if(o<0||n.getUint32(o+6,true)*2!==n.byteLength-o)return;let r=0,i=0,a=0,l=0,s=false,u;for(let f=o+18;f+6<=n.byteLength;){let b=n.getUint32(f,true)*2,P=n.getUint16(f+4,true);if(b<6||b>n.byteLength-f)return;if(P===0)return b===6&&f+b===n.byteLength?u:void 0;if(u)return;if(P===259){if(b<8||n.getUint16(f+6,true)!==8)return;s=true;}else if(P===263){if(b<8||![1,2,3,4].includes(n.getUint16(f+6,true)))return}else if(P===523||P===524){if(b!==10)return;let C=n.getInt16(f+6,true),k=n.getInt16(f+8,true);if(P===523)r=k,i=C;else {if(!s)return;a=k,l=C;}}else if(P===2881){if(b<66||n.getUint32(f+6,true)!==13369376||n.getInt16(f+14,true)!==0||n.getInt16(f+16,true)!==0||n.getInt16(f+18,true)!==l||n.getInt16(f+20,true)!==a||n.getInt16(f+22,true)!==i||n.getInt16(f+24,true)!==r||!a||!l||(u=vt(t.subarray(f+26,f+b),n.getInt16(f+12,true),n.getInt16(f+10,true),e),!u))return}else return;f+=b;}}function vt(t,e,n,o){if(t.length<40)return;let r=new DataView(t.buffer,t.byteOffset,t.byteLength),i=r.getInt32(4,true),a=r.getInt32(8,true),l=r.getUint16(14,true);if(r.getUint32(0,true)!==40||i<1||!a||i*Math.abs(a)>un||e!==i||n!==Math.abs(a)||r.getUint16(12,true)!==1||![24,32].includes(l)||r.getUint32(16,true)!==0||r.getUint32(32,true)!==0)return;let s=Math.ceil(i*l/32)*4*Math.abs(a);if(40+s!==t.length||![0,s].includes(r.getUint32(20,true)))return;if(o)return t;let u=new Uint8Array(14+t.length),f=new DataView(u.buffer);return f.setUint16(0,19778,true),f.setUint32(2,u.length,true),f.setUint32(10,54,true),u.set(t,14),u}var wn=import('./chunk-663FARNX.js'),xn=t=>t,Pn=134217728;function He(t,e,n=1){return {width:Math.ceil(t.width*n*e),height:Math.ceil(t.height*n*e)}}function Ir(t,e,n,o=1){let r=He(e,n,o);t.width=r.width,t.height=r.height,t.style.width=`${e.width*o}px`,t.style.height=`${e.height*o}px`;}async function Tt(t,e,n=1,o=1,r={}){let i=await wn,a=r.fontCoverage?await(await import('./chunk-JJV35WHH.js')).prepareTextFamilies(e,r.fontCoverage):xn,l={remaining:r.maxShadowPixels??Pn};if(!Number.isSafeInteger(l.remaining)||l.remaining<0)throw new Error("invalid shadow pixel budget");let s=r.resolveImage?.acquire?.()??r.resolveImage,u={...r,resolveImage:s};try{t.save(),t.setTransform(n*o,0,0,n*o,0,0),t.clearRect(0,0,e.width,e.height),e.background&&(t.fillStyle=be(t,e.background,0,0,e.width,e.height),t.fillRect(0,0,e.width,e.height));for(let f of e.primitives)await Rt(t,f,u,n*o,l,i,a);}finally{try{t.restore();}finally{s?.release?.();}}}async function Rt(t,e,n,o,r,i,a){t.save();try{let l="shapeId"in e&&n.shapeChanges?.some(s=>s.shapeId===e.shapeId&&s.kind==="deleted");switch(l&&(t.globalAlpha*=.4),vn(t,e),e.kind){case "shape":Ft(t,e,o,r);break;case "image":await An(t,e,n.resolveImage,o,r);break;case "textBox":qn(t,e,i,a,n.textChanges,n.fontFamily);break;case "placeholder":Vn(t,e);break;case "chart":case "table":await Sn(t,e,l?{...n,shapeChanges:n.shapeChanges?.filter(s=>s.shapeId!==e.shapeId)}:n,o,r,i,a);break}}finally{t.restore();}}async function Sn(t,e,n,o,r,i,a){t.beginPath(),t.rect(e.x,e.y,e.w,e.h),t.clip();for(let l of e.primitives)await Rt(t,l,n,o,r,i,a);}function vn(t,e){let n=e.transform;if(!n)return;let o=e.x+e.w/2,r=e.y+e.h/2;t.translate(o,r),t.rotate((n.rotationDeg??0)*Math.PI/180),t.scale(n.flipH?-1:1,n.flipV?-1:1),t.translate(-o,-r);}function Ft(t,e,n,o){e.clip&&(je(t,e.clip,e.x,e.y,e.w,e.h),t.clip()),e.shadow&&(e.fill||e.stroke||e.shadow.paths?.some(r=>r.stroke))&&Cn(t,e,n,o),je(t,e.path,e.x,e.y,e.w,e.h),e.fill&&(t.fillStyle=be(t,e.fill,e.x,e.y,e.w,e.h),t.fill(e.evenOdd?"evenodd":"nonzero")),e.stroke&&(Mt(t,e.stroke,e.x,e.y,e.w,e.h),Tn(t,e));}function Cn(t,e,n,o){let r=e.shadow?.paths?.length?e.shadow.paths.map(i=>({...e,path:i.path,fill:i.fill?e.fill:void 0,stroke:i.stroke,shadow:void 0})):[{...e,shadow:void 0}];Jt(t,e.shadow,r.flatMap(i=>qe(i.path,i)),r.reduce((i,a)=>Math.max(i,a.stroke?.width??0),0),n,o,i=>{for(let a of r)Ft(i,a,n,o);});}function Jt(t,e,n,o,r,i,a){let l=e.scaleX??1,s=e.scaleY??1,u=t.getTransform(),f={a:u.a*l,b:u.b*s,c:u.c*l,d:u.d*s,e:u.e*l,f:u.f*s};if(!n.length)return;let b=1/0,P=1/0,C=-1/0,k=-1/0;for(let[D,c]of n){let p=f.a*D+f.c*c+f.e,h=f.b*D+f.d*c+f.f;b=Math.min(b,p),P=Math.min(P,h),C=Math.max(C,p),k=Math.max(k,h);}let A=Math.min(Math.max(e.blur??0,0)*r/2,128),E=A*3+1,F=o*r*Math.max(Math.abs(l),Math.abs(s))*2,ee=(e.dx??0)*r,te=(e.dy??0)*r,S=Math.floor(Math.max(b-F,-E-ee)),y=Math.floor(Math.max(P-F,-E-te)),$=Math.ceil(Math.min(C+F,t.canvas.width+E-ee)),ne=Math.ceil(Math.min(k+F,t.canvas.height+E-te));if($<=S||ne<=y)return;let ae=($-S)*(ne-y);if(!Number.isSafeInteger(ae)||ae>i.remaining)return;i.remaining-=ae;let q=typeof OffscreenCanvas<"u"?new OffscreenCanvas($-S,ne-y):Object.assign(document.createElement("canvas"),{width:$-S,height:ne-y}),j=q.getContext("2d");if(j){j.setTransform(f.a,f.b,f.c,f.d,f.e-S,f.f-y),a(j),t.save();try{if(t.resetTransform(),typeof t.filter=="string")j.setTransform(1,0,0,1,0,0),j.globalCompositeOperation="source-in",j.fillStyle=e.color,j.fillRect(0,0,q.width,q.height),t.filter=`blur(${A}px)`,t.drawImage(q,S+ee,y+te);else {let D=t.canvas.width+1;t.shadowColor=e.color,t.shadowBlur=A*2,t.shadowOffsetX=S+ee-D,t.shadowOffsetY=te,t.drawImage(q,D,y);}}finally{t.restore();}}}function qe(t,e){let n=[];for(let o of t)o.type!=="close"&&(o.type==="quad"?n.push([e.x+o.cpx*e.w,e.y+o.cpy*e.h]):o.type==="cubic"&&(n.push([e.x+o.cp1x*e.w,e.y+o.cp1y*e.h]),n.push([e.x+o.cp2x*e.w,e.y+o.cp2y*e.h])),n.push([e.x+o.x*e.w,e.y+o.y*e.h]));return n.filter((o,r)=>r===0||o[0]!==n[r-1][0]||o[1]!==n[r-1][1])}function In(t){return t.path?qe(t.path,t):[[t.x,t.y],[t.x+t.w,t.y],[t.x+t.w,t.y+t.h],[t.x,t.y+t.h]]}var kn=new Set(["triangle","stealth","arrow","diamond","oval"]);function Tn(t,e){let n=e.stroke;if(!n||!n.headEnd&&!n.tailEnd)return;let o=qe(e.path,e);if(o.length<2)return;let r=[[n.headEnd,o[1],o[0]],[n.tailEnd,o[o.length-2],o[o.length-1]]];t.save(),t.setLineDash([]);let i=n.paint?be(t,n.paint,e.x,e.y,e.w,e.h):n.color;t.fillStyle=i,t.strokeStyle=i,t.lineWidth=n.width,t.lineJoin="miter";for(let[a,l,s]of r){if(!a||!kn.has(a.kind))continue;let[u,f]=[s[0]-l[0],s[1]-l[1]],b=Math.hypot(u,f);b<1e-6||Rn(t,a,s,u/b,f/b);}t.restore();}function Rn(t,e,[n,o],r,i){let a=e.width/2,[l,s]=[-i*a,r*a],[u,f]=[n-r*e.length,o-i*e.length];switch(t.beginPath(),e.kind){case "triangle":t.moveTo(n,o),t.lineTo(u+l,f+s),t.lineTo(u-l,f-s),t.closePath(),t.fill();break;case "stealth":t.moveTo(n,o),t.lineTo(u+l,f+s),t.lineTo(n-r*e.length*.6,o-i*e.length*.6),t.lineTo(u-l,f-s),t.closePath(),t.fill();break;case "arrow":t.moveTo(u+l,f+s),t.lineTo(n,o),t.lineTo(u-l,f-s),t.stroke();break;case "diamond":{let[b,P]=[r*e.length/2,i*e.length/2];t.moveTo(n+b,o+P),t.lineTo(n+l,o+s),t.lineTo(n-b,o-P),t.lineTo(n-l,o-s),t.closePath(),t.fill();break}case "oval":t.ellipse(n,o,e.length/2,a,Math.atan2(i,r),0,Math.PI*2),t.fill();break}}function Fn(t,e,n){if(n.tile){Jn(t,e,n,n.tile);return}let o=n.crop,r=V(o?.left),i=V(o?.top),a=1-r-V(o?.right),l=1-i-V(o?.bottom),s=n.path!==void 0||a!==1||l!==1;if(a<=0||l<=0)return;s&&(t.save(),ze(t,n),t.clip());let u=Et(e),f=At(e),b=n.destination??n;u>0&&f>0?t.drawImage(e,r*u,i*f,a*u,l*f,b.x,b.y,b.w,b.h):t.drawImage(e,b.x,b.y,b.w,b.h),s&&t.restore();}function Jn(t,e,n,o){let r=Et(e),i=At(e);if(r<=0||i<=0)return;let a=ce(e),l=r*a.x,s=i*a.y,u=Math.round(V(n.crop?.left)*l)/a.x,f=Math.round(V(n.crop?.top)*s)/a.y,b=(l-Math.round(V(n.crop?.right)*l))/a.x,P=(s-Math.round(V(n.crop?.bottom)*s))/a.y;if(b<=u||P<=f)return;let k=u>0||f>0||b<r||P<i?En(e,u,f,b-u,P-f):e,A=t.createPattern(k,"repeat");if(!A)return;t.save(),ze(t,n),t.clip();let E=ce(k),F=n.destination??n;A.setTransform(new DOMMatrix().translateSelf(F.x,F.y).scaleSelf(o.scaleX*E.x,o.scaleY*E.y)),t.fillStyle=A,t.fillRect(F.x,F.y,F.w,F.h),t.restore();}function En(t,e,n,o,r){try{let i=Ut(Math.max(1,Math.ceil(o)),Math.max(1,Math.ceil(r))),a=i?.getContext("2d");if(!i||!a)return t;a.drawImage(t,e,n,o,r,0,0,i.width,i.height);let l=ce(t);return _e(i,{x:l.x*o/i.width,y:l.y*r/i.height}),i}catch{return t}}function ze(t,e){e.path?je(t,e.path,e.x,e.y,e.w,e.h):(t.beginPath(),t.rect(e.x,e.y,e.w,e.h));}function V(t){return t===void 0||!Number.isFinite(t)?0:Math.min(Math.max(t,0),1)}function Et(t){return "naturalWidth"in t&&typeof t.naturalWidth=="number"?t.naturalWidth:"width"in t&&typeof t.width=="number"?t.width:0}function At(t){return "naturalHeight"in t&&typeof t.naturalHeight=="number"?t.naturalHeight:"height"in t&&typeof t.height=="number"?t.height:0}function je(t,e,n,o,r,i){t.beginPath();for(let a of e)switch(a.type){case "move":t.moveTo(n+a.x*r,o+a.y*i);break;case "line":t.lineTo(n+a.x*r,o+a.y*i);break;case "quad":t.quadraticCurveTo(n+a.cpx*r,o+a.cpy*i,n+a.x*r,o+a.y*i);break;case "cubic":t.bezierCurveTo(n+a.cp1x*r,o+a.cp1y*i,n+a.cp2x*r,o+a.cp2y*i,n+a.x*r,o+a.y*i);break;case "close":t.closePath();break}}function Mt(t,e,n,o,r,i){t.strokeStyle=e.paint?be(t,e.paint,n,o,r,i):e.color,t.lineWidth=e.width,t.setLineDash(e.dashed?[Math.max(3,e.width*2),Math.max(2,e.width)]:[]),t.lineJoin=e.join??"miter",t.stroke();}function be(t,e,n,o,r,i){if(e.kind==="solid")return e.color;let a=(e.angleDeg??0)*Math.PI/180,l=n+r/2,s=o+i/2,u=Math.hypot(r,i)/2,f=e.gradientType==="linear"?t.createLinearGradient(l-Math.cos(a)*u,s-Math.sin(a)*u,l+Math.cos(a)*u,s+Math.sin(a)*u):t.createRadialGradient(l,s,0,l,s,u);for(let b of e.stops)f.addColorStop(Math.max(0,Math.min(1,b.position)),b.color);return f}async function An(t,e,n,o,r){let i;if(e.assetId&&n){let a=await Mn(n,e.assetId);a&&(i=e.effects?.length?jn(a,e.effects):a);}if(e.shadow&&(i||e.stroke||e.shadow.paths?.some(a=>a.stroke))){let a=e.shadow.paths?.length?e.shadow.paths.map(l=>({image:{...e,path:l.path,stroke:l.stroke},source:l.fill?i:void 0})):[{image:e,source:i}];Jt(t,e.shadow,a.flatMap(l=>In(l.image)),a.reduce((l,s)=>Math.max(l,s.image.stroke?.width??0),0),o,r,l=>{for(let s of a)Ct(l,s.image,s.source);});}Ct(t,e,i);}async function Mn(t,e){try{return await t(e)}catch{return null}}function Ct(t,e,n){n&&Fn(t,n,e),e.stroke&&(ze(t,e),Mt(t,e.stroke,e.x,e.y,e.w,e.h));}var It=33554432,Un=67108864;function On(t){let e=t,n=e.naturalWidth??e.videoWidth??e.displayWidth??(typeof e.width=="number"?e.width:0),o=e.naturalHeight??e.videoHeight??e.displayHeight??(typeof e.height=="number"?e.height:0);return n>0&&o>0?{width:n,height:o}:null}function Dn(t){let e=t.width*t.height;if(e<=It)return t;let n=Math.sqrt(It/e);return {width:Math.max(1,Math.floor(t.width*n)),height:Math.max(1,Math.floor(t.height*n))}}var We=new WeakMap,re=[],Le=0;function Bn(t){let e=t;return "videoWidth"in e||"displayWidth"in e||typeof e.getContext=="function"}function Ln(t,e){let n=We.get(t),o=n?.get(e);if(!n||!o)return;let r=re.findIndex(i=>i.entries===n&&i.key===e);return r>=0&&re.push(...re.splice(r,1)),o}function Nn(t,e,n,o){let r=We.get(t);for(r||(r=new Map,We.set(t,r)),r.set(e,n),re.push({entries:r,key:e,pixels:o}),Le+=o;Le>Un&&re.length>1;){let i=re.shift();if(!i)break;i.entries.delete(i.key),Le-=i.pixels;}}function Ut(t,e){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(t,e);if(typeof document>"u")return null;let n=document.createElement("canvas");return n.width=t,n.height=e,n}function jn(t,e){let n=On(t);if(!n)return t;let o=JSON.stringify(e),r=!Bn(t);if(r){let a=Ln(t,o);if(a)return a}let i=Dn(n);try{let a=Ut(i.width,i.height),l=a?.getContext("2d");if(!a||!l)return t;l.drawImage(t,0,0,i.width,i.height);let s=l.getImageData(0,0,i.width,i.height);Hn(s.data,e),l.putImageData(s,0,0);let u=a,f=ce(t);return _e(u,{x:f.x*n.width/i.width,y:f.y*n.height/i.height}),r&&Nn(t,o,u,i.width*i.height),u}catch{return t}}function Ne(t,e){return .299*t[e]+.587*t[e+1]+.114*t[e+2]}function Wn(t,e){let n=Math.min(Math.max(e,-1),1),o=n>=0?128/(128-127*n):(128+127*n)/128,r=128-128*o+255*Math.min(Math.max(t,-1),1)*(1+o)/2,i=new Uint8ClampedArray(256);for(let a=0;a<256;a+=1)i[a]=Math.round(o*a+r);return i}function he(t){let e=t.startsWith("#")?t.slice(1):t,n=e.length===3||e.length===4?[...e].map(i=>i+i).join(""):e;if(n.length!==6&&n.length!==8)return null;let o=i=>Number.parseInt(n.slice(i,i+2),16),r=[o(0),o(2),o(4),n.length===8?o(6):255];return r.some(Number.isNaN)?null:r}function Hn(t,e){for(let n of e)switch(n.kind){case "biLevel":{let o=Math.min(Math.max(n.threshold,0),1)*255;for(let r=0;r<t.length;r+=4){let i=Ne(t,r)<o?0:255;t[r]=i,t[r+1]=i,t[r+2]=i;}break}case "alpha":{let o=Math.min(Math.max(n.amount,0),1);for(let r=3;r<t.length;r+=4)t[r]=Math.round(t[r]*o);break}case "grayscale":{for(let o=0;o<t.length;o+=4){let r=Math.round(Ne(t,o));t[o]=r,t[o+1]=r,t[o+2]=r;}break}case "luminance":{let o=Wn(n.brightness,n.contrast);for(let r=0;r<t.length;r+=4)t[r]=o[t[r]],t[r+1]=o[t[r+1]],t[r+2]=o[t[r+2]];break}case "duotone":{let o=he(n.shadow),r=he(n.highlight);if(!o||!r)break;for(let i=0;i<t.length;i+=4){let a=Ne(t,i)/255;for(let s=0;s<3;s+=1)t[i+s]=Math.round(o[s]*(1-a)+r[s]*a);let l=o[3]*(1-a)+r[3]*a;t[i+3]=Math.round(t[i+3]*l/255);}break}case "colorChange":{let o=he(n.from),r=he(n.to);if(!o||!r)break;for(let i=0;i<t.length;i+=4)t[i]!==o[0]||t[i+1]!==o[1]||t[i+2]!==o[2]||n.useAlpha!==false&&t[i+3]!==o[3]||(t[i]=r[0],t[i+1]=r[1],t[i+2]=r[2],n.useAlpha!==false&&(t[i+3]=r[3]));break}}}function qn(t,e,n,o,r=[],i){e.overflow||(t.beginPath(),t.rect(e.x,e.y,e.w,e.h),t.clip()),t.textAlign="left",t.textBaseline="alphabetic";let a=r.filter(s=>s.storyId===e.storyId);kt(t,e,a,false);let l=e.textShadow;l&&(t.save(),t.shadowColor=l.color,t.shadowBlur=Math.max(l.blur??0,0),t.shadowOffsetX=l.dx??0,t.shadowOffsetY=l.dy??0);for(let s of e.lines)for(let u of s.runs)zn(t,u,s.baseline,n,o,i);l&&t.restore(),kt(t,e,a,true);}function kt(t,e,n,o){if(n.length!==0)for(let r of e.lines)for(let i of r.runs)for(let a of n){let l=Math.max(i.start,a.start),s=Math.min(i.end,a.end);if(l>=s)continue;let u=r.caretStops.filter(C=>C.position>=l&&C.position<=s),f=u.length>1?Math.max(i.x,Math.min(...u.map(C=>C.x))):i.x,b=u.length>1?Math.min(i.x+i.width,Math.max(...u.map(C=>C.x))):i.x+i.width;if(b<=f)continue;let P=a.kind==="insertion";if(o){t.fillStyle=P?"#166534":"#b91c1c";let k=r.baseline-(i.baselineOffsetPx??0)+i.fontSizePx*(P?.08:-0.3);t.fillRect(f,k,b-f,Math.max(1,i.fontSizePx*.05));}else t.fillStyle=P?"#dcfce7cc":"#fee2e2cc",t.fillRect(f,r.y,b-f,r.height);}}function zn(t,e,n,o,r,i){let a=e.italic?"italic ":"",l=e.bold?"bold ":"",s=i?.({family:e.fontFamily,bold:e.bold===true,italic:e.italic===true,id:e.fontId})??r(e.fontFamily,e.bold,e.italic);t.font=`${a}${l}${e.fontSizePx}px ${Kn(s)}`,t.fillStyle=e.color;let u=e.letterSpacingPx??0;t.letterSpacing=u===0?"0px":`${u}px`;let f="fontKerning"in t?t.fontKerning:void 0;f!==void 0&&(t.fontKerning=e.kerning===false?"none":"auto");let b="textRendering"in t?t.textRendering:void 0;b!==void 0&&(t.textRendering="geometricPrecision");let P=n-(e.baselineOffsetPx??0);o.paintTextChunks(t,e,P,u),t.letterSpacing="0px",f!==void 0&&(t.fontKerning=f),b!==void 0&&(t.textRendering=b),e.underline&&t.fillRect(e.x,P+e.fontSizePx*.08,e.width,Math.max(1,e.fontSizePx*.05));let C=Math.max(1,e.fontSizePx*.05),k=P-e.fontSizePx*.3,A=e.strike==="sngStrike"?[0]:e.strike==="dblStrike"?[-C,C]:[];for(let E of A)t.fillRect(e.x,k+E,e.width,C);}function Kn(t){return t.includes(" ")?JSON.stringify(t):t}function Vn(t,e){t.strokeStyle="#8a94a6",t.lineWidth=1,t.setLineDash([5,4]),t.strokeRect(e.x,e.y,e.w,e.h),e.label&&(t.setLineDash([]),t.fillStyle="#5d6675",t.font="12px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(e.label,e.x+e.w/2,e.y+e.h/2,Math.max(0,e.w-12)));}var Ot=()=>import('@betteroffice/fonts'),Tr=()=>import('@betteroffice/fonts/progressive');var T=class t{static __wrap(e){let n=Object.create(t.prototype);return n.__wbg_ptr=e,Dt.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Dt.unregister(this),e}free(){let e=this.__destroy_into_raw();d.__wbg_pptxdocument_free(e,0);}acceptProposalJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_acceptProposalJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}addCommentJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_addCommentJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}addPictureJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_addPictureJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}addShapeJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_addShapeJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}addTextBoxJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_addTextBoxJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}addTextBoxProfiledJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_addTextBoxProfiledJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}addUndoBoundary(){d.pptxdocument_addUndoBoundary(this.__wbg_ptr);}adoptPeerIdentity(){let e=d.pptxdocument_adoptPeerIdentity(this.__wbg_ptr);if(e[1])throw g(e[0])}anchorCaretJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_anchorCaretJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}applyEditsJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_applyEditsJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}applyUpdateJson(e){let n,o;try{let a=J(e,d.__wbindgen_malloc),l=_,s=d.pptxdocument_applyUpdateJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}bringShapeForwardJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_bringShapeForwardJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}bringShapeToFrontJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_bringShapeToFrontJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}canRedo(){return d.pptxdocument_canRedo(this.__wbg_ptr)!==0}canUndo(){return d.pptxdocument_canUndo(this.__wbg_ptr)!==0}checkTableEditJson(e){let n=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),o=_,r=d.pptxdocument_checkTableEditJson(this.__wbg_ptr,n,o);if(r[1])throw g(r[0])}clearUpdateObservation(){d.pptxdocument_clearUpdateObservation(this.__wbg_ptr);}get clientId(){return d.pptxdocument_clientId(this.__wbg_ptr)}commentsJson(){let e,n;try{let i=d.pptxdocument_commentsJson(this.__wbg_ptr);var o=i[0],r=i[1];if(i[3])throw o=0,r=0,g(i[2]);return e=o,n=r,m(o,r)}finally{d.__wbindgen_free(e,n,1);}}deleteSlideJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_deleteSlideJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}deleteTableColumnJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_deleteTableColumnJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}deleteTableRowJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_deleteTableRowJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}deleteTextJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_deleteTextJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}deleteTextProfiledJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_deleteTextProfiledJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}documentVersion(){let e,n;try{let o=d.pptxdocument_documentVersion(this.__wbg_ptr);return e=o[0],n=o[1],m(o[0],o[1])}finally{d.__wbindgen_free(e,n,1);}}drainUpdateEvent(){let e=d.pptxdocument_drainUpdateEvent(this.__wbg_ptr);var n=W(e[0],e[1]).slice();return d.__wbindgen_free(e[0],e[1]*1,1),n}duplicateSlideJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_duplicateSlideJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}encodeDiff(e){let n=J(e,d.__wbindgen_malloc),o=_,r=d.pptxdocument_encodeDiff(this.__wbg_ptr,n,o);if(r[3])throw g(r[2]);var i=W(r[0],r[1]).slice();return d.__wbindgen_free(r[0],r[1]*1,1),i}encodeStateAsUpdate(){let e=d.pptxdocument_encodeStateAsUpdate(this.__wbg_ptr);var n=W(e[0],e[1]).slice();return d.__wbindgen_free(e[0],e[1]*1,1),n}encodeStateVector(){let e=d.pptxdocument_encodeStateVector(this.__wbg_ptr);var n=W(e[0],e[1]).slice();return d.__wbindgen_free(e[0],e[1]*1,1),n}exportMarkdownJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_exportMarkdownJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}exportStructuredJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_exportStructuredJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}findTextJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_findTextJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}formatTextJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_formatTextJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}insertParagraphBreakJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_insertParagraphBreakJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}insertSlideJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_insertSlideJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}insertSlideProfiledJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_insertSlideProfiledJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}insertTableColumnJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_insertTableColumnJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}insertTableRowJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_insertTableRowJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}insertTextJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_insertTextJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}insertTextProfiledJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_insertTextProfiledJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}listProposalsJson(){let e,n;try{let i=d.pptxdocument_listProposalsJson(this.__wbg_ptr);var o=i[0],r=i[1];if(i[3])throw o=0,r=0,g(i[2]);return e=o,n=r,m(o,r)}finally{d.__wbindgen_free(e,n,1);}}mediaBytes(e){let n=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),o=_,r=d.pptxdocument_mediaBytes(this.__wbg_ptr,n,o);if(r[3])throw g(r[2]);var i=W(r[0],r[1]).slice();return d.__wbindgen_free(r[0],r[1]*1,1),i}metafileSvg(e){let n=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),o=_,r=d.pptxdocument_metafileSvg(this.__wbg_ptr,n,o),i;return r[0]!==0&&(i=W(r[0],r[1]).slice(),d.__wbindgen_free(r[0],r[1]*1,1)),i}moveShapeJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_moveShapeJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}moveShapeProfiledJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_moveShapeProfiledJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}moveSlideJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_moveSlideJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}static openCollaborativeFromUpdate(e,n,o){let r=J(e,d.__wbindgen_malloc),i=_;var a=M(o)?0:J(o,d.__wbindgen_malloc),l=_;let s=d.pptxdocument_openCollaborativeFromUpdate(r,i,n,a,l);if(s[2])throw g(s[1]);return t.__wrap(s[0])}static openCollaborative(e,n){let o=J(e,d.__wbindgen_malloc),r=_,i=d.pptxdocument_openCollaborative(o,r,n);if(i[2])throw g(i[1]);return t.__wrap(i[0])}static openPeerDeckJson(e,n,o){let r=J(e,d.__wbindgen_malloc),i=_,a=w(n,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_;var s=M(o)?0:J(o,d.__wbindgen_malloc),u=_;let f=d.pptxdocument_openPeerDeckJson(r,i,a,l,s,u);if(f[2])throw g(f[1]);return t.__wrap(f[0])}static openReplayBaseline(e,n,o){let r=J(e,d.__wbindgen_malloc),i=_;var a=M(o)?0:J(o,d.__wbindgen_malloc),l=_;let s=d.pptxdocument_openReplayBaseline(r,i,!M(n),M(n)?0:n,a,l);if(s[2])throw g(s[1]);return t.__wrap(s[0])}peerHydrationJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_peerHydrationJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}previewProposalJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_previewProposalJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}proposalSlideStripJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_proposalSlideStripJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}proposeJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_proposeJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}readCommandContentJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_readCommandContentJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}readContentJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_readContentJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}redoJson(){let e,n;try{let i=d.pptxdocument_redoJson(this.__wbg_ptr);var o=i[0],r=i[1];if(i[3])throw o=0,r=0,g(i[2]);return e=o,n=r,m(o,r)}finally{d.__wbindgen_free(e,n,1);}}redoReceiptJson(){let e,n;try{let i=d.pptxdocument_redoReceiptJson(this.__wbg_ptr);var o=i[0],r=i[1];if(i[3])throw o=0,r=0,g(i[2]);return e=o,n=r,m(o,r)}finally{d.__wbindgen_free(e,n,1);}}registerPeerFontsJson(e){let n=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),o=_,r=d.pptxdocument_registerPeerFontsJson(this.__wbg_ptr,n,o);if(r[1])throw g(r[0])}rejectProposalJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_rejectProposalJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}removeCommentJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_removeCommentJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}removeShapeJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_removeShapeJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}replayJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_replayJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}replyToCommentJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_replyToCommentJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}resizeShapeJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_resizeShapeJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}resolveCaretAnchorJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_resolveCaretAnchorJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}saveBytes(){let e=d.pptxdocument_saveBytes(this.__wbg_ptr);if(e[3])throw g(e[2]);var n=W(e[0],e[1]).slice();return d.__wbindgen_free(e[0],e[1]*1,1),n}searchTextJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_searchTextJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}sendShapeBackwardJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_sendShapeBackwardJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}sendShapeToBackJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_sendShapeToBackJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}sessionMetadataJson(){let e,n;try{let i=d.pptxdocument_sessionMetadataJson(this.__wbg_ptr);var o=i[0],r=i[1];if(i[3])throw o=0,r=0,g(i[2]);return e=o,n=r,m(o,r)}finally{d.__wbindgen_free(e,n,1);}}setCollaborative(){let e=d.pptxdocument_setCollaborative(this.__wbg_ptr);if(e[1])throw g(e[0])}setCommentFlavorJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_setCommentFlavorJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}setCommentPositionJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_setCommentPositionJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}setCommentStatusJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_setCommentStatusJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}setParagraphAlignmentJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_setParagraphAlignmentJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}setShapeAdjustJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_setShapeAdjustJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}setShapeFillJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_setShapeFillJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}setShapeRectJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_setShapeRectJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}setShapeStrokeJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_setShapeStrokeJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}setSlideLayoutJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_setSlideLayoutJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}setSlideNotesJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_setSlideNotesJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}setStoryParagraphsJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_setStoryParagraphsJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}setUndoCaptureMode(e){let n=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),o=_,r=d.pptxdocument_setUndoCaptureMode(this.__wbg_ptr,n,o);if(r[1])throw g(r[0])}snapshotJson(){let e,n;try{let i=d.pptxdocument_snapshotJson(this.__wbg_ptr);var o=i[0],r=i[1];if(i[3])throw o=0,r=0,g(i[2]);return e=o,n=r,m(o,r)}finally{d.__wbindgen_free(e,n,1);}}startUpdateObservation(){let e=d.pptxdocument_startUpdateObservation(this.__wbg_ptr);if(e[1])throw g(e[0])}storyFormattingJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_storyFormattingJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}storyJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_storyJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}undoCaptureMode(){let e,n;try{let o=d.pptxdocument_undoCaptureMode(this.__wbg_ptr);return e=o[0],n=o[1],m(o[0],o[1])}finally{d.__wbindgen_free(e,n,1);}}undoJson(){let e,n;try{let i=d.pptxdocument_undoJson(this.__wbg_ptr);var o=i[0],r=i[1];if(i[3])throw o=0,r=0,g(i[2]);return e=o,n=r,m(o,r)}finally{d.__wbindgen_free(e,n,1);}}undoProfiledJson(){let e,n;try{let i=d.pptxdocument_undoProfiledJson(this.__wbg_ptr);var o=i[0],r=i[1];if(i[3])throw o=0,r=0,g(i[2]);return e=o,n=r,m(o,r)}finally{d.__wbindgen_free(e,n,1);}}undoReceiptJson(){let e,n;try{let i=d.pptxdocument_undoReceiptJson(this.__wbg_ptr);var o=i[0],r=i[1];if(i[3])throw o=0,r=0,g(i[2]);return e=o,n=r,m(o,r)}finally{d.__wbindgen_free(e,n,1);}}validateEditsJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_validateEditsJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}validateProposalJson(e){let n,o;try{let a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=d.pptxdocument_validateProposalJson(this.__wbg_ptr,a,l);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,g(s[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}static version(){let e,n;try{let o=d.pptxdocument_version();return e=o[0],n=o[1],m(o[0],o[1])}finally{d.__wbindgen_free(e,n,1);}}};Symbol.dispose&&(T.prototype[Symbol.dispose]=T.prototype.free);var K=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Bt.unregister(this),e}free(){let e=this.__destroy_into_raw();d.__wbg_pptxrenderer_free(e,0);}exportSlideJson(e,n){let o,r;try{B(e,T);let l=d.pptxrenderer_exportSlideJson(this.__wbg_ptr,e.__wbg_ptr,n);var i=l[0],a=l[1];if(l[3])throw i=0,a=0,g(l[2]);return o=i,r=a,m(i,a)}finally{d.__wbindgen_free(o,r,1);}}hitTestJson(e,n){let o,r;try{let l=d.pptxrenderer_hitTestJson(this.__wbg_ptr,e,n);var i=l[0],a=l[1];if(l[3])throw i=0,a=0,g(l[2]);return o=i,r=a,m(i,a)}finally{d.__wbindgen_free(o,r,1);}}hitTestSlideJson(e,n,o,r){let i,a;try{B(e,T);let u=w(n,d.__wbindgen_malloc,d.__wbindgen_realloc),f=_,b=d.pptxrenderer_hitTestSlideJson(this.__wbg_ptr,e.__wbg_ptr,u,f,o,r);var l=b[0],s=b[1];if(b[3])throw l=0,s=0,g(b[2]);return i=l,a=s,m(l,s)}finally{d.__wbindgen_free(i,a,1);}}layoutProposalDiffSlideByIdJson(e,n,o){let r,i;try{B(e,T);let s=w(n,d.__wbindgen_malloc,d.__wbindgen_realloc),u=_,f=w(o,d.__wbindgen_malloc,d.__wbindgen_realloc),b=_,P=d.pptxrenderer_layoutProposalDiffSlideByIdJson(this.__wbg_ptr,e.__wbg_ptr,s,u,f,b);var a=P[0],l=P[1];if(P[3])throw a=0,l=0,g(P[2]);return r=a,i=l,m(a,l)}finally{d.__wbindgen_free(r,i,1);}}layoutProposalDiffSlideJson(e,n,o){let r,i;try{B(e,T);let s=w(n,d.__wbindgen_malloc,d.__wbindgen_realloc),u=_,f=d.pptxrenderer_layoutProposalDiffSlideJson(this.__wbg_ptr,e.__wbg_ptr,s,u,o);var a=f[0],l=f[1];if(f[3])throw a=0,l=0,g(f[2]);return r=a,i=l,m(a,l)}finally{d.__wbindgen_free(r,i,1);}}layoutProposalSlideJson(e,n,o){let r,i;try{B(e,T);let s=w(n,d.__wbindgen_malloc,d.__wbindgen_realloc),u=_,f=d.pptxrenderer_layoutProposalSlideJson(this.__wbg_ptr,e.__wbg_ptr,s,u,o);var a=f[0],l=f[1];if(f[3])throw a=0,l=0,g(f[2]);return r=a,i=l,m(a,l)}finally{d.__wbindgen_free(r,i,1);}}layoutSlideJson(e,n){let o,r;try{B(e,T);let l=d.pptxrenderer_layoutSlideJson(this.__wbg_ptr,e.__wbg_ptr,n);var i=l[0],a=l[1];if(l[3])throw i=0,a=0,g(l[2]);return o=i,r=a,m(i,a)}finally{d.__wbindgen_free(o,r,1);}}layoutSlideProfiledJson(e,n){let o,r;try{B(e,T);let l=d.pptxrenderer_layoutSlideProfiledJson(this.__wbg_ptr,e.__wbg_ptr,n);var i=l[0],a=l[1];if(l[3])throw i=0,a=0,g(l[2]);return o=i,r=a,m(i,a)}finally{d.__wbindgen_free(o,r,1);}}constructor(){let e=d.pptxrenderer_new();return this.__wbg_ptr=e,Bt.register(this,this.__wbg_ptr,this),this}previewShapeRectJson(e,n){let o,r;try{B(e,T);let l=d.pptxrenderer_previewShapeRectJson(this.__wbg_ptr,e.__wbg_ptr,n);var i=l[0],a=l[1];if(l[3])throw i=0,a=0,g(l[2]);return o=i,r=a,m(i,a)}finally{d.__wbindgen_free(o,r,1);}}registerFallbackFont(e,n,o,r){let i=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),a=_,l=J(r,d.__wbindgen_malloc),s=_,u=d.pptxrenderer_registerFallbackFont(this.__wbg_ptr,i,a,n,o,l,s);if(u[2])throw g(u[1]);return u[0]>>>0}registerFont(e,n,o,r){let i=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),a=_,l=J(r,d.__wbindgen_malloc),s=_,u=d.pptxrenderer_registerFont(this.__wbg_ptr,i,a,n,o,l,s);if(u[2])throw g(u[1]);return u[0]>>>0}requestedFontFacesJson(e,n){let o,r;try{B(e,T);var i=M(n)?0:w(n,d.__wbindgen_malloc,d.__wbindgen_realloc),a=_;let u=d.pptxrenderer_requestedFontFacesJson(this.__wbg_ptr,e.__wbg_ptr,i,a);var l=u[0],s=u[1];if(u[3])throw l=0,s=0,g(u[2]);return o=l,r=s,m(l,s)}finally{d.__wbindgen_free(o,r,1);}}saveBytes(e){B(e,T);let n=d.pptxrenderer_saveBytes(this.__wbg_ptr,e.__wbg_ptr);if(n[3])throw g(n[2]);var o=W(n[0],n[1]).slice();return d.__wbindgen_free(n[0],n[1]*1,1),o}setActiveSlide(e,n,o){B(e,T);let r=w(n,d.__wbindgen_malloc,d.__wbindgen_realloc),i=_,a=w(o,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_;return d.pptxrenderer_setActiveSlide(this.__wbg_ptr,e.__wbg_ptr,r,i,a,l)!==0}setBrowserCoverageFallback(e){d.pptxrenderer_setBrowserCoverageFallback(this.__wbg_ptr,e);}slideLayoutKey(e,n){let o,r;try{B(e,T);let l=d.pptxrenderer_slideLayoutKey(this.__wbg_ptr,e.__wbg_ptr,n);var i=l[0],a=l[1];if(l[3])throw i=0,a=0,g(l[2]);return o=i,r=a,m(i,a)}finally{d.__wbindgen_free(o,r,1);}}snapshotWithLayoutKeysJson(e){let n,o;try{B(e,T);let a=d.pptxrenderer_snapshotWithLayoutKeysJson(this.__wbg_ptr,e.__wbg_ptr);var r=a[0],i=a[1];if(a[3])throw r=0,i=0,g(a[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}};Symbol.dispose&&(K.prototype[Symbol.dispose]=K.prototype.free);function Ve(t,e,n,o){let r=J(t,d.__wbindgen_malloc),i=_,a=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_;var s=M(n)?0:J(n,d.__wbindgen_malloc),u=_;let f=d.decodeFontFace(r,i,a,l,s,u,!M(o),M(o)?0:o);if(f[2])throw g(f[1]);return g(f[0])}function $e(t){let e=J(t,d.__wbindgen_malloc),n=_,o=d.decodeTiffPng(e,n);if(o[3])throw g(o[2]);var r=W(o[0],o[1]).slice();return d.__wbindgen_free(o[0],o[1]*1,1),r}function Xe(t,e){let n,o;try{let a=J(t,d.__wbindgen_malloc),l=_,s=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),u=_,f=d.exportPptxMarkdownJson(a,l,s,u);var r=f[0],i=f[1];if(f[3])throw r=0,i=0,g(f[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}function Ge(t,e){let n,o;try{let a=J(t,d.__wbindgen_malloc),l=_,s=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),u=_,f=d.exportPptxStructuredJson(a,l,s,u);var r=f[0],i=f[1];if(f[3])throw r=0,i=0,g(f[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}function Ye(t){let e,n;try{let i=J(t,d.__wbindgen_malloc),a=_,l=d.parsePptxJson(i,a);var o=l[0],r=l[1];if(l[3])throw o=0,r=0,g(l[2]);return e=o,n=r,m(o,r)}finally{d.__wbindgen_free(e,n,1);}}function Ze(t){let e,n;try{let i=J(t,d.__wbindgen_malloc),a=_,l=d.parsePptxJsonWithoutMedia(i,a);var o=l[0],r=l[1];if(l[3])throw o=0,r=0,g(l[2]);return e=o,n=r,m(o,r)}finally{d.__wbindgen_free(e,n,1);}}function Qe(t,e){let n,o;try{let a=w(t,d.__wbindgen_malloc,d.__wbindgen_realloc),l=_,s=w(e,d.__wbindgen_malloc,d.__wbindgen_realloc),u=_,f=d.renderPptxMarkdownJson(a,l,s,u);var r=f[0],i=f[1];if(f[3])throw r=0,i=0,g(f[2]);return n=r,o=i,m(r,i)}finally{d.__wbindgen_free(n,o,1);}}function et(){let t,e;try{let n=d.rendererVersion();return t=n[0],e=n[1],m(n[0],n[1])}finally{d.__wbindgen_free(t,e,1);}}function $n(){return {__proto__:null,"./pptx_wasm_bg.js":{__proto__:null,__wbg_Error_30c8987f7c2ed4e2:function(e,n){return Error(m(e,n))},__wbg___wbindgen_is_function_1f9d30630b8b1d3d:function(e){return typeof e=="function"},__wbg___wbindgen_is_undefined_8865fb403f8fe9d8:function(e){return e===void 0},__wbg___wbindgen_number_get_2e0e7dee9f701a71:function(e,n){let o=n,r=typeof o=="number"?o:void 0;ye().setFloat64(e+8,M(r)?0:r,true),ye().setInt32(e+0,!M(r),true);},__wbg___wbindgen_string_get_0380ccaa2f57f0d9:function(e,n){let o=n,r=typeof o=="string"?o:void 0;var i=M(r)?0:w(r,d.__wbindgen_malloc,d.__wbindgen_realloc),a=_;ye().setInt32(e+4,a,true),ye().setInt32(e+0,i,true);},__wbg___wbindgen_throw_41e9ee4f547fc59a:function(e,n){throw new Error(m(e,n))},__wbg_call_6137034ef55c9d0f:function(){return we(function(e,n){return e.call(n)},arguments)},__wbg_getRandomValues_a608c4436c19407a:function(){return we(function(e,n){globalThis.crypto.getRandomValues(W(e,n));},arguments)},__wbg_get_31af05bd4842a84f:function(){return we(function(e,n){return Reflect.get(e,n)},arguments)},__wbg_new_343a093a3c2ffb4e:function(e,n){return new Error(m(e,n))},__wbg_new_617a8cdb8bb1130e:function(){return new Object},__wbg_new_from_slice_9a868026ffa4208a:function(e,n){return new Uint8Array(W(e,n))},__wbg_now_68a0bbb746d42d4e: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 we(function(e,n,o){return Reflect.set(e,n,o)},arguments)},__wbg_set_name_2c630595dc90a7aa:function(e,n,o){e.name=m(n,o);},__wbg_static_accessor_GLOBAL_266715b9d96ba635:function(){let e=typeof global>"u"?null:global;return M(e)?0:fe(e)},__wbg_static_accessor_GLOBAL_THIS_10fb7dc1ae063179:function(){let e=typeof globalThis>"u"?null:globalThis;return M(e)?0:fe(e)},__wbg_static_accessor_SELF_0b583911f537483a:function(){let e=typeof self>"u"?null:self;return M(e)?0:fe(e)},__wbg_static_accessor_WINDOW_d7f903d1508cbdc4:function(){let e=typeof window>"u"?null:window;return M(e)?0:fe(e)},__wbindgen_generic_0000000000000001:function(e,n){return m(e,n)},__wbindgen_init_externref_table:function(){let e=d.__wbindgen_externrefs,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,true),e.set(n+3,false);}}}}var Dt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>d.__wbg_pptxdocument_free(t,1)),Bt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>d.__wbg_pptxrenderer_free(t,1));function fe(t){let e=d.__externref_table_alloc();return d.__wbindgen_externrefs.set(e,t),e}function B(t,e){if(!(t instanceof e))throw new Error(`expected instance of ${e.name}`)}function W(t,e){return t=t>>>0,oe().subarray(t/1,t/1+e)}var X=null;function ye(){return (X===null||X.buffer.detached===true||X.buffer.detached===void 0&&X.buffer!==d.memory.buffer)&&(X=new DataView(d.memory.buffer)),X}function m(t,e){return Gn(t>>>0,e)}var pe=null;function oe(){return (pe===null||pe.byteLength===0)&&(pe=new Uint8Array(d.memory.buffer)),pe}function we(t,e){try{return t.apply(this,e)}catch(n){let o=fe(n);d.__wbindgen_exn_store(o);}}function M(t){return t==null}function J(t,e){let n=e(t.length*1,1)>>>0;return oe().set(t,n/1),_=t.length,n}function w(t,e,n){if(n===void 0){let l=ue.encode(t),s=e(l.length,1)>>>0;return oe().subarray(s,s+l.length).set(l),_=l.length,s}let o=t.length,r=e(o,1)>>>0,i=oe(),a=0;for(;a<o;a++){let l=t.charCodeAt(a);if(l>127)break;i[r+a]=l;}if(a!==o){a!==0&&(t=t.slice(a)),r=n(r,o,o=a+t.length*3,1)>>>0;let l=oe().subarray(r+a,r+o),s=ue.encodeInto(t,l);a+=s.written,r=n(r,o,a,1)>>>0;}return _=a,r}function g(t){let e=d.__wbindgen_externrefs.get(t);return d.__externref_table_dealloc(t),e}var xe=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true});xe.decode();var Xn=2146435072,Ke=0;function Gn(t,e){return Ke+=e,Ke>=Xn&&(xe=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}),xe.decode(),Ke=e),xe.decode(oe().subarray(t,t+e))}var ue=new TextEncoder;"encodeInto"in ue||(ue.encodeInto=function(t,e){let n=ue.encode(t);return e.set(n),{read:t.length,written:n.length}});var _=0,d;function Qn(t,e){return d=t.exports,X=null,pe=null,d.__wbindgen_start(),d}async function er(t,e){if(typeof Response=="function"&&t instanceof Response){if(!t.ok)throw new Error(`failed to fetch Wasm: ${t.status} ${t.statusText} fetching '${t.url}'`);if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(r){if(n(t.type)&&t.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 o=await t.arrayBuffer();return await WebAssembly.instantiate(o,e)}else {let o=await WebAssembly.instantiate(t,e);return o instanceof WebAssembly.Instance?{instance:o,module:t}:o}function n(o){switch(o){case "basic":case "cors":case "default":return true}return false}}async function tt(t){if(d!==void 0)return d;if(t!==void 0&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),t===void 0)throw new Error("pptx-wasm requires an explicit module or URL");let e=$n();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:n,module:o}=await er(await t,e);return Qn(n)}var Lt="wasm";function Er(){return import('./chunk-QWRXUT7T.js')}async function Ar(){return (await Ot()).checkFontPacks()}function Nt(){return new URL("./generated/pptx_wasm_bg.wasm",import.meta.url)}function Or(){return new URL("./generated/pptx_wasm_lean_bg.wasm",import.meta.url)}function Dr(){return new URL("./generated/metafile_svg_wasm_bg.wasm",import.meta.url)}var Br=true;var Nr="SessionSuperseded",nt=class extends Error{constructor(n,o,r){super(o);a(this,"code",n);a(this,"diagnostics",r);this.name="SessionFailure";}};var tr=async()=>{};var Wt=(...t)=>tr(...t),jt=class extends TypeError{constructor(e){super(`Failed to resolve module specifier '${e}'`);}};function nr(t){let e=t;return e?.protocol===1&&e.kind==="font-pack-request"&&typeof e.id=="string"&&(e.pack==="base"||e.pack==="latin"||e.pack==="intl"||e.pack==="cjk"||e.pack==="decoder")}function qr(t,e,n){let o=new Map;return {receive(r){if(!nr(r))return false;let{pack:i}=r,a=globalThis.location?.href,l=o.get(i);if(!l){l=Promise.resolve().then(async()=>{let f=await e(i),b=f&&Object.fromEntries(Object.entries(f).map(([C,k])=>[C,new URL(k,a).href])),P=i==="decoder"?void 0:n?.();return P?{urls:b,cdn:P}:{urls:b}}),o.set(i,l);let u=()=>{o.delete(i);};l.then(u,u);}let s=u=>{try{t(u);}catch{}};return l.then(u=>s({protocol:1,kind:"font-pack-reply",id:r.id,...u,...i==="base"&&a?{pageUrl:a}:{}}),u=>s({protocol:1,kind:"font-pack-reply",id:r.id,error:u instanceof Error?u.message:String(u)})),true}}}var rr="https://cdn.jsdelivr.net/npm/",or=1e4,Pe=Symbol.for("betteroffice.fonts.cdn"),Se=Symbol.for("betteroffice.fonts.cdn.configured-here");var rt=Symbol.for("betteroffice.fonts.cdn.test-globals"),O=globalThis;function ot(t){return t.process?.versions?.node!==void 0||t.Deno!==void 0||t.Bun!==void 0}function qt(t){return t.window?.document!=null&&!ot(t)}function zt(t){if(t&&!(t.implicit&&ot(O[rt]??O)))return {...t}}function ir(){let t=O[Pe];if(t)return zt(t);if(qt(O[rt]??O))return {baseUrl:rr,timeoutMs:or,implicit:true}}function Vr(t,e){t===void 0?delete O[Pe]:O[Pe]={...t},e?O[Se]=e:delete O[Se];}function ar(t){return zt(O[Se]||t===void 0?O[Pe]:t.cdn)}function Ht(t=ir()??null){return t?JSON.stringify([t.baseUrl,t.timeoutMs,t.implicit]):""}async function $r(){let t=O[rt]??O;if(O[Se]||ot(t)||qt(t))return Ht();let e=await Wt("base").catch(()=>{});return Ht(ar(e)??null)}function Kt(t){let e=new Set,n=o=>{for(let r of o)r.kind==="image"&&r.assetId?e.add(r.assetId):(r.kind==="chart"||r.kind==="table")&&n(r.primitives);};return n(t.primitives),e}var ve=class extends Error{constructor(n){super(`Proposal targets changed: ${n.join(", ")}`);a(this,"targets");this.name="StaleProposalError",this.targets=n;}},Ce=class extends Error{constructor(n,o=8*1024*1024){super(`Proposal picture media exceeds ${o} decoded bytes (${n} bytes)`);a(this,"totalBytes",n);a(this,"limitBytes",o);a(this,"code","proposalPictureMediaTooLarge");this.name="ProposalPictureMediaTooLargeError";}};var Ie=class extends Error{constructor(n){super(n.message);a(this,"failure");this.name="PptxExportError",this.failure=n;}};function Vt(t,e,n,o=()=>false){let r=e.trim().toLowerCase();for(let i of t)i.family.trim().toLowerCase()===r&&!o(i)&&(i.bytes=n);}function no(t){return (e,n)=>{let o=G(e).buffer,r=n.dict===void 0?void 0:G(n.dict).buffer;return t(o,{...n,dict:r},r===void 0?[o]:[o,r])}}function G(t){return (t instanceof Uint8Array?t:new Uint8Array(t)).slice()}function $t(t){return {font:G(t.font).buffer,...t.payload===void 0?{}:{payload:G(t.payload).buffer}}}var Xt=new Map,ke=t=>JSON.stringify([t.family,t.bold,t.italic,t.id??null]);function sr(){return typeof document<"u"?document.fonts:globalThis.fonts}function Te(t,e){return new a$1("font-unavailable",`The font "${t}" could not load, so the ${e} was not exported with a substitute.`)}async function Gt(t){let e=new Map;for(let f of t.fonts)e.set(ke(f),f);let n=sr(),o=new Map,r=new Map,i=new Map,a=[],l=()=>{for(let f of a)n?.delete(f);},s=(Xt.get(t.prefix)??0)+1;Xt.set(t.prefix,s);let u=async f=>{let b=o.get(f);if(!b){if(!n||typeof FontFace>"u")throw Te(f.family,t.subject);b=`${t.prefix}-${s}-${o.size}`;let P=await new FontFace(b,f.bytes.slice().buffer,{weight:f.face?.bold??f.bold?"700":"400",style:f.face?.italic??f.italic?"italic":"normal"}).load().catch(()=>{throw Te(f.family,t.subject)});n.add(P),a.push(P),o.set(f,b);}return b};try{for(let[f,b]of e){let P=t.choose(t.faces,b);if(!P)continue;let C=await u(P);r.set(f,{family:C,face:P});let k=[C];for(let A of t.fallbacks?.(b)??[]){let E=await u(A);k.includes(E)||k.push(E);}i.set(f,k);}if(n&&typeof n.load=="function")for(let[f,b]of e){let P=r.get(f),C=await n.load(t.canvasFont(b,P?.family??b.family)).catch(()=>{throw Te(b.family,t.subject)});if(P&&!C?.length)throw Te(b.family,t.subject)}return {family:f=>r.get(ke(f))?.family,face:f=>r.get(ke(f))?.face,families:f=>[...i.get(ke(f))??[]],release:l}}catch(f){throw l(),f}}var dr=4294967295,it=16384,Yt=16777216;function en(){if(typeof OffscreenCanvas=="function")return true;if(typeof document>"u")return false;try{return document.createElement("canvas").getContext("2d")!==null}catch{return false}}function at(){return new a$1("canvas-unavailable","PNG export needs a canvas, and this environment has none. Use @betteroffice/pptx-native.")}function st(t){return new a$1("canvas-unavailable",t==="svg"?"This slide has SVG pictures, which decode only with a document. Export from the page, or use @betteroffice/pptx-native.":"This slide has EMF or WMF pictures this engine cannot convert. Use @betteroffice/pptx-native.")}function tn(t,e){let n=me(t,e);if(n.byteLength)return n;if(t.byteLength&&typeof Image>"u")throw st("metafile")}function lr(t){if(t===void 0)return "slide";if(t==="slide"||t==="transparent"||typeof t=="string"&&/^#[0-9a-fA-F]{6}$/.test(t))return t;throw new TypeError(`background must be "slide", "transparent", or a #rrggbb color, not ${JSON.stringify(t)}`)}function cr(t,e){let n=e.scale??1;if(typeof n!="number"||!Number.isFinite(n)||n<=0)throw new RangeError("scale must be finite and positive");let o=lr(e.background);if(e.maxShadowPixels!==void 0&&(!Number.isSafeInteger(e.maxShadowPixels)||e.maxShadowPixels<0))throw new RangeError("invalid shadow pixel budget");let{width:r,height:i}=He(t,1,n);if(r>it||i>it||r*i>Yt)throw new a$1("canvas-too-large",`A ${r}x${i}px slide is over the ${it}px side or ${Yt} pixel limit; lower the scale.`);return {width:r,height:i,scale:n,background:o}}async function nn(t,e={}){let{width:n,height:o,scale:r,background:i}=cr(t,e);e.signal?.throwIfAborted();let a=fr(t),l=a.find(u=>u.id!==void 0&&u.id!==dr&&!Qt(e.fonts??[],u));if(l)throw new a$1("font-unavailable",`The slide's text was laid out with a ${JSON.stringify(l.family)} face this export does not have.`);let s=await Gt({prefix:"bo-pptx-png",fonts:a,faces:e.fonts??[],choose:Qt,subject:"slide",canvasFont:(u,f)=>`${u.italic?"italic ":""}${u.bold?"bold ":""}16px ${JSON.stringify(f)}`});try{e.signal?.throwIfAborted();let u=pr(n,o),f=u.getContext("2d");if(!f)throw new a$1("canvas-unavailable","PNG export needs a 2d canvas context.");return await Tt(f,t,1,r,{resolveImage:e.resolveImage,maxShadowPixels:e.maxShadowPixels,fontFamily:s.family}),i!=="transparent"&&(f.save(),f.setTransform(1,0,0,1,0,0),f.globalCompositeOperation="destination-over",f.fillStyle=i==="slide"?"#ffffff":i,f.fillRect(0,0,n,o),f.restore()),e.signal?.throwIfAborted(),new Uint8Array(await(await ur(u)).arrayBuffer())}finally{s.release();}}function rn(t,e){for(let n of t)if((n.kind==="chart"||n.kind==="table")&&rn(n.primitives,e),n.kind==="textBox")for(let o of n.lines)for(let r of o.runs){let i={family:r.fontFamily,bold:r.bold===true,italic:r.italic===true,id:r.fontId};e.set(JSON.stringify(i),i);}}function fr(t){let e=new Map;return rn(t.primitives,e),[...e.values()]}var Zt=t=>t.trim().toLowerCase();function Qt(t,e){let n=e.id===void 0?void 0:t.find(o=>o.id===e.id);if(n)return n;for(let[o,r]of [[e.bold,e.italic],[e.bold,false],[false,e.italic],[false,false]]){let i;for(let a of t)a.id===void 0&&Zt(a.family)===Zt(e.family)&&(a.bold??false)===o&&(a.italic??false)===r&&(i=a);if(i)return i}}function pr(t,e){if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(t,e);if(typeof document>"u")throw at();let n=document.createElement("canvas");return n.width=t,n.height=e,n}function ur(t){return "convertToBlob"in t?t.convertToBlob({type:"image/png"}):new Promise((e,n)=>{t.toBlob(o=>{o?e(o):n(new a$1("canvas-too-large","The canvas produced no PNG."));},"image/png");})}var dt;function lt(t){dt?.releaseDefaultFontLayout(t);}function gr(t){try{return Be(De(t))}catch{return false}}function on(t,e){for(let n of t)n.kind==="image"&&n.assetId&&e.add(n.assetId),(n.kind==="chart"||n.kind==="table")&&on(n.primitives,e);return e}async function an(t,e,n){if(!en())throw at();let o,r;if(t.doc&&e.id!==void 0){let a=t.fonts();dt??(dt=await import('./chunk-2XA2UH2O.js'));let l=await dt.defaultFontLayout(t.doc,e.id,a,n.fonts,n.signal);o=l.list,r=[...l.fonts,...n.fonts??[]];}else o=t.displayList(e.slide),r=[...t.fonts(),...n.fonts??[]];let i=new Map;try{for(let a of on(o.primitives,new Set)){n.signal?.throwIfAborted();let l=t.media(a);if(l?.byteLength&&typeof Image>"u"&&gr(l))throw st("svg");i.set(a,l?.byteLength?await yt(l,"image could not decode").catch(()=>null):null);}return await nn(o,{...n,fonts:r,resolveImage:a=>i.get(a)??null})}finally{for(let a of i.values())a?.close?.();}}var Y=new WeakMap;var ko=async(t,{codec:e,dict:n,maxOutput:o})=>(await Ee(),$t(Ve(G(t),e,n===void 0?void 0:G(n),o))),ct=false,L=class extends Error{constructor(n,o){super(o);a(this,"code",n);this.name="PresentationPeerError";}},_r=["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"],ln=new WeakMap;function ie(t){let e=ln.get(t);if(!e)throw new L("stage","Presentation is not a retained replay handle");return e}function Jo(t,e={}){try{return pt(t,e,{kind:"baseline"})}catch(n){throw Je(n)}}function Eo(t,e,n={}){try{return pt(t,n,{kind:"peer",identity:e})}catch(o){throw Je(o)}}function Ao(t){return ie(t).registerFonts()}function Mo(t){ie(t).adopt();}function Uo(t){return ie(t).hydration()}function Oo(t){return ie(t).metadata()}function Do(t,e){return ie(t).displayListJson(e)}function Bo(t,e,n){return ie(t).replay(e,n)}function Lo(t,e){let n=Y.get(t);if(!n)throw new Error("Presentation story formatting is unavailable");return n.jsonWasmCall(()=>n.doc.storyFormattingJson(JSON.stringify({slideId:e.slideId,shapeId:e.shapeId,storyId:e.storyId})))}function No(t,e,n,o){let r=Y.get(t);if(!r||r.peer)throw new Error("Presentation paragraph joining is unavailable");return r.jsonWasmCall(()=>r.doc.deleteTextJson(JSON.stringify({storyId:e,start:n,end:o,allowParagraphJoin:true})),true)}function jo(t){let e=Y.get(t);if(!e)throw new Error("Presentation metadata is unavailable");return e.jsonWasmCall(()=>e.doc.sessionMetadataJson())}function Wo(t,e){let n=Y.get(t);if(!n)throw new Error("Presentation display list is unavailable");return n.wasmCall(()=>n.renderer.layoutSlideJson(n.doc,e))}function Ho(t,e,n,o){let r=Y.get(t);if(!r)throw new Error("Presentation shape preview is unavailable");return r.jsonWasmCall(()=>r.renderer.previewShapeRectJson(r.doc,{slideId:e,shapeId:n,...o}))}function Re(){return typeof T.prototype.proposeJson=="function"&&typeof K.prototype.layoutProposalSlideJson=="function"}var ge;function Ee(t){if(ct)return Promise.resolve();if(ge)return ge;let e;return ge=tt({module_or_path:t??b(e=Nt())}).then(()=>{ct=true;},n=>{throw ge=void 0,e&&Lt!=="native"?c(e,n):Q(n)}),ge}function qo(){return typeof WebAssembly=="object"}function zo(){return Ae(),et()}function mr(t,e={}){return Ae(),yr(()=>e.includeMedia===false?Ze(t):Ye(t))}function ft(t){let e=fn(t);if(!e.ok)throw new Ie(e.failure);return e.content}async function Ko(t,e={}){await Ee();let n=H(e);return ft(()=>Ge(t,n))}async function Vo(t,e={}){await Ee();let n=H(e);return ft(()=>Xe(t,n))}async function $o(t,e={}){await Ee();let n=H(e);return ft(()=>Qe(JSON.stringify(t),n))}function dn(t){return Ae(),Fe(()=>$e(t))}function hr(t,e={}){return pt(t,e)}function pt(t,e,n){if(Ae(),e.clientId!==void 0&&e.clientId>=q){let c="client id must be a positive safe integer below Number.MAX_SAFE_INTEGER - 1";throw n?new L("clientId",c):new Error(c)}let o=n?[...(e.fonts??[]).map(c=>({...c,bytes:new Uint8Array(c.bytes),fallback:false})),...(e.fallbackFonts??[]).map(c=>({...c,bytes:new Uint8Array(c.bytes),fallback:true}))]:[],r=n&&e.initialUpdate!==void 0?e.initialUpdate:void 0,i=n?e.clientId:e.clientId??br(),a=Fe(()=>n?n.kind==="baseline"?T.openReplayBaseline(t,i,r):T.openPeerDeckJson(t,n.identity,r):e.initialUpdate===void 0?T.openCollaborative(t,i):T.openCollaborativeFromUpdate(e.initialUpdate,i,t)),l;try{l=Fe(()=>new K);}catch(c){try{a.free();}catch{}throw n?Je(c):c}let s=new Map,u=(c,p,h=false)=>(s.set(c,{id:c,family:p.family,bold:p.bold??false,italic:p.italic??false,bytes:p.bytes.slice(),fallback:h}),c);if(!n)try{for(let c of e.fonts??[])u(Z(l,c),c);for(let c of e.fallbackFonts??[])u(Z(l,c,!0),c,!0);}catch(c){try{l.free();}catch{}try{a.free();}catch{}throw c}let f=new Map,b=[],P=0,C=false,k=false,A=0,E=false,F=()=>{if(C)throw new Error("presentation handle is disposed")},ee=()=>{if(!(C||E||A!==0)){E=true;try{for(;!C&&b.length>0;){let c=b.shift();if(!c)break;for(let[p,h]of [...f]){if(C)return;if(f.get(p)===h)try{h(c.update.slice(),c.origin);}catch{}}}}finally{E=false,C&&(b.length=0);}}},te=()=>{if(!(!k||C))for(;;){let c=a.drainUpdateEvent();if(c.byteLength===0)return;let p=c[0];if(p!==0&&p!==1)throw new Error(`pptx wasm returned unknown update origin ${p}`);b.push({update:c.subarray(1),origin:p===0?"local":"remote"});}},S=(c,p=false)=>{F(),A+=1;try{let h,x,I=!1;try{h=c();}catch(v){x=v,I=!0;}if(p)try{te();}catch(v){I||(x=v,I=!0);}if(I)throw Q(x);return h}finally{A-=1,A===0&&ee();}},y=(c,p=false)=>S(()=>JSON.parse(c()),p),$=c=>{let p=[];for(let h of Kt(c.frame))if(!h.startsWith("pending-media:"))try{let x=S(()=>a.mediaBytes(h));de(x)&&x.byteLength<=33554432&&(x=dn(x));let I=me(x,()=>S(()=>a.metafileSvg(h)));if(!I.byteLength)continue;p.push({assetId:h,bytes:new Uint8Array(I).buffer});}catch{}return {...c,media:p}},ne=()=>{k||(S(()=>a.startUpdateObservation()),k=true);},ae=()=>{!k||f.size>0||C||(b.length=0,S(()=>a.clearUpdateObservation()),k=false);},q$1=n||e.retainSource===false?void 0:new Uint8Array(t),j=false,D={fork(){if(F(),!q$1)throw new Error("Presentation source is unavailable for fork");let c=hr(q$1,{initialUpdate:D.encodeStateAsUpdate()});return j&&c.setCollaborative(),c},setCollaborative(){j=true,S(()=>a.setCollaborative());},isCollaborative(){return j},layouts(){if(F(),!q$1)throw new Error("Presentation source is unavailable for layouts");let c=h=>h.flatMap(x=>[...x.placeholder?[{id:String(x.id),name:x.name,type:x.placeholder.placeholderType,idx:x.placeholder.index}]:[],...c(x.children??[])]),p=mr(q$1,{includeMedia:false});return p.layouts.map(h=>({id:h.partPath,name:h.name,type:h.layoutType,masterId:h.masterPartPath??p.masters.find(x=>x.layoutPartPaths.includes(h.partPath))?.partPath??null,placeholders:c(h.shapes)}))},isProposalsAvailable:Re,propose(c,p,h){return y(()=>a.proposeJson(JSON.stringify({agentId:c,note:p,edits:h})))},listProposals(){return Re()?y(()=>a.listProposalsJson()):[]},previewProposal(c){return y(()=>a.previewProposalJson(JSON.stringify({id:c})))},proposalSlideStrip(c){return !Re()||typeof a.proposalSlideStripJson!="function"?[]:y(()=>a.proposalSlideStripJson(c))},layoutProposalDiffSlideById(c,p){if(!Re()||typeof l.layoutProposalDiffSlideByIdJson!="function")throw new Error("Proposal slide previews are unavailable");return $(y(()=>l.layoutProposalDiffSlideByIdJson(a,c,p)))},layoutProposalDiffSlide(c,p){return $(y(()=>l.layoutProposalDiffSlideJson(a,c,p)))},layoutProposalSlide(c,p){return y(()=>l.layoutProposalSlideJson(a,c,p))},acceptProposal(c,p){return y(()=>a.acceptProposalJson(JSON.stringify({id:c,force:p?.force??false})),true)},rejectProposal(c){return y(()=>a.rejectProposalJson(JSON.stringify({id:c})))},get clientId(){return S(()=>a.clientId)},snapshot(){return y(()=>a.snapshotJson())},story(c){return y(()=>a.storyJson(JSON.stringify({storyId:c})))},anchorCaret(c,p){return y(()=>a.anchorCaretJson(JSON.stringify({storyId:c,index:p})))},resolveCaretAnchor(c){return y(()=>a.resolveCaretAnchorJson(JSON.stringify({storyId:c.storyId,position:c.position})))},version(){return S(()=>a.documentVersion())},readContent(c={}){let p=H(c);return y(()=>a.readContentJson(p))},readCommandContent(c={}){let p=H(c);return y(()=>a.readCommandContentJson(p))},historyStep(c){return y(()=>c==="undo"?a.undoReceiptJson():a.redoReceiptJson(),true)},findText(c){let p=H(c);return y(()=>a.findTextJson(p))},exportStructured(c={}){let p=H(c);return y(()=>a.exportStructuredJson(p))},exportMarkdown(c={}){let p=H(c);return y(()=>a.exportMarkdownJson(p))},validateEdits(c){let p=H(c);return y(()=>a.validateEditsJson(p))},applyEdits(c){let p=H(c);return y(()=>a.applyEditsJson(p),true)},searchText(c,p={}){if(!c)return [];let h=p.limit??Number.POSITIVE_INFINITY;if(!Number.isSafeInteger(h)&&h!==Number.POSITIVE_INFINITY||h<0)throw new RangeError("search limit must be a non-negative safe integer");return y(()=>a.searchTextJson(JSON.stringify({query:c,caseSensitive:p.caseSensitive??false,limit:Number.isFinite(h)?Math.min(h,4294967295):void 0})))},registerFont(c){return u(S(()=>Z(l,c)),c)},registerFallbackFont(c){return u(S(()=>Z(l,c,!0)),c,true)},replaceExportFace(c,p,h){Vt(s.values(),c,p,h),lt(a);},renderPng(c,p={}){let h,x;try{if(F(),typeof c!="object"||c===null||Object.keys(c).length!==1||!("slide"in c))throw new TypeError("target must be { slide } with a slide index or ID");let I=y(()=>a.snapshotJson()).slides,v=c.slide;if(typeof v=="string"){if(h=I.findIndex(R=>R.id===v),h<0)throw new RangeError(`no slide with ID ${JSON.stringify(v)}`)}else if(typeof v=="number"&&Number.isInteger(v)){if(v<0||v>=I.length)throw new RangeError(`slide index ${v} out of range for ${I.length} slide(s)`);h=v;}else throw new TypeError("slide must be an ID (string) or an index (number)");x=I[h].id;}catch(I){return Promise.reject(I)}return an({doc:a,renderer:l,displayList:I=>y(()=>l.exportSlideJson(a,I)),media:I=>{F();let v;try{v=S(()=>a.mediaBytes(I)),de(v)&&v.byteLength<=33554432&&(v=dn(v));}catch{return}return tn(v,()=>{try{return S(()=>a.metafileSvg(I))}catch{return}})},fonts:()=>[...s.values()]},{slide:h,id:x},p).then(I=>(F(),I),I=>{throw F(),I})},layoutSlide(c){return y(()=>l.layoutSlideJson(a,c))},layoutSlideProfiled(c){return y(()=>l.layoutSlideProfiledJson(a,c))},hitTest(c,p){return y(()=>l.hitTestJson(c,p))},mediaBytes(c){return S(()=>a.mediaBytes(c))},metafileSvg(c){return S(()=>a.metafileSvg(c))},save(c){if(!c)return S(()=>l.saveBytes(a));let p=Fe(()=>new K);try{for(let h of c.fonts)S(()=>Z(p,h));for(let h of c.fallbackFonts??[])S(()=>Z(p,h,!0));return S(()=>p.saveBytes(a))}finally{p.free();}},insertText(c,p,h,x={}){return y(()=>a.insertTextJson(JSON.stringify({storyId:c,index:p,text:h,style:x})),true)},insertTextProfiled(c,p,h,x={}){return y(()=>a.insertTextProfiledJson(JSON.stringify({storyId:c,index:p,text:h,style:x})),true)},deleteText(c,p,h){return y(()=>a.deleteTextJson(JSON.stringify({storyId:c,start:p,end:h})),true)},deleteTextProfiled(c,p,h){return y(()=>a.deleteTextProfiledJson(JSON.stringify({storyId:c,start:p,end:h})),true)},formatText(c,p,h,x){return y(()=>a.formatTextJson(JSON.stringify({storyId:c,start:p,end:h,patch:x})),true)},insertParagraphBreak(c,p){return y(()=>a.insertParagraphBreakJson(JSON.stringify({storyId:c,index:p})),true)},setParagraphAlignment(c,p,h,x){return y(()=>a.setParagraphAlignmentJson(JSON.stringify({storyId:c,start:p,end:h,alignment:x})),true)},insertTableRow(c,p,h,x,I){return y(()=>a.insertTableRowJson(JSON.stringify({slideId:c,shapeId:p,index:h,position:x,cells:I})),true)},checkTableEdit(c,p,h,x,I,v,R){let U={insertTableRow:"insertRow",deleteTableRow:"deleteRow",insertTableColumn:"insertColumn",deleteTableColumn:"deleteColumn"}[c];S(()=>a.checkTableEditJson(JSON.stringify({edit:U,slideId:p,shapeId:h,index:x,position:I,cells:v,width:R})));},deleteTableRow(c,p,h){return y(()=>a.deleteTableRowJson(JSON.stringify({slideId:c,shapeId:p,index:h})),true)},insertTableColumn(c,p,h,x,I,v){return y(()=>a.insertTableColumnJson(JSON.stringify({slideId:c,shapeId:p,index:h,position:x,cells:I,width:v})),true)},deleteTableColumn(c,p,h){return y(()=>a.deleteTableColumnJson(JSON.stringify({slideId:c,shapeId:p,index:h})),true)},insertSlide(c,p){return y(()=>a.insertSlideJson(JSON.stringify({index:c,layoutPartPath:p??null})),true)},setStoryParagraphs(c,p){return y(()=>a.setStoryParagraphsJson(JSON.stringify({storyId:c,paragraphs:p})),true)},duplicateSlide(c,p){return y(()=>a.duplicateSlideJson(JSON.stringify({slideId:c,toIndex:p})),true)},insertSlideProfiled(c,p){return y(()=>a.insertSlideProfiledJson(JSON.stringify({index:c,layoutPartPath:p??null})),true)},deleteSlide(c){return y(()=>a.deleteSlideJson(JSON.stringify({slideId:c})),true)},moveSlide(c,p){return y(()=>a.moveSlideJson(JSON.stringify({slideId:c,toIndex:p})),true)},setSlideLayout(c,p,h=[]){let x=h.map(([I,v])=>{if(!/^\d+$/u.test(v)||!Number.isSafeInteger(Number(v))||Number(v)>4294967295)throw new Error("Invalid layout placeholder ID");return [I,Number(v)]});y(()=>a.setSlideLayoutJson(JSON.stringify({slideId:c,layoutPartPath:p,mapping:x})),true);},setSlideNotes(c,p){y(()=>a.setSlideNotesJson(JSON.stringify({slideId:c,text:p})),true);},addComment(c,p){return y(()=>a.addCommentJson(JSON.stringify({slideId:c,author:p.author,initials:p.initials??"",text:p.text,created:p.created,xEmu:p.xEmu??0,yEmu:p.yEmu??0})),true)},replyToComment(c,p){return y(()=>a.replyToCommentJson(JSON.stringify({commentId:c,author:p.author,initials:p.initials??"",text:p.text,created:p.created})),true)},setCommentPosition(c,p){if(!Number.isSafeInteger(p.xEmu)||!Number.isSafeInteger(p.yEmu))throw new Error("Comment coordinates must be safe integer EMU");return y(()=>a.setCommentPositionJson(JSON.stringify({commentId:c,...p})),true)},setCommentStatus(c,p){return y(()=>a.setCommentStatusJson(JSON.stringify({commentId:c,resolved:p})),true)},removeComment(c){return y(()=>a.removeCommentJson(JSON.stringify({commentId:c})),true)},setCommentFlavor(c){return y(()=>a.setCommentFlavorJson(JSON.stringify({flavor:c})),true)},comments(){return y(()=>a.commentsJson())},addTextBox(c,p){return y(()=>a.addTextBoxJson(JSON.stringify({slideId:c,draft:p})),true)},addTextBoxProfiled(c,p){return y(()=>a.addTextBoxProfiledJson(JSON.stringify({slideId:c,draft:p})),true)},addShape(c,p){return y(()=>a.addShapeJson(JSON.stringify({slideId:c,draft:p})),true)},addPicture(c,p){return y(()=>a.addPictureJson(JSON.stringify({slideId:c,...p})),true)},setShapeFill(c,p,h){return y(()=>a.setShapeFillJson(JSON.stringify({slideId:c,shapeId:p,color:h})),true)},setShapeStroke(c,p,h){return y(()=>a.setShapeStrokeJson(JSON.stringify({slideId:c,shapeId:p,stroke:h})),true)},setShapeAdjust(c,p,h){return y(()=>a.setShapeAdjustJson(JSON.stringify({slideId:c,shapeId:p,adjustments:h})),true)},removeShape(c,p){return y(()=>a.removeShapeJson(JSON.stringify({slideId:c,shapeId:p})),true)},bringShapeToFront(c,p){return y(()=>a.bringShapeToFrontJson(JSON.stringify({slideId:c,shapeId:p})),true)},sendShapeToBack(c,p){return y(()=>a.sendShapeToBackJson(JSON.stringify({slideId:c,shapeId:p})),true)},bringShapeForward(c,p){return y(()=>a.bringShapeForwardJson(JSON.stringify({slideId:c,shapeId:p})),true)},sendShapeBackward(c,p){return y(()=>a.sendShapeBackwardJson(JSON.stringify({slideId:c,shapeId:p})),true)},moveShape(c,p,h,x){return y(()=>a.moveShapeJson(JSON.stringify({slideId:c,shapeId:p,x:h,y:x})),true)},moveShapeProfiled(c,p,h,x){return y(()=>a.moveShapeProfiledJson(JSON.stringify({slideId:c,shapeId:p,x:h,y:x})),true)},resizeShape(c,p,h,x){return y(()=>a.resizeShapeJson(JSON.stringify({slideId:c,shapeId:p,width:h,height:x})),true)},setShapeRect(c,p,h){return y(()=>a.setShapeRectJson(JSON.stringify({slideId:c,shapeId:p,rect:h})),true)},canUndo(){return S(()=>a.canUndo())},canRedo(){return S(()=>a.canRedo())},undoCaptureMode(){return S(()=>a.undoCaptureMode())},setUndoCaptureMode(c){S(()=>a.setUndoCaptureMode(c));},addUndoBoundary(){S(()=>a.addUndoBoundary());},undo(){return y(()=>a.undoJson(),true)},undoProfiled(){return y(()=>a.undoProfiledJson(),true)},redo(){return y(()=>a.redoJson(),true)},encodeStateVector(){return S(()=>a.encodeStateVector())},encodeStateAsUpdate(c){return S(()=>c===void 0?a.encodeStateAsUpdate():a.encodeDiff(c))},encodeDiff(c){return S(()=>a.encodeDiff(c))},applyUpdate(c){return y(()=>a.applyUpdateJson(c),true)},onUpdate(c){if(F(),typeof c!="function")throw new TypeError("update listener must be a function");let p=P++;f.set(p,c);try{ne();}catch(x){throw f.delete(p),x}let h=true;return ()=>{h&&(h=false,f.delete(p),ae());}},dispose(){if(C)return;C=true,o.length=0,f.clear(),b.length=0;let c;if(k){try{a.clearUpdateObservation();}catch(p){c=p;}k=false;}try{lt(a);}catch(p){c??(c=p);}try{l.free();}catch(p){c??(c=p);}try{a.free();}catch(p){c??(c=p);}if(c!==void 0)throw Q(c)}};if(Y.set(D,{doc:a,renderer:l,wasmCall:S,jsonWasmCall:y,peer:!!n}),Object.defineProperty(D,Symbol.for("@betteroffice/pptx/slide-layout-cache"),{value:{snapshot:()=>y(()=>l.snapshotWithLayoutKeysJson(a)),key:c=>S(()=>l.slideLayoutKey(a,c)),activate:(c,p)=>S(()=>l.setActiveSlide(a,c,p)),hitTest:(c,p,h)=>y(()=>l.hitTestSlideJson(a,c,p,h))}}),n){let c="deck",p="",h,x=false,I=R=>{c="failed",o.length=0;try{D.dispose();}catch{}throw Je(R)},v=R=>{if(C||c!==R)throw new L("stage",`Presentation peer requires ${R} stage`)};ln.set(D,{metadata(){return v("ready"),y(()=>a.sessionMetadataJson())},displayListJson(R){return v("ready"),S(()=>l.layoutSlideJson(a,R))},async registerFonts(){try{v("deck"),c="registering";let R=[];for(let U of o){let Me=await globalThis.crypto.subtle.digest("SHA-256",U.bytes);v("registering"),R.push({family:U.family,bold:U.bold??!1,italic:U.italic??!1,fallback:U.fallback,fingerprint:Array.from(new Uint8Array(Me),se=>se.toString(16).padStart(2,"0")).join("")});}p=JSON.stringify(R),S(()=>{for(let U of o)u(Z(l,U,U.fallback),U,U.fallback);n.kind==="peer"&&a.registerPeerFontsJson(p);}),o.length=0,c="fonts";}catch(R){return I(R)}},adopt(){try{if(v("fonts"),n.kind!=="peer")throw new L("stage","Only a peer can adopt identity");S(()=>a.adoptPeerIdentity()),c="ready";}catch(R){return I(R)}},hydration(){if(n.kind!=="baseline")throw new L("stage","Only the worker baseline can capture hydration");if(h!==void 0)return v("ready"),h;try{return v("fonts"),h=S(()=>a.peerHydrationJson(p)),c="ready",h}catch(R){return I(R)}},replay(R,U){if(v("ready"),x||E)throw new L("stage","Presentation replay cannot reenter");x=true;try{let Me=H(R);return S(()=>{let se=JSON.parse(a.replayJson(Me));return cn(se),U?.(se),se},!0)}finally{x=false;}}});for(let R of [..._r,"insertTextProfiled","deleteTextProfiled","insertSlideProfiled","addTextBoxProfiled","moveShapeProfiled","undoProfiled","applyUpdate","setUndoCaptureMode","registerFont","registerFallbackFont","historyStep","readCommandContent"])Object.defineProperty(D,R,{value:()=>{throw new L("stage","Retained presentations require ordered replay")}});}return D}function cn(t){if(!(t===null||typeof t!="object")){for(let e of Object.values(t))cn(e);Object.freeze(t);}}function Je(t){let e=Q(t);return e instanceof L?e:new L("engine",e.message)}function H(t){return JSON.stringify(t,(e,n)=>{if(typeof n=="number"&&!Number.isFinite(n))throw new RangeError("host requests must not contain NaN or infinite numbers");return n})}function Z(t,e,n=false){try{return (n?t.registerFallbackFont:t.registerFont).call(t,e.family,e.bold??!1,e.italic??!1,e.bytes)}catch(o){throw Q(o)}}function Ae(){if(!ct)throw new Error("pptx wasm is not initialized; call initWasm() first")}function br(){let t=globalThis.crypto;if(!t||typeof t.getRandomValues!="function")throw new Error("crypto.getRandomValues is required to generate a collaboration client ID");let e=new Uint32Array(2),n;do t.getRandomValues(e),n=(e[0]&2097151)*4294967296+e[1];while(n===0||n>=q);return n}function Fe(t){try{return t()}catch(e){throw Q(e)}}function fn(t){try{return JSON.parse(t())}catch(e){throw Q(e)}}function yr(t){return fn(t)}function Q(t){if(t instanceof L)return t;if(t!==null&&typeof t=="object"&&"name"in t&&t.name==="PresentationPeerError"&&"code"in t&&typeof t.code=="string"&&"message"in t&&typeof t.message=="string")return new L(t.code,t.message);if(t instanceof Error)return t;if(typeof t=="string")try{let e=JSON.parse(t);if(e.code==="proposalPictureMediaTooLarge"&&typeof e.totalBytes=="number")return new Ce(e.totalBytes,e.limitBytes);if(e.code==="staleProposal"&&Array.isArray(e.targets)&&e.targets.every(n=>typeof n=="string"))return new ve(e.targets)}catch{}return Object.assign(new Error(typeof t=="string"?t:String(t)),{cause:t})}
2
+ export{Ko as $,Ht as A,$r as B,Kt as C,Y as D,ve as E,Ce as F,Ie as G,ko as H,L as I,Jo as J,Eo as K,Ao as L,Mo as M,Uo as N,Oo as O,Do as P,Bo as Q,Lo as R,No as S,jo as T,Wo as U,Ho as V,Re as W,Ee as X,qo as Y,zo as Z,mr as _,de as a,Vo as aa,De as b,$o as ba,Be as c,dn as ca,yt as d,hr as da,mn as e,me as f,Ir as g,Tt as h,Ot as i,Tr as j,T as k,K as l,Lt as m,Er as n,Ar as o,Nt as p,Or as q,Dr as r,Br as s,no as t,Nr as u,nt as v,jt as w,qr as x,ir as y,Vr as z};
@@ -0,0 +1 @@
1
+ import {m,i as i$1}from'./chunk-COS6CTH7.js';var i=512*1024;function d(e,o){return async(t,r)=>{if(t.byteLength>=i)try{return await(await o())(t,r)}catch{}return e(t,r)}}function F(e){return m==="wasm"?d(e,()=>i$1().then(o=>o.decodeFontFaceOutsideEngine)):e}export{F as a};
@@ -0,0 +1,2 @@
1
+ import {a as a$1,b}from'./chunk-J54GRQWZ.js';import {a as a$3}from'./chunk-4WP5ZWYV.js';import {a as a$2}from'./chunk-CCVGR3MS.js';import'./chunk-O2XFH626.js';var d=Number.MAX_SAFE_INTEGER,W=2,_=48,H=300,D=1e3;function q(f=globalThis.navigator?.userAgent??""){return /(?:Chrome|Chromium|Firefox)\//.test(f)&&!/\b(?:iPhone|iPad|iPod|CriOS|FxiOS)\b/.test(f)}var a=f=>f.trim().toLowerCase(),S=(f,s)=>`${f?1:0}|${s?1:0}`;function K(f=H){let s=new Map,u=new Map,h=new Map,c=false,b$1=-1/0,g,F=()=>globalThis.performance?.now()??Date.now(),P=async()=>{for(;!c&&F()-b$1<f;)await new Promise(e=>setTimeout(e,f));},M=e=>{let t=a$3(new Uint8Array(e));return t?{weight:String(t.weight),style:t.italic?"italic":t.oblique?"oblique":"normal"}:{}};async function A(e,t,n,r){let o=globalThis.fonts;if(!o)return e.family;let i=t===d?`${e.family} whole`:`${e.family} r${t}`,l=await new FontFace(i,n,M(n)).load();if(c||!s.has(a(e.family)))return e.family;let y=m(e);if(y&&y.revision>=t)return y.family;for(o.add(l),e.installed.push({revision:t,family:i,face:l,chunks:r});e.installed.length>W;)o.delete(e.installed.shift().face);return i}let x=e=>e.wholeLoad??(e.wholeLoad=(e.whole.slices?.loadWholeForExport?.()??e.whole()).then(t=>(e.wholeBytes=t,t),t=>{throw e.wholeLoad=void 0,t})),w=e=>x(e).catch(t=>{throw a$1(t)&&b(t),t}),m=e=>e.installed[e.installed.length-1];function B(e){let t=m(e);if(t?.revision===d)return Promise.resolve(t.family);let n=e.face.revision;if(t?.revision===n)return Promise.resolve(t.family);if(e.installing?.revision===n)return e.installing.done;let r=new Set(e.face.loadedChunks()),o={revision:n,done:A(e,n,e.face.bytes(),r)};return e.installing=o,o.done.catch(()=>{}).finally(()=>{e.installing===o&&(e.installing=void 0);}),o.done}async function N(e,t){try{await e.face.ensureText(t);}catch(n){if(a$1(n))return m(e)?.family??e.family;let r;try{r=await w(e);}catch{return e.family}let o=m(e);if(o?.revision===d)return o.family;try{return await A(e,d,r,null)}catch{return e.family}}return B(e)}let U={async prepare(e,t){let n=s.get(a(e));if(!n||c)return e;b$1=F();let r=m(n);if(r&&(r.chunks===null||n.face.chunksOf(t).every(i=>r.chunks.has(i))))return r.family;let o=await N(n,t);return o===n.family?e:o},latest(e){let t=s.get(a(e));return t&&m(t)?.family},covers:(e,t,n)=>!h.get(a(e))?.has(S(t,n))};async function T(e){let t=[...new Set(`${e}${e.normalize("NFC")}`)];for(let n of [...s.values()]){let r=n.face.loadedChunks(),o=t.filter(i=>n.face.chunksOf(i).some(l=>!r.has(l)));for(let i=0;i<o.length;i+=_){if(await P(),c||n.wholeBytes)return;let l=o.slice(i,i+_);await n.face.ensureText(l.join(""));}if(await P(),c||n.wholeBytes)return;await B(n);}}function k(e){return (s.get(a(e))??u.get(a(e))?.entry)?.wholeBytes}function L(e){return Promise.all(e.flatMap(t=>{let n=s.get(a(t))??u.get(a(t))?.entry;return n?[x(n).then(r=>({family:n.family,bytes:r.slice(0)}),r=>{let o=r instanceof Error?r.message:String(r);throw new a$2("font-unavailable",`${n.family} could not load: ${o}`)})]:[]}))}function v(e,t){return u.get(a(e))?.hostFaces.includes(t.id)===true||h.get(a(e))?.has(S(t.bold===true,t.italic===true))===true}let E=()=>[...s.values()].map(e=>e.family),C=()=>[...s.values(),...[...u.values()].map(({entry:e})=>e)].map(e=>e.family),$=()=>[...s.keys()].flatMap(e=>[...h.get(e)??[]].map(t=>`${e}|${t}`));return {coverage:U,fill:T,loadedWhole:k,wholeFaces:L,keepsExportFace:v,families:E,exportFamilies:C,plainStyles:$,supported:()=>q(),ack:()=>({slicedFamilies:E(),slicedPlainStyles:$()}),scheduleFill(e){g!==void 0||c||!s.size||(g=setTimeout(()=>{if(g=void 0,!c)try{let t=e();t!==void 0&&T(t).catch(()=>{});}catch{}},D));},upgradeRegistered(e,t){let n=k(t);n&&e.replaceExportFace(t,new Uint8Array(n),r=>v(t,r));},async completeExport(e){let t=new Set,n=[];for(;;){let r=C().filter(o=>!t.has(o));if(!r.length)return n;for(let{family:o,bytes:i}of await L(r)){let l=new Uint8Array(i);e.replaceExportFace(o,l,y=>v(o,y)),s.has(a(o))&&n.push({family:o,bold:false,italic:false,bytes:l});}for(let o of r)t.add(o);}},async wholeFonts(e){let t=new Set(Array.isArray(e)?e:[]);return (await Promise.all(E().filter(r=>!t.has(r)).map(async r=>{let o=s.get(a(r)),i=await(o?w(o).then(l=>l.slice(0)):void 0)?.catch(()=>{});return i?{family:r,bold:false,italic:false,bytes:i,kind:"coverage"}:void 0}))).filter(r=>r!==void 0)},add(e,t,n){!c&&!s.has(a(e))&&s.set(a(e),{family:e,face:t,whole:n,installed:[]});},has:e=>s.has(a(e)),prefetch(e){for(let t of s.values())t.face.prefetch(e);},read(e,t,n){let r=s.get(a(e));return !r||c?Promise.resolve(void 0):(b$1=F(),(async()=>{if(!r.wholeBytes)try{let i=await r.face.ensureText(t);return i===n?{revision:i}:{revision:i,bytes:r.face.bytes()}}catch(i){if(a$1(i))return}let o=await w(r).catch(i=>{if(!a$1(i))throw i});if(o)return n===d?{revision:d}:{revision:d,bytes:o.slice(0)}})())},whole(e){let t=s.get(a(e));return t&&w(t).then(n=>n.slice(0))},plain(e,t,n){let r=h.get(a(e))??new Set;r.add(S(t,n)),h.set(a(e),r);},forget(e,t){let n=a(e),r=u.get(n);if(r){r.hostFaces.push(t);return}let o=s.get(n);if(!o)return;s.delete(n),u.set(n,{entry:o,hostFaces:[t]});let i=globalThis.fonts;for(let{face:l}of o.installed)i?.delete(l);},dispose(){c=true,g!==void 0&&clearTimeout(g);let e=globalThis.fonts;for(let t of s.values())for(let{face:n}of t.installed)e?.delete(n);s.clear(),u.clear(),h.clear();}}}
2
+ export{K as createSlicedFontFaces,q as slicedFacesSupported};
@@ -0,0 +1 @@
1
+ function l(e){let r=[];for(let n of e)n.op==="event"&&n.event.type==="message"&&r.push(n.event.data);return r}function d(e){return e.buffer instanceof ArrayBuffer&&e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.slice().buffer}var i=new Set(["backpressure","protocol","replica","transport"]);var p=e=>Number.isSafeInteger(e)&&e>=0;function c(e){let r=e;return typeof r=="object"&&r!==null&&i.has(r.code)&&typeof r.message=="string"}function f(e,r){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<=r;case "close":return n.reason===void 0||typeof n.reason=="string";default:return false}}function b(e,r,n){if(typeof e!="object"||e===null)return false;let{provider:u,ops:t}=e;return !Number.isSafeInteger(u)||u<0||!Array.isArray(t)||t.length===0?false:t.every(s=>{if(typeof s!="object"||s===null)return false;let o=s;if(!p(o.seq))return false;switch(o.op){case "create":return typeof o.options=="object"&&o.options!==null&&Object.keys(o.options).every(a=>n.optionKeys.has(a));case "connect":case "disconnect":case "destroy":return true;case "fail":return c(o.error);case "cursor":return typeof o.broadcast=="boolean"&&(o.cursor===null||n.validCursor(o.cursor,r));case "event":return f(o.event,r);default:return false}})}function m(){let e=globalThis.performance;return typeof e?.now!="function"?0:typeof e.timeOrigin=="number"?e.timeOrigin:Date.now()-e.now()}export{l as a,d as b,b as c,m as d};
@@ -0,0 +1 @@
1
+ import {a as a$1,b as b$1}from'./chunk-J54GRQWZ.js';import {a}from'./chunk-G54T5CXF.js';import {b}from'./chunk-T6VUFMNC.js';import {H,i,j}from'./chunk-COS6CTH7.js';import'./chunk-CCVGR3MS.js';import'./chunk-S6UYP4BX.js';import'./chunk-65A2TX24.js';import'./chunk-O2XFH626.js';function se(a,g){let n=new DataView(a);if(n.byteLength<12)return false;let w=n.getUint16(4);if(12+w*16>n.byteLength)return false;for(let d=12;d<12+w*16;d+=16){if(n.getUint32(d)!==1851878757)continue;let o=n.getUint32(d+8),m=n.getUint32(d+12);if(m<6||o+m>n.byteLength)return false;let L=n.getUint16(o+2),B=o+n.getUint16(o+4);if(6+L*12>m)return false;for(let y=o+6;y<o+6+L*12;y+=12){let v=n.getUint16(y+6);if(v!==1&&v!==16)continue;let k=n.getUint16(y),c=n.getUint16(y+8),f=B+n.getUint16(y+10);if(f<o||f+c>o+m)continue;let T="";if(k===0||k===3){if(c%2)continue;for(let p=f;p<f+c;p+=2)T+=String.fromCharCode(n.getUint16(p));}else if(k===1)for(let p=f;p<f+c;p++)T+=String.fromCharCode(n.getUint8(p));if(T.trim().toLowerCase()===g.trim().toLowerCase())return true}}return false}async function Y(a,g,n,w){let{resolveScriptFallbackFace:d}=await i(),o=d(a,g,n)??d(a,false,false);if(!(!o||o.script!==a||!se(w,o.family)))return {family:o.family,bold:o.weight===700,italic:o.style==="italic",bytes:w,kind:"coverage"}}var ae=3,le=[2e3,8e3],ne=Promise.resolve(),de=a(async(a,g)=>(await ne.catch(()=>{}),H(a,g))),ce={async load(...a){return a.length&&b(a[0]),(await i()).createFontProvider(void 0,{decoder:de,strict:"except-optional-cdn-failure"})}};function be(a,g,n,w=false){ne=g,a.length&&n().then(async d=>{for(let o of a){let m=d.resolveScriptFallback(o,false,false);if(m?.slices&&w&&(await import('./chunk-GAM2OAAP.js')).slicedFacesSupported()){let{openSlicedFace:L}=await j();L(m.slices).catch(()=>{});}else m?.().catch(()=>{});}}).catch(()=>{});}function we(a,g,n,w,d,o,m,L){let B=new Set(a.map(e=>e.family.trim().toLowerCase())),y=new Set,v=new Map,k=new Map,c=new Map,f=new Map,T=new Set,p,u=false,K=false,E=new Set,x=e=>JSON.stringify([e.kind,e.kind==="coverage"?e.script:e.family.trim().toLowerCase(),e.bold,e.italic]),P=e=>e.kind==="primary"&&B.has(e.family.trim().toLowerCase()),X=e=>!y.has(e)||(v.get(e)??0)<ae&&Date.now()>=(k.get(e)??1/0),I=e=>k.set(e,Date.now()+(le[(v.get(e)??1)-1]??1/0));function j$1(e,t){if(u)return [];let i=[];for(let[S,r]of t.entries()){if(!r||P(e[S]))continue;let R=JSON.stringify([r.kind??"primary",r.family.trim().toLowerCase(),r.bold,r.italic]);if(!T.has(R))try{K||(o?.(),K=!0),n(r),T.add(R),i.push({family:r.family,bold:r.bold,italic:r.italic,...r.kind?{kind:r.kind}:{},...r.ownWeight?{ownWeight:!0}:{}});}catch{I(x(e[S]));}}return i.length&&w(i),i}function ie(e){let t=x(e),i=c.get(t);if(i)return i;if(!X(t)||P(e))return Promise.resolve(void 0);let S=v.get(t),r=k.get(t);y.add(t),v.set(t,(S??0)+1),k.delete(t);let R=new Promise(oe=>{let N=false,J=s=>{N||(N=true,clearTimeout(re),E.delete(W),oe(s));},W=()=>J(),re=setTimeout(W,5e3);E.add(W);let H=false;p??(p=Promise.resolve().then(()=>m?m():ce.load()).catch(s=>{throw p=void 0,s})),p.then(async s=>{if(u)return;let h=e.bold,b=e.italic,D,z;if(e.kind==="coverage")D=s.resolveScriptFallback(e.script,h,b),!D&&(h||b)&&(h=false,b=false,D=s.resolveScriptFallback(e.script,h,b));else {let l=s.resolve(e.family,h,b)??s.resolveFamily(e.family,h,b);z=l?void 0:s.resolveLightVariant?.(e.family,h,b),D=l??z??s.resolveLastResort(e.family,h,b,"powerpoint");}if(!D)return;if(H=true,D.slices&&L?.supported())try{let{openSlicedFace:l}=await j(),F=await l(D.slices);if(u||P(e))return;let q=e.kind==="coverage"?await Y(e.script,h,b,F.bytes()):{family:e.family,bold:e.bold,italic:e.italic,bytes:F.bytes()};if(q&&!B.has(q.family.trim().toLowerCase()))return L.add(q.family,{get revision(){return F.revision},bytes:()=>F.bytes(),ensureText:A=>F.ensureText(A),prefetch:A=>F.prefetch(A),chunksOf:A=>F.chunksOf(A),loadedChunks:()=>F.loadedChunks()},D),u?void 0:q}catch(l){if(a$1(l)&&l.diagnostic.pack==="latin")throw l}let Q=await D().catch(l=>{throw a$1(l)&&b$1(l),l});if(u||P(e))return;let C=e.kind==="coverage"?await Y(e.script,h,b,Q):{family:e.family,bold:e.bold,italic:e.italic,bytes:Q,...z?{ownWeight:true}:{}};if(!C||u||P(e))return;L?.plain(C.family,C.bold,C.italic);let M=JSON.stringify([C.family.trim().toLowerCase(),C.bold,C.italic]),U=f.get(M);if(!U){U=Promise.resolve().then(async()=>!u&&(!d||(await d([C])).length>0)),f.set(M,U);let l=U,F=()=>{f.get(M)===l&&f.delete(M);};U.then(q=>{q||F();},F);}return await U&&!u?C:void 0}).then(s=>{c.delete(t),!s&&H&&!u&&!P(e)&&I(t),N&&s?j$1([e],[s]):J(s);},s=>{c.delete(t),a$1(s)?S===void 0?(y.delete(t),v.delete(t)):(v.set(t,S),r!==void 0&&k.set(t,r)):!u&&!P(e)&&I(t),J();});});return c.set(t,R),R}function G(e){if(u)return [];try{let t=new Map;for(let i of g(e)){let S={kind:"primary",family:i.family,bold:i.bold,italic:i.italic};t.set(x(S),S);for(let r of i.scripts??[]){let R={kind:"coverage",script:r,bold:i.bold,italic:i.italic};t.set(x(R),R);}}return [...t.values()].filter(i=>!P(i)&&(X(x(i))||c.has(x(i))))}catch{return []}}return {isLoading(){return c.size>0},hasPending(e){return G(e).length>0},load(e){let t=G(e);return t.length?Promise.all(t.map(ie)).then(i=>j$1(t,i)):[]},supply(e){B.add(e.trim().toLowerCase());},dispose(){u=true;for(let e of E)e();c.clear(),f.clear();}}}export{ce as commandFontProvider,we as createCommandDefaultFonts,be as prefetchCoverageFaces};
@@ -0,0 +1 @@
1
+ import {a as a$1,d as d$2}from'./chunk-GHET7GIK.js';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}from'./chunk-65A2TX24.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,a$1(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-d$2();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};
@@ -0,0 +1 @@
1
+ function t(n){return n instanceof Error&&n.diagnostic?.reason==="cdn-unavailable"}function i({diagnostic:n}){typeof globalThis.dispatchEvent=="function"&&typeof CustomEvent=="function"&&globalThis.dispatchEvent(new CustomEvent("betteroffice:font-pack-diagnostic",{detail:{...n}}));}export{t as a,i as b};
@@ -0,0 +1,2 @@
1
+ import'./chunk-O2XFH626.js';async function d(c,r){let o=new Map,s=(t,e,n)=>r.covers?.(t,e===true,n===true)??true,a=t=>{for(let e of t)if(e.kind==="textBox")for(let n of e.lines)for(let i of n.runs){if(!s(i.fontFamily,i.bold,i.italic))continue;let l=o.get(i.fontFamily)??[];l.push(i.text),o.set(i.fontFamily,l);}else (e.kind==="chart"||e.kind==="table")&&a(e.primitives);};a(c.primitives);let p=new Map;return await Promise.all([...o].map(async([t,e])=>{p.set(t,await r.prepare(t,e.join(`
2
+ `)));})),(t,e,n)=>{if(!s(t,e,n))return t;let i=p.get(t);if(i===void 0)throw new Error(`Text in ${t} was painted without preparing its font`);return i===t?t:r.latest?.(t)??i}}export{d as prepareTextFamilies};
@@ -0,0 +1 @@
1
+ import {x as x$1,I,y,v as v$1}from'./chunk-COS6CTH7.js';import {a}from'./chunk-O2XFH626.js';var d=class extends Error{constructor(r,i,s){super(i);a(this,"code",r);a(this,"cause",s);a(this,"refusal");this.name="PptxPeerHydrationError",this.refusal={code:r};}},S=class extends Error{constructor(){super("Presentation editor is not ready");a(this,"code","peer-not-ready");this.name="PptxPeerNotReadyError";}},E=class extends Error{constructor(r){super(`Presentation worker editor failed: ${r instanceof Error?r.message:String(r)}`);a(this,"cause",r);a(this,"code","editor-failed");this.name="PptxWorkerEditorFailedError";}},b=class extends Error{constructor(){super("Presentation worker editor is disposed");a(this,"code","editor-disposed");this.name="PptxWorkerEditorDisposedError";}},x=class extends Error{constructor(){super("Collaboration is unavailable in the presentation worker editor");a(this,"code","collaboration-unavailable");this.name="PptxWorkerEditorCollaborationError";}};var F=async e=>(await import('@betteroffice/fonts').catch(()=>{}))?.fontAssetUrls?.(e);function A(){return y()}var f=Symbol.for("betteroffice.fontPackSource"),c=Symbol.for("betteroffice.fontPackSource.detach");function R(e,t=F){let r=e;if(r[f])return r[c];if(typeof e.addEventListener!="function")return;let i=x$1(o=>e.postMessage(o),t,A),s=o=>{i.receive(o.data)&&o.stopImmediatePropagation();},n=()=>{r[c]===n&&(e.removeEventListener?.("message",s),delete r[c],delete r[f]);};return e.addEventListener("message",s),r[c]=n,r[f]=true,n}function h(e,t){let r=new Set,i=false;function s(n,o){if(i)return ()=>{};e.addEventListener(n,o);let p=()=>{e.removeEventListener(n,o),r.delete(p);};return r.add(p),e.start?.(),p}return {post(n,o=[]){if(i)throw new v$1("disposed","Session transport is closed");e.postMessage(n,o);},listen(n){return s("message",o=>n(o.data))},onError(n){let o=s("error",O=>n(new v$1("crash",O.message||"Session worker crashed"))),p=s("messageerror",()=>n(new v$1("message","Session transport received an unreadable message")));return ()=>{o(),p();}},close(){if(!i){i=true;for(let n of [...r])n();t();}}}}function D(e){let t=R(e);return h(e,()=>{t?.(),e.terminate();})}function N(e){return h(e,()=>e.close?.())}var T=Symbol("session-transfer"),v=Symbol("session-deferred");function H(e){return {[v]:true,promise:e}}function _(e){return u(e)&&e[v]===true}function z(e,t){return {[T]:true,value:e,transfer:t}}function K(e){return u(e)&&e[T]===true}function k(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function u(e){return e!==null&&typeof e=="object"}function m(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}function U(e){if(!u(e)||e.protocol!==1)return false;if(e.kind==="wasm-compile"){if(e.pending!==void 0&&e.pending!==true||e.bytes!==void 0&&!(e.bytes instanceof ArrayBuffer))return false;if(e.stream===void 0)return true;try{return Object.prototype.toString.call(e.stream)==="[object ReadableStream]"}catch{return false}}return e.kind==="dispose"||e.kind==="call"&&m(e.id)&&typeof e.method=="string"&&Array.isArray(e.args)}function V(e){if(!u(e)||e.protocol!==1)return false;switch(e.kind){case "wasm-accept":return true;case "wasm-module":try{return typeof e.url=="string"&&(e.hydration===void 0||typeof e.hydration=="string")&&Object.prototype.toString.call(e.module)==="[object WebAssembly.Module]"}catch{return false}case "reply":return m(e.id)&&(e.ok===true&&k(e,"value")||e.ok===false&&u(e.error)&&typeof e.error.name=="string"&&typeof e.error.message=="string");case "event":return typeof e.name=="string"&&k(e,"payload");case "progress":return m(e.id);case "failure":return ["crash","trap","out-of-memory","message","silence","disposed"].includes(e.code)&&typeof e.message=="string"&&(e.diagnostics===void 0||typeof e.diagnostics=="string");default:return false}}var $=new WeakMap,G={beginEditor:true,attachPeer:true,replay:true,flush:true,editorFrame:true,editorSave:true},J={beginEditor:{lane:"interactive"},attachPeer:{lane:"interactive"},replay:{lane:"input",mutates:true,userInput:true},flush:{lane:"interactive"},editorFrame:{lane:"interactive",reframes:true},editorSave:{lane:"interactive"}},Q={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 w(e,t){if(Object.is(e,t))return true;if(!e||!t||typeof e!="object"||typeof t!="object"||Array.isArray(e)!==Array.isArray(t))return false;let r=Object.keys(e),i=Object.keys(t);return r.length===i.length&&r.every(s=>Object.prototype.hasOwnProperty.call(t,s)&&w(e[s],t[s]))}function X(e,t){return t.consumed===true&&e.sequence===t.sequence&&e.revision===t.revision&&e.version===t.version&&e.engineVersion===t.engineVersion&&w(e.outcome,t.outcome)}var ee={open:true,version:true,readContent:true,findText:true,validateEdits:true,applyEdits:true,frame:true,slides:true,slideSize:true,save:true,renderPng:true,dispose:true},te={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"},renderPng:{lane:"interactive",reorderable:false},dispose:{lane:"interactive"}};function se(e){if(e instanceof d)return e;if(e instanceof I)return new d(e.code,e.message,e);if(e instanceof Error&&"refusal"in e){let t=e.refusal;if(t!==null&&typeof t=="object"&&"code"in t&&typeof t.code=="string")return new d(t.code,e.message,e)}return e}export{d as a,S as b,E as c,b as d,x as e,H as f,_ as g,z as h,K as i,k as j,U as k,V as l,R as m,D as n,N as o,$ as p,G as q,J as r,Q as s,X as t,ee as u,te as v,se as w};
@@ -0,0 +1 @@
1
+ function e(r){return new Error(`Worker sessions need a Web Worker (browsers, Bun, Deno), which this runtime lacks; use ${r} in-thread or pass the worker option`)}function o(r){if(typeof Worker!="function")throw e(r)}export{e as a,o as b};