andoncloud-widget-preview 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -680
- package/dist/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
var React = require('react');
|
|
2
2
|
var andoncloudSdk = require('andoncloud-sdk');
|
|
3
|
+
var reactRouterDom = require('react-router-dom');
|
|
3
4
|
require('react-grid-layout/css/styles.css');
|
|
4
5
|
var RGL = require('react-grid-layout');
|
|
5
6
|
var material = require('@mui/material');
|
|
@@ -2995,684 +2996,6 @@ void instance.use(initReactI18next).init({
|
|
|
2995
2996
|
}
|
|
2996
2997
|
});
|
|
2997
2998
|
|
|
2998
|
-
/**
|
|
2999
|
-
* Actions represent the type of change to a location value.
|
|
3000
|
-
*
|
|
3001
|
-
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action
|
|
3002
|
-
*/
|
|
3003
|
-
var Action;
|
|
3004
|
-
|
|
3005
|
-
(function (Action) {
|
|
3006
|
-
/**
|
|
3007
|
-
* A POP indicates a change to an arbitrary index in the history stack, such
|
|
3008
|
-
* as a back or forward navigation. It does not describe the direction of the
|
|
3009
|
-
* navigation, only that the current index changed.
|
|
3010
|
-
*
|
|
3011
|
-
* Note: This is the default action for newly created history objects.
|
|
3012
|
-
*/
|
|
3013
|
-
Action["Pop"] = "POP";
|
|
3014
|
-
/**
|
|
3015
|
-
* A PUSH indicates a new entry being added to the history stack, such as when
|
|
3016
|
-
* a link is clicked and a new page loads. When this happens, all subsequent
|
|
3017
|
-
* entries in the stack are lost.
|
|
3018
|
-
*/
|
|
3019
|
-
|
|
3020
|
-
Action["Push"] = "PUSH";
|
|
3021
|
-
/**
|
|
3022
|
-
* A REPLACE indicates the entry at the current index in the history stack
|
|
3023
|
-
* being replaced by a new one.
|
|
3024
|
-
*/
|
|
3025
|
-
|
|
3026
|
-
Action["Replace"] = "REPLACE";
|
|
3027
|
-
})(Action || (Action = {}));
|
|
3028
|
-
|
|
3029
|
-
process.env.NODE_ENV !== "production" ? function (obj) {
|
|
3030
|
-
return Object.freeze(obj);
|
|
3031
|
-
} : function (obj) {
|
|
3032
|
-
return obj;
|
|
3033
|
-
};
|
|
3034
|
-
/**
|
|
3035
|
-
* Parses a string URL path into its separate pathname, search, and hash components.
|
|
3036
|
-
*
|
|
3037
|
-
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath
|
|
3038
|
-
*/
|
|
3039
|
-
|
|
3040
|
-
function parsePath(path) {
|
|
3041
|
-
var parsedPath = {};
|
|
3042
|
-
|
|
3043
|
-
if (path) {
|
|
3044
|
-
var hashIndex = path.indexOf('#');
|
|
3045
|
-
|
|
3046
|
-
if (hashIndex >= 0) {
|
|
3047
|
-
parsedPath.hash = path.substr(hashIndex);
|
|
3048
|
-
path = path.substr(0, hashIndex);
|
|
3049
|
-
}
|
|
3050
|
-
|
|
3051
|
-
var searchIndex = path.indexOf('?');
|
|
3052
|
-
|
|
3053
|
-
if (searchIndex >= 0) {
|
|
3054
|
-
parsedPath.search = path.substr(searchIndex);
|
|
3055
|
-
path = path.substr(0, searchIndex);
|
|
3056
|
-
}
|
|
3057
|
-
|
|
3058
|
-
if (path) {
|
|
3059
|
-
parsedPath.pathname = path;
|
|
3060
|
-
}
|
|
3061
|
-
}
|
|
3062
|
-
|
|
3063
|
-
return parsedPath;
|
|
3064
|
-
}
|
|
3065
|
-
|
|
3066
|
-
/**
|
|
3067
|
-
* React Router v6.3.0
|
|
3068
|
-
*
|
|
3069
|
-
* Copyright (c) Remix Software Inc.
|
|
3070
|
-
*
|
|
3071
|
-
* This source code is licensed under the MIT license found in the
|
|
3072
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
3073
|
-
*
|
|
3074
|
-
* @license MIT
|
|
3075
|
-
*/
|
|
3076
|
-
|
|
3077
|
-
const NavigationContext = /*#__PURE__*/React.createContext(null);
|
|
3078
|
-
|
|
3079
|
-
if (process.env.NODE_ENV !== "production") {
|
|
3080
|
-
NavigationContext.displayName = "Navigation";
|
|
3081
|
-
}
|
|
3082
|
-
|
|
3083
|
-
const LocationContext = /*#__PURE__*/React.createContext(null);
|
|
3084
|
-
|
|
3085
|
-
if (process.env.NODE_ENV !== "production") {
|
|
3086
|
-
LocationContext.displayName = "Location";
|
|
3087
|
-
}
|
|
3088
|
-
|
|
3089
|
-
const RouteContext = /*#__PURE__*/React.createContext({
|
|
3090
|
-
outlet: null,
|
|
3091
|
-
matches: []
|
|
3092
|
-
});
|
|
3093
|
-
|
|
3094
|
-
if (process.env.NODE_ENV !== "production") {
|
|
3095
|
-
RouteContext.displayName = "Route";
|
|
3096
|
-
}
|
|
3097
|
-
|
|
3098
|
-
function invariant(cond, message) {
|
|
3099
|
-
if (!cond) throw new Error(message);
|
|
3100
|
-
}
|
|
3101
|
-
function warning(cond, message) {
|
|
3102
|
-
if (!cond) {
|
|
3103
|
-
// eslint-disable-next-line no-console
|
|
3104
|
-
if (typeof console !== "undefined") console.warn(message);
|
|
3105
|
-
|
|
3106
|
-
try {
|
|
3107
|
-
// Welcome to debugging React Router!
|
|
3108
|
-
//
|
|
3109
|
-
// This error is thrown as a convenience so you can more easily
|
|
3110
|
-
// find the source for a warning that appears in the console by
|
|
3111
|
-
// enabling "pause on exceptions" in your JavaScript debugger.
|
|
3112
|
-
throw new Error(message); // eslint-disable-next-line no-empty
|
|
3113
|
-
} catch (e) {}
|
|
3114
|
-
}
|
|
3115
|
-
}
|
|
3116
|
-
const alreadyWarned = {};
|
|
3117
|
-
function warningOnce(key, cond, message) {
|
|
3118
|
-
if (!cond && !alreadyWarned[key]) {
|
|
3119
|
-
alreadyWarned[key] = true;
|
|
3120
|
-
process.env.NODE_ENV !== "production" ? warning(false, message) : void 0;
|
|
3121
|
-
}
|
|
3122
|
-
}
|
|
3123
|
-
/**
|
|
3124
|
-
* A RouteMatch contains info about how a route matched a URL.
|
|
3125
|
-
*/
|
|
3126
|
-
|
|
3127
|
-
/**
|
|
3128
|
-
* Matches the given routes to a location and returns the match data.
|
|
3129
|
-
*
|
|
3130
|
-
* @see https://reactrouter.com/docs/en/v6/api#matchroutes
|
|
3131
|
-
*/
|
|
3132
|
-
function matchRoutes(routes, locationArg, basename) {
|
|
3133
|
-
if (basename === void 0) {
|
|
3134
|
-
basename = "/";
|
|
3135
|
-
}
|
|
3136
|
-
|
|
3137
|
-
let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
|
3138
|
-
let pathname = stripBasename(location.pathname || "/", basename);
|
|
3139
|
-
|
|
3140
|
-
if (pathname == null) {
|
|
3141
|
-
return null;
|
|
3142
|
-
}
|
|
3143
|
-
|
|
3144
|
-
let branches = flattenRoutes(routes);
|
|
3145
|
-
rankRouteBranches(branches);
|
|
3146
|
-
let matches = null;
|
|
3147
|
-
|
|
3148
|
-
for (let i = 0; matches == null && i < branches.length; ++i) {
|
|
3149
|
-
matches = matchRouteBranch(branches[i], pathname);
|
|
3150
|
-
}
|
|
3151
|
-
|
|
3152
|
-
return matches;
|
|
3153
|
-
}
|
|
3154
|
-
|
|
3155
|
-
function flattenRoutes(routes, branches, parentsMeta, parentPath) {
|
|
3156
|
-
if (branches === void 0) {
|
|
3157
|
-
branches = [];
|
|
3158
|
-
}
|
|
3159
|
-
|
|
3160
|
-
if (parentsMeta === void 0) {
|
|
3161
|
-
parentsMeta = [];
|
|
3162
|
-
}
|
|
3163
|
-
|
|
3164
|
-
if (parentPath === void 0) {
|
|
3165
|
-
parentPath = "";
|
|
3166
|
-
}
|
|
3167
|
-
|
|
3168
|
-
routes.forEach((route, index) => {
|
|
3169
|
-
let meta = {
|
|
3170
|
-
relativePath: route.path || "",
|
|
3171
|
-
caseSensitive: route.caseSensitive === true,
|
|
3172
|
-
childrenIndex: index,
|
|
3173
|
-
route
|
|
3174
|
-
};
|
|
3175
|
-
|
|
3176
|
-
if (meta.relativePath.startsWith("/")) {
|
|
3177
|
-
!meta.relativePath.startsWith(parentPath) ? process.env.NODE_ENV !== "production" ? invariant(false, "Absolute route path \"" + meta.relativePath + "\" nested under path " + ("\"" + parentPath + "\" is not valid. An absolute child route path ") + "must start with the combined path of all its parent routes.") : invariant(false) : void 0;
|
|
3178
|
-
meta.relativePath = meta.relativePath.slice(parentPath.length);
|
|
3179
|
-
}
|
|
3180
|
-
|
|
3181
|
-
let path = joinPaths([parentPath, meta.relativePath]);
|
|
3182
|
-
let routesMeta = parentsMeta.concat(meta); // Add the children before adding this route to the array so we traverse the
|
|
3183
|
-
// route tree depth-first and child routes appear before their parents in
|
|
3184
|
-
// the "flattened" version.
|
|
3185
|
-
|
|
3186
|
-
if (route.children && route.children.length > 0) {
|
|
3187
|
-
!(route.index !== true) ? process.env.NODE_ENV !== "production" ? invariant(false, "Index routes must not have child routes. Please remove " + ("all child routes from route path \"" + path + "\".")) : invariant(false) : void 0;
|
|
3188
|
-
flattenRoutes(route.children, branches, routesMeta, path);
|
|
3189
|
-
} // Routes without a path shouldn't ever match by themselves unless they are
|
|
3190
|
-
// index routes, so don't add them to the list of possible branches.
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
if (route.path == null && !route.index) {
|
|
3194
|
-
return;
|
|
3195
|
-
}
|
|
3196
|
-
|
|
3197
|
-
branches.push({
|
|
3198
|
-
path,
|
|
3199
|
-
score: computeScore(path, route.index),
|
|
3200
|
-
routesMeta
|
|
3201
|
-
});
|
|
3202
|
-
});
|
|
3203
|
-
return branches;
|
|
3204
|
-
}
|
|
3205
|
-
|
|
3206
|
-
function rankRouteBranches(branches) {
|
|
3207
|
-
branches.sort((a, b) => a.score !== b.score ? b.score - a.score // Higher score first
|
|
3208
|
-
: compareIndexes(a.routesMeta.map(meta => meta.childrenIndex), b.routesMeta.map(meta => meta.childrenIndex)));
|
|
3209
|
-
}
|
|
3210
|
-
|
|
3211
|
-
const paramRe = /^:\w+$/;
|
|
3212
|
-
const dynamicSegmentValue = 3;
|
|
3213
|
-
const indexRouteValue = 2;
|
|
3214
|
-
const emptySegmentValue = 1;
|
|
3215
|
-
const staticSegmentValue = 10;
|
|
3216
|
-
const splatPenalty = -2;
|
|
3217
|
-
|
|
3218
|
-
const isSplat = s => s === "*";
|
|
3219
|
-
|
|
3220
|
-
function computeScore(path, index) {
|
|
3221
|
-
let segments = path.split("/");
|
|
3222
|
-
let initialScore = segments.length;
|
|
3223
|
-
|
|
3224
|
-
if (segments.some(isSplat)) {
|
|
3225
|
-
initialScore += splatPenalty;
|
|
3226
|
-
}
|
|
3227
|
-
|
|
3228
|
-
if (index) {
|
|
3229
|
-
initialScore += indexRouteValue;
|
|
3230
|
-
}
|
|
3231
|
-
|
|
3232
|
-
return segments.filter(s => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue), initialScore);
|
|
3233
|
-
}
|
|
3234
|
-
|
|
3235
|
-
function compareIndexes(a, b) {
|
|
3236
|
-
let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);
|
|
3237
|
-
return siblings ? // If two routes are siblings, we should try to match the earlier sibling
|
|
3238
|
-
// first. This allows people to have fine-grained control over the matching
|
|
3239
|
-
// behavior by simply putting routes with identical paths in the order they
|
|
3240
|
-
// want them tried.
|
|
3241
|
-
a[a.length - 1] - b[b.length - 1] : // Otherwise, it doesn't really make sense to rank non-siblings by index,
|
|
3242
|
-
// so they sort equally.
|
|
3243
|
-
0;
|
|
3244
|
-
}
|
|
3245
|
-
|
|
3246
|
-
function matchRouteBranch(branch, pathname) {
|
|
3247
|
-
let {
|
|
3248
|
-
routesMeta
|
|
3249
|
-
} = branch;
|
|
3250
|
-
let matchedParams = {};
|
|
3251
|
-
let matchedPathname = "/";
|
|
3252
|
-
let matches = [];
|
|
3253
|
-
|
|
3254
|
-
for (let i = 0; i < routesMeta.length; ++i) {
|
|
3255
|
-
let meta = routesMeta[i];
|
|
3256
|
-
let end = i === routesMeta.length - 1;
|
|
3257
|
-
let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
|
|
3258
|
-
let match = matchPath({
|
|
3259
|
-
path: meta.relativePath,
|
|
3260
|
-
caseSensitive: meta.caseSensitive,
|
|
3261
|
-
end
|
|
3262
|
-
}, remainingPathname);
|
|
3263
|
-
if (!match) return null;
|
|
3264
|
-
Object.assign(matchedParams, match.params);
|
|
3265
|
-
let route = meta.route;
|
|
3266
|
-
matches.push({
|
|
3267
|
-
params: matchedParams,
|
|
3268
|
-
pathname: joinPaths([matchedPathname, match.pathname]),
|
|
3269
|
-
pathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])),
|
|
3270
|
-
route
|
|
3271
|
-
});
|
|
3272
|
-
|
|
3273
|
-
if (match.pathnameBase !== "/") {
|
|
3274
|
-
matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);
|
|
3275
|
-
}
|
|
3276
|
-
}
|
|
3277
|
-
|
|
3278
|
-
return matches;
|
|
3279
|
-
}
|
|
3280
|
-
/**
|
|
3281
|
-
* A PathPattern is used to match on some portion of a URL pathname.
|
|
3282
|
-
*/
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
/**
|
|
3286
|
-
* Performs pattern matching on a URL pathname and returns information about
|
|
3287
|
-
* the match.
|
|
3288
|
-
*
|
|
3289
|
-
* @see https://reactrouter.com/docs/en/v6/api#matchpath
|
|
3290
|
-
*/
|
|
3291
|
-
function matchPath(pattern, pathname) {
|
|
3292
|
-
if (typeof pattern === "string") {
|
|
3293
|
-
pattern = {
|
|
3294
|
-
path: pattern,
|
|
3295
|
-
caseSensitive: false,
|
|
3296
|
-
end: true
|
|
3297
|
-
};
|
|
3298
|
-
}
|
|
3299
|
-
|
|
3300
|
-
let [matcher, paramNames] = compilePath(pattern.path, pattern.caseSensitive, pattern.end);
|
|
3301
|
-
let match = pathname.match(matcher);
|
|
3302
|
-
if (!match) return null;
|
|
3303
|
-
let matchedPathname = match[0];
|
|
3304
|
-
let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
|
|
3305
|
-
let captureGroups = match.slice(1);
|
|
3306
|
-
let params = paramNames.reduce((memo, paramName, index) => {
|
|
3307
|
-
// We need to compute the pathnameBase here using the raw splat value
|
|
3308
|
-
// instead of using params["*"] later because it will be decoded then
|
|
3309
|
-
if (paramName === "*") {
|
|
3310
|
-
let splatValue = captureGroups[index] || "";
|
|
3311
|
-
pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
|
|
3312
|
-
}
|
|
3313
|
-
|
|
3314
|
-
memo[paramName] = safelyDecodeURIComponent(captureGroups[index] || "", paramName);
|
|
3315
|
-
return memo;
|
|
3316
|
-
}, {});
|
|
3317
|
-
return {
|
|
3318
|
-
params,
|
|
3319
|
-
pathname: matchedPathname,
|
|
3320
|
-
pathnameBase,
|
|
3321
|
-
pattern
|
|
3322
|
-
};
|
|
3323
|
-
}
|
|
3324
|
-
|
|
3325
|
-
function compilePath(path, caseSensitive, end) {
|
|
3326
|
-
if (caseSensitive === void 0) {
|
|
3327
|
-
caseSensitive = false;
|
|
3328
|
-
}
|
|
3329
|
-
|
|
3330
|
-
if (end === void 0) {
|
|
3331
|
-
end = true;
|
|
3332
|
-
}
|
|
3333
|
-
|
|
3334
|
-
process.env.NODE_ENV !== "production" ? warning(path === "*" || !path.endsWith("*") || path.endsWith("/*"), "Route path \"" + path + "\" will be treated as if it were " + ("\"" + path.replace(/\*$/, "/*") + "\" because the `*` character must ") + "always follow a `/` in the pattern. To get rid of this warning, " + ("please change the route path to \"" + path.replace(/\*$/, "/*") + "\".")) : void 0;
|
|
3335
|
-
let paramNames = [];
|
|
3336
|
-
let regexpSource = "^" + path.replace(/\/*\*?$/, "") // Ignore trailing / and /*, we'll handle it below
|
|
3337
|
-
.replace(/^\/*/, "/") // Make sure it has a leading /
|
|
3338
|
-
.replace(/[\\.*+^$?{}|()[\]]/g, "\\$&") // Escape special regex chars
|
|
3339
|
-
.replace(/:(\w+)/g, (_, paramName) => {
|
|
3340
|
-
paramNames.push(paramName);
|
|
3341
|
-
return "([^\\/]+)";
|
|
3342
|
-
});
|
|
3343
|
-
|
|
3344
|
-
if (path.endsWith("*")) {
|
|
3345
|
-
paramNames.push("*");
|
|
3346
|
-
regexpSource += path === "*" || path === "/*" ? "(.*)$" // Already matched the initial /, just match the rest
|
|
3347
|
-
: "(?:\\/(.+)|\\/*)$"; // Don't include the / in params["*"]
|
|
3348
|
-
} else {
|
|
3349
|
-
regexpSource += end ? "\\/*$" // When matching to the end, ignore trailing slashes
|
|
3350
|
-
: // Otherwise, match a word boundary or a proceeding /. The word boundary restricts
|
|
3351
|
-
// parent routes to matching only their own words and nothing more, e.g. parent
|
|
3352
|
-
// route "/home" should not match "/home2".
|
|
3353
|
-
// Additionally, allow paths starting with `.`, `-`, `~`, and url-encoded entities,
|
|
3354
|
-
// but do not consume the character in the matched path so they can match against
|
|
3355
|
-
// nested paths.
|
|
3356
|
-
"(?:(?=[.~-]|%[0-9A-F]{2})|\\b|\\/|$)";
|
|
3357
|
-
}
|
|
3358
|
-
|
|
3359
|
-
let matcher = new RegExp(regexpSource, caseSensitive ? undefined : "i");
|
|
3360
|
-
return [matcher, paramNames];
|
|
3361
|
-
}
|
|
3362
|
-
|
|
3363
|
-
function safelyDecodeURIComponent(value, paramName) {
|
|
3364
|
-
try {
|
|
3365
|
-
return decodeURIComponent(value);
|
|
3366
|
-
} catch (error) {
|
|
3367
|
-
process.env.NODE_ENV !== "production" ? warning(false, "The value for the URL param \"" + paramName + "\" will not be decoded because" + (" the string \"" + value + "\" is a malformed URL segment. This is probably") + (" due to a bad percent encoding (" + error + ").")) : void 0;
|
|
3368
|
-
return value;
|
|
3369
|
-
}
|
|
3370
|
-
}
|
|
3371
|
-
/**
|
|
3372
|
-
* Returns a resolved path object relative to the given pathname.
|
|
3373
|
-
*
|
|
3374
|
-
* @see https://reactrouter.com/docs/en/v6/api#resolvepath
|
|
3375
|
-
*/
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
function resolvePath(to, fromPathname) {
|
|
3379
|
-
if (fromPathname === void 0) {
|
|
3380
|
-
fromPathname = "/";
|
|
3381
|
-
}
|
|
3382
|
-
|
|
3383
|
-
let {
|
|
3384
|
-
pathname: toPathname,
|
|
3385
|
-
search = "",
|
|
3386
|
-
hash = ""
|
|
3387
|
-
} = typeof to === "string" ? parsePath(to) : to;
|
|
3388
|
-
let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;
|
|
3389
|
-
return {
|
|
3390
|
-
pathname,
|
|
3391
|
-
search: normalizeSearch(search),
|
|
3392
|
-
hash: normalizeHash(hash)
|
|
3393
|
-
};
|
|
3394
|
-
}
|
|
3395
|
-
|
|
3396
|
-
function resolvePathname(relativePath, fromPathname) {
|
|
3397
|
-
let segments = fromPathname.replace(/\/+$/, "").split("/");
|
|
3398
|
-
let relativeSegments = relativePath.split("/");
|
|
3399
|
-
relativeSegments.forEach(segment => {
|
|
3400
|
-
if (segment === "..") {
|
|
3401
|
-
// Keep the root "" segment so the pathname starts at /
|
|
3402
|
-
if (segments.length > 1) segments.pop();
|
|
3403
|
-
} else if (segment !== ".") {
|
|
3404
|
-
segments.push(segment);
|
|
3405
|
-
}
|
|
3406
|
-
});
|
|
3407
|
-
return segments.length > 1 ? segments.join("/") : "/";
|
|
3408
|
-
}
|
|
3409
|
-
|
|
3410
|
-
function resolveTo(toArg, routePathnames, locationPathname) {
|
|
3411
|
-
let to = typeof toArg === "string" ? parsePath(toArg) : toArg;
|
|
3412
|
-
let toPathname = toArg === "" || to.pathname === "" ? "/" : to.pathname; // If a pathname is explicitly provided in `to`, it should be relative to the
|
|
3413
|
-
// route context. This is explained in `Note on `<Link to>` values` in our
|
|
3414
|
-
// migration guide from v5 as a means of disambiguation between `to` values
|
|
3415
|
-
// that begin with `/` and those that do not. However, this is problematic for
|
|
3416
|
-
// `to` values that do not provide a pathname. `to` can simply be a search or
|
|
3417
|
-
// hash string, in which case we should assume that the navigation is relative
|
|
3418
|
-
// to the current location's pathname and *not* the route pathname.
|
|
3419
|
-
|
|
3420
|
-
let from;
|
|
3421
|
-
|
|
3422
|
-
if (toPathname == null) {
|
|
3423
|
-
from = locationPathname;
|
|
3424
|
-
} else {
|
|
3425
|
-
let routePathnameIndex = routePathnames.length - 1;
|
|
3426
|
-
|
|
3427
|
-
if (toPathname.startsWith("..")) {
|
|
3428
|
-
let toSegments = toPathname.split("/"); // Each leading .. segment means "go up one route" instead of "go up one
|
|
3429
|
-
// URL segment". This is a key difference from how <a href> works and a
|
|
3430
|
-
// major reason we call this a "to" value instead of a "href".
|
|
3431
|
-
|
|
3432
|
-
while (toSegments[0] === "..") {
|
|
3433
|
-
toSegments.shift();
|
|
3434
|
-
routePathnameIndex -= 1;
|
|
3435
|
-
}
|
|
3436
|
-
|
|
3437
|
-
to.pathname = toSegments.join("/");
|
|
3438
|
-
} // If there are more ".." segments than parent routes, resolve relative to
|
|
3439
|
-
// the root / URL.
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
|
|
3443
|
-
}
|
|
3444
|
-
|
|
3445
|
-
let path = resolvePath(to, from); // Ensure the pathname has a trailing slash if the original to value had one.
|
|
3446
|
-
|
|
3447
|
-
if (toPathname && toPathname !== "/" && toPathname.endsWith("/") && !path.pathname.endsWith("/")) {
|
|
3448
|
-
path.pathname += "/";
|
|
3449
|
-
}
|
|
3450
|
-
|
|
3451
|
-
return path;
|
|
3452
|
-
}
|
|
3453
|
-
function stripBasename(pathname, basename) {
|
|
3454
|
-
if (basename === "/") return pathname;
|
|
3455
|
-
|
|
3456
|
-
if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
|
|
3457
|
-
return null;
|
|
3458
|
-
}
|
|
3459
|
-
|
|
3460
|
-
let nextChar = pathname.charAt(basename.length);
|
|
3461
|
-
|
|
3462
|
-
if (nextChar && nextChar !== "/") {
|
|
3463
|
-
// pathname does not start with basename/
|
|
3464
|
-
return null;
|
|
3465
|
-
}
|
|
3466
|
-
|
|
3467
|
-
return pathname.slice(basename.length) || "/";
|
|
3468
|
-
}
|
|
3469
|
-
const joinPaths = paths => paths.join("/").replace(/\/\/+/g, "/");
|
|
3470
|
-
const normalizePathname = pathname => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
|
|
3471
|
-
|
|
3472
|
-
const normalizeSearch = search => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
|
|
3473
|
-
|
|
3474
|
-
const normalizeHash = hash => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
|
|
3475
|
-
/**
|
|
3476
|
-
* Returns true if this component is a descendant of a <Router>.
|
|
3477
|
-
*
|
|
3478
|
-
* @see https://reactrouter.com/docs/en/v6/api#useinroutercontext
|
|
3479
|
-
*/
|
|
3480
|
-
|
|
3481
|
-
function useInRouterContext() {
|
|
3482
|
-
return React.useContext(LocationContext) != null;
|
|
3483
|
-
}
|
|
3484
|
-
/**
|
|
3485
|
-
* Returns the current location object, which represents the current URL in web
|
|
3486
|
-
* browsers.
|
|
3487
|
-
*
|
|
3488
|
-
* Note: If you're using this it may mean you're doing some of your own
|
|
3489
|
-
* "routing" in your app, and we'd like to know what your use case is. We may
|
|
3490
|
-
* be able to provide something higher-level to better suit your needs.
|
|
3491
|
-
*
|
|
3492
|
-
* @see https://reactrouter.com/docs/en/v6/api#uselocation
|
|
3493
|
-
*/
|
|
3494
|
-
|
|
3495
|
-
function useLocation() {
|
|
3496
|
-
!useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
|
|
3497
|
-
// router loaded. We can help them understand how to avoid that.
|
|
3498
|
-
"useLocation() may be used only in the context of a <Router> component.") : invariant(false) : void 0;
|
|
3499
|
-
return React.useContext(LocationContext).location;
|
|
3500
|
-
}
|
|
3501
|
-
/**
|
|
3502
|
-
* The interface for the navigate() function returned from useNavigate().
|
|
3503
|
-
*/
|
|
3504
|
-
|
|
3505
|
-
/**
|
|
3506
|
-
* Returns an imperative method for changing the location. Used by <Link>s, but
|
|
3507
|
-
* may also be used by other elements to change the location.
|
|
3508
|
-
*
|
|
3509
|
-
* @see https://reactrouter.com/docs/en/v6/api#usenavigate
|
|
3510
|
-
*/
|
|
3511
|
-
function useNavigate() {
|
|
3512
|
-
!useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
|
|
3513
|
-
// router loaded. We can help them understand how to avoid that.
|
|
3514
|
-
"useNavigate() may be used only in the context of a <Router> component.") : invariant(false) : void 0;
|
|
3515
|
-
let {
|
|
3516
|
-
basename,
|
|
3517
|
-
navigator
|
|
3518
|
-
} = React.useContext(NavigationContext);
|
|
3519
|
-
let {
|
|
3520
|
-
matches
|
|
3521
|
-
} = React.useContext(RouteContext);
|
|
3522
|
-
let {
|
|
3523
|
-
pathname: locationPathname
|
|
3524
|
-
} = useLocation();
|
|
3525
|
-
let routePathnamesJson = JSON.stringify(matches.map(match => match.pathnameBase));
|
|
3526
|
-
let activeRef = React.useRef(false);
|
|
3527
|
-
React.useEffect(() => {
|
|
3528
|
-
activeRef.current = true;
|
|
3529
|
-
});
|
|
3530
|
-
let navigate = React.useCallback(function (to, options) {
|
|
3531
|
-
if (options === void 0) {
|
|
3532
|
-
options = {};
|
|
3533
|
-
}
|
|
3534
|
-
|
|
3535
|
-
process.env.NODE_ENV !== "production" ? warning(activeRef.current, "You should call navigate() in a React.useEffect(), not when " + "your component is first rendered.") : void 0;
|
|
3536
|
-
if (!activeRef.current) return;
|
|
3537
|
-
|
|
3538
|
-
if (typeof to === "number") {
|
|
3539
|
-
navigator.go(to);
|
|
3540
|
-
return;
|
|
3541
|
-
}
|
|
3542
|
-
|
|
3543
|
-
let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname);
|
|
3544
|
-
|
|
3545
|
-
if (basename !== "/") {
|
|
3546
|
-
path.pathname = joinPaths([basename, path.pathname]);
|
|
3547
|
-
}
|
|
3548
|
-
|
|
3549
|
-
(!!options.replace ? navigator.replace : navigator.push)(path, options.state);
|
|
3550
|
-
}, [basename, navigator, routePathnamesJson, locationPathname]);
|
|
3551
|
-
return navigate;
|
|
3552
|
-
}
|
|
3553
|
-
/**
|
|
3554
|
-
* Returns the element of the route that matched the current location, prepared
|
|
3555
|
-
* with the correct context to render the remainder of the route tree. Route
|
|
3556
|
-
* elements in the tree must render an <Outlet> to render their child route's
|
|
3557
|
-
* element.
|
|
3558
|
-
*
|
|
3559
|
-
* @see https://reactrouter.com/docs/en/v6/api#useroutes
|
|
3560
|
-
*/
|
|
3561
|
-
|
|
3562
|
-
function useRoutes(routes, locationArg) {
|
|
3563
|
-
!useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
|
|
3564
|
-
// router loaded. We can help them understand how to avoid that.
|
|
3565
|
-
"useRoutes() may be used only in the context of a <Router> component.") : invariant(false) : void 0;
|
|
3566
|
-
let {
|
|
3567
|
-
matches: parentMatches
|
|
3568
|
-
} = React.useContext(RouteContext);
|
|
3569
|
-
let routeMatch = parentMatches[parentMatches.length - 1];
|
|
3570
|
-
let parentParams = routeMatch ? routeMatch.params : {};
|
|
3571
|
-
let parentPathname = routeMatch ? routeMatch.pathname : "/";
|
|
3572
|
-
let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/";
|
|
3573
|
-
let parentRoute = routeMatch && routeMatch.route;
|
|
3574
|
-
|
|
3575
|
-
if (process.env.NODE_ENV !== "production") {
|
|
3576
|
-
// You won't get a warning about 2 different <Routes> under a <Route>
|
|
3577
|
-
// without a trailing *, but this is a best-effort warning anyway since we
|
|
3578
|
-
// cannot even give the warning unless they land at the parent route.
|
|
3579
|
-
//
|
|
3580
|
-
// Example:
|
|
3581
|
-
//
|
|
3582
|
-
// <Routes>
|
|
3583
|
-
// {/* This route path MUST end with /* because otherwise
|
|
3584
|
-
// it will never match /blog/post/123 */}
|
|
3585
|
-
// <Route path="blog" element={<Blog />} />
|
|
3586
|
-
// <Route path="blog/feed" element={<BlogFeed />} />
|
|
3587
|
-
// </Routes>
|
|
3588
|
-
//
|
|
3589
|
-
// function Blog() {
|
|
3590
|
-
// return (
|
|
3591
|
-
// <Routes>
|
|
3592
|
-
// <Route path="post/:id" element={<Post />} />
|
|
3593
|
-
// </Routes>
|
|
3594
|
-
// );
|
|
3595
|
-
// }
|
|
3596
|
-
let parentPath = parentRoute && parentRoute.path || "";
|
|
3597
|
-
warningOnce(parentPathname, !parentRoute || parentPath.endsWith("*"), "You rendered descendant <Routes> (or called `useRoutes()`) at " + ("\"" + parentPathname + "\" (under <Route path=\"" + parentPath + "\">) but the ") + "parent route path has no trailing \"*\". This means if you navigate " + "deeper, the parent won't match anymore and therefore the child " + "routes will never render.\n\n" + ("Please change the parent <Route path=\"" + parentPath + "\"> to <Route ") + ("path=\"" + (parentPath === "/" ? "*" : parentPath + "/*") + "\">."));
|
|
3598
|
-
}
|
|
3599
|
-
|
|
3600
|
-
let locationFromContext = useLocation();
|
|
3601
|
-
let location;
|
|
3602
|
-
|
|
3603
|
-
if (locationArg) {
|
|
3604
|
-
var _parsedLocationArg$pa;
|
|
3605
|
-
|
|
3606
|
-
let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
|
3607
|
-
!(parentPathnameBase === "/" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? process.env.NODE_ENV !== "production" ? invariant(false, "When overriding the location using `<Routes location>` or `useRoutes(routes, location)`, " + "the location pathname must begin with the portion of the URL pathname that was " + ("matched by all parent routes. The current pathname base is \"" + parentPathnameBase + "\" ") + ("but pathname \"" + parsedLocationArg.pathname + "\" was given in the `location` prop.")) : invariant(false) : void 0;
|
|
3608
|
-
location = parsedLocationArg;
|
|
3609
|
-
} else {
|
|
3610
|
-
location = locationFromContext;
|
|
3611
|
-
}
|
|
3612
|
-
|
|
3613
|
-
let pathname = location.pathname || "/";
|
|
3614
|
-
let remainingPathname = parentPathnameBase === "/" ? pathname : pathname.slice(parentPathnameBase.length) || "/";
|
|
3615
|
-
let matches = matchRoutes(routes, {
|
|
3616
|
-
pathname: remainingPathname
|
|
3617
|
-
});
|
|
3618
|
-
|
|
3619
|
-
if (process.env.NODE_ENV !== "production") {
|
|
3620
|
-
process.env.NODE_ENV !== "production" ? warning(parentRoute || matches != null, "No routes matched location \"" + location.pathname + location.search + location.hash + "\" ") : void 0;
|
|
3621
|
-
process.env.NODE_ENV !== "production" ? warning(matches == null || matches[matches.length - 1].route.element !== undefined, "Matched leaf route at location \"" + location.pathname + location.search + location.hash + "\" does not have an element. " + "This means it will render an <Outlet /> with a null value by default resulting in an \"empty\" page.") : void 0;
|
|
3622
|
-
}
|
|
3623
|
-
|
|
3624
|
-
return _renderMatches(matches && matches.map(match => Object.assign({}, match, {
|
|
3625
|
-
params: Object.assign({}, parentParams, match.params),
|
|
3626
|
-
pathname: joinPaths([parentPathnameBase, match.pathname]),
|
|
3627
|
-
pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([parentPathnameBase, match.pathnameBase])
|
|
3628
|
-
})), parentMatches);
|
|
3629
|
-
}
|
|
3630
|
-
function _renderMatches(matches, parentMatches) {
|
|
3631
|
-
if (parentMatches === void 0) {
|
|
3632
|
-
parentMatches = [];
|
|
3633
|
-
}
|
|
3634
|
-
|
|
3635
|
-
if (matches == null) return null;
|
|
3636
|
-
return matches.reduceRight((outlet, match, index) => {
|
|
3637
|
-
return /*#__PURE__*/React.createElement(RouteContext.Provider, {
|
|
3638
|
-
children: match.route.element !== undefined ? match.route.element : outlet,
|
|
3639
|
-
value: {
|
|
3640
|
-
outlet,
|
|
3641
|
-
matches: parentMatches.concat(matches.slice(0, index + 1))
|
|
3642
|
-
}
|
|
3643
|
-
});
|
|
3644
|
-
}, null);
|
|
3645
|
-
}
|
|
3646
|
-
|
|
3647
|
-
/**
|
|
3648
|
-
* Changes the current location.
|
|
3649
|
-
*
|
|
3650
|
-
* Note: This API is mostly useful in React.Component subclasses that are not
|
|
3651
|
-
* able to use hooks. In functional components, we recommend you use the
|
|
3652
|
-
* `useNavigate` hook instead.
|
|
3653
|
-
*
|
|
3654
|
-
* @see https://reactrouter.com/docs/en/v6/api#navigate
|
|
3655
|
-
*/
|
|
3656
|
-
function Navigate(_ref2) {
|
|
3657
|
-
let {
|
|
3658
|
-
to,
|
|
3659
|
-
replace,
|
|
3660
|
-
state
|
|
3661
|
-
} = _ref2;
|
|
3662
|
-
!useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false, // TODO: This error is probably because they somehow have 2 versions of
|
|
3663
|
-
// the router loaded. We can help them understand how to avoid that.
|
|
3664
|
-
"<Navigate> may be used only in the context of a <Router> component.") : invariant(false) : void 0;
|
|
3665
|
-
process.env.NODE_ENV !== "production" ? warning(!React.useContext(NavigationContext).static, "<Navigate> must not be used on the initial render in a <StaticRouter>. " + "This is a no-op, but you should modify your code so the <Navigate> is " + "only ever rendered in response to some user interaction or state change.") : void 0;
|
|
3666
|
-
let navigate = useNavigate();
|
|
3667
|
-
React.useEffect(() => {
|
|
3668
|
-
navigate(to, {
|
|
3669
|
-
replace,
|
|
3670
|
-
state
|
|
3671
|
-
});
|
|
3672
|
-
});
|
|
3673
|
-
return null;
|
|
3674
|
-
}
|
|
3675
|
-
|
|
3676
2999
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
3677
3000
|
|
|
3678
3001
|
function createCommonjsModule(fn) {
|
|
@@ -4951,7 +4274,7 @@ var routes = function routes(isLoggedIn, _ref) {
|
|
|
4951
4274
|
widgetHeight: widgetHeight,
|
|
4952
4275
|
Widget: Widget,
|
|
4953
4276
|
editMode: editMode
|
|
4954
|
-
}) : React__default["default"].createElement(Navigate, {
|
|
4277
|
+
}) : React__default["default"].createElement(reactRouterDom.Navigate, {
|
|
4955
4278
|
to: "/login"
|
|
4956
4279
|
})
|
|
4957
4280
|
}];
|
|
@@ -4961,7 +4284,7 @@ var Routing = function Routing(dashboardProps) {
|
|
|
4961
4284
|
var _useLoginStatus = andoncloudSdk.useLoginStatus(),
|
|
4962
4285
|
status = _useLoginStatus.status;
|
|
4963
4286
|
|
|
4964
|
-
return useRoutes(routes(status === 'connected', dashboardProps));
|
|
4287
|
+
return reactRouterDom.useRoutes(routes(status === 'connected', dashboardProps));
|
|
4965
4288
|
};
|
|
4966
4289
|
|
|
4967
4290
|
var OAUTH2_BASE_URL = process.env.REACT_APP_DASHBOARD_OAUTH2_BASE_URL;
|