@localazy/strapi-plugin
Version:
The official Strapi Plugin by Localazy.
1,221 lines • 174 kB
JavaScript
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const reactRouterDom = require("react-router-dom");
const index$1 = require("./index-CaY3BYnQ.js");
const React = require("react");
const index = require("./index-Q3-srfXc.js");
const set = require("./set-CmcBsVOP.js");
const useTranslation = require("./useTranslation-BdIl-aLe.js");
const _commonjsHelpers = require("./_commonjsHelpers-Bc2YnDe1.js");
const LanguagesSelector = require("./LanguagesSelector-Bfrsr3-P.js");
const admin = require("@strapi/strapi/admin");
require("./i18n-0dV2P-Hm.js");
const hasModelChanged = require("./has-model-changed-B5SSh8XW.js");
var PLUGIN_ROUTES = /* @__PURE__ */ ((PLUGIN_ROUTES2) => {
PLUGIN_ROUTES2["ROOT"] = "";
PLUGIN_ROUTES2["LOGIN"] = "login";
PLUGIN_ROUTES2["UPLOAD"] = "upload";
PLUGIN_ROUTES2["DOWNLOAD"] = "download";
PLUGIN_ROUTES2["OVERVIEW"] = "overview";
PLUGIN_ROUTES2["CONTENT_TRANSFER_SETUP"] = "content-transfer-setup";
PLUGIN_ROUTES2["GLOBAL_SETTINGS"] = "global-settings";
return PLUGIN_ROUTES2;
})(PLUGIN_ROUTES || {});
const useRedirectToPluginRoute = () => {
const navigate = reactRouterDom.useNavigate();
const navigateToPluginRoute = (route) => {
if ([
"content-transfer-setup",
"global-settings"
/* GLOBAL_SETTINGS */
].includes(route)) {
navigate(`/settings/${index.PLUGIN_ID}/${route}`);
return;
}
navigate(`/plugins/${index.PLUGIN_ID}/${route}`);
};
return {
navigateToPluginRoute
};
};
const useNav = () => {
const { t: t2 } = useTranslation.useTranslation();
return [
{
id: "overview",
label: t2("common.overview"),
description: t2("overview.description"),
icon: /* @__PURE__ */ jsxRuntime.jsx(index$1.ForwardRef$2H, {}),
to: `/plugins/${index.PLUGIN_ID}/overview`,
active: false
},
{
id: "upload",
label: t2("common.upload_to_localazy"),
description: t2("upload.description"),
icon: /* @__PURE__ */ jsxRuntime.jsx(index$1.ForwardRef$d, {}),
to: `/plugins/${index.PLUGIN_ID}/upload`,
active: false
},
{
id: "download",
label: t2("common.download_to_strapi"),
description: t2("download.description"),
icon: /* @__PURE__ */ jsxRuntime.jsx(index$1.ForwardRef$3P, {}),
to: `/plugins/${index.PLUGIN_ID}/download`,
active: false
}
];
};
const useHeaderTitle = () => {
const { t: t2 } = useTranslation.useTranslation();
const location2 = reactRouterDom.useLocation();
const navigation = useNav();
const pluginSegment = location2?.pathname.split(`/${index.PLUGIN_ID}/`)[1];
if (!pluginSegment) {
return t2("common.localazy_plugin_hand");
}
const currentNavItem = navigation.find((navItem) => pluginSegment.includes(navItem.id));
return currentNavItem?.label || t2("common.localazy_plugin_hand");
};
const useHeaderSubtitle = () => {
const location2 = reactRouterDom.useLocation();
const navigation = useNav();
const pluginSegment = location2?.pathname.split(`/${index.PLUGIN_ID}/`)[1];
if (!pluginSegment) {
return "";
}
const currentNavItem = navigation.find((navItem) => pluginSegment.includes(navItem.id));
return currentNavItem?.description || "";
};
function PluginPageLoader() {
const { t: t2 } = useTranslation.useTranslation();
return /* @__PURE__ */ jsxRuntime.jsx(index$1.Flex, { marginTop: 10, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(index$1.Loader, { children: t2("common.loading_content") }) });
}
var propTypes = { exports: {} };
var reactIs = { exports: {} };
var reactIs_production_min = {};
/** @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 hasRequiredReactIs_production_min;
function requireReactIs_production_min() {
if (hasRequiredReactIs_production_min) return reactIs_production_min;
hasRequiredReactIs_production_min = 1;
var b = "function" === typeof Symbol && Symbol.for, c2 = b ? Symbol.for("react.element") : 60103, d = b ? Symbol.for("react.portal") : 60106, e2 = 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, l2 = b ? Symbol.for("react.async_mode") : 60111, m = b ? Symbol.for("react.concurrent_mode") : 60111, n2 = b ? Symbol.for("react.forward_ref") : 60112, p = b ? Symbol.for("react.suspense") : 60113, q = b ? Symbol.for("react.suspense_list") : 60120, r2 = b ? Symbol.for("react.memo") : 60115, t2 = 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(a2) {
if ("object" === typeof a2 && null !== a2) {
var u = a2.$$typeof;
switch (u) {
case c2:
switch (a2 = a2.type, a2) {
case l2:
case m:
case e2:
case g:
case f:
case p:
return a2;
default:
switch (a2 = a2 && a2.$$typeof, a2) {
case k:
case n2:
case t2:
case r2:
case h:
return a2;
default:
return u;
}
}
case d:
return u;
}
}
}
function A(a2) {
return z(a2) === m;
}
reactIs_production_min.AsyncMode = l2;
reactIs_production_min.ConcurrentMode = m;
reactIs_production_min.ContextConsumer = k;
reactIs_production_min.ContextProvider = h;
reactIs_production_min.Element = c2;
reactIs_production_min.ForwardRef = n2;
reactIs_production_min.Fragment = e2;
reactIs_production_min.Lazy = t2;
reactIs_production_min.Memo = r2;
reactIs_production_min.Portal = d;
reactIs_production_min.Profiler = g;
reactIs_production_min.StrictMode = f;
reactIs_production_min.Suspense = p;
reactIs_production_min.isAsyncMode = function(a2) {
return A(a2) || z(a2) === l2;
};
reactIs_production_min.isConcurrentMode = A;
reactIs_production_min.isContextConsumer = function(a2) {
return z(a2) === k;
};
reactIs_production_min.isContextProvider = function(a2) {
return z(a2) === h;
};
reactIs_production_min.isElement = function(a2) {
return "object" === typeof a2 && null !== a2 && a2.$$typeof === c2;
};
reactIs_production_min.isForwardRef = function(a2) {
return z(a2) === n2;
};
reactIs_production_min.isFragment = function(a2) {
return z(a2) === e2;
};
reactIs_production_min.isLazy = function(a2) {
return z(a2) === t2;
};
reactIs_production_min.isMemo = function(a2) {
return z(a2) === r2;
};
reactIs_production_min.isPortal = function(a2) {
return z(a2) === d;
};
reactIs_production_min.isProfiler = function(a2) {
return z(a2) === g;
};
reactIs_production_min.isStrictMode = function(a2) {
return z(a2) === f;
};
reactIs_production_min.isSuspense = function(a2) {
return z(a2) === p;
};
reactIs_production_min.isValidElementType = function(a2) {
return "string" === typeof a2 || "function" === typeof a2 || a2 === e2 || a2 === m || a2 === g || a2 === f || a2 === p || a2 === q || "object" === typeof a2 && null !== a2 && (a2.$$typeof === t2 || a2.$$typeof === r2 || a2.$$typeof === h || a2.$$typeof === k || a2.$$typeof === n2 || a2.$$typeof === w || a2.$$typeof === x || a2.$$typeof === y || a2.$$typeof === v);
};
reactIs_production_min.typeOf = z;
return reactIs_production_min;
}
var reactIs_development = {};
/** @license React v16.13.1
* react-is.development.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 hasRequiredReactIs_development;
function requireReactIs_development() {
if (hasRequiredReactIs_development) return reactIs_development;
hasRequiredReactIs_development = 1;
if (process.env.NODE_ENV !== "production") {
(function() {
var hasSymbol = typeof Symbol === "function" && Symbol.for;
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103;
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106;
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107;
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108;
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114;
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109;
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110;
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for("react.async_mode") : 60111;
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") : 60111;
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112;
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113;
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for("react.suspense_list") : 60120;
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115;
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116;
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for("react.block") : 60121;
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117;
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118;
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119;
function isValidElementType(type) {
return typeof type === "string" || typeof type === "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
}
function typeOf(object) {
if (typeof object === "object" && object !== null) {
var $$typeof = object.$$typeof;
switch ($$typeof) {
case REACT_ELEMENT_TYPE:
var type = object.type;
switch (type) {
case REACT_ASYNC_MODE_TYPE:
case REACT_CONCURRENT_MODE_TYPE:
case REACT_FRAGMENT_TYPE:
case REACT_PROFILER_TYPE:
case REACT_STRICT_MODE_TYPE:
case REACT_SUSPENSE_TYPE:
return type;
default:
var $$typeofType = type && type.$$typeof;
switch ($$typeofType) {
case REACT_CONTEXT_TYPE:
case REACT_FORWARD_REF_TYPE:
case REACT_LAZY_TYPE:
case REACT_MEMO_TYPE:
case REACT_PROVIDER_TYPE:
return $$typeofType;
default:
return $$typeof;
}
}
case REACT_PORTAL_TYPE:
return $$typeof;
}
}
return void 0;
}
var AsyncMode = REACT_ASYNC_MODE_TYPE;
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
var ContextConsumer = REACT_CONTEXT_TYPE;
var ContextProvider = REACT_PROVIDER_TYPE;
var Element = REACT_ELEMENT_TYPE;
var ForwardRef = REACT_FORWARD_REF_TYPE;
var Fragment = REACT_FRAGMENT_TYPE;
var Lazy = REACT_LAZY_TYPE;
var Memo = REACT_MEMO_TYPE;
var Portal = REACT_PORTAL_TYPE;
var Profiler = REACT_PROFILER_TYPE;
var StrictMode = REACT_STRICT_MODE_TYPE;
var Suspense = REACT_SUSPENSE_TYPE;
var hasWarnedAboutDeprecatedIsAsyncMode = false;
function isAsyncMode(object) {
{
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
hasWarnedAboutDeprecatedIsAsyncMode = true;
console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.");
}
}
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
}
function isConcurrentMode(object) {
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
}
function isContextConsumer(object) {
return typeOf(object) === REACT_CONTEXT_TYPE;
}
function isContextProvider(object) {
return typeOf(object) === REACT_PROVIDER_TYPE;
}
function isElement(object) {
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
}
function isForwardRef(object) {
return typeOf(object) === REACT_FORWARD_REF_TYPE;
}
function isFragment(object) {
return typeOf(object) === REACT_FRAGMENT_TYPE;
}
function isLazy(object) {
return typeOf(object) === REACT_LAZY_TYPE;
}
function isMemo(object) {
return typeOf(object) === REACT_MEMO_TYPE;
}
function isPortal(object) {
return typeOf(object) === REACT_PORTAL_TYPE;
}
function isProfiler(object) {
return typeOf(object) === REACT_PROFILER_TYPE;
}
function isStrictMode(object) {
return typeOf(object) === REACT_STRICT_MODE_TYPE;
}
function isSuspense(object) {
return typeOf(object) === REACT_SUSPENSE_TYPE;
}
reactIs_development.AsyncMode = AsyncMode;
reactIs_development.ConcurrentMode = ConcurrentMode;
reactIs_development.ContextConsumer = ContextConsumer;
reactIs_development.ContextProvider = ContextProvider;
reactIs_development.Element = Element;
reactIs_development.ForwardRef = ForwardRef;
reactIs_development.Fragment = Fragment;
reactIs_development.Lazy = Lazy;
reactIs_development.Memo = Memo;
reactIs_development.Portal = Portal;
reactIs_development.Profiler = Profiler;
reactIs_development.StrictMode = StrictMode;
reactIs_development.Suspense = Suspense;
reactIs_development.isAsyncMode = isAsyncMode;
reactIs_development.isConcurrentMode = isConcurrentMode;
reactIs_development.isContextConsumer = isContextConsumer;
reactIs_development.isContextProvider = isContextProvider;
reactIs_development.isElement = isElement;
reactIs_development.isForwardRef = isForwardRef;
reactIs_development.isFragment = isFragment;
reactIs_development.isLazy = isLazy;
reactIs_development.isMemo = isMemo;
reactIs_development.isPortal = isPortal;
reactIs_development.isProfiler = isProfiler;
reactIs_development.isStrictMode = isStrictMode;
reactIs_development.isSuspense = isSuspense;
reactIs_development.isValidElementType = isValidElementType;
reactIs_development.typeOf = typeOf;
})();
}
return reactIs_development;
}
var hasRequiredReactIs;
function requireReactIs() {
if (hasRequiredReactIs) return reactIs.exports;
hasRequiredReactIs = 1;
if (process.env.NODE_ENV === "production") {
reactIs.exports = requireReactIs_production_min();
} else {
reactIs.exports = requireReactIs_development();
}
return reactIs.exports;
}
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
var objectAssign;
var hasRequiredObjectAssign;
function requireObjectAssign() {
if (hasRequiredObjectAssign) return objectAssign;
hasRequiredObjectAssign = 1;
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === void 0) {
throw new TypeError("Object.assign cannot be called with null or undefined");
}
return Object(val);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
}
var test1 = new String("abc");
test1[5] = "de";
if (Object.getOwnPropertyNames(test1)[0] === "5") {
return false;
}
var test2 = {};
for (var i2 = 0; i2 < 10; i2++) {
test2["_" + String.fromCharCode(i2)] = i2;
}
var order2 = Object.getOwnPropertyNames(test2).map(function(n2) {
return test2[n2];
});
if (order2.join("") !== "0123456789") {
return false;
}
var test3 = {};
"abcdefghijklmnopqrst".split("").forEach(function(letter) {
test3[letter] = letter;
});
if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
return false;
}
return true;
} catch (err) {
return false;
}
}
objectAssign = shouldUseNative() ? Object.assign : function(target, source) {
var from;
var to = toObject(target);
var symbols;
for (var s2 = 1; s2 < arguments.length; s2++) {
from = Object(arguments[s2]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (getOwnPropertySymbols) {
symbols = getOwnPropertySymbols(from);
for (var i2 = 0; i2 < symbols.length; i2++) {
if (propIsEnumerable.call(from, symbols[i2])) {
to[symbols[i2]] = from[symbols[i2]];
}
}
}
}
return to;
};
return objectAssign;
}
var ReactPropTypesSecret_1;
var hasRequiredReactPropTypesSecret;
function requireReactPropTypesSecret() {
if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
hasRequiredReactPropTypesSecret = 1;
var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
ReactPropTypesSecret_1 = ReactPropTypesSecret;
return ReactPropTypesSecret_1;
}
var has;
var hasRequiredHas;
function requireHas() {
if (hasRequiredHas) return has;
hasRequiredHas = 1;
has = Function.call.bind(Object.prototype.hasOwnProperty);
return has;
}
var checkPropTypes_1;
var hasRequiredCheckPropTypes;
function requireCheckPropTypes() {
if (hasRequiredCheckPropTypes) return checkPropTypes_1;
hasRequiredCheckPropTypes = 1;
var printWarning = function() {
};
if (process.env.NODE_ENV !== "production") {
var ReactPropTypesSecret = requireReactPropTypesSecret();
var loggedTypeFailures = {};
var has2 = requireHas();
printWarning = function(text) {
var message = "Warning: " + text;
if (typeof console !== "undefined") {
console.error(message);
}
try {
throw new Error(message);
} catch (x) {
}
};
}
function checkPropTypes(typeSpecs, values, location2, componentName, getStack) {
if (process.env.NODE_ENV !== "production") {
for (var typeSpecName in typeSpecs) {
if (has2(typeSpecs, typeSpecName)) {
var error;
try {
if (typeof typeSpecs[typeSpecName] !== "function") {
var err = Error(
(componentName || "React class") + ": " + location2 + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
);
err.name = "Invariant Violation";
throw err;
}
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location2, null, ReactPropTypesSecret);
} catch (ex) {
error = ex;
}
if (error && !(error instanceof Error)) {
printWarning(
(componentName || "React class") + ": type specification of " + location2 + " `" + typeSpecName + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof error + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
);
}
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
loggedTypeFailures[error.message] = true;
var stack = getStack ? getStack() : "";
printWarning(
"Failed " + location2 + " type: " + error.message + (stack != null ? stack : "")
);
}
}
}
}
}
checkPropTypes.resetWarningCache = function() {
if (process.env.NODE_ENV !== "production") {
loggedTypeFailures = {};
}
};
checkPropTypes_1 = checkPropTypes;
return checkPropTypes_1;
}
var factoryWithTypeCheckers;
var hasRequiredFactoryWithTypeCheckers;
function requireFactoryWithTypeCheckers() {
if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
hasRequiredFactoryWithTypeCheckers = 1;
var ReactIs = requireReactIs();
var assign = requireObjectAssign();
var ReactPropTypesSecret = requireReactPropTypesSecret();
var has2 = requireHas();
var checkPropTypes = requireCheckPropTypes();
var printWarning = function() {
};
if (process.env.NODE_ENV !== "production") {
printWarning = function(text) {
var message = "Warning: " + text;
if (typeof console !== "undefined") {
console.error(message);
}
try {
throw new Error(message);
} catch (x) {
}
};
}
function emptyFunctionThatReturnsNull() {
return null;
}
factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = "@@iterator";
function getIteratorFn(maybeIterable) {
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === "function") {
return iteratorFn;
}
}
var ANONYMOUS = "<<anonymous>>";
var ReactPropTypes = {
array: createPrimitiveTypeChecker("array"),
bigint: createPrimitiveTypeChecker("bigint"),
bool: createPrimitiveTypeChecker("boolean"),
func: createPrimitiveTypeChecker("function"),
number: createPrimitiveTypeChecker("number"),
object: createPrimitiveTypeChecker("object"),
string: createPrimitiveTypeChecker("string"),
symbol: createPrimitiveTypeChecker("symbol"),
any: createAnyTypeChecker(),
arrayOf: createArrayOfTypeChecker,
element: createElementTypeChecker(),
elementType: createElementTypeTypeChecker(),
instanceOf: createInstanceTypeChecker,
node: createNodeChecker(),
objectOf: createObjectOfTypeChecker,
oneOf: createEnumTypeChecker,
oneOfType: createUnionTypeChecker,
shape: createShapeTypeChecker,
exact: createStrictShapeTypeChecker
};
function is(x, y) {
if (x === y) {
return x !== 0 || 1 / x === 1 / y;
} else {
return x !== x && y !== y;
}
}
function PropTypeError(message, data) {
this.message = message;
this.data = data && typeof data === "object" ? data : {};
this.stack = "";
}
PropTypeError.prototype = Error.prototype;
function createChainableTypeChecker(validate) {
if (process.env.NODE_ENV !== "production") {
var manualPropTypeCallCache = {};
var manualPropTypeWarningCount = 0;
}
function checkType(isRequired, props, propName, componentName, location2, propFullName, secret) {
componentName = componentName || ANONYMOUS;
propFullName = propFullName || propName;
if (secret !== ReactPropTypesSecret) {
if (throwOnDirectAccess) {
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;
} else if (process.env.NODE_ENV !== "production" && typeof console !== "undefined") {
var cacheKey = componentName + ":" + propName;
if (!manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors
manualPropTypeWarningCount < 3) {
printWarning(
"You are manually calling a React.PropTypes validation function for the `" + propFullName + "` prop on `" + componentName + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
);
manualPropTypeCallCache[cacheKey] = true;
manualPropTypeWarningCount++;
}
}
}
if (props[propName] == null) {
if (isRequired) {
if (props[propName] === null) {
return new PropTypeError("The " + location2 + " `" + propFullName + "` is marked as required " + ("in `" + componentName + "`, but its value is `null`."));
}
return new PropTypeError("The " + location2 + " `" + propFullName + "` is marked as required in " + ("`" + componentName + "`, but its value is `undefined`."));
}
return null;
} else {
return validate(props, propName, componentName, location2, propFullName);
}
}
var chainedCheckType = checkType.bind(null, false);
chainedCheckType.isRequired = checkType.bind(null, true);
return chainedCheckType;
}
function createPrimitiveTypeChecker(expectedType) {
function validate(props, propName, componentName, location2, propFullName, secret) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== expectedType) {
var preciseType = getPreciseType(propValue);
return new PropTypeError(
"Invalid " + location2 + " `" + propFullName + "` of type " + ("`" + preciseType + "` supplied to `" + componentName + "`, expected ") + ("`" + expectedType + "`."),
{ expectedType }
);
}
return null;
}
return createChainableTypeChecker(validate);
}
function createAnyTypeChecker() {
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
}
function createArrayOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location2, propFullName) {
if (typeof typeChecker !== "function") {
return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside arrayOf.");
}
var propValue = props[propName];
if (!Array.isArray(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError("Invalid " + location2 + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array."));
}
for (var i2 = 0; i2 < propValue.length; i2++) {
var error = typeChecker(propValue, i2, componentName, location2, propFullName + "[" + i2 + "]", ReactPropTypesSecret);
if (error instanceof Error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createElementTypeChecker() {
function validate(props, propName, componentName, location2, propFullName) {
var propValue = props[propName];
if (!isValidElement(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError("Invalid " + location2 + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement."));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createElementTypeTypeChecker() {
function validate(props, propName, componentName, location2, propFullName) {
var propValue = props[propName];
if (!ReactIs.isValidElementType(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError("Invalid " + location2 + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement type."));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createInstanceTypeChecker(expectedClass) {
function validate(props, propName, componentName, location2, propFullName) {
if (!(props[propName] instanceof expectedClass)) {
var expectedClassName = expectedClass.name || ANONYMOUS;
var actualClassName = getClassName(props[propName]);
return new PropTypeError("Invalid " + location2 + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createEnumTypeChecker(expectedValues) {
if (!Array.isArray(expectedValues)) {
if (process.env.NODE_ENV !== "production") {
if (arguments.length > 1) {
printWarning(
"Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
);
} else {
printWarning("Invalid argument supplied to oneOf, expected an array.");
}
}
return emptyFunctionThatReturnsNull;
}
function validate(props, propName, componentName, location2, propFullName) {
var propValue = props[propName];
for (var i2 = 0; i2 < expectedValues.length; i2++) {
if (is(propValue, expectedValues[i2])) {
return null;
}
}
var valuesString = JSON.stringify(expectedValues, function replacer(key, value2) {
var type = getPreciseType(value2);
if (type === "symbol") {
return String(value2);
}
return value2;
});
return new PropTypeError("Invalid " + location2 + " `" + propFullName + "` of value `" + String(propValue) + "` " + ("supplied to `" + componentName + "`, expected one of " + valuesString + "."));
}
return createChainableTypeChecker(validate);
}
function createObjectOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location2, propFullName) {
if (typeof typeChecker !== "function") {
return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside objectOf.");
}
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== "object") {
return new PropTypeError("Invalid " + location2 + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an object."));
}
for (var key in propValue) {
if (has2(propValue, key)) {
var error = typeChecker(propValue, key, componentName, location2, propFullName + "." + key, ReactPropTypesSecret);
if (error instanceof Error) {
return error;
}
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createUnionTypeChecker(arrayOfTypeCheckers) {
if (!Array.isArray(arrayOfTypeCheckers)) {
process.env.NODE_ENV !== "production" ? printWarning("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0;
return emptyFunctionThatReturnsNull;
}
for (var i2 = 0; i2 < arrayOfTypeCheckers.length; i2++) {
var checker = arrayOfTypeCheckers[i2];
if (typeof checker !== "function") {
printWarning(
"Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + getPostfixForTypeWarning(checker) + " at index " + i2 + "."
);
return emptyFunctionThatReturnsNull;
}
}
function validate(props, propName, componentName, location2, propFullName) {
var expectedTypes = [];
for (var i3 = 0; i3 < arrayOfTypeCheckers.length; i3++) {
var checker2 = arrayOfTypeCheckers[i3];
var checkerResult = checker2(props, propName, componentName, location2, propFullName, ReactPropTypesSecret);
if (checkerResult == null) {
return null;
}
if (checkerResult.data && has2(checkerResult.data, "expectedType")) {
expectedTypes.push(checkerResult.data.expectedType);
}
}
var expectedTypesMessage = expectedTypes.length > 0 ? ", expected one of type [" + expectedTypes.join(", ") + "]" : "";
return new PropTypeError("Invalid " + location2 + " `" + propFullName + "` supplied to " + ("`" + componentName + "`" + expectedTypesMessage + "."));
}
return createChainableTypeChecker(validate);
}
function createNodeChecker() {
function validate(props, propName, componentName, location2, propFullName) {
if (!isNode(props[propName])) {
return new PropTypeError("Invalid " + location2 + " `" + propFullName + "` supplied to " + ("`" + componentName + "`, expected a ReactNode."));
}
return null;
}
return createChainableTypeChecker(validate);
}
function invalidValidatorError(componentName, location2, propFullName, key, type) {
return new PropTypeError(
(componentName || "React class") + ": " + location2 + " type `" + propFullName + "." + key + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + type + "`."
);
}
function createShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location2, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== "object") {
return new PropTypeError("Invalid " + location2 + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
}
for (var key in shapeTypes) {
var checker = shapeTypes[key];
if (typeof checker !== "function") {
return invalidValidatorError(componentName, location2, propFullName, key, getPreciseType(checker));
}
var error = checker(propValue, key, componentName, location2, propFullName + "." + key, ReactPropTypesSecret);
if (error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createStrictShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location2, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== "object") {
return new PropTypeError("Invalid " + location2 + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
}
var allKeys = assign({}, props[propName], shapeTypes);
for (var key in allKeys) {
var checker = shapeTypes[key];
if (has2(shapeTypes, key) && typeof checker !== "function") {
return invalidValidatorError(componentName, location2, propFullName, key, getPreciseType(checker));
}
if (!checker) {
return new PropTypeError(
"Invalid " + location2 + " `" + propFullName + "` key `" + key + "` supplied to `" + componentName + "`.\nBad object: " + JSON.stringify(props[propName], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(shapeTypes), null, " ")
);
}
var error = checker(propValue, key, componentName, location2, propFullName + "." + key, ReactPropTypesSecret);
if (error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function isNode(propValue) {
switch (typeof propValue) {
case "number":
case "string":
case "undefined":
return true;
case "boolean":
return !propValue;
case "object":
if (Array.isArray(propValue)) {
return propValue.every(isNode);
}
if (propValue === null || isValidElement(propValue)) {
return true;
}
var iteratorFn = getIteratorFn(propValue);
if (iteratorFn) {
var iterator = iteratorFn.call(propValue);
var step;
if (iteratorFn !== propValue.entries) {
while (!(step = iterator.next()).done) {
if (!isNode(step.value)) {
return false;
}
}
} else {
while (!(step = iterator.next()).done) {
var entry = step.value;
if (entry) {
if (!isNode(entry[1])) {
return false;
}
}
}
}
} else {
return false;
}
return true;
default:
return false;
}
}
function isSymbol(propType, propValue) {
if (propType === "symbol") {
return true;
}
if (!propValue) {
return false;
}
if (propValue["@@toStringTag"] === "Symbol") {
return true;
}
if (typeof Symbol === "function" && propValue instanceof Symbol) {
return true;
}
return false;
}
function getPropType(propValue) {
var propType = typeof propValue;
if (Array.isArray(propValue)) {
return "array";
}
if (propValue instanceof RegExp) {
return "object";
}
if (isSymbol(propType, propValue)) {
return "symbol";
}
return propType;
}
function getPreciseType(propValue) {
if (typeof propValue === "undefined" || propValue === null) {
return "" + propValue;
}
var propType = getPropType(propValue);
if (propType === "object") {
if (propValue instanceof Date) {
return "date";
} else if (propValue instanceof RegExp) {
return "regexp";
}
}
return propType;
}
function getPostfixForTypeWarning(value2) {
var type = getPreciseType(value2);
switch (type) {
case "array":
case "object":
return "an " + type;
case "boolean":
case "date":
case "regexp":
return "a " + type;
default:
return type;
}
}
function getClassName(propValue) {
if (!propValue.constructor || !propValue.constructor.name) {
return ANONYMOUS;
}
return propValue.constructor.name;
}
ReactPropTypes.checkPropTypes = checkPropTypes;
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
return factoryWithTypeCheckers;
}
var factoryWithThrowingShims;
var hasRequiredFactoryWithThrowingShims;
function requireFactoryWithThrowingShims() {
if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
hasRequiredFactoryWithThrowingShims = 1;
var ReactPropTypesSecret = requireReactPropTypesSecret();
function emptyFunction() {
}
function emptyFunctionWithReset() {
}
emptyFunctionWithReset.resetWarningCache = emptyFunction;
factoryWithThrowingShims = function() {
function shim(props, propName, componentName, location2, propFullName, secret) {
if (secret === ReactPropTypesSecret) {
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;
}
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;
};
return factoryWithThrowingShims;
}
if (process.env.NODE_ENV !== "production") {
var ReactIs = requireReactIs();
var throwOnDirectAccess = true;
propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
} else {
propTypes.exports = requireFactoryWithThrowingShims()();
}
var propTypesExports = propTypes.exports;
const PropTypes = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(propTypesExports);
var t = Object.defineProperty, e = (e2, a2, n2) => (((e3, a3, n3) => {
a3 in e3 ? t(e3, a3, { enumerable: true, configurable: true, writable: true, value: n3 }) : e3[a3] = n3;
})(e2, "symbol" != typeof a2 ? a2 + "" : a2, n2), n2);
/* @localazy/generic-connector-client@0.3.0
* (c) 2024 Localazy <team@localazy.com>
* @license MIT */
class a {
constructor(t2) {
e(this, "genericConnectorUrl"), e(this, "pluginId"), this.genericConnectorUrl = t2.genericConnectorUrl || "https://plugins.localazy.com/generic-connector", this.pluginId = t2.pluginId;
}
async get(t2, e2) {
return this.makeRequest("GET", t2, e2);
}
async post(t2, e2, a2) {
return this.makeRequest("POST", t2, a2, e2);
}
async put(t2, e2, a2) {
return this.makeRequest("PUT", t2, a2, e2);
}
async delete(t2, e2) {
return this.makeRequest("DELETE", t2, e2);
}
urlFactory(t2) {
return `${this.genericConnectorUrl}${t2}`;
}
configFactory(t2, e2, a2) {
const n2 = { method: t2, headers: { ...(null == e2 ? void 0 : e2.headers) || {}, "X-Localazy-Plugin-Id": `${this.pluginId}`, Accept: "application/json", "Content-Type": "application/json" } };
return a2 && (n2.body = JSON.stringify(a2)), n2;
}
async makeRequest(t2, e2, a2, n2) {
let s2 = this.urlFactory(e2);
if ("GET" === t2 && (null == a2 ? void 0 : a2.params)) {
s2 += `?${new URLSearchParams(a2.params).toString()}`;
}
const r2 = await fetch(s2, this.configFactory(t2, a2, n2)), i2 = r2.headers.get("content-type"), o2 = "blob" === (null == a2 ? void 0 : a2.responseType) || false, c2 = (null == i2 ? void 0 : i2.startsWith("application/json")) || false;
let l2;
if (l2 = o2 ? await r2.blob() : c2 ? await r2.json() : await r2.text(), r2.status >= 400) {
const t3 = c2 && l2.error ? l2.error : r2.statusText;
throw new Error(`Request failed with status code ${r2.status}: ${t3}`);
}
return l2;
}
}
class n {
constructor(t2) {
e(this, "api"), this.api = t2;
}
}
class s extends n {
async keys(t2) {
return await this.api.client.get("/public/keys", { ...t2 });
}
}
class r extends n {
async poll(t2, e2) {
return await this.api.client.get("/oauth/poll", { ...e2, params: { ...null == e2 ? void 0 : e2.params, ...t2 } });
}
async continuousPoll(t2, e2) {
const a2 = t2.pollingMaxAttempts || 60, n2 = t2.pollingIntervalMs || 2e3;
let s2 = 1, r2 = await this.poll({ readKey: t2.readKey }, e2);
return r2.completed ? r2 : new Promise((i2, o2) => {
const c2 = setInterval(async () => {
r2 = await this.poll({ readKey: t2.readKey }, e2), r2.completed && (clearInterval(c2), i2(r2)), s2 += 1, s2 >= a2 && (clearInterval(c2), o2(new Error("Sign in attempts timed out.")));
}, n2);
});
}
}
class i extends n {
async track(t2, e2) {
return await this.api.client.post("/analytics/track", t2, e2);
}
}
class o {
constructor(t2) {
e(this, "client"), e(this, "public"), e(this, "oauth"), e(this, "analytics"), this.client = new a(t2), this.public = new s(this), this.oauth = new r(this), this.analytics = new i(this);
}
}
var c = ((t2) => (t2[t2.UNKNOWN_SERVICE = -1] = "UNKNOWN_SERVICE", t2[t2.FIGMA = 0] = "FIGMA", t2[t2.STRAPI = 1] = "STRAPI", t2[t2.ZAPIER = 2] = "ZAPIER", t2[t2.STORYBLOK = 3] = "STORYBLOK", t2[t2.INTERCOM = 4] = "INTERCOM", t2[t2.DIRECTUS = 5] = "DIRECTUS", t2[t2.ZENDESK = 6] = "ZENDESK", t2))(c || {});
function l(t2, e2) {
const a2 = new URLSearchParams();
a2.append("client_id", t2.clientId), t2.redirectUri && a2.append("redirect_uri", t2.redirectUri), t2.customId && a2.append("custom_id", t2.customId), t2.state && a2.append("state", t2.state), t2.scope && a2.append("scope", t2.scope), t2.allowCreate && a2.append("allow_create", t2.allowCreate.toString()), t2.createType && a2.append("create_type", t2.createType), t2.createLocale && a2.append("create_locale", t2.createLocale), t2.minimalRole && a2.append("minimal_role", t2.minimalRole);
const n2 = e2 || "https://localazy.com";
return "/" !== new URL(n2).pathname ? `${n2}?${a2.toString()}` : `${n2}/oauth/authorize?${a2.toString()}`;
}
const BASE_PATH$2 = "/auth";
const axiosInstance = index.createStrapiApiAxiosInstance();
class LocalazyLoginService {
static async generateKeys() {
try {
const result = await axiosInstance.get(`${BASE_PATH$2}/generate-keys`);
return result.data;
} catch (e2) {
throw e2;
}
}
static async continuousPoll(readKey) {
try {
const result = await axiosInstance.get(`${BASE_PATH$2}/continuous-poll?readKey=${readKey}`);
return result.data;
} catch (e2) {
throw e2;
}
}
}
const strapiApiInstance$1 = index.createStrapiApiAxiosInstance("/i18n");
class I18nService {
static async getLocales() {
try {
const result = await strapiApiInstance$1.get(`/locales`);
return result.data;
} catch (e2) {
throw e2;
}
}
}
async function getStrapiDefaultLocale() {
const locales = await I18nService.getLocales();
const defaultLocale = locales.find((locale) => !!locale.isDefault);
if (!defaultLocale) {
return null;
}
return defaultLocale;
}
async function getLocalazySourceLanguage() {
const connectedProject = await LanguagesSelector.ProjectService.getConnectedProject();
if (!connectedProject) {
return null;
}
const sourceLanguageId = connectedProject.sourceLanguage;
const sourceLanguage = connectedProject.languages.find((language) => language.id === sourceLanguageId);
if (!sourceLanguage) {
return null;
}
return sourceLanguage;
}
const isoStrapiToLocalazy = (isoStrapi) => {
if (!isoStrapi) {
return null;
}
const split = isoStrapi.split("-");
const language = split[0];
const hasRegionAndScript = split.length === 3;
if (hasRegionAndScript) {
const script = split[1];
const region = split[2];
return `${language}_${region}#${script}`;
}
const hasPossiblyRegion = split.length === 2;
if (hasPossiblyRegion) {
const regionOrScript = split[1];
const isItRegion = regionOrScript.toUpperCase() === regionOrScript;
return isItRegion ? `${language}_${regionOrScript}` : `${language}#${regionOrScript}`;
}
return isoStrapi.replace("-", "_");
};
const isoLocalazyToStrapi = (isoLocalazy) => {
if (!isoLocalazy) {
return null;
}
const scriptIndex = isoLocalazy.indexOf("#");
const hasScript = scriptIndex > -1;
if (hasScript) {
const script = isoLocalazy.substring(scriptIndex + 1);
const isoLocalazyWithoutScript = isoLocalazy.substring(0, scriptIndex);
const split = isoLocalazyWithoutScript.split("_");
const language = split[0];
const region = split[1];
if (!region) {
return `${language}-${script}`;
}
const isoStrapi = `${language}-${script}-${region.toUpperCase()}`;
return isoStrapi;
}
return isoLocalazy.replace("_", "-");
};
const production = {
LOCALAZY_OAUTH_URL: "https://localazy.com/oauth/authorize",
LOCALAZY_OAUTH_APP_CLIENT_ID: "18395772851999073783",
LOCALAZY_PLUGIN_CONNECTOR_API_URL: "https://plugins.localazy.com/generic-connector"
};
const local = {
LOCALAZY_OAUTH_URL: "https://testing.localazy.com/oauth/authorize",
LOCALAZY_OAUTH_APP_CLIENT_ID: "18503917571895066465",
LOCALAZY_PLUGIN_CONNECTOR_API_URL: "http://localhost:3000",
LOCALAZY_PUBLIC_API_URL: "https://testing.localazy.com/pubapi",
LOCALAZY_PLUGIN_ID: "1",
LOCALAZY_DEFAULT_FILE_NAME: "str