@qwen-code/qwen-code 0.16.0-preview.0 → 0.16.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.
Files changed (89) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +39 -37
  2. package/bundled/qc-helper/docs/features/_meta.ts +2 -0
  3. package/bundled/qc-helper/docs/features/approval-mode.md +119 -2
  4. package/bundled/qc-helper/docs/features/auto-mode.md +263 -0
  5. package/bundled/qc-helper/docs/features/commands.md +11 -10
  6. package/bundled/qc-helper/docs/features/skills.md +3 -0
  7. package/bundled/qc-helper/docs/features/structured-output.md +309 -0
  8. package/bundled/qc-helper/docs/features/sub-agents.md +47 -5
  9. package/bundled/qc-helper/docs/qwen-serve.md +119 -14
  10. package/bundled/review/SKILL.md +12 -3
  11. package/chunks/{agent-ZNQPH67I.js → agent-2JCG7FDJ.js} +9 -11
  12. package/chunks/{anthropicContentGenerator-ICBDZ6R2.js → anthropicContentGenerator-RQJNXJIY.js} +6 -3
  13. package/chunks/{askUserQuestion-WQILGUSQ.js → askUserQuestion-PQPMPNM3.js} +1 -1
  14. package/chunks/{ca-S3XJMT6P.js → ca-UZ7BANMN.js} +3 -3
  15. package/chunks/{chunk-XVHR7ATJ.js → chunk-4AOCVI6J.js} +1 -0
  16. package/chunks/chunk-7LMPOVYW.js +956 -0
  17. package/chunks/{chunk-MNPZ2WO6.js → chunk-BAZDG3QU.js} +9104 -3955
  18. package/chunks/{chunk-AEJ2DKLP.js → chunk-C6WMLUNB.js} +1 -1
  19. package/chunks/{chunk-PPHYLJSS.js → chunk-CAVZVZX6.js} +2 -2
  20. package/chunks/{chunk-VTPOO6GV.js → chunk-CSWBPY3P.js} +1 -1
  21. package/chunks/chunk-D6LBYOCX.js +19126 -0
  22. package/chunks/{chunk-NAID3ZWF.js → chunk-DMIMF3CG.js} +1 -1
  23. package/chunks/{chunk-2B7UBDY5.js → chunk-GGNTZ2NH.js} +90 -19
  24. package/chunks/chunk-HW5S7L73.js +379 -0
  25. package/chunks/{chunk-C3LHPHN2.js → chunk-JCR2WRXZ.js} +1227 -657
  26. package/chunks/{chunk-EDYSNFEM.js → chunk-L5E26RN6.js} +2 -2
  27. package/chunks/{chunk-CW44BRRA.js → chunk-MAY32HXD.js} +375 -0
  28. package/chunks/{chunk-7QXHXMC6.js → chunk-N6GSJHZ4.js} +96 -20
  29. package/chunks/{chunk-FZIUV27X.js → chunk-PVVL5Q3W.js} +31 -0
  30. package/chunks/{chunk-YHEAJFCI.js → chunk-USE2VQ5P.js} +3 -0
  31. package/chunks/{chunk-JYQUJ5DS.js → chunk-YJLGXDQJ.js} +1 -1
  32. package/chunks/{contextCommand-IGBCEXI4.js → contextCommand-XVRGKS3Q.js} +11 -13
  33. package/chunks/{cron-create-AVI3Q267.js → cron-create-IGYXQVG4.js} +27 -1
  34. package/chunks/{cron-delete-ZCEGDXXV.js → cron-delete-ETKIZCWT.js} +1 -1
  35. package/chunks/{cron-list-VN653OK5.js → cron-list-BVCUSWRU.js} +1 -1
  36. package/chunks/{de-MNR4SMAI.js → de-V4IE2OOZ.js} +3 -3
  37. package/chunks/{dist-RRYNPBOE.js → dist-4L54HRX2.js} +2 -2
  38. package/chunks/{dist-WP4AH3VK.js → dist-BXDUQ2QY.js} +1 -1
  39. package/chunks/{dist-M6GFCZ7S.js → dist-MN2PDDPR.js} +1 -1
  40. package/chunks/{edit-74Q4AFHQ.js → edit-3MLXHQPW.js} +22 -12
  41. package/chunks/{en-FIUWJSZR.js → en-HGJ2SPLM.js} +4 -3
  42. package/chunks/{enter-worktree-H72HXC7D.js → enter-worktree-OCA4SG6D.js} +35 -11
  43. package/chunks/{exit-worktree-FGIQO3S3.js → exit-worktree-6EDLXVEV.js} +35 -11
  44. package/chunks/{exitPlanMode-NBR2PK2D.js → exitPlanMode-H75KHRX4.js} +9 -11
  45. package/chunks/{fr-OFJFHLCR.js → fr-CJULI7ZX.js} +3 -3
  46. package/chunks/{geminiContentGenerator-33RP4WKD.js → geminiContentGenerator-E7Y6TCPU.js} +1 -1
  47. package/chunks/{glob-WEE3CJL6.js → glob-JFFSKARO.js} +9 -11
  48. package/chunks/{grep-DZKSBFZK.js → grep-7TAFR7MX.js} +9 -11
  49. package/chunks/{ja-V6OQ6VL7.js → ja-L7CHRQEW.js} +3 -3
  50. package/chunks/{ls-6F3VSP6S.js → ls-7HD6XG3V.js} +1 -1
  51. package/chunks/{lsp-67Y7DJN5.js → lsp-ZZSFCIWD.js} +1 -1
  52. package/chunks/{monitor-EDZWEZVS.js → monitor-YX2ABLXH.js} +21 -11
  53. package/chunks/notebook-edit-EEJEGFZR.js +756 -0
  54. package/chunks/{openaiContentGenerator-5NQG3W64.js → openaiContentGenerator-BSAWHGQJ.js} +9 -8
  55. package/chunks/{pt-ZLE6SA4A.js → pt-M6JULLEQ.js} +3 -3
  56. package/chunks/{qwenContentGenerator-4DPUUS6R.js → qwenContentGenerator-47XRHQXM.js} +11 -13
  57. package/chunks/{qwenOAuth2-JE7H47TE.js → qwenOAuth2-EEJGROP7.js} +7 -1
  58. package/chunks/{read-file-CQOF7BQ2.js → read-file-O53WD46Y.js} +4 -5
  59. package/chunks/{ripGrep-KR5LKGTI.js → ripGrep-OXNZ5Z3T.js} +9 -11
  60. package/chunks/{ru-A4OHIUNN.js → ru-QILM4HBC.js} +3 -3
  61. package/chunks/{send-message-GB4AQZNC.js → send-message-ULK4MQXJ.js} +22 -1
  62. package/chunks/{serve-GAD2PEST.js → serve-H2REZAYD.js} +13728 -3026
  63. package/chunks/{shell-E2HMCBGR.js → shell-DET66JID.js} +9 -11
  64. package/chunks/{skill-KDZH6UZ6.js → skill-ZIXPX3L3.js} +19 -6
  65. package/chunks/{src-LY4RU5AI.js → src-PN3XGQYP.js} +205 -13
  66. package/chunks/{syntheticOutput-HFL3DE7R.js → syntheticOutput-IS2X5OZ2.js} +2 -2
  67. package/chunks/{task-stop-ZQF26RXS.js → task-stop-7QSJGSSP.js} +1 -1
  68. package/chunks/{todoWrite-U4SC643O.js → todoWrite-7CVACFUX.js} +2 -2
  69. package/chunks/{tool-search-U4XQVLFU.js → tool-search-GTYLSGZ3.js} +4 -5
  70. package/chunks/{web-fetch-BRWZ4WSE.js → web-fetch-ENQ2I5JA.js} +5 -2
  71. package/chunks/{write-file-NBLRMNGB.js → write-file-NILNEZCR.js} +19 -12
  72. package/chunks/{zh-V32QONGV.js → zh-PWL2NKY3.js} +4 -3
  73. package/chunks/{zh-TW-552S24LR.js → zh-TW-S3YGWICZ.js} +4 -3
  74. package/cli.js +14832 -49049
  75. package/locales/ca.js +4 -5
  76. package/locales/de.js +4 -5
  77. package/locales/en.js +6 -5
  78. package/locales/fr.js +4 -5
  79. package/locales/ja.js +4 -5
  80. package/locales/pt.js +4 -5
  81. package/locales/ru.js +4 -5
  82. package/locales/zh-TW.js +5 -4
  83. package/locales/zh.js +5 -4
  84. package/package.json +2 -2
  85. package/chunks/chunk-3MBY4GKN.js +0 -350
  86. package/chunks/chunk-5P5XGNYH.js +0 -93
  87. package/chunks/chunk-JHMX4QTD.js +0 -2306
  88. package/chunks/chunk-SYCJMSIJ.js +0 -82
  89. package/chunks/chunk-Y6Z2O3WR.js +0 -33
@@ -1,2306 +0,0 @@
1
- // Force strict mode and setup for ESM
2
- "use strict";
3
- import {
4
- writeStderrLine
5
- } from "./chunk-Y6Z2O3WR.js";
6
- import {
7
- getCoreSystemPrompt,
8
- resolveBundleDir
9
- } from "./chunk-MNPZ2WO6.js";
10
- import {
11
- buildSkillLlmContent
12
- } from "./chunk-G7YTSRES.js";
13
- import {
14
- DiscoveredMCPTool,
15
- uiTelemetryService
16
- } from "./chunk-C3LHPHN2.js";
17
- import {
18
- DEFAULT_TOKEN_LIMIT
19
- } from "./chunk-CW44BRRA.js";
20
- import {
21
- ToolNames
22
- } from "./chunk-FZIUV27X.js";
23
- import {
24
- Storage
25
- } from "./chunk-XP27SJMH.js";
26
- import {
27
- init_esbuild_shims
28
- } from "./chunk-A4BMJM77.js";
29
- import {
30
- __commonJS,
31
- __glob,
32
- __name,
33
- __toESM
34
- } from "./chunk-J2S4EL5Y.js";
35
-
36
- // node_modules/react/cjs/react.production.js
37
- var require_react_production = __commonJS({
38
- "node_modules/react/cjs/react.production.js"(exports) {
39
- "use strict";
40
- init_esbuild_shims();
41
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element");
42
- var REACT_PORTAL_TYPE = Symbol.for("react.portal");
43
- var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
44
- var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
45
- var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
46
- var REACT_CONSUMER_TYPE = Symbol.for("react.consumer");
47
- var REACT_CONTEXT_TYPE = Symbol.for("react.context");
48
- var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
49
- var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
50
- var REACT_MEMO_TYPE = Symbol.for("react.memo");
51
- var REACT_LAZY_TYPE = Symbol.for("react.lazy");
52
- var REACT_ACTIVITY_TYPE = Symbol.for("react.activity");
53
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
54
- function getIteratorFn(maybeIterable) {
55
- if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
56
- maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
57
- return "function" === typeof maybeIterable ? maybeIterable : null;
58
- }
59
- __name(getIteratorFn, "getIteratorFn");
60
- var ReactNoopUpdateQueue = {
61
- isMounted: /* @__PURE__ */ __name(function() {
62
- return false;
63
- }, "isMounted"),
64
- enqueueForceUpdate: /* @__PURE__ */ __name(function() {
65
- }, "enqueueForceUpdate"),
66
- enqueueReplaceState: /* @__PURE__ */ __name(function() {
67
- }, "enqueueReplaceState"),
68
- enqueueSetState: /* @__PURE__ */ __name(function() {
69
- }, "enqueueSetState")
70
- };
71
- var assign = Object.assign;
72
- var emptyObject = {};
73
- function Component(props, context, updater) {
74
- this.props = props;
75
- this.context = context;
76
- this.refs = emptyObject;
77
- this.updater = updater || ReactNoopUpdateQueue;
78
- }
79
- __name(Component, "Component");
80
- Component.prototype.isReactComponent = {};
81
- Component.prototype.setState = function(partialState, callback) {
82
- if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState)
83
- throw Error(
84
- "takes an object of state variables to update or a function which returns an object of state variables."
85
- );
86
- this.updater.enqueueSetState(this, partialState, callback, "setState");
87
- };
88
- Component.prototype.forceUpdate = function(callback) {
89
- this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
90
- };
91
- function ComponentDummy() {
92
- }
93
- __name(ComponentDummy, "ComponentDummy");
94
- ComponentDummy.prototype = Component.prototype;
95
- function PureComponent(props, context, updater) {
96
- this.props = props;
97
- this.context = context;
98
- this.refs = emptyObject;
99
- this.updater = updater || ReactNoopUpdateQueue;
100
- }
101
- __name(PureComponent, "PureComponent");
102
- var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
103
- pureComponentPrototype.constructor = PureComponent;
104
- assign(pureComponentPrototype, Component.prototype);
105
- pureComponentPrototype.isPureReactComponent = true;
106
- var isArrayImpl = Array.isArray;
107
- function noop() {
108
- }
109
- __name(noop, "noop");
110
- var ReactSharedInternals = { H: null, A: null, T: null, S: null };
111
- var hasOwnProperty = Object.prototype.hasOwnProperty;
112
- function ReactElement(type, key, props) {
113
- var refProp = props.ref;
114
- return {
115
- $$typeof: REACT_ELEMENT_TYPE,
116
- type,
117
- key,
118
- ref: void 0 !== refProp ? refProp : null,
119
- props
120
- };
121
- }
122
- __name(ReactElement, "ReactElement");
123
- function cloneAndReplaceKey(oldElement, newKey) {
124
- return ReactElement(oldElement.type, newKey, oldElement.props);
125
- }
126
- __name(cloneAndReplaceKey, "cloneAndReplaceKey");
127
- function isValidElement(object) {
128
- return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
129
- }
130
- __name(isValidElement, "isValidElement");
131
- function escape(key) {
132
- var escaperLookup = { "=": "=0", ":": "=2" };
133
- return "$" + key.replace(/[=:]/g, function(match) {
134
- return escaperLookup[match];
135
- });
136
- }
137
- __name(escape, "escape");
138
- var userProvidedKeyEscapeRegex = /\/+/g;
139
- function getElementKey(element, index) {
140
- return "object" === typeof element && null !== element && null != element.key ? escape("" + element.key) : index.toString(36);
141
- }
142
- __name(getElementKey, "getElementKey");
143
- function resolveThenable(thenable) {
144
- switch (thenable.status) {
145
- case "fulfilled":
146
- return thenable.value;
147
- case "rejected":
148
- throw thenable.reason;
149
- default:
150
- switch ("string" === typeof thenable.status ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(
151
- function(fulfilledValue) {
152
- "pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
153
- },
154
- function(error) {
155
- "pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
156
- }
157
- )), thenable.status) {
158
- case "fulfilled":
159
- return thenable.value;
160
- case "rejected":
161
- throw thenable.reason;
162
- }
163
- }
164
- throw thenable;
165
- }
166
- __name(resolveThenable, "resolveThenable");
167
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
168
- var type = typeof children;
169
- if ("undefined" === type || "boolean" === type) children = null;
170
- var invokeCallback = false;
171
- if (null === children) invokeCallback = true;
172
- else
173
- switch (type) {
174
- case "bigint":
175
- case "string":
176
- case "number":
177
- invokeCallback = true;
178
- break;
179
- case "object":
180
- switch (children.$$typeof) {
181
- case REACT_ELEMENT_TYPE:
182
- case REACT_PORTAL_TYPE:
183
- invokeCallback = true;
184
- break;
185
- case REACT_LAZY_TYPE:
186
- return invokeCallback = children._init, mapIntoArray(
187
- invokeCallback(children._payload),
188
- array,
189
- escapedPrefix,
190
- nameSoFar,
191
- callback
192
- );
193
- }
194
- }
195
- if (invokeCallback)
196
- return callback = callback(children), invokeCallback = "" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar, isArrayImpl(callback) ? (escapedPrefix = "", null != invokeCallback && (escapedPrefix = invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
197
- return c;
198
- })) : null != callback && (isValidElement(callback) && (callback = cloneAndReplaceKey(
199
- callback,
200
- escapedPrefix + (null == callback.key || children && children.key === callback.key ? "" : ("" + callback.key).replace(
201
- userProvidedKeyEscapeRegex,
202
- "$&/"
203
- ) + "/") + invokeCallback
204
- )), array.push(callback)), 1;
205
- invokeCallback = 0;
206
- var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
207
- if (isArrayImpl(children))
208
- for (var i = 0; i < children.length; i++)
209
- nameSoFar = children[i], type = nextNamePrefix + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(
210
- nameSoFar,
211
- array,
212
- escapedPrefix,
213
- type,
214
- callback
215
- );
216
- else if (i = getIteratorFn(children), "function" === typeof i)
217
- for (children = i.call(children), i = 0; !(nameSoFar = children.next()).done; )
218
- nameSoFar = nameSoFar.value, type = nextNamePrefix + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(
219
- nameSoFar,
220
- array,
221
- escapedPrefix,
222
- type,
223
- callback
224
- );
225
- else if ("object" === type) {
226
- if ("function" === typeof children.then)
227
- return mapIntoArray(
228
- resolveThenable(children),
229
- array,
230
- escapedPrefix,
231
- nameSoFar,
232
- callback
233
- );
234
- array = String(children);
235
- throw Error(
236
- "Objects are not valid as a React child (found: " + ("[object Object]" === array ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead."
237
- );
238
- }
239
- return invokeCallback;
240
- }
241
- __name(mapIntoArray, "mapIntoArray");
242
- function mapChildren(children, func, context) {
243
- if (null == children) return children;
244
- var result = [], count = 0;
245
- mapIntoArray(children, result, "", "", function(child) {
246
- return func.call(context, child, count++);
247
- });
248
- return result;
249
- }
250
- __name(mapChildren, "mapChildren");
251
- function lazyInitializer(payload) {
252
- if (-1 === payload._status) {
253
- var ctor = payload._result;
254
- ctor = ctor();
255
- ctor.then(
256
- function(moduleObject) {
257
- if (0 === payload._status || -1 === payload._status)
258
- payload._status = 1, payload._result = moduleObject;
259
- },
260
- function(error) {
261
- if (0 === payload._status || -1 === payload._status)
262
- payload._status = 2, payload._result = error;
263
- }
264
- );
265
- -1 === payload._status && (payload._status = 0, payload._result = ctor);
266
- }
267
- if (1 === payload._status) return payload._result.default;
268
- throw payload._result;
269
- }
270
- __name(lazyInitializer, "lazyInitializer");
271
- var reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
272
- if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
273
- var event = new window.ErrorEvent("error", {
274
- bubbles: true,
275
- cancelable: true,
276
- message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
277
- error
278
- });
279
- if (!window.dispatchEvent(event)) return;
280
- } else if ("object" === typeof process && "function" === typeof process.emit) {
281
- process.emit("uncaughtException", error);
282
- return;
283
- }
284
- console.error(error);
285
- };
286
- var Children = {
287
- map: mapChildren,
288
- forEach: /* @__PURE__ */ __name(function(children, forEachFunc, forEachContext) {
289
- mapChildren(
290
- children,
291
- function() {
292
- forEachFunc.apply(this, arguments);
293
- },
294
- forEachContext
295
- );
296
- }, "forEach"),
297
- count: /* @__PURE__ */ __name(function(children) {
298
- var n = 0;
299
- mapChildren(children, function() {
300
- n++;
301
- });
302
- return n;
303
- }, "count"),
304
- toArray: /* @__PURE__ */ __name(function(children) {
305
- return mapChildren(children, function(child) {
306
- return child;
307
- }) || [];
308
- }, "toArray"),
309
- only: /* @__PURE__ */ __name(function(children) {
310
- if (!isValidElement(children))
311
- throw Error(
312
- "React.Children.only expected to receive a single React element child."
313
- );
314
- return children;
315
- }, "only")
316
- };
317
- exports.Activity = REACT_ACTIVITY_TYPE;
318
- exports.Children = Children;
319
- exports.Component = Component;
320
- exports.Fragment = REACT_FRAGMENT_TYPE;
321
- exports.Profiler = REACT_PROFILER_TYPE;
322
- exports.PureComponent = PureComponent;
323
- exports.StrictMode = REACT_STRICT_MODE_TYPE;
324
- exports.Suspense = REACT_SUSPENSE_TYPE;
325
- exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
326
- exports.__COMPILER_RUNTIME = {
327
- __proto__: null,
328
- c: /* @__PURE__ */ __name(function(size) {
329
- return ReactSharedInternals.H.useMemoCache(size);
330
- }, "c")
331
- };
332
- exports.cache = function(fn) {
333
- return function() {
334
- return fn.apply(null, arguments);
335
- };
336
- };
337
- exports.cacheSignal = function() {
338
- return null;
339
- };
340
- exports.cloneElement = function(element, config, children) {
341
- if (null === element || void 0 === element)
342
- throw Error(
343
- "The argument must be a React element, but you passed " + element + "."
344
- );
345
- var props = assign({}, element.props), key = element.key;
346
- if (null != config)
347
- for (propName in void 0 !== config.key && (key = "" + config.key), config)
348
- !hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
349
- var propName = arguments.length - 2;
350
- if (1 === propName) props.children = children;
351
- else if (1 < propName) {
352
- for (var childArray = Array(propName), i = 0; i < propName; i++)
353
- childArray[i] = arguments[i + 2];
354
- props.children = childArray;
355
- }
356
- return ReactElement(element.type, key, props);
357
- };
358
- exports.createContext = function(defaultValue) {
359
- defaultValue = {
360
- $$typeof: REACT_CONTEXT_TYPE,
361
- _currentValue: defaultValue,
362
- _currentValue2: defaultValue,
363
- _threadCount: 0,
364
- Provider: null,
365
- Consumer: null
366
- };
367
- defaultValue.Provider = defaultValue;
368
- defaultValue.Consumer = {
369
- $$typeof: REACT_CONSUMER_TYPE,
370
- _context: defaultValue
371
- };
372
- return defaultValue;
373
- };
374
- exports.createElement = function(type, config, children) {
375
- var propName, props = {}, key = null;
376
- if (null != config)
377
- for (propName in void 0 !== config.key && (key = "" + config.key), config)
378
- hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (props[propName] = config[propName]);
379
- var childrenLength = arguments.length - 2;
380
- if (1 === childrenLength) props.children = children;
381
- else if (1 < childrenLength) {
382
- for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
383
- childArray[i] = arguments[i + 2];
384
- props.children = childArray;
385
- }
386
- if (type && type.defaultProps)
387
- for (propName in childrenLength = type.defaultProps, childrenLength)
388
- void 0 === props[propName] && (props[propName] = childrenLength[propName]);
389
- return ReactElement(type, key, props);
390
- };
391
- exports.createRef = function() {
392
- return { current: null };
393
- };
394
- exports.forwardRef = function(render) {
395
- return { $$typeof: REACT_FORWARD_REF_TYPE, render };
396
- };
397
- exports.isValidElement = isValidElement;
398
- exports.lazy = function(ctor) {
399
- return {
400
- $$typeof: REACT_LAZY_TYPE,
401
- _payload: { _status: -1, _result: ctor },
402
- _init: lazyInitializer
403
- };
404
- };
405
- exports.memo = function(type, compare) {
406
- return {
407
- $$typeof: REACT_MEMO_TYPE,
408
- type,
409
- compare: void 0 === compare ? null : compare
410
- };
411
- };
412
- exports.startTransition = function(scope) {
413
- var prevTransition = ReactSharedInternals.T, currentTransition = {};
414
- ReactSharedInternals.T = currentTransition;
415
- try {
416
- var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
417
- null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
418
- "object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && returnValue.then(noop, reportGlobalError);
419
- } catch (error) {
420
- reportGlobalError(error);
421
- } finally {
422
- null !== prevTransition && null !== currentTransition.types && (prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
423
- }
424
- };
425
- exports.unstable_useCacheRefresh = function() {
426
- return ReactSharedInternals.H.useCacheRefresh();
427
- };
428
- exports.use = function(usable) {
429
- return ReactSharedInternals.H.use(usable);
430
- };
431
- exports.useActionState = function(action, initialState, permalink) {
432
- return ReactSharedInternals.H.useActionState(action, initialState, permalink);
433
- };
434
- exports.useCallback = function(callback, deps) {
435
- return ReactSharedInternals.H.useCallback(callback, deps);
436
- };
437
- exports.useContext = function(Context) {
438
- return ReactSharedInternals.H.useContext(Context);
439
- };
440
- exports.useDebugValue = function() {
441
- };
442
- exports.useDeferredValue = function(value, initialValue) {
443
- return ReactSharedInternals.H.useDeferredValue(value, initialValue);
444
- };
445
- exports.useEffect = function(create, deps) {
446
- return ReactSharedInternals.H.useEffect(create, deps);
447
- };
448
- exports.useEffectEvent = function(callback) {
449
- return ReactSharedInternals.H.useEffectEvent(callback);
450
- };
451
- exports.useId = function() {
452
- return ReactSharedInternals.H.useId();
453
- };
454
- exports.useImperativeHandle = function(ref, create, deps) {
455
- return ReactSharedInternals.H.useImperativeHandle(ref, create, deps);
456
- };
457
- exports.useInsertionEffect = function(create, deps) {
458
- return ReactSharedInternals.H.useInsertionEffect(create, deps);
459
- };
460
- exports.useLayoutEffect = function(create, deps) {
461
- return ReactSharedInternals.H.useLayoutEffect(create, deps);
462
- };
463
- exports.useMemo = function(create, deps) {
464
- return ReactSharedInternals.H.useMemo(create, deps);
465
- };
466
- exports.useOptimistic = function(passthrough, reducer) {
467
- return ReactSharedInternals.H.useOptimistic(passthrough, reducer);
468
- };
469
- exports.useReducer = function(reducer, initialArg, init) {
470
- return ReactSharedInternals.H.useReducer(reducer, initialArg, init);
471
- };
472
- exports.useRef = function(initialValue) {
473
- return ReactSharedInternals.H.useRef(initialValue);
474
- };
475
- exports.useState = function(initialState) {
476
- return ReactSharedInternals.H.useState(initialState);
477
- };
478
- exports.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
479
- return ReactSharedInternals.H.useSyncExternalStore(
480
- subscribe,
481
- getSnapshot,
482
- getServerSnapshot
483
- );
484
- };
485
- exports.useTransition = function() {
486
- return ReactSharedInternals.H.useTransition();
487
- };
488
- exports.version = "19.2.4";
489
- }
490
- });
491
-
492
- // node_modules/react/cjs/react.development.js
493
- var require_react_development = __commonJS({
494
- "node_modules/react/cjs/react.development.js"(exports, module) {
495
- "use strict";
496
- init_esbuild_shims();
497
- "production" !== process.env.NODE_ENV && function() {
498
- function defineDeprecationWarning(methodName, info) {
499
- Object.defineProperty(Component.prototype, methodName, {
500
- get: /* @__PURE__ */ __name(function() {
501
- console.warn(
502
- "%s(...) is deprecated in plain JavaScript React classes. %s",
503
- info[0],
504
- info[1]
505
- );
506
- }, "get")
507
- });
508
- }
509
- __name(defineDeprecationWarning, "defineDeprecationWarning");
510
- function getIteratorFn(maybeIterable) {
511
- if (null === maybeIterable || "object" !== typeof maybeIterable)
512
- return null;
513
- maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
514
- return "function" === typeof maybeIterable ? maybeIterable : null;
515
- }
516
- __name(getIteratorFn, "getIteratorFn");
517
- function warnNoop(publicInstance, callerName) {
518
- publicInstance = (publicInstance = publicInstance.constructor) && (publicInstance.displayName || publicInstance.name) || "ReactClass";
519
- var warningKey = publicInstance + "." + callerName;
520
- didWarnStateUpdateForUnmountedComponent[warningKey] || (console.error(
521
- "Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",
522
- callerName,
523
- publicInstance
524
- ), didWarnStateUpdateForUnmountedComponent[warningKey] = true);
525
- }
526
- __name(warnNoop, "warnNoop");
527
- function Component(props, context, updater) {
528
- this.props = props;
529
- this.context = context;
530
- this.refs = emptyObject;
531
- this.updater = updater || ReactNoopUpdateQueue;
532
- }
533
- __name(Component, "Component");
534
- function ComponentDummy() {
535
- }
536
- __name(ComponentDummy, "ComponentDummy");
537
- function PureComponent(props, context, updater) {
538
- this.props = props;
539
- this.context = context;
540
- this.refs = emptyObject;
541
- this.updater = updater || ReactNoopUpdateQueue;
542
- }
543
- __name(PureComponent, "PureComponent");
544
- function noop() {
545
- }
546
- __name(noop, "noop");
547
- function testStringCoercion(value) {
548
- return "" + value;
549
- }
550
- __name(testStringCoercion, "testStringCoercion");
551
- function checkKeyStringCoercion(value) {
552
- try {
553
- testStringCoercion(value);
554
- var JSCompiler_inline_result = false;
555
- } catch (e) {
556
- JSCompiler_inline_result = true;
557
- }
558
- if (JSCompiler_inline_result) {
559
- JSCompiler_inline_result = console;
560
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
561
- var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
562
- JSCompiler_temp_const.call(
563
- JSCompiler_inline_result,
564
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
565
- JSCompiler_inline_result$jscomp$0
566
- );
567
- return testStringCoercion(value);
568
- }
569
- }
570
- __name(checkKeyStringCoercion, "checkKeyStringCoercion");
571
- function getComponentNameFromType(type) {
572
- if (null == type) return null;
573
- if ("function" === typeof type)
574
- return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
575
- if ("string" === typeof type) return type;
576
- switch (type) {
577
- case REACT_FRAGMENT_TYPE:
578
- return "Fragment";
579
- case REACT_PROFILER_TYPE:
580
- return "Profiler";
581
- case REACT_STRICT_MODE_TYPE:
582
- return "StrictMode";
583
- case REACT_SUSPENSE_TYPE:
584
- return "Suspense";
585
- case REACT_SUSPENSE_LIST_TYPE:
586
- return "SuspenseList";
587
- case REACT_ACTIVITY_TYPE:
588
- return "Activity";
589
- }
590
- if ("object" === typeof type)
591
- switch ("number" === typeof type.tag && console.error(
592
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
593
- ), type.$$typeof) {
594
- case REACT_PORTAL_TYPE:
595
- return "Portal";
596
- case REACT_CONTEXT_TYPE:
597
- return type.displayName || "Context";
598
- case REACT_CONSUMER_TYPE:
599
- return (type._context.displayName || "Context") + ".Consumer";
600
- case REACT_FORWARD_REF_TYPE:
601
- var innerType = type.render;
602
- type = type.displayName;
603
- type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
604
- return type;
605
- case REACT_MEMO_TYPE:
606
- return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
607
- case REACT_LAZY_TYPE:
608
- innerType = type._payload;
609
- type = type._init;
610
- try {
611
- return getComponentNameFromType(type(innerType));
612
- } catch (x) {
613
- }
614
- }
615
- return null;
616
- }
617
- __name(getComponentNameFromType, "getComponentNameFromType");
618
- function getTaskName(type) {
619
- if (type === REACT_FRAGMENT_TYPE) return "<>";
620
- if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE)
621
- return "<...>";
622
- try {
623
- var name = getComponentNameFromType(type);
624
- return name ? "<" + name + ">" : "<...>";
625
- } catch (x) {
626
- return "<...>";
627
- }
628
- }
629
- __name(getTaskName, "getTaskName");
630
- function getOwner() {
631
- var dispatcher = ReactSharedInternals.A;
632
- return null === dispatcher ? null : dispatcher.getOwner();
633
- }
634
- __name(getOwner, "getOwner");
635
- function UnknownOwner() {
636
- return Error("react-stack-top-frame");
637
- }
638
- __name(UnknownOwner, "UnknownOwner");
639
- function hasValidKey(config) {
640
- if (hasOwnProperty.call(config, "key")) {
641
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
642
- if (getter && getter.isReactWarning) return false;
643
- }
644
- return void 0 !== config.key;
645
- }
646
- __name(hasValidKey, "hasValidKey");
647
- function defineKeyPropWarningGetter(props, displayName) {
648
- function warnAboutAccessingKey() {
649
- specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error(
650
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
651
- displayName
652
- ));
653
- }
654
- __name(warnAboutAccessingKey, "warnAboutAccessingKey");
655
- warnAboutAccessingKey.isReactWarning = true;
656
- Object.defineProperty(props, "key", {
657
- get: warnAboutAccessingKey,
658
- configurable: true
659
- });
660
- }
661
- __name(defineKeyPropWarningGetter, "defineKeyPropWarningGetter");
662
- function elementRefGetterWithDeprecationWarning() {
663
- var componentName = getComponentNameFromType(this.type);
664
- didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error(
665
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
666
- ));
667
- componentName = this.props.ref;
668
- return void 0 !== componentName ? componentName : null;
669
- }
670
- __name(elementRefGetterWithDeprecationWarning, "elementRefGetterWithDeprecationWarning");
671
- function ReactElement(type, key, props, owner, debugStack, debugTask) {
672
- var refProp = props.ref;
673
- type = {
674
- $$typeof: REACT_ELEMENT_TYPE,
675
- type,
676
- key,
677
- props,
678
- _owner: owner
679
- };
680
- null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
681
- enumerable: false,
682
- get: elementRefGetterWithDeprecationWarning
683
- }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
684
- type._store = {};
685
- Object.defineProperty(type._store, "validated", {
686
- configurable: false,
687
- enumerable: false,
688
- writable: true,
689
- value: 0
690
- });
691
- Object.defineProperty(type, "_debugInfo", {
692
- configurable: false,
693
- enumerable: false,
694
- writable: true,
695
- value: null
696
- });
697
- Object.defineProperty(type, "_debugStack", {
698
- configurable: false,
699
- enumerable: false,
700
- writable: true,
701
- value: debugStack
702
- });
703
- Object.defineProperty(type, "_debugTask", {
704
- configurable: false,
705
- enumerable: false,
706
- writable: true,
707
- value: debugTask
708
- });
709
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
710
- return type;
711
- }
712
- __name(ReactElement, "ReactElement");
713
- function cloneAndReplaceKey(oldElement, newKey) {
714
- newKey = ReactElement(
715
- oldElement.type,
716
- newKey,
717
- oldElement.props,
718
- oldElement._owner,
719
- oldElement._debugStack,
720
- oldElement._debugTask
721
- );
722
- oldElement._store && (newKey._store.validated = oldElement._store.validated);
723
- return newKey;
724
- }
725
- __name(cloneAndReplaceKey, "cloneAndReplaceKey");
726
- function validateChildKeys(node) {
727
- isValidElement(node) ? node._store && (node._store.validated = 1) : "object" === typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
728
- }
729
- __name(validateChildKeys, "validateChildKeys");
730
- function isValidElement(object) {
731
- return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
732
- }
733
- __name(isValidElement, "isValidElement");
734
- function escape(key) {
735
- var escaperLookup = { "=": "=0", ":": "=2" };
736
- return "$" + key.replace(/[=:]/g, function(match) {
737
- return escaperLookup[match];
738
- });
739
- }
740
- __name(escape, "escape");
741
- function getElementKey(element, index) {
742
- return "object" === typeof element && null !== element && null != element.key ? (checkKeyStringCoercion(element.key), escape("" + element.key)) : index.toString(36);
743
- }
744
- __name(getElementKey, "getElementKey");
745
- function resolveThenable(thenable) {
746
- switch (thenable.status) {
747
- case "fulfilled":
748
- return thenable.value;
749
- case "rejected":
750
- throw thenable.reason;
751
- default:
752
- switch ("string" === typeof thenable.status ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(
753
- function(fulfilledValue) {
754
- "pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
755
- },
756
- function(error) {
757
- "pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
758
- }
759
- )), thenable.status) {
760
- case "fulfilled":
761
- return thenable.value;
762
- case "rejected":
763
- throw thenable.reason;
764
- }
765
- }
766
- throw thenable;
767
- }
768
- __name(resolveThenable, "resolveThenable");
769
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
770
- var type = typeof children;
771
- if ("undefined" === type || "boolean" === type) children = null;
772
- var invokeCallback = false;
773
- if (null === children) invokeCallback = true;
774
- else
775
- switch (type) {
776
- case "bigint":
777
- case "string":
778
- case "number":
779
- invokeCallback = true;
780
- break;
781
- case "object":
782
- switch (children.$$typeof) {
783
- case REACT_ELEMENT_TYPE:
784
- case REACT_PORTAL_TYPE:
785
- invokeCallback = true;
786
- break;
787
- case REACT_LAZY_TYPE:
788
- return invokeCallback = children._init, mapIntoArray(
789
- invokeCallback(children._payload),
790
- array,
791
- escapedPrefix,
792
- nameSoFar,
793
- callback
794
- );
795
- }
796
- }
797
- if (invokeCallback) {
798
- invokeCallback = children;
799
- callback = callback(invokeCallback);
800
- var childKey = "" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
801
- isArrayImpl(callback) ? (escapedPrefix = "", null != childKey && (escapedPrefix = childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
802
- return c;
803
- })) : null != callback && (isValidElement(callback) && (null != callback.key && (invokeCallback && invokeCallback.key === callback.key || checkKeyStringCoercion(callback.key)), escapedPrefix = cloneAndReplaceKey(
804
- callback,
805
- escapedPrefix + (null == callback.key || invokeCallback && invokeCallback.key === callback.key ? "" : ("" + callback.key).replace(
806
- userProvidedKeyEscapeRegex,
807
- "$&/"
808
- ) + "/") + childKey
809
- ), "" !== nameSoFar && null != invokeCallback && isValidElement(invokeCallback) && null == invokeCallback.key && invokeCallback._store && !invokeCallback._store.validated && (escapedPrefix._store.validated = 2), callback = escapedPrefix), array.push(callback));
810
- return 1;
811
- }
812
- invokeCallback = 0;
813
- childKey = "" === nameSoFar ? "." : nameSoFar + ":";
814
- if (isArrayImpl(children))
815
- for (var i = 0; i < children.length; i++)
816
- nameSoFar = children[i], type = childKey + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(
817
- nameSoFar,
818
- array,
819
- escapedPrefix,
820
- type,
821
- callback
822
- );
823
- else if (i = getIteratorFn(children), "function" === typeof i)
824
- for (i === children.entries && (didWarnAboutMaps || console.warn(
825
- "Using Maps as children is not supported. Use an array of keyed ReactElements instead."
826
- ), didWarnAboutMaps = true), children = i.call(children), i = 0; !(nameSoFar = children.next()).done; )
827
- nameSoFar = nameSoFar.value, type = childKey + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(
828
- nameSoFar,
829
- array,
830
- escapedPrefix,
831
- type,
832
- callback
833
- );
834
- else if ("object" === type) {
835
- if ("function" === typeof children.then)
836
- return mapIntoArray(
837
- resolveThenable(children),
838
- array,
839
- escapedPrefix,
840
- nameSoFar,
841
- callback
842
- );
843
- array = String(children);
844
- throw Error(
845
- "Objects are not valid as a React child (found: " + ("[object Object]" === array ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead."
846
- );
847
- }
848
- return invokeCallback;
849
- }
850
- __name(mapIntoArray, "mapIntoArray");
851
- function mapChildren(children, func, context) {
852
- if (null == children) return children;
853
- var result = [], count = 0;
854
- mapIntoArray(children, result, "", "", function(child) {
855
- return func.call(context, child, count++);
856
- });
857
- return result;
858
- }
859
- __name(mapChildren, "mapChildren");
860
- function lazyInitializer(payload) {
861
- if (-1 === payload._status) {
862
- var ioInfo = payload._ioInfo;
863
- null != ioInfo && (ioInfo.start = ioInfo.end = performance.now());
864
- ioInfo = payload._result;
865
- var thenable = ioInfo();
866
- thenable.then(
867
- function(moduleObject) {
868
- if (0 === payload._status || -1 === payload._status) {
869
- payload._status = 1;
870
- payload._result = moduleObject;
871
- var _ioInfo = payload._ioInfo;
872
- null != _ioInfo && (_ioInfo.end = performance.now());
873
- void 0 === thenable.status && (thenable.status = "fulfilled", thenable.value = moduleObject);
874
- }
875
- },
876
- function(error) {
877
- if (0 === payload._status || -1 === payload._status) {
878
- payload._status = 2;
879
- payload._result = error;
880
- var _ioInfo2 = payload._ioInfo;
881
- null != _ioInfo2 && (_ioInfo2.end = performance.now());
882
- void 0 === thenable.status && (thenable.status = "rejected", thenable.reason = error);
883
- }
884
- }
885
- );
886
- ioInfo = payload._ioInfo;
887
- if (null != ioInfo) {
888
- ioInfo.value = thenable;
889
- var displayName = thenable.displayName;
890
- "string" === typeof displayName && (ioInfo.name = displayName);
891
- }
892
- -1 === payload._status && (payload._status = 0, payload._result = thenable);
893
- }
894
- if (1 === payload._status)
895
- return ioInfo = payload._result, void 0 === ioInfo && console.error(
896
- "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?",
897
- ioInfo
898
- ), "default" in ioInfo || console.error(
899
- "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",
900
- ioInfo
901
- ), ioInfo.default;
902
- throw payload._result;
903
- }
904
- __name(lazyInitializer, "lazyInitializer");
905
- function resolveDispatcher() {
906
- var dispatcher = ReactSharedInternals.H;
907
- null === dispatcher && console.error(
908
- "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."
909
- );
910
- return dispatcher;
911
- }
912
- __name(resolveDispatcher, "resolveDispatcher");
913
- function releaseAsyncTransition() {
914
- ReactSharedInternals.asyncTransitions--;
915
- }
916
- __name(releaseAsyncTransition, "releaseAsyncTransition");
917
- function enqueueTask(task) {
918
- if (null === enqueueTaskImpl)
919
- try {
920
- var requireString = ("require" + Math.random()).slice(0, 7);
921
- enqueueTaskImpl = (module && module[requireString]).call(
922
- module,
923
- "timers"
924
- ).setImmediate;
925
- } catch (_err) {
926
- enqueueTaskImpl = /* @__PURE__ */ __name(function(callback) {
927
- false === didWarnAboutMessageChannel && (didWarnAboutMessageChannel = true, "undefined" === typeof MessageChannel && console.error(
928
- "This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."
929
- ));
930
- var channel = new MessageChannel();
931
- channel.port1.onmessage = callback;
932
- channel.port2.postMessage(void 0);
933
- }, "enqueueTaskImpl");
934
- }
935
- return enqueueTaskImpl(task);
936
- }
937
- __name(enqueueTask, "enqueueTask");
938
- function aggregateErrors(errors) {
939
- return 1 < errors.length && "function" === typeof AggregateError ? new AggregateError(errors) : errors[0];
940
- }
941
- __name(aggregateErrors, "aggregateErrors");
942
- function popActScope(prevActQueue, prevActScopeDepth) {
943
- prevActScopeDepth !== actScopeDepth - 1 && console.error(
944
- "You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "
945
- );
946
- actScopeDepth = prevActScopeDepth;
947
- }
948
- __name(popActScope, "popActScope");
949
- function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
950
- var queue = ReactSharedInternals.actQueue;
951
- if (null !== queue)
952
- if (0 !== queue.length)
953
- try {
954
- flushActQueue(queue);
955
- enqueueTask(function() {
956
- return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
957
- });
958
- return;
959
- } catch (error) {
960
- ReactSharedInternals.thrownErrors.push(error);
961
- }
962
- else ReactSharedInternals.actQueue = null;
963
- 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve(returnValue);
964
- }
965
- __name(recursivelyFlushAsyncActWork, "recursivelyFlushAsyncActWork");
966
- function flushActQueue(queue) {
967
- if (!isFlushing) {
968
- isFlushing = true;
969
- var i = 0;
970
- try {
971
- for (; i < queue.length; i++) {
972
- var callback = queue[i];
973
- do {
974
- ReactSharedInternals.didUsePromise = false;
975
- var continuation = callback(false);
976
- if (null !== continuation) {
977
- if (ReactSharedInternals.didUsePromise) {
978
- queue[i] = callback;
979
- queue.splice(0, i);
980
- return;
981
- }
982
- callback = continuation;
983
- } else break;
984
- } while (1);
985
- }
986
- queue.length = 0;
987
- } catch (error) {
988
- queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error);
989
- } finally {
990
- isFlushing = false;
991
- }
992
- }
993
- }
994
- __name(flushActQueue, "flushActQueue");
995
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
996
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, didWarnStateUpdateForUnmountedComponent = {}, ReactNoopUpdateQueue = {
997
- isMounted: /* @__PURE__ */ __name(function() {
998
- return false;
999
- }, "isMounted"),
1000
- enqueueForceUpdate: /* @__PURE__ */ __name(function(publicInstance) {
1001
- warnNoop(publicInstance, "forceUpdate");
1002
- }, "enqueueForceUpdate"),
1003
- enqueueReplaceState: /* @__PURE__ */ __name(function(publicInstance) {
1004
- warnNoop(publicInstance, "replaceState");
1005
- }, "enqueueReplaceState"),
1006
- enqueueSetState: /* @__PURE__ */ __name(function(publicInstance) {
1007
- warnNoop(publicInstance, "setState");
1008
- }, "enqueueSetState")
1009
- }, assign = Object.assign, emptyObject = {};
1010
- Object.freeze(emptyObject);
1011
- Component.prototype.isReactComponent = {};
1012
- Component.prototype.setState = function(partialState, callback) {
1013
- if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState)
1014
- throw Error(
1015
- "takes an object of state variables to update or a function which returns an object of state variables."
1016
- );
1017
- this.updater.enqueueSetState(this, partialState, callback, "setState");
1018
- };
1019
- Component.prototype.forceUpdate = function(callback) {
1020
- this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
1021
- };
1022
- var deprecatedAPIs = {
1023
- isMounted: [
1024
- "isMounted",
1025
- "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
1026
- ],
1027
- replaceState: [
1028
- "replaceState",
1029
- "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
1030
- ]
1031
- };
1032
- for (fnName in deprecatedAPIs)
1033
- deprecatedAPIs.hasOwnProperty(fnName) && defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
1034
- ComponentDummy.prototype = Component.prototype;
1035
- deprecatedAPIs = PureComponent.prototype = new ComponentDummy();
1036
- deprecatedAPIs.constructor = PureComponent;
1037
- assign(deprecatedAPIs, Component.prototype);
1038
- deprecatedAPIs.isPureReactComponent = true;
1039
- var isArrayImpl = Array.isArray, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = {
1040
- H: null,
1041
- A: null,
1042
- T: null,
1043
- S: null,
1044
- actQueue: null,
1045
- asyncTransitions: 0,
1046
- isBatchingLegacy: false,
1047
- didScheduleLegacyUpdate: false,
1048
- didUsePromise: false,
1049
- thrownErrors: [],
1050
- getCurrentStack: null,
1051
- recentlyCreatedOwnerStacks: 0
1052
- }, hasOwnProperty = Object.prototype.hasOwnProperty, createTask = console.createTask ? console.createTask : function() {
1053
- return null;
1054
- };
1055
- deprecatedAPIs = {
1056
- react_stack_bottom_frame: /* @__PURE__ */ __name(function(callStackForError) {
1057
- return callStackForError();
1058
- }, "react_stack_bottom_frame")
1059
- };
1060
- var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
1061
- var didWarnAboutElementRef = {};
1062
- var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(
1063
- deprecatedAPIs,
1064
- UnknownOwner
1065
- )();
1066
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
1067
- var didWarnAboutMaps = false, userProvidedKeyEscapeRegex = /\/+/g, reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
1068
- if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
1069
- var event = new window.ErrorEvent("error", {
1070
- bubbles: true,
1071
- cancelable: true,
1072
- message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
1073
- error
1074
- });
1075
- if (!window.dispatchEvent(event)) return;
1076
- } else if ("object" === typeof process && "function" === typeof process.emit) {
1077
- process.emit("uncaughtException", error);
1078
- return;
1079
- }
1080
- console.error(error);
1081
- }, didWarnAboutMessageChannel = false, enqueueTaskImpl = null, actScopeDepth = 0, didWarnNoAwaitAct = false, isFlushing = false, queueSeveralMicrotasks = "function" === typeof queueMicrotask ? function(callback) {
1082
- queueMicrotask(function() {
1083
- return queueMicrotask(callback);
1084
- });
1085
- } : enqueueTask;
1086
- deprecatedAPIs = Object.freeze({
1087
- __proto__: null,
1088
- c: /* @__PURE__ */ __name(function(size) {
1089
- return resolveDispatcher().useMemoCache(size);
1090
- }, "c")
1091
- });
1092
- var fnName = {
1093
- map: mapChildren,
1094
- forEach: /* @__PURE__ */ __name(function(children, forEachFunc, forEachContext) {
1095
- mapChildren(
1096
- children,
1097
- function() {
1098
- forEachFunc.apply(this, arguments);
1099
- },
1100
- forEachContext
1101
- );
1102
- }, "forEach"),
1103
- count: /* @__PURE__ */ __name(function(children) {
1104
- var n = 0;
1105
- mapChildren(children, function() {
1106
- n++;
1107
- });
1108
- return n;
1109
- }, "count"),
1110
- toArray: /* @__PURE__ */ __name(function(children) {
1111
- return mapChildren(children, function(child) {
1112
- return child;
1113
- }) || [];
1114
- }, "toArray"),
1115
- only: /* @__PURE__ */ __name(function(children) {
1116
- if (!isValidElement(children))
1117
- throw Error(
1118
- "React.Children.only expected to receive a single React element child."
1119
- );
1120
- return children;
1121
- }, "only")
1122
- };
1123
- exports.Activity = REACT_ACTIVITY_TYPE;
1124
- exports.Children = fnName;
1125
- exports.Component = Component;
1126
- exports.Fragment = REACT_FRAGMENT_TYPE;
1127
- exports.Profiler = REACT_PROFILER_TYPE;
1128
- exports.PureComponent = PureComponent;
1129
- exports.StrictMode = REACT_STRICT_MODE_TYPE;
1130
- exports.Suspense = REACT_SUSPENSE_TYPE;
1131
- exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
1132
- exports.__COMPILER_RUNTIME = deprecatedAPIs;
1133
- exports.act = function(callback) {
1134
- var prevActQueue = ReactSharedInternals.actQueue, prevActScopeDepth = actScopeDepth;
1135
- actScopeDepth++;
1136
- var queue = ReactSharedInternals.actQueue = null !== prevActQueue ? prevActQueue : [], didAwaitActCall = false;
1137
- try {
1138
- var result = callback();
1139
- } catch (error) {
1140
- ReactSharedInternals.thrownErrors.push(error);
1141
- }
1142
- if (0 < ReactSharedInternals.thrownErrors.length)
1143
- throw popActScope(prevActQueue, prevActScopeDepth), callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
1144
- if (null !== result && "object" === typeof result && "function" === typeof result.then) {
1145
- var thenable = result;
1146
- queueSeveralMicrotasks(function() {
1147
- didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error(
1148
- "You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"
1149
- ));
1150
- });
1151
- return {
1152
- then: /* @__PURE__ */ __name(function(resolve, reject) {
1153
- didAwaitActCall = true;
1154
- thenable.then(
1155
- function(returnValue) {
1156
- popActScope(prevActQueue, prevActScopeDepth);
1157
- if (0 === prevActScopeDepth) {
1158
- try {
1159
- flushActQueue(queue), enqueueTask(function() {
1160
- return recursivelyFlushAsyncActWork(
1161
- returnValue,
1162
- resolve,
1163
- reject
1164
- );
1165
- });
1166
- } catch (error$0) {
1167
- ReactSharedInternals.thrownErrors.push(error$0);
1168
- }
1169
- if (0 < ReactSharedInternals.thrownErrors.length) {
1170
- var _thrownError = aggregateErrors(
1171
- ReactSharedInternals.thrownErrors
1172
- );
1173
- ReactSharedInternals.thrownErrors.length = 0;
1174
- reject(_thrownError);
1175
- }
1176
- } else resolve(returnValue);
1177
- },
1178
- function(error) {
1179
- popActScope(prevActQueue, prevActScopeDepth);
1180
- 0 < ReactSharedInternals.thrownErrors.length ? (error = aggregateErrors(
1181
- ReactSharedInternals.thrownErrors
1182
- ), ReactSharedInternals.thrownErrors.length = 0, reject(error)) : reject(error);
1183
- }
1184
- );
1185
- }, "then")
1186
- };
1187
- }
1188
- var returnValue$jscomp$0 = result;
1189
- popActScope(prevActQueue, prevActScopeDepth);
1190
- 0 === prevActScopeDepth && (flushActQueue(queue), 0 !== queue.length && queueSeveralMicrotasks(function() {
1191
- didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error(
1192
- "A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"
1193
- ));
1194
- }), ReactSharedInternals.actQueue = null);
1195
- if (0 < ReactSharedInternals.thrownErrors.length)
1196
- throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
1197
- return {
1198
- then: /* @__PURE__ */ __name(function(resolve, reject) {
1199
- didAwaitActCall = true;
1200
- 0 === prevActScopeDepth ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
1201
- return recursivelyFlushAsyncActWork(
1202
- returnValue$jscomp$0,
1203
- resolve,
1204
- reject
1205
- );
1206
- })) : resolve(returnValue$jscomp$0);
1207
- }, "then")
1208
- };
1209
- };
1210
- exports.cache = function(fn) {
1211
- return function() {
1212
- return fn.apply(null, arguments);
1213
- };
1214
- };
1215
- exports.cacheSignal = function() {
1216
- return null;
1217
- };
1218
- exports.captureOwnerStack = function() {
1219
- var getCurrentStack = ReactSharedInternals.getCurrentStack;
1220
- return null === getCurrentStack ? null : getCurrentStack();
1221
- };
1222
- exports.cloneElement = function(element, config, children) {
1223
- if (null === element || void 0 === element)
1224
- throw Error(
1225
- "The argument must be a React element, but you passed " + element + "."
1226
- );
1227
- var props = assign({}, element.props), key = element.key, owner = element._owner;
1228
- if (null != config) {
1229
- var JSCompiler_inline_result;
1230
- a: {
1231
- if (hasOwnProperty.call(config, "ref") && (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(
1232
- config,
1233
- "ref"
1234
- ).get) && JSCompiler_inline_result.isReactWarning) {
1235
- JSCompiler_inline_result = false;
1236
- break a;
1237
- }
1238
- JSCompiler_inline_result = void 0 !== config.ref;
1239
- }
1240
- JSCompiler_inline_result && (owner = getOwner());
1241
- hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key);
1242
- for (propName in config)
1243
- !hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
1244
- }
1245
- var propName = arguments.length - 2;
1246
- if (1 === propName) props.children = children;
1247
- else if (1 < propName) {
1248
- JSCompiler_inline_result = Array(propName);
1249
- for (var i = 0; i < propName; i++)
1250
- JSCompiler_inline_result[i] = arguments[i + 2];
1251
- props.children = JSCompiler_inline_result;
1252
- }
1253
- props = ReactElement(
1254
- element.type,
1255
- key,
1256
- props,
1257
- owner,
1258
- element._debugStack,
1259
- element._debugTask
1260
- );
1261
- for (key = 2; key < arguments.length; key++)
1262
- validateChildKeys(arguments[key]);
1263
- return props;
1264
- };
1265
- exports.createContext = function(defaultValue) {
1266
- defaultValue = {
1267
- $$typeof: REACT_CONTEXT_TYPE,
1268
- _currentValue: defaultValue,
1269
- _currentValue2: defaultValue,
1270
- _threadCount: 0,
1271
- Provider: null,
1272
- Consumer: null
1273
- };
1274
- defaultValue.Provider = defaultValue;
1275
- defaultValue.Consumer = {
1276
- $$typeof: REACT_CONSUMER_TYPE,
1277
- _context: defaultValue
1278
- };
1279
- defaultValue._currentRenderer = null;
1280
- defaultValue._currentRenderer2 = null;
1281
- return defaultValue;
1282
- };
1283
- exports.createElement = function(type, config, children) {
1284
- for (var i = 2; i < arguments.length; i++)
1285
- validateChildKeys(arguments[i]);
1286
- i = {};
1287
- var key = null;
1288
- if (null != config)
1289
- for (propName in didWarnAboutOldJSXRuntime || !("__self" in config) || "key" in config || (didWarnAboutOldJSXRuntime = true, console.warn(
1290
- "Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform"
1291
- )), hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key), config)
1292
- hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (i[propName] = config[propName]);
1293
- var childrenLength = arguments.length - 2;
1294
- if (1 === childrenLength) i.children = children;
1295
- else if (1 < childrenLength) {
1296
- for (var childArray = Array(childrenLength), _i = 0; _i < childrenLength; _i++)
1297
- childArray[_i] = arguments[_i + 2];
1298
- Object.freeze && Object.freeze(childArray);
1299
- i.children = childArray;
1300
- }
1301
- if (type && type.defaultProps)
1302
- for (propName in childrenLength = type.defaultProps, childrenLength)
1303
- void 0 === i[propName] && (i[propName] = childrenLength[propName]);
1304
- key && defineKeyPropWarningGetter(
1305
- i,
1306
- "function" === typeof type ? type.displayName || type.name || "Unknown" : type
1307
- );
1308
- var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
1309
- return ReactElement(
1310
- type,
1311
- key,
1312
- i,
1313
- getOwner(),
1314
- propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
1315
- propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask
1316
- );
1317
- };
1318
- exports.createRef = function() {
1319
- var refObject = { current: null };
1320
- Object.seal(refObject);
1321
- return refObject;
1322
- };
1323
- exports.forwardRef = function(render) {
1324
- null != render && render.$$typeof === REACT_MEMO_TYPE ? console.error(
1325
- "forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."
1326
- ) : "function" !== typeof render ? console.error(
1327
- "forwardRef requires a render function but was given %s.",
1328
- null === render ? "null" : typeof render
1329
- ) : 0 !== render.length && 2 !== render.length && console.error(
1330
- "forwardRef render functions accept exactly two parameters: props and ref. %s",
1331
- 1 === render.length ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined."
1332
- );
1333
- null != render && null != render.defaultProps && console.error(
1334
- "forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?"
1335
- );
1336
- var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render }, ownName;
1337
- Object.defineProperty(elementType, "displayName", {
1338
- enumerable: false,
1339
- configurable: true,
1340
- get: /* @__PURE__ */ __name(function() {
1341
- return ownName;
1342
- }, "get"),
1343
- set: /* @__PURE__ */ __name(function(name) {
1344
- ownName = name;
1345
- render.name || render.displayName || (Object.defineProperty(render, "name", { value: name }), render.displayName = name);
1346
- }, "set")
1347
- });
1348
- return elementType;
1349
- };
1350
- exports.isValidElement = isValidElement;
1351
- exports.lazy = function(ctor) {
1352
- ctor = { _status: -1, _result: ctor };
1353
- var lazyType = {
1354
- $$typeof: REACT_LAZY_TYPE,
1355
- _payload: ctor,
1356
- _init: lazyInitializer
1357
- }, ioInfo = {
1358
- name: "lazy",
1359
- start: -1,
1360
- end: -1,
1361
- value: null,
1362
- owner: null,
1363
- debugStack: Error("react-stack-top-frame"),
1364
- debugTask: console.createTask ? console.createTask("lazy()") : null
1365
- };
1366
- ctor._ioInfo = ioInfo;
1367
- lazyType._debugInfo = [{ awaited: ioInfo }];
1368
- return lazyType;
1369
- };
1370
- exports.memo = function(type, compare) {
1371
- null == type && console.error(
1372
- "memo: The first argument must be a component. Instead received: %s",
1373
- null === type ? "null" : typeof type
1374
- );
1375
- compare = {
1376
- $$typeof: REACT_MEMO_TYPE,
1377
- type,
1378
- compare: void 0 === compare ? null : compare
1379
- };
1380
- var ownName;
1381
- Object.defineProperty(compare, "displayName", {
1382
- enumerable: false,
1383
- configurable: true,
1384
- get: /* @__PURE__ */ __name(function() {
1385
- return ownName;
1386
- }, "get"),
1387
- set: /* @__PURE__ */ __name(function(name) {
1388
- ownName = name;
1389
- type.name || type.displayName || (Object.defineProperty(type, "name", { value: name }), type.displayName = name);
1390
- }, "set")
1391
- });
1392
- return compare;
1393
- };
1394
- exports.startTransition = function(scope) {
1395
- var prevTransition = ReactSharedInternals.T, currentTransition = {};
1396
- currentTransition._updatedFibers = /* @__PURE__ */ new Set();
1397
- ReactSharedInternals.T = currentTransition;
1398
- try {
1399
- var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
1400
- null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
1401
- "object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && (ReactSharedInternals.asyncTransitions++, returnValue.then(releaseAsyncTransition, releaseAsyncTransition), returnValue.then(noop, reportGlobalError));
1402
- } catch (error) {
1403
- reportGlobalError(error);
1404
- } finally {
1405
- null === prevTransition && currentTransition._updatedFibers && (scope = currentTransition._updatedFibers.size, currentTransition._updatedFibers.clear(), 10 < scope && console.warn(
1406
- "Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."
1407
- )), null !== prevTransition && null !== currentTransition.types && (null !== prevTransition.types && prevTransition.types !== currentTransition.types && console.error(
1408
- "We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."
1409
- ), prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
1410
- }
1411
- };
1412
- exports.unstable_useCacheRefresh = function() {
1413
- return resolveDispatcher().useCacheRefresh();
1414
- };
1415
- exports.use = function(usable) {
1416
- return resolveDispatcher().use(usable);
1417
- };
1418
- exports.useActionState = function(action, initialState, permalink) {
1419
- return resolveDispatcher().useActionState(
1420
- action,
1421
- initialState,
1422
- permalink
1423
- );
1424
- };
1425
- exports.useCallback = function(callback, deps) {
1426
- return resolveDispatcher().useCallback(callback, deps);
1427
- };
1428
- exports.useContext = function(Context) {
1429
- var dispatcher = resolveDispatcher();
1430
- Context.$$typeof === REACT_CONSUMER_TYPE && console.error(
1431
- "Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"
1432
- );
1433
- return dispatcher.useContext(Context);
1434
- };
1435
- exports.useDebugValue = function(value, formatterFn) {
1436
- return resolveDispatcher().useDebugValue(value, formatterFn);
1437
- };
1438
- exports.useDeferredValue = function(value, initialValue) {
1439
- return resolveDispatcher().useDeferredValue(value, initialValue);
1440
- };
1441
- exports.useEffect = function(create, deps) {
1442
- null == create && console.warn(
1443
- "React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1444
- );
1445
- return resolveDispatcher().useEffect(create, deps);
1446
- };
1447
- exports.useEffectEvent = function(callback) {
1448
- return resolveDispatcher().useEffectEvent(callback);
1449
- };
1450
- exports.useId = function() {
1451
- return resolveDispatcher().useId();
1452
- };
1453
- exports.useImperativeHandle = function(ref, create, deps) {
1454
- return resolveDispatcher().useImperativeHandle(ref, create, deps);
1455
- };
1456
- exports.useInsertionEffect = function(create, deps) {
1457
- null == create && console.warn(
1458
- "React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1459
- );
1460
- return resolveDispatcher().useInsertionEffect(create, deps);
1461
- };
1462
- exports.useLayoutEffect = function(create, deps) {
1463
- null == create && console.warn(
1464
- "React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1465
- );
1466
- return resolveDispatcher().useLayoutEffect(create, deps);
1467
- };
1468
- exports.useMemo = function(create, deps) {
1469
- return resolveDispatcher().useMemo(create, deps);
1470
- };
1471
- exports.useOptimistic = function(passthrough, reducer) {
1472
- return resolveDispatcher().useOptimistic(passthrough, reducer);
1473
- };
1474
- exports.useReducer = function(reducer, initialArg, init) {
1475
- return resolveDispatcher().useReducer(reducer, initialArg, init);
1476
- };
1477
- exports.useRef = function(initialValue) {
1478
- return resolveDispatcher().useRef(initialValue);
1479
- };
1480
- exports.useState = function(initialState) {
1481
- return resolveDispatcher().useState(initialState);
1482
- };
1483
- exports.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
1484
- return resolveDispatcher().useSyncExternalStore(
1485
- subscribe,
1486
- getSnapshot,
1487
- getServerSnapshot
1488
- );
1489
- };
1490
- exports.useTransition = function() {
1491
- return resolveDispatcher().useTransition();
1492
- };
1493
- exports.version = "19.2.4";
1494
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
1495
- }();
1496
- }
1497
- });
1498
-
1499
- // node_modules/react/index.js
1500
- var require_react = __commonJS({
1501
- "node_modules/react/index.js"(exports, module) {
1502
- "use strict";
1503
- init_esbuild_shims();
1504
- if (process.env.NODE_ENV === "production") {
1505
- module.exports = require_react_production();
1506
- } else {
1507
- module.exports = require_react_development();
1508
- }
1509
- }
1510
- });
1511
-
1512
- // packages/cli/src/ui/commands/contextCommand.ts
1513
- init_esbuild_shims();
1514
-
1515
- // packages/cli/src/ui/commands/types.ts
1516
- init_esbuild_shims();
1517
-
1518
- // packages/cli/src/ui/types.ts
1519
- init_esbuild_shims();
1520
- var import_react = __toESM(require_react(), 1);
1521
-
1522
- // packages/cli/src/i18n/index.ts
1523
- init_esbuild_shims();
1524
- import * as fs from "node:fs";
1525
- import * as path from "node:path";
1526
- import { pathToFileURL } from "node:url";
1527
-
1528
- // packages/cli/src/i18n/languages.ts
1529
- init_esbuild_shims();
1530
- var SUPPORTED_LANGUAGES = [
1531
- {
1532
- code: "en",
1533
- id: "en-US",
1534
- fullName: "English",
1535
- nativeName: "English"
1536
- },
1537
- {
1538
- code: "zh-TW",
1539
- id: "zh-TW",
1540
- fullName: "Traditional Chinese",
1541
- nativeName: "\u7E41\u9AD4\u4E2D\u6587",
1542
- strictParity: true
1543
- },
1544
- {
1545
- code: "zh",
1546
- id: "zh-CN",
1547
- fullName: "Chinese",
1548
- nativeName: "\u4E2D\u6587",
1549
- strictParity: true
1550
- },
1551
- {
1552
- code: "ru",
1553
- id: "ru-RU",
1554
- fullName: "Russian",
1555
- nativeName: "\u0420\u0443\u0441\u0441\u043A\u0438\u0439"
1556
- },
1557
- {
1558
- code: "de",
1559
- id: "de-DE",
1560
- fullName: "German",
1561
- nativeName: "Deutsch"
1562
- },
1563
- {
1564
- code: "ja",
1565
- id: "ja-JP",
1566
- fullName: "Japanese",
1567
- nativeName: "\u65E5\u672C\u8A9E"
1568
- },
1569
- {
1570
- code: "pt",
1571
- id: "pt-BR",
1572
- fullName: "Portuguese",
1573
- nativeName: "Portugu\xEAs"
1574
- },
1575
- {
1576
- code: "fr",
1577
- id: "fr-FR",
1578
- fullName: "French",
1579
- nativeName: "Fran\xE7ais"
1580
- },
1581
- {
1582
- code: "ca",
1583
- id: "ca-ES",
1584
- fullName: "Catalan",
1585
- nativeName: "Catal\xE0"
1586
- }
1587
- ];
1588
- function normalizeLanguageCandidate(input) {
1589
- return input.trim().replace(/_/g, "-").toLowerCase();
1590
- }
1591
- __name(normalizeLanguageCandidate, "normalizeLanguageCandidate");
1592
- function matchesLocaleToken(candidate, token) {
1593
- return candidate === token || candidate.startsWith(`${token}-`) || candidate.startsWith(`${token}.`) || candidate.startsWith(`${token}@`);
1594
- }
1595
- __name(matchesLocaleToken, "matchesLocaleToken");
1596
- function getMatchedLocaleTokenLength(candidate, language) {
1597
- const code = language.code.toLowerCase();
1598
- const id = language.id.toLowerCase();
1599
- if (matchesLocaleToken(candidate, id)) {
1600
- return id.length;
1601
- }
1602
- if (matchesLocaleToken(candidate, code)) {
1603
- return code.length;
1604
- }
1605
- return void 0;
1606
- }
1607
- __name(getMatchedLocaleTokenLength, "getMatchedLocaleTokenLength");
1608
- function resolveSupportedLanguage(input) {
1609
- const normalized = normalizeLanguageCandidate(input);
1610
- if (!normalized) {
1611
- return void 0;
1612
- }
1613
- let bestMatch;
1614
- for (const language of SUPPORTED_LANGUAGES) {
1615
- if (normalized === language.fullName.toLowerCase() || language.nativeName && normalized === language.nativeName.toLowerCase()) {
1616
- return language.code;
1617
- }
1618
- const tokenLength = getMatchedLocaleTokenLength(normalized, language);
1619
- if (tokenLength !== void 0 && (!bestMatch || tokenLength > bestMatch.tokenLength)) {
1620
- bestMatch = { code: language.code, tokenLength };
1621
- }
1622
- }
1623
- return bestMatch?.code;
1624
- }
1625
- __name(resolveSupportedLanguage, "resolveSupportedLanguage");
1626
- function getLanguageNameFromLocale(locale) {
1627
- const resolved = resolveSupportedLanguage(locale);
1628
- const lang = resolved ? SUPPORTED_LANGUAGES.find((language) => language.code === resolved) : void 0;
1629
- return lang?.fullName || "English";
1630
- }
1631
- __name(getLanguageNameFromLocale, "getLanguageNameFromLocale");
1632
- function getLanguageSettingsOptions() {
1633
- return [
1634
- { value: "auto", label: "Auto (detect from system)" },
1635
- ...SUPPORTED_LANGUAGES.map((l) => ({
1636
- value: l.code,
1637
- label: l.nativeName ? `${l.nativeName} (${l.fullName})` : `${l.fullName} (${l.id})`
1638
- }))
1639
- ];
1640
- }
1641
- __name(getLanguageSettingsOptions, "getLanguageSettingsOptions");
1642
- function getSupportedLanguageIds(separator = "|") {
1643
- return SUPPORTED_LANGUAGES.map((l) => l.id).join(separator);
1644
- }
1645
- __name(getSupportedLanguageIds, "getSupportedLanguageIds");
1646
-
1647
- // packages/cli/src/i18n/translationDict.ts
1648
- init_esbuild_shims();
1649
- function getTranslationModuleExport(module) {
1650
- return Object.prototype.hasOwnProperty.call(module, "default") ? module["default"] : module;
1651
- }
1652
- __name(getTranslationModuleExport, "getTranslationModuleExport");
1653
- function isTranslationDict(value) {
1654
- return value !== null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length > 0;
1655
- }
1656
- __name(isTranslationDict, "isTranslationDict");
1657
-
1658
- // packages/cli/src/i18n/mustTranslateKeys.ts
1659
- init_esbuild_shims();
1660
-
1661
- // import("./locales/**/*.js") in packages/cli/src/i18n/index.ts
1662
- var globImport_locales_js = __glob({
1663
- "./locales/ca.js": () => import("./ca-S3XJMT6P.js"),
1664
- "./locales/de.js": () => import("./de-MNR4SMAI.js"),
1665
- "./locales/en.js": () => import("./en-FIUWJSZR.js"),
1666
- "./locales/fr.js": () => import("./fr-OFJFHLCR.js"),
1667
- "./locales/ja.js": () => import("./ja-V6OQ6VL7.js"),
1668
- "./locales/pt.js": () => import("./pt-ZLE6SA4A.js"),
1669
- "./locales/ru.js": () => import("./ru-A4OHIUNN.js"),
1670
- "./locales/zh-TW.js": () => import("./zh-TW-552S24LR.js"),
1671
- "./locales/zh.js": () => import("./zh-V32QONGV.js")
1672
- });
1673
-
1674
- // packages/cli/src/i18n/index.ts
1675
- var currentLanguage = "en";
1676
- var translations = {};
1677
- var translationCache = {};
1678
- var loadingPromises = {};
1679
- var getBuiltinLocalesDir = /* @__PURE__ */ __name(() => path.join(resolveBundleDir(import.meta.url), "locales"), "getBuiltinLocalesDir");
1680
- var getUserLocalesDir = /* @__PURE__ */ __name(() => path.join(Storage.getGlobalQwenDir(), "locales"), "getUserLocalesDir");
1681
- var getLocalePath = /* @__PURE__ */ __name((lang, useUserDir = false) => {
1682
- const baseDir = useUserDir ? getUserLocalesDir() : getBuiltinLocalesDir();
1683
- return path.join(baseDir, `${lang}.js`);
1684
- }, "getLocalePath");
1685
- function detectSystemLanguage() {
1686
- const envLang = process.env["QWEN_CODE_LANG"] || process.env["LANG"];
1687
- if (envLang) {
1688
- const resolved = resolveSupportedLanguage(envLang);
1689
- if (resolved) {
1690
- return resolved;
1691
- }
1692
- }
1693
- try {
1694
- const locale = Intl.DateTimeFormat().resolvedOptions().locale;
1695
- const resolved = resolveSupportedLanguage(locale);
1696
- if (resolved) {
1697
- return resolved;
1698
- }
1699
- } catch {
1700
- }
1701
- return "en";
1702
- }
1703
- __name(detectSystemLanguage, "detectSystemLanguage");
1704
- async function tryImportTranslations(moduleSpecifier) {
1705
- try {
1706
- const module = await import(moduleSpecifier);
1707
- const result = getTranslationModuleExport(module);
1708
- if (isTranslationDict(result)) {
1709
- return { translations: result };
1710
- }
1711
- return {
1712
- error: new Error("Module loaded but result is empty or invalid")
1713
- };
1714
- } catch (error) {
1715
- return {
1716
- error: error instanceof Error ? error : new Error(String(error))
1717
- };
1718
- }
1719
- }
1720
- __name(tryImportTranslations, "tryImportTranslations");
1721
- async function tryImportBundledTranslations(lang) {
1722
- try {
1723
- const module = await globImport_locales_js(`./locales/${lang}.js`);
1724
- const result = getTranslationModuleExport(module);
1725
- if (isTranslationDict(result)) {
1726
- return { translations: result };
1727
- }
1728
- return {
1729
- error: new Error("Module loaded but result is empty or invalid")
1730
- };
1731
- } catch (error) {
1732
- return {
1733
- error: error instanceof Error ? error : new Error(String(error))
1734
- };
1735
- }
1736
- }
1737
- __name(tryImportBundledTranslations, "tryImportBundledTranslations");
1738
- async function loadTranslationsAsync(lang) {
1739
- if (translationCache[lang]) {
1740
- return translationCache[lang];
1741
- }
1742
- const existingPromise = loadingPromises[lang];
1743
- if (existingPromise) {
1744
- return existingPromise;
1745
- }
1746
- const loadPromise = (async () => {
1747
- const userJsPath = getLocalePath(lang, true);
1748
- if (fs.existsSync(getUserLocalesDir()) && fs.existsSync(userJsPath)) {
1749
- const userResult = await tryImportTranslations(
1750
- pathToFileURL(userJsPath).href
1751
- );
1752
- if (userResult.translations) {
1753
- translationCache[lang] = userResult.translations;
1754
- return userResult.translations;
1755
- }
1756
- writeStderrLine(
1757
- `Failed to load translations from user directory for ${lang}: ${userResult.error.message}`
1758
- );
1759
- }
1760
- const builtinJsPath = getLocalePath(lang, false);
1761
- const builtinModuleSpecifiers = [];
1762
- if (fs.existsSync(getBuiltinLocalesDir()) && fs.existsSync(builtinJsPath)) {
1763
- builtinModuleSpecifiers.push(pathToFileURL(builtinJsPath).href);
1764
- }
1765
- let lastBuiltinError;
1766
- for (const moduleSpecifier of builtinModuleSpecifiers) {
1767
- const builtinResult = await tryImportTranslations(moduleSpecifier);
1768
- if (builtinResult.translations) {
1769
- translationCache[lang] = builtinResult.translations;
1770
- return builtinResult.translations;
1771
- }
1772
- lastBuiltinError = builtinResult.error;
1773
- }
1774
- const bundledBuiltinResult = await tryImportBundledTranslations(lang);
1775
- if (bundledBuiltinResult.translations) {
1776
- translationCache[lang] = bundledBuiltinResult.translations;
1777
- return bundledBuiltinResult.translations;
1778
- }
1779
- lastBuiltinError = bundledBuiltinResult.error;
1780
- if (lastBuiltinError) {
1781
- writeStderrLine(
1782
- `Failed to load JS translations for ${lang}: ${lastBuiltinError.message}`
1783
- );
1784
- }
1785
- translationCache[lang] = {};
1786
- return {};
1787
- })();
1788
- loadingPromises[lang] = loadPromise;
1789
- loadPromise.finally(() => {
1790
- delete loadingPromises[lang];
1791
- });
1792
- return loadPromise;
1793
- }
1794
- __name(loadTranslationsAsync, "loadTranslationsAsync");
1795
- function interpolate(template, params) {
1796
- if (!params) return template;
1797
- return template.replace(
1798
- /\{\{(\w+)\}\}/g,
1799
- (match, key) => params[key] ?? match
1800
- );
1801
- }
1802
- __name(interpolate, "interpolate");
1803
- function resolveLanguage(lang) {
1804
- if (lang === "auto") {
1805
- return detectSystemLanguage();
1806
- }
1807
- return resolveSupportedLanguage(lang) ?? lang;
1808
- }
1809
- __name(resolveLanguage, "resolveLanguage");
1810
- async function setLanguageAsync(lang) {
1811
- currentLanguage = resolveLanguage(lang);
1812
- translations = await loadTranslationsAsync(currentLanguage);
1813
- }
1814
- __name(setLanguageAsync, "setLanguageAsync");
1815
- function getCurrentLanguage() {
1816
- return currentLanguage;
1817
- }
1818
- __name(getCurrentLanguage, "getCurrentLanguage");
1819
- function t(key, params) {
1820
- const translation = translations[key] ?? key;
1821
- if (Array.isArray(translation)) {
1822
- return key;
1823
- }
1824
- return interpolate(translation, params);
1825
- }
1826
- __name(t, "t");
1827
- function ta(key) {
1828
- const translation = translations[key];
1829
- if (Array.isArray(translation)) {
1830
- return translation;
1831
- }
1832
- return [];
1833
- }
1834
- __name(ta, "ta");
1835
- async function initializeI18n(lang) {
1836
- await setLanguageAsync(lang ?? "auto");
1837
- }
1838
- __name(initializeI18n, "initializeI18n");
1839
-
1840
- // packages/cli/src/ui/commands/contextCommand.ts
1841
- var DEFAULT_COMPRESSION_THRESHOLD = 0.7;
1842
- function estimateTokens(text) {
1843
- if (!text || text.length === 0) return 0;
1844
- let asciiChars = 0;
1845
- let nonAsciiChars = 0;
1846
- for (let i = 0; i < text.length; i++) {
1847
- const charCode = text.charCodeAt(i);
1848
- if (charCode < 128) {
1849
- asciiChars++;
1850
- } else {
1851
- nonAsciiChars++;
1852
- }
1853
- }
1854
- return Math.ceil(asciiChars / 4 + nonAsciiChars * 1.5);
1855
- }
1856
- __name(estimateTokens, "estimateTokens");
1857
- function parseMemoryFiles(memoryContent) {
1858
- if (!memoryContent || memoryContent.trim().length === 0) return [];
1859
- const results = [];
1860
- const regex = /--- Context from: (.+?) ---\n([\s\S]*?)--- End of Context from: \1 ---/g;
1861
- let match;
1862
- while ((match = regex.exec(memoryContent)) !== null) {
1863
- const filePath = match[1];
1864
- const content = match[2];
1865
- results.push({
1866
- path: filePath,
1867
- tokens: estimateTokens(content)
1868
- });
1869
- }
1870
- if (results.length === 0 && memoryContent.trim().length > 0) {
1871
- results.push({
1872
- path: t("memory"),
1873
- tokens: estimateTokens(memoryContent)
1874
- });
1875
- }
1876
- return results;
1877
- }
1878
- __name(parseMemoryFiles, "parseMemoryFiles");
1879
- async function collectContextData(config, showDetails) {
1880
- const modelName = config.getModel() || "unknown";
1881
- const contentGeneratorConfig = config.getContentGeneratorConfig();
1882
- const contextWindowSize = contentGeneratorConfig.contextWindowSize ?? DEFAULT_TOKEN_LIMIT;
1883
- const apiTotalTokens = uiTelemetryService.getLastPromptTokenCount();
1884
- const apiCachedTokens = uiTelemetryService.getLastCachedContentTokenCount();
1885
- const systemPromptText = getCoreSystemPrompt(void 0, modelName);
1886
- const systemPromptTokens = estimateTokens(systemPromptText);
1887
- const toolRegistry = config.getToolRegistry();
1888
- const allTools = toolRegistry ? toolRegistry.getAllTools() : [];
1889
- const toolDeclarations = toolRegistry ? toolRegistry.getFunctionDeclarations({ includeDeferred: true }) : [];
1890
- const toolsJsonStr = JSON.stringify(toolDeclarations);
1891
- const allToolsTokens = estimateTokens(toolsJsonStr);
1892
- const builtinTools = [];
1893
- const mcpTools = [];
1894
- for (const tool of allTools) {
1895
- const toolJsonStr = JSON.stringify(tool.schema);
1896
- const tokens = estimateTokens(toolJsonStr);
1897
- if (tool instanceof DiscoveredMCPTool) {
1898
- mcpTools.push({
1899
- name: `${tool.serverName}__${tool.serverToolName || tool.name}`,
1900
- tokens
1901
- });
1902
- } else if (tool.name !== ToolNames.SKILL) {
1903
- builtinTools.push({
1904
- name: tool.name,
1905
- tokens
1906
- });
1907
- }
1908
- }
1909
- const memoryContent = config.getUserMemory();
1910
- const memoryFiles = parseMemoryFiles(memoryContent);
1911
- const memoryFilesTokens = memoryFiles.reduce((sum, f) => sum + f.tokens, 0);
1912
- const skillTool = allTools.find((tool) => tool.name === ToolNames.SKILL);
1913
- const skillToolDefinitionTokens = skillTool ? estimateTokens(JSON.stringify(skillTool.schema)) : 0;
1914
- const loadedSkillNames = skillTool && "getLoadedSkillNames" in skillTool ? skillTool.getLoadedSkillNames() : /* @__PURE__ */ new Set();
1915
- const skillManager = config.getSkillManager();
1916
- const skillConfigs = skillManager ? await skillManager.listSkills() : [];
1917
- let loadedBodiesTokens = 0;
1918
- const skills = skillConfigs.map((skill) => {
1919
- const listingTokens = estimateTokens(
1920
- `<skill>
1921
- <name>
1922
- ${skill.name}
1923
- </name>
1924
- <description>
1925
- ${skill.description} (${skill.level})
1926
- </description>
1927
- <location>
1928
- ${skill.level}
1929
- </location>
1930
- </skill>`
1931
- );
1932
- const isLoaded = loadedSkillNames.has(skill.name);
1933
- let bodyTokens;
1934
- if (isLoaded && skill.body) {
1935
- const baseDir = skill.filePath ? skill.filePath.replace(/\/[^/]+$/, "") : "";
1936
- bodyTokens = estimateTokens(buildSkillLlmContent(baseDir, skill.body));
1937
- loadedBodiesTokens += bodyTokens;
1938
- }
1939
- return {
1940
- name: skill.name,
1941
- tokens: listingTokens,
1942
- loaded: isLoaded,
1943
- bodyTokens
1944
- };
1945
- });
1946
- const skillsTokens = skillToolDefinitionTokens + loadedBodiesTokens;
1947
- const compressionThreshold = config.getChatCompression()?.contextPercentageThreshold ?? DEFAULT_COMPRESSION_THRESHOLD;
1948
- const autocompactBuffer = compressionThreshold > 0 ? Math.round((1 - compressionThreshold) * contextWindowSize) : 0;
1949
- const rawOverhead = systemPromptTokens + allToolsTokens + memoryFilesTokens + loadedBodiesTokens;
1950
- const isEstimated = apiTotalTokens === 0;
1951
- const mcpToolsTotalTokens = mcpTools.reduce(
1952
- (sum, tool) => sum + tool.tokens,
1953
- 0
1954
- );
1955
- let totalTokens;
1956
- let displaySystemPrompt;
1957
- let displayBuiltinTools;
1958
- let displayMcpTools;
1959
- let displayMemoryFiles;
1960
- let displaySkills;
1961
- let messagesTokens;
1962
- let freeSpace;
1963
- let detailBuiltinTools;
1964
- let detailMcpTools;
1965
- let detailMemoryFiles;
1966
- let detailSkills;
1967
- if (isEstimated) {
1968
- totalTokens = 0;
1969
- displaySystemPrompt = systemPromptTokens;
1970
- displaySkills = skillsTokens;
1971
- displayBuiltinTools = Math.max(
1972
- 0,
1973
- allToolsTokens - skillToolDefinitionTokens - mcpToolsTotalTokens
1974
- );
1975
- displayMcpTools = mcpToolsTotalTokens;
1976
- displayMemoryFiles = memoryFilesTokens;
1977
- messagesTokens = 0;
1978
- freeSpace = Math.max(
1979
- 0,
1980
- contextWindowSize - rawOverhead - autocompactBuffer
1981
- );
1982
- detailBuiltinTools = builtinTools;
1983
- detailMcpTools = mcpTools;
1984
- detailMemoryFiles = memoryFiles;
1985
- detailSkills = skills;
1986
- } else {
1987
- totalTokens = apiTotalTokens;
1988
- const overheadScale = rawOverhead > totalTokens ? totalTokens / rawOverhead : 1;
1989
- displaySystemPrompt = Math.round(systemPromptTokens * overheadScale);
1990
- const scaledAllTools = Math.round(allToolsTokens * overheadScale);
1991
- displayMemoryFiles = Math.round(memoryFilesTokens * overheadScale);
1992
- displaySkills = Math.round(skillsTokens * overheadScale);
1993
- const scaledMcpTotal = Math.round(mcpToolsTotalTokens * overheadScale);
1994
- displayMcpTools = scaledMcpTotal;
1995
- const scaledSkillDefinition = Math.round(
1996
- skillToolDefinitionTokens * overheadScale
1997
- );
1998
- displayBuiltinTools = Math.max(
1999
- 0,
2000
- scaledAllTools - scaledSkillDefinition - scaledMcpTotal
2001
- );
2002
- const scaledOverhead = displaySystemPrompt + scaledAllTools + displayMemoryFiles + Math.round(loadedBodiesTokens * overheadScale);
2003
- if (apiCachedTokens > 0) {
2004
- messagesTokens = Math.max(0, totalTokens - apiCachedTokens);
2005
- } else {
2006
- messagesTokens = Math.max(0, totalTokens - scaledOverhead);
2007
- }
2008
- freeSpace = Math.max(
2009
- 0,
2010
- contextWindowSize - totalTokens - autocompactBuffer
2011
- );
2012
- const scaleDetail = /* @__PURE__ */ __name((items) => overheadScale < 1 ? items.map((item) => ({
2013
- ...item,
2014
- tokens: Math.round(item.tokens * overheadScale)
2015
- })) : items, "scaleDetail");
2016
- detailBuiltinTools = scaleDetail(builtinTools);
2017
- detailMcpTools = scaleDetail(mcpTools);
2018
- detailMemoryFiles = scaleDetail(memoryFiles);
2019
- detailSkills = overheadScale < 1 ? skills.map((item) => ({
2020
- ...item,
2021
- tokens: Math.round(item.tokens * overheadScale),
2022
- bodyTokens: item.bodyTokens ? Math.round(item.bodyTokens * overheadScale) : void 0
2023
- })) : skills;
2024
- }
2025
- const breakdown = {
2026
- systemPrompt: displaySystemPrompt,
2027
- builtinTools: displayBuiltinTools,
2028
- mcpTools: displayMcpTools,
2029
- memoryFiles: displayMemoryFiles,
2030
- skills: displaySkills,
2031
- messages: messagesTokens,
2032
- freeSpace,
2033
- autocompactBuffer
2034
- };
2035
- return {
2036
- type: "context_usage" /* CONTEXT_USAGE */,
2037
- modelName,
2038
- totalTokens,
2039
- contextWindowSize,
2040
- breakdown,
2041
- builtinTools: showDetails ? detailBuiltinTools : [],
2042
- mcpTools: showDetails ? detailMcpTools : [],
2043
- memoryFiles: showDetails ? detailMemoryFiles : [],
2044
- skills: showDetails ? detailSkills : [],
2045
- isEstimated,
2046
- showDetails
2047
- };
2048
- }
2049
- __name(collectContextData, "collectContextData");
2050
- function fmtTokens(tokens) {
2051
- if (tokens >= 1e3) {
2052
- return `${(tokens / 1e3).toFixed(1)}k`;
2053
- }
2054
- return `${tokens}`;
2055
- }
2056
- __name(fmtTokens, "fmtTokens");
2057
- function fmtCategoryRow(label, tokens, contextWindowSize, indent = " ") {
2058
- const percentage = (tokens / contextWindowSize * 100).toFixed(1);
2059
- const right = `${fmtTokens(tokens)} tokens (${percentage}%)`;
2060
- const leftPart = `${indent}${label}`;
2061
- const totalWidth = 56;
2062
- const dots = Math.max(1, totalWidth - leftPart.length - right.length);
2063
- return `${leftPart}${" ".repeat(dots)}${right}`;
2064
- }
2065
- __name(fmtCategoryRow, "fmtCategoryRow");
2066
- function formatContextUsageText(data) {
2067
- const {
2068
- modelName,
2069
- totalTokens,
2070
- contextWindowSize,
2071
- breakdown,
2072
- builtinTools,
2073
- mcpTools,
2074
- memoryFiles,
2075
- skills,
2076
- isEstimated,
2077
- showDetails
2078
- } = data;
2079
- const lines = [];
2080
- lines.push("## Context Usage");
2081
- lines.push("");
2082
- if (isEstimated) {
2083
- lines.push("*No API response yet. Send a message to see actual usage.*");
2084
- lines.push("");
2085
- lines.push("**Estimated pre-conversation overhead**");
2086
- lines.push(
2087
- `Model: ${modelName} Context window: ${fmtTokens(contextWindowSize)} tokens`
2088
- );
2089
- lines.push("");
2090
- } else {
2091
- lines.push(
2092
- `Model: ${modelName} Context window: ${fmtTokens(contextWindowSize)} tokens`
2093
- );
2094
- lines.push("");
2095
- lines.push(fmtCategoryRow("Used", totalTokens, contextWindowSize));
2096
- lines.push(fmtCategoryRow("Free", breakdown.freeSpace, contextWindowSize));
2097
- lines.push(
2098
- fmtCategoryRow(
2099
- "Autocompact buffer",
2100
- breakdown.autocompactBuffer,
2101
- contextWindowSize
2102
- )
2103
- );
2104
- lines.push("");
2105
- lines.push("**Usage by category**");
2106
- }
2107
- lines.push(
2108
- fmtCategoryRow("System prompt", breakdown.systemPrompt, contextWindowSize)
2109
- );
2110
- lines.push(
2111
- fmtCategoryRow("Built-in tools", breakdown.builtinTools, contextWindowSize)
2112
- );
2113
- if (breakdown.mcpTools > 0) {
2114
- lines.push(
2115
- fmtCategoryRow("MCP tools", breakdown.mcpTools, contextWindowSize)
2116
- );
2117
- }
2118
- lines.push(
2119
- fmtCategoryRow("Memory files", breakdown.memoryFiles, contextWindowSize)
2120
- );
2121
- lines.push(fmtCategoryRow("Skills", breakdown.skills, contextWindowSize));
2122
- if (!isEstimated) {
2123
- lines.push(
2124
- fmtCategoryRow("Messages", breakdown.messages, contextWindowSize)
2125
- );
2126
- }
2127
- if (showDetails) {
2128
- const sortedBuiltin = [...builtinTools].sort((a, b) => b.tokens - a.tokens);
2129
- const sortedMcp = [...mcpTools].sort((a, b) => b.tokens - a.tokens);
2130
- const sortedMemory = [...memoryFiles].sort((a, b) => b.tokens - a.tokens);
2131
- const sortedSkills = [...skills].sort((a, b) => {
2132
- if (a.loaded !== b.loaded) return a.loaded ? -1 : 1;
2133
- return b.tokens + (b.bodyTokens ?? 0) - (a.tokens + (a.bodyTokens ?? 0));
2134
- });
2135
- if (sortedBuiltin.length > 0) {
2136
- lines.push("");
2137
- lines.push("**Built-in tools**");
2138
- for (const tool of sortedBuiltin) {
2139
- lines.push(
2140
- fmtCategoryRow(tool.name, tool.tokens, contextWindowSize, " \u2514 ")
2141
- );
2142
- }
2143
- }
2144
- if (sortedMcp.length > 0) {
2145
- lines.push("");
2146
- lines.push("**MCP tools**");
2147
- for (const tool of sortedMcp) {
2148
- lines.push(
2149
- fmtCategoryRow(tool.name, tool.tokens, contextWindowSize, " \u2514 ")
2150
- );
2151
- }
2152
- }
2153
- if (sortedMemory.length > 0) {
2154
- lines.push("");
2155
- lines.push("**Memory files**");
2156
- for (const file of sortedMemory) {
2157
- lines.push(
2158
- fmtCategoryRow(file.path, file.tokens, contextWindowSize, " \u2514 ")
2159
- );
2160
- }
2161
- }
2162
- if (sortedSkills.length > 0) {
2163
- lines.push("");
2164
- lines.push("**Skills**");
2165
- for (const skill of sortedSkills) {
2166
- const label = skill.loaded ? `${skill.name} (active)` : skill.name;
2167
- lines.push(
2168
- fmtCategoryRow(label, skill.tokens, contextWindowSize, " \u2514 ")
2169
- );
2170
- if (skill.loaded && skill.bodyTokens && skill.bodyTokens > 0) {
2171
- lines.push(
2172
- fmtCategoryRow(
2173
- "body loaded",
2174
- skill.bodyTokens,
2175
- contextWindowSize,
2176
- " \u2514 "
2177
- )
2178
- );
2179
- }
2180
- }
2181
- }
2182
- } else {
2183
- lines.push("");
2184
- lines.push("*Run /context detail for per-item breakdown.*");
2185
- }
2186
- return lines.join("\n");
2187
- }
2188
- __name(formatContextUsageText, "formatContextUsageText");
2189
- var contextCommand = {
2190
- name: "context",
2191
- get description() {
2192
- return t(
2193
- 'Show context window usage breakdown. Use "/context detail" for per-item breakdown.'
2194
- );
2195
- },
2196
- kind: "built-in" /* BUILT_IN */,
2197
- supportedModes: ["interactive", "non_interactive", "acp"],
2198
- action: /* @__PURE__ */ __name(async (context, args) => {
2199
- const showDetails = args?.trim().toLowerCase() === "detail" || args?.trim().toLowerCase() === "-d";
2200
- const executionMode = context.executionMode ?? "interactive";
2201
- const { config } = context.services;
2202
- if (!config) {
2203
- if (executionMode === "interactive") {
2204
- context.ui.addItem(
2205
- {
2206
- type: "error" /* ERROR */,
2207
- text: t("Config not loaded.")
2208
- },
2209
- Date.now()
2210
- );
2211
- return;
2212
- }
2213
- return {
2214
- type: "message",
2215
- messageType: "error",
2216
- content: t("Config not loaded.")
2217
- };
2218
- }
2219
- const contextUsageItem = await collectContextData(config, showDetails);
2220
- if (executionMode === "interactive") {
2221
- context.ui.addItem(contextUsageItem, Date.now());
2222
- return;
2223
- } else {
2224
- return {
2225
- type: "message",
2226
- messageType: "info",
2227
- content: formatContextUsageText(contextUsageItem)
2228
- };
2229
- }
2230
- }, "action"),
2231
- subCommands: [
2232
- {
2233
- name: "detail",
2234
- get description() {
2235
- return t("Show per-item context usage breakdown.");
2236
- },
2237
- kind: "built-in" /* BUILT_IN */,
2238
- supportedModes: ["interactive", "non_interactive", "acp"],
2239
- action: /* @__PURE__ */ __name(async (context) => {
2240
- await contextCommand.action(context, "detail");
2241
- }, "action")
2242
- }
2243
- ]
2244
- };
2245
-
2246
- export {
2247
- require_react,
2248
- SUPPORTED_LANGUAGES,
2249
- resolveSupportedLanguage,
2250
- getLanguageNameFromLocale,
2251
- getLanguageSettingsOptions,
2252
- getSupportedLanguageIds,
2253
- detectSystemLanguage,
2254
- setLanguageAsync,
2255
- getCurrentLanguage,
2256
- t,
2257
- ta,
2258
- initializeI18n,
2259
- collectContextData,
2260
- formatContextUsageText,
2261
- contextCommand
2262
- };
2263
- /**
2264
- * @license
2265
- * Copyright 2025 Google LLC
2266
- * SPDX-License-Identifier: Apache-2.0
2267
- */
2268
- /**
2269
- * @license
2270
- * Copyright 2025 Qwen team
2271
- * SPDX-License-Identifier: Apache-2.0
2272
- */
2273
- /**
2274
- * @license
2275
- * Copyright 2026 Qwen Team
2276
- * SPDX-License-Identifier: Apache-2.0
2277
- */
2278
- /**
2279
- * @license
2280
- * Copyright 2025 Qwen
2281
- * SPDX-License-Identifier: Apache-2.0
2282
- */
2283
- /*! Bundled license information:
2284
-
2285
- react/cjs/react.production.js:
2286
- (**
2287
- * @license React
2288
- * react.production.js
2289
- *
2290
- * Copyright (c) Meta Platforms, Inc. and affiliates.
2291
- *
2292
- * This source code is licensed under the MIT license found in the
2293
- * LICENSE file in the root directory of this source tree.
2294
- *)
2295
-
2296
- react/cjs/react.development.js:
2297
- (**
2298
- * @license React
2299
- * react.development.js
2300
- *
2301
- * Copyright (c) Meta Platforms, Inc. and affiliates.
2302
- *
2303
- * This source code is licensed under the MIT license found in the
2304
- * LICENSE file in the root directory of this source tree.
2305
- *)
2306
- */