@saasquatch/mint-components 1.7.0-7 → 1.7.0-9
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/AsYouType-6788393a.js +3874 -0
- package/dist/cjs/{GenericTableView-6b0d1f93.js → GenericTableView-fa0cb936.js} +1 -1
- package/dist/cjs/{JSS-a75f3a9a.js → JSS-c73206b7.js} +35 -19
- package/dist/cjs/{ShadowViewAddon-260da162.js → ShadowViewAddon-970dff24.js} +172 -194
- package/dist/cjs/{global-a7614907.js → global-97364373.js} +4 -4
- package/dist/cjs/{index.module-1c799b1f.js → index.module-d3a28293.js} +6887 -6843
- package/dist/cjs/loader.cjs.js +5 -6
- package/dist/cjs/{luxon-59ca7d19.js → luxon-479fc825.js} +1 -1
- package/dist/cjs/mint-components.cjs.js +5 -6
- package/dist/cjs/{re-render-c02c16c0.js → re-render-7b0c34bb.js} +5 -5
- package/dist/cjs/{sqm-asset-card-view-07420209.js → sqm-asset-card-view-7e16757a.js} +1 -1
- package/dist/cjs/sqm-asset-card.cjs.entry.js +6 -7
- package/dist/cjs/sqm-big-stat_35.cjs.entry.js +383 -4308
- package/dist/cjs/sqm-empty_5.cjs.entry.js +4 -6
- package/dist/cjs/sqm-form-message.cjs.entry.js +1 -1
- package/dist/cjs/sqm-graphql-client-provider.cjs.entry.js +7 -8
- package/dist/cjs/sqm-hamburger-menu.cjs.entry.js +160 -0
- package/dist/cjs/sqm-header-logo.cjs.entry.js +30 -0
- package/dist/cjs/{sqm-hero-view-d5d46a36.js → sqm-hero-view-f4264d5e.js} +3 -3
- package/dist/cjs/sqm-hero.cjs.entry.js +6 -5
- package/dist/cjs/sqm-leaderboard-rank.cjs.entry.js +8 -9
- package/dist/cjs/{sqm-navigation-sidebar-item-view-85e51ba6.js → sqm-navigation-sidebar-item-view-46a53c67.js} +3 -3
- package/dist/cjs/sqm-navigation-sidebar-item.cjs.entry.js +7 -8
- package/dist/cjs/sqm-navigation-sidebar.cjs.entry.js +197 -6
- package/dist/cjs/sqm-password-field.cjs.entry.js +23 -20
- package/dist/cjs/sqm-popup-container.cjs.entry.js +6 -7
- package/dist/cjs/{sqm-portal-container-view-a3e86fc2.js → sqm-portal-container-view-4a8432e9.js} +1 -3
- package/dist/cjs/{sqm-portal-email-verification-view-c60833cc.js → sqm-portal-email-verification-view-56d07e94.js} +3 -3
- package/dist/cjs/sqm-portal-email-verification.cjs.entry.js +27 -29
- package/dist/cjs/{sqm-portal-footer-view-d5478077.js → sqm-portal-footer-view-cbd4cd48.js} +3 -3
- package/dist/cjs/sqm-portal-footer.cjs.entry.js +16 -9
- package/dist/cjs/{sqm-portal-forgot-password-view-97932f7a.js → sqm-portal-forgot-password-view-aaa8dd17.js} +2 -2
- package/dist/cjs/sqm-portal-forgot-password.cjs.entry.js +38 -28
- package/dist/cjs/sqm-portal-logout.cjs.entry.js +10 -8
- package/dist/cjs/{sqm-portal-profile-view-a8ee44c2.js → sqm-portal-profile-view-9792a786.js} +4 -4
- package/dist/cjs/sqm-portal-profile.cjs.entry.js +26 -37
- package/dist/cjs/sqm-portal-protected-route.cjs.entry.js +14 -12
- package/dist/cjs/sqm-portal-registration-form.cjs.entry.js +441 -0
- package/dist/cjs/{sqm-portal-reset-password-view-042073ca.js → sqm-portal-reset-password-view-035245e6.js} +2 -2
- package/dist/cjs/sqm-portal-reset-password.cjs.entry.js +53 -60
- package/dist/cjs/{sqm-portal-section-view-765aae4d.js → sqm-portal-section-view-71a57cd9.js} +1 -1
- package/dist/cjs/{sqm-portal-verify-email-view-cb3c9c2f.js → sqm-portal-verify-email-view-7014ca89.js} +2 -2
- package/dist/cjs/sqm-portal-verify-email.cjs.entry.js +36 -56
- package/dist/cjs/sqm-referral-table_11.cjs.entry.js +12 -13
- package/dist/cjs/sqm-rewards-table-customer-note-cell.cjs.entry.js +3 -4
- package/dist/cjs/sqm-rewards-table-customer-note-column.cjs.entry.js +4 -5
- package/dist/cjs/sqm-rewards-table_9.cjs.entry.js +32 -30
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +205 -250
- package/dist/cjs/sqm-tab.cjs.entry.js +7 -0
- package/dist/cjs/sqm-tabs.cjs.entry.js +8 -7
- package/dist/cjs/{sqm-text-span-view-ab4ad6ef.js → sqm-text-span-view-b0c90c27.js} +1 -1
- package/dist/cjs/sqm-text-span.cjs.entry.js +3 -4
- package/dist/cjs/{stencil-hooks.module-87a1f4f7.js → stencil-hooks.module-6fe43579.js} +1 -0
- package/dist/cjs/{use-callback-e754042f.js → use-callback-5d15897d.js} +1 -1
- package/dist/cjs/{useChildElements-dc4c3132.js → useChildElements-24fbca82.js} +7 -5
- package/dist/cjs/{useReferralTable-f52c7f8e.js → useReferralTable-8f7a049c.js} +9 -9
- package/dist/cjs/useRegistrationFormState-3f88db90.js +14 -0
- package/dist/collection/collection-manifest.json +3 -3
- package/dist/collection/components/sqm-big-stat/sqm-big-stat-view.js +8 -13
- package/dist/collection/components/sqm-big-stat/sqm-big-stat.js +1 -144
- package/dist/collection/components/sqm-big-stat/useBigStat.js +1 -3
- package/dist/collection/components/sqm-big-stat/useDemoBigStat.js +2 -10
- package/dist/collection/components/sqm-brand/sqm-brand.js +13 -32
- package/dist/collection/components/sqm-card-feed/sqm-card-feed.js +1 -16
- package/dist/collection/components/sqm-checkbox-field/CheckboxField.stories.js +12 -5
- package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field-view.js +3 -2
- package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field.js +15 -9
- package/dist/collection/components/sqm-checkbox-field/useCheckboxField.js +12 -5
- package/dist/collection/components/sqm-divided-layout/DividedLayout.stories.js +6 -5
- package/dist/collection/components/sqm-divided-layout/sqm-divided-layout-view.js +2 -4
- package/dist/collection/components/sqm-divided-layout/sqm-divided-layout.js +40 -2
- package/dist/collection/components/sqm-dropdown-field/DropdownField.stories.js +13 -6
- package/dist/collection/components/sqm-dropdown-field/sqm-dropdown-field-view.js +6 -2
- package/dist/collection/components/sqm-dropdown-field/sqm-dropdown-field.js +11 -4
- package/dist/collection/components/sqm-dropdown-field/useDropdownField.js +3 -3
- package/dist/collection/components/sqm-edit-profile/sqm-edit-profile.js +1 -1
- package/dist/collection/components/sqm-form-message/sqm-form-message.js +1 -0
- package/dist/collection/components/sqm-graphql-client-provider/sqm-graphql-client-provider.js +1 -0
- package/dist/collection/components/sqm-hamburger-menu/HamburgerMenu.stories.js +7 -0
- package/dist/collection/components/sqm-hamburger-menu/sqm-hamburger-menu-view.js +139 -0
- package/dist/collection/components/sqm-hamburger-menu/sqm-hamburger-menu.js +45 -0
- package/dist/collection/components/sqm-header-logo/sqm-header-logo.js +102 -0
- package/dist/collection/components/sqm-hero/sqm-hero.js +9 -2
- package/dist/collection/components/sqm-hero-image/sqm-hero-image-view.js +0 -2
- package/dist/collection/components/sqm-hero-image/sqm-hero-image.js +2 -22
- package/dist/collection/components/sqm-image/sqm-image-view.js +0 -1
- package/dist/collection/components/sqm-image/sqm-image.js +1 -21
- package/dist/collection/components/sqm-input-field/InputField.stories.js +12 -5
- package/dist/collection/components/sqm-input-field/sqm-input-field-view.js +6 -2
- package/dist/collection/components/sqm-input-field/sqm-input-field.js +10 -4
- package/dist/collection/components/sqm-input-field/useInputField.js +3 -3
- package/dist/collection/components/sqm-name-fields/NameFields.stories.js +8 -4
- package/dist/collection/components/sqm-name-fields/sqm-name-fields-view.js +10 -3
- package/dist/collection/components/sqm-name-fields/sqm-name-fields.js +7 -4
- package/dist/collection/components/sqm-name-fields/useNameFields.js +3 -3
- package/dist/collection/components/sqm-navigation-sidebar/NavigationSidebar.stories.js +6 -5
- package/dist/collection/components/sqm-navigation-sidebar/sqm-navigation-sidebar-view.js +146 -7
- package/dist/collection/components/sqm-navigation-sidebar/sqm-navigation-sidebar.js +36 -5
- package/dist/collection/components/sqm-navigation-sidebar/useNavigationSidebar.js +17 -0
- package/dist/collection/components/sqm-navigation-sidebar-item/sqm-navigation-sidebar-item.js +7 -1
- package/dist/collection/components/sqm-password-field/PasswordField.stories.js +9 -3
- package/dist/collection/components/sqm-password-field/sqm-password-field-view.js +8 -4
- package/dist/collection/components/sqm-password-field/sqm-password-field.js +15 -12
- package/dist/collection/components/sqm-password-field/usePasswordField.js +4 -4
- package/dist/collection/components/sqm-portal-change-password/sqm-portal-change-password.js +29 -23
- package/dist/collection/components/sqm-portal-change-password/usePortalChangePassword.js +7 -10
- package/dist/collection/components/sqm-portal-container/sqm-portal-container-view.js +0 -2
- package/dist/collection/components/sqm-portal-container/sqm-portal-container.js +3 -46
- package/dist/collection/components/sqm-portal-email-verification/sqm-portal-email-verification.js +15 -7
- package/dist/collection/components/sqm-portal-email-verification/usePortalEmailVerification.js +14 -17
- package/dist/collection/components/sqm-portal-footer/PortalFooter.stories.js +2 -2
- package/dist/collection/components/sqm-portal-footer/sqm-portal-footer-view.js +1 -1
- package/dist/collection/components/sqm-portal-footer/sqm-portal-footer.js +38 -6
- package/dist/collection/components/sqm-portal-forgot-password/sqm-portal-forgot-password.js +68 -9
- package/dist/collection/components/sqm-portal-forgot-password/usePortalForgotPassword.js +16 -16
- package/dist/collection/components/sqm-portal-frame/sqm-portal-frame-view.js +3 -7
- package/dist/collection/components/sqm-portal-frame/sqm-portal-frame.js +29 -2
- package/dist/collection/components/sqm-portal-login/sqm-portal-login.js +58 -54
- package/dist/collection/components/sqm-portal-login/usePortalLogin.js +13 -16
- package/dist/collection/components/sqm-portal-logout/sqm-portal-logout.js +10 -4
- package/dist/collection/components/sqm-portal-profile/sqm-portal-profile.js +26 -36
- package/dist/collection/components/sqm-portal-profile/usePortalProfile.js +1 -1
- package/dist/collection/components/sqm-portal-protected-route/sqm-portal-protected-route.js +12 -11
- package/dist/collection/components/sqm-portal-register/PortalRegister.stories.js +5 -0
- package/dist/collection/components/sqm-portal-register/sqm-portal-register-view.js +5 -6
- package/dist/collection/components/sqm-portal-register/sqm-portal-register.js +49 -45
- package/dist/collection/components/sqm-portal-register/usePortalRegister.js +41 -25
- package/dist/collection/components/sqm-portal-registration-form/PortalRegistrationForm.stories.js +105 -0
- package/dist/collection/components/sqm-portal-registration-form/sqm-portal-registration-form-view.js +80 -0
- package/dist/collection/components/sqm-portal-registration-form/sqm-portal-registration-form.js +595 -0
- package/dist/collection/components/sqm-portal-registration-form/usePortalRegistrationForm.js +207 -0
- package/dist/collection/components/sqm-portal-registration-form/useRegistrationFormState.js +8 -0
- package/dist/collection/components/sqm-portal-reset-password/sqm-portal-reset-password.js +39 -33
- package/dist/collection/components/sqm-portal-reset-password/usePortalResetPassword.js +23 -29
- package/dist/collection/components/sqm-portal-verify-email/sqm-portal-verify-email.js +17 -9
- package/dist/collection/components/sqm-portal-verify-email/usePortalVerifyEmail.js +20 -41
- package/dist/collection/components/sqm-program-explainer/sqm-program-explainer.js +1 -1
- package/dist/collection/components/sqm-program-explainer-step/sqm-program-explainer-step.js +1 -1
- package/dist/collection/components/sqm-program-menu/sqm-program-menu.js +2 -1
- package/dist/collection/components/sqm-referral-card/sqm-referral-card-view.js +4 -20
- package/dist/collection/components/sqm-referral-card/sqm-referral-card.js +0 -130
- package/dist/collection/components/sqm-referral-iframe/sqm-referral-iframe.js +4 -4
- package/dist/collection/components/sqm-referral-table/sqm-referral-table.js +1 -1
- package/dist/collection/components/sqm-rewards-table/sqm-rewards-table.js +18 -15
- package/dist/collection/components/sqm-route/sqm-route.js +1 -1
- package/dist/collection/components/sqm-share-code/sqm-share-code.js +2 -2
- package/dist/collection/components/sqm-share-code/useShareCode.js +1 -1
- package/dist/collection/components/sqm-share-link/sqm-share-link-view.js +9 -22
- package/dist/collection/components/sqm-share-link/sqm-share-link.js +2 -125
- package/dist/collection/components/sqm-stat-container/sqm-stat-container-view.js +2 -6
- package/dist/collection/components/sqm-stat-container/sqm-stat-container.js +1 -49
- package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +2 -0
- package/dist/collection/components/sqm-tab/sqm-tab.js +7 -0
- package/dist/collection/components/sqm-table-cell/sqm-table-cell.js +2 -2
- package/dist/collection/components/sqm-tabs/sqm-tabs.js +1 -3
- package/dist/collection/components/sqm-tabs/useTabs.js +3 -1
- package/dist/collection/components/sqm-task-card/sqm-task-card-view.js +0 -1
- package/dist/collection/components/sqm-task-card/sqm-task-card.js +3 -3
- package/dist/collection/components/sqm-text/sqm-text.js +0 -7
- package/dist/collection/components/sqm-timeline/sqm-timeline-entry-view.js +2 -1
- package/dist/collection/components/sqm-timeline/sqm-timeline-entry.js +0 -23
- package/dist/collection/components/sqm-titled-section/sqm-titled-section.js +1 -1
- package/dist/collection/components/sqm-user-name/sqm-user-name.js +8 -8
- package/dist/collection/global/styles.js +1 -1
- package/dist/collection/global/styles.ts +1 -1
- package/dist/collection/stories/NewPortal.stories.js +6 -5
- package/dist/collection/tables/useChildElements.js +5 -3
- package/dist/esm/AsYouType-46f67d0d.js +3872 -0
- package/dist/esm/{GenericTableView-80119630.js → GenericTableView-5dd51546.js} +1 -1
- package/dist/esm/{JSS-418cab16.js → JSS-506b9295.js} +17 -1
- package/dist/esm/{ShadowViewAddon-b2386d47.js → ShadowViewAddon-f0daae38.js} +172 -194
- package/dist/esm/{global-2d97b8c1.js → global-5f5e66ae.js} +4 -4
- package/dist/esm/{index.module-2b4f1755.js → index.module-877f3231.js} +6865 -6822
- package/dist/esm/loader.js +5 -6
- package/dist/esm/{luxon-578505e2.js → luxon-5a398612.js} +1 -1
- package/dist/esm/mint-components.js +5 -6
- package/dist/esm/{re-render-2c1d8030.js → re-render-9d31cb93.js} +5 -5
- package/dist/esm/{sqm-asset-card-view-68f80b85.js → sqm-asset-card-view-de0f3463.js} +1 -1
- package/dist/esm/sqm-asset-card.entry.js +6 -7
- package/dist/esm/sqm-big-stat_35.entry.js +383 -4308
- package/dist/esm/sqm-empty_5.entry.js +4 -6
- package/dist/esm/sqm-form-message.entry.js +1 -1
- package/dist/esm/sqm-graphql-client-provider.entry.js +7 -8
- package/dist/esm/sqm-hamburger-menu.entry.js +156 -0
- package/dist/esm/sqm-header-logo.entry.js +26 -0
- package/dist/esm/{sqm-hero-view-1f148798.js → sqm-hero-view-ed7fa8f3.js} +3 -3
- package/dist/esm/sqm-hero.entry.js +6 -5
- package/dist/esm/sqm-leaderboard-rank.entry.js +8 -9
- package/dist/esm/{sqm-navigation-sidebar-item-view-b22b07a2.js → sqm-navigation-sidebar-item-view-393c5475.js} +3 -3
- package/dist/esm/sqm-navigation-sidebar-item.entry.js +7 -8
- package/dist/esm/sqm-navigation-sidebar.entry.js +199 -8
- package/dist/esm/sqm-password-field.entry.js +23 -20
- package/dist/esm/sqm-popup-container.entry.js +6 -7
- package/dist/esm/{sqm-portal-container-view-5d6f1411.js → sqm-portal-container-view-8f1bcc77.js} +1 -3
- package/dist/esm/{sqm-portal-email-verification-view-3dad1010.js → sqm-portal-email-verification-view-96f98975.js} +3 -3
- package/dist/esm/sqm-portal-email-verification.entry.js +27 -29
- package/dist/esm/{sqm-portal-footer-view-c35314a2.js → sqm-portal-footer-view-744654ef.js} +3 -3
- package/dist/esm/sqm-portal-footer.entry.js +16 -9
- package/dist/esm/{sqm-portal-forgot-password-view-f7239087.js → sqm-portal-forgot-password-view-38910bc9.js} +2 -2
- package/dist/esm/sqm-portal-forgot-password.entry.js +38 -28
- package/dist/esm/sqm-portal-logout.entry.js +10 -8
- package/dist/esm/{sqm-portal-profile-view-3d621db8.js → sqm-portal-profile-view-f5904a10.js} +4 -4
- package/dist/esm/sqm-portal-profile.entry.js +26 -37
- package/dist/esm/sqm-portal-protected-route.entry.js +14 -12
- package/dist/esm/sqm-portal-registration-form.entry.js +437 -0
- package/dist/esm/{sqm-portal-reset-password-view-e0436989.js → sqm-portal-reset-password-view-55411ca5.js} +2 -2
- package/dist/esm/sqm-portal-reset-password.entry.js +53 -60
- package/dist/esm/{sqm-portal-section-view-c8d1c727.js → sqm-portal-section-view-d64cd5de.js} +1 -1
- package/dist/esm/{sqm-portal-verify-email-view-c489166b.js → sqm-portal-verify-email-view-7ba350f9.js} +2 -2
- package/dist/esm/sqm-portal-verify-email.entry.js +36 -56
- package/dist/esm/sqm-referral-table_11.entry.js +12 -13
- package/dist/esm/sqm-rewards-table-customer-note-cell.entry.js +3 -4
- package/dist/esm/sqm-rewards-table-customer-note-column.entry.js +4 -5
- package/dist/esm/sqm-rewards-table_9.entry.js +32 -30
- package/dist/esm/sqm-stencilbook.entry.js +205 -250
- package/dist/esm/sqm-tab.entry.js +7 -0
- package/dist/esm/sqm-tabs.entry.js +8 -7
- package/dist/esm/{sqm-text-span-view-020db63f.js → sqm-text-span-view-20c0f018.js} +1 -1
- package/dist/esm/sqm-text-span.entry.js +3 -4
- package/dist/esm/{stencil-hooks.module-e39af977.js → stencil-hooks.module-eefa3570.js} +1 -1
- package/dist/esm/{use-callback-697e2ff0.js → use-callback-684c8bb7.js} +1 -1
- package/dist/esm/{useChildElements-0eab9c95.js → useChildElements-591435be.js} +7 -5
- package/dist/esm/{useReferralTable-3513622d.js → useReferralTable-f991c78a.js} +9 -9
- package/dist/esm/useRegistrationFormState-04a77cee.js +11 -0
- package/dist/esm-es5/AsYouType-46f67d0d.js +1 -0
- package/dist/esm-es5/{GenericTableView-80119630.js → GenericTableView-5dd51546.js} +1 -1
- package/dist/esm-es5/{JSS-418cab16.js → JSS-506b9295.js} +1 -1
- package/dist/esm-es5/ShadowViewAddon-f0daae38.js +1 -0
- package/dist/esm-es5/{global-2d97b8c1.js → global-5f5e66ae.js} +2 -2
- package/dist/esm-es5/index.module-877f3231.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{luxon-578505e2.js → luxon-5a398612.js} +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/{re-render-2c1d8030.js → re-render-9d31cb93.js} +1 -1
- package/dist/esm-es5/{sqm-asset-card-view-68f80b85.js → sqm-asset-card-view-de0f3463.js} +1 -1
- package/dist/esm-es5/sqm-asset-card.entry.js +1 -1
- package/dist/esm-es5/sqm-big-stat_35.entry.js +1 -1
- package/dist/esm-es5/sqm-empty_5.entry.js +1 -1
- package/dist/esm-es5/sqm-form-message.entry.js +1 -1
- package/dist/esm-es5/sqm-graphql-client-provider.entry.js +1 -1
- package/dist/esm-es5/sqm-hamburger-menu.entry.js +1 -0
- package/dist/esm-es5/sqm-header-logo.entry.js +1 -0
- package/dist/esm-es5/{sqm-hero-view-1f148798.js → sqm-hero-view-ed7fa8f3.js} +1 -1
- package/dist/esm-es5/sqm-hero.entry.js +1 -1
- package/dist/esm-es5/sqm-leaderboard-rank.entry.js +1 -1
- package/dist/esm-es5/{sqm-navigation-sidebar-item-view-b22b07a2.js → sqm-navigation-sidebar-item-view-393c5475.js} +1 -1
- package/dist/esm-es5/sqm-navigation-sidebar-item.entry.js +1 -1
- package/dist/esm-es5/sqm-navigation-sidebar.entry.js +1 -1
- package/dist/esm-es5/sqm-password-field.entry.js +1 -1
- package/dist/esm-es5/sqm-popup-container.entry.js +1 -1
- package/dist/esm-es5/sqm-portal-container-view-8f1bcc77.js +1 -0
- package/dist/esm-es5/{sqm-portal-email-verification-view-3dad1010.js → sqm-portal-email-verification-view-96f98975.js} +1 -1
- package/dist/esm-es5/sqm-portal-email-verification.entry.js +1 -1
- package/dist/esm-es5/{sqm-portal-footer-view-c35314a2.js → sqm-portal-footer-view-744654ef.js} +1 -1
- package/dist/esm-es5/sqm-portal-footer.entry.js +1 -1
- package/dist/esm-es5/{sqm-portal-forgot-password-view-f7239087.js → sqm-portal-forgot-password-view-38910bc9.js} +1 -1
- package/dist/esm-es5/sqm-portal-forgot-password.entry.js +1 -1
- package/dist/esm-es5/sqm-portal-logout.entry.js +1 -1
- package/dist/esm-es5/{sqm-portal-profile-view-3d621db8.js → sqm-portal-profile-view-f5904a10.js} +1 -1
- package/dist/esm-es5/sqm-portal-profile.entry.js +1 -1
- package/dist/esm-es5/sqm-portal-protected-route.entry.js +1 -1
- package/dist/esm-es5/sqm-portal-registration-form.entry.js +1 -0
- package/dist/esm-es5/{sqm-portal-reset-password-view-e0436989.js → sqm-portal-reset-password-view-55411ca5.js} +1 -1
- package/dist/esm-es5/sqm-portal-reset-password.entry.js +1 -1
- package/dist/esm-es5/sqm-portal-section-view-d64cd5de.js +1 -0
- package/dist/esm-es5/{sqm-portal-verify-email-view-c489166b.js → sqm-portal-verify-email-view-7ba350f9.js} +1 -1
- package/dist/esm-es5/sqm-portal-verify-email.entry.js +1 -1
- package/dist/esm-es5/sqm-referral-table_11.entry.js +1 -1
- package/dist/esm-es5/sqm-rewards-table-customer-note-cell.entry.js +1 -1
- package/dist/esm-es5/sqm-rewards-table-customer-note-column.entry.js +1 -1
- package/dist/esm-es5/sqm-rewards-table_9.entry.js +1 -1
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/esm-es5/sqm-tab.entry.js +1 -1
- package/dist/esm-es5/sqm-tabs.entry.js +1 -1
- package/dist/esm-es5/{sqm-text-span-view-020db63f.js → sqm-text-span-view-20c0f018.js} +1 -1
- package/dist/esm-es5/sqm-text-span.entry.js +1 -1
- package/dist/esm-es5/{stencil-hooks.module-e39af977.js → stencil-hooks.module-eefa3570.js} +1 -1
- package/dist/esm-es5/use-callback-684c8bb7.js +1 -0
- package/dist/esm-es5/useChildElements-591435be.js +1 -0
- package/dist/esm-es5/useReferralTable-f991c78a.js +1 -0
- package/dist/esm-es5/useRegistrationFormState-04a77cee.js +1 -0
- package/dist/mint-components/global/styles.ts +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/mint-components.js +1 -1
- package/dist/mint-components/p-00732eb1.entry.js +1 -0
- package/dist/mint-components/p-0222e8b1.system.js +1 -0
- package/dist/mint-components/p-03b1dda6.js +1 -0
- package/dist/mint-components/p-0571ac6b.system.entry.js +1 -0
- package/dist/mint-components/p-0878d563.system.entry.js +1 -0
- package/dist/mint-components/p-095d7d5e.entry.js +1 -0
- package/dist/mint-components/p-09a4bd9b.system.entry.js +1 -0
- package/dist/mint-components/{p-ec634002.system.entry.js → p-0a27f867.system.entry.js} +1 -1
- package/dist/mint-components/{p-b8452e47.entry.js → p-0b85f581.entry.js} +1 -1
- package/dist/mint-components/{p-be4cfea0.system.js → p-0bf5d514.system.js} +1 -1
- package/dist/mint-components/p-0f1fc54b.entry.js +1 -0
- package/dist/mint-components/p-121cdc60.js +1 -0
- package/dist/mint-components/{p-fb5163d7.js → p-14aacddf.js} +1 -1
- package/dist/mint-components/{p-0935fef5.system.js → p-1c87be0c.system.js} +1 -1
- package/dist/mint-components/{p-a1b9ca51.system.js → p-1cc7a8e6.system.js} +1 -1
- package/dist/mint-components/p-1e541014.system.entry.js +1 -0
- package/dist/mint-components/{p-ab2cbd56.js → p-1fbf8d0b.js} +1 -1
- package/dist/mint-components/{p-aa0ccc8d.js → p-2506531b.js} +1 -1
- package/dist/mint-components/p-2a33de60.entry.js +13 -0
- package/dist/mint-components/p-2c4c978e.system.entry.js +1 -0
- package/dist/mint-components/{p-903a6d4d.js → p-2dc6e74c.js} +1 -1
- package/dist/mint-components/{p-5fca1bb9.system.js → p-330680dd.system.js} +1 -1
- package/dist/mint-components/p-3ac7063d.entry.js +1 -0
- package/dist/mint-components/p-3af0caba.entry.js +159 -0
- package/dist/mint-components/p-3b7d870e.entry.js +1 -0
- package/dist/mint-components/p-3bb4fd18.system.js +8 -0
- package/dist/mint-components/p-3bb76558.system.js +1 -0
- package/dist/mint-components/{p-c8c83a9e.system.entry.js → p-3c6f3be9.system.entry.js} +1 -1
- package/dist/mint-components/{p-967445d6.system.js → p-3f13dae9.system.js} +1 -1
- package/dist/mint-components/p-41860440.system.entry.js +1 -0
- package/dist/mint-components/{p-541460a6.js → p-4494b612.js} +2 -2
- package/dist/mint-components/p-456571a6.entry.js +9 -0
- package/dist/mint-components/p-46a2d411.system.js +1 -0
- package/dist/mint-components/p-4708ece8.system.js +1 -0
- package/dist/mint-components/{p-38889f3c.system.js → p-48631971.system.js} +1 -1
- package/dist/mint-components/p-4a165275.entry.js +99 -0
- package/dist/mint-components/p-4f0a49e2.system.entry.js +1 -0
- package/dist/mint-components/{p-894cf728.system.js → p-51fc3d02.system.js} +1 -1
- package/dist/mint-components/{p-30b3592f.js → p-538904bd.js} +1 -1
- package/dist/mint-components/p-5711de63.system.js +1 -0
- package/dist/mint-components/p-5934c4ab.entry.js +1 -0
- package/dist/mint-components/{p-e8f5f4e0.js → p-5a1ed9bb.js} +1 -1
- package/dist/mint-components/{p-937bf427.system.js → p-621a2912.system.js} +1 -1
- package/dist/mint-components/p-628437e6.entry.js +1 -0
- package/dist/mint-components/{p-97483814.system.entry.js → p-647256a7.system.entry.js} +1 -1
- package/dist/mint-components/{p-4519c6d9.system.js → p-684aadb5.system.js} +1 -1
- package/dist/mint-components/p-6afbdcf9.entry.js +1 -0
- package/dist/mint-components/p-6b468f72.system.entry.js +1 -0
- package/dist/mint-components/p-6cf00931.system.entry.js +1 -0
- package/dist/mint-components/p-6cf891f8.system.entry.js +1 -0
- package/dist/mint-components/p-7341c340.entry.js +1 -0
- package/dist/mint-components/p-740afefb.entry.js +1 -0
- package/dist/mint-components/p-76767c7d.system.entry.js +1 -0
- package/dist/mint-components/p-767aedc8.entry.js +1 -0
- package/dist/mint-components/{p-72b3562a.system.js → p-774c9bb9.system.js} +1 -1
- package/dist/mint-components/p-7fa5ce30.system.js +1 -0
- package/dist/mint-components/{p-25846611.js → p-80934ab7.js} +2 -2
- package/dist/mint-components/{p-6081728e.system.js → p-8128c64d.system.js} +1 -1
- package/dist/mint-components/p-848cd7ea.system.entry.js +1 -0
- package/dist/mint-components/{p-6e0c7f7c.system.js → p-85528bea.system.js} +1 -1
- package/dist/mint-components/p-85a21d7b.entry.js +1 -0
- package/dist/mint-components/p-85e934c8.js +1 -0
- package/dist/mint-components/{p-46416f3e.js → p-864be7c2.js} +1 -1
- package/dist/mint-components/p-88cc585a.system.entry.js +1 -0
- package/dist/mint-components/{p-48a1e759.entry.js → p-8a2c78e0.entry.js} +1 -1
- package/dist/mint-components/p-9124a1e9.system.entry.js +1 -0
- package/dist/mint-components/p-919b93f1.js +1 -0
- package/dist/mint-components/p-92e8439a.system.entry.js +1 -0
- package/dist/mint-components/p-99397ef5.system.js +1 -0
- package/dist/mint-components/p-9c1841c6.entry.js +1 -0
- package/dist/mint-components/p-9d362d44.system.js +1 -0
- package/dist/mint-components/{p-066a4b23.system.js → p-9db19ba0.system.js} +2 -2
- package/dist/mint-components/p-9fd08e41.js +1 -0
- package/dist/mint-components/p-a91c1995.entry.js +1 -0
- package/dist/mint-components/p-af10beae.entry.js +33 -0
- package/dist/mint-components/p-b3436fd3.system.entry.js +1 -0
- package/dist/mint-components/p-b3610b44.entry.js +1 -0
- package/dist/mint-components/p-b9b4142b.js +268 -0
- package/dist/mint-components/p-be126e55.system.entry.js +1 -0
- package/dist/mint-components/{p-8763472e.js → p-bf4cd488.js} +1 -1
- package/dist/mint-components/p-c2c92ece.entry.js +1 -0
- package/dist/mint-components/p-c4b5c3b0.entry.js +1 -0
- package/dist/mint-components/p-c52e21cf.entry.js +1 -0
- package/dist/mint-components/p-c53322f8.system.entry.js +1 -0
- package/dist/mint-components/p-c586b1bb.entry.js +1 -0
- package/dist/mint-components/p-c5b1e781.system.entry.js +1 -0
- package/dist/mint-components/{p-edb569b8.js → p-cecf6365.js} +1 -1
- package/dist/mint-components/{p-190d0446.system.js → p-d1242e79.system.js} +1 -1
- package/dist/mint-components/p-d1341773.entry.js +1 -0
- package/dist/mint-components/{p-dc7b06ef.system.js → p-d4ee07e6.system.js} +2 -2
- package/dist/mint-components/p-d5645202.entry.js +1 -0
- package/dist/mint-components/p-d873d405.system.entry.js +1 -0
- package/dist/mint-components/p-dbfb865e.js +1 -0
- package/dist/mint-components/{p-6fd0198e.js → p-ddadc8e3.js} +1 -1
- package/dist/mint-components/p-df0899d3.entry.js +1 -0
- package/dist/mint-components/p-e3290be6.js +1 -0
- package/dist/mint-components/{p-54694cd4.system.js → p-e6b17831.system.js} +1 -1
- package/dist/mint-components/p-e71c3590.system.entry.js +1 -0
- package/dist/mint-components/{p-916a8f50.js → p-e733843b.js} +1 -1
- package/dist/mint-components/p-ea7ba030.system.entry.js +1 -0
- package/dist/mint-components/p-ec7e6d40.entry.js +1 -0
- package/dist/mint-components/p-eccd7d60.system.entry.js +1 -0
- package/dist/mint-components/p-ef147f86.system.entry.js +1 -0
- package/dist/mint-components/p-ef39ca69.system.entry.js +1 -0
- package/dist/mint-components/{p-9f08dc58.js → p-f30000d4.js} +1 -1
- package/dist/mint-components/p-f3a65df7.js +1 -0
- package/dist/mint-components/p-f6aa512e.system.js +1 -0
- package/dist/mint-components/p-fd14c63e.js +1 -0
- package/dist/mint-components/p-fdb3c23e.system.entry.js +1 -0
- package/dist/mint-components/p-fe74b75b.system.entry.js +1 -0
- package/dist/mint-components/{p-380b25a3.js → p-ff39746d.js} +1 -1
- package/dist/types/components/sqm-big-stat/sqm-big-stat-view.d.ts +0 -5
- package/dist/types/components/sqm-big-stat/sqm-big-stat.d.ts +0 -25
- package/dist/types/components/sqm-brand/sqm-brand.d.ts +1 -6
- package/dist/types/components/sqm-card-feed/sqm-card-feed.d.ts +1 -1
- package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field-view.d.ts +2 -2
- package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field.d.ts +7 -2
- package/dist/types/components/sqm-checkbox-field/useCheckboxField.d.ts +4 -2
- package/dist/types/components/sqm-divided-layout/sqm-divided-layout-view.d.ts +1 -0
- package/dist/types/components/sqm-divided-layout/sqm-divided-layout.d.ts +9 -1
- package/dist/types/components/sqm-dropdown-field/sqm-dropdown-field-view.d.ts +2 -2
- package/dist/types/components/sqm-dropdown-field/sqm-dropdown-field.d.ts +7 -1
- package/dist/types/components/sqm-dropdown-field/useDropdownField.d.ts +2 -1
- package/dist/types/components/sqm-edit-profile/sqm-edit-profile.d.ts +1 -1
- package/dist/types/components/sqm-form-message/sqm-form-message.d.ts +1 -0
- package/dist/types/components/sqm-graphql-client-provider/sqm-graphql-client-provider.d.ts +1 -0
- package/dist/types/components/sqm-hamburger-menu/HamburgerMenu.stories.d.ts +5 -0
- package/dist/types/components/sqm-hamburger-menu/sqm-hamburger-menu-view.d.ts +6 -0
- package/dist/types/components/sqm-hamburger-menu/sqm-hamburger-menu.d.ts +11 -0
- package/dist/types/components/sqm-header-logo/sqm-header-logo.d.ts +25 -0
- package/dist/types/components/sqm-hero/sqm-hero.d.ts +3 -2
- package/dist/types/components/sqm-hero-image/sqm-hero-image-view.d.ts +0 -1
- package/dist/types/components/sqm-hero-image/sqm-hero-image.d.ts +2 -7
- package/dist/types/components/sqm-image/sqm-image-view.d.ts +0 -1
- package/dist/types/components/sqm-image/sqm-image.d.ts +1 -6
- package/dist/types/components/sqm-input-field/sqm-input-field-view.d.ts +2 -2
- package/dist/types/components/sqm-input-field/sqm-input-field.d.ts +6 -2
- package/dist/types/components/sqm-input-field/useInputField.d.ts +2 -1
- package/dist/types/components/sqm-name-fields/sqm-name-fields-view.d.ts +2 -2
- package/dist/types/components/sqm-name-fields/sqm-name-fields.d.ts +4 -1
- package/dist/types/components/sqm-name-fields/useNameFields.d.ts +2 -1
- package/dist/types/components/sqm-navigation-sidebar/sqm-navigation-sidebar-view.d.ts +2 -1
- package/dist/types/components/sqm-navigation-sidebar/sqm-navigation-sidebar.d.ts +3 -3
- package/dist/types/components/sqm-navigation-sidebar/useNavigationSidebar.d.ts +4 -0
- package/dist/types/components/sqm-navigation-sidebar-item/sqm-navigation-sidebar-item.d.ts +5 -1
- package/dist/types/components/sqm-password-field/sqm-password-field-view.d.ts +2 -1
- package/dist/types/components/sqm-password-field/sqm-password-field.d.ts +9 -5
- package/dist/types/components/sqm-portal-change-password/sqm-portal-change-password.d.ts +8 -7
- package/dist/types/components/sqm-portal-container/sqm-portal-container-view.d.ts +0 -2
- package/dist/types/components/sqm-portal-container/sqm-portal-container.d.ts +3 -13
- package/dist/types/components/sqm-portal-email-verification/sqm-portal-email-verification.d.ts +5 -3
- package/dist/types/components/sqm-portal-footer/sqm-portal-footer-view.d.ts +1 -1
- package/dist/types/components/sqm-portal-footer/sqm-portal-footer.d.ts +10 -2
- package/dist/types/components/sqm-portal-forgot-password/sqm-portal-forgot-password.d.ts +16 -5
- package/dist/types/components/sqm-portal-forgot-password/usePortalForgotPassword.d.ts +2 -0
- package/dist/types/components/sqm-portal-frame/sqm-portal-frame-view.d.ts +1 -0
- package/dist/types/components/sqm-portal-frame/sqm-portal-frame.d.ts +6 -1
- package/dist/types/components/sqm-portal-login/sqm-portal-login.d.ts +18 -26
- package/dist/types/components/sqm-portal-logout/sqm-portal-logout.d.ts +5 -2
- package/dist/types/components/sqm-portal-profile/sqm-portal-profile.d.ts +6 -16
- package/dist/types/components/sqm-portal-profile/usePortalProfile.d.ts +1 -1
- package/dist/types/components/sqm-portal-protected-route/sqm-portal-protected-route.d.ts +8 -4
- package/dist/types/components/sqm-portal-register/sqm-portal-register-view.d.ts +3 -3
- package/dist/types/components/sqm-portal-register/sqm-portal-register.d.ts +19 -19
- package/dist/types/components/sqm-portal-register/usePortalRegister.d.ts +2 -1
- package/dist/types/components/sqm-portal-registration-form/PortalRegistrationForm.stories.d.ts +10 -0
- package/dist/types/components/sqm-portal-registration-form/sqm-portal-registration-form-view.d.ts +37 -0
- package/dist/types/components/sqm-portal-registration-form/sqm-portal-registration-form.d.ts +118 -0
- package/dist/types/components/sqm-portal-registration-form/usePortalRegistrationForm.d.ts +27 -0
- package/dist/types/components/sqm-portal-registration-form/useRegistrationFormState.d.ts +19 -0
- package/dist/types/components/sqm-portal-reset-password/sqm-portal-reset-password.d.ts +13 -13
- package/dist/types/components/sqm-portal-verify-email/sqm-portal-verify-email.d.ts +7 -5
- package/dist/types/components/sqm-program-explainer/sqm-program-explainer.d.ts +1 -1
- package/dist/types/components/sqm-program-explainer-step/sqm-program-explainer-step.d.ts +1 -1
- package/dist/types/components/sqm-program-menu/sqm-program-menu.d.ts +2 -1
- package/dist/types/components/sqm-referral-card/sqm-referral-card-view.d.ts +0 -6
- package/dist/types/components/sqm-referral-card/sqm-referral-card.d.ts +0 -28
- package/dist/types/components/sqm-referral-iframe/sqm-referral-iframe.d.ts +2 -2
- package/dist/types/components/sqm-referral-table/sqm-referral-table.d.ts +1 -1
- package/dist/types/components/sqm-rewards-table/sqm-rewards-table.d.ts +1 -1
- package/dist/types/components/sqm-route/sqm-route.d.ts +1 -0
- package/dist/types/components/sqm-share-code/sqm-share-code.d.ts +1 -1
- package/dist/types/components/sqm-share-link/sqm-share-link-view.d.ts +0 -5
- package/dist/types/components/sqm-share-link/sqm-share-link.d.ts +1 -28
- package/dist/types/components/sqm-stat-container/sqm-stat-container-view.d.ts +0 -2
- package/dist/types/components/sqm-stat-container/sqm-stat-container.d.ts +1 -10
- package/dist/types/components/sqm-tab/sqm-tab.d.ts +2 -0
- package/dist/types/components/sqm-table-cell/sqm-table-cell.d.ts +1 -1
- package/dist/types/components/sqm-tabs/sqm-tabs.d.ts +1 -3
- package/dist/types/components/sqm-task-card/sqm-task-card.d.ts +2 -2
- package/dist/types/components/sqm-text/sqm-text.d.ts +0 -7
- package/dist/types/components/sqm-timeline/sqm-timeline-entry-view.d.ts +0 -1
- package/dist/types/components/sqm-timeline/sqm-timeline-entry.d.ts +0 -5
- package/dist/types/components/sqm-titled-section/sqm-titled-section.d.ts +1 -1
- package/dist/types/components/sqm-user-name/sqm-user-name.d.ts +4 -4
- package/dist/types/components.d.ts +556 -1002
- package/dist/types/global/styles.d.ts +1 -1
- package/docs/docs.docx +0 -0
- package/docs/raisins.json +1 -1
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +3 -3
- package/CHANGELOG.md +0 -473
- package/dist/cjs/extends-08099afd.js +0 -21
- package/dist/cjs/sqm-navigation-sidebar-view-0ee28f65.js +0 -36
- package/dist/cjs/sqm-qa-referral-card.cjs.entry.js +0 -89
- package/dist/cjs/sqm-qa-tabs.cjs.entry.js +0 -100
- package/dist/cjs/sqm-qa.cjs.entry.js +0 -117
- package/dist/collection/components/sqm-portal-register/useValidationState.js +0 -8
- package/dist/collection/components/sqm-qa/sqm-qa.js +0 -1064
- package/dist/collection/components/sqm-qa-referral-card/ReferralCard.stories.js +0 -79
- package/dist/collection/components/sqm-qa-referral-card/sqm-referral-card-view.js +0 -56
- package/dist/collection/components/sqm-qa-referral-card/sqm-referral-card.js +0 -70
- package/dist/collection/components/sqm-qa-tabs/Tabs.stories.js +0 -491
- package/dist/collection/components/sqm-qa-tabs/sqm-tabs-view.js +0 -31
- package/dist/collection/components/sqm-qa-tabs/sqm-tabs.js +0 -59
- package/dist/collection/components/sqm-qa-tabs/useTabs.js +0 -46
- package/dist/esm/extends-c31f1eff.js +0 -19
- package/dist/esm/sqm-navigation-sidebar-view-9cb9a5f4.js +0 -34
- package/dist/esm/sqm-qa-referral-card.entry.js +0 -85
- package/dist/esm/sqm-qa-tabs.entry.js +0 -96
- package/dist/esm/sqm-qa.entry.js +0 -113
- package/dist/esm-es5/ShadowViewAddon-b2386d47.js +0 -1
- package/dist/esm-es5/extends-c31f1eff.js +0 -1
- package/dist/esm-es5/index.module-2b4f1755.js +0 -1
- package/dist/esm-es5/sqm-navigation-sidebar-view-9cb9a5f4.js +0 -1
- package/dist/esm-es5/sqm-portal-container-view-5d6f1411.js +0 -1
- package/dist/esm-es5/sqm-portal-section-view-c8d1c727.js +0 -1
- package/dist/esm-es5/sqm-qa-referral-card.entry.js +0 -1
- package/dist/esm-es5/sqm-qa-tabs.entry.js +0 -1
- package/dist/esm-es5/sqm-qa.entry.js +0 -1
- package/dist/esm-es5/use-callback-697e2ff0.js +0 -1
- package/dist/esm-es5/useChildElements-0eab9c95.js +0 -1
- package/dist/esm-es5/useReferralTable-3513622d.js +0 -1
- package/dist/mint-components/p-03d5b192.entry.js +0 -159
- package/dist/mint-components/p-0ec3b3e5.system.js +0 -1
- package/dist/mint-components/p-127e25e6.system.entry.js +0 -1
- package/dist/mint-components/p-13f034ac.system.js +0 -1
- package/dist/mint-components/p-15b1a2b2.system.entry.js +0 -1
- package/dist/mint-components/p-16b6aea4.js +0 -1
- package/dist/mint-components/p-174767c7.entry.js +0 -1
- package/dist/mint-components/p-1c17892a.system.js +0 -1
- package/dist/mint-components/p-1e13c65a.system.entry.js +0 -1
- package/dist/mint-components/p-242d76ee.system.entry.js +0 -1
- package/dist/mint-components/p-24f8c2f6.entry.js +0 -1
- package/dist/mint-components/p-2800ad44.system.js +0 -8
- package/dist/mint-components/p-3149462a.system.entry.js +0 -1
- package/dist/mint-components/p-353a6419.system.js +0 -1
- package/dist/mint-components/p-36578b9f.system.entry.js +0 -1
- package/dist/mint-components/p-3894495a.js +0 -1
- package/dist/mint-components/p-39c637da.system.entry.js +0 -1
- package/dist/mint-components/p-408f983a.system.js +0 -1
- package/dist/mint-components/p-4647ef97.entry.js +0 -1
- package/dist/mint-components/p-46ab109e.system.entry.js +0 -1
- package/dist/mint-components/p-4d4fbaec.entry.js +0 -1
- package/dist/mint-components/p-505d8965.system.entry.js +0 -1
- package/dist/mint-components/p-50ef8db6.system.entry.js +0 -1
- package/dist/mint-components/p-54bad89f.system.entry.js +0 -1
- package/dist/mint-components/p-555c9e1d.system.entry.js +0 -1
- package/dist/mint-components/p-59d481ea.entry.js +0 -1
- package/dist/mint-components/p-5c454d18.entry.js +0 -1
- package/dist/mint-components/p-5dd4dcc7.system.entry.js +0 -1
- package/dist/mint-components/p-6073e2f7.entry.js +0 -1
- package/dist/mint-components/p-60e2423f.entry.js +0 -1
- package/dist/mint-components/p-63617b4b.system.entry.js +0 -1
- package/dist/mint-components/p-6505fca3.system.entry.js +0 -1
- package/dist/mint-components/p-673a731f.entry.js +0 -1
- package/dist/mint-components/p-684967e6.entry.js +0 -1
- package/dist/mint-components/p-6882941e.system.entry.js +0 -1
- package/dist/mint-components/p-6e2ca2a0.js +0 -1
- package/dist/mint-components/p-6fc2fea4.entry.js +0 -1
- package/dist/mint-components/p-7473b40b.system.entry.js +0 -1
- package/dist/mint-components/p-77e5a1d4.entry.js +0 -1
- package/dist/mint-components/p-7d2d6a2b.system.js +0 -1
- package/dist/mint-components/p-7fd6f6ef.system.entry.js +0 -1
- package/dist/mint-components/p-81f34787.js +0 -1
- package/dist/mint-components/p-86fcb500.system.entry.js +0 -1
- package/dist/mint-components/p-889dbba5.entry.js +0 -1
- package/dist/mint-components/p-8d445a96.entry.js +0 -1
- package/dist/mint-components/p-96b0537b.system.js +0 -1
- package/dist/mint-components/p-9744ae44.system.js +0 -1
- package/dist/mint-components/p-991d3c0c.system.entry.js +0 -1
- package/dist/mint-components/p-9f54769f.system.entry.js +0 -1
- package/dist/mint-components/p-9f5e7313.entry.js +0 -33
- package/dist/mint-components/p-a73784bb.entry.js +0 -1
- package/dist/mint-components/p-ab8f86d3.js +0 -1
- package/dist/mint-components/p-ac80106e.entry.js +0 -1
- package/dist/mint-components/p-b3fa7c87.entry.js +0 -1
- package/dist/mint-components/p-bbb584e6.system.entry.js +0 -1
- package/dist/mint-components/p-be45347d.entry.js +0 -1
- package/dist/mint-components/p-bed4977e.entry.js +0 -1
- package/dist/mint-components/p-bf29e206.system.entry.js +0 -1
- package/dist/mint-components/p-c469be65.entry.js +0 -9
- package/dist/mint-components/p-c5573b7c.js +0 -1
- package/dist/mint-components/p-c81305b3.js +0 -268
- package/dist/mint-components/p-ccbacc32.entry.js +0 -1
- package/dist/mint-components/p-cee807de.system.entry.js +0 -1
- package/dist/mint-components/p-cf7d0aee.js +0 -1
- package/dist/mint-components/p-d298e4c5.system.entry.js +0 -1
- package/dist/mint-components/p-d30d1664.system.entry.js +0 -1
- package/dist/mint-components/p-d9488d28.entry.js +0 -1
- package/dist/mint-components/p-dc564561.js +0 -1
- package/dist/mint-components/p-dec7a657.entry.js +0 -1
- package/dist/mint-components/p-e4f4bfbb.entry.js +0 -1
- package/dist/mint-components/p-eb2f96a0.system.js +0 -1
- package/dist/mint-components/p-ec5b69bd.system.entry.js +0 -1
- package/dist/mint-components/p-ee461c80.js +0 -1
- package/dist/mint-components/p-f33e65c8.entry.js +0 -1
- package/dist/mint-components/p-f55d96ad.entry.js +0 -99
- package/dist/types/components/sqm-portal-register/useValidationState.d.ts +0 -18
- package/dist/types/components/sqm-qa/sqm-qa.d.ts +0 -255
- package/dist/types/components/sqm-qa-referral-card/ReferralCard.stories.d.ts +0 -14
- package/dist/types/components/sqm-qa-referral-card/sqm-referral-card-view.d.ts +0 -9
- package/dist/types/components/sqm-qa-referral-card/sqm-referral-card.d.ts +0 -20
- package/dist/types/components/sqm-qa-tabs/Tabs.stories.d.ts +0 -15
- package/dist/types/components/sqm-qa-tabs/sqm-tabs-view.d.ts +0 -9
- package/dist/types/components/sqm-qa-tabs/sqm-tabs.d.ts +0 -23
- package/dist/types/components/sqm-qa-tabs/useTabs.d.ts +0 -9
|
@@ -0,0 +1,3874 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// This file is a workaround for a bug in web browsers' "native"
|
|
4
|
+
// ES6 importing system which is uncapable of importing "*.json" files.
|
|
5
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/239
|
|
6
|
+
const metadata = {"version":4,"country_calling_codes":{"1":["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],"7":["RU","KZ"],"20":["EG"],"27":["ZA"],"30":["GR"],"31":["NL"],"32":["BE"],"33":["FR"],"34":["ES"],"36":["HU"],"39":["IT","VA"],"40":["RO"],"41":["CH"],"43":["AT"],"44":["GB","GG","IM","JE"],"45":["DK"],"46":["SE"],"47":["NO","SJ"],"48":["PL"],"49":["DE"],"51":["PE"],"52":["MX"],"53":["CU"],"54":["AR"],"55":["BR"],"56":["CL"],"57":["CO"],"58":["VE"],"60":["MY"],"61":["AU","CC","CX"],"62":["ID"],"63":["PH"],"64":["NZ"],"65":["SG"],"66":["TH"],"81":["JP"],"82":["KR"],"84":["VN"],"86":["CN"],"90":["TR"],"91":["IN"],"92":["PK"],"93":["AF"],"94":["LK"],"95":["MM"],"98":["IR"],"211":["SS"],"212":["MA","EH"],"213":["DZ"],"216":["TN"],"218":["LY"],"220":["GM"],"221":["SN"],"222":["MR"],"223":["ML"],"224":["GN"],"225":["CI"],"226":["BF"],"227":["NE"],"228":["TG"],"229":["BJ"],"230":["MU"],"231":["LR"],"232":["SL"],"233":["GH"],"234":["NG"],"235":["TD"],"236":["CF"],"237":["CM"],"238":["CV"],"239":["ST"],"240":["GQ"],"241":["GA"],"242":["CG"],"243":["CD"],"244":["AO"],"245":["GW"],"246":["IO"],"247":["AC"],"248":["SC"],"249":["SD"],"250":["RW"],"251":["ET"],"252":["SO"],"253":["DJ"],"254":["KE"],"255":["TZ"],"256":["UG"],"257":["BI"],"258":["MZ"],"260":["ZM"],"261":["MG"],"262":["RE","YT"],"263":["ZW"],"264":["NA"],"265":["MW"],"266":["LS"],"267":["BW"],"268":["SZ"],"269":["KM"],"290":["SH","TA"],"291":["ER"],"297":["AW"],"298":["FO"],"299":["GL"],"350":["GI"],"351":["PT"],"352":["LU"],"353":["IE"],"354":["IS"],"355":["AL"],"356":["MT"],"357":["CY"],"358":["FI","AX"],"359":["BG"],"370":["LT"],"371":["LV"],"372":["EE"],"373":["MD"],"374":["AM"],"375":["BY"],"376":["AD"],"377":["MC"],"378":["SM"],"380":["UA"],"381":["RS"],"382":["ME"],"383":["XK"],"385":["HR"],"386":["SI"],"387":["BA"],"389":["MK"],"420":["CZ"],"421":["SK"],"423":["LI"],"500":["FK"],"501":["BZ"],"502":["GT"],"503":["SV"],"504":["HN"],"505":["NI"],"506":["CR"],"507":["PA"],"508":["PM"],"509":["HT"],"590":["GP","BL","MF"],"591":["BO"],"592":["GY"],"593":["EC"],"594":["GF"],"595":["PY"],"596":["MQ"],"597":["SR"],"598":["UY"],"599":["CW","BQ"],"670":["TL"],"672":["NF"],"673":["BN"],"674":["NR"],"675":["PG"],"676":["TO"],"677":["SB"],"678":["VU"],"679":["FJ"],"680":["PW"],"681":["WF"],"682":["CK"],"683":["NU"],"685":["WS"],"686":["KI"],"687":["NC"],"688":["TV"],"689":["PF"],"690":["TK"],"691":["FM"],"692":["MH"],"850":["KP"],"852":["HK"],"853":["MO"],"855":["KH"],"856":["LA"],"880":["BD"],"886":["TW"],"960":["MV"],"961":["LB"],"962":["JO"],"963":["SY"],"964":["IQ"],"965":["KW"],"966":["SA"],"967":["YE"],"968":["OM"],"970":["PS"],"971":["AE"],"972":["IL"],"973":["BH"],"974":["QA"],"975":["BT"],"976":["MN"],"977":["NP"],"992":["TJ"],"993":["TM"],"994":["AZ"],"995":["GE"],"996":["KG"],"998":["UZ"]},"countries":{"AC":["247","00","(?:[01589]\\d|[46])\\d{4}",[5,6]],"AD":["376","00","(?:1|6\\d)\\d{7}|[135-9]\\d{5}",[6,8,9],[["(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],["(\\d{4})(\\d{4})","$1 $2",["1"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]]],"AE":["971","00","(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",[5,6,7,8,9,10,11,12],[["(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],["(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"]],"0"],"AF":["93","00","[2-7]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"]],"0"],"AG":["1","011","(?:268|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([457]\\d{6})$","268$1",0,"268"],"AI":["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2457]\\d{6})$","264$1",0,"264"],"AL":["355","00","(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",[6,7,8,9],[["(\\d{3})(\\d{3,4})","$1 $2",["80|9"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["4[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2358][2-5]|4"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["[23578]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["6"],"0$1"]],"0"],"AM":["374","00","(?:[1-489]\\d|55|60|77)\\d{6}",[8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0"],"0 $1"],["(\\d{3})(\\d{5})","$1 $2",["2|3[12]"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["1|47"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[3-9]"],"0$1"]],"0"],"AO":["244","00","[29]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[29]"]]]],"AR":["54","00","(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}",[10,11],[["(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])","2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["1"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["[23]"],"0$1",1],["(\\d)(\\d{4})(\\d{2})(\\d{4})","$2 15-$3-$4",["9(?:2[2-469]|3[3-578])","9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))","9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",0,"$1 $2 $3-$4"],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 15-$3-$4",["91"],"0$1",0,"$1 $2 $3-$4"],["(\\d{3})(\\d{3})(\\d{5})","$1-$2-$3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 15-$3-$4",["9"],"0$1",0,"$1 $2 $3-$4"]],"0",0,"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?","9$1"],"AS":["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"1|([267]\\d{6})$","684$1",0,"684"],"AT":["43","00","1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",[4,5,6,7,8,9,10,11,12,13],[["(\\d)(\\d{3,12})","$1 $2",["1(?:11|[2-9])"],"0$1"],["(\\d{3})(\\d{2})","$1 $2",["517"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["5[079]"],"0$1"],["(\\d{3})(\\d{3,10})","$1 $2",["(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]"],"0$1"],["(\\d{4})(\\d{3,9})","$1 $2",["[2-467]|5[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["5"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,7})","$1 $2 $3",["5"],"0$1"]],"0"],"AU":["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{7,8}|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["16"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,4})","$1 $2 $3",["16"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["14|4"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:30|[89])"]]],"0",0,"0|(183[12])",0,0,0,[["(?:(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\d|2[0-8]))\\d{3}|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4]))|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}",[9]],["4(?:83[0-38]|93[0-4])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[06-9]|7[02-9]|8[0-24-9]|9[0-27-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,["163\\d{2,6}",[5,6,7,8,9]],["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{3}|45[0-4])\\d{3}|13\\d{4}",[6,8,10]]],"0011"],"AW":["297","00","(?:[25-79]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[25-9]"]]]],"AX":["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}",[5,6,7,8,9,10,11,12],0,"0",0,0,0,0,"18",0,"00"],"AZ":["994","00","365\\d{6}|(?:[124579]\\d|60|88)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[28]|2|365|46","1[28]|2|365|46","1[28]|2|365(?:[0-46-9]|5[0-35-9])|46"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[13-9]"],"0$1"]],"0"],"BA":["387","00","6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["6[1-3]|[7-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2-$3",["[3-5]|6[56]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["6"],"0$1"]],"0"],"BB":["1","011","(?:246|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-9]\\d{6})$","246$1",0,"246"],"BD":["880","00","1\\d{9}|2\\d{7,8}|88\\d{4,6}|(?:8[0-79]|9\\d)\\d{4,8}|(?:[346]\\d|[57])\\d{5,8}",[6,7,8,9,10],[["(\\d{2})(\\d{4,6})","$1-$2",["31[5-8]|[459]1"],"0$1"],["(\\d{3})(\\d{3,7})","$1-$2",["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:28|4[14]|5)|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],"0$1"],["(\\d{4})(\\d{3,6})","$1-$2",["[13-9]"],"0$1"],["(\\d)(\\d{7,8})","$1-$2",["2"],"0$1"]],"0"],"BE":["32","00","4\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:80|9)0"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[239]|4[23]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[15-8]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4"],"0$1"]],"0"],"BF":["226","00","[025-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[025-7]"]]]],"BG":["359","00","[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9],[["(\\d)(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["43[1-6]|70[1-9]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:70|8)0"],"0$1"],["(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3",["43[1-7]|7"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[48]|9[08]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"]],"0"],"BH":["973","00","[136-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[13679]|8[047]"]]]],"BI":["257","00","(?:[267]\\d|31)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2367]"]]]],"BJ":["229","00","[25689]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[25689]"]]]],"BL":["590","00","(?:590|(?:69|80)\\d|976)\\d{6}",[9],0,"0",0,0,0,0,0,[["590(?:2[7-9]|5[12]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["976[01]\\d{5}"]]],"BM":["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-8]\\d{6})$","441$1",0,"441"],"BN":["673","00","[2-578]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-578]"]]]],"BO":["591","00(?:1\\d)?","(?:[2-467]\\d\\d|8001)\\d{5}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[23]|4[46]"]],["(\\d{8})","$1",["[67]"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["8"]]],"0",0,"0(1\\d)?"],"BQ":["599","00","(?:[34]1|7\\d)\\d{5}",[7],0,0,0,0,0,0,"[347]"],"BR":["55","00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)","(?:[1-46-9]\\d\\d|5(?:[0-46-9]\\d|5[0-24679]))\\d{8}|[1-9]\\d{9}|[3589]\\d{8}|[34]\\d{7}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37)","4(?:02|37)0|[34]00"]],["(\\d{3})(\\d{2,3})(\\d{4})","$1 $2 $3",["(?:[358]|90)0"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"],"($1)"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["[16][1-9]|[2-57-9]"],"($1)"]],"0",0,"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?","$2"],"BS":["1","011","(?:242|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([3-8]\\d{6})$","242$1",0,"242"],"BT":["975","00","[17]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-68]|7[246]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|7"]]]],"BW":["267","00","(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}",[7,8,10],[["(\\d{2})(\\d{5})","$1 $2",["90"]],["(\\d{3})(\\d{4})","$1 $2",["[24-6]|3[15-79]"]],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37]"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["8"]]]],"BY":["375","810","(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3})","$1 $2",["800"],"8 $1"],["(\\d{3})(\\d{2})(\\d{2,4})","$1 $2 $3",["800"],"8 $1"],["(\\d{4})(\\d{2})(\\d{3})","$1 $2-$3",["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])","1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"],"8 0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:[56]|7[467])|2[1-3]"],"8 0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-4]"],"8 0$1"],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["[89]"],"8 $1"]],"8",0,"0|80?",0,0,0,0,"8~10"],"BZ":["501","00","(?:0800\\d|[2-8])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1-$2",["[2-8]"]],["(\\d)(\\d{3})(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"]]]],"CA":["1","011","(?:[2-8]\\d|90)\\d{8}",[10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|50)|3(?:06|43|6[578])|4(?:03|1[68]|3[178]|50|74)|5(?:06|1[49]|48|79|8[17])|6(?:04|13|39|47|72)|7(?:0[59]|78|8[02])|8(?:[06]7|19|25|73)|90[25])[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:00|2[12]|33|44|66|77|88)|622)[2-9]\\d{6}"],0,0,0,["600[2-9]\\d{6}"]]],"CC":["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d|8[0-24-9])\\d{7}|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10],0,"0",0,"0|([59]\\d{7})$","8$1",0,0,[["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}",[9]],["4(?:83[0-38]|93[0-4])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[06-9]|7[02-9]|8[0-24-9]|9[0-27-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{3}|45[0-4])\\d{3}|13\\d{4}",[6,8,10]]],"0011"],"CD":["243","00","[189]\\d{8}|[1-68]\\d{6}",[7,9],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[1-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"]],"0"],"CF":["236","00","(?:[27]\\d{3}|8776)\\d{4}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[278]"]]]],"CG":["242","00","222\\d{6}|(?:0\\d|80)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["801"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02]"]]]],"CH":["41","00","8\\d{11}|[2-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8[047]|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]|81"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["8"],"0$1"]],"0"],"CI":["225","00","[02]\\d{9}",[10],[["(\\d{2})(\\d{2})(\\d)(\\d{5})","$1 $2 $3 $4",["2"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3 $4",["0"]]]],"CK":["682","00","[2-578]\\d{4}",[5],[["(\\d{2})(\\d{3})","$1 $2",["[2-578]"]]]],"CL":["56","(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0","12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}",[9,10,11],[["(\\d{5})(\\d{4})","$1 $2",["219","2196"],"($1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-3]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9[2-9]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])"],"($1)"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["60|8"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{3})(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3 $4",["60"]]]],"CM":["237","00","[26]\\d{8}|88\\d{6,7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["88"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[26]|88"]]]],"CN":["86","00|1(?:[12]\\d|79)\\d\\d00","1[127]\\d{8,9}|2\\d{9}(?:\\d{2})?|[12]\\d{6,7}|86\\d{6}|(?:1[03-689]\\d|6)\\d{7,9}|(?:[3-579]\\d|8[0-57-9])\\d{6,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]","(?:10|2[0-57-9])(?:10|9[56])","(?:10|2[0-57-9])(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{5,6})","$1 $2",["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]","(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]","85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])","85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["(?:4|80)0"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|2(?:[02-57-9]|1[1-9])","10|2(?:[02-57-9]|1[1-9])","10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"],"0$1",1],["(\\d{3})(\\d{7,8})","$1 $2",["9"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["80"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[3-578]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["1[3-9]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["[12]"],"0$1",1]],"0",0,"0|(1(?:[12]\\d|79)\\d\\d)",0,0,0,0,"00"],"CO":["57","00(?:4(?:[14]4|56)|[579])","(?:(?:1\\d|3)\\d{3}|9101)\\d{6}|[124-8]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1 $2",["[14][2-9]|[25-8]"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["[39]"]],["(\\d)(\\d{3})(\\d{7})","$1-$2-$3",["1"],"0$1",0,"$1 $2 $3"]],"0",0,"0([3579]|4(?:[14]4|56))?"],"CR":["506","00","(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}",[8,10],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[3-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[89]"]]],0,0,"(19(?:0[0-2468]|1[09]|20|66|77|99))"],"CU":["53","119","[27]\\d{6,7}|[34]\\d{5,7}|(?:5|8\\d\\d)\\d{7}",[6,7,8,10],[["(\\d{2})(\\d{4,6})","$1 $2",["2[1-4]|[34]"],"(0$1)"],["(\\d)(\\d{6,7})","$1 $2",["7"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["5"],"0$1"],["(\\d{3})(\\d{7})","$1 $2",["8"],"0$1"]],"0"],"CV":["238","0","(?:[2-59]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2-589]"]]]],"CW":["599","00","(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[3467]"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["9[4-8]"]]],0,0,0,0,0,"[69]"],"CX":["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d|8[0-24-9])\\d{7}|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10],0,"0",0,"0|([59]\\d{7})$","8$1",0,0,[["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}",[9]],["4(?:83[0-38]|93[0-4])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[06-9]|7[02-9]|8[0-24-9]|9[0-27-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{3}|45[0-4])\\d{3}|13\\d{4}",[6,8,10]]],"0011"],"CY":["357","00","(?:[279]\\d|[58]0)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[257-9]"]]]],"CZ":["420","00","(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]]],"DE":["49","00","[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:[12]\\d|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[05]\\d|31|[46][1-8])\\d{1,9}",[4,5,6,7,8,9,10,11,12,13,14,15],[["(\\d{2})(\\d{3,13})","$1 $2",["3[02]|40|[68]9"],"0$1"],["(\\d{3})(\\d{3,12})","$1 $2",["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1","2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],"0$1"],["(\\d{4})(\\d{2,11})","$1 $2",["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]","[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["138"],"0$1"],["(\\d{5})(\\d{2,10})","$1 $2",["3"],"0$1"],["(\\d{3})(\\d{5,11})","$1 $2",["181"],"0$1"],["(\\d{3})(\\d)(\\d{4,10})","$1 $2 $3",["1(?:3|80)|9"],"0$1"],["(\\d{3})(\\d{7,8})","$1 $2",["1[67]"],"0$1"],["(\\d{3})(\\d{7,12})","$1 $2",["8"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["185","1850","18500"],"0$1"],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["18[68]"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["15[0568]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"0$1"],["(\\d{3})(\\d{8})","$1 $2",["18"],"0$1"],["(\\d{3})(\\d{2})(\\d{7,8})","$1 $2 $3",["1(?:6[023]|7)"],"0$1"],["(\\d{4})(\\d{2})(\\d{7})","$1 $2 $3",["15[279]"],"0$1"],["(\\d{3})(\\d{2})(\\d{8})","$1 $2 $3",["15"],"0$1"]],"0"],"DJ":["253","00","(?:2\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[27]"]]]],"DK":["45","00","[2-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-9]"]]]],"DM":["1","011","(?:[58]\\d\\d|767|900)\\d{7}",[10],0,"1",0,"1|([2-7]\\d{6})$","767$1",0,"767"],"DO":["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,0,0,0,"8001|8[024]9"],"DZ":["213","00","(?:[1-4]|[5-79]\\d|80)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["9"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-8]"],"0$1"]],"0"],"EC":["593","00","1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}",[8,9,10,11],[["(\\d)(\\d{3})(\\d{4})","$1 $2-$3",["[2-7]"],"(0$1)",0,"$1-$2-$3"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{3})(\\d{3,4})","$1 $2 $3",["1"]]],"0"],"EE":["372","00","8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88","[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]],["(\\d{4})(\\d{3,4})","$1 $2",["[45]|8(?:00|[1-49])","[45]|8(?:00[1-9]|[1-49])"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],"EG":["20","00","[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}",[8,9,10],[["(\\d)(\\d{7,8})","$1 $2",["[23]"],"0$1"],["(\\d{2})(\\d{6,7})","$1 $2",["1[35]|[4-6]|8[2468]|9[235-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[189]"],"0$1"]],"0"],"EH":["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,"528[89]"],"ER":["291","00","[178]\\d{6}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[178]"],"0$1"]],"0"],"ES":["34","00","[5-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]00"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-9]"]]]],"ET":["251","00","(?:11|[2-59]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-59]"],"0$1"]],"0"],"FI":["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",[5,6,7,8,9,10,11,12],[["(\\d)(\\d{4,9})","$1 $2",["[2568][1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["[12]00|[368]|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[1245]|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"0$1"]],"0",0,0,0,0,"1[03-79]|[2-9]",0,"00"],"FJ":["679","0(?:0|52)","45\\d{5}|(?:0800\\d|[235-9])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|45"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]]],0,0,0,0,0,0,0,"00"],"FK":["500","00","[2-7]\\d{4}",[5]],"FM":["691","00","(?:[39]\\d\\d|820)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[389]"]]]],"FO":["298","00","[2-9]\\d{5}",[6],[["(\\d{6})","$1",["[2-9]"]]],0,0,"(10(?:01|[12]0|88))"],"FR":["33","00","[1-9]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0 $1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[1-79]"],"0$1"]],"0"],"GA":["241","00","(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}",[7,8],[["(\\d)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-7]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["11|[67]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]]],0,0,"0(11\\d{6}|6[256]\\d{6}|7[47]\\d{6})","$1"],"GB":["44","00","[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",[7,9,10],[["(\\d{3})(\\d{4})","$1 $2",["800","8001","80011","800111","8001111"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["845","8454","84546","845464"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["800"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["1(?:38|5[23]|69|76|94)","1(?:(?:38|69)7|5(?:24|39)|768|946)","1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["1(?:[2-69][02-9]|[78])"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[25]|7(?:0|6[02-9])","[25]|7(?:0|6(?:[03-9]|2[356]))"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[1389]"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[023])|4(?:[0-5]\\d\\d|69[7-9]|70[059])|(?:5[0-26-9]|[78][0-49])\\d\\d|6(?:[0-4]\\d\\d|50[259]))|2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d\\d|1(?:[0-7]\\d\\d|8(?:[02]\\d|1[278])))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",[9,10]],["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-2]|2[356]|34|4[01347]|5[49]|6[0-369]|77|81|9[139])\\d{6}",[10]],["56\\d{8}",[10]]],0," x"],"GD":["1","011","(?:473|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-9]\\d{6})$","473$1",0,"473"],"GE":["995","00","(?:[3-57]\\d\\d|800)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["32"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[57]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[348]"],"0$1"]],"0"],"GF":["594","00","(?:[56]94|80\\d|976)\\d{6}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],"GG":["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"0|([25-9]\\d{5})$","1481$1",0,0,[["1481[25-9]\\d{5}",[10]],["7(?:(?:781|839)\\d|911[17])\\d{5}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-2]|2[356]|34|4[01347]|5[49]|6[0-369]|77|81|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],"GH":["233","00","(?:[235]\\d{3}|800)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[235]"],"0$1"]],"0"],"GI":["350","00","(?:[25]\\d\\d|606)\\d{5}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]]],"GL":["299","00","(?:19|[2-689]\\d)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-689]"]]]],"GM":["220","00","[2-9]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],"GN":["224","00","722\\d{6}|(?:3|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["3"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[67]"]]]],"GP":["590","00","(?:590|(?:69|80)\\d|976)\\d{6}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["590(?:0[1-68]|1[0-2]|2[0-68]|3[1289]|4[0-24-9]|5[3-579]|6[0189]|7[08]|8[0-689]|9\\d)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["976[01]\\d{5}"]]],"GQ":["240","00","222\\d{6}|(?:3\\d|55|[89]0)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235]"]],["(\\d{3})(\\d{6})","$1 $2",["[89]"]]]],"GR":["30","00","5005000\\d{3}|8\\d{9,10}|(?:[269]\\d|70)\\d{8}",[10,11],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["21|7"]],["(\\d{4})(\\d{6})","$1 $2",["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2689]"]],["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3",["8"]]]],"GT":["502","00","(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],"GU":["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"1|([3-9]\\d{6})$","671$1",0,"671"],"GW":["245","00","[49]\\d{8}|4\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["40"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"]]]],"GY":["592","001","(?:862\\d|9008)\\d{3}|(?:[2-46]\\d|77)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-46-9]"]]]],"HK":["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4}(?:\\d(?:\\d(?:\\d{4})?)?)?|(?:[235-79]\\d|46)\\d{6}",[5,6,7,8,9,11],[["(\\d{3})(\\d{2,5})","$1 $2",["900","9003"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{3})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,0,"00"],"HN":["504","00","8\\d{10}|[237-9]\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1-$2",["[237-9]"]]]],"HR":["385","00","(?:[24-69]\\d|3[0-79])\\d{7}|80\\d{5,7}|[1-79]\\d{7}|6\\d{5,6}",[6,7,8,9],[["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["6[01]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{4})(\\d{3})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-5]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0"],"HT":["509","00","[2-489]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-489]"]]]],"HU":["36","00","[235-7]\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"06 $1"]],"06"],"ID":["62","00[89]","(?:(?:00[1-9]|8\\d)\\d{4}|[1-36])\\d{6}|00\\d{10}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["15"]],["(\\d{2})(\\d{5,9})","$1 $2",["2[124]|[36]1"],"(0$1)"],["(\\d{3})(\\d{5,7})","$1 $2",["800"],"0$1"],["(\\d{3})(\\d{5,8})","$1 $2",["[2-79]"],"(0$1)"],["(\\d{3})(\\d{3,4})(\\d{3})","$1-$2-$3",["8[1-35-9]"],"0$1"],["(\\d{3})(\\d{6,8})","$1 $2",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["804"],"0$1"],["(\\d{3})(\\d)(\\d{3})(\\d{3})","$1 $2 $3 $4",["80"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1-$2-$3",["8"],"0$1"]],"0"],"IE":["353","00","(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["2[24-9]|47|58|6[237-9]|9[35-9]"],"(0$1)"],["(\\d{3})(\\d{5})","$1 $2",["[45]0"],"(0$1)"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["1"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2569]|4[1-69]|7[14]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["81"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[78]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["4"],"(0$1)"],["(\\d{2})(\\d)(\\d{3})(\\d{4})","$1 $2 $3 $4",["8"],"0$1"]],"0"],"IL":["972","0(?:0|1[2-9])","1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}",[7,8,9,10,11,12],[["(\\d{4})(\\d{3})","$1-$2",["125"]],["(\\d{4})(\\d{2})(\\d{2})","$1-$2-$3",["121"]],["(\\d)(\\d{3})(\\d{4})","$1-$2-$3",["[2-489]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1-$2-$3",["12"]],["(\\d{4})(\\d{6})","$1-$2",["159"]],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3-$4",["1[7-9]"]],["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})","$1-$2 $3-$4",["15"]]],"0"],"IM":["44","00","1624\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"0|([25-8]\\d{5})$","1624$1",0,"74576|(?:16|7[56])24"],"IN":["91","00","(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}",[8,9,10,11,12,13],[["(\\d{8})","$1",["5(?:0|2[23]|3[03]|[67]1|88)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"],0,1],["(\\d{4})(\\d{4,5})","$1 $2",["180","1800"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["140"],0,1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["11|2[02]|33|4[04]|79[1-7]|80[2-46]","11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])","11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"],"0$1",1],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807","1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]","1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"],"0$1",1],["(\\d{5})(\\d{5})","$1 $2",["[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["1(?:6|8[06])","1(?:6|8[06]0)"],0,1],["(\\d{4})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["18"],0,1]],"0"],"IO":["246","00","3\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["3"]]]],"IQ":["964","00","(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],"IR":["98","00","[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}",[4,5,6,7,10],[["(\\d{4,5})","$1",["96"],"0$1"],["(\\d{2})(\\d{4,5})","$1 $2",["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[1-8]"],"0$1"]],"0"],"IS":["354","00|1(?:0(?:01|[12]0)|100)","(?:38\\d|[4-9])\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[4-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["3"]]],0,0,0,0,0,0,0,"00"],"IT":["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11],[["(\\d{2})(\\d{4,6})","$1 $2",["0[26]"]],["(\\d{3})(\\d{3,6})","$1 $2",["0[13-57-9][0159]|8(?:03|4[17]|9[245])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|[45][0-4]))"]],["(\\d{4})(\\d{2,6})","$1 $2",["0(?:[13-579][2-46-8]|8[236-8])"]],["(\\d{4})(\\d{4})","$1 $2",["894"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[26]|5"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["1[4679]|[38]"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]"]],["(\\d{2})(\\d{4})(\\d{5})","$1 $2 $3",["0[26]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["3"]]],0,0,0,0,0,0,[["0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"],["3[1-9]\\d{8}|3[2-9]\\d{7}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d\\d|89(?:2|4[5-9]\\d))\\d{3}|89[45][0-4]\\d\\d|(?:1(?:44|6[346])|89(?:5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],0,0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],"JE":["44","00","1534\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"0|([0-24-8]\\d{5})$","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97[7-9]))\\d{5}"],["80(?:07(?:35|81)|8901)\\d{4}"],["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"],["701511\\d{4}"],0,["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"],["76(?:464|652)\\d{5}|76(?:0[0-2]|2[356]|34|4[01347]|5[49]|6[0-369]|77|81|9[139])\\d{6}"],["56\\d{8}"]]],"JM":["1","011","(?:[58]\\d\\d|658|900)\\d{7}",[10],0,"1",0,0,0,0,"658|876"],"JO":["962","00","(?:(?:[2689]|7\\d)\\d|32|53)\\d{6}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2356]|87"],"(0$1)"],["(\\d{3})(\\d{5,6})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["70"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],"JP":["81","010","00[1-9]\\d{6,14}|[257-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}",[8,9,10,11,12,13,14,15,16,17],[["(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3",["(?:12|57|99)0"],"0$1"],["(\\d{4})(\\d)(\\d{4})","$1-$2-$3",["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51|63)|9(?:49|80|9[16])","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9]|636)|9(?:496|802|9(?:1[23]|69))|1(?:45|58)[67]","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9]|636[457-9])|9(?:496|802|9(?:1[23]|69))|1(?:45|58)[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2-$3",["[36]|4(?:2[09]|7[01])","[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[27-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9])|5(?:2|3[045]|4[0-369]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|49|51|6(?:[0-24]|36|5[0-3589]|72|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:49|55|83)[29]|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[23]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|72|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|7[015-9]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17|3[015-9]))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9(?:[019]|4[1-3]|6(?:[0-47-9]|5[01346-9])))|3(?:[29]|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[23]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|72|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|829(?:2|66)|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"],"0$1"],["(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["[14]|[289][2-9]|5[3-9]|7[2-4679]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["800"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[257-9]"],"0$1"]],"0"],"KE":["254","000","(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}",[7,8,9,10],[["(\\d{2})(\\d{5,7})","$1 $2",["[24-6]"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[17]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0"],"KG":["996","00","8\\d{9}|(?:[235-8]\\d|99)\\d{7}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["3(?:1[346]|[24-79])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-79]|88"],"0$1"],["(\\d{3})(\\d{3})(\\d)(\\d{2,3})","$1 $2 $3 $4",["8"],"0$1"]],"0"],"KH":["855","00[14-9]","1\\d{9}|[1-9]\\d{7,8}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],"KI":["686","00","(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}",[5,8],0,"0"],"KM":["269","00","[3478]\\d{6}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[3478]"]]]],"KN":["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-7]\\d{6})$","869$1",0,"869"],"KP":["850","00|99","85\\d{6}|(?:19\\d|[2-7])\\d{7}",[8,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"]],"0"],"KR":["82","00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))","00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}",[5,6,8,9,10,11,12,13,14],[["(\\d{2})(\\d{3,4})","$1-$2",["(?:3[1-3]|[46][1-4]|5[1-5])1"],"0$1"],["(\\d{4})(\\d{4})","$1-$2",["1"]],["(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60|8"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["[1346]|5[1-5]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{2})(\\d{5})(\\d{4})","$1-$2-$3",["5"],"0$1"]],"0",0,"0(8(?:[1-46-8]|5\\d\\d))?"],"KW":["965","00","(?:18|[2569]\\d\\d)\\d{5}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[25]"]]]],"KY":["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-9]\\d{6})$","345$1",0,"345"],"KZ":["7","810","(?:33622|8\\d{8})\\d{5}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"33|7",0,"8~10"],"LA":["856","00","[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2[13]|3[14]|[4-8]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["30[013-9]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[23]"],"0$1"]],"0"],"LB":["961","00","[27-9]\\d{7}|[13-9]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27-9]"]]],"0"],"LC":["1","011","(?:[58]\\d\\d|758|900)\\d{7}",[10],0,"1",0,"1|([2-8]\\d{6})$","758$1",0,"758"],"LI":["423","00","90\\d{5}|(?:[2378]|6\\d\\d)\\d{6}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[237-9]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"0|(1001)"],"LK":["94","00","[1-9]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[1-689]"],"0$1"]],"0"],"LR":["231","00","(?:2|33|5\\d|77|88)\\d{7}|[4-6]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[4-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3578]"],"0$1"]],"0"],"LS":["266","00","(?:[256]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2568]"]]]],"LT":["370","00","(?:[3469]\\d|52|[78]0)\\d{6}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["52[0-7]"],"(8-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"8 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(8-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(8-$1)",1]],"8",0,"[08]"],"LU":["352","00","35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",[4,5,6,7,8,9,10,11],[["(\\d{2})(\\d{3})","$1 $2",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["20[2-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["2(?:[0367]|4[3-8])"]],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["80[01]|90[015]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["2(?:[0367]|4[3-8])"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})","$1 $2 $3 $4",["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"],"LV":["371","00","(?:[268]\\d|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[269]|8[01]"]]]],"LY":["218","00","[2-9]\\d{8}",[9],[["(\\d{2})(\\d{7})","$1-$2",["[2-9]"],"0$1"]],"0"],"MA":["212","00","[5-8]\\d{8}",[9],[["(\\d{5})(\\d{4})","$1-$2",["5(?:29|38)","5(?:29|38)[89]","5(?:29|38)[89]0"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5[45]"],"0$1"],["(\\d{4})(\\d{5})","$1-$2",["5(?:2[2-489]|3[5-9]|9)|892","5(?:2(?:[2-49]|8[235-9])|3[5-9]|9)|892"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8"],"0$1"],["(\\d{3})(\\d{6})","$1-$2",["[5-7]"],"0$1"]],"0",0,0,0,0,0,[["5(?:29(?:[189][05]|2[29]|3[01])|38[89][05])\\d{4}|5(?:2(?:[0-25-7]\\d|3[1-578]|4[02-46-8]|8[0235-7]|90)|3(?:[0-47]\\d|5[02-9]|6[02-8]|80|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:0\\d|1[0-3]|6[1267]|7[0-57]))\\d{6}"],["80\\d{7}"],["89\\d{7}"],0,0,0,0,["592(?:4[0-2]|93)\\d{4}"]]],"MC":["377","00","(?:[3489]|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["4"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[389]"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["6"],"0$1"]],"0"],"MD":["373","00","(?:[235-7]\\d|[89]0)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["22|3"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[25-7]"],"0$1"]],"0"],"ME":["382","00","(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"0$1"]],"0"],"MF":["590","00","(?:590|(?:69|80)\\d|976)\\d{6}",[9],0,"0",0,0,0,0,0,[["590(?:0[079]|[14]3|[27][79]|30|5[0-268]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["976[01]\\d{5}"]]],"MG":["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"0|([24-9]\\d{6})$","20$1"],"MH":["692","011","329\\d{4}|(?:[256]\\d|45)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1-$2",["[2-6]"]]],"1"],"MK":["389","00","[2-578]\\d{7}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[347]"],"0$1"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["[58]"],"0$1"]],"0"],"ML":["223","00","[24-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-9]"]]]],"MM":["95","00","1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}",[6,7,8,9,10],[["(\\d)(\\d{2})(\\d{3})","$1 $2 $3",["16|2"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["[45]|6(?:0[23]|[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-6]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[4-7]|8[1-35]"],"0$1"],["(\\d)(\\d{3})(\\d{4,6})","$1 $2 $3",["9(?:2[0-4]|[35-9]|4[137-9])"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["92"],"0$1"],["(\\d)(\\d{5})(\\d{4})","$1 $2 $3",["9"],"0$1"]],"0"],"MN":["976","001","[12]\\d{7,9}|[57-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[12]1"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[57-9]"]],["(\\d{3})(\\d{5,6})","$1 $2",["[12]2[1-3]"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["[12](?:27|3[2-8]|4[2-68]|5[1-4689])","[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["[12]"],"0$1"]],"0"],"MO":["853","00","08005\\d\\d|(?:28|[68]\\d)\\d{6}",[7,8],[["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{4})(\\d{4})","$1 $2",["[268]"]]]],"MP":["1","011","[58]\\d{9}|(?:67|90)0\\d{7}",[10],0,"1",0,"1|([2-9]\\d{6})$","670$1",0,"670"],"MQ":["596","00","(?:69|80)\\d{7}|(?:59|97)6\\d{6}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],"MR":["222","00","(?:[2-4]\\d\\d|800)\\d{5}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-48]"]]]],"MS":["1","011","(?:[58]\\d\\d|664|900)\\d{7}",[10],0,"1",0,"1|([34]\\d{6})$","664$1",0,"664"],"MT":["356","00","3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2357-9]"]]]],"MU":["230","0(?:0|[24-7]0|3[03])","(?:5|8\\d\\d)\\d{7}|[2-468]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[2-46]|8[013]"]],["(\\d{4})(\\d{4})","$1 $2",["5"]],["(\\d{5})(\\d{5})","$1 $2",["8"]]],0,0,0,0,0,0,0,"020"],"MV":["960","0(?:0|19)","(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}",[7,10],[["(\\d{3})(\\d{4})","$1-$2",["[3467]|9[13-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,0,"00"],"MW":["265","00","(?:[19]\\d|[23]1|77|88)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[137-9]"],"0$1"]],"0"],"MX":["52","0[09]","199[1-9]\\d{7}|(?:1(?:[01467]\\d|[235][1-9]|8[1-79]|9[1-8])|[2-9]\\d)\\d{8}",[10,11],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"],0,1],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 $3 $4",["1(?:33|5[56]|81)"],0,1],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 $3 $4",["1"],0,1]],"01",0,"0(?:[12]|4[45])|1",0,0,0,0,"00"],"MY":["60","00","1\\d{8,9}|(?:3\\d|[4-9])\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["[4-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1-$2 $3",["1(?:[02469]|[378][1-9])|8"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2 $3",["3"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3-$4",["1[36-8]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2 $3",["15"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2 $3",["1"],"0$1"]],"0"],"MZ":["258","00","(?:2|8\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2|8[2-79]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],"NA":["264","00","[68]\\d{7,8}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["87"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],"NC":["687","00","[2-57-9]\\d{5}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[2-57-9]"]]]],"NE":["227","00","[027-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["08"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[089]|2[013]|7[04]"]]]],"NF":["672","00","[13]\\d{5}",[6],[["(\\d{2})(\\d{4})","$1 $2",["1[0-3]"]],["(\\d)(\\d{5})","$1 $2",["[13]"]]],0,0,"([0-258]\\d{4})$","3$1"],"NG":["234","009","(?:[124-7]|9\\d{3})\\d{6}|[1-9]\\d{7}|[78]\\d{9,13}",[7,8,10,11,12,13,14],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["78"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|9(?:0[3-9]|[1-9])"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[3-7]|8[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[78]"],"0$1"],["(\\d{3})(\\d{5})(\\d{5,6})","$1 $2 $3",["[78]"],"0$1"]],"0"],"NI":["505","00","(?:1800|[25-8]\\d{3})\\d{4}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[125-8]"]]]],"NL":["31","00","(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|[89]\\d{6,9}|1\\d{4,5}",[5,6,7,8,9,10],[["(\\d{3})(\\d{4,7})","$1 $2",["[89]0"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["66"],"0$1"],["(\\d)(\\d{8})","$1 $2",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-57-9]"],"0$1"]],"0"],"NO":["47","00","(?:0|[2-9]\\d{3})\\d{4}",[5,8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[489]|59"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-7]"]]],0,0,0,0,0,"[02-689]|7[0-8]"],"NP":["977","00","(?:1\\d|9)\\d{9}|[1-9]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1-$2",["1[2-6]"],"0$1"],["(\\d{2})(\\d{6})","$1-$2",["1[01]|[2-8]|9(?:[1-579]|6[2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0"],"NR":["674","00","(?:444|(?:55|8\\d)\\d|666)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[4-68]"]]]],"NU":["683","00","(?:[47]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]]],"NZ":["64","0(?:0|161)","[29]\\d{7,9}|50\\d{5}(?:\\d{2,3})?|6[0-35-9]\\d{6}|7\\d{7,8}|8\\d{4,9}|(?:11\\d|[34])\\d{7}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-579]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|[89]0","50(?:[0367]|88)|[89]0"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["24|[346]|7[2-57-9]|9[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:10|74)|[59]|80"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1|2[028]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,5})","$1 $2 $3",["2(?:[169]|7[0-35-9])|7|86"],"0$1"]],"0",0,0,0,0,0,0,"00"],"OM":["968","00","(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}",[7,8,9],[["(\\d{3})(\\d{4,6})","$1 $2",["[58]"]],["(\\d{2})(\\d{6})","$1 $2",["2"]],["(\\d{4})(\\d{4})","$1 $2",["[179]"]]]],"PA":["507","00","8\\d{9}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],["(\\d{4})(\\d{4})","$1-$2",["[68]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]]],"PE":["51","19(?:1[124]|77|90)00","(?:[14-8]|9\\d)\\d{7}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["80"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["1"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[4-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,0,0," Anexo "],"PF":["689","00","4\\d{5}(?:\\d{2})?|8\\d{7,8}",[6,8,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["44"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4|8[7-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],"PG":["675","00|140[1-3]","(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["18|[2-69]|85"]],["(\\d{4})(\\d{4})","$1 $2",["[78]"]]],0,0,0,0,0,0,0,"00"],"PH":["63","00","(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}",[6,8,9,10,11,12,13],[["(\\d)(\\d{5})","$1 $2",["2"],"(0$1)"],["(\\d{4})(\\d{4,6})","$1 $2",["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2","3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"],"(0$1)"],["(\\d{5})(\\d{4})","$1 $2",["346|4(?:27|9[35])|883","3469|4(?:279|9(?:30|56))|8834"],"(0$1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|8[2-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})","$1 $2 $3 $4",["1"]]],"0"],"PK":["92","00","122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,7})","$1 $2 $3",["[89]0"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["1"]],["(\\d{3})(\\d{6,7})","$1 $2",["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])","9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"],"(0$1)"],["(\\d{2})(\\d{7,8})","$1 $2",["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"],"(0$1)"],["(\\d{5})(\\d{5})","$1 $2",["58"],"(0$1)"],["(\\d{3})(\\d{7})","$1 $2",["3"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[24-9]"],"(0$1)"]],"0"],"PL":["48","00","6\\d{5}(?:\\d{2})?|8\\d{9}|[1-9]\\d{6}(?:\\d{2})?",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1","(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["64"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[2-8]|[2-7]|8[1-79]|9[145]"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["8"]]]],"PM":["508","00","(?:[45]|80\\d\\d)\\d{5}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[45]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],"PR":["1","011","(?:[589]\\d\\d|787)\\d{7}",[10],0,"1",0,0,0,0,"787|939"],"PS":["970","00","[2489]2\\d{6}|(?:1\\d|5)\\d{8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2489]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["5"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],"PT":["351","00","1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["2[12]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["16|[236-9]"]]]],"PW":["680","01[12]","(?:[24-8]\\d\\d|345|900)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],"PY":["595","00","59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,7}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3,6})","$1 $2",["[2-9]0"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"],"(0$1)"],["(\\d{3})(\\d{4,5})","$1 $2",["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["87"]],["(\\d{3})(\\d{6})","$1 $2",["9(?:[5-79]|8[1-6])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["9"]]],"0"],"QA":["974","00","[2-7]\\d{7}|(?:2\\d\\d|800)\\d{4}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["2[126]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]"]]]],"RE":["262","00","9769\\d{5}|(?:26|[68]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2689]"],"0$1"]],"0",0,0,0,0,"26[23]|69|[89]"],"RO":["40","00","(?:[237]\\d|[89]0)\\d{7}|[23]\\d{5}",[6,9],[["(\\d{3})(\\d{3})","$1 $2",["2[3-6]","2[3-6]\\d9"],"0$1"],["(\\d{2})(\\d{4})","$1 $2",["219|31"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23]1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[237-9]"],"0$1"]],"0",0,0,0,0,0,0,0," int "],"RS":["381","00","38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",[6,7,8,9,10,11,12],[["(\\d{3})(\\d{3,9})","$1 $2",["(?:2[389]|39)0|[7-9]"],"0$1"],["(\\d{2})(\\d{5,10})","$1 $2",["[1-36]"],"0$1"]],"0"],"RU":["7","810","8\\d{13}|[347-9]\\d{9}",[10,14],[["(\\d{4})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-8]|2[1-9])","7(?:1(?:[0-6]2|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-6]2|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"],"8 ($1)",1],["(\\d{5})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-68]|2[1-9])","7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))","7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[349]|8(?:[02-7]|1[1-8])"],"8 ($1)",1],["(\\d{4})(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3 $4",["8"],"8 ($1)"]],"8",0,0,0,0,"3[04-689]|[489]",0,"8~10"],"RW":["250","00","(?:06|[27]\\d\\d|[89]00)\\d{6}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]]],"0"],"SA":["966","00","92\\d{7}|(?:[15]|8\\d)\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["9"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["81"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0"],"SB":["677","0[01]","(?:[1-6]|[7-9]\\d\\d)\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],"SC":["248","010|0[0-2]","8000\\d{3}|(?:[249]\\d|64)\\d{5}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[246]|9[57]"]]],0,0,0,0,0,0,0,"00"],"SD":["249","00","[19]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[19]"],"0$1"]],"0"],"SE":["46","00","(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{2,3})(\\d{2})","$1-$2 $3",["20"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{4})","$1-$2",["9(?:00|39|44)"],"0$1",0,"$1 $2"],["(\\d{2})(\\d{3})(\\d{2})","$1-$2 $3",["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3"],["(\\d)(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2,3})(\\d{2})","$1-$2 $3",["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{2,3})(\\d{3})","$1-$2 $3",["9(?:00|39|44)"],"0$1",0,"$1 $2 $3"],["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3 $4"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["10|7"],"0$1",0,"$1 $2 $3 $4"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1-$2 $3 $4",["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{3})","$1-$2 $3 $4",["9"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4 $5",["[26]"],"0$1",0,"$1 $2 $3 $4 $5"]],"0"],"SG":["65","0[0-3]\\d","(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["[369]|8(?:0[1-4]|[1-9])"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]],["(\\d{4})(\\d{4})(\\d{3})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],"SH":["290","00","(?:[256]\\d|8)\\d{3}",[4,5],0,0,0,0,0,0,"[256]"],"SI":["386","00|10(?:22|66|88|99)","[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",[5,6,7,8],[["(\\d{2})(\\d{3,6})","$1 $2",["8[09]|9"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["59|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37][01]|4[0139]|51|6"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-57]"],"(0$1)"]],"0",0,0,0,0,0,0,"00"],"SJ":["47","00","0\\d{4}|(?:[489]\\d|[57]9)\\d{6}",[5,8],0,0,0,0,0,0,"79"],"SK":["421","00","[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",[6,7,9],[["(\\d)(\\d{2})(\\d{3,4})","$1 $2 $3",["21"],"0$1"],["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["[3-5][1-8]1","[3-5][1-8]1[67]"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1/$2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[689]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1/$2 $3 $4",["[3-5]"],"0$1"]],"0"],"SL":["232","00","(?:[237-9]\\d|66)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[236-9]"],"(0$1)"]],"0"],"SM":["378","00","(?:0549|[5-7]\\d)\\d{6}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]"]],["(\\d{4})(\\d{6})","$1 $2",["0"]]],0,0,"([89]\\d{5})$","0549$1"],"SN":["221","00","(?:[378]\\d{4}|93330)\\d{4}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[379]"]]]],"SO":["252","00","[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}",[6,7,8,9],[["(\\d{2})(\\d{4})","$1 $2",["8[125]"]],["(\\d{6})","$1",["[134]"]],["(\\d)(\\d{6})","$1 $2",["[15]|2[0-79]|3[0-46-8]|4[0-7]"]],["(\\d)(\\d{7})","$1 $2",["24|[67]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[3478]|64|90"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|6[1-35-9]|9[2-9]"]]],"0"],"SR":["597","00","(?:[2-5]|68|[78]\\d)\\d{5}",[6,7],[["(\\d{2})(\\d{2})(\\d{2})","$1-$2-$3",["56"]],["(\\d{3})(\\d{3})","$1-$2",["[2-5]"]],["(\\d{3})(\\d{4})","$1-$2",["[6-8]"]]]],"SS":["211","00","[19]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[19]"],"0$1"]],"0"],"ST":["239","00","(?:22|9\\d)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[29]"]]]],"SV":["503","00","[267]\\d{7}|[89]00\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[267]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[89]"]]]],"SX":["1","011","7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|(5\\d{6})$","721$1",0,"721"],"SY":["963","00","[1-39]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-5]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1",1]],"0"],"SZ":["268","00","0800\\d{4}|(?:[237]\\d|900)\\d{6}",[8,9],[["(\\d{4})(\\d{4})","$1 $2",["[0237]"]],["(\\d{5})(\\d{4})","$1 $2",["9"]]]],"TA":["290","00","8\\d{3}",[4],0,0,0,0,0,0,"8"],"TC":["1","011","(?:[58]\\d\\d|649|900)\\d{7}",[10],0,"1",0,"1|([2-479]\\d{6})$","649$1",0,"649"],"TD":["235","00|16","(?:22|[69]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2679]"]]],0,0,0,0,0,0,0,"00"],"TG":["228","00","[279]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[279]"]]]],"TH":["66","00[1-9]","1\\d{9}|[1689]\\d{8}|[1-57]\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[13-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],"TJ":["992","810","(?:00|11|[2-57-9]\\d)\\d{7}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"],0,1],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[34]7|91[78]"],0,1],["(\\d{4})(\\d)(\\d{4})","$1 $2 $3",["3[1-5]"],0,1],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02-57-9]|11"],0,1]],"8",0,0,0,0,0,0,"8~10"],"TK":["690","00","[2-47]\\d{3,6}",[4,5,6,7]],"TL":["670","00","7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[2-489]|70"]],["(\\d{4})(\\d{4})","$1 $2",["7"]]]],"TM":["993","810","[1-6]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["12"],"(8 $1)"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-5]"],"(8 $1)"],["(\\d{2})(\\d{6})","$1 $2",["6"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],"TN":["216","00","[2-57-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-57-9]"]]]],"TO":["676","00","(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}",[5,7],[["(\\d{2})(\\d{3})","$1-$2",["[2-4]|50|6[09]|7[0-24-69]|8[05]"]],["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[5-9]"]]]],"TR":["90","00","4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",[7,10,12,13],[["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["512|8[01589]|90"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5(?:[0-59]|61)","5(?:[0-59]|616)","5(?:[0-59]|6161)"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24][1-8]|3[1-9]"],"(0$1)",1],["(\\d{3})(\\d{3})(\\d{6,7})","$1 $2 $3",["80"],"0$1",1]],"0"],"TT":["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-46-8]\\d{6})$","868$1",0,"868"],"TV":["688","00","(?:2|7\\d\\d|90)\\d{4}",[5,6,7],[["(\\d{2})(\\d{3})","$1 $2",["2"]],["(\\d{2})(\\d{4})","$1 $2",["90"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],"TW":["886","0(?:0[25-79]|19)","[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}",[7,8,9,10,11],[["(\\d{2})(\\d)(\\d{4})","$1 $2 $3",["202"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[258]0"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]","[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,5})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,0,0,"#"],"TZ":["255","00[056]","(?:[26-8]\\d|41|90)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[24]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[67]"],"0$1"]],"0"],"UA":["380","00","[89]\\d{9}|[3-9]\\d{8}",[9,10],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]","6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["4[45][0-5]|5(?:0|6[37])|6(?:[12][018]|[36-8])|7|89|9[1-9]|(?:48|57)[0137-9]","4[45][0-5]|5(?:0|6(?:3[14-7]|7))|6(?:[12][018]|[36-8])|7|89|9[1-9]|(?:48|57)[0137-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["[3-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,0,"0~0"],"UG":["256","00[057]","800\\d{6}|(?:[29]0|[347]\\d)\\d{7}",[9],[["(\\d{4})(\\d{5})","$1 $2",["202","2024"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[27-9]|4(?:6[45]|[7-9])"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[34]"],"0$1"]],"0"],"US":["1","011","[2-9]\\d{9}",[10],[["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["(?:2(?:0[1-35-9]|1[02-9]|2[03-589]|3[149]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[01356]|3[0-24679]|4[167]|5[12]|6[014]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[39]|7[0589]|8[04])|5(?:0[1-57-9]|1[0235-8]|20|3[0149]|4[01]|5[19]|6[1-47]|7[0-5]|8[056])|6(?:0[1-35-9]|1[024-9]|2[03689]|[34][016]|5[0179]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-7]|3[1247]|4[037]|5[47]|6[02359]|7[02-59]|8[156])|8(?:0[1-68]|1[02-8]|2[08]|3[0-289]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01579]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[12]|33|44|66|77|88)[2-9]\\d{6}"]]],"UY":["598","0(?:0|1[3-9]\\d)","4\\d{9}|[249]\\d{7}|(?:[49]\\d|80)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["405|8|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[24]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["4"],"0$1"]],"0",0,0,0,0,0,0,"00"," int. "],"UZ":["998","810","(?:33|55|[679]\\d|88)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[35-9]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],"VA":["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11],0,0,0,0,0,0,"06698"],"VC":["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"1|([2-7]\\d{6})$","784$1",0,"784"],"VE":["58","00","[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}",[10],[["(\\d{3})(\\d{7})","$1-$2",["[24-689]"],"0$1"]],"0"],"VG":["1","011","(?:284|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-578]\\d{6})$","284$1",0,"284"],"VI":["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"1|([2-9]\\d{6})$","340$1",0,"340"],"VN":["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["80"],"0$1",1],["(\\d{4})(\\d{4,6})","$1 $2",["1"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[69]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[3578]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["2[48]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["2"],"0$1",1]],"0"],"VU":["678","00","[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}",[5,7],[["(\\d{3})(\\d{4})","$1 $2",["[57-9]"]]]],"WF":["681","00","(?:40|72)\\d{4}|8\\d{5}(?:\\d{3})?",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[478]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],"WS":["685","0","(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}",[5,6,7,10],[["(\\d{5})","$1",["[2-5]|6[1-9]"]],["(\\d{3})(\\d{3,7})","$1 $2",["[68]"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],"XK":["383","00","[23]\\d{7,8}|(?:4\\d\\d|[89]00)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[23]"],"0$1"]],"0"],"YE":["967","00","(?:1|7\\d)\\d{7}|[1-7]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-6]|7[24-68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0"],"YT":["262","00","80\\d{7}|(?:26|63)9\\d{6}",[9],0,"0",0,0,0,0,"269|63"],"ZA":["27","00","[1-79]\\d{8}|8\\d{4,9}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["8[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["8[1-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["860"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],"ZM":["260","00","(?:63|80)0\\d{6}|(?:21|[79]\\d)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[79]"],"0$1"]],"0"],"ZW":["263","00","2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}",[5,6,7,8,9,10],[["(\\d{3})(\\d{3,5})","$1 $2",["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"],"0$1"],["(\\d)(\\d{3})(\\d{2,4})","$1 $2 $3",["[49]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["80"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2","2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)","2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["29[013-9]|39|54"],"0$1"],["(\\d{4})(\\d{3,5})","$1 $2",["(?:25|54)8","258|5483"],"0$1"]],"0"]},"nonGeographic":{"800":["800",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,["[1-9]\\d{7}"]]],"808":["808",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,["[1-9]\\d{7}"]]],"870":["870",0,"7\\d{11}|[35-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[35-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"]]],"878":["878",0,"10\\d{10}",[12],[["(\\d{2})(\\d{5})(\\d{5})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["10\\d{10}"]]],"881":["881",0,"[0-36-9]\\d{8}",[9],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-36-9]"]]],0,0,0,0,0,0,[0,["[0-36-9]\\d{8}"]]],"882":["882",0,"[13]\\d{6}(?:\\d{2,5})?|285\\d{9}|(?:[19]\\d|49)\\d{6}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["4"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[19]"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["34[57]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-3]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|3(?:2|47|7\\d{3})\\d{7}",[7,8,9,10,12]],0,0,0,0,0,0,["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:(?:285\\d\\d|3(?:45|[69]\\d{3}))\\d|9[89])\\d{6}"]]],"883":["883",0,"210\\d{7}|51\\d{7}(?:\\d{3})?",[9,10,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["2"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["510"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["5"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:210|51[013]0\\d)\\d{7}|5100\\d{5}"]]],"888":["888",0,"\\d{11}",[11],[["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3"]],0,0,0,0,0,0,[0,0,0,0,0,0,["\\d{11}"]]],"979":["979",0,"[1359]\\d{8}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[1359]"]]],0,0,0,0,0,0,[0,0,0,["[1359]\\d{8}"]]]}};
|
|
7
|
+
|
|
8
|
+
// The minimum length of the national significant number.
|
|
9
|
+
|
|
10
|
+
var MAX_LENGTH_COUNTRY_CODE = 3; // Digits accepted in phone numbers
|
|
11
|
+
// (ascii, fullwidth, arabic-indic, and eastern arabic digits).
|
|
12
|
+
|
|
13
|
+
var VALID_DIGITS = "0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9"; // `DASHES` will be right after the opening square bracket of the "character class"
|
|
14
|
+
|
|
15
|
+
var DASHES = "-\u2010-\u2015\u2212\u30FC\uFF0D";
|
|
16
|
+
var SLASHES = "\uFF0F/";
|
|
17
|
+
var DOTS = "\uFF0E.";
|
|
18
|
+
var WHITESPACE = " \xA0\xAD\u200B\u2060\u3000";
|
|
19
|
+
var BRACKETS = "()\uFF08\uFF09\uFF3B\uFF3D\\[\\]"; // export const OPENING_BRACKETS = '(\uFF08\uFF3B\\\['
|
|
20
|
+
|
|
21
|
+
var TILDES = "~\u2053\u223C\uFF5E"; // Regular expression of acceptable punctuation found in phone numbers. This
|
|
22
|
+
// excludes punctuation found as a leading character only. This consists of dash
|
|
23
|
+
// characters, white space characters, full stops, slashes, square brackets,
|
|
24
|
+
// parentheses and tildes. Full-width variants are also present.
|
|
25
|
+
|
|
26
|
+
var VALID_PUNCTUATION = "".concat(DASHES).concat(SLASHES).concat(DOTS).concat(WHITESPACE).concat(BRACKETS).concat(TILDES);
|
|
27
|
+
var PLUS_CHARS = "+\uFF0B"; // const LEADING_PLUS_CHARS_PATTERN = new RegExp('^[' + PLUS_CHARS + ']+')
|
|
28
|
+
|
|
29
|
+
// Copy-pasted from:
|
|
30
|
+
// https://github.com/substack/semver-compare/blob/master/index.js
|
|
31
|
+
//
|
|
32
|
+
// Inlining this function because some users reported issues with
|
|
33
|
+
// importing from `semver-compare` in a browser with ES6 "native" modules.
|
|
34
|
+
//
|
|
35
|
+
// Fixes `semver-compare` not being able to compare versions with alpha/beta/etc "tags".
|
|
36
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/381
|
|
37
|
+
function compare (a, b) {
|
|
38
|
+
a = a.split('-');
|
|
39
|
+
b = b.split('-');
|
|
40
|
+
var pa = a[0].split('.');
|
|
41
|
+
var pb = b[0].split('.');
|
|
42
|
+
|
|
43
|
+
for (var i = 0; i < 3; i++) {
|
|
44
|
+
var na = Number(pa[i]);
|
|
45
|
+
var nb = Number(pb[i]);
|
|
46
|
+
if (na > nb) return 1;
|
|
47
|
+
if (nb > na) return -1;
|
|
48
|
+
if (!isNaN(na) && isNaN(nb)) return 1;
|
|
49
|
+
if (isNaN(na) && !isNaN(nb)) return -1;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (a[1] && b[1]) {
|
|
53
|
+
return a[1] > b[1] ? 1 : a[1] < b[1] ? -1 : 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return !a[1] && b[1] ? 1 : a[1] && !b[1] ? -1 : 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
60
|
+
|
|
61
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
62
|
+
|
|
63
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
64
|
+
|
|
65
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
66
|
+
|
|
67
|
+
var V3 = '1.2.0'; // Moved `001` country code to "nonGeographic" section of metadata.
|
|
68
|
+
|
|
69
|
+
var V4 = '1.7.35';
|
|
70
|
+
var DEFAULT_EXT_PREFIX = ' ext. ';
|
|
71
|
+
var CALLING_CODE_REG_EXP = /^\d+$/;
|
|
72
|
+
/**
|
|
73
|
+
* See: https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
var Metadata =
|
|
77
|
+
/*#__PURE__*/
|
|
78
|
+
function () {
|
|
79
|
+
function Metadata(metadata) {
|
|
80
|
+
_classCallCheck(this, Metadata);
|
|
81
|
+
|
|
82
|
+
validateMetadata(metadata);
|
|
83
|
+
this.metadata = metadata;
|
|
84
|
+
setVersion.call(this, metadata);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
_createClass(Metadata, [{
|
|
88
|
+
key: "getCountries",
|
|
89
|
+
value: function getCountries() {
|
|
90
|
+
return Object.keys(this.metadata.countries).filter(function (_) {
|
|
91
|
+
return _ !== '001';
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
key: "getCountryMetadata",
|
|
96
|
+
value: function getCountryMetadata(countryCode) {
|
|
97
|
+
return this.metadata.countries[countryCode];
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
key: "nonGeographic",
|
|
101
|
+
value: function nonGeographic() {
|
|
102
|
+
if (this.v1 || this.v2 || this.v3) return; // `nonGeographical` was a typo.
|
|
103
|
+
// It's present in metadata generated from `1.7.35` to `1.7.37`.
|
|
104
|
+
|
|
105
|
+
return this.metadata.nonGeographic || this.metadata.nonGeographical;
|
|
106
|
+
}
|
|
107
|
+
}, {
|
|
108
|
+
key: "hasCountry",
|
|
109
|
+
value: function hasCountry(country) {
|
|
110
|
+
return this.getCountryMetadata(country) !== undefined;
|
|
111
|
+
}
|
|
112
|
+
}, {
|
|
113
|
+
key: "hasCallingCode",
|
|
114
|
+
value: function hasCallingCode(callingCode) {
|
|
115
|
+
if (this.getCountryCodesForCallingCode(callingCode)) {
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (this.nonGeographic()) {
|
|
120
|
+
if (this.nonGeographic()[callingCode]) {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
// A hacky workaround for old custom metadata (generated before V4).
|
|
125
|
+
var countryCodes = this.countryCallingCodes()[callingCode];
|
|
126
|
+
|
|
127
|
+
if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') {
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}, {
|
|
133
|
+
key: "isNonGeographicCallingCode",
|
|
134
|
+
value: function isNonGeographicCallingCode(callingCode) {
|
|
135
|
+
if (this.nonGeographic()) {
|
|
136
|
+
return this.nonGeographic()[callingCode] ? true : false;
|
|
137
|
+
} else {
|
|
138
|
+
return this.getCountryCodesForCallingCode(callingCode) ? false : true;
|
|
139
|
+
}
|
|
140
|
+
} // Deprecated.
|
|
141
|
+
|
|
142
|
+
}, {
|
|
143
|
+
key: "country",
|
|
144
|
+
value: function country(countryCode) {
|
|
145
|
+
return this.selectNumberingPlan(countryCode);
|
|
146
|
+
}
|
|
147
|
+
}, {
|
|
148
|
+
key: "selectNumberingPlan",
|
|
149
|
+
value: function selectNumberingPlan(countryCode, callingCode) {
|
|
150
|
+
// Supports just passing `callingCode` as the first argument.
|
|
151
|
+
if (countryCode && CALLING_CODE_REG_EXP.test(countryCode)) {
|
|
152
|
+
callingCode = countryCode;
|
|
153
|
+
countryCode = null;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (countryCode && countryCode !== '001') {
|
|
157
|
+
if (!this.hasCountry(countryCode)) {
|
|
158
|
+
throw new Error("Unknown country: ".concat(countryCode));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
this.numberingPlan = new NumberingPlan(this.getCountryMetadata(countryCode), this);
|
|
162
|
+
} else if (callingCode) {
|
|
163
|
+
if (!this.hasCallingCode(callingCode)) {
|
|
164
|
+
throw new Error("Unknown calling code: ".concat(callingCode));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
this.numberingPlan = new NumberingPlan(this.getNumberingPlanMetadata(callingCode), this);
|
|
168
|
+
} else {
|
|
169
|
+
this.numberingPlan = undefined;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return this;
|
|
173
|
+
}
|
|
174
|
+
}, {
|
|
175
|
+
key: "getCountryCodesForCallingCode",
|
|
176
|
+
value: function getCountryCodesForCallingCode(callingCode) {
|
|
177
|
+
var countryCodes = this.countryCallingCodes()[callingCode];
|
|
178
|
+
|
|
179
|
+
if (countryCodes) {
|
|
180
|
+
// Metadata before V4 included "non-geographic entity" calling codes
|
|
181
|
+
// inside `country_calling_codes` (for example, `"881":["001"]`).
|
|
182
|
+
// Now the semantics of `country_calling_codes` has changed:
|
|
183
|
+
// it's specifically for "countries" now.
|
|
184
|
+
// Older versions of custom metadata will simply skip parsing
|
|
185
|
+
// "non-geographic entity" phone numbers with new versions
|
|
186
|
+
// of this library: it's not considered a bug,
|
|
187
|
+
// because such numbers are extremely rare,
|
|
188
|
+
// and developers extremely rarely use custom metadata.
|
|
189
|
+
if (countryCodes.length === 1 && countryCodes[0].length === 3) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return countryCodes;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}, {
|
|
197
|
+
key: "getCountryCodeForCallingCode",
|
|
198
|
+
value: function getCountryCodeForCallingCode(callingCode) {
|
|
199
|
+
var countryCodes = this.getCountryCodesForCallingCode(callingCode);
|
|
200
|
+
|
|
201
|
+
if (countryCodes) {
|
|
202
|
+
return countryCodes[0];
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}, {
|
|
206
|
+
key: "getNumberingPlanMetadata",
|
|
207
|
+
value: function getNumberingPlanMetadata(callingCode) {
|
|
208
|
+
var countryCode = this.getCountryCodeForCallingCode(callingCode);
|
|
209
|
+
|
|
210
|
+
if (countryCode) {
|
|
211
|
+
return this.getCountryMetadata(countryCode);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (this.nonGeographic()) {
|
|
215
|
+
var metadata = this.nonGeographic()[callingCode];
|
|
216
|
+
|
|
217
|
+
if (metadata) {
|
|
218
|
+
return metadata;
|
|
219
|
+
}
|
|
220
|
+
} else {
|
|
221
|
+
// A hacky workaround for old custom metadata (generated before V4).
|
|
222
|
+
var countryCodes = this.countryCallingCodes()[callingCode];
|
|
223
|
+
|
|
224
|
+
if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') {
|
|
225
|
+
return this.metadata.countries['001'];
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
} // Deprecated.
|
|
229
|
+
|
|
230
|
+
}, {
|
|
231
|
+
key: "countryCallingCode",
|
|
232
|
+
value: function countryCallingCode() {
|
|
233
|
+
return this.numberingPlan.callingCode();
|
|
234
|
+
} // Deprecated.
|
|
235
|
+
|
|
236
|
+
}, {
|
|
237
|
+
key: "IDDPrefix",
|
|
238
|
+
value: function IDDPrefix() {
|
|
239
|
+
return this.numberingPlan.IDDPrefix();
|
|
240
|
+
} // Deprecated.
|
|
241
|
+
|
|
242
|
+
}, {
|
|
243
|
+
key: "defaultIDDPrefix",
|
|
244
|
+
value: function defaultIDDPrefix() {
|
|
245
|
+
return this.numberingPlan.defaultIDDPrefix();
|
|
246
|
+
} // Deprecated.
|
|
247
|
+
|
|
248
|
+
}, {
|
|
249
|
+
key: "nationalNumberPattern",
|
|
250
|
+
value: function nationalNumberPattern() {
|
|
251
|
+
return this.numberingPlan.nationalNumberPattern();
|
|
252
|
+
} // Deprecated.
|
|
253
|
+
|
|
254
|
+
}, {
|
|
255
|
+
key: "possibleLengths",
|
|
256
|
+
value: function possibleLengths() {
|
|
257
|
+
return this.numberingPlan.possibleLengths();
|
|
258
|
+
} // Deprecated.
|
|
259
|
+
|
|
260
|
+
}, {
|
|
261
|
+
key: "formats",
|
|
262
|
+
value: function formats() {
|
|
263
|
+
return this.numberingPlan.formats();
|
|
264
|
+
} // Deprecated.
|
|
265
|
+
|
|
266
|
+
}, {
|
|
267
|
+
key: "nationalPrefixForParsing",
|
|
268
|
+
value: function nationalPrefixForParsing() {
|
|
269
|
+
return this.numberingPlan.nationalPrefixForParsing();
|
|
270
|
+
} // Deprecated.
|
|
271
|
+
|
|
272
|
+
}, {
|
|
273
|
+
key: "nationalPrefixTransformRule",
|
|
274
|
+
value: function nationalPrefixTransformRule() {
|
|
275
|
+
return this.numberingPlan.nationalPrefixTransformRule();
|
|
276
|
+
} // Deprecated.
|
|
277
|
+
|
|
278
|
+
}, {
|
|
279
|
+
key: "leadingDigits",
|
|
280
|
+
value: function leadingDigits() {
|
|
281
|
+
return this.numberingPlan.leadingDigits();
|
|
282
|
+
} // Deprecated.
|
|
283
|
+
|
|
284
|
+
}, {
|
|
285
|
+
key: "hasTypes",
|
|
286
|
+
value: function hasTypes() {
|
|
287
|
+
return this.numberingPlan.hasTypes();
|
|
288
|
+
} // Deprecated.
|
|
289
|
+
|
|
290
|
+
}, {
|
|
291
|
+
key: "type",
|
|
292
|
+
value: function type(_type) {
|
|
293
|
+
return this.numberingPlan.type(_type);
|
|
294
|
+
} // Deprecated.
|
|
295
|
+
|
|
296
|
+
}, {
|
|
297
|
+
key: "ext",
|
|
298
|
+
value: function ext() {
|
|
299
|
+
return this.numberingPlan.ext();
|
|
300
|
+
}
|
|
301
|
+
}, {
|
|
302
|
+
key: "countryCallingCodes",
|
|
303
|
+
value: function countryCallingCodes() {
|
|
304
|
+
if (this.v1) return this.metadata.country_phone_code_to_countries;
|
|
305
|
+
return this.metadata.country_calling_codes;
|
|
306
|
+
} // Deprecated.
|
|
307
|
+
|
|
308
|
+
}, {
|
|
309
|
+
key: "chooseCountryByCountryCallingCode",
|
|
310
|
+
value: function chooseCountryByCountryCallingCode(callingCode) {
|
|
311
|
+
return this.selectNumberingPlan(callingCode);
|
|
312
|
+
}
|
|
313
|
+
}, {
|
|
314
|
+
key: "hasSelectedNumberingPlan",
|
|
315
|
+
value: function hasSelectedNumberingPlan() {
|
|
316
|
+
return this.numberingPlan !== undefined;
|
|
317
|
+
}
|
|
318
|
+
}]);
|
|
319
|
+
|
|
320
|
+
return Metadata;
|
|
321
|
+
}();
|
|
322
|
+
|
|
323
|
+
var NumberingPlan =
|
|
324
|
+
/*#__PURE__*/
|
|
325
|
+
function () {
|
|
326
|
+
function NumberingPlan(metadata, globalMetadataObject) {
|
|
327
|
+
_classCallCheck(this, NumberingPlan);
|
|
328
|
+
|
|
329
|
+
this.globalMetadataObject = globalMetadataObject;
|
|
330
|
+
this.metadata = metadata;
|
|
331
|
+
setVersion.call(this, globalMetadataObject.metadata);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
_createClass(NumberingPlan, [{
|
|
335
|
+
key: "callingCode",
|
|
336
|
+
value: function callingCode() {
|
|
337
|
+
return this.metadata[0];
|
|
338
|
+
} // Formatting information for regions which share
|
|
339
|
+
// a country calling code is contained by only one region
|
|
340
|
+
// for performance reasons. For example, for NANPA region
|
|
341
|
+
// ("North American Numbering Plan Administration",
|
|
342
|
+
// which includes USA, Canada, Cayman Islands, Bahamas, etc)
|
|
343
|
+
// it will be contained in the metadata for `US`.
|
|
344
|
+
|
|
345
|
+
}, {
|
|
346
|
+
key: "getDefaultCountryMetadataForRegion",
|
|
347
|
+
value: function getDefaultCountryMetadataForRegion() {
|
|
348
|
+
return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode());
|
|
349
|
+
}
|
|
350
|
+
}, {
|
|
351
|
+
key: "IDDPrefix",
|
|
352
|
+
value: function IDDPrefix() {
|
|
353
|
+
if (this.v1 || this.v2) return;
|
|
354
|
+
return this.metadata[1];
|
|
355
|
+
}
|
|
356
|
+
}, {
|
|
357
|
+
key: "defaultIDDPrefix",
|
|
358
|
+
value: function defaultIDDPrefix() {
|
|
359
|
+
if (this.v1 || this.v2) return;
|
|
360
|
+
return this.metadata[12];
|
|
361
|
+
}
|
|
362
|
+
}, {
|
|
363
|
+
key: "nationalNumberPattern",
|
|
364
|
+
value: function nationalNumberPattern() {
|
|
365
|
+
if (this.v1 || this.v2) return this.metadata[1];
|
|
366
|
+
return this.metadata[2];
|
|
367
|
+
}
|
|
368
|
+
}, {
|
|
369
|
+
key: "possibleLengths",
|
|
370
|
+
value: function possibleLengths() {
|
|
371
|
+
if (this.v1) return;
|
|
372
|
+
return this.metadata[this.v2 ? 2 : 3];
|
|
373
|
+
}
|
|
374
|
+
}, {
|
|
375
|
+
key: "_getFormats",
|
|
376
|
+
value: function _getFormats(metadata) {
|
|
377
|
+
return metadata[this.v1 ? 2 : this.v2 ? 3 : 4];
|
|
378
|
+
} // For countries of the same region (e.g. NANPA)
|
|
379
|
+
// formats are all stored in the "main" country for that region.
|
|
380
|
+
// E.g. "RU" and "KZ", "US" and "CA".
|
|
381
|
+
|
|
382
|
+
}, {
|
|
383
|
+
key: "formats",
|
|
384
|
+
value: function formats() {
|
|
385
|
+
var _this = this;
|
|
386
|
+
|
|
387
|
+
var formats = this._getFormats(this.metadata) || this._getFormats(this.getDefaultCountryMetadataForRegion()) || [];
|
|
388
|
+
return formats.map(function (_) {
|
|
389
|
+
return new Format(_, _this);
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
}, {
|
|
393
|
+
key: "nationalPrefix",
|
|
394
|
+
value: function nationalPrefix() {
|
|
395
|
+
return this.metadata[this.v1 ? 3 : this.v2 ? 4 : 5];
|
|
396
|
+
}
|
|
397
|
+
}, {
|
|
398
|
+
key: "_getNationalPrefixFormattingRule",
|
|
399
|
+
value: function _getNationalPrefixFormattingRule(metadata) {
|
|
400
|
+
return metadata[this.v1 ? 4 : this.v2 ? 5 : 6];
|
|
401
|
+
} // For countries of the same region (e.g. NANPA)
|
|
402
|
+
// national prefix formatting rule is stored in the "main" country for that region.
|
|
403
|
+
// E.g. "RU" and "KZ", "US" and "CA".
|
|
404
|
+
|
|
405
|
+
}, {
|
|
406
|
+
key: "nationalPrefixFormattingRule",
|
|
407
|
+
value: function nationalPrefixFormattingRule() {
|
|
408
|
+
return this._getNationalPrefixFormattingRule(this.metadata) || this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion());
|
|
409
|
+
}
|
|
410
|
+
}, {
|
|
411
|
+
key: "_nationalPrefixForParsing",
|
|
412
|
+
value: function _nationalPrefixForParsing() {
|
|
413
|
+
return this.metadata[this.v1 ? 5 : this.v2 ? 6 : 7];
|
|
414
|
+
}
|
|
415
|
+
}, {
|
|
416
|
+
key: "nationalPrefixForParsing",
|
|
417
|
+
value: function nationalPrefixForParsing() {
|
|
418
|
+
// If `national_prefix_for_parsing` is not set explicitly,
|
|
419
|
+
// then infer it from `national_prefix` (if any)
|
|
420
|
+
return this._nationalPrefixForParsing() || this.nationalPrefix();
|
|
421
|
+
}
|
|
422
|
+
}, {
|
|
423
|
+
key: "nationalPrefixTransformRule",
|
|
424
|
+
value: function nationalPrefixTransformRule() {
|
|
425
|
+
return this.metadata[this.v1 ? 6 : this.v2 ? 7 : 8];
|
|
426
|
+
}
|
|
427
|
+
}, {
|
|
428
|
+
key: "_getNationalPrefixIsOptionalWhenFormatting",
|
|
429
|
+
value: function _getNationalPrefixIsOptionalWhenFormatting() {
|
|
430
|
+
return !!this.metadata[this.v1 ? 7 : this.v2 ? 8 : 9];
|
|
431
|
+
} // For countries of the same region (e.g. NANPA)
|
|
432
|
+
// "national prefix is optional when formatting" flag is
|
|
433
|
+
// stored in the "main" country for that region.
|
|
434
|
+
// E.g. "RU" and "KZ", "US" and "CA".
|
|
435
|
+
|
|
436
|
+
}, {
|
|
437
|
+
key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat",
|
|
438
|
+
value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {
|
|
439
|
+
return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata) || this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion());
|
|
440
|
+
}
|
|
441
|
+
}, {
|
|
442
|
+
key: "leadingDigits",
|
|
443
|
+
value: function leadingDigits() {
|
|
444
|
+
return this.metadata[this.v1 ? 8 : this.v2 ? 9 : 10];
|
|
445
|
+
}
|
|
446
|
+
}, {
|
|
447
|
+
key: "types",
|
|
448
|
+
value: function types() {
|
|
449
|
+
return this.metadata[this.v1 ? 9 : this.v2 ? 10 : 11];
|
|
450
|
+
}
|
|
451
|
+
}, {
|
|
452
|
+
key: "hasTypes",
|
|
453
|
+
value: function hasTypes() {
|
|
454
|
+
// Versions 1.2.0 - 1.2.4: can be `[]`.
|
|
455
|
+
|
|
456
|
+
/* istanbul ignore next */
|
|
457
|
+
if (this.types() && this.types().length === 0) {
|
|
458
|
+
return false;
|
|
459
|
+
} // Versions <= 1.2.4: can be `undefined`.
|
|
460
|
+
// Version >= 1.2.5: can be `0`.
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
return !!this.types();
|
|
464
|
+
}
|
|
465
|
+
}, {
|
|
466
|
+
key: "type",
|
|
467
|
+
value: function type(_type2) {
|
|
468
|
+
if (this.hasTypes() && getType(this.types(), _type2)) {
|
|
469
|
+
return new Type(getType(this.types(), _type2), this);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}, {
|
|
473
|
+
key: "ext",
|
|
474
|
+
value: function ext() {
|
|
475
|
+
if (this.v1 || this.v2) return DEFAULT_EXT_PREFIX;
|
|
476
|
+
return this.metadata[13] || DEFAULT_EXT_PREFIX;
|
|
477
|
+
}
|
|
478
|
+
}]);
|
|
479
|
+
|
|
480
|
+
return NumberingPlan;
|
|
481
|
+
}();
|
|
482
|
+
|
|
483
|
+
var Format =
|
|
484
|
+
/*#__PURE__*/
|
|
485
|
+
function () {
|
|
486
|
+
function Format(format, metadata) {
|
|
487
|
+
_classCallCheck(this, Format);
|
|
488
|
+
|
|
489
|
+
this._format = format;
|
|
490
|
+
this.metadata = metadata;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
_createClass(Format, [{
|
|
494
|
+
key: "pattern",
|
|
495
|
+
value: function pattern() {
|
|
496
|
+
return this._format[0];
|
|
497
|
+
}
|
|
498
|
+
}, {
|
|
499
|
+
key: "format",
|
|
500
|
+
value: function format() {
|
|
501
|
+
return this._format[1];
|
|
502
|
+
}
|
|
503
|
+
}, {
|
|
504
|
+
key: "leadingDigitsPatterns",
|
|
505
|
+
value: function leadingDigitsPatterns() {
|
|
506
|
+
return this._format[2] || [];
|
|
507
|
+
}
|
|
508
|
+
}, {
|
|
509
|
+
key: "nationalPrefixFormattingRule",
|
|
510
|
+
value: function nationalPrefixFormattingRule() {
|
|
511
|
+
return this._format[3] || this.metadata.nationalPrefixFormattingRule();
|
|
512
|
+
}
|
|
513
|
+
}, {
|
|
514
|
+
key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat",
|
|
515
|
+
value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {
|
|
516
|
+
return !!this._format[4] || this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat();
|
|
517
|
+
}
|
|
518
|
+
}, {
|
|
519
|
+
key: "nationalPrefixIsMandatoryWhenFormattingInNationalFormat",
|
|
520
|
+
value: function nationalPrefixIsMandatoryWhenFormattingInNationalFormat() {
|
|
521
|
+
// National prefix is omitted if there's no national prefix formatting rule
|
|
522
|
+
// set for this country, or when the national prefix formatting rule
|
|
523
|
+
// contains no national prefix itself, or when this rule is set but
|
|
524
|
+
// national prefix is optional for this phone number format
|
|
525
|
+
// (and it is not enforced explicitly)
|
|
526
|
+
return this.usesNationalPrefix() && !this.nationalPrefixIsOptionalWhenFormattingInNationalFormat();
|
|
527
|
+
} // Checks whether national prefix formatting rule contains national prefix.
|
|
528
|
+
|
|
529
|
+
}, {
|
|
530
|
+
key: "usesNationalPrefix",
|
|
531
|
+
value: function usesNationalPrefix() {
|
|
532
|
+
return this.nationalPrefixFormattingRule() && // Check that national prefix formatting rule is not a "dummy" one.
|
|
533
|
+
!FIRST_GROUP_ONLY_PREFIX_PATTERN.test(this.nationalPrefixFormattingRule()) // In compressed metadata, `this.nationalPrefixFormattingRule()` is `0`
|
|
534
|
+
// when `national_prefix_formatting_rule` is not present.
|
|
535
|
+
// So, `true` or `false` are returned explicitly here, so that
|
|
536
|
+
// `0` number isn't returned.
|
|
537
|
+
? true : false;
|
|
538
|
+
}
|
|
539
|
+
}, {
|
|
540
|
+
key: "internationalFormat",
|
|
541
|
+
value: function internationalFormat() {
|
|
542
|
+
return this._format[5] || this.format();
|
|
543
|
+
}
|
|
544
|
+
}]);
|
|
545
|
+
|
|
546
|
+
return Format;
|
|
547
|
+
}();
|
|
548
|
+
/**
|
|
549
|
+
* A pattern that is used to determine if the national prefix formatting rule
|
|
550
|
+
* has the first group only, i.e., does not start with the national prefix.
|
|
551
|
+
* Note that the pattern explicitly allows for unbalanced parentheses.
|
|
552
|
+
*/
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
var FIRST_GROUP_ONLY_PREFIX_PATTERN = /^\(?\$1\)?$/;
|
|
556
|
+
|
|
557
|
+
var Type =
|
|
558
|
+
/*#__PURE__*/
|
|
559
|
+
function () {
|
|
560
|
+
function Type(type, metadata) {
|
|
561
|
+
_classCallCheck(this, Type);
|
|
562
|
+
|
|
563
|
+
this.type = type;
|
|
564
|
+
this.metadata = metadata;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
_createClass(Type, [{
|
|
568
|
+
key: "pattern",
|
|
569
|
+
value: function pattern() {
|
|
570
|
+
if (this.metadata.v1) return this.type;
|
|
571
|
+
return this.type[0];
|
|
572
|
+
}
|
|
573
|
+
}, {
|
|
574
|
+
key: "possibleLengths",
|
|
575
|
+
value: function possibleLengths() {
|
|
576
|
+
if (this.metadata.v1) return;
|
|
577
|
+
return this.type[1] || this.metadata.possibleLengths();
|
|
578
|
+
}
|
|
579
|
+
}]);
|
|
580
|
+
|
|
581
|
+
return Type;
|
|
582
|
+
}();
|
|
583
|
+
|
|
584
|
+
function getType(types, type) {
|
|
585
|
+
switch (type) {
|
|
586
|
+
case 'FIXED_LINE':
|
|
587
|
+
return types[0];
|
|
588
|
+
|
|
589
|
+
case 'MOBILE':
|
|
590
|
+
return types[1];
|
|
591
|
+
|
|
592
|
+
case 'TOLL_FREE':
|
|
593
|
+
return types[2];
|
|
594
|
+
|
|
595
|
+
case 'PREMIUM_RATE':
|
|
596
|
+
return types[3];
|
|
597
|
+
|
|
598
|
+
case 'PERSONAL_NUMBER':
|
|
599
|
+
return types[4];
|
|
600
|
+
|
|
601
|
+
case 'VOICEMAIL':
|
|
602
|
+
return types[5];
|
|
603
|
+
|
|
604
|
+
case 'UAN':
|
|
605
|
+
return types[6];
|
|
606
|
+
|
|
607
|
+
case 'PAGER':
|
|
608
|
+
return types[7];
|
|
609
|
+
|
|
610
|
+
case 'VOIP':
|
|
611
|
+
return types[8];
|
|
612
|
+
|
|
613
|
+
case 'SHARED_COST':
|
|
614
|
+
return types[9];
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
function validateMetadata(metadata) {
|
|
619
|
+
if (!metadata) {
|
|
620
|
+
throw new Error('[libphonenumber-js] `metadata` argument not passed. Check your arguments.');
|
|
621
|
+
} // `country_phone_code_to_countries` was renamed to
|
|
622
|
+
// `country_calling_codes` in `1.0.18`.
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
if (!is_object(metadata) || !is_object(metadata.countries)) {
|
|
626
|
+
throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(is_object(metadata) ? 'an object of shape: { ' + Object.keys(metadata).join(', ') + ' }' : 'a ' + type_of(metadata) + ': ' + metadata, "."));
|
|
627
|
+
}
|
|
628
|
+
} // Babel transforms `typeof` into some "branches"
|
|
629
|
+
// so istanbul will show this as "branch not covered".
|
|
630
|
+
|
|
631
|
+
/* istanbul ignore next */
|
|
632
|
+
|
|
633
|
+
var is_object = function is_object(_) {
|
|
634
|
+
return _typeof(_) === 'object';
|
|
635
|
+
}; // Babel transforms `typeof` into some "branches"
|
|
636
|
+
// so istanbul will show this as "branch not covered".
|
|
637
|
+
|
|
638
|
+
/* istanbul ignore next */
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
var type_of = function type_of(_) {
|
|
642
|
+
return _typeof(_);
|
|
643
|
+
};
|
|
644
|
+
/**
|
|
645
|
+
* Returns "country calling code" for a country.
|
|
646
|
+
* Throws an error if the country doesn't exist or isn't supported by this library.
|
|
647
|
+
* @param {string} country
|
|
648
|
+
* @param {object} metadata
|
|
649
|
+
* @return {string}
|
|
650
|
+
* @example
|
|
651
|
+
* // Returns "44"
|
|
652
|
+
* getCountryCallingCode("GB")
|
|
653
|
+
*/
|
|
654
|
+
|
|
655
|
+
function getCountryCallingCode(country, metadata) {
|
|
656
|
+
metadata = new Metadata(metadata);
|
|
657
|
+
|
|
658
|
+
if (metadata.hasCountry(country)) {
|
|
659
|
+
return metadata.country(country).countryCallingCode();
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
throw new Error("Unknown country: ".concat(country));
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
function setVersion(metadata) {
|
|
666
|
+
var version = metadata.version;
|
|
667
|
+
|
|
668
|
+
if (typeof version === 'number') {
|
|
669
|
+
this.v1 = version === 1;
|
|
670
|
+
this.v2 = version === 2;
|
|
671
|
+
this.v3 = version === 3;
|
|
672
|
+
this.v4 = version === 4;
|
|
673
|
+
} else {
|
|
674
|
+
if (!version) {
|
|
675
|
+
this.v1 = true;
|
|
676
|
+
} else if (compare(version, V3) === -1) {
|
|
677
|
+
this.v2 = true;
|
|
678
|
+
} else if (compare(version, V4) === -1) {
|
|
679
|
+
this.v3 = true;
|
|
680
|
+
} else {
|
|
681
|
+
this.v4 = true;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
} // const ISO_COUNTRY_CODE = /^[A-Z]{2}$/
|
|
685
|
+
// function isCountryCode(countryCode) {
|
|
686
|
+
// return ISO_COUNTRY_CODE.test(countryCodeOrCountryCallingCode)
|
|
687
|
+
// }
|
|
688
|
+
|
|
689
|
+
// These mappings map a character (key) to a specific digit that should
|
|
690
|
+
// replace it for normalization purposes. Non-European digits that
|
|
691
|
+
// may be used in phone numbers are mapped to a European equivalent.
|
|
692
|
+
//
|
|
693
|
+
// E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.
|
|
694
|
+
//
|
|
695
|
+
var DIGITS = {
|
|
696
|
+
'0': '0',
|
|
697
|
+
'1': '1',
|
|
698
|
+
'2': '2',
|
|
699
|
+
'3': '3',
|
|
700
|
+
'4': '4',
|
|
701
|
+
'5': '5',
|
|
702
|
+
'6': '6',
|
|
703
|
+
'7': '7',
|
|
704
|
+
'8': '8',
|
|
705
|
+
'9': '9',
|
|
706
|
+
"\uFF10": '0',
|
|
707
|
+
// Fullwidth digit 0
|
|
708
|
+
"\uFF11": '1',
|
|
709
|
+
// Fullwidth digit 1
|
|
710
|
+
"\uFF12": '2',
|
|
711
|
+
// Fullwidth digit 2
|
|
712
|
+
"\uFF13": '3',
|
|
713
|
+
// Fullwidth digit 3
|
|
714
|
+
"\uFF14": '4',
|
|
715
|
+
// Fullwidth digit 4
|
|
716
|
+
"\uFF15": '5',
|
|
717
|
+
// Fullwidth digit 5
|
|
718
|
+
"\uFF16": '6',
|
|
719
|
+
// Fullwidth digit 6
|
|
720
|
+
"\uFF17": '7',
|
|
721
|
+
// Fullwidth digit 7
|
|
722
|
+
"\uFF18": '8',
|
|
723
|
+
// Fullwidth digit 8
|
|
724
|
+
"\uFF19": '9',
|
|
725
|
+
// Fullwidth digit 9
|
|
726
|
+
"\u0660": '0',
|
|
727
|
+
// Arabic-indic digit 0
|
|
728
|
+
"\u0661": '1',
|
|
729
|
+
// Arabic-indic digit 1
|
|
730
|
+
"\u0662": '2',
|
|
731
|
+
// Arabic-indic digit 2
|
|
732
|
+
"\u0663": '3',
|
|
733
|
+
// Arabic-indic digit 3
|
|
734
|
+
"\u0664": '4',
|
|
735
|
+
// Arabic-indic digit 4
|
|
736
|
+
"\u0665": '5',
|
|
737
|
+
// Arabic-indic digit 5
|
|
738
|
+
"\u0666": '6',
|
|
739
|
+
// Arabic-indic digit 6
|
|
740
|
+
"\u0667": '7',
|
|
741
|
+
// Arabic-indic digit 7
|
|
742
|
+
"\u0668": '8',
|
|
743
|
+
// Arabic-indic digit 8
|
|
744
|
+
"\u0669": '9',
|
|
745
|
+
// Arabic-indic digit 9
|
|
746
|
+
"\u06F0": '0',
|
|
747
|
+
// Eastern-Arabic digit 0
|
|
748
|
+
"\u06F1": '1',
|
|
749
|
+
// Eastern-Arabic digit 1
|
|
750
|
+
"\u06F2": '2',
|
|
751
|
+
// Eastern-Arabic digit 2
|
|
752
|
+
"\u06F3": '3',
|
|
753
|
+
// Eastern-Arabic digit 3
|
|
754
|
+
"\u06F4": '4',
|
|
755
|
+
// Eastern-Arabic digit 4
|
|
756
|
+
"\u06F5": '5',
|
|
757
|
+
// Eastern-Arabic digit 5
|
|
758
|
+
"\u06F6": '6',
|
|
759
|
+
// Eastern-Arabic digit 6
|
|
760
|
+
"\u06F7": '7',
|
|
761
|
+
// Eastern-Arabic digit 7
|
|
762
|
+
"\u06F8": '8',
|
|
763
|
+
// Eastern-Arabic digit 8
|
|
764
|
+
"\u06F9": '9' // Eastern-Arabic digit 9
|
|
765
|
+
|
|
766
|
+
};
|
|
767
|
+
function parseDigit(character) {
|
|
768
|
+
return DIGITS[character];
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Parses phone number digits from a string.
|
|
772
|
+
* Drops all punctuation leaving only digits.
|
|
773
|
+
* Also converts wide-ascii and arabic-indic numerals to conventional numerals.
|
|
774
|
+
* E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.
|
|
775
|
+
* @param {string} string
|
|
776
|
+
* @return {string}
|
|
777
|
+
* @example
|
|
778
|
+
* ```js
|
|
779
|
+
* parseDigits('8 (800) 555')
|
|
780
|
+
* // Outputs '8800555'.
|
|
781
|
+
* ```
|
|
782
|
+
*/
|
|
783
|
+
|
|
784
|
+
function parseDigits(string) {
|
|
785
|
+
var result = ''; // Using `.split('')` here instead of normal `for ... of`
|
|
786
|
+
// because the importing application doesn't neccessarily include an ES6 polyfill.
|
|
787
|
+
// The `.split('')` approach discards "exotic" UTF-8 characters
|
|
788
|
+
// (the ones consisting of four bytes) but digits
|
|
789
|
+
// (including non-European ones) don't fall into that range
|
|
790
|
+
// so such "exotic" characters would be discarded anyway.
|
|
791
|
+
|
|
792
|
+
for (var _iterator = string.split(''), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
|
793
|
+
var _ref;
|
|
794
|
+
|
|
795
|
+
if (_isArray) {
|
|
796
|
+
if (_i >= _iterator.length) break;
|
|
797
|
+
_ref = _iterator[_i++];
|
|
798
|
+
} else {
|
|
799
|
+
_i = _iterator.next();
|
|
800
|
+
if (_i.done) break;
|
|
801
|
+
_ref = _i.value;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
var character = _ref;
|
|
805
|
+
var digit = parseDigit(character);
|
|
806
|
+
|
|
807
|
+
if (digit) {
|
|
808
|
+
result += digit;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
return result;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* Merges two arrays.
|
|
817
|
+
* @param {*} a
|
|
818
|
+
* @param {*} b
|
|
819
|
+
* @return {*}
|
|
820
|
+
*/
|
|
821
|
+
function mergeArrays(a, b) {
|
|
822
|
+
var merged = a.slice();
|
|
823
|
+
|
|
824
|
+
for (var _iterator = b, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
|
825
|
+
var _ref;
|
|
826
|
+
|
|
827
|
+
if (_isArray) {
|
|
828
|
+
if (_i >= _iterator.length) break;
|
|
829
|
+
_ref = _iterator[_i++];
|
|
830
|
+
} else {
|
|
831
|
+
_i = _iterator.next();
|
|
832
|
+
if (_i.done) break;
|
|
833
|
+
_ref = _i.value;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
var element = _ref;
|
|
837
|
+
|
|
838
|
+
if (a.indexOf(element) < 0) {
|
|
839
|
+
merged.push(element);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
return merged.sort(function (a, b) {
|
|
844
|
+
return a - b;
|
|
845
|
+
}); // ES6 version, requires Set polyfill.
|
|
846
|
+
// let merged = new Set(a)
|
|
847
|
+
// for (const element of b) {
|
|
848
|
+
// merged.add(i)
|
|
849
|
+
// }
|
|
850
|
+
// return Array.from(merged).sort((a, b) => a - b)
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
function checkNumberLength(nationalNumber, metadata) {
|
|
854
|
+
return checkNumberLengthForType(nationalNumber, undefined, metadata);
|
|
855
|
+
} // Checks whether a number is possible for the country based on its length.
|
|
856
|
+
// Should only be called for the "new" metadata which has "possible lengths".
|
|
857
|
+
|
|
858
|
+
function checkNumberLengthForType(nationalNumber, type, metadata) {
|
|
859
|
+
var type_info = metadata.type(type); // There should always be "<possiblePengths/>" set for every type element.
|
|
860
|
+
// This is declared in the XML schema.
|
|
861
|
+
// For size efficiency, where a sub-description (e.g. fixed-line)
|
|
862
|
+
// has the same "<possiblePengths/>" as the "general description", this is missing,
|
|
863
|
+
// so we fall back to the "general description". Where no numbers of the type
|
|
864
|
+
// exist at all, there is one possible length (-1) which is guaranteed
|
|
865
|
+
// not to match the length of any real phone number.
|
|
866
|
+
|
|
867
|
+
var possible_lengths = type_info && type_info.possibleLengths() || metadata.possibleLengths(); // let local_lengths = type_info && type.possibleLengthsLocal() || metadata.possibleLengthsLocal()
|
|
868
|
+
// Metadata before version `1.0.18` didn't contain `possible_lengths`.
|
|
869
|
+
|
|
870
|
+
if (!possible_lengths) {
|
|
871
|
+
return 'IS_POSSIBLE';
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
if (type === 'FIXED_LINE_OR_MOBILE') {
|
|
875
|
+
// No such country in metadata.
|
|
876
|
+
|
|
877
|
+
/* istanbul ignore next */
|
|
878
|
+
if (!metadata.type('FIXED_LINE')) {
|
|
879
|
+
// The rare case has been encountered where no fixedLine data is available
|
|
880
|
+
// (true for some non-geographic entities), so we just check mobile.
|
|
881
|
+
return checkNumberLengthForType(nationalNumber, 'MOBILE', metadata);
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
var mobile_type = metadata.type('MOBILE');
|
|
885
|
+
|
|
886
|
+
if (mobile_type) {
|
|
887
|
+
// Merge the mobile data in if there was any. "Concat" creates a new
|
|
888
|
+
// array, it doesn't edit possible_lengths in place, so we don't need a copy.
|
|
889
|
+
// Note that when adding the possible lengths from mobile, we have
|
|
890
|
+
// to again check they aren't empty since if they are this indicates
|
|
891
|
+
// they are the same as the general desc and should be obtained from there.
|
|
892
|
+
possible_lengths = mergeArrays(possible_lengths, mobile_type.possibleLengths()); // The current list is sorted; we need to merge in the new list and
|
|
893
|
+
// re-sort (duplicates are okay). Sorting isn't so expensive because
|
|
894
|
+
// the lists are very small.
|
|
895
|
+
// if (local_lengths) {
|
|
896
|
+
// local_lengths = mergeArrays(local_lengths, mobile_type.possibleLengthsLocal())
|
|
897
|
+
// } else {
|
|
898
|
+
// local_lengths = mobile_type.possibleLengthsLocal()
|
|
899
|
+
// }
|
|
900
|
+
}
|
|
901
|
+
} // If the type doesn't exist then return 'INVALID_LENGTH'.
|
|
902
|
+
else if (type && !type_info) {
|
|
903
|
+
return 'INVALID_LENGTH';
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
var actual_length = nationalNumber.length; // In `libphonenumber-js` all "local-only" formats are dropped for simplicity.
|
|
907
|
+
// // This is safe because there is never an overlap beween the possible lengths
|
|
908
|
+
// // and the local-only lengths; this is checked at build time.
|
|
909
|
+
// if (local_lengths && local_lengths.indexOf(nationalNumber.length) >= 0)
|
|
910
|
+
// {
|
|
911
|
+
// return 'IS_POSSIBLE_LOCAL_ONLY'
|
|
912
|
+
// }
|
|
913
|
+
|
|
914
|
+
var minimum_length = possible_lengths[0];
|
|
915
|
+
|
|
916
|
+
if (minimum_length === actual_length) {
|
|
917
|
+
return 'IS_POSSIBLE';
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
if (minimum_length > actual_length) {
|
|
921
|
+
return 'TOO_SHORT';
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
if (possible_lengths[possible_lengths.length - 1] < actual_length) {
|
|
925
|
+
return 'TOO_LONG';
|
|
926
|
+
} // We skip the first element since we've already checked it.
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
return possible_lengths.indexOf(actual_length, 1) >= 0 ? 'IS_POSSIBLE' : 'INVALID_LENGTH';
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
function isPossiblePhoneNumber(input, options, metadata) {
|
|
933
|
+
/* istanbul ignore if */
|
|
934
|
+
if (options === undefined) {
|
|
935
|
+
options = {};
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
metadata = new Metadata(metadata);
|
|
939
|
+
|
|
940
|
+
if (options.v2) {
|
|
941
|
+
if (!input.countryCallingCode) {
|
|
942
|
+
throw new Error('Invalid phone number object passed');
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
metadata.selectNumberingPlan(input.countryCallingCode);
|
|
946
|
+
} else {
|
|
947
|
+
if (!input.phone) {
|
|
948
|
+
return false;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
if (input.country) {
|
|
952
|
+
if (!metadata.hasCountry(input.country)) {
|
|
953
|
+
throw new Error("Unknown country: ".concat(input.country));
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
metadata.country(input.country);
|
|
957
|
+
} else {
|
|
958
|
+
if (!input.countryCallingCode) {
|
|
959
|
+
throw new Error('Invalid phone number object passed');
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
metadata.selectNumberingPlan(input.countryCallingCode);
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
if (metadata.possibleLengths()) {
|
|
967
|
+
return isPossibleNumber(input.phone || input.nationalNumber, metadata);
|
|
968
|
+
} else {
|
|
969
|
+
// There was a bug between `1.7.35` and `1.7.37` where "possible_lengths"
|
|
970
|
+
// were missing for "non-geographical" numbering plans.
|
|
971
|
+
// Just assume the number is possible in such cases:
|
|
972
|
+
// it's unlikely that anyone generated their custom metadata
|
|
973
|
+
// in that short period of time (one day).
|
|
974
|
+
// This code can be removed in some future major version update.
|
|
975
|
+
if (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) {
|
|
976
|
+
// "Non-geographic entities" did't have `possibleLengths`
|
|
977
|
+
// due to a bug in metadata generation process.
|
|
978
|
+
return true;
|
|
979
|
+
} else {
|
|
980
|
+
throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.');
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
function isPossibleNumber(nationalNumber, metadata) {
|
|
985
|
+
//, isInternational) {
|
|
986
|
+
switch (checkNumberLength(nationalNumber, metadata)) {
|
|
987
|
+
case 'IS_POSSIBLE':
|
|
988
|
+
return true;
|
|
989
|
+
// This library ignores "local-only" phone numbers (for simplicity).
|
|
990
|
+
// See the readme for more info on what are "local-only" phone numbers.
|
|
991
|
+
// case 'IS_POSSIBLE_LOCAL_ONLY':
|
|
992
|
+
// return !isInternational
|
|
993
|
+
|
|
994
|
+
default:
|
|
995
|
+
return false;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* @param {object} - `{ ?number, ?extension }`.
|
|
1001
|
+
* @return {string} Phone URI (RFC 3966).
|
|
1002
|
+
*/
|
|
1003
|
+
|
|
1004
|
+
function formatRFC3966(_ref2) {
|
|
1005
|
+
var number = _ref2.number,
|
|
1006
|
+
ext = _ref2.ext;
|
|
1007
|
+
|
|
1008
|
+
if (!number) {
|
|
1009
|
+
return '';
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
if (number[0] !== '+') {
|
|
1013
|
+
throw new Error("\"formatRFC3966()\" expects \"number\" to be in E.164 format.");
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
return "tel:".concat(number).concat(ext ? ';ext=' + ext : '');
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
/**
|
|
1020
|
+
* Checks whether the entire input sequence can be matched
|
|
1021
|
+
* against the regular expression.
|
|
1022
|
+
* @return {boolean}
|
|
1023
|
+
*/
|
|
1024
|
+
function matchesEntirely(text, regular_expression) {
|
|
1025
|
+
// If assigning the `''` default value is moved to the arguments above,
|
|
1026
|
+
// code coverage would decrease for some weird reason.
|
|
1027
|
+
text = text || '';
|
|
1028
|
+
return new RegExp('^(?:' + regular_expression + ')$').test(text);
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
var NON_FIXED_LINE_PHONE_TYPES = ['MOBILE', 'PREMIUM_RATE', 'TOLL_FREE', 'SHARED_COST', 'VOIP', 'PERSONAL_NUMBER', 'PAGER', 'UAN', 'VOICEMAIL']; // Finds out national phone number type (fixed line, mobile, etc)
|
|
1032
|
+
|
|
1033
|
+
function getNumberType(input, options, metadata) {
|
|
1034
|
+
// If assigning the `{}` default value is moved to the arguments above,
|
|
1035
|
+
// code coverage would decrease for some weird reason.
|
|
1036
|
+
options = options || {}; // When `parse()` returned `{}`
|
|
1037
|
+
// meaning that the phone number is not a valid one.
|
|
1038
|
+
|
|
1039
|
+
if (!input.country) {
|
|
1040
|
+
return;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
metadata = new Metadata(metadata);
|
|
1044
|
+
metadata.selectNumberingPlan(input.country, input.countryCallingCode);
|
|
1045
|
+
var nationalNumber = options.v2 ? input.nationalNumber : input.phone; // The following is copy-pasted from the original function:
|
|
1046
|
+
// https://github.com/googlei18n/libphonenumber/blob/3ea547d4fbaa2d0b67588904dfa5d3f2557c27ff/javascript/i18n/phonenumbers/phonenumberutil.js#L2835
|
|
1047
|
+
// Is this national number even valid for this country
|
|
1048
|
+
|
|
1049
|
+
if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern())) {
|
|
1050
|
+
return;
|
|
1051
|
+
} // Is it fixed line number
|
|
1052
|
+
|
|
1053
|
+
|
|
1054
|
+
if (isNumberTypeEqualTo(nationalNumber, 'FIXED_LINE', metadata)) {
|
|
1055
|
+
// Because duplicate regular expressions are removed
|
|
1056
|
+
// to reduce metadata size, if "mobile" pattern is ""
|
|
1057
|
+
// then it means it was removed due to being a duplicate of the fixed-line pattern.
|
|
1058
|
+
//
|
|
1059
|
+
if (metadata.type('MOBILE') && metadata.type('MOBILE').pattern() === '') {
|
|
1060
|
+
return 'FIXED_LINE_OR_MOBILE';
|
|
1061
|
+
} // v1 metadata.
|
|
1062
|
+
// Legacy.
|
|
1063
|
+
// Deprecated.
|
|
1064
|
+
|
|
1065
|
+
|
|
1066
|
+
if (!metadata.type('MOBILE')) {
|
|
1067
|
+
return 'FIXED_LINE_OR_MOBILE';
|
|
1068
|
+
} // Check if the number happens to qualify as both fixed line and mobile.
|
|
1069
|
+
// (no such country in the minimal metadata set)
|
|
1070
|
+
|
|
1071
|
+
/* istanbul ignore if */
|
|
1072
|
+
|
|
1073
|
+
|
|
1074
|
+
if (isNumberTypeEqualTo(nationalNumber, 'MOBILE', metadata)) {
|
|
1075
|
+
return 'FIXED_LINE_OR_MOBILE';
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
return 'FIXED_LINE';
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
for (var _i = 0, _NON_FIXED_LINE_PHONE = NON_FIXED_LINE_PHONE_TYPES; _i < _NON_FIXED_LINE_PHONE.length; _i++) {
|
|
1082
|
+
var type = _NON_FIXED_LINE_PHONE[_i];
|
|
1083
|
+
|
|
1084
|
+
if (isNumberTypeEqualTo(nationalNumber, type, metadata)) {
|
|
1085
|
+
return type;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
function isNumberTypeEqualTo(nationalNumber, type, metadata) {
|
|
1090
|
+
type = metadata.type(type);
|
|
1091
|
+
|
|
1092
|
+
if (!type || !type.pattern()) {
|
|
1093
|
+
return false;
|
|
1094
|
+
} // Check if any possible number lengths are present;
|
|
1095
|
+
// if so, we use them to avoid checking
|
|
1096
|
+
// the validation pattern if they don't match.
|
|
1097
|
+
// If they are absent, this means they match
|
|
1098
|
+
// the general description, which we have
|
|
1099
|
+
// already checked before a specific number type.
|
|
1100
|
+
|
|
1101
|
+
|
|
1102
|
+
if (type.possibleLengths() && type.possibleLengths().indexOf(nationalNumber.length) < 0) {
|
|
1103
|
+
return false;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
return matchesEntirely(nationalNumber, type.pattern());
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
/**
|
|
1110
|
+
* Checks if a given phone number is valid.
|
|
1111
|
+
*
|
|
1112
|
+
* If the `number` is a string, it will be parsed to an object,
|
|
1113
|
+
* but only if it contains only valid phone number characters (including punctuation).
|
|
1114
|
+
* If the `number` is an object, it is used as is.
|
|
1115
|
+
*
|
|
1116
|
+
* The optional `defaultCountry` argument is the default country.
|
|
1117
|
+
* I.e. it does not restrict to just that country,
|
|
1118
|
+
* e.g. in those cases where several countries share
|
|
1119
|
+
* the same phone numbering rules (NANPA, Britain, etc).
|
|
1120
|
+
* For example, even though the number `07624 369230`
|
|
1121
|
+
* belongs to the Isle of Man ("IM" country code)
|
|
1122
|
+
* calling `isValidNumber('07624369230', 'GB', metadata)`
|
|
1123
|
+
* still returns `true` because the country is not restricted to `GB`,
|
|
1124
|
+
* it's just that `GB` is the default one for the phone numbering rules.
|
|
1125
|
+
* For restricting the country see `isValidNumberForRegion()`
|
|
1126
|
+
* though restricting a country might not be a good idea.
|
|
1127
|
+
* https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion
|
|
1128
|
+
*
|
|
1129
|
+
* Examples:
|
|
1130
|
+
*
|
|
1131
|
+
* ```js
|
|
1132
|
+
* isValidNumber('+78005553535', metadata)
|
|
1133
|
+
* isValidNumber('8005553535', 'RU', metadata)
|
|
1134
|
+
* isValidNumber('88005553535', 'RU', metadata)
|
|
1135
|
+
* isValidNumber({ phone: '8005553535', country: 'RU' }, metadata)
|
|
1136
|
+
* ```
|
|
1137
|
+
*/
|
|
1138
|
+
|
|
1139
|
+
function isValidNumber(input, options, metadata) {
|
|
1140
|
+
// If assigning the `{}` default value is moved to the arguments above,
|
|
1141
|
+
// code coverage would decrease for some weird reason.
|
|
1142
|
+
options = options || {};
|
|
1143
|
+
metadata = new Metadata(metadata); // This is just to support `isValidNumber({})`
|
|
1144
|
+
// for cases when `parseNumber()` returns `{}`.
|
|
1145
|
+
|
|
1146
|
+
if (!input.country) {
|
|
1147
|
+
return false;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
metadata.selectNumberingPlan(input.country, input.countryCallingCode); // By default, countries only have type regexps when it's required for
|
|
1151
|
+
// distinguishing different countries having the same `countryCallingCode`.
|
|
1152
|
+
|
|
1153
|
+
if (metadata.hasTypes()) {
|
|
1154
|
+
return getNumberType(input, options, metadata.metadata) !== undefined;
|
|
1155
|
+
} // If there are no type regexps for this country in metadata then use
|
|
1156
|
+
// `nationalNumberPattern` as a "better than nothing" replacement.
|
|
1157
|
+
|
|
1158
|
+
|
|
1159
|
+
var national_number = options.v2 ? input.nationalNumber : input.phone;
|
|
1160
|
+
return matchesEntirely(national_number, metadata.nationalNumberPattern());
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
//
|
|
1164
|
+
// E.g. "(999) 111-22-33" -> "999 111 22 33"
|
|
1165
|
+
//
|
|
1166
|
+
// For some reason Google's metadata contains `<intlFormat/>`s with brackets and dashes.
|
|
1167
|
+
// Meanwhile, there's no single opinion about using punctuation in international phone numbers.
|
|
1168
|
+
//
|
|
1169
|
+
// For example, Google's `<intlFormat/>` for USA is `+1 213-373-4253`.
|
|
1170
|
+
// And here's a quote from WikiPedia's "North American Numbering Plan" page:
|
|
1171
|
+
// https://en.wikipedia.org/wiki/North_American_Numbering_Plan
|
|
1172
|
+
//
|
|
1173
|
+
// "The country calling code for all countries participating in the NANP is 1.
|
|
1174
|
+
// In international format, an NANP number should be listed as +1 301 555 01 00,
|
|
1175
|
+
// where 301 is an area code (Maryland)."
|
|
1176
|
+
//
|
|
1177
|
+
// I personally prefer the international format without any punctuation.
|
|
1178
|
+
// For example, brackets are remnants of the old age, meaning that the
|
|
1179
|
+
// phone number part in brackets (so called "area code") can be omitted
|
|
1180
|
+
// if dialing within the same "area".
|
|
1181
|
+
// And hyphens were clearly introduced for splitting local numbers into memorizable groups.
|
|
1182
|
+
// For example, remembering "5553535" is difficult but "555-35-35" is much simpler.
|
|
1183
|
+
// Imagine a man taking a bus from home to work and seeing an ad with a phone number.
|
|
1184
|
+
// He has a couple of seconds to memorize that number until it passes by.
|
|
1185
|
+
// If it were spaces instead of hyphens the man wouldn't necessarily get it,
|
|
1186
|
+
// but with hyphens instead of spaces the grouping is more explicit.
|
|
1187
|
+
// I personally think that hyphens introduce visual clutter,
|
|
1188
|
+
// so I prefer replacing them with spaces in international numbers.
|
|
1189
|
+
// In the modern age all output is done on displays where spaces are clearly distinguishable
|
|
1190
|
+
// so hyphens can be safely replaced with spaces without losing any legibility.
|
|
1191
|
+
//
|
|
1192
|
+
|
|
1193
|
+
function applyInternationalSeparatorStyle(formattedNumber) {
|
|
1194
|
+
return formattedNumber.replace(new RegExp("[".concat(VALID_PUNCTUATION, "]+"), 'g'), ' ').trim();
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
// first group is not used in the national pattern (e.g. Argentina) so the $1
|
|
1198
|
+
// group does not match correctly. Therefore, we use `\d`, so that the first
|
|
1199
|
+
// group actually used in the pattern will be matched.
|
|
1200
|
+
|
|
1201
|
+
var FIRST_GROUP_PATTERN = /(\$\d)/;
|
|
1202
|
+
function formatNationalNumberUsingFormat(number, format, _ref) {
|
|
1203
|
+
var useInternationalFormat = _ref.useInternationalFormat,
|
|
1204
|
+
withNationalPrefix = _ref.withNationalPrefix;
|
|
1205
|
+
var formattedNumber = number.replace(new RegExp(format.pattern()), useInternationalFormat ? format.internationalFormat() : // This library doesn't use `domestic_carrier_code_formatting_rule`,
|
|
1206
|
+
// because that one is only used when formatting phone numbers
|
|
1207
|
+
// for dialing from a mobile phone, and this is not a dialing library.
|
|
1208
|
+
// carrierCode && format.domesticCarrierCodeFormattingRule()
|
|
1209
|
+
// // First, replace the $CC in the formatting rule with the desired carrier code.
|
|
1210
|
+
// // Then, replace the $FG in the formatting rule with the first group
|
|
1211
|
+
// // and the carrier code combined in the appropriate way.
|
|
1212
|
+
// ? format.format().replace(FIRST_GROUP_PATTERN, format.domesticCarrierCodeFormattingRule().replace('$CC', carrierCode))
|
|
1213
|
+
// : (
|
|
1214
|
+
// withNationalPrefix && format.nationalPrefixFormattingRule()
|
|
1215
|
+
// ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule())
|
|
1216
|
+
// : format.format()
|
|
1217
|
+
// )
|
|
1218
|
+
withNationalPrefix && format.nationalPrefixFormattingRule() ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()) : format.format());
|
|
1219
|
+
|
|
1220
|
+
if (useInternationalFormat) {
|
|
1221
|
+
return applyInternationalSeparatorStyle(formattedNumber);
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
return formattedNumber;
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
/**
|
|
1228
|
+
* Pattern that makes it easy to distinguish whether a region has a single
|
|
1229
|
+
* international dialing prefix or not. If a region has a single international
|
|
1230
|
+
* prefix (e.g. 011 in USA), it will be represented as a string that contains
|
|
1231
|
+
* a sequence of ASCII digits, and possibly a tilde, which signals waiting for
|
|
1232
|
+
* the tone. If there are multiple available international prefixes in a
|
|
1233
|
+
* region, they will be represented as a regex string that always contains one
|
|
1234
|
+
* or more characters that are not ASCII digits or a tilde.
|
|
1235
|
+
*/
|
|
1236
|
+
|
|
1237
|
+
var SINGLE_IDD_PREFIX_REG_EXP = /^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/; // For regions that have multiple IDD prefixes
|
|
1238
|
+
// a preferred IDD prefix is returned.
|
|
1239
|
+
|
|
1240
|
+
function getIddPrefix(country, callingCode, metadata) {
|
|
1241
|
+
var countryMetadata = new Metadata(metadata);
|
|
1242
|
+
countryMetadata.selectNumberingPlan(country, callingCode);
|
|
1243
|
+
|
|
1244
|
+
if (countryMetadata.defaultIDDPrefix()) {
|
|
1245
|
+
return countryMetadata.defaultIDDPrefix();
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
if (SINGLE_IDD_PREFIX_REG_EXP.test(countryMetadata.IDDPrefix())) {
|
|
1249
|
+
return countryMetadata.IDDPrefix();
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
|
1254
|
+
|
|
1255
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1256
|
+
var DEFAULT_OPTIONS = {
|
|
1257
|
+
formatExtension: function formatExtension(formattedNumber, extension, metadata) {
|
|
1258
|
+
return "".concat(formattedNumber).concat(metadata.ext()).concat(extension);
|
|
1259
|
+
} // Formats a phone number
|
|
1260
|
+
//
|
|
1261
|
+
// Example use cases:
|
|
1262
|
+
//
|
|
1263
|
+
// ```js
|
|
1264
|
+
// formatNumber('8005553535', 'RU', 'INTERNATIONAL')
|
|
1265
|
+
// formatNumber('8005553535', 'RU', 'INTERNATIONAL', metadata)
|
|
1266
|
+
// formatNumber({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL')
|
|
1267
|
+
// formatNumber({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL', metadata)
|
|
1268
|
+
// formatNumber('+78005553535', 'NATIONAL')
|
|
1269
|
+
// formatNumber('+78005553535', 'NATIONAL', metadata)
|
|
1270
|
+
// ```
|
|
1271
|
+
//
|
|
1272
|
+
|
|
1273
|
+
};
|
|
1274
|
+
function formatNumber(input, format, options, metadata) {
|
|
1275
|
+
// Apply default options.
|
|
1276
|
+
if (options) {
|
|
1277
|
+
options = _objectSpread({}, DEFAULT_OPTIONS, options);
|
|
1278
|
+
} else {
|
|
1279
|
+
options = DEFAULT_OPTIONS;
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
metadata = new Metadata(metadata);
|
|
1283
|
+
|
|
1284
|
+
if (input.country && input.country !== '001') {
|
|
1285
|
+
// Validate `input.country`.
|
|
1286
|
+
if (!metadata.hasCountry(input.country)) {
|
|
1287
|
+
throw new Error("Unknown country: ".concat(input.country));
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
metadata.country(input.country);
|
|
1291
|
+
} else if (input.countryCallingCode) {
|
|
1292
|
+
metadata.selectNumberingPlan(input.countryCallingCode);
|
|
1293
|
+
} else return input.phone || '';
|
|
1294
|
+
|
|
1295
|
+
var countryCallingCode = metadata.countryCallingCode();
|
|
1296
|
+
var nationalNumber = options.v2 ? input.nationalNumber : input.phone; // This variable should have been declared inside `case`s
|
|
1297
|
+
// but Babel has a bug and it says "duplicate variable declaration".
|
|
1298
|
+
|
|
1299
|
+
var number;
|
|
1300
|
+
|
|
1301
|
+
switch (format) {
|
|
1302
|
+
case 'NATIONAL':
|
|
1303
|
+
// Legacy argument support.
|
|
1304
|
+
// (`{ country: ..., phone: '' }`)
|
|
1305
|
+
if (!nationalNumber) {
|
|
1306
|
+
return '';
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
number = formatNationalNumber(nationalNumber, input.carrierCode, 'NATIONAL', metadata, options);
|
|
1310
|
+
return addExtension(number, input.ext, metadata, options.formatExtension);
|
|
1311
|
+
|
|
1312
|
+
case 'INTERNATIONAL':
|
|
1313
|
+
// Legacy argument support.
|
|
1314
|
+
// (`{ country: ..., phone: '' }`)
|
|
1315
|
+
if (!nationalNumber) {
|
|
1316
|
+
return "+".concat(countryCallingCode);
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
number = formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metadata, options);
|
|
1320
|
+
number = "+".concat(countryCallingCode, " ").concat(number);
|
|
1321
|
+
return addExtension(number, input.ext, metadata, options.formatExtension);
|
|
1322
|
+
|
|
1323
|
+
case 'E.164':
|
|
1324
|
+
// `E.164` doesn't define "phone number extensions".
|
|
1325
|
+
return "+".concat(countryCallingCode).concat(nationalNumber);
|
|
1326
|
+
|
|
1327
|
+
case 'RFC3966':
|
|
1328
|
+
return formatRFC3966({
|
|
1329
|
+
number: "+".concat(countryCallingCode).concat(nationalNumber),
|
|
1330
|
+
ext: input.ext
|
|
1331
|
+
});
|
|
1332
|
+
// For reference, here's Google's IDD formatter:
|
|
1333
|
+
// https://github.com/google/libphonenumber/blob/32719cf74e68796788d1ca45abc85dcdc63ba5b9/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L1546
|
|
1334
|
+
// Not saying that this IDD formatter replicates it 1:1, but it seems to work.
|
|
1335
|
+
// Who would even need to format phone numbers in IDD format anyway?
|
|
1336
|
+
|
|
1337
|
+
case 'IDD':
|
|
1338
|
+
if (!options.fromCountry) {
|
|
1339
|
+
return; // throw new Error('`fromCountry` option not passed for IDD-prefixed formatting.')
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
var formattedNumber = formatIDD(nationalNumber, input.carrierCode, countryCallingCode, options.fromCountry, metadata);
|
|
1343
|
+
return addExtension(formattedNumber, input.ext, metadata, options.formatExtension);
|
|
1344
|
+
|
|
1345
|
+
default:
|
|
1346
|
+
throw new Error("Unknown \"format\" argument passed to \"formatNumber()\": \"".concat(format, "\""));
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
function formatNationalNumber(number, carrierCode, formatAs, metadata, options) {
|
|
1351
|
+
var format = chooseFormatForNumber(metadata.formats(), number);
|
|
1352
|
+
|
|
1353
|
+
if (!format) {
|
|
1354
|
+
return number;
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
return formatNationalNumberUsingFormat(number, format, {
|
|
1358
|
+
useInternationalFormat: formatAs === 'INTERNATIONAL',
|
|
1359
|
+
withNationalPrefix: format.nationalPrefixIsOptionalWhenFormattingInNationalFormat() && options && options.nationalPrefix === false ? false : true,
|
|
1360
|
+
carrierCode: carrierCode,
|
|
1361
|
+
metadata: metadata
|
|
1362
|
+
});
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
function chooseFormatForNumber(availableFormats, nationalNnumber) {
|
|
1366
|
+
for (var _iterator = availableFormats, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
|
1367
|
+
var _ref;
|
|
1368
|
+
|
|
1369
|
+
if (_isArray) {
|
|
1370
|
+
if (_i >= _iterator.length) break;
|
|
1371
|
+
_ref = _iterator[_i++];
|
|
1372
|
+
} else {
|
|
1373
|
+
_i = _iterator.next();
|
|
1374
|
+
if (_i.done) break;
|
|
1375
|
+
_ref = _i.value;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
var format = _ref;
|
|
1379
|
+
|
|
1380
|
+
// Validate leading digits
|
|
1381
|
+
if (format.leadingDigitsPatterns().length > 0) {
|
|
1382
|
+
// The last leading_digits_pattern is used here, as it is the most detailed
|
|
1383
|
+
var lastLeadingDigitsPattern = format.leadingDigitsPatterns()[format.leadingDigitsPatterns().length - 1]; // If leading digits don't match then move on to the next phone number format
|
|
1384
|
+
|
|
1385
|
+
if (nationalNnumber.search(lastLeadingDigitsPattern) !== 0) {
|
|
1386
|
+
continue;
|
|
1387
|
+
}
|
|
1388
|
+
} // Check that the national number matches the phone number format regular expression
|
|
1389
|
+
|
|
1390
|
+
|
|
1391
|
+
if (matchesEntirely(nationalNnumber, format.pattern())) {
|
|
1392
|
+
return format;
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
function addExtension(formattedNumber, ext, metadata, formatExtension) {
|
|
1398
|
+
return ext ? formatExtension(formattedNumber, ext, metadata) : formattedNumber;
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
function formatIDD(nationalNumber, carrierCode, countryCallingCode, fromCountry, metadata) {
|
|
1402
|
+
var fromCountryCallingCode = getCountryCallingCode(fromCountry, metadata.metadata); // When calling within the same country calling code.
|
|
1403
|
+
|
|
1404
|
+
if (fromCountryCallingCode === countryCallingCode) {
|
|
1405
|
+
var formattedNumber = formatNationalNumber(nationalNumber, carrierCode, 'NATIONAL', metadata); // For NANPA regions, return the national format for these regions
|
|
1406
|
+
// but prefix it with the country calling code.
|
|
1407
|
+
|
|
1408
|
+
if (countryCallingCode === '1') {
|
|
1409
|
+
return countryCallingCode + ' ' + formattedNumber;
|
|
1410
|
+
} // If regions share a country calling code, the country calling code need
|
|
1411
|
+
// not be dialled. This also applies when dialling within a region, so this
|
|
1412
|
+
// if clause covers both these cases. Technically this is the case for
|
|
1413
|
+
// dialling from La Reunion to other overseas departments of France (French
|
|
1414
|
+
// Guiana, Martinique, Guadeloupe), but not vice versa - so we don't cover
|
|
1415
|
+
// this edge case for now and for those cases return the version including
|
|
1416
|
+
// country calling code. Details here:
|
|
1417
|
+
// http://www.petitfute.com/voyage/225-info-pratiques-reunion
|
|
1418
|
+
//
|
|
1419
|
+
|
|
1420
|
+
|
|
1421
|
+
return formattedNumber;
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
var iddPrefix = getIddPrefix(fromCountry, undefined, metadata.metadata);
|
|
1425
|
+
|
|
1426
|
+
if (iddPrefix) {
|
|
1427
|
+
return "".concat(iddPrefix, " ").concat(countryCallingCode, " ").concat(formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metadata));
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$1(target, key, source[key]); }); } return target; }
|
|
1432
|
+
|
|
1433
|
+
function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1434
|
+
|
|
1435
|
+
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1436
|
+
|
|
1437
|
+
function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
1438
|
+
|
|
1439
|
+
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
|
|
1440
|
+
|
|
1441
|
+
var PhoneNumber =
|
|
1442
|
+
/*#__PURE__*/
|
|
1443
|
+
function () {
|
|
1444
|
+
function PhoneNumber(countryCallingCode, nationalNumber, metadata) {
|
|
1445
|
+
_classCallCheck$1(this, PhoneNumber);
|
|
1446
|
+
|
|
1447
|
+
if (!countryCallingCode) {
|
|
1448
|
+
throw new TypeError('`country` or `countryCallingCode` not passed');
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
if (!nationalNumber) {
|
|
1452
|
+
throw new TypeError('`nationalNumber` not passed');
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
if (!metadata) {
|
|
1456
|
+
throw new TypeError('`metadata` not passed');
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
var _metadata = new Metadata(metadata); // If country code is passed then derive `countryCallingCode` from it.
|
|
1460
|
+
// Also store the country code as `.country`.
|
|
1461
|
+
|
|
1462
|
+
|
|
1463
|
+
if (isCountryCode(countryCallingCode)) {
|
|
1464
|
+
this.country = countryCallingCode;
|
|
1465
|
+
|
|
1466
|
+
_metadata.country(countryCallingCode);
|
|
1467
|
+
|
|
1468
|
+
countryCallingCode = _metadata.countryCallingCode();
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
this.countryCallingCode = countryCallingCode;
|
|
1472
|
+
this.nationalNumber = nationalNumber;
|
|
1473
|
+
this.number = '+' + this.countryCallingCode + this.nationalNumber;
|
|
1474
|
+
this.metadata = metadata;
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
_createClass$1(PhoneNumber, [{
|
|
1478
|
+
key: "isPossible",
|
|
1479
|
+
value: function isPossible() {
|
|
1480
|
+
return isPossiblePhoneNumber(this, {
|
|
1481
|
+
v2: true
|
|
1482
|
+
}, this.metadata);
|
|
1483
|
+
}
|
|
1484
|
+
}, {
|
|
1485
|
+
key: "isValid",
|
|
1486
|
+
value: function isValid() {
|
|
1487
|
+
return isValidNumber(this, {
|
|
1488
|
+
v2: true
|
|
1489
|
+
}, this.metadata);
|
|
1490
|
+
}
|
|
1491
|
+
}, {
|
|
1492
|
+
key: "isNonGeographic",
|
|
1493
|
+
value: function isNonGeographic() {
|
|
1494
|
+
var metadata = new Metadata(this.metadata);
|
|
1495
|
+
return metadata.isNonGeographicCallingCode(this.countryCallingCode);
|
|
1496
|
+
}
|
|
1497
|
+
}, {
|
|
1498
|
+
key: "isEqual",
|
|
1499
|
+
value: function isEqual(phoneNumber) {
|
|
1500
|
+
return this.number === phoneNumber.number && this.ext === phoneNumber.ext;
|
|
1501
|
+
} // // Is just an alias for `this.isValid() && this.country === country`.
|
|
1502
|
+
// // https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion
|
|
1503
|
+
// isValidForRegion(country) {
|
|
1504
|
+
// return isValidNumberForRegion(this, country, { v2: true }, this.metadata)
|
|
1505
|
+
// }
|
|
1506
|
+
|
|
1507
|
+
}, {
|
|
1508
|
+
key: "getType",
|
|
1509
|
+
value: function getType() {
|
|
1510
|
+
return getNumberType(this, {
|
|
1511
|
+
v2: true
|
|
1512
|
+
}, this.metadata);
|
|
1513
|
+
}
|
|
1514
|
+
}, {
|
|
1515
|
+
key: "format",
|
|
1516
|
+
value: function format(_format, options) {
|
|
1517
|
+
return formatNumber(this, _format, options ? _objectSpread$1({}, options, {
|
|
1518
|
+
v2: true
|
|
1519
|
+
}) : {
|
|
1520
|
+
v2: true
|
|
1521
|
+
}, this.metadata);
|
|
1522
|
+
}
|
|
1523
|
+
}, {
|
|
1524
|
+
key: "formatNational",
|
|
1525
|
+
value: function formatNational(options) {
|
|
1526
|
+
return this.format('NATIONAL', options);
|
|
1527
|
+
}
|
|
1528
|
+
}, {
|
|
1529
|
+
key: "formatInternational",
|
|
1530
|
+
value: function formatInternational(options) {
|
|
1531
|
+
return this.format('INTERNATIONAL', options);
|
|
1532
|
+
}
|
|
1533
|
+
}, {
|
|
1534
|
+
key: "getURI",
|
|
1535
|
+
value: function getURI(options) {
|
|
1536
|
+
return this.format('RFC3966', options);
|
|
1537
|
+
}
|
|
1538
|
+
}]);
|
|
1539
|
+
|
|
1540
|
+
return PhoneNumber;
|
|
1541
|
+
}();
|
|
1542
|
+
|
|
1543
|
+
var isCountryCode = function isCountryCode(value) {
|
|
1544
|
+
return /^[A-Z]{2}$/.test(value);
|
|
1545
|
+
};
|
|
1546
|
+
|
|
1547
|
+
var CAPTURING_DIGIT_PATTERN = new RegExp('([' + VALID_DIGITS + '])');
|
|
1548
|
+
function stripIddPrefix(number, country, callingCode, metadata) {
|
|
1549
|
+
if (!country) {
|
|
1550
|
+
return;
|
|
1551
|
+
} // Check if the number is IDD-prefixed.
|
|
1552
|
+
|
|
1553
|
+
|
|
1554
|
+
var countryMetadata = new Metadata(metadata);
|
|
1555
|
+
countryMetadata.selectNumberingPlan(country, callingCode);
|
|
1556
|
+
var IDDPrefixPattern = new RegExp(countryMetadata.IDDPrefix());
|
|
1557
|
+
|
|
1558
|
+
if (number.search(IDDPrefixPattern) !== 0) {
|
|
1559
|
+
return;
|
|
1560
|
+
} // Strip IDD prefix.
|
|
1561
|
+
|
|
1562
|
+
|
|
1563
|
+
number = number.slice(number.match(IDDPrefixPattern)[0].length); // If there're any digits after an IDD prefix,
|
|
1564
|
+
// then those digits are a country calling code.
|
|
1565
|
+
// Since no country code starts with a `0`,
|
|
1566
|
+
// the code below validates that the next digit (if present) is not `0`.
|
|
1567
|
+
|
|
1568
|
+
var matchedGroups = number.match(CAPTURING_DIGIT_PATTERN);
|
|
1569
|
+
|
|
1570
|
+
if (matchedGroups && matchedGroups[1] != null && matchedGroups[1].length > 0) {
|
|
1571
|
+
if (matchedGroups[1] === '0') {
|
|
1572
|
+
return;
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
return number;
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
/**
|
|
1580
|
+
* Strips any national prefix (such as 0, 1) present in a
|
|
1581
|
+
* (possibly incomplete) number provided.
|
|
1582
|
+
* "Carrier codes" are only used in Colombia and Brazil,
|
|
1583
|
+
* and only when dialing within those countries from a mobile phone to a fixed line number.
|
|
1584
|
+
* Sometimes it won't actually strip national prefix
|
|
1585
|
+
* and will instead prepend some digits to the `number`:
|
|
1586
|
+
* for example, when number `2345678` is passed with `VI` country selected,
|
|
1587
|
+
* it will return `{ number: "3402345678" }`, because `340` area code is prepended.
|
|
1588
|
+
* @param {string} number — National number digits.
|
|
1589
|
+
* @param {object} metadata — Metadata with country selected.
|
|
1590
|
+
* @return {object} `{ nationalNumber: string, nationalPrefix: string? carrierCode: string? }`.
|
|
1591
|
+
*/
|
|
1592
|
+
function extractNationalNumberFromPossiblyIncompleteNumber(number, metadata) {
|
|
1593
|
+
if (number && metadata.numberingPlan.nationalPrefixForParsing()) {
|
|
1594
|
+
// See METADATA.md for the description of
|
|
1595
|
+
// `national_prefix_for_parsing` and `national_prefix_transform_rule`.
|
|
1596
|
+
// Attempt to parse the first digits as a national prefix.
|
|
1597
|
+
var prefixPattern = new RegExp('^(?:' + metadata.numberingPlan.nationalPrefixForParsing() + ')');
|
|
1598
|
+
var prefixMatch = prefixPattern.exec(number);
|
|
1599
|
+
|
|
1600
|
+
if (prefixMatch) {
|
|
1601
|
+
var nationalNumber;
|
|
1602
|
+
var carrierCode; // https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule
|
|
1603
|
+
// If a `national_prefix_for_parsing` has any "capturing groups"
|
|
1604
|
+
// then it means that the national (significant) number is equal to
|
|
1605
|
+
// those "capturing groups" transformed via `national_prefix_transform_rule`,
|
|
1606
|
+
// and nothing could be said about the actual national prefix:
|
|
1607
|
+
// what is it and was it even there.
|
|
1608
|
+
// If a `national_prefix_for_parsing` doesn't have any "capturing groups",
|
|
1609
|
+
// then everything it matches is a national prefix.
|
|
1610
|
+
// To determine whether `national_prefix_for_parsing` matched any
|
|
1611
|
+
// "capturing groups", the value of the result of calling `.exec()`
|
|
1612
|
+
// is looked at, and if it has non-undefined values where there're
|
|
1613
|
+
// "capturing groups" in the regular expression, then it means
|
|
1614
|
+
// that "capturing groups" have been matched.
|
|
1615
|
+
// It's not possible to tell whether there'll be any "capturing gropus"
|
|
1616
|
+
// before the matching process, because a `national_prefix_for_parsing`
|
|
1617
|
+
// could exhibit both behaviors.
|
|
1618
|
+
|
|
1619
|
+
var capturedGroupsCount = prefixMatch.length - 1;
|
|
1620
|
+
var hasCapturedGroups = capturedGroupsCount > 0 && prefixMatch[capturedGroupsCount];
|
|
1621
|
+
|
|
1622
|
+
if (metadata.nationalPrefixTransformRule() && hasCapturedGroups) {
|
|
1623
|
+
nationalNumber = number.replace(prefixPattern, metadata.nationalPrefixTransformRule()); // If there's more than one captured group,
|
|
1624
|
+
// then carrier code is the second one.
|
|
1625
|
+
|
|
1626
|
+
if (capturedGroupsCount > 1) {
|
|
1627
|
+
carrierCode = prefixMatch[1];
|
|
1628
|
+
}
|
|
1629
|
+
} // If there're no "capturing groups",
|
|
1630
|
+
// or if there're "capturing groups" but no
|
|
1631
|
+
// `national_prefix_transform_rule`,
|
|
1632
|
+
// then just strip the national prefix from the number,
|
|
1633
|
+
// and possibly a carrier code.
|
|
1634
|
+
// Seems like there could be more.
|
|
1635
|
+
else {
|
|
1636
|
+
// `prefixBeforeNationalNumber` is the whole substring matched by
|
|
1637
|
+
// the `national_prefix_for_parsing` regular expression.
|
|
1638
|
+
// There seem to be no guarantees that it's just a national prefix.
|
|
1639
|
+
// For example, if there's a carrier code, it's gonna be a
|
|
1640
|
+
// part of `prefixBeforeNationalNumber` too.
|
|
1641
|
+
var prefixBeforeNationalNumber = prefixMatch[0];
|
|
1642
|
+
nationalNumber = number.slice(prefixBeforeNationalNumber.length); // If there's at least one captured group,
|
|
1643
|
+
// then carrier code is the first one.
|
|
1644
|
+
|
|
1645
|
+
if (hasCapturedGroups) {
|
|
1646
|
+
carrierCode = prefixMatch[1];
|
|
1647
|
+
}
|
|
1648
|
+
} // Tries to guess whether a national prefix was present in the input.
|
|
1649
|
+
// This is not something copy-pasted from Google's library:
|
|
1650
|
+
// they don't seem to have an equivalent for that.
|
|
1651
|
+
// So this isn't an "officially approved" way of doing something like that.
|
|
1652
|
+
// But since there seems no other existing method, this library uses it.
|
|
1653
|
+
|
|
1654
|
+
|
|
1655
|
+
var nationalPrefix;
|
|
1656
|
+
|
|
1657
|
+
if (hasCapturedGroups) {
|
|
1658
|
+
var possiblePositionOfTheFirstCapturedGroup = number.indexOf(prefixMatch[1]);
|
|
1659
|
+
var possibleNationalPrefix = number.slice(0, possiblePositionOfTheFirstCapturedGroup); // Example: an Argentinian (AR) phone number `0111523456789`.
|
|
1660
|
+
// `prefixMatch[0]` is `01115`, and `$1` is `11`,
|
|
1661
|
+
// and the rest of the phone number is `23456789`.
|
|
1662
|
+
// The national number is transformed via `9$1` to `91123456789`.
|
|
1663
|
+
// National prefix `0` is detected being present at the start.
|
|
1664
|
+
// if (possibleNationalPrefix.indexOf(metadata.numberingPlan.nationalPrefix()) === 0) {
|
|
1665
|
+
|
|
1666
|
+
if (possibleNationalPrefix === metadata.numberingPlan.nationalPrefix()) {
|
|
1667
|
+
nationalPrefix = metadata.numberingPlan.nationalPrefix();
|
|
1668
|
+
}
|
|
1669
|
+
} else {
|
|
1670
|
+
nationalPrefix = prefixMatch[0];
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
return {
|
|
1674
|
+
nationalNumber: nationalNumber,
|
|
1675
|
+
nationalPrefix: nationalPrefix,
|
|
1676
|
+
carrierCode: carrierCode
|
|
1677
|
+
};
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
return {
|
|
1682
|
+
nationalNumber: number
|
|
1683
|
+
};
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
/**
|
|
1687
|
+
* Strips national prefix and carrier code from a complete phone number.
|
|
1688
|
+
* The difference from the non-"FromCompleteNumber" function is that
|
|
1689
|
+
* it won't extract national prefix if the resultant number is too short
|
|
1690
|
+
* to be a complete number for the selected phone numbering plan.
|
|
1691
|
+
* @param {string} number — Complete phone number digits.
|
|
1692
|
+
* @param {Metadata} metadata — Metadata with a phone numbering plan selected.
|
|
1693
|
+
* @return {object} `{ nationalNumber: string, carrierCode: string? }`.
|
|
1694
|
+
*/
|
|
1695
|
+
|
|
1696
|
+
function extractNationalNumber(number, metadata) {
|
|
1697
|
+
// Parsing national prefixes and carrier codes
|
|
1698
|
+
// is only required for local phone numbers
|
|
1699
|
+
// but some people don't understand that
|
|
1700
|
+
// and sometimes write international phone numbers
|
|
1701
|
+
// with national prefixes (or maybe even carrier codes).
|
|
1702
|
+
// http://ucken.blogspot.ru/2016/03/trunk-prefixes-in-skype4b.html
|
|
1703
|
+
// Google's original library forgives such mistakes
|
|
1704
|
+
// and so does this library, because it has been requested:
|
|
1705
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/127
|
|
1706
|
+
var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(number, metadata),
|
|
1707
|
+
nationalNumber = _extractNationalNumbe.nationalNumber,
|
|
1708
|
+
carrierCode = _extractNationalNumbe.carrierCode;
|
|
1709
|
+
|
|
1710
|
+
if (!shouldExtractNationalPrefix(number, nationalNumber, metadata)) {
|
|
1711
|
+
// Don't strip the national prefix.
|
|
1712
|
+
return {
|
|
1713
|
+
nationalNumber: number
|
|
1714
|
+
};
|
|
1715
|
+
} // If a national prefix has been extracted, check to see
|
|
1716
|
+
// if the resultant number isn't too short.
|
|
1717
|
+
// Same code in Google's `libphonenumber`:
|
|
1718
|
+
// https://github.com/google/libphonenumber/blob/e326fa1fc4283bb05eb35cb3c15c18f98a31af33/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3291-L3302
|
|
1719
|
+
// For some reason, they do this check right after the `national_number_pattern` check
|
|
1720
|
+
// this library does in `shouldExtractNationalPrefix()` function.
|
|
1721
|
+
// Why is there a second "resultant" number validity check?
|
|
1722
|
+
// They don't provide an explanation.
|
|
1723
|
+
// This library just copies the behavior.
|
|
1724
|
+
|
|
1725
|
+
|
|
1726
|
+
if (number.length !== nationalNumber.length + (carrierCode ? carrierCode.length : 0)) {
|
|
1727
|
+
// If not using legacy generated metadata (before version `1.0.18`)
|
|
1728
|
+
// then it has "possible lengths", so use those to validate the number length.
|
|
1729
|
+
if (metadata.possibleLengths()) {
|
|
1730
|
+
// "We require that the NSN remaining after stripping the national prefix and
|
|
1731
|
+
// carrier code be long enough to be a possible length for the region.
|
|
1732
|
+
// Otherwise, we don't do the stripping, since the original number could be
|
|
1733
|
+
// a valid short number."
|
|
1734
|
+
// https://github.com/google/libphonenumber/blob/876268eb1ad6cdc1b7b5bef17fc5e43052702d57/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3236-L3250
|
|
1735
|
+
switch (checkNumberLength(nationalNumber, metadata)) {
|
|
1736
|
+
case 'TOO_SHORT':
|
|
1737
|
+
case 'INVALID_LENGTH':
|
|
1738
|
+
// case 'IS_POSSIBLE_LOCAL_ONLY':
|
|
1739
|
+
// Don't strip the national prefix.
|
|
1740
|
+
return {
|
|
1741
|
+
nationalNumber: number
|
|
1742
|
+
};
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
return {
|
|
1748
|
+
nationalNumber: nationalNumber,
|
|
1749
|
+
carrierCode: carrierCode
|
|
1750
|
+
};
|
|
1751
|
+
} // In some countries, the same digit could be a national prefix
|
|
1752
|
+
// or a leading digit of a valid phone number.
|
|
1753
|
+
// For example, in Russia, national prefix is `8`,
|
|
1754
|
+
// and also `800 555 35 35` is a valid number
|
|
1755
|
+
// in which `8` is not a national prefix, but the first digit
|
|
1756
|
+
// of a national (significant) number.
|
|
1757
|
+
// Same's with Belarus:
|
|
1758
|
+
// `82004910060` is a valid national (significant) number,
|
|
1759
|
+
// but `2004910060` is not.
|
|
1760
|
+
// To support such cases (to prevent the code from always stripping
|
|
1761
|
+
// national prefix), a condition is imposed: a national prefix
|
|
1762
|
+
// is not extracted when the original number is "viable" and the
|
|
1763
|
+
// resultant number is not, a "viable" national number being the one
|
|
1764
|
+
// that matches `national_number_pattern`.
|
|
1765
|
+
|
|
1766
|
+
function shouldExtractNationalPrefix(number, nationalSignificantNumber, metadata) {
|
|
1767
|
+
// The equivalent in Google's code is:
|
|
1768
|
+
// https://github.com/google/libphonenumber/blob/e326fa1fc4283bb05eb35cb3c15c18f98a31af33/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L2969-L3004
|
|
1769
|
+
if (matchesEntirely(number, metadata.nationalNumberPattern()) && !matchesEntirely(nationalSignificantNumber, metadata.nationalNumberPattern())) {
|
|
1770
|
+
return false;
|
|
1771
|
+
} // Just "possible" number check would be more relaxed, so it's not used.
|
|
1772
|
+
// if (isPossibleNumber(number, metadata) &&
|
|
1773
|
+
// !isPossibleNumber(numberWithNationalPrefixExtracted, metadata)) {
|
|
1774
|
+
// return false
|
|
1775
|
+
// }
|
|
1776
|
+
|
|
1777
|
+
|
|
1778
|
+
return true;
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
/**
|
|
1782
|
+
* Sometimes some people incorrectly input international phone numbers
|
|
1783
|
+
* without the leading `+`. This function corrects such input.
|
|
1784
|
+
* @param {string} number — Phone number digits.
|
|
1785
|
+
* @param {string?} country
|
|
1786
|
+
* @param {string?} callingCode
|
|
1787
|
+
* @param {object} metadata
|
|
1788
|
+
* @return {object} `{ countryCallingCode: string?, number: string }`.
|
|
1789
|
+
*/
|
|
1790
|
+
|
|
1791
|
+
function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata) {
|
|
1792
|
+
var countryCallingCode = country ? getCountryCallingCode(country, metadata) : callingCode;
|
|
1793
|
+
|
|
1794
|
+
if (number.indexOf(countryCallingCode) === 0) {
|
|
1795
|
+
metadata = new Metadata(metadata);
|
|
1796
|
+
metadata.selectNumberingPlan(country, callingCode);
|
|
1797
|
+
var possibleShorterNumber = number.slice(countryCallingCode.length);
|
|
1798
|
+
|
|
1799
|
+
var _extractNationalNumbe = extractNationalNumber(possibleShorterNumber, metadata),
|
|
1800
|
+
possibleShorterNationalNumber = _extractNationalNumbe.nationalNumber;
|
|
1801
|
+
|
|
1802
|
+
var _extractNationalNumbe2 = extractNationalNumber(number, metadata),
|
|
1803
|
+
nationalNumber = _extractNationalNumbe2.nationalNumber; // If the number was not valid before but is valid now,
|
|
1804
|
+
// or if it was too long before, we consider the number
|
|
1805
|
+
// with the country calling code stripped to be a better result
|
|
1806
|
+
// and keep that instead.
|
|
1807
|
+
// For example, in Germany (+49), `49` is a valid area code,
|
|
1808
|
+
// so if a number starts with `49`, it could be both a valid
|
|
1809
|
+
// national German number or an international number without
|
|
1810
|
+
// a leading `+`.
|
|
1811
|
+
|
|
1812
|
+
|
|
1813
|
+
if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) && matchesEntirely(possibleShorterNationalNumber, metadata.nationalNumberPattern()) || checkNumberLength(nationalNumber, metadata) === 'TOO_LONG') {
|
|
1814
|
+
return {
|
|
1815
|
+
countryCallingCode: countryCallingCode,
|
|
1816
|
+
number: possibleShorterNumber
|
|
1817
|
+
};
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
return {
|
|
1822
|
+
number: number
|
|
1823
|
+
};
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
/**
|
|
1827
|
+
* Converts a phone number digits (possibly with a `+`)
|
|
1828
|
+
* into a calling code and the rest phone number digits.
|
|
1829
|
+
* The "rest phone number digits" could include
|
|
1830
|
+
* a national prefix, carrier code, and national
|
|
1831
|
+
* (significant) number.
|
|
1832
|
+
* @param {string} number — Phone number digits (possibly with a `+`).
|
|
1833
|
+
* @param {string} [country] — Default country.
|
|
1834
|
+
* @param {string} [callingCode] — Default calling code (some phone numbering plans are non-geographic).
|
|
1835
|
+
* @param {object} metadata
|
|
1836
|
+
* @return {object} `{ countryCallingCode: string?, number: string }`
|
|
1837
|
+
* @example
|
|
1838
|
+
* // Returns `{ countryCallingCode: "1", number: "2133734253" }`.
|
|
1839
|
+
* extractCountryCallingCode('2133734253', 'US', null, metadata)
|
|
1840
|
+
* extractCountryCallingCode('2133734253', null, '1', metadata)
|
|
1841
|
+
* extractCountryCallingCode('+12133734253', null, null, metadata)
|
|
1842
|
+
* extractCountryCallingCode('+12133734253', 'RU', null, metadata)
|
|
1843
|
+
*/
|
|
1844
|
+
|
|
1845
|
+
function extractCountryCallingCode(number, country, callingCode, metadata) {
|
|
1846
|
+
if (!number) {
|
|
1847
|
+
return {};
|
|
1848
|
+
} // If this is not an international phone number,
|
|
1849
|
+
// then either extract an "IDD" prefix, or extract a
|
|
1850
|
+
// country calling code from a number by autocorrecting it
|
|
1851
|
+
// by prepending a leading `+` in cases when it starts
|
|
1852
|
+
// with the country calling code.
|
|
1853
|
+
// https://wikitravel.org/en/International_dialling_prefix
|
|
1854
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/376
|
|
1855
|
+
|
|
1856
|
+
|
|
1857
|
+
if (number[0] !== '+') {
|
|
1858
|
+
// Convert an "out-of-country" dialing phone number
|
|
1859
|
+
// to a proper international phone number.
|
|
1860
|
+
var numberWithoutIDD = stripIddPrefix(number, country, callingCode, metadata); // If an IDD prefix was stripped then
|
|
1861
|
+
// convert the number to international one
|
|
1862
|
+
// for subsequent parsing.
|
|
1863
|
+
|
|
1864
|
+
if (numberWithoutIDD && numberWithoutIDD !== number) {
|
|
1865
|
+
number = '+' + numberWithoutIDD;
|
|
1866
|
+
} else {
|
|
1867
|
+
// Check to see if the number starts with the country calling code
|
|
1868
|
+
// for the default country. If so, we remove the country calling code,
|
|
1869
|
+
// and do some checks on the validity of the number before and after.
|
|
1870
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/376
|
|
1871
|
+
if (country || callingCode) {
|
|
1872
|
+
var _extractCountryCallin = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata),
|
|
1873
|
+
countryCallingCode = _extractCountryCallin.countryCallingCode,
|
|
1874
|
+
shorterNumber = _extractCountryCallin.number;
|
|
1875
|
+
|
|
1876
|
+
if (countryCallingCode) {
|
|
1877
|
+
return {
|
|
1878
|
+
countryCallingCode: countryCallingCode,
|
|
1879
|
+
number: shorterNumber
|
|
1880
|
+
};
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
return {
|
|
1885
|
+
number: number
|
|
1886
|
+
};
|
|
1887
|
+
}
|
|
1888
|
+
} // Fast abortion: country codes do not begin with a '0'
|
|
1889
|
+
|
|
1890
|
+
|
|
1891
|
+
if (number[1] === '0') {
|
|
1892
|
+
return {};
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
metadata = new Metadata(metadata); // The thing with country phone codes
|
|
1896
|
+
// is that they are orthogonal to each other
|
|
1897
|
+
// i.e. there's no such country phone code A
|
|
1898
|
+
// for which country phone code B exists
|
|
1899
|
+
// where B starts with A.
|
|
1900
|
+
// Therefore, while scanning digits,
|
|
1901
|
+
// if a valid country code is found,
|
|
1902
|
+
// that means that it is the country code.
|
|
1903
|
+
//
|
|
1904
|
+
|
|
1905
|
+
var i = 2;
|
|
1906
|
+
|
|
1907
|
+
while (i - 1 <= MAX_LENGTH_COUNTRY_CODE && i <= number.length) {
|
|
1908
|
+
var _countryCallingCode = number.slice(1, i);
|
|
1909
|
+
|
|
1910
|
+
if (metadata.hasCallingCode(_countryCallingCode)) {
|
|
1911
|
+
metadata.selectNumberingPlan(_countryCallingCode);
|
|
1912
|
+
return {
|
|
1913
|
+
countryCallingCode: _countryCallingCode,
|
|
1914
|
+
number: number.slice(i)
|
|
1915
|
+
};
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
i++;
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
return {};
|
|
1922
|
+
}
|
|
1923
|
+
|
|
1924
|
+
function getCountryByCallingCode(callingCode, nationalPhoneNumber, metadata) {
|
|
1925
|
+
|
|
1926
|
+
|
|
1927
|
+
var possibleCountries = metadata.getCountryCodesForCallingCode(callingCode);
|
|
1928
|
+
|
|
1929
|
+
if (!possibleCountries) {
|
|
1930
|
+
return;
|
|
1931
|
+
} // If there's just one country corresponding to the country code,
|
|
1932
|
+
// then just return it, without further phone number digits validation.
|
|
1933
|
+
|
|
1934
|
+
|
|
1935
|
+
if (possibleCountries.length === 1) {
|
|
1936
|
+
return possibleCountries[0];
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
return selectCountryFromList(possibleCountries, nationalPhoneNumber, metadata.metadata);
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
function selectCountryFromList(possibleCountries, nationalPhoneNumber, metadata) {
|
|
1943
|
+
// Re-create `metadata` because it will be selecting a `country`.
|
|
1944
|
+
metadata = new Metadata(metadata);
|
|
1945
|
+
|
|
1946
|
+
for (var _iterator = possibleCountries, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
|
1947
|
+
var _ref;
|
|
1948
|
+
|
|
1949
|
+
if (_isArray) {
|
|
1950
|
+
if (_i >= _iterator.length) break;
|
|
1951
|
+
_ref = _iterator[_i++];
|
|
1952
|
+
} else {
|
|
1953
|
+
_i = _iterator.next();
|
|
1954
|
+
if (_i.done) break;
|
|
1955
|
+
_ref = _i.value;
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
var country = _ref;
|
|
1959
|
+
metadata.country(country); // Leading digits check would be the simplest one
|
|
1960
|
+
|
|
1961
|
+
if (metadata.leadingDigits()) {
|
|
1962
|
+
if (nationalPhoneNumber && nationalPhoneNumber.search(metadata.leadingDigits()) === 0) {
|
|
1963
|
+
return country;
|
|
1964
|
+
}
|
|
1965
|
+
} // Else perform full validation with all of those
|
|
1966
|
+
// fixed-line/mobile/etc regular expressions.
|
|
1967
|
+
else if (getNumberType({
|
|
1968
|
+
phone: nationalPhoneNumber,
|
|
1969
|
+
country: country
|
|
1970
|
+
}, undefined, metadata.metadata)) {
|
|
1971
|
+
return country;
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1977
|
+
|
|
1978
|
+
function _defineProperties$2(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
1979
|
+
|
|
1980
|
+
function _createClass$2(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$2(Constructor.prototype, protoProps); if (staticProps) _defineProperties$2(Constructor, staticProps); return Constructor; }
|
|
1981
|
+
|
|
1982
|
+
function _defineProperty$2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1983
|
+
|
|
1984
|
+
var AsYouTypeState =
|
|
1985
|
+
/*#__PURE__*/
|
|
1986
|
+
function () {
|
|
1987
|
+
function AsYouTypeState(_ref) {
|
|
1988
|
+
var _this = this;
|
|
1989
|
+
|
|
1990
|
+
var onCountryChange = _ref.onCountryChange,
|
|
1991
|
+
onCallingCodeChange = _ref.onCallingCodeChange;
|
|
1992
|
+
|
|
1993
|
+
_classCallCheck$2(this, AsYouTypeState);
|
|
1994
|
+
|
|
1995
|
+
_defineProperty$2(this, "update", function (properties) {
|
|
1996
|
+
for (var _i = 0, _Object$keys = Object.keys(properties); _i < _Object$keys.length; _i++) {
|
|
1997
|
+
var key = _Object$keys[_i];
|
|
1998
|
+
_this[key] = properties[key];
|
|
1999
|
+
}
|
|
2000
|
+
});
|
|
2001
|
+
|
|
2002
|
+
this.onCountryChange = onCountryChange;
|
|
2003
|
+
this.onCallingCodeChange = onCallingCodeChange;
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
_createClass$2(AsYouTypeState, [{
|
|
2007
|
+
key: "reset",
|
|
2008
|
+
value: function reset(defaultCountry, defaultCallingCode) {
|
|
2009
|
+
this.international = false;
|
|
2010
|
+
this.IDDPrefix = undefined;
|
|
2011
|
+
this.missingPlus = undefined;
|
|
2012
|
+
this.callingCode = undefined;
|
|
2013
|
+
this.digits = '';
|
|
2014
|
+
this.resetNationalSignificantNumber();
|
|
2015
|
+
this.initCountryAndCallingCode(defaultCountry, defaultCallingCode);
|
|
2016
|
+
}
|
|
2017
|
+
}, {
|
|
2018
|
+
key: "resetNationalSignificantNumber",
|
|
2019
|
+
value: function resetNationalSignificantNumber() {
|
|
2020
|
+
this.nationalSignificantNumber = this.getNationalDigits();
|
|
2021
|
+
this.nationalSignificantNumberMatchesInput = true;
|
|
2022
|
+
this.nationalPrefix = undefined;
|
|
2023
|
+
this.carrierCode = undefined;
|
|
2024
|
+
this.complexPrefixBeforeNationalSignificantNumber = undefined;
|
|
2025
|
+
}
|
|
2026
|
+
}, {
|
|
2027
|
+
key: "initCountryAndCallingCode",
|
|
2028
|
+
value: function initCountryAndCallingCode(country, callingCode) {
|
|
2029
|
+
this.setCountry(country);
|
|
2030
|
+
this.setCallingCode(callingCode);
|
|
2031
|
+
}
|
|
2032
|
+
}, {
|
|
2033
|
+
key: "setCountry",
|
|
2034
|
+
value: function setCountry(country) {
|
|
2035
|
+
this.country = country;
|
|
2036
|
+
this.onCountryChange(country);
|
|
2037
|
+
}
|
|
2038
|
+
}, {
|
|
2039
|
+
key: "setCallingCode",
|
|
2040
|
+
value: function setCallingCode(callingCode) {
|
|
2041
|
+
this.callingCode = callingCode;
|
|
2042
|
+
return this.onCallingCodeChange(this.country, callingCode);
|
|
2043
|
+
}
|
|
2044
|
+
}, {
|
|
2045
|
+
key: "startInternationalNumber",
|
|
2046
|
+
value: function startInternationalNumber() {
|
|
2047
|
+
// Prepend the `+` to parsed input.
|
|
2048
|
+
this.international = true; // If a default country was set then reset it
|
|
2049
|
+
// because an explicitly international phone
|
|
2050
|
+
// number is being entered.
|
|
2051
|
+
|
|
2052
|
+
this.initCountryAndCallingCode();
|
|
2053
|
+
}
|
|
2054
|
+
}, {
|
|
2055
|
+
key: "appendDigits",
|
|
2056
|
+
value: function appendDigits(nextDigits) {
|
|
2057
|
+
this.digits += nextDigits;
|
|
2058
|
+
}
|
|
2059
|
+
}, {
|
|
2060
|
+
key: "appendNationalSignificantNumberDigits",
|
|
2061
|
+
value: function appendNationalSignificantNumberDigits(nextDigits) {
|
|
2062
|
+
this.nationalSignificantNumber += nextDigits;
|
|
2063
|
+
}
|
|
2064
|
+
/**
|
|
2065
|
+
* Returns the part of `this.digits` that corresponds to the national number.
|
|
2066
|
+
* Basically, all digits that have been input by the user, except for the
|
|
2067
|
+
* international prefix and the country calling code part
|
|
2068
|
+
* (if the number is an international one).
|
|
2069
|
+
* @return {string}
|
|
2070
|
+
*/
|
|
2071
|
+
|
|
2072
|
+
}, {
|
|
2073
|
+
key: "getNationalDigits",
|
|
2074
|
+
value: function getNationalDigits() {
|
|
2075
|
+
if (this.international) {
|
|
2076
|
+
return this.digits.slice((this.IDDPrefix ? this.IDDPrefix.length : 0) + (this.callingCode ? this.callingCode.length : 0));
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
return this.digits;
|
|
2080
|
+
}
|
|
2081
|
+
}, {
|
|
2082
|
+
key: "getDigitsWithoutInternationalPrefix",
|
|
2083
|
+
value: function getDigitsWithoutInternationalPrefix() {
|
|
2084
|
+
if (this.international) {
|
|
2085
|
+
if (this.IDDPrefix) {
|
|
2086
|
+
return this.digits.slice(this.IDDPrefix.length);
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
return this.digits;
|
|
2091
|
+
}
|
|
2092
|
+
}]);
|
|
2093
|
+
|
|
2094
|
+
return AsYouTypeState;
|
|
2095
|
+
}();
|
|
2096
|
+
|
|
2097
|
+
// Should be the same as `DIGIT_PLACEHOLDER` in `libphonenumber-metadata-generator`.
|
|
2098
|
+
var DIGIT_PLACEHOLDER = 'x'; // '\u2008' (punctuation space)
|
|
2099
|
+
|
|
2100
|
+
var DIGIT_PLACEHOLDER_MATCHER = new RegExp(DIGIT_PLACEHOLDER); // Counts all occurences of a symbol in a string.
|
|
2101
|
+
// http://stackoverflow.com/questions/202605/repeat-string-javascript
|
|
2102
|
+
|
|
2103
|
+
function repeat(string, times) {
|
|
2104
|
+
if (times < 1) {
|
|
2105
|
+
return '';
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
var result = '';
|
|
2109
|
+
|
|
2110
|
+
while (times > 1) {
|
|
2111
|
+
if (times & 1) {
|
|
2112
|
+
result += string;
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
times >>= 1;
|
|
2116
|
+
string += string;
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2119
|
+
return result + string;
|
|
2120
|
+
}
|
|
2121
|
+
function cutAndStripNonPairedParens(string, cutBeforeIndex) {
|
|
2122
|
+
if (string[cutBeforeIndex] === ')') {
|
|
2123
|
+
cutBeforeIndex++;
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
return stripNonPairedParens(string.slice(0, cutBeforeIndex));
|
|
2127
|
+
}
|
|
2128
|
+
function stripNonPairedParens(string) {
|
|
2129
|
+
var dangling_braces = [];
|
|
2130
|
+
var i = 0;
|
|
2131
|
+
|
|
2132
|
+
while (i < string.length) {
|
|
2133
|
+
if (string[i] === '(') {
|
|
2134
|
+
dangling_braces.push(i);
|
|
2135
|
+
} else if (string[i] === ')') {
|
|
2136
|
+
dangling_braces.pop();
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
i++;
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
var start = 0;
|
|
2143
|
+
var cleared_string = '';
|
|
2144
|
+
dangling_braces.push(string.length);
|
|
2145
|
+
|
|
2146
|
+
for (var _i2 = 0, _dangling_braces = dangling_braces; _i2 < _dangling_braces.length; _i2++) {
|
|
2147
|
+
var index = _dangling_braces[_i2];
|
|
2148
|
+
cleared_string += string.slice(start, index);
|
|
2149
|
+
start = index + 1;
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
return cleared_string;
|
|
2153
|
+
}
|
|
2154
|
+
function populateTemplateWithDigits(template, position, digits) {
|
|
2155
|
+
// Using `.split('')` to iterate through a string here
|
|
2156
|
+
// to avoid requiring `Symbol.iterator` polyfill.
|
|
2157
|
+
// `.split('')` is generally not safe for Unicode,
|
|
2158
|
+
// but in this particular case for `digits` it is safe.
|
|
2159
|
+
// for (const digit of digits)
|
|
2160
|
+
for (var _iterator2 = digits.split(''), _isArray2 = Array.isArray(_iterator2), _i3 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
|
2161
|
+
var _ref2;
|
|
2162
|
+
|
|
2163
|
+
if (_isArray2) {
|
|
2164
|
+
if (_i3 >= _iterator2.length) break;
|
|
2165
|
+
_ref2 = _iterator2[_i3++];
|
|
2166
|
+
} else {
|
|
2167
|
+
_i3 = _iterator2.next();
|
|
2168
|
+
if (_i3.done) break;
|
|
2169
|
+
_ref2 = _i3.value;
|
|
2170
|
+
}
|
|
2171
|
+
|
|
2172
|
+
var digit = _ref2;
|
|
2173
|
+
|
|
2174
|
+
// If there is room for more digits in current `template`,
|
|
2175
|
+
// then set the next digit in the `template`,
|
|
2176
|
+
// and return the formatted digits so far.
|
|
2177
|
+
// If more digits are entered than the current format could handle.
|
|
2178
|
+
if (template.slice(position + 1).search(DIGIT_PLACEHOLDER_MATCHER) < 0) {
|
|
2179
|
+
return;
|
|
2180
|
+
}
|
|
2181
|
+
|
|
2182
|
+
position = template.search(DIGIT_PLACEHOLDER_MATCHER);
|
|
2183
|
+
template = template.replace(DIGIT_PLACEHOLDER_MATCHER, digit);
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
return [template, position];
|
|
2187
|
+
}
|
|
2188
|
+
|
|
2189
|
+
function formatCompleteNumber(state, format, _ref) {
|
|
2190
|
+
var metadata = _ref.metadata,
|
|
2191
|
+
shouldTryNationalPrefixFormattingRule = _ref.shouldTryNationalPrefixFormattingRule,
|
|
2192
|
+
getSeparatorAfterNationalPrefix = _ref.getSeparatorAfterNationalPrefix;
|
|
2193
|
+
var matcher = new RegExp("^(?:".concat(format.pattern(), ")$"));
|
|
2194
|
+
|
|
2195
|
+
if (matcher.test(state.nationalSignificantNumber)) {
|
|
2196
|
+
return formatNationalNumberWithAndWithoutNationalPrefixFormattingRule(state, format, {
|
|
2197
|
+
metadata: metadata,
|
|
2198
|
+
shouldTryNationalPrefixFormattingRule: shouldTryNationalPrefixFormattingRule,
|
|
2199
|
+
getSeparatorAfterNationalPrefix: getSeparatorAfterNationalPrefix
|
|
2200
|
+
});
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
function canFormatCompleteNumber(nationalSignificantNumber, metadata) {
|
|
2204
|
+
return checkNumberLength(nationalSignificantNumber, metadata) === 'IS_POSSIBLE';
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2207
|
+
function formatNationalNumberWithAndWithoutNationalPrefixFormattingRule(state, format, _ref2) {
|
|
2208
|
+
var metadata = _ref2.metadata,
|
|
2209
|
+
shouldTryNationalPrefixFormattingRule = _ref2.shouldTryNationalPrefixFormattingRule,
|
|
2210
|
+
getSeparatorAfterNationalPrefix = _ref2.getSeparatorAfterNationalPrefix;
|
|
2211
|
+
// If the resulting formatted number is a valid formatted number, then return it.
|
|
2212
|
+
//
|
|
2213
|
+
// Google's AsYouType formatter is different in a way that it doesn't try
|
|
2214
|
+
// to format using the "national prefix formatting rule", and instead it
|
|
2215
|
+
// simply prepends a national prefix followed by a " " character.
|
|
2216
|
+
// This code does that too, but as a fallback.
|
|
2217
|
+
// The reason is that "national prefix formatting rule" may use parentheses,
|
|
2218
|
+
// which wouldn't be included has it used the simpler Google's way.
|
|
2219
|
+
//
|
|
2220
|
+
|
|
2221
|
+
if (shouldTryNationalPrefixFormattingRule(format)) {
|
|
2222
|
+
var formattedNumber = formatNationalNumber$1(state, format, {
|
|
2223
|
+
useNationalPrefixFormattingRule: true,
|
|
2224
|
+
getSeparatorAfterNationalPrefix: getSeparatorAfterNationalPrefix,
|
|
2225
|
+
metadata: metadata
|
|
2226
|
+
});
|
|
2227
|
+
|
|
2228
|
+
if (formattedNumber) {
|
|
2229
|
+
return formattedNumber;
|
|
2230
|
+
}
|
|
2231
|
+
} // Format the number without using `national_prefix_formatting_rule`.
|
|
2232
|
+
|
|
2233
|
+
|
|
2234
|
+
return formatNationalNumber$1(state, format, {
|
|
2235
|
+
useNationalPrefixFormattingRule: false,
|
|
2236
|
+
getSeparatorAfterNationalPrefix: getSeparatorAfterNationalPrefix,
|
|
2237
|
+
metadata: metadata
|
|
2238
|
+
});
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2241
|
+
function formatNationalNumber$1(state, format, _ref3) {
|
|
2242
|
+
var metadata = _ref3.metadata,
|
|
2243
|
+
useNationalPrefixFormattingRule = _ref3.useNationalPrefixFormattingRule,
|
|
2244
|
+
getSeparatorAfterNationalPrefix = _ref3.getSeparatorAfterNationalPrefix;
|
|
2245
|
+
var formattedNationalNumber = formatNationalNumberUsingFormat(state.nationalSignificantNumber, format, {
|
|
2246
|
+
carrierCode: state.carrierCode,
|
|
2247
|
+
useInternationalFormat: state.international,
|
|
2248
|
+
withNationalPrefix: useNationalPrefixFormattingRule,
|
|
2249
|
+
metadata: metadata
|
|
2250
|
+
});
|
|
2251
|
+
|
|
2252
|
+
if (!useNationalPrefixFormattingRule) {
|
|
2253
|
+
if (state.nationalPrefix) {
|
|
2254
|
+
// If a national prefix was extracted, then just prepend it,
|
|
2255
|
+
// followed by a " " character.
|
|
2256
|
+
formattedNationalNumber = state.nationalPrefix + getSeparatorAfterNationalPrefix(format) + formattedNationalNumber;
|
|
2257
|
+
} else if (state.complexPrefixBeforeNationalSignificantNumber) {
|
|
2258
|
+
formattedNationalNumber = state.complexPrefixBeforeNationalSignificantNumber + ' ' + formattedNationalNumber;
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2261
|
+
|
|
2262
|
+
if (isValidFormattedNationalNumber(formattedNationalNumber, state)) {
|
|
2263
|
+
return formattedNationalNumber;
|
|
2264
|
+
}
|
|
2265
|
+
} // Check that the formatted phone number contains exactly
|
|
2266
|
+
// the same digits that have been input by the user.
|
|
2267
|
+
// For example, when "0111523456789" is input for `AR` country,
|
|
2268
|
+
// the extracted `this.nationalSignificantNumber` is "91123456789",
|
|
2269
|
+
// which means that the national part of `this.digits` isn't simply equal to
|
|
2270
|
+
// `this.nationalPrefix` + `this.nationalSignificantNumber`.
|
|
2271
|
+
//
|
|
2272
|
+
// Also, a `format` can add extra digits to the `this.nationalSignificantNumber`
|
|
2273
|
+
// being formatted via `metadata[country].national_prefix_transform_rule`.
|
|
2274
|
+
// For example, for `VI` country, it prepends `340` to the national number,
|
|
2275
|
+
// and if this check hasn't been implemented, then there would be a bug
|
|
2276
|
+
// when `340` "area coude" is "duplicated" during input for `VI` country:
|
|
2277
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/318
|
|
2278
|
+
//
|
|
2279
|
+
// So, all these "gotchas" are filtered out.
|
|
2280
|
+
//
|
|
2281
|
+
// In the original Google's code, the comments say:
|
|
2282
|
+
// "Check that we didn't remove nor add any extra digits when we matched
|
|
2283
|
+
// this formatting pattern. This usually happens after we entered the last
|
|
2284
|
+
// digit during AYTF. Eg: In case of MX, we swallow mobile token (1) when
|
|
2285
|
+
// formatted but AYTF should retain all the number entered and not change
|
|
2286
|
+
// in order to match a format (of same leading digits and length) display
|
|
2287
|
+
// in that way."
|
|
2288
|
+
// "If it's the same (i.e entered number and format is same), then it's
|
|
2289
|
+
// safe to return this in formatted number as nothing is lost / added."
|
|
2290
|
+
// Otherwise, don't use this format.
|
|
2291
|
+
// https://github.com/google/libphonenumber/commit/3e7c1f04f5e7200f87fb131e6f85c6e99d60f510#diff-9149457fa9f5d608a11bb975c6ef4bc5
|
|
2292
|
+
// https://github.com/google/libphonenumber/commit/3ac88c7106e7dcb553bcc794b15f19185928a1c6#diff-2dcb77e833422ee304da348b905cde0b
|
|
2293
|
+
//
|
|
2294
|
+
|
|
2295
|
+
|
|
2296
|
+
function isValidFormattedNationalNumber(formattedNationalNumber, state) {
|
|
2297
|
+
return parseDigits(formattedNationalNumber) === state.getNationalDigits();
|
|
2298
|
+
}
|
|
2299
|
+
|
|
2300
|
+
function _classCallCheck$3(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2301
|
+
|
|
2302
|
+
function _defineProperties$3(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
2303
|
+
|
|
2304
|
+
function _createClass$3(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$3(Constructor.prototype, protoProps); if (staticProps) _defineProperties$3(Constructor, staticProps); return Constructor; }
|
|
2305
|
+
|
|
2306
|
+
function _defineProperty$3(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2307
|
+
// Could be any digit, I guess.
|
|
2308
|
+
|
|
2309
|
+
var DUMMY_DIGIT = '9'; // I don't know why is it exactly `15`
|
|
2310
|
+
|
|
2311
|
+
var LONGEST_NATIONAL_PHONE_NUMBER_LENGTH = 15; // Create a phone number consisting only of the digit 9 that matches the
|
|
2312
|
+
// `number_pattern` by applying the pattern to the "longest phone number" string.
|
|
2313
|
+
|
|
2314
|
+
var LONGEST_DUMMY_PHONE_NUMBER = repeat(DUMMY_DIGIT, LONGEST_NATIONAL_PHONE_NUMBER_LENGTH); // A set of characters that, if found in a national prefix formatting rules, are an indicator to
|
|
2315
|
+
// us that we should separate the national prefix from the number when formatting.
|
|
2316
|
+
|
|
2317
|
+
var NATIONAL_PREFIX_SEPARATORS_PATTERN = /[- ]/; // Deprecated: Google has removed some formatting pattern related code from their repo.
|
|
2318
|
+
// An example of a character class is "[1-4]".
|
|
2319
|
+
|
|
2320
|
+
var CREATE_CHARACTER_CLASS_PATTERN = function () {
|
|
2321
|
+
return /\[([^\[\]])*\]/g;
|
|
2322
|
+
}; // Any digit in a regular expression that actually denotes a digit. For
|
|
2323
|
+
// example, in the regular expression "80[0-2]\d{6,10}", the first 2 digits
|
|
2324
|
+
// (8 and 0) are standalone digits, but the rest are not.
|
|
2325
|
+
// Two look-aheads are needed because the number following \\d could be a
|
|
2326
|
+
// two-digit number, since the phone number can be as long as 15 digits.
|
|
2327
|
+
|
|
2328
|
+
|
|
2329
|
+
var CREATE_STANDALONE_DIGIT_PATTERN = function () {
|
|
2330
|
+
return /\d(?=[^,}][^,}])/g;
|
|
2331
|
+
}; // A regular expression that is used to determine if a `format` is
|
|
2332
|
+
// suitable to be used in the "as you type formatter".
|
|
2333
|
+
// A `format` is suitable when the resulting formatted number has
|
|
2334
|
+
// the same digits as the user has entered.
|
|
2335
|
+
//
|
|
2336
|
+
// In the simplest case, that would mean that the format
|
|
2337
|
+
// doesn't add any additional digits when formatting a number.
|
|
2338
|
+
// Google says that it also shouldn't add "star" (`*`) characters,
|
|
2339
|
+
// like it does in some Israeli formats.
|
|
2340
|
+
// Such basic format would only contain "valid punctuation"
|
|
2341
|
+
// and "captured group" identifiers ($1, $2, etc).
|
|
2342
|
+
//
|
|
2343
|
+
// An example of a format that adds additional digits:
|
|
2344
|
+
//
|
|
2345
|
+
// Country: `AR` (Argentina).
|
|
2346
|
+
// Format:
|
|
2347
|
+
// {
|
|
2348
|
+
// "pattern": "(\\d)(\\d{2})(\\d{4})(\\d{4})",
|
|
2349
|
+
// "leading_digits_patterns": ["91"],
|
|
2350
|
+
// "national_prefix_formatting_rule": "0$1",
|
|
2351
|
+
// "format": "$2 15-$3-$4",
|
|
2352
|
+
// "international_format": "$1 $2 $3-$4"
|
|
2353
|
+
// }
|
|
2354
|
+
//
|
|
2355
|
+
// In the format above, the `format` adds `15` to the digits when formatting a number.
|
|
2356
|
+
// A sidenote: this format actually is suitable because `national_prefix_for_parsing`
|
|
2357
|
+
// has previously removed `15` from a national number, so re-adding `15` in `format`
|
|
2358
|
+
// doesn't actually result in any extra digits added to user's input.
|
|
2359
|
+
// But verifying that would be a complex procedure, so the code chooses a simpler path:
|
|
2360
|
+
// it simply filters out all `format`s that contain anything but "captured group" ids.
|
|
2361
|
+
//
|
|
2362
|
+
// This regular expression is called `ELIGIBLE_FORMAT_PATTERN` in Google's
|
|
2363
|
+
// `libphonenumber` code.
|
|
2364
|
+
//
|
|
2365
|
+
|
|
2366
|
+
|
|
2367
|
+
var NON_ALTERING_FORMAT_REG_EXP = new RegExp('^' + '[' + VALID_PUNCTUATION + ']*' + '(\\$\\d[' + VALID_PUNCTUATION + ']*)+' + '$'); // This is the minimum length of the leading digits of a phone number
|
|
2368
|
+
// to guarantee the first "leading digits pattern" for a phone number format
|
|
2369
|
+
// to be preemptive.
|
|
2370
|
+
|
|
2371
|
+
var MIN_LEADING_DIGITS_LENGTH = 3;
|
|
2372
|
+
|
|
2373
|
+
var AsYouTypeFormatter =
|
|
2374
|
+
/*#__PURE__*/
|
|
2375
|
+
function () {
|
|
2376
|
+
function AsYouTypeFormatter(_ref) {
|
|
2377
|
+
var _this = this;
|
|
2378
|
+
|
|
2379
|
+
var metadata = _ref.metadata;
|
|
2380
|
+
|
|
2381
|
+
_classCallCheck$3(this, AsYouTypeFormatter);
|
|
2382
|
+
|
|
2383
|
+
_defineProperty$3(this, "getSeparatorAfterNationalPrefix", function (format) {
|
|
2384
|
+
// `US` metadata doesn't have a `national_prefix_formatting_rule`,
|
|
2385
|
+
// so the `if` condition below doesn't apply to `US`,
|
|
2386
|
+
// but in reality there shoudl be a separator
|
|
2387
|
+
// between a national prefix and a national (significant) number.
|
|
2388
|
+
// So `US` national prefix separator is a "special" "hardcoded" case.
|
|
2389
|
+
if (_this.isNANP) {
|
|
2390
|
+
return ' ';
|
|
2391
|
+
} // If a `format` has a `national_prefix_formatting_rule`
|
|
2392
|
+
// and that rule has a separator after a national prefix,
|
|
2393
|
+
// then it means that there should be a separator
|
|
2394
|
+
// between a national prefix and a national (significant) number.
|
|
2395
|
+
|
|
2396
|
+
|
|
2397
|
+
if (format && format.nationalPrefixFormattingRule() && NATIONAL_PREFIX_SEPARATORS_PATTERN.test(format.nationalPrefixFormattingRule())) {
|
|
2398
|
+
return ' ';
|
|
2399
|
+
} // At this point, there seems to be no clear evidence that
|
|
2400
|
+
// there should be a separator between a national prefix
|
|
2401
|
+
// and a national (significant) number. So don't insert one.
|
|
2402
|
+
|
|
2403
|
+
|
|
2404
|
+
return '';
|
|
2405
|
+
});
|
|
2406
|
+
|
|
2407
|
+
_defineProperty$3(this, "shouldTryNationalPrefixFormattingRule", function (format, _ref2) {
|
|
2408
|
+
var international = _ref2.international,
|
|
2409
|
+
nationalPrefix = _ref2.nationalPrefix;
|
|
2410
|
+
|
|
2411
|
+
if (format.nationalPrefixFormattingRule()) {
|
|
2412
|
+
// In some countries, `national_prefix_formatting_rule` is `($1)`,
|
|
2413
|
+
// so it applies even if the user hasn't input a national prefix.
|
|
2414
|
+
// `format.usesNationalPrefix()` detects such cases.
|
|
2415
|
+
var usesNationalPrefix = format.usesNationalPrefix();
|
|
2416
|
+
|
|
2417
|
+
if (usesNationalPrefix && nationalPrefix || !usesNationalPrefix && !international) {
|
|
2418
|
+
return true;
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
});
|
|
2422
|
+
|
|
2423
|
+
this.metadata = metadata;
|
|
2424
|
+
this.resetFormat();
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2427
|
+
_createClass$3(AsYouTypeFormatter, [{
|
|
2428
|
+
key: "resetFormat",
|
|
2429
|
+
value: function resetFormat() {
|
|
2430
|
+
this.chosenFormat = undefined;
|
|
2431
|
+
this.template = undefined;
|
|
2432
|
+
this.nationalNumberTemplate = undefined;
|
|
2433
|
+
this.populatedNationalNumberTemplate = undefined;
|
|
2434
|
+
this.populatedNationalNumberTemplatePosition = -1;
|
|
2435
|
+
}
|
|
2436
|
+
}, {
|
|
2437
|
+
key: "reset",
|
|
2438
|
+
value: function reset(numberingPlan, state) {
|
|
2439
|
+
this.resetFormat();
|
|
2440
|
+
|
|
2441
|
+
if (numberingPlan) {
|
|
2442
|
+
this.isNANP = numberingPlan.callingCode() === '1';
|
|
2443
|
+
this.matchingFormats = numberingPlan.formats();
|
|
2444
|
+
|
|
2445
|
+
if (state.nationalSignificantNumber) {
|
|
2446
|
+
this.narrowDownMatchingFormats(state);
|
|
2447
|
+
}
|
|
2448
|
+
} else {
|
|
2449
|
+
this.isNANP = undefined;
|
|
2450
|
+
this.matchingFormats = [];
|
|
2451
|
+
}
|
|
2452
|
+
}
|
|
2453
|
+
}, {
|
|
2454
|
+
key: "format",
|
|
2455
|
+
value: function format(nextDigits, state) {
|
|
2456
|
+
var _this2 = this;
|
|
2457
|
+
|
|
2458
|
+
// See if the phone number digits can be formatted as a complete phone number.
|
|
2459
|
+
// If not, use the results from `formatNationalNumberWithNextDigits()`,
|
|
2460
|
+
// which formats based on the chosen formatting pattern.
|
|
2461
|
+
//
|
|
2462
|
+
// Attempting to format complete phone number first is how it's done
|
|
2463
|
+
// in Google's `libphonenumber`, so this library just follows it.
|
|
2464
|
+
// Google's `libphonenumber` code doesn't explain in detail why does it
|
|
2465
|
+
// attempt to format digits as a complete phone number
|
|
2466
|
+
// instead of just going with a previoulsy (or newly) chosen `format`:
|
|
2467
|
+
//
|
|
2468
|
+
// "Checks to see if there is an exact pattern match for these digits.
|
|
2469
|
+
// If so, we should use this instead of any other formatting template
|
|
2470
|
+
// whose leadingDigitsPattern also matches the input."
|
|
2471
|
+
//
|
|
2472
|
+
if (canFormatCompleteNumber(state.nationalSignificantNumber, this.metadata)) {
|
|
2473
|
+
for (var _iterator = this.matchingFormats, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
|
2474
|
+
var _ref3;
|
|
2475
|
+
|
|
2476
|
+
if (_isArray) {
|
|
2477
|
+
if (_i >= _iterator.length) break;
|
|
2478
|
+
_ref3 = _iterator[_i++];
|
|
2479
|
+
} else {
|
|
2480
|
+
_i = _iterator.next();
|
|
2481
|
+
if (_i.done) break;
|
|
2482
|
+
_ref3 = _i.value;
|
|
2483
|
+
}
|
|
2484
|
+
|
|
2485
|
+
var format = _ref3;
|
|
2486
|
+
var formattedCompleteNumber = formatCompleteNumber(state, format, {
|
|
2487
|
+
metadata: this.metadata,
|
|
2488
|
+
shouldTryNationalPrefixFormattingRule: function shouldTryNationalPrefixFormattingRule(format) {
|
|
2489
|
+
return _this2.shouldTryNationalPrefixFormattingRule(format, {
|
|
2490
|
+
international: state.international,
|
|
2491
|
+
nationalPrefix: state.nationalPrefix
|
|
2492
|
+
});
|
|
2493
|
+
},
|
|
2494
|
+
getSeparatorAfterNationalPrefix: this.getSeparatorAfterNationalPrefix
|
|
2495
|
+
});
|
|
2496
|
+
|
|
2497
|
+
if (formattedCompleteNumber) {
|
|
2498
|
+
this.resetFormat();
|
|
2499
|
+
this.chosenFormat = format;
|
|
2500
|
+
this.setNationalNumberTemplate(formattedCompleteNumber.replace(/\d/g, DIGIT_PLACEHOLDER), state);
|
|
2501
|
+
this.populatedNationalNumberTemplate = formattedCompleteNumber; // With a new formatting template, the matched position
|
|
2502
|
+
// using the old template needs to be reset.
|
|
2503
|
+
|
|
2504
|
+
this.populatedNationalNumberTemplatePosition = this.template.lastIndexOf(DIGIT_PLACEHOLDER);
|
|
2505
|
+
return formattedCompleteNumber;
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
} // Format the digits as a partial (incomplete) phone number
|
|
2509
|
+
// using the previously chosen formatting pattern (or a newly chosen one).
|
|
2510
|
+
|
|
2511
|
+
|
|
2512
|
+
return this.formatNationalNumberWithNextDigits(nextDigits, state);
|
|
2513
|
+
} // Formats the next phone number digits.
|
|
2514
|
+
|
|
2515
|
+
}, {
|
|
2516
|
+
key: "formatNationalNumberWithNextDigits",
|
|
2517
|
+
value: function formatNationalNumberWithNextDigits(nextDigits, state) {
|
|
2518
|
+
var previouslyChosenFormat = this.chosenFormat; // Choose a format from the list of matching ones.
|
|
2519
|
+
|
|
2520
|
+
var newlyChosenFormat = this.chooseFormat(state);
|
|
2521
|
+
|
|
2522
|
+
if (newlyChosenFormat) {
|
|
2523
|
+
if (newlyChosenFormat === previouslyChosenFormat) {
|
|
2524
|
+
// If it can format the next (current) digits
|
|
2525
|
+
// using the previously chosen phone number format
|
|
2526
|
+
// then return the updated formatted number.
|
|
2527
|
+
return this.formatNextNationalNumberDigits(nextDigits);
|
|
2528
|
+
} else {
|
|
2529
|
+
// If a more appropriate phone number format
|
|
2530
|
+
// has been chosen for these "leading digits",
|
|
2531
|
+
// then re-format the national phone number part
|
|
2532
|
+
// using the newly selected format.
|
|
2533
|
+
return this.formatNextNationalNumberDigits(state.getNationalDigits());
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
}
|
|
2537
|
+
}, {
|
|
2538
|
+
key: "narrowDownMatchingFormats",
|
|
2539
|
+
value: function narrowDownMatchingFormats(_ref4) {
|
|
2540
|
+
var _this3 = this;
|
|
2541
|
+
|
|
2542
|
+
var nationalSignificantNumber = _ref4.nationalSignificantNumber,
|
|
2543
|
+
nationalPrefix = _ref4.nationalPrefix,
|
|
2544
|
+
international = _ref4.international;
|
|
2545
|
+
var leadingDigits = nationalSignificantNumber; // "leading digits" pattern list starts with a
|
|
2546
|
+
// "leading digits" pattern fitting a maximum of 3 leading digits.
|
|
2547
|
+
// So, after a user inputs 3 digits of a national (significant) phone number
|
|
2548
|
+
// this national (significant) number can already be formatted.
|
|
2549
|
+
// The next "leading digits" pattern is for 4 leading digits max,
|
|
2550
|
+
// and the "leading digits" pattern after it is for 5 leading digits max, etc.
|
|
2551
|
+
// This implementation is different from Google's
|
|
2552
|
+
// in that it searches for a fitting format
|
|
2553
|
+
// even if the user has entered less than
|
|
2554
|
+
// `MIN_LEADING_DIGITS_LENGTH` digits of a national number.
|
|
2555
|
+
// Because some leading digit patterns already match for a single first digit.
|
|
2556
|
+
|
|
2557
|
+
var leadingDigitsPatternIndex = leadingDigits.length - MIN_LEADING_DIGITS_LENGTH;
|
|
2558
|
+
|
|
2559
|
+
if (leadingDigitsPatternIndex < 0) {
|
|
2560
|
+
leadingDigitsPatternIndex = 0;
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
this.matchingFormats = this.matchingFormats.filter(function (format) {
|
|
2564
|
+
return _this3.formatSuits(format, international, nationalPrefix) && _this3.formatMatches(format, leadingDigits, leadingDigitsPatternIndex);
|
|
2565
|
+
}); // If there was a phone number format chosen
|
|
2566
|
+
// and it no longer holds given the new leading digits then reset it.
|
|
2567
|
+
// The test for this `if` condition is marked as:
|
|
2568
|
+
// "Reset a chosen format when it no longer holds given the new leading digits".
|
|
2569
|
+
// To construct a valid test case for this one can find a country
|
|
2570
|
+
// in `PhoneNumberMetadata.xml` yielding one format for 3 `<leadingDigits>`
|
|
2571
|
+
// and yielding another format for 4 `<leadingDigits>` (Australia in this case).
|
|
2572
|
+
|
|
2573
|
+
if (this.chosenFormat && this.matchingFormats.indexOf(this.chosenFormat) === -1) {
|
|
2574
|
+
this.resetFormat();
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
}, {
|
|
2578
|
+
key: "formatSuits",
|
|
2579
|
+
value: function formatSuits(format, international, nationalPrefix) {
|
|
2580
|
+
// When a prefix before a national (significant) number is
|
|
2581
|
+
// simply a national prefix, then it's parsed as `this.nationalPrefix`.
|
|
2582
|
+
// In more complex cases, a prefix before national (significant) number
|
|
2583
|
+
// could include a national prefix as well as some "capturing groups",
|
|
2584
|
+
// and in that case there's no info whether a national prefix has been parsed.
|
|
2585
|
+
// If national prefix is not used when formatting a phone number
|
|
2586
|
+
// using this format, but a national prefix has been entered by the user,
|
|
2587
|
+
// and was extracted, then discard such phone number format.
|
|
2588
|
+
// In Google's "AsYouType" formatter code, the equivalent would be this part:
|
|
2589
|
+
// https://github.com/google/libphonenumber/blob/0a45cfd96e71cad8edb0e162a70fcc8bd9728933/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java#L175-L184
|
|
2590
|
+
if (nationalPrefix && !format.usesNationalPrefix() && // !format.domesticCarrierCodeFormattingRule() &&
|
|
2591
|
+
!format.nationalPrefixIsOptionalWhenFormattingInNationalFormat()) {
|
|
2592
|
+
return false;
|
|
2593
|
+
} // If national prefix is mandatory for this phone number format
|
|
2594
|
+
// and there're no guarantees that a national prefix is present in user input
|
|
2595
|
+
// then discard this phone number format as not suitable.
|
|
2596
|
+
// In Google's "AsYouType" formatter code, the equivalent would be this part:
|
|
2597
|
+
// https://github.com/google/libphonenumber/blob/0a45cfd96e71cad8edb0e162a70fcc8bd9728933/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java#L185-L193
|
|
2598
|
+
|
|
2599
|
+
|
|
2600
|
+
if (!international && !nationalPrefix && format.nationalPrefixIsMandatoryWhenFormattingInNationalFormat()) {
|
|
2601
|
+
return false;
|
|
2602
|
+
}
|
|
2603
|
+
|
|
2604
|
+
return true;
|
|
2605
|
+
}
|
|
2606
|
+
}, {
|
|
2607
|
+
key: "formatMatches",
|
|
2608
|
+
value: function formatMatches(format, leadingDigits, leadingDigitsPatternIndex) {
|
|
2609
|
+
var leadingDigitsPatternsCount = format.leadingDigitsPatterns().length; // If this format is not restricted to a certain
|
|
2610
|
+
// leading digits pattern then it fits.
|
|
2611
|
+
|
|
2612
|
+
if (leadingDigitsPatternsCount === 0) {
|
|
2613
|
+
return true;
|
|
2614
|
+
} // Start excluding any non-matching formats only when the
|
|
2615
|
+
// national number entered so far is at least 3 digits long,
|
|
2616
|
+
// otherwise format matching would give false negatives.
|
|
2617
|
+
// For example, when the digits entered so far are `2`
|
|
2618
|
+
// and the leading digits pattern is `21` –
|
|
2619
|
+
// it's quite obvious in this case that the format could be the one
|
|
2620
|
+
// but due to the absence of further digits it would give false negative.
|
|
2621
|
+
|
|
2622
|
+
|
|
2623
|
+
if (leadingDigits.length < MIN_LEADING_DIGITS_LENGTH) {
|
|
2624
|
+
return true;
|
|
2625
|
+
} // If at least `MIN_LEADING_DIGITS_LENGTH` digits of a national number are available
|
|
2626
|
+
// then format matching starts narrowing down the list of possible formats
|
|
2627
|
+
// (only previously matched formats are considered for next digits).
|
|
2628
|
+
|
|
2629
|
+
|
|
2630
|
+
leadingDigitsPatternIndex = Math.min(leadingDigitsPatternIndex, leadingDigitsPatternsCount - 1);
|
|
2631
|
+
var leadingDigitsPattern = format.leadingDigitsPatterns()[leadingDigitsPatternIndex]; // Brackets are required for `^` to be applied to
|
|
2632
|
+
// all or-ed (`|`) parts, not just the first one.
|
|
2633
|
+
|
|
2634
|
+
return new RegExp("^(".concat(leadingDigitsPattern, ")")).test(leadingDigits);
|
|
2635
|
+
}
|
|
2636
|
+
}, {
|
|
2637
|
+
key: "getFormatFormat",
|
|
2638
|
+
value: function getFormatFormat(format, international) {
|
|
2639
|
+
return international ? format.internationalFormat() : format.format();
|
|
2640
|
+
}
|
|
2641
|
+
}, {
|
|
2642
|
+
key: "chooseFormat",
|
|
2643
|
+
value: function chooseFormat(state) {
|
|
2644
|
+
var _this4 = this;
|
|
2645
|
+
|
|
2646
|
+
var _loop2 = function _loop2() {
|
|
2647
|
+
if (_isArray2) {
|
|
2648
|
+
if (_i2 >= _iterator2.length) return "break";
|
|
2649
|
+
_ref5 = _iterator2[_i2++];
|
|
2650
|
+
} else {
|
|
2651
|
+
_i2 = _iterator2.next();
|
|
2652
|
+
if (_i2.done) return "break";
|
|
2653
|
+
_ref5 = _i2.value;
|
|
2654
|
+
}
|
|
2655
|
+
|
|
2656
|
+
var format = _ref5;
|
|
2657
|
+
|
|
2658
|
+
// If this format is currently being used
|
|
2659
|
+
// and is still suitable, then stick to it.
|
|
2660
|
+
if (_this4.chosenFormat === format) {
|
|
2661
|
+
return "break";
|
|
2662
|
+
} // Sometimes, a formatting rule inserts additional digits in a phone number,
|
|
2663
|
+
// and "as you type" formatter can't do that: it should only use the digits
|
|
2664
|
+
// that the user has input.
|
|
2665
|
+
//
|
|
2666
|
+
// For example, in Argentina, there's a format for mobile phone numbers:
|
|
2667
|
+
//
|
|
2668
|
+
// {
|
|
2669
|
+
// "pattern": "(\\d)(\\d{2})(\\d{4})(\\d{4})",
|
|
2670
|
+
// "leading_digits_patterns": ["91"],
|
|
2671
|
+
// "national_prefix_formatting_rule": "0$1",
|
|
2672
|
+
// "format": "$2 15-$3-$4",
|
|
2673
|
+
// "international_format": "$1 $2 $3-$4"
|
|
2674
|
+
// }
|
|
2675
|
+
//
|
|
2676
|
+
// In that format, `international_format` is used instead of `format`
|
|
2677
|
+
// because `format` inserts `15` in the formatted number,
|
|
2678
|
+
// and `AsYouType` formatter should only use the digits
|
|
2679
|
+
// the user has actually input, without adding any extra digits.
|
|
2680
|
+
// In this case, it wouldn't make a difference, because the `15`
|
|
2681
|
+
// is first stripped when applying `national_prefix_for_parsing`
|
|
2682
|
+
// and then re-added when using `format`, so in reality it doesn't
|
|
2683
|
+
// add any new digits to the number, but to detect that, the code
|
|
2684
|
+
// would have to be more complex: it would have to try formatting
|
|
2685
|
+
// the digits using the format and then see if any digits have
|
|
2686
|
+
// actually been added or removed, and then, every time a new digit
|
|
2687
|
+
// is input, it should re-check whether the chosen format doesn't
|
|
2688
|
+
// alter the digits.
|
|
2689
|
+
//
|
|
2690
|
+
// Google's code doesn't go that far, and so does this library:
|
|
2691
|
+
// it simply requires that a `format` doesn't add any additonal
|
|
2692
|
+
// digits to user's input.
|
|
2693
|
+
//
|
|
2694
|
+
// Also, people in general should move from inputting phone numbers
|
|
2695
|
+
// in national format (possibly with national prefixes)
|
|
2696
|
+
// and use international phone number format instead:
|
|
2697
|
+
// it's a logical thing in the modern age of mobile phones,
|
|
2698
|
+
// globalization and the internet.
|
|
2699
|
+
//
|
|
2700
|
+
|
|
2701
|
+
/* istanbul ignore if */
|
|
2702
|
+
|
|
2703
|
+
|
|
2704
|
+
if (!NON_ALTERING_FORMAT_REG_EXP.test(_this4.getFormatFormat(format, state.international))) {
|
|
2705
|
+
return "continue";
|
|
2706
|
+
}
|
|
2707
|
+
|
|
2708
|
+
if (!_this4.createTemplateForFormat(format, state)) {
|
|
2709
|
+
// Remove the format if it can't generate a template.
|
|
2710
|
+
_this4.matchingFormats = _this4.matchingFormats.filter(function (_) {
|
|
2711
|
+
return _ !== format;
|
|
2712
|
+
});
|
|
2713
|
+
return "continue";
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2716
|
+
_this4.chosenFormat = format;
|
|
2717
|
+
return "break";
|
|
2718
|
+
};
|
|
2719
|
+
|
|
2720
|
+
// When there are multiple available formats, the formatter uses the first
|
|
2721
|
+
// format where a formatting template could be created.
|
|
2722
|
+
_loop: for (var _iterator2 = this.matchingFormats.slice(), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
|
2723
|
+
var _ref5;
|
|
2724
|
+
|
|
2725
|
+
var _ret = _loop2();
|
|
2726
|
+
|
|
2727
|
+
switch (_ret) {
|
|
2728
|
+
case "break":
|
|
2729
|
+
break _loop;
|
|
2730
|
+
|
|
2731
|
+
case "continue":
|
|
2732
|
+
continue;
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2736
|
+
if (!this.chosenFormat) {
|
|
2737
|
+
// No format matches the national (significant) phone number.
|
|
2738
|
+
this.resetFormat();
|
|
2739
|
+
}
|
|
2740
|
+
|
|
2741
|
+
return this.chosenFormat;
|
|
2742
|
+
}
|
|
2743
|
+
}, {
|
|
2744
|
+
key: "createTemplateForFormat",
|
|
2745
|
+
value: function createTemplateForFormat(format, state) {
|
|
2746
|
+
// The formatter doesn't format numbers when numberPattern contains '|', e.g.
|
|
2747
|
+
// (20|3)\d{4}. In those cases we quickly return.
|
|
2748
|
+
// (Though there's no such format in current metadata)
|
|
2749
|
+
|
|
2750
|
+
/* istanbul ignore if */
|
|
2751
|
+
if ( format.pattern().indexOf('|') >= 0) {
|
|
2752
|
+
return;
|
|
2753
|
+
} // Get formatting template for this phone number format
|
|
2754
|
+
|
|
2755
|
+
|
|
2756
|
+
var template = this.getTemplateForFormat(format, state); // If the national number entered is too long
|
|
2757
|
+
// for any phone number format, then abort.
|
|
2758
|
+
|
|
2759
|
+
if (template) {
|
|
2760
|
+
this.setNationalNumberTemplate(template, state);
|
|
2761
|
+
return true;
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2764
|
+
}, {
|
|
2765
|
+
key: "getInternationalPrefixBeforeCountryCallingCode",
|
|
2766
|
+
value: function getInternationalPrefixBeforeCountryCallingCode(_ref6, options) {
|
|
2767
|
+
var IDDPrefix = _ref6.IDDPrefix,
|
|
2768
|
+
missingPlus = _ref6.missingPlus;
|
|
2769
|
+
|
|
2770
|
+
if (IDDPrefix) {
|
|
2771
|
+
return options && options.spacing === false ? IDDPrefix : IDDPrefix + ' ';
|
|
2772
|
+
}
|
|
2773
|
+
|
|
2774
|
+
if (missingPlus) {
|
|
2775
|
+
return '';
|
|
2776
|
+
}
|
|
2777
|
+
|
|
2778
|
+
return '+';
|
|
2779
|
+
}
|
|
2780
|
+
}, {
|
|
2781
|
+
key: "getTemplate",
|
|
2782
|
+
value: function getTemplate(state) {
|
|
2783
|
+
if (!this.template) {
|
|
2784
|
+
return;
|
|
2785
|
+
} // `this.template` holds the template for a "complete" phone number.
|
|
2786
|
+
// The currently entered phone number is most likely not "complete",
|
|
2787
|
+
// so trim all non-populated digits.
|
|
2788
|
+
|
|
2789
|
+
|
|
2790
|
+
var index = -1;
|
|
2791
|
+
var i = 0;
|
|
2792
|
+
var internationalPrefix = state.international ? this.getInternationalPrefixBeforeCountryCallingCode(state, {
|
|
2793
|
+
spacing: false
|
|
2794
|
+
}) : '';
|
|
2795
|
+
|
|
2796
|
+
while (i < internationalPrefix.length + state.getDigitsWithoutInternationalPrefix().length) {
|
|
2797
|
+
index = this.template.indexOf(DIGIT_PLACEHOLDER, index + 1);
|
|
2798
|
+
i++;
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
return cutAndStripNonPairedParens(this.template, index + 1);
|
|
2802
|
+
}
|
|
2803
|
+
}, {
|
|
2804
|
+
key: "setNationalNumberTemplate",
|
|
2805
|
+
value: function setNationalNumberTemplate(template, state) {
|
|
2806
|
+
this.nationalNumberTemplate = template;
|
|
2807
|
+
this.populatedNationalNumberTemplate = template; // With a new formatting template, the matched position
|
|
2808
|
+
// using the old template needs to be reset.
|
|
2809
|
+
|
|
2810
|
+
this.populatedNationalNumberTemplatePosition = -1; // For convenience, the public `.template` property
|
|
2811
|
+
// contains the whole international number
|
|
2812
|
+
// if the phone number being input is international:
|
|
2813
|
+
// 'x' for the '+' sign, 'x'es for the country phone code,
|
|
2814
|
+
// a spacebar and then the template for the formatted national number.
|
|
2815
|
+
|
|
2816
|
+
if (state.international) {
|
|
2817
|
+
this.template = this.getInternationalPrefixBeforeCountryCallingCode(state).replace(/[\d\+]/g, DIGIT_PLACEHOLDER) + repeat(DIGIT_PLACEHOLDER, state.callingCode.length) + ' ' + template;
|
|
2818
|
+
} else {
|
|
2819
|
+
this.template = template;
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
/**
|
|
2823
|
+
* Generates formatting template for a national phone number,
|
|
2824
|
+
* optionally containing a national prefix, for a format.
|
|
2825
|
+
* @param {Format} format
|
|
2826
|
+
* @param {string} nationalPrefix
|
|
2827
|
+
* @return {string}
|
|
2828
|
+
*/
|
|
2829
|
+
|
|
2830
|
+
}, {
|
|
2831
|
+
key: "getTemplateForFormat",
|
|
2832
|
+
value: function getTemplateForFormat(format, _ref7) {
|
|
2833
|
+
var nationalSignificantNumber = _ref7.nationalSignificantNumber,
|
|
2834
|
+
international = _ref7.international,
|
|
2835
|
+
nationalPrefix = _ref7.nationalPrefix,
|
|
2836
|
+
complexPrefixBeforeNationalSignificantNumber = _ref7.complexPrefixBeforeNationalSignificantNumber;
|
|
2837
|
+
var pattern = format.pattern();
|
|
2838
|
+
/* istanbul ignore else */
|
|
2839
|
+
|
|
2840
|
+
{
|
|
2841
|
+
pattern = pattern // Replace anything in the form of [..] with \d
|
|
2842
|
+
.replace(CREATE_CHARACTER_CLASS_PATTERN(), '\\d') // Replace any standalone digit (not the one in `{}`) with \d
|
|
2843
|
+
.replace(CREATE_STANDALONE_DIGIT_PATTERN(), '\\d');
|
|
2844
|
+
} // Generate a dummy national number (consisting of `9`s)
|
|
2845
|
+
// that fits this format's `pattern`.
|
|
2846
|
+
//
|
|
2847
|
+
// This match will always succeed,
|
|
2848
|
+
// because the "longest dummy phone number"
|
|
2849
|
+
// has enough length to accomodate any possible
|
|
2850
|
+
// national phone number format pattern.
|
|
2851
|
+
//
|
|
2852
|
+
|
|
2853
|
+
|
|
2854
|
+
var digits = LONGEST_DUMMY_PHONE_NUMBER.match(pattern)[0]; // If the national number entered is too long
|
|
2855
|
+
// for any phone number format, then abort.
|
|
2856
|
+
|
|
2857
|
+
if (nationalSignificantNumber.length > digits.length) {
|
|
2858
|
+
return;
|
|
2859
|
+
} // Get a formatting template which can be used to efficiently format
|
|
2860
|
+
// a partial number where digits are added one by one.
|
|
2861
|
+
// Below `strictPattern` is used for the
|
|
2862
|
+
// regular expression (with `^` and `$`).
|
|
2863
|
+
// This wasn't originally in Google's `libphonenumber`
|
|
2864
|
+
// and I guess they don't really need it
|
|
2865
|
+
// because they're not using "templates" to format phone numbers
|
|
2866
|
+
// but I added `strictPattern` after encountering
|
|
2867
|
+
// South Korean phone number formatting bug.
|
|
2868
|
+
//
|
|
2869
|
+
// Non-strict regular expression bug demonstration:
|
|
2870
|
+
//
|
|
2871
|
+
// this.nationalSignificantNumber : `111111111` (9 digits)
|
|
2872
|
+
//
|
|
2873
|
+
// pattern : (\d{2})(\d{3,4})(\d{4})
|
|
2874
|
+
// format : `$1 $2 $3`
|
|
2875
|
+
// digits : `9999999999` (10 digits)
|
|
2876
|
+
//
|
|
2877
|
+
// '9999999999'.replace(new RegExp(/(\d{2})(\d{3,4})(\d{4})/g), '$1 $2 $3') = "99 9999 9999"
|
|
2878
|
+
//
|
|
2879
|
+
// template : xx xxxx xxxx
|
|
2880
|
+
//
|
|
2881
|
+
// But the correct template in this case is `xx xxx xxxx`.
|
|
2882
|
+
// The template was generated incorrectly because of the
|
|
2883
|
+
// `{3,4}` variability in the `pattern`.
|
|
2884
|
+
//
|
|
2885
|
+
// The fix is, if `this.nationalSignificantNumber` has already sufficient length
|
|
2886
|
+
// to satisfy the `pattern` completely then `this.nationalSignificantNumber`
|
|
2887
|
+
// is used instead of `digits`.
|
|
2888
|
+
|
|
2889
|
+
|
|
2890
|
+
var strictPattern = new RegExp('^' + pattern + '$');
|
|
2891
|
+
var nationalNumberDummyDigits = nationalSignificantNumber.replace(/\d/g, DUMMY_DIGIT); // If `this.nationalSignificantNumber` has already sufficient length
|
|
2892
|
+
// to satisfy the `pattern` completely then use it
|
|
2893
|
+
// instead of `digits`.
|
|
2894
|
+
|
|
2895
|
+
if (strictPattern.test(nationalNumberDummyDigits)) {
|
|
2896
|
+
digits = nationalNumberDummyDigits;
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2899
|
+
var numberFormat = this.getFormatFormat(format, international);
|
|
2900
|
+
var nationalPrefixIncludedInTemplate; // If a user did input a national prefix (and that's guaranteed),
|
|
2901
|
+
// and if a `format` does have a national prefix formatting rule,
|
|
2902
|
+
// then see if that national prefix formatting rule
|
|
2903
|
+
// prepends exactly the same national prefix the user has input.
|
|
2904
|
+
// If that's the case, then use the `format` with the national prefix formatting rule.
|
|
2905
|
+
// Otherwise, use the `format` without the national prefix formatting rule,
|
|
2906
|
+
// and prepend a national prefix manually to it.
|
|
2907
|
+
|
|
2908
|
+
if (this.shouldTryNationalPrefixFormattingRule(format, {
|
|
2909
|
+
international: international,
|
|
2910
|
+
nationalPrefix: nationalPrefix
|
|
2911
|
+
})) {
|
|
2912
|
+
var numberFormatWithNationalPrefix = numberFormat.replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()); // If `national_prefix_formatting_rule` of a `format` simply prepends
|
|
2913
|
+
// national prefix at the start of a national (significant) number,
|
|
2914
|
+
// then such formatting can be used with `AsYouType` formatter.
|
|
2915
|
+
// There seems to be no `else` case: everywhere in metadata,
|
|
2916
|
+
// national prefix formatting rule is national prefix + $1,
|
|
2917
|
+
// or `($1)`, in which case such format isn't even considered
|
|
2918
|
+
// when the user has input a national prefix.
|
|
2919
|
+
|
|
2920
|
+
/* istanbul ignore else */
|
|
2921
|
+
|
|
2922
|
+
if (parseDigits(format.nationalPrefixFormattingRule()) === (nationalPrefix || '') + parseDigits('$1')) {
|
|
2923
|
+
numberFormat = numberFormatWithNationalPrefix;
|
|
2924
|
+
nationalPrefixIncludedInTemplate = true; // Replace all digits of the national prefix in the formatting template
|
|
2925
|
+
// with `DIGIT_PLACEHOLDER`s.
|
|
2926
|
+
|
|
2927
|
+
if (nationalPrefix) {
|
|
2928
|
+
var i = nationalPrefix.length;
|
|
2929
|
+
|
|
2930
|
+
while (i > 0) {
|
|
2931
|
+
numberFormat = numberFormat.replace(/\d/, DIGIT_PLACEHOLDER);
|
|
2932
|
+
i--;
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
} // Generate formatting template for this phone number format.
|
|
2937
|
+
|
|
2938
|
+
|
|
2939
|
+
var template = digits // Format the dummy phone number according to the format.
|
|
2940
|
+
.replace(new RegExp(pattern), numberFormat) // Replace each dummy digit with a DIGIT_PLACEHOLDER.
|
|
2941
|
+
.replace(new RegExp(DUMMY_DIGIT, 'g'), DIGIT_PLACEHOLDER); // If a prefix of a national (significant) number is not as simple
|
|
2942
|
+
// as just a basic national prefix, then just prepend such prefix
|
|
2943
|
+
// before the national (significant) number, optionally spacing
|
|
2944
|
+
// the two with a whitespace.
|
|
2945
|
+
|
|
2946
|
+
if (!nationalPrefixIncludedInTemplate) {
|
|
2947
|
+
if (complexPrefixBeforeNationalSignificantNumber) {
|
|
2948
|
+
// Prepend the prefix to the template manually.
|
|
2949
|
+
template = repeat(DIGIT_PLACEHOLDER, complexPrefixBeforeNationalSignificantNumber.length) + ' ' + template;
|
|
2950
|
+
} else if (nationalPrefix) {
|
|
2951
|
+
// Prepend national prefix to the template manually.
|
|
2952
|
+
template = repeat(DIGIT_PLACEHOLDER, nationalPrefix.length) + this.getSeparatorAfterNationalPrefix(format) + template;
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2955
|
+
|
|
2956
|
+
if (international) {
|
|
2957
|
+
template = applyInternationalSeparatorStyle(template);
|
|
2958
|
+
}
|
|
2959
|
+
|
|
2960
|
+
return template;
|
|
2961
|
+
}
|
|
2962
|
+
}, {
|
|
2963
|
+
key: "formatNextNationalNumberDigits",
|
|
2964
|
+
value: function formatNextNationalNumberDigits(digits) {
|
|
2965
|
+
var result = populateTemplateWithDigits(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition, digits);
|
|
2966
|
+
|
|
2967
|
+
if (!result) {
|
|
2968
|
+
// Reset the format.
|
|
2969
|
+
this.resetFormat();
|
|
2970
|
+
return;
|
|
2971
|
+
}
|
|
2972
|
+
|
|
2973
|
+
this.populatedNationalNumberTemplate = result[0];
|
|
2974
|
+
this.populatedNationalNumberTemplatePosition = result[1]; // Return the formatted phone number so far.
|
|
2975
|
+
|
|
2976
|
+
return cutAndStripNonPairedParens(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1); // The old way which was good for `input-format` but is not so good
|
|
2977
|
+
// for `react-phone-number-input`'s default input (`InputBasic`).
|
|
2978
|
+
// return closeNonPairedParens(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1)
|
|
2979
|
+
// .replace(new RegExp(DIGIT_PLACEHOLDER, 'g'), ' ')
|
|
2980
|
+
}
|
|
2981
|
+
}]);
|
|
2982
|
+
|
|
2983
|
+
return AsYouTypeFormatter;
|
|
2984
|
+
}();
|
|
2985
|
+
|
|
2986
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
2987
|
+
|
|
2988
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
2989
|
+
|
|
2990
|
+
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
2991
|
+
|
|
2992
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
2993
|
+
|
|
2994
|
+
function _classCallCheck$4(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2995
|
+
|
|
2996
|
+
function _defineProperties$4(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
2997
|
+
|
|
2998
|
+
function _createClass$4(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$4(Constructor.prototype, protoProps); if (staticProps) _defineProperties$4(Constructor, staticProps); return Constructor; }
|
|
2999
|
+
var VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART = '[' + VALID_PUNCTUATION + VALID_DIGITS + ']+';
|
|
3000
|
+
var VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART_PATTERN = new RegExp('^' + VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART + '$', 'i');
|
|
3001
|
+
var VALID_FORMATTED_PHONE_NUMBER_PART = '(?:' + '[' + PLUS_CHARS + ']' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']*' + '|' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']+' + ')';
|
|
3002
|
+
var AFTER_PHONE_NUMBER_DIGITS_END_PATTERN = new RegExp('[^' + VALID_PUNCTUATION + VALID_DIGITS + ']+' + '.*' + '$'); // Tests whether `national_prefix_for_parsing` could match
|
|
3003
|
+
// different national prefixes.
|
|
3004
|
+
// Matches anything that's not a digit or a square bracket.
|
|
3005
|
+
|
|
3006
|
+
var COMPLEX_NATIONAL_PREFIX = /[^\d\[\]]/;
|
|
3007
|
+
|
|
3008
|
+
var AsYouTypeParser =
|
|
3009
|
+
/*#__PURE__*/
|
|
3010
|
+
function () {
|
|
3011
|
+
function AsYouTypeParser(_ref) {
|
|
3012
|
+
var defaultCountry = _ref.defaultCountry,
|
|
3013
|
+
defaultCallingCode = _ref.defaultCallingCode,
|
|
3014
|
+
metadata = _ref.metadata,
|
|
3015
|
+
onNationalSignificantNumberChange = _ref.onNationalSignificantNumberChange;
|
|
3016
|
+
|
|
3017
|
+
_classCallCheck$4(this, AsYouTypeParser);
|
|
3018
|
+
|
|
3019
|
+
this.defaultCountry = defaultCountry;
|
|
3020
|
+
this.defaultCallingCode = defaultCallingCode;
|
|
3021
|
+
this.metadata = metadata;
|
|
3022
|
+
this.onNationalSignificantNumberChange = onNationalSignificantNumberChange;
|
|
3023
|
+
}
|
|
3024
|
+
|
|
3025
|
+
_createClass$4(AsYouTypeParser, [{
|
|
3026
|
+
key: "input",
|
|
3027
|
+
value: function input(text, state) {
|
|
3028
|
+
var _extractFormattedDigi = extractFormattedDigitsAndPlus(text),
|
|
3029
|
+
_extractFormattedDigi2 = _slicedToArray(_extractFormattedDigi, 2),
|
|
3030
|
+
formattedDigits = _extractFormattedDigi2[0],
|
|
3031
|
+
hasPlus = _extractFormattedDigi2[1];
|
|
3032
|
+
|
|
3033
|
+
var digits = parseDigits(formattedDigits); // Checks for a special case: just a leading `+` has been entered.
|
|
3034
|
+
|
|
3035
|
+
var justLeadingPlus;
|
|
3036
|
+
|
|
3037
|
+
if (hasPlus) {
|
|
3038
|
+
if (!state.digits) {
|
|
3039
|
+
state.startInternationalNumber();
|
|
3040
|
+
|
|
3041
|
+
if (!digits) {
|
|
3042
|
+
justLeadingPlus = true;
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3045
|
+
}
|
|
3046
|
+
|
|
3047
|
+
if (digits) {
|
|
3048
|
+
this.inputDigits(digits, state);
|
|
3049
|
+
}
|
|
3050
|
+
|
|
3051
|
+
return {
|
|
3052
|
+
digits: digits,
|
|
3053
|
+
justLeadingPlus: justLeadingPlus
|
|
3054
|
+
};
|
|
3055
|
+
}
|
|
3056
|
+
/**
|
|
3057
|
+
* Inputs "next" phone number digits.
|
|
3058
|
+
* @param {string} digits
|
|
3059
|
+
* @return {string} [formattedNumber] Formatted national phone number (if it can be formatted at this stage). Returning `undefined` means "don't format the national phone number at this stage".
|
|
3060
|
+
*/
|
|
3061
|
+
|
|
3062
|
+
}, {
|
|
3063
|
+
key: "inputDigits",
|
|
3064
|
+
value: function inputDigits(nextDigits, state) {
|
|
3065
|
+
var digits = state.digits;
|
|
3066
|
+
var hasReceivedThreeLeadingDigits = digits.length < 3 && digits.length + nextDigits.length >= 3; // Append phone number digits.
|
|
3067
|
+
|
|
3068
|
+
state.appendDigits(nextDigits); // Attempt to extract IDD prefix:
|
|
3069
|
+
// Some users input their phone number in international format,
|
|
3070
|
+
// but in an "out-of-country" dialing format instead of using the leading `+`.
|
|
3071
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/185
|
|
3072
|
+
// Detect such numbers as soon as there're at least 3 digits.
|
|
3073
|
+
// Google's library attempts to extract IDD prefix at 3 digits,
|
|
3074
|
+
// so this library just copies that behavior.
|
|
3075
|
+
// I guess that's because the most commot IDD prefixes are
|
|
3076
|
+
// `00` (Europe) and `011` (US).
|
|
3077
|
+
// There exist really long IDD prefixes too:
|
|
3078
|
+
// for example, in Australia the default IDD prefix is `0011`,
|
|
3079
|
+
// and it could even be as long as `14880011`.
|
|
3080
|
+
// An IDD prefix is extracted here, and then every time when
|
|
3081
|
+
// there's a new digit and the number couldn't be formatted.
|
|
3082
|
+
|
|
3083
|
+
if (hasReceivedThreeLeadingDigits) {
|
|
3084
|
+
this.extractIddPrefix(state);
|
|
3085
|
+
}
|
|
3086
|
+
|
|
3087
|
+
if (this.isWaitingForCountryCallingCode(state)) {
|
|
3088
|
+
if (!this.extractCountryCallingCode(state)) {
|
|
3089
|
+
return;
|
|
3090
|
+
}
|
|
3091
|
+
} else {
|
|
3092
|
+
state.appendNationalSignificantNumberDigits(nextDigits);
|
|
3093
|
+
} // If a phone number is being input in international format,
|
|
3094
|
+
// then it's not valid for it to have a national prefix.
|
|
3095
|
+
// Still, some people incorrectly input such numbers with a national prefix.
|
|
3096
|
+
// In such cases, only attempt to strip a national prefix if the number becomes too long.
|
|
3097
|
+
// (but that is done later, not here)
|
|
3098
|
+
|
|
3099
|
+
|
|
3100
|
+
if (!state.international) {
|
|
3101
|
+
if (!this.hasExtractedNationalSignificantNumber) {
|
|
3102
|
+
this.extractNationalSignificantNumber(state.getNationalDigits(), state.update);
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
}, {
|
|
3107
|
+
key: "isWaitingForCountryCallingCode",
|
|
3108
|
+
value: function isWaitingForCountryCallingCode(_ref2) {
|
|
3109
|
+
var international = _ref2.international,
|
|
3110
|
+
callingCode = _ref2.callingCode;
|
|
3111
|
+
return international && !callingCode;
|
|
3112
|
+
} // Extracts a country calling code from a number
|
|
3113
|
+
// being entered in internatonal format.
|
|
3114
|
+
|
|
3115
|
+
}, {
|
|
3116
|
+
key: "extractCountryCallingCode",
|
|
3117
|
+
value: function extractCountryCallingCode$1(state) {
|
|
3118
|
+
var _extractCountryCallin = extractCountryCallingCode('+' + state.getDigitsWithoutInternationalPrefix(), this.defaultCountry, this.defaultCallingCode, this.metadata.metadata),
|
|
3119
|
+
countryCallingCode = _extractCountryCallin.countryCallingCode,
|
|
3120
|
+
number = _extractCountryCallin.number;
|
|
3121
|
+
|
|
3122
|
+
if (countryCallingCode) {
|
|
3123
|
+
state.setCallingCode(countryCallingCode);
|
|
3124
|
+
state.update({
|
|
3125
|
+
nationalSignificantNumber: number
|
|
3126
|
+
});
|
|
3127
|
+
return true;
|
|
3128
|
+
}
|
|
3129
|
+
}
|
|
3130
|
+
}, {
|
|
3131
|
+
key: "reset",
|
|
3132
|
+
value: function reset(numberingPlan) {
|
|
3133
|
+
if (numberingPlan) {
|
|
3134
|
+
this.hasSelectedNumberingPlan = true;
|
|
3135
|
+
|
|
3136
|
+
var nationalPrefixForParsing = numberingPlan._nationalPrefixForParsing();
|
|
3137
|
+
|
|
3138
|
+
this.couldPossiblyExtractAnotherNationalSignificantNumber = nationalPrefixForParsing && COMPLEX_NATIONAL_PREFIX.test(nationalPrefixForParsing);
|
|
3139
|
+
} else {
|
|
3140
|
+
this.hasSelectedNumberingPlan = undefined;
|
|
3141
|
+
this.couldPossiblyExtractAnotherNationalSignificantNumber = undefined;
|
|
3142
|
+
}
|
|
3143
|
+
}
|
|
3144
|
+
/**
|
|
3145
|
+
* Extracts a national (significant) number from user input.
|
|
3146
|
+
* Google's library is different in that it only applies `national_prefix_for_parsing`
|
|
3147
|
+
* and doesn't apply `national_prefix_transform_rule` after that.
|
|
3148
|
+
* https://github.com/google/libphonenumber/blob/a3d70b0487875475e6ad659af404943211d26456/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java#L539
|
|
3149
|
+
* @return {boolean} [extracted]
|
|
3150
|
+
*/
|
|
3151
|
+
|
|
3152
|
+
}, {
|
|
3153
|
+
key: "extractNationalSignificantNumber",
|
|
3154
|
+
value: function extractNationalSignificantNumber(nationalDigits, setState) {
|
|
3155
|
+
if (!this.hasSelectedNumberingPlan) {
|
|
3156
|
+
return;
|
|
3157
|
+
}
|
|
3158
|
+
|
|
3159
|
+
var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(nationalDigits, this.metadata),
|
|
3160
|
+
nationalPrefix = _extractNationalNumbe.nationalPrefix,
|
|
3161
|
+
nationalNumber = _extractNationalNumbe.nationalNumber,
|
|
3162
|
+
carrierCode = _extractNationalNumbe.carrierCode;
|
|
3163
|
+
|
|
3164
|
+
if (nationalNumber === nationalDigits) {
|
|
3165
|
+
return;
|
|
3166
|
+
}
|
|
3167
|
+
|
|
3168
|
+
this.onExtractedNationalNumber(nationalPrefix, carrierCode, nationalNumber, nationalDigits, setState);
|
|
3169
|
+
return true;
|
|
3170
|
+
}
|
|
3171
|
+
/**
|
|
3172
|
+
* In Google's code this function is called "attempt to extract longer NDD".
|
|
3173
|
+
* "Some national prefixes are a substring of others", they say.
|
|
3174
|
+
* @return {boolean} [result] — Returns `true` if extracting a national prefix produced different results from what they were.
|
|
3175
|
+
*/
|
|
3176
|
+
|
|
3177
|
+
}, {
|
|
3178
|
+
key: "extractAnotherNationalSignificantNumber",
|
|
3179
|
+
value: function extractAnotherNationalSignificantNumber(nationalDigits, prevNationalSignificantNumber, setState) {
|
|
3180
|
+
if (!this.hasExtractedNationalSignificantNumber) {
|
|
3181
|
+
return this.extractNationalSignificantNumber(nationalDigits, setState);
|
|
3182
|
+
}
|
|
3183
|
+
|
|
3184
|
+
if (!this.couldPossiblyExtractAnotherNationalSignificantNumber) {
|
|
3185
|
+
return;
|
|
3186
|
+
}
|
|
3187
|
+
|
|
3188
|
+
var _extractNationalNumbe2 = extractNationalNumberFromPossiblyIncompleteNumber(nationalDigits, this.metadata),
|
|
3189
|
+
nationalPrefix = _extractNationalNumbe2.nationalPrefix,
|
|
3190
|
+
nationalNumber = _extractNationalNumbe2.nationalNumber,
|
|
3191
|
+
carrierCode = _extractNationalNumbe2.carrierCode; // If a national prefix has been extracted previously,
|
|
3192
|
+
// then it's always extracted as additional digits are added.
|
|
3193
|
+
// That's assuming `extractNationalNumberFromPossiblyIncompleteNumber()`
|
|
3194
|
+
// doesn't do anything different from what it currently does.
|
|
3195
|
+
// So, just in case, here's this check, though it doesn't occur.
|
|
3196
|
+
|
|
3197
|
+
/* istanbul ignore if */
|
|
3198
|
+
|
|
3199
|
+
|
|
3200
|
+
if (nationalNumber === prevNationalSignificantNumber) {
|
|
3201
|
+
return;
|
|
3202
|
+
}
|
|
3203
|
+
|
|
3204
|
+
this.onExtractedNationalNumber(nationalPrefix, carrierCode, nationalNumber, nationalDigits, setState);
|
|
3205
|
+
return true;
|
|
3206
|
+
}
|
|
3207
|
+
}, {
|
|
3208
|
+
key: "onExtractedNationalNumber",
|
|
3209
|
+
value: function onExtractedNationalNumber(nationalPrefix, carrierCode, nationalSignificantNumber, nationalDigits, setState) {
|
|
3210
|
+
var complexPrefixBeforeNationalSignificantNumber;
|
|
3211
|
+
var nationalSignificantNumberMatchesInput; // This check also works with empty `this.nationalSignificantNumber`.
|
|
3212
|
+
|
|
3213
|
+
var nationalSignificantNumberIndex = nationalDigits.lastIndexOf(nationalSignificantNumber); // If the extracted national (significant) number is the
|
|
3214
|
+
// last substring of the `digits`, then it means that it hasn't been altered:
|
|
3215
|
+
// no digits have been removed from the national (significant) number
|
|
3216
|
+
// while applying `national_prefix_transform_rule`.
|
|
3217
|
+
// https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule
|
|
3218
|
+
|
|
3219
|
+
if (nationalSignificantNumberIndex >= 0 && nationalSignificantNumberIndex === nationalDigits.length - nationalSignificantNumber.length) {
|
|
3220
|
+
nationalSignificantNumberMatchesInput = true; // If a prefix of a national (significant) number is not as simple
|
|
3221
|
+
// as just a basic national prefix, then such prefix is stored in
|
|
3222
|
+
// `this.complexPrefixBeforeNationalSignificantNumber` property and will be
|
|
3223
|
+
// prepended "as is" to the national (significant) number to produce
|
|
3224
|
+
// a formatted result.
|
|
3225
|
+
|
|
3226
|
+
var prefixBeforeNationalNumber = nationalDigits.slice(0, nationalSignificantNumberIndex); // `prefixBeforeNationalNumber` is always non-empty,
|
|
3227
|
+
// because `onExtractedNationalNumber()` isn't called
|
|
3228
|
+
// when a national (significant) number hasn't been actually "extracted":
|
|
3229
|
+
// when a national (significant) number is equal to the national part of `digits`,
|
|
3230
|
+
// then `onExtractedNationalNumber()` doesn't get called.
|
|
3231
|
+
|
|
3232
|
+
if (prefixBeforeNationalNumber !== nationalPrefix) {
|
|
3233
|
+
complexPrefixBeforeNationalSignificantNumber = prefixBeforeNationalNumber;
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
|
|
3237
|
+
setState({
|
|
3238
|
+
nationalPrefix: nationalPrefix,
|
|
3239
|
+
carrierCode: carrierCode,
|
|
3240
|
+
nationalSignificantNumber: nationalSignificantNumber,
|
|
3241
|
+
nationalSignificantNumberMatchesInput: nationalSignificantNumberMatchesInput,
|
|
3242
|
+
complexPrefixBeforeNationalSignificantNumber: complexPrefixBeforeNationalSignificantNumber
|
|
3243
|
+
}); // `onExtractedNationalNumber()` is only called when
|
|
3244
|
+
// the national (significant) number actually did change.
|
|
3245
|
+
|
|
3246
|
+
this.hasExtractedNationalSignificantNumber = true;
|
|
3247
|
+
this.onNationalSignificantNumberChange();
|
|
3248
|
+
}
|
|
3249
|
+
}, {
|
|
3250
|
+
key: "reExtractNationalSignificantNumber",
|
|
3251
|
+
value: function reExtractNationalSignificantNumber(state) {
|
|
3252
|
+
// Attempt to extract a national prefix.
|
|
3253
|
+
//
|
|
3254
|
+
// Some people incorrectly input national prefix
|
|
3255
|
+
// in an international phone number.
|
|
3256
|
+
// For example, some people write British phone numbers as `+44(0)...`.
|
|
3257
|
+
//
|
|
3258
|
+
// Also, in some rare cases, it is valid for a national prefix
|
|
3259
|
+
// to be a part of an international phone number.
|
|
3260
|
+
// For example, mobile phone numbers in Mexico are supposed to be
|
|
3261
|
+
// dialled internationally using a `1` national prefix,
|
|
3262
|
+
// so the national prefix will be part of an international number.
|
|
3263
|
+
//
|
|
3264
|
+
// Quote from:
|
|
3265
|
+
// https://www.mexperience.com/dialing-cell-phones-in-mexico/
|
|
3266
|
+
//
|
|
3267
|
+
// "Dialing a Mexican cell phone from abroad
|
|
3268
|
+
// When you are calling a cell phone number in Mexico from outside Mexico,
|
|
3269
|
+
// it’s necessary to dial an additional “1” after Mexico’s country code
|
|
3270
|
+
// (which is “52”) and before the area code.
|
|
3271
|
+
// You also ignore the 045, and simply dial the area code and the
|
|
3272
|
+
// cell phone’s number.
|
|
3273
|
+
//
|
|
3274
|
+
// If you don’t add the “1”, you’ll receive a recorded announcement
|
|
3275
|
+
// asking you to redial using it.
|
|
3276
|
+
//
|
|
3277
|
+
// For example, if you are calling from the USA to a cell phone
|
|
3278
|
+
// in Mexico City, you would dial +52 – 1 – 55 – 1234 5678.
|
|
3279
|
+
// (Note that this is different to calling a land line in Mexico City
|
|
3280
|
+
// from abroad, where the number dialed would be +52 – 55 – 1234 5678)".
|
|
3281
|
+
//
|
|
3282
|
+
// Google's demo output:
|
|
3283
|
+
// https://libphonenumber.appspot.com/phonenumberparser?number=%2b5215512345678&country=MX
|
|
3284
|
+
//
|
|
3285
|
+
if (this.extractAnotherNationalSignificantNumber(state.getNationalDigits(), state.nationalSignificantNumber, state.update)) {
|
|
3286
|
+
return true;
|
|
3287
|
+
} // If no format matches the phone number, then it could be
|
|
3288
|
+
// "a really long IDD" (quote from a comment in Google's library).
|
|
3289
|
+
// An IDD prefix is first extracted when the user has entered at least 3 digits,
|
|
3290
|
+
// and then here — every time when there's a new digit and the number
|
|
3291
|
+
// couldn't be formatted.
|
|
3292
|
+
// For example, in Australia the default IDD prefix is `0011`,
|
|
3293
|
+
// and it could even be as long as `14880011`.
|
|
3294
|
+
//
|
|
3295
|
+
// Could also check `!hasReceivedThreeLeadingDigits` here
|
|
3296
|
+
// to filter out the case when this check duplicates the one
|
|
3297
|
+
// already performed when there're 3 leading digits,
|
|
3298
|
+
// but it's not a big deal, and in most cases there
|
|
3299
|
+
// will be a suitable `format` when there're 3 leading digits.
|
|
3300
|
+
//
|
|
3301
|
+
|
|
3302
|
+
|
|
3303
|
+
if (this.extractIddPrefix(state)) {
|
|
3304
|
+
this.extractCallingCodeAndNationalSignificantNumber(state);
|
|
3305
|
+
return true;
|
|
3306
|
+
} // Google's AsYouType formatter supports sort of an "autocorrection" feature
|
|
3307
|
+
// when it "autocorrects" numbers that have been input for a country
|
|
3308
|
+
// with that country's calling code.
|
|
3309
|
+
// Such "autocorrection" feature looks weird, but different people have been requesting it:
|
|
3310
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/376
|
|
3311
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/375
|
|
3312
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/316
|
|
3313
|
+
|
|
3314
|
+
|
|
3315
|
+
if (this.fixMissingPlus(state)) {
|
|
3316
|
+
this.extractCallingCodeAndNationalSignificantNumber(state);
|
|
3317
|
+
return true;
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
}, {
|
|
3321
|
+
key: "extractIddPrefix",
|
|
3322
|
+
value: function extractIddPrefix(state) {
|
|
3323
|
+
// An IDD prefix can't be present in a number written with a `+`.
|
|
3324
|
+
// Also, don't re-extract an IDD prefix if has already been extracted.
|
|
3325
|
+
var international = state.international,
|
|
3326
|
+
IDDPrefix = state.IDDPrefix,
|
|
3327
|
+
digits = state.digits;
|
|
3328
|
+
|
|
3329
|
+
if (international || IDDPrefix) {
|
|
3330
|
+
return;
|
|
3331
|
+
} // Some users input their phone number in "out-of-country"
|
|
3332
|
+
// dialing format instead of using the leading `+`.
|
|
3333
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/185
|
|
3334
|
+
// Detect such numbers.
|
|
3335
|
+
|
|
3336
|
+
|
|
3337
|
+
var numberWithoutIDD = stripIddPrefix(digits, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata);
|
|
3338
|
+
|
|
3339
|
+
if (numberWithoutIDD !== undefined && numberWithoutIDD !== digits) {
|
|
3340
|
+
// If an IDD prefix was stripped then convert the IDD-prefixed number
|
|
3341
|
+
// to international number for subsequent parsing.
|
|
3342
|
+
state.update({
|
|
3343
|
+
IDDPrefix: digits.slice(0, digits.length - numberWithoutIDD.length)
|
|
3344
|
+
});
|
|
3345
|
+
this.startInternationalNumber(state);
|
|
3346
|
+
return true;
|
|
3347
|
+
}
|
|
3348
|
+
}
|
|
3349
|
+
}, {
|
|
3350
|
+
key: "fixMissingPlus",
|
|
3351
|
+
value: function fixMissingPlus(state) {
|
|
3352
|
+
if (!state.international) {
|
|
3353
|
+
var _extractCountryCallin2 = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(state.digits, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata),
|
|
3354
|
+
newCallingCode = _extractCountryCallin2.countryCallingCode;
|
|
3355
|
+
|
|
3356
|
+
if (newCallingCode) {
|
|
3357
|
+
state.update({
|
|
3358
|
+
missingPlus: true
|
|
3359
|
+
});
|
|
3360
|
+
this.startInternationalNumber(state);
|
|
3361
|
+
return true;
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
}, {
|
|
3366
|
+
key: "startInternationalNumber",
|
|
3367
|
+
value: function startInternationalNumber(state) {
|
|
3368
|
+
state.startInternationalNumber(); // If a national (significant) number has been extracted before, reset it.
|
|
3369
|
+
|
|
3370
|
+
if (state.nationalSignificantNumber) {
|
|
3371
|
+
state.resetNationalSignificantNumber();
|
|
3372
|
+
this.onNationalSignificantNumberChange();
|
|
3373
|
+
this.hasExtractedNationalSignificantNumber = undefined;
|
|
3374
|
+
}
|
|
3375
|
+
}
|
|
3376
|
+
}, {
|
|
3377
|
+
key: "extractCallingCodeAndNationalSignificantNumber",
|
|
3378
|
+
value: function extractCallingCodeAndNationalSignificantNumber(state) {
|
|
3379
|
+
if (this.extractCountryCallingCode(state)) {
|
|
3380
|
+
// `this.extractCallingCode()` is currently called when the number
|
|
3381
|
+
// couldn't be formatted during the standard procedure.
|
|
3382
|
+
// Normally, the national prefix would be re-extracted
|
|
3383
|
+
// for an international number if such number couldn't be formatted,
|
|
3384
|
+
// but since it's already not able to be formatted,
|
|
3385
|
+
// there won't be yet another retry, so also extract national prefix here.
|
|
3386
|
+
this.extractNationalSignificantNumber(state.getNationalDigits(), state.update);
|
|
3387
|
+
}
|
|
3388
|
+
}
|
|
3389
|
+
}]);
|
|
3390
|
+
|
|
3391
|
+
return AsYouTypeParser;
|
|
3392
|
+
}();
|
|
3393
|
+
|
|
3394
|
+
function extractFormattedPhoneNumber(text) {
|
|
3395
|
+
// Attempt to extract a possible number from the string passed in.
|
|
3396
|
+
var startsAt = text.search(VALID_FORMATTED_PHONE_NUMBER_PART);
|
|
3397
|
+
|
|
3398
|
+
if (startsAt < 0) {
|
|
3399
|
+
return;
|
|
3400
|
+
} // Trim everything to the left of the phone number.
|
|
3401
|
+
|
|
3402
|
+
|
|
3403
|
+
text = text.slice(startsAt); // Trim the `+`.
|
|
3404
|
+
|
|
3405
|
+
var hasPlus;
|
|
3406
|
+
|
|
3407
|
+
if (text[0] === '+') {
|
|
3408
|
+
hasPlus = true;
|
|
3409
|
+
text = text.slice('+'.length);
|
|
3410
|
+
} // Trim everything to the right of the phone number.
|
|
3411
|
+
|
|
3412
|
+
|
|
3413
|
+
text = text.replace(AFTER_PHONE_NUMBER_DIGITS_END_PATTERN, ''); // Re-add the previously trimmed `+`.
|
|
3414
|
+
|
|
3415
|
+
if (hasPlus) {
|
|
3416
|
+
text = '+' + text;
|
|
3417
|
+
}
|
|
3418
|
+
|
|
3419
|
+
return text;
|
|
3420
|
+
}
|
|
3421
|
+
/**
|
|
3422
|
+
* Extracts formatted phone number digits (and a `+`) from text (if there're any).
|
|
3423
|
+
* @param {string} text
|
|
3424
|
+
* @return {any[]}
|
|
3425
|
+
*/
|
|
3426
|
+
|
|
3427
|
+
|
|
3428
|
+
function _extractFormattedDigitsAndPlus(text) {
|
|
3429
|
+
// Extract a formatted phone number part from text.
|
|
3430
|
+
var extractedNumber = extractFormattedPhoneNumber(text) || ''; // Trim a `+`.
|
|
3431
|
+
|
|
3432
|
+
if (extractedNumber[0] === '+') {
|
|
3433
|
+
return [extractedNumber.slice('+'.length), true];
|
|
3434
|
+
}
|
|
3435
|
+
|
|
3436
|
+
return [extractedNumber];
|
|
3437
|
+
}
|
|
3438
|
+
/**
|
|
3439
|
+
* Extracts formatted phone number digits (and a `+`) from text (if there're any).
|
|
3440
|
+
* @param {string} text
|
|
3441
|
+
* @return {any[]}
|
|
3442
|
+
*/
|
|
3443
|
+
|
|
3444
|
+
|
|
3445
|
+
function extractFormattedDigitsAndPlus(text) {
|
|
3446
|
+
var _extractFormattedDigi3 = _extractFormattedDigitsAndPlus(text),
|
|
3447
|
+
_extractFormattedDigi4 = _slicedToArray(_extractFormattedDigi3, 2),
|
|
3448
|
+
formattedDigits = _extractFormattedDigi4[0],
|
|
3449
|
+
hasPlus = _extractFormattedDigi4[1]; // If the extracted phone number part
|
|
3450
|
+
// can possibly be a part of some valid phone number
|
|
3451
|
+
// then parse phone number characters from a formatted phone number.
|
|
3452
|
+
|
|
3453
|
+
|
|
3454
|
+
if (!VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART_PATTERN.test(formattedDigits)) {
|
|
3455
|
+
formattedDigits = '';
|
|
3456
|
+
}
|
|
3457
|
+
|
|
3458
|
+
return [formattedDigits, hasPlus];
|
|
3459
|
+
}
|
|
3460
|
+
|
|
3461
|
+
function _typeof$1(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function _typeof(obj) { return typeof obj; }; } else { _typeof$1 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$1(obj); }
|
|
3462
|
+
|
|
3463
|
+
function _slicedToArray$1(arr, i) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _nonIterableRest$1(); }
|
|
3464
|
+
|
|
3465
|
+
function _nonIterableRest$1() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
3466
|
+
|
|
3467
|
+
function _iterableToArrayLimit$1(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
3468
|
+
|
|
3469
|
+
function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; }
|
|
3470
|
+
|
|
3471
|
+
function _classCallCheck$5(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3472
|
+
|
|
3473
|
+
function _defineProperties$5(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
3474
|
+
|
|
3475
|
+
function _createClass$5(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$5(Constructor.prototype, protoProps); if (staticProps) _defineProperties$5(Constructor, staticProps); return Constructor; }
|
|
3476
|
+
|
|
3477
|
+
var AsYouType =
|
|
3478
|
+
/*#__PURE__*/
|
|
3479
|
+
function () {
|
|
3480
|
+
/**
|
|
3481
|
+
* @param {(string|object)?} [optionsOrDefaultCountry] - The default country used for parsing non-international phone numbers. Can also be an `options` object.
|
|
3482
|
+
* @param {Object} metadata
|
|
3483
|
+
*/
|
|
3484
|
+
function AsYouType(optionsOrDefaultCountry, metadata) {
|
|
3485
|
+
_classCallCheck$5(this, AsYouType);
|
|
3486
|
+
|
|
3487
|
+
this.metadata = new Metadata(metadata);
|
|
3488
|
+
|
|
3489
|
+
var _this$getCountryAndCa = this.getCountryAndCallingCode(optionsOrDefaultCountry),
|
|
3490
|
+
_this$getCountryAndCa2 = _slicedToArray$1(_this$getCountryAndCa, 2),
|
|
3491
|
+
defaultCountry = _this$getCountryAndCa2[0],
|
|
3492
|
+
defaultCallingCode = _this$getCountryAndCa2[1];
|
|
3493
|
+
|
|
3494
|
+
this.defaultCountry = defaultCountry;
|
|
3495
|
+
this.defaultCallingCode = defaultCallingCode;
|
|
3496
|
+
this.reset();
|
|
3497
|
+
}
|
|
3498
|
+
|
|
3499
|
+
_createClass$5(AsYouType, [{
|
|
3500
|
+
key: "getCountryAndCallingCode",
|
|
3501
|
+
value: function getCountryAndCallingCode(optionsOrDefaultCountry) {
|
|
3502
|
+
// Set `defaultCountry` and `defaultCallingCode` options.
|
|
3503
|
+
var defaultCountry;
|
|
3504
|
+
var defaultCallingCode; // Turns out `null` also has type "object". Weird.
|
|
3505
|
+
|
|
3506
|
+
if (optionsOrDefaultCountry) {
|
|
3507
|
+
if (_typeof$1(optionsOrDefaultCountry) === 'object') {
|
|
3508
|
+
defaultCountry = optionsOrDefaultCountry.defaultCountry;
|
|
3509
|
+
defaultCallingCode = optionsOrDefaultCountry.defaultCallingCode;
|
|
3510
|
+
} else {
|
|
3511
|
+
defaultCountry = optionsOrDefaultCountry;
|
|
3512
|
+
}
|
|
3513
|
+
}
|
|
3514
|
+
|
|
3515
|
+
if (defaultCountry && !this.metadata.hasCountry(defaultCountry)) {
|
|
3516
|
+
defaultCountry = undefined;
|
|
3517
|
+
}
|
|
3518
|
+
|
|
3519
|
+
return [defaultCountry, defaultCallingCode];
|
|
3520
|
+
}
|
|
3521
|
+
/**
|
|
3522
|
+
* Inputs "next" phone number characters.
|
|
3523
|
+
* @param {string} text
|
|
3524
|
+
* @return {string} Formatted phone number characters that have been input so far.
|
|
3525
|
+
*/
|
|
3526
|
+
|
|
3527
|
+
}, {
|
|
3528
|
+
key: "input",
|
|
3529
|
+
value: function input(text) {
|
|
3530
|
+
var _this$parser$input = this.parser.input(text, this.state),
|
|
3531
|
+
digits = _this$parser$input.digits,
|
|
3532
|
+
justLeadingPlus = _this$parser$input.justLeadingPlus;
|
|
3533
|
+
|
|
3534
|
+
if (justLeadingPlus) {
|
|
3535
|
+
this.formattedOutput = '+';
|
|
3536
|
+
} else if (digits) {
|
|
3537
|
+
this.determineTheCountryIfNeeded(); // Match the available formats by the currently available leading digits.
|
|
3538
|
+
|
|
3539
|
+
if (this.state.nationalSignificantNumber) {
|
|
3540
|
+
this.formatter.narrowDownMatchingFormats(this.state);
|
|
3541
|
+
}
|
|
3542
|
+
|
|
3543
|
+
var formattedNationalNumber;
|
|
3544
|
+
|
|
3545
|
+
if (this.metadata.hasSelectedNumberingPlan()) {
|
|
3546
|
+
formattedNationalNumber = this.formatter.format(digits, this.state);
|
|
3547
|
+
}
|
|
3548
|
+
|
|
3549
|
+
if (formattedNationalNumber === undefined) {
|
|
3550
|
+
// See if another national (significant) number could be re-extracted.
|
|
3551
|
+
if (this.parser.reExtractNationalSignificantNumber(this.state)) {
|
|
3552
|
+
this.determineTheCountryIfNeeded(); // If it could, then re-try formatting the new national (significant) number.
|
|
3553
|
+
|
|
3554
|
+
var nationalDigits = this.state.getNationalDigits();
|
|
3555
|
+
|
|
3556
|
+
if (nationalDigits) {
|
|
3557
|
+
formattedNationalNumber = this.formatter.format(nationalDigits, this.state);
|
|
3558
|
+
}
|
|
3559
|
+
}
|
|
3560
|
+
}
|
|
3561
|
+
|
|
3562
|
+
this.formattedOutput = formattedNationalNumber ? this.getFullNumber(formattedNationalNumber) : this.getNonFormattedNumber();
|
|
3563
|
+
}
|
|
3564
|
+
|
|
3565
|
+
return this.formattedOutput;
|
|
3566
|
+
}
|
|
3567
|
+
}, {
|
|
3568
|
+
key: "reset",
|
|
3569
|
+
value: function reset() {
|
|
3570
|
+
var _this = this;
|
|
3571
|
+
|
|
3572
|
+
this.state = new AsYouTypeState({
|
|
3573
|
+
onCountryChange: function onCountryChange(country) {
|
|
3574
|
+
// Before version `1.6.0`, the official `AsYouType` formatter API
|
|
3575
|
+
// included the `.country` property of an `AsYouType` instance.
|
|
3576
|
+
// Since that property (along with the others) have been moved to
|
|
3577
|
+
// `this.state`, `this.country` property is emulated for compatibility
|
|
3578
|
+
// with the old versions.
|
|
3579
|
+
_this.country = country;
|
|
3580
|
+
},
|
|
3581
|
+
onCallingCodeChange: function onCallingCodeChange(country, callingCode) {
|
|
3582
|
+
_this.metadata.selectNumberingPlan(country, callingCode);
|
|
3583
|
+
|
|
3584
|
+
_this.formatter.reset(_this.metadata.numberingPlan, _this.state);
|
|
3585
|
+
|
|
3586
|
+
_this.parser.reset(_this.metadata.numberingPlan);
|
|
3587
|
+
}
|
|
3588
|
+
});
|
|
3589
|
+
this.formatter = new AsYouTypeFormatter({
|
|
3590
|
+
state: this.state,
|
|
3591
|
+
metadata: this.metadata
|
|
3592
|
+
});
|
|
3593
|
+
this.parser = new AsYouTypeParser({
|
|
3594
|
+
defaultCountry: this.defaultCountry,
|
|
3595
|
+
defaultCallingCode: this.defaultCallingCode,
|
|
3596
|
+
metadata: this.metadata,
|
|
3597
|
+
state: this.state,
|
|
3598
|
+
onNationalSignificantNumberChange: function onNationalSignificantNumberChange() {
|
|
3599
|
+
_this.determineTheCountryIfNeeded();
|
|
3600
|
+
|
|
3601
|
+
_this.formatter.reset(_this.metadata.numberingPlan, _this.state);
|
|
3602
|
+
}
|
|
3603
|
+
});
|
|
3604
|
+
this.state.reset(this.defaultCountry, this.defaultCallingCode);
|
|
3605
|
+
this.formattedOutput = '';
|
|
3606
|
+
return this;
|
|
3607
|
+
}
|
|
3608
|
+
/**
|
|
3609
|
+
* Returns `true` if the phone number is being input in international format.
|
|
3610
|
+
* In other words, returns `true` if and only if the parsed phone number starts with a `"+"`.
|
|
3611
|
+
* @return {boolean}
|
|
3612
|
+
*/
|
|
3613
|
+
|
|
3614
|
+
}, {
|
|
3615
|
+
key: "isInternational",
|
|
3616
|
+
value: function isInternational() {
|
|
3617
|
+
return this.state.international;
|
|
3618
|
+
}
|
|
3619
|
+
/**
|
|
3620
|
+
* Returns the "country calling code" part of the phone number.
|
|
3621
|
+
* Returns `undefined` if the number is not being input in international format.
|
|
3622
|
+
* Returns "country calling code" for "non-geographic" phone numbering plans too.
|
|
3623
|
+
* @return {string} [callingCode]
|
|
3624
|
+
*/
|
|
3625
|
+
|
|
3626
|
+
}, {
|
|
3627
|
+
key: "getCallingCode",
|
|
3628
|
+
value: function getCallingCode() {
|
|
3629
|
+
return this.state.callingCode;
|
|
3630
|
+
} // A legacy alias.
|
|
3631
|
+
|
|
3632
|
+
}, {
|
|
3633
|
+
key: "getCountryCallingCode",
|
|
3634
|
+
value: function getCountryCallingCode() {
|
|
3635
|
+
return this.getCallingCode();
|
|
3636
|
+
}
|
|
3637
|
+
/**
|
|
3638
|
+
* Returns a two-letter country code of the phone number.
|
|
3639
|
+
* Returns `undefined` for "non-geographic" phone numbering plans.
|
|
3640
|
+
* Returns `undefined` if no phone number has been input yet.
|
|
3641
|
+
* @return {string} [country]
|
|
3642
|
+
*/
|
|
3643
|
+
|
|
3644
|
+
}, {
|
|
3645
|
+
key: "getCountry",
|
|
3646
|
+
value: function getCountry() {
|
|
3647
|
+
var _this$state = this.state,
|
|
3648
|
+
digits = _this$state.digits,
|
|
3649
|
+
country = _this$state.country; // If no digits have been input yet,
|
|
3650
|
+
// then `this.country` is the `defaultCountry`.
|
|
3651
|
+
// Won't return the `defaultCountry` in such case.
|
|
3652
|
+
|
|
3653
|
+
if (!digits) {
|
|
3654
|
+
return;
|
|
3655
|
+
}
|
|
3656
|
+
|
|
3657
|
+
var countryCode = country;
|
|
3658
|
+
|
|
3659
|
+
return countryCode;
|
|
3660
|
+
}
|
|
3661
|
+
}, {
|
|
3662
|
+
key: "determineTheCountryIfNeeded",
|
|
3663
|
+
value: function determineTheCountryIfNeeded() {
|
|
3664
|
+
// Suppose a user enters a phone number in international format,
|
|
3665
|
+
// and there're several countries corresponding to that country calling code,
|
|
3666
|
+
// and a country has been derived from the number, and then
|
|
3667
|
+
// a user enters one more digit and the number is no longer
|
|
3668
|
+
// valid for the derived country, so the country should be re-derived
|
|
3669
|
+
// on every new digit in those cases.
|
|
3670
|
+
//
|
|
3671
|
+
// If the phone number is being input in national format,
|
|
3672
|
+
// then it could be a case when `defaultCountry` wasn't specified
|
|
3673
|
+
// when creating `AsYouType` instance, and just `defaultCallingCode` was specified,
|
|
3674
|
+
// and that "calling code" could correspond to a "non-geographic entity",
|
|
3675
|
+
// or there could be several countries corresponding to that country calling code.
|
|
3676
|
+
// In those cases, `this.country` is `undefined` and should be derived
|
|
3677
|
+
// from the number. Again, if country calling code is ambiguous, then
|
|
3678
|
+
// `this.country` should be re-derived with each new digit.
|
|
3679
|
+
//
|
|
3680
|
+
if (!this.state.country || this.isCountryCallingCodeAmbiguous()) {
|
|
3681
|
+
this.determineTheCountry();
|
|
3682
|
+
}
|
|
3683
|
+
} // Prepends `+CountryCode ` in case of an international phone number
|
|
3684
|
+
|
|
3685
|
+
}, {
|
|
3686
|
+
key: "getFullNumber",
|
|
3687
|
+
value: function getFullNumber(formattedNationalNumber) {
|
|
3688
|
+
var _this2 = this;
|
|
3689
|
+
|
|
3690
|
+
if (this.isInternational()) {
|
|
3691
|
+
var prefix = function prefix(text) {
|
|
3692
|
+
return _this2.formatter.getInternationalPrefixBeforeCountryCallingCode(_this2.state, {
|
|
3693
|
+
spacing: text ? true : false
|
|
3694
|
+
}) + text;
|
|
3695
|
+
};
|
|
3696
|
+
|
|
3697
|
+
var callingCode = this.state.callingCode;
|
|
3698
|
+
|
|
3699
|
+
if (!callingCode) {
|
|
3700
|
+
return prefix("".concat(this.state.getDigitsWithoutInternationalPrefix()));
|
|
3701
|
+
}
|
|
3702
|
+
|
|
3703
|
+
if (!formattedNationalNumber) {
|
|
3704
|
+
return prefix(callingCode);
|
|
3705
|
+
}
|
|
3706
|
+
|
|
3707
|
+
return prefix("".concat(callingCode, " ").concat(formattedNationalNumber));
|
|
3708
|
+
}
|
|
3709
|
+
|
|
3710
|
+
return formattedNationalNumber;
|
|
3711
|
+
}
|
|
3712
|
+
}, {
|
|
3713
|
+
key: "getNonFormattedNationalNumberWithPrefix",
|
|
3714
|
+
value: function getNonFormattedNationalNumberWithPrefix() {
|
|
3715
|
+
var _this$state2 = this.state,
|
|
3716
|
+
nationalSignificantNumber = _this$state2.nationalSignificantNumber,
|
|
3717
|
+
complexPrefixBeforeNationalSignificantNumber = _this$state2.complexPrefixBeforeNationalSignificantNumber,
|
|
3718
|
+
nationalPrefix = _this$state2.nationalPrefix;
|
|
3719
|
+
var number = nationalSignificantNumber;
|
|
3720
|
+
var prefix = complexPrefixBeforeNationalSignificantNumber || nationalPrefix;
|
|
3721
|
+
|
|
3722
|
+
if (prefix) {
|
|
3723
|
+
number = prefix + number;
|
|
3724
|
+
}
|
|
3725
|
+
|
|
3726
|
+
return number;
|
|
3727
|
+
}
|
|
3728
|
+
}, {
|
|
3729
|
+
key: "getNonFormattedNumber",
|
|
3730
|
+
value: function getNonFormattedNumber() {
|
|
3731
|
+
var nationalSignificantNumberMatchesInput = this.state.nationalSignificantNumberMatchesInput;
|
|
3732
|
+
return this.getFullNumber(nationalSignificantNumberMatchesInput ? this.getNonFormattedNationalNumberWithPrefix() : this.state.getNationalDigits());
|
|
3733
|
+
}
|
|
3734
|
+
}, {
|
|
3735
|
+
key: "getNonFormattedTemplate",
|
|
3736
|
+
value: function getNonFormattedTemplate() {
|
|
3737
|
+
var number = this.getNonFormattedNumber();
|
|
3738
|
+
|
|
3739
|
+
if (number) {
|
|
3740
|
+
return number.replace(/[\+\d]/g, DIGIT_PLACEHOLDER);
|
|
3741
|
+
}
|
|
3742
|
+
}
|
|
3743
|
+
}, {
|
|
3744
|
+
key: "isCountryCallingCodeAmbiguous",
|
|
3745
|
+
value: function isCountryCallingCodeAmbiguous() {
|
|
3746
|
+
var callingCode = this.state.callingCode;
|
|
3747
|
+
var countryCodes = this.metadata.getCountryCodesForCallingCode(callingCode);
|
|
3748
|
+
return countryCodes && countryCodes.length > 1;
|
|
3749
|
+
} // Determines the country of the phone number
|
|
3750
|
+
// entered so far based on the country phone code
|
|
3751
|
+
// and the national phone number.
|
|
3752
|
+
|
|
3753
|
+
}, {
|
|
3754
|
+
key: "determineTheCountry",
|
|
3755
|
+
value: function determineTheCountry() {
|
|
3756
|
+
this.state.setCountry(getCountryByCallingCode(this.isInternational() ? this.state.callingCode : this.defaultCallingCode, this.state.nationalSignificantNumber, this.metadata));
|
|
3757
|
+
}
|
|
3758
|
+
/**
|
|
3759
|
+
* Returns an instance of `PhoneNumber` class.
|
|
3760
|
+
* Will return `undefined` if no national (significant) number
|
|
3761
|
+
* digits have been entered so far, or if no `defaultCountry` has been
|
|
3762
|
+
* set and the user enters a phone number not in international format.
|
|
3763
|
+
*/
|
|
3764
|
+
|
|
3765
|
+
}, {
|
|
3766
|
+
key: "getNumber",
|
|
3767
|
+
value: function getNumber() {
|
|
3768
|
+
var _this$state3 = this.state,
|
|
3769
|
+
nationalSignificantNumber = _this$state3.nationalSignificantNumber,
|
|
3770
|
+
carrierCode = _this$state3.carrierCode;
|
|
3771
|
+
|
|
3772
|
+
if (this.isInternational()) {
|
|
3773
|
+
if (!this.state.callingCode) {
|
|
3774
|
+
return;
|
|
3775
|
+
}
|
|
3776
|
+
} else {
|
|
3777
|
+
if (!this.state.country && !this.defaultCallingCode) {
|
|
3778
|
+
return;
|
|
3779
|
+
}
|
|
3780
|
+
}
|
|
3781
|
+
|
|
3782
|
+
if (!nationalSignificantNumber) {
|
|
3783
|
+
return;
|
|
3784
|
+
}
|
|
3785
|
+
|
|
3786
|
+
var countryCode = this.getCountry();
|
|
3787
|
+
var callingCode = this.getCountryCallingCode() || this.defaultCallingCode;
|
|
3788
|
+
var phoneNumber = new PhoneNumber(countryCode || callingCode, nationalSignificantNumber, this.metadata.metadata);
|
|
3789
|
+
|
|
3790
|
+
if (carrierCode) {
|
|
3791
|
+
phoneNumber.carrierCode = carrierCode;
|
|
3792
|
+
} // Phone number extensions are not supported by "As You Type" formatter.
|
|
3793
|
+
|
|
3794
|
+
|
|
3795
|
+
return phoneNumber;
|
|
3796
|
+
}
|
|
3797
|
+
/**
|
|
3798
|
+
* Returns `true` if the phone number is "possible".
|
|
3799
|
+
* Is just a shortcut for `PhoneNumber.isPossible()`.
|
|
3800
|
+
* @return {boolean}
|
|
3801
|
+
*/
|
|
3802
|
+
|
|
3803
|
+
}, {
|
|
3804
|
+
key: "isPossible",
|
|
3805
|
+
value: function isPossible() {
|
|
3806
|
+
var phoneNumber = this.getNumber();
|
|
3807
|
+
|
|
3808
|
+
if (!phoneNumber) {
|
|
3809
|
+
return false;
|
|
3810
|
+
}
|
|
3811
|
+
|
|
3812
|
+
return phoneNumber.isPossible();
|
|
3813
|
+
}
|
|
3814
|
+
/**
|
|
3815
|
+
* Returns `true` if the phone number is "valid".
|
|
3816
|
+
* Is just a shortcut for `PhoneNumber.isValid()`.
|
|
3817
|
+
* @return {boolean}
|
|
3818
|
+
*/
|
|
3819
|
+
|
|
3820
|
+
}, {
|
|
3821
|
+
key: "isValid",
|
|
3822
|
+
value: function isValid() {
|
|
3823
|
+
var phoneNumber = this.getNumber();
|
|
3824
|
+
|
|
3825
|
+
if (!phoneNumber) {
|
|
3826
|
+
return false;
|
|
3827
|
+
}
|
|
3828
|
+
|
|
3829
|
+
return phoneNumber.isValid();
|
|
3830
|
+
}
|
|
3831
|
+
/**
|
|
3832
|
+
* @deprecated
|
|
3833
|
+
* This method is used in `react-phone-number-input/source/input-control.js`
|
|
3834
|
+
* in versions before `3.0.16`.
|
|
3835
|
+
*/
|
|
3836
|
+
|
|
3837
|
+
}, {
|
|
3838
|
+
key: "getNationalNumber",
|
|
3839
|
+
value: function getNationalNumber() {
|
|
3840
|
+
return this.state.nationalSignificantNumber;
|
|
3841
|
+
}
|
|
3842
|
+
/**
|
|
3843
|
+
* Returns the phone number characters entered by the user.
|
|
3844
|
+
* @return {string}
|
|
3845
|
+
*/
|
|
3846
|
+
|
|
3847
|
+
}, {
|
|
3848
|
+
key: "getChars",
|
|
3849
|
+
value: function getChars() {
|
|
3850
|
+
return (this.state.international ? '+' : '') + this.state.digits;
|
|
3851
|
+
}
|
|
3852
|
+
/**
|
|
3853
|
+
* Returns the template for the formatted phone number.
|
|
3854
|
+
* @return {string}
|
|
3855
|
+
*/
|
|
3856
|
+
|
|
3857
|
+
}, {
|
|
3858
|
+
key: "getTemplate",
|
|
3859
|
+
value: function getTemplate() {
|
|
3860
|
+
return this.formatter.getTemplate(this.state) || this.getNonFormattedTemplate() || '';
|
|
3861
|
+
}
|
|
3862
|
+
}]);
|
|
3863
|
+
|
|
3864
|
+
return AsYouType;
|
|
3865
|
+
}();
|
|
3866
|
+
|
|
3867
|
+
function AsYouType$1(country) {
|
|
3868
|
+
return AsYouType.call(this, country, metadata)
|
|
3869
|
+
}
|
|
3870
|
+
|
|
3871
|
+
AsYouType$1.prototype = Object.create(AsYouType.prototype, {});
|
|
3872
|
+
AsYouType$1.prototype.constructor = AsYouType$1;
|
|
3873
|
+
|
|
3874
|
+
exports.AsYouType = AsYouType$1;
|