@ohtaman/washi 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/README.ja.md +58 -19
  2. package/README.md +58 -19
  3. package/README.zh-CN.md +58 -19
  4. package/THIRD_PARTY_LICENSES.md +34 -1
  5. package/dist/browser/__vite-browser-external-rTVKos2U.js +7 -0
  6. package/dist/browser/browser-runtime-AG5QFtKf.js +2021 -0
  7. package/dist/browser/highs-worker.js +26 -11
  8. package/dist/browser/highs.wasm +0 -0
  9. package/dist/browser/{loader-DewlSho8.js → loader-i3FnqMes.js} +183 -149
  10. package/dist/browser/solvers/glpk.js +289 -238
  11. package/dist/browser/solvers/glpk.min.js +1 -1
  12. package/dist/browser/solvers/pumpkin-_washi-pumpkin-node-runtime-CEKUDK6d.js +9 -0
  13. package/dist/browser/solvers/pumpkin-loader-CvdaKxf4.js +320 -0
  14. package/dist/browser/solvers/pumpkin-worker.js +45 -0
  15. package/dist/browser/solvers/pumpkin.js +1777 -0
  16. package/dist/browser/solvers/pumpkin.min.js +1 -0
  17. package/dist/browser/solvers/pumpkin.wasm +0 -0
  18. package/dist/browser/solvers/pumpkin.wasm.LICENSE +21 -0
  19. package/dist/browser/solvers/z3.js +1600 -1335
  20. package/dist/browser/solvers/z3.min.js +2 -2
  21. package/dist/browser/washi.js +3374 -1377
  22. package/dist/browser/washi.min.js +5 -3
  23. package/dist/lib/__vite-browser-external-oLchLuMx.js +7 -0
  24. package/dist/lib/highs-browser-runtime.js +1846 -1618
  25. package/dist/lib/highs-runtime.js +16 -2
  26. package/dist/lib/highs-worker.js +26 -11
  27. package/dist/lib/highs.wasm +0 -0
  28. package/dist/lib/{loader-BZUQNvh4.js → loader-CDpPXN_F.js} +138 -116
  29. package/dist/lib/registry-dx7x4e5c.js +1694 -0
  30. package/dist/lib/rolldown-runtime-DtPi1Y-2.js +13 -0
  31. package/dist/lib/solvers/glpk.js +161 -121
  32. package/dist/lib/solvers/pumpkin-assets.js +1 -0
  33. package/dist/lib/solvers/pumpkin-loader-Ow74Fa1B.js +311 -0
  34. package/dist/lib/solvers/pumpkin-node-runtime.js +15 -0
  35. package/dist/lib/solvers/pumpkin-worker-factory.js +1 -0
  36. package/dist/lib/solvers/pumpkin-worker.js +45 -0
  37. package/dist/lib/solvers/pumpkin.js +1767 -0
  38. package/dist/lib/solvers/pumpkin.wasm +0 -0
  39. package/dist/lib/solvers/pumpkin.wasm.LICENSE +21 -0
  40. package/dist/lib/solvers/z3.js +486 -306
  41. package/dist/lib/washi.js +2563 -1154
  42. package/dist/types/decomposition/benders.d.ts.map +1 -1
  43. package/dist/types/index.d.ts +3 -3
  44. package/dist/types/index.d.ts.map +1 -1
  45. package/dist/types/modeler/boolean-expr.d.ts +137 -29
  46. package/dist/types/modeler/boolean-expr.d.ts.map +1 -1
  47. package/dist/types/modeler/constraint.d.ts +40 -4
  48. package/dist/types/modeler/constraint.d.ts.map +1 -1
  49. package/dist/types/modeler/expression.d.ts +129 -2
  50. package/dist/types/modeler/expression.d.ts.map +1 -1
  51. package/dist/types/modeler/index.d.ts +4 -5
  52. package/dist/types/modeler/index.d.ts.map +1 -1
  53. package/dist/types/modeler/linearizer.d.ts +11 -2
  54. package/dist/types/modeler/linearizer.d.ts.map +1 -1
  55. package/dist/types/modeler/lp-writer.d.ts.map +1 -1
  56. package/dist/types/modeler/model.d.ts +85 -124
  57. package/dist/types/modeler/model.d.ts.map +1 -1
  58. package/dist/types/modeler/parser.d.ts.map +1 -1
  59. package/dist/types/modeler/quad-expr.d.ts +8 -2
  60. package/dist/types/modeler/quad-expr.d.ts.map +1 -1
  61. package/dist/types/modeler/solution-validator.d.ts +12 -12
  62. package/dist/types/modeler/solution-validator.d.ts.map +1 -1
  63. package/dist/types/modeler/solvers/glpk/loader.d.ts +4 -0
  64. package/dist/types/modeler/solvers/glpk/loader.d.ts.map +1 -1
  65. package/dist/types/modeler/solvers/glpk/solver.d.ts +2 -2
  66. package/dist/types/modeler/solvers/glpk/solver.d.ts.map +1 -1
  67. package/dist/types/modeler/solvers/highs/driver.d.ts.map +1 -1
  68. package/dist/types/modeler/solvers/highs/loader.d.ts +8 -6
  69. package/dist/types/modeler/solvers/highs/loader.d.ts.map +1 -1
  70. package/dist/types/modeler/solvers/highs/solver.d.ts.map +1 -1
  71. package/dist/types/modeler/solvers/highs/worker-client.d.ts +16 -0
  72. package/dist/types/modeler/solvers/highs/worker-client.d.ts.map +1 -1
  73. package/dist/types/modeler/solvers/mock.d.ts +2 -3
  74. package/dist/types/modeler/solvers/mock.d.ts.map +1 -1
  75. package/dist/types/modeler/solvers/pumpkin/assets.d.ts +2 -0
  76. package/dist/types/modeler/solvers/pumpkin/assets.d.ts.map +1 -0
  77. package/dist/types/modeler/solvers/pumpkin/index.d.ts +6 -0
  78. package/dist/types/modeler/solvers/pumpkin/index.d.ts.map +1 -0
  79. package/dist/types/modeler/solvers/pumpkin/loader.d.ts +40 -0
  80. package/dist/types/modeler/solvers/pumpkin/loader.d.ts.map +1 -0
  81. package/dist/types/modeler/solvers/pumpkin/node-runtime.d.ts +3 -0
  82. package/dist/types/modeler/solvers/pumpkin/node-runtime.d.ts.map +1 -0
  83. package/dist/types/modeler/solvers/pumpkin/solver.d.ts +23 -0
  84. package/dist/types/modeler/solvers/pumpkin/solver.d.ts.map +1 -0
  85. package/dist/types/modeler/solvers/pumpkin/worker-client.d.ts +74 -0
  86. package/dist/types/modeler/solvers/pumpkin/worker-client.d.ts.map +1 -0
  87. package/dist/types/modeler/solvers/pumpkin/worker-factory.d.ts +3 -0
  88. package/dist/types/modeler/solvers/pumpkin/worker-factory.d.ts.map +1 -0
  89. package/dist/types/modeler/solvers/pumpkin/worker.d.ts +7 -0
  90. package/dist/types/modeler/solvers/pumpkin/worker.d.ts.map +1 -0
  91. package/dist/types/modeler/solvers/pumpkin.d.ts +2 -0
  92. package/dist/types/modeler/solvers/pumpkin.d.ts.map +1 -0
  93. package/dist/types/modeler/solvers/registry.d.ts.map +1 -1
  94. package/dist/types/modeler/solvers/types.d.ts +7 -9
  95. package/dist/types/modeler/solvers/types.d.ts.map +1 -1
  96. package/dist/types/modeler/solvers/z3/loader.d.ts +4 -0
  97. package/dist/types/modeler/solvers/z3/loader.d.ts.map +1 -1
  98. package/dist/types/modeler/solvers/z3/solver.d.ts +2 -15
  99. package/dist/types/modeler/solvers/z3/solver.d.ts.map +1 -1
  100. package/dist/types/modeler/types.d.ts +12 -15
  101. package/dist/types/modeler/types.d.ts.map +1 -1
  102. package/dist/types/modeler/validation.d.ts +26 -2
  103. package/dist/types/modeler/validation.d.ts.map +1 -1
  104. package/dist/types/modeler/variable.d.ts +9 -5
  105. package/dist/types/modeler/variable.d.ts.map +1 -1
  106. package/docs/examples/index.md +6 -1
  107. package/docs/examples/project-scheduling.md +106 -0
  108. package/docs/examples/shift-scheduling.md +3 -0
  109. package/docs/examples/smt-security.md +1 -0
  110. package/docs/examples/traveling-salesperson.md +1 -1
  111. package/docs/examples/unsat-core.md +3 -2
  112. package/docs/getting-started/ai-agents.md +94 -25
  113. package/docs/getting-started/coding-agents.md +158 -0
  114. package/docs/getting-started/cross-origin.md +2 -2
  115. package/docs/getting-started/index.md +40 -41
  116. package/docs/getting-started/runtimes.md +42 -18
  117. package/docs/guide/constraint-programming.md +141 -0
  118. package/docs/guide/constraints.md +64 -14
  119. package/docs/guide/decomposition.md +59 -59
  120. package/docs/guide/expressions.md +42 -10
  121. package/docs/guide/formulation-tips.md +6 -6
  122. package/docs/guide/objectives.md +65 -62
  123. package/docs/guide/unsat-core.md +36 -27
  124. package/docs/guide/variables.md +30 -17
  125. package/docs/solvers/custom-solver.md +18 -13
  126. package/docs/solvers/highs.md +18 -23
  127. package/docs/solvers/index.md +12 -6
  128. package/docs/solvers/pumpkin.md +163 -0
  129. package/docs/solvers/z3.md +2 -2
  130. package/llms-full.txt +944 -314
  131. package/llms.txt +43 -22
  132. package/package.json +38 -11
  133. package/skills/washi/SKILL.md +79 -27
  134. package/dist/browser/_washi-node-only-BvRk9kiK.js +0 -0
  135. package/dist/browser/browser-runtime-TLCY0hkc.js +0 -1793
  136. package/dist/lib/_washi-node-only-BvRk9kiK.js +0 -0
  137. package/dist/lib/registry-D7TZ3Wh_.js +0 -1034
  138. package/docs/ja/getting-started/ai-agents.md +0 -280
  139. package/docs/zh/getting-started/ai-agents.md +0 -280
@@ -0,0 +1,311 @@
1
+ import { getBundledPumpkinWasmUrl as e } from "./pumpkin-assets.js";
2
+ //#region src/modeler/solvers/pumpkin/runtime.js
3
+ function t() {
4
+ function e(e) {
5
+ let t, n;
6
+ try {
7
+ let r = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), i = g, a = _.check_json(r, i);
8
+ return t = a[0], n = a[1], o(a[0], a[1]);
9
+ } finally {
10
+ _.__wbindgen_free(t, n, 1);
11
+ }
12
+ }
13
+ function t(e, t) {
14
+ let n, r;
15
+ try {
16
+ let i = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), s = g, c = _.check_with_callback(i, s, u(t) ? 0 : a(t));
17
+ return n = c[0], r = c[1], o(c[0], c[1]);
18
+ } finally {
19
+ _.__wbindgen_free(n, r, 1);
20
+ }
21
+ }
22
+ function n(e) {
23
+ let t, n;
24
+ try {
25
+ let r = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), i = g, a = _.solve_json(r, i);
26
+ return t = a[0], n = a[1], o(a[0], a[1]);
27
+ } finally {
28
+ _.__wbindgen_free(t, n, 1);
29
+ }
30
+ }
31
+ function r(e, t, n) {
32
+ let r, i;
33
+ try {
34
+ let s = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), c = g, l = _.solve_with_callback(s, c, u(t) ? 0 : a(t), u(n) ? 0 : a(n));
35
+ return r = l[0], i = l[1], o(l[0], l[1]);
36
+ } finally {
37
+ _.__wbindgen_free(r, i, 1);
38
+ }
39
+ }
40
+ function i() {
41
+ return {
42
+ __proto__: null,
43
+ "./pumpkin_bg.js": {
44
+ __proto__: null,
45
+ __wbg___wbindgen_boolean_get_4f1baf9a00be3c74: function(e) {
46
+ let t = e, n = typeof t == "boolean" ? t : void 0;
47
+ return u(n) ? 16777215 : +!!n;
48
+ },
49
+ __wbg___wbindgen_is_undefined_be5b34249ff1fc15: function(e) {
50
+ return e === void 0;
51
+ },
52
+ __wbg___wbindgen_throw_4c88d8bf264fd984: function(e, t) {
53
+ throw Error(o(e, t));
54
+ },
55
+ __wbg_call_40b008ba32f73991: function() {
56
+ return l(function(e, t) {
57
+ return e.call(t);
58
+ }, arguments);
59
+ },
60
+ __wbg_call_a410eb4b59ed5965: function() {
61
+ return l(function(e, t, n) {
62
+ return e.call(t, n);
63
+ }, arguments);
64
+ },
65
+ __wbg_now_e7c6795a7f81e10f: function(e) {
66
+ return e.now();
67
+ },
68
+ __wbg_performance_7e4e4494fdc9d07a: function(e) {
69
+ return e.performance;
70
+ },
71
+ __wbg_static_accessor_GLOBAL_THIS_003ee833af9699fc: function() {
72
+ let e = typeof globalThis > "u" ? void 0 : globalThis;
73
+ return u(e) ? 0 : a(e);
74
+ },
75
+ __wbg_static_accessor_GLOBAL_e4293fb22cbe77da: function() {
76
+ let e = typeof global > "u" ? void 0 : global;
77
+ return u(e) ? 0 : a(e);
78
+ },
79
+ __wbg_static_accessor_SELF_53bb20457401453d: function() {
80
+ let e = typeof self > "u" ? void 0 : self;
81
+ return u(e) ? 0 : a(e);
82
+ },
83
+ __wbg_static_accessor_WINDOW_b5e0810bfecb7feb: function() {
84
+ let e = typeof window > "u" ? void 0 : window;
85
+ return u(e) ? 0 : a(e);
86
+ },
87
+ __wbindgen_generic_0000000000000001: function(e, t) {
88
+ return o(e, t);
89
+ },
90
+ __wbindgen_init_externref_table: function() {
91
+ let e = _.__wbindgen_externrefs;
92
+ e.set(0, void 0), e.set(1024, void 0), e.set(1025, null), e.set(1026, !0), e.set(1027, !1);
93
+ }
94
+ }
95
+ };
96
+ }
97
+ function a(e) {
98
+ let t = _.__externref_table_alloc();
99
+ return _.__wbindgen_externrefs.set(t, e), t;
100
+ }
101
+ function o(e, t) {
102
+ return e >>>= 0, m(c().subarray(e, e + t));
103
+ }
104
+ let s = null;
105
+ function c() {
106
+ return (s === null || s.byteLength === 0) && (s = new Uint8Array(_.memory.buffer)), s;
107
+ }
108
+ function l(e, t) {
109
+ try {
110
+ return e.apply(this, t);
111
+ } catch (e) {
112
+ let t = a(e);
113
+ _.__wbindgen_exn_store(t);
114
+ }
115
+ }
116
+ function u(e) {
117
+ return e == null;
118
+ }
119
+ function d(e, t, n) {
120
+ if (n === void 0) {
121
+ let n = h.encode(e), r = t(n.length, 1) >>> 0;
122
+ return c().subarray(r, r + n.length).set(n), g = n.length, r;
123
+ }
124
+ let r = e.length, i = t(r, 1) >>> 0, a = c(), o = 0;
125
+ for (; o < r; o++) {
126
+ let t = e.charCodeAt(o);
127
+ if (t > 127) break;
128
+ a[i + o] = t;
129
+ }
130
+ if (o !== r) {
131
+ o !== 0 && (e = e.slice(o)), i = n(i, r, r = o + e.length * 3, 1) >>> 0;
132
+ let t = c().subarray(i + o, i + r), a = h.encodeInto(e, t);
133
+ o += a.written, i = n(i, r, o, 1) >>> 0;
134
+ }
135
+ return g = o, i;
136
+ }
137
+ let f = new TextDecoder("utf-8", { ignoreBOM: !0 });
138
+ f.decode();
139
+ let p = 0;
140
+ function m(e) {
141
+ return p += e.length, p >= 2146435072 && (f = new TextDecoder("utf-8", { ignoreBOM: !0 }), f.decode(), p = e.length), f.decode(e);
142
+ }
143
+ let h = new TextEncoder();
144
+ "encodeInto" in h || (h.encodeInto = function(e, t) {
145
+ let n = h.encode(e);
146
+ return t.set(n), {
147
+ read: e.length,
148
+ written: n.length
149
+ };
150
+ });
151
+ let g = 0, _;
152
+ function v(e, t) {
153
+ if (_ = e.exports, s = null, !_ || !(_.memory instanceof WebAssembly.Memory) || typeof _.__wbindgen_start != "function" || typeof _.__wbindgen_malloc != "function" || typeof _.__wbindgen_free != "function" || typeof _.check_json != "function" || typeof _.check_with_callback != "function" || typeof _.solve_json != "function" || typeof _.solve_with_callback != "function") throw Error("[WaSHI] Invalid Pumpkin WebAssembly module: missing expected solver exports.");
154
+ return _.__wbindgen_start(), _;
155
+ }
156
+ async function y(e, t) {
157
+ if (typeof Response == "function" && e instanceof Response) {
158
+ if (!e.ok) throw Error(`failed to fetch Wasm: ${e.status} ${e.statusText} fetching '${e.url}'`);
159
+ if (typeof WebAssembly.instantiateStreaming == "function") try {
160
+ return await WebAssembly.instantiateStreaming(e, t);
161
+ } catch (t) {
162
+ if (n(e.type) && e.headers.get("Content-Type") !== "application/wasm") console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", t);
163
+ else throw t;
164
+ }
165
+ let r = await e.arrayBuffer();
166
+ return await WebAssembly.instantiate(r, t);
167
+ }
168
+ {
169
+ let n = await WebAssembly.instantiate(e, t);
170
+ return n instanceof WebAssembly.Instance ? {
171
+ instance: n,
172
+ module: e
173
+ } : n;
174
+ }
175
+ function n(e) {
176
+ switch (e) {
177
+ case "basic":
178
+ case "cors":
179
+ case "default": return !0;
180
+ }
181
+ return !1;
182
+ }
183
+ }
184
+ let b;
185
+ async function x(e) {
186
+ return _ === void 0 ? (b === void 0 && (b = S(e), b.catch(() => {
187
+ b = void 0;
188
+ })), b) : _;
189
+ }
190
+ async function S(e) {
191
+ 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"));
192
+ let t = i();
193
+ (typeof e == "string" || typeof Request == "function" && e instanceof Request || typeof URL == "function" && e instanceof URL) && (e = fetch(e));
194
+ let { instance: n, module: r } = await y(await e, t);
195
+ return v(n, r);
196
+ }
197
+ return {
198
+ check_json: e,
199
+ check_with_callback: t,
200
+ solve_json: n,
201
+ solve_with_callback: r,
202
+ __wbg_init: x
203
+ };
204
+ }
205
+ async function n(e) {
206
+ let n = t();
207
+ return await n.__wbg_init({ module_or_path: e }), {
208
+ check_json: n.check_json,
209
+ check_with_callback: n.check_with_callback,
210
+ solve_json: n.solve_json,
211
+ solve_with_callback: n.solve_with_callback
212
+ };
213
+ }
214
+ //#endregion
215
+ //#region src/modeler/solvers/pumpkin/loader.ts
216
+ var r = 4, i = null, a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = 0, c = null;
217
+ function l(e) {
218
+ c = e;
219
+ }
220
+ function u() {
221
+ return typeof process < "u" && !!process.versions?.node && process.release?.name === "node";
222
+ }
223
+ function d(e) {
224
+ return e.byteLength >= 8 && e[0] === 0 && e[1] === 97 && e[2] === 115 && e[3] === 109;
225
+ }
226
+ function f(e) {
227
+ if (e !== null && typeof e != "string") throw Error(`Invalid pumpkin.wasm URL: expected string or null, got ${typeof e}.`);
228
+ if (e === "") throw Error("Invalid pumpkin.wasm URL: expected non-empty string or null (received empty string \"\").");
229
+ e !== i && (i = e, h());
230
+ }
231
+ function p() {
232
+ return i;
233
+ }
234
+ function m() {
235
+ return i ?? e();
236
+ }
237
+ function h() {
238
+ s++, a.clear(), o.clear(), c?.();
239
+ }
240
+ function g(e) {
241
+ let t = y(e) ?? "__bundled__";
242
+ return o.has(t);
243
+ }
244
+ function _() {
245
+ if (typeof Worker > "u" || typeof window > "u" || typeof Worker.prototype.unref == "function") return !1;
246
+ let e = typeof window.origin == "string" ? window.origin : (() => {
247
+ try {
248
+ return window.location?.origin;
249
+ } catch {
250
+ return;
251
+ }
252
+ })();
253
+ return !(!e || e === "null" || e.startsWith("file:"));
254
+ }
255
+ async function v(e) {
256
+ if (typeof fetch != "function") throw Error(`[WaSHI] Global fetch() is unavailable to load Pumpkin WebAssembly from "${e}"; no CDN fallback is attempted.`);
257
+ let t;
258
+ try {
259
+ t = await fetch(e);
260
+ } catch (t) {
261
+ throw Error(`[WaSHI] Failed to fetch pumpkin.wasm from "${e}" (no CDN fallback is attempted): ${t instanceof Error ? t.message : String(t)}. Ensure pumpkin.wasm is hosted cleanly or call setPumpkinWasmUrl(url).`);
262
+ }
263
+ if (!t.ok) throw Error(`[WaSHI] Failed to fetch pumpkin.wasm from "${e}": HTTP ${t.status} ${t.statusText}; no CDN fallback is attempted.`);
264
+ let n = t.headers?.get("content-type")?.toLowerCase() ?? "";
265
+ if (n.includes("text/html")) throw Error(`[WaSHI] Invalid response while loading pumpkin.wasm from "${e}": received HTML ("${n}") instead of a WebAssembly binary; no CDN fallback is attempted.`);
266
+ let r = await t.arrayBuffer(), i = new Uint8Array(r);
267
+ if (!d(i)) throw Error(`[WaSHI] Invalid WebAssembly binary loaded from "${e}": expected \\0asm magic header; no CDN fallback is attempted.`);
268
+ return i;
269
+ }
270
+ function y(e) {
271
+ if (e === void 0) return i;
272
+ if (e !== null && typeof e != "string") throw Error(`Invalid pumpkin.wasm URL: expected string or null, got ${typeof e}.`);
273
+ if (e === "") throw Error("Invalid pumpkin.wasm URL: expected non-empty string or null (received empty string \"\").");
274
+ return e;
275
+ }
276
+ async function b(t) {
277
+ if (t !== null) {
278
+ if (u() && t.startsWith("file://")) {
279
+ let { readPumpkinWasmFileUrl: e } = await import("./pumpkin-node-runtime.js"), n = await e(new URL(t));
280
+ if (!d(n)) throw Error(`[WaSHI] Invalid WebAssembly binary at "${t}": expected \\0asm magic header.`);
281
+ return n;
282
+ }
283
+ return v(t);
284
+ }
285
+ if (u() && typeof window > "u") {
286
+ let { readBundledPumpkinWasmBytes: e } = await import("./pumpkin-node-runtime.js"), t = await e();
287
+ if (!d(t)) throw Error("[WaSHI] Bundled pumpkin.wasm on disk has an invalid WebAssembly magic header.");
288
+ return t;
289
+ }
290
+ return v(e());
291
+ }
292
+ async function x(e) {
293
+ let t = y(e), i = t ?? "__bundled__", c = a.get(i);
294
+ if (c) return a.delete(i), a.set(i, c), c;
295
+ let l = s, u = null;
296
+ for (u = (async () => {
297
+ try {
298
+ let e = await n(await b(t));
299
+ return s === l && a.get(i) === u && o.add(i), e;
300
+ } catch (e) {
301
+ throw s === l && (o.delete(i), a.get(i) === u && a.delete(i)), t !== null && e instanceof Error && e.message.includes("Invalid Pumpkin WebAssembly module") ? Error(`[WaSHI] Invalid Pumpkin WebAssembly module loaded from "${t}" (${e.message}); no CDN fallback is attempted.`) : e;
302
+ }
303
+ })(); a.size >= r;) {
304
+ let e = a.keys().next().value;
305
+ if (e === void 0) break;
306
+ a.delete(e), o.delete(e);
307
+ }
308
+ return a.set(i, u), u;
309
+ }
310
+ //#endregion
311
+ export { l as a, f as c, x as i, _ as l, g as n, h as o, d as r, m as s, p as t };
@@ -0,0 +1,15 @@
1
+ export async function readPumpkinWasmFileUrl(fileUrl) {
2
+ const [{ readFile }] = await Promise.all([import(/* webpackIgnore: true */ /* @vite-ignore */ "node:fs/promises")]);
3
+ const buf = await readFile(fileUrl);
4
+ return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
5
+ }
6
+ export async function readBundledPumpkinWasmBytes() {
7
+ const [{ fileURLToPath }] = await Promise.all([import(/* webpackIgnore: true */ /* @vite-ignore */ "node:url")]);
8
+ const tried = [];
9
+ for (const rel of ["./pumpkin.wasm", "../../public/pumpkin.wasm"]) {
10
+ const fileUrl = new URL(rel, import.meta.url);
11
+ tried.push(fileURLToPath(fileUrl));
12
+ try { return await readPumpkinWasmFileUrl(fileUrl); } catch {}
13
+ }
14
+ throw new Error(`[WaSHI] Bundled pumpkin.wasm could not be found in Node.js (tried: ${tried.join(", ")}); no CDN fallback is attempted.`);
15
+ }
@@ -0,0 +1 @@
1
+ export function createPumpkinWorker() { return new Worker(new URL("./pumpkin-worker.js", import.meta.url), { type: "module" }); }
@@ -0,0 +1,45 @@
1
+ import { i as e } from "./pumpkin-loader-Ow74Fa1B.js";
2
+ //#region src/modeler/solvers/pumpkin/worker.ts
3
+ var t = globalThis;
4
+ t.onmessage = async (n) => {
5
+ let { id: r, type: i, requestJson: a, wasmUrl: o } = n.data;
6
+ try {
7
+ let n = await e(o === void 0 ? null : o), s = performance.now();
8
+ if (i === "check") {
9
+ let e = n.check_with_callback(a, null), i = Math.max((performance.now() - s) / 1e3, 1e-6);
10
+ t.postMessage({
11
+ id: r,
12
+ type: "CHECK_SUCCESS",
13
+ responseJson: e,
14
+ runTime: i
15
+ });
16
+ return;
17
+ }
18
+ if (i === "solve") {
19
+ let e = n.solve_with_callback(a, (e) => {
20
+ let n = Math.max((performance.now() - s) / 1e3, 1e-6);
21
+ return t.postMessage({
22
+ id: r,
23
+ type: "SOLVE_PROGRESS",
24
+ payloadJson: e,
25
+ elapsedTime: n
26
+ }), !1;
27
+ }, null), i = Math.max((performance.now() - s) / 1e3, 1e-6);
28
+ t.postMessage({
29
+ id: r,
30
+ type: "SOLVE_SUCCESS",
31
+ responseJson: e,
32
+ runTime: i
33
+ });
34
+ return;
35
+ }
36
+ throw Error(`[WaSHI] Unknown Pumpkin worker command "${String(i)}".`);
37
+ } catch (e) {
38
+ t.postMessage({
39
+ id: r,
40
+ type: "SOLVER_ERROR",
41
+ error: e instanceof Error ? e.message : String(e)
42
+ });
43
+ }
44
+ };
45
+ //#endregion