@qwen-code/qwen-code 0.16.0 → 0.16.1-nightly.20260524.84f408017

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 (30) hide show
  1. package/chunks/{agent-K6OWOMBN.js → agent-QFQGDV7B.js} +2 -2
  2. package/chunks/{chunk-3T4ZT63H.js → chunk-6JQC5PYU.js} +359 -49
  3. package/chunks/{chunk-WCZWAKFG.js → chunk-JUAMIT3V.js} +440 -523
  4. package/chunks/{chunk-NOAHME6A.js → chunk-LKSMYCUK.js} +1 -1
  5. package/chunks/{chunk-VMOAQVBP.js → chunk-M2TQETH7.js} +1 -1
  6. package/chunks/chunk-TEES5V4K.js +956 -0
  7. package/chunks/{chunk-L34E6AGL.js → chunk-UL4NCM6X.js} +5 -5
  8. package/chunks/{contextCommand-7CPNXBLO.js → contextCommand-3FI5VRHY.js} +4 -4
  9. package/chunks/{edit-CBM5NDVK.js → edit-JXJILHZW.js} +2 -2
  10. package/chunks/{enter-worktree-XABKPLO6.js → enter-worktree-HQ3RBRIA.js} +2 -2
  11. package/chunks/{exit-worktree-56MN2PCL.js → exit-worktree-73TYZY5X.js} +2 -2
  12. package/chunks/{exitPlanMode-YDNPCSCJ.js → exitPlanMode-WEETA2GM.js} +2 -2
  13. package/chunks/{geminiContentGenerator-ZGPNBFDS.js → geminiContentGenerator-TVVMIHRE.js} +1 -1
  14. package/chunks/{glob-ZHA35VO5.js → glob-HZYBHMPB.js} +2 -2
  15. package/chunks/{grep-RV6V6T52.js → grep-RO7NJDWP.js} +2 -2
  16. package/chunks/{monitor-5G2OBGE5.js → monitor-IOU376UD.js} +2 -2
  17. package/chunks/{notebook-edit-XUBTCT6L.js → notebook-edit-7NXIUSLW.js} +2 -2
  18. package/chunks/{openaiContentGenerator-POYAZQ6I.js → openaiContentGenerator-BXS7CQJ2.js} +2 -2
  19. package/chunks/{qwenContentGenerator-2E4H56DK.js → qwenContentGenerator-7VOJGPBD.js} +3 -3
  20. package/chunks/{read-file-3JIOOXFT.js → read-file-G4TFJFZ2.js} +1 -1
  21. package/chunks/{ripGrep-LEI3L6PM.js → ripGrep-IMMYV3HQ.js} +2 -2
  22. package/chunks/{serve-CFVRMD4W.js → serve-5EHHVHBV.js} +4440 -360
  23. package/chunks/{shell-3B5DZ437.js → shell-AXZQIDDU.js} +2 -2
  24. package/chunks/{skill-STSZUBXR.js → skill-IMUVSRRZ.js} +1 -1
  25. package/chunks/{src-ROFXAPEP.js → src-VYNNTRVU.js} +4 -2
  26. package/chunks/{tool-search-ARWOD3GD.js → tool-search-BTGLGBDQ.js} +1 -1
  27. package/chunks/{write-file-6MRT7TEW.js → write-file-BNUIFGU4.js} +2 -2
  28. package/cli.js +624 -16436
  29. package/package.json +2 -2
  30. package/chunks/chunk-4J63U5QO.js +0 -1974
@@ -1,1974 +0,0 @@
1
- // Force strict mode and setup for ESM
2
- "use strict";
3
- import {
4
- t
5
- } from "./chunk-VMOAQVBP.js";
6
- import {
7
- getCoreSystemPrompt
8
- } from "./chunk-3T4ZT63H.js";
9
- import {
10
- buildSkillLlmContent
11
- } from "./chunk-G7YTSRES.js";
12
- import {
13
- DiscoveredMCPTool,
14
- uiTelemetryService
15
- } from "./chunk-WCZWAKFG.js";
16
- import {
17
- DEFAULT_TOKEN_LIMIT
18
- } from "./chunk-MAY32HXD.js";
19
- import {
20
- ToolNames
21
- } from "./chunk-PVVL5Q3W.js";
22
- import {
23
- init_esbuild_shims
24
- } from "./chunk-A4BMJM77.js";
25
- import {
26
- __commonJS,
27
- __name,
28
- __toESM
29
- } from "./chunk-J2S4EL5Y.js";
30
-
31
- // node_modules/react/cjs/react.production.js
32
- var require_react_production = __commonJS({
33
- "node_modules/react/cjs/react.production.js"(exports) {
34
- "use strict";
35
- init_esbuild_shims();
36
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element");
37
- var REACT_PORTAL_TYPE = Symbol.for("react.portal");
38
- var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
39
- var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
40
- var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
41
- var REACT_CONSUMER_TYPE = Symbol.for("react.consumer");
42
- var REACT_CONTEXT_TYPE = Symbol.for("react.context");
43
- var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
44
- var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
45
- var REACT_MEMO_TYPE = Symbol.for("react.memo");
46
- var REACT_LAZY_TYPE = Symbol.for("react.lazy");
47
- var REACT_ACTIVITY_TYPE = Symbol.for("react.activity");
48
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
49
- function getIteratorFn(maybeIterable) {
50
- if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
51
- maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
52
- return "function" === typeof maybeIterable ? maybeIterable : null;
53
- }
54
- __name(getIteratorFn, "getIteratorFn");
55
- var ReactNoopUpdateQueue = {
56
- isMounted: /* @__PURE__ */ __name(function() {
57
- return false;
58
- }, "isMounted"),
59
- enqueueForceUpdate: /* @__PURE__ */ __name(function() {
60
- }, "enqueueForceUpdate"),
61
- enqueueReplaceState: /* @__PURE__ */ __name(function() {
62
- }, "enqueueReplaceState"),
63
- enqueueSetState: /* @__PURE__ */ __name(function() {
64
- }, "enqueueSetState")
65
- };
66
- var assign = Object.assign;
67
- var emptyObject = {};
68
- function Component(props, context, updater) {
69
- this.props = props;
70
- this.context = context;
71
- this.refs = emptyObject;
72
- this.updater = updater || ReactNoopUpdateQueue;
73
- }
74
- __name(Component, "Component");
75
- Component.prototype.isReactComponent = {};
76
- Component.prototype.setState = function(partialState, callback) {
77
- if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState)
78
- throw Error(
79
- "takes an object of state variables to update or a function which returns an object of state variables."
80
- );
81
- this.updater.enqueueSetState(this, partialState, callback, "setState");
82
- };
83
- Component.prototype.forceUpdate = function(callback) {
84
- this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
85
- };
86
- function ComponentDummy() {
87
- }
88
- __name(ComponentDummy, "ComponentDummy");
89
- ComponentDummy.prototype = Component.prototype;
90
- function PureComponent(props, context, updater) {
91
- this.props = props;
92
- this.context = context;
93
- this.refs = emptyObject;
94
- this.updater = updater || ReactNoopUpdateQueue;
95
- }
96
- __name(PureComponent, "PureComponent");
97
- var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
98
- pureComponentPrototype.constructor = PureComponent;
99
- assign(pureComponentPrototype, Component.prototype);
100
- pureComponentPrototype.isPureReactComponent = true;
101
- var isArrayImpl = Array.isArray;
102
- function noop() {
103
- }
104
- __name(noop, "noop");
105
- var ReactSharedInternals = { H: null, A: null, T: null, S: null };
106
- var hasOwnProperty = Object.prototype.hasOwnProperty;
107
- function ReactElement(type, key, props) {
108
- var refProp = props.ref;
109
- return {
110
- $$typeof: REACT_ELEMENT_TYPE,
111
- type,
112
- key,
113
- ref: void 0 !== refProp ? refProp : null,
114
- props
115
- };
116
- }
117
- __name(ReactElement, "ReactElement");
118
- function cloneAndReplaceKey(oldElement, newKey) {
119
- return ReactElement(oldElement.type, newKey, oldElement.props);
120
- }
121
- __name(cloneAndReplaceKey, "cloneAndReplaceKey");
122
- function isValidElement(object) {
123
- return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
124
- }
125
- __name(isValidElement, "isValidElement");
126
- function escape(key) {
127
- var escaperLookup = { "=": "=0", ":": "=2" };
128
- return "$" + key.replace(/[=:]/g, function(match) {
129
- return escaperLookup[match];
130
- });
131
- }
132
- __name(escape, "escape");
133
- var userProvidedKeyEscapeRegex = /\/+/g;
134
- function getElementKey(element, index) {
135
- return "object" === typeof element && null !== element && null != element.key ? escape("" + element.key) : index.toString(36);
136
- }
137
- __name(getElementKey, "getElementKey");
138
- function resolveThenable(thenable) {
139
- switch (thenable.status) {
140
- case "fulfilled":
141
- return thenable.value;
142
- case "rejected":
143
- throw thenable.reason;
144
- default:
145
- switch ("string" === typeof thenable.status ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(
146
- function(fulfilledValue) {
147
- "pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
148
- },
149
- function(error) {
150
- "pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
151
- }
152
- )), thenable.status) {
153
- case "fulfilled":
154
- return thenable.value;
155
- case "rejected":
156
- throw thenable.reason;
157
- }
158
- }
159
- throw thenable;
160
- }
161
- __name(resolveThenable, "resolveThenable");
162
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
163
- var type = typeof children;
164
- if ("undefined" === type || "boolean" === type) children = null;
165
- var invokeCallback = false;
166
- if (null === children) invokeCallback = true;
167
- else
168
- switch (type) {
169
- case "bigint":
170
- case "string":
171
- case "number":
172
- invokeCallback = true;
173
- break;
174
- case "object":
175
- switch (children.$$typeof) {
176
- case REACT_ELEMENT_TYPE:
177
- case REACT_PORTAL_TYPE:
178
- invokeCallback = true;
179
- break;
180
- case REACT_LAZY_TYPE:
181
- return invokeCallback = children._init, mapIntoArray(
182
- invokeCallback(children._payload),
183
- array,
184
- escapedPrefix,
185
- nameSoFar,
186
- callback
187
- );
188
- }
189
- }
190
- if (invokeCallback)
191
- 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) {
192
- return c;
193
- })) : null != callback && (isValidElement(callback) && (callback = cloneAndReplaceKey(
194
- callback,
195
- escapedPrefix + (null == callback.key || children && children.key === callback.key ? "" : ("" + callback.key).replace(
196
- userProvidedKeyEscapeRegex,
197
- "$&/"
198
- ) + "/") + invokeCallback
199
- )), array.push(callback)), 1;
200
- invokeCallback = 0;
201
- var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
202
- if (isArrayImpl(children))
203
- for (var i = 0; i < children.length; i++)
204
- nameSoFar = children[i], type = nextNamePrefix + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(
205
- nameSoFar,
206
- array,
207
- escapedPrefix,
208
- type,
209
- callback
210
- );
211
- else if (i = getIteratorFn(children), "function" === typeof i)
212
- for (children = i.call(children), i = 0; !(nameSoFar = children.next()).done; )
213
- nameSoFar = nameSoFar.value, type = nextNamePrefix + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(
214
- nameSoFar,
215
- array,
216
- escapedPrefix,
217
- type,
218
- callback
219
- );
220
- else if ("object" === type) {
221
- if ("function" === typeof children.then)
222
- return mapIntoArray(
223
- resolveThenable(children),
224
- array,
225
- escapedPrefix,
226
- nameSoFar,
227
- callback
228
- );
229
- array = String(children);
230
- throw Error(
231
- "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."
232
- );
233
- }
234
- return invokeCallback;
235
- }
236
- __name(mapIntoArray, "mapIntoArray");
237
- function mapChildren(children, func, context) {
238
- if (null == children) return children;
239
- var result = [], count = 0;
240
- mapIntoArray(children, result, "", "", function(child) {
241
- return func.call(context, child, count++);
242
- });
243
- return result;
244
- }
245
- __name(mapChildren, "mapChildren");
246
- function lazyInitializer(payload) {
247
- if (-1 === payload._status) {
248
- var ctor = payload._result;
249
- ctor = ctor();
250
- ctor.then(
251
- function(moduleObject) {
252
- if (0 === payload._status || -1 === payload._status)
253
- payload._status = 1, payload._result = moduleObject;
254
- },
255
- function(error) {
256
- if (0 === payload._status || -1 === payload._status)
257
- payload._status = 2, payload._result = error;
258
- }
259
- );
260
- -1 === payload._status && (payload._status = 0, payload._result = ctor);
261
- }
262
- if (1 === payload._status) return payload._result.default;
263
- throw payload._result;
264
- }
265
- __name(lazyInitializer, "lazyInitializer");
266
- var reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
267
- if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
268
- var event = new window.ErrorEvent("error", {
269
- bubbles: true,
270
- cancelable: true,
271
- message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
272
- error
273
- });
274
- if (!window.dispatchEvent(event)) return;
275
- } else if ("object" === typeof process && "function" === typeof process.emit) {
276
- process.emit("uncaughtException", error);
277
- return;
278
- }
279
- console.error(error);
280
- };
281
- var Children = {
282
- map: mapChildren,
283
- forEach: /* @__PURE__ */ __name(function(children, forEachFunc, forEachContext) {
284
- mapChildren(
285
- children,
286
- function() {
287
- forEachFunc.apply(this, arguments);
288
- },
289
- forEachContext
290
- );
291
- }, "forEach"),
292
- count: /* @__PURE__ */ __name(function(children) {
293
- var n = 0;
294
- mapChildren(children, function() {
295
- n++;
296
- });
297
- return n;
298
- }, "count"),
299
- toArray: /* @__PURE__ */ __name(function(children) {
300
- return mapChildren(children, function(child) {
301
- return child;
302
- }) || [];
303
- }, "toArray"),
304
- only: /* @__PURE__ */ __name(function(children) {
305
- if (!isValidElement(children))
306
- throw Error(
307
- "React.Children.only expected to receive a single React element child."
308
- );
309
- return children;
310
- }, "only")
311
- };
312
- exports.Activity = REACT_ACTIVITY_TYPE;
313
- exports.Children = Children;
314
- exports.Component = Component;
315
- exports.Fragment = REACT_FRAGMENT_TYPE;
316
- exports.Profiler = REACT_PROFILER_TYPE;
317
- exports.PureComponent = PureComponent;
318
- exports.StrictMode = REACT_STRICT_MODE_TYPE;
319
- exports.Suspense = REACT_SUSPENSE_TYPE;
320
- exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
321
- exports.__COMPILER_RUNTIME = {
322
- __proto__: null,
323
- c: /* @__PURE__ */ __name(function(size) {
324
- return ReactSharedInternals.H.useMemoCache(size);
325
- }, "c")
326
- };
327
- exports.cache = function(fn) {
328
- return function() {
329
- return fn.apply(null, arguments);
330
- };
331
- };
332
- exports.cacheSignal = function() {
333
- return null;
334
- };
335
- exports.cloneElement = function(element, config, children) {
336
- if (null === element || void 0 === element)
337
- throw Error(
338
- "The argument must be a React element, but you passed " + element + "."
339
- );
340
- var props = assign({}, element.props), key = element.key;
341
- if (null != config)
342
- for (propName in void 0 !== config.key && (key = "" + config.key), config)
343
- !hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
344
- var propName = arguments.length - 2;
345
- if (1 === propName) props.children = children;
346
- else if (1 < propName) {
347
- for (var childArray = Array(propName), i = 0; i < propName; i++)
348
- childArray[i] = arguments[i + 2];
349
- props.children = childArray;
350
- }
351
- return ReactElement(element.type, key, props);
352
- };
353
- exports.createContext = function(defaultValue) {
354
- defaultValue = {
355
- $$typeof: REACT_CONTEXT_TYPE,
356
- _currentValue: defaultValue,
357
- _currentValue2: defaultValue,
358
- _threadCount: 0,
359
- Provider: null,
360
- Consumer: null
361
- };
362
- defaultValue.Provider = defaultValue;
363
- defaultValue.Consumer = {
364
- $$typeof: REACT_CONSUMER_TYPE,
365
- _context: defaultValue
366
- };
367
- return defaultValue;
368
- };
369
- exports.createElement = function(type, config, children) {
370
- var propName, props = {}, key = null;
371
- if (null != config)
372
- for (propName in void 0 !== config.key && (key = "" + config.key), config)
373
- hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (props[propName] = config[propName]);
374
- var childrenLength = arguments.length - 2;
375
- if (1 === childrenLength) props.children = children;
376
- else if (1 < childrenLength) {
377
- for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
378
- childArray[i] = arguments[i + 2];
379
- props.children = childArray;
380
- }
381
- if (type && type.defaultProps)
382
- for (propName in childrenLength = type.defaultProps, childrenLength)
383
- void 0 === props[propName] && (props[propName] = childrenLength[propName]);
384
- return ReactElement(type, key, props);
385
- };
386
- exports.createRef = function() {
387
- return { current: null };
388
- };
389
- exports.forwardRef = function(render) {
390
- return { $$typeof: REACT_FORWARD_REF_TYPE, render };
391
- };
392
- exports.isValidElement = isValidElement;
393
- exports.lazy = function(ctor) {
394
- return {
395
- $$typeof: REACT_LAZY_TYPE,
396
- _payload: { _status: -1, _result: ctor },
397
- _init: lazyInitializer
398
- };
399
- };
400
- exports.memo = function(type, compare) {
401
- return {
402
- $$typeof: REACT_MEMO_TYPE,
403
- type,
404
- compare: void 0 === compare ? null : compare
405
- };
406
- };
407
- exports.startTransition = function(scope) {
408
- var prevTransition = ReactSharedInternals.T, currentTransition = {};
409
- ReactSharedInternals.T = currentTransition;
410
- try {
411
- var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
412
- null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
413
- "object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && returnValue.then(noop, reportGlobalError);
414
- } catch (error) {
415
- reportGlobalError(error);
416
- } finally {
417
- null !== prevTransition && null !== currentTransition.types && (prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
418
- }
419
- };
420
- exports.unstable_useCacheRefresh = function() {
421
- return ReactSharedInternals.H.useCacheRefresh();
422
- };
423
- exports.use = function(usable) {
424
- return ReactSharedInternals.H.use(usable);
425
- };
426
- exports.useActionState = function(action, initialState, permalink) {
427
- return ReactSharedInternals.H.useActionState(action, initialState, permalink);
428
- };
429
- exports.useCallback = function(callback, deps) {
430
- return ReactSharedInternals.H.useCallback(callback, deps);
431
- };
432
- exports.useContext = function(Context) {
433
- return ReactSharedInternals.H.useContext(Context);
434
- };
435
- exports.useDebugValue = function() {
436
- };
437
- exports.useDeferredValue = function(value, initialValue) {
438
- return ReactSharedInternals.H.useDeferredValue(value, initialValue);
439
- };
440
- exports.useEffect = function(create, deps) {
441
- return ReactSharedInternals.H.useEffect(create, deps);
442
- };
443
- exports.useEffectEvent = function(callback) {
444
- return ReactSharedInternals.H.useEffectEvent(callback);
445
- };
446
- exports.useId = function() {
447
- return ReactSharedInternals.H.useId();
448
- };
449
- exports.useImperativeHandle = function(ref, create, deps) {
450
- return ReactSharedInternals.H.useImperativeHandle(ref, create, deps);
451
- };
452
- exports.useInsertionEffect = function(create, deps) {
453
- return ReactSharedInternals.H.useInsertionEffect(create, deps);
454
- };
455
- exports.useLayoutEffect = function(create, deps) {
456
- return ReactSharedInternals.H.useLayoutEffect(create, deps);
457
- };
458
- exports.useMemo = function(create, deps) {
459
- return ReactSharedInternals.H.useMemo(create, deps);
460
- };
461
- exports.useOptimistic = function(passthrough, reducer) {
462
- return ReactSharedInternals.H.useOptimistic(passthrough, reducer);
463
- };
464
- exports.useReducer = function(reducer, initialArg, init) {
465
- return ReactSharedInternals.H.useReducer(reducer, initialArg, init);
466
- };
467
- exports.useRef = function(initialValue) {
468
- return ReactSharedInternals.H.useRef(initialValue);
469
- };
470
- exports.useState = function(initialState) {
471
- return ReactSharedInternals.H.useState(initialState);
472
- };
473
- exports.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
474
- return ReactSharedInternals.H.useSyncExternalStore(
475
- subscribe,
476
- getSnapshot,
477
- getServerSnapshot
478
- );
479
- };
480
- exports.useTransition = function() {
481
- return ReactSharedInternals.H.useTransition();
482
- };
483
- exports.version = "19.2.4";
484
- }
485
- });
486
-
487
- // node_modules/react/cjs/react.development.js
488
- var require_react_development = __commonJS({
489
- "node_modules/react/cjs/react.development.js"(exports, module) {
490
- "use strict";
491
- init_esbuild_shims();
492
- "production" !== process.env.NODE_ENV && function() {
493
- function defineDeprecationWarning(methodName, info) {
494
- Object.defineProperty(Component.prototype, methodName, {
495
- get: /* @__PURE__ */ __name(function() {
496
- console.warn(
497
- "%s(...) is deprecated in plain JavaScript React classes. %s",
498
- info[0],
499
- info[1]
500
- );
501
- }, "get")
502
- });
503
- }
504
- __name(defineDeprecationWarning, "defineDeprecationWarning");
505
- function getIteratorFn(maybeIterable) {
506
- if (null === maybeIterable || "object" !== typeof maybeIterable)
507
- return null;
508
- maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
509
- return "function" === typeof maybeIterable ? maybeIterable : null;
510
- }
511
- __name(getIteratorFn, "getIteratorFn");
512
- function warnNoop(publicInstance, callerName) {
513
- publicInstance = (publicInstance = publicInstance.constructor) && (publicInstance.displayName || publicInstance.name) || "ReactClass";
514
- var warningKey = publicInstance + "." + callerName;
515
- didWarnStateUpdateForUnmountedComponent[warningKey] || (console.error(
516
- "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.",
517
- callerName,
518
- publicInstance
519
- ), didWarnStateUpdateForUnmountedComponent[warningKey] = true);
520
- }
521
- __name(warnNoop, "warnNoop");
522
- function Component(props, context, updater) {
523
- this.props = props;
524
- this.context = context;
525
- this.refs = emptyObject;
526
- this.updater = updater || ReactNoopUpdateQueue;
527
- }
528
- __name(Component, "Component");
529
- function ComponentDummy() {
530
- }
531
- __name(ComponentDummy, "ComponentDummy");
532
- function PureComponent(props, context, updater) {
533
- this.props = props;
534
- this.context = context;
535
- this.refs = emptyObject;
536
- this.updater = updater || ReactNoopUpdateQueue;
537
- }
538
- __name(PureComponent, "PureComponent");
539
- function noop() {
540
- }
541
- __name(noop, "noop");
542
- function testStringCoercion(value) {
543
- return "" + value;
544
- }
545
- __name(testStringCoercion, "testStringCoercion");
546
- function checkKeyStringCoercion(value) {
547
- try {
548
- testStringCoercion(value);
549
- var JSCompiler_inline_result = false;
550
- } catch (e) {
551
- JSCompiler_inline_result = true;
552
- }
553
- if (JSCompiler_inline_result) {
554
- JSCompiler_inline_result = console;
555
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
556
- var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
557
- JSCompiler_temp_const.call(
558
- JSCompiler_inline_result,
559
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
560
- JSCompiler_inline_result$jscomp$0
561
- );
562
- return testStringCoercion(value);
563
- }
564
- }
565
- __name(checkKeyStringCoercion, "checkKeyStringCoercion");
566
- function getComponentNameFromType(type) {
567
- if (null == type) return null;
568
- if ("function" === typeof type)
569
- return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
570
- if ("string" === typeof type) return type;
571
- switch (type) {
572
- case REACT_FRAGMENT_TYPE:
573
- return "Fragment";
574
- case REACT_PROFILER_TYPE:
575
- return "Profiler";
576
- case REACT_STRICT_MODE_TYPE:
577
- return "StrictMode";
578
- case REACT_SUSPENSE_TYPE:
579
- return "Suspense";
580
- case REACT_SUSPENSE_LIST_TYPE:
581
- return "SuspenseList";
582
- case REACT_ACTIVITY_TYPE:
583
- return "Activity";
584
- }
585
- if ("object" === typeof type)
586
- switch ("number" === typeof type.tag && console.error(
587
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
588
- ), type.$$typeof) {
589
- case REACT_PORTAL_TYPE:
590
- return "Portal";
591
- case REACT_CONTEXT_TYPE:
592
- return type.displayName || "Context";
593
- case REACT_CONSUMER_TYPE:
594
- return (type._context.displayName || "Context") + ".Consumer";
595
- case REACT_FORWARD_REF_TYPE:
596
- var innerType = type.render;
597
- type = type.displayName;
598
- type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
599
- return type;
600
- case REACT_MEMO_TYPE:
601
- return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
602
- case REACT_LAZY_TYPE:
603
- innerType = type._payload;
604
- type = type._init;
605
- try {
606
- return getComponentNameFromType(type(innerType));
607
- } catch (x) {
608
- }
609
- }
610
- return null;
611
- }
612
- __name(getComponentNameFromType, "getComponentNameFromType");
613
- function getTaskName(type) {
614
- if (type === REACT_FRAGMENT_TYPE) return "<>";
615
- if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE)
616
- return "<...>";
617
- try {
618
- var name = getComponentNameFromType(type);
619
- return name ? "<" + name + ">" : "<...>";
620
- } catch (x) {
621
- return "<...>";
622
- }
623
- }
624
- __name(getTaskName, "getTaskName");
625
- function getOwner() {
626
- var dispatcher = ReactSharedInternals.A;
627
- return null === dispatcher ? null : dispatcher.getOwner();
628
- }
629
- __name(getOwner, "getOwner");
630
- function UnknownOwner() {
631
- return Error("react-stack-top-frame");
632
- }
633
- __name(UnknownOwner, "UnknownOwner");
634
- function hasValidKey(config) {
635
- if (hasOwnProperty.call(config, "key")) {
636
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
637
- if (getter && getter.isReactWarning) return false;
638
- }
639
- return void 0 !== config.key;
640
- }
641
- __name(hasValidKey, "hasValidKey");
642
- function defineKeyPropWarningGetter(props, displayName) {
643
- function warnAboutAccessingKey() {
644
- specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error(
645
- "%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)",
646
- displayName
647
- ));
648
- }
649
- __name(warnAboutAccessingKey, "warnAboutAccessingKey");
650
- warnAboutAccessingKey.isReactWarning = true;
651
- Object.defineProperty(props, "key", {
652
- get: warnAboutAccessingKey,
653
- configurable: true
654
- });
655
- }
656
- __name(defineKeyPropWarningGetter, "defineKeyPropWarningGetter");
657
- function elementRefGetterWithDeprecationWarning() {
658
- var componentName = getComponentNameFromType(this.type);
659
- didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error(
660
- "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."
661
- ));
662
- componentName = this.props.ref;
663
- return void 0 !== componentName ? componentName : null;
664
- }
665
- __name(elementRefGetterWithDeprecationWarning, "elementRefGetterWithDeprecationWarning");
666
- function ReactElement(type, key, props, owner, debugStack, debugTask) {
667
- var refProp = props.ref;
668
- type = {
669
- $$typeof: REACT_ELEMENT_TYPE,
670
- type,
671
- key,
672
- props,
673
- _owner: owner
674
- };
675
- null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
676
- enumerable: false,
677
- get: elementRefGetterWithDeprecationWarning
678
- }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
679
- type._store = {};
680
- Object.defineProperty(type._store, "validated", {
681
- configurable: false,
682
- enumerable: false,
683
- writable: true,
684
- value: 0
685
- });
686
- Object.defineProperty(type, "_debugInfo", {
687
- configurable: false,
688
- enumerable: false,
689
- writable: true,
690
- value: null
691
- });
692
- Object.defineProperty(type, "_debugStack", {
693
- configurable: false,
694
- enumerable: false,
695
- writable: true,
696
- value: debugStack
697
- });
698
- Object.defineProperty(type, "_debugTask", {
699
- configurable: false,
700
- enumerable: false,
701
- writable: true,
702
- value: debugTask
703
- });
704
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
705
- return type;
706
- }
707
- __name(ReactElement, "ReactElement");
708
- function cloneAndReplaceKey(oldElement, newKey) {
709
- newKey = ReactElement(
710
- oldElement.type,
711
- newKey,
712
- oldElement.props,
713
- oldElement._owner,
714
- oldElement._debugStack,
715
- oldElement._debugTask
716
- );
717
- oldElement._store && (newKey._store.validated = oldElement._store.validated);
718
- return newKey;
719
- }
720
- __name(cloneAndReplaceKey, "cloneAndReplaceKey");
721
- function validateChildKeys(node) {
722
- 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));
723
- }
724
- __name(validateChildKeys, "validateChildKeys");
725
- function isValidElement(object) {
726
- return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
727
- }
728
- __name(isValidElement, "isValidElement");
729
- function escape(key) {
730
- var escaperLookup = { "=": "=0", ":": "=2" };
731
- return "$" + key.replace(/[=:]/g, function(match) {
732
- return escaperLookup[match];
733
- });
734
- }
735
- __name(escape, "escape");
736
- function getElementKey(element, index) {
737
- return "object" === typeof element && null !== element && null != element.key ? (checkKeyStringCoercion(element.key), escape("" + element.key)) : index.toString(36);
738
- }
739
- __name(getElementKey, "getElementKey");
740
- function resolveThenable(thenable) {
741
- switch (thenable.status) {
742
- case "fulfilled":
743
- return thenable.value;
744
- case "rejected":
745
- throw thenable.reason;
746
- default:
747
- switch ("string" === typeof thenable.status ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(
748
- function(fulfilledValue) {
749
- "pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
750
- },
751
- function(error) {
752
- "pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
753
- }
754
- )), thenable.status) {
755
- case "fulfilled":
756
- return thenable.value;
757
- case "rejected":
758
- throw thenable.reason;
759
- }
760
- }
761
- throw thenable;
762
- }
763
- __name(resolveThenable, "resolveThenable");
764
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
765
- var type = typeof children;
766
- if ("undefined" === type || "boolean" === type) children = null;
767
- var invokeCallback = false;
768
- if (null === children) invokeCallback = true;
769
- else
770
- switch (type) {
771
- case "bigint":
772
- case "string":
773
- case "number":
774
- invokeCallback = true;
775
- break;
776
- case "object":
777
- switch (children.$$typeof) {
778
- case REACT_ELEMENT_TYPE:
779
- case REACT_PORTAL_TYPE:
780
- invokeCallback = true;
781
- break;
782
- case REACT_LAZY_TYPE:
783
- return invokeCallback = children._init, mapIntoArray(
784
- invokeCallback(children._payload),
785
- array,
786
- escapedPrefix,
787
- nameSoFar,
788
- callback
789
- );
790
- }
791
- }
792
- if (invokeCallback) {
793
- invokeCallback = children;
794
- callback = callback(invokeCallback);
795
- var childKey = "" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
796
- isArrayImpl(callback) ? (escapedPrefix = "", null != childKey && (escapedPrefix = childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
797
- return c;
798
- })) : null != callback && (isValidElement(callback) && (null != callback.key && (invokeCallback && invokeCallback.key === callback.key || checkKeyStringCoercion(callback.key)), escapedPrefix = cloneAndReplaceKey(
799
- callback,
800
- escapedPrefix + (null == callback.key || invokeCallback && invokeCallback.key === callback.key ? "" : ("" + callback.key).replace(
801
- userProvidedKeyEscapeRegex,
802
- "$&/"
803
- ) + "/") + childKey
804
- ), "" !== nameSoFar && null != invokeCallback && isValidElement(invokeCallback) && null == invokeCallback.key && invokeCallback._store && !invokeCallback._store.validated && (escapedPrefix._store.validated = 2), callback = escapedPrefix), array.push(callback));
805
- return 1;
806
- }
807
- invokeCallback = 0;
808
- childKey = "" === nameSoFar ? "." : nameSoFar + ":";
809
- if (isArrayImpl(children))
810
- for (var i = 0; i < children.length; i++)
811
- nameSoFar = children[i], type = childKey + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(
812
- nameSoFar,
813
- array,
814
- escapedPrefix,
815
- type,
816
- callback
817
- );
818
- else if (i = getIteratorFn(children), "function" === typeof i)
819
- for (i === children.entries && (didWarnAboutMaps || console.warn(
820
- "Using Maps as children is not supported. Use an array of keyed ReactElements instead."
821
- ), didWarnAboutMaps = true), children = i.call(children), i = 0; !(nameSoFar = children.next()).done; )
822
- nameSoFar = nameSoFar.value, type = childKey + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(
823
- nameSoFar,
824
- array,
825
- escapedPrefix,
826
- type,
827
- callback
828
- );
829
- else if ("object" === type) {
830
- if ("function" === typeof children.then)
831
- return mapIntoArray(
832
- resolveThenable(children),
833
- array,
834
- escapedPrefix,
835
- nameSoFar,
836
- callback
837
- );
838
- array = String(children);
839
- throw Error(
840
- "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."
841
- );
842
- }
843
- return invokeCallback;
844
- }
845
- __name(mapIntoArray, "mapIntoArray");
846
- function mapChildren(children, func, context) {
847
- if (null == children) return children;
848
- var result = [], count = 0;
849
- mapIntoArray(children, result, "", "", function(child) {
850
- return func.call(context, child, count++);
851
- });
852
- return result;
853
- }
854
- __name(mapChildren, "mapChildren");
855
- function lazyInitializer(payload) {
856
- if (-1 === payload._status) {
857
- var ioInfo = payload._ioInfo;
858
- null != ioInfo && (ioInfo.start = ioInfo.end = performance.now());
859
- ioInfo = payload._result;
860
- var thenable = ioInfo();
861
- thenable.then(
862
- function(moduleObject) {
863
- if (0 === payload._status || -1 === payload._status) {
864
- payload._status = 1;
865
- payload._result = moduleObject;
866
- var _ioInfo = payload._ioInfo;
867
- null != _ioInfo && (_ioInfo.end = performance.now());
868
- void 0 === thenable.status && (thenable.status = "fulfilled", thenable.value = moduleObject);
869
- }
870
- },
871
- function(error) {
872
- if (0 === payload._status || -1 === payload._status) {
873
- payload._status = 2;
874
- payload._result = error;
875
- var _ioInfo2 = payload._ioInfo;
876
- null != _ioInfo2 && (_ioInfo2.end = performance.now());
877
- void 0 === thenable.status && (thenable.status = "rejected", thenable.reason = error);
878
- }
879
- }
880
- );
881
- ioInfo = payload._ioInfo;
882
- if (null != ioInfo) {
883
- ioInfo.value = thenable;
884
- var displayName = thenable.displayName;
885
- "string" === typeof displayName && (ioInfo.name = displayName);
886
- }
887
- -1 === payload._status && (payload._status = 0, payload._result = thenable);
888
- }
889
- if (1 === payload._status)
890
- return ioInfo = payload._result, void 0 === ioInfo && console.error(
891
- "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?",
892
- ioInfo
893
- ), "default" in ioInfo || console.error(
894
- "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",
895
- ioInfo
896
- ), ioInfo.default;
897
- throw payload._result;
898
- }
899
- __name(lazyInitializer, "lazyInitializer");
900
- function resolveDispatcher() {
901
- var dispatcher = ReactSharedInternals.H;
902
- null === dispatcher && console.error(
903
- "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."
904
- );
905
- return dispatcher;
906
- }
907
- __name(resolveDispatcher, "resolveDispatcher");
908
- function releaseAsyncTransition() {
909
- ReactSharedInternals.asyncTransitions--;
910
- }
911
- __name(releaseAsyncTransition, "releaseAsyncTransition");
912
- function enqueueTask(task) {
913
- if (null === enqueueTaskImpl)
914
- try {
915
- var requireString = ("require" + Math.random()).slice(0, 7);
916
- enqueueTaskImpl = (module && module[requireString]).call(
917
- module,
918
- "timers"
919
- ).setImmediate;
920
- } catch (_err) {
921
- enqueueTaskImpl = /* @__PURE__ */ __name(function(callback) {
922
- false === didWarnAboutMessageChannel && (didWarnAboutMessageChannel = true, "undefined" === typeof MessageChannel && console.error(
923
- "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."
924
- ));
925
- var channel = new MessageChannel();
926
- channel.port1.onmessage = callback;
927
- channel.port2.postMessage(void 0);
928
- }, "enqueueTaskImpl");
929
- }
930
- return enqueueTaskImpl(task);
931
- }
932
- __name(enqueueTask, "enqueueTask");
933
- function aggregateErrors(errors) {
934
- return 1 < errors.length && "function" === typeof AggregateError ? new AggregateError(errors) : errors[0];
935
- }
936
- __name(aggregateErrors, "aggregateErrors");
937
- function popActScope(prevActQueue, prevActScopeDepth) {
938
- prevActScopeDepth !== actScopeDepth - 1 && console.error(
939
- "You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "
940
- );
941
- actScopeDepth = prevActScopeDepth;
942
- }
943
- __name(popActScope, "popActScope");
944
- function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
945
- var queue = ReactSharedInternals.actQueue;
946
- if (null !== queue)
947
- if (0 !== queue.length)
948
- try {
949
- flushActQueue(queue);
950
- enqueueTask(function() {
951
- return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
952
- });
953
- return;
954
- } catch (error) {
955
- ReactSharedInternals.thrownErrors.push(error);
956
- }
957
- else ReactSharedInternals.actQueue = null;
958
- 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve(returnValue);
959
- }
960
- __name(recursivelyFlushAsyncActWork, "recursivelyFlushAsyncActWork");
961
- function flushActQueue(queue) {
962
- if (!isFlushing) {
963
- isFlushing = true;
964
- var i = 0;
965
- try {
966
- for (; i < queue.length; i++) {
967
- var callback = queue[i];
968
- do {
969
- ReactSharedInternals.didUsePromise = false;
970
- var continuation = callback(false);
971
- if (null !== continuation) {
972
- if (ReactSharedInternals.didUsePromise) {
973
- queue[i] = callback;
974
- queue.splice(0, i);
975
- return;
976
- }
977
- callback = continuation;
978
- } else break;
979
- } while (1);
980
- }
981
- queue.length = 0;
982
- } catch (error) {
983
- queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error);
984
- } finally {
985
- isFlushing = false;
986
- }
987
- }
988
- }
989
- __name(flushActQueue, "flushActQueue");
990
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
991
- 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 = {
992
- isMounted: /* @__PURE__ */ __name(function() {
993
- return false;
994
- }, "isMounted"),
995
- enqueueForceUpdate: /* @__PURE__ */ __name(function(publicInstance) {
996
- warnNoop(publicInstance, "forceUpdate");
997
- }, "enqueueForceUpdate"),
998
- enqueueReplaceState: /* @__PURE__ */ __name(function(publicInstance) {
999
- warnNoop(publicInstance, "replaceState");
1000
- }, "enqueueReplaceState"),
1001
- enqueueSetState: /* @__PURE__ */ __name(function(publicInstance) {
1002
- warnNoop(publicInstance, "setState");
1003
- }, "enqueueSetState")
1004
- }, assign = Object.assign, emptyObject = {};
1005
- Object.freeze(emptyObject);
1006
- Component.prototype.isReactComponent = {};
1007
- Component.prototype.setState = function(partialState, callback) {
1008
- if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState)
1009
- throw Error(
1010
- "takes an object of state variables to update or a function which returns an object of state variables."
1011
- );
1012
- this.updater.enqueueSetState(this, partialState, callback, "setState");
1013
- };
1014
- Component.prototype.forceUpdate = function(callback) {
1015
- this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
1016
- };
1017
- var deprecatedAPIs = {
1018
- isMounted: [
1019
- "isMounted",
1020
- "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
1021
- ],
1022
- replaceState: [
1023
- "replaceState",
1024
- "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
1025
- ]
1026
- };
1027
- for (fnName in deprecatedAPIs)
1028
- deprecatedAPIs.hasOwnProperty(fnName) && defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
1029
- ComponentDummy.prototype = Component.prototype;
1030
- deprecatedAPIs = PureComponent.prototype = new ComponentDummy();
1031
- deprecatedAPIs.constructor = PureComponent;
1032
- assign(deprecatedAPIs, Component.prototype);
1033
- deprecatedAPIs.isPureReactComponent = true;
1034
- var isArrayImpl = Array.isArray, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = {
1035
- H: null,
1036
- A: null,
1037
- T: null,
1038
- S: null,
1039
- actQueue: null,
1040
- asyncTransitions: 0,
1041
- isBatchingLegacy: false,
1042
- didScheduleLegacyUpdate: false,
1043
- didUsePromise: false,
1044
- thrownErrors: [],
1045
- getCurrentStack: null,
1046
- recentlyCreatedOwnerStacks: 0
1047
- }, hasOwnProperty = Object.prototype.hasOwnProperty, createTask = console.createTask ? console.createTask : function() {
1048
- return null;
1049
- };
1050
- deprecatedAPIs = {
1051
- react_stack_bottom_frame: /* @__PURE__ */ __name(function(callStackForError) {
1052
- return callStackForError();
1053
- }, "react_stack_bottom_frame")
1054
- };
1055
- var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
1056
- var didWarnAboutElementRef = {};
1057
- var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(
1058
- deprecatedAPIs,
1059
- UnknownOwner
1060
- )();
1061
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
1062
- var didWarnAboutMaps = false, userProvidedKeyEscapeRegex = /\/+/g, reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
1063
- if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
1064
- var event = new window.ErrorEvent("error", {
1065
- bubbles: true,
1066
- cancelable: true,
1067
- message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
1068
- error
1069
- });
1070
- if (!window.dispatchEvent(event)) return;
1071
- } else if ("object" === typeof process && "function" === typeof process.emit) {
1072
- process.emit("uncaughtException", error);
1073
- return;
1074
- }
1075
- console.error(error);
1076
- }, didWarnAboutMessageChannel = false, enqueueTaskImpl = null, actScopeDepth = 0, didWarnNoAwaitAct = false, isFlushing = false, queueSeveralMicrotasks = "function" === typeof queueMicrotask ? function(callback) {
1077
- queueMicrotask(function() {
1078
- return queueMicrotask(callback);
1079
- });
1080
- } : enqueueTask;
1081
- deprecatedAPIs = Object.freeze({
1082
- __proto__: null,
1083
- c: /* @__PURE__ */ __name(function(size) {
1084
- return resolveDispatcher().useMemoCache(size);
1085
- }, "c")
1086
- });
1087
- var fnName = {
1088
- map: mapChildren,
1089
- forEach: /* @__PURE__ */ __name(function(children, forEachFunc, forEachContext) {
1090
- mapChildren(
1091
- children,
1092
- function() {
1093
- forEachFunc.apply(this, arguments);
1094
- },
1095
- forEachContext
1096
- );
1097
- }, "forEach"),
1098
- count: /* @__PURE__ */ __name(function(children) {
1099
- var n = 0;
1100
- mapChildren(children, function() {
1101
- n++;
1102
- });
1103
- return n;
1104
- }, "count"),
1105
- toArray: /* @__PURE__ */ __name(function(children) {
1106
- return mapChildren(children, function(child) {
1107
- return child;
1108
- }) || [];
1109
- }, "toArray"),
1110
- only: /* @__PURE__ */ __name(function(children) {
1111
- if (!isValidElement(children))
1112
- throw Error(
1113
- "React.Children.only expected to receive a single React element child."
1114
- );
1115
- return children;
1116
- }, "only")
1117
- };
1118
- exports.Activity = REACT_ACTIVITY_TYPE;
1119
- exports.Children = fnName;
1120
- exports.Component = Component;
1121
- exports.Fragment = REACT_FRAGMENT_TYPE;
1122
- exports.Profiler = REACT_PROFILER_TYPE;
1123
- exports.PureComponent = PureComponent;
1124
- exports.StrictMode = REACT_STRICT_MODE_TYPE;
1125
- exports.Suspense = REACT_SUSPENSE_TYPE;
1126
- exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
1127
- exports.__COMPILER_RUNTIME = deprecatedAPIs;
1128
- exports.act = function(callback) {
1129
- var prevActQueue = ReactSharedInternals.actQueue, prevActScopeDepth = actScopeDepth;
1130
- actScopeDepth++;
1131
- var queue = ReactSharedInternals.actQueue = null !== prevActQueue ? prevActQueue : [], didAwaitActCall = false;
1132
- try {
1133
- var result = callback();
1134
- } catch (error) {
1135
- ReactSharedInternals.thrownErrors.push(error);
1136
- }
1137
- if (0 < ReactSharedInternals.thrownErrors.length)
1138
- throw popActScope(prevActQueue, prevActScopeDepth), callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
1139
- if (null !== result && "object" === typeof result && "function" === typeof result.then) {
1140
- var thenable = result;
1141
- queueSeveralMicrotasks(function() {
1142
- didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error(
1143
- "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 () => ...);"
1144
- ));
1145
- });
1146
- return {
1147
- then: /* @__PURE__ */ __name(function(resolve, reject) {
1148
- didAwaitActCall = true;
1149
- thenable.then(
1150
- function(returnValue) {
1151
- popActScope(prevActQueue, prevActScopeDepth);
1152
- if (0 === prevActScopeDepth) {
1153
- try {
1154
- flushActQueue(queue), enqueueTask(function() {
1155
- return recursivelyFlushAsyncActWork(
1156
- returnValue,
1157
- resolve,
1158
- reject
1159
- );
1160
- });
1161
- } catch (error$0) {
1162
- ReactSharedInternals.thrownErrors.push(error$0);
1163
- }
1164
- if (0 < ReactSharedInternals.thrownErrors.length) {
1165
- var _thrownError = aggregateErrors(
1166
- ReactSharedInternals.thrownErrors
1167
- );
1168
- ReactSharedInternals.thrownErrors.length = 0;
1169
- reject(_thrownError);
1170
- }
1171
- } else resolve(returnValue);
1172
- },
1173
- function(error) {
1174
- popActScope(prevActQueue, prevActScopeDepth);
1175
- 0 < ReactSharedInternals.thrownErrors.length ? (error = aggregateErrors(
1176
- ReactSharedInternals.thrownErrors
1177
- ), ReactSharedInternals.thrownErrors.length = 0, reject(error)) : reject(error);
1178
- }
1179
- );
1180
- }, "then")
1181
- };
1182
- }
1183
- var returnValue$jscomp$0 = result;
1184
- popActScope(prevActQueue, prevActScopeDepth);
1185
- 0 === prevActScopeDepth && (flushActQueue(queue), 0 !== queue.length && queueSeveralMicrotasks(function() {
1186
- didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error(
1187
- "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(() => ...)"
1188
- ));
1189
- }), ReactSharedInternals.actQueue = null);
1190
- if (0 < ReactSharedInternals.thrownErrors.length)
1191
- throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
1192
- return {
1193
- then: /* @__PURE__ */ __name(function(resolve, reject) {
1194
- didAwaitActCall = true;
1195
- 0 === prevActScopeDepth ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
1196
- return recursivelyFlushAsyncActWork(
1197
- returnValue$jscomp$0,
1198
- resolve,
1199
- reject
1200
- );
1201
- })) : resolve(returnValue$jscomp$0);
1202
- }, "then")
1203
- };
1204
- };
1205
- exports.cache = function(fn) {
1206
- return function() {
1207
- return fn.apply(null, arguments);
1208
- };
1209
- };
1210
- exports.cacheSignal = function() {
1211
- return null;
1212
- };
1213
- exports.captureOwnerStack = function() {
1214
- var getCurrentStack = ReactSharedInternals.getCurrentStack;
1215
- return null === getCurrentStack ? null : getCurrentStack();
1216
- };
1217
- exports.cloneElement = function(element, config, children) {
1218
- if (null === element || void 0 === element)
1219
- throw Error(
1220
- "The argument must be a React element, but you passed " + element + "."
1221
- );
1222
- var props = assign({}, element.props), key = element.key, owner = element._owner;
1223
- if (null != config) {
1224
- var JSCompiler_inline_result;
1225
- a: {
1226
- if (hasOwnProperty.call(config, "ref") && (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(
1227
- config,
1228
- "ref"
1229
- ).get) && JSCompiler_inline_result.isReactWarning) {
1230
- JSCompiler_inline_result = false;
1231
- break a;
1232
- }
1233
- JSCompiler_inline_result = void 0 !== config.ref;
1234
- }
1235
- JSCompiler_inline_result && (owner = getOwner());
1236
- hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key);
1237
- for (propName in config)
1238
- !hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
1239
- }
1240
- var propName = arguments.length - 2;
1241
- if (1 === propName) props.children = children;
1242
- else if (1 < propName) {
1243
- JSCompiler_inline_result = Array(propName);
1244
- for (var i = 0; i < propName; i++)
1245
- JSCompiler_inline_result[i] = arguments[i + 2];
1246
- props.children = JSCompiler_inline_result;
1247
- }
1248
- props = ReactElement(
1249
- element.type,
1250
- key,
1251
- props,
1252
- owner,
1253
- element._debugStack,
1254
- element._debugTask
1255
- );
1256
- for (key = 2; key < arguments.length; key++)
1257
- validateChildKeys(arguments[key]);
1258
- return props;
1259
- };
1260
- exports.createContext = function(defaultValue) {
1261
- defaultValue = {
1262
- $$typeof: REACT_CONTEXT_TYPE,
1263
- _currentValue: defaultValue,
1264
- _currentValue2: defaultValue,
1265
- _threadCount: 0,
1266
- Provider: null,
1267
- Consumer: null
1268
- };
1269
- defaultValue.Provider = defaultValue;
1270
- defaultValue.Consumer = {
1271
- $$typeof: REACT_CONSUMER_TYPE,
1272
- _context: defaultValue
1273
- };
1274
- defaultValue._currentRenderer = null;
1275
- defaultValue._currentRenderer2 = null;
1276
- return defaultValue;
1277
- };
1278
- exports.createElement = function(type, config, children) {
1279
- for (var i = 2; i < arguments.length; i++)
1280
- validateChildKeys(arguments[i]);
1281
- i = {};
1282
- var key = null;
1283
- if (null != config)
1284
- for (propName in didWarnAboutOldJSXRuntime || !("__self" in config) || "key" in config || (didWarnAboutOldJSXRuntime = true, console.warn(
1285
- "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"
1286
- )), hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key), config)
1287
- hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (i[propName] = config[propName]);
1288
- var childrenLength = arguments.length - 2;
1289
- if (1 === childrenLength) i.children = children;
1290
- else if (1 < childrenLength) {
1291
- for (var childArray = Array(childrenLength), _i = 0; _i < childrenLength; _i++)
1292
- childArray[_i] = arguments[_i + 2];
1293
- Object.freeze && Object.freeze(childArray);
1294
- i.children = childArray;
1295
- }
1296
- if (type && type.defaultProps)
1297
- for (propName in childrenLength = type.defaultProps, childrenLength)
1298
- void 0 === i[propName] && (i[propName] = childrenLength[propName]);
1299
- key && defineKeyPropWarningGetter(
1300
- i,
1301
- "function" === typeof type ? type.displayName || type.name || "Unknown" : type
1302
- );
1303
- var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
1304
- return ReactElement(
1305
- type,
1306
- key,
1307
- i,
1308
- getOwner(),
1309
- propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
1310
- propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask
1311
- );
1312
- };
1313
- exports.createRef = function() {
1314
- var refObject = { current: null };
1315
- Object.seal(refObject);
1316
- return refObject;
1317
- };
1318
- exports.forwardRef = function(render) {
1319
- null != render && render.$$typeof === REACT_MEMO_TYPE ? console.error(
1320
- "forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."
1321
- ) : "function" !== typeof render ? console.error(
1322
- "forwardRef requires a render function but was given %s.",
1323
- null === render ? "null" : typeof render
1324
- ) : 0 !== render.length && 2 !== render.length && console.error(
1325
- "forwardRef render functions accept exactly two parameters: props and ref. %s",
1326
- 1 === render.length ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined."
1327
- );
1328
- null != render && null != render.defaultProps && console.error(
1329
- "forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?"
1330
- );
1331
- var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render }, ownName;
1332
- Object.defineProperty(elementType, "displayName", {
1333
- enumerable: false,
1334
- configurable: true,
1335
- get: /* @__PURE__ */ __name(function() {
1336
- return ownName;
1337
- }, "get"),
1338
- set: /* @__PURE__ */ __name(function(name) {
1339
- ownName = name;
1340
- render.name || render.displayName || (Object.defineProperty(render, "name", { value: name }), render.displayName = name);
1341
- }, "set")
1342
- });
1343
- return elementType;
1344
- };
1345
- exports.isValidElement = isValidElement;
1346
- exports.lazy = function(ctor) {
1347
- ctor = { _status: -1, _result: ctor };
1348
- var lazyType = {
1349
- $$typeof: REACT_LAZY_TYPE,
1350
- _payload: ctor,
1351
- _init: lazyInitializer
1352
- }, ioInfo = {
1353
- name: "lazy",
1354
- start: -1,
1355
- end: -1,
1356
- value: null,
1357
- owner: null,
1358
- debugStack: Error("react-stack-top-frame"),
1359
- debugTask: console.createTask ? console.createTask("lazy()") : null
1360
- };
1361
- ctor._ioInfo = ioInfo;
1362
- lazyType._debugInfo = [{ awaited: ioInfo }];
1363
- return lazyType;
1364
- };
1365
- exports.memo = function(type, compare) {
1366
- null == type && console.error(
1367
- "memo: The first argument must be a component. Instead received: %s",
1368
- null === type ? "null" : typeof type
1369
- );
1370
- compare = {
1371
- $$typeof: REACT_MEMO_TYPE,
1372
- type,
1373
- compare: void 0 === compare ? null : compare
1374
- };
1375
- var ownName;
1376
- Object.defineProperty(compare, "displayName", {
1377
- enumerable: false,
1378
- configurable: true,
1379
- get: /* @__PURE__ */ __name(function() {
1380
- return ownName;
1381
- }, "get"),
1382
- set: /* @__PURE__ */ __name(function(name) {
1383
- ownName = name;
1384
- type.name || type.displayName || (Object.defineProperty(type, "name", { value: name }), type.displayName = name);
1385
- }, "set")
1386
- });
1387
- return compare;
1388
- };
1389
- exports.startTransition = function(scope) {
1390
- var prevTransition = ReactSharedInternals.T, currentTransition = {};
1391
- currentTransition._updatedFibers = /* @__PURE__ */ new Set();
1392
- ReactSharedInternals.T = currentTransition;
1393
- try {
1394
- var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
1395
- null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
1396
- "object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && (ReactSharedInternals.asyncTransitions++, returnValue.then(releaseAsyncTransition, releaseAsyncTransition), returnValue.then(noop, reportGlobalError));
1397
- } catch (error) {
1398
- reportGlobalError(error);
1399
- } finally {
1400
- null === prevTransition && currentTransition._updatedFibers && (scope = currentTransition._updatedFibers.size, currentTransition._updatedFibers.clear(), 10 < scope && console.warn(
1401
- "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."
1402
- )), null !== prevTransition && null !== currentTransition.types && (null !== prevTransition.types && prevTransition.types !== currentTransition.types && console.error(
1403
- "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."
1404
- ), prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
1405
- }
1406
- };
1407
- exports.unstable_useCacheRefresh = function() {
1408
- return resolveDispatcher().useCacheRefresh();
1409
- };
1410
- exports.use = function(usable) {
1411
- return resolveDispatcher().use(usable);
1412
- };
1413
- exports.useActionState = function(action, initialState, permalink) {
1414
- return resolveDispatcher().useActionState(
1415
- action,
1416
- initialState,
1417
- permalink
1418
- );
1419
- };
1420
- exports.useCallback = function(callback, deps) {
1421
- return resolveDispatcher().useCallback(callback, deps);
1422
- };
1423
- exports.useContext = function(Context) {
1424
- var dispatcher = resolveDispatcher();
1425
- Context.$$typeof === REACT_CONSUMER_TYPE && console.error(
1426
- "Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"
1427
- );
1428
- return dispatcher.useContext(Context);
1429
- };
1430
- exports.useDebugValue = function(value, formatterFn) {
1431
- return resolveDispatcher().useDebugValue(value, formatterFn);
1432
- };
1433
- exports.useDeferredValue = function(value, initialValue) {
1434
- return resolveDispatcher().useDeferredValue(value, initialValue);
1435
- };
1436
- exports.useEffect = function(create, deps) {
1437
- null == create && console.warn(
1438
- "React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1439
- );
1440
- return resolveDispatcher().useEffect(create, deps);
1441
- };
1442
- exports.useEffectEvent = function(callback) {
1443
- return resolveDispatcher().useEffectEvent(callback);
1444
- };
1445
- exports.useId = function() {
1446
- return resolveDispatcher().useId();
1447
- };
1448
- exports.useImperativeHandle = function(ref, create, deps) {
1449
- return resolveDispatcher().useImperativeHandle(ref, create, deps);
1450
- };
1451
- exports.useInsertionEffect = function(create, deps) {
1452
- null == create && console.warn(
1453
- "React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1454
- );
1455
- return resolveDispatcher().useInsertionEffect(create, deps);
1456
- };
1457
- exports.useLayoutEffect = function(create, deps) {
1458
- null == create && console.warn(
1459
- "React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1460
- );
1461
- return resolveDispatcher().useLayoutEffect(create, deps);
1462
- };
1463
- exports.useMemo = function(create, deps) {
1464
- return resolveDispatcher().useMemo(create, deps);
1465
- };
1466
- exports.useOptimistic = function(passthrough, reducer) {
1467
- return resolveDispatcher().useOptimistic(passthrough, reducer);
1468
- };
1469
- exports.useReducer = function(reducer, initialArg, init) {
1470
- return resolveDispatcher().useReducer(reducer, initialArg, init);
1471
- };
1472
- exports.useRef = function(initialValue) {
1473
- return resolveDispatcher().useRef(initialValue);
1474
- };
1475
- exports.useState = function(initialState) {
1476
- return resolveDispatcher().useState(initialState);
1477
- };
1478
- exports.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
1479
- return resolveDispatcher().useSyncExternalStore(
1480
- subscribe,
1481
- getSnapshot,
1482
- getServerSnapshot
1483
- );
1484
- };
1485
- exports.useTransition = function() {
1486
- return resolveDispatcher().useTransition();
1487
- };
1488
- exports.version = "19.2.4";
1489
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
1490
- }();
1491
- }
1492
- });
1493
-
1494
- // node_modules/react/index.js
1495
- var require_react = __commonJS({
1496
- "node_modules/react/index.js"(exports, module) {
1497
- "use strict";
1498
- init_esbuild_shims();
1499
- if (process.env.NODE_ENV === "production") {
1500
- module.exports = require_react_production();
1501
- } else {
1502
- module.exports = require_react_development();
1503
- }
1504
- }
1505
- });
1506
-
1507
- // packages/cli/src/ui/commands/contextCommand.ts
1508
- init_esbuild_shims();
1509
-
1510
- // packages/cli/src/ui/commands/types.ts
1511
- init_esbuild_shims();
1512
-
1513
- // packages/cli/src/ui/types.ts
1514
- init_esbuild_shims();
1515
- var import_react = __toESM(require_react(), 1);
1516
- var TERMINAL_GOAL_STATUS_KINDS = [
1517
- "achieved",
1518
- "aborted",
1519
- "failed"
1520
- ];
1521
- function isTerminalGoalStatusKind(kind) {
1522
- return TERMINAL_GOAL_STATUS_KINDS.includes(
1523
- kind
1524
- );
1525
- }
1526
- __name(isTerminalGoalStatusKind, "isTerminalGoalStatusKind");
1527
-
1528
- // packages/cli/src/ui/commands/contextCommand.ts
1529
- var DEFAULT_COMPRESSION_THRESHOLD = 0.7;
1530
- function estimateTokens(text) {
1531
- if (!text || text.length === 0) return 0;
1532
- let asciiChars = 0;
1533
- let nonAsciiChars = 0;
1534
- for (let i = 0; i < text.length; i++) {
1535
- const charCode = text.charCodeAt(i);
1536
- if (charCode < 128) {
1537
- asciiChars++;
1538
- } else {
1539
- nonAsciiChars++;
1540
- }
1541
- }
1542
- return Math.ceil(asciiChars / 4 + nonAsciiChars * 1.5);
1543
- }
1544
- __name(estimateTokens, "estimateTokens");
1545
- function parseMemoryFiles(memoryContent) {
1546
- if (!memoryContent || memoryContent.trim().length === 0) return [];
1547
- const results = [];
1548
- const regex = /--- Context from: (.+?) ---\n([\s\S]*?)--- End of Context from: \1 ---/g;
1549
- let match;
1550
- while ((match = regex.exec(memoryContent)) !== null) {
1551
- const filePath = match[1];
1552
- const content = match[2];
1553
- results.push({
1554
- path: filePath,
1555
- tokens: estimateTokens(content)
1556
- });
1557
- }
1558
- if (results.length === 0 && memoryContent.trim().length > 0) {
1559
- results.push({
1560
- path: t("memory"),
1561
- tokens: estimateTokens(memoryContent)
1562
- });
1563
- }
1564
- return results;
1565
- }
1566
- __name(parseMemoryFiles, "parseMemoryFiles");
1567
- async function collectContextData(config, showDetails) {
1568
- const modelName = config.getModel() || "unknown";
1569
- const contentGeneratorConfig = config.getContentGeneratorConfig();
1570
- const contextWindowSize = contentGeneratorConfig.contextWindowSize ?? DEFAULT_TOKEN_LIMIT;
1571
- const apiTotalTokens = uiTelemetryService.getLastPromptTokenCount();
1572
- const apiCachedTokens = uiTelemetryService.getLastCachedContentTokenCount();
1573
- const systemPromptText = getCoreSystemPrompt(void 0, modelName);
1574
- const systemPromptTokens = estimateTokens(systemPromptText);
1575
- const toolRegistry = config.getToolRegistry();
1576
- const allTools = toolRegistry ? toolRegistry.getAllTools() : [];
1577
- const toolDeclarations = toolRegistry ? toolRegistry.getFunctionDeclarations({ includeDeferred: true }) : [];
1578
- const toolsJsonStr = JSON.stringify(toolDeclarations);
1579
- const allToolsTokens = estimateTokens(toolsJsonStr);
1580
- const builtinTools = [];
1581
- const mcpTools = [];
1582
- for (const tool of allTools) {
1583
- const toolJsonStr = JSON.stringify(tool.schema);
1584
- const tokens = estimateTokens(toolJsonStr);
1585
- if (tool instanceof DiscoveredMCPTool) {
1586
- mcpTools.push({
1587
- name: `${tool.serverName}__${tool.serverToolName || tool.name}`,
1588
- tokens
1589
- });
1590
- } else if (tool.name !== ToolNames.SKILL) {
1591
- builtinTools.push({
1592
- name: tool.name,
1593
- tokens
1594
- });
1595
- }
1596
- }
1597
- const memoryContent = config.getUserMemory();
1598
- const memoryFiles = parseMemoryFiles(memoryContent);
1599
- const memoryFilesTokens = memoryFiles.reduce((sum, f) => sum + f.tokens, 0);
1600
- const skillTool = allTools.find((tool) => tool.name === ToolNames.SKILL);
1601
- const skillToolDefinitionTokens = skillTool ? estimateTokens(JSON.stringify(skillTool.schema)) : 0;
1602
- const loadedSkillNames = skillTool && "getLoadedSkillNames" in skillTool ? skillTool.getLoadedSkillNames() : /* @__PURE__ */ new Set();
1603
- const skillManager = config.getSkillManager();
1604
- const skillConfigs = skillManager ? await skillManager.listSkills() : [];
1605
- let loadedBodiesTokens = 0;
1606
- const skills = skillConfigs.map((skill) => {
1607
- const listingTokens = estimateTokens(
1608
- `<skill>
1609
- <name>
1610
- ${skill.name}
1611
- </name>
1612
- <description>
1613
- ${skill.description} (${skill.level})
1614
- </description>
1615
- <location>
1616
- ${skill.level}
1617
- </location>
1618
- </skill>`
1619
- );
1620
- const isLoaded = loadedSkillNames.has(skill.name);
1621
- let bodyTokens;
1622
- if (isLoaded && skill.body) {
1623
- const baseDir = skill.filePath ? skill.filePath.replace(/\/[^/]+$/, "") : "";
1624
- bodyTokens = estimateTokens(buildSkillLlmContent(baseDir, skill.body));
1625
- loadedBodiesTokens += bodyTokens;
1626
- }
1627
- return {
1628
- name: skill.name,
1629
- tokens: listingTokens,
1630
- loaded: isLoaded,
1631
- bodyTokens
1632
- };
1633
- });
1634
- const skillsTokens = skillToolDefinitionTokens + loadedBodiesTokens;
1635
- const compressionThreshold = config.getChatCompression()?.contextPercentageThreshold ?? DEFAULT_COMPRESSION_THRESHOLD;
1636
- const autocompactBuffer = compressionThreshold > 0 ? Math.round((1 - compressionThreshold) * contextWindowSize) : 0;
1637
- const rawOverhead = systemPromptTokens + allToolsTokens + memoryFilesTokens + loadedBodiesTokens;
1638
- const isEstimated = apiTotalTokens === 0;
1639
- const mcpToolsTotalTokens = mcpTools.reduce(
1640
- (sum, tool) => sum + tool.tokens,
1641
- 0
1642
- );
1643
- let totalTokens;
1644
- let displaySystemPrompt;
1645
- let displayBuiltinTools;
1646
- let displayMcpTools;
1647
- let displayMemoryFiles;
1648
- let displaySkills;
1649
- let messagesTokens;
1650
- let freeSpace;
1651
- let detailBuiltinTools;
1652
- let detailMcpTools;
1653
- let detailMemoryFiles;
1654
- let detailSkills;
1655
- if (isEstimated) {
1656
- totalTokens = 0;
1657
- displaySystemPrompt = systemPromptTokens;
1658
- displaySkills = skillsTokens;
1659
- displayBuiltinTools = Math.max(
1660
- 0,
1661
- allToolsTokens - skillToolDefinitionTokens - mcpToolsTotalTokens
1662
- );
1663
- displayMcpTools = mcpToolsTotalTokens;
1664
- displayMemoryFiles = memoryFilesTokens;
1665
- messagesTokens = 0;
1666
- freeSpace = Math.max(
1667
- 0,
1668
- contextWindowSize - rawOverhead - autocompactBuffer
1669
- );
1670
- detailBuiltinTools = builtinTools;
1671
- detailMcpTools = mcpTools;
1672
- detailMemoryFiles = memoryFiles;
1673
- detailSkills = skills;
1674
- } else {
1675
- totalTokens = apiTotalTokens;
1676
- const overheadScale = rawOverhead > totalTokens ? totalTokens / rawOverhead : 1;
1677
- displaySystemPrompt = Math.round(systemPromptTokens * overheadScale);
1678
- const scaledAllTools = Math.round(allToolsTokens * overheadScale);
1679
- displayMemoryFiles = Math.round(memoryFilesTokens * overheadScale);
1680
- displaySkills = Math.round(skillsTokens * overheadScale);
1681
- const scaledMcpTotal = Math.round(mcpToolsTotalTokens * overheadScale);
1682
- displayMcpTools = scaledMcpTotal;
1683
- const scaledSkillDefinition = Math.round(
1684
- skillToolDefinitionTokens * overheadScale
1685
- );
1686
- displayBuiltinTools = Math.max(
1687
- 0,
1688
- scaledAllTools - scaledSkillDefinition - scaledMcpTotal
1689
- );
1690
- const scaledOverhead = displaySystemPrompt + scaledAllTools + displayMemoryFiles + Math.round(loadedBodiesTokens * overheadScale);
1691
- if (apiCachedTokens > 0) {
1692
- messagesTokens = Math.max(0, totalTokens - apiCachedTokens);
1693
- } else {
1694
- messagesTokens = Math.max(0, totalTokens - scaledOverhead);
1695
- }
1696
- freeSpace = Math.max(
1697
- 0,
1698
- contextWindowSize - totalTokens - autocompactBuffer
1699
- );
1700
- const scaleDetail = /* @__PURE__ */ __name((items) => overheadScale < 1 ? items.map((item) => ({
1701
- ...item,
1702
- tokens: Math.round(item.tokens * overheadScale)
1703
- })) : items, "scaleDetail");
1704
- detailBuiltinTools = scaleDetail(builtinTools);
1705
- detailMcpTools = scaleDetail(mcpTools);
1706
- detailMemoryFiles = scaleDetail(memoryFiles);
1707
- detailSkills = overheadScale < 1 ? skills.map((item) => ({
1708
- ...item,
1709
- tokens: Math.round(item.tokens * overheadScale),
1710
- bodyTokens: item.bodyTokens ? Math.round(item.bodyTokens * overheadScale) : void 0
1711
- })) : skills;
1712
- }
1713
- const breakdown = {
1714
- systemPrompt: displaySystemPrompt,
1715
- builtinTools: displayBuiltinTools,
1716
- mcpTools: displayMcpTools,
1717
- memoryFiles: displayMemoryFiles,
1718
- skills: displaySkills,
1719
- messages: messagesTokens,
1720
- freeSpace,
1721
- autocompactBuffer
1722
- };
1723
- return {
1724
- type: "context_usage" /* CONTEXT_USAGE */,
1725
- modelName,
1726
- totalTokens,
1727
- contextWindowSize,
1728
- breakdown,
1729
- builtinTools: showDetails ? detailBuiltinTools : [],
1730
- mcpTools: showDetails ? detailMcpTools : [],
1731
- memoryFiles: showDetails ? detailMemoryFiles : [],
1732
- skills: showDetails ? detailSkills : [],
1733
- isEstimated,
1734
- showDetails
1735
- };
1736
- }
1737
- __name(collectContextData, "collectContextData");
1738
- function fmtTokens(tokens) {
1739
- if (tokens >= 1e3) {
1740
- return `${(tokens / 1e3).toFixed(1)}k`;
1741
- }
1742
- return `${tokens}`;
1743
- }
1744
- __name(fmtTokens, "fmtTokens");
1745
- function fmtCategoryRow(label, tokens, contextWindowSize, indent = " ") {
1746
- const percentage = (tokens / contextWindowSize * 100).toFixed(1);
1747
- const right = `${fmtTokens(tokens)} tokens (${percentage}%)`;
1748
- const leftPart = `${indent}${label}`;
1749
- const totalWidth = 56;
1750
- const dots = Math.max(1, totalWidth - leftPart.length - right.length);
1751
- return `${leftPart}${" ".repeat(dots)}${right}`;
1752
- }
1753
- __name(fmtCategoryRow, "fmtCategoryRow");
1754
- function formatContextUsageText(data) {
1755
- const {
1756
- modelName,
1757
- totalTokens,
1758
- contextWindowSize,
1759
- breakdown,
1760
- builtinTools,
1761
- mcpTools,
1762
- memoryFiles,
1763
- skills,
1764
- isEstimated,
1765
- showDetails
1766
- } = data;
1767
- const lines = [];
1768
- lines.push("## Context Usage");
1769
- lines.push("");
1770
- if (isEstimated) {
1771
- lines.push("*No API response yet. Send a message to see actual usage.*");
1772
- lines.push("");
1773
- lines.push("**Estimated pre-conversation overhead**");
1774
- lines.push(
1775
- `Model: ${modelName} Context window: ${fmtTokens(contextWindowSize)} tokens`
1776
- );
1777
- lines.push("");
1778
- } else {
1779
- lines.push(
1780
- `Model: ${modelName} Context window: ${fmtTokens(contextWindowSize)} tokens`
1781
- );
1782
- lines.push("");
1783
- lines.push(fmtCategoryRow("Used", totalTokens, contextWindowSize));
1784
- lines.push(fmtCategoryRow("Free", breakdown.freeSpace, contextWindowSize));
1785
- lines.push(
1786
- fmtCategoryRow(
1787
- "Autocompact buffer",
1788
- breakdown.autocompactBuffer,
1789
- contextWindowSize
1790
- )
1791
- );
1792
- lines.push("");
1793
- lines.push("**Usage by category**");
1794
- }
1795
- lines.push(
1796
- fmtCategoryRow("System prompt", breakdown.systemPrompt, contextWindowSize)
1797
- );
1798
- lines.push(
1799
- fmtCategoryRow("Built-in tools", breakdown.builtinTools, contextWindowSize)
1800
- );
1801
- if (breakdown.mcpTools > 0) {
1802
- lines.push(
1803
- fmtCategoryRow("MCP tools", breakdown.mcpTools, contextWindowSize)
1804
- );
1805
- }
1806
- lines.push(
1807
- fmtCategoryRow("Memory files", breakdown.memoryFiles, contextWindowSize)
1808
- );
1809
- lines.push(fmtCategoryRow("Skills", breakdown.skills, contextWindowSize));
1810
- if (!isEstimated) {
1811
- lines.push(
1812
- fmtCategoryRow("Messages", breakdown.messages, contextWindowSize)
1813
- );
1814
- }
1815
- if (showDetails) {
1816
- const sortedBuiltin = [...builtinTools].sort((a, b) => b.tokens - a.tokens);
1817
- const sortedMcp = [...mcpTools].sort((a, b) => b.tokens - a.tokens);
1818
- const sortedMemory = [...memoryFiles].sort((a, b) => b.tokens - a.tokens);
1819
- const sortedSkills = [...skills].sort((a, b) => {
1820
- if (a.loaded !== b.loaded) return a.loaded ? -1 : 1;
1821
- return b.tokens + (b.bodyTokens ?? 0) - (a.tokens + (a.bodyTokens ?? 0));
1822
- });
1823
- if (sortedBuiltin.length > 0) {
1824
- lines.push("");
1825
- lines.push("**Built-in tools**");
1826
- for (const tool of sortedBuiltin) {
1827
- lines.push(
1828
- fmtCategoryRow(tool.name, tool.tokens, contextWindowSize, " \u2514 ")
1829
- );
1830
- }
1831
- }
1832
- if (sortedMcp.length > 0) {
1833
- lines.push("");
1834
- lines.push("**MCP tools**");
1835
- for (const tool of sortedMcp) {
1836
- lines.push(
1837
- fmtCategoryRow(tool.name, tool.tokens, contextWindowSize, " \u2514 ")
1838
- );
1839
- }
1840
- }
1841
- if (sortedMemory.length > 0) {
1842
- lines.push("");
1843
- lines.push("**Memory files**");
1844
- for (const file of sortedMemory) {
1845
- lines.push(
1846
- fmtCategoryRow(file.path, file.tokens, contextWindowSize, " \u2514 ")
1847
- );
1848
- }
1849
- }
1850
- if (sortedSkills.length > 0) {
1851
- lines.push("");
1852
- lines.push("**Skills**");
1853
- for (const skill of sortedSkills) {
1854
- const label = skill.loaded ? `${skill.name} (active)` : skill.name;
1855
- lines.push(
1856
- fmtCategoryRow(label, skill.tokens, contextWindowSize, " \u2514 ")
1857
- );
1858
- if (skill.loaded && skill.bodyTokens && skill.bodyTokens > 0) {
1859
- lines.push(
1860
- fmtCategoryRow(
1861
- "body loaded",
1862
- skill.bodyTokens,
1863
- contextWindowSize,
1864
- " \u2514 "
1865
- )
1866
- );
1867
- }
1868
- }
1869
- }
1870
- } else {
1871
- lines.push("");
1872
- lines.push("*Run /context detail for per-item breakdown.*");
1873
- }
1874
- return lines.join("\n");
1875
- }
1876
- __name(formatContextUsageText, "formatContextUsageText");
1877
- var contextCommand = {
1878
- name: "context",
1879
- get description() {
1880
- return t(
1881
- 'Show context window usage breakdown. Use "/context detail" for per-item breakdown.'
1882
- );
1883
- },
1884
- kind: "built-in" /* BUILT_IN */,
1885
- supportedModes: ["interactive", "non_interactive", "acp"],
1886
- action: /* @__PURE__ */ __name(async (context, args) => {
1887
- const showDetails = args?.trim().toLowerCase() === "detail" || args?.trim().toLowerCase() === "-d";
1888
- const executionMode = context.executionMode ?? "interactive";
1889
- const { config } = context.services;
1890
- if (!config) {
1891
- if (executionMode === "interactive") {
1892
- context.ui.addItem(
1893
- {
1894
- type: "error" /* ERROR */,
1895
- text: t("Config not loaded.")
1896
- },
1897
- Date.now()
1898
- );
1899
- return;
1900
- }
1901
- return {
1902
- type: "message",
1903
- messageType: "error",
1904
- content: t("Config not loaded.")
1905
- };
1906
- }
1907
- const contextUsageItem = await collectContextData(config, showDetails);
1908
- if (executionMode === "interactive") {
1909
- context.ui.addItem(contextUsageItem, Date.now());
1910
- return;
1911
- } else {
1912
- return {
1913
- type: "message",
1914
- messageType: "info",
1915
- content: formatContextUsageText(contextUsageItem)
1916
- };
1917
- }
1918
- }, "action"),
1919
- subCommands: [
1920
- {
1921
- name: "detail",
1922
- get description() {
1923
- return t("Show per-item context usage breakdown.");
1924
- },
1925
- kind: "built-in" /* BUILT_IN */,
1926
- supportedModes: ["interactive", "non_interactive", "acp"],
1927
- action: /* @__PURE__ */ __name(async (context) => {
1928
- await contextCommand.action(context, "detail");
1929
- }, "action")
1930
- }
1931
- ]
1932
- };
1933
-
1934
- export {
1935
- require_react,
1936
- isTerminalGoalStatusKind,
1937
- collectContextData,
1938
- formatContextUsageText,
1939
- contextCommand
1940
- };
1941
- /**
1942
- * @license
1943
- * Copyright 2025 Google LLC
1944
- * SPDX-License-Identifier: Apache-2.0
1945
- */
1946
- /**
1947
- * @license
1948
- * Copyright 2025 Qwen
1949
- * SPDX-License-Identifier: Apache-2.0
1950
- */
1951
- /*! Bundled license information:
1952
-
1953
- react/cjs/react.production.js:
1954
- (**
1955
- * @license React
1956
- * react.production.js
1957
- *
1958
- * Copyright (c) Meta Platforms, Inc. and affiliates.
1959
- *
1960
- * This source code is licensed under the MIT license found in the
1961
- * LICENSE file in the root directory of this source tree.
1962
- *)
1963
-
1964
- react/cjs/react.development.js:
1965
- (**
1966
- * @license React
1967
- * react.development.js
1968
- *
1969
- * Copyright (c) Meta Platforms, Inc. and affiliates.
1970
- *
1971
- * This source code is licensed under the MIT license found in the
1972
- * LICENSE file in the root directory of this source tree.
1973
- *)
1974
- */