@hasna/assistants 1.1.40 → 1.1.42
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.
- package/dist/index.js +1807 -1828
- package/dist/index.js.map +15 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -87223,7 +87223,7 @@ Not a git repository or git not available.
|
|
|
87223
87223
|
context.setProjectContext(projectContext);
|
|
87224
87224
|
}
|
|
87225
87225
|
}
|
|
87226
|
-
var VERSION2 = "1.1.
|
|
87226
|
+
var VERSION2 = "1.1.42";
|
|
87227
87227
|
var init_builtin = __esm(async () => {
|
|
87228
87228
|
init_src2();
|
|
87229
87229
|
init_store();
|
|
@@ -205198,6 +205198,229 @@ var require_stack_utils = __commonJS((exports, module) => {
|
|
|
205198
205198
|
module.exports = StackUtils;
|
|
205199
205199
|
});
|
|
205200
205200
|
|
|
205201
|
+
// node_modules/.pnpm/react@19.2.4/node_modules/react/cjs/react-jsx-dev-runtime.development.js
|
|
205202
|
+
var require_react_jsx_dev_runtime_development = __commonJS((exports) => {
|
|
205203
|
+
var React11 = __toESM(require_react2());
|
|
205204
|
+
(function() {
|
|
205205
|
+
function getComponentNameFromType2(type) {
|
|
205206
|
+
if (type == null)
|
|
205207
|
+
return null;
|
|
205208
|
+
if (typeof type === "function")
|
|
205209
|
+
return type.$$typeof === REACT_CLIENT_REFERENCE2 ? null : type.displayName || type.name || null;
|
|
205210
|
+
if (typeof type === "string")
|
|
205211
|
+
return type;
|
|
205212
|
+
switch (type) {
|
|
205213
|
+
case REACT_FRAGMENT_TYPE2:
|
|
205214
|
+
return "Fragment";
|
|
205215
|
+
case REACT_PROFILER_TYPE2:
|
|
205216
|
+
return "Profiler";
|
|
205217
|
+
case REACT_STRICT_MODE_TYPE2:
|
|
205218
|
+
return "StrictMode";
|
|
205219
|
+
case REACT_SUSPENSE_TYPE2:
|
|
205220
|
+
return "Suspense";
|
|
205221
|
+
case REACT_SUSPENSE_LIST_TYPE2:
|
|
205222
|
+
return "SuspenseList";
|
|
205223
|
+
case REACT_ACTIVITY_TYPE2:
|
|
205224
|
+
return "Activity";
|
|
205225
|
+
}
|
|
205226
|
+
if (typeof type === "object")
|
|
205227
|
+
switch (typeof type.tag === "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
|
|
205228
|
+
case REACT_PORTAL_TYPE2:
|
|
205229
|
+
return "Portal";
|
|
205230
|
+
case REACT_CONTEXT_TYPE2:
|
|
205231
|
+
return type.displayName || "Context";
|
|
205232
|
+
case REACT_CONSUMER_TYPE2:
|
|
205233
|
+
return (type._context.displayName || "Context") + ".Consumer";
|
|
205234
|
+
case REACT_FORWARD_REF_TYPE2:
|
|
205235
|
+
var innerType = type.render;
|
|
205236
|
+
type = type.displayName;
|
|
205237
|
+
type || (type = innerType.displayName || innerType.name || "", type = type !== "" ? "ForwardRef(" + type + ")" : "ForwardRef");
|
|
205238
|
+
return type;
|
|
205239
|
+
case REACT_MEMO_TYPE2:
|
|
205240
|
+
return innerType = type.displayName || null, innerType !== null ? innerType : getComponentNameFromType2(type.type) || "Memo";
|
|
205241
|
+
case REACT_LAZY_TYPE2:
|
|
205242
|
+
innerType = type._payload;
|
|
205243
|
+
type = type._init;
|
|
205244
|
+
try {
|
|
205245
|
+
return getComponentNameFromType2(type(innerType));
|
|
205246
|
+
} catch (x6) {}
|
|
205247
|
+
}
|
|
205248
|
+
return null;
|
|
205249
|
+
}
|
|
205250
|
+
function testStringCoercion2(value) {
|
|
205251
|
+
return "" + value;
|
|
205252
|
+
}
|
|
205253
|
+
function checkKeyStringCoercion(value) {
|
|
205254
|
+
try {
|
|
205255
|
+
testStringCoercion2(value);
|
|
205256
|
+
var JSCompiler_inline_result = false;
|
|
205257
|
+
} catch (e6) {
|
|
205258
|
+
JSCompiler_inline_result = true;
|
|
205259
|
+
}
|
|
205260
|
+
if (JSCompiler_inline_result) {
|
|
205261
|
+
JSCompiler_inline_result = console;
|
|
205262
|
+
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
205263
|
+
var JSCompiler_inline_result$jscomp$0 = typeof Symbol === "function" && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
205264
|
+
JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
|
|
205265
|
+
return testStringCoercion2(value);
|
|
205266
|
+
}
|
|
205267
|
+
}
|
|
205268
|
+
function getTaskName(type) {
|
|
205269
|
+
if (type === REACT_FRAGMENT_TYPE2)
|
|
205270
|
+
return "<>";
|
|
205271
|
+
if (typeof type === "object" && type !== null && type.$$typeof === REACT_LAZY_TYPE2)
|
|
205272
|
+
return "<...>";
|
|
205273
|
+
try {
|
|
205274
|
+
var name2 = getComponentNameFromType2(type);
|
|
205275
|
+
return name2 ? "<" + name2 + ">" : "<...>";
|
|
205276
|
+
} catch (x6) {
|
|
205277
|
+
return "<...>";
|
|
205278
|
+
}
|
|
205279
|
+
}
|
|
205280
|
+
function getOwner() {
|
|
205281
|
+
var dispatcher = ReactSharedInternals2.A;
|
|
205282
|
+
return dispatcher === null ? null : dispatcher.getOwner();
|
|
205283
|
+
}
|
|
205284
|
+
function UnknownOwner() {
|
|
205285
|
+
return Error("react-stack-top-frame");
|
|
205286
|
+
}
|
|
205287
|
+
function hasValidKey(config) {
|
|
205288
|
+
if (hasOwnProperty2.call(config, "key")) {
|
|
205289
|
+
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
205290
|
+
if (getter && getter.isReactWarning)
|
|
205291
|
+
return false;
|
|
205292
|
+
}
|
|
205293
|
+
return config.key !== undefined;
|
|
205294
|
+
}
|
|
205295
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
205296
|
+
function warnAboutAccessingKey() {
|
|
205297
|
+
specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error("%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)", displayName));
|
|
205298
|
+
}
|
|
205299
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
205300
|
+
Object.defineProperty(props, "key", {
|
|
205301
|
+
get: warnAboutAccessingKey,
|
|
205302
|
+
configurable: true
|
|
205303
|
+
});
|
|
205304
|
+
}
|
|
205305
|
+
function elementRefGetterWithDeprecationWarning() {
|
|
205306
|
+
var componentName = getComponentNameFromType2(this.type);
|
|
205307
|
+
didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error("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."));
|
|
205308
|
+
componentName = this.props.ref;
|
|
205309
|
+
return componentName !== undefined ? componentName : null;
|
|
205310
|
+
}
|
|
205311
|
+
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
205312
|
+
var refProp = props.ref;
|
|
205313
|
+
type = {
|
|
205314
|
+
$$typeof: REACT_ELEMENT_TYPE2,
|
|
205315
|
+
type,
|
|
205316
|
+
key,
|
|
205317
|
+
props,
|
|
205318
|
+
_owner: owner
|
|
205319
|
+
};
|
|
205320
|
+
(refProp !== undefined ? refProp : null) !== null ? Object.defineProperty(type, "ref", {
|
|
205321
|
+
enumerable: false,
|
|
205322
|
+
get: elementRefGetterWithDeprecationWarning
|
|
205323
|
+
}) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
|
|
205324
|
+
type._store = {};
|
|
205325
|
+
Object.defineProperty(type._store, "validated", {
|
|
205326
|
+
configurable: false,
|
|
205327
|
+
enumerable: false,
|
|
205328
|
+
writable: true,
|
|
205329
|
+
value: 0
|
|
205330
|
+
});
|
|
205331
|
+
Object.defineProperty(type, "_debugInfo", {
|
|
205332
|
+
configurable: false,
|
|
205333
|
+
enumerable: false,
|
|
205334
|
+
writable: true,
|
|
205335
|
+
value: null
|
|
205336
|
+
});
|
|
205337
|
+
Object.defineProperty(type, "_debugStack", {
|
|
205338
|
+
configurable: false,
|
|
205339
|
+
enumerable: false,
|
|
205340
|
+
writable: true,
|
|
205341
|
+
value: debugStack
|
|
205342
|
+
});
|
|
205343
|
+
Object.defineProperty(type, "_debugTask", {
|
|
205344
|
+
configurable: false,
|
|
205345
|
+
enumerable: false,
|
|
205346
|
+
writable: true,
|
|
205347
|
+
value: debugTask
|
|
205348
|
+
});
|
|
205349
|
+
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
205350
|
+
return type;
|
|
205351
|
+
}
|
|
205352
|
+
function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) {
|
|
205353
|
+
var children2 = config.children;
|
|
205354
|
+
if (children2 !== undefined)
|
|
205355
|
+
if (isStaticChildren)
|
|
205356
|
+
if (isArrayImpl2(children2)) {
|
|
205357
|
+
for (isStaticChildren = 0;isStaticChildren < children2.length; isStaticChildren++)
|
|
205358
|
+
validateChildKeys(children2[isStaticChildren]);
|
|
205359
|
+
Object.freeze && Object.freeze(children2);
|
|
205360
|
+
} else
|
|
205361
|
+
console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
205362
|
+
else
|
|
205363
|
+
validateChildKeys(children2);
|
|
205364
|
+
if (hasOwnProperty2.call(config, "key")) {
|
|
205365
|
+
children2 = getComponentNameFromType2(type);
|
|
205366
|
+
var keys = Object.keys(config).filter(function(k7) {
|
|
205367
|
+
return k7 !== "key";
|
|
205368
|
+
});
|
|
205369
|
+
isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
205370
|
+
didWarnAboutKeySpread[children2 + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
205371
|
+
let props = %s;
|
|
205372
|
+
<%s {...props} />
|
|
205373
|
+
React keys must be passed directly to JSX without using spread:
|
|
205374
|
+
let props = %s;
|
|
205375
|
+
<%s key={someKey} {...props} />`, isStaticChildren, children2, keys, children2), didWarnAboutKeySpread[children2 + isStaticChildren] = true);
|
|
205376
|
+
}
|
|
205377
|
+
children2 = null;
|
|
205378
|
+
maybeKey !== undefined && (checkKeyStringCoercion(maybeKey), children2 = "" + maybeKey);
|
|
205379
|
+
hasValidKey(config) && (checkKeyStringCoercion(config.key), children2 = "" + config.key);
|
|
205380
|
+
if ("key" in config) {
|
|
205381
|
+
maybeKey = {};
|
|
205382
|
+
for (var propName in config)
|
|
205383
|
+
propName !== "key" && (maybeKey[propName] = config[propName]);
|
|
205384
|
+
} else
|
|
205385
|
+
maybeKey = config;
|
|
205386
|
+
children2 && defineKeyPropWarningGetter(maybeKey, typeof type === "function" ? type.displayName || type.name || "Unknown" : type);
|
|
205387
|
+
return ReactElement(type, children2, maybeKey, getOwner(), debugStack, debugTask);
|
|
205388
|
+
}
|
|
205389
|
+
function validateChildKeys(node2) {
|
|
205390
|
+
isValidElement(node2) ? node2._store && (node2._store.validated = 1) : typeof node2 === "object" && node2 !== null && node2.$$typeof === REACT_LAZY_TYPE2 && (node2._payload.status === "fulfilled" ? isValidElement(node2._payload.value) && node2._payload.value._store && (node2._payload.value._store.validated = 1) : node2._store && (node2._store.validated = 1));
|
|
205391
|
+
}
|
|
205392
|
+
function isValidElement(object) {
|
|
205393
|
+
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE2;
|
|
205394
|
+
}
|
|
205395
|
+
var REACT_ELEMENT_TYPE2 = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE2 = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE2 = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE2 = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE2 = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE2 = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE2 = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE2 = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE2 = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE2 = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE2 = Symbol.for("react.memo"), REACT_LAZY_TYPE2 = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE2 = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE2 = Symbol.for("react.client.reference"), ReactSharedInternals2 = React11.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty2 = Object.prototype.hasOwnProperty, isArrayImpl2 = Array.isArray, createTask = console.createTask ? console.createTask : function() {
|
|
205396
|
+
return null;
|
|
205397
|
+
};
|
|
205398
|
+
React11 = {
|
|
205399
|
+
react_stack_bottom_frame: function(callStackForError) {
|
|
205400
|
+
return callStackForError();
|
|
205401
|
+
}
|
|
205402
|
+
};
|
|
205403
|
+
var specialPropKeyWarningShown;
|
|
205404
|
+
var didWarnAboutElementRef = {};
|
|
205405
|
+
var unknownOwnerDebugStack = React11.react_stack_bottom_frame.bind(React11, UnknownOwner)();
|
|
205406
|
+
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
205407
|
+
var didWarnAboutKeySpread = {};
|
|
205408
|
+
exports.Fragment = REACT_FRAGMENT_TYPE2;
|
|
205409
|
+
exports.jsxDEV = function(type, config, maybeKey, isStaticChildren) {
|
|
205410
|
+
var trackActualOwner = 1e4 > ReactSharedInternals2.recentlyCreatedOwnerStacks++;
|
|
205411
|
+
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
205412
|
+
};
|
|
205413
|
+
})();
|
|
205414
|
+
});
|
|
205415
|
+
|
|
205416
|
+
// node_modules/.pnpm/react@19.2.4/node_modules/react/jsx-dev-runtime.js
|
|
205417
|
+
var require_jsx_dev_runtime = __commonJS((exports, module) => {
|
|
205418
|
+
var react_jsx_dev_runtime_development = __toESM(require_react_jsx_dev_runtime_development());
|
|
205419
|
+
if (false) {} else {
|
|
205420
|
+
module.exports = react_jsx_dev_runtime_development;
|
|
205421
|
+
}
|
|
205422
|
+
});
|
|
205423
|
+
|
|
205201
205424
|
// node_modules/.pnpm/sharp@0.34.5/node_modules/sharp/lib/is.js
|
|
205202
205425
|
var require_is = __commonJS((exports, module) => {
|
|
205203
205426
|
/*!
|
|
@@ -217234,7 +217457,7 @@ var require_dom_parser = __commonJS((exports) => {
|
|
|
217234
217457
|
var NAMESPACE = conventions.NAMESPACE;
|
|
217235
217458
|
var ParseError = sax.ParseError;
|
|
217236
217459
|
var XMLReader = sax.XMLReader;
|
|
217237
|
-
function
|
|
217460
|
+
function normalizeLineEndings2(input) {
|
|
217238
217461
|
return input.replace(/\r[\n\u0085]/g, `
|
|
217239
217462
|
`).replace(/[\r\u0085\u2028]/g, `
|
|
217240
217463
|
`);
|
|
@@ -217260,7 +217483,7 @@ var require_dom_parser = __commonJS((exports) => {
|
|
|
217260
217483
|
defaultNSMap[""] = NAMESPACE.HTML;
|
|
217261
217484
|
}
|
|
217262
217485
|
defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;
|
|
217263
|
-
var normalize3 = options.normalizeLineEndings ||
|
|
217486
|
+
var normalize3 = options.normalizeLineEndings || normalizeLineEndings2;
|
|
217264
217487
|
if (source && typeof source === "string") {
|
|
217265
217488
|
sax2.parse(normalize3(source), defaultNSMap, entityMap);
|
|
217266
217489
|
} else {
|
|
@@ -217423,7 +217646,7 @@ var require_dom_parser = __commonJS((exports) => {
|
|
|
217423
217646
|
}
|
|
217424
217647
|
}
|
|
217425
217648
|
exports.__DOMHandler = DOMHandler;
|
|
217426
|
-
exports.normalizeLineEndings =
|
|
217649
|
+
exports.normalizeLineEndings = normalizeLineEndings2;
|
|
217427
217650
|
exports.DOMParser = DOMParser;
|
|
217428
217651
|
});
|
|
217429
217652
|
|
|
@@ -223832,229 +224055,6 @@ var require_lib13 = __commonJS((exports) => {
|
|
|
223832
224055
|
} });
|
|
223833
224056
|
});
|
|
223834
224057
|
|
|
223835
|
-
// node_modules/.pnpm/react@19.2.4/node_modules/react/cjs/react-jsx-dev-runtime.development.js
|
|
223836
|
-
var require_react_jsx_dev_runtime_development = __commonJS((exports) => {
|
|
223837
|
-
var React19 = __toESM(require_react2());
|
|
223838
|
-
(function() {
|
|
223839
|
-
function getComponentNameFromType2(type) {
|
|
223840
|
-
if (type == null)
|
|
223841
|
-
return null;
|
|
223842
|
-
if (typeof type === "function")
|
|
223843
|
-
return type.$$typeof === REACT_CLIENT_REFERENCE2 ? null : type.displayName || type.name || null;
|
|
223844
|
-
if (typeof type === "string")
|
|
223845
|
-
return type;
|
|
223846
|
-
switch (type) {
|
|
223847
|
-
case REACT_FRAGMENT_TYPE2:
|
|
223848
|
-
return "Fragment";
|
|
223849
|
-
case REACT_PROFILER_TYPE2:
|
|
223850
|
-
return "Profiler";
|
|
223851
|
-
case REACT_STRICT_MODE_TYPE2:
|
|
223852
|
-
return "StrictMode";
|
|
223853
|
-
case REACT_SUSPENSE_TYPE2:
|
|
223854
|
-
return "Suspense";
|
|
223855
|
-
case REACT_SUSPENSE_LIST_TYPE2:
|
|
223856
|
-
return "SuspenseList";
|
|
223857
|
-
case REACT_ACTIVITY_TYPE2:
|
|
223858
|
-
return "Activity";
|
|
223859
|
-
}
|
|
223860
|
-
if (typeof type === "object")
|
|
223861
|
-
switch (typeof type.tag === "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
|
|
223862
|
-
case REACT_PORTAL_TYPE2:
|
|
223863
|
-
return "Portal";
|
|
223864
|
-
case REACT_CONTEXT_TYPE2:
|
|
223865
|
-
return type.displayName || "Context";
|
|
223866
|
-
case REACT_CONSUMER_TYPE2:
|
|
223867
|
-
return (type._context.displayName || "Context") + ".Consumer";
|
|
223868
|
-
case REACT_FORWARD_REF_TYPE2:
|
|
223869
|
-
var innerType = type.render;
|
|
223870
|
-
type = type.displayName;
|
|
223871
|
-
type || (type = innerType.displayName || innerType.name || "", type = type !== "" ? "ForwardRef(" + type + ")" : "ForwardRef");
|
|
223872
|
-
return type;
|
|
223873
|
-
case REACT_MEMO_TYPE2:
|
|
223874
|
-
return innerType = type.displayName || null, innerType !== null ? innerType : getComponentNameFromType2(type.type) || "Memo";
|
|
223875
|
-
case REACT_LAZY_TYPE2:
|
|
223876
|
-
innerType = type._payload;
|
|
223877
|
-
type = type._init;
|
|
223878
|
-
try {
|
|
223879
|
-
return getComponentNameFromType2(type(innerType));
|
|
223880
|
-
} catch (x6) {}
|
|
223881
|
-
}
|
|
223882
|
-
return null;
|
|
223883
|
-
}
|
|
223884
|
-
function testStringCoercion2(value) {
|
|
223885
|
-
return "" + value;
|
|
223886
|
-
}
|
|
223887
|
-
function checkKeyStringCoercion(value) {
|
|
223888
|
-
try {
|
|
223889
|
-
testStringCoercion2(value);
|
|
223890
|
-
var JSCompiler_inline_result = false;
|
|
223891
|
-
} catch (e6) {
|
|
223892
|
-
JSCompiler_inline_result = true;
|
|
223893
|
-
}
|
|
223894
|
-
if (JSCompiler_inline_result) {
|
|
223895
|
-
JSCompiler_inline_result = console;
|
|
223896
|
-
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
223897
|
-
var JSCompiler_inline_result$jscomp$0 = typeof Symbol === "function" && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
223898
|
-
JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
|
|
223899
|
-
return testStringCoercion2(value);
|
|
223900
|
-
}
|
|
223901
|
-
}
|
|
223902
|
-
function getTaskName(type) {
|
|
223903
|
-
if (type === REACT_FRAGMENT_TYPE2)
|
|
223904
|
-
return "<>";
|
|
223905
|
-
if (typeof type === "object" && type !== null && type.$$typeof === REACT_LAZY_TYPE2)
|
|
223906
|
-
return "<...>";
|
|
223907
|
-
try {
|
|
223908
|
-
var name2 = getComponentNameFromType2(type);
|
|
223909
|
-
return name2 ? "<" + name2 + ">" : "<...>";
|
|
223910
|
-
} catch (x6) {
|
|
223911
|
-
return "<...>";
|
|
223912
|
-
}
|
|
223913
|
-
}
|
|
223914
|
-
function getOwner() {
|
|
223915
|
-
var dispatcher = ReactSharedInternals2.A;
|
|
223916
|
-
return dispatcher === null ? null : dispatcher.getOwner();
|
|
223917
|
-
}
|
|
223918
|
-
function UnknownOwner() {
|
|
223919
|
-
return Error("react-stack-top-frame");
|
|
223920
|
-
}
|
|
223921
|
-
function hasValidKey(config) {
|
|
223922
|
-
if (hasOwnProperty2.call(config, "key")) {
|
|
223923
|
-
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
223924
|
-
if (getter && getter.isReactWarning)
|
|
223925
|
-
return false;
|
|
223926
|
-
}
|
|
223927
|
-
return config.key !== undefined;
|
|
223928
|
-
}
|
|
223929
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
223930
|
-
function warnAboutAccessingKey() {
|
|
223931
|
-
specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error("%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)", displayName));
|
|
223932
|
-
}
|
|
223933
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
223934
|
-
Object.defineProperty(props, "key", {
|
|
223935
|
-
get: warnAboutAccessingKey,
|
|
223936
|
-
configurable: true
|
|
223937
|
-
});
|
|
223938
|
-
}
|
|
223939
|
-
function elementRefGetterWithDeprecationWarning() {
|
|
223940
|
-
var componentName = getComponentNameFromType2(this.type);
|
|
223941
|
-
didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error("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."));
|
|
223942
|
-
componentName = this.props.ref;
|
|
223943
|
-
return componentName !== undefined ? componentName : null;
|
|
223944
|
-
}
|
|
223945
|
-
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
223946
|
-
var refProp = props.ref;
|
|
223947
|
-
type = {
|
|
223948
|
-
$$typeof: REACT_ELEMENT_TYPE2,
|
|
223949
|
-
type,
|
|
223950
|
-
key,
|
|
223951
|
-
props,
|
|
223952
|
-
_owner: owner
|
|
223953
|
-
};
|
|
223954
|
-
(refProp !== undefined ? refProp : null) !== null ? Object.defineProperty(type, "ref", {
|
|
223955
|
-
enumerable: false,
|
|
223956
|
-
get: elementRefGetterWithDeprecationWarning
|
|
223957
|
-
}) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
|
|
223958
|
-
type._store = {};
|
|
223959
|
-
Object.defineProperty(type._store, "validated", {
|
|
223960
|
-
configurable: false,
|
|
223961
|
-
enumerable: false,
|
|
223962
|
-
writable: true,
|
|
223963
|
-
value: 0
|
|
223964
|
-
});
|
|
223965
|
-
Object.defineProperty(type, "_debugInfo", {
|
|
223966
|
-
configurable: false,
|
|
223967
|
-
enumerable: false,
|
|
223968
|
-
writable: true,
|
|
223969
|
-
value: null
|
|
223970
|
-
});
|
|
223971
|
-
Object.defineProperty(type, "_debugStack", {
|
|
223972
|
-
configurable: false,
|
|
223973
|
-
enumerable: false,
|
|
223974
|
-
writable: true,
|
|
223975
|
-
value: debugStack
|
|
223976
|
-
});
|
|
223977
|
-
Object.defineProperty(type, "_debugTask", {
|
|
223978
|
-
configurable: false,
|
|
223979
|
-
enumerable: false,
|
|
223980
|
-
writable: true,
|
|
223981
|
-
value: debugTask
|
|
223982
|
-
});
|
|
223983
|
-
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
223984
|
-
return type;
|
|
223985
|
-
}
|
|
223986
|
-
function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) {
|
|
223987
|
-
var children2 = config.children;
|
|
223988
|
-
if (children2 !== undefined)
|
|
223989
|
-
if (isStaticChildren)
|
|
223990
|
-
if (isArrayImpl2(children2)) {
|
|
223991
|
-
for (isStaticChildren = 0;isStaticChildren < children2.length; isStaticChildren++)
|
|
223992
|
-
validateChildKeys(children2[isStaticChildren]);
|
|
223993
|
-
Object.freeze && Object.freeze(children2);
|
|
223994
|
-
} else
|
|
223995
|
-
console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
223996
|
-
else
|
|
223997
|
-
validateChildKeys(children2);
|
|
223998
|
-
if (hasOwnProperty2.call(config, "key")) {
|
|
223999
|
-
children2 = getComponentNameFromType2(type);
|
|
224000
|
-
var keys = Object.keys(config).filter(function(k7) {
|
|
224001
|
-
return k7 !== "key";
|
|
224002
|
-
});
|
|
224003
|
-
isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
224004
|
-
didWarnAboutKeySpread[children2 + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
224005
|
-
let props = %s;
|
|
224006
|
-
<%s {...props} />
|
|
224007
|
-
React keys must be passed directly to JSX without using spread:
|
|
224008
|
-
let props = %s;
|
|
224009
|
-
<%s key={someKey} {...props} />`, isStaticChildren, children2, keys, children2), didWarnAboutKeySpread[children2 + isStaticChildren] = true);
|
|
224010
|
-
}
|
|
224011
|
-
children2 = null;
|
|
224012
|
-
maybeKey !== undefined && (checkKeyStringCoercion(maybeKey), children2 = "" + maybeKey);
|
|
224013
|
-
hasValidKey(config) && (checkKeyStringCoercion(config.key), children2 = "" + config.key);
|
|
224014
|
-
if ("key" in config) {
|
|
224015
|
-
maybeKey = {};
|
|
224016
|
-
for (var propName in config)
|
|
224017
|
-
propName !== "key" && (maybeKey[propName] = config[propName]);
|
|
224018
|
-
} else
|
|
224019
|
-
maybeKey = config;
|
|
224020
|
-
children2 && defineKeyPropWarningGetter(maybeKey, typeof type === "function" ? type.displayName || type.name || "Unknown" : type);
|
|
224021
|
-
return ReactElement(type, children2, maybeKey, getOwner(), debugStack, debugTask);
|
|
224022
|
-
}
|
|
224023
|
-
function validateChildKeys(node2) {
|
|
224024
|
-
isValidElement(node2) ? node2._store && (node2._store.validated = 1) : typeof node2 === "object" && node2 !== null && node2.$$typeof === REACT_LAZY_TYPE2 && (node2._payload.status === "fulfilled" ? isValidElement(node2._payload.value) && node2._payload.value._store && (node2._payload.value._store.validated = 1) : node2._store && (node2._store.validated = 1));
|
|
224025
|
-
}
|
|
224026
|
-
function isValidElement(object) {
|
|
224027
|
-
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE2;
|
|
224028
|
-
}
|
|
224029
|
-
var REACT_ELEMENT_TYPE2 = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE2 = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE2 = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE2 = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE2 = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE2 = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE2 = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE2 = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE2 = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE2 = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE2 = Symbol.for("react.memo"), REACT_LAZY_TYPE2 = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE2 = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE2 = Symbol.for("react.client.reference"), ReactSharedInternals2 = React19.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty2 = Object.prototype.hasOwnProperty, isArrayImpl2 = Array.isArray, createTask = console.createTask ? console.createTask : function() {
|
|
224030
|
-
return null;
|
|
224031
|
-
};
|
|
224032
|
-
React19 = {
|
|
224033
|
-
react_stack_bottom_frame: function(callStackForError) {
|
|
224034
|
-
return callStackForError();
|
|
224035
|
-
}
|
|
224036
|
-
};
|
|
224037
|
-
var specialPropKeyWarningShown;
|
|
224038
|
-
var didWarnAboutElementRef = {};
|
|
224039
|
-
var unknownOwnerDebugStack = React19.react_stack_bottom_frame.bind(React19, UnknownOwner)();
|
|
224040
|
-
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
224041
|
-
var didWarnAboutKeySpread = {};
|
|
224042
|
-
exports.Fragment = REACT_FRAGMENT_TYPE2;
|
|
224043
|
-
exports.jsxDEV = function(type, config, maybeKey, isStaticChildren) {
|
|
224044
|
-
var trackActualOwner = 1e4 > ReactSharedInternals2.recentlyCreatedOwnerStacks++;
|
|
224045
|
-
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
224046
|
-
};
|
|
224047
|
-
})();
|
|
224048
|
-
});
|
|
224049
|
-
|
|
224050
|
-
// node_modules/.pnpm/react@19.2.4/node_modules/react/jsx-dev-runtime.js
|
|
224051
|
-
var require_jsx_dev_runtime = __commonJS((exports, module) => {
|
|
224052
|
-
var react_jsx_dev_runtime_development = __toESM(require_react_jsx_dev_runtime_development());
|
|
224053
|
-
if (false) {} else {
|
|
224054
|
-
module.exports = react_jsx_dev_runtime_development;
|
|
224055
|
-
}
|
|
224056
|
-
});
|
|
224057
|
-
|
|
224058
224058
|
// node_modules/.pnpm/cli-spinners@2.9.2/node_modules/cli-spinners/spinners.json
|
|
224059
224059
|
var require_spinners = __commonJS((exports, module) => {
|
|
224060
224060
|
module.exports = {
|
|
@@ -231563,1239 +231563,6 @@ var measureElement = (node2) => ({
|
|
|
231563
231563
|
height: node2.yogaNode?.getComputedHeight() ?? 0
|
|
231564
231564
|
});
|
|
231565
231565
|
var measure_element_default = measureElement;
|
|
231566
|
-
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/index.js
|
|
231567
|
-
var import_react35 = __toESM(require_react2(), 1);
|
|
231568
|
-
|
|
231569
|
-
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/Ascii.js
|
|
231570
|
-
var import_react28 = __toESM(require_react2(), 1);
|
|
231571
|
-
|
|
231572
|
-
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/utils/image.js
|
|
231573
|
-
var import_sharp = __toESM(require_lib10(), 1);
|
|
231574
|
-
import fetch2 from "node-fetch";
|
|
231575
|
-
async function fetchImage(src) {
|
|
231576
|
-
try {
|
|
231577
|
-
let imageBuffer;
|
|
231578
|
-
if (src.startsWith("http")) {
|
|
231579
|
-
const response = await fetch2(src);
|
|
231580
|
-
if (!response.ok) {
|
|
231581
|
-
throw new Error(`Failed to fetch image: ${response.statusText}`);
|
|
231582
|
-
}
|
|
231583
|
-
imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
231584
|
-
} else {
|
|
231585
|
-
imageBuffer = await import_sharp.default(src).toBuffer();
|
|
231586
|
-
}
|
|
231587
|
-
return import_sharp.default(imageBuffer);
|
|
231588
|
-
} catch {
|
|
231589
|
-
return;
|
|
231590
|
-
}
|
|
231591
|
-
}
|
|
231592
|
-
function calculateImageSize({ maxWidth, maxHeight, originalAspectRatio, specifiedWidth, specifiedHeight }) {
|
|
231593
|
-
if (specifiedWidth && specifiedHeight) {
|
|
231594
|
-
const width2 = Math.min(specifiedWidth, maxWidth);
|
|
231595
|
-
const height2 = Math.min(specifiedHeight, maxHeight);
|
|
231596
|
-
return { width: Math.round(width2), height: Math.round(height2) };
|
|
231597
|
-
}
|
|
231598
|
-
if (specifiedWidth) {
|
|
231599
|
-
let width2 = Math.min(specifiedWidth, maxWidth);
|
|
231600
|
-
let height2 = width2 / originalAspectRatio;
|
|
231601
|
-
if (height2 > maxHeight) {
|
|
231602
|
-
height2 = maxHeight;
|
|
231603
|
-
width2 = height2 * originalAspectRatio;
|
|
231604
|
-
}
|
|
231605
|
-
return { width: Math.round(width2), height: Math.round(height2) };
|
|
231606
|
-
}
|
|
231607
|
-
if (specifiedHeight) {
|
|
231608
|
-
let height2 = Math.min(specifiedHeight, maxHeight);
|
|
231609
|
-
let width2 = height2 * originalAspectRatio;
|
|
231610
|
-
if (width2 > maxWidth) {
|
|
231611
|
-
width2 = maxWidth;
|
|
231612
|
-
height2 = width2 / originalAspectRatio;
|
|
231613
|
-
}
|
|
231614
|
-
return { width: Math.round(width2), height: Math.round(height2) };
|
|
231615
|
-
}
|
|
231616
|
-
let height = maxHeight;
|
|
231617
|
-
let width = height * originalAspectRatio;
|
|
231618
|
-
if (width > maxWidth) {
|
|
231619
|
-
width = maxWidth;
|
|
231620
|
-
height = width / originalAspectRatio;
|
|
231621
|
-
}
|
|
231622
|
-
if (height > maxHeight) {
|
|
231623
|
-
height = maxHeight;
|
|
231624
|
-
width = height * originalAspectRatio;
|
|
231625
|
-
}
|
|
231626
|
-
return { width: Math.round(width), height: Math.round(height) };
|
|
231627
|
-
}
|
|
231628
|
-
|
|
231629
|
-
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/context/TerminalInfo.js
|
|
231630
|
-
var import_react27 = __toESM(require_react2(), 1);
|
|
231631
|
-
|
|
231632
|
-
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/utils/queryEscapeSequence.js
|
|
231633
|
-
function queryEscapeSequence(message, stdin, stdout, setRawMode) {
|
|
231634
|
-
return new Promise((resolve5) => {
|
|
231635
|
-
const responseTimeout = 100;
|
|
231636
|
-
let responseTimeoutId = undefined;
|
|
231637
|
-
const timeoutBetweenReplies = 50;
|
|
231638
|
-
let timeoutBetweenRepliesId = undefined;
|
|
231639
|
-
let runningReply = "";
|
|
231640
|
-
setRawMode(true);
|
|
231641
|
-
const restoreState = () => {
|
|
231642
|
-
setRawMode(false);
|
|
231643
|
-
stdin.removeListener("data", onData);
|
|
231644
|
-
stdin.removeListener("close", onClose);
|
|
231645
|
-
if (responseTimeoutId !== undefined) {
|
|
231646
|
-
clearTimeout(responseTimeoutId);
|
|
231647
|
-
}
|
|
231648
|
-
if (timeoutBetweenRepliesId !== undefined) {
|
|
231649
|
-
clearTimeout(timeoutBetweenRepliesId);
|
|
231650
|
-
}
|
|
231651
|
-
};
|
|
231652
|
-
const onData = (data) => {
|
|
231653
|
-
if (responseTimeoutId !== undefined) {
|
|
231654
|
-
clearTimeout(responseTimeoutId);
|
|
231655
|
-
}
|
|
231656
|
-
if (timeoutBetweenRepliesId !== undefined) {
|
|
231657
|
-
clearTimeout(timeoutBetweenRepliesId);
|
|
231658
|
-
}
|
|
231659
|
-
runningReply += data;
|
|
231660
|
-
timeoutBetweenRepliesId = setTimeout(() => {
|
|
231661
|
-
restoreState();
|
|
231662
|
-
resolve5(runningReply.length > 0 ? runningReply : undefined);
|
|
231663
|
-
}, timeoutBetweenReplies);
|
|
231664
|
-
};
|
|
231665
|
-
const onClose = () => {
|
|
231666
|
-
restoreState();
|
|
231667
|
-
resolve5(runningReply.length > 0 ? runningReply : undefined);
|
|
231668
|
-
};
|
|
231669
|
-
stdin.on("data", onData);
|
|
231670
|
-
stdin.on("close", onClose);
|
|
231671
|
-
responseTimeoutId = setTimeout(() => {
|
|
231672
|
-
restoreState();
|
|
231673
|
-
resolve5(undefined);
|
|
231674
|
-
}, responseTimeout);
|
|
231675
|
-
stdout.write(message);
|
|
231676
|
-
});
|
|
231677
|
-
}
|
|
231678
|
-
var queryEscapeSequence_default = queryEscapeSequence;
|
|
231679
|
-
|
|
231680
|
-
// node_modules/.pnpm/supports-color@10.2.2/node_modules/supports-color/index.js
|
|
231681
|
-
import process14 from "process";
|
|
231682
|
-
import os4 from "os";
|
|
231683
|
-
import tty2 from "tty";
|
|
231684
|
-
function hasFlag2(flag, argv = globalThis.Deno ? globalThis.Deno.args : process14.argv) {
|
|
231685
|
-
const prefix2 = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
231686
|
-
const position = argv.indexOf(prefix2 + flag);
|
|
231687
|
-
const terminatorPosition = argv.indexOf("--");
|
|
231688
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
231689
|
-
}
|
|
231690
|
-
var { env: env4 } = process14;
|
|
231691
|
-
var flagForceColor2;
|
|
231692
|
-
if (hasFlag2("no-color") || hasFlag2("no-colors") || hasFlag2("color=false") || hasFlag2("color=never")) {
|
|
231693
|
-
flagForceColor2 = 0;
|
|
231694
|
-
} else if (hasFlag2("color") || hasFlag2("colors") || hasFlag2("color=true") || hasFlag2("color=always")) {
|
|
231695
|
-
flagForceColor2 = 1;
|
|
231696
|
-
}
|
|
231697
|
-
function envForceColor2() {
|
|
231698
|
-
if (!("FORCE_COLOR" in env4)) {
|
|
231699
|
-
return;
|
|
231700
|
-
}
|
|
231701
|
-
if (env4.FORCE_COLOR === "true") {
|
|
231702
|
-
return 1;
|
|
231703
|
-
}
|
|
231704
|
-
if (env4.FORCE_COLOR === "false") {
|
|
231705
|
-
return 0;
|
|
231706
|
-
}
|
|
231707
|
-
if (env4.FORCE_COLOR.length === 0) {
|
|
231708
|
-
return 1;
|
|
231709
|
-
}
|
|
231710
|
-
const level = Math.min(Number.parseInt(env4.FORCE_COLOR, 10), 3);
|
|
231711
|
-
if (![0, 1, 2, 3].includes(level)) {
|
|
231712
|
-
return;
|
|
231713
|
-
}
|
|
231714
|
-
return level;
|
|
231715
|
-
}
|
|
231716
|
-
function translateLevel2(level) {
|
|
231717
|
-
if (level === 0) {
|
|
231718
|
-
return false;
|
|
231719
|
-
}
|
|
231720
|
-
return {
|
|
231721
|
-
level,
|
|
231722
|
-
hasBasic: true,
|
|
231723
|
-
has256: level >= 2,
|
|
231724
|
-
has16m: level >= 3
|
|
231725
|
-
};
|
|
231726
|
-
}
|
|
231727
|
-
function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
231728
|
-
const noFlagForceColor = envForceColor2();
|
|
231729
|
-
if (noFlagForceColor !== undefined) {
|
|
231730
|
-
flagForceColor2 = noFlagForceColor;
|
|
231731
|
-
}
|
|
231732
|
-
const forceColor = sniffFlags ? flagForceColor2 : noFlagForceColor;
|
|
231733
|
-
if (forceColor === 0) {
|
|
231734
|
-
return 0;
|
|
231735
|
-
}
|
|
231736
|
-
if (sniffFlags) {
|
|
231737
|
-
if (hasFlag2("color=16m") || hasFlag2("color=full") || hasFlag2("color=truecolor")) {
|
|
231738
|
-
return 3;
|
|
231739
|
-
}
|
|
231740
|
-
if (hasFlag2("color=256")) {
|
|
231741
|
-
return 2;
|
|
231742
|
-
}
|
|
231743
|
-
}
|
|
231744
|
-
if ("TF_BUILD" in env4 && "AGENT_NAME" in env4) {
|
|
231745
|
-
return 1;
|
|
231746
|
-
}
|
|
231747
|
-
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
231748
|
-
return 0;
|
|
231749
|
-
}
|
|
231750
|
-
const min = forceColor || 0;
|
|
231751
|
-
if (env4.TERM === "dumb") {
|
|
231752
|
-
return min;
|
|
231753
|
-
}
|
|
231754
|
-
if (process14.platform === "win32") {
|
|
231755
|
-
const osRelease = os4.release().split(".");
|
|
231756
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
231757
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
231758
|
-
}
|
|
231759
|
-
return 1;
|
|
231760
|
-
}
|
|
231761
|
-
if ("CI" in env4) {
|
|
231762
|
-
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => (key in env4))) {
|
|
231763
|
-
return 3;
|
|
231764
|
-
}
|
|
231765
|
-
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign2) => (sign2 in env4)) || env4.CI_NAME === "codeship") {
|
|
231766
|
-
return 1;
|
|
231767
|
-
}
|
|
231768
|
-
return min;
|
|
231769
|
-
}
|
|
231770
|
-
if ("TEAMCITY_VERSION" in env4) {
|
|
231771
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env4.TEAMCITY_VERSION) ? 1 : 0;
|
|
231772
|
-
}
|
|
231773
|
-
if (env4.COLORTERM === "truecolor") {
|
|
231774
|
-
return 3;
|
|
231775
|
-
}
|
|
231776
|
-
if (env4.TERM === "xterm-kitty") {
|
|
231777
|
-
return 3;
|
|
231778
|
-
}
|
|
231779
|
-
if (env4.TERM === "xterm-ghostty") {
|
|
231780
|
-
return 3;
|
|
231781
|
-
}
|
|
231782
|
-
if (env4.TERM === "wezterm") {
|
|
231783
|
-
return 3;
|
|
231784
|
-
}
|
|
231785
|
-
if ("TERM_PROGRAM" in env4) {
|
|
231786
|
-
const version3 = Number.parseInt((env4.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
231787
|
-
switch (env4.TERM_PROGRAM) {
|
|
231788
|
-
case "iTerm.app": {
|
|
231789
|
-
return version3 >= 3 ? 3 : 2;
|
|
231790
|
-
}
|
|
231791
|
-
case "Apple_Terminal": {
|
|
231792
|
-
return 2;
|
|
231793
|
-
}
|
|
231794
|
-
}
|
|
231795
|
-
}
|
|
231796
|
-
if (/-256(color)?$/i.test(env4.TERM)) {
|
|
231797
|
-
return 2;
|
|
231798
|
-
}
|
|
231799
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env4.TERM)) {
|
|
231800
|
-
return 1;
|
|
231801
|
-
}
|
|
231802
|
-
if ("COLORTERM" in env4) {
|
|
231803
|
-
return 1;
|
|
231804
|
-
}
|
|
231805
|
-
return min;
|
|
231806
|
-
}
|
|
231807
|
-
function createSupportsColor2(stream, options = {}) {
|
|
231808
|
-
const level = _supportsColor2(stream, {
|
|
231809
|
-
streamIsTTY: stream && stream.isTTY,
|
|
231810
|
-
...options
|
|
231811
|
-
});
|
|
231812
|
-
return translateLevel2(level);
|
|
231813
|
-
}
|
|
231814
|
-
var supportsColor2 = {
|
|
231815
|
-
stdout: createSupportsColor2({ isTTY: tty2.isatty(1) }),
|
|
231816
|
-
stderr: createSupportsColor2({ isTTY: tty2.isatty(2) })
|
|
231817
|
-
};
|
|
231818
|
-
var supports_color_default2 = supportsColor2;
|
|
231819
|
-
|
|
231820
|
-
// node_modules/.pnpm/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js
|
|
231821
|
-
import process15 from "process";
|
|
231822
|
-
function isUnicodeSupported() {
|
|
231823
|
-
const { env: env5 } = process15;
|
|
231824
|
-
const { TERM, TERM_PROGRAM } = env5;
|
|
231825
|
-
if (process15.platform !== "win32") {
|
|
231826
|
-
return TERM !== "linux";
|
|
231827
|
-
}
|
|
231828
|
-
return Boolean(env5.WT_SESSION) || Boolean(env5.TERMINUS_SUBLIME) || env5.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env5.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
231829
|
-
}
|
|
231830
|
-
|
|
231831
|
-
// node_modules/.pnpm/iterm2-version@5.0.0/node_modules/iterm2-version/index.js
|
|
231832
|
-
import path4 from "path";
|
|
231833
|
-
import fs5 from "fs";
|
|
231834
|
-
|
|
231835
|
-
// node_modules/.pnpm/app-path@4.0.0/node_modules/app-path/index.js
|
|
231836
|
-
var import_execa = __toESM(require_execa(), 1);
|
|
231837
|
-
import { fileURLToPath } from "url";
|
|
231838
|
-
import path3 from "path";
|
|
231839
|
-
var dirname29 = path3.dirname(fileURLToPath(import.meta.url));
|
|
231840
|
-
var improveError = (error3) => {
|
|
231841
|
-
if (error3.exitCode === 2) {
|
|
231842
|
-
error3.message = "Couldn't find the app";
|
|
231843
|
-
}
|
|
231844
|
-
return error3;
|
|
231845
|
-
};
|
|
231846
|
-
async function appPath(appName) {
|
|
231847
|
-
if (process.platform !== "darwin") {
|
|
231848
|
-
throw new Error("macOS only");
|
|
231849
|
-
}
|
|
231850
|
-
if (typeof appName !== "string") {
|
|
231851
|
-
throw new TypeError("Please supply an app name or bundle identifier");
|
|
231852
|
-
}
|
|
231853
|
-
try {
|
|
231854
|
-
const { stdout } = await import_execa.default("./main", [appName], { cwd: dirname29 });
|
|
231855
|
-
return stdout;
|
|
231856
|
-
} catch (error3) {
|
|
231857
|
-
throw improveError(error3);
|
|
231858
|
-
}
|
|
231859
|
-
}
|
|
231860
|
-
appPath.sync = (appName) => {
|
|
231861
|
-
if (process.platform !== "darwin") {
|
|
231862
|
-
throw new Error("macOS only");
|
|
231863
|
-
}
|
|
231864
|
-
if (typeof appName !== "string") {
|
|
231865
|
-
throw new TypeError("Please supply an app name or bundle identifier");
|
|
231866
|
-
}
|
|
231867
|
-
try {
|
|
231868
|
-
return import_execa.default.sync("./main", [appName], { cwd: dirname29 }).stdout;
|
|
231869
|
-
} catch (error3) {
|
|
231870
|
-
throw improveError(error3);
|
|
231871
|
-
}
|
|
231872
|
-
};
|
|
231873
|
-
|
|
231874
|
-
// node_modules/.pnpm/iterm2-version@5.0.0/node_modules/iterm2-version/index.js
|
|
231875
|
-
var import_plist = __toESM(require_plist(), 1);
|
|
231876
|
-
var version3;
|
|
231877
|
-
function iterm2Version() {
|
|
231878
|
-
if (process.platform !== "darwin") {
|
|
231879
|
-
return;
|
|
231880
|
-
}
|
|
231881
|
-
if (!version3) {
|
|
231882
|
-
if (process.env.TERM_PROGRAM === "iTerm.app" && process.env.TERM_PROGRAM_VERSION) {
|
|
231883
|
-
version3 = process.env.TERM_PROGRAM_VERSION;
|
|
231884
|
-
} else {
|
|
231885
|
-
const filePath = path4.join(appPath.sync("iTerm"), "Contents/Info.plist");
|
|
231886
|
-
version3 = import_plist.default.parse(fs5.readFileSync(filePath, "utf8")).CFBundleVersion;
|
|
231887
|
-
}
|
|
231888
|
-
}
|
|
231889
|
-
return version3;
|
|
231890
|
-
}
|
|
231891
|
-
|
|
231892
|
-
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/context/TerminalInfo.js
|
|
231893
|
-
function supportsITerm2(context3) {
|
|
231894
|
-
if (process.env["TERM_PROGRAM"] === "iTerm.app") {
|
|
231895
|
-
const version4 = iterm2Version();
|
|
231896
|
-
if (!version4 || Number(version4[0]) < 3)
|
|
231897
|
-
return false;
|
|
231898
|
-
return true;
|
|
231899
|
-
} else if (process.env["TERM_PROGRAM"] === "WezTerm") {
|
|
231900
|
-
const version4 = process.env["TERM_PROGRAM_VERSION"];
|
|
231901
|
-
if (!version4)
|
|
231902
|
-
return false;
|
|
231903
|
-
const date = parseInt(version4.split("-")[0]);
|
|
231904
|
-
if (!Number.isNaN(date) && date >= 20220319) {
|
|
231905
|
-
return true;
|
|
231906
|
-
}
|
|
231907
|
-
} else if (process.env["KONSOLE_VERSION"]) {
|
|
231908
|
-
const version4 = process.env["KONSOLE_VERSION"];
|
|
231909
|
-
if (!version4)
|
|
231910
|
-
return false;
|
|
231911
|
-
const date = parseInt(version4);
|
|
231912
|
-
if (!Number.isNaN(date) && date >= 220400) {
|
|
231913
|
-
return true;
|
|
231914
|
-
}
|
|
231915
|
-
} else if (process.env["TERM_PROGRAM"] === "rio") {
|
|
231916
|
-
const version4 = process.env["TERM_PROGRAM_VERSION"];
|
|
231917
|
-
if (!version4)
|
|
231918
|
-
return false;
|
|
231919
|
-
const [major, minor, patch] = version4.split(".").map((v7) => parseInt(v7, 10));
|
|
231920
|
-
if (!Number.isNaN(major) && !Number.isNaN(minor) && !Number.isNaN(patch) && (major > 0 || major === 0 && minor > 1 || major === 0 && minor === 1 && patch >= 13)) {
|
|
231921
|
-
return true;
|
|
231922
|
-
}
|
|
231923
|
-
} else if (process.env["TERM_PROGRAM"] === "vscode") {
|
|
231924
|
-
if (context3?.supportsSixelGraphics) {
|
|
231925
|
-
return true;
|
|
231926
|
-
}
|
|
231927
|
-
} else if (process.env["TERM_PROGRAM"] === "WarpTerminal") {
|
|
231928
|
-
const version4 = process.env["TERM_PROGRAM_VERSION"];
|
|
231929
|
-
if (version4) {
|
|
231930
|
-
const [, year, month, day] = version4.slice(1).split(".").map((v7) => parseInt(v7, 10));
|
|
231931
|
-
if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day) && (year > 2025 || year === 2025 && month > 3 || year === 2025 && month === 3 && day >= 5)) {
|
|
231932
|
-
return true;
|
|
231933
|
-
}
|
|
231934
|
-
}
|
|
231935
|
-
}
|
|
231936
|
-
return false;
|
|
231937
|
-
}
|
|
231938
|
-
var TerminalInfoContext = import_react27.createContext(undefined);
|
|
231939
|
-
var TerminalInfoProvider = ({ children: children2 }) => {
|
|
231940
|
-
const { stdin, setRawMode } = use_stdin_default();
|
|
231941
|
-
const { stdout } = use_stdout_default();
|
|
231942
|
-
const [terminalInfo, setTerminalInfo] = import_react27.useState(undefined);
|
|
231943
|
-
import_react27.useEffect(() => {
|
|
231944
|
-
async function getCellPixelDimensions() {
|
|
231945
|
-
try {
|
|
231946
|
-
const cellPixelDimensionsResponse = await queryEscapeSequence_default("\x1B[16t", stdin, stdout, setRawMode);
|
|
231947
|
-
if (!cellPixelDimensionsResponse) {
|
|
231948
|
-
throw new Error;
|
|
231949
|
-
}
|
|
231950
|
-
const parsedResponse = cellPixelDimensionsResponse.match(/\x1b\[6;(\d+);(\d+);?t/);
|
|
231951
|
-
if (!parsedResponse || !parsedResponse[1] || !parsedResponse[2]) {
|
|
231952
|
-
throw new Error;
|
|
231953
|
-
}
|
|
231954
|
-
const height = parseInt(parsedResponse[1], 10);
|
|
231955
|
-
const width = parseInt(parsedResponse[2], 10);
|
|
231956
|
-
if (Number.isNaN(height) || Number.isNaN(width)) {
|
|
231957
|
-
throw new Error;
|
|
231958
|
-
}
|
|
231959
|
-
return {
|
|
231960
|
-
width,
|
|
231961
|
-
height
|
|
231962
|
-
};
|
|
231963
|
-
} catch {
|
|
231964
|
-
const terminalPixelDimensionsResponse = await queryEscapeSequence_default("\x1B[14t", stdin, stdout, setRawMode);
|
|
231965
|
-
if (!terminalPixelDimensionsResponse) {
|
|
231966
|
-
return;
|
|
231967
|
-
}
|
|
231968
|
-
const parsedResponse = terminalPixelDimensionsResponse.match(/\x1b\[4;(\d+);(\d+);?t/);
|
|
231969
|
-
if (!parsedResponse || !parsedResponse[1] || !parsedResponse[2]) {
|
|
231970
|
-
return;
|
|
231971
|
-
}
|
|
231972
|
-
const height = parseInt(parsedResponse[1], 10);
|
|
231973
|
-
const width = parseInt(parsedResponse[2], 10);
|
|
231974
|
-
if (Number.isNaN(height) || Number.isNaN(width)) {
|
|
231975
|
-
return;
|
|
231976
|
-
}
|
|
231977
|
-
return {
|
|
231978
|
-
width: width / process.stdout.columns,
|
|
231979
|
-
height: height / process.stdout.rows
|
|
231980
|
-
};
|
|
231981
|
-
}
|
|
231982
|
-
}
|
|
231983
|
-
const queryTerminalInfo = async () => {
|
|
231984
|
-
let cellDimensions = await getCellPixelDimensions();
|
|
231985
|
-
if (!cellDimensions) {
|
|
231986
|
-
cellDimensions = {
|
|
231987
|
-
width: 6,
|
|
231988
|
-
height: 12
|
|
231989
|
-
};
|
|
231990
|
-
}
|
|
231991
|
-
const supportsUnicode = isUnicodeSupported();
|
|
231992
|
-
const isColorSupported = !!supports_color_default2.stdout;
|
|
231993
|
-
const kittyResponse = await queryEscapeSequence_default("\x1B_Gi=31,s=1,v=1,a=q,t=d,f=24;AAAA\x1B\\ \x1B[c", stdin, stdout, setRawMode);
|
|
231994
|
-
let supportsKittyGraphics = false;
|
|
231995
|
-
if (kittyResponse && kittyResponse.includes("OK")) {
|
|
231996
|
-
supportsKittyGraphics = true;
|
|
231997
|
-
}
|
|
231998
|
-
const deviceAttributesResponse = await queryEscapeSequence_default("\x1B[c", stdin, stdout, setRawMode);
|
|
231999
|
-
let supportsSixelGraphics = false;
|
|
232000
|
-
if (deviceAttributesResponse && deviceAttributesResponse.endsWith("c") && deviceAttributesResponse.slice(0, -1).split(";").find((attr) => attr === "4")) {
|
|
232001
|
-
supportsSixelGraphics = true;
|
|
232002
|
-
}
|
|
232003
|
-
const supportsITerm2Graphics = supportsITerm2({ supportsSixelGraphics });
|
|
232004
|
-
let scale = 1;
|
|
232005
|
-
if (supportsITerm2Graphics) {
|
|
232006
|
-
const reportCellSizeResponse = await queryEscapeSequence_default("\x1B]1337;ReportCellSize\x07", stdin, stdout, setRawMode);
|
|
232007
|
-
if (reportCellSizeResponse) {
|
|
232008
|
-
const match = reportCellSizeResponse.match(/ReportCellSize=([\d.]+);([\d.]+);([\d.]+)/);
|
|
232009
|
-
if (match && match[1] && match[2] && match[3]) {
|
|
232010
|
-
const width = parseFloat(match[2]);
|
|
232011
|
-
const height = parseFloat(match[1]);
|
|
232012
|
-
const parsedScale = parseFloat(match[3]);
|
|
232013
|
-
if (!Number.isNaN(width) && !Number.isNaN(height) && !isNaN(parsedScale)) {
|
|
232014
|
-
cellDimensions = { width, height };
|
|
232015
|
-
scale = parsedScale;
|
|
232016
|
-
}
|
|
232017
|
-
}
|
|
232018
|
-
}
|
|
232019
|
-
}
|
|
232020
|
-
const dimensions = {
|
|
232021
|
-
viewportWidth: cellDimensions.width * scale * process.stdout.columns,
|
|
232022
|
-
viewportHeight: cellDimensions.height * scale * process.stdout.rows,
|
|
232023
|
-
cellWidth: cellDimensions.width * scale,
|
|
232024
|
-
cellHeight: cellDimensions.height * scale
|
|
232025
|
-
};
|
|
232026
|
-
const capabilities2 = {
|
|
232027
|
-
supportsUnicode,
|
|
232028
|
-
supportsColor: isColorSupported,
|
|
232029
|
-
supportsKittyGraphics,
|
|
232030
|
-
supportsSixelGraphics,
|
|
232031
|
-
supportsITerm2Graphics
|
|
232032
|
-
};
|
|
232033
|
-
setTerminalInfo({
|
|
232034
|
-
dimensions,
|
|
232035
|
-
capabilities: capabilities2
|
|
232036
|
-
});
|
|
232037
|
-
};
|
|
232038
|
-
queryTerminalInfo();
|
|
232039
|
-
}, [stdin, stdout, setRawMode]);
|
|
232040
|
-
return import_react27.default.createElement(TerminalInfoContext.Provider, { value: terminalInfo }, terminalInfo ? children2 : null);
|
|
232041
|
-
};
|
|
232042
|
-
var useTerminalInfo = () => {
|
|
232043
|
-
const terminalInfo = import_react27.useContext(TerminalInfoContext);
|
|
232044
|
-
import_react27.useEffect(() => {
|
|
232045
|
-
if (terminalInfo)
|
|
232046
|
-
return;
|
|
232047
|
-
const timeoutId = setTimeout(() => {
|
|
232048
|
-
if (!terminalInfo) {
|
|
232049
|
-
throw new Error(`Terminal info not available. (Did you forget to wrap your component in <TerminalInfoProvider>?)
|
|
232050
|
-
` + "Apps using the `ink-picture` Image component must be wrapped in a <TerminalInfoProvider>.\n" + "See https://github.com/endernoke/ink-picture?tab=readme-ov-file#terminalinfoprovider for details.");
|
|
232051
|
-
}
|
|
232052
|
-
}, 2000);
|
|
232053
|
-
return () => clearTimeout(timeoutId);
|
|
232054
|
-
}, [terminalInfo]);
|
|
232055
|
-
return terminalInfo;
|
|
232056
|
-
};
|
|
232057
|
-
var useTerminalDimensions = () => {
|
|
232058
|
-
const terminalInfo = useTerminalInfo();
|
|
232059
|
-
return terminalInfo?.dimensions;
|
|
232060
|
-
};
|
|
232061
|
-
var useTerminalCapabilities = () => {
|
|
232062
|
-
const terminalInfo = useTerminalInfo();
|
|
232063
|
-
return terminalInfo?.capabilities;
|
|
232064
|
-
};
|
|
232065
|
-
|
|
232066
|
-
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/Ascii.js
|
|
232067
|
-
function AsciiImage(props) {
|
|
232068
|
-
const [imageOutput, setImageOutput] = import_react28.useState(null);
|
|
232069
|
-
const [hasError, setHasError] = import_react28.useState(false);
|
|
232070
|
-
const containerRef = import_react28.useRef(null);
|
|
232071
|
-
const terminalCapabilities = useTerminalCapabilities();
|
|
232072
|
-
const { onSupportDetected, src, width: propsWidth, height: propsHeight } = props;
|
|
232073
|
-
import_react28.useEffect(() => {
|
|
232074
|
-
if (!terminalCapabilities)
|
|
232075
|
-
return;
|
|
232076
|
-
const isSupported = true;
|
|
232077
|
-
onSupportDetected(isSupported);
|
|
232078
|
-
}, [onSupportDetected, terminalCapabilities]);
|
|
232079
|
-
import_react28.useEffect(() => {
|
|
232080
|
-
const generateImageOutput = async () => {
|
|
232081
|
-
const image2 = await fetchImage(src);
|
|
232082
|
-
if (!image2) {
|
|
232083
|
-
setHasError(true);
|
|
232084
|
-
return;
|
|
232085
|
-
}
|
|
232086
|
-
setHasError(false);
|
|
232087
|
-
const metadata = await image2.metadata();
|
|
232088
|
-
if (!containerRef.current)
|
|
232089
|
-
return;
|
|
232090
|
-
const { width: maxWidth, height: maxHeight } = measure_element_default(containerRef.current);
|
|
232091
|
-
const { width, height } = calculateImageSize({
|
|
232092
|
-
maxWidth,
|
|
232093
|
-
maxHeight,
|
|
232094
|
-
originalAspectRatio: metadata.width / (metadata.height / 2),
|
|
232095
|
-
specifiedWidth: propsWidth,
|
|
232096
|
-
specifiedHeight: propsHeight ? propsHeight / 2 : undefined
|
|
232097
|
-
});
|
|
232098
|
-
const resizedImage = await image2.resize(width, height, { fit: "fill" }).raw().toBuffer({ resolveWithObject: true });
|
|
232099
|
-
const output = await toAscii(resizedImage, terminalCapabilities?.supportsColor);
|
|
232100
|
-
setImageOutput(output);
|
|
232101
|
-
};
|
|
232102
|
-
generateImageOutput();
|
|
232103
|
-
}, [src, propsWidth, propsHeight, terminalCapabilities]);
|
|
232104
|
-
return import_react28.default.createElement(Box_default, { ref: containerRef, flexDirection: "column", flexGrow: 1 }, imageOutput ? imageOutput.split(`
|
|
232105
|
-
`).map((line, index) => import_react28.default.createElement(Text3, { key: index }, line)) : import_react28.default.createElement(Box_default, { flexDirection: "column", alignItems: "center", justifyContent: "center" }, hasError && import_react28.default.createElement(Text3, { color: "red" }, "X", import_react28.default.createElement(Newline, null), "Load failed"), import_react28.default.createElement(Text3, { color: "gray" }, props.alt || "Loading...")));
|
|
232106
|
-
}
|
|
232107
|
-
async function toAscii(imageData, colored = true) {
|
|
232108
|
-
const { data, info } = imageData;
|
|
232109
|
-
const { width, height, channels: channels2 } = info;
|
|
232110
|
-
const ascii_chars = "$@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\\|()1{}[]?-_+~<>i!lI;:,\"^`'. ";
|
|
232111
|
-
let result = "";
|
|
232112
|
-
for (let y4 = 0;y4 < height; y4++) {
|
|
232113
|
-
for (let x6 = 0;x6 < width; x6++) {
|
|
232114
|
-
const pixelIndex = (y4 * width + x6) * channels2;
|
|
232115
|
-
const r6 = data[pixelIndex];
|
|
232116
|
-
const g5 = data[pixelIndex + 1];
|
|
232117
|
-
const b8 = data[pixelIndex + 2];
|
|
232118
|
-
const a5 = channels2 === 4 ? data[pixelIndex + 3] : 255;
|
|
232119
|
-
const intensity = r6 + g5 + b8 + a5 == 0 ? 0 : (r6 + g5 + b8 + a5) / (255 * 4);
|
|
232120
|
-
const pixel_char = ascii_chars[ascii_chars.length - 1 - Math.floor(intensity * (ascii_chars.length - 1))];
|
|
232121
|
-
result += colored ? source_default.rgb(r6, g5, b8)(pixel_char) : pixel_char;
|
|
232122
|
-
}
|
|
232123
|
-
result += `
|
|
232124
|
-
`;
|
|
232125
|
-
}
|
|
232126
|
-
return result;
|
|
232127
|
-
}
|
|
232128
|
-
var Ascii_default = AsciiImage;
|
|
232129
|
-
|
|
232130
|
-
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/HalfBlock.js
|
|
232131
|
-
var import_react29 = __toESM(require_react2(), 1);
|
|
232132
|
-
function HalfBlockImage(props) {
|
|
232133
|
-
const [imageOutput, setImageOutput] = import_react29.useState(null);
|
|
232134
|
-
const [hasError, setHasError] = import_react29.useState(false);
|
|
232135
|
-
const containerRef = import_react29.useRef(null);
|
|
232136
|
-
const terminalCapabilities = useTerminalCapabilities();
|
|
232137
|
-
const { onSupportDetected, src, width: propsWidth, height: propsHeight } = props;
|
|
232138
|
-
import_react29.useEffect(() => {
|
|
232139
|
-
if (!terminalCapabilities)
|
|
232140
|
-
return;
|
|
232141
|
-
const isSupported = terminalCapabilities.supportsColor && terminalCapabilities.supportsUnicode;
|
|
232142
|
-
onSupportDetected?.(isSupported);
|
|
232143
|
-
}, [onSupportDetected, terminalCapabilities]);
|
|
232144
|
-
import_react29.useEffect(() => {
|
|
232145
|
-
const generateImageOutput = async () => {
|
|
232146
|
-
const image2 = await fetchImage(src);
|
|
232147
|
-
if (!image2) {
|
|
232148
|
-
setHasError(true);
|
|
232149
|
-
return;
|
|
232150
|
-
}
|
|
232151
|
-
setHasError(false);
|
|
232152
|
-
const metadata = await image2.metadata();
|
|
232153
|
-
if (!containerRef.current)
|
|
232154
|
-
return;
|
|
232155
|
-
const { width: maxWidth, height: maxHeight } = measure_element_default(containerRef.current);
|
|
232156
|
-
const { width, height } = calculateImageSize({
|
|
232157
|
-
maxWidth,
|
|
232158
|
-
maxHeight: maxHeight * 2,
|
|
232159
|
-
originalAspectRatio: metadata.width / metadata.height,
|
|
232160
|
-
specifiedWidth: propsWidth,
|
|
232161
|
-
specifiedHeight: propsHeight ? propsHeight * 2 : undefined
|
|
232162
|
-
});
|
|
232163
|
-
const resizedImage = await image2.resize(width, height).raw().toBuffer({ resolveWithObject: true });
|
|
232164
|
-
const output = await toHalfBlocks(resizedImage);
|
|
232165
|
-
setImageOutput(output);
|
|
232166
|
-
};
|
|
232167
|
-
generateImageOutput();
|
|
232168
|
-
}, [src, propsWidth, propsHeight]);
|
|
232169
|
-
return import_react29.default.createElement(Box_default, { ref: containerRef, flexDirection: "column", flexGrow: 1 }, imageOutput ? imageOutput.split(`
|
|
232170
|
-
`).map((line, index) => import_react29.default.createElement(Text3, { key: index }, line)) : import_react29.default.createElement(Box_default, { flexDirection: "column", alignItems: "center", justifyContent: "center" }, hasError && import_react29.default.createElement(Text3, { color: "red" }, "X", import_react29.default.createElement(Newline, null), "Load failed"), import_react29.default.createElement(Text3, { color: "gray" }, props.alt || "Loading...")));
|
|
232171
|
-
}
|
|
232172
|
-
var HALF_BLOCK = "\u2584";
|
|
232173
|
-
async function toHalfBlocks(imageData) {
|
|
232174
|
-
const { data, info } = imageData;
|
|
232175
|
-
const { width, height, channels: channels2 } = info;
|
|
232176
|
-
let result = "";
|
|
232177
|
-
for (let y4 = 0;y4 < height - 1; y4 += 2) {
|
|
232178
|
-
for (let x6 = 0;x6 < width; x6++) {
|
|
232179
|
-
const topPixelIndex = (y4 * width + x6) * channels2;
|
|
232180
|
-
const bottomPixelIndex = ((y4 + 1) * width + x6) * channels2;
|
|
232181
|
-
const r6 = data[topPixelIndex];
|
|
232182
|
-
const g5 = data[topPixelIndex + 1];
|
|
232183
|
-
const b8 = data[topPixelIndex + 2];
|
|
232184
|
-
const a5 = channels2 === 4 ? data[topPixelIndex + 3] : 255;
|
|
232185
|
-
const r22 = data[bottomPixelIndex];
|
|
232186
|
-
const g22 = data[bottomPixelIndex + 1];
|
|
232187
|
-
const b22 = data[bottomPixelIndex + 2];
|
|
232188
|
-
result += a5 === 0 ? source_default.reset(" ") : source_default.bgRgb(r6, g5, b8).rgb(r22, g22, b22)(HALF_BLOCK);
|
|
232189
|
-
}
|
|
232190
|
-
result += `
|
|
232191
|
-
`;
|
|
232192
|
-
}
|
|
232193
|
-
return result;
|
|
232194
|
-
}
|
|
232195
|
-
var HalfBlock_default = HalfBlockImage;
|
|
232196
|
-
|
|
232197
|
-
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/Braille.js
|
|
232198
|
-
var import_react30 = __toESM(require_react2(), 1);
|
|
232199
|
-
function BrailleImage(props) {
|
|
232200
|
-
const [imageOutput, setImageOutput] = import_react30.useState(null);
|
|
232201
|
-
const [hasError, setHasError] = import_react30.useState(false);
|
|
232202
|
-
const containerRef = import_react30.useRef(null);
|
|
232203
|
-
const terminalCapabilities = useTerminalCapabilities();
|
|
232204
|
-
const { onSupportDetected, src, width: propsWidth, height: propsHeight } = props;
|
|
232205
|
-
import_react30.useEffect(() => {
|
|
232206
|
-
if (!terminalCapabilities)
|
|
232207
|
-
return;
|
|
232208
|
-
const isSupported = terminalCapabilities.supportsUnicode;
|
|
232209
|
-
onSupportDetected?.(isSupported);
|
|
232210
|
-
}, [terminalCapabilities, onSupportDetected]);
|
|
232211
|
-
import_react30.useEffect(() => {
|
|
232212
|
-
const generateImageOutput = async () => {
|
|
232213
|
-
const image2 = await fetchImage(src);
|
|
232214
|
-
if (!image2) {
|
|
232215
|
-
setHasError(true);
|
|
232216
|
-
return;
|
|
232217
|
-
}
|
|
232218
|
-
setHasError(false);
|
|
232219
|
-
const metadata = await image2.metadata();
|
|
232220
|
-
if (!containerRef.current)
|
|
232221
|
-
return;
|
|
232222
|
-
const { width: maxWidth, height: maxHeight } = measure_element_default(containerRef.current);
|
|
232223
|
-
const { width, height } = calculateImageSize({
|
|
232224
|
-
maxWidth: maxWidth * 2,
|
|
232225
|
-
maxHeight: maxHeight * 4,
|
|
232226
|
-
originalAspectRatio: metadata.width / metadata.height,
|
|
232227
|
-
specifiedWidth: propsWidth ? propsWidth * 2 : undefined,
|
|
232228
|
-
specifiedHeight: propsHeight ? propsHeight * 4 : undefined
|
|
232229
|
-
});
|
|
232230
|
-
const resizedImage = await image2.resize(width, height).raw().toBuffer({ resolveWithObject: true });
|
|
232231
|
-
const output = await toBraille(resizedImage);
|
|
232232
|
-
setImageOutput(output);
|
|
232233
|
-
};
|
|
232234
|
-
generateImageOutput();
|
|
232235
|
-
}, [src, propsWidth, propsHeight]);
|
|
232236
|
-
return import_react30.default.createElement(Box_default, { ref: containerRef, flexDirection: "column", flexGrow: 1 }, imageOutput ? imageOutput.split(`
|
|
232237
|
-
`).map((line, index) => import_react30.default.createElement(Text3, { key: index }, line)) : import_react30.default.createElement(Box_default, { flexDirection: "column", alignItems: "center", justifyContent: "center" }, hasError && import_react30.default.createElement(Text3, { color: "red" }, "X", import_react30.default.createElement(Newline, null), "Load failed"), import_react30.default.createElement(Text3, { color: "gray" }, props.alt || "Loading...")));
|
|
232238
|
-
}
|
|
232239
|
-
async function toBraille(imageData) {
|
|
232240
|
-
const { data, info } = imageData;
|
|
232241
|
-
const { width, height, channels: channels2 } = info;
|
|
232242
|
-
let result = "";
|
|
232243
|
-
for (let y4 = 0;y4 < height - 3; y4 += 4) {
|
|
232244
|
-
for (let x6 = 0;x6 < width - 1; x6 += 2) {
|
|
232245
|
-
const dot1Index = (y4 * width + x6) * channels2;
|
|
232246
|
-
const dot2Index = ((y4 + 1) * width + x6) * channels2;
|
|
232247
|
-
const dot3Index = ((y4 + 2) * width + x6) * channels2;
|
|
232248
|
-
const dot4Index = (y4 * width + x6 + 1) * channels2;
|
|
232249
|
-
const dot5Index = ((y4 + 1) * width + x6 + 1) * channels2;
|
|
232250
|
-
const dot6Index = ((y4 + 2) * width + x6 + 1) * channels2;
|
|
232251
|
-
const dot7Index = ((y4 + 3) * width + x6) * channels2;
|
|
232252
|
-
const dot8Index = ((y4 + 3) * width + x6 + 1) * channels2;
|
|
232253
|
-
const getRgba = (index) => {
|
|
232254
|
-
const r6 = data[index];
|
|
232255
|
-
const g5 = data[index + 1];
|
|
232256
|
-
const b8 = data[index + 2];
|
|
232257
|
-
const a5 = channels2 === 4 ? data[index + 3] : 1;
|
|
232258
|
-
return { r: r6, g: g5, b: b8, a: a5 };
|
|
232259
|
-
};
|
|
232260
|
-
const dot1 = rgbaToBlackOrWhite(getRgba(dot1Index));
|
|
232261
|
-
const dot2 = rgbaToBlackOrWhite(getRgba(dot2Index));
|
|
232262
|
-
const dot3 = rgbaToBlackOrWhite(getRgba(dot3Index));
|
|
232263
|
-
const dot4 = rgbaToBlackOrWhite(getRgba(dot4Index));
|
|
232264
|
-
const dot5 = rgbaToBlackOrWhite(getRgba(dot5Index));
|
|
232265
|
-
const dot6 = rgbaToBlackOrWhite(getRgba(dot6Index));
|
|
232266
|
-
const dot7 = rgbaToBlackOrWhite(getRgba(dot7Index));
|
|
232267
|
-
const dot8 = rgbaToBlackOrWhite(getRgba(dot8Index));
|
|
232268
|
-
const brailleChar = String.fromCharCode(10240 + (dot8 << 7) + (dot7 << 6) + (dot6 << 5) + (dot5 << 4) + (dot4 << 3) + (dot3 << 2) + (dot2 << 1) + dot1);
|
|
232269
|
-
result += brailleChar;
|
|
232270
|
-
}
|
|
232271
|
-
result += `
|
|
232272
|
-
`;
|
|
232273
|
-
}
|
|
232274
|
-
return result;
|
|
232275
|
-
}
|
|
232276
|
-
function rgbaToBlackOrWhite({ r: r6, g: g5, b: b8, a: a5 }) {
|
|
232277
|
-
const red = r6;
|
|
232278
|
-
const green = g5;
|
|
232279
|
-
const blue = b8;
|
|
232280
|
-
const alpha = a5;
|
|
232281
|
-
const luminance = 0.2126 * red + 0.7152 * green + 0.0722 * blue;
|
|
232282
|
-
const alphaAdjustedLuminance = luminance * alpha + 255 * (1 - alpha);
|
|
232283
|
-
if (alphaAdjustedLuminance > 128) {
|
|
232284
|
-
return 1;
|
|
232285
|
-
} else {
|
|
232286
|
-
return 0;
|
|
232287
|
-
}
|
|
232288
|
-
}
|
|
232289
|
-
var Braille_default = BrailleImage;
|
|
232290
|
-
|
|
232291
|
-
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/Sixel.js
|
|
232292
|
-
var import_react32 = __toESM(require_react2(), 1);
|
|
232293
|
-
var import_sixel = __toESM(require_lib13(), 1);
|
|
232294
|
-
|
|
232295
|
-
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/hooks/usePosition.js
|
|
232296
|
-
var import_react31 = __toESM(require_react2(), 1);
|
|
232297
|
-
var usePosition = (ref) => {
|
|
232298
|
-
const [position, setPosition] = import_react31.useState(undefined);
|
|
232299
|
-
const updatePosition = import_react31.useCallback(() => {
|
|
232300
|
-
if (!ref.current?.yogaNode) {
|
|
232301
|
-
return;
|
|
232302
|
-
}
|
|
232303
|
-
const { current: node2 } = ref;
|
|
232304
|
-
const { yogaNode } = node2;
|
|
232305
|
-
let absoluteCol = 0;
|
|
232306
|
-
let absoluteRow = 0;
|
|
232307
|
-
let appWidth = 0;
|
|
232308
|
-
let appHeight = 0;
|
|
232309
|
-
let currentNode = node2;
|
|
232310
|
-
while (currentNode) {
|
|
232311
|
-
if (currentNode.yogaNode) {
|
|
232312
|
-
absoluteCol += currentNode.yogaNode.getComputedLeft();
|
|
232313
|
-
absoluteRow += currentNode.yogaNode.getComputedTop();
|
|
232314
|
-
appWidth = currentNode.yogaNode.getComputedWidth();
|
|
232315
|
-
appHeight = currentNode.yogaNode.getComputedHeight();
|
|
232316
|
-
}
|
|
232317
|
-
currentNode = currentNode.parentNode;
|
|
232318
|
-
}
|
|
232319
|
-
const newPosition = {
|
|
232320
|
-
col: absoluteCol,
|
|
232321
|
-
row: absoluteRow,
|
|
232322
|
-
width: yogaNode.getComputedWidth(),
|
|
232323
|
-
height: yogaNode.getComputedHeight(),
|
|
232324
|
-
appWidth,
|
|
232325
|
-
appHeight
|
|
232326
|
-
};
|
|
232327
|
-
setPosition((previousPosition) => {
|
|
232328
|
-
if (!previousPosition || previousPosition.col !== newPosition.col || previousPosition.row !== newPosition.row || previousPosition.width !== newPosition.width || previousPosition.height !== newPosition.height || previousPosition.appWidth !== newPosition.appWidth || previousPosition.appHeight !== newPosition.appHeight) {
|
|
232329
|
-
return newPosition;
|
|
232330
|
-
}
|
|
232331
|
-
return previousPosition;
|
|
232332
|
-
});
|
|
232333
|
-
}, [ref]);
|
|
232334
|
-
import_react31.useEffect(() => {
|
|
232335
|
-
updatePosition();
|
|
232336
|
-
});
|
|
232337
|
-
return position;
|
|
232338
|
-
};
|
|
232339
|
-
var usePosition_default = usePosition;
|
|
232340
|
-
|
|
232341
|
-
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/Sixel.js
|
|
232342
|
-
function SixelImage(props) {
|
|
232343
|
-
const [imageOutput, setImageOutput] = import_react32.useState(undefined);
|
|
232344
|
-
const [hasError, setHasError] = import_react32.useState(false);
|
|
232345
|
-
const { stdout } = use_stdout_default();
|
|
232346
|
-
const containerRef = import_react32.useRef(null);
|
|
232347
|
-
const componentPosition = usePosition_default(containerRef);
|
|
232348
|
-
const terminalDimensions = useTerminalDimensions();
|
|
232349
|
-
const terminalCapabilities = useTerminalCapabilities();
|
|
232350
|
-
const [actualSizeInCells, setActualSizeInCells] = import_react32.useState(null);
|
|
232351
|
-
const shouldCleanupRef = import_react32.useRef(true);
|
|
232352
|
-
const { src, onSupportDetected, width: propsWidth, height: propsHeight } = props;
|
|
232353
|
-
import_react32.useEffect(() => {
|
|
232354
|
-
if (!terminalCapabilities)
|
|
232355
|
-
return;
|
|
232356
|
-
const isSupported = terminalCapabilities.supportsSixelGraphics;
|
|
232357
|
-
onSupportDetected?.(isSupported);
|
|
232358
|
-
}, [terminalCapabilities, onSupportDetected]);
|
|
232359
|
-
import_react32.useEffect(() => {
|
|
232360
|
-
const generateImageOutput = async () => {
|
|
232361
|
-
if (!componentPosition)
|
|
232362
|
-
return;
|
|
232363
|
-
if (!terminalDimensions)
|
|
232364
|
-
return;
|
|
232365
|
-
const image2 = await fetchImage(src);
|
|
232366
|
-
if (!image2) {
|
|
232367
|
-
setHasError(true);
|
|
232368
|
-
return;
|
|
232369
|
-
}
|
|
232370
|
-
setHasError(false);
|
|
232371
|
-
const metadata = await image2.metadata();
|
|
232372
|
-
const { width: maxWidth, height: maxHeight } = componentPosition;
|
|
232373
|
-
const { width, height } = calculateImageSize({
|
|
232374
|
-
maxWidth: maxWidth * terminalDimensions.cellWidth,
|
|
232375
|
-
maxHeight: maxHeight * terminalDimensions.cellHeight,
|
|
232376
|
-
originalAspectRatio: metadata.width / metadata.height,
|
|
232377
|
-
specifiedWidth: propsWidth ? propsWidth * terminalDimensions.cellWidth : undefined,
|
|
232378
|
-
specifiedHeight: propsHeight ? propsHeight * terminalDimensions.cellHeight : undefined
|
|
232379
|
-
});
|
|
232380
|
-
const resizedImage = await image2.resize(width, height).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
|
|
232381
|
-
setActualSizeInCells({
|
|
232382
|
-
width: Math.ceil(resizedImage.info.width / terminalDimensions.cellWidth),
|
|
232383
|
-
height: Math.ceil(resizedImage.info.height / terminalDimensions.cellHeight)
|
|
232384
|
-
});
|
|
232385
|
-
const output = await toSixel(resizedImage);
|
|
232386
|
-
setImageOutput(output);
|
|
232387
|
-
};
|
|
232388
|
-
generateImageOutput();
|
|
232389
|
-
}, [
|
|
232390
|
-
src,
|
|
232391
|
-
propsWidth,
|
|
232392
|
-
propsHeight,
|
|
232393
|
-
componentPosition?.width,
|
|
232394
|
-
componentPosition?.height,
|
|
232395
|
-
terminalDimensions
|
|
232396
|
-
]);
|
|
232397
|
-
import_react32.useLayoutEffect(() => {
|
|
232398
|
-
if (!imageOutput)
|
|
232399
|
-
return;
|
|
232400
|
-
if (!componentPosition)
|
|
232401
|
-
return;
|
|
232402
|
-
if (stdout.rows - componentPosition.appHeight + componentPosition.row < 0 || componentPosition.col > stdout.columns)
|
|
232403
|
-
return;
|
|
232404
|
-
function onExit() {
|
|
232405
|
-
shouldCleanupRef.current = false;
|
|
232406
|
-
}
|
|
232407
|
-
function onSigInt() {
|
|
232408
|
-
shouldCleanupRef.current = false;
|
|
232409
|
-
process.exit();
|
|
232410
|
-
}
|
|
232411
|
-
process.on("exit", onExit);
|
|
232412
|
-
process.on("SIGINT", onSigInt);
|
|
232413
|
-
process.on("SIGTERM", onSigInt);
|
|
232414
|
-
let previousRenderBoundingBox = undefined;
|
|
232415
|
-
const renderTimeout = setTimeout(() => {
|
|
232416
|
-
stdout.write("\x1B7");
|
|
232417
|
-
stdout.write(cursorUp2(componentPosition.appHeight - componentPosition.row));
|
|
232418
|
-
stdout.write("\r");
|
|
232419
|
-
stdout.write(cursorForward2(componentPosition.col));
|
|
232420
|
-
stdout.write(imageOutput);
|
|
232421
|
-
stdout.write("\x1B8");
|
|
232422
|
-
previousRenderBoundingBox = {
|
|
232423
|
-
row: stdout.rows - componentPosition.appHeight + componentPosition.row,
|
|
232424
|
-
col: componentPosition.col,
|
|
232425
|
-
width: actualSizeInCells.width,
|
|
232426
|
-
height: actualSizeInCells.height
|
|
232427
|
-
};
|
|
232428
|
-
}, 100);
|
|
232429
|
-
return () => {
|
|
232430
|
-
process.removeListener("exit", onExit);
|
|
232431
|
-
process.removeListener("SIGINT", onSigInt);
|
|
232432
|
-
process.removeListener("SIGTERM", onSigInt);
|
|
232433
|
-
if (!shouldCleanupRef.current)
|
|
232434
|
-
return;
|
|
232435
|
-
clearTimeout(renderTimeout);
|
|
232436
|
-
if (!previousRenderBoundingBox)
|
|
232437
|
-
return;
|
|
232438
|
-
stdout.write("\x1B7");
|
|
232439
|
-
stdout.write(cursorUp2(componentPosition.appHeight - componentPosition.row));
|
|
232440
|
-
for (let i5 = 0;i5 < previousRenderBoundingBox.height; i5++) {
|
|
232441
|
-
stdout.write("\r");
|
|
232442
|
-
stdout.write(cursorForward2(previousRenderBoundingBox.col));
|
|
232443
|
-
stdout.write(" ".repeat(previousRenderBoundingBox.width));
|
|
232444
|
-
stdout.write(`
|
|
232445
|
-
`);
|
|
232446
|
-
}
|
|
232447
|
-
stdout.write("\x1B8");
|
|
232448
|
-
};
|
|
232449
|
-
});
|
|
232450
|
-
return import_react32.default.createElement(Box_default, { ref: containerRef, flexDirection: "column", flexGrow: 1 }, imageOutput ? import_react32.default.createElement(Text3, { color: "gray", wrap: "wrap" }, props.alt || "Loading...") : import_react32.default.createElement(Box_default, { flexDirection: "column", alignItems: "center", justifyContent: "center" }, hasError && import_react32.default.createElement(Text3, { color: "red" }, "X", import_react32.default.createElement(Newline, null), "Load failed"), import_react32.default.createElement(Text3, { color: "gray" }, props.alt || "Loading...")));
|
|
232451
|
-
}
|
|
232452
|
-
async function toSixel(imageData) {
|
|
232453
|
-
const { data, info } = imageData;
|
|
232454
|
-
const { width, height } = info;
|
|
232455
|
-
const u8Data = new Uint8Array(data);
|
|
232456
|
-
const sixelData = import_sixel.image2sixel(u8Data, width, height);
|
|
232457
|
-
return sixelData;
|
|
232458
|
-
}
|
|
232459
|
-
function cursorForward2(count = 1) {
|
|
232460
|
-
return "\x1B[" + count + "C";
|
|
232461
|
-
}
|
|
232462
|
-
function cursorUp2(count = 1) {
|
|
232463
|
-
return "\x1B[" + count + "A";
|
|
232464
|
-
}
|
|
232465
|
-
var Sixel_default = SixelImage;
|
|
232466
|
-
|
|
232467
|
-
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/ITerm2.js
|
|
232468
|
-
var import_react33 = __toESM(require_react2(), 1);
|
|
232469
|
-
function ITerm2Image(props) {
|
|
232470
|
-
const [imageOutput, setImageOutput] = import_react33.useState(undefined);
|
|
232471
|
-
const [hasError, setHasError] = import_react33.useState(false);
|
|
232472
|
-
const { stdout } = use_stdout_default();
|
|
232473
|
-
const containerRef = import_react33.useRef(null);
|
|
232474
|
-
const componentPosition = usePosition_default(containerRef);
|
|
232475
|
-
const terminalDimensions = useTerminalDimensions();
|
|
232476
|
-
const terminalCapabilities = useTerminalCapabilities();
|
|
232477
|
-
const [actualSizeInCells, setActualSizeInCells] = import_react33.useState(null);
|
|
232478
|
-
const shouldCleanupRef = import_react33.useRef(true);
|
|
232479
|
-
const { onSupportDetected, src, width: propsWidth, height: propsHeight } = props;
|
|
232480
|
-
import_react33.useEffect(() => {
|
|
232481
|
-
if (!terminalCapabilities)
|
|
232482
|
-
return;
|
|
232483
|
-
const isSupported = terminalCapabilities.supportsITerm2Graphics;
|
|
232484
|
-
onSupportDetected?.(isSupported);
|
|
232485
|
-
}, [terminalCapabilities, onSupportDetected]);
|
|
232486
|
-
import_react33.useEffect(() => {
|
|
232487
|
-
const generateImageOutput = async () => {
|
|
232488
|
-
if (!componentPosition)
|
|
232489
|
-
return;
|
|
232490
|
-
if (!terminalDimensions)
|
|
232491
|
-
return;
|
|
232492
|
-
const image2 = await fetchImage(src);
|
|
232493
|
-
if (!image2) {
|
|
232494
|
-
setHasError(true);
|
|
232495
|
-
return;
|
|
232496
|
-
}
|
|
232497
|
-
setHasError(false);
|
|
232498
|
-
const metadata = await image2.metadata();
|
|
232499
|
-
const { width: maxWidth, height: maxHeight } = componentPosition;
|
|
232500
|
-
const { width, height } = calculateImageSize({
|
|
232501
|
-
maxWidth: maxWidth * terminalDimensions.cellWidth,
|
|
232502
|
-
maxHeight: maxHeight * terminalDimensions.cellHeight,
|
|
232503
|
-
originalAspectRatio: metadata.width / metadata.height,
|
|
232504
|
-
specifiedWidth: propsWidth ? propsWidth * terminalDimensions.cellWidth : undefined,
|
|
232505
|
-
specifiedHeight: propsHeight ? propsHeight * terminalDimensions.cellHeight : undefined
|
|
232506
|
-
});
|
|
232507
|
-
const resizedImage = await image2.png().toBuffer({ resolveWithObject: true });
|
|
232508
|
-
setActualSizeInCells({
|
|
232509
|
-
width: Math.ceil(width / terminalDimensions.cellWidth),
|
|
232510
|
-
height: Math.ceil(height / terminalDimensions.cellHeight)
|
|
232511
|
-
});
|
|
232512
|
-
const output = toITerm2(resizedImage, { width, height });
|
|
232513
|
-
setImageOutput(output);
|
|
232514
|
-
};
|
|
232515
|
-
generateImageOutput();
|
|
232516
|
-
}, [
|
|
232517
|
-
src,
|
|
232518
|
-
propsWidth,
|
|
232519
|
-
propsHeight,
|
|
232520
|
-
componentPosition?.width,
|
|
232521
|
-
componentPosition?.height,
|
|
232522
|
-
terminalDimensions
|
|
232523
|
-
]);
|
|
232524
|
-
import_react33.useLayoutEffect(() => {
|
|
232525
|
-
if (!imageOutput)
|
|
232526
|
-
return;
|
|
232527
|
-
if (!componentPosition)
|
|
232528
|
-
return;
|
|
232529
|
-
if (stdout.rows - componentPosition.appHeight + componentPosition.row < 0 || componentPosition.col > stdout.columns)
|
|
232530
|
-
return;
|
|
232531
|
-
function onExit() {
|
|
232532
|
-
shouldCleanupRef.current = false;
|
|
232533
|
-
}
|
|
232534
|
-
function onSigInt() {
|
|
232535
|
-
shouldCleanupRef.current = false;
|
|
232536
|
-
process.exit();
|
|
232537
|
-
}
|
|
232538
|
-
process.on("exit", onExit);
|
|
232539
|
-
process.on("SIGINT", onSigInt);
|
|
232540
|
-
process.on("SIGTERM", onSigInt);
|
|
232541
|
-
let previousRenderBoundingBox = undefined;
|
|
232542
|
-
const renderTimeout = setTimeout(() => {
|
|
232543
|
-
stdout.write("\x1B7");
|
|
232544
|
-
stdout.write(cursorUp3(componentPosition.appHeight - componentPosition.row));
|
|
232545
|
-
stdout.write("\r");
|
|
232546
|
-
stdout.write(cursorForward3(componentPosition.col));
|
|
232547
|
-
stdout.write(imageOutput);
|
|
232548
|
-
stdout.write("\x1B8");
|
|
232549
|
-
previousRenderBoundingBox = {
|
|
232550
|
-
row: stdout.rows - componentPosition.appHeight + componentPosition.row,
|
|
232551
|
-
col: componentPosition.col,
|
|
232552
|
-
width: actualSizeInCells.width,
|
|
232553
|
-
height: actualSizeInCells.height
|
|
232554
|
-
};
|
|
232555
|
-
}, 100);
|
|
232556
|
-
return () => {
|
|
232557
|
-
process.removeListener("exit", onExit);
|
|
232558
|
-
process.removeListener("SIGINT", onSigInt);
|
|
232559
|
-
process.removeListener("SIGTERM", onSigInt);
|
|
232560
|
-
if (!shouldCleanupRef.current)
|
|
232561
|
-
return;
|
|
232562
|
-
clearTimeout(renderTimeout);
|
|
232563
|
-
if (!previousRenderBoundingBox)
|
|
232564
|
-
return;
|
|
232565
|
-
stdout.write("\x1B7");
|
|
232566
|
-
stdout.write(cursorUp3(componentPosition.appHeight - componentPosition.row));
|
|
232567
|
-
for (let i5 = 0;i5 < previousRenderBoundingBox.height; i5++) {
|
|
232568
|
-
stdout.write("\r");
|
|
232569
|
-
stdout.write(cursorForward3(previousRenderBoundingBox.col));
|
|
232570
|
-
stdout.write(" ".repeat(previousRenderBoundingBox.width));
|
|
232571
|
-
stdout.write(`
|
|
232572
|
-
`);
|
|
232573
|
-
}
|
|
232574
|
-
stdout.write("\x1B8");
|
|
232575
|
-
};
|
|
232576
|
-
});
|
|
232577
|
-
return import_react33.default.createElement(Box_default, { ref: containerRef, flexDirection: "column", flexGrow: 1 }, imageOutput ? import_react33.default.createElement(Text3, { color: "gray", wrap: "wrap" }, props.alt || "Loading...") : import_react33.default.createElement(Box_default, { flexDirection: "column", alignItems: "center", justifyContent: "center" }, hasError && import_react33.default.createElement(Text3, { color: "red" }, "X", import_react33.default.createElement(Newline, null), "Load failed"), import_react33.default.createElement(Text3, { color: "gray" }, props.alt || "Loading...")));
|
|
232578
|
-
}
|
|
232579
|
-
function toITerm2(imageData, options) {
|
|
232580
|
-
const { data, info } = imageData;
|
|
232581
|
-
const { width, height } = options;
|
|
232582
|
-
const iTerm2Data = "\x1B]1337;File=" + `size=${info.size};` + `width=${width}px;height=${height}px;` + `preserveAspectRatio=1;` + `inline=1:` + data.toString("base64") + "\x07";
|
|
232583
|
-
return iTerm2Data;
|
|
232584
|
-
}
|
|
232585
|
-
function cursorForward3(count = 1) {
|
|
232586
|
-
return "\x1B[" + count + "C";
|
|
232587
|
-
}
|
|
232588
|
-
function cursorUp3(count = 1) {
|
|
232589
|
-
return "\x1B[" + count + "A";
|
|
232590
|
-
}
|
|
232591
|
-
var ITerm2_default = ITerm2Image;
|
|
232592
|
-
|
|
232593
|
-
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/Kitty.js
|
|
232594
|
-
var import_react34 = __toESM(require_react2(), 1);
|
|
232595
|
-
|
|
232596
|
-
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/utils/generateKittyId.js
|
|
232597
|
-
var MIN_ID = 1048576;
|
|
232598
|
-
var MAX_ID = 16777216;
|
|
232599
|
-
|
|
232600
|
-
class KittyIdGenerator {
|
|
232601
|
-
currentId = MIN_ID;
|
|
232602
|
-
freedIds = new Set;
|
|
232603
|
-
generateId() {
|
|
232604
|
-
if (this.freedIds.size > 0) {
|
|
232605
|
-
const reusedId = this.freedIds.values().next().value;
|
|
232606
|
-
this.freedIds.delete(reusedId);
|
|
232607
|
-
return reusedId;
|
|
232608
|
-
}
|
|
232609
|
-
if (this.currentId >= MAX_ID) {
|
|
232610
|
-
throw new Error("Kitty ID overflow: Maximum ID value reached");
|
|
232611
|
-
}
|
|
232612
|
-
return this.currentId++;
|
|
232613
|
-
}
|
|
232614
|
-
freeId(id) {
|
|
232615
|
-
if (id >= MIN_ID && id < this.currentId) {
|
|
232616
|
-
return this.freedIds.add(id).size > this.freedIds.size - 1;
|
|
232617
|
-
}
|
|
232618
|
-
return false;
|
|
232619
|
-
}
|
|
232620
|
-
getActiveIdCount() {
|
|
232621
|
-
return this.currentId - MIN_ID - this.freedIds.size;
|
|
232622
|
-
}
|
|
232623
|
-
getAvailableIdCount() {
|
|
232624
|
-
return MAX_ID - this.currentId + this.freedIds.size;
|
|
232625
|
-
}
|
|
232626
|
-
}
|
|
232627
|
-
var generator = new KittyIdGenerator;
|
|
232628
|
-
var generateId2 = () => generator.generateId();
|
|
232629
|
-
var generateKittyId_default = generateId2;
|
|
232630
|
-
|
|
232631
|
-
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/Kitty.js
|
|
232632
|
-
function KittyImage(props) {
|
|
232633
|
-
const [imageId, setImageId] = import_react34.useState(undefined);
|
|
232634
|
-
const [hasError, setHasError] = import_react34.useState(false);
|
|
232635
|
-
const { stdout } = use_stdout_default();
|
|
232636
|
-
const containerRef = import_react34.useRef(null);
|
|
232637
|
-
const componentPosition = usePosition_default(containerRef);
|
|
232638
|
-
const terminalDimensions = useTerminalDimensions();
|
|
232639
|
-
const terminalCapabilities = useTerminalCapabilities();
|
|
232640
|
-
const { src, onSupportDetected, width: propsWidth, height: propsHeight } = props;
|
|
232641
|
-
import_react34.useEffect(() => {
|
|
232642
|
-
if (!terminalCapabilities)
|
|
232643
|
-
return;
|
|
232644
|
-
const isSupported = terminalCapabilities.supportsKittyGraphics;
|
|
232645
|
-
onSupportDetected?.(isSupported);
|
|
232646
|
-
}, [terminalCapabilities, onSupportDetected]);
|
|
232647
|
-
import_react34.useEffect(() => {
|
|
232648
|
-
const generateImageOutput = async () => {
|
|
232649
|
-
if (!componentPosition)
|
|
232650
|
-
return;
|
|
232651
|
-
if (!terminalDimensions)
|
|
232652
|
-
return;
|
|
232653
|
-
const image2 = await fetchImage(src);
|
|
232654
|
-
if (!image2) {
|
|
232655
|
-
setHasError(true);
|
|
232656
|
-
return;
|
|
232657
|
-
}
|
|
232658
|
-
setHasError(false);
|
|
232659
|
-
const metadata = await image2.metadata();
|
|
232660
|
-
const { width: maxWidth, height: maxHeight } = componentPosition;
|
|
232661
|
-
const { width, height } = calculateImageSize({
|
|
232662
|
-
maxWidth: maxWidth * terminalDimensions.cellWidth,
|
|
232663
|
-
maxHeight: maxHeight * terminalDimensions.cellHeight,
|
|
232664
|
-
originalAspectRatio: metadata.width / metadata.height,
|
|
232665
|
-
specifiedWidth: propsWidth ? propsWidth * terminalDimensions.cellWidth : undefined,
|
|
232666
|
-
specifiedHeight: propsHeight ? propsHeight * terminalDimensions.cellHeight : undefined
|
|
232667
|
-
});
|
|
232668
|
-
const resizedImage = image2.resize(width, height);
|
|
232669
|
-
try {
|
|
232670
|
-
const imageId2 = generateKittyId_default();
|
|
232671
|
-
const data = await resizedImage.png().toBuffer();
|
|
232672
|
-
const chunkSize = 4096;
|
|
232673
|
-
const base64Data = data.toString("base64");
|
|
232674
|
-
const firstChunk = base64Data.slice(0, chunkSize);
|
|
232675
|
-
stdout.write(`\x1B_Gf=100,t=d,i=${imageId2},m=1,q=2;${firstChunk}\x1B\\`);
|
|
232676
|
-
let bufferOffset = chunkSize;
|
|
232677
|
-
while (bufferOffset < base64Data.length - chunkSize) {
|
|
232678
|
-
const chunk = base64Data.slice(bufferOffset, bufferOffset + chunkSize);
|
|
232679
|
-
bufferOffset += chunkSize;
|
|
232680
|
-
stdout.write(`\x1B_Gm=1,q=2;${chunk}\x1B\\`);
|
|
232681
|
-
}
|
|
232682
|
-
const lastChunk = base64Data.slice(bufferOffset);
|
|
232683
|
-
stdout.write(`\x1B_Gm=0,q=2;${lastChunk}\x1B\\`);
|
|
232684
|
-
setImageId(imageId2);
|
|
232685
|
-
} catch {
|
|
232686
|
-
setHasError(true);
|
|
232687
|
-
return;
|
|
232688
|
-
}
|
|
232689
|
-
};
|
|
232690
|
-
generateImageOutput();
|
|
232691
|
-
}, [
|
|
232692
|
-
src,
|
|
232693
|
-
propsWidth,
|
|
232694
|
-
propsHeight,
|
|
232695
|
-
componentPosition?.width,
|
|
232696
|
-
componentPosition?.height,
|
|
232697
|
-
terminalDimensions
|
|
232698
|
-
]);
|
|
232699
|
-
import_react34.useEffect(() => {
|
|
232700
|
-
if (!imageId)
|
|
232701
|
-
return;
|
|
232702
|
-
if (!componentPosition)
|
|
232703
|
-
return;
|
|
232704
|
-
stdout.write("\x1B7");
|
|
232705
|
-
stdout.write(cursorUp4(componentPosition.appHeight - componentPosition.row));
|
|
232706
|
-
stdout.write("\r");
|
|
232707
|
-
stdout.write(cursorForward4(componentPosition.col));
|
|
232708
|
-
const placementId = 1;
|
|
232709
|
-
stdout.write(`\x1B_Ga=p,i=${imageId},p=${placementId},C=1,q=2\x1B\\`);
|
|
232710
|
-
stdout.write("\x1B8");
|
|
232711
|
-
});
|
|
232712
|
-
import_react34.useEffect(() => {
|
|
232713
|
-
return () => {
|
|
232714
|
-
if (!imageId)
|
|
232715
|
-
return;
|
|
232716
|
-
stdout.write(`\x1B_Ga=d,d=I,i=${imageId}\x1B\\`);
|
|
232717
|
-
};
|
|
232718
|
-
}, [imageId, stdout]);
|
|
232719
|
-
return import_react34.default.createElement(Box_default, { ref: containerRef, flexDirection: "column", flexGrow: 1 }, imageId ? import_react34.default.createElement(Text3, { color: "gray", wrap: "wrap" }, props.alt || "Loading...") : import_react34.default.createElement(Box_default, { flexDirection: "column", alignItems: "center", justifyContent: "center" }, hasError && import_react34.default.createElement(Text3, { color: "red" }, "X", import_react34.default.createElement(Newline, null), "Load failed"), import_react34.default.createElement(Text3, { color: "gray" }, props.alt || "Loading...")));
|
|
232720
|
-
}
|
|
232721
|
-
function cursorForward4(count = 1) {
|
|
232722
|
-
return "\x1B[" + count + "C";
|
|
232723
|
-
}
|
|
232724
|
-
function cursorUp4(count = 1) {
|
|
232725
|
-
return "\x1B[" + count + "A";
|
|
232726
|
-
}
|
|
232727
|
-
var Kitty_default = KittyImage;
|
|
232728
|
-
|
|
232729
|
-
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/utils/getBestProtocol.js
|
|
232730
|
-
function getBestProtocol(caps) {
|
|
232731
|
-
if (process.env["TERM_PROGRAM"] === "iTerm.app" && caps.supportsITerm2Graphics) {
|
|
232732
|
-
return "iterm2";
|
|
232733
|
-
} else if (process.env["TERM_PROGRAM"] === "WarpTerminal" && caps.supportsITerm2Graphics) {
|
|
232734
|
-
return "iterm2";
|
|
232735
|
-
} else if (process.env["TERM_PROGRAM"] === "WezTerm" && caps.supportsITerm2Graphics) {
|
|
232736
|
-
return "iterm2";
|
|
232737
|
-
} else if (process.env["KONSOLE_VERSION"] && caps.supportsKittyGraphics) {
|
|
232738
|
-
return "kitty";
|
|
232739
|
-
} else if (caps.supportsKittyGraphics) {
|
|
232740
|
-
return "kitty";
|
|
232741
|
-
} else if (caps.supportsITerm2Graphics) {
|
|
232742
|
-
return "iterm2";
|
|
232743
|
-
} else if (caps.supportsSixelGraphics) {
|
|
232744
|
-
return "sixel";
|
|
232745
|
-
} else if (caps.supportsUnicode && caps.supportsColor) {
|
|
232746
|
-
return "halfBlock";
|
|
232747
|
-
} else if (caps.supportsUnicode) {
|
|
232748
|
-
return "braille";
|
|
232749
|
-
} else {
|
|
232750
|
-
return "ascii";
|
|
232751
|
-
}
|
|
232752
|
-
}
|
|
232753
|
-
|
|
232754
|
-
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/index.js
|
|
232755
|
-
var imageProtocols = {
|
|
232756
|
-
ascii: Ascii_default,
|
|
232757
|
-
braille: Braille_default,
|
|
232758
|
-
halfBlock: HalfBlock_default,
|
|
232759
|
-
iterm2: ITerm2_default,
|
|
232760
|
-
kitty: Kitty_default,
|
|
232761
|
-
sixel: Sixel_default
|
|
232762
|
-
};
|
|
232763
|
-
var ImageRenderer = (props) => {
|
|
232764
|
-
const ProtocolComponent = imageProtocols[props.protocol] || imageProtocols["ascii"];
|
|
232765
|
-
return import_react35.default.createElement(ProtocolComponent, { ...props });
|
|
232766
|
-
};
|
|
232767
|
-
function Image({ protocol: specifiedProtocol = "auto", ...props }) {
|
|
232768
|
-
const terminalCapabilitiesContext = useTerminalCapabilities();
|
|
232769
|
-
const [protocol, setProtocol] = import_react35.useState(terminalCapabilitiesContext ? getBestProtocol(terminalCapabilitiesContext) : "auto");
|
|
232770
|
-
const getFallbackProtocol = import_react35.useCallback((currentProtocol) => {
|
|
232771
|
-
switch (currentProtocol) {
|
|
232772
|
-
case "kitty":
|
|
232773
|
-
return "iterm2";
|
|
232774
|
-
case "iterm2":
|
|
232775
|
-
return "sixel";
|
|
232776
|
-
case "sixel":
|
|
232777
|
-
return "halfBlock";
|
|
232778
|
-
case "halfBlock":
|
|
232779
|
-
return "braille";
|
|
232780
|
-
case "braille":
|
|
232781
|
-
return "ascii";
|
|
232782
|
-
default:
|
|
232783
|
-
return "ascii";
|
|
232784
|
-
}
|
|
232785
|
-
}, []);
|
|
232786
|
-
const handleSupportDetected = import_react35.useCallback((isSupported) => {
|
|
232787
|
-
if (isSupported) {
|
|
232788
|
-
return;
|
|
232789
|
-
}
|
|
232790
|
-
const nextProtocol = getFallbackProtocol(protocol);
|
|
232791
|
-
setProtocol(nextProtocol);
|
|
232792
|
-
}, [protocol, getFallbackProtocol]);
|
|
232793
|
-
if (specifiedProtocol !== "auto") {
|
|
232794
|
-
return import_react35.default.createElement(ImageRenderer, { protocol: specifiedProtocol, ...props, onSupportDetected: () => {} });
|
|
232795
|
-
}
|
|
232796
|
-
return import_react35.default.createElement(ImageRenderer, { protocol, ...props, onSupportDetected: handleSupportDetected });
|
|
232797
|
-
}
|
|
232798
|
-
var image_default = Image;
|
|
232799
231566
|
// packages/terminal/src/components/App.tsx
|
|
232800
231567
|
var import_react82 = __toESM(require_react2(), 1);
|
|
232801
231568
|
import { spawn as spawn3 } from "child_process";
|
|
@@ -232805,7 +231572,7 @@ init_src2();
|
|
|
232805
231572
|
await init_src3();
|
|
232806
231573
|
|
|
232807
231574
|
// packages/terminal/src/components/Input.tsx
|
|
232808
|
-
var
|
|
231575
|
+
var import_react28 = __toESM(require_react2(), 1);
|
|
232809
231576
|
|
|
232810
231577
|
// packages/terminal/src/components/inputLayout.ts
|
|
232811
231578
|
function buildLayout(text, position, width) {
|
|
@@ -232882,7 +231649,7 @@ function moveCursorVertical(layout, preferredColumn, direction) {
|
|
|
232882
231649
|
await init_src3();
|
|
232883
231650
|
|
|
232884
231651
|
// packages/terminal/src/hooks/useSafeInput.ts
|
|
232885
|
-
var
|
|
231652
|
+
var import_react27 = __toESM(require_react2(), 1);
|
|
232886
231653
|
import { Buffer as Buffer5 } from "buffer";
|
|
232887
231654
|
var rawModeUsers = 0;
|
|
232888
231655
|
var rawModePatched = false;
|
|
@@ -232973,7 +231740,7 @@ var NON_ALPHA_KEYS = ["up", "down", "left", "right", "pageup", "pagedown", "home
|
|
|
232973
231740
|
function useSafeInput(handler, options = {}) {
|
|
232974
231741
|
ensureRawModePatch();
|
|
232975
231742
|
const { internal_eventEmitter, internal_exitOnCtrlC, setRawMode, isRawModeSupported, stdin } = use_stdin_default();
|
|
232976
|
-
|
|
231743
|
+
import_react27.useEffect(() => {
|
|
232977
231744
|
const rawModeSupported = isRawModeSupported ?? Boolean(stdin?.isTTY ?? process.stdin?.isTTY);
|
|
232978
231745
|
const rawModeSetter = setRawMode ?? (stdin && typeof stdin.setRawMode === "function" ? stdin.setRawMode.bind(stdin) : undefined) ?? (process.stdin && typeof process.stdin.setRawMode === "function" ? process.stdin.setRawMode.bind(process.stdin) : undefined);
|
|
232979
231746
|
if (!rawModeSupported || !rawModeSetter)
|
|
@@ -232985,7 +231752,7 @@ function useSafeInput(handler, options = {}) {
|
|
|
232985
231752
|
rawModeSetter(false);
|
|
232986
231753
|
};
|
|
232987
231754
|
}, [isRawModeSupported, setRawMode, stdin]);
|
|
232988
|
-
|
|
231755
|
+
import_react27.useEffect(() => {
|
|
232989
231756
|
if (options.isActive === false)
|
|
232990
231757
|
return;
|
|
232991
231758
|
const resolvedStdin = stdin ?? process.stdin;
|
|
@@ -233173,7 +231940,7 @@ function isLargePaste(text, thresholds = DEFAULT_PASTE_THRESHOLDS) {
|
|
|
233173
231940
|
const lineThreshold = thresholds.lines ?? DEFAULT_PASTE_THRESHOLDS.lines;
|
|
233174
231941
|
return text.length > charThreshold || countWords(text) > wordThreshold || countLines(text) > lineThreshold;
|
|
233175
231942
|
}
|
|
233176
|
-
var Input =
|
|
231943
|
+
var Input = import_react28.default.forwardRef(function Input2({
|
|
233177
231944
|
onSubmit,
|
|
233178
231945
|
onStopProcessing,
|
|
233179
231946
|
isProcessing,
|
|
@@ -233194,14 +231961,14 @@ var Input = import_react37.default.forwardRef(function Input2({
|
|
|
233194
231961
|
const pasteEnabled = pasteConfig?.enabled !== false;
|
|
233195
231962
|
const pasteThresholds = pasteConfig?.thresholds ?? DEFAULT_PASTE_THRESHOLDS;
|
|
233196
231963
|
const pasteMode = pasteConfig?.mode ?? "placeholder";
|
|
233197
|
-
const [inputState, setInputState] =
|
|
231964
|
+
const [inputState, setInputState] = import_react28.useState({ value: "", cursor: 0 });
|
|
233198
231965
|
const { value, cursor } = inputState;
|
|
233199
|
-
const [largePaste, setLargePaste] =
|
|
233200
|
-
const [showPastePreview, setShowPastePreview] =
|
|
233201
|
-
const historyRef =
|
|
233202
|
-
const [historyLoaded, setHistoryLoaded] =
|
|
233203
|
-
const [savedInput, setSavedInput] =
|
|
233204
|
-
|
|
231966
|
+
const [largePaste, setLargePaste] = import_react28.useState(null);
|
|
231967
|
+
const [showPastePreview, setShowPastePreview] = import_react28.useState(false);
|
|
231968
|
+
const historyRef = import_react28.useRef(historyProp || getCommandHistory());
|
|
231969
|
+
const [historyLoaded, setHistoryLoaded] = import_react28.useState(false);
|
|
231970
|
+
const [savedInput, setSavedInput] = import_react28.useState("");
|
|
231971
|
+
import_react28.useEffect(() => {
|
|
233205
231972
|
historyRef.current.load().then(() => {
|
|
233206
231973
|
setHistoryLoaded(true);
|
|
233207
231974
|
});
|
|
@@ -233218,12 +231985,12 @@ var Input = import_react37.default.forwardRef(function Input2({
|
|
|
233218
231985
|
cursor: typeof newCursor === "function" ? newCursor(prev.cursor) : newCursor
|
|
233219
231986
|
}));
|
|
233220
231987
|
};
|
|
233221
|
-
const [preferredColumn, setPreferredColumn] =
|
|
233222
|
-
const [selectedIndex, setSelectedIndex] =
|
|
231988
|
+
const [preferredColumn, setPreferredColumn] = import_react28.useState(null);
|
|
231989
|
+
const [selectedIndex, setSelectedIndex] = import_react28.useState(0);
|
|
233223
231990
|
const { stdout } = use_stdout_default();
|
|
233224
231991
|
const screenWidth = stdout?.columns ?? 80;
|
|
233225
231992
|
const textWidth = Math.max(10, screenWidth - 4);
|
|
233226
|
-
const allCommands =
|
|
231993
|
+
const allCommands = import_react28.useMemo(() => {
|
|
233227
231994
|
const merged = [...COMMANDS];
|
|
233228
231995
|
if (commands9) {
|
|
233229
231996
|
for (const cmd of commands9) {
|
|
@@ -233234,7 +232001,7 @@ var Input = import_react37.default.forwardRef(function Input2({
|
|
|
233234
232001
|
}
|
|
233235
232002
|
return merged.sort((a5, b8) => a5.name.localeCompare(b8.name));
|
|
233236
232003
|
}, [commands9]);
|
|
233237
|
-
const autocompleteMode =
|
|
232004
|
+
const autocompleteMode = import_react28.useMemo(() => {
|
|
233238
232005
|
if (isAskingUser)
|
|
233239
232006
|
return null;
|
|
233240
232007
|
if (value.startsWith("$") && !value.includes(" ")) {
|
|
@@ -233251,38 +232018,38 @@ var Input = import_react37.default.forwardRef(function Input2({
|
|
|
233251
232018
|
}
|
|
233252
232019
|
return null;
|
|
233253
232020
|
}, [value, isAskingUser, onFileSearch]);
|
|
233254
|
-
const filteredCommands =
|
|
232021
|
+
const filteredCommands = import_react28.useMemo(() => {
|
|
233255
232022
|
if (autocompleteMode !== "command")
|
|
233256
232023
|
return [];
|
|
233257
232024
|
const search = value.toLowerCase();
|
|
233258
232025
|
return allCommands.filter((cmd) => cmd.name.toLowerCase().startsWith(search));
|
|
233259
232026
|
}, [value, autocompleteMode, allCommands]);
|
|
233260
|
-
const filteredSkills =
|
|
232027
|
+
const filteredSkills = import_react28.useMemo(() => {
|
|
233261
232028
|
if (autocompleteMode !== "skill")
|
|
233262
232029
|
return [];
|
|
233263
232030
|
const search = value.slice(1).toLowerCase();
|
|
233264
232031
|
return skills.filter((skill) => skill.name.toLowerCase().startsWith(search));
|
|
233265
232032
|
}, [value, autocompleteMode, skills]);
|
|
233266
|
-
const fileSearchQuery =
|
|
232033
|
+
const fileSearchQuery = import_react28.useMemo(() => {
|
|
233267
232034
|
if (autocompleteMode !== "file")
|
|
233268
232035
|
return "";
|
|
233269
232036
|
const atMatch = value.match(/(?:^|.*\s)@([^\s]*)$/);
|
|
233270
232037
|
return atMatch ? atMatch[1] : "";
|
|
233271
232038
|
}, [value, autocompleteMode]);
|
|
233272
|
-
const filteredFiles =
|
|
232039
|
+
const filteredFiles = import_react28.useMemo(() => {
|
|
233273
232040
|
if (autocompleteMode !== "file" || !onFileSearch)
|
|
233274
232041
|
return [];
|
|
233275
232042
|
return onFileSearch(fileSearchQuery);
|
|
233276
232043
|
}, [autocompleteMode, fileSearchQuery, onFileSearch]);
|
|
233277
232044
|
const autocompleteItems = autocompleteMode === "skill" ? filteredSkills : autocompleteMode === "file" ? filteredFiles.map((f6) => ({ name: f6 })) : filteredCommands;
|
|
233278
|
-
|
|
232045
|
+
import_react28.useEffect(() => {
|
|
233279
232046
|
if (autocompleteItems.length === 0) {
|
|
233280
232047
|
setSelectedIndex(0);
|
|
233281
232048
|
return;
|
|
233282
232049
|
}
|
|
233283
232050
|
setSelectedIndex((prev) => Math.min(prev, autocompleteItems.length - 1));
|
|
233284
232051
|
}, [autocompleteItems.length]);
|
|
233285
|
-
const setValueAndCursor =
|
|
232052
|
+
const setValueAndCursor = import_react28.useCallback((nextValue, nextCursor = nextValue.length, resetHistory = true) => {
|
|
233286
232053
|
const normalized = normalizeLineEndings(nextValue);
|
|
233287
232054
|
const clamped = Math.max(0, Math.min(nextCursor, normalized.length));
|
|
233288
232055
|
setInputState({ value: normalized, cursor: clamped });
|
|
@@ -233292,11 +232059,11 @@ var Input = import_react37.default.forwardRef(function Input2({
|
|
|
233292
232059
|
historyRef.current.resetIndex(normalized);
|
|
233293
232060
|
}
|
|
233294
232061
|
}, []);
|
|
233295
|
-
const clearLargePaste =
|
|
232062
|
+
const clearLargePaste = import_react28.useCallback(() => {
|
|
233296
232063
|
setLargePaste(null);
|
|
233297
232064
|
setShowPastePreview(false);
|
|
233298
232065
|
}, []);
|
|
233299
|
-
|
|
232066
|
+
import_react28.useImperativeHandle(ref, () => ({
|
|
233300
232067
|
setValue: (nextValue, nextCursor = nextValue.length, resetHistory = true) => {
|
|
233301
232068
|
clearLargePaste();
|
|
233302
232069
|
setValueAndCursor(nextValue, nextCursor, resetHistory);
|
|
@@ -233622,7 +232389,7 @@ var Input = import_react37.default.forwardRef(function Input2({
|
|
|
233622
232389
|
};
|
|
233623
232390
|
const visibleSkills = getVisibleItems(filteredSkills);
|
|
233624
232391
|
const visibleCommands = getVisibleItems(filteredCommands);
|
|
233625
|
-
const fileItems =
|
|
232392
|
+
const fileItems = import_react28.useMemo(() => filteredFiles.map((f6) => ({ name: f6 })), [filteredFiles]);
|
|
233626
232393
|
const visibleFiles = getVisibleItems(fileItems);
|
|
233627
232394
|
const layout = buildLayout(value, cursor, textWidth);
|
|
233628
232395
|
const lines = layout.displayLines;
|
|
@@ -234992,356 +233759,1591 @@ function parseErrorInfo(content, toolName) {
|
|
|
234992
233759
|
exitCode,
|
|
234993
233760
|
hint: "Check allowed tools configuration"
|
|
234994
233761
|
};
|
|
234995
|
-
}
|
|
234996
|
-
if (exitCode !== undefined) {
|
|
234997
|
-
return {
|
|
234998
|
-
type: "exit_code",
|
|
234999
|
-
message: `Failed with exit code ${exitCode}`,
|
|
235000
|
-
exitCode,
|
|
235001
|
-
hint: exitCode === 1 ? "Check command output for details" : undefined
|
|
233762
|
+
}
|
|
233763
|
+
if (exitCode !== undefined) {
|
|
233764
|
+
return {
|
|
233765
|
+
type: "exit_code",
|
|
233766
|
+
message: `Failed with exit code ${exitCode}`,
|
|
233767
|
+
exitCode,
|
|
233768
|
+
hint: exitCode === 1 ? "Check command output for details" : undefined
|
|
233769
|
+
};
|
|
233770
|
+
}
|
|
233771
|
+
return {
|
|
233772
|
+
type: "unknown",
|
|
233773
|
+
message: "Error occurred",
|
|
233774
|
+
hint: "Check the error details"
|
|
233775
|
+
};
|
|
233776
|
+
}
|
|
233777
|
+
function formatErrorConcise(content, toolName) {
|
|
233778
|
+
const info = parseErrorInfo(content, toolName);
|
|
233779
|
+
const exitPart = info.exitCode !== undefined ? ` [${info.exitCode}]` : "";
|
|
233780
|
+
const hintPart = info.hint ? ` \u2192 ${info.hint}` : "";
|
|
233781
|
+
return `\u2717 ${info.message}${exitPart}${hintPart}`;
|
|
233782
|
+
}
|
|
233783
|
+
function formatToolResultNicely(toolName, content, isError) {
|
|
233784
|
+
if (isError) {
|
|
233785
|
+
return formatErrorConcise(content, toolName);
|
|
233786
|
+
}
|
|
233787
|
+
switch (toolName) {
|
|
233788
|
+
case "schedule":
|
|
233789
|
+
return formatScheduleResult(content);
|
|
233790
|
+
case "submit_feedback":
|
|
233791
|
+
return formatFeedbackResult(content);
|
|
233792
|
+
case "read":
|
|
233793
|
+
return formatReadResult(content);
|
|
233794
|
+
case "write":
|
|
233795
|
+
return formatWriteResult(content);
|
|
233796
|
+
case "glob":
|
|
233797
|
+
return formatGlobResult(content);
|
|
233798
|
+
case "grep":
|
|
233799
|
+
return formatGrepResult(content);
|
|
233800
|
+
case "bash":
|
|
233801
|
+
return formatBashResult(content);
|
|
233802
|
+
case "web_search":
|
|
233803
|
+
return formatSearchResult(content);
|
|
233804
|
+
default:
|
|
233805
|
+
return null;
|
|
233806
|
+
}
|
|
233807
|
+
}
|
|
233808
|
+
function formatScheduleResult(content) {
|
|
233809
|
+
const trimmed = content.trim().toLowerCase();
|
|
233810
|
+
if (trimmed === "no schedules found." || trimmed.includes("no schedules")) {
|
|
233811
|
+
return "\uD83D\uDCC5 No scheduled tasks";
|
|
233812
|
+
}
|
|
233813
|
+
if (trimmed.includes("created") || trimmed.includes("scheduled")) {
|
|
233814
|
+
return "\u2713 Schedule created";
|
|
233815
|
+
}
|
|
233816
|
+
if (trimmed.includes("deleted") || trimmed.includes("removed")) {
|
|
233817
|
+
return "\u2713 Schedule deleted";
|
|
233818
|
+
}
|
|
233819
|
+
if (trimmed.includes("paused")) {
|
|
233820
|
+
return "\u23F8 Schedule paused";
|
|
233821
|
+
}
|
|
233822
|
+
if (trimmed.includes("resumed")) {
|
|
233823
|
+
return "\u25B6 Schedule resumed";
|
|
233824
|
+
}
|
|
233825
|
+
if (content.includes("id:") || content.includes("command:")) {
|
|
233826
|
+
const lines = content.split(`
|
|
233827
|
+
`).filter((line) => line.trim());
|
|
233828
|
+
return `\uD83D\uDCC5 ${lines.length} scheduled task${lines.length !== 1 ? "s" : ""}`;
|
|
233829
|
+
}
|
|
233830
|
+
return null;
|
|
233831
|
+
}
|
|
233832
|
+
function formatFeedbackResult(content) {
|
|
233833
|
+
if (content.includes("submitted") || content.includes("created")) {
|
|
233834
|
+
return "\u2713 Feedback submitted";
|
|
233835
|
+
}
|
|
233836
|
+
return null;
|
|
233837
|
+
}
|
|
233838
|
+
function formatReadResult(content) {
|
|
233839
|
+
const lines = content.split(`
|
|
233840
|
+
`).length;
|
|
233841
|
+
if (lines > 20) {
|
|
233842
|
+
return `\uD83D\uDCC4 Read ${lines} lines`;
|
|
233843
|
+
}
|
|
233844
|
+
return null;
|
|
233845
|
+
}
|
|
233846
|
+
function formatWriteResult(content) {
|
|
233847
|
+
if (content.includes("written") || content.includes("saved") || content.includes("created")) {
|
|
233848
|
+
return "\u2713 File saved";
|
|
233849
|
+
}
|
|
233850
|
+
return null;
|
|
233851
|
+
}
|
|
233852
|
+
function formatGlobResult(content) {
|
|
233853
|
+
const lines = content.split(`
|
|
233854
|
+
`).filter((line) => line.trim());
|
|
233855
|
+
if (lines.length === 0) {
|
|
233856
|
+
return "\uD83D\uDD0D No files found";
|
|
233857
|
+
}
|
|
233858
|
+
if (lines.length > 10) {
|
|
233859
|
+
return `\uD83D\uDD0D Found ${lines.length} files`;
|
|
233860
|
+
}
|
|
233861
|
+
return null;
|
|
233862
|
+
}
|
|
233863
|
+
function formatGrepResult(content) {
|
|
233864
|
+
const lines = content.split(`
|
|
233865
|
+
`).filter((line) => line.trim());
|
|
233866
|
+
if (lines.length === 0) {
|
|
233867
|
+
return "\uD83D\uDD0D No matches found";
|
|
233868
|
+
}
|
|
233869
|
+
if (lines.length > 10) {
|
|
233870
|
+
return `\uD83D\uDD0D Found ${lines.length} matches`;
|
|
233871
|
+
}
|
|
233872
|
+
return null;
|
|
233873
|
+
}
|
|
233874
|
+
function formatBashResult(content) {
|
|
233875
|
+
const trimmed = content.trim();
|
|
233876
|
+
if (!trimmed) {
|
|
233877
|
+
return "\u2713 Command completed";
|
|
233878
|
+
}
|
|
233879
|
+
if (trimmed.length < 100 && !trimmed.includes(`
|
|
233880
|
+
`)) {
|
|
233881
|
+
return null;
|
|
233882
|
+
}
|
|
233883
|
+
const lines = trimmed.split(`
|
|
233884
|
+
`).length;
|
|
233885
|
+
if (lines > 20) {
|
|
233886
|
+
return `\u2713 Output: ${lines} lines`;
|
|
233887
|
+
}
|
|
233888
|
+
return null;
|
|
233889
|
+
}
|
|
233890
|
+
function formatSearchResult(content) {
|
|
233891
|
+
const resultCount = (content.match(/https?:\/\//g) || []).length;
|
|
233892
|
+
if (resultCount > 0) {
|
|
233893
|
+
return `\uD83D\uDD0D Found ${resultCount} result${resultCount !== 1 ? "s" : ""}`;
|
|
233894
|
+
}
|
|
233895
|
+
return null;
|
|
233896
|
+
}
|
|
233897
|
+
function stripAnsi3(text) {
|
|
233898
|
+
return text.replace(/\x1B\[[0-9;]*m/g, "");
|
|
233899
|
+
}
|
|
233900
|
+
|
|
233901
|
+
// packages/terminal/src/components/messageLines.ts
|
|
233902
|
+
function estimateToolPanelLines(toolCalls, toolResults, hasContent, maxWidth) {
|
|
233903
|
+
if (!toolCalls || toolCalls.length === 0) {
|
|
233904
|
+
return 0;
|
|
233905
|
+
}
|
|
233906
|
+
const innerWidth = maxWidth ? Math.max(1, maxWidth - 4) : undefined;
|
|
233907
|
+
const resultWidth = innerWidth ? Math.max(1, innerWidth - 4) : undefined;
|
|
233908
|
+
const resultLines = new Map;
|
|
233909
|
+
for (const result of toolResults || []) {
|
|
233910
|
+
resultLines.set(result.toolCallId, estimateToolResultLines(result, resultWidth));
|
|
233911
|
+
}
|
|
233912
|
+
let lines = 0;
|
|
233913
|
+
if (hasContent) {
|
|
233914
|
+
lines += 1;
|
|
233915
|
+
}
|
|
233916
|
+
for (const call of toolCalls) {
|
|
233917
|
+
lines += 2;
|
|
233918
|
+
const toolResultLines = resultLines.get(call.id);
|
|
233919
|
+
if (toolResultLines && toolResultLines > 0) {
|
|
233920
|
+
lines += toolResultLines;
|
|
233921
|
+
}
|
|
233922
|
+
}
|
|
233923
|
+
return lines;
|
|
233924
|
+
}
|
|
233925
|
+
function estimateToolResultPanelLines(toolResults, hasContent, maxWidth) {
|
|
233926
|
+
if (!toolResults || toolResults.length === 0)
|
|
233927
|
+
return 0;
|
|
233928
|
+
const innerWidth = maxWidth ? Math.max(1, maxWidth - 4) : undefined;
|
|
233929
|
+
const resultWidth = innerWidth ? Math.max(1, innerWidth - 4) : undefined;
|
|
233930
|
+
let lines = 0;
|
|
233931
|
+
if (hasContent) {
|
|
233932
|
+
lines += 1;
|
|
233933
|
+
}
|
|
233934
|
+
for (const result of toolResults) {
|
|
233935
|
+
lines += 2;
|
|
233936
|
+
lines += estimateToolResultLines(result, resultWidth);
|
|
233937
|
+
}
|
|
233938
|
+
return lines;
|
|
233939
|
+
}
|
|
233940
|
+
function estimateToolResultLines(result, maxWidth, maxLines = 4) {
|
|
233941
|
+
const content = truncateToolResult(result, maxLines, 400);
|
|
233942
|
+
if (!content)
|
|
233943
|
+
return 1;
|
|
233944
|
+
const lines = stripAnsi4(content).split(`
|
|
233945
|
+
`);
|
|
233946
|
+
const wrapped = countWrappedLines(lines, maxWidth);
|
|
233947
|
+
return Math.max(1, wrapped);
|
|
233948
|
+
}
|
|
233949
|
+
function estimateMessageLines(message, maxWidth) {
|
|
233950
|
+
if (message.role === "system") {
|
|
233951
|
+
return 0;
|
|
233952
|
+
}
|
|
233953
|
+
const content = message.content ?? "";
|
|
233954
|
+
const contentLines = content.length > 0 ? content.split(`
|
|
233955
|
+
`) : [];
|
|
233956
|
+
const hasContent = contentLines.length > 0;
|
|
233957
|
+
const prefixWidth = message.role === "user" || message.role === "assistant" ? 2 : 0;
|
|
233958
|
+
const effectiveWidth = maxWidth ? Math.max(1, maxWidth - prefixWidth) : maxWidth;
|
|
233959
|
+
const wrappedLines = typeof message.__lineCount === "number" ? message.__lineCount : contentLines.length > 0 ? countWrappedLines(contentLines, effectiveWidth) : 0;
|
|
233960
|
+
let lines = hasContent ? Math.max(1, wrappedLines) : 0;
|
|
233961
|
+
const toolCalls = message.toolCalls ?? [];
|
|
233962
|
+
const toolResults = message.toolResults ?? [];
|
|
233963
|
+
if (toolCalls.length > 0) {
|
|
233964
|
+
lines += estimateToolPanelLines(toolCalls, toolResults, hasContent, maxWidth);
|
|
233965
|
+
} else if (toolResults.length > 0) {
|
|
233966
|
+
lines += estimateToolResultPanelLines(toolResults, hasContent, maxWidth);
|
|
233967
|
+
}
|
|
233968
|
+
if (message.role === "user" || message.role === "assistant") {
|
|
233969
|
+
if (!isContinuationChunk(message.id)) {
|
|
233970
|
+
lines += 2;
|
|
233971
|
+
}
|
|
233972
|
+
}
|
|
233973
|
+
return lines;
|
|
233974
|
+
}
|
|
233975
|
+
function countWrappedLines(lines, maxWidth) {
|
|
233976
|
+
if (!maxWidth || maxWidth <= 0) {
|
|
233977
|
+
return lines.length;
|
|
233978
|
+
}
|
|
233979
|
+
let total = 0;
|
|
233980
|
+
for (const line of lines) {
|
|
233981
|
+
const visible = stripAnsi4(line).length;
|
|
233982
|
+
const wrapped = Math.max(1, Math.ceil(visible / maxWidth));
|
|
233983
|
+
total += wrapped;
|
|
233984
|
+
}
|
|
233985
|
+
return total;
|
|
233986
|
+
}
|
|
233987
|
+
function stripAnsi4(text) {
|
|
233988
|
+
return text.replace(/\x1B\[[0-9;]*m/g, "");
|
|
233989
|
+
}
|
|
233990
|
+
function estimateActivityEntryLines(entry, wrapWidth, renderWidth) {
|
|
233991
|
+
const effectiveWidth = Math.max(1, wrapWidth - 2);
|
|
233992
|
+
switch (entry.type) {
|
|
233993
|
+
case "text": {
|
|
233994
|
+
const content = entry.content ?? "";
|
|
233995
|
+
if (!content.trim())
|
|
233996
|
+
return 0;
|
|
233997
|
+
const rendered = renderMarkdown(content, { maxWidth: renderWidth });
|
|
233998
|
+
const lines = stripAnsi4(rendered).split(`
|
|
233999
|
+
`);
|
|
234000
|
+
const wrapped = countWrappedLines(lines, effectiveWidth);
|
|
234001
|
+
return Math.max(1, wrapped) + 2;
|
|
234002
|
+
}
|
|
234003
|
+
case "tool_call":
|
|
234004
|
+
return 4;
|
|
234005
|
+
case "tool_result":
|
|
234006
|
+
return estimateToolResultEntryLines(entry, effectiveWidth);
|
|
234007
|
+
default:
|
|
234008
|
+
return 0;
|
|
234009
|
+
}
|
|
234010
|
+
}
|
|
234011
|
+
function estimateToolResultEntryLines(entry, effectiveWidth) {
|
|
234012
|
+
const content = entry.toolResult ? truncateToolResult(entry.toolResult) : "";
|
|
234013
|
+
const lines = content.split(`
|
|
234014
|
+
`);
|
|
234015
|
+
const wrapped = countWrappedLines(lines, effectiveWidth);
|
|
234016
|
+
return Math.max(1, wrapped) + 2;
|
|
234017
|
+
}
|
|
234018
|
+
function estimateDisplayMessagesLines(messages2, maxWidth) {
|
|
234019
|
+
return messages2.reduce((sum, message) => sum + estimateMessageLines(message, maxWidth), 0);
|
|
234020
|
+
}
|
|
234021
|
+
function trimDisplayMessagesByLines(messages2, maxLines, maxWidth) {
|
|
234022
|
+
if (maxLines <= 0) {
|
|
234023
|
+
return { messages: [], trimmed: messages2.length > 0 };
|
|
234024
|
+
}
|
|
234025
|
+
const kept = [];
|
|
234026
|
+
let remaining = maxLines;
|
|
234027
|
+
for (let i5 = messages2.length - 1;i5 >= 0; i5 -= 1) {
|
|
234028
|
+
const message = messages2[i5];
|
|
234029
|
+
const lineCount = estimateMessageLines(message, maxWidth);
|
|
234030
|
+
if (lineCount <= remaining || kept.length === 0) {
|
|
234031
|
+
kept.unshift(message);
|
|
234032
|
+
remaining -= Math.max(0, lineCount);
|
|
234033
|
+
} else {
|
|
234034
|
+
break;
|
|
234035
|
+
}
|
|
234036
|
+
}
|
|
234037
|
+
return { messages: kept, trimmed: kept.length < messages2.length };
|
|
234038
|
+
}
|
|
234039
|
+
function trimActivityLogByLines(entries, wrapWidth, renderWidth, maxLines) {
|
|
234040
|
+
if (maxLines <= 0) {
|
|
234041
|
+
return { entries: [], trimmed: entries.length > 0 };
|
|
234042
|
+
}
|
|
234043
|
+
const kept = [];
|
|
234044
|
+
let remaining = maxLines;
|
|
234045
|
+
for (let i5 = entries.length - 1;i5 >= 0; i5 -= 1) {
|
|
234046
|
+
const entry = entries[i5];
|
|
234047
|
+
const lineCount = estimateActivityEntryLines(entry, wrapWidth, renderWidth);
|
|
234048
|
+
if (lineCount <= remaining || kept.length === 0) {
|
|
234049
|
+
kept.unshift(entry);
|
|
234050
|
+
remaining -= Math.max(0, lineCount);
|
|
234051
|
+
} else {
|
|
234052
|
+
break;
|
|
234053
|
+
}
|
|
234054
|
+
}
|
|
234055
|
+
return { entries: kept, trimmed: kept.length < entries.length };
|
|
234056
|
+
}
|
|
234057
|
+
function isContinuationChunk(id) {
|
|
234058
|
+
const match = id.match(/::chunk-(\d+)$/);
|
|
234059
|
+
if (!match)
|
|
234060
|
+
return false;
|
|
234061
|
+
const idx = Number(match[1]);
|
|
234062
|
+
return Number.isFinite(idx) && idx > 0;
|
|
234063
|
+
}
|
|
234064
|
+
function groupConsecutiveToolMessages(messages2) {
|
|
234065
|
+
const groups = [];
|
|
234066
|
+
let currentToolGroup = [];
|
|
234067
|
+
for (const msg of messages2) {
|
|
234068
|
+
const isToolOnlyAssistant = msg.role === "assistant" && (!msg.content || !msg.content.trim()) && msg.toolCalls && msg.toolCalls.length > 0;
|
|
234069
|
+
if (isToolOnlyAssistant) {
|
|
234070
|
+
currentToolGroup.push(msg);
|
|
234071
|
+
} else {
|
|
234072
|
+
if (currentToolGroup.length > 0) {
|
|
234073
|
+
if (currentToolGroup.length === 1) {
|
|
234074
|
+
groups.push({ type: "single", message: currentToolGroup[0] });
|
|
234075
|
+
} else {
|
|
234076
|
+
groups.push({ type: "grouped", messages: currentToolGroup });
|
|
234077
|
+
}
|
|
234078
|
+
currentToolGroup = [];
|
|
234079
|
+
}
|
|
234080
|
+
groups.push({ type: "single", message: msg });
|
|
234081
|
+
}
|
|
234082
|
+
}
|
|
234083
|
+
if (currentToolGroup.length > 0) {
|
|
234084
|
+
if (currentToolGroup.length === 1) {
|
|
234085
|
+
groups.push({ type: "single", message: currentToolGroup[0] });
|
|
234086
|
+
} else {
|
|
234087
|
+
groups.push({ type: "grouped", messages: currentToolGroup });
|
|
234088
|
+
}
|
|
234089
|
+
}
|
|
234090
|
+
return groups;
|
|
234091
|
+
}
|
|
234092
|
+
|
|
234093
|
+
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/index.js
|
|
234094
|
+
var import_react37 = __toESM(require_react2(), 1);
|
|
234095
|
+
|
|
234096
|
+
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/Ascii.js
|
|
234097
|
+
var import_react30 = __toESM(require_react2(), 1);
|
|
234098
|
+
|
|
234099
|
+
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/utils/image.js
|
|
234100
|
+
var import_sharp = __toESM(require_lib10(), 1);
|
|
234101
|
+
import fetch2 from "node-fetch";
|
|
234102
|
+
async function fetchImage(src) {
|
|
234103
|
+
try {
|
|
234104
|
+
let imageBuffer;
|
|
234105
|
+
if (src.startsWith("http")) {
|
|
234106
|
+
const response = await fetch2(src);
|
|
234107
|
+
if (!response.ok) {
|
|
234108
|
+
throw new Error(`Failed to fetch image: ${response.statusText}`);
|
|
234109
|
+
}
|
|
234110
|
+
imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
234111
|
+
} else {
|
|
234112
|
+
imageBuffer = await import_sharp.default(src).toBuffer();
|
|
234113
|
+
}
|
|
234114
|
+
return import_sharp.default(imageBuffer);
|
|
234115
|
+
} catch {
|
|
234116
|
+
return;
|
|
234117
|
+
}
|
|
234118
|
+
}
|
|
234119
|
+
function calculateImageSize({ maxWidth, maxHeight, originalAspectRatio, specifiedWidth, specifiedHeight }) {
|
|
234120
|
+
if (specifiedWidth && specifiedHeight) {
|
|
234121
|
+
const width2 = Math.min(specifiedWidth, maxWidth);
|
|
234122
|
+
const height2 = Math.min(specifiedHeight, maxHeight);
|
|
234123
|
+
return { width: Math.round(width2), height: Math.round(height2) };
|
|
234124
|
+
}
|
|
234125
|
+
if (specifiedWidth) {
|
|
234126
|
+
let width2 = Math.min(specifiedWidth, maxWidth);
|
|
234127
|
+
let height2 = width2 / originalAspectRatio;
|
|
234128
|
+
if (height2 > maxHeight) {
|
|
234129
|
+
height2 = maxHeight;
|
|
234130
|
+
width2 = height2 * originalAspectRatio;
|
|
234131
|
+
}
|
|
234132
|
+
return { width: Math.round(width2), height: Math.round(height2) };
|
|
234133
|
+
}
|
|
234134
|
+
if (specifiedHeight) {
|
|
234135
|
+
let height2 = Math.min(specifiedHeight, maxHeight);
|
|
234136
|
+
let width2 = height2 * originalAspectRatio;
|
|
234137
|
+
if (width2 > maxWidth) {
|
|
234138
|
+
width2 = maxWidth;
|
|
234139
|
+
height2 = width2 / originalAspectRatio;
|
|
234140
|
+
}
|
|
234141
|
+
return { width: Math.round(width2), height: Math.round(height2) };
|
|
234142
|
+
}
|
|
234143
|
+
let height = maxHeight;
|
|
234144
|
+
let width = height * originalAspectRatio;
|
|
234145
|
+
if (width > maxWidth) {
|
|
234146
|
+
width = maxWidth;
|
|
234147
|
+
height = width / originalAspectRatio;
|
|
234148
|
+
}
|
|
234149
|
+
if (height > maxHeight) {
|
|
234150
|
+
height = maxHeight;
|
|
234151
|
+
width = height * originalAspectRatio;
|
|
234152
|
+
}
|
|
234153
|
+
return { width: Math.round(width), height: Math.round(height) };
|
|
234154
|
+
}
|
|
234155
|
+
|
|
234156
|
+
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/context/TerminalInfo.js
|
|
234157
|
+
var import_react29 = __toESM(require_react2(), 1);
|
|
234158
|
+
|
|
234159
|
+
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/utils/queryEscapeSequence.js
|
|
234160
|
+
function queryEscapeSequence(message, stdin, stdout, setRawMode) {
|
|
234161
|
+
return new Promise((resolve5) => {
|
|
234162
|
+
const responseTimeout = 100;
|
|
234163
|
+
let responseTimeoutId = undefined;
|
|
234164
|
+
const timeoutBetweenReplies = 50;
|
|
234165
|
+
let timeoutBetweenRepliesId = undefined;
|
|
234166
|
+
let runningReply = "";
|
|
234167
|
+
setRawMode(true);
|
|
234168
|
+
const restoreState = () => {
|
|
234169
|
+
setRawMode(false);
|
|
234170
|
+
stdin.removeListener("data", onData);
|
|
234171
|
+
stdin.removeListener("close", onClose);
|
|
234172
|
+
if (responseTimeoutId !== undefined) {
|
|
234173
|
+
clearTimeout(responseTimeoutId);
|
|
234174
|
+
}
|
|
234175
|
+
if (timeoutBetweenRepliesId !== undefined) {
|
|
234176
|
+
clearTimeout(timeoutBetweenRepliesId);
|
|
234177
|
+
}
|
|
234178
|
+
};
|
|
234179
|
+
const onData = (data) => {
|
|
234180
|
+
if (responseTimeoutId !== undefined) {
|
|
234181
|
+
clearTimeout(responseTimeoutId);
|
|
234182
|
+
}
|
|
234183
|
+
if (timeoutBetweenRepliesId !== undefined) {
|
|
234184
|
+
clearTimeout(timeoutBetweenRepliesId);
|
|
234185
|
+
}
|
|
234186
|
+
runningReply += data;
|
|
234187
|
+
timeoutBetweenRepliesId = setTimeout(() => {
|
|
234188
|
+
restoreState();
|
|
234189
|
+
resolve5(runningReply.length > 0 ? runningReply : undefined);
|
|
234190
|
+
}, timeoutBetweenReplies);
|
|
234191
|
+
};
|
|
234192
|
+
const onClose = () => {
|
|
234193
|
+
restoreState();
|
|
234194
|
+
resolve5(runningReply.length > 0 ? runningReply : undefined);
|
|
234195
|
+
};
|
|
234196
|
+
stdin.on("data", onData);
|
|
234197
|
+
stdin.on("close", onClose);
|
|
234198
|
+
responseTimeoutId = setTimeout(() => {
|
|
234199
|
+
restoreState();
|
|
234200
|
+
resolve5(undefined);
|
|
234201
|
+
}, responseTimeout);
|
|
234202
|
+
stdout.write(message);
|
|
234203
|
+
});
|
|
234204
|
+
}
|
|
234205
|
+
var queryEscapeSequence_default = queryEscapeSequence;
|
|
234206
|
+
|
|
234207
|
+
// node_modules/.pnpm/supports-color@10.2.2/node_modules/supports-color/index.js
|
|
234208
|
+
import process14 from "process";
|
|
234209
|
+
import os4 from "os";
|
|
234210
|
+
import tty2 from "tty";
|
|
234211
|
+
function hasFlag2(flag, argv = globalThis.Deno ? globalThis.Deno.args : process14.argv) {
|
|
234212
|
+
const prefix2 = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
234213
|
+
const position = argv.indexOf(prefix2 + flag);
|
|
234214
|
+
const terminatorPosition = argv.indexOf("--");
|
|
234215
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
234216
|
+
}
|
|
234217
|
+
var { env: env4 } = process14;
|
|
234218
|
+
var flagForceColor2;
|
|
234219
|
+
if (hasFlag2("no-color") || hasFlag2("no-colors") || hasFlag2("color=false") || hasFlag2("color=never")) {
|
|
234220
|
+
flagForceColor2 = 0;
|
|
234221
|
+
} else if (hasFlag2("color") || hasFlag2("colors") || hasFlag2("color=true") || hasFlag2("color=always")) {
|
|
234222
|
+
flagForceColor2 = 1;
|
|
234223
|
+
}
|
|
234224
|
+
function envForceColor2() {
|
|
234225
|
+
if (!("FORCE_COLOR" in env4)) {
|
|
234226
|
+
return;
|
|
234227
|
+
}
|
|
234228
|
+
if (env4.FORCE_COLOR === "true") {
|
|
234229
|
+
return 1;
|
|
234230
|
+
}
|
|
234231
|
+
if (env4.FORCE_COLOR === "false") {
|
|
234232
|
+
return 0;
|
|
234233
|
+
}
|
|
234234
|
+
if (env4.FORCE_COLOR.length === 0) {
|
|
234235
|
+
return 1;
|
|
234236
|
+
}
|
|
234237
|
+
const level = Math.min(Number.parseInt(env4.FORCE_COLOR, 10), 3);
|
|
234238
|
+
if (![0, 1, 2, 3].includes(level)) {
|
|
234239
|
+
return;
|
|
234240
|
+
}
|
|
234241
|
+
return level;
|
|
234242
|
+
}
|
|
234243
|
+
function translateLevel2(level) {
|
|
234244
|
+
if (level === 0) {
|
|
234245
|
+
return false;
|
|
234246
|
+
}
|
|
234247
|
+
return {
|
|
234248
|
+
level,
|
|
234249
|
+
hasBasic: true,
|
|
234250
|
+
has256: level >= 2,
|
|
234251
|
+
has16m: level >= 3
|
|
234252
|
+
};
|
|
234253
|
+
}
|
|
234254
|
+
function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
234255
|
+
const noFlagForceColor = envForceColor2();
|
|
234256
|
+
if (noFlagForceColor !== undefined) {
|
|
234257
|
+
flagForceColor2 = noFlagForceColor;
|
|
234258
|
+
}
|
|
234259
|
+
const forceColor = sniffFlags ? flagForceColor2 : noFlagForceColor;
|
|
234260
|
+
if (forceColor === 0) {
|
|
234261
|
+
return 0;
|
|
234262
|
+
}
|
|
234263
|
+
if (sniffFlags) {
|
|
234264
|
+
if (hasFlag2("color=16m") || hasFlag2("color=full") || hasFlag2("color=truecolor")) {
|
|
234265
|
+
return 3;
|
|
234266
|
+
}
|
|
234267
|
+
if (hasFlag2("color=256")) {
|
|
234268
|
+
return 2;
|
|
234269
|
+
}
|
|
234270
|
+
}
|
|
234271
|
+
if ("TF_BUILD" in env4 && "AGENT_NAME" in env4) {
|
|
234272
|
+
return 1;
|
|
234273
|
+
}
|
|
234274
|
+
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
234275
|
+
return 0;
|
|
234276
|
+
}
|
|
234277
|
+
const min = forceColor || 0;
|
|
234278
|
+
if (env4.TERM === "dumb") {
|
|
234279
|
+
return min;
|
|
234280
|
+
}
|
|
234281
|
+
if (process14.platform === "win32") {
|
|
234282
|
+
const osRelease = os4.release().split(".");
|
|
234283
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
234284
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
234285
|
+
}
|
|
234286
|
+
return 1;
|
|
234287
|
+
}
|
|
234288
|
+
if ("CI" in env4) {
|
|
234289
|
+
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => (key in env4))) {
|
|
234290
|
+
return 3;
|
|
234291
|
+
}
|
|
234292
|
+
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign2) => (sign2 in env4)) || env4.CI_NAME === "codeship") {
|
|
234293
|
+
return 1;
|
|
234294
|
+
}
|
|
234295
|
+
return min;
|
|
234296
|
+
}
|
|
234297
|
+
if ("TEAMCITY_VERSION" in env4) {
|
|
234298
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env4.TEAMCITY_VERSION) ? 1 : 0;
|
|
234299
|
+
}
|
|
234300
|
+
if (env4.COLORTERM === "truecolor") {
|
|
234301
|
+
return 3;
|
|
234302
|
+
}
|
|
234303
|
+
if (env4.TERM === "xterm-kitty") {
|
|
234304
|
+
return 3;
|
|
234305
|
+
}
|
|
234306
|
+
if (env4.TERM === "xterm-ghostty") {
|
|
234307
|
+
return 3;
|
|
234308
|
+
}
|
|
234309
|
+
if (env4.TERM === "wezterm") {
|
|
234310
|
+
return 3;
|
|
234311
|
+
}
|
|
234312
|
+
if ("TERM_PROGRAM" in env4) {
|
|
234313
|
+
const version3 = Number.parseInt((env4.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
234314
|
+
switch (env4.TERM_PROGRAM) {
|
|
234315
|
+
case "iTerm.app": {
|
|
234316
|
+
return version3 >= 3 ? 3 : 2;
|
|
234317
|
+
}
|
|
234318
|
+
case "Apple_Terminal": {
|
|
234319
|
+
return 2;
|
|
234320
|
+
}
|
|
234321
|
+
}
|
|
234322
|
+
}
|
|
234323
|
+
if (/-256(color)?$/i.test(env4.TERM)) {
|
|
234324
|
+
return 2;
|
|
234325
|
+
}
|
|
234326
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env4.TERM)) {
|
|
234327
|
+
return 1;
|
|
234328
|
+
}
|
|
234329
|
+
if ("COLORTERM" in env4) {
|
|
234330
|
+
return 1;
|
|
234331
|
+
}
|
|
234332
|
+
return min;
|
|
234333
|
+
}
|
|
234334
|
+
function createSupportsColor2(stream, options = {}) {
|
|
234335
|
+
const level = _supportsColor2(stream, {
|
|
234336
|
+
streamIsTTY: stream && stream.isTTY,
|
|
234337
|
+
...options
|
|
234338
|
+
});
|
|
234339
|
+
return translateLevel2(level);
|
|
234340
|
+
}
|
|
234341
|
+
var supportsColor2 = {
|
|
234342
|
+
stdout: createSupportsColor2({ isTTY: tty2.isatty(1) }),
|
|
234343
|
+
stderr: createSupportsColor2({ isTTY: tty2.isatty(2) })
|
|
234344
|
+
};
|
|
234345
|
+
var supports_color_default2 = supportsColor2;
|
|
234346
|
+
|
|
234347
|
+
// node_modules/.pnpm/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js
|
|
234348
|
+
import process15 from "process";
|
|
234349
|
+
function isUnicodeSupported() {
|
|
234350
|
+
const { env: env5 } = process15;
|
|
234351
|
+
const { TERM, TERM_PROGRAM } = env5;
|
|
234352
|
+
if (process15.platform !== "win32") {
|
|
234353
|
+
return TERM !== "linux";
|
|
234354
|
+
}
|
|
234355
|
+
return Boolean(env5.WT_SESSION) || Boolean(env5.TERMINUS_SUBLIME) || env5.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env5.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
234356
|
+
}
|
|
234357
|
+
|
|
234358
|
+
// node_modules/.pnpm/iterm2-version@5.0.0/node_modules/iterm2-version/index.js
|
|
234359
|
+
import path4 from "path";
|
|
234360
|
+
import fs5 from "fs";
|
|
234361
|
+
|
|
234362
|
+
// node_modules/.pnpm/app-path@4.0.0/node_modules/app-path/index.js
|
|
234363
|
+
var import_execa = __toESM(require_execa(), 1);
|
|
234364
|
+
import { fileURLToPath } from "url";
|
|
234365
|
+
import path3 from "path";
|
|
234366
|
+
var dirname29 = path3.dirname(fileURLToPath(import.meta.url));
|
|
234367
|
+
var improveError = (error3) => {
|
|
234368
|
+
if (error3.exitCode === 2) {
|
|
234369
|
+
error3.message = "Couldn't find the app";
|
|
234370
|
+
}
|
|
234371
|
+
return error3;
|
|
234372
|
+
};
|
|
234373
|
+
async function appPath(appName) {
|
|
234374
|
+
if (process.platform !== "darwin") {
|
|
234375
|
+
throw new Error("macOS only");
|
|
234376
|
+
}
|
|
234377
|
+
if (typeof appName !== "string") {
|
|
234378
|
+
throw new TypeError("Please supply an app name or bundle identifier");
|
|
234379
|
+
}
|
|
234380
|
+
try {
|
|
234381
|
+
const { stdout } = await import_execa.default("./main", [appName], { cwd: dirname29 });
|
|
234382
|
+
return stdout;
|
|
234383
|
+
} catch (error3) {
|
|
234384
|
+
throw improveError(error3);
|
|
234385
|
+
}
|
|
234386
|
+
}
|
|
234387
|
+
appPath.sync = (appName) => {
|
|
234388
|
+
if (process.platform !== "darwin") {
|
|
234389
|
+
throw new Error("macOS only");
|
|
234390
|
+
}
|
|
234391
|
+
if (typeof appName !== "string") {
|
|
234392
|
+
throw new TypeError("Please supply an app name or bundle identifier");
|
|
234393
|
+
}
|
|
234394
|
+
try {
|
|
234395
|
+
return import_execa.default.sync("./main", [appName], { cwd: dirname29 }).stdout;
|
|
234396
|
+
} catch (error3) {
|
|
234397
|
+
throw improveError(error3);
|
|
234398
|
+
}
|
|
234399
|
+
};
|
|
234400
|
+
|
|
234401
|
+
// node_modules/.pnpm/iterm2-version@5.0.0/node_modules/iterm2-version/index.js
|
|
234402
|
+
var import_plist = __toESM(require_plist(), 1);
|
|
234403
|
+
var version3;
|
|
234404
|
+
function iterm2Version() {
|
|
234405
|
+
if (process.platform !== "darwin") {
|
|
234406
|
+
return;
|
|
234407
|
+
}
|
|
234408
|
+
if (!version3) {
|
|
234409
|
+
if (process.env.TERM_PROGRAM === "iTerm.app" && process.env.TERM_PROGRAM_VERSION) {
|
|
234410
|
+
version3 = process.env.TERM_PROGRAM_VERSION;
|
|
234411
|
+
} else {
|
|
234412
|
+
const filePath = path4.join(appPath.sync("iTerm"), "Contents/Info.plist");
|
|
234413
|
+
version3 = import_plist.default.parse(fs5.readFileSync(filePath, "utf8")).CFBundleVersion;
|
|
234414
|
+
}
|
|
234415
|
+
}
|
|
234416
|
+
return version3;
|
|
234417
|
+
}
|
|
234418
|
+
|
|
234419
|
+
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/context/TerminalInfo.js
|
|
234420
|
+
function supportsITerm2(context3) {
|
|
234421
|
+
if (process.env["TERM_PROGRAM"] === "iTerm.app") {
|
|
234422
|
+
const version4 = iterm2Version();
|
|
234423
|
+
if (!version4 || Number(version4[0]) < 3)
|
|
234424
|
+
return false;
|
|
234425
|
+
return true;
|
|
234426
|
+
} else if (process.env["TERM_PROGRAM"] === "WezTerm") {
|
|
234427
|
+
const version4 = process.env["TERM_PROGRAM_VERSION"];
|
|
234428
|
+
if (!version4)
|
|
234429
|
+
return false;
|
|
234430
|
+
const date = parseInt(version4.split("-")[0]);
|
|
234431
|
+
if (!Number.isNaN(date) && date >= 20220319) {
|
|
234432
|
+
return true;
|
|
234433
|
+
}
|
|
234434
|
+
} else if (process.env["KONSOLE_VERSION"]) {
|
|
234435
|
+
const version4 = process.env["KONSOLE_VERSION"];
|
|
234436
|
+
if (!version4)
|
|
234437
|
+
return false;
|
|
234438
|
+
const date = parseInt(version4);
|
|
234439
|
+
if (!Number.isNaN(date) && date >= 220400) {
|
|
234440
|
+
return true;
|
|
234441
|
+
}
|
|
234442
|
+
} else if (process.env["TERM_PROGRAM"] === "rio") {
|
|
234443
|
+
const version4 = process.env["TERM_PROGRAM_VERSION"];
|
|
234444
|
+
if (!version4)
|
|
234445
|
+
return false;
|
|
234446
|
+
const [major, minor, patch] = version4.split(".").map((v7) => parseInt(v7, 10));
|
|
234447
|
+
if (!Number.isNaN(major) && !Number.isNaN(minor) && !Number.isNaN(patch) && (major > 0 || major === 0 && minor > 1 || major === 0 && minor === 1 && patch >= 13)) {
|
|
234448
|
+
return true;
|
|
234449
|
+
}
|
|
234450
|
+
} else if (process.env["TERM_PROGRAM"] === "vscode") {
|
|
234451
|
+
if (context3?.supportsSixelGraphics) {
|
|
234452
|
+
return true;
|
|
234453
|
+
}
|
|
234454
|
+
} else if (process.env["TERM_PROGRAM"] === "WarpTerminal") {
|
|
234455
|
+
const version4 = process.env["TERM_PROGRAM_VERSION"];
|
|
234456
|
+
if (version4) {
|
|
234457
|
+
const [, year, month, day] = version4.slice(1).split(".").map((v7) => parseInt(v7, 10));
|
|
234458
|
+
if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day) && (year > 2025 || year === 2025 && month > 3 || year === 2025 && month === 3 && day >= 5)) {
|
|
234459
|
+
return true;
|
|
234460
|
+
}
|
|
234461
|
+
}
|
|
234462
|
+
}
|
|
234463
|
+
return false;
|
|
234464
|
+
}
|
|
234465
|
+
var TerminalInfoContext = import_react29.createContext(undefined);
|
|
234466
|
+
var TerminalInfoProvider = ({ children: children2 }) => {
|
|
234467
|
+
const { stdin, setRawMode } = use_stdin_default();
|
|
234468
|
+
const { stdout } = use_stdout_default();
|
|
234469
|
+
const [terminalInfo, setTerminalInfo] = import_react29.useState(undefined);
|
|
234470
|
+
import_react29.useEffect(() => {
|
|
234471
|
+
async function getCellPixelDimensions() {
|
|
234472
|
+
try {
|
|
234473
|
+
const cellPixelDimensionsResponse = await queryEscapeSequence_default("\x1B[16t", stdin, stdout, setRawMode);
|
|
234474
|
+
if (!cellPixelDimensionsResponse) {
|
|
234475
|
+
throw new Error;
|
|
234476
|
+
}
|
|
234477
|
+
const parsedResponse = cellPixelDimensionsResponse.match(/\x1b\[6;(\d+);(\d+);?t/);
|
|
234478
|
+
if (!parsedResponse || !parsedResponse[1] || !parsedResponse[2]) {
|
|
234479
|
+
throw new Error;
|
|
234480
|
+
}
|
|
234481
|
+
const height = parseInt(parsedResponse[1], 10);
|
|
234482
|
+
const width = parseInt(parsedResponse[2], 10);
|
|
234483
|
+
if (Number.isNaN(height) || Number.isNaN(width)) {
|
|
234484
|
+
throw new Error;
|
|
234485
|
+
}
|
|
234486
|
+
return {
|
|
234487
|
+
width,
|
|
234488
|
+
height
|
|
234489
|
+
};
|
|
234490
|
+
} catch {
|
|
234491
|
+
const terminalPixelDimensionsResponse = await queryEscapeSequence_default("\x1B[14t", stdin, stdout, setRawMode);
|
|
234492
|
+
if (!terminalPixelDimensionsResponse) {
|
|
234493
|
+
return;
|
|
234494
|
+
}
|
|
234495
|
+
const parsedResponse = terminalPixelDimensionsResponse.match(/\x1b\[4;(\d+);(\d+);?t/);
|
|
234496
|
+
if (!parsedResponse || !parsedResponse[1] || !parsedResponse[2]) {
|
|
234497
|
+
return;
|
|
234498
|
+
}
|
|
234499
|
+
const height = parseInt(parsedResponse[1], 10);
|
|
234500
|
+
const width = parseInt(parsedResponse[2], 10);
|
|
234501
|
+
if (Number.isNaN(height) || Number.isNaN(width)) {
|
|
234502
|
+
return;
|
|
234503
|
+
}
|
|
234504
|
+
return {
|
|
234505
|
+
width: width / process.stdout.columns,
|
|
234506
|
+
height: height / process.stdout.rows
|
|
234507
|
+
};
|
|
234508
|
+
}
|
|
234509
|
+
}
|
|
234510
|
+
const queryTerminalInfo = async () => {
|
|
234511
|
+
let cellDimensions = await getCellPixelDimensions();
|
|
234512
|
+
if (!cellDimensions) {
|
|
234513
|
+
cellDimensions = {
|
|
234514
|
+
width: 6,
|
|
234515
|
+
height: 12
|
|
234516
|
+
};
|
|
234517
|
+
}
|
|
234518
|
+
const supportsUnicode = isUnicodeSupported();
|
|
234519
|
+
const isColorSupported = !!supports_color_default2.stdout;
|
|
234520
|
+
const kittyResponse = await queryEscapeSequence_default("\x1B_Gi=31,s=1,v=1,a=q,t=d,f=24;AAAA\x1B\\ \x1B[c", stdin, stdout, setRawMode);
|
|
234521
|
+
let supportsKittyGraphics = false;
|
|
234522
|
+
if (kittyResponse && kittyResponse.includes("OK")) {
|
|
234523
|
+
supportsKittyGraphics = true;
|
|
234524
|
+
}
|
|
234525
|
+
const deviceAttributesResponse = await queryEscapeSequence_default("\x1B[c", stdin, stdout, setRawMode);
|
|
234526
|
+
let supportsSixelGraphics = false;
|
|
234527
|
+
if (deviceAttributesResponse && deviceAttributesResponse.endsWith("c") && deviceAttributesResponse.slice(0, -1).split(";").find((attr) => attr === "4")) {
|
|
234528
|
+
supportsSixelGraphics = true;
|
|
234529
|
+
}
|
|
234530
|
+
const supportsITerm2Graphics = supportsITerm2({ supportsSixelGraphics });
|
|
234531
|
+
let scale = 1;
|
|
234532
|
+
if (supportsITerm2Graphics) {
|
|
234533
|
+
const reportCellSizeResponse = await queryEscapeSequence_default("\x1B]1337;ReportCellSize\x07", stdin, stdout, setRawMode);
|
|
234534
|
+
if (reportCellSizeResponse) {
|
|
234535
|
+
const match = reportCellSizeResponse.match(/ReportCellSize=([\d.]+);([\d.]+);([\d.]+)/);
|
|
234536
|
+
if (match && match[1] && match[2] && match[3]) {
|
|
234537
|
+
const width = parseFloat(match[2]);
|
|
234538
|
+
const height = parseFloat(match[1]);
|
|
234539
|
+
const parsedScale = parseFloat(match[3]);
|
|
234540
|
+
if (!Number.isNaN(width) && !Number.isNaN(height) && !isNaN(parsedScale)) {
|
|
234541
|
+
cellDimensions = { width, height };
|
|
234542
|
+
scale = parsedScale;
|
|
234543
|
+
}
|
|
234544
|
+
}
|
|
234545
|
+
}
|
|
234546
|
+
}
|
|
234547
|
+
const dimensions = {
|
|
234548
|
+
viewportWidth: cellDimensions.width * scale * process.stdout.columns,
|
|
234549
|
+
viewportHeight: cellDimensions.height * scale * process.stdout.rows,
|
|
234550
|
+
cellWidth: cellDimensions.width * scale,
|
|
234551
|
+
cellHeight: cellDimensions.height * scale
|
|
234552
|
+
};
|
|
234553
|
+
const capabilities2 = {
|
|
234554
|
+
supportsUnicode,
|
|
234555
|
+
supportsColor: isColorSupported,
|
|
234556
|
+
supportsKittyGraphics,
|
|
234557
|
+
supportsSixelGraphics,
|
|
234558
|
+
supportsITerm2Graphics
|
|
234559
|
+
};
|
|
234560
|
+
setTerminalInfo({
|
|
234561
|
+
dimensions,
|
|
234562
|
+
capabilities: capabilities2
|
|
234563
|
+
});
|
|
234564
|
+
};
|
|
234565
|
+
queryTerminalInfo();
|
|
234566
|
+
}, [stdin, stdout, setRawMode]);
|
|
234567
|
+
return import_react29.default.createElement(TerminalInfoContext.Provider, { value: terminalInfo }, terminalInfo ? children2 : null);
|
|
234568
|
+
};
|
|
234569
|
+
var useTerminalInfo = () => {
|
|
234570
|
+
const terminalInfo = import_react29.useContext(TerminalInfoContext);
|
|
234571
|
+
import_react29.useEffect(() => {
|
|
234572
|
+
if (terminalInfo)
|
|
234573
|
+
return;
|
|
234574
|
+
const timeoutId = setTimeout(() => {
|
|
234575
|
+
if (!terminalInfo) {
|
|
234576
|
+
throw new Error(`Terminal info not available. (Did you forget to wrap your component in <TerminalInfoProvider>?)
|
|
234577
|
+
` + "Apps using the `ink-picture` Image component must be wrapped in a <TerminalInfoProvider>.\n" + "See https://github.com/endernoke/ink-picture?tab=readme-ov-file#terminalinfoprovider for details.");
|
|
234578
|
+
}
|
|
234579
|
+
}, 2000);
|
|
234580
|
+
return () => clearTimeout(timeoutId);
|
|
234581
|
+
}, [terminalInfo]);
|
|
234582
|
+
return terminalInfo;
|
|
234583
|
+
};
|
|
234584
|
+
var useTerminalDimensions = () => {
|
|
234585
|
+
const terminalInfo = useTerminalInfo();
|
|
234586
|
+
return terminalInfo?.dimensions;
|
|
234587
|
+
};
|
|
234588
|
+
var useTerminalCapabilities = () => {
|
|
234589
|
+
const terminalInfo = useTerminalInfo();
|
|
234590
|
+
return terminalInfo?.capabilities;
|
|
234591
|
+
};
|
|
234592
|
+
|
|
234593
|
+
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/Ascii.js
|
|
234594
|
+
function AsciiImage(props) {
|
|
234595
|
+
const [imageOutput, setImageOutput] = import_react30.useState(null);
|
|
234596
|
+
const [hasError, setHasError] = import_react30.useState(false);
|
|
234597
|
+
const containerRef = import_react30.useRef(null);
|
|
234598
|
+
const terminalCapabilities = useTerminalCapabilities();
|
|
234599
|
+
const { onSupportDetected, src, width: propsWidth, height: propsHeight } = props;
|
|
234600
|
+
import_react30.useEffect(() => {
|
|
234601
|
+
if (!terminalCapabilities)
|
|
234602
|
+
return;
|
|
234603
|
+
const isSupported = true;
|
|
234604
|
+
onSupportDetected(isSupported);
|
|
234605
|
+
}, [onSupportDetected, terminalCapabilities]);
|
|
234606
|
+
import_react30.useEffect(() => {
|
|
234607
|
+
const generateImageOutput = async () => {
|
|
234608
|
+
const image2 = await fetchImage(src);
|
|
234609
|
+
if (!image2) {
|
|
234610
|
+
setHasError(true);
|
|
234611
|
+
return;
|
|
234612
|
+
}
|
|
234613
|
+
setHasError(false);
|
|
234614
|
+
const metadata = await image2.metadata();
|
|
234615
|
+
if (!containerRef.current)
|
|
234616
|
+
return;
|
|
234617
|
+
const { width: maxWidth, height: maxHeight } = measure_element_default(containerRef.current);
|
|
234618
|
+
const { width, height } = calculateImageSize({
|
|
234619
|
+
maxWidth,
|
|
234620
|
+
maxHeight,
|
|
234621
|
+
originalAspectRatio: metadata.width / (metadata.height / 2),
|
|
234622
|
+
specifiedWidth: propsWidth,
|
|
234623
|
+
specifiedHeight: propsHeight ? propsHeight / 2 : undefined
|
|
234624
|
+
});
|
|
234625
|
+
const resizedImage = await image2.resize(width, height, { fit: "fill" }).raw().toBuffer({ resolveWithObject: true });
|
|
234626
|
+
const output = await toAscii(resizedImage, terminalCapabilities?.supportsColor);
|
|
234627
|
+
setImageOutput(output);
|
|
235002
234628
|
};
|
|
235003
|
-
|
|
235004
|
-
|
|
235005
|
-
|
|
235006
|
-
|
|
235007
|
-
hint: "Check the error details"
|
|
235008
|
-
};
|
|
235009
|
-
}
|
|
235010
|
-
function formatErrorConcise(content, toolName) {
|
|
235011
|
-
const info = parseErrorInfo(content, toolName);
|
|
235012
|
-
const exitPart = info.exitCode !== undefined ? ` [${info.exitCode}]` : "";
|
|
235013
|
-
const hintPart = info.hint ? ` \u2192 ${info.hint}` : "";
|
|
235014
|
-
return `\u2717 ${info.message}${exitPart}${hintPart}`;
|
|
234629
|
+
generateImageOutput();
|
|
234630
|
+
}, [src, propsWidth, propsHeight, terminalCapabilities]);
|
|
234631
|
+
return import_react30.default.createElement(Box_default, { ref: containerRef, flexDirection: "column", flexGrow: 1 }, imageOutput ? imageOutput.split(`
|
|
234632
|
+
`).map((line, index) => import_react30.default.createElement(Text3, { key: index }, line)) : import_react30.default.createElement(Box_default, { flexDirection: "column", alignItems: "center", justifyContent: "center" }, hasError && import_react30.default.createElement(Text3, { color: "red" }, "X", import_react30.default.createElement(Newline, null), "Load failed"), import_react30.default.createElement(Text3, { color: "gray" }, props.alt || "Loading...")));
|
|
235015
234633
|
}
|
|
235016
|
-
function
|
|
235017
|
-
|
|
235018
|
-
|
|
235019
|
-
}
|
|
235020
|
-
|
|
235021
|
-
|
|
235022
|
-
|
|
235023
|
-
|
|
235024
|
-
|
|
235025
|
-
|
|
235026
|
-
|
|
235027
|
-
|
|
235028
|
-
|
|
235029
|
-
|
|
235030
|
-
|
|
235031
|
-
|
|
235032
|
-
|
|
235033
|
-
|
|
235034
|
-
return formatBashResult(content);
|
|
235035
|
-
case "web_search":
|
|
235036
|
-
return formatSearchResult(content);
|
|
235037
|
-
default:
|
|
235038
|
-
return null;
|
|
234634
|
+
async function toAscii(imageData, colored = true) {
|
|
234635
|
+
const { data, info } = imageData;
|
|
234636
|
+
const { width, height, channels: channels2 } = info;
|
|
234637
|
+
const ascii_chars = "$@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\\|()1{}[]?-_+~<>i!lI;:,\"^`'. ";
|
|
234638
|
+
let result = "";
|
|
234639
|
+
for (let y4 = 0;y4 < height; y4++) {
|
|
234640
|
+
for (let x6 = 0;x6 < width; x6++) {
|
|
234641
|
+
const pixelIndex = (y4 * width + x6) * channels2;
|
|
234642
|
+
const r6 = data[pixelIndex];
|
|
234643
|
+
const g5 = data[pixelIndex + 1];
|
|
234644
|
+
const b8 = data[pixelIndex + 2];
|
|
234645
|
+
const a5 = channels2 === 4 ? data[pixelIndex + 3] : 255;
|
|
234646
|
+
const intensity = r6 + g5 + b8 + a5 == 0 ? 0 : (r6 + g5 + b8 + a5) / (255 * 4);
|
|
234647
|
+
const pixel_char = ascii_chars[ascii_chars.length - 1 - Math.floor(intensity * (ascii_chars.length - 1))];
|
|
234648
|
+
result += colored ? source_default.rgb(r6, g5, b8)(pixel_char) : pixel_char;
|
|
234649
|
+
}
|
|
234650
|
+
result += `
|
|
234651
|
+
`;
|
|
235039
234652
|
}
|
|
234653
|
+
return result;
|
|
235040
234654
|
}
|
|
235041
|
-
|
|
235042
|
-
|
|
235043
|
-
|
|
235044
|
-
|
|
235045
|
-
|
|
235046
|
-
|
|
235047
|
-
|
|
235048
|
-
|
|
235049
|
-
|
|
235050
|
-
|
|
235051
|
-
|
|
235052
|
-
|
|
235053
|
-
|
|
235054
|
-
|
|
235055
|
-
|
|
235056
|
-
|
|
235057
|
-
|
|
235058
|
-
|
|
235059
|
-
|
|
235060
|
-
|
|
235061
|
-
|
|
235062
|
-
|
|
235063
|
-
|
|
234655
|
+
var Ascii_default = AsciiImage;
|
|
234656
|
+
|
|
234657
|
+
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/HalfBlock.js
|
|
234658
|
+
var import_react31 = __toESM(require_react2(), 1);
|
|
234659
|
+
function HalfBlockImage(props) {
|
|
234660
|
+
const [imageOutput, setImageOutput] = import_react31.useState(null);
|
|
234661
|
+
const [hasError, setHasError] = import_react31.useState(false);
|
|
234662
|
+
const containerRef = import_react31.useRef(null);
|
|
234663
|
+
const terminalCapabilities = useTerminalCapabilities();
|
|
234664
|
+
const { onSupportDetected, src, width: propsWidth, height: propsHeight } = props;
|
|
234665
|
+
import_react31.useEffect(() => {
|
|
234666
|
+
if (!terminalCapabilities)
|
|
234667
|
+
return;
|
|
234668
|
+
const isSupported = terminalCapabilities.supportsColor && terminalCapabilities.supportsUnicode;
|
|
234669
|
+
onSupportDetected?.(isSupported);
|
|
234670
|
+
}, [onSupportDetected, terminalCapabilities]);
|
|
234671
|
+
import_react31.useEffect(() => {
|
|
234672
|
+
const generateImageOutput = async () => {
|
|
234673
|
+
const image2 = await fetchImage(src);
|
|
234674
|
+
if (!image2) {
|
|
234675
|
+
setHasError(true);
|
|
234676
|
+
return;
|
|
234677
|
+
}
|
|
234678
|
+
setHasError(false);
|
|
234679
|
+
const metadata = await image2.metadata();
|
|
234680
|
+
if (!containerRef.current)
|
|
234681
|
+
return;
|
|
234682
|
+
const { width: maxWidth, height: maxHeight } = measure_element_default(containerRef.current);
|
|
234683
|
+
const { width, height } = calculateImageSize({
|
|
234684
|
+
maxWidth,
|
|
234685
|
+
maxHeight: maxHeight * 2,
|
|
234686
|
+
originalAspectRatio: metadata.width / metadata.height,
|
|
234687
|
+
specifiedWidth: propsWidth,
|
|
234688
|
+
specifiedHeight: propsHeight ? propsHeight * 2 : undefined
|
|
234689
|
+
});
|
|
234690
|
+
const resizedImage = await image2.resize(width, height).raw().toBuffer({ resolveWithObject: true });
|
|
234691
|
+
const output = await toHalfBlocks(resizedImage);
|
|
234692
|
+
setImageOutput(output);
|
|
234693
|
+
};
|
|
234694
|
+
generateImageOutput();
|
|
234695
|
+
}, [src, propsWidth, propsHeight]);
|
|
234696
|
+
return import_react31.default.createElement(Box_default, { ref: containerRef, flexDirection: "column", flexGrow: 1 }, imageOutput ? imageOutput.split(`
|
|
234697
|
+
`).map((line, index) => import_react31.default.createElement(Text3, { key: index }, line)) : import_react31.default.createElement(Box_default, { flexDirection: "column", alignItems: "center", justifyContent: "center" }, hasError && import_react31.default.createElement(Text3, { color: "red" }, "X", import_react31.default.createElement(Newline, null), "Load failed"), import_react31.default.createElement(Text3, { color: "gray" }, props.alt || "Loading...")));
|
|
235064
234698
|
}
|
|
235065
|
-
|
|
235066
|
-
|
|
235067
|
-
|
|
234699
|
+
var HALF_BLOCK = "\u2584";
|
|
234700
|
+
async function toHalfBlocks(imageData) {
|
|
234701
|
+
const { data, info } = imageData;
|
|
234702
|
+
const { width, height, channels: channels2 } = info;
|
|
234703
|
+
let result = "";
|
|
234704
|
+
for (let y4 = 0;y4 < height - 1; y4 += 2) {
|
|
234705
|
+
for (let x6 = 0;x6 < width; x6++) {
|
|
234706
|
+
const topPixelIndex = (y4 * width + x6) * channels2;
|
|
234707
|
+
const bottomPixelIndex = ((y4 + 1) * width + x6) * channels2;
|
|
234708
|
+
const r6 = data[topPixelIndex];
|
|
234709
|
+
const g5 = data[topPixelIndex + 1];
|
|
234710
|
+
const b8 = data[topPixelIndex + 2];
|
|
234711
|
+
const a5 = channels2 === 4 ? data[topPixelIndex + 3] : 255;
|
|
234712
|
+
const r22 = data[bottomPixelIndex];
|
|
234713
|
+
const g22 = data[bottomPixelIndex + 1];
|
|
234714
|
+
const b22 = data[bottomPixelIndex + 2];
|
|
234715
|
+
result += a5 === 0 ? source_default.reset(" ") : source_default.bgRgb(r6, g5, b8).rgb(r22, g22, b22)(HALF_BLOCK);
|
|
234716
|
+
}
|
|
234717
|
+
result += `
|
|
234718
|
+
`;
|
|
235068
234719
|
}
|
|
235069
|
-
return
|
|
234720
|
+
return result;
|
|
235070
234721
|
}
|
|
235071
|
-
|
|
235072
|
-
|
|
235073
|
-
|
|
235074
|
-
|
|
235075
|
-
|
|
235076
|
-
|
|
235077
|
-
|
|
234722
|
+
var HalfBlock_default = HalfBlockImage;
|
|
234723
|
+
|
|
234724
|
+
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/Braille.js
|
|
234725
|
+
var import_react32 = __toESM(require_react2(), 1);
|
|
234726
|
+
function BrailleImage(props) {
|
|
234727
|
+
const [imageOutput, setImageOutput] = import_react32.useState(null);
|
|
234728
|
+
const [hasError, setHasError] = import_react32.useState(false);
|
|
234729
|
+
const containerRef = import_react32.useRef(null);
|
|
234730
|
+
const terminalCapabilities = useTerminalCapabilities();
|
|
234731
|
+
const { onSupportDetected, src, width: propsWidth, height: propsHeight } = props;
|
|
234732
|
+
import_react32.useEffect(() => {
|
|
234733
|
+
if (!terminalCapabilities)
|
|
234734
|
+
return;
|
|
234735
|
+
const isSupported = terminalCapabilities.supportsUnicode;
|
|
234736
|
+
onSupportDetected?.(isSupported);
|
|
234737
|
+
}, [terminalCapabilities, onSupportDetected]);
|
|
234738
|
+
import_react32.useEffect(() => {
|
|
234739
|
+
const generateImageOutput = async () => {
|
|
234740
|
+
const image2 = await fetchImage(src);
|
|
234741
|
+
if (!image2) {
|
|
234742
|
+
setHasError(true);
|
|
234743
|
+
return;
|
|
234744
|
+
}
|
|
234745
|
+
setHasError(false);
|
|
234746
|
+
const metadata = await image2.metadata();
|
|
234747
|
+
if (!containerRef.current)
|
|
234748
|
+
return;
|
|
234749
|
+
const { width: maxWidth, height: maxHeight } = measure_element_default(containerRef.current);
|
|
234750
|
+
const { width, height } = calculateImageSize({
|
|
234751
|
+
maxWidth: maxWidth * 2,
|
|
234752
|
+
maxHeight: maxHeight * 4,
|
|
234753
|
+
originalAspectRatio: metadata.width / metadata.height,
|
|
234754
|
+
specifiedWidth: propsWidth ? propsWidth * 2 : undefined,
|
|
234755
|
+
specifiedHeight: propsHeight ? propsHeight * 4 : undefined
|
|
234756
|
+
});
|
|
234757
|
+
const resizedImage = await image2.resize(width, height).raw().toBuffer({ resolveWithObject: true });
|
|
234758
|
+
const output = await toBraille(resizedImage);
|
|
234759
|
+
setImageOutput(output);
|
|
234760
|
+
};
|
|
234761
|
+
generateImageOutput();
|
|
234762
|
+
}, [src, propsWidth, propsHeight]);
|
|
234763
|
+
return import_react32.default.createElement(Box_default, { ref: containerRef, flexDirection: "column", flexGrow: 1 }, imageOutput ? imageOutput.split(`
|
|
234764
|
+
`).map((line, index) => import_react32.default.createElement(Text3, { key: index }, line)) : import_react32.default.createElement(Box_default, { flexDirection: "column", alignItems: "center", justifyContent: "center" }, hasError && import_react32.default.createElement(Text3, { color: "red" }, "X", import_react32.default.createElement(Newline, null), "Load failed"), import_react32.default.createElement(Text3, { color: "gray" }, props.alt || "Loading...")));
|
|
235078
234765
|
}
|
|
235079
|
-
function
|
|
235080
|
-
|
|
235081
|
-
|
|
234766
|
+
async function toBraille(imageData) {
|
|
234767
|
+
const { data, info } = imageData;
|
|
234768
|
+
const { width, height, channels: channels2 } = info;
|
|
234769
|
+
let result = "";
|
|
234770
|
+
for (let y4 = 0;y4 < height - 3; y4 += 4) {
|
|
234771
|
+
for (let x6 = 0;x6 < width - 1; x6 += 2) {
|
|
234772
|
+
const dot1Index = (y4 * width + x6) * channels2;
|
|
234773
|
+
const dot2Index = ((y4 + 1) * width + x6) * channels2;
|
|
234774
|
+
const dot3Index = ((y4 + 2) * width + x6) * channels2;
|
|
234775
|
+
const dot4Index = (y4 * width + x6 + 1) * channels2;
|
|
234776
|
+
const dot5Index = ((y4 + 1) * width + x6 + 1) * channels2;
|
|
234777
|
+
const dot6Index = ((y4 + 2) * width + x6 + 1) * channels2;
|
|
234778
|
+
const dot7Index = ((y4 + 3) * width + x6) * channels2;
|
|
234779
|
+
const dot8Index = ((y4 + 3) * width + x6 + 1) * channels2;
|
|
234780
|
+
const getRgba = (index) => {
|
|
234781
|
+
const r6 = data[index];
|
|
234782
|
+
const g5 = data[index + 1];
|
|
234783
|
+
const b8 = data[index + 2];
|
|
234784
|
+
const a5 = channels2 === 4 ? data[index + 3] : 1;
|
|
234785
|
+
return { r: r6, g: g5, b: b8, a: a5 };
|
|
234786
|
+
};
|
|
234787
|
+
const dot1 = rgbaToBlackOrWhite(getRgba(dot1Index));
|
|
234788
|
+
const dot2 = rgbaToBlackOrWhite(getRgba(dot2Index));
|
|
234789
|
+
const dot3 = rgbaToBlackOrWhite(getRgba(dot3Index));
|
|
234790
|
+
const dot4 = rgbaToBlackOrWhite(getRgba(dot4Index));
|
|
234791
|
+
const dot5 = rgbaToBlackOrWhite(getRgba(dot5Index));
|
|
234792
|
+
const dot6 = rgbaToBlackOrWhite(getRgba(dot6Index));
|
|
234793
|
+
const dot7 = rgbaToBlackOrWhite(getRgba(dot7Index));
|
|
234794
|
+
const dot8 = rgbaToBlackOrWhite(getRgba(dot8Index));
|
|
234795
|
+
const brailleChar = String.fromCharCode(10240 + (dot8 << 7) + (dot7 << 6) + (dot6 << 5) + (dot5 << 4) + (dot4 << 3) + (dot3 << 2) + (dot2 << 1) + dot1);
|
|
234796
|
+
result += brailleChar;
|
|
234797
|
+
}
|
|
234798
|
+
result += `
|
|
234799
|
+
`;
|
|
235082
234800
|
}
|
|
235083
|
-
return
|
|
234801
|
+
return result;
|
|
235084
234802
|
}
|
|
235085
|
-
function
|
|
235086
|
-
const
|
|
235087
|
-
|
|
235088
|
-
|
|
235089
|
-
|
|
235090
|
-
|
|
235091
|
-
|
|
235092
|
-
|
|
234803
|
+
function rgbaToBlackOrWhite({ r: r6, g: g5, b: b8, a: a5 }) {
|
|
234804
|
+
const red = r6;
|
|
234805
|
+
const green = g5;
|
|
234806
|
+
const blue = b8;
|
|
234807
|
+
const alpha = a5;
|
|
234808
|
+
const luminance = 0.2126 * red + 0.7152 * green + 0.0722 * blue;
|
|
234809
|
+
const alphaAdjustedLuminance = luminance * alpha + 255 * (1 - alpha);
|
|
234810
|
+
if (alphaAdjustedLuminance > 128) {
|
|
234811
|
+
return 1;
|
|
234812
|
+
} else {
|
|
234813
|
+
return 0;
|
|
235093
234814
|
}
|
|
235094
|
-
return null;
|
|
235095
234815
|
}
|
|
235096
|
-
|
|
235097
|
-
|
|
235098
|
-
|
|
235099
|
-
|
|
235100
|
-
|
|
235101
|
-
|
|
235102
|
-
|
|
235103
|
-
|
|
235104
|
-
|
|
235105
|
-
|
|
234816
|
+
var Braille_default = BrailleImage;
|
|
234817
|
+
|
|
234818
|
+
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/Sixel.js
|
|
234819
|
+
var import_react34 = __toESM(require_react2(), 1);
|
|
234820
|
+
var import_sixel = __toESM(require_lib13(), 1);
|
|
234821
|
+
|
|
234822
|
+
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/hooks/usePosition.js
|
|
234823
|
+
var import_react33 = __toESM(require_react2(), 1);
|
|
234824
|
+
var usePosition = (ref) => {
|
|
234825
|
+
const [position, setPosition] = import_react33.useState(undefined);
|
|
234826
|
+
const updatePosition = import_react33.useCallback(() => {
|
|
234827
|
+
if (!ref.current?.yogaNode) {
|
|
234828
|
+
return;
|
|
234829
|
+
}
|
|
234830
|
+
const { current: node2 } = ref;
|
|
234831
|
+
const { yogaNode } = node2;
|
|
234832
|
+
let absoluteCol = 0;
|
|
234833
|
+
let absoluteRow = 0;
|
|
234834
|
+
let appWidth = 0;
|
|
234835
|
+
let appHeight = 0;
|
|
234836
|
+
let currentNode = node2;
|
|
234837
|
+
while (currentNode) {
|
|
234838
|
+
if (currentNode.yogaNode) {
|
|
234839
|
+
absoluteCol += currentNode.yogaNode.getComputedLeft();
|
|
234840
|
+
absoluteRow += currentNode.yogaNode.getComputedTop();
|
|
234841
|
+
appWidth = currentNode.yogaNode.getComputedWidth();
|
|
234842
|
+
appHeight = currentNode.yogaNode.getComputedHeight();
|
|
234843
|
+
}
|
|
234844
|
+
currentNode = currentNode.parentNode;
|
|
234845
|
+
}
|
|
234846
|
+
const newPosition = {
|
|
234847
|
+
col: absoluteCol,
|
|
234848
|
+
row: absoluteRow,
|
|
234849
|
+
width: yogaNode.getComputedWidth(),
|
|
234850
|
+
height: yogaNode.getComputedHeight(),
|
|
234851
|
+
appWidth,
|
|
234852
|
+
appHeight
|
|
234853
|
+
};
|
|
234854
|
+
setPosition((previousPosition) => {
|
|
234855
|
+
if (!previousPosition || previousPosition.col !== newPosition.col || previousPosition.row !== newPosition.row || previousPosition.width !== newPosition.width || previousPosition.height !== newPosition.height || previousPosition.appWidth !== newPosition.appWidth || previousPosition.appHeight !== newPosition.appHeight) {
|
|
234856
|
+
return newPosition;
|
|
234857
|
+
}
|
|
234858
|
+
return previousPosition;
|
|
234859
|
+
});
|
|
234860
|
+
}, [ref]);
|
|
234861
|
+
import_react33.useEffect(() => {
|
|
234862
|
+
updatePosition();
|
|
234863
|
+
});
|
|
234864
|
+
return position;
|
|
234865
|
+
};
|
|
234866
|
+
var usePosition_default = usePosition;
|
|
234867
|
+
|
|
234868
|
+
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/Sixel.js
|
|
234869
|
+
function SixelImage(props) {
|
|
234870
|
+
const [imageOutput, setImageOutput] = import_react34.useState(undefined);
|
|
234871
|
+
const [hasError, setHasError] = import_react34.useState(false);
|
|
234872
|
+
const { stdout } = use_stdout_default();
|
|
234873
|
+
const containerRef = import_react34.useRef(null);
|
|
234874
|
+
const componentPosition = usePosition_default(containerRef);
|
|
234875
|
+
const terminalDimensions = useTerminalDimensions();
|
|
234876
|
+
const terminalCapabilities = useTerminalCapabilities();
|
|
234877
|
+
const [actualSizeInCells, setActualSizeInCells] = import_react34.useState(null);
|
|
234878
|
+
const shouldCleanupRef = import_react34.useRef(true);
|
|
234879
|
+
const { src, onSupportDetected, width: propsWidth, height: propsHeight } = props;
|
|
234880
|
+
import_react34.useEffect(() => {
|
|
234881
|
+
if (!terminalCapabilities)
|
|
234882
|
+
return;
|
|
234883
|
+
const isSupported = terminalCapabilities.supportsSixelGraphics;
|
|
234884
|
+
onSupportDetected?.(isSupported);
|
|
234885
|
+
}, [terminalCapabilities, onSupportDetected]);
|
|
234886
|
+
import_react34.useEffect(() => {
|
|
234887
|
+
const generateImageOutput = async () => {
|
|
234888
|
+
if (!componentPosition)
|
|
234889
|
+
return;
|
|
234890
|
+
if (!terminalDimensions)
|
|
234891
|
+
return;
|
|
234892
|
+
const image2 = await fetchImage(src);
|
|
234893
|
+
if (!image2) {
|
|
234894
|
+
setHasError(true);
|
|
234895
|
+
return;
|
|
234896
|
+
}
|
|
234897
|
+
setHasError(false);
|
|
234898
|
+
const metadata = await image2.metadata();
|
|
234899
|
+
const { width: maxWidth, height: maxHeight } = componentPosition;
|
|
234900
|
+
const { width, height } = calculateImageSize({
|
|
234901
|
+
maxWidth: maxWidth * terminalDimensions.cellWidth,
|
|
234902
|
+
maxHeight: maxHeight * terminalDimensions.cellHeight,
|
|
234903
|
+
originalAspectRatio: metadata.width / metadata.height,
|
|
234904
|
+
specifiedWidth: propsWidth ? propsWidth * terminalDimensions.cellWidth : undefined,
|
|
234905
|
+
specifiedHeight: propsHeight ? propsHeight * terminalDimensions.cellHeight : undefined
|
|
234906
|
+
});
|
|
234907
|
+
const resizedImage = await image2.resize(width, height).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
|
|
234908
|
+
setActualSizeInCells({
|
|
234909
|
+
width: Math.ceil(resizedImage.info.width / terminalDimensions.cellWidth),
|
|
234910
|
+
height: Math.ceil(resizedImage.info.height / terminalDimensions.cellHeight)
|
|
234911
|
+
});
|
|
234912
|
+
const output = await toSixel(resizedImage);
|
|
234913
|
+
setImageOutput(output);
|
|
234914
|
+
};
|
|
234915
|
+
generateImageOutput();
|
|
234916
|
+
}, [
|
|
234917
|
+
src,
|
|
234918
|
+
propsWidth,
|
|
234919
|
+
propsHeight,
|
|
234920
|
+
componentPosition?.width,
|
|
234921
|
+
componentPosition?.height,
|
|
234922
|
+
terminalDimensions
|
|
234923
|
+
]);
|
|
234924
|
+
import_react34.useLayoutEffect(() => {
|
|
234925
|
+
if (!imageOutput)
|
|
234926
|
+
return;
|
|
234927
|
+
if (!componentPosition)
|
|
234928
|
+
return;
|
|
234929
|
+
if (stdout.rows - componentPosition.appHeight + componentPosition.row < 0 || componentPosition.col > stdout.columns)
|
|
234930
|
+
return;
|
|
234931
|
+
function onExit() {
|
|
234932
|
+
shouldCleanupRef.current = false;
|
|
234933
|
+
}
|
|
234934
|
+
function onSigInt() {
|
|
234935
|
+
shouldCleanupRef.current = false;
|
|
234936
|
+
process.exit();
|
|
234937
|
+
}
|
|
234938
|
+
process.on("exit", onExit);
|
|
234939
|
+
process.on("SIGINT", onSigInt);
|
|
234940
|
+
process.on("SIGTERM", onSigInt);
|
|
234941
|
+
let previousRenderBoundingBox = undefined;
|
|
234942
|
+
const renderTimeout = setTimeout(() => {
|
|
234943
|
+
stdout.write("\x1B7");
|
|
234944
|
+
stdout.write(cursorUp2(componentPosition.appHeight - componentPosition.row));
|
|
234945
|
+
stdout.write("\r");
|
|
234946
|
+
stdout.write(cursorForward2(componentPosition.col));
|
|
234947
|
+
stdout.write(imageOutput);
|
|
234948
|
+
stdout.write("\x1B8");
|
|
234949
|
+
previousRenderBoundingBox = {
|
|
234950
|
+
row: stdout.rows - componentPosition.appHeight + componentPosition.row,
|
|
234951
|
+
col: componentPosition.col,
|
|
234952
|
+
width: actualSizeInCells.width,
|
|
234953
|
+
height: actualSizeInCells.height
|
|
234954
|
+
};
|
|
234955
|
+
}, 100);
|
|
234956
|
+
return () => {
|
|
234957
|
+
process.removeListener("exit", onExit);
|
|
234958
|
+
process.removeListener("SIGINT", onSigInt);
|
|
234959
|
+
process.removeListener("SIGTERM", onSigInt);
|
|
234960
|
+
if (!shouldCleanupRef.current)
|
|
234961
|
+
return;
|
|
234962
|
+
clearTimeout(renderTimeout);
|
|
234963
|
+
if (!previousRenderBoundingBox)
|
|
234964
|
+
return;
|
|
234965
|
+
stdout.write("\x1B7");
|
|
234966
|
+
stdout.write(cursorUp2(componentPosition.appHeight - componentPosition.row));
|
|
234967
|
+
for (let i5 = 0;i5 < previousRenderBoundingBox.height; i5++) {
|
|
234968
|
+
stdout.write("\r");
|
|
234969
|
+
stdout.write(cursorForward2(previousRenderBoundingBox.col));
|
|
234970
|
+
stdout.write(" ".repeat(previousRenderBoundingBox.width));
|
|
234971
|
+
stdout.write(`
|
|
234972
|
+
`);
|
|
234973
|
+
}
|
|
234974
|
+
stdout.write("\x1B8");
|
|
234975
|
+
};
|
|
234976
|
+
});
|
|
234977
|
+
return import_react34.default.createElement(Box_default, { ref: containerRef, flexDirection: "column", flexGrow: 1 }, imageOutput ? import_react34.default.createElement(Text3, { color: "gray", wrap: "wrap" }, props.alt || "Loading...") : import_react34.default.createElement(Box_default, { flexDirection: "column", alignItems: "center", justifyContent: "center" }, hasError && import_react34.default.createElement(Text3, { color: "red" }, "X", import_react34.default.createElement(Newline, null), "Load failed"), import_react34.default.createElement(Text3, { color: "gray" }, props.alt || "Loading...")));
|
|
235106
234978
|
}
|
|
235107
|
-
function
|
|
235108
|
-
const
|
|
235109
|
-
|
|
235110
|
-
|
|
235111
|
-
|
|
235112
|
-
|
|
235113
|
-
`)) {
|
|
235114
|
-
return null;
|
|
235115
|
-
}
|
|
235116
|
-
const lines = trimmed.split(`
|
|
235117
|
-
`).length;
|
|
235118
|
-
if (lines > 20) {
|
|
235119
|
-
return `\u2713 Output: ${lines} lines`;
|
|
235120
|
-
}
|
|
235121
|
-
return null;
|
|
234979
|
+
async function toSixel(imageData) {
|
|
234980
|
+
const { data, info } = imageData;
|
|
234981
|
+
const { width, height } = info;
|
|
234982
|
+
const u8Data = new Uint8Array(data);
|
|
234983
|
+
const sixelData = import_sixel.image2sixel(u8Data, width, height);
|
|
234984
|
+
return sixelData;
|
|
235122
234985
|
}
|
|
235123
|
-
function
|
|
235124
|
-
|
|
235125
|
-
if (resultCount > 0) {
|
|
235126
|
-
return `\uD83D\uDD0D Found ${resultCount} result${resultCount !== 1 ? "s" : ""}`;
|
|
235127
|
-
}
|
|
235128
|
-
return null;
|
|
234986
|
+
function cursorForward2(count = 1) {
|
|
234987
|
+
return "\x1B[" + count + "C";
|
|
235129
234988
|
}
|
|
235130
|
-
function
|
|
235131
|
-
return
|
|
234989
|
+
function cursorUp2(count = 1) {
|
|
234990
|
+
return "\x1B[" + count + "A";
|
|
235132
234991
|
}
|
|
234992
|
+
var Sixel_default = SixelImage;
|
|
235133
234993
|
|
|
235134
|
-
//
|
|
235135
|
-
|
|
235136
|
-
|
|
235137
|
-
|
|
235138
|
-
|
|
235139
|
-
const
|
|
235140
|
-
const
|
|
235141
|
-
const
|
|
235142
|
-
|
|
235143
|
-
|
|
235144
|
-
|
|
235145
|
-
|
|
235146
|
-
|
|
235147
|
-
|
|
235148
|
-
|
|
235149
|
-
|
|
235150
|
-
|
|
235151
|
-
|
|
235152
|
-
|
|
235153
|
-
|
|
234994
|
+
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/ITerm2.js
|
|
234995
|
+
var import_react35 = __toESM(require_react2(), 1);
|
|
234996
|
+
function ITerm2Image(props) {
|
|
234997
|
+
const [imageOutput, setImageOutput] = import_react35.useState(undefined);
|
|
234998
|
+
const [hasError, setHasError] = import_react35.useState(false);
|
|
234999
|
+
const { stdout } = use_stdout_default();
|
|
235000
|
+
const containerRef = import_react35.useRef(null);
|
|
235001
|
+
const componentPosition = usePosition_default(containerRef);
|
|
235002
|
+
const terminalDimensions = useTerminalDimensions();
|
|
235003
|
+
const terminalCapabilities = useTerminalCapabilities();
|
|
235004
|
+
const [actualSizeInCells, setActualSizeInCells] = import_react35.useState(null);
|
|
235005
|
+
const shouldCleanupRef = import_react35.useRef(true);
|
|
235006
|
+
const { onSupportDetected, src, width: propsWidth, height: propsHeight } = props;
|
|
235007
|
+
import_react35.useEffect(() => {
|
|
235008
|
+
if (!terminalCapabilities)
|
|
235009
|
+
return;
|
|
235010
|
+
const isSupported = terminalCapabilities.supportsITerm2Graphics;
|
|
235011
|
+
onSupportDetected?.(isSupported);
|
|
235012
|
+
}, [terminalCapabilities, onSupportDetected]);
|
|
235013
|
+
import_react35.useEffect(() => {
|
|
235014
|
+
const generateImageOutput = async () => {
|
|
235015
|
+
if (!componentPosition)
|
|
235016
|
+
return;
|
|
235017
|
+
if (!terminalDimensions)
|
|
235018
|
+
return;
|
|
235019
|
+
const image2 = await fetchImage(src);
|
|
235020
|
+
if (!image2) {
|
|
235021
|
+
setHasError(true);
|
|
235022
|
+
return;
|
|
235023
|
+
}
|
|
235024
|
+
setHasError(false);
|
|
235025
|
+
const metadata = await image2.metadata();
|
|
235026
|
+
const { width: maxWidth, height: maxHeight } = componentPosition;
|
|
235027
|
+
const { width, height } = calculateImageSize({
|
|
235028
|
+
maxWidth: maxWidth * terminalDimensions.cellWidth,
|
|
235029
|
+
maxHeight: maxHeight * terminalDimensions.cellHeight,
|
|
235030
|
+
originalAspectRatio: metadata.width / metadata.height,
|
|
235031
|
+
specifiedWidth: propsWidth ? propsWidth * terminalDimensions.cellWidth : undefined,
|
|
235032
|
+
specifiedHeight: propsHeight ? propsHeight * terminalDimensions.cellHeight : undefined
|
|
235033
|
+
});
|
|
235034
|
+
const resizedImage = await image2.png().toBuffer({ resolveWithObject: true });
|
|
235035
|
+
setActualSizeInCells({
|
|
235036
|
+
width: Math.ceil(width / terminalDimensions.cellWidth),
|
|
235037
|
+
height: Math.ceil(height / terminalDimensions.cellHeight)
|
|
235038
|
+
});
|
|
235039
|
+
const output = toITerm2(resizedImage, { width, height });
|
|
235040
|
+
setImageOutput(output);
|
|
235041
|
+
};
|
|
235042
|
+
generateImageOutput();
|
|
235043
|
+
}, [
|
|
235044
|
+
src,
|
|
235045
|
+
propsWidth,
|
|
235046
|
+
propsHeight,
|
|
235047
|
+
componentPosition?.width,
|
|
235048
|
+
componentPosition?.height,
|
|
235049
|
+
terminalDimensions
|
|
235050
|
+
]);
|
|
235051
|
+
import_react35.useLayoutEffect(() => {
|
|
235052
|
+
if (!imageOutput)
|
|
235053
|
+
return;
|
|
235054
|
+
if (!componentPosition)
|
|
235055
|
+
return;
|
|
235056
|
+
if (stdout.rows - componentPosition.appHeight + componentPosition.row < 0 || componentPosition.col > stdout.columns)
|
|
235057
|
+
return;
|
|
235058
|
+
function onExit() {
|
|
235059
|
+
shouldCleanupRef.current = false;
|
|
235154
235060
|
}
|
|
235155
|
-
|
|
235156
|
-
|
|
235157
|
-
|
|
235158
|
-
|
|
235159
|
-
|
|
235160
|
-
|
|
235161
|
-
|
|
235162
|
-
|
|
235163
|
-
|
|
235164
|
-
|
|
235165
|
-
|
|
235166
|
-
|
|
235167
|
-
|
|
235168
|
-
|
|
235169
|
-
|
|
235170
|
-
|
|
235171
|
-
|
|
235172
|
-
|
|
235173
|
-
|
|
235174
|
-
|
|
235175
|
-
|
|
235176
|
-
|
|
235177
|
-
|
|
235061
|
+
function onSigInt() {
|
|
235062
|
+
shouldCleanupRef.current = false;
|
|
235063
|
+
process.exit();
|
|
235064
|
+
}
|
|
235065
|
+
process.on("exit", onExit);
|
|
235066
|
+
process.on("SIGINT", onSigInt);
|
|
235067
|
+
process.on("SIGTERM", onSigInt);
|
|
235068
|
+
let previousRenderBoundingBox = undefined;
|
|
235069
|
+
const renderTimeout = setTimeout(() => {
|
|
235070
|
+
stdout.write("\x1B7");
|
|
235071
|
+
stdout.write(cursorUp3(componentPosition.appHeight - componentPosition.row));
|
|
235072
|
+
stdout.write("\r");
|
|
235073
|
+
stdout.write(cursorForward3(componentPosition.col));
|
|
235074
|
+
stdout.write(imageOutput);
|
|
235075
|
+
stdout.write("\x1B8");
|
|
235076
|
+
previousRenderBoundingBox = {
|
|
235077
|
+
row: stdout.rows - componentPosition.appHeight + componentPosition.row,
|
|
235078
|
+
col: componentPosition.col,
|
|
235079
|
+
width: actualSizeInCells.width,
|
|
235080
|
+
height: actualSizeInCells.height
|
|
235081
|
+
};
|
|
235082
|
+
}, 100);
|
|
235083
|
+
return () => {
|
|
235084
|
+
process.removeListener("exit", onExit);
|
|
235085
|
+
process.removeListener("SIGINT", onSigInt);
|
|
235086
|
+
process.removeListener("SIGTERM", onSigInt);
|
|
235087
|
+
if (!shouldCleanupRef.current)
|
|
235088
|
+
return;
|
|
235089
|
+
clearTimeout(renderTimeout);
|
|
235090
|
+
if (!previousRenderBoundingBox)
|
|
235091
|
+
return;
|
|
235092
|
+
stdout.write("\x1B7");
|
|
235093
|
+
stdout.write(cursorUp3(componentPosition.appHeight - componentPosition.row));
|
|
235094
|
+
for (let i5 = 0;i5 < previousRenderBoundingBox.height; i5++) {
|
|
235095
|
+
stdout.write("\r");
|
|
235096
|
+
stdout.write(cursorForward3(previousRenderBoundingBox.col));
|
|
235097
|
+
stdout.write(" ".repeat(previousRenderBoundingBox.width));
|
|
235098
|
+
stdout.write(`
|
|
235178
235099
|
`);
|
|
235179
|
-
|
|
235180
|
-
|
|
235100
|
+
}
|
|
235101
|
+
stdout.write("\x1B8");
|
|
235102
|
+
};
|
|
235103
|
+
});
|
|
235104
|
+
return import_react35.default.createElement(Box_default, { ref: containerRef, flexDirection: "column", flexGrow: 1 }, imageOutput ? import_react35.default.createElement(Text3, { color: "gray", wrap: "wrap" }, props.alt || "Loading...") : import_react35.default.createElement(Box_default, { flexDirection: "column", alignItems: "center", justifyContent: "center" }, hasError && import_react35.default.createElement(Text3, { color: "red" }, "X", import_react35.default.createElement(Newline, null), "Load failed"), import_react35.default.createElement(Text3, { color: "gray" }, props.alt || "Loading...")));
|
|
235181
235105
|
}
|
|
235182
|
-
function
|
|
235183
|
-
|
|
235184
|
-
|
|
235185
|
-
}
|
|
235186
|
-
|
|
235187
|
-
const contentLines = content.length > 0 ? content.split(`
|
|
235188
|
-
`) : [];
|
|
235189
|
-
const hasContent = contentLines.length > 0;
|
|
235190
|
-
const prefixWidth = message.role === "user" || message.role === "assistant" ? 2 : 0;
|
|
235191
|
-
const effectiveWidth = maxWidth ? Math.max(1, maxWidth - prefixWidth) : maxWidth;
|
|
235192
|
-
const wrappedLines = typeof message.__lineCount === "number" ? message.__lineCount : contentLines.length > 0 ? countWrappedLines(contentLines, effectiveWidth) : 0;
|
|
235193
|
-
let lines = hasContent ? Math.max(1, wrappedLines) : 0;
|
|
235194
|
-
const toolCalls = message.toolCalls ?? [];
|
|
235195
|
-
const toolResults = message.toolResults ?? [];
|
|
235196
|
-
if (toolCalls.length > 0) {
|
|
235197
|
-
lines += estimateToolPanelLines(toolCalls, toolResults, hasContent, maxWidth);
|
|
235198
|
-
} else if (toolResults.length > 0) {
|
|
235199
|
-
lines += estimateToolResultPanelLines(toolResults, hasContent, maxWidth);
|
|
235200
|
-
}
|
|
235201
|
-
if (message.role === "user" || message.role === "assistant") {
|
|
235202
|
-
if (!isContinuationChunk(message.id)) {
|
|
235203
|
-
lines += 2;
|
|
235204
|
-
}
|
|
235205
|
-
}
|
|
235206
|
-
return lines;
|
|
235106
|
+
function toITerm2(imageData, options) {
|
|
235107
|
+
const { data, info } = imageData;
|
|
235108
|
+
const { width, height } = options;
|
|
235109
|
+
const iTerm2Data = "\x1B]1337;File=" + `size=${info.size};` + `width=${width}px;height=${height}px;` + `preserveAspectRatio=1;` + `inline=1:` + data.toString("base64") + "\x07";
|
|
235110
|
+
return iTerm2Data;
|
|
235207
235111
|
}
|
|
235208
|
-
function
|
|
235209
|
-
|
|
235210
|
-
return lines.length;
|
|
235211
|
-
}
|
|
235212
|
-
let total = 0;
|
|
235213
|
-
for (const line of lines) {
|
|
235214
|
-
const visible = stripAnsi4(line).length;
|
|
235215
|
-
const wrapped = Math.max(1, Math.ceil(visible / maxWidth));
|
|
235216
|
-
total += wrapped;
|
|
235217
|
-
}
|
|
235218
|
-
return total;
|
|
235112
|
+
function cursorForward3(count = 1) {
|
|
235113
|
+
return "\x1B[" + count + "C";
|
|
235219
235114
|
}
|
|
235220
|
-
function
|
|
235221
|
-
return
|
|
235115
|
+
function cursorUp3(count = 1) {
|
|
235116
|
+
return "\x1B[" + count + "A";
|
|
235222
235117
|
}
|
|
235223
|
-
|
|
235224
|
-
|
|
235225
|
-
|
|
235226
|
-
|
|
235227
|
-
|
|
235228
|
-
|
|
235229
|
-
|
|
235230
|
-
|
|
235231
|
-
|
|
235232
|
-
|
|
235233
|
-
|
|
235234
|
-
|
|
235118
|
+
var ITerm2_default = ITerm2Image;
|
|
235119
|
+
|
|
235120
|
+
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/Kitty.js
|
|
235121
|
+
var import_react36 = __toESM(require_react2(), 1);
|
|
235122
|
+
|
|
235123
|
+
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/utils/generateKittyId.js
|
|
235124
|
+
var MIN_ID = 1048576;
|
|
235125
|
+
var MAX_ID = 16777216;
|
|
235126
|
+
|
|
235127
|
+
class KittyIdGenerator {
|
|
235128
|
+
currentId = MIN_ID;
|
|
235129
|
+
freedIds = new Set;
|
|
235130
|
+
generateId() {
|
|
235131
|
+
if (this.freedIds.size > 0) {
|
|
235132
|
+
const reusedId = this.freedIds.values().next().value;
|
|
235133
|
+
this.freedIds.delete(reusedId);
|
|
235134
|
+
return reusedId;
|
|
235235
235135
|
}
|
|
235236
|
-
|
|
235237
|
-
|
|
235238
|
-
|
|
235239
|
-
|
|
235240
|
-
default:
|
|
235241
|
-
return 0;
|
|
235242
|
-
}
|
|
235243
|
-
}
|
|
235244
|
-
function estimateToolResultEntryLines(entry, effectiveWidth) {
|
|
235245
|
-
const content = entry.toolResult ? truncateToolResult(entry.toolResult) : "";
|
|
235246
|
-
const lines = content.split(`
|
|
235247
|
-
`);
|
|
235248
|
-
const wrapped = countWrappedLines(lines, effectiveWidth);
|
|
235249
|
-
return Math.max(1, wrapped) + 2;
|
|
235250
|
-
}
|
|
235251
|
-
function estimateDisplayMessagesLines(messages2, maxWidth) {
|
|
235252
|
-
return messages2.reduce((sum, message) => sum + estimateMessageLines(message, maxWidth), 0);
|
|
235253
|
-
}
|
|
235254
|
-
function trimDisplayMessagesByLines(messages2, maxLines, maxWidth) {
|
|
235255
|
-
if (maxLines <= 0) {
|
|
235256
|
-
return { messages: [], trimmed: messages2.length > 0 };
|
|
235136
|
+
if (this.currentId >= MAX_ID) {
|
|
235137
|
+
throw new Error("Kitty ID overflow: Maximum ID value reached");
|
|
235138
|
+
}
|
|
235139
|
+
return this.currentId++;
|
|
235257
235140
|
}
|
|
235258
|
-
|
|
235259
|
-
|
|
235260
|
-
|
|
235261
|
-
const message = messages2[i5];
|
|
235262
|
-
const lineCount = estimateMessageLines(message, maxWidth);
|
|
235263
|
-
if (lineCount <= remaining || kept.length === 0) {
|
|
235264
|
-
kept.unshift(message);
|
|
235265
|
-
remaining -= Math.max(0, lineCount);
|
|
235266
|
-
} else {
|
|
235267
|
-
break;
|
|
235141
|
+
freeId(id) {
|
|
235142
|
+
if (id >= MIN_ID && id < this.currentId) {
|
|
235143
|
+
return this.freedIds.add(id).size > this.freedIds.size - 1;
|
|
235268
235144
|
}
|
|
235145
|
+
return false;
|
|
235269
235146
|
}
|
|
235270
|
-
|
|
235271
|
-
|
|
235272
|
-
function trimActivityLogByLines(entries, wrapWidth, renderWidth, maxLines) {
|
|
235273
|
-
if (maxLines <= 0) {
|
|
235274
|
-
return { entries: [], trimmed: entries.length > 0 };
|
|
235147
|
+
getActiveIdCount() {
|
|
235148
|
+
return this.currentId - MIN_ID - this.freedIds.size;
|
|
235275
235149
|
}
|
|
235276
|
-
|
|
235277
|
-
|
|
235278
|
-
for (let i5 = entries.length - 1;i5 >= 0; i5 -= 1) {
|
|
235279
|
-
const entry = entries[i5];
|
|
235280
|
-
const lineCount = estimateActivityEntryLines(entry, wrapWidth, renderWidth);
|
|
235281
|
-
if (lineCount <= remaining || kept.length === 0) {
|
|
235282
|
-
kept.unshift(entry);
|
|
235283
|
-
remaining -= Math.max(0, lineCount);
|
|
235284
|
-
} else {
|
|
235285
|
-
break;
|
|
235286
|
-
}
|
|
235150
|
+
getAvailableIdCount() {
|
|
235151
|
+
return MAX_ID - this.currentId + this.freedIds.size;
|
|
235287
235152
|
}
|
|
235288
|
-
return { entries: kept, trimmed: kept.length < entries.length };
|
|
235289
|
-
}
|
|
235290
|
-
function isContinuationChunk(id) {
|
|
235291
|
-
const match = id.match(/::chunk-(\d+)$/);
|
|
235292
|
-
if (!match)
|
|
235293
|
-
return false;
|
|
235294
|
-
const idx = Number(match[1]);
|
|
235295
|
-
return Number.isFinite(idx) && idx > 0;
|
|
235296
235153
|
}
|
|
235297
|
-
|
|
235298
|
-
|
|
235299
|
-
|
|
235300
|
-
|
|
235301
|
-
|
|
235302
|
-
|
|
235303
|
-
|
|
235304
|
-
|
|
235305
|
-
|
|
235306
|
-
|
|
235307
|
-
|
|
235308
|
-
|
|
235309
|
-
|
|
235154
|
+
var generator = new KittyIdGenerator;
|
|
235155
|
+
var generateId2 = () => generator.generateId();
|
|
235156
|
+
var generateKittyId_default = generateId2;
|
|
235157
|
+
|
|
235158
|
+
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/Kitty.js
|
|
235159
|
+
function KittyImage(props) {
|
|
235160
|
+
const [imageId, setImageId] = import_react36.useState(undefined);
|
|
235161
|
+
const [hasError, setHasError] = import_react36.useState(false);
|
|
235162
|
+
const { stdout } = use_stdout_default();
|
|
235163
|
+
const containerRef = import_react36.useRef(null);
|
|
235164
|
+
const componentPosition = usePosition_default(containerRef);
|
|
235165
|
+
const terminalDimensions = useTerminalDimensions();
|
|
235166
|
+
const terminalCapabilities = useTerminalCapabilities();
|
|
235167
|
+
const { src, onSupportDetected, width: propsWidth, height: propsHeight } = props;
|
|
235168
|
+
import_react36.useEffect(() => {
|
|
235169
|
+
if (!terminalCapabilities)
|
|
235170
|
+
return;
|
|
235171
|
+
const isSupported = terminalCapabilities.supportsKittyGraphics;
|
|
235172
|
+
onSupportDetected?.(isSupported);
|
|
235173
|
+
}, [terminalCapabilities, onSupportDetected]);
|
|
235174
|
+
import_react36.useEffect(() => {
|
|
235175
|
+
const generateImageOutput = async () => {
|
|
235176
|
+
if (!componentPosition)
|
|
235177
|
+
return;
|
|
235178
|
+
if (!terminalDimensions)
|
|
235179
|
+
return;
|
|
235180
|
+
const image2 = await fetchImage(src);
|
|
235181
|
+
if (!image2) {
|
|
235182
|
+
setHasError(true);
|
|
235183
|
+
return;
|
|
235184
|
+
}
|
|
235185
|
+
setHasError(false);
|
|
235186
|
+
const metadata = await image2.metadata();
|
|
235187
|
+
const { width: maxWidth, height: maxHeight } = componentPosition;
|
|
235188
|
+
const { width, height } = calculateImageSize({
|
|
235189
|
+
maxWidth: maxWidth * terminalDimensions.cellWidth,
|
|
235190
|
+
maxHeight: maxHeight * terminalDimensions.cellHeight,
|
|
235191
|
+
originalAspectRatio: metadata.width / metadata.height,
|
|
235192
|
+
specifiedWidth: propsWidth ? propsWidth * terminalDimensions.cellWidth : undefined,
|
|
235193
|
+
specifiedHeight: propsHeight ? propsHeight * terminalDimensions.cellHeight : undefined
|
|
235194
|
+
});
|
|
235195
|
+
const resizedImage = image2.resize(width, height);
|
|
235196
|
+
try {
|
|
235197
|
+
const imageId2 = generateKittyId_default();
|
|
235198
|
+
const data = await resizedImage.png().toBuffer();
|
|
235199
|
+
const chunkSize = 4096;
|
|
235200
|
+
const base64Data = data.toString("base64");
|
|
235201
|
+
const firstChunk = base64Data.slice(0, chunkSize);
|
|
235202
|
+
stdout.write(`\x1B_Gf=100,t=d,i=${imageId2},m=1,q=2;${firstChunk}\x1B\\`);
|
|
235203
|
+
let bufferOffset = chunkSize;
|
|
235204
|
+
while (bufferOffset < base64Data.length - chunkSize) {
|
|
235205
|
+
const chunk = base64Data.slice(bufferOffset, bufferOffset + chunkSize);
|
|
235206
|
+
bufferOffset += chunkSize;
|
|
235207
|
+
stdout.write(`\x1B_Gm=1,q=2;${chunk}\x1B\\`);
|
|
235310
235208
|
}
|
|
235311
|
-
|
|
235209
|
+
const lastChunk = base64Data.slice(bufferOffset);
|
|
235210
|
+
stdout.write(`\x1B_Gm=0,q=2;${lastChunk}\x1B\\`);
|
|
235211
|
+
setImageId(imageId2);
|
|
235212
|
+
} catch {
|
|
235213
|
+
setHasError(true);
|
|
235214
|
+
return;
|
|
235312
235215
|
}
|
|
235313
|
-
|
|
235314
|
-
|
|
235216
|
+
};
|
|
235217
|
+
generateImageOutput();
|
|
235218
|
+
}, [
|
|
235219
|
+
src,
|
|
235220
|
+
propsWidth,
|
|
235221
|
+
propsHeight,
|
|
235222
|
+
componentPosition?.width,
|
|
235223
|
+
componentPosition?.height,
|
|
235224
|
+
terminalDimensions
|
|
235225
|
+
]);
|
|
235226
|
+
import_react36.useEffect(() => {
|
|
235227
|
+
if (!imageId)
|
|
235228
|
+
return;
|
|
235229
|
+
if (!componentPosition)
|
|
235230
|
+
return;
|
|
235231
|
+
stdout.write("\x1B7");
|
|
235232
|
+
stdout.write(cursorUp4(componentPosition.appHeight - componentPosition.row));
|
|
235233
|
+
stdout.write("\r");
|
|
235234
|
+
stdout.write(cursorForward4(componentPosition.col));
|
|
235235
|
+
const placementId = 1;
|
|
235236
|
+
stdout.write(`\x1B_Ga=p,i=${imageId},p=${placementId},C=1,q=2\x1B\\`);
|
|
235237
|
+
stdout.write("\x1B8");
|
|
235238
|
+
});
|
|
235239
|
+
import_react36.useEffect(() => {
|
|
235240
|
+
return () => {
|
|
235241
|
+
if (!imageId)
|
|
235242
|
+
return;
|
|
235243
|
+
stdout.write(`\x1B_Ga=d,d=I,i=${imageId}\x1B\\`);
|
|
235244
|
+
};
|
|
235245
|
+
}, [imageId, stdout]);
|
|
235246
|
+
return import_react36.default.createElement(Box_default, { ref: containerRef, flexDirection: "column", flexGrow: 1 }, imageId ? import_react36.default.createElement(Text3, { color: "gray", wrap: "wrap" }, props.alt || "Loading...") : import_react36.default.createElement(Box_default, { flexDirection: "column", alignItems: "center", justifyContent: "center" }, hasError && import_react36.default.createElement(Text3, { color: "red" }, "X", import_react36.default.createElement(Newline, null), "Load failed"), import_react36.default.createElement(Text3, { color: "gray" }, props.alt || "Loading...")));
|
|
235247
|
+
}
|
|
235248
|
+
function cursorForward4(count = 1) {
|
|
235249
|
+
return "\x1B[" + count + "C";
|
|
235250
|
+
}
|
|
235251
|
+
function cursorUp4(count = 1) {
|
|
235252
|
+
return "\x1B[" + count + "A";
|
|
235253
|
+
}
|
|
235254
|
+
var Kitty_default = KittyImage;
|
|
235255
|
+
|
|
235256
|
+
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/utils/getBestProtocol.js
|
|
235257
|
+
function getBestProtocol(caps) {
|
|
235258
|
+
if (process.env["TERM_PROGRAM"] === "iTerm.app" && caps.supportsITerm2Graphics) {
|
|
235259
|
+
return "iterm2";
|
|
235260
|
+
} else if (process.env["TERM_PROGRAM"] === "WarpTerminal" && caps.supportsITerm2Graphics) {
|
|
235261
|
+
return "iterm2";
|
|
235262
|
+
} else if (process.env["TERM_PROGRAM"] === "WezTerm" && caps.supportsITerm2Graphics) {
|
|
235263
|
+
return "iterm2";
|
|
235264
|
+
} else if (process.env["KONSOLE_VERSION"] && caps.supportsKittyGraphics) {
|
|
235265
|
+
return "kitty";
|
|
235266
|
+
} else if (caps.supportsKittyGraphics) {
|
|
235267
|
+
return "kitty";
|
|
235268
|
+
} else if (caps.supportsITerm2Graphics) {
|
|
235269
|
+
return "iterm2";
|
|
235270
|
+
} else if (caps.supportsSixelGraphics) {
|
|
235271
|
+
return "sixel";
|
|
235272
|
+
} else if (caps.supportsUnicode && caps.supportsColor) {
|
|
235273
|
+
return "halfBlock";
|
|
235274
|
+
} else if (caps.supportsUnicode) {
|
|
235275
|
+
return "braille";
|
|
235276
|
+
} else {
|
|
235277
|
+
return "ascii";
|
|
235315
235278
|
}
|
|
235316
|
-
|
|
235317
|
-
|
|
235318
|
-
|
|
235319
|
-
|
|
235320
|
-
|
|
235279
|
+
}
|
|
235280
|
+
|
|
235281
|
+
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.6.0_@types+react@19.2.13_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/components/image/index.js
|
|
235282
|
+
var imageProtocols = {
|
|
235283
|
+
ascii: Ascii_default,
|
|
235284
|
+
braille: Braille_default,
|
|
235285
|
+
halfBlock: HalfBlock_default,
|
|
235286
|
+
iterm2: ITerm2_default,
|
|
235287
|
+
kitty: Kitty_default,
|
|
235288
|
+
sixel: Sixel_default
|
|
235289
|
+
};
|
|
235290
|
+
var ImageRenderer = (props) => {
|
|
235291
|
+
const ProtocolComponent = imageProtocols[props.protocol] || imageProtocols["ascii"];
|
|
235292
|
+
return import_react37.default.createElement(ProtocolComponent, { ...props });
|
|
235293
|
+
};
|
|
235294
|
+
function Image({ protocol: specifiedProtocol = "auto", ...props }) {
|
|
235295
|
+
const terminalCapabilitiesContext = useTerminalCapabilities();
|
|
235296
|
+
const [protocol, setProtocol] = import_react37.useState(terminalCapabilitiesContext ? getBestProtocol(terminalCapabilitiesContext) : "auto");
|
|
235297
|
+
const getFallbackProtocol = import_react37.useCallback((currentProtocol) => {
|
|
235298
|
+
switch (currentProtocol) {
|
|
235299
|
+
case "kitty":
|
|
235300
|
+
return "iterm2";
|
|
235301
|
+
case "iterm2":
|
|
235302
|
+
return "sixel";
|
|
235303
|
+
case "sixel":
|
|
235304
|
+
return "halfBlock";
|
|
235305
|
+
case "halfBlock":
|
|
235306
|
+
return "braille";
|
|
235307
|
+
case "braille":
|
|
235308
|
+
return "ascii";
|
|
235309
|
+
default:
|
|
235310
|
+
return "ascii";
|
|
235311
|
+
}
|
|
235312
|
+
}, []);
|
|
235313
|
+
const handleSupportDetected = import_react37.useCallback((isSupported) => {
|
|
235314
|
+
if (isSupported) {
|
|
235315
|
+
return;
|
|
235321
235316
|
}
|
|
235317
|
+
const nextProtocol = getFallbackProtocol(protocol);
|
|
235318
|
+
setProtocol(nextProtocol);
|
|
235319
|
+
}, [protocol, getFallbackProtocol]);
|
|
235320
|
+
if (specifiedProtocol !== "auto") {
|
|
235321
|
+
return import_react37.default.createElement(ImageRenderer, { protocol: specifiedProtocol, ...props, onSupportDetected: () => {} });
|
|
235322
235322
|
}
|
|
235323
|
-
return
|
|
235323
|
+
return import_react37.default.createElement(ImageRenderer, { protocol, ...props, onSupportDetected: handleSupportDetected });
|
|
235324
235324
|
}
|
|
235325
|
-
|
|
235325
|
+
var image_default = Image;
|
|
235326
235326
|
// packages/terminal/src/components/TerminalImage.tsx
|
|
235327
235327
|
var jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
|
|
235328
235328
|
function TerminalImage({ src, width, height, alt }) {
|
|
235329
|
-
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(
|
|
235330
|
-
|
|
235331
|
-
|
|
235332
|
-
|
|
235333
|
-
|
|
235334
|
-
|
|
235335
|
-
|
|
235336
|
-
|
|
235337
|
-
|
|
235338
|
-
|
|
235339
|
-
|
|
235340
|
-
|
|
235341
|
-
|
|
235342
|
-
|
|
235343
|
-
|
|
235344
|
-
|
|
235329
|
+
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(TerminalInfoProvider, {
|
|
235330
|
+
children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
235331
|
+
flexDirection: "column",
|
|
235332
|
+
marginY: 1,
|
|
235333
|
+
children: [
|
|
235334
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(image_default, {
|
|
235335
|
+
src,
|
|
235336
|
+
width: width || 60,
|
|
235337
|
+
height: height || 20,
|
|
235338
|
+
alt: alt || src
|
|
235339
|
+
}, undefined, false, undefined, this),
|
|
235340
|
+
alt && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text3, {
|
|
235341
|
+
dimColor: true,
|
|
235342
|
+
children: alt
|
|
235343
|
+
}, undefined, false, undefined, this)
|
|
235344
|
+
]
|
|
235345
|
+
}, undefined, true, undefined, this)
|
|
235346
|
+
}, undefined, false, undefined, this);
|
|
235345
235347
|
}
|
|
235346
235348
|
|
|
235347
235349
|
// packages/terminal/src/components/Messages.tsx
|
|
@@ -267612,39 +267614,17 @@ Interactive Mode:
|
|
|
267612
267614
|
// packages/terminal/src/index.tsx
|
|
267613
267615
|
var jsx_dev_runtime51 = __toESM(require_jsx_dev_runtime(), 1);
|
|
267614
267616
|
setRuntime(bunRuntime);
|
|
267615
|
-
var VERSION4 = "1.1.
|
|
267617
|
+
var VERSION4 = "1.1.42";
|
|
267616
267618
|
var SYNC_START = "\x1B[?2026h";
|
|
267617
267619
|
var SYNC_END = "\x1B[?2026l";
|
|
267618
267620
|
function enableSynchronizedOutput() {
|
|
267619
267621
|
const originalWrite = process.stdout.write.bind(process.stdout);
|
|
267620
|
-
let buffer = "";
|
|
267621
|
-
let flushTimeout = null;
|
|
267622
|
-
const flush = () => {
|
|
267623
|
-
if (buffer) {
|
|
267624
|
-
const safe = sanitizeTerminalOutput(buffer);
|
|
267625
|
-
originalWrite(SYNC_START + safe + SYNC_END);
|
|
267626
|
-
buffer = "";
|
|
267627
|
-
}
|
|
267628
|
-
flushTimeout = null;
|
|
267629
|
-
};
|
|
267630
267622
|
process.stdout.write = function(chunk, encodingOrCallback, callback) {
|
|
267631
267623
|
const raw = typeof chunk === "string" ? chunk : chunk.toString();
|
|
267632
|
-
|
|
267633
|
-
|
|
267634
|
-
clearTimeout(flushTimeout);
|
|
267635
|
-
}
|
|
267636
|
-
flushTimeout = setTimeout(flush, 0);
|
|
267637
|
-
const cb2 = typeof encodingOrCallback === "function" ? encodingOrCallback : callback;
|
|
267638
|
-
if (cb2) {
|
|
267639
|
-
setImmediate(() => cb2());
|
|
267640
|
-
}
|
|
267641
|
-
return true;
|
|
267624
|
+
const safe = sanitizeTerminalOutput(raw);
|
|
267625
|
+
return originalWrite(SYNC_START + safe + SYNC_END, encodingOrCallback, callback);
|
|
267642
267626
|
};
|
|
267643
267627
|
return () => {
|
|
267644
|
-
if (flushTimeout) {
|
|
267645
|
-
clearTimeout(flushTimeout);
|
|
267646
|
-
}
|
|
267647
|
-
flush();
|
|
267648
267628
|
process.stdout.write = originalWrite;
|
|
267649
267629
|
};
|
|
267650
267630
|
}
|
|
@@ -267735,12 +267715,11 @@ if (options.print !== null) {
|
|
|
267735
267715
|
} else {
|
|
267736
267716
|
const useSyncOutput = process.env.ASSISTANTS_NO_SYNC !== "1";
|
|
267737
267717
|
const disableSyncOutput = useSyncOutput ? enableSynchronizedOutput() : () => {};
|
|
267738
|
-
const
|
|
267739
|
-
|
|
267740
|
-
|
|
267741
|
-
|
|
267742
|
-
|
|
267743
|
-
}, undefined, false, undefined, this), {
|
|
267718
|
+
const appElement = /* @__PURE__ */ jsx_dev_runtime51.jsxDEV(App2, {
|
|
267719
|
+
cwd: options.cwd,
|
|
267720
|
+
version: VERSION4
|
|
267721
|
+
}, undefined, false, undefined, this);
|
|
267722
|
+
const { waitUntilExit } = render_default(appElement, {
|
|
267744
267723
|
patchConsole: true,
|
|
267745
267724
|
exitOnCtrlC: false
|
|
267746
267725
|
});
|
|
@@ -267754,4 +267733,4 @@ export {
|
|
|
267754
267733
|
main
|
|
267755
267734
|
};
|
|
267756
267735
|
|
|
267757
|
-
//# debugId=
|
|
267736
|
+
//# debugId=3B52320FF540EF9A64756E2164756E21
|