@silurus/ooxml-legacy-office 0.0.0-stage → 0.89.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +24 -2
- package/THIRD_PARTY_NOTICES.md +271 -0
- package/dist/doc.mjs +15 -0
- package/dist/legacy-doc-source-module.mjs +1 -0
- package/dist/legacy-ppt-source-module.mjs +1 -0
- package/dist/legacy-source-CKrK91co.js +197 -0
- package/dist/legacy-xls-source-module.mjs +1 -0
- package/dist/legacy_doc_direct_bg.wasm +0 -0
- package/dist/legacy_ppt_direct_bg.wasm +0 -0
- package/dist/legacy_xls_direct_bg.wasm +0 -0
- package/dist/ppt.mjs +14 -0
- package/dist/types/doc.d.ts +33 -0
- package/dist/types/ppt.d.ts +33 -0
- package/dist/types/xls.d.ts +33 -0
- package/dist/xls.mjs +14 -0
- package/package.json +71 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yuki Yokotani
|
|
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.
|
package/README.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @silurus/ooxml-legacy-office
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Experimental DOC, XLS and PPT model sources for `@silurus/ooxml`. Both packages
|
|
4
|
+
must have the same version.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
npm i @silurus/ooxml @silurus/ooxml-legacy-office
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { DocxViewer } from '@silurus/ooxml/docx';
|
|
12
|
+
import { legacyDoc } from '@silurus/ooxml-legacy-office/doc';
|
|
13
|
+
|
|
14
|
+
const canvas = document.getElementById('viewer') as HTMLCanvasElement;
|
|
15
|
+
const viewer = new DocxViewer(canvas, { legacyDoc });
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Use `/xls` (`legacyXls`) and `/ppt` (`legacyPpt`) with the corresponding
|
|
19
|
+
viewers or Node sessions, passed as `{ legacyXls }` and `{ legacyPpt }`.
|
|
20
|
+
Importing a reader loads nothing: its source module and WASM load only when a
|
|
21
|
+
matching file is opened. When an asset pipeline relocates the bundled files,
|
|
22
|
+
create the reader with `createLegacyDoc({ wasmUrl, moduleUrl })` (likewise
|
|
23
|
+
`createLegacyXls` and `createLegacyPpt`) and pass it as the same option.
|
|
24
|
+
The package ships three external WASM assets and self-contained source modules.
|
|
25
|
+
See the [usage and support guide](https://github.com/yukiyokotani/office-open-xml-viewer/blob/main/docs/legacy-office-conversion.md).
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
# Third-Party Notices
|
|
2
|
+
|
|
3
|
+
`@silurus/ooxml-legacy-office` is MIT-licensed (see [LICENSE](./LICENSE)).
|
|
4
|
+
Its JavaScript helpers are from this repository. Its three WASM binaries are
|
|
5
|
+
built from `legacy-office-parser`, the shared model/common crates, and
|
|
6
|
+
(for PPT alternative shape XML) the parser library without its WASM entries.
|
|
7
|
+
The viewer, renderers, fonts and optional rendering engines are supplied by the
|
|
8
|
+
separate `@silurus/ooxml` peer and are not bundled in this package.
|
|
9
|
+
|
|
10
|
+
## Rust / WebAssembly
|
|
11
|
+
|
|
12
|
+
The normal dependency graph for all three direct-reader features on
|
|
13
|
+
`wasm32-unknown-unknown` uses the following third-party crates. The table includes
|
|
14
|
+
procedural macros used during compilation; no development dependencies ship.
|
|
15
|
+
|
|
16
|
+
| License | Crates |
|
|
17
|
+
|---|---|
|
|
18
|
+
| MIT OR Apache-2.0 | bumpalo, cfg-if, console_error_panic_hook, crc32fast, displaydoc, equivalent, flate2, hashbrown, indexmap, itoa, js-sys, log, once_cell, proc-macro2, quote, roxmltree, rustversion, serde, serde_core, serde_derive, serde_json, syn, thiserror, thiserror-impl, wasm-bindgen, wasm-bindgen-macro, wasm-bindgen-macro-support, wasm-bindgen-shared |
|
|
19
|
+
| (Apache-2.0 OR MIT) AND Unicode-3.0 | unicode-ident |
|
|
20
|
+
| 0BSD OR Apache-2.0 OR MIT | adler2 |
|
|
21
|
+
| Apache-2.0 | zopfli |
|
|
22
|
+
| Apache-2.0 OR MIT OR Zlib | miniz_oxide |
|
|
23
|
+
| MIT | quick-xml, simd-adler32, zip, zmij |
|
|
24
|
+
| MIT OR Unlicense | memchr |
|
|
25
|
+
|
|
26
|
+
Dependency names and license expressions can be checked from the locked sources:
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
cargo tree -p legacy-office-parser --features direct-doc,direct-xls,direct-ppt \
|
|
30
|
+
--target wasm32-unknown-unknown --edges normal --prefix none --format '{p} {l}'
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The `unicode-ident` dependency includes Unicode data under Unicode License v3.
|
|
34
|
+
Full crate license texts and copyright notices are available in each crate's
|
|
35
|
+
source distribution on crates.io. The Apache and Unicode texts follow.
|
|
36
|
+
|
|
37
|
+
## License texts
|
|
38
|
+
|
|
39
|
+
- **MIT** — see [LICENSE](./LICENSE) (this repository's own license; the
|
|
40
|
+
MIT-licensed dependencies above use the same standard text with their own
|
|
41
|
+
copyright holder).
|
|
42
|
+
- **Unicode License v3** — canonical text at
|
|
43
|
+
<https://www.unicode.org/license.txt>, reproduced below.
|
|
44
|
+
- **Apache License, Version 2.0** — full text at
|
|
45
|
+
<https://www.apache.org/licenses/LICENSE-2.0>, reproduced below for
|
|
46
|
+
convenience.
|
|
47
|
+
|
|
48
|
+
### Unicode License v3 (full text)
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
UNICODE LICENSE V3
|
|
52
|
+
|
|
53
|
+
COPYRIGHT AND PERMISSION NOTICE
|
|
54
|
+
|
|
55
|
+
Copyright © 1991-2026 Unicode, Inc.
|
|
56
|
+
|
|
57
|
+
NOTICE TO USER: Carefully read the following legal agreement. BY
|
|
58
|
+
DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR
|
|
59
|
+
SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
|
|
60
|
+
TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT
|
|
61
|
+
DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.
|
|
62
|
+
|
|
63
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
64
|
+
copy of data files and any associated documentation (the "Data Files") or
|
|
65
|
+
software and any associated documentation (the "Software") to deal in the
|
|
66
|
+
Data Files or Software without restriction, including without limitation
|
|
67
|
+
the rights to use, copy, modify, merge, publish, distribute, and/or sell
|
|
68
|
+
copies of the Data Files or Software, and to permit persons to whom the
|
|
69
|
+
Data Files or Software are furnished to do so, provided that either (a)
|
|
70
|
+
this copyright and permission notice appear with all copies of the Data
|
|
71
|
+
Files or Software, or (b) this copyright and permission notice appear in
|
|
72
|
+
associated Documentation.
|
|
73
|
+
|
|
74
|
+
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
|
75
|
+
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
76
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
77
|
+
THIRD PARTY RIGHTS.
|
|
78
|
+
|
|
79
|
+
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE
|
|
80
|
+
BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES,
|
|
81
|
+
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
82
|
+
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
|
83
|
+
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA
|
|
84
|
+
FILES OR SOFTWARE.
|
|
85
|
+
|
|
86
|
+
Except as contained in this notice, the name of a copyright holder shall
|
|
87
|
+
not be used in advertising or otherwise to promote the sale, use or other
|
|
88
|
+
dealings in these Data Files or Software without prior written
|
|
89
|
+
authorization of the copyright holder.
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Apache License 2.0 (full text)
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
Apache License
|
|
96
|
+
Version 2.0, January 2004
|
|
97
|
+
http://www.apache.org/licenses/
|
|
98
|
+
|
|
99
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
100
|
+
|
|
101
|
+
1. Definitions.
|
|
102
|
+
|
|
103
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
104
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
105
|
+
|
|
106
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
107
|
+
the copyright owner that is granting the License.
|
|
108
|
+
|
|
109
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
110
|
+
other entities that control, are controlled by, or are under common
|
|
111
|
+
control with that entity. For the purposes of this definition,
|
|
112
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
113
|
+
direction or management of such entity, whether by contract or
|
|
114
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
115
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
116
|
+
|
|
117
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
118
|
+
exercising permissions granted by this License.
|
|
119
|
+
|
|
120
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
121
|
+
including but not limited to software source code, documentation
|
|
122
|
+
source, and configuration files.
|
|
123
|
+
|
|
124
|
+
"Object" form shall mean any form resulting from mechanical
|
|
125
|
+
transformation or translation of a Source form, including but
|
|
126
|
+
not limited to compiled object code, generated documentation,
|
|
127
|
+
and conversions to other media types.
|
|
128
|
+
|
|
129
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
130
|
+
Object form, made available under the License, as indicated by a
|
|
131
|
+
copyright notice that is included in or attached to the work
|
|
132
|
+
(an example is provided in the Appendix below).
|
|
133
|
+
|
|
134
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
135
|
+
form, that is based on (or derived from) the Work and for which the
|
|
136
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
137
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
138
|
+
of this License, Derivative Works shall not include works that remain
|
|
139
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
140
|
+
the Work and Derivative Works thereof.
|
|
141
|
+
|
|
142
|
+
"Contribution" shall mean any work of authorship, including
|
|
143
|
+
the original version of the Work and any modifications or additions
|
|
144
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
145
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
146
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
147
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
148
|
+
means any form of electronic, verbal, or written communication sent
|
|
149
|
+
to the Licensor or its representatives, including but not limited to
|
|
150
|
+
communication on electronic mailing lists, source code control systems,
|
|
151
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
152
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
153
|
+
excluding communication that is conspicuously marked or otherwise
|
|
154
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
155
|
+
|
|
156
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
157
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
158
|
+
subsequently incorporated within the Work.
|
|
159
|
+
|
|
160
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
161
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
162
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
163
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
164
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
165
|
+
Work and such Derivative Works in Source or Object form.
|
|
166
|
+
|
|
167
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
168
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
169
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
170
|
+
(except as stated in this section) patent license to make, have made,
|
|
171
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
172
|
+
where such license applies only to those patent claims licensable
|
|
173
|
+
by such Contributor that are necessarily infringed by their
|
|
174
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
175
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
176
|
+
institute patent litigation against any entity (including a
|
|
177
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
178
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
179
|
+
or contributory patent infringement, then any patent licenses
|
|
180
|
+
granted to You under this License for that Work shall terminate
|
|
181
|
+
as of the date such litigation is filed.
|
|
182
|
+
|
|
183
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
184
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
185
|
+
modifications, and in Source or Object form, provided that You
|
|
186
|
+
meet the following conditions:
|
|
187
|
+
|
|
188
|
+
(a) You must give any other recipients of the Work or
|
|
189
|
+
Derivative Works a copy of this License; and
|
|
190
|
+
|
|
191
|
+
(b) You must cause any modified files to carry prominent notices
|
|
192
|
+
stating that You changed the files; and
|
|
193
|
+
|
|
194
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
195
|
+
that You distribute, all copyright, patent, trademark, and
|
|
196
|
+
attribution notices from the Source form of the Work,
|
|
197
|
+
excluding those notices that do not pertain to any part of
|
|
198
|
+
the Derivative Works; and
|
|
199
|
+
|
|
200
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
201
|
+
distribution, then any Derivative Works that You distribute must
|
|
202
|
+
include a readable copy of the attribution notices contained
|
|
203
|
+
within such NOTICE file, excluding those notices that do not
|
|
204
|
+
pertain to any part of the Derivative Works, in at least one
|
|
205
|
+
of the following places: within a NOTICE text file distributed
|
|
206
|
+
as part of the Derivative Works; within the Source form or
|
|
207
|
+
documentation, if provided along with the Derivative Works; or,
|
|
208
|
+
within a display generated by the Derivative Works, if and
|
|
209
|
+
wherever such third-party notices normally appear. The contents
|
|
210
|
+
of the NOTICE file are for informational purposes only and
|
|
211
|
+
do not modify the License. You may add Your own attribution
|
|
212
|
+
notices within Derivative Works that You distribute, alongside
|
|
213
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
214
|
+
that such additional attribution notices cannot be construed
|
|
215
|
+
as modifying the License.
|
|
216
|
+
|
|
217
|
+
You may add Your own copyright statement to Your modifications and
|
|
218
|
+
may provide additional or different license terms and conditions
|
|
219
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
220
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
221
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
222
|
+
the conditions stated in this License.
|
|
223
|
+
|
|
224
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
225
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
226
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
227
|
+
this License, without any additional terms or conditions.
|
|
228
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
229
|
+
the terms of any separate license agreement you may have executed
|
|
230
|
+
with Licensor regarding such Contributions.
|
|
231
|
+
|
|
232
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
233
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
234
|
+
except as required for reasonable and customary use in describing the
|
|
235
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
236
|
+
|
|
237
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
238
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
239
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
240
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
241
|
+
implied, including, without limitation, any warranties or conditions
|
|
242
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
243
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
244
|
+
appropriateness of using or redistributing the Work and assume any
|
|
245
|
+
risks associated with Your exercise of permissions under this License.
|
|
246
|
+
|
|
247
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
248
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
249
|
+
unless required by applicable law (such as deliberate and grossly
|
|
250
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
251
|
+
liable to You for damages, including any direct, indirect, special,
|
|
252
|
+
incidental, or consequential damages of any character arising as a
|
|
253
|
+
result of this License or out of the use or inability to use the
|
|
254
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
255
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
256
|
+
other commercial damages or losses), even if such Contributor
|
|
257
|
+
has been advised of the possibility of such damages.
|
|
258
|
+
|
|
259
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
260
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
261
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
262
|
+
or other liability obligations and/or rights consistent with this
|
|
263
|
+
License. However, in accepting such obligations, You may act only
|
|
264
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
265
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
266
|
+
defend, and hold each Contributor harmless for any liability
|
|
267
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
268
|
+
of your accepting any such warranty or additional liability.
|
|
269
|
+
|
|
270
|
+
END OF TERMS AND CONDITIONS
|
|
271
|
+
```
|
package/dist/doc.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { n as e, r as t, t as n } from "./legacy-source-CKrK91co.js";
|
|
2
|
+
//#region src/wasm-direct-doc/legacy_doc_direct_bg.wasm?url
|
|
3
|
+
var r = new URL("legacy_doc_direct_bg.wasm", import.meta.url).href, i = new URL("legacy-doc-source-module.mjs", import.meta.url).href;
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/legacy-doc.ts
|
|
6
|
+
function a(e = {}) {
|
|
7
|
+
if (typeof e != "object" || !e || Array.isArray(e)) throw TypeError("legacy DOC source options must be an object");
|
|
8
|
+
return n("doc", e, {
|
|
9
|
+
wasmUrl: t(r, import.meta.url),
|
|
10
|
+
moduleUrl: t(i, import.meta.url)
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
var o = /* @__PURE__ */ e("docx", () => a());
|
|
14
|
+
//#endregion
|
|
15
|
+
export { a as createLegacyDoc, o as legacyDoc };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.defineProperty,t=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};function r(e,t){return typeof e==`string`?e.startsWith(`LEGACY_UNSUPPORTED_ENCRYPTION:`)?Error(`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`):e.startsWith(`UNSUPPORTED:`)?Error(`MODEL_SOURCE_UNSUPPORTED:${JSON.stringify({format:t,reason:`source-subset`})}`):Error(e):e}var i=class e extends Error{code=`parser-crashed`;constructor(t){super(t),this.name=`WasmTrapError`,Object.setPrototypeOf(this,e.prototype)}};function a(e){let t=globalThis.WebAssembly?.RuntimeError;return t&&e instanceof t||e instanceof RangeError?!0:e instanceof Error?e.name===`RuntimeError`||e.name===`CompileError`||e.name===`LinkError`||e.name===`InternalError`||e.name===`OOMError`:!1}function o(e){try{if((typeof e!=`object`||!e)&&typeof e!=`function`)return;let t=Reflect.get(e,`__destroy_into_raw`);typeof t==`function`&&Reflect.apply(t,e,[])}catch{}}const s=new WeakMap,c=new Set([`http:`,`https:`,`file:`,`blob:`,`data:`]);function l(e,t){if(typeof e!=`string`||e.length===0||e.trim()!==e)throw TypeError(`${t} wasmUrl must be a nonempty absolute URL`);let n;try{n=new URL(e)}catch{throw TypeError(`${t} wasmUrl must be a nonempty absolute URL`)}if(!c.has(n.protocol))throw TypeError(`${t} wasmUrl protocol is unsupported`);return e}function u(e){let t,n,c,u,d=()=>c??u?.failure,g=t=>{if(!a(t))throw h(t);let n=d()??new i(`${e.label} WASM runtime trapped and is unavailable`);if(u){u.failure??=n;for(let e of u.live)e.invalidate();u.live.clear()}else c=n;throw n},_=t=>{let n=d();if(n)throw n;try{return t()}catch(t){return g(e.format?r(t,e.format):t)}},v=r=>t?r===n?t:Promise.reject(Error(`${e.label} source engine is pinned to another WASM URL`)):(n=r,t=e.loadGlue().then(async t=>{if(u=s.get(t),u||(u={live:new Set},s.set(t,u)),u.failure)throw u.failure;try{let n=await e.resolveWasm(r);await t.default({module_or_path:n})}catch(e){return g(e)}return t}),t);return Object.freeze({async open(t,n,r){let i=d();if(i)throw i;let a=l(n,e.label);m(r,e.label);let c;try{c=await p(v(a),r,e.label)}catch(e){return g(e)}if(u=s.get(c),!u)throw Error(`${e.label} source runtime identity is unavailable`);if(u.failure)throw u.failure;m(r,e.label);let h;try{h=_(()=>e.construct(c,t)),m(r,e.label)}catch(t){if(h)try{f(h,e.closeNative,_)}catch{}throw t}let y=!1,b=h,x={invalidate(){let e=b;b=void 0,o(e)}};return u.live.add(x),{archive:new Proxy(h,{get(t,n){let r=b;if(!r)throw d()??Error(`${e.label} source archive is closed`);let i=_(()=>Reflect.get(r,n,r));return typeof i==`function`?(...t)=>{let r=b;if(!r)throw d()??Error(`${e.label} source archive is closed`);return _(()=>{let e=Reflect.get(r,n,r);return Reflect.apply(e,r,t)})}:i}}),sourceByteLength:t.byteLength,closeArchive(){if(y)return;y=!0,u?.live.delete(x);let t=b;b=void 0,t&&f(t,e.closeNative,_)}}}})}async function d(e){let t=new URL(e),n=globalThis.process;if(t.protocol===`file:`&&n?.versions?.node){let{readFile:e}=await import(`node:fs/promises`);return e(t)}return t}function f(e,t,n){let r,s=!1;try{n(()=>t(e))}catch(e){s=!0,r=e}if(a(r)||r instanceof i)o(e);else try{n(()=>e.free())}catch(t){s||(s=!0,r=t),(a(t)||t instanceof i)&&o(e)}if(s)throw r}function p(e,t,n){return t?(m(t,n),new Promise((r,i)=>{let a=()=>{o();try{m(t,n)}catch(e){i(e)}},o=()=>t.removeEventListener(`abort`,a);t.addEventListener(`abort`,a,{once:!0}),e.then(e=>{o(),r(e)},e=>{o(),i(e)})})):e}function m(e,t){if(!e?.aborted)return;let n=Error(`${t} direct source was aborted`);throw n.name=`AbortError`,n}function h(e){return typeof e==`string`?Error(e):e}function g(e,t,n){if(n!==void 0&&(!Number.isSafeInteger(n)||n<=0||n>268435456))throw RangeError(`legacy DOC model budget is invalid`);return u({label:`legacy DOC`,format:`doc`,loadGlue:e,resolveWasm:t,construct:(e,t)=>new e.LegacyDocDocument(t,n),closeNative:e=>e.close_document_session()})}function _(e){return e.revision_markup_in_print?.()===!0&&e.has_revision_marks?.()===!0?{showTrackedChanges:!0}:{}}function v(e,t){if(e!==void 0){if(typeof e!=`number`||!Number.isSafeInteger(e)||e<=0)throw RangeError(`${t} maxInputBytes is invalid`);return e}}function y(e,t){if(typeof e!=`object`||!e)throw TypeError(`${t} source module config must be an object`);let n=e;for(let e of Object.keys(n))if(e!==`wasmUrl`&&e!==`maxInputBytes`)throw TypeError(`${t} source module config has an unknown field`);let r=v(n.maxInputBytes,t);if(typeof n.wasmUrl!=`string`)throw TypeError(`${t} wasmUrl must be a nonempty absolute URL`);return{wasmUrl:n.wasmUrl,...r===void 0?{}:{maxInputBytes:r}}}var b=n({LegacyDocDocument:()=>F,default:()=>N,initSync:()=>M,reinit:()=>P});function x(){return{__proto__:null,"./legacy_doc_direct_bg.js":{__proto__:null,__wbg___wbindgen_throw_6b64449b9b9ed33c:function(e,t){throw Error(w(e,t))},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(w(e,t))}finally{W.__wbindgen_free(n,r,1)}},__wbg_length_9f1775224cf1d815:function(e){return e.length},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_prototypesetcall_a6b02eb00b0f4ce2:function(e,t,n){Uint8Array.prototype.set.call(S(e,t),n)},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=D(n,W.__wbindgen_malloc,W.__wbindgen_realloc),i=U;C().setInt32(e+4,i,!0),C().setInt32(e+0,r,!0)},__wbindgen_cast_0000000000000001:function(e,t){return w(e,t)},__wbindgen_init_externref_table:function(){let e=W.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}function S(e,t){return e>>>=0,T().subarray(e/1,e/1+t)}function C(){return(L===null||L.buffer.detached===!0||L.buffer.detached===void 0&&L.buffer!==W.memory.buffer)&&(L=new DataView(W.memory.buffer)),L}function w(e,t){return e>>>=0,k(e,t)}function T(){return(R===null||R.byteLength===0)&&(R=new Uint8Array(W.memory.buffer)),R}function E(e){return e==null}function D(e,t,n){if(n===void 0){let n=H.encode(e),r=t(n.length,1)>>>0;return T().subarray(r,r+n.length).set(n),U=n.length,r}let r=e.length,i=t(r,1)>>>0,a=T(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=T().subarray(i+o,i+r),a=H.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return U=o,i}function O(e){let t=W.__wbindgen_externrefs.get(e);return W.__externref_table_dealloc(e),t}function k(e,t){return V+=t,V>=B&&(z=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),z.decode(),V=t),z.decode(T().subarray(e,e+t))}function A(e,t){return W=e.exports,L=null,R=null,W.__wbindgen_start(),W}async function j(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&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",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}function M(e){if(W!==void 0)return W;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=x();return e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e)),A(new WebAssembly.Instance(e,t),e)}async function N(e){if(W!==void 0)return W;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`));let t=x();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await j(await e,t);return A(n,r)}async function P(e){return W=void 0,L=null,R=null,N(e)}var F,I,L,R,z,B,V,H,U,W,G=t(()=>{F=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,I.unregister(this),e}free(){let e=this.__destroy_into_raw();W.__wbg_legacydocdocument_free(e,0)}acknowledge_document_chunk(e,t,n){let r=W.legacydocdocument_acknowledge_document_chunk(this.__wbg_ptr,e,t,n);if(r[1])throw O(r[0])}assert_healthy(){let e=W.legacydocdocument_assert_healthy(this.__wbg_ptr);if(e[1])throw O(e[0])}cancel_document_cursor(){let e=W.legacydocdocument_cancel_document_cursor(this.__wbg_ptr);if(e[1])throw O(e[0])}close_document_session(){W.legacydocdocument_close_document_session(this.__wbg_ptr)}document_chunk_done(){let e=W.legacydocdocument_document_chunk_done(this.__wbg_ptr);if(e[2])throw O(e[1]);return e[0]!==0}extract_image(e){let t=D(e,W.__wbindgen_malloc,W.__wbindgen_realloc),n=U,r=W.legacydocdocument_extract_image(this.__wbg_ptr,t,n);if(r[3])throw O(r[2]);var i=S(r[0],r[1]).slice();return W.__wbindgen_free(r[0],r[1]*1,1),i}has_revision_marks(){return W.legacydocdocument_has_revision_marks(this.__wbg_ptr)!==0}image_mime_type(e){let t,n;try{let a=D(e,W.__wbindgen_malloc,W.__wbindgen_realloc),o=U,s=W.legacydocdocument_image_mime_type(this.__wbg_ptr,a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,O(s[2]);return t=r,n=i,w(r,i)}finally{W.__wbindgen_free(t,n,1)}}constructor(e,t){let n=W.legacydocdocument_new(e,E(t)?4294967297:t>>>0);if(n[2])throw O(n[1]);return this.__wbg_ptr=n[0]>>>0,I.register(this,this.__wbg_ptr,this),this}open_document_cursor(e,t){let n=W.legacydocdocument_open_document_cursor(this.__wbg_ptr,e,t);if(n[1])throw O(n[0])}pull_document_chunk(e,t,n,r){let i=W.legacydocdocument_pull_document_chunk(this.__wbg_ptr,e,t,n,r);if(i[3])throw O(i[2]);var a=S(i[0],i[1]).slice();return W.__wbindgen_free(i[0],i[1]*1,1),a}revision_markup_in_print(){return W.legacydocdocument_revision_markup_in_print(this.__wbg_ptr)!==0}revision_markup_on_screen(){return W.legacydocdocument_revision_markup_on_screen(this.__wbg_ptr)!==0}},Symbol.dispose&&(F.prototype[Symbol.dispose]=F.prototype.free),I=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>W.__wbg_legacydocdocument_free(e>>>0,1)),L=null,R=null,z=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),z.decode(),B=2146435072,V=0,H=new TextEncoder,`encodeInto`in H||(H.encodeInto=function(e,t){let n=H.encode(e);return t.set(n),{read:e.length,written:n.length}}),U=0});const K=g(()=>Promise.resolve().then(()=>(G(),b)),d);async function q(e,t,n){let{wasmUrl:r,maxInputBytes:i}=y(t,`legacy DOC`);if(i!==void 0&&e.byteLength>i)throw RangeError(`legacy DOC input exceeds the configured size limit`);let a=await K.open(e,r,n);try{return Object.freeze({archive:a.archive,viewDefaults:_(a.archive),close:()=>a.closeArchive()})}catch(e){try{a.closeArchive()}catch{}throw e}}export{q as openModelSource};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.defineProperty,t=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};function r(e,t){return typeof e==`string`?e.startsWith(`LEGACY_UNSUPPORTED_ENCRYPTION:`)?Error(`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`):e.startsWith(`UNSUPPORTED:`)?Error(`MODEL_SOURCE_UNSUPPORTED:${JSON.stringify({format:t,reason:`source-subset`})}`):Error(e):e}var i=class e extends Error{code=`parser-crashed`;constructor(t){super(t),this.name=`WasmTrapError`,Object.setPrototypeOf(this,e.prototype)}};function a(e){let t=globalThis.WebAssembly?.RuntimeError;return t&&e instanceof t||e instanceof RangeError?!0:e instanceof Error?e.name===`RuntimeError`||e.name===`CompileError`||e.name===`LinkError`||e.name===`InternalError`||e.name===`OOMError`:!1}function o(e){try{if((typeof e!=`object`||!e)&&typeof e!=`function`)return;let t=Reflect.get(e,`__destroy_into_raw`);typeof t==`function`&&Reflect.apply(t,e,[])}catch{}}const s=new WeakMap,c=new Set([`http:`,`https:`,`file:`,`blob:`,`data:`]);function l(e,t){if(typeof e!=`string`||e.length===0||e.trim()!==e)throw TypeError(`${t} wasmUrl must be a nonempty absolute URL`);let n;try{n=new URL(e)}catch{throw TypeError(`${t} wasmUrl must be a nonempty absolute URL`)}if(!c.has(n.protocol))throw TypeError(`${t} wasmUrl protocol is unsupported`);return e}function u(e){let t,n,c,u,d=()=>c??u?.failure,g=t=>{if(!a(t))throw h(t);let n=d()??new i(`${e.label} WASM runtime trapped and is unavailable`);if(u){u.failure??=n;for(let e of u.live)e.invalidate();u.live.clear()}else c=n;throw n},_=t=>{let n=d();if(n)throw n;try{return t()}catch(t){return g(e.format?r(t,e.format):t)}},v=r=>t?r===n?t:Promise.reject(Error(`${e.label} source engine is pinned to another WASM URL`)):(n=r,t=e.loadGlue().then(async t=>{if(u=s.get(t),u||(u={live:new Set},s.set(t,u)),u.failure)throw u.failure;try{let n=await e.resolveWasm(r);await t.default({module_or_path:n})}catch(e){return g(e)}return t}),t);return Object.freeze({async open(t,n,r){let i=d();if(i)throw i;let a=l(n,e.label);m(r,e.label);let c;try{c=await p(v(a),r,e.label)}catch(e){return g(e)}if(u=s.get(c),!u)throw Error(`${e.label} source runtime identity is unavailable`);if(u.failure)throw u.failure;m(r,e.label);let h;try{h=_(()=>e.construct(c,t)),m(r,e.label)}catch(t){if(h)try{f(h,e.closeNative,_)}catch{}throw t}let y=!1,b=h,x={invalidate(){let e=b;b=void 0,o(e)}};return u.live.add(x),{archive:new Proxy(h,{get(t,n){let r=b;if(!r)throw d()??Error(`${e.label} source archive is closed`);let i=_(()=>Reflect.get(r,n,r));return typeof i==`function`?(...t)=>{let r=b;if(!r)throw d()??Error(`${e.label} source archive is closed`);return _(()=>{let e=Reflect.get(r,n,r);return Reflect.apply(e,r,t)})}:i}}),sourceByteLength:t.byteLength,closeArchive(){if(y)return;y=!0,u?.live.delete(x);let t=b;b=void 0,t&&f(t,e.closeNative,_)}}}})}async function d(e){let t=new URL(e),n=globalThis.process;if(t.protocol===`file:`&&n?.versions?.node){let{readFile:e}=await import(`node:fs/promises`);return e(t)}return t}function f(e,t,n){let r,s=!1;try{n(()=>t(e))}catch(e){s=!0,r=e}if(a(r)||r instanceof i)o(e);else try{n(()=>e.free())}catch(t){s||(s=!0,r=t),(a(t)||t instanceof i)&&o(e)}if(s)throw r}function p(e,t,n){return t?(m(t,n),new Promise((r,i)=>{let a=()=>{o();try{m(t,n)}catch(e){i(e)}},o=()=>t.removeEventListener(`abort`,a);t.addEventListener(`abort`,a,{once:!0}),e.then(e=>{o(),r(e)},e=>{o(),i(e)})})):e}function m(e,t){if(!e?.aborted)return;let n=Error(`${t} direct source was aborted`);throw n.name=`AbortError`,n}function h(e){return typeof e==`string`?Error(e):e}function g(e,t){return u({label:`legacy PPT`,format:`ppt`,loadGlue:e,resolveWasm:t,construct:(e,t)=>new e.LegacyPptPresentation(t),closeNative:e=>e.close_presentation_session()})}function _(e,t){if(e!==void 0){if(typeof e!=`number`||!Number.isSafeInteger(e)||e<=0)throw RangeError(`${t} maxInputBytes is invalid`);return e}}function v(e,t){if(typeof e!=`object`||!e)throw TypeError(`${t} source module config must be an object`);let n=e;for(let e of Object.keys(n))if(e!==`wasmUrl`&&e!==`maxInputBytes`)throw TypeError(`${t} source module config has an unknown field`);let r=_(n.maxInputBytes,t);if(typeof n.wasmUrl!=`string`)throw TypeError(`${t} wasmUrl must be a nonempty absolute URL`);return{wasmUrl:n.wasmUrl,...r===void 0?{}:{maxInputBytes:r}}}var y=n({LegacyPptPresentation:()=>N,default:()=>j,initSync:()=>A,reinit:()=>M});function b(){return{__proto__:null,"./legacy_ppt_direct_bg.js":{__proto__:null,__wbg___wbindgen_throw_6b64449b9b9ed33c:function(e,t){throw Error(C(e,t))},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(C(e,t))}finally{H.__wbindgen_free(n,r,1)}},__wbg_length_9f1775224cf1d815:function(e){return e.length},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_prototypesetcall_a6b02eb00b0f4ce2:function(e,t,n){Uint8Array.prototype.set.call(x(e,t),n)},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=T(n,H.__wbindgen_malloc,H.__wbindgen_realloc),i=V;S().setInt32(e+4,i,!0),S().setInt32(e+0,r,!0)},__wbindgen_cast_0000000000000001:function(e,t){return C(e,t)},__wbindgen_init_externref_table:function(){let e=H.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}function x(e,t){return e>>>=0,w().subarray(e/1,e/1+t)}function S(){return(F===null||F.buffer.detached===!0||F.buffer.detached===void 0&&F.buffer!==H.memory.buffer)&&(F=new DataView(H.memory.buffer)),F}function C(e,t){return e>>>=0,D(e,t)}function w(){return(I===null||I.byteLength===0)&&(I=new Uint8Array(H.memory.buffer)),I}function T(e,t,n){if(n===void 0){let n=B.encode(e),r=t(n.length,1)>>>0;return w().subarray(r,r+n.length).set(n),V=n.length,r}let r=e.length,i=t(r,1)>>>0,a=w(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=w().subarray(i+o,i+r),a=B.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return V=o,i}function E(e){let t=H.__wbindgen_externrefs.get(e);return H.__externref_table_dealloc(e),t}function D(e,t){return z+=t,z>=R&&(L=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),L.decode(),z=t),L.decode(w().subarray(e,e+t))}function O(e,t){return H=e.exports,F=null,I=null,H.__wbindgen_start(),H}async function k(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&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",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}function A(e){if(H!==void 0)return H;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=b();return e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e)),O(new WebAssembly.Instance(e,t),e)}async function j(e){if(H!==void 0)return H;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`));let t=b();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await k(await e,t);return O(n,r)}async function M(e){return H=void 0,F=null,I=null,j(e)}var N,P,F,I,L,R,z,B,V,H,U=t(()=>{N=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,P.unregister(this),e}free(){let e=this.__destroy_into_raw();H.__wbg_legacypptpresentation_free(e,0)}acknowledge_slide(e,t){let n=H.legacypptpresentation_acknowledge_slide(this.__wbg_ptr,e,t);if(n[1])throw E(n[0])}assert_healthy(){let e=H.legacypptpresentation_assert_healthy(this.__wbg_ptr);if(e[1])throw E(e[0])}cancel_slide(){let e=H.legacypptpresentation_cancel_slide(this.__wbg_ptr);if(e[1])throw E(e[0])}close_presentation_session(){let e=H.legacypptpresentation_close_presentation_session(this.__wbg_ptr);if(e[1])throw E(e[0])}extract_image(e){let t=T(e,H.__wbindgen_malloc,H.__wbindgen_realloc),n=V,r=H.legacypptpresentation_extract_image(this.__wbg_ptr,t,n);if(r[3])throw E(r[2]);var i=x(r[0],r[1]).slice();return H.__wbindgen_free(r[0],r[1]*1,1),i}constructor(e){let t=H.legacypptpresentation_new(e);if(t[2])throw E(t[1]);return this.__wbg_ptr=t[0]>>>0,P.register(this,this.__wbg_ptr,this),this}presentation_bootstrap(){let e=H.legacypptpresentation_presentation_bootstrap(this.__wbg_ptr);if(e[3])throw E(e[2]);var t=x(e[0],e[1]).slice();return H.__wbindgen_free(e[0],e[1]*1,1),t}pull_slide(e,t,n,r){let i=H.legacypptpresentation_pull_slide(this.__wbg_ptr,e,t,n,r);if(i[3])throw E(i[2]);var a=x(i[0],i[1]).slice();return H.__wbindgen_free(i[0],i[1]*1,1),a}slide_cursor_resource_usage(){let e=H.legacypptpresentation_slide_cursor_resource_usage(this.__wbg_ptr);if(e[3])throw E(e[2]);var t=x(e[0],e[1]).slice();return H.__wbindgen_free(e[0],e[1]*1,1),t}},Symbol.dispose&&(N.prototype[Symbol.dispose]=N.prototype.free),P=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>H.__wbg_legacypptpresentation_free(e>>>0,1)),F=null,I=null,L=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),L.decode(),R=2146435072,z=0,B=new TextEncoder,`encodeInto`in B||(B.encodeInto=function(e,t){let n=B.encode(e);return t.set(n),{read:e.length,written:n.length}}),V=0});const W=g(()=>Promise.resolve().then(()=>(U(),y)),d);async function G(e,t,n){let{wasmUrl:r,maxInputBytes:i}=v(t,`legacy PPT`);if(i!==void 0&&e.byteLength>i)throw RangeError(`legacy PPT input exceeds the configured size limit`);let a=await W.open(e,r,n);return Object.freeze({archive:a.archive,close:()=>a.closeArchive()})}export{G as openModelSource};
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { MODEL_SOURCE_MODULE_PROTOCOL as e, assertCompanionRuntime as t } from "@silurus/ooxml/internal/companion";
|
|
2
|
+
//#region ../core/src/internal/bundled-asset-url.ts
|
|
3
|
+
function n(e, t) {
|
|
4
|
+
if (e.startsWith("/") && globalThis.location?.href) {
|
|
5
|
+
let n;
|
|
6
|
+
try {
|
|
7
|
+
n = new URL("/", t);
|
|
8
|
+
} catch {}
|
|
9
|
+
if (!n || n.protocol === "file:") try {
|
|
10
|
+
return new URL(e, globalThis.location.href).href;
|
|
11
|
+
} catch {}
|
|
12
|
+
}
|
|
13
|
+
return new URL(e, t).href;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region ../core/src/errors/cfb-read.ts
|
|
17
|
+
var r = 4294967290, i = 1e6;
|
|
18
|
+
function a(e, t) {
|
|
19
|
+
return (e + 1) * t;
|
|
20
|
+
}
|
|
21
|
+
function o(e) {
|
|
22
|
+
return e >= 0 && e <= r;
|
|
23
|
+
}
|
|
24
|
+
function s(e, t, n) {
|
|
25
|
+
let { sectorSize: r } = n, s = [], c = /* @__PURE__ */ new Set(), l = Math.max(0, Math.floor(t / r) - 1);
|
|
26
|
+
if (n.numFatSectors > l || n.numDifatSectors > l || n.numDifatSectors > i) return null;
|
|
27
|
+
let u = 0, d = (e) => u++ >= n.numFatSectors ? !o(e) : !o(e) || e >= l || c.has(e) ? !1 : (c.add(e), s.push(e), !0);
|
|
28
|
+
for (let t = 0; t < 109; t++) if (!d(e.getUint32(76 + t * 4, !0))) return null;
|
|
29
|
+
let f = r / 4 - 1, p = n.firstDifatSector, m = /* @__PURE__ */ new Set(), h = 0;
|
|
30
|
+
for (; o(p) && h < n.numDifatSectors && (h++, !m.has(p));) {
|
|
31
|
+
m.add(p);
|
|
32
|
+
let n = a(p, r);
|
|
33
|
+
if (n < 0 || n + r > t) return null;
|
|
34
|
+
for (let t = 0; t < f; t++) if (!d(e.getUint32(n + t * 4, !0))) return null;
|
|
35
|
+
p = e.getUint32(n + f * 4, !0);
|
|
36
|
+
}
|
|
37
|
+
return h !== n.numDifatSectors || o(p) || s.length !== n.numFatSectors ? null : s;
|
|
38
|
+
}
|
|
39
|
+
function c(e, t, n, r, i) {
|
|
40
|
+
let s = n / 4, c = Math.floor(i / s), l = i % s;
|
|
41
|
+
if (c >= r.length) return null;
|
|
42
|
+
let u = r[c];
|
|
43
|
+
if (!o(u)) return null;
|
|
44
|
+
let d = a(u, n) + l * 4;
|
|
45
|
+
return d < 0 || d + 4 > t ? null : e.getUint32(d, !0);
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region ../core/src/errors/cfb-sniff.ts
|
|
49
|
+
var l = 4294967290, u = 128, d = 4096, f = 8192;
|
|
50
|
+
function p(e, t, n, r, i) {
|
|
51
|
+
if (!g(r)) return null;
|
|
52
|
+
let a = /* @__PURE__ */ new Set(), o = Math.floor(n / u);
|
|
53
|
+
if (o < 1) return null;
|
|
54
|
+
let s = /* @__PURE__ */ new Set(), l = r, p = 0, _ = 0;
|
|
55
|
+
for (; g(l) && !(p++ > f || s.has(l));) {
|
|
56
|
+
s.add(l);
|
|
57
|
+
let r = h(l, n);
|
|
58
|
+
if (r < 0 || r + n > t) return null;
|
|
59
|
+
for (let t = 0; t < o; t++) {
|
|
60
|
+
if (_++ > d) return a;
|
|
61
|
+
let n = m(e, r + t * u);
|
|
62
|
+
n && a.add(n);
|
|
63
|
+
}
|
|
64
|
+
let f = c(e, t, n, i, l);
|
|
65
|
+
if (f === null) break;
|
|
66
|
+
l = f;
|
|
67
|
+
}
|
|
68
|
+
return a;
|
|
69
|
+
}
|
|
70
|
+
function m(e, t) {
|
|
71
|
+
let n = e.getUint16(t + 64, !0);
|
|
72
|
+
if (n < 2 || n > 64) return "";
|
|
73
|
+
let r = n / 2 - 1, i = "";
|
|
74
|
+
for (let n = 0; n < r; n++) {
|
|
75
|
+
let r = e.getUint16(t + n * 2, !0);
|
|
76
|
+
if (r === 0) break;
|
|
77
|
+
i += String.fromCharCode(r);
|
|
78
|
+
}
|
|
79
|
+
return i;
|
|
80
|
+
}
|
|
81
|
+
function h(e, t) {
|
|
82
|
+
return (e + 1) * t;
|
|
83
|
+
}
|
|
84
|
+
function g(e) {
|
|
85
|
+
return e >= 0 && e <= l;
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region ../core/src/source/cfb-directory-names.ts
|
|
89
|
+
var _ = [
|
|
90
|
+
208,
|
|
91
|
+
207,
|
|
92
|
+
17,
|
|
93
|
+
224,
|
|
94
|
+
161,
|
|
95
|
+
177,
|
|
96
|
+
26,
|
|
97
|
+
225
|
|
98
|
+
];
|
|
99
|
+
function v(e) {
|
|
100
|
+
if (e.length < 512) return null;
|
|
101
|
+
for (let t = 0; t < _.length; t++) if (e[t] !== _[t]) return null;
|
|
102
|
+
let t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = t.getUint16(30, !0);
|
|
103
|
+
if (n !== 9 && n !== 12) return /* @__PURE__ */ new Set();
|
|
104
|
+
let r = 1 << n, i = s(t, e.length, {
|
|
105
|
+
sectorSize: r,
|
|
106
|
+
numFatSectors: t.getUint32(44, !0),
|
|
107
|
+
firstDifatSector: t.getUint32(68, !0),
|
|
108
|
+
numDifatSectors: t.getUint32(72, !0)
|
|
109
|
+
});
|
|
110
|
+
return i === null ? /* @__PURE__ */ new Set() : p(t, e.length, r, t.getUint32(48, !0), i) ?? /* @__PURE__ */ new Set();
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region ../../src/companion-version.ts
|
|
114
|
+
var y = "0.89.1";
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/source-module-config.ts
|
|
117
|
+
function b(e, t) {
|
|
118
|
+
if (e !== void 0) {
|
|
119
|
+
if (typeof e != "number" || !Number.isSafeInteger(e) || e <= 0) throw RangeError(`${t} maxInputBytes is invalid`);
|
|
120
|
+
return e;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/legacy-source.ts
|
|
125
|
+
var x = {
|
|
126
|
+
wasmUrl: new Set([
|
|
127
|
+
"http:",
|
|
128
|
+
"https:",
|
|
129
|
+
"file:",
|
|
130
|
+
"blob:",
|
|
131
|
+
"data:"
|
|
132
|
+
]),
|
|
133
|
+
moduleUrl: new Set([
|
|
134
|
+
"http:",
|
|
135
|
+
"https:",
|
|
136
|
+
"file:",
|
|
137
|
+
"blob:"
|
|
138
|
+
])
|
|
139
|
+
}, S = {
|
|
140
|
+
doc: "docx",
|
|
141
|
+
xls: "xlsx",
|
|
142
|
+
ppt: "pptx"
|
|
143
|
+
};
|
|
144
|
+
function C(e) {
|
|
145
|
+
let t = [];
|
|
146
|
+
return e.has("WordDocument") && t.push("doc"), (e.has("Workbook") || e.has("Book")) && t.push("xls"), e.has("PowerPoint Document") && t.push("ppt"), t.length === 1 ? t[0] : null;
|
|
147
|
+
}
|
|
148
|
+
function w(n, r, i) {
|
|
149
|
+
t(y, "ooxml-model-source-module/v2");
|
|
150
|
+
let a = `legacy ${n.toUpperCase()} source`;
|
|
151
|
+
if (typeof r != "object" || !r) throw TypeError(`${a} options must be an object`);
|
|
152
|
+
let o = E(r.wasmUrl ?? i.wasmUrl, "wasmUrl", a), s = E(r.moduleUrl ?? i.moduleUrl, "moduleUrl", a), c = b(r.maxInputBytes, a), l = S[n], u = Object.freeze({
|
|
153
|
+
protocol: e,
|
|
154
|
+
target: l,
|
|
155
|
+
moduleUrl: s,
|
|
156
|
+
config: Object.freeze({
|
|
157
|
+
wasmUrl: o,
|
|
158
|
+
...c === void 0 ? {} : { maxInputBytes: c }
|
|
159
|
+
})
|
|
160
|
+
});
|
|
161
|
+
return Object.freeze({
|
|
162
|
+
target: l,
|
|
163
|
+
claim(e) {
|
|
164
|
+
let t = v(e);
|
|
165
|
+
if (!t || t.has("EncryptionInfo") || C(t) !== n) return !1;
|
|
166
|
+
if (c !== void 0 && e.byteLength > c) throw RangeError(`${a} input exceeds the configured size limit`);
|
|
167
|
+
return !0;
|
|
168
|
+
},
|
|
169
|
+
beginLoad() {
|
|
170
|
+
return {
|
|
171
|
+
module: u,
|
|
172
|
+
release() {}
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
function T(e, t) {
|
|
178
|
+
let n, r = () => n ??= t();
|
|
179
|
+
return Object.freeze({
|
|
180
|
+
target: e,
|
|
181
|
+
claim: (e) => r().claim(e),
|
|
182
|
+
beginLoad: () => r().beginLoad()
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
function E(e, t, n) {
|
|
186
|
+
if (typeof e != "string" || e.length === 0 || e.trim() !== e) throw TypeError(`${n} ${t} must be a nonempty absolute URL`);
|
|
187
|
+
let r;
|
|
188
|
+
try {
|
|
189
|
+
r = new URL(e);
|
|
190
|
+
} catch {
|
|
191
|
+
throw TypeError(`${n} ${t} must be a nonempty absolute URL`);
|
|
192
|
+
}
|
|
193
|
+
if (!x[t].has(r.protocol)) throw TypeError(`${n} ${t} protocol is unsupported`);
|
|
194
|
+
return e;
|
|
195
|
+
}
|
|
196
|
+
//#endregion
|
|
197
|
+
export { T as n, n as r, w as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.defineProperty,t=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};function r(e,t){return typeof e==`string`?e.startsWith(`LEGACY_UNSUPPORTED_ENCRYPTION:`)?Error(`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`):e.startsWith(`UNSUPPORTED:`)?Error(`MODEL_SOURCE_UNSUPPORTED:${JSON.stringify({format:t,reason:`source-subset`})}`):Error(e):e}var i=class e extends Error{code=`parser-crashed`;constructor(t){super(t),this.name=`WasmTrapError`,Object.setPrototypeOf(this,e.prototype)}};function a(e){let t=globalThis.WebAssembly?.RuntimeError;return t&&e instanceof t||e instanceof RangeError?!0:e instanceof Error?e.name===`RuntimeError`||e.name===`CompileError`||e.name===`LinkError`||e.name===`InternalError`||e.name===`OOMError`:!1}function o(e){try{if((typeof e!=`object`||!e)&&typeof e!=`function`)return;let t=Reflect.get(e,`__destroy_into_raw`);typeof t==`function`&&Reflect.apply(t,e,[])}catch{}}const s=new WeakMap,c=new Set([`http:`,`https:`,`file:`,`blob:`,`data:`]);function l(e,t){if(typeof e!=`string`||e.length===0||e.trim()!==e)throw TypeError(`${t} wasmUrl must be a nonempty absolute URL`);let n;try{n=new URL(e)}catch{throw TypeError(`${t} wasmUrl must be a nonempty absolute URL`)}if(!c.has(n.protocol))throw TypeError(`${t} wasmUrl protocol is unsupported`);return e}function u(e){let t,n,c,u,d=()=>c??u?.failure,g=t=>{if(!a(t))throw h(t);let n=d()??new i(`${e.label} WASM runtime trapped and is unavailable`);if(u){u.failure??=n;for(let e of u.live)e.invalidate();u.live.clear()}else c=n;throw n},_=t=>{let n=d();if(n)throw n;try{return t()}catch(t){return g(e.format?r(t,e.format):t)}},v=r=>t?r===n?t:Promise.reject(Error(`${e.label} source engine is pinned to another WASM URL`)):(n=r,t=e.loadGlue().then(async t=>{if(u=s.get(t),u||(u={live:new Set},s.set(t,u)),u.failure)throw u.failure;try{let n=await e.resolveWasm(r);await t.default({module_or_path:n})}catch(e){return g(e)}return t}),t);return Object.freeze({async open(t,n,r){let i=d();if(i)throw i;let a=l(n,e.label);m(r,e.label);let c;try{c=await p(v(a),r,e.label)}catch(e){return g(e)}if(u=s.get(c),!u)throw Error(`${e.label} source runtime identity is unavailable`);if(u.failure)throw u.failure;m(r,e.label);let h;try{h=_(()=>e.construct(c,t)),m(r,e.label)}catch(t){if(h)try{f(h,e.closeNative,_)}catch{}throw t}let y=!1,b=h,x={invalidate(){let e=b;b=void 0,o(e)}};return u.live.add(x),{archive:new Proxy(h,{get(t,n){let r=b;if(!r)throw d()??Error(`${e.label} source archive is closed`);let i=_(()=>Reflect.get(r,n,r));return typeof i==`function`?(...t)=>{let r=b;if(!r)throw d()??Error(`${e.label} source archive is closed`);return _(()=>{let e=Reflect.get(r,n,r);return Reflect.apply(e,r,t)})}:i}}),sourceByteLength:t.byteLength,closeArchive(){if(y)return;y=!0,u?.live.delete(x);let t=b;b=void 0,t&&f(t,e.closeNative,_)}}}})}async function d(e){let t=new URL(e),n=globalThis.process;if(t.protocol===`file:`&&n?.versions?.node){let{readFile:e}=await import(`node:fs/promises`);return e(t)}return t}function f(e,t,n){let r,s=!1;try{n(()=>t(e))}catch(e){s=!0,r=e}if(a(r)||r instanceof i)o(e);else try{n(()=>e.free())}catch(t){s||(s=!0,r=t),(a(t)||t instanceof i)&&o(e)}if(s)throw r}function p(e,t,n){return t?(m(t,n),new Promise((r,i)=>{let a=()=>{o();try{m(t,n)}catch(e){i(e)}},o=()=>t.removeEventListener(`abort`,a);t.addEventListener(`abort`,a,{once:!0}),e.then(e=>{o(),r(e)},e=>{o(),i(e)})})):e}function m(e,t){if(!e?.aborted)return;let n=Error(`${t} direct source was aborted`);throw n.name=`AbortError`,n}function h(e){return typeof e==`string`?Error(e):e}function g(e,t){return u({label:`legacy XLS`,format:`xls`,loadGlue:e,resolveWasm:t,construct:(e,t)=>new e.LegacyXlsWorkbook(t),closeNative:e=>e.close_workbook_session()})}function _(e,t){if(e!==void 0){if(typeof e!=`number`||!Number.isSafeInteger(e)||e<=0)throw RangeError(`${t} maxInputBytes is invalid`);return e}}function v(e,t){if(typeof e!=`object`||!e)throw TypeError(`${t} source module config must be an object`);let n=e;for(let e of Object.keys(n))if(e!==`wasmUrl`&&e!==`maxInputBytes`)throw TypeError(`${t} source module config has an unknown field`);let r=_(n.maxInputBytes,t);if(typeof n.wasmUrl!=`string`)throw TypeError(`${t} wasmUrl must be a nonempty absolute URL`);return{wasmUrl:n.wasmUrl,...r===void 0?{}:{maxInputBytes:r}}}var y=n({LegacyXlsWorkbook:()=>P,default:()=>M,initSync:()=>j,reinit:()=>N});function b(){return{__proto__:null,"./legacy_xls_direct_bg.js":{__proto__:null,__wbg___wbindgen_throw_6b64449b9b9ed33c:function(e,t){throw Error(C(e,t))},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(C(e,t))}finally{U.__wbindgen_free(n,r,1)}},__wbg_length_9f1775224cf1d815:function(e){return e.length},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_prototypesetcall_a6b02eb00b0f4ce2:function(e,t,n){Uint8Array.prototype.set.call(x(e,t),n)},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=E(n,U.__wbindgen_malloc,U.__wbindgen_realloc),i=H;S().setInt32(e+4,i,!0),S().setInt32(e+0,r,!0)},__wbindgen_cast_0000000000000001:function(e,t){return C(e,t)},__wbindgen_init_externref_table:function(){let e=U.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}function x(e,t){return e>>>=0,w().subarray(e/1,e/1+t)}function S(){return(I===null||I.buffer.detached===!0||I.buffer.detached===void 0&&I.buffer!==U.memory.buffer)&&(I=new DataView(U.memory.buffer)),I}function C(e,t){return e>>>=0,O(e,t)}function w(){return(L===null||L.byteLength===0)&&(L=new Uint8Array(U.memory.buffer)),L}function T(e){return e==null}function E(e,t,n){if(n===void 0){let n=V.encode(e),r=t(n.length,1)>>>0;return w().subarray(r,r+n.length).set(n),H=n.length,r}let r=e.length,i=t(r,1)>>>0,a=w(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=w().subarray(i+o,i+r),a=V.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return H=o,i}function D(e){let t=U.__wbindgen_externrefs.get(e);return U.__externref_table_dealloc(e),t}function O(e,t){return B+=t,B>=z&&(R=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),R.decode(),B=t),R.decode(w().subarray(e,e+t))}function k(e,t){return U=e.exports,I=null,L=null,U.__wbindgen_start(),U}async function A(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&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",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}function j(e){if(U!==void 0)return U;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=b();return e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e)),k(new WebAssembly.Instance(e,t),e)}async function M(e){if(U!==void 0)return U;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`));let t=b();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await A(await e,t);return k(n,r)}async function N(e){return U=void 0,I=null,L=null,M(e)}var P,F,I,L,R,z,B,V,H,U,W=t(()=>{P=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,F.unregister(this),e}free(){let e=this.__destroy_into_raw();U.__wbg_legacyxlsworkbook_free(e,0)}acknowledge_sheet_cursor_terminal(){let e=U.legacyxlsworkbook_acknowledge_sheet_cursor_terminal(this.__wbg_ptr);if(e[1])throw D(e[0])}assert_healthy(){let e=U.legacyxlsworkbook_assert_healthy(this.__wbg_ptr);if(e[1])throw D(e[0])}cancel_sheet_cursor(){U.legacyxlsworkbook_cancel_sheet_cursor(this.__wbg_ptr)}close_sheet_cursor(){U.legacyxlsworkbook_close_sheet_cursor(this.__wbg_ptr)}close_workbook_session(){let e=U.legacyxlsworkbook_close_workbook_session(this.__wbg_ptr);if(e[1])throw D(e[0])}configure_host_layout(e){let t=U.legacyxlsworkbook_configure_host_layout(this.__wbg_ptr,!T(e),T(e)?0:e);if(t[1])throw D(t[0])}extract_image(e){let t=E(e,U.__wbindgen_malloc,U.__wbindgen_realloc),n=H,r=U.legacyxlsworkbook_extract_image(this.__wbg_ptr,t,n);if(r[3])throw D(r[2]);var i=x(r[0],r[1]).slice();return U.__wbindgen_free(r[0],r[1]*1,1),i}host_layout_request(){let e=U.legacyxlsworkbook_host_layout_request(this.__wbg_ptr);if(e[3])throw D(e[2]);var t=x(e[0],e[1]).slice();return U.__wbindgen_free(e[0],e[1]*1,1),t}constructor(e){let t=U.legacyxlsworkbook_new(e);if(t[2])throw D(t[1]);return this.__wbg_ptr=t[0]>>>0,F.register(this,this.__wbg_ptr,this),this}open_sheet_cursor(e,t){let n=E(t,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=U.legacyxlsworkbook_open_sheet_cursor(this.__wbg_ptr,e,n,r);if(i[1])throw D(i[0])}parse(){let e=U.legacyxlsworkbook_parse(this.__wbg_ptr);if(e[3])throw D(e[2]);var t=x(e[0],e[1]).slice();return U.__wbindgen_free(e[0],e[1]*1,1),t}pull_sheet_cursor(e){let t=U.legacyxlsworkbook_pull_sheet_cursor(this.__wbg_ptr,e);if(t[3])throw D(t[2]);var n=x(t[0],t[1]).slice();return U.__wbindgen_free(t[0],t[1]*1,1),n}sheet_cursor_pull_finished(){return U.legacyxlsworkbook_sheet_cursor_pull_finished(this.__wbg_ptr)!==0}},Symbol.dispose&&(P.prototype[Symbol.dispose]=P.prototype.free),F=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>U.__wbg_legacyxlsworkbook_free(e>>>0,1)),I=null,L=null,R=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),R.decode(),z=2146435072,B=0,V=new TextEncoder,`encodeInto`in V||(V.encodeInto=function(e,t){let n=V.encode(e);return t.set(n),{read:e.length,written:n.length}}),H=0});const G=g(()=>Promise.resolve().then(()=>(W(),y)),d);async function K(e,t,n){let{wasmUrl:r,maxInputBytes:i}=v(t,`legacy XLS`);if(i!==void 0&&e.byteLength>i)throw RangeError(`legacy XLS input exceeds the configured size limit`);let a=await G.open(e,r,n);return Object.freeze({archive:a.archive,close:()=>a.closeArchive()})}export{K as openModelSource};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/ppt.mjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { n as e, r as t, t as n } from "./legacy-source-CKrK91co.js";
|
|
2
|
+
//#region src/wasm-direct-ppt/legacy_ppt_direct_bg.wasm?url
|
|
3
|
+
var r = new URL("legacy_ppt_direct_bg.wasm", import.meta.url).href, i = new URL("legacy-ppt-source-module.mjs", import.meta.url).href;
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/legacy-ppt.ts
|
|
6
|
+
function a(e = {}) {
|
|
7
|
+
return n("ppt", e, {
|
|
8
|
+
wasmUrl: t(r, import.meta.url),
|
|
9
|
+
moduleUrl: t(i, import.meta.url)
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
var o = /* @__PURE__ */ e("pptx", () => a());
|
|
13
|
+
//#endregion
|
|
14
|
+
export { a as createLegacyPpt, o as legacyPpt };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region dist/.types-work/legacy-source-Demb9N-0.d.ts
|
|
2
|
+
type ModelSourceTarget = 'docx' | 'xlsx' | 'pptx';
|
|
3
|
+
type ModelSourceConfigValue = string | number | boolean | null;
|
|
4
|
+
type ModelSourceConfig = Readonly<Record<string, ModelSourceConfigValue>>;
|
|
5
|
+
declare const MODEL_SOURCE_MODULE_PROTOCOL = "ooxml-model-source-module/v2";
|
|
6
|
+
interface ModelSourceModuleDescriptor {
|
|
7
|
+
readonly protocol: typeof MODEL_SOURCE_MODULE_PROTOCOL;
|
|
8
|
+
readonly target: ModelSourceTarget;
|
|
9
|
+
readonly moduleUrl: string;
|
|
10
|
+
readonly config: ModelSourceConfig;
|
|
11
|
+
}
|
|
12
|
+
interface ModelSourceLoad {
|
|
13
|
+
readonly module: ModelSourceModuleDescriptor;
|
|
14
|
+
readonly transfer?: readonly Transferable[];
|
|
15
|
+
release(): void;
|
|
16
|
+
}
|
|
17
|
+
interface ModelSource<T extends ModelSourceTarget = ModelSourceTarget> {
|
|
18
|
+
readonly target: T;
|
|
19
|
+
claim(bytes: Uint8Array): boolean;
|
|
20
|
+
beginLoad(): ModelSourceLoad;
|
|
21
|
+
}
|
|
22
|
+
interface LegacySourceOptions {
|
|
23
|
+
readonly wasmUrl?: string;
|
|
24
|
+
readonly moduleUrl?: string;
|
|
25
|
+
readonly maxInputBytes?: number;
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region dist/.types-work/doc.d.ts
|
|
29
|
+
type LegacyDocOptions = LegacySourceOptions;
|
|
30
|
+
declare function createLegacyDoc(options?: LegacyDocOptions): ModelSource<'docx'>;
|
|
31
|
+
declare const legacyDoc: ModelSource<'docx'>;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { LegacyDocOptions, createLegacyDoc, legacyDoc };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region dist/.types-work/legacy-source-Demb9N-0.d.ts
|
|
2
|
+
type ModelSourceTarget = 'docx' | 'xlsx' | 'pptx';
|
|
3
|
+
type ModelSourceConfigValue = string | number | boolean | null;
|
|
4
|
+
type ModelSourceConfig = Readonly<Record<string, ModelSourceConfigValue>>;
|
|
5
|
+
declare const MODEL_SOURCE_MODULE_PROTOCOL = "ooxml-model-source-module/v2";
|
|
6
|
+
interface ModelSourceModuleDescriptor {
|
|
7
|
+
readonly protocol: typeof MODEL_SOURCE_MODULE_PROTOCOL;
|
|
8
|
+
readonly target: ModelSourceTarget;
|
|
9
|
+
readonly moduleUrl: string;
|
|
10
|
+
readonly config: ModelSourceConfig;
|
|
11
|
+
}
|
|
12
|
+
interface ModelSourceLoad {
|
|
13
|
+
readonly module: ModelSourceModuleDescriptor;
|
|
14
|
+
readonly transfer?: readonly Transferable[];
|
|
15
|
+
release(): void;
|
|
16
|
+
}
|
|
17
|
+
interface ModelSource<T extends ModelSourceTarget = ModelSourceTarget> {
|
|
18
|
+
readonly target: T;
|
|
19
|
+
claim(bytes: Uint8Array): boolean;
|
|
20
|
+
beginLoad(): ModelSourceLoad;
|
|
21
|
+
}
|
|
22
|
+
interface LegacySourceOptions {
|
|
23
|
+
readonly wasmUrl?: string;
|
|
24
|
+
readonly moduleUrl?: string;
|
|
25
|
+
readonly maxInputBytes?: number;
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region dist/.types-work/ppt.d.ts
|
|
29
|
+
type LegacyPptOptions = LegacySourceOptions;
|
|
30
|
+
declare function createLegacyPpt(options?: LegacyPptOptions): ModelSource<'pptx'>;
|
|
31
|
+
declare const legacyPpt: ModelSource<'pptx'>;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { LegacyPptOptions, createLegacyPpt, legacyPpt };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region dist/.types-work/legacy-source-Demb9N-0.d.ts
|
|
2
|
+
type ModelSourceTarget = 'docx' | 'xlsx' | 'pptx';
|
|
3
|
+
type ModelSourceConfigValue = string | number | boolean | null;
|
|
4
|
+
type ModelSourceConfig = Readonly<Record<string, ModelSourceConfigValue>>;
|
|
5
|
+
declare const MODEL_SOURCE_MODULE_PROTOCOL = "ooxml-model-source-module/v2";
|
|
6
|
+
interface ModelSourceModuleDescriptor {
|
|
7
|
+
readonly protocol: typeof MODEL_SOURCE_MODULE_PROTOCOL;
|
|
8
|
+
readonly target: ModelSourceTarget;
|
|
9
|
+
readonly moduleUrl: string;
|
|
10
|
+
readonly config: ModelSourceConfig;
|
|
11
|
+
}
|
|
12
|
+
interface ModelSourceLoad {
|
|
13
|
+
readonly module: ModelSourceModuleDescriptor;
|
|
14
|
+
readonly transfer?: readonly Transferable[];
|
|
15
|
+
release(): void;
|
|
16
|
+
}
|
|
17
|
+
interface ModelSource<T extends ModelSourceTarget = ModelSourceTarget> {
|
|
18
|
+
readonly target: T;
|
|
19
|
+
claim(bytes: Uint8Array): boolean;
|
|
20
|
+
beginLoad(): ModelSourceLoad;
|
|
21
|
+
}
|
|
22
|
+
interface LegacySourceOptions {
|
|
23
|
+
readonly wasmUrl?: string;
|
|
24
|
+
readonly moduleUrl?: string;
|
|
25
|
+
readonly maxInputBytes?: number;
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region dist/.types-work/xls.d.ts
|
|
29
|
+
type LegacyXlsOptions = LegacySourceOptions;
|
|
30
|
+
declare function createLegacyXls(options?: LegacyXlsOptions): ModelSource<'xlsx'>;
|
|
31
|
+
declare const legacyXls: ModelSource<'xlsx'>;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { LegacyXlsOptions, createLegacyXls, legacyXls };
|
package/dist/xls.mjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { n as e, r as t, t as n } from "./legacy-source-CKrK91co.js";
|
|
2
|
+
//#region src/wasm-direct-xls/legacy_xls_direct_bg.wasm?url
|
|
3
|
+
var r = new URL("legacy_xls_direct_bg.wasm", import.meta.url).href, i = new URL("legacy-xls-source-module.mjs", import.meta.url).href;
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/legacy-xls.ts
|
|
6
|
+
function a(e = {}) {
|
|
7
|
+
return n("xls", e, {
|
|
8
|
+
wasmUrl: t(r, import.meta.url),
|
|
9
|
+
moduleUrl: t(i, import.meta.url)
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
var o = /* @__PURE__ */ e("xlsx", () => a());
|
|
13
|
+
//#endregion
|
|
14
|
+
export { a as createLegacyXls, o as legacyXls };
|
package/package.json
CHANGED
|
@@ -1,6 +1,74 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@silurus/ooxml-legacy-office",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.89.1",
|
|
4
|
+
"description": "Optional legacy Office (DOC/XLS/PPT) model sources for @silurus/ooxml",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Yuki Yokotani <silurus.dev@gmail.com>",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/yukiyokotani/office-open-xml-viewer.git",
|
|
10
|
+
"directory": "packages/legacy-office"
|
|
11
|
+
},
|
|
12
|
+
"type": "module",
|
|
13
|
+
"sideEffects": false,
|
|
14
|
+
"exports": {
|
|
15
|
+
"./doc": {
|
|
16
|
+
"types": "./dist/types/doc.d.ts",
|
|
17
|
+
"import": "./dist/doc.mjs",
|
|
18
|
+
"default": "./dist/doc.mjs"
|
|
19
|
+
},
|
|
20
|
+
"./xls": {
|
|
21
|
+
"types": "./dist/types/xls.d.ts",
|
|
22
|
+
"import": "./dist/xls.mjs",
|
|
23
|
+
"default": "./dist/xls.mjs"
|
|
24
|
+
},
|
|
25
|
+
"./ppt": {
|
|
26
|
+
"types": "./dist/types/ppt.d.ts",
|
|
27
|
+
"import": "./dist/ppt.mjs",
|
|
28
|
+
"default": "./dist/ppt.mjs"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@playwright/test": "^1.59.1",
|
|
33
|
+
"@types/node": "^25.6.0",
|
|
34
|
+
"@types/pngjs": "^6.0.5",
|
|
35
|
+
"pixelmatch": "^7.1.0",
|
|
36
|
+
"playwright": "^1.59.1",
|
|
37
|
+
"pngjs": "^7.0.0",
|
|
38
|
+
"typescript": "^7.0.2",
|
|
39
|
+
"vite": "^8.0.8",
|
|
40
|
+
"vitest": "^4.1.4",
|
|
41
|
+
"@silurus/ooxml-core": "0.89.1",
|
|
42
|
+
"@silurus/ooxml": "0.89.1"
|
|
43
|
+
},
|
|
44
|
+
"files": [
|
|
45
|
+
"dist",
|
|
46
|
+
"LICENSE",
|
|
47
|
+
"THIRD_PARTY_NOTICES.md"
|
|
48
|
+
],
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public",
|
|
51
|
+
"provenance": true
|
|
52
|
+
},
|
|
53
|
+
"keywords": [
|
|
54
|
+
"ooxml",
|
|
55
|
+
"office",
|
|
56
|
+
"doc",
|
|
57
|
+
"xls",
|
|
58
|
+
"ppt",
|
|
59
|
+
"viewer",
|
|
60
|
+
"wasm"
|
|
61
|
+
],
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"@silurus/ooxml": "0.89.1"
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"wasm:direct-doc": "cd parser && wasm-pack build --target web --out-dir ../src/wasm-direct-doc --out-name legacy_doc_direct --features direct-doc && node ../../../scripts/append-wasm-reinit.mjs ../src/wasm-direct-doc/legacy_doc_direct.js",
|
|
67
|
+
"wasm:direct-ppt": "cd parser && wasm-pack build --target web --out-dir ../src/wasm-direct-ppt --out-name legacy_ppt_direct --features direct-ppt && node ../../../scripts/append-wasm-reinit.mjs ../src/wasm-direct-ppt/legacy_ppt_direct.js",
|
|
68
|
+
"wasm:direct-xls": "cd parser && wasm-pack build --target web --out-dir ../src/wasm-direct-xls --out-name legacy_xls_direct --features direct-xls && node ../../../scripts/append-wasm-reinit.mjs ../src/wasm-direct-xls/legacy_xls_direct.js",
|
|
69
|
+
"typecheck": "tsc --noEmit",
|
|
70
|
+
"survey": "playwright test --config playwright.config.ts",
|
|
71
|
+
"build": "vite build && node ../../scripts/bundle-declarations.mjs doc xls ppt",
|
|
72
|
+
"test": "cd ../.. && vitest run packages/legacy-office/src"
|
|
73
|
+
}
|
|
6
74
|
}
|