@ohtaman/washi 0.6.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 (147) hide show
  1. package/README.ja.md +139 -418
  2. package/README.md +139 -418
  3. package/README.zh-CN.md +139 -418
  4. package/THIRD_PARTY_LICENSES.md +39 -4
  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 +3828 -1315
  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 +3054 -1202
  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 +176 -28
  50. package/dist/types/modeler/expression.d.ts.map +1 -1
  51. package/dist/types/modeler/index.d.ts +5 -6
  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 +97 -130
  57. package/dist/types/modeler/model.d.ts.map +1 -1
  58. package/dist/types/modeler/parser.d.ts +25 -5
  59. package/dist/types/modeler/parser.d.ts.map +1 -1
  60. package/dist/types/modeler/quad-expr.d.ts +8 -2
  61. package/dist/types/modeler/quad-expr.d.ts.map +1 -1
  62. package/dist/types/modeler/solution-validator.d.ts +12 -12
  63. package/dist/types/modeler/solution-validator.d.ts.map +1 -1
  64. package/dist/types/modeler/solvers/glpk/loader.d.ts +4 -0
  65. package/dist/types/modeler/solvers/glpk/loader.d.ts.map +1 -1
  66. package/dist/types/modeler/solvers/glpk/solver.d.ts +2 -2
  67. package/dist/types/modeler/solvers/glpk/solver.d.ts.map +1 -1
  68. package/dist/types/modeler/solvers/highs/driver.d.ts.map +1 -1
  69. package/dist/types/modeler/solvers/highs/loader.d.ts +8 -6
  70. package/dist/types/modeler/solvers/highs/loader.d.ts.map +1 -1
  71. package/dist/types/modeler/solvers/highs/solver.d.ts.map +1 -1
  72. package/dist/types/modeler/solvers/highs/worker-client.d.ts +16 -0
  73. package/dist/types/modeler/solvers/highs/worker-client.d.ts.map +1 -1
  74. package/dist/types/modeler/solvers/mock.d.ts +2 -3
  75. package/dist/types/modeler/solvers/mock.d.ts.map +1 -1
  76. package/dist/types/modeler/solvers/pumpkin/assets.d.ts +2 -0
  77. package/dist/types/modeler/solvers/pumpkin/assets.d.ts.map +1 -0
  78. package/dist/types/modeler/solvers/pumpkin/index.d.ts +6 -0
  79. package/dist/types/modeler/solvers/pumpkin/index.d.ts.map +1 -0
  80. package/dist/types/modeler/solvers/pumpkin/loader.d.ts +40 -0
  81. package/dist/types/modeler/solvers/pumpkin/loader.d.ts.map +1 -0
  82. package/dist/types/modeler/solvers/pumpkin/node-runtime.d.ts +3 -0
  83. package/dist/types/modeler/solvers/pumpkin/node-runtime.d.ts.map +1 -0
  84. package/dist/types/modeler/solvers/pumpkin/solver.d.ts +23 -0
  85. package/dist/types/modeler/solvers/pumpkin/solver.d.ts.map +1 -0
  86. package/dist/types/modeler/solvers/pumpkin/worker-client.d.ts +74 -0
  87. package/dist/types/modeler/solvers/pumpkin/worker-client.d.ts.map +1 -0
  88. package/dist/types/modeler/solvers/pumpkin/worker-factory.d.ts +3 -0
  89. package/dist/types/modeler/solvers/pumpkin/worker-factory.d.ts.map +1 -0
  90. package/dist/types/modeler/solvers/pumpkin/worker.d.ts +7 -0
  91. package/dist/types/modeler/solvers/pumpkin/worker.d.ts.map +1 -0
  92. package/dist/types/modeler/solvers/pumpkin.d.ts +2 -0
  93. package/dist/types/modeler/solvers/pumpkin.d.ts.map +1 -0
  94. package/dist/types/modeler/solvers/registry.d.ts.map +1 -1
  95. package/dist/types/modeler/solvers/types.d.ts +9 -9
  96. package/dist/types/modeler/solvers/types.d.ts.map +1 -1
  97. package/dist/types/modeler/solvers/z3/loader.d.ts +4 -0
  98. package/dist/types/modeler/solvers/z3/loader.d.ts.map +1 -1
  99. package/dist/types/modeler/solvers/z3/solver.d.ts +2 -15
  100. package/dist/types/modeler/solvers/z3/solver.d.ts.map +1 -1
  101. package/dist/types/modeler/types.d.ts +12 -15
  102. package/dist/types/modeler/types.d.ts.map +1 -1
  103. package/dist/types/modeler/validation.d.ts +26 -2
  104. package/dist/types/modeler/validation.d.ts.map +1 -1
  105. package/dist/types/modeler/variable.d.ts +9 -5
  106. package/dist/types/modeler/variable.d.ts.map +1 -1
  107. package/docs/examples/diet-sensitivity.md +15 -14
  108. package/docs/examples/ecommerce-coupons.md +15 -22
  109. package/docs/examples/index.md +20 -13
  110. package/docs/examples/knapsack.md +8 -7
  111. package/docs/examples/portfolio-qp.md +11 -4
  112. package/docs/examples/production.md +4 -4
  113. package/docs/examples/project-scheduling.md +106 -0
  114. package/docs/examples/shift-scheduling.md +23 -7
  115. package/docs/examples/smt-security.md +17 -4
  116. package/docs/examples/transportation.md +46 -19
  117. package/docs/examples/traveling-salesperson.md +29 -45
  118. package/docs/examples/unsat-core.md +16 -5
  119. package/docs/examples/vehicle-routing.md +10 -8
  120. package/docs/getting-started/ai-agents.md +114 -34
  121. package/docs/getting-started/coding-agents.md +158 -0
  122. package/docs/getting-started/cross-origin.md +56 -28
  123. package/docs/getting-started/index.md +36 -66
  124. package/docs/getting-started/runtimes.md +98 -69
  125. package/docs/guide/constraint-programming.md +141 -0
  126. package/docs/guide/constraints.md +100 -44
  127. package/docs/guide/decomposition.md +141 -273
  128. package/docs/guide/expressions.md +125 -42
  129. package/docs/guide/formulation-tips.md +212 -0
  130. package/docs/guide/objectives.md +70 -64
  131. package/docs/guide/unsat-core.md +44 -23
  132. package/docs/guide/variables.md +56 -48
  133. package/docs/solvers/custom-solver.md +18 -13
  134. package/docs/solvers/highs.md +41 -25
  135. package/docs/solvers/index.md +13 -7
  136. package/docs/solvers/pumpkin.md +163 -0
  137. package/docs/solvers/z3.md +4 -1
  138. package/llms-full.txt +1732 -860
  139. package/llms.txt +59 -36
  140. package/package.json +40 -13
  141. package/skills/washi/SKILL.md +91 -35
  142. package/dist/browser/_washi-node-only-BvRk9kiK.js +0 -0
  143. package/dist/browser/browser-runtime-TLCY0hkc.js +0 -1793
  144. package/dist/lib/_washi-node-only-BvRk9kiK.js +0 -0
  145. package/dist/lib/registry-C20sxTwm.js +0 -964
  146. package/docs/ja/getting-started/ai-agents.md +0 -270
  147. package/docs/zh/getting-started/ai-agents.md +0 -270
@@ -0,0 +1,9 @@
1
+ //#region \0washi-pumpkin-node-runtime
2
+ async function e() {
3
+ throw Error("This distribution is for browsers. Use the npm entry in Node.js.");
4
+ }
5
+ async function t() {
6
+ throw Error("This distribution is for browsers. Use the npm entry in Node.js.");
7
+ }
8
+ //#endregion
9
+ export { t as readBundledPumpkinWasmBytes, e as readPumpkinWasmFileUrl };
@@ -0,0 +1,320 @@
1
+ //#region \0washi-browser-pumpkin-assets
2
+ var e = import.meta.url;
3
+ function t(t) {
4
+ if (!e) throw Error("[WaSHI] Load the browser IIFE using an external script src, or use the browser ESM build.");
5
+ return new URL(t, e).href;
6
+ }
7
+ function n() {
8
+ return t("pumpkin.wasm");
9
+ }
10
+ //#endregion
11
+ //#region src/modeler/solvers/pumpkin/runtime.js
12
+ function r() {
13
+ function e(e) {
14
+ let t, n;
15
+ try {
16
+ let r = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), i = g, a = _.check_json(r, i);
17
+ return t = a[0], n = a[1], o(a[0], a[1]);
18
+ } finally {
19
+ _.__wbindgen_free(t, n, 1);
20
+ }
21
+ }
22
+ function t(e, t) {
23
+ let n, r;
24
+ try {
25
+ let i = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), s = g, c = _.check_with_callback(i, s, u(t) ? 0 : a(t));
26
+ return n = c[0], r = c[1], o(c[0], c[1]);
27
+ } finally {
28
+ _.__wbindgen_free(n, r, 1);
29
+ }
30
+ }
31
+ function n(e) {
32
+ let t, n;
33
+ try {
34
+ let r = d(e, _.__wbindgen_malloc, _.__wbindgen_realloc), i = g, a = _.solve_json(r, i);
35
+ return t = a[0], n = a[1], o(a[0], a[1]);
36
+ } finally {
37
+ _.__wbindgen_free(t, n, 1);
38
+ }
39
+ }
40
+ function r(e, t, n) {
41
+ let r, i;
42
+ try {
43
+ 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));
44
+ return r = l[0], i = l[1], o(l[0], l[1]);
45
+ } finally {
46
+ _.__wbindgen_free(r, i, 1);
47
+ }
48
+ }
49
+ function i() {
50
+ return {
51
+ __proto__: null,
52
+ "./pumpkin_bg.js": {
53
+ __proto__: null,
54
+ __wbg___wbindgen_boolean_get_4f1baf9a00be3c74: function(e) {
55
+ let t = e, n = typeof t == "boolean" ? t : void 0;
56
+ return u(n) ? 16777215 : +!!n;
57
+ },
58
+ __wbg___wbindgen_is_undefined_be5b34249ff1fc15: function(e) {
59
+ return e === void 0;
60
+ },
61
+ __wbg___wbindgen_throw_4c88d8bf264fd984: function(e, t) {
62
+ throw Error(o(e, t));
63
+ },
64
+ __wbg_call_40b008ba32f73991: function() {
65
+ return l(function(e, t) {
66
+ return e.call(t);
67
+ }, arguments);
68
+ },
69
+ __wbg_call_a410eb4b59ed5965: function() {
70
+ return l(function(e, t, n) {
71
+ return e.call(t, n);
72
+ }, arguments);
73
+ },
74
+ __wbg_now_e7c6795a7f81e10f: function(e) {
75
+ return e.now();
76
+ },
77
+ __wbg_performance_7e4e4494fdc9d07a: function(e) {
78
+ return e.performance;
79
+ },
80
+ __wbg_static_accessor_GLOBAL_THIS_003ee833af9699fc: function() {
81
+ let e = typeof globalThis > "u" ? void 0 : globalThis;
82
+ return u(e) ? 0 : a(e);
83
+ },
84
+ __wbg_static_accessor_GLOBAL_e4293fb22cbe77da: function() {
85
+ let e = typeof globalThis > "u" ? void 0 : globalThis;
86
+ return u(e) ? 0 : a(e);
87
+ },
88
+ __wbg_static_accessor_SELF_53bb20457401453d: function() {
89
+ let e = typeof self > "u" ? void 0 : self;
90
+ return u(e) ? 0 : a(e);
91
+ },
92
+ __wbg_static_accessor_WINDOW_b5e0810bfecb7feb: function() {
93
+ let e = typeof window > "u" ? void 0 : window;
94
+ return u(e) ? 0 : a(e);
95
+ },
96
+ __wbindgen_generic_0000000000000001: function(e, t) {
97
+ return o(e, t);
98
+ },
99
+ __wbindgen_init_externref_table: function() {
100
+ let e = _.__wbindgen_externrefs;
101
+ e.set(0, void 0), e.set(1024, void 0), e.set(1025, null), e.set(1026, !0), e.set(1027, !1);
102
+ }
103
+ }
104
+ };
105
+ }
106
+ function a(e) {
107
+ let t = _.__externref_table_alloc();
108
+ return _.__wbindgen_externrefs.set(t, e), t;
109
+ }
110
+ function o(e, t) {
111
+ return e >>>= 0, m(c().subarray(e, e + t));
112
+ }
113
+ let s = null;
114
+ function c() {
115
+ return (s === null || s.byteLength === 0) && (s = new Uint8Array(_.memory.buffer)), s;
116
+ }
117
+ function l(e, t) {
118
+ try {
119
+ return e.apply(this, t);
120
+ } catch (e) {
121
+ let t = a(e);
122
+ _.__wbindgen_exn_store(t);
123
+ }
124
+ }
125
+ function u(e) {
126
+ return e == null;
127
+ }
128
+ function d(e, t, n) {
129
+ if (n === void 0) {
130
+ let n = h.encode(e), r = t(n.length, 1) >>> 0;
131
+ return c().subarray(r, r + n.length).set(n), g = n.length, r;
132
+ }
133
+ let r = e.length, i = t(r, 1) >>> 0, a = c(), o = 0;
134
+ for (; o < r; o++) {
135
+ let t = e.charCodeAt(o);
136
+ if (t > 127) break;
137
+ a[i + o] = t;
138
+ }
139
+ if (o !== r) {
140
+ o !== 0 && (e = e.slice(o)), i = n(i, r, r = o + e.length * 3, 1) >>> 0;
141
+ let t = c().subarray(i + o, i + r), a = h.encodeInto(e, t);
142
+ o += a.written, i = n(i, r, o, 1) >>> 0;
143
+ }
144
+ return g = o, i;
145
+ }
146
+ let f = new TextDecoder("utf-8", { ignoreBOM: !0 });
147
+ f.decode();
148
+ let p = 0;
149
+ function m(e) {
150
+ return p += e.length, p >= 2146435072 && (f = new TextDecoder("utf-8", { ignoreBOM: !0 }), f.decode(), p = e.length), f.decode(e);
151
+ }
152
+ let h = new TextEncoder();
153
+ "encodeInto" in h || (h.encodeInto = function(e, t) {
154
+ let n = h.encode(e);
155
+ return t.set(n), {
156
+ read: e.length,
157
+ written: n.length
158
+ };
159
+ });
160
+ let g = 0, _;
161
+ function v(e, t) {
162
+ 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.");
163
+ return _.__wbindgen_start(), _;
164
+ }
165
+ async function y(e, t) {
166
+ if (typeof Response == "function" && e instanceof Response) {
167
+ if (!e.ok) throw Error(`failed to fetch Wasm: ${e.status} ${e.statusText} fetching '${e.url}'`);
168
+ if (typeof WebAssembly.instantiateStreaming == "function") try {
169
+ return await WebAssembly.instantiateStreaming(e, t);
170
+ } catch (t) {
171
+ 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);
172
+ else throw t;
173
+ }
174
+ let r = await e.arrayBuffer();
175
+ return await WebAssembly.instantiate(r, t);
176
+ }
177
+ {
178
+ let n = await WebAssembly.instantiate(e, t);
179
+ return n instanceof WebAssembly.Instance ? {
180
+ instance: n,
181
+ module: e
182
+ } : n;
183
+ }
184
+ function n(e) {
185
+ switch (e) {
186
+ case "basic":
187
+ case "cors":
188
+ case "default": return !0;
189
+ }
190
+ return !1;
191
+ }
192
+ }
193
+ let b;
194
+ async function x(e) {
195
+ return _ === void 0 ? (b === void 0 && (b = S(e), b.catch(() => {
196
+ b = void 0;
197
+ })), b) : _;
198
+ }
199
+ async function S(e) {
200
+ 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"));
201
+ let t = i();
202
+ (typeof e == "string" || typeof Request == "function" && e instanceof Request || typeof URL == "function" && e instanceof URL) && (e = fetch(e));
203
+ let { instance: n, module: r } = await y(await e, t);
204
+ return v(n, r);
205
+ }
206
+ return {
207
+ check_json: e,
208
+ check_with_callback: t,
209
+ solve_json: n,
210
+ solve_with_callback: r,
211
+ __wbg_init: x
212
+ };
213
+ }
214
+ async function i(e) {
215
+ let t = r();
216
+ return await t.__wbg_init({ module_or_path: e }), {
217
+ check_json: t.check_json,
218
+ check_with_callback: t.check_with_callback,
219
+ solve_json: t.solve_json,
220
+ solve_with_callback: t.solve_with_callback
221
+ };
222
+ }
223
+ //#endregion
224
+ //#region src/modeler/solvers/pumpkin/loader.ts
225
+ var a = 4, o = null, s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set(), l = 0, u = null;
226
+ function d(e) {
227
+ u = e;
228
+ }
229
+ function f() {
230
+ return !1;
231
+ }
232
+ function p(e) {
233
+ return e.byteLength >= 8 && e[0] === 0 && e[1] === 97 && e[2] === 115 && e[3] === 109;
234
+ }
235
+ function m(e) {
236
+ if (e !== null && typeof e != "string") throw Error(`Invalid pumpkin.wasm URL: expected string or null, got ${typeof e}.`);
237
+ if (e === "") throw Error("Invalid pumpkin.wasm URL: expected non-empty string or null (received empty string \"\").");
238
+ e !== o && (o = e, _());
239
+ }
240
+ function h() {
241
+ return o;
242
+ }
243
+ function g() {
244
+ return o ?? n();
245
+ }
246
+ function _() {
247
+ l++, s.clear(), c.clear(), u?.();
248
+ }
249
+ function v(e) {
250
+ let t = x(e) ?? "__bundled__";
251
+ return c.has(t);
252
+ }
253
+ function y() {
254
+ if (typeof Worker > "u" || typeof window > "u" || typeof Worker.prototype.unref == "function") return !1;
255
+ let e = typeof window.origin == "string" ? window.origin : (() => {
256
+ try {
257
+ return window.location?.origin;
258
+ } catch {
259
+ return;
260
+ }
261
+ })();
262
+ return !(!e || e === "null" || e.startsWith("file:"));
263
+ }
264
+ async function b(e) {
265
+ if (typeof fetch != "function") throw Error(`[WaSHI] Global fetch() is unavailable to load Pumpkin WebAssembly from "${e}"; no CDN fallback is attempted.`);
266
+ let t;
267
+ try {
268
+ t = await fetch(e);
269
+ } catch (t) {
270
+ 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).`);
271
+ }
272
+ if (!t.ok) throw Error(`[WaSHI] Failed to fetch pumpkin.wasm from "${e}": HTTP ${t.status} ${t.statusText}; no CDN fallback is attempted.`);
273
+ let n = t.headers?.get("content-type")?.toLowerCase() ?? "";
274
+ 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.`);
275
+ let r = await t.arrayBuffer(), i = new Uint8Array(r);
276
+ if (!p(i)) throw Error(`[WaSHI] Invalid WebAssembly binary loaded from "${e}": expected \\0asm magic header; no CDN fallback is attempted.`);
277
+ return i;
278
+ }
279
+ function x(e) {
280
+ if (e === void 0) return o;
281
+ if (e !== null && typeof e != "string") throw Error(`Invalid pumpkin.wasm URL: expected string or null, got ${typeof e}.`);
282
+ if (e === "") throw Error("Invalid pumpkin.wasm URL: expected non-empty string or null (received empty string \"\").");
283
+ return e;
284
+ }
285
+ async function S(e) {
286
+ if (e !== null) {
287
+ if (f() && e.startsWith("file://")) {
288
+ let { readPumpkinWasmFileUrl: t } = await import("./pumpkin-_washi-pumpkin-node-runtime-CEKUDK6d.js"), n = await t(new URL(e));
289
+ if (!p(n)) throw Error(`[WaSHI] Invalid WebAssembly binary at "${e}": expected \\0asm magic header.`);
290
+ return n;
291
+ }
292
+ return b(e);
293
+ }
294
+ if (f() && typeof window > "u") {
295
+ let { readBundledPumpkinWasmBytes: e } = await import("./pumpkin-_washi-pumpkin-node-runtime-CEKUDK6d.js"), t = await e();
296
+ if (!p(t)) throw Error("[WaSHI] Bundled pumpkin.wasm on disk has an invalid WebAssembly magic header.");
297
+ return t;
298
+ }
299
+ return b(n());
300
+ }
301
+ async function C(e) {
302
+ let t = x(e), n = t ?? "__bundled__", r = s.get(n);
303
+ if (r) return s.delete(n), s.set(n, r), r;
304
+ let o = l, u = null;
305
+ for (u = (async () => {
306
+ try {
307
+ let e = await i(await S(t));
308
+ return l === o && s.get(n) === u && c.add(n), e;
309
+ } catch (e) {
310
+ throw l === o && (c.delete(n), s.get(n) === u && s.delete(n)), 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;
311
+ }
312
+ })(); s.size >= a;) {
313
+ let e = s.keys().next().value;
314
+ if (e === void 0) break;
315
+ s.delete(e), c.delete(e);
316
+ }
317
+ return s.set(n, u), u;
318
+ }
319
+ //#endregion
320
+ export { d as a, m as c, n as d, C as i, y as l, v as n, _ as o, p as r, g as s, h as t, t as u };
@@ -0,0 +1,45 @@
1
+ import { i as e } from "./pumpkin-loader-CvdaKxf4.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