@univer-cli/univer-collaboration-runtime-pool 1.5.2 → 1.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.
package/README.md CHANGED
@@ -2,9 +2,7 @@
2
2
 
3
3
  English | [简体中文](./README.zh-CN.md)
4
4
 
5
- Create, exclusively lease, cache, and recycle `UniverCollaborationRuntime` instances in separate worker processes by an application-owned opaque key.
6
-
7
- This lets multiple short tasks reuse expensive runtimes while isolating Univer and native/runtime state in workers. If you need only one runtime in the current process, use `@univer-cli/univer-collaboration-runtime` directly.
5
+ Use this package when your application repeatedly reads or edits the same Univer documents and you want tasks to reuse a loaded collaboration runtime. Each Unit has its own Univer instance and collaboration state. Several Units can share a Node.js worker process. To work with a single Unit in the current process, use the [collaboration runtime](../univer-collaboration-runtime/README.md) directly.
8
6
 
9
7
  ## Installation
10
8
 
@@ -12,25 +10,28 @@ This lets multiple short tasks reuse expensive runtimes while isolating Univer a
12
10
  pnpm add @univer-cli/univer-collaboration-runtime-pool
13
11
  ```
14
12
 
15
- Requires Node.js 22.12 or higher. Worker entry must be the built JavaScript ESM file and cannot point to TypeScript source.
13
+ Requires Node.js 22.12 or later. Your application supplies the backend, credentials, and Univer factory. The pool manages the lifetime of the runtimes in its workers.
16
14
 
17
- ## Worker entry
15
+ ## Define a worker entry
18
16
 
19
- The worker creates the backend in the process that hosts the runtime, reads credentials, and constructs Univer:
17
+ First, define a worker entry. In this Sheet example, the application supplies `loadSheetRuntime(unitId)`, which creates a collaboration runtime for the given workbook using your backend and a fresh Univer instance. Build the entry as a JavaScript ESM file named `worker.js`.
20
18
 
21
19
  ```ts
22
20
  import { defineUniverCollaborationRuntimeWorker } from "@univer-cli/univer-collaboration-runtime-pool";
21
+ import { loadSheetRuntime } from "./sheet-runtime.js";
23
22
 
24
23
  export default defineUniverCollaborationRuntimeWorker({
25
- async createRuntime(init) {
26
- return createRuntimeFromApplicationInit(init);
24
+ createRuntime({ unitId }: { unitId: string }) {
25
+ return loadSheetRuntime(unitId);
27
26
  },
28
27
  });
29
28
  ```
30
29
 
31
- Initialization data must be compatible with structured clone. The worker can read credentials directly from the environment or secure storage, avoiding the need to route remote Snapshots, changesets, and blocks through a daemon or parent process.
30
+ ## Reuse a runtime across tool calls
31
+
32
+ An application can share one pool across tool calls. Each call acquires a lease by key and releases it when finished. A later call using the same key can continue working with the loaded Unit as long as its runtime is still cached.
32
33
 
33
- ## Use pool
34
+ Agents are a typical example. Suppose a user asks, “If A1 is less than 40, add 10.” An agent might call a tool to read A1, get `32`, then call a tool to write `42`. Using the same workbook key lets both calls reuse its runtime.
34
35
 
35
36
  ```ts
36
37
  import { createUniverCollaborationRuntimePool } from "@univer-cli/univer-collaboration-runtime-pool";
@@ -39,37 +40,50 @@ const pool = createUniverCollaborationRuntimePool({
39
40
  entry: new URL("./worker.js", import.meta.url),
40
41
  });
41
42
 
42
- const lease = await pool.acquire({
43
- key: "server-a:book-1:sheet",
44
- init: { unitId: "book-1", unitType: "sheet" },
45
- });
46
-
47
- try {
48
- await lease.pull();
49
- const result = await lease.execute({ mode: "read", code: "return workbook.getId();" });
50
- console.log(result.value);
51
- } catch (error) {
52
- await lease.invalidate();
53
- throw error;
54
- } finally {
55
- await lease.release();
43
+ const unitId = "book-1";
44
+ const target = { key: unitId, init: { unitId } };
45
+
46
+ // First tool call: read A1.
47
+ const readLease = await pool.acquire(target);
48
+ const { value } = await readLease
49
+ .execute({
50
+ mode: "read",
51
+ code: 'return univerAPI.getActiveWorkbook().getActiveSheet().getRange("A1").getValue();',
52
+ })
53
+ .finally(() => readLease.release());
54
+
55
+ // The agent decides what to do with the result. For example, reading 32 leads to a second call to write 42.
56
+ if (typeof value === "number" && value < 40) {
57
+ const writeLease = await pool.acquire(target);
58
+ try {
59
+ await writeLease.execute({
60
+ mode: "write",
61
+ code: `univerAPI.getActiveWorkbook().getActiveSheet().getRange("A1").setValue(${value + 10});`,
62
+ });
63
+ const result = await writeLease.commit();
64
+ console.log(result.status);
65
+ } finally {
66
+ await writeLease.release();
67
+ }
56
68
  }
57
-
58
- await pool.close();
59
69
  ```
60
70
 
61
- The lease proxies the collaboration runtime's complete public interface, so callers do not need to design RPC methods.
71
+ Call `pool.close()` at application shutdown.
62
72
 
63
- ## Pool behavior
73
+ This example assumes workbook IDs are unique within your data source. If your application can access multiple servers or multiple worktrees of a document, include that information in the `key`. Requests for the same key receive leases in order. The pool uses `init` only when creating or reloading a runtime, and its contents must support structured clone.
64
74
 
65
- Creation for a key is single-flight, and leases for the same key are granted in FIFO order. Idle runtimes can be evicted by TTL and LRU; idle eviction never interrupts an active lease. Invalidation marks a worker/runtime as untrustworthy, so it is destroyed during release. For invalidation, TTL, and LRU eviction, `destroy-start` is emitted synchronously before worker destruction starts; generation-specific state should be discarded then rather than waiting for the later `evicted` event. Pool events can feed logs and metrics.
75
+ ## Edit and save
66
76
 
67
- The application defines both key and initialization data. The pool knows nothing about Workspace, Worktree, URLs, authentication, or target-to-key algorithms, and does not verify whether two initialization values for the same key are semantically compatible.
77
+ Call `lease.pull()` when you need to synchronize remote changes. After editing with `lease.execute({ mode: "write", code })`, call `lease.commit()` and check the returned status before releasing the lease. Pending edits live in runtime memory until committed. To discard the entire runtime, call `lease.invalidate()`. See the [collaboration runtime](../univer-collaboration-runtime/README.md) for synchronization, commit results, and conflict handling.
68
78
 
69
- ## Mutation transport
79
+ ## Capacity and process isolation
70
80
 
71
- Mutation replacements transferred across workers preserve the collaboration runtime's structured contract. Values unsupported by structured clone fail at the boundary. Business logic should not depend on the internal worker protocol or serialization format.
81
+ The defaults let multiple tasks share a group of workers. Adjust these options for the number of documents you access, the memory available, and the process isolation you need.
72
82
 
73
- ## Responsibility boundaries
83
+ | Option | Default | When to adjust |
84
+ | ------------------- | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
85
+ | `cache.maxEntries` | `50` | Limits the total number of resident runtimes. A full pool evicts the least recently used idle runtime. When all entries are in use or loading, acquiring a new key returns a capacity error. |
86
+ | `cache.idleTtlMs` | `300_000` (5 minutes) | Shorten this to free memory sooner after a task finishes, or lengthen it to reuse loaded documents between visits. |
87
+ | `maxUnitsPerWorker` | `10` | Increase this to spread process overhead across more Units. Set it to `1` when each Unit needs a dedicated process. |
74
88
 
75
- The package owns worker lifecycle, runtime proxies, leases, and caching. It does not define daemon methods, Commander commands, backends, or remote data-loading workflows.
89
+ If a worker crashes or an operation times out, all Units in that worker lose their in-memory state, including pending edits. Other workers continue serving their Units.
package/README.zh-CN.md CHANGED
@@ -2,11 +2,7 @@
2
2
 
3
3
  [English](./README.md) | 简体中文
4
4
 
5
- 在独立 worker process 中按 application-owned opaque key 创建、独占租用、缓存和回收
6
- `UniverCollaborationRuntime`。
7
-
8
- 它适合多个短任务复用昂贵 runtime,同时把 Univer 与 native/runtime 状态隔离在 worker 中。若只需要当前进程内的
9
- 单个 runtime,直接使用 `@univer-cli/univer-collaboration-runtime`。
5
+ 如果你的应用需要反复读取或编辑同一个 Univer 文档,可以用这个包在多个任务之间复用已加载的协同 runtime。每个 Unit 拥有独立的 Univer 实例和协同状态,多个 Unit 可以共享一个 Node.js worker 进程。只需在当前进程处理单个 Unit 时,可以直接使用 [collaboration runtime](../univer-collaboration-runtime/README.zh-CN.md)。
10
6
 
11
7
  ## 安装
12
8
 
@@ -14,26 +10,28 @@
14
10
  pnpm add @univer-cli/univer-collaboration-runtime-pool
15
11
  ```
16
12
 
17
- 要求 Node.js 22.12 或更高版本。Worker entry 必须是构建后的 JavaScript ESM 文件,不能指向 TypeScript source。
13
+ 要求 Node.js 22.12 或更高版本。应用负责提供 backend、凭证和 Univer factory,pool 负责在 worker 中创建、复用和释放 runtime。
18
14
 
19
- ## Worker entry
15
+ ## 准备 worker 入口
20
16
 
21
- Worker 在 runtime 所在进程创建 backend、读取凭证并构造 Univer:
17
+ 先准备 worker 入口。在这个 Sheet 示例中,`loadSheetRuntime(unitId)` 由应用提供,用配置好的 backend 和独立的 Univer 实例为指定工作簿创建协同 runtime。将入口构建为 JavaScript ESM 文件 `worker.js`。
22
18
 
23
19
  ```ts
24
20
  import { defineUniverCollaborationRuntimeWorker } from "@univer-cli/univer-collaboration-runtime-pool";
21
+ import { loadSheetRuntime } from "./sheet-runtime.js";
25
22
 
26
23
  export default defineUniverCollaborationRuntimeWorker({
27
- async createRuntime(init) {
28
- return createRuntimeFromApplicationInit(init);
24
+ createRuntime({ unitId }: { unitId: string }) {
25
+ return loadSheetRuntime(unitId);
29
26
  },
30
27
  });
31
28
  ```
32
29
 
33
- Init 必须是 structured-clone compatible value。凭证也可以由 worker 自己从环境或安全存储读取,避免经过 daemon
34
- 或 parent process 转发远端 Snapshot、changeset 与 block。
30
+ ## 在多次工具调用之间复用 runtime
31
+
32
+ 应用可以为多个工具调用共用一个 pool。每次调用按 key 获取 lease,完成后归还。后续调用使用同一个 key 时,只要 runtime 仍在缓存中,就可以继续操作已加载的 Unit。
35
33
 
36
- ## 使用 pool
34
+ Agent 是典型场景。例如,用户要求“如果 A1 小于 40,就加 10”。Agent 可能先调用工具读取 A1,得到 `32`,再调用工具写入 `42`。两次调用使用同一个工作簿的 key,即可复用它的 runtime。
37
35
 
38
36
  ```ts
39
37
  import { createUniverCollaborationRuntimePool } from "@univer-cli/univer-collaboration-runtime-pool";
@@ -42,43 +40,50 @@ const pool = createUniverCollaborationRuntimePool({
42
40
  entry: new URL("./worker.js", import.meta.url),
43
41
  });
44
42
 
45
- const lease = await pool.acquire({
46
- key: "server-a:book-1:sheet",
47
- init: { unitId: "book-1", unitType: "sheet" },
48
- });
49
-
50
- try {
51
- await lease.pull();
52
- const result = await lease.execute({ mode: "read", code: "return workbook.getId();" });
53
- console.log(result.value);
54
- } catch (error) {
55
- await lease.invalidate();
56
- throw error;
57
- } finally {
58
- await lease.release();
43
+ const unitId = "book-1";
44
+ const target = { key: unitId, init: { unitId } };
45
+
46
+ // 第一次工具调用:读取 A1。
47
+ const readLease = await pool.acquire(target);
48
+ const { value } = await readLease
49
+ .execute({
50
+ mode: "read",
51
+ code: 'return univerAPI.getActiveWorkbook().getActiveSheet().getRange("A1").getValue();',
52
+ })
53
+ .finally(() => readLease.release());
54
+
55
+ // Agent 根据读数决定下一步。例如,读到 32 时,再调用工具写入 42。
56
+ if (typeof value === "number" && value < 40) {
57
+ const writeLease = await pool.acquire(target);
58
+ try {
59
+ await writeLease.execute({
60
+ mode: "write",
61
+ code: `univerAPI.getActiveWorkbook().getActiveSheet().getRange("A1").setValue(${value + 10});`,
62
+ });
63
+ const result = await writeLease.commit();
64
+ console.log(result.status);
65
+ } finally {
66
+ await writeLease.release();
67
+ }
59
68
  }
60
-
61
- await pool.close();
62
69
  ```
63
70
 
64
- Lease 代理 collaboration runtime 的完整 public interface;调用方不需要设计 RPC method。
71
+ 应用退出时调用 `pool.close()`。
65
72
 
66
- ## Pool 行为
73
+ 示例假设工作簿 ID 在应用的数据源中唯一。如果应用可以访问多个服务或同一文档的多个 worktree,请将这些信息也纳入 `key`。相同 key 的请求按顺序取得 lease。只有创建或重新加载 runtime 时才会使用 `init`,其内容须支持 structured clone。
67
74
 
68
- 同一个 key 使用 single-flight 创建和 FIFO lease;idle runtime 可按 TTL 与 LRU 回收。Active lease 不会被 idle
69
- eviction 中断。Invalidate 表示 worker/runtime 已不可信,会在 release 时销毁。Invalidate、TTL 与 LRU eviction 会在
70
- worker 销毁开始前同步发出 `destroy-start`;与该 generation 绑定的状态应在此清理,不要等待随后发出的 `evicted`。
71
- Pool event 可用于日志和 metrics。
75
+ ## 编辑与保存
72
76
 
73
- Key 与 init 完全由 application 定义。Pool 不知道 Workspace、Worktree、URL、认证或 target-to-key 算法,也不会
74
- 验证相同 key 的两次 init 是否语义兼容。
77
+ 需要同步远端更改时调用 `lease.pull()`。用 `lease.execute({ mode: "write", code })` 编辑后,调用 `lease.commit()` 并检查返回状态,再归还 lease。未提交的修改只保留在 runtime 内存中,归还 lease 时不会自动保存。如果要丢弃整个 runtime,调用 `lease.invalidate()`。同步、提交和冲突处理的完整语义见 [collaboration runtime](../univer-collaboration-runtime/README.zh-CN.md)。
75
78
 
76
- ## Mutation replacement
79
+ ## 容量与进程隔离
77
80
 
78
- 跨 worker 传输的 mutation replacement 保留 collaboration runtime 的结构化合同;不支持 structured clone 的值
79
- 会在边界失败。业务层不应依赖 worker protocol 或序列化内部格式。
81
+ 默认配置适合让多个任务共享一组 worker。可以根据同时访问的文档数、可用内存和进程隔离需求调整这些选项。
80
82
 
81
- ## 职责边界
83
+ | 选项 | 默认值 | 何时调整 |
84
+ | ------------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
85
+ | `cache.maxEntries` | `50` | 控制整个 pool 可驻留的 runtime 总数。容量已满时优先回收最久未使用的空闲 runtime。全部在用或正在加载时,申请新 key 会返回容量错误。 |
86
+ | `cache.idleTtlMs` | `300_000`(5 分钟) | 希望任务结束后更快释放内存时缩短。希望下次访问时复用已加载文档时延长。 |
87
+ | `maxUnitsPerWorker` | `10` | 调高可让更多 Unit 分摊进程开销。需要每个 Unit 独占进程时设为 `1`。 |
82
88
 
83
- Package 拥有 worker lifecycle、runtime proxy、lease 与 cache;不定义 daemon method、Commander command、
84
- backend 或远程数据加载流程。
89
+ worker 崩溃或操作超时时,其中所有 Unit 都会失去内存状态,包括待提交的修改。其他 worker 可以继续服务。
package/dist/index.d.ts CHANGED
@@ -34,7 +34,7 @@ interface UniverCollaborationRuntimeLease {
34
34
  exportUnitData(): Promise<CollaborationUnitData$1>;
35
35
  /** Releases the current runtime for reuse. */
36
36
  release(): Promise<void>;
37
- /** Permanently removes this runtime and its worker from the pool. */
37
+ /** Ends the lease and permanently removes its runtime from the pool. */
38
38
  invalidate(): Promise<void>;
39
39
  }
40
40
  interface UniverCollaborationRuntimePool<TInit = unknown> {
@@ -71,9 +71,12 @@ type UniverCollaborationRuntimePoolEvent = {
71
71
  readonly type: "instance-failed";
72
72
  };
73
73
  interface UniverCollaborationRuntimePoolOptions {
74
+ /** Cache policy for this pool. maxEntries defaults to 50. */
74
75
  readonly cache?: InstancePoolCacheOptions;
75
76
  readonly entry: string | URL;
76
77
  readonly env?: NodeJS.ProcessEnv;
78
+ /** Maximum resident Unit runtimes per child process. Defaults to 10. */
79
+ readonly maxUnitsPerWorker?: number;
77
80
  readonly onEvent?: (event: UniverCollaborationRuntimePoolEvent) => void;
78
81
  readonly openTimeoutMs?: number;
79
82
  readonly operationTimeoutMs?: number;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- const _0x3e1b99=_0x2138;(function(_0x1dd729,_0x2809bf){const _0x25bf09=_0x2138,_0x4d69b2=_0x1dd729();while(!![]){try{const _0x7a90e6=-parseInt(_0x25bf09(0xdb))/0x1+-parseInt(_0x25bf09(0xa6))/0x2*(parseInt(_0x25bf09(0xe5))/0x3)+-parseInt(_0x25bf09(0xab))/0x4+parseInt(_0x25bf09(0xd0))/0x5+-parseInt(_0x25bf09(0x98))/0x6+parseInt(_0x25bf09(0x10c))/0x7+-parseInt(_0x25bf09(0x10b))/0x8*(-parseInt(_0x25bf09(0xaf))/0x9);if(_0x7a90e6===_0x2809bf)break;else _0x4d69b2['push'](_0x4d69b2['shift']());}catch(_0x1e0ffb){_0x4d69b2['push'](_0x4d69b2['shift']());}}}(_0x2822,0x7532e));import{InstancePoolError as _0x3afe5a,createGenericKeyedInstancePool as _0xea6852}from'@univer-cli/generic-keyed-instance-pool';import{fork as _0x4eed7a}from'node:child_process';import{dirname as _0x2fdcd5,extname as _0xc0453f,join as _0x2fed0b}from'node:path';import{fileURLToPath as _0x2a681c}from'node:url';var s=class extends Error{[_0x3e1b99(0xdc)];['invalidatesInstance'];constructor(_0x496037,_0xd96762,_0x57f81d={}){const _0x3f1f13=_0x3e1b99;super(_0xd96762,_0x57f81d),this[_0x3f1f13(0x9c)]=_0x3f1f13(0xfb),this[_0x3f1f13(0xdc)]=_0x496037,this[_0x3f1f13(0xeb)]=_0x57f81d['invalidatesInstance']??!0x1;}},c=_0x3e1b99(0xd9);function l(_0x23a69d){const _0x529264=_0x3e1b99;return _0x23a69d instanceof Error&&_0x23a69d['name']===_0x529264(0xd9)&&_0x529264(0xdc)in _0x23a69d&&typeof _0x23a69d['code']==_0x529264(0xca);}async function u(_0x427dd7){const _0x4f1deb=_0x3e1b99;let _0x32e38a=_0x2a681c(import.meta.url),_0x431251=_0x2fdcd5(_0x32e38a),_0x5040b9=_0x2fed0b(_0x431251,_0xc0453f(_0x32e38a)===_0x4f1deb(0xf0)?_0x4f1deb(0x91):_0x4f1deb(0xbd)),_0x1297ed=d(_0x4eed7a(_0x5040b9,[],{..._0x427dd7['env']===void 0x0?{}:{'env':_0x427dd7[_0x4f1deb(0xfe)]},'serialization':_0x4f1deb(0xbe),'stdio':[_0x4f1deb(0x109),_0x4f1deb(0x109),_0x4f1deb(0x109),_0x4f1deb(0xf5)]}),_0x427dd7[_0x4f1deb(0xcc)]);try{let _0x1182e1=f(await _0x1297ed[_0x4f1deb(0x8a)]({'entry':_0x427dd7[_0x4f1deb(0xf6)],'id':_0x1297ed[_0x4f1deb(0x7f)](),'init':_0x427dd7[_0x4f1deb(0x8d)],'type':'open'},_0x427dd7[_0x4f1deb(0xb4)],_0x4f1deb(0xc1))),_0x446d90,_0x4864f8=async _0x52d032=>await _0x1297ed['request']({..._0x52d032,'id':_0x1297ed[_0x4f1deb(0x7f)]()},_0x427dd7[_0x4f1deb(0xe9)]);return{..._0x1182e1,async 'close'(){const _0x28e4c1=_0x4f1deb;_0x446d90??=_0x1297ed[_0x28e4c1(0xaa)](),await _0x446d90;},async 'getState'(){const _0xead9ce=_0x4f1deb;return p(await _0x4864f8({'type':_0xead9ce(0xef)}));},async 'getPendingMutations'(){const _0x15e76e=_0x4f1deb;let _0x30ca65=await _0x4864f8({'type':_0x15e76e(0xbc)});if(!w(_0x30ca65))throw v(_0x15e76e(0xc7));return _0x30ca65;},async 'executeReadCode'(_0x3dedf3){const _0x2c468a=_0x4f1deb;let _0x2fd700=m(await _0x4864f8({'code':_0x3dedf3,'type':_0x2c468a(0xc9)}));if(!('value'in _0x2fd700)||!T(_0x2fd700['value']))throw v('Worker\x20returned\x20an\x20invalid\x20read\x20value');return _0x2fd700;},async 'executeWriteCode'(_0x334f5d){const _0xabc308=_0x4f1deb;let _0x3390f3=m(await _0x4864f8({'code':_0x334f5d,'type':_0xabc308(0x86)}));if(!T(_0x3390f3[_0xabc308(0xa1)])||!w(_0x3390f3[_0xabc308(0xb7)]))throw v(_0xabc308(0x84));return _0x3390f3;},async 'replacePendingMutations'(_0x1b0942){const _0x4c0a1e=_0x4f1deb;let _0x15737c=m(await _0x4864f8({'mutations':_0x1b0942,'type':'replace-mutations'}));if(!E(_0x15737c['previousMutationCount'])||!E(_0x15737c[_0x4c0a1e(0xe4)]))throw v('Worker\x20returned\x20an\x20invalid\x20mutation\x20replacement\x20result');return _0x15737c;},async 'fetch'(){const _0x1a5b5f=_0x4f1deb;return h(await _0x4864f8({'type':'fetch'}),['unchanged',_0x1a5b5f(0xf2)]);},async 'pull'(){const _0x2c6ff9=_0x4f1deb;return h(await _0x4864f8({'type':_0x2c6ff9(0xcb)}),['up-to-date',_0x2c6ff9(0xf3),_0x2c6ff9(0xd4)]);},async 'commit'(){const _0x37dd2b=_0x4f1deb;return h(await _0x4864f8({'type':_0x37dd2b(0xc0)}),[_0x37dd2b(0xa0),_0x37dd2b(0xd7),'confirmed','retry','unknown','conflict']);},async 'exportUnitData'(){const _0x56ce41=_0x4f1deb;let _0x1b2bb5=await _0x4864f8({'type':'export'});if(!D(_0x1b2bb5))throw v(_0x56ce41(0xd6));return _0x1b2bb5;}};}catch(_0xa40cf3){throw await _0x1297ed[_0x4f1deb(0xaa)](),_0xa40cf3;}}function d(_0x5a3874,_0x435fd8){const _0x1272c1=_0x3e1b99;let _0x50d0d5=new Map(),_0x40bbf6=0x0,_0x20bcb3,_0x576dc3=!0x1,_0x251364,_0x5d9305,_0x46767b=new Promise(_0x246bcc=>{_0x5d9305=_0x246bcc;});return _0x5a3874['on'](_0x1272c1(0xcd),_0xef8f93=>{const _0x30f3ad=_0x1272c1;if(!y(_0xef8f93))return;let _0x52e6b5=_0x50d0d5[_0x30f3ad(0xb9)](_0xef8f93['id']);_0x52e6b5&&(_0x50d0d5['delete'](_0xef8f93['id']),_0x52e6b5['timer']&&clearTimeout(_0x52e6b5[_0x30f3ad(0xfc)]),_0xef8f93[_0x30f3ad(0xe1)]===_0x30f3ad(0xd3)?_0x52e6b5['reject'](g(_0xef8f93[_0x30f3ad(0xd3)])):_0x52e6b5['resolve'](_0xef8f93[_0x30f3ad(0x88)]));}),_0x5a3874['on'](_0x1272c1(0xd3),_0x17c556=>_0x2f964b(_(_0x1272c1(0xc8)+_0x435fd8+'\x20failed:\x20'+_0x17c556['message'],_0x17c556))),_0x5a3874['on']('exit',(_0x5189a4,_0x428d08)=>{const _0x4c4b0a=_0x1272c1;_0x576dc3||_0x2f964b(_(_0x4c4b0a(0xc8)+_0x435fd8+_0x4c4b0a(0xc4)+(_0x428d08?'signal\x20'+_0x428d08:_0x4c4b0a(0xa2)+String(_0x5189a4))));}),_0x5a3874['on'](_0x1272c1(0xaa),()=>_0x5d9305()),{async 'close'(){if(_0x251364)return await _0x251364;_0x251364=_0x201499(),await _0x251364;},'nextId'(){return++_0x40bbf6;},async 'request'(_0x52b270,_0x5aabf3,_0x410b17=_0x1272c1(0xff)){if(_0x20bcb3)throw _0x20bcb3;return await new Promise((_0x5ae694,_0x190808)=>{const _0x5cd970=_0x2138;let _0x179c8e={'reject':_0x190808,'resolve':_0x5ae694,'timer':setTimeout(()=>{const _0x5e0c40=_0x2138;_0x2f964b(new s(_0x410b17,'Collaboration\x20worker\x20'+_0x435fd8+_0x5e0c40(0xda)+_0x5aabf3+'ms',{'invalidatesInstance':!0x0})),_0x3190c7();},_0x5aabf3)};_0x50d0d5[_0x5cd970(0xb0)](_0x52b270['id'],_0x179c8e),_0x5a3874['send'](_0x52b270,_0x15fc95=>{const _0x5e22dc=_0x5cd970;_0x15fc95&&_0x2f964b(_(_0x5e22dc(0xb3)+_0x435fd8,_0x15fc95));});});}};async function _0x201499(){const _0x1fe0b4=_0x1272c1;if(_0x576dc3=!0x0,!_0x20bcb3&&_0x5a3874[_0x1fe0b4(0xcf)])try{await Promise[_0x1fe0b4(0x105)]([new Promise((_0x1213f6,_0x5a3c89)=>{const _0xc9da46=_0x1fe0b4;let _0x7f805a=++_0x40bbf6;_0x50d0d5[_0xc9da46(0xb0)](_0x7f805a,{'reject':_0x5a3c89,'resolve':_0x1213f6}),_0x5a3874[_0xc9da46(0xad)]({'id':_0x7f805a,'type':_0xc9da46(0xaa)},_0x33f155=>{_0x33f155&&_0x5a3c89(_0x33f155);});}),new Promise((_0x205746,_0x42ac4c)=>{const _0x1b2346=_0x1fe0b4;setTimeout(()=>_0x42ac4c(Error('Worker\x20close\x20timed\x20out')),0x1388)[_0x1b2346(0xc6)]();})]);}catch{}_0x3190c7(),await _0x46767b,_0x2f964b(new s(_0x1fe0b4(0x93),_0x1fe0b4(0x8e)+_0x435fd8+_0x1fe0b4(0x8b),{'invalidatesInstance':!0x0}));}function _0x2f964b(_0x214600){const _0x3e867b=_0x1272c1;_0x20bcb3??=_0x214600;for(let _0x1c82b1 of _0x50d0d5['values']())_0x1c82b1[_0x3e867b(0xfc)]&&clearTimeout(_0x1c82b1[_0x3e867b(0xfc)]),_0x1c82b1[_0x3e867b(0xe8)](_0x20bcb3);_0x50d0d5[_0x3e867b(0xd5)]();}function _0x3190c7(){const _0x912eb3=_0x1272c1;_0x5a3874[_0x912eb3(0xdd)]===null&&_0x5a3874[_0x912eb3(0x103)]===null&&_0x5a3874[_0x912eb3(0xf8)](_0x912eb3(0xde));}}function f(_0x24d96d){const _0x22d89b=_0x3e1b99;if(!D(_0x24d96d)||typeof _0x24d96d[_0x22d89b(0x9b)]!=_0x22d89b(0xca)||!b(_0x24d96d[_0x22d89b(0xae)]))throw v('Worker\x20returned\x20invalid\x20collaboration\x20runtime\x20metadata');return{'unitId':_0x24d96d[_0x22d89b(0x9b)],'unitType':_0x24d96d[_0x22d89b(0xae)]};}function p(_0x3433f6){const _0x8f1a17=_0x3e1b99;if(!D(_0x3433f6)||!x(_0x3433f6[_0x8f1a17(0xce)])||!E(_0x3433f6['baseRevision'])||!E(_0x3433f6[_0x8f1a17(0x89)])||Number(_0x3433f6[_0x8f1a17(0x89)])<Number(_0x3433f6[_0x8f1a17(0xb1)])||!E(_0x3433f6[_0x8f1a17(0xe4)])||!E(_0x3433f6[_0x8f1a17(0xd2)])||!S(_0x3433f6[_0x8f1a17(0x80)])||!C(_0x3433f6[_0x8f1a17(0xd4)]))throw v('Worker\x20returned\x20invalid\x20collaboration\x20runtime\x20state');return _0x3433f6;}function m(_0x158615){const _0x59b895=_0x3e1b99;if(!D(_0x158615))throw v('Worker\x20returned\x20an\x20invalid\x20operation\x20result');return{..._0x158615,'state':p(_0x158615[_0x59b895(0x108)])};}function h(_0x3cfd7f,_0x3853f0){const _0x479370=_0x3e1b99;let _0x1b47a5=m(_0x3cfd7f);if(typeof _0x1b47a5['status']!=_0x479370(0xca)||!_0x3853f0[_0x479370(0xa9)](_0x1b47a5['status']))throw v(_0x479370(0xee));return _0x1b47a5;}function g(_0x3dfbe2){const _0xa7d8dc=_0x3e1b99;let _0x226c2f=Error(_0x3dfbe2['message']);return _0x3dfbe2['code']?.[_0xa7d8dc(0x9a)](_0xa7d8dc(0xb2))&&!_0x3dfbe2[_0xa7d8dc(0xdc)][_0xa7d8dc(0x9a)](_0xa7d8dc(0x8f))?(_0x226c2f[_0xa7d8dc(0x9c)]=c,Object[_0xa7d8dc(0xa8)](_0x226c2f,{'code':_0x3dfbe2['code'],'retryable':_0x3dfbe2[_0xa7d8dc(0x82)]??!0x1})):(_0x226c2f[_0xa7d8dc(0x9c)]=_0x3dfbe2[_0xa7d8dc(0x9c)],_0x3dfbe2[_0xa7d8dc(0xdc)]!==void 0x0&&Object['assign'](_0x226c2f,{'code':_0x3dfbe2['code']})),_0x3dfbe2[_0xa7d8dc(0xeb)]&&Object['assign'](_0x226c2f,{'invalidatesInstance':!0x0}),_0x3dfbe2[_0xa7d8dc(0xbb)]!==void 0x0&&(_0x226c2f[_0xa7d8dc(0xbb)]=_0x3dfbe2[_0xa7d8dc(0xbb)]),_0x226c2f;}function _(_0x276daa,_0xb4ca5f){const _0x54e313=_0x3e1b99;return new s(_0x54e313(0xf4),_0x276daa,{..._0xb4ca5f===void 0x0?{}:{'cause':_0xb4ca5f},'invalidatesInstance':!0x0});}function v(_0x46c2f2){const _0x19444a=_0x3e1b99;return new s(_0x19444a(0xed),_0x46c2f2,{'invalidatesInstance':!0x0});}function y(_0x58c8cf){const _0x167dcb=_0x3e1b99;return D(_0x58c8cf)&&Number[_0x167dcb(0x106)](_0x58c8cf['id'])&&(_0x58c8cf['type']===_0x167dcb(0x88)||_0x58c8cf[_0x167dcb(0xe1)]===_0x167dcb(0xd3));}function b(_0x21809c){return _0x21809c===0x1||_0x21809c===0x2||_0x21809c===0x3||_0x21809c===0x5||_0x21809c===0x6||_0x21809c===0x7;}function x(_0x162ef8){const _0x2d1de4=_0x3e1b99;return _0x162ef8==='online'||_0x162ef8===_0x2d1de4(0xc2)||_0x162ef8===_0x2d1de4(0x94)||_0x162ef8===_0x2d1de4(0xdf);}function S(_0x5b49d6){const _0x3d372d=_0x3e1b99;return _0x5b49d6===null||D(_0x5b49d6)&&E(_0x5b49d6[_0x3d372d(0xb1)])&&E(_0x5b49d6[_0x3d372d(0x8c)])&&E(_0x5b49d6[_0x3d372d(0xea)])&&(_0x5b49d6[_0x3d372d(0x85)]===void 0x0||typeof _0x5b49d6['sid']=='string')&&(_0x5b49d6[_0x3d372d(0x104)]===void 0x0||E(_0x5b49d6[_0x3d372d(0x104)]));}function _0x2822(){const _0x31e381=['timer','isFinite','env','COLLABORATION_WORKER_OPERATION_TIMEOUT','instance-failed','COLLABORATION_LEASE_CLOSED','UNKNOWN','signalCode','reqId','race','isSafeInteger','COLLABORATION_PROTOCOL_ERROR','state','ignore','object','8TEUcnr','4665234eEwsQZ','nextId','awaitingChangeset','number','retryable','boolean','Worker\x20returned\x20an\x20invalid\x20write\x20result','sid','execute-write','onEvent','result','knownHeadRevision','request','\x20is\x20closed','revision','init','Collaboration\x20worker\x20','COLLABORATION_WORKER_','COLLABORATION_POOL_CLOSED','worker-child.ts','pending-mutations','COLLABORATION_WORKER_CLOSED','offline','Collaboration\x20runtime\x20lease\x20','exportUnitData','mode','4311360lesyNg','permission-rejected','startsWith','unitId','name','COLLABORATION_POOL_INVALID_INPUT','invalidate','executeWriteCode','nothing-to-commit','value','exit\x20code\x20','reason','isArray','entry\x20must\x20be\x20an\x20absolute\x20file\x20URL\x20or\x20another\x20importable\x20URL','8fxJKDJ','href','assign','includes','close','2221308xhnnFt','entry\x20must\x20not\x20be\x20empty','send','unitType','15607602JKgmiC','set','baseRevision','COLLABORATION_','Failed\x20to\x20send\x20a\x20request\x20to\x20worker\x20','openTimeoutMs','export','fetch','mutations','getPendingMutations','get','changeset-rejected','stack','get-pending-mutations','worker-child.mjs','advanced','values','commit','COLLABORATION_WORKER_OPEN_TIMEOUT','reconnecting','isInteger','\x20exited\x20unexpectedly\x20with\x20','read','unref','Worker\x20returned\x20invalid\x20pending\x20mutations','Worker\x20','execute-read','string','pull','key','message','connection','connected','82565yVReBG','every','bufferedChangesetCount','error','conflict','clear','Worker\x20returned\x20invalid\x20UnitData','pull-required','release','CollaborationRuntimeError','\x20timed\x20out\x20after\x20','425656hVimUb','code','exitCode','SIGKILL','closed','now','type','length','instance','pendingMutationCount','178173wjsPfm','operation','INSTANCE_POOL_CLOSED','reject','operationTimeoutMs','mutationCount','invalidatesInstance','data','COLLABORATION_WORKER_PROTOCOL_ERROR','Worker\x20returned\x20an\x20invalid\x20operation\x20status','get-state','.ts','\x20must\x20be\x20a\x20finite\x20positive\x20number','fetched','pulled','COLLABORATION_WORKER_CRASHED','ipc','entry','replacePendingMutations','kill','COLLABORATION_LOAD_FAILED','executeReadCode','UniverCollaborationRuntimePoolError'];_0x2822=function(){return _0x31e381;};return _0x2822();}function C(_0x4e5fc8){const _0x75c4aa=_0x3e1b99;return _0x4e5fc8===null||D(_0x4e5fc8)&&(_0x4e5fc8[_0x75c4aa(0xe6)]===_0x75c4aa(0xcb)||_0x4e5fc8[_0x75c4aa(0xe6)]===_0x75c4aa(0xc0))&&(_0x4e5fc8[_0x75c4aa(0xa3)]==='transform-failed'||_0x4e5fc8[_0x75c4aa(0xa3)]===_0x75c4aa(0xba)||_0x4e5fc8[_0x75c4aa(0xa3)]===_0x75c4aa(0x99))&&typeof _0x4e5fc8['message']==_0x75c4aa(0xca)&&(_0x4e5fc8[_0x75c4aa(0xdc)]===void 0x0||Number[_0x75c4aa(0xc3)](_0x4e5fc8[_0x75c4aa(0xdc)]));}function w(_0x23e46c){const _0x4d381b=_0x3e1b99;return Array[_0x4d381b(0xa4)](_0x23e46c)&&_0x23e46c['every'](_0x1eb2f8=>D(_0x1eb2f8)&&typeof _0x1eb2f8['id']==_0x4d381b(0xca)&&_0x1eb2f8['id'][_0x4d381b(0xe2)]>0x0&&typeof _0x1eb2f8[_0x4d381b(0xec)]==_0x4d381b(0xca));}function _0x2138(_0x2d92ed,_0x483f9a){_0x2d92ed=_0x2d92ed-0x7f;const _0x2822de=_0x2822();let _0x213875=_0x2822de[_0x2d92ed];return _0x213875;}function T(_0x274e6e){const _0x8bac7d=_0x3e1b99;return _0x274e6e===null||typeof _0x274e6e==_0x8bac7d(0x83)||typeof _0x274e6e==_0x8bac7d(0xca)||typeof _0x274e6e==_0x8bac7d(0x81)&&Number[_0x8bac7d(0xfd)](_0x274e6e)?!0x0:Array[_0x8bac7d(0xa4)](_0x274e6e)?_0x274e6e[_0x8bac7d(0xd1)](T):D(_0x274e6e)&&Object[_0x8bac7d(0xbf)](_0x274e6e)[_0x8bac7d(0xd1)](T);}function E(_0x3c4ff7){const _0x46d5e1=_0x3e1b99;return Number[_0x46d5e1(0x106)](_0x3c4ff7)&&Number(_0x3c4ff7)>=0x0;}function D(_0x3d5851){const _0x333a7f=_0x3e1b99;return typeof _0x3d5851=='object'&&!!_0x3d5851&&!Array[_0x333a7f(0xa4)](_0x3d5851);}var O=0x7530,k=0x7530;function A(_0xe0d4a7){const _0x5509db=_0x3e1b99;let _0x3cf753=j(_0xe0d4a7[_0x5509db(0xf6)]),_0x251599=_0xe0d4a7[_0x5509db(0xb4)]??O,_0x2e9c3f=_0xe0d4a7['operationTimeoutMs']??k;M(_0x251599,'openTimeoutMs'),M(_0x2e9c3f,_0x5509db(0xe9));let _0x4daba5;try{_0x4daba5=_0xea6852({'factory':{async 'create'(_0x4e1031){const _0x290708=_0x5509db;return await u({'entry':_0x3cf753,..._0xe0d4a7[_0x290708(0xfe)]===void 0x0?{}:{'env':_0xe0d4a7[_0x290708(0xfe)]},'init':_0x4e1031[_0x290708(0x8d)],'key':_0x4e1031['key'],'openTimeoutMs':_0x251599,'operationTimeoutMs':_0x2e9c3f});},async 'destroy'({instance:_0x3e6657}){await _0x3e6657['close']();}},..._0xe0d4a7['cache']===void 0x0?{}:{'cache':_0xe0d4a7['cache']},'onEvent':_0x4df4e6});}catch(_0xc5b6c2){throw N(_0xc5b6c2);}return{async 'acquire'(_0x3888b6){let _0x4cd335;try{_0x4cd335=await _0x4daba5['acquire'](_0x3888b6);}catch(_0x5a60cc){throw N(_0x5a60cc);}return _0x124ae9(_0x4cd335);},async 'close'(){const _0x1fbe52=_0x5509db;try{await _0x4daba5[_0x1fbe52(0xaa)]();}catch(_0x477034){throw N(_0x477034);}}};function _0x124ae9(_0x281262){const _0x41dbe2=_0x5509db;let _0x50bbd2=_0x281262[_0x41dbe2(0xe3)],_0x4e7e97=!0x1,_0x3a13e1,_0x2e1f07=!0x1;return{'key':_0x281262[_0x41dbe2(0xcc)],'unitId':_0x50bbd2[_0x41dbe2(0x9b)],'unitType':_0x50bbd2['unitType'],async 'getState'(){return await _0x3d97db('state',async()=>await _0x50bbd2['getState']());},async 'getPendingMutations'(){const _0x3ceac1=_0x41dbe2;return await _0x3d97db(_0x3ceac1(0x92),async()=>await _0x50bbd2[_0x3ceac1(0xb8)]());},async 'execute'(_0xfdf3e1){const _0x2911ad=_0x41dbe2;return _0xfdf3e1[_0x2911ad(0x97)]==='read'?await _0x3d97db(_0x2911ad(0xc5),async()=>await _0x50bbd2[_0x2911ad(0xfa)](_0xfdf3e1[_0x2911ad(0xdc)])):await _0x3d97db('write',async()=>await _0x50bbd2[_0x2911ad(0x9f)](_0xfdf3e1[_0x2911ad(0xdc)]));},async 'replacePendingMutations'(_0x1b616b){const _0x401563=_0x41dbe2;return await _0x3d97db('replace-mutations',async()=>await _0x50bbd2[_0x401563(0xf7)](_0x1b616b));},async 'fetch'(){const _0x492d76=_0x41dbe2;return await _0x3d97db(_0x492d76(0xb6),async()=>await _0x50bbd2[_0x492d76(0xb6)]());},async 'pull'(){return await _0x3d97db('pull',async()=>await _0x50bbd2['pull']());},async 'commit'(){const _0x2bcc1f=_0x41dbe2;return await _0x3d97db(_0x2bcc1f(0xc0),async()=>await _0x50bbd2[_0x2bcc1f(0xc0)]());},async 'exportUnitData'(){const _0x2d9561=_0x41dbe2;return await _0x3d97db(_0x2d9561(0xb5),async()=>await _0x50bbd2[_0x2d9561(0x96)]());},async 'invalidate'(){_0x4e7e97||(_0x4e7e97=!0x0,await _0x281262['invalidate']());},async 'release'(){const _0x4721d9=_0x41dbe2;_0x4e7e97||(_0x4e7e97=!0x0,_0x2e1f07?await _0x281262[_0x4721d9(0x9e)]():await _0x281262[_0x4721d9(0xd8)]());}};async function _0x3d97db(_0x4627f2,_0x1238f1){const _0x1d5100=_0x41dbe2;_0x4003fe();try{return await _0x3ccd44(_0x281262[_0x1d5100(0xcc)],_0x4627f2,_0x1238f1);}catch(_0x2d18b7){throw _0x59cabb(_0x2d18b7),_0x2d18b7;}}function _0x4003fe(){const _0x5d46f6=_0x41dbe2;if(_0x4e7e97)throw new s(_0x5d46f6(0x101),_0x5d46f6(0x95)+_0x281262[_0x5d46f6(0xcc)]+_0x5d46f6(0x8b));if(_0x3a13e1)throw _0x3a13e1;}function _0x59cabb(_0x354e6e){const _0x2ed9c5=_0x41dbe2;(_0x354e6e instanceof s&&_0x354e6e[_0x2ed9c5(0xeb)]||l(_0x354e6e)&&(_0x354e6e[_0x2ed9c5(0xdc)]===_0x2ed9c5(0x107)||_0x354e6e[_0x2ed9c5(0xdc)]==='COLLABORATION_CLOSED'||_0x354e6e[_0x2ed9c5(0xdc)]===_0x2ed9c5(0xf9))||typeof _0x354e6e==_0x2ed9c5(0x10a)&&_0x354e6e&&'invalidatesInstance'in _0x354e6e&&_0x354e6e[_0x2ed9c5(0xeb)]===!0x0)&&(_0x2e1f07=!0x0,_0x3a13e1=_0x354e6e,_0x946064({'errorCode':P(_0x354e6e),'key':_0x281262[_0x2ed9c5(0xcc)],'type':_0x2ed9c5(0x100)}));}}async function _0x3ccd44(_0x56326d,_0x3618a1,_0xd576f){const _0x16c17d=_0x5509db;let _0x5ccdfd=Date[_0x16c17d(0xe0)](),_0x486c03=await _0xd576f();return _0x946064({'durationMs':Date[_0x16c17d(0xe0)]()-_0x5ccdfd,'key':_0x56326d,'operation':_0x3618a1,'type':'operation-complete'}),_0x486c03;}function _0x4df4e6(_0x3b24fb){_0x946064(_0x3b24fb);}function _0x946064(_0x1be79a){const _0x2d66c6=_0x5509db;try{_0xe0d4a7[_0x2d66c6(0x87)]?.(_0x1be79a);}catch{}}}function j(_0x2d08e3){const _0x64210d=_0x3e1b99;let _0xb37e72=_0x2d08e3 instanceof URL?_0x2d08e3['href']:_0x2d08e3;if(_0xb37e72['length']===0x0)throw new s(_0x64210d(0x9d),_0x64210d(0xac));try{return new URL(_0xb37e72)[_0x64210d(0xa7)];}catch{throw new s(_0x64210d(0x9d),_0x64210d(0xa5));}}function M(_0x35c6c6,_0x1d8367){const _0x56bdfd=_0x3e1b99;if(!Number[_0x56bdfd(0xfd)](_0x35c6c6)||_0x35c6c6<=0x0)throw new s('COLLABORATION_POOL_INVALID_INPUT',_0x1d8367+_0x56bdfd(0xf1));}function N(_0x288ef6){const _0x58b3cc=_0x3e1b99;return _0x288ef6 instanceof _0x3afe5a?new s(_0x288ef6[_0x58b3cc(0xdc)]==='INSTANCE_POOL_CAPACITY_EXCEEDED'?'COLLABORATION_POOL_CAPACITY_EXCEEDED':_0x288ef6[_0x58b3cc(0xdc)]===_0x58b3cc(0xe7)?_0x58b3cc(0x90):_0x58b3cc(0x9d),_0x288ef6['message'],{'cause':_0x288ef6}):_0x288ef6;}function P(_0x2702ef){const _0x50d545=_0x3e1b99;return typeof _0x2702ef==_0x50d545(0x10a)&&_0x2702ef&&_0x50d545(0xdc)in _0x2702ef&&typeof _0x2702ef[_0x50d545(0xdc)]==_0x50d545(0xca)?_0x2702ef[_0x50d545(0xdc)]:_0x50d545(0x102);}function F(_0x4ed198){return _0x4ed198;}export{s as UniverCollaborationRuntimePoolError,A as createUniverCollaborationRuntimePool,F as defineUniverCollaborationRuntimeWorker};
1
+ const _0x405923=_0x19e5;(function(_0x343696,_0x6a3228){const _0xc162a4=_0x19e5,_0x587d4d=_0x343696();while(!![]){try{const _0x4c2fe9=-parseInt(_0xc162a4(0x276))/0x1*(-parseInt(_0xc162a4(0x269))/0x2)+parseInt(_0xc162a4(0x25f))/0x3*(-parseInt(_0xc162a4(0x1f2))/0x4)+-parseInt(_0xc162a4(0x20a))/0x5+-parseInt(_0xc162a4(0x253))/0x6*(-parseInt(_0xc162a4(0x277))/0x7)+parseInt(_0xc162a4(0x23b))/0x8+parseInt(_0xc162a4(0x1e9))/0x9+-parseInt(_0xc162a4(0x252))/0xa*(parseInt(_0xc162a4(0x221))/0xb);if(_0x4c2fe9===_0x6a3228)break;else _0x587d4d['push'](_0x587d4d['shift']());}catch(_0x2302ae){_0x587d4d['push'](_0x587d4d['shift']());}}}(_0x2237,0x82f7e));import{InstancePoolError as _0x3694b8,createGenericKeyedInstancePool as _0x408481}from'@univer-cli/generic-keyed-instance-pool';import{fork as _0x3449a8}from'node:child_process';import{fileURLToPath as _0x2768b8}from'node:url';var i=class extends Error{[_0x405923(0x264)];[_0x405923(0x239)];constructor(_0x595157,_0x4aa05f,_0x2cacc0={}){const _0x406064=_0x405923;super(_0x4aa05f,_0x2cacc0),this['name']='UniverCollaborationRuntimePoolError',this[_0x406064(0x264)]=_0x595157,this['invalidatesInstance']=_0x2cacc0['invalidatesInstance']??!0x1;}},a=_0x405923(0x22d);function o(_0x5b54e3){const _0x3d0f05=_0x405923;return _0x5b54e3 instanceof Error&&_0x5b54e3[_0x3d0f05(0x22f)]===_0x3d0f05(0x22d)&&'code'in _0x5b54e3&&typeof _0x5b54e3['code']=='string';}function s(_0x52a7e5){const _0x1a6ffc=_0x405923;let _0x34388b=import.meta.url['endsWith'](_0x1a6ffc(0x22e))?_0x1a6ffc(0x22c):_0x1a6ffc(0x20f),_0x1fab50=_0x3449a8(_0x2768b8(new URL(_0x34388b,import.meta.url)),[],{..._0x52a7e5===void 0x0?{}:{'env':_0x52a7e5},'serialization':'advanced','stdio':[_0x1a6ffc(0x1f0),_0x1a6ffc(0x1f0),_0x1a6ffc(0x1f0),'ipc']}),_0x7b4356=0x0,_0x5ae005,_0x30ed6c=new Map(),_0x4fd230=new Promise(_0x71d756=>_0x1fab50[_0x1a6ffc(0x1e3)]('close',()=>_0x71d756()));_0x1fab50['on'](_0x1a6ffc(0x231),_0x30360c=>_0x3715dc(l(_0x30360c[_0x1a6ffc(0x25c)],_0x30360c))),_0x1fab50['on'](_0x1a6ffc(0x225),(_0x3ebb71,_0x2bcf20)=>_0x3715dc(l(_0x1a6ffc(0x22b)+(_0x2bcf20??_0x3ebb71)))),_0x1fab50['on'](_0x1a6ffc(0x1f6),()=>_0x3715dc(l(_0x1a6ffc(0x26b)))),_0x1fab50['on']('message',_0x509d46=>{const _0x5ca792=_0x1a6ffc;if(!u(_0x509d46))return;let _0x5ab6b1=_0x30ed6c[_0x5ca792(0x260)](_0x509d46['id']);_0x5ab6b1&&(_0x30ed6c['delete'](_0x509d46['id']),clearTimeout(_0x5ab6b1[_0x5ca792(0x1e7)]),_0x509d46['type']===_0x5ca792(0x231)?_0x5ab6b1['reject'](c(_0x509d46[_0x5ca792(0x231)])):_0x5ab6b1[_0x5ca792(0x26d)](_0x509d46['result']));});function _0x3715dc(_0x286f53){const _0x416822=_0x1a6ffc;if(!_0x5ae005){_0x5ae005=_0x286f53;for(let _0x1ae7d6 of _0x30ed6c['values']())clearTimeout(_0x1ae7d6[_0x416822(0x1e7)]),_0x1ae7d6[_0x416822(0x205)](_0x286f53);_0x30ed6c[_0x416822(0x254)](),_0x1fab50['exitCode']===null&&_0x1fab50[_0x416822(0x206)]===null&&_0x1fab50[_0x416822(0x270)](_0x416822(0x273));}}return{'units':0x0,'exited':_0x4fd230,get 'available'(){return!_0x5ae005;},'terminate'(){const _0x3460b6=_0x1a6ffc;_0x3715dc(new i(_0x3460b6(0x25e),_0x3460b6(0x232),{'invalidatesInstance':!0x0}));},async 'request'(_0x29154d,_0x12a9c2,_0x52fc5d){if(_0x5ae005)throw _0x5ae005;let _0x150977=++_0x7b4356;return await new Promise((_0x5efd9a,_0x4fa781)=>{const _0x46dbb8=_0x19e5;let _0x1a546a=setTimeout(()=>_0x3715dc(new i(_0x12a9c2[_0x46dbb8(0x271)]===_0x46dbb8(0x1e6)?_0x46dbb8(0x1f3):_0x46dbb8(0x247),_0x46dbb8(0x203)+_0x12a9c2[_0x46dbb8(0x271)]+_0x46dbb8(0x228)+_0x52fc5d+'ms',{'invalidatesInstance':!0x0})),_0x52fc5d);_0x30ed6c[_0x46dbb8(0x1e4)](_0x150977,{'reject':_0x4fa781,'resolve':_0x5efd9a,'timer':_0x1a546a});try{_0x1fab50['send']({..._0x12a9c2,'id':_0x150977,'runtimeId':_0x29154d},_0x56f05e=>{_0x56f05e&&_0x3715dc(l(_0x56f05e['message'],_0x56f05e));});}catch(_0xf0073d){clearTimeout(_0x1a546a),_0x30ed6c[_0x46dbb8(0x258)](_0x150977),_0x4fa781(_0xf0073d);}});}};}function c(_0xf4cd49){const _0x5f1568=_0x405923;let _0x2d5cc8=Error(_0xf4cd49['message']);return _0xf4cd49[_0x5f1568(0x264)]?.['startsWith'](_0x5f1568(0x207))&&!_0xf4cd49[_0x5f1568(0x264)]['startsWith'](_0x5f1568(0x278))?(_0x2d5cc8[_0x5f1568(0x22f)]=a,Object[_0x5f1568(0x204)](_0x2d5cc8,{'code':_0xf4cd49[_0x5f1568(0x264)],'retryable':_0xf4cd49['retryable']??!0x1})):(_0x2d5cc8[_0x5f1568(0x22f)]=_0xf4cd49[_0x5f1568(0x22f)],_0xf4cd49[_0x5f1568(0x264)]!==void 0x0&&Object[_0x5f1568(0x204)](_0x2d5cc8,{'code':_0xf4cd49['code']})),_0xf4cd49[_0x5f1568(0x239)]&&Object['assign'](_0x2d5cc8,{'invalidatesInstance':!0x0}),_0xf4cd49[_0x5f1568(0x219)]!==void 0x0&&(_0x2d5cc8[_0x5f1568(0x219)]=_0xf4cd49[_0x5f1568(0x219)]),_0x2d5cc8;}function l(_0x44c059,_0x48b955){return new i('COLLABORATION_WORKER_CRASHED',_0x44c059,{..._0x48b955===void 0x0?{}:{'cause':_0x48b955},'invalidatesInstance':!0x0});}function u(_0x34060f){const _0x52ba84=_0x405923;return typeof _0x34060f==_0x52ba84(0x236)&&!!_0x34060f&&'id'in _0x34060f&&_0x52ba84(0x271)in _0x34060f&&Number[_0x52ba84(0x213)](_0x34060f['id'])&&(_0x34060f['type']===_0x52ba84(0x263)||_0x34060f[_0x52ba84(0x271)]===_0x52ba84(0x231));}var d=0x1388;function f(_0x53752c){let _0x16e3ef=new Set(),_0x50d6cd=0x0;function _0xa61fc2(){const _0x50156b=_0x19e5;for(let _0x35834d of _0x16e3ef)if(_0x35834d[_0x50156b(0x235)]&&_0x35834d[_0x50156b(0x246)]<_0x53752c[_0x50156b(0x234)])return _0x35834d[_0x50156b(0x246)]++,_0x35834d;let _0x379998=s(_0x53752c[_0x50156b(0x1e5)]);return _0x379998[_0x50156b(0x246)]++,_0x16e3ef[_0x50156b(0x20e)](_0x379998),_0x379998[_0x50156b(0x229)][_0x50156b(0x21f)](()=>_0x16e3ef[_0x50156b(0x258)](_0x379998)),_0x379998;}return{async 'create'({init:_0x12ccd8}){const _0x4bacc6=_0x19e5;let _0x21d1cb=_0xa61fc2(),_0x3a7cdb=++_0x50d6cd,_0x1289ae=async()=>{const _0x522396=_0x19e5;try{_0x21d1cb['available']&&await _0x21d1cb[_0x522396(0x200)](_0x3a7cdb,{'type':_0x522396(0x20d)},d);}catch{_0x21d1cb[_0x522396(0x20b)]();}finally{--_0x21d1cb[_0x522396(0x246)]===0x0&&(_0x21d1cb['terminate'](),await _0x21d1cb['exited']);}};try{return p(_0x21d1cb,_0x3a7cdb,m(await _0x21d1cb[_0x4bacc6(0x200)](_0x3a7cdb,{'entry':_0x53752c[_0x4bacc6(0x1ee)],'init':_0x12ccd8,'type':_0x4bacc6(0x1e6)},_0x53752c[_0x4bacc6(0x262)])),_0x53752c[_0x4bacc6(0x1fe)],_0x1289ae);}catch(_0x25d45f){throw await _0x1289ae(),_0x25d45f;}},async 'destroy'({instance:_0x39b01a}){const _0x9719dc=_0x19e5;await _0x39b01a[_0x9719dc(0x20d)]();},async 'waitForExit'(){const _0x322607=_0x19e5;await Promise[_0x322607(0x275)](Array[_0x322607(0x233)](_0x16e3ef,_0x5608a5=>_0x5608a5[_0x322607(0x229)]));}};}function _0x19e5(_0x4ffa7e,_0xc90bc9){_0x4ffa7e=_0x4ffa7e-0x1e2;const _0x2237a9=_0x2237();let _0x19e567=_0x2237a9[_0x4ffa7e];return _0x19e567;}function p(_0x32e0bc,_0x400899,_0x35a9df,_0x5741dd,_0x86a08b){const _0x1d4a45=_0x405923;let _0x36ca2e=_0x1fdc6e=>_0x32e0bc[_0x1d4a45(0x200)](_0x400899,_0x1fdc6e,_0x5741dd);return{..._0x35a9df,get 'available'(){const _0x5f3d54=_0x1d4a45;return _0x32e0bc[_0x5f3d54(0x235)];},'close':_0x86a08b,async 'getState'(){const _0x552f50=_0x1d4a45;return h(await _0x36ca2e({'type':_0x552f50(0x24f)}));},async 'getPendingMutations'(){const _0x2c4c3b=_0x1d4a45;let _0x1e399f=await _0x36ca2e({'type':'get-pending-mutations'});if(!C(_0x1e399f))throw v(_0x2c4c3b(0x1f7));return _0x1e399f;},async 'executeReadCode'(_0x44cd45){const _0x5c890d=_0x1d4a45;let _0x49fab4=g(await _0x36ca2e({'code':_0x44cd45,'type':_0x5c890d(0x266)}));if(!(_0x5c890d(0x22a)in _0x49fab4)||!w(_0x49fab4[_0x5c890d(0x22a)]))throw v(_0x5c890d(0x220));return _0x49fab4;},async 'executeWriteCode'(_0x2e085a){const _0x3e6cc7=_0x1d4a45;let _0x16dfc3=g(await _0x36ca2e({'code':_0x2e085a,'type':'execute-write'}));if(!w(_0x16dfc3[_0x3e6cc7(0x22a)])||!C(_0x16dfc3[_0x3e6cc7(0x1f9)]))throw v(_0x3e6cc7(0x21d));return _0x16dfc3;},async 'replacePendingMutations'(_0x16792e){const _0x31718b=_0x1d4a45;let _0x25f450=g(await _0x36ca2e({'mutations':_0x16792e,'type':_0x31718b(0x243)}));if(!T(_0x25f450[_0x31718b(0x279)])||!T(_0x25f450[_0x31718b(0x267)]))throw v(_0x31718b(0x216));return _0x25f450;},async 'fetch'(){const _0x656ac1=_0x1d4a45;return _(await _0x36ca2e({'type':_0x656ac1(0x261)}),[_0x656ac1(0x24d),_0x656ac1(0x1f8)]);},async 'pull'(){const _0x5057b6=_0x1d4a45;return _(await _0x36ca2e({'type':_0x5057b6(0x23a)}),[_0x5057b6(0x25d),_0x5057b6(0x272),_0x5057b6(0x227)]);},async 'commit'(){const _0xf2de4d=_0x1d4a45;return _(await _0x36ca2e({'type':'commit'}),['nothing-to-commit',_0xf2de4d(0x215),'confirmed','retry',_0xf2de4d(0x1f5),'conflict']);},async 'exportUnitData'(){let _0x5cc54e=await _0x36ca2e({'type':'export'});if(!E(_0x5cc54e))throw v('Worker\x20returned\x20invalid\x20UnitData');return _0x5cc54e;}};}function _0x2237(){const _0x4156d8=['baseRevision','status','message','up-to-date','COLLABORATION_WORKER_CLOSED','101874LNuqGv','get','fetch','openTimeoutMs','result','code','sid','execute-read','pendingMutationCount','executeWriteCode','2KYnuVa','COLLABORATION_LOAD_FAILED','Worker\x20IPC\x20disconnected','entry\x20must\x20not\x20be\x20empty','resolve','Worker\x20returned\x20an\x20invalid\x20operation\x20status','COLLABORATION_WORKER_PROTOCOL_ERROR','kill','type','pulled','SIGKILL','online','all','171259xVYLSP','121751eXmBQB','COLLABORATION_WORKER_','previousMutationCount','string','once','set','env','open','timer','executeReadCode','4855113VqWyrI','operation','read','COLLABORATION_POOL_CLOSED','pending-mutations','entry','write','ignore','waitForExit','88hzmfyg','COLLABORATION_WORKER_OPEN_TIMEOUT','acquire','unknown','disconnect','Worker\x20returned\x20invalid\x20pending\x20mutations','fetched','mutations','UNKNOWN','Worker\x20returned\x20invalid\x20collaboration\x20runtime\x20state','export','boolean','operationTimeoutMs','number','request','instance-failed','bufferedChangesetCount','Worker\x20','assign','reject','signalCode','COLLABORATION_','operation-complete','onEvent','620030BonvFg','terminate','entry\x20must\x20be\x20an\x20absolute\x20file\x20URL\x20or\x20another\x20importable\x20URL','close','add','./worker-child.mjs','instance','now','key','isSafeInteger','isArray','pull-required','Worker\x20returned\x20an\x20invalid\x20mutation\x20replacement\x20result','reason','COLLABORATION_POOL_INVALID_INPUT','stack','closed','\x20must\x20be\x20a\x20finite\x20positive\x20number','awaitingChangeset','Worker\x20returned\x20an\x20invalid\x20write\x20result','getPendingMutations','then','Worker\x20returned\x20an\x20invalid\x20read\x20value','770CQkBdH','isInteger','state','every','exit','revision','conflict','\x20timed\x20out\x20after\x20','exited','value','Worker\x20exited\x20with\x20','./worker-child.ts','CollaborationRuntimeError','.ts','name','cache','error','Worker\x20closed','from','maxUnitsPerWorker','available','object','release','Worker\x20returned\x20invalid\x20collaboration\x20runtime\x20metadata','invalidatesInstance','pull','6183864YDAdih','data','href','mode','COLLABORATION_POOL_CAPACITY_EXCEEDED','transform-failed','COLLABORATION_CLOSED','unitId','replace-mutations','Worker\x20returned\x20an\x20invalid\x20operation\x20result','permission-rejected','units','COLLABORATION_WORKER_OPERATION_TIMEOUT','commit','Replacement\x20worker\x20for\x20','reqId','exportUnitData','isFinite','unchanged','\x20is\x20closed','get-state','INSTANCE_POOL_CLOSED','length','68030cAEXTg','138GoYHEO','clear','unitType','replacePendingMutations','values','delete','invalidate'];_0x2237=function(){return _0x4156d8;};return _0x2237();}function m(_0x23bc57){const _0x264f54=_0x405923;if(!E(_0x23bc57)||typeof _0x23bc57[_0x264f54(0x242)]!='string'||!y(_0x23bc57['unitType']))throw v(_0x264f54(0x238));return{'unitId':_0x23bc57[_0x264f54(0x242)],'unitType':_0x23bc57['unitType']};}function h(_0x121120){const _0x2ad137=_0x405923;if(!E(_0x121120)||!b(_0x121120['connection'])||!T(_0x121120[_0x2ad137(0x25a)])||!T(_0x121120['knownHeadRevision'])||Number(_0x121120['knownHeadRevision'])<Number(_0x121120[_0x2ad137(0x25a)])||!T(_0x121120['pendingMutationCount'])||!T(_0x121120[_0x2ad137(0x202)])||!x(_0x121120[_0x2ad137(0x21c)])||!S(_0x121120[_0x2ad137(0x227)]))throw v(_0x2ad137(0x1fb));return _0x121120;}function g(_0x310936){const _0x545d2e=_0x405923;if(!E(_0x310936))throw v(_0x545d2e(0x244));return{..._0x310936,'state':h(_0x310936[_0x545d2e(0x223)])};}function _(_0x27d563,_0x51fd05){const _0x29ca9e=_0x405923;let _0x2829a5=g(_0x27d563);if(typeof _0x2829a5[_0x29ca9e(0x25b)]!='string'||!_0x51fd05['includes'](_0x2829a5[_0x29ca9e(0x25b)]))throw v(_0x29ca9e(0x26e));return _0x2829a5;}function v(_0x45ba10){const _0x257cb1=_0x405923;return new i(_0x257cb1(0x26f),_0x45ba10,{'invalidatesInstance':!0x0});}function y(_0x2531ab){return _0x2531ab===0x1||_0x2531ab===0x2||_0x2531ab===0x3||_0x2531ab===0x5||_0x2531ab===0x6||_0x2531ab===0x7;}function b(_0x12b18a){const _0x21eee4=_0x405923;return _0x12b18a===_0x21eee4(0x274)||_0x12b18a==='reconnecting'||_0x12b18a==='offline'||_0x12b18a===_0x21eee4(0x21a);}function x(_0x207a1d){const _0x4558d1=_0x405923;return _0x207a1d===null||E(_0x207a1d)&&T(_0x207a1d['baseRevision'])&&T(_0x207a1d[_0x4558d1(0x226)])&&T(_0x207a1d['mutationCount'])&&(_0x207a1d[_0x4558d1(0x265)]===void 0x0||typeof _0x207a1d[_0x4558d1(0x265)]==_0x4558d1(0x1e2))&&(_0x207a1d[_0x4558d1(0x24a)]===void 0x0||T(_0x207a1d[_0x4558d1(0x24a)]));}function S(_0x2f1f26){const _0x1634f8=_0x405923;return _0x2f1f26===null||E(_0x2f1f26)&&(_0x2f1f26[_0x1634f8(0x1ea)]===_0x1634f8(0x23a)||_0x2f1f26[_0x1634f8(0x1ea)]===_0x1634f8(0x248))&&(_0x2f1f26[_0x1634f8(0x217)]===_0x1634f8(0x240)||_0x2f1f26['reason']==='changeset-rejected'||_0x2f1f26[_0x1634f8(0x217)]===_0x1634f8(0x245))&&typeof _0x2f1f26['message']==_0x1634f8(0x1e2)&&(_0x2f1f26[_0x1634f8(0x264)]===void 0x0||Number[_0x1634f8(0x222)](_0x2f1f26[_0x1634f8(0x264)]));}function C(_0x58a5d3){const _0x3c7fba=_0x405923;return Array[_0x3c7fba(0x214)](_0x58a5d3)&&_0x58a5d3[_0x3c7fba(0x224)](_0x8c0b36=>E(_0x8c0b36)&&typeof _0x8c0b36['id']==_0x3c7fba(0x1e2)&&_0x8c0b36['id'][_0x3c7fba(0x251)]>0x0&&typeof _0x8c0b36[_0x3c7fba(0x23c)]==_0x3c7fba(0x1e2));}function w(_0xa13c06){const _0x298786=_0x405923;return _0xa13c06===null||typeof _0xa13c06==_0x298786(0x1fd)||typeof _0xa13c06==_0x298786(0x1e2)||typeof _0xa13c06==_0x298786(0x1ff)&&Number[_0x298786(0x24c)](_0xa13c06)?!0x0:Array[_0x298786(0x214)](_0xa13c06)?_0xa13c06[_0x298786(0x224)](w):E(_0xa13c06)&&Object[_0x298786(0x257)](_0xa13c06)[_0x298786(0x224)](w);}function T(_0xc15b7b){const _0x325e62=_0x405923;return Number[_0x325e62(0x213)](_0xc15b7b)&&Number(_0xc15b7b)>=0x0;}function E(_0xa5fb5f){const _0x851b9e=_0x405923;return typeof _0xa5fb5f==_0x851b9e(0x236)&&!!_0xa5fb5f&&!Array[_0x851b9e(0x214)](_0xa5fb5f);}var D=0x32,O=0xa,k=0x7530,A=0x7530;function j(_0x41ba26){const _0xb50ae6=_0x405923;let _0x42a983=M(_0x41ba26[_0xb50ae6(0x1ee)]),_0x568712=_0x41ba26[_0xb50ae6(0x262)]??k,_0x589314=_0x41ba26[_0xb50ae6(0x1fe)]??A;N(_0x568712,_0xb50ae6(0x262)),N(_0x589314,'operationTimeoutMs');let _0x48c521=_0x41ba26[_0xb50ae6(0x234)]??O;if(!Number[_0xb50ae6(0x213)](_0x48c521)||_0x48c521<=0x0)throw new i(_0xb50ae6(0x218),'maxUnitsPerWorker\x20must\x20be\x20a\x20positive\x20integer');let _0x263829=f({'entry':_0x42a983,'maxUnitsPerWorker':_0x48c521,'openTimeoutMs':_0x568712,'operationTimeoutMs':_0x589314,..._0x41ba26[_0xb50ae6(0x1e5)]===void 0x0?{}:{'env':_0x41ba26['env']}}),_0x341c98;try{_0x341c98=_0x408481({'factory':_0x263829,'cache':{..._0x41ba26['cache'],'maxEntries':_0x41ba26[_0xb50ae6(0x230)]?.['maxEntries']??D},'onEvent':_0x389f3d});}catch(_0x992a4a){throw P(_0x992a4a);}return{async 'acquire'(_0x17e139){const _0x25c5ff=_0xb50ae6;try{let _0x263acf=await _0x341c98[_0x25c5ff(0x1f4)](_0x17e139);if(_0x263acf[_0x25c5ff(0x210)][_0x25c5ff(0x235)])return _0x3da52a(_0x263acf);let [,_0x29a15a]=await Promise['all']([_0x263acf[_0x25c5ff(0x259)](),_0x341c98[_0x25c5ff(0x1f4)](_0x17e139)]);if(_0x29a15a['instance'][_0x25c5ff(0x235)])return _0x3da52a(_0x29a15a);throw await _0x29a15a[_0x25c5ff(0x259)](),new i(_0x25c5ff(0x25e),_0x25c5ff(0x249)+_0x17e139[_0x25c5ff(0x212)]+'\x20is\x20unavailable',{'invalidatesInstance':!0x0});}catch(_0x3ff160){throw P(_0x3ff160);}},async 'close'(){const _0x2b476e=_0xb50ae6;try{await _0x341c98[_0x2b476e(0x20d)](),await _0x263829[_0x2b476e(0x1f1)]();}catch(_0x281fe9){throw P(_0x281fe9);}}};function _0x3da52a(_0x50c8fb){const _0x4d2402=_0xb50ae6;let _0x187373=_0x50c8fb[_0x4d2402(0x210)],_0xf7aa83=!0x1,_0x4467a8,_0x5920e4=!0x1;return{'key':_0x50c8fb[_0x4d2402(0x212)],'unitId':_0x187373['unitId'],'unitType':_0x187373[_0x4d2402(0x255)],async 'getState'(){const _0x24a3d5=_0x4d2402;return await _0x51dada(_0x24a3d5(0x223),async()=>await _0x187373['getState']());},async 'getPendingMutations'(){const _0x500ddc=_0x4d2402;return await _0x51dada(_0x500ddc(0x1ed),async()=>await _0x187373[_0x500ddc(0x21e)]());},async 'execute'(_0x447327){const _0x112f5b=_0x4d2402;return _0x447327[_0x112f5b(0x23e)]==='read'?await _0x51dada(_0x112f5b(0x1eb),async()=>await _0x187373[_0x112f5b(0x1e8)](_0x447327['code'])):await _0x51dada(_0x112f5b(0x1ef),async()=>await _0x187373[_0x112f5b(0x268)](_0x447327[_0x112f5b(0x264)]));},async 'replacePendingMutations'(_0x4d084a){const _0x423a73=_0x4d2402;return await _0x51dada('replace-mutations',async()=>await _0x187373[_0x423a73(0x256)](_0x4d084a));},async 'fetch'(){const _0x30e5b0=_0x4d2402;return await _0x51dada(_0x30e5b0(0x261),async()=>await _0x187373[_0x30e5b0(0x261)]());},async 'pull'(){const _0x3b4cb8=_0x4d2402;return await _0x51dada(_0x3b4cb8(0x23a),async()=>await _0x187373['pull']());},async 'commit'(){const _0x5bdc11=_0x4d2402;return await _0x51dada(_0x5bdc11(0x248),async()=>await _0x187373[_0x5bdc11(0x248)]());},async 'exportUnitData'(){const _0x2b9fb1=_0x4d2402;return await _0x51dada(_0x2b9fb1(0x1fc),async()=>await _0x187373[_0x2b9fb1(0x24b)]());},async 'invalidate'(){_0xf7aa83||(_0xf7aa83=!0x0,await _0x50c8fb['invalidate']());},async 'release'(){const _0x386feb=_0x4d2402;_0xf7aa83||(_0xf7aa83=!0x0,_0x5920e4||!_0x187373[_0x386feb(0x235)]?await _0x50c8fb['invalidate']():await _0x50c8fb[_0x386feb(0x237)]());}};async function _0x51dada(_0x452911,_0x5e8421){const _0x1b2899=_0x4d2402;_0x2a1464();try{return await _0x1289d7(_0x50c8fb[_0x1b2899(0x212)],_0x452911,_0x5e8421);}catch(_0x555b7f){throw _0x16fff2(_0x555b7f),_0x555b7f;}}function _0x2a1464(){const _0x2f1072=_0x4d2402;if(_0xf7aa83)throw new i('COLLABORATION_LEASE_CLOSED','Collaboration\x20runtime\x20lease\x20'+_0x50c8fb['key']+_0x2f1072(0x24e));if(_0x4467a8)throw _0x4467a8;}function _0x16fff2(_0x3c4e30){const _0x5f1d66=_0x4d2402;(_0x3c4e30 instanceof i&&_0x3c4e30['invalidatesInstance']||o(_0x3c4e30)&&(_0x3c4e30[_0x5f1d66(0x264)]==='COLLABORATION_PROTOCOL_ERROR'||_0x3c4e30[_0x5f1d66(0x264)]===_0x5f1d66(0x241)||_0x3c4e30[_0x5f1d66(0x264)]===_0x5f1d66(0x26a))||typeof _0x3c4e30==_0x5f1d66(0x236)&&_0x3c4e30&&_0x5f1d66(0x239)in _0x3c4e30&&_0x3c4e30[_0x5f1d66(0x239)]===!0x0)&&(_0x5920e4=!0x0,_0x4467a8=_0x3c4e30,_0x576eab({'errorCode':F(_0x3c4e30),'key':_0x50c8fb[_0x5f1d66(0x212)],'type':_0x5f1d66(0x201)}));}}async function _0x1289d7(_0x59211a,_0xd48b6e,_0x42d823){const _0x50ef02=_0xb50ae6;let _0x8fd323=Date[_0x50ef02(0x211)](),_0x256344=await _0x42d823();return _0x576eab({'durationMs':Date[_0x50ef02(0x211)]()-_0x8fd323,'key':_0x59211a,'operation':_0xd48b6e,'type':_0x50ef02(0x208)}),_0x256344;}function _0x389f3d(_0x31f255){_0x576eab(_0x31f255);}function _0x576eab(_0x11f25f){const _0xd67a7=_0xb50ae6;try{_0x41ba26[_0xd67a7(0x209)]?.(_0x11f25f);}catch{}}}function M(_0x5cdaf0){const _0x7acfc0=_0x405923;let _0x188894=_0x5cdaf0 instanceof URL?_0x5cdaf0[_0x7acfc0(0x23d)]:_0x5cdaf0;if(_0x188894['length']===0x0)throw new i(_0x7acfc0(0x218),_0x7acfc0(0x26c));try{return new URL(_0x188894)['href'];}catch{throw new i(_0x7acfc0(0x218),_0x7acfc0(0x20c));}}function N(_0x17f8bc,_0x2a95bc){const _0xbb3f0a=_0x405923;if(!Number[_0xbb3f0a(0x24c)](_0x17f8bc)||_0x17f8bc<=0x0)throw new i(_0xbb3f0a(0x218),_0x2a95bc+_0xbb3f0a(0x21b));}function P(_0x465130){const _0x48e20d=_0x405923;return _0x465130 instanceof _0x3694b8?new i(_0x465130[_0x48e20d(0x264)]==='INSTANCE_POOL_CAPACITY_EXCEEDED'?_0x48e20d(0x23f):_0x465130[_0x48e20d(0x264)]===_0x48e20d(0x250)?_0x48e20d(0x1ec):'COLLABORATION_POOL_INVALID_INPUT',_0x465130['message'],{'cause':_0x465130}):_0x465130;}function F(_0x2740e8){const _0x441e7b=_0x405923;return typeof _0x2740e8==_0x441e7b(0x236)&&_0x2740e8&&_0x441e7b(0x264)in _0x2740e8&&typeof _0x2740e8[_0x441e7b(0x264)]==_0x441e7b(0x1e2)?_0x2740e8['code']:_0x441e7b(0x1fa);}function I(_0x13313f){return _0x13313f;}export{i as UniverCollaborationRuntimePoolError,j as createUniverCollaborationRuntimePool,I as defineUniverCollaborationRuntimeWorker};
@@ -1 +1 @@
1
- (function(_0x23b808,_0x2e484e){const _0x3ba641=_0x1643,_0x5574a1=_0x23b808();while(!![]){try{const _0x15777c=-parseInt(_0x3ba641(0xc1))/0x1+parseInt(_0x3ba641(0xbb))/0x2+parseInt(_0x3ba641(0xaf))/0x3+parseInt(_0x3ba641(0xa7))/0x4*(parseInt(_0x3ba641(0xa8))/0x5)+-parseInt(_0x3ba641(0xb6))/0x6+parseInt(_0x3ba641(0xb9))/0x7*(parseInt(_0x3ba641(0xba))/0x8)+-parseInt(_0x3ba641(0xa9))/0x9*(parseInt(_0x3ba641(0xc3))/0xa);if(_0x15777c===_0x2e484e)break;else _0x5574a1['push'](_0x5574a1['shift']());}catch(_0xa3b262){_0x5574a1['push'](_0x5574a1['shift']());}}}(_0x48bd,0x1f279));var e;function _0x48bd(){const _0x26275e=['execute-read','execute-write','Collaboration\x20worker\x20is\x20already\x20open','get-pending-mutations','default','object','function','result','send','string','2180OPtfNY','185UccOuw','27873XLkTCC','Collaboration\x20worker\x20entry\x20must\x20default-export\x20a\x20worker\x20definition','isSafeInteger','execute','message','getPendingMutations','265671NoljoX','open','error','commit','type','close','unitId','1018404gxPxxY','exportUnitData','replace-mutations','112JlKQzu','110904wouOYJ','401046IUmBCO','code','replacePendingMutations','connection','createRuntime','boolean','106733ywoHAA','retryable','410WolaBJ','mutations','name','fetch','getState','stack','then','pull','get-state','Error'];_0x48bd=function(){return _0x26275e;};return _0x48bd();}function _0x1643(_0x363e41,_0x3db602){_0x363e41=_0x363e41-0xa6;const _0x48bddc=_0x48bd();let _0x1643a2=_0x48bddc[_0x363e41];return _0x1643a2;}process['on']('message',_0x3dbe0d=>{const _0x5c1d70=_0x1643;a(_0x3dbe0d)&&t(_0x3dbe0d)[_0x5c1d70(0xc9)](_0x62b2d4=>s({'id':_0x3dbe0d['id'],'result':_0x62b2d4,'type':_0x5c1d70(0xd4)}),_0x5427c5=>s({'error':o(_0x5427c5,e?.[_0x5c1d70(0xc7)]()[_0x5c1d70(0xbe)]==='closed'),'id':_0x3dbe0d['id'],'type':_0x5c1d70(0xb1)}));});async function t(_0x4b0793){const _0xc2281d=_0x1643;if(_0x4b0793[_0xc2281d(0xb3)]===_0xc2281d(0xb0)){if(e!==void 0x0)throw Error(_0xc2281d(0xcf));let _0x180663=await import(_0x4b0793.entry);if(!i(_0x180663[_0xc2281d(0xd1)]))throw Error(_0xc2281d(0xaa));return e=await _0x180663[_0xc2281d(0xd1)][_0xc2281d(0xbf)](_0x4b0793['init']),r(e);}if(_0x4b0793['type']===_0xc2281d(0xb4))return await e?.[_0xc2281d(0xb4)](),e=void 0x0,null;let _0x43d964=n();return _0x4b0793[_0xc2281d(0xb3)]===_0xc2281d(0xcb)?_0x43d964[_0xc2281d(0xc7)]():_0x4b0793[_0xc2281d(0xb3)]===_0xc2281d(0xd0)?_0x43d964[_0xc2281d(0xae)]():_0x4b0793[_0xc2281d(0xb3)]===_0xc2281d(0xcd)?await _0x43d964[_0xc2281d(0xac)]({'code':_0x4b0793[_0xc2281d(0xbc)],'mode':'read'}):_0x4b0793[_0xc2281d(0xb3)]===_0xc2281d(0xce)?await _0x43d964[_0xc2281d(0xac)]({'code':_0x4b0793[_0xc2281d(0xbc)],'mode':'write'}):_0x4b0793[_0xc2281d(0xb3)]===_0xc2281d(0xb8)?await _0x43d964[_0xc2281d(0xbd)](_0x4b0793[_0xc2281d(0xc4)]):_0x4b0793[_0xc2281d(0xb3)]===_0xc2281d(0xc6)?await _0x43d964[_0xc2281d(0xc6)]():_0x4b0793[_0xc2281d(0xb3)]==='pull'?await _0x43d964[_0xc2281d(0xca)]():_0x4b0793[_0xc2281d(0xb3)]===_0xc2281d(0xb2)?await _0x43d964['commit']():await _0x43d964[_0xc2281d(0xb7)]();}function n(){if(!e)throw Error('Collaboration\x20worker\x20is\x20not\x20open');return e;}function r(_0xb000ef){const _0x4e92ef=_0x1643;return{'unitId':_0xb000ef[_0x4e92ef(0xb5)],'unitType':_0xb000ef['unitType']};}function i(_0x4f236b){const _0x4061e2=_0x1643;return typeof _0x4f236b=='object'&&!!_0x4f236b&&'createRuntime'in _0x4f236b&&typeof _0x4f236b[_0x4061e2(0xbf)]==_0x4061e2(0xd3);}function a(_0x17e79e){const _0x25949a=_0x1643;return typeof _0x17e79e==_0x25949a(0xd2)&&!!_0x17e79e&&'id'in _0x17e79e&&Number[_0x25949a(0xab)](_0x17e79e['id'])&&'type'in _0x17e79e&&typeof _0x17e79e['type']=='string';}function o(_0x253efd,_0x2cee23){const _0x37fe79=_0x1643;if(!(_0x253efd instanceof Error))return{'invalidatesInstance':_0x2cee23,'message':String(_0x253efd),'name':_0x37fe79(0xcc)};let _0x1fb9fc=_0x253efd;return{...typeof _0x1fb9fc['code']==_0x37fe79(0xa6)?{'code':_0x1fb9fc['code']}:{},..._0x2cee23?{'invalidatesInstance':!0x0}:{},'message':_0x253efd[_0x37fe79(0xad)],'name':_0x253efd[_0x37fe79(0xc5)],...typeof _0x1fb9fc[_0x37fe79(0xc2)]==_0x37fe79(0xc0)?{'retryable':_0x1fb9fc[_0x37fe79(0xc2)]}:{},..._0x253efd[_0x37fe79(0xc8)]===void 0x0?{}:{'stack':_0x253efd[_0x37fe79(0xc8)]}};}function s(_0x43bc2c){const _0x69bacf=_0x1643;process['connected']&&process[_0x69bacf(0xd5)]?.(_0x43bc2c);}
1
+ const _0x1d4780=_0x1d61;function _0x5c30(){const _0x2cac5b=['replacePendingMutations','init','2586170Uuywpf','get','pull','522993VdWrsl','stack','type','message','closed','set','string','boolean','delete','get-pending-mutations','close','execute','unitId','6lsPZfw','write','4052536DYmnhn','result','1588620oBRXkX','then','read','default','error','open','runtimeId','execute-read','1277216rlETBd','mutations','name','object','function','651147vGYTNa','exportUnitData','send','Collaboration\x20runtime\x20is\x20not\x20open','code','retryable','commit','execute-write','596244hmPOfG','unitType','fetch','get-state','createRuntime','getState'];_0x5c30=function(){return _0x2cac5b;};return _0x5c30();}(function(_0x44e202,_0x12081b){const _0x2de602=_0x1d61,_0x3aeb3d=_0x44e202();while(!![]){try{const _0x84bbd8=parseInt(_0x2de602(0x96))/0x1+parseInt(_0x2de602(0x8b))/0x2+-parseInt(_0x2de602(0x76))/0x3+parseInt(_0x2de602(0x7e))/0x4+parseInt(_0x2de602(0x93))/0x5+-parseInt(_0x2de602(0x72))/0x6*(-parseInt(_0x2de602(0x83))/0x7)+-parseInt(_0x2de602(0x74))/0x8;if(_0x84bbd8===_0x12081b)break;else _0x3aeb3d['push'](_0x3aeb3d['shift']());}catch(_0xd29546){_0x3aeb3d['push'](_0x3aeb3d['shift']());}}}(_0x5c30,0xae747));var e=new Map();process['on'](_0x1d4780(0x99),_0x441dfd=>{const _0x22870a=_0x1d4780;i(_0x441dfd)&&t(_0x441dfd)[_0x22870a(0x77)](_0x28a094=>o({'id':_0x441dfd['id'],'result':_0x28a094,'type':_0x22870a(0x75)}),_0xe90c8d=>o({'error':a(_0xe90c8d,e['get'](_0x441dfd[_0x22870a(0x7c)])?.[_0x22870a(0x90)]()['connection']===_0x22870a(0x9a)),'id':_0x441dfd['id'],'type':_0x22870a(0x7a)}));});async function t(_0x39bf36){const _0x43a5c0=_0x1d4780;if(_0x39bf36[_0x43a5c0(0x98)]===_0x43a5c0(0x7b)){let _0x160b9b=await import(_0x39bf36.entry);if(!r(_0x160b9b[_0x43a5c0(0x79)]))throw Error('Collaboration\x20worker\x20entry\x20must\x20default-export\x20a\x20worker\x20definition');let _0x19f251=await _0x160b9b['default'][_0x43a5c0(0x8f)](_0x39bf36[_0x43a5c0(0x92)]);return e[_0x43a5c0(0x9b)](_0x39bf36['runtimeId'],_0x19f251),n(_0x19f251);}let _0x5d48e5=e[_0x43a5c0(0x94)](_0x39bf36['runtimeId']);if(_0x39bf36[_0x43a5c0(0x98)]===_0x43a5c0(0xa0))return await _0x5d48e5?.[_0x43a5c0(0xa0)](),e[_0x43a5c0(0x9e)](_0x39bf36[_0x43a5c0(0x7c)]),null;if(!_0x5d48e5)throw Error(_0x43a5c0(0x86));return _0x39bf36[_0x43a5c0(0x98)]===_0x43a5c0(0x8e)?_0x5d48e5['getState']():_0x39bf36[_0x43a5c0(0x98)]===_0x43a5c0(0x9f)?_0x5d48e5['getPendingMutations']():_0x39bf36[_0x43a5c0(0x98)]===_0x43a5c0(0x7d)?await _0x5d48e5[_0x43a5c0(0xa1)]({'code':_0x39bf36[_0x43a5c0(0x87)],'mode':_0x43a5c0(0x78)}):_0x39bf36[_0x43a5c0(0x98)]===_0x43a5c0(0x8a)?await _0x5d48e5[_0x43a5c0(0xa1)]({'code':_0x39bf36[_0x43a5c0(0x87)],'mode':_0x43a5c0(0x73)}):_0x39bf36[_0x43a5c0(0x98)]==='replace-mutations'?await _0x5d48e5[_0x43a5c0(0x91)](_0x39bf36[_0x43a5c0(0x7f)]):_0x39bf36['type']===_0x43a5c0(0x8d)?await _0x5d48e5['fetch']():_0x39bf36[_0x43a5c0(0x98)]===_0x43a5c0(0x95)?await _0x5d48e5[_0x43a5c0(0x95)]():_0x39bf36[_0x43a5c0(0x98)]===_0x43a5c0(0x89)?await _0x5d48e5['commit']():await _0x5d48e5[_0x43a5c0(0x84)]();}function n(_0x104842){const _0x1eb624=_0x1d4780;return{'unitId':_0x104842[_0x1eb624(0x71)],'unitType':_0x104842[_0x1eb624(0x8c)]};}function r(_0x5d160b){const _0x2d58b9=_0x1d4780;return typeof _0x5d160b==_0x2d58b9(0x81)&&!!_0x5d160b&&_0x2d58b9(0x8f)in _0x5d160b&&typeof _0x5d160b[_0x2d58b9(0x8f)]==_0x2d58b9(0x82);}function i(_0xd2833a){const _0x172fb8=_0x1d4780;return typeof _0xd2833a==_0x172fb8(0x81)&&!!_0xd2833a&&'id'in _0xd2833a&&Number['isSafeInteger'](_0xd2833a['id'])&&_0x172fb8(0x7c)in _0xd2833a&&Number['isSafeInteger'](_0xd2833a[_0x172fb8(0x7c)])&&_0x172fb8(0x98)in _0xd2833a&&typeof _0xd2833a['type']==_0x172fb8(0x9c);}function a(_0xa23465,_0x519450){const _0x1a6bbb=_0x1d4780;if(!(_0xa23465 instanceof Error))return{'invalidatesInstance':_0x519450,'message':String(_0xa23465),'name':'Error'};let _0x419b72=_0xa23465;return{...typeof _0x419b72[_0x1a6bbb(0x87)]==_0x1a6bbb(0x9c)?{'code':_0x419b72[_0x1a6bbb(0x87)]}:{},..._0x519450?{'invalidatesInstance':!0x0}:{},'message':_0xa23465[_0x1a6bbb(0x99)],'name':_0xa23465[_0x1a6bbb(0x80)],...typeof _0x419b72[_0x1a6bbb(0x88)]==_0x1a6bbb(0x9d)?{'retryable':_0x419b72['retryable']}:{},..._0xa23465[_0x1a6bbb(0x97)]===void 0x0?{}:{'stack':_0xa23465['stack']}};}function _0x1d61(_0x19ed5e,_0x1c2aee){_0x19ed5e=_0x19ed5e-0x71;const _0x5c3099=_0x5c30();let _0x1d6179=_0x5c3099[_0x19ed5e];return _0x1d6179;}function o(_0x1327f3){const _0x248f35=_0x1d4780;process['connected']&&process[_0x248f35(0x85)]?.(_0x1327f3);}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@univer-cli/univer-collaboration-runtime-pool",
3
3
  "type": "module",
4
- "version": "1.5.2",
4
+ "version": "1.6.1",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.ts",
@@ -18,8 +18,8 @@
18
18
  "README.zh-CN.md"
19
19
  ],
20
20
  "dependencies": {
21
- "@univer-cli/generic-keyed-instance-pool": "1.5.2",
22
- "@univer-cli/univer-collaboration-runtime": "1.5.2",
23
- "@univerjs/protocol": "1.5.2"
21
+ "@univer-cli/generic-keyed-instance-pool": "1.6.1",
22
+ "@univer-cli/univer-collaboration-runtime": "1.6.1",
23
+ "@univerjs/protocol": "1.6.1"
24
24
  }
25
25
  }