@flickfyi/flkr 0.0.141 → 0.0.153
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/@flickfyi/attestation/.turbo/turbo-build.log +7 -7
- package/node_modules/@flickfyi/biscuit/.turbo/turbo-build.log +7 -7
- package/node_modules/@flickfyi/core/.oxlintrc.json +2 -1
- package/node_modules/@flickfyi/core/.turbo/turbo-build.log +499 -92
- package/node_modules/@flickfyi/core/README.md +58 -4
- package/node_modules/@flickfyi/core/dist/index.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/index.js +35 -24
- package/node_modules/@flickfyi/core/dist/kowalski/calculations.d.ts +17 -0
- package/node_modules/@flickfyi/core/dist/kowalski/calculator.d.ts +13 -0
- package/node_modules/@flickfyi/core/dist/kowalski/catalog.cjs +1 -0
- package/node_modules/@flickfyi/core/dist/kowalski/catalog.d.cts +962 -0
- package/node_modules/@flickfyi/core/dist/kowalski/catalog.d.ts +962 -0
- package/node_modules/@flickfyi/core/dist/kowalski/catalog.js +639 -0
- package/node_modules/@flickfyi/core/dist/kowalski/clocks.d.ts +4 -0
- package/node_modules/@flickfyi/core/dist/kowalski/date-time.d.ts +22 -0
- package/node_modules/@flickfyi/core/dist/kowalski/details.d.ts +7 -0
- package/node_modules/@flickfyi/core/dist/kowalski/everyday.d.ts +8 -0
- package/node_modules/@flickfyi/core/dist/kowalski/format.d.ts +4 -0
- package/node_modules/@flickfyi/core/dist/kowalski/frame.d.ts +161 -0
- package/node_modules/@flickfyi/core/dist/kowalski/index.cjs +21 -0
- package/node_modules/@flickfyi/core/dist/kowalski/index.d.cts +8 -0
- package/node_modules/@flickfyi/core/dist/kowalski/index.d.ts +8 -0
- package/node_modules/@flickfyi/core/dist/kowalski/index.js +7496 -0
- package/node_modules/@flickfyi/core/dist/kowalski/productivity.d.ts +5 -0
- package/node_modules/@flickfyi/core/dist/kowalski/recipe.d.ts +8 -0
- package/node_modules/@flickfyi/core/dist/kowalski/tools.d.ts +7 -0
- package/node_modules/@flickfyi/core/dist/kowalski/use-clock.d.ts +6 -0
- package/node_modules/@flickfyi/core/dist/kowalski/use-configured-feature.d.ts +19 -0
- package/node_modules/@flickfyi/core/dist/kowalski/use-feature-store.d.ts +15 -0
- package/node_modules/@flickfyi/core/dist/kowalski.css +506 -0
- package/node_modules/@flickfyi/core/dist/molecules/field/field.d.ts +8 -0
- package/node_modules/@flickfyi/core/dist/molecules/index.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/molecules/index.d.cts +3 -0
- package/node_modules/@flickfyi/core/dist/molecules/index.d.ts +3 -0
- package/node_modules/@flickfyi/core/dist/molecules/index.js +88 -27
- package/node_modules/@flickfyi/core/dist/molecules/segmented/segmented.d.ts +10 -0
- package/node_modules/@flickfyi/core/dist/molecules/stepper/stepper.d.ts +10 -0
- package/node_modules/@flickfyi/core/dist/quantum/use-store.d.ts +7 -1
- package/node_modules/@flickfyi/core/dist/themes.css +2 -0
- package/node_modules/@flickfyi/core/examples/kowalski/bill-split/bill-split.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/bill-split/bill-split.tsx +17 -0
- package/node_modules/@flickfyi/core/examples/kowalski/bookmark/bookmark.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/bookmark/bookmark.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/budget/budget.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/budget/budget.tsx +26 -0
- package/node_modules/@flickfyi/core/examples/kowalski/calculator/calculator.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/calculator/calculator.tsx +24 -0
- package/node_modules/@flickfyi/core/examples/kowalski/checklist/checklist.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/checklist/checklist.tsx +26 -0
- package/node_modules/@flickfyi/core/examples/kowalski/color-palette/color-palette.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/color-palette/color-palette.tsx +22 -0
- package/node_modules/@flickfyi/core/examples/kowalski/contact/contact.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/contact/contact.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/countdown/countdown.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/countdown/countdown.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/event/event.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/event/event.tsx +24 -0
- package/node_modules/@flickfyi/core/examples/kowalski/expense/expense.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/expense/expense.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/goal/goal.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/goal/goal.tsx +24 -0
- package/node_modules/@flickfyi/core/examples/kowalski/habit/habit.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/habit/habit.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/ledger/ledger.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/ledger/ledger.tsx +25 -0
- package/node_modules/@flickfyi/core/examples/kowalski/note/note.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/note/note.tsx +22 -0
- package/node_modules/@flickfyi/core/examples/kowalski/poll/poll.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/poll/poll.tsx +26 -0
- package/node_modules/@flickfyi/core/examples/kowalski/random-picker/random-picker.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/random-picker/random-picker.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/rating/rating.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/rating/rating.tsx +19 -0
- package/node_modules/@flickfyi/core/examples/kowalski/recipe/recipe.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/recipe/recipe.tsx +120 -0
- package/node_modules/@flickfyi/core/examples/kowalski/reminder/reminder.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/reminder/reminder.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/rotation/rotation.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/rotation/rotation.tsx +27 -0
- package/node_modules/@flickfyi/core/examples/kowalski/scoreboard/scoreboard.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/scoreboard/scoreboard.tsx +26 -0
- package/node_modules/@flickfyi/core/examples/kowalski/shopping-list/shopping-list.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/shopping-list/shopping-list.tsx +27 -0
- package/node_modules/@flickfyi/core/examples/kowalski/task-board/task-board.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/task-board/task-board.tsx +27 -0
- package/node_modules/@flickfyi/core/examples/kowalski/theme.ts +3 -0
- package/node_modules/@flickfyi/core/examples/kowalski/time-zone/time-zone.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/time-zone/time-zone.tsx +22 -0
- package/node_modules/@flickfyi/core/examples/kowalski/timer/timer.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/timer/timer.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/trip/trip.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/trip/trip.tsx +26 -0
- package/node_modules/@flickfyi/core/examples/kowalski/unit-converter/unit-converter.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/unit-converter/unit-converter.tsx +24 -0
- package/node_modules/@flickfyi/core/examples/parrott/calculator/calculator.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/checklist/checklist.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/countdown/countdown.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/counter/counter.stories.tsx +1 -0
- package/node_modules/@flickfyi/core/examples/parrott/fortune/fortune.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/grid/grid.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/kale-smoothie/kale-smoothie.stories.tsx +1 -0
- package/node_modules/@flickfyi/core/examples/parrott/list/list.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/log/log.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/timed-task/timed-task.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/timer/timer.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/fixtures/native/host/project.yml +3 -0
- package/node_modules/@flickfyi/core/fixtures/native/src/catalog-features.tsx +88 -0
- package/node_modules/@flickfyi/core/package.json +35 -5
- package/node_modules/@flickfyi/core/package.tsgo.json +19 -1
- package/node_modules/@flickfyi/core/scripts/vite-globals.d.ts +2 -0
- package/node_modules/@flickfyi/core/src/generated-types.d.ts +1 -0
- package/node_modules/@flickfyi/core/src/kowalski/README.md +9 -0
- package/node_modules/@flickfyi/core/src/kowalski/calculations.ts +106 -0
- package/node_modules/@flickfyi/core/src/kowalski/calculator.ts +243 -0
- package/node_modules/@flickfyi/core/src/kowalski/catalog.ts +787 -0
- package/node_modules/@flickfyi/core/src/kowalski/clocks.tsx +464 -0
- package/node_modules/@flickfyi/core/src/kowalski/date-time.tsx +469 -0
- package/node_modules/@flickfyi/core/src/kowalski/details.tsx +1387 -0
- package/node_modules/@flickfyi/core/src/kowalski/everyday.tsx +652 -0
- package/node_modules/@flickfyi/core/src/kowalski/format.ts +48 -0
- package/node_modules/@flickfyi/core/src/kowalski/frame.tsx +351 -0
- package/node_modules/@flickfyi/core/src/kowalski/index.ts +23 -0
- package/node_modules/@flickfyi/core/src/kowalski/productivity.tsx +575 -0
- package/node_modules/@flickfyi/core/src/kowalski/recipe.tsx +555 -0
- package/node_modules/@flickfyi/core/src/kowalski/stories/composition.stories.tsx +47 -0
- package/node_modules/@flickfyi/core/src/kowalski/stories/composition.tsx +100 -0
- package/node_modules/@flickfyi/core/src/kowalski/tools.tsx +1213 -0
- package/node_modules/@flickfyi/core/src/kowalski/use-clock.ts +19 -0
- package/node_modules/@flickfyi/core/src/kowalski/use-configured-feature.ts +85 -0
- package/node_modules/@flickfyi/core/src/kowalski/use-feature-store.ts +119 -0
- package/node_modules/@flickfyi/core/src/molecules/field/field.tsx +34 -0
- package/node_modules/@flickfyi/core/src/molecules/index.ts +3 -0
- package/node_modules/@flickfyi/core/src/molecules/segmented/segmented.tsx +48 -0
- package/node_modules/@flickfyi/core/src/molecules/stepper/stepper.tsx +54 -0
- package/node_modules/@flickfyi/core/src/quantum/use-store.ts +41 -16
- package/node_modules/@flickfyi/core/tests/fly.test.ts +34 -7
- package/node_modules/@flickfyi/core/tests/kowalski-calculations.test.ts +60 -0
- package/node_modules/@flickfyi/core/tests/kowalski-calculator.test.ts +142 -0
- package/node_modules/@flickfyi/core/tests/kowalski-contracts.test.ts +223 -0
- package/node_modules/@flickfyi/core/tests/kowalski-date-time.test.tsx +462 -0
- package/node_modules/@flickfyi/core/tests/kowalski-features.test.tsx +2158 -0
- package/node_modules/@flickfyi/core/tests/kowalski-store.test.tsx +514 -0
- package/node_modules/@flickfyi/core/tests/preview-build.test.ts +1 -1
- package/node_modules/@flickfyi/core/tests/quantum-use-store.test.ts +53 -1
- package/node_modules/@flickfyi/core/tests/verify-tsgo-assets.test.ts +1 -1
- package/node_modules/@flickfyi/core/tsconfig.vite-dts.json +2 -1
- package/node_modules/@flickfyi/core/tsgo.bun.lock +111 -9
- package/node_modules/@flickfyi/core/tsgo.package.json +21 -3
- package/node_modules/@flickfyi/core/vite.config.ts +9 -5
- package/node_modules/@flickfyi/core/vitest.config.ts +1 -1
- package/node_modules/@flickfyi/http-message-sig/.turbo/turbo-build.log +7 -7
- package/node_modules/@flickfyi/identity/.turbo/turbo-build.log +8 -9
- package/node_modules/@flickfyi/lens/.turbo/turbo-build.log +7 -7
- package/node_modules/@flickfyi/photon/.turbo/turbo-build.log +4 -4
- package/node_modules/@flickfyi/photon/Sources/Photon/Components/Button.swift +29 -2
- package/node_modules/@flickfyi/photon/Sources/PhotonVersion/Resources/photon-version.json +1 -1
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Components/ButtonHostTests.swift +26 -0
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/catalog-features.styles.json +1 -0
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/catalog-native.styles.json +1 -1
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/catalog-scale.styles.json +1 -1
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/catalog-theme.styles.json +1 -1
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/catalog-typography.styles.json +1 -1
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/stylex-calculator.styles.json +1 -1
- package/node_modules/@flickfyi/photon/dist/globals.d.ts +5 -0
- package/node_modules/@flickfyi/photon/dist/version.cjs +1 -1
- package/node_modules/@flickfyi/photon/dist/version.js +1 -1
- package/node_modules/@flickfyi/photon/generated/react-swiftui.d.ts +1 -0
- package/node_modules/@flickfyi/photon/package.json +1 -1
- package/node_modules/@flickfyi/photon/src/globals.d.ts +5 -0
- package/node_modules/@flickfyi/rwsdk-extensions/.turbo/turbo-build.log +7 -7
- package/node_modules/@formatjs/fast-memoize/LICENSE.md +9 -0
- package/node_modules/@formatjs/fast-memoize/README.md +3 -0
- package/node_modules/@formatjs/fast-memoize/index.d.ts +35 -0
- package/node_modules/@formatjs/fast-memoize/index.js +69 -0
- package/node_modules/@formatjs/fast-memoize/index.js.map +1 -0
- package/node_modules/@formatjs/fast-memoize/package.json +25 -0
- package/node_modules/@formatjs/icu-messageformat-parser/LICENSE.md +9 -0
- package/node_modules/@formatjs/icu-messageformat-parser/README.md +38 -0
- package/node_modules/@formatjs/icu-messageformat-parser/index.d.ts +393 -0
- package/node_modules/@formatjs/icu-messageformat-parser/index.js +2187 -0
- package/node_modules/@formatjs/icu-messageformat-parser/index.js.map +1 -0
- package/node_modules/@formatjs/icu-messageformat-parser/manipulator.d.ts +175 -0
- package/node_modules/@formatjs/icu-messageformat-parser/manipulator.js +209 -0
- package/node_modules/@formatjs/icu-messageformat-parser/manipulator.js.map +1 -0
- package/node_modules/@formatjs/icu-messageformat-parser/no-parser.d.ts +183 -0
- package/node_modules/@formatjs/icu-messageformat-parser/no-parser.js +162 -0
- package/node_modules/@formatjs/icu-messageformat-parser/no-parser.js.map +1 -0
- package/node_modules/@formatjs/icu-messageformat-parser/package.json +21 -0
- package/node_modules/@formatjs/icu-messageformat-parser/printer.d.ts +154 -0
- package/node_modules/@formatjs/icu-messageformat-parser/printer.js +224 -0
- package/node_modules/@formatjs/icu-messageformat-parser/printer.js.map +1 -0
- package/node_modules/@formatjs/icu-skeleton-parser/LICENSE.md +9 -0
- package/node_modules/@formatjs/icu-skeleton-parser/README.md +1 -0
- package/node_modules/@formatjs/icu-skeleton-parser/index.d.ts +67 -0
- package/node_modules/@formatjs/icu-skeleton-parser/index.js +380 -0
- package/node_modules/@formatjs/icu-skeleton-parser/index.js.map +1 -0
- package/node_modules/@formatjs/icu-skeleton-parser/package.json +15 -0
- package/node_modules/@formatjs/intl/LICENSE.md +9 -0
- package/node_modules/@formatjs/intl/README.md +3 -0
- package/node_modules/@formatjs/intl/index.d.ts +499 -0
- package/node_modules/@formatjs/intl/index.js +595 -0
- package/node_modules/@formatjs/intl/index.js.map +1 -0
- package/node_modules/@formatjs/intl/package.json +37 -0
- package/node_modules/decimal.js/LICENCE.md +23 -0
- package/node_modules/decimal.js/README.md +246 -0
- package/node_modules/decimal.js/decimal.d.ts +301 -0
- package/node_modules/decimal.js/decimal.js +4951 -0
- package/node_modules/decimal.js/decimal.mjs +4914 -0
- package/node_modules/decimal.js/package.json +55 -0
- package/node_modules/format-quantity/LICENSE +21 -0
- package/node_modules/format-quantity/README.md +181 -0
- package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.development.d.ts +131 -0
- package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.development.js +214 -0
- package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.development.js.map +1 -0
- package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.production.d.ts +131 -0
- package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.production.js +2 -0
- package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.production.js.map +1 -0
- package/node_modules/format-quantity/dist/cjs/index.d.ts +1 -0
- package/node_modules/format-quantity/dist/cjs/index.js +6 -0
- package/node_modules/format-quantity/dist/format-quantity.d.mts +131 -0
- package/node_modules/format-quantity/dist/format-quantity.legacy-esm.d.ts +131 -0
- package/node_modules/format-quantity/dist/format-quantity.legacy-esm.js +268 -0
- package/node_modules/format-quantity/dist/format-quantity.legacy-esm.js.map +1 -0
- package/node_modules/format-quantity/dist/format-quantity.mjs +208 -0
- package/node_modules/format-quantity/dist/format-quantity.mjs.map +1 -0
- package/node_modules/format-quantity/dist/format-quantity.production.d.mts +131 -0
- package/node_modules/format-quantity/dist/format-quantity.production.mjs +2 -0
- package/node_modules/format-quantity/dist/format-quantity.production.mjs.map +1 -0
- package/node_modules/format-quantity/dist/format-quantity.umd.min.js +3 -0
- package/node_modules/format-quantity/dist/format-quantity.umd.min.js.map +1 -0
- package/node_modules/format-quantity/package.json +81 -0
- package/node_modules/intl-messageformat/LICENSE.md +33 -0
- package/node_modules/intl-messageformat/README.md +3 -0
- package/node_modules/intl-messageformat/index.d.ts +177 -0
- package/node_modules/intl-messageformat/index.js +327 -0
- package/node_modules/intl-messageformat/index.js.map +1 -0
- package/node_modules/intl-messageformat/intl-messageformat.iife.js +2819 -0
- package/node_modules/intl-messageformat/package.json +40 -0
- package/node_modules/numeric-quantity/LICENSE +21 -0
- package/node_modules/numeric-quantity/README.md +306 -0
- package/node_modules/numeric-quantity/dist/cjs/index.d.ts +1 -0
- package/node_modules/numeric-quantity/dist/cjs/index.js +6 -0
- package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.development.d.ts +293 -0
- package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.development.js +579 -0
- package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.development.js.map +1 -0
- package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.production.d.ts +293 -0
- package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.production.js +2 -0
- package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.production.js.map +1 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.d.mts +293 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.iife.umd.min.js +2 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.iife.umd.min.js.map +1 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.legacy-esm.d.ts +293 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.legacy-esm.js +622 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.legacy-esm.js.map +1 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.mjs +564 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.mjs.map +1 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.production.d.mts +293 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.production.mjs +2 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.production.mjs.map +1 -0
- package/node_modules/numeric-quantity/package.json +72 -0
- package/node_modules/validator/LICENSE +20 -0
- package/node_modules/validator/README.md +269 -0
- package/node_modules/validator/es/index.js +218 -0
- package/node_modules/validator/es/lib/alpha.js +151 -0
- package/node_modules/validator/es/lib/blacklist.js +5 -0
- package/node_modules/validator/es/lib/contains.js +15 -0
- package/node_modules/validator/es/lib/equals.js +5 -0
- package/node_modules/validator/es/lib/escape.js +5 -0
- package/node_modules/validator/es/lib/isAbaRouting.js +15 -0
- package/node_modules/validator/es/lib/isAfter.js +10 -0
- package/node_modules/validator/es/lib/isAlpha.js +23 -0
- package/node_modules/validator/es/lib/isAlphanumeric.js +23 -0
- package/node_modules/validator/es/lib/isAscii.js +10 -0
- package/node_modules/validator/es/lib/isBIC.js +16 -0
- package/node_modules/validator/es/lib/isBase32.js +15 -0
- package/node_modules/validator/es/lib/isBase58.js +8 -0
- package/node_modules/validator/es/lib/isBase64.js +23 -0
- package/node_modules/validator/es/lib/isBefore.js +10 -0
- package/node_modules/validator/es/lib/isBoolean.js +15 -0
- package/node_modules/validator/es/lib/isBtcAddress.js +7 -0
- package/node_modules/validator/es/lib/isByteLength.js +19 -0
- package/node_modules/validator/es/lib/isCreditCard.js +43 -0
- package/node_modules/validator/es/lib/isCurrency.js +74 -0
- package/node_modules/validator/es/lib/isDataURI.js +31 -0
- package/node_modules/validator/es/lib/isDate.js +93 -0
- package/node_modules/validator/es/lib/isDecimal.js +22 -0
- package/node_modules/validator/es/lib/isDivisibleBy.js +6 -0
- package/node_modules/validator/es/lib/isEAN.js +70 -0
- package/node_modules/validator/es/lib/isEmail.js +165 -0
- package/node_modules/validator/es/lib/isEmpty.js +10 -0
- package/node_modules/validator/es/lib/isEthereumAddress.js +6 -0
- package/node_modules/validator/es/lib/isFQDN.js +67 -0
- package/node_modules/validator/es/lib/isFloat.js +14 -0
- package/node_modules/validator/es/lib/isFullWidth.js +6 -0
- package/node_modules/validator/es/lib/isHSL.js +13 -0
- package/node_modules/validator/es/lib/isHalfWidth.js +6 -0
- package/node_modules/validator/es/lib/isHash.js +21 -0
- package/node_modules/validator/es/lib/isHexColor.js +13 -0
- package/node_modules/validator/es/lib/isHexadecimal.js +6 -0
- package/node_modules/validator/es/lib/isIBAN.js +171 -0
- package/node_modules/validator/es/lib/isIMEI.js +40 -0
- package/node_modules/validator/es/lib/isIP.js +58 -0
- package/node_modules/validator/es/lib/isIPRange.js +41 -0
- package/node_modules/validator/es/lib/isISBN.js +47 -0
- package/node_modules/validator/es/lib/isISIN.js +55 -0
- package/node_modules/validator/es/lib/isISO15924.js +9 -0
- package/node_modules/validator/es/lib/isISO31661Alpha2.js +21 -0
- package/node_modules/validator/es/lib/isISO31661Alpha3.js +20 -0
- package/node_modules/validator/es/lib/isISO31661Numeric.js +8 -0
- package/node_modules/validator/es/lib/isISO4217.js +9 -0
- package/node_modules/validator/es/lib/isISO6346.js +28 -0
- package/node_modules/validator/es/lib/isISO6391.js +6 -0
- package/node_modules/validator/es/lib/isISO8601.js +42 -0
- package/node_modules/validator/es/lib/isISRC.js +8 -0
- package/node_modules/validator/es/lib/isISSN.js +19 -0
- package/node_modules/validator/es/lib/isIdentityCard.js +407 -0
- package/node_modules/validator/es/lib/isIn.js +23 -0
- package/node_modules/validator/es/lib/isInt.js +19 -0
- package/node_modules/validator/es/lib/isJSON.js +26 -0
- package/node_modules/validator/es/lib/isJWT.js +15 -0
- package/node_modules/validator/es/lib/isLatLong.js +21 -0
- package/node_modules/validator/es/lib/isLength.js +27 -0
- package/node_modules/validator/es/lib/isLicensePlate.js +58 -0
- package/node_modules/validator/es/lib/isLocale.js +107 -0
- package/node_modules/validator/es/lib/isLowercase.js +5 -0
- package/node_modules/validator/es/lib/isLuhnNumber.js +25 -0
- package/node_modules/validator/es/lib/isMACAddress.js +36 -0
- package/node_modules/validator/es/lib/isMD5.js +6 -0
- package/node_modules/validator/es/lib/isMagnetURI.js +9 -0
- package/node_modules/validator/es/lib/isMailtoURI.js +75 -0
- package/node_modules/validator/es/lib/isMimeType.js +40 -0
- package/node_modules/validator/es/lib/isMobilePhone.js +212 -0
- package/node_modules/validator/es/lib/isMongoId.js +6 -0
- package/node_modules/validator/es/lib/isMultibyte.js +10 -0
- package/node_modules/validator/es/lib/isNumeric.js +10 -0
- package/node_modules/validator/es/lib/isOctal.js +6 -0
- package/node_modules/validator/es/lib/isPassportNumber.js +145 -0
- package/node_modules/validator/es/lib/isPort.js +8 -0
- package/node_modules/validator/es/lib/isPostalCode.js +100 -0
- package/node_modules/validator/es/lib/isRFC3339.js +21 -0
- package/node_modules/validator/es/lib/isRgbColor.js +34 -0
- package/node_modules/validator/es/lib/isSemVer.js +14 -0
- package/node_modules/validator/es/lib/isSlug.js +6 -0
- package/node_modules/validator/es/lib/isStrongPassword.js +90 -0
- package/node_modules/validator/es/lib/isSurrogatePair.js +6 -0
- package/node_modules/validator/es/lib/isTaxID.js +1407 -0
- package/node_modules/validator/es/lib/isTime.js +22 -0
- package/node_modules/validator/es/lib/isULID.js +5 -0
- package/node_modules/validator/es/lib/isURL.js +241 -0
- package/node_modules/validator/es/lib/isUUID.js +23 -0
- package/node_modules/validator/es/lib/isUppercase.js +5 -0
- package/node_modules/validator/es/lib/isVAT.js +264 -0
- package/node_modules/validator/es/lib/isVariableWidth.js +7 -0
- package/node_modules/validator/es/lib/isWhitelisted.js +10 -0
- package/node_modules/validator/es/lib/ltrim.js +7 -0
- package/node_modules/validator/es/lib/matches.js +8 -0
- package/node_modules/validator/es/lib/normalizeEmail.js +131 -0
- package/node_modules/validator/es/lib/rtrim.js +15 -0
- package/node_modules/validator/es/lib/stripLow.js +7 -0
- package/node_modules/validator/es/lib/toBoolean.js +8 -0
- package/node_modules/validator/es/lib/toDate.js +6 -0
- package/node_modules/validator/es/lib/toFloat.js +5 -0
- package/node_modules/validator/es/lib/toInt.js +5 -0
- package/node_modules/validator/es/lib/trim.js +5 -0
- package/node_modules/validator/es/lib/unescape.js +8 -0
- package/node_modules/validator/es/lib/util/algorithms.js +79 -0
- package/node_modules/validator/es/lib/util/assertString.js +4 -0
- package/node_modules/validator/es/lib/util/checkHost.js +12 -0
- package/node_modules/validator/es/lib/util/includesArray.js +6 -0
- package/node_modules/validator/es/lib/util/includesString.js +4 -0
- package/node_modules/validator/es/lib/util/merge.js +14 -0
- package/node_modules/validator/es/lib/util/multilineRegex.js +12 -0
- package/node_modules/validator/es/lib/util/nullUndefinedCheck.js +3 -0
- package/node_modules/validator/es/lib/util/toString.js +13 -0
- package/node_modules/validator/es/lib/util/typeOf.js +10 -0
- package/node_modules/validator/es/lib/whitelist.js +5 -0
- package/node_modules/validator/index.js +229 -0
- package/node_modules/validator/lib/alpha.js +157 -0
- package/node_modules/validator/lib/blacklist.js +14 -0
- package/node_modules/validator/lib/contains.js +24 -0
- package/node_modules/validator/lib/equals.js +14 -0
- package/node_modules/validator/lib/escape.js +14 -0
- package/node_modules/validator/lib/isAbaRouting.js +23 -0
- package/node_modules/validator/lib/isAfter.js +19 -0
- package/node_modules/validator/lib/isAlpha.js +31 -0
- package/node_modules/validator/lib/isAlphanumeric.js +31 -0
- package/node_modules/validator/lib/isAscii.js +18 -0
- package/node_modules/validator/lib/isBIC.js +24 -0
- package/node_modules/validator/lib/isBase32.js +24 -0
- package/node_modules/validator/lib/isBase58.js +16 -0
- package/node_modules/validator/lib/isBase64.js +32 -0
- package/node_modules/validator/lib/isBefore.js +19 -0
- package/node_modules/validator/lib/isBoolean.js +24 -0
- package/node_modules/validator/lib/isBtcAddress.js +16 -0
- package/node_modules/validator/lib/isByteLength.js +27 -0
- package/node_modules/validator/lib/isCreditCard.js +52 -0
- package/node_modules/validator/lib/isCurrency.js +83 -0
- package/node_modules/validator/lib/isDataURI.js +40 -0
- package/node_modules/validator/lib/isDate.js +102 -0
- package/node_modules/validator/lib/isDecimal.js +31 -0
- package/node_modules/validator/lib/isDivisibleBy.js +15 -0
- package/node_modules/validator/lib/isEAN.js +78 -0
- package/node_modules/validator/lib/isEmail.js +174 -0
- package/node_modules/validator/lib/isEmpty.js +19 -0
- package/node_modules/validator/lib/isEthereumAddress.js +15 -0
- package/node_modules/validator/lib/isFQDN.js +76 -0
- package/node_modules/validator/lib/isFloat.js +22 -0
- package/node_modules/validator/lib/isFullWidth.js +14 -0
- package/node_modules/validator/lib/isHSL.js +22 -0
- package/node_modules/validator/lib/isHalfWidth.js +14 -0
- package/node_modules/validator/lib/isHash.js +30 -0
- package/node_modules/validator/lib/isHexColor.js +22 -0
- package/node_modules/validator/lib/isHexadecimal.js +15 -0
- package/node_modules/validator/lib/isIBAN.js +178 -0
- package/node_modules/validator/lib/isIMEI.js +49 -0
- package/node_modules/validator/lib/isIP.js +67 -0
- package/node_modules/validator/lib/isIPRange.js +50 -0
- package/node_modules/validator/lib/isISBN.js +56 -0
- package/node_modules/validator/lib/isISIN.js +64 -0
- package/node_modules/validator/lib/isISO15924.js +16 -0
- package/node_modules/validator/lib/isISO31661Alpha2.js +28 -0
- package/node_modules/validator/lib/isISO31661Alpha3.js +28 -0
- package/node_modules/validator/lib/isISO31661Numeric.js +16 -0
- package/node_modules/validator/lib/isISO4217.js +16 -0
- package/node_modules/validator/lib/isISO6346.js +35 -0
- package/node_modules/validator/lib/isISO6391.js +15 -0
- package/node_modules/validator/lib/isISO8601.js +50 -0
- package/node_modules/validator/lib/isISRC.js +16 -0
- package/node_modules/validator/lib/isISSN.js +28 -0
- package/node_modules/validator/lib/isIdentityCard.js +416 -0
- package/node_modules/validator/lib/isIn.js +32 -0
- package/node_modules/validator/lib/isInt.js +28 -0
- package/node_modules/validator/lib/isJSON.js +35 -0
- package/node_modules/validator/lib/isJWT.js +24 -0
- package/node_modules/validator/lib/isLatLong.js +30 -0
- package/node_modules/validator/lib/isLength.js +35 -0
- package/node_modules/validator/lib/isLicensePlate.js +67 -0
- package/node_modules/validator/lib/isLocale.js +115 -0
- package/node_modules/validator/lib/isLowercase.js +14 -0
- package/node_modules/validator/lib/isLuhnNumber.js +34 -0
- package/node_modules/validator/lib/isMACAddress.js +45 -0
- package/node_modules/validator/lib/isMD5.js +15 -0
- package/node_modules/validator/lib/isMagnetURI.js +18 -0
- package/node_modules/validator/lib/isMailtoURI.js +84 -0
- package/node_modules/validator/lib/isMimeType.js +48 -0
- package/node_modules/validator/lib/isMobilePhone.js +219 -0
- package/node_modules/validator/lib/isMongoId.js +15 -0
- package/node_modules/validator/lib/isMultibyte.js +18 -0
- package/node_modules/validator/lib/isNumeric.js +19 -0
- package/node_modules/validator/lib/isOctal.js +15 -0
- package/node_modules/validator/lib/isPassportNumber.js +152 -0
- package/node_modules/validator/lib/isPort.js +17 -0
- package/node_modules/validator/lib/isPostalCode.js +107 -0
- package/node_modules/validator/lib/isRFC3339.js +29 -0
- package/node_modules/validator/lib/isRgbColor.js +42 -0
- package/node_modules/validator/lib/isSemVer.js +22 -0
- package/node_modules/validator/lib/isSlug.js +15 -0
- package/node_modules/validator/lib/isStrongPassword.js +99 -0
- package/node_modules/validator/lib/isSurrogatePair.js +15 -0
- package/node_modules/validator/lib/isTaxID.js +1417 -0
- package/node_modules/validator/lib/isTime.js +31 -0
- package/node_modules/validator/lib/isULID.js +14 -0
- package/node_modules/validator/lib/isURL.js +249 -0
- package/node_modules/validator/lib/isUUID.js +32 -0
- package/node_modules/validator/lib/isUppercase.js +14 -0
- package/node_modules/validator/lib/isVAT.js +274 -0
- package/node_modules/validator/lib/isVariableWidth.js +16 -0
- package/node_modules/validator/lib/isWhitelisted.js +19 -0
- package/node_modules/validator/lib/ltrim.js +16 -0
- package/node_modules/validator/lib/matches.js +17 -0
- package/node_modules/validator/lib/normalizeEmail.js +140 -0
- package/node_modules/validator/lib/rtrim.js +24 -0
- package/node_modules/validator/lib/stripLow.js +16 -0
- package/node_modules/validator/lib/toBoolean.js +17 -0
- package/node_modules/validator/lib/toDate.js +15 -0
- package/node_modules/validator/lib/toFloat.js +14 -0
- package/node_modules/validator/lib/toInt.js +14 -0
- package/node_modules/validator/lib/trim.js +14 -0
- package/node_modules/validator/lib/unescape.js +17 -0
- package/node_modules/validator/lib/util/algorithms.js +88 -0
- package/node_modules/validator/lib/util/assertString.js +12 -0
- package/node_modules/validator/lib/util/checkHost.js +20 -0
- package/node_modules/validator/lib/util/includesArray.js +14 -0
- package/node_modules/validator/lib/util/includesString.js +12 -0
- package/node_modules/validator/lib/util/merge.js +22 -0
- package/node_modules/validator/lib/util/multilineRegex.js +20 -0
- package/node_modules/validator/lib/util/nullUndefinedCheck.js +11 -0
- package/node_modules/validator/lib/util/toString.js +21 -0
- package/node_modules/validator/lib/util/typeOf.js +18 -0
- package/node_modules/validator/lib/whitelist.js +14 -0
- package/node_modules/validator/package.json +76 -0
- package/node_modules/validator/validator.js +5808 -0
- package/node_modules/validator/validator.min.js +23 -0
- package/package.json +3 -3
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { memoize, strategies } from "@formatjs/fast-memoize";
|
|
2
|
+
import { isArgumentElement, isDateElement, isDateTimeSkeleton, isLiteralElement, isNumberElement, isNumberSkeleton, isPluralElement, isPoundElement, isSelectElement, isTagElement, isTimeElement, parse } from "@formatjs/icu-messageformat-parser";
|
|
3
|
+
//#region packages/intl-messageformat/error.ts
|
|
4
|
+
let ErrorCode = /* @__PURE__ */ function(ErrorCode) {
|
|
5
|
+
ErrorCode["MISSING_VALUE"] = "MISSING_VALUE";
|
|
6
|
+
ErrorCode["INVALID_VALUE"] = "INVALID_VALUE";
|
|
7
|
+
ErrorCode["MISSING_INTL_API"] = "MISSING_INTL_API";
|
|
8
|
+
return ErrorCode;
|
|
9
|
+
}({});
|
|
10
|
+
var FormatError = class extends Error {
|
|
11
|
+
constructor(msg, code, originalMessage) {
|
|
12
|
+
super(msg);
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.originalMessage = originalMessage;
|
|
15
|
+
}
|
|
16
|
+
toString() {
|
|
17
|
+
return `[formatjs Error: ${this.code}] ${this.message}`;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var InvalidValueError = class extends FormatError {
|
|
21
|
+
constructor(variableId, value, options, originalMessage) {
|
|
22
|
+
super(`Invalid values for "${variableId}": "${value}". Options are "${Object.keys(options).join("\", \"")}"`, "INVALID_VALUE", originalMessage);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
var InvalidValueTypeError = class extends FormatError {
|
|
26
|
+
constructor(value, type, originalMessage) {
|
|
27
|
+
super(`Value for "${value}" must be of type ${type}`, "INVALID_VALUE", originalMessage);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var MissingValueError = class extends FormatError {
|
|
31
|
+
constructor(variableId, originalMessage) {
|
|
32
|
+
super(`The intl string context variable "${variableId}" was not provided to the string "${originalMessage}"`, "MISSING_VALUE", originalMessage);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region packages/intl-messageformat/formatters.ts
|
|
37
|
+
let PART_TYPE = /* @__PURE__ */ function(PART_TYPE) {
|
|
38
|
+
PART_TYPE[PART_TYPE["literal"] = 0] = "literal";
|
|
39
|
+
PART_TYPE[PART_TYPE["object"] = 1] = "object";
|
|
40
|
+
return PART_TYPE;
|
|
41
|
+
}({});
|
|
42
|
+
function mergeLiteral(parts) {
|
|
43
|
+
if (parts.length < 2) return parts;
|
|
44
|
+
return parts.reduce((all, part) => {
|
|
45
|
+
const lastPart = all[all.length - 1];
|
|
46
|
+
if (!lastPart || lastPart.type !== 0 || part.type !== 0) all.push(part);
|
|
47
|
+
else lastPart.value += part.value;
|
|
48
|
+
return all;
|
|
49
|
+
}, []);
|
|
50
|
+
}
|
|
51
|
+
function isFormatXMLElementFn(el) {
|
|
52
|
+
return typeof el === "function";
|
|
53
|
+
}
|
|
54
|
+
function formatToParts(els, locales, formatters, formats, values, currentPluralValue, originalMessage) {
|
|
55
|
+
if (els.length === 1 && isLiteralElement(els[0])) return [{
|
|
56
|
+
type: 0,
|
|
57
|
+
value: els[0].value
|
|
58
|
+
}];
|
|
59
|
+
const result = [];
|
|
60
|
+
for (const el of els) {
|
|
61
|
+
if (isLiteralElement(el)) {
|
|
62
|
+
result.push({
|
|
63
|
+
type: 0,
|
|
64
|
+
value: el.value
|
|
65
|
+
});
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (isPoundElement(el)) {
|
|
69
|
+
if (typeof currentPluralValue === "number") result.push({
|
|
70
|
+
type: 0,
|
|
71
|
+
value: formatters.getNumberFormat(locales).format(currentPluralValue)
|
|
72
|
+
});
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
const { value: varName } = el;
|
|
76
|
+
if (!(values && varName in values)) throw new MissingValueError(varName, originalMessage);
|
|
77
|
+
let value = values[varName];
|
|
78
|
+
if (isArgumentElement(el)) {
|
|
79
|
+
if (!value || typeof value === "string" || typeof value === "number" || typeof value === "bigint") value = typeof value === "string" || typeof value === "number" || typeof value === "bigint" ? String(value) : "";
|
|
80
|
+
result.push({
|
|
81
|
+
type: typeof value === "string" ? 0 : 1,
|
|
82
|
+
value
|
|
83
|
+
});
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (isDateElement(el)) {
|
|
87
|
+
const style = typeof el.style === "string" ? formats.date[el.style] : isDateTimeSkeleton(el.style) ? el.style.parsedOptions : void 0;
|
|
88
|
+
result.push({
|
|
89
|
+
type: 0,
|
|
90
|
+
value: formatters.getDateTimeFormat(locales, style).format(value)
|
|
91
|
+
});
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (isTimeElement(el)) {
|
|
95
|
+
const style = typeof el.style === "string" ? formats.time[el.style] : isDateTimeSkeleton(el.style) ? el.style.parsedOptions : formats.time.medium;
|
|
96
|
+
result.push({
|
|
97
|
+
type: 0,
|
|
98
|
+
value: formatters.getDateTimeFormat(locales, style).format(value)
|
|
99
|
+
});
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (isNumberElement(el)) {
|
|
103
|
+
const style = typeof el.style === "string" ? formats.number[el.style] : isNumberSkeleton(el.style) ? el.style.parsedOptions : void 0;
|
|
104
|
+
if (style && style.scale) {
|
|
105
|
+
const scale = style.scale || 1;
|
|
106
|
+
if (typeof value === "bigint") {
|
|
107
|
+
if (!Number.isInteger(scale)) throw new TypeError(`Cannot apply fractional scale ${scale} to bigint value. Scale must be an integer when formatting bigint.`);
|
|
108
|
+
value = value * BigInt(scale);
|
|
109
|
+
} else value = value * scale;
|
|
110
|
+
}
|
|
111
|
+
result.push({
|
|
112
|
+
type: 0,
|
|
113
|
+
value: formatters.getNumberFormat(locales, style).format(value)
|
|
114
|
+
});
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (isTagElement(el)) {
|
|
118
|
+
const { children, value } = el;
|
|
119
|
+
const formatFn = values[value];
|
|
120
|
+
if (!isFormatXMLElementFn(formatFn)) throw new InvalidValueTypeError(value, "function", originalMessage);
|
|
121
|
+
let chunks = formatFn(formatToParts(children, locales, formatters, formats, values, currentPluralValue).map((p) => p.value));
|
|
122
|
+
if (!Array.isArray(chunks)) chunks = [chunks];
|
|
123
|
+
result.push(...chunks.map((c) => {
|
|
124
|
+
return {
|
|
125
|
+
type: typeof c === "string" ? 0 : 1,
|
|
126
|
+
value: c
|
|
127
|
+
};
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
if (isSelectElement(el)) {
|
|
131
|
+
const key = value;
|
|
132
|
+
const opt = (Object.prototype.hasOwnProperty.call(el.options, key) ? el.options[key] : void 0) || el.options.other;
|
|
133
|
+
if (!opt) throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);
|
|
134
|
+
result.push(...formatToParts(opt.value, locales, formatters, formats, values));
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (isPluralElement(el)) {
|
|
138
|
+
const exactKey = `=${value}`;
|
|
139
|
+
let opt = Object.prototype.hasOwnProperty.call(el.options, exactKey) ? el.options[exactKey] : void 0;
|
|
140
|
+
if (!opt) {
|
|
141
|
+
if (!Intl.PluralRules) throw new FormatError(`Intl.PluralRules is not available in this environment.
|
|
142
|
+
Try polyfilling it using "@formatjs/intl-pluralrules"
|
|
143
|
+
`, "MISSING_INTL_API", originalMessage);
|
|
144
|
+
const numericValue = typeof value === "bigint" ? Number(value) : value;
|
|
145
|
+
const rule = formatters.getPluralRules(locales, { type: el.pluralType }).select(numericValue - (el.offset || 0));
|
|
146
|
+
opt = (Object.prototype.hasOwnProperty.call(el.options, rule) ? el.options[rule] : void 0) || el.options.other;
|
|
147
|
+
}
|
|
148
|
+
if (!opt) throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);
|
|
149
|
+
const numericValue = typeof value === "bigint" ? Number(value) : value;
|
|
150
|
+
result.push(...formatToParts(opt.value, locales, formatters, formats, values, numericValue - (el.offset || 0)));
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return mergeLiteral(result);
|
|
155
|
+
}
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region packages/intl-messageformat/core.ts
|
|
158
|
+
function mergeConfig(c1, c2) {
|
|
159
|
+
if (!c2) return c1;
|
|
160
|
+
return {
|
|
161
|
+
...c1,
|
|
162
|
+
...c2,
|
|
163
|
+
...Object.keys(c1).reduce((all, k) => {
|
|
164
|
+
all[k] = {
|
|
165
|
+
...c1[k],
|
|
166
|
+
...c2[k]
|
|
167
|
+
};
|
|
168
|
+
return all;
|
|
169
|
+
}, {})
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function mergeConfigs(defaultConfig, configs) {
|
|
173
|
+
if (!configs) return defaultConfig;
|
|
174
|
+
return Object.keys(defaultConfig).reduce((all, k) => {
|
|
175
|
+
all[k] = mergeConfig(defaultConfig[k], configs[k]);
|
|
176
|
+
return all;
|
|
177
|
+
}, { ...defaultConfig });
|
|
178
|
+
}
|
|
179
|
+
function createFastMemoizeCache(store) {
|
|
180
|
+
return { create() {
|
|
181
|
+
return {
|
|
182
|
+
get(key) {
|
|
183
|
+
return store[key];
|
|
184
|
+
},
|
|
185
|
+
set(key, value) {
|
|
186
|
+
store[key] = value;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
} };
|
|
190
|
+
}
|
|
191
|
+
function createDefaultFormatters(cache = {
|
|
192
|
+
number: {},
|
|
193
|
+
dateTime: {},
|
|
194
|
+
pluralRules: {}
|
|
195
|
+
}) {
|
|
196
|
+
return {
|
|
197
|
+
getNumberFormat: memoize((...args) => new Intl.NumberFormat(...args), {
|
|
198
|
+
cache: createFastMemoizeCache(cache.number),
|
|
199
|
+
strategy: strategies.variadic
|
|
200
|
+
}),
|
|
201
|
+
getDateTimeFormat: memoize((...args) => new Intl.DateTimeFormat(...args), {
|
|
202
|
+
cache: createFastMemoizeCache(cache.dateTime),
|
|
203
|
+
strategy: strategies.variadic
|
|
204
|
+
}),
|
|
205
|
+
getPluralRules: memoize((...args) => new Intl.PluralRules(...args), {
|
|
206
|
+
cache: createFastMemoizeCache(cache.pluralRules),
|
|
207
|
+
strategy: strategies.variadic
|
|
208
|
+
})
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
var IntlMessageFormat = class IntlMessageFormat {
|
|
212
|
+
constructor(message, locales = IntlMessageFormat.defaultLocale, overrideFormats, opts) {
|
|
213
|
+
this.formatterCache = {
|
|
214
|
+
number: {},
|
|
215
|
+
dateTime: {},
|
|
216
|
+
pluralRules: {}
|
|
217
|
+
};
|
|
218
|
+
this.format = ((values) => {
|
|
219
|
+
const parts = this.formatToParts(values);
|
|
220
|
+
if (parts.length === 1) return parts[0].value;
|
|
221
|
+
const result = parts.reduce((all, part) => {
|
|
222
|
+
if (!all.length || part.type !== 0 || typeof all[all.length - 1] !== "string") all.push(part.value);
|
|
223
|
+
else all[all.length - 1] += part.value;
|
|
224
|
+
return all;
|
|
225
|
+
}, []);
|
|
226
|
+
if (result.length <= 1) return result[0] || "";
|
|
227
|
+
return result;
|
|
228
|
+
});
|
|
229
|
+
this.formatToParts = ((values) => formatToParts(this.ast, this.locales, this.formatters, this.formats, values, void 0, this.message));
|
|
230
|
+
this.resolvedOptions = () => ({ locale: this.resolvedLocale?.toString() || Intl.NumberFormat.supportedLocalesOf(this.locales)[0] });
|
|
231
|
+
this.getAst = () => this.ast;
|
|
232
|
+
this.locales = locales;
|
|
233
|
+
this.resolvedLocale = IntlMessageFormat.resolveLocale(locales);
|
|
234
|
+
if (typeof message === "string") {
|
|
235
|
+
this.message = message;
|
|
236
|
+
if (!IntlMessageFormat.__parse) throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");
|
|
237
|
+
const { ...parseOpts } = opts || {};
|
|
238
|
+
this.ast = IntlMessageFormat.__parse(message, {
|
|
239
|
+
...parseOpts,
|
|
240
|
+
locale: this.resolvedLocale
|
|
241
|
+
});
|
|
242
|
+
} else this.ast = message;
|
|
243
|
+
if (!Array.isArray(this.ast)) throw new TypeError("A message must be provided as a String or AST.");
|
|
244
|
+
this.formats = mergeConfigs(IntlMessageFormat.formats, overrideFormats);
|
|
245
|
+
this.formatters = opts && opts.formatters || createDefaultFormatters(this.formatterCache);
|
|
246
|
+
}
|
|
247
|
+
static {
|
|
248
|
+
this.memoizedDefaultLocale = null;
|
|
249
|
+
}
|
|
250
|
+
static get defaultLocale() {
|
|
251
|
+
if (!IntlMessageFormat.memoizedDefaultLocale) IntlMessageFormat.memoizedDefaultLocale = new Intl.NumberFormat().resolvedOptions().locale;
|
|
252
|
+
return IntlMessageFormat.memoizedDefaultLocale;
|
|
253
|
+
}
|
|
254
|
+
static {
|
|
255
|
+
this.resolveLocale = (locales) => {
|
|
256
|
+
if (typeof Intl.Locale === "undefined") return;
|
|
257
|
+
const supportedLocales = Intl.NumberFormat.supportedLocalesOf(locales);
|
|
258
|
+
if (supportedLocales.length > 0) return new Intl.Locale(supportedLocales[0]);
|
|
259
|
+
return new Intl.Locale(typeof locales === "string" ? locales : locales[0]);
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
static {
|
|
263
|
+
this.__parse = parse;
|
|
264
|
+
}
|
|
265
|
+
static {
|
|
266
|
+
this.formats = {
|
|
267
|
+
number: {
|
|
268
|
+
integer: { maximumFractionDigits: 0 },
|
|
269
|
+
currency: { style: "currency" },
|
|
270
|
+
percent: { style: "percent" }
|
|
271
|
+
},
|
|
272
|
+
date: {
|
|
273
|
+
short: {
|
|
274
|
+
month: "numeric",
|
|
275
|
+
day: "numeric",
|
|
276
|
+
year: "2-digit"
|
|
277
|
+
},
|
|
278
|
+
medium: {
|
|
279
|
+
month: "short",
|
|
280
|
+
day: "numeric",
|
|
281
|
+
year: "numeric"
|
|
282
|
+
},
|
|
283
|
+
long: {
|
|
284
|
+
month: "long",
|
|
285
|
+
day: "numeric",
|
|
286
|
+
year: "numeric"
|
|
287
|
+
},
|
|
288
|
+
full: {
|
|
289
|
+
weekday: "long",
|
|
290
|
+
month: "long",
|
|
291
|
+
day: "numeric",
|
|
292
|
+
year: "numeric"
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
time: {
|
|
296
|
+
short: {
|
|
297
|
+
hour: "numeric",
|
|
298
|
+
minute: "numeric"
|
|
299
|
+
},
|
|
300
|
+
medium: {
|
|
301
|
+
hour: "numeric",
|
|
302
|
+
minute: "numeric",
|
|
303
|
+
second: "numeric"
|
|
304
|
+
},
|
|
305
|
+
long: {
|
|
306
|
+
hour: "numeric",
|
|
307
|
+
minute: "numeric",
|
|
308
|
+
second: "numeric",
|
|
309
|
+
timeZoneName: "short"
|
|
310
|
+
},
|
|
311
|
+
full: {
|
|
312
|
+
hour: "numeric",
|
|
313
|
+
minute: "numeric",
|
|
314
|
+
second: "numeric",
|
|
315
|
+
timeZoneName: "short"
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
//#endregion
|
|
322
|
+
//#region packages/intl-messageformat/index.ts
|
|
323
|
+
var intl_messageformat_default = IntlMessageFormat;
|
|
324
|
+
//#endregion
|
|
325
|
+
export { ErrorCode, FormatError, IntlMessageFormat, InvalidValueError, InvalidValueTypeError, MissingValueError, PART_TYPE, intl_messageformat_default as default, formatToParts, isFormatXMLElementFn };
|
|
326
|
+
|
|
327
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../error.ts","../formatters.ts","../core.ts","../index.ts"],"sourcesContent":["export enum ErrorCode {\n // When we have a placeholder but no value to format\n MISSING_VALUE = 'MISSING_VALUE',\n // When value supplied is invalid\n INVALID_VALUE = 'INVALID_VALUE',\n // When we need specific Intl API but it's not available\n MISSING_INTL_API = 'MISSING_INTL_API',\n}\n\nexport class FormatError extends Error {\n public readonly code: ErrorCode\n /**\n * Original message we're trying to format\n * `undefined` if we're only dealing w/ AST\n *\n * @type {(string | undefined)}\n * @memberof FormatError\n */\n public readonly originalMessage: string | undefined\n constructor(msg: string, code: ErrorCode, originalMessage?: string) {\n super(msg)\n this.code = code\n this.originalMessage = originalMessage\n }\n public toString() {\n return `[formatjs Error: ${this.code}] ${this.message}`\n }\n}\n\nexport class InvalidValueError extends FormatError {\n constructor(\n variableId: string,\n value: any,\n options: string[],\n originalMessage?: string\n ) {\n super(\n `Invalid values for \"${variableId}\": \"${value}\". Options are \"${Object.keys(\n options\n ).join('\", \"')}\"`,\n ErrorCode.INVALID_VALUE,\n originalMessage\n )\n }\n}\n\nexport class InvalidValueTypeError extends FormatError {\n constructor(value: any, type: string, originalMessage?: string) {\n super(\n `Value for \"${value}\" must be of type ${type}`,\n ErrorCode.INVALID_VALUE,\n originalMessage\n )\n }\n}\n\nexport class MissingValueError extends FormatError {\n constructor(variableId: string, originalMessage?: string) {\n super(\n `The intl string context variable \"${variableId}\" was not provided to the string \"${originalMessage}\"`,\n ErrorCode.MISSING_VALUE,\n originalMessage\n )\n }\n}\n","import {type NumberFormatOptions} from '#packages/ecma402-abstract/types/number.js'\nimport {\n type ExtendedNumberFormatOptions,\n isArgumentElement,\n isDateElement,\n isDateTimeSkeleton,\n isLiteralElement,\n isNumberElement,\n isNumberSkeleton,\n isPluralElement,\n isPoundElement,\n isSelectElement,\n isTagElement,\n isTimeElement,\n type MessageFormatElement,\n} from '@formatjs/icu-messageformat-parser'\nimport {\n ErrorCode,\n FormatError,\n InvalidValueError,\n InvalidValueTypeError,\n MissingValueError,\n} from '#packages/intl-messageformat/error.js'\n\ndeclare global {\n namespace FormatjsIntl {\n interface Message {}\n interface IntlConfig {}\n interface Formats {}\n }\n}\n\ntype Format<Source = string> = Source extends keyof FormatjsIntl.Formats\n ? FormatjsIntl.Formats[Source]\n : string\n\nexport interface Formats {\n number: Record<Format<'number'>, NumberFormatOptions>\n date: Record<Format<'date'>, Intl.DateTimeFormatOptions>\n time: Record<Format<'time'>, Intl.DateTimeFormatOptions>\n}\n\nexport interface FormatterCache {\n number: Record<string, NumberFormatOptions>\n dateTime: Record<string, Intl.DateTimeFormat>\n pluralRules: Record<string, Intl.PluralRules>\n}\n\nexport interface Formatters {\n getNumberFormat(\n locals?: string | string[],\n opts?: NumberFormatOptions\n ): Intl.NumberFormat\n getDateTimeFormat(\n ...args: ConstructorParameters<typeof Intl.DateTimeFormat>\n ): Intl.DateTimeFormat\n getPluralRules(\n ...args: ConstructorParameters<typeof Intl.PluralRules>\n ): Intl.PluralRules\n}\n\nexport enum PART_TYPE {\n literal,\n object,\n}\n\nexport interface LiteralPart {\n type: PART_TYPE.literal\n value: string\n}\n\nexport interface ObjectPart<T = any> {\n type: PART_TYPE.object\n value: T\n}\n\nexport type MessageFormatPart<T> = LiteralPart | ObjectPart<T>\n\nexport type PrimitiveType =\n | string\n | number\n | bigint\n | boolean\n | null\n | undefined\n | Date\n\nfunction mergeLiteral<T>(\n parts: MessageFormatPart<T>[]\n): MessageFormatPart<T>[] {\n if (parts.length < 2) {\n return parts\n }\n return parts.reduce((all, part) => {\n const lastPart = all[all.length - 1]\n if (\n !lastPart ||\n lastPart.type !== PART_TYPE.literal ||\n part.type !== PART_TYPE.literal\n ) {\n all.push(part)\n } else {\n lastPart.value += part.value\n }\n return all\n }, [] as MessageFormatPart<T>[])\n}\n\nexport function isFormatXMLElementFn<T>(\n el: PrimitiveType | T | FormatXMLElementFn<T>\n): el is FormatXMLElementFn<T> {\n return typeof el === 'function'\n}\n\n// TODO(skeleton): add skeleton support\nexport function formatToParts<T>(\n els: MessageFormatElement[],\n locales: string | string[],\n formatters: Formatters,\n formats: Formats,\n values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>>,\n currentPluralValue?: number,\n // For debugging\n originalMessage?: string\n): MessageFormatPart<T>[] {\n // Hot path for straight simple msg translations\n if (els.length === 1 && isLiteralElement(els[0])) {\n return [\n {\n type: PART_TYPE.literal,\n value: els[0].value,\n },\n ]\n }\n const result: MessageFormatPart<T>[] = []\n for (const el of els) {\n // Exit early for string parts.\n if (isLiteralElement(el)) {\n result.push({\n type: PART_TYPE.literal,\n value: el.value,\n })\n continue\n }\n // TODO: should this part be literal type?\n // Replace `#` in plural rules with the actual numeric value.\n if (isPoundElement(el)) {\n if (typeof currentPluralValue === 'number') {\n result.push({\n type: PART_TYPE.literal,\n value: formatters.getNumberFormat(locales).format(currentPluralValue),\n })\n }\n continue\n }\n\n const {value: varName} = el\n\n // Enforce that all required values are provided by the caller.\n if (!(values && varName in values)) {\n throw new MissingValueError(varName, originalMessage)\n }\n\n let value = values[varName]\n if (isArgumentElement(el)) {\n if (\n !value ||\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'bigint'\n ) {\n value =\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'bigint'\n ? String(value)\n : ''\n }\n result.push({\n type: typeof value === 'string' ? PART_TYPE.literal : PART_TYPE.object,\n value,\n } as ObjectPart<T>)\n continue\n }\n\n // Recursively format plural and select parts' option — which can be a\n // nested pattern structure. The choosing of the option to use is\n // abstracted-by and delegated-to the part helper object.\n if (isDateElement(el)) {\n const style =\n typeof el.style === 'string'\n ? formats.date[el.style]\n : isDateTimeSkeleton(el.style)\n ? el.style.parsedOptions\n : undefined\n result.push({\n type: PART_TYPE.literal,\n value: formatters\n .getDateTimeFormat(locales, style)\n .format(value as number),\n })\n continue\n }\n if (isTimeElement(el)) {\n const style =\n typeof el.style === 'string'\n ? formats.time[el.style]\n : isDateTimeSkeleton(el.style)\n ? el.style.parsedOptions\n : formats.time.medium\n result.push({\n type: PART_TYPE.literal,\n value: formatters\n .getDateTimeFormat(locales, style)\n .format(value as number),\n })\n continue\n }\n if (isNumberElement(el)) {\n const style =\n typeof el.style === 'string'\n ? formats.number[el.style]\n : isNumberSkeleton(el.style)\n ? el.style.parsedOptions\n : undefined\n\n if (style && (style as ExtendedNumberFormatOptions).scale) {\n const scale = (style as ExtendedNumberFormatOptions).scale || 1\n // Handle bigint scale multiplication\n // BigInt can only be multiplied by BigInt\n if (typeof value === 'bigint') {\n // Check if scale is a safe integer that can be converted to BigInt\n if (!Number.isInteger(scale)) {\n throw new TypeError(\n `Cannot apply fractional scale ${scale} to bigint value. Scale must be an integer when formatting bigint.`\n )\n }\n value = value * BigInt(scale)\n } else {\n value = (value as number) * scale\n }\n }\n result.push({\n type: PART_TYPE.literal,\n value: formatters\n .getNumberFormat(locales, style)\n .format(value as number | bigint),\n })\n continue\n }\n if (isTagElement(el)) {\n const {children, value} = el\n const formatFn = values[value]\n if (!isFormatXMLElementFn<T>(formatFn)) {\n throw new InvalidValueTypeError(value, 'function', originalMessage)\n }\n const parts = formatToParts<T>(\n children,\n locales,\n formatters,\n formats,\n values,\n currentPluralValue\n )\n let chunks = formatFn(parts.map(p => p.value))\n if (!Array.isArray(chunks)) {\n chunks = [chunks]\n }\n result.push(\n ...chunks.map((c): MessageFormatPart<T> => {\n return {\n type: typeof c === 'string' ? PART_TYPE.literal : PART_TYPE.object,\n value: c,\n } as MessageFormatPart<T>\n })\n )\n }\n if (isSelectElement(el)) {\n // GH #4490: Use hasOwnProperty to avoid prototype chain issues with keys like \"constructor\"\n const key = value as string\n const opt =\n (Object.prototype.hasOwnProperty.call(el.options, key)\n ? el.options[key]\n : undefined) || el.options.other\n if (!opt) {\n throw new InvalidValueError(\n el.value,\n value,\n Object.keys(el.options),\n originalMessage\n )\n }\n result.push(\n ...formatToParts(opt.value, locales, formatters, formats, values)\n )\n continue\n }\n if (isPluralElement(el)) {\n // GH #4490: Use hasOwnProperty to avoid prototype chain issues\n const exactKey = `=${value}`\n let opt = Object.prototype.hasOwnProperty.call(el.options, exactKey)\n ? el.options[exactKey]\n : undefined\n if (!opt) {\n if (!Intl.PluralRules) {\n throw new FormatError(\n `Intl.PluralRules is not available in this environment.\nTry polyfilling it using \"@formatjs/intl-pluralrules\"\n`,\n ErrorCode.MISSING_INTL_API,\n originalMessage\n )\n }\n // Convert bigint to number for PluralRules (which only accepts number)\n const numericValue =\n typeof value === 'bigint' ? Number(value) : (value as number)\n const rule = formatters\n .getPluralRules(locales, {type: el.pluralType})\n .select(numericValue - (el.offset || 0))\n opt =\n (Object.prototype.hasOwnProperty.call(el.options, rule)\n ? el.options[rule]\n : undefined) || el.options.other\n }\n if (!opt) {\n throw new InvalidValueError(\n el.value,\n value,\n Object.keys(el.options),\n originalMessage\n )\n }\n // Convert bigint to number for currentPluralValue\n const numericValue =\n typeof value === 'bigint' ? Number(value) : (value as number)\n result.push(\n ...formatToParts(\n opt.value,\n locales,\n formatters,\n formats,\n values,\n numericValue - (el.offset || 0)\n )\n )\n continue\n }\n }\n return mergeLiteral(result)\n}\n\nexport type FormatXMLElementFn<T, R = string | T | (string | T)[]> = (\n parts: Array<string | T>\n) => R\n","/*\nCopyright (c) 2014, Yahoo! Inc. All rights reserved.\nCopyrights licensed under the New BSD License.\nSee the accompanying LICENSE file for terms.\n*/\n\nimport {type Cache, memoize, strategies} from '@formatjs/fast-memoize'\nimport {\n type MessageFormatElement,\n parse,\n type ParserOptions,\n} from '@formatjs/icu-messageformat-parser'\nimport {\n type Formats,\n type FormatterCache,\n type Formatters,\n formatToParts,\n type FormatXMLElementFn,\n type MessageFormatPart,\n PART_TYPE,\n type PrimitiveType,\n} from '#packages/intl-messageformat/formatters.js'\n\nimport type {\n MessageValues,\n MessageFormatFunction,\n MessageFormatToPartsFunction,\n UntypedMessageFormatToParts,\n} from '#packages/intl-messageformat/message-types.js'\n\n// -- MessageFormat --------------------------------------------------------\n\nfunction mergeConfig(c1: Record<string, object>, c2?: Record<string, object>) {\n if (!c2) {\n return c1\n }\n return {\n ...c1,\n ...c2,\n ...Object.keys(c1).reduce((all: Record<string, object>, k) => {\n all[k] = {\n ...c1[k],\n ...c2[k],\n }\n return all\n }, {}),\n }\n}\n\nfunction mergeConfigs(\n defaultConfig: Formats,\n configs?: Partial<Formats>\n): Formats {\n if (!configs) {\n return defaultConfig\n }\n\n return (Object.keys(defaultConfig) as Array<keyof Formats>).reduce(\n (all: Formats, k: keyof Formats) => {\n all[k] = mergeConfig(defaultConfig[k], configs[k])\n return all\n },\n {...defaultConfig}\n )\n}\n\nexport interface Options extends Omit<ParserOptions, 'locale'> {\n formatters?: Formatters\n}\n\nfunction createFastMemoizeCache<V>(\n store: Record<string, V | undefined>\n): Cache<string, V> {\n return {\n create() {\n return {\n get(key) {\n return store[key]\n },\n set(key, value) {\n store[key] = value\n },\n }\n },\n }\n}\n\nfunction createDefaultFormatters(\n cache: FormatterCache = {\n number: {},\n dateTime: {},\n pluralRules: {},\n }\n): Formatters {\n return {\n getNumberFormat: memoize((...args) => new Intl.NumberFormat(...args), {\n cache: createFastMemoizeCache(cache.number),\n strategy: strategies.variadic,\n }),\n getDateTimeFormat: memoize((...args) => new Intl.DateTimeFormat(...args), {\n cache: createFastMemoizeCache(cache.dateTime),\n strategy: strategies.variadic,\n }),\n getPluralRules: memoize((...args) => new Intl.PluralRules(...args), {\n cache: createFastMemoizeCache(cache.pluralRules),\n strategy: strategies.variadic,\n }),\n }\n}\n\nexport class IntlMessageFormat<\n V extends MessageValues | undefined = undefined,\n> {\n private readonly ast: MessageFormatElement[]\n private readonly locales: string | string[]\n private readonly resolvedLocale?: Intl.Locale\n private readonly formatters: Formatters\n private readonly formats: Formats\n private readonly message: string | undefined\n private readonly formatterCache: FormatterCache = {\n number: {},\n dateTime: {},\n pluralRules: {},\n }\n constructor(\n message: string | MessageFormatElement[],\n locales: string | string[] = IntlMessageFormat.defaultLocale,\n overrideFormats?: Partial<Formats>,\n opts?: Options\n ) {\n // Defined first because it's used to build the format pattern.\n this.locales = locales\n this.resolvedLocale = IntlMessageFormat.resolveLocale(locales)\n\n if (typeof message === 'string') {\n this.message = message\n if (!IntlMessageFormat.__parse) {\n throw new TypeError(\n 'IntlMessageFormat.__parse must be set to process `message` of type `string`'\n )\n }\n const {...parseOpts} = opts || {}\n // Parse string messages into an AST.\n this.ast = IntlMessageFormat.__parse(message, {\n ...parseOpts,\n locale: this.resolvedLocale,\n })\n } else {\n this.ast = message\n }\n\n if (!Array.isArray(this.ast)) {\n throw new TypeError('A message must be provided as a String or AST.')\n }\n\n // Creates a new object with the specified `formats` merged with the default\n // formats.\n this.formats = mergeConfigs(IntlMessageFormat.formats, overrideFormats)\n\n this.formatters =\n (opts && opts.formatters) || createDefaultFormatters(this.formatterCache)\n }\n\n format = (<T = void>(\n values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>>\n ): string | T | (string | T)[] => {\n const parts = (this.formatToParts as UntypedMessageFormatToParts)<T>(values)\n // Hot path for straight simple msg translations\n if (parts.length === 1) {\n return parts[0].value\n }\n const result = parts.reduce(\n (all, part) => {\n if (\n !all.length ||\n part.type !== PART_TYPE.literal ||\n typeof all[all.length - 1] !== 'string'\n ) {\n all.push(part.value)\n } else {\n all[all.length - 1] += part.value\n }\n return all\n },\n [] as Array<string | T>\n )\n\n if (result.length <= 1) {\n return result[0] || ''\n }\n return result\n }) as MessageFormatFunction<V>\n formatToParts = (<T>(\n values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>>\n ): MessageFormatPart<T>[] =>\n formatToParts(\n this.ast,\n this.locales,\n this.formatters,\n this.formats,\n values,\n undefined,\n this.message\n )) as MessageFormatToPartsFunction<V>\n resolvedOptions = (): {\n locale: string\n } => ({\n locale:\n this.resolvedLocale?.toString() ||\n Intl.NumberFormat.supportedLocalesOf(this.locales)[0],\n })\n getAst = (): MessageFormatElement[] => this.ast\n private static memoizedDefaultLocale: string | null = null\n\n static get defaultLocale(): string {\n if (!IntlMessageFormat.memoizedDefaultLocale) {\n IntlMessageFormat.memoizedDefaultLocale =\n new Intl.NumberFormat().resolvedOptions().locale\n }\n\n return IntlMessageFormat.memoizedDefaultLocale\n }\n static resolveLocale = (\n locales: string | string[]\n ): Intl.Locale | undefined => {\n if (typeof Intl.Locale === 'undefined') {\n return\n }\n const supportedLocales = Intl.NumberFormat.supportedLocalesOf(locales)\n if (supportedLocales.length > 0) {\n return new Intl.Locale(supportedLocales[0])\n }\n\n return new Intl.Locale(typeof locales === 'string' ? locales : locales[0])\n }\n static __parse: typeof parse | undefined = parse\n // Default format options used as the prototype of the `formats` provided to the\n // constructor. These are used when constructing the internal Intl.NumberFormat\n // and Intl.DateTimeFormat instances.\n static formats: Formats = {\n number: {\n integer: {\n maximumFractionDigits: 0,\n },\n currency: {\n style: 'currency',\n },\n\n percent: {\n style: 'percent',\n },\n },\n\n date: {\n short: {\n month: 'numeric',\n day: 'numeric',\n year: '2-digit',\n },\n\n medium: {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n },\n\n long: {\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n },\n\n full: {\n weekday: 'long',\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n },\n },\n\n time: {\n short: {\n hour: 'numeric',\n minute: 'numeric',\n },\n\n medium: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n },\n\n long: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'short',\n },\n\n full: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'short',\n },\n },\n }\n}\n","/*\nCopyright (c) 2014, Yahoo! Inc. All rights reserved.\nCopyrights licensed under the New BSD License.\nSee the accompanying LICENSE file for terms.\n*/\n\nimport {IntlMessageFormat} from '#packages/intl-messageformat/core.js'\nexport * from '#packages/intl-messageformat/core.js'\nexport * from '#packages/intl-messageformat/error.js'\nexport * from '#packages/intl-messageformat/formatters.js'\nexport {IntlMessageFormat}\nexport default IntlMessageFormat\n\nexport type {\n FormattedText,\n MessageValue,\n MessageTag,\n NoMessageValues,\n MessageValues,\n MessageContract,\n MessageValuesOf,\n UntypedMessageContract,\n TypedMessageValues,\n MessageFormatArguments,\n MessageFormatFunction,\n MessageFormatToPartsFunction,\n} from '#pack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