site_oueb_2/wp-content/plugins/blockart-blocks/dist/admin.js

4765 lines
141 KiB
JavaScript
Raw Permalink Normal View History

2022-11-22 20:23:31 +01:00
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 8679:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var reactIs = __webpack_require__(9864);
/**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
var REACT_STATICS = {
childContextTypes: true,
contextType: true,
contextTypes: true,
defaultProps: true,
displayName: true,
getDefaultProps: true,
getDerivedStateFromError: true,
getDerivedStateFromProps: true,
mixins: true,
propTypes: true,
type: true
};
var KNOWN_STATICS = {
name: true,
length: true,
prototype: true,
caller: true,
callee: true,
arguments: true,
arity: true
};
var FORWARD_REF_STATICS = {
'$$typeof': true,
render: true,
defaultProps: true,
displayName: true,
propTypes: true
};
var MEMO_STATICS = {
'$$typeof': true,
compare: true,
defaultProps: true,
displayName: true,
propTypes: true,
type: true
};
var TYPE_STATICS = {};
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
function getStatics(component) {
// React v16.11 and below
if (reactIs.isMemo(component)) {
return MEMO_STATICS;
} // React v16.12 and above
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
}
var defineProperty = Object.defineProperty;
var getOwnPropertyNames = Object.getOwnPropertyNames;
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var getPrototypeOf = Object.getPrototypeOf;
var objectPrototype = Object.prototype;
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
if (typeof sourceComponent !== 'string') {
// don't hoist over string (html) components
if (objectPrototype) {
var inheritedComponent = getPrototypeOf(sourceComponent);
if (inheritedComponent && inheritedComponent !== objectPrototype) {
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
}
}
var keys = getOwnPropertyNames(sourceComponent);
if (getOwnPropertySymbols) {
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
}
var targetStatics = getStatics(targetComponent);
var sourceStatics = getStatics(sourceComponent);
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
try {
// Avoid failures from read-only properties
defineProperty(targetComponent, key, descriptor);
} catch (e) {}
}
}
}
return targetComponent;
}
module.exports = hoistNonReactStatics;
/***/ }),
/***/ 4779:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var isarray = __webpack_require__(6173)
/**
* Expose `pathToRegexp`.
*/
module.exports = pathToRegexp
module.exports.parse = parse
module.exports.compile = compile
module.exports.tokensToFunction = tokensToFunction
module.exports.tokensToRegExp = tokensToRegExp
/**
* The main path matching regexp utility.
*
* @type {RegExp}
*/
var PATH_REGEXP = new RegExp([
// Match escaped characters that would otherwise appear in future matches.
// This allows the user to escape special characters that won't transform.
'(\\\\.)',
// Match Express-style parameters and un-named parameters with a prefix
// and optional suffixes. Matches appear as:
//
// "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
// "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
// "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
'([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
].join('|'), 'g')
/**
* Parse a string for the raw tokens.
*
* @param {string} str
* @param {Object=} options
* @return {!Array}
*/
function parse (str, options) {
var tokens = []
var key = 0
var index = 0
var path = ''
var defaultDelimiter = options && options.delimiter || '/'
var res
while ((res = PATH_REGEXP.exec(str)) != null) {
var m = res[0]
var escaped = res[1]
var offset = res.index
path += str.slice(index, offset)
index = offset + m.length
// Ignore already escaped sequences.
if (escaped) {
path += escaped[1]
continue
}
var next = str[index]
var prefix = res[2]
var name = res[3]
var capture = res[4]
var group = res[5]
var modifier = res[6]
var asterisk = res[7]
// Push the current path onto the tokens.
if (path) {
tokens.push(path)
path = ''
}
var partial = prefix != null && next != null && next !== prefix
var repeat = modifier === '+' || modifier === '*'
var optional = modifier === '?' || modifier === '*'
var delimiter = res[2] || defaultDelimiter
var pattern = capture || group
tokens.push({
name: name || key++,
prefix: prefix || '',
delimiter: delimiter,
optional: optional,
repeat: repeat,
partial: partial,
asterisk: !!asterisk,
pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
})
}
// Match any characters still remaining.
if (index < str.length) {
path += str.substr(index)
}
// If the path exists, push it onto the end.
if (path) {
tokens.push(path)
}
return tokens
}
/**
* Compile a string to a template function for the path.
*
* @param {string} str
* @param {Object=} options
* @return {!function(Object=, Object=)}
*/
function compile (str, options) {
return tokensToFunction(parse(str, options), options)
}
/**
* Prettier encoding of URI path segments.
*
* @param {string}
* @return {string}
*/
function encodeURIComponentPretty (str) {
return encodeURI(str).replace(/[\/?#]/g, function (c) {
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
})
}
/**
* Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
*
* @param {string}
* @return {string}
*/
function encodeAsterisk (str) {
return encodeURI(str).replace(/[?#]/g, function (c) {
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
})
}
/**
* Expose a method for transforming tokens into the path function.
*/
function tokensToFunction (tokens, options) {
// Compile all the tokens into regexps.
var matches = new Array(tokens.length)
// Compile all the patterns before compilation.
for (var i = 0; i < tokens.length; i++) {
if (typeof tokens[i] === 'object') {
matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$', flags(options))
}
}
return function (obj, opts) {
var path = ''
var data = obj || {}
var options = opts || {}
var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent
for (var i = 0; i < tokens.length; i++) {
var token = tokens[i]
if (typeof token === 'string') {
path += token
continue
}
var value = data[token.name]
var segment
if (value == null) {
if (token.optional) {
// Prepend partial segment prefixes.
if (token.partial) {
path += token.prefix
}
continue
} else {
throw new TypeError('Expected "' + token.name + '" to be defined')
}
}
if (isarray(value)) {
if (!token.repeat) {
throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
}
if (value.length === 0) {
if (token.optional) {
continue
} else {
throw new TypeError('Expected "' + token.name + '" to not be empty')
}
}
for (var j = 0; j < value.length; j++) {
segment = encode(value[j])
if (!matches[i].test(segment)) {
throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
}
path += (j === 0 ? token.prefix : token.delimiter) + segment
}
continue
}
segment = token.asterisk ? encodeAsterisk(value) : encode(value)
if (!matches[i].test(segment)) {
throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
}
path += token.prefix + segment
}
return path
}
}
/**
* Escape a regular expression string.
*
* @param {string} str
* @return {string}
*/
function escapeString (str) {
return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
}
/**
* Escape the capturing group by escaping special characters and meaning.
*
* @param {string} group
* @return {string}
*/
function escapeGroup (group) {
return group.replace(/([=!:$\/()])/g, '\\$1')
}
/**
* Attach the keys as a property of the regexp.
*
* @param {!RegExp} re
* @param {Array} keys
* @return {!RegExp}
*/
function attachKeys (re, keys) {
re.keys = keys
return re
}
/**
* Get the flags for a regexp from the options.
*
* @param {Object} options
* @return {string}
*/
function flags (options) {
return options && options.sensitive ? '' : 'i'
}
/**
* Pull out keys from a regexp.
*
* @param {!RegExp} path
* @param {!Array} keys
* @return {!RegExp}
*/
function regexpToRegexp (path, keys) {
// Use a negative lookahead to match only capturing groups.
var groups = path.source.match(/\((?!\?)/g)
if (groups) {
for (var i = 0; i < groups.length; i++) {
keys.push({
name: i,
prefix: null,
delimiter: null,
optional: false,
repeat: false,
partial: false,
asterisk: false,
pattern: null
})
}
}
return attachKeys(path, keys)
}
/**
* Transform an array into a regexp.
*
* @param {!Array} path
* @param {Array} keys
* @param {!Object} options
* @return {!RegExp}
*/
function arrayToRegexp (path, keys, options) {
var parts = []
for (var i = 0; i < path.length; i++) {
parts.push(pathToRegexp(path[i], keys, options).source)
}
var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options))
return attachKeys(regexp, keys)
}
/**
* Create a path regexp from string input.
*
* @param {string} path
* @param {!Array} keys
* @param {!Object} options
* @return {!RegExp}
*/
function stringToRegexp (path, keys, options) {
return tokensToRegExp(parse(path, options), keys, options)
}
/**
* Expose a function for taking tokens and returning a RegExp.
*
* @param {!Array} tokens
* @param {(Array|Object)=} keys
* @param {Object=} options
* @return {!RegExp}
*/
function tokensToRegExp (tokens, keys, options) {
if (!isarray(keys)) {
options = /** @type {!Object} */ (keys || options)
keys = []
}
options = options || {}
var strict = options.strict
var end = options.end !== false
var route = ''
// Iterate over the tokens and create our regexp string.
for (var i = 0; i < tokens.length; i++) {
var token = tokens[i]
if (typeof token === 'string') {
route += escapeString(token)
} else {
var prefix = escapeString(token.prefix)
var capture = '(?:' + token.pattern + ')'
keys.push(token)
if (token.repeat) {
capture += '(?:' + prefix + capture + ')*'
}
if (token.optional) {
if (!token.partial) {
capture = '(?:' + prefix + '(' + capture + '))?'
} else {
capture = prefix + '(' + capture + ')?'
}
} else {
capture = prefix + '(' + capture + ')'
}
route += capture
}
}
var delimiter = escapeString(options.delimiter || '/')
var endsWithDelimiter = route.slice(-delimiter.length) === delimiter
// In non-strict mode we allow a slash at the end of match. If the path to
// match already ends with a slash, we remove it for consistency. The slash
// is valid at the end of a path match, not in the middle. This is important
// in non-ending mode, where "/test/" shouldn't match "/test//route".
if (!strict) {
route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?'
}
if (end) {
route += '$'
} else {
// In non-ending mode, we need the capturing groups to match as much as
// possible by using a positive lookahead to the end or next path segment.
route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)'
}
return attachKeys(new RegExp('^' + route, flags(options)), keys)
}
/**
* Normalize the given path string, returning a regular expression.
*
* An empty array can be passed in for the keys, which will hold the
* placeholder key descriptions. For example, using `/user/:id`, `keys` will
* contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
*
* @param {(string|RegExp|Array)} path
* @param {(Array|Object)=} keys
* @param {Object=} options
* @return {!RegExp}
*/
function pathToRegexp (path, keys, options) {
if (!isarray(keys)) {
options = /** @type {!Object} */ (keys || options)
keys = []
}
options = options || {}
if (path instanceof RegExp) {
return regexpToRegexp(path, /** @type {!Array} */ (keys))
}
if (isarray(path)) {
return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
}
return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
}
/***/ }),
/***/ 6173:
/***/ ((module) => {
module.exports = Array.isArray || function (arr) {
return Object.prototype.toString.call(arr) == '[object Array]';
};
/***/ }),
/***/ 2703:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ReactPropTypesSecret = __webpack_require__(414);
function emptyFunction() {}
function emptyFunctionWithReset() {}
emptyFunctionWithReset.resetWarningCache = emptyFunction;
module.exports = function() {
function shim(props, propName, componentName, location, propFullName, secret) {
if (secret === ReactPropTypesSecret) {
// It is still safe when called from React.
return;
}
var err = new Error(
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use PropTypes.checkPropTypes() to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
err.name = 'Invariant Violation';
throw err;
};
shim.isRequired = shim;
function getShim() {
return shim;
};
// Important!
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
var ReactPropTypes = {
array: shim,
bigint: shim,
bool: shim,
func: shim,
number: shim,
object: shim,
string: shim,
symbol: shim,
any: shim,
arrayOf: getShim,
element: shim,
elementType: shim,
instanceOf: getShim,
node: shim,
objectOf: getShim,
oneOf: getShim,
oneOfType: getShim,
shape: getShim,
exact: getShim,
checkPropTypes: emptyFunctionWithReset,
resetWarningCache: emptyFunction
};
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
/***/ }),
/***/ 5697:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
if (false) { var throwOnDirectAccess, ReactIs; } else {
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = __webpack_require__(2703)();
}
/***/ }),
/***/ 414:
/***/ ((module) => {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
module.exports = ReactPropTypesSecret;
/***/ }),
/***/ 9921:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;
exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};
exports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};
exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;
/***/ }),
/***/ 9864:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
if (true) {
module.exports = __webpack_require__(9921);
} else {}
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/global */
/******/ (() => {
/******/ __webpack_require__.g = (function() {
/******/ if (typeof globalThis === 'object') return globalThis;
/******/ try {
/******/ return this || new Function('return this')();
/******/ } catch (e) {
/******/ if (typeof window === 'object') return window;
/******/ }
/******/ })();
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
"use strict";
;// CONCATENATED MODULE: external ["wp","element"]
const external_wp_element_namespaceObject = window["wp"]["element"];
;// CONCATENATED MODULE: external ["wp","apiFetch"]
const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
;// CONCATENATED MODULE: external ["wp","i18n"]
const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
;// CONCATENATED MODULE: ./src/admin/helpers/set-rating.js
/* harmony default export */ const set_rating = (function (ev) {
ev.target.parentElement.innerText = (0,external_wp_i18n_namespaceObject.__)('Thanks :)', 'blockart');
external_wp_apiFetch_default()({
path: 'wp/v2/settings',
method: 'PUT',
body: JSON.stringify({
_blockart_admin_footer_text_rated: true
})
}).then(function () {
var el = document.getElementById('footer-left');
if (null !== el) {
el.innerText = (0,external_wp_i18n_namespaceObject.__)('Thank you for creating with BlockArt.', 'blockart');
}
})["catch"](function (e) {
// eslint-disable-next-line no-console
console.warn(e);
});
});
;// CONCATENATED MODULE: ./src/admin/helpers/index.js
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
;// CONCATENATED MODULE: external "React"
const external_React_namespaceObject = window["React"];
var external_React_default = /*#__PURE__*/__webpack_require__.n(external_React_namespaceObject);
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
function extends_extends() {
extends_extends = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return extends_extends.apply(this, arguments);
}
;// CONCATENATED MODULE: ./node_modules/resolve-pathname/esm/resolve-pathname.js
function isAbsolute(pathname) {
return pathname.charAt(0) === '/';
}
// About 1.5x faster than the two-arg version of Array#splice()
function spliceOne(list, index) {
for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {
list[i] = list[k];
}
list.pop();
}
// This implementation is based heavily on node's url.parse
function resolvePathname(to, from) {
if (from === undefined) from = '';
var toParts = (to && to.split('/')) || [];
var fromParts = (from && from.split('/')) || [];
var isToAbs = to && isAbsolute(to);
var isFromAbs = from && isAbsolute(from);
var mustEndAbs = isToAbs || isFromAbs;
if (to && isAbsolute(to)) {
// to is absolute
fromParts = toParts;
} else if (toParts.length) {
// to is relative, drop the filename
fromParts.pop();
fromParts = fromParts.concat(toParts);
}
if (!fromParts.length) return '/';
var hasTrailingSlash;
if (fromParts.length) {
var last = fromParts[fromParts.length - 1];
hasTrailingSlash = last === '.' || last === '..' || last === '';
} else {
hasTrailingSlash = false;
}
var up = 0;
for (var i = fromParts.length; i >= 0; i--) {
var part = fromParts[i];
if (part === '.') {
spliceOne(fromParts, i);
} else if (part === '..') {
spliceOne(fromParts, i);
up++;
} else if (up) {
spliceOne(fromParts, i);
up--;
}
}
if (!mustEndAbs) for (; up--; up) fromParts.unshift('..');
if (
mustEndAbs &&
fromParts[0] !== '' &&
(!fromParts[0] || !isAbsolute(fromParts[0]))
)
fromParts.unshift('');
var result = fromParts.join('/');
if (hasTrailingSlash && result.substr(-1) !== '/') result += '/';
return result;
}
/* harmony default export */ const resolve_pathname = (resolvePathname);
;// CONCATENATED MODULE: ./node_modules/tiny-invariant/dist/tiny-invariant.esm.js
var isProduction = "production" === 'production';
var prefix = 'Invariant failed';
function tiny_invariant_esm_invariant(condition, message) {
if (condition) {
return;
}
if (isProduction) {
throw new Error(prefix);
}
var provided = typeof message === 'function' ? message() : message;
var value = provided ? prefix + ": " + provided : prefix;
throw new Error(value);
}
;// CONCATENATED MODULE: ./node_modules/history/esm/history.js
function addLeadingSlash(path) {
return path.charAt(0) === '/' ? path : '/' + path;
}
function stripLeadingSlash(path) {
return path.charAt(0) === '/' ? path.substr(1) : path;
}
function hasBasename(path, prefix) {
return path.toLowerCase().indexOf(prefix.toLowerCase()) === 0 && '/?#'.indexOf(path.charAt(prefix.length)) !== -1;
}
function stripBasename(path, prefix) {
return hasBasename(path, prefix) ? path.substr(prefix.length) : path;
}
function stripTrailingSlash(path) {
return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path;
}
function parsePath(path) {
var pathname = path || '/';
var search = '';
var hash = '';
var hashIndex = pathname.indexOf('#');
if (hashIndex !== -1) {
hash = pathname.substr(hashIndex);
pathname = pathname.substr(0, hashIndex);
}
var searchIndex = pathname.indexOf('?');
if (searchIndex !== -1) {
search = pathname.substr(searchIndex);
pathname = pathname.substr(0, searchIndex);
}
return {
pathname: pathname,
search: search === '?' ? '' : search,
hash: hash === '#' ? '' : hash
};
}
function createPath(location) {
var pathname = location.pathname,
search = location.search,
hash = location.hash;
var path = pathname || '/';
if (search && search !== '?') path += search.charAt(0) === '?' ? search : "?" + search;
if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : "#" + hash;
return path;
}
function history_createLocation(path, state, key, currentLocation) {
var location;
if (typeof path === 'string') {
// Two-arg form: push(path, state)
location = parsePath(path);
location.state = state;
} else {
// One-arg form: push(location)
location = extends_extends({}, path);
if (location.pathname === undefined) location.pathname = '';
if (location.search) {
if (location.search.charAt(0) !== '?') location.search = '?' + location.search;
} else {
location.search = '';
}
if (location.hash) {
if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash;
} else {
location.hash = '';
}
if (state !== undefined && location.state === undefined) location.state = state;
}
try {
location.pathname = decodeURI(location.pathname);
} catch (e) {
if (e instanceof URIError) {
throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.');
} else {
throw e;
}
}
if (key) location.key = key;
if (currentLocation) {
// Resolve incomplete/relative pathname relative to current location.
if (!location.pathname) {
location.pathname = currentLocation.pathname;
} else if (location.pathname.charAt(0) !== '/') {
location.pathname = resolve_pathname(location.pathname, currentLocation.pathname);
}
} else {
// When there is no prior location and pathname is empty, set it to /
if (!location.pathname) {
location.pathname = '/';
}
}
return location;
}
function history_locationsAreEqual(a, b) {
return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && a.key === b.key && valueEqual(a.state, b.state);
}
function createTransitionManager() {
var prompt = null;
function setPrompt(nextPrompt) {
false ? 0 : void 0;
prompt = nextPrompt;
return function () {
if (prompt === nextPrompt) prompt = null;
};
}
function confirmTransitionTo(location, action, getUserConfirmation, callback) {
// TODO: If another transition starts while we're still confirming
// the previous one, we may end up in a weird state. Figure out the
// best way to handle this.
if (prompt != null) {
var result = typeof prompt === 'function' ? prompt(location, action) : prompt;
if (typeof result === 'string') {
if (typeof getUserConfirmation === 'function') {
getUserConfirmation(result, callback);
} else {
false ? 0 : void 0;
callback(true);
}
} else {
// Return false from a transition hook to cancel the transition.
callback(result !== false);
}
} else {
callback(true);
}
}
var listeners = [];
function appendListener(fn) {
var isActive = true;
function listener() {
if (isActive) fn.apply(void 0, arguments);
}
listeners.push(listener);
return function () {
isActive = false;
listeners = listeners.filter(function (item) {
return item !== listener;
});
};
}
function notifyListeners() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
listeners.forEach(function (listener) {
return listener.apply(void 0, args);
});
}
return {
setPrompt: setPrompt,
confirmTransitionTo: confirmTransitionTo,
appendListener: appendListener,
notifyListeners: notifyListeners
};
}
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
function getConfirmation(message, callback) {
callback(window.confirm(message)); // eslint-disable-line no-alert
}
/**
* Returns true if the HTML5 history API is supported. Taken from Modernizr.
*
* https://github.com/Modernizr/Modernizr/blob/master/LICENSE
* https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
* changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586
*/
function supportsHistory() {
var ua = window.navigator.userAgent;
if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false;
return window.history && 'pushState' in window.history;
}
/**
* Returns true if browser fires popstate on hash change.
* IE10 and IE11 do not.
*/
function supportsPopStateOnHashChange() {
return window.navigator.userAgent.indexOf('Trident') === -1;
}
/**
* Returns false if using go(n) with hash history causes a full page reload.
*/
function supportsGoWithoutReloadUsingHash() {
return window.navigator.userAgent.indexOf('Firefox') === -1;
}
/**
* Returns true if a given popstate event is an extraneous WebKit event.
* Accounts for the fact that Chrome on iOS fires real popstate events
* containing undefined state when pressing the back button.
*/
function isExtraneousPopstateEvent(event) {
return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1;
}
var PopStateEvent = 'popstate';
var HashChangeEvent = 'hashchange';
function getHistoryState() {
try {
return window.history.state || {};
} catch (e) {
// IE 11 sometimes throws when accessing window.history.state
// See https://github.com/ReactTraining/history/pull/289
return {};
}
}
/**
* Creates a history object that uses the HTML5 history API including
* pushState, replaceState, and the popstate event.
*/
function createBrowserHistory(props) {
if (props === void 0) {
props = {};
}
!canUseDOM ? false ? 0 : tiny_invariant_esm_invariant(false) : void 0;
var globalHistory = window.history;
var canUseHistory = supportsHistory();
var needsHashChangeListener = !supportsPopStateOnHashChange();
var _props = props,
_props$forceRefresh = _props.forceRefresh,
forceRefresh = _props$forceRefresh === void 0 ? false : _props$forceRefresh,
_props$getUserConfirm = _props.getUserConfirmation,
getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,
_props$keyLength = _props.keyLength,
keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : '';
function getDOMLocation(historyState) {
var _ref = historyState || {},
key = _ref.key,
state = _ref.state;
var _window$location = window.location,
pathname = _window$location.pathname,
search = _window$location.search,
hash = _window$location.hash;
var path = pathname + search + hash;
false ? 0 : void 0;
if (basename) path = stripBasename(path, basename);
return history_createLocation(path, state, key);
}
function createKey() {
return Math.random().toString(36).substr(2, keyLength);
}
var transitionManager = createTransitionManager();
function setState(nextState) {
extends_extends(history, nextState);
history.length = globalHistory.length;
transitionManager.notifyListeners(history.location, history.action);
}
function handlePopState(event) {
// Ignore extraneous popstate events in WebKit.
if (isExtraneousPopstateEvent(event)) return;
handlePop(getDOMLocation(event.state));
}
function handleHashChange() {
handlePop(getDOMLocation(getHistoryState()));
}
var forceNextPop = false;
function handlePop(location) {
if (forceNextPop) {
forceNextPop = false;
setState();
} else {
var action = 'POP';
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (ok) {
setState({
action: action,
location: location
});
} else {
revertPop(location);
}
});
}
}
function revertPop(fromLocation) {
var toLocation = history.location; // TODO: We could probably make this more reliable by
// keeping a list of keys we've seen in sessionStorage.
// Instead, we just default to 0 for keys we don't know.
var toIndex = allKeys.indexOf(toLocation.key);
if (toIndex === -1) toIndex = 0;
var fromIndex = allKeys.indexOf(fromLocation.key);
if (fromIndex === -1) fromIndex = 0;
var delta = toIndex - fromIndex;
if (delta) {
forceNextPop = true;
go(delta);
}
}
var initialLocation = getDOMLocation(getHistoryState());
var allKeys = [initialLocation.key]; // Public interface
function createHref(location) {
return basename + createPath(location);
}
function push(path, state) {
false ? 0 : void 0;
var action = 'PUSH';
var location = history_createLocation(path, state, createKey(), history.location);
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (!ok) return;
var href = createHref(location);
var key = location.key,
state = location.state;
if (canUseHistory) {
globalHistory.pushState({
key: key,
state: state
}, null, href);
if (forceRefresh) {
window.location.href = href;
} else {
var prevIndex = allKeys.indexOf(history.location.key);
var nextKeys = allKeys.slice(0, prevIndex + 1);
nextKeys.push(location.key);
allKeys = nextKeys;
setState({
action: action,
location: location
});
}
} else {
false ? 0 : void 0;
window.location.href = href;
}
});
}
function replace(path, state) {
false ? 0 : void 0;
var action = 'REPLACE';
var location = history_createLocation(path, state, createKey(), history.location);
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (!ok) return;
var href = createHref(location);
var key = location.key,
state = location.state;
if (canUseHistory) {
globalHistory.replaceState({
key: key,
state: state
}, null, href);
if (forceRefresh) {
window.location.replace(href);
} else {
var prevIndex = allKeys.indexOf(history.location.key);
if (prevIndex !== -1) allKeys[prevIndex] = location.key;
setState({
action: action,
location: location
});
}
} else {
false ? 0 : void 0;
window.location.replace(href);
}
});
}
function go(n) {
globalHistory.go(n);
}
function goBack() {
go(-1);
}
function goForward() {
go(1);
}
var listenerCount = 0;
function checkDOMListeners(delta) {
listenerCount += delta;
if (listenerCount === 1 && delta === 1) {
window.addEventListener(PopStateEvent, handlePopState);
if (needsHashChangeListener) window.addEventListener(HashChangeEvent, handleHashChange);
} else if (listenerCount === 0) {
window.removeEventListener(PopStateEvent, handlePopState);
if (needsHashChangeListener) window.removeEventListener(HashChangeEvent, handleHashChange);
}
}
var isBlocked = false;
function block(prompt) {
if (prompt === void 0) {
prompt = false;
}
var unblock = transitionManager.setPrompt(prompt);
if (!isBlocked) {
checkDOMListeners(1);
isBlocked = true;
}
return function () {
if (isBlocked) {
isBlocked = false;
checkDOMListeners(-1);
}
return unblock();
};
}
function listen(listener) {
var unlisten = transitionManager.appendListener(listener);
checkDOMListeners(1);
return function () {
checkDOMListeners(-1);
unlisten();
};
}
var history = {
length: globalHistory.length,
action: 'POP',
location: initialLocation,
createHref: createHref,
push: push,
replace: replace,
go: go,
goBack: goBack,
goForward: goForward,
block: block,
listen: listen
};
return history;
}
var HashChangeEvent$1 = 'hashchange';
var HashPathCoders = {
hashbang: {
encodePath: function encodePath(path) {
return path.charAt(0) === '!' ? path : '!/' + stripLeadingSlash(path);
},
decodePath: function decodePath(path) {
return path.charAt(0) === '!' ? path.substr(1) : path;
}
},
noslash: {
encodePath: stripLeadingSlash,
decodePath: addLeadingSlash
},
slash: {
encodePath: addLeadingSlash,
decodePath: addLeadingSlash
}
};
function stripHash(url) {
var hashIndex = url.indexOf('#');
return hashIndex === -1 ? url : url.slice(0, hashIndex);
}
function getHashPath() {
// We can't use window.location.hash here because it's not
// consistent across browsers - Firefox will pre-decode it!
var href = window.location.href;
var hashIndex = href.indexOf('#');
return hashIndex === -1 ? '' : href.substring(hashIndex + 1);
}
function pushHashPath(path) {
window.location.hash = path;
}
function replaceHashPath(path) {
window.location.replace(stripHash(window.location.href) + '#' + path);
}
function createHashHistory(props) {
if (props === void 0) {
props = {};
}
!canUseDOM ? false ? 0 : tiny_invariant_esm_invariant(false) : void 0;
var globalHistory = window.history;
var canGoWithoutReload = supportsGoWithoutReloadUsingHash();
var _props = props,
_props$getUserConfirm = _props.getUserConfirmation,
getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,
_props$hashType = _props.hashType,
hashType = _props$hashType === void 0 ? 'slash' : _props$hashType;
var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : '';
var _HashPathCoders$hashT = HashPathCoders[hashType],
encodePath = _HashPathCoders$hashT.encodePath,
decodePath = _HashPathCoders$hashT.decodePath;
function getDOMLocation() {
var path = decodePath(getHashPath());
false ? 0 : void 0;
if (basename) path = stripBasename(path, basename);
return history_createLocation(path);
}
var transitionManager = createTransitionManager();
function setState(nextState) {
extends_extends(history, nextState);
history.length = globalHistory.length;
transitionManager.notifyListeners(history.location, history.action);
}
var forceNextPop = false;
var ignorePath = null;
function locationsAreEqual$$1(a, b) {
return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash;
}
function handleHashChange() {
var path = getHashPath();
var encodedPath = encodePath(path);
if (path !== encodedPath) {
// Ensure we always have a properly-encoded hash.
replaceHashPath(encodedPath);
} else {
var location = getDOMLocation();
var prevLocation = history.location;
if (!forceNextPop && locationsAreEqual$$1(prevLocation, location)) return; // A hashchange doesn't always == location change.
if (ignorePath === createPath(location)) return; // Ignore this change; we already setState in push/replace.
ignorePath = null;
handlePop(location);
}
}
function handlePop(location) {
if (forceNextPop) {
forceNextPop = false;
setState();
} else {
var action = 'POP';
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (ok) {
setState({
action: action,
location: location
});
} else {
revertPop(location);
}
});
}
}
function revertPop(fromLocation) {
var toLocation = history.location; // TODO: We could probably make this more reliable by
// keeping a list of paths we've seen in sessionStorage.
// Instead, we just default to 0 for paths we don't know.
var toIndex = allPaths.lastIndexOf(createPath(toLocation));
if (toIndex === -1) toIndex = 0;
var fromIndex = allPaths.lastIndexOf(createPath(fromLocation));
if (fromIndex === -1) fromIndex = 0;
var delta = toIndex - fromIndex;
if (delta) {
forceNextPop = true;
go(delta);
}
} // Ensure the hash is encoded properly before doing anything else.
var path = getHashPath();
var encodedPath = encodePath(path);
if (path !== encodedPath) replaceHashPath(encodedPath);
var initialLocation = getDOMLocation();
var allPaths = [createPath(initialLocation)]; // Public interface
function createHref(location) {
var baseTag = document.querySelector('base');
var href = '';
if (baseTag && baseTag.getAttribute('href')) {
href = stripHash(window.location.href);
}
return href + '#' + encodePath(basename + createPath(location));
}
function push(path, state) {
false ? 0 : void 0;
var action = 'PUSH';
var location = history_createLocation(path, undefined, undefined, history.location);
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (!ok) return;
var path = createPath(location);
var encodedPath = encodePath(basename + path);
var hashChanged = getHashPath() !== encodedPath;
if (hashChanged) {
// We cannot tell if a hashchange was caused by a PUSH, so we'd
// rather setState here and ignore the hashchange. The caveat here
// is that other hash histories in the page will consider it a POP.
ignorePath = path;
pushHashPath(encodedPath);
var prevIndex = allPaths.lastIndexOf(createPath(history.location));
var nextPaths = allPaths.slice(0, prevIndex + 1);
nextPaths.push(path);
allPaths = nextPaths;
setState({
action: action,
location: location
});
} else {
false ? 0 : void 0;
setState();
}
});
}
function replace(path, state) {
false ? 0 : void 0;
var action = 'REPLACE';
var location = history_createLocation(path, undefined, undefined, history.location);
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (!ok) return;
var path = createPath(location);
var encodedPath = encodePath(basename + path);
var hashChanged = getHashPath() !== encodedPath;
if (hashChanged) {
// We cannot tell if a hashchange was caused by a REPLACE, so we'd
// rather setState here and ignore the hashchange. The caveat here
// is that other hash histories in the page will consider it a POP.
ignorePath = path;
replaceHashPath(encodedPath);
}
var prevIndex = allPaths.indexOf(createPath(history.location));
if (prevIndex !== -1) allPaths[prevIndex] = path;
setState({
action: action,
location: location
});
});
}
function go(n) {
false ? 0 : void 0;
globalHistory.go(n);
}
function goBack() {
go(-1);
}
function goForward() {
go(1);
}
var listenerCount = 0;
function checkDOMListeners(delta) {
listenerCount += delta;
if (listenerCount === 1 && delta === 1) {
window.addEventListener(HashChangeEvent$1, handleHashChange);
} else if (listenerCount === 0) {
window.removeEventListener(HashChangeEvent$1, handleHashChange);
}
}
var isBlocked = false;
function block(prompt) {
if (prompt === void 0) {
prompt = false;
}
var unblock = transitionManager.setPrompt(prompt);
if (!isBlocked) {
checkDOMListeners(1);
isBlocked = true;
}
return function () {
if (isBlocked) {
isBlocked = false;
checkDOMListeners(-1);
}
return unblock();
};
}
function listen(listener) {
var unlisten = transitionManager.appendListener(listener);
checkDOMListeners(1);
return function () {
checkDOMListeners(-1);
unlisten();
};
}
var history = {
length: globalHistory.length,
action: 'POP',
location: initialLocation,
createHref: createHref,
push: push,
replace: replace,
go: go,
goBack: goBack,
goForward: goForward,
block: block,
listen: listen
};
return history;
}
function clamp(n, lowerBound, upperBound) {
return Math.min(Math.max(n, lowerBound), upperBound);
}
/**
* Creates a history object that stores locations in memory.
*/
function createMemoryHistory(props) {
if (props === void 0) {
props = {};
}
var _props = props,
getUserConfirmation = _props.getUserConfirmation,
_props$initialEntries = _props.initialEntries,
initialEntries = _props$initialEntries === void 0 ? ['/'] : _props$initialEntries,
_props$initialIndex = _props.initialIndex,
initialIndex = _props$initialIndex === void 0 ? 0 : _props$initialIndex,
_props$keyLength = _props.keyLength,
keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
var transitionManager = createTransitionManager();
function setState(nextState) {
extends_extends(history, nextState);
history.length = history.entries.length;
transitionManager.notifyListeners(history.location, history.action);
}
function createKey() {
return Math.random().toString(36).substr(2, keyLength);
}
var index = clamp(initialIndex, 0, initialEntries.length - 1);
var entries = initialEntries.map(function (entry) {
return typeof entry === 'string' ? history_createLocation(entry, undefined, createKey()) : history_createLocation(entry, undefined, entry.key || createKey());
}); // Public interface
var createHref = createPath;
function push(path, state) {
false ? 0 : void 0;
var action = 'PUSH';
var location = history_createLocation(path, state, createKey(), history.location);
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (!ok) return;
var prevIndex = history.index;
var nextIndex = prevIndex + 1;
var nextEntries = history.entries.slice(0);
if (nextEntries.length > nextIndex) {
nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location);
} else {
nextEntries.push(location);
}
setState({
action: action,
location: location,
index: nextIndex,
entries: nextEntries
});
});
}
function replace(path, state) {
false ? 0 : void 0;
var action = 'REPLACE';
var location = history_createLocation(path, state, createKey(), history.location);
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (!ok) return;
history.entries[history.index] = location;
setState({
action: action,
location: location
});
});
}
function go(n) {
var nextIndex = clamp(history.index + n, 0, history.entries.length - 1);
var action = 'POP';
var location = history.entries[nextIndex];
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (ok) {
setState({
action: action,
location: location,
index: nextIndex
});
} else {
// Mimic the behavior of DOM histories by
// causing a render after a cancelled POP.
setState();
}
});
}
function goBack() {
go(-1);
}
function goForward() {
go(1);
}
function canGo(n) {
var nextIndex = history.index + n;
return nextIndex >= 0 && nextIndex < history.entries.length;
}
function block(prompt) {
if (prompt === void 0) {
prompt = false;
}
return transitionManager.setPrompt(prompt);
}
function listen(listener) {
return transitionManager.appendListener(listener);
}
var history = {
length: entries.length,
action: 'POP',
location: entries[index],
index: index,
entries: entries,
createHref: createHref,
push: push,
replace: replace,
go: go,
goBack: goBack,
goForward: goForward,
canGo: canGo,
block: block,
listen: listen
};
return history;
}
// EXTERNAL MODULE: ./node_modules/prop-types/index.js
var prop_types = __webpack_require__(5697);
var prop_types_default = /*#__PURE__*/__webpack_require__.n(prop_types);
;// CONCATENATED MODULE: ./node_modules/mini-create-react-context/dist/esm/index.js
var MAX_SIGNED_31_BIT_INT = 1073741823;
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : {};
function getUniqueId() {
var key = '__global_unique_id__';
return commonjsGlobal[key] = (commonjsGlobal[key] || 0) + 1;
}
function objectIs(x, y) {
if (x === y) {
return x !== 0 || 1 / x === 1 / y;
} else {
return x !== x && y !== y;
}
}
function createEventEmitter(value) {
var handlers = [];
return {
on: function on(handler) {
handlers.push(handler);
},
off: function off(handler) {
handlers = handlers.filter(function (h) {
return h !== handler;
});
},
get: function get() {
return value;
},
set: function set(newValue, changedBits) {
value = newValue;
handlers.forEach(function (handler) {
return handler(value, changedBits);
});
}
};
}
function onlyChild(children) {
return Array.isArray(children) ? children[0] : children;
}
function createReactContext(defaultValue, calculateChangedBits) {
var _Provider$childContex, _Consumer$contextType;
var contextProp = '__create-react-context-' + getUniqueId() + '__';
var Provider = /*#__PURE__*/function (_Component) {
_inheritsLoose(Provider, _Component);
function Provider() {
var _this;
_this = _Component.apply(this, arguments) || this;
_this.emitter = createEventEmitter(_this.props.value);
return _this;
}
var _proto = Provider.prototype;
_proto.getChildContext = function getChildContext() {
var _ref;
return _ref = {}, _ref[contextProp] = this.emitter, _ref;
};
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (this.props.value !== nextProps.value) {
var oldValue = this.props.value;
var newValue = nextProps.value;
var changedBits;
if (objectIs(oldValue, newValue)) {
changedBits = 0;
} else {
changedBits = typeof calculateChangedBits === 'function' ? calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;
if (false) {}
changedBits |= 0;
if (changedBits !== 0) {
this.emitter.set(nextProps.value, changedBits);
}
}
}
};
_proto.render = function render() {
return this.props.children;
};
return Provider;
}(external_React_namespaceObject.Component);
Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[contextProp] = (prop_types_default()).object.isRequired, _Provider$childContex);
var Consumer = /*#__PURE__*/function (_Component2) {
_inheritsLoose(Consumer, _Component2);
function Consumer() {
var _this2;
_this2 = _Component2.apply(this, arguments) || this;
_this2.state = {
value: _this2.getValue()
};
_this2.onUpdate = function (newValue, changedBits) {
var observedBits = _this2.observedBits | 0;
if ((observedBits & changedBits) !== 0) {
_this2.setState({
value: _this2.getValue()
});
}
};
return _this2;
}
var _proto2 = Consumer.prototype;
_proto2.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
var observedBits = nextProps.observedBits;
this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits;
};
_proto2.componentDidMount = function componentDidMount() {
if (this.context[contextProp]) {
this.context[contextProp].on(this.onUpdate);
}
var observedBits = this.props.observedBits;
this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits;
};
_proto2.componentWillUnmount = function componentWillUnmount() {
if (this.context[contextProp]) {
this.context[contextProp].off(this.onUpdate);
}
};
_proto2.getValue = function getValue() {
if (this.context[contextProp]) {
return this.context[contextProp].get();
} else {
return defaultValue;
}
};
_proto2.render = function render() {
return onlyChild(this.props.children)(this.state.value);
};
return Consumer;
}(external_React_namespaceObject.Component);
Consumer.contextTypes = (_Consumer$contextType = {}, _Consumer$contextType[contextProp] = (prop_types_default()).object, _Consumer$contextType);
return {
Provider: Provider,
Consumer: Consumer
};
}
var index = (external_React_default()).createContext || createReactContext;
/* harmony default export */ const esm = (index);
// EXTERNAL MODULE: ./node_modules/path-to-regexp/index.js
var path_to_regexp = __webpack_require__(4779);
var path_to_regexp_default = /*#__PURE__*/__webpack_require__.n(path_to_regexp);
// EXTERNAL MODULE: ./node_modules/react-is/index.js
var react_is = __webpack_require__(9864);
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
function objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
// EXTERNAL MODULE: ./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js
var hoist_non_react_statics_cjs = __webpack_require__(8679);
;// CONCATENATED MODULE: ./node_modules/react-router/esm/react-router.js
// TODO: Replace with React.createContext once we can assume React 16+
var createNamedContext = function createNamedContext(name) {
var context = esm();
context.displayName = name;
return context;
};
var historyContext = /*#__PURE__*/createNamedContext("Router-History");
var context = /*#__PURE__*/createNamedContext("Router");
/**
* The public API for putting history on context.
*/
var Router = /*#__PURE__*/function (_React$Component) {
_inheritsLoose(Router, _React$Component);
Router.computeRootMatch = function computeRootMatch(pathname) {
return {
path: "/",
url: "/",
params: {},
isExact: pathname === "/"
};
};
function Router(props) {
var _this;
_this = _React$Component.call(this, props) || this;
_this.state = {
location: props.history.location
}; // This is a bit of a hack. We have to start listening for location
// changes here in the constructor in case there are any <Redirect>s
// on the initial render. If there are, they will replace/push when
// they mount and since cDM fires in children before parents, we may
// get a new location before the <Router> is mounted.
_this._isMounted = false;
_this._pendingLocation = null;
if (!props.staticContext) {
_this.unlisten = props.history.listen(function (location) {
_this._pendingLocation = location;
});
}
return _this;
}
var _proto = Router.prototype;
_proto.componentDidMount = function componentDidMount() {
var _this2 = this;
this._isMounted = true;
if (this.unlisten) {
// Any pre-mount location changes have been captured at
// this point, so unregister the listener.
this.unlisten();
}
if (!this.props.staticContext) {
this.unlisten = this.props.history.listen(function (location) {
if (_this2._isMounted) {
_this2.setState({
location: location
});
}
});
}
if (this._pendingLocation) {
this.setState({
location: this._pendingLocation
});
}
};
_proto.componentWillUnmount = function componentWillUnmount() {
if (this.unlisten) {
this.unlisten();
this._isMounted = false;
this._pendingLocation = null;
}
};
_proto.render = function render() {
return /*#__PURE__*/external_React_default().createElement(context.Provider, {
value: {
history: this.props.history,
location: this.state.location,
match: Router.computeRootMatch(this.state.location.pathname),
staticContext: this.props.staticContext
}
}, /*#__PURE__*/external_React_default().createElement(historyContext.Provider, {
children: this.props.children || null,
value: this.props.history
}));
};
return Router;
}((external_React_default()).Component);
if (false) {}
/**
* The public API for a <Router> that stores location in memory.
*/
var MemoryRouter = /*#__PURE__*/function (_React$Component) {
_inheritsLoose(MemoryRouter, _React$Component);
function MemoryRouter() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
_this.history = createMemoryHistory(_this.props);
return _this;
}
var _proto = MemoryRouter.prototype;
_proto.render = function render() {
return /*#__PURE__*/external_React_default().createElement(Router, {
history: this.history,
children: this.props.children
});
};
return MemoryRouter;
}((external_React_default()).Component);
if (false) {}
var Lifecycle = /*#__PURE__*/function (_React$Component) {
_inheritsLoose(Lifecycle, _React$Component);
function Lifecycle() {
return _React$Component.apply(this, arguments) || this;
}
var _proto = Lifecycle.prototype;
_proto.componentDidMount = function componentDidMount() {
if (this.props.onMount) this.props.onMount.call(this, this);
};
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
if (this.props.onUpdate) this.props.onUpdate.call(this, this, prevProps);
};
_proto.componentWillUnmount = function componentWillUnmount() {
if (this.props.onUnmount) this.props.onUnmount.call(this, this);
};
_proto.render = function render() {
return null;
};
return Lifecycle;
}((external_React_default()).Component);
/**
* The public API for prompting the user before navigating away from a screen.
*/
function Prompt(_ref) {
var message = _ref.message,
_ref$when = _ref.when,
when = _ref$when === void 0 ? true : _ref$when;
return /*#__PURE__*/React.createElement(context.Consumer, null, function (context) {
!context ? false ? 0 : invariant(false) : void 0;
if (!when || context.staticContext) return null;
var method = context.history.block;
return /*#__PURE__*/React.createElement(Lifecycle, {
onMount: function onMount(self) {
self.release = method(message);
},
onUpdate: function onUpdate(self, prevProps) {
if (prevProps.message !== message) {
self.release();
self.release = method(message);
}
},
onUnmount: function onUnmount(self) {
self.release();
},
message: message
});
});
}
if (false) { var messageType; }
var cache = {};
var cacheLimit = 10000;
var cacheCount = 0;
function compilePath(path) {
if (cache[path]) return cache[path];
var generator = pathToRegexp.compile(path);
if (cacheCount < cacheLimit) {
cache[path] = generator;
cacheCount++;
}
return generator;
}
/**
* Public API for generating a URL pathname from a path and parameters.
*/
function generatePath(path, params) {
if (path === void 0) {
path = "/";
}
if (params === void 0) {
params = {};
}
return path === "/" ? path : compilePath(path)(params, {
pretty: true
});
}
/**
* The public API for navigating programmatically with a component.
*/
function Redirect(_ref) {
var computedMatch = _ref.computedMatch,
to = _ref.to,
_ref$push = _ref.push,
push = _ref$push === void 0 ? false : _ref$push;
return /*#__PURE__*/React.createElement(context.Consumer, null, function (context) {
!context ? false ? 0 : invariant(false) : void 0;
var history = context.history,
staticContext = context.staticContext;
var method = push ? history.push : history.replace;
var location = createLocation(computedMatch ? typeof to === "string" ? generatePath(to, computedMatch.params) : _extends({}, to, {
pathname: generatePath(to.pathname, computedMatch.params)
}) : to); // When rendering in a static context,
// set the new location immediately.
if (staticContext) {
method(location);
return null;
}
return /*#__PURE__*/React.createElement(Lifecycle, {
onMount: function onMount() {
method(location);
},
onUpdate: function onUpdate(self, prevProps) {
var prevLocation = createLocation(prevProps.to);
if (!locationsAreEqual(prevLocation, _extends({}, location, {
key: prevLocation.key
}))) {
method(location);
}
},
to: to
});
});
}
if (false) {}
var cache$1 = {};
var cacheLimit$1 = 10000;
var cacheCount$1 = 0;
function compilePath$1(path, options) {
var cacheKey = "" + options.end + options.strict + options.sensitive;
var pathCache = cache$1[cacheKey] || (cache$1[cacheKey] = {});
if (pathCache[path]) return pathCache[path];
var keys = [];
var regexp = path_to_regexp_default()(path, keys, options);
var result = {
regexp: regexp,
keys: keys
};
if (cacheCount$1 < cacheLimit$1) {
pathCache[path] = result;
cacheCount$1++;
}
return result;
}
/**
* Public API for matching a URL pathname to a path.
*/
function matchPath(pathname, options) {
if (options === void 0) {
options = {};
}
if (typeof options === "string" || Array.isArray(options)) {
options = {
path: options
};
}
var _options = options,
path = _options.path,
_options$exact = _options.exact,
exact = _options$exact === void 0 ? false : _options$exact,
_options$strict = _options.strict,
strict = _options$strict === void 0 ? false : _options$strict,
_options$sensitive = _options.sensitive,
sensitive = _options$sensitive === void 0 ? false : _options$sensitive;
var paths = [].concat(path);
return paths.reduce(function (matched, path) {
if (!path && path !== "") return null;
if (matched) return matched;
var _compilePath = compilePath$1(path, {
end: exact,
strict: strict,
sensitive: sensitive
}),
regexp = _compilePath.regexp,
keys = _compilePath.keys;
var match = regexp.exec(pathname);
if (!match) return null;
var url = match[0],
values = match.slice(1);
var isExact = pathname === url;
if (exact && !isExact) return null;
return {
path: path,
// the path used to match
url: path === "/" && url === "" ? "/" : url,
// the matched portion of the URL
isExact: isExact,
// whether or not we matched exactly
params: keys.reduce(function (memo, key, index) {
memo[key.name] = values[index];
return memo;
}, {})
};
}, null);
}
function isEmptyChildren(children) {
return external_React_default().Children.count(children) === 0;
}
function evalChildrenDev(children, props, path) {
var value = children(props);
false ? 0 : void 0;
return value || null;
}
/**
* The public API for matching a single path and rendering.
*/
var Route = /*#__PURE__*/function (_React$Component) {
_inheritsLoose(Route, _React$Component);
function Route() {
return _React$Component.apply(this, arguments) || this;
}
var _proto = Route.prototype;
_proto.render = function render() {
var _this = this;
return /*#__PURE__*/external_React_default().createElement(context.Consumer, null, function (context$1) {
!context$1 ? false ? 0 : tiny_invariant_esm_invariant(false) : void 0;
var location = _this.props.location || context$1.location;
var match = _this.props.computedMatch ? _this.props.computedMatch // <Switch> already computed the match for us
: _this.props.path ? matchPath(location.pathname, _this.props) : context$1.match;
var props = extends_extends({}, context$1, {
location: location,
match: match
});
var _this$props = _this.props,
children = _this$props.children,
component = _this$props.component,
render = _this$props.render; // Preact uses an empty array as children by
// default, so use null if that's the case.
if (Array.isArray(children) && isEmptyChildren(children)) {
children = null;
}
return /*#__PURE__*/external_React_default().createElement(context.Provider, {
value: props
}, props.match ? children ? typeof children === "function" ? false ? 0 : children(props) : children : component ? /*#__PURE__*/external_React_default().createElement(component, props) : render ? render(props) : null : typeof children === "function" ? false ? 0 : children(props) : null);
});
};
return Route;
}((external_React_default()).Component);
if (false) {}
function react_router_addLeadingSlash(path) {
return path.charAt(0) === "/" ? path : "/" + path;
}
function addBasename(basename, location) {
if (!basename) return location;
return extends_extends({}, location, {
pathname: react_router_addLeadingSlash(basename) + location.pathname
});
}
function react_router_stripBasename(basename, location) {
if (!basename) return location;
var base = react_router_addLeadingSlash(basename);
if (location.pathname.indexOf(base) !== 0) return location;
return extends_extends({}, location, {
pathname: location.pathname.substr(base.length)
});
}
function createURL(location) {
return typeof location === "string" ? location : createPath(location);
}
function staticHandler(methodName) {
return function () {
false ? 0 : tiny_invariant_esm_invariant(false) ;
};
}
function noop() {}
/**
* The public top-level API for a "static" <Router>, so-called because it
* can't actually change the current location. Instead, it just records
* location changes in a context object. Useful mainly in testing and
* server-rendering scenarios.
*/
var StaticRouter = /*#__PURE__*/function (_React$Component) {
_inheritsLoose(StaticRouter, _React$Component);
function StaticRouter() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
_this.handlePush = function (location) {
return _this.navigateTo(location, "PUSH");
};
_this.handleReplace = function (location) {
return _this.navigateTo(location, "REPLACE");
};
_this.handleListen = function () {
return noop;
};
_this.handleBlock = function () {
return noop;
};
return _this;
}
var _proto = StaticRouter.prototype;
_proto.navigateTo = function navigateTo(location, action) {
var _this$props = this.props,
_this$props$basename = _this$props.basename,
basename = _this$props$basename === void 0 ? "" : _this$props$basename,
_this$props$context = _this$props.context,
context = _this$props$context === void 0 ? {} : _this$props$context;
context.action = action;
context.location = addBasename(basename, history_createLocation(location));
context.url = createURL(context.location);
};
_proto.render = function render() {
var _this$props2 = this.props,
_this$props2$basename = _this$props2.basename,
basename = _this$props2$basename === void 0 ? "" : _this$props2$basename,
_this$props2$context = _this$props2.context,
context = _this$props2$context === void 0 ? {} : _this$props2$context,
_this$props2$location = _this$props2.location,
location = _this$props2$location === void 0 ? "/" : _this$props2$location,
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_this$props2, ["basename", "context", "location"]);
var history = {
createHref: function createHref(path) {
return react_router_addLeadingSlash(basename + createURL(path));
},
action: "POP",
location: react_router_stripBasename(basename, history_createLocation(location)),
push: this.handlePush,
replace: this.handleReplace,
go: staticHandler("go"),
goBack: staticHandler("goBack"),
goForward: staticHandler("goForward"),
listen: this.handleListen,
block: this.handleBlock
};
return /*#__PURE__*/external_React_default().createElement(Router, extends_extends({}, rest, {
history: history,
staticContext: context
}));
};
return StaticRouter;
}((external_React_default()).Component);
if (false) {}
/**
* The public API for rendering the first <Route> that matches.
*/
var Switch = /*#__PURE__*/function (_React$Component) {
_inheritsLoose(Switch, _React$Component);
function Switch() {
return _React$Component.apply(this, arguments) || this;
}
var _proto = Switch.prototype;
_proto.render = function render() {
var _this = this;
return /*#__PURE__*/external_React_default().createElement(context.Consumer, null, function (context) {
!context ? false ? 0 : tiny_invariant_esm_invariant(false) : void 0;
var location = _this.props.location || context.location;
var element, match; // We use React.Children.forEach instead of React.Children.toArray().find()
// here because toArray adds keys to all child elements and we do not want
// to trigger an unmount/remount for two <Route>s that render the same
// component at different URLs.
external_React_default().Children.forEach(_this.props.children, function (child) {
if (match == null && /*#__PURE__*/external_React_default().isValidElement(child)) {
element = child;
var path = child.props.path || child.props.from;
match = path ? matchPath(location.pathname, extends_extends({}, child.props, {
path: path
})) : context.match;
}
});
return match ? /*#__PURE__*/external_React_default().cloneElement(element, {
location: location,
computedMatch: match
}) : null;
});
};
return Switch;
}((external_React_default()).Component);
if (false) {}
/**
* A public higher-order component to access the imperative API
*/
function withRouter(Component) {
var displayName = "withRouter(" + (Component.displayName || Component.name) + ")";
var C = function C(props) {
var wrappedComponentRef = props.wrappedComponentRef,
remainingProps = _objectWithoutPropertiesLoose(props, ["wrappedComponentRef"]);
return /*#__PURE__*/React.createElement(context.Consumer, null, function (context) {
!context ? false ? 0 : invariant(false) : void 0;
return /*#__PURE__*/React.createElement(Component, _extends({}, remainingProps, context, {
ref: wrappedComponentRef
}));
});
};
C.displayName = displayName;
C.WrappedComponent = Component;
if (false) {}
return hoistStatics(C, Component);
}
var useContext = (external_React_default()).useContext;
function useHistory() {
if (false) {}
return useContext(historyContext);
}
function useLocation() {
if (false) {}
return useContext(context).location;
}
function useParams() {
if (false) {}
var match = useContext(context).match;
return match ? match.params : {};
}
function useRouteMatch(path) {
if (false) {}
var location = useLocation();
var match = useContext(context).match;
return path ? matchPath(location.pathname, path) : match;
}
if (false) { var secondaryBuildName, initialBuildName, buildNames, key, global; }
//# sourceMappingURL=react-router.js.map
;// CONCATENATED MODULE: ./node_modules/react-router-dom/esm/react-router-dom.js
/**
* The public API for a <Router> that uses HTML5 history.
*/
var BrowserRouter = /*#__PURE__*/function (_React$Component) {
_inheritsLoose(BrowserRouter, _React$Component);
function BrowserRouter() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
_this.history = createBrowserHistory(_this.props);
return _this;
}
var _proto = BrowserRouter.prototype;
_proto.render = function render() {
return /*#__PURE__*/external_React_default().createElement(Router, {
history: this.history,
children: this.props.children
});
};
return BrowserRouter;
}((external_React_default()).Component);
if (false) {}
/**
* The public API for a <Router> that uses window.location.hash.
*/
var HashRouter = /*#__PURE__*/function (_React$Component) {
_inheritsLoose(HashRouter, _React$Component);
function HashRouter() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
_this.history = createHashHistory(_this.props);
return _this;
}
var _proto = HashRouter.prototype;
_proto.render = function render() {
return /*#__PURE__*/external_React_default().createElement(Router, {
history: this.history,
children: this.props.children
});
};
return HashRouter;
}((external_React_default()).Component);
if (false) {}
var resolveToLocation = function resolveToLocation(to, currentLocation) {
return typeof to === "function" ? to(currentLocation) : to;
};
var normalizeToLocation = function normalizeToLocation(to, currentLocation) {
return typeof to === "string" ? history_createLocation(to, null, null, currentLocation) : to;
};
var forwardRefShim = function forwardRefShim(C) {
return C;
};
var forwardRef = (external_React_default()).forwardRef;
if (typeof forwardRef === "undefined") {
forwardRef = forwardRefShim;
}
function isModifiedEvent(event) {
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
}
var LinkAnchor = forwardRef(function (_ref, forwardedRef) {
var innerRef = _ref.innerRef,
navigate = _ref.navigate,
_onClick = _ref.onClick,
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref, ["innerRef", "navigate", "onClick"]);
var target = rest.target;
var props = extends_extends({}, rest, {
onClick: function onClick(event) {
try {
if (_onClick) _onClick(event);
} catch (ex) {
event.preventDefault();
throw ex;
}
if (!event.defaultPrevented && // onClick prevented default
event.button === 0 && ( // ignore everything but left clicks
!target || target === "_self") && // let browser handle "target=_blank" etc.
!isModifiedEvent(event) // ignore clicks with modifier keys
) {
event.preventDefault();
navigate();
}
}
}); // React 15 compat
if (forwardRefShim !== forwardRef) {
props.ref = forwardedRef || innerRef;
} else {
props.ref = innerRef;
}
/* eslint-disable-next-line jsx-a11y/anchor-has-content */
return /*#__PURE__*/external_React_default().createElement("a", props);
});
if (false) {}
/**
* The public API for rendering a history-aware <a>.
*/
var Link = forwardRef(function (_ref2, forwardedRef) {
var _ref2$component = _ref2.component,
component = _ref2$component === void 0 ? LinkAnchor : _ref2$component,
replace = _ref2.replace,
to = _ref2.to,
innerRef = _ref2.innerRef,
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref2, ["component", "replace", "to", "innerRef"]);
return /*#__PURE__*/external_React_default().createElement(context.Consumer, null, function (context) {
!context ? false ? 0 : tiny_invariant_esm_invariant(false) : void 0;
var history = context.history;
var location = normalizeToLocation(resolveToLocation(to, context.location), context.location);
var href = location ? history.createHref(location) : "";
var props = extends_extends({}, rest, {
href: href,
navigate: function navigate() {
var location = resolveToLocation(to, context.location);
var isDuplicateNavigation = createPath(context.location) === createPath(normalizeToLocation(location));
var method = replace || isDuplicateNavigation ? history.replace : history.push;
method(location);
}
}); // React 15 compat
if (forwardRefShim !== forwardRef) {
props.ref = forwardedRef || innerRef;
} else {
props.innerRef = innerRef;
}
return /*#__PURE__*/external_React_default().createElement(component, props);
});
});
if (false) { var refType, toType; }
var forwardRefShim$1 = function forwardRefShim(C) {
return C;
};
var forwardRef$1 = (external_React_default()).forwardRef;
if (typeof forwardRef$1 === "undefined") {
forwardRef$1 = forwardRefShim$1;
}
function joinClassnames() {
for (var _len = arguments.length, classnames = new Array(_len), _key = 0; _key < _len; _key++) {
classnames[_key] = arguments[_key];
}
return classnames.filter(function (i) {
return i;
}).join(" ");
}
/**
* A <Link> wrapper that knows if it's "active" or not.
*/
var NavLink = forwardRef$1(function (_ref, forwardedRef) {
var _ref$ariaCurrent = _ref["aria-current"],
ariaCurrent = _ref$ariaCurrent === void 0 ? "page" : _ref$ariaCurrent,
_ref$activeClassName = _ref.activeClassName,
activeClassName = _ref$activeClassName === void 0 ? "active" : _ref$activeClassName,
activeStyle = _ref.activeStyle,
classNameProp = _ref.className,
exact = _ref.exact,
isActiveProp = _ref.isActive,
locationProp = _ref.location,
sensitive = _ref.sensitive,
strict = _ref.strict,
styleProp = _ref.style,
to = _ref.to,
innerRef = _ref.innerRef,
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref, ["aria-current", "activeClassName", "activeStyle", "className", "exact", "isActive", "location", "sensitive", "strict", "style", "to", "innerRef"]);
return /*#__PURE__*/external_React_default().createElement(context.Consumer, null, function (context) {
!context ? false ? 0 : tiny_invariant_esm_invariant(false) : void 0;
var currentLocation = locationProp || context.location;
var toLocation = normalizeToLocation(resolveToLocation(to, currentLocation), currentLocation);
var path = toLocation.pathname; // Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202
var escapedPath = path && path.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
var match = escapedPath ? matchPath(currentLocation.pathname, {
path: escapedPath,
exact: exact,
sensitive: sensitive,
strict: strict
}) : null;
var isActive = !!(isActiveProp ? isActiveProp(match, currentLocation) : match);
var className = typeof classNameProp === "function" ? classNameProp(isActive) : classNameProp;
var style = typeof styleProp === "function" ? styleProp(isActive) : styleProp;
if (isActive) {
className = joinClassnames(className, activeClassName);
style = extends_extends({}, style, activeStyle);
}
var props = extends_extends({
"aria-current": isActive && ariaCurrent || null,
className: className,
style: style,
to: toLocation
}, rest); // React 15 compat
if (forwardRefShim$1 !== forwardRef$1) {
props.ref = forwardedRef || innerRef;
} else {
props.innerRef = innerRef;
}
return /*#__PURE__*/external_React_default().createElement(Link, props);
});
});
if (false) { var ariaCurrentType; }
//# sourceMappingURL=react-router-dom.js.map
;// CONCATENATED MODULE: ./src/admin/hooks/use-current-css-class.js
/* harmony default export */ const use_current_css_class = (function (selector) {
(0,external_wp_element_namespaceObject.useEffect)(function () {
var _menu$parentElement, _menu$parentElement$c;
var menu = document.querySelector(selector);
if (!menu) {
return;
}
menu === null || menu === void 0 ? void 0 : (_menu$parentElement = menu.parentElement) === null || _menu$parentElement === void 0 ? void 0 : (_menu$parentElement$c = _menu$parentElement.classList) === null || _menu$parentElement$c === void 0 ? void 0 : _menu$parentElement$c.add('current');
return function () {
var _menu$parentElement2, _menu$parentElement2$;
menu === null || menu === void 0 ? void 0 : (_menu$parentElement2 = menu.parentElement) === null || _menu$parentElement2 === void 0 ? void 0 : (_menu$parentElement2$ = _menu$parentElement2.classList) === null || _menu$parentElement2$ === void 0 ? void 0 : _menu$parentElement2$.remove('current');
};
}, []);
});
;// CONCATENATED MODULE: ./src/admin/hooks/index.js
;// CONCATENATED MODULE: ./src/admin/components/getting-started/index.js
/* harmony default export */ const getting_started = (function () {
use_current_css_class('#toplevel_page_blockart a[href="admin.php?page=blockart#/getting-started"]:not(.toplevel_page_blockart)');
return /*#__PURE__*/React.createElement("div", {
className: "blockart-welcome"
}, /*#__PURE__*/React.createElement("div", {
className: "blockart-welcome-header"
}, /*#__PURE__*/React.createElement("svg", {
width: "24",
height: "24",
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, /*#__PURE__*/React.createElement("path", {
d: "M22 22H2V2h20zM3 21h18V3H3z",
fill: "#0369fc"
}), /*#__PURE__*/React.createElement("path", {
d: "M13.46 10l-1.39-5-1.39 5zm.92 3H9.77l-1 4.46V19h6.4v-1.52z",
fill: "#005cff",
fillRule: "evenodd"
})), /*#__PURE__*/React.createElement("h2", null, (0,external_wp_i18n_namespaceObject.__)('GETTING STARTED', 'blockart')), /*#__PURE__*/React.createElement("a", {
href: _BLOCKART_ADMIN_.adminURL
}, /*#__PURE__*/React.createElement("svg", {
width: "11",
height: "11",
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, /*#__PURE__*/React.createElement("path", {
d: "M12 10.6L3.4 2 2 3.3l8.6 8.6L2 20.4l1.4 1.4 8.6-8.5 8.5 8.5 1.4-1.4-8.5-8.5L22 3.5l-1.4-1.3-8.6 8.4z",
fill: "#72777C"
})))), /*#__PURE__*/React.createElement("div", {
className: "blockart-welcome-content"
}, /*#__PURE__*/React.createElement("h2", null, (0,external_wp_i18n_namespaceObject.__)('Welcome to BlockArt', 'blockart')), /*#__PURE__*/React.createElement("p", null, (0,external_wp_i18n_namespaceObject.__)('BlockArt is a collection of Gutenberg blocks that you can use to create posts and pages. Try it by creating a new page or read our documentation to get started.', 'blockart')), /*#__PURE__*/React.createElement("div", {
className: "blockart-welcome-content-cta"
}, /*#__PURE__*/React.createElement("a", {
className: "blockart-welcome-btn",
href: _BLOCKART_ADMIN_.adminURL + 'post-new.php?post_type=page&blockart-onboarding=true'
}, (0,external_wp_i18n_namespaceObject.__)('Create Your First Page', 'blockart')), /*#__PURE__*/React.createElement("a", {
className: "blockart-welcome-btn",
href: "https://docs.wpblockart.com/",
target: "_blank",
rel: "noreferrer"
}, (0,external_wp_i18n_namespaceObject.__)('View Documentation', 'blockart')))), /*#__PURE__*/React.createElement("div", {
className: "blockart-welcome-footer"
}, /*#__PURE__*/React.createElement("h2", null, (0,external_wp_i18n_namespaceObject.__)('Need help?', 'blockart')), /*#__PURE__*/React.createElement("p", null, (0,external_wp_i18n_namespaceObject.__)('Our support team is always here to help you out. If you got any queries or confusion regarding BlockArt, please reach us out by clicking the button below:', 'blockart')), /*#__PURE__*/React.createElement("a", {
className: "blockart-welcome-btn",
href: "https://wpblockart.com/contact/",
target: "_blank",
rel: "noreferrer"
}, (0,external_wp_i18n_namespaceObject.__)('Contact Us', 'blockart'))));
});
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
function _iterableToArrayLimit(arr, i) {
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
if (_i == null) return;
var _arr = [];
var _n = true;
var _d = false;
var _s, _e;
try {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
;// CONCATENATED MODULE: external ["wp","components"]
const external_wp_components_namespaceObject = window["wp"]["components"];
;// CONCATENATED MODULE: ./node_modules/clsx/dist/clsx.m.js
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const clsx_m = (clsx);
;// CONCATENATED MODULE: external "ReactDOM"
const external_ReactDOM_namespaceObject = window["ReactDOM"];
;// CONCATENATED MODULE: ./node_modules/react-toastify/dist/react-toastify.esm.js
function react_toastify_esm_extends() {
react_toastify_esm_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return react_toastify_esm_extends.apply(this, arguments);
}
function react_toastify_esm_objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function isNum(v) {
return typeof v === 'number' && !isNaN(v);
}
function isBool(v) {
return typeof v === 'boolean';
}
function isStr(v) {
return typeof v === 'string';
}
function isFn(v) {
return typeof v === 'function';
}
function parseClassName(v) {
return isStr(v) || isFn(v) ? v : null;
}
function isToastIdValid(toastId) {
return toastId === 0 || toastId;
}
function getAutoCloseDelay(toastAutoClose, containerAutoClose) {
return toastAutoClose === false || isNum(toastAutoClose) && toastAutoClose > 0 ? toastAutoClose : containerAutoClose;
}
var canUseDom = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
function canBeRendered(content) {
return (0,external_React_namespaceObject.isValidElement)(content) || isStr(content) || isFn(content) || isNum(content);
}
var POSITION = {
TOP_LEFT: 'top-left',
TOP_RIGHT: 'top-right',
TOP_CENTER: 'top-center',
BOTTOM_LEFT: 'bottom-left',
BOTTOM_RIGHT: 'bottom-right',
BOTTOM_CENTER: 'bottom-center'
};
var TYPE = {
INFO: 'info',
SUCCESS: 'success',
WARNING: 'warning',
ERROR: 'error',
DEFAULT: 'default'
};
/**
* Used to collapse toast after exit animation
*/
function collapseToast(node, done, duration
/* COLLAPSE_DURATION */
) {
if (duration === void 0) {
duration = 300;
}
var scrollHeight = node.scrollHeight,
style = node.style;
requestAnimationFrame(function () {
style.minHeight = 'initial';
style.height = scrollHeight + 'px';
style.transition = "all " + duration + "ms";
requestAnimationFrame(function () {
style.height = '0';
style.padding = '0';
style.margin = '0';
setTimeout(done, duration);
});
});
}
/**
* Css animation that just work.
* You could use animate.css for instance
*
*
* ```
* cssTransition({
* enter: "animate__animated animate__bounceIn",
* exit: "animate__animated animate__bounceOut"
* })
* ```
*
*/
function cssTransition(_ref) {
var enter = _ref.enter,
exit = _ref.exit,
_ref$appendPosition = _ref.appendPosition,
appendPosition = _ref$appendPosition === void 0 ? false : _ref$appendPosition,
_ref$collapse = _ref.collapse,
collapse = _ref$collapse === void 0 ? true : _ref$collapse,
_ref$collapseDuration = _ref.collapseDuration,
collapseDuration = _ref$collapseDuration === void 0 ? 300 : _ref$collapseDuration;
return function ToastTransition(_ref2) {
var children = _ref2.children,
position = _ref2.position,
preventExitTransition = _ref2.preventExitTransition,
done = _ref2.done,
nodeRef = _ref2.nodeRef,
isIn = _ref2.isIn;
var enterClassName = appendPosition ? enter + "--" + position : enter;
var exitClassName = appendPosition ? exit + "--" + position : exit;
var baseClassName = (0,external_React_namespaceObject.useRef)();
var animationStep = (0,external_React_namespaceObject.useRef)(0
/* Enter */
);
(0,external_React_namespaceObject.useLayoutEffect)(function () {
onEnter();
}, []);
(0,external_React_namespaceObject.useEffect)(function () {
if (!isIn) preventExitTransition ? onExited() : onExit();
}, [isIn]);
function onEnter() {
var node = nodeRef.current;
baseClassName.current = node.className;
node.className += " " + enterClassName;
node.addEventListener('animationend', onEntered);
node.addEventListener('animationcancel', onEntered);
}
function onEntered(e) {
if (e.target !== nodeRef.current) return;
var node = nodeRef.current;
node.dispatchEvent(new Event("d"
/* ENTRANCE_ANIMATION_END */
));
node.removeEventListener('animationend', onEntered);
node.removeEventListener('animationcancel', onEntered);
if (animationStep.current === 0
/* Enter */
) {
node.className = baseClassName.current;
}
}
function onExit() {
animationStep.current = 1
/* Exit */
;
var node = nodeRef.current;
node.className += " " + exitClassName;
node.addEventListener('animationend', onExited);
}
function onExited() {
var node = nodeRef.current;
node.removeEventListener('animationend', onExited);
collapse ? collapseToast(node, done, collapseDuration) : done();
}
return external_React_default().createElement((external_React_default()).Fragment, null, children);
};
}
var eventManager = {
list: /*#__PURE__*/new Map(),
emitQueue: /*#__PURE__*/new Map(),
on: function on(event, callback) {
this.list.has(event) || this.list.set(event, []);
this.list.get(event).push(callback);
return this;
},
off: function off(event, callback) {
if (callback) {
var cb = this.list.get(event).filter(function (cb) {
return cb !== callback;
});
this.list.set(event, cb);
return this;
}
this.list["delete"](event);
return this;
},
cancelEmit: function cancelEmit(event) {
var timers = this.emitQueue.get(event);
if (timers) {
timers.forEach(clearTimeout);
this.emitQueue["delete"](event);
}
return this;
},
/**
* Enqueue the event at the end of the call stack
* Doing so let the user call toast as follow:
* toast('1')
* toast('2')
* toast('3')
* Without setTimemout the code above will not work
*/
emit: function emit(event) {
var _this = this;
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
this.list.has(event) && this.list.get(event).forEach(function (callback) {
var timer = setTimeout(function () {
// @ts-ignore
callback.apply(void 0, args);
}, 0);
_this.emitQueue.has(event) || _this.emitQueue.set(event, []);
_this.emitQueue.get(event).push(timer);
});
}
};
var _excluded = ["delay", "staleId"];
function useToastContainer(props) {
var _useReducer = (0,external_React_namespaceObject.useReducer)(function (x) {
return x + 1;
}, 0),
forceUpdate = _useReducer[1];
var _useState = (0,external_React_namespaceObject.useState)([]),
toastIds = _useState[0],
setToastIds = _useState[1];
var containerRef = (0,external_React_namespaceObject.useRef)(null);
var toastToRender = (0,external_React_namespaceObject.useRef)(new Map()).current;
var isToastActive = function isToastActive(id) {
return toastIds.indexOf(id) !== -1;
};
var instance = (0,external_React_namespaceObject.useRef)({
toastKey: 1,
displayedToast: 0,
count: 0,
queue: [],
props: props,
containerId: null,
isToastActive: isToastActive,
getToast: function getToast(id) {
return toastToRender.get(id);
}
}).current;
(0,external_React_namespaceObject.useEffect)(function () {
instance.containerId = props.containerId;
eventManager.cancelEmit(3
/* WillUnmount */
).on(0
/* Show */
, buildToast).on(1
/* Clear */
, function (toastId) {
return containerRef.current && removeToast(toastId);
}).on(5
/* ClearWaitingQueue */
, clearWaitingQueue).emit(2
/* DidMount */
, instance);
return function () {
return eventManager.emit(3
/* WillUnmount */
, instance);
};
}, []);
(0,external_React_namespaceObject.useEffect)(function () {
instance.isToastActive = isToastActive;
instance.displayedToast = toastIds.length;
eventManager.emit(4
/* Change */
, toastIds.length, props.containerId);
}, [toastIds]);
(0,external_React_namespaceObject.useEffect)(function () {
instance.props = props;
});
function clearWaitingQueue(_ref) {
var containerId = _ref.containerId;
var limit = instance.props.limit;
if (limit && (!containerId || instance.containerId === containerId)) {
instance.count -= instance.queue.length;
instance.queue = [];
}
}
function removeToast(toastId) {
setToastIds(function (state) {
return isToastIdValid(toastId) ? state.filter(function (id) {
return id !== toastId;
}) : [];
});
}
function dequeueToast() {
var _instance$queue$shift = instance.queue.shift(),
toastContent = _instance$queue$shift.toastContent,
toastProps = _instance$queue$shift.toastProps,
staleId = _instance$queue$shift.staleId;
appendToast(toastContent, toastProps, staleId);
}
/**
* check if a container is attached to the dom
* check for multi-container, build only if associated
* check for duplicate toastId if no update
*/
function isNotValid(options) {
return !containerRef.current || instance.props.enableMultiContainer && options.containerId !== instance.props.containerId || toastToRender.has(options.toastId) && options.updateId == null;
} // this function and all the function called inside needs to rely on refs
function buildToast(content, _ref2) {
var delay = _ref2.delay,
staleId = _ref2.staleId,
options = react_toastify_esm_objectWithoutPropertiesLoose(_ref2, _excluded);
if (!canBeRendered(content) || isNotValid(options)) return;
var toastId = options.toastId,
updateId = options.updateId,
data = options.data;
var props = instance.props;
var closeToast = function closeToast() {
return removeToast(toastId);
};
var isNotAnUpdate = updateId == null;
if (isNotAnUpdate) instance.count++;
var toastProps = {
toastId: toastId,
updateId: updateId,
isLoading: options.isLoading,
theme: options.theme || props.theme,
icon: options.icon != null ? options.icon : props.icon,
isIn: false,
key: options.key || instance.toastKey++,
type: options.type,
closeToast: closeToast,
closeButton: options.closeButton,
rtl: props.rtl,
position: options.position || props.position,
transition: options.transition || props.transition,
className: parseClassName(options.className || props.toastClassName),
bodyClassName: parseClassName(options.bodyClassName || props.bodyClassName),
style: options.style || props.toastStyle,
bodyStyle: options.bodyStyle || props.bodyStyle,
onClick: options.onClick || props.onClick,
pauseOnHover: isBool(options.pauseOnHover) ? options.pauseOnHover : props.pauseOnHover,
pauseOnFocusLoss: isBool(options.pauseOnFocusLoss) ? options.pauseOnFocusLoss : props.pauseOnFocusLoss,
draggable: isBool(options.draggable) ? options.draggable : props.draggable,
draggablePercent: options.draggablePercent || props.draggablePercent,
draggableDirection: options.draggableDirection || props.draggableDirection,
closeOnClick: isBool(options.closeOnClick) ? options.closeOnClick : props.closeOnClick,
progressClassName: parseClassName(options.progressClassName || props.progressClassName),
progressStyle: options.progressStyle || props.progressStyle,
autoClose: options.isLoading ? false : getAutoCloseDelay(options.autoClose, props.autoClose),
hideProgressBar: isBool(options.hideProgressBar) ? options.hideProgressBar : props.hideProgressBar,
progress: options.progress,
role: options.role || props.role,
deleteToast: function deleteToast() {
toastToRender["delete"](toastId);
var queueLen = instance.queue.length;
instance.count = isToastIdValid(toastId) ? instance.count - 1 : instance.count - instance.displayedToast;
if (instance.count < 0) instance.count = 0;
if (queueLen > 0) {
var freeSlot = isToastIdValid(toastId) ? 1 : instance.props.limit;
if (queueLen === 1 || freeSlot === 1) {
instance.displayedToast++;
dequeueToast();
} else {
var toDequeue = freeSlot > queueLen ? queueLen : freeSlot;
instance.displayedToast = toDequeue;
for (var i = 0; i < toDequeue; i++) {
dequeueToast();
}
}
} else {
forceUpdate();
}
}
};
if (isFn(options.onOpen)) toastProps.onOpen = options.onOpen;
if (isFn(options.onClose)) toastProps.onClose = options.onClose;
toastProps.closeButton = props.closeButton;
if (options.closeButton === false || canBeRendered(options.closeButton)) {
toastProps.closeButton = options.closeButton;
} else if (options.closeButton === true) {
toastProps.closeButton = canBeRendered(props.closeButton) ? props.closeButton : true;
}
var toastContent = content;
if ((0,external_React_namespaceObject.isValidElement)(content) && !isStr(content.type)) {
toastContent = (0,external_React_namespaceObject.cloneElement)(content, {
closeToast: closeToast,
toastProps: toastProps,
data: data
});
} else if (isFn(content)) {
toastContent = content({
closeToast: closeToast,
toastProps: toastProps,
data: data
});
} // not handling limit + delay by design. Waiting for user feedback first
if (props.limit && props.limit > 0 && instance.count > props.limit && isNotAnUpdate) {
instance.queue.push({
toastContent: toastContent,
toastProps: toastProps,
staleId: staleId
});
} else if (isNum(delay) && delay > 0) {
setTimeout(function () {
appendToast(toastContent, toastProps, staleId);
}, delay);
} else {
appendToast(toastContent, toastProps, staleId);
}
}
function appendToast(content, toastProps, staleId) {
var toastId = toastProps.toastId;
if (staleId) toastToRender["delete"](staleId);
toastToRender.set(toastId, {
content: content,
props: toastProps
});
setToastIds(function (state) {
return [].concat(state, [toastId]).filter(function (id) {
return id !== staleId;
});
});
}
function getToastToRender(cb) {
var toRender = new Map();
var collection = Array.from(toastToRender.values());
if (props.newestOnTop) collection.reverse();
collection.forEach(function (toast) {
var position = toast.props.position;
toRender.has(position) || toRender.set(position, []);
toRender.get(position).push(toast);
});
return Array.from(toRender, function (p) {
return cb(p[0], p[1]);
});
}
return {
getToastToRender: getToastToRender,
containerRef: containerRef,
isToastActive: isToastActive
};
}
function getX(e) {
return e.targetTouches && e.targetTouches.length >= 1 ? e.targetTouches[0].clientX : e.clientX;
}
function getY(e) {
return e.targetTouches && e.targetTouches.length >= 1 ? e.targetTouches[0].clientY : e.clientY;
}
function useToast(props) {
var _useState = (0,external_React_namespaceObject.useState)(false),
isRunning = _useState[0],
setIsRunning = _useState[1];
var _useState2 = (0,external_React_namespaceObject.useState)(false),
preventExitTransition = _useState2[0],
setPreventExitTransition = _useState2[1];
var toastRef = (0,external_React_namespaceObject.useRef)(null);
var drag = (0,external_React_namespaceObject.useRef)({
start: 0,
x: 0,
y: 0,
delta: 0,
removalDistance: 0,
canCloseOnClick: true,
canDrag: false,
boundingRect: null,
didMove: false
}).current;
var syncProps = (0,external_React_namespaceObject.useRef)(props);
var autoClose = props.autoClose,
pauseOnHover = props.pauseOnHover,
closeToast = props.closeToast,
onClick = props.onClick,
closeOnClick = props.closeOnClick;
(0,external_React_namespaceObject.useEffect)(function () {
syncProps.current = props;
});
(0,external_React_namespaceObject.useEffect)(function () {
if (toastRef.current) toastRef.current.addEventListener("d"
/* ENTRANCE_ANIMATION_END */
, playToast, {
once: true
});
if (isFn(props.onOpen)) props.onOpen((0,external_React_namespaceObject.isValidElement)(props.children) && props.children.props);
return function () {
var props = syncProps.current;
if (isFn(props.onClose)) props.onClose((0,external_React_namespaceObject.isValidElement)(props.children) && props.children.props);
};
}, []);
(0,external_React_namespaceObject.useEffect)(function () {
props.pauseOnFocusLoss && bindFocusEvents();
return function () {
props.pauseOnFocusLoss && unbindFocusEvents();
};
}, [props.pauseOnFocusLoss]);
function onDragStart(e) {
if (props.draggable) {
bindDragEvents();
var toast = toastRef.current;
drag.canCloseOnClick = true;
drag.canDrag = true;
drag.boundingRect = toast.getBoundingClientRect();
toast.style.transition = '';
drag.x = getX(e.nativeEvent);
drag.y = getY(e.nativeEvent);
if (props.draggableDirection === "x"
/* X */
) {
drag.start = drag.x;
drag.removalDistance = toast.offsetWidth * (props.draggablePercent / 100);
} else {
drag.start = drag.y;
drag.removalDistance = toast.offsetHeight * (props.draggablePercent === 80
/* DRAGGABLE_PERCENT */
? props.draggablePercent * 1.5 : props.draggablePercent / 100);
}
}
}
function onDragTransitionEnd() {
if (drag.boundingRect) {
var _drag$boundingRect = drag.boundingRect,
top = _drag$boundingRect.top,
bottom = _drag$boundingRect.bottom,
left = _drag$boundingRect.left,
right = _drag$boundingRect.right;
if (props.pauseOnHover && drag.x >= left && drag.x <= right && drag.y >= top && drag.y <= bottom) {
pauseToast();
} else {
playToast();
}
}
}
function playToast() {
setIsRunning(true);
}
function pauseToast() {
setIsRunning(false);
}
function bindFocusEvents() {
if (!document.hasFocus()) pauseToast();
window.addEventListener('focus', playToast);
window.addEventListener('blur', pauseToast);
}
function unbindFocusEvents() {
window.removeEventListener('focus', playToast);
window.removeEventListener('blur', pauseToast);
}
function bindDragEvents() {
drag.didMove = false;
document.addEventListener('mousemove', onDragMove);
document.addEventListener('mouseup', onDragEnd);
document.addEventListener('touchmove', onDragMove);
document.addEventListener('touchend', onDragEnd);
}
function unbindDragEvents() {
document.removeEventListener('mousemove', onDragMove);
document.removeEventListener('mouseup', onDragEnd);
document.removeEventListener('touchmove', onDragMove);
document.removeEventListener('touchend', onDragEnd);
}
function onDragMove(e) {
var toast = toastRef.current;
if (drag.canDrag && toast) {
drag.didMove = true;
if (isRunning) pauseToast();
drag.x = getX(e);
drag.y = getY(e);
if (props.draggableDirection === "x"
/* X */
) {
drag.delta = drag.x - drag.start;
} else {
drag.delta = drag.y - drag.start;
} // prevent false positif during a toast click
if (drag.start !== drag.x) drag.canCloseOnClick = false;
toast.style.transform = "translate" + props.draggableDirection + "(" + drag.delta + "px)";
toast.style.opacity = "" + (1 - Math.abs(drag.delta / drag.removalDistance));
}
}
function onDragEnd() {
unbindDragEvents();
var toast = toastRef.current;
if (drag.canDrag && drag.didMove && toast) {
drag.canDrag = false;
if (Math.abs(drag.delta) > drag.removalDistance) {
setPreventExitTransition(true);
props.closeToast();
return;
}
toast.style.transition = 'transform 0.2s, opacity 0.2s';
toast.style.transform = "translate" + props.draggableDirection + "(0)";
toast.style.opacity = '1';
}
}
var eventHandlers = {
onMouseDown: onDragStart,
onTouchStart: onDragStart,
onMouseUp: onDragTransitionEnd,
onTouchEnd: onDragTransitionEnd
};
if (autoClose && pauseOnHover) {
eventHandlers.onMouseEnter = pauseToast;
eventHandlers.onMouseLeave = playToast;
} // prevent toast from closing when user drags the toast
if (closeOnClick) {
eventHandlers.onClick = function (e) {
onClick && onClick(e);
drag.canCloseOnClick && closeToast();
};
}
return {
playToast: playToast,
pauseToast: pauseToast,
isRunning: isRunning,
preventExitTransition: preventExitTransition,
toastRef: toastRef,
eventHandlers: eventHandlers
};
}
function CloseButton(_ref) {
var closeToast = _ref.closeToast,
theme = _ref.theme,
_ref$ariaLabel = _ref.ariaLabel,
ariaLabel = _ref$ariaLabel === void 0 ? 'close' : _ref$ariaLabel;
return (0,external_React_namespaceObject.createElement)("button", {
className: "Toastify"
/* CSS_NAMESPACE */
+ "__close-button " + "Toastify"
/* CSS_NAMESPACE */
+ "__close-button--" + theme,
type: "button",
onClick: function onClick(e) {
e.stopPropagation();
closeToast(e);
},
"aria-label": ariaLabel
}, (0,external_React_namespaceObject.createElement)("svg", {
"aria-hidden": "true",
viewBox: "0 0 14 16"
}, (0,external_React_namespaceObject.createElement)("path", {
fillRule: "evenodd",
d: "M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"
})));
}
function ProgressBar(_ref) {
var _cx, _animationEvent;
var delay = _ref.delay,
isRunning = _ref.isRunning,
closeToast = _ref.closeToast,
type = _ref.type,
hide = _ref.hide,
className = _ref.className,
userStyle = _ref.style,
controlledProgress = _ref.controlledProgress,
progress = _ref.progress,
rtl = _ref.rtl,
isIn = _ref.isIn,
theme = _ref.theme;
var style = react_toastify_esm_extends({}, userStyle, {
animationDuration: delay + "ms",
animationPlayState: isRunning ? 'running' : 'paused',
opacity: hide ? 0 : 1
});
if (controlledProgress) style.transform = "scaleX(" + progress + ")";
var defaultClassName = clsx_m("Toastify"
/* CSS_NAMESPACE */
+ "__progress-bar", controlledProgress ? "Toastify"
/* CSS_NAMESPACE */
+ "__progress-bar--controlled" : "Toastify"
/* CSS_NAMESPACE */
+ "__progress-bar--animated", "Toastify"
/* CSS_NAMESPACE */
+ "__progress-bar-theme--" + theme, "Toastify"
/* CSS_NAMESPACE */
+ "__progress-bar--" + type, (_cx = {}, _cx["Toastify"
/* CSS_NAMESPACE */
+ "__progress-bar--rtl"] = rtl, _cx));
var classNames = isFn(className) ? className({
rtl: rtl,
type: type,
defaultClassName: defaultClassName
}) : clsx_m(defaultClassName, className); // 🧐 controlledProgress is derived from progress
// so if controlledProgress is set
// it means that this is also the case for progress
var animationEvent = (_animationEvent = {}, _animationEvent[controlledProgress && progress >= 1 ? 'onTransitionEnd' : 'onAnimationEnd'] = controlledProgress && progress < 1 ? null : function () {
isIn && closeToast();
}, _animationEvent); // TODO: add aria-valuenow, aria-valuemax, aria-valuemin
return (0,external_React_namespaceObject.createElement)("div", Object.assign({
role: "progressbar",
"aria-hidden": hide ? 'true' : 'false',
"aria-label": "notification timer",
className: classNames,
style: style
}, animationEvent));
}
ProgressBar.defaultProps = {
type: TYPE.DEFAULT,
hide: false
};
var _excluded$1 = ["theme", "type"];
var Svg = function Svg(_ref) {
var theme = _ref.theme,
type = _ref.type,
rest = react_toastify_esm_objectWithoutPropertiesLoose(_ref, _excluded$1);
return (0,external_React_namespaceObject.createElement)("svg", Object.assign({
viewBox: "0 0 24 24",
width: "100%",
height: "100%",
fill: theme === 'colored' ? 'currentColor' : "var(--toastify-icon-color-" + type + ")"
}, rest));
};
function Warning(props) {
return (0,external_React_namespaceObject.createElement)(Svg, Object.assign({}, props), (0,external_React_namespaceObject.createElement)("path", {
d: "M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"
}));
}
function Info(props) {
return (0,external_React_namespaceObject.createElement)(Svg, Object.assign({}, props), (0,external_React_namespaceObject.createElement)("path", {
d: "M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"
}));
}
function Success(props) {
return (0,external_React_namespaceObject.createElement)(Svg, Object.assign({}, props), (0,external_React_namespaceObject.createElement)("path", {
d: "M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"
}));
}
function react_toastify_esm_Error(props) {
return (0,external_React_namespaceObject.createElement)(Svg, Object.assign({}, props), (0,external_React_namespaceObject.createElement)("path", {
d: "M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"
}));
}
function Spinner() {
return (0,external_React_namespaceObject.createElement)("div", {
className: "Toastify"
/* CSS_NAMESPACE */
+ "__spinner"
});
}
var Icons = {
info: Info,
warning: Warning,
success: Success,
error: react_toastify_esm_Error,
spinner: Spinner
};
var Toast = function Toast(props) {
var _cx, _cx2;
var _useToast = useToast(props),
isRunning = _useToast.isRunning,
preventExitTransition = _useToast.preventExitTransition,
toastRef = _useToast.toastRef,
eventHandlers = _useToast.eventHandlers;
var closeButton = props.closeButton,
children = props.children,
autoClose = props.autoClose,
onClick = props.onClick,
type = props.type,
hideProgressBar = props.hideProgressBar,
closeToast = props.closeToast,
Transition = props.transition,
position = props.position,
className = props.className,
style = props.style,
bodyClassName = props.bodyClassName,
bodyStyle = props.bodyStyle,
progressClassName = props.progressClassName,
progressStyle = props.progressStyle,
updateId = props.updateId,
role = props.role,
progress = props.progress,
rtl = props.rtl,
toastId = props.toastId,
deleteToast = props.deleteToast,
isIn = props.isIn,
isLoading = props.isLoading,
icon = props.icon,
theme = props.theme;
var defaultClassName = clsx_m("Toastify"
/* CSS_NAMESPACE */
+ "__toast", "Toastify"
/* CSS_NAMESPACE */
+ "__toast-theme--" + theme, "Toastify"
/* CSS_NAMESPACE */
+ "__toast--" + type, (_cx = {}, _cx["Toastify"
/* CSS_NAMESPACE */
+ "__toast--rtl"] = rtl, _cx));
var cssClasses = isFn(className) ? className({
rtl: rtl,
position: position,
type: type,
defaultClassName: defaultClassName
}) : clsx_m(defaultClassName, className);
var isProgressControlled = !!progress;
var maybeIcon = Icons[type];
var iconProps = {
theme: theme,
type: type
};
var Icon = maybeIcon && maybeIcon(iconProps);
if (icon === false) {
Icon = void 0;
} else if (isFn(icon)) {
Icon = icon(iconProps);
} else if ((0,external_React_namespaceObject.isValidElement)(icon)) {
Icon = (0,external_React_namespaceObject.cloneElement)(icon, iconProps);
} else if (isStr(icon)) {
Icon = icon;
} else if (isLoading) {
Icon = Icons.spinner();
}
function renderCloseButton(closeButton) {
if (!closeButton) return;
var props = {
closeToast: closeToast,
type: type,
theme: theme
};
if (isFn(closeButton)) return closeButton(props);
if ((0,external_React_namespaceObject.isValidElement)(closeButton)) return (0,external_React_namespaceObject.cloneElement)(closeButton, props);
}
return (0,external_React_namespaceObject.createElement)(Transition, {
isIn: isIn,
done: deleteToast,
position: position,
preventExitTransition: preventExitTransition,
nodeRef: toastRef
}, (0,external_React_namespaceObject.createElement)("div", Object.assign({
id: toastId,
onClick: onClick,
className: cssClasses
}, eventHandlers, {
style: style,
ref: toastRef
}), (0,external_React_namespaceObject.createElement)("div", Object.assign({}, isIn && {
role: role
}, {
className: isFn(bodyClassName) ? bodyClassName({
type: type
}) : clsx_m("Toastify"
/* CSS_NAMESPACE */
+ "__toast-body", bodyClassName),
style: bodyStyle
}), Icon && (0,external_React_namespaceObject.createElement)("div", {
className: clsx_m("Toastify"
/* CSS_NAMESPACE */
+ "__toast-icon", (_cx2 = {}, _cx2["Toastify"
/* CSS_NAMESPACE */
+ "--animate-icon " + "Toastify"
/* CSS_NAMESPACE */
+ "__zoom-enter"] = !isLoading, _cx2))
}, Icon), (0,external_React_namespaceObject.createElement)("div", null, children)), renderCloseButton(closeButton), (autoClose || isProgressControlled) && (0,external_React_namespaceObject.createElement)(ProgressBar, Object.assign({}, updateId && !isProgressControlled ? {
key: "pb-" + updateId
} : {}, {
rtl: rtl,
theme: theme,
delay: autoClose,
isRunning: isRunning,
isIn: isIn,
closeToast: closeToast,
hide: hideProgressBar,
type: type,
style: progressStyle,
className: progressClassName,
controlledProgress: isProgressControlled,
progress: progress
}))));
};
var Bounce = /*#__PURE__*/cssTransition({
enter: "Toastify"
/* CSS_NAMESPACE */
+ "--animate " + "Toastify"
/* CSS_NAMESPACE */
+ "__bounce-enter",
exit: "Toastify"
/* CSS_NAMESPACE */
+ "--animate " + "Toastify"
/* CSS_NAMESPACE */
+ "__bounce-exit",
appendPosition: true
});
var Slide = /*#__PURE__*/cssTransition({
enter: "Toastify"
/* CSS_NAMESPACE */
+ "--animate " + "Toastify"
/* CSS_NAMESPACE */
+ "__slide-enter",
exit: "Toastify"
/* CSS_NAMESPACE */
+ "--animate " + "Toastify"
/* CSS_NAMESPACE */
+ "__slide-exit",
appendPosition: true
});
var Zoom = /*#__PURE__*/cssTransition({
enter: "Toastify"
/* CSS_NAMESPACE */
+ "--animate " + "Toastify"
/* CSS_NAMESPACE */
+ "__zoom-enter",
exit: "Toastify"
/* CSS_NAMESPACE */
+ "--animate " + "Toastify"
/* CSS_NAMESPACE */
+ "__zoom-exit"
});
var Flip = /*#__PURE__*/cssTransition({
enter: "Toastify"
/* CSS_NAMESPACE */
+ "--animate " + "Toastify"
/* CSS_NAMESPACE */
+ "__flip-enter",
exit: "Toastify"
/* CSS_NAMESPACE */
+ "--animate " + "Toastify"
/* CSS_NAMESPACE */
+ "__flip-exit"
});
var ToastContainer = function ToastContainer(props) {
var _useToastContainer = useToastContainer(props),
getToastToRender = _useToastContainer.getToastToRender,
containerRef = _useToastContainer.containerRef,
isToastActive = _useToastContainer.isToastActive;
var className = props.className,
style = props.style,
rtl = props.rtl,
containerId = props.containerId;
function getClassName(position) {
var _cx;
var defaultClassName = clsx_m("Toastify"
/* CSS_NAMESPACE */
+ "__toast-container", "Toastify"
/* CSS_NAMESPACE */
+ "__toast-container--" + position, (_cx = {}, _cx["Toastify"
/* CSS_NAMESPACE */
+ "__toast-container--rtl"] = rtl, _cx));
return isFn(className) ? className({
position: position,
rtl: rtl,
defaultClassName: defaultClassName
}) : clsx_m(defaultClassName, parseClassName(className));
}
return (0,external_React_namespaceObject.createElement)("div", {
ref: containerRef,
className: "Toastify"
/* CSS_NAMESPACE */
,
id: containerId
}, getToastToRender(function (position, toastList) {
var containerStyle = !toastList.length ? react_toastify_esm_extends({}, style, {
pointerEvents: 'none'
}) : react_toastify_esm_extends({}, style);
return (0,external_React_namespaceObject.createElement)("div", {
className: getClassName(position),
style: containerStyle,
key: "container-" + position
}, toastList.map(function (_ref) {
var content = _ref.content,
toastProps = _ref.props;
return (0,external_React_namespaceObject.createElement)(Toast, Object.assign({}, toastProps, {
isIn: isToastActive(toastProps.toastId),
key: "toast-" + toastProps.key,
closeButton: toastProps.closeButton === true ? CloseButton : toastProps.closeButton
}), content);
}));
}));
};
ToastContainer.defaultProps = {
position: POSITION.TOP_RIGHT,
transition: Bounce,
rtl: false,
autoClose: 5000,
hideProgressBar: false,
closeButton: CloseButton,
pauseOnHover: true,
pauseOnFocusLoss: true,
closeOnClick: true,
newestOnTop: false,
draggable: true,
draggablePercent: 80
/* DRAGGABLE_PERCENT */
,
draggableDirection: "x"
/* X */
,
role: 'alert',
theme: 'light'
};
var containers = /*#__PURE__*/new Map();
var latestInstance;
var containerDomNode;
var containerConfig;
var queue = [];
var lazy = false;
/**
* Get the toast by id, given it's in the DOM, otherwise returns null
*/
function getToast(toastId, _ref) {
var containerId = _ref.containerId;
var container = containers.get(containerId || latestInstance);
if (!container) return null;
return container.getToast(toastId);
}
/**
* Generate a random toastId
*/
function generateToastId() {
return Math.random().toString(36).substring(2, 9);
}
/**
* Generate a toastId or use the one provided
*/
function getToastId(options) {
if (options && (isStr(options.toastId) || isNum(options.toastId))) {
return options.toastId;
}
return generateToastId();
}
/**
* If the container is not mounted, the toast is enqueued and
* the container lazy mounted
*/
function dispatchToast(content, options) {
if (containers.size > 0) {
eventManager.emit(0
/* Show */
, content, options);
} else {
queue.push({
content: content,
options: options
});
if (lazy && canUseDom) {
lazy = false;
containerDomNode = document.createElement('div');
document.body.appendChild(containerDomNode);
(0,external_ReactDOM_namespaceObject.render)((0,external_React_namespaceObject.createElement)(ToastContainer, Object.assign({}, containerConfig)), containerDomNode);
}
}
return options.toastId;
}
/**
* Merge provided options with the defaults settings and generate the toastId
*/
function mergeOptions(type, options) {
return react_toastify_esm_extends({}, options, {
type: options && options.type || type,
toastId: getToastId(options)
});
}
function createToastByType(type) {
return function (content, options) {
return dispatchToast(content, mergeOptions(type, options));
};
}
function toast(content, options) {
return dispatchToast(content, mergeOptions(TYPE.DEFAULT, options));
}
toast.loading = function (content, options) {
return dispatchToast(content, mergeOptions(TYPE.DEFAULT, react_toastify_esm_extends({
isLoading: true,
autoClose: false,
closeOnClick: false,
closeButton: false,
draggable: false
}, options)));
};
function handlePromise(promise, _ref2, options) {
var pending = _ref2.pending,
error = _ref2.error,
success = _ref2.success;
var id;
if (pending) {
id = isStr(pending) ? toast.loading(pending, options) : toast.loading(pending.render, react_toastify_esm_extends({}, options, pending));
}
var resetParams = {
isLoading: null,
autoClose: null,
closeOnClick: null,
closeButton: null,
draggable: null
};
var resolver = function resolver(type, input, result) {
// Remove the toast if the input has not been provided. This prevents the toast from hanging
// in the pending state if a success/error toast has not been provided.
if (input == null) {
toast.dismiss(id);
return;
}
var baseParams = react_toastify_esm_extends({
type: type
}, resetParams, options, {
data: result
});
var params = isStr(input) ? {
render: input
} : input; // if the id is set we know that it's an update
if (id) {
toast.update(id, react_toastify_esm_extends({}, baseParams, params));
} else {
// using toast.promise without loading
toast(params.render, react_toastify_esm_extends({}, baseParams, params));
}
return result;
};
var p = isFn(promise) ? promise() : promise; //call the resolvers only when needed
p.then(function (result) {
return resolver('success', success, result);
})["catch"](function (err) {
return resolver('error', error, err);
});
return p;
}
toast.promise = handlePromise;
toast.success = /*#__PURE__*/createToastByType(TYPE.SUCCESS);
toast.info = /*#__PURE__*/createToastByType(TYPE.INFO);
toast.error = /*#__PURE__*/createToastByType(TYPE.ERROR);
toast.warning = /*#__PURE__*/createToastByType(TYPE.WARNING);
toast.warn = toast.warning;
toast.dark = function (content, options) {
return dispatchToast(content, mergeOptions(TYPE.DEFAULT, react_toastify_esm_extends({
theme: 'dark'
}, options)));
};
/**
* Remove toast programmaticaly
*/
toast.dismiss = function (id) {
return eventManager.emit(1
/* Clear */
, id);
};
/**
* Clear waiting queue when limit is used
*/
toast.clearWaitingQueue = function (params) {
if (params === void 0) {
params = {};
}
return eventManager.emit(5
/* ClearWaitingQueue */
, params);
};
/**
* return true if one container is displaying the toast
*/
toast.isActive = function (id) {
var isToastActive = false;
containers.forEach(function (container) {
if (container.isToastActive && container.isToastActive(id)) {
isToastActive = true;
}
});
return isToastActive;
};
toast.update = function (toastId, options) {
if (options === void 0) {
options = {};
}
// if you call toast and toast.update directly nothing will be displayed
// this is why I defered the update
setTimeout(function () {
var toast = getToast(toastId, options);
if (toast) {
var oldOptions = toast.props,
oldContent = toast.content;
var nextOptions = react_toastify_esm_extends({}, oldOptions, options, {
toastId: options.toastId || toastId,
updateId: generateToastId()
});
if (nextOptions.toastId !== toastId) nextOptions.staleId = toastId;
var content = nextOptions.render || oldContent;
delete nextOptions.render;
dispatchToast(content, nextOptions);
}
}, 0);
};
/**
* Used for controlled progress bar.
*/
toast.done = function (id) {
toast.update(id, {
progress: 1
});
};
/**
* @deprecated
* API will change in the next major release
*
* Track changes. The callback get the number of toast displayed
*/
toast.onChange = function (callback) {
if (isFn(callback)) {
eventManager.on(4
/* Change */
, callback);
}
return function () {
isFn(callback) && eventManager.off(4
/* Change */
, callback);
};
};
/**
* @deprecated
* will be removed in the next major release
*
* Configure the ToastContainer when lazy mounted
* Prefer ToastContainer over this one
*/
toast.configure = function (config) {
if (config === void 0) {
config = {};
}
lazy = true;
containerConfig = config;
};
toast.POSITION = POSITION;
toast.TYPE = TYPE;
/**
* Wait until the ToastContainer is mounted to dispatch the toast
* and attach isActive method
*/
eventManager.on(2
/* DidMount */
, function (containerInstance) {
latestInstance = containerInstance.containerId || containerInstance;
containers.set(latestInstance, containerInstance);
queue.forEach(function (item) {
eventManager.emit(0
/* Show */
, item.content, item.options);
});
queue = [];
}).on(3
/* WillUnmount */
, function (containerInstance) {
containers["delete"](containerInstance.containerId || containerInstance);
if (containers.size === 0) {
eventManager.off(0
/* Show */
).off(1
/* Clear */
).off(5
/* ClearWaitingQueue */
);
}
if (canUseDom && containerDomNode) {
document.body.removeChild(containerDomNode);
}
});
//# sourceMappingURL=react-toastify.esm.js.map
;// CONCATENATED MODULE: ./node_modules/react-toastify/dist/ReactToastify.css
// extracted by mini-css-extract-plugin
;// CONCATENATED MODULE: ./src/admin/components/settings/index.js
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
/* harmony default export */ const settings = (function () {
var _useState = (0,external_wp_element_namespaceObject.useState)({
isSaving: false,
dynamicCSSPrintMethod: _BLOCKART_ADMIN_.cssPrintMethod || 'inline'
}),
_useState2 = _slicedToArray(_useState, 2),
_useState2$ = _useState2[0],
isSaving = _useState2$.isSaving,
dynamicCSSPrintMethod = _useState2$.dynamicCSSPrintMethod,
setState = _useState2[1];
use_current_css_class('#toplevel_page_blockart a[href="admin.php?page=blockart#/settings"]');
var toastOptions = {
position: toast.POSITION.BOTTOM_CENTER,
pauseOnHover: false,
hideProgressBar: true,
autoClose: 3000,
transition: Slide
};
var updateSettings = function updateSettings() {
setState(function (prev) {
return _objectSpread(_objectSpread({}, prev), {}, {
isSaving: true
});
});
external_wp_apiFetch_default()({
path: 'wp/v2/settings',
method: 'PUT',
body: JSON.stringify({
_blockart_dynamic_css_print_method: dynamicCSSPrintMethod
})
}).then(function () {
toast.success((0,external_wp_i18n_namespaceObject.__)('Settings saved successfully!', 'blockart'), toastOptions);
})["catch"](function (e) {
toast.error("".concat(e.code, ": ").concat(e.message), toastOptions);
})["finally"](function () {
setState(function (prev) {
return _objectSpread(_objectSpread({}, prev), {}, {
isSaving: false
});
});
});
};
return /*#__PURE__*/React.createElement("div", {
className: "blockart-settings"
}, /*#__PURE__*/React.createElement("div", {
className: "blockart-settings-header"
}, /*#__PURE__*/React.createElement("div", {
className: "blockart-settings-container"
}, /*#__PURE__*/React.createElement("div", {
className: "blockart-settings-logo"
}, /*#__PURE__*/React.createElement(external_wp_components_namespaceObject.Icon, {
className: "blockart-settings-icon",
size: 50,
icon: /*#__PURE__*/React.createElement("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, /*#__PURE__*/React.createElement("path", {
d: "M22,22H2V2H22ZM3,21H21V3H3Z",
style: {
fill: '#0369fc'
}
}), /*#__PURE__*/React.createElement("path", {
d: "M13.46,10,12.07,5l-1.39,5Zm.92,3H9.77l-1,4.46V19h6.4V17.48Z",
style: {
fill: '#005cff',
fillRule: 'evenodd'
}
}))
})), /*#__PURE__*/React.createElement("div", {
className: "blockart-settings-nav"
}, /*#__PURE__*/React.createElement(NavLink, {
to: "/settings",
activeClassName: "is-active"
}, /*#__PURE__*/React.createElement(external_wp_components_namespaceObject.Icon, {
className: "blockart-settings-icon",
icon: /*#__PURE__*/React.createElement("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, /*#__PURE__*/React.createElement("path", {
d: "M12 16c2.2 0 4-1.8 4-4s-1.8-4-4-4-4 1.8-4 4 1.8 4 4 4zm0-6c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2z"
}), /*#__PURE__*/React.createElement("path", {
d: "M2.8 16.1l1 1.7c.5.9 1.8 1.3 2.7.7l.5-.3c.6.5 1.2.8 1.9 1.1v.7c0 1.1.9 2 2 2h2c1.1 0 2-.9 2-2v-.6c.7-.3 1.3-.7 1.9-1.1l.5.3c.9.5 2.2.2 2.7-.7l1-1.7c.6-1 .2-2.2-.7-2.7l-.5-.3c.1-.7.1-1.5 0-2.2l.5-.3c1-.6 1.3-1.8.7-2.7l-1-1.7c-.5-.9-1.8-1.3-2.7-.7l-.5.3c-.6-.5-1.2-.8-1.9-1.1V4c0-1.1-.9-2-2-2h-2C9.9 2 9 2.9 9 4v.6c-.7.3-1.3.7-1.9 1.1l-.5-.3c-.9-.5-2.2-.2-2.8.7l-1 1.7c-.6 1-.2 2.2.7 2.7l.5.3c-.1.7-.1 1.5 0 2.2l-.5.3c-.9.7-1.2 1.9-.7 2.8zm3.4-2.7c-.1-.5-.2-.9-.2-1.4 0-.5.1-.9.2-1.4.1-.4-.1-.9-.5-1.1l-1.1-.6 1-1.7 1.1.7c.4.1.9.1 1.2-.2.7-.7 1.5-1.2 2.4-1.4.4-.1.7-.5.7-1V4h2v1.3c0 .4.3.8.7 1 .9.3 1.7.8 2.4 1.4.3.3.8.3 1.2.1l1.1-.7 1 1.7-1.1.6c-.4.2-.6.7-.5 1.1.1.5.2.9.2 1.4 0 .5-.1.9-.2 1.4-.1.4.1.9.5 1.1l1.1.6-1 1.7-1.1-.7c-.4-.2-.9-.2-1.2.1-.7.6-1.5 1.1-2.4 1.4-.4.1-.7.5-.7 1v1.3h-2v-1.3c0-.4-.3-.8-.7-1-.9-.3-1.7-.8-2.4-1.4-.3-.1-.8-.1-1.2.1l-1.1.7-1-1.7 1.1-.7c.4-.2.6-.7.5-1.1z"
}))
}), /*#__PURE__*/React.createElement(external_wp_components_namespaceObject.Icon, {
type: "controlIcon",
name: "cog"
}), (0,external_wp_i18n_namespaceObject.__)('Settings', 'blockart'))))), /*#__PURE__*/React.createElement("div", {
className: "blockart-settings-content"
}, /*#__PURE__*/React.createElement("div", {
className: "blockart-settings-container"
}, /*#__PURE__*/React.createElement("label", {
htmlFor: "blockart-dynamic-css-print-method"
}, (0,external_wp_i18n_namespaceObject.__)('Dynamic CSS print method', 'blockart')), /*#__PURE__*/React.createElement("select", {
name: "blockart-dynamic-css-print-method",
id: "blockart-dynamic-css-print-method",
defaultValue: dynamicCSSPrintMethod,
onChange: function onChange(e) {
return setState(function (prev) {
return _objectSpread(_objectSpread({}, prev), {}, {
dynamicCSSPrintMethod: e.target.value
});
});
}
}, /*#__PURE__*/React.createElement("option", {
value: "internal-css"
}, (0,external_wp_i18n_namespaceObject.__)('Internal CSS', 'blockart')), /*#__PURE__*/React.createElement("option", {
value: "external-css-file"
}, (0,external_wp_i18n_namespaceObject.__)('External CSS File', 'blockart'))), /*#__PURE__*/React.createElement("button", {
className: "blockart-settings-save",
disabled: isSaving,
onClick: updateSettings
}, isSaving && /*#__PURE__*/React.createElement(external_wp_components_namespaceObject.Spinner, null), /*#__PURE__*/React.createElement("span", {
className: "blockart-settings-save-text"
}, (0,external_wp_i18n_namespaceObject.__)('Save Settings', 'blockart'))), /*#__PURE__*/React.createElement(ToastContainer, null))));
});
;// CONCATENATED MODULE: ./src/admin/components/index.js
;// CONCATENATED MODULE: ./src/admin/app.js
/* harmony default export */ const app = (function () {
(0,external_wp_element_namespaceObject.useEffect)(function () {
var _menu$classList, _menu$parentElement, _menu$parentElement$c;
var menu = document.querySelector('#toplevel_page_blockart a[href="admin.php?page=blockart#/settings"].menu-top');
if (!menu) {
return;
}
if (menu !== null && menu !== void 0 && (_menu$classList = menu.classList) !== null && _menu$classList !== void 0 && _menu$classList.contains('wp-not-current-submenu')) {
menu.classList.remove('wp-not-current-submenu');
menu.classList.add('wp-has-current-submenu');
menu.classList.add('wp-menu-open');
menu.setAttribute('aria-haspop', 'false');
}
if (menu !== null && menu !== void 0 && (_menu$parentElement = menu.parentElement) !== null && _menu$parentElement !== void 0 && (_menu$parentElement$c = _menu$parentElement.classList) !== null && _menu$parentElement$c !== void 0 && _menu$parentElement$c.contains('wp-not-current-submenu')) {
menu.parentElement.classList.remove('wp-not-current-submenu');
menu.parentElement.classList.add('wp-has-current-submenu');
menu.parentElement.classList.add('wp-menu-open');
}
}, []);
(0,external_wp_element_namespaceObject.useEffect)(function () {
var el = document.querySelector('a.blockart-rating-link');
if (null === el || _BLOCKART_ADMIN_.isRated) {
return;
}
el.addEventListener('click', set_rating);
return function () {
el.removeEventListener('click', set_rating);
};
}, []);
return /*#__PURE__*/React.createElement(HashRouter, null, /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(Route, {
path: "/getting-started",
component: getting_started,
exact: true
}), /*#__PURE__*/React.createElement(Route, {
path: "/settings",
component: settings,
exact: true
})));
});
;// CONCATENATED MODULE: ./src/admin/index.js
var root = document.getElementById('blockart');
if (root) {
(0,external_wp_element_namespaceObject.render)( /*#__PURE__*/React.createElement(app, null), root);
}
})();
/******/ })()
;