@hanzogui/static-worker 2.0.0-rc.41-hanzoai.5

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.
@@ -0,0 +1,316 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
34
+ var index_exports = {};
35
+ __export(index_exports, {
36
+ clearWorkerCache: () => clearWorkerCache,
37
+ destroyPool: () => destroyPool,
38
+ extractToClassNames: () => extractToClassNames,
39
+ extractToNative: () => extractToNative,
40
+ getPoolStats: () => getPoolStats,
41
+ getPragmaOptions: () => getPragmaOptions,
42
+ loadHanzogui: () => loadHanzogui,
43
+ loadHanzoguiBuildConfig: () => loadHanzoguiBuildConfig,
44
+ watchHanzoguiConfig: () => watchHanzoguiConfig
45
+ });
46
+ module.exports = __toCommonJS(index_exports);
47
+ var import_node_url = require("node:url");
48
+ var import_piscina = __toESM(require("piscina"), 1);
49
+ const import_meta = {};
50
+ const getPragmaOptions = async props => {
51
+ const {
52
+ default: Static
53
+ } = await import("@hanzogui/static");
54
+ return Static.getPragmaOptions(props);
55
+ };
56
+ const getWorkerPath = () => {
57
+ if (typeof import_meta !== "undefined" && import_meta.url) {
58
+ const workerPath = (0, import_node_url.fileURLToPath)(import_meta.resolve("@hanzogui/static/worker"));
59
+ return workerPath.replace(/\.mjs$/, ".js");
60
+ }
61
+ return require.resolve("@hanzogui/static/worker").replace(/\.mjs$/, ".js");
62
+ };
63
+ const POOL_KEY = "__hanzogui_piscina_pool__";
64
+ const CLOSING_KEY = "__hanzogui_piscina_closing__";
65
+ const TASK_COUNT_KEY = "__hanzogui_piscina_task_count__";
66
+ const RECYCLING_KEY = "__hanzogui_piscina_recycling__";
67
+ const MAX_TASKS_BEFORE_RECYCLE = 1e3;
68
+ function getSharedPool() {
69
+ return globalThis[POOL_KEY] ?? null;
70
+ }
71
+ function setSharedPool(pool) {
72
+ ;
73
+ globalThis[POOL_KEY] = pool;
74
+ }
75
+ function isClosing() {
76
+ return globalThis[CLOSING_KEY] === true;
77
+ }
78
+ function setClosing(value) {
79
+ ;
80
+ globalThis[CLOSING_KEY] = value;
81
+ }
82
+ function isRecycling() {
83
+ return globalThis[RECYCLING_KEY] === true;
84
+ }
85
+ function setRecycling(value) {
86
+ ;
87
+ globalThis[RECYCLING_KEY] = value;
88
+ }
89
+ function getTaskCount() {
90
+ return globalThis[TASK_COUNT_KEY] ?? 0;
91
+ }
92
+ function incrementTaskCount() {
93
+ const count = getTaskCount() + 1;
94
+ globalThis[TASK_COUNT_KEY] = count;
95
+ return count;
96
+ }
97
+ function resetTaskCount() {
98
+ ;
99
+ globalThis[TASK_COUNT_KEY] = 0;
100
+ }
101
+ function createPool() {
102
+ const pool = new import_piscina.default({
103
+ filename: getWorkerPath(),
104
+ // each worker loads and caches config independently
105
+ minThreads: 2,
106
+ maxThreads: 2,
107
+ // Never terminate due to idle - worker stays alive until close() or process exit
108
+ // This prevents "Terminating worker thread" errors from Piscina during idle
109
+ idleTimeout: Number.POSITIVE_INFINITY
110
+ // no resourceLimits - we rely on task-based recycling instead
111
+ // V8 resourceLimits cause "Terminating worker thread" messages when hit
112
+ });
113
+ pool.on("error", err => {
114
+ if (isClosing() || isRecycling()) return;
115
+ const message = err && typeof err === "object" && "message" in err ? String(err.message) : "";
116
+ if (message.includes("Terminating worker thread")) return;
117
+ console.error("[hanzogui] Worker pool error:", err);
118
+ });
119
+ return pool;
120
+ }
121
+ function getPool() {
122
+ let pool = getSharedPool();
123
+ if (!pool) {
124
+ pool = createPool();
125
+ setSharedPool(pool);
126
+ }
127
+ return pool;
128
+ }
129
+ async function loadHanzogui(options) {
130
+ const pool = getPool();
131
+ const task = {
132
+ type: "extractToClassNames",
133
+ source: "// dummy",
134
+ sourcePath: "__dummy__.tsx",
135
+ options: {
136
+ components: ["hanzogui"],
137
+ ...options
138
+ },
139
+ shouldPrintDebug: false
140
+ };
141
+ try {
142
+ await pool.run(task, {
143
+ name: "runTask"
144
+ });
145
+ return {
146
+ success: true
147
+ };
148
+ } catch (error) {
149
+ console.error("[static-worker] Error loading Hanzogui config:", error);
150
+ throw error;
151
+ }
152
+ }
153
+ async function recyclePool(options) {
154
+ if (isClosing() || isRecycling()) return;
155
+ const oldPool = getSharedPool();
156
+ if (!oldPool) return;
157
+ setRecycling(true);
158
+ const start = Date.now();
159
+ try {
160
+ const originalStderr = process.stderr.write.bind(process.stderr);
161
+ const originalStdout = process.stdout.write.bind(process.stdout);
162
+ const filter = (chunk, ...args) => {
163
+ const str = typeof chunk === "string" ? chunk : chunk?.toString?.() || "";
164
+ if (str.includes("Terminating worker thread")) return true;
165
+ return false;
166
+ };
167
+ process.stderr.write = (chunk, ...args) => {
168
+ if (filter(chunk)) return true;
169
+ return originalStderr(chunk, ...args);
170
+ };
171
+ process.stdout.write = (chunk, ...args) => {
172
+ if (filter(chunk)) return true;
173
+ return originalStdout(chunk, ...args);
174
+ };
175
+ const newPool = createPool();
176
+ setSharedPool(newPool);
177
+ const warmupTask = {
178
+ type: "extractToClassNames",
179
+ source: "// warmup",
180
+ sourcePath: "__warmup__.tsx",
181
+ options: {
182
+ ...options,
183
+ // skip the "built config" log on warmup since it's a recycle
184
+ _skipBuildLog: true
185
+ },
186
+ shouldPrintDebug: false
187
+ };
188
+ await newPool.run(warmupTask, {
189
+ name: "runTask"
190
+ });
191
+ oldPool.removeAllListeners();
192
+ oldPool.destroy().catch(() => {});
193
+ setTimeout(() => {
194
+ process.stderr.write = originalStderr;
195
+ process.stdout.write = originalStdout;
196
+ });
197
+ console.log(` \u267B\uFE0F [hanzogui] recycled worker pool (${Date.now() - start}ms)`);
198
+ } finally {
199
+ setRecycling(false);
200
+ }
201
+ }
202
+ async function loadHanzoguiBuildConfig(hanzoguiOptions) {
203
+ const {
204
+ default: Static
205
+ } = await import("@hanzogui/static");
206
+ return Static.loadHanzoguiBuildConfigAsync(hanzoguiOptions);
207
+ }
208
+ async function extractToClassNames(params) {
209
+ const {
210
+ source,
211
+ sourcePath = "",
212
+ options,
213
+ shouldPrintDebug = false
214
+ } = params;
215
+ if (typeof source !== "string") {
216
+ throw new Error("`source` must be a string of javascript");
217
+ }
218
+ const task = {
219
+ type: "extractToClassNames",
220
+ source,
221
+ sourcePath,
222
+ options,
223
+ shouldPrintDebug
224
+ };
225
+ const pool = getPool();
226
+ const result = await pool.run(task, {
227
+ name: "runTask"
228
+ });
229
+ if (!result.success) {
230
+ const errorMessage = [`[hanzogui-extract] Error processing file: ${sourcePath || "(unknown)"}`, ``, result.error, result.stack ? `
231
+ ${result.stack}` : ""].filter(Boolean).join("\n");
232
+ throw new Error(errorMessage);
233
+ }
234
+ const count = incrementTaskCount();
235
+ if (count >= MAX_TASKS_BEFORE_RECYCLE) {
236
+ resetTaskCount();
237
+ recyclePool(options).catch(() => {});
238
+ }
239
+ return result.data;
240
+ }
241
+ async function extractToNative(sourceFileName, sourceCode, options) {
242
+ const task = {
243
+ type: "extractToNative",
244
+ sourceFileName,
245
+ sourceCode,
246
+ options
247
+ };
248
+ const pool = getPool();
249
+ const result = await pool.run(task, {
250
+ name: "runTask"
251
+ });
252
+ if (!result.success) {
253
+ const errorMessage = [`[hanzogui-extract] Error processing file: ${sourceFileName || "(unknown)"}`, ``, result.error, result.stack ? `
254
+ ${result.stack}` : ""].filter(Boolean).join("\n");
255
+ throw new Error(errorMessage);
256
+ }
257
+ const count = incrementTaskCount();
258
+ if (count >= MAX_TASKS_BEFORE_RECYCLE) {
259
+ resetTaskCount();
260
+ recyclePool(options).catch(() => {});
261
+ }
262
+ return result.data;
263
+ }
264
+ async function watchHanzoguiConfig(options) {
265
+ const {
266
+ default: Static
267
+ } = await import("@hanzogui/static");
268
+ const watcher = await Static.watchHanzoguiConfig(options);
269
+ if (!watcher) {
270
+ return;
271
+ }
272
+ const originalDispose = watcher.dispose;
273
+ return {
274
+ dispose: () => {
275
+ originalDispose();
276
+ if (getSharedPool()) {
277
+ clearWorkerCache();
278
+ }
279
+ }
280
+ };
281
+ }
282
+ async function clearWorkerCache() {
283
+ const pool = getSharedPool();
284
+ if (!pool || isClosing()) return;
285
+ const task = {
286
+ type: "clearCache"
287
+ };
288
+ await pool.run(task, {
289
+ name: "runTask"
290
+ });
291
+ }
292
+ async function destroyPool() {
293
+ const pool = getSharedPool();
294
+ if (pool) {
295
+ setClosing(true);
296
+ try {
297
+ await pool.close();
298
+ } finally {
299
+ setSharedPool(null);
300
+ setClosing(false);
301
+ }
302
+ }
303
+ }
304
+ function getPoolStats() {
305
+ const pool = getSharedPool();
306
+ if (!pool) {
307
+ return null;
308
+ }
309
+ return {
310
+ threads: pool.threads.length,
311
+ queueSize: pool.queueSize,
312
+ completed: pool.completed,
313
+ duration: pool.duration,
314
+ utilization: pool.utilization
315
+ };
316
+ }
@@ -0,0 +1,271 @@
1
+ import { fileURLToPath } from "node:url";
2
+ import Piscina from "piscina";
3
+ const getPragmaOptions = async props => {
4
+ const {
5
+ default: Static
6
+ } = await import("@hanzogui/static");
7
+ return Static.getPragmaOptions(props);
8
+ };
9
+ const getWorkerPath = () => {
10
+ if (typeof import.meta !== "undefined" && import.meta.url) {
11
+ const workerPath = fileURLToPath(import.meta.resolve("@hanzogui/static/worker"));
12
+ return workerPath.replace(/\.mjs$/, ".js");
13
+ }
14
+ return require.resolve("@hanzogui/static/worker").replace(/\.mjs$/, ".js");
15
+ };
16
+ const POOL_KEY = "__hanzogui_piscina_pool__";
17
+ const CLOSING_KEY = "__hanzogui_piscina_closing__";
18
+ const TASK_COUNT_KEY = "__hanzogui_piscina_task_count__";
19
+ const RECYCLING_KEY = "__hanzogui_piscina_recycling__";
20
+ const MAX_TASKS_BEFORE_RECYCLE = 1e3;
21
+ function getSharedPool() {
22
+ return globalThis[POOL_KEY] ?? null;
23
+ }
24
+ function setSharedPool(pool) {
25
+ ;
26
+ globalThis[POOL_KEY] = pool;
27
+ }
28
+ function isClosing() {
29
+ return globalThis[CLOSING_KEY] === true;
30
+ }
31
+ function setClosing(value) {
32
+ ;
33
+ globalThis[CLOSING_KEY] = value;
34
+ }
35
+ function isRecycling() {
36
+ return globalThis[RECYCLING_KEY] === true;
37
+ }
38
+ function setRecycling(value) {
39
+ ;
40
+ globalThis[RECYCLING_KEY] = value;
41
+ }
42
+ function getTaskCount() {
43
+ return globalThis[TASK_COUNT_KEY] ?? 0;
44
+ }
45
+ function incrementTaskCount() {
46
+ const count = getTaskCount() + 1;
47
+ globalThis[TASK_COUNT_KEY] = count;
48
+ return count;
49
+ }
50
+ function resetTaskCount() {
51
+ ;
52
+ globalThis[TASK_COUNT_KEY] = 0;
53
+ }
54
+ function createPool() {
55
+ const pool = new Piscina({
56
+ filename: getWorkerPath(),
57
+ // each worker loads and caches config independently
58
+ minThreads: 2,
59
+ maxThreads: 2,
60
+ // Never terminate due to idle - worker stays alive until close() or process exit
61
+ // This prevents "Terminating worker thread" errors from Piscina during idle
62
+ idleTimeout: Number.POSITIVE_INFINITY
63
+ // no resourceLimits - we rely on task-based recycling instead
64
+ // V8 resourceLimits cause "Terminating worker thread" messages when hit
65
+ });
66
+ pool.on("error", err => {
67
+ if (isClosing() || isRecycling()) return;
68
+ const message = err && typeof err === "object" && "message" in err ? String(err.message) : "";
69
+ if (message.includes("Terminating worker thread")) return;
70
+ console.error("[hanzogui] Worker pool error:", err);
71
+ });
72
+ return pool;
73
+ }
74
+ function getPool() {
75
+ let pool = getSharedPool();
76
+ if (!pool) {
77
+ pool = createPool();
78
+ setSharedPool(pool);
79
+ }
80
+ return pool;
81
+ }
82
+ async function loadHanzogui(options) {
83
+ const pool = getPool();
84
+ const task = {
85
+ type: "extractToClassNames",
86
+ source: "// dummy",
87
+ sourcePath: "__dummy__.tsx",
88
+ options: {
89
+ components: ["hanzogui"],
90
+ ...options
91
+ },
92
+ shouldPrintDebug: false
93
+ };
94
+ try {
95
+ await pool.run(task, {
96
+ name: "runTask"
97
+ });
98
+ return {
99
+ success: true
100
+ };
101
+ } catch (error) {
102
+ console.error("[static-worker] Error loading Hanzogui config:", error);
103
+ throw error;
104
+ }
105
+ }
106
+ async function recyclePool(options) {
107
+ if (isClosing() || isRecycling()) return;
108
+ const oldPool = getSharedPool();
109
+ if (!oldPool) return;
110
+ setRecycling(true);
111
+ const start = Date.now();
112
+ try {
113
+ const originalStderr = process.stderr.write.bind(process.stderr);
114
+ const originalStdout = process.stdout.write.bind(process.stdout);
115
+ const filter = (chunk, ...args) => {
116
+ const str = typeof chunk === "string" ? chunk : chunk?.toString?.() || "";
117
+ if (str.includes("Terminating worker thread")) return true;
118
+ return false;
119
+ };
120
+ process.stderr.write = (chunk, ...args) => {
121
+ if (filter(chunk)) return true;
122
+ return originalStderr(chunk, ...args);
123
+ };
124
+ process.stdout.write = (chunk, ...args) => {
125
+ if (filter(chunk)) return true;
126
+ return originalStdout(chunk, ...args);
127
+ };
128
+ const newPool = createPool();
129
+ setSharedPool(newPool);
130
+ const warmupTask = {
131
+ type: "extractToClassNames",
132
+ source: "// warmup",
133
+ sourcePath: "__warmup__.tsx",
134
+ options: {
135
+ ...options,
136
+ // skip the "built config" log on warmup since it's a recycle
137
+ _skipBuildLog: true
138
+ },
139
+ shouldPrintDebug: false
140
+ };
141
+ await newPool.run(warmupTask, {
142
+ name: "runTask"
143
+ });
144
+ oldPool.removeAllListeners();
145
+ oldPool.destroy().catch(() => {});
146
+ setTimeout(() => {
147
+ process.stderr.write = originalStderr;
148
+ process.stdout.write = originalStdout;
149
+ });
150
+ console.log(` \u267B\uFE0F [hanzogui] recycled worker pool (${Date.now() - start}ms)`);
151
+ } finally {
152
+ setRecycling(false);
153
+ }
154
+ }
155
+ async function loadHanzoguiBuildConfig(hanzoguiOptions) {
156
+ const {
157
+ default: Static
158
+ } = await import("@hanzogui/static");
159
+ return Static.loadHanzoguiBuildConfigAsync(hanzoguiOptions);
160
+ }
161
+ async function extractToClassNames(params) {
162
+ const {
163
+ source,
164
+ sourcePath = "",
165
+ options,
166
+ shouldPrintDebug = false
167
+ } = params;
168
+ if (typeof source !== "string") {
169
+ throw new Error("`source` must be a string of javascript");
170
+ }
171
+ const task = {
172
+ type: "extractToClassNames",
173
+ source,
174
+ sourcePath,
175
+ options,
176
+ shouldPrintDebug
177
+ };
178
+ const pool = getPool();
179
+ const result = await pool.run(task, {
180
+ name: "runTask"
181
+ });
182
+ if (!result.success) {
183
+ const errorMessage = [`[hanzogui-extract] Error processing file: ${sourcePath || "(unknown)"}`, ``, result.error, result.stack ? `
184
+ ${result.stack}` : ""].filter(Boolean).join("\n");
185
+ throw new Error(errorMessage);
186
+ }
187
+ const count = incrementTaskCount();
188
+ if (count >= MAX_TASKS_BEFORE_RECYCLE) {
189
+ resetTaskCount();
190
+ recyclePool(options).catch(() => {});
191
+ }
192
+ return result.data;
193
+ }
194
+ async function extractToNative(sourceFileName, sourceCode, options) {
195
+ const task = {
196
+ type: "extractToNative",
197
+ sourceFileName,
198
+ sourceCode,
199
+ options
200
+ };
201
+ const pool = getPool();
202
+ const result = await pool.run(task, {
203
+ name: "runTask"
204
+ });
205
+ if (!result.success) {
206
+ const errorMessage = [`[hanzogui-extract] Error processing file: ${sourceFileName || "(unknown)"}`, ``, result.error, result.stack ? `
207
+ ${result.stack}` : ""].filter(Boolean).join("\n");
208
+ throw new Error(errorMessage);
209
+ }
210
+ const count = incrementTaskCount();
211
+ if (count >= MAX_TASKS_BEFORE_RECYCLE) {
212
+ resetTaskCount();
213
+ recyclePool(options).catch(() => {});
214
+ }
215
+ return result.data;
216
+ }
217
+ async function watchHanzoguiConfig(options) {
218
+ const {
219
+ default: Static
220
+ } = await import("@hanzogui/static");
221
+ const watcher = await Static.watchHanzoguiConfig(options);
222
+ if (!watcher) {
223
+ return;
224
+ }
225
+ const originalDispose = watcher.dispose;
226
+ return {
227
+ dispose: () => {
228
+ originalDispose();
229
+ if (getSharedPool()) {
230
+ clearWorkerCache();
231
+ }
232
+ }
233
+ };
234
+ }
235
+ async function clearWorkerCache() {
236
+ const pool = getSharedPool();
237
+ if (!pool || isClosing()) return;
238
+ const task = {
239
+ type: "clearCache"
240
+ };
241
+ await pool.run(task, {
242
+ name: "runTask"
243
+ });
244
+ }
245
+ async function destroyPool() {
246
+ const pool = getSharedPool();
247
+ if (pool) {
248
+ setClosing(true);
249
+ try {
250
+ await pool.close();
251
+ } finally {
252
+ setSharedPool(null);
253
+ setClosing(false);
254
+ }
255
+ }
256
+ }
257
+ function getPoolStats() {
258
+ const pool = getSharedPool();
259
+ if (!pool) {
260
+ return null;
261
+ }
262
+ return {
263
+ threads: pool.threads.length,
264
+ queueSize: pool.queueSize,
265
+ completed: pool.completed,
266
+ duration: pool.duration,
267
+ utilization: pool.utilization
268
+ };
269
+ }
270
+ export { clearWorkerCache, destroyPool, extractToClassNames, extractToNative, getPoolStats, getPragmaOptions, loadHanzogui, loadHanzoguiBuildConfig, watchHanzoguiConfig };
271
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["fileURLToPath","Piscina","getPragmaOptions","props","default","Static","getWorkerPath","import","meta","url","workerPath","resolve","replace","require","POOL_KEY","CLOSING_KEY","TASK_COUNT_KEY","RECYCLING_KEY","MAX_TASKS_BEFORE_RECYCLE","getSharedPool","globalThis","setSharedPool","pool","isClosing","setClosing","value","isRecycling","setRecycling","getTaskCount","incrementTaskCount","count","resetTaskCount","createPool","filename","minThreads","maxThreads","idleTimeout","Number","POSITIVE_INFINITY","on","err","message","String","includes","console","error","getPool","loadHanzogui","options","task","type","source","sourcePath","components","shouldPrintDebug","run","name","success","recyclePool","oldPool","start","Date","now","originalStderr","process","stderr","write","bind","originalStdout","stdout","filter","chunk","args","str","toString","newPool","warmupTask","_skipBuildLog","removeAllListeners","destroy","catch","setTimeout","log","loadHanzoguiBuildConfig","hanzoguiOptions","loadHanzoguiBuildConfigAsync","extractToClassNames","params","Error","result","errorMessage","stack","Boolean","join","data","extractToNative","sourceFileName","sourceCode","watchHanzoguiConfig","watcher","originalDispose","dispose","clearWorkerCache","destroyPool","close","getPoolStats","threads","length","queueSize","completed","duration","utilization"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAWA,SAASA,aAAA,QAAqB;AAC9B,OAAOC,OAAA,MAAa;AAKb,MAAMC,gBAAA,GAAmB,MAAOC,KAAA,IAA4C;EACjF,MAAM;IAAEC,OAAA,EAASC;EAAO,IAAI,MAAM,OAAO,kBAAkB;EAC3D,OAAOA,MAAA,CAAOH,gBAAA,CAAiBC,KAAK;AACtC;AAGA,MAAMG,aAAA,GAAgBA,CAAA,KAAM;EAG1B,IAAI,OAAOC,MAAA,CAAAC,IAAA,KAAgB,eAAeD,MAAA,CAAAC,IAAA,CAAYC,GAAA,EAAK;IACzD,MAAMC,UAAA,GAAaV,aAAA,CAAcO,MAAA,CAAAC,IAAA,CAA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