@mjhls/mjh-framework 1.0.1073 → 1.0.1074
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +168 -168
- package/dist/cjs/AD300x250.js +1 -1
- package/dist/cjs/AD300x250x600.js +1 -1
- package/dist/cjs/AD728x90.js +1 -1
- package/dist/cjs/ADFloatingFooter.js +1 -1
- package/dist/cjs/ADGutter.js +1 -1
- package/dist/cjs/{ADInfeed-0519664d.js → ADInfeed-98ee4120.js} +1 -1
- package/dist/cjs/ADSkyscraper.js +1 -1
- package/dist/cjs/ADSponsoredResources.js +1 -1
- package/dist/cjs/ADWebcast.js +1 -1
- package/dist/cjs/ADWelcome.js +1 -1
- package/dist/cjs/{ADlgInfeed-e544ac1c.js → ADlgInfeed-55df7d69.js} +1 -1
- package/dist/cjs/AdSlot.js +1 -1
- package/dist/cjs/AdSlotsProvider.js +1 -1
- package/dist/cjs/AlgoliaSearch.js +63 -91
- package/dist/cjs/ArticleCarousel.js +1 -1
- package/dist/cjs/ArticleProgramLandingPage.js +3 -3
- package/dist/cjs/ArticleSeriesLandingPage.js +3 -3
- package/dist/cjs/ArticleSeriesListing.js +1 -1
- package/dist/cjs/AuthWrapper.js +1476 -294
- package/dist/cjs/CEDeckSupabase.js +2 -2
- package/dist/cjs/CMEDeck.js +1 -1
- package/dist/cjs/Column3.js +1 -1
- package/dist/cjs/ConferenceArticleCard.js +15 -15
- package/dist/cjs/ContentCardPaginated.js +3 -3
- package/dist/cjs/DeckContent.js +11 -11
- package/dist/cjs/DeckQueue.js +2 -2
- package/dist/cjs/DeckQueuePaginated.js +2 -2
- package/dist/cjs/EventsDeck.js +18 -18
- package/dist/cjs/ExternalResources.js +3 -3
- package/dist/cjs/Feature.js +1 -1
- package/dist/cjs/GridContent.js +4 -4
- package/dist/cjs/GridContentPaginated.js +4 -4
- package/dist/cjs/GridHero.js +1 -1
- package/dist/cjs/HamMagazine.js +11 -11
- package/dist/cjs/HealthCareProfessionalModal.js +1 -1
- package/dist/cjs/Hero.js +1 -1
- package/dist/cjs/HorizontalArticleListing.js +3 -3
- package/dist/cjs/{ImageSlider-62a43659.js → ImageSlider-984a697b.js} +92 -149
- package/dist/cjs/IssueLanding.js +34 -34
- package/dist/cjs/KMTracker.js +15 -15
- package/dist/cjs/LeftNav.js +1 -1
- package/dist/cjs/MasterDeck.js +11 -11
- package/dist/cjs/MasterDeckPaginated.js +11 -11
- package/dist/cjs/{MediaSeriesCard-a7e29435.js → MediaSeriesCard-19aab049.js} +2 -2
- package/dist/cjs/MediaSeriesLanding.js +13 -13
- package/dist/cjs/MediaSeriesLandingPaginated.js +13 -13
- package/dist/cjs/NavMagazine.js +12 -12
- package/dist/cjs/NavNative.js +10 -10
- package/dist/cjs/OncliveLargeHero.js +1 -1
- package/dist/cjs/PartnerDetailListing.js +7 -6
- package/dist/cjs/PartnerDetailListingPaginated.js +7 -6
- package/dist/cjs/PodcastsLanding.js +6 -6
- package/dist/cjs/PubSection.js +4 -4
- package/dist/cjs/PublicationLanding.js +26 -26
- package/dist/cjs/QueueDeckExpanded.js +4 -4
- package/dist/cjs/QueueDeckExpandedPaginated.js +4 -4
- package/dist/cjs/RelatedContent.js +28 -28
- package/dist/cjs/RelatedTopicsDropdown.js +10 -10
- package/dist/cjs/SeriesListingDeck.js +2 -2
- package/dist/cjs/{SeriesSlider-edcb8e4b.js → SeriesSlider-086a8319.js} +5 -5
- package/dist/cjs/SideFooter.js +2 -2
- package/dist/cjs/{SocialSearchComponent-e9ec9c63.js → SocialSearchComponent-d7e5d3a6.js} +1 -1
- package/dist/cjs/TaxonomyDescription.js +3 -3
- package/dist/cjs/TemplateNormal.js +2 -2
- package/dist/cjs/ThumbnailCard.js +1 -1
- package/dist/cjs/{Tooltip-980a1d1a.js → Tooltip-96fe6ef6.js} +264 -108
- package/dist/cjs/Ustream.js +1 -1
- package/dist/cjs/VideoProgramLandingPage.js +3 -3
- package/dist/cjs/VideoSeriesCard.js +1 -1
- package/dist/cjs/VideoSeriesLandingPage.js +3 -3
- package/dist/cjs/VideoSeriesListing.js +1 -1
- package/dist/cjs/View.js +34 -27
- package/dist/cjs/YahooHero.js +1 -1
- package/dist/cjs/YoutubeGroup.js +5 -5
- package/dist/cjs/defineProperty-e0fb52c5.js +73 -0
- package/dist/cjs/{entities-3f9d0f2f.js → entities-df1aed86.js} +4 -0
- package/dist/cjs/getSerializers.js +3 -3
- package/dist/cjs/{getTargeting-45ffbee8.js → getTargeting-5b954783.js} +9 -9
- package/dist/cjs/getTargeting.js +1 -1
- package/dist/cjs/{index-8041a4eb.js → index-50be6759.js} +15 -9
- package/dist/cjs/{index-43275e6f.js → index-a075129d.js} +2 -2
- package/dist/cjs/index.js +12 -10
- package/dist/cjs/{main-47be4f9f.js → main-ae8472f3.js} +4 -9
- package/dist/cjs/typeof-1358762e.js +33 -0
- package/dist/esm/AD300x250.js +1 -1
- package/dist/esm/AD300x250x600.js +1 -1
- package/dist/esm/AD728x90.js +1 -1
- package/dist/esm/ADFloatingFooter.js +1 -1
- package/dist/esm/ADGutter.js +1 -1
- package/dist/esm/{ADInfeed-c3f5613e.js → ADInfeed-6d0c0856.js} +1 -1
- package/dist/esm/ADSkyscraper.js +1 -1
- package/dist/esm/ADSponsoredResources.js +1 -1
- package/dist/esm/ADWebcast.js +1 -1
- package/dist/esm/ADWelcome.js +1 -1
- package/dist/esm/{ADlgInfeed-2b148f3f.js → ADlgInfeed-93bc2250.js} +1 -1
- package/dist/esm/AdSlot.js +1 -1
- package/dist/esm/AdSlotsProvider.js +1 -1
- package/dist/esm/AlgoliaSearch.js +63 -91
- package/dist/esm/ArticleCarousel.js +1 -1
- package/dist/esm/ArticleProgramLandingPage.js +3 -3
- package/dist/esm/ArticleSeriesLandingPage.js +3 -3
- package/dist/esm/ArticleSeriesListing.js +1 -1
- package/dist/esm/AuthWrapper.js +1470 -288
- package/dist/esm/CEDeckSupabase.js +2 -2
- package/dist/esm/CMEDeck.js +1 -1
- package/dist/esm/Column3.js +1 -1
- package/dist/esm/ConferenceArticleCard.js +15 -15
- package/dist/esm/ContentCardPaginated.js +3 -3
- package/dist/esm/DeckContent.js +11 -11
- package/dist/esm/DeckQueue.js +2 -2
- package/dist/esm/DeckQueuePaginated.js +2 -2
- package/dist/esm/EventsDeck.js +18 -18
- package/dist/esm/ExternalResources.js +3 -3
- package/dist/esm/Feature.js +1 -1
- package/dist/esm/GridContent.js +4 -4
- package/dist/esm/GridContentPaginated.js +4 -4
- package/dist/esm/GridHero.js +1 -1
- package/dist/esm/HamMagazine.js +11 -11
- package/dist/esm/HealthCareProfessionalModal.js +1 -1
- package/dist/esm/Hero.js +1 -1
- package/dist/esm/HorizontalArticleListing.js +3 -3
- package/dist/esm/{ImageSlider-aea3a615.js → ImageSlider-497e9c88.js} +10 -67
- package/dist/esm/IssueLanding.js +34 -34
- package/dist/esm/KMTracker.js +15 -15
- package/dist/esm/LeftNav.js +1 -1
- package/dist/esm/MasterDeck.js +11 -11
- package/dist/esm/MasterDeckPaginated.js +11 -11
- package/dist/esm/{MediaSeriesCard-b47e2393.js → MediaSeriesCard-6d08d387.js} +2 -2
- package/dist/esm/MediaSeriesLanding.js +13 -13
- package/dist/esm/MediaSeriesLandingPaginated.js +13 -13
- package/dist/esm/NavMagazine.js +12 -12
- package/dist/esm/NavNative.js +10 -10
- package/dist/esm/OncliveLargeHero.js +1 -1
- package/dist/esm/PartnerDetailListing.js +7 -6
- package/dist/esm/PartnerDetailListingPaginated.js +7 -6
- package/dist/esm/PodcastsLanding.js +6 -6
- package/dist/esm/PubSection.js +4 -4
- package/dist/esm/PublicationLanding.js +26 -26
- package/dist/esm/QueueDeckExpanded.js +4 -4
- package/dist/esm/QueueDeckExpandedPaginated.js +4 -4
- package/dist/esm/RelatedContent.js +28 -28
- package/dist/esm/RelatedTopicsDropdown.js +10 -10
- package/dist/esm/SeriesListingDeck.js +2 -2
- package/dist/esm/{SeriesSlider-2e83e861.js → SeriesSlider-a6b1d617.js} +5 -5
- package/dist/esm/SideFooter.js +2 -2
- package/dist/esm/{SocialSearchComponent-020f9e81.js → SocialSearchComponent-6065bff2.js} +1 -1
- package/dist/esm/TaxonomyDescription.js +3 -3
- package/dist/esm/TemplateNormal.js +2 -2
- package/dist/esm/ThumbnailCard.js +1 -1
- package/dist/esm/{Tooltip-51957f7c.js → Tooltip-bc98d17e.js} +264 -108
- package/dist/esm/Ustream.js +1 -1
- package/dist/esm/VideoProgramLandingPage.js +3 -3
- package/dist/esm/VideoSeriesCard.js +1 -1
- package/dist/esm/VideoSeriesLandingPage.js +3 -3
- package/dist/esm/VideoSeriesListing.js +1 -1
- package/dist/esm/View.js +34 -27
- package/dist/esm/YahooHero.js +1 -1
- package/dist/esm/YoutubeGroup.js +5 -5
- package/dist/esm/defineProperty-23a8f8cd.js +68 -0
- package/dist/esm/{entities-932b50cf.js → entities-6d9154b4.js} +4 -0
- package/dist/esm/getSerializers.js +3 -3
- package/dist/esm/{getTargeting-a569a9cc.js → getTargeting-5a281334.js} +9 -9
- package/dist/esm/getTargeting.js +1 -1
- package/dist/esm/{index-983ef4ad.js → index-6be9a1c4.js} +2 -2
- package/dist/esm/{index-67e1773f.js → index-98ca9cec.js} +15 -9
- package/dist/esm/index.js +12 -10
- package/dist/esm/{main-f97773b2.js → main-754d4992.js} +4 -9
- package/dist/esm/typeof-2f07d0e8.js +30 -0
- package/package.json +116 -116
package/dist/cjs/AuthWrapper.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var slicedToArray = require('./slicedToArray-067dd3bc.js');
|
|
3
|
+
var slicedToArray$1 = require('./slicedToArray-067dd3bc.js');
|
|
4
4
|
var _commonjsHelpers = require('./_commonjsHelpers-06173234.js');
|
|
5
|
+
var _typeof = require('./typeof-1358762e.js');
|
|
6
|
+
var defineProperty = require('./defineProperty-e0fb52c5.js');
|
|
5
7
|
var React = require('react');
|
|
6
8
|
var reactBootstrap = require('react-bootstrap');
|
|
7
9
|
var styleInject_es = require('./style-inject.es-dcee06b6.js');
|
|
@@ -12,6 +14,880 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
12
14
|
|
|
13
15
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
16
|
|
|
17
|
+
var interopRequireDefault = _commonjsHelpers.createCommonjsModule(function (module) {
|
|
18
|
+
function _interopRequireDefault(obj) {
|
|
19
|
+
return obj && obj.__esModule ? obj : {
|
|
20
|
+
"default": obj
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = _interopRequireDefault;
|
|
25
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
_commonjsHelpers.unwrapExports(interopRequireDefault);
|
|
29
|
+
|
|
30
|
+
var runtime_1 = _commonjsHelpers.createCommonjsModule(function (module) {
|
|
31
|
+
/**
|
|
32
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the MIT license found in the
|
|
35
|
+
* LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
var runtime = (function (exports) {
|
|
39
|
+
|
|
40
|
+
var Op = Object.prototype;
|
|
41
|
+
var hasOwn = Op.hasOwnProperty;
|
|
42
|
+
var undefined$1; // More compressible than void 0.
|
|
43
|
+
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
44
|
+
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
45
|
+
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
46
|
+
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
47
|
+
|
|
48
|
+
function define(obj, key, value) {
|
|
49
|
+
Object.defineProperty(obj, key, {
|
|
50
|
+
value: value,
|
|
51
|
+
enumerable: true,
|
|
52
|
+
configurable: true,
|
|
53
|
+
writable: true
|
|
54
|
+
});
|
|
55
|
+
return obj[key];
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
59
|
+
define({}, "");
|
|
60
|
+
} catch (err) {
|
|
61
|
+
define = function(obj, key, value) {
|
|
62
|
+
return obj[key] = value;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
67
|
+
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
68
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
69
|
+
var generator = Object.create(protoGenerator.prototype);
|
|
70
|
+
var context = new Context(tryLocsList || []);
|
|
71
|
+
|
|
72
|
+
// The ._invoke method unifies the implementations of the .next,
|
|
73
|
+
// .throw, and .return methods.
|
|
74
|
+
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
75
|
+
|
|
76
|
+
return generator;
|
|
77
|
+
}
|
|
78
|
+
exports.wrap = wrap;
|
|
79
|
+
|
|
80
|
+
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|
81
|
+
// record like context.tryEntries[i].completion. This interface could
|
|
82
|
+
// have been (and was previously) designed to take a closure to be
|
|
83
|
+
// invoked without arguments, but in all the cases we care about we
|
|
84
|
+
// already have an existing method we want to call, so there's no need
|
|
85
|
+
// to create a new function object. We can even get away with assuming
|
|
86
|
+
// the method takes exactly one argument, since that happens to be true
|
|
87
|
+
// in every case, so we don't have to touch the arguments object. The
|
|
88
|
+
// only additional allocation required is the completion record, which
|
|
89
|
+
// has a stable shape and so hopefully should be cheap to allocate.
|
|
90
|
+
function tryCatch(fn, obj, arg) {
|
|
91
|
+
try {
|
|
92
|
+
return { type: "normal", arg: fn.call(obj, arg) };
|
|
93
|
+
} catch (err) {
|
|
94
|
+
return { type: "throw", arg: err };
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
var GenStateSuspendedStart = "suspendedStart";
|
|
99
|
+
var GenStateSuspendedYield = "suspendedYield";
|
|
100
|
+
var GenStateExecuting = "executing";
|
|
101
|
+
var GenStateCompleted = "completed";
|
|
102
|
+
|
|
103
|
+
// Returning this object from the innerFn has the same effect as
|
|
104
|
+
// breaking out of the dispatch switch statement.
|
|
105
|
+
var ContinueSentinel = {};
|
|
106
|
+
|
|
107
|
+
// Dummy constructor functions that we use as the .constructor and
|
|
108
|
+
// .constructor.prototype properties for functions that return Generator
|
|
109
|
+
// objects. For full spec compliance, you may wish to configure your
|
|
110
|
+
// minifier not to mangle the names of these two functions.
|
|
111
|
+
function Generator() {}
|
|
112
|
+
function GeneratorFunction() {}
|
|
113
|
+
function GeneratorFunctionPrototype() {}
|
|
114
|
+
|
|
115
|
+
// This is a polyfill for %IteratorPrototype% for environments that
|
|
116
|
+
// don't natively support it.
|
|
117
|
+
var IteratorPrototype = {};
|
|
118
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
119
|
+
return this;
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
var getProto = Object.getPrototypeOf;
|
|
123
|
+
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
124
|
+
if (NativeIteratorPrototype &&
|
|
125
|
+
NativeIteratorPrototype !== Op &&
|
|
126
|
+
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
127
|
+
// This environment has a native %IteratorPrototype%; use it instead
|
|
128
|
+
// of the polyfill.
|
|
129
|
+
IteratorPrototype = NativeIteratorPrototype;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
var Gp = GeneratorFunctionPrototype.prototype =
|
|
133
|
+
Generator.prototype = Object.create(IteratorPrototype);
|
|
134
|
+
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
135
|
+
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
136
|
+
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
137
|
+
GeneratorFunction.displayName = define(
|
|
138
|
+
GeneratorFunctionPrototype,
|
|
139
|
+
toStringTagSymbol,
|
|
140
|
+
"GeneratorFunction"
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
// Helper for defining the .next, .throw, and .return methods of the
|
|
144
|
+
// Iterator interface in terms of a single ._invoke method.
|
|
145
|
+
function defineIteratorMethods(prototype) {
|
|
146
|
+
["next", "throw", "return"].forEach(function(method) {
|
|
147
|
+
define(prototype, method, function(arg) {
|
|
148
|
+
return this._invoke(method, arg);
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
exports.isGeneratorFunction = function(genFun) {
|
|
154
|
+
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
155
|
+
return ctor
|
|
156
|
+
? ctor === GeneratorFunction ||
|
|
157
|
+
// For the native GeneratorFunction constructor, the best we can
|
|
158
|
+
// do is to check its .name property.
|
|
159
|
+
(ctor.displayName || ctor.name) === "GeneratorFunction"
|
|
160
|
+
: false;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
exports.mark = function(genFun) {
|
|
164
|
+
if (Object.setPrototypeOf) {
|
|
165
|
+
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
166
|
+
} else {
|
|
167
|
+
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
168
|
+
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
169
|
+
}
|
|
170
|
+
genFun.prototype = Object.create(Gp);
|
|
171
|
+
return genFun;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
// Within the body of any async function, `await x` is transformed to
|
|
175
|
+
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
176
|
+
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
177
|
+
// meant to be awaited.
|
|
178
|
+
exports.awrap = function(arg) {
|
|
179
|
+
return { __await: arg };
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
183
|
+
function invoke(method, arg, resolve, reject) {
|
|
184
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
185
|
+
if (record.type === "throw") {
|
|
186
|
+
reject(record.arg);
|
|
187
|
+
} else {
|
|
188
|
+
var result = record.arg;
|
|
189
|
+
var value = result.value;
|
|
190
|
+
if (value &&
|
|
191
|
+
typeof value === "object" &&
|
|
192
|
+
hasOwn.call(value, "__await")) {
|
|
193
|
+
return PromiseImpl.resolve(value.__await).then(function(value) {
|
|
194
|
+
invoke("next", value, resolve, reject);
|
|
195
|
+
}, function(err) {
|
|
196
|
+
invoke("throw", err, resolve, reject);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return PromiseImpl.resolve(value).then(function(unwrapped) {
|
|
201
|
+
// When a yielded Promise is resolved, its final value becomes
|
|
202
|
+
// the .value of the Promise<{value,done}> result for the
|
|
203
|
+
// current iteration.
|
|
204
|
+
result.value = unwrapped;
|
|
205
|
+
resolve(result);
|
|
206
|
+
}, function(error) {
|
|
207
|
+
// If a rejected Promise was yielded, throw the rejection back
|
|
208
|
+
// into the async generator function so it can be handled there.
|
|
209
|
+
return invoke("throw", error, resolve, reject);
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
var previousPromise;
|
|
215
|
+
|
|
216
|
+
function enqueue(method, arg) {
|
|
217
|
+
function callInvokeWithMethodAndArg() {
|
|
218
|
+
return new PromiseImpl(function(resolve, reject) {
|
|
219
|
+
invoke(method, arg, resolve, reject);
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return previousPromise =
|
|
224
|
+
// If enqueue has been called before, then we want to wait until
|
|
225
|
+
// all previous Promises have been resolved before calling invoke,
|
|
226
|
+
// so that results are always delivered in the correct order. If
|
|
227
|
+
// enqueue has not been called before, then it is important to
|
|
228
|
+
// call invoke immediately, without waiting on a callback to fire,
|
|
229
|
+
// so that the async generator function has the opportunity to do
|
|
230
|
+
// any necessary setup in a predictable way. This predictability
|
|
231
|
+
// is why the Promise constructor synchronously invokes its
|
|
232
|
+
// executor callback, and why async functions synchronously
|
|
233
|
+
// execute code before the first await. Since we implement simple
|
|
234
|
+
// async functions in terms of async generators, it is especially
|
|
235
|
+
// important to get this right, even though it requires care.
|
|
236
|
+
previousPromise ? previousPromise.then(
|
|
237
|
+
callInvokeWithMethodAndArg,
|
|
238
|
+
// Avoid propagating failures to Promises returned by later
|
|
239
|
+
// invocations of the iterator.
|
|
240
|
+
callInvokeWithMethodAndArg
|
|
241
|
+
) : callInvokeWithMethodAndArg();
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// Define the unified helper method that is used to implement .next,
|
|
245
|
+
// .throw, and .return (see defineIteratorMethods).
|
|
246
|
+
this._invoke = enqueue;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
defineIteratorMethods(AsyncIterator.prototype);
|
|
250
|
+
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
251
|
+
return this;
|
|
252
|
+
});
|
|
253
|
+
exports.AsyncIterator = AsyncIterator;
|
|
254
|
+
|
|
255
|
+
// Note that simple async functions are implemented on top of
|
|
256
|
+
// AsyncIterator objects; they just return a Promise for the value of
|
|
257
|
+
// the final result produced by the iterator.
|
|
258
|
+
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
259
|
+
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
260
|
+
|
|
261
|
+
var iter = new AsyncIterator(
|
|
262
|
+
wrap(innerFn, outerFn, self, tryLocsList),
|
|
263
|
+
PromiseImpl
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
return exports.isGeneratorFunction(outerFn)
|
|
267
|
+
? iter // If outerFn is a generator, return the full iterator.
|
|
268
|
+
: iter.next().then(function(result) {
|
|
269
|
+
return result.done ? result.value : iter.next();
|
|
270
|
+
});
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
274
|
+
var state = GenStateSuspendedStart;
|
|
275
|
+
|
|
276
|
+
return function invoke(method, arg) {
|
|
277
|
+
if (state === GenStateExecuting) {
|
|
278
|
+
throw new Error("Generator is already running");
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (state === GenStateCompleted) {
|
|
282
|
+
if (method === "throw") {
|
|
283
|
+
throw arg;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// Be forgiving, per 25.3.3.3.3 of the spec:
|
|
287
|
+
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
288
|
+
return doneResult();
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
context.method = method;
|
|
292
|
+
context.arg = arg;
|
|
293
|
+
|
|
294
|
+
while (true) {
|
|
295
|
+
var delegate = context.delegate;
|
|
296
|
+
if (delegate) {
|
|
297
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
298
|
+
if (delegateResult) {
|
|
299
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
300
|
+
return delegateResult;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if (context.method === "next") {
|
|
305
|
+
// Setting context._sent for legacy support of Babel's
|
|
306
|
+
// function.sent implementation.
|
|
307
|
+
context.sent = context._sent = context.arg;
|
|
308
|
+
|
|
309
|
+
} else if (context.method === "throw") {
|
|
310
|
+
if (state === GenStateSuspendedStart) {
|
|
311
|
+
state = GenStateCompleted;
|
|
312
|
+
throw context.arg;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
context.dispatchException(context.arg);
|
|
316
|
+
|
|
317
|
+
} else if (context.method === "return") {
|
|
318
|
+
context.abrupt("return", context.arg);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
state = GenStateExecuting;
|
|
322
|
+
|
|
323
|
+
var record = tryCatch(innerFn, self, context);
|
|
324
|
+
if (record.type === "normal") {
|
|
325
|
+
// If an exception is thrown from innerFn, we leave state ===
|
|
326
|
+
// GenStateExecuting and loop back for another invocation.
|
|
327
|
+
state = context.done
|
|
328
|
+
? GenStateCompleted
|
|
329
|
+
: GenStateSuspendedYield;
|
|
330
|
+
|
|
331
|
+
if (record.arg === ContinueSentinel) {
|
|
332
|
+
continue;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return {
|
|
336
|
+
value: record.arg,
|
|
337
|
+
done: context.done
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
} else if (record.type === "throw") {
|
|
341
|
+
state = GenStateCompleted;
|
|
342
|
+
// Dispatch the exception by looping back around to the
|
|
343
|
+
// context.dispatchException(context.arg) call above.
|
|
344
|
+
context.method = "throw";
|
|
345
|
+
context.arg = record.arg;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// Call delegate.iterator[context.method](context.arg) and handle the
|
|
352
|
+
// result, either by returning a { value, done } result from the
|
|
353
|
+
// delegate iterator, or by modifying context.method and context.arg,
|
|
354
|
+
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
355
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
356
|
+
var method = delegate.iterator[context.method];
|
|
357
|
+
if (method === undefined$1) {
|
|
358
|
+
// A .throw or .return when the delegate iterator has no .throw
|
|
359
|
+
// method always terminates the yield* loop.
|
|
360
|
+
context.delegate = null;
|
|
361
|
+
|
|
362
|
+
if (context.method === "throw") {
|
|
363
|
+
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
364
|
+
if (delegate.iterator["return"]) {
|
|
365
|
+
// If the delegate iterator has a return method, give it a
|
|
366
|
+
// chance to clean up.
|
|
367
|
+
context.method = "return";
|
|
368
|
+
context.arg = undefined$1;
|
|
369
|
+
maybeInvokeDelegate(delegate, context);
|
|
370
|
+
|
|
371
|
+
if (context.method === "throw") {
|
|
372
|
+
// If maybeInvokeDelegate(context) changed context.method from
|
|
373
|
+
// "return" to "throw", let that override the TypeError below.
|
|
374
|
+
return ContinueSentinel;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
context.method = "throw";
|
|
379
|
+
context.arg = new TypeError(
|
|
380
|
+
"The iterator does not provide a 'throw' method");
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
return ContinueSentinel;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
387
|
+
|
|
388
|
+
if (record.type === "throw") {
|
|
389
|
+
context.method = "throw";
|
|
390
|
+
context.arg = record.arg;
|
|
391
|
+
context.delegate = null;
|
|
392
|
+
return ContinueSentinel;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
var info = record.arg;
|
|
396
|
+
|
|
397
|
+
if (! info) {
|
|
398
|
+
context.method = "throw";
|
|
399
|
+
context.arg = new TypeError("iterator result is not an object");
|
|
400
|
+
context.delegate = null;
|
|
401
|
+
return ContinueSentinel;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
if (info.done) {
|
|
405
|
+
// Assign the result of the finished delegate to the temporary
|
|
406
|
+
// variable specified by delegate.resultName (see delegateYield).
|
|
407
|
+
context[delegate.resultName] = info.value;
|
|
408
|
+
|
|
409
|
+
// Resume execution at the desired location (see delegateYield).
|
|
410
|
+
context.next = delegate.nextLoc;
|
|
411
|
+
|
|
412
|
+
// If context.method was "throw" but the delegate handled the
|
|
413
|
+
// exception, let the outer generator proceed normally. If
|
|
414
|
+
// context.method was "next", forget context.arg since it has been
|
|
415
|
+
// "consumed" by the delegate iterator. If context.method was
|
|
416
|
+
// "return", allow the original .return call to continue in the
|
|
417
|
+
// outer generator.
|
|
418
|
+
if (context.method !== "return") {
|
|
419
|
+
context.method = "next";
|
|
420
|
+
context.arg = undefined$1;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
} else {
|
|
424
|
+
// Re-yield the result returned by the delegate method.
|
|
425
|
+
return info;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// The delegate iterator is finished, so forget it and continue with
|
|
429
|
+
// the outer generator.
|
|
430
|
+
context.delegate = null;
|
|
431
|
+
return ContinueSentinel;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// Define Generator.prototype.{next,throw,return} in terms of the
|
|
435
|
+
// unified ._invoke helper method.
|
|
436
|
+
defineIteratorMethods(Gp);
|
|
437
|
+
|
|
438
|
+
define(Gp, toStringTagSymbol, "Generator");
|
|
439
|
+
|
|
440
|
+
// A Generator should always return itself as the iterator object when the
|
|
441
|
+
// @@iterator function is called on it. Some browsers' implementations of the
|
|
442
|
+
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
443
|
+
// object to not be returned from this call. This ensures that doesn't happen.
|
|
444
|
+
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
445
|
+
define(Gp, iteratorSymbol, function() {
|
|
446
|
+
return this;
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
define(Gp, "toString", function() {
|
|
450
|
+
return "[object Generator]";
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
function pushTryEntry(locs) {
|
|
454
|
+
var entry = { tryLoc: locs[0] };
|
|
455
|
+
|
|
456
|
+
if (1 in locs) {
|
|
457
|
+
entry.catchLoc = locs[1];
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
if (2 in locs) {
|
|
461
|
+
entry.finallyLoc = locs[2];
|
|
462
|
+
entry.afterLoc = locs[3];
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
this.tryEntries.push(entry);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
function resetTryEntry(entry) {
|
|
469
|
+
var record = entry.completion || {};
|
|
470
|
+
record.type = "normal";
|
|
471
|
+
delete record.arg;
|
|
472
|
+
entry.completion = record;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
function Context(tryLocsList) {
|
|
476
|
+
// The root entry object (effectively a try statement without a catch
|
|
477
|
+
// or a finally block) gives us a place to store values thrown from
|
|
478
|
+
// locations where there is no enclosing try statement.
|
|
479
|
+
this.tryEntries = [{ tryLoc: "root" }];
|
|
480
|
+
tryLocsList.forEach(pushTryEntry, this);
|
|
481
|
+
this.reset(true);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
exports.keys = function(object) {
|
|
485
|
+
var keys = [];
|
|
486
|
+
for (var key in object) {
|
|
487
|
+
keys.push(key);
|
|
488
|
+
}
|
|
489
|
+
keys.reverse();
|
|
490
|
+
|
|
491
|
+
// Rather than returning an object with a next method, we keep
|
|
492
|
+
// things simple and return the next function itself.
|
|
493
|
+
return function next() {
|
|
494
|
+
while (keys.length) {
|
|
495
|
+
var key = keys.pop();
|
|
496
|
+
if (key in object) {
|
|
497
|
+
next.value = key;
|
|
498
|
+
next.done = false;
|
|
499
|
+
return next;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
// To avoid creating an additional object, we just hang the .value
|
|
504
|
+
// and .done properties off the next function object itself. This
|
|
505
|
+
// also ensures that the minifier will not anonymize the function.
|
|
506
|
+
next.done = true;
|
|
507
|
+
return next;
|
|
508
|
+
};
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
function values(iterable) {
|
|
512
|
+
if (iterable) {
|
|
513
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
514
|
+
if (iteratorMethod) {
|
|
515
|
+
return iteratorMethod.call(iterable);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
if (typeof iterable.next === "function") {
|
|
519
|
+
return iterable;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
if (!isNaN(iterable.length)) {
|
|
523
|
+
var i = -1, next = function next() {
|
|
524
|
+
while (++i < iterable.length) {
|
|
525
|
+
if (hasOwn.call(iterable, i)) {
|
|
526
|
+
next.value = iterable[i];
|
|
527
|
+
next.done = false;
|
|
528
|
+
return next;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
next.value = undefined$1;
|
|
533
|
+
next.done = true;
|
|
534
|
+
|
|
535
|
+
return next;
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
return next.next = next;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
// Return an iterator with no values.
|
|
543
|
+
return { next: doneResult };
|
|
544
|
+
}
|
|
545
|
+
exports.values = values;
|
|
546
|
+
|
|
547
|
+
function doneResult() {
|
|
548
|
+
return { value: undefined$1, done: true };
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
Context.prototype = {
|
|
552
|
+
constructor: Context,
|
|
553
|
+
|
|
554
|
+
reset: function(skipTempReset) {
|
|
555
|
+
this.prev = 0;
|
|
556
|
+
this.next = 0;
|
|
557
|
+
// Resetting context._sent for legacy support of Babel's
|
|
558
|
+
// function.sent implementation.
|
|
559
|
+
this.sent = this._sent = undefined$1;
|
|
560
|
+
this.done = false;
|
|
561
|
+
this.delegate = null;
|
|
562
|
+
|
|
563
|
+
this.method = "next";
|
|
564
|
+
this.arg = undefined$1;
|
|
565
|
+
|
|
566
|
+
this.tryEntries.forEach(resetTryEntry);
|
|
567
|
+
|
|
568
|
+
if (!skipTempReset) {
|
|
569
|
+
for (var name in this) {
|
|
570
|
+
// Not sure about the optimal order of these conditions:
|
|
571
|
+
if (name.charAt(0) === "t" &&
|
|
572
|
+
hasOwn.call(this, name) &&
|
|
573
|
+
!isNaN(+name.slice(1))) {
|
|
574
|
+
this[name] = undefined$1;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
},
|
|
579
|
+
|
|
580
|
+
stop: function() {
|
|
581
|
+
this.done = true;
|
|
582
|
+
|
|
583
|
+
var rootEntry = this.tryEntries[0];
|
|
584
|
+
var rootRecord = rootEntry.completion;
|
|
585
|
+
if (rootRecord.type === "throw") {
|
|
586
|
+
throw rootRecord.arg;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
return this.rval;
|
|
590
|
+
},
|
|
591
|
+
|
|
592
|
+
dispatchException: function(exception) {
|
|
593
|
+
if (this.done) {
|
|
594
|
+
throw exception;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
var context = this;
|
|
598
|
+
function handle(loc, caught) {
|
|
599
|
+
record.type = "throw";
|
|
600
|
+
record.arg = exception;
|
|
601
|
+
context.next = loc;
|
|
602
|
+
|
|
603
|
+
if (caught) {
|
|
604
|
+
// If the dispatched exception was caught by a catch block,
|
|
605
|
+
// then let that catch block handle the exception normally.
|
|
606
|
+
context.method = "next";
|
|
607
|
+
context.arg = undefined$1;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
return !! caught;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
614
|
+
var entry = this.tryEntries[i];
|
|
615
|
+
var record = entry.completion;
|
|
616
|
+
|
|
617
|
+
if (entry.tryLoc === "root") {
|
|
618
|
+
// Exception thrown outside of any try block that could handle
|
|
619
|
+
// it, so set the completion value of the entire function to
|
|
620
|
+
// throw the exception.
|
|
621
|
+
return handle("end");
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
if (entry.tryLoc <= this.prev) {
|
|
625
|
+
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
626
|
+
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
627
|
+
|
|
628
|
+
if (hasCatch && hasFinally) {
|
|
629
|
+
if (this.prev < entry.catchLoc) {
|
|
630
|
+
return handle(entry.catchLoc, true);
|
|
631
|
+
} else if (this.prev < entry.finallyLoc) {
|
|
632
|
+
return handle(entry.finallyLoc);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
} else if (hasCatch) {
|
|
636
|
+
if (this.prev < entry.catchLoc) {
|
|
637
|
+
return handle(entry.catchLoc, true);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
} else if (hasFinally) {
|
|
641
|
+
if (this.prev < entry.finallyLoc) {
|
|
642
|
+
return handle(entry.finallyLoc);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
} else {
|
|
646
|
+
throw new Error("try statement without catch or finally");
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
},
|
|
651
|
+
|
|
652
|
+
abrupt: function(type, arg) {
|
|
653
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
654
|
+
var entry = this.tryEntries[i];
|
|
655
|
+
if (entry.tryLoc <= this.prev &&
|
|
656
|
+
hasOwn.call(entry, "finallyLoc") &&
|
|
657
|
+
this.prev < entry.finallyLoc) {
|
|
658
|
+
var finallyEntry = entry;
|
|
659
|
+
break;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
if (finallyEntry &&
|
|
664
|
+
(type === "break" ||
|
|
665
|
+
type === "continue") &&
|
|
666
|
+
finallyEntry.tryLoc <= arg &&
|
|
667
|
+
arg <= finallyEntry.finallyLoc) {
|
|
668
|
+
// Ignore the finally entry if control is not jumping to a
|
|
669
|
+
// location outside the try/catch block.
|
|
670
|
+
finallyEntry = null;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
674
|
+
record.type = type;
|
|
675
|
+
record.arg = arg;
|
|
676
|
+
|
|
677
|
+
if (finallyEntry) {
|
|
678
|
+
this.method = "next";
|
|
679
|
+
this.next = finallyEntry.finallyLoc;
|
|
680
|
+
return ContinueSentinel;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
return this.complete(record);
|
|
684
|
+
},
|
|
685
|
+
|
|
686
|
+
complete: function(record, afterLoc) {
|
|
687
|
+
if (record.type === "throw") {
|
|
688
|
+
throw record.arg;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
if (record.type === "break" ||
|
|
692
|
+
record.type === "continue") {
|
|
693
|
+
this.next = record.arg;
|
|
694
|
+
} else if (record.type === "return") {
|
|
695
|
+
this.rval = this.arg = record.arg;
|
|
696
|
+
this.method = "return";
|
|
697
|
+
this.next = "end";
|
|
698
|
+
} else if (record.type === "normal" && afterLoc) {
|
|
699
|
+
this.next = afterLoc;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
return ContinueSentinel;
|
|
703
|
+
},
|
|
704
|
+
|
|
705
|
+
finish: function(finallyLoc) {
|
|
706
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
707
|
+
var entry = this.tryEntries[i];
|
|
708
|
+
if (entry.finallyLoc === finallyLoc) {
|
|
709
|
+
this.complete(entry.completion, entry.afterLoc);
|
|
710
|
+
resetTryEntry(entry);
|
|
711
|
+
return ContinueSentinel;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
},
|
|
715
|
+
|
|
716
|
+
"catch": function(tryLoc) {
|
|
717
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
718
|
+
var entry = this.tryEntries[i];
|
|
719
|
+
if (entry.tryLoc === tryLoc) {
|
|
720
|
+
var record = entry.completion;
|
|
721
|
+
if (record.type === "throw") {
|
|
722
|
+
var thrown = record.arg;
|
|
723
|
+
resetTryEntry(entry);
|
|
724
|
+
}
|
|
725
|
+
return thrown;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
// The context.catch method must only be called with a location
|
|
730
|
+
// argument that corresponds to a known catch block.
|
|
731
|
+
throw new Error("illegal catch attempt");
|
|
732
|
+
},
|
|
733
|
+
|
|
734
|
+
delegateYield: function(iterable, resultName, nextLoc) {
|
|
735
|
+
this.delegate = {
|
|
736
|
+
iterator: values(iterable),
|
|
737
|
+
resultName: resultName,
|
|
738
|
+
nextLoc: nextLoc
|
|
739
|
+
};
|
|
740
|
+
|
|
741
|
+
if (this.method === "next") {
|
|
742
|
+
// Deliberately forget the last sent value so that we don't
|
|
743
|
+
// accidentally pass it on to the delegate.
|
|
744
|
+
this.arg = undefined$1;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
return ContinueSentinel;
|
|
748
|
+
}
|
|
749
|
+
};
|
|
750
|
+
|
|
751
|
+
// Regardless of whether this script is executing as a CommonJS module
|
|
752
|
+
// or not, return the runtime object so that we can declare the variable
|
|
753
|
+
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
754
|
+
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
755
|
+
return exports;
|
|
756
|
+
|
|
757
|
+
}(
|
|
758
|
+
// If this script is executing as a CommonJS module, use module.exports
|
|
759
|
+
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
760
|
+
// object. Either way, the resulting object will be used to initialize
|
|
761
|
+
// the regeneratorRuntime variable at the top of this file.
|
|
762
|
+
module.exports
|
|
763
|
+
));
|
|
764
|
+
|
|
765
|
+
try {
|
|
766
|
+
regeneratorRuntime = runtime;
|
|
767
|
+
} catch (accidentalStrictMode) {
|
|
768
|
+
// This module should not be running in strict mode, so the above
|
|
769
|
+
// assignment should always work unless something is misconfigured. Just
|
|
770
|
+
// in case runtime.js accidentally runs in strict mode, in modern engines
|
|
771
|
+
// we can explicitly access globalThis. In older engines we can escape
|
|
772
|
+
// strict mode using a global Function call. This could conceivably fail
|
|
773
|
+
// if a Content Security Policy forbids using Function, but in that case
|
|
774
|
+
// the proper solution is to fix the accidental strict mode problem. If
|
|
775
|
+
// you've misconfigured your bundler to force strict mode and applied a
|
|
776
|
+
// CSP to forbid Function, and you're not willing to fix either of those
|
|
777
|
+
// problems, please detail your unique predicament in a GitHub issue.
|
|
778
|
+
if (typeof globalThis === "object") {
|
|
779
|
+
globalThis.regeneratorRuntime = runtime;
|
|
780
|
+
} else {
|
|
781
|
+
Function("r", "regeneratorRuntime = r")(runtime);
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
});
|
|
785
|
+
|
|
786
|
+
var regenerator = runtime_1;
|
|
787
|
+
|
|
788
|
+
var arrayWithHoles = _commonjsHelpers.createCommonjsModule(function (module) {
|
|
789
|
+
function _arrayWithHoles(arr) {
|
|
790
|
+
if (Array.isArray(arr)) return arr;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
module.exports = _arrayWithHoles;
|
|
794
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
795
|
+
});
|
|
796
|
+
|
|
797
|
+
_commonjsHelpers.unwrapExports(arrayWithHoles);
|
|
798
|
+
|
|
799
|
+
var iterableToArrayLimit = _commonjsHelpers.createCommonjsModule(function (module) {
|
|
800
|
+
function _iterableToArrayLimit(arr, i) {
|
|
801
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
802
|
+
|
|
803
|
+
if (_i == null) return;
|
|
804
|
+
var _arr = [];
|
|
805
|
+
var _n = true;
|
|
806
|
+
var _d = false;
|
|
807
|
+
|
|
808
|
+
var _s, _e;
|
|
809
|
+
|
|
810
|
+
try {
|
|
811
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
812
|
+
_arr.push(_s.value);
|
|
813
|
+
|
|
814
|
+
if (i && _arr.length === i) break;
|
|
815
|
+
}
|
|
816
|
+
} catch (err) {
|
|
817
|
+
_d = true;
|
|
818
|
+
_e = err;
|
|
819
|
+
} finally {
|
|
820
|
+
try {
|
|
821
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
822
|
+
} finally {
|
|
823
|
+
if (_d) throw _e;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
return _arr;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
module.exports = _iterableToArrayLimit;
|
|
831
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
832
|
+
});
|
|
833
|
+
|
|
834
|
+
_commonjsHelpers.unwrapExports(iterableToArrayLimit);
|
|
835
|
+
|
|
836
|
+
var arrayLikeToArray = _commonjsHelpers.createCommonjsModule(function (module) {
|
|
837
|
+
function _arrayLikeToArray(arr, len) {
|
|
838
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
839
|
+
|
|
840
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
841
|
+
arr2[i] = arr[i];
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
return arr2;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
module.exports = _arrayLikeToArray;
|
|
848
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
849
|
+
});
|
|
850
|
+
|
|
851
|
+
_commonjsHelpers.unwrapExports(arrayLikeToArray);
|
|
852
|
+
|
|
853
|
+
var unsupportedIterableToArray = _commonjsHelpers.createCommonjsModule(function (module) {
|
|
854
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
855
|
+
if (!o) return;
|
|
856
|
+
if (typeof o === "string") return arrayLikeToArray(o, minLen);
|
|
857
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
858
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
859
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
860
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
module.exports = _unsupportedIterableToArray;
|
|
864
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
865
|
+
});
|
|
866
|
+
|
|
867
|
+
_commonjsHelpers.unwrapExports(unsupportedIterableToArray);
|
|
868
|
+
|
|
869
|
+
var nonIterableRest = _commonjsHelpers.createCommonjsModule(function (module) {
|
|
870
|
+
function _nonIterableRest() {
|
|
871
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
module.exports = _nonIterableRest;
|
|
875
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
876
|
+
});
|
|
877
|
+
|
|
878
|
+
_commonjsHelpers.unwrapExports(nonIterableRest);
|
|
879
|
+
|
|
880
|
+
var slicedToArray = _commonjsHelpers.createCommonjsModule(function (module) {
|
|
881
|
+
function _slicedToArray(arr, i) {
|
|
882
|
+
return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
module.exports = _slicedToArray;
|
|
886
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
887
|
+
});
|
|
888
|
+
|
|
889
|
+
_commonjsHelpers.unwrapExports(slicedToArray);
|
|
890
|
+
|
|
15
891
|
var logger = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
16
892
|
|
|
17
893
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -20,39 +896,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
20
896
|
exports.setLogger = setLogger;
|
|
21
897
|
exports.proxyLogger = proxyLogger;
|
|
22
898
|
exports.default = void 0;
|
|
23
|
-
|
|
24
|
-
error(code) {
|
|
25
|
-
|
|
26
|
-
message[_key - 1] = arguments[_key];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
console.error("[next-auth][error][".concat(code.toLowerCase(), "]"), "\nhttps://next-auth.js.org/errors#".concat(code.toLowerCase()), ...message);
|
|
899
|
+
const _logger = {
|
|
900
|
+
error(code, ...message) {
|
|
901
|
+
console.error(`[next-auth][error][${code.toLowerCase()}]`, `\nhttps://next-auth.js.org/errors#${code.toLowerCase()}`, ...message);
|
|
30
902
|
},
|
|
31
903
|
|
|
32
|
-
warn(code) {
|
|
33
|
-
|
|
34
|
-
message[_key2 - 1] = arguments[_key2];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
console.warn("[next-auth][warn][".concat(code.toLowerCase(), "]"), "\nhttps://next-auth.js.org/warnings#".concat(code.toLowerCase()), ...message);
|
|
904
|
+
warn(code, ...message) {
|
|
905
|
+
console.warn(`[next-auth][warn][${code.toLowerCase()}]`, `\nhttps://next-auth.js.org/warnings#${code.toLowerCase()}`, ...message);
|
|
38
906
|
},
|
|
39
907
|
|
|
40
|
-
debug(code) {
|
|
908
|
+
debug(code, ...message) {
|
|
41
909
|
var _process, _process$env;
|
|
42
910
|
|
|
43
911
|
if (!((_process = process) !== null && _process !== void 0 && (_process$env = _process.env) !== null && _process$env !== void 0 && _process$env._NEXTAUTH_DEBUG)) return;
|
|
44
|
-
|
|
45
|
-
for (var _len3 = arguments.length, message = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
46
|
-
message[_key3 - 1] = arguments[_key3];
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
console.log("[next-auth][debug][".concat(code.toLowerCase(), "]"), ...message);
|
|
912
|
+
console.log(`[next-auth][debug][${code.toLowerCase()}]`, ...message);
|
|
50
913
|
}
|
|
51
914
|
|
|
52
915
|
};
|
|
53
916
|
|
|
54
|
-
function setLogger() {
|
|
55
|
-
var newLogger = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
917
|
+
function setLogger(newLogger = {}) {
|
|
56
918
|
if (newLogger.error) _logger.error = newLogger.error;
|
|
57
919
|
if (newLogger.warn) _logger.warn = newLogger.warn;
|
|
58
920
|
if (newLogger.debug) _logger.debug = newLogger.debug;
|
|
@@ -61,27 +923,20 @@ function setLogger() {
|
|
|
61
923
|
var _default = _logger;
|
|
62
924
|
exports.default = _default;
|
|
63
925
|
|
|
64
|
-
function proxyLogger() {
|
|
65
|
-
var logger = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _logger;
|
|
66
|
-
var basePath = arguments.length > 1 ? arguments[1] : undefined;
|
|
67
|
-
|
|
926
|
+
function proxyLogger(logger = _logger, basePath) {
|
|
68
927
|
try {
|
|
69
|
-
if (typeof window ===
|
|
928
|
+
if (typeof window === "undefined") {
|
|
70
929
|
return logger;
|
|
71
930
|
}
|
|
72
931
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
var _loop = function _loop(level) {
|
|
76
|
-
clientLogger[level] = function (code) {
|
|
77
|
-
for (var _len4 = arguments.length, message = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
78
|
-
message[_key4 - 1] = arguments[_key4];
|
|
79
|
-
}
|
|
932
|
+
const clientLogger = {};
|
|
80
933
|
|
|
934
|
+
for (const level in logger) {
|
|
935
|
+
clientLogger[level] = (code, ...message) => {
|
|
81
936
|
_logger[level](code, ...message);
|
|
82
937
|
|
|
83
|
-
|
|
84
|
-
|
|
938
|
+
const url = `${basePath}/_log`;
|
|
939
|
+
const body = new URLSearchParams({
|
|
85
940
|
level,
|
|
86
941
|
code,
|
|
87
942
|
message: JSON.stringify(message.map(m => {
|
|
@@ -102,17 +957,13 @@ function proxyLogger() {
|
|
|
102
957
|
}
|
|
103
958
|
|
|
104
959
|
return fetch(url, {
|
|
105
|
-
method:
|
|
960
|
+
method: "POST",
|
|
106
961
|
headers: {
|
|
107
|
-
|
|
962
|
+
"Content-Type": "application/json"
|
|
108
963
|
},
|
|
109
964
|
body
|
|
110
965
|
});
|
|
111
966
|
};
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
for (var level in logger) {
|
|
115
|
-
_loop(level);
|
|
116
967
|
}
|
|
117
968
|
|
|
118
969
|
return clientLogger;
|
|
@@ -134,18 +985,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
134
985
|
exports.default = parseUrl;
|
|
135
986
|
|
|
136
987
|
function parseUrl(url) {
|
|
137
|
-
|
|
138
|
-
|
|
988
|
+
const defaultHost = 'http://localhost:3000';
|
|
989
|
+
const defaultPath = '/api/auth';
|
|
139
990
|
|
|
140
991
|
if (!url) {
|
|
141
|
-
url =
|
|
992
|
+
url = `${defaultHost}${defaultPath}`;
|
|
142
993
|
}
|
|
143
994
|
|
|
144
|
-
|
|
995
|
+
const protocol = url.startsWith('http:') ? 'http' : 'https';
|
|
145
996
|
url = url.replace(/^https?:\/\//, '').replace(/\/$/, '');
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
997
|
+
const [_host, ..._path] = url.split('/');
|
|
998
|
+
const baseUrl = _host ? `${protocol}://${_host}` : defaultHost;
|
|
999
|
+
const basePath = _path.length > 0 ? `/${_path.join('/')}` : defaultPath;
|
|
149
1000
|
return {
|
|
150
1001
|
baseUrl,
|
|
151
1002
|
basePath
|
|
@@ -157,39 +1008,44 @@ _commonjsHelpers.unwrapExports(parseUrl_1);
|
|
|
157
1008
|
|
|
158
1009
|
var client$1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
159
1010
|
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
|
|
160
1015
|
Object.defineProperty(exports, "__esModule", {
|
|
161
1016
|
value: true
|
|
162
1017
|
});
|
|
163
1018
|
exports.useSession = useSession;
|
|
164
|
-
exports.getSession = getSession;
|
|
165
|
-
exports.
|
|
166
|
-
exports.
|
|
167
|
-
exports.
|
|
168
|
-
exports.
|
|
1019
|
+
exports.session = exports.getSession = getSession;
|
|
1020
|
+
exports.csrfToken = exports.getCsrfToken = getCsrfToken;
|
|
1021
|
+
exports.providers = exports.getProviders = getProviders;
|
|
1022
|
+
exports.signin = exports.signIn = signIn;
|
|
1023
|
+
exports.signout = exports.signOut = signOut;
|
|
1024
|
+
exports.options = exports.setOptions = setOptions;
|
|
169
1025
|
exports.Provider = Provider;
|
|
170
1026
|
exports.default = void 0;
|
|
171
1027
|
|
|
1028
|
+
var _regenerator = interopRequireDefault(regenerator);
|
|
172
1029
|
|
|
1030
|
+
var _defineProperty2 = interopRequireDefault(defineProperty.defineProperty);
|
|
173
1031
|
|
|
174
|
-
var
|
|
1032
|
+
var _asyncToGenerator2 = interopRequireDefault(defineProperty.asyncToGenerator);
|
|
175
1033
|
|
|
176
|
-
var
|
|
1034
|
+
var _slicedToArray2 = interopRequireDefault(slicedToArray);
|
|
177
1035
|
|
|
178
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
179
1036
|
|
|
180
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
181
1037
|
|
|
182
|
-
|
|
1038
|
+
var _logger2 = _interopRequireWildcard(logger);
|
|
183
1039
|
|
|
184
|
-
|
|
1040
|
+
var _parseUrl = interopRequireDefault(parseUrl_1);
|
|
185
1041
|
|
|
186
|
-
function
|
|
1042
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
187
1043
|
|
|
188
|
-
function
|
|
1044
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof._typeof_1(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
189
1045
|
|
|
190
|
-
function
|
|
1046
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
191
1047
|
|
|
192
|
-
function
|
|
1048
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
193
1049
|
|
|
194
1050
|
var __NEXTAUTH = {
|
|
195
1051
|
baseUrl: (0, _parseUrl.default)(process.env.NEXTAUTH_URL || process.env.VERCEL_URL).baseUrl,
|
|
@@ -202,19 +1058,21 @@ var __NEXTAUTH = {
|
|
|
202
1058
|
_clientSyncTimer: null,
|
|
203
1059
|
_eventListenersAdded: false,
|
|
204
1060
|
_clientSession: undefined,
|
|
205
|
-
_getSession: ()
|
|
1061
|
+
_getSession: function _getSession() {}
|
|
206
1062
|
};
|
|
207
1063
|
var logger$1 = (0, _logger2.proxyLogger)(_logger2.default, __NEXTAUTH.basePath);
|
|
208
1064
|
var broadcast = BroadcastChannel();
|
|
209
1065
|
|
|
210
|
-
if (typeof window !==
|
|
1066
|
+
if (typeof window !== "undefined" && !__NEXTAUTH._eventListenersAdded) {
|
|
211
1067
|
__NEXTAUTH._eventListenersAdded = true;
|
|
212
|
-
broadcast.receive(()
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
1068
|
+
broadcast.receive(function () {
|
|
1069
|
+
return __NEXTAUTH._getSession({
|
|
1070
|
+
event: "storage"
|
|
1071
|
+
});
|
|
1072
|
+
});
|
|
1073
|
+
document.addEventListener("visibilitychange", function () {
|
|
216
1074
|
!document.hidden && __NEXTAUTH._getSession({
|
|
217
|
-
event:
|
|
1075
|
+
event: "visibilitychange"
|
|
218
1076
|
});
|
|
219
1077
|
}, false);
|
|
220
1078
|
}
|
|
@@ -228,50 +1086,103 @@ function useSession(session) {
|
|
|
228
1086
|
}
|
|
229
1087
|
|
|
230
1088
|
function _useSessionHook(session) {
|
|
231
|
-
var
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
1089
|
+
var _useState = (0, React__default["default"].useState)(session),
|
|
1090
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
1091
|
+
data = _useState2[0],
|
|
1092
|
+
setData = _useState2[1];
|
|
1093
|
+
|
|
1094
|
+
var _useState3 = (0, React__default["default"].useState)(!data),
|
|
1095
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
1096
|
+
loading = _useState4[0],
|
|
1097
|
+
setLoading = _useState4[1];
|
|
1098
|
+
|
|
1099
|
+
(0, React__default["default"].useEffect)(function () {
|
|
1100
|
+
__NEXTAUTH._getSession = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee() {
|
|
1101
|
+
var _ref2,
|
|
1102
|
+
_ref2$event,
|
|
1103
|
+
event,
|
|
1104
|
+
triggredByEvent,
|
|
1105
|
+
triggeredByStorageEvent,
|
|
1106
|
+
clientMaxAge,
|
|
1107
|
+
clientLastSync,
|
|
1108
|
+
currentTime,
|
|
1109
|
+
clientSession,
|
|
1110
|
+
newClientSessionData,
|
|
1111
|
+
_args = arguments;
|
|
1112
|
+
|
|
1113
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
1114
|
+
while (1) {
|
|
1115
|
+
switch (_context.prev = _context.next) {
|
|
1116
|
+
case 0:
|
|
1117
|
+
_ref2 = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, _ref2$event = _ref2.event, event = _ref2$event === void 0 ? null : _ref2$event;
|
|
1118
|
+
_context.prev = 1;
|
|
1119
|
+
triggredByEvent = event !== null;
|
|
1120
|
+
triggeredByStorageEvent = event === "storage";
|
|
1121
|
+
clientMaxAge = __NEXTAUTH.clientMaxAge;
|
|
1122
|
+
clientLastSync = parseInt(__NEXTAUTH._clientLastSync);
|
|
1123
|
+
currentTime = _now();
|
|
1124
|
+
clientSession = __NEXTAUTH._clientSession;
|
|
1125
|
+
|
|
1126
|
+
if (!(!triggeredByStorageEvent && clientSession !== undefined)) {
|
|
1127
|
+
_context.next = 19;
|
|
1128
|
+
break;
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
if (!(clientMaxAge === 0 && triggredByEvent !== true)) {
|
|
1132
|
+
_context.next = 13;
|
|
1133
|
+
break;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
return _context.abrupt("return");
|
|
1137
|
+
|
|
1138
|
+
case 13:
|
|
1139
|
+
if (!(clientMaxAge > 0 && clientSession === null)) {
|
|
1140
|
+
_context.next = 17;
|
|
1141
|
+
break;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
return _context.abrupt("return");
|
|
1145
|
+
|
|
1146
|
+
case 17:
|
|
1147
|
+
if (!(clientMaxAge > 0 && currentTime < clientLastSync + clientMaxAge)) {
|
|
1148
|
+
_context.next = 19;
|
|
1149
|
+
break;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
return _context.abrupt("return");
|
|
1153
|
+
|
|
1154
|
+
case 19:
|
|
1155
|
+
if (clientSession === undefined) {
|
|
1156
|
+
__NEXTAUTH._clientSession = null;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
__NEXTAUTH._clientLastSync = _now();
|
|
1160
|
+
_context.next = 23;
|
|
1161
|
+
return getSession({
|
|
1162
|
+
triggerEvent: !triggeredByStorageEvent
|
|
1163
|
+
});
|
|
1164
|
+
|
|
1165
|
+
case 23:
|
|
1166
|
+
newClientSessionData = _context.sent;
|
|
1167
|
+
__NEXTAUTH._clientSession = newClientSessionData;
|
|
1168
|
+
setData(newClientSessionData);
|
|
1169
|
+
setLoading(false);
|
|
1170
|
+
_context.next = 33;
|
|
1171
|
+
break;
|
|
1172
|
+
|
|
1173
|
+
case 29:
|
|
1174
|
+
_context.prev = 29;
|
|
1175
|
+
_context.t0 = _context["catch"](1);
|
|
1176
|
+
logger$1.error("CLIENT_USE_SESSION_ERROR", _context.t0);
|
|
1177
|
+
setLoading(false);
|
|
1178
|
+
|
|
1179
|
+
case 33:
|
|
1180
|
+
case "end":
|
|
1181
|
+
return _context.stop();
|
|
256
1182
|
}
|
|
257
1183
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
__NEXTAUTH._clientSession = null;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
__NEXTAUTH._clientLastSync = _now();
|
|
264
|
-
var newClientSessionData = yield getSession({
|
|
265
|
-
triggerEvent: !triggeredByStorageEvent
|
|
266
|
-
});
|
|
267
|
-
__NEXTAUTH._clientSession = newClientSessionData;
|
|
268
|
-
setData(newClientSessionData);
|
|
269
|
-
setLoading(false);
|
|
270
|
-
} catch (error) {
|
|
271
|
-
logger$1.error('CLIENT_USE_SESSION_ERROR', error);
|
|
272
|
-
setLoading(false);
|
|
273
|
-
}
|
|
274
|
-
});
|
|
1184
|
+
}, _callee, null, [[1, 29]]);
|
|
1185
|
+
}));
|
|
275
1186
|
|
|
276
1187
|
__NEXTAUTH._getSession();
|
|
277
1188
|
});
|
|
@@ -283,22 +1194,38 @@ function getSession(_x) {
|
|
|
283
1194
|
}
|
|
284
1195
|
|
|
285
1196
|
function _getSession2() {
|
|
286
|
-
_getSession2 =
|
|
1197
|
+
_getSession2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee4(ctx) {
|
|
287
1198
|
var _ctx$triggerEvent;
|
|
288
1199
|
|
|
289
|
-
var session
|
|
1200
|
+
var session;
|
|
1201
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
1202
|
+
while (1) {
|
|
1203
|
+
switch (_context4.prev = _context4.next) {
|
|
1204
|
+
case 0:
|
|
1205
|
+
_context4.next = 2;
|
|
1206
|
+
return _fetchData("session", ctx);
|
|
1207
|
+
|
|
1208
|
+
case 2:
|
|
1209
|
+
session = _context4.sent;
|
|
1210
|
+
|
|
1211
|
+
if ((_ctx$triggerEvent = ctx === null || ctx === void 0 ? void 0 : ctx.triggerEvent) !== null && _ctx$triggerEvent !== void 0 ? _ctx$triggerEvent : true) {
|
|
1212
|
+
broadcast.post({
|
|
1213
|
+
event: "session",
|
|
1214
|
+
data: {
|
|
1215
|
+
trigger: "getSession"
|
|
1216
|
+
}
|
|
1217
|
+
});
|
|
1218
|
+
}
|
|
290
1219
|
|
|
291
|
-
|
|
292
|
-
broadcast.post({
|
|
293
|
-
event: 'session',
|
|
294
|
-
data: {
|
|
295
|
-
trigger: 'getSession'
|
|
296
|
-
}
|
|
297
|
-
});
|
|
298
|
-
}
|
|
1220
|
+
return _context4.abrupt("return", session);
|
|
299
1221
|
|
|
300
|
-
|
|
301
|
-
|
|
1222
|
+
case 5:
|
|
1223
|
+
case "end":
|
|
1224
|
+
return _context4.stop();
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}, _callee4);
|
|
1228
|
+
}));
|
|
302
1229
|
return _getSession2.apply(this, arguments);
|
|
303
1230
|
}
|
|
304
1231
|
|
|
@@ -307,11 +1234,50 @@ function getCsrfToken(_x2) {
|
|
|
307
1234
|
}
|
|
308
1235
|
|
|
309
1236
|
function _getCsrfToken() {
|
|
310
|
-
_getCsrfToken =
|
|
1237
|
+
_getCsrfToken = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee5(ctx) {
|
|
311
1238
|
var _yield$_fetchData;
|
|
312
1239
|
|
|
313
|
-
return (
|
|
314
|
-
|
|
1240
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
1241
|
+
while (1) {
|
|
1242
|
+
switch (_context5.prev = _context5.next) {
|
|
1243
|
+
case 0:
|
|
1244
|
+
_context5.next = 2;
|
|
1245
|
+
return _fetchData("csrf", ctx);
|
|
1246
|
+
|
|
1247
|
+
case 2:
|
|
1248
|
+
_context5.t1 = _yield$_fetchData = _context5.sent;
|
|
1249
|
+
_context5.t0 = _context5.t1 === null;
|
|
1250
|
+
|
|
1251
|
+
if (_context5.t0) {
|
|
1252
|
+
_context5.next = 6;
|
|
1253
|
+
break;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
_context5.t0 = _yield$_fetchData === void 0;
|
|
1257
|
+
|
|
1258
|
+
case 6:
|
|
1259
|
+
if (!_context5.t0) {
|
|
1260
|
+
_context5.next = 10;
|
|
1261
|
+
break;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
_context5.t2 = void 0;
|
|
1265
|
+
_context5.next = 11;
|
|
1266
|
+
break;
|
|
1267
|
+
|
|
1268
|
+
case 10:
|
|
1269
|
+
_context5.t2 = _yield$_fetchData.csrfToken;
|
|
1270
|
+
|
|
1271
|
+
case 11:
|
|
1272
|
+
return _context5.abrupt("return", _context5.t2);
|
|
1273
|
+
|
|
1274
|
+
case 12:
|
|
1275
|
+
case "end":
|
|
1276
|
+
return _context5.stop();
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
}, _callee5);
|
|
1280
|
+
}));
|
|
315
1281
|
return _getCsrfToken.apply(this, arguments);
|
|
316
1282
|
}
|
|
317
1283
|
|
|
@@ -320,9 +1286,24 @@ function getProviders() {
|
|
|
320
1286
|
}
|
|
321
1287
|
|
|
322
1288
|
function _getProviders() {
|
|
323
|
-
_getProviders =
|
|
324
|
-
return
|
|
325
|
-
|
|
1289
|
+
_getProviders = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee6() {
|
|
1290
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
1291
|
+
while (1) {
|
|
1292
|
+
switch (_context6.prev = _context6.next) {
|
|
1293
|
+
case 0:
|
|
1294
|
+
_context6.next = 2;
|
|
1295
|
+
return _fetchData("providers");
|
|
1296
|
+
|
|
1297
|
+
case 2:
|
|
1298
|
+
return _context6.abrupt("return", _context6.sent);
|
|
1299
|
+
|
|
1300
|
+
case 3:
|
|
1301
|
+
case "end":
|
|
1302
|
+
return _context6.stop();
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
}, _callee6);
|
|
1306
|
+
}));
|
|
326
1307
|
return _getProviders.apply(this, arguments);
|
|
327
1308
|
}
|
|
328
1309
|
|
|
@@ -331,68 +1312,138 @@ function signIn(_x3) {
|
|
|
331
1312
|
}
|
|
332
1313
|
|
|
333
1314
|
function _signIn() {
|
|
334
|
-
_signIn =
|
|
335
|
-
var options
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
callbackUrl = window.location,
|
|
339
|
-
redirect = true
|
|
340
|
-
} = options;
|
|
341
|
-
|
|
342
|
-
var baseUrl = _apiBaseUrl();
|
|
343
|
-
|
|
344
|
-
var providers = yield getProviders();
|
|
345
|
-
|
|
346
|
-
if (!(provider in providers)) {
|
|
347
|
-
window.location = "".concat(baseUrl, "/signin?callbackUrl=").concat(encodeURIComponent(callbackUrl));
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
var isCredentials = providers[provider].type === 'credentials';
|
|
352
|
-
var isEmail = providers[provider].type === 'email';
|
|
353
|
-
var canRedirectBeDisabled = isCredentials || isEmail;
|
|
354
|
-
var signInUrl = isCredentials ? "".concat(baseUrl, "/callback/").concat(provider) : "".concat(baseUrl, "/signin/").concat(provider);
|
|
355
|
-
var fetchOptions = {
|
|
356
|
-
method: 'post',
|
|
357
|
-
headers: {
|
|
358
|
-
'Content-Type': 'application/x-www-form-urlencoded'
|
|
359
|
-
},
|
|
360
|
-
body: new URLSearchParams(_objectSpread(_objectSpread({}, options), {}, {
|
|
361
|
-
csrfToken: yield getCsrfToken(),
|
|
1315
|
+
_signIn = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee7(provider) {
|
|
1316
|
+
var options,
|
|
1317
|
+
authorizationParams,
|
|
1318
|
+
_options$callbackUrl,
|
|
362
1319
|
callbackUrl,
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
1320
|
+
_options$redirect,
|
|
1321
|
+
redirect,
|
|
1322
|
+
baseUrl,
|
|
1323
|
+
providers,
|
|
1324
|
+
isCredentials,
|
|
1325
|
+
isEmail,
|
|
1326
|
+
isSupportingReturn,
|
|
1327
|
+
signInUrl,
|
|
1328
|
+
_signInUrl,
|
|
1329
|
+
res,
|
|
1330
|
+
data,
|
|
1331
|
+
_data$url,
|
|
1332
|
+
url,
|
|
1333
|
+
error,
|
|
1334
|
+
_args7 = arguments;
|
|
1335
|
+
|
|
1336
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
1337
|
+
while (1) {
|
|
1338
|
+
switch (_context7.prev = _context7.next) {
|
|
1339
|
+
case 0:
|
|
1340
|
+
options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
|
|
1341
|
+
authorizationParams = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : {};
|
|
1342
|
+
_options$callbackUrl = options.callbackUrl, callbackUrl = _options$callbackUrl === void 0 ? window.location.href : _options$callbackUrl, _options$redirect = options.redirect, redirect = _options$redirect === void 0 ? true : _options$redirect;
|
|
1343
|
+
baseUrl = _apiBaseUrl();
|
|
1344
|
+
_context7.next = 6;
|
|
1345
|
+
return getProviders();
|
|
1346
|
+
|
|
1347
|
+
case 6:
|
|
1348
|
+
providers = _context7.sent;
|
|
1349
|
+
|
|
1350
|
+
if (providers) {
|
|
1351
|
+
_context7.next = 9;
|
|
1352
|
+
break;
|
|
1353
|
+
}
|
|
366
1354
|
|
|
367
|
-
|
|
1355
|
+
return _context7.abrupt("return", window.location.replace("".concat(baseUrl, "/error")));
|
|
368
1356
|
|
|
369
|
-
|
|
370
|
-
|
|
1357
|
+
case 9:
|
|
1358
|
+
if (provider in providers) {
|
|
1359
|
+
_context7.next = 11;
|
|
1360
|
+
break;
|
|
1361
|
+
}
|
|
371
1362
|
|
|
372
|
-
|
|
373
|
-
|
|
1363
|
+
return _context7.abrupt("return", window.location.replace("".concat(baseUrl, "/signin?callbackUrl=").concat(encodeURIComponent(callbackUrl))));
|
|
1364
|
+
|
|
1365
|
+
case 11:
|
|
1366
|
+
isCredentials = providers[provider].type === "credentials";
|
|
1367
|
+
isEmail = providers[provider].type === "email";
|
|
1368
|
+
isSupportingReturn = isCredentials || isEmail;
|
|
1369
|
+
signInUrl = isCredentials ? "".concat(baseUrl, "/callback/").concat(provider) : "".concat(baseUrl, "/signin/").concat(provider);
|
|
1370
|
+
_signInUrl = "".concat(signInUrl, "?").concat(new URLSearchParams(authorizationParams));
|
|
1371
|
+
_context7.t0 = fetch;
|
|
1372
|
+
_context7.t1 = _signInUrl;
|
|
1373
|
+
_context7.t2 = {
|
|
1374
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1375
|
+
};
|
|
1376
|
+
_context7.t3 = URLSearchParams;
|
|
1377
|
+
_context7.t4 = _objectSpread;
|
|
1378
|
+
_context7.t5 = _objectSpread({}, options);
|
|
1379
|
+
_context7.t6 = {};
|
|
1380
|
+
_context7.next = 25;
|
|
1381
|
+
return getCsrfToken();
|
|
1382
|
+
|
|
1383
|
+
case 25:
|
|
1384
|
+
_context7.t7 = _context7.sent;
|
|
1385
|
+
_context7.t8 = callbackUrl;
|
|
1386
|
+
_context7.t9 = {
|
|
1387
|
+
csrfToken: _context7.t7,
|
|
1388
|
+
callbackUrl: _context7.t8,
|
|
1389
|
+
json: true
|
|
1390
|
+
};
|
|
1391
|
+
_context7.t10 = (0, _context7.t4)(_context7.t5, _context7.t6, _context7.t9);
|
|
1392
|
+
_context7.t11 = new _context7.t3(_context7.t10);
|
|
1393
|
+
_context7.t12 = {
|
|
1394
|
+
method: "post",
|
|
1395
|
+
headers: _context7.t2,
|
|
1396
|
+
body: _context7.t11
|
|
1397
|
+
};
|
|
1398
|
+
_context7.next = 33;
|
|
1399
|
+
return (0, _context7.t0)(_context7.t1, _context7.t12);
|
|
1400
|
+
|
|
1401
|
+
case 33:
|
|
1402
|
+
res = _context7.sent;
|
|
1403
|
+
_context7.next = 36;
|
|
1404
|
+
return res.json();
|
|
1405
|
+
|
|
1406
|
+
case 36:
|
|
1407
|
+
data = _context7.sent;
|
|
1408
|
+
|
|
1409
|
+
if (!(redirect || !isSupportingReturn)) {
|
|
1410
|
+
_context7.next = 42;
|
|
1411
|
+
break;
|
|
1412
|
+
}
|
|
374
1413
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
}
|
|
1414
|
+
url = (_data$url = data.url) !== null && _data$url !== void 0 ? _data$url : callbackUrl;
|
|
1415
|
+
window.location.replace(url);
|
|
1416
|
+
if (url.includes("#")) window.location.reload();
|
|
1417
|
+
return _context7.abrupt("return");
|
|
380
1418
|
|
|
381
|
-
|
|
1419
|
+
case 42:
|
|
1420
|
+
error = new URL(data.url).searchParams.get("error");
|
|
382
1421
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
}
|
|
1422
|
+
if (!res.ok) {
|
|
1423
|
+
_context7.next = 46;
|
|
1424
|
+
break;
|
|
1425
|
+
}
|
|
388
1426
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
1427
|
+
_context7.next = 46;
|
|
1428
|
+
return __NEXTAUTH._getSession({
|
|
1429
|
+
event: "storage"
|
|
1430
|
+
});
|
|
1431
|
+
|
|
1432
|
+
case 46:
|
|
1433
|
+
return _context7.abrupt("return", {
|
|
1434
|
+
error: error,
|
|
1435
|
+
status: res.status,
|
|
1436
|
+
ok: res.ok,
|
|
1437
|
+
url: error ? null : data.url
|
|
1438
|
+
});
|
|
1439
|
+
|
|
1440
|
+
case 47:
|
|
1441
|
+
case "end":
|
|
1442
|
+
return _context7.stop();
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
}, _callee7);
|
|
1446
|
+
}));
|
|
396
1447
|
return _signIn.apply(this, arguments);
|
|
397
1448
|
}
|
|
398
1449
|
|
|
@@ -401,86 +1452,145 @@ function signOut() {
|
|
|
401
1452
|
}
|
|
402
1453
|
|
|
403
1454
|
function _signOut() {
|
|
404
|
-
_signOut =
|
|
405
|
-
var options
|
|
406
|
-
|
|
407
|
-
callbackUrl = window.location,
|
|
408
|
-
redirect = true
|
|
409
|
-
} = options;
|
|
410
|
-
|
|
411
|
-
var baseUrl = _apiBaseUrl();
|
|
412
|
-
|
|
413
|
-
var fetchOptions = {
|
|
414
|
-
method: 'post',
|
|
415
|
-
headers: {
|
|
416
|
-
'Content-Type': 'application/x-www-form-urlencoded'
|
|
417
|
-
},
|
|
418
|
-
body: new URLSearchParams({
|
|
419
|
-
csrfToken: yield getCsrfToken(),
|
|
1455
|
+
_signOut = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee8() {
|
|
1456
|
+
var options,
|
|
1457
|
+
_options$callbackUrl2,
|
|
420
1458
|
callbackUrl,
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
1459
|
+
_options$redirect2,
|
|
1460
|
+
redirect,
|
|
1461
|
+
baseUrl,
|
|
1462
|
+
fetchOptions,
|
|
1463
|
+
res,
|
|
1464
|
+
data,
|
|
1465
|
+
_data$url2,
|
|
1466
|
+
url,
|
|
1467
|
+
_args8 = arguments;
|
|
1468
|
+
|
|
1469
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
1470
|
+
while (1) {
|
|
1471
|
+
switch (_context8.prev = _context8.next) {
|
|
1472
|
+
case 0:
|
|
1473
|
+
options = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
|
|
1474
|
+
_options$callbackUrl2 = options.callbackUrl, callbackUrl = _options$callbackUrl2 === void 0 ? window.location.href : _options$callbackUrl2, _options$redirect2 = options.redirect, redirect = _options$redirect2 === void 0 ? true : _options$redirect2;
|
|
1475
|
+
baseUrl = _apiBaseUrl();
|
|
1476
|
+
_context8.t0 = {
|
|
1477
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1478
|
+
};
|
|
1479
|
+
_context8.t1 = URLSearchParams;
|
|
1480
|
+
_context8.next = 7;
|
|
1481
|
+
return getCsrfToken();
|
|
1482
|
+
|
|
1483
|
+
case 7:
|
|
1484
|
+
_context8.t2 = _context8.sent;
|
|
1485
|
+
_context8.t3 = callbackUrl;
|
|
1486
|
+
_context8.t4 = {
|
|
1487
|
+
csrfToken: _context8.t2,
|
|
1488
|
+
callbackUrl: _context8.t3,
|
|
1489
|
+
json: true
|
|
1490
|
+
};
|
|
1491
|
+
_context8.t5 = new _context8.t1(_context8.t4);
|
|
1492
|
+
fetchOptions = {
|
|
1493
|
+
method: "post",
|
|
1494
|
+
headers: _context8.t0,
|
|
1495
|
+
body: _context8.t5
|
|
1496
|
+
};
|
|
1497
|
+
_context8.next = 14;
|
|
1498
|
+
return fetch("".concat(baseUrl, "/signout"), fetchOptions);
|
|
1499
|
+
|
|
1500
|
+
case 14:
|
|
1501
|
+
res = _context8.sent;
|
|
1502
|
+
_context8.next = 17;
|
|
1503
|
+
return res.json();
|
|
1504
|
+
|
|
1505
|
+
case 17:
|
|
1506
|
+
data = _context8.sent;
|
|
1507
|
+
broadcast.post({
|
|
1508
|
+
event: "session",
|
|
1509
|
+
data: {
|
|
1510
|
+
trigger: "signout"
|
|
1511
|
+
}
|
|
1512
|
+
});
|
|
1513
|
+
|
|
1514
|
+
if (!redirect) {
|
|
1515
|
+
_context8.next = 24;
|
|
1516
|
+
break;
|
|
1517
|
+
}
|
|
432
1518
|
|
|
433
|
-
|
|
434
|
-
|
|
1519
|
+
url = (_data$url2 = data.url) !== null && _data$url2 !== void 0 ? _data$url2 : callbackUrl;
|
|
1520
|
+
window.location.replace(url);
|
|
1521
|
+
if (url.includes("#")) window.location.reload();
|
|
1522
|
+
return _context8.abrupt("return");
|
|
435
1523
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
1524
|
+
case 24:
|
|
1525
|
+
_context8.next = 26;
|
|
1526
|
+
return __NEXTAUTH._getSession({
|
|
1527
|
+
event: "storage"
|
|
1528
|
+
});
|
|
441
1529
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
1530
|
+
case 26:
|
|
1531
|
+
return _context8.abrupt("return", data);
|
|
1532
|
+
|
|
1533
|
+
case 27:
|
|
1534
|
+
case "end":
|
|
1535
|
+
return _context8.stop();
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
}, _callee8);
|
|
1539
|
+
}));
|
|
447
1540
|
return _signOut.apply(this, arguments);
|
|
448
1541
|
}
|
|
449
1542
|
|
|
450
1543
|
function setOptions() {
|
|
451
|
-
var {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
1544
|
+
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1545
|
+
baseUrl = _ref3.baseUrl,
|
|
1546
|
+
basePath = _ref3.basePath,
|
|
1547
|
+
clientMaxAge = _ref3.clientMaxAge,
|
|
1548
|
+
keepAlive = _ref3.keepAlive;
|
|
1549
|
+
|
|
457
1550
|
if (baseUrl) __NEXTAUTH.baseUrl = baseUrl;
|
|
458
1551
|
if (basePath) __NEXTAUTH.basePath = basePath;
|
|
459
1552
|
if (clientMaxAge) __NEXTAUTH.clientMaxAge = clientMaxAge;
|
|
460
1553
|
|
|
461
1554
|
if (keepAlive) {
|
|
462
1555
|
__NEXTAUTH.keepAlive = keepAlive;
|
|
463
|
-
if (typeof window ===
|
|
1556
|
+
if (typeof window === "undefined") return;
|
|
464
1557
|
|
|
465
1558
|
if (__NEXTAUTH._clientSyncTimer !== null) {
|
|
466
1559
|
clearTimeout(__NEXTAUTH._clientSyncTimer);
|
|
467
1560
|
}
|
|
468
1561
|
|
|
469
|
-
__NEXTAUTH._clientSyncTimer = setTimeout(
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
1562
|
+
__NEXTAUTH._clientSyncTimer = setTimeout((0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2() {
|
|
1563
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
1564
|
+
while (1) {
|
|
1565
|
+
switch (_context2.prev = _context2.next) {
|
|
1566
|
+
case 0:
|
|
1567
|
+
if (__NEXTAUTH._clientSession) {
|
|
1568
|
+
_context2.next = 2;
|
|
1569
|
+
break;
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
return _context2.abrupt("return");
|
|
1573
|
+
|
|
1574
|
+
case 2:
|
|
1575
|
+
_context2.next = 4;
|
|
1576
|
+
return __NEXTAUTH._getSession({
|
|
1577
|
+
event: "timer"
|
|
1578
|
+
});
|
|
1579
|
+
|
|
1580
|
+
case 4:
|
|
1581
|
+
case "end":
|
|
1582
|
+
return _context2.stop();
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
}, _callee2);
|
|
1586
|
+
})), keepAlive * 1000);
|
|
475
1587
|
}
|
|
476
1588
|
}
|
|
477
1589
|
|
|
478
|
-
function Provider(
|
|
479
|
-
var
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
options
|
|
483
|
-
} = _ref3;
|
|
1590
|
+
function Provider(_ref5) {
|
|
1591
|
+
var children = _ref5.children,
|
|
1592
|
+
session = _ref5.session,
|
|
1593
|
+
options = _ref5.options;
|
|
484
1594
|
setOptions(options);
|
|
485
1595
|
return (0, React__default["default"].createElement)(SessionContext.Provider, {
|
|
486
1596
|
value: useSession(session)
|
|
@@ -492,34 +1602,74 @@ function _fetchData(_x4) {
|
|
|
492
1602
|
}
|
|
493
1603
|
|
|
494
1604
|
function _fetchData2() {
|
|
495
|
-
_fetchData2 =
|
|
496
|
-
var
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
1605
|
+
_fetchData2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee9(path) {
|
|
1606
|
+
var _ref7,
|
|
1607
|
+
ctx,
|
|
1608
|
+
_ref7$req,
|
|
1609
|
+
req,
|
|
1610
|
+
baseUrl,
|
|
1611
|
+
options,
|
|
1612
|
+
res,
|
|
1613
|
+
data,
|
|
1614
|
+
_args9 = arguments;
|
|
1615
|
+
|
|
1616
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
1617
|
+
while (1) {
|
|
1618
|
+
switch (_context9.prev = _context9.next) {
|
|
1619
|
+
case 0:
|
|
1620
|
+
_ref7 = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : {}, ctx = _ref7.ctx, _ref7$req = _ref7.req, req = _ref7$req === void 0 ? ctx === null || ctx === void 0 ? void 0 : ctx.req : _ref7$req;
|
|
1621
|
+
_context9.prev = 1;
|
|
1622
|
+
_context9.next = 4;
|
|
1623
|
+
return _apiBaseUrl();
|
|
1624
|
+
|
|
1625
|
+
case 4:
|
|
1626
|
+
baseUrl = _context9.sent;
|
|
1627
|
+
options = req ? {
|
|
1628
|
+
headers: {
|
|
1629
|
+
cookie: req.headers.cookie
|
|
1630
|
+
}
|
|
1631
|
+
} : {};
|
|
1632
|
+
_context9.next = 8;
|
|
1633
|
+
return fetch("".concat(baseUrl, "/").concat(path), options);
|
|
1634
|
+
|
|
1635
|
+
case 8:
|
|
1636
|
+
res = _context9.sent;
|
|
1637
|
+
_context9.next = 11;
|
|
1638
|
+
return res.json();
|
|
1639
|
+
|
|
1640
|
+
case 11:
|
|
1641
|
+
data = _context9.sent;
|
|
1642
|
+
|
|
1643
|
+
if (res.ok) {
|
|
1644
|
+
_context9.next = 14;
|
|
1645
|
+
break;
|
|
1646
|
+
}
|
|
500
1647
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
1648
|
+
throw data;
|
|
1649
|
+
|
|
1650
|
+
case 14:
|
|
1651
|
+
return _context9.abrupt("return", Object.keys(data).length > 0 ? data : null);
|
|
1652
|
+
|
|
1653
|
+
case 17:
|
|
1654
|
+
_context9.prev = 17;
|
|
1655
|
+
_context9.t0 = _context9["catch"](1);
|
|
1656
|
+
logger$1.error("CLIENT_FETCH_ERROR", path, _context9.t0);
|
|
1657
|
+
return _context9.abrupt("return", null);
|
|
1658
|
+
|
|
1659
|
+
case 21:
|
|
1660
|
+
case "end":
|
|
1661
|
+
return _context9.stop();
|
|
506
1662
|
}
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
return Object.keys(data).length > 0 ? data : null;
|
|
511
|
-
} catch (error) {
|
|
512
|
-
logger$1.error('CLIENT_FETCH_ERROR', path, error);
|
|
513
|
-
return null;
|
|
514
|
-
}
|
|
515
|
-
});
|
|
1663
|
+
}
|
|
1664
|
+
}, _callee9, null, [[1, 17]]);
|
|
1665
|
+
}));
|
|
516
1666
|
return _fetchData2.apply(this, arguments);
|
|
517
1667
|
}
|
|
518
1668
|
|
|
519
1669
|
function _apiBaseUrl() {
|
|
520
|
-
if (typeof window ===
|
|
1670
|
+
if (typeof window === "undefined") {
|
|
521
1671
|
if (!process.env.NEXTAUTH_URL) {
|
|
522
|
-
logger$1.warn(
|
|
1672
|
+
logger$1.warn("NEXTAUTH_URL", "NEXTAUTH_URL environment variable not set");
|
|
523
1673
|
}
|
|
524
1674
|
|
|
525
1675
|
return "".concat(__NEXTAUTH.baseUrlServer).concat(__NEXTAUTH.basePathServer);
|
|
@@ -533,43 +1683,68 @@ function _now() {
|
|
|
533
1683
|
}
|
|
534
1684
|
|
|
535
1685
|
function BroadcastChannel() {
|
|
536
|
-
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :
|
|
1686
|
+
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "nextauth.message";
|
|
537
1687
|
return {
|
|
538
|
-
receive(onReceive) {
|
|
539
|
-
if (typeof window ===
|
|
540
|
-
window.addEventListener(
|
|
541
|
-
var
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
1688
|
+
receive: function receive(onReceive) {
|
|
1689
|
+
if (typeof window === "undefined") return;
|
|
1690
|
+
window.addEventListener("storage", function () {
|
|
1691
|
+
var _ref6 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee3(event) {
|
|
1692
|
+
var message;
|
|
1693
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
1694
|
+
while (1) {
|
|
1695
|
+
switch (_context3.prev = _context3.next) {
|
|
1696
|
+
case 0:
|
|
1697
|
+
if (!(event.key !== name)) {
|
|
1698
|
+
_context3.next = 2;
|
|
1699
|
+
break;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
return _context3.abrupt("return");
|
|
1703
|
+
|
|
1704
|
+
case 2:
|
|
1705
|
+
message = JSON.parse(event.newValue);
|
|
1706
|
+
|
|
1707
|
+
if (!((message === null || message === void 0 ? void 0 : message.event) !== "session" || !(message !== null && message !== void 0 && message.data))) {
|
|
1708
|
+
_context3.next = 5;
|
|
1709
|
+
break;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
return _context3.abrupt("return");
|
|
1713
|
+
|
|
1714
|
+
case 5:
|
|
1715
|
+
onReceive(message);
|
|
1716
|
+
|
|
1717
|
+
case 6:
|
|
1718
|
+
case "end":
|
|
1719
|
+
return _context3.stop();
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
}, _callee3);
|
|
1723
|
+
}));
|
|
547
1724
|
|
|
548
1725
|
return function (_x5) {
|
|
549
|
-
return
|
|
1726
|
+
return _ref6.apply(this, arguments);
|
|
550
1727
|
};
|
|
551
1728
|
}());
|
|
552
1729
|
},
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
if (typeof localStorage === 'undefined') return;
|
|
1730
|
+
post: function post(message) {
|
|
1731
|
+
if (typeof localStorage === "undefined") return;
|
|
556
1732
|
localStorage.setItem(name, JSON.stringify(_objectSpread(_objectSpread({}, message), {}, {
|
|
557
1733
|
timestamp: _now()
|
|
558
1734
|
})));
|
|
559
1735
|
}
|
|
560
|
-
|
|
561
1736
|
};
|
|
562
1737
|
}
|
|
563
1738
|
|
|
564
1739
|
var _default = {
|
|
565
|
-
getSession,
|
|
566
|
-
getCsrfToken,
|
|
567
|
-
getProviders,
|
|
568
|
-
useSession,
|
|
569
|
-
signIn,
|
|
570
|
-
signOut,
|
|
571
|
-
Provider,
|
|
572
|
-
setOptions,
|
|
1740
|
+
getSession: getSession,
|
|
1741
|
+
getCsrfToken: getCsrfToken,
|
|
1742
|
+
getProviders: getProviders,
|
|
1743
|
+
useSession: useSession,
|
|
1744
|
+
signIn: signIn,
|
|
1745
|
+
signOut: signOut,
|
|
1746
|
+
Provider: Provider,
|
|
1747
|
+
setOptions: setOptions,
|
|
573
1748
|
options: setOptions,
|
|
574
1749
|
session: getSession,
|
|
575
1750
|
providers: getProviders,
|
|
@@ -582,16 +1757,23 @@ exports.default = _default;
|
|
|
582
1757
|
|
|
583
1758
|
_commonjsHelpers.unwrapExports(client$1);
|
|
584
1759
|
client$1.useSession;
|
|
1760
|
+
client$1.session;
|
|
585
1761
|
client$1.getSession;
|
|
1762
|
+
client$1.csrfToken;
|
|
1763
|
+
client$1.getCsrfToken;
|
|
1764
|
+
client$1.providers;
|
|
586
1765
|
client$1.getProviders;
|
|
1766
|
+
client$1.signin;
|
|
587
1767
|
client$1.signIn;
|
|
1768
|
+
client$1.signout;
|
|
588
1769
|
client$1.signOut;
|
|
1770
|
+
client$1.options;
|
|
589
1771
|
client$1.setOptions;
|
|
590
1772
|
client$1.Provider;
|
|
591
1773
|
|
|
592
1774
|
var client = client$1.default;
|
|
593
1775
|
|
|
594
|
-
var css = ".AuthWrapper-module_loginBox__3l-BE {\
|
|
1776
|
+
var css = ".AuthWrapper-module_loginBox__3l-BE {\n margin-bottom: 2rem;\n width: 350px;\n max-width: 90vw;\n margin-left: auto;\n margin-right: auto;\n /* box-shadow: 2px 5px 12px rgba(0, 0, 0, 0.15); */\n background: #fff;\n z-index: 1;\n}\n.AuthWrapper-module_loginBox_title__12rGD {\n margin-bottom: 2rem;\n text-align: center;\n}\n.AuthWrapper-module_bar__1dafn {\n background: #eee;\n margin-left: unset;\n margin-right: unset;\n}\n.AuthWrapper-module_bar__1dafn:nth-child(1) {\n float: left;\n border-right: 1rem solid #fff;\n background: rgb(245, 245, 245);\n height: 10rem;\n width: 25%;\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 2rem;\n}\n.AuthWrapper-module_bar__1dafn:nth-child(2n) {\n width: 97%;\n height: 1.5rem;\n margin-bottom: 0.25rem;\n}\n.AuthWrapper-module_bar__1dafn.AuthWrapper-module_bar__1dafn:nth-child(3n) {\n width: 96%;\n height: 1.5rem;\n margin-bottom: 1.5rem;\n}\n.AuthWrapper-module_bar__1dafn.AuthWrapper-module_bar__1dafn:nth-child(4n) {\n width: 72%;\n height: 1.5rem;\n margin-bottom: 0.25rem;\n}\n.AuthWrapper-module_bar__1dafn.AuthWrapper-module_bar__1dafn:nth-child(5n) {\n width: 88%;\n height: 1.5rem;\n margin-bottom: 0.25rem;\n}\n\n.AuthWrapper-module_iframe__2wDJW {\n margin-top: -3rem;\n border: none;\n width: 100%;\n height: 1900px;\n}";
|
|
595
1777
|
var styles = { "loginBox": "AuthWrapper-module_loginBox__3l-BE", "loginBox_title": "AuthWrapper-module_loginBox_title__12rGD", "bar": "AuthWrapper-module_bar__1dafn", "iframe": "AuthWrapper-module_iframe__2wDJW" };
|
|
596
1778
|
styleInject_es.styleInject(css);
|
|
597
1779
|
|
|
@@ -602,27 +1784,27 @@ var AuthWrapper = function AuthWrapper(_ref) {
|
|
|
602
1784
|
formUrl = _ref$formUrl === undefined ? '' : _ref$formUrl;
|
|
603
1785
|
|
|
604
1786
|
var _nextAuth$useSession = client.useSession(),
|
|
605
|
-
_nextAuth$useSession2 = slicedToArray._slicedToArray(_nextAuth$useSession, 2),
|
|
1787
|
+
_nextAuth$useSession2 = slicedToArray$1._slicedToArray(_nextAuth$useSession, 2),
|
|
606
1788
|
session = _nextAuth$useSession2[0],
|
|
607
1789
|
loading = _nextAuth$useSession2[1];
|
|
608
1790
|
|
|
609
1791
|
var _useState = React.useState(null),
|
|
610
|
-
_useState2 = slicedToArray._slicedToArray(_useState, 2),
|
|
1792
|
+
_useState2 = slicedToArray$1._slicedToArray(_useState, 2),
|
|
611
1793
|
callbackUrl = _useState2[0],
|
|
612
1794
|
setCallbackUrl = _useState2[1];
|
|
613
1795
|
|
|
614
1796
|
var _useState3 = React.useState(),
|
|
615
|
-
_useState4 = slicedToArray._slicedToArray(_useState3, 2),
|
|
1797
|
+
_useState4 = slicedToArray$1._slicedToArray(_useState3, 2),
|
|
616
1798
|
email = _useState4[0],
|
|
617
1799
|
setEmail = _useState4[1];
|
|
618
1800
|
|
|
619
1801
|
var _useState5 = React.useState(false),
|
|
620
|
-
_useState6 = slicedToArray._slicedToArray(_useState5, 2),
|
|
1802
|
+
_useState6 = slicedToArray$1._slicedToArray(_useState5, 2),
|
|
621
1803
|
showForm = _useState6[0],
|
|
622
1804
|
setShowForm = _useState6[1];
|
|
623
1805
|
|
|
624
1806
|
var _useState7 = React.useState(),
|
|
625
|
-
_useState8 = slicedToArray._slicedToArray(_useState7, 2),
|
|
1807
|
+
_useState8 = slicedToArray$1._slicedToArray(_useState7, 2),
|
|
626
1808
|
password = _useState8[0],
|
|
627
1809
|
setPassword = _useState8[1];
|
|
628
1810
|
|