@builder.io/sdk 2.2.6 → 2.2.7-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.
@@ -1,340 +1,455 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
1
+ 'use strict';
2
+ var __assign =
3
+ (this && this.__assign) ||
4
+ function () {
5
+ __assign =
6
+ Object.assign ||
7
+ function (t) {
4
8
  for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
9
+ s = arguments[i];
10
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
8
11
  }
9
12
  return t;
10
- };
13
+ };
11
14
  return __assign.apply(this, arguments);
12
- };
13
- var __generator = (this && this.__generator) || function (thisArg, body) {
14
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
15
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
16
- function verb(n) { return function (v) { return step([n, v]); }; }
15
+ };
16
+ var __generator =
17
+ (this && this.__generator) ||
18
+ function (thisArg, body) {
19
+ var _ = {
20
+ label: 0,
21
+ sent: function () {
22
+ if (t[0] & 1) throw t[1];
23
+ return t[1];
24
+ },
25
+ trys: [],
26
+ ops: [],
27
+ },
28
+ f,
29
+ y,
30
+ t,
31
+ g;
32
+ return (
33
+ (g = { next: verb(0), throw: verb(1), return: verb(2) }),
34
+ typeof Symbol === 'function' &&
35
+ (g[Symbol.iterator] = function () {
36
+ return this;
37
+ }),
38
+ g
39
+ );
40
+ function verb(n) {
41
+ return function (v) {
42
+ return step([n, v]);
43
+ };
44
+ }
17
45
  function step(op) {
18
- if (f) throw new TypeError("Generator is already executing.");
19
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
20
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
21
- if (y = 0, t) op = [op[0] & 2, t.value];
22
- switch (op[0]) {
23
- case 0: case 1: t = op; break;
24
- case 4: _.label++; return { value: op[1], done: false };
25
- case 5: _.label++; y = op[1]; op = [0]; continue;
26
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
27
- default:
28
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
29
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
30
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
31
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
32
- if (t[2]) _.ops.pop();
33
- _.trys.pop(); continue;
34
- }
35
- op = body.call(thisArg, _);
36
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
37
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ if (f) throw new TypeError('Generator is already executing.');
47
+ while ((g && ((g = 0), op[0] && (_ = 0)), _))
48
+ try {
49
+ if (
50
+ ((f = 1),
51
+ y &&
52
+ (t =
53
+ op[0] & 2
54
+ ? y['return']
55
+ : op[0]
56
+ ? y['throw'] || ((t = y['return']) && t.call(y), 0)
57
+ : y.next) &&
58
+ !(t = t.call(y, op[1])).done)
59
+ )
60
+ return t;
61
+ if (((y = 0), t)) op = [op[0] & 2, t.value];
62
+ switch (op[0]) {
63
+ case 0:
64
+ case 1:
65
+ t = op;
66
+ break;
67
+ case 4:
68
+ _.label++;
69
+ return { value: op[1], done: false };
70
+ case 5:
71
+ _.label++;
72
+ y = op[1];
73
+ op = [0];
74
+ continue;
75
+ case 7:
76
+ op = _.ops.pop();
77
+ _.trys.pop();
78
+ continue;
79
+ default:
80
+ if (
81
+ !((t = _.trys), (t = t.length > 0 && t[t.length - 1])) &&
82
+ (op[0] === 6 || op[0] === 2)
83
+ ) {
84
+ _ = 0;
85
+ continue;
86
+ }
87
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
88
+ _.label = op[1];
89
+ break;
90
+ }
91
+ if (op[0] === 6 && _.label < t[1]) {
92
+ _.label = t[1];
93
+ t = op;
94
+ break;
95
+ }
96
+ if (t && _.label < t[2]) {
97
+ _.label = t[2];
98
+ _.ops.push(op);
99
+ break;
100
+ }
101
+ if (t[2]) _.ops.pop();
102
+ _.trys.pop();
103
+ continue;
104
+ }
105
+ op = body.call(thisArg, _);
106
+ } catch (e) {
107
+ op = [6, e];
108
+ y = 0;
109
+ } finally {
110
+ f = t = 0;
111
+ }
112
+ if (op[0] & 5) throw op[1];
113
+ return { value: op[0] ? op[1] : void 0, done: true };
38
114
  }
39
- };
40
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
41
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
115
+ };
116
+ var __spreadArray =
117
+ (this && this.__spreadArray) ||
118
+ function (to, from, pack) {
119
+ if (pack || arguments.length === 2)
120
+ for (var i = 0, l = from.length, ar; i < l; i++) {
42
121
  if (ar || !(i in from)) {
43
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
44
- ar[i] = from[i];
122
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
123
+ ar[i] = from[i];
45
124
  }
46
- }
125
+ }
47
126
  return to.concat(ar || Array.prototype.slice.call(from));
48
- };
49
- var __values = (this && this.__values) || function(o) {
50
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
127
+ };
128
+ var __values =
129
+ (this && this.__values) ||
130
+ function (o) {
131
+ var s = typeof Symbol === 'function' && Symbol.iterator,
132
+ m = s && o[s],
133
+ i = 0;
51
134
  if (m) return m.call(o);
52
- if (o && typeof o.length === "number") return {
135
+ if (o && typeof o.length === 'number')
136
+ return {
53
137
  next: function () {
54
- if (o && i >= o.length) o = void 0;
55
- return { value: o && o[i++], done: !o };
56
- }
57
- };
58
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
59
- };
60
- Object.defineProperty(exports, "__esModule", { value: true });
138
+ if (o && i >= o.length) o = void 0;
139
+ return { value: o && o[i++], done: !o };
140
+ },
141
+ };
142
+ throw new TypeError(s ? 'Object is not iterable.' : 'Symbol.iterator is not defined.');
143
+ };
144
+ Object.defineProperty(exports, '__esModule', { value: true });
61
145
  var Limit;
62
146
  (function (Limit) {
63
- Limit[Limit["All"] = 0] = "All";
64
- Limit[Limit["Two"] = 1] = "Two";
65
- Limit[Limit["One"] = 2] = "One";
147
+ Limit[(Limit['All'] = 0)] = 'All';
148
+ Limit[(Limit['Two'] = 1)] = 'Two';
149
+ Limit[(Limit['One'] = 2)] = 'One';
66
150
  })(Limit || (Limit = {}));
67
151
  var config;
68
152
  var rootDocument;
69
153
  function default_1(input, options) {
70
- if (input.nodeType !== Node.ELEMENT_NODE) {
71
- throw new Error("Can't generate CSS selector for non-element node type.");
72
- }
73
- if ('html' === input.tagName.toLowerCase()) {
74
- return input.tagName.toLowerCase();
75
- }
76
- var defaults = {
77
- root: document.body,
78
- idName: function (name) { return true; },
79
- className: function (name) { return true; },
80
- tagName: function (name) { return true; },
81
- seedMinLength: 1,
82
- optimizedMinLength: 2,
83
- threshold: 1000,
84
- };
85
- config = __assign(__assign({}, defaults), options);
86
- rootDocument = findRootDocument(config.root, defaults);
87
- var path = bottomUpSearch(input, Limit.All, function () {
88
- return bottomUpSearch(input, Limit.Two, function () { return bottomUpSearch(input, Limit.One); });
154
+ if (input.nodeType !== Node.ELEMENT_NODE) {
155
+ throw new Error("Can't generate CSS selector for non-element node type.");
156
+ }
157
+ if ('html' === input.tagName.toLowerCase()) {
158
+ return input.tagName.toLowerCase();
159
+ }
160
+ var defaults = {
161
+ root: document.body,
162
+ idName: function (name) {
163
+ return true;
164
+ },
165
+ className: function (name) {
166
+ return true;
167
+ },
168
+ tagName: function (name) {
169
+ return true;
170
+ },
171
+ seedMinLength: 1,
172
+ optimizedMinLength: 2,
173
+ threshold: 1000,
174
+ };
175
+ config = __assign(__assign({}, defaults), options);
176
+ rootDocument = findRootDocument(config.root, defaults);
177
+ var path = bottomUpSearch(input, Limit.All, function () {
178
+ return bottomUpSearch(input, Limit.Two, function () {
179
+ return bottomUpSearch(input, Limit.One);
89
180
  });
90
- if (path) {
91
- var optimized = sort(optimize(path, input));
92
- if (optimized.length > 0) {
93
- path = optimized[0];
94
- }
95
- return selector(path);
96
- }
97
- else {
98
- throw new Error("Selector was not found.");
181
+ });
182
+ if (path) {
183
+ var optimized = sort(optimize(path, input));
184
+ if (optimized.length > 0) {
185
+ path = optimized[0];
99
186
  }
187
+ return selector(path);
188
+ } else {
189
+ throw new Error('Selector was not found.');
190
+ }
100
191
  }
101
192
  exports.default = default_1;
102
193
  function findRootDocument(rootNode, defaults) {
103
- if (rootNode.nodeType === Node.DOCUMENT_NODE) {
104
- return rootNode;
105
- }
106
- if (rootNode === defaults.root) {
107
- return rootNode.ownerDocument;
108
- }
194
+ if (rootNode.nodeType === Node.DOCUMENT_NODE) {
109
195
  return rootNode;
196
+ }
197
+ if (rootNode === defaults.root) {
198
+ return rootNode.ownerDocument;
199
+ }
200
+ return rootNode;
110
201
  }
111
202
  function bottomUpSearch(input, limit, fallback) {
112
- var path = null;
113
- var stack = [];
114
- var current = input;
115
- var i = 0;
116
- var _loop_1 = function () {
117
- var level = maybe(id(current)) || maybe.apply(void 0, classNames(current)) ||
118
- maybe(tagName(current)) || [any()];
119
- var nth = index(current);
120
- if (limit === Limit.All) {
121
- if (nth) {
122
- level = level.concat(level.filter(dispensableNth).map(function (node) { return nthChild(node, nth); }));
123
- }
124
- }
125
- else if (limit === Limit.Two) {
126
- level = level.slice(0, 1);
127
- if (nth) {
128
- level = level.concat(level.filter(dispensableNth).map(function (node) { return nthChild(node, nth); }));
129
- }
130
- }
131
- else if (limit === Limit.One) {
132
- var node = (level = level.slice(0, 1))[0];
133
- if (nth && dispensableNth(node)) {
134
- level = [nthChild(node, nth)];
135
- }
136
- }
137
- for (var _i = 0, level_1 = level; _i < level_1.length; _i++) {
138
- var node = level_1[_i];
139
- node.level = i;
140
- }
141
- stack.push(level);
142
- if (stack.length >= config.seedMinLength) {
143
- path = findUniquePath(stack, fallback);
144
- if (path) {
145
- return "break";
146
- }
147
- }
148
- current = current.parentElement;
149
- i++;
150
- };
151
- while (current && current !== config.root.parentElement) {
152
- var state_1 = _loop_1();
153
- if (state_1 === "break")
154
- break;
203
+ var path = null;
204
+ var stack = [];
205
+ var current = input;
206
+ var i = 0;
207
+ var _loop_1 = function () {
208
+ var level = maybe(id(current)) ||
209
+ maybe.apply(void 0, classNames(current)) ||
210
+ maybe(tagName(current)) || [any()];
211
+ var nth = index(current);
212
+ if (limit === Limit.All) {
213
+ if (nth) {
214
+ level = level.concat(
215
+ level.filter(dispensableNth).map(function (node) {
216
+ return nthChild(node, nth);
217
+ })
218
+ );
219
+ }
220
+ } else if (limit === Limit.Two) {
221
+ level = level.slice(0, 1);
222
+ if (nth) {
223
+ level = level.concat(
224
+ level.filter(dispensableNth).map(function (node) {
225
+ return nthChild(node, nth);
226
+ })
227
+ );
228
+ }
229
+ } else if (limit === Limit.One) {
230
+ var node = (level = level.slice(0, 1))[0];
231
+ if (nth && dispensableNth(node)) {
232
+ level = [nthChild(node, nth)];
233
+ }
234
+ }
235
+ for (var _i = 0, level_1 = level; _i < level_1.length; _i++) {
236
+ var node = level_1[_i];
237
+ node.level = i;
155
238
  }
156
- if (!path) {
157
- path = findUniquePath(stack, fallback);
239
+ stack.push(level);
240
+ if (stack.length >= config.seedMinLength) {
241
+ path = findUniquePath(stack, fallback);
242
+ if (path) {
243
+ return 'break';
244
+ }
158
245
  }
159
- return path;
246
+ current = current.parentElement;
247
+ i++;
248
+ };
249
+ while (current && current !== config.root.parentElement) {
250
+ var state_1 = _loop_1();
251
+ if (state_1 === 'break') break;
252
+ }
253
+ if (!path) {
254
+ path = findUniquePath(stack, fallback);
255
+ }
256
+ return path;
160
257
  }
161
258
  function findUniquePath(stack, fallback) {
162
- var paths = sort(combinations(stack));
163
- if (paths.length > config.threshold) {
164
- return fallback ? fallback() : null;
259
+ var paths = sort(combinations(stack));
260
+ if (paths.length > config.threshold) {
261
+ return fallback ? fallback() : null;
262
+ }
263
+ for (var _i = 0, paths_1 = paths; _i < paths_1.length; _i++) {
264
+ var candidate = paths_1[_i];
265
+ if (unique(candidate)) {
266
+ return candidate;
165
267
  }
166
- for (var _i = 0, paths_1 = paths; _i < paths_1.length; _i++) {
167
- var candidate = paths_1[_i];
168
- if (unique(candidate)) {
169
- return candidate;
170
- }
171
- }
172
- return null;
268
+ }
269
+ return null;
173
270
  }
174
271
  function selector(path) {
175
- var node = path[0];
176
- var query = node.name;
177
- for (var i = 1; i < path.length; i++) {
178
- var level = path[i].level || 0;
179
- if (node.level === level - 1) {
180
- query = "".concat(path[i].name, " > ").concat(query);
181
- }
182
- else {
183
- query = "".concat(path[i].name, " ").concat(query);
184
- }
185
- node = path[i];
272
+ var node = path[0];
273
+ var query = node.name;
274
+ for (var i = 1; i < path.length; i++) {
275
+ var level = path[i].level || 0;
276
+ if (node.level === level - 1) {
277
+ query = ''.concat(path[i].name, ' > ').concat(query);
278
+ } else {
279
+ query = ''.concat(path[i].name, ' ').concat(query);
186
280
  }
187
- return query;
281
+ node = path[i];
282
+ }
283
+ return query;
188
284
  }
189
285
  function penalty(path) {
190
- return path.map(function (node) { return node.penalty; }).reduce(function (acc, i) { return acc + i; }, 0);
286
+ return path
287
+ .map(function (node) {
288
+ return node.penalty;
289
+ })
290
+ .reduce(function (acc, i) {
291
+ return acc + i;
292
+ }, 0);
191
293
  }
192
294
  function unique(path) {
193
- switch (rootDocument.querySelectorAll(selector(path)).length) {
194
- case 0:
195
- throw new Error("Can't select any node with this selector: ".concat(selector(path)));
196
- case 1:
197
- return true;
198
- default:
199
- return false;
200
- }
295
+ switch (rootDocument.querySelectorAll(selector(path)).length) {
296
+ case 0:
297
+ throw new Error("Can't select any node with this selector: ".concat(selector(path)));
298
+ case 1:
299
+ return true;
300
+ default:
301
+ return false;
302
+ }
201
303
  }
202
304
  function id(input) {
203
- var elementId = input.getAttribute('id');
204
- if (elementId && config.idName(elementId)) {
205
- return {
206
- name: '#' + elementId,
207
- penalty: 0,
208
- };
209
- }
210
- return null;
305
+ var elementId = input.getAttribute('id');
306
+ if (elementId && config.idName(elementId)) {
307
+ return {
308
+ name: '#' + elementId,
309
+ penalty: 0,
310
+ };
311
+ }
312
+ return null;
211
313
  }
212
314
  function classNames(input) {
213
- var names = [].slice.call(input.classList).filter(config.className);
214
- return names.map(function (name) { return ({
215
- name: '.' + name,
216
- penalty: 1,
217
- }); });
315
+ var names = [].slice.call(input.classList).filter(config.className);
316
+ return names.map(function (name) {
317
+ return {
318
+ name: '.' + name,
319
+ penalty: 1,
320
+ };
321
+ });
218
322
  }
219
323
  function tagName(input) {
220
- var name = input.tagName.toLowerCase();
221
- if (config.tagName(name)) {
222
- return {
223
- name: name,
224
- penalty: 2,
225
- };
226
- }
227
- return null;
228
- }
229
- function any() {
324
+ var name = input.tagName.toLowerCase();
325
+ if (config.tagName(name)) {
230
326
  return {
231
- name: '*',
232
- penalty: 3,
327
+ name: name,
328
+ penalty: 2,
233
329
  };
330
+ }
331
+ return null;
332
+ }
333
+ function any() {
334
+ return {
335
+ name: '*',
336
+ penalty: 3,
337
+ };
234
338
  }
235
339
  function index(input) {
236
- var parent = input.parentNode;
237
- if (!parent) {
238
- return null;
239
- }
240
- var child = parent.firstChild;
241
- if (!child) {
242
- return null;
340
+ var parent = input.parentNode;
341
+ if (!parent) {
342
+ return null;
343
+ }
344
+ var child = parent.firstChild;
345
+ if (!child) {
346
+ return null;
347
+ }
348
+ var i = 0;
349
+ while (child) {
350
+ if (child.nodeType === Node.ELEMENT_NODE) {
351
+ i++;
243
352
  }
244
- var i = 0;
245
- while (child) {
246
- if (child.nodeType === Node.ELEMENT_NODE) {
247
- i++;
248
- }
249
- if (child === input) {
250
- break;
251
- }
252
- child = child.nextSibling;
353
+ if (child === input) {
354
+ break;
253
355
  }
254
- return i;
356
+ child = child.nextSibling;
357
+ }
358
+ return i;
255
359
  }
256
360
  function nthChild(node, i) {
257
- return {
258
- name: node.name + ":nth-child(".concat(i, ")"),
259
- penalty: node.penalty + 1,
260
- };
361
+ return {
362
+ name: node.name + ':nth-child('.concat(i, ')'),
363
+ penalty: node.penalty + 1,
364
+ };
261
365
  }
262
366
  function dispensableNth(node) {
263
- return node.name !== 'html' && !(node.name[0] === '#');
367
+ return node.name !== 'html' && !(node.name[0] === '#');
264
368
  }
265
369
  function maybe() {
266
- var level = [];
267
- for (var _i = 0; _i < arguments.length; _i++) {
268
- level[_i] = arguments[_i];
269
- }
270
- var list = level.filter(notEmpty);
271
- if (list.length > 0) {
272
- return list;
273
- }
274
- return null;
370
+ var level = [];
371
+ for (var _i = 0; _i < arguments.length; _i++) {
372
+ level[_i] = arguments[_i];
373
+ }
374
+ var list = level.filter(notEmpty);
375
+ if (list.length > 0) {
376
+ return list;
377
+ }
378
+ return null;
275
379
  }
276
380
  function notEmpty(value) {
277
- return value !== null && value !== undefined;
381
+ return value !== null && value !== undefined;
278
382
  }
279
383
  function combinations(stack, path) {
280
- var _i, _a, node;
281
- if (path === void 0) { path = []; }
282
- return __generator(this, function (_b) {
283
- switch (_b.label) {
284
- case 0:
285
- if (!(stack.length > 0)) return [3 /*break*/, 5];
286
- _i = 0, _a = stack[0];
287
- _b.label = 1;
288
- case 1:
289
- if (!(_i < _a.length)) return [3 /*break*/, 4];
290
- node = _a[_i];
291
- return [5 /*yield**/, __values(combinations(stack.slice(1, stack.length), path.concat(node)))];
292
- case 2:
293
- _b.sent();
294
- _b.label = 3;
295
- case 3:
296
- _i++;
297
- return [3 /*break*/, 1];
298
- case 4: return [3 /*break*/, 7];
299
- case 5: return [4 /*yield*/, path];
300
- case 6:
301
- _b.sent();
302
- _b.label = 7;
303
- case 7: return [2 /*return*/];
304
- }
305
- });
384
+ var _i, _a, node;
385
+ if (path === void 0) {
386
+ path = [];
387
+ }
388
+ return __generator(this, function (_b) {
389
+ switch (_b.label) {
390
+ case 0:
391
+ if (!(stack.length > 0)) return [3 /*break*/, 5];
392
+ (_i = 0), (_a = stack[0]);
393
+ _b.label = 1;
394
+ case 1:
395
+ if (!(_i < _a.length)) return [3 /*break*/, 4];
396
+ node = _a[_i];
397
+ return [
398
+ 5 /*yield**/,
399
+ __values(combinations(stack.slice(1, stack.length), path.concat(node))),
400
+ ];
401
+ case 2:
402
+ _b.sent();
403
+ _b.label = 3;
404
+ case 3:
405
+ _i++;
406
+ return [3 /*break*/, 1];
407
+ case 4:
408
+ return [3 /*break*/, 7];
409
+ case 5:
410
+ return [4 /*yield*/, path];
411
+ case 6:
412
+ _b.sent();
413
+ _b.label = 7;
414
+ case 7:
415
+ return [2 /*return*/];
416
+ }
417
+ });
306
418
  }
307
419
  function sort(paths) {
308
- return [].slice.call(paths).sort(function (a, b) { return penalty(a) - penalty(b); });
420
+ return [].slice.call(paths).sort(function (a, b) {
421
+ return penalty(a) - penalty(b);
422
+ });
309
423
  }
310
424
  function optimize(path, input) {
311
- var i, newPath;
312
- return __generator(this, function (_a) {
313
- switch (_a.label) {
314
- case 0:
315
- if (!(path.length > 2 && path.length > config.optimizedMinLength)) return [3 /*break*/, 5];
316
- i = 1;
317
- _a.label = 1;
318
- case 1:
319
- if (!(i < path.length - 1)) return [3 /*break*/, 5];
320
- newPath = __spreadArray([], path, true);
321
- newPath.splice(i, 1);
322
- if (!(unique(newPath) && same(newPath, input))) return [3 /*break*/, 4];
323
- return [4 /*yield*/, newPath];
324
- case 2:
325
- _a.sent();
326
- return [5 /*yield**/, __values(optimize(newPath, input))];
327
- case 3:
328
- _a.sent();
329
- _a.label = 4;
330
- case 4:
331
- i++;
332
- return [3 /*break*/, 1];
333
- case 5: return [2 /*return*/];
334
- }
335
- });
425
+ var i, newPath;
426
+ return __generator(this, function (_a) {
427
+ switch (_a.label) {
428
+ case 0:
429
+ if (!(path.length > 2 && path.length > config.optimizedMinLength)) return [3 /*break*/, 5];
430
+ i = 1;
431
+ _a.label = 1;
432
+ case 1:
433
+ if (!(i < path.length - 1)) return [3 /*break*/, 5];
434
+ newPath = __spreadArray([], path, true);
435
+ newPath.splice(i, 1);
436
+ if (!(unique(newPath) && same(newPath, input))) return [3 /*break*/, 4];
437
+ return [4 /*yield*/, newPath];
438
+ case 2:
439
+ _a.sent();
440
+ return [5 /*yield**/, __values(optimize(newPath, input))];
441
+ case 3:
442
+ _a.sent();
443
+ _a.label = 4;
444
+ case 4:
445
+ i++;
446
+ return [3 /*break*/, 1];
447
+ case 5:
448
+ return [2 /*return*/];
449
+ }
450
+ });
336
451
  }
337
452
  function same(path, input) {
338
- return rootDocument.querySelector(selector(path)) === input;
453
+ return rootDocument.querySelector(selector(path)) === input;
339
454
  }
340
- //# sourceMappingURL=finder.function.js.map
455
+ //# sourceMappingURL=finder.function.js.map