@rhseung/ps-cli 1.2.1 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,1150 +7,37 @@ import {
7
7
  getDefaultLanguage,
8
8
  getEditor,
9
9
  getProblemDir,
10
- getSolvedAcHandle,
11
- setAutoOpenEditor,
12
- setDefaultLanguage,
13
- setEditor,
14
- setProblemDir,
15
- setSolvedAcHandle
16
- } from "../chunk-63CK6URL.js";
17
- import {
18
- __commonJS,
19
- __toESM
20
- } from "../chunk-FYS2JH42.js";
21
-
22
- // node_modules/lodash.isequal/index.js
23
- var require_lodash = __commonJS({
24
- "node_modules/lodash.isequal/index.js"(exports, module) {
25
- "use strict";
26
- var LARGE_ARRAY_SIZE = 200;
27
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
28
- var COMPARE_PARTIAL_FLAG = 1;
29
- var COMPARE_UNORDERED_FLAG = 2;
30
- var MAX_SAFE_INTEGER = 9007199254740991;
31
- var argsTag = "[object Arguments]";
32
- var arrayTag = "[object Array]";
33
- var asyncTag = "[object AsyncFunction]";
34
- var boolTag = "[object Boolean]";
35
- var dateTag = "[object Date]";
36
- var errorTag = "[object Error]";
37
- var funcTag = "[object Function]";
38
- var genTag = "[object GeneratorFunction]";
39
- var mapTag = "[object Map]";
40
- var numberTag = "[object Number]";
41
- var nullTag = "[object Null]";
42
- var objectTag = "[object Object]";
43
- var promiseTag = "[object Promise]";
44
- var proxyTag = "[object Proxy]";
45
- var regexpTag = "[object RegExp]";
46
- var setTag = "[object Set]";
47
- var stringTag = "[object String]";
48
- var symbolTag = "[object Symbol]";
49
- var undefinedTag = "[object Undefined]";
50
- var weakMapTag = "[object WeakMap]";
51
- var arrayBufferTag = "[object ArrayBuffer]";
52
- var dataViewTag = "[object DataView]";
53
- var float32Tag = "[object Float32Array]";
54
- var float64Tag = "[object Float64Array]";
55
- var int8Tag = "[object Int8Array]";
56
- var int16Tag = "[object Int16Array]";
57
- var int32Tag = "[object Int32Array]";
58
- var uint8Tag = "[object Uint8Array]";
59
- var uint8ClampedTag = "[object Uint8ClampedArray]";
60
- var uint16Tag = "[object Uint16Array]";
61
- var uint32Tag = "[object Uint32Array]";
62
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
63
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
64
- var reIsUint = /^(?:0|[1-9]\d*)$/;
65
- var typedArrayTags = {};
66
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
67
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
68
- var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
69
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
70
- var root = freeGlobal || freeSelf || Function("return this")();
71
- var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
72
- var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
73
- var moduleExports = freeModule && freeModule.exports === freeExports;
74
- var freeProcess = moduleExports && freeGlobal.process;
75
- var nodeUtil = (function() {
76
- try {
77
- return freeProcess && freeProcess.binding && freeProcess.binding("util");
78
- } catch (e) {
79
- }
80
- })();
81
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
82
- function arrayFilter(array, predicate) {
83
- var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
84
- while (++index < length) {
85
- var value = array[index];
86
- if (predicate(value, index, array)) {
87
- result[resIndex++] = value;
88
- }
89
- }
90
- return result;
91
- }
92
- function arrayPush(array, values) {
93
- var index = -1, length = values.length, offset = array.length;
94
- while (++index < length) {
95
- array[offset + index] = values[index];
96
- }
97
- return array;
98
- }
99
- function arraySome(array, predicate) {
100
- var index = -1, length = array == null ? 0 : array.length;
101
- while (++index < length) {
102
- if (predicate(array[index], index, array)) {
103
- return true;
104
- }
105
- }
106
- return false;
107
- }
108
- function baseTimes(n, iteratee) {
109
- var index = -1, result = Array(n);
110
- while (++index < n) {
111
- result[index] = iteratee(index);
112
- }
113
- return result;
114
- }
115
- function baseUnary(func) {
116
- return function(value) {
117
- return func(value);
118
- };
119
- }
120
- function cacheHas(cache, key) {
121
- return cache.has(key);
122
- }
123
- function getValue(object, key) {
124
- return object == null ? void 0 : object[key];
125
- }
126
- function mapToArray(map) {
127
- var index = -1, result = Array(map.size);
128
- map.forEach(function(value, key) {
129
- result[++index] = [key, value];
130
- });
131
- return result;
132
- }
133
- function overArg(func, transform) {
134
- return function(arg) {
135
- return func(transform(arg));
136
- };
137
- }
138
- function setToArray(set) {
139
- var index = -1, result = Array(set.size);
140
- set.forEach(function(value) {
141
- result[++index] = value;
142
- });
143
- return result;
144
- }
145
- var arrayProto = Array.prototype;
146
- var funcProto = Function.prototype;
147
- var objectProto = Object.prototype;
148
- var coreJsData = root["__core-js_shared__"];
149
- var funcToString = funcProto.toString;
150
- var hasOwnProperty = objectProto.hasOwnProperty;
151
- var maskSrcKey = (function() {
152
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
153
- return uid ? "Symbol(src)_1." + uid : "";
154
- })();
155
- var nativeObjectToString = objectProto.toString;
156
- var reIsNative = RegExp(
157
- "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
158
- );
159
- var Buffer = moduleExports ? root.Buffer : void 0;
160
- var Symbol = root.Symbol;
161
- var Uint8Array = root.Uint8Array;
162
- var propertyIsEnumerable = objectProto.propertyIsEnumerable;
163
- var splice = arrayProto.splice;
164
- var symToStringTag = Symbol ? Symbol.toStringTag : void 0;
165
- var nativeGetSymbols = Object.getOwnPropertySymbols;
166
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
167
- var nativeKeys = overArg(Object.keys, Object);
168
- var DataView = getNative(root, "DataView");
169
- var Map = getNative(root, "Map");
170
- var Promise2 = getNative(root, "Promise");
171
- var Set = getNative(root, "Set");
172
- var WeakMap = getNative(root, "WeakMap");
173
- var nativeCreate = getNative(Object, "create");
174
- var dataViewCtorString = toSource(DataView);
175
- var mapCtorString = toSource(Map);
176
- var promiseCtorString = toSource(Promise2);
177
- var setCtorString = toSource(Set);
178
- var weakMapCtorString = toSource(WeakMap);
179
- var symbolProto = Symbol ? Symbol.prototype : void 0;
180
- var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
181
- function Hash(entries) {
182
- var index = -1, length = entries == null ? 0 : entries.length;
183
- this.clear();
184
- while (++index < length) {
185
- var entry = entries[index];
186
- this.set(entry[0], entry[1]);
187
- }
188
- }
189
- function hashClear() {
190
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
191
- this.size = 0;
192
- }
193
- function hashDelete(key) {
194
- var result = this.has(key) && delete this.__data__[key];
195
- this.size -= result ? 1 : 0;
196
- return result;
197
- }
198
- function hashGet(key) {
199
- var data = this.__data__;
200
- if (nativeCreate) {
201
- var result = data[key];
202
- return result === HASH_UNDEFINED ? void 0 : result;
203
- }
204
- return hasOwnProperty.call(data, key) ? data[key] : void 0;
205
- }
206
- function hashHas(key) {
207
- var data = this.__data__;
208
- return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
209
- }
210
- function hashSet(key, value) {
211
- var data = this.__data__;
212
- this.size += this.has(key) ? 0 : 1;
213
- data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
214
- return this;
215
- }
216
- Hash.prototype.clear = hashClear;
217
- Hash.prototype["delete"] = hashDelete;
218
- Hash.prototype.get = hashGet;
219
- Hash.prototype.has = hashHas;
220
- Hash.prototype.set = hashSet;
221
- function ListCache(entries) {
222
- var index = -1, length = entries == null ? 0 : entries.length;
223
- this.clear();
224
- while (++index < length) {
225
- var entry = entries[index];
226
- this.set(entry[0], entry[1]);
227
- }
228
- }
229
- function listCacheClear() {
230
- this.__data__ = [];
231
- this.size = 0;
232
- }
233
- function listCacheDelete(key) {
234
- var data = this.__data__, index = assocIndexOf(data, key);
235
- if (index < 0) {
236
- return false;
237
- }
238
- var lastIndex = data.length - 1;
239
- if (index == lastIndex) {
240
- data.pop();
241
- } else {
242
- splice.call(data, index, 1);
243
- }
244
- --this.size;
245
- return true;
246
- }
247
- function listCacheGet(key) {
248
- var data = this.__data__, index = assocIndexOf(data, key);
249
- return index < 0 ? void 0 : data[index][1];
250
- }
251
- function listCacheHas(key) {
252
- return assocIndexOf(this.__data__, key) > -1;
253
- }
254
- function listCacheSet(key, value) {
255
- var data = this.__data__, index = assocIndexOf(data, key);
256
- if (index < 0) {
257
- ++this.size;
258
- data.push([key, value]);
259
- } else {
260
- data[index][1] = value;
261
- }
262
- return this;
263
- }
264
- ListCache.prototype.clear = listCacheClear;
265
- ListCache.prototype["delete"] = listCacheDelete;
266
- ListCache.prototype.get = listCacheGet;
267
- ListCache.prototype.has = listCacheHas;
268
- ListCache.prototype.set = listCacheSet;
269
- function MapCache(entries) {
270
- var index = -1, length = entries == null ? 0 : entries.length;
271
- this.clear();
272
- while (++index < length) {
273
- var entry = entries[index];
274
- this.set(entry[0], entry[1]);
275
- }
276
- }
277
- function mapCacheClear() {
278
- this.size = 0;
279
- this.__data__ = {
280
- "hash": new Hash(),
281
- "map": new (Map || ListCache)(),
282
- "string": new Hash()
283
- };
284
- }
285
- function mapCacheDelete(key) {
286
- var result = getMapData(this, key)["delete"](key);
287
- this.size -= result ? 1 : 0;
288
- return result;
289
- }
290
- function mapCacheGet(key) {
291
- return getMapData(this, key).get(key);
292
- }
293
- function mapCacheHas(key) {
294
- return getMapData(this, key).has(key);
295
- }
296
- function mapCacheSet(key, value) {
297
- var data = getMapData(this, key), size = data.size;
298
- data.set(key, value);
299
- this.size += data.size == size ? 0 : 1;
300
- return this;
301
- }
302
- MapCache.prototype.clear = mapCacheClear;
303
- MapCache.prototype["delete"] = mapCacheDelete;
304
- MapCache.prototype.get = mapCacheGet;
305
- MapCache.prototype.has = mapCacheHas;
306
- MapCache.prototype.set = mapCacheSet;
307
- function SetCache(values) {
308
- var index = -1, length = values == null ? 0 : values.length;
309
- this.__data__ = new MapCache();
310
- while (++index < length) {
311
- this.add(values[index]);
312
- }
313
- }
314
- function setCacheAdd(value) {
315
- this.__data__.set(value, HASH_UNDEFINED);
316
- return this;
317
- }
318
- function setCacheHas(value) {
319
- return this.__data__.has(value);
320
- }
321
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
322
- SetCache.prototype.has = setCacheHas;
323
- function Stack(entries) {
324
- var data = this.__data__ = new ListCache(entries);
325
- this.size = data.size;
326
- }
327
- function stackClear() {
328
- this.__data__ = new ListCache();
329
- this.size = 0;
330
- }
331
- function stackDelete(key) {
332
- var data = this.__data__, result = data["delete"](key);
333
- this.size = data.size;
334
- return result;
335
- }
336
- function stackGet(key) {
337
- return this.__data__.get(key);
338
- }
339
- function stackHas(key) {
340
- return this.__data__.has(key);
341
- }
342
- function stackSet(key, value) {
343
- var data = this.__data__;
344
- if (data instanceof ListCache) {
345
- var pairs = data.__data__;
346
- if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
347
- pairs.push([key, value]);
348
- this.size = ++data.size;
349
- return this;
350
- }
351
- data = this.__data__ = new MapCache(pairs);
352
- }
353
- data.set(key, value);
354
- this.size = data.size;
355
- return this;
356
- }
357
- Stack.prototype.clear = stackClear;
358
- Stack.prototype["delete"] = stackDelete;
359
- Stack.prototype.get = stackGet;
360
- Stack.prototype.has = stackHas;
361
- Stack.prototype.set = stackSet;
362
- function arrayLikeKeys(value, inherited) {
363
- var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
364
- for (var key in value) {
365
- if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
366
- (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
367
- isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
368
- isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
369
- isIndex(key, length)))) {
370
- result.push(key);
371
- }
372
- }
373
- return result;
374
- }
375
- function assocIndexOf(array, key) {
376
- var length = array.length;
377
- while (length--) {
378
- if (eq(array[length][0], key)) {
379
- return length;
380
- }
381
- }
382
- return -1;
383
- }
384
- function baseGetAllKeys(object, keysFunc, symbolsFunc) {
385
- var result = keysFunc(object);
386
- return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
387
- }
388
- function baseGetTag(value) {
389
- if (value == null) {
390
- return value === void 0 ? undefinedTag : nullTag;
391
- }
392
- return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
393
- }
394
- function baseIsArguments(value) {
395
- return isObjectLike(value) && baseGetTag(value) == argsTag;
396
- }
397
- function baseIsEqual(value, other, bitmask, customizer, stack) {
398
- if (value === other) {
399
- return true;
400
- }
401
- if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
402
- return value !== value && other !== other;
403
- }
404
- return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
405
- }
406
- function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
407
- var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
408
- objTag = objTag == argsTag ? objectTag : objTag;
409
- othTag = othTag == argsTag ? objectTag : othTag;
410
- var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
411
- if (isSameTag && isBuffer(object)) {
412
- if (!isBuffer(other)) {
413
- return false;
414
- }
415
- objIsArr = true;
416
- objIsObj = false;
417
- }
418
- if (isSameTag && !objIsObj) {
419
- stack || (stack = new Stack());
420
- return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
421
- }
422
- if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
423
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
424
- if (objIsWrapped || othIsWrapped) {
425
- var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
426
- stack || (stack = new Stack());
427
- return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
428
- }
429
- }
430
- if (!isSameTag) {
431
- return false;
432
- }
433
- stack || (stack = new Stack());
434
- return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
435
- }
436
- function baseIsNative(value) {
437
- if (!isObject(value) || isMasked(value)) {
438
- return false;
439
- }
440
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
441
- return pattern.test(toSource(value));
442
- }
443
- function baseIsTypedArray(value) {
444
- return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
445
- }
446
- function baseKeys(object) {
447
- if (!isPrototype(object)) {
448
- return nativeKeys(object);
449
- }
450
- var result = [];
451
- for (var key in Object(object)) {
452
- if (hasOwnProperty.call(object, key) && key != "constructor") {
453
- result.push(key);
454
- }
455
- }
456
- return result;
457
- }
458
- function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
459
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length;
460
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
461
- return false;
462
- }
463
- var stacked = stack.get(array);
464
- if (stacked && stack.get(other)) {
465
- return stacked == other;
466
- }
467
- var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : void 0;
468
- stack.set(array, other);
469
- stack.set(other, array);
470
- while (++index < arrLength) {
471
- var arrValue = array[index], othValue = other[index];
472
- if (customizer) {
473
- var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
474
- }
475
- if (compared !== void 0) {
476
- if (compared) {
477
- continue;
478
- }
479
- result = false;
480
- break;
481
- }
482
- if (seen) {
483
- if (!arraySome(other, function(othValue2, othIndex) {
484
- if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
485
- return seen.push(othIndex);
486
- }
487
- })) {
488
- result = false;
489
- break;
490
- }
491
- } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
492
- result = false;
493
- break;
494
- }
495
- }
496
- stack["delete"](array);
497
- stack["delete"](other);
498
- return result;
499
- }
500
- function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
501
- switch (tag) {
502
- case dataViewTag:
503
- if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
504
- return false;
505
- }
506
- object = object.buffer;
507
- other = other.buffer;
508
- case arrayBufferTag:
509
- if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
510
- return false;
511
- }
512
- return true;
513
- case boolTag:
514
- case dateTag:
515
- case numberTag:
516
- return eq(+object, +other);
517
- case errorTag:
518
- return object.name == other.name && object.message == other.message;
519
- case regexpTag:
520
- case stringTag:
521
- return object == other + "";
522
- case mapTag:
523
- var convert = mapToArray;
524
- case setTag:
525
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
526
- convert || (convert = setToArray);
527
- if (object.size != other.size && !isPartial) {
528
- return false;
529
- }
530
- var stacked = stack.get(object);
531
- if (stacked) {
532
- return stacked == other;
533
- }
534
- bitmask |= COMPARE_UNORDERED_FLAG;
535
- stack.set(object, other);
536
- var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
537
- stack["delete"](object);
538
- return result;
539
- case symbolTag:
540
- if (symbolValueOf) {
541
- return symbolValueOf.call(object) == symbolValueOf.call(other);
542
- }
543
- }
544
- return false;
545
- }
546
- function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
547
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
548
- if (objLength != othLength && !isPartial) {
549
- return false;
550
- }
551
- var index = objLength;
552
- while (index--) {
553
- var key = objProps[index];
554
- if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
555
- return false;
556
- }
557
- }
558
- var stacked = stack.get(object);
559
- if (stacked && stack.get(other)) {
560
- return stacked == other;
561
- }
562
- var result = true;
563
- stack.set(object, other);
564
- stack.set(other, object);
565
- var skipCtor = isPartial;
566
- while (++index < objLength) {
567
- key = objProps[index];
568
- var objValue = object[key], othValue = other[key];
569
- if (customizer) {
570
- var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
571
- }
572
- if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
573
- result = false;
574
- break;
575
- }
576
- skipCtor || (skipCtor = key == "constructor");
577
- }
578
- if (result && !skipCtor) {
579
- var objCtor = object.constructor, othCtor = other.constructor;
580
- if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
581
- result = false;
582
- }
583
- }
584
- stack["delete"](object);
585
- stack["delete"](other);
586
- return result;
587
- }
588
- function getAllKeys(object) {
589
- return baseGetAllKeys(object, keys, getSymbols);
590
- }
591
- function getMapData(map, key) {
592
- var data = map.__data__;
593
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
594
- }
595
- function getNative(object, key) {
596
- var value = getValue(object, key);
597
- return baseIsNative(value) ? value : void 0;
598
- }
599
- function getRawTag(value) {
600
- var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
601
- try {
602
- value[symToStringTag] = void 0;
603
- var unmasked = true;
604
- } catch (e) {
605
- }
606
- var result = nativeObjectToString.call(value);
607
- if (unmasked) {
608
- if (isOwn) {
609
- value[symToStringTag] = tag;
610
- } else {
611
- delete value[symToStringTag];
612
- }
613
- }
614
- return result;
615
- }
616
- var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
617
- if (object == null) {
618
- return [];
619
- }
620
- object = Object(object);
621
- return arrayFilter(nativeGetSymbols(object), function(symbol) {
622
- return propertyIsEnumerable.call(object, symbol);
623
- });
624
- };
625
- var getTag = baseGetTag;
626
- if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
627
- getTag = function(value) {
628
- var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
629
- if (ctorString) {
630
- switch (ctorString) {
631
- case dataViewCtorString:
632
- return dataViewTag;
633
- case mapCtorString:
634
- return mapTag;
635
- case promiseCtorString:
636
- return promiseTag;
637
- case setCtorString:
638
- return setTag;
639
- case weakMapCtorString:
640
- return weakMapTag;
641
- }
642
- }
643
- return result;
644
- };
645
- }
646
- function isIndex(value, length) {
647
- length = length == null ? MAX_SAFE_INTEGER : length;
648
- return !!length && (typeof value == "number" || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
649
- }
650
- function isKeyable(value) {
651
- var type = typeof value;
652
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
653
- }
654
- function isMasked(func) {
655
- return !!maskSrcKey && maskSrcKey in func;
656
- }
657
- function isPrototype(value) {
658
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
659
- return value === proto;
660
- }
661
- function objectToString(value) {
662
- return nativeObjectToString.call(value);
663
- }
664
- function toSource(func) {
665
- if (func != null) {
666
- try {
667
- return funcToString.call(func);
668
- } catch (e) {
669
- }
670
- try {
671
- return func + "";
672
- } catch (e) {
673
- }
674
- }
675
- return "";
676
- }
677
- function eq(value, other) {
678
- return value === other || value !== value && other !== other;
679
- }
680
- var isArguments = baseIsArguments(/* @__PURE__ */ (function() {
681
- return arguments;
682
- })()) ? baseIsArguments : function(value) {
683
- return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
684
- };
685
- var isArray = Array.isArray;
686
- function isArrayLike(value) {
687
- return value != null && isLength(value.length) && !isFunction(value);
688
- }
689
- var isBuffer = nativeIsBuffer || stubFalse;
690
- function isEqual2(value, other) {
691
- return baseIsEqual(value, other);
692
- }
693
- function isFunction(value) {
694
- if (!isObject(value)) {
695
- return false;
696
- }
697
- var tag = baseGetTag(value);
698
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
699
- }
700
- function isLength(value) {
701
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
702
- }
703
- function isObject(value) {
704
- var type = typeof value;
705
- return value != null && (type == "object" || type == "function");
706
- }
707
- function isObjectLike(value) {
708
- return value != null && typeof value == "object";
709
- }
710
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
711
- function keys(object) {
712
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
713
- }
714
- function stubArray() {
715
- return [];
716
- }
717
- function stubFalse() {
718
- return false;
719
- }
720
- module.exports = isEqual2;
721
- }
722
- });
723
-
724
- // node_modules/arr-rotate/index.js
725
- var require_arr_rotate = __commonJS({
726
- "node_modules/arr-rotate/index.js"(exports, module) {
727
- "use strict";
728
- module.exports = (input, n) => {
729
- if (!Array.isArray(input)) {
730
- throw new TypeError(`Expected an array, got ${typeof input}`);
731
- }
732
- const x = input.slice();
733
- const num = typeof n === "number" ? n : 0;
734
- return x.splice(-num % x.length).concat(x);
735
- };
736
- }
737
- });
10
+ getSolvedAcHandle
11
+ } from "../chunk-CIG2LEJC.js";
12
+ import "../chunk-FYS2JH42.js";
738
13
 
739
14
  // src/commands/init.tsx
740
- import { useState as useState2, useEffect as useEffect2 } from "react";
741
- import { render, Text as Text3, Box as Box3 } from "ink";
15
+ import { useState, useEffect } from "react";
16
+ import { render, Text, Box } from "ink";
742
17
  import { mkdir, readFile, writeFile, access } from "fs/promises";
743
18
  import { join } from "path";
744
-
745
- // node_modules/ink-select-input/build/Indicator.js
746
- import React from "react";
747
- import { Box, Text } from "ink";
748
-
749
- // node_modules/ink-select-input/node_modules/figures/index.js
750
- import process3 from "process";
751
-
752
- // node_modules/ink-select-input/node_modules/figures/node_modules/is-unicode-supported/index.js
753
- import process2 from "process";
754
- function isUnicodeSupported() {
755
- if (process2.platform !== "win32") {
756
- return process2.env.TERM !== "linux";
757
- }
758
- return Boolean(process2.env.CI) || Boolean(process2.env.WT_SESSION) || Boolean(process2.env.TERMINUS_SUBLIME) || process2.env.ConEmuTask === "{cmd::Cmder}" || process2.env.TERM_PROGRAM === "Terminus-Sublime" || process2.env.TERM_PROGRAM === "vscode" || process2.env.TERM === "xterm-256color" || process2.env.TERM === "alacritty" || process2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
759
- }
760
-
761
- // node_modules/ink-select-input/node_modules/figures/index.js
762
- var { platform } = process3;
763
- var common = {
764
- square: "\u2588",
765
- squareDarkShade: "\u2593",
766
- squareMediumShade: "\u2592",
767
- squareLightShade: "\u2591",
768
- squareTop: "\u2580",
769
- squareBottom: "\u2584",
770
- squareLeft: "\u258C",
771
- squareRight: "\u2590",
772
- squareCenter: "\u25A0",
773
- bullet: "\u25CF",
774
- dot: "\u2024",
775
- ellipsis: "\u2026",
776
- pointerSmall: "\u203A",
777
- triangleUp: "\u25B2",
778
- triangleUpSmall: "\u25B4",
779
- triangleDown: "\u25BC",
780
- triangleDownSmall: "\u25BE",
781
- triangleLeftSmall: "\u25C2",
782
- triangleRightSmall: "\u25B8",
783
- home: "\u2302",
784
- heart: "\u2665",
785
- musicNote: "\u266A",
786
- musicNoteBeamed: "\u266B",
787
- arrowUp: "\u2191",
788
- arrowDown: "\u2193",
789
- arrowLeft: "\u2190",
790
- arrowRight: "\u2192",
791
- arrowLeftRight: "\u2194",
792
- arrowUpDown: "\u2195",
793
- almostEqual: "\u2248",
794
- notEqual: "\u2260",
795
- lessOrEqual: "\u2264",
796
- greaterOrEqual: "\u2265",
797
- identical: "\u2261",
798
- infinity: "\u221E",
799
- subscriptZero: "\u2080",
800
- subscriptOne: "\u2081",
801
- subscriptTwo: "\u2082",
802
- subscriptThree: "\u2083",
803
- subscriptFour: "\u2084",
804
- subscriptFive: "\u2085",
805
- subscriptSix: "\u2086",
806
- subscriptSeven: "\u2087",
807
- subscriptEight: "\u2088",
808
- subscriptNine: "\u2089",
809
- oneHalf: "\xBD",
810
- oneThird: "\u2153",
811
- oneQuarter: "\xBC",
812
- oneFifth: "\u2155",
813
- oneSixth: "\u2159",
814
- oneEighth: "\u215B",
815
- twoThirds: "\u2154",
816
- twoFifths: "\u2156",
817
- threeQuarters: "\xBE",
818
- threeFifths: "\u2157",
819
- threeEighths: "\u215C",
820
- fourFifths: "\u2158",
821
- fiveSixths: "\u215A",
822
- fiveEighths: "\u215D",
823
- sevenEighths: "\u215E",
824
- line: "\u2500",
825
- lineBold: "\u2501",
826
- lineDouble: "\u2550",
827
- lineDashed0: "\u2504",
828
- lineDashed1: "\u2505",
829
- lineDashed2: "\u2508",
830
- lineDashed3: "\u2509",
831
- lineDashed4: "\u254C",
832
- lineDashed5: "\u254D",
833
- lineDashed6: "\u2574",
834
- lineDashed7: "\u2576",
835
- lineDashed8: "\u2578",
836
- lineDashed9: "\u257A",
837
- lineDashed10: "\u257C",
838
- lineDashed11: "\u257E",
839
- lineDashed12: "\u2212",
840
- lineDashed13: "\u2013",
841
- lineDashed14: "\u2010",
842
- lineDashed15: "\u2043",
843
- lineVertical: "\u2502",
844
- lineVerticalBold: "\u2503",
845
- lineVerticalDouble: "\u2551",
846
- lineVerticalDashed0: "\u2506",
847
- lineVerticalDashed1: "\u2507",
848
- lineVerticalDashed2: "\u250A",
849
- lineVerticalDashed3: "\u250B",
850
- lineVerticalDashed4: "\u254E",
851
- lineVerticalDashed5: "\u254F",
852
- lineVerticalDashed6: "\u2575",
853
- lineVerticalDashed7: "\u2577",
854
- lineVerticalDashed8: "\u2579",
855
- lineVerticalDashed9: "\u257B",
856
- lineVerticalDashed10: "\u257D",
857
- lineVerticalDashed11: "\u257F",
858
- lineDownLeft: "\u2510",
859
- lineDownLeftArc: "\u256E",
860
- lineDownBoldLeftBold: "\u2513",
861
- lineDownBoldLeft: "\u2512",
862
- lineDownLeftBold: "\u2511",
863
- lineDownDoubleLeftDouble: "\u2557",
864
- lineDownDoubleLeft: "\u2556",
865
- lineDownLeftDouble: "\u2555",
866
- lineDownRight: "\u250C",
867
- lineDownRightArc: "\u256D",
868
- lineDownBoldRightBold: "\u250F",
869
- lineDownBoldRight: "\u250E",
870
- lineDownRightBold: "\u250D",
871
- lineDownDoubleRightDouble: "\u2554",
872
- lineDownDoubleRight: "\u2553",
873
- lineDownRightDouble: "\u2552",
874
- lineUpLeft: "\u2518",
875
- lineUpLeftArc: "\u256F",
876
- lineUpBoldLeftBold: "\u251B",
877
- lineUpBoldLeft: "\u251A",
878
- lineUpLeftBold: "\u2519",
879
- lineUpDoubleLeftDouble: "\u255D",
880
- lineUpDoubleLeft: "\u255C",
881
- lineUpLeftDouble: "\u255B",
882
- lineUpRight: "\u2514",
883
- lineUpRightArc: "\u2570",
884
- lineUpBoldRightBold: "\u2517",
885
- lineUpBoldRight: "\u2516",
886
- lineUpRightBold: "\u2515",
887
- lineUpDoubleRightDouble: "\u255A",
888
- lineUpDoubleRight: "\u2559",
889
- lineUpRightDouble: "\u2558",
890
- lineUpDownLeft: "\u2524",
891
- lineUpBoldDownBoldLeftBold: "\u252B",
892
- lineUpBoldDownBoldLeft: "\u2528",
893
- lineUpDownLeftBold: "\u2525",
894
- lineUpBoldDownLeftBold: "\u2529",
895
- lineUpDownBoldLeftBold: "\u252A",
896
- lineUpDownBoldLeft: "\u2527",
897
- lineUpBoldDownLeft: "\u2526",
898
- lineUpDoubleDownDoubleLeftDouble: "\u2563",
899
- lineUpDoubleDownDoubleLeft: "\u2562",
900
- lineUpDownLeftDouble: "\u2561",
901
- lineUpDownRight: "\u251C",
902
- lineUpBoldDownBoldRightBold: "\u2523",
903
- lineUpBoldDownBoldRight: "\u2520",
904
- lineUpDownRightBold: "\u251D",
905
- lineUpBoldDownRightBold: "\u2521",
906
- lineUpDownBoldRightBold: "\u2522",
907
- lineUpDownBoldRight: "\u251F",
908
- lineUpBoldDownRight: "\u251E",
909
- lineUpDoubleDownDoubleRightDouble: "\u2560",
910
- lineUpDoubleDownDoubleRight: "\u255F",
911
- lineUpDownRightDouble: "\u255E",
912
- lineDownLeftRight: "\u252C",
913
- lineDownBoldLeftBoldRightBold: "\u2533",
914
- lineDownLeftBoldRightBold: "\u252F",
915
- lineDownBoldLeftRight: "\u2530",
916
- lineDownBoldLeftBoldRight: "\u2531",
917
- lineDownBoldLeftRightBold: "\u2532",
918
- lineDownLeftRightBold: "\u252E",
919
- lineDownLeftBoldRight: "\u252D",
920
- lineDownDoubleLeftDoubleRightDouble: "\u2566",
921
- lineDownDoubleLeftRight: "\u2565",
922
- lineDownLeftDoubleRightDouble: "\u2564",
923
- lineUpLeftRight: "\u2534",
924
- lineUpBoldLeftBoldRightBold: "\u253B",
925
- lineUpLeftBoldRightBold: "\u2537",
926
- lineUpBoldLeftRight: "\u2538",
927
- lineUpBoldLeftBoldRight: "\u2539",
928
- lineUpBoldLeftRightBold: "\u253A",
929
- lineUpLeftRightBold: "\u2536",
930
- lineUpLeftBoldRight: "\u2535",
931
- lineUpDoubleLeftDoubleRightDouble: "\u2569",
932
- lineUpDoubleLeftRight: "\u2568",
933
- lineUpLeftDoubleRightDouble: "\u2567",
934
- lineUpDownLeftRight: "\u253C",
935
- lineUpBoldDownBoldLeftBoldRightBold: "\u254B",
936
- lineUpDownBoldLeftBoldRightBold: "\u2548",
937
- lineUpBoldDownLeftBoldRightBold: "\u2547",
938
- lineUpBoldDownBoldLeftRightBold: "\u254A",
939
- lineUpBoldDownBoldLeftBoldRight: "\u2549",
940
- lineUpBoldDownLeftRight: "\u2540",
941
- lineUpDownBoldLeftRight: "\u2541",
942
- lineUpDownLeftBoldRight: "\u253D",
943
- lineUpDownLeftRightBold: "\u253E",
944
- lineUpBoldDownBoldLeftRight: "\u2542",
945
- lineUpDownLeftBoldRightBold: "\u253F",
946
- lineUpBoldDownLeftBoldRight: "\u2543",
947
- lineUpBoldDownLeftRightBold: "\u2544",
948
- lineUpDownBoldLeftBoldRight: "\u2545",
949
- lineUpDownBoldLeftRightBold: "\u2546",
950
- lineUpDoubleDownDoubleLeftDoubleRightDouble: "\u256C",
951
- lineUpDoubleDownDoubleLeftRight: "\u256B",
952
- lineUpDownLeftDoubleRightDouble: "\u256A",
953
- lineCross: "\u2573",
954
- lineBackslash: "\u2572",
955
- lineSlash: "\u2571"
956
- };
957
- var mainSymbols = {
958
- ...common,
959
- // The main symbols for those do not look that good on Ubuntu.
960
- ...platform === "linux" ? {
961
- circleQuestionMark: "?\u20DD",
962
- questionMarkPrefix: "?\u20DD"
963
- } : {
964
- circleQuestionMark: "?",
965
- questionMarkPrefix: "?"
966
- },
967
- tick: "\u2714",
968
- info: "\u2139",
969
- warning: "\u26A0",
970
- cross: "\u2718",
971
- squareSmall: "\u25FB",
972
- squareSmallFilled: "\u25FC",
973
- circle: "\u25EF",
974
- circleFilled: "\u25C9",
975
- circleDotted: "\u25CC",
976
- circleDouble: "\u25CE",
977
- circleCircle: "\u24DE",
978
- circleCross: "\u24E7",
979
- circlePipe: "\u24BE",
980
- radioOn: "\u25C9",
981
- radioOff: "\u25EF",
982
- checkboxOn: "\u2612",
983
- checkboxOff: "\u2610",
984
- checkboxCircleOn: "\u24E7",
985
- checkboxCircleOff: "\u24BE",
986
- pointer: "\u276F",
987
- triangleUpOutline: "\u25B3",
988
- triangleLeft: "\u25C0",
989
- triangleRight: "\u25B6",
990
- lozenge: "\u25C6",
991
- lozengeOutline: "\u25C7",
992
- hamburger: "\u2630",
993
- smiley: "\u32E1",
994
- mustache: "\u0DF4",
995
- star: "\u2605",
996
- play: "\u25B6",
997
- nodejs: "\u2B22",
998
- oneSeventh: "\u2150",
999
- oneNinth: "\u2151",
1000
- oneTenth: "\u2152"
1001
- };
1002
- var fallbackSymbols = {
1003
- ...common,
1004
- tick: "\u221A",
1005
- info: "i",
1006
- warning: "\u203C",
1007
- cross: "\xD7",
1008
- squareSmall: "\u25A1",
1009
- squareSmallFilled: "\u25A0",
1010
- circle: "( )",
1011
- circleFilled: "(*)",
1012
- circleDotted: "( )",
1013
- circleDouble: "( )",
1014
- circleCircle: "(\u25CB)",
1015
- circleCross: "(\xD7)",
1016
- circlePipe: "(\u2502)",
1017
- circleQuestionMark: "(?)",
1018
- radioOn: "(*)",
1019
- radioOff: "( )",
1020
- checkboxOn: "[\xD7]",
1021
- checkboxOff: "[ ]",
1022
- checkboxCircleOn: "(\xD7)",
1023
- checkboxCircleOff: "( )",
1024
- questionMarkPrefix: "\uFF1F",
1025
- pointer: ">",
1026
- triangleUpOutline: "\u2206",
1027
- triangleLeft: "\u25C4",
1028
- triangleRight: "\u25BA",
1029
- lozenge: "\u2666",
1030
- lozengeOutline: "\u25CA",
1031
- hamburger: "\u2261",
1032
- smiley: "\u263A",
1033
- mustache: "\u250C\u2500\u2510",
1034
- star: "\u2736",
1035
- play: "\u25BA",
1036
- nodejs: "\u2666",
1037
- oneSeventh: "1/7",
1038
- oneNinth: "1/9",
1039
- oneTenth: "1/10"
1040
- };
1041
- var shouldUseMain = isUnicodeSupported();
1042
- var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
1043
- var figures_default = figures;
1044
-
1045
- // node_modules/ink-select-input/build/Indicator.js
1046
- function Indicator({ isSelected = false }) {
1047
- return React.createElement(Box, { marginRight: 1 }, isSelected ? React.createElement(Text, { color: "blue" }, figures_default.pointer) : React.createElement(Text, null, " "));
1048
- }
1049
- var Indicator_default = Indicator;
1050
-
1051
- // node_modules/ink-select-input/build/Item.js
1052
- import * as React2 from "react";
1053
- import { Text as Text2 } from "ink";
1054
- function Item({ isSelected = false, label }) {
1055
- return React2.createElement(Text2, { color: isSelected ? "blue" : void 0 }, label);
1056
- }
1057
- var Item_default = Item;
1058
-
1059
- // node_modules/ink-select-input/build/SelectInput.js
1060
- var import_lodash = __toESM(require_lodash(), 1);
1061
- var import_arr_rotate = __toESM(require_arr_rotate(), 1);
1062
- import React3 from "react";
1063
- import { useState, useEffect, useRef, useCallback } from "react";
1064
- import { Box as Box2, useInput } from "ink";
1065
- function SelectInput({ items = [], isFocused = true, initialIndex = 0, indicatorComponent = Indicator_default, itemComponent = Item_default, limit: customLimit, onSelect, onHighlight }) {
1066
- const hasLimit = typeof customLimit === "number" && items.length > customLimit;
1067
- const limit = hasLimit ? Math.min(customLimit, items.length) : items.length;
1068
- const lastIndex = limit - 1;
1069
- const [rotateIndex, setRotateIndex] = useState(initialIndex > lastIndex ? lastIndex - initialIndex : 0);
1070
- const [selectedIndex, setSelectedIndex] = useState(initialIndex ? initialIndex > lastIndex ? lastIndex : initialIndex : 0);
1071
- const previousItems = useRef(items);
1072
- useEffect(() => {
1073
- if (!(0, import_lodash.default)(previousItems.current.map((item) => item.value), items.map((item) => item.value))) {
1074
- setRotateIndex(0);
1075
- setSelectedIndex(0);
1076
- }
1077
- previousItems.current = items;
1078
- }, [items]);
1079
- useInput(useCallback((input, key) => {
1080
- if (input === "k" || key.upArrow) {
1081
- const lastIndex2 = (hasLimit ? limit : items.length) - 1;
1082
- const atFirstIndex = selectedIndex === 0;
1083
- const nextIndex = hasLimit ? selectedIndex : lastIndex2;
1084
- const nextRotateIndex = atFirstIndex ? rotateIndex + 1 : rotateIndex;
1085
- const nextSelectedIndex = atFirstIndex ? nextIndex : selectedIndex - 1;
1086
- setRotateIndex(nextRotateIndex);
1087
- setSelectedIndex(nextSelectedIndex);
1088
- const slicedItems2 = hasLimit ? (0, import_arr_rotate.default)(items, nextRotateIndex).slice(0, limit) : items;
1089
- if (typeof onHighlight === "function") {
1090
- onHighlight(slicedItems2[nextSelectedIndex]);
1091
- }
1092
- }
1093
- if (input === "j" || key.downArrow) {
1094
- const atLastIndex = selectedIndex === (hasLimit ? limit : items.length) - 1;
1095
- const nextIndex = hasLimit ? selectedIndex : 0;
1096
- const nextRotateIndex = atLastIndex ? rotateIndex - 1 : rotateIndex;
1097
- const nextSelectedIndex = atLastIndex ? nextIndex : selectedIndex + 1;
1098
- setRotateIndex(nextRotateIndex);
1099
- setSelectedIndex(nextSelectedIndex);
1100
- const slicedItems2 = hasLimit ? (0, import_arr_rotate.default)(items, nextRotateIndex).slice(0, limit) : items;
1101
- if (typeof onHighlight === "function") {
1102
- onHighlight(slicedItems2[nextSelectedIndex]);
1103
- }
1104
- }
1105
- if (key.return) {
1106
- const slicedItems2 = hasLimit ? (0, import_arr_rotate.default)(items, rotateIndex).slice(0, limit) : items;
1107
- if (typeof onSelect === "function") {
1108
- onSelect(slicedItems2[selectedIndex]);
1109
- }
1110
- }
1111
- }, [
1112
- hasLimit,
1113
- limit,
1114
- rotateIndex,
1115
- selectedIndex,
1116
- items,
1117
- onSelect,
1118
- onHighlight
1119
- ]), { isActive: isFocused });
1120
- const slicedItems = hasLimit ? (0, import_arr_rotate.default)(items, rotateIndex).slice(0, limit) : items;
1121
- return React3.createElement(Box2, { flexDirection: "column" }, slicedItems.map((item, index) => {
1122
- const isSelected = index === selectedIndex;
1123
- return (
1124
- // @ts-expect-error - `key` can't be optional but `item.value` is generic T
1125
- React3.createElement(
1126
- Box2,
1127
- { key: item.key ?? item.value },
1128
- React3.createElement(indicatorComponent, { isSelected }),
1129
- React3.createElement(itemComponent, { ...item, isSelected })
1130
- )
1131
- );
1132
- }));
1133
- }
1134
- var SelectInput_default = SelectInput;
1135
-
1136
- // src/commands/init.tsx
1137
- import TextInput from "ink-text-input";
19
+ import {
20
+ Select,
21
+ TextInput,
22
+ StatusMessage,
23
+ Alert,
24
+ ConfirmInput
25
+ } from "@inkjs/ui";
1138
26
  import { jsx, jsxs } from "react/jsx-runtime";
1139
27
  function InitCommand({ onComplete }) {
1140
- const [currentStep, setCurrentStep] = useState2("problem-dir");
1141
- const [completedSteps, setCompletedSteps] = useState2([]);
1142
- const [confirmExit, setConfirmExit] = useState2(false);
1143
- const [exitConfirmInput, setExitConfirmInput] = useState2("");
1144
- const [initialized, setInitialized] = useState2(false);
1145
- const [problemDir, setProblemDirValue] = useState2(getProblemDir());
1146
- const [language, setLanguage] = useState2(getDefaultLanguage());
1147
- const [editor, setEditorValue] = useState2(getEditor());
1148
- const [autoOpen, setAutoOpen] = useState2(getAutoOpenEditor());
1149
- const [handle, setHandle] = useState2(getSolvedAcHandle() || "");
1150
- const [handleInputMode, setHandleInputMode] = useState2(false);
1151
- const [created, setCreated] = useState2([]);
1152
- const [cancelled, setCancelled] = useState2(false);
1153
- useEffect2(() => {
28
+ const [currentStep, setCurrentStep] = useState("problem-dir");
29
+ const [completedSteps, setCompletedSteps] = useState([]);
30
+ const [confirmExit, setConfirmExit] = useState(false);
31
+ const [initialized, setInitialized] = useState(false);
32
+ const [problemDir, setProblemDirValue] = useState(getProblemDir());
33
+ const [language, setLanguage] = useState(getDefaultLanguage());
34
+ const [editor, setEditorValue] = useState(getEditor());
35
+ const [autoOpen, setAutoOpen] = useState(getAutoOpenEditor());
36
+ const [handle, setHandle] = useState(getSolvedAcHandle() || "");
37
+ const [handleInputMode, setHandleInputMode] = useState(false);
38
+ const [created, setCreated] = useState([]);
39
+ const [cancelled, setCancelled] = useState(false);
40
+ useEffect(() => {
1154
41
  const handleSigInt = () => {
1155
42
  if (confirmExit) {
1156
43
  setCancelled(true);
@@ -1161,26 +48,13 @@ function InitCommand({ onComplete }) {
1161
48
  return;
1162
49
  }
1163
50
  setConfirmExit(true);
1164
- setExitConfirmInput("");
1165
51
  };
1166
52
  process.on("SIGINT", handleSigInt);
1167
53
  return () => {
1168
54
  process.off("SIGINT", handleSigInt);
1169
55
  };
1170
56
  }, [confirmExit, onComplete]);
1171
- useEffect2(() => {
1172
- if (confirmExit && exitConfirmInput.toLowerCase() === "y") {
1173
- setCancelled(true);
1174
- setCurrentStep("cancelled");
1175
- setTimeout(() => {
1176
- onComplete();
1177
- }, 500);
1178
- } else if (confirmExit && exitConfirmInput.toLowerCase() === "n") {
1179
- setConfirmExit(false);
1180
- setExitConfirmInput("");
1181
- }
1182
- }, [exitConfirmInput, confirmExit, onComplete]);
1183
- useEffect2(() => {
57
+ useEffect(() => {
1184
58
  async function loadProjectConfig() {
1185
59
  try {
1186
60
  const cwd = process.cwd();
@@ -1275,13 +149,6 @@ function InitCommand({ onComplete }) {
1275
149
  "utf-8"
1276
150
  );
1277
151
  setCreated((prev) => [...prev, ".ps-cli.json"]);
1278
- setProblemDir(problemDir);
1279
- setDefaultLanguage(language);
1280
- setEditor(editor);
1281
- setAutoOpenEditor(autoOpen);
1282
- if (handle) {
1283
- setSolvedAcHandle(handle);
1284
- }
1285
152
  if (problemDir !== "." && problemDir !== "") {
1286
153
  const problemDirPath = join(cwd, problemDir);
1287
154
  try {
@@ -1335,77 +202,51 @@ ${gitignorePattern}
1335
202
  }
1336
203
  }
1337
204
  function renderQuestionCard(title, children) {
1338
- return /* @__PURE__ */ jsxs(
1339
- Box3,
1340
- {
1341
- flexDirection: "column",
1342
- borderStyle: "round",
1343
- borderColor: "yellow",
1344
- paddingX: 1,
1345
- marginTop: 1,
1346
- children: [
1347
- /* @__PURE__ */ jsx(Box3, { marginBottom: 1, children: /* @__PURE__ */ jsx(Text3, { color: "yellow", bold: true, children: title }) }),
1348
- /* @__PURE__ */ jsx(Box3, { flexDirection: "column", children })
1349
- ]
1350
- }
1351
- );
205
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [
206
+ /* @__PURE__ */ jsx(Alert, { variant: "info", children: title }),
207
+ /* @__PURE__ */ jsx(Box, { marginTop: 1, flexDirection: "column", children })
208
+ ] });
1352
209
  }
1353
210
  function renderStepContent() {
1354
211
  if (cancelled || currentStep === "cancelled") {
1355
- return /* @__PURE__ */ jsx(
1356
- Box3,
1357
- {
1358
- flexDirection: "column",
1359
- borderStyle: "round",
1360
- borderColor: "red",
1361
- paddingX: 1,
1362
- children: /* @__PURE__ */ jsx(Text3, { color: "red", bold: true, children: "\u2717 \uCD08\uAE30\uD654\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4." })
1363
- }
1364
- );
212
+ return /* @__PURE__ */ jsx(Alert, { variant: "error", children: "\uCD08\uAE30\uD654\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4." });
1365
213
  }
1366
214
  if (confirmExit) {
1367
- return /* @__PURE__ */ jsx(Box3, { flexDirection: "column", children: /* @__PURE__ */ jsxs(
1368
- Box3,
1369
- {
1370
- flexDirection: "column",
1371
- borderStyle: "round",
1372
- borderColor: "red",
1373
- paddingX: 1,
1374
- children: [
1375
- /* @__PURE__ */ jsx(Text3, { color: "red", bold: true, children: "\uC815\uB9D0 \uC885\uB8CC\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C? (y/n)" }),
1376
- /* @__PURE__ */ jsx(Box3, { marginTop: 1, children: /* @__PURE__ */ jsx(
1377
- TextInput,
1378
- {
1379
- value: exitConfirmInput,
1380
- onChange: setExitConfirmInput,
1381
- placeholder: "",
1382
- showCursor: true
1383
- }
1384
- ) })
1385
- ]
1386
- }
1387
- ) });
215
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
216
+ /* @__PURE__ */ jsx(Alert, { variant: "error", children: "\uC815\uB9D0 \uC885\uB8CC\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?" }),
217
+ /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(
218
+ ConfirmInput,
219
+ {
220
+ onConfirm: () => {
221
+ setCancelled(true);
222
+ setCurrentStep("cancelled");
223
+ setConfirmExit(false);
224
+ setTimeout(() => {
225
+ onComplete();
226
+ }, 500);
227
+ },
228
+ onCancel: () => {
229
+ setConfirmExit(false);
230
+ }
231
+ }
232
+ ) })
233
+ ] });
1388
234
  }
1389
235
  switch (currentStep) {
1390
236
  case "problem-dir": {
1391
- const items = [
237
+ const options = [
1392
238
  { label: "problems", value: "problems" },
1393
239
  { label: ". (\uD504\uB85C\uC81D\uD2B8 \uB8E8\uD2B8)", value: "." }
1394
240
  ];
1395
241
  return renderQuestionCard(
1396
242
  getStepLabel(currentStep),
1397
243
  /* @__PURE__ */ jsx(
1398
- SelectInput_default,
244
+ Select,
1399
245
  {
1400
- items,
1401
- indicatorComponent: () => null,
1402
- itemComponent: ({ label, isSelected }) => /* @__PURE__ */ jsx(Box3, { children: /* @__PURE__ */ jsxs(Text3, { color: isSelected ? "yellow" : "gray", children: [
1403
- isSelected ? "\u2192 " : " ",
1404
- label
1405
- ] }) }),
1406
- onSelect: (item) => {
1407
- setProblemDirValue(item.value);
1408
- const displayValue = item.value === "." ? "\uD504\uB85C\uC81D\uD2B8 \uB8E8\uD2B8" : item.value;
246
+ options,
247
+ onChange: (value) => {
248
+ setProblemDirValue(value);
249
+ const displayValue = value === "." ? "\uD504\uB85C\uC81D\uD2B8 \uB8E8\uD2B8" : value;
1409
250
  moveToNextStep(displayValue, getStepLabel(currentStep));
1410
251
  }
1411
252
  }
@@ -1414,31 +255,26 @@ ${gitignorePattern}
1414
255
  }
1415
256
  case "language": {
1416
257
  const supportedLanguages = getSupportedLanguages();
1417
- const items = supportedLanguages.map((lang) => ({
258
+ const options = supportedLanguages.map((lang) => ({
1418
259
  label: lang,
1419
260
  value: lang
1420
261
  }));
1421
262
  return renderQuestionCard(
1422
263
  getStepLabel(currentStep),
1423
264
  /* @__PURE__ */ jsx(
1424
- SelectInput_default,
265
+ Select,
1425
266
  {
1426
- items,
1427
- indicatorComponent: () => null,
1428
- itemComponent: ({ label, isSelected }) => /* @__PURE__ */ jsx(Box3, { children: /* @__PURE__ */ jsxs(Text3, { color: isSelected ? "yellow" : "gray", children: [
1429
- isSelected ? "\u2192 " : " ",
1430
- label
1431
- ] }) }),
1432
- onSelect: (item) => {
1433
- setLanguage(item.value);
1434
- moveToNextStep(item.value, getStepLabel(currentStep));
267
+ options,
268
+ onChange: (value) => {
269
+ setLanguage(value);
270
+ moveToNextStep(value, getStepLabel(currentStep));
1435
271
  }
1436
272
  }
1437
273
  )
1438
274
  );
1439
275
  }
1440
276
  case "editor": {
1441
- const items = [
277
+ const options = [
1442
278
  { label: "code", value: "code" },
1443
279
  { label: "cursor", value: "cursor" },
1444
280
  { label: "vim", value: "vim" },
@@ -1447,42 +283,32 @@ ${gitignorePattern}
1447
283
  return renderQuestionCard(
1448
284
  getStepLabel(currentStep),
1449
285
  /* @__PURE__ */ jsx(
1450
- SelectInput_default,
286
+ Select,
1451
287
  {
1452
- items,
1453
- indicatorComponent: () => null,
1454
- itemComponent: ({ label, isSelected }) => /* @__PURE__ */ jsx(Box3, { children: /* @__PURE__ */ jsxs(Text3, { color: isSelected ? "yellow" : "gray", children: [
1455
- isSelected ? "\u2192 " : " ",
1456
- label
1457
- ] }) }),
1458
- onSelect: (item) => {
1459
- setEditorValue(item.value);
1460
- moveToNextStep(item.value, getStepLabel(currentStep));
288
+ options,
289
+ onChange: (value) => {
290
+ setEditorValue(value);
291
+ moveToNextStep(value, getStepLabel(currentStep));
1461
292
  }
1462
293
  }
1463
294
  )
1464
295
  );
1465
296
  }
1466
297
  case "auto-open": {
1467
- const items = [
298
+ const options = [
1468
299
  { label: "\uC608", value: "true" },
1469
300
  { label: "\uC544\uB2C8\uC624", value: "false" }
1470
301
  ];
1471
302
  return renderQuestionCard(
1472
303
  getStepLabel(currentStep),
1473
304
  /* @__PURE__ */ jsx(
1474
- SelectInput_default,
305
+ Select,
1475
306
  {
1476
- items,
1477
- indicatorComponent: () => null,
1478
- itemComponent: ({ label, isSelected }) => /* @__PURE__ */ jsx(Box3, { children: /* @__PURE__ */ jsxs(Text3, { color: isSelected ? "yellow" : "gray", children: [
1479
- isSelected ? "\u2192 " : " ",
1480
- label
1481
- ] }) }),
1482
- onSelect: (item) => {
1483
- setAutoOpen(item.value === "true");
307
+ options,
308
+ onChange: (value) => {
309
+ setAutoOpen(value === "true");
1484
310
  moveToNextStep(
1485
- item.value === "true" ? "\uC608" : "\uC544\uB2C8\uC624",
311
+ value === "true" ? "\uC608" : "\uC544\uB2C8\uC624",
1486
312
  getStepLabel(currentStep)
1487
313
  );
1488
314
  }
@@ -1494,13 +320,12 @@ ${gitignorePattern}
1494
320
  if (handleInputMode) {
1495
321
  return renderQuestionCard(
1496
322
  getStepLabel(currentStep),
1497
- /* @__PURE__ */ jsx(Box3, { children: /* @__PURE__ */ jsx(
323
+ /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
1498
324
  TextInput,
1499
325
  {
1500
- value: handle,
1501
326
  placeholder: "\uD578\uB4E4 \uC785\uB825",
1502
- onChange: setHandle,
1503
327
  onSubmit: (value) => {
328
+ setHandle(value);
1504
329
  setHandleInputMode(false);
1505
330
  moveToNextStep(value || "(\uC2A4\uD0B5)", getStepLabel(currentStep));
1506
331
  }
@@ -1508,23 +333,18 @@ ${gitignorePattern}
1508
333
  ) })
1509
334
  );
1510
335
  }
1511
- const items = [
336
+ const options = [
1512
337
  { label: "\uC124\uC815", value: "set" },
1513
338
  { label: "\uC2A4\uD0B5", value: "skip" }
1514
339
  ];
1515
340
  return renderQuestionCard(
1516
341
  getStepLabel(currentStep),
1517
342
  /* @__PURE__ */ jsx(
1518
- SelectInput_default,
343
+ Select,
1519
344
  {
1520
- items,
1521
- indicatorComponent: () => null,
1522
- itemComponent: ({ label, isSelected }) => /* @__PURE__ */ jsx(Box3, { children: /* @__PURE__ */ jsxs(Text3, { color: isSelected ? "yellow" : "gray", children: [
1523
- isSelected ? "\u2192 " : " ",
1524
- label
1525
- ] }) }),
1526
- onSelect: (item) => {
1527
- if (item.value === "skip") {
345
+ options,
346
+ onChange: (value) => {
347
+ if (value === "skip") {
1528
348
  setHandle("");
1529
349
  moveToNextStep("(\uC2A4\uD0B5)", getStepLabel(currentStep));
1530
350
  } else {
@@ -1536,32 +356,18 @@ ${gitignorePattern}
1536
356
  );
1537
357
  }
1538
358
  case "done": {
1539
- return /* @__PURE__ */ jsxs(Box3, { flexDirection: "column", children: [
1540
- /* @__PURE__ */ jsxs(
1541
- Box3,
1542
- {
1543
- flexDirection: "column",
1544
- borderStyle: "round",
1545
- borderColor: "green",
1546
- paddingX: 1,
1547
- marginTop: 1,
1548
- marginBottom: 1,
1549
- children: [
1550
- /* @__PURE__ */ jsx(Box3, { marginBottom: 1, children: /* @__PURE__ */ jsx(Text3, { color: "green", bold: true, children: "\u2713 \uD504\uB85C\uC81D\uD2B8 \uCD08\uAE30\uD654 \uC644\uB8CC" }) }),
1551
- created.length > 0 && /* @__PURE__ */ jsxs(Box3, { flexDirection: "column", children: [
1552
- /* @__PURE__ */ jsx(Text3, { color: "cyan", bold: true, children: "\uC0DD\uC131\uB41C \uD56D\uBAA9:" }),
1553
- /* @__PURE__ */ jsx(Box3, { flexDirection: "column", marginTop: 0, paddingLeft: 1, children: created.map((item, idx) => /* @__PURE__ */ jsxs(Text3, { color: "white", children: [
1554
- "\u2022 ",
1555
- item
1556
- ] }, idx)) })
1557
- ] })
1558
- ]
1559
- }
1560
- ),
1561
- /* @__PURE__ */ jsx(Box3, { children: /* @__PURE__ */ jsxs(Text3, { color: "gray", children: [
359
+ const createdItemsText = created.length > 0 ? `
360
+ \uC0DD\uC131\uB41C \uD56D\uBAA9:
361
+ ${created.map((item) => `\u2022 ${item}`).join("\n")}` : "";
362
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
363
+ /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsxs(Alert, { variant: "success", children: [
364
+ "\uD504\uB85C\uC81D\uD2B8 \uCD08\uAE30\uD654 \uC644\uB8CC",
365
+ createdItemsText
366
+ ] }) }),
367
+ /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsxs(Text, { color: "gray", children: [
1562
368
  "\uC774\uC81C",
1563
369
  " ",
1564
- /* @__PURE__ */ jsx(Text3, { bold: true, color: "cyan", children: "ps help" }),
370
+ /* @__PURE__ */ jsx(Text, { bold: true, color: "cyan", children: "ps help" }),
1565
371
  " ",
1566
372
  "\uBA85\uB839\uC5B4\uB97C \uD1B5\uD574 \uB354 \uC790\uC138\uD55C \uC815\uBCF4\uB97C \uD655\uC778\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4."
1567
373
  ] }) })
@@ -1572,17 +378,14 @@ ${gitignorePattern}
1572
378
  }
1573
379
  }
1574
380
  if (!initialized) {
1575
- return /* @__PURE__ */ jsx(Box3, { children: /* @__PURE__ */ jsx(Text3, { color: "gray", children: "\uB85C\uB529 \uC911..." }) });
381
+ return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { color: "gray", children: "\uB85C\uB529 \uC911..." }) });
1576
382
  }
1577
- return /* @__PURE__ */ jsxs(Box3, { flexDirection: "column", children: [
1578
- /* @__PURE__ */ jsx(Box3, { marginBottom: completedSteps.length > 0 ? 1 : 0, children: /* @__PURE__ */ jsx(Text3, { color: "cyan", bold: true, children: "\u{1F680} ps-cli \uD504\uB85C\uC81D\uD2B8 \uCD08\uAE30\uD654" }) }),
1579
- completedSteps.length > 0 && /* @__PURE__ */ jsx(Box3, { flexDirection: "column", children: completedSteps.map((step, idx) => /* @__PURE__ */ jsxs(Box3, { marginBottom: 0, children: [
1580
- /* @__PURE__ */ jsx(Text3, { color: "green", children: "\u2713 " }),
1581
- /* @__PURE__ */ jsxs(Text3, { color: "gray", children: [
1582
- step.label,
1583
- ": "
1584
- ] }),
1585
- /* @__PURE__ */ jsx(Text3, { color: "cyan", bold: true, children: step.value })
383
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
384
+ /* @__PURE__ */ jsx(Box, { marginBottom: completedSteps.length > 0 ? 1 : 0, children: /* @__PURE__ */ jsx(Text, { color: "cyan", bold: true, children: "\u{1F680} ps-cli \uD504\uB85C\uC81D\uD2B8 \uCD08\uAE30\uD654" }) }),
385
+ completedSteps.length > 0 && /* @__PURE__ */ jsx(Box, { flexDirection: "column", children: completedSteps.map((step, idx) => /* @__PURE__ */ jsxs(StatusMessage, { variant: "success", children: [
386
+ step.label,
387
+ ": ",
388
+ step.value
1586
389
  ] }, idx)) }),
1587
390
  renderStepContent()
1588
391
  ] });