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