import {
AssetSource,
AssetType,
PERMISSIONS,
byte_size_default,
getTrad,
pluginId,
sortOptions,
tableHeaders,
urlSchema
} from "./chunk-ALMC553V.js";
import {
useDrag,
useDrop
} from "./chunk-S3HPKOXW.js";
import {
useMutation,
useQuery,
useQueryClient
} from "./chunk-QLEKUQKW.js";
import {
useFetchClient
} from "./chunk-FCIM6RNO.js";
import {
ConfirmDialog
} from "./chunk-NP53ZCXD.js";
import {
_arrayLikeToArray,
_classCallCheck,
_createClass,
_createSuper,
_inherits,
_unsupportedIterableToArray,
intervalToDuration
} from "./chunk-KFLQQE5L.js";
import {
require_isEmpty
} from "./chunk-YJEURQPS.js";
import {
Form,
Formik
} from "./chunk-PW7XKCYO.js";
import {
create4 as create,
create5 as create2,
create6 as create3
} from "./chunk-XLSIZGJF.js";
import {
useTracking
} from "./chunk-GSN7U3BK.js";
import {
useClipboard
} from "./chunk-7PUJSL55.js";
import {
useRBAC
} from "./chunk-CMLQV3Z2.js";
import {
parseISO
} from "./chunk-D4WYVNVM.js";
import {
Layouts
} from "./chunk-TIVRAWTC.js";
import {
require_isEqual
} from "./chunk-VYSYYPOB.js";
import {
ForwardRef$J
} from "./chunk-5CAWUBTQ.js";
import {
useQueryParams
} from "./chunk-W2TBR6J3.js";
import {
require_lib
} from "./chunk-LCL5TIBZ.js";
import {
_defineProperty,
_objectSpread2,
_typeof
} from "./chunk-WOQNBAGN.js";
import {
useNotification
} from "./chunk-N55RVBRV.js";
import {
Avatar,
Badge,
Box,
Breadcrumbs,
Button,
Card,
CardActionImpl,
CardAsset,
CardBadge,
CardBody,
CardCheckbox,
CardContent,
CardHeader,
CardSubtitle,
CardTimer,
CardTitle,
CheckboxImpl,
Crumb,
CrumbLink,
CrumbSimpleMenu,
DateTimePicker,
Dialog,
Divider,
Field,
Flex,
FocusTrap,
Grid,
IconButton,
KeyboardNavigable,
Loader,
Menu,
MenuItem,
Modal,
Popover,
ProgressBar,
SingleSelect,
SingleSelectOption,
Table,
Tabs,
Tag,
Tbody,
Td,
TextInput,
Textarea,
Th,
Thead,
TooltipImpl,
Tr,
Typography,
VisuallyHidden,
_extends,
_objectWithoutPropertiesLoose,
autoUpdate,
require_hoist_non_react_statics_cjs,
useIntl,
useNotifyAT
} from "./chunk-7XB6XSWQ.js";
import {
Link,
NavLink,
useLocation
} from "./chunk-TUXTO2Z5.js";
import {
require_react_dom
} from "./chunk-FOD4ENRR.js";
import {
ForwardRef$1f,
ForwardRef$1h,
ForwardRef$1v,
ForwardRef$2r,
ForwardRef$3D,
ForwardRef$3V,
ForwardRef$3h,
ForwardRef$3p,
ForwardRef$3v,
ForwardRef$45,
ForwardRef$47,
ForwardRef$4F,
ForwardRef$4R,
ForwardRef$4T,
ForwardRef$4t,
ForwardRef$4z,
ForwardRef$j
} from "./chunk-WRD5KPDH.js";
import {
require_jsx_runtime
} from "./chunk-NIAJZ5MX.js";
import {
dt,
nt
} from "./chunk-ACIMPXWY.js";
import {
require_react
} from "./chunk-MADUDGYZ.js";
import {
__toESM
} from "./chunk-PLDDJCW6.js";
// node_modules/@strapi/upload/dist/admin/hooks/useAssets.mjs
var React = __toESM(require_react(), 1);
var useAssets = ({ skipWhen = false, query = {} } = {}) => {
var _a3;
const { formatMessage } = useIntl();
const { toggleNotification } = useNotification();
const { notifyStatus } = useNotifyAT();
const { get } = useFetchClient();
const { folderPath, _q, ...paramsExceptFolderAndQ } = query;
let params;
if (_q) {
params = {
...paramsExceptFolderAndQ,
_q: encodeURIComponent(_q)
};
} else {
params = {
...paramsExceptFolderAndQ,
filters: {
$and: [
...((_a3 = paramsExceptFolderAndQ == null ? void 0 : paramsExceptFolderAndQ.filters) == null ? void 0 : _a3.$and) ?? [],
{
folderPath: {
$eq: folderPath ?? "/"
}
}
]
}
};
}
const { data, error, isLoading } = useQuery([
pluginId,
"assets",
params
], async () => {
const { data: data2 } = await get("/upload/files", {
params
});
return data2;
}, {
enabled: !skipWhen,
staleTime: 0,
cacheTime: 0,
select(data2) {
if ((data2 == null ? void 0 : data2.results) && Array.isArray(data2.results)) {
return {
...data2,
results: data2.results.filter((asset) => asset.name).map((asset) => ({
...asset,
/**
* Mime and ext cannot be null in the front-end because
* we expect them to be strings and use the `includes` method.
*/
mime: asset.mime ?? "",
ext: asset.ext ?? ""
}))
};
}
return data2;
}
});
React.useEffect(() => {
if (data) {
notifyStatus(formatMessage({
id: "list.asset.at.finished",
defaultMessage: "The assets have finished loading."
}));
}
}, [
data,
formatMessage,
notifyStatus
]);
React.useEffect(() => {
if (error) {
toggleNotification({
type: "danger",
message: formatMessage({
id: "notification.error"
})
});
}
}, [
error,
formatMessage,
toggleNotification
]);
return {
data,
error,
isLoading
};
};
// node_modules/@strapi/upload/dist/admin/hooks/useFolders.mjs
var React2 = __toESM(require_react(), 1);
var import_qs = __toESM(require_lib(), 1);
var useFolders = ({ enabled = true, query = {} } = {}) => {
var _a3;
const { formatMessage } = useIntl();
const { toggleNotification } = useNotification();
const { notifyStatus } = useNotifyAT();
const { folder, _q, ...paramsExceptFolderAndQ } = query;
const { get } = useFetchClient();
let params;
if (_q) {
params = {
...paramsExceptFolderAndQ,
pagination: {
pageSize: -1
},
_q
};
} else {
params = {
...paramsExceptFolderAndQ,
pagination: {
pageSize: -1
},
filters: {
$and: [
...((_a3 = paramsExceptFolderAndQ == null ? void 0 : paramsExceptFolderAndQ.filters) == null ? void 0 : _a3.$and) ?? [],
{
parent: {
id: folder ?? {
$null: true
}
}
}
]
}
};
}
const { data, error, isLoading } = useQuery([
pluginId,
"folders",
(0, import_qs.stringify)(params)
], async () => {
const { data: { data: data2 } } = await get("/upload/folders", {
params
});
return data2;
}, {
enabled,
staleTime: 0,
cacheTime: 0,
onError() {
toggleNotification({
type: "danger",
message: formatMessage({
id: "notification.error"
})
});
}
});
React2.useEffect(() => {
if (data) {
notifyStatus(formatMessage({
id: "list.asset.at.finished",
defaultMessage: "The folders have finished loading."
}));
}
}, [
data,
formatMessage,
notifyStatus
]);
return {
data,
error,
isLoading
};
};
// node_modules/@strapi/upload/dist/admin/hooks/useMediaLibraryPermissions.mjs
var { main: _main, ...restPermissions } = PERMISSIONS;
var useMediaLibraryPermissions = () => {
const { allowedActions, isLoading } = useRBAC(restPermissions);
return {
...allowedActions,
isLoading
};
};
// node_modules/@strapi/upload/dist/admin/hooks/useSelectionState.mjs
var React3 = __toESM(require_react(), 1);
var useSelectionState = (keys, initialValue) => {
const [selections, setSelections] = React3.useState(initialValue);
const selectOne = (selection) => {
const index2 = selections.findIndex((currentSelection) => keys.every((key) => currentSelection[key] === selection[key]));
if (index2 > -1) {
setSelections((prevSelected) => [
...prevSelected.slice(0, index2),
...prevSelected.slice(index2 + 1)
]);
} else {
setSelections((prevSelected) => [
...prevSelected,
selection
]);
}
};
const selectAll = (nextSelections) => {
if (selections.length > 0) {
setSelections([]);
} else {
setSelections(nextSelections);
}
};
const selectOnly = (nextSelection) => {
const index2 = selections.findIndex((currentSelection) => keys.every((key) => currentSelection[key] === nextSelection[key]));
if (index2 > -1) {
setSelections([]);
} else {
setSelections([
nextSelection
]);
}
};
const selectMultiple = (nextSelections) => {
setSelections((currSelections) => [
// already selected items
...currSelections,
// filter out already selected items from nextSelections
...nextSelections.filter((nextSelection) => currSelections.findIndex((currentSelection) => keys.every((key) => currentSelection[key] === nextSelection[key])) === -1)
]);
};
const deselectMultiple = (nextSelections) => {
setSelections((currSelections) => [
// filter out items in currSelections that are in nextSelections
...currSelections.filter((currentSelection) => nextSelections.findIndex((nextSelection) => keys.every((key) => currentSelection[key] === nextSelection[key])) === -1)
]);
};
return [
selections,
{
selectOne,
selectAll,
selectOnly,
selectMultiple,
deselectMultiple,
setSelections
}
];
};
// node_modules/@strapi/upload/dist/admin/utils/containsAssetFilter.mjs
var containsMimeTypeFilter = (query) => {
var _a3;
const filters = (_a3 = query == null ? void 0 : query.filters) == null ? void 0 : _a3.$and;
if (!filters) {
return false;
}
const result = filters.find((filter) => {
return Object.keys(filter).includes("mime");
});
return !!result;
};
var containsAssetFilter = (query) => {
return containsMimeTypeFilter(query);
};
// node_modules/@strapi/upload/dist/admin/components/EditAssetDialog/EditAssetContent.mjs
var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
var React16 = __toESM(require_react(), 1);
var import_isEqual = __toESM(require_isEqual(), 1);
// node_modules/@strapi/upload/dist/admin/hooks/useEditAsset.mjs
var React4 = __toESM(require_react(), 1);
var import_qs2 = __toESM(require_lib(), 1);
var editAssetRequest = (asset, file, signal, onProgress, post) => {
const endpoint2 = `/${pluginId}?id=${asset.id}`;
const formData = new FormData();
if (file) {
formData.append("files", file);
}
formData.append("fileInfo", JSON.stringify({
alternativeText: asset.alternativeText,
caption: asset.caption,
folder: asset.folder,
name: asset.name
}));
return post(endpoint2, formData, {
signal
}).then((res) => res.data);
};
var useEditAsset = () => {
const [progress, setProgress] = React4.useState(0);
const { formatMessage } = useIntl();
const { toggleNotification } = useNotification();
const queryClient = useQueryClient();
const abortController = new AbortController();
const signal = abortController.signal;
const { post } = useFetchClient();
const mutation = useMutation(({ asset, file }) => editAssetRequest(asset, file, signal, setProgress, post), {
onSuccess() {
queryClient.refetchQueries([
pluginId,
"assets"
], {
active: true
});
queryClient.refetchQueries([
pluginId,
"asset-count"
], {
active: true
});
queryClient.refetchQueries([
pluginId,
"folders"
], {
active: true
});
},
onError(reason) {
var _a3;
if (((_a3 = reason == null ? void 0 : reason.response) == null ? void 0 : _a3.status) === 403) {
toggleNotification({
type: "info",
message: formatMessage({
id: getTrad("permissions.not-allowed.update")
})
});
} else {
toggleNotification({
type: "danger",
message: reason == null ? void 0 : reason.message
});
}
}
});
const editAsset = (asset, file) => mutation.mutateAsync({
asset,
file
});
const cancel = () => abortController.abort();
return {
...mutation,
cancel,
editAsset,
progress,
status: mutation.status
};
};
// node_modules/@strapi/upload/dist/admin/hooks/useFolderStructure.mjs
var import_qs3 = __toESM(require_lib(), 1);
// node_modules/@strapi/upload/dist/admin/hooks/utils/renameKeys.mjs
var recursiveRenameKeys = (obj, fn) => Object.fromEntries(Object.entries(obj).map(([key, value]) => {
const getValue = (v2) => typeof v2 === "object" && v2 !== null ? recursiveRenameKeys(v2, fn) : v2;
return [
fn(key),
Array.isArray(value) ? value.map((val) => getValue(val)) : getValue(value)
];
}));
// node_modules/@strapi/upload/dist/admin/hooks/useFolderStructure.mjs
var FIELD_MAPPING = {
name: "label",
id: "value"
};
var useFolderStructure = ({ enabled = true } = {}) => {
const { formatMessage } = useIntl();
const { get } = useFetchClient();
const fetchFolderStructure = async () => {
const { data: { data: data2 } } = await get("/upload/folder-structure");
const children = data2.map((f) => recursiveRenameKeys(f, (key) => (FIELD_MAPPING == null ? void 0 : FIELD_MAPPING[key]) ?? key));
return [
{
value: null,
label: formatMessage({
id: getTrad("form.input.label.folder-location-default-label"),
defaultMessage: "Media Library"
}),
children
}
];
};
const { data, error, isLoading } = useQuery([
pluginId,
"folder",
"structure"
], fetchFolderStructure, {
enabled,
staleTime: 0,
cacheTime: 0
});
return {
data,
error,
isLoading
};
};
// node_modules/@strapi/upload/dist/admin/utils/findRecursiveFolderByValue.mjs
function findRecursiveFolderByValue(data, value) {
let result;
function iter(a2) {
if (a2.value === value) {
result = a2;
return true;
}
return Array.isArray(a2.children) && a2.children.some(iter);
}
data.some(iter);
return result;
}
// node_modules/@strapi/upload/dist/admin/utils/formatBytes.mjs
function formatBytes(receivedBytes, decimals = 0) {
const realBytes = typeof receivedBytes === "string" ? Number(receivedBytes) : receivedBytes;
const { value, unit } = byte_size_default(realBytes * 1e3, {
precision: decimals
});
if (!unit) {
return "0B";
}
return `${value}${unit.toUpperCase()}`;
}
// node_modules/@strapi/upload/dist/admin/components/EditAssetDialog/EditAssetContent.mjs
var import_qs8 = __toESM(require_lib(), 1);
// node_modules/@strapi/upload/dist/admin/utils/getFileExtension.mjs
var getFileExtension = (ext) => ext && ext[0] === "." ? ext.substring(1) : ext;
// node_modules/@strapi/upload/dist/admin/components/ContextInfo/ContextInfo.mjs
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
var ContextInfo = ({ blocks }) => {
return (0, import_jsx_runtime.jsx)(Box, {
hasRadius: true,
paddingLeft: 6,
paddingRight: 6,
paddingTop: 4,
paddingBottom: 4,
background: "neutral100",
children: (0, import_jsx_runtime.jsx)(Grid.Root, {
gap: 4,
children: blocks.map(({ label, value }) => (0, import_jsx_runtime.jsx)(Grid.Item, {
col: 6,
xs: 12,
direction: "column",
alignItems: "stretch",
children: (0, import_jsx_runtime.jsxs)(Flex, {
direction: "column",
alignItems: "stretch",
gap: 1,
children: [
(0, import_jsx_runtime.jsx)(Typography, {
variant: "sigma",
textColor: "neutral600",
children: label
}),
(0, import_jsx_runtime.jsx)(Typography, {
variant: "pi",
textColor: "neutral700",
children: value
})
]
})
}, label))
})
});
};
// node_modules/@strapi/upload/dist/admin/components/SelectTree/SelectTree.mjs
var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
var React10 = __toESM(require_react(), 1);
// node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
function _arrayWithHoles(r9) {
if (Array.isArray(r9)) return r9;
}
// node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
function _iterableToArrayLimit(r9, l2) {
var t2 = null == r9 ? null : "undefined" != typeof Symbol && r9[Symbol.iterator] || r9["@@iterator"];
if (null != t2) {
var e, n2, i3, u3, a2 = [], f = true, o2 = false;
try {
if (i3 = (t2 = t2.call(r9)).next, 0 === l2) {
if (Object(t2) !== t2) return;
f = false;
} else for (; !(f = (e = i3.call(t2)).done) && (a2.push(e.value), a2.length !== l2); f = true) ;
} catch (r10) {
o2 = true, n2 = r10;
} finally {
try {
if (!f && null != t2["return"] && (u3 = t2["return"](), Object(u3) !== u3)) return;
} finally {
if (o2) throw n2;
}
}
return a2;
}
}
// 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.");
}
// node_modules/@babel/runtime/helpers/esm/slicedToArray.js
function _slicedToArray(r9, e) {
return _arrayWithHoles(r9) || _iterableToArrayLimit(r9, e) || _unsupportedIterableToArray(r9, e) || _nonIterableRest();
}
// node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
function _objectWithoutProperties(e, t2) {
if (null == e) return {};
var o2, r9, i3 = _objectWithoutPropertiesLoose(e, t2);
if (Object.getOwnPropertySymbols) {
var n2 = Object.getOwnPropertySymbols(e);
for (r9 = 0; r9 < n2.length; r9++) o2 = n2[r9], -1 === t2.indexOf(o2) && {}.propertyIsEnumerable.call(e, o2) && (i3[o2] = e[o2]);
}
return i3;
}
// node_modules/react-select/dist/useStateManager-7e1e8489.esm.js
var import_react = __toESM(require_react());
var _excluded = ["defaultInputValue", "defaultMenuIsOpen", "defaultValue", "inputValue", "menuIsOpen", "onChange", "onInputChange", "onMenuClose", "onMenuOpen", "value"];
function useStateManager(_ref3) {
var _ref$defaultInputValu = _ref3.defaultInputValue, defaultInputValue = _ref$defaultInputValu === void 0 ? "" : _ref$defaultInputValu, _ref$defaultMenuIsOpe = _ref3.defaultMenuIsOpen, defaultMenuIsOpen = _ref$defaultMenuIsOpe === void 0 ? false : _ref$defaultMenuIsOpe, _ref$defaultValue = _ref3.defaultValue, defaultValue = _ref$defaultValue === void 0 ? null : _ref$defaultValue, propsInputValue = _ref3.inputValue, propsMenuIsOpen = _ref3.menuIsOpen, propsOnChange = _ref3.onChange, propsOnInputChange = _ref3.onInputChange, propsOnMenuClose = _ref3.onMenuClose, propsOnMenuOpen = _ref3.onMenuOpen, propsValue = _ref3.value, restSelectProps = _objectWithoutProperties(_ref3, _excluded);
var _useState = (0, import_react.useState)(propsInputValue !== void 0 ? propsInputValue : defaultInputValue), _useState2 = _slicedToArray(_useState, 2), stateInputValue = _useState2[0], setStateInputValue = _useState2[1];
var _useState3 = (0, import_react.useState)(propsMenuIsOpen !== void 0 ? propsMenuIsOpen : defaultMenuIsOpen), _useState4 = _slicedToArray(_useState3, 2), stateMenuIsOpen = _useState4[0], setStateMenuIsOpen = _useState4[1];
var _useState5 = (0, import_react.useState)(propsValue !== void 0 ? propsValue : defaultValue), _useState6 = _slicedToArray(_useState5, 2), stateValue = _useState6[0], setStateValue = _useState6[1];
var onChange2 = (0, import_react.useCallback)(function(value2, actionMeta) {
if (typeof propsOnChange === "function") {
propsOnChange(value2, actionMeta);
}
setStateValue(value2);
}, [propsOnChange]);
var onInputChange = (0, import_react.useCallback)(function(value2, actionMeta) {
var newValue;
if (typeof propsOnInputChange === "function") {
newValue = propsOnInputChange(value2, actionMeta);
}
setStateInputValue(newValue !== void 0 ? newValue : value2);
}, [propsOnInputChange]);
var onMenuOpen = (0, import_react.useCallback)(function() {
if (typeof propsOnMenuOpen === "function") {
propsOnMenuOpen();
}
setStateMenuIsOpen(true);
}, [propsOnMenuOpen]);
var onMenuClose = (0, import_react.useCallback)(function() {
if (typeof propsOnMenuClose === "function") {
propsOnMenuClose();
}
setStateMenuIsOpen(false);
}, [propsOnMenuClose]);
var inputValue = propsInputValue !== void 0 ? propsInputValue : stateInputValue;
var menuIsOpen = propsMenuIsOpen !== void 0 ? propsMenuIsOpen : stateMenuIsOpen;
var value = propsValue !== void 0 ? propsValue : stateValue;
return _objectSpread2(_objectSpread2({}, restSelectProps), {}, {
inputValue,
menuIsOpen,
onChange: onChange2,
onInputChange,
onMenuClose,
onMenuOpen,
value
});
}
// node_modules/react-select/dist/react-select.esm.js
var React9 = __toESM(require_react());
var import_react8 = __toESM(require_react());
// node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
function _arrayWithoutHoles(r9) {
if (Array.isArray(r9)) return _arrayLikeToArray(r9);
}
// node_modules/@babel/runtime/helpers/esm/iterableToArray.js
function _iterableToArray(r9) {
if ("undefined" != typeof Symbol && null != r9[Symbol.iterator] || null != r9["@@iterator"]) return Array.from(r9);
}
// node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
// node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
function _toConsumableArray(r9) {
return _arrayWithoutHoles(r9) || _iterableToArray(r9) || _unsupportedIterableToArray(r9) || _nonIterableSpread();
}
// node_modules/react-select/dist/Select-49a62830.esm.js
var React8 = __toESM(require_react());
var import_react6 = __toESM(require_react());
// node_modules/@emotion/react/dist/emotion-element-489459f2.browser.development.esm.js
var React6 = __toESM(require_react());
var import_react2 = __toESM(require_react());
// node_modules/@emotion/sheet/dist/emotion-sheet.development.esm.js
var isDevelopment = true;
function sheetForTag(tag) {
if (tag.sheet) {
return tag.sheet;
}
for (var i3 = 0; i3 < document.styleSheets.length; i3++) {
if (document.styleSheets[i3].ownerNode === tag) {
return document.styleSheets[i3];
}
}
return void 0;
}
function createStyleElement(options2) {
var tag = document.createElement("style");
tag.setAttribute("data-emotion", options2.key);
if (options2.nonce !== void 0) {
tag.setAttribute("nonce", options2.nonce);
}
tag.appendChild(document.createTextNode(""));
tag.setAttribute("data-s", "");
return tag;
}
var StyleSheet = function() {
function StyleSheet2(options2) {
var _this = this;
this._insertTag = function(tag) {
var before;
if (_this.tags.length === 0) {
if (_this.insertionPoint) {
before = _this.insertionPoint.nextSibling;
} else if (_this.prepend) {
before = _this.container.firstChild;
} else {
before = _this.before;
}
} else {
before = _this.tags[_this.tags.length - 1].nextSibling;
}
_this.container.insertBefore(tag, before);
_this.tags.push(tag);
};
this.isSpeedy = options2.speedy === void 0 ? !isDevelopment : options2.speedy;
this.tags = [];
this.ctr = 0;
this.nonce = options2.nonce;
this.key = options2.key;
this.container = options2.container;
this.prepend = options2.prepend;
this.insertionPoint = options2.insertionPoint;
this.before = null;
}
var _proto = StyleSheet2.prototype;
_proto.hydrate = function hydrate(nodes) {
nodes.forEach(this._insertTag);
};
_proto.insert = function insert(rule) {
if (this.ctr % (this.isSpeedy ? 65e3 : 1) === 0) {
this._insertTag(createStyleElement(this));
}
var tag = this.tags[this.tags.length - 1];
{
var isImportRule3 = rule.charCodeAt(0) === 64 && rule.charCodeAt(1) === 105;
if (isImportRule3 && this._alreadyInsertedOrderInsensitiveRule) {
console.error("You're attempting to insert the following rule:\n" + rule + "\n\n`@import` rules must be before all other types of rules in a stylesheet but other rules have already been inserted. Please ensure that `@import` rules are before all other rules.");
}
this._alreadyInsertedOrderInsensitiveRule = this._alreadyInsertedOrderInsensitiveRule || !isImportRule3;
}
if (this.isSpeedy) {
var sheet = sheetForTag(tag);
try {
sheet.insertRule(rule, sheet.cssRules.length);
} catch (e) {
if (!/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear|-ms-expand|-ms-reveal){/.test(rule)) {
console.error('There was a problem inserting the following rule: "' + rule + '"', e);
}
}
} else {
tag.appendChild(document.createTextNode(rule));
}
this.ctr++;
};
_proto.flush = function flush() {
this.tags.forEach(function(tag) {
var _tag$parentNode;
return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag);
});
this.tags = [];
this.ctr = 0;
{
this._alreadyInsertedOrderInsensitiveRule = false;
}
};
return StyleSheet2;
}();
// node_modules/stylis/src/Enum.js
var MS = "-ms-";
var MOZ = "-moz-";
var WEBKIT = "-webkit-";
var COMMENT = "comm";
var RULESET = "rule";
var DECLARATION = "decl";
var IMPORT = "@import";
var KEYFRAMES = "@keyframes";
var LAYER = "@layer";
// node_modules/stylis/src/Utility.js
var abs = Math.abs;
var from = String.fromCharCode;
var assign = Object.assign;
function hash(value, length2) {
return charat(value, 0) ^ 45 ? (((length2 << 2 ^ charat(value, 0)) << 2 ^ charat(value, 1)) << 2 ^ charat(value, 2)) << 2 ^ charat(value, 3) : 0;
}
function trim(value) {
return value.trim();
}
function match(value, pattern) {
return (value = pattern.exec(value)) ? value[0] : value;
}
function replace(value, pattern, replacement) {
return value.replace(pattern, replacement);
}
function indexof(value, search) {
return value.indexOf(search);
}
function charat(value, index2) {
return value.charCodeAt(index2) | 0;
}
function substr(value, begin, end) {
return value.slice(begin, end);
}
function strlen(value) {
return value.length;
}
function sizeof(value) {
return value.length;
}
function append(value, array) {
return array.push(value), value;
}
function combine(array, callback) {
return array.map(callback).join("");
}
// node_modules/stylis/src/Tokenizer.js
var line = 1;
var column = 1;
var length = 0;
var position = 0;
var character = 0;
var characters = "";
function node(value, root, parent, type, props, children, length2) {
return { value, root, parent, type, props, children, line, column, length: length2, return: "" };
}
function copy(root, props) {
return assign(node("", null, null, "", null, null, 0), root, { length: -root.length }, props);
}
function char() {
return character;
}
function prev() {
character = position > 0 ? charat(characters, --position) : 0;
if (column--, character === 10)
column = 1, line--;
return character;
}
function next() {
character = position < length ? charat(characters, position++) : 0;
if (column++, character === 10)
column = 1, line++;
return character;
}
function peek() {
return charat(characters, position);
}
function caret() {
return position;
}
function slice(begin, end) {
return substr(characters, begin, end);
}
function token(type) {
switch (type) {
case 0:
case 9:
case 10:
case 13:
case 32:
return 5;
case 33:
case 43:
case 44:
case 47:
case 62:
case 64:
case 126:
case 59:
case 123:
case 125:
return 4;
case 58:
return 3;
case 34:
case 39:
case 40:
case 91:
return 2;
case 41:
case 93:
return 1;
}
return 0;
}
function alloc(value) {
return line = column = 1, length = strlen(characters = value), position = 0, [];
}
function dealloc(value) {
return characters = "", value;
}
function delimit(type) {
return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)));
}
function whitespace(type) {
while (character = peek())
if (character < 33)
next();
else
break;
return token(type) > 2 || token(character) > 3 ? "" : " ";
}
function escaping(index2, count) {
while (--count && next())
if (character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97)
break;
return slice(index2, caret() + (count < 6 && peek() == 32 && next() == 32));
}
function delimiter(type) {
while (next())
switch (character) {
case type:
return position;
case 34:
case 39:
if (type !== 34 && type !== 39)
delimiter(character);
break;
case 40:
if (type === 41)
delimiter(type);
break;
case 92:
next();
break;
}
return position;
}
function commenter(type, index2) {
while (next())
if (type + character === 47 + 10)
break;
else if (type + character === 42 + 42 && peek() === 47)
break;
return "/*" + slice(index2, position - 1) + "*" + from(type === 47 ? type : next());
}
function identifier(index2) {
while (!token(peek()))
next();
return slice(index2, position);
}
// node_modules/stylis/src/Parser.js
function compile(value) {
return dealloc(parse("", null, null, null, [""], value = alloc(value), 0, [0], value));
}
function parse(value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
var index2 = 0;
var offset = 0;
var length2 = pseudo;
var atrule = 0;
var property = 0;
var previous = 0;
var variable = 1;
var scanning = 1;
var ampersand = 1;
var character2 = 0;
var type = "";
var props = rules;
var children = rulesets;
var reference = rule;
var characters2 = type;
while (scanning)
switch (previous = character2, character2 = next()) {
case 40:
if (previous != 108 && charat(characters2, length2 - 1) == 58) {
if (indexof(characters2 += replace(delimit(character2), "&", "&\f"), "&\f") != -1)
ampersand = -1;
break;
}
case 34:
case 39:
case 91:
characters2 += delimit(character2);
break;
case 9:
case 10:
case 13:
case 32:
characters2 += whitespace(previous);
break;
case 92:
characters2 += escaping(caret() - 1, 7);
continue;
case 47:
switch (peek()) {
case 42:
case 47:
append(comment(commenter(next(), caret()), root, parent), declarations);
break;
default:
characters2 += "/";
}
break;
case 123 * variable:
points[index2++] = strlen(characters2) * ampersand;
case 125 * variable:
case 59:
case 0:
switch (character2) {
case 0:
case 125:
scanning = 0;
case 59 + offset:
if (ampersand == -1) characters2 = replace(characters2, /\f/g, "");
if (property > 0 && strlen(characters2) - length2)
append(property > 32 ? declaration(characters2 + ";", rule, parent, length2 - 1) : declaration(replace(characters2, " ", "") + ";", rule, parent, length2 - 2), declarations);
break;
case 59:
characters2 += ";";
default:
append(reference = ruleset(characters2, root, parent, index2, offset, rules, points, type, props = [], children = [], length2), rulesets);
if (character2 === 123)
if (offset === 0)
parse(characters2, root, reference, reference, props, rulesets, length2, points, children);
else
switch (atrule === 99 && charat(characters2, 3) === 110 ? 100 : atrule) {
case 100:
case 108:
case 109:
case 115:
parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length2), children), rules, children, length2, points, rule ? props : children);
break;
default:
parse(characters2, reference, reference, reference, [""], children, 0, points, children);
}
}
index2 = offset = property = 0, variable = ampersand = 1, type = characters2 = "", length2 = pseudo;
break;
case 58:
length2 = 1 + strlen(characters2), property = previous;
default:
if (variable < 1) {
if (character2 == 123)
--variable;
else if (character2 == 125 && variable++ == 0 && prev() == 125)
continue;
}
switch (characters2 += from(character2), character2 * variable) {
case 38:
ampersand = offset > 0 ? 1 : (characters2 += "\f", -1);
break;
case 44:
points[index2++] = (strlen(characters2) - 1) * ampersand, ampersand = 1;
break;
case 64:
if (peek() === 45)
characters2 += delimit(next());
atrule = peek(), offset = length2 = strlen(type = characters2 += identifier(caret())), character2++;
break;
case 45:
if (previous === 45 && strlen(characters2) == 2)
variable = 0;
}
}
return rulesets;
}
function ruleset(value, root, parent, index2, offset, rules, points, type, props, children, length2) {
var post = offset - 1;
var rule = offset === 0 ? rules : [""];
var size = sizeof(rule);
for (var i3 = 0, j3 = 0, k3 = 0; i3 < index2; ++i3)
for (var x2 = 0, y4 = substr(value, post + 1, post = abs(j3 = points[i3])), z3 = value; x2 < size; ++x2)
if (z3 = trim(j3 > 0 ? rule[x2] + " " + y4 : replace(y4, /&\f/g, rule[x2])))
props[k3++] = z3;
return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length2);
}
function comment(value, root, parent) {
return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0);
}
function declaration(value, root, parent, length2) {
return node(value, root, parent, DECLARATION, substr(value, 0, length2), substr(value, length2 + 1, -1), length2);
}
// node_modules/stylis/src/Serializer.js
function serialize(children, callback) {
var output2 = "";
var length2 = sizeof(children);
for (var i3 = 0; i3 < length2; i3++)
output2 += callback(children[i3], i3, children, callback) || "";
return output2;
}
function stringify2(element, index2, children, callback) {
switch (element.type) {
case LAYER:
if (element.children.length) break;
case IMPORT:
case DECLARATION:
return element.return = element.return || element.value;
case COMMENT:
return "";
case KEYFRAMES:
return element.return = element.value + "{" + serialize(element.children, callback) + "}";
case RULESET:
element.value = element.props.join(",");
}
return strlen(children = serialize(element.children, callback)) ? element.return = element.value + "{" + children + "}" : "";
}
// node_modules/stylis/src/Middleware.js
function middleware(collection) {
var length2 = sizeof(collection);
return function(element, index2, children, callback) {
var output2 = "";
for (var i3 = 0; i3 < length2; i3++)
output2 += collection[i3](element, index2, children, callback) || "";
return output2;
};
}
// node_modules/@emotion/weak-memoize/dist/emotion-weak-memoize.esm.js
var weakMemoize = function weakMemoize2(func) {
var cache = /* @__PURE__ */ new WeakMap();
return function(arg) {
if (cache.has(arg)) {
return cache.get(arg);
}
var ret = func(arg);
cache.set(arg, ret);
return ret;
};
};
// node_modules/@emotion/memoize/dist/emotion-memoize.esm.js
function memoize(fn) {
var cache = /* @__PURE__ */ Object.create(null);
return function(arg) {
if (cache[arg] === void 0) cache[arg] = fn(arg);
return cache[arg];
};
}
// node_modules/@emotion/cache/dist/emotion-cache.browser.development.esm.js
var identifierWithPointTracking = function identifierWithPointTracking2(begin, points, index2) {
var previous = 0;
var character2 = 0;
while (true) {
previous = character2;
character2 = peek();
if (previous === 38 && character2 === 12) {
points[index2] = 1;
}
if (token(character2)) {
break;
}
next();
}
return slice(begin, position);
};
var toRules = function toRules2(parsed, points) {
var index2 = -1;
var character2 = 44;
do {
switch (token(character2)) {
case 0:
if (character2 === 38 && peek() === 12) {
points[index2] = 1;
}
parsed[index2] += identifierWithPointTracking(position - 1, points, index2);
break;
case 2:
parsed[index2] += delimit(character2);
break;
case 4:
if (character2 === 44) {
parsed[++index2] = peek() === 58 ? "&\f" : "";
points[index2] = parsed[index2].length;
break;
}
default:
parsed[index2] += from(character2);
}
} while (character2 = next());
return parsed;
};
var getRules = function getRules2(value, points) {
return dealloc(toRules(alloc(value), points));
};
var fixedElements = /* @__PURE__ */ new WeakMap();
var compat = function compat2(element) {
if (element.type !== "rule" || !element.parent || // positive .length indicates that this rule contains pseudo
// negative .length indicates that this rule has been already prefixed
element.length < 1) {
return;
}
var value = element.value;
var parent = element.parent;
var isImplicitRule = element.column === parent.column && element.line === parent.line;
while (parent.type !== "rule") {
parent = parent.parent;
if (!parent) return;
}
if (element.props.length === 1 && value.charCodeAt(0) !== 58 && !fixedElements.get(parent)) {
return;
}
if (isImplicitRule) {
return;
}
fixedElements.set(element, true);
var points = [];
var rules = getRules(value, points);
var parentRules = parent.props;
for (var i3 = 0, k3 = 0; i3 < rules.length; i3++) {
for (var j3 = 0; j3 < parentRules.length; j3++, k3++) {
element.props[k3] = points[i3] ? rules[i3].replace(/&\f/g, parentRules[j3]) : parentRules[j3] + " " + rules[i3];
}
}
};
var removeLabel = function removeLabel2(element) {
if (element.type === "decl") {
var value = element.value;
if (
// charcode for l
value.charCodeAt(0) === 108 && // charcode for b
value.charCodeAt(2) === 98
) {
element["return"] = "";
element.value = "";
}
}
};
var ignoreFlag = "emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason";
var isIgnoringComment = function isIgnoringComment2(element) {
return element.type === "comm" && element.children.indexOf(ignoreFlag) > -1;
};
var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm2(cache) {
return function(element, index2, children) {
if (element.type !== "rule" || cache.compat) return;
var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
if (unsafePseudoClasses) {
var isNested = !!element.parent;
var commentContainer = isNested ? element.parent.children : (
// global rule at the root level
children
);
for (var i3 = commentContainer.length - 1; i3 >= 0; i3--) {
var node2 = commentContainer[i3];
if (node2.line < element.line) {
break;
}
if (node2.column < element.column) {
if (isIgnoringComment(node2)) {
return;
}
break;
}
}
unsafePseudoClasses.forEach(function(unsafePseudoClass) {
console.error('The pseudo class "' + unsafePseudoClass + '" is potentially unsafe when doing server-side rendering. Try changing it to "' + unsafePseudoClass.split("-child")[0] + '-of-type".');
});
}
};
};
var isImportRule = function isImportRule2(element) {
return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
};
var isPrependedWithRegularRules = function isPrependedWithRegularRules2(index2, children) {
for (var i3 = index2 - 1; i3 >= 0; i3--) {
if (!isImportRule(children[i3])) {
return true;
}
}
return false;
};
var nullifyElement = function nullifyElement2(element) {
element.type = "";
element.value = "";
element["return"] = "";
element.children = "";
element.props = "";
};
var incorrectImportAlarm = function incorrectImportAlarm2(element, index2, children) {
if (!isImportRule(element)) {
return;
}
if (element.parent) {
console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles.");
nullifyElement(element);
} else if (isPrependedWithRegularRules(index2, children)) {
console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
nullifyElement(element);
}
};
function prefix2(value, length2) {
switch (hash(value, length2)) {
case 5103:
return WEBKIT + "print-" + value + value;
case 5737:
case 4201:
case 3177:
case 3433:
case 1641:
case 4457:
case 2921:
case 5572:
case 6356:
case 5844:
case 3191:
case 6645:
case 3005:
case 6391:
case 5879:
case 5623:
case 6135:
case 4599:
case 4855:
case 4215:
case 6389:
case 5109:
case 5365:
case 5621:
case 3829:
return WEBKIT + value + value;
case 5349:
case 4246:
case 4810:
case 6968:
case 2756:
return WEBKIT + value + MOZ + value + MS + value + value;
case 6828:
case 4268:
return WEBKIT + value + MS + value + value;
case 6165:
return WEBKIT + value + MS + "flex-" + value + value;
case 5187:
return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + "box-$1$2" + MS + "flex-$1$2") + value;
case 5443:
return WEBKIT + value + MS + "flex-item-" + replace(value, /flex-|-self/, "") + value;
case 4675:
return WEBKIT + value + MS + "flex-line-pack" + replace(value, /align-content|flex-|-self/, "") + value;
case 5548:
return WEBKIT + value + MS + replace(value, "shrink", "negative") + value;
case 5292:
return WEBKIT + value + MS + replace(value, "basis", "preferred-size") + value;
case 6060:
return WEBKIT + "box-" + replace(value, "-grow", "") + WEBKIT + value + MS + replace(value, "grow", "positive") + value;
case 4554:
return WEBKIT + replace(value, /([^-])(transform)/g, "$1" + WEBKIT + "$2") + value;
case 6187:
return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + "$1"), /(image-set)/, WEBKIT + "$1"), value, "") + value;
case 5495:
case 3959:
return replace(value, /(image-set\([^]*)/, WEBKIT + "$1$`$1");
case 4968:
return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + "box-pack:$3" + MS + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + WEBKIT + value + value;
case 4095:
case 3583:
case 4068:
case 2532:
return replace(value, /(.+)-inline(.+)/, WEBKIT + "$1$2") + value;
case 8116:
case 7059:
case 5753:
case 5535:
case 5445:
case 5701:
case 4933:
case 4677:
case 5533:
case 5789:
case 5021:
case 4765:
if (strlen(value) - 1 - length2 > 6) switch (charat(value, length2 + 1)) {
case 109:
if (charat(value, length2 + 4) !== 45) break;
case 102:
return replace(value, /(.+:)(.+)-([^]+)/, "$1" + WEBKIT + "$2-$3$1" + MOZ + (charat(value, length2 + 3) == 108 ? "$3" : "$2-$3")) + value;
case 115:
return ~indexof(value, "stretch") ? prefix2(replace(value, "stretch", "fill-available"), length2) + value : value;
}
break;
case 4949:
if (charat(value, length2 + 1) !== 115) break;
case 6444:
switch (charat(value, strlen(value) - 3 - (~indexof(value, "!important") && 10))) {
case 107:
return replace(value, ":", ":" + WEBKIT) + value;
case 101:
return replace(value, /(.+:)([^;!]+)(;|!.+)?/, "$1" + WEBKIT + (charat(value, 14) === 45 ? "inline-" : "") + "box$3$1" + WEBKIT + "$2$3$1" + MS + "$2box$3") + value;
}
break;
case 5936:
switch (charat(value, length2 + 11)) {
case 114:
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "tb") + value;
case 108:
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "tb-rl") + value;
case 45:
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "lr") + value;
}
return WEBKIT + value + MS + value + value;
}
return value;
}
var prefixer = function prefixer2(element, index2, children, callback) {
if (element.length > -1) {
if (!element["return"]) switch (element.type) {
case DECLARATION:
element["return"] = prefix2(element.value, element.length);
break;
case KEYFRAMES:
return serialize([copy(element, {
value: replace(element.value, "@", "@" + WEBKIT)
})], callback);
case RULESET:
if (element.length) return combine(element.props, function(value) {
switch (match(value, /(::plac\w+|:read-\w+)/)) {
case ":read-only":
case ":read-write":
return serialize([copy(element, {
props: [replace(value, /:(read-\w+)/, ":" + MOZ + "$1")]
})], callback);
case "::placeholder":
return serialize([copy(element, {
props: [replace(value, /:(plac\w+)/, ":" + WEBKIT + "input-$1")]
}), copy(element, {
props: [replace(value, /:(plac\w+)/, ":" + MOZ + "$1")]
}), copy(element, {
props: [replace(value, /:(plac\w+)/, MS + "input-$1")]
})], callback);
}
return "";
});
}
}
};
var defaultStylisPlugins = [prefixer];
var getSourceMap;
{
sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;
getSourceMap = function getSourceMap2(styles) {
var matches = styles.match(sourceMapPattern);
if (!matches) return;
return matches[matches.length - 1];
};
}
var sourceMapPattern;
var createCache = function createCache2(options2) {
var key = options2.key;
if (!key) {
throw new Error("You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\nIf multiple caches share the same key they might \"fight\" for each other's style elements.");
}
if (key === "css") {
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])");
Array.prototype.forEach.call(ssrStyles, function(node2) {
var dataEmotionAttribute = node2.getAttribute("data-emotion");
if (dataEmotionAttribute.indexOf(" ") === -1) {
return;
}
document.head.appendChild(node2);
node2.setAttribute("data-s", "");
});
}
var stylisPlugins = options2.stylisPlugins || defaultStylisPlugins;
{
if (/[^a-z-]/.test(key)) {
throw new Error('Emotion key must only contain lower case alphabetical characters and - but "' + key + '" was passed');
}
}
var inserted = {};
var container;
var nodesToHydrate = [];
{
container = options2.container || document.head;
Array.prototype.forEach.call(
// this means we will ignore elements which don't have a space in them which
// means that the style elements we're looking at are only Emotion 11 server-rendered style elements
document.querySelectorAll('style[data-emotion^="' + key + ' "]'),
function(node2) {
var attrib = node2.getAttribute("data-emotion").split(" ");
for (var i3 = 1; i3 < attrib.length; i3++) {
inserted[attrib[i3]] = true;
}
nodesToHydrate.push(node2);
}
);
}
var _insert;
var omnipresentPlugins = [compat, removeLabel];
{
omnipresentPlugins.push(createUnsafeSelectorsAlarm({
get compat() {
return cache.compat;
}
}), incorrectImportAlarm);
}
{
var currentSheet;
var finalizingPlugins = [stringify2, function(element) {
if (!element.root) {
if (element["return"]) {
currentSheet.insert(element["return"]);
} else if (element.value && element.type !== COMMENT) {
currentSheet.insert(element.value + "{}");
}
}
}];
var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
var stylis = function stylis2(styles) {
return serialize(compile(styles), serializer);
};
_insert = function insert(selector, serialized, sheet, shouldCache) {
currentSheet = sheet;
if (getSourceMap) {
var sourceMap = getSourceMap(serialized.styles);
if (sourceMap) {
currentSheet = {
insert: function insert2(rule) {
sheet.insert(rule + sourceMap);
}
};
}
}
stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
if (shouldCache) {
cache.inserted[serialized.name] = true;
}
};
}
var cache = {
key,
sheet: new StyleSheet({
key,
container,
nonce: options2.nonce,
speedy: options2.speedy,
prepend: options2.prepend,
insertionPoint: options2.insertionPoint
}),
nonce: options2.nonce,
inserted,
registered: {},
insert: _insert
};
cache.sheet.hydrate(nodesToHydrate);
return cache;
};
// node_modules/@emotion/react/_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.development.esm.js
var import_hoist_non_react_statics = __toESM(require_hoist_non_react_statics_cjs());
// node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js
var isBrowser = true;
function getRegisteredStyles(registered, registeredStyles, classNames2) {
var rawClassName = "";
classNames2.split(" ").forEach(function(className) {
if (registered[className] !== void 0) {
registeredStyles.push(registered[className] + ";");
} else if (className) {
rawClassName += className + " ";
}
});
return rawClassName;
}
var registerStyles = function registerStyles2(cache, serialized, isStringTag) {
var className = cache.key + "-" + serialized.name;
if (
// we only need to add the styles to the registered cache if the
// class name could be used further down
// the tree but if it's a string tag, we know it won't
// so we don't have to add it to registered cache.
// this improves memory usage since we can avoid storing the whole style string
(isStringTag === false || // we need to always store it if we're in compat mode and
// in node since emotion-server relies on whether a style is in
// the registered cache to know whether a style is global or not
// also, note that this check will be dead code eliminated in the browser
isBrowser === false) && cache.registered[className] === void 0
) {
cache.registered[className] = serialized.styles;
}
};
var insertStyles = function insertStyles2(cache, serialized, isStringTag) {
registerStyles(cache, serialized, isStringTag);
var className = cache.key + "-" + serialized.name;
if (cache.inserted[serialized.name] === void 0) {
var current = serialized;
do {
cache.insert(serialized === current ? "." + className : "", current, cache.sheet, true);
current = current.next;
} while (current !== void 0);
}
};
// node_modules/@emotion/hash/dist/emotion-hash.esm.js
function murmur2(str) {
var h3 = 0;
var k3, i3 = 0, len = str.length;
for (; len >= 4; ++i3, len -= 4) {
k3 = str.charCodeAt(i3) & 255 | (str.charCodeAt(++i3) & 255) << 8 | (str.charCodeAt(++i3) & 255) << 16 | (str.charCodeAt(++i3) & 255) << 24;
k3 = /* Math.imul(k, m): */
(k3 & 65535) * 1540483477 + ((k3 >>> 16) * 59797 << 16);
k3 ^= /* k >>> r: */
k3 >>> 24;
h3 = /* Math.imul(k, m): */
(k3 & 65535) * 1540483477 + ((k3 >>> 16) * 59797 << 16) ^ /* Math.imul(h, m): */
(h3 & 65535) * 1540483477 + ((h3 >>> 16) * 59797 << 16);
}
switch (len) {
case 3:
h3 ^= (str.charCodeAt(i3 + 2) & 255) << 16;
case 2:
h3 ^= (str.charCodeAt(i3 + 1) & 255) << 8;
case 1:
h3 ^= str.charCodeAt(i3) & 255;
h3 = /* Math.imul(h, m): */
(h3 & 65535) * 1540483477 + ((h3 >>> 16) * 59797 << 16);
}
h3 ^= h3 >>> 13;
h3 = /* Math.imul(h, m): */
(h3 & 65535) * 1540483477 + ((h3 >>> 16) * 59797 << 16);
return ((h3 ^ h3 >>> 15) >>> 0).toString(36);
}
// node_modules/@emotion/unitless/dist/emotion-unitless.esm.js
var unitlessKeys = {
animationIterationCount: 1,
aspectRatio: 1,
borderImageOutset: 1,
borderImageSlice: 1,
borderImageWidth: 1,
boxFlex: 1,
boxFlexGroup: 1,
boxOrdinalGroup: 1,
columnCount: 1,
columns: 1,
flex: 1,
flexGrow: 1,
flexPositive: 1,
flexShrink: 1,
flexNegative: 1,
flexOrder: 1,
gridRow: 1,
gridRowEnd: 1,
gridRowSpan: 1,
gridRowStart: 1,
gridColumn: 1,
gridColumnEnd: 1,
gridColumnSpan: 1,
gridColumnStart: 1,
msGridRow: 1,
msGridRowSpan: 1,
msGridColumn: 1,
msGridColumnSpan: 1,
fontWeight: 1,
lineHeight: 1,
opacity: 1,
order: 1,
orphans: 1,
scale: 1,
tabSize: 1,
widows: 1,
zIndex: 1,
zoom: 1,
WebkitLineClamp: 1,
// SVG-related properties
fillOpacity: 1,
floodOpacity: 1,
stopOpacity: 1,
strokeDasharray: 1,
strokeDashoffset: 1,
strokeMiterlimit: 1,
strokeOpacity: 1,
strokeWidth: 1
};
// node_modules/@emotion/serialize/dist/emotion-serialize.development.esm.js
var isDevelopment2 = true;
var ILLEGAL_ESCAPE_SEQUENCE_ERROR = `You have illegal escape sequence in your template literal, most likely inside content's property value.
Because you write your CSS inside a JavaScript string you actually have to do double escaping, so for example "content: '\\00d7';" should become "content: '\\\\00d7';".
You can read more about this here:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences`;
var UNDEFINED_AS_OBJECT_KEY_ERROR = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key).";
var hyphenateRegex = /[A-Z]|^ms/g;
var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
var isCustomProperty = function isCustomProperty2(property) {
return property.charCodeAt(1) === 45;
};
var isProcessableValue = function isProcessableValue2(value) {
return value != null && typeof value !== "boolean";
};
var processStyleName = memoize(function(styleName) {
return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, "-$&").toLowerCase();
});
var processStyleValue = function processStyleValue2(key, value) {
switch (key) {
case "animation":
case "animationName": {
if (typeof value === "string") {
return value.replace(animationRegex, function(match2, p1, p22) {
cursor = {
name: p1,
styles: p22,
next: cursor
};
return p1;
});
}
}
}
if (unitlessKeys[key] !== 1 && !isCustomProperty(key) && typeof value === "number" && value !== 0) {
return value + "px";
}
return value;
};
{
contentValuePattern = /(var|attr|counters?|url|element|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/;
contentValues = ["normal", "none", "initial", "inherit", "unset"];
oldProcessStyleValue = processStyleValue;
msPattern = /^-ms-/;
hyphenPattern = /-(.)/g;
hyphenatedCache = {};
processStyleValue = function processStyleValue3(key, value) {
if (key === "content") {
if (typeof value !== "string" || contentValues.indexOf(value) === -1 && !contentValuePattern.test(value) && (value.charAt(0) !== value.charAt(value.length - 1) || value.charAt(0) !== '"' && value.charAt(0) !== "'")) {
throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`");
}
}
var processed = oldProcessStyleValue(key, value);
if (processed !== "" && !isCustomProperty(key) && key.indexOf("-") !== -1 && hyphenatedCache[key] === void 0) {
hyphenatedCache[key] = true;
console.error("Using kebab-case for css properties in objects is not supported. Did you mean " + key.replace(msPattern, "ms-").replace(hyphenPattern, function(str, _char) {
return _char.toUpperCase();
}) + "?");
}
return processed;
};
}
var contentValuePattern;
var contentValues;
var oldProcessStyleValue;
var msPattern;
var hyphenPattern;
var hyphenatedCache;
var noComponentSelectorMessage = "Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";
function handleInterpolation(mergedProps, registered, interpolation) {
if (interpolation == null) {
return "";
}
var componentSelector = interpolation;
if (componentSelector.__emotion_styles !== void 0) {
if (String(componentSelector) === "NO_COMPONENT_SELECTOR") {
throw new Error(noComponentSelectorMessage);
}
return componentSelector;
}
switch (typeof interpolation) {
case "boolean": {
return "";
}
case "object": {
var keyframes2 = interpolation;
if (keyframes2.anim === 1) {
cursor = {
name: keyframes2.name,
styles: keyframes2.styles,
next: cursor
};
return keyframes2.name;
}
var serializedStyles = interpolation;
if (serializedStyles.styles !== void 0) {
var next2 = serializedStyles.next;
if (next2 !== void 0) {
while (next2 !== void 0) {
cursor = {
name: next2.name,
styles: next2.styles,
next: cursor
};
next2 = next2.next;
}
}
var styles = serializedStyles.styles + ";";
return styles;
}
return createStringFromObject(mergedProps, registered, interpolation);
}
case "function": {
if (mergedProps !== void 0) {
var previousCursor = cursor;
var result = interpolation(mergedProps);
cursor = previousCursor;
return handleInterpolation(mergedProps, registered, result);
} else {
console.error("Functions that are interpolated in css calls will be stringified.\nIf you want to have a css call based on props, create a function that returns a css call like this\nlet dynamicStyle = (props) => css`color: ${props.color}`\nIt can be called directly with props or interpolated in a styled call like this\nlet SomeComponent = styled('div')`${dynamicStyle}`");
}
break;
}
case "string":
{
var matched = [];
var replaced = interpolation.replace(animationRegex, function(_match, _p1, p22) {
var fakeVarName = "animation" + matched.length;
matched.push("const " + fakeVarName + " = keyframes`" + p22.replace(/^@keyframes animation-\w+/, "") + "`");
return "${" + fakeVarName + "}";
});
if (matched.length) {
console.error("`keyframes` output got interpolated into plain string, please wrap it with `css`.\n\nInstead of doing this:\n\n" + [].concat(matched, ["`" + replaced + "`"]).join("\n") + "\n\nYou should wrap it with `css` like this:\n\ncss`" + replaced + "`");
}
}
break;
}
var asString = interpolation;
if (registered == null) {
return asString;
}
var cached = registered[asString];
return cached !== void 0 ? cached : asString;
}
function createStringFromObject(mergedProps, registered, obj) {
var string = "";
if (Array.isArray(obj)) {
for (var i3 = 0; i3 < obj.length; i3++) {
string += handleInterpolation(mergedProps, registered, obj[i3]) + ";";
}
} else {
for (var key in obj) {
var value = obj[key];
if (typeof value !== "object") {
var asString = value;
if (registered != null && registered[asString] !== void 0) {
string += key + "{" + registered[asString] + "}";
} else if (isProcessableValue(asString)) {
string += processStyleName(key) + ":" + processStyleValue(key, asString) + ";";
}
} else {
if (key === "NO_COMPONENT_SELECTOR" && isDevelopment2) {
throw new Error(noComponentSelectorMessage);
}
if (Array.isArray(value) && typeof value[0] === "string" && (registered == null || registered[value[0]] === void 0)) {
for (var _i2 = 0; _i2 < value.length; _i2++) {
if (isProcessableValue(value[_i2])) {
string += processStyleName(key) + ":" + processStyleValue(key, value[_i2]) + ";";
}
}
} else {
var interpolated = handleInterpolation(mergedProps, registered, value);
switch (key) {
case "animation":
case "animationName": {
string += processStyleName(key) + ":" + interpolated + ";";
break;
}
default: {
if (key === "undefined") {
console.error(UNDEFINED_AS_OBJECT_KEY_ERROR);
}
string += key + "{" + interpolated + "}";
}
}
}
}
}
}
return string;
}
var labelPattern = /label:\s*([^\s;{]+)\s*(;|$)/g;
var cursor;
function serializeStyles(args, registered, mergedProps) {
if (args.length === 1 && typeof args[0] === "object" && args[0] !== null && args[0].styles !== void 0) {
return args[0];
}
var stringMode = true;
var styles = "";
cursor = void 0;
var strings = args[0];
if (strings == null || strings.raw === void 0) {
stringMode = false;
styles += handleInterpolation(mergedProps, registered, strings);
} else {
var asTemplateStringsArr = strings;
if (asTemplateStringsArr[0] === void 0) {
console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR);
}
styles += asTemplateStringsArr[0];
}
for (var i3 = 1; i3 < args.length; i3++) {
styles += handleInterpolation(mergedProps, registered, args[i3]);
if (stringMode) {
var templateStringsArr = strings;
if (templateStringsArr[i3] === void 0) {
console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR);
}
styles += templateStringsArr[i3];
}
}
labelPattern.lastIndex = 0;
var identifierName = "";
var match2;
while ((match2 = labelPattern.exec(styles)) !== null) {
identifierName += "-" + match2[1];
}
var name = murmur2(styles) + identifierName;
{
var devStyles = {
name,
styles,
next: cursor,
toString: function toString() {
return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
}
};
return devStyles;
}
}
// node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js
var React5 = __toESM(require_react());
var syncFallback = function syncFallback2(create4) {
return create4();
};
var useInsertionEffect2 = React5["useInsertionEffect"] ? React5["useInsertionEffect"] : false;
var useInsertionEffectAlwaysWithSyncFallback = useInsertionEffect2 || syncFallback;
var useInsertionEffectWithLayoutFallback = useInsertionEffect2 || React5.useLayoutEffect;
// node_modules/@emotion/react/dist/emotion-element-489459f2.browser.development.esm.js
var EmotionCacheContext = React6.createContext(
// we're doing this to avoid preconstruct's dead code elimination in this one case
// because this module is primarily intended for the browser and node
// but it's also required in react native and similar environments sometimes
// and we could have a special build just for that
// but this is much easier and the native packages
// might use a different theme context in the future anyway
typeof HTMLElement !== "undefined" ? createCache({
key: "css"
}) : null
);
{
EmotionCacheContext.displayName = "EmotionCacheContext";
}
var CacheProvider = EmotionCacheContext.Provider;
var withEmotionCache = function withEmotionCache2(func) {
return (0, import_react2.forwardRef)(function(props, ref) {
var cache = (0, import_react2.useContext)(EmotionCacheContext);
return func(props, cache, ref);
});
};
var ThemeContext = React6.createContext({});
{
ThemeContext.displayName = "EmotionThemeContext";
}
var getTheme = function getTheme2(outerTheme, theme) {
if (typeof theme === "function") {
var mergedTheme = theme(outerTheme);
if (mergedTheme == null || typeof mergedTheme !== "object" || Array.isArray(mergedTheme)) {
throw new Error("[ThemeProvider] Please return an object from your theme function, i.e. theme={() => ({})}!");
}
return mergedTheme;
}
if (theme == null || typeof theme !== "object" || Array.isArray(theme)) {
throw new Error("[ThemeProvider] Please make your theme prop a plain object");
}
return _extends({}, outerTheme, theme);
};
var createCacheWithTheme = weakMemoize(function(outerTheme) {
return weakMemoize(function(theme) {
return getTheme(outerTheme, theme);
});
});
var hasOwn = {}.hasOwnProperty;
var getLastPart = function getLastPart2(functionName) {
var parts = functionName.split(".");
return parts[parts.length - 1];
};
var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine2(line2) {
var match2 = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line2);
if (match2) return getLastPart(match2[1]);
match2 = /^([A-Za-z0-9$.]+)@/.exec(line2);
if (match2) return getLastPart(match2[1]);
return void 0;
};
var internalReactFunctionNames = /* @__PURE__ */ new Set(["renderWithHooks", "processChild", "finishClassComponent", "renderToString"]);
var sanitizeIdentifier = function sanitizeIdentifier2(identifier2) {
return identifier2.replace(/\$/g, "-");
};
var getLabelFromStackTrace = function getLabelFromStackTrace2(stackTrace) {
if (!stackTrace) return void 0;
var lines = stackTrace.split("\n");
for (var i3 = 0; i3 < lines.length; i3++) {
var functionName = getFunctionNameFromStackTraceLine(lines[i3]);
if (!functionName) continue;
if (internalReactFunctionNames.has(functionName)) break;
if (/^[A-Z]/.test(functionName)) return sanitizeIdentifier(functionName);
}
return void 0;
};
var typePropName = "__EMOTION_TYPE_PLEASE_DO_NOT_USE__";
var labelPropName = "__EMOTION_LABEL_PLEASE_DO_NOT_USE__";
var createEmotionProps = function createEmotionProps2(type, props) {
if (typeof props.css === "string" && // check if there is a css declaration
props.css.indexOf(":") !== -1) {
throw new Error("Strings are not allowed as css prop values, please wrap it in a css template literal from '@emotion/react' like this: css`" + props.css + "`");
}
var newProps = {};
for (var _key in props) {
if (hasOwn.call(props, _key)) {
newProps[_key] = props[_key];
}
}
newProps[typePropName] = type;
if (typeof globalThis !== "undefined" && !!globalThis.EMOTION_RUNTIME_AUTO_LABEL && !!props.css && (typeof props.css !== "object" || !("name" in props.css) || typeof props.css.name !== "string" || props.css.name.indexOf("-") === -1)) {
var label = getLabelFromStackTrace(new Error().stack);
if (label) newProps[labelPropName] = label;
}
return newProps;
};
var Insertion = function Insertion2(_ref3) {
var cache = _ref3.cache, serialized = _ref3.serialized, isStringTag = _ref3.isStringTag;
registerStyles(cache, serialized, isStringTag);
useInsertionEffectAlwaysWithSyncFallback(function() {
return insertStyles(cache, serialized, isStringTag);
});
return null;
};
var Emotion = withEmotionCache(function(props, cache, ref) {
var cssProp = props.css;
if (typeof cssProp === "string" && cache.registered[cssProp] !== void 0) {
cssProp = cache.registered[cssProp];
}
var WrappedComponent = props[typePropName];
var registeredStyles = [cssProp];
var className = "";
if (typeof props.className === "string") {
className = getRegisteredStyles(cache.registered, registeredStyles, props.className);
} else if (props.className != null) {
className = props.className + " ";
}
var serialized = serializeStyles(registeredStyles, void 0, React6.useContext(ThemeContext));
if (serialized.name.indexOf("-") === -1) {
var labelFromStack = props[labelPropName];
if (labelFromStack) {
serialized = serializeStyles([serialized, "label:" + labelFromStack + ";"]);
}
}
className += cache.key + "-" + serialized.name;
var newProps = {};
for (var _key2 in props) {
if (hasOwn.call(props, _key2) && _key2 !== "css" && _key2 !== typePropName && _key2 !== labelPropName) {
newProps[_key2] = props[_key2];
}
}
newProps.className = className;
if (ref) {
newProps.ref = ref;
}
return React6.createElement(React6.Fragment, null, React6.createElement(Insertion, {
cache,
serialized,
isStringTag: typeof WrappedComponent === "string"
}), React6.createElement(WrappedComponent, newProps));
});
{
Emotion.displayName = "EmotionCssPropInternal";
}
var Emotion$1 = Emotion;
// node_modules/@emotion/react/dist/emotion-react.browser.development.esm.js
var React7 = __toESM(require_react());
var import_hoist_non_react_statics2 = __toESM(require_hoist_non_react_statics_cjs());
var isDevelopment3 = true;
var pkg = {
name: "@emotion/react",
version: "11.14.0",
main: "dist/emotion-react.cjs.js",
module: "dist/emotion-react.esm.js",
types: "dist/emotion-react.cjs.d.ts",
exports: {
".": {
types: {
"import": "./dist/emotion-react.cjs.mjs",
"default": "./dist/emotion-react.cjs.js"
},
development: {
"edge-light": {
module: "./dist/emotion-react.development.edge-light.esm.js",
"import": "./dist/emotion-react.development.edge-light.cjs.mjs",
"default": "./dist/emotion-react.development.edge-light.cjs.js"
},
worker: {
module: "./dist/emotion-react.development.edge-light.esm.js",
"import": "./dist/emotion-react.development.edge-light.cjs.mjs",
"default": "./dist/emotion-react.development.edge-light.cjs.js"
},
workerd: {
module: "./dist/emotion-react.development.edge-light.esm.js",
"import": "./dist/emotion-react.development.edge-light.cjs.mjs",
"default": "./dist/emotion-react.development.edge-light.cjs.js"
},
browser: {
module: "./dist/emotion-react.browser.development.esm.js",
"import": "./dist/emotion-react.browser.development.cjs.mjs",
"default": "./dist/emotion-react.browser.development.cjs.js"
},
module: "./dist/emotion-react.development.esm.js",
"import": "./dist/emotion-react.development.cjs.mjs",
"default": "./dist/emotion-react.development.cjs.js"
},
"edge-light": {
module: "./dist/emotion-react.edge-light.esm.js",
"import": "./dist/emotion-react.edge-light.cjs.mjs",
"default": "./dist/emotion-react.edge-light.cjs.js"
},
worker: {
module: "./dist/emotion-react.edge-light.esm.js",
"import": "./dist/emotion-react.edge-light.cjs.mjs",
"default": "./dist/emotion-react.edge-light.cjs.js"
},
workerd: {
module: "./dist/emotion-react.edge-light.esm.js",
"import": "./dist/emotion-react.edge-light.cjs.mjs",
"default": "./dist/emotion-react.edge-light.cjs.js"
},
browser: {
module: "./dist/emotion-react.browser.esm.js",
"import": "./dist/emotion-react.browser.cjs.mjs",
"default": "./dist/emotion-react.browser.cjs.js"
},
module: "./dist/emotion-react.esm.js",
"import": "./dist/emotion-react.cjs.mjs",
"default": "./dist/emotion-react.cjs.js"
},
"./jsx-runtime": {
types: {
"import": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.mjs",
"default": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.js"
},
development: {
"edge-light": {
module: "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.esm.js",
"import": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.cjs.mjs",
"default": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.cjs.js"
},
worker: {
module: "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.esm.js",
"import": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.cjs.mjs",
"default": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.cjs.js"
},
workerd: {
module: "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.esm.js",
"import": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.cjs.mjs",
"default": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.cjs.js"
},
browser: {
module: "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.development.esm.js",
"import": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.development.cjs.mjs",
"default": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.development.cjs.js"
},
module: "./jsx-runtime/dist/emotion-react-jsx-runtime.development.esm.js",
"import": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.cjs.mjs",
"default": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.cjs.js"
},
"edge-light": {
module: "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.esm.js",
"import": "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.cjs.mjs",
"default": "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.cjs.js"
},
worker: {
module: "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.esm.js",
"import": "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.cjs.mjs",
"default": "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.cjs.js"
},
workerd: {
module: "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.esm.js",
"import": "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.cjs.mjs",
"default": "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.cjs.js"
},
browser: {
module: "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js",
"import": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.cjs.mjs",
"default": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.cjs.js"
},
module: "./jsx-runtime/dist/emotion-react-jsx-runtime.esm.js",
"import": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.mjs",
"default": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.js"
},
"./_isolated-hnrs": {
types: {
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.mjs",
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.js"
},
development: {
"edge-light": {
module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.esm.js",
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.mjs",
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.js"
},
worker: {
module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.esm.js",
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.mjs",
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.js"
},
workerd: {
module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.esm.js",
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.mjs",
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.js"
},
browser: {
module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.development.esm.js",
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.development.cjs.mjs",
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.development.cjs.js"
},
module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.esm.js",
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.cjs.mjs",
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.cjs.js"
},
"edge-light": {
module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.esm.js",
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.mjs",
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.js"
},
worker: {
module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.esm.js",
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.mjs",
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.js"
},
workerd: {
module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.esm.js",
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.mjs",
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.js"
},
browser: {
module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js",
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.cjs.mjs",
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.cjs.js"
},
module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.js",
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.mjs",
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.js"
},
"./jsx-dev-runtime": {
types: {
"import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.mjs",
"default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.js"
},
development: {
"edge-light": {
module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.esm.js",
"import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.cjs.mjs",
"default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.cjs.js"
},
worker: {
module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.esm.js",
"import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.cjs.mjs",
"default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.cjs.js"
},
workerd: {
module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.esm.js",
"import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.cjs.mjs",
"default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.cjs.js"
},
browser: {
module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.development.esm.js",
"import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.development.cjs.mjs",
"default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.development.cjs.js"
},
module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.esm.js",
"import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.cjs.mjs",
"default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.cjs.js"
},
"edge-light": {
module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.esm.js",
"import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.cjs.mjs",
"default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.cjs.js"
},
worker: {
module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.esm.js",
"import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.cjs.mjs",
"default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.cjs.js"
},
workerd: {
module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.esm.js",
"import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.cjs.mjs",
"default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.cjs.js"
},
browser: {
module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.js",
"import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.cjs.mjs",
"default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.cjs.js"
},
module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.esm.js",
"import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.mjs",
"default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.js"
},
"./package.json": "./package.json",
"./types/css-prop": "./types/css-prop.d.ts",
"./macro": {
types: {
"import": "./macro.d.mts",
"default": "./macro.d.ts"
},
"default": "./macro.js"
}
},
imports: {
"#is-development": {
development: "./src/conditions/true.ts",
"default": "./src/conditions/false.ts"
},
"#is-browser": {
"edge-light": "./src/conditions/false.ts",
workerd: "./src/conditions/false.ts",
worker: "./src/conditions/false.ts",
browser: "./src/conditions/true.ts",
"default": "./src/conditions/is-browser.ts"
}
},
files: [
"src",
"dist",
"jsx-runtime",
"jsx-dev-runtime",
"_isolated-hnrs",
"types/css-prop.d.ts",
"macro.*"
],
sideEffects: false,
author: "Emotion Contributors",
license: "MIT",
scripts: {
"test:typescript": "dtslint types"
},
dependencies: {
"@babel/runtime": "^7.18.3",
"@emotion/babel-plugin": "^11.13.5",
"@emotion/cache": "^11.14.0",
"@emotion/serialize": "^1.3.3",
"@emotion/use-insertion-effect-with-fallbacks": "^1.2.0",
"@emotion/utils": "^1.4.2",
"@emotion/weak-memoize": "^0.4.0",
"hoist-non-react-statics": "^3.3.1"
},
peerDependencies: {
react: ">=16.8.0"
},
peerDependenciesMeta: {
"@types/react": {
optional: true
}
},
devDependencies: {
"@definitelytyped/dtslint": "0.0.112",
"@emotion/css": "11.13.5",
"@emotion/css-prettifier": "1.2.0",
"@emotion/server": "11.11.0",
"@emotion/styled": "11.14.0",
"@types/hoist-non-react-statics": "^3.3.5",
"html-tag-names": "^1.1.2",
react: "16.14.0",
"svg-tag-names": "^1.1.1",
typescript: "^5.4.5"
},
repository: "https://github.com/emotion-js/emotion/tree/main/packages/react",
publishConfig: {
access: "public"
},
"umd:main": "dist/emotion-react.umd.min.js",
preconstruct: {
entrypoints: [
"./index.ts",
"./jsx-runtime.ts",
"./jsx-dev-runtime.ts",
"./_isolated-hnrs.ts"
],
umdName: "emotionReact",
exports: {
extra: {
"./types/css-prop": "./types/css-prop.d.ts",
"./macro": {
types: {
"import": "./macro.d.mts",
"default": "./macro.d.ts"
},
"default": "./macro.js"
}
}
}
}
};
var jsx2 = function jsx3(type, props) {
var args = arguments;
if (props == null || !hasOwn.call(props, "css")) {
return React7.createElement.apply(void 0, args);
}
var argsLength = args.length;
var createElementArgArray = new Array(argsLength);
createElementArgArray[0] = Emotion$1;
createElementArgArray[1] = createEmotionProps(type, props);
for (var i3 = 2; i3 < argsLength; i3++) {
createElementArgArray[i3] = args[i3];
}
return React7.createElement.apply(null, createElementArgArray);
};
(function(_jsx) {
var JSX;
/* @__PURE__ */ (function(_JSX) {
})(JSX || (JSX = _jsx.JSX || (_jsx.JSX = {})));
})(jsx2 || (jsx2 = {}));
var warnedAboutCssPropForGlobal = false;
var Global = withEmotionCache(function(props, cache) {
if (!warnedAboutCssPropForGlobal && // check for className as well since the user is
// probably using the custom createElement which
// means it will be turned into a className prop
// I don't really want to add it to the type since it shouldn't be used
("className" in props && props.className || "css" in props && props.css)) {
console.error("It looks like you're using the css prop on Global, did you mean to use the styles prop instead?");
warnedAboutCssPropForGlobal = true;
}
var styles = props.styles;
var serialized = serializeStyles([styles], void 0, React7.useContext(ThemeContext));
var sheetRef = React7.useRef();
useInsertionEffectWithLayoutFallback(function() {
var key = cache.key + "-global";
var sheet = new cache.sheet.constructor({
key,
nonce: cache.sheet.nonce,
container: cache.sheet.container,
speedy: cache.sheet.isSpeedy
});
var rehydrating = false;
var node2 = document.querySelector('style[data-emotion="' + key + " " + serialized.name + '"]');
if (cache.sheet.tags.length) {
sheet.before = cache.sheet.tags[0];
}
if (node2 !== null) {
rehydrating = true;
node2.setAttribute("data-emotion", key);
sheet.hydrate([node2]);
}
sheetRef.current = [sheet, rehydrating];
return function() {
sheet.flush();
};
}, [cache]);
useInsertionEffectWithLayoutFallback(function() {
var sheetRefCurrent = sheetRef.current;
var sheet = sheetRefCurrent[0], rehydrating = sheetRefCurrent[1];
if (rehydrating) {
sheetRefCurrent[1] = false;
return;
}
if (serialized.next !== void 0) {
insertStyles(cache, serialized.next, true);
}
if (sheet.tags.length) {
var element = sheet.tags[sheet.tags.length - 1].nextElementSibling;
sheet.before = element;
sheet.flush();
}
cache.insert("", serialized, sheet, false);
}, [cache, serialized.name]);
return null;
});
{
Global.displayName = "EmotionGlobal";
}
function css() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return serializeStyles(args);
}
function keyframes() {
var insertable = css.apply(void 0, arguments);
var name = "animation-" + insertable.name;
return {
name,
styles: "@keyframes " + name + "{" + insertable.styles + "}",
anim: 1,
toString: function toString() {
return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
}
};
}
var classnames = function classnames2(args) {
var len = args.length;
var i3 = 0;
var cls = "";
for (; i3 < len; i3++) {
var arg = args[i3];
if (arg == null) continue;
var toAdd = void 0;
switch (typeof arg) {
case "boolean":
break;
case "object": {
if (Array.isArray(arg)) {
toAdd = classnames2(arg);
} else {
if (arg.styles !== void 0 && arg.name !== void 0) {
console.error("You have passed styles created with `css` from `@emotion/react` package to the `cx`.\n`cx` is meant to compose class names (strings) so you should convert those styles to a class name by passing them to the `css` received from component.");
}
toAdd = "";
for (var k3 in arg) {
if (arg[k3] && k3) {
toAdd && (toAdd += " ");
toAdd += k3;
}
}
}
break;
}
default: {
toAdd = arg;
}
}
if (toAdd) {
cls && (cls += " ");
cls += toAdd;
}
}
return cls;
};
function merge(registered, css5, className) {
var registeredStyles = [];
var rawClassName = getRegisteredStyles(registered, registeredStyles, className);
if (registeredStyles.length < 2) {
return className;
}
return rawClassName + css5(registeredStyles);
}
var Insertion3 = function Insertion4(_ref3) {
var cache = _ref3.cache, serializedArr = _ref3.serializedArr;
useInsertionEffectAlwaysWithSyncFallback(function() {
for (var i3 = 0; i3 < serializedArr.length; i3++) {
insertStyles(cache, serializedArr[i3], false);
}
});
return null;
};
var ClassNames = withEmotionCache(function(props, cache) {
var hasRendered = false;
var serializedArr = [];
var css5 = function css6() {
if (hasRendered && isDevelopment3) {
throw new Error("css can only be used during render");
}
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var serialized = serializeStyles(args, cache.registered);
serializedArr.push(serialized);
registerStyles(cache, serialized, false);
return cache.key + "-" + serialized.name;
};
var cx = function cx2() {
if (hasRendered && isDevelopment3) {
throw new Error("cx can only be used during render");
}
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return merge(cache.registered, css5, classnames(args));
};
var content = {
css: css5,
cx,
theme: React7.useContext(ThemeContext)
};
var ele = props.children(content);
hasRendered = true;
return React7.createElement(React7.Fragment, null, React7.createElement(Insertion3, {
cache,
serializedArr
}), ele);
});
{
ClassNames.displayName = "EmotionClassNames";
}
{
isBrowser2 = typeof document !== "undefined";
isTestEnv = typeof jest !== "undefined" || typeof vi !== "undefined";
if (isBrowser2 && !isTestEnv) {
globalContext = typeof globalThis !== "undefined" ? globalThis : isBrowser2 ? window : global;
globalKey = "__EMOTION_REACT_" + pkg.version.split(".")[0] + "__";
if (globalContext[globalKey]) {
console.warn("You are loading @emotion/react when it is already loaded. Running multiple instances may cause problems. This can happen if multiple versions are used, or if multiple builds of the same version are used.");
}
globalContext[globalKey] = true;
}
}
var isBrowser2;
var isTestEnv;
var globalContext;
var globalKey;
// node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js
function _taggedTemplateLiteral(e, t2) {
return t2 || (t2 = e.slice(0)), Object.freeze(Object.defineProperties(e, {
raw: {
value: Object.freeze(t2)
}
}));
}
// node_modules/react-select/dist/index-a301f526.esm.js
var import_react5 = __toESM(require_react());
var import_react_dom = __toESM(require_react_dom());
// node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js
var import_react3 = __toESM(require_react());
var index = import_react3.useLayoutEffect;
// node_modules/react-select/dist/index-a301f526.esm.js
var _excluded$4 = ["className", "clearValue", "cx", "getStyles", "getClassNames", "getValue", "hasValue", "isMulti", "isRtl", "options", "selectOption", "selectProps", "setValue", "theme"];
var noop = function noop2() {
};
function applyPrefixToName(prefix3, name) {
if (!name) {
return prefix3;
} else if (name[0] === "-") {
return prefix3 + name;
} else {
return prefix3 + "__" + name;
}
}
function classNames(prefix3, state) {
for (var _len = arguments.length, classNameList = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
classNameList[_key - 2] = arguments[_key];
}
var arr = [].concat(classNameList);
if (state && prefix3) {
for (var key in state) {
if (state.hasOwnProperty(key) && state[key]) {
arr.push("".concat(applyPrefixToName(prefix3, key)));
}
}
}
return arr.filter(function(i3) {
return i3;
}).map(function(i3) {
return String(i3).trim();
}).join(" ");
}
var cleanValue = function cleanValue2(value) {
if (isArray(value)) return value.filter(Boolean);
if (_typeof(value) === "object" && value !== null) return [value];
return [];
};
var cleanCommonProps = function cleanCommonProps2(props) {
props.className;
props.clearValue;
props.cx;
props.getStyles;
props.getClassNames;
props.getValue;
props.hasValue;
props.isMulti;
props.isRtl;
props.options;
props.selectOption;
props.selectProps;
props.setValue;
props.theme;
var innerProps = _objectWithoutProperties(props, _excluded$4);
return _objectSpread2({}, innerProps);
};
var getStyleProps = function getStyleProps2(props, name, classNamesState) {
var cx = props.cx, getStyles = props.getStyles, getClassNames = props.getClassNames, className = props.className;
return {
css: getStyles(name, props),
className: cx(classNamesState !== null && classNamesState !== void 0 ? classNamesState : {}, getClassNames(name, props), className)
};
};
function isDocumentElement(el) {
return [document.documentElement, document.body, window].indexOf(el) > -1;
}
function normalizedHeight(el) {
if (isDocumentElement(el)) {
return window.innerHeight;
}
return el.clientHeight;
}
function getScrollTop(el) {
if (isDocumentElement(el)) {
return window.pageYOffset;
}
return el.scrollTop;
}
function scrollTo(el, top) {
if (isDocumentElement(el)) {
window.scrollTo(0, top);
return;
}
el.scrollTop = top;
}
function getScrollParent(element) {
var style = getComputedStyle(element);
var excludeStaticParent = style.position === "absolute";
var overflowRx = /(auto|scroll)/;
if (style.position === "fixed") return document.documentElement;
for (var parent = element; parent = parent.parentElement; ) {
style = getComputedStyle(parent);
if (excludeStaticParent && style.position === "static") {
continue;
}
if (overflowRx.test(style.overflow + style.overflowY + style.overflowX)) {
return parent;
}
}
return document.documentElement;
}
function easeOutCubic(t2, b2, c3, d2) {
return c3 * ((t2 = t2 / d2 - 1) * t2 * t2 + 1) + b2;
}
function animatedScrollTo(element, to) {
var duration = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 200;
var callback = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : noop;
var start = getScrollTop(element);
var change3 = to - start;
var increment = 10;
var currentTime = 0;
function animateScroll() {
currentTime += increment;
var val = easeOutCubic(currentTime, start, change3, duration);
scrollTo(element, val);
if (currentTime < duration) {
window.requestAnimationFrame(animateScroll);
} else {
callback(element);
}
}
animateScroll();
}
function scrollIntoView(menuEl, focusedEl) {
var menuRect = menuEl.getBoundingClientRect();
var focusedRect = focusedEl.getBoundingClientRect();
var overScroll = focusedEl.offsetHeight / 3;
if (focusedRect.bottom + overScroll > menuRect.bottom) {
scrollTo(menuEl, Math.min(focusedEl.offsetTop + focusedEl.clientHeight - menuEl.offsetHeight + overScroll, menuEl.scrollHeight));
} else if (focusedRect.top - overScroll < menuRect.top) {
scrollTo(menuEl, Math.max(focusedEl.offsetTop - overScroll, 0));
}
}
function getBoundingClientObj(element) {
var rect = element.getBoundingClientRect();
return {
bottom: rect.bottom,
height: rect.height,
left: rect.left,
right: rect.right,
top: rect.top,
width: rect.width
};
}
function isTouchCapable() {
try {
document.createEvent("TouchEvent");
return true;
} catch (e) {
return false;
}
}
function isMobileDevice() {
try {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
} catch (e) {
return false;
}
}
var passiveOptionAccessed = false;
var options = {
get passive() {
return passiveOptionAccessed = true;
}
};
var w = typeof window !== "undefined" ? window : {};
if (w.addEventListener && w.removeEventListener) {
w.addEventListener("p", noop, options);
w.removeEventListener("p", noop, false);
}
var supportsPassiveEvents = passiveOptionAccessed;
function notNullish(item) {
return item != null;
}
function isArray(arg) {
return Array.isArray(arg);
}
function valueTernary(isMulti, multiValue, singleValue) {
return isMulti ? multiValue : singleValue;
}
function singleValueAsValue(singleValue) {
return singleValue;
}
function multiValueAsValue(multiValue) {
return multiValue;
}
var removeProps = function removeProps2(propsObj) {
for (var _len2 = arguments.length, properties = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
properties[_key2 - 1] = arguments[_key2];
}
var propsMap = Object.entries(propsObj).filter(function(_ref3) {
var _ref23 = _slicedToArray(_ref3, 1), key = _ref23[0];
return !properties.includes(key);
});
return propsMap.reduce(function(newProps, _ref3) {
var _ref4 = _slicedToArray(_ref3, 2), key = _ref4[0], val = _ref4[1];
newProps[key] = val;
return newProps;
}, {});
};
var _excluded$3 = ["children", "innerProps"];
var _excluded2$1 = ["children", "innerProps"];
function getMenuPlacement(_ref3) {
var preferredMaxHeight = _ref3.maxHeight, menuEl = _ref3.menuEl, minHeight = _ref3.minHeight, preferredPlacement = _ref3.placement, shouldScroll = _ref3.shouldScroll, isFixedPosition = _ref3.isFixedPosition, controlHeight2 = _ref3.controlHeight;
var scrollParent = getScrollParent(menuEl);
var defaultState = {
placement: "bottom",
maxHeight: preferredMaxHeight
};
if (!menuEl || !menuEl.offsetParent) return defaultState;
var _scrollParent$getBoun = scrollParent.getBoundingClientRect(), scrollHeight = _scrollParent$getBoun.height;
var _menuEl$getBoundingCl = menuEl.getBoundingClientRect(), menuBottom = _menuEl$getBoundingCl.bottom, menuHeight = _menuEl$getBoundingCl.height, menuTop = _menuEl$getBoundingCl.top;
var _menuEl$offsetParent$ = menuEl.offsetParent.getBoundingClientRect(), containerTop = _menuEl$offsetParent$.top;
var viewHeight = isFixedPosition ? window.innerHeight : normalizedHeight(scrollParent);
var scrollTop = getScrollTop(scrollParent);
var marginBottom = parseInt(getComputedStyle(menuEl).marginBottom, 10);
var marginTop = parseInt(getComputedStyle(menuEl).marginTop, 10);
var viewSpaceAbove = containerTop - marginTop;
var viewSpaceBelow = viewHeight - menuTop;
var scrollSpaceAbove = viewSpaceAbove + scrollTop;
var scrollSpaceBelow = scrollHeight - scrollTop - menuTop;
var scrollDown = menuBottom - viewHeight + scrollTop + marginBottom;
var scrollUp = scrollTop + menuTop - marginTop;
var scrollDuration = 160;
switch (preferredPlacement) {
case "auto":
case "bottom":
if (viewSpaceBelow >= menuHeight) {
return {
placement: "bottom",
maxHeight: preferredMaxHeight
};
}
if (scrollSpaceBelow >= menuHeight && !isFixedPosition) {
if (shouldScroll) {
animatedScrollTo(scrollParent, scrollDown, scrollDuration);
}
return {
placement: "bottom",
maxHeight: preferredMaxHeight
};
}
if (!isFixedPosition && scrollSpaceBelow >= minHeight || isFixedPosition && viewSpaceBelow >= minHeight) {
if (shouldScroll) {
animatedScrollTo(scrollParent, scrollDown, scrollDuration);
}
var constrainedHeight = isFixedPosition ? viewSpaceBelow - marginBottom : scrollSpaceBelow - marginBottom;
return {
placement: "bottom",
maxHeight: constrainedHeight
};
}
if (preferredPlacement === "auto" || isFixedPosition) {
var _constrainedHeight = preferredMaxHeight;
var spaceAbove = isFixedPosition ? viewSpaceAbove : scrollSpaceAbove;
if (spaceAbove >= minHeight) {
_constrainedHeight = Math.min(spaceAbove - marginBottom - controlHeight2, preferredMaxHeight);
}
return {
placement: "top",
maxHeight: _constrainedHeight
};
}
if (preferredPlacement === "bottom") {
if (shouldScroll) {
scrollTo(scrollParent, scrollDown);
}
return {
placement: "bottom",
maxHeight: preferredMaxHeight
};
}
break;
case "top":
if (viewSpaceAbove >= menuHeight) {
return {
placement: "top",
maxHeight: preferredMaxHeight
};
}
if (scrollSpaceAbove >= menuHeight && !isFixedPosition) {
if (shouldScroll) {
animatedScrollTo(scrollParent, scrollUp, scrollDuration);
}
return {
placement: "top",
maxHeight: preferredMaxHeight
};
}
if (!isFixedPosition && scrollSpaceAbove >= minHeight || isFixedPosition && viewSpaceAbove >= minHeight) {
var _constrainedHeight2 = preferredMaxHeight;
if (!isFixedPosition && scrollSpaceAbove >= minHeight || isFixedPosition && viewSpaceAbove >= minHeight) {
_constrainedHeight2 = isFixedPosition ? viewSpaceAbove - marginTop : scrollSpaceAbove - marginTop;
}
if (shouldScroll) {
animatedScrollTo(scrollParent, scrollUp, scrollDuration);
}
return {
placement: "top",
maxHeight: _constrainedHeight2
};
}
return {
placement: "bottom",
maxHeight: preferredMaxHeight
};
default:
throw new Error('Invalid placement provided "'.concat(preferredPlacement, '".'));
}
return defaultState;
}
function alignToControl(placement) {
var placementToCSSProp = {
bottom: "top",
top: "bottom"
};
return placement ? placementToCSSProp[placement] : "bottom";
}
var coercePlacement = function coercePlacement2(p3) {
return p3 === "auto" ? "bottom" : p3;
};
var menuCSS = function menuCSS2(_ref23, unstyled) {
var _objectSpread24;
var placement = _ref23.placement, _ref2$theme = _ref23.theme, borderRadius2 = _ref2$theme.borderRadius, spacing2 = _ref2$theme.spacing, colors2 = _ref2$theme.colors;
return _objectSpread2((_objectSpread24 = {
label: "menu"
}, _defineProperty(_objectSpread24, alignToControl(placement), "100%"), _defineProperty(_objectSpread24, "position", "absolute"), _defineProperty(_objectSpread24, "width", "100%"), _defineProperty(_objectSpread24, "zIndex", 1), _objectSpread24), unstyled ? {} : {
backgroundColor: colors2.neutral0,
borderRadius: borderRadius2,
boxShadow: "0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",
marginBottom: spacing2.menuGutter,
marginTop: spacing2.menuGutter
});
};
var PortalPlacementContext = (0, import_react5.createContext)(null);
var MenuPlacer = function MenuPlacer2(props) {
var children = props.children, minMenuHeight = props.minMenuHeight, maxMenuHeight = props.maxMenuHeight, menuPlacement = props.menuPlacement, menuPosition = props.menuPosition, menuShouldScrollIntoView = props.menuShouldScrollIntoView, theme = props.theme;
var _ref3 = (0, import_react5.useContext)(PortalPlacementContext) || {}, setPortalPlacement = _ref3.setPortalPlacement;
var ref = (0, import_react5.useRef)(null);
var _useState = (0, import_react5.useState)(maxMenuHeight), _useState2 = _slicedToArray(_useState, 2), maxHeight = _useState2[0], setMaxHeight = _useState2[1];
var _useState3 = (0, import_react5.useState)(null), _useState4 = _slicedToArray(_useState3, 2), placement = _useState4[0], setPlacement = _useState4[1];
var controlHeight2 = theme.spacing.controlHeight;
index(function() {
var menuEl = ref.current;
if (!menuEl) return;
var isFixedPosition = menuPosition === "fixed";
var shouldScroll = menuShouldScrollIntoView && !isFixedPosition;
var state = getMenuPlacement({
maxHeight: maxMenuHeight,
menuEl,
minHeight: minMenuHeight,
placement: menuPlacement,
shouldScroll,
isFixedPosition,
controlHeight: controlHeight2
});
setMaxHeight(state.maxHeight);
setPlacement(state.placement);
setPortalPlacement === null || setPortalPlacement === void 0 ? void 0 : setPortalPlacement(state.placement);
}, [maxMenuHeight, menuPlacement, menuPosition, menuShouldScrollIntoView, minMenuHeight, setPortalPlacement, controlHeight2]);
return children({
ref,
placerProps: _objectSpread2(_objectSpread2({}, props), {}, {
placement: placement || coercePlacement(menuPlacement),
maxHeight
})
});
};
var Menu2 = function Menu3(props) {
var children = props.children, innerRef = props.innerRef, innerProps = props.innerProps;
return jsx2("div", _extends({}, getStyleProps(props, "menu", {
menu: true
}), {
ref: innerRef
}, innerProps), children);
};
var Menu$1 = Menu2;
var menuListCSS = function menuListCSS2(_ref4, unstyled) {
var maxHeight = _ref4.maxHeight, baseUnit2 = _ref4.theme.spacing.baseUnit;
return _objectSpread2({
maxHeight,
overflowY: "auto",
position: "relative",
// required for offset[Height, Top] > keyboard scroll
WebkitOverflowScrolling: "touch"
}, unstyled ? {} : {
paddingBottom: baseUnit2,
paddingTop: baseUnit2
});
};
var MenuList = function MenuList2(props) {
var children = props.children, innerProps = props.innerProps, innerRef = props.innerRef, isMulti = props.isMulti;
return jsx2("div", _extends({}, getStyleProps(props, "menuList", {
"menu-list": true,
"menu-list--is-multi": isMulti
}), {
ref: innerRef
}, innerProps), children);
};
var noticeCSS = function noticeCSS2(_ref5, unstyled) {
var _ref5$theme = _ref5.theme, baseUnit2 = _ref5$theme.spacing.baseUnit, colors2 = _ref5$theme.colors;
return _objectSpread2({
textAlign: "center"
}, unstyled ? {} : {
color: colors2.neutral40,
padding: "".concat(baseUnit2 * 2, "px ").concat(baseUnit2 * 3, "px")
});
};
var noOptionsMessageCSS = noticeCSS;
var loadingMessageCSS = noticeCSS;
var NoOptionsMessage = function NoOptionsMessage2(_ref6) {
var _ref6$children = _ref6.children, children = _ref6$children === void 0 ? "No options" : _ref6$children, innerProps = _ref6.innerProps, restProps = _objectWithoutProperties(_ref6, _excluded$3);
return jsx2("div", _extends({}, getStyleProps(_objectSpread2(_objectSpread2({}, restProps), {}, {
children,
innerProps
}), "noOptionsMessage", {
"menu-notice": true,
"menu-notice--no-options": true
}), innerProps), children);
};
var LoadingMessage = function LoadingMessage2(_ref7) {
var _ref7$children = _ref7.children, children = _ref7$children === void 0 ? "Loading..." : _ref7$children, innerProps = _ref7.innerProps, restProps = _objectWithoutProperties(_ref7, _excluded2$1);
return jsx2("div", _extends({}, getStyleProps(_objectSpread2(_objectSpread2({}, restProps), {}, {
children,
innerProps
}), "loadingMessage", {
"menu-notice": true,
"menu-notice--loading": true
}), innerProps), children);
};
var menuPortalCSS = function menuPortalCSS2(_ref8) {
var rect = _ref8.rect, offset = _ref8.offset, position2 = _ref8.position;
return {
left: rect.left,
position: position2,
top: offset,
width: rect.width,
zIndex: 1
};
};
var MenuPortal = function MenuPortal2(props) {
var appendTo = props.appendTo, children = props.children, controlElement = props.controlElement, innerProps = props.innerProps, menuPlacement = props.menuPlacement, menuPosition = props.menuPosition;
var menuPortalRef = (0, import_react5.useRef)(null);
var cleanupRef = (0, import_react5.useRef)(null);
var _useState5 = (0, import_react5.useState)(coercePlacement(menuPlacement)), _useState6 = _slicedToArray(_useState5, 2), placement = _useState6[0], setPortalPlacement = _useState6[1];
var portalPlacementContext = (0, import_react5.useMemo)(function() {
return {
setPortalPlacement
};
}, []);
var _useState7 = (0, import_react5.useState)(null), _useState8 = _slicedToArray(_useState7, 2), computedPosition = _useState8[0], setComputedPosition = _useState8[1];
var updateComputedPosition = (0, import_react5.useCallback)(function() {
if (!controlElement) return;
var rect = getBoundingClientObj(controlElement);
var scrollDistance = menuPosition === "fixed" ? 0 : window.pageYOffset;
var offset = rect[placement] + scrollDistance;
if (offset !== (computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.offset) || rect.left !== (computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.left) || rect.width !== (computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.width)) {
setComputedPosition({
offset,
rect
});
}
}, [controlElement, menuPosition, placement, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.offset, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.left, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.width]);
index(function() {
updateComputedPosition();
}, [updateComputedPosition]);
var runAutoUpdate = (0, import_react5.useCallback)(function() {
if (typeof cleanupRef.current === "function") {
cleanupRef.current();
cleanupRef.current = null;
}
if (controlElement && menuPortalRef.current) {
cleanupRef.current = autoUpdate(controlElement, menuPortalRef.current, updateComputedPosition, {
elementResize: "ResizeObserver" in window
});
}
}, [controlElement, updateComputedPosition]);
index(function() {
runAutoUpdate();
}, [runAutoUpdate]);
var setMenuPortalElement = (0, import_react5.useCallback)(function(menuPortalElement) {
menuPortalRef.current = menuPortalElement;
runAutoUpdate();
}, [runAutoUpdate]);
if (!appendTo && menuPosition !== "fixed" || !computedPosition) return null;
var menuWrapper = jsx2("div", _extends({
ref: setMenuPortalElement
}, getStyleProps(_objectSpread2(_objectSpread2({}, props), {}, {
offset: computedPosition.offset,
position: menuPosition,
rect: computedPosition.rect
}), "menuPortal", {
"menu-portal": true
}), innerProps), children);
return jsx2(PortalPlacementContext.Provider, {
value: portalPlacementContext
}, appendTo ? (0, import_react_dom.createPortal)(menuWrapper, appendTo) : menuWrapper);
};
var containerCSS = function containerCSS2(_ref3) {
var isDisabled = _ref3.isDisabled, isRtl = _ref3.isRtl;
return {
label: "container",
direction: isRtl ? "rtl" : void 0,
pointerEvents: isDisabled ? "none" : void 0,
// cancel mouse events when disabled
position: "relative"
};
};
var SelectContainer = function SelectContainer2(props) {
var children = props.children, innerProps = props.innerProps, isDisabled = props.isDisabled, isRtl = props.isRtl;
return jsx2("div", _extends({}, getStyleProps(props, "container", {
"--is-disabled": isDisabled,
"--is-rtl": isRtl
}), innerProps), children);
};
var valueContainerCSS = function valueContainerCSS2(_ref23, unstyled) {
var spacing2 = _ref23.theme.spacing, isMulti = _ref23.isMulti, hasValue = _ref23.hasValue, controlShouldRenderValue = _ref23.selectProps.controlShouldRenderValue;
return _objectSpread2({
alignItems: "center",
display: isMulti && hasValue && controlShouldRenderValue ? "flex" : "grid",
flex: 1,
flexWrap: "wrap",
WebkitOverflowScrolling: "touch",
position: "relative",
overflow: "hidden"
}, unstyled ? {} : {
padding: "".concat(spacing2.baseUnit / 2, "px ").concat(spacing2.baseUnit * 2, "px")
});
};
var ValueContainer = function ValueContainer2(props) {
var children = props.children, innerProps = props.innerProps, isMulti = props.isMulti, hasValue = props.hasValue;
return jsx2("div", _extends({}, getStyleProps(props, "valueContainer", {
"value-container": true,
"value-container--is-multi": isMulti,
"value-container--has-value": hasValue
}), innerProps), children);
};
var indicatorsContainerCSS = function indicatorsContainerCSS2() {
return {
alignItems: "center",
alignSelf: "stretch",
display: "flex",
flexShrink: 0
};
};
var IndicatorsContainer = function IndicatorsContainer2(props) {
var children = props.children, innerProps = props.innerProps;
return jsx2("div", _extends({}, getStyleProps(props, "indicatorsContainer", {
indicators: true
}), innerProps), children);
};
var _templateObject;
var _excluded$2 = ["size"];
var _excluded2 = ["innerProps", "isRtl", "size"];
function _EMOTION_STRINGIFIED_CSS_ERROR__() {
return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
}
var _ref2 = false ? {
name: "8mmkcg",
styles: "display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"
} : {
name: "tj5bde-Svg",
styles: "display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0;label:Svg;",
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGljYXRvcnMudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXlCSSIsImZpbGUiOiJpbmRpY2F0b3JzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsgUmVhY3ROb2RlIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsganN4LCBrZXlmcmFtZXMgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbmltcG9ydCB7XG4gIENvbW1vblByb3BzQW5kQ2xhc3NOYW1lLFxuICBDU1NPYmplY3RXaXRoTGFiZWwsXG4gIEdyb3VwQmFzZSxcbn0gZnJvbSAnLi4vdHlwZXMnO1xuaW1wb3J0IHsgZ2V0U3R5bGVQcm9wcyB9IGZyb20gJy4uL3V0aWxzJztcblxuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4vLyBEcm9wZG93biAmIENsZWFyIEljb25zXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cblxuY29uc3QgU3ZnID0gKHtcbiAgc2l6ZSxcbiAgLi4ucHJvcHNcbn06IEpTWC5JbnRyaW5zaWNFbGVtZW50c1snc3ZnJ10gJiB7IHNpemU6IG51bWJlciB9KSA9PiAoXG4gIDxzdmdcbiAgICBoZWlnaHQ9e3NpemV9XG4gICAgd2lkdGg9e3NpemV9XG4gICAgdmlld0JveD1cIjAgMCAyMCAyMFwiXG4gICAgYXJpYS1oaWRkZW49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T4ge1xuICByZXR1cm4gKFxuICAgIDxkaXZcbiAgICAgIHsuLi5nZXRTdHlsZVByb3BzKFxuICAgICAgICB7IC4uLnJlc3RQcm9wcywgaW5uZXJQcm9wcywgaXNSdGwsIHNpemUgfSxcbiAgICAgICAgJ2xvYWRpbmdJbmRpY2F0b3InLFxuICAgICAgICB7XG4gICAgICAgICAgaW5kaWNhdG9yOiB0cnVlLFxuICAgICAgICAgICdsb2FkaW5nLWluZGljYXRvcic6IHRydWUsXG4gICAgICAgIH1cbiAgICAgICl9XG4gICAgICB7Li4uaW5uZXJQcm9wc31cbiAgICA+XG4gICAgICA8TG9hZGluZ0RvdCBkZWxheT17MH0gb2Zmc2V0PXtpc1J0bH0gLz5cbiAgICAgIDxMb2FkaW5nRG90IGRlbGF5PXsxNjB9IG9mZnNldCAvPlxuICAgICAgPExvYWRpbmdEb3QgZGVsYXk9ezMyMH0gb2Zmc2V0PXshaXNSdGx9IC8+XG4gICAgPC9kaXY+XG4gICk7XG59O1xuIl19 */",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};
var Svg = function Svg2(_ref3) {
var size = _ref3.size, props = _objectWithoutProperties(_ref3, _excluded$2);
return jsx2("svg", _extends({
height: size,
width: size,
viewBox: "0 0 20 20",
"aria-hidden": "true",
focusable: "false",
css: _ref2
}, props));
};
var CrossIcon = function CrossIcon2(props) {
return jsx2(Svg, _extends({
size: 20
}, props), jsx2("path", {
d: "M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"
}));
};
var DownChevron = function DownChevron2(props) {
return jsx2(Svg, _extends({
size: 20
}, props), jsx2("path", {
d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"
}));
};
var baseCSS = function baseCSS2(_ref3, unstyled) {
var isFocused = _ref3.isFocused, _ref3$theme = _ref3.theme, baseUnit2 = _ref3$theme.spacing.baseUnit, colors2 = _ref3$theme.colors;
return _objectSpread2({
label: "indicatorContainer",
display: "flex",
transition: "color 150ms"
}, unstyled ? {} : {
color: isFocused ? colors2.neutral60 : colors2.neutral20,
padding: baseUnit2 * 2,
":hover": {
color: isFocused ? colors2.neutral80 : colors2.neutral40
}
});
};
var dropdownIndicatorCSS = baseCSS;
var DropdownIndicator = function DropdownIndicator2(props) {
var children = props.children, innerProps = props.innerProps;
return jsx2("div", _extends({}, getStyleProps(props, "dropdownIndicator", {
indicator: true,
"dropdown-indicator": true
}), innerProps), children || jsx2(DownChevron, null));
};
var clearIndicatorCSS = baseCSS;
var ClearIndicator = function ClearIndicator2(props) {
var children = props.children, innerProps = props.innerProps;
return jsx2("div", _extends({}, getStyleProps(props, "clearIndicator", {
indicator: true,
"clear-indicator": true
}), innerProps), children || jsx2(CrossIcon, null));
};
var indicatorSeparatorCSS = function indicatorSeparatorCSS2(_ref4, unstyled) {
var isDisabled = _ref4.isDisabled, _ref4$theme = _ref4.theme, baseUnit2 = _ref4$theme.spacing.baseUnit, colors2 = _ref4$theme.colors;
return _objectSpread2({
label: "indicatorSeparator",
alignSelf: "stretch",
width: 1
}, unstyled ? {} : {
backgroundColor: isDisabled ? colors2.neutral10 : colors2.neutral20,
marginBottom: baseUnit2 * 2,
marginTop: baseUnit2 * 2
});
};
var IndicatorSeparator = function IndicatorSeparator2(props) {
var innerProps = props.innerProps;
return jsx2("span", _extends({}, innerProps, getStyleProps(props, "indicatorSeparator", {
"indicator-separator": true
})));
};
var loadingDotAnimations = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0%, 80%, 100% { opacity: 0; }\n 40% { opacity: 1; }\n"])));
var loadingIndicatorCSS = function loadingIndicatorCSS2(_ref5, unstyled) {
var isFocused = _ref5.isFocused, size = _ref5.size, _ref5$theme = _ref5.theme, colors2 = _ref5$theme.colors, baseUnit2 = _ref5$theme.spacing.baseUnit;
return _objectSpread2({
label: "loadingIndicator",
display: "flex",
transition: "color 150ms",
alignSelf: "center",
fontSize: size,
lineHeight: 1,
marginRight: size,
textAlign: "center",
verticalAlign: "middle"
}, unstyled ? {} : {
color: isFocused ? colors2.neutral60 : colors2.neutral20,
padding: baseUnit2 * 2
});
};
var LoadingDot = function LoadingDot2(_ref6) {
var delay2 = _ref6.delay, offset = _ref6.offset;
return jsx2("span", {
css: css({
animation: "".concat(loadingDotAnimations, " 1s ease-in-out ").concat(delay2, "ms infinite;"),
backgroundColor: "currentColor",
borderRadius: "1em",
display: "inline-block",
marginLeft: offset ? "1em" : void 0,
height: "1em",
verticalAlign: "top",
width: "1em"
}, false ? "" : ";label:LoadingDot;", false ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGljYXRvcnMudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQW1RSSIsImZpbGUiOiJpbmRpY2F0b3JzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsgUmVhY3ROb2RlIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsganN4LCBrZXlmcmFtZXMgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbmltcG9ydCB7XG4gIENvbW1vblByb3BzQW5kQ2xhc3NOYW1lLFxuICBDU1NPYmplY3RXaXRoTGFiZWwsXG4gIEdyb3Vw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HN0YXRlIG9mIHRoZSBzZWxlY3QuICovXG4gIGlzRm9jdXNlZDogYm9vbGVhbjtcbiAgaXNEaXNhYmxlZDogYm9vbGVhbjtcbiAgLyoqIFNldCBzaXplIG9mIHRoZSBjb250YWluZXIuICovXG4gIHNpemU6IG51bWJlcjtcbn1cbmV4cG9ydCBjb25zdCBMb2FkaW5nSW5kaWNhdG9yID0gPFxuICBPcHRpb24sXG4gIElzTXVsdGkgZXh0ZW5kcyBib29sZWFuLFxuICBHcm91cCBleHRlbmRzIEdyb3VwQmFzZTxPcHRpb24+XG4+KHtcbiAgaW5uZXJQcm9wcyxcbiAgaXNSdGwsXG4gIHNpemUgPSA0LFxuICAuLi5yZXN0UHJvcHNcbn06IExvYWRpbmdJbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPikgPT4ge1xuICByZXR1cm4gKFxuICAgIDxkaXZcbiAgICAgIHsuLi5nZXRTdHlsZVByb3BzKFxuICAgICAgICB7IC4uLnJlc3RQcm9wcywgaW5uZXJQcm9wcywgaXNSdGwsIHNpemUgfSxcbiAgICAgICAgJ2xvYWRpbmdJbmRpY2F0b3InLFxuICAgICAgICB7XG4gICAgICAgICAgaW5kaWNhdG9yOiB0cnVlLFxuICAgICAgICAgICdsb2FkaW5nLWluZGljYXRvcic6IHRydWUsXG4gICAgICAgIH1cbiAgICAgICl9XG4gICAgICB7Li4uaW5uZXJQcm9wc31cbiAgICA+XG4gICAgICA8TG9hZGluZ0RvdCBkZWxheT17MH0gb2Zmc2V0PXtpc1J0bH0gLz5cbiAgICAgIDxMb2FkaW5nRG90IGRlbGF5PXsxNjB9IG9mZnNldCAvPlxuICAgICAgPExvYWRpbmdEb3QgZGVsYXk9ezMyMH0gb2Zmc2V0PXshaXNSdGx9IC8+XG4gICAgPC9kaXY+XG4gICk7XG59O1xuIl19 */")
});
};
var LoadingIndicator = function LoadingIndicator2(_ref7) {
var innerProps = _ref7.innerProps, isRtl = _ref7.isRtl, _ref7$size = _ref7.size, size = _ref7$size === void 0 ? 4 : _ref7$size, restProps = _objectWithoutProperties(_ref7, _excluded2);
return jsx2("div", _extends({}, getStyleProps(_objectSpread2(_objectSpread2({}, restProps), {}, {
innerProps,
isRtl,
size
}), "loadingIndicator", {
indicator: true,
"loading-indicator": true
}), innerProps), jsx2(LoadingDot, {
delay: 0,
offset: isRtl
}), jsx2(LoadingDot, {
delay: 160,
offset: true
}), jsx2(LoadingDot, {
delay: 320,
offset: !isRtl
}));
};
var css$1 = function css2(_ref3, unstyled) {
var isDisabled = _ref3.isDisabled, isFocused = _ref3.isFocused, _ref$theme = _ref3.theme, colors2 = _ref$theme.colors, borderRadius2 = _ref$theme.borderRadius, spacing2 = _ref$theme.spacing;
return _objectSpread2({
label: "control",
alignItems: "center",
cursor: "default",
display: "flex",
flexWrap: "wrap",
justifyContent: "space-between",
minHeight: spacing2.controlHeight,
outline: "0 !important",
position: "relative",
transition: "all 100ms"
}, unstyled ? {} : {
backgroundColor: isDisabled ? colors2.neutral5 : colors2.neutral0,
borderColor: isDisabled ? colors2.neutral10 : isFocused ? colors2.primary : colors2.neutral20,
borderRadius: borderRadius2,
borderStyle: "solid",
borderWidth: 1,
boxShadow: isFocused ? "0 0 0 1px ".concat(colors2.primary) : void 0,
"&:hover": {
borderColor: isFocused ? colors2.primary : colors2.neutral30
}
});
};
var Control = function Control2(props) {
var children = props.children, isDisabled = props.isDisabled, isFocused = props.isFocused, innerRef = props.innerRef, innerProps = props.innerProps, menuIsOpen = props.menuIsOpen;
return jsx2("div", _extends({
ref: innerRef
}, getStyleProps(props, "control", {
control: true,
"control--is-disabled": isDisabled,
"control--is-focused": isFocused,
"control--menu-is-open": menuIsOpen
}), innerProps, {
"aria-disabled": isDisabled || void 0
}), children);
};
var Control$1 = Control;
var _excluded$1 = ["data"];
var groupCSS = function groupCSS2(_ref3, unstyled) {
var spacing2 = _ref3.theme.spacing;
return unstyled ? {} : {
paddingBottom: spacing2.baseUnit * 2,
paddingTop: spacing2.baseUnit * 2
};
};
var Group = function Group2(props) {
var children = props.children, cx = props.cx, getStyles = props.getStyles, getClassNames = props.getClassNames, Heading = props.Heading, headingProps = props.headingProps, innerProps = props.innerProps, label = props.label, theme = props.theme, selectProps = props.selectProps;
return jsx2("div", _extends({}, getStyleProps(props, "group", {
group: true
}), innerProps), jsx2(Heading, _extends({}, headingProps, {
selectProps,
theme,
getStyles,
getClassNames,
cx
}), label), jsx2("div", null, children));
};
var groupHeadingCSS = function groupHeadingCSS2(_ref23, unstyled) {
var _ref2$theme = _ref23.theme, colors2 = _ref2$theme.colors, spacing2 = _ref2$theme.spacing;
return _objectSpread2({
label: "group",
cursor: "default",
display: "block"
}, unstyled ? {} : {
color: colors2.neutral40,
fontSize: "75%",
fontWeight: 500,
marginBottom: "0.25em",
paddingLeft: spacing2.baseUnit * 3,
paddingRight: spacing2.baseUnit * 3,
textTransform: "uppercase"
});
};
var GroupHeading = function GroupHeading2(props) {
var _cleanCommonProps = cleanCommonProps(props);
_cleanCommonProps.data;
var innerProps = _objectWithoutProperties(_cleanCommonProps, _excluded$1);
return jsx2("div", _extends({}, getStyleProps(props, "groupHeading", {
"group-heading": true
}), innerProps));
};
var Group$1 = Group;
var _excluded3 = ["innerRef", "isDisabled", "isHidden", "inputClassName"];
var inputCSS = function inputCSS2(_ref3, unstyled) {
var isDisabled = _ref3.isDisabled, value = _ref3.value, _ref$theme = _ref3.theme, spacing2 = _ref$theme.spacing, colors2 = _ref$theme.colors;
return _objectSpread2(_objectSpread2({
visibility: isDisabled ? "hidden" : "visible",
// force css to recompute when value change due to @emotion bug.
// We can remove it whenever the bug is fixed.
transform: value ? "translateZ(0)" : ""
}, containerStyle), unstyled ? {} : {
margin: spacing2.baseUnit / 2,
paddingBottom: spacing2.baseUnit / 2,
paddingTop: spacing2.baseUnit / 2,
color: colors2.neutral80
});
};
var spacingStyle = {
gridArea: "1 / 2",
font: "inherit",
minWidth: "2px",
border: 0,
margin: 0,
outline: 0,
padding: 0
};
var containerStyle = {
flex: "1 1 auto",
display: "inline-grid",
gridArea: "1 / 1 / 2 / 3",
gridTemplateColumns: "0 min-content",
"&:after": _objectSpread2({
content: 'attr(data-value) " "',
visibility: "hidden",
whiteSpace: "pre"
}, spacingStyle)
};
var inputStyle = function inputStyle2(isHidden) {
return _objectSpread2({
label: "input",
color: "inherit",
background: 0,
opacity: isHidden ? 0 : 1,
width: "100%"
}, spacingStyle);
};
var Input = function Input2(props) {
var cx = props.cx, value = props.value;
var _cleanCommonProps = cleanCommonProps(props), innerRef = _cleanCommonProps.innerRef, isDisabled = _cleanCommonProps.isDisabled, isHidden = _cleanCommonProps.isHidden, inputClassName = _cleanCommonProps.inputClassName, innerProps = _objectWithoutProperties(_cleanCommonProps, _excluded3);
return jsx2("div", _extends({}, getStyleProps(props, "input", {
"input-container": true
}), {
"data-value": value || ""
}), jsx2("input", _extends({
className: cx({
input: true
}, inputClassName),
ref: innerRef,
style: inputStyle(isHidden),
disabled: isDisabled
}, innerProps)));
};
var Input$1 = Input;
var multiValueCSS = function multiValueCSS2(_ref3, unstyled) {
var _ref$theme = _ref3.theme, spacing2 = _ref$theme.spacing, borderRadius2 = _ref$theme.borderRadius, colors2 = _ref$theme.colors;
return _objectSpread2({
label: "multiValue",
display: "flex",
minWidth: 0
}, unstyled ? {} : {
backgroundColor: colors2.neutral10,
borderRadius: borderRadius2 / 2,
margin: spacing2.baseUnit / 2
});
};
var multiValueLabelCSS = function multiValueLabelCSS2(_ref23, unstyled) {
var _ref2$theme = _ref23.theme, borderRadius2 = _ref2$theme.borderRadius, colors2 = _ref2$theme.colors, cropWithEllipsis = _ref23.cropWithEllipsis;
return _objectSpread2({
overflow: "hidden",
textOverflow: cropWithEllipsis || cropWithEllipsis === void 0 ? "ellipsis" : void 0,
whiteSpace: "nowrap"
}, unstyled ? {} : {
borderRadius: borderRadius2 / 2,
color: colors2.neutral80,
fontSize: "85%",
padding: 3,
paddingLeft: 6
});
};
var multiValueRemoveCSS = function multiValueRemoveCSS2(_ref3, unstyled) {
var _ref3$theme = _ref3.theme, spacing2 = _ref3$theme.spacing, borderRadius2 = _ref3$theme.borderRadius, colors2 = _ref3$theme.colors, isFocused = _ref3.isFocused;
return _objectSpread2({
alignItems: "center",
display: "flex"
}, unstyled ? {} : {
borderRadius: borderRadius2 / 2,
backgroundColor: isFocused ? colors2.dangerLight : void 0,
paddingLeft: spacing2.baseUnit,
paddingRight: spacing2.baseUnit,
":hover": {
backgroundColor: colors2.dangerLight,
color: colors2.danger
}
});
};
var MultiValueGeneric = function MultiValueGeneric2(_ref4) {
var children = _ref4.children, innerProps = _ref4.innerProps;
return jsx2("div", innerProps, children);
};
var MultiValueContainer = MultiValueGeneric;
var MultiValueLabel = MultiValueGeneric;
function MultiValueRemove(_ref5) {
var children = _ref5.children, innerProps = _ref5.innerProps;
return jsx2("div", _extends({
role: "button"
}, innerProps), children || jsx2(CrossIcon, {
size: 14
}));
}
var MultiValue = function MultiValue2(props) {
var children = props.children, components2 = props.components, data = props.data, innerProps = props.innerProps, isDisabled = props.isDisabled, removeProps3 = props.removeProps, selectProps = props.selectProps;
var Container = components2.Container, Label = components2.Label, Remove = components2.Remove;
return jsx2(Container, {
data,
innerProps: _objectSpread2(_objectSpread2({}, getStyleProps(props, "multiValue", {
"multi-value": true,
"multi-value--is-disabled": isDisabled
})), innerProps),
selectProps
}, jsx2(Label, {
data,
innerProps: _objectSpread2({}, getStyleProps(props, "multiValueLabel", {
"multi-value__label": true
})),
selectProps
}, children), jsx2(Remove, {
data,
innerProps: _objectSpread2(_objectSpread2({}, getStyleProps(props, "multiValueRemove", {
"multi-value__remove": true
})), {}, {
"aria-label": "Remove ".concat(children || "option")
}, removeProps3),
selectProps
}));
};
var MultiValue$1 = MultiValue;
var optionCSS = function optionCSS2(_ref3, unstyled) {
var isDisabled = _ref3.isDisabled, isFocused = _ref3.isFocused, isSelected = _ref3.isSelected, _ref$theme = _ref3.theme, spacing2 = _ref$theme.spacing, colors2 = _ref$theme.colors;
return _objectSpread2({
label: "option",
cursor: "default",
display: "block",
fontSize: "inherit",
width: "100%",
userSelect: "none",
WebkitTapHighlightColor: "rgba(0, 0, 0, 0)"
}, unstyled ? {} : {
backgroundColor: isSelected ? colors2.primary : isFocused ? colors2.primary25 : "transparent",
color: isDisabled ? colors2.neutral20 : isSelected ? colors2.neutral0 : "inherit",
padding: "".concat(spacing2.baseUnit * 2, "px ").concat(spacing2.baseUnit * 3, "px"),
// provide some affordance on touch devices
":active": {
backgroundColor: !isDisabled ? isSelected ? colors2.primary : colors2.primary50 : void 0
}
});
};
var Option = function Option2(props) {
var children = props.children, isDisabled = props.isDisabled, isFocused = props.isFocused, isSelected = props.isSelected, innerRef = props.innerRef, innerProps = props.innerProps;
return jsx2("div", _extends({}, getStyleProps(props, "option", {
option: true,
"option--is-disabled": isDisabled,
"option--is-focused": isFocused,
"option--is-selected": isSelected
}), {
ref: innerRef,
"aria-disabled": isDisabled
}, innerProps), children);
};
var Option$1 = Option;
var placeholderCSS = function placeholderCSS2(_ref3, unstyled) {
var _ref$theme = _ref3.theme, spacing2 = _ref$theme.spacing, colors2 = _ref$theme.colors;
return _objectSpread2({
label: "placeholder",
gridArea: "1 / 1 / 2 / 3"
}, unstyled ? {} : {
color: colors2.neutral50,
marginLeft: spacing2.baseUnit / 2,
marginRight: spacing2.baseUnit / 2
});
};
var Placeholder = function Placeholder2(props) {
var children = props.children, innerProps = props.innerProps;
return jsx2("div", _extends({}, getStyleProps(props, "placeholder", {
placeholder: true
}), innerProps), children);
};
var Placeholder$1 = Placeholder;
var css3 = function css4(_ref3, unstyled) {
var isDisabled = _ref3.isDisabled, _ref$theme = _ref3.theme, spacing2 = _ref$theme.spacing, colors2 = _ref$theme.colors;
return _objectSpread2({
label: "singleValue",
gridArea: "1 / 1 / 2 / 3",
maxWidth: "100%",
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap"
}, unstyled ? {} : {
color: isDisabled ? colors2.neutral40 : colors2.neutral80,
marginLeft: spacing2.baseUnit / 2,
marginRight: spacing2.baseUnit / 2
});
};
var SingleValue = function SingleValue2(props) {
var children = props.children, isDisabled = props.isDisabled, innerProps = props.innerProps;
return jsx2("div", _extends({}, getStyleProps(props, "singleValue", {
"single-value": true,
"single-value--is-disabled": isDisabled
}), innerProps), children);
};
var SingleValue$1 = SingleValue;
var components = {
ClearIndicator,
Control: Control$1,
DropdownIndicator,
DownChevron,
CrossIcon,
Group: Group$1,
GroupHeading,
IndicatorsContainer,
IndicatorSeparator,
Input: Input$1,
LoadingIndicator,
Menu: Menu$1,
MenuList,
MenuPortal,
LoadingMessage,
NoOptionsMessage,
MultiValue: MultiValue$1,
MultiValueContainer,
MultiValueLabel,
MultiValueRemove,
Option: Option$1,
Placeholder: Placeholder$1,
SelectContainer,
SingleValue: SingleValue$1,
ValueContainer
};
var defaultComponents = function defaultComponents2(props) {
return _objectSpread2(_objectSpread2({}, components), props.components);
};
// node_modules/memoize-one/dist/memoize-one.esm.js
var safeIsNaN = Number.isNaN || function ponyfill(value) {
return typeof value === "number" && value !== value;
};
function isEqual(first, second) {
if (first === second) {
return true;
}
if (safeIsNaN(first) && safeIsNaN(second)) {
return true;
}
return false;
}
function areInputsEqual(newInputs, lastInputs) {
if (newInputs.length !== lastInputs.length) {
return false;
}
for (var i3 = 0; i3 < newInputs.length; i3++) {
if (!isEqual(newInputs[i3], lastInputs[i3])) {
return false;
}
}
return true;
}
function memoizeOne(resultFn, isEqual3) {
if (isEqual3 === void 0) {
isEqual3 = areInputsEqual;
}
var cache = null;
function memoized() {
var newArgs = [];
for (var _i2 = 0; _i2 < arguments.length; _i2++) {
newArgs[_i2] = arguments[_i2];
}
if (cache && cache.lastThis === this && isEqual3(newArgs, cache.lastArgs)) {
return cache.lastResult;
}
var lastResult = resultFn.apply(this, newArgs);
cache = {
lastResult,
lastArgs: newArgs,
lastThis: this
};
return lastResult;
}
memoized.clear = function clear2() {
cache = null;
};
return memoized;
}
// node_modules/react-select/dist/Select-49a62830.esm.js
function _EMOTION_STRINGIFIED_CSS_ERROR__$2() {
return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
}
var _ref = false ? {
name: "7pg0cj-a11yText",
styles: "label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"
} : {
name: "1f43avz-a11yText-A11yText",
styles: "label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap;label:A11yText;",
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkExMXlUZXh0LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFNSSIsImZpbGUiOiJBMTF5VGV4dC50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKiogQGpzeCBqc3ggKi9cbmltcG9ydCB7IGpzeCB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuLy8gQXNzaXN0aXZlIHRleHQgdG8gZGVzY3JpYmUgdmlzdWFsIGVsZW1lbnRzLiBIaWRkZW4gZm9yIHNpZ2h0ZWQgdXNlcnMuXG5jb25zdCBBMTF5VGV4dCA9IChwcm9wczogSlNYLkludHJpbnNpY0VsZW1lbnRzWydzcGFuJ10pID0+IChcbiAgPHNwYW5cbiAgICBjc3M9e3tcbiAgICAgIGxhYmVsOiAnYTExeVRleHQnLFxuICAgICAgekluZGV4OiA5OTk5LFxuICAgICAgYm9yZGVyOiAwLFxuICAgICAgY2xpcDogJ3JlY3QoMXB4LCAxcHgsIDFweCwgMXB4KScsXG4gICAgICBoZWlnaHQ6IDEsXG4gICAgICB3aWR0aDogMSxcbiAgICAgIHBvc2l0aW9uOiAnYWJzb2x1dGUnLFxuICAgICAgb3ZlcmZsb3c6ICdoaWRkZW4nLFxuICAgICAgcGFkZGluZzogMCxcbiAgICAgIHdoaXRlU3BhY2U6ICdub3dyYXAnLFxuICAgIH19XG4gICAgey4uLnByb3BzfVxuICAvPlxuKTtcblxuZXhwb3J0IGRlZmF1bHQgQTExeVRleHQ7XG4iXX0= */",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$2
};
var A11yText = function A11yText2(props) {
return jsx2("span", _extends({
css: _ref
}, props));
};
var A11yText$1 = A11yText;
var defaultAriaLiveMessages = {
guidance: function guidance(props) {
var isSearchable = props.isSearchable, isMulti = props.isMulti, tabSelectsValue = props.tabSelectsValue, context = props.context, isInitialFocus = props.isInitialFocus;
switch (context) {
case "menu":
return "Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu".concat(tabSelectsValue ? ", press Tab to select the option and exit the menu" : "", ".");
case "input":
return isInitialFocus ? "".concat(props["aria-label"] || "Select", " is focused ").concat(isSearchable ? ",type to refine list" : "", ", press Down to open the menu, ").concat(isMulti ? " press left to focus selected values" : "") : "";
case "value":
return "Use left and right to toggle between focused values, press Backspace to remove the currently focused value";
default:
return "";
}
},
onChange: function onChange(props) {
var action = props.action, _props$label = props.label, label = _props$label === void 0 ? "" : _props$label, labels = props.labels, isDisabled = props.isDisabled;
switch (action) {
case "deselect-option":
case "pop-value":
case "remove-value":
return "option ".concat(label, ", deselected.");
case "clear":
return "All selected options have been cleared.";
case "initial-input-focus":
return "option".concat(labels.length > 1 ? "s" : "", " ").concat(labels.join(","), ", selected.");
case "select-option":
return isDisabled ? "option ".concat(label, " is disabled. Select another option.") : "option ".concat(label, ", selected.");
default:
return "";
}
},
onFocus: function onFocus(props) {
var context = props.context, focused = props.focused, options2 = props.options, _props$label2 = props.label, label = _props$label2 === void 0 ? "" : _props$label2, selectValue = props.selectValue, isDisabled = props.isDisabled, isSelected = props.isSelected, isAppleDevice2 = props.isAppleDevice;
var getArrayIndex = function getArrayIndex2(arr, item) {
return arr && arr.length ? "".concat(arr.indexOf(item) + 1, " of ").concat(arr.length) : "";
};
if (context === "value" && selectValue) {
return "value ".concat(label, " focused, ").concat(getArrayIndex(selectValue, focused), ".");
}
if (context === "menu" && isAppleDevice2) {
var disabled = isDisabled ? " disabled" : "";
var status2 = "".concat(isSelected ? " selected" : "").concat(disabled);
return "".concat(label).concat(status2, ", ").concat(getArrayIndex(options2, focused), ".");
}
return "";
},
onFilter: function onFilter(props) {
var inputValue = props.inputValue, resultsMessage = props.resultsMessage;
return "".concat(resultsMessage).concat(inputValue ? " for search term " + inputValue : "", ".");
}
};
var LiveRegion = function LiveRegion2(props) {
var ariaSelection = props.ariaSelection, focusedOption = props.focusedOption, focusedValue = props.focusedValue, focusableOptions = props.focusableOptions, isFocused = props.isFocused, selectValue = props.selectValue, selectProps = props.selectProps, id = props.id, isAppleDevice2 = props.isAppleDevice;
var ariaLiveMessages = selectProps.ariaLiveMessages, getOptionLabel4 = selectProps.getOptionLabel, inputValue = selectProps.inputValue, isMulti = selectProps.isMulti, isOptionDisabled3 = selectProps.isOptionDisabled, isSearchable = selectProps.isSearchable, menuIsOpen = selectProps.menuIsOpen, options2 = selectProps.options, screenReaderStatus2 = selectProps.screenReaderStatus, tabSelectsValue = selectProps.tabSelectsValue, isLoading = selectProps.isLoading;
var ariaLabel = selectProps["aria-label"];
var ariaLive = selectProps["aria-live"];
var messages = (0, import_react6.useMemo)(function() {
return _objectSpread2(_objectSpread2({}, defaultAriaLiveMessages), ariaLiveMessages || {});
}, [ariaLiveMessages]);
var ariaSelected = (0, import_react6.useMemo)(function() {
var message = "";
if (ariaSelection && messages.onChange) {
var option = ariaSelection.option, selectedOptions = ariaSelection.options, removedValue = ariaSelection.removedValue, removedValues = ariaSelection.removedValues, value = ariaSelection.value;
var asOption = function asOption2(val) {
return !Array.isArray(val) ? val : null;
};
var selected = removedValue || option || asOption(value);
var label = selected ? getOptionLabel4(selected) : "";
var multiSelected = selectedOptions || removedValues || void 0;
var labels = multiSelected ? multiSelected.map(getOptionLabel4) : [];
var onChangeProps = _objectSpread2({
// multiSelected items are usually items that have already been selected
// or set by the user as a default value so we assume they are not disabled
isDisabled: selected && isOptionDisabled3(selected, selectValue),
label,
labels
}, ariaSelection);
message = messages.onChange(onChangeProps);
}
return message;
}, [ariaSelection, messages, isOptionDisabled3, selectValue, getOptionLabel4]);
var ariaFocused = (0, import_react6.useMemo)(function() {
var focusMsg = "";
var focused = focusedOption || focusedValue;
var isSelected = !!(focusedOption && selectValue && selectValue.includes(focusedOption));
if (focused && messages.onFocus) {
var onFocusProps = {
focused,
label: getOptionLabel4(focused),
isDisabled: isOptionDisabled3(focused, selectValue),
isSelected,
options: focusableOptions,
context: focused === focusedOption ? "menu" : "value",
selectValue,
isAppleDevice: isAppleDevice2
};
focusMsg = messages.onFocus(onFocusProps);
}
return focusMsg;
}, [focusedOption, focusedValue, getOptionLabel4, isOptionDisabled3, messages, focusableOptions, selectValue, isAppleDevice2]);
var ariaResults = (0, import_react6.useMemo)(function() {
var resultsMsg = "";
if (menuIsOpen && options2.length && !isLoading && messages.onFilter) {
var resultsMessage = screenReaderStatus2({
count: focusableOptions.length
});
resultsMsg = messages.onFilter({
inputValue,
resultsMessage
});
}
return resultsMsg;
}, [focusableOptions, inputValue, menuIsOpen, messages, options2, screenReaderStatus2, isLoading]);
var isInitialFocus = (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === "initial-input-focus";
var ariaGuidance = (0, import_react6.useMemo)(function() {
var guidanceMsg = "";
if (messages.guidance) {
var context = focusedValue ? "value" : menuIsOpen ? "menu" : "input";
guidanceMsg = messages.guidance({
"aria-label": ariaLabel,
context,
isDisabled: focusedOption && isOptionDisabled3(focusedOption, selectValue),
isMulti,
isSearchable,
tabSelectsValue,
isInitialFocus
});
}
return guidanceMsg;
}, [ariaLabel, focusedOption, focusedValue, isMulti, isOptionDisabled3, isSearchable, menuIsOpen, messages, selectValue, tabSelectsValue, isInitialFocus]);
var ScreenReaderText = jsx2(import_react6.Fragment, null, jsx2("span", {
id: "aria-selection"
}, ariaSelected), jsx2("span", {
id: "aria-focused"
}, ariaFocused), jsx2("span", {
id: "aria-results"
}, ariaResults), jsx2("span", {
id: "aria-guidance"
}, ariaGuidance));
return jsx2(import_react6.Fragment, null, jsx2(A11yText$1, {
id
}, isInitialFocus && ScreenReaderText), jsx2(A11yText$1, {
"aria-live": ariaLive,
"aria-atomic": "false",
"aria-relevant": "additions text",
role: "log"
}, isFocused && !isInitialFocus && ScreenReaderText));
};
var LiveRegion$1 = LiveRegion;
var diacritics = [{
base: "A",
letters: "AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"
}, {
base: "AA",
letters: "Ꜳ"
}, {
base: "AE",
letters: "ÆǼǢ"
}, {
base: "AO",
letters: "Ꜵ"
}, {
base: "AU",
letters: "Ꜷ"
}, {
base: "AV",
letters: "ꜸꜺ"
}, {
base: "AY",
letters: "Ꜽ"
}, {
base: "B",
letters: "BⒷBḂḄḆɃƂƁ"
}, {
base: "C",
letters: "CⒸCĆĈĊČÇḈƇȻꜾ"
}, {
base: "D",
letters: "DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"
}, {
base: "DZ",
letters: "DZDŽ"
}, {
base: "Dz",
letters: "DzDž"
}, {
base: "E",
letters: "EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"
}, {
base: "F",
letters: "FⒻFḞƑꝻ"
}, {
base: "G",
letters: "GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"
}, {
base: "H",
letters: "HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"
}, {
base: "I",
letters: "IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"
}, {
base: "J",
letters: "JⒿJĴɈ"
}, {
base: "K",
letters: "KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"
}, {
base: "L",
letters: "LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"
}, {
base: "LJ",
letters: "LJ"
}, {
base: "Lj",
letters: "Lj"
}, {
base: "M",
letters: "MⓂMḾṀṂⱮƜ"
}, {
base: "N",
letters: "NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"
}, {
base: "NJ",
letters: "NJ"
}, {
base: "Nj",
letters: "Nj"
}, {
base: "O",
letters: "OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"
}, {
base: "OI",
letters: "Ƣ"
}, {
base: "OO",
letters: "Ꝏ"
}, {
base: "OU",
letters: "Ȣ"
}, {
base: "P",
letters: "PⓅPṔṖƤⱣꝐꝒꝔ"
}, {
base: "Q",
letters: "QⓆQꝖꝘɊ"
}, {
base: "R",
letters: "RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"
}, {
base: "S",
letters: "SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"
}, {
base: "T",
letters: "TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"
}, {
base: "TZ",
letters: "Ꜩ"
}, {
base: "U",
letters: "UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"
}, {
base: "V",
letters: "VⓋVṼṾƲꝞɅ"
}, {
base: "VY",
letters: "Ꝡ"
}, {
base: "W",
letters: "WⓌWẀẂŴẆẄẈⱲ"
}, {
base: "X",
letters: "XⓍXẊẌ"
}, {
base: "Y",
letters: "YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"
}, {
base: "Z",
letters: "ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"
}, {
base: "a",
letters: "aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"
}, {
base: "aa",
letters: "ꜳ"
}, {
base: "ae",
letters: "æǽǣ"
}, {
base: "ao",
letters: "ꜵ"
}, {
base: "au",
letters: "ꜷ"
}, {
base: "av",
letters: "ꜹꜻ"
}, {
base: "ay",
letters: "ꜽ"
}, {
base: "b",
letters: "bⓑbḃḅḇƀƃɓ"
}, {
base: "c",
letters: "cⓒcćĉċčçḉƈȼꜿↄ"
}, {
base: "d",
letters: "dⓓdḋďḍḑḓḏđƌɖɗꝺ"
}, {
base: "dz",
letters: "dzdž"
}, {
base: "e",
letters: "eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"
}, {
base: "f",
letters: "fⓕfḟƒꝼ"
}, {
base: "g",
letters: "gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"
}, {
base: "h",
letters: "hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"
}, {
base: "hv",
letters: "ƕ"
}, {
base: "i",
letters: "iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"
}, {
base: "j",
letters: "jⓙjĵǰɉ"
}, {
base: "k",
letters: "kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"
}, {
base: "l",
letters: "lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"
}, {
base: "lj",
letters: "lj"
}, {
base: "m",
letters: "mⓜmḿṁṃɱɯ"
}, {
base: "n",
letters: "nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"
}, {
base: "nj",
letters: "nj"
}, {
base: "o",
letters: "oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"
}, {
base: "oi",
letters: "ƣ"
}, {
base: "ou",
letters: "ȣ"
}, {
base: "oo",
letters: "ꝏ"
}, {
base: "p",
letters: "pⓟpṕṗƥᵽꝑꝓꝕ"
}, {
base: "q",
letters: "qⓠqɋꝗꝙ"
}, {
base: "r",
letters: "rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"
}, {
base: "s",
letters: "sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"
}, {
base: "t",
letters: "tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"
}, {
base: "tz",
letters: "ꜩ"
}, {
base: "u",
letters: "uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"
}, {
base: "v",
letters: "vⓥvṽṿʋꝟʌ"
}, {
base: "vy",
letters: "ꝡ"
}, {
base: "w",
letters: "wⓦwẁẃŵẇẅẘẉⱳ"
}, {
base: "x",
letters: "xⓧxẋẍ"
}, {
base: "y",
letters: "yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"
}, {
base: "z",
letters: "zⓩzźẑżžẓẕƶȥɀⱬꝣ"
}];
var anyDiacritic = new RegExp("[" + diacritics.map(function(d2) {
return d2.letters;
}).join("") + "]", "g");
var diacriticToBase = {};
for (i3 = 0; i3 < diacritics.length; i3++) {
diacritic = diacritics[i3];
for (j3 = 0; j3 < diacritic.letters.length; j3++) {
diacriticToBase[diacritic.letters[j3]] = diacritic.base;
}
}
var diacritic;
var j3;
var i3;
var stripDiacritics = function stripDiacritics2(str) {
return str.replace(anyDiacritic, function(match2) {
return diacriticToBase[match2];
});
};
var memoizedStripDiacriticsForInput = memoizeOne(stripDiacritics);
var trimString = function trimString2(str) {
return str.replace(/^\s+|\s+$/g, "");
};
var defaultStringify = function defaultStringify2(option) {
return "".concat(option.label, " ").concat(option.value);
};
var createFilter = function createFilter2(config) {
return function(option, rawInput) {
if (option.data.__isNew__) return true;
var _ignoreCase$ignoreAcc = _objectSpread2({
ignoreCase: true,
ignoreAccents: true,
stringify: defaultStringify,
trim: true,
matchFrom: "any"
}, config), ignoreCase = _ignoreCase$ignoreAcc.ignoreCase, ignoreAccents = _ignoreCase$ignoreAcc.ignoreAccents, stringify4 = _ignoreCase$ignoreAcc.stringify, trim2 = _ignoreCase$ignoreAcc.trim, matchFrom = _ignoreCase$ignoreAcc.matchFrom;
var input = trim2 ? trimString(rawInput) : rawInput;
var candidate = trim2 ? trimString(stringify4(option)) : stringify4(option);
if (ignoreCase) {
input = input.toLowerCase();
candidate = candidate.toLowerCase();
}
if (ignoreAccents) {
input = memoizedStripDiacriticsForInput(input);
candidate = stripDiacritics(candidate);
}
return matchFrom === "start" ? candidate.substr(0, input.length) === input : candidate.indexOf(input) > -1;
};
};
var _excluded4 = ["innerRef"];
function DummyInput(_ref3) {
var innerRef = _ref3.innerRef, props = _objectWithoutProperties(_ref3, _excluded4);
var filteredProps = removeProps(props, "onExited", "in", "enter", "exit", "appear");
return jsx2("input", _extends({
ref: innerRef
}, filteredProps, {
css: css({
label: "dummyInput",
// get rid of any default styles
background: 0,
border: 0,
// important! this hides the flashing cursor
caretColor: "transparent",
fontSize: "inherit",
gridArea: "1 / 1 / 2 / 3",
outline: 0,
padding: 0,
// important! without `width` browsers won't allow focus
width: 1,
// remove cursor on desktop
color: "transparent",
// remove cursor on mobile whilst maintaining "scroll into view" behaviour
left: -100,
opacity: 0,
position: "relative",
transform: "scale(.01)"
}, false ? "" : ";label:DummyInput;", false ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkR1bW15SW5wdXQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXlCTSIsImZpbGUiOiJEdW1teUlucHV0LnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsgUmVmIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsganN4IH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHsgcmVtb3ZlUHJvcHMgfSBmcm9tICcuLi91dGlscyc7XG5cbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIER1bW15SW5wdXQoe1xuICBpbm5lclJlZixcbiAgLi4ucHJvcHNcbn06IEpTWC5JbnRyaW5zaWNFbGVtZW50c1snaW5wdXQnXSAmIHtcbiAgcmVhZG9ubHkgaW5uZ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yb2xsIGludG8gdmlld1wiIGJlaGF2aW91clxuICAgICAgICBsZWZ0OiAtMTAwLFxuICAgICAgICBvcGFjaXR5OiAwLFxuICAgICAgICBwb3NpdGlvbjogJ3JlbGF0aXZlJyxcbiAgICAgICAgdHJhbnNmb3JtOiAnc2NhbGUoLjAxKScsXG4gICAgICB9fVxuICAgIC8+XG4gICk7XG59XG4iXX0= */")
}));
}
var cancelScroll = function cancelScroll2(event) {
if (event.cancelable) event.preventDefault();
event.stopPropagation();
};
function useScrollCapture(_ref3) {
var isEnabled = _ref3.isEnabled, onBottomArrive = _ref3.onBottomArrive, onBottomLeave = _ref3.onBottomLeave, onTopArrive = _ref3.onTopArrive, onTopLeave = _ref3.onTopLeave;
var isBottom = (0, import_react6.useRef)(false);
var isTop = (0, import_react6.useRef)(false);
var touchStart = (0, import_react6.useRef)(0);
var scrollTarget = (0, import_react6.useRef)(null);
var handleEventDelta = (0, import_react6.useCallback)(function(event, delta) {
if (scrollTarget.current === null) return;
var _scrollTarget$current = scrollTarget.current, scrollTop = _scrollTarget$current.scrollTop, scrollHeight = _scrollTarget$current.scrollHeight, clientHeight = _scrollTarget$current.clientHeight;
var target = scrollTarget.current;
var isDeltaPositive = delta > 0;
var availableScroll = scrollHeight - clientHeight - scrollTop;
var shouldCancelScroll = false;
if (availableScroll > delta && isBottom.current) {
if (onBottomLeave) onBottomLeave(event);
isBottom.current = false;
}
if (isDeltaPositive && isTop.current) {
if (onTopLeave) onTopLeave(event);
isTop.current = false;
}
if (isDeltaPositive && delta > availableScroll) {
if (onBottomArrive && !isBottom.current) {
onBottomArrive(event);
}
target.scrollTop = scrollHeight;
shouldCancelScroll = true;
isBottom.current = true;
} else if (!isDeltaPositive && -delta > scrollTop) {
if (onTopArrive && !isTop.current) {
onTopArrive(event);
}
target.scrollTop = 0;
shouldCancelScroll = true;
isTop.current = true;
}
if (shouldCancelScroll) {
cancelScroll(event);
}
}, [onBottomArrive, onBottomLeave, onTopArrive, onTopLeave]);
var onWheel = (0, import_react6.useCallback)(function(event) {
handleEventDelta(event, event.deltaY);
}, [handleEventDelta]);
var onTouchStart = (0, import_react6.useCallback)(function(event) {
touchStart.current = event.changedTouches[0].clientY;
}, []);
var onTouchMove = (0, import_react6.useCallback)(function(event) {
var deltaY = touchStart.current - event.changedTouches[0].clientY;
handleEventDelta(event, deltaY);
}, [handleEventDelta]);
var startListening = (0, import_react6.useCallback)(function(el) {
if (!el) return;
var notPassive = supportsPassiveEvents ? {
passive: false
} : false;
el.addEventListener("wheel", onWheel, notPassive);
el.addEventListener("touchstart", onTouchStart, notPassive);
el.addEventListener("touchmove", onTouchMove, notPassive);
}, [onTouchMove, onTouchStart, onWheel]);
var stopListening = (0, import_react6.useCallback)(function(el) {
if (!el) return;
el.removeEventListener("wheel", onWheel, false);
el.removeEventListener("touchstart", onTouchStart, false);
el.removeEventListener("touchmove", onTouchMove, false);
}, [onTouchMove, onTouchStart, onWheel]);
(0, import_react6.useEffect)(function() {
if (!isEnabled) return;
var element = scrollTarget.current;
startListening(element);
return function() {
stopListening(element);
};
}, [isEnabled, startListening, stopListening]);
return function(element) {
scrollTarget.current = element;
};
}
var STYLE_KEYS = ["boxSizing", "height", "overflow", "paddingRight", "position"];
var LOCK_STYLES = {
boxSizing: "border-box",
// account for possible declaration `width: 100%;` on body
overflow: "hidden",
position: "relative",
height: "100%"
};
function preventTouchMove(e) {
e.preventDefault();
}
function allowTouchMove(e) {
e.stopPropagation();
}
function preventInertiaScroll() {
var top = this.scrollTop;
var totalScroll = this.scrollHeight;
var currentScroll = top + this.offsetHeight;
if (top === 0) {
this.scrollTop = 1;
} else if (currentScroll === totalScroll) {
this.scrollTop = top - 1;
}
}
function isTouchDevice() {
return "ontouchstart" in window || navigator.maxTouchPoints;
}
var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
var activeScrollLocks = 0;
var listenerOptions = {
capture: false,
passive: false
};
function useScrollLock(_ref3) {
var isEnabled = _ref3.isEnabled, _ref$accountForScroll = _ref3.accountForScrollbars, accountForScrollbars = _ref$accountForScroll === void 0 ? true : _ref$accountForScroll;
var originalStyles = (0, import_react6.useRef)({});
var scrollTarget = (0, import_react6.useRef)(null);
var addScrollLock = (0, import_react6.useCallback)(function(touchScrollTarget) {
if (!canUseDOM) return;
var target = document.body;
var targetStyle = target && target.style;
if (accountForScrollbars) {
STYLE_KEYS.forEach(function(key) {
var val = targetStyle && targetStyle[key];
originalStyles.current[key] = val;
});
}
if (accountForScrollbars && activeScrollLocks < 1) {
var currentPadding = parseInt(originalStyles.current.paddingRight, 10) || 0;
var clientWidth = document.body ? document.body.clientWidth : 0;
var adjustedPadding = window.innerWidth - clientWidth + currentPadding || 0;
Object.keys(LOCK_STYLES).forEach(function(key) {
var val = LOCK_STYLES[key];
if (targetStyle) {
targetStyle[key] = val;
}
});
if (targetStyle) {
targetStyle.paddingRight = "".concat(adjustedPadding, "px");
}
}
if (target && isTouchDevice()) {
target.addEventListener("touchmove", preventTouchMove, listenerOptions);
if (touchScrollTarget) {
touchScrollTarget.addEventListener("touchstart", preventInertiaScroll, listenerOptions);
touchScrollTarget.addEventListener("touchmove", allowTouchMove, listenerOptions);
}
}
activeScrollLocks += 1;
}, [accountForScrollbars]);
var removeScrollLock = (0, import_react6.useCallback)(function(touchScrollTarget) {
if (!canUseDOM) return;
var target = document.body;
var targetStyle = target && target.style;
activeScrollLocks = Math.max(activeScrollLocks - 1, 0);
if (accountForScrollbars && activeScrollLocks < 1) {
STYLE_KEYS.forEach(function(key) {
var val = originalStyles.current[key];
if (targetStyle) {
targetStyle[key] = val;
}
});
}
if (target && isTouchDevice()) {
target.removeEventListener("touchmove", preventTouchMove, listenerOptions);
if (touchScrollTarget) {
touchScrollTarget.removeEventListener("touchstart", preventInertiaScroll, listenerOptions);
touchScrollTarget.removeEventListener("touchmove", allowTouchMove, listenerOptions);
}
}
}, [accountForScrollbars]);
(0, import_react6.useEffect)(function() {
if (!isEnabled) return;
var element = scrollTarget.current;
addScrollLock(element);
return function() {
removeScrollLock(element);
};
}, [isEnabled, addScrollLock, removeScrollLock]);
return function(element) {
scrollTarget.current = element;
};
}
function _EMOTION_STRINGIFIED_CSS_ERROR__$1() {
return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
}
var blurSelectInput = function blurSelectInput2(event) {
var element = event.target;
return element.ownerDocument.activeElement && element.ownerDocument.activeElement.blur();
};
var _ref2$1 = false ? {
name: "1kfdb0e",
styles: "position:fixed;left:0;bottom:0;right:0;top:0"
} : {
name: "bp8cua-ScrollManager",
styles: "position:fixed;left:0;bottom:0;right:0;top:0;label:ScrollManager;",
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlNjcm9sbE1hbmFnZXIudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQW9EVSIsImZpbGUiOiJTY3JvbGxNYW5hZ2VyLnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsganN4IH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHsgRnJhZ21lbnQsIFJlYWN0RWxlbWVudCwgUmVmQ2FsbGJhY2ssIE1vdXNlRXZlbnQgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgdXNlU2Nyb2xsQ2FwdHVyZSBmcm9tICcuL3VzZVNjcm9sbENhcHR1cmUnO1xuaW1wb3J0IHVzZVNjcm9sbExvY2sgZnJvbSAnLi91c2VTY3JvbGxMb2NrJztcblxuaW50ZXJmYWNlIFByb3BzIHtcbiAgcmVhZG9ubHkgY2hpbGRyZW46IChyZWY6IFJlZkNhbGxiYWNrPEhUTUxFbGVtZW50PikgPT4gUmVhY3RFbGVtZW50O1xuICByZWFkb25seSBsb2NrRW5hYmxlZDogYm9vbGVhbjtcbiAgcmVhZG9ubHkgY2FwdHVyZUVu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FxuICAgIG9uQm90dG9tQXJyaXZlLFxuICAgIG9uQm90dG9tTGVhdmUsXG4gICAgb25Ub3BBcnJpdmUsXG4gICAgb25Ub3BMZWF2ZSxcbiAgfSk7XG4gIGNvbnN0IHNldFNjcm9sbExvY2tUYXJnZXQgPSB1c2VTY3JvbGxMb2NrKHsgaXNFbmFibGVkOiBsb2NrRW5hYmxlZCB9KTtcblxuICBjb25zdCB0YXJnZXRSZWY6IFJlZkNhbGxiYWNrPEhUTUxFbGVtZW50PiA9IChlbGVtZW50KSA9PiB7XG4gICAgc2V0U2Nyb2xsQ2FwdHVyZVRhcmdldChlbGVtZW50KTtcbiAgICBzZXRTY3JvbGxMb2NrVGFyZ2V0KGVsZW1lbnQpO1xuICB9O1xuXG4gIHJldHVybiAoXG4gICAgPEZyYWdtZW50PlxuICAgICAge2xvY2tFbmFibGVkICYmIChcbiAgICAgICAgPGRpdlxuICAgICAgICAgIG9uQ2xpY2s9e2JsdXJTZWxlY3RJbnB1dH1cbiAgICAgICAgICBjc3M9e3sgcG9zaXRpb246ICdmaXhlZCcsIGxlZnQ6IDAsIGJvdHRvbTogMCwgcmlnaHQ6IDAsIHRvcDogMCB9fVxuICAgICAgICAvPlxuICAgICAgKX1cbiAgICAgIHtjaGlsZHJlbih0YXJnZXRSZWYpfVxuICAgIDwvRnJhZ21lbnQ+XG4gICk7XG59XG4iXX0= */",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
};
function ScrollManager(_ref3) {
var children = _ref3.children, lockEnabled = _ref3.lockEnabled, _ref$captureEnabled = _ref3.captureEnabled, captureEnabled = _ref$captureEnabled === void 0 ? true : _ref$captureEnabled, onBottomArrive = _ref3.onBottomArrive, onBottomLeave = _ref3.onBottomLeave, onTopArrive = _ref3.onTopArrive, onTopLeave = _ref3.onTopLeave;
var setScrollCaptureTarget = useScrollCapture({
isEnabled: captureEnabled,
onBottomArrive,
onBottomLeave,
onTopArrive,
onTopLeave
});
var setScrollLockTarget = useScrollLock({
isEnabled: lockEnabled
});
var targetRef = function targetRef2(element) {
setScrollCaptureTarget(element);
setScrollLockTarget(element);
};
return jsx2(import_react6.Fragment, null, lockEnabled && jsx2("div", {
onClick: blurSelectInput,
css: _ref2$1
}), children(targetRef));
}
function _EMOTION_STRINGIFIED_CSS_ERROR__2() {
return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
}
var _ref22 = false ? {
name: "1a0ro4n-requiredInput",
styles: "label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"
} : {
name: "5kkxb2-requiredInput-RequiredInput",
styles: "label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%;label:RequiredInput;",
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlJlcXVpcmVkSW5wdXQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWNJIiwiZmlsZSI6IlJlcXVpcmVkSW5wdXQudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiLyoqIEBqc3gganN4ICovXG5pbXBvcnQgeyBGb2N1c0V2ZW50SGFuZGxlciwgRnVuY3Rpb25Db21wb25lbnQgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgeyBqc3ggfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbmNvbnN0IFJlcXVpcmVkSW5wdXQ6IEZ1bmN0aW9uQ29tcG9uZW50PHtcbiAgcmVhZG9ubHkgbmFtZT86IHN0cmluZztcbiAgcmVhZG9ubHkgb25Gb2N1czogRm9jdXNFdmVudEhhbmRsZXI8SFRNTElucHV0RWxlbWVudD47XG59PiA9ICh7IG5hbWUsIG9uRm9jdXMgfSkgPT4gKFxuICA8aW5wdXRcbiAgICByZXF1aXJlZFxuICAgIG5hbWU9e25hbWV9XG4gICAgdGFiSW5kZXg9ey0xfVxuICAgIGFyaWEtaGlkZGVuPVwidHJ1ZVwiXG4gICAgb25Gb2N1cz17b25Gb2N1c31cbiAgICBjc3M9e3tcbiAgICAgIGxhYmVsOiAncmVxdWlyZWRJbnB1dCcsXG4gICAgICBvcGFjaXR5OiAwLFxuICAgICAgcG9pbnRlckV2ZW50czogJ25vbmUnLFxuICAgICAgcG9zaXRpb246ICdhYnNvbHV0ZScsXG4gICAgICBib3R0b206IDAsXG4gICAgICBsZWZ0OiAwLFxuICAgICAgcmlnaHQ6IDAsXG4gICAgICB3aWR0aDogJzEwMCUnLFxuICAgIH19XG4gICAgLy8gUHJldmVudCBgU3dpdGNoaW5nIGZyb20gdW5jb250cm9sbGVkIHRvIGNvbnRyb2xsZWRgIGVycm9yXG4gICAgdmFsdWU9XCJcIlxuICAgIG9uQ2hhbmdlPXsoKSA9PiB7fX1cbiAgLz5cbik7XG5cbmV4cG9ydCBkZWZhdWx0IFJlcXVpcmVkSW5wdXQ7XG4iXX0= */",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__2
};
var RequiredInput = function RequiredInput2(_ref3) {
var name = _ref3.name, onFocus2 = _ref3.onFocus;
return jsx2("input", {
required: true,
name,
tabIndex: -1,
"aria-hidden": "true",
onFocus: onFocus2,
css: _ref22,
value: "",
onChange: function onChange2() {
}
});
};
var RequiredInput$1 = RequiredInput;
function testPlatform(re6) {
var _window$navigator$use;
return typeof window !== "undefined" && window.navigator != null ? re6.test(((_window$navigator$use = window.navigator["userAgentData"]) === null || _window$navigator$use === void 0 ? void 0 : _window$navigator$use.platform) || window.navigator.platform) : false;
}
function isIPhone() {
return testPlatform(/^iPhone/i);
}
function isMac() {
return testPlatform(/^Mac/i);
}
function isIPad() {
return testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
isMac() && navigator.maxTouchPoints > 1;
}
function isIOS() {
return isIPhone() || isIPad();
}
function isAppleDevice() {
return isMac() || isIOS();
}
var formatGroupLabel = function formatGroupLabel2(group) {
return group.label;
};
var getOptionLabel$1 = function getOptionLabel(option) {
return option.label;
};
var getOptionValue$1 = function getOptionValue(option) {
return option.value;
};
var isOptionDisabled = function isOptionDisabled2(option) {
return !!option.isDisabled;
};
var defaultStyles = {
clearIndicator: clearIndicatorCSS,
container: containerCSS,
control: css$1,
dropdownIndicator: dropdownIndicatorCSS,
group: groupCSS,
groupHeading: groupHeadingCSS,
indicatorsContainer: indicatorsContainerCSS,
indicatorSeparator: indicatorSeparatorCSS,
input: inputCSS,
loadingIndicator: loadingIndicatorCSS,
loadingMessage: loadingMessageCSS,
menu: menuCSS,
menuList: menuListCSS,
menuPortal: menuPortalCSS,
multiValue: multiValueCSS,
multiValueLabel: multiValueLabelCSS,
multiValueRemove: multiValueRemoveCSS,
noOptionsMessage: noOptionsMessageCSS,
option: optionCSS,
placeholder: placeholderCSS,
singleValue: css3,
valueContainer: valueContainerCSS
};
var colors = {
primary: "#2684FF",
primary75: "#4C9AFF",
primary50: "#B2D4FF",
primary25: "#DEEBFF",
danger: "#DE350B",
dangerLight: "#FFBDAD",
neutral0: "hsl(0, 0%, 100%)",
neutral5: "hsl(0, 0%, 95%)",
neutral10: "hsl(0, 0%, 90%)",
neutral20: "hsl(0, 0%, 80%)",
neutral30: "hsl(0, 0%, 70%)",
neutral40: "hsl(0, 0%, 60%)",
neutral50: "hsl(0, 0%, 50%)",
neutral60: "hsl(0, 0%, 40%)",
neutral70: "hsl(0, 0%, 30%)",
neutral80: "hsl(0, 0%, 20%)",
neutral90: "hsl(0, 0%, 10%)"
};
var borderRadius = 4;
var baseUnit = 4;
var controlHeight = 38;
var menuGutter = baseUnit * 2;
var spacing = {
baseUnit,
controlHeight,
menuGutter
};
var defaultTheme = {
borderRadius,
colors,
spacing
};
var defaultProps = {
"aria-live": "polite",
backspaceRemovesValue: true,
blurInputOnSelect: isTouchCapable(),
captureMenuScroll: !isTouchCapable(),
classNames: {},
closeMenuOnSelect: true,
closeMenuOnScroll: false,
components: {},
controlShouldRenderValue: true,
escapeClearsValue: false,
filterOption: createFilter(),
formatGroupLabel,
getOptionLabel: getOptionLabel$1,
getOptionValue: getOptionValue$1,
isDisabled: false,
isLoading: false,
isMulti: false,
isRtl: false,
isSearchable: true,
isOptionDisabled,
loadingMessage: function loadingMessage() {
return "Loading...";
},
maxMenuHeight: 300,
minMenuHeight: 140,
menuIsOpen: false,
menuPlacement: "bottom",
menuPosition: "absolute",
menuShouldBlockScroll: false,
menuShouldScrollIntoView: !isMobileDevice(),
noOptionsMessage: function noOptionsMessage() {
return "No options";
},
openMenuOnFocus: false,
openMenuOnClick: true,
options: [],
pageSize: 5,
placeholder: "Select...",
screenReaderStatus: function screenReaderStatus(_ref3) {
var count = _ref3.count;
return "".concat(count, " result").concat(count !== 1 ? "s" : "", " available");
},
styles: {},
tabIndex: 0,
tabSelectsValue: true,
unstyled: false
};
function toCategorizedOption(props, option, selectValue, index2) {
var isDisabled = _isOptionDisabled(props, option, selectValue);
var isSelected = _isOptionSelected(props, option, selectValue);
var label = getOptionLabel2(props, option);
var value = getOptionValue2(props, option);
return {
type: "option",
data: option,
isDisabled,
isSelected,
label,
value,
index: index2
};
}
function buildCategorizedOptions(props, selectValue) {
return props.options.map(function(groupOrOption, groupOrOptionIndex) {
if ("options" in groupOrOption) {
var categorizedOptions = groupOrOption.options.map(function(option, optionIndex) {
return toCategorizedOption(props, option, selectValue, optionIndex);
}).filter(function(categorizedOption2) {
return isFocusable(props, categorizedOption2);
});
return categorizedOptions.length > 0 ? {
type: "group",
data: groupOrOption,
options: categorizedOptions,
index: groupOrOptionIndex
} : void 0;
}
var categorizedOption = toCategorizedOption(props, groupOrOption, selectValue, groupOrOptionIndex);
return isFocusable(props, categorizedOption) ? categorizedOption : void 0;
}).filter(notNullish);
}
function buildFocusableOptionsFromCategorizedOptions(categorizedOptions) {
return categorizedOptions.reduce(function(optionsAccumulator, categorizedOption) {
if (categorizedOption.type === "group") {
optionsAccumulator.push.apply(optionsAccumulator, _toConsumableArray(categorizedOption.options.map(function(option) {
return option.data;
})));
} else {
optionsAccumulator.push(categorizedOption.data);
}
return optionsAccumulator;
}, []);
}
function buildFocusableOptionsWithIds(categorizedOptions, optionId) {
return categorizedOptions.reduce(function(optionsAccumulator, categorizedOption) {
if (categorizedOption.type === "group") {
optionsAccumulator.push.apply(optionsAccumulator, _toConsumableArray(categorizedOption.options.map(function(option) {
return {
data: option.data,
id: "".concat(optionId, "-").concat(categorizedOption.index, "-").concat(option.index)
};
})));
} else {
optionsAccumulator.push({
data: categorizedOption.data,
id: "".concat(optionId, "-").concat(categorizedOption.index)
});
}
return optionsAccumulator;
}, []);
}
function buildFocusableOptions(props, selectValue) {
return buildFocusableOptionsFromCategorizedOptions(buildCategorizedOptions(props, selectValue));
}
function isFocusable(props, categorizedOption) {
var _props$inputValue = props.inputValue, inputValue = _props$inputValue === void 0 ? "" : _props$inputValue;
var data = categorizedOption.data, isSelected = categorizedOption.isSelected, label = categorizedOption.label, value = categorizedOption.value;
return (!shouldHideSelectedOptions(props) || !isSelected) && _filterOption(props, {
label,
value,
data
}, inputValue);
}
function getNextFocusedValue(state, nextSelectValue) {
var focusedValue = state.focusedValue, lastSelectValue = state.selectValue;
var lastFocusedIndex = lastSelectValue.indexOf(focusedValue);
if (lastFocusedIndex > -1) {
var nextFocusedIndex = nextSelectValue.indexOf(focusedValue);
if (nextFocusedIndex > -1) {
return focusedValue;
} else if (lastFocusedIndex < nextSelectValue.length) {
return nextSelectValue[lastFocusedIndex];
}
}
return null;
}
function getNextFocusedOption(state, options2) {
var lastFocusedOption = state.focusedOption;
return lastFocusedOption && options2.indexOf(lastFocusedOption) > -1 ? lastFocusedOption : options2[0];
}
var getFocusedOptionId = function getFocusedOptionId2(focusableOptionsWithIds, focusedOption) {
var _focusableOptionsWith;
var focusedOptionId = (_focusableOptionsWith = focusableOptionsWithIds.find(function(option) {
return option.data === focusedOption;
})) === null || _focusableOptionsWith === void 0 ? void 0 : _focusableOptionsWith.id;
return focusedOptionId || null;
};
var getOptionLabel2 = function getOptionLabel3(props, data) {
return props.getOptionLabel(data);
};
var getOptionValue2 = function getOptionValue3(props, data) {
return props.getOptionValue(data);
};
function _isOptionDisabled(props, option, selectValue) {
return typeof props.isOptionDisabled === "function" ? props.isOptionDisabled(option, selectValue) : false;
}
function _isOptionSelected(props, option, selectValue) {
if (selectValue.indexOf(option) > -1) return true;
if (typeof props.isOptionSelected === "function") {
return props.isOptionSelected(option, selectValue);
}
var candidate = getOptionValue2(props, option);
return selectValue.some(function(i3) {
return getOptionValue2(props, i3) === candidate;
});
}
function _filterOption(props, option, inputValue) {
return props.filterOption ? props.filterOption(option, inputValue) : true;
}
var shouldHideSelectedOptions = function shouldHideSelectedOptions2(props) {
var hideSelectedOptions = props.hideSelectedOptions, isMulti = props.isMulti;
if (hideSelectedOptions === void 0) return isMulti;
return hideSelectedOptions;
};
var instanceId = 1;
var Select = function(_Component) {
_inherits(Select3, _Component);
var _super = _createSuper(Select3);
function Select3(_props) {
var _this;
_classCallCheck(this, Select3);
_this = _super.call(this, _props);
_this.state = {
ariaSelection: null,
focusedOption: null,
focusedOptionId: null,
focusableOptionsWithIds: [],
focusedValue: null,
inputIsHidden: false,
isFocused: false,
selectValue: [],
clearFocusValueOnUpdate: false,
prevWasFocused: false,
inputIsHiddenAfterUpdate: void 0,
prevProps: void 0,
instancePrefix: ""
};
_this.blockOptionHover = false;
_this.isComposing = false;
_this.commonProps = void 0;
_this.initialTouchX = 0;
_this.initialTouchY = 0;
_this.openAfterFocus = false;
_this.scrollToFocusedOptionOnUpdate = false;
_this.userIsDragging = void 0;
_this.isAppleDevice = isAppleDevice();
_this.controlRef = null;
_this.getControlRef = function(ref) {
_this.controlRef = ref;
};
_this.focusedOptionRef = null;
_this.getFocusedOptionRef = function(ref) {
_this.focusedOptionRef = ref;
};
_this.menuListRef = null;
_this.getMenuListRef = function(ref) {
_this.menuListRef = ref;
};
_this.inputRef = null;
_this.getInputRef = function(ref) {
_this.inputRef = ref;
};
_this.focus = _this.focusInput;
_this.blur = _this.blurInput;
_this.onChange = function(newValue, actionMeta) {
var _this$props = _this.props, onChange2 = _this$props.onChange, name = _this$props.name;
actionMeta.name = name;
_this.ariaOnChange(newValue, actionMeta);
onChange2(newValue, actionMeta);
};
_this.setValue = function(newValue, action, option) {
var _this$props2 = _this.props, closeMenuOnSelect = _this$props2.closeMenuOnSelect, isMulti = _this$props2.isMulti, inputValue = _this$props2.inputValue;
_this.onInputChange("", {
action: "set-value",
prevInputValue: inputValue
});
if (closeMenuOnSelect) {
_this.setState({
inputIsHiddenAfterUpdate: !isMulti
});
_this.onMenuClose();
}
_this.setState({
clearFocusValueOnUpdate: true
});
_this.onChange(newValue, {
action,
option
});
};
_this.selectOption = function(newValue) {
var _this$props3 = _this.props, blurInputOnSelect = _this$props3.blurInputOnSelect, isMulti = _this$props3.isMulti, name = _this$props3.name;
var selectValue = _this.state.selectValue;
var deselected = isMulti && _this.isOptionSelected(newValue, selectValue);
var isDisabled = _this.isOptionDisabled(newValue, selectValue);
if (deselected) {
var candidate = _this.getOptionValue(newValue);
_this.setValue(multiValueAsValue(selectValue.filter(function(i3) {
return _this.getOptionValue(i3) !== candidate;
})), "deselect-option", newValue);
} else if (!isDisabled) {
if (isMulti) {
_this.setValue(multiValueAsValue([].concat(_toConsumableArray(selectValue), [newValue])), "select-option", newValue);
} else {
_this.setValue(singleValueAsValue(newValue), "select-option");
}
} else {
_this.ariaOnChange(singleValueAsValue(newValue), {
action: "select-option",
option: newValue,
name
});
return;
}
if (blurInputOnSelect) {
_this.blurInput();
}
};
_this.removeValue = function(removedValue) {
var isMulti = _this.props.isMulti;
var selectValue = _this.state.selectValue;
var candidate = _this.getOptionValue(removedValue);
var newValueArray = selectValue.filter(function(i3) {
return _this.getOptionValue(i3) !== candidate;
});
var newValue = valueTernary(isMulti, newValueArray, newValueArray[0] || null);
_this.onChange(newValue, {
action: "remove-value",
removedValue
});
_this.focusInput();
};
_this.clearValue = function() {
var selectValue = _this.state.selectValue;
_this.onChange(valueTernary(_this.props.isMulti, [], null), {
action: "clear",
removedValues: selectValue
});
};
_this.popValue = function() {
var isMulti = _this.props.isMulti;
var selectValue = _this.state.selectValue;
var lastSelectedValue = selectValue[selectValue.length - 1];
var newValueArray = selectValue.slice(0, selectValue.length - 1);
var newValue = valueTernary(isMulti, newValueArray, newValueArray[0] || null);
_this.onChange(newValue, {
action: "pop-value",
removedValue: lastSelectedValue
});
};
_this.getFocusedOptionId = function(focusedOption) {
return getFocusedOptionId(_this.state.focusableOptionsWithIds, focusedOption);
};
_this.getFocusableOptionsWithIds = function() {
return buildFocusableOptionsWithIds(buildCategorizedOptions(_this.props, _this.state.selectValue), _this.getElementId("option"));
};
_this.getValue = function() {
return _this.state.selectValue;
};
_this.cx = function() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return classNames.apply(void 0, [_this.props.classNamePrefix].concat(args));
};
_this.getOptionLabel = function(data) {
return getOptionLabel2(_this.props, data);
};
_this.getOptionValue = function(data) {
return getOptionValue2(_this.props, data);
};
_this.getStyles = function(key, props) {
var unstyled = _this.props.unstyled;
var base = defaultStyles[key](props, unstyled);
base.boxSizing = "border-box";
var custom = _this.props.styles[key];
return custom ? custom(base, props) : base;
};
_this.getClassNames = function(key, props) {
var _this$props$className, _this$props$className2;
return (_this$props$className = (_this$props$className2 = _this.props.classNames)[key]) === null || _this$props$className === void 0 ? void 0 : _this$props$className.call(_this$props$className2, props);
};
_this.getElementId = function(element) {
return "".concat(_this.state.instancePrefix, "-").concat(element);
};
_this.getComponents = function() {
return defaultComponents(_this.props);
};
_this.buildCategorizedOptions = function() {
return buildCategorizedOptions(_this.props, _this.state.selectValue);
};
_this.getCategorizedOptions = function() {
return _this.props.menuIsOpen ? _this.buildCategorizedOptions() : [];
};
_this.buildFocusableOptions = function() {
return buildFocusableOptionsFromCategorizedOptions(_this.buildCategorizedOptions());
};
_this.getFocusableOptions = function() {
return _this.props.menuIsOpen ? _this.buildFocusableOptions() : [];
};
_this.ariaOnChange = function(value, actionMeta) {
_this.setState({
ariaSelection: _objectSpread2({
value
}, actionMeta)
});
};
_this.onMenuMouseDown = function(event) {
if (event.button !== 0) {
return;
}
event.stopPropagation();
event.preventDefault();
_this.focusInput();
};
_this.onMenuMouseMove = function(event) {
_this.blockOptionHover = false;
};
_this.onControlMouseDown = function(event) {
if (event.defaultPrevented) {
return;
}
var openMenuOnClick = _this.props.openMenuOnClick;
if (!_this.state.isFocused) {
if (openMenuOnClick) {
_this.openAfterFocus = true;
}
_this.focusInput();
} else if (!_this.props.menuIsOpen) {
if (openMenuOnClick) {
_this.openMenu("first");
}
} else {
if (event.target.tagName !== "INPUT" && event.target.tagName !== "TEXTAREA") {
_this.onMenuClose();
}
}
if (event.target.tagName !== "INPUT" && event.target.tagName !== "TEXTAREA") {
event.preventDefault();
}
};
_this.onDropdownIndicatorMouseDown = function(event) {
if (event && event.type === "mousedown" && event.button !== 0) {
return;
}
if (_this.props.isDisabled) return;
var _this$props4 = _this.props, isMulti = _this$props4.isMulti, menuIsOpen = _this$props4.menuIsOpen;
_this.focusInput();
if (menuIsOpen) {
_this.setState({
inputIsHiddenAfterUpdate: !isMulti
});
_this.onMenuClose();
} else {
_this.openMenu("first");
}
event.preventDefault();
};
_this.onClearIndicatorMouseDown = function(event) {
if (event && event.type === "mousedown" && event.button !== 0) {
return;
}
_this.clearValue();
event.preventDefault();
_this.openAfterFocus = false;
if (event.type === "touchend") {
_this.focusInput();
} else {
setTimeout(function() {
return _this.focusInput();
});
}
};
_this.onScroll = function(event) {
if (typeof _this.props.closeMenuOnScroll === "boolean") {
if (event.target instanceof HTMLElement && isDocumentElement(event.target)) {
_this.props.onMenuClose();
}
} else if (typeof _this.props.closeMenuOnScroll === "function") {
if (_this.props.closeMenuOnScroll(event)) {
_this.props.onMenuClose();
}
}
};
_this.onCompositionStart = function() {
_this.isComposing = true;
};
_this.onCompositionEnd = function() {
_this.isComposing = false;
};
_this.onTouchStart = function(_ref23) {
var touches = _ref23.touches;
var touch = touches && touches.item(0);
if (!touch) {
return;
}
_this.initialTouchX = touch.clientX;
_this.initialTouchY = touch.clientY;
_this.userIsDragging = false;
};
_this.onTouchMove = function(_ref3) {
var touches = _ref3.touches;
var touch = touches && touches.item(0);
if (!touch) {
return;
}
var deltaX = Math.abs(touch.clientX - _this.initialTouchX);
var deltaY = Math.abs(touch.clientY - _this.initialTouchY);
var moveThreshold = 5;
_this.userIsDragging = deltaX > moveThreshold || deltaY > moveThreshold;
};
_this.onTouchEnd = function(event) {
if (_this.userIsDragging) return;
if (_this.controlRef && !_this.controlRef.contains(event.target) && _this.menuListRef && !_this.menuListRef.contains(event.target)) {
_this.blurInput();
}
_this.initialTouchX = 0;
_this.initialTouchY = 0;
};
_this.onControlTouchEnd = function(event) {
if (_this.userIsDragging) return;
_this.onControlMouseDown(event);
};
_this.onClearIndicatorTouchEnd = function(event) {
if (_this.userIsDragging) return;
_this.onClearIndicatorMouseDown(event);
};
_this.onDropdownIndicatorTouchEnd = function(event) {
if (_this.userIsDragging) return;
_this.onDropdownIndicatorMouseDown(event);
};
_this.handleInputChange = function(event) {
var prevInputValue = _this.props.inputValue;
var inputValue = event.currentTarget.value;
_this.setState({
inputIsHiddenAfterUpdate: false
});
_this.onInputChange(inputValue, {
action: "input-change",
prevInputValue
});
if (!_this.props.menuIsOpen) {
_this.onMenuOpen();
}
};
_this.onInputFocus = function(event) {
if (_this.props.onFocus) {
_this.props.onFocus(event);
}
_this.setState({
inputIsHiddenAfterUpdate: false,
isFocused: true
});
if (_this.openAfterFocus || _this.props.openMenuOnFocus) {
_this.openMenu("first");
}
_this.openAfterFocus = false;
};
_this.onInputBlur = function(event) {
var prevInputValue = _this.props.inputValue;
if (_this.menuListRef && _this.menuListRef.contains(document.activeElement)) {
_this.inputRef.focus();
return;
}
if (_this.props.onBlur) {
_this.props.onBlur(event);
}
_this.onInputChange("", {
action: "input-blur",
prevInputValue
});
_this.onMenuClose();
_this.setState({
focusedValue: null,
isFocused: false
});
};
_this.onOptionHover = function(focusedOption) {
if (_this.blockOptionHover || _this.state.focusedOption === focusedOption) {
return;
}
var options2 = _this.getFocusableOptions();
var focusedOptionIndex = options2.indexOf(focusedOption);
_this.setState({
focusedOption,
focusedOptionId: focusedOptionIndex > -1 ? _this.getFocusedOptionId(focusedOption) : null
});
};
_this.shouldHideSelectedOptions = function() {
return shouldHideSelectedOptions(_this.props);
};
_this.onValueInputFocus = function(e) {
e.preventDefault();
e.stopPropagation();
_this.focus();
};
_this.onKeyDown = function(event) {
var _this$props5 = _this.props, isMulti = _this$props5.isMulti, backspaceRemovesValue = _this$props5.backspaceRemovesValue, escapeClearsValue = _this$props5.escapeClearsValue, inputValue = _this$props5.inputValue, isClearable = _this$props5.isClearable, isDisabled = _this$props5.isDisabled, menuIsOpen = _this$props5.menuIsOpen, onKeyDown = _this$props5.onKeyDown, tabSelectsValue = _this$props5.tabSelectsValue, openMenuOnFocus = _this$props5.openMenuOnFocus;
var _this$state = _this.state, focusedOption = _this$state.focusedOption, focusedValue = _this$state.focusedValue, selectValue = _this$state.selectValue;
if (isDisabled) return;
if (typeof onKeyDown === "function") {
onKeyDown(event);
if (event.defaultPrevented) {
return;
}
}
_this.blockOptionHover = true;
switch (event.key) {
case "ArrowLeft":
if (!isMulti || inputValue) return;
_this.focusValue("previous");
break;
case "ArrowRight":
if (!isMulti || inputValue) return;
_this.focusValue("next");
break;
case "Delete":
case "Backspace":
if (inputValue) return;
if (focusedValue) {
_this.removeValue(focusedValue);
} else {
if (!backspaceRemovesValue) return;
if (isMulti) {
_this.popValue();
} else if (isClearable) {
_this.clearValue();
}
}
break;
case "Tab":
if (_this.isComposing) return;
if (event.shiftKey || !menuIsOpen || !tabSelectsValue || !focusedOption || // don't capture the event if the menu opens on focus and the focused
// option is already selected; it breaks the flow of navigation
openMenuOnFocus && _this.isOptionSelected(focusedOption, selectValue)) {
return;
}
_this.selectOption(focusedOption);
break;
case "Enter":
if (event.keyCode === 229) {
break;
}
if (menuIsOpen) {
if (!focusedOption) return;
if (_this.isComposing) return;
_this.selectOption(focusedOption);
break;
}
return;
case "Escape":
if (menuIsOpen) {
_this.setState({
inputIsHiddenAfterUpdate: false
});
_this.onInputChange("", {
action: "menu-close",
prevInputValue: inputValue
});
_this.onMenuClose();
} else if (isClearable && escapeClearsValue) {
_this.clearValue();
}
break;
case " ":
if (inputValue) {
return;
}
if (!menuIsOpen) {
_this.openMenu("first");
break;
}
if (!focusedOption) return;
_this.selectOption(focusedOption);
break;
case "ArrowUp":
if (menuIsOpen) {
_this.focusOption("up");
} else {
_this.openMenu("last");
}
break;
case "ArrowDown":
if (menuIsOpen) {
_this.focusOption("down");
} else {
_this.openMenu("first");
}
break;
case "PageUp":
if (!menuIsOpen) return;
_this.focusOption("pageup");
break;
case "PageDown":
if (!menuIsOpen) return;
_this.focusOption("pagedown");
break;
case "Home":
if (!menuIsOpen) return;
_this.focusOption("first");
break;
case "End":
if (!menuIsOpen) return;
_this.focusOption("last");
break;
default:
return;
}
event.preventDefault();
};
_this.state.instancePrefix = "react-select-" + (_this.props.instanceId || ++instanceId);
_this.state.selectValue = cleanValue(_props.value);
if (_props.menuIsOpen && _this.state.selectValue.length) {
var focusableOptionsWithIds = _this.getFocusableOptionsWithIds();
var focusableOptions = _this.buildFocusableOptions();
var optionIndex = focusableOptions.indexOf(_this.state.selectValue[0]);
_this.state.focusableOptionsWithIds = focusableOptionsWithIds;
_this.state.focusedOption = focusableOptions[optionIndex];
_this.state.focusedOptionId = getFocusedOptionId(focusableOptionsWithIds, focusableOptions[optionIndex]);
}
return _this;
}
_createClass(Select3, [{
key: "componentDidMount",
value: function componentDidMount() {
this.startListeningComposition();
this.startListeningToTouch();
if (this.props.closeMenuOnScroll && document && document.addEventListener) {
document.addEventListener("scroll", this.onScroll, true);
}
if (this.props.autoFocus) {
this.focusInput();
}
if (this.props.menuIsOpen && this.state.focusedOption && this.menuListRef && this.focusedOptionRef) {
scrollIntoView(this.menuListRef, this.focusedOptionRef);
}
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
var _this$props6 = this.props, isDisabled = _this$props6.isDisabled, menuIsOpen = _this$props6.menuIsOpen;
var isFocused = this.state.isFocused;
if (
// ensure focus is restored correctly when the control becomes enabled
isFocused && !isDisabled && prevProps.isDisabled || // ensure focus is on the Input when the menu opens
isFocused && menuIsOpen && !prevProps.menuIsOpen
) {
this.focusInput();
}
if (isFocused && isDisabled && !prevProps.isDisabled) {
this.setState({
isFocused: false
}, this.onMenuClose);
} else if (!isFocused && !isDisabled && prevProps.isDisabled && this.inputRef === document.activeElement) {
this.setState({
isFocused: true
});
}
if (this.menuListRef && this.focusedOptionRef && this.scrollToFocusedOptionOnUpdate) {
scrollIntoView(this.menuListRef, this.focusedOptionRef);
this.scrollToFocusedOptionOnUpdate = false;
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this.stopListeningComposition();
this.stopListeningToTouch();
document.removeEventListener("scroll", this.onScroll, true);
}
// ==============================
// Consumer Handlers
// ==============================
}, {
key: "onMenuOpen",
value: function onMenuOpen() {
this.props.onMenuOpen();
}
}, {
key: "onMenuClose",
value: function onMenuClose() {
this.onInputChange("", {
action: "menu-close",
prevInputValue: this.props.inputValue
});
this.props.onMenuClose();
}
}, {
key: "onInputChange",
value: function onInputChange(newValue, actionMeta) {
this.props.onInputChange(newValue, actionMeta);
}
// ==============================
// Methods
// ==============================
}, {
key: "focusInput",
value: function focusInput() {
if (!this.inputRef) return;
this.inputRef.focus();
}
}, {
key: "blurInput",
value: function blurInput() {
if (!this.inputRef) return;
this.inputRef.blur();
}
// aliased for consumers
}, {
key: "openMenu",
value: function openMenu(focusOption) {
var _this2 = this;
var _this$state2 = this.state, selectValue = _this$state2.selectValue, isFocused = _this$state2.isFocused;
var focusableOptions = this.buildFocusableOptions();
var openAtIndex = focusOption === "first" ? 0 : focusableOptions.length - 1;
if (!this.props.isMulti) {
var selectedIndex = focusableOptions.indexOf(selectValue[0]);
if (selectedIndex > -1) {
openAtIndex = selectedIndex;
}
}
this.scrollToFocusedOptionOnUpdate = !(isFocused && this.menuListRef);
this.setState({
inputIsHiddenAfterUpdate: false,
focusedValue: null,
focusedOption: focusableOptions[openAtIndex],
focusedOptionId: this.getFocusedOptionId(focusableOptions[openAtIndex])
}, function() {
return _this2.onMenuOpen();
});
}
}, {
key: "focusValue",
value: function focusValue(direction) {
var _this$state3 = this.state, selectValue = _this$state3.selectValue, focusedValue = _this$state3.focusedValue;
if (!this.props.isMulti) return;
this.setState({
focusedOption: null
});
var focusedIndex = selectValue.indexOf(focusedValue);
if (!focusedValue) {
focusedIndex = -1;
}
var lastIndex = selectValue.length - 1;
var nextFocus = -1;
if (!selectValue.length) return;
switch (direction) {
case "previous":
if (focusedIndex === 0) {
nextFocus = 0;
} else if (focusedIndex === -1) {
nextFocus = lastIndex;
} else {
nextFocus = focusedIndex - 1;
}
break;
case "next":
if (focusedIndex > -1 && focusedIndex < lastIndex) {
nextFocus = focusedIndex + 1;
}
break;
}
this.setState({
inputIsHidden: nextFocus !== -1,
focusedValue: selectValue[nextFocus]
});
}
}, {
key: "focusOption",
value: function focusOption() {
var direction = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "first";
var pageSize = this.props.pageSize;
var focusedOption = this.state.focusedOption;
var options2 = this.getFocusableOptions();
if (!options2.length) return;
var nextFocus = 0;
var focusedIndex = options2.indexOf(focusedOption);
if (!focusedOption) {
focusedIndex = -1;
}
if (direction === "up") {
nextFocus = focusedIndex > 0 ? focusedIndex - 1 : options2.length - 1;
} else if (direction === "down") {
nextFocus = (focusedIndex + 1) % options2.length;
} else if (direction === "pageup") {
nextFocus = focusedIndex - pageSize;
if (nextFocus < 0) nextFocus = 0;
} else if (direction === "pagedown") {
nextFocus = focusedIndex + pageSize;
if (nextFocus > options2.length - 1) nextFocus = options2.length - 1;
} else if (direction === "last") {
nextFocus = options2.length - 1;
}
this.scrollToFocusedOptionOnUpdate = true;
this.setState({
focusedOption: options2[nextFocus],
focusedValue: null,
focusedOptionId: this.getFocusedOptionId(options2[nextFocus])
});
}
}, {
key: "getTheme",
value: (
// ==============================
// Getters
// ==============================
function getTheme3() {
if (!this.props.theme) {
return defaultTheme;
}
if (typeof this.props.theme === "function") {
return this.props.theme(defaultTheme);
}
return _objectSpread2(_objectSpread2({}, defaultTheme), this.props.theme);
}
)
}, {
key: "getCommonProps",
value: function getCommonProps() {
var clearValue = this.clearValue, cx = this.cx, getStyles = this.getStyles, getClassNames = this.getClassNames, getValue = this.getValue, selectOption = this.selectOption, setValue = this.setValue, props = this.props;
var isMulti = props.isMulti, isRtl = props.isRtl, options2 = props.options;
var hasValue = this.hasValue();
return {
clearValue,
cx,
getStyles,
getClassNames,
getValue,
hasValue,
isMulti,
isRtl,
options: options2,
selectOption,
selectProps: props,
setValue,
theme: this.getTheme()
};
}
}, {
key: "hasValue",
value: function hasValue() {
var selectValue = this.state.selectValue;
return selectValue.length > 0;
}
}, {
key: "hasOptions",
value: function hasOptions() {
return !!this.getFocusableOptions().length;
}
}, {
key: "isClearable",
value: function isClearable() {
var _this$props7 = this.props, isClearable2 = _this$props7.isClearable, isMulti = _this$props7.isMulti;
if (isClearable2 === void 0) return isMulti;
return isClearable2;
}
}, {
key: "isOptionDisabled",
value: function isOptionDisabled3(option, selectValue) {
return _isOptionDisabled(this.props, option, selectValue);
}
}, {
key: "isOptionSelected",
value: function isOptionSelected(option, selectValue) {
return _isOptionSelected(this.props, option, selectValue);
}
}, {
key: "filterOption",
value: function filterOption(option, inputValue) {
return _filterOption(this.props, option, inputValue);
}
}, {
key: "formatOptionLabel",
value: function formatOptionLabel(data, context) {
if (typeof this.props.formatOptionLabel === "function") {
var _inputValue = this.props.inputValue;
var _selectValue = this.state.selectValue;
return this.props.formatOptionLabel(data, {
context,
inputValue: _inputValue,
selectValue: _selectValue
});
} else {
return this.getOptionLabel(data);
}
}
}, {
key: "formatGroupLabel",
value: function formatGroupLabel3(data) {
return this.props.formatGroupLabel(data);
}
// ==============================
// Mouse Handlers
// ==============================
}, {
key: "startListeningComposition",
value: (
// ==============================
// Composition Handlers
// ==============================
function startListeningComposition() {
if (document && document.addEventListener) {
document.addEventListener("compositionstart", this.onCompositionStart, false);
document.addEventListener("compositionend", this.onCompositionEnd, false);
}
}
)
}, {
key: "stopListeningComposition",
value: function stopListeningComposition() {
if (document && document.removeEventListener) {
document.removeEventListener("compositionstart", this.onCompositionStart);
document.removeEventListener("compositionend", this.onCompositionEnd);
}
}
}, {
key: "startListeningToTouch",
value: (
// ==============================
// Touch Handlers
// ==============================
function startListeningToTouch() {
if (document && document.addEventListener) {
document.addEventListener("touchstart", this.onTouchStart, false);
document.addEventListener("touchmove", this.onTouchMove, false);
document.addEventListener("touchend", this.onTouchEnd, false);
}
}
)
}, {
key: "stopListeningToTouch",
value: function stopListeningToTouch() {
if (document && document.removeEventListener) {
document.removeEventListener("touchstart", this.onTouchStart);
document.removeEventListener("touchmove", this.onTouchMove);
document.removeEventListener("touchend", this.onTouchEnd);
}
}
}, {
key: "renderInput",
value: (
// ==============================
// Renderers
// ==============================
function renderInput() {
var _this$props8 = this.props, isDisabled = _this$props8.isDisabled, isSearchable = _this$props8.isSearchable, inputId = _this$props8.inputId, inputValue = _this$props8.inputValue, tabIndex = _this$props8.tabIndex, form = _this$props8.form, menuIsOpen = _this$props8.menuIsOpen, required = _this$props8.required;
var _this$getComponents = this.getComponents(), Input3 = _this$getComponents.Input;
var _this$state4 = this.state, inputIsHidden = _this$state4.inputIsHidden, ariaSelection = _this$state4.ariaSelection;
var commonProps = this.commonProps;
var id = inputId || this.getElementId("input");
var ariaAttributes = _objectSpread2(_objectSpread2(_objectSpread2({
"aria-autocomplete": "list",
"aria-expanded": menuIsOpen,
"aria-haspopup": true,
"aria-errormessage": this.props["aria-errormessage"],
"aria-invalid": this.props["aria-invalid"],
"aria-label": this.props["aria-label"],
"aria-labelledby": this.props["aria-labelledby"],
"aria-required": required,
role: "combobox",
"aria-activedescendant": this.isAppleDevice ? void 0 : this.state.focusedOptionId || ""
}, menuIsOpen && {
"aria-controls": this.getElementId("listbox")
}), !isSearchable && {
"aria-readonly": true
}), this.hasValue() ? (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === "initial-input-focus" && {
"aria-describedby": this.getElementId("live-region")
} : {
"aria-describedby": this.getElementId("placeholder")
});
if (!isSearchable) {
return React8.createElement(DummyInput, _extends({
id,
innerRef: this.getInputRef,
onBlur: this.onInputBlur,
onChange: noop,
onFocus: this.onInputFocus,
disabled: isDisabled,
tabIndex,
inputMode: "none",
form,
value: ""
}, ariaAttributes));
}
return React8.createElement(Input3, _extends({}, commonProps, {
autoCapitalize: "none",
autoComplete: "off",
autoCorrect: "off",
id,
innerRef: this.getInputRef,
isDisabled,
isHidden: inputIsHidden,
onBlur: this.onInputBlur,
onChange: this.handleInputChange,
onFocus: this.onInputFocus,
spellCheck: "false",
tabIndex,
form,
type: "text",
value: inputValue
}, ariaAttributes));
}
)
}, {
key: "renderPlaceholderOrValue",
value: function renderPlaceholderOrValue() {
var _this3 = this;
var _this$getComponents2 = this.getComponents(), MultiValue3 = _this$getComponents2.MultiValue, MultiValueContainer2 = _this$getComponents2.MultiValueContainer, MultiValueLabel2 = _this$getComponents2.MultiValueLabel, MultiValueRemove2 = _this$getComponents2.MultiValueRemove, SingleValue3 = _this$getComponents2.SingleValue, Placeholder3 = _this$getComponents2.Placeholder;
var commonProps = this.commonProps;
var _this$props9 = this.props, controlShouldRenderValue = _this$props9.controlShouldRenderValue, isDisabled = _this$props9.isDisabled, isMulti = _this$props9.isMulti, inputValue = _this$props9.inputValue, placeholder = _this$props9.placeholder;
var _this$state5 = this.state, selectValue = _this$state5.selectValue, focusedValue = _this$state5.focusedValue, isFocused = _this$state5.isFocused;
if (!this.hasValue() || !controlShouldRenderValue) {
return inputValue ? null : React8.createElement(Placeholder3, _extends({}, commonProps, {
key: "placeholder",
isDisabled,
isFocused,
innerProps: {
id: this.getElementId("placeholder")
}
}), placeholder);
}
if (isMulti) {
return selectValue.map(function(opt, index2) {
var isOptionFocused = opt === focusedValue;
var key = "".concat(_this3.getOptionLabel(opt), "-").concat(_this3.getOptionValue(opt));
return React8.createElement(MultiValue3, _extends({}, commonProps, {
components: {
Container: MultiValueContainer2,
Label: MultiValueLabel2,
Remove: MultiValueRemove2
},
isFocused: isOptionFocused,
isDisabled,
key,
index: index2,
removeProps: {
onClick: function onClick() {
return _this3.removeValue(opt);
},
onTouchEnd: function onTouchEnd() {
return _this3.removeValue(opt);
},
onMouseDown: function onMouseDown(e) {
e.preventDefault();
}
},
data: opt
}), _this3.formatOptionLabel(opt, "value"));
});
}
if (inputValue) {
return null;
}
var singleValue = selectValue[0];
return React8.createElement(SingleValue3, _extends({}, commonProps, {
data: singleValue,
isDisabled
}), this.formatOptionLabel(singleValue, "value"));
}
}, {
key: "renderClearIndicator",
value: function renderClearIndicator() {
var _this$getComponents3 = this.getComponents(), ClearIndicator4 = _this$getComponents3.ClearIndicator;
var commonProps = this.commonProps;
var _this$props10 = this.props, isDisabled = _this$props10.isDisabled, isLoading = _this$props10.isLoading;
var isFocused = this.state.isFocused;
if (!this.isClearable() || !ClearIndicator4 || isDisabled || !this.hasValue() || isLoading) {
return null;
}
var innerProps = {
onMouseDown: this.onClearIndicatorMouseDown,
onTouchEnd: this.onClearIndicatorTouchEnd,
"aria-hidden": "true"
};
return React8.createElement(ClearIndicator4, _extends({}, commonProps, {
innerProps,
isFocused
}));
}
}, {
key: "renderLoadingIndicator",
value: function renderLoadingIndicator() {
var _this$getComponents4 = this.getComponents(), LoadingIndicator3 = _this$getComponents4.LoadingIndicator;
var commonProps = this.commonProps;
var _this$props11 = this.props, isDisabled = _this$props11.isDisabled, isLoading = _this$props11.isLoading;
var isFocused = this.state.isFocused;
if (!LoadingIndicator3 || !isLoading) return null;
var innerProps = {
"aria-hidden": "true"
};
return React8.createElement(LoadingIndicator3, _extends({}, commonProps, {
innerProps,
isDisabled,
isFocused
}));
}
}, {
key: "renderIndicatorSeparator",
value: function renderIndicatorSeparator() {
var _this$getComponents5 = this.getComponents(), DropdownIndicator4 = _this$getComponents5.DropdownIndicator, IndicatorSeparator3 = _this$getComponents5.IndicatorSeparator;
if (!DropdownIndicator4 || !IndicatorSeparator3) return null;
var commonProps = this.commonProps;
var isDisabled = this.props.isDisabled;
var isFocused = this.state.isFocused;
return React8.createElement(IndicatorSeparator3, _extends({}, commonProps, {
isDisabled,
isFocused
}));
}
}, {
key: "renderDropdownIndicator",
value: function renderDropdownIndicator() {
var _this$getComponents6 = this.getComponents(), DropdownIndicator4 = _this$getComponents6.DropdownIndicator;
if (!DropdownIndicator4) return null;
var commonProps = this.commonProps;
var isDisabled = this.props.isDisabled;
var isFocused = this.state.isFocused;
var innerProps = {
onMouseDown: this.onDropdownIndicatorMouseDown,
onTouchEnd: this.onDropdownIndicatorTouchEnd,
"aria-hidden": "true"
};
return React8.createElement(DropdownIndicator4, _extends({}, commonProps, {
innerProps,
isDisabled,
isFocused
}));
}
}, {
key: "renderMenu",
value: function renderMenu() {
var _this4 = this;
var _this$getComponents7 = this.getComponents(), Group3 = _this$getComponents7.Group, GroupHeading3 = _this$getComponents7.GroupHeading, Menu4 = _this$getComponents7.Menu, MenuList3 = _this$getComponents7.MenuList, MenuPortal3 = _this$getComponents7.MenuPortal, LoadingMessage3 = _this$getComponents7.LoadingMessage, NoOptionsMessage3 = _this$getComponents7.NoOptionsMessage, Option4 = _this$getComponents7.Option;
var commonProps = this.commonProps;
var focusedOption = this.state.focusedOption;
var _this$props12 = this.props, captureMenuScroll = _this$props12.captureMenuScroll, inputValue = _this$props12.inputValue, isLoading = _this$props12.isLoading, loadingMessage2 = _this$props12.loadingMessage, minMenuHeight = _this$props12.minMenuHeight, maxMenuHeight = _this$props12.maxMenuHeight, menuIsOpen = _this$props12.menuIsOpen, menuPlacement = _this$props12.menuPlacement, menuPosition = _this$props12.menuPosition, menuPortalTarget = _this$props12.menuPortalTarget, menuShouldBlockScroll = _this$props12.menuShouldBlockScroll, menuShouldScrollIntoView = _this$props12.menuShouldScrollIntoView, noOptionsMessage2 = _this$props12.noOptionsMessage, onMenuScrollToTop = _this$props12.onMenuScrollToTop, onMenuScrollToBottom = _this$props12.onMenuScrollToBottom;
if (!menuIsOpen) return null;
var render3 = function render4(props, id) {
var type = props.type, data = props.data, isDisabled = props.isDisabled, isSelected = props.isSelected, label = props.label, value = props.value;
var isFocused = focusedOption === data;
var onHover = isDisabled ? void 0 : function() {
return _this4.onOptionHover(data);
};
var onSelect = isDisabled ? void 0 : function() {
return _this4.selectOption(data);
};
var optionId = "".concat(_this4.getElementId("option"), "-").concat(id);
var innerProps = {
id: optionId,
onClick: onSelect,
onMouseMove: onHover,
onMouseOver: onHover,
tabIndex: -1,
role: "option",
"aria-selected": _this4.isAppleDevice ? void 0 : isSelected
// is not supported on Apple devices
};
return React8.createElement(Option4, _extends({}, commonProps, {
innerProps,
data,
isDisabled,
isSelected,
key: optionId,
label,
type,
value,
isFocused,
innerRef: isFocused ? _this4.getFocusedOptionRef : void 0
}), _this4.formatOptionLabel(props.data, "menu"));
};
var menuUI;
if (this.hasOptions()) {
menuUI = this.getCategorizedOptions().map(function(item) {
if (item.type === "group") {
var _data = item.data, options2 = item.options, groupIndex = item.index;
var groupId = "".concat(_this4.getElementId("group"), "-").concat(groupIndex);
var headingId = "".concat(groupId, "-heading");
return React8.createElement(Group3, _extends({}, commonProps, {
key: groupId,
data: _data,
options: options2,
Heading: GroupHeading3,
headingProps: {
id: headingId,
data: item.data
},
label: _this4.formatGroupLabel(item.data)
}), item.options.map(function(option) {
return render3(option, "".concat(groupIndex, "-").concat(option.index));
}));
} else if (item.type === "option") {
return render3(item, "".concat(item.index));
}
});
} else if (isLoading) {
var message = loadingMessage2({
inputValue
});
if (message === null) return null;
menuUI = React8.createElement(LoadingMessage3, commonProps, message);
} else {
var _message = noOptionsMessage2({
inputValue
});
if (_message === null) return null;
menuUI = React8.createElement(NoOptionsMessage3, commonProps, _message);
}
var menuPlacementProps = {
minMenuHeight,
maxMenuHeight,
menuPlacement,
menuPosition,
menuShouldScrollIntoView
};
var menuElement = React8.createElement(MenuPlacer, _extends({}, commonProps, menuPlacementProps), function(_ref4) {
var ref = _ref4.ref, _ref4$placerProps = _ref4.placerProps, placement = _ref4$placerProps.placement, maxHeight = _ref4$placerProps.maxHeight;
return React8.createElement(Menu4, _extends({}, commonProps, menuPlacementProps, {
innerRef: ref,
innerProps: {
onMouseDown: _this4.onMenuMouseDown,
onMouseMove: _this4.onMenuMouseMove
},
isLoading,
placement
}), React8.createElement(ScrollManager, {
captureEnabled: captureMenuScroll,
onTopArrive: onMenuScrollToTop,
onBottomArrive: onMenuScrollToBottom,
lockEnabled: menuShouldBlockScroll
}, function(scrollTargetRef) {
return React8.createElement(MenuList3, _extends({}, commonProps, {
innerRef: function innerRef(instance) {
_this4.getMenuListRef(instance);
scrollTargetRef(instance);
},
innerProps: {
role: "listbox",
"aria-multiselectable": commonProps.isMulti,
id: _this4.getElementId("listbox")
},
isLoading,
maxHeight,
focusedOption
}), menuUI);
}));
});
return menuPortalTarget || menuPosition === "fixed" ? React8.createElement(MenuPortal3, _extends({}, commonProps, {
appendTo: menuPortalTarget,
controlElement: this.controlRef,
menuPlacement,
menuPosition
}), menuElement) : menuElement;
}
}, {
key: "renderFormField",
value: function renderFormField() {
var _this5 = this;
var _this$props13 = this.props, delimiter2 = _this$props13.delimiter, isDisabled = _this$props13.isDisabled, isMulti = _this$props13.isMulti, name = _this$props13.name, required = _this$props13.required;
var selectValue = this.state.selectValue;
if (required && !this.hasValue() && !isDisabled) {
return React8.createElement(RequiredInput$1, {
name,
onFocus: this.onValueInputFocus
});
}
if (!name || isDisabled) return;
if (isMulti) {
if (delimiter2) {
var value = selectValue.map(function(opt) {
return _this5.getOptionValue(opt);
}).join(delimiter2);
return React8.createElement("input", {
name,
type: "hidden",
value
});
} else {
var input = selectValue.length > 0 ? selectValue.map(function(opt, i3) {
return React8.createElement("input", {
key: "i-".concat(i3),
name,
type: "hidden",
value: _this5.getOptionValue(opt)
});
}) : React8.createElement("input", {
name,
type: "hidden",
value: ""
});
return React8.createElement("div", null, input);
}
} else {
var _value2 = selectValue[0] ? this.getOptionValue(selectValue[0]) : "";
return React8.createElement("input", {
name,
type: "hidden",
value: _value2
});
}
}
}, {
key: "renderLiveRegion",
value: function renderLiveRegion() {
var commonProps = this.commonProps;
var _this$state6 = this.state, ariaSelection = _this$state6.ariaSelection, focusedOption = _this$state6.focusedOption, focusedValue = _this$state6.focusedValue, isFocused = _this$state6.isFocused, selectValue = _this$state6.selectValue;
var focusableOptions = this.getFocusableOptions();
return React8.createElement(LiveRegion$1, _extends({}, commonProps, {
id: this.getElementId("live-region"),
ariaSelection,
focusedOption,
focusedValue,
isFocused,
selectValue,
focusableOptions,
isAppleDevice: this.isAppleDevice
}));
}
}, {
key: "render",
value: function render3() {
var _this$getComponents8 = this.getComponents(), Control3 = _this$getComponents8.Control, IndicatorsContainer3 = _this$getComponents8.IndicatorsContainer, SelectContainer3 = _this$getComponents8.SelectContainer, ValueContainer3 = _this$getComponents8.ValueContainer;
var _this$props14 = this.props, className = _this$props14.className, id = _this$props14.id, isDisabled = _this$props14.isDisabled, menuIsOpen = _this$props14.menuIsOpen;
var isFocused = this.state.isFocused;
var commonProps = this.commonProps = this.getCommonProps();
return React8.createElement(SelectContainer3, _extends({}, commonProps, {
className,
innerProps: {
id,
onKeyDown: this.onKeyDown
},
isDisabled,
isFocused
}), this.renderLiveRegion(), React8.createElement(Control3, _extends({}, commonProps, {
innerRef: this.getControlRef,
innerProps: {
onMouseDown: this.onControlMouseDown,
onTouchEnd: this.onControlTouchEnd
},
isDisabled,
isFocused,
menuIsOpen
}), React8.createElement(ValueContainer3, _extends({}, commonProps, {
isDisabled
}), this.renderPlaceholderOrValue(), this.renderInput()), React8.createElement(IndicatorsContainer3, _extends({}, commonProps, {
isDisabled
}), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderIndicatorSeparator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField());
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(props, state) {
var prevProps = state.prevProps, clearFocusValueOnUpdate = state.clearFocusValueOnUpdate, inputIsHiddenAfterUpdate = state.inputIsHiddenAfterUpdate, ariaSelection = state.ariaSelection, isFocused = state.isFocused, prevWasFocused = state.prevWasFocused, instancePrefix = state.instancePrefix;
var options2 = props.options, value = props.value, menuIsOpen = props.menuIsOpen, inputValue = props.inputValue, isMulti = props.isMulti;
var selectValue = cleanValue(value);
var newMenuOptionsState = {};
if (prevProps && (value !== prevProps.value || options2 !== prevProps.options || menuIsOpen !== prevProps.menuIsOpen || inputValue !== prevProps.inputValue)) {
var focusableOptions = menuIsOpen ? buildFocusableOptions(props, selectValue) : [];
var focusableOptionsWithIds = menuIsOpen ? buildFocusableOptionsWithIds(buildCategorizedOptions(props, selectValue), "".concat(instancePrefix, "-option")) : [];
var focusedValue = clearFocusValueOnUpdate ? getNextFocusedValue(state, selectValue) : null;
var focusedOption = getNextFocusedOption(state, focusableOptions);
var focusedOptionId = getFocusedOptionId(focusableOptionsWithIds, focusedOption);
newMenuOptionsState = {
selectValue,
focusedOption,
focusedOptionId,
focusableOptionsWithIds,
focusedValue,
clearFocusValueOnUpdate: false
};
}
var newInputIsHiddenState = inputIsHiddenAfterUpdate != null && props !== prevProps ? {
inputIsHidden: inputIsHiddenAfterUpdate,
inputIsHiddenAfterUpdate: void 0
} : {};
var newAriaSelection = ariaSelection;
var hasKeptFocus = isFocused && prevWasFocused;
if (isFocused && !hasKeptFocus) {
newAriaSelection = {
value: valueTernary(isMulti, selectValue, selectValue[0] || null),
options: selectValue,
action: "initial-input-focus"
};
hasKeptFocus = !prevWasFocused;
}
if ((ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === "initial-input-focus") {
newAriaSelection = null;
}
return _objectSpread2(_objectSpread2(_objectSpread2({}, newMenuOptionsState), newInputIsHiddenState), {}, {
prevProps: props,
ariaSelection: newAriaSelection,
prevWasFocused: hasKeptFocus
});
}
}]);
return Select3;
}(import_react6.Component);
Select.defaultProps = defaultProps;
// node_modules/react-select/dist/react-select.esm.js
var import_react_dom2 = __toESM(require_react_dom());
var StateManagedSelect = (0, import_react8.forwardRef)(function(props, ref) {
var baseSelectProps = useStateManager(props);
return React9.createElement(Select, _extends({
ref
}, baseSelectProps));
});
var StateManagedSelect$1 = StateManagedSelect;
// node_modules/@strapi/upload/dist/admin/components/SelectTree/Option.mjs
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
var import_react10 = __toESM(require_react(), 1);
var ToggleButton = dt(Flex)`
align-self: flex-end;
height: 2.2rem;
width: 2.8rem;
&:hover,
&:focus {
background-color: ${({ theme }) => theme.colors.primary200};
}
`;
var Option3 = ({ children, data, selectProps, ...props }) => {
const { formatMessage } = useIntl();
const { depth, value, children: options2 } = data;
const { maxDisplayDepth, openValues, onOptionToggle } = selectProps;
const isOpen = openValues.includes(value);
const Icon = isOpen ? ForwardRef$4t : ForwardRef$4z;
return (0, import_jsx_runtime2.jsx)(components.Option, {
data,
selectProps,
...props,
children: (0, import_jsx_runtime2.jsxs)(Flex, {
alignItems: "start",
children: [
(0, import_jsx_runtime2.jsx)(Typography, {
textColor: "neutral800",
ellipsis: true,
children: (0, import_jsx_runtime2.jsx)("span", {
style: {
paddingLeft: `${Math.min(depth, maxDisplayDepth) * 14}px`
},
children
})
}),
options2 && (options2 == null ? void 0 : options2.length) > 0 && (0, import_jsx_runtime2.jsx)(ToggleButton, {
"aria-label": formatMessage({
id: "app.utils.toggle",
defaultMessage: "Toggle"
}),
tag: "button",
alignItems: "center",
hasRadius: true,
justifyContent: "center",
marginLeft: "auto",
onClick: (event) => {
event.preventDefault();
event.stopPropagation();
onOptionToggle(value);
},
children: (0, import_jsx_runtime2.jsx)(Icon, {
width: "1.4rem",
fill: "neutral500"
})
})
]
})
});
};
// node_modules/@strapi/upload/dist/admin/components/SelectTree/utils/flattenTree.mjs
function flattenTree(tree, parent = null, depth = 0) {
return tree.flatMap((item) => item.children ? [
{
...item,
parent: parent == null ? void 0 : parent.value,
depth
},
...flattenTree(item.children, item, depth + 1)
] : {
...item,
depth,
parent: parent == null ? void 0 : parent.value
});
}
// node_modules/@strapi/upload/dist/admin/components/SelectTree/utils/getOpenValues.mjs
function getOpenValues(options2, defaultValue = {}) {
const values = [];
const { value } = defaultValue;
const option = options2.find((option2) => option2.value === value);
if (!option) {
return values;
}
values.push(option.value);
let { parent } = option;
while (parent !== void 0) {
const option2 = options2.find(({ value: value2 }) => value2 === parent);
if (!option2) {
break;
}
values.push(option2.value);
parent = option2.parent;
}
return values.reverse();
}
// node_modules/@strapi/upload/dist/admin/components/SelectTree/utils/getValuesToClose.mjs
function getValuesToClose(options2, value) {
const optionForValue = options2.find((option) => option.value === value);
if (!optionForValue) {
return [];
}
return options2.filter((option) => option.depth >= optionForValue.depth).map((option) => option.value);
}
// node_modules/@strapi/upload/dist/admin/components/SelectTree/SelectTree.mjs
var hasParent = (option) => !option.parent;
var SelectTree = ({ options: defaultOptions, maxDisplayDepth = 5, defaultValue, ...props }) => {
const flatDefaultOptions = React10.useMemo(() => flattenTree(defaultOptions), [
defaultOptions
]);
const optionsFiltered = React10.useMemo(() => flatDefaultOptions.filter(hasParent), [
flatDefaultOptions
]);
const [options2, setOptions] = React10.useState(optionsFiltered);
const [openValues, setOpenValues] = React10.useState(getOpenValues(flatDefaultOptions, defaultValue));
React10.useEffect(() => {
if (openValues.length === 0) {
setOptions(flatDefaultOptions.filter((option) => option.parent === void 0));
} else {
const allOpenValues = openValues.reduce((acc, value) => {
const options3 = flatDefaultOptions.filter((option) => option.value === value || option.parent === value);
options3.forEach((option) => {
const values = getOpenValues(flatDefaultOptions, option);
acc = [
...acc,
...values
];
});
return acc;
}, []);
const nextOptions = flatDefaultOptions.filter((option) => allOpenValues.includes(option.value));
setOptions(nextOptions);
}
}, [
openValues,
flatDefaultOptions,
optionsFiltered
]);
const handleToggle = (value) => {
if (openValues.includes(value)) {
const valuesToClose = getValuesToClose(flatDefaultOptions, value);
setOpenValues((prev2) => prev2.filter((prevData) => !valuesToClose.includes(prevData)));
} else {
setOpenValues((prev2) => [
...prev2,
value
]);
}
};
return (0, import_jsx_runtime3.jsx)(Select2, {
components: {
Option: Option3
},
options: options2,
defaultValue,
isSearchable: false,
/* -- custom props, used by the Option component */
maxDisplayDepth,
openValues,
onOptionToggle: handleToggle,
...props
});
};
var Select2 = ({ components: components2 = {}, styles = {}, error, ariaErrorMessage, ...props }) => {
const theme = nt();
const customStyles = getSelectStyles(theme, error);
return (0, import_jsx_runtime3.jsx)(StateManagedSelect$1, {
menuPosition: "fixed",
components: {
...components2,
ClearIndicator: ClearIndicator3,
DropdownIndicator: DropdownIndicator3,
IndicatorSeparator: () => null,
LoadingIndicator: () => null
},
"aria-errormessage": error && ariaErrorMessage,
"aria-invalid": !!error,
styles: {
...customStyles,
...styles
},
...props
});
};
var IconBox = dt(Box)`
background: transparent;
border: none;
position: relative;
z-index: 1;
svg {
height: 1.1rem;
width: 1.1rem;
}
svg path {
fill: ${({ theme }) => theme.colors.neutral600};
}
`;
var ClearIndicator3 = (props) => {
const Component2 = components.ClearIndicator;
return (0, import_jsx_runtime3.jsx)(Component2, {
...props,
children: (0, import_jsx_runtime3.jsx)(IconBox, {
tag: "button",
type: "button",
children: (0, import_jsx_runtime3.jsx)(ForwardRef$45, {})
})
});
};
var CarretBox = dt(IconBox)`
display: flex;
background: none;
border: none;
svg {
width: 0.9rem;
}
`;
var DropdownIndicator3 = ({ innerProps }) => {
return (0, import_jsx_runtime3.jsx)(CarretBox, {
paddingRight: 3,
...innerProps,
children: (0, import_jsx_runtime3.jsx)(ForwardRef$4T, {})
});
};
var getSelectStyles = (theme, error) => {
return {
clearIndicator: (base) => ({
...base,
padding: 0,
paddingRight: theme.spaces[3]
}),
container: (base) => ({
...base,
background: theme.colors.neutral0,
lineHeight: "normal"
}),
control(base, state) {
let borderColor = theme.colors.neutral200;
let boxShadowColor = void 0;
let backgroundColor = void 0;
if (state.isFocused) {
borderColor = theme.colors.primary600;
boxShadowColor = theme.colors.primary600;
} else if (error) {
borderColor = theme.colors.danger600;
}
if (state.isDisabled) {
backgroundColor = `${theme.colors.neutral150} !important`;
}
return {
...base,
fontSize: theme.fontSizes[2],
height: 40,
border: `1px solid ${borderColor} !important`,
outline: 0,
backgroundColor,
borderRadius: theme.borderRadius,
boxShadow: boxShadowColor ? `${boxShadowColor} 0px 0px 0px 2px` : ""
};
},
indicatorsContainer: (base) => ({
...base,
padding: 0,
paddingRight: theme.spaces[3]
}),
input: (base) => ({
...base,
margin: 0,
padding: 0,
color: theme.colors.neutral800,
gridTemplateColumns: "0 100%"
}),
menuPortal: (base) => ({
...base,
zIndex: theme.zIndices.dialog,
pointerEvents: "auto"
}),
menu(base) {
return {
...base,
width: "100%",
marginTop: theme.spaces[1],
backgroundColor: theme.colors.neutral0,
color: theme.colors.neutral800,
borderRadius: theme.borderRadius,
border: `1px solid ${theme.colors.neutral200}`,
boxShadow: theme.shadows.tableShadow,
fontSize: theme.fontSizes[2],
zIndex: 2
};
},
menuList: (base) => ({
...base,
paddingLeft: theme.spaces[1],
paddingTop: theme.spaces[1],
paddingRight: theme.spaces[1],
paddingBottom: theme.spaces[1]
}),
// eslint-disable-next-line @typescript-eslint/no-explicit-any
option(base, state) {
let backgroundColor = base == null ? void 0 : base.backgroundColor;
if (state.isFocused || state.isSelected) {
backgroundColor = theme.colors.primary100;
}
return {
...base,
color: theme.colors.neutral800,
lineHeight: theme.spaces[5],
backgroundColor,
borderRadius: theme.borderRadius,
"&:active": {
backgroundColor: theme.colors.primary100
}
};
},
placeholder: (base) => ({
...base,
color: theme.colors.neutral600,
marginLeft: 0,
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
maxWidth: "80%"
}),
singleValue(base, state) {
let color = theme.colors.neutral800;
if (state.isDisabled) {
color = theme.colors.neutral600;
}
return {
...base,
marginLeft: 0,
color
};
},
valueContainer: (base) => ({
...base,
cursor: "pointer",
padding: 0,
paddingLeft: theme.spaces[4],
marginLeft: 0,
marginRight: 0
})
};
};
// node_modules/@strapi/upload/dist/admin/components/EditAssetDialog/DialogHeader.mjs
var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
var DialogHeader = () => {
const { formatMessage } = useIntl();
return (0, import_jsx_runtime4.jsx)(Modal.Header, {
children: (0, import_jsx_runtime4.jsx)(Modal.Title, {
children: formatMessage({
id: "global.details",
defaultMessage: "Details"
})
})
});
};
// node_modules/@strapi/upload/dist/admin/components/EditAssetDialog/PreviewBox/PreviewBox.mjs
var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
var React14 = __toESM(require_react(), 1);
// node_modules/@strapi/upload/dist/admin/hooks/useCropImg.mjs
var React11 = __toESM(require_react(), 1);
// node_modules/cropperjs/dist/cropper.esm.js
function ownKeys(e, r9) {
var t2 = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o2 = Object.getOwnPropertySymbols(e);
r9 && (o2 = o2.filter(function(r10) {
return Object.getOwnPropertyDescriptor(e, r10).enumerable;
})), t2.push.apply(t2, o2);
}
return t2;
}
function _objectSpread22(e) {
for (var r9 = 1; r9 < arguments.length; r9++) {
var t2 = null != arguments[r9] ? arguments[r9] : {};
r9 % 2 ? ownKeys(Object(t2), true).forEach(function(r10) {
_defineProperty2(e, r10, t2[r10]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys(Object(t2)).forEach(function(r10) {
Object.defineProperty(e, r10, Object.getOwnPropertyDescriptor(t2, r10));
});
}
return e;
}
function _typeof2(o2) {
"@babel/helpers - typeof";
return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) {
return typeof o3;
} : function(o3) {
return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3;
}, _typeof2(o2);
}
function _classCallCheck2(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i3 = 0; i3 < props.length; i3++) {
var descriptor = props[i3];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass2(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
function _defineProperty2(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _toConsumableArray2(arr) {
return _arrayWithoutHoles2(arr) || _iterableToArray2(arr) || _unsupportedIterableToArray2(arr) || _nonIterableSpread2();
}
function _arrayWithoutHoles2(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray2(arr);
}
function _iterableToArray2(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _unsupportedIterableToArray2(o2, minLen) {
if (!o2) return;
if (typeof o2 === "string") return _arrayLikeToArray2(o2, minLen);
var n2 = Object.prototype.toString.call(o2).slice(8, -1);
if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name;
if (n2 === "Map" || n2 === "Set") return Array.from(o2);
if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray2(o2, minLen);
}
function _arrayLikeToArray2(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i3 = 0, arr2 = new Array(len); i3 < len; i3++) arr2[i3] = arr[i3];
return arr2;
}
function _nonIterableSpread2() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== void 0) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}
var IS_BROWSER = typeof window !== "undefined" && typeof window.document !== "undefined";
var WINDOW = IS_BROWSER ? window : {};
var IS_TOUCH_DEVICE = IS_BROWSER && WINDOW.document.documentElement ? "ontouchstart" in WINDOW.document.documentElement : false;
var HAS_POINTER_EVENT = IS_BROWSER ? "PointerEvent" in WINDOW : false;
var NAMESPACE = "cropper";
var ACTION_ALL = "all";
var ACTION_CROP = "crop";
var ACTION_MOVE = "move";
var ACTION_ZOOM = "zoom";
var ACTION_EAST = "e";
var ACTION_WEST = "w";
var ACTION_SOUTH = "s";
var ACTION_NORTH = "n";
var ACTION_NORTH_EAST = "ne";
var ACTION_NORTH_WEST = "nw";
var ACTION_SOUTH_EAST = "se";
var ACTION_SOUTH_WEST = "sw";
var CLASS_CROP = "".concat(NAMESPACE, "-crop");
var CLASS_DISABLED = "".concat(NAMESPACE, "-disabled");
var CLASS_HIDDEN = "".concat(NAMESPACE, "-hidden");
var CLASS_HIDE = "".concat(NAMESPACE, "-hide");
var CLASS_INVISIBLE = "".concat(NAMESPACE, "-invisible");
var CLASS_MODAL = "".concat(NAMESPACE, "-modal");
var CLASS_MOVE = "".concat(NAMESPACE, "-move");
var DATA_ACTION = "".concat(NAMESPACE, "Action");
var DATA_PREVIEW = "".concat(NAMESPACE, "Preview");
var DRAG_MODE_CROP = "crop";
var DRAG_MODE_MOVE = "move";
var DRAG_MODE_NONE = "none";
var EVENT_CROP = "crop";
var EVENT_CROP_END = "cropend";
var EVENT_CROP_MOVE = "cropmove";
var EVENT_CROP_START = "cropstart";
var EVENT_DBLCLICK = "dblclick";
var EVENT_TOUCH_START = IS_TOUCH_DEVICE ? "touchstart" : "mousedown";
var EVENT_TOUCH_MOVE = IS_TOUCH_DEVICE ? "touchmove" : "mousemove";
var EVENT_TOUCH_END = IS_TOUCH_DEVICE ? "touchend touchcancel" : "mouseup";
var EVENT_POINTER_DOWN = HAS_POINTER_EVENT ? "pointerdown" : EVENT_TOUCH_START;
var EVENT_POINTER_MOVE = HAS_POINTER_EVENT ? "pointermove" : EVENT_TOUCH_MOVE;
var EVENT_POINTER_UP = HAS_POINTER_EVENT ? "pointerup pointercancel" : EVENT_TOUCH_END;
var EVENT_READY = "ready";
var EVENT_RESIZE = "resize";
var EVENT_WHEEL = "wheel";
var EVENT_ZOOM = "zoom";
var MIME_TYPE_JPEG = "image/jpeg";
var REGEXP_ACTIONS = /^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/;
var REGEXP_DATA_URL = /^data:/;
var REGEXP_DATA_URL_JPEG = /^data:image\/jpeg;base64,/;
var REGEXP_TAG_NAME = /^img|canvas$/i;
var MIN_CONTAINER_WIDTH = 200;
var MIN_CONTAINER_HEIGHT = 100;
var DEFAULTS = {
// Define the view mode of the cropper
viewMode: 0,
// 0, 1, 2, 3
// Define the dragging mode of the cropper
dragMode: DRAG_MODE_CROP,
// 'crop', 'move' or 'none'
// Define the initial aspect ratio of the crop box
initialAspectRatio: NaN,
// Define the aspect ratio of the crop box
aspectRatio: NaN,
// An object with the previous cropping result data
data: null,
// A selector for adding extra containers to preview
preview: "",
// Re-render the cropper when resize the window
responsive: true,
// Restore the cropped area after resize the window
restore: true,
// Check if the current image is a cross-origin image
checkCrossOrigin: true,
// Check the current image's Exif Orientation information
checkOrientation: true,
// Show the black modal
modal: true,
// Show the dashed lines for guiding
guides: true,
// Show the center indicator for guiding
center: true,
// Show the white modal to highlight the crop box
highlight: true,
// Show the grid background
background: true,
// Enable to crop the image automatically when initialize
autoCrop: true,
// Define the percentage of automatic cropping area when initializes
autoCropArea: 0.8,
// Enable to move the image
movable: true,
// Enable to rotate the image
rotatable: true,
// Enable to scale the image
scalable: true,
// Enable to zoom the image
zoomable: true,
// Enable to zoom the image by dragging touch
zoomOnTouch: true,
// Enable to zoom the image by wheeling mouse
zoomOnWheel: true,
// Define zoom ratio when zoom the image by wheeling mouse
wheelZoomRatio: 0.1,
// Enable to move the crop box
cropBoxMovable: true,
// Enable to resize the crop box
cropBoxResizable: true,
// Toggle drag mode between "crop" and "move" when click twice on the cropper
toggleDragModeOnDblclick: true,
// Size limitation
minCanvasWidth: 0,
minCanvasHeight: 0,
minCropBoxWidth: 0,
minCropBoxHeight: 0,
minContainerWidth: MIN_CONTAINER_WIDTH,
minContainerHeight: MIN_CONTAINER_HEIGHT,
// Shortcuts of events
ready: null,
cropstart: null,
cropmove: null,
cropend: null,
crop: null,
zoom: null
};
var TEMPLATE = '
';
var isNaN2 = Number.isNaN || WINDOW.isNaN;
function isNumber(value) {
return typeof value === "number" && !isNaN2(value);
}
var isPositiveNumber = function isPositiveNumber2(value) {
return value > 0 && value < Infinity;
};
function isUndefined(value) {
return typeof value === "undefined";
}
function isObject(value) {
return _typeof2(value) === "object" && value !== null;
}
var hasOwnProperty = Object.prototype.hasOwnProperty;
function isPlainObject(value) {
if (!isObject(value)) {
return false;
}
try {
var _constructor = value.constructor;
var prototype = _constructor.prototype;
return _constructor && prototype && hasOwnProperty.call(prototype, "isPrototypeOf");
} catch (error) {
return false;
}
}
function isFunction(value) {
return typeof value === "function";
}
var slice2 = Array.prototype.slice;
function toArray(value) {
return Array.from ? Array.from(value) : slice2.call(value);
}
function forEach(data, callback) {
if (data && isFunction(callback)) {
if (Array.isArray(data) || isNumber(data.length)) {
toArray(data).forEach(function(value, key) {
callback.call(data, value, key, data);
});
} else if (isObject(data)) {
Object.keys(data).forEach(function(key) {
callback.call(data, data[key], key, data);
});
}
}
return data;
}
var assign2 = Object.assign || function assign3(target) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
if (isObject(target) && args.length > 0) {
args.forEach(function(arg) {
if (isObject(arg)) {
Object.keys(arg).forEach(function(key) {
target[key] = arg[key];
});
}
});
}
return target;
};
var REGEXP_DECIMALS = /\.\d*(?:0|9){12}\d*$/;
function normalizeDecimalNumber(value) {
var times = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1e11;
return REGEXP_DECIMALS.test(value) ? Math.round(value * times) / times : value;
}
var REGEXP_SUFFIX = /^width|height|left|top|marginLeft|marginTop$/;
function setStyle(element, styles) {
var style = element.style;
forEach(styles, function(value, property) {
if (REGEXP_SUFFIX.test(property) && isNumber(value)) {
value = "".concat(value, "px");
}
style[property] = value;
});
}
function hasClass(element, value) {
return element.classList ? element.classList.contains(value) : element.className.indexOf(value) > -1;
}
function addClass(element, value) {
if (!value) {
return;
}
if (isNumber(element.length)) {
forEach(element, function(elem) {
addClass(elem, value);
});
return;
}
if (element.classList) {
element.classList.add(value);
return;
}
var className = element.className.trim();
if (!className) {
element.className = value;
} else if (className.indexOf(value) < 0) {
element.className = "".concat(className, " ").concat(value);
}
}
function removeClass(element, value) {
if (!value) {
return;
}
if (isNumber(element.length)) {
forEach(element, function(elem) {
removeClass(elem, value);
});
return;
}
if (element.classList) {
element.classList.remove(value);
return;
}
if (element.className.indexOf(value) >= 0) {
element.className = element.className.replace(value, "");
}
}
function toggleClass(element, value, added) {
if (!value) {
return;
}
if (isNumber(element.length)) {
forEach(element, function(elem) {
toggleClass(elem, value, added);
});
return;
}
if (added) {
addClass(element, value);
} else {
removeClass(element, value);
}
}
var REGEXP_CAMEL_CASE = /([a-z\d])([A-Z])/g;
function toParamCase(value) {
return value.replace(REGEXP_CAMEL_CASE, "$1-$2").toLowerCase();
}
function getData(element, name) {
if (isObject(element[name])) {
return element[name];
}
if (element.dataset) {
return element.dataset[name];
}
return element.getAttribute("data-".concat(toParamCase(name)));
}
function setData(element, name, data) {
if (isObject(data)) {
element[name] = data;
} else if (element.dataset) {
element.dataset[name] = data;
} else {
element.setAttribute("data-".concat(toParamCase(name)), data);
}
}
function removeData(element, name) {
if (isObject(element[name])) {
try {
delete element[name];
} catch (error) {
element[name] = void 0;
}
} else if (element.dataset) {
try {
delete element.dataset[name];
} catch (error) {
element.dataset[name] = void 0;
}
} else {
element.removeAttribute("data-".concat(toParamCase(name)));
}
}
var REGEXP_SPACES = /\s\s*/;
var onceSupported = function() {
var supported = false;
if (IS_BROWSER) {
var once = false;
var listener = function listener2() {
};
var options2 = Object.defineProperty({}, "once", {
get: function get() {
supported = true;
return once;
},
/**
* This setter can fix a `TypeError` in strict mode
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Getter_only}
* @param {boolean} value - The value to set
*/
set: function set(value) {
once = value;
}
});
WINDOW.addEventListener("test", listener, options2);
WINDOW.removeEventListener("test", listener, options2);
}
return supported;
}();
function removeListener(element, type, listener) {
var options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
var handler = listener;
type.trim().split(REGEXP_SPACES).forEach(function(event) {
if (!onceSupported) {
var listeners = element.listeners;
if (listeners && listeners[event] && listeners[event][listener]) {
handler = listeners[event][listener];
delete listeners[event][listener];
if (Object.keys(listeners[event]).length === 0) {
delete listeners[event];
}
if (Object.keys(listeners).length === 0) {
delete element.listeners;
}
}
}
element.removeEventListener(event, handler, options2);
});
}
function addListener(element, type, listener) {
var options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
var _handler = listener;
type.trim().split(REGEXP_SPACES).forEach(function(event) {
if (options2.once && !onceSupported) {
var _element$listeners = element.listeners, listeners = _element$listeners === void 0 ? {} : _element$listeners;
_handler = function handler() {
delete listeners[event][listener];
element.removeEventListener(event, _handler, options2);
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
listener.apply(element, args);
};
if (!listeners[event]) {
listeners[event] = {};
}
if (listeners[event][listener]) {
element.removeEventListener(event, listeners[event][listener], options2);
}
listeners[event][listener] = _handler;
element.listeners = listeners;
}
element.addEventListener(event, _handler, options2);
});
}
function dispatchEvent(element, type, data) {
var event;
if (isFunction(Event) && isFunction(CustomEvent)) {
event = new CustomEvent(type, {
detail: data,
bubbles: true,
cancelable: true
});
} else {
event = document.createEvent("CustomEvent");
event.initCustomEvent(type, true, true, data);
}
return element.dispatchEvent(event);
}
function getOffset(element) {
var box = element.getBoundingClientRect();
return {
left: box.left + (window.pageXOffset - document.documentElement.clientLeft),
top: box.top + (window.pageYOffset - document.documentElement.clientTop)
};
}
var location2 = WINDOW.location;
var REGEXP_ORIGINS = /^(\w+:)\/\/([^:/?#]*):?(\d*)/i;
function isCrossOriginURL(url) {
var parts = url.match(REGEXP_ORIGINS);
return parts !== null && (parts[1] !== location2.protocol || parts[2] !== location2.hostname || parts[3] !== location2.port);
}
function addTimestamp(url) {
var timestamp = "timestamp=".concat((/* @__PURE__ */ new Date()).getTime());
return url + (url.indexOf("?") === -1 ? "?" : "&") + timestamp;
}
function getTransforms(_ref3) {
var rotate2 = _ref3.rotate, scaleX2 = _ref3.scaleX, scaleY2 = _ref3.scaleY, translateX = _ref3.translateX, translateY = _ref3.translateY;
var values = [];
if (isNumber(translateX) && translateX !== 0) {
values.push("translateX(".concat(translateX, "px)"));
}
if (isNumber(translateY) && translateY !== 0) {
values.push("translateY(".concat(translateY, "px)"));
}
if (isNumber(rotate2) && rotate2 !== 0) {
values.push("rotate(".concat(rotate2, "deg)"));
}
if (isNumber(scaleX2) && scaleX2 !== 1) {
values.push("scaleX(".concat(scaleX2, ")"));
}
if (isNumber(scaleY2) && scaleY2 !== 1) {
values.push("scaleY(".concat(scaleY2, ")"));
}
var transform = values.length ? values.join(" ") : "none";
return {
WebkitTransform: transform,
msTransform: transform,
transform
};
}
function getMaxZoomRatio(pointers) {
var pointers2 = _objectSpread22({}, pointers);
var maxRatio = 0;
forEach(pointers, function(pointer, pointerId) {
delete pointers2[pointerId];
forEach(pointers2, function(pointer2) {
var x1 = Math.abs(pointer.startX - pointer2.startX);
var y1 = Math.abs(pointer.startY - pointer2.startY);
var x2 = Math.abs(pointer.endX - pointer2.endX);
var y22 = Math.abs(pointer.endY - pointer2.endY);
var z1 = Math.sqrt(x1 * x1 + y1 * y1);
var z22 = Math.sqrt(x2 * x2 + y22 * y22);
var ratio = (z22 - z1) / z1;
if (Math.abs(ratio) > Math.abs(maxRatio)) {
maxRatio = ratio;
}
});
});
return maxRatio;
}
function getPointer(_ref23, endOnly) {
var pageX = _ref23.pageX, pageY = _ref23.pageY;
var end = {
endX: pageX,
endY: pageY
};
return endOnly ? end : _objectSpread22({
startX: pageX,
startY: pageY
}, end);
}
function getPointersCenter(pointers) {
var pageX = 0;
var pageY = 0;
var count = 0;
forEach(pointers, function(_ref3) {
var startX = _ref3.startX, startY = _ref3.startY;
pageX += startX;
pageY += startY;
count += 1;
});
pageX /= count;
pageY /= count;
return {
pageX,
pageY
};
}
function getAdjustedSizes(_ref4) {
var aspectRatio = _ref4.aspectRatio, height = _ref4.height, width = _ref4.width;
var type = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "contain";
var isValidWidth = isPositiveNumber(width);
var isValidHeight = isPositiveNumber(height);
if (isValidWidth && isValidHeight) {
var adjustedWidth = height * aspectRatio;
if (type === "contain" && adjustedWidth > width || type === "cover" && adjustedWidth < width) {
height = width / aspectRatio;
} else {
width = height * aspectRatio;
}
} else if (isValidWidth) {
height = width / aspectRatio;
} else if (isValidHeight) {
width = height * aspectRatio;
}
return {
width,
height
};
}
function getRotatedSizes(_ref5) {
var width = _ref5.width, height = _ref5.height, degree = _ref5.degree;
degree = Math.abs(degree) % 180;
if (degree === 90) {
return {
width: height,
height: width
};
}
var arc = degree % 90 * Math.PI / 180;
var sinArc = Math.sin(arc);
var cosArc = Math.cos(arc);
var newWidth = width * cosArc + height * sinArc;
var newHeight = width * sinArc + height * cosArc;
return degree > 90 ? {
width: newHeight,
height: newWidth
} : {
width: newWidth,
height: newHeight
};
}
function getSourceCanvas(image, _ref6, _ref7, _ref8) {
var imageAspectRatio = _ref6.aspectRatio, imageNaturalWidth = _ref6.naturalWidth, imageNaturalHeight = _ref6.naturalHeight, _ref6$rotate = _ref6.rotate, rotate2 = _ref6$rotate === void 0 ? 0 : _ref6$rotate, _ref6$scaleX = _ref6.scaleX, scaleX2 = _ref6$scaleX === void 0 ? 1 : _ref6$scaleX, _ref6$scaleY = _ref6.scaleY, scaleY2 = _ref6$scaleY === void 0 ? 1 : _ref6$scaleY;
var aspectRatio = _ref7.aspectRatio, naturalWidth = _ref7.naturalWidth, naturalHeight = _ref7.naturalHeight;
var _ref8$fillColor = _ref8.fillColor, fillColor = _ref8$fillColor === void 0 ? "transparent" : _ref8$fillColor, _ref8$imageSmoothingE = _ref8.imageSmoothingEnabled, imageSmoothingEnabled = _ref8$imageSmoothingE === void 0 ? true : _ref8$imageSmoothingE, _ref8$imageSmoothingQ = _ref8.imageSmoothingQuality, imageSmoothingQuality = _ref8$imageSmoothingQ === void 0 ? "low" : _ref8$imageSmoothingQ, _ref8$maxWidth = _ref8.maxWidth, maxWidth = _ref8$maxWidth === void 0 ? Infinity : _ref8$maxWidth, _ref8$maxHeight = _ref8.maxHeight, maxHeight = _ref8$maxHeight === void 0 ? Infinity : _ref8$maxHeight, _ref8$minWidth = _ref8.minWidth, minWidth = _ref8$minWidth === void 0 ? 0 : _ref8$minWidth, _ref8$minHeight = _ref8.minHeight, minHeight = _ref8$minHeight === void 0 ? 0 : _ref8$minHeight;
var canvas = document.createElement("canvas");
var context = canvas.getContext("2d");
var maxSizes = getAdjustedSizes({
aspectRatio,
width: maxWidth,
height: maxHeight
});
var minSizes = getAdjustedSizes({
aspectRatio,
width: minWidth,
height: minHeight
}, "cover");
var width = Math.min(maxSizes.width, Math.max(minSizes.width, naturalWidth));
var height = Math.min(maxSizes.height, Math.max(minSizes.height, naturalHeight));
var destMaxSizes = getAdjustedSizes({
aspectRatio: imageAspectRatio,
width: maxWidth,
height: maxHeight
});
var destMinSizes = getAdjustedSizes({
aspectRatio: imageAspectRatio,
width: minWidth,
height: minHeight
}, "cover");
var destWidth = Math.min(destMaxSizes.width, Math.max(destMinSizes.width, imageNaturalWidth));
var destHeight = Math.min(destMaxSizes.height, Math.max(destMinSizes.height, imageNaturalHeight));
var params = [-destWidth / 2, -destHeight / 2, destWidth, destHeight];
canvas.width = normalizeDecimalNumber(width);
canvas.height = normalizeDecimalNumber(height);
context.fillStyle = fillColor;
context.fillRect(0, 0, width, height);
context.save();
context.translate(width / 2, height / 2);
context.rotate(rotate2 * Math.PI / 180);
context.scale(scaleX2, scaleY2);
context.imageSmoothingEnabled = imageSmoothingEnabled;
context.imageSmoothingQuality = imageSmoothingQuality;
context.drawImage.apply(context, [image].concat(_toConsumableArray2(params.map(function(param) {
return Math.floor(normalizeDecimalNumber(param));
}))));
context.restore();
return canvas;
}
var fromCharCode = String.fromCharCode;
function getStringFromCharCode(dataView, start, length2) {
var str = "";
length2 += start;
for (var i3 = start; i3 < length2; i3 += 1) {
str += fromCharCode(dataView.getUint8(i3));
}
return str;
}
var REGEXP_DATA_URL_HEAD = /^data:.*,/;
function dataURLToArrayBuffer(dataURL) {
var base64 = dataURL.replace(REGEXP_DATA_URL_HEAD, "");
var binary = atob(base64);
var arrayBuffer = new ArrayBuffer(binary.length);
var uint8 = new Uint8Array(arrayBuffer);
forEach(uint8, function(value, i3) {
uint8[i3] = binary.charCodeAt(i3);
});
return arrayBuffer;
}
function arrayBufferToDataURL(arrayBuffer, mimeType) {
var chunks = [];
var chunkSize = 8192;
var uint8 = new Uint8Array(arrayBuffer);
while (uint8.length > 0) {
chunks.push(fromCharCode.apply(null, toArray(uint8.subarray(0, chunkSize))));
uint8 = uint8.subarray(chunkSize);
}
return "data:".concat(mimeType, ";base64,").concat(btoa(chunks.join("")));
}
function resetAndGetOrientation(arrayBuffer) {
var dataView = new DataView(arrayBuffer);
var orientation;
try {
var littleEndian;
var app1Start;
var ifdStart;
if (dataView.getUint8(0) === 255 && dataView.getUint8(1) === 216) {
var length2 = dataView.byteLength;
var offset = 2;
while (offset + 1 < length2) {
if (dataView.getUint8(offset) === 255 && dataView.getUint8(offset + 1) === 225) {
app1Start = offset;
break;
}
offset += 1;
}
}
if (app1Start) {
var exifIDCode = app1Start + 4;
var tiffOffset = app1Start + 10;
if (getStringFromCharCode(dataView, exifIDCode, 4) === "Exif") {
var endianness = dataView.getUint16(tiffOffset);
littleEndian = endianness === 18761;
if (littleEndian || endianness === 19789) {
if (dataView.getUint16(tiffOffset + 2, littleEndian) === 42) {
var firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian);
if (firstIFDOffset >= 8) {
ifdStart = tiffOffset + firstIFDOffset;
}
}
}
}
}
if (ifdStart) {
var _length = dataView.getUint16(ifdStart, littleEndian);
var _offset;
var i3;
for (i3 = 0; i3 < _length; i3 += 1) {
_offset = ifdStart + i3 * 12 + 2;
if (dataView.getUint16(_offset, littleEndian) === 274) {
_offset += 8;
orientation = dataView.getUint16(_offset, littleEndian);
dataView.setUint16(_offset, 1, littleEndian);
break;
}
}
}
} catch (error) {
orientation = 1;
}
return orientation;
}
function parseOrientation(orientation) {
var rotate2 = 0;
var scaleX2 = 1;
var scaleY2 = 1;
switch (orientation) {
case 2:
scaleX2 = -1;
break;
case 3:
rotate2 = -180;
break;
case 4:
scaleY2 = -1;
break;
case 5:
rotate2 = 90;
scaleY2 = -1;
break;
case 6:
rotate2 = 90;
break;
case 7:
rotate2 = 90;
scaleX2 = -1;
break;
case 8:
rotate2 = -90;
break;
}
return {
rotate: rotate2,
scaleX: scaleX2,
scaleY: scaleY2
};
}
var render = {
render: function render2() {
this.initContainer();
this.initCanvas();
this.initCropBox();
this.renderCanvas();
if (this.cropped) {
this.renderCropBox();
}
},
initContainer: function initContainer() {
var element = this.element, options2 = this.options, container = this.container, cropper = this.cropper;
var minWidth = Number(options2.minContainerWidth);
var minHeight = Number(options2.minContainerHeight);
addClass(cropper, CLASS_HIDDEN);
removeClass(element, CLASS_HIDDEN);
var containerData = {
width: Math.max(container.offsetWidth, minWidth >= 0 ? minWidth : MIN_CONTAINER_WIDTH),
height: Math.max(container.offsetHeight, minHeight >= 0 ? minHeight : MIN_CONTAINER_HEIGHT)
};
this.containerData = containerData;
setStyle(cropper, {
width: containerData.width,
height: containerData.height
});
addClass(element, CLASS_HIDDEN);
removeClass(cropper, CLASS_HIDDEN);
},
// Canvas (image wrapper)
initCanvas: function initCanvas() {
var containerData = this.containerData, imageData = this.imageData;
var viewMode = this.options.viewMode;
var rotated = Math.abs(imageData.rotate) % 180 === 90;
var naturalWidth = rotated ? imageData.naturalHeight : imageData.naturalWidth;
var naturalHeight = rotated ? imageData.naturalWidth : imageData.naturalHeight;
var aspectRatio = naturalWidth / naturalHeight;
var canvasWidth = containerData.width;
var canvasHeight = containerData.height;
if (containerData.height * aspectRatio > containerData.width) {
if (viewMode === 3) {
canvasWidth = containerData.height * aspectRatio;
} else {
canvasHeight = containerData.width / aspectRatio;
}
} else if (viewMode === 3) {
canvasHeight = containerData.width / aspectRatio;
} else {
canvasWidth = containerData.height * aspectRatio;
}
var canvasData = {
aspectRatio,
naturalWidth,
naturalHeight,
width: canvasWidth,
height: canvasHeight
};
this.canvasData = canvasData;
this.limited = viewMode === 1 || viewMode === 2;
this.limitCanvas(true, true);
canvasData.width = Math.min(Math.max(canvasData.width, canvasData.minWidth), canvasData.maxWidth);
canvasData.height = Math.min(Math.max(canvasData.height, canvasData.minHeight), canvasData.maxHeight);
canvasData.left = (containerData.width - canvasData.width) / 2;
canvasData.top = (containerData.height - canvasData.height) / 2;
canvasData.oldLeft = canvasData.left;
canvasData.oldTop = canvasData.top;
this.initialCanvasData = assign2({}, canvasData);
},
limitCanvas: function limitCanvas(sizeLimited, positionLimited) {
var options2 = this.options, containerData = this.containerData, canvasData = this.canvasData, cropBoxData = this.cropBoxData;
var viewMode = options2.viewMode;
var aspectRatio = canvasData.aspectRatio;
var cropped = this.cropped && cropBoxData;
if (sizeLimited) {
var minCanvasWidth = Number(options2.minCanvasWidth) || 0;
var minCanvasHeight = Number(options2.minCanvasHeight) || 0;
if (viewMode > 1) {
minCanvasWidth = Math.max(minCanvasWidth, containerData.width);
minCanvasHeight = Math.max(minCanvasHeight, containerData.height);
if (viewMode === 3) {
if (minCanvasHeight * aspectRatio > minCanvasWidth) {
minCanvasWidth = minCanvasHeight * aspectRatio;
} else {
minCanvasHeight = minCanvasWidth / aspectRatio;
}
}
} else if (viewMode > 0) {
if (minCanvasWidth) {
minCanvasWidth = Math.max(minCanvasWidth, cropped ? cropBoxData.width : 0);
} else if (minCanvasHeight) {
minCanvasHeight = Math.max(minCanvasHeight, cropped ? cropBoxData.height : 0);
} else if (cropped) {
minCanvasWidth = cropBoxData.width;
minCanvasHeight = cropBoxData.height;
if (minCanvasHeight * aspectRatio > minCanvasWidth) {
minCanvasWidth = minCanvasHeight * aspectRatio;
} else {
minCanvasHeight = minCanvasWidth / aspectRatio;
}
}
}
var _getAdjustedSizes = getAdjustedSizes({
aspectRatio,
width: minCanvasWidth,
height: minCanvasHeight
});
minCanvasWidth = _getAdjustedSizes.width;
minCanvasHeight = _getAdjustedSizes.height;
canvasData.minWidth = minCanvasWidth;
canvasData.minHeight = minCanvasHeight;
canvasData.maxWidth = Infinity;
canvasData.maxHeight = Infinity;
}
if (positionLimited) {
if (viewMode > (cropped ? 0 : 1)) {
var newCanvasLeft = containerData.width - canvasData.width;
var newCanvasTop = containerData.height - canvasData.height;
canvasData.minLeft = Math.min(0, newCanvasLeft);
canvasData.minTop = Math.min(0, newCanvasTop);
canvasData.maxLeft = Math.max(0, newCanvasLeft);
canvasData.maxTop = Math.max(0, newCanvasTop);
if (cropped && this.limited) {
canvasData.minLeft = Math.min(cropBoxData.left, cropBoxData.left + (cropBoxData.width - canvasData.width));
canvasData.minTop = Math.min(cropBoxData.top, cropBoxData.top + (cropBoxData.height - canvasData.height));
canvasData.maxLeft = cropBoxData.left;
canvasData.maxTop = cropBoxData.top;
if (viewMode === 2) {
if (canvasData.width >= containerData.width) {
canvasData.minLeft = Math.min(0, newCanvasLeft);
canvasData.maxLeft = Math.max(0, newCanvasLeft);
}
if (canvasData.height >= containerData.height) {
canvasData.minTop = Math.min(0, newCanvasTop);
canvasData.maxTop = Math.max(0, newCanvasTop);
}
}
}
} else {
canvasData.minLeft = -canvasData.width;
canvasData.minTop = -canvasData.height;
canvasData.maxLeft = containerData.width;
canvasData.maxTop = containerData.height;
}
}
},
renderCanvas: function renderCanvas(changed, transformed) {
var canvasData = this.canvasData, imageData = this.imageData;
if (transformed) {
var _getRotatedSizes = getRotatedSizes({
width: imageData.naturalWidth * Math.abs(imageData.scaleX || 1),
height: imageData.naturalHeight * Math.abs(imageData.scaleY || 1),
degree: imageData.rotate || 0
}), naturalWidth = _getRotatedSizes.width, naturalHeight = _getRotatedSizes.height;
var width = canvasData.width * (naturalWidth / canvasData.naturalWidth);
var height = canvasData.height * (naturalHeight / canvasData.naturalHeight);
canvasData.left -= (width - canvasData.width) / 2;
canvasData.top -= (height - canvasData.height) / 2;
canvasData.width = width;
canvasData.height = height;
canvasData.aspectRatio = naturalWidth / naturalHeight;
canvasData.naturalWidth = naturalWidth;
canvasData.naturalHeight = naturalHeight;
this.limitCanvas(true, false);
}
if (canvasData.width > canvasData.maxWidth || canvasData.width < canvasData.minWidth) {
canvasData.left = canvasData.oldLeft;
}
if (canvasData.height > canvasData.maxHeight || canvasData.height < canvasData.minHeight) {
canvasData.top = canvasData.oldTop;
}
canvasData.width = Math.min(Math.max(canvasData.width, canvasData.minWidth), canvasData.maxWidth);
canvasData.height = Math.min(Math.max(canvasData.height, canvasData.minHeight), canvasData.maxHeight);
this.limitCanvas(false, true);
canvasData.left = Math.min(Math.max(canvasData.left, canvasData.minLeft), canvasData.maxLeft);
canvasData.top = Math.min(Math.max(canvasData.top, canvasData.minTop), canvasData.maxTop);
canvasData.oldLeft = canvasData.left;
canvasData.oldTop = canvasData.top;
setStyle(this.canvas, assign2({
width: canvasData.width,
height: canvasData.height
}, getTransforms({
translateX: canvasData.left,
translateY: canvasData.top
})));
this.renderImage(changed);
if (this.cropped && this.limited) {
this.limitCropBox(true, true);
}
},
renderImage: function renderImage(changed) {
var canvasData = this.canvasData, imageData = this.imageData;
var width = imageData.naturalWidth * (canvasData.width / canvasData.naturalWidth);
var height = imageData.naturalHeight * (canvasData.height / canvasData.naturalHeight);
assign2(imageData, {
width,
height,
left: (canvasData.width - width) / 2,
top: (canvasData.height - height) / 2
});
setStyle(this.image, assign2({
width: imageData.width,
height: imageData.height
}, getTransforms(assign2({
translateX: imageData.left,
translateY: imageData.top
}, imageData))));
if (changed) {
this.output();
}
},
initCropBox: function initCropBox() {
var options2 = this.options, canvasData = this.canvasData;
var aspectRatio = options2.aspectRatio || options2.initialAspectRatio;
var autoCropArea = Number(options2.autoCropArea) || 0.8;
var cropBoxData = {
width: canvasData.width,
height: canvasData.height
};
if (aspectRatio) {
if (canvasData.height * aspectRatio > canvasData.width) {
cropBoxData.height = cropBoxData.width / aspectRatio;
} else {
cropBoxData.width = cropBoxData.height * aspectRatio;
}
}
this.cropBoxData = cropBoxData;
this.limitCropBox(true, true);
cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth);
cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight);
cropBoxData.width = Math.max(cropBoxData.minWidth, cropBoxData.width * autoCropArea);
cropBoxData.height = Math.max(cropBoxData.minHeight, cropBoxData.height * autoCropArea);
cropBoxData.left = canvasData.left + (canvasData.width - cropBoxData.width) / 2;
cropBoxData.top = canvasData.top + (canvasData.height - cropBoxData.height) / 2;
cropBoxData.oldLeft = cropBoxData.left;
cropBoxData.oldTop = cropBoxData.top;
this.initialCropBoxData = assign2({}, cropBoxData);
},
limitCropBox: function limitCropBox(sizeLimited, positionLimited) {
var options2 = this.options, containerData = this.containerData, canvasData = this.canvasData, cropBoxData = this.cropBoxData, limited = this.limited;
var aspectRatio = options2.aspectRatio;
if (sizeLimited) {
var minCropBoxWidth = Number(options2.minCropBoxWidth) || 0;
var minCropBoxHeight = Number(options2.minCropBoxHeight) || 0;
var maxCropBoxWidth = limited ? Math.min(containerData.width, canvasData.width, canvasData.width + canvasData.left, containerData.width - canvasData.left) : containerData.width;
var maxCropBoxHeight = limited ? Math.min(containerData.height, canvasData.height, canvasData.height + canvasData.top, containerData.height - canvasData.top) : containerData.height;
minCropBoxWidth = Math.min(minCropBoxWidth, containerData.width);
minCropBoxHeight = Math.min(minCropBoxHeight, containerData.height);
if (aspectRatio) {
if (minCropBoxWidth && minCropBoxHeight) {
if (minCropBoxHeight * aspectRatio > minCropBoxWidth) {
minCropBoxHeight = minCropBoxWidth / aspectRatio;
} else {
minCropBoxWidth = minCropBoxHeight * aspectRatio;
}
} else if (minCropBoxWidth) {
minCropBoxHeight = minCropBoxWidth / aspectRatio;
} else if (minCropBoxHeight) {
minCropBoxWidth = minCropBoxHeight * aspectRatio;
}
if (maxCropBoxHeight * aspectRatio > maxCropBoxWidth) {
maxCropBoxHeight = maxCropBoxWidth / aspectRatio;
} else {
maxCropBoxWidth = maxCropBoxHeight * aspectRatio;
}
}
cropBoxData.minWidth = Math.min(minCropBoxWidth, maxCropBoxWidth);
cropBoxData.minHeight = Math.min(minCropBoxHeight, maxCropBoxHeight);
cropBoxData.maxWidth = maxCropBoxWidth;
cropBoxData.maxHeight = maxCropBoxHeight;
}
if (positionLimited) {
if (limited) {
cropBoxData.minLeft = Math.max(0, canvasData.left);
cropBoxData.minTop = Math.max(0, canvasData.top);
cropBoxData.maxLeft = Math.min(containerData.width, canvasData.left + canvasData.width) - cropBoxData.width;
cropBoxData.maxTop = Math.min(containerData.height, canvasData.top + canvasData.height) - cropBoxData.height;
} else {
cropBoxData.minLeft = 0;
cropBoxData.minTop = 0;
cropBoxData.maxLeft = containerData.width - cropBoxData.width;
cropBoxData.maxTop = containerData.height - cropBoxData.height;
}
}
},
renderCropBox: function renderCropBox() {
var options2 = this.options, containerData = this.containerData, cropBoxData = this.cropBoxData;
if (cropBoxData.width > cropBoxData.maxWidth || cropBoxData.width < cropBoxData.minWidth) {
cropBoxData.left = cropBoxData.oldLeft;
}
if (cropBoxData.height > cropBoxData.maxHeight || cropBoxData.height < cropBoxData.minHeight) {
cropBoxData.top = cropBoxData.oldTop;
}
cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth);
cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight);
this.limitCropBox(false, true);
cropBoxData.left = Math.min(Math.max(cropBoxData.left, cropBoxData.minLeft), cropBoxData.maxLeft);
cropBoxData.top = Math.min(Math.max(cropBoxData.top, cropBoxData.minTop), cropBoxData.maxTop);
cropBoxData.oldLeft = cropBoxData.left;
cropBoxData.oldTop = cropBoxData.top;
if (options2.movable && options2.cropBoxMovable) {
setData(this.face, DATA_ACTION, cropBoxData.width >= containerData.width && cropBoxData.height >= containerData.height ? ACTION_MOVE : ACTION_ALL);
}
setStyle(this.cropBox, assign2({
width: cropBoxData.width,
height: cropBoxData.height
}, getTransforms({
translateX: cropBoxData.left,
translateY: cropBoxData.top
})));
if (this.cropped && this.limited) {
this.limitCanvas(true, true);
}
if (!this.disabled) {
this.output();
}
},
output: function output() {
this.preview();
dispatchEvent(this.element, EVENT_CROP, this.getData());
}
};
var preview = {
initPreview: function initPreview() {
var element = this.element, crossOrigin = this.crossOrigin;
var preview3 = this.options.preview;
var url = crossOrigin ? this.crossOriginUrl : this.url;
var alt = element.alt || "The image to preview";
var image = document.createElement("img");
if (crossOrigin) {
image.crossOrigin = crossOrigin;
}
image.src = url;
image.alt = alt;
this.viewBox.appendChild(image);
this.viewBoxImage = image;
if (!preview3) {
return;
}
var previews = preview3;
if (typeof preview3 === "string") {
previews = element.ownerDocument.querySelectorAll(preview3);
} else if (preview3.querySelector) {
previews = [preview3];
}
this.previews = previews;
forEach(previews, function(el) {
var img = document.createElement("img");
setData(el, DATA_PREVIEW, {
width: el.offsetWidth,
height: el.offsetHeight,
html: el.innerHTML
});
if (crossOrigin) {
img.crossOrigin = crossOrigin;
}
img.src = url;
img.alt = alt;
img.style.cssText = 'display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"';
el.innerHTML = "";
el.appendChild(img);
});
},
resetPreview: function resetPreview() {
forEach(this.previews, function(element) {
var data = getData(element, DATA_PREVIEW);
setStyle(element, {
width: data.width,
height: data.height
});
element.innerHTML = data.html;
removeData(element, DATA_PREVIEW);
});
},
preview: function preview2() {
var imageData = this.imageData, canvasData = this.canvasData, cropBoxData = this.cropBoxData;
var cropBoxWidth = cropBoxData.width, cropBoxHeight = cropBoxData.height;
var width = imageData.width, height = imageData.height;
var left = cropBoxData.left - canvasData.left - imageData.left;
var top = cropBoxData.top - canvasData.top - imageData.top;
if (!this.cropped || this.disabled) {
return;
}
setStyle(this.viewBoxImage, assign2({
width,
height
}, getTransforms(assign2({
translateX: -left,
translateY: -top
}, imageData))));
forEach(this.previews, function(element) {
var data = getData(element, DATA_PREVIEW);
var originalWidth = data.width;
var originalHeight = data.height;
var newWidth = originalWidth;
var newHeight = originalHeight;
var ratio = 1;
if (cropBoxWidth) {
ratio = originalWidth / cropBoxWidth;
newHeight = cropBoxHeight * ratio;
}
if (cropBoxHeight && newHeight > originalHeight) {
ratio = originalHeight / cropBoxHeight;
newWidth = cropBoxWidth * ratio;
newHeight = originalHeight;
}
setStyle(element, {
width: newWidth,
height: newHeight
});
setStyle(element.getElementsByTagName("img")[0], assign2({
width: width * ratio,
height: height * ratio
}, getTransforms(assign2({
translateX: -left * ratio,
translateY: -top * ratio
}, imageData))));
});
}
};
var events = {
bind: function bind() {
var element = this.element, options2 = this.options, cropper = this.cropper;
if (isFunction(options2.cropstart)) {
addListener(element, EVENT_CROP_START, options2.cropstart);
}
if (isFunction(options2.cropmove)) {
addListener(element, EVENT_CROP_MOVE, options2.cropmove);
}
if (isFunction(options2.cropend)) {
addListener(element, EVENT_CROP_END, options2.cropend);
}
if (isFunction(options2.crop)) {
addListener(element, EVENT_CROP, options2.crop);
}
if (isFunction(options2.zoom)) {
addListener(element, EVENT_ZOOM, options2.zoom);
}
addListener(cropper, EVENT_POINTER_DOWN, this.onCropStart = this.cropStart.bind(this));
if (options2.zoomable && options2.zoomOnWheel) {
addListener(cropper, EVENT_WHEEL, this.onWheel = this.wheel.bind(this), {
passive: false,
capture: true
});
}
if (options2.toggleDragModeOnDblclick) {
addListener(cropper, EVENT_DBLCLICK, this.onDblclick = this.dblclick.bind(this));
}
addListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove = this.cropMove.bind(this));
addListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd = this.cropEnd.bind(this));
if (options2.responsive) {
addListener(window, EVENT_RESIZE, this.onResize = this.resize.bind(this));
}
},
unbind: function unbind() {
var element = this.element, options2 = this.options, cropper = this.cropper;
if (isFunction(options2.cropstart)) {
removeListener(element, EVENT_CROP_START, options2.cropstart);
}
if (isFunction(options2.cropmove)) {
removeListener(element, EVENT_CROP_MOVE, options2.cropmove);
}
if (isFunction(options2.cropend)) {
removeListener(element, EVENT_CROP_END, options2.cropend);
}
if (isFunction(options2.crop)) {
removeListener(element, EVENT_CROP, options2.crop);
}
if (isFunction(options2.zoom)) {
removeListener(element, EVENT_ZOOM, options2.zoom);
}
removeListener(cropper, EVENT_POINTER_DOWN, this.onCropStart);
if (options2.zoomable && options2.zoomOnWheel) {
removeListener(cropper, EVENT_WHEEL, this.onWheel, {
passive: false,
capture: true
});
}
if (options2.toggleDragModeOnDblclick) {
removeListener(cropper, EVENT_DBLCLICK, this.onDblclick);
}
removeListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove);
removeListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd);
if (options2.responsive) {
removeListener(window, EVENT_RESIZE, this.onResize);
}
}
};
var handlers = {
resize: function resize() {
if (this.disabled) {
return;
}
var options2 = this.options, container = this.container, containerData = this.containerData;
var ratioX = container.offsetWidth / containerData.width;
var ratioY = container.offsetHeight / containerData.height;
var ratio = Math.abs(ratioX - 1) > Math.abs(ratioY - 1) ? ratioX : ratioY;
if (ratio !== 1) {
var canvasData;
var cropBoxData;
if (options2.restore) {
canvasData = this.getCanvasData();
cropBoxData = this.getCropBoxData();
}
this.render();
if (options2.restore) {
this.setCanvasData(forEach(canvasData, function(n2, i3) {
canvasData[i3] = n2 * ratio;
}));
this.setCropBoxData(forEach(cropBoxData, function(n2, i3) {
cropBoxData[i3] = n2 * ratio;
}));
}
}
},
dblclick: function dblclick() {
if (this.disabled || this.options.dragMode === DRAG_MODE_NONE) {
return;
}
this.setDragMode(hasClass(this.dragBox, CLASS_CROP) ? DRAG_MODE_MOVE : DRAG_MODE_CROP);
},
wheel: function wheel(event) {
var _this = this;
var ratio = Number(this.options.wheelZoomRatio) || 0.1;
var delta = 1;
if (this.disabled) {
return;
}
event.preventDefault();
if (this.wheeling) {
return;
}
this.wheeling = true;
setTimeout(function() {
_this.wheeling = false;
}, 50);
if (event.deltaY) {
delta = event.deltaY > 0 ? 1 : -1;
} else if (event.wheelDelta) {
delta = -event.wheelDelta / 120;
} else if (event.detail) {
delta = event.detail > 0 ? 1 : -1;
}
this.zoom(-delta * ratio, event);
},
cropStart: function cropStart(event) {
var buttons = event.buttons, button = event.button;
if (this.disabled || (event.type === "mousedown" || event.type === "pointerdown" && event.pointerType === "mouse") && // No primary button (Usually the left button)
(isNumber(buttons) && buttons !== 1 || isNumber(button) && button !== 0 || event.ctrlKey)) {
return;
}
var options2 = this.options, pointers = this.pointers;
var action;
if (event.changedTouches) {
forEach(event.changedTouches, function(touch) {
pointers[touch.identifier] = getPointer(touch);
});
} else {
pointers[event.pointerId || 0] = getPointer(event);
}
if (Object.keys(pointers).length > 1 && options2.zoomable && options2.zoomOnTouch) {
action = ACTION_ZOOM;
} else {
action = getData(event.target, DATA_ACTION);
}
if (!REGEXP_ACTIONS.test(action)) {
return;
}
if (dispatchEvent(this.element, EVENT_CROP_START, {
originalEvent: event,
action
}) === false) {
return;
}
event.preventDefault();
this.action = action;
this.cropping = false;
if (action === ACTION_CROP) {
this.cropping = true;
addClass(this.dragBox, CLASS_MODAL);
}
},
cropMove: function cropMove(event) {
var action = this.action;
if (this.disabled || !action) {
return;
}
var pointers = this.pointers;
event.preventDefault();
if (dispatchEvent(this.element, EVENT_CROP_MOVE, {
originalEvent: event,
action
}) === false) {
return;
}
if (event.changedTouches) {
forEach(event.changedTouches, function(touch) {
assign2(pointers[touch.identifier] || {}, getPointer(touch, true));
});
} else {
assign2(pointers[event.pointerId || 0] || {}, getPointer(event, true));
}
this.change(event);
},
cropEnd: function cropEnd(event) {
if (this.disabled) {
return;
}
var action = this.action, pointers = this.pointers;
if (event.changedTouches) {
forEach(event.changedTouches, function(touch) {
delete pointers[touch.identifier];
});
} else {
delete pointers[event.pointerId || 0];
}
if (!action) {
return;
}
event.preventDefault();
if (!Object.keys(pointers).length) {
this.action = "";
}
if (this.cropping) {
this.cropping = false;
toggleClass(this.dragBox, CLASS_MODAL, this.cropped && this.options.modal);
}
dispatchEvent(this.element, EVENT_CROP_END, {
originalEvent: event,
action
});
}
};
var change = {
change: function change2(event) {
var options2 = this.options, canvasData = this.canvasData, containerData = this.containerData, cropBoxData = this.cropBoxData, pointers = this.pointers;
var action = this.action;
var aspectRatio = options2.aspectRatio;
var left = cropBoxData.left, top = cropBoxData.top, width = cropBoxData.width, height = cropBoxData.height;
var right = left + width;
var bottom = top + height;
var minLeft = 0;
var minTop = 0;
var maxWidth = containerData.width;
var maxHeight = containerData.height;
var renderable = true;
var offset;
if (!aspectRatio && event.shiftKey) {
aspectRatio = width && height ? width / height : 1;
}
if (this.limited) {
minLeft = cropBoxData.minLeft;
minTop = cropBoxData.minTop;
maxWidth = minLeft + Math.min(containerData.width, canvasData.width, canvasData.left + canvasData.width);
maxHeight = minTop + Math.min(containerData.height, canvasData.height, canvasData.top + canvasData.height);
}
var pointer = pointers[Object.keys(pointers)[0]];
var range = {
x: pointer.endX - pointer.startX,
y: pointer.endY - pointer.startY
};
var check = function check2(side) {
switch (side) {
case ACTION_EAST:
if (right + range.x > maxWidth) {
range.x = maxWidth - right;
}
break;
case ACTION_WEST:
if (left + range.x < minLeft) {
range.x = minLeft - left;
}
break;
case ACTION_NORTH:
if (top + range.y < minTop) {
range.y = minTop - top;
}
break;
case ACTION_SOUTH:
if (bottom + range.y > maxHeight) {
range.y = maxHeight - bottom;
}
break;
}
};
switch (action) {
case ACTION_ALL:
left += range.x;
top += range.y;
break;
case ACTION_EAST:
if (range.x >= 0 && (right >= maxWidth || aspectRatio && (top <= minTop || bottom >= maxHeight))) {
renderable = false;
break;
}
check(ACTION_EAST);
width += range.x;
if (width < 0) {
action = ACTION_WEST;
width = -width;
left -= width;
}
if (aspectRatio) {
height = width / aspectRatio;
top += (cropBoxData.height - height) / 2;
}
break;
case ACTION_NORTH:
if (range.y <= 0 && (top <= minTop || aspectRatio && (left <= minLeft || right >= maxWidth))) {
renderable = false;
break;
}
check(ACTION_NORTH);
height -= range.y;
top += range.y;
if (height < 0) {
action = ACTION_SOUTH;
height = -height;
top -= height;
}
if (aspectRatio) {
width = height * aspectRatio;
left += (cropBoxData.width - width) / 2;
}
break;
case ACTION_WEST:
if (range.x <= 0 && (left <= minLeft || aspectRatio && (top <= minTop || bottom >= maxHeight))) {
renderable = false;
break;
}
check(ACTION_WEST);
width -= range.x;
left += range.x;
if (width < 0) {
action = ACTION_EAST;
width = -width;
left -= width;
}
if (aspectRatio) {
height = width / aspectRatio;
top += (cropBoxData.height - height) / 2;
}
break;
case ACTION_SOUTH:
if (range.y >= 0 && (bottom >= maxHeight || aspectRatio && (left <= minLeft || right >= maxWidth))) {
renderable = false;
break;
}
check(ACTION_SOUTH);
height += range.y;
if (height < 0) {
action = ACTION_NORTH;
height = -height;
top -= height;
}
if (aspectRatio) {
width = height * aspectRatio;
left += (cropBoxData.width - width) / 2;
}
break;
case ACTION_NORTH_EAST:
if (aspectRatio) {
if (range.y <= 0 && (top <= minTop || right >= maxWidth)) {
renderable = false;
break;
}
check(ACTION_NORTH);
height -= range.y;
top += range.y;
width = height * aspectRatio;
} else {
check(ACTION_NORTH);
check(ACTION_EAST);
if (range.x >= 0) {
if (right < maxWidth) {
width += range.x;
} else if (range.y <= 0 && top <= minTop) {
renderable = false;
}
} else {
width += range.x;
}
if (range.y <= 0) {
if (top > minTop) {
height -= range.y;
top += range.y;
}
} else {
height -= range.y;
top += range.y;
}
}
if (width < 0 && height < 0) {
action = ACTION_SOUTH_WEST;
height = -height;
width = -width;
top -= height;
left -= width;
} else if (width < 0) {
action = ACTION_NORTH_WEST;
width = -width;
left -= width;
} else if (height < 0) {
action = ACTION_SOUTH_EAST;
height = -height;
top -= height;
}
break;
case ACTION_NORTH_WEST:
if (aspectRatio) {
if (range.y <= 0 && (top <= minTop || left <= minLeft)) {
renderable = false;
break;
}
check(ACTION_NORTH);
height -= range.y;
top += range.y;
width = height * aspectRatio;
left += cropBoxData.width - width;
} else {
check(ACTION_NORTH);
check(ACTION_WEST);
if (range.x <= 0) {
if (left > minLeft) {
width -= range.x;
left += range.x;
} else if (range.y <= 0 && top <= minTop) {
renderable = false;
}
} else {
width -= range.x;
left += range.x;
}
if (range.y <= 0) {
if (top > minTop) {
height -= range.y;
top += range.y;
}
} else {
height -= range.y;
top += range.y;
}
}
if (width < 0 && height < 0) {
action = ACTION_SOUTH_EAST;
height = -height;
width = -width;
top -= height;
left -= width;
} else if (width < 0) {
action = ACTION_NORTH_EAST;
width = -width;
left -= width;
} else if (height < 0) {
action = ACTION_SOUTH_WEST;
height = -height;
top -= height;
}
break;
case ACTION_SOUTH_WEST:
if (aspectRatio) {
if (range.x <= 0 && (left <= minLeft || bottom >= maxHeight)) {
renderable = false;
break;
}
check(ACTION_WEST);
width -= range.x;
left += range.x;
height = width / aspectRatio;
} else {
check(ACTION_SOUTH);
check(ACTION_WEST);
if (range.x <= 0) {
if (left > minLeft) {
width -= range.x;
left += range.x;
} else if (range.y >= 0 && bottom >= maxHeight) {
renderable = false;
}
} else {
width -= range.x;
left += range.x;
}
if (range.y >= 0) {
if (bottom < maxHeight) {
height += range.y;
}
} else {
height += range.y;
}
}
if (width < 0 && height < 0) {
action = ACTION_NORTH_EAST;
height = -height;
width = -width;
top -= height;
left -= width;
} else if (width < 0) {
action = ACTION_SOUTH_EAST;
width = -width;
left -= width;
} else if (height < 0) {
action = ACTION_NORTH_WEST;
height = -height;
top -= height;
}
break;
case ACTION_SOUTH_EAST:
if (aspectRatio) {
if (range.x >= 0 && (right >= maxWidth || bottom >= maxHeight)) {
renderable = false;
break;
}
check(ACTION_EAST);
width += range.x;
height = width / aspectRatio;
} else {
check(ACTION_SOUTH);
check(ACTION_EAST);
if (range.x >= 0) {
if (right < maxWidth) {
width += range.x;
} else if (range.y >= 0 && bottom >= maxHeight) {
renderable = false;
}
} else {
width += range.x;
}
if (range.y >= 0) {
if (bottom < maxHeight) {
height += range.y;
}
} else {
height += range.y;
}
}
if (width < 0 && height < 0) {
action = ACTION_NORTH_WEST;
height = -height;
width = -width;
top -= height;
left -= width;
} else if (width < 0) {
action = ACTION_SOUTH_WEST;
width = -width;
left -= width;
} else if (height < 0) {
action = ACTION_NORTH_EAST;
height = -height;
top -= height;
}
break;
case ACTION_MOVE:
this.move(range.x, range.y);
renderable = false;
break;
case ACTION_ZOOM:
this.zoom(getMaxZoomRatio(pointers), event);
renderable = false;
break;
case ACTION_CROP:
if (!range.x || !range.y) {
renderable = false;
break;
}
offset = getOffset(this.cropper);
left = pointer.startX - offset.left;
top = pointer.startY - offset.top;
width = cropBoxData.minWidth;
height = cropBoxData.minHeight;
if (range.x > 0) {
action = range.y > 0 ? ACTION_SOUTH_EAST : ACTION_NORTH_EAST;
} else if (range.x < 0) {
left -= width;
action = range.y > 0 ? ACTION_SOUTH_WEST : ACTION_NORTH_WEST;
}
if (range.y < 0) {
top -= height;
}
if (!this.cropped) {
removeClass(this.cropBox, CLASS_HIDDEN);
this.cropped = true;
if (this.limited) {
this.limitCropBox(true, true);
}
}
break;
}
if (renderable) {
cropBoxData.width = width;
cropBoxData.height = height;
cropBoxData.left = left;
cropBoxData.top = top;
this.action = action;
this.renderCropBox();
}
forEach(pointers, function(p3) {
p3.startX = p3.endX;
p3.startY = p3.endY;
});
}
};
var methods = {
// Show the crop box manually
crop: function crop() {
if (this.ready && !this.cropped && !this.disabled) {
this.cropped = true;
this.limitCropBox(true, true);
if (this.options.modal) {
addClass(this.dragBox, CLASS_MODAL);
}
removeClass(this.cropBox, CLASS_HIDDEN);
this.setCropBoxData(this.initialCropBoxData);
}
return this;
},
// Reset the image and crop box to their initial states
reset: function reset() {
if (this.ready && !this.disabled) {
this.imageData = assign2({}, this.initialImageData);
this.canvasData = assign2({}, this.initialCanvasData);
this.cropBoxData = assign2({}, this.initialCropBoxData);
this.renderCanvas();
if (this.cropped) {
this.renderCropBox();
}
}
return this;
},
// Clear the crop box
clear: function clear() {
if (this.cropped && !this.disabled) {
assign2(this.cropBoxData, {
left: 0,
top: 0,
width: 0,
height: 0
});
this.cropped = false;
this.renderCropBox();
this.limitCanvas(true, true);
this.renderCanvas();
removeClass(this.dragBox, CLASS_MODAL);
addClass(this.cropBox, CLASS_HIDDEN);
}
return this;
},
/**
* Replace the image's src and rebuild the cropper
* @param {string} url - The new URL.
* @param {boolean} [hasSameSize] - Indicate if the new image has the same size as the old one.
* @returns {Cropper} this
*/
replace: function replace2(url) {
var hasSameSize = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
if (!this.disabled && url) {
if (this.isImg) {
this.element.src = url;
}
if (hasSameSize) {
this.url = url;
this.image.src = url;
if (this.ready) {
this.viewBoxImage.src = url;
forEach(this.previews, function(element) {
element.getElementsByTagName("img")[0].src = url;
});
}
} else {
if (this.isImg) {
this.replaced = true;
}
this.options.data = null;
this.uncreate();
this.load(url);
}
}
return this;
},
// Enable (unfreeze) the cropper
enable: function enable() {
if (this.ready && this.disabled) {
this.disabled = false;
removeClass(this.cropper, CLASS_DISABLED);
}
return this;
},
// Disable (freeze) the cropper
disable: function disable() {
if (this.ready && !this.disabled) {
this.disabled = true;
addClass(this.cropper, CLASS_DISABLED);
}
return this;
},
/**
* Destroy the cropper and remove the instance from the image
* @returns {Cropper} this
*/
destroy: function destroy() {
var element = this.element;
if (!element[NAMESPACE]) {
return this;
}
element[NAMESPACE] = void 0;
if (this.isImg && this.replaced) {
element.src = this.originalUrl;
}
this.uncreate();
return this;
},
/**
* Move the canvas with relative offsets
* @param {number} offsetX - The relative offset distance on the x-axis.
* @param {number} [offsetY=offsetX] - The relative offset distance on the y-axis.
* @returns {Cropper} this
*/
move: function move(offsetX) {
var offsetY = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : offsetX;
var _this$canvasData = this.canvasData, left = _this$canvasData.left, top = _this$canvasData.top;
return this.moveTo(isUndefined(offsetX) ? offsetX : left + Number(offsetX), isUndefined(offsetY) ? offsetY : top + Number(offsetY));
},
/**
* Move the canvas to an absolute point
* @param {number} x - The x-axis coordinate.
* @param {number} [y=x] - The y-axis coordinate.
* @returns {Cropper} this
*/
moveTo: function moveTo(x2) {
var y4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : x2;
var canvasData = this.canvasData;
var changed = false;
x2 = Number(x2);
y4 = Number(y4);
if (this.ready && !this.disabled && this.options.movable) {
if (isNumber(x2)) {
canvasData.left = x2;
changed = true;
}
if (isNumber(y4)) {
canvasData.top = y4;
changed = true;
}
if (changed) {
this.renderCanvas(true);
}
}
return this;
},
/**
* Zoom the canvas with a relative ratio
* @param {number} ratio - The target ratio.
* @param {Event} _originalEvent - The original event if any.
* @returns {Cropper} this
*/
zoom: function zoom(ratio, _originalEvent) {
var canvasData = this.canvasData;
ratio = Number(ratio);
if (ratio < 0) {
ratio = 1 / (1 - ratio);
} else {
ratio = 1 + ratio;
}
return this.zoomTo(canvasData.width * ratio / canvasData.naturalWidth, null, _originalEvent);
},
/**
* Zoom the canvas to an absolute ratio
* @param {number} ratio - The target ratio.
* @param {Object} pivot - The zoom pivot point coordinate.
* @param {Event} _originalEvent - The original event if any.
* @returns {Cropper} this
*/
zoomTo: function zoomTo(ratio, pivot, _originalEvent) {
var options2 = this.options, canvasData = this.canvasData;
var width = canvasData.width, height = canvasData.height, naturalWidth = canvasData.naturalWidth, naturalHeight = canvasData.naturalHeight;
ratio = Number(ratio);
if (ratio >= 0 && this.ready && !this.disabled && options2.zoomable) {
var newWidth = naturalWidth * ratio;
var newHeight = naturalHeight * ratio;
if (dispatchEvent(this.element, EVENT_ZOOM, {
ratio,
oldRatio: width / naturalWidth,
originalEvent: _originalEvent
}) === false) {
return this;
}
if (_originalEvent) {
var pointers = this.pointers;
var offset = getOffset(this.cropper);
var center2 = pointers && Object.keys(pointers).length ? getPointersCenter(pointers) : {
pageX: _originalEvent.pageX,
pageY: _originalEvent.pageY
};
canvasData.left -= (newWidth - width) * ((center2.pageX - offset.left - canvasData.left) / width);
canvasData.top -= (newHeight - height) * ((center2.pageY - offset.top - canvasData.top) / height);
} else if (isPlainObject(pivot) && isNumber(pivot.x) && isNumber(pivot.y)) {
canvasData.left -= (newWidth - width) * ((pivot.x - canvasData.left) / width);
canvasData.top -= (newHeight - height) * ((pivot.y - canvasData.top) / height);
} else {
canvasData.left -= (newWidth - width) / 2;
canvasData.top -= (newHeight - height) / 2;
}
canvasData.width = newWidth;
canvasData.height = newHeight;
this.renderCanvas(true);
}
return this;
},
/**
* Rotate the canvas with a relative degree
* @param {number} degree - The rotate degree.
* @returns {Cropper} this
*/
rotate: function rotate(degree) {
return this.rotateTo((this.imageData.rotate || 0) + Number(degree));
},
/**
* Rotate the canvas to an absolute degree
* @param {number} degree - The rotate degree.
* @returns {Cropper} this
*/
rotateTo: function rotateTo(degree) {
degree = Number(degree);
if (isNumber(degree) && this.ready && !this.disabled && this.options.rotatable) {
this.imageData.rotate = degree % 360;
this.renderCanvas(true, true);
}
return this;
},
/**
* Scale the image on the x-axis.
* @param {number} scaleX - The scale ratio on the x-axis.
* @returns {Cropper} this
*/
scaleX: function scaleX(_scaleX) {
var scaleY2 = this.imageData.scaleY;
return this.scale(_scaleX, isNumber(scaleY2) ? scaleY2 : 1);
},
/**
* Scale the image on the y-axis.
* @param {number} scaleY - The scale ratio on the y-axis.
* @returns {Cropper} this
*/
scaleY: function scaleY(_scaleY) {
var scaleX2 = this.imageData.scaleX;
return this.scale(isNumber(scaleX2) ? scaleX2 : 1, _scaleY);
},
/**
* Scale the image
* @param {number} scaleX - The scale ratio on the x-axis.
* @param {number} [scaleY=scaleX] - The scale ratio on the y-axis.
* @returns {Cropper} this
*/
scale: function scale(scaleX2) {
var scaleY2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : scaleX2;
var imageData = this.imageData;
var transformed = false;
scaleX2 = Number(scaleX2);
scaleY2 = Number(scaleY2);
if (this.ready && !this.disabled && this.options.scalable) {
if (isNumber(scaleX2)) {
imageData.scaleX = scaleX2;
transformed = true;
}
if (isNumber(scaleY2)) {
imageData.scaleY = scaleY2;
transformed = true;
}
if (transformed) {
this.renderCanvas(true, true);
}
}
return this;
},
/**
* Get the cropped area position and size data (base on the original image)
* @param {boolean} [rounded=false] - Indicate if round the data values or not.
* @returns {Object} The result cropped data.
*/
getData: function getData2() {
var rounded = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
var options2 = this.options, imageData = this.imageData, canvasData = this.canvasData, cropBoxData = this.cropBoxData;
var data;
if (this.ready && this.cropped) {
data = {
x: cropBoxData.left - canvasData.left,
y: cropBoxData.top - canvasData.top,
width: cropBoxData.width,
height: cropBoxData.height
};
var ratio = imageData.width / imageData.naturalWidth;
forEach(data, function(n2, i3) {
data[i3] = n2 / ratio;
});
if (rounded) {
var bottom = Math.round(data.y + data.height);
var right = Math.round(data.x + data.width);
data.x = Math.round(data.x);
data.y = Math.round(data.y);
data.width = right - data.x;
data.height = bottom - data.y;
}
} else {
data = {
x: 0,
y: 0,
width: 0,
height: 0
};
}
if (options2.rotatable) {
data.rotate = imageData.rotate || 0;
}
if (options2.scalable) {
data.scaleX = imageData.scaleX || 1;
data.scaleY = imageData.scaleY || 1;
}
return data;
},
/**
* Set the cropped area position and size with new data
* @param {Object} data - The new data.
* @returns {Cropper} this
*/
setData: function setData2(data) {
var options2 = this.options, imageData = this.imageData, canvasData = this.canvasData;
var cropBoxData = {};
if (this.ready && !this.disabled && isPlainObject(data)) {
var transformed = false;
if (options2.rotatable) {
if (isNumber(data.rotate) && data.rotate !== imageData.rotate) {
imageData.rotate = data.rotate;
transformed = true;
}
}
if (options2.scalable) {
if (isNumber(data.scaleX) && data.scaleX !== imageData.scaleX) {
imageData.scaleX = data.scaleX;
transformed = true;
}
if (isNumber(data.scaleY) && data.scaleY !== imageData.scaleY) {
imageData.scaleY = data.scaleY;
transformed = true;
}
}
if (transformed) {
this.renderCanvas(true, true);
}
var ratio = imageData.width / imageData.naturalWidth;
if (isNumber(data.x)) {
cropBoxData.left = data.x * ratio + canvasData.left;
}
if (isNumber(data.y)) {
cropBoxData.top = data.y * ratio + canvasData.top;
}
if (isNumber(data.width)) {
cropBoxData.width = data.width * ratio;
}
if (isNumber(data.height)) {
cropBoxData.height = data.height * ratio;
}
this.setCropBoxData(cropBoxData);
}
return this;
},
/**
* Get the container size data.
* @returns {Object} The result container data.
*/
getContainerData: function getContainerData() {
return this.ready ? assign2({}, this.containerData) : {};
},
/**
* Get the image position and size data.
* @returns {Object} The result image data.
*/
getImageData: function getImageData() {
return this.sized ? assign2({}, this.imageData) : {};
},
/**
* Get the canvas position and size data.
* @returns {Object} The result canvas data.
*/
getCanvasData: function getCanvasData() {
var canvasData = this.canvasData;
var data = {};
if (this.ready) {
forEach(["left", "top", "width", "height", "naturalWidth", "naturalHeight"], function(n2) {
data[n2] = canvasData[n2];
});
}
return data;
},
/**
* Set the canvas position and size with new data.
* @param {Object} data - The new canvas data.
* @returns {Cropper} this
*/
setCanvasData: function setCanvasData(data) {
var canvasData = this.canvasData;
var aspectRatio = canvasData.aspectRatio;
if (this.ready && !this.disabled && isPlainObject(data)) {
if (isNumber(data.left)) {
canvasData.left = data.left;
}
if (isNumber(data.top)) {
canvasData.top = data.top;
}
if (isNumber(data.width)) {
canvasData.width = data.width;
canvasData.height = data.width / aspectRatio;
} else if (isNumber(data.height)) {
canvasData.height = data.height;
canvasData.width = data.height * aspectRatio;
}
this.renderCanvas(true);
}
return this;
},
/**
* Get the crop box position and size data.
* @returns {Object} The result crop box data.
*/
getCropBoxData: function getCropBoxData() {
var cropBoxData = this.cropBoxData;
var data;
if (this.ready && this.cropped) {
data = {
left: cropBoxData.left,
top: cropBoxData.top,
width: cropBoxData.width,
height: cropBoxData.height
};
}
return data || {};
},
/**
* Set the crop box position and size with new data.
* @param {Object} data - The new crop box data.
* @returns {Cropper} this
*/
setCropBoxData: function setCropBoxData(data) {
var cropBoxData = this.cropBoxData;
var aspectRatio = this.options.aspectRatio;
var widthChanged;
var heightChanged;
if (this.ready && this.cropped && !this.disabled && isPlainObject(data)) {
if (isNumber(data.left)) {
cropBoxData.left = data.left;
}
if (isNumber(data.top)) {
cropBoxData.top = data.top;
}
if (isNumber(data.width) && data.width !== cropBoxData.width) {
widthChanged = true;
cropBoxData.width = data.width;
}
if (isNumber(data.height) && data.height !== cropBoxData.height) {
heightChanged = true;
cropBoxData.height = data.height;
}
if (aspectRatio) {
if (widthChanged) {
cropBoxData.height = cropBoxData.width / aspectRatio;
} else if (heightChanged) {
cropBoxData.width = cropBoxData.height * aspectRatio;
}
}
this.renderCropBox();
}
return this;
},
/**
* Get a canvas drawn the cropped image.
* @param {Object} [options={}] - The config options.
* @returns {HTMLCanvasElement} - The result canvas.
*/
getCroppedCanvas: function getCroppedCanvas() {
var options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
if (!this.ready || !window.HTMLCanvasElement) {
return null;
}
var canvasData = this.canvasData;
var source = getSourceCanvas(this.image, this.imageData, canvasData, options2);
if (!this.cropped) {
return source;
}
var _this$getData = this.getData(options2.rounded), initialX = _this$getData.x, initialY = _this$getData.y, initialWidth = _this$getData.width, initialHeight = _this$getData.height;
var ratio = source.width / Math.floor(canvasData.naturalWidth);
if (ratio !== 1) {
initialX *= ratio;
initialY *= ratio;
initialWidth *= ratio;
initialHeight *= ratio;
}
var aspectRatio = initialWidth / initialHeight;
var maxSizes = getAdjustedSizes({
aspectRatio,
width: options2.maxWidth || Infinity,
height: options2.maxHeight || Infinity
});
var minSizes = getAdjustedSizes({
aspectRatio,
width: options2.minWidth || 0,
height: options2.minHeight || 0
}, "cover");
var _getAdjustedSizes = getAdjustedSizes({
aspectRatio,
width: options2.width || (ratio !== 1 ? source.width : initialWidth),
height: options2.height || (ratio !== 1 ? source.height : initialHeight)
}), width = _getAdjustedSizes.width, height = _getAdjustedSizes.height;
width = Math.min(maxSizes.width, Math.max(minSizes.width, width));
height = Math.min(maxSizes.height, Math.max(minSizes.height, height));
var canvas = document.createElement("canvas");
var context = canvas.getContext("2d");
canvas.width = normalizeDecimalNumber(width);
canvas.height = normalizeDecimalNumber(height);
context.fillStyle = options2.fillColor || "transparent";
context.fillRect(0, 0, width, height);
var _options$imageSmoothi = options2.imageSmoothingEnabled, imageSmoothingEnabled = _options$imageSmoothi === void 0 ? true : _options$imageSmoothi, imageSmoothingQuality = options2.imageSmoothingQuality;
context.imageSmoothingEnabled = imageSmoothingEnabled;
if (imageSmoothingQuality) {
context.imageSmoothingQuality = imageSmoothingQuality;
}
var sourceWidth = source.width;
var sourceHeight = source.height;
var srcX = initialX;
var srcY = initialY;
var srcWidth;
var srcHeight;
var dstX;
var dstY;
var dstWidth;
var dstHeight;
if (srcX <= -initialWidth || srcX > sourceWidth) {
srcX = 0;
srcWidth = 0;
dstX = 0;
dstWidth = 0;
} else if (srcX <= 0) {
dstX = -srcX;
srcX = 0;
srcWidth = Math.min(sourceWidth, initialWidth + srcX);
dstWidth = srcWidth;
} else if (srcX <= sourceWidth) {
dstX = 0;
srcWidth = Math.min(initialWidth, sourceWidth - srcX);
dstWidth = srcWidth;
}
if (srcWidth <= 0 || srcY <= -initialHeight || srcY > sourceHeight) {
srcY = 0;
srcHeight = 0;
dstY = 0;
dstHeight = 0;
} else if (srcY <= 0) {
dstY = -srcY;
srcY = 0;
srcHeight = Math.min(sourceHeight, initialHeight + srcY);
dstHeight = srcHeight;
} else if (srcY <= sourceHeight) {
dstY = 0;
srcHeight = Math.min(initialHeight, sourceHeight - srcY);
dstHeight = srcHeight;
}
var params = [srcX, srcY, srcWidth, srcHeight];
if (dstWidth > 0 && dstHeight > 0) {
var scale2 = width / initialWidth;
params.push(dstX * scale2, dstY * scale2, dstWidth * scale2, dstHeight * scale2);
}
context.drawImage.apply(context, [source].concat(_toConsumableArray2(params.map(function(param) {
return Math.floor(normalizeDecimalNumber(param));
}))));
return canvas;
},
/**
* Change the aspect ratio of the crop box.
* @param {number} aspectRatio - The new aspect ratio.
* @returns {Cropper} this
*/
setAspectRatio: function setAspectRatio(aspectRatio) {
var options2 = this.options;
if (!this.disabled && !isUndefined(aspectRatio)) {
options2.aspectRatio = Math.max(0, aspectRatio) || NaN;
if (this.ready) {
this.initCropBox();
if (this.cropped) {
this.renderCropBox();
}
}
}
return this;
},
/**
* Change the drag mode.
* @param {string} mode - The new drag mode.
* @returns {Cropper} this
*/
setDragMode: function setDragMode(mode) {
var options2 = this.options, dragBox = this.dragBox, face = this.face;
if (this.ready && !this.disabled) {
var croppable = mode === DRAG_MODE_CROP;
var movable = options2.movable && mode === DRAG_MODE_MOVE;
mode = croppable || movable ? mode : DRAG_MODE_NONE;
options2.dragMode = mode;
setData(dragBox, DATA_ACTION, mode);
toggleClass(dragBox, CLASS_CROP, croppable);
toggleClass(dragBox, CLASS_MOVE, movable);
if (!options2.cropBoxMovable) {
setData(face, DATA_ACTION, mode);
toggleClass(face, CLASS_CROP, croppable);
toggleClass(face, CLASS_MOVE, movable);
}
}
return this;
}
};
var AnotherCropper = WINDOW.Cropper;
var Cropper = function() {
function Cropper2(element) {
var options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
_classCallCheck2(this, Cropper2);
if (!element || !REGEXP_TAG_NAME.test(element.tagName)) {
throw new Error("The first argument is required and must be an
or