moonshot-rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +20 -0
- data/README.md +1 -0
- data/app/assets/javascripts/moonshot/index.js +7 -0
- data/app/assets/javascripts/moonshot/shepherd_controller.js +75 -0
- data/app/assets/javascripts/moonshot.js +3849 -0
- data/app/helpers/moonshot/moonshot_helper.rb +6 -0
- data/lib/moonshot-rails/config.rb +6 -0
- data/lib/moonshot-rails/engine.rb +25 -0
- data/lib/moonshot-rails/version.rb +3 -0
- data/lib/moonshot-rails.rb +14 -0
- metadata +97 -0
@@ -0,0 +1,3849 @@
|
|
1
|
+
import { post } from "@rails/request.js";
|
2
|
+
|
3
|
+
import { Controller } from "@hotwired/stimulus";
|
4
|
+
|
5
|
+
/*! shepherd.js 11.2.0 */ var isMergeableObject = function isMergeableObject(value) {
|
6
|
+
return isNonNullObject(value) && !isSpecial(value);
|
7
|
+
};
|
8
|
+
|
9
|
+
function isNonNullObject(value) {
|
10
|
+
return !!value && typeof value === "object";
|
11
|
+
}
|
12
|
+
|
13
|
+
function isSpecial(value) {
|
14
|
+
var stringValue = Object.prototype.toString.call(value);
|
15
|
+
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
|
16
|
+
}
|
17
|
+
|
18
|
+
var canUseSymbol = typeof Symbol === "function" && Symbol.for;
|
19
|
+
|
20
|
+
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
|
21
|
+
|
22
|
+
function isReactElement(value) {
|
23
|
+
return value.$$typeof === REACT_ELEMENT_TYPE;
|
24
|
+
}
|
25
|
+
|
26
|
+
function emptyTarget(val) {
|
27
|
+
return Array.isArray(val) ? [] : {};
|
28
|
+
}
|
29
|
+
|
30
|
+
function cloneUnlessOtherwiseSpecified(value, options) {
|
31
|
+
return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
|
32
|
+
}
|
33
|
+
|
34
|
+
function defaultArrayMerge(target, source, options) {
|
35
|
+
return target.concat(source).map((function(element) {
|
36
|
+
return cloneUnlessOtherwiseSpecified(element, options);
|
37
|
+
}));
|
38
|
+
}
|
39
|
+
|
40
|
+
function getMergeFunction(key, options) {
|
41
|
+
if (!options.customMerge) {
|
42
|
+
return deepmerge;
|
43
|
+
}
|
44
|
+
var customMerge = options.customMerge(key);
|
45
|
+
return typeof customMerge === "function" ? customMerge : deepmerge;
|
46
|
+
}
|
47
|
+
|
48
|
+
function getEnumerableOwnPropertySymbols(target) {
|
49
|
+
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter((function(symbol) {
|
50
|
+
return Object.propertyIsEnumerable.call(target, symbol);
|
51
|
+
})) : [];
|
52
|
+
}
|
53
|
+
|
54
|
+
function getKeys(target) {
|
55
|
+
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
|
56
|
+
}
|
57
|
+
|
58
|
+
function propertyIsOnObject(object, property) {
|
59
|
+
try {
|
60
|
+
return property in object;
|
61
|
+
} catch (_) {
|
62
|
+
return false;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
function propertyIsUnsafe(target, key) {
|
67
|
+
return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
|
68
|
+
}
|
69
|
+
|
70
|
+
function mergeObject(target, source, options) {
|
71
|
+
var destination = {};
|
72
|
+
if (options.isMergeableObject(target)) {
|
73
|
+
getKeys(target).forEach((function(key) {
|
74
|
+
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
75
|
+
}));
|
76
|
+
}
|
77
|
+
getKeys(source).forEach((function(key) {
|
78
|
+
if (propertyIsUnsafe(target, key)) {
|
79
|
+
return;
|
80
|
+
}
|
81
|
+
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
82
|
+
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
83
|
+
} else {
|
84
|
+
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
85
|
+
}
|
86
|
+
}));
|
87
|
+
return destination;
|
88
|
+
}
|
89
|
+
|
90
|
+
function deepmerge(target, source, options) {
|
91
|
+
options = options || {};
|
92
|
+
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
93
|
+
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
94
|
+
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
95
|
+
var sourceIsArray = Array.isArray(source);
|
96
|
+
var targetIsArray = Array.isArray(target);
|
97
|
+
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
98
|
+
if (!sourceAndTargetTypesMatch) {
|
99
|
+
return cloneUnlessOtherwiseSpecified(source, options);
|
100
|
+
} else if (sourceIsArray) {
|
101
|
+
return options.arrayMerge(target, source, options);
|
102
|
+
} else {
|
103
|
+
return mergeObject(target, source, options);
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
deepmerge.all = function deepmergeAll(array, options) {
|
108
|
+
if (!Array.isArray(array)) {
|
109
|
+
throw new Error("first argument should be an array");
|
110
|
+
}
|
111
|
+
return array.reduce((function(prev, next) {
|
112
|
+
return deepmerge(prev, next, options);
|
113
|
+
}), {});
|
114
|
+
};
|
115
|
+
|
116
|
+
var deepmerge_1 = deepmerge;
|
117
|
+
|
118
|
+
var cjs = deepmerge_1;
|
119
|
+
|
120
|
+
function isElement$1(value) {
|
121
|
+
return value instanceof Element;
|
122
|
+
}
|
123
|
+
|
124
|
+
function isHTMLElement$1(value) {
|
125
|
+
return value instanceof HTMLElement;
|
126
|
+
}
|
127
|
+
|
128
|
+
function isFunction(value) {
|
129
|
+
return typeof value === "function";
|
130
|
+
}
|
131
|
+
|
132
|
+
function isString(value) {
|
133
|
+
return typeof value === "string";
|
134
|
+
}
|
135
|
+
|
136
|
+
function isUndefined(value) {
|
137
|
+
return value === undefined;
|
138
|
+
}
|
139
|
+
|
140
|
+
class Evented {
|
141
|
+
on(event, handler, ctx, once = false) {
|
142
|
+
if (isUndefined(this.bindings)) {
|
143
|
+
this.bindings = {};
|
144
|
+
}
|
145
|
+
if (isUndefined(this.bindings[event])) {
|
146
|
+
this.bindings[event] = [];
|
147
|
+
}
|
148
|
+
this.bindings[event].push({
|
149
|
+
handler: handler,
|
150
|
+
ctx: ctx,
|
151
|
+
once: once
|
152
|
+
});
|
153
|
+
return this;
|
154
|
+
}
|
155
|
+
once(event, handler, ctx) {
|
156
|
+
return this.on(event, handler, ctx, true);
|
157
|
+
}
|
158
|
+
off(event, handler) {
|
159
|
+
if (isUndefined(this.bindings) || isUndefined(this.bindings[event])) {
|
160
|
+
return this;
|
161
|
+
}
|
162
|
+
if (isUndefined(handler)) {
|
163
|
+
delete this.bindings[event];
|
164
|
+
} else {
|
165
|
+
this.bindings[event].forEach(((binding, index) => {
|
166
|
+
if (binding.handler === handler) {
|
167
|
+
this.bindings[event].splice(index, 1);
|
168
|
+
}
|
169
|
+
}));
|
170
|
+
}
|
171
|
+
return this;
|
172
|
+
}
|
173
|
+
trigger(event, ...args) {
|
174
|
+
if (!isUndefined(this.bindings) && this.bindings[event]) {
|
175
|
+
this.bindings[event].forEach(((binding, index) => {
|
176
|
+
const {ctx: ctx, handler: handler, once: once} = binding;
|
177
|
+
const context = ctx || this;
|
178
|
+
handler.apply(context, args);
|
179
|
+
if (once) {
|
180
|
+
this.bindings[event].splice(index, 1);
|
181
|
+
}
|
182
|
+
}));
|
183
|
+
}
|
184
|
+
return this;
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
188
|
+
function autoBind(self) {
|
189
|
+
const keys = Object.getOwnPropertyNames(self.constructor.prototype);
|
190
|
+
for (let i = 0; i < keys.length; i++) {
|
191
|
+
const key = keys[i];
|
192
|
+
const val = self[key];
|
193
|
+
if (key !== "constructor" && typeof val === "function") {
|
194
|
+
self[key] = val.bind(self);
|
195
|
+
}
|
196
|
+
}
|
197
|
+
return self;
|
198
|
+
}
|
199
|
+
|
200
|
+
function _setupAdvanceOnHandler(selector, step) {
|
201
|
+
return event => {
|
202
|
+
if (step.isOpen()) {
|
203
|
+
const targetIsEl = step.el && event.currentTarget === step.el;
|
204
|
+
const targetIsSelector = !isUndefined(selector) && event.currentTarget.matches(selector);
|
205
|
+
if (targetIsSelector || targetIsEl) {
|
206
|
+
step.tour.next();
|
207
|
+
}
|
208
|
+
}
|
209
|
+
};
|
210
|
+
}
|
211
|
+
|
212
|
+
function bindAdvance(step) {
|
213
|
+
const {event: event, selector: selector} = step.options.advanceOn || {};
|
214
|
+
if (event) {
|
215
|
+
const handler = _setupAdvanceOnHandler(selector, step);
|
216
|
+
let el;
|
217
|
+
try {
|
218
|
+
el = document.querySelector(selector);
|
219
|
+
} catch (e) {}
|
220
|
+
if (!isUndefined(selector) && !el) {
|
221
|
+
return console.error(`No element was found for the selector supplied to advanceOn: ${selector}`);
|
222
|
+
} else if (el) {
|
223
|
+
el.addEventListener(event, handler);
|
224
|
+
step.on("destroy", (() => el.removeEventListener(event, handler)));
|
225
|
+
} else {
|
226
|
+
document.body.addEventListener(event, handler, true);
|
227
|
+
step.on("destroy", (() => document.body.removeEventListener(event, handler, true)));
|
228
|
+
}
|
229
|
+
} else {
|
230
|
+
return console.error("advanceOn was defined, but no event name was passed.");
|
231
|
+
}
|
232
|
+
}
|
233
|
+
|
234
|
+
function normalizePrefix(prefix) {
|
235
|
+
if (!isString(prefix) || prefix === "") {
|
236
|
+
return "";
|
237
|
+
}
|
238
|
+
return prefix.charAt(prefix.length - 1) !== "-" ? `${prefix}-` : prefix;
|
239
|
+
}
|
240
|
+
|
241
|
+
function parseAttachTo(step) {
|
242
|
+
const options = step.options.attachTo || {};
|
243
|
+
const returnOpts = Object.assign({}, options);
|
244
|
+
if (isFunction(returnOpts.element)) {
|
245
|
+
returnOpts.element = returnOpts.element.call(step);
|
246
|
+
}
|
247
|
+
if (isString(returnOpts.element)) {
|
248
|
+
try {
|
249
|
+
returnOpts.element = document.querySelector(returnOpts.element);
|
250
|
+
} catch (e) {}
|
251
|
+
if (!returnOpts.element) {
|
252
|
+
console.error(`The element for this Shepherd step was not found ${options.element}`);
|
253
|
+
}
|
254
|
+
}
|
255
|
+
return returnOpts;
|
256
|
+
}
|
257
|
+
|
258
|
+
function shouldCenterStep(resolvedAttachToOptions) {
|
259
|
+
if (resolvedAttachToOptions === undefined || resolvedAttachToOptions === null) {
|
260
|
+
return true;
|
261
|
+
}
|
262
|
+
return !resolvedAttachToOptions.element || !resolvedAttachToOptions.on;
|
263
|
+
}
|
264
|
+
|
265
|
+
function uuid() {
|
266
|
+
let d = Date.now();
|
267
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c => {
|
268
|
+
const r = (d + Math.random() * 16) % 16 | 0;
|
269
|
+
d = Math.floor(d / 16);
|
270
|
+
return (c == "x" ? r : r & 3 | 8).toString(16);
|
271
|
+
}));
|
272
|
+
}
|
273
|
+
|
274
|
+
function _extends() {
|
275
|
+
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
276
|
+
for (var i = 1; i < arguments.length; i++) {
|
277
|
+
var source = arguments[i];
|
278
|
+
for (var key in source) {
|
279
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
280
|
+
target[key] = source[key];
|
281
|
+
}
|
282
|
+
}
|
283
|
+
}
|
284
|
+
return target;
|
285
|
+
};
|
286
|
+
return _extends.apply(this, arguments);
|
287
|
+
}
|
288
|
+
|
289
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
290
|
+
if (source == null) return {};
|
291
|
+
var target = {};
|
292
|
+
var sourceKeys = Object.keys(source);
|
293
|
+
var key, i;
|
294
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
295
|
+
key = sourceKeys[i];
|
296
|
+
if (excluded.indexOf(key) >= 0) continue;
|
297
|
+
target[key] = source[key];
|
298
|
+
}
|
299
|
+
return target;
|
300
|
+
}
|
301
|
+
|
302
|
+
const min = Math.min;
|
303
|
+
|
304
|
+
const max = Math.max;
|
305
|
+
|
306
|
+
const round = Math.round;
|
307
|
+
|
308
|
+
const floor = Math.floor;
|
309
|
+
|
310
|
+
const createCoords = v => ({
|
311
|
+
x: v,
|
312
|
+
y: v
|
313
|
+
});
|
314
|
+
|
315
|
+
const oppositeSideMap = {
|
316
|
+
left: "right",
|
317
|
+
right: "left",
|
318
|
+
bottom: "top",
|
319
|
+
top: "bottom"
|
320
|
+
};
|
321
|
+
|
322
|
+
const oppositeAlignmentMap = {
|
323
|
+
start: "end",
|
324
|
+
end: "start"
|
325
|
+
};
|
326
|
+
|
327
|
+
function clamp(start, value, end) {
|
328
|
+
return max(start, min(value, end));
|
329
|
+
}
|
330
|
+
|
331
|
+
function evaluate(value, param) {
|
332
|
+
return typeof value === "function" ? value(param) : value;
|
333
|
+
}
|
334
|
+
|
335
|
+
function getSide(placement) {
|
336
|
+
return placement.split("-")[0];
|
337
|
+
}
|
338
|
+
|
339
|
+
function getAlignment(placement) {
|
340
|
+
return placement.split("-")[1];
|
341
|
+
}
|
342
|
+
|
343
|
+
function getOppositeAxis(axis) {
|
344
|
+
return axis === "x" ? "y" : "x";
|
345
|
+
}
|
346
|
+
|
347
|
+
function getAxisLength(axis) {
|
348
|
+
return axis === "y" ? "height" : "width";
|
349
|
+
}
|
350
|
+
|
351
|
+
function getSideAxis(placement) {
|
352
|
+
return [ "top", "bottom" ].includes(getSide(placement)) ? "y" : "x";
|
353
|
+
}
|
354
|
+
|
355
|
+
function getAlignmentAxis(placement) {
|
356
|
+
return getOppositeAxis(getSideAxis(placement));
|
357
|
+
}
|
358
|
+
|
359
|
+
function getAlignmentSides(placement, rects, rtl) {
|
360
|
+
if (rtl === void 0) {
|
361
|
+
rtl = false;
|
362
|
+
}
|
363
|
+
const alignment = getAlignment(placement);
|
364
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
365
|
+
const length = getAxisLength(alignmentAxis);
|
366
|
+
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
367
|
+
if (rects.reference[length] > rects.floating[length]) {
|
368
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
369
|
+
}
|
370
|
+
return [ mainAlignmentSide, getOppositePlacement(mainAlignmentSide) ];
|
371
|
+
}
|
372
|
+
|
373
|
+
function getExpandedPlacements(placement) {
|
374
|
+
const oppositePlacement = getOppositePlacement(placement);
|
375
|
+
return [ getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement) ];
|
376
|
+
}
|
377
|
+
|
378
|
+
function getOppositeAlignmentPlacement(placement) {
|
379
|
+
return placement.replace(/start|end/g, (alignment => oppositeAlignmentMap[alignment]));
|
380
|
+
}
|
381
|
+
|
382
|
+
function getSideList(side, isStart, rtl) {
|
383
|
+
const lr = [ "left", "right" ];
|
384
|
+
const rl = [ "right", "left" ];
|
385
|
+
const tb = [ "top", "bottom" ];
|
386
|
+
const bt = [ "bottom", "top" ];
|
387
|
+
switch (side) {
|
388
|
+
case "top":
|
389
|
+
case "bottom":
|
390
|
+
if (rtl) return isStart ? rl : lr;
|
391
|
+
return isStart ? lr : rl;
|
392
|
+
|
393
|
+
case "left":
|
394
|
+
case "right":
|
395
|
+
return isStart ? tb : bt;
|
396
|
+
|
397
|
+
default:
|
398
|
+
return [];
|
399
|
+
}
|
400
|
+
}
|
401
|
+
|
402
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
403
|
+
const alignment = getAlignment(placement);
|
404
|
+
let list = getSideList(getSide(placement), direction === "start", rtl);
|
405
|
+
if (alignment) {
|
406
|
+
list = list.map((side => side + "-" + alignment));
|
407
|
+
if (flipAlignment) {
|
408
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
409
|
+
}
|
410
|
+
}
|
411
|
+
return list;
|
412
|
+
}
|
413
|
+
|
414
|
+
function getOppositePlacement(placement) {
|
415
|
+
return placement.replace(/left|right|bottom|top/g, (side => oppositeSideMap[side]));
|
416
|
+
}
|
417
|
+
|
418
|
+
function expandPaddingObject(padding) {
|
419
|
+
return _extends({
|
420
|
+
top: 0,
|
421
|
+
right: 0,
|
422
|
+
bottom: 0,
|
423
|
+
left: 0
|
424
|
+
}, padding);
|
425
|
+
}
|
426
|
+
|
427
|
+
function getPaddingObject(padding) {
|
428
|
+
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
429
|
+
top: padding,
|
430
|
+
right: padding,
|
431
|
+
bottom: padding,
|
432
|
+
left: padding
|
433
|
+
};
|
434
|
+
}
|
435
|
+
|
436
|
+
function rectToClientRect(rect) {
|
437
|
+
return _extends({}, rect, {
|
438
|
+
top: rect.y,
|
439
|
+
left: rect.x,
|
440
|
+
right: rect.x + rect.width,
|
441
|
+
bottom: rect.y + rect.height
|
442
|
+
});
|
443
|
+
}
|
444
|
+
|
445
|
+
const _excluded2 = [ "mainAxis", "crossAxis", "fallbackPlacements", "fallbackStrategy", "fallbackAxisSideDirection", "flipAlignment" ], _excluded4 = [ "mainAxis", "crossAxis", "limiter" ];
|
446
|
+
|
447
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
448
|
+
let {reference: reference, floating: floating} = _ref;
|
449
|
+
const sideAxis = getSideAxis(placement);
|
450
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
451
|
+
const alignLength = getAxisLength(alignmentAxis);
|
452
|
+
const side = getSide(placement);
|
453
|
+
const isVertical = sideAxis === "y";
|
454
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
455
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
456
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
457
|
+
let coords;
|
458
|
+
switch (side) {
|
459
|
+
case "top":
|
460
|
+
coords = {
|
461
|
+
x: commonX,
|
462
|
+
y: reference.y - floating.height
|
463
|
+
};
|
464
|
+
break;
|
465
|
+
|
466
|
+
case "bottom":
|
467
|
+
coords = {
|
468
|
+
x: commonX,
|
469
|
+
y: reference.y + reference.height
|
470
|
+
};
|
471
|
+
break;
|
472
|
+
|
473
|
+
case "right":
|
474
|
+
coords = {
|
475
|
+
x: reference.x + reference.width,
|
476
|
+
y: commonY
|
477
|
+
};
|
478
|
+
break;
|
479
|
+
|
480
|
+
case "left":
|
481
|
+
coords = {
|
482
|
+
x: reference.x - floating.width,
|
483
|
+
y: commonY
|
484
|
+
};
|
485
|
+
break;
|
486
|
+
|
487
|
+
default:
|
488
|
+
coords = {
|
489
|
+
x: reference.x,
|
490
|
+
y: reference.y
|
491
|
+
};
|
492
|
+
}
|
493
|
+
switch (getAlignment(placement)) {
|
494
|
+
case "start":
|
495
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
496
|
+
break;
|
497
|
+
|
498
|
+
case "end":
|
499
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
500
|
+
break;
|
501
|
+
}
|
502
|
+
return coords;
|
503
|
+
}
|
504
|
+
|
505
|
+
const computePosition$1 = async (reference, floating, config) => {
|
506
|
+
const {placement: placement = "bottom", strategy: strategy = "absolute", middleware: middleware = [], platform: platform} = config;
|
507
|
+
const validMiddleware = middleware.filter(Boolean);
|
508
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
509
|
+
let rects = await platform.getElementRects({
|
510
|
+
reference: reference,
|
511
|
+
floating: floating,
|
512
|
+
strategy: strategy
|
513
|
+
});
|
514
|
+
let {x: x, y: y} = computeCoordsFromPlacement(rects, placement, rtl);
|
515
|
+
let statefulPlacement = placement;
|
516
|
+
let middlewareData = {};
|
517
|
+
let resetCount = 0;
|
518
|
+
for (let i = 0; i < validMiddleware.length; i++) {
|
519
|
+
const {name: name, fn: fn} = validMiddleware[i];
|
520
|
+
const {x: nextX, y: nextY, data: data, reset: reset} = await fn({
|
521
|
+
x: x,
|
522
|
+
y: y,
|
523
|
+
initialPlacement: placement,
|
524
|
+
placement: statefulPlacement,
|
525
|
+
strategy: strategy,
|
526
|
+
middlewareData: middlewareData,
|
527
|
+
rects: rects,
|
528
|
+
platform: platform,
|
529
|
+
elements: {
|
530
|
+
reference: reference,
|
531
|
+
floating: floating
|
532
|
+
}
|
533
|
+
});
|
534
|
+
x = nextX != null ? nextX : x;
|
535
|
+
y = nextY != null ? nextY : y;
|
536
|
+
middlewareData = _extends({}, middlewareData, {
|
537
|
+
[name]: _extends({}, middlewareData[name], data)
|
538
|
+
});
|
539
|
+
if (reset && resetCount <= 50) {
|
540
|
+
resetCount++;
|
541
|
+
if (typeof reset === "object") {
|
542
|
+
if (reset.placement) {
|
543
|
+
statefulPlacement = reset.placement;
|
544
|
+
}
|
545
|
+
if (reset.rects) {
|
546
|
+
rects = reset.rects === true ? await platform.getElementRects({
|
547
|
+
reference: reference,
|
548
|
+
floating: floating,
|
549
|
+
strategy: strategy
|
550
|
+
}) : reset.rects;
|
551
|
+
}
|
552
|
+
({x: x, y: y} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
553
|
+
}
|
554
|
+
i = -1;
|
555
|
+
continue;
|
556
|
+
}
|
557
|
+
}
|
558
|
+
return {
|
559
|
+
x: x,
|
560
|
+
y: y,
|
561
|
+
placement: statefulPlacement,
|
562
|
+
strategy: strategy,
|
563
|
+
middlewareData: middlewareData
|
564
|
+
};
|
565
|
+
};
|
566
|
+
|
567
|
+
async function detectOverflow(state, options) {
|
568
|
+
var _await$platform$isEle;
|
569
|
+
if (options === void 0) {
|
570
|
+
options = {};
|
571
|
+
}
|
572
|
+
const {x: x, y: y, platform: platform, rects: rects, elements: elements, strategy: strategy} = state;
|
573
|
+
const {boundary: boundary = "clippingAncestors", rootBoundary: rootBoundary = "viewport", elementContext: elementContext = "floating", altBoundary: altBoundary = false, padding: padding = 0} = evaluate(options, state);
|
574
|
+
const paddingObject = getPaddingObject(padding);
|
575
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
576
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
577
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
578
|
+
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating)),
|
579
|
+
boundary: boundary,
|
580
|
+
rootBoundary: rootBoundary,
|
581
|
+
strategy: strategy
|
582
|
+
}));
|
583
|
+
const rect = elementContext === "floating" ? _extends({}, rects.floating, {
|
584
|
+
x: x,
|
585
|
+
y: y
|
586
|
+
}) : rects.reference;
|
587
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
588
|
+
const offsetScale = await (platform.isElement == null ? void 0 : platform.isElement(offsetParent)) ? await (platform.getScale == null ? void 0 : platform.getScale(offsetParent)) || {
|
589
|
+
x: 1,
|
590
|
+
y: 1
|
591
|
+
} : {
|
592
|
+
x: 1,
|
593
|
+
y: 1
|
594
|
+
};
|
595
|
+
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
596
|
+
rect: rect,
|
597
|
+
offsetParent: offsetParent,
|
598
|
+
strategy: strategy
|
599
|
+
}) : rect);
|
600
|
+
return {
|
601
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
602
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
603
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
604
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
605
|
+
};
|
606
|
+
}
|
607
|
+
|
608
|
+
const arrow = options => ({
|
609
|
+
name: "arrow",
|
610
|
+
options: options,
|
611
|
+
async fn(state) {
|
612
|
+
const {x: x, y: y, placement: placement, rects: rects, platform: platform, elements: elements} = state;
|
613
|
+
const {element: element, padding: padding = 0} = evaluate(options, state) || {};
|
614
|
+
if (element == null) {
|
615
|
+
return {};
|
616
|
+
}
|
617
|
+
const paddingObject = getPaddingObject(padding);
|
618
|
+
const coords = {
|
619
|
+
x: x,
|
620
|
+
y: y
|
621
|
+
};
|
622
|
+
const axis = getAlignmentAxis(placement);
|
623
|
+
const length = getAxisLength(axis);
|
624
|
+
const arrowDimensions = await platform.getDimensions(element);
|
625
|
+
const isYAxis = axis === "y";
|
626
|
+
const minProp = isYAxis ? "top" : "left";
|
627
|
+
const maxProp = isYAxis ? "bottom" : "right";
|
628
|
+
const clientProp = isYAxis ? "clientHeight" : "clientWidth";
|
629
|
+
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
630
|
+
const startDiff = coords[axis] - rects.reference[axis];
|
631
|
+
const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
|
632
|
+
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
|
633
|
+
if (!clientSize || !await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent))) {
|
634
|
+
clientSize = elements.floating[clientProp] || rects.floating[length];
|
635
|
+
}
|
636
|
+
const centerToReference = endDiff / 2 - startDiff / 2;
|
637
|
+
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
638
|
+
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
|
639
|
+
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
|
640
|
+
const min$1 = minPadding;
|
641
|
+
const max = clientSize - arrowDimensions[length] - maxPadding;
|
642
|
+
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
643
|
+
const offset = clamp(min$1, center, max);
|
644
|
+
const shouldAddOffset = getAlignment(placement) != null && center != offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
645
|
+
const alignmentOffset = shouldAddOffset ? center < min$1 ? min$1 - center : max - center : 0;
|
646
|
+
return {
|
647
|
+
[axis]: coords[axis] - alignmentOffset,
|
648
|
+
data: {
|
649
|
+
[axis]: offset,
|
650
|
+
centerOffset: center - offset + alignmentOffset
|
651
|
+
}
|
652
|
+
};
|
653
|
+
}
|
654
|
+
});
|
655
|
+
|
656
|
+
const flip = function flip(options) {
|
657
|
+
if (options === void 0) {
|
658
|
+
options = {};
|
659
|
+
}
|
660
|
+
return {
|
661
|
+
name: "flip",
|
662
|
+
options: options,
|
663
|
+
async fn(state) {
|
664
|
+
var _middlewareData$flip;
|
665
|
+
const {placement: placement, middlewareData: middlewareData, rects: rects, initialPlacement: initialPlacement, platform: platform, elements: elements} = state;
|
666
|
+
const _evaluate2 = evaluate(options, state), {mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true, fallbackPlacements: specifiedFallbackPlacements, fallbackStrategy: fallbackStrategy = "bestFit", fallbackAxisSideDirection: fallbackAxisSideDirection = "none", flipAlignment: flipAlignment = true} = _evaluate2, detectOverflowOptions = _objectWithoutPropertiesLoose(_evaluate2, _excluded2);
|
667
|
+
const side = getSide(placement);
|
668
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
669
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
670
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [ getOppositePlacement(initialPlacement) ] : getExpandedPlacements(initialPlacement));
|
671
|
+
if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== "none") {
|
672
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
673
|
+
}
|
674
|
+
const placements = [ initialPlacement, ...fallbackPlacements ];
|
675
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
676
|
+
const overflows = [];
|
677
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
678
|
+
if (checkMainAxis) {
|
679
|
+
overflows.push(overflow[side]);
|
680
|
+
}
|
681
|
+
if (checkCrossAxis) {
|
682
|
+
const sides = getAlignmentSides(placement, rects, rtl);
|
683
|
+
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
684
|
+
}
|
685
|
+
overflowsData = [ ...overflowsData, {
|
686
|
+
placement: placement,
|
687
|
+
overflows: overflows
|
688
|
+
} ];
|
689
|
+
if (!overflows.every((side => side <= 0))) {
|
690
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
691
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
692
|
+
const nextPlacement = placements[nextIndex];
|
693
|
+
if (nextPlacement) {
|
694
|
+
return {
|
695
|
+
data: {
|
696
|
+
index: nextIndex,
|
697
|
+
overflows: overflowsData
|
698
|
+
},
|
699
|
+
reset: {
|
700
|
+
placement: nextPlacement
|
701
|
+
}
|
702
|
+
};
|
703
|
+
}
|
704
|
+
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d => d.overflows[0] <= 0)).sort(((a, b) => a.overflows[1] - b.overflows[1]))[0]) == null ? void 0 : _overflowsData$filter.placement;
|
705
|
+
if (!resetPlacement) {
|
706
|
+
switch (fallbackStrategy) {
|
707
|
+
case "bestFit":
|
708
|
+
{
|
709
|
+
var _overflowsData$map$so;
|
710
|
+
const placement = (_overflowsData$map$so = overflowsData.map((d => [ d.placement, d.overflows.filter((overflow => overflow > 0)).reduce(((acc, overflow) => acc + overflow), 0) ])).sort(((a, b) => a[1] - b[1]))[0]) == null ? void 0 : _overflowsData$map$so[0];
|
711
|
+
if (placement) {
|
712
|
+
resetPlacement = placement;
|
713
|
+
}
|
714
|
+
break;
|
715
|
+
}
|
716
|
+
|
717
|
+
case "initialPlacement":
|
718
|
+
resetPlacement = initialPlacement;
|
719
|
+
break;
|
720
|
+
}
|
721
|
+
}
|
722
|
+
if (placement !== resetPlacement) {
|
723
|
+
return {
|
724
|
+
reset: {
|
725
|
+
placement: resetPlacement
|
726
|
+
}
|
727
|
+
};
|
728
|
+
}
|
729
|
+
}
|
730
|
+
return {};
|
731
|
+
}
|
732
|
+
};
|
733
|
+
};
|
734
|
+
|
735
|
+
const shift = function shift(options) {
|
736
|
+
if (options === void 0) {
|
737
|
+
options = {};
|
738
|
+
}
|
739
|
+
return {
|
740
|
+
name: "shift",
|
741
|
+
options: options,
|
742
|
+
async fn(state) {
|
743
|
+
const {x: x, y: y, placement: placement} = state;
|
744
|
+
const _evaluate4 = evaluate(options, state), {mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = false, limiter: limiter = {
|
745
|
+
fn: _ref => {
|
746
|
+
let {x: x, y: y} = _ref;
|
747
|
+
return {
|
748
|
+
x: x,
|
749
|
+
y: y
|
750
|
+
};
|
751
|
+
}
|
752
|
+
}} = _evaluate4, detectOverflowOptions = _objectWithoutPropertiesLoose(_evaluate4, _excluded4);
|
753
|
+
const coords = {
|
754
|
+
x: x,
|
755
|
+
y: y
|
756
|
+
};
|
757
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
758
|
+
const crossAxis = getSideAxis(getSide(placement));
|
759
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
760
|
+
let mainAxisCoord = coords[mainAxis];
|
761
|
+
let crossAxisCoord = coords[crossAxis];
|
762
|
+
if (checkMainAxis) {
|
763
|
+
const minSide = mainAxis === "y" ? "top" : "left";
|
764
|
+
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
765
|
+
const min = mainAxisCoord + overflow[minSide];
|
766
|
+
const max = mainAxisCoord - overflow[maxSide];
|
767
|
+
mainAxisCoord = clamp(min, mainAxisCoord, max);
|
768
|
+
}
|
769
|
+
if (checkCrossAxis) {
|
770
|
+
const minSide = crossAxis === "y" ? "top" : "left";
|
771
|
+
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
772
|
+
const min = crossAxisCoord + overflow[minSide];
|
773
|
+
const max = crossAxisCoord - overflow[maxSide];
|
774
|
+
crossAxisCoord = clamp(min, crossAxisCoord, max);
|
775
|
+
}
|
776
|
+
const limitedCoords = limiter.fn(_extends({}, state, {
|
777
|
+
[mainAxis]: mainAxisCoord,
|
778
|
+
[crossAxis]: crossAxisCoord
|
779
|
+
}));
|
780
|
+
return _extends({}, limitedCoords, {
|
781
|
+
data: {
|
782
|
+
x: limitedCoords.x - x,
|
783
|
+
y: limitedCoords.y - y
|
784
|
+
}
|
785
|
+
});
|
786
|
+
}
|
787
|
+
};
|
788
|
+
};
|
789
|
+
|
790
|
+
const limitShift = function limitShift(options) {
|
791
|
+
if (options === void 0) {
|
792
|
+
options = {};
|
793
|
+
}
|
794
|
+
return {
|
795
|
+
options: options,
|
796
|
+
fn(state) {
|
797
|
+
const {x: x, y: y, placement: placement, rects: rects, middlewareData: middlewareData} = state;
|
798
|
+
const {offset: offset = 0, mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true} = evaluate(options, state);
|
799
|
+
const coords = {
|
800
|
+
x: x,
|
801
|
+
y: y
|
802
|
+
};
|
803
|
+
const crossAxis = getSideAxis(placement);
|
804
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
805
|
+
let mainAxisCoord = coords[mainAxis];
|
806
|
+
let crossAxisCoord = coords[crossAxis];
|
807
|
+
const rawOffset = evaluate(offset, state);
|
808
|
+
const computedOffset = typeof rawOffset === "number" ? {
|
809
|
+
mainAxis: rawOffset,
|
810
|
+
crossAxis: 0
|
811
|
+
} : _extends({
|
812
|
+
mainAxis: 0,
|
813
|
+
crossAxis: 0
|
814
|
+
}, rawOffset);
|
815
|
+
if (checkMainAxis) {
|
816
|
+
const len = mainAxis === "y" ? "height" : "width";
|
817
|
+
const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
|
818
|
+
const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
|
819
|
+
if (mainAxisCoord < limitMin) {
|
820
|
+
mainAxisCoord = limitMin;
|
821
|
+
} else if (mainAxisCoord > limitMax) {
|
822
|
+
mainAxisCoord = limitMax;
|
823
|
+
}
|
824
|
+
}
|
825
|
+
if (checkCrossAxis) {
|
826
|
+
var _middlewareData$offse, _middlewareData$offse2;
|
827
|
+
const len = mainAxis === "y" ? "width" : "height";
|
828
|
+
const isOriginSide = [ "top", "left" ].includes(getSide(placement));
|
829
|
+
const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
|
830
|
+
const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
|
831
|
+
if (crossAxisCoord < limitMin) {
|
832
|
+
crossAxisCoord = limitMin;
|
833
|
+
} else if (crossAxisCoord > limitMax) {
|
834
|
+
crossAxisCoord = limitMax;
|
835
|
+
}
|
836
|
+
}
|
837
|
+
return {
|
838
|
+
[mainAxis]: mainAxisCoord,
|
839
|
+
[crossAxis]: crossAxisCoord
|
840
|
+
};
|
841
|
+
}
|
842
|
+
};
|
843
|
+
};
|
844
|
+
|
845
|
+
function getNodeName(node) {
|
846
|
+
if (isNode(node)) {
|
847
|
+
return (node.nodeName || "").toLowerCase();
|
848
|
+
}
|
849
|
+
return "#document";
|
850
|
+
}
|
851
|
+
|
852
|
+
function getWindow(node) {
|
853
|
+
var _node$ownerDocument;
|
854
|
+
return (node == null ? void 0 : (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
855
|
+
}
|
856
|
+
|
857
|
+
function getDocumentElement(node) {
|
858
|
+
var _ref;
|
859
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
860
|
+
}
|
861
|
+
|
862
|
+
function isNode(value) {
|
863
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
864
|
+
}
|
865
|
+
|
866
|
+
function isElement(value) {
|
867
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
868
|
+
}
|
869
|
+
|
870
|
+
function isHTMLElement(value) {
|
871
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
872
|
+
}
|
873
|
+
|
874
|
+
function isShadowRoot(value) {
|
875
|
+
if (typeof ShadowRoot === "undefined") {
|
876
|
+
return false;
|
877
|
+
}
|
878
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
879
|
+
}
|
880
|
+
|
881
|
+
function isOverflowElement(element) {
|
882
|
+
const {overflow: overflow, overflowX: overflowX, overflowY: overflowY, display: display} = getComputedStyle(element);
|
883
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && ![ "inline", "contents" ].includes(display);
|
884
|
+
}
|
885
|
+
|
886
|
+
function isTableElement(element) {
|
887
|
+
return [ "table", "td", "th" ].includes(getNodeName(element));
|
888
|
+
}
|
889
|
+
|
890
|
+
function isContainingBlock(element) {
|
891
|
+
const webkit = isWebKit();
|
892
|
+
const css = getComputedStyle(element);
|
893
|
+
return css.transform !== "none" || css.perspective !== "none" || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || [ "transform", "perspective", "filter" ].some((value => (css.willChange || "").includes(value))) || [ "paint", "layout", "strict", "content" ].some((value => (css.contain || "").includes(value)));
|
894
|
+
}
|
895
|
+
|
896
|
+
function getContainingBlock(element) {
|
897
|
+
let currentNode = getParentNode(element);
|
898
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
899
|
+
if (isContainingBlock(currentNode)) {
|
900
|
+
return currentNode;
|
901
|
+
} else {
|
902
|
+
currentNode = getParentNode(currentNode);
|
903
|
+
}
|
904
|
+
}
|
905
|
+
return null;
|
906
|
+
}
|
907
|
+
|
908
|
+
function isWebKit() {
|
909
|
+
if (typeof CSS === "undefined" || !CSS.supports) return false;
|
910
|
+
return CSS.supports("-webkit-backdrop-filter", "none");
|
911
|
+
}
|
912
|
+
|
913
|
+
function isLastTraversableNode(node) {
|
914
|
+
return [ "html", "body", "#document" ].includes(getNodeName(node));
|
915
|
+
}
|
916
|
+
|
917
|
+
function getComputedStyle(element) {
|
918
|
+
return getWindow(element).getComputedStyle(element);
|
919
|
+
}
|
920
|
+
|
921
|
+
function getNodeScroll(element) {
|
922
|
+
if (isElement(element)) {
|
923
|
+
return {
|
924
|
+
scrollLeft: element.scrollLeft,
|
925
|
+
scrollTop: element.scrollTop
|
926
|
+
};
|
927
|
+
}
|
928
|
+
return {
|
929
|
+
scrollLeft: element.pageXOffset,
|
930
|
+
scrollTop: element.pageYOffset
|
931
|
+
};
|
932
|
+
}
|
933
|
+
|
934
|
+
function getParentNode(node) {
|
935
|
+
if (getNodeName(node) === "html") {
|
936
|
+
return node;
|
937
|
+
}
|
938
|
+
const result = node.assignedSlot || node.parentNode || isShadowRoot(node) && node.host || getDocumentElement(node);
|
939
|
+
return isShadowRoot(result) ? result.host : result;
|
940
|
+
}
|
941
|
+
|
942
|
+
function getNearestOverflowAncestor(node) {
|
943
|
+
const parentNode = getParentNode(node);
|
944
|
+
if (isLastTraversableNode(parentNode)) {
|
945
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
946
|
+
}
|
947
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
948
|
+
return parentNode;
|
949
|
+
}
|
950
|
+
return getNearestOverflowAncestor(parentNode);
|
951
|
+
}
|
952
|
+
|
953
|
+
function getOverflowAncestors(node, list) {
|
954
|
+
var _node$ownerDocument2;
|
955
|
+
if (list === void 0) {
|
956
|
+
list = [];
|
957
|
+
}
|
958
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
959
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
960
|
+
const win = getWindow(scrollableAncestor);
|
961
|
+
if (isBody) {
|
962
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []);
|
963
|
+
}
|
964
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor));
|
965
|
+
}
|
966
|
+
|
967
|
+
function getCssDimensions(element) {
|
968
|
+
const css = getComputedStyle(element);
|
969
|
+
let width = parseFloat(css.width) || 0;
|
970
|
+
let height = parseFloat(css.height) || 0;
|
971
|
+
const hasOffset = isHTMLElement(element);
|
972
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
973
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
974
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
975
|
+
if (shouldFallback) {
|
976
|
+
width = offsetWidth;
|
977
|
+
height = offsetHeight;
|
978
|
+
}
|
979
|
+
return {
|
980
|
+
width: width,
|
981
|
+
height: height,
|
982
|
+
$: shouldFallback
|
983
|
+
};
|
984
|
+
}
|
985
|
+
|
986
|
+
function unwrapElement(element) {
|
987
|
+
return !isElement(element) ? element.contextElement : element;
|
988
|
+
}
|
989
|
+
|
990
|
+
function getScale(element) {
|
991
|
+
const domElement = unwrapElement(element);
|
992
|
+
if (!isHTMLElement(domElement)) {
|
993
|
+
return createCoords(1);
|
994
|
+
}
|
995
|
+
const rect = domElement.getBoundingClientRect();
|
996
|
+
const {width: width, height: height, $: $} = getCssDimensions(domElement);
|
997
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
998
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
999
|
+
if (!x || !Number.isFinite(x)) {
|
1000
|
+
x = 1;
|
1001
|
+
}
|
1002
|
+
if (!y || !Number.isFinite(y)) {
|
1003
|
+
y = 1;
|
1004
|
+
}
|
1005
|
+
return {
|
1006
|
+
x: x,
|
1007
|
+
y: y
|
1008
|
+
};
|
1009
|
+
}
|
1010
|
+
|
1011
|
+
const noOffsets = createCoords(0);
|
1012
|
+
|
1013
|
+
function getVisualOffsets(element) {
|
1014
|
+
const win = getWindow(element);
|
1015
|
+
if (!isWebKit() || !win.visualViewport) {
|
1016
|
+
return noOffsets;
|
1017
|
+
}
|
1018
|
+
return {
|
1019
|
+
x: win.visualViewport.offsetLeft,
|
1020
|
+
y: win.visualViewport.offsetTop
|
1021
|
+
};
|
1022
|
+
}
|
1023
|
+
|
1024
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
1025
|
+
if (isFixed === void 0) {
|
1026
|
+
isFixed = false;
|
1027
|
+
}
|
1028
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
1029
|
+
return false;
|
1030
|
+
}
|
1031
|
+
return isFixed;
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
1035
|
+
if (includeScale === void 0) {
|
1036
|
+
includeScale = false;
|
1037
|
+
}
|
1038
|
+
if (isFixedStrategy === void 0) {
|
1039
|
+
isFixedStrategy = false;
|
1040
|
+
}
|
1041
|
+
const clientRect = element.getBoundingClientRect();
|
1042
|
+
const domElement = unwrapElement(element);
|
1043
|
+
let scale = createCoords(1);
|
1044
|
+
if (includeScale) {
|
1045
|
+
if (offsetParent) {
|
1046
|
+
if (isElement(offsetParent)) {
|
1047
|
+
scale = getScale(offsetParent);
|
1048
|
+
}
|
1049
|
+
} else {
|
1050
|
+
scale = getScale(element);
|
1051
|
+
}
|
1052
|
+
}
|
1053
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
1054
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
1055
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
1056
|
+
let width = clientRect.width / scale.x;
|
1057
|
+
let height = clientRect.height / scale.y;
|
1058
|
+
if (domElement) {
|
1059
|
+
const win = getWindow(domElement);
|
1060
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
1061
|
+
let currentIFrame = win.frameElement;
|
1062
|
+
while (currentIFrame && offsetParent && offsetWin !== win) {
|
1063
|
+
const iframeScale = getScale(currentIFrame);
|
1064
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
1065
|
+
const css = getComputedStyle(currentIFrame);
|
1066
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
1067
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
1068
|
+
x *= iframeScale.x;
|
1069
|
+
y *= iframeScale.y;
|
1070
|
+
width *= iframeScale.x;
|
1071
|
+
height *= iframeScale.y;
|
1072
|
+
x += left;
|
1073
|
+
y += top;
|
1074
|
+
currentIFrame = getWindow(currentIFrame).frameElement;
|
1075
|
+
}
|
1076
|
+
}
|
1077
|
+
return rectToClientRect({
|
1078
|
+
width: width,
|
1079
|
+
height: height,
|
1080
|
+
x: x,
|
1081
|
+
y: y
|
1082
|
+
});
|
1083
|
+
}
|
1084
|
+
|
1085
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
1086
|
+
let {rect: rect, offsetParent: offsetParent, strategy: strategy} = _ref;
|
1087
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
1088
|
+
const documentElement = getDocumentElement(offsetParent);
|
1089
|
+
if (offsetParent === documentElement) {
|
1090
|
+
return rect;
|
1091
|
+
}
|
1092
|
+
let scroll = {
|
1093
|
+
scrollLeft: 0,
|
1094
|
+
scrollTop: 0
|
1095
|
+
};
|
1096
|
+
let scale = createCoords(1);
|
1097
|
+
const offsets = createCoords(0);
|
1098
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== "fixed") {
|
1099
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
1100
|
+
scroll = getNodeScroll(offsetParent);
|
1101
|
+
}
|
1102
|
+
if (isHTMLElement(offsetParent)) {
|
1103
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
1104
|
+
scale = getScale(offsetParent);
|
1105
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
1106
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
1107
|
+
}
|
1108
|
+
}
|
1109
|
+
return {
|
1110
|
+
width: rect.width * scale.x,
|
1111
|
+
height: rect.height * scale.y,
|
1112
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
1113
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
1114
|
+
};
|
1115
|
+
}
|
1116
|
+
|
1117
|
+
function getClientRects(element) {
|
1118
|
+
return Array.from(element.getClientRects());
|
1119
|
+
}
|
1120
|
+
|
1121
|
+
function getWindowScrollBarX(element) {
|
1122
|
+
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
1123
|
+
}
|
1124
|
+
|
1125
|
+
function getDocumentRect(element) {
|
1126
|
+
const html = getDocumentElement(element);
|
1127
|
+
const scroll = getNodeScroll(element);
|
1128
|
+
const body = element.ownerDocument.body;
|
1129
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
1130
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
1131
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
1132
|
+
const y = -scroll.scrollTop;
|
1133
|
+
if (getComputedStyle(body).direction === "rtl") {
|
1134
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
1135
|
+
}
|
1136
|
+
return {
|
1137
|
+
width: width,
|
1138
|
+
height: height,
|
1139
|
+
x: x,
|
1140
|
+
y: y
|
1141
|
+
};
|
1142
|
+
}
|
1143
|
+
|
1144
|
+
function getViewportRect(element, strategy) {
|
1145
|
+
const win = getWindow(element);
|
1146
|
+
const html = getDocumentElement(element);
|
1147
|
+
const visualViewport = win.visualViewport;
|
1148
|
+
let width = html.clientWidth;
|
1149
|
+
let height = html.clientHeight;
|
1150
|
+
let x = 0;
|
1151
|
+
let y = 0;
|
1152
|
+
if (visualViewport) {
|
1153
|
+
width = visualViewport.width;
|
1154
|
+
height = visualViewport.height;
|
1155
|
+
const visualViewportBased = isWebKit();
|
1156
|
+
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
1157
|
+
x = visualViewport.offsetLeft;
|
1158
|
+
y = visualViewport.offsetTop;
|
1159
|
+
}
|
1160
|
+
}
|
1161
|
+
return {
|
1162
|
+
width: width,
|
1163
|
+
height: height,
|
1164
|
+
x: x,
|
1165
|
+
y: y
|
1166
|
+
};
|
1167
|
+
}
|
1168
|
+
|
1169
|
+
function getInnerBoundingClientRect(element, strategy) {
|
1170
|
+
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
1171
|
+
const top = clientRect.top + element.clientTop;
|
1172
|
+
const left = clientRect.left + element.clientLeft;
|
1173
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
1174
|
+
const width = element.clientWidth * scale.x;
|
1175
|
+
const height = element.clientHeight * scale.y;
|
1176
|
+
const x = left * scale.x;
|
1177
|
+
const y = top * scale.y;
|
1178
|
+
return {
|
1179
|
+
width: width,
|
1180
|
+
height: height,
|
1181
|
+
x: x,
|
1182
|
+
y: y
|
1183
|
+
};
|
1184
|
+
}
|
1185
|
+
|
1186
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
1187
|
+
let rect;
|
1188
|
+
if (clippingAncestor === "viewport") {
|
1189
|
+
rect = getViewportRect(element, strategy);
|
1190
|
+
} else if (clippingAncestor === "document") {
|
1191
|
+
rect = getDocumentRect(getDocumentElement(element));
|
1192
|
+
} else if (isElement(clippingAncestor)) {
|
1193
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
1194
|
+
} else {
|
1195
|
+
const visualOffsets = getVisualOffsets(element);
|
1196
|
+
rect = _extends({}, clippingAncestor, {
|
1197
|
+
x: clippingAncestor.x - visualOffsets.x,
|
1198
|
+
y: clippingAncestor.y - visualOffsets.y
|
1199
|
+
});
|
1200
|
+
}
|
1201
|
+
return rectToClientRect(rect);
|
1202
|
+
}
|
1203
|
+
|
1204
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
1205
|
+
const parentNode = getParentNode(element);
|
1206
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
1207
|
+
return false;
|
1208
|
+
}
|
1209
|
+
return getComputedStyle(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
1210
|
+
}
|
1211
|
+
|
1212
|
+
function getClippingElementAncestors(element, cache) {
|
1213
|
+
const cachedResult = cache.get(element);
|
1214
|
+
if (cachedResult) {
|
1215
|
+
return cachedResult;
|
1216
|
+
}
|
1217
|
+
let result = getOverflowAncestors(element).filter((el => isElement(el) && getNodeName(el) !== "body"));
|
1218
|
+
let currentContainingBlockComputedStyle = null;
|
1219
|
+
const elementIsFixed = getComputedStyle(element).position === "fixed";
|
1220
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
1221
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
1222
|
+
const computedStyle = getComputedStyle(currentNode);
|
1223
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
1224
|
+
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
1225
|
+
currentContainingBlockComputedStyle = null;
|
1226
|
+
}
|
1227
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && [ "absolute", "fixed" ].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
1228
|
+
if (shouldDropCurrentNode) {
|
1229
|
+
result = result.filter((ancestor => ancestor !== currentNode));
|
1230
|
+
} else {
|
1231
|
+
currentContainingBlockComputedStyle = computedStyle;
|
1232
|
+
}
|
1233
|
+
currentNode = getParentNode(currentNode);
|
1234
|
+
}
|
1235
|
+
cache.set(element, result);
|
1236
|
+
return result;
|
1237
|
+
}
|
1238
|
+
|
1239
|
+
function getClippingRect(_ref) {
|
1240
|
+
let {element: element, boundary: boundary, rootBoundary: rootBoundary, strategy: strategy} = _ref;
|
1241
|
+
const elementClippingAncestors = boundary === "clippingAncestors" ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
1242
|
+
const clippingAncestors = [ ...elementClippingAncestors, rootBoundary ];
|
1243
|
+
const firstClippingAncestor = clippingAncestors[0];
|
1244
|
+
const clippingRect = clippingAncestors.reduce(((accRect, clippingAncestor) => {
|
1245
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
1246
|
+
accRect.top = max(rect.top, accRect.top);
|
1247
|
+
accRect.right = min(rect.right, accRect.right);
|
1248
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
1249
|
+
accRect.left = max(rect.left, accRect.left);
|
1250
|
+
return accRect;
|
1251
|
+
}), getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
1252
|
+
return {
|
1253
|
+
width: clippingRect.right - clippingRect.left,
|
1254
|
+
height: clippingRect.bottom - clippingRect.top,
|
1255
|
+
x: clippingRect.left,
|
1256
|
+
y: clippingRect.top
|
1257
|
+
};
|
1258
|
+
}
|
1259
|
+
|
1260
|
+
function getDimensions(element) {
|
1261
|
+
return getCssDimensions(element);
|
1262
|
+
}
|
1263
|
+
|
1264
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
1265
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
1266
|
+
const documentElement = getDocumentElement(offsetParent);
|
1267
|
+
const isFixed = strategy === "fixed";
|
1268
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
1269
|
+
let scroll = {
|
1270
|
+
scrollLeft: 0,
|
1271
|
+
scrollTop: 0
|
1272
|
+
};
|
1273
|
+
const offsets = createCoords(0);
|
1274
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
1275
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
1276
|
+
scroll = getNodeScroll(offsetParent);
|
1277
|
+
}
|
1278
|
+
if (isOffsetParentAnElement) {
|
1279
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
1280
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
1281
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
1282
|
+
} else if (documentElement) {
|
1283
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
1284
|
+
}
|
1285
|
+
}
|
1286
|
+
return {
|
1287
|
+
x: rect.left + scroll.scrollLeft - offsets.x,
|
1288
|
+
y: rect.top + scroll.scrollTop - offsets.y,
|
1289
|
+
width: rect.width,
|
1290
|
+
height: rect.height
|
1291
|
+
};
|
1292
|
+
}
|
1293
|
+
|
1294
|
+
function getTrueOffsetParent(element, polyfill) {
|
1295
|
+
if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
|
1296
|
+
return null;
|
1297
|
+
}
|
1298
|
+
if (polyfill) {
|
1299
|
+
return polyfill(element);
|
1300
|
+
}
|
1301
|
+
return element.offsetParent;
|
1302
|
+
}
|
1303
|
+
|
1304
|
+
function getOffsetParent(element, polyfill) {
|
1305
|
+
const window = getWindow(element);
|
1306
|
+
if (!isHTMLElement(element)) {
|
1307
|
+
return window;
|
1308
|
+
}
|
1309
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
1310
|
+
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
|
1311
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
1312
|
+
}
|
1313
|
+
if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static" && !isContainingBlock(offsetParent))) {
|
1314
|
+
return window;
|
1315
|
+
}
|
1316
|
+
return offsetParent || getContainingBlock(element) || window;
|
1317
|
+
}
|
1318
|
+
|
1319
|
+
const getElementRects = async function getElementRects(_ref) {
|
1320
|
+
let {reference: reference, floating: floating, strategy: strategy} = _ref;
|
1321
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
1322
|
+
const getDimensionsFn = this.getDimensions;
|
1323
|
+
return {
|
1324
|
+
reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
|
1325
|
+
floating: _extends({
|
1326
|
+
x: 0,
|
1327
|
+
y: 0
|
1328
|
+
}, await getDimensionsFn(floating))
|
1329
|
+
};
|
1330
|
+
};
|
1331
|
+
|
1332
|
+
function isRTL(element) {
|
1333
|
+
return getComputedStyle(element).direction === "rtl";
|
1334
|
+
}
|
1335
|
+
|
1336
|
+
const platform = {
|
1337
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: convertOffsetParentRelativeRectToViewportRelativeRect,
|
1338
|
+
getDocumentElement: getDocumentElement,
|
1339
|
+
getClippingRect: getClippingRect,
|
1340
|
+
getOffsetParent: getOffsetParent,
|
1341
|
+
getElementRects: getElementRects,
|
1342
|
+
getClientRects: getClientRects,
|
1343
|
+
getDimensions: getDimensions,
|
1344
|
+
getScale: getScale,
|
1345
|
+
isElement: isElement,
|
1346
|
+
isRTL: isRTL
|
1347
|
+
};
|
1348
|
+
|
1349
|
+
function observeMove(element, onMove) {
|
1350
|
+
let io = null;
|
1351
|
+
let timeoutId;
|
1352
|
+
const root = getDocumentElement(element);
|
1353
|
+
function cleanup() {
|
1354
|
+
clearTimeout(timeoutId);
|
1355
|
+
io && io.disconnect();
|
1356
|
+
io = null;
|
1357
|
+
}
|
1358
|
+
function refresh(skip, threshold) {
|
1359
|
+
if (skip === void 0) {
|
1360
|
+
skip = false;
|
1361
|
+
}
|
1362
|
+
if (threshold === void 0) {
|
1363
|
+
threshold = 1;
|
1364
|
+
}
|
1365
|
+
cleanup();
|
1366
|
+
const {left: left, top: top, width: width, height: height} = element.getBoundingClientRect();
|
1367
|
+
if (!skip) {
|
1368
|
+
onMove();
|
1369
|
+
}
|
1370
|
+
if (!width || !height) {
|
1371
|
+
return;
|
1372
|
+
}
|
1373
|
+
const insetTop = floor(top);
|
1374
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
1375
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
1376
|
+
const insetLeft = floor(left);
|
1377
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
1378
|
+
const options = {
|
1379
|
+
rootMargin: rootMargin,
|
1380
|
+
threshold: max(0, min(1, threshold)) || 1
|
1381
|
+
};
|
1382
|
+
let isFirstUpdate = true;
|
1383
|
+
function handleObserve(entries) {
|
1384
|
+
const ratio = entries[0].intersectionRatio;
|
1385
|
+
if (ratio !== threshold) {
|
1386
|
+
if (!isFirstUpdate) {
|
1387
|
+
return refresh();
|
1388
|
+
}
|
1389
|
+
if (!ratio) {
|
1390
|
+
timeoutId = setTimeout((() => {
|
1391
|
+
refresh(false, 1e-7);
|
1392
|
+
}), 100);
|
1393
|
+
} else {
|
1394
|
+
refresh(false, ratio);
|
1395
|
+
}
|
1396
|
+
}
|
1397
|
+
isFirstUpdate = false;
|
1398
|
+
}
|
1399
|
+
try {
|
1400
|
+
io = new IntersectionObserver(handleObserve, _extends({}, options, {
|
1401
|
+
root: root.ownerDocument
|
1402
|
+
}));
|
1403
|
+
} catch (e) {
|
1404
|
+
io = new IntersectionObserver(handleObserve, options);
|
1405
|
+
}
|
1406
|
+
io.observe(element);
|
1407
|
+
}
|
1408
|
+
refresh(true);
|
1409
|
+
return cleanup;
|
1410
|
+
}
|
1411
|
+
|
1412
|
+
function autoUpdate(reference, floating, update, options) {
|
1413
|
+
if (options === void 0) {
|
1414
|
+
options = {};
|
1415
|
+
}
|
1416
|
+
const {ancestorScroll: ancestorScroll = true, ancestorResize: ancestorResize = true, elementResize: elementResize = typeof ResizeObserver === "function", layoutShift: layoutShift = typeof IntersectionObserver === "function", animationFrame: animationFrame = false} = options;
|
1417
|
+
const referenceEl = unwrapElement(reference);
|
1418
|
+
const ancestors = ancestorScroll || ancestorResize ? [ ...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating) ] : [];
|
1419
|
+
ancestors.forEach((ancestor => {
|
1420
|
+
ancestorScroll && ancestor.addEventListener("scroll", update, {
|
1421
|
+
passive: true
|
1422
|
+
});
|
1423
|
+
ancestorResize && ancestor.addEventListener("resize", update);
|
1424
|
+
}));
|
1425
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
1426
|
+
let reobserveFrame = -1;
|
1427
|
+
let resizeObserver = null;
|
1428
|
+
if (elementResize) {
|
1429
|
+
resizeObserver = new ResizeObserver((_ref => {
|
1430
|
+
let [firstEntry] = _ref;
|
1431
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
1432
|
+
resizeObserver.unobserve(floating);
|
1433
|
+
cancelAnimationFrame(reobserveFrame);
|
1434
|
+
reobserveFrame = requestAnimationFrame((() => {
|
1435
|
+
resizeObserver && resizeObserver.observe(floating);
|
1436
|
+
}));
|
1437
|
+
}
|
1438
|
+
update();
|
1439
|
+
}));
|
1440
|
+
if (referenceEl && !animationFrame) {
|
1441
|
+
resizeObserver.observe(referenceEl);
|
1442
|
+
}
|
1443
|
+
resizeObserver.observe(floating);
|
1444
|
+
}
|
1445
|
+
let frameId;
|
1446
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
1447
|
+
if (animationFrame) {
|
1448
|
+
frameLoop();
|
1449
|
+
}
|
1450
|
+
function frameLoop() {
|
1451
|
+
const nextRefRect = getBoundingClientRect(reference);
|
1452
|
+
if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
|
1453
|
+
update();
|
1454
|
+
}
|
1455
|
+
prevRefRect = nextRefRect;
|
1456
|
+
frameId = requestAnimationFrame(frameLoop);
|
1457
|
+
}
|
1458
|
+
update();
|
1459
|
+
return () => {
|
1460
|
+
ancestors.forEach((ancestor => {
|
1461
|
+
ancestorScroll && ancestor.removeEventListener("scroll", update);
|
1462
|
+
ancestorResize && ancestor.removeEventListener("resize", update);
|
1463
|
+
}));
|
1464
|
+
cleanupIo && cleanupIo();
|
1465
|
+
resizeObserver && resizeObserver.disconnect();
|
1466
|
+
resizeObserver = null;
|
1467
|
+
if (animationFrame) {
|
1468
|
+
cancelAnimationFrame(frameId);
|
1469
|
+
}
|
1470
|
+
};
|
1471
|
+
}
|
1472
|
+
|
1473
|
+
const computePosition = (reference, floating, options) => {
|
1474
|
+
const cache = new Map;
|
1475
|
+
const mergedOptions = _extends({
|
1476
|
+
platform: platform
|
1477
|
+
}, options);
|
1478
|
+
const platformWithCache = _extends({}, mergedOptions.platform, {
|
1479
|
+
_c: cache
|
1480
|
+
});
|
1481
|
+
return computePosition$1(reference, floating, _extends({}, mergedOptions, {
|
1482
|
+
platform: platformWithCache
|
1483
|
+
}));
|
1484
|
+
};
|
1485
|
+
|
1486
|
+
function setupTooltip(step) {
|
1487
|
+
if (step.cleanup) {
|
1488
|
+
step.cleanup();
|
1489
|
+
}
|
1490
|
+
const attachToOptions = step._getResolvedAttachToOptions();
|
1491
|
+
let target = attachToOptions.element;
|
1492
|
+
const floatingUIOptions = getFloatingUIOptions(attachToOptions, step);
|
1493
|
+
const shouldCenter = shouldCenterStep(attachToOptions);
|
1494
|
+
if (shouldCenter) {
|
1495
|
+
target = document.body;
|
1496
|
+
const content = step.shepherdElementComponent.getElement();
|
1497
|
+
content.classList.add("shepherd-centered");
|
1498
|
+
}
|
1499
|
+
step.cleanup = autoUpdate(target, step.el, (() => {
|
1500
|
+
if (!step.el) {
|
1501
|
+
step.cleanup();
|
1502
|
+
return;
|
1503
|
+
}
|
1504
|
+
setPosition(target, step, floatingUIOptions, shouldCenter);
|
1505
|
+
}));
|
1506
|
+
step.target = attachToOptions.element;
|
1507
|
+
return floatingUIOptions;
|
1508
|
+
}
|
1509
|
+
|
1510
|
+
function mergeTooltipConfig(tourOptions, options) {
|
1511
|
+
return {
|
1512
|
+
floatingUIOptions: cjs(tourOptions.floatingUIOptions || {}, options.floatingUIOptions || {})
|
1513
|
+
};
|
1514
|
+
}
|
1515
|
+
|
1516
|
+
function destroyTooltip(step) {
|
1517
|
+
if (step.cleanup) {
|
1518
|
+
step.cleanup();
|
1519
|
+
}
|
1520
|
+
step.cleanup = null;
|
1521
|
+
}
|
1522
|
+
|
1523
|
+
function setPosition(target, step, floatingUIOptions, shouldCenter) {
|
1524
|
+
return computePosition(target, step.el, floatingUIOptions).then(floatingUIposition(step, shouldCenter)).then((step => new Promise((resolve => {
|
1525
|
+
setTimeout((() => resolve(step)), 300);
|
1526
|
+
})))).then((step => {
|
1527
|
+
if (step && step.el) {
|
1528
|
+
step.el.focus({
|
1529
|
+
preventScroll: true
|
1530
|
+
});
|
1531
|
+
}
|
1532
|
+
}));
|
1533
|
+
}
|
1534
|
+
|
1535
|
+
function floatingUIposition(step, shouldCenter) {
|
1536
|
+
return ({x: x, y: y, placement: placement, middlewareData: middlewareData}) => {
|
1537
|
+
if (!step.el) {
|
1538
|
+
return step;
|
1539
|
+
}
|
1540
|
+
if (shouldCenter) {
|
1541
|
+
Object.assign(step.el.style, {
|
1542
|
+
position: "fixed",
|
1543
|
+
left: "50%",
|
1544
|
+
top: "50%",
|
1545
|
+
transform: "translate(-50%, -50%)"
|
1546
|
+
});
|
1547
|
+
} else {
|
1548
|
+
Object.assign(step.el.style, {
|
1549
|
+
position: "absolute",
|
1550
|
+
left: `${x}px`,
|
1551
|
+
top: `${y}px`
|
1552
|
+
});
|
1553
|
+
}
|
1554
|
+
step.el.dataset.popperPlacement = placement;
|
1555
|
+
placeArrow(step.el, middlewareData);
|
1556
|
+
return step;
|
1557
|
+
};
|
1558
|
+
}
|
1559
|
+
|
1560
|
+
function placeArrow(el, middlewareData) {
|
1561
|
+
const arrowEl = el.querySelector(".shepherd-arrow");
|
1562
|
+
if (arrowEl && middlewareData.arrow) {
|
1563
|
+
const {x: arrowX, y: arrowY} = middlewareData.arrow;
|
1564
|
+
Object.assign(arrowEl.style, {
|
1565
|
+
left: arrowX != null ? `${arrowX}px` : "",
|
1566
|
+
top: arrowY != null ? `${arrowY}px` : ""
|
1567
|
+
});
|
1568
|
+
}
|
1569
|
+
}
|
1570
|
+
|
1571
|
+
function getFloatingUIOptions(attachToOptions, step) {
|
1572
|
+
const options = {
|
1573
|
+
strategy: "absolute",
|
1574
|
+
middleware: []
|
1575
|
+
};
|
1576
|
+
const arrowEl = addArrow(step);
|
1577
|
+
const shouldCenter = shouldCenterStep(attachToOptions);
|
1578
|
+
if (!shouldCenter) {
|
1579
|
+
options.middleware.push(flip(), shift({
|
1580
|
+
limiter: limitShift(),
|
1581
|
+
crossAxis: true
|
1582
|
+
}));
|
1583
|
+
if (arrowEl) {
|
1584
|
+
options.middleware.push(arrow({
|
1585
|
+
element: arrowEl
|
1586
|
+
}));
|
1587
|
+
}
|
1588
|
+
options.placement = attachToOptions.on;
|
1589
|
+
}
|
1590
|
+
return cjs(step.options.floatingUIOptions || {}, options);
|
1591
|
+
}
|
1592
|
+
|
1593
|
+
function addArrow(step) {
|
1594
|
+
if (step.options.arrow && step.el) {
|
1595
|
+
return step.el.querySelector(".shepherd-arrow");
|
1596
|
+
}
|
1597
|
+
return false;
|
1598
|
+
}
|
1599
|
+
|
1600
|
+
function noop() {}
|
1601
|
+
|
1602
|
+
function assign(tar, src) {
|
1603
|
+
for (const k in src) tar[k] = src[k];
|
1604
|
+
return tar;
|
1605
|
+
}
|
1606
|
+
|
1607
|
+
function run(fn) {
|
1608
|
+
return fn();
|
1609
|
+
}
|
1610
|
+
|
1611
|
+
function blank_object() {
|
1612
|
+
return Object.create(null);
|
1613
|
+
}
|
1614
|
+
|
1615
|
+
function run_all(fns) {
|
1616
|
+
fns.forEach(run);
|
1617
|
+
}
|
1618
|
+
|
1619
|
+
function is_function(thing) {
|
1620
|
+
return typeof thing === "function";
|
1621
|
+
}
|
1622
|
+
|
1623
|
+
function safe_not_equal(a, b) {
|
1624
|
+
return a != a ? b == b : a !== b || a && typeof a === "object" || typeof a === "function";
|
1625
|
+
}
|
1626
|
+
|
1627
|
+
function is_empty(obj) {
|
1628
|
+
return Object.keys(obj).length === 0;
|
1629
|
+
}
|
1630
|
+
|
1631
|
+
function append(target, node) {
|
1632
|
+
target.appendChild(node);
|
1633
|
+
}
|
1634
|
+
|
1635
|
+
function insert(target, node, anchor) {
|
1636
|
+
target.insertBefore(node, anchor || null);
|
1637
|
+
}
|
1638
|
+
|
1639
|
+
function detach(node) {
|
1640
|
+
if (node.parentNode) {
|
1641
|
+
node.parentNode.removeChild(node);
|
1642
|
+
}
|
1643
|
+
}
|
1644
|
+
|
1645
|
+
function destroy_each(iterations, detaching) {
|
1646
|
+
for (let i = 0; i < iterations.length; i += 1) {
|
1647
|
+
if (iterations[i]) iterations[i].d(detaching);
|
1648
|
+
}
|
1649
|
+
}
|
1650
|
+
|
1651
|
+
function element(name) {
|
1652
|
+
return document.createElement(name);
|
1653
|
+
}
|
1654
|
+
|
1655
|
+
function svg_element(name) {
|
1656
|
+
return document.createElementNS("http://www.w3.org/2000/svg", name);
|
1657
|
+
}
|
1658
|
+
|
1659
|
+
function text(data) {
|
1660
|
+
return document.createTextNode(data);
|
1661
|
+
}
|
1662
|
+
|
1663
|
+
function space() {
|
1664
|
+
return text(" ");
|
1665
|
+
}
|
1666
|
+
|
1667
|
+
function empty() {
|
1668
|
+
return text("");
|
1669
|
+
}
|
1670
|
+
|
1671
|
+
function listen(node, event, handler, options) {
|
1672
|
+
node.addEventListener(event, handler, options);
|
1673
|
+
return () => node.removeEventListener(event, handler, options);
|
1674
|
+
}
|
1675
|
+
|
1676
|
+
function attr(node, attribute, value) {
|
1677
|
+
if (value == null) node.removeAttribute(attribute); else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value);
|
1678
|
+
}
|
1679
|
+
|
1680
|
+
const always_set_through_set_attribute = [ "width", "height" ];
|
1681
|
+
|
1682
|
+
function set_attributes(node, attributes) {
|
1683
|
+
const descriptors = Object.getOwnPropertyDescriptors(node.__proto__);
|
1684
|
+
for (const key in attributes) {
|
1685
|
+
if (attributes[key] == null) {
|
1686
|
+
node.removeAttribute(key);
|
1687
|
+
} else if (key === "style") {
|
1688
|
+
node.style.cssText = attributes[key];
|
1689
|
+
} else if (key === "__value") {
|
1690
|
+
node.value = node[key] = attributes[key];
|
1691
|
+
} else if (descriptors[key] && descriptors[key].set && always_set_through_set_attribute.indexOf(key) === -1) {
|
1692
|
+
node[key] = attributes[key];
|
1693
|
+
} else {
|
1694
|
+
attr(node, key, attributes[key]);
|
1695
|
+
}
|
1696
|
+
}
|
1697
|
+
}
|
1698
|
+
|
1699
|
+
function children(element) {
|
1700
|
+
return Array.from(element.childNodes);
|
1701
|
+
}
|
1702
|
+
|
1703
|
+
function toggle_class(element, name, toggle) {
|
1704
|
+
element.classList[toggle ? "add" : "remove"](name);
|
1705
|
+
}
|
1706
|
+
|
1707
|
+
let current_component;
|
1708
|
+
|
1709
|
+
function set_current_component(component) {
|
1710
|
+
current_component = component;
|
1711
|
+
}
|
1712
|
+
|
1713
|
+
function get_current_component() {
|
1714
|
+
if (!current_component) throw new Error("Function called outside component initialization");
|
1715
|
+
return current_component;
|
1716
|
+
}
|
1717
|
+
|
1718
|
+
function onMount(fn) {
|
1719
|
+
get_current_component().$$.on_mount.push(fn);
|
1720
|
+
}
|
1721
|
+
|
1722
|
+
function afterUpdate(fn) {
|
1723
|
+
get_current_component().$$.after_update.push(fn);
|
1724
|
+
}
|
1725
|
+
|
1726
|
+
const dirty_components = [];
|
1727
|
+
|
1728
|
+
const binding_callbacks = [];
|
1729
|
+
|
1730
|
+
let render_callbacks = [];
|
1731
|
+
|
1732
|
+
const flush_callbacks = [];
|
1733
|
+
|
1734
|
+
const resolved_promise = Promise.resolve();
|
1735
|
+
|
1736
|
+
let update_scheduled = false;
|
1737
|
+
|
1738
|
+
function schedule_update() {
|
1739
|
+
if (!update_scheduled) {
|
1740
|
+
update_scheduled = true;
|
1741
|
+
resolved_promise.then(flush);
|
1742
|
+
}
|
1743
|
+
}
|
1744
|
+
|
1745
|
+
function add_render_callback(fn) {
|
1746
|
+
render_callbacks.push(fn);
|
1747
|
+
}
|
1748
|
+
|
1749
|
+
const seen_callbacks = new Set;
|
1750
|
+
|
1751
|
+
let flushidx = 0;
|
1752
|
+
|
1753
|
+
function flush() {
|
1754
|
+
if (flushidx !== 0) {
|
1755
|
+
return;
|
1756
|
+
}
|
1757
|
+
const saved_component = current_component;
|
1758
|
+
do {
|
1759
|
+
try {
|
1760
|
+
while (flushidx < dirty_components.length) {
|
1761
|
+
const component = dirty_components[flushidx];
|
1762
|
+
flushidx++;
|
1763
|
+
set_current_component(component);
|
1764
|
+
update(component.$$);
|
1765
|
+
}
|
1766
|
+
} catch (e) {
|
1767
|
+
dirty_components.length = 0;
|
1768
|
+
flushidx = 0;
|
1769
|
+
throw e;
|
1770
|
+
}
|
1771
|
+
set_current_component(null);
|
1772
|
+
dirty_components.length = 0;
|
1773
|
+
flushidx = 0;
|
1774
|
+
while (binding_callbacks.length) binding_callbacks.pop()();
|
1775
|
+
for (let i = 0; i < render_callbacks.length; i += 1) {
|
1776
|
+
const callback = render_callbacks[i];
|
1777
|
+
if (!seen_callbacks.has(callback)) {
|
1778
|
+
seen_callbacks.add(callback);
|
1779
|
+
callback();
|
1780
|
+
}
|
1781
|
+
}
|
1782
|
+
render_callbacks.length = 0;
|
1783
|
+
} while (dirty_components.length);
|
1784
|
+
while (flush_callbacks.length) {
|
1785
|
+
flush_callbacks.pop()();
|
1786
|
+
}
|
1787
|
+
update_scheduled = false;
|
1788
|
+
seen_callbacks.clear();
|
1789
|
+
set_current_component(saved_component);
|
1790
|
+
}
|
1791
|
+
|
1792
|
+
function update($$) {
|
1793
|
+
if ($$.fragment !== null) {
|
1794
|
+
$$.update();
|
1795
|
+
run_all($$.before_update);
|
1796
|
+
const dirty = $$.dirty;
|
1797
|
+
$$.dirty = [ -1 ];
|
1798
|
+
$$.fragment && $$.fragment.p($$.ctx, dirty);
|
1799
|
+
$$.after_update.forEach(add_render_callback);
|
1800
|
+
}
|
1801
|
+
}
|
1802
|
+
|
1803
|
+
function flush_render_callbacks(fns) {
|
1804
|
+
const filtered = [];
|
1805
|
+
const targets = [];
|
1806
|
+
render_callbacks.forEach((c => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c)));
|
1807
|
+
targets.forEach((c => c()));
|
1808
|
+
render_callbacks = filtered;
|
1809
|
+
}
|
1810
|
+
|
1811
|
+
const outroing = new Set;
|
1812
|
+
|
1813
|
+
let outros;
|
1814
|
+
|
1815
|
+
function group_outros() {
|
1816
|
+
outros = {
|
1817
|
+
r: 0,
|
1818
|
+
c: [],
|
1819
|
+
p: outros
|
1820
|
+
};
|
1821
|
+
}
|
1822
|
+
|
1823
|
+
function check_outros() {
|
1824
|
+
if (!outros.r) {
|
1825
|
+
run_all(outros.c);
|
1826
|
+
}
|
1827
|
+
outros = outros.p;
|
1828
|
+
}
|
1829
|
+
|
1830
|
+
function transition_in(block, local) {
|
1831
|
+
if (block && block.i) {
|
1832
|
+
outroing.delete(block);
|
1833
|
+
block.i(local);
|
1834
|
+
}
|
1835
|
+
}
|
1836
|
+
|
1837
|
+
function transition_out(block, local, detach, callback) {
|
1838
|
+
if (block && block.o) {
|
1839
|
+
if (outroing.has(block)) return;
|
1840
|
+
outroing.add(block);
|
1841
|
+
outros.c.push((() => {
|
1842
|
+
outroing.delete(block);
|
1843
|
+
if (callback) {
|
1844
|
+
if (detach) block.d(1);
|
1845
|
+
callback();
|
1846
|
+
}
|
1847
|
+
}));
|
1848
|
+
block.o(local);
|
1849
|
+
} else if (callback) {
|
1850
|
+
callback();
|
1851
|
+
}
|
1852
|
+
}
|
1853
|
+
|
1854
|
+
function get_spread_update(levels, updates) {
|
1855
|
+
const update = {};
|
1856
|
+
const to_null_out = {};
|
1857
|
+
const accounted_for = {
|
1858
|
+
$$scope: 1
|
1859
|
+
};
|
1860
|
+
let i = levels.length;
|
1861
|
+
while (i--) {
|
1862
|
+
const o = levels[i];
|
1863
|
+
const n = updates[i];
|
1864
|
+
if (n) {
|
1865
|
+
for (const key in o) {
|
1866
|
+
if (!(key in n)) to_null_out[key] = 1;
|
1867
|
+
}
|
1868
|
+
for (const key in n) {
|
1869
|
+
if (!accounted_for[key]) {
|
1870
|
+
update[key] = n[key];
|
1871
|
+
accounted_for[key] = 1;
|
1872
|
+
}
|
1873
|
+
}
|
1874
|
+
levels[i] = n;
|
1875
|
+
} else {
|
1876
|
+
for (const key in o) {
|
1877
|
+
accounted_for[key] = 1;
|
1878
|
+
}
|
1879
|
+
}
|
1880
|
+
}
|
1881
|
+
for (const key in to_null_out) {
|
1882
|
+
if (!(key in update)) update[key] = undefined;
|
1883
|
+
}
|
1884
|
+
return update;
|
1885
|
+
}
|
1886
|
+
|
1887
|
+
function create_component(block) {
|
1888
|
+
block && block.c();
|
1889
|
+
}
|
1890
|
+
|
1891
|
+
function mount_component(component, target, anchor, customElement) {
|
1892
|
+
const {fragment: fragment, after_update: after_update} = component.$$;
|
1893
|
+
fragment && fragment.m(target, anchor);
|
1894
|
+
if (!customElement) {
|
1895
|
+
add_render_callback((() => {
|
1896
|
+
const new_on_destroy = component.$$.on_mount.map(run).filter(is_function);
|
1897
|
+
if (component.$$.on_destroy) {
|
1898
|
+
component.$$.on_destroy.push(...new_on_destroy);
|
1899
|
+
} else {
|
1900
|
+
run_all(new_on_destroy);
|
1901
|
+
}
|
1902
|
+
component.$$.on_mount = [];
|
1903
|
+
}));
|
1904
|
+
}
|
1905
|
+
after_update.forEach(add_render_callback);
|
1906
|
+
}
|
1907
|
+
|
1908
|
+
function destroy_component(component, detaching) {
|
1909
|
+
const $$ = component.$$;
|
1910
|
+
if ($$.fragment !== null) {
|
1911
|
+
flush_render_callbacks($$.after_update);
|
1912
|
+
run_all($$.on_destroy);
|
1913
|
+
$$.fragment && $$.fragment.d(detaching);
|
1914
|
+
$$.on_destroy = $$.fragment = null;
|
1915
|
+
$$.ctx = [];
|
1916
|
+
}
|
1917
|
+
}
|
1918
|
+
|
1919
|
+
function make_dirty(component, i) {
|
1920
|
+
if (component.$$.dirty[0] === -1) {
|
1921
|
+
dirty_components.push(component);
|
1922
|
+
schedule_update();
|
1923
|
+
component.$$.dirty.fill(0);
|
1924
|
+
}
|
1925
|
+
component.$$.dirty[i / 31 | 0] |= 1 << i % 31;
|
1926
|
+
}
|
1927
|
+
|
1928
|
+
function init(component, options, instance, create_fragment, not_equal, props, append_styles, dirty = [ -1 ]) {
|
1929
|
+
const parent_component = current_component;
|
1930
|
+
set_current_component(component);
|
1931
|
+
const $$ = component.$$ = {
|
1932
|
+
fragment: null,
|
1933
|
+
ctx: [],
|
1934
|
+
props: props,
|
1935
|
+
update: noop,
|
1936
|
+
not_equal: not_equal,
|
1937
|
+
bound: blank_object(),
|
1938
|
+
on_mount: [],
|
1939
|
+
on_destroy: [],
|
1940
|
+
on_disconnect: [],
|
1941
|
+
before_update: [],
|
1942
|
+
after_update: [],
|
1943
|
+
context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
|
1944
|
+
callbacks: blank_object(),
|
1945
|
+
dirty: dirty,
|
1946
|
+
skip_bound: false,
|
1947
|
+
root: options.target || parent_component.$$.root
|
1948
|
+
};
|
1949
|
+
append_styles && append_styles($$.root);
|
1950
|
+
let ready = false;
|
1951
|
+
$$.ctx = instance ? instance(component, options.props || {}, ((i, ret, ...rest) => {
|
1952
|
+
const value = rest.length ? rest[0] : ret;
|
1953
|
+
if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
|
1954
|
+
if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value);
|
1955
|
+
if (ready) make_dirty(component, i);
|
1956
|
+
}
|
1957
|
+
return ret;
|
1958
|
+
})) : [];
|
1959
|
+
$$.update();
|
1960
|
+
ready = true;
|
1961
|
+
run_all($$.before_update);
|
1962
|
+
$$.fragment = create_fragment ? create_fragment($$.ctx) : false;
|
1963
|
+
if (options.target) {
|
1964
|
+
if (options.hydrate) {
|
1965
|
+
const nodes = children(options.target);
|
1966
|
+
$$.fragment && $$.fragment.l(nodes);
|
1967
|
+
nodes.forEach(detach);
|
1968
|
+
} else {
|
1969
|
+
$$.fragment && $$.fragment.c();
|
1970
|
+
}
|
1971
|
+
if (options.intro) transition_in(component.$$.fragment);
|
1972
|
+
mount_component(component, options.target, options.anchor, options.customElement);
|
1973
|
+
flush();
|
1974
|
+
}
|
1975
|
+
set_current_component(parent_component);
|
1976
|
+
}
|
1977
|
+
|
1978
|
+
class SvelteComponent {
|
1979
|
+
$destroy() {
|
1980
|
+
destroy_component(this, 1);
|
1981
|
+
this.$destroy = noop;
|
1982
|
+
}
|
1983
|
+
$on(type, callback) {
|
1984
|
+
if (!is_function(callback)) {
|
1985
|
+
return noop;
|
1986
|
+
}
|
1987
|
+
const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
|
1988
|
+
callbacks.push(callback);
|
1989
|
+
return () => {
|
1990
|
+
const index = callbacks.indexOf(callback);
|
1991
|
+
if (index !== -1) callbacks.splice(index, 1);
|
1992
|
+
};
|
1993
|
+
}
|
1994
|
+
$set($$props) {
|
1995
|
+
if (this.$$set && !is_empty($$props)) {
|
1996
|
+
this.$$.skip_bound = true;
|
1997
|
+
this.$$set($$props);
|
1998
|
+
this.$$.skip_bound = false;
|
1999
|
+
}
|
2000
|
+
}
|
2001
|
+
}
|
2002
|
+
|
2003
|
+
function create_fragment$8(ctx) {
|
2004
|
+
let button;
|
2005
|
+
let button_aria_label_value;
|
2006
|
+
let button_class_value;
|
2007
|
+
let mounted;
|
2008
|
+
let dispose;
|
2009
|
+
return {
|
2010
|
+
c() {
|
2011
|
+
button = element("button");
|
2012
|
+
attr(button, "aria-label", button_aria_label_value = ctx[3] ? ctx[3] : null);
|
2013
|
+
attr(button, "class", button_class_value = `${ctx[1] || ""} shepherd-button ${ctx[4] ? "shepherd-button-secondary" : ""}`);
|
2014
|
+
button.disabled = ctx[2];
|
2015
|
+
attr(button, "tabindex", "0");
|
2016
|
+
},
|
2017
|
+
m(target, anchor) {
|
2018
|
+
insert(target, button, anchor);
|
2019
|
+
button.innerHTML = ctx[5];
|
2020
|
+
if (!mounted) {
|
2021
|
+
dispose = listen(button, "click", (function() {
|
2022
|
+
if (is_function(ctx[0])) ctx[0].apply(this, arguments);
|
2023
|
+
}));
|
2024
|
+
mounted = true;
|
2025
|
+
}
|
2026
|
+
},
|
2027
|
+
p(new_ctx, [dirty]) {
|
2028
|
+
ctx = new_ctx;
|
2029
|
+
if (dirty & 32) button.innerHTML = ctx[5];
|
2030
|
+
if (dirty & 8 && button_aria_label_value !== (button_aria_label_value = ctx[3] ? ctx[3] : null)) {
|
2031
|
+
attr(button, "aria-label", button_aria_label_value);
|
2032
|
+
}
|
2033
|
+
if (dirty & 18 && button_class_value !== (button_class_value = `${ctx[1] || ""} shepherd-button ${ctx[4] ? "shepherd-button-secondary" : ""}`)) {
|
2034
|
+
attr(button, "class", button_class_value);
|
2035
|
+
}
|
2036
|
+
if (dirty & 4) {
|
2037
|
+
button.disabled = ctx[2];
|
2038
|
+
}
|
2039
|
+
},
|
2040
|
+
i: noop,
|
2041
|
+
o: noop,
|
2042
|
+
d(detaching) {
|
2043
|
+
if (detaching) detach(button);
|
2044
|
+
mounted = false;
|
2045
|
+
dispose();
|
2046
|
+
}
|
2047
|
+
};
|
2048
|
+
}
|
2049
|
+
|
2050
|
+
function instance$8($$self, $$props, $$invalidate) {
|
2051
|
+
let {config: config, step: step} = $$props;
|
2052
|
+
let action, classes, disabled, label, secondary, text;
|
2053
|
+
function getConfigOption(option) {
|
2054
|
+
if (isFunction(option)) {
|
2055
|
+
return option = option.call(step);
|
2056
|
+
}
|
2057
|
+
return option;
|
2058
|
+
}
|
2059
|
+
$$self.$$set = $$props => {
|
2060
|
+
if ("config" in $$props) $$invalidate(6, config = $$props.config);
|
2061
|
+
if ("step" in $$props) $$invalidate(7, step = $$props.step);
|
2062
|
+
};
|
2063
|
+
$$self.$$.update = () => {
|
2064
|
+
if ($$self.$$.dirty & 192) {
|
2065
|
+
{
|
2066
|
+
$$invalidate(0, action = config.action ? config.action.bind(step.tour) : null);
|
2067
|
+
$$invalidate(1, classes = config.classes);
|
2068
|
+
$$invalidate(2, disabled = config.disabled ? getConfigOption(config.disabled) : false);
|
2069
|
+
$$invalidate(3, label = config.label ? getConfigOption(config.label) : null);
|
2070
|
+
$$invalidate(4, secondary = config.secondary);
|
2071
|
+
$$invalidate(5, text = config.text ? getConfigOption(config.text) : null);
|
2072
|
+
}
|
2073
|
+
}
|
2074
|
+
};
|
2075
|
+
return [ action, classes, disabled, label, secondary, text, config, step ];
|
2076
|
+
}
|
2077
|
+
|
2078
|
+
class Shepherd_button extends SvelteComponent {
|
2079
|
+
constructor(options) {
|
2080
|
+
super();
|
2081
|
+
init(this, options, instance$8, create_fragment$8, safe_not_equal, {
|
2082
|
+
config: 6,
|
2083
|
+
step: 7
|
2084
|
+
});
|
2085
|
+
}
|
2086
|
+
}
|
2087
|
+
|
2088
|
+
function get_each_context(ctx, list, i) {
|
2089
|
+
const child_ctx = ctx.slice();
|
2090
|
+
child_ctx[2] = list[i];
|
2091
|
+
return child_ctx;
|
2092
|
+
}
|
2093
|
+
|
2094
|
+
function create_if_block$3(ctx) {
|
2095
|
+
let each_1_anchor;
|
2096
|
+
let current;
|
2097
|
+
let each_value = ctx[1];
|
2098
|
+
let each_blocks = [];
|
2099
|
+
for (let i = 0; i < each_value.length; i += 1) {
|
2100
|
+
each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
|
2101
|
+
}
|
2102
|
+
const out = i => transition_out(each_blocks[i], 1, 1, (() => {
|
2103
|
+
each_blocks[i] = null;
|
2104
|
+
}));
|
2105
|
+
return {
|
2106
|
+
c() {
|
2107
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
2108
|
+
each_blocks[i].c();
|
2109
|
+
}
|
2110
|
+
each_1_anchor = empty();
|
2111
|
+
},
|
2112
|
+
m(target, anchor) {
|
2113
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
2114
|
+
if (each_blocks[i]) {
|
2115
|
+
each_blocks[i].m(target, anchor);
|
2116
|
+
}
|
2117
|
+
}
|
2118
|
+
insert(target, each_1_anchor, anchor);
|
2119
|
+
current = true;
|
2120
|
+
},
|
2121
|
+
p(ctx, dirty) {
|
2122
|
+
if (dirty & 3) {
|
2123
|
+
each_value = ctx[1];
|
2124
|
+
let i;
|
2125
|
+
for (i = 0; i < each_value.length; i += 1) {
|
2126
|
+
const child_ctx = get_each_context(ctx, each_value, i);
|
2127
|
+
if (each_blocks[i]) {
|
2128
|
+
each_blocks[i].p(child_ctx, dirty);
|
2129
|
+
transition_in(each_blocks[i], 1);
|
2130
|
+
} else {
|
2131
|
+
each_blocks[i] = create_each_block(child_ctx);
|
2132
|
+
each_blocks[i].c();
|
2133
|
+
transition_in(each_blocks[i], 1);
|
2134
|
+
each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
|
2135
|
+
}
|
2136
|
+
}
|
2137
|
+
group_outros();
|
2138
|
+
for (i = each_value.length; i < each_blocks.length; i += 1) {
|
2139
|
+
out(i);
|
2140
|
+
}
|
2141
|
+
check_outros();
|
2142
|
+
}
|
2143
|
+
},
|
2144
|
+
i(local) {
|
2145
|
+
if (current) return;
|
2146
|
+
for (let i = 0; i < each_value.length; i += 1) {
|
2147
|
+
transition_in(each_blocks[i]);
|
2148
|
+
}
|
2149
|
+
current = true;
|
2150
|
+
},
|
2151
|
+
o(local) {
|
2152
|
+
each_blocks = each_blocks.filter(Boolean);
|
2153
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
2154
|
+
transition_out(each_blocks[i]);
|
2155
|
+
}
|
2156
|
+
current = false;
|
2157
|
+
},
|
2158
|
+
d(detaching) {
|
2159
|
+
destroy_each(each_blocks, detaching);
|
2160
|
+
if (detaching) detach(each_1_anchor);
|
2161
|
+
}
|
2162
|
+
};
|
2163
|
+
}
|
2164
|
+
|
2165
|
+
function create_each_block(ctx) {
|
2166
|
+
let shepherdbutton;
|
2167
|
+
let current;
|
2168
|
+
shepherdbutton = new Shepherd_button({
|
2169
|
+
props: {
|
2170
|
+
config: ctx[2],
|
2171
|
+
step: ctx[0]
|
2172
|
+
}
|
2173
|
+
});
|
2174
|
+
return {
|
2175
|
+
c() {
|
2176
|
+
create_component(shepherdbutton.$$.fragment);
|
2177
|
+
},
|
2178
|
+
m(target, anchor) {
|
2179
|
+
mount_component(shepherdbutton, target, anchor);
|
2180
|
+
current = true;
|
2181
|
+
},
|
2182
|
+
p(ctx, dirty) {
|
2183
|
+
const shepherdbutton_changes = {};
|
2184
|
+
if (dirty & 2) shepherdbutton_changes.config = ctx[2];
|
2185
|
+
if (dirty & 1) shepherdbutton_changes.step = ctx[0];
|
2186
|
+
shepherdbutton.$set(shepherdbutton_changes);
|
2187
|
+
},
|
2188
|
+
i(local) {
|
2189
|
+
if (current) return;
|
2190
|
+
transition_in(shepherdbutton.$$.fragment, local);
|
2191
|
+
current = true;
|
2192
|
+
},
|
2193
|
+
o(local) {
|
2194
|
+
transition_out(shepherdbutton.$$.fragment, local);
|
2195
|
+
current = false;
|
2196
|
+
},
|
2197
|
+
d(detaching) {
|
2198
|
+
destroy_component(shepherdbutton, detaching);
|
2199
|
+
}
|
2200
|
+
};
|
2201
|
+
}
|
2202
|
+
|
2203
|
+
function create_fragment$7(ctx) {
|
2204
|
+
let footer;
|
2205
|
+
let current;
|
2206
|
+
let if_block = ctx[1] && create_if_block$3(ctx);
|
2207
|
+
return {
|
2208
|
+
c() {
|
2209
|
+
footer = element("footer");
|
2210
|
+
if (if_block) if_block.c();
|
2211
|
+
attr(footer, "class", "shepherd-footer");
|
2212
|
+
},
|
2213
|
+
m(target, anchor) {
|
2214
|
+
insert(target, footer, anchor);
|
2215
|
+
if (if_block) if_block.m(footer, null);
|
2216
|
+
current = true;
|
2217
|
+
},
|
2218
|
+
p(ctx, [dirty]) {
|
2219
|
+
if (ctx[1]) {
|
2220
|
+
if (if_block) {
|
2221
|
+
if_block.p(ctx, dirty);
|
2222
|
+
if (dirty & 2) {
|
2223
|
+
transition_in(if_block, 1);
|
2224
|
+
}
|
2225
|
+
} else {
|
2226
|
+
if_block = create_if_block$3(ctx);
|
2227
|
+
if_block.c();
|
2228
|
+
transition_in(if_block, 1);
|
2229
|
+
if_block.m(footer, null);
|
2230
|
+
}
|
2231
|
+
} else if (if_block) {
|
2232
|
+
group_outros();
|
2233
|
+
transition_out(if_block, 1, 1, (() => {
|
2234
|
+
if_block = null;
|
2235
|
+
}));
|
2236
|
+
check_outros();
|
2237
|
+
}
|
2238
|
+
},
|
2239
|
+
i(local) {
|
2240
|
+
if (current) return;
|
2241
|
+
transition_in(if_block);
|
2242
|
+
current = true;
|
2243
|
+
},
|
2244
|
+
o(local) {
|
2245
|
+
transition_out(if_block);
|
2246
|
+
current = false;
|
2247
|
+
},
|
2248
|
+
d(detaching) {
|
2249
|
+
if (detaching) detach(footer);
|
2250
|
+
if (if_block) if_block.d();
|
2251
|
+
}
|
2252
|
+
};
|
2253
|
+
}
|
2254
|
+
|
2255
|
+
function instance$7($$self, $$props, $$invalidate) {
|
2256
|
+
let buttons;
|
2257
|
+
let {step: step} = $$props;
|
2258
|
+
$$self.$$set = $$props => {
|
2259
|
+
if ("step" in $$props) $$invalidate(0, step = $$props.step);
|
2260
|
+
};
|
2261
|
+
$$self.$$.update = () => {
|
2262
|
+
if ($$self.$$.dirty & 1) {
|
2263
|
+
$$invalidate(1, buttons = step.options.buttons);
|
2264
|
+
}
|
2265
|
+
};
|
2266
|
+
return [ step, buttons ];
|
2267
|
+
}
|
2268
|
+
|
2269
|
+
class Shepherd_footer extends SvelteComponent {
|
2270
|
+
constructor(options) {
|
2271
|
+
super();
|
2272
|
+
init(this, options, instance$7, create_fragment$7, safe_not_equal, {
|
2273
|
+
step: 0
|
2274
|
+
});
|
2275
|
+
}
|
2276
|
+
}
|
2277
|
+
|
2278
|
+
function create_fragment$6(ctx) {
|
2279
|
+
let button;
|
2280
|
+
let span;
|
2281
|
+
let button_aria_label_value;
|
2282
|
+
let mounted;
|
2283
|
+
let dispose;
|
2284
|
+
return {
|
2285
|
+
c() {
|
2286
|
+
button = element("button");
|
2287
|
+
span = element("span");
|
2288
|
+
span.textContent = "×";
|
2289
|
+
attr(span, "aria-hidden", "true");
|
2290
|
+
attr(button, "aria-label", button_aria_label_value = ctx[0].label ? ctx[0].label : "Close Tour");
|
2291
|
+
attr(button, "class", "shepherd-cancel-icon");
|
2292
|
+
attr(button, "type", "button");
|
2293
|
+
},
|
2294
|
+
m(target, anchor) {
|
2295
|
+
insert(target, button, anchor);
|
2296
|
+
append(button, span);
|
2297
|
+
if (!mounted) {
|
2298
|
+
dispose = listen(button, "click", ctx[1]);
|
2299
|
+
mounted = true;
|
2300
|
+
}
|
2301
|
+
},
|
2302
|
+
p(ctx, [dirty]) {
|
2303
|
+
if (dirty & 1 && button_aria_label_value !== (button_aria_label_value = ctx[0].label ? ctx[0].label : "Close Tour")) {
|
2304
|
+
attr(button, "aria-label", button_aria_label_value);
|
2305
|
+
}
|
2306
|
+
},
|
2307
|
+
i: noop,
|
2308
|
+
o: noop,
|
2309
|
+
d(detaching) {
|
2310
|
+
if (detaching) detach(button);
|
2311
|
+
mounted = false;
|
2312
|
+
dispose();
|
2313
|
+
}
|
2314
|
+
};
|
2315
|
+
}
|
2316
|
+
|
2317
|
+
function instance$6($$self, $$props, $$invalidate) {
|
2318
|
+
let {cancelIcon: cancelIcon, step: step} = $$props;
|
2319
|
+
const handleCancelClick = e => {
|
2320
|
+
e.preventDefault();
|
2321
|
+
step.cancel();
|
2322
|
+
};
|
2323
|
+
$$self.$$set = $$props => {
|
2324
|
+
if ("cancelIcon" in $$props) $$invalidate(0, cancelIcon = $$props.cancelIcon);
|
2325
|
+
if ("step" in $$props) $$invalidate(2, step = $$props.step);
|
2326
|
+
};
|
2327
|
+
return [ cancelIcon, handleCancelClick, step ];
|
2328
|
+
}
|
2329
|
+
|
2330
|
+
class Shepherd_cancel_icon extends SvelteComponent {
|
2331
|
+
constructor(options) {
|
2332
|
+
super();
|
2333
|
+
init(this, options, instance$6, create_fragment$6, safe_not_equal, {
|
2334
|
+
cancelIcon: 0,
|
2335
|
+
step: 2
|
2336
|
+
});
|
2337
|
+
}
|
2338
|
+
}
|
2339
|
+
|
2340
|
+
function create_fragment$5(ctx) {
|
2341
|
+
let h3;
|
2342
|
+
return {
|
2343
|
+
c() {
|
2344
|
+
h3 = element("h3");
|
2345
|
+
attr(h3, "id", ctx[1]);
|
2346
|
+
attr(h3, "class", "shepherd-title");
|
2347
|
+
},
|
2348
|
+
m(target, anchor) {
|
2349
|
+
insert(target, h3, anchor);
|
2350
|
+
ctx[3](h3);
|
2351
|
+
},
|
2352
|
+
p(ctx, [dirty]) {
|
2353
|
+
if (dirty & 2) {
|
2354
|
+
attr(h3, "id", ctx[1]);
|
2355
|
+
}
|
2356
|
+
},
|
2357
|
+
i: noop,
|
2358
|
+
o: noop,
|
2359
|
+
d(detaching) {
|
2360
|
+
if (detaching) detach(h3);
|
2361
|
+
ctx[3](null);
|
2362
|
+
}
|
2363
|
+
};
|
2364
|
+
}
|
2365
|
+
|
2366
|
+
function instance$5($$self, $$props, $$invalidate) {
|
2367
|
+
let {labelId: labelId, element: element, title: title} = $$props;
|
2368
|
+
afterUpdate((() => {
|
2369
|
+
if (isFunction(title)) {
|
2370
|
+
$$invalidate(2, title = title());
|
2371
|
+
}
|
2372
|
+
$$invalidate(0, element.innerHTML = title, element);
|
2373
|
+
}));
|
2374
|
+
function h3_binding($$value) {
|
2375
|
+
binding_callbacks[$$value ? "unshift" : "push"]((() => {
|
2376
|
+
element = $$value;
|
2377
|
+
$$invalidate(0, element);
|
2378
|
+
}));
|
2379
|
+
}
|
2380
|
+
$$self.$$set = $$props => {
|
2381
|
+
if ("labelId" in $$props) $$invalidate(1, labelId = $$props.labelId);
|
2382
|
+
if ("element" in $$props) $$invalidate(0, element = $$props.element);
|
2383
|
+
if ("title" in $$props) $$invalidate(2, title = $$props.title);
|
2384
|
+
};
|
2385
|
+
return [ element, labelId, title, h3_binding ];
|
2386
|
+
}
|
2387
|
+
|
2388
|
+
class Shepherd_title extends SvelteComponent {
|
2389
|
+
constructor(options) {
|
2390
|
+
super();
|
2391
|
+
init(this, options, instance$5, create_fragment$5, safe_not_equal, {
|
2392
|
+
labelId: 1,
|
2393
|
+
element: 0,
|
2394
|
+
title: 2
|
2395
|
+
});
|
2396
|
+
}
|
2397
|
+
}
|
2398
|
+
|
2399
|
+
function create_if_block_1$1(ctx) {
|
2400
|
+
let shepherdtitle;
|
2401
|
+
let current;
|
2402
|
+
shepherdtitle = new Shepherd_title({
|
2403
|
+
props: {
|
2404
|
+
labelId: ctx[0],
|
2405
|
+
title: ctx[2]
|
2406
|
+
}
|
2407
|
+
});
|
2408
|
+
return {
|
2409
|
+
c() {
|
2410
|
+
create_component(shepherdtitle.$$.fragment);
|
2411
|
+
},
|
2412
|
+
m(target, anchor) {
|
2413
|
+
mount_component(shepherdtitle, target, anchor);
|
2414
|
+
current = true;
|
2415
|
+
},
|
2416
|
+
p(ctx, dirty) {
|
2417
|
+
const shepherdtitle_changes = {};
|
2418
|
+
if (dirty & 1) shepherdtitle_changes.labelId = ctx[0];
|
2419
|
+
if (dirty & 4) shepherdtitle_changes.title = ctx[2];
|
2420
|
+
shepherdtitle.$set(shepherdtitle_changes);
|
2421
|
+
},
|
2422
|
+
i(local) {
|
2423
|
+
if (current) return;
|
2424
|
+
transition_in(shepherdtitle.$$.fragment, local);
|
2425
|
+
current = true;
|
2426
|
+
},
|
2427
|
+
o(local) {
|
2428
|
+
transition_out(shepherdtitle.$$.fragment, local);
|
2429
|
+
current = false;
|
2430
|
+
},
|
2431
|
+
d(detaching) {
|
2432
|
+
destroy_component(shepherdtitle, detaching);
|
2433
|
+
}
|
2434
|
+
};
|
2435
|
+
}
|
2436
|
+
|
2437
|
+
function create_if_block$2(ctx) {
|
2438
|
+
let shepherdcancelicon;
|
2439
|
+
let current;
|
2440
|
+
shepherdcancelicon = new Shepherd_cancel_icon({
|
2441
|
+
props: {
|
2442
|
+
cancelIcon: ctx[3],
|
2443
|
+
step: ctx[1]
|
2444
|
+
}
|
2445
|
+
});
|
2446
|
+
return {
|
2447
|
+
c() {
|
2448
|
+
create_component(shepherdcancelicon.$$.fragment);
|
2449
|
+
},
|
2450
|
+
m(target, anchor) {
|
2451
|
+
mount_component(shepherdcancelicon, target, anchor);
|
2452
|
+
current = true;
|
2453
|
+
},
|
2454
|
+
p(ctx, dirty) {
|
2455
|
+
const shepherdcancelicon_changes = {};
|
2456
|
+
if (dirty & 8) shepherdcancelicon_changes.cancelIcon = ctx[3];
|
2457
|
+
if (dirty & 2) shepherdcancelicon_changes.step = ctx[1];
|
2458
|
+
shepherdcancelicon.$set(shepherdcancelicon_changes);
|
2459
|
+
},
|
2460
|
+
i(local) {
|
2461
|
+
if (current) return;
|
2462
|
+
transition_in(shepherdcancelicon.$$.fragment, local);
|
2463
|
+
current = true;
|
2464
|
+
},
|
2465
|
+
o(local) {
|
2466
|
+
transition_out(shepherdcancelicon.$$.fragment, local);
|
2467
|
+
current = false;
|
2468
|
+
},
|
2469
|
+
d(detaching) {
|
2470
|
+
destroy_component(shepherdcancelicon, detaching);
|
2471
|
+
}
|
2472
|
+
};
|
2473
|
+
}
|
2474
|
+
|
2475
|
+
function create_fragment$4(ctx) {
|
2476
|
+
let header;
|
2477
|
+
let t;
|
2478
|
+
let current;
|
2479
|
+
let if_block0 = ctx[2] && create_if_block_1$1(ctx);
|
2480
|
+
let if_block1 = ctx[3] && ctx[3].enabled && create_if_block$2(ctx);
|
2481
|
+
return {
|
2482
|
+
c() {
|
2483
|
+
header = element("header");
|
2484
|
+
if (if_block0) if_block0.c();
|
2485
|
+
t = space();
|
2486
|
+
if (if_block1) if_block1.c();
|
2487
|
+
attr(header, "class", "shepherd-header");
|
2488
|
+
},
|
2489
|
+
m(target, anchor) {
|
2490
|
+
insert(target, header, anchor);
|
2491
|
+
if (if_block0) if_block0.m(header, null);
|
2492
|
+
append(header, t);
|
2493
|
+
if (if_block1) if_block1.m(header, null);
|
2494
|
+
current = true;
|
2495
|
+
},
|
2496
|
+
p(ctx, [dirty]) {
|
2497
|
+
if (ctx[2]) {
|
2498
|
+
if (if_block0) {
|
2499
|
+
if_block0.p(ctx, dirty);
|
2500
|
+
if (dirty & 4) {
|
2501
|
+
transition_in(if_block0, 1);
|
2502
|
+
}
|
2503
|
+
} else {
|
2504
|
+
if_block0 = create_if_block_1$1(ctx);
|
2505
|
+
if_block0.c();
|
2506
|
+
transition_in(if_block0, 1);
|
2507
|
+
if_block0.m(header, t);
|
2508
|
+
}
|
2509
|
+
} else if (if_block0) {
|
2510
|
+
group_outros();
|
2511
|
+
transition_out(if_block0, 1, 1, (() => {
|
2512
|
+
if_block0 = null;
|
2513
|
+
}));
|
2514
|
+
check_outros();
|
2515
|
+
}
|
2516
|
+
if (ctx[3] && ctx[3].enabled) {
|
2517
|
+
if (if_block1) {
|
2518
|
+
if_block1.p(ctx, dirty);
|
2519
|
+
if (dirty & 8) {
|
2520
|
+
transition_in(if_block1, 1);
|
2521
|
+
}
|
2522
|
+
} else {
|
2523
|
+
if_block1 = create_if_block$2(ctx);
|
2524
|
+
if_block1.c();
|
2525
|
+
transition_in(if_block1, 1);
|
2526
|
+
if_block1.m(header, null);
|
2527
|
+
}
|
2528
|
+
} else if (if_block1) {
|
2529
|
+
group_outros();
|
2530
|
+
transition_out(if_block1, 1, 1, (() => {
|
2531
|
+
if_block1 = null;
|
2532
|
+
}));
|
2533
|
+
check_outros();
|
2534
|
+
}
|
2535
|
+
},
|
2536
|
+
i(local) {
|
2537
|
+
if (current) return;
|
2538
|
+
transition_in(if_block0);
|
2539
|
+
transition_in(if_block1);
|
2540
|
+
current = true;
|
2541
|
+
},
|
2542
|
+
o(local) {
|
2543
|
+
transition_out(if_block0);
|
2544
|
+
transition_out(if_block1);
|
2545
|
+
current = false;
|
2546
|
+
},
|
2547
|
+
d(detaching) {
|
2548
|
+
if (detaching) detach(header);
|
2549
|
+
if (if_block0) if_block0.d();
|
2550
|
+
if (if_block1) if_block1.d();
|
2551
|
+
}
|
2552
|
+
};
|
2553
|
+
}
|
2554
|
+
|
2555
|
+
function instance$4($$self, $$props, $$invalidate) {
|
2556
|
+
let {labelId: labelId, step: step} = $$props;
|
2557
|
+
let title, cancelIcon;
|
2558
|
+
$$self.$$set = $$props => {
|
2559
|
+
if ("labelId" in $$props) $$invalidate(0, labelId = $$props.labelId);
|
2560
|
+
if ("step" in $$props) $$invalidate(1, step = $$props.step);
|
2561
|
+
};
|
2562
|
+
$$self.$$.update = () => {
|
2563
|
+
if ($$self.$$.dirty & 2) {
|
2564
|
+
{
|
2565
|
+
$$invalidate(2, title = step.options.title);
|
2566
|
+
$$invalidate(3, cancelIcon = step.options.cancelIcon);
|
2567
|
+
}
|
2568
|
+
}
|
2569
|
+
};
|
2570
|
+
return [ labelId, step, title, cancelIcon ];
|
2571
|
+
}
|
2572
|
+
|
2573
|
+
class Shepherd_header extends SvelteComponent {
|
2574
|
+
constructor(options) {
|
2575
|
+
super();
|
2576
|
+
init(this, options, instance$4, create_fragment$4, safe_not_equal, {
|
2577
|
+
labelId: 0,
|
2578
|
+
step: 1
|
2579
|
+
});
|
2580
|
+
}
|
2581
|
+
}
|
2582
|
+
|
2583
|
+
function create_fragment$3(ctx) {
|
2584
|
+
let div;
|
2585
|
+
return {
|
2586
|
+
c() {
|
2587
|
+
div = element("div");
|
2588
|
+
attr(div, "class", "shepherd-text");
|
2589
|
+
attr(div, "id", ctx[1]);
|
2590
|
+
},
|
2591
|
+
m(target, anchor) {
|
2592
|
+
insert(target, div, anchor);
|
2593
|
+
ctx[3](div);
|
2594
|
+
},
|
2595
|
+
p(ctx, [dirty]) {
|
2596
|
+
if (dirty & 2) {
|
2597
|
+
attr(div, "id", ctx[1]);
|
2598
|
+
}
|
2599
|
+
},
|
2600
|
+
i: noop,
|
2601
|
+
o: noop,
|
2602
|
+
d(detaching) {
|
2603
|
+
if (detaching) detach(div);
|
2604
|
+
ctx[3](null);
|
2605
|
+
}
|
2606
|
+
};
|
2607
|
+
}
|
2608
|
+
|
2609
|
+
function instance$3($$self, $$props, $$invalidate) {
|
2610
|
+
let {descriptionId: descriptionId, element: element, step: step} = $$props;
|
2611
|
+
afterUpdate((() => {
|
2612
|
+
let {text: text} = step.options;
|
2613
|
+
if (isFunction(text)) {
|
2614
|
+
text = text.call(step);
|
2615
|
+
}
|
2616
|
+
if (isHTMLElement$1(text)) {
|
2617
|
+
element.appendChild(text);
|
2618
|
+
} else {
|
2619
|
+
$$invalidate(0, element.innerHTML = text, element);
|
2620
|
+
}
|
2621
|
+
}));
|
2622
|
+
function div_binding($$value) {
|
2623
|
+
binding_callbacks[$$value ? "unshift" : "push"]((() => {
|
2624
|
+
element = $$value;
|
2625
|
+
$$invalidate(0, element);
|
2626
|
+
}));
|
2627
|
+
}
|
2628
|
+
$$self.$$set = $$props => {
|
2629
|
+
if ("descriptionId" in $$props) $$invalidate(1, descriptionId = $$props.descriptionId);
|
2630
|
+
if ("element" in $$props) $$invalidate(0, element = $$props.element);
|
2631
|
+
if ("step" in $$props) $$invalidate(2, step = $$props.step);
|
2632
|
+
};
|
2633
|
+
return [ element, descriptionId, step, div_binding ];
|
2634
|
+
}
|
2635
|
+
|
2636
|
+
class Shepherd_text extends SvelteComponent {
|
2637
|
+
constructor(options) {
|
2638
|
+
super();
|
2639
|
+
init(this, options, instance$3, create_fragment$3, safe_not_equal, {
|
2640
|
+
descriptionId: 1,
|
2641
|
+
element: 0,
|
2642
|
+
step: 2
|
2643
|
+
});
|
2644
|
+
}
|
2645
|
+
}
|
2646
|
+
|
2647
|
+
function create_if_block_2(ctx) {
|
2648
|
+
let shepherdheader;
|
2649
|
+
let current;
|
2650
|
+
shepherdheader = new Shepherd_header({
|
2651
|
+
props: {
|
2652
|
+
labelId: ctx[1],
|
2653
|
+
step: ctx[2]
|
2654
|
+
}
|
2655
|
+
});
|
2656
|
+
return {
|
2657
|
+
c() {
|
2658
|
+
create_component(shepherdheader.$$.fragment);
|
2659
|
+
},
|
2660
|
+
m(target, anchor) {
|
2661
|
+
mount_component(shepherdheader, target, anchor);
|
2662
|
+
current = true;
|
2663
|
+
},
|
2664
|
+
p(ctx, dirty) {
|
2665
|
+
const shepherdheader_changes = {};
|
2666
|
+
if (dirty & 2) shepherdheader_changes.labelId = ctx[1];
|
2667
|
+
if (dirty & 4) shepherdheader_changes.step = ctx[2];
|
2668
|
+
shepherdheader.$set(shepherdheader_changes);
|
2669
|
+
},
|
2670
|
+
i(local) {
|
2671
|
+
if (current) return;
|
2672
|
+
transition_in(shepherdheader.$$.fragment, local);
|
2673
|
+
current = true;
|
2674
|
+
},
|
2675
|
+
o(local) {
|
2676
|
+
transition_out(shepherdheader.$$.fragment, local);
|
2677
|
+
current = false;
|
2678
|
+
},
|
2679
|
+
d(detaching) {
|
2680
|
+
destroy_component(shepherdheader, detaching);
|
2681
|
+
}
|
2682
|
+
};
|
2683
|
+
}
|
2684
|
+
|
2685
|
+
function create_if_block_1(ctx) {
|
2686
|
+
let shepherdtext;
|
2687
|
+
let current;
|
2688
|
+
shepherdtext = new Shepherd_text({
|
2689
|
+
props: {
|
2690
|
+
descriptionId: ctx[0],
|
2691
|
+
step: ctx[2]
|
2692
|
+
}
|
2693
|
+
});
|
2694
|
+
return {
|
2695
|
+
c() {
|
2696
|
+
create_component(shepherdtext.$$.fragment);
|
2697
|
+
},
|
2698
|
+
m(target, anchor) {
|
2699
|
+
mount_component(shepherdtext, target, anchor);
|
2700
|
+
current = true;
|
2701
|
+
},
|
2702
|
+
p(ctx, dirty) {
|
2703
|
+
const shepherdtext_changes = {};
|
2704
|
+
if (dirty & 1) shepherdtext_changes.descriptionId = ctx[0];
|
2705
|
+
if (dirty & 4) shepherdtext_changes.step = ctx[2];
|
2706
|
+
shepherdtext.$set(shepherdtext_changes);
|
2707
|
+
},
|
2708
|
+
i(local) {
|
2709
|
+
if (current) return;
|
2710
|
+
transition_in(shepherdtext.$$.fragment, local);
|
2711
|
+
current = true;
|
2712
|
+
},
|
2713
|
+
o(local) {
|
2714
|
+
transition_out(shepherdtext.$$.fragment, local);
|
2715
|
+
current = false;
|
2716
|
+
},
|
2717
|
+
d(detaching) {
|
2718
|
+
destroy_component(shepherdtext, detaching);
|
2719
|
+
}
|
2720
|
+
};
|
2721
|
+
}
|
2722
|
+
|
2723
|
+
function create_if_block$1(ctx) {
|
2724
|
+
let shepherdfooter;
|
2725
|
+
let current;
|
2726
|
+
shepherdfooter = new Shepherd_footer({
|
2727
|
+
props: {
|
2728
|
+
step: ctx[2]
|
2729
|
+
}
|
2730
|
+
});
|
2731
|
+
return {
|
2732
|
+
c() {
|
2733
|
+
create_component(shepherdfooter.$$.fragment);
|
2734
|
+
},
|
2735
|
+
m(target, anchor) {
|
2736
|
+
mount_component(shepherdfooter, target, anchor);
|
2737
|
+
current = true;
|
2738
|
+
},
|
2739
|
+
p(ctx, dirty) {
|
2740
|
+
const shepherdfooter_changes = {};
|
2741
|
+
if (dirty & 4) shepherdfooter_changes.step = ctx[2];
|
2742
|
+
shepherdfooter.$set(shepherdfooter_changes);
|
2743
|
+
},
|
2744
|
+
i(local) {
|
2745
|
+
if (current) return;
|
2746
|
+
transition_in(shepherdfooter.$$.fragment, local);
|
2747
|
+
current = true;
|
2748
|
+
},
|
2749
|
+
o(local) {
|
2750
|
+
transition_out(shepherdfooter.$$.fragment, local);
|
2751
|
+
current = false;
|
2752
|
+
},
|
2753
|
+
d(detaching) {
|
2754
|
+
destroy_component(shepherdfooter, detaching);
|
2755
|
+
}
|
2756
|
+
};
|
2757
|
+
}
|
2758
|
+
|
2759
|
+
function create_fragment$2(ctx) {
|
2760
|
+
let div;
|
2761
|
+
let show_if_2 = !isUndefined(ctx[2].options.title) || ctx[2].options.cancelIcon && ctx[2].options.cancelIcon.enabled;
|
2762
|
+
let t0;
|
2763
|
+
let show_if_1 = !isUndefined(ctx[2].options.text);
|
2764
|
+
let t1;
|
2765
|
+
let show_if = Array.isArray(ctx[2].options.buttons) && ctx[2].options.buttons.length;
|
2766
|
+
let current;
|
2767
|
+
let if_block0 = show_if_2 && create_if_block_2(ctx);
|
2768
|
+
let if_block1 = show_if_1 && create_if_block_1(ctx);
|
2769
|
+
let if_block2 = show_if && create_if_block$1(ctx);
|
2770
|
+
return {
|
2771
|
+
c() {
|
2772
|
+
div = element("div");
|
2773
|
+
if (if_block0) if_block0.c();
|
2774
|
+
t0 = space();
|
2775
|
+
if (if_block1) if_block1.c();
|
2776
|
+
t1 = space();
|
2777
|
+
if (if_block2) if_block2.c();
|
2778
|
+
attr(div, "class", "shepherd-content");
|
2779
|
+
},
|
2780
|
+
m(target, anchor) {
|
2781
|
+
insert(target, div, anchor);
|
2782
|
+
if (if_block0) if_block0.m(div, null);
|
2783
|
+
append(div, t0);
|
2784
|
+
if (if_block1) if_block1.m(div, null);
|
2785
|
+
append(div, t1);
|
2786
|
+
if (if_block2) if_block2.m(div, null);
|
2787
|
+
current = true;
|
2788
|
+
},
|
2789
|
+
p(ctx, [dirty]) {
|
2790
|
+
if (dirty & 4) show_if_2 = !isUndefined(ctx[2].options.title) || ctx[2].options.cancelIcon && ctx[2].options.cancelIcon.enabled;
|
2791
|
+
if (show_if_2) {
|
2792
|
+
if (if_block0) {
|
2793
|
+
if_block0.p(ctx, dirty);
|
2794
|
+
if (dirty & 4) {
|
2795
|
+
transition_in(if_block0, 1);
|
2796
|
+
}
|
2797
|
+
} else {
|
2798
|
+
if_block0 = create_if_block_2(ctx);
|
2799
|
+
if_block0.c();
|
2800
|
+
transition_in(if_block0, 1);
|
2801
|
+
if_block0.m(div, t0);
|
2802
|
+
}
|
2803
|
+
} else if (if_block0) {
|
2804
|
+
group_outros();
|
2805
|
+
transition_out(if_block0, 1, 1, (() => {
|
2806
|
+
if_block0 = null;
|
2807
|
+
}));
|
2808
|
+
check_outros();
|
2809
|
+
}
|
2810
|
+
if (dirty & 4) show_if_1 = !isUndefined(ctx[2].options.text);
|
2811
|
+
if (show_if_1) {
|
2812
|
+
if (if_block1) {
|
2813
|
+
if_block1.p(ctx, dirty);
|
2814
|
+
if (dirty & 4) {
|
2815
|
+
transition_in(if_block1, 1);
|
2816
|
+
}
|
2817
|
+
} else {
|
2818
|
+
if_block1 = create_if_block_1(ctx);
|
2819
|
+
if_block1.c();
|
2820
|
+
transition_in(if_block1, 1);
|
2821
|
+
if_block1.m(div, t1);
|
2822
|
+
}
|
2823
|
+
} else if (if_block1) {
|
2824
|
+
group_outros();
|
2825
|
+
transition_out(if_block1, 1, 1, (() => {
|
2826
|
+
if_block1 = null;
|
2827
|
+
}));
|
2828
|
+
check_outros();
|
2829
|
+
}
|
2830
|
+
if (dirty & 4) show_if = Array.isArray(ctx[2].options.buttons) && ctx[2].options.buttons.length;
|
2831
|
+
if (show_if) {
|
2832
|
+
if (if_block2) {
|
2833
|
+
if_block2.p(ctx, dirty);
|
2834
|
+
if (dirty & 4) {
|
2835
|
+
transition_in(if_block2, 1);
|
2836
|
+
}
|
2837
|
+
} else {
|
2838
|
+
if_block2 = create_if_block$1(ctx);
|
2839
|
+
if_block2.c();
|
2840
|
+
transition_in(if_block2, 1);
|
2841
|
+
if_block2.m(div, null);
|
2842
|
+
}
|
2843
|
+
} else if (if_block2) {
|
2844
|
+
group_outros();
|
2845
|
+
transition_out(if_block2, 1, 1, (() => {
|
2846
|
+
if_block2 = null;
|
2847
|
+
}));
|
2848
|
+
check_outros();
|
2849
|
+
}
|
2850
|
+
},
|
2851
|
+
i(local) {
|
2852
|
+
if (current) return;
|
2853
|
+
transition_in(if_block0);
|
2854
|
+
transition_in(if_block1);
|
2855
|
+
transition_in(if_block2);
|
2856
|
+
current = true;
|
2857
|
+
},
|
2858
|
+
o(local) {
|
2859
|
+
transition_out(if_block0);
|
2860
|
+
transition_out(if_block1);
|
2861
|
+
transition_out(if_block2);
|
2862
|
+
current = false;
|
2863
|
+
},
|
2864
|
+
d(detaching) {
|
2865
|
+
if (detaching) detach(div);
|
2866
|
+
if (if_block0) if_block0.d();
|
2867
|
+
if (if_block1) if_block1.d();
|
2868
|
+
if (if_block2) if_block2.d();
|
2869
|
+
}
|
2870
|
+
};
|
2871
|
+
}
|
2872
|
+
|
2873
|
+
function instance$2($$self, $$props, $$invalidate) {
|
2874
|
+
let {descriptionId: descriptionId, labelId: labelId, step: step} = $$props;
|
2875
|
+
$$self.$$set = $$props => {
|
2876
|
+
if ("descriptionId" in $$props) $$invalidate(0, descriptionId = $$props.descriptionId);
|
2877
|
+
if ("labelId" in $$props) $$invalidate(1, labelId = $$props.labelId);
|
2878
|
+
if ("step" in $$props) $$invalidate(2, step = $$props.step);
|
2879
|
+
};
|
2880
|
+
return [ descriptionId, labelId, step ];
|
2881
|
+
}
|
2882
|
+
|
2883
|
+
class Shepherd_content extends SvelteComponent {
|
2884
|
+
constructor(options) {
|
2885
|
+
super();
|
2886
|
+
init(this, options, instance$2, create_fragment$2, safe_not_equal, {
|
2887
|
+
descriptionId: 0,
|
2888
|
+
labelId: 1,
|
2889
|
+
step: 2
|
2890
|
+
});
|
2891
|
+
}
|
2892
|
+
}
|
2893
|
+
|
2894
|
+
function create_if_block(ctx) {
|
2895
|
+
let div;
|
2896
|
+
return {
|
2897
|
+
c() {
|
2898
|
+
div = element("div");
|
2899
|
+
attr(div, "class", "shepherd-arrow");
|
2900
|
+
attr(div, "data-popper-arrow", "");
|
2901
|
+
},
|
2902
|
+
m(target, anchor) {
|
2903
|
+
insert(target, div, anchor);
|
2904
|
+
},
|
2905
|
+
d(detaching) {
|
2906
|
+
if (detaching) detach(div);
|
2907
|
+
}
|
2908
|
+
};
|
2909
|
+
}
|
2910
|
+
|
2911
|
+
function create_fragment$1(ctx) {
|
2912
|
+
let div;
|
2913
|
+
let t;
|
2914
|
+
let shepherdcontent;
|
2915
|
+
let div_aria_describedby_value;
|
2916
|
+
let div_aria_labelledby_value;
|
2917
|
+
let current;
|
2918
|
+
let mounted;
|
2919
|
+
let dispose;
|
2920
|
+
let if_block = ctx[4].options.arrow && ctx[4].options.attachTo && ctx[4].options.attachTo.element && ctx[4].options.attachTo.on && create_if_block();
|
2921
|
+
shepherdcontent = new Shepherd_content({
|
2922
|
+
props: {
|
2923
|
+
descriptionId: ctx[2],
|
2924
|
+
labelId: ctx[3],
|
2925
|
+
step: ctx[4]
|
2926
|
+
}
|
2927
|
+
});
|
2928
|
+
let div_levels = [ {
|
2929
|
+
"aria-describedby": div_aria_describedby_value = !isUndefined(ctx[4].options.text) ? ctx[2] : null
|
2930
|
+
}, {
|
2931
|
+
"aria-labelledby": div_aria_labelledby_value = ctx[4].options.title ? ctx[3] : null
|
2932
|
+
}, ctx[1], {
|
2933
|
+
role: "dialog"
|
2934
|
+
}, {
|
2935
|
+
tabindex: "0"
|
2936
|
+
} ];
|
2937
|
+
let div_data = {};
|
2938
|
+
for (let i = 0; i < div_levels.length; i += 1) {
|
2939
|
+
div_data = assign(div_data, div_levels[i]);
|
2940
|
+
}
|
2941
|
+
return {
|
2942
|
+
c() {
|
2943
|
+
div = element("div");
|
2944
|
+
if (if_block) if_block.c();
|
2945
|
+
t = space();
|
2946
|
+
create_component(shepherdcontent.$$.fragment);
|
2947
|
+
set_attributes(div, div_data);
|
2948
|
+
toggle_class(div, "shepherd-has-cancel-icon", ctx[5]);
|
2949
|
+
toggle_class(div, "shepherd-has-title", ctx[6]);
|
2950
|
+
toggle_class(div, "shepherd-element", true);
|
2951
|
+
},
|
2952
|
+
m(target, anchor) {
|
2953
|
+
insert(target, div, anchor);
|
2954
|
+
if (if_block) if_block.m(div, null);
|
2955
|
+
append(div, t);
|
2956
|
+
mount_component(shepherdcontent, div, null);
|
2957
|
+
ctx[13](div);
|
2958
|
+
current = true;
|
2959
|
+
if (!mounted) {
|
2960
|
+
dispose = listen(div, "keydown", ctx[7]);
|
2961
|
+
mounted = true;
|
2962
|
+
}
|
2963
|
+
},
|
2964
|
+
p(ctx, [dirty]) {
|
2965
|
+
if (ctx[4].options.arrow && ctx[4].options.attachTo && ctx[4].options.attachTo.element && ctx[4].options.attachTo.on) {
|
2966
|
+
if (if_block) ; else {
|
2967
|
+
if_block = create_if_block();
|
2968
|
+
if_block.c();
|
2969
|
+
if_block.m(div, t);
|
2970
|
+
}
|
2971
|
+
} else if (if_block) {
|
2972
|
+
if_block.d(1);
|
2973
|
+
if_block = null;
|
2974
|
+
}
|
2975
|
+
const shepherdcontent_changes = {};
|
2976
|
+
if (dirty & 4) shepherdcontent_changes.descriptionId = ctx[2];
|
2977
|
+
if (dirty & 8) shepherdcontent_changes.labelId = ctx[3];
|
2978
|
+
if (dirty & 16) shepherdcontent_changes.step = ctx[4];
|
2979
|
+
shepherdcontent.$set(shepherdcontent_changes);
|
2980
|
+
set_attributes(div, div_data = get_spread_update(div_levels, [ (!current || dirty & 20 && div_aria_describedby_value !== (div_aria_describedby_value = !isUndefined(ctx[4].options.text) ? ctx[2] : null)) && {
|
2981
|
+
"aria-describedby": div_aria_describedby_value
|
2982
|
+
}, (!current || dirty & 24 && div_aria_labelledby_value !== (div_aria_labelledby_value = ctx[4].options.title ? ctx[3] : null)) && {
|
2983
|
+
"aria-labelledby": div_aria_labelledby_value
|
2984
|
+
}, dirty & 2 && ctx[1], {
|
2985
|
+
role: "dialog"
|
2986
|
+
}, {
|
2987
|
+
tabindex: "0"
|
2988
|
+
} ]));
|
2989
|
+
toggle_class(div, "shepherd-has-cancel-icon", ctx[5]);
|
2990
|
+
toggle_class(div, "shepherd-has-title", ctx[6]);
|
2991
|
+
toggle_class(div, "shepherd-element", true);
|
2992
|
+
},
|
2993
|
+
i(local) {
|
2994
|
+
if (current) return;
|
2995
|
+
transition_in(shepherdcontent.$$.fragment, local);
|
2996
|
+
current = true;
|
2997
|
+
},
|
2998
|
+
o(local) {
|
2999
|
+
transition_out(shepherdcontent.$$.fragment, local);
|
3000
|
+
current = false;
|
3001
|
+
},
|
3002
|
+
d(detaching) {
|
3003
|
+
if (detaching) detach(div);
|
3004
|
+
if (if_block) if_block.d();
|
3005
|
+
destroy_component(shepherdcontent);
|
3006
|
+
ctx[13](null);
|
3007
|
+
mounted = false;
|
3008
|
+
dispose();
|
3009
|
+
}
|
3010
|
+
};
|
3011
|
+
}
|
3012
|
+
|
3013
|
+
const KEY_TAB = 9;
|
3014
|
+
|
3015
|
+
const KEY_ESC = 27;
|
3016
|
+
|
3017
|
+
const LEFT_ARROW = 37;
|
3018
|
+
|
3019
|
+
const RIGHT_ARROW = 39;
|
3020
|
+
|
3021
|
+
function getClassesArray(classes) {
|
3022
|
+
return classes.split(" ").filter((className => !!className.length));
|
3023
|
+
}
|
3024
|
+
|
3025
|
+
function instance$1($$self, $$props, $$invalidate) {
|
3026
|
+
let {classPrefix: classPrefix, element: element, descriptionId: descriptionId, firstFocusableElement: firstFocusableElement, focusableElements: focusableElements, labelId: labelId, lastFocusableElement: lastFocusableElement, step: step, dataStepId: dataStepId} = $$props;
|
3027
|
+
let hasCancelIcon, hasTitle, classes;
|
3028
|
+
const getElement = () => element;
|
3029
|
+
onMount((() => {
|
3030
|
+
$$invalidate(1, dataStepId = {
|
3031
|
+
[`data-${classPrefix}shepherd-step-id`]: step.id
|
3032
|
+
});
|
3033
|
+
$$invalidate(9, focusableElements = element.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]'));
|
3034
|
+
$$invalidate(8, firstFocusableElement = focusableElements[0]);
|
3035
|
+
$$invalidate(10, lastFocusableElement = focusableElements[focusableElements.length - 1]);
|
3036
|
+
}));
|
3037
|
+
afterUpdate((() => {
|
3038
|
+
if (classes !== step.options.classes) {
|
3039
|
+
updateDynamicClasses();
|
3040
|
+
}
|
3041
|
+
}));
|
3042
|
+
function updateDynamicClasses() {
|
3043
|
+
removeClasses(classes);
|
3044
|
+
classes = step.options.classes;
|
3045
|
+
addClasses(classes);
|
3046
|
+
}
|
3047
|
+
function removeClasses(classes) {
|
3048
|
+
if (isString(classes)) {
|
3049
|
+
const oldClasses = getClassesArray(classes);
|
3050
|
+
if (oldClasses.length) {
|
3051
|
+
element.classList.remove(...oldClasses);
|
3052
|
+
}
|
3053
|
+
}
|
3054
|
+
}
|
3055
|
+
function addClasses(classes) {
|
3056
|
+
if (isString(classes)) {
|
3057
|
+
const newClasses = getClassesArray(classes);
|
3058
|
+
if (newClasses.length) {
|
3059
|
+
element.classList.add(...newClasses);
|
3060
|
+
}
|
3061
|
+
}
|
3062
|
+
}
|
3063
|
+
const handleKeyDown = e => {
|
3064
|
+
const {tour: tour} = step;
|
3065
|
+
switch (e.keyCode) {
|
3066
|
+
case KEY_TAB:
|
3067
|
+
if (focusableElements.length === 0) {
|
3068
|
+
e.preventDefault();
|
3069
|
+
break;
|
3070
|
+
}
|
3071
|
+
if (e.shiftKey) {
|
3072
|
+
if (document.activeElement === firstFocusableElement || document.activeElement.classList.contains("shepherd-element")) {
|
3073
|
+
e.preventDefault();
|
3074
|
+
lastFocusableElement.focus();
|
3075
|
+
}
|
3076
|
+
} else {
|
3077
|
+
if (document.activeElement === lastFocusableElement) {
|
3078
|
+
e.preventDefault();
|
3079
|
+
firstFocusableElement.focus();
|
3080
|
+
}
|
3081
|
+
}
|
3082
|
+
break;
|
3083
|
+
|
3084
|
+
case KEY_ESC:
|
3085
|
+
if (tour.options.exitOnEsc) {
|
3086
|
+
e.stopPropagation();
|
3087
|
+
step.cancel();
|
3088
|
+
}
|
3089
|
+
break;
|
3090
|
+
|
3091
|
+
case LEFT_ARROW:
|
3092
|
+
if (tour.options.keyboardNavigation) {
|
3093
|
+
e.stopPropagation();
|
3094
|
+
tour.back();
|
3095
|
+
}
|
3096
|
+
break;
|
3097
|
+
|
3098
|
+
case RIGHT_ARROW:
|
3099
|
+
if (tour.options.keyboardNavigation) {
|
3100
|
+
e.stopPropagation();
|
3101
|
+
tour.next();
|
3102
|
+
}
|
3103
|
+
break;
|
3104
|
+
}
|
3105
|
+
};
|
3106
|
+
function div_binding($$value) {
|
3107
|
+
binding_callbacks[$$value ? "unshift" : "push"]((() => {
|
3108
|
+
element = $$value;
|
3109
|
+
$$invalidate(0, element);
|
3110
|
+
}));
|
3111
|
+
}
|
3112
|
+
$$self.$$set = $$props => {
|
3113
|
+
if ("classPrefix" in $$props) $$invalidate(11, classPrefix = $$props.classPrefix);
|
3114
|
+
if ("element" in $$props) $$invalidate(0, element = $$props.element);
|
3115
|
+
if ("descriptionId" in $$props) $$invalidate(2, descriptionId = $$props.descriptionId);
|
3116
|
+
if ("firstFocusableElement" in $$props) $$invalidate(8, firstFocusableElement = $$props.firstFocusableElement);
|
3117
|
+
if ("focusableElements" in $$props) $$invalidate(9, focusableElements = $$props.focusableElements);
|
3118
|
+
if ("labelId" in $$props) $$invalidate(3, labelId = $$props.labelId);
|
3119
|
+
if ("lastFocusableElement" in $$props) $$invalidate(10, lastFocusableElement = $$props.lastFocusableElement);
|
3120
|
+
if ("step" in $$props) $$invalidate(4, step = $$props.step);
|
3121
|
+
if ("dataStepId" in $$props) $$invalidate(1, dataStepId = $$props.dataStepId);
|
3122
|
+
};
|
3123
|
+
$$self.$$.update = () => {
|
3124
|
+
if ($$self.$$.dirty & 16) {
|
3125
|
+
{
|
3126
|
+
$$invalidate(5, hasCancelIcon = step.options && step.options.cancelIcon && step.options.cancelIcon.enabled);
|
3127
|
+
$$invalidate(6, hasTitle = step.options && step.options.title);
|
3128
|
+
}
|
3129
|
+
}
|
3130
|
+
};
|
3131
|
+
return [ element, dataStepId, descriptionId, labelId, step, hasCancelIcon, hasTitle, handleKeyDown, firstFocusableElement, focusableElements, lastFocusableElement, classPrefix, getElement, div_binding ];
|
3132
|
+
}
|
3133
|
+
|
3134
|
+
class Shepherd_element extends SvelteComponent {
|
3135
|
+
constructor(options) {
|
3136
|
+
super();
|
3137
|
+
init(this, options, instance$1, create_fragment$1, safe_not_equal, {
|
3138
|
+
classPrefix: 11,
|
3139
|
+
element: 0,
|
3140
|
+
descriptionId: 2,
|
3141
|
+
firstFocusableElement: 8,
|
3142
|
+
focusableElements: 9,
|
3143
|
+
labelId: 3,
|
3144
|
+
lastFocusableElement: 10,
|
3145
|
+
step: 4,
|
3146
|
+
dataStepId: 1,
|
3147
|
+
getElement: 12
|
3148
|
+
});
|
3149
|
+
}
|
3150
|
+
get getElement() {
|
3151
|
+
return this.$$.ctx[12];
|
3152
|
+
}
|
3153
|
+
}
|
3154
|
+
|
3155
|
+
class Step extends Evented {
|
3156
|
+
constructor(tour, options = {}) {
|
3157
|
+
super(tour, options);
|
3158
|
+
this.tour = tour;
|
3159
|
+
this.classPrefix = this.tour.options ? normalizePrefix(this.tour.options.classPrefix) : "";
|
3160
|
+
this.styles = tour.styles;
|
3161
|
+
this._resolvedAttachTo = null;
|
3162
|
+
autoBind(this);
|
3163
|
+
this._setOptions(options);
|
3164
|
+
return this;
|
3165
|
+
}
|
3166
|
+
cancel() {
|
3167
|
+
this.tour.cancel();
|
3168
|
+
this.trigger("cancel");
|
3169
|
+
}
|
3170
|
+
complete() {
|
3171
|
+
this.tour.complete();
|
3172
|
+
this.trigger("complete");
|
3173
|
+
}
|
3174
|
+
destroy() {
|
3175
|
+
destroyTooltip(this);
|
3176
|
+
if (isHTMLElement$1(this.el)) {
|
3177
|
+
this.el.remove();
|
3178
|
+
this.el = null;
|
3179
|
+
}
|
3180
|
+
this._updateStepTargetOnHide();
|
3181
|
+
this.trigger("destroy");
|
3182
|
+
}
|
3183
|
+
getTour() {
|
3184
|
+
return this.tour;
|
3185
|
+
}
|
3186
|
+
hide() {
|
3187
|
+
this.tour.modal.hide();
|
3188
|
+
this.trigger("before-hide");
|
3189
|
+
if (this.el) {
|
3190
|
+
this.el.hidden = true;
|
3191
|
+
}
|
3192
|
+
this._updateStepTargetOnHide();
|
3193
|
+
this.trigger("hide");
|
3194
|
+
}
|
3195
|
+
_resolveAttachToOptions() {
|
3196
|
+
this._resolvedAttachTo = parseAttachTo(this);
|
3197
|
+
return this._resolvedAttachTo;
|
3198
|
+
}
|
3199
|
+
_getResolvedAttachToOptions() {
|
3200
|
+
if (this._resolvedAttachTo === null) {
|
3201
|
+
return this._resolveAttachToOptions();
|
3202
|
+
}
|
3203
|
+
return this._resolvedAttachTo;
|
3204
|
+
}
|
3205
|
+
isOpen() {
|
3206
|
+
return Boolean(this.el && !this.el.hidden);
|
3207
|
+
}
|
3208
|
+
show() {
|
3209
|
+
if (isFunction(this.options.beforeShowPromise)) {
|
3210
|
+
return Promise.resolve(this.options.beforeShowPromise()).then((() => this._show()));
|
3211
|
+
}
|
3212
|
+
return Promise.resolve(this._show());
|
3213
|
+
}
|
3214
|
+
updateStepOptions(options) {
|
3215
|
+
Object.assign(this.options, options);
|
3216
|
+
if (this.shepherdElementComponent) {
|
3217
|
+
this.shepherdElementComponent.$set({
|
3218
|
+
step: this
|
3219
|
+
});
|
3220
|
+
}
|
3221
|
+
}
|
3222
|
+
getElement() {
|
3223
|
+
return this.el;
|
3224
|
+
}
|
3225
|
+
getTarget() {
|
3226
|
+
return this.target;
|
3227
|
+
}
|
3228
|
+
_createTooltipContent() {
|
3229
|
+
const descriptionId = `${this.id}-description`;
|
3230
|
+
const labelId = `${this.id}-label`;
|
3231
|
+
this.shepherdElementComponent = new Shepherd_element({
|
3232
|
+
target: this.tour.options.stepsContainer || document.body,
|
3233
|
+
props: {
|
3234
|
+
classPrefix: this.classPrefix,
|
3235
|
+
descriptionId: descriptionId,
|
3236
|
+
labelId: labelId,
|
3237
|
+
step: this,
|
3238
|
+
styles: this.styles
|
3239
|
+
}
|
3240
|
+
});
|
3241
|
+
return this.shepherdElementComponent.getElement();
|
3242
|
+
}
|
3243
|
+
_scrollTo(scrollToOptions) {
|
3244
|
+
const {element: element} = this._getResolvedAttachToOptions();
|
3245
|
+
if (isFunction(this.options.scrollToHandler)) {
|
3246
|
+
this.options.scrollToHandler(element);
|
3247
|
+
} else if (isElement$1(element) && typeof element.scrollIntoView === "function") {
|
3248
|
+
element.scrollIntoView(scrollToOptions);
|
3249
|
+
}
|
3250
|
+
}
|
3251
|
+
_getClassOptions(stepOptions) {
|
3252
|
+
const defaultStepOptions = this.tour && this.tour.options && this.tour.options.defaultStepOptions;
|
3253
|
+
const stepClasses = stepOptions.classes ? stepOptions.classes : "";
|
3254
|
+
const defaultStepOptionsClasses = defaultStepOptions && defaultStepOptions.classes ? defaultStepOptions.classes : "";
|
3255
|
+
const allClasses = [ ...stepClasses.split(" "), ...defaultStepOptionsClasses.split(" ") ];
|
3256
|
+
const uniqClasses = new Set(allClasses);
|
3257
|
+
return Array.from(uniqClasses).join(" ").trim();
|
3258
|
+
}
|
3259
|
+
_setOptions(options = {}) {
|
3260
|
+
let tourOptions = this.tour && this.tour.options && this.tour.options.defaultStepOptions;
|
3261
|
+
tourOptions = cjs({}, tourOptions || {});
|
3262
|
+
this.options = Object.assign({
|
3263
|
+
arrow: true
|
3264
|
+
}, tourOptions, options, mergeTooltipConfig(tourOptions, options));
|
3265
|
+
const {when: when} = this.options;
|
3266
|
+
this.options.classes = this._getClassOptions(options);
|
3267
|
+
this.destroy();
|
3268
|
+
this.id = this.options.id || `step-${uuid()}`;
|
3269
|
+
if (when) {
|
3270
|
+
Object.keys(when).forEach((event => {
|
3271
|
+
this.on(event, when[event], this);
|
3272
|
+
}));
|
3273
|
+
}
|
3274
|
+
}
|
3275
|
+
_setupElements() {
|
3276
|
+
if (!isUndefined(this.el)) {
|
3277
|
+
this.destroy();
|
3278
|
+
}
|
3279
|
+
this.el = this._createTooltipContent();
|
3280
|
+
if (this.options.advanceOn) {
|
3281
|
+
bindAdvance(this);
|
3282
|
+
}
|
3283
|
+
setupTooltip(this);
|
3284
|
+
}
|
3285
|
+
_show() {
|
3286
|
+
this.trigger("before-show");
|
3287
|
+
this._resolveAttachToOptions();
|
3288
|
+
this._setupElements();
|
3289
|
+
if (!this.tour.modal) {
|
3290
|
+
this.tour._setupModal();
|
3291
|
+
}
|
3292
|
+
this.tour.modal.setupForStep(this);
|
3293
|
+
this._styleTargetElementForStep(this);
|
3294
|
+
this.el.hidden = false;
|
3295
|
+
if (this.options.scrollTo) {
|
3296
|
+
setTimeout((() => {
|
3297
|
+
this._scrollTo(this.options.scrollTo);
|
3298
|
+
}));
|
3299
|
+
}
|
3300
|
+
this.el.hidden = false;
|
3301
|
+
const content = this.shepherdElementComponent.getElement();
|
3302
|
+
const target = this.target || document.body;
|
3303
|
+
target.classList.add(`${this.classPrefix}shepherd-enabled`);
|
3304
|
+
target.classList.add(`${this.classPrefix}shepherd-target`);
|
3305
|
+
content.classList.add("shepherd-enabled");
|
3306
|
+
this.trigger("show");
|
3307
|
+
}
|
3308
|
+
_styleTargetElementForStep(step) {
|
3309
|
+
const targetElement = step.target;
|
3310
|
+
if (!targetElement) {
|
3311
|
+
return;
|
3312
|
+
}
|
3313
|
+
if (step.options.highlightClass) {
|
3314
|
+
targetElement.classList.add(step.options.highlightClass);
|
3315
|
+
}
|
3316
|
+
targetElement.classList.remove("shepherd-target-click-disabled");
|
3317
|
+
if (step.options.canClickTarget === false) {
|
3318
|
+
targetElement.classList.add("shepherd-target-click-disabled");
|
3319
|
+
}
|
3320
|
+
}
|
3321
|
+
_updateStepTargetOnHide() {
|
3322
|
+
const target = this.target || document.body;
|
3323
|
+
if (this.options.highlightClass) {
|
3324
|
+
target.classList.remove(this.options.highlightClass);
|
3325
|
+
}
|
3326
|
+
target.classList.remove("shepherd-target-click-disabled", `${this.classPrefix}shepherd-enabled`, `${this.classPrefix}shepherd-target`);
|
3327
|
+
}
|
3328
|
+
}
|
3329
|
+
|
3330
|
+
function cleanupSteps(tour) {
|
3331
|
+
if (tour) {
|
3332
|
+
const {steps: steps} = tour;
|
3333
|
+
steps.forEach((step => {
|
3334
|
+
if (step.options && step.options.canClickTarget === false && step.options.attachTo) {
|
3335
|
+
if (step.target instanceof HTMLElement) {
|
3336
|
+
step.target.classList.remove("shepherd-target-click-disabled");
|
3337
|
+
}
|
3338
|
+
}
|
3339
|
+
}));
|
3340
|
+
}
|
3341
|
+
}
|
3342
|
+
|
3343
|
+
function makeOverlayPath({width: width, height: height, x: x = 0, y: y = 0, r: r = 0}) {
|
3344
|
+
const {innerWidth: w, innerHeight: h} = window;
|
3345
|
+
const {topLeft: topLeft = 0, topRight: topRight = 0, bottomRight: bottomRight = 0, bottomLeft: bottomLeft = 0} = typeof r === "number" ? {
|
3346
|
+
topLeft: r,
|
3347
|
+
topRight: r,
|
3348
|
+
bottomRight: r,
|
3349
|
+
bottomLeft: r
|
3350
|
+
} : r;
|
3351
|
+
return `M${w},${h}H0V0H${w}V${h}ZM${x + topLeft},${y}a${topLeft},${topLeft},0,0,0-${topLeft},${topLeft}V${height + y - bottomLeft}a${bottomLeft},${bottomLeft},0,0,0,${bottomLeft},${bottomLeft}H${width + x - bottomRight}a${bottomRight},${bottomRight},0,0,0,${bottomRight}-${bottomRight}V${y + topRight}a${topRight},${topRight},0,0,0-${topRight}-${topRight}Z`;
|
3352
|
+
}
|
3353
|
+
|
3354
|
+
function create_fragment(ctx) {
|
3355
|
+
let svg;
|
3356
|
+
let path;
|
3357
|
+
let svg_class_value;
|
3358
|
+
let mounted;
|
3359
|
+
let dispose;
|
3360
|
+
return {
|
3361
|
+
c() {
|
3362
|
+
svg = svg_element("svg");
|
3363
|
+
path = svg_element("path");
|
3364
|
+
attr(path, "d", ctx[2]);
|
3365
|
+
attr(svg, "class", svg_class_value = `${ctx[1] ? "shepherd-modal-is-visible" : ""} shepherd-modal-overlay-container`);
|
3366
|
+
},
|
3367
|
+
m(target, anchor) {
|
3368
|
+
insert(target, svg, anchor);
|
3369
|
+
append(svg, path);
|
3370
|
+
ctx[11](svg);
|
3371
|
+
if (!mounted) {
|
3372
|
+
dispose = listen(svg, "touchmove", ctx[3]);
|
3373
|
+
mounted = true;
|
3374
|
+
}
|
3375
|
+
},
|
3376
|
+
p(ctx, [dirty]) {
|
3377
|
+
if (dirty & 4) {
|
3378
|
+
attr(path, "d", ctx[2]);
|
3379
|
+
}
|
3380
|
+
if (dirty & 2 && svg_class_value !== (svg_class_value = `${ctx[1] ? "shepherd-modal-is-visible" : ""} shepherd-modal-overlay-container`)) {
|
3381
|
+
attr(svg, "class", svg_class_value);
|
3382
|
+
}
|
3383
|
+
},
|
3384
|
+
i: noop,
|
3385
|
+
o: noop,
|
3386
|
+
d(detaching) {
|
3387
|
+
if (detaching) detach(svg);
|
3388
|
+
ctx[11](null);
|
3389
|
+
mounted = false;
|
3390
|
+
dispose();
|
3391
|
+
}
|
3392
|
+
};
|
3393
|
+
}
|
3394
|
+
|
3395
|
+
function _getScrollParent(element) {
|
3396
|
+
if (!element) {
|
3397
|
+
return null;
|
3398
|
+
}
|
3399
|
+
const isHtmlElement = element instanceof HTMLElement;
|
3400
|
+
const overflowY = isHtmlElement && window.getComputedStyle(element).overflowY;
|
3401
|
+
const isScrollable = overflowY !== "hidden" && overflowY !== "visible";
|
3402
|
+
if (isScrollable && element.scrollHeight >= element.clientHeight) {
|
3403
|
+
return element;
|
3404
|
+
}
|
3405
|
+
return _getScrollParent(element.parentElement);
|
3406
|
+
}
|
3407
|
+
|
3408
|
+
function _getVisibleHeight(element, scrollParent) {
|
3409
|
+
const elementRect = element.getBoundingClientRect();
|
3410
|
+
let top = elementRect.y || elementRect.top;
|
3411
|
+
let bottom = elementRect.bottom || top + elementRect.height;
|
3412
|
+
if (scrollParent) {
|
3413
|
+
const scrollRect = scrollParent.getBoundingClientRect();
|
3414
|
+
const scrollTop = scrollRect.y || scrollRect.top;
|
3415
|
+
const scrollBottom = scrollRect.bottom || scrollTop + scrollRect.height;
|
3416
|
+
top = Math.max(top, scrollTop);
|
3417
|
+
bottom = Math.min(bottom, scrollBottom);
|
3418
|
+
}
|
3419
|
+
const height = Math.max(bottom - top, 0);
|
3420
|
+
return {
|
3421
|
+
y: top,
|
3422
|
+
height: height
|
3423
|
+
};
|
3424
|
+
}
|
3425
|
+
|
3426
|
+
function instance($$self, $$props, $$invalidate) {
|
3427
|
+
let {element: element, openingProperties: openingProperties} = $$props;
|
3428
|
+
uuid();
|
3429
|
+
let modalIsVisible = false;
|
3430
|
+
let rafId = undefined;
|
3431
|
+
let pathDefinition;
|
3432
|
+
closeModalOpening();
|
3433
|
+
const getElement = () => element;
|
3434
|
+
function closeModalOpening() {
|
3435
|
+
$$invalidate(4, openingProperties = {
|
3436
|
+
width: 0,
|
3437
|
+
height: 0,
|
3438
|
+
x: 0,
|
3439
|
+
y: 0,
|
3440
|
+
r: 0
|
3441
|
+
});
|
3442
|
+
}
|
3443
|
+
function hide() {
|
3444
|
+
$$invalidate(1, modalIsVisible = false);
|
3445
|
+
_cleanupStepEventListeners();
|
3446
|
+
}
|
3447
|
+
function positionModal(modalOverlayOpeningPadding = 0, modalOverlayOpeningRadius = 0, scrollParent, targetElement) {
|
3448
|
+
if (targetElement) {
|
3449
|
+
const {y: y, height: height} = _getVisibleHeight(targetElement, scrollParent);
|
3450
|
+
const {x: x, width: width, left: left} = targetElement.getBoundingClientRect();
|
3451
|
+
$$invalidate(4, openingProperties = {
|
3452
|
+
width: width + modalOverlayOpeningPadding * 2,
|
3453
|
+
height: height + modalOverlayOpeningPadding * 2,
|
3454
|
+
x: (x || left) - modalOverlayOpeningPadding,
|
3455
|
+
y: y - modalOverlayOpeningPadding,
|
3456
|
+
r: modalOverlayOpeningRadius
|
3457
|
+
});
|
3458
|
+
} else {
|
3459
|
+
closeModalOpening();
|
3460
|
+
}
|
3461
|
+
}
|
3462
|
+
function setupForStep(step) {
|
3463
|
+
_cleanupStepEventListeners();
|
3464
|
+
if (step.tour.options.useModalOverlay) {
|
3465
|
+
_styleForStep(step);
|
3466
|
+
show();
|
3467
|
+
} else {
|
3468
|
+
hide();
|
3469
|
+
}
|
3470
|
+
}
|
3471
|
+
function show() {
|
3472
|
+
$$invalidate(1, modalIsVisible = true);
|
3473
|
+
}
|
3474
|
+
const _preventModalBodyTouch = e => {
|
3475
|
+
e.preventDefault();
|
3476
|
+
};
|
3477
|
+
const _preventModalOverlayTouch = e => {
|
3478
|
+
e.stopPropagation();
|
3479
|
+
};
|
3480
|
+
function _addStepEventListeners() {
|
3481
|
+
window.addEventListener("touchmove", _preventModalBodyTouch, {
|
3482
|
+
passive: false
|
3483
|
+
});
|
3484
|
+
}
|
3485
|
+
function _cleanupStepEventListeners() {
|
3486
|
+
if (rafId) {
|
3487
|
+
cancelAnimationFrame(rafId);
|
3488
|
+
rafId = undefined;
|
3489
|
+
}
|
3490
|
+
window.removeEventListener("touchmove", _preventModalBodyTouch, {
|
3491
|
+
passive: false
|
3492
|
+
});
|
3493
|
+
}
|
3494
|
+
function _styleForStep(step) {
|
3495
|
+
const {modalOverlayOpeningPadding: modalOverlayOpeningPadding, modalOverlayOpeningRadius: modalOverlayOpeningRadius} = step.options;
|
3496
|
+
const scrollParent = _getScrollParent(step.target);
|
3497
|
+
const rafLoop = () => {
|
3498
|
+
rafId = undefined;
|
3499
|
+
positionModal(modalOverlayOpeningPadding, modalOverlayOpeningRadius, scrollParent, step.target);
|
3500
|
+
rafId = requestAnimationFrame(rafLoop);
|
3501
|
+
};
|
3502
|
+
rafLoop();
|
3503
|
+
_addStepEventListeners();
|
3504
|
+
}
|
3505
|
+
function svg_binding($$value) {
|
3506
|
+
binding_callbacks[$$value ? "unshift" : "push"]((() => {
|
3507
|
+
element = $$value;
|
3508
|
+
$$invalidate(0, element);
|
3509
|
+
}));
|
3510
|
+
}
|
3511
|
+
$$self.$$set = $$props => {
|
3512
|
+
if ("element" in $$props) $$invalidate(0, element = $$props.element);
|
3513
|
+
if ("openingProperties" in $$props) $$invalidate(4, openingProperties = $$props.openingProperties);
|
3514
|
+
};
|
3515
|
+
$$self.$$.update = () => {
|
3516
|
+
if ($$self.$$.dirty & 16) {
|
3517
|
+
$$invalidate(2, pathDefinition = makeOverlayPath(openingProperties));
|
3518
|
+
}
|
3519
|
+
};
|
3520
|
+
return [ element, modalIsVisible, pathDefinition, _preventModalOverlayTouch, openingProperties, getElement, closeModalOpening, hide, positionModal, setupForStep, show, svg_binding ];
|
3521
|
+
}
|
3522
|
+
|
3523
|
+
class Shepherd_modal extends SvelteComponent {
|
3524
|
+
constructor(options) {
|
3525
|
+
super();
|
3526
|
+
init(this, options, instance, create_fragment, safe_not_equal, {
|
3527
|
+
element: 0,
|
3528
|
+
openingProperties: 4,
|
3529
|
+
getElement: 5,
|
3530
|
+
closeModalOpening: 6,
|
3531
|
+
hide: 7,
|
3532
|
+
positionModal: 8,
|
3533
|
+
setupForStep: 9,
|
3534
|
+
show: 10
|
3535
|
+
});
|
3536
|
+
}
|
3537
|
+
get getElement() {
|
3538
|
+
return this.$$.ctx[5];
|
3539
|
+
}
|
3540
|
+
get closeModalOpening() {
|
3541
|
+
return this.$$.ctx[6];
|
3542
|
+
}
|
3543
|
+
get hide() {
|
3544
|
+
return this.$$.ctx[7];
|
3545
|
+
}
|
3546
|
+
get positionModal() {
|
3547
|
+
return this.$$.ctx[8];
|
3548
|
+
}
|
3549
|
+
get setupForStep() {
|
3550
|
+
return this.$$.ctx[9];
|
3551
|
+
}
|
3552
|
+
get show() {
|
3553
|
+
return this.$$.ctx[10];
|
3554
|
+
}
|
3555
|
+
}
|
3556
|
+
|
3557
|
+
const Shepherd$1 = new Evented;
|
3558
|
+
|
3559
|
+
class Tour extends Evented {
|
3560
|
+
constructor(options = {}) {
|
3561
|
+
super(options);
|
3562
|
+
autoBind(this);
|
3563
|
+
const defaultTourOptions = {
|
3564
|
+
exitOnEsc: true,
|
3565
|
+
keyboardNavigation: true
|
3566
|
+
};
|
3567
|
+
this.options = Object.assign({}, defaultTourOptions, options);
|
3568
|
+
this.classPrefix = normalizePrefix(this.options.classPrefix);
|
3569
|
+
this.steps = [];
|
3570
|
+
this.addSteps(this.options.steps);
|
3571
|
+
const events = [ "active", "cancel", "complete", "inactive", "show", "start" ];
|
3572
|
+
events.map((event => {
|
3573
|
+
(e => {
|
3574
|
+
this.on(e, (opts => {
|
3575
|
+
opts = opts || {};
|
3576
|
+
opts.tour = this;
|
3577
|
+
Shepherd$1.trigger(e, opts);
|
3578
|
+
}));
|
3579
|
+
})(event);
|
3580
|
+
}));
|
3581
|
+
this._setTourID();
|
3582
|
+
return this;
|
3583
|
+
}
|
3584
|
+
addStep(options, index) {
|
3585
|
+
let step = options;
|
3586
|
+
if (!(step instanceof Step)) {
|
3587
|
+
step = new Step(this, step);
|
3588
|
+
} else {
|
3589
|
+
step.tour = this;
|
3590
|
+
}
|
3591
|
+
if (!isUndefined(index)) {
|
3592
|
+
this.steps.splice(index, 0, step);
|
3593
|
+
} else {
|
3594
|
+
this.steps.push(step);
|
3595
|
+
}
|
3596
|
+
return step;
|
3597
|
+
}
|
3598
|
+
addSteps(steps) {
|
3599
|
+
if (Array.isArray(steps)) {
|
3600
|
+
steps.forEach((step => {
|
3601
|
+
this.addStep(step);
|
3602
|
+
}));
|
3603
|
+
}
|
3604
|
+
return this;
|
3605
|
+
}
|
3606
|
+
back() {
|
3607
|
+
const index = this.steps.indexOf(this.currentStep);
|
3608
|
+
this.show(index - 1, false);
|
3609
|
+
}
|
3610
|
+
async cancel() {
|
3611
|
+
if (this.options.confirmCancel) {
|
3612
|
+
const confirmCancelIsFunction = typeof this.options.confirmCancel === "function";
|
3613
|
+
const cancelMessage = this.options.confirmCancelMessage || "Are you sure you want to stop the tour?";
|
3614
|
+
const stopTour = confirmCancelIsFunction ? await this.options.confirmCancel() : window.confirm(cancelMessage);
|
3615
|
+
if (stopTour) {
|
3616
|
+
this._done("cancel");
|
3617
|
+
}
|
3618
|
+
} else {
|
3619
|
+
this._done("cancel");
|
3620
|
+
}
|
3621
|
+
}
|
3622
|
+
complete() {
|
3623
|
+
this._done("complete");
|
3624
|
+
}
|
3625
|
+
getById(id) {
|
3626
|
+
return this.steps.find((step => step.id === id));
|
3627
|
+
}
|
3628
|
+
getCurrentStep() {
|
3629
|
+
return this.currentStep;
|
3630
|
+
}
|
3631
|
+
hide() {
|
3632
|
+
const currentStep = this.getCurrentStep();
|
3633
|
+
if (currentStep) {
|
3634
|
+
return currentStep.hide();
|
3635
|
+
}
|
3636
|
+
}
|
3637
|
+
isActive() {
|
3638
|
+
return Shepherd$1.activeTour === this;
|
3639
|
+
}
|
3640
|
+
next() {
|
3641
|
+
const index = this.steps.indexOf(this.currentStep);
|
3642
|
+
if (index === this.steps.length - 1) {
|
3643
|
+
this.complete();
|
3644
|
+
} else {
|
3645
|
+
this.show(index + 1, true);
|
3646
|
+
}
|
3647
|
+
}
|
3648
|
+
removeStep(name) {
|
3649
|
+
const current = this.getCurrentStep();
|
3650
|
+
this.steps.some(((step, i) => {
|
3651
|
+
if (step.id === name) {
|
3652
|
+
if (step.isOpen()) {
|
3653
|
+
step.hide();
|
3654
|
+
}
|
3655
|
+
step.destroy();
|
3656
|
+
this.steps.splice(i, 1);
|
3657
|
+
return true;
|
3658
|
+
}
|
3659
|
+
}));
|
3660
|
+
if (current && current.id === name) {
|
3661
|
+
this.currentStep = undefined;
|
3662
|
+
this.steps.length ? this.show(0) : this.cancel();
|
3663
|
+
}
|
3664
|
+
}
|
3665
|
+
show(key = 0, forward = true) {
|
3666
|
+
const step = isString(key) ? this.getById(key) : this.steps[key];
|
3667
|
+
if (step) {
|
3668
|
+
this._updateStateBeforeShow();
|
3669
|
+
const shouldSkipStep = isFunction(step.options.showOn) && !step.options.showOn();
|
3670
|
+
if (shouldSkipStep) {
|
3671
|
+
this._skipStep(step, forward);
|
3672
|
+
} else {
|
3673
|
+
this.trigger("show", {
|
3674
|
+
step: step,
|
3675
|
+
previous: this.currentStep
|
3676
|
+
});
|
3677
|
+
this.currentStep = step;
|
3678
|
+
step.show();
|
3679
|
+
}
|
3680
|
+
}
|
3681
|
+
}
|
3682
|
+
start() {
|
3683
|
+
this.trigger("start");
|
3684
|
+
this.focusedElBeforeOpen = document.activeElement;
|
3685
|
+
this.currentStep = null;
|
3686
|
+
this._setupModal();
|
3687
|
+
this._setupActiveTour();
|
3688
|
+
this.next();
|
3689
|
+
}
|
3690
|
+
_done(event) {
|
3691
|
+
const index = this.steps.indexOf(this.currentStep);
|
3692
|
+
if (Array.isArray(this.steps)) {
|
3693
|
+
this.steps.forEach((step => step.destroy()));
|
3694
|
+
}
|
3695
|
+
cleanupSteps(this);
|
3696
|
+
this.trigger(event, {
|
3697
|
+
index: index
|
3698
|
+
});
|
3699
|
+
Shepherd$1.activeTour = null;
|
3700
|
+
this.trigger("inactive", {
|
3701
|
+
tour: this
|
3702
|
+
});
|
3703
|
+
if (this.modal) {
|
3704
|
+
this.modal.hide();
|
3705
|
+
}
|
3706
|
+
if (event === "cancel" || event === "complete") {
|
3707
|
+
if (this.modal) {
|
3708
|
+
const modalContainer = document.querySelector(".shepherd-modal-overlay-container");
|
3709
|
+
if (modalContainer) {
|
3710
|
+
modalContainer.remove();
|
3711
|
+
}
|
3712
|
+
}
|
3713
|
+
}
|
3714
|
+
if (isHTMLElement$1(this.focusedElBeforeOpen)) {
|
3715
|
+
this.focusedElBeforeOpen.focus();
|
3716
|
+
}
|
3717
|
+
}
|
3718
|
+
_setupActiveTour() {
|
3719
|
+
this.trigger("active", {
|
3720
|
+
tour: this
|
3721
|
+
});
|
3722
|
+
Shepherd$1.activeTour = this;
|
3723
|
+
}
|
3724
|
+
_setupModal() {
|
3725
|
+
this.modal = new Shepherd_modal({
|
3726
|
+
target: this.options.modalContainer || document.body,
|
3727
|
+
props: {
|
3728
|
+
classPrefix: this.classPrefix,
|
3729
|
+
styles: this.styles
|
3730
|
+
}
|
3731
|
+
});
|
3732
|
+
}
|
3733
|
+
_skipStep(step, forward) {
|
3734
|
+
const index = this.steps.indexOf(step);
|
3735
|
+
if (index === this.steps.length - 1) {
|
3736
|
+
this.complete();
|
3737
|
+
} else {
|
3738
|
+
const nextIndex = forward ? index + 1 : index - 1;
|
3739
|
+
this.show(nextIndex, forward);
|
3740
|
+
}
|
3741
|
+
}
|
3742
|
+
_updateStateBeforeShow() {
|
3743
|
+
if (this.currentStep) {
|
3744
|
+
this.currentStep.hide();
|
3745
|
+
}
|
3746
|
+
if (!this.isActive()) {
|
3747
|
+
this._setupActiveTour();
|
3748
|
+
}
|
3749
|
+
}
|
3750
|
+
_setTourID() {
|
3751
|
+
const tourName = this.options.tourName || "tour";
|
3752
|
+
this.id = `${tourName}--${uuid()}`;
|
3753
|
+
}
|
3754
|
+
}
|
3755
|
+
|
3756
|
+
const isServerSide = typeof window === "undefined";
|
3757
|
+
|
3758
|
+
class NoOp {
|
3759
|
+
constructor() {}
|
3760
|
+
}
|
3761
|
+
|
3762
|
+
if (isServerSide) {
|
3763
|
+
Object.assign(Shepherd$1, {
|
3764
|
+
Tour: NoOp,
|
3765
|
+
Step: NoOp
|
3766
|
+
});
|
3767
|
+
} else {
|
3768
|
+
Object.assign(Shepherd$1, {
|
3769
|
+
Tour: Tour,
|
3770
|
+
Step: Step
|
3771
|
+
});
|
3772
|
+
}
|
3773
|
+
|
3774
|
+
class Shepherd extends Controller {
|
3775
|
+
static values={
|
3776
|
+
tourName: String,
|
3777
|
+
endpoint: String,
|
3778
|
+
config: Object,
|
3779
|
+
context: Object
|
3780
|
+
};
|
3781
|
+
initialize() {
|
3782
|
+
this.tour = new Shepherd$1.Tour(this.configValue.tour);
|
3783
|
+
}
|
3784
|
+
connect() {
|
3785
|
+
const steps = this.processTourConfigAction(this.configValue.steps);
|
3786
|
+
if (steps) {
|
3787
|
+
this.addTourListeners();
|
3788
|
+
this.tour.addSteps(steps);
|
3789
|
+
this.tour.start();
|
3790
|
+
}
|
3791
|
+
}
|
3792
|
+
addTourListeners() {
|
3793
|
+
[ "hide", "cancel", "complete", "start" ].map((eventName => {
|
3794
|
+
this.tour.on(eventName, (event => this.processTourEvent({
|
3795
|
+
event: event,
|
3796
|
+
tourName: this.tourNameValue,
|
3797
|
+
eventName: eventName
|
3798
|
+
})));
|
3799
|
+
}));
|
3800
|
+
}
|
3801
|
+
async processTourEvent({event: event, tourName: tourName, eventName: eventName}) {
|
3802
|
+
const body = JSON.stringify({
|
3803
|
+
tour: tourName,
|
3804
|
+
event: eventName,
|
3805
|
+
context: this.contextValue
|
3806
|
+
});
|
3807
|
+
const response = await post(this.endpointValue, {
|
3808
|
+
body: body
|
3809
|
+
});
|
3810
|
+
if (!response.ok) {
|
3811
|
+
console.warn("Failed", response);
|
3812
|
+
}
|
3813
|
+
}
|
3814
|
+
processTourConfigAction(steps) {
|
3815
|
+
if (!steps.length) {
|
3816
|
+
return false;
|
3817
|
+
}
|
3818
|
+
return steps.map((step => {
|
3819
|
+
let {buttons: buttons, ...rest} = step;
|
3820
|
+
if (buttons) {
|
3821
|
+
buttons = buttons.map((button => {
|
3822
|
+
switch (button.action) {
|
3823
|
+
case "next":
|
3824
|
+
button.action = this.tour.next;
|
3825
|
+
break;
|
3826
|
+
|
3827
|
+
case "back":
|
3828
|
+
button.action = this.tour.back;
|
3829
|
+
break;
|
3830
|
+
|
3831
|
+
default:
|
3832
|
+
button.action = this.tour.complete;
|
3833
|
+
}
|
3834
|
+
return button;
|
3835
|
+
}));
|
3836
|
+
}
|
3837
|
+
return {
|
3838
|
+
buttons: buttons,
|
3839
|
+
...rest
|
3840
|
+
};
|
3841
|
+
}));
|
3842
|
+
}
|
3843
|
+
}
|
3844
|
+
|
3845
|
+
function registerControllers(application) {
|
3846
|
+
application.register("moonshot-shepherd", Shepherd);
|
3847
|
+
}
|
3848
|
+
|
3849
|
+
export { Shepherd, registerControllers };
|