git-stack-cli 1.9.0 → 1.10.0

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.
@@ -119,12 +119,12 @@ var React = /*@__PURE__*/getDefaultExportFromCjs(reactExports);
119
119
  * // => false
120
120
  */
121
121
 
122
- function isObject$3(value) {
122
+ function isObject$8(value) {
123
123
  var type = typeof value;
124
124
  return value != null && (type == 'object' || type == 'function');
125
125
  }
126
126
 
127
- var isObject_1 = isObject$3;
127
+ var isObject_1 = isObject$8;
128
128
 
129
129
  /** Detect free variable `global` from Node.js. */
130
130
 
@@ -138,11 +138,11 @@ var freeGlobal = _freeGlobal;
138
138
  var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
139
139
 
140
140
  /** Used as a reference to the global object. */
141
- var root$2 = freeGlobal || freeSelf || Function('return this')();
141
+ var root$9 = freeGlobal || freeSelf || Function('return this')();
142
142
 
143
- var _root = root$2;
143
+ var _root = root$9;
144
144
 
145
- var root$1 = _root;
145
+ var root$8 = _root;
146
146
 
147
147
  /**
148
148
  * Gets the timestamp of the number of milliseconds that have elapsed since
@@ -161,7 +161,7 @@ var root$1 = _root;
161
161
  * // => Logs the number of milliseconds it took for the deferred invocation.
162
162
  */
163
163
  var now$3 = function() {
164
- return root$1.Date.now();
164
+ return root$8.Date.now();
165
165
  };
166
166
 
167
167
  var now_1 = now$3;
@@ -207,30 +207,30 @@ function baseTrim$1(string) {
207
207
 
208
208
  var _baseTrim = baseTrim$1;
209
209
 
210
- var root = _root;
210
+ var root$7 = _root;
211
211
 
212
212
  /** Built-in value references. */
213
- var Symbol$3 = root.Symbol;
213
+ var Symbol$4 = root$7.Symbol;
214
214
 
215
- var _Symbol = Symbol$3;
215
+ var _Symbol = Symbol$4;
216
216
 
217
- var Symbol$2 = _Symbol;
217
+ var Symbol$3 = _Symbol;
218
218
 
219
219
  /** Used for built-in method references. */
220
- var objectProto$1 = Object.prototype;
220
+ var objectProto$c = Object.prototype;
221
221
 
222
222
  /** Used to check objects for own properties. */
223
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
223
+ var hasOwnProperty$a = objectProto$c.hasOwnProperty;
224
224
 
225
225
  /**
226
226
  * Used to resolve the
227
227
  * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
228
228
  * of values.
229
229
  */
230
- var nativeObjectToString$1 = objectProto$1.toString;
230
+ var nativeObjectToString$1 = objectProto$c.toString;
231
231
 
232
232
  /** Built-in value references. */
233
- var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
233
+ var symToStringTag$1 = Symbol$3 ? Symbol$3.toStringTag : undefined;
234
234
 
235
235
  /**
236
236
  * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
@@ -240,7 +240,7 @@ var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
240
240
  * @returns {string} Returns the raw `toStringTag`.
241
241
  */
242
242
  function getRawTag$1(value) {
243
- var isOwn = hasOwnProperty$1.call(value, symToStringTag$1),
243
+ var isOwn = hasOwnProperty$a.call(value, symToStringTag$1),
244
244
  tag = value[symToStringTag$1];
245
245
 
246
246
  try {
@@ -263,14 +263,14 @@ var _getRawTag = getRawTag$1;
263
263
 
264
264
  /** Used for built-in method references. */
265
265
 
266
- var objectProto = Object.prototype;
266
+ var objectProto$b = Object.prototype;
267
267
 
268
268
  /**
269
269
  * Used to resolve the
270
270
  * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
271
271
  * of values.
272
272
  */
273
- var nativeObjectToString = objectProto.toString;
273
+ var nativeObjectToString = objectProto$b.toString;
274
274
 
275
275
  /**
276
276
  * Converts `value` to a string using `Object.prototype.toString`.
@@ -285,7 +285,7 @@ function objectToString$1(value) {
285
285
 
286
286
  var _objectToString = objectToString$1;
287
287
 
288
- var Symbol$1 = _Symbol,
288
+ var Symbol$2 = _Symbol,
289
289
  getRawTag = _getRawTag,
290
290
  objectToString = _objectToString;
291
291
 
@@ -294,7 +294,7 @@ var nullTag = '[object Null]',
294
294
  undefinedTag = '[object Undefined]';
295
295
 
296
296
  /** Built-in value references. */
297
- var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
297
+ var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : undefined;
298
298
 
299
299
  /**
300
300
  * The base implementation of `getTag` without fallbacks for buggy environments.
@@ -303,7 +303,7 @@ var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
303
303
  * @param {*} value The value to query.
304
304
  * @returns {string} Returns the `toStringTag`.
305
305
  */
306
- function baseGetTag$1(value) {
306
+ function baseGetTag$5(value) {
307
307
  if (value == null) {
308
308
  return value === undefined ? undefinedTag : nullTag;
309
309
  }
@@ -312,7 +312,7 @@ function baseGetTag$1(value) {
312
312
  : objectToString(value);
313
313
  }
314
314
 
315
- var _baseGetTag = baseGetTag$1;
315
+ var _baseGetTag = baseGetTag$5;
316
316
 
317
317
  /**
318
318
  * Checks if `value` is object-like. A value is object-like if it's not `null`
@@ -339,17 +339,17 @@ var _baseGetTag = baseGetTag$1;
339
339
  * // => false
340
340
  */
341
341
 
342
- function isObjectLike$1(value) {
342
+ function isObjectLike$6(value) {
343
343
  return value != null && typeof value == 'object';
344
344
  }
345
345
 
346
- var isObjectLike_1 = isObjectLike$1;
346
+ var isObjectLike_1 = isObjectLike$6;
347
347
 
348
- var baseGetTag = _baseGetTag,
349
- isObjectLike = isObjectLike_1;
348
+ var baseGetTag$4 = _baseGetTag,
349
+ isObjectLike$5 = isObjectLike_1;
350
350
 
351
351
  /** `Object#toString` result references. */
352
- var symbolTag = '[object Symbol]';
352
+ var symbolTag$2 = '[object Symbol]';
353
353
 
354
354
  /**
355
355
  * Checks if `value` is classified as a `Symbol` primitive or object.
@@ -370,13 +370,13 @@ var symbolTag = '[object Symbol]';
370
370
  */
371
371
  function isSymbol$1(value) {
372
372
  return typeof value == 'symbol' ||
373
- (isObjectLike(value) && baseGetTag(value) == symbolTag);
373
+ (isObjectLike$5(value) && baseGetTag$4(value) == symbolTag$2);
374
374
  }
375
375
 
376
376
  var isSymbol_1 = isSymbol$1;
377
377
 
378
378
  var baseTrim = _baseTrim,
379
- isObject$2 = isObject_1,
379
+ isObject$7 = isObject_1,
380
380
  isSymbol = isSymbol_1;
381
381
 
382
382
  /** Used as references for various `Number` constants. */
@@ -424,9 +424,9 @@ function toNumber$1(value) {
424
424
  if (isSymbol(value)) {
425
425
  return NAN;
426
426
  }
427
- if (isObject$2(value)) {
427
+ if (isObject$7(value)) {
428
428
  var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
429
- value = isObject$2(other) ? (other + '') : other;
429
+ value = isObject$7(other) ? (other + '') : other;
430
430
  }
431
431
  if (typeof value != 'string') {
432
432
  return value === 0 ? value : +value;
@@ -440,7 +440,7 @@ function toNumber$1(value) {
440
440
 
441
441
  var toNumber_1 = toNumber$1;
442
442
 
443
- var isObject$1 = isObject_1,
443
+ var isObject$6 = isObject_1,
444
444
  now$2 = now_1,
445
445
  toNumber = toNumber_1;
446
446
 
@@ -521,7 +521,7 @@ function debounce$1(func, wait, options) {
521
521
  throw new TypeError(FUNC_ERROR_TEXT$1);
522
522
  }
523
523
  wait = toNumber(wait) || 0;
524
- if (isObject$1(options)) {
524
+ if (isObject$6(options)) {
525
525
  leading = !!options.leading;
526
526
  maxing = 'maxWait' in options;
527
527
  maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
@@ -633,7 +633,7 @@ function debounce$1(func, wait, options) {
633
633
  var debounce_1 = debounce$1;
634
634
 
635
635
  var debounce = debounce_1,
636
- isObject = isObject_1;
636
+ isObject$5 = isObject_1;
637
637
 
638
638
  /** Error message constants. */
639
639
  var FUNC_ERROR_TEXT = 'Expected a function';
@@ -689,7 +689,7 @@ function throttle(func, wait, options) {
689
689
  if (typeof func != 'function') {
690
690
  throw new TypeError(FUNC_ERROR_TEXT);
691
691
  }
692
- if (isObject(options)) {
692
+ if (isObject$5(options)) {
693
693
  leading = 'leading' in options ? !!options.leading : leading;
694
694
  trailing = 'trailing' in options ? !!options.trailing : trailing;
695
695
  }
@@ -17837,7 +17837,7 @@ function isDraft(value) {
17837
17837
  function isDraftable(value) {
17838
17838
  if (!value)
17839
17839
  return false;
17840
- return isPlainObject(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!value.constructor?.[DRAFTABLE] || isMap(value) || isSet(value);
17840
+ return isPlainObject(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!value.constructor?.[DRAFTABLE] || isMap$2(value) || isSet$2(value);
17841
17841
  }
17842
17842
  var objectCtorString = Object.prototype.constructor.toString();
17843
17843
  function isPlainObject(value) {
@@ -17863,7 +17863,7 @@ function each(obj, iter) {
17863
17863
  }
17864
17864
  function getArchtype(thing) {
17865
17865
  const state = thing[DRAFT_STATE];
17866
- return state ? state.type_ : Array.isArray(thing) ? 1 /* Array */ : isMap(thing) ? 2 /* Map */ : isSet(thing) ? 3 /* Set */ : 0 /* Object */;
17866
+ return state ? state.type_ : Array.isArray(thing) ? 1 /* Array */ : isMap$2(thing) ? 2 /* Map */ : isSet$2(thing) ? 3 /* Set */ : 0 /* Object */;
17867
17867
  }
17868
17868
  function has(thing, prop) {
17869
17869
  return getArchtype(thing) === 2 /* Map */ ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);
@@ -17884,20 +17884,20 @@ function is(x, y) {
17884
17884
  return x !== x && y !== y;
17885
17885
  }
17886
17886
  }
17887
- function isMap(target) {
17887
+ function isMap$2(target) {
17888
17888
  return target instanceof Map;
17889
17889
  }
17890
- function isSet(target) {
17890
+ function isSet$2(target) {
17891
17891
  return target instanceof Set;
17892
17892
  }
17893
17893
  function latest(state) {
17894
17894
  return state.copy_ || state.base_;
17895
17895
  }
17896
17896
  function shallowCopy(base, strict) {
17897
- if (isMap(base)) {
17897
+ if (isMap$2(base)) {
17898
17898
  return new Map(base);
17899
17899
  }
17900
- if (isSet(base)) {
17900
+ if (isSet$2(base)) {
17901
17901
  return new Set(base);
17902
17902
  }
17903
17903
  if (Array.isArray(base))
@@ -18431,7 +18431,7 @@ var Immer2 = class {
18431
18431
  }
18432
18432
  };
18433
18433
  function createProxy(value, parent) {
18434
- const draft = isMap(value) ? getPlugin("MapSet").proxyMap_(value, parent) : isSet(value) ? getPlugin("MapSet").proxySet_(value, parent) : createProxyProxy(value, parent);
18434
+ const draft = isMap$2(value) ? getPlugin("MapSet").proxyMap_(value, parent) : isSet$2(value) ? getPlugin("MapSet").proxySet_(value, parent) : createProxyProxy(value, parent);
18435
18435
  const scope = parent ? parent.scope_ : getCurrentScope();
18436
18436
  scope.drafts_.push(draft);
18437
18437
  return draft;
@@ -20252,7 +20252,7 @@ function pick(obj, keys) {
20252
20252
  }, {});
20253
20253
  }
20254
20254
 
20255
- function hasOwnProperty(obj, prop) {
20255
+ function hasOwnProperty$9(obj, prop) {
20256
20256
  return Object.prototype.hasOwnProperty.call(obj, prop);
20257
20257
  }
20258
20258
 
@@ -20445,7 +20445,7 @@ function asNumber(value) {
20445
20445
  function normalizeObject(obj, normalizer) {
20446
20446
  const normalized = {};
20447
20447
  for (const u in obj) {
20448
- if (hasOwnProperty(obj, u)) {
20448
+ if (hasOwnProperty$9(obj, u)) {
20449
20449
  const v = obj[u];
20450
20450
  if (v === undefined || v === null) continue;
20451
20451
  normalized[normalizer(u)] = asNumber(v);
@@ -22000,7 +22000,7 @@ class Duration {
22000
22000
  result = {};
22001
22001
 
22002
22002
  for (const k of orderedUnits$1) {
22003
- if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) {
22003
+ if (hasOwnProperty$9(dur.values, k) || hasOwnProperty$9(this.values, k)) {
22004
22004
  result[k] = dur.get(k) + this.get(k);
22005
22005
  }
22006
22006
  }
@@ -23655,7 +23655,7 @@ function match(input, regex, handlers) {
23655
23655
  const all = {};
23656
23656
  let matchIndex = 1;
23657
23657
  for (const i in handlers) {
23658
- if (hasOwnProperty(handlers, i)) {
23658
+ if (hasOwnProperty$9(handlers, i)) {
23659
23659
  const h = handlers[i],
23660
23660
  groups = h.groups ? h.groups + 1 : 1;
23661
23661
  if (!h.literal && h.token) {
@@ -23797,7 +23797,7 @@ function explainFromTokens(locale, input, format) {
23797
23797
  [result, zone, specificOffset] = matches
23798
23798
  ? dateTimeFromMatches(matches)
23799
23799
  : [null, null, undefined];
23800
- if (hasOwnProperty(matches, "a") && hasOwnProperty(matches, "H")) {
23800
+ if (hasOwnProperty$9(matches, "a") && hasOwnProperty$9(matches, "H")) {
23801
23801
  throw new ConflictingSpecificationError(
23802
23802
  "Can't include meridiem when specifying 24-hour format"
23803
23803
  );
@@ -26563,14 +26563,14 @@ async function sleep(time) {
26563
26563
  return new Promise((resolve) => setTimeout(resolve, time));
26564
26564
  }
26565
26565
 
26566
- function reducer$3(state, patch) {
26566
+ function reducer$4(state, patch) {
26567
26567
  return { ...state, ...patch };
26568
26568
  }
26569
26569
  function AutoUpdate(props) {
26570
26570
  const props_ref = reactExports.useRef(props);
26571
26571
  props_ref.current = props;
26572
26572
  const [output, set_output] = reactExports.useState([]);
26573
- const [state, patch] = reactExports.useReducer(reducer$3, {
26573
+ const [state, patch] = reactExports.useReducer(reducer$4, {
26574
26574
  error: null,
26575
26575
  local_version: null,
26576
26576
  latest_version: null,
@@ -26773,12 +26773,12 @@ function Command(props) {
26773
26773
  return (reactExports.createElement(Text, { bold: true, color: text_color }, props.children));
26774
26774
  }
26775
26775
 
26776
- function reducer$2(state, patch) {
26776
+ function reducer$3(state, patch) {
26777
26777
  return { ...state, ...patch };
26778
26778
  }
26779
26779
  function CherryPickCheck(props) {
26780
26780
  const actions = Store.useActions();
26781
- const [state, patch] = reactExports.useReducer(reducer$2, {
26781
+ const [state, patch] = reactExports.useReducer(reducer$3, {
26782
26782
  status: "init",
26783
26783
  });
26784
26784
  switch (state.status) {
@@ -26794,12 +26794,12 @@ function CherryPickCheck(props) {
26794
26794
  actions.exit(0);
26795
26795
  } }));
26796
26796
  default:
26797
- return (reactExports.createElement(Await, { fallback: reactExports.createElement(Text, { color: colors.yellow },
26797
+ return (reactExports.createElement(Await, { function: run, fallback: reactExports.createElement(Text, { color: colors.yellow },
26798
26798
  "Checking for ",
26799
26799
  reactExports.createElement(Command, null, "git cherry-pick"),
26800
- "\u2026"), function: cherry_pick_check }));
26800
+ "\u2026") }));
26801
26801
  }
26802
- async function cherry_pick_check() {
26802
+ async function run() {
26803
26803
  const actions = Store.getState().actions;
26804
26804
  try {
26805
26805
  const git_dir = (await cli(`git rev-parse --absolute-git-dir`)).stdout;
@@ -26814,7 +26814,7 @@ function CherryPickCheck(props) {
26814
26814
  actions.error(err.message);
26815
26815
  }
26816
26816
  }
26817
- actions.exit(9);
26817
+ actions.exit(11);
26818
26818
  }
26819
26819
  }
26820
26820
  }
@@ -27031,360 +27031,2783 @@ function CheckGitRevise(props) {
27031
27031
  } }, props.children));
27032
27032
  }
27033
27033
 
27034
- function reducer$1(state, patch) {
27035
- return { ...state, ...patch };
27036
- }
27037
- function DirtyCheck(props) {
27038
- const actions = Store.useActions();
27039
- const [state, patch] = reactExports.useReducer(reducer$1, {
27040
- status: "init",
27041
- });
27042
- switch (state.status) {
27043
- case "done":
27044
- return props.children;
27045
- case "prompt":
27046
- return (reactExports.createElement(YesNoPrompt, { message: reactExports.createElement(Box, { flexDirection: "column" },
27047
- reactExports.createElement(FormatText, { wrapper: reactExports.createElement(Text, { color: colors.yellow }), message: "{git} repo has uncommitted changes.", values: {
27048
- git: reactExports.createElement(Command, null, "git"),
27049
- git_stack: reactExports.createElement(Command, null, "git stack"),
27050
- } }),
27051
- reactExports.createElement(FormatText, { wrapper: reactExports.createElement(Text, { color: colors.yellow }), message: "Changes may be lost during {git_stack}, are you sure you want to proceed?", values: {
27052
- git: reactExports.createElement(Command, null, "git"),
27053
- git_stack: reactExports.createElement(Command, null, "git stack"),
27054
- } })), onYes: async () => {
27055
- patch({ status: "done" });
27056
- }, onNo: async () => {
27057
- actions.exit(0);
27058
- } }));
27059
- default:
27060
- return (reactExports.createElement(Await, { fallback: reactExports.createElement(Text, { color: colors.yellow },
27061
- "Ensuring ",
27062
- reactExports.createElement(Command, null, "git status --porcelain"),
27063
- "\u2026"), function: rebase_check }));
27064
- }
27065
- async function rebase_check() {
27066
- const actions = Store.getState().actions;
27067
- try {
27068
- const git_dirty = (await cli(`git status --porcelain`)).stdout;
27069
- const status = git_dirty ? "prompt" : "done";
27070
- patch({ status });
27071
- }
27072
- catch (err) {
27073
- actions.error("Must be run from within a git repository.");
27074
- if (err instanceof Error) {
27075
- if (actions.isDebug()) {
27076
- actions.error(err.message);
27077
- }
27078
- }
27079
- actions.exit(9);
27080
- }
27081
- }
27034
+ /**
27035
+ * Removes all key-value entries from the list cache.
27036
+ *
27037
+ * @private
27038
+ * @name clear
27039
+ * @memberOf ListCache
27040
+ */
27041
+
27042
+ function listCacheClear$1() {
27043
+ this.__data__ = [];
27044
+ this.size = 0;
27082
27045
  }
27083
27046
 
27084
- function GatherMetadata(props) {
27085
- const fallback = (reactExports.createElement(Text, { color: colors.yellow }, "Gathering local git information\u2026"));
27086
- return (reactExports.createElement(Await, { fallback: fallback, function: gather_metadata$1 }, props.children));
27047
+ var _listCacheClear = listCacheClear$1;
27048
+
27049
+ /**
27050
+ * Performs a
27051
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
27052
+ * comparison between two values to determine if they are equivalent.
27053
+ *
27054
+ * @static
27055
+ * @memberOf _
27056
+ * @since 4.0.0
27057
+ * @category Lang
27058
+ * @param {*} value The value to compare.
27059
+ * @param {*} other The other value to compare.
27060
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
27061
+ * @example
27062
+ *
27063
+ * var object = { 'a': 1 };
27064
+ * var other = { 'a': 1 };
27065
+ *
27066
+ * _.eq(object, object);
27067
+ * // => true
27068
+ *
27069
+ * _.eq(object, other);
27070
+ * // => false
27071
+ *
27072
+ * _.eq('a', 'a');
27073
+ * // => true
27074
+ *
27075
+ * _.eq('a', Object('a'));
27076
+ * // => false
27077
+ *
27078
+ * _.eq(NaN, NaN);
27079
+ * // => true
27080
+ */
27081
+
27082
+ function eq$2(value, other) {
27083
+ return value === other || (value !== value && other !== other);
27087
27084
  }
27088
- async function gather_metadata$1() {
27089
- const actions = Store.getState().actions;
27090
- const argv = Store.getState().argv;
27091
- try {
27092
- // default to master branch, fallback to main
27093
- let master_branch;
27094
- if (argv.branch) {
27095
- actions.debug(reactExports.createElement(FormatText, { message: "Setting master branch to {branch}", values: {
27096
- branch: reactExports.createElement(Brackets, null, argv.branch),
27097
- } }));
27098
- master_branch = argv.branch;
27099
- }
27100
- else {
27101
- const detect_master = await cli(`git branch --list "${BRANCH.master}" --color=never`);
27102
- if (detect_master.stdout !== "") {
27103
- master_branch = BRANCH.master;
27104
- }
27105
- else {
27106
- actions.debug(reactExports.createElement(FormatText, { message: "Could not find {master} branch, falling back to {main}", values: {
27107
- master: reactExports.createElement(Brackets, null, BRANCH.master),
27108
- main: reactExports.createElement(Brackets, null, BRANCH.main),
27109
- } }));
27110
- master_branch = BRANCH.main;
27111
- }
27112
- }
27113
- const branch_name = (await cli("git rev-parse --abbrev-ref HEAD")).stdout;
27114
- // handle detahed head state
27115
- if (branch_name === "HEAD") {
27116
- actions.error("Must run within a branch.");
27117
- actions.exit(0);
27118
- return;
27119
- }
27120
- // handle when there are no detected changes
27121
- if (branch_name === master_branch) {
27122
- actions.error("Must run within a branch.");
27123
- actions.exit(0);
27124
- return;
27125
- }
27126
- const head = (await cli("git rev-parse HEAD")).stdout;
27127
- const merge_base = (await cli(`git merge-base HEAD ${master_branch}`))
27128
- .stdout;
27129
- // handle when there are no detected changes
27130
- if (head === merge_base) {
27131
- actions.newline();
27132
- actions.output(reactExports.createElement(Text, { color: colors.gray }, "No changes detected."));
27133
- actions.exit(0);
27134
- return;
27135
- }
27136
- // git@github.com:magus/git-multi-diff-playground.git
27137
- // https://github.com/magus/git-multi-diff-playground.git
27138
- const origin_url = (await cli(`git config --get remote.origin.url`)).stdout;
27139
- const repo_path = match_group(origin_url, RE$3.repo_path, "repo_path");
27140
- const repo_root = (await cli(`git rev-parse --show-toplevel`)).stdout;
27141
- Store.setState((state) => {
27142
- state.repo_path = repo_path;
27143
- state.repo_root = repo_root;
27144
- state.master_branch = master_branch;
27145
- state.head = head;
27146
- state.branch_name = branch_name;
27147
- });
27148
- }
27149
- catch (err) {
27150
- actions.error("Unable to gather git metadata.");
27151
- if (err instanceof Error) {
27152
- if (actions.isDebug()) {
27153
- actions.error(err.message);
27154
- }
27155
- }
27156
- actions.exit(7);
27085
+
27086
+ var eq_1 = eq$2;
27087
+
27088
+ var eq$1 = eq_1;
27089
+
27090
+ /**
27091
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
27092
+ *
27093
+ * @private
27094
+ * @param {Array} array The array to inspect.
27095
+ * @param {*} key The key to search for.
27096
+ * @returns {number} Returns the index of the matched value, else `-1`.
27097
+ */
27098
+ function assocIndexOf$4(array, key) {
27099
+ var length = array.length;
27100
+ while (length--) {
27101
+ if (eq$1(array[length][0], key)) {
27102
+ return length;
27157
27103
  }
27104
+ }
27105
+ return -1;
27158
27106
  }
27159
- const RE$3 = {
27160
- // git@github.com:magus/git-multi-diff-playground.git
27161
- // https://github.com/magus/git-multi-diff-playground.git
27162
- repo_path: /(?<repo_path>[^:^/]+\/[^/]+)\.git/,
27163
- };
27164
- const BRANCH = {
27165
- master: "master",
27166
- main: "main",
27167
- };
27168
27107
 
27169
- function intl_format(date, options) {
27170
- return new Intl.DateTimeFormat("en-US", options).format(date);
27108
+ var _assocIndexOf = assocIndexOf$4;
27109
+
27110
+ var assocIndexOf$3 = _assocIndexOf;
27111
+
27112
+ /** Used for built-in method references. */
27113
+ var arrayProto = Array.prototype;
27114
+
27115
+ /** Built-in value references. */
27116
+ var splice = arrayProto.splice;
27117
+
27118
+ /**
27119
+ * Removes `key` and its value from the list cache.
27120
+ *
27121
+ * @private
27122
+ * @name delete
27123
+ * @memberOf ListCache
27124
+ * @param {string} key The key of the value to remove.
27125
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
27126
+ */
27127
+ function listCacheDelete$1(key) {
27128
+ var data = this.__data__,
27129
+ index = assocIndexOf$3(data, key);
27130
+
27131
+ if (index < 0) {
27132
+ return false;
27133
+ }
27134
+ var lastIndex = data.length - 1;
27135
+ if (index == lastIndex) {
27136
+ data.pop();
27137
+ } else {
27138
+ splice.call(data, index, 1);
27139
+ }
27140
+ --this.size;
27141
+ return true;
27171
27142
  }
27172
- function format_time(date) {
27173
- const time = intl_format(date, {
27174
- hour: "numeric",
27175
- minute: "2-digit",
27176
- hour12: true,
27177
- });
27178
- return time;
27143
+
27144
+ var _listCacheDelete = listCacheDelete$1;
27145
+
27146
+ var assocIndexOf$2 = _assocIndexOf;
27147
+
27148
+ /**
27149
+ * Gets the list cache value for `key`.
27150
+ *
27151
+ * @private
27152
+ * @name get
27153
+ * @memberOf ListCache
27154
+ * @param {string} key The key of the value to get.
27155
+ * @returns {*} Returns the entry value.
27156
+ */
27157
+ function listCacheGet$1(key) {
27158
+ var data = this.__data__,
27159
+ index = assocIndexOf$2(data, key);
27160
+
27161
+ return index < 0 ? undefined : data[index][1];
27179
27162
  }
27180
27163
 
27181
- function GithubApiError() {
27182
- return reactExports.createElement(Await, { fallback: null, function: run$7 });
27164
+ var _listCacheGet = listCacheGet$1;
27165
+
27166
+ var assocIndexOf$1 = _assocIndexOf;
27167
+
27168
+ /**
27169
+ * Checks if a list cache value for `key` exists.
27170
+ *
27171
+ * @private
27172
+ * @name has
27173
+ * @memberOf ListCache
27174
+ * @param {string} key The key of the entry to check.
27175
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
27176
+ */
27177
+ function listCacheHas$1(key) {
27178
+ return assocIndexOf$1(this.__data__, key) > -1;
27183
27179
  }
27184
- async function run$7() {
27185
- const actions = Store.getState().actions;
27186
- const res = await cli(`gh api https://api.github.com/rate_limit`);
27187
- const res_json = JSON.parse(res.stdout);
27188
- const resources_graphql = res_json.resources.graphql;
27189
- const used = resources_graphql.used;
27190
- const limit = resources_graphql.limit;
27191
- const reset_date = new Date(resources_graphql.reset * 1000);
27192
- // calculate the time remaining in minutes
27193
- const now = new Date();
27194
- const diff_seconds = (reset_date.getTime() - now.getTime()) / 1000;
27195
- const diff_minutes = Math.round(diff_seconds / 60);
27196
- const reset_time = format_time(reset_date);
27197
- let time_until;
27198
- if (diff_minutes < 0) {
27199
- time_until = `${diff_seconds} seconds`;
27200
- }
27201
- else {
27202
- time_until = `${diff_minutes} minutes`;
27203
- }
27204
- actions.output(reactExports.createElement(Text, { dimColor: true },
27205
- reactExports.createElement(Text, null, "Github "),
27206
- reactExports.createElement(Brackets, null, "graphql"),
27207
- reactExports.createElement(Text, null, " API rate limit "),
27208
- reactExports.createElement(Brackets, null,
27209
- reactExports.createElement(Text, null, used),
27210
- reactExports.createElement(Text, null, "/"),
27211
- reactExports.createElement(Text, null, limit)),
27212
- reactExports.createElement(Text, null, " will reset at "),
27213
- reactExports.createElement(Text, { bold: true, color: colors.yellow }, reset_time),
27214
- reactExports.createElement(Text, null, " "),
27215
- reactExports.createElement(Parens, null,
27216
- reactExports.createElement(Text, null, "in "),
27217
- reactExports.createElement(Text, { bold: true, color: colors.yellow }, time_until))));
27180
+
27181
+ var _listCacheHas = listCacheHas$1;
27182
+
27183
+ var assocIndexOf = _assocIndexOf;
27184
+
27185
+ /**
27186
+ * Sets the list cache `key` to `value`.
27187
+ *
27188
+ * @private
27189
+ * @name set
27190
+ * @memberOf ListCache
27191
+ * @param {string} key The key of the value to set.
27192
+ * @param {*} value The value to set.
27193
+ * @returns {Object} Returns the list cache instance.
27194
+ */
27195
+ function listCacheSet$1(key, value) {
27196
+ var data = this.__data__,
27197
+ index = assocIndexOf(data, key);
27198
+
27199
+ if (index < 0) {
27200
+ ++this.size;
27201
+ data.push([key, value]);
27202
+ } else {
27203
+ data[index][1] = value;
27204
+ }
27205
+ return this;
27218
27206
  }
27219
27207
 
27220
- // escape double-quote for cli
27221
- function safe_quote(value) {
27222
- let result = value;
27223
- result = result.replace(RE$2.all_double_quote, '\\"');
27224
- return result;
27208
+ var _listCacheSet = listCacheSet$1;
27209
+
27210
+ var listCacheClear = _listCacheClear,
27211
+ listCacheDelete = _listCacheDelete,
27212
+ listCacheGet = _listCacheGet,
27213
+ listCacheHas = _listCacheHas,
27214
+ listCacheSet = _listCacheSet;
27215
+
27216
+ /**
27217
+ * Creates an list cache object.
27218
+ *
27219
+ * @private
27220
+ * @constructor
27221
+ * @param {Array} [entries] The key-value pairs to cache.
27222
+ */
27223
+ function ListCache$4(entries) {
27224
+ var index = -1,
27225
+ length = entries == null ? 0 : entries.length;
27226
+
27227
+ this.clear();
27228
+ while (++index < length) {
27229
+ var entry = entries[index];
27230
+ this.set(entry[0], entry[1]);
27231
+ }
27225
27232
  }
27226
- const RE$2 = {
27227
- all_double_quote: /"/g,
27228
- };
27229
27233
 
27230
- function write$1(message, values) {
27231
- let result = message;
27232
- // remove any previous metadata lines
27233
- result = remove(result);
27234
- const line_list = [result, "", TEMPLATE$1.stack_id(values.id)];
27235
- if (values.title) {
27236
- line_list.push(TEMPLATE$1.group_title(values.title));
27237
- }
27238
- let new_message = line_list.join("\n");
27239
- new_message = safe_quote(new_message);
27240
- return new_message;
27234
+ // Add methods to `ListCache`.
27235
+ ListCache$4.prototype.clear = listCacheClear;
27236
+ ListCache$4.prototype['delete'] = listCacheDelete;
27237
+ ListCache$4.prototype.get = listCacheGet;
27238
+ ListCache$4.prototype.has = listCacheHas;
27239
+ ListCache$4.prototype.set = listCacheSet;
27240
+
27241
+ var _ListCache = ListCache$4;
27242
+
27243
+ var ListCache$3 = _ListCache;
27244
+
27245
+ /**
27246
+ * Removes all key-value entries from the stack.
27247
+ *
27248
+ * @private
27249
+ * @name clear
27250
+ * @memberOf Stack
27251
+ */
27252
+ function stackClear$1() {
27253
+ this.__data__ = new ListCache$3;
27254
+ this.size = 0;
27241
27255
  }
27242
- function read(message) {
27243
- const values = { id: null, title: null };
27244
- const match_id = message.match(RE$1.stack_id);
27245
- if (match_id?.groups) {
27246
- values.id = match_id.groups["id"];
27247
- invariant(values.id, "id must exist");
27248
- }
27249
- const match_title = message.match(RE$1.group_title);
27250
- if (match_title?.groups) {
27251
- values.title = match_title.groups["title"];
27252
- }
27253
- return values;
27256
+
27257
+ var _stackClear = stackClear$1;
27258
+
27259
+ /**
27260
+ * Removes `key` and its value from the stack.
27261
+ *
27262
+ * @private
27263
+ * @name delete
27264
+ * @memberOf Stack
27265
+ * @param {string} key The key of the value to remove.
27266
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
27267
+ */
27268
+
27269
+ function stackDelete$1(key) {
27270
+ var data = this.__data__,
27271
+ result = data['delete'](key);
27272
+
27273
+ this.size = data.size;
27274
+ return result;
27254
27275
  }
27255
- function remove(message) {
27256
- let result = message;
27257
- // remove metadata
27258
- result = result.replace(new RegExp(RE$1.stack_id, "gmi"), "");
27259
- result = result.replace(new RegExp(RE$1.group_title, "gmi"), "");
27260
- result = result.trimEnd();
27261
- return result;
27276
+
27277
+ var _stackDelete = stackDelete$1;
27278
+
27279
+ /**
27280
+ * Gets the stack value for `key`.
27281
+ *
27282
+ * @private
27283
+ * @name get
27284
+ * @memberOf Stack
27285
+ * @param {string} key The key of the value to get.
27286
+ * @returns {*} Returns the entry value.
27287
+ */
27288
+
27289
+ function stackGet$1(key) {
27290
+ return this.__data__.get(key);
27262
27291
  }
27263
- const TEMPLATE$1 = {
27264
- stack_id(id) {
27265
- return `git-stack-id: ${id}`;
27266
- },
27267
- group_title(title) {
27268
- return `git-stack-title: ${title}`;
27269
- },
27270
- };
27271
- const RE$1 = {
27272
- // https://regex101.com/r/wLmGVq/1
27273
- stack_id: new RegExp(`${TEMPLATE$1.stack_id("(?<id>[^\\s]+)")}`, "i"),
27274
- group_title: new RegExp(TEMPLATE$1.group_title("(?<title>[^\\n^\\r]+)"), "i"),
27275
- };
27276
27292
 
27277
- async function pr_list() {
27278
- const state = Store.getState();
27279
- const actions = state.actions;
27280
- const username = state.username;
27281
- const repo_path = state.repo_path;
27282
- invariant(username, "username must exist");
27283
- invariant(repo_path, "repo_path must exist");
27284
- const result_pr_list = await gh_json(`pr list --repo ${repo_path} --author ${username} --state open ${JSON_FIELDS}`);
27285
- if (result_pr_list instanceof Error) {
27286
- handle_error(result_pr_list.message);
27287
- }
27288
- if (actions.isDebug()) {
27289
- actions.output(reactExports.createElement(Text, { dimColor: true },
27290
- reactExports.createElement(Text, null, "Github cache "),
27291
- reactExports.createElement(Text, { bold: true, color: colors.yellow }, result_pr_list.length),
27292
- reactExports.createElement(Text, null, " open PRs from "),
27293
- reactExports.createElement(Brackets, null, repo_path),
27294
- reactExports.createElement(Text, null, " authored by "),
27295
- reactExports.createElement(Brackets, null, username)));
27296
- }
27297
- actions.set((state) => {
27298
- for (const pr of result_pr_list) {
27299
- state.pr[pr.headRefName] = pr;
27300
- }
27301
- });
27302
- return result_pr_list;
27293
+ var _stackGet = stackGet$1;
27294
+
27295
+ /**
27296
+ * Checks if a stack value for `key` exists.
27297
+ *
27298
+ * @private
27299
+ * @name has
27300
+ * @memberOf Stack
27301
+ * @param {string} key The key of the entry to check.
27302
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
27303
+ */
27304
+
27305
+ function stackHas$1(key) {
27306
+ return this.__data__.has(key);
27303
27307
  }
27304
- async function pr_status(branch) {
27305
- const state = Store.getState();
27306
- const actions = state.actions;
27307
- const username = state.username;
27308
- const repo_path = state.repo_path;
27309
- invariant(username, "username must exist");
27310
- invariant(repo_path, "repo_path must exist");
27311
- const cache = state.pr[branch];
27312
- if (cache) {
27313
- if (actions.isDebug()) {
27314
- actions.output(reactExports.createElement(Text, null,
27315
- reactExports.createElement(Text, { dimColor: true }, "Github pr_status cache"),
27316
- reactExports.createElement(Text, null, " "),
27317
- reactExports.createElement(Text, { bold: true, color: colors.green }, "HIT "),
27318
- reactExports.createElement(Text, null, " "),
27319
- reactExports.createElement(Text, { dimColor: true }, branch)));
27320
- }
27321
- return cache;
27322
- }
27323
- if (actions.isDebug()) {
27324
- actions.output(reactExports.createElement(Text, null,
27325
- reactExports.createElement(Text, { dimColor: true }, "Github pr_status cache"),
27326
- reactExports.createElement(Text, null, " "),
27327
- reactExports.createElement(Text, { bold: true, color: colors.red }, "MISS"),
27328
- reactExports.createElement(Text, null, " "),
27329
- reactExports.createElement(Text, { dimColor: true }, branch)));
27330
- }
27331
- const pr = await gh_json(`pr view ${branch} --repo ${repo_path} ${JSON_FIELDS}`);
27332
- if (pr instanceof Error) {
27333
- return null;
27334
- }
27335
- actions.set((state) => {
27336
- state.pr[pr.headRefName] = pr;
27337
- });
27338
- return pr;
27308
+
27309
+ var _stackHas = stackHas$1;
27310
+
27311
+ var baseGetTag$3 = _baseGetTag,
27312
+ isObject$4 = isObject_1;
27313
+
27314
+ /** `Object#toString` result references. */
27315
+ var asyncTag = '[object AsyncFunction]',
27316
+ funcTag$2 = '[object Function]',
27317
+ genTag$1 = '[object GeneratorFunction]',
27318
+ proxyTag = '[object Proxy]';
27319
+
27320
+ /**
27321
+ * Checks if `value` is classified as a `Function` object.
27322
+ *
27323
+ * @static
27324
+ * @memberOf _
27325
+ * @since 0.1.0
27326
+ * @category Lang
27327
+ * @param {*} value The value to check.
27328
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
27329
+ * @example
27330
+ *
27331
+ * _.isFunction(_);
27332
+ * // => true
27333
+ *
27334
+ * _.isFunction(/abc/);
27335
+ * // => false
27336
+ */
27337
+ function isFunction$3(value) {
27338
+ if (!isObject$4(value)) {
27339
+ return false;
27340
+ }
27341
+ // The use of `Object#toString` avoids issues with the `typeof` operator
27342
+ // in Safari 9 which returns 'object' for typed arrays and other constructors.
27343
+ var tag = baseGetTag$3(value);
27344
+ return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
27339
27345
  }
27340
- async function pr_create(args) {
27341
- const title = safe_quote(args.title);
27342
- let command = `gh pr create --fill --head ${args.branch} --base ${args.base} --title="${title}" --body="${args.body}"`;
27343
- if (args.draft) {
27344
- command += " --draft";
27345
- }
27346
- const cli_result = await cli(command);
27347
- if (cli_result.code !== 0) {
27348
- handle_error(cli_result.output);
27349
- return null;
27350
- }
27351
- return cli_result.stdout;
27346
+
27347
+ var isFunction_1 = isFunction$3;
27348
+
27349
+ var root$6 = _root;
27350
+
27351
+ /** Used to detect overreaching core-js shims. */
27352
+ var coreJsData$1 = root$6['__core-js_shared__'];
27353
+
27354
+ var _coreJsData = coreJsData$1;
27355
+
27356
+ var coreJsData = _coreJsData;
27357
+
27358
+ /** Used to detect methods masquerading as native. */
27359
+ var maskSrcKey = (function() {
27360
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
27361
+ return uid ? ('Symbol(src)_1.' + uid) : '';
27362
+ }());
27363
+
27364
+ /**
27365
+ * Checks if `func` has its source masked.
27366
+ *
27367
+ * @private
27368
+ * @param {Function} func The function to check.
27369
+ * @returns {boolean} Returns `true` if `func` is masked, else `false`.
27370
+ */
27371
+ function isMasked$1(func) {
27372
+ return !!maskSrcKey && (maskSrcKey in func);
27352
27373
  }
27353
- async function pr_edit(args) {
27354
- const cli_result = await cli(
27355
- // prettier-ignore
27356
- `gh pr edit ${args.branch} --base ${args.base} --body-file="${body_file(args.body)}"`);
27357
- if (cli_result.code !== 0) {
27358
- handle_error(cli_result.output);
27359
- }
27374
+
27375
+ var _isMasked = isMasked$1;
27376
+
27377
+ /** Used for built-in method references. */
27378
+
27379
+ var funcProto$1 = Function.prototype;
27380
+
27381
+ /** Used to resolve the decompiled source of functions. */
27382
+ var funcToString$1 = funcProto$1.toString;
27383
+
27384
+ /**
27385
+ * Converts `func` to its source code.
27386
+ *
27387
+ * @private
27388
+ * @param {Function} func The function to convert.
27389
+ * @returns {string} Returns the source code.
27390
+ */
27391
+ function toSource$2(func) {
27392
+ if (func != null) {
27393
+ try {
27394
+ return funcToString$1.call(func);
27395
+ } catch (e) {}
27396
+ try {
27397
+ return (func + '');
27398
+ } catch (e) {}
27399
+ }
27400
+ return '';
27360
27401
  }
27361
- // prettier-ignore
27362
- const JSON_FIELDS = "--json number,state,baseRefName,headRefName,commits,title,body,url";
27363
- // consistent handle gh cli commands returning json
27364
- // redirect to tmp file to avoid scrollback overflow causing scrollback to be cleared
27365
- async function gh_json(command) {
27366
- const tmp_pr_json = path.join(os.tmpdir(), "git-stack-gh.json");
27367
- const options = { ignoreExitCode: true };
27368
- const cli_result = await cli(`gh ${command} > ${tmp_pr_json}`, options);
27369
- if (cli_result.code !== 0) {
27370
- return new Error(cli_result.output);
27371
- }
27372
- // read from file
27373
- const json_str = fs.readFileSync(tmp_pr_json, "utf-8");
27374
- const json = JSON.parse(json_str);
27375
- return json;
27402
+
27403
+ var _toSource = toSource$2;
27404
+
27405
+ var isFunction$2 = isFunction_1,
27406
+ isMasked = _isMasked,
27407
+ isObject$3 = isObject_1,
27408
+ toSource$1 = _toSource;
27409
+
27410
+ /**
27411
+ * Used to match `RegExp`
27412
+ * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
27413
+ */
27414
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
27415
+
27416
+ /** Used to detect host constructors (Safari). */
27417
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
27418
+
27419
+ /** Used for built-in method references. */
27420
+ var funcProto = Function.prototype,
27421
+ objectProto$a = Object.prototype;
27422
+
27423
+ /** Used to resolve the decompiled source of functions. */
27424
+ var funcToString = funcProto.toString;
27425
+
27426
+ /** Used to check objects for own properties. */
27427
+ var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
27428
+
27429
+ /** Used to detect if a method is native. */
27430
+ var reIsNative = RegExp('^' +
27431
+ funcToString.call(hasOwnProperty$8).replace(reRegExpChar, '\\$&')
27432
+ .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
27433
+ );
27434
+
27435
+ /**
27436
+ * The base implementation of `_.isNative` without bad shim checks.
27437
+ *
27438
+ * @private
27439
+ * @param {*} value The value to check.
27440
+ * @returns {boolean} Returns `true` if `value` is a native function,
27441
+ * else `false`.
27442
+ */
27443
+ function baseIsNative$1(value) {
27444
+ if (!isObject$3(value) || isMasked(value)) {
27445
+ return false;
27446
+ }
27447
+ var pattern = isFunction$2(value) ? reIsNative : reIsHostCtor;
27448
+ return pattern.test(toSource$1(value));
27376
27449
  }
27377
- function handle_error(output) {
27378
- const state = Store.getState();
27379
- const actions = state.actions;
27380
- actions.set((state) => {
27381
- state.step = "github-api-error";
27382
- });
27383
- throw new Error(output);
27450
+
27451
+ var _baseIsNative = baseIsNative$1;
27452
+
27453
+ /**
27454
+ * Gets the value at `key` of `object`.
27455
+ *
27456
+ * @private
27457
+ * @param {Object} [object] The object to query.
27458
+ * @param {string} key The key of the property to get.
27459
+ * @returns {*} Returns the property value.
27460
+ */
27461
+
27462
+ function getValue$1(object, key) {
27463
+ return object == null ? undefined : object[key];
27384
27464
  }
27385
- // convert a string to a file for use via github cli `--body-file`
27386
- function body_file(body) {
27387
- const temp_dir = os.tmpdir();
27465
+
27466
+ var _getValue = getValue$1;
27467
+
27468
+ var baseIsNative = _baseIsNative,
27469
+ getValue = _getValue;
27470
+
27471
+ /**
27472
+ * Gets the native function at `key` of `object`.
27473
+ *
27474
+ * @private
27475
+ * @param {Object} object The object to query.
27476
+ * @param {string} key The key of the method to get.
27477
+ * @returns {*} Returns the function if it's native, else `undefined`.
27478
+ */
27479
+ function getNative$7(object, key) {
27480
+ var value = getValue(object, key);
27481
+ return baseIsNative(value) ? value : undefined;
27482
+ }
27483
+
27484
+ var _getNative = getNative$7;
27485
+
27486
+ var getNative$6 = _getNative,
27487
+ root$5 = _root;
27488
+
27489
+ /* Built-in method references that are verified to be native. */
27490
+ var Map$4 = getNative$6(root$5, 'Map');
27491
+
27492
+ var _Map = Map$4;
27493
+
27494
+ var getNative$5 = _getNative;
27495
+
27496
+ /* Built-in method references that are verified to be native. */
27497
+ var nativeCreate$4 = getNative$5(Object, 'create');
27498
+
27499
+ var _nativeCreate = nativeCreate$4;
27500
+
27501
+ var nativeCreate$3 = _nativeCreate;
27502
+
27503
+ /**
27504
+ * Removes all key-value entries from the hash.
27505
+ *
27506
+ * @private
27507
+ * @name clear
27508
+ * @memberOf Hash
27509
+ */
27510
+ function hashClear$1() {
27511
+ this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
27512
+ this.size = 0;
27513
+ }
27514
+
27515
+ var _hashClear = hashClear$1;
27516
+
27517
+ /**
27518
+ * Removes `key` and its value from the hash.
27519
+ *
27520
+ * @private
27521
+ * @name delete
27522
+ * @memberOf Hash
27523
+ * @param {Object} hash The hash to modify.
27524
+ * @param {string} key The key of the value to remove.
27525
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
27526
+ */
27527
+
27528
+ function hashDelete$1(key) {
27529
+ var result = this.has(key) && delete this.__data__[key];
27530
+ this.size -= result ? 1 : 0;
27531
+ return result;
27532
+ }
27533
+
27534
+ var _hashDelete = hashDelete$1;
27535
+
27536
+ var nativeCreate$2 = _nativeCreate;
27537
+
27538
+ /** Used to stand-in for `undefined` hash values. */
27539
+ var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
27540
+
27541
+ /** Used for built-in method references. */
27542
+ var objectProto$9 = Object.prototype;
27543
+
27544
+ /** Used to check objects for own properties. */
27545
+ var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
27546
+
27547
+ /**
27548
+ * Gets the hash value for `key`.
27549
+ *
27550
+ * @private
27551
+ * @name get
27552
+ * @memberOf Hash
27553
+ * @param {string} key The key of the value to get.
27554
+ * @returns {*} Returns the entry value.
27555
+ */
27556
+ function hashGet$1(key) {
27557
+ var data = this.__data__;
27558
+ if (nativeCreate$2) {
27559
+ var result = data[key];
27560
+ return result === HASH_UNDEFINED$1 ? undefined : result;
27561
+ }
27562
+ return hasOwnProperty$7.call(data, key) ? data[key] : undefined;
27563
+ }
27564
+
27565
+ var _hashGet = hashGet$1;
27566
+
27567
+ var nativeCreate$1 = _nativeCreate;
27568
+
27569
+ /** Used for built-in method references. */
27570
+ var objectProto$8 = Object.prototype;
27571
+
27572
+ /** Used to check objects for own properties. */
27573
+ var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
27574
+
27575
+ /**
27576
+ * Checks if a hash value for `key` exists.
27577
+ *
27578
+ * @private
27579
+ * @name has
27580
+ * @memberOf Hash
27581
+ * @param {string} key The key of the entry to check.
27582
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
27583
+ */
27584
+ function hashHas$1(key) {
27585
+ var data = this.__data__;
27586
+ return nativeCreate$1 ? (data[key] !== undefined) : hasOwnProperty$6.call(data, key);
27587
+ }
27588
+
27589
+ var _hashHas = hashHas$1;
27590
+
27591
+ var nativeCreate = _nativeCreate;
27592
+
27593
+ /** Used to stand-in for `undefined` hash values. */
27594
+ var HASH_UNDEFINED = '__lodash_hash_undefined__';
27595
+
27596
+ /**
27597
+ * Sets the hash `key` to `value`.
27598
+ *
27599
+ * @private
27600
+ * @name set
27601
+ * @memberOf Hash
27602
+ * @param {string} key The key of the value to set.
27603
+ * @param {*} value The value to set.
27604
+ * @returns {Object} Returns the hash instance.
27605
+ */
27606
+ function hashSet$1(key, value) {
27607
+ var data = this.__data__;
27608
+ this.size += this.has(key) ? 0 : 1;
27609
+ data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
27610
+ return this;
27611
+ }
27612
+
27613
+ var _hashSet = hashSet$1;
27614
+
27615
+ var hashClear = _hashClear,
27616
+ hashDelete = _hashDelete,
27617
+ hashGet = _hashGet,
27618
+ hashHas = _hashHas,
27619
+ hashSet = _hashSet;
27620
+
27621
+ /**
27622
+ * Creates a hash object.
27623
+ *
27624
+ * @private
27625
+ * @constructor
27626
+ * @param {Array} [entries] The key-value pairs to cache.
27627
+ */
27628
+ function Hash$1(entries) {
27629
+ var index = -1,
27630
+ length = entries == null ? 0 : entries.length;
27631
+
27632
+ this.clear();
27633
+ while (++index < length) {
27634
+ var entry = entries[index];
27635
+ this.set(entry[0], entry[1]);
27636
+ }
27637
+ }
27638
+
27639
+ // Add methods to `Hash`.
27640
+ Hash$1.prototype.clear = hashClear;
27641
+ Hash$1.prototype['delete'] = hashDelete;
27642
+ Hash$1.prototype.get = hashGet;
27643
+ Hash$1.prototype.has = hashHas;
27644
+ Hash$1.prototype.set = hashSet;
27645
+
27646
+ var _Hash = Hash$1;
27647
+
27648
+ var Hash = _Hash,
27649
+ ListCache$2 = _ListCache,
27650
+ Map$3 = _Map;
27651
+
27652
+ /**
27653
+ * Removes all key-value entries from the map.
27654
+ *
27655
+ * @private
27656
+ * @name clear
27657
+ * @memberOf MapCache
27658
+ */
27659
+ function mapCacheClear$1() {
27660
+ this.size = 0;
27661
+ this.__data__ = {
27662
+ 'hash': new Hash,
27663
+ 'map': new (Map$3 || ListCache$2),
27664
+ 'string': new Hash
27665
+ };
27666
+ }
27667
+
27668
+ var _mapCacheClear = mapCacheClear$1;
27669
+
27670
+ /**
27671
+ * Checks if `value` is suitable for use as unique object key.
27672
+ *
27673
+ * @private
27674
+ * @param {*} value The value to check.
27675
+ * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
27676
+ */
27677
+
27678
+ function isKeyable$1(value) {
27679
+ var type = typeof value;
27680
+ return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
27681
+ ? (value !== '__proto__')
27682
+ : (value === null);
27683
+ }
27684
+
27685
+ var _isKeyable = isKeyable$1;
27686
+
27687
+ var isKeyable = _isKeyable;
27688
+
27689
+ /**
27690
+ * Gets the data for `map`.
27691
+ *
27692
+ * @private
27693
+ * @param {Object} map The map to query.
27694
+ * @param {string} key The reference key.
27695
+ * @returns {*} Returns the map data.
27696
+ */
27697
+ function getMapData$4(map, key) {
27698
+ var data = map.__data__;
27699
+ return isKeyable(key)
27700
+ ? data[typeof key == 'string' ? 'string' : 'hash']
27701
+ : data.map;
27702
+ }
27703
+
27704
+ var _getMapData = getMapData$4;
27705
+
27706
+ var getMapData$3 = _getMapData;
27707
+
27708
+ /**
27709
+ * Removes `key` and its value from the map.
27710
+ *
27711
+ * @private
27712
+ * @name delete
27713
+ * @memberOf MapCache
27714
+ * @param {string} key The key of the value to remove.
27715
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
27716
+ */
27717
+ function mapCacheDelete$1(key) {
27718
+ var result = getMapData$3(this, key)['delete'](key);
27719
+ this.size -= result ? 1 : 0;
27720
+ return result;
27721
+ }
27722
+
27723
+ var _mapCacheDelete = mapCacheDelete$1;
27724
+
27725
+ var getMapData$2 = _getMapData;
27726
+
27727
+ /**
27728
+ * Gets the map value for `key`.
27729
+ *
27730
+ * @private
27731
+ * @name get
27732
+ * @memberOf MapCache
27733
+ * @param {string} key The key of the value to get.
27734
+ * @returns {*} Returns the entry value.
27735
+ */
27736
+ function mapCacheGet$1(key) {
27737
+ return getMapData$2(this, key).get(key);
27738
+ }
27739
+
27740
+ var _mapCacheGet = mapCacheGet$1;
27741
+
27742
+ var getMapData$1 = _getMapData;
27743
+
27744
+ /**
27745
+ * Checks if a map value for `key` exists.
27746
+ *
27747
+ * @private
27748
+ * @name has
27749
+ * @memberOf MapCache
27750
+ * @param {string} key The key of the entry to check.
27751
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
27752
+ */
27753
+ function mapCacheHas$1(key) {
27754
+ return getMapData$1(this, key).has(key);
27755
+ }
27756
+
27757
+ var _mapCacheHas = mapCacheHas$1;
27758
+
27759
+ var getMapData = _getMapData;
27760
+
27761
+ /**
27762
+ * Sets the map `key` to `value`.
27763
+ *
27764
+ * @private
27765
+ * @name set
27766
+ * @memberOf MapCache
27767
+ * @param {string} key The key of the value to set.
27768
+ * @param {*} value The value to set.
27769
+ * @returns {Object} Returns the map cache instance.
27770
+ */
27771
+ function mapCacheSet$1(key, value) {
27772
+ var data = getMapData(this, key),
27773
+ size = data.size;
27774
+
27775
+ data.set(key, value);
27776
+ this.size += data.size == size ? 0 : 1;
27777
+ return this;
27778
+ }
27779
+
27780
+ var _mapCacheSet = mapCacheSet$1;
27781
+
27782
+ var mapCacheClear = _mapCacheClear,
27783
+ mapCacheDelete = _mapCacheDelete,
27784
+ mapCacheGet = _mapCacheGet,
27785
+ mapCacheHas = _mapCacheHas,
27786
+ mapCacheSet = _mapCacheSet;
27787
+
27788
+ /**
27789
+ * Creates a map cache object to store key-value pairs.
27790
+ *
27791
+ * @private
27792
+ * @constructor
27793
+ * @param {Array} [entries] The key-value pairs to cache.
27794
+ */
27795
+ function MapCache$1(entries) {
27796
+ var index = -1,
27797
+ length = entries == null ? 0 : entries.length;
27798
+
27799
+ this.clear();
27800
+ while (++index < length) {
27801
+ var entry = entries[index];
27802
+ this.set(entry[0], entry[1]);
27803
+ }
27804
+ }
27805
+
27806
+ // Add methods to `MapCache`.
27807
+ MapCache$1.prototype.clear = mapCacheClear;
27808
+ MapCache$1.prototype['delete'] = mapCacheDelete;
27809
+ MapCache$1.prototype.get = mapCacheGet;
27810
+ MapCache$1.prototype.has = mapCacheHas;
27811
+ MapCache$1.prototype.set = mapCacheSet;
27812
+
27813
+ var _MapCache = MapCache$1;
27814
+
27815
+ var ListCache$1 = _ListCache,
27816
+ Map$2 = _Map,
27817
+ MapCache = _MapCache;
27818
+
27819
+ /** Used as the size to enable large array optimizations. */
27820
+ var LARGE_ARRAY_SIZE = 200;
27821
+
27822
+ /**
27823
+ * Sets the stack `key` to `value`.
27824
+ *
27825
+ * @private
27826
+ * @name set
27827
+ * @memberOf Stack
27828
+ * @param {string} key The key of the value to set.
27829
+ * @param {*} value The value to set.
27830
+ * @returns {Object} Returns the stack cache instance.
27831
+ */
27832
+ function stackSet$1(key, value) {
27833
+ var data = this.__data__;
27834
+ if (data instanceof ListCache$1) {
27835
+ var pairs = data.__data__;
27836
+ if (!Map$2 || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
27837
+ pairs.push([key, value]);
27838
+ this.size = ++data.size;
27839
+ return this;
27840
+ }
27841
+ data = this.__data__ = new MapCache(pairs);
27842
+ }
27843
+ data.set(key, value);
27844
+ this.size = data.size;
27845
+ return this;
27846
+ }
27847
+
27848
+ var _stackSet = stackSet$1;
27849
+
27850
+ var ListCache = _ListCache,
27851
+ stackClear = _stackClear,
27852
+ stackDelete = _stackDelete,
27853
+ stackGet = _stackGet,
27854
+ stackHas = _stackHas,
27855
+ stackSet = _stackSet;
27856
+
27857
+ /**
27858
+ * Creates a stack cache object to store key-value pairs.
27859
+ *
27860
+ * @private
27861
+ * @constructor
27862
+ * @param {Array} [entries] The key-value pairs to cache.
27863
+ */
27864
+ function Stack$1(entries) {
27865
+ var data = this.__data__ = new ListCache(entries);
27866
+ this.size = data.size;
27867
+ }
27868
+
27869
+ // Add methods to `Stack`.
27870
+ Stack$1.prototype.clear = stackClear;
27871
+ Stack$1.prototype['delete'] = stackDelete;
27872
+ Stack$1.prototype.get = stackGet;
27873
+ Stack$1.prototype.has = stackHas;
27874
+ Stack$1.prototype.set = stackSet;
27875
+
27876
+ var _Stack = Stack$1;
27877
+
27878
+ /**
27879
+ * A specialized version of `_.forEach` for arrays without support for
27880
+ * iteratee shorthands.
27881
+ *
27882
+ * @private
27883
+ * @param {Array} [array] The array to iterate over.
27884
+ * @param {Function} iteratee The function invoked per iteration.
27885
+ * @returns {Array} Returns `array`.
27886
+ */
27887
+
27888
+ function arrayEach$1(array, iteratee) {
27889
+ var index = -1,
27890
+ length = array == null ? 0 : array.length;
27891
+
27892
+ while (++index < length) {
27893
+ if (iteratee(array[index], index, array) === false) {
27894
+ break;
27895
+ }
27896
+ }
27897
+ return array;
27898
+ }
27899
+
27900
+ var _arrayEach = arrayEach$1;
27901
+
27902
+ var getNative$4 = _getNative;
27903
+
27904
+ var defineProperty$1 = (function() {
27905
+ try {
27906
+ var func = getNative$4(Object, 'defineProperty');
27907
+ func({}, '', {});
27908
+ return func;
27909
+ } catch (e) {}
27910
+ }());
27911
+
27912
+ var _defineProperty = defineProperty$1;
27913
+
27914
+ var defineProperty = _defineProperty;
27915
+
27916
+ /**
27917
+ * The base implementation of `assignValue` and `assignMergeValue` without
27918
+ * value checks.
27919
+ *
27920
+ * @private
27921
+ * @param {Object} object The object to modify.
27922
+ * @param {string} key The key of the property to assign.
27923
+ * @param {*} value The value to assign.
27924
+ */
27925
+ function baseAssignValue$2(object, key, value) {
27926
+ if (key == '__proto__' && defineProperty) {
27927
+ defineProperty(object, key, {
27928
+ 'configurable': true,
27929
+ 'enumerable': true,
27930
+ 'value': value,
27931
+ 'writable': true
27932
+ });
27933
+ } else {
27934
+ object[key] = value;
27935
+ }
27936
+ }
27937
+
27938
+ var _baseAssignValue = baseAssignValue$2;
27939
+
27940
+ var baseAssignValue$1 = _baseAssignValue,
27941
+ eq = eq_1;
27942
+
27943
+ /** Used for built-in method references. */
27944
+ var objectProto$7 = Object.prototype;
27945
+
27946
+ /** Used to check objects for own properties. */
27947
+ var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
27948
+
27949
+ /**
27950
+ * Assigns `value` to `key` of `object` if the existing value is not equivalent
27951
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
27952
+ * for equality comparisons.
27953
+ *
27954
+ * @private
27955
+ * @param {Object} object The object to modify.
27956
+ * @param {string} key The key of the property to assign.
27957
+ * @param {*} value The value to assign.
27958
+ */
27959
+ function assignValue$2(object, key, value) {
27960
+ var objValue = object[key];
27961
+ if (!(hasOwnProperty$5.call(object, key) && eq(objValue, value)) ||
27962
+ (value === undefined && !(key in object))) {
27963
+ baseAssignValue$1(object, key, value);
27964
+ }
27965
+ }
27966
+
27967
+ var _assignValue = assignValue$2;
27968
+
27969
+ var assignValue$1 = _assignValue,
27970
+ baseAssignValue = _baseAssignValue;
27971
+
27972
+ /**
27973
+ * Copies properties of `source` to `object`.
27974
+ *
27975
+ * @private
27976
+ * @param {Object} source The object to copy properties from.
27977
+ * @param {Array} props The property identifiers to copy.
27978
+ * @param {Object} [object={}] The object to copy properties to.
27979
+ * @param {Function} [customizer] The function to customize copied values.
27980
+ * @returns {Object} Returns `object`.
27981
+ */
27982
+ function copyObject$4(source, props, object, customizer) {
27983
+ var isNew = !object;
27984
+ object || (object = {});
27985
+
27986
+ var index = -1,
27987
+ length = props.length;
27988
+
27989
+ while (++index < length) {
27990
+ var key = props[index];
27991
+
27992
+ var newValue = customizer
27993
+ ? customizer(object[key], source[key], key, object, source)
27994
+ : undefined;
27995
+
27996
+ if (newValue === undefined) {
27997
+ newValue = source[key];
27998
+ }
27999
+ if (isNew) {
28000
+ baseAssignValue(object, key, newValue);
28001
+ } else {
28002
+ assignValue$1(object, key, newValue);
28003
+ }
28004
+ }
28005
+ return object;
28006
+ }
28007
+
28008
+ var _copyObject = copyObject$4;
28009
+
28010
+ /**
28011
+ * The base implementation of `_.times` without support for iteratee shorthands
28012
+ * or max array length checks.
28013
+ *
28014
+ * @private
28015
+ * @param {number} n The number of times to invoke `iteratee`.
28016
+ * @param {Function} iteratee The function invoked per iteration.
28017
+ * @returns {Array} Returns the array of results.
28018
+ */
28019
+
28020
+ function baseTimes$1(n, iteratee) {
28021
+ var index = -1,
28022
+ result = Array(n);
28023
+
28024
+ while (++index < n) {
28025
+ result[index] = iteratee(index);
28026
+ }
28027
+ return result;
28028
+ }
28029
+
28030
+ var _baseTimes = baseTimes$1;
28031
+
28032
+ var baseGetTag$2 = _baseGetTag,
28033
+ isObjectLike$4 = isObjectLike_1;
28034
+
28035
+ /** `Object#toString` result references. */
28036
+ var argsTag$2 = '[object Arguments]';
28037
+
28038
+ /**
28039
+ * The base implementation of `_.isArguments`.
28040
+ *
28041
+ * @private
28042
+ * @param {*} value The value to check.
28043
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
28044
+ */
28045
+ function baseIsArguments$1(value) {
28046
+ return isObjectLike$4(value) && baseGetTag$2(value) == argsTag$2;
28047
+ }
28048
+
28049
+ var _baseIsArguments = baseIsArguments$1;
28050
+
28051
+ var baseIsArguments = _baseIsArguments,
28052
+ isObjectLike$3 = isObjectLike_1;
28053
+
28054
+ /** Used for built-in method references. */
28055
+ var objectProto$6 = Object.prototype;
28056
+
28057
+ /** Used to check objects for own properties. */
28058
+ var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
28059
+
28060
+ /** Built-in value references. */
28061
+ var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
28062
+
28063
+ /**
28064
+ * Checks if `value` is likely an `arguments` object.
28065
+ *
28066
+ * @static
28067
+ * @memberOf _
28068
+ * @since 0.1.0
28069
+ * @category Lang
28070
+ * @param {*} value The value to check.
28071
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
28072
+ * else `false`.
28073
+ * @example
28074
+ *
28075
+ * _.isArguments(function() { return arguments; }());
28076
+ * // => true
28077
+ *
28078
+ * _.isArguments([1, 2, 3]);
28079
+ * // => false
28080
+ */
28081
+ var isArguments$1 = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
28082
+ return isObjectLike$3(value) && hasOwnProperty$4.call(value, 'callee') &&
28083
+ !propertyIsEnumerable$1.call(value, 'callee');
28084
+ };
28085
+
28086
+ var isArguments_1 = isArguments$1;
28087
+
28088
+ /**
28089
+ * Checks if `value` is classified as an `Array` object.
28090
+ *
28091
+ * @static
28092
+ * @memberOf _
28093
+ * @since 0.1.0
28094
+ * @category Lang
28095
+ * @param {*} value The value to check.
28096
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
28097
+ * @example
28098
+ *
28099
+ * _.isArray([1, 2, 3]);
28100
+ * // => true
28101
+ *
28102
+ * _.isArray(document.body.children);
28103
+ * // => false
28104
+ *
28105
+ * _.isArray('abc');
28106
+ * // => false
28107
+ *
28108
+ * _.isArray(_.noop);
28109
+ * // => false
28110
+ */
28111
+
28112
+ var isArray$3 = Array.isArray;
28113
+
28114
+ var isArray_1 = isArray$3;
28115
+
28116
+ var isBuffer$2 = {exports: {}};
28117
+
28118
+ /**
28119
+ * This method returns `false`.
28120
+ *
28121
+ * @static
28122
+ * @memberOf _
28123
+ * @since 4.13.0
28124
+ * @category Util
28125
+ * @returns {boolean} Returns `false`.
28126
+ * @example
28127
+ *
28128
+ * _.times(2, _.stubFalse);
28129
+ * // => [false, false]
28130
+ */
28131
+
28132
+ function stubFalse() {
28133
+ return false;
28134
+ }
28135
+
28136
+ var stubFalse_1 = stubFalse;
28137
+
28138
+ isBuffer$2.exports;
28139
+
28140
+ (function (module, exports) {
28141
+ var root = _root,
28142
+ stubFalse = stubFalse_1;
28143
+
28144
+ /** Detect free variable `exports`. */
28145
+ var freeExports = exports && !exports.nodeType && exports;
28146
+
28147
+ /** Detect free variable `module`. */
28148
+ var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
28149
+
28150
+ /** Detect the popular CommonJS extension `module.exports`. */
28151
+ var moduleExports = freeModule && freeModule.exports === freeExports;
28152
+
28153
+ /** Built-in value references. */
28154
+ var Buffer = moduleExports ? root.Buffer : undefined;
28155
+
28156
+ /* Built-in method references for those with the same name as other `lodash` methods. */
28157
+ var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
28158
+
28159
+ /**
28160
+ * Checks if `value` is a buffer.
28161
+ *
28162
+ * @static
28163
+ * @memberOf _
28164
+ * @since 4.3.0
28165
+ * @category Lang
28166
+ * @param {*} value The value to check.
28167
+ * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
28168
+ * @example
28169
+ *
28170
+ * _.isBuffer(new Buffer(2));
28171
+ * // => true
28172
+ *
28173
+ * _.isBuffer(new Uint8Array(2));
28174
+ * // => false
28175
+ */
28176
+ var isBuffer = nativeIsBuffer || stubFalse;
28177
+
28178
+ module.exports = isBuffer;
28179
+ } (isBuffer$2, isBuffer$2.exports));
28180
+
28181
+ var isBufferExports = isBuffer$2.exports;
28182
+
28183
+ /** Used as references for various `Number` constants. */
28184
+
28185
+ var MAX_SAFE_INTEGER$1 = 9007199254740991;
28186
+
28187
+ /** Used to detect unsigned integer values. */
28188
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
28189
+
28190
+ /**
28191
+ * Checks if `value` is a valid array-like index.
28192
+ *
28193
+ * @private
28194
+ * @param {*} value The value to check.
28195
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
28196
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
28197
+ */
28198
+ function isIndex$1(value, length) {
28199
+ var type = typeof value;
28200
+ length = length == null ? MAX_SAFE_INTEGER$1 : length;
28201
+
28202
+ return !!length &&
28203
+ (type == 'number' ||
28204
+ (type != 'symbol' && reIsUint.test(value))) &&
28205
+ (value > -1 && value % 1 == 0 && value < length);
28206
+ }
28207
+
28208
+ var _isIndex = isIndex$1;
28209
+
28210
+ /** Used as references for various `Number` constants. */
28211
+
28212
+ var MAX_SAFE_INTEGER = 9007199254740991;
28213
+
28214
+ /**
28215
+ * Checks if `value` is a valid array-like length.
28216
+ *
28217
+ * **Note:** This method is loosely based on
28218
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
28219
+ *
28220
+ * @static
28221
+ * @memberOf _
28222
+ * @since 4.0.0
28223
+ * @category Lang
28224
+ * @param {*} value The value to check.
28225
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
28226
+ * @example
28227
+ *
28228
+ * _.isLength(3);
28229
+ * // => true
28230
+ *
28231
+ * _.isLength(Number.MIN_VALUE);
28232
+ * // => false
28233
+ *
28234
+ * _.isLength(Infinity);
28235
+ * // => false
28236
+ *
28237
+ * _.isLength('3');
28238
+ * // => false
28239
+ */
28240
+ function isLength$2(value) {
28241
+ return typeof value == 'number' &&
28242
+ value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
28243
+ }
28244
+
28245
+ var isLength_1 = isLength$2;
28246
+
28247
+ var baseGetTag$1 = _baseGetTag,
28248
+ isLength$1 = isLength_1,
28249
+ isObjectLike$2 = isObjectLike_1;
28250
+
28251
+ /** `Object#toString` result references. */
28252
+ var argsTag$1 = '[object Arguments]',
28253
+ arrayTag$1 = '[object Array]',
28254
+ boolTag$2 = '[object Boolean]',
28255
+ dateTag$2 = '[object Date]',
28256
+ errorTag$1 = '[object Error]',
28257
+ funcTag$1 = '[object Function]',
28258
+ mapTag$4 = '[object Map]',
28259
+ numberTag$2 = '[object Number]',
28260
+ objectTag$2 = '[object Object]',
28261
+ regexpTag$2 = '[object RegExp]',
28262
+ setTag$4 = '[object Set]',
28263
+ stringTag$2 = '[object String]',
28264
+ weakMapTag$2 = '[object WeakMap]';
28265
+
28266
+ var arrayBufferTag$2 = '[object ArrayBuffer]',
28267
+ dataViewTag$3 = '[object DataView]',
28268
+ float32Tag$2 = '[object Float32Array]',
28269
+ float64Tag$2 = '[object Float64Array]',
28270
+ int8Tag$2 = '[object Int8Array]',
28271
+ int16Tag$2 = '[object Int16Array]',
28272
+ int32Tag$2 = '[object Int32Array]',
28273
+ uint8Tag$2 = '[object Uint8Array]',
28274
+ uint8ClampedTag$2 = '[object Uint8ClampedArray]',
28275
+ uint16Tag$2 = '[object Uint16Array]',
28276
+ uint32Tag$2 = '[object Uint32Array]';
28277
+
28278
+ /** Used to identify `toStringTag` values of typed arrays. */
28279
+ var typedArrayTags = {};
28280
+ typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] =
28281
+ typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] =
28282
+ typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] =
28283
+ typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] =
28284
+ typedArrayTags[uint32Tag$2] = true;
28285
+ typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
28286
+ typedArrayTags[arrayBufferTag$2] = typedArrayTags[boolTag$2] =
28287
+ typedArrayTags[dataViewTag$3] = typedArrayTags[dateTag$2] =
28288
+ typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] =
28289
+ typedArrayTags[mapTag$4] = typedArrayTags[numberTag$2] =
28290
+ typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$2] =
28291
+ typedArrayTags[setTag$4] = typedArrayTags[stringTag$2] =
28292
+ typedArrayTags[weakMapTag$2] = false;
28293
+
28294
+ /**
28295
+ * The base implementation of `_.isTypedArray` without Node.js optimizations.
28296
+ *
28297
+ * @private
28298
+ * @param {*} value The value to check.
28299
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
28300
+ */
28301
+ function baseIsTypedArray$1(value) {
28302
+ return isObjectLike$2(value) &&
28303
+ isLength$1(value.length) && !!typedArrayTags[baseGetTag$1(value)];
28304
+ }
28305
+
28306
+ var _baseIsTypedArray = baseIsTypedArray$1;
28307
+
28308
+ /**
28309
+ * The base implementation of `_.unary` without support for storing metadata.
28310
+ *
28311
+ * @private
28312
+ * @param {Function} func The function to cap arguments for.
28313
+ * @returns {Function} Returns the new capped function.
28314
+ */
28315
+
28316
+ function baseUnary$3(func) {
28317
+ return function(value) {
28318
+ return func(value);
28319
+ };
28320
+ }
28321
+
28322
+ var _baseUnary = baseUnary$3;
28323
+
28324
+ var _nodeUtil = {exports: {}};
28325
+
28326
+ _nodeUtil.exports;
28327
+
28328
+ (function (module, exports) {
28329
+ var freeGlobal = _freeGlobal;
28330
+
28331
+ /** Detect free variable `exports`. */
28332
+ var freeExports = exports && !exports.nodeType && exports;
28333
+
28334
+ /** Detect free variable `module`. */
28335
+ var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
28336
+
28337
+ /** Detect the popular CommonJS extension `module.exports`. */
28338
+ var moduleExports = freeModule && freeModule.exports === freeExports;
28339
+
28340
+ /** Detect free variable `process` from Node.js. */
28341
+ var freeProcess = moduleExports && freeGlobal.process;
28342
+
28343
+ /** Used to access faster Node.js helpers. */
28344
+ var nodeUtil = (function() {
28345
+ try {
28346
+ // Use `util.types` for Node.js 10+.
28347
+ var types = freeModule && freeModule.require && freeModule.require('util').types;
28348
+
28349
+ if (types) {
28350
+ return types;
28351
+ }
28352
+
28353
+ // Legacy `process.binding('util')` for Node.js < 10.
28354
+ return freeProcess && freeProcess.binding && freeProcess.binding('util');
28355
+ } catch (e) {}
28356
+ }());
28357
+
28358
+ module.exports = nodeUtil;
28359
+ } (_nodeUtil, _nodeUtil.exports));
28360
+
28361
+ var _nodeUtilExports = _nodeUtil.exports;
28362
+
28363
+ var baseIsTypedArray = _baseIsTypedArray,
28364
+ baseUnary$2 = _baseUnary,
28365
+ nodeUtil$2 = _nodeUtilExports;
28366
+
28367
+ /* Node.js helper references. */
28368
+ var nodeIsTypedArray = nodeUtil$2 && nodeUtil$2.isTypedArray;
28369
+
28370
+ /**
28371
+ * Checks if `value` is classified as a typed array.
28372
+ *
28373
+ * @static
28374
+ * @memberOf _
28375
+ * @since 3.0.0
28376
+ * @category Lang
28377
+ * @param {*} value The value to check.
28378
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
28379
+ * @example
28380
+ *
28381
+ * _.isTypedArray(new Uint8Array);
28382
+ * // => true
28383
+ *
28384
+ * _.isTypedArray([]);
28385
+ * // => false
28386
+ */
28387
+ var isTypedArray$1 = nodeIsTypedArray ? baseUnary$2(nodeIsTypedArray) : baseIsTypedArray;
28388
+
28389
+ var isTypedArray_1 = isTypedArray$1;
28390
+
28391
+ var baseTimes = _baseTimes,
28392
+ isArguments = isArguments_1,
28393
+ isArray$2 = isArray_1,
28394
+ isBuffer$1 = isBufferExports,
28395
+ isIndex = _isIndex,
28396
+ isTypedArray = isTypedArray_1;
28397
+
28398
+ /** Used for built-in method references. */
28399
+ var objectProto$5 = Object.prototype;
28400
+
28401
+ /** Used to check objects for own properties. */
28402
+ var hasOwnProperty$3 = objectProto$5.hasOwnProperty;
28403
+
28404
+ /**
28405
+ * Creates an array of the enumerable property names of the array-like `value`.
28406
+ *
28407
+ * @private
28408
+ * @param {*} value The value to query.
28409
+ * @param {boolean} inherited Specify returning inherited property names.
28410
+ * @returns {Array} Returns the array of property names.
28411
+ */
28412
+ function arrayLikeKeys$2(value, inherited) {
28413
+ var isArr = isArray$2(value),
28414
+ isArg = !isArr && isArguments(value),
28415
+ isBuff = !isArr && !isArg && isBuffer$1(value),
28416
+ isType = !isArr && !isArg && !isBuff && isTypedArray(value),
28417
+ skipIndexes = isArr || isArg || isBuff || isType,
28418
+ result = skipIndexes ? baseTimes(value.length, String) : [],
28419
+ length = result.length;
28420
+
28421
+ for (var key in value) {
28422
+ if ((inherited || hasOwnProperty$3.call(value, key)) &&
28423
+ !(skipIndexes && (
28424
+ // Safari 9 has enumerable `arguments.length` in strict mode.
28425
+ key == 'length' ||
28426
+ // Node.js 0.10 has enumerable non-index properties on buffers.
28427
+ (isBuff && (key == 'offset' || key == 'parent')) ||
28428
+ // PhantomJS 2 has enumerable non-index properties on typed arrays.
28429
+ (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
28430
+ // Skip index properties.
28431
+ isIndex(key, length)
28432
+ ))) {
28433
+ result.push(key);
28434
+ }
28435
+ }
28436
+ return result;
28437
+ }
28438
+
28439
+ var _arrayLikeKeys = arrayLikeKeys$2;
28440
+
28441
+ /** Used for built-in method references. */
28442
+
28443
+ var objectProto$4 = Object.prototype;
28444
+
28445
+ /**
28446
+ * Checks if `value` is likely a prototype object.
28447
+ *
28448
+ * @private
28449
+ * @param {*} value The value to check.
28450
+ * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
28451
+ */
28452
+ function isPrototype$3(value) {
28453
+ var Ctor = value && value.constructor,
28454
+ proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$4;
28455
+
28456
+ return value === proto;
28457
+ }
28458
+
28459
+ var _isPrototype = isPrototype$3;
28460
+
28461
+ /**
28462
+ * Creates a unary function that invokes `func` with its argument transformed.
28463
+ *
28464
+ * @private
28465
+ * @param {Function} func The function to wrap.
28466
+ * @param {Function} transform The argument transform.
28467
+ * @returns {Function} Returns the new function.
28468
+ */
28469
+
28470
+ function overArg$2(func, transform) {
28471
+ return function(arg) {
28472
+ return func(transform(arg));
28473
+ };
28474
+ }
28475
+
28476
+ var _overArg = overArg$2;
28477
+
28478
+ var overArg$1 = _overArg;
28479
+
28480
+ /* Built-in method references for those with the same name as other `lodash` methods. */
28481
+ var nativeKeys$1 = overArg$1(Object.keys, Object);
28482
+
28483
+ var _nativeKeys = nativeKeys$1;
28484
+
28485
+ var isPrototype$2 = _isPrototype,
28486
+ nativeKeys = _nativeKeys;
28487
+
28488
+ /** Used for built-in method references. */
28489
+ var objectProto$3 = Object.prototype;
28490
+
28491
+ /** Used to check objects for own properties. */
28492
+ var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
28493
+
28494
+ /**
28495
+ * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
28496
+ *
28497
+ * @private
28498
+ * @param {Object} object The object to query.
28499
+ * @returns {Array} Returns the array of property names.
28500
+ */
28501
+ function baseKeys$1(object) {
28502
+ if (!isPrototype$2(object)) {
28503
+ return nativeKeys(object);
28504
+ }
28505
+ var result = [];
28506
+ for (var key in Object(object)) {
28507
+ if (hasOwnProperty$2.call(object, key) && key != 'constructor') {
28508
+ result.push(key);
28509
+ }
28510
+ }
28511
+ return result;
28512
+ }
28513
+
28514
+ var _baseKeys = baseKeys$1;
28515
+
28516
+ var isFunction$1 = isFunction_1,
28517
+ isLength = isLength_1;
28518
+
28519
+ /**
28520
+ * Checks if `value` is array-like. A value is considered array-like if it's
28521
+ * not a function and has a `value.length` that's an integer greater than or
28522
+ * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
28523
+ *
28524
+ * @static
28525
+ * @memberOf _
28526
+ * @since 4.0.0
28527
+ * @category Lang
28528
+ * @param {*} value The value to check.
28529
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
28530
+ * @example
28531
+ *
28532
+ * _.isArrayLike([1, 2, 3]);
28533
+ * // => true
28534
+ *
28535
+ * _.isArrayLike(document.body.children);
28536
+ * // => true
28537
+ *
28538
+ * _.isArrayLike('abc');
28539
+ * // => true
28540
+ *
28541
+ * _.isArrayLike(_.noop);
28542
+ * // => false
28543
+ */
28544
+ function isArrayLike$2(value) {
28545
+ return value != null && isLength(value.length) && !isFunction$1(value);
28546
+ }
28547
+
28548
+ var isArrayLike_1 = isArrayLike$2;
28549
+
28550
+ var arrayLikeKeys$1 = _arrayLikeKeys,
28551
+ baseKeys = _baseKeys,
28552
+ isArrayLike$1 = isArrayLike_1;
28553
+
28554
+ /**
28555
+ * Creates an array of the own enumerable property names of `object`.
28556
+ *
28557
+ * **Note:** Non-object values are coerced to objects. See the
28558
+ * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
28559
+ * for more details.
28560
+ *
28561
+ * @static
28562
+ * @since 0.1.0
28563
+ * @memberOf _
28564
+ * @category Object
28565
+ * @param {Object} object The object to query.
28566
+ * @returns {Array} Returns the array of property names.
28567
+ * @example
28568
+ *
28569
+ * function Foo() {
28570
+ * this.a = 1;
28571
+ * this.b = 2;
28572
+ * }
28573
+ *
28574
+ * Foo.prototype.c = 3;
28575
+ *
28576
+ * _.keys(new Foo);
28577
+ * // => ['a', 'b'] (iteration order is not guaranteed)
28578
+ *
28579
+ * _.keys('hi');
28580
+ * // => ['0', '1']
28581
+ */
28582
+ function keys$3(object) {
28583
+ return isArrayLike$1(object) ? arrayLikeKeys$1(object) : baseKeys(object);
28584
+ }
28585
+
28586
+ var keys_1 = keys$3;
28587
+
28588
+ var copyObject$3 = _copyObject,
28589
+ keys$2 = keys_1;
28590
+
28591
+ /**
28592
+ * The base implementation of `_.assign` without support for multiple sources
28593
+ * or `customizer` functions.
28594
+ *
28595
+ * @private
28596
+ * @param {Object} object The destination object.
28597
+ * @param {Object} source The source object.
28598
+ * @returns {Object} Returns `object`.
28599
+ */
28600
+ function baseAssign$1(object, source) {
28601
+ return object && copyObject$3(source, keys$2(source), object);
28602
+ }
28603
+
28604
+ var _baseAssign = baseAssign$1;
28605
+
28606
+ /**
28607
+ * This function is like
28608
+ * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
28609
+ * except that it includes inherited enumerable properties.
28610
+ *
28611
+ * @private
28612
+ * @param {Object} object The object to query.
28613
+ * @returns {Array} Returns the array of property names.
28614
+ */
28615
+
28616
+ function nativeKeysIn$1(object) {
28617
+ var result = [];
28618
+ if (object != null) {
28619
+ for (var key in Object(object)) {
28620
+ result.push(key);
28621
+ }
28622
+ }
28623
+ return result;
28624
+ }
28625
+
28626
+ var _nativeKeysIn = nativeKeysIn$1;
28627
+
28628
+ var isObject$2 = isObject_1,
28629
+ isPrototype$1 = _isPrototype,
28630
+ nativeKeysIn = _nativeKeysIn;
28631
+
28632
+ /** Used for built-in method references. */
28633
+ var objectProto$2 = Object.prototype;
28634
+
28635
+ /** Used to check objects for own properties. */
28636
+ var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
28637
+
28638
+ /**
28639
+ * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
28640
+ *
28641
+ * @private
28642
+ * @param {Object} object The object to query.
28643
+ * @returns {Array} Returns the array of property names.
28644
+ */
28645
+ function baseKeysIn$1(object) {
28646
+ if (!isObject$2(object)) {
28647
+ return nativeKeysIn(object);
28648
+ }
28649
+ var isProto = isPrototype$1(object),
28650
+ result = [];
28651
+
28652
+ for (var key in object) {
28653
+ if (!(key == 'constructor' && (isProto || !hasOwnProperty$1.call(object, key)))) {
28654
+ result.push(key);
28655
+ }
28656
+ }
28657
+ return result;
28658
+ }
28659
+
28660
+ var _baseKeysIn = baseKeysIn$1;
28661
+
28662
+ var arrayLikeKeys = _arrayLikeKeys,
28663
+ baseKeysIn = _baseKeysIn,
28664
+ isArrayLike = isArrayLike_1;
28665
+
28666
+ /**
28667
+ * Creates an array of the own and inherited enumerable property names of `object`.
28668
+ *
28669
+ * **Note:** Non-object values are coerced to objects.
28670
+ *
28671
+ * @static
28672
+ * @memberOf _
28673
+ * @since 3.0.0
28674
+ * @category Object
28675
+ * @param {Object} object The object to query.
28676
+ * @returns {Array} Returns the array of property names.
28677
+ * @example
28678
+ *
28679
+ * function Foo() {
28680
+ * this.a = 1;
28681
+ * this.b = 2;
28682
+ * }
28683
+ *
28684
+ * Foo.prototype.c = 3;
28685
+ *
28686
+ * _.keysIn(new Foo);
28687
+ * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
28688
+ */
28689
+ function keysIn$3(object) {
28690
+ return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
28691
+ }
28692
+
28693
+ var keysIn_1 = keysIn$3;
28694
+
28695
+ var copyObject$2 = _copyObject,
28696
+ keysIn$2 = keysIn_1;
28697
+
28698
+ /**
28699
+ * The base implementation of `_.assignIn` without support for multiple sources
28700
+ * or `customizer` functions.
28701
+ *
28702
+ * @private
28703
+ * @param {Object} object The destination object.
28704
+ * @param {Object} source The source object.
28705
+ * @returns {Object} Returns `object`.
28706
+ */
28707
+ function baseAssignIn$1(object, source) {
28708
+ return object && copyObject$2(source, keysIn$2(source), object);
28709
+ }
28710
+
28711
+ var _baseAssignIn = baseAssignIn$1;
28712
+
28713
+ var _cloneBuffer = {exports: {}};
28714
+
28715
+ _cloneBuffer.exports;
28716
+
28717
+ (function (module, exports) {
28718
+ var root = _root;
28719
+
28720
+ /** Detect free variable `exports`. */
28721
+ var freeExports = exports && !exports.nodeType && exports;
28722
+
28723
+ /** Detect free variable `module`. */
28724
+ var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
28725
+
28726
+ /** Detect the popular CommonJS extension `module.exports`. */
28727
+ var moduleExports = freeModule && freeModule.exports === freeExports;
28728
+
28729
+ /** Built-in value references. */
28730
+ var Buffer = moduleExports ? root.Buffer : undefined,
28731
+ allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
28732
+
28733
+ /**
28734
+ * Creates a clone of `buffer`.
28735
+ *
28736
+ * @private
28737
+ * @param {Buffer} buffer The buffer to clone.
28738
+ * @param {boolean} [isDeep] Specify a deep clone.
28739
+ * @returns {Buffer} Returns the cloned buffer.
28740
+ */
28741
+ function cloneBuffer(buffer, isDeep) {
28742
+ if (isDeep) {
28743
+ return buffer.slice();
28744
+ }
28745
+ var length = buffer.length,
28746
+ result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
28747
+
28748
+ buffer.copy(result);
28749
+ return result;
28750
+ }
28751
+
28752
+ module.exports = cloneBuffer;
28753
+ } (_cloneBuffer, _cloneBuffer.exports));
28754
+
28755
+ var _cloneBufferExports = _cloneBuffer.exports;
28756
+
28757
+ /**
28758
+ * Copies the values of `source` to `array`.
28759
+ *
28760
+ * @private
28761
+ * @param {Array} source The array to copy values from.
28762
+ * @param {Array} [array=[]] The array to copy values to.
28763
+ * @returns {Array} Returns `array`.
28764
+ */
28765
+
28766
+ function copyArray$1(source, array) {
28767
+ var index = -1,
28768
+ length = source.length;
28769
+
28770
+ array || (array = Array(length));
28771
+ while (++index < length) {
28772
+ array[index] = source[index];
28773
+ }
28774
+ return array;
28775
+ }
28776
+
28777
+ var _copyArray = copyArray$1;
28778
+
28779
+ /**
28780
+ * A specialized version of `_.filter` for arrays without support for
28781
+ * iteratee shorthands.
28782
+ *
28783
+ * @private
28784
+ * @param {Array} [array] The array to iterate over.
28785
+ * @param {Function} predicate The function invoked per iteration.
28786
+ * @returns {Array} Returns the new filtered array.
28787
+ */
28788
+
28789
+ function arrayFilter$1(array, predicate) {
28790
+ var index = -1,
28791
+ length = array == null ? 0 : array.length,
28792
+ resIndex = 0,
28793
+ result = [];
28794
+
28795
+ while (++index < length) {
28796
+ var value = array[index];
28797
+ if (predicate(value, index, array)) {
28798
+ result[resIndex++] = value;
28799
+ }
28800
+ }
28801
+ return result;
28802
+ }
28803
+
28804
+ var _arrayFilter = arrayFilter$1;
28805
+
28806
+ /**
28807
+ * This method returns a new empty array.
28808
+ *
28809
+ * @static
28810
+ * @memberOf _
28811
+ * @since 4.13.0
28812
+ * @category Util
28813
+ * @returns {Array} Returns the new empty array.
28814
+ * @example
28815
+ *
28816
+ * var arrays = _.times(2, _.stubArray);
28817
+ *
28818
+ * console.log(arrays);
28819
+ * // => [[], []]
28820
+ *
28821
+ * console.log(arrays[0] === arrays[1]);
28822
+ * // => false
28823
+ */
28824
+
28825
+ function stubArray$2() {
28826
+ return [];
28827
+ }
28828
+
28829
+ var stubArray_1 = stubArray$2;
28830
+
28831
+ var arrayFilter = _arrayFilter,
28832
+ stubArray$1 = stubArray_1;
28833
+
28834
+ /** Used for built-in method references. */
28835
+ var objectProto$1 = Object.prototype;
28836
+
28837
+ /** Built-in value references. */
28838
+ var propertyIsEnumerable = objectProto$1.propertyIsEnumerable;
28839
+
28840
+ /* Built-in method references for those with the same name as other `lodash` methods. */
28841
+ var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
28842
+
28843
+ /**
28844
+ * Creates an array of the own enumerable symbols of `object`.
28845
+ *
28846
+ * @private
28847
+ * @param {Object} object The object to query.
28848
+ * @returns {Array} Returns the array of symbols.
28849
+ */
28850
+ var getSymbols$3 = !nativeGetSymbols$1 ? stubArray$1 : function(object) {
28851
+ if (object == null) {
28852
+ return [];
28853
+ }
28854
+ object = Object(object);
28855
+ return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
28856
+ return propertyIsEnumerable.call(object, symbol);
28857
+ });
28858
+ };
28859
+
28860
+ var _getSymbols = getSymbols$3;
28861
+
28862
+ var copyObject$1 = _copyObject,
28863
+ getSymbols$2 = _getSymbols;
28864
+
28865
+ /**
28866
+ * Copies own symbols of `source` to `object`.
28867
+ *
28868
+ * @private
28869
+ * @param {Object} source The object to copy symbols from.
28870
+ * @param {Object} [object={}] The object to copy symbols to.
28871
+ * @returns {Object} Returns `object`.
28872
+ */
28873
+ function copySymbols$1(source, object) {
28874
+ return copyObject$1(source, getSymbols$2(source), object);
28875
+ }
28876
+
28877
+ var _copySymbols = copySymbols$1;
28878
+
28879
+ /**
28880
+ * Appends the elements of `values` to `array`.
28881
+ *
28882
+ * @private
28883
+ * @param {Array} array The array to modify.
28884
+ * @param {Array} values The values to append.
28885
+ * @returns {Array} Returns `array`.
28886
+ */
28887
+
28888
+ function arrayPush$2(array, values) {
28889
+ var index = -1,
28890
+ length = values.length,
28891
+ offset = array.length;
28892
+
28893
+ while (++index < length) {
28894
+ array[offset + index] = values[index];
28895
+ }
28896
+ return array;
28897
+ }
28898
+
28899
+ var _arrayPush = arrayPush$2;
28900
+
28901
+ var overArg = _overArg;
28902
+
28903
+ /** Built-in value references. */
28904
+ var getPrototype$2 = overArg(Object.getPrototypeOf, Object);
28905
+
28906
+ var _getPrototype = getPrototype$2;
28907
+
28908
+ var arrayPush$1 = _arrayPush,
28909
+ getPrototype$1 = _getPrototype,
28910
+ getSymbols$1 = _getSymbols,
28911
+ stubArray = stubArray_1;
28912
+
28913
+ /* Built-in method references for those with the same name as other `lodash` methods. */
28914
+ var nativeGetSymbols = Object.getOwnPropertySymbols;
28915
+
28916
+ /**
28917
+ * Creates an array of the own and inherited enumerable symbols of `object`.
28918
+ *
28919
+ * @private
28920
+ * @param {Object} object The object to query.
28921
+ * @returns {Array} Returns the array of symbols.
28922
+ */
28923
+ var getSymbolsIn$2 = !nativeGetSymbols ? stubArray : function(object) {
28924
+ var result = [];
28925
+ while (object) {
28926
+ arrayPush$1(result, getSymbols$1(object));
28927
+ object = getPrototype$1(object);
28928
+ }
28929
+ return result;
28930
+ };
28931
+
28932
+ var _getSymbolsIn = getSymbolsIn$2;
28933
+
28934
+ var copyObject = _copyObject,
28935
+ getSymbolsIn$1 = _getSymbolsIn;
28936
+
28937
+ /**
28938
+ * Copies own and inherited symbols of `source` to `object`.
28939
+ *
28940
+ * @private
28941
+ * @param {Object} source The object to copy symbols from.
28942
+ * @param {Object} [object={}] The object to copy symbols to.
28943
+ * @returns {Object} Returns `object`.
28944
+ */
28945
+ function copySymbolsIn$1(source, object) {
28946
+ return copyObject(source, getSymbolsIn$1(source), object);
28947
+ }
28948
+
28949
+ var _copySymbolsIn = copySymbolsIn$1;
28950
+
28951
+ var arrayPush = _arrayPush,
28952
+ isArray$1 = isArray_1;
28953
+
28954
+ /**
28955
+ * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
28956
+ * `keysFunc` and `symbolsFunc` to get the enumerable property names and
28957
+ * symbols of `object`.
28958
+ *
28959
+ * @private
28960
+ * @param {Object} object The object to query.
28961
+ * @param {Function} keysFunc The function to get the keys of `object`.
28962
+ * @param {Function} symbolsFunc The function to get the symbols of `object`.
28963
+ * @returns {Array} Returns the array of property names and symbols.
28964
+ */
28965
+ function baseGetAllKeys$2(object, keysFunc, symbolsFunc) {
28966
+ var result = keysFunc(object);
28967
+ return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
28968
+ }
28969
+
28970
+ var _baseGetAllKeys = baseGetAllKeys$2;
28971
+
28972
+ var baseGetAllKeys$1 = _baseGetAllKeys,
28973
+ getSymbols = _getSymbols,
28974
+ keys$1 = keys_1;
28975
+
28976
+ /**
28977
+ * Creates an array of own enumerable property names and symbols of `object`.
28978
+ *
28979
+ * @private
28980
+ * @param {Object} object The object to query.
28981
+ * @returns {Array} Returns the array of property names and symbols.
28982
+ */
28983
+ function getAllKeys$1(object) {
28984
+ return baseGetAllKeys$1(object, keys$1, getSymbols);
28985
+ }
28986
+
28987
+ var _getAllKeys = getAllKeys$1;
28988
+
28989
+ var baseGetAllKeys = _baseGetAllKeys,
28990
+ getSymbolsIn = _getSymbolsIn,
28991
+ keysIn$1 = keysIn_1;
28992
+
28993
+ /**
28994
+ * Creates an array of own and inherited enumerable property names and
28995
+ * symbols of `object`.
28996
+ *
28997
+ * @private
28998
+ * @param {Object} object The object to query.
28999
+ * @returns {Array} Returns the array of property names and symbols.
29000
+ */
29001
+ function getAllKeysIn$1(object) {
29002
+ return baseGetAllKeys(object, keysIn$1, getSymbolsIn);
29003
+ }
29004
+
29005
+ var _getAllKeysIn = getAllKeysIn$1;
29006
+
29007
+ var getNative$3 = _getNative,
29008
+ root$4 = _root;
29009
+
29010
+ /* Built-in method references that are verified to be native. */
29011
+ var DataView$1 = getNative$3(root$4, 'DataView');
29012
+
29013
+ var _DataView = DataView$1;
29014
+
29015
+ var getNative$2 = _getNative,
29016
+ root$3 = _root;
29017
+
29018
+ /* Built-in method references that are verified to be native. */
29019
+ var Promise$2 = getNative$2(root$3, 'Promise');
29020
+
29021
+ var _Promise = Promise$2;
29022
+
29023
+ var getNative$1 = _getNative,
29024
+ root$2 = _root;
29025
+
29026
+ /* Built-in method references that are verified to be native. */
29027
+ var Set$2 = getNative$1(root$2, 'Set');
29028
+
29029
+ var _Set = Set$2;
29030
+
29031
+ var getNative = _getNative,
29032
+ root$1 = _root;
29033
+
29034
+ /* Built-in method references that are verified to be native. */
29035
+ var WeakMap$2 = getNative(root$1, 'WeakMap');
29036
+
29037
+ var _WeakMap = WeakMap$2;
29038
+
29039
+ var DataView = _DataView,
29040
+ Map$1 = _Map,
29041
+ Promise$1 = _Promise,
29042
+ Set$1 = _Set,
29043
+ WeakMap$1 = _WeakMap,
29044
+ baseGetTag = _baseGetTag,
29045
+ toSource = _toSource;
29046
+
29047
+ /** `Object#toString` result references. */
29048
+ var mapTag$3 = '[object Map]',
29049
+ objectTag$1 = '[object Object]',
29050
+ promiseTag = '[object Promise]',
29051
+ setTag$3 = '[object Set]',
29052
+ weakMapTag$1 = '[object WeakMap]';
29053
+
29054
+ var dataViewTag$2 = '[object DataView]';
29055
+
29056
+ /** Used to detect maps, sets, and weakmaps. */
29057
+ var dataViewCtorString = toSource(DataView),
29058
+ mapCtorString = toSource(Map$1),
29059
+ promiseCtorString = toSource(Promise$1),
29060
+ setCtorString = toSource(Set$1),
29061
+ weakMapCtorString = toSource(WeakMap$1);
29062
+
29063
+ /**
29064
+ * Gets the `toStringTag` of `value`.
29065
+ *
29066
+ * @private
29067
+ * @param {*} value The value to query.
29068
+ * @returns {string} Returns the `toStringTag`.
29069
+ */
29070
+ var getTag$3 = baseGetTag;
29071
+
29072
+ // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
29073
+ if ((DataView && getTag$3(new DataView(new ArrayBuffer(1))) != dataViewTag$2) ||
29074
+ (Map$1 && getTag$3(new Map$1) != mapTag$3) ||
29075
+ (Promise$1 && getTag$3(Promise$1.resolve()) != promiseTag) ||
29076
+ (Set$1 && getTag$3(new Set$1) != setTag$3) ||
29077
+ (WeakMap$1 && getTag$3(new WeakMap$1) != weakMapTag$1)) {
29078
+ getTag$3 = function(value) {
29079
+ var result = baseGetTag(value),
29080
+ Ctor = result == objectTag$1 ? value.constructor : undefined,
29081
+ ctorString = Ctor ? toSource(Ctor) : '';
29082
+
29083
+ if (ctorString) {
29084
+ switch (ctorString) {
29085
+ case dataViewCtorString: return dataViewTag$2;
29086
+ case mapCtorString: return mapTag$3;
29087
+ case promiseCtorString: return promiseTag;
29088
+ case setCtorString: return setTag$3;
29089
+ case weakMapCtorString: return weakMapTag$1;
29090
+ }
29091
+ }
29092
+ return result;
29093
+ };
29094
+ }
29095
+
29096
+ var _getTag = getTag$3;
29097
+
29098
+ /** Used for built-in method references. */
29099
+
29100
+ var objectProto = Object.prototype;
29101
+
29102
+ /** Used to check objects for own properties. */
29103
+ var hasOwnProperty = objectProto.hasOwnProperty;
29104
+
29105
+ /**
29106
+ * Initializes an array clone.
29107
+ *
29108
+ * @private
29109
+ * @param {Array} array The array to clone.
29110
+ * @returns {Array} Returns the initialized clone.
29111
+ */
29112
+ function initCloneArray$1(array) {
29113
+ var length = array.length,
29114
+ result = new array.constructor(length);
29115
+
29116
+ // Add properties assigned by `RegExp#exec`.
29117
+ if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
29118
+ result.index = array.index;
29119
+ result.input = array.input;
29120
+ }
29121
+ return result;
29122
+ }
29123
+
29124
+ var _initCloneArray = initCloneArray$1;
29125
+
29126
+ var root = _root;
29127
+
29128
+ /** Built-in value references. */
29129
+ var Uint8Array$2 = root.Uint8Array;
29130
+
29131
+ var _Uint8Array = Uint8Array$2;
29132
+
29133
+ var Uint8Array$1 = _Uint8Array;
29134
+
29135
+ /**
29136
+ * Creates a clone of `arrayBuffer`.
29137
+ *
29138
+ * @private
29139
+ * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
29140
+ * @returns {ArrayBuffer} Returns the cloned array buffer.
29141
+ */
29142
+ function cloneArrayBuffer$3(arrayBuffer) {
29143
+ var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
29144
+ new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
29145
+ return result;
29146
+ }
29147
+
29148
+ var _cloneArrayBuffer = cloneArrayBuffer$3;
29149
+
29150
+ var cloneArrayBuffer$2 = _cloneArrayBuffer;
29151
+
29152
+ /**
29153
+ * Creates a clone of `dataView`.
29154
+ *
29155
+ * @private
29156
+ * @param {Object} dataView The data view to clone.
29157
+ * @param {boolean} [isDeep] Specify a deep clone.
29158
+ * @returns {Object} Returns the cloned data view.
29159
+ */
29160
+ function cloneDataView$1(dataView, isDeep) {
29161
+ var buffer = isDeep ? cloneArrayBuffer$2(dataView.buffer) : dataView.buffer;
29162
+ return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
29163
+ }
29164
+
29165
+ var _cloneDataView = cloneDataView$1;
29166
+
29167
+ /** Used to match `RegExp` flags from their coerced string values. */
29168
+
29169
+ var reFlags = /\w*$/;
29170
+
29171
+ /**
29172
+ * Creates a clone of `regexp`.
29173
+ *
29174
+ * @private
29175
+ * @param {Object} regexp The regexp to clone.
29176
+ * @returns {Object} Returns the cloned regexp.
29177
+ */
29178
+ function cloneRegExp$1(regexp) {
29179
+ var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
29180
+ result.lastIndex = regexp.lastIndex;
29181
+ return result;
29182
+ }
29183
+
29184
+ var _cloneRegExp = cloneRegExp$1;
29185
+
29186
+ var Symbol$1 = _Symbol;
29187
+
29188
+ /** Used to convert symbols to primitives and strings. */
29189
+ var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
29190
+ symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
29191
+
29192
+ /**
29193
+ * Creates a clone of the `symbol` object.
29194
+ *
29195
+ * @private
29196
+ * @param {Object} symbol The symbol object to clone.
29197
+ * @returns {Object} Returns the cloned symbol object.
29198
+ */
29199
+ function cloneSymbol$1(symbol) {
29200
+ return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
29201
+ }
29202
+
29203
+ var _cloneSymbol = cloneSymbol$1;
29204
+
29205
+ var cloneArrayBuffer$1 = _cloneArrayBuffer;
29206
+
29207
+ /**
29208
+ * Creates a clone of `typedArray`.
29209
+ *
29210
+ * @private
29211
+ * @param {Object} typedArray The typed array to clone.
29212
+ * @param {boolean} [isDeep] Specify a deep clone.
29213
+ * @returns {Object} Returns the cloned typed array.
29214
+ */
29215
+ function cloneTypedArray$1(typedArray, isDeep) {
29216
+ var buffer = isDeep ? cloneArrayBuffer$1(typedArray.buffer) : typedArray.buffer;
29217
+ return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
29218
+ }
29219
+
29220
+ var _cloneTypedArray = cloneTypedArray$1;
29221
+
29222
+ var cloneArrayBuffer = _cloneArrayBuffer,
29223
+ cloneDataView = _cloneDataView,
29224
+ cloneRegExp = _cloneRegExp,
29225
+ cloneSymbol = _cloneSymbol,
29226
+ cloneTypedArray = _cloneTypedArray;
29227
+
29228
+ /** `Object#toString` result references. */
29229
+ var boolTag$1 = '[object Boolean]',
29230
+ dateTag$1 = '[object Date]',
29231
+ mapTag$2 = '[object Map]',
29232
+ numberTag$1 = '[object Number]',
29233
+ regexpTag$1 = '[object RegExp]',
29234
+ setTag$2 = '[object Set]',
29235
+ stringTag$1 = '[object String]',
29236
+ symbolTag$1 = '[object Symbol]';
29237
+
29238
+ var arrayBufferTag$1 = '[object ArrayBuffer]',
29239
+ dataViewTag$1 = '[object DataView]',
29240
+ float32Tag$1 = '[object Float32Array]',
29241
+ float64Tag$1 = '[object Float64Array]',
29242
+ int8Tag$1 = '[object Int8Array]',
29243
+ int16Tag$1 = '[object Int16Array]',
29244
+ int32Tag$1 = '[object Int32Array]',
29245
+ uint8Tag$1 = '[object Uint8Array]',
29246
+ uint8ClampedTag$1 = '[object Uint8ClampedArray]',
29247
+ uint16Tag$1 = '[object Uint16Array]',
29248
+ uint32Tag$1 = '[object Uint32Array]';
29249
+
29250
+ /**
29251
+ * Initializes an object clone based on its `toStringTag`.
29252
+ *
29253
+ * **Note:** This function only supports cloning values with tags of
29254
+ * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
29255
+ *
29256
+ * @private
29257
+ * @param {Object} object The object to clone.
29258
+ * @param {string} tag The `toStringTag` of the object to clone.
29259
+ * @param {boolean} [isDeep] Specify a deep clone.
29260
+ * @returns {Object} Returns the initialized clone.
29261
+ */
29262
+ function initCloneByTag$1(object, tag, isDeep) {
29263
+ var Ctor = object.constructor;
29264
+ switch (tag) {
29265
+ case arrayBufferTag$1:
29266
+ return cloneArrayBuffer(object);
29267
+
29268
+ case boolTag$1:
29269
+ case dateTag$1:
29270
+ return new Ctor(+object);
29271
+
29272
+ case dataViewTag$1:
29273
+ return cloneDataView(object, isDeep);
29274
+
29275
+ case float32Tag$1: case float64Tag$1:
29276
+ case int8Tag$1: case int16Tag$1: case int32Tag$1:
29277
+ case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
29278
+ return cloneTypedArray(object, isDeep);
29279
+
29280
+ case mapTag$2:
29281
+ return new Ctor;
29282
+
29283
+ case numberTag$1:
29284
+ case stringTag$1:
29285
+ return new Ctor(object);
29286
+
29287
+ case regexpTag$1:
29288
+ return cloneRegExp(object);
29289
+
29290
+ case setTag$2:
29291
+ return new Ctor;
29292
+
29293
+ case symbolTag$1:
29294
+ return cloneSymbol(object);
29295
+ }
29296
+ }
29297
+
29298
+ var _initCloneByTag = initCloneByTag$1;
29299
+
29300
+ var isObject$1 = isObject_1;
29301
+
29302
+ /** Built-in value references. */
29303
+ var objectCreate = Object.create;
29304
+
29305
+ /**
29306
+ * The base implementation of `_.create` without support for assigning
29307
+ * properties to the created object.
29308
+ *
29309
+ * @private
29310
+ * @param {Object} proto The object to inherit from.
29311
+ * @returns {Object} Returns the new object.
29312
+ */
29313
+ var baseCreate$1 = (function() {
29314
+ function object() {}
29315
+ return function(proto) {
29316
+ if (!isObject$1(proto)) {
29317
+ return {};
29318
+ }
29319
+ if (objectCreate) {
29320
+ return objectCreate(proto);
29321
+ }
29322
+ object.prototype = proto;
29323
+ var result = new object;
29324
+ object.prototype = undefined;
29325
+ return result;
29326
+ };
29327
+ }());
29328
+
29329
+ var _baseCreate = baseCreate$1;
29330
+
29331
+ var baseCreate = _baseCreate,
29332
+ getPrototype = _getPrototype,
29333
+ isPrototype = _isPrototype;
29334
+
29335
+ /**
29336
+ * Initializes an object clone.
29337
+ *
29338
+ * @private
29339
+ * @param {Object} object The object to clone.
29340
+ * @returns {Object} Returns the initialized clone.
29341
+ */
29342
+ function initCloneObject$1(object) {
29343
+ return (typeof object.constructor == 'function' && !isPrototype(object))
29344
+ ? baseCreate(getPrototype(object))
29345
+ : {};
29346
+ }
29347
+
29348
+ var _initCloneObject = initCloneObject$1;
29349
+
29350
+ var getTag$2 = _getTag,
29351
+ isObjectLike$1 = isObjectLike_1;
29352
+
29353
+ /** `Object#toString` result references. */
29354
+ var mapTag$1 = '[object Map]';
29355
+
29356
+ /**
29357
+ * The base implementation of `_.isMap` without Node.js optimizations.
29358
+ *
29359
+ * @private
29360
+ * @param {*} value The value to check.
29361
+ * @returns {boolean} Returns `true` if `value` is a map, else `false`.
29362
+ */
29363
+ function baseIsMap$1(value) {
29364
+ return isObjectLike$1(value) && getTag$2(value) == mapTag$1;
29365
+ }
29366
+
29367
+ var _baseIsMap = baseIsMap$1;
29368
+
29369
+ var baseIsMap = _baseIsMap,
29370
+ baseUnary$1 = _baseUnary,
29371
+ nodeUtil$1 = _nodeUtilExports;
29372
+
29373
+ /* Node.js helper references. */
29374
+ var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap;
29375
+
29376
+ /**
29377
+ * Checks if `value` is classified as a `Map` object.
29378
+ *
29379
+ * @static
29380
+ * @memberOf _
29381
+ * @since 4.3.0
29382
+ * @category Lang
29383
+ * @param {*} value The value to check.
29384
+ * @returns {boolean} Returns `true` if `value` is a map, else `false`.
29385
+ * @example
29386
+ *
29387
+ * _.isMap(new Map);
29388
+ * // => true
29389
+ *
29390
+ * _.isMap(new WeakMap);
29391
+ * // => false
29392
+ */
29393
+ var isMap$1 = nodeIsMap ? baseUnary$1(nodeIsMap) : baseIsMap;
29394
+
29395
+ var isMap_1 = isMap$1;
29396
+
29397
+ var getTag$1 = _getTag,
29398
+ isObjectLike = isObjectLike_1;
29399
+
29400
+ /** `Object#toString` result references. */
29401
+ var setTag$1 = '[object Set]';
29402
+
29403
+ /**
29404
+ * The base implementation of `_.isSet` without Node.js optimizations.
29405
+ *
29406
+ * @private
29407
+ * @param {*} value The value to check.
29408
+ * @returns {boolean} Returns `true` if `value` is a set, else `false`.
29409
+ */
29410
+ function baseIsSet$1(value) {
29411
+ return isObjectLike(value) && getTag$1(value) == setTag$1;
29412
+ }
29413
+
29414
+ var _baseIsSet = baseIsSet$1;
29415
+
29416
+ var baseIsSet = _baseIsSet,
29417
+ baseUnary = _baseUnary,
29418
+ nodeUtil = _nodeUtilExports;
29419
+
29420
+ /* Node.js helper references. */
29421
+ var nodeIsSet = nodeUtil && nodeUtil.isSet;
29422
+
29423
+ /**
29424
+ * Checks if `value` is classified as a `Set` object.
29425
+ *
29426
+ * @static
29427
+ * @memberOf _
29428
+ * @since 4.3.0
29429
+ * @category Lang
29430
+ * @param {*} value The value to check.
29431
+ * @returns {boolean} Returns `true` if `value` is a set, else `false`.
29432
+ * @example
29433
+ *
29434
+ * _.isSet(new Set);
29435
+ * // => true
29436
+ *
29437
+ * _.isSet(new WeakSet);
29438
+ * // => false
29439
+ */
29440
+ var isSet$1 = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
29441
+
29442
+ var isSet_1 = isSet$1;
29443
+
29444
+ var Stack = _Stack,
29445
+ arrayEach = _arrayEach,
29446
+ assignValue = _assignValue,
29447
+ baseAssign = _baseAssign,
29448
+ baseAssignIn = _baseAssignIn,
29449
+ cloneBuffer = _cloneBufferExports,
29450
+ copyArray = _copyArray,
29451
+ copySymbols = _copySymbols,
29452
+ copySymbolsIn = _copySymbolsIn,
29453
+ getAllKeys = _getAllKeys,
29454
+ getAllKeysIn = _getAllKeysIn,
29455
+ getTag = _getTag,
29456
+ initCloneArray = _initCloneArray,
29457
+ initCloneByTag = _initCloneByTag,
29458
+ initCloneObject = _initCloneObject,
29459
+ isArray = isArray_1,
29460
+ isBuffer = isBufferExports,
29461
+ isMap = isMap_1,
29462
+ isObject = isObject_1,
29463
+ isSet = isSet_1,
29464
+ keys = keys_1,
29465
+ keysIn = keysIn_1;
29466
+
29467
+ /** Used to compose bitmasks for cloning. */
29468
+ var CLONE_DEEP_FLAG$1 = 1,
29469
+ CLONE_FLAT_FLAG = 2,
29470
+ CLONE_SYMBOLS_FLAG$1 = 4;
29471
+
29472
+ /** `Object#toString` result references. */
29473
+ var argsTag = '[object Arguments]',
29474
+ arrayTag = '[object Array]',
29475
+ boolTag = '[object Boolean]',
29476
+ dateTag = '[object Date]',
29477
+ errorTag = '[object Error]',
29478
+ funcTag = '[object Function]',
29479
+ genTag = '[object GeneratorFunction]',
29480
+ mapTag = '[object Map]',
29481
+ numberTag = '[object Number]',
29482
+ objectTag = '[object Object]',
29483
+ regexpTag = '[object RegExp]',
29484
+ setTag = '[object Set]',
29485
+ stringTag = '[object String]',
29486
+ symbolTag = '[object Symbol]',
29487
+ weakMapTag = '[object WeakMap]';
29488
+
29489
+ var arrayBufferTag = '[object ArrayBuffer]',
29490
+ dataViewTag = '[object DataView]',
29491
+ float32Tag = '[object Float32Array]',
29492
+ float64Tag = '[object Float64Array]',
29493
+ int8Tag = '[object Int8Array]',
29494
+ int16Tag = '[object Int16Array]',
29495
+ int32Tag = '[object Int32Array]',
29496
+ uint8Tag = '[object Uint8Array]',
29497
+ uint8ClampedTag = '[object Uint8ClampedArray]',
29498
+ uint16Tag = '[object Uint16Array]',
29499
+ uint32Tag = '[object Uint32Array]';
29500
+
29501
+ /** Used to identify `toStringTag` values supported by `_.clone`. */
29502
+ var cloneableTags = {};
29503
+ cloneableTags[argsTag] = cloneableTags[arrayTag] =
29504
+ cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
29505
+ cloneableTags[boolTag] = cloneableTags[dateTag] =
29506
+ cloneableTags[float32Tag] = cloneableTags[float64Tag] =
29507
+ cloneableTags[int8Tag] = cloneableTags[int16Tag] =
29508
+ cloneableTags[int32Tag] = cloneableTags[mapTag] =
29509
+ cloneableTags[numberTag] = cloneableTags[objectTag] =
29510
+ cloneableTags[regexpTag] = cloneableTags[setTag] =
29511
+ cloneableTags[stringTag] = cloneableTags[symbolTag] =
29512
+ cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
29513
+ cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
29514
+ cloneableTags[errorTag] = cloneableTags[funcTag] =
29515
+ cloneableTags[weakMapTag] = false;
29516
+
29517
+ /**
29518
+ * The base implementation of `_.clone` and `_.cloneDeep` which tracks
29519
+ * traversed objects.
29520
+ *
29521
+ * @private
29522
+ * @param {*} value The value to clone.
29523
+ * @param {boolean} bitmask The bitmask flags.
29524
+ * 1 - Deep clone
29525
+ * 2 - Flatten inherited properties
29526
+ * 4 - Clone symbols
29527
+ * @param {Function} [customizer] The function to customize cloning.
29528
+ * @param {string} [key] The key of `value`.
29529
+ * @param {Object} [object] The parent object of `value`.
29530
+ * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
29531
+ * @returns {*} Returns the cloned value.
29532
+ */
29533
+ function baseClone$1(value, bitmask, customizer, key, object, stack) {
29534
+ var result,
29535
+ isDeep = bitmask & CLONE_DEEP_FLAG$1,
29536
+ isFlat = bitmask & CLONE_FLAT_FLAG,
29537
+ isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
29538
+
29539
+ if (customizer) {
29540
+ result = object ? customizer(value, key, object, stack) : customizer(value);
29541
+ }
29542
+ if (result !== undefined) {
29543
+ return result;
29544
+ }
29545
+ if (!isObject(value)) {
29546
+ return value;
29547
+ }
29548
+ var isArr = isArray(value);
29549
+ if (isArr) {
29550
+ result = initCloneArray(value);
29551
+ if (!isDeep) {
29552
+ return copyArray(value, result);
29553
+ }
29554
+ } else {
29555
+ var tag = getTag(value),
29556
+ isFunc = tag == funcTag || tag == genTag;
29557
+
29558
+ if (isBuffer(value)) {
29559
+ return cloneBuffer(value, isDeep);
29560
+ }
29561
+ if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
29562
+ result = (isFlat || isFunc) ? {} : initCloneObject(value);
29563
+ if (!isDeep) {
29564
+ return isFlat
29565
+ ? copySymbolsIn(value, baseAssignIn(result, value))
29566
+ : copySymbols(value, baseAssign(result, value));
29567
+ }
29568
+ } else {
29569
+ if (!cloneableTags[tag]) {
29570
+ return object ? value : {};
29571
+ }
29572
+ result = initCloneByTag(value, tag, isDeep);
29573
+ }
29574
+ }
29575
+ // Check for circular references and return its corresponding clone.
29576
+ stack || (stack = new Stack);
29577
+ var stacked = stack.get(value);
29578
+ if (stacked) {
29579
+ return stacked;
29580
+ }
29581
+ stack.set(value, result);
29582
+
29583
+ if (isSet(value)) {
29584
+ value.forEach(function(subValue) {
29585
+ result.add(baseClone$1(subValue, bitmask, customizer, subValue, value, stack));
29586
+ });
29587
+ } else if (isMap(value)) {
29588
+ value.forEach(function(subValue, key) {
29589
+ result.set(key, baseClone$1(subValue, bitmask, customizer, key, value, stack));
29590
+ });
29591
+ }
29592
+
29593
+ var keysFunc = isFull
29594
+ ? (isFlat ? getAllKeysIn : getAllKeys)
29595
+ : (isFlat ? keysIn : keys);
29596
+
29597
+ var props = isArr ? undefined : keysFunc(value);
29598
+ arrayEach(props || value, function(subValue, key) {
29599
+ if (props) {
29600
+ key = subValue;
29601
+ subValue = value[key];
29602
+ }
29603
+ // Recursively populate clone (susceptible to call stack limits).
29604
+ assignValue(result, key, baseClone$1(subValue, bitmask, customizer, key, value, stack));
29605
+ });
29606
+ return result;
29607
+ }
29608
+
29609
+ var _baseClone = baseClone$1;
29610
+
29611
+ var baseClone = _baseClone;
29612
+
29613
+ /** Used to compose bitmasks for cloning. */
29614
+ var CLONE_DEEP_FLAG = 1,
29615
+ CLONE_SYMBOLS_FLAG = 4;
29616
+
29617
+ /**
29618
+ * This method is like `_.clone` except that it recursively clones `value`.
29619
+ *
29620
+ * @static
29621
+ * @memberOf _
29622
+ * @since 1.0.0
29623
+ * @category Lang
29624
+ * @param {*} value The value to recursively clone.
29625
+ * @returns {*} Returns the deep cloned value.
29626
+ * @see _.clone
29627
+ * @example
29628
+ *
29629
+ * var objects = [{ 'a': 1 }, { 'b': 2 }];
29630
+ *
29631
+ * var deep = _.cloneDeep(objects);
29632
+ * console.log(deep[0] === objects[0]);
29633
+ * // => false
29634
+ */
29635
+ function cloneDeep(value) {
29636
+ return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
29637
+ }
29638
+
29639
+ var cloneDeep_1 = cloneDeep;
29640
+
29641
+ var cloneDeep$1 = /*@__PURE__*/getDefaultExportFromCjs(cloneDeep_1);
29642
+
29643
+ // escape double-quote for cli
29644
+ function safe_quote(value) {
29645
+ let result = value;
29646
+ result = result.replace(RE$3.all_double_quote, '\\"');
29647
+ return result;
29648
+ }
29649
+ const RE$3 = {
29650
+ all_double_quote: /"/g,
29651
+ };
29652
+
29653
+ function write$1(message, values) {
29654
+ let result = message;
29655
+ // remove any previous metadata lines
29656
+ result = remove(result);
29657
+ const line_list = [result, "", TEMPLATE$1.stack_id(values.id)];
29658
+ if (values.title) {
29659
+ line_list.push(TEMPLATE$1.group_title(values.title));
29660
+ }
29661
+ let new_message = line_list.join("\n");
29662
+ new_message = safe_quote(new_message);
29663
+ return new_message;
29664
+ }
29665
+ function read(message) {
29666
+ const values = { id: null, title: null };
29667
+ const match_id = message.match(RE$2.stack_id);
29668
+ if (match_id?.groups) {
29669
+ values.id = match_id.groups["id"];
29670
+ invariant(values.id, "id must exist");
29671
+ }
29672
+ const match_title = message.match(RE$2.group_title);
29673
+ if (match_title?.groups) {
29674
+ values.title = match_title.groups["title"];
29675
+ }
29676
+ return values;
29677
+ }
29678
+ function remove(message) {
29679
+ let result = message;
29680
+ // remove metadata
29681
+ result = result.replace(new RegExp(RE$2.stack_id, "gmi"), "");
29682
+ result = result.replace(new RegExp(RE$2.group_title, "gmi"), "");
29683
+ result = result.trimEnd();
29684
+ return result;
29685
+ }
29686
+ const TEMPLATE$1 = {
29687
+ stack_id(id) {
29688
+ return `git-stack-id: ${id}`;
29689
+ },
29690
+ group_title(title) {
29691
+ return `git-stack-title: ${title}`;
29692
+ },
29693
+ };
29694
+ const RE$2 = {
29695
+ // https://regex101.com/r/wLmGVq/1
29696
+ stack_id: new RegExp(`${TEMPLATE$1.stack_id("(?<id>[^\\s]+)")}`, "i"),
29697
+ group_title: new RegExp(TEMPLATE$1.group_title("(?<title>[^\\n^\\r]+)"), "i"),
29698
+ };
29699
+
29700
+ async function pr_list() {
29701
+ const state = Store.getState();
29702
+ const actions = state.actions;
29703
+ const username = state.username;
29704
+ const repo_path = state.repo_path;
29705
+ invariant(username, "username must exist");
29706
+ invariant(repo_path, "repo_path must exist");
29707
+ const result_pr_list = await gh_json(`pr list --repo ${repo_path} --author ${username} --state open ${JSON_FIELDS}`);
29708
+ if (result_pr_list instanceof Error) {
29709
+ handle_error(result_pr_list.message);
29710
+ }
29711
+ if (actions.isDebug()) {
29712
+ actions.output(reactExports.createElement(Text, { dimColor: true },
29713
+ reactExports.createElement(Text, null, "Github cache "),
29714
+ reactExports.createElement(Text, { bold: true, color: colors.yellow }, result_pr_list.length),
29715
+ reactExports.createElement(Text, null, " open PRs from "),
29716
+ reactExports.createElement(Brackets, null, repo_path),
29717
+ reactExports.createElement(Text, null, " authored by "),
29718
+ reactExports.createElement(Brackets, null, username)));
29719
+ }
29720
+ actions.set((state) => {
29721
+ for (const pr of result_pr_list) {
29722
+ state.pr[pr.headRefName] = pr;
29723
+ }
29724
+ });
29725
+ return result_pr_list;
29726
+ }
29727
+ async function pr_status(branch) {
29728
+ const state = Store.getState();
29729
+ const actions = state.actions;
29730
+ const username = state.username;
29731
+ const repo_path = state.repo_path;
29732
+ invariant(username, "username must exist");
29733
+ invariant(repo_path, "repo_path must exist");
29734
+ const cache = state.pr[branch];
29735
+ if (cache) {
29736
+ if (actions.isDebug()) {
29737
+ actions.output(reactExports.createElement(Text, null,
29738
+ reactExports.createElement(Text, { dimColor: true }, "Github pr_status cache"),
29739
+ reactExports.createElement(Text, null, " "),
29740
+ reactExports.createElement(Text, { bold: true, color: colors.green }, "HIT "),
29741
+ reactExports.createElement(Text, null, " "),
29742
+ reactExports.createElement(Text, { dimColor: true }, branch)));
29743
+ }
29744
+ return cache;
29745
+ }
29746
+ if (actions.isDebug()) {
29747
+ actions.output(reactExports.createElement(Text, null,
29748
+ reactExports.createElement(Text, { dimColor: true }, "Github pr_status cache"),
29749
+ reactExports.createElement(Text, null, " "),
29750
+ reactExports.createElement(Text, { bold: true, color: colors.red }, "MISS"),
29751
+ reactExports.createElement(Text, null, " "),
29752
+ reactExports.createElement(Text, { dimColor: true }, branch)));
29753
+ }
29754
+ const pr = await gh_json(`pr view ${branch} --repo ${repo_path} ${JSON_FIELDS}`);
29755
+ if (pr instanceof Error) {
29756
+ return null;
29757
+ }
29758
+ actions.set((state) => {
29759
+ state.pr[pr.headRefName] = pr;
29760
+ });
29761
+ return pr;
29762
+ }
29763
+ async function pr_create(args) {
29764
+ const title = safe_quote(args.title);
29765
+ let command = `gh pr create --fill --head ${args.branch} --base ${args.base} --title="${title}" --body="${args.body}"`;
29766
+ if (args.draft) {
29767
+ command += " --draft";
29768
+ }
29769
+ const cli_result = await cli(command);
29770
+ if (cli_result.code !== 0) {
29771
+ handle_error(cli_result.output);
29772
+ return null;
29773
+ }
29774
+ return cli_result.stdout;
29775
+ }
29776
+ async function pr_edit(args) {
29777
+ const cli_result = await cli(
29778
+ // prettier-ignore
29779
+ `gh pr edit ${args.branch} --base ${args.base} --body-file="${body_file(args.body)}"`);
29780
+ if (cli_result.code !== 0) {
29781
+ handle_error(cli_result.output);
29782
+ }
29783
+ }
29784
+ // prettier-ignore
29785
+ const JSON_FIELDS = "--json number,state,baseRefName,headRefName,commits,title,body,url";
29786
+ // consistent handle gh cli commands returning json
29787
+ // redirect to tmp file to avoid scrollback overflow causing scrollback to be cleared
29788
+ async function gh_json(command) {
29789
+ const tmp_pr_json = path.join(os.tmpdir(), "git-stack-gh.json");
29790
+ const options = { ignoreExitCode: true };
29791
+ const cli_result = await cli(`gh ${command} > ${tmp_pr_json}`, options);
29792
+ if (cli_result.code !== 0) {
29793
+ return new Error(cli_result.output);
29794
+ }
29795
+ // read from file
29796
+ const json_str = fs.readFileSync(tmp_pr_json, "utf-8");
29797
+ const json = JSON.parse(json_str);
29798
+ return json;
29799
+ }
29800
+ function handle_error(output) {
29801
+ const state = Store.getState();
29802
+ const actions = state.actions;
29803
+ actions.set((state) => {
29804
+ state.step = "github-api-error";
29805
+ });
29806
+ throw new Error(output);
29807
+ }
29808
+ // convert a string to a file for use via github cli `--body-file`
29809
+ function body_file(body) {
29810
+ const temp_dir = os.tmpdir();
27388
29811
  const temp_path = path.join(temp_dir, "git-stack-body");
27389
29812
  if (fs.existsSync(temp_path)) {
27390
29813
  fs.rmSync(temp_path);
@@ -27516,33 +29939,17 @@ async function range(commit_group_map) {
27516
29939
  }
27517
29940
  async function get_commit_list() {
27518
29941
  const master_branch = Store.getState().master_branch;
27519
- const branch_name = Store.getState().branch_name;
27520
- invariant(branch_name, "branch_name must exist");
27521
29942
  const log_result = await cli(`git log ${master_branch}..HEAD --oneline --format=%H --color=never`);
27522
29943
  if (!log_result.stdout) {
27523
29944
  return [];
27524
29945
  }
27525
29946
  const sha_list = lines(log_result.stdout).reverse();
27526
29947
  const commit_metadata_list = [];
27527
- let has_metadata = false;
27528
29948
  for (let i = 0; i < sha_list.length; i++) {
27529
29949
  const sha = sha_list[i];
27530
29950
  const commit_metadata = await commit(sha);
27531
- if (commit_metadata.branch_id) {
27532
- has_metadata = true;
27533
- }
27534
29951
  commit_metadata_list.push(commit_metadata);
27535
29952
  }
27536
- if (!has_metadata) {
27537
- // check for pr with matching branch name to initialize group
27538
- const pr_result = await pr_status(branch_name);
27539
- if (pr_result) {
27540
- for (const commit_metadata of commit_metadata_list) {
27541
- commit_metadata.branch_id = branch_name;
27542
- commit_metadata.title = pr_result.title;
27543
- }
27544
- }
27545
- }
27546
29953
  return commit_metadata_list;
27547
29954
  }
27548
29955
  async function commit(sha) {
@@ -27569,13 +29976,391 @@ function lines(value) {
27569
29976
  }
27570
29977
  const UNASSIGNED = "unassigned";
27571
29978
 
29979
+ // https://git-revise.readthedocs.io/en/latest/man.html#interactive-mode
29980
+ //
29981
+ // # Interactive Revise Todos(4 commands)
29982
+ // #
29983
+ // # Commands:
29984
+ // # p, pick <commit> = use commit
29985
+ // # r, reword <commit> = use commit, but edit the commit message
29986
+ // # s, squash <commit> = use commit, but meld into previous commit
29987
+ // # f, fixup <commit> = like squash, but discard this commit's message
29988
+ // # c, cut <commit> = interactively split commit into two smaller commits
29989
+ // # i, index <commit> = leave commit changes staged, but uncommitted
29990
+ // #
29991
+ // # Each command block is prefixed by a '++' marker, followed by the command to
29992
+ // # run, the commit hash and after a newline the complete commit message until
29993
+ // # the next '++' marker or the end of the file.
29994
+ // #
29995
+ // # Commit messages will be reworded to match the provided message before the
29996
+ // # command is performed.
29997
+ // #
29998
+ // # These blocks are executed from top to bottom. They can be re-ordered and
29999
+ // # their commands can be changed, however the number of blocks must remain
30000
+ // # identical. If present, index blocks must be at the bottom of the list,
30001
+ // # i.e. they can not be followed by non-index blocks.
30002
+ // #
30003
+ // #
30004
+ // # If you remove everything, the revising process will be aborted.
30005
+ // calculate git-revise-todo from commit_range and rebase_group_index
30006
+ //
30007
+ // Example
30008
+ // ----------------------------
30009
+ // ++ pick d36d63499425
30010
+ // cantaloupe color
30011
+ //
30012
+ // git-stack-id: E63ytp5dj
30013
+ //
30014
+ // ++ pick 4f98dd3e67d0
30015
+ // banana sweet
30016
+ //
30017
+ // git-stack-id: E63ytp5dj
30018
+ //
30019
+ // ++ pick f143d03c723c
30020
+ // apple sweet
30021
+ //
30022
+ function GitReviseTodo(args) {
30023
+ const commit_list = [];
30024
+ const group_list = args.commit_range.group_list;
30025
+ for (let i = args.rebase_group_index; i < group_list.length; i++) {
30026
+ const group = group_list[i];
30027
+ for (const commit of group.commits) {
30028
+ commit_list.push(commit);
30029
+ }
30030
+ }
30031
+ const todo = GitReviseTodo.todo({ commit_list });
30032
+ return todo;
30033
+ }
30034
+ GitReviseTodo.todo = function todo(args) {
30035
+ const entry_list = [];
30036
+ for (const commit of args.commit_list) {
30037
+ // update git commit message with stack id
30038
+ const id = commit.branch_id;
30039
+ const title = commit.title;
30040
+ invariant(id, "commit.branch_id must exist");
30041
+ invariant(title, "commit.title must exist");
30042
+ const metadata = { id, title };
30043
+ const unsafe_message_with_id = write$1(commit.full_message, metadata);
30044
+ let message_with_id = unsafe_message_with_id;
30045
+ message_with_id = message_with_id.replace(/[^\\]"/g, '\\"');
30046
+ // get first 12 characters of commit sha
30047
+ const sha = commit.sha.slice(0, 12);
30048
+ // generate git revise entry
30049
+ const entry_lines = [`++ pick ${sha}`, message_with_id];
30050
+ const entry = entry_lines.join("\n");
30051
+ entry_list.push(entry);
30052
+ }
30053
+ const todo = entry_list.join("\n\n");
30054
+ return todo;
30055
+ };
30056
+ GitReviseTodo.execute = async function grt_execute(args) {
30057
+ // generate temporary directory and drop sequence editor script
30058
+ const tmp_git_sequence_editor_path = path.join(os.tmpdir(), "git-sequence-editor.sh");
30059
+ // ensure script is executable
30060
+ fs.chmodSync(tmp_git_sequence_editor_path, "755");
30061
+ const git_revise_todo = GitReviseTodo(args);
30062
+ // execute cli with temporary git sequence editor script
30063
+ // revise from merge base to pick correct commits
30064
+ const command = [
30065
+ `GIT_EDITOR="${tmp_git_sequence_editor_path}"`,
30066
+ `GIT_REVISE_TODO="${git_revise_todo}"`,
30067
+ `git`,
30068
+ `revise --edit -i ${args.rebase_merge_base}`,
30069
+ ];
30070
+ await cli(command, { stdio: ["ignore", "ignore", "ignore"] });
30071
+ };
30072
+
30073
+ function reducer$2(state, patch) {
30074
+ return { ...state, ...patch };
30075
+ }
30076
+ function DetectInitialPR(props) {
30077
+ const actions = Store.useActions();
30078
+ const branch_name = Store.useState((state) => state.branch_name);
30079
+ const [state, patch] = reactExports.useReducer(reducer$2, {
30080
+ status: "init",
30081
+ pr: null,
30082
+ });
30083
+ switch (state.status) {
30084
+ case "done":
30085
+ return props.children;
30086
+ case "revise":
30087
+ return (reactExports.createElement(Await, { function: run_revise, fallback: reactExports.createElement(Text, { color: colors.yellow }, "Synchronizing local commit metadata with remote branch on Github\u2026") }));
30088
+ case "prompt":
30089
+ return (reactExports.createElement(YesNoPrompt, { message: reactExports.createElement(Box, { flexDirection: "column" },
30090
+ reactExports.createElement(FormatText, { wrapper: reactExports.createElement(Text, { color: colors.yellow }), message: "{branch_name} exists on Github and was not generated with {git_stack}.", values: {
30091
+ branch_name: reactExports.createElement(Brackets, null, branch_name),
30092
+ git_stack: reactExports.createElement(Command, null, "git stack"),
30093
+ } }),
30094
+ reactExports.createElement(Text, null, " "),
30095
+ reactExports.createElement(FormatText, { message: " {url}", values: {
30096
+ url: reactExports.createElement(Url, null, state.pr?.url),
30097
+ } }),
30098
+ reactExports.createElement(Text, null, " "),
30099
+ reactExports.createElement(FormatText, { wrapper: reactExports.createElement(Text, { color: colors.yellow }), message: "In order to synchronize we need to rename your local branch, would you like to proceed?" })), onYes: async () => {
30100
+ patch({ status: "revise" });
30101
+ }, onNo: async () => {
30102
+ actions.exit(0);
30103
+ } }));
30104
+ default:
30105
+ return (reactExports.createElement(Await, { function: run, fallback: reactExports.createElement(Text, { color: colors.yellow }, "Checking for existing PR on Github\u2026") }));
30106
+ }
30107
+ async function run() {
30108
+ const actions = Store.getState().actions;
30109
+ const branch_name = Store.getState().branch_name;
30110
+ const commit_range = Store.getState().commit_range;
30111
+ invariant(branch_name, "branch_name must exist");
30112
+ invariant(commit_range, "branch_name must exist");
30113
+ try {
30114
+ let has_existing_metadata = false;
30115
+ for (const commit of commit_range.commit_list) {
30116
+ if (commit.branch_id) {
30117
+ has_existing_metadata = true;
30118
+ break;
30119
+ }
30120
+ }
30121
+ if (!has_existing_metadata) {
30122
+ // check for pr with matching branch name to initialize group
30123
+ const pr = await pr_status(branch_name);
30124
+ if (pr) {
30125
+ return patch({ status: "prompt", pr });
30126
+ }
30127
+ }
30128
+ patch({ status: "done" });
30129
+ }
30130
+ catch (err) {
30131
+ actions.error("Must be run from within a git repository.");
30132
+ if (err instanceof Error) {
30133
+ if (actions.isDebug()) {
30134
+ actions.error(err.message);
30135
+ }
30136
+ }
30137
+ actions.exit(9);
30138
+ }
30139
+ }
30140
+ async function run_revise() {
30141
+ const actions = Store.getState().actions;
30142
+ const master_branch = Store.getState().master_branch;
30143
+ const branch_name = Store.getState().branch_name;
30144
+ const commit_range = cloneDeep$1(Store.getState().commit_range);
30145
+ invariant(branch_name, "branch_name must exist");
30146
+ invariant(commit_range, "branch_name must exist");
30147
+ for (const group of commit_range.group_list) {
30148
+ group.id = branch_name;
30149
+ group.title = state.pr?.title || "-";
30150
+ }
30151
+ // get latest merge_base relative to local master
30152
+ const rebase_group_index = 0;
30153
+ const rebase_merge_base = (await cli(`git merge-base HEAD ${master_branch}`)).stdout;
30154
+ await GitReviseTodo.execute({
30155
+ rebase_group_index,
30156
+ rebase_merge_base,
30157
+ commit_range,
30158
+ });
30159
+ const new_branch_name = `${branch_name}-sync`;
30160
+ await cli(`git checkout -b ${new_branch_name}`);
30161
+ await cli(`git branch -D ${branch_name}`);
30162
+ const commit_range_new = await range();
30163
+ actions.set((state) => {
30164
+ state.branch_name = new_branch_name;
30165
+ state.commit_range = commit_range_new;
30166
+ });
30167
+ patch({ status: "done" });
30168
+ }
30169
+ }
30170
+
30171
+ function reducer$1(state, patch) {
30172
+ return { ...state, ...patch };
30173
+ }
30174
+ function DirtyCheck(props) {
30175
+ const actions = Store.useActions();
30176
+ const [state, patch] = reactExports.useReducer(reducer$1, {
30177
+ status: "init",
30178
+ });
30179
+ switch (state.status) {
30180
+ case "done":
30181
+ return props.children;
30182
+ case "prompt":
30183
+ return (reactExports.createElement(YesNoPrompt, { message: reactExports.createElement(Box, { flexDirection: "column" },
30184
+ reactExports.createElement(FormatText, { wrapper: reactExports.createElement(Text, { color: colors.yellow }), message: "{git} repo has uncommitted changes.", values: {
30185
+ git: reactExports.createElement(Command, null, "git"),
30186
+ git_stack: reactExports.createElement(Command, null, "git stack"),
30187
+ } }),
30188
+ reactExports.createElement(FormatText, { wrapper: reactExports.createElement(Text, { color: colors.yellow }), message: "Changes may be lost during {git_stack}, are you sure you want to proceed?", values: {
30189
+ git: reactExports.createElement(Command, null, "git"),
30190
+ git_stack: reactExports.createElement(Command, null, "git stack"),
30191
+ } })), onYes: async () => {
30192
+ patch({ status: "done" });
30193
+ }, onNo: async () => {
30194
+ actions.exit(0);
30195
+ } }));
30196
+ default:
30197
+ return (reactExports.createElement(Await, { function: run, fallback: reactExports.createElement(Text, { color: colors.yellow },
30198
+ "Ensuring ",
30199
+ reactExports.createElement(Command, null, "git status --porcelain"),
30200
+ "\u2026") }));
30201
+ }
30202
+ async function run() {
30203
+ const actions = Store.getState().actions;
30204
+ try {
30205
+ const git_dirty = (await cli(`git status --porcelain`)).stdout;
30206
+ const status = git_dirty ? "prompt" : "done";
30207
+ patch({ status });
30208
+ }
30209
+ catch (err) {
30210
+ actions.error("Must be run from within a git repository.");
30211
+ if (err instanceof Error) {
30212
+ if (actions.isDebug()) {
30213
+ actions.error(err.message);
30214
+ }
30215
+ }
30216
+ actions.exit(12);
30217
+ }
30218
+ }
30219
+ }
30220
+
30221
+ function GatherMetadata(props) {
30222
+ const fallback = (reactExports.createElement(Text, { color: colors.yellow }, "Gathering local git information\u2026"));
30223
+ return (reactExports.createElement(Await, { fallback: fallback, function: run$9 }, props.children));
30224
+ }
30225
+ async function run$9() {
30226
+ const actions = Store.getState().actions;
30227
+ const argv = Store.getState().argv;
30228
+ try {
30229
+ // default to master branch, fallback to main
30230
+ let master_branch;
30231
+ if (argv.branch) {
30232
+ actions.debug(reactExports.createElement(FormatText, { message: "Setting master branch to {branch}", values: {
30233
+ branch: reactExports.createElement(Brackets, null, argv.branch),
30234
+ } }));
30235
+ master_branch = argv.branch;
30236
+ }
30237
+ else {
30238
+ const detect_master = await cli(`git branch --list "${BRANCH.master}" --color=never`);
30239
+ if (detect_master.stdout !== "") {
30240
+ master_branch = BRANCH.master;
30241
+ }
30242
+ else {
30243
+ actions.debug(reactExports.createElement(FormatText, { message: "Could not find {master} branch, falling back to {main}", values: {
30244
+ master: reactExports.createElement(Brackets, null, BRANCH.master),
30245
+ main: reactExports.createElement(Brackets, null, BRANCH.main),
30246
+ } }));
30247
+ master_branch = BRANCH.main;
30248
+ }
30249
+ }
30250
+ const branch_name = (await cli("git rev-parse --abbrev-ref HEAD")).stdout;
30251
+ // handle detahed head state
30252
+ if (branch_name === "HEAD") {
30253
+ actions.error("Must run within a branch.");
30254
+ actions.exit(0);
30255
+ return;
30256
+ }
30257
+ // handle when there are no detected changes
30258
+ if (branch_name === master_branch) {
30259
+ actions.error("Must run within a branch.");
30260
+ actions.exit(0);
30261
+ return;
30262
+ }
30263
+ const head = (await cli("git rev-parse HEAD")).stdout;
30264
+ const merge_base = (await cli(`git merge-base HEAD ${master_branch}`))
30265
+ .stdout;
30266
+ // handle when there are no detected changes
30267
+ if (head === merge_base) {
30268
+ actions.newline();
30269
+ actions.output(reactExports.createElement(Text, { color: colors.gray }, "No changes detected."));
30270
+ actions.exit(0);
30271
+ return;
30272
+ }
30273
+ // git@github.com:magus/git-multi-diff-playground.git
30274
+ // https://github.com/magus/git-multi-diff-playground.git
30275
+ const origin_url = (await cli(`git config --get remote.origin.url`)).stdout;
30276
+ const repo_path = match_group(origin_url, RE$1.repo_path, "repo_path");
30277
+ const repo_root = (await cli(`git rev-parse --show-toplevel`)).stdout;
30278
+ Store.setState((state) => {
30279
+ state.repo_path = repo_path;
30280
+ state.repo_root = repo_root;
30281
+ state.master_branch = master_branch;
30282
+ state.head = head;
30283
+ state.branch_name = branch_name;
30284
+ });
30285
+ }
30286
+ catch (err) {
30287
+ actions.error("Unable to gather git metadata.");
30288
+ if (err instanceof Error) {
30289
+ if (actions.isDebug()) {
30290
+ actions.error(err.message);
30291
+ }
30292
+ }
30293
+ actions.exit(7);
30294
+ }
30295
+ }
30296
+ const RE$1 = {
30297
+ // git@github.com:magus/git-multi-diff-playground.git
30298
+ // https://github.com/magus/git-multi-diff-playground.git
30299
+ repo_path: /(?<repo_path>[^:^/]+\/[^/]+)\.git/,
30300
+ };
30301
+ const BRANCH = {
30302
+ master: "master",
30303
+ main: "main",
30304
+ };
30305
+
30306
+ function intl_format(date, options) {
30307
+ return new Intl.DateTimeFormat("en-US", options).format(date);
30308
+ }
30309
+ function format_time(date) {
30310
+ const time = intl_format(date, {
30311
+ hour: "numeric",
30312
+ minute: "2-digit",
30313
+ hour12: true,
30314
+ });
30315
+ return time;
30316
+ }
30317
+
30318
+ function GithubApiError() {
30319
+ return reactExports.createElement(Await, { fallback: null, function: run$8 });
30320
+ }
30321
+ async function run$8() {
30322
+ const actions = Store.getState().actions;
30323
+ const res = await cli(`gh api https://api.github.com/rate_limit`);
30324
+ const res_json = JSON.parse(res.stdout);
30325
+ const resources_graphql = res_json.resources.graphql;
30326
+ const used = resources_graphql.used;
30327
+ const limit = resources_graphql.limit;
30328
+ const reset_date = new Date(resources_graphql.reset * 1000);
30329
+ // calculate the time remaining in minutes
30330
+ const now = new Date();
30331
+ const diff_seconds = (reset_date.getTime() - now.getTime()) / 1000;
30332
+ const diff_minutes = Math.round(diff_seconds / 60);
30333
+ const reset_time = format_time(reset_date);
30334
+ let time_until;
30335
+ if (diff_minutes < 0) {
30336
+ time_until = `${diff_seconds} seconds`;
30337
+ }
30338
+ else {
30339
+ time_until = `${diff_minutes} minutes`;
30340
+ }
30341
+ actions.output(reactExports.createElement(Text, { dimColor: true },
30342
+ reactExports.createElement(Text, null, "Github "),
30343
+ reactExports.createElement(Brackets, null, "graphql"),
30344
+ reactExports.createElement(Text, null, " API rate limit "),
30345
+ reactExports.createElement(Brackets, null,
30346
+ reactExports.createElement(Text, null, used),
30347
+ reactExports.createElement(Text, null, "/"),
30348
+ reactExports.createElement(Text, null, limit)),
30349
+ reactExports.createElement(Text, null, " will reset at "),
30350
+ reactExports.createElement(Text, { bold: true, color: colors.yellow }, reset_time),
30351
+ reactExports.createElement(Text, null, " "),
30352
+ reactExports.createElement(Parens, null,
30353
+ reactExports.createElement(Text, null, "in "),
30354
+ reactExports.createElement(Text, { bold: true, color: colors.yellow }, time_until))));
30355
+ }
30356
+
27572
30357
  function LocalCommitStatus(props) {
27573
30358
  const argv = Store.useState((state) => state.argv);
27574
30359
  const fallback = (reactExports.createElement(Text, { color: colors.yellow }, "Fetching PR status from Github\u2026"));
27575
30360
  if (argv["mock-metadata"]) {
27576
30361
  return (reactExports.createElement(Await, { fallback: fallback, function: mock_metadata }, props.children));
27577
30362
  }
27578
- return (reactExports.createElement(Await, { fallback: fallback, function: gather_metadata }, props.children));
30363
+ return (reactExports.createElement(Await, { fallback: fallback, function: run$7 }, props.children));
27579
30364
  }
27580
30365
  async function mock_metadata() {
27581
30366
  const module = await Promise.resolve().then(function () { return metadata; });
@@ -27585,7 +30370,7 @@ async function mock_metadata() {
27585
30370
  state.step = "status";
27586
30371
  });
27587
30372
  }
27588
- async function gather_metadata() {
30373
+ async function run$7() {
27589
30374
  const actions = Store.getState().actions;
27590
30375
  try {
27591
30376
  const commit_range = await range();
@@ -27784,72 +30569,6 @@ async function run$6() {
27784
30569
  }
27785
30570
  const PATCH_FILE$1 = "git-stack-cli-patch.patch";
27786
30571
 
27787
- // https://git-revise.readthedocs.io/en/latest/man.html#interactive-mode
27788
- //
27789
- // # Interactive Revise Todos(4 commands)
27790
- // #
27791
- // # Commands:
27792
- // # p, pick <commit> = use commit
27793
- // # r, reword <commit> = use commit, but edit the commit message
27794
- // # s, squash <commit> = use commit, but meld into previous commit
27795
- // # f, fixup <commit> = like squash, but discard this commit's message
27796
- // # c, cut <commit> = interactively split commit into two smaller commits
27797
- // # i, index <commit> = leave commit changes staged, but uncommitted
27798
- // #
27799
- // # Each command block is prefixed by a '++' marker, followed by the command to
27800
- // # run, the commit hash and after a newline the complete commit message until
27801
- // # the next '++' marker or the end of the file.
27802
- // #
27803
- // # Commit messages will be reworded to match the provided message before the
27804
- // # command is performed.
27805
- // #
27806
- // # These blocks are executed from top to bottom. They can be re-ordered and
27807
- // # their commands can be changed, however the number of blocks must remain
27808
- // # identical. If present, index blocks must be at the bottom of the list,
27809
- // # i.e. they can not be followed by non-index blocks.
27810
- // #
27811
- // #
27812
- // # If you remove everything, the revising process will be aborted.
27813
- // calculate git-revise-todo from commit_range and rebase_group_index
27814
- //
27815
- // Example
27816
- // ----------------------------
27817
- // ++ pick d36d63499425
27818
- // cantaloupe color
27819
- //
27820
- // git-stack-id: E63ytp5dj
27821
- //
27822
- // ++ pick 4f98dd3e67d0
27823
- // banana sweet
27824
- //
27825
- // git-stack-id: E63ytp5dj
27826
- //
27827
- // ++ pick f143d03c723c
27828
- // apple sweet
27829
- //
27830
- function GitReviseTodo(args) {
27831
- const entry_list = [];
27832
- const group_list = args.commit_range.group_list;
27833
- for (let i = args.rebase_group_index; i < group_list.length; i++) {
27834
- const group = group_list[i];
27835
- for (const commit of group.commits) {
27836
- // update git commit message with stack id
27837
- const metadata = { id: group.id, title: group.title };
27838
- const unsafe_message_with_id = write$1(commit.full_message, metadata);
27839
- let message_with_id = unsafe_message_with_id;
27840
- message_with_id = message_with_id.replace(/[^\\]"/g, '\\"');
27841
- // get first 12 characters of commit sha
27842
- const sha = commit.sha.slice(0, 12);
27843
- // generate git revise entry
27844
- const entry_lines = [`++ pick ${sha}`, message_with_id];
27845
- const entry = entry_lines.join("\n");
27846
- entry_list.push(entry);
27847
- }
27848
- }
27849
- const todo = entry_list.join("\n\n");
27850
- return todo;
27851
- }
27852
-
27853
30572
  function write(args) {
27854
30573
  const stack_table = table(args);
27855
30574
  let result = args.body;
@@ -27965,15 +30684,31 @@ async function run$5() {
27965
30684
  const actions = state.actions;
27966
30685
  const argv = state.argv;
27967
30686
  const branch_name = state.branch_name;
30687
+ const original_commit_range = cloneDeep$1(state.commit_range);
27968
30688
  const commit_map = state.commit_map;
27969
30689
  const master_branch = state.master_branch;
27970
30690
  const cwd = state.cwd;
27971
30691
  const repo_root = state.repo_root;
27972
30692
  invariant(branch_name, "branch_name must exist");
30693
+ invariant(original_commit_range, "original_commit_range must exist");
27973
30694
  invariant(commit_map, "commit_map must exist");
27974
30695
  invariant(repo_root, "repo_root must exist");
27975
30696
  // always listen for SIGINT event and restore git state
27976
30697
  process.once("SIGINT", handle_exit);
30698
+ // get latest merge_base relative to local master
30699
+ const merge_base = (await cli(`git merge-base HEAD ${master_branch}`)).stdout;
30700
+ // immediately paint all commit to preserve selected commit ranges
30701
+ original_commit_range.group_list.reverse();
30702
+ for (const commit of original_commit_range.commit_list) {
30703
+ const group_from_map = commit_map[commit.sha];
30704
+ commit.branch_id = group_from_map.id;
30705
+ commit.title = group_from_map.title;
30706
+ }
30707
+ await GitReviseTodo.execute({
30708
+ rebase_group_index: 0,
30709
+ rebase_merge_base: merge_base,
30710
+ commit_range: original_commit_range,
30711
+ });
27977
30712
  let DEFAULT_PR_BODY = "";
27978
30713
  if (state.pr_template_body) {
27979
30714
  DEFAULT_PR_BODY = state.pr_template_body;
@@ -27982,8 +30717,6 @@ async function run$5() {
27982
30717
  const commit_range = await range(commit_map);
27983
30718
  // reverse commit list so that we can cherry-pick in order
27984
30719
  commit_range.group_list.reverse();
27985
- // get latest merge_base relative to local master
27986
- const merge_base = (await cli(`git merge-base HEAD ${master_branch}`)).stdout;
27987
30720
  let rebase_merge_base = merge_base;
27988
30721
  let rebase_group_index = 0;
27989
30722
  for (let i = 0; i < commit_range.group_list.length; i++) {
@@ -28079,15 +30812,11 @@ echo "$GIT_REVISE_TODO" > "$git_revise_todo_path"
28079
30812
  fs.chmodSync(tmp_git_sequence_editor_path, "755");
28080
30813
  // create temporary branch
28081
30814
  await cli(`git checkout -b ${temp_branch_name}`);
28082
- const git_revise_todo = GitReviseTodo({ rebase_group_index, commit_range });
28083
- // execute cli with temporary git sequence editor script
28084
- // revise from merge base to pick correct commits
28085
- await cli([
28086
- `GIT_EDITOR="${tmp_git_sequence_editor_path}"`,
28087
- `GIT_REVISE_TODO="${git_revise_todo}"`,
28088
- `git`,
28089
- `revise --edit -i ${rebase_merge_base}`,
28090
- ], { stdio: ["ignore", "ignore", "ignore"] });
30815
+ await GitReviseTodo.execute({
30816
+ rebase_group_index,
30817
+ rebase_merge_base,
30818
+ commit_range,
30819
+ });
28091
30820
  // early return since we do not need to sync
28092
30821
  if (!argv.sync) {
28093
30822
  return;
@@ -28793,6 +31522,10 @@ function get_value(props) {
28793
31522
  return props.value || props.defaultValue || "";
28794
31523
  }
28795
31524
 
31525
+ function gs_short_id() {
31526
+ return `gs-${short_id()}`;
31527
+ }
31528
+
28796
31529
  function SelectCommitRanges() {
28797
31530
  const commit_range = Store.useState((state) => state.commit_range);
28798
31531
  invariant(commit_range, "commit_range must exist");
@@ -28992,7 +31725,7 @@ function SelectCommitRangesInternal(props) {
28992
31725
  enter: (reactExports.createElement(Text, { bold: true, color: colors.green }, SYMBOL.enter)),
28993
31726
  } }))));
28994
31727
  function submit_group_input(title) {
28995
- const id = `gs-${short_id()}`;
31728
+ const id = gs_short_id();
28996
31729
  actions.output(reactExports.createElement(FormatText, { wrapper: reactExports.createElement(Text, { dimColor: true }), message: "Created new group {group} {note}", values: {
28997
31730
  group: reactExports.createElement(Brackets, null, title),
28998
31731
  note: reactExports.createElement(Parens, null, id),
@@ -29128,12 +31861,12 @@ function RebaseCheck(props) {
29128
31861
  actions.exit(0);
29129
31862
  } }));
29130
31863
  default:
29131
- return (reactExports.createElement(Await, { fallback: reactExports.createElement(Text, { color: colors.yellow },
31864
+ return (reactExports.createElement(Await, { function: run, fallback: reactExports.createElement(Text, { color: colors.yellow },
29132
31865
  "Checking for ",
29133
31866
  reactExports.createElement(Command, null, "git rebase"),
29134
- "\u2026"), function: rebase_check }));
31867
+ "\u2026") }));
29135
31868
  }
29136
- async function rebase_check() {
31869
+ async function run() {
29137
31870
  const actions = Store.getState().actions;
29138
31871
  try {
29139
31872
  const git_dir = (await cli(`git rev-parse --absolute-git-dir`)).stdout;
@@ -29150,7 +31883,7 @@ function RebaseCheck(props) {
29150
31883
  actions.error(err.message);
29151
31884
  }
29152
31885
  }
29153
- actions.exit(9);
31886
+ actions.exit(13);
29154
31887
  }
29155
31888
  }
29156
31889
  }
@@ -29313,7 +32046,8 @@ function MaybeMain() {
29313
32046
  !argv.verbose ? null : reactExports.createElement(GithubApiError, null),
29314
32047
  reactExports.createElement(GatherMetadata, null,
29315
32048
  reactExports.createElement(LocalCommitStatus, null,
29316
- reactExports.createElement(Main, null)))));
32049
+ reactExports.createElement(DetectInitialPR, null,
32050
+ reactExports.createElement(Main, null))))));
29317
32051
  }
29318
32052
 
29319
32053
  const align = {
@@ -34633,7 +37367,7 @@ async function command() {
34633
37367
  .wrap(123)
34634
37368
  // disallow unknown options
34635
37369
  .strict()
34636
- .version("1.9.0" )
37370
+ .version("1.10.0" )
34637
37371
  .showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`")
34638
37372
  .help("help", "Show usage via `git stack help`")
34639
37373
  .argv;