node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

27
server/node_modules/react-intl/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,27 @@
Copyright 2019 Oath Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Oath Inc. nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL Oath INC. BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

3
server/node_modules/react-intl/README.md generated vendored Normal file
View File

@@ -0,0 +1,3 @@
# React Intl
We've migrated the docs to https://formatjs.io/docs/getting-started/installation.

47
server/node_modules/react-intl/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,47 @@
import * as React from 'react';
import { MessageDescriptor, CustomFormatConfig, FormatDateOptions } from '@formatjs/intl';
import { IntlListFormatOptions } from '@formatjs/intl-listformat';
import { DisplayNamesOptions } from '@formatjs/intl-displaynames';
import { NumberFormatOptions } from '@formatjs/ecma402-abstract';
import injectIntl, { Provider as RawIntlProvider, Context as IntlContext, WithIntlProps, WrappedComponentProps } from './src/components/injectIntl';
import useIntl from './src/components/useIntl';
import IntlProvider from './src/components/provider';
import { createIntl } from './src/components/createIntl';
import FormattedRelativeTime from './src/components/relative';
import FormattedPlural from './src/components/plural';
import FormattedMessage from './src/components/message';
import FormattedDateTimeRange from './src/components/dateTimeRange';
export { FormattedDateTimeRange, FormattedMessage, FormattedPlural, FormattedRelativeTime, IntlContext, IntlProvider, RawIntlProvider, WithIntlProps, WrappedComponentProps, createIntl, injectIntl, useIntl, };
export { IntlConfig, ResolvedIntlConfig, IntlShape } from './src/types';
export { createIntlCache, MessageDescriptor, IntlCache, Formatters, IntlFormatters, FormatDisplayNameOptions, FormatListOptions, FormatPluralOptions, FormatRelativeTimeOptions, FormatNumberOptions, FormatDateOptions, CustomFormatConfig, CustomFormats, UnsupportedFormatterError, InvalidConfigError, MissingDataError, MessageFormatError, MissingTranslationError, IntlErrorCode as ReactIntlErrorCode, IntlError as ReactIntlError, } from '@formatjs/intl';
export declare function defineMessages<K extends keyof any, T = MessageDescriptor, U extends Record<K, T> = Record<K, T>>(msgs: U): U;
export declare function defineMessage<T extends MessageDescriptor>(msg: T): T;
export declare const FormattedDate: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig & {
value: string | number | Date | undefined;
children?(formattedDate: string): React.ReactElement | null;
}>;
export declare const FormattedTime: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig & {
value: string | number | Date | undefined;
children?(formattedTime: string): React.ReactElement | null;
}>;
export declare const FormattedNumber: React.FC<Omit<NumberFormatOptions, 'localeMatcher'> & CustomFormatConfig<'number'> & {
value: number;
children?(formattedNumber: string): React.ReactElement | null;
}>;
export declare const FormattedList: React.FC<IntlListFormatOptions & {
value: readonly React.ReactNode[];
}>;
export declare const FormattedDisplayName: React.FC<DisplayNamesOptions & {
value: string | number | Record<string, unknown>;
}>;
export declare const FormattedDateParts: React.FC<FormatDateOptions & {
value: Parameters<Intl.DateTimeFormat['format']>[0] | string;
children(val: Intl.DateTimeFormatPart[]): React.ReactElement | null;
}>;
export declare const FormattedTimeParts: React.FC<FormatDateOptions & {
value: Parameters<Intl.DateTimeFormat['format']>[0] | string;
children(val: Intl.DateTimeFormatPart[]): React.ReactElement | null;
}>;
export { FormattedNumberParts, FormattedListParts, } from './src/components/createFormattedComponent';
export type { MessageFormatElement } from '@formatjs/icu-messageformat-parser';
export type { PrimitiveType } from 'intl-messageformat';

51
server/node_modules/react-intl/index.js generated vendored Normal file
View File

@@ -0,0 +1,51 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FormattedListParts = exports.FormattedNumberParts = exports.FormattedTimeParts = exports.FormattedDateParts = exports.FormattedDisplayName = exports.FormattedList = exports.FormattedNumber = exports.FormattedTime = exports.FormattedDate = exports.defineMessage = exports.defineMessages = exports.ReactIntlError = exports.ReactIntlErrorCode = exports.MissingTranslationError = exports.MessageFormatError = exports.MissingDataError = exports.InvalidConfigError = exports.UnsupportedFormatterError = exports.createIntlCache = exports.useIntl = exports.injectIntl = exports.createIntl = exports.RawIntlProvider = exports.IntlProvider = exports.IntlContext = exports.FormattedRelativeTime = exports.FormattedPlural = exports.FormattedMessage = exports.FormattedDateTimeRange = void 0;
var tslib_1 = require("tslib");
var createFormattedComponent_1 = require("./src/components/createFormattedComponent");
var injectIntl_1 = tslib_1.__importStar(require("./src/components/injectIntl"));
exports.injectIntl = injectIntl_1.default;
Object.defineProperty(exports, "RawIntlProvider", { enumerable: true, get: function () { return injectIntl_1.Provider; } });
Object.defineProperty(exports, "IntlContext", { enumerable: true, get: function () { return injectIntl_1.Context; } });
var useIntl_1 = tslib_1.__importDefault(require("./src/components/useIntl"));
exports.useIntl = useIntl_1.default;
var provider_1 = tslib_1.__importDefault(require("./src/components/provider"));
exports.IntlProvider = provider_1.default;
var createIntl_1 = require("./src/components/createIntl");
Object.defineProperty(exports, "createIntl", { enumerable: true, get: function () { return createIntl_1.createIntl; } });
var relative_1 = tslib_1.__importDefault(require("./src/components/relative"));
exports.FormattedRelativeTime = relative_1.default;
var plural_1 = tslib_1.__importDefault(require("./src/components/plural"));
exports.FormattedPlural = plural_1.default;
var message_1 = tslib_1.__importDefault(require("./src/components/message"));
exports.FormattedMessage = message_1.default;
var dateTimeRange_1 = tslib_1.__importDefault(require("./src/components/dateTimeRange"));
exports.FormattedDateTimeRange = dateTimeRange_1.default;
var intl_1 = require("@formatjs/intl");
Object.defineProperty(exports, "createIntlCache", { enumerable: true, get: function () { return intl_1.createIntlCache; } });
Object.defineProperty(exports, "UnsupportedFormatterError", { enumerable: true, get: function () { return intl_1.UnsupportedFormatterError; } });
Object.defineProperty(exports, "InvalidConfigError", { enumerable: true, get: function () { return intl_1.InvalidConfigError; } });
Object.defineProperty(exports, "MissingDataError", { enumerable: true, get: function () { return intl_1.MissingDataError; } });
Object.defineProperty(exports, "MessageFormatError", { enumerable: true, get: function () { return intl_1.MessageFormatError; } });
Object.defineProperty(exports, "MissingTranslationError", { enumerable: true, get: function () { return intl_1.MissingTranslationError; } });
Object.defineProperty(exports, "ReactIntlErrorCode", { enumerable: true, get: function () { return intl_1.IntlErrorCode; } });
Object.defineProperty(exports, "ReactIntlError", { enumerable: true, get: function () { return intl_1.IntlError; } });
function defineMessages(msgs) {
return msgs;
}
exports.defineMessages = defineMessages;
function defineMessage(msg) {
return msg;
}
exports.defineMessage = defineMessage;
// IMPORTANT: Explicit here to prevent api-extractor from outputing `import('./src/types').CustomFormatConfig`
exports.FormattedDate = (0, createFormattedComponent_1.createFormattedComponent)('formatDate');
exports.FormattedTime = (0, createFormattedComponent_1.createFormattedComponent)('formatTime');
exports.FormattedNumber = (0, createFormattedComponent_1.createFormattedComponent)('formatNumber');
exports.FormattedList = (0, createFormattedComponent_1.createFormattedComponent)('formatList');
exports.FormattedDisplayName = (0, createFormattedComponent_1.createFormattedComponent)('formatDisplayName');
exports.FormattedDateParts = (0, createFormattedComponent_1.createFormattedDateTimePartsComponent)('formatDate');
exports.FormattedTimeParts = (0, createFormattedComponent_1.createFormattedDateTimePartsComponent)('formatTime');
var createFormattedComponent_2 = require("./src/components/createFormattedComponent");
Object.defineProperty(exports, "FormattedNumberParts", { enumerable: true, get: function () { return createFormattedComponent_2.FormattedNumberParts; } });
Object.defineProperty(exports, "FormattedListParts", { enumerable: true, get: function () { return createFormattedComponent_2.FormattedListParts; } });

47
server/node_modules/react-intl/lib/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,47 @@
import * as React from 'react';
import { MessageDescriptor, CustomFormatConfig, FormatDateOptions } from '@formatjs/intl';
import { IntlListFormatOptions } from '@formatjs/intl-listformat';
import { DisplayNamesOptions } from '@formatjs/intl-displaynames';
import { NumberFormatOptions } from '@formatjs/ecma402-abstract';
import injectIntl, { Provider as RawIntlProvider, Context as IntlContext, WithIntlProps, WrappedComponentProps } from './src/components/injectIntl';
import useIntl from './src/components/useIntl';
import IntlProvider from './src/components/provider';
import { createIntl } from './src/components/createIntl';
import FormattedRelativeTime from './src/components/relative';
import FormattedPlural from './src/components/plural';
import FormattedMessage from './src/components/message';
import FormattedDateTimeRange from './src/components/dateTimeRange';
export { FormattedDateTimeRange, FormattedMessage, FormattedPlural, FormattedRelativeTime, IntlContext, IntlProvider, RawIntlProvider, WithIntlProps, WrappedComponentProps, createIntl, injectIntl, useIntl, };
export { IntlConfig, ResolvedIntlConfig, IntlShape } from './src/types';
export { createIntlCache, MessageDescriptor, IntlCache, Formatters, IntlFormatters, FormatDisplayNameOptions, FormatListOptions, FormatPluralOptions, FormatRelativeTimeOptions, FormatNumberOptions, FormatDateOptions, CustomFormatConfig, CustomFormats, UnsupportedFormatterError, InvalidConfigError, MissingDataError, MessageFormatError, MissingTranslationError, IntlErrorCode as ReactIntlErrorCode, IntlError as ReactIntlError, } from '@formatjs/intl';
export declare function defineMessages<K extends keyof any, T = MessageDescriptor, U extends Record<K, T> = Record<K, T>>(msgs: U): U;
export declare function defineMessage<T extends MessageDescriptor>(msg: T): T;
export declare const FormattedDate: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig & {
value: string | number | Date | undefined;
children?(formattedDate: string): React.ReactElement | null;
}>;
export declare const FormattedTime: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig & {
value: string | number | Date | undefined;
children?(formattedTime: string): React.ReactElement | null;
}>;
export declare const FormattedNumber: React.FC<Omit<NumberFormatOptions, 'localeMatcher'> & CustomFormatConfig<'number'> & {
value: number;
children?(formattedNumber: string): React.ReactElement | null;
}>;
export declare const FormattedList: React.FC<IntlListFormatOptions & {
value: readonly React.ReactNode[];
}>;
export declare const FormattedDisplayName: React.FC<DisplayNamesOptions & {
value: string | number | Record<string, unknown>;
}>;
export declare const FormattedDateParts: React.FC<FormatDateOptions & {
value: Parameters<Intl.DateTimeFormat['format']>[0] | string;
children(val: Intl.DateTimeFormatPart[]): React.ReactElement | null;
}>;
export declare const FormattedTimeParts: React.FC<FormatDateOptions & {
value: Parameters<Intl.DateTimeFormat['format']>[0] | string;
children(val: Intl.DateTimeFormatPart[]): React.ReactElement | null;
}>;
export { FormattedNumberParts, FormattedListParts, } from './src/components/createFormattedComponent';
export type { MessageFormatElement } from '@formatjs/icu-messageformat-parser';
export type { PrimitiveType } from 'intl-messageformat';

26
server/node_modules/react-intl/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
import { createFormattedComponent, createFormattedDateTimePartsComponent, } from './src/components/createFormattedComponent';
import injectIntl, { Provider as RawIntlProvider, Context as IntlContext, } from './src/components/injectIntl';
import useIntl from './src/components/useIntl';
import IntlProvider from './src/components/provider';
import { createIntl } from './src/components/createIntl';
import FormattedRelativeTime from './src/components/relative';
import FormattedPlural from './src/components/plural';
import FormattedMessage from './src/components/message';
import FormattedDateTimeRange from './src/components/dateTimeRange';
export { FormattedDateTimeRange, FormattedMessage, FormattedPlural, FormattedRelativeTime, IntlContext, IntlProvider, RawIntlProvider, createIntl, injectIntl, useIntl, };
export { createIntlCache, UnsupportedFormatterError, InvalidConfigError, MissingDataError, MessageFormatError, MissingTranslationError, IntlErrorCode as ReactIntlErrorCode, IntlError as ReactIntlError, } from '@formatjs/intl';
export function defineMessages(msgs) {
return msgs;
}
export function defineMessage(msg) {
return msg;
}
// IMPORTANT: Explicit here to prevent api-extractor from outputing `import('./src/types').CustomFormatConfig`
export var FormattedDate = createFormattedComponent('formatDate');
export var FormattedTime = createFormattedComponent('formatTime');
export var FormattedNumber = createFormattedComponent('formatNumber');
export var FormattedList = createFormattedComponent('formatList');
export var FormattedDisplayName = createFormattedComponent('formatDisplayName');
export var FormattedDateParts = createFormattedDateTimePartsComponent('formatDate');
export var FormattedTimeParts = createFormattedDateTimePartsComponent('formatTime');
export { FormattedNumberParts, FormattedListParts, } from './src/components/createFormattedComponent';

View File

@@ -0,0 +1,28 @@
import * as React from 'react';
import { FormatDateOptions, FormatNumberOptions, FormatListOptions, FormatDisplayNameOptions } from '@formatjs/intl';
import { IntlShape } from '../types';
import { Part } from '@formatjs/intl-listformat';
type Formatter = {
formatDate: FormatDateOptions;
formatTime: FormatDateOptions;
formatNumber: FormatNumberOptions;
formatList: FormatListOptions;
formatDisplayName: FormatDisplayNameOptions;
};
export declare const FormattedNumberParts: React.FC<Formatter['formatNumber'] & {
value: Parameters<IntlShape['formatNumber']>[0];
children(val: Intl.NumberFormatPart[]): React.ReactElement | null;
}>;
export declare const FormattedListParts: React.FC<Formatter['formatList'] & {
value: Parameters<IntlShape['formatList']>[0];
children(val: Part[]): React.ReactElement | null;
}>;
export declare function createFormattedDateTimePartsComponent<Name extends 'formatDate' | 'formatTime'>(name: Name): React.FC<Formatter[Name] & {
value: Parameters<IntlShape[Name]>[0];
children(val: Intl.DateTimeFormatPart[]): React.ReactElement | null;
}>;
export declare function createFormattedComponent<Name extends keyof Formatter>(name: Name): React.FC<Formatter[Name] & {
value: Parameters<IntlShape[Name]>[0];
children?(val: string): React.ReactElement | null;
}>;
export {};

View File

@@ -0,0 +1,62 @@
import { __rest } from "tslib";
import * as React from 'react';
import useIntl from './useIntl';
var DisplayName;
(function (DisplayName) {
DisplayName["formatDate"] = "FormattedDate";
DisplayName["formatTime"] = "FormattedTime";
DisplayName["formatNumber"] = "FormattedNumber";
DisplayName["formatList"] = "FormattedList";
// Note that this DisplayName is the locale display name, not to be confused with
// the name of the enum, which is for React component display name in dev tools.
DisplayName["formatDisplayName"] = "FormattedDisplayName";
})(DisplayName || (DisplayName = {}));
var DisplayNameParts;
(function (DisplayNameParts) {
DisplayNameParts["formatDate"] = "FormattedDateParts";
DisplayNameParts["formatTime"] = "FormattedTimeParts";
DisplayNameParts["formatNumber"] = "FormattedNumberParts";
DisplayNameParts["formatList"] = "FormattedListParts";
})(DisplayNameParts || (DisplayNameParts = {}));
export var FormattedNumberParts = function (props) {
var intl = useIntl();
var value = props.value, children = props.children, formatProps = __rest(props, ["value", "children"]);
return children(intl.formatNumberToParts(value, formatProps));
};
FormattedNumberParts.displayName = 'FormattedNumberParts';
export var FormattedListParts = function (props) {
var intl = useIntl();
var value = props.value, children = props.children, formatProps = __rest(props, ["value", "children"]);
return children(intl.formatListToParts(value, formatProps));
};
FormattedNumberParts.displayName = 'FormattedNumberParts';
export function createFormattedDateTimePartsComponent(name) {
var ComponentParts = function (props) {
var intl = useIntl();
var value = props.value, children = props.children, formatProps = __rest(props, ["value", "children"]);
var date = typeof value === 'string' ? new Date(value || 0) : value;
var formattedParts = name === 'formatDate'
? intl.formatDateToParts(date, formatProps)
: intl.formatTimeToParts(date, formatProps);
return children(formattedParts);
};
ComponentParts.displayName = DisplayNameParts[name];
return ComponentParts;
}
export function createFormattedComponent(name) {
var Component = function (props) {
var intl = useIntl();
var value = props.value, children = props.children, formatProps = __rest(props
// TODO: fix TS type definition for localeMatcher upstream
, ["value", "children"]);
// TODO: fix TS type definition for localeMatcher upstream
var formattedValue = intl[name](value, formatProps);
if (typeof children === 'function') {
return children(formattedValue);
}
var Text = intl.textComponent || React.Fragment;
return React.createElement(Text, null, formattedValue);
};
Component.displayName = DisplayName[name];
return Component;
}

View File

@@ -0,0 +1,9 @@
import { CreateIntlFn } from '@formatjs/intl';
import * as React from 'react';
import type { IntlConfig, IntlShape } from '../types';
/**
* Create intl object
* @param config intl config
* @param cache cache for formatter instances to prevent memory leak
*/
export declare const createIntl: CreateIntlFn<React.ReactNode, IntlConfig, IntlShape>;

View File

@@ -0,0 +1,63 @@
/*
* Copyright 2015, Yahoo Inc.
* Copyrights licensed under the New BSD License.
* See the accompanying LICENSE file for terms.
*/
import { __assign, __rest, __spreadArray } from "tslib";
import { createIntl as coreCreateIntl, formatMessage as coreFormatMessage, } from '@formatjs/intl';
import * as React from 'react';
import { DEFAULT_INTL_CONFIG, assignUniqueKeysToParts } from '../utils';
import { isFormatXMLElementFn, } from 'intl-messageformat';
function assignUniqueKeysToFormatXMLElementFnArgument(values) {
if (!values) {
return values;
}
return Object.keys(values).reduce(function (acc, k) {
var v = values[k];
acc[k] = isFormatXMLElementFn(v)
? assignUniqueKeysToParts(v)
: v;
return acc;
}, {});
}
var formatMessage = function (config, formatters, descriptor, rawValues) {
var rest = [];
for (var _i = 4; _i < arguments.length; _i++) {
rest[_i - 4] = arguments[_i];
}
var values = assignUniqueKeysToFormatXMLElementFnArgument(rawValues);
var chunks = coreFormatMessage.apply(void 0, __spreadArray([config,
formatters,
descriptor,
values], rest, false));
if (Array.isArray(chunks)) {
return React.Children.toArray(chunks);
}
return chunks;
};
/**
* Create intl object
* @param config intl config
* @param cache cache for formatter instances to prevent memory leak
*/
export var createIntl = function (_a, cache) {
var rawDefaultRichTextElements = _a.defaultRichTextElements, config = __rest(_a, ["defaultRichTextElements"]);
var defaultRichTextElements = assignUniqueKeysToFormatXMLElementFnArgument(rawDefaultRichTextElements);
var coreIntl = coreCreateIntl(__assign(__assign(__assign({}, DEFAULT_INTL_CONFIG), config), { defaultRichTextElements: defaultRichTextElements }), cache);
var resolvedConfig = {
locale: coreIntl.locale,
timeZone: coreIntl.timeZone,
fallbackOnEmptyString: coreIntl.fallbackOnEmptyString,
formats: coreIntl.formats,
defaultLocale: coreIntl.defaultLocale,
defaultFormats: coreIntl.defaultFormats,
messages: coreIntl.messages,
onError: coreIntl.onError,
defaultRichTextElements: defaultRichTextElements,
};
return __assign(__assign({}, coreIntl), { formatMessage: formatMessage.bind(null, resolvedConfig,
// @ts-expect-error fix this
coreIntl.formatters),
// @ts-expect-error fix this
$t: formatMessage.bind(null, resolvedConfig, coreIntl.formatters) });
};

View File

@@ -0,0 +1,10 @@
import * as React from 'react';
import { FormatDateOptions } from '@formatjs/intl';
import { DateTimeFormat } from '@formatjs/ecma402-abstract';
interface Props extends FormatDateOptions {
from: Parameters<DateTimeFormat['formatRange']>[0];
to: Parameters<DateTimeFormat['formatRange']>[1];
children?(value: React.ReactNode): React.ReactElement | null;
}
declare const FormattedDateTimeRange: React.FC<Props>;
export default FormattedDateTimeRange;

View File

@@ -0,0 +1,15 @@
import { __rest } from "tslib";
import * as React from 'react';
import useIntl from './useIntl';
var FormattedDateTimeRange = function (props) {
var intl = useIntl();
var from = props.from, to = props.to, children = props.children, formatProps = __rest(props, ["from", "to", "children"]);
var formattedValue = intl.formatDateTimeRange(from, to, formatProps);
if (typeof children === 'function') {
return children(formattedValue);
}
var Text = intl.textComponent || React.Fragment;
return React.createElement(Text, null, formattedValue);
};
FormattedDateTimeRange.displayName = 'FormattedDateTimeRange';
export default FormattedDateTimeRange;

View File

@@ -0,0 +1,39 @@
import * as React from 'react';
import { IntlShape } from '../types';
declare global {
interface Window {
/**
* Set this to `true` prior to mounting to bypass using a globally-exposed context.
*/
__REACT_INTL_BYPASS_GLOBAL_CONTEXT__: boolean | undefined;
__REACT_INTL_CONTEXT__: React.Context<IntlShape> | undefined;
}
}
export declare const Provider: React.Provider<IntlShape>;
export declare const Context: React.Context<IntlShape>;
export interface Opts<IntlPropName extends string = 'intl', ForwardRef extends boolean = false> {
intlPropName?: IntlPropName;
forwardRef?: ForwardRef;
enforceContext?: boolean;
}
export type WrappedComponentProps<IntlPropName extends string = 'intl'> = {
[k in IntlPropName]: IntlShape;
};
/**
* Utility type to help deal with the fact that `Omit` doesn't play well with unions:
* - https://github.com/microsoft/TypeScript/issues/31501
* - https://github.com/microsoft/TypeScript/issues/28339
*
* @example
* DistributedOmit<X | Y, K> --> Omit<X, K> | Omit<Y, K>
*/
export type DistributedOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
export type WithIntlProps<P> = DistributedOmit<P, keyof WrappedComponentProps> & {
forwardedRef?: React.Ref<any>;
};
export default function injectIntl<IntlPropName extends string = 'intl', P extends WrappedComponentProps<IntlPropName> = WrappedComponentProps<any>>(WrappedComponent: React.ComponentType<P>, options?: Opts<IntlPropName, false>): React.FC<WithIntlProps<P>> & {
WrappedComponent: React.ComponentType<P>;
};
export default function injectIntl<IntlPropName extends string = 'intl', P extends WrappedComponentProps<IntlPropName> = WrappedComponentProps<any>, T extends React.ComponentType<P> = any>(WrappedComponent: React.ComponentType<P>, options?: Opts<IntlPropName, true>): React.ForwardRefExoticComponent<React.PropsWithoutRef<WithIntlProps<React.PropsWithChildren<P>>> & React.RefAttributes<T>> & {
WrappedComponent: React.ComponentType<P>;
};

View File

@@ -0,0 +1,33 @@
import { __assign } from "tslib";
import * as React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
import { invariantIntlContext } from '../utils';
function getDisplayName(Component) {
return Component.displayName || Component.name || 'Component';
}
// This is primarily dealing with packaging systems where multiple copies of react-intl
// might exist
var IntlContext = typeof window !== 'undefined' && !window.__REACT_INTL_BYPASS_GLOBAL_CONTEXT__
? window.__REACT_INTL_CONTEXT__ ||
(window.__REACT_INTL_CONTEXT__ = React.createContext(null))
: React.createContext(null);
var IntlConsumer = IntlContext.Consumer, IntlProvider = IntlContext.Provider;
export var Provider = IntlProvider;
export var Context = IntlContext;
export default function injectIntl(WrappedComponent, options) {
var _a = options || {}, _b = _a.intlPropName, intlPropName = _b === void 0 ? 'intl' : _b, _c = _a.forwardRef, forwardRef = _c === void 0 ? false : _c, _d = _a.enforceContext, enforceContext = _d === void 0 ? true : _d;
var WithIntl = function (props) { return (React.createElement(IntlConsumer, null, function (intl) {
var _a;
if (enforceContext) {
invariantIntlContext(intl);
}
var intlProp = (_a = {}, _a[intlPropName] = intl, _a);
return (React.createElement(WrappedComponent, __assign({}, props, intlProp, { ref: forwardRef ? props.forwardedRef : null })));
})); };
WithIntl.displayName = "injectIntl(".concat(getDisplayName(WrappedComponent), ")");
WithIntl.WrappedComponent = WrappedComponent;
if (forwardRef) {
return hoistNonReactStatics(React.forwardRef(function (props, ref) { return (React.createElement(WithIntl, __assign({}, props, { forwardedRef: ref }))); }), WrappedComponent);
}
return hoistNonReactStatics(WithIntl, WrappedComponent);
}

View File

@@ -0,0 +1,11 @@
import * as React from 'react';
import type { FormatXMLElementFn, Options as IntlMessageFormatOptions, PrimitiveType } from 'intl-messageformat';
import { MessageDescriptor } from '@formatjs/intl';
export interface Props<V extends Record<string, any> = Record<string, React.ReactNode | PrimitiveType | FormatXMLElementFn<React.ReactNode, React.ReactNode>>> extends MessageDescriptor {
values?: V;
tagName?: React.ElementType<any>;
children?(nodes: React.ReactNode[]): React.ReactElement | null;
ignoreTag?: IntlMessageFormatOptions['ignoreTag'];
}
declare const MemoizedFormattedMessage: React.ComponentType<Props>;
export default MemoizedFormattedMessage;

View File

@@ -0,0 +1,35 @@
/*
* Copyright 2015, Yahoo Inc.
* Copyrights licensed under the New BSD License.
* See the accompanying LICENSE file for terms.
*/
import { __rest } from "tslib";
import * as React from 'react';
import useIntl from './useIntl';
import { shallowEqual } from '../utils';
function areEqual(prevProps, nextProps) {
var values = prevProps.values, otherProps = __rest(prevProps, ["values"]);
var nextValues = nextProps.values, nextOtherProps = __rest(nextProps, ["values"]);
return (shallowEqual(nextValues, values) &&
shallowEqual(otherProps, nextOtherProps));
}
function FormattedMessage(props) {
var intl = useIntl();
var formatMessage = intl.formatMessage, _a = intl.textComponent, Text = _a === void 0 ? React.Fragment : _a;
var id = props.id, description = props.description, defaultMessage = props.defaultMessage, values = props.values, children = props.children, _b = props.tagName, Component = _b === void 0 ? Text : _b, ignoreTag = props.ignoreTag;
var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
var nodes = formatMessage(descriptor, values, {
ignoreTag: ignoreTag,
});
if (typeof children === 'function') {
return children(Array.isArray(nodes) ? nodes : [nodes]);
}
if (Component) {
return React.createElement(Component, null, React.Children.toArray(nodes));
}
return React.createElement(React.Fragment, null, nodes);
}
FormattedMessage.displayName = 'FormattedMessage';
var MemoizedFormattedMessage = React.memo(FormattedMessage, areEqual);
MemoizedFormattedMessage.displayName = 'MemoizedFormattedMessage';
export default MemoizedFormattedMessage;

View File

@@ -0,0 +1,14 @@
import * as React from 'react';
import { FormatPluralOptions } from '@formatjs/intl';
interface Props extends FormatPluralOptions {
value: number;
other: React.ReactNode;
zero?: React.ReactNode;
one?: React.ReactNode;
two?: React.ReactNode;
few?: React.ReactNode;
many?: React.ReactNode;
children?(value: React.ReactNode): React.ReactElement | null;
}
declare const FormattedPlural: React.FC<Props>;
export default FormattedPlural;

View File

@@ -0,0 +1,23 @@
/*
* Copyright 2015, Yahoo Inc.
* Copyrights licensed under the New BSD License.
* See the accompanying LICENSE file for terms.
*/
import * as React from 'react';
import useIntl from './useIntl';
var FormattedPlural = function (props) {
var _a = useIntl(), formatPlural = _a.formatPlural, Text = _a.textComponent;
var value = props.value, other = props.other, children = props.children;
var pluralCategory = formatPlural(value, props);
var formattedPlural = props[pluralCategory] || other;
if (typeof children === 'function') {
return children(formattedPlural);
}
if (Text) {
return React.createElement(Text, null, formattedPlural);
}
// Work around @types/react where React.FC cannot return string
return formattedPlural;
};
FormattedPlural.displayName = 'FormattedPlural';
export default FormattedPlural;

View File

@@ -0,0 +1,28 @@
import { IntlCache } from '@formatjs/intl';
import * as React from 'react';
import type { IntlConfig, IntlShape } from '../types';
interface State {
/**
* Explicit intl cache to prevent memory leaks
*/
cache: IntlCache;
/**
* Intl object we created
*/
intl?: IntlShape;
/**
* list of memoized config we care about.
* This is important since creating intl is
* very expensive
*/
prevConfig: IntlConfig;
}
export default class IntlProvider extends React.PureComponent<React.PropsWithChildren<IntlConfig>, State> {
static displayName: string;
static defaultProps: Pick<import("../types").ResolvedIntlConfig, "timeZone" | "onError" | "fallbackOnEmptyString" | "formats" | "messages" | "defaultLocale" | "defaultFormats" | "textComponent">;
private cache;
state: State;
static getDerivedStateFromProps(props: Readonly<IntlConfig>, { prevConfig, cache }: State): Partial<State> | null;
render(): JSX.Element;
}
export {};

View File

@@ -0,0 +1,59 @@
/*
* Copyright 2015, Yahoo Inc.
* Copyrights licensed under the New BSD License.
* See the accompanying LICENSE file for terms.
*/
import { __extends } from "tslib";
import { createIntlCache } from '@formatjs/intl';
import * as React from 'react';
import { DEFAULT_INTL_CONFIG, invariantIntlContext, shallowEqual } from '../utils';
import { Provider } from './injectIntl';
import { createIntl } from './createIntl';
function processIntlConfig(config) {
return {
locale: config.locale,
timeZone: config.timeZone,
fallbackOnEmptyString: config.fallbackOnEmptyString,
formats: config.formats,
textComponent: config.textComponent,
messages: config.messages,
defaultLocale: config.defaultLocale,
defaultFormats: config.defaultFormats,
onError: config.onError,
onWarn: config.onWarn,
wrapRichTextChunksInFragment: config.wrapRichTextChunksInFragment,
defaultRichTextElements: config.defaultRichTextElements,
};
}
var IntlProvider = /** @class */ (function (_super) {
__extends(IntlProvider, _super);
function IntlProvider() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.cache = createIntlCache();
_this.state = {
cache: _this.cache,
intl: createIntl(processIntlConfig(_this.props), _this.cache),
prevConfig: processIntlConfig(_this.props),
};
return _this;
}
IntlProvider.getDerivedStateFromProps = function (props, _a) {
var prevConfig = _a.prevConfig, cache = _a.cache;
var config = processIntlConfig(props);
if (!shallowEqual(prevConfig, config)) {
return {
intl: createIntl(config, cache),
prevConfig: config,
};
}
return null;
};
IntlProvider.prototype.render = function () {
invariantIntlContext(this.state.intl);
return React.createElement(Provider, { value: this.state.intl }, this.props.children);
};
IntlProvider.displayName = 'IntlProvider';
IntlProvider.defaultProps = DEFAULT_INTL_CONFIG;
return IntlProvider;
}(React.PureComponent));
export default IntlProvider;

View File

@@ -0,0 +1,11 @@
import * as React from 'react';
import { RelativeTimeFormatSingularUnit } from '@formatjs/ecma402-abstract';
import { FormatRelativeTimeOptions } from '@formatjs/intl';
export interface Props extends FormatRelativeTimeOptions {
value?: number;
unit?: RelativeTimeFormatSingularUnit;
updateIntervalInSeconds?: number;
children?(value: string): React.ReactElement | null;
}
declare const FormattedRelativeTime: React.FC<Props>;
export default FormattedRelativeTime;

View File

@@ -0,0 +1,125 @@
import { __assign, __rest } from "tslib";
/*
* Copyright 2015, Yahoo Inc.
* Copyrights licensed under the New BSD License.
* See the accompanying LICENSE file for terms.
*/
import * as React from 'react';
import { invariant, } from '@formatjs/ecma402-abstract';
import useIntl from './useIntl';
var MINUTE = 60;
var HOUR = 60 * 60;
var DAY = 60 * 60 * 24;
function selectUnit(seconds) {
var absValue = Math.abs(seconds);
if (absValue < MINUTE) {
return 'second';
}
if (absValue < HOUR) {
return 'minute';
}
if (absValue < DAY) {
return 'hour';
}
return 'day';
}
function getDurationInSeconds(unit) {
switch (unit) {
case 'second':
return 1;
case 'minute':
return MINUTE;
case 'hour':
return HOUR;
default:
return DAY;
}
}
function valueToSeconds(value, unit) {
if (!value) {
return 0;
}
switch (unit) {
case 'second':
return value;
case 'minute':
return value * MINUTE;
default:
return value * HOUR;
}
}
var INCREMENTABLE_UNITS = [
'second',
'minute',
'hour',
];
function canIncrement(unit) {
if (unit === void 0) { unit = 'second'; }
return INCREMENTABLE_UNITS.indexOf(unit) > -1;
}
var SimpleFormattedRelativeTime = function (props) {
var _a = useIntl(), formatRelativeTime = _a.formatRelativeTime, Text = _a.textComponent;
var children = props.children, value = props.value, unit = props.unit, otherProps = __rest(props, ["children", "value", "unit"]);
var formattedRelativeTime = formatRelativeTime(value || 0, unit, otherProps);
if (typeof children === 'function') {
return children(formattedRelativeTime);
}
if (Text) {
return React.createElement(Text, null, formattedRelativeTime);
}
return React.createElement(React.Fragment, null, formattedRelativeTime);
};
var FormattedRelativeTime = function (_a) {
var _b = _a.value, value = _b === void 0 ? 0 : _b, _c = _a.unit, unit = _c === void 0 ? 'second' : _c, updateIntervalInSeconds = _a.updateIntervalInSeconds, otherProps = __rest(_a, ["value", "unit", "updateIntervalInSeconds"]);
invariant(!updateIntervalInSeconds ||
!!(updateIntervalInSeconds && canIncrement(unit)), 'Cannot schedule update with unit longer than hour');
var _d = React.useState(), prevUnit = _d[0], setPrevUnit = _d[1];
var _e = React.useState(0), prevValue = _e[0], setPrevValue = _e[1];
var _f = React.useState(0), currentValueInSeconds = _f[0], setCurrentValueInSeconds = _f[1];
var updateTimer;
if (unit !== prevUnit || value !== prevValue) {
setPrevValue(value || 0);
setPrevUnit(unit);
setCurrentValueInSeconds(canIncrement(unit) ? valueToSeconds(value, unit) : 0);
}
React.useEffect(function () {
function clearUpdateTimer() {
clearTimeout(updateTimer);
}
clearUpdateTimer();
// If there's no interval and we cannot increment this unit, do nothing
if (!updateIntervalInSeconds || !canIncrement(unit)) {
return clearUpdateTimer;
}
// Figure out the next interesting time
var nextValueInSeconds = currentValueInSeconds - updateIntervalInSeconds;
var nextUnit = selectUnit(nextValueInSeconds);
// We've reached the max auto incrementable unit, don't schedule another update
if (nextUnit === 'day') {
return clearUpdateTimer;
}
var unitDuration = getDurationInSeconds(nextUnit);
var remainder = nextValueInSeconds % unitDuration;
var prevInterestingValueInSeconds = nextValueInSeconds - remainder;
var nextInterestingValueInSeconds = prevInterestingValueInSeconds >= currentValueInSeconds
? prevInterestingValueInSeconds - unitDuration
: prevInterestingValueInSeconds;
var delayInSeconds = Math.abs(nextInterestingValueInSeconds - currentValueInSeconds);
if (currentValueInSeconds !== nextInterestingValueInSeconds) {
updateTimer = setTimeout(function () { return setCurrentValueInSeconds(nextInterestingValueInSeconds); }, delayInSeconds * 1e3);
}
return clearUpdateTimer;
}, [currentValueInSeconds, updateIntervalInSeconds, unit]);
var currentValue = value || 0;
var currentUnit = unit;
if (canIncrement(unit) &&
typeof currentValueInSeconds === 'number' &&
updateIntervalInSeconds) {
currentUnit = selectUnit(currentValueInSeconds);
var unitDuration = getDurationInSeconds(currentUnit);
currentValue = Math.round(currentValueInSeconds / unitDuration);
}
return (React.createElement(SimpleFormattedRelativeTime, __assign({ value: currentValue, unit: currentUnit }, otherProps)));
};
FormattedRelativeTime.displayName = 'FormattedRelativeTime';
export default FormattedRelativeTime;

View File

@@ -0,0 +1,2 @@
import { IntlShape } from '../types';
export default function useIntl(): IntlShape;

View File

@@ -0,0 +1,8 @@
import * as React from 'react';
import { Context } from './injectIntl';
import { invariantIntlContext } from '../utils';
export default function useIntl() {
var intl = React.useContext(Context);
invariantIntlContext(intl);
return intl;
}

11
server/node_modules/react-intl/lib/src/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
import * as React from 'react';
import { ResolvedIntlConfig as CoreResolvedIntlConfig, IntlFormatters, Formatters } from '@formatjs/intl';
import { DEFAULT_INTL_CONFIG } from './utils';
export type IntlConfig = Omit<ResolvedIntlConfig, keyof typeof DEFAULT_INTL_CONFIG> & Partial<typeof DEFAULT_INTL_CONFIG>;
export interface ResolvedIntlConfig extends CoreResolvedIntlConfig<React.ReactNode> {
textComponent?: React.ComponentType | keyof React.ReactHTML;
wrapRichTextChunksInFragment?: boolean;
}
export interface IntlShape extends ResolvedIntlConfig, IntlFormatters<React.ReactNode> {
formatters: Formatters;
}

1
server/node_modules/react-intl/lib/src/types.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

13
server/node_modules/react-intl/lib/src/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import { ResolvedIntlConfig } from './types';
import * as React from 'react';
import { FormatXMLElementFn } from 'intl-messageformat';
export declare function invariantIntlContext(intl?: any): asserts intl;
export declare const DEFAULT_INTL_CONFIG: Pick<ResolvedIntlConfig, 'fallbackOnEmptyString' | 'formats' | 'messages' | 'timeZone' | 'textComponent' | 'defaultLocale' | 'defaultFormats' | 'onError'>;
/**
* Takes a `formatXMLElementFn`, and composes it in function, which passes
* argument `parts` through, assigning unique key to each part, to prevent
* "Each child in a list should have a unique "key"" React error.
* @param formatXMLElementFn
*/
export declare function assignUniqueKeysToParts(formatXMLElementFn: FormatXMLElementFn<React.ReactNode>): FormatXMLElementFn<React.ReactNode>;
export declare function shallowEqual<T extends Record<string, unknown> = Record<string, unknown>>(objA?: T, objB?: T): boolean;

43
server/node_modules/react-intl/lib/src/utils.js generated vendored Normal file
View File

@@ -0,0 +1,43 @@
import { __assign } from "tslib";
import * as React from 'react';
import { invariant } from '@formatjs/ecma402-abstract';
import { DEFAULT_INTL_CONFIG as CORE_DEFAULT_INTL_CONFIG } from '@formatjs/intl';
export function invariantIntlContext(intl) {
invariant(intl, '[React Intl] Could not find required `intl` object. ' +
'<IntlProvider> needs to exist in the component ancestry.');
}
export var DEFAULT_INTL_CONFIG = __assign(__assign({}, CORE_DEFAULT_INTL_CONFIG), { textComponent: React.Fragment });
/**
* Takes a `formatXMLElementFn`, and composes it in function, which passes
* argument `parts` through, assigning unique key to each part, to prevent
* "Each child in a list should have a unique "key"" React error.
* @param formatXMLElementFn
*/
export function assignUniqueKeysToParts(formatXMLElementFn) {
return function (parts) {
// eslint-disable-next-line prefer-rest-params
return formatXMLElementFn(React.Children.toArray(parts));
};
}
export function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
if (!objA || !objB) {
return false;
}
var aKeys = Object.keys(objA);
var bKeys = Object.keys(objB);
var len = aKeys.length;
if (bKeys.length !== len) {
return false;
}
for (var i = 0; i < len; i++) {
var key = aKeys[i];
if (objA[key] !== objB[key] ||
!Object.prototype.hasOwnProperty.call(objB, key)) {
return false;
}
}
return true;
}

159
server/node_modules/react-intl/package.json generated vendored Normal file
View File

@@ -0,0 +1,159 @@
{
"name": "react-intl",
"version": "6.6.2",
"description": "Internationalize React apps. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations.",
"keywords": [
"intl",
"i18n",
"internationalization",
"locale",
"localization",
"globalization",
"react",
"reactjs",
"format",
"formatting",
"translate",
"translation"
],
"author": "Eric Ferraiuolo <edf@ericf.me>",
"contributors": [
"Aarni Koskela <akx@iki.fi>",
"Alexis Deveria <adeveria@gmail.com>",
"Andrew McCloud <andrew.mccloud@formsdirect.net>",
"Antoine <Ivraie@users.noreply.github.com>",
"Arnaud-Ceccaldi <arnaud.ceccaldi@schibsted.com>",
"Bryan Richards <brichardssa@gmail.com>",
"Caridy Patino <caridy@gmail.com>",
"Charles King <bringking@gmail.com>",
"Charlie Robbins <charlie.robbins@gmail.com>",
"Christian Budde Christensen <budde377@gmail.com>",
"Christian Fredh <christian.fredh@gmail.com>",
"Christopher Deutsch <cd@cdeutsch.com>",
"Daniel Kita <t.trax0@gmail.com>",
"David Christensen <OracPrime@users.noreply.github.com>",
"David Marland <djmarland@users.noreply.github.com>",
"Denis Sikuler <progwork@yandex.com>",
"Dominik Schmidt <evolveeee@gmail.com>",
"DragonRaider5 <marces.engel@googlemail.com>",
"dropfen <boris.kotov@gmail.com>",
"Dylan Kirby <djkirby@users.noreply.github.com>",
"Elvin Dzhavadov <web.botan@gmail.com>",
"Eric Baer <me@ericbaer.com>",
"Eric Ferraiuolo <edf@ericf.me>",
"Erik J. Sturcke <esturcke@users.noreply.github.com>",
"Eugie Limpin <eugiellimpin@users.noreply.github.com>",
"Giovanni Gonzaga <giovanni@buildo.io>",
"Henry Zhu <hi@henryzoo.com>",
"Ilya Panasenko <hottdogg2008@gmail.com>",
"Iswan Jumat <iswan@thinkcube.com>",
"James Kyle <me@thejameskyle.com>",
"Jan Dvorak <storyteller@freedombase.net>",
"Janic Duplessis <janicduplessis@gmail.com>",
"Jason Mitchell <jason.mitchell.w@gmail.com>",
"Jeremy Yap <dcsyjlj@nus.edu.sg>",
"Jeremy Yap <jeremy.yapjl@gmail.com>",
"Jiayi Hu <steph.jiayi@gmail.com>",
"Jimmy Jia <tesrin@gmail.com>",
"Joe Lencioni <joe.lencioni@gmail.com>",
"Jonas Antonelli <jonas.antonelli@gmail.com>",
"Jose G <josegranafdez@gmail.com>",
"Juan Ignacio Dopazo <juan@dopazo.me>",
"Julien Lecomte <julien.lecomte@gmail.com>",
"Kazuki <dsbnatut@gmail.com>",
"Kerem Sevencan <ciukerem@gmail.com>",
"Kipras Melnikovas <sarpixo@gmail.com>",
"Leo Y. Li <leo@leoyli.com>",
"Li Zhuoran John <zhuoran666@gmail.com>",
"Linjie Ding <pyrocat101@users.noreply.github.com>",
"Long Ho <holevietlong@gmail.com>",
"Maarten Rijke <maartenrijke@gmail.com>",
"Marc d'Entremont <cramhead@gmail.com>",
"Marc Schipperheyn <m.schipperheyn@gmail.com>",
"Mårten Pettersson <mtnptrsn@gmail.com>",
"Matt Parrilla <matthew.parrilla@gmail.com>",
"Matthew Kime <matt@mattki.me>",
"Matti Korttila <matti.korttila@gmail.com>",
"Michael Liang <mliang@opentable.com>",
"Moshe Brevda <mbrevda@gmail.com>",
"Nicola Molinari <nicola.molinari@commercetools.de>",
"Osipov Vladimir <zoux.me@gmail.com>",
"p10ns11y <sathyam.peram@gmail.com>",
"papasmile <ismail@azizahsolutions.biz>",
"Patrick Kempff <patrickkempff@gmail.com>",
"Pieter Joost van de Sande <pj@born2code.net>",
"PutziSan <putzisan@putzisan.de>",
"Rifat Nabi <to.rifat@gmail.com>",
"Rob Richard <robrichard87@gmail.com>",
"Rob Walker <rob@papertrail.io>",
"Roderick Hsiao <roderickhsiao@gmail.com>",
"Rodrigo Silveira <rodrigo@oddshot.tv>",
"rsamec <roman.samec2@gmail.com>",
"Rusya44 <rustamkudyashov@gmail.com>",
"Ryan Meyer <ryan1234@gmail.com>",
"Ryuichi Okumura <okuryu@okuryu.com>",
"salagadoola <salagadoola@ymail.com>",
"Samuel Reed <samuel.trace.reed@gmail.com>",
"sbertal <sbertal@yahoo-inc.com>",
"Scott Dickerson <scottsd@us.ibm.com>",
"Seth Bertalotto <seth@bertalotto.net>",
"sourabh2k15 <sourab.reddy2k14@gmail.com>",
"Stefan Maric <me@stefanmaric.com>",
"Stephen Doyle <32746416+stephendoyle1992@users.noreply.github.com>",
"swiftfoot <swiftfoot@hotmail.com>",
"Sylvester Keil <sylvester@keil.or.at>",
"telaoumatenyanis <telaoumatenyanis@outlook.fr>",
"Thibaud <thibaud@jnuine.com>",
"Timothy Blumberg <tblumberg39@gmail.com>",
"Tomas Roos <ptomasroos@gmail.com>",
"Tuan Iswan (TIJ) <info@iswanjumat.com>",
"Tyler Benziger <tabenziger@gmail.com>",
"Ville Immonen <ville.immonen@iki.fi>",
"Vincent Ricard <ghostd@users.noreply.github.com>",
"Yamagishi Kazutoshi <ykzts@desire.sh>",
"Yang Su <yang@quip.com>",
"zouxuoz <zouxuoz@gmail.com>"
],
"license": "BSD-3-Clause",
"homepage": "https://formatjs.io/docs/react-intl",
"bugs": {
"url": "https://github.com/formatjs/formatjs/issues"
},
"repository": {
"type": "git",
"url": "git@github.com:formatjs/formatjs.git"
},
"main": "index.js",
"module": "lib/index.js",
"types": "index.d.ts",
"sideEffects": false,
"dependencies": {
"@types/hoist-non-react-statics": "^3.3.1",
"@types/react": "16 || 17 || 18",
"hoist-non-react-statics": "^3.3.2",
"tslib": "^2.4.0",
"@formatjs/ecma402-abstract": "1.18.2",
"@formatjs/intl-displaynames": "6.6.6",
"@formatjs/intl": "2.10.0",
"@formatjs/icu-messageformat-parser": "2.7.6",
"@formatjs/intl-listformat": "7.5.5",
"intl-messageformat": "10.5.11"
},
"devDependencies": {
"@formatjs/intl-numberformat": "8.10.0",
"@formatjs/intl-relativetimeformat": "11.2.12"
},
"peerDependencies": {
"react": "^16.6.0 || 17 || 18",
"typescript": "^4.7 || 5"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
},
"browserslist": [
"ie 11"
],
"gitHead": "773d6ebf881357f6e4c2dd7e8984b1bd0f69b4ca"
}

4891
server/node_modules/react-intl/react-intl.iife.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,28 @@
import * as React from 'react';
import { FormatDateOptions, FormatNumberOptions, FormatListOptions, FormatDisplayNameOptions } from '@formatjs/intl';
import { IntlShape } from '../types';
import { Part } from '@formatjs/intl-listformat';
type Formatter = {
formatDate: FormatDateOptions;
formatTime: FormatDateOptions;
formatNumber: FormatNumberOptions;
formatList: FormatListOptions;
formatDisplayName: FormatDisplayNameOptions;
};
export declare const FormattedNumberParts: React.FC<Formatter['formatNumber'] & {
value: Parameters<IntlShape['formatNumber']>[0];
children(val: Intl.NumberFormatPart[]): React.ReactElement | null;
}>;
export declare const FormattedListParts: React.FC<Formatter['formatList'] & {
value: Parameters<IntlShape['formatList']>[0];
children(val: Part[]): React.ReactElement | null;
}>;
export declare function createFormattedDateTimePartsComponent<Name extends 'formatDate' | 'formatTime'>(name: Name): React.FC<Formatter[Name] & {
value: Parameters<IntlShape[Name]>[0];
children(val: Intl.DateTimeFormatPart[]): React.ReactElement | null;
}>;
export declare function createFormattedComponent<Name extends keyof Formatter>(name: Name): React.FC<Formatter[Name] & {
value: Parameters<IntlShape[Name]>[0];
children?(val: string): React.ReactElement | null;
}>;
export {};

View File

@@ -0,0 +1,69 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createFormattedComponent = exports.createFormattedDateTimePartsComponent = exports.FormattedListParts = exports.FormattedNumberParts = void 0;
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
var DisplayName;
(function (DisplayName) {
DisplayName["formatDate"] = "FormattedDate";
DisplayName["formatTime"] = "FormattedTime";
DisplayName["formatNumber"] = "FormattedNumber";
DisplayName["formatList"] = "FormattedList";
// Note that this DisplayName is the locale display name, not to be confused with
// the name of the enum, which is for React component display name in dev tools.
DisplayName["formatDisplayName"] = "FormattedDisplayName";
})(DisplayName || (DisplayName = {}));
var DisplayNameParts;
(function (DisplayNameParts) {
DisplayNameParts["formatDate"] = "FormattedDateParts";
DisplayNameParts["formatTime"] = "FormattedTimeParts";
DisplayNameParts["formatNumber"] = "FormattedNumberParts";
DisplayNameParts["formatList"] = "FormattedListParts";
})(DisplayNameParts || (DisplayNameParts = {}));
var FormattedNumberParts = function (props) {
var intl = (0, useIntl_1.default)();
var value = props.value, children = props.children, formatProps = tslib_1.__rest(props, ["value", "children"]);
return children(intl.formatNumberToParts(value, formatProps));
};
exports.FormattedNumberParts = FormattedNumberParts;
exports.FormattedNumberParts.displayName = 'FormattedNumberParts';
var FormattedListParts = function (props) {
var intl = (0, useIntl_1.default)();
var value = props.value, children = props.children, formatProps = tslib_1.__rest(props, ["value", "children"]);
return children(intl.formatListToParts(value, formatProps));
};
exports.FormattedListParts = FormattedListParts;
exports.FormattedNumberParts.displayName = 'FormattedNumberParts';
function createFormattedDateTimePartsComponent(name) {
var ComponentParts = function (props) {
var intl = (0, useIntl_1.default)();
var value = props.value, children = props.children, formatProps = tslib_1.__rest(props, ["value", "children"]);
var date = typeof value === 'string' ? new Date(value || 0) : value;
var formattedParts = name === 'formatDate'
? intl.formatDateToParts(date, formatProps)
: intl.formatTimeToParts(date, formatProps);
return children(formattedParts);
};
ComponentParts.displayName = DisplayNameParts[name];
return ComponentParts;
}
exports.createFormattedDateTimePartsComponent = createFormattedDateTimePartsComponent;
function createFormattedComponent(name) {
var Component = function (props) {
var intl = (0, useIntl_1.default)();
var value = props.value, children = props.children, formatProps = tslib_1.__rest(props
// TODO: fix TS type definition for localeMatcher upstream
, ["value", "children"]);
// TODO: fix TS type definition for localeMatcher upstream
var formattedValue = intl[name](value, formatProps);
if (typeof children === 'function') {
return children(formattedValue);
}
var Text = intl.textComponent || React.Fragment;
return React.createElement(Text, null, formattedValue);
};
Component.displayName = DisplayName[name];
return Component;
}
exports.createFormattedComponent = createFormattedComponent;

View File

@@ -0,0 +1,9 @@
import { CreateIntlFn } from '@formatjs/intl';
import * as React from 'react';
import type { IntlConfig, IntlShape } from '../types';
/**
* Create intl object
* @param config intl config
* @param cache cache for formatter instances to prevent memory leak
*/
export declare const createIntl: CreateIntlFn<React.ReactNode, IntlConfig, IntlShape>;

View File

@@ -0,0 +1,67 @@
"use strict";
/*
* Copyright 2015, Yahoo Inc.
* Copyrights licensed under the New BSD License.
* See the accompanying LICENSE file for terms.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.createIntl = void 0;
var tslib_1 = require("tslib");
var intl_1 = require("@formatjs/intl");
var React = tslib_1.__importStar(require("react"));
var utils_1 = require("../utils");
var intl_messageformat_1 = require("intl-messageformat");
function assignUniqueKeysToFormatXMLElementFnArgument(values) {
if (!values) {
return values;
}
return Object.keys(values).reduce(function (acc, k) {
var v = values[k];
acc[k] = (0, intl_messageformat_1.isFormatXMLElementFn)(v)
? (0, utils_1.assignUniqueKeysToParts)(v)
: v;
return acc;
}, {});
}
var formatMessage = function (config, formatters, descriptor, rawValues) {
var rest = [];
for (var _i = 4; _i < arguments.length; _i++) {
rest[_i - 4] = arguments[_i];
}
var values = assignUniqueKeysToFormatXMLElementFnArgument(rawValues);
var chunks = intl_1.formatMessage.apply(void 0, tslib_1.__spreadArray([config,
formatters,
descriptor,
values], rest, false));
if (Array.isArray(chunks)) {
return React.Children.toArray(chunks);
}
return chunks;
};
/**
* Create intl object
* @param config intl config
* @param cache cache for formatter instances to prevent memory leak
*/
var createIntl = function (_a, cache) {
var rawDefaultRichTextElements = _a.defaultRichTextElements, config = tslib_1.__rest(_a, ["defaultRichTextElements"]);
var defaultRichTextElements = assignUniqueKeysToFormatXMLElementFnArgument(rawDefaultRichTextElements);
var coreIntl = (0, intl_1.createIntl)(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, utils_1.DEFAULT_INTL_CONFIG), config), { defaultRichTextElements: defaultRichTextElements }), cache);
var resolvedConfig = {
locale: coreIntl.locale,
timeZone: coreIntl.timeZone,
fallbackOnEmptyString: coreIntl.fallbackOnEmptyString,
formats: coreIntl.formats,
defaultLocale: coreIntl.defaultLocale,
defaultFormats: coreIntl.defaultFormats,
messages: coreIntl.messages,
onError: coreIntl.onError,
defaultRichTextElements: defaultRichTextElements,
};
return tslib_1.__assign(tslib_1.__assign({}, coreIntl), { formatMessage: formatMessage.bind(null, resolvedConfig,
// @ts-expect-error fix this
coreIntl.formatters),
// @ts-expect-error fix this
$t: formatMessage.bind(null, resolvedConfig, coreIntl.formatters) });
};
exports.createIntl = createIntl;

View File

@@ -0,0 +1,10 @@
import * as React from 'react';
import { FormatDateOptions } from '@formatjs/intl';
import { DateTimeFormat } from '@formatjs/ecma402-abstract';
interface Props extends FormatDateOptions {
from: Parameters<DateTimeFormat['formatRange']>[0];
to: Parameters<DateTimeFormat['formatRange']>[1];
children?(value: React.ReactNode): React.ReactElement | null;
}
declare const FormattedDateTimeRange: React.FC<Props>;
export default FormattedDateTimeRange;

View File

@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
var FormattedDateTimeRange = function (props) {
var intl = (0, useIntl_1.default)();
var from = props.from, to = props.to, children = props.children, formatProps = tslib_1.__rest(props, ["from", "to", "children"]);
var formattedValue = intl.formatDateTimeRange(from, to, formatProps);
if (typeof children === 'function') {
return children(formattedValue);
}
var Text = intl.textComponent || React.Fragment;
return React.createElement(Text, null, formattedValue);
};
FormattedDateTimeRange.displayName = 'FormattedDateTimeRange';
exports.default = FormattedDateTimeRange;

View File

@@ -0,0 +1,39 @@
import * as React from 'react';
import { IntlShape } from '../types';
declare global {
interface Window {
/**
* Set this to `true` prior to mounting to bypass using a globally-exposed context.
*/
__REACT_INTL_BYPASS_GLOBAL_CONTEXT__: boolean | undefined;
__REACT_INTL_CONTEXT__: React.Context<IntlShape> | undefined;
}
}
export declare const Provider: React.Provider<IntlShape>;
export declare const Context: React.Context<IntlShape>;
export interface Opts<IntlPropName extends string = 'intl', ForwardRef extends boolean = false> {
intlPropName?: IntlPropName;
forwardRef?: ForwardRef;
enforceContext?: boolean;
}
export type WrappedComponentProps<IntlPropName extends string = 'intl'> = {
[k in IntlPropName]: IntlShape;
};
/**
* Utility type to help deal with the fact that `Omit` doesn't play well with unions:
* - https://github.com/microsoft/TypeScript/issues/31501
* - https://github.com/microsoft/TypeScript/issues/28339
*
* @example
* DistributedOmit<X | Y, K> --> Omit<X, K> | Omit<Y, K>
*/
export type DistributedOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
export type WithIntlProps<P> = DistributedOmit<P, keyof WrappedComponentProps> & {
forwardedRef?: React.Ref<any>;
};
export default function injectIntl<IntlPropName extends string = 'intl', P extends WrappedComponentProps<IntlPropName> = WrappedComponentProps<any>>(WrappedComponent: React.ComponentType<P>, options?: Opts<IntlPropName, false>): React.FC<WithIntlProps<P>> & {
WrappedComponent: React.ComponentType<P>;
};
export default function injectIntl<IntlPropName extends string = 'intl', P extends WrappedComponentProps<IntlPropName> = WrappedComponentProps<any>, T extends React.ComponentType<P> = any>(WrappedComponent: React.ComponentType<P>, options?: Opts<IntlPropName, true>): React.ForwardRefExoticComponent<React.PropsWithoutRef<WithIntlProps<React.PropsWithChildren<P>>> & React.RefAttributes<T>> & {
WrappedComponent: React.ComponentType<P>;
};

View File

@@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Context = exports.Provider = void 0;
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var hoist_non_react_statics_1 = tslib_1.__importDefault(require("hoist-non-react-statics"));
var utils_1 = require("../utils");
function getDisplayName(Component) {
return Component.displayName || Component.name || 'Component';
}
// This is primarily dealing with packaging systems where multiple copies of react-intl
// might exist
var IntlContext = typeof window !== 'undefined' && !window.__REACT_INTL_BYPASS_GLOBAL_CONTEXT__
? window.__REACT_INTL_CONTEXT__ ||
(window.__REACT_INTL_CONTEXT__ = React.createContext(null))
: React.createContext(null);
var IntlConsumer = IntlContext.Consumer, IntlProvider = IntlContext.Provider;
exports.Provider = IntlProvider;
exports.Context = IntlContext;
function injectIntl(WrappedComponent, options) {
var _a = options || {}, _b = _a.intlPropName, intlPropName = _b === void 0 ? 'intl' : _b, _c = _a.forwardRef, forwardRef = _c === void 0 ? false : _c, _d = _a.enforceContext, enforceContext = _d === void 0 ? true : _d;
var WithIntl = function (props) { return (React.createElement(IntlConsumer, null, function (intl) {
var _a;
if (enforceContext) {
(0, utils_1.invariantIntlContext)(intl);
}
var intlProp = (_a = {}, _a[intlPropName] = intl, _a);
return (React.createElement(WrappedComponent, tslib_1.__assign({}, props, intlProp, { ref: forwardRef ? props.forwardedRef : null })));
})); };
WithIntl.displayName = "injectIntl(".concat(getDisplayName(WrappedComponent), ")");
WithIntl.WrappedComponent = WrappedComponent;
if (forwardRef) {
return (0, hoist_non_react_statics_1.default)(React.forwardRef(function (props, ref) { return (React.createElement(WithIntl, tslib_1.__assign({}, props, { forwardedRef: ref }))); }), WrappedComponent);
}
return (0, hoist_non_react_statics_1.default)(WithIntl, WrappedComponent);
}
exports.default = injectIntl;

View File

@@ -0,0 +1,11 @@
import * as React from 'react';
import type { FormatXMLElementFn, Options as IntlMessageFormatOptions, PrimitiveType } from 'intl-messageformat';
import { MessageDescriptor } from '@formatjs/intl';
export interface Props<V extends Record<string, any> = Record<string, React.ReactNode | PrimitiveType | FormatXMLElementFn<React.ReactNode, React.ReactNode>>> extends MessageDescriptor {
values?: V;
tagName?: React.ElementType<any>;
children?(nodes: React.ReactNode[]): React.ReactElement | null;
ignoreTag?: IntlMessageFormatOptions['ignoreTag'];
}
declare const MemoizedFormattedMessage: React.ComponentType<Props>;
export default MemoizedFormattedMessage;

View File

@@ -0,0 +1,37 @@
"use strict";
/*
* Copyright 2015, Yahoo Inc.
* Copyrights licensed under the New BSD License.
* See the accompanying LICENSE file for terms.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
var utils_1 = require("../utils");
function areEqual(prevProps, nextProps) {
var values = prevProps.values, otherProps = tslib_1.__rest(prevProps, ["values"]);
var nextValues = nextProps.values, nextOtherProps = tslib_1.__rest(nextProps, ["values"]);
return ((0, utils_1.shallowEqual)(nextValues, values) &&
(0, utils_1.shallowEqual)(otherProps, nextOtherProps));
}
function FormattedMessage(props) {
var intl = (0, useIntl_1.default)();
var formatMessage = intl.formatMessage, _a = intl.textComponent, Text = _a === void 0 ? React.Fragment : _a;
var id = props.id, description = props.description, defaultMessage = props.defaultMessage, values = props.values, children = props.children, _b = props.tagName, Component = _b === void 0 ? Text : _b, ignoreTag = props.ignoreTag;
var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
var nodes = formatMessage(descriptor, values, {
ignoreTag: ignoreTag,
});
if (typeof children === 'function') {
return children(Array.isArray(nodes) ? nodes : [nodes]);
}
if (Component) {
return React.createElement(Component, null, React.Children.toArray(nodes));
}
return React.createElement(React.Fragment, null, nodes);
}
FormattedMessage.displayName = 'FormattedMessage';
var MemoizedFormattedMessage = React.memo(FormattedMessage, areEqual);
MemoizedFormattedMessage.displayName = 'MemoizedFormattedMessage';
exports.default = MemoizedFormattedMessage;

View File

@@ -0,0 +1,14 @@
import * as React from 'react';
import { FormatPluralOptions } from '@formatjs/intl';
interface Props extends FormatPluralOptions {
value: number;
other: React.ReactNode;
zero?: React.ReactNode;
one?: React.ReactNode;
two?: React.ReactNode;
few?: React.ReactNode;
many?: React.ReactNode;
children?(value: React.ReactNode): React.ReactElement | null;
}
declare const FormattedPlural: React.FC<Props>;
export default FormattedPlural;

View File

@@ -0,0 +1,26 @@
"use strict";
/*
* Copyright 2015, Yahoo Inc.
* Copyrights licensed under the New BSD License.
* See the accompanying LICENSE file for terms.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
var FormattedPlural = function (props) {
var _a = (0, useIntl_1.default)(), formatPlural = _a.formatPlural, Text = _a.textComponent;
var value = props.value, other = props.other, children = props.children;
var pluralCategory = formatPlural(value, props);
var formattedPlural = props[pluralCategory] || other;
if (typeof children === 'function') {
return children(formattedPlural);
}
if (Text) {
return React.createElement(Text, null, formattedPlural);
}
// Work around @types/react where React.FC cannot return string
return formattedPlural;
};
FormattedPlural.displayName = 'FormattedPlural';
exports.default = FormattedPlural;

View File

@@ -0,0 +1,28 @@
import { IntlCache } from '@formatjs/intl';
import * as React from 'react';
import type { IntlConfig, IntlShape } from '../types';
interface State {
/**
* Explicit intl cache to prevent memory leaks
*/
cache: IntlCache;
/**
* Intl object we created
*/
intl?: IntlShape;
/**
* list of memoized config we care about.
* This is important since creating intl is
* very expensive
*/
prevConfig: IntlConfig;
}
export default class IntlProvider extends React.PureComponent<React.PropsWithChildren<IntlConfig>, State> {
static displayName: string;
static defaultProps: Pick<import("../types").ResolvedIntlConfig, "timeZone" | "onError" | "fallbackOnEmptyString" | "formats" | "messages" | "defaultLocale" | "defaultFormats" | "textComponent">;
private cache;
state: State;
static getDerivedStateFromProps(props: Readonly<IntlConfig>, { prevConfig, cache }: State): Partial<State> | null;
render(): JSX.Element;
}
export {};

View File

@@ -0,0 +1,61 @@
"use strict";
/*
* Copyright 2015, Yahoo Inc.
* Copyrights licensed under the New BSD License.
* See the accompanying LICENSE file for terms.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var intl_1 = require("@formatjs/intl");
var React = tslib_1.__importStar(require("react"));
var utils_1 = require("../utils");
var injectIntl_1 = require("./injectIntl");
var createIntl_1 = require("./createIntl");
function processIntlConfig(config) {
return {
locale: config.locale,
timeZone: config.timeZone,
fallbackOnEmptyString: config.fallbackOnEmptyString,
formats: config.formats,
textComponent: config.textComponent,
messages: config.messages,
defaultLocale: config.defaultLocale,
defaultFormats: config.defaultFormats,
onError: config.onError,
onWarn: config.onWarn,
wrapRichTextChunksInFragment: config.wrapRichTextChunksInFragment,
defaultRichTextElements: config.defaultRichTextElements,
};
}
var IntlProvider = /** @class */ (function (_super) {
tslib_1.__extends(IntlProvider, _super);
function IntlProvider() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.cache = (0, intl_1.createIntlCache)();
_this.state = {
cache: _this.cache,
intl: (0, createIntl_1.createIntl)(processIntlConfig(_this.props), _this.cache),
prevConfig: processIntlConfig(_this.props),
};
return _this;
}
IntlProvider.getDerivedStateFromProps = function (props, _a) {
var prevConfig = _a.prevConfig, cache = _a.cache;
var config = processIntlConfig(props);
if (!(0, utils_1.shallowEqual)(prevConfig, config)) {
return {
intl: (0, createIntl_1.createIntl)(config, cache),
prevConfig: config,
};
}
return null;
};
IntlProvider.prototype.render = function () {
(0, utils_1.invariantIntlContext)(this.state.intl);
return React.createElement(injectIntl_1.Provider, { value: this.state.intl }, this.props.children);
};
IntlProvider.displayName = 'IntlProvider';
IntlProvider.defaultProps = utils_1.DEFAULT_INTL_CONFIG;
return IntlProvider;
}(React.PureComponent));
exports.default = IntlProvider;

View File

@@ -0,0 +1,11 @@
import * as React from 'react';
import { RelativeTimeFormatSingularUnit } from '@formatjs/ecma402-abstract';
import { FormatRelativeTimeOptions } from '@formatjs/intl';
export interface Props extends FormatRelativeTimeOptions {
value?: number;
unit?: RelativeTimeFormatSingularUnit;
updateIntervalInSeconds?: number;
children?(value: string): React.ReactElement | null;
}
declare const FormattedRelativeTime: React.FC<Props>;
export default FormattedRelativeTime;

View File

@@ -0,0 +1,127 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/*
* Copyright 2015, Yahoo Inc.
* Copyrights licensed under the New BSD License.
* See the accompanying LICENSE file for terms.
*/
var React = tslib_1.__importStar(require("react"));
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
var MINUTE = 60;
var HOUR = 60 * 60;
var DAY = 60 * 60 * 24;
function selectUnit(seconds) {
var absValue = Math.abs(seconds);
if (absValue < MINUTE) {
return 'second';
}
if (absValue < HOUR) {
return 'minute';
}
if (absValue < DAY) {
return 'hour';
}
return 'day';
}
function getDurationInSeconds(unit) {
switch (unit) {
case 'second':
return 1;
case 'minute':
return MINUTE;
case 'hour':
return HOUR;
default:
return DAY;
}
}
function valueToSeconds(value, unit) {
if (!value) {
return 0;
}
switch (unit) {
case 'second':
return value;
case 'minute':
return value * MINUTE;
default:
return value * HOUR;
}
}
var INCREMENTABLE_UNITS = [
'second',
'minute',
'hour',
];
function canIncrement(unit) {
if (unit === void 0) { unit = 'second'; }
return INCREMENTABLE_UNITS.indexOf(unit) > -1;
}
var SimpleFormattedRelativeTime = function (props) {
var _a = (0, useIntl_1.default)(), formatRelativeTime = _a.formatRelativeTime, Text = _a.textComponent;
var children = props.children, value = props.value, unit = props.unit, otherProps = tslib_1.__rest(props, ["children", "value", "unit"]);
var formattedRelativeTime = formatRelativeTime(value || 0, unit, otherProps);
if (typeof children === 'function') {
return children(formattedRelativeTime);
}
if (Text) {
return React.createElement(Text, null, formattedRelativeTime);
}
return React.createElement(React.Fragment, null, formattedRelativeTime);
};
var FormattedRelativeTime = function (_a) {
var _b = _a.value, value = _b === void 0 ? 0 : _b, _c = _a.unit, unit = _c === void 0 ? 'second' : _c, updateIntervalInSeconds = _a.updateIntervalInSeconds, otherProps = tslib_1.__rest(_a, ["value", "unit", "updateIntervalInSeconds"]);
(0, ecma402_abstract_1.invariant)(!updateIntervalInSeconds ||
!!(updateIntervalInSeconds && canIncrement(unit)), 'Cannot schedule update with unit longer than hour');
var _d = React.useState(), prevUnit = _d[0], setPrevUnit = _d[1];
var _e = React.useState(0), prevValue = _e[0], setPrevValue = _e[1];
var _f = React.useState(0), currentValueInSeconds = _f[0], setCurrentValueInSeconds = _f[1];
var updateTimer;
if (unit !== prevUnit || value !== prevValue) {
setPrevValue(value || 0);
setPrevUnit(unit);
setCurrentValueInSeconds(canIncrement(unit) ? valueToSeconds(value, unit) : 0);
}
React.useEffect(function () {
function clearUpdateTimer() {
clearTimeout(updateTimer);
}
clearUpdateTimer();
// If there's no interval and we cannot increment this unit, do nothing
if (!updateIntervalInSeconds || !canIncrement(unit)) {
return clearUpdateTimer;
}
// Figure out the next interesting time
var nextValueInSeconds = currentValueInSeconds - updateIntervalInSeconds;
var nextUnit = selectUnit(nextValueInSeconds);
// We've reached the max auto incrementable unit, don't schedule another update
if (nextUnit === 'day') {
return clearUpdateTimer;
}
var unitDuration = getDurationInSeconds(nextUnit);
var remainder = nextValueInSeconds % unitDuration;
var prevInterestingValueInSeconds = nextValueInSeconds - remainder;
var nextInterestingValueInSeconds = prevInterestingValueInSeconds >= currentValueInSeconds
? prevInterestingValueInSeconds - unitDuration
: prevInterestingValueInSeconds;
var delayInSeconds = Math.abs(nextInterestingValueInSeconds - currentValueInSeconds);
if (currentValueInSeconds !== nextInterestingValueInSeconds) {
updateTimer = setTimeout(function () { return setCurrentValueInSeconds(nextInterestingValueInSeconds); }, delayInSeconds * 1e3);
}
return clearUpdateTimer;
}, [currentValueInSeconds, updateIntervalInSeconds, unit]);
var currentValue = value || 0;
var currentUnit = unit;
if (canIncrement(unit) &&
typeof currentValueInSeconds === 'number' &&
updateIntervalInSeconds) {
currentUnit = selectUnit(currentValueInSeconds);
var unitDuration = getDurationInSeconds(currentUnit);
currentValue = Math.round(currentValueInSeconds / unitDuration);
}
return (React.createElement(SimpleFormattedRelativeTime, tslib_1.__assign({ value: currentValue, unit: currentUnit }, otherProps)));
};
FormattedRelativeTime.displayName = 'FormattedRelativeTime';
exports.default = FormattedRelativeTime;

View File

@@ -0,0 +1,2 @@
import { IntlShape } from '../types';
export default function useIntl(): IntlShape;

View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var injectIntl_1 = require("./injectIntl");
var utils_1 = require("../utils");
function useIntl() {
var intl = React.useContext(injectIntl_1.Context);
(0, utils_1.invariantIntlContext)(intl);
return intl;
}
exports.default = useIntl;

11
server/node_modules/react-intl/src/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
import * as React from 'react';
import { ResolvedIntlConfig as CoreResolvedIntlConfig, IntlFormatters, Formatters } from '@formatjs/intl';
import { DEFAULT_INTL_CONFIG } from './utils';
export type IntlConfig = Omit<ResolvedIntlConfig, keyof typeof DEFAULT_INTL_CONFIG> & Partial<typeof DEFAULT_INTL_CONFIG>;
export interface ResolvedIntlConfig extends CoreResolvedIntlConfig<React.ReactNode> {
textComponent?: React.ComponentType | keyof React.ReactHTML;
wrapRichTextChunksInFragment?: boolean;
}
export interface IntlShape extends ResolvedIntlConfig, IntlFormatters<React.ReactNode> {
formatters: Formatters;
}

2
server/node_modules/react-intl/src/types.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

13
server/node_modules/react-intl/src/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import { ResolvedIntlConfig } from './types';
import * as React from 'react';
import { FormatXMLElementFn } from 'intl-messageformat';
export declare function invariantIntlContext(intl?: any): asserts intl;
export declare const DEFAULT_INTL_CONFIG: Pick<ResolvedIntlConfig, 'fallbackOnEmptyString' | 'formats' | 'messages' | 'timeZone' | 'textComponent' | 'defaultLocale' | 'defaultFormats' | 'onError'>;
/**
* Takes a `formatXMLElementFn`, and composes it in function, which passes
* argument `parts` through, assigning unique key to each part, to prevent
* "Each child in a list should have a unique "key"" React error.
* @param formatXMLElementFn
*/
export declare function assignUniqueKeysToParts(formatXMLElementFn: FormatXMLElementFn<React.ReactNode>): FormatXMLElementFn<React.ReactNode>;
export declare function shallowEqual<T extends Record<string, unknown> = Record<string, unknown>>(objA?: T, objB?: T): boolean;

49
server/node_modules/react-intl/src/utils.js generated vendored Normal file
View File

@@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.shallowEqual = exports.assignUniqueKeysToParts = exports.DEFAULT_INTL_CONFIG = exports.invariantIntlContext = void 0;
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
var intl_1 = require("@formatjs/intl");
function invariantIntlContext(intl) {
(0, ecma402_abstract_1.invariant)(intl, '[React Intl] Could not find required `intl` object. ' +
'<IntlProvider> needs to exist in the component ancestry.');
}
exports.invariantIntlContext = invariantIntlContext;
exports.DEFAULT_INTL_CONFIG = tslib_1.__assign(tslib_1.__assign({}, intl_1.DEFAULT_INTL_CONFIG), { textComponent: React.Fragment });
/**
* Takes a `formatXMLElementFn`, and composes it in function, which passes
* argument `parts` through, assigning unique key to each part, to prevent
* "Each child in a list should have a unique "key"" React error.
* @param formatXMLElementFn
*/
function assignUniqueKeysToParts(formatXMLElementFn) {
return function (parts) {
// eslint-disable-next-line prefer-rest-params
return formatXMLElementFn(React.Children.toArray(parts));
};
}
exports.assignUniqueKeysToParts = assignUniqueKeysToParts;
function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
if (!objA || !objB) {
return false;
}
var aKeys = Object.keys(objA);
var bKeys = Object.keys(objB);
var len = aKeys.length;
if (bKeys.length !== len) {
return false;
}
for (var i = 0; i < len; i++) {
var key = aKeys[i];
if (objA[key] !== objB[key] ||
!Object.prototype.hasOwnProperty.call(objB, key)) {
return false;
}
}
return true;
}
exports.shallowEqual = shallowEqual;