genesys-spark-components 4.202.0 → 4.204.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{get-valid-timezone-B5cZ0d-f.js → get-valid-timezone-Dr_-VXi7.js} +1 -1
- package/dist/cjs/gux-accordion.cjs.entry.js +1 -1
- package/dist/cjs/gux-action-button.cjs.entry.js +2 -2
- package/dist/cjs/gux-action-toast-legacy.cjs.entry.js +1 -1
- package/dist/cjs/gux-actionable-inline-alert-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-advanced-dropdown-legacy.cjs.entry.js +2 -2
- package/dist/cjs/gux-ai-powered-badge-beta.cjs.entry.js +2 -2
- package/dist/cjs/gux-all-row-select.cjs.entry.js +1 -1
- package/dist/cjs/gux-announce-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-avatar-beta.cjs.entry.js +2 -2
- package/dist/cjs/gux-avatar-change-photo-beta.cjs.entry.js +2 -2
- package/dist/cjs/gux-avatar-group-add-item-beta_3.cjs.entry.js +2 -2
- package/dist/cjs/gux-avatar-group-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-avatar-group-item-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-badge.cjs.entry.js +2 -2
- package/dist/cjs/gux-blank-state-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-blank-state.cjs.entry.js +1 -1
- package/dist/cjs/gux-breadcrumbs.cjs.entry.js +2 -2
- package/dist/cjs/gux-button-multi.cjs.entry.js +1 -1
- package/dist/cjs/gux-button-slot.cjs.entry.js +1 -1
- package/dist/cjs/gux-button_2.cjs.entry.js +1 -1
- package/dist/cjs/gux-calendar-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-calendar.cjs.entry.js +3 -3
- package/dist/cjs/gux-card.cjs.entry.js +1 -1
- package/dist/cjs/gux-cloud-logo-beta.cjs.entry.js +2 -2
- package/dist/cjs/gux-cloud-logomark-beta.cjs.entry.js +2 -2
- package/dist/cjs/gux-column-manager-item.cjs.entry.js +1 -1
- package/dist/cjs/gux-column-manager.cjs.entry.js +2 -2
- package/dist/cjs/gux-content-search.cjs.entry.js +2 -2
- package/dist/cjs/gux-context-menu.cjs.entry.js +2 -2
- package/dist/cjs/gux-copy-to-clipboard.cjs.entry.js +2 -2
- package/dist/cjs/gux-create-option.cjs.entry.js +1 -1
- package/dist/cjs/gux-date-beta.cjs.entry.js +3 -3
- package/dist/cjs/gux-date-time-beta.cjs.entry.js +3 -3
- package/dist/cjs/gux-datepicker.cjs.entry.js +15 -12
- package/dist/cjs/gux-day-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-disclosure-button-legacy.cjs.entry.js +2 -2
- package/dist/cjs/gux-dismiss-button.cjs.entry.js +2 -2
- package/dist/cjs/gux-dropdown-multi-tag.cjs.entry.js +1 -1
- package/dist/cjs/gux-dropdown-multi.cjs.entry.js +2 -2
- package/dist/cjs/gux-dropdown_3.cjs.entry.js +2 -2
- package/dist/cjs/gux-file-list-item.cjs.entry.js +2 -2
- package/dist/cjs/gux-flag-icon-beta.cjs.entry.js +2 -2
- package/dist/cjs/gux-flyout-menu.cjs.entry.js +2 -2
- package/dist/cjs/gux-form-field-checkbox-group-beta.cjs.entry.js +2 -2
- package/dist/cjs/gux-form-field-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-color.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-dropdown.cjs.entry.js +2 -2
- package/dist/cjs/gux-form-field-file-beta.cjs.entry.js +2 -2
- package/dist/cjs/gux-form-field-file.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-input-clear-button.cjs.entry.js +2 -2
- package/dist/cjs/gux-form-field-label-indicator.cjs.entry.js +2 -2
- package/dist/cjs/gux-form-field-number_2.cjs.entry.js +2 -2
- package/dist/cjs/gux-form-field-phone.cjs.entry.js +2 -2
- package/dist/cjs/gux-form-field-radio-group-beta.cjs.entry.js +2 -2
- package/dist/cjs/gux-form-field-radio.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-range.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-search.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-select.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-text-like.cjs.entry.js +2 -2
- package/dist/cjs/gux-form-field-textarea.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-time-picker.cjs.entry.js +2 -2
- package/dist/cjs/gux-form-field-time-zone-picker.cjs.entry.js +2 -2
- package/dist/cjs/gux-form-footer.cjs.entry.js +1 -1
- package/dist/cjs/gux-icon-tooltip-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-icon.cjs.entry.js +2 -2
- package/dist/cjs/gux-illustration-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-inline-alert.cjs.entry.js +2 -2
- package/dist/cjs/gux-inline-dropdown-beta.cjs.entry.js +2 -2
- package/dist/cjs/gux-label-info-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-link-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-list.cjs.entry.js +1 -1
- package/dist/cjs/gux-listbox-multi.cjs.entry.js +2 -2
- package/dist/cjs/gux-loading-message.cjs.entry.js +1 -1
- package/dist/cjs/gux-logo-beta.cjs.entry.js +2 -2
- package/dist/cjs/gux-logomark-beta.cjs.entry.js +2 -2
- package/dist/cjs/gux-modal-legacy.cjs.entry.js +1 -1
- package/dist/cjs/gux-modal-side-panel-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-modal.cjs.entry.js +1 -1
- package/dist/cjs/gux-month-calendar.cjs.entry.js +1 -1
- package/dist/cjs/gux-month-picker-beta.cjs.entry.js +2 -2
- package/dist/cjs/gux-notification-toast-legacy.cjs.entry.js +1 -1
- package/dist/cjs/gux-option-multi.cjs.entry.js +1 -1
- package/dist/cjs/gux-page-loading-spinner.cjs.entry.js +1 -1
- package/dist/cjs/gux-pagination-buttons-legacy_3.cjs.entry.js +1 -1
- package/dist/cjs/gux-pagination-buttons_2.cjs.entry.js +1 -1
- package/dist/cjs/gux-pagination-cursor.cjs.entry.js +2 -2
- package/dist/cjs/gux-pagination-items-per-page.cjs.entry.js +1 -1
- package/dist/cjs/gux-pagination-legacy.cjs.entry.js +1 -1
- package/dist/cjs/gux-pagination.cjs.entry.js +1 -1
- package/dist/cjs/gux-phone-input-beta.cjs.entry.js +173 -171
- package/dist/cjs/gux-popover-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-popover-list-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-popover-list.cjs.entry.js +1 -1
- package/dist/cjs/gux-prompt-input-beta.cjs.entry.js +2 -2
- package/dist/cjs/gux-radial-loading.cjs.entry.js +2 -2
- package/dist/cjs/gux-radial-progress.cjs.entry.js +1 -1
- package/dist/cjs/gux-rating.cjs.entry.js +2 -2
- package/dist/cjs/gux-rich-highlight-list-item.cjs.entry.js +2 -2
- package/dist/cjs/gux-rich-style-list-item_3.cjs.entry.js +2 -2
- package/dist/cjs/gux-rich-text-editor-action-link.cjs.entry.js +2 -2
- package/dist/cjs/gux-rich-text-editor-action-rich-style.cjs.entry.js +2 -2
- package/dist/cjs/gux-rich-text-editor-action-text-highlight.cjs.entry.js +2 -2
- package/dist/cjs/gux-rich-text-editor-action.cjs.entry.js +2 -2
- package/dist/cjs/gux-rich-text-editor-beta.cjs.entry.js +2 -2
- package/dist/cjs/gux-rich-text-editor-list.cjs.entry.js +1 -1
- package/dist/cjs/gux-row-select.cjs.entry.js +1 -1
- package/dist/cjs/gux-screen-reader-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-segmented-control-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-select-all.cjs.entry.js +1 -1
- package/dist/cjs/gux-selector-card-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-selector-cards-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-side-panel-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-side-panel-header.cjs.entry.js +1 -1
- package/dist/cjs/gux-side-panel-heading.cjs.entry.js +1 -1
- package/dist/cjs/gux-simple-toast-legacy.cjs.entry.js +1 -1
- package/dist/cjs/gux-skip-navigation-list.cjs.entry.js +2 -2
- package/dist/cjs/gux-sort-control.cjs.entry.js +2 -2
- package/dist/cjs/gux-status-indicator-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-step-title.cjs.entry.js +1 -1
- package/dist/cjs/gux-step.cjs.entry.js +1 -1
- package/dist/cjs/gux-stepper-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-switch-legacy.cjs.entry.js +1 -1
- package/dist/cjs/gux-tab-advanced-list.cjs.entry.js +1 -1
- package/dist/cjs/gux-tab-advanced.cjs.entry.js +1 -1
- package/dist/cjs/gux-tab-list.cjs.entry.js +1 -1
- package/dist/cjs/gux-table-select-menu.cjs.entry.js +1 -1
- package/dist/cjs/gux-table-toolbar-action.cjs.entry.js +2 -2
- package/dist/cjs/gux-table-toolbar-custom-action.cjs.entry.js +1 -1
- package/dist/cjs/gux-table-toolbar-menu-button.cjs.entry.js +2 -2
- package/dist/cjs/gux-table-toolbar.cjs.entry.js +1 -1
- package/dist/cjs/gux-table.cjs.entry.js +2 -2
- package/dist/cjs/gux-tabs-advanced.cjs.entry.js +1 -1
- package/dist/cjs/gux-tabs.cjs.entry.js +1 -1
- package/dist/cjs/gux-tag.cjs.entry.js +2 -2
- package/dist/cjs/gux-text-highlight.cjs.entry.js +1 -1
- package/dist/cjs/gux-time-beta.cjs.entry.js +3 -3
- package/dist/cjs/gux-time-picker.cjs.entry.js +2 -2
- package/dist/cjs/gux-time-zone-beta.cjs.entry.js +2 -2
- package/dist/cjs/gux-time-zone-picker-beta.cjs.entry.js +16 -10
- package/dist/cjs/gux-toast.cjs.entry.js +1 -1
- package/dist/cjs/gux-toggle.cjs.entry.js +2 -2
- package/dist/cjs/gux-tooltip-base-beta_2.cjs.entry.js +1 -1
- package/dist/cjs/gux-tooltip-pointer-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-tooltip_2.cjs.entry.js +1 -1
- package/dist/cjs/gux-tree-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-tree-multi-beta.cjs.entry.js +1 -1
- package/dist/cjs/index-DRg53_B7.js +3372 -0
- package/dist/cjs/{iso-dates-B-hZmvim.js → iso-dates-BOFf_iIt.js} +3 -0
- package/dist/cjs/{usage-DzqgBX-I.js → usage-D4P0WJ6v.js} +1 -1
- package/dist/collection/components/beta/gux-calendar-beta/tests/tests.service.playwright.js +1 -1
- package/dist/collection/components/beta/gux-time-zone-picker/gux-time-zone-picker.js +14 -8
- package/dist/collection/components/stable/gux-datepicker/gux-datepicker.js +12 -9
- package/dist/collection/components/stable/gux-icon/gux-icon.css +1 -2
- package/dist/collection/utils/date/iso-dates.js +3 -0
- package/dist/esm/{get-valid-timezone-rh51yAZx.js → get-valid-timezone-DIdb7fir.js} +1 -1
- package/dist/esm/gux-accordion.entry.js +1 -1
- package/dist/esm/gux-action-button.entry.js +2 -2
- package/dist/esm/gux-action-toast-legacy.entry.js +1 -1
- package/dist/esm/gux-actionable-inline-alert-beta.entry.js +1 -1
- package/dist/esm/gux-advanced-dropdown-legacy.entry.js +2 -2
- package/dist/esm/gux-ai-powered-badge-beta.entry.js +2 -2
- package/dist/esm/gux-all-row-select.entry.js +1 -1
- package/dist/esm/gux-announce-beta.entry.js +1 -1
- package/dist/esm/gux-avatar-beta.entry.js +2 -2
- package/dist/esm/gux-avatar-change-photo-beta.entry.js +2 -2
- package/dist/esm/gux-avatar-group-add-item-beta_3.entry.js +2 -2
- package/dist/esm/gux-avatar-group-beta.entry.js +1 -1
- package/dist/esm/gux-avatar-group-item-beta.entry.js +1 -1
- package/dist/esm/gux-badge.entry.js +2 -2
- package/dist/esm/gux-blank-state-beta.entry.js +1 -1
- package/dist/esm/gux-blank-state.entry.js +1 -1
- package/dist/esm/gux-breadcrumbs.entry.js +2 -2
- package/dist/esm/gux-button-multi.entry.js +1 -1
- package/dist/esm/gux-button-slot.entry.js +1 -1
- package/dist/esm/gux-button_2.entry.js +1 -1
- package/dist/esm/gux-calendar-beta.entry.js +1 -1
- package/dist/esm/gux-calendar.entry.js +3 -3
- package/dist/esm/gux-card.entry.js +1 -1
- package/dist/esm/gux-cloud-logo-beta.entry.js +2 -2
- package/dist/esm/gux-cloud-logomark-beta.entry.js +2 -2
- package/dist/esm/gux-column-manager-item.entry.js +1 -1
- package/dist/esm/gux-column-manager.entry.js +2 -2
- package/dist/esm/gux-content-search.entry.js +2 -2
- package/dist/esm/gux-context-menu.entry.js +2 -2
- package/dist/esm/gux-copy-to-clipboard.entry.js +2 -2
- package/dist/esm/gux-create-option.entry.js +1 -1
- package/dist/esm/gux-date-beta.entry.js +3 -3
- package/dist/esm/gux-date-time-beta.entry.js +3 -3
- package/dist/esm/gux-datepicker.entry.js +15 -12
- package/dist/esm/gux-day-beta.entry.js +1 -1
- package/dist/esm/gux-disclosure-button-legacy.entry.js +2 -2
- package/dist/esm/gux-dismiss-button.entry.js +2 -2
- package/dist/esm/gux-dropdown-multi-tag.entry.js +1 -1
- package/dist/esm/gux-dropdown-multi.entry.js +2 -2
- package/dist/esm/gux-dropdown_3.entry.js +2 -2
- package/dist/esm/gux-file-list-item.entry.js +2 -2
- package/dist/esm/gux-flag-icon-beta.entry.js +2 -2
- package/dist/esm/gux-flyout-menu.entry.js +2 -2
- package/dist/esm/gux-form-field-checkbox-group-beta.entry.js +2 -2
- package/dist/esm/gux-form-field-checkbox.entry.js +1 -1
- package/dist/esm/gux-form-field-color.entry.js +1 -1
- package/dist/esm/gux-form-field-dropdown.entry.js +2 -2
- package/dist/esm/gux-form-field-file-beta.entry.js +2 -2
- package/dist/esm/gux-form-field-file.entry.js +1 -1
- package/dist/esm/gux-form-field-input-clear-button.entry.js +2 -2
- package/dist/esm/gux-form-field-label-indicator.entry.js +2 -2
- package/dist/esm/gux-form-field-number_2.entry.js +2 -2
- package/dist/esm/gux-form-field-phone.entry.js +2 -2
- package/dist/esm/gux-form-field-radio-group-beta.entry.js +2 -2
- package/dist/esm/gux-form-field-radio.entry.js +1 -1
- package/dist/esm/gux-form-field-range.entry.js +1 -1
- package/dist/esm/gux-form-field-search.entry.js +1 -1
- package/dist/esm/gux-form-field-select.entry.js +1 -1
- package/dist/esm/gux-form-field-text-like.entry.js +2 -2
- package/dist/esm/gux-form-field-textarea.entry.js +1 -1
- package/dist/esm/gux-form-field-time-picker.entry.js +2 -2
- package/dist/esm/gux-form-field-time-zone-picker.entry.js +2 -2
- package/dist/esm/gux-form-footer.entry.js +1 -1
- package/dist/esm/gux-icon-tooltip-beta.entry.js +1 -1
- package/dist/esm/gux-icon.entry.js +2 -2
- package/dist/esm/gux-illustration-beta.entry.js +1 -1
- package/dist/esm/gux-inline-alert.entry.js +2 -2
- package/dist/esm/gux-inline-dropdown-beta.entry.js +2 -2
- package/dist/esm/gux-label-info-beta.entry.js +1 -1
- package/dist/esm/gux-link-beta.entry.js +1 -1
- package/dist/esm/gux-list.entry.js +1 -1
- package/dist/esm/gux-listbox-multi.entry.js +2 -2
- package/dist/esm/gux-loading-message.entry.js +1 -1
- package/dist/esm/gux-logo-beta.entry.js +2 -2
- package/dist/esm/gux-logomark-beta.entry.js +2 -2
- package/dist/esm/gux-modal-legacy.entry.js +1 -1
- package/dist/esm/gux-modal-side-panel-beta.entry.js +1 -1
- package/dist/esm/gux-modal.entry.js +1 -1
- package/dist/esm/gux-month-calendar.entry.js +1 -1
- package/dist/esm/gux-month-picker-beta.entry.js +2 -2
- package/dist/esm/gux-notification-toast-legacy.entry.js +1 -1
- package/dist/esm/gux-option-multi.entry.js +1 -1
- package/dist/esm/gux-page-loading-spinner.entry.js +1 -1
- package/dist/esm/gux-pagination-buttons-legacy_3.entry.js +1 -1
- package/dist/esm/gux-pagination-buttons_2.entry.js +1 -1
- package/dist/esm/gux-pagination-cursor.entry.js +2 -2
- package/dist/esm/gux-pagination-items-per-page.entry.js +1 -1
- package/dist/esm/gux-pagination-legacy.entry.js +1 -1
- package/dist/esm/gux-pagination.entry.js +1 -1
- package/dist/esm/gux-phone-input-beta.entry.js +173 -171
- package/dist/esm/gux-popover-beta.entry.js +1 -1
- package/dist/esm/gux-popover-list-beta.entry.js +1 -1
- package/dist/esm/gux-popover-list.entry.js +1 -1
- package/dist/esm/gux-prompt-input-beta.entry.js +2 -2
- package/dist/esm/gux-radial-loading.entry.js +2 -2
- package/dist/esm/gux-radial-progress.entry.js +1 -1
- package/dist/esm/gux-rating.entry.js +2 -2
- package/dist/esm/gux-rich-highlight-list-item.entry.js +2 -2
- package/dist/esm/gux-rich-style-list-item_3.entry.js +2 -2
- package/dist/esm/gux-rich-text-editor-action-link.entry.js +2 -2
- package/dist/esm/gux-rich-text-editor-action-rich-style.entry.js +2 -2
- package/dist/esm/gux-rich-text-editor-action-text-highlight.entry.js +2 -2
- package/dist/esm/gux-rich-text-editor-action.entry.js +2 -2
- package/dist/esm/gux-rich-text-editor-beta.entry.js +2 -2
- package/dist/esm/gux-rich-text-editor-list.entry.js +1 -1
- package/dist/esm/gux-row-select.entry.js +1 -1
- package/dist/esm/gux-screen-reader-beta.entry.js +1 -1
- package/dist/esm/gux-segmented-control-beta.entry.js +1 -1
- package/dist/esm/gux-select-all.entry.js +1 -1
- package/dist/esm/gux-selector-card-beta.entry.js +1 -1
- package/dist/esm/gux-selector-cards-beta.entry.js +1 -1
- package/dist/esm/gux-side-panel-beta.entry.js +1 -1
- package/dist/esm/gux-side-panel-header.entry.js +1 -1
- package/dist/esm/gux-side-panel-heading.entry.js +1 -1
- package/dist/esm/gux-simple-toast-legacy.entry.js +1 -1
- package/dist/esm/gux-skip-navigation-list.entry.js +2 -2
- package/dist/esm/gux-sort-control.entry.js +2 -2
- package/dist/esm/gux-status-indicator-beta.entry.js +1 -1
- package/dist/esm/gux-step-title.entry.js +1 -1
- package/dist/esm/gux-step.entry.js +1 -1
- package/dist/esm/gux-stepper-beta.entry.js +1 -1
- package/dist/esm/gux-switch-legacy.entry.js +1 -1
- package/dist/esm/gux-tab-advanced-list.entry.js +1 -1
- package/dist/esm/gux-tab-advanced.entry.js +1 -1
- package/dist/esm/gux-tab-list.entry.js +1 -1
- package/dist/esm/gux-table-select-menu.entry.js +1 -1
- package/dist/esm/gux-table-toolbar-action.entry.js +2 -2
- package/dist/esm/gux-table-toolbar-custom-action.entry.js +1 -1
- package/dist/esm/gux-table-toolbar-menu-button.entry.js +2 -2
- package/dist/esm/gux-table-toolbar.entry.js +1 -1
- package/dist/esm/gux-table.entry.js +2 -2
- package/dist/esm/gux-tabs-advanced.entry.js +1 -1
- package/dist/esm/gux-tabs.entry.js +1 -1
- package/dist/esm/gux-tag.entry.js +2 -2
- package/dist/esm/gux-text-highlight.entry.js +1 -1
- package/dist/esm/gux-time-beta.entry.js +3 -3
- package/dist/esm/gux-time-picker.entry.js +2 -2
- package/dist/esm/gux-time-zone-beta.entry.js +2 -2
- package/dist/esm/gux-time-zone-picker-beta.entry.js +16 -10
- package/dist/esm/gux-toast.entry.js +1 -1
- package/dist/esm/gux-toggle.entry.js +2 -2
- package/dist/esm/gux-tooltip-base-beta_2.entry.js +1 -1
- package/dist/esm/gux-tooltip-pointer-beta.entry.js +1 -1
- package/dist/esm/gux-tooltip_2.entry.js +1 -1
- package/dist/esm/gux-tree-beta.entry.js +1 -1
- package/dist/esm/gux-tree-multi-beta.entry.js +1 -1
- package/dist/esm/index-ChoMleW_.js +3366 -0
- package/dist/esm/{iso-dates-aKaDsw_5.js → iso-dates-BFybQmZw.js} +3 -0
- package/dist/esm/{usage-B9HnE3QT.js → usage-BJX1jP8P.js} +1 -1
- package/dist/genesys-webcomponents/genesys-webcomponents.esm.js +1 -1
- package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.ar.json +1 -1
- package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.da.json +1 -1
- package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.es-es.json +1 -1
- package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.es.json +1 -1
- package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.fi.json +1 -1
- package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.it.json +1 -1
- package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.ja.json +1 -1
- package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.ko.json +1 -1
- package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.nl.json +1 -1
- package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.pt-br.json +1 -1
- package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.ru.json +1 -1
- package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.sv.json +1 -1
- package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.th.json +1 -1
- package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.uk.json +1 -1
- package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.zh-cn.json +1 -1
- package/dist/genesys-webcomponents/{p-abe028d8.entry.js → p-00b6b549.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-f713b1d8.entry.js → p-015756d9.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-c479e193.entry.js → p-029ceda7.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-8f29fb00.entry.js → p-02cdb13e.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-bde9f6b7.entry.js → p-05157b56.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-37d259a2.entry.js → p-052c800a.entry.js} +1 -1
- package/dist/genesys-webcomponents/p-087ec88e.entry.js +1 -0
- package/dist/genesys-webcomponents/{p-d95946e3.entry.js → p-09220774.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-705967e3.entry.js → p-0a094594.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-b6de5b84.entry.js → p-0fb11edf.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-aa98b8f0.entry.js → p-13c99e2f.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-f72c9bb1.entry.js → p-15ca8693.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-aef270c5.entry.js → p-17014484.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-46318094.entry.js → p-1814ba1a.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-89932cec.entry.js → p-18e166ec.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-32991d30.entry.js → p-1bf6a162.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-83277884.entry.js → p-1c01fba6.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-5a1bd75c.entry.js → p-1faaddc6.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-0ddf0453.entry.js → p-208a7b8c.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-34a30a80.entry.js → p-24a8060c.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-207d4334.entry.js → p-24da0e5e.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-f45843c7.entry.js → p-24fec568.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-2b145df7.entry.js → p-2596e74c.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-75111ea3.entry.js → p-29801d89.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-f6ea8646.entry.js → p-2a1e81bc.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-ea4325d1.entry.js → p-2d219353.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-69615472.entry.js → p-305f1f65.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-899ad52a.entry.js → p-308b7568.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-9a0a2286.entry.js → p-3098f337.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-7010b5ae.entry.js → p-30d43160.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-98da3040.entry.js → p-3142356f.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-46112d2a.entry.js → p-323abf43.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-3a22823b.entry.js → p-33ecf7bd.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-6e5cc105.entry.js → p-35acfa86.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-0578dca5.entry.js → p-36996781.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-896b0e29.entry.js → p-38d44fd2.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-f70b6eee.entry.js → p-395329cf.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-7afdadd7.entry.js → p-3a826875.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-5ef86c70.entry.js → p-3ab52659.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-573cb83a.entry.js → p-3d638b05.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-51f941c9.entry.js → p-3e37ff1f.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-21d093dd.entry.js → p-3f6e1f1c.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-7e670911.entry.js → p-3fdf0607.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-1f05796d.entry.js → p-45656682.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-eba63cc1.entry.js → p-471bfa55.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-52229679.entry.js → p-476b2052.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-00f866fe.entry.js → p-47f84787.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-1aa5a5d1.entry.js → p-4ce8fbc8.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-86e6290e.entry.js → p-4d202156.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-96746d26.entry.js → p-52541fce.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-7c915506.entry.js → p-532f5101.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-759581f9.entry.js → p-538798e4.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-594562c5.entry.js → p-54c664c9.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-7ef51b7d.entry.js → p-5932e0c1.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-a80580d3.entry.js → p-5965a868.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-baa87b38.entry.js → p-5ac20467.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-fe98388e.entry.js → p-5f544839.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-96810b21.entry.js → p-674c7d0c.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-31a9fcc6.entry.js → p-69412348.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-6ff72393.entry.js → p-6bdceed9.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-bc7c5bd0.entry.js → p-6cca4881.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-995d27f1.entry.js → p-6fa72a72.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-844b404c.entry.js → p-6fe0db93.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-30917e88.entry.js → p-70fb9b3c.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-ada5de19.entry.js → p-71a9054c.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-e26feb8c.entry.js → p-72b6fa90.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-a68cb724.entry.js → p-74d74b0a.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-48926e3d.entry.js → p-751d9ed3.entry.js} +2 -2
- package/dist/genesys-webcomponents/{p-a7c37eab.entry.js → p-7537d923.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-532d0e72.entry.js → p-75aa126c.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-8915cd14.entry.js → p-82bd4b31.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-2ec914e1.entry.js → p-84d1c531.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-be48a871.entry.js → p-86d8a706.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-110a0926.entry.js → p-87717cac.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-5c6ddf8f.entry.js → p-879ee390.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-8f296b65.entry.js → p-87f84d44.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-bcdbe0ec.entry.js → p-89e226e8.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-e67865a1.entry.js → p-8aae6e1b.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-19ae0df0.entry.js → p-8cd048c5.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-de053990.entry.js → p-8d6fe6e1.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-cc1f66ba.entry.js → p-8edabc20.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-e511bbd1.entry.js → p-93249f0f.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-aad6c489.entry.js → p-95c9469b.entry.js} +1 -1
- package/dist/genesys-webcomponents/p-9744bbcd.entry.js +1 -0
- package/dist/genesys-webcomponents/{p-3988faaf.entry.js → p-98109a06.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-e75f235e.entry.js → p-9867f5b0.entry.js} +1 -1
- package/dist/genesys-webcomponents/p-9a8cf271.entry.js +1 -0
- package/dist/genesys-webcomponents/{p-7ecf22c2.entry.js → p-9cfa2e74.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-f9fa3200.entry.js → p-9d76b7d4.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-ea03189c.entry.js → p-9e7d3ee9.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-08308b0d.entry.js → p-9eee14c9.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-04d0b995.entry.js → p-9f43092a.entry.js} +1 -1
- package/dist/genesys-webcomponents/p-BFybQmZw.js +1 -0
- package/dist/genesys-webcomponents/{p-B9HnE3QT.js → p-BJX1jP8P.js} +1 -1
- package/dist/genesys-webcomponents/{p-BvsD2Jrx.js → p-C1OLX65e.js} +1 -1
- package/dist/genesys-webcomponents/p-DyLWs74h.js +1 -0
- package/dist/genesys-webcomponents/{p-5b00d78f.entry.js → p-a1f4ee28.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-00463972.entry.js → p-a3b6a5f4.entry.js} +1 -1
- package/dist/genesys-webcomponents/p-a3e570b0.entry.js +1 -0
- package/dist/genesys-webcomponents/{p-13481f4d.entry.js → p-a4788c1d.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-18bc0d0a.entry.js → p-a5385c5f.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-661001b0.entry.js → p-a65b14f2.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-8ac99306.entry.js → p-a9e0a048.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-9ae1e33d.entry.js → p-ab0bd3aa.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-49f8c1c6.entry.js → p-ac82162e.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-d33c8efa.entry.js → p-b20b9779.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-0946ff11.entry.js → p-b25eb49f.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-3c8a3e09.entry.js → p-b4b76262.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-84175b6c.entry.js → p-b5fb334b.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-ddf08875.entry.js → p-b749688d.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-eaecb237.entry.js → p-b77918a0.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-d1b6b001.entry.js → p-b77b650c.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-69afb0b5.entry.js → p-ba41e5d2.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-6dec6afd.entry.js → p-bd35bf72.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-1ffbdffb.entry.js → p-c07ab9eb.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-463d1421.entry.js → p-c083c960.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-4f917ec8.entry.js → p-c0a79e8d.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-1c2a277b.entry.js → p-c4896269.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-31aa6646.entry.js → p-c60a0743.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-7e943541.entry.js → p-c629b283.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-56367f4c.entry.js → p-c91c7adc.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-7ec04b55.entry.js → p-ca3bfaac.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-2b1e89e6.entry.js → p-cb31dea7.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-aa24e08e.entry.js → p-d5de16e1.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-ae8d410c.entry.js → p-d868dbb5.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-2667eeff.entry.js → p-d87799ad.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-8406ccbd.entry.js → p-d97c6402.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-0ac44e50.entry.js → p-da89d324.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-9cd2ee36.entry.js → p-db52a0eb.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-dfc79833.entry.js → p-defa1a7d.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-4565ffbc.entry.js → p-e0696252.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-1a32aad7.entry.js → p-e2c1853d.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-1aa5a639.entry.js → p-e52833b2.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-ea2e8271.entry.js → p-e6a0b0a6.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-6a7301ce.entry.js → p-e9a2985b.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-5f793021.entry.js → p-f15957e2.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-29222289.entry.js → p-f2bb6dac.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-2cbe7e24.entry.js → p-f475a40b.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-b24f1e22.entry.js → p-f4b919f5.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-bbd7f7f6.entry.js → p-f52f163b.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-89ff8f8c.entry.js → p-f7e612aa.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-5ca981cd.entry.js → p-f9d537a3.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-41a1b420.entry.js → p-fa6bd708.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-feedb61e.entry.js → p-faaf93da.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-f5a057f7.entry.js → p-fbbce3cb.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-aea8467d.entry.js → p-fbed7ee9.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-bac76e57.entry.js → p-fd44ee1b.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-893e892f.entry.js → p-fd7a9f36.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-a0b848dc.entry.js → p-fde2d393.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-dc7d60b3.entry.js → p-fe915258.entry.js} +1 -1
- package/dist/stencil-wrapper.js +1 -1
- package/dist/types/components/beta/gux-time-zone-picker/gux-time-zone-picker.d.ts +1 -0
- package/dist/types/components/stable/gux-datepicker/gux-datepicker.d.ts +1 -0
- package/dist/types/stencil-wrapper.d.ts +1 -1
- package/package.json +10 -10
- package/dist/cjs/index-D7ufkS4M.js +0 -4194
- package/dist/esm/index-HMDSHwTB.js +0 -4188
- package/dist/genesys-webcomponents/p-126149ce.entry.js +0 -1
- package/dist/genesys-webcomponents/p-28d3ce2e.entry.js +0 -1
- package/dist/genesys-webcomponents/p-71fb6228.entry.js +0 -1
- package/dist/genesys-webcomponents/p-DnzIYzsz.js +0 -1
- package/dist/genesys-webcomponents/p-aKaDsw_5.js +0 -1
- package/dist/genesys-webcomponents/p-f2bdd3e5.entry.js +0 -1
|
@@ -1,4188 +0,0 @@
|
|
|
1
|
-
import { e as getAssetPath } from './index-8p-S7f9X.js';
|
|
2
|
-
import { g as getClosestElement } from './get-closest-element-Cd4R0amv.js';
|
|
3
|
-
|
|
4
|
-
/******************************************************************************
|
|
5
|
-
Copyright (c) Microsoft Corporation.
|
|
6
|
-
|
|
7
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
8
|
-
purpose with or without fee is hereby granted.
|
|
9
|
-
|
|
10
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
11
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
12
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
13
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
14
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
15
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
16
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
17
|
-
***************************************************************************** */
|
|
18
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
19
|
-
|
|
20
|
-
var extendStatics = function(d, b) {
|
|
21
|
-
extendStatics = Object.setPrototypeOf ||
|
|
22
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
23
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
24
|
-
return extendStatics(d, b);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
function __extends(d, b) {
|
|
28
|
-
if (typeof b !== "function" && b !== null)
|
|
29
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
30
|
-
extendStatics(d, b);
|
|
31
|
-
function __() { this.constructor = d; }
|
|
32
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
var __assign = function() {
|
|
36
|
-
__assign = Object.assign || function __assign(t) {
|
|
37
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
38
|
-
s = arguments[i];
|
|
39
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
40
|
-
}
|
|
41
|
-
return t;
|
|
42
|
-
};
|
|
43
|
-
return __assign.apply(this, arguments);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
function __rest(s, e) {
|
|
47
|
-
var t = {};
|
|
48
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
49
|
-
t[p] = s[p];
|
|
50
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
51
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
52
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
53
|
-
t[p[i]] = s[p[i]];
|
|
54
|
-
}
|
|
55
|
-
return t;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function __spreadArray(to, from, pack) {
|
|
59
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
60
|
-
if (ar || !(i in from)) {
|
|
61
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
62
|
-
ar[i] = from[i];
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
69
|
-
var e = new Error(message);
|
|
70
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
//
|
|
74
|
-
// Main
|
|
75
|
-
//
|
|
76
|
-
function memoize(fn, options) {
|
|
77
|
-
var cache = options && options.cache ? options.cache : cacheDefault;
|
|
78
|
-
var serializer = options && options.serializer ? options.serializer : serializerDefault;
|
|
79
|
-
var strategy = options && options.strategy ? options.strategy : strategyDefault;
|
|
80
|
-
return strategy(fn, {
|
|
81
|
-
cache: cache,
|
|
82
|
-
serializer: serializer,
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
//
|
|
86
|
-
// Strategy
|
|
87
|
-
//
|
|
88
|
-
function isPrimitive(value) {
|
|
89
|
-
return (value == null || typeof value === 'number' || typeof value === 'boolean'); // || typeof value === "string" 'unsafe' primitive for our needs
|
|
90
|
-
}
|
|
91
|
-
function monadic(fn, cache, serializer, arg) {
|
|
92
|
-
var cacheKey = isPrimitive(arg) ? arg : serializer(arg);
|
|
93
|
-
var computedValue = cache.get(cacheKey);
|
|
94
|
-
if (typeof computedValue === 'undefined') {
|
|
95
|
-
computedValue = fn.call(this, arg);
|
|
96
|
-
cache.set(cacheKey, computedValue);
|
|
97
|
-
}
|
|
98
|
-
return computedValue;
|
|
99
|
-
}
|
|
100
|
-
function variadic(fn, cache, serializer) {
|
|
101
|
-
var args = Array.prototype.slice.call(arguments, 3);
|
|
102
|
-
var cacheKey = serializer(args);
|
|
103
|
-
var computedValue = cache.get(cacheKey);
|
|
104
|
-
if (typeof computedValue === 'undefined') {
|
|
105
|
-
computedValue = fn.apply(this, args);
|
|
106
|
-
cache.set(cacheKey, computedValue);
|
|
107
|
-
}
|
|
108
|
-
return computedValue;
|
|
109
|
-
}
|
|
110
|
-
function assemble(fn, context, strategy, cache, serialize) {
|
|
111
|
-
return strategy.bind(context, fn, cache, serialize);
|
|
112
|
-
}
|
|
113
|
-
function strategyDefault(fn, options) {
|
|
114
|
-
var strategy = fn.length === 1 ? monadic : variadic;
|
|
115
|
-
return assemble(fn, this, strategy, options.cache.create(), options.serializer);
|
|
116
|
-
}
|
|
117
|
-
function strategyVariadic(fn, options) {
|
|
118
|
-
return assemble(fn, this, variadic, options.cache.create(), options.serializer);
|
|
119
|
-
}
|
|
120
|
-
//
|
|
121
|
-
// Serializer
|
|
122
|
-
//
|
|
123
|
-
var serializerDefault = function () {
|
|
124
|
-
return JSON.stringify(arguments);
|
|
125
|
-
};
|
|
126
|
-
//
|
|
127
|
-
// Cache
|
|
128
|
-
//
|
|
129
|
-
var ObjectWithoutPrototypeCache = /** @class */ (function () {
|
|
130
|
-
function ObjectWithoutPrototypeCache() {
|
|
131
|
-
this.cache = Object.create(null);
|
|
132
|
-
}
|
|
133
|
-
ObjectWithoutPrototypeCache.prototype.get = function (key) {
|
|
134
|
-
return this.cache[key];
|
|
135
|
-
};
|
|
136
|
-
ObjectWithoutPrototypeCache.prototype.set = function (key, value) {
|
|
137
|
-
this.cache[key] = value;
|
|
138
|
-
};
|
|
139
|
-
return ObjectWithoutPrototypeCache;
|
|
140
|
-
}());
|
|
141
|
-
var cacheDefault = {
|
|
142
|
-
create: function create() {
|
|
143
|
-
return new ObjectWithoutPrototypeCache();
|
|
144
|
-
},
|
|
145
|
-
};
|
|
146
|
-
var strategies = {
|
|
147
|
-
variadic: strategyVariadic};
|
|
148
|
-
|
|
149
|
-
var ErrorKind;
|
|
150
|
-
(function (ErrorKind) {
|
|
151
|
-
/** Argument is unclosed (e.g. `{0`) */
|
|
152
|
-
ErrorKind[ErrorKind["EXPECT_ARGUMENT_CLOSING_BRACE"] = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE";
|
|
153
|
-
/** Argument is empty (e.g. `{}`). */
|
|
154
|
-
ErrorKind[ErrorKind["EMPTY_ARGUMENT"] = 2] = "EMPTY_ARGUMENT";
|
|
155
|
-
/** Argument is malformed (e.g. `{foo!}``) */
|
|
156
|
-
ErrorKind[ErrorKind["MALFORMED_ARGUMENT"] = 3] = "MALFORMED_ARGUMENT";
|
|
157
|
-
/** Expect an argument type (e.g. `{foo,}`) */
|
|
158
|
-
ErrorKind[ErrorKind["EXPECT_ARGUMENT_TYPE"] = 4] = "EXPECT_ARGUMENT_TYPE";
|
|
159
|
-
/** Unsupported argument type (e.g. `{foo,foo}`) */
|
|
160
|
-
ErrorKind[ErrorKind["INVALID_ARGUMENT_TYPE"] = 5] = "INVALID_ARGUMENT_TYPE";
|
|
161
|
-
/** Expect an argument style (e.g. `{foo, number, }`) */
|
|
162
|
-
ErrorKind[ErrorKind["EXPECT_ARGUMENT_STYLE"] = 6] = "EXPECT_ARGUMENT_STYLE";
|
|
163
|
-
/** The number skeleton is invalid. */
|
|
164
|
-
ErrorKind[ErrorKind["INVALID_NUMBER_SKELETON"] = 7] = "INVALID_NUMBER_SKELETON";
|
|
165
|
-
/** The date time skeleton is invalid. */
|
|
166
|
-
ErrorKind[ErrorKind["INVALID_DATE_TIME_SKELETON"] = 8] = "INVALID_DATE_TIME_SKELETON";
|
|
167
|
-
/** Exepct a number skeleton following the `::` (e.g. `{foo, number, ::}`) */
|
|
168
|
-
ErrorKind[ErrorKind["EXPECT_NUMBER_SKELETON"] = 9] = "EXPECT_NUMBER_SKELETON";
|
|
169
|
-
/** Exepct a date time skeleton following the `::` (e.g. `{foo, date, ::}`) */
|
|
170
|
-
ErrorKind[ErrorKind["EXPECT_DATE_TIME_SKELETON"] = 10] = "EXPECT_DATE_TIME_SKELETON";
|
|
171
|
-
/** Unmatched apostrophes in the argument style (e.g. `{foo, number, 'test`) */
|
|
172
|
-
ErrorKind[ErrorKind["UNCLOSED_QUOTE_IN_ARGUMENT_STYLE"] = 11] = "UNCLOSED_QUOTE_IN_ARGUMENT_STYLE";
|
|
173
|
-
/** Missing select argument options (e.g. `{foo, select}`) */
|
|
174
|
-
ErrorKind[ErrorKind["EXPECT_SELECT_ARGUMENT_OPTIONS"] = 12] = "EXPECT_SELECT_ARGUMENT_OPTIONS";
|
|
175
|
-
/** Expecting an offset value in `plural` or `selectordinal` argument (e.g `{foo, plural, offset}`) */
|
|
176
|
-
ErrorKind[ErrorKind["EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE"] = 13] = "EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE";
|
|
177
|
-
/** Offset value in `plural` or `selectordinal` is invalid (e.g. `{foo, plural, offset: x}`) */
|
|
178
|
-
ErrorKind[ErrorKind["INVALID_PLURAL_ARGUMENT_OFFSET_VALUE"] = 14] = "INVALID_PLURAL_ARGUMENT_OFFSET_VALUE";
|
|
179
|
-
/** Expecting a selector in `select` argument (e.g `{foo, select}`) */
|
|
180
|
-
ErrorKind[ErrorKind["EXPECT_SELECT_ARGUMENT_SELECTOR"] = 15] = "EXPECT_SELECT_ARGUMENT_SELECTOR";
|
|
181
|
-
/** Expecting a selector in `plural` or `selectordinal` argument (e.g `{foo, plural}`) */
|
|
182
|
-
ErrorKind[ErrorKind["EXPECT_PLURAL_ARGUMENT_SELECTOR"] = 16] = "EXPECT_PLURAL_ARGUMENT_SELECTOR";
|
|
183
|
-
/** Expecting a message fragment after the `select` selector (e.g. `{foo, select, apple}`) */
|
|
184
|
-
ErrorKind[ErrorKind["EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT"] = 17] = "EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT";
|
|
185
|
-
/**
|
|
186
|
-
* Expecting a message fragment after the `plural` or `selectordinal` selector
|
|
187
|
-
* (e.g. `{foo, plural, one}`)
|
|
188
|
-
*/
|
|
189
|
-
ErrorKind[ErrorKind["EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT"] = 18] = "EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT";
|
|
190
|
-
/** Selector in `plural` or `selectordinal` is malformed (e.g. `{foo, plural, =x {#}}`) */
|
|
191
|
-
ErrorKind[ErrorKind["INVALID_PLURAL_ARGUMENT_SELECTOR"] = 19] = "INVALID_PLURAL_ARGUMENT_SELECTOR";
|
|
192
|
-
/**
|
|
193
|
-
* Duplicate selectors in `plural` or `selectordinal` argument.
|
|
194
|
-
* (e.g. {foo, plural, one {#} one {#}})
|
|
195
|
-
*/
|
|
196
|
-
ErrorKind[ErrorKind["DUPLICATE_PLURAL_ARGUMENT_SELECTOR"] = 20] = "DUPLICATE_PLURAL_ARGUMENT_SELECTOR";
|
|
197
|
-
/** Duplicate selectors in `select` argument.
|
|
198
|
-
* (e.g. {foo, select, apple {apple} apple {apple}})
|
|
199
|
-
*/
|
|
200
|
-
ErrorKind[ErrorKind["DUPLICATE_SELECT_ARGUMENT_SELECTOR"] = 21] = "DUPLICATE_SELECT_ARGUMENT_SELECTOR";
|
|
201
|
-
/** Plural or select argument option must have `other` clause. */
|
|
202
|
-
ErrorKind[ErrorKind["MISSING_OTHER_CLAUSE"] = 22] = "MISSING_OTHER_CLAUSE";
|
|
203
|
-
/** The tag is malformed. (e.g. `<bold!>foo</bold!>) */
|
|
204
|
-
ErrorKind[ErrorKind["INVALID_TAG"] = 23] = "INVALID_TAG";
|
|
205
|
-
/** The tag name is invalid. (e.g. `<123>foo</123>`) */
|
|
206
|
-
ErrorKind[ErrorKind["INVALID_TAG_NAME"] = 25] = "INVALID_TAG_NAME";
|
|
207
|
-
/** The closing tag does not match the opening tag. (e.g. `<bold>foo</italic>`) */
|
|
208
|
-
ErrorKind[ErrorKind["UNMATCHED_CLOSING_TAG"] = 26] = "UNMATCHED_CLOSING_TAG";
|
|
209
|
-
/** The opening tag has unmatched closing tag. (e.g. `<bold>foo`) */
|
|
210
|
-
ErrorKind[ErrorKind["UNCLOSED_TAG"] = 27] = "UNCLOSED_TAG";
|
|
211
|
-
})(ErrorKind || (ErrorKind = {}));
|
|
212
|
-
|
|
213
|
-
var TYPE;
|
|
214
|
-
(function (TYPE) {
|
|
215
|
-
/**
|
|
216
|
-
* Raw text
|
|
217
|
-
*/
|
|
218
|
-
TYPE[TYPE["literal"] = 0] = "literal";
|
|
219
|
-
/**
|
|
220
|
-
* Variable w/o any format, e.g `var` in `this is a {var}`
|
|
221
|
-
*/
|
|
222
|
-
TYPE[TYPE["argument"] = 1] = "argument";
|
|
223
|
-
/**
|
|
224
|
-
* Variable w/ number format
|
|
225
|
-
*/
|
|
226
|
-
TYPE[TYPE["number"] = 2] = "number";
|
|
227
|
-
/**
|
|
228
|
-
* Variable w/ date format
|
|
229
|
-
*/
|
|
230
|
-
TYPE[TYPE["date"] = 3] = "date";
|
|
231
|
-
/**
|
|
232
|
-
* Variable w/ time format
|
|
233
|
-
*/
|
|
234
|
-
TYPE[TYPE["time"] = 4] = "time";
|
|
235
|
-
/**
|
|
236
|
-
* Variable w/ select format
|
|
237
|
-
*/
|
|
238
|
-
TYPE[TYPE["select"] = 5] = "select";
|
|
239
|
-
/**
|
|
240
|
-
* Variable w/ plural format
|
|
241
|
-
*/
|
|
242
|
-
TYPE[TYPE["plural"] = 6] = "plural";
|
|
243
|
-
/**
|
|
244
|
-
* Only possible within plural argument.
|
|
245
|
-
* This is the `#` symbol that will be substituted with the count.
|
|
246
|
-
*/
|
|
247
|
-
TYPE[TYPE["pound"] = 7] = "pound";
|
|
248
|
-
/**
|
|
249
|
-
* XML-like tag
|
|
250
|
-
*/
|
|
251
|
-
TYPE[TYPE["tag"] = 8] = "tag";
|
|
252
|
-
})(TYPE || (TYPE = {}));
|
|
253
|
-
var SKELETON_TYPE;
|
|
254
|
-
(function (SKELETON_TYPE) {
|
|
255
|
-
SKELETON_TYPE[SKELETON_TYPE["number"] = 0] = "number";
|
|
256
|
-
SKELETON_TYPE[SKELETON_TYPE["dateTime"] = 1] = "dateTime";
|
|
257
|
-
})(SKELETON_TYPE || (SKELETON_TYPE = {}));
|
|
258
|
-
/**
|
|
259
|
-
* Type Guards
|
|
260
|
-
*/
|
|
261
|
-
function isLiteralElement(el) {
|
|
262
|
-
return el.type === TYPE.literal;
|
|
263
|
-
}
|
|
264
|
-
function isArgumentElement(el) {
|
|
265
|
-
return el.type === TYPE.argument;
|
|
266
|
-
}
|
|
267
|
-
function isNumberElement(el) {
|
|
268
|
-
return el.type === TYPE.number;
|
|
269
|
-
}
|
|
270
|
-
function isDateElement(el) {
|
|
271
|
-
return el.type === TYPE.date;
|
|
272
|
-
}
|
|
273
|
-
function isTimeElement(el) {
|
|
274
|
-
return el.type === TYPE.time;
|
|
275
|
-
}
|
|
276
|
-
function isSelectElement(el) {
|
|
277
|
-
return el.type === TYPE.select;
|
|
278
|
-
}
|
|
279
|
-
function isPluralElement(el) {
|
|
280
|
-
return el.type === TYPE.plural;
|
|
281
|
-
}
|
|
282
|
-
function isPoundElement(el) {
|
|
283
|
-
return el.type === TYPE.pound;
|
|
284
|
-
}
|
|
285
|
-
function isTagElement(el) {
|
|
286
|
-
return el.type === TYPE.tag;
|
|
287
|
-
}
|
|
288
|
-
function isNumberSkeleton(el) {
|
|
289
|
-
return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.number);
|
|
290
|
-
}
|
|
291
|
-
function isDateTimeSkeleton(el) {
|
|
292
|
-
return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.dateTime);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// @generated from regex-gen.ts
|
|
296
|
-
var SPACE_SEPARATOR_REGEX = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/;
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
300
|
-
* Credit: https://github.com/caridy/intl-datetimeformat-pattern/blob/master/index.js
|
|
301
|
-
* with some tweaks
|
|
302
|
-
*/
|
|
303
|
-
var DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;
|
|
304
|
-
/**
|
|
305
|
-
* Parse Date time skeleton into Intl.DateTimeFormatOptions
|
|
306
|
-
* Ref: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
307
|
-
* @public
|
|
308
|
-
* @param skeleton skeleton string
|
|
309
|
-
*/
|
|
310
|
-
function parseDateTimeSkeleton(skeleton) {
|
|
311
|
-
var result = {};
|
|
312
|
-
skeleton.replace(DATE_TIME_REGEX, function (match) {
|
|
313
|
-
var len = match.length;
|
|
314
|
-
switch (match[0]) {
|
|
315
|
-
// Era
|
|
316
|
-
case 'G':
|
|
317
|
-
result.era = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short';
|
|
318
|
-
break;
|
|
319
|
-
// Year
|
|
320
|
-
case 'y':
|
|
321
|
-
result.year = len === 2 ? '2-digit' : 'numeric';
|
|
322
|
-
break;
|
|
323
|
-
case 'Y':
|
|
324
|
-
case 'u':
|
|
325
|
-
case 'U':
|
|
326
|
-
case 'r':
|
|
327
|
-
throw new RangeError('`Y/u/U/r` (year) patterns are not supported, use `y` instead');
|
|
328
|
-
// Quarter
|
|
329
|
-
case 'q':
|
|
330
|
-
case 'Q':
|
|
331
|
-
throw new RangeError('`q/Q` (quarter) patterns are not supported');
|
|
332
|
-
// Month
|
|
333
|
-
case 'M':
|
|
334
|
-
case 'L':
|
|
335
|
-
result.month = ['numeric', '2-digit', 'short', 'long', 'narrow'][len - 1];
|
|
336
|
-
break;
|
|
337
|
-
// Week
|
|
338
|
-
case 'w':
|
|
339
|
-
case 'W':
|
|
340
|
-
throw new RangeError('`w/W` (week) patterns are not supported');
|
|
341
|
-
case 'd':
|
|
342
|
-
result.day = ['numeric', '2-digit'][len - 1];
|
|
343
|
-
break;
|
|
344
|
-
case 'D':
|
|
345
|
-
case 'F':
|
|
346
|
-
case 'g':
|
|
347
|
-
throw new RangeError('`D/F/g` (day) patterns are not supported, use `d` instead');
|
|
348
|
-
// Weekday
|
|
349
|
-
case 'E':
|
|
350
|
-
result.weekday = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short';
|
|
351
|
-
break;
|
|
352
|
-
case 'e':
|
|
353
|
-
if (len < 4) {
|
|
354
|
-
throw new RangeError('`e..eee` (weekday) patterns are not supported');
|
|
355
|
-
}
|
|
356
|
-
result.weekday = ['short', 'long', 'narrow', 'short'][len - 4];
|
|
357
|
-
break;
|
|
358
|
-
case 'c':
|
|
359
|
-
if (len < 4) {
|
|
360
|
-
throw new RangeError('`c..ccc` (weekday) patterns are not supported');
|
|
361
|
-
}
|
|
362
|
-
result.weekday = ['short', 'long', 'narrow', 'short'][len - 4];
|
|
363
|
-
break;
|
|
364
|
-
// Period
|
|
365
|
-
case 'a': // AM, PM
|
|
366
|
-
result.hour12 = true;
|
|
367
|
-
break;
|
|
368
|
-
case 'b': // am, pm, noon, midnight
|
|
369
|
-
case 'B': // flexible day periods
|
|
370
|
-
throw new RangeError('`b/B` (period) patterns are not supported, use `a` instead');
|
|
371
|
-
// Hour
|
|
372
|
-
case 'h':
|
|
373
|
-
result.hourCycle = 'h12';
|
|
374
|
-
result.hour = ['numeric', '2-digit'][len - 1];
|
|
375
|
-
break;
|
|
376
|
-
case 'H':
|
|
377
|
-
result.hourCycle = 'h23';
|
|
378
|
-
result.hour = ['numeric', '2-digit'][len - 1];
|
|
379
|
-
break;
|
|
380
|
-
case 'K':
|
|
381
|
-
result.hourCycle = 'h11';
|
|
382
|
-
result.hour = ['numeric', '2-digit'][len - 1];
|
|
383
|
-
break;
|
|
384
|
-
case 'k':
|
|
385
|
-
result.hourCycle = 'h24';
|
|
386
|
-
result.hour = ['numeric', '2-digit'][len - 1];
|
|
387
|
-
break;
|
|
388
|
-
case 'j':
|
|
389
|
-
case 'J':
|
|
390
|
-
case 'C':
|
|
391
|
-
throw new RangeError('`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead');
|
|
392
|
-
// Minute
|
|
393
|
-
case 'm':
|
|
394
|
-
result.minute = ['numeric', '2-digit'][len - 1];
|
|
395
|
-
break;
|
|
396
|
-
// Second
|
|
397
|
-
case 's':
|
|
398
|
-
result.second = ['numeric', '2-digit'][len - 1];
|
|
399
|
-
break;
|
|
400
|
-
case 'S':
|
|
401
|
-
case 'A':
|
|
402
|
-
throw new RangeError('`S/A` (second) patterns are not supported, use `s` instead');
|
|
403
|
-
// Zone
|
|
404
|
-
case 'z': // 1..3, 4: specific non-location format
|
|
405
|
-
result.timeZoneName = len < 4 ? 'short' : 'long';
|
|
406
|
-
break;
|
|
407
|
-
case 'Z': // 1..3, 4, 5: The ISO8601 varios formats
|
|
408
|
-
case 'O': // 1, 4: milliseconds in day short, long
|
|
409
|
-
case 'v': // 1, 4: generic non-location format
|
|
410
|
-
case 'V': // 1, 2, 3, 4: time zone ID or city
|
|
411
|
-
case 'X': // 1, 2, 3, 4: The ISO8601 varios formats
|
|
412
|
-
case 'x': // 1, 2, 3, 4: The ISO8601 varios formats
|
|
413
|
-
throw new RangeError('`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead');
|
|
414
|
-
}
|
|
415
|
-
return '';
|
|
416
|
-
});
|
|
417
|
-
return result;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
// @generated from regex-gen.ts
|
|
421
|
-
var WHITE_SPACE_REGEX = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i;
|
|
422
|
-
|
|
423
|
-
function parseNumberSkeletonFromString(skeleton) {
|
|
424
|
-
if (skeleton.length === 0) {
|
|
425
|
-
throw new Error('Number skeleton cannot be empty');
|
|
426
|
-
}
|
|
427
|
-
// Parse the skeleton
|
|
428
|
-
var stringTokens = skeleton
|
|
429
|
-
.split(WHITE_SPACE_REGEX)
|
|
430
|
-
.filter(function (x) { return x.length > 0; });
|
|
431
|
-
var tokens = [];
|
|
432
|
-
for (var _i = 0, stringTokens_1 = stringTokens; _i < stringTokens_1.length; _i++) {
|
|
433
|
-
var stringToken = stringTokens_1[_i];
|
|
434
|
-
var stemAndOptions = stringToken.split('/');
|
|
435
|
-
if (stemAndOptions.length === 0) {
|
|
436
|
-
throw new Error('Invalid number skeleton');
|
|
437
|
-
}
|
|
438
|
-
var stem = stemAndOptions[0], options = stemAndOptions.slice(1);
|
|
439
|
-
for (var _a = 0, options_1 = options; _a < options_1.length; _a++) {
|
|
440
|
-
var option = options_1[_a];
|
|
441
|
-
if (option.length === 0) {
|
|
442
|
-
throw new Error('Invalid number skeleton');
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
tokens.push({ stem: stem, options: options });
|
|
446
|
-
}
|
|
447
|
-
return tokens;
|
|
448
|
-
}
|
|
449
|
-
function icuUnitToEcma(unit) {
|
|
450
|
-
return unit.replace(/^(.*?)-/, '');
|
|
451
|
-
}
|
|
452
|
-
var FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g;
|
|
453
|
-
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?[rs]?$/g;
|
|
454
|
-
var INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g;
|
|
455
|
-
var CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;
|
|
456
|
-
function parseSignificantPrecision(str) {
|
|
457
|
-
var result = {};
|
|
458
|
-
if (str[str.length - 1] === 'r') {
|
|
459
|
-
result.roundingPriority = 'morePrecision';
|
|
460
|
-
}
|
|
461
|
-
else if (str[str.length - 1] === 's') {
|
|
462
|
-
result.roundingPriority = 'lessPrecision';
|
|
463
|
-
}
|
|
464
|
-
str.replace(SIGNIFICANT_PRECISION_REGEX, function (_, g1, g2) {
|
|
465
|
-
// @@@ case
|
|
466
|
-
if (typeof g2 !== 'string') {
|
|
467
|
-
result.minimumSignificantDigits = g1.length;
|
|
468
|
-
result.maximumSignificantDigits = g1.length;
|
|
469
|
-
}
|
|
470
|
-
// @@@+ case
|
|
471
|
-
else if (g2 === '+') {
|
|
472
|
-
result.minimumSignificantDigits = g1.length;
|
|
473
|
-
}
|
|
474
|
-
// .### case
|
|
475
|
-
else if (g1[0] === '#') {
|
|
476
|
-
result.maximumSignificantDigits = g1.length;
|
|
477
|
-
}
|
|
478
|
-
// .@@## or .@@@ case
|
|
479
|
-
else {
|
|
480
|
-
result.minimumSignificantDigits = g1.length;
|
|
481
|
-
result.maximumSignificantDigits =
|
|
482
|
-
g1.length + (typeof g2 === 'string' ? g2.length : 0);
|
|
483
|
-
}
|
|
484
|
-
return '';
|
|
485
|
-
});
|
|
486
|
-
return result;
|
|
487
|
-
}
|
|
488
|
-
function parseSign(str) {
|
|
489
|
-
switch (str) {
|
|
490
|
-
case 'sign-auto':
|
|
491
|
-
return {
|
|
492
|
-
signDisplay: 'auto',
|
|
493
|
-
};
|
|
494
|
-
case 'sign-accounting':
|
|
495
|
-
case '()':
|
|
496
|
-
return {
|
|
497
|
-
currencySign: 'accounting',
|
|
498
|
-
};
|
|
499
|
-
case 'sign-always':
|
|
500
|
-
case '+!':
|
|
501
|
-
return {
|
|
502
|
-
signDisplay: 'always',
|
|
503
|
-
};
|
|
504
|
-
case 'sign-accounting-always':
|
|
505
|
-
case '()!':
|
|
506
|
-
return {
|
|
507
|
-
signDisplay: 'always',
|
|
508
|
-
currencySign: 'accounting',
|
|
509
|
-
};
|
|
510
|
-
case 'sign-except-zero':
|
|
511
|
-
case '+?':
|
|
512
|
-
return {
|
|
513
|
-
signDisplay: 'exceptZero',
|
|
514
|
-
};
|
|
515
|
-
case 'sign-accounting-except-zero':
|
|
516
|
-
case '()?':
|
|
517
|
-
return {
|
|
518
|
-
signDisplay: 'exceptZero',
|
|
519
|
-
currencySign: 'accounting',
|
|
520
|
-
};
|
|
521
|
-
case 'sign-never':
|
|
522
|
-
case '+_':
|
|
523
|
-
return {
|
|
524
|
-
signDisplay: 'never',
|
|
525
|
-
};
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
function parseConciseScientificAndEngineeringStem(stem) {
|
|
529
|
-
// Engineering
|
|
530
|
-
var result;
|
|
531
|
-
if (stem[0] === 'E' && stem[1] === 'E') {
|
|
532
|
-
result = {
|
|
533
|
-
notation: 'engineering',
|
|
534
|
-
};
|
|
535
|
-
stem = stem.slice(2);
|
|
536
|
-
}
|
|
537
|
-
else if (stem[0] === 'E') {
|
|
538
|
-
result = {
|
|
539
|
-
notation: 'scientific',
|
|
540
|
-
};
|
|
541
|
-
stem = stem.slice(1);
|
|
542
|
-
}
|
|
543
|
-
if (result) {
|
|
544
|
-
var signDisplay = stem.slice(0, 2);
|
|
545
|
-
if (signDisplay === '+!') {
|
|
546
|
-
result.signDisplay = 'always';
|
|
547
|
-
stem = stem.slice(2);
|
|
548
|
-
}
|
|
549
|
-
else if (signDisplay === '+?') {
|
|
550
|
-
result.signDisplay = 'exceptZero';
|
|
551
|
-
stem = stem.slice(2);
|
|
552
|
-
}
|
|
553
|
-
if (!CONCISE_INTEGER_WIDTH_REGEX.test(stem)) {
|
|
554
|
-
throw new Error('Malformed concise eng/scientific notation');
|
|
555
|
-
}
|
|
556
|
-
result.minimumIntegerDigits = stem.length;
|
|
557
|
-
}
|
|
558
|
-
return result;
|
|
559
|
-
}
|
|
560
|
-
function parseNotationOptions(opt) {
|
|
561
|
-
var result = {};
|
|
562
|
-
var signOpts = parseSign(opt);
|
|
563
|
-
if (signOpts) {
|
|
564
|
-
return signOpts;
|
|
565
|
-
}
|
|
566
|
-
return result;
|
|
567
|
-
}
|
|
568
|
-
/**
|
|
569
|
-
* https://github.com/unicode-org/icu/blob/master/docs/userguide/format_parse/numbers/skeletons.md#skeleton-stems-and-options
|
|
570
|
-
*/
|
|
571
|
-
function parseNumberSkeleton(tokens) {
|
|
572
|
-
var result = {};
|
|
573
|
-
for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
|
|
574
|
-
var token = tokens_1[_i];
|
|
575
|
-
switch (token.stem) {
|
|
576
|
-
case 'percent':
|
|
577
|
-
case '%':
|
|
578
|
-
result.style = 'percent';
|
|
579
|
-
continue;
|
|
580
|
-
case '%x100':
|
|
581
|
-
result.style = 'percent';
|
|
582
|
-
result.scale = 100;
|
|
583
|
-
continue;
|
|
584
|
-
case 'currency':
|
|
585
|
-
result.style = 'currency';
|
|
586
|
-
result.currency = token.options[0];
|
|
587
|
-
continue;
|
|
588
|
-
case 'group-off':
|
|
589
|
-
case ',_':
|
|
590
|
-
result.useGrouping = false;
|
|
591
|
-
continue;
|
|
592
|
-
case 'precision-integer':
|
|
593
|
-
case '.':
|
|
594
|
-
result.maximumFractionDigits = 0;
|
|
595
|
-
continue;
|
|
596
|
-
case 'measure-unit':
|
|
597
|
-
case 'unit':
|
|
598
|
-
result.style = 'unit';
|
|
599
|
-
result.unit = icuUnitToEcma(token.options[0]);
|
|
600
|
-
continue;
|
|
601
|
-
case 'compact-short':
|
|
602
|
-
case 'K':
|
|
603
|
-
result.notation = 'compact';
|
|
604
|
-
result.compactDisplay = 'short';
|
|
605
|
-
continue;
|
|
606
|
-
case 'compact-long':
|
|
607
|
-
case 'KK':
|
|
608
|
-
result.notation = 'compact';
|
|
609
|
-
result.compactDisplay = 'long';
|
|
610
|
-
continue;
|
|
611
|
-
case 'scientific':
|
|
612
|
-
result = __assign(__assign(__assign({}, result), { notation: 'scientific' }), token.options.reduce(function (all, opt) { return (__assign(__assign({}, all), parseNotationOptions(opt))); }, {}));
|
|
613
|
-
continue;
|
|
614
|
-
case 'engineering':
|
|
615
|
-
result = __assign(__assign(__assign({}, result), { notation: 'engineering' }), token.options.reduce(function (all, opt) { return (__assign(__assign({}, all), parseNotationOptions(opt))); }, {}));
|
|
616
|
-
continue;
|
|
617
|
-
case 'notation-simple':
|
|
618
|
-
result.notation = 'standard';
|
|
619
|
-
continue;
|
|
620
|
-
// https://github.com/unicode-org/icu/blob/master/icu4c/source/i18n/unicode/unumberformatter.h
|
|
621
|
-
case 'unit-width-narrow':
|
|
622
|
-
result.currencyDisplay = 'narrowSymbol';
|
|
623
|
-
result.unitDisplay = 'narrow';
|
|
624
|
-
continue;
|
|
625
|
-
case 'unit-width-short':
|
|
626
|
-
result.currencyDisplay = 'code';
|
|
627
|
-
result.unitDisplay = 'short';
|
|
628
|
-
continue;
|
|
629
|
-
case 'unit-width-full-name':
|
|
630
|
-
result.currencyDisplay = 'name';
|
|
631
|
-
result.unitDisplay = 'long';
|
|
632
|
-
continue;
|
|
633
|
-
case 'unit-width-iso-code':
|
|
634
|
-
result.currencyDisplay = 'symbol';
|
|
635
|
-
continue;
|
|
636
|
-
case 'scale':
|
|
637
|
-
result.scale = parseFloat(token.options[0]);
|
|
638
|
-
continue;
|
|
639
|
-
case 'rounding-mode-floor':
|
|
640
|
-
result.roundingMode = 'floor';
|
|
641
|
-
continue;
|
|
642
|
-
case 'rounding-mode-ceiling':
|
|
643
|
-
result.roundingMode = 'ceil';
|
|
644
|
-
continue;
|
|
645
|
-
case 'rounding-mode-down':
|
|
646
|
-
result.roundingMode = 'trunc';
|
|
647
|
-
continue;
|
|
648
|
-
case 'rounding-mode-up':
|
|
649
|
-
result.roundingMode = 'expand';
|
|
650
|
-
continue;
|
|
651
|
-
case 'rounding-mode-half-even':
|
|
652
|
-
result.roundingMode = 'halfEven';
|
|
653
|
-
continue;
|
|
654
|
-
case 'rounding-mode-half-down':
|
|
655
|
-
result.roundingMode = 'halfTrunc';
|
|
656
|
-
continue;
|
|
657
|
-
case 'rounding-mode-half-up':
|
|
658
|
-
result.roundingMode = 'halfExpand';
|
|
659
|
-
continue;
|
|
660
|
-
// https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width
|
|
661
|
-
case 'integer-width':
|
|
662
|
-
if (token.options.length > 1) {
|
|
663
|
-
throw new RangeError('integer-width stems only accept a single optional option');
|
|
664
|
-
}
|
|
665
|
-
token.options[0].replace(INTEGER_WIDTH_REGEX, function (_, g1, g2, g3, g4, g5) {
|
|
666
|
-
if (g1) {
|
|
667
|
-
result.minimumIntegerDigits = g2.length;
|
|
668
|
-
}
|
|
669
|
-
else if (g3 && g4) {
|
|
670
|
-
throw new Error('We currently do not support maximum integer digits');
|
|
671
|
-
}
|
|
672
|
-
else if (g5) {
|
|
673
|
-
throw new Error('We currently do not support exact integer digits');
|
|
674
|
-
}
|
|
675
|
-
return '';
|
|
676
|
-
});
|
|
677
|
-
continue;
|
|
678
|
-
}
|
|
679
|
-
// https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width
|
|
680
|
-
if (CONCISE_INTEGER_WIDTH_REGEX.test(token.stem)) {
|
|
681
|
-
result.minimumIntegerDigits = token.stem.length;
|
|
682
|
-
continue;
|
|
683
|
-
}
|
|
684
|
-
if (FRACTION_PRECISION_REGEX.test(token.stem)) {
|
|
685
|
-
// Precision
|
|
686
|
-
// https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#fraction-precision
|
|
687
|
-
// precision-integer case
|
|
688
|
-
if (token.options.length > 1) {
|
|
689
|
-
throw new RangeError('Fraction-precision stems only accept a single optional option');
|
|
690
|
-
}
|
|
691
|
-
token.stem.replace(FRACTION_PRECISION_REGEX, function (_, g1, g2, g3, g4, g5) {
|
|
692
|
-
// .000* case (before ICU67 it was .000+)
|
|
693
|
-
if (g2 === '*') {
|
|
694
|
-
result.minimumFractionDigits = g1.length;
|
|
695
|
-
}
|
|
696
|
-
// .### case
|
|
697
|
-
else if (g3 && g3[0] === '#') {
|
|
698
|
-
result.maximumFractionDigits = g3.length;
|
|
699
|
-
}
|
|
700
|
-
// .00## case
|
|
701
|
-
else if (g4 && g5) {
|
|
702
|
-
result.minimumFractionDigits = g4.length;
|
|
703
|
-
result.maximumFractionDigits = g4.length + g5.length;
|
|
704
|
-
}
|
|
705
|
-
else {
|
|
706
|
-
result.minimumFractionDigits = g1.length;
|
|
707
|
-
result.maximumFractionDigits = g1.length;
|
|
708
|
-
}
|
|
709
|
-
return '';
|
|
710
|
-
});
|
|
711
|
-
var opt = token.options[0];
|
|
712
|
-
// https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#trailing-zero-display
|
|
713
|
-
if (opt === 'w') {
|
|
714
|
-
result = __assign(__assign({}, result), { trailingZeroDisplay: 'stripIfInteger' });
|
|
715
|
-
}
|
|
716
|
-
else if (opt) {
|
|
717
|
-
result = __assign(__assign({}, result), parseSignificantPrecision(opt));
|
|
718
|
-
}
|
|
719
|
-
continue;
|
|
720
|
-
}
|
|
721
|
-
// https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#significant-digits-precision
|
|
722
|
-
if (SIGNIFICANT_PRECISION_REGEX.test(token.stem)) {
|
|
723
|
-
result = __assign(__assign({}, result), parseSignificantPrecision(token.stem));
|
|
724
|
-
continue;
|
|
725
|
-
}
|
|
726
|
-
var signOpts = parseSign(token.stem);
|
|
727
|
-
if (signOpts) {
|
|
728
|
-
result = __assign(__assign({}, result), signOpts);
|
|
729
|
-
}
|
|
730
|
-
var conciseScientificAndEngineeringOpts = parseConciseScientificAndEngineeringStem(token.stem);
|
|
731
|
-
if (conciseScientificAndEngineeringOpts) {
|
|
732
|
-
result = __assign(__assign({}, result), conciseScientificAndEngineeringOpts);
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
return result;
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
// @generated from time-data-gen.ts
|
|
739
|
-
// prettier-ignore
|
|
740
|
-
var timeData = {
|
|
741
|
-
"001": [
|
|
742
|
-
"H",
|
|
743
|
-
"h"
|
|
744
|
-
],
|
|
745
|
-
"419": [
|
|
746
|
-
"h",
|
|
747
|
-
"H",
|
|
748
|
-
"hB",
|
|
749
|
-
"hb"
|
|
750
|
-
],
|
|
751
|
-
"AC": [
|
|
752
|
-
"H",
|
|
753
|
-
"h",
|
|
754
|
-
"hb",
|
|
755
|
-
"hB"
|
|
756
|
-
],
|
|
757
|
-
"AD": [
|
|
758
|
-
"H",
|
|
759
|
-
"hB"
|
|
760
|
-
],
|
|
761
|
-
"AE": [
|
|
762
|
-
"h",
|
|
763
|
-
"hB",
|
|
764
|
-
"hb",
|
|
765
|
-
"H"
|
|
766
|
-
],
|
|
767
|
-
"AF": [
|
|
768
|
-
"H",
|
|
769
|
-
"hb",
|
|
770
|
-
"hB",
|
|
771
|
-
"h"
|
|
772
|
-
],
|
|
773
|
-
"AG": [
|
|
774
|
-
"h",
|
|
775
|
-
"hb",
|
|
776
|
-
"H",
|
|
777
|
-
"hB"
|
|
778
|
-
],
|
|
779
|
-
"AI": [
|
|
780
|
-
"H",
|
|
781
|
-
"h",
|
|
782
|
-
"hb",
|
|
783
|
-
"hB"
|
|
784
|
-
],
|
|
785
|
-
"AL": [
|
|
786
|
-
"h",
|
|
787
|
-
"H",
|
|
788
|
-
"hB"
|
|
789
|
-
],
|
|
790
|
-
"AM": [
|
|
791
|
-
"H",
|
|
792
|
-
"hB"
|
|
793
|
-
],
|
|
794
|
-
"AO": [
|
|
795
|
-
"H",
|
|
796
|
-
"hB"
|
|
797
|
-
],
|
|
798
|
-
"AR": [
|
|
799
|
-
"h",
|
|
800
|
-
"H",
|
|
801
|
-
"hB",
|
|
802
|
-
"hb"
|
|
803
|
-
],
|
|
804
|
-
"AS": [
|
|
805
|
-
"h",
|
|
806
|
-
"H"
|
|
807
|
-
],
|
|
808
|
-
"AT": [
|
|
809
|
-
"H",
|
|
810
|
-
"hB"
|
|
811
|
-
],
|
|
812
|
-
"AU": [
|
|
813
|
-
"h",
|
|
814
|
-
"hb",
|
|
815
|
-
"H",
|
|
816
|
-
"hB"
|
|
817
|
-
],
|
|
818
|
-
"AW": [
|
|
819
|
-
"H",
|
|
820
|
-
"hB"
|
|
821
|
-
],
|
|
822
|
-
"AX": [
|
|
823
|
-
"H"
|
|
824
|
-
],
|
|
825
|
-
"AZ": [
|
|
826
|
-
"H",
|
|
827
|
-
"hB",
|
|
828
|
-
"h"
|
|
829
|
-
],
|
|
830
|
-
"BA": [
|
|
831
|
-
"H",
|
|
832
|
-
"hB",
|
|
833
|
-
"h"
|
|
834
|
-
],
|
|
835
|
-
"BB": [
|
|
836
|
-
"h",
|
|
837
|
-
"hb",
|
|
838
|
-
"H",
|
|
839
|
-
"hB"
|
|
840
|
-
],
|
|
841
|
-
"BD": [
|
|
842
|
-
"h",
|
|
843
|
-
"hB",
|
|
844
|
-
"H"
|
|
845
|
-
],
|
|
846
|
-
"BE": [
|
|
847
|
-
"H",
|
|
848
|
-
"hB"
|
|
849
|
-
],
|
|
850
|
-
"BF": [
|
|
851
|
-
"H",
|
|
852
|
-
"hB"
|
|
853
|
-
],
|
|
854
|
-
"BG": [
|
|
855
|
-
"H",
|
|
856
|
-
"hB",
|
|
857
|
-
"h"
|
|
858
|
-
],
|
|
859
|
-
"BH": [
|
|
860
|
-
"h",
|
|
861
|
-
"hB",
|
|
862
|
-
"hb",
|
|
863
|
-
"H"
|
|
864
|
-
],
|
|
865
|
-
"BI": [
|
|
866
|
-
"H",
|
|
867
|
-
"h"
|
|
868
|
-
],
|
|
869
|
-
"BJ": [
|
|
870
|
-
"H",
|
|
871
|
-
"hB"
|
|
872
|
-
],
|
|
873
|
-
"BL": [
|
|
874
|
-
"H",
|
|
875
|
-
"hB"
|
|
876
|
-
],
|
|
877
|
-
"BM": [
|
|
878
|
-
"h",
|
|
879
|
-
"hb",
|
|
880
|
-
"H",
|
|
881
|
-
"hB"
|
|
882
|
-
],
|
|
883
|
-
"BN": [
|
|
884
|
-
"hb",
|
|
885
|
-
"hB",
|
|
886
|
-
"h",
|
|
887
|
-
"H"
|
|
888
|
-
],
|
|
889
|
-
"BO": [
|
|
890
|
-
"h",
|
|
891
|
-
"H",
|
|
892
|
-
"hB",
|
|
893
|
-
"hb"
|
|
894
|
-
],
|
|
895
|
-
"BQ": [
|
|
896
|
-
"H"
|
|
897
|
-
],
|
|
898
|
-
"BR": [
|
|
899
|
-
"H",
|
|
900
|
-
"hB"
|
|
901
|
-
],
|
|
902
|
-
"BS": [
|
|
903
|
-
"h",
|
|
904
|
-
"hb",
|
|
905
|
-
"H",
|
|
906
|
-
"hB"
|
|
907
|
-
],
|
|
908
|
-
"BT": [
|
|
909
|
-
"h",
|
|
910
|
-
"H"
|
|
911
|
-
],
|
|
912
|
-
"BW": [
|
|
913
|
-
"H",
|
|
914
|
-
"h",
|
|
915
|
-
"hb",
|
|
916
|
-
"hB"
|
|
917
|
-
],
|
|
918
|
-
"BY": [
|
|
919
|
-
"H",
|
|
920
|
-
"h"
|
|
921
|
-
],
|
|
922
|
-
"BZ": [
|
|
923
|
-
"H",
|
|
924
|
-
"h",
|
|
925
|
-
"hb",
|
|
926
|
-
"hB"
|
|
927
|
-
],
|
|
928
|
-
"CA": [
|
|
929
|
-
"h",
|
|
930
|
-
"hb",
|
|
931
|
-
"H",
|
|
932
|
-
"hB"
|
|
933
|
-
],
|
|
934
|
-
"CC": [
|
|
935
|
-
"H",
|
|
936
|
-
"h",
|
|
937
|
-
"hb",
|
|
938
|
-
"hB"
|
|
939
|
-
],
|
|
940
|
-
"CD": [
|
|
941
|
-
"hB",
|
|
942
|
-
"H"
|
|
943
|
-
],
|
|
944
|
-
"CF": [
|
|
945
|
-
"H",
|
|
946
|
-
"h",
|
|
947
|
-
"hB"
|
|
948
|
-
],
|
|
949
|
-
"CG": [
|
|
950
|
-
"H",
|
|
951
|
-
"hB"
|
|
952
|
-
],
|
|
953
|
-
"CH": [
|
|
954
|
-
"H",
|
|
955
|
-
"hB",
|
|
956
|
-
"h"
|
|
957
|
-
],
|
|
958
|
-
"CI": [
|
|
959
|
-
"H",
|
|
960
|
-
"hB"
|
|
961
|
-
],
|
|
962
|
-
"CK": [
|
|
963
|
-
"H",
|
|
964
|
-
"h",
|
|
965
|
-
"hb",
|
|
966
|
-
"hB"
|
|
967
|
-
],
|
|
968
|
-
"CL": [
|
|
969
|
-
"h",
|
|
970
|
-
"H",
|
|
971
|
-
"hB",
|
|
972
|
-
"hb"
|
|
973
|
-
],
|
|
974
|
-
"CM": [
|
|
975
|
-
"H",
|
|
976
|
-
"h",
|
|
977
|
-
"hB"
|
|
978
|
-
],
|
|
979
|
-
"CN": [
|
|
980
|
-
"H",
|
|
981
|
-
"hB",
|
|
982
|
-
"hb",
|
|
983
|
-
"h"
|
|
984
|
-
],
|
|
985
|
-
"CO": [
|
|
986
|
-
"h",
|
|
987
|
-
"H",
|
|
988
|
-
"hB",
|
|
989
|
-
"hb"
|
|
990
|
-
],
|
|
991
|
-
"CP": [
|
|
992
|
-
"H"
|
|
993
|
-
],
|
|
994
|
-
"CR": [
|
|
995
|
-
"h",
|
|
996
|
-
"H",
|
|
997
|
-
"hB",
|
|
998
|
-
"hb"
|
|
999
|
-
],
|
|
1000
|
-
"CU": [
|
|
1001
|
-
"h",
|
|
1002
|
-
"H",
|
|
1003
|
-
"hB",
|
|
1004
|
-
"hb"
|
|
1005
|
-
],
|
|
1006
|
-
"CV": [
|
|
1007
|
-
"H",
|
|
1008
|
-
"hB"
|
|
1009
|
-
],
|
|
1010
|
-
"CW": [
|
|
1011
|
-
"H",
|
|
1012
|
-
"hB"
|
|
1013
|
-
],
|
|
1014
|
-
"CX": [
|
|
1015
|
-
"H",
|
|
1016
|
-
"h",
|
|
1017
|
-
"hb",
|
|
1018
|
-
"hB"
|
|
1019
|
-
],
|
|
1020
|
-
"CY": [
|
|
1021
|
-
"h",
|
|
1022
|
-
"H",
|
|
1023
|
-
"hb",
|
|
1024
|
-
"hB"
|
|
1025
|
-
],
|
|
1026
|
-
"CZ": [
|
|
1027
|
-
"H"
|
|
1028
|
-
],
|
|
1029
|
-
"DE": [
|
|
1030
|
-
"H",
|
|
1031
|
-
"hB"
|
|
1032
|
-
],
|
|
1033
|
-
"DG": [
|
|
1034
|
-
"H",
|
|
1035
|
-
"h",
|
|
1036
|
-
"hb",
|
|
1037
|
-
"hB"
|
|
1038
|
-
],
|
|
1039
|
-
"DJ": [
|
|
1040
|
-
"h",
|
|
1041
|
-
"H"
|
|
1042
|
-
],
|
|
1043
|
-
"DK": [
|
|
1044
|
-
"H"
|
|
1045
|
-
],
|
|
1046
|
-
"DM": [
|
|
1047
|
-
"h",
|
|
1048
|
-
"hb",
|
|
1049
|
-
"H",
|
|
1050
|
-
"hB"
|
|
1051
|
-
],
|
|
1052
|
-
"DO": [
|
|
1053
|
-
"h",
|
|
1054
|
-
"H",
|
|
1055
|
-
"hB",
|
|
1056
|
-
"hb"
|
|
1057
|
-
],
|
|
1058
|
-
"DZ": [
|
|
1059
|
-
"h",
|
|
1060
|
-
"hB",
|
|
1061
|
-
"hb",
|
|
1062
|
-
"H"
|
|
1063
|
-
],
|
|
1064
|
-
"EA": [
|
|
1065
|
-
"H",
|
|
1066
|
-
"h",
|
|
1067
|
-
"hB",
|
|
1068
|
-
"hb"
|
|
1069
|
-
],
|
|
1070
|
-
"EC": [
|
|
1071
|
-
"h",
|
|
1072
|
-
"H",
|
|
1073
|
-
"hB",
|
|
1074
|
-
"hb"
|
|
1075
|
-
],
|
|
1076
|
-
"EE": [
|
|
1077
|
-
"H",
|
|
1078
|
-
"hB"
|
|
1079
|
-
],
|
|
1080
|
-
"EG": [
|
|
1081
|
-
"h",
|
|
1082
|
-
"hB",
|
|
1083
|
-
"hb",
|
|
1084
|
-
"H"
|
|
1085
|
-
],
|
|
1086
|
-
"EH": [
|
|
1087
|
-
"h",
|
|
1088
|
-
"hB",
|
|
1089
|
-
"hb",
|
|
1090
|
-
"H"
|
|
1091
|
-
],
|
|
1092
|
-
"ER": [
|
|
1093
|
-
"h",
|
|
1094
|
-
"H"
|
|
1095
|
-
],
|
|
1096
|
-
"ES": [
|
|
1097
|
-
"H",
|
|
1098
|
-
"hB",
|
|
1099
|
-
"h",
|
|
1100
|
-
"hb"
|
|
1101
|
-
],
|
|
1102
|
-
"ET": [
|
|
1103
|
-
"hB",
|
|
1104
|
-
"hb",
|
|
1105
|
-
"h",
|
|
1106
|
-
"H"
|
|
1107
|
-
],
|
|
1108
|
-
"FI": [
|
|
1109
|
-
"H"
|
|
1110
|
-
],
|
|
1111
|
-
"FJ": [
|
|
1112
|
-
"h",
|
|
1113
|
-
"hb",
|
|
1114
|
-
"H",
|
|
1115
|
-
"hB"
|
|
1116
|
-
],
|
|
1117
|
-
"FK": [
|
|
1118
|
-
"H",
|
|
1119
|
-
"h",
|
|
1120
|
-
"hb",
|
|
1121
|
-
"hB"
|
|
1122
|
-
],
|
|
1123
|
-
"FM": [
|
|
1124
|
-
"h",
|
|
1125
|
-
"hb",
|
|
1126
|
-
"H",
|
|
1127
|
-
"hB"
|
|
1128
|
-
],
|
|
1129
|
-
"FO": [
|
|
1130
|
-
"H",
|
|
1131
|
-
"h"
|
|
1132
|
-
],
|
|
1133
|
-
"FR": [
|
|
1134
|
-
"H",
|
|
1135
|
-
"hB"
|
|
1136
|
-
],
|
|
1137
|
-
"GA": [
|
|
1138
|
-
"H",
|
|
1139
|
-
"hB"
|
|
1140
|
-
],
|
|
1141
|
-
"GB": [
|
|
1142
|
-
"H",
|
|
1143
|
-
"h",
|
|
1144
|
-
"hb",
|
|
1145
|
-
"hB"
|
|
1146
|
-
],
|
|
1147
|
-
"GD": [
|
|
1148
|
-
"h",
|
|
1149
|
-
"hb",
|
|
1150
|
-
"H",
|
|
1151
|
-
"hB"
|
|
1152
|
-
],
|
|
1153
|
-
"GE": [
|
|
1154
|
-
"H",
|
|
1155
|
-
"hB",
|
|
1156
|
-
"h"
|
|
1157
|
-
],
|
|
1158
|
-
"GF": [
|
|
1159
|
-
"H",
|
|
1160
|
-
"hB"
|
|
1161
|
-
],
|
|
1162
|
-
"GG": [
|
|
1163
|
-
"H",
|
|
1164
|
-
"h",
|
|
1165
|
-
"hb",
|
|
1166
|
-
"hB"
|
|
1167
|
-
],
|
|
1168
|
-
"GH": [
|
|
1169
|
-
"h",
|
|
1170
|
-
"H"
|
|
1171
|
-
],
|
|
1172
|
-
"GI": [
|
|
1173
|
-
"H",
|
|
1174
|
-
"h",
|
|
1175
|
-
"hb",
|
|
1176
|
-
"hB"
|
|
1177
|
-
],
|
|
1178
|
-
"GL": [
|
|
1179
|
-
"H",
|
|
1180
|
-
"h"
|
|
1181
|
-
],
|
|
1182
|
-
"GM": [
|
|
1183
|
-
"h",
|
|
1184
|
-
"hb",
|
|
1185
|
-
"H",
|
|
1186
|
-
"hB"
|
|
1187
|
-
],
|
|
1188
|
-
"GN": [
|
|
1189
|
-
"H",
|
|
1190
|
-
"hB"
|
|
1191
|
-
],
|
|
1192
|
-
"GP": [
|
|
1193
|
-
"H",
|
|
1194
|
-
"hB"
|
|
1195
|
-
],
|
|
1196
|
-
"GQ": [
|
|
1197
|
-
"H",
|
|
1198
|
-
"hB",
|
|
1199
|
-
"h",
|
|
1200
|
-
"hb"
|
|
1201
|
-
],
|
|
1202
|
-
"GR": [
|
|
1203
|
-
"h",
|
|
1204
|
-
"H",
|
|
1205
|
-
"hb",
|
|
1206
|
-
"hB"
|
|
1207
|
-
],
|
|
1208
|
-
"GT": [
|
|
1209
|
-
"h",
|
|
1210
|
-
"H",
|
|
1211
|
-
"hB",
|
|
1212
|
-
"hb"
|
|
1213
|
-
],
|
|
1214
|
-
"GU": [
|
|
1215
|
-
"h",
|
|
1216
|
-
"hb",
|
|
1217
|
-
"H",
|
|
1218
|
-
"hB"
|
|
1219
|
-
],
|
|
1220
|
-
"GW": [
|
|
1221
|
-
"H",
|
|
1222
|
-
"hB"
|
|
1223
|
-
],
|
|
1224
|
-
"GY": [
|
|
1225
|
-
"h",
|
|
1226
|
-
"hb",
|
|
1227
|
-
"H",
|
|
1228
|
-
"hB"
|
|
1229
|
-
],
|
|
1230
|
-
"HK": [
|
|
1231
|
-
"h",
|
|
1232
|
-
"hB",
|
|
1233
|
-
"hb",
|
|
1234
|
-
"H"
|
|
1235
|
-
],
|
|
1236
|
-
"HN": [
|
|
1237
|
-
"h",
|
|
1238
|
-
"H",
|
|
1239
|
-
"hB",
|
|
1240
|
-
"hb"
|
|
1241
|
-
],
|
|
1242
|
-
"HR": [
|
|
1243
|
-
"H",
|
|
1244
|
-
"hB"
|
|
1245
|
-
],
|
|
1246
|
-
"HU": [
|
|
1247
|
-
"H",
|
|
1248
|
-
"h"
|
|
1249
|
-
],
|
|
1250
|
-
"IC": [
|
|
1251
|
-
"H",
|
|
1252
|
-
"h",
|
|
1253
|
-
"hB",
|
|
1254
|
-
"hb"
|
|
1255
|
-
],
|
|
1256
|
-
"ID": [
|
|
1257
|
-
"H"
|
|
1258
|
-
],
|
|
1259
|
-
"IE": [
|
|
1260
|
-
"H",
|
|
1261
|
-
"h",
|
|
1262
|
-
"hb",
|
|
1263
|
-
"hB"
|
|
1264
|
-
],
|
|
1265
|
-
"IL": [
|
|
1266
|
-
"H",
|
|
1267
|
-
"hB"
|
|
1268
|
-
],
|
|
1269
|
-
"IM": [
|
|
1270
|
-
"H",
|
|
1271
|
-
"h",
|
|
1272
|
-
"hb",
|
|
1273
|
-
"hB"
|
|
1274
|
-
],
|
|
1275
|
-
"IN": [
|
|
1276
|
-
"h",
|
|
1277
|
-
"H"
|
|
1278
|
-
],
|
|
1279
|
-
"IO": [
|
|
1280
|
-
"H",
|
|
1281
|
-
"h",
|
|
1282
|
-
"hb",
|
|
1283
|
-
"hB"
|
|
1284
|
-
],
|
|
1285
|
-
"IQ": [
|
|
1286
|
-
"h",
|
|
1287
|
-
"hB",
|
|
1288
|
-
"hb",
|
|
1289
|
-
"H"
|
|
1290
|
-
],
|
|
1291
|
-
"IR": [
|
|
1292
|
-
"hB",
|
|
1293
|
-
"H"
|
|
1294
|
-
],
|
|
1295
|
-
"IS": [
|
|
1296
|
-
"H"
|
|
1297
|
-
],
|
|
1298
|
-
"IT": [
|
|
1299
|
-
"H",
|
|
1300
|
-
"hB"
|
|
1301
|
-
],
|
|
1302
|
-
"JE": [
|
|
1303
|
-
"H",
|
|
1304
|
-
"h",
|
|
1305
|
-
"hb",
|
|
1306
|
-
"hB"
|
|
1307
|
-
],
|
|
1308
|
-
"JM": [
|
|
1309
|
-
"h",
|
|
1310
|
-
"hb",
|
|
1311
|
-
"H",
|
|
1312
|
-
"hB"
|
|
1313
|
-
],
|
|
1314
|
-
"JO": [
|
|
1315
|
-
"h",
|
|
1316
|
-
"hB",
|
|
1317
|
-
"hb",
|
|
1318
|
-
"H"
|
|
1319
|
-
],
|
|
1320
|
-
"JP": [
|
|
1321
|
-
"H",
|
|
1322
|
-
"K",
|
|
1323
|
-
"h"
|
|
1324
|
-
],
|
|
1325
|
-
"KE": [
|
|
1326
|
-
"hB",
|
|
1327
|
-
"hb",
|
|
1328
|
-
"H",
|
|
1329
|
-
"h"
|
|
1330
|
-
],
|
|
1331
|
-
"KG": [
|
|
1332
|
-
"H",
|
|
1333
|
-
"h",
|
|
1334
|
-
"hB",
|
|
1335
|
-
"hb"
|
|
1336
|
-
],
|
|
1337
|
-
"KH": [
|
|
1338
|
-
"hB",
|
|
1339
|
-
"h",
|
|
1340
|
-
"H",
|
|
1341
|
-
"hb"
|
|
1342
|
-
],
|
|
1343
|
-
"KI": [
|
|
1344
|
-
"h",
|
|
1345
|
-
"hb",
|
|
1346
|
-
"H",
|
|
1347
|
-
"hB"
|
|
1348
|
-
],
|
|
1349
|
-
"KM": [
|
|
1350
|
-
"H",
|
|
1351
|
-
"h",
|
|
1352
|
-
"hB",
|
|
1353
|
-
"hb"
|
|
1354
|
-
],
|
|
1355
|
-
"KN": [
|
|
1356
|
-
"h",
|
|
1357
|
-
"hb",
|
|
1358
|
-
"H",
|
|
1359
|
-
"hB"
|
|
1360
|
-
],
|
|
1361
|
-
"KP": [
|
|
1362
|
-
"h",
|
|
1363
|
-
"H",
|
|
1364
|
-
"hB",
|
|
1365
|
-
"hb"
|
|
1366
|
-
],
|
|
1367
|
-
"KR": [
|
|
1368
|
-
"h",
|
|
1369
|
-
"H",
|
|
1370
|
-
"hB",
|
|
1371
|
-
"hb"
|
|
1372
|
-
],
|
|
1373
|
-
"KW": [
|
|
1374
|
-
"h",
|
|
1375
|
-
"hB",
|
|
1376
|
-
"hb",
|
|
1377
|
-
"H"
|
|
1378
|
-
],
|
|
1379
|
-
"KY": [
|
|
1380
|
-
"h",
|
|
1381
|
-
"hb",
|
|
1382
|
-
"H",
|
|
1383
|
-
"hB"
|
|
1384
|
-
],
|
|
1385
|
-
"KZ": [
|
|
1386
|
-
"H",
|
|
1387
|
-
"hB"
|
|
1388
|
-
],
|
|
1389
|
-
"LA": [
|
|
1390
|
-
"H",
|
|
1391
|
-
"hb",
|
|
1392
|
-
"hB",
|
|
1393
|
-
"h"
|
|
1394
|
-
],
|
|
1395
|
-
"LB": [
|
|
1396
|
-
"h",
|
|
1397
|
-
"hB",
|
|
1398
|
-
"hb",
|
|
1399
|
-
"H"
|
|
1400
|
-
],
|
|
1401
|
-
"LC": [
|
|
1402
|
-
"h",
|
|
1403
|
-
"hb",
|
|
1404
|
-
"H",
|
|
1405
|
-
"hB"
|
|
1406
|
-
],
|
|
1407
|
-
"LI": [
|
|
1408
|
-
"H",
|
|
1409
|
-
"hB",
|
|
1410
|
-
"h"
|
|
1411
|
-
],
|
|
1412
|
-
"LK": [
|
|
1413
|
-
"H",
|
|
1414
|
-
"h",
|
|
1415
|
-
"hB",
|
|
1416
|
-
"hb"
|
|
1417
|
-
],
|
|
1418
|
-
"LR": [
|
|
1419
|
-
"h",
|
|
1420
|
-
"hb",
|
|
1421
|
-
"H",
|
|
1422
|
-
"hB"
|
|
1423
|
-
],
|
|
1424
|
-
"LS": [
|
|
1425
|
-
"h",
|
|
1426
|
-
"H"
|
|
1427
|
-
],
|
|
1428
|
-
"LT": [
|
|
1429
|
-
"H",
|
|
1430
|
-
"h",
|
|
1431
|
-
"hb",
|
|
1432
|
-
"hB"
|
|
1433
|
-
],
|
|
1434
|
-
"LU": [
|
|
1435
|
-
"H",
|
|
1436
|
-
"h",
|
|
1437
|
-
"hB"
|
|
1438
|
-
],
|
|
1439
|
-
"LV": [
|
|
1440
|
-
"H",
|
|
1441
|
-
"hB",
|
|
1442
|
-
"hb",
|
|
1443
|
-
"h"
|
|
1444
|
-
],
|
|
1445
|
-
"LY": [
|
|
1446
|
-
"h",
|
|
1447
|
-
"hB",
|
|
1448
|
-
"hb",
|
|
1449
|
-
"H"
|
|
1450
|
-
],
|
|
1451
|
-
"MA": [
|
|
1452
|
-
"H",
|
|
1453
|
-
"h",
|
|
1454
|
-
"hB",
|
|
1455
|
-
"hb"
|
|
1456
|
-
],
|
|
1457
|
-
"MC": [
|
|
1458
|
-
"H",
|
|
1459
|
-
"hB"
|
|
1460
|
-
],
|
|
1461
|
-
"MD": [
|
|
1462
|
-
"H",
|
|
1463
|
-
"hB"
|
|
1464
|
-
],
|
|
1465
|
-
"ME": [
|
|
1466
|
-
"H",
|
|
1467
|
-
"hB",
|
|
1468
|
-
"h"
|
|
1469
|
-
],
|
|
1470
|
-
"MF": [
|
|
1471
|
-
"H",
|
|
1472
|
-
"hB"
|
|
1473
|
-
],
|
|
1474
|
-
"MG": [
|
|
1475
|
-
"H",
|
|
1476
|
-
"h"
|
|
1477
|
-
],
|
|
1478
|
-
"MH": [
|
|
1479
|
-
"h",
|
|
1480
|
-
"hb",
|
|
1481
|
-
"H",
|
|
1482
|
-
"hB"
|
|
1483
|
-
],
|
|
1484
|
-
"MK": [
|
|
1485
|
-
"H",
|
|
1486
|
-
"h",
|
|
1487
|
-
"hb",
|
|
1488
|
-
"hB"
|
|
1489
|
-
],
|
|
1490
|
-
"ML": [
|
|
1491
|
-
"H"
|
|
1492
|
-
],
|
|
1493
|
-
"MM": [
|
|
1494
|
-
"hB",
|
|
1495
|
-
"hb",
|
|
1496
|
-
"H",
|
|
1497
|
-
"h"
|
|
1498
|
-
],
|
|
1499
|
-
"MN": [
|
|
1500
|
-
"H",
|
|
1501
|
-
"h",
|
|
1502
|
-
"hb",
|
|
1503
|
-
"hB"
|
|
1504
|
-
],
|
|
1505
|
-
"MO": [
|
|
1506
|
-
"h",
|
|
1507
|
-
"hB",
|
|
1508
|
-
"hb",
|
|
1509
|
-
"H"
|
|
1510
|
-
],
|
|
1511
|
-
"MP": [
|
|
1512
|
-
"h",
|
|
1513
|
-
"hb",
|
|
1514
|
-
"H",
|
|
1515
|
-
"hB"
|
|
1516
|
-
],
|
|
1517
|
-
"MQ": [
|
|
1518
|
-
"H",
|
|
1519
|
-
"hB"
|
|
1520
|
-
],
|
|
1521
|
-
"MR": [
|
|
1522
|
-
"h",
|
|
1523
|
-
"hB",
|
|
1524
|
-
"hb",
|
|
1525
|
-
"H"
|
|
1526
|
-
],
|
|
1527
|
-
"MS": [
|
|
1528
|
-
"H",
|
|
1529
|
-
"h",
|
|
1530
|
-
"hb",
|
|
1531
|
-
"hB"
|
|
1532
|
-
],
|
|
1533
|
-
"MT": [
|
|
1534
|
-
"H",
|
|
1535
|
-
"h"
|
|
1536
|
-
],
|
|
1537
|
-
"MU": [
|
|
1538
|
-
"H",
|
|
1539
|
-
"h"
|
|
1540
|
-
],
|
|
1541
|
-
"MV": [
|
|
1542
|
-
"H",
|
|
1543
|
-
"h"
|
|
1544
|
-
],
|
|
1545
|
-
"MW": [
|
|
1546
|
-
"h",
|
|
1547
|
-
"hb",
|
|
1548
|
-
"H",
|
|
1549
|
-
"hB"
|
|
1550
|
-
],
|
|
1551
|
-
"MX": [
|
|
1552
|
-
"h",
|
|
1553
|
-
"H",
|
|
1554
|
-
"hB",
|
|
1555
|
-
"hb"
|
|
1556
|
-
],
|
|
1557
|
-
"MY": [
|
|
1558
|
-
"hb",
|
|
1559
|
-
"hB",
|
|
1560
|
-
"h",
|
|
1561
|
-
"H"
|
|
1562
|
-
],
|
|
1563
|
-
"MZ": [
|
|
1564
|
-
"H",
|
|
1565
|
-
"hB"
|
|
1566
|
-
],
|
|
1567
|
-
"NA": [
|
|
1568
|
-
"h",
|
|
1569
|
-
"H",
|
|
1570
|
-
"hB",
|
|
1571
|
-
"hb"
|
|
1572
|
-
],
|
|
1573
|
-
"NC": [
|
|
1574
|
-
"H",
|
|
1575
|
-
"hB"
|
|
1576
|
-
],
|
|
1577
|
-
"NE": [
|
|
1578
|
-
"H"
|
|
1579
|
-
],
|
|
1580
|
-
"NF": [
|
|
1581
|
-
"H",
|
|
1582
|
-
"h",
|
|
1583
|
-
"hb",
|
|
1584
|
-
"hB"
|
|
1585
|
-
],
|
|
1586
|
-
"NG": [
|
|
1587
|
-
"H",
|
|
1588
|
-
"h",
|
|
1589
|
-
"hb",
|
|
1590
|
-
"hB"
|
|
1591
|
-
],
|
|
1592
|
-
"NI": [
|
|
1593
|
-
"h",
|
|
1594
|
-
"H",
|
|
1595
|
-
"hB",
|
|
1596
|
-
"hb"
|
|
1597
|
-
],
|
|
1598
|
-
"NL": [
|
|
1599
|
-
"H",
|
|
1600
|
-
"hB"
|
|
1601
|
-
],
|
|
1602
|
-
"NO": [
|
|
1603
|
-
"H",
|
|
1604
|
-
"h"
|
|
1605
|
-
],
|
|
1606
|
-
"NP": [
|
|
1607
|
-
"H",
|
|
1608
|
-
"h",
|
|
1609
|
-
"hB"
|
|
1610
|
-
],
|
|
1611
|
-
"NR": [
|
|
1612
|
-
"H",
|
|
1613
|
-
"h",
|
|
1614
|
-
"hb",
|
|
1615
|
-
"hB"
|
|
1616
|
-
],
|
|
1617
|
-
"NU": [
|
|
1618
|
-
"H",
|
|
1619
|
-
"h",
|
|
1620
|
-
"hb",
|
|
1621
|
-
"hB"
|
|
1622
|
-
],
|
|
1623
|
-
"NZ": [
|
|
1624
|
-
"h",
|
|
1625
|
-
"hb",
|
|
1626
|
-
"H",
|
|
1627
|
-
"hB"
|
|
1628
|
-
],
|
|
1629
|
-
"OM": [
|
|
1630
|
-
"h",
|
|
1631
|
-
"hB",
|
|
1632
|
-
"hb",
|
|
1633
|
-
"H"
|
|
1634
|
-
],
|
|
1635
|
-
"PA": [
|
|
1636
|
-
"h",
|
|
1637
|
-
"H",
|
|
1638
|
-
"hB",
|
|
1639
|
-
"hb"
|
|
1640
|
-
],
|
|
1641
|
-
"PE": [
|
|
1642
|
-
"h",
|
|
1643
|
-
"H",
|
|
1644
|
-
"hB",
|
|
1645
|
-
"hb"
|
|
1646
|
-
],
|
|
1647
|
-
"PF": [
|
|
1648
|
-
"H",
|
|
1649
|
-
"h",
|
|
1650
|
-
"hB"
|
|
1651
|
-
],
|
|
1652
|
-
"PG": [
|
|
1653
|
-
"h",
|
|
1654
|
-
"H"
|
|
1655
|
-
],
|
|
1656
|
-
"PH": [
|
|
1657
|
-
"h",
|
|
1658
|
-
"hB",
|
|
1659
|
-
"hb",
|
|
1660
|
-
"H"
|
|
1661
|
-
],
|
|
1662
|
-
"PK": [
|
|
1663
|
-
"h",
|
|
1664
|
-
"hB",
|
|
1665
|
-
"H"
|
|
1666
|
-
],
|
|
1667
|
-
"PL": [
|
|
1668
|
-
"H",
|
|
1669
|
-
"h"
|
|
1670
|
-
],
|
|
1671
|
-
"PM": [
|
|
1672
|
-
"H",
|
|
1673
|
-
"hB"
|
|
1674
|
-
],
|
|
1675
|
-
"PN": [
|
|
1676
|
-
"H",
|
|
1677
|
-
"h",
|
|
1678
|
-
"hb",
|
|
1679
|
-
"hB"
|
|
1680
|
-
],
|
|
1681
|
-
"PR": [
|
|
1682
|
-
"h",
|
|
1683
|
-
"H",
|
|
1684
|
-
"hB",
|
|
1685
|
-
"hb"
|
|
1686
|
-
],
|
|
1687
|
-
"PS": [
|
|
1688
|
-
"h",
|
|
1689
|
-
"hB",
|
|
1690
|
-
"hb",
|
|
1691
|
-
"H"
|
|
1692
|
-
],
|
|
1693
|
-
"PT": [
|
|
1694
|
-
"H",
|
|
1695
|
-
"hB"
|
|
1696
|
-
],
|
|
1697
|
-
"PW": [
|
|
1698
|
-
"h",
|
|
1699
|
-
"H"
|
|
1700
|
-
],
|
|
1701
|
-
"PY": [
|
|
1702
|
-
"h",
|
|
1703
|
-
"H",
|
|
1704
|
-
"hB",
|
|
1705
|
-
"hb"
|
|
1706
|
-
],
|
|
1707
|
-
"QA": [
|
|
1708
|
-
"h",
|
|
1709
|
-
"hB",
|
|
1710
|
-
"hb",
|
|
1711
|
-
"H"
|
|
1712
|
-
],
|
|
1713
|
-
"RE": [
|
|
1714
|
-
"H",
|
|
1715
|
-
"hB"
|
|
1716
|
-
],
|
|
1717
|
-
"RO": [
|
|
1718
|
-
"H",
|
|
1719
|
-
"hB"
|
|
1720
|
-
],
|
|
1721
|
-
"RS": [
|
|
1722
|
-
"H",
|
|
1723
|
-
"hB",
|
|
1724
|
-
"h"
|
|
1725
|
-
],
|
|
1726
|
-
"RU": [
|
|
1727
|
-
"H"
|
|
1728
|
-
],
|
|
1729
|
-
"RW": [
|
|
1730
|
-
"H",
|
|
1731
|
-
"h"
|
|
1732
|
-
],
|
|
1733
|
-
"SA": [
|
|
1734
|
-
"h",
|
|
1735
|
-
"hB",
|
|
1736
|
-
"hb",
|
|
1737
|
-
"H"
|
|
1738
|
-
],
|
|
1739
|
-
"SB": [
|
|
1740
|
-
"h",
|
|
1741
|
-
"hb",
|
|
1742
|
-
"H",
|
|
1743
|
-
"hB"
|
|
1744
|
-
],
|
|
1745
|
-
"SC": [
|
|
1746
|
-
"H",
|
|
1747
|
-
"h",
|
|
1748
|
-
"hB"
|
|
1749
|
-
],
|
|
1750
|
-
"SD": [
|
|
1751
|
-
"h",
|
|
1752
|
-
"hB",
|
|
1753
|
-
"hb",
|
|
1754
|
-
"H"
|
|
1755
|
-
],
|
|
1756
|
-
"SE": [
|
|
1757
|
-
"H"
|
|
1758
|
-
],
|
|
1759
|
-
"SG": [
|
|
1760
|
-
"h",
|
|
1761
|
-
"hb",
|
|
1762
|
-
"H",
|
|
1763
|
-
"hB"
|
|
1764
|
-
],
|
|
1765
|
-
"SH": [
|
|
1766
|
-
"H",
|
|
1767
|
-
"h",
|
|
1768
|
-
"hb",
|
|
1769
|
-
"hB"
|
|
1770
|
-
],
|
|
1771
|
-
"SI": [
|
|
1772
|
-
"H",
|
|
1773
|
-
"hB"
|
|
1774
|
-
],
|
|
1775
|
-
"SJ": [
|
|
1776
|
-
"H"
|
|
1777
|
-
],
|
|
1778
|
-
"SK": [
|
|
1779
|
-
"H"
|
|
1780
|
-
],
|
|
1781
|
-
"SL": [
|
|
1782
|
-
"h",
|
|
1783
|
-
"hb",
|
|
1784
|
-
"H",
|
|
1785
|
-
"hB"
|
|
1786
|
-
],
|
|
1787
|
-
"SM": [
|
|
1788
|
-
"H",
|
|
1789
|
-
"h",
|
|
1790
|
-
"hB"
|
|
1791
|
-
],
|
|
1792
|
-
"SN": [
|
|
1793
|
-
"H",
|
|
1794
|
-
"h",
|
|
1795
|
-
"hB"
|
|
1796
|
-
],
|
|
1797
|
-
"SO": [
|
|
1798
|
-
"h",
|
|
1799
|
-
"H"
|
|
1800
|
-
],
|
|
1801
|
-
"SR": [
|
|
1802
|
-
"H",
|
|
1803
|
-
"hB"
|
|
1804
|
-
],
|
|
1805
|
-
"SS": [
|
|
1806
|
-
"h",
|
|
1807
|
-
"hb",
|
|
1808
|
-
"H",
|
|
1809
|
-
"hB"
|
|
1810
|
-
],
|
|
1811
|
-
"ST": [
|
|
1812
|
-
"H",
|
|
1813
|
-
"hB"
|
|
1814
|
-
],
|
|
1815
|
-
"SV": [
|
|
1816
|
-
"h",
|
|
1817
|
-
"H",
|
|
1818
|
-
"hB",
|
|
1819
|
-
"hb"
|
|
1820
|
-
],
|
|
1821
|
-
"SX": [
|
|
1822
|
-
"H",
|
|
1823
|
-
"h",
|
|
1824
|
-
"hb",
|
|
1825
|
-
"hB"
|
|
1826
|
-
],
|
|
1827
|
-
"SY": [
|
|
1828
|
-
"h",
|
|
1829
|
-
"hB",
|
|
1830
|
-
"hb",
|
|
1831
|
-
"H"
|
|
1832
|
-
],
|
|
1833
|
-
"SZ": [
|
|
1834
|
-
"h",
|
|
1835
|
-
"hb",
|
|
1836
|
-
"H",
|
|
1837
|
-
"hB"
|
|
1838
|
-
],
|
|
1839
|
-
"TA": [
|
|
1840
|
-
"H",
|
|
1841
|
-
"h",
|
|
1842
|
-
"hb",
|
|
1843
|
-
"hB"
|
|
1844
|
-
],
|
|
1845
|
-
"TC": [
|
|
1846
|
-
"h",
|
|
1847
|
-
"hb",
|
|
1848
|
-
"H",
|
|
1849
|
-
"hB"
|
|
1850
|
-
],
|
|
1851
|
-
"TD": [
|
|
1852
|
-
"h",
|
|
1853
|
-
"H",
|
|
1854
|
-
"hB"
|
|
1855
|
-
],
|
|
1856
|
-
"TF": [
|
|
1857
|
-
"H",
|
|
1858
|
-
"h",
|
|
1859
|
-
"hB"
|
|
1860
|
-
],
|
|
1861
|
-
"TG": [
|
|
1862
|
-
"H",
|
|
1863
|
-
"hB"
|
|
1864
|
-
],
|
|
1865
|
-
"TH": [
|
|
1866
|
-
"H",
|
|
1867
|
-
"h"
|
|
1868
|
-
],
|
|
1869
|
-
"TJ": [
|
|
1870
|
-
"H",
|
|
1871
|
-
"h"
|
|
1872
|
-
],
|
|
1873
|
-
"TL": [
|
|
1874
|
-
"H",
|
|
1875
|
-
"hB",
|
|
1876
|
-
"hb",
|
|
1877
|
-
"h"
|
|
1878
|
-
],
|
|
1879
|
-
"TM": [
|
|
1880
|
-
"H",
|
|
1881
|
-
"h"
|
|
1882
|
-
],
|
|
1883
|
-
"TN": [
|
|
1884
|
-
"h",
|
|
1885
|
-
"hB",
|
|
1886
|
-
"hb",
|
|
1887
|
-
"H"
|
|
1888
|
-
],
|
|
1889
|
-
"TO": [
|
|
1890
|
-
"h",
|
|
1891
|
-
"H"
|
|
1892
|
-
],
|
|
1893
|
-
"TR": [
|
|
1894
|
-
"H",
|
|
1895
|
-
"hB"
|
|
1896
|
-
],
|
|
1897
|
-
"TT": [
|
|
1898
|
-
"h",
|
|
1899
|
-
"hb",
|
|
1900
|
-
"H",
|
|
1901
|
-
"hB"
|
|
1902
|
-
],
|
|
1903
|
-
"TW": [
|
|
1904
|
-
"hB",
|
|
1905
|
-
"hb",
|
|
1906
|
-
"h",
|
|
1907
|
-
"H"
|
|
1908
|
-
],
|
|
1909
|
-
"TZ": [
|
|
1910
|
-
"hB",
|
|
1911
|
-
"hb",
|
|
1912
|
-
"H",
|
|
1913
|
-
"h"
|
|
1914
|
-
],
|
|
1915
|
-
"UA": [
|
|
1916
|
-
"H",
|
|
1917
|
-
"hB",
|
|
1918
|
-
"h"
|
|
1919
|
-
],
|
|
1920
|
-
"UG": [
|
|
1921
|
-
"hB",
|
|
1922
|
-
"hb",
|
|
1923
|
-
"H",
|
|
1924
|
-
"h"
|
|
1925
|
-
],
|
|
1926
|
-
"UM": [
|
|
1927
|
-
"h",
|
|
1928
|
-
"hb",
|
|
1929
|
-
"H",
|
|
1930
|
-
"hB"
|
|
1931
|
-
],
|
|
1932
|
-
"US": [
|
|
1933
|
-
"h",
|
|
1934
|
-
"hb",
|
|
1935
|
-
"H",
|
|
1936
|
-
"hB"
|
|
1937
|
-
],
|
|
1938
|
-
"UY": [
|
|
1939
|
-
"h",
|
|
1940
|
-
"H",
|
|
1941
|
-
"hB",
|
|
1942
|
-
"hb"
|
|
1943
|
-
],
|
|
1944
|
-
"UZ": [
|
|
1945
|
-
"H",
|
|
1946
|
-
"hB",
|
|
1947
|
-
"h"
|
|
1948
|
-
],
|
|
1949
|
-
"VA": [
|
|
1950
|
-
"H",
|
|
1951
|
-
"h",
|
|
1952
|
-
"hB"
|
|
1953
|
-
],
|
|
1954
|
-
"VC": [
|
|
1955
|
-
"h",
|
|
1956
|
-
"hb",
|
|
1957
|
-
"H",
|
|
1958
|
-
"hB"
|
|
1959
|
-
],
|
|
1960
|
-
"VE": [
|
|
1961
|
-
"h",
|
|
1962
|
-
"H",
|
|
1963
|
-
"hB",
|
|
1964
|
-
"hb"
|
|
1965
|
-
],
|
|
1966
|
-
"VG": [
|
|
1967
|
-
"h",
|
|
1968
|
-
"hb",
|
|
1969
|
-
"H",
|
|
1970
|
-
"hB"
|
|
1971
|
-
],
|
|
1972
|
-
"VI": [
|
|
1973
|
-
"h",
|
|
1974
|
-
"hb",
|
|
1975
|
-
"H",
|
|
1976
|
-
"hB"
|
|
1977
|
-
],
|
|
1978
|
-
"VN": [
|
|
1979
|
-
"H",
|
|
1980
|
-
"h"
|
|
1981
|
-
],
|
|
1982
|
-
"VU": [
|
|
1983
|
-
"h",
|
|
1984
|
-
"H"
|
|
1985
|
-
],
|
|
1986
|
-
"WF": [
|
|
1987
|
-
"H",
|
|
1988
|
-
"hB"
|
|
1989
|
-
],
|
|
1990
|
-
"WS": [
|
|
1991
|
-
"h",
|
|
1992
|
-
"H"
|
|
1993
|
-
],
|
|
1994
|
-
"XK": [
|
|
1995
|
-
"H",
|
|
1996
|
-
"hB",
|
|
1997
|
-
"h"
|
|
1998
|
-
],
|
|
1999
|
-
"YE": [
|
|
2000
|
-
"h",
|
|
2001
|
-
"hB",
|
|
2002
|
-
"hb",
|
|
2003
|
-
"H"
|
|
2004
|
-
],
|
|
2005
|
-
"YT": [
|
|
2006
|
-
"H",
|
|
2007
|
-
"hB"
|
|
2008
|
-
],
|
|
2009
|
-
"ZA": [
|
|
2010
|
-
"H",
|
|
2011
|
-
"h",
|
|
2012
|
-
"hb",
|
|
2013
|
-
"hB"
|
|
2014
|
-
],
|
|
2015
|
-
"ZM": [
|
|
2016
|
-
"h",
|
|
2017
|
-
"hb",
|
|
2018
|
-
"H",
|
|
2019
|
-
"hB"
|
|
2020
|
-
],
|
|
2021
|
-
"ZW": [
|
|
2022
|
-
"H",
|
|
2023
|
-
"h"
|
|
2024
|
-
],
|
|
2025
|
-
"af-ZA": [
|
|
2026
|
-
"H",
|
|
2027
|
-
"h",
|
|
2028
|
-
"hB",
|
|
2029
|
-
"hb"
|
|
2030
|
-
],
|
|
2031
|
-
"ar-001": [
|
|
2032
|
-
"h",
|
|
2033
|
-
"hB",
|
|
2034
|
-
"hb",
|
|
2035
|
-
"H"
|
|
2036
|
-
],
|
|
2037
|
-
"ca-ES": [
|
|
2038
|
-
"H",
|
|
2039
|
-
"h",
|
|
2040
|
-
"hB"
|
|
2041
|
-
],
|
|
2042
|
-
"en-001": [
|
|
2043
|
-
"h",
|
|
2044
|
-
"hb",
|
|
2045
|
-
"H",
|
|
2046
|
-
"hB"
|
|
2047
|
-
],
|
|
2048
|
-
"en-HK": [
|
|
2049
|
-
"h",
|
|
2050
|
-
"hb",
|
|
2051
|
-
"H",
|
|
2052
|
-
"hB"
|
|
2053
|
-
],
|
|
2054
|
-
"en-IL": [
|
|
2055
|
-
"H",
|
|
2056
|
-
"h",
|
|
2057
|
-
"hb",
|
|
2058
|
-
"hB"
|
|
2059
|
-
],
|
|
2060
|
-
"en-MY": [
|
|
2061
|
-
"h",
|
|
2062
|
-
"hb",
|
|
2063
|
-
"H",
|
|
2064
|
-
"hB"
|
|
2065
|
-
],
|
|
2066
|
-
"es-BR": [
|
|
2067
|
-
"H",
|
|
2068
|
-
"h",
|
|
2069
|
-
"hB",
|
|
2070
|
-
"hb"
|
|
2071
|
-
],
|
|
2072
|
-
"es-ES": [
|
|
2073
|
-
"H",
|
|
2074
|
-
"h",
|
|
2075
|
-
"hB",
|
|
2076
|
-
"hb"
|
|
2077
|
-
],
|
|
2078
|
-
"es-GQ": [
|
|
2079
|
-
"H",
|
|
2080
|
-
"h",
|
|
2081
|
-
"hB",
|
|
2082
|
-
"hb"
|
|
2083
|
-
],
|
|
2084
|
-
"fr-CA": [
|
|
2085
|
-
"H",
|
|
2086
|
-
"h",
|
|
2087
|
-
"hB"
|
|
2088
|
-
],
|
|
2089
|
-
"gl-ES": [
|
|
2090
|
-
"H",
|
|
2091
|
-
"h",
|
|
2092
|
-
"hB"
|
|
2093
|
-
],
|
|
2094
|
-
"gu-IN": [
|
|
2095
|
-
"hB",
|
|
2096
|
-
"hb",
|
|
2097
|
-
"h",
|
|
2098
|
-
"H"
|
|
2099
|
-
],
|
|
2100
|
-
"hi-IN": [
|
|
2101
|
-
"hB",
|
|
2102
|
-
"h",
|
|
2103
|
-
"H"
|
|
2104
|
-
],
|
|
2105
|
-
"it-CH": [
|
|
2106
|
-
"H",
|
|
2107
|
-
"h",
|
|
2108
|
-
"hB"
|
|
2109
|
-
],
|
|
2110
|
-
"it-IT": [
|
|
2111
|
-
"H",
|
|
2112
|
-
"h",
|
|
2113
|
-
"hB"
|
|
2114
|
-
],
|
|
2115
|
-
"kn-IN": [
|
|
2116
|
-
"hB",
|
|
2117
|
-
"h",
|
|
2118
|
-
"H"
|
|
2119
|
-
],
|
|
2120
|
-
"ml-IN": [
|
|
2121
|
-
"hB",
|
|
2122
|
-
"h",
|
|
2123
|
-
"H"
|
|
2124
|
-
],
|
|
2125
|
-
"mr-IN": [
|
|
2126
|
-
"hB",
|
|
2127
|
-
"hb",
|
|
2128
|
-
"h",
|
|
2129
|
-
"H"
|
|
2130
|
-
],
|
|
2131
|
-
"pa-IN": [
|
|
2132
|
-
"hB",
|
|
2133
|
-
"hb",
|
|
2134
|
-
"h",
|
|
2135
|
-
"H"
|
|
2136
|
-
],
|
|
2137
|
-
"ta-IN": [
|
|
2138
|
-
"hB",
|
|
2139
|
-
"h",
|
|
2140
|
-
"hb",
|
|
2141
|
-
"H"
|
|
2142
|
-
],
|
|
2143
|
-
"te-IN": [
|
|
2144
|
-
"hB",
|
|
2145
|
-
"h",
|
|
2146
|
-
"H"
|
|
2147
|
-
],
|
|
2148
|
-
"zu-ZA": [
|
|
2149
|
-
"H",
|
|
2150
|
-
"hB",
|
|
2151
|
-
"hb",
|
|
2152
|
-
"h"
|
|
2153
|
-
]
|
|
2154
|
-
};
|
|
2155
|
-
|
|
2156
|
-
/**
|
|
2157
|
-
* Returns the best matching date time pattern if a date time skeleton
|
|
2158
|
-
* pattern is provided with a locale. Follows the Unicode specification:
|
|
2159
|
-
* https://www.unicode.org/reports/tr35/tr35-dates.html#table-mapping-requested-time-skeletons-to-patterns
|
|
2160
|
-
* @param skeleton date time skeleton pattern that possibly includes j, J or C
|
|
2161
|
-
* @param locale
|
|
2162
|
-
*/
|
|
2163
|
-
function getBestPattern(skeleton, locale) {
|
|
2164
|
-
var skeletonCopy = '';
|
|
2165
|
-
for (var patternPos = 0; patternPos < skeleton.length; patternPos++) {
|
|
2166
|
-
var patternChar = skeleton.charAt(patternPos);
|
|
2167
|
-
if (patternChar === 'j') {
|
|
2168
|
-
var extraLength = 0;
|
|
2169
|
-
while (patternPos + 1 < skeleton.length &&
|
|
2170
|
-
skeleton.charAt(patternPos + 1) === patternChar) {
|
|
2171
|
-
extraLength++;
|
|
2172
|
-
patternPos++;
|
|
2173
|
-
}
|
|
2174
|
-
var hourLen = 1 + (extraLength & 1);
|
|
2175
|
-
var dayPeriodLen = extraLength < 2 ? 1 : 3 + (extraLength >> 1);
|
|
2176
|
-
var dayPeriodChar = 'a';
|
|
2177
|
-
var hourChar = getDefaultHourSymbolFromLocale(locale);
|
|
2178
|
-
if (hourChar == 'H' || hourChar == 'k') {
|
|
2179
|
-
dayPeriodLen = 0;
|
|
2180
|
-
}
|
|
2181
|
-
while (dayPeriodLen-- > 0) {
|
|
2182
|
-
skeletonCopy += dayPeriodChar;
|
|
2183
|
-
}
|
|
2184
|
-
while (hourLen-- > 0) {
|
|
2185
|
-
skeletonCopy = hourChar + skeletonCopy;
|
|
2186
|
-
}
|
|
2187
|
-
}
|
|
2188
|
-
else if (patternChar === 'J') {
|
|
2189
|
-
skeletonCopy += 'H';
|
|
2190
|
-
}
|
|
2191
|
-
else {
|
|
2192
|
-
skeletonCopy += patternChar;
|
|
2193
|
-
}
|
|
2194
|
-
}
|
|
2195
|
-
return skeletonCopy;
|
|
2196
|
-
}
|
|
2197
|
-
/**
|
|
2198
|
-
* Maps the [hour cycle type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/hourCycle)
|
|
2199
|
-
* of the given `locale` to the corresponding time pattern.
|
|
2200
|
-
* @param locale
|
|
2201
|
-
*/
|
|
2202
|
-
function getDefaultHourSymbolFromLocale(locale) {
|
|
2203
|
-
var hourCycle = locale.hourCycle;
|
|
2204
|
-
if (hourCycle === undefined &&
|
|
2205
|
-
// @ts-ignore hourCycle(s) is not identified yet
|
|
2206
|
-
locale.hourCycles &&
|
|
2207
|
-
// @ts-ignore
|
|
2208
|
-
locale.hourCycles.length) {
|
|
2209
|
-
// @ts-ignore
|
|
2210
|
-
hourCycle = locale.hourCycles[0];
|
|
2211
|
-
}
|
|
2212
|
-
if (hourCycle) {
|
|
2213
|
-
switch (hourCycle) {
|
|
2214
|
-
case 'h24':
|
|
2215
|
-
return 'k';
|
|
2216
|
-
case 'h23':
|
|
2217
|
-
return 'H';
|
|
2218
|
-
case 'h12':
|
|
2219
|
-
return 'h';
|
|
2220
|
-
case 'h11':
|
|
2221
|
-
return 'K';
|
|
2222
|
-
default:
|
|
2223
|
-
throw new Error('Invalid hourCycle');
|
|
2224
|
-
}
|
|
2225
|
-
}
|
|
2226
|
-
// TODO: Once hourCycle is fully supported remove the following with data generation
|
|
2227
|
-
var languageTag = locale.language;
|
|
2228
|
-
var regionTag;
|
|
2229
|
-
if (languageTag !== 'root') {
|
|
2230
|
-
regionTag = locale.maximize().region;
|
|
2231
|
-
}
|
|
2232
|
-
var hourCycles = timeData[regionTag || ''] ||
|
|
2233
|
-
timeData[languageTag || ''] ||
|
|
2234
|
-
timeData["".concat(languageTag, "-001")] ||
|
|
2235
|
-
timeData['001'];
|
|
2236
|
-
return hourCycles[0];
|
|
2237
|
-
}
|
|
2238
|
-
|
|
2239
|
-
var _a;
|
|
2240
|
-
var SPACE_SEPARATOR_START_REGEX = new RegExp("^".concat(SPACE_SEPARATOR_REGEX.source, "*"));
|
|
2241
|
-
var SPACE_SEPARATOR_END_REGEX = new RegExp("".concat(SPACE_SEPARATOR_REGEX.source, "*$"));
|
|
2242
|
-
function createLocation(start, end) {
|
|
2243
|
-
return { start: start, end: end };
|
|
2244
|
-
}
|
|
2245
|
-
// #region Ponyfills
|
|
2246
|
-
// Consolidate these variables up top for easier toggling during debugging
|
|
2247
|
-
var hasNativeStartsWith = !!String.prototype.startsWith && '_a'.startsWith('a', 1);
|
|
2248
|
-
var hasNativeFromCodePoint = !!String.fromCodePoint;
|
|
2249
|
-
var hasNativeFromEntries = !!Object.fromEntries;
|
|
2250
|
-
var hasNativeCodePointAt = !!String.prototype.codePointAt;
|
|
2251
|
-
var hasTrimStart = !!String.prototype.trimStart;
|
|
2252
|
-
var hasTrimEnd = !!String.prototype.trimEnd;
|
|
2253
|
-
var hasNativeIsSafeInteger = !!Number.isSafeInteger;
|
|
2254
|
-
var isSafeInteger = hasNativeIsSafeInteger
|
|
2255
|
-
? Number.isSafeInteger
|
|
2256
|
-
: function (n) {
|
|
2257
|
-
return (typeof n === 'number' &&
|
|
2258
|
-
isFinite(n) &&
|
|
2259
|
-
Math.floor(n) === n &&
|
|
2260
|
-
Math.abs(n) <= 0x1fffffffffffff);
|
|
2261
|
-
};
|
|
2262
|
-
// IE11 does not support y and u.
|
|
2263
|
-
var REGEX_SUPPORTS_U_AND_Y = true;
|
|
2264
|
-
try {
|
|
2265
|
-
var re = RE('([^\\p{White_Space}\\p{Pattern_Syntax}]*)', 'yu');
|
|
2266
|
-
/**
|
|
2267
|
-
* legacy Edge or Xbox One browser
|
|
2268
|
-
* Unicode flag support: supported
|
|
2269
|
-
* Pattern_Syntax support: not supported
|
|
2270
|
-
* See https://github.com/formatjs/formatjs/issues/2822
|
|
2271
|
-
*/
|
|
2272
|
-
REGEX_SUPPORTS_U_AND_Y = ((_a = re.exec('a')) === null || _a === void 0 ? void 0 : _a[0]) === 'a';
|
|
2273
|
-
}
|
|
2274
|
-
catch (_) {
|
|
2275
|
-
REGEX_SUPPORTS_U_AND_Y = false;
|
|
2276
|
-
}
|
|
2277
|
-
var startsWith = hasNativeStartsWith
|
|
2278
|
-
? // Native
|
|
2279
|
-
function startsWith(s, search, position) {
|
|
2280
|
-
return s.startsWith(search, position);
|
|
2281
|
-
}
|
|
2282
|
-
: // For IE11
|
|
2283
|
-
function startsWith(s, search, position) {
|
|
2284
|
-
return s.slice(position, position + search.length) === search;
|
|
2285
|
-
};
|
|
2286
|
-
var fromCodePoint = hasNativeFromCodePoint
|
|
2287
|
-
? String.fromCodePoint
|
|
2288
|
-
: // IE11
|
|
2289
|
-
function fromCodePoint() {
|
|
2290
|
-
var codePoints = [];
|
|
2291
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2292
|
-
codePoints[_i] = arguments[_i];
|
|
2293
|
-
}
|
|
2294
|
-
var elements = '';
|
|
2295
|
-
var length = codePoints.length;
|
|
2296
|
-
var i = 0;
|
|
2297
|
-
var code;
|
|
2298
|
-
while (length > i) {
|
|
2299
|
-
code = codePoints[i++];
|
|
2300
|
-
if (code > 0x10ffff)
|
|
2301
|
-
throw RangeError(code + ' is not a valid code point');
|
|
2302
|
-
elements +=
|
|
2303
|
-
code < 0x10000
|
|
2304
|
-
? String.fromCharCode(code)
|
|
2305
|
-
: String.fromCharCode(((code -= 0x10000) >> 10) + 0xd800, (code % 0x400) + 0xdc00);
|
|
2306
|
-
}
|
|
2307
|
-
return elements;
|
|
2308
|
-
};
|
|
2309
|
-
var fromEntries =
|
|
2310
|
-
// native
|
|
2311
|
-
hasNativeFromEntries
|
|
2312
|
-
? Object.fromEntries
|
|
2313
|
-
: // Ponyfill
|
|
2314
|
-
function fromEntries(entries) {
|
|
2315
|
-
var obj = {};
|
|
2316
|
-
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
2317
|
-
var _a = entries_1[_i], k = _a[0], v = _a[1];
|
|
2318
|
-
obj[k] = v;
|
|
2319
|
-
}
|
|
2320
|
-
return obj;
|
|
2321
|
-
};
|
|
2322
|
-
var codePointAt = hasNativeCodePointAt
|
|
2323
|
-
? // Native
|
|
2324
|
-
function codePointAt(s, index) {
|
|
2325
|
-
return s.codePointAt(index);
|
|
2326
|
-
}
|
|
2327
|
-
: // IE 11
|
|
2328
|
-
function codePointAt(s, index) {
|
|
2329
|
-
var size = s.length;
|
|
2330
|
-
if (index < 0 || index >= size) {
|
|
2331
|
-
return undefined;
|
|
2332
|
-
}
|
|
2333
|
-
var first = s.charCodeAt(index);
|
|
2334
|
-
var second;
|
|
2335
|
-
return first < 0xd800 ||
|
|
2336
|
-
first > 0xdbff ||
|
|
2337
|
-
index + 1 === size ||
|
|
2338
|
-
(second = s.charCodeAt(index + 1)) < 0xdc00 ||
|
|
2339
|
-
second > 0xdfff
|
|
2340
|
-
? first
|
|
2341
|
-
: ((first - 0xd800) << 10) + (second - 0xdc00) + 0x10000;
|
|
2342
|
-
};
|
|
2343
|
-
var trimStart = hasTrimStart
|
|
2344
|
-
? // Native
|
|
2345
|
-
function trimStart(s) {
|
|
2346
|
-
return s.trimStart();
|
|
2347
|
-
}
|
|
2348
|
-
: // Ponyfill
|
|
2349
|
-
function trimStart(s) {
|
|
2350
|
-
return s.replace(SPACE_SEPARATOR_START_REGEX, '');
|
|
2351
|
-
};
|
|
2352
|
-
var trimEnd = hasTrimEnd
|
|
2353
|
-
? // Native
|
|
2354
|
-
function trimEnd(s) {
|
|
2355
|
-
return s.trimEnd();
|
|
2356
|
-
}
|
|
2357
|
-
: // Ponyfill
|
|
2358
|
-
function trimEnd(s) {
|
|
2359
|
-
return s.replace(SPACE_SEPARATOR_END_REGEX, '');
|
|
2360
|
-
};
|
|
2361
|
-
// Prevent minifier to translate new RegExp to literal form that might cause syntax error on IE11.
|
|
2362
|
-
function RE(s, flag) {
|
|
2363
|
-
return new RegExp(s, flag);
|
|
2364
|
-
}
|
|
2365
|
-
// #endregion
|
|
2366
|
-
var matchIdentifierAtIndex;
|
|
2367
|
-
if (REGEX_SUPPORTS_U_AND_Y) {
|
|
2368
|
-
// Native
|
|
2369
|
-
var IDENTIFIER_PREFIX_RE_1 = RE('([^\\p{White_Space}\\p{Pattern_Syntax}]*)', 'yu');
|
|
2370
|
-
matchIdentifierAtIndex = function matchIdentifierAtIndex(s, index) {
|
|
2371
|
-
var _a;
|
|
2372
|
-
IDENTIFIER_PREFIX_RE_1.lastIndex = index;
|
|
2373
|
-
var match = IDENTIFIER_PREFIX_RE_1.exec(s);
|
|
2374
|
-
return (_a = match[1]) !== null && _a !== void 0 ? _a : '';
|
|
2375
|
-
};
|
|
2376
|
-
}
|
|
2377
|
-
else {
|
|
2378
|
-
// IE11
|
|
2379
|
-
matchIdentifierAtIndex = function matchIdentifierAtIndex(s, index) {
|
|
2380
|
-
var match = [];
|
|
2381
|
-
while (true) {
|
|
2382
|
-
var c = codePointAt(s, index);
|
|
2383
|
-
if (c === undefined || _isWhiteSpace(c) || _isPatternSyntax(c)) {
|
|
2384
|
-
break;
|
|
2385
|
-
}
|
|
2386
|
-
match.push(c);
|
|
2387
|
-
index += c >= 0x10000 ? 2 : 1;
|
|
2388
|
-
}
|
|
2389
|
-
return fromCodePoint.apply(void 0, match);
|
|
2390
|
-
};
|
|
2391
|
-
}
|
|
2392
|
-
var Parser = /** @class */ (function () {
|
|
2393
|
-
function Parser(message, options) {
|
|
2394
|
-
if (options === void 0) { options = {}; }
|
|
2395
|
-
this.message = message;
|
|
2396
|
-
this.position = { offset: 0, line: 1, column: 1 };
|
|
2397
|
-
this.ignoreTag = !!options.ignoreTag;
|
|
2398
|
-
this.locale = options.locale;
|
|
2399
|
-
this.requiresOtherClause = !!options.requiresOtherClause;
|
|
2400
|
-
this.shouldParseSkeletons = !!options.shouldParseSkeletons;
|
|
2401
|
-
}
|
|
2402
|
-
Parser.prototype.parse = function () {
|
|
2403
|
-
if (this.offset() !== 0) {
|
|
2404
|
-
throw Error('parser can only be used once');
|
|
2405
|
-
}
|
|
2406
|
-
return this.parseMessage(0, '', false);
|
|
2407
|
-
};
|
|
2408
|
-
Parser.prototype.parseMessage = function (nestingLevel, parentArgType, expectingCloseTag) {
|
|
2409
|
-
var elements = [];
|
|
2410
|
-
while (!this.isEOF()) {
|
|
2411
|
-
var char = this.char();
|
|
2412
|
-
if (char === 123 /* `{` */) {
|
|
2413
|
-
var result = this.parseArgument(nestingLevel, expectingCloseTag);
|
|
2414
|
-
if (result.err) {
|
|
2415
|
-
return result;
|
|
2416
|
-
}
|
|
2417
|
-
elements.push(result.val);
|
|
2418
|
-
}
|
|
2419
|
-
else if (char === 125 /* `}` */ && nestingLevel > 0) {
|
|
2420
|
-
break;
|
|
2421
|
-
}
|
|
2422
|
-
else if (char === 35 /* `#` */ &&
|
|
2423
|
-
(parentArgType === 'plural' || parentArgType === 'selectordinal')) {
|
|
2424
|
-
var position = this.clonePosition();
|
|
2425
|
-
this.bump();
|
|
2426
|
-
elements.push({
|
|
2427
|
-
type: TYPE.pound,
|
|
2428
|
-
location: createLocation(position, this.clonePosition()),
|
|
2429
|
-
});
|
|
2430
|
-
}
|
|
2431
|
-
else if (char === 60 /* `<` */ &&
|
|
2432
|
-
!this.ignoreTag &&
|
|
2433
|
-
this.peek() === 47 // char code for '/'
|
|
2434
|
-
) {
|
|
2435
|
-
if (expectingCloseTag) {
|
|
2436
|
-
break;
|
|
2437
|
-
}
|
|
2438
|
-
else {
|
|
2439
|
-
return this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(this.clonePosition(), this.clonePosition()));
|
|
2440
|
-
}
|
|
2441
|
-
}
|
|
2442
|
-
else if (char === 60 /* `<` */ &&
|
|
2443
|
-
!this.ignoreTag &&
|
|
2444
|
-
_isAlpha(this.peek() || 0)) {
|
|
2445
|
-
var result = this.parseTag(nestingLevel, parentArgType);
|
|
2446
|
-
if (result.err) {
|
|
2447
|
-
return result;
|
|
2448
|
-
}
|
|
2449
|
-
elements.push(result.val);
|
|
2450
|
-
}
|
|
2451
|
-
else {
|
|
2452
|
-
var result = this.parseLiteral(nestingLevel, parentArgType);
|
|
2453
|
-
if (result.err) {
|
|
2454
|
-
return result;
|
|
2455
|
-
}
|
|
2456
|
-
elements.push(result.val);
|
|
2457
|
-
}
|
|
2458
|
-
}
|
|
2459
|
-
return { val: elements, err: null };
|
|
2460
|
-
};
|
|
2461
|
-
/**
|
|
2462
|
-
* A tag name must start with an ASCII lower/upper case letter. The grammar is based on the
|
|
2463
|
-
* [custom element name][] except that a dash is NOT always mandatory and uppercase letters
|
|
2464
|
-
* are accepted:
|
|
2465
|
-
*
|
|
2466
|
-
* ```
|
|
2467
|
-
* tag ::= "<" tagName (whitespace)* "/>" | "<" tagName (whitespace)* ">" message "</" tagName (whitespace)* ">"
|
|
2468
|
-
* tagName ::= [a-z] (PENChar)*
|
|
2469
|
-
* PENChar ::=
|
|
2470
|
-
* "-" | "." | [0-9] | "_" | [a-z] | [A-Z] | #xB7 | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x37D] |
|
|
2471
|
-
* [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] |
|
|
2472
|
-
* [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
|
|
2473
|
-
* ```
|
|
2474
|
-
*
|
|
2475
|
-
* [custom element name]: https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
|
|
2476
|
-
* NOTE: We're a bit more lax here since HTML technically does not allow uppercase HTML element but we do
|
|
2477
|
-
* since other tag-based engines like React allow it
|
|
2478
|
-
*/
|
|
2479
|
-
Parser.prototype.parseTag = function (nestingLevel, parentArgType) {
|
|
2480
|
-
var startPosition = this.clonePosition();
|
|
2481
|
-
this.bump(); // `<`
|
|
2482
|
-
var tagName = this.parseTagName();
|
|
2483
|
-
this.bumpSpace();
|
|
2484
|
-
if (this.bumpIf('/>')) {
|
|
2485
|
-
// Self closing tag
|
|
2486
|
-
return {
|
|
2487
|
-
val: {
|
|
2488
|
-
type: TYPE.literal,
|
|
2489
|
-
value: "<".concat(tagName, "/>"),
|
|
2490
|
-
location: createLocation(startPosition, this.clonePosition()),
|
|
2491
|
-
},
|
|
2492
|
-
err: null,
|
|
2493
|
-
};
|
|
2494
|
-
}
|
|
2495
|
-
else if (this.bumpIf('>')) {
|
|
2496
|
-
var childrenResult = this.parseMessage(nestingLevel + 1, parentArgType, true);
|
|
2497
|
-
if (childrenResult.err) {
|
|
2498
|
-
return childrenResult;
|
|
2499
|
-
}
|
|
2500
|
-
var children = childrenResult.val;
|
|
2501
|
-
// Expecting a close tag
|
|
2502
|
-
var endTagStartPosition = this.clonePosition();
|
|
2503
|
-
if (this.bumpIf('</')) {
|
|
2504
|
-
if (this.isEOF() || !_isAlpha(this.char())) {
|
|
2505
|
-
return this.error(ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));
|
|
2506
|
-
}
|
|
2507
|
-
var closingTagNameStartPosition = this.clonePosition();
|
|
2508
|
-
var closingTagName = this.parseTagName();
|
|
2509
|
-
if (tagName !== closingTagName) {
|
|
2510
|
-
return this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(closingTagNameStartPosition, this.clonePosition()));
|
|
2511
|
-
}
|
|
2512
|
-
this.bumpSpace();
|
|
2513
|
-
if (!this.bumpIf('>')) {
|
|
2514
|
-
return this.error(ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));
|
|
2515
|
-
}
|
|
2516
|
-
return {
|
|
2517
|
-
val: {
|
|
2518
|
-
type: TYPE.tag,
|
|
2519
|
-
value: tagName,
|
|
2520
|
-
children: children,
|
|
2521
|
-
location: createLocation(startPosition, this.clonePosition()),
|
|
2522
|
-
},
|
|
2523
|
-
err: null,
|
|
2524
|
-
};
|
|
2525
|
-
}
|
|
2526
|
-
else {
|
|
2527
|
-
return this.error(ErrorKind.UNCLOSED_TAG, createLocation(startPosition, this.clonePosition()));
|
|
2528
|
-
}
|
|
2529
|
-
}
|
|
2530
|
-
else {
|
|
2531
|
-
return this.error(ErrorKind.INVALID_TAG, createLocation(startPosition, this.clonePosition()));
|
|
2532
|
-
}
|
|
2533
|
-
};
|
|
2534
|
-
/**
|
|
2535
|
-
* This method assumes that the caller has peeked ahead for the first tag character.
|
|
2536
|
-
*/
|
|
2537
|
-
Parser.prototype.parseTagName = function () {
|
|
2538
|
-
var startOffset = this.offset();
|
|
2539
|
-
this.bump(); // the first tag name character
|
|
2540
|
-
while (!this.isEOF() && _isPotentialElementNameChar(this.char())) {
|
|
2541
|
-
this.bump();
|
|
2542
|
-
}
|
|
2543
|
-
return this.message.slice(startOffset, this.offset());
|
|
2544
|
-
};
|
|
2545
|
-
Parser.prototype.parseLiteral = function (nestingLevel, parentArgType) {
|
|
2546
|
-
var start = this.clonePosition();
|
|
2547
|
-
var value = '';
|
|
2548
|
-
while (true) {
|
|
2549
|
-
var parseQuoteResult = this.tryParseQuote(parentArgType);
|
|
2550
|
-
if (parseQuoteResult) {
|
|
2551
|
-
value += parseQuoteResult;
|
|
2552
|
-
continue;
|
|
2553
|
-
}
|
|
2554
|
-
var parseUnquotedResult = this.tryParseUnquoted(nestingLevel, parentArgType);
|
|
2555
|
-
if (parseUnquotedResult) {
|
|
2556
|
-
value += parseUnquotedResult;
|
|
2557
|
-
continue;
|
|
2558
|
-
}
|
|
2559
|
-
var parseLeftAngleResult = this.tryParseLeftAngleBracket();
|
|
2560
|
-
if (parseLeftAngleResult) {
|
|
2561
|
-
value += parseLeftAngleResult;
|
|
2562
|
-
continue;
|
|
2563
|
-
}
|
|
2564
|
-
break;
|
|
2565
|
-
}
|
|
2566
|
-
var location = createLocation(start, this.clonePosition());
|
|
2567
|
-
return {
|
|
2568
|
-
val: { type: TYPE.literal, value: value, location: location },
|
|
2569
|
-
err: null,
|
|
2570
|
-
};
|
|
2571
|
-
};
|
|
2572
|
-
Parser.prototype.tryParseLeftAngleBracket = function () {
|
|
2573
|
-
if (!this.isEOF() &&
|
|
2574
|
-
this.char() === 60 /* `<` */ &&
|
|
2575
|
-
(this.ignoreTag ||
|
|
2576
|
-
// If at the opening tag or closing tag position, bail.
|
|
2577
|
-
!_isAlphaOrSlash(this.peek() || 0))) {
|
|
2578
|
-
this.bump(); // `<`
|
|
2579
|
-
return '<';
|
|
2580
|
-
}
|
|
2581
|
-
return null;
|
|
2582
|
-
};
|
|
2583
|
-
/**
|
|
2584
|
-
* Starting with ICU 4.8, an ASCII apostrophe only starts quoted text if it immediately precedes
|
|
2585
|
-
* a character that requires quoting (that is, "only where needed"), and works the same in
|
|
2586
|
-
* nested messages as on the top level of the pattern. The new behavior is otherwise compatible.
|
|
2587
|
-
*/
|
|
2588
|
-
Parser.prototype.tryParseQuote = function (parentArgType) {
|
|
2589
|
-
if (this.isEOF() || this.char() !== 39 /* `'` */) {
|
|
2590
|
-
return null;
|
|
2591
|
-
}
|
|
2592
|
-
// Parse escaped char following the apostrophe, or early return if there is no escaped char.
|
|
2593
|
-
// Check if is valid escaped character
|
|
2594
|
-
switch (this.peek()) {
|
|
2595
|
-
case 39 /* `'` */:
|
|
2596
|
-
// double quote, should return as a single quote.
|
|
2597
|
-
this.bump();
|
|
2598
|
-
this.bump();
|
|
2599
|
-
return "'";
|
|
2600
|
-
// '{', '<', '>', '}'
|
|
2601
|
-
case 123:
|
|
2602
|
-
case 60:
|
|
2603
|
-
case 62:
|
|
2604
|
-
case 125:
|
|
2605
|
-
break;
|
|
2606
|
-
case 35: // '#'
|
|
2607
|
-
if (parentArgType === 'plural' || parentArgType === 'selectordinal') {
|
|
2608
|
-
break;
|
|
2609
|
-
}
|
|
2610
|
-
return null;
|
|
2611
|
-
default:
|
|
2612
|
-
return null;
|
|
2613
|
-
}
|
|
2614
|
-
this.bump(); // apostrophe
|
|
2615
|
-
var codePoints = [this.char()]; // escaped char
|
|
2616
|
-
this.bump();
|
|
2617
|
-
// read chars until the optional closing apostrophe is found
|
|
2618
|
-
while (!this.isEOF()) {
|
|
2619
|
-
var ch = this.char();
|
|
2620
|
-
if (ch === 39 /* `'` */) {
|
|
2621
|
-
if (this.peek() === 39 /* `'` */) {
|
|
2622
|
-
codePoints.push(39);
|
|
2623
|
-
// Bump one more time because we need to skip 2 characters.
|
|
2624
|
-
this.bump();
|
|
2625
|
-
}
|
|
2626
|
-
else {
|
|
2627
|
-
// Optional closing apostrophe.
|
|
2628
|
-
this.bump();
|
|
2629
|
-
break;
|
|
2630
|
-
}
|
|
2631
|
-
}
|
|
2632
|
-
else {
|
|
2633
|
-
codePoints.push(ch);
|
|
2634
|
-
}
|
|
2635
|
-
this.bump();
|
|
2636
|
-
}
|
|
2637
|
-
return fromCodePoint.apply(void 0, codePoints);
|
|
2638
|
-
};
|
|
2639
|
-
Parser.prototype.tryParseUnquoted = function (nestingLevel, parentArgType) {
|
|
2640
|
-
if (this.isEOF()) {
|
|
2641
|
-
return null;
|
|
2642
|
-
}
|
|
2643
|
-
var ch = this.char();
|
|
2644
|
-
if (ch === 60 /* `<` */ ||
|
|
2645
|
-
ch === 123 /* `{` */ ||
|
|
2646
|
-
(ch === 35 /* `#` */ &&
|
|
2647
|
-
(parentArgType === 'plural' || parentArgType === 'selectordinal')) ||
|
|
2648
|
-
(ch === 125 /* `}` */ && nestingLevel > 0)) {
|
|
2649
|
-
return null;
|
|
2650
|
-
}
|
|
2651
|
-
else {
|
|
2652
|
-
this.bump();
|
|
2653
|
-
return fromCodePoint(ch);
|
|
2654
|
-
}
|
|
2655
|
-
};
|
|
2656
|
-
Parser.prototype.parseArgument = function (nestingLevel, expectingCloseTag) {
|
|
2657
|
-
var openingBracePosition = this.clonePosition();
|
|
2658
|
-
this.bump(); // `{`
|
|
2659
|
-
this.bumpSpace();
|
|
2660
|
-
if (this.isEOF()) {
|
|
2661
|
-
return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
2662
|
-
}
|
|
2663
|
-
if (this.char() === 125 /* `}` */) {
|
|
2664
|
-
this.bump();
|
|
2665
|
-
return this.error(ErrorKind.EMPTY_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
|
|
2666
|
-
}
|
|
2667
|
-
// argument name
|
|
2668
|
-
var value = this.parseIdentifierIfPossible().value;
|
|
2669
|
-
if (!value) {
|
|
2670
|
-
return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
|
|
2671
|
-
}
|
|
2672
|
-
this.bumpSpace();
|
|
2673
|
-
if (this.isEOF()) {
|
|
2674
|
-
return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
2675
|
-
}
|
|
2676
|
-
switch (this.char()) {
|
|
2677
|
-
// Simple argument: `{name}`
|
|
2678
|
-
case 125 /* `}` */: {
|
|
2679
|
-
this.bump(); // `}`
|
|
2680
|
-
return {
|
|
2681
|
-
val: {
|
|
2682
|
-
type: TYPE.argument,
|
|
2683
|
-
// value does not include the opening and closing braces.
|
|
2684
|
-
value: value,
|
|
2685
|
-
location: createLocation(openingBracePosition, this.clonePosition()),
|
|
2686
|
-
},
|
|
2687
|
-
err: null,
|
|
2688
|
-
};
|
|
2689
|
-
}
|
|
2690
|
-
// Argument with options: `{name, format, ...}`
|
|
2691
|
-
case 44 /* `,` */: {
|
|
2692
|
-
this.bump(); // `,`
|
|
2693
|
-
this.bumpSpace();
|
|
2694
|
-
if (this.isEOF()) {
|
|
2695
|
-
return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
2696
|
-
}
|
|
2697
|
-
return this.parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition);
|
|
2698
|
-
}
|
|
2699
|
-
default:
|
|
2700
|
-
return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
|
|
2701
|
-
}
|
|
2702
|
-
};
|
|
2703
|
-
/**
|
|
2704
|
-
* Advance the parser until the end of the identifier, if it is currently on
|
|
2705
|
-
* an identifier character. Return an empty string otherwise.
|
|
2706
|
-
*/
|
|
2707
|
-
Parser.prototype.parseIdentifierIfPossible = function () {
|
|
2708
|
-
var startingPosition = this.clonePosition();
|
|
2709
|
-
var startOffset = this.offset();
|
|
2710
|
-
var value = matchIdentifierAtIndex(this.message, startOffset);
|
|
2711
|
-
var endOffset = startOffset + value.length;
|
|
2712
|
-
this.bumpTo(endOffset);
|
|
2713
|
-
var endPosition = this.clonePosition();
|
|
2714
|
-
var location = createLocation(startingPosition, endPosition);
|
|
2715
|
-
return { value: value, location: location };
|
|
2716
|
-
};
|
|
2717
|
-
Parser.prototype.parseArgumentOptions = function (nestingLevel, expectingCloseTag, value, openingBracePosition) {
|
|
2718
|
-
var _a;
|
|
2719
|
-
// Parse this range:
|
|
2720
|
-
// {name, type, style}
|
|
2721
|
-
// ^---^
|
|
2722
|
-
var typeStartPosition = this.clonePosition();
|
|
2723
|
-
var argType = this.parseIdentifierIfPossible().value;
|
|
2724
|
-
var typeEndPosition = this.clonePosition();
|
|
2725
|
-
switch (argType) {
|
|
2726
|
-
case '':
|
|
2727
|
-
// Expecting a style string number, date, time, plural, selectordinal, or select.
|
|
2728
|
-
return this.error(ErrorKind.EXPECT_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));
|
|
2729
|
-
case 'number':
|
|
2730
|
-
case 'date':
|
|
2731
|
-
case 'time': {
|
|
2732
|
-
// Parse this range:
|
|
2733
|
-
// {name, number, style}
|
|
2734
|
-
// ^-------^
|
|
2735
|
-
this.bumpSpace();
|
|
2736
|
-
var styleAndLocation = null;
|
|
2737
|
-
if (this.bumpIf(',')) {
|
|
2738
|
-
this.bumpSpace();
|
|
2739
|
-
var styleStartPosition = this.clonePosition();
|
|
2740
|
-
var result = this.parseSimpleArgStyleIfPossible();
|
|
2741
|
-
if (result.err) {
|
|
2742
|
-
return result;
|
|
2743
|
-
}
|
|
2744
|
-
var style = trimEnd(result.val);
|
|
2745
|
-
if (style.length === 0) {
|
|
2746
|
-
return this.error(ErrorKind.EXPECT_ARGUMENT_STYLE, createLocation(this.clonePosition(), this.clonePosition()));
|
|
2747
|
-
}
|
|
2748
|
-
var styleLocation = createLocation(styleStartPosition, this.clonePosition());
|
|
2749
|
-
styleAndLocation = { style: style, styleLocation: styleLocation };
|
|
2750
|
-
}
|
|
2751
|
-
var argCloseResult = this.tryParseArgumentClose(openingBracePosition);
|
|
2752
|
-
if (argCloseResult.err) {
|
|
2753
|
-
return argCloseResult;
|
|
2754
|
-
}
|
|
2755
|
-
var location_1 = createLocation(openingBracePosition, this.clonePosition());
|
|
2756
|
-
// Extract style or skeleton
|
|
2757
|
-
if (styleAndLocation && startsWith(styleAndLocation === null || styleAndLocation === void 0 ? void 0 : styleAndLocation.style, '::', 0)) {
|
|
2758
|
-
// Skeleton starts with `::`.
|
|
2759
|
-
var skeleton = trimStart(styleAndLocation.style.slice(2));
|
|
2760
|
-
if (argType === 'number') {
|
|
2761
|
-
var result = this.parseNumberSkeletonFromString(skeleton, styleAndLocation.styleLocation);
|
|
2762
|
-
if (result.err) {
|
|
2763
|
-
return result;
|
|
2764
|
-
}
|
|
2765
|
-
return {
|
|
2766
|
-
val: { type: TYPE.number, value: value, location: location_1, style: result.val },
|
|
2767
|
-
err: null,
|
|
2768
|
-
};
|
|
2769
|
-
}
|
|
2770
|
-
else {
|
|
2771
|
-
if (skeleton.length === 0) {
|
|
2772
|
-
return this.error(ErrorKind.EXPECT_DATE_TIME_SKELETON, location_1);
|
|
2773
|
-
}
|
|
2774
|
-
var dateTimePattern = skeleton;
|
|
2775
|
-
// Get "best match" pattern only if locale is passed, if not, let it
|
|
2776
|
-
// pass as-is where `parseDateTimeSkeleton()` will throw an error
|
|
2777
|
-
// for unsupported patterns.
|
|
2778
|
-
if (this.locale) {
|
|
2779
|
-
dateTimePattern = getBestPattern(skeleton, this.locale);
|
|
2780
|
-
}
|
|
2781
|
-
var style = {
|
|
2782
|
-
type: SKELETON_TYPE.dateTime,
|
|
2783
|
-
pattern: dateTimePattern,
|
|
2784
|
-
location: styleAndLocation.styleLocation,
|
|
2785
|
-
parsedOptions: this.shouldParseSkeletons
|
|
2786
|
-
? parseDateTimeSkeleton(dateTimePattern)
|
|
2787
|
-
: {},
|
|
2788
|
-
};
|
|
2789
|
-
var type = argType === 'date' ? TYPE.date : TYPE.time;
|
|
2790
|
-
return {
|
|
2791
|
-
val: { type: type, value: value, location: location_1, style: style },
|
|
2792
|
-
err: null,
|
|
2793
|
-
};
|
|
2794
|
-
}
|
|
2795
|
-
}
|
|
2796
|
-
// Regular style or no style.
|
|
2797
|
-
return {
|
|
2798
|
-
val: {
|
|
2799
|
-
type: argType === 'number'
|
|
2800
|
-
? TYPE.number
|
|
2801
|
-
: argType === 'date'
|
|
2802
|
-
? TYPE.date
|
|
2803
|
-
: TYPE.time,
|
|
2804
|
-
value: value,
|
|
2805
|
-
location: location_1,
|
|
2806
|
-
style: (_a = styleAndLocation === null || styleAndLocation === void 0 ? void 0 : styleAndLocation.style) !== null && _a !== void 0 ? _a : null,
|
|
2807
|
-
},
|
|
2808
|
-
err: null,
|
|
2809
|
-
};
|
|
2810
|
-
}
|
|
2811
|
-
case 'plural':
|
|
2812
|
-
case 'selectordinal':
|
|
2813
|
-
case 'select': {
|
|
2814
|
-
// Parse this range:
|
|
2815
|
-
// {name, plural, options}
|
|
2816
|
-
// ^---------^
|
|
2817
|
-
var typeEndPosition_1 = this.clonePosition();
|
|
2818
|
-
this.bumpSpace();
|
|
2819
|
-
if (!this.bumpIf(',')) {
|
|
2820
|
-
return this.error(ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, createLocation(typeEndPosition_1, __assign({}, typeEndPosition_1)));
|
|
2821
|
-
}
|
|
2822
|
-
this.bumpSpace();
|
|
2823
|
-
// Parse offset:
|
|
2824
|
-
// {name, plural, offset:1, options}
|
|
2825
|
-
// ^-----^
|
|
2826
|
-
//
|
|
2827
|
-
// or the first option:
|
|
2828
|
-
//
|
|
2829
|
-
// {name, plural, one {...} other {...}}
|
|
2830
|
-
// ^--^
|
|
2831
|
-
var identifierAndLocation = this.parseIdentifierIfPossible();
|
|
2832
|
-
var pluralOffset = 0;
|
|
2833
|
-
if (argType !== 'select' && identifierAndLocation.value === 'offset') {
|
|
2834
|
-
if (!this.bumpIf(':')) {
|
|
2835
|
-
return this.error(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, createLocation(this.clonePosition(), this.clonePosition()));
|
|
2836
|
-
}
|
|
2837
|
-
this.bumpSpace();
|
|
2838
|
-
var result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, ErrorKind.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);
|
|
2839
|
-
if (result.err) {
|
|
2840
|
-
return result;
|
|
2841
|
-
}
|
|
2842
|
-
// Parse another identifier for option parsing
|
|
2843
|
-
this.bumpSpace();
|
|
2844
|
-
identifierAndLocation = this.parseIdentifierIfPossible();
|
|
2845
|
-
pluralOffset = result.val;
|
|
2846
|
-
}
|
|
2847
|
-
var optionsResult = this.tryParsePluralOrSelectOptions(nestingLevel, argType, expectingCloseTag, identifierAndLocation);
|
|
2848
|
-
if (optionsResult.err) {
|
|
2849
|
-
return optionsResult;
|
|
2850
|
-
}
|
|
2851
|
-
var argCloseResult = this.tryParseArgumentClose(openingBracePosition);
|
|
2852
|
-
if (argCloseResult.err) {
|
|
2853
|
-
return argCloseResult;
|
|
2854
|
-
}
|
|
2855
|
-
var location_2 = createLocation(openingBracePosition, this.clonePosition());
|
|
2856
|
-
if (argType === 'select') {
|
|
2857
|
-
return {
|
|
2858
|
-
val: {
|
|
2859
|
-
type: TYPE.select,
|
|
2860
|
-
value: value,
|
|
2861
|
-
options: fromEntries(optionsResult.val),
|
|
2862
|
-
location: location_2,
|
|
2863
|
-
},
|
|
2864
|
-
err: null,
|
|
2865
|
-
};
|
|
2866
|
-
}
|
|
2867
|
-
else {
|
|
2868
|
-
return {
|
|
2869
|
-
val: {
|
|
2870
|
-
type: TYPE.plural,
|
|
2871
|
-
value: value,
|
|
2872
|
-
options: fromEntries(optionsResult.val),
|
|
2873
|
-
offset: pluralOffset,
|
|
2874
|
-
pluralType: argType === 'plural' ? 'cardinal' : 'ordinal',
|
|
2875
|
-
location: location_2,
|
|
2876
|
-
},
|
|
2877
|
-
err: null,
|
|
2878
|
-
};
|
|
2879
|
-
}
|
|
2880
|
-
}
|
|
2881
|
-
default:
|
|
2882
|
-
return this.error(ErrorKind.INVALID_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));
|
|
2883
|
-
}
|
|
2884
|
-
};
|
|
2885
|
-
Parser.prototype.tryParseArgumentClose = function (openingBracePosition) {
|
|
2886
|
-
// Parse: {value, number, ::currency/GBP }
|
|
2887
|
-
//
|
|
2888
|
-
if (this.isEOF() || this.char() !== 125 /* `}` */) {
|
|
2889
|
-
return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
2890
|
-
}
|
|
2891
|
-
this.bump(); // `}`
|
|
2892
|
-
return { val: true, err: null };
|
|
2893
|
-
};
|
|
2894
|
-
/**
|
|
2895
|
-
* See: https://github.com/unicode-org/icu/blob/af7ed1f6d2298013dc303628438ec4abe1f16479/icu4c/source/common/messagepattern.cpp#L659
|
|
2896
|
-
*/
|
|
2897
|
-
Parser.prototype.parseSimpleArgStyleIfPossible = function () {
|
|
2898
|
-
var nestedBraces = 0;
|
|
2899
|
-
var startPosition = this.clonePosition();
|
|
2900
|
-
while (!this.isEOF()) {
|
|
2901
|
-
var ch = this.char();
|
|
2902
|
-
switch (ch) {
|
|
2903
|
-
case 39 /* `'` */: {
|
|
2904
|
-
// Treat apostrophe as quoting but include it in the style part.
|
|
2905
|
-
// Find the end of the quoted literal text.
|
|
2906
|
-
this.bump();
|
|
2907
|
-
var apostrophePosition = this.clonePosition();
|
|
2908
|
-
if (!this.bumpUntil("'")) {
|
|
2909
|
-
return this.error(ErrorKind.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, createLocation(apostrophePosition, this.clonePosition()));
|
|
2910
|
-
}
|
|
2911
|
-
this.bump();
|
|
2912
|
-
break;
|
|
2913
|
-
}
|
|
2914
|
-
case 123 /* `{` */: {
|
|
2915
|
-
nestedBraces += 1;
|
|
2916
|
-
this.bump();
|
|
2917
|
-
break;
|
|
2918
|
-
}
|
|
2919
|
-
case 125 /* `}` */: {
|
|
2920
|
-
if (nestedBraces > 0) {
|
|
2921
|
-
nestedBraces -= 1;
|
|
2922
|
-
}
|
|
2923
|
-
else {
|
|
2924
|
-
return {
|
|
2925
|
-
val: this.message.slice(startPosition.offset, this.offset()),
|
|
2926
|
-
err: null,
|
|
2927
|
-
};
|
|
2928
|
-
}
|
|
2929
|
-
break;
|
|
2930
|
-
}
|
|
2931
|
-
default:
|
|
2932
|
-
this.bump();
|
|
2933
|
-
break;
|
|
2934
|
-
}
|
|
2935
|
-
}
|
|
2936
|
-
return {
|
|
2937
|
-
val: this.message.slice(startPosition.offset, this.offset()),
|
|
2938
|
-
err: null,
|
|
2939
|
-
};
|
|
2940
|
-
};
|
|
2941
|
-
Parser.prototype.parseNumberSkeletonFromString = function (skeleton, location) {
|
|
2942
|
-
var tokens = [];
|
|
2943
|
-
try {
|
|
2944
|
-
tokens = parseNumberSkeletonFromString(skeleton);
|
|
2945
|
-
}
|
|
2946
|
-
catch (e) {
|
|
2947
|
-
return this.error(ErrorKind.INVALID_NUMBER_SKELETON, location);
|
|
2948
|
-
}
|
|
2949
|
-
return {
|
|
2950
|
-
val: {
|
|
2951
|
-
type: SKELETON_TYPE.number,
|
|
2952
|
-
tokens: tokens,
|
|
2953
|
-
location: location,
|
|
2954
|
-
parsedOptions: this.shouldParseSkeletons
|
|
2955
|
-
? parseNumberSkeleton(tokens)
|
|
2956
|
-
: {},
|
|
2957
|
-
},
|
|
2958
|
-
err: null,
|
|
2959
|
-
};
|
|
2960
|
-
};
|
|
2961
|
-
/**
|
|
2962
|
-
* @param nesting_level The current nesting level of messages.
|
|
2963
|
-
* This can be positive when parsing message fragment in select or plural argument options.
|
|
2964
|
-
* @param parent_arg_type The parent argument's type.
|
|
2965
|
-
* @param parsed_first_identifier If provided, this is the first identifier-like selector of
|
|
2966
|
-
* the argument. It is a by-product of a previous parsing attempt.
|
|
2967
|
-
* @param expecting_close_tag If true, this message is directly or indirectly nested inside
|
|
2968
|
-
* between a pair of opening and closing tags. The nested message will not parse beyond
|
|
2969
|
-
* the closing tag boundary.
|
|
2970
|
-
*/
|
|
2971
|
-
Parser.prototype.tryParsePluralOrSelectOptions = function (nestingLevel, parentArgType, expectCloseTag, parsedFirstIdentifier) {
|
|
2972
|
-
var _a;
|
|
2973
|
-
var hasOtherClause = false;
|
|
2974
|
-
var options = [];
|
|
2975
|
-
var parsedSelectors = new Set();
|
|
2976
|
-
var selector = parsedFirstIdentifier.value, selectorLocation = parsedFirstIdentifier.location;
|
|
2977
|
-
// Parse:
|
|
2978
|
-
// one {one apple}
|
|
2979
|
-
// ^--^
|
|
2980
|
-
while (true) {
|
|
2981
|
-
if (selector.length === 0) {
|
|
2982
|
-
var startPosition = this.clonePosition();
|
|
2983
|
-
if (parentArgType !== 'select' && this.bumpIf('=')) {
|
|
2984
|
-
// Try parse `={number}` selector
|
|
2985
|
-
var result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, ErrorKind.INVALID_PLURAL_ARGUMENT_SELECTOR);
|
|
2986
|
-
if (result.err) {
|
|
2987
|
-
return result;
|
|
2988
|
-
}
|
|
2989
|
-
selectorLocation = createLocation(startPosition, this.clonePosition());
|
|
2990
|
-
selector = this.message.slice(startPosition.offset, this.offset());
|
|
2991
|
-
}
|
|
2992
|
-
else {
|
|
2993
|
-
break;
|
|
2994
|
-
}
|
|
2995
|
-
}
|
|
2996
|
-
// Duplicate selector clauses
|
|
2997
|
-
if (parsedSelectors.has(selector)) {
|
|
2998
|
-
return this.error(parentArgType === 'select'
|
|
2999
|
-
? ErrorKind.DUPLICATE_SELECT_ARGUMENT_SELECTOR
|
|
3000
|
-
: ErrorKind.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, selectorLocation);
|
|
3001
|
-
}
|
|
3002
|
-
if (selector === 'other') {
|
|
3003
|
-
hasOtherClause = true;
|
|
3004
|
-
}
|
|
3005
|
-
// Parse:
|
|
3006
|
-
// one {one apple}
|
|
3007
|
-
// ^----------^
|
|
3008
|
-
this.bumpSpace();
|
|
3009
|
-
var openingBracePosition = this.clonePosition();
|
|
3010
|
-
if (!this.bumpIf('{')) {
|
|
3011
|
-
return this.error(parentArgType === 'select'
|
|
3012
|
-
? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT
|
|
3013
|
-
: ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, createLocation(this.clonePosition(), this.clonePosition()));
|
|
3014
|
-
}
|
|
3015
|
-
var fragmentResult = this.parseMessage(nestingLevel + 1, parentArgType, expectCloseTag);
|
|
3016
|
-
if (fragmentResult.err) {
|
|
3017
|
-
return fragmentResult;
|
|
3018
|
-
}
|
|
3019
|
-
var argCloseResult = this.tryParseArgumentClose(openingBracePosition);
|
|
3020
|
-
if (argCloseResult.err) {
|
|
3021
|
-
return argCloseResult;
|
|
3022
|
-
}
|
|
3023
|
-
options.push([
|
|
3024
|
-
selector,
|
|
3025
|
-
{
|
|
3026
|
-
value: fragmentResult.val,
|
|
3027
|
-
location: createLocation(openingBracePosition, this.clonePosition()),
|
|
3028
|
-
},
|
|
3029
|
-
]);
|
|
3030
|
-
// Keep track of the existing selectors
|
|
3031
|
-
parsedSelectors.add(selector);
|
|
3032
|
-
// Prep next selector clause.
|
|
3033
|
-
this.bumpSpace();
|
|
3034
|
-
(_a = this.parseIdentifierIfPossible(), selector = _a.value, selectorLocation = _a.location);
|
|
3035
|
-
}
|
|
3036
|
-
if (options.length === 0) {
|
|
3037
|
-
return this.error(parentArgType === 'select'
|
|
3038
|
-
? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR
|
|
3039
|
-
: ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, createLocation(this.clonePosition(), this.clonePosition()));
|
|
3040
|
-
}
|
|
3041
|
-
if (this.requiresOtherClause && !hasOtherClause) {
|
|
3042
|
-
return this.error(ErrorKind.MISSING_OTHER_CLAUSE, createLocation(this.clonePosition(), this.clonePosition()));
|
|
3043
|
-
}
|
|
3044
|
-
return { val: options, err: null };
|
|
3045
|
-
};
|
|
3046
|
-
Parser.prototype.tryParseDecimalInteger = function (expectNumberError, invalidNumberError) {
|
|
3047
|
-
var sign = 1;
|
|
3048
|
-
var startingPosition = this.clonePosition();
|
|
3049
|
-
if (this.bumpIf('+')) ;
|
|
3050
|
-
else if (this.bumpIf('-')) {
|
|
3051
|
-
sign = -1;
|
|
3052
|
-
}
|
|
3053
|
-
var hasDigits = false;
|
|
3054
|
-
var decimal = 0;
|
|
3055
|
-
while (!this.isEOF()) {
|
|
3056
|
-
var ch = this.char();
|
|
3057
|
-
if (ch >= 48 /* `0` */ && ch <= 57 /* `9` */) {
|
|
3058
|
-
hasDigits = true;
|
|
3059
|
-
decimal = decimal * 10 + (ch - 48);
|
|
3060
|
-
this.bump();
|
|
3061
|
-
}
|
|
3062
|
-
else {
|
|
3063
|
-
break;
|
|
3064
|
-
}
|
|
3065
|
-
}
|
|
3066
|
-
var location = createLocation(startingPosition, this.clonePosition());
|
|
3067
|
-
if (!hasDigits) {
|
|
3068
|
-
return this.error(expectNumberError, location);
|
|
3069
|
-
}
|
|
3070
|
-
decimal *= sign;
|
|
3071
|
-
if (!isSafeInteger(decimal)) {
|
|
3072
|
-
return this.error(invalidNumberError, location);
|
|
3073
|
-
}
|
|
3074
|
-
return { val: decimal, err: null };
|
|
3075
|
-
};
|
|
3076
|
-
Parser.prototype.offset = function () {
|
|
3077
|
-
return this.position.offset;
|
|
3078
|
-
};
|
|
3079
|
-
Parser.prototype.isEOF = function () {
|
|
3080
|
-
return this.offset() === this.message.length;
|
|
3081
|
-
};
|
|
3082
|
-
Parser.prototype.clonePosition = function () {
|
|
3083
|
-
// This is much faster than `Object.assign` or spread.
|
|
3084
|
-
return {
|
|
3085
|
-
offset: this.position.offset,
|
|
3086
|
-
line: this.position.line,
|
|
3087
|
-
column: this.position.column,
|
|
3088
|
-
};
|
|
3089
|
-
};
|
|
3090
|
-
/**
|
|
3091
|
-
* Return the code point at the current position of the parser.
|
|
3092
|
-
* Throws if the index is out of bound.
|
|
3093
|
-
*/
|
|
3094
|
-
Parser.prototype.char = function () {
|
|
3095
|
-
var offset = this.position.offset;
|
|
3096
|
-
if (offset >= this.message.length) {
|
|
3097
|
-
throw Error('out of bound');
|
|
3098
|
-
}
|
|
3099
|
-
var code = codePointAt(this.message, offset);
|
|
3100
|
-
if (code === undefined) {
|
|
3101
|
-
throw Error("Offset ".concat(offset, " is at invalid UTF-16 code unit boundary"));
|
|
3102
|
-
}
|
|
3103
|
-
return code;
|
|
3104
|
-
};
|
|
3105
|
-
Parser.prototype.error = function (kind, location) {
|
|
3106
|
-
return {
|
|
3107
|
-
val: null,
|
|
3108
|
-
err: {
|
|
3109
|
-
kind: kind,
|
|
3110
|
-
message: this.message,
|
|
3111
|
-
location: location,
|
|
3112
|
-
},
|
|
3113
|
-
};
|
|
3114
|
-
};
|
|
3115
|
-
/** Bump the parser to the next UTF-16 code unit. */
|
|
3116
|
-
Parser.prototype.bump = function () {
|
|
3117
|
-
if (this.isEOF()) {
|
|
3118
|
-
return;
|
|
3119
|
-
}
|
|
3120
|
-
var code = this.char();
|
|
3121
|
-
if (code === 10 /* '\n' */) {
|
|
3122
|
-
this.position.line += 1;
|
|
3123
|
-
this.position.column = 1;
|
|
3124
|
-
this.position.offset += 1;
|
|
3125
|
-
}
|
|
3126
|
-
else {
|
|
3127
|
-
this.position.column += 1;
|
|
3128
|
-
// 0 ~ 0x10000 -> unicode BMP, otherwise skip the surrogate pair.
|
|
3129
|
-
this.position.offset += code < 0x10000 ? 1 : 2;
|
|
3130
|
-
}
|
|
3131
|
-
};
|
|
3132
|
-
/**
|
|
3133
|
-
* If the substring starting at the current position of the parser has
|
|
3134
|
-
* the given prefix, then bump the parser to the character immediately
|
|
3135
|
-
* following the prefix and return true. Otherwise, don't bump the parser
|
|
3136
|
-
* and return false.
|
|
3137
|
-
*/
|
|
3138
|
-
Parser.prototype.bumpIf = function (prefix) {
|
|
3139
|
-
if (startsWith(this.message, prefix, this.offset())) {
|
|
3140
|
-
for (var i = 0; i < prefix.length; i++) {
|
|
3141
|
-
this.bump();
|
|
3142
|
-
}
|
|
3143
|
-
return true;
|
|
3144
|
-
}
|
|
3145
|
-
return false;
|
|
3146
|
-
};
|
|
3147
|
-
/**
|
|
3148
|
-
* Bump the parser until the pattern character is found and return `true`.
|
|
3149
|
-
* Otherwise bump to the end of the file and return `false`.
|
|
3150
|
-
*/
|
|
3151
|
-
Parser.prototype.bumpUntil = function (pattern) {
|
|
3152
|
-
var currentOffset = this.offset();
|
|
3153
|
-
var index = this.message.indexOf(pattern, currentOffset);
|
|
3154
|
-
if (index >= 0) {
|
|
3155
|
-
this.bumpTo(index);
|
|
3156
|
-
return true;
|
|
3157
|
-
}
|
|
3158
|
-
else {
|
|
3159
|
-
this.bumpTo(this.message.length);
|
|
3160
|
-
return false;
|
|
3161
|
-
}
|
|
3162
|
-
};
|
|
3163
|
-
/**
|
|
3164
|
-
* Bump the parser to the target offset.
|
|
3165
|
-
* If target offset is beyond the end of the input, bump the parser to the end of the input.
|
|
3166
|
-
*/
|
|
3167
|
-
Parser.prototype.bumpTo = function (targetOffset) {
|
|
3168
|
-
if (this.offset() > targetOffset) {
|
|
3169
|
-
throw Error("targetOffset ".concat(targetOffset, " must be greater than or equal to the current offset ").concat(this.offset()));
|
|
3170
|
-
}
|
|
3171
|
-
targetOffset = Math.min(targetOffset, this.message.length);
|
|
3172
|
-
while (true) {
|
|
3173
|
-
var offset = this.offset();
|
|
3174
|
-
if (offset === targetOffset) {
|
|
3175
|
-
break;
|
|
3176
|
-
}
|
|
3177
|
-
if (offset > targetOffset) {
|
|
3178
|
-
throw Error("targetOffset ".concat(targetOffset, " is at invalid UTF-16 code unit boundary"));
|
|
3179
|
-
}
|
|
3180
|
-
this.bump();
|
|
3181
|
-
if (this.isEOF()) {
|
|
3182
|
-
break;
|
|
3183
|
-
}
|
|
3184
|
-
}
|
|
3185
|
-
};
|
|
3186
|
-
/** advance the parser through all whitespace to the next non-whitespace code unit. */
|
|
3187
|
-
Parser.prototype.bumpSpace = function () {
|
|
3188
|
-
while (!this.isEOF() && _isWhiteSpace(this.char())) {
|
|
3189
|
-
this.bump();
|
|
3190
|
-
}
|
|
3191
|
-
};
|
|
3192
|
-
/**
|
|
3193
|
-
* Peek at the *next* Unicode codepoint in the input without advancing the parser.
|
|
3194
|
-
* If the input has been exhausted, then this returns null.
|
|
3195
|
-
*/
|
|
3196
|
-
Parser.prototype.peek = function () {
|
|
3197
|
-
if (this.isEOF()) {
|
|
3198
|
-
return null;
|
|
3199
|
-
}
|
|
3200
|
-
var code = this.char();
|
|
3201
|
-
var offset = this.offset();
|
|
3202
|
-
var nextCode = this.message.charCodeAt(offset + (code >= 0x10000 ? 2 : 1));
|
|
3203
|
-
return nextCode !== null && nextCode !== void 0 ? nextCode : null;
|
|
3204
|
-
};
|
|
3205
|
-
return Parser;
|
|
3206
|
-
}());
|
|
3207
|
-
/**
|
|
3208
|
-
* This check if codepoint is alphabet (lower & uppercase)
|
|
3209
|
-
* @param codepoint
|
|
3210
|
-
* @returns
|
|
3211
|
-
*/
|
|
3212
|
-
function _isAlpha(codepoint) {
|
|
3213
|
-
return ((codepoint >= 97 && codepoint <= 122) ||
|
|
3214
|
-
(codepoint >= 65 && codepoint <= 90));
|
|
3215
|
-
}
|
|
3216
|
-
function _isAlphaOrSlash(codepoint) {
|
|
3217
|
-
return _isAlpha(codepoint) || codepoint === 47; /* '/' */
|
|
3218
|
-
}
|
|
3219
|
-
/** See `parseTag` function docs. */
|
|
3220
|
-
function _isPotentialElementNameChar(c) {
|
|
3221
|
-
return (c === 45 /* '-' */ ||
|
|
3222
|
-
c === 46 /* '.' */ ||
|
|
3223
|
-
(c >= 48 && c <= 57) /* 0..9 */ ||
|
|
3224
|
-
c === 95 /* '_' */ ||
|
|
3225
|
-
(c >= 97 && c <= 122) /** a..z */ ||
|
|
3226
|
-
(c >= 65 && c <= 90) /* A..Z */ ||
|
|
3227
|
-
c == 0xb7 ||
|
|
3228
|
-
(c >= 0xc0 && c <= 0xd6) ||
|
|
3229
|
-
(c >= 0xd8 && c <= 0xf6) ||
|
|
3230
|
-
(c >= 0xf8 && c <= 0x37d) ||
|
|
3231
|
-
(c >= 0x37f && c <= 0x1fff) ||
|
|
3232
|
-
(c >= 0x200c && c <= 0x200d) ||
|
|
3233
|
-
(c >= 0x203f && c <= 0x2040) ||
|
|
3234
|
-
(c >= 0x2070 && c <= 0x218f) ||
|
|
3235
|
-
(c >= 0x2c00 && c <= 0x2fef) ||
|
|
3236
|
-
(c >= 0x3001 && c <= 0xd7ff) ||
|
|
3237
|
-
(c >= 0xf900 && c <= 0xfdcf) ||
|
|
3238
|
-
(c >= 0xfdf0 && c <= 0xfffd) ||
|
|
3239
|
-
(c >= 0x10000 && c <= 0xeffff));
|
|
3240
|
-
}
|
|
3241
|
-
/**
|
|
3242
|
-
* Code point equivalent of regex `\p{White_Space}`.
|
|
3243
|
-
* From: https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt
|
|
3244
|
-
*/
|
|
3245
|
-
function _isWhiteSpace(c) {
|
|
3246
|
-
return ((c >= 0x0009 && c <= 0x000d) ||
|
|
3247
|
-
c === 0x0020 ||
|
|
3248
|
-
c === 0x0085 ||
|
|
3249
|
-
(c >= 0x200e && c <= 0x200f) ||
|
|
3250
|
-
c === 0x2028 ||
|
|
3251
|
-
c === 0x2029);
|
|
3252
|
-
}
|
|
3253
|
-
/**
|
|
3254
|
-
* Code point equivalent of regex `\p{Pattern_Syntax}`.
|
|
3255
|
-
* See https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt
|
|
3256
|
-
*/
|
|
3257
|
-
function _isPatternSyntax(c) {
|
|
3258
|
-
return ((c >= 0x0021 && c <= 0x0023) ||
|
|
3259
|
-
c === 0x0024 ||
|
|
3260
|
-
(c >= 0x0025 && c <= 0x0027) ||
|
|
3261
|
-
c === 0x0028 ||
|
|
3262
|
-
c === 0x0029 ||
|
|
3263
|
-
c === 0x002a ||
|
|
3264
|
-
c === 0x002b ||
|
|
3265
|
-
c === 0x002c ||
|
|
3266
|
-
c === 0x002d ||
|
|
3267
|
-
(c >= 0x002e && c <= 0x002f) ||
|
|
3268
|
-
(c >= 0x003a && c <= 0x003b) ||
|
|
3269
|
-
(c >= 0x003c && c <= 0x003e) ||
|
|
3270
|
-
(c >= 0x003f && c <= 0x0040) ||
|
|
3271
|
-
c === 0x005b ||
|
|
3272
|
-
c === 0x005c ||
|
|
3273
|
-
c === 0x005d ||
|
|
3274
|
-
c === 0x005e ||
|
|
3275
|
-
c === 0x0060 ||
|
|
3276
|
-
c === 0x007b ||
|
|
3277
|
-
c === 0x007c ||
|
|
3278
|
-
c === 0x007d ||
|
|
3279
|
-
c === 0x007e ||
|
|
3280
|
-
c === 0x00a1 ||
|
|
3281
|
-
(c >= 0x00a2 && c <= 0x00a5) ||
|
|
3282
|
-
c === 0x00a6 ||
|
|
3283
|
-
c === 0x00a7 ||
|
|
3284
|
-
c === 0x00a9 ||
|
|
3285
|
-
c === 0x00ab ||
|
|
3286
|
-
c === 0x00ac ||
|
|
3287
|
-
c === 0x00ae ||
|
|
3288
|
-
c === 0x00b0 ||
|
|
3289
|
-
c === 0x00b1 ||
|
|
3290
|
-
c === 0x00b6 ||
|
|
3291
|
-
c === 0x00bb ||
|
|
3292
|
-
c === 0x00bf ||
|
|
3293
|
-
c === 0x00d7 ||
|
|
3294
|
-
c === 0x00f7 ||
|
|
3295
|
-
(c >= 0x2010 && c <= 0x2015) ||
|
|
3296
|
-
(c >= 0x2016 && c <= 0x2017) ||
|
|
3297
|
-
c === 0x2018 ||
|
|
3298
|
-
c === 0x2019 ||
|
|
3299
|
-
c === 0x201a ||
|
|
3300
|
-
(c >= 0x201b && c <= 0x201c) ||
|
|
3301
|
-
c === 0x201d ||
|
|
3302
|
-
c === 0x201e ||
|
|
3303
|
-
c === 0x201f ||
|
|
3304
|
-
(c >= 0x2020 && c <= 0x2027) ||
|
|
3305
|
-
(c >= 0x2030 && c <= 0x2038) ||
|
|
3306
|
-
c === 0x2039 ||
|
|
3307
|
-
c === 0x203a ||
|
|
3308
|
-
(c >= 0x203b && c <= 0x203e) ||
|
|
3309
|
-
(c >= 0x2041 && c <= 0x2043) ||
|
|
3310
|
-
c === 0x2044 ||
|
|
3311
|
-
c === 0x2045 ||
|
|
3312
|
-
c === 0x2046 ||
|
|
3313
|
-
(c >= 0x2047 && c <= 0x2051) ||
|
|
3314
|
-
c === 0x2052 ||
|
|
3315
|
-
c === 0x2053 ||
|
|
3316
|
-
(c >= 0x2055 && c <= 0x205e) ||
|
|
3317
|
-
(c >= 0x2190 && c <= 0x2194) ||
|
|
3318
|
-
(c >= 0x2195 && c <= 0x2199) ||
|
|
3319
|
-
(c >= 0x219a && c <= 0x219b) ||
|
|
3320
|
-
(c >= 0x219c && c <= 0x219f) ||
|
|
3321
|
-
c === 0x21a0 ||
|
|
3322
|
-
(c >= 0x21a1 && c <= 0x21a2) ||
|
|
3323
|
-
c === 0x21a3 ||
|
|
3324
|
-
(c >= 0x21a4 && c <= 0x21a5) ||
|
|
3325
|
-
c === 0x21a6 ||
|
|
3326
|
-
(c >= 0x21a7 && c <= 0x21ad) ||
|
|
3327
|
-
c === 0x21ae ||
|
|
3328
|
-
(c >= 0x21af && c <= 0x21cd) ||
|
|
3329
|
-
(c >= 0x21ce && c <= 0x21cf) ||
|
|
3330
|
-
(c >= 0x21d0 && c <= 0x21d1) ||
|
|
3331
|
-
c === 0x21d2 ||
|
|
3332
|
-
c === 0x21d3 ||
|
|
3333
|
-
c === 0x21d4 ||
|
|
3334
|
-
(c >= 0x21d5 && c <= 0x21f3) ||
|
|
3335
|
-
(c >= 0x21f4 && c <= 0x22ff) ||
|
|
3336
|
-
(c >= 0x2300 && c <= 0x2307) ||
|
|
3337
|
-
c === 0x2308 ||
|
|
3338
|
-
c === 0x2309 ||
|
|
3339
|
-
c === 0x230a ||
|
|
3340
|
-
c === 0x230b ||
|
|
3341
|
-
(c >= 0x230c && c <= 0x231f) ||
|
|
3342
|
-
(c >= 0x2320 && c <= 0x2321) ||
|
|
3343
|
-
(c >= 0x2322 && c <= 0x2328) ||
|
|
3344
|
-
c === 0x2329 ||
|
|
3345
|
-
c === 0x232a ||
|
|
3346
|
-
(c >= 0x232b && c <= 0x237b) ||
|
|
3347
|
-
c === 0x237c ||
|
|
3348
|
-
(c >= 0x237d && c <= 0x239a) ||
|
|
3349
|
-
(c >= 0x239b && c <= 0x23b3) ||
|
|
3350
|
-
(c >= 0x23b4 && c <= 0x23db) ||
|
|
3351
|
-
(c >= 0x23dc && c <= 0x23e1) ||
|
|
3352
|
-
(c >= 0x23e2 && c <= 0x2426) ||
|
|
3353
|
-
(c >= 0x2427 && c <= 0x243f) ||
|
|
3354
|
-
(c >= 0x2440 && c <= 0x244a) ||
|
|
3355
|
-
(c >= 0x244b && c <= 0x245f) ||
|
|
3356
|
-
(c >= 0x2500 && c <= 0x25b6) ||
|
|
3357
|
-
c === 0x25b7 ||
|
|
3358
|
-
(c >= 0x25b8 && c <= 0x25c0) ||
|
|
3359
|
-
c === 0x25c1 ||
|
|
3360
|
-
(c >= 0x25c2 && c <= 0x25f7) ||
|
|
3361
|
-
(c >= 0x25f8 && c <= 0x25ff) ||
|
|
3362
|
-
(c >= 0x2600 && c <= 0x266e) ||
|
|
3363
|
-
c === 0x266f ||
|
|
3364
|
-
(c >= 0x2670 && c <= 0x2767) ||
|
|
3365
|
-
c === 0x2768 ||
|
|
3366
|
-
c === 0x2769 ||
|
|
3367
|
-
c === 0x276a ||
|
|
3368
|
-
c === 0x276b ||
|
|
3369
|
-
c === 0x276c ||
|
|
3370
|
-
c === 0x276d ||
|
|
3371
|
-
c === 0x276e ||
|
|
3372
|
-
c === 0x276f ||
|
|
3373
|
-
c === 0x2770 ||
|
|
3374
|
-
c === 0x2771 ||
|
|
3375
|
-
c === 0x2772 ||
|
|
3376
|
-
c === 0x2773 ||
|
|
3377
|
-
c === 0x2774 ||
|
|
3378
|
-
c === 0x2775 ||
|
|
3379
|
-
(c >= 0x2794 && c <= 0x27bf) ||
|
|
3380
|
-
(c >= 0x27c0 && c <= 0x27c4) ||
|
|
3381
|
-
c === 0x27c5 ||
|
|
3382
|
-
c === 0x27c6 ||
|
|
3383
|
-
(c >= 0x27c7 && c <= 0x27e5) ||
|
|
3384
|
-
c === 0x27e6 ||
|
|
3385
|
-
c === 0x27e7 ||
|
|
3386
|
-
c === 0x27e8 ||
|
|
3387
|
-
c === 0x27e9 ||
|
|
3388
|
-
c === 0x27ea ||
|
|
3389
|
-
c === 0x27eb ||
|
|
3390
|
-
c === 0x27ec ||
|
|
3391
|
-
c === 0x27ed ||
|
|
3392
|
-
c === 0x27ee ||
|
|
3393
|
-
c === 0x27ef ||
|
|
3394
|
-
(c >= 0x27f0 && c <= 0x27ff) ||
|
|
3395
|
-
(c >= 0x2800 && c <= 0x28ff) ||
|
|
3396
|
-
(c >= 0x2900 && c <= 0x2982) ||
|
|
3397
|
-
c === 0x2983 ||
|
|
3398
|
-
c === 0x2984 ||
|
|
3399
|
-
c === 0x2985 ||
|
|
3400
|
-
c === 0x2986 ||
|
|
3401
|
-
c === 0x2987 ||
|
|
3402
|
-
c === 0x2988 ||
|
|
3403
|
-
c === 0x2989 ||
|
|
3404
|
-
c === 0x298a ||
|
|
3405
|
-
c === 0x298b ||
|
|
3406
|
-
c === 0x298c ||
|
|
3407
|
-
c === 0x298d ||
|
|
3408
|
-
c === 0x298e ||
|
|
3409
|
-
c === 0x298f ||
|
|
3410
|
-
c === 0x2990 ||
|
|
3411
|
-
c === 0x2991 ||
|
|
3412
|
-
c === 0x2992 ||
|
|
3413
|
-
c === 0x2993 ||
|
|
3414
|
-
c === 0x2994 ||
|
|
3415
|
-
c === 0x2995 ||
|
|
3416
|
-
c === 0x2996 ||
|
|
3417
|
-
c === 0x2997 ||
|
|
3418
|
-
c === 0x2998 ||
|
|
3419
|
-
(c >= 0x2999 && c <= 0x29d7) ||
|
|
3420
|
-
c === 0x29d8 ||
|
|
3421
|
-
c === 0x29d9 ||
|
|
3422
|
-
c === 0x29da ||
|
|
3423
|
-
c === 0x29db ||
|
|
3424
|
-
(c >= 0x29dc && c <= 0x29fb) ||
|
|
3425
|
-
c === 0x29fc ||
|
|
3426
|
-
c === 0x29fd ||
|
|
3427
|
-
(c >= 0x29fe && c <= 0x2aff) ||
|
|
3428
|
-
(c >= 0x2b00 && c <= 0x2b2f) ||
|
|
3429
|
-
(c >= 0x2b30 && c <= 0x2b44) ||
|
|
3430
|
-
(c >= 0x2b45 && c <= 0x2b46) ||
|
|
3431
|
-
(c >= 0x2b47 && c <= 0x2b4c) ||
|
|
3432
|
-
(c >= 0x2b4d && c <= 0x2b73) ||
|
|
3433
|
-
(c >= 0x2b74 && c <= 0x2b75) ||
|
|
3434
|
-
(c >= 0x2b76 && c <= 0x2b95) ||
|
|
3435
|
-
c === 0x2b96 ||
|
|
3436
|
-
(c >= 0x2b97 && c <= 0x2bff) ||
|
|
3437
|
-
(c >= 0x2e00 && c <= 0x2e01) ||
|
|
3438
|
-
c === 0x2e02 ||
|
|
3439
|
-
c === 0x2e03 ||
|
|
3440
|
-
c === 0x2e04 ||
|
|
3441
|
-
c === 0x2e05 ||
|
|
3442
|
-
(c >= 0x2e06 && c <= 0x2e08) ||
|
|
3443
|
-
c === 0x2e09 ||
|
|
3444
|
-
c === 0x2e0a ||
|
|
3445
|
-
c === 0x2e0b ||
|
|
3446
|
-
c === 0x2e0c ||
|
|
3447
|
-
c === 0x2e0d ||
|
|
3448
|
-
(c >= 0x2e0e && c <= 0x2e16) ||
|
|
3449
|
-
c === 0x2e17 ||
|
|
3450
|
-
(c >= 0x2e18 && c <= 0x2e19) ||
|
|
3451
|
-
c === 0x2e1a ||
|
|
3452
|
-
c === 0x2e1b ||
|
|
3453
|
-
c === 0x2e1c ||
|
|
3454
|
-
c === 0x2e1d ||
|
|
3455
|
-
(c >= 0x2e1e && c <= 0x2e1f) ||
|
|
3456
|
-
c === 0x2e20 ||
|
|
3457
|
-
c === 0x2e21 ||
|
|
3458
|
-
c === 0x2e22 ||
|
|
3459
|
-
c === 0x2e23 ||
|
|
3460
|
-
c === 0x2e24 ||
|
|
3461
|
-
c === 0x2e25 ||
|
|
3462
|
-
c === 0x2e26 ||
|
|
3463
|
-
c === 0x2e27 ||
|
|
3464
|
-
c === 0x2e28 ||
|
|
3465
|
-
c === 0x2e29 ||
|
|
3466
|
-
(c >= 0x2e2a && c <= 0x2e2e) ||
|
|
3467
|
-
c === 0x2e2f ||
|
|
3468
|
-
(c >= 0x2e30 && c <= 0x2e39) ||
|
|
3469
|
-
(c >= 0x2e3a && c <= 0x2e3b) ||
|
|
3470
|
-
(c >= 0x2e3c && c <= 0x2e3f) ||
|
|
3471
|
-
c === 0x2e40 ||
|
|
3472
|
-
c === 0x2e41 ||
|
|
3473
|
-
c === 0x2e42 ||
|
|
3474
|
-
(c >= 0x2e43 && c <= 0x2e4f) ||
|
|
3475
|
-
(c >= 0x2e50 && c <= 0x2e51) ||
|
|
3476
|
-
c === 0x2e52 ||
|
|
3477
|
-
(c >= 0x2e53 && c <= 0x2e7f) ||
|
|
3478
|
-
(c >= 0x3001 && c <= 0x3003) ||
|
|
3479
|
-
c === 0x3008 ||
|
|
3480
|
-
c === 0x3009 ||
|
|
3481
|
-
c === 0x300a ||
|
|
3482
|
-
c === 0x300b ||
|
|
3483
|
-
c === 0x300c ||
|
|
3484
|
-
c === 0x300d ||
|
|
3485
|
-
c === 0x300e ||
|
|
3486
|
-
c === 0x300f ||
|
|
3487
|
-
c === 0x3010 ||
|
|
3488
|
-
c === 0x3011 ||
|
|
3489
|
-
(c >= 0x3012 && c <= 0x3013) ||
|
|
3490
|
-
c === 0x3014 ||
|
|
3491
|
-
c === 0x3015 ||
|
|
3492
|
-
c === 0x3016 ||
|
|
3493
|
-
c === 0x3017 ||
|
|
3494
|
-
c === 0x3018 ||
|
|
3495
|
-
c === 0x3019 ||
|
|
3496
|
-
c === 0x301a ||
|
|
3497
|
-
c === 0x301b ||
|
|
3498
|
-
c === 0x301c ||
|
|
3499
|
-
c === 0x301d ||
|
|
3500
|
-
(c >= 0x301e && c <= 0x301f) ||
|
|
3501
|
-
c === 0x3020 ||
|
|
3502
|
-
c === 0x3030 ||
|
|
3503
|
-
c === 0xfd3e ||
|
|
3504
|
-
c === 0xfd3f ||
|
|
3505
|
-
(c >= 0xfe45 && c <= 0xfe46));
|
|
3506
|
-
}
|
|
3507
|
-
|
|
3508
|
-
function pruneLocation(els) {
|
|
3509
|
-
els.forEach(function (el) {
|
|
3510
|
-
delete el.location;
|
|
3511
|
-
if (isSelectElement(el) || isPluralElement(el)) {
|
|
3512
|
-
for (var k in el.options) {
|
|
3513
|
-
delete el.options[k].location;
|
|
3514
|
-
pruneLocation(el.options[k].value);
|
|
3515
|
-
}
|
|
3516
|
-
}
|
|
3517
|
-
else if (isNumberElement(el) && isNumberSkeleton(el.style)) {
|
|
3518
|
-
delete el.style.location;
|
|
3519
|
-
}
|
|
3520
|
-
else if ((isDateElement(el) || isTimeElement(el)) &&
|
|
3521
|
-
isDateTimeSkeleton(el.style)) {
|
|
3522
|
-
delete el.style.location;
|
|
3523
|
-
}
|
|
3524
|
-
else if (isTagElement(el)) {
|
|
3525
|
-
pruneLocation(el.children);
|
|
3526
|
-
}
|
|
3527
|
-
});
|
|
3528
|
-
}
|
|
3529
|
-
function parse(message, opts) {
|
|
3530
|
-
if (opts === void 0) { opts = {}; }
|
|
3531
|
-
opts = __assign({ shouldParseSkeletons: true, requiresOtherClause: true }, opts);
|
|
3532
|
-
var result = new Parser(message, opts).parse();
|
|
3533
|
-
if (result.err) {
|
|
3534
|
-
var error = SyntaxError(ErrorKind[result.err.kind]);
|
|
3535
|
-
// @ts-expect-error Assign to error object
|
|
3536
|
-
error.location = result.err.location;
|
|
3537
|
-
// @ts-expect-error Assign to error object
|
|
3538
|
-
error.originalMessage = result.err.message;
|
|
3539
|
-
throw error;
|
|
3540
|
-
}
|
|
3541
|
-
if (!(opts === null || opts === void 0 ? void 0 : opts.captureLocation)) {
|
|
3542
|
-
pruneLocation(result.val);
|
|
3543
|
-
}
|
|
3544
|
-
return result.val;
|
|
3545
|
-
}
|
|
3546
|
-
|
|
3547
|
-
var ErrorCode;
|
|
3548
|
-
(function (ErrorCode) {
|
|
3549
|
-
// When we have a placeholder but no value to format
|
|
3550
|
-
ErrorCode["MISSING_VALUE"] = "MISSING_VALUE";
|
|
3551
|
-
// When value supplied is invalid
|
|
3552
|
-
ErrorCode["INVALID_VALUE"] = "INVALID_VALUE";
|
|
3553
|
-
// When we need specific Intl API but it's not available
|
|
3554
|
-
ErrorCode["MISSING_INTL_API"] = "MISSING_INTL_API";
|
|
3555
|
-
})(ErrorCode || (ErrorCode = {}));
|
|
3556
|
-
var FormatError = /** @class */ (function (_super) {
|
|
3557
|
-
__extends(FormatError, _super);
|
|
3558
|
-
function FormatError(msg, code, originalMessage) {
|
|
3559
|
-
var _this = _super.call(this, msg) || this;
|
|
3560
|
-
_this.code = code;
|
|
3561
|
-
_this.originalMessage = originalMessage;
|
|
3562
|
-
return _this;
|
|
3563
|
-
}
|
|
3564
|
-
FormatError.prototype.toString = function () {
|
|
3565
|
-
return "[formatjs Error: ".concat(this.code, "] ").concat(this.message);
|
|
3566
|
-
};
|
|
3567
|
-
return FormatError;
|
|
3568
|
-
}(Error));
|
|
3569
|
-
var InvalidValueError = /** @class */ (function (_super) {
|
|
3570
|
-
__extends(InvalidValueError, _super);
|
|
3571
|
-
function InvalidValueError(variableId, value, options, originalMessage) {
|
|
3572
|
-
return _super.call(this, "Invalid values for \"".concat(variableId, "\": \"").concat(value, "\". Options are \"").concat(Object.keys(options).join('", "'), "\""), ErrorCode.INVALID_VALUE, originalMessage) || this;
|
|
3573
|
-
}
|
|
3574
|
-
return InvalidValueError;
|
|
3575
|
-
}(FormatError));
|
|
3576
|
-
var InvalidValueTypeError = /** @class */ (function (_super) {
|
|
3577
|
-
__extends(InvalidValueTypeError, _super);
|
|
3578
|
-
function InvalidValueTypeError(value, type, originalMessage) {
|
|
3579
|
-
return _super.call(this, "Value for \"".concat(value, "\" must be of type ").concat(type), ErrorCode.INVALID_VALUE, originalMessage) || this;
|
|
3580
|
-
}
|
|
3581
|
-
return InvalidValueTypeError;
|
|
3582
|
-
}(FormatError));
|
|
3583
|
-
var MissingValueError = /** @class */ (function (_super) {
|
|
3584
|
-
__extends(MissingValueError, _super);
|
|
3585
|
-
function MissingValueError(variableId, originalMessage) {
|
|
3586
|
-
return _super.call(this, "The intl string context variable \"".concat(variableId, "\" was not provided to the string \"").concat(originalMessage, "\""), ErrorCode.MISSING_VALUE, originalMessage) || this;
|
|
3587
|
-
}
|
|
3588
|
-
return MissingValueError;
|
|
3589
|
-
}(FormatError));
|
|
3590
|
-
|
|
3591
|
-
var PART_TYPE;
|
|
3592
|
-
(function (PART_TYPE) {
|
|
3593
|
-
PART_TYPE[PART_TYPE["literal"] = 0] = "literal";
|
|
3594
|
-
PART_TYPE[PART_TYPE["object"] = 1] = "object";
|
|
3595
|
-
})(PART_TYPE || (PART_TYPE = {}));
|
|
3596
|
-
function mergeLiteral(parts) {
|
|
3597
|
-
if (parts.length < 2) {
|
|
3598
|
-
return parts;
|
|
3599
|
-
}
|
|
3600
|
-
return parts.reduce(function (all, part) {
|
|
3601
|
-
var lastPart = all[all.length - 1];
|
|
3602
|
-
if (!lastPart ||
|
|
3603
|
-
lastPart.type !== PART_TYPE.literal ||
|
|
3604
|
-
part.type !== PART_TYPE.literal) {
|
|
3605
|
-
all.push(part);
|
|
3606
|
-
}
|
|
3607
|
-
else {
|
|
3608
|
-
lastPart.value += part.value;
|
|
3609
|
-
}
|
|
3610
|
-
return all;
|
|
3611
|
-
}, []);
|
|
3612
|
-
}
|
|
3613
|
-
function isFormatXMLElementFn(el) {
|
|
3614
|
-
return typeof el === 'function';
|
|
3615
|
-
}
|
|
3616
|
-
// TODO(skeleton): add skeleton support
|
|
3617
|
-
function formatToParts(els, locales, formatters, formats, values, currentPluralValue,
|
|
3618
|
-
// For debugging
|
|
3619
|
-
originalMessage) {
|
|
3620
|
-
// Hot path for straight simple msg translations
|
|
3621
|
-
if (els.length === 1 && isLiteralElement(els[0])) {
|
|
3622
|
-
return [
|
|
3623
|
-
{
|
|
3624
|
-
type: PART_TYPE.literal,
|
|
3625
|
-
value: els[0].value,
|
|
3626
|
-
},
|
|
3627
|
-
];
|
|
3628
|
-
}
|
|
3629
|
-
var result = [];
|
|
3630
|
-
for (var _i = 0, els_1 = els; _i < els_1.length; _i++) {
|
|
3631
|
-
var el = els_1[_i];
|
|
3632
|
-
// Exit early for string parts.
|
|
3633
|
-
if (isLiteralElement(el)) {
|
|
3634
|
-
result.push({
|
|
3635
|
-
type: PART_TYPE.literal,
|
|
3636
|
-
value: el.value,
|
|
3637
|
-
});
|
|
3638
|
-
continue;
|
|
3639
|
-
}
|
|
3640
|
-
// TODO: should this part be literal type?
|
|
3641
|
-
// Replace `#` in plural rules with the actual numeric value.
|
|
3642
|
-
if (isPoundElement(el)) {
|
|
3643
|
-
if (typeof currentPluralValue === 'number') {
|
|
3644
|
-
result.push({
|
|
3645
|
-
type: PART_TYPE.literal,
|
|
3646
|
-
value: formatters.getNumberFormat(locales).format(currentPluralValue),
|
|
3647
|
-
});
|
|
3648
|
-
}
|
|
3649
|
-
continue;
|
|
3650
|
-
}
|
|
3651
|
-
var varName = el.value;
|
|
3652
|
-
// Enforce that all required values are provided by the caller.
|
|
3653
|
-
if (!(values && varName in values)) {
|
|
3654
|
-
throw new MissingValueError(varName, originalMessage);
|
|
3655
|
-
}
|
|
3656
|
-
var value = values[varName];
|
|
3657
|
-
if (isArgumentElement(el)) {
|
|
3658
|
-
if (!value || typeof value === 'string' || typeof value === 'number') {
|
|
3659
|
-
value =
|
|
3660
|
-
typeof value === 'string' || typeof value === 'number'
|
|
3661
|
-
? String(value)
|
|
3662
|
-
: '';
|
|
3663
|
-
}
|
|
3664
|
-
result.push({
|
|
3665
|
-
type: typeof value === 'string' ? PART_TYPE.literal : PART_TYPE.object,
|
|
3666
|
-
value: value,
|
|
3667
|
-
});
|
|
3668
|
-
continue;
|
|
3669
|
-
}
|
|
3670
|
-
// Recursively format plural and select parts' option — which can be a
|
|
3671
|
-
// nested pattern structure. The choosing of the option to use is
|
|
3672
|
-
// abstracted-by and delegated-to the part helper object.
|
|
3673
|
-
if (isDateElement(el)) {
|
|
3674
|
-
var style = typeof el.style === 'string'
|
|
3675
|
-
? formats.date[el.style]
|
|
3676
|
-
: isDateTimeSkeleton(el.style)
|
|
3677
|
-
? el.style.parsedOptions
|
|
3678
|
-
: undefined;
|
|
3679
|
-
result.push({
|
|
3680
|
-
type: PART_TYPE.literal,
|
|
3681
|
-
value: formatters
|
|
3682
|
-
.getDateTimeFormat(locales, style)
|
|
3683
|
-
.format(value),
|
|
3684
|
-
});
|
|
3685
|
-
continue;
|
|
3686
|
-
}
|
|
3687
|
-
if (isTimeElement(el)) {
|
|
3688
|
-
var style = typeof el.style === 'string'
|
|
3689
|
-
? formats.time[el.style]
|
|
3690
|
-
: isDateTimeSkeleton(el.style)
|
|
3691
|
-
? el.style.parsedOptions
|
|
3692
|
-
: formats.time.medium;
|
|
3693
|
-
result.push({
|
|
3694
|
-
type: PART_TYPE.literal,
|
|
3695
|
-
value: formatters
|
|
3696
|
-
.getDateTimeFormat(locales, style)
|
|
3697
|
-
.format(value),
|
|
3698
|
-
});
|
|
3699
|
-
continue;
|
|
3700
|
-
}
|
|
3701
|
-
if (isNumberElement(el)) {
|
|
3702
|
-
var style = typeof el.style === 'string'
|
|
3703
|
-
? formats.number[el.style]
|
|
3704
|
-
: isNumberSkeleton(el.style)
|
|
3705
|
-
? el.style.parsedOptions
|
|
3706
|
-
: undefined;
|
|
3707
|
-
if (style && style.scale) {
|
|
3708
|
-
value =
|
|
3709
|
-
value *
|
|
3710
|
-
(style.scale || 1);
|
|
3711
|
-
}
|
|
3712
|
-
result.push({
|
|
3713
|
-
type: PART_TYPE.literal,
|
|
3714
|
-
value: formatters
|
|
3715
|
-
.getNumberFormat(locales, style)
|
|
3716
|
-
.format(value),
|
|
3717
|
-
});
|
|
3718
|
-
continue;
|
|
3719
|
-
}
|
|
3720
|
-
if (isTagElement(el)) {
|
|
3721
|
-
var children = el.children, value_1 = el.value;
|
|
3722
|
-
var formatFn = values[value_1];
|
|
3723
|
-
if (!isFormatXMLElementFn(formatFn)) {
|
|
3724
|
-
throw new InvalidValueTypeError(value_1, 'function', originalMessage);
|
|
3725
|
-
}
|
|
3726
|
-
var parts = formatToParts(children, locales, formatters, formats, values, currentPluralValue);
|
|
3727
|
-
var chunks = formatFn(parts.map(function (p) { return p.value; }));
|
|
3728
|
-
if (!Array.isArray(chunks)) {
|
|
3729
|
-
chunks = [chunks];
|
|
3730
|
-
}
|
|
3731
|
-
result.push.apply(result, chunks.map(function (c) {
|
|
3732
|
-
return {
|
|
3733
|
-
type: typeof c === 'string' ? PART_TYPE.literal : PART_TYPE.object,
|
|
3734
|
-
value: c,
|
|
3735
|
-
};
|
|
3736
|
-
}));
|
|
3737
|
-
}
|
|
3738
|
-
if (isSelectElement(el)) {
|
|
3739
|
-
var opt = el.options[value] || el.options.other;
|
|
3740
|
-
if (!opt) {
|
|
3741
|
-
throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);
|
|
3742
|
-
}
|
|
3743
|
-
result.push.apply(result, formatToParts(opt.value, locales, formatters, formats, values));
|
|
3744
|
-
continue;
|
|
3745
|
-
}
|
|
3746
|
-
if (isPluralElement(el)) {
|
|
3747
|
-
var opt = el.options["=".concat(value)];
|
|
3748
|
-
if (!opt) {
|
|
3749
|
-
if (!Intl.PluralRules) {
|
|
3750
|
-
throw new FormatError("Intl.PluralRules is not available in this environment.\nTry polyfilling it using \"@formatjs/intl-pluralrules\"\n", ErrorCode.MISSING_INTL_API, originalMessage);
|
|
3751
|
-
}
|
|
3752
|
-
var rule = formatters
|
|
3753
|
-
.getPluralRules(locales, { type: el.pluralType })
|
|
3754
|
-
.select(value - (el.offset || 0));
|
|
3755
|
-
opt = el.options[rule] || el.options.other;
|
|
3756
|
-
}
|
|
3757
|
-
if (!opt) {
|
|
3758
|
-
throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);
|
|
3759
|
-
}
|
|
3760
|
-
result.push.apply(result, formatToParts(opt.value, locales, formatters, formats, values, value - (el.offset || 0)));
|
|
3761
|
-
continue;
|
|
3762
|
-
}
|
|
3763
|
-
}
|
|
3764
|
-
return mergeLiteral(result);
|
|
3765
|
-
}
|
|
3766
|
-
|
|
3767
|
-
/*
|
|
3768
|
-
Copyright (c) 2014, Yahoo! Inc. All rights reserved.
|
|
3769
|
-
Copyrights licensed under the New BSD License.
|
|
3770
|
-
See the accompanying LICENSE file for terms.
|
|
3771
|
-
*/
|
|
3772
|
-
// -- MessageFormat --------------------------------------------------------
|
|
3773
|
-
function mergeConfig(c1, c2) {
|
|
3774
|
-
if (!c2) {
|
|
3775
|
-
return c1;
|
|
3776
|
-
}
|
|
3777
|
-
return __assign(__assign(__assign({}, (c1 || {})), (c2 || {})), Object.keys(c1).reduce(function (all, k) {
|
|
3778
|
-
all[k] = __assign(__assign({}, c1[k]), (c2[k] || {}));
|
|
3779
|
-
return all;
|
|
3780
|
-
}, {}));
|
|
3781
|
-
}
|
|
3782
|
-
function mergeConfigs(defaultConfig, configs) {
|
|
3783
|
-
if (!configs) {
|
|
3784
|
-
return defaultConfig;
|
|
3785
|
-
}
|
|
3786
|
-
return Object.keys(defaultConfig).reduce(function (all, k) {
|
|
3787
|
-
all[k] = mergeConfig(defaultConfig[k], configs[k]);
|
|
3788
|
-
return all;
|
|
3789
|
-
}, __assign({}, defaultConfig));
|
|
3790
|
-
}
|
|
3791
|
-
function createFastMemoizeCache(store) {
|
|
3792
|
-
return {
|
|
3793
|
-
create: function () {
|
|
3794
|
-
return {
|
|
3795
|
-
get: function (key) {
|
|
3796
|
-
return store[key];
|
|
3797
|
-
},
|
|
3798
|
-
set: function (key, value) {
|
|
3799
|
-
store[key] = value;
|
|
3800
|
-
},
|
|
3801
|
-
};
|
|
3802
|
-
},
|
|
3803
|
-
};
|
|
3804
|
-
}
|
|
3805
|
-
function createDefaultFormatters(cache) {
|
|
3806
|
-
if (cache === void 0) { cache = {
|
|
3807
|
-
number: {},
|
|
3808
|
-
dateTime: {},
|
|
3809
|
-
pluralRules: {},
|
|
3810
|
-
}; }
|
|
3811
|
-
return {
|
|
3812
|
-
getNumberFormat: memoize(function () {
|
|
3813
|
-
var _a;
|
|
3814
|
-
var args = [];
|
|
3815
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3816
|
-
args[_i] = arguments[_i];
|
|
3817
|
-
}
|
|
3818
|
-
return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
3819
|
-
}, {
|
|
3820
|
-
cache: createFastMemoizeCache(cache.number),
|
|
3821
|
-
strategy: strategies.variadic,
|
|
3822
|
-
}),
|
|
3823
|
-
getDateTimeFormat: memoize(function () {
|
|
3824
|
-
var _a;
|
|
3825
|
-
var args = [];
|
|
3826
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3827
|
-
args[_i] = arguments[_i];
|
|
3828
|
-
}
|
|
3829
|
-
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
3830
|
-
}, {
|
|
3831
|
-
cache: createFastMemoizeCache(cache.dateTime),
|
|
3832
|
-
strategy: strategies.variadic,
|
|
3833
|
-
}),
|
|
3834
|
-
getPluralRules: memoize(function () {
|
|
3835
|
-
var _a;
|
|
3836
|
-
var args = [];
|
|
3837
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3838
|
-
args[_i] = arguments[_i];
|
|
3839
|
-
}
|
|
3840
|
-
return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
3841
|
-
}, {
|
|
3842
|
-
cache: createFastMemoizeCache(cache.pluralRules),
|
|
3843
|
-
strategy: strategies.variadic,
|
|
3844
|
-
}),
|
|
3845
|
-
};
|
|
3846
|
-
}
|
|
3847
|
-
var IntlMessageFormat = /** @class */ (function () {
|
|
3848
|
-
function IntlMessageFormat(message, locales, overrideFormats, opts) {
|
|
3849
|
-
if (locales === void 0) { locales = IntlMessageFormat.defaultLocale; }
|
|
3850
|
-
var _this = this;
|
|
3851
|
-
this.formatterCache = {
|
|
3852
|
-
number: {},
|
|
3853
|
-
dateTime: {},
|
|
3854
|
-
pluralRules: {},
|
|
3855
|
-
};
|
|
3856
|
-
this.format = function (values) {
|
|
3857
|
-
var parts = _this.formatToParts(values);
|
|
3858
|
-
// Hot path for straight simple msg translations
|
|
3859
|
-
if (parts.length === 1) {
|
|
3860
|
-
return parts[0].value;
|
|
3861
|
-
}
|
|
3862
|
-
var result = parts.reduce(function (all, part) {
|
|
3863
|
-
if (!all.length ||
|
|
3864
|
-
part.type !== PART_TYPE.literal ||
|
|
3865
|
-
typeof all[all.length - 1] !== 'string') {
|
|
3866
|
-
all.push(part.value);
|
|
3867
|
-
}
|
|
3868
|
-
else {
|
|
3869
|
-
all[all.length - 1] += part.value;
|
|
3870
|
-
}
|
|
3871
|
-
return all;
|
|
3872
|
-
}, []);
|
|
3873
|
-
if (result.length <= 1) {
|
|
3874
|
-
return result[0] || '';
|
|
3875
|
-
}
|
|
3876
|
-
return result;
|
|
3877
|
-
};
|
|
3878
|
-
this.formatToParts = function (values) {
|
|
3879
|
-
return formatToParts(_this.ast, _this.locales, _this.formatters, _this.formats, values, undefined, _this.message);
|
|
3880
|
-
};
|
|
3881
|
-
this.resolvedOptions = function () {
|
|
3882
|
-
var _a;
|
|
3883
|
-
return ({
|
|
3884
|
-
locale: ((_a = _this.resolvedLocale) === null || _a === void 0 ? void 0 : _a.toString()) ||
|
|
3885
|
-
Intl.NumberFormat.supportedLocalesOf(_this.locales)[0],
|
|
3886
|
-
});
|
|
3887
|
-
};
|
|
3888
|
-
this.getAst = function () { return _this.ast; };
|
|
3889
|
-
// Defined first because it's used to build the format pattern.
|
|
3890
|
-
this.locales = locales;
|
|
3891
|
-
this.resolvedLocale = IntlMessageFormat.resolveLocale(locales);
|
|
3892
|
-
if (typeof message === 'string') {
|
|
3893
|
-
this.message = message;
|
|
3894
|
-
if (!IntlMessageFormat.__parse) {
|
|
3895
|
-
throw new TypeError('IntlMessageFormat.__parse must be set to process `message` of type `string`');
|
|
3896
|
-
}
|
|
3897
|
-
var _a = opts || {}, parseOpts = __rest(_a, ["formatters"]);
|
|
3898
|
-
// Parse string messages into an AST.
|
|
3899
|
-
this.ast = IntlMessageFormat.__parse(message, __assign(__assign({}, parseOpts), { locale: this.resolvedLocale }));
|
|
3900
|
-
}
|
|
3901
|
-
else {
|
|
3902
|
-
this.ast = message;
|
|
3903
|
-
}
|
|
3904
|
-
if (!Array.isArray(this.ast)) {
|
|
3905
|
-
throw new TypeError('A message must be provided as a String or AST.');
|
|
3906
|
-
}
|
|
3907
|
-
// Creates a new object with the specified `formats` merged with the default
|
|
3908
|
-
// formats.
|
|
3909
|
-
this.formats = mergeConfigs(IntlMessageFormat.formats, overrideFormats);
|
|
3910
|
-
this.formatters =
|
|
3911
|
-
(opts && opts.formatters) || createDefaultFormatters(this.formatterCache);
|
|
3912
|
-
}
|
|
3913
|
-
Object.defineProperty(IntlMessageFormat, "defaultLocale", {
|
|
3914
|
-
get: function () {
|
|
3915
|
-
if (!IntlMessageFormat.memoizedDefaultLocale) {
|
|
3916
|
-
IntlMessageFormat.memoizedDefaultLocale =
|
|
3917
|
-
new Intl.NumberFormat().resolvedOptions().locale;
|
|
3918
|
-
}
|
|
3919
|
-
return IntlMessageFormat.memoizedDefaultLocale;
|
|
3920
|
-
},
|
|
3921
|
-
enumerable: false,
|
|
3922
|
-
configurable: true
|
|
3923
|
-
});
|
|
3924
|
-
IntlMessageFormat.memoizedDefaultLocale = null;
|
|
3925
|
-
IntlMessageFormat.resolveLocale = function (locales) {
|
|
3926
|
-
if (typeof Intl.Locale === 'undefined') {
|
|
3927
|
-
return;
|
|
3928
|
-
}
|
|
3929
|
-
var supportedLocales = Intl.NumberFormat.supportedLocalesOf(locales);
|
|
3930
|
-
if (supportedLocales.length > 0) {
|
|
3931
|
-
return new Intl.Locale(supportedLocales[0]);
|
|
3932
|
-
}
|
|
3933
|
-
return new Intl.Locale(typeof locales === 'string' ? locales : locales[0]);
|
|
3934
|
-
};
|
|
3935
|
-
IntlMessageFormat.__parse = parse;
|
|
3936
|
-
// Default format options used as the prototype of the `formats` provided to the
|
|
3937
|
-
// constructor. These are used when constructing the internal Intl.NumberFormat
|
|
3938
|
-
// and Intl.DateTimeFormat instances.
|
|
3939
|
-
IntlMessageFormat.formats = {
|
|
3940
|
-
number: {
|
|
3941
|
-
integer: {
|
|
3942
|
-
maximumFractionDigits: 0,
|
|
3943
|
-
},
|
|
3944
|
-
currency: {
|
|
3945
|
-
style: 'currency',
|
|
3946
|
-
},
|
|
3947
|
-
percent: {
|
|
3948
|
-
style: 'percent',
|
|
3949
|
-
},
|
|
3950
|
-
},
|
|
3951
|
-
date: {
|
|
3952
|
-
short: {
|
|
3953
|
-
month: 'numeric',
|
|
3954
|
-
day: 'numeric',
|
|
3955
|
-
year: '2-digit',
|
|
3956
|
-
},
|
|
3957
|
-
medium: {
|
|
3958
|
-
month: 'short',
|
|
3959
|
-
day: 'numeric',
|
|
3960
|
-
year: 'numeric',
|
|
3961
|
-
},
|
|
3962
|
-
long: {
|
|
3963
|
-
month: 'long',
|
|
3964
|
-
day: 'numeric',
|
|
3965
|
-
year: 'numeric',
|
|
3966
|
-
},
|
|
3967
|
-
full: {
|
|
3968
|
-
weekday: 'long',
|
|
3969
|
-
month: 'long',
|
|
3970
|
-
day: 'numeric',
|
|
3971
|
-
year: 'numeric',
|
|
3972
|
-
},
|
|
3973
|
-
},
|
|
3974
|
-
time: {
|
|
3975
|
-
short: {
|
|
3976
|
-
hour: 'numeric',
|
|
3977
|
-
minute: 'numeric',
|
|
3978
|
-
},
|
|
3979
|
-
medium: {
|
|
3980
|
-
hour: 'numeric',
|
|
3981
|
-
minute: 'numeric',
|
|
3982
|
-
second: 'numeric',
|
|
3983
|
-
},
|
|
3984
|
-
long: {
|
|
3985
|
-
hour: 'numeric',
|
|
3986
|
-
minute: 'numeric',
|
|
3987
|
-
second: 'numeric',
|
|
3988
|
-
timeZoneName: 'short',
|
|
3989
|
-
},
|
|
3990
|
-
full: {
|
|
3991
|
-
hour: 'numeric',
|
|
3992
|
-
minute: 'numeric',
|
|
3993
|
-
second: 'numeric',
|
|
3994
|
-
timeZoneName: 'short',
|
|
3995
|
-
},
|
|
3996
|
-
},
|
|
3997
|
-
};
|
|
3998
|
-
return IntlMessageFormat;
|
|
3999
|
-
}());
|
|
4000
|
-
|
|
4001
|
-
const resourceCache = {};
|
|
4002
|
-
const determineFetchUrl = (locale = 'en') => getAssetPath(`i18n/genesys-webcomponents.i18n.${locale}.json`);
|
|
4003
|
-
const fetchResources = async (componentName, locale) => {
|
|
4004
|
-
if (!resourceCache[locale]) {
|
|
4005
|
-
const url = determineFetchUrl(locale);
|
|
4006
|
-
const response = await fetch(url);
|
|
4007
|
-
const resources = await response.json();
|
|
4008
|
-
resourceCache[locale] = resources;
|
|
4009
|
-
}
|
|
4010
|
-
return resourceCache[locale][componentName];
|
|
4011
|
-
};
|
|
4012
|
-
|
|
4013
|
-
var locales = [
|
|
4014
|
-
"ar",
|
|
4015
|
-
"cs",
|
|
4016
|
-
"da",
|
|
4017
|
-
"de",
|
|
4018
|
-
"en",
|
|
4019
|
-
"es-es",
|
|
4020
|
-
"es",
|
|
4021
|
-
"fi",
|
|
4022
|
-
"fr-ca",
|
|
4023
|
-
"fr",
|
|
4024
|
-
"he",
|
|
4025
|
-
"hi",
|
|
4026
|
-
"it",
|
|
4027
|
-
"ja",
|
|
4028
|
-
"ko",
|
|
4029
|
-
"nl",
|
|
4030
|
-
"no",
|
|
4031
|
-
"pl",
|
|
4032
|
-
"pt-br",
|
|
4033
|
-
"pt-pt",
|
|
4034
|
-
"ru",
|
|
4035
|
-
"sv",
|
|
4036
|
-
"th",
|
|
4037
|
-
"tr",
|
|
4038
|
-
"uk",
|
|
4039
|
-
"zh-cn",
|
|
4040
|
-
"zh-tw"
|
|
4041
|
-
];
|
|
4042
|
-
|
|
4043
|
-
const ar = 6;
|
|
4044
|
-
const cs = 1;
|
|
4045
|
-
const da = 1;
|
|
4046
|
-
const de = 1;
|
|
4047
|
-
const en = 0;
|
|
4048
|
-
const es = 1;
|
|
4049
|
-
const fi = 1;
|
|
4050
|
-
const fr = 1;
|
|
4051
|
-
const he = 0;
|
|
4052
|
-
const hi = 0;
|
|
4053
|
-
const it = 1;
|
|
4054
|
-
const ja = 0;
|
|
4055
|
-
const ko = 0;
|
|
4056
|
-
const nl = 1;
|
|
4057
|
-
const no = 1;
|
|
4058
|
-
const pl = 1;
|
|
4059
|
-
const ru = 1;
|
|
4060
|
-
const sv = 1;
|
|
4061
|
-
const th = 0;
|
|
4062
|
-
const tr = 1;
|
|
4063
|
-
const uk = 1;
|
|
4064
|
-
var startOfWeekDataUntyped = {
|
|
4065
|
-
ar: ar,
|
|
4066
|
-
cs: cs,
|
|
4067
|
-
da: da,
|
|
4068
|
-
de: de,
|
|
4069
|
-
en: en,
|
|
4070
|
-
"es-es": 1,
|
|
4071
|
-
es: es,
|
|
4072
|
-
fi: fi,
|
|
4073
|
-
"fr-ca": 0,
|
|
4074
|
-
fr: fr,
|
|
4075
|
-
he: he,
|
|
4076
|
-
hi: hi,
|
|
4077
|
-
it: it,
|
|
4078
|
-
ja: ja,
|
|
4079
|
-
ko: ko,
|
|
4080
|
-
nl: nl,
|
|
4081
|
-
no: no,
|
|
4082
|
-
pl: pl,
|
|
4083
|
-
"pt-br": 0,
|
|
4084
|
-
"pt-pt": 0,
|
|
4085
|
-
ru: ru,
|
|
4086
|
-
sv: sv,
|
|
4087
|
-
th: th,
|
|
4088
|
-
tr: tr,
|
|
4089
|
-
uk: uk,
|
|
4090
|
-
"zh-cn": 1,
|
|
4091
|
-
"zh-tw": 0
|
|
4092
|
-
};
|
|
4093
|
-
|
|
4094
|
-
const DEFAULT_LOCALE = 'en';
|
|
4095
|
-
async function buildI18nForComponent(component, defaultResources, parentComponent) {
|
|
4096
|
-
let resources = defaultResources;
|
|
4097
|
-
let locale = 'en';
|
|
4098
|
-
if (component !== undefined) {
|
|
4099
|
-
locale = getDesiredLocale(component);
|
|
4100
|
-
resources = await getComponentI18nResources(component, defaultResources, locale, parentComponent);
|
|
4101
|
-
}
|
|
4102
|
-
const intlFormats = Object.entries(resources).reduce((map, [key, val]) => {
|
|
4103
|
-
map.set(key, new IntlMessageFormat(val, locale));
|
|
4104
|
-
return map;
|
|
4105
|
-
}, new Map());
|
|
4106
|
-
const defaultFormats = Object.entries(defaultResources).reduce((map, [key, val]) => {
|
|
4107
|
-
map.set(key, new IntlMessageFormat(val, DEFAULT_LOCALE));
|
|
4108
|
-
return map;
|
|
4109
|
-
}, new Map());
|
|
4110
|
-
return (resourceKey, context) => {
|
|
4111
|
-
var _a, _b;
|
|
4112
|
-
let i18nString = (_a = intlFormats.get(resourceKey)) === null || _a === void 0 ? void 0 : _a.format(context);
|
|
4113
|
-
if (!i18nString) {
|
|
4114
|
-
i18nString = (_b = defaultFormats.get(resourceKey)) === null || _b === void 0 ? void 0 : _b.format(context);
|
|
4115
|
-
console.warn(`No localized string available for "${resourceKey}-${i18nString}" for "${locale}" locale. Falling back to English translation.`);
|
|
4116
|
-
}
|
|
4117
|
-
return i18nString;
|
|
4118
|
-
};
|
|
4119
|
-
}
|
|
4120
|
-
async function getComponentI18nResources(component, defaultResources, locale, parentComponent) {
|
|
4121
|
-
const componentName = parentComponent ||
|
|
4122
|
-
component.tagName.toLocaleLowerCase().replace(/-beta$/, '');
|
|
4123
|
-
let resources;
|
|
4124
|
-
if (component['i18n-resources']) {
|
|
4125
|
-
resources = component['i18n-resources'];
|
|
4126
|
-
}
|
|
4127
|
-
else if (locale !== DEFAULT_LOCALE) {
|
|
4128
|
-
try {
|
|
4129
|
-
resources = await fetchResources(componentName, locale);
|
|
4130
|
-
}
|
|
4131
|
-
catch (_a) {
|
|
4132
|
-
resources = null;
|
|
4133
|
-
}
|
|
4134
|
-
}
|
|
4135
|
-
if (!resources) {
|
|
4136
|
-
resources = defaultResources;
|
|
4137
|
-
}
|
|
4138
|
-
return resources;
|
|
4139
|
-
}
|
|
4140
|
-
function getDesiredLocale(element) {
|
|
4141
|
-
const locale = findLocaleInDom(element);
|
|
4142
|
-
const lang = locale.split(/[_-]/)[0];
|
|
4143
|
-
if (locales.indexOf(locale) >= 0) {
|
|
4144
|
-
return locale;
|
|
4145
|
-
}
|
|
4146
|
-
else if (locales.indexOf(lang) >= 0) {
|
|
4147
|
-
return lang;
|
|
4148
|
-
}
|
|
4149
|
-
else {
|
|
4150
|
-
return DEFAULT_LOCALE;
|
|
4151
|
-
}
|
|
4152
|
-
}
|
|
4153
|
-
function findLocaleInDom(element) {
|
|
4154
|
-
const closestElement = getClosestElement('[lang]', element);
|
|
4155
|
-
if (closestElement && closestElement.lang) {
|
|
4156
|
-
return closestElement.lang.toLowerCase();
|
|
4157
|
-
}
|
|
4158
|
-
else {
|
|
4159
|
-
return DEFAULT_LOCALE;
|
|
4160
|
-
}
|
|
4161
|
-
}
|
|
4162
|
-
/**
|
|
4163
|
-
* Get the 0-indexed first day of the week for a given locale, where 0 represents
|
|
4164
|
-
* Sunday. This should be considered deprecated, as newer browser APIs use
|
|
4165
|
-
* a different day-of-week indexing scheme, provided by `getFirstDayOfWeek`
|
|
4166
|
-
* @param locale
|
|
4167
|
-
* @returns A number representing the first day of the week where 0 is Sunday
|
|
4168
|
-
*/
|
|
4169
|
-
function getStartOfWeek(locale = DEFAULT_LOCALE) {
|
|
4170
|
-
const startOfWeekData = startOfWeekDataUntyped;
|
|
4171
|
-
return (startOfWeekData[locale]
|
|
4172
|
-
? startOfWeekData[locale]
|
|
4173
|
-
: startOfWeekData[DEFAULT_LOCALE]);
|
|
4174
|
-
}
|
|
4175
|
-
function getFirstDayOfWeek(locale = DEFAULT_LOCALE) {
|
|
4176
|
-
// Eventually, we can hopefully convert all of this to:
|
|
4177
|
-
// `new Locale(locale).getWeekInfo().firstDay`
|
|
4178
|
-
// Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo
|
|
4179
|
-
const legacyFirstDay = getStartOfWeek(locale);
|
|
4180
|
-
// This looks crazy, but it's the following:
|
|
4181
|
-
// - Shift legacy days "left" 1 place: `legacyFirstDay - 1`
|
|
4182
|
-
// - Take a true mathematical modulo: `((n % d) + d) % d` (where d is 7)
|
|
4183
|
-
// to get back to the correct range
|
|
4184
|
-
// - Add 1 to make the list 1-indexed.
|
|
4185
|
-
return (((((legacyFirstDay - 1) % 7) + 7) % 7) + 1);
|
|
4186
|
-
}
|
|
4187
|
-
|
|
4188
|
-
export { getFirstDayOfWeek as a, buildI18nForComponent as b, getStartOfWeek as c, getDesiredLocale as g, locales as l };
|