@incodetech/core 2.3.2 → 2.4.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES.txt +1243 -3
- package/dist/Actor-DpTj5PFb.d.ts +1 -0
- package/dist/{BaseWasmProvider-Dyi6dKp1.d.ts → BaseWasmProvider-BL9wIRnN.d.ts} +2 -2
- package/dist/{FaceDetectionProvider-DtmtCKa9.esm.js → FaceDetectionProvider-BjTer9h3.esm.js} +126 -10
- package/dist/HttpRequestError-Bh0pNGSC.esm.js +35 -0
- package/dist/{IIdCaptureCapability-RNiFhvXR.d.ts → IIdCaptureCapability-DBsv9-7M.d.ts} +2 -2
- package/dist/{IWasmUtilCapability-CNWRl7jr.d.ts → IWasmUtilCapability-CPX0RGdQ.d.ts} +28 -5
- package/dist/{Manager-CQQ99QOI.d.ts → Manager-C9T5amUN.d.ts} +7 -1
- package/dist/{MotionSensorProvider-DyhbM4Si.esm.js → MotionSensorProvider-DYxh8TjR.esm.js} +1 -1
- package/dist/{ekycStateMachine-UeJRO8_p.esm.js → PhoneValidationProvider-SZiOS0jB.esm.js} +232 -827
- package/dist/{StreamCanvasCapture-_8gdW5Lk.d.ts → StreamCanvasCapture-DVmzJux5.d.ts} +2 -2
- package/dist/{safeStorage-BdU9_m2E.esm.js → WasmUtilProvider-CIdnE7Fx.esm.js} +95 -46
- package/dist/{addressSearch-DyHGgeX8.esm.js → addressSearch-BiYZjvp3.esm.js} +143 -4
- package/dist/{advanceableErrors-CpF2cBy6.esm.js → advanceableErrors-q_pfU3Cn.esm.js} +5 -4
- package/dist/ae-signature.d.ts +2 -2
- package/dist/ae-signature.esm.js +1 -1
- package/dist/antifraud.d.ts +1 -1
- package/dist/antifraud.esm.js +2 -2
- package/dist/{antifraudManager-BY36bS12.d.ts → antifraudManager-DbGCvlJs.d.ts} +2 -2
- package/dist/{antifraudManager-DNkw66oW.esm.js → antifraudManager-HL08jeDX.esm.js} +3 -3
- package/dist/{antifraudStateMachine-DBeq47D2.esm.js → antifraudStateMachine-DoJVzblM.esm.js} +3 -3
- package/dist/{apiError-CmGEmaGU.esm.js → apiError-DcSWedC6.esm.js} +2 -1
- package/dist/authentication.d.ts +3 -3
- package/dist/authentication.esm.js +2 -2
- package/dist/{authenticationManager-CboRCl_N.d.ts → authenticationManager-CANv5-W5.d.ts} +2 -8
- package/dist/{authenticationManager-BFjSjtQ_.esm.js → authenticationManager-SaiAxqvS.esm.js} +6 -6
- package/dist/{authenticationStateMachine-Dfo34ZiI.esm.js → authenticationStateMachine-CHSxmV7z.esm.js} +5 -6
- package/dist/avatar.d.ts +1 -1
- package/dist/{backCameraStream-B0-YgP_y.esm.js → backCameraStream-CMvXj4X4.esm.js} +1 -1
- package/dist/camera.esm.js +1 -1
- package/dist/certificate-issuance.d.ts +1 -1
- package/dist/certificate-issuance.esm.js +2 -2
- package/dist/{certificateIssuanceManager-C3-CI0_s.esm.js → certificateIssuanceManager-CMg4SgL4.esm.js} +3 -3
- package/dist/{certificateIssuanceManager-DCgEidHz.d.ts → certificateIssuanceManager-Dr8A4Lgr.d.ts} +2 -3
- package/dist/{certificateIssuanceStateMachine-CxqS_nD-.esm.js → certificateIssuanceStateMachine-Cs64QmYH.esm.js} +4 -4
- package/dist/consent.d.ts +1 -1
- package/dist/consent.esm.js +2 -2
- package/dist/{consentManager-B6E1XJDw.esm.js → consentManager-CjrxY737.esm.js} +3 -3
- package/dist/{consentManager-2h_w6wFc.d.ts → consentManager-DgzWQpAR.d.ts} +6 -7
- package/dist/{consentStateMachine-DTSfdGiW.esm.js → consentStateMachine-BCj5Jb3g.esm.js} +3 -3
- package/dist/{createCameraCycleOwnership-DnwTl1ad.esm.js → createCameraCycleOwnership-kdlhkmmY.esm.js} +71 -65
- package/dist/{createFaceAvatar-BlcTYgJv.d.ts → createFaceAvatar-DXgmQmQy.d.ts} +1 -1
- package/dist/cross-document-data-match.d.ts +1 -1
- package/dist/cross-document-data-match.esm.js +1 -1
- package/dist/{crossDocumentDataMatchManager-9XhFVZ5S.esm.js → crossDocumentDataMatchManager-BHnGRsto.esm.js} +4 -4
- package/dist/{crossDocumentDataMatchManager-Dq8Z3SOg.d.ts → crossDocumentDataMatchManager-yCWCOzcU.d.ts} +2 -2
- package/dist/curp-validation.d.ts +1 -1
- package/dist/curp-validation.esm.js +2 -2
- package/dist/{curpValidationManager-DNuZn9fn.d.ts → curpValidationManager-B-1EZbP_.d.ts} +3 -3
- package/dist/{curpValidationManager-DbIMYFcJ.esm.js → curpValidationManager-DBNIn8BF.esm.js} +15 -22
- package/dist/{curpValidationStateMachine-g5kMfuLj.esm.js → curpValidationStateMachine-DAxImy8p.esm.js} +4 -4
- package/dist/custom-fields.d.ts +1 -1
- package/dist/custom-fields.esm.js +1 -1
- package/dist/custom-watchlist.d.ts +1 -1
- package/dist/custom-watchlist.esm.js +2 -2
- package/dist/{customFieldsManager-CzWZTkW-.esm.js → customFieldsManager-BV6UyLFV.esm.js} +4 -4
- package/dist/{customFieldsManager-8-W2KY4n.d.ts → customFieldsManager-CF-cO8ap.d.ts} +2 -2
- package/dist/{customWatchlistManager-DWTED5Ur.esm.js → customWatchlistManager-DML0UPzf.esm.js} +3 -3
- package/dist/{customWatchlistManager-PBWHr_oM.d.ts → customWatchlistManager-DolUswyR.d.ts} +2 -2
- package/dist/{customWatchlistStateMachine-DOQou6TW.esm.js → customWatchlistStateMachine-D9gI5uu7.esm.js} +3 -3
- package/dist/deepsightLoader-DvfAYnzg.esm.js +55 -0
- package/dist/{deepsightLoader-v-dLejS-.esm.js → deepsightService-DLGO9yv1.esm.js} +51 -56
- package/dist/device.esm.js +1 -1
- package/dist/document-capture.d.ts +2 -2
- package/dist/document-capture.esm.js +2 -2
- package/dist/{documentCaptureManager-BRPxqYD2.esm.js → documentCaptureManager-C9XUnYU6.esm.js} +17 -18
- package/dist/{documentCaptureManager-lEtCM320.d.ts → documentCaptureManager-DkyDtm3Y.d.ts} +11 -34
- package/dist/{documentCaptureStateMachine-D312sSIu.esm.js → documentCaptureStateMachine-BHDsCfhL.esm.js} +55 -58
- package/dist/dynamic-forms.d.ts +2 -2
- package/dist/dynamic-forms.esm.js +2 -2
- package/dist/{dynamicFormsManager-C-9Jhnd3.esm.js → dynamicFormsManager-5uIXobxi.esm.js} +3 -3
- package/dist/{dynamicFormsManager-D5R_uxLQ.d.ts → dynamicFormsManager-C0dHs1ty.d.ts} +3 -3
- package/dist/{dynamicFormsStateMachine-DGI_F2PP.esm.js → dynamicFormsStateMachine-DQmok084.esm.js} +4 -4
- package/dist/ekyb.d.ts +5 -5
- package/dist/ekyb.esm.js +3 -3
- package/dist/{ekybManager-BwRuGAwt.d.ts → ekybManager-BaZ_7CEu.d.ts} +4 -4
- package/dist/{ekybManager-DeoMcZEz.esm.js → ekybManager-CazShiQz.esm.js} +23 -27
- package/dist/{ekybStateMachine-D1IJ1Z72.esm.js → ekybStateMachine-hstiCNmW.esm.js} +338 -13
- package/dist/ekyc.d.ts +2 -2
- package/dist/ekyc.esm.js +3 -3
- package/dist/{ekycManager-BX2d46FY.esm.js → ekycManager-BdJRUsz0.esm.js} +29 -36
- package/dist/{ekycManager-DLzDuBzI.d.ts → ekycManager-DW-ynodd.d.ts} +3 -3
- package/dist/ekycStateMachine-x6Klot8g.esm.js +1444 -0
- package/dist/{ekycUtils-D6wfSpPN.esm.js → ekycUtils-zY8CdKJL.esm.js} +53 -3
- package/dist/electronic-signature.d.ts +1 -1
- package/dist/electronic-signature.esm.js +1 -1
- package/dist/{electronicSignatureManager-yYUc30na.esm.js → electronicSignatureManager-Bc8spG8p.esm.js} +10 -10
- package/dist/{electronicSignatureManager-Ds-KEVTq.d.ts → electronicSignatureManager-DTSLOvKR.d.ts} +2 -3
- package/dist/email.d.ts +1 -1
- package/dist/email.esm.js +2 -2
- package/dist/{emailManager-bR1N5rV_.esm.js → emailManager-CtlKRRaR.esm.js} +20 -26
- package/dist/{emailManager-CADXW_9X.d.ts → emailManager-Dy6omJVp.d.ts} +2 -2
- package/dist/{emailStateMachine-Bc_6oIYw.esm.js → emailStateMachine-5Neq3rE5.esm.js} +4 -4
- package/dist/{endpoints-B-3Q-LUw.esm.js → endpoints-DHzlkQNe.esm.js} +2 -0
- package/dist/{events-ijlbX_Wx.esm.js → events-CAgFE-k3.esm.js} +19 -7
- package/dist/events.d.ts +3 -2
- package/dist/events.esm.js +1 -1
- package/dist/extensibility.d.ts +38 -38
- package/dist/extensibility.esm.js +36 -36
- package/dist/{externalFetch-BKBThAUC.esm.js → externalFetch-DrR9xshk.esm.js} +3 -2
- package/dist/face-match.d.ts +1 -1
- package/dist/face-match.esm.js +2 -2
- package/dist/{faceCaptureManagerFactory-m-7ae67q.d.ts → faceCaptureManagerFactory-jKQ2QtY-.d.ts} +11 -51
- package/dist/{faceCaptureManagerFactory-B6i9QcAk.esm.js → faceCaptureManagerFactory-uFm1AcaY.esm.js} +19 -54
- package/dist/{faceCaptureSetup-DU1mjRr6.esm.js → faceCaptureSetup-Cu2wabzo.esm.js} +99 -395
- package/dist/{faceMatchManager-Bmv0HzuY.esm.js → faceMatchManager-9Nj9aPci.esm.js} +3 -3
- package/dist/{faceMatchManager-BnvrZM2F.d.ts → faceMatchManager-DIgG-UFS.d.ts} +1 -2
- package/dist/{faceMatchStateMachine-mRIHQ3dA.esm.js → faceMatchStateMachine-B9ZUnlyU.esm.js} +6 -4
- package/dist/{feature-management-C8CuN0os.esm.js → feature-management-BTbYruNe.esm.js} +3 -3
- package/dist/feature-management.esm.js +1 -1
- package/dist/field-comparison.d.ts +2 -2
- package/dist/field-comparison.esm.js +1 -1
- package/dist/{fieldComparisonManager-CBvEGxFx.d.ts → fieldComparisonManager-CUX4gza2.d.ts} +6 -3
- package/dist/{fieldComparisonManager-CC-klG0h.esm.js → fieldComparisonManager-Dk38hXZP.esm.js} +35 -17
- package/dist/fiscal-qr.d.ts +1 -1
- package/dist/fiscal-qr.esm.js +1 -1
- package/dist/{fiscalQrManager-B1STmT6z.d.ts → fiscalQrManager-D0Iy7EKR.d.ts} +2 -2
- package/dist/fiscalQrManager-DmBkQfs0.esm.js +6798 -0
- package/dist/flow-events.d.ts +1 -1
- package/dist/flow.d.ts +14 -13
- package/dist/flow.esm.js +14 -14
- package/dist/{flowCompletionService-DccgtDnm.esm.js → flowCompletionService-xnn_SlJU.esm.js} +2 -2
- package/dist/{flowServices-CdsWsppG.esm.js → flowServices-DA64AEZC.esm.js} +11 -7
- package/dist/geolocation.d.ts +1 -1
- package/dist/geolocation.esm.js +2 -2
- package/dist/{geolocationManager-CGHBxtMb.esm.js → geolocationManager-CqNLY45e.esm.js} +6 -7
- package/dist/{geolocationManager-Cz744E5S.d.ts → geolocationManager-Dn24g1fl.d.ts} +2 -3
- package/dist/{geolocationStateMachine-CdEb1Gn0.esm.js → geolocationStateMachine-D-cQi7ar.esm.js} +4 -4
- package/dist/{getDeviceClass-5NYZg9s6.esm.js → getDeviceClass-bsWdEDxP.esm.js} +1 -1
- package/dist/{getParsedUserAgent-B2iFDql1.esm.js → getParsedUserAgent-DhQPeKqw.esm.js} +1 -1
- package/dist/government-validation.d.ts +1 -1
- package/dist/government-validation.esm.js +2 -2
- package/dist/{governmentValidationManager-D02vT4yY.d.ts → governmentValidationManager-B82zOut8.d.ts} +3 -3
- package/dist/{governmentValidationManager-CacFOtKO.esm.js → governmentValidationManager-CP0SiOOe.esm.js} +3 -3
- package/dist/{governmentValidationStateMachine-CoaZOSTP.esm.js → governmentValidationStateMachine-C3YQ8yCZ.esm.js} +3 -3
- package/dist/home.d.ts +3 -26
- package/dist/home.esm.js +2 -2
- package/dist/id-ocr.d.ts +1 -1
- package/dist/id-ocr.esm.js +2 -2
- package/dist/id-selfie-flow.d.ts +6 -9
- package/dist/id-selfie-flow.esm.js +23 -28
- package/dist/id-verification.d.ts +1 -1
- package/dist/id-verification.esm.js +2 -2
- package/dist/id.d.ts +4 -4
- package/dist/id.esm.js +4 -205
- package/dist/{idCaptureDefaults-Dl64Trv5.esm.js → idCaptureDefaults-CBg73RnV.esm.js} +8 -5
- package/dist/{idCaptureManager-BHwL2Z0V.d.ts → idCaptureManager-BY97SRCV.d.ts} +242 -98
- package/dist/{idCaptureManager-BNmVJQkd.esm.js → idCaptureManager-D4V8vXtY.esm.js} +276 -210
- package/dist/{idCaptureServices-dtDG2HXS.esm.js → idCaptureServices-DJ33k3-p.esm.js} +21 -39
- package/dist/{idCaptureStateMachine-BbiZD3uf.esm.js → idCaptureStateMachine-PJt0yzom.esm.js} +989 -872
- package/dist/{idOcrManager-CFlDwUvN.d.ts → idOcrManager-BTdHlJ9D.d.ts} +2 -3
- package/dist/{idOcrManager-ByWuQ4ej.esm.js → idOcrManager-DxoCesYP.esm.js} +3 -3
- package/dist/{idOcrStateMachine-Bt_abXQQ.esm.js → idOcrStateMachine-kPn7DB2I.esm.js} +3 -3
- package/dist/{idVerificationManager-BB4Pj_N6.d.ts → idVerificationManager-BJapZfpy.d.ts} +2 -3
- package/dist/{idVerificationManager-DT42c77H.esm.js → idVerificationManager-CDhRUU5n.esm.js} +3 -3
- package/dist/{idVerificationStateMachine-DbDVIh9t.esm.js → idVerificationStateMachine-0HTVVxse.esm.js} +3 -3
- package/dist/identity-reuse.d.ts +2 -2
- package/dist/identity-reuse.esm.js +2 -2
- package/dist/{identityReuseManager-yG3acUrQ.esm.js → identityReuseManager-BleUi6TK.esm.js} +26 -13
- package/dist/{identityReuseManager-BXEBBI3N.d.ts → identityReuseManager-ooAbp6Kc.d.ts} +164 -46
- package/dist/{identityReuseStateMachine-BhAkuIra.esm.js → identityReuseStateMachine-BrBUpfn5.esm.js} +89 -23
- package/dist/{index-CeaC32qI.d.ts → index-DfEuu-Ew.d.ts} +2 -2
- package/dist/index-DpTj5PFb.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/{invokeOnCaptureCallback-BjzPjJ_p.esm.js → invokeOnCaptureCallback-BW7V3vub.esm.js} +1 -1
- package/dist/lamejs-B6TzhU5q.esm.js +10 -0
- package/dist/mandatory-consent.d.ts +2 -2
- package/dist/mandatory-consent.esm.js +2 -2
- package/dist/{mandatoryConsentManager-7dI0D08q.esm.js → mandatoryConsentManager-CX_Dyht7.esm.js} +3 -3
- package/dist/{mandatoryConsentManager-DFVm_i2B.d.ts → mandatoryConsentManager-TkX57U6f.d.ts} +3 -4
- package/dist/{mandatoryConsentStateMachine-DC5Mo6M1.esm.js → mandatoryConsentStateMachine-CoaSB7P7.esm.js} +3 -3
- package/dist/{multipartRecordingService-mwKFTlhR.esm.js → multipartRecordingService-DbeQpXdU.esm.js} +2 -2
- package/dist/{permissionGuards-D6TfVop2.esm.js → permissionGuards-Bf4LbHjC.esm.js} +1 -1
- package/dist/{permissionServices-EY3_Vx6c.esm.js → permissionServices-d2UW0r_L.esm.js} +34 -3
- package/dist/phone-number.d.ts +24 -0
- package/dist/phone-number.esm.js +1922 -0
- package/dist/phone.d.ts +1 -1
- package/dist/phone.esm.js +2 -2
- package/dist/{phoneManager-IjhSv5XS.esm.js → phoneManager-BGBcpqsk.esm.js} +31 -22
- package/dist/{phoneManager-BBU8Lq0O.d.ts → phoneManager-BO-LTih5.d.ts} +16 -3
- package/dist/{phoneStateMachine-CXdXufKg.esm.js → phoneStateMachine-CEm2y7yG.esm.js} +39 -20
- package/dist/phoneValidation-DnBcNUNh.esm.js +48 -0
- package/dist/qe-signature.d.ts +2 -2
- package/dist/qe-signature.esm.js +1 -1
- package/dist/redirect-to-mobile.d.ts +1 -1
- package/dist/redirect-to-mobile.esm.js +2 -2
- package/dist/{redirectToMobileManager-FLEWJtv8.esm.js → redirectToMobileManager-B1yQHFLu.esm.js} +4 -4
- package/dist/{redirectToMobileManager-BD2PvT5B.d.ts → redirectToMobileManager-CVsvpVbQ.d.ts} +2 -2
- package/dist/{redirectToMobileStateMachine-CSWWgUTO.esm.js → redirectToMobileStateMachine--Sr9NEVT.esm.js} +5 -5
- package/dist/{rolldown-runtime-FDOR9p9I.esm.js → rolldown-runtime-B-1-B7_t.esm.js} +10 -1
- package/dist/{runChildModule-B2Y_hlix.esm.js → runChildModule-vdxQMCmO.esm.js} +13 -12
- package/dist/safeStorage-UxDrnjwa.esm.js +35 -0
- package/dist/{sdkVersion-N1UiyFiY.esm.js → sdkVersion-F5YZbjip.esm.js} +1 -1
- package/dist/selfie.d.ts +4 -4
- package/dist/selfie.esm.js +12 -12
- package/dist/selfieErrorUtils-D-tsgEuX.esm.js +21 -0
- package/dist/{selfieManager-BSZG891S.d.ts → selfieManager-1J0IEyFq.d.ts} +2 -8
- package/dist/{selfieManager-AS6wfUvZ.esm.js → selfieManager-26pENXxw.esm.js} +6 -6
- package/dist/selfieStateMachine-BhfKsl3I.esm.js +41 -0
- package/dist/{session-BESZc05k.esm.js → session-Bu7djCsj.esm.js} +5 -5
- package/dist/session.d.ts +15 -3
- package/dist/session.esm.js +30 -5
- package/dist/sessionInitializer-jxbfCnE-.esm.js +974 -0
- package/dist/{setup-BuPbxpwF.esm.js → setup-C38QkrSP.esm.js} +232 -112
- package/dist/{setup-Cyko6cAn.d.ts → setup-lgkQ8dJW.d.ts} +20 -11
- package/dist/signature.d.ts +1 -1
- package/dist/signature.esm.js +2 -2
- package/dist/{signatureManager-DGBSWz2_.d.ts → signatureManager-BpVt_Jv7.d.ts} +2 -2
- package/dist/{signatureManager-B72np4ZO.esm.js → signatureManager-qqXyH93e.esm.js} +7 -11
- package/dist/{signatureStateMachine-ce_XMA3l.esm.js → signatureStateMachine-BkRSrkKp.esm.js} +3 -3
- package/dist/splitTrackedName-3zJRd2RD.esm.js +19 -0
- package/dist/{src-35ekGRzK.esm.js → src-DJAJjRYQ.esm.js} +1 -1
- package/dist/{stats-CZcy2J53.esm.js → stats-DmG_tkGk.esm.js} +1 -1
- package/dist/stats.esm.js +1 -1
- package/dist/{sessionInitializer-CnhAkMUN.esm.js → thumbmark.esm-CRc0cYvz.esm.js} +33 -776
- package/dist/{trueSightService-M5VpCo96.esm.js → trueSightService-BWgRVGIT.esm.js} +893 -900
- package/dist/trust-graph.d.ts +1 -2
- package/dist/trust-graph.esm.js +2 -2
- package/dist/{types-C0oWGUzg.d.ts → types-0L-eFDmr.d.ts} +1 -1
- package/dist/{types-C1g9itHE.d.ts → types-BGXxRwQM.d.ts} +6 -7
- package/dist/{types-BfgmV7s7.d.ts → types-BQA7lRDV.d.ts} +1 -1
- package/dist/{types-CxGdmzxa.d.ts → types-BvFmYX5c.d.ts} +1 -1
- package/dist/{types-Cx-1zo-i.d.ts → types-BvLo3U4u.d.ts} +1 -1
- package/dist/types-C71Zo6vl.d.ts +6 -0
- package/dist/{types-DEGVXwsk2.d.ts → types-CyPUIpzf.d.ts} +110 -62
- package/dist/{types-Bx-BWveD.d.ts → types-DTYr9pCB.d.ts} +1 -1
- package/dist/{types-BjSly8cp.d.ts → types-DUnFZ08M.d.ts} +1 -1
- package/dist/{types-ESdtnHtg.d.ts → types-zpO4fU6a.d.ts} +3 -4
- package/dist/{urlUtils-D6phjq1-.esm.js → urlUtils-6jsE6rKp.esm.js} +9 -1
- package/dist/video-selfie.d.ts +6 -9
- package/dist/video-selfie.esm.js +1386 -1344
- package/dist/{videoSelfieCameraWarmer-q9ZjvXu9.esm.js → videoSelfieCameraWarmer-C366RKqu.esm.js} +11 -11
- package/dist/{videoSelfieFlowModuleMachine-BUe2uACW.esm.js → videoSelfieFlowModuleMachine-BCFVHBQ1.esm.js} +1 -1
- package/dist/{videoSelfieStepDetector-ChYgFM15.d.ts → videoSelfieStepDetector-C5QHOvWb.d.ts} +4 -4
- package/dist/videoTrimByCopy-BFfAiNpv.esm.js +15901 -0
- package/dist/{warmup-Cis2p6O0.d.ts → warmup-BUPPRAA1.d.ts} +7 -0
- package/dist/{warmup-ChDwHSel.esm.js → warmup-DMtbyb2l.esm.js} +27 -9
- package/dist/wasm.d.ts +2 -2
- package/dist/wasm.esm.js +4 -4
- package/dist/{wasmDsFlagSync-DYrLUEII.esm.js → wasmDsFlagSync-BXCGqP48.esm.js} +1 -1
- package/dist/{wasmWebClient-B7baE-Wf.esm.js → wasmWebClient-kbYZ2sxw.esm.js} +259 -20
- package/dist/watchlist-for-business.d.ts +1 -1
- package/dist/watchlist-for-business.esm.js +2 -2
- package/dist/watchlist.d.ts +1 -1
- package/dist/watchlist.esm.js +2 -2
- package/dist/{watchlistForBusinessManager-CsnJnG-C.d.ts → watchlistForBusinessManager-B3GDPZrr.d.ts} +2 -2
- package/dist/{watchlistForBusinessManager-CIMkpEhu.esm.js → watchlistForBusinessManager-BvF4jK3S.esm.js} +7 -5
- package/dist/{watchlistForBusinessStateMachine-CJ-MvUre.esm.js → watchlistForBusinessStateMachine-121XK-Et.esm.js} +3 -3
- package/dist/{watchlistManager-CixcLNDT.esm.js → watchlistManager-CNWEOYSq.esm.js} +3 -3
- package/dist/{watchlistManager-DLXef90v.d.ts → watchlistManager-DJQOd8Pw.d.ts} +2 -2
- package/dist/{watchlistStateMachine-CBqk2w-h.esm.js → watchlistStateMachine-Dgfm42w2.esm.js} +3 -3
- package/dist/workflow.d.ts +34 -5
- package/dist/workflow.esm.js +64 -46
- package/dist/{xstate-actors.esm-BXeQ-Ucz.esm.js → xstate-actors.esm-8Gzepa_A.esm.js} +1 -1
- package/dist/{xstate.esm-BuFLFuzz.esm.js → xstate.esm-DSajW7CJ.esm.js} +24 -10
- package/package.json +13 -5
- package/dist/Actor-iTq7YY48.d.ts +0 -1
- package/dist/StateMachine-EDpYWy0i.d.ts +0 -6
- package/dist/fiscalQrManager-DbCVMIBx.esm.js +0 -34143
- package/dist/index-B8weJxmL.d.ts +0 -1
- package/dist/selfieErrorUtils-UiQ46EBa.esm.js +0 -116
- package/dist/selfieStateMachine-DY7vJVNY.esm.js +0 -71
- package/dist/types-BN5RPPIZ.esm.js +0 -34
- package/dist/types-Bt9RuRqt.d.ts +0 -6
- package/dist/virtualCameraCheck-Cjab7FTI.esm.js +0 -48
- /package/dist/{types-BSBzhHRH.d.ts → types-BSBzhHRH2.d.ts} +0 -0
|
@@ -0,0 +1,1922 @@
|
|
|
1
|
+
import { C as metadata_min_json_default, S as withMetadataArgument, _ as VALID_PUNCTUATION, a as PhoneNumber, b as getCountryCallingCode$1, c as applyInternationalSeparatorStyle, d as getCountryByCallingCode, f as getCountryByNationalNumber, g as VALID_DIGITS, h as PLUS_CHARS, i as parseDigits, l as extractCountryCallingCode, m as stripIddPrefix, o as FIRST_GROUP_PATTERN, p as extractNationalNumberFromPossiblyIncompleteNumber, r as parsePhoneNumber$1, s as formatNationalNumberUsingFormat, t as PhoneValidationProvider, u as extractCountryCallingCodeFromInternationalNumberWithoutPlusSign, v as checkNumberLength, x as isObject, y as Metadata } from "./PhoneValidationProvider-SZiOS0jB.esm.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/AsYouTypeState.js
|
|
3
|
+
function _typeof$5(o) {
|
|
4
|
+
"@babel/helpers - typeof";
|
|
5
|
+
return _typeof$5 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
6
|
+
return typeof o;
|
|
7
|
+
} : function(o) {
|
|
8
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
9
|
+
}, _typeof$5(o);
|
|
10
|
+
}
|
|
11
|
+
function _classCallCheck$5(a, n) {
|
|
12
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
13
|
+
}
|
|
14
|
+
function _defineProperties$5(e, r) {
|
|
15
|
+
for (var t = 0; t < r.length; t++) {
|
|
16
|
+
var o = r[t];
|
|
17
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$5(o.key), o);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function _createClass$5(e, r, t) {
|
|
21
|
+
return r && _defineProperties$5(e.prototype, r), t && _defineProperties$5(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
22
|
+
}
|
|
23
|
+
function _toPropertyKey$5(t) {
|
|
24
|
+
var i = _toPrimitive$5(t, "string");
|
|
25
|
+
return "symbol" == _typeof$5(i) ? i : i + "";
|
|
26
|
+
}
|
|
27
|
+
function _toPrimitive$5(t, r) {
|
|
28
|
+
if ("object" != _typeof$5(t) || !t) return t;
|
|
29
|
+
var e = t[Symbol.toPrimitive];
|
|
30
|
+
if (void 0 !== e) {
|
|
31
|
+
var i = e.call(t, r || "default");
|
|
32
|
+
if ("object" != _typeof$5(i)) return i;
|
|
33
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
34
|
+
}
|
|
35
|
+
return ("string" === r ? String : Number)(t);
|
|
36
|
+
}
|
|
37
|
+
var AsYouTypeState = /*#__PURE__*/ function() {
|
|
38
|
+
function AsYouTypeState(_ref) {
|
|
39
|
+
var onCountryChange = _ref.onCountryChange, onCallingCodeChange = _ref.onCallingCodeChange;
|
|
40
|
+
_classCallCheck$5(this, AsYouTypeState);
|
|
41
|
+
this.onCountryChange = onCountryChange;
|
|
42
|
+
this.onCallingCodeChange = onCallingCodeChange;
|
|
43
|
+
}
|
|
44
|
+
return _createClass$5(AsYouTypeState, [
|
|
45
|
+
{
|
|
46
|
+
key: "reset",
|
|
47
|
+
value: function reset(_ref2) {
|
|
48
|
+
var country = _ref2.country, callingCode = _ref2.callingCode;
|
|
49
|
+
this.international = false;
|
|
50
|
+
this.missingPlus = false;
|
|
51
|
+
this.IDDPrefix = void 0;
|
|
52
|
+
this.callingCode = void 0;
|
|
53
|
+
this.digits = "";
|
|
54
|
+
this.resetNationalSignificantNumber();
|
|
55
|
+
this.initCountryAndCallingCode(country, callingCode);
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
key: "resetNationalSignificantNumber",
|
|
60
|
+
value: function resetNationalSignificantNumber() {
|
|
61
|
+
this.nationalSignificantNumber = this.getNationalDigits();
|
|
62
|
+
this.nationalSignificantNumberIsModified = false;
|
|
63
|
+
this.nationalPrefix = void 0;
|
|
64
|
+
this.carrierCode = void 0;
|
|
65
|
+
this.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix = void 0;
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
key: "update",
|
|
70
|
+
value: function update(properties) {
|
|
71
|
+
for (var _i = 0, _Object$keys = Object.keys(properties); _i < _Object$keys.length; _i++) {
|
|
72
|
+
var key = _Object$keys[_i];
|
|
73
|
+
this[key] = properties[key];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
key: "initCountryAndCallingCode",
|
|
79
|
+
value: function initCountryAndCallingCode(country, callingCode) {
|
|
80
|
+
this.setCountry(country);
|
|
81
|
+
this.setCallingCode(callingCode);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
key: "setCountry",
|
|
86
|
+
value: function setCountry(country) {
|
|
87
|
+
this.country = country;
|
|
88
|
+
this.onCountryChange(country);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
key: "setCallingCode",
|
|
93
|
+
value: function setCallingCode(callingCode) {
|
|
94
|
+
this.callingCode = callingCode;
|
|
95
|
+
this.onCallingCodeChange(callingCode, this.country);
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
key: "startInternationalNumber",
|
|
100
|
+
value: function startInternationalNumber(country, callingCode) {
|
|
101
|
+
this.international = true;
|
|
102
|
+
this.initCountryAndCallingCode(country, callingCode);
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
key: "appendDigits",
|
|
107
|
+
value: function appendDigits(nextDigits) {
|
|
108
|
+
this.digits += nextDigits;
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
key: "appendNationalSignificantNumberDigits",
|
|
113
|
+
value: function appendNationalSignificantNumberDigits(nextDigits) {
|
|
114
|
+
this.nationalSignificantNumber += nextDigits;
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
key: "getNationalDigits",
|
|
119
|
+
value: function getNationalDigits() {
|
|
120
|
+
if (this.international) return this.digits.slice((this.IDDPrefix ? this.IDDPrefix.length : 0) + (this.callingCode ? this.callingCode.length : 0));
|
|
121
|
+
return this.digits;
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
key: "getDigitsWithoutInternationalPrefix",
|
|
126
|
+
value: function getDigitsWithoutInternationalPrefix() {
|
|
127
|
+
if (this.international) {
|
|
128
|
+
if (this.IDDPrefix) return this.digits.slice(this.IDDPrefix.length);
|
|
129
|
+
}
|
|
130
|
+
return this.digits;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
]);
|
|
134
|
+
}();
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.util.js
|
|
137
|
+
function _createForOfIteratorHelperLoose$2(r, e) {
|
|
138
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
139
|
+
if (t) return (t = t.call(r)).next.bind(t);
|
|
140
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray$4(r)) || e && r && "number" == typeof r.length) {
|
|
141
|
+
t && (r = t);
|
|
142
|
+
var o = 0;
|
|
143
|
+
return function() {
|
|
144
|
+
return o >= r.length ? { done: !0 } : {
|
|
145
|
+
done: !1,
|
|
146
|
+
value: r[o++]
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
151
|
+
}
|
|
152
|
+
function _unsupportedIterableToArray$4(r, a) {
|
|
153
|
+
if (r) {
|
|
154
|
+
if ("string" == typeof r) return _arrayLikeToArray$4(r, a);
|
|
155
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
156
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$4(r, a) : void 0;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function _arrayLikeToArray$4(r, a) {
|
|
160
|
+
(null == a || a > r.length) && (a = r.length);
|
|
161
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
162
|
+
return n;
|
|
163
|
+
}
|
|
164
|
+
var DIGIT_PLACEHOLDER_MATCHER = /* @__PURE__ */ new RegExp("x");
|
|
165
|
+
function repeat(string, times) {
|
|
166
|
+
if (times < 1) return "";
|
|
167
|
+
var result = "";
|
|
168
|
+
while (times > 1) {
|
|
169
|
+
if (times & 1) result += string;
|
|
170
|
+
times >>= 1;
|
|
171
|
+
string += string;
|
|
172
|
+
}
|
|
173
|
+
return result + string;
|
|
174
|
+
}
|
|
175
|
+
function cutAndStripNonPairedParens(string, cutBeforeIndex) {
|
|
176
|
+
if (string[cutBeforeIndex] === ")") cutBeforeIndex++;
|
|
177
|
+
return stripNonPairedParens(string.slice(0, cutBeforeIndex));
|
|
178
|
+
}
|
|
179
|
+
function stripNonPairedParens(string) {
|
|
180
|
+
var dangling_braces = [];
|
|
181
|
+
var i = 0;
|
|
182
|
+
while (i < string.length) {
|
|
183
|
+
if (string[i] === "(") dangling_braces.push(i);
|
|
184
|
+
else if (string[i] === ")") dangling_braces.pop();
|
|
185
|
+
i++;
|
|
186
|
+
}
|
|
187
|
+
var start = 0;
|
|
188
|
+
var cleared_string = "";
|
|
189
|
+
dangling_braces.push(string.length);
|
|
190
|
+
for (var _i = 0, _dangling_braces = dangling_braces; _i < _dangling_braces.length; _i++) {
|
|
191
|
+
var index = _dangling_braces[_i];
|
|
192
|
+
cleared_string += string.slice(start, index);
|
|
193
|
+
start = index + 1;
|
|
194
|
+
}
|
|
195
|
+
return cleared_string;
|
|
196
|
+
}
|
|
197
|
+
function populateTemplateWithDigits(template, position, digits) {
|
|
198
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose$2(digits.split("")), _step2; !(_step2 = _iterator2()).done;) {
|
|
199
|
+
var digit = _step2.value;
|
|
200
|
+
if (template.slice(position + 1).search(DIGIT_PLACEHOLDER_MATCHER) < 0) return;
|
|
201
|
+
position = template.search(DIGIT_PLACEHOLDER_MATCHER);
|
|
202
|
+
template = template.replace(DIGIT_PLACEHOLDER_MATCHER, digit);
|
|
203
|
+
}
|
|
204
|
+
return [template, position];
|
|
205
|
+
}
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.complete.js
|
|
208
|
+
function formatCompleteNumber(state, format, _ref) {
|
|
209
|
+
var metadata = _ref.metadata, shouldTryNationalPrefixFormattingRule = _ref.shouldTryNationalPrefixFormattingRule, getSeparatorAfterNationalPrefix = _ref.getSeparatorAfterNationalPrefix;
|
|
210
|
+
if (new RegExp("^(?:".concat(format.pattern(), ")$")).test(state.nationalSignificantNumber)) return formatNationalNumberWithAndWithoutNationalPrefixFormattingRule(state, format, {
|
|
211
|
+
metadata,
|
|
212
|
+
shouldTryNationalPrefixFormattingRule,
|
|
213
|
+
getSeparatorAfterNationalPrefix
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
function canFormatCompleteNumber(nationalSignificantNumber, country, metadata) {
|
|
217
|
+
return checkNumberLength(nationalSignificantNumber, country, metadata) === "IS_POSSIBLE";
|
|
218
|
+
}
|
|
219
|
+
function formatNationalNumberWithAndWithoutNationalPrefixFormattingRule(state, format, _ref2) {
|
|
220
|
+
var metadata = _ref2.metadata, shouldTryNationalPrefixFormattingRule = _ref2.shouldTryNationalPrefixFormattingRule, getSeparatorAfterNationalPrefix = _ref2.getSeparatorAfterNationalPrefix;
|
|
221
|
+
state.nationalSignificantNumber;
|
|
222
|
+
state.international;
|
|
223
|
+
state.nationalPrefix;
|
|
224
|
+
state.carrierCode;
|
|
225
|
+
if (shouldTryNationalPrefixFormattingRule(format)) {
|
|
226
|
+
var formattedNumber = formatNationalNumber(state, format, {
|
|
227
|
+
useNationalPrefixFormattingRule: true,
|
|
228
|
+
getSeparatorAfterNationalPrefix,
|
|
229
|
+
metadata
|
|
230
|
+
});
|
|
231
|
+
if (formattedNumber) return formattedNumber;
|
|
232
|
+
}
|
|
233
|
+
return formatNationalNumber(state, format, {
|
|
234
|
+
useNationalPrefixFormattingRule: false,
|
|
235
|
+
getSeparatorAfterNationalPrefix,
|
|
236
|
+
metadata
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
function formatNationalNumber(state, format, _ref3) {
|
|
240
|
+
var metadata = _ref3.metadata, useNationalPrefixFormattingRule = _ref3.useNationalPrefixFormattingRule, getSeparatorAfterNationalPrefix = _ref3.getSeparatorAfterNationalPrefix;
|
|
241
|
+
var formattedNationalNumber = formatNationalNumberUsingFormat(state.nationalSignificantNumber, format, {
|
|
242
|
+
carrierCode: state.carrierCode,
|
|
243
|
+
useInternationalFormat: state.international,
|
|
244
|
+
withNationalPrefix: useNationalPrefixFormattingRule,
|
|
245
|
+
metadata
|
|
246
|
+
});
|
|
247
|
+
if (!useNationalPrefixFormattingRule) {
|
|
248
|
+
if (state.nationalPrefix) formattedNationalNumber = state.nationalPrefix + getSeparatorAfterNationalPrefix(format) + formattedNationalNumber;
|
|
249
|
+
else if (state.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix) formattedNationalNumber = state.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix + " " + formattedNationalNumber;
|
|
250
|
+
}
|
|
251
|
+
if (isValidFormattedNationalNumber(formattedNationalNumber, state)) return formattedNationalNumber;
|
|
252
|
+
}
|
|
253
|
+
function isValidFormattedNationalNumber(formattedNationalNumber, state) {
|
|
254
|
+
return parseDigits(formattedNationalNumber) === state.getNationalDigits();
|
|
255
|
+
}
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.PatternParser.js
|
|
258
|
+
function _typeof$4(o) {
|
|
259
|
+
"@babel/helpers - typeof";
|
|
260
|
+
return _typeof$4 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
261
|
+
return typeof o;
|
|
262
|
+
} : function(o) {
|
|
263
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
264
|
+
}, _typeof$4(o);
|
|
265
|
+
}
|
|
266
|
+
function _classCallCheck$4(a, n) {
|
|
267
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
268
|
+
}
|
|
269
|
+
function _defineProperties$4(e, r) {
|
|
270
|
+
for (var t = 0; t < r.length; t++) {
|
|
271
|
+
var o = r[t];
|
|
272
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$4(o.key), o);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
function _createClass$4(e, r, t) {
|
|
276
|
+
return r && _defineProperties$4(e.prototype, r), t && _defineProperties$4(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
277
|
+
}
|
|
278
|
+
function _toPropertyKey$4(t) {
|
|
279
|
+
var i = _toPrimitive$4(t, "string");
|
|
280
|
+
return "symbol" == _typeof$4(i) ? i : i + "";
|
|
281
|
+
}
|
|
282
|
+
function _toPrimitive$4(t, r) {
|
|
283
|
+
if ("object" != _typeof$4(t) || !t) return t;
|
|
284
|
+
var e = t[Symbol.toPrimitive];
|
|
285
|
+
if (void 0 !== e) {
|
|
286
|
+
var i = e.call(t, r || "default");
|
|
287
|
+
if ("object" != _typeof$4(i)) return i;
|
|
288
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
289
|
+
}
|
|
290
|
+
return ("string" === r ? String : Number)(t);
|
|
291
|
+
}
|
|
292
|
+
var PatternParser = /*#__PURE__*/ function() {
|
|
293
|
+
function PatternParser() {
|
|
294
|
+
_classCallCheck$4(this, PatternParser);
|
|
295
|
+
}
|
|
296
|
+
return _createClass$4(PatternParser, [
|
|
297
|
+
{
|
|
298
|
+
key: "parse",
|
|
299
|
+
value: function parse(pattern) {
|
|
300
|
+
this.context = [{
|
|
301
|
+
or: true,
|
|
302
|
+
instructions: []
|
|
303
|
+
}];
|
|
304
|
+
this.parsePattern(pattern);
|
|
305
|
+
if (this.context.length !== 1) throw new Error("Non-finalized contexts left when pattern parse ended");
|
|
306
|
+
var _this$context$ = this.context[0], branches = _this$context$.branches, instructions = _this$context$.instructions;
|
|
307
|
+
if (branches) return {
|
|
308
|
+
op: "|",
|
|
309
|
+
args: branches.concat([expandSingleElementArray(instructions)])
|
|
310
|
+
};
|
|
311
|
+
/* istanbul ignore if */
|
|
312
|
+
if (instructions.length === 0) throw new Error("Pattern is required");
|
|
313
|
+
if (instructions.length === 1) return instructions[0];
|
|
314
|
+
return instructions;
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
key: "startContext",
|
|
319
|
+
value: function startContext(context) {
|
|
320
|
+
this.context.push(context);
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
key: "endContext",
|
|
325
|
+
value: function endContext() {
|
|
326
|
+
this.context.pop();
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
key: "getContext",
|
|
331
|
+
value: function getContext() {
|
|
332
|
+
return this.context[this.context.length - 1];
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
key: "parsePattern",
|
|
337
|
+
value: function parsePattern(pattern) {
|
|
338
|
+
if (!pattern) throw new Error("Pattern is required");
|
|
339
|
+
var match = pattern.match(OPERATOR);
|
|
340
|
+
if (!match) {
|
|
341
|
+
if (ILLEGAL_CHARACTER_REGEXP.test(pattern)) throw new Error("Illegal characters found in a pattern: ".concat(pattern));
|
|
342
|
+
this.getContext().instructions = this.getContext().instructions.concat(pattern.split(""));
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
var operator = match[1];
|
|
346
|
+
var before = pattern.slice(0, match.index);
|
|
347
|
+
var rightPart = pattern.slice(match.index + operator.length);
|
|
348
|
+
switch (operator) {
|
|
349
|
+
case "(?:":
|
|
350
|
+
if (before) this.parsePattern(before);
|
|
351
|
+
this.startContext({
|
|
352
|
+
or: true,
|
|
353
|
+
instructions: [],
|
|
354
|
+
branches: []
|
|
355
|
+
});
|
|
356
|
+
break;
|
|
357
|
+
case ")":
|
|
358
|
+
if (!this.getContext().or) throw new Error("\")\" operator must be preceded by \"(?:\" operator");
|
|
359
|
+
if (before) this.parsePattern(before);
|
|
360
|
+
if (this.getContext().instructions.length === 0) throw new Error("No instructions found after \"|\" operator in an \"or\" group");
|
|
361
|
+
var branches = this.getContext().branches;
|
|
362
|
+
branches.push(expandSingleElementArray(this.getContext().instructions));
|
|
363
|
+
this.endContext();
|
|
364
|
+
this.getContext().instructions.push({
|
|
365
|
+
op: "|",
|
|
366
|
+
args: branches
|
|
367
|
+
});
|
|
368
|
+
break;
|
|
369
|
+
case "|":
|
|
370
|
+
if (!this.getContext().or) throw new Error("\"|\" operator can only be used inside \"or\" groups");
|
|
371
|
+
if (before) this.parsePattern(before);
|
|
372
|
+
if (!this.getContext().branches)
|
|
373
|
+
/* istanbul ignore else */
|
|
374
|
+
if (this.context.length === 1) this.getContext().branches = [];
|
|
375
|
+
else throw new Error("\"branches\" not found in an \"or\" group context");
|
|
376
|
+
this.getContext().branches.push(expandSingleElementArray(this.getContext().instructions));
|
|
377
|
+
this.getContext().instructions = [];
|
|
378
|
+
break;
|
|
379
|
+
case "[":
|
|
380
|
+
if (before) this.parsePattern(before);
|
|
381
|
+
this.startContext({ oneOfSet: true });
|
|
382
|
+
break;
|
|
383
|
+
case "]":
|
|
384
|
+
if (!this.getContext().oneOfSet) throw new Error("\"]\" operator must be preceded by \"[\" operator");
|
|
385
|
+
this.endContext();
|
|
386
|
+
this.getContext().instructions.push({
|
|
387
|
+
op: "[]",
|
|
388
|
+
args: parseOneOfSet(before)
|
|
389
|
+
});
|
|
390
|
+
break;
|
|
391
|
+
/* istanbul ignore next */
|
|
392
|
+
default: throw new Error("Unknown operator: ".concat(operator));
|
|
393
|
+
}
|
|
394
|
+
if (rightPart) this.parsePattern(rightPart);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
]);
|
|
398
|
+
}();
|
|
399
|
+
function parseOneOfSet(pattern) {
|
|
400
|
+
var values = [];
|
|
401
|
+
var i = 0;
|
|
402
|
+
while (i < pattern.length) {
|
|
403
|
+
if (pattern[i] === "-") {
|
|
404
|
+
if (i === 0 || i === pattern.length - 1) throw new Error("Couldn't parse a one-of set pattern: ".concat(pattern));
|
|
405
|
+
var prevValue = pattern[i - 1].charCodeAt(0) + 1;
|
|
406
|
+
var nextValue = pattern[i + 1].charCodeAt(0) - 1;
|
|
407
|
+
var value = prevValue;
|
|
408
|
+
while (value <= nextValue) {
|
|
409
|
+
values.push(String.fromCharCode(value));
|
|
410
|
+
value++;
|
|
411
|
+
}
|
|
412
|
+
} else values.push(pattern[i]);
|
|
413
|
+
i++;
|
|
414
|
+
}
|
|
415
|
+
return values;
|
|
416
|
+
}
|
|
417
|
+
var ILLEGAL_CHARACTER_REGEXP = /[\(\)\[\]\?\:\|]/;
|
|
418
|
+
var OPERATOR = /* @__PURE__ */ new RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");
|
|
419
|
+
function expandSingleElementArray(array) {
|
|
420
|
+
if (array.length === 1) return array[0];
|
|
421
|
+
return array;
|
|
422
|
+
}
|
|
423
|
+
//#endregion
|
|
424
|
+
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.PatternMatcher.js
|
|
425
|
+
function _createForOfIteratorHelperLoose$1(r, e) {
|
|
426
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
427
|
+
if (t) return (t = t.call(r)).next.bind(t);
|
|
428
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray$3(r)) || e && r && "number" == typeof r.length) {
|
|
429
|
+
t && (r = t);
|
|
430
|
+
var o = 0;
|
|
431
|
+
return function() {
|
|
432
|
+
return o >= r.length ? { done: !0 } : {
|
|
433
|
+
done: !1,
|
|
434
|
+
value: r[o++]
|
|
435
|
+
};
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
439
|
+
}
|
|
440
|
+
function _unsupportedIterableToArray$3(r, a) {
|
|
441
|
+
if (r) {
|
|
442
|
+
if ("string" == typeof r) return _arrayLikeToArray$3(r, a);
|
|
443
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
444
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$3(r, a) : void 0;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
function _arrayLikeToArray$3(r, a) {
|
|
448
|
+
(null == a || a > r.length) && (a = r.length);
|
|
449
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
450
|
+
return n;
|
|
451
|
+
}
|
|
452
|
+
function _typeof$3(o) {
|
|
453
|
+
"@babel/helpers - typeof";
|
|
454
|
+
return _typeof$3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
455
|
+
return typeof o;
|
|
456
|
+
} : function(o) {
|
|
457
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
458
|
+
}, _typeof$3(o);
|
|
459
|
+
}
|
|
460
|
+
function _classCallCheck$3(a, n) {
|
|
461
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
462
|
+
}
|
|
463
|
+
function _defineProperties$3(e, r) {
|
|
464
|
+
for (var t = 0; t < r.length; t++) {
|
|
465
|
+
var o = r[t];
|
|
466
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$3(o.key), o);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
function _createClass$3(e, r, t) {
|
|
470
|
+
return r && _defineProperties$3(e.prototype, r), t && _defineProperties$3(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
471
|
+
}
|
|
472
|
+
function _toPropertyKey$3(t) {
|
|
473
|
+
var i = _toPrimitive$3(t, "string");
|
|
474
|
+
return "symbol" == _typeof$3(i) ? i : i + "";
|
|
475
|
+
}
|
|
476
|
+
function _toPrimitive$3(t, r) {
|
|
477
|
+
if ("object" != _typeof$3(t) || !t) return t;
|
|
478
|
+
var e = t[Symbol.toPrimitive];
|
|
479
|
+
if (void 0 !== e) {
|
|
480
|
+
var i = e.call(t, r || "default");
|
|
481
|
+
if ("object" != _typeof$3(i)) return i;
|
|
482
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
483
|
+
}
|
|
484
|
+
return ("string" === r ? String : Number)(t);
|
|
485
|
+
}
|
|
486
|
+
var PatternMatcher = /*#__PURE__*/ function() {
|
|
487
|
+
function PatternMatcher(pattern) {
|
|
488
|
+
_classCallCheck$3(this, PatternMatcher);
|
|
489
|
+
this.matchTree = new PatternParser().parse(pattern);
|
|
490
|
+
}
|
|
491
|
+
return _createClass$3(PatternMatcher, [{
|
|
492
|
+
key: "match",
|
|
493
|
+
value: function match(string) {
|
|
494
|
+
var allowOverflow = (arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}).allowOverflow;
|
|
495
|
+
if (!string) throw new Error("String is required");
|
|
496
|
+
var result = _match(string.split(""), this.matchTree, true);
|
|
497
|
+
if (result && result.match) delete result.matchedChars;
|
|
498
|
+
if (result && result.overflow) {
|
|
499
|
+
if (!allowOverflow) return;
|
|
500
|
+
}
|
|
501
|
+
return result;
|
|
502
|
+
}
|
|
503
|
+
}]);
|
|
504
|
+
}();
|
|
505
|
+
function _match(characters, tree, last) {
|
|
506
|
+
if (typeof tree === "string") {
|
|
507
|
+
var characterString = characters.join("");
|
|
508
|
+
if (tree.indexOf(characterString) === 0) {
|
|
509
|
+
/* istanbul ignore else */
|
|
510
|
+
if (characters.length === tree.length) return {
|
|
511
|
+
match: true,
|
|
512
|
+
matchedChars: characters
|
|
513
|
+
};
|
|
514
|
+
/* istanbul ignore next */
|
|
515
|
+
return { partialMatch: true };
|
|
516
|
+
}
|
|
517
|
+
if (characterString.indexOf(tree) === 0) {
|
|
518
|
+
if (last) {
|
|
519
|
+
/* istanbul ignore else */
|
|
520
|
+
if (characters.length > tree.length) return { overflow: true };
|
|
521
|
+
}
|
|
522
|
+
return {
|
|
523
|
+
match: true,
|
|
524
|
+
matchedChars: characters.slice(0, tree.length)
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
if (Array.isArray(tree)) {
|
|
530
|
+
var restCharacters = characters.slice();
|
|
531
|
+
var i = 0;
|
|
532
|
+
while (i < tree.length) {
|
|
533
|
+
var subtree = tree[i];
|
|
534
|
+
var result = _match(restCharacters, subtree, last && i === tree.length - 1);
|
|
535
|
+
if (!result) return;
|
|
536
|
+
else if (result.overflow) return result;
|
|
537
|
+
else if (result.match) {
|
|
538
|
+
restCharacters = restCharacters.slice(result.matchedChars.length);
|
|
539
|
+
if (restCharacters.length === 0) if (i === tree.length - 1) return {
|
|
540
|
+
match: true,
|
|
541
|
+
matchedChars: characters
|
|
542
|
+
};
|
|
543
|
+
else return { partialMatch: true };
|
|
544
|
+
} else if (result.partialMatch) return { partialMatch: true };
|
|
545
|
+
else throw new Error("Unsupported match result:\n".concat(JSON.stringify(result, null, 2)));
|
|
546
|
+
i++;
|
|
547
|
+
}
|
|
548
|
+
/* istanbul ignore if */
|
|
549
|
+
if (last) return { overflow: true };
|
|
550
|
+
return {
|
|
551
|
+
match: true,
|
|
552
|
+
matchedChars: characters.slice(0, characters.length - restCharacters.length)
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
switch (tree.op) {
|
|
556
|
+
case "|":
|
|
557
|
+
var partialMatch;
|
|
558
|
+
for (var _iterator = _createForOfIteratorHelperLoose$1(tree.args), _step; !(_step = _iterator()).done;) {
|
|
559
|
+
var branch = _step.value;
|
|
560
|
+
var _result = _match(characters, branch, last);
|
|
561
|
+
if (_result) if (_result.overflow) return _result;
|
|
562
|
+
else if (_result.match) return {
|
|
563
|
+
match: true,
|
|
564
|
+
matchedChars: _result.matchedChars
|
|
565
|
+
};
|
|
566
|
+
else if (_result.partialMatch) partialMatch = true;
|
|
567
|
+
else throw new Error("Unsupported match result:\n".concat(JSON.stringify(_result, null, 2)));
|
|
568
|
+
}
|
|
569
|
+
if (partialMatch) return { partialMatch: true };
|
|
570
|
+
return;
|
|
571
|
+
case "[]":
|
|
572
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose$1(tree.args), _step2; !(_step2 = _iterator2()).done;) {
|
|
573
|
+
var _char = _step2.value;
|
|
574
|
+
if (characters[0] === _char) {
|
|
575
|
+
if (characters.length === 1) return {
|
|
576
|
+
match: true,
|
|
577
|
+
matchedChars: characters
|
|
578
|
+
};
|
|
579
|
+
if (last) return { overflow: true };
|
|
580
|
+
return {
|
|
581
|
+
match: true,
|
|
582
|
+
matchedChars: [_char]
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
return;
|
|
587
|
+
/* istanbul ignore next */
|
|
588
|
+
default: throw new Error("Unsupported instruction tree: ".concat(tree));
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
//#endregion
|
|
592
|
+
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.js
|
|
593
|
+
function _typeof$2(o) {
|
|
594
|
+
"@babel/helpers - typeof";
|
|
595
|
+
return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
596
|
+
return typeof o;
|
|
597
|
+
} : function(o) {
|
|
598
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
599
|
+
}, _typeof$2(o);
|
|
600
|
+
}
|
|
601
|
+
function _createForOfIteratorHelperLoose(r, e) {
|
|
602
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
603
|
+
if (t) return (t = t.call(r)).next.bind(t);
|
|
604
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray$2(r)) || e && r && "number" == typeof r.length) {
|
|
605
|
+
t && (r = t);
|
|
606
|
+
var o = 0;
|
|
607
|
+
return function() {
|
|
608
|
+
return o >= r.length ? { done: !0 } : {
|
|
609
|
+
done: !1,
|
|
610
|
+
value: r[o++]
|
|
611
|
+
};
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
615
|
+
}
|
|
616
|
+
function _unsupportedIterableToArray$2(r, a) {
|
|
617
|
+
if (r) {
|
|
618
|
+
if ("string" == typeof r) return _arrayLikeToArray$2(r, a);
|
|
619
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
620
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2(r, a) : void 0;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
function _arrayLikeToArray$2(r, a) {
|
|
624
|
+
(null == a || a > r.length) && (a = r.length);
|
|
625
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
626
|
+
return n;
|
|
627
|
+
}
|
|
628
|
+
function _classCallCheck$2(a, n) {
|
|
629
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
630
|
+
}
|
|
631
|
+
function _defineProperties$2(e, r) {
|
|
632
|
+
for (var t = 0; t < r.length; t++) {
|
|
633
|
+
var o = r[t];
|
|
634
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$2(o.key), o);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
function _createClass$2(e, r, t) {
|
|
638
|
+
return r && _defineProperties$2(e.prototype, r), t && _defineProperties$2(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
639
|
+
}
|
|
640
|
+
function _toPropertyKey$2(t) {
|
|
641
|
+
var i = _toPrimitive$2(t, "string");
|
|
642
|
+
return "symbol" == _typeof$2(i) ? i : i + "";
|
|
643
|
+
}
|
|
644
|
+
function _toPrimitive$2(t, r) {
|
|
645
|
+
if ("object" != _typeof$2(t) || !t) return t;
|
|
646
|
+
var e = t[Symbol.toPrimitive];
|
|
647
|
+
if (void 0 !== e) {
|
|
648
|
+
var i = e.call(t, r || "default");
|
|
649
|
+
if ("object" != _typeof$2(i)) return i;
|
|
650
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
651
|
+
}
|
|
652
|
+
return ("string" === r ? String : Number)(t);
|
|
653
|
+
}
|
|
654
|
+
var DUMMY_DIGIT = "9";
|
|
655
|
+
var LONGEST_DUMMY_PHONE_NUMBER = repeat(DUMMY_DIGIT, 15);
|
|
656
|
+
var NATIONAL_PREFIX_SEPARATORS_PATTERN = /[- ]/;
|
|
657
|
+
var SUPPORT_LEGACY_FORMATTING_PATTERNS = true;
|
|
658
|
+
var CREATE_CHARACTER_CLASS_PATTERN = SUPPORT_LEGACY_FORMATTING_PATTERNS && function() {
|
|
659
|
+
return /\[([^\[\]])*\]/g;
|
|
660
|
+
};
|
|
661
|
+
var CREATE_STANDALONE_DIGIT_PATTERN = SUPPORT_LEGACY_FORMATTING_PATTERNS && function() {
|
|
662
|
+
return /\d(?=[^,}][^,}])/g;
|
|
663
|
+
};
|
|
664
|
+
var NON_ALTERING_FORMAT_REG_EXP = new RegExp("[" + VALID_PUNCTUATION + "]*\\$1[" + VALID_PUNCTUATION + "]*(\\$\\d[" + VALID_PUNCTUATION + "]*)*$");
|
|
665
|
+
var MIN_LEADING_DIGITS_LENGTH = 3;
|
|
666
|
+
var AsYouTypeFormatter = /*#__PURE__*/ function() {
|
|
667
|
+
function AsYouTypeFormatter(_ref) {
|
|
668
|
+
_ref.state;
|
|
669
|
+
var metadata = _ref.metadata;
|
|
670
|
+
_classCallCheck$2(this, AsYouTypeFormatter);
|
|
671
|
+
this.metadata = metadata;
|
|
672
|
+
this.resetFormat();
|
|
673
|
+
}
|
|
674
|
+
return _createClass$2(AsYouTypeFormatter, [
|
|
675
|
+
{
|
|
676
|
+
key: "resetFormat",
|
|
677
|
+
value: function resetFormat() {
|
|
678
|
+
this.chosenFormat = void 0;
|
|
679
|
+
this.template = void 0;
|
|
680
|
+
this.nationalNumberTemplate = void 0;
|
|
681
|
+
this.populatedNationalNumberTemplate = void 0;
|
|
682
|
+
this.populatedNationalNumberTemplatePosition = -1;
|
|
683
|
+
}
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
key: "reset",
|
|
687
|
+
value: function reset(numberingPlan, state) {
|
|
688
|
+
this.resetFormat();
|
|
689
|
+
if (numberingPlan) {
|
|
690
|
+
this.isNANP = numberingPlan.callingCode() === "1";
|
|
691
|
+
this.matchingFormats = numberingPlan.formats();
|
|
692
|
+
if (state.nationalSignificantNumber) this.narrowDownMatchingFormats(state);
|
|
693
|
+
} else {
|
|
694
|
+
this.isNANP = void 0;
|
|
695
|
+
this.matchingFormats = [];
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
key: "format",
|
|
701
|
+
value: function format(nextDigits, state) {
|
|
702
|
+
var _this = this;
|
|
703
|
+
if (canFormatCompleteNumber(state.nationalSignificantNumber, state.country, this.metadata)) for (var _iterator = _createForOfIteratorHelperLoose(this.matchingFormats), _step; !(_step = _iterator()).done;) {
|
|
704
|
+
var _format = _step.value;
|
|
705
|
+
var formattedCompleteNumber = formatCompleteNumber(state, _format, {
|
|
706
|
+
metadata: this.metadata,
|
|
707
|
+
shouldTryNationalPrefixFormattingRule: function shouldTryNationalPrefixFormattingRule(format) {
|
|
708
|
+
return _this.shouldTryNationalPrefixFormattingRule(format, {
|
|
709
|
+
international: state.international,
|
|
710
|
+
nationalPrefix: state.nationalPrefix
|
|
711
|
+
});
|
|
712
|
+
},
|
|
713
|
+
getSeparatorAfterNationalPrefix: function getSeparatorAfterNationalPrefix(format) {
|
|
714
|
+
return _this.getSeparatorAfterNationalPrefix(format);
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
if (formattedCompleteNumber) {
|
|
718
|
+
this.resetFormat();
|
|
719
|
+
this.chosenFormat = _format;
|
|
720
|
+
this.setNationalNumberTemplate(formattedCompleteNumber.replace(/\d/g, "x"), state);
|
|
721
|
+
this.populatedNationalNumberTemplate = formattedCompleteNumber;
|
|
722
|
+
this.populatedNationalNumberTemplatePosition = this.template.lastIndexOf("x");
|
|
723
|
+
return formattedCompleteNumber;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
return this.formatNationalNumberWithNextDigits(nextDigits, state);
|
|
727
|
+
}
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
key: "formatNationalNumberWithNextDigits",
|
|
731
|
+
value: function formatNationalNumberWithNextDigits(nextDigits, state) {
|
|
732
|
+
var previouslyChosenFormat = this.chosenFormat;
|
|
733
|
+
var newlyChosenFormat = this.chooseFormat(state);
|
|
734
|
+
if (newlyChosenFormat) if (newlyChosenFormat === previouslyChosenFormat) return this.formatNextNationalNumberDigits(nextDigits);
|
|
735
|
+
else return this.formatNextNationalNumberDigits(state.getNationalDigits());
|
|
736
|
+
}
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
key: "narrowDownMatchingFormats",
|
|
740
|
+
value: function narrowDownMatchingFormats(_ref2) {
|
|
741
|
+
var _this2 = this;
|
|
742
|
+
var nationalSignificantNumber = _ref2.nationalSignificantNumber, nationalPrefix = _ref2.nationalPrefix, international = _ref2.international;
|
|
743
|
+
var leadingDigits = nationalSignificantNumber;
|
|
744
|
+
var leadingDigitsPatternIndex = leadingDigits.length - MIN_LEADING_DIGITS_LENGTH;
|
|
745
|
+
if (leadingDigitsPatternIndex < 0) leadingDigitsPatternIndex = 0;
|
|
746
|
+
this.matchingFormats = this.matchingFormats.filter(function(format) {
|
|
747
|
+
return _this2.formatSuits(format, international, nationalPrefix) && _this2.formatMatches(format, leadingDigits, leadingDigitsPatternIndex);
|
|
748
|
+
});
|
|
749
|
+
if (this.chosenFormat && this.matchingFormats.indexOf(this.chosenFormat) === -1) this.resetFormat();
|
|
750
|
+
}
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
key: "formatSuits",
|
|
754
|
+
value: function formatSuits(format, international, nationalPrefix) {
|
|
755
|
+
if (nationalPrefix && !format.usesNationalPrefix() && !format.nationalPrefixIsOptionalWhenFormattingInNationalFormat()) return false;
|
|
756
|
+
if (!international && !nationalPrefix && format.nationalPrefixIsMandatoryWhenFormattingInNationalFormat()) return false;
|
|
757
|
+
return true;
|
|
758
|
+
}
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
key: "formatMatches",
|
|
762
|
+
value: function formatMatches(format, leadingDigits, leadingDigitsPatternIndex) {
|
|
763
|
+
var leadingDigitsPatternsCount = format.leadingDigitsPatterns().length;
|
|
764
|
+
if (leadingDigitsPatternsCount === 0) return true;
|
|
765
|
+
leadingDigitsPatternIndex = Math.min(leadingDigitsPatternIndex, leadingDigitsPatternsCount - 1);
|
|
766
|
+
var leadingDigitsPattern = format.leadingDigitsPatterns()[leadingDigitsPatternIndex];
|
|
767
|
+
if (leadingDigits.length < MIN_LEADING_DIGITS_LENGTH) try {
|
|
768
|
+
return new PatternMatcher(leadingDigitsPattern).match(leadingDigits, { allowOverflow: true }) !== void 0;
|
|
769
|
+
} catch (error) /* istanbul ignore next */ {
|
|
770
|
+
console.error(error);
|
|
771
|
+
return true;
|
|
772
|
+
}
|
|
773
|
+
return new RegExp("^(".concat(leadingDigitsPattern, ")")).test(leadingDigits);
|
|
774
|
+
}
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
key: "getFormatFormat",
|
|
778
|
+
value: function getFormatFormat(format, international) {
|
|
779
|
+
return international ? format.internationalFormat() : format.format();
|
|
780
|
+
}
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
key: "chooseFormat",
|
|
784
|
+
value: function chooseFormat(state) {
|
|
785
|
+
var _this3 = this;
|
|
786
|
+
var _loop = function _loop() {
|
|
787
|
+
var format = _step2.value;
|
|
788
|
+
if (_this3.chosenFormat === format) return 0;
|
|
789
|
+
/* istanbul ignore if */
|
|
790
|
+
if (!NON_ALTERING_FORMAT_REG_EXP.test(_this3.getFormatFormat(format, state.international))) return 1;
|
|
791
|
+
if (!_this3.createTemplateForFormat(format, state)) {
|
|
792
|
+
_this3.matchingFormats = _this3.matchingFormats.filter(function(_) {
|
|
793
|
+
return _ !== format;
|
|
794
|
+
});
|
|
795
|
+
return 1;
|
|
796
|
+
}
|
|
797
|
+
_this3.chosenFormat = format;
|
|
798
|
+
return 0;
|
|
799
|
+
}, _ret;
|
|
800
|
+
/* istanbul ignore next */
|
|
801
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(this.matchingFormats.slice()), _step2; !(_step2 = _iterator2()).done;) {
|
|
802
|
+
_ret = _loop();
|
|
803
|
+
if (_ret === 0) break;
|
|
804
|
+
if (_ret === 1) continue;
|
|
805
|
+
}
|
|
806
|
+
if (!this.chosenFormat) this.resetFormat();
|
|
807
|
+
return this.chosenFormat;
|
|
808
|
+
}
|
|
809
|
+
},
|
|
810
|
+
{
|
|
811
|
+
key: "createTemplateForFormat",
|
|
812
|
+
value: function createTemplateForFormat(format, state) {
|
|
813
|
+
/* istanbul ignore if */
|
|
814
|
+
if (SUPPORT_LEGACY_FORMATTING_PATTERNS && format.pattern().indexOf("|") >= 0) return;
|
|
815
|
+
var template = this.getTemplateForFormat(format, state);
|
|
816
|
+
if (template) {
|
|
817
|
+
this.setNationalNumberTemplate(template, state);
|
|
818
|
+
return true;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
key: "getSeparatorAfterNationalPrefix",
|
|
824
|
+
value: function getSeparatorAfterNationalPrefix(format) {
|
|
825
|
+
if (this.isNANP) return " ";
|
|
826
|
+
if (format && format.nationalPrefixFormattingRule() && NATIONAL_PREFIX_SEPARATORS_PATTERN.test(format.nationalPrefixFormattingRule())) return " ";
|
|
827
|
+
return "";
|
|
828
|
+
}
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
key: "getInternationalPrefixBeforeCountryCallingCode",
|
|
832
|
+
value: function getInternationalPrefixBeforeCountryCallingCode(_ref3, options) {
|
|
833
|
+
var IDDPrefix = _ref3.IDDPrefix, missingPlus = _ref3.missingPlus;
|
|
834
|
+
if (IDDPrefix) return options && options.spacing === false ? IDDPrefix : IDDPrefix + " ";
|
|
835
|
+
if (missingPlus) return "";
|
|
836
|
+
return "+";
|
|
837
|
+
}
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
key: "getTemplate",
|
|
841
|
+
value: function getTemplate(state) {
|
|
842
|
+
if (!this.template) return;
|
|
843
|
+
var index = -1;
|
|
844
|
+
var i = 0;
|
|
845
|
+
var internationalPrefix = state.international ? this.getInternationalPrefixBeforeCountryCallingCode(state, { spacing: false }) : "";
|
|
846
|
+
while (i < internationalPrefix.length + state.getDigitsWithoutInternationalPrefix().length) {
|
|
847
|
+
index = this.template.indexOf("x", index + 1);
|
|
848
|
+
i++;
|
|
849
|
+
}
|
|
850
|
+
return cutAndStripNonPairedParens(this.template, index + 1);
|
|
851
|
+
}
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
key: "setNationalNumberTemplate",
|
|
855
|
+
value: function setNationalNumberTemplate(template, state) {
|
|
856
|
+
this.nationalNumberTemplate = template;
|
|
857
|
+
this.populatedNationalNumberTemplate = template;
|
|
858
|
+
this.populatedNationalNumberTemplatePosition = -1;
|
|
859
|
+
if (state.international) this.template = this.getInternationalPrefixBeforeCountryCallingCode(state).replace(/[\d\+]/g, "x") + repeat("x", state.callingCode.length) + " " + template;
|
|
860
|
+
else this.template = template;
|
|
861
|
+
}
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
key: "getTemplateForFormat",
|
|
865
|
+
value: function getTemplateForFormat(format, _ref4) {
|
|
866
|
+
var nationalSignificantNumber = _ref4.nationalSignificantNumber, international = _ref4.international, nationalPrefix = _ref4.nationalPrefix, prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix = _ref4.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix;
|
|
867
|
+
var pattern = format.pattern();
|
|
868
|
+
/* istanbul ignore else */
|
|
869
|
+
if (SUPPORT_LEGACY_FORMATTING_PATTERNS) pattern = pattern.replace(CREATE_CHARACTER_CLASS_PATTERN(), "\\d").replace(CREATE_STANDALONE_DIGIT_PATTERN(), "\\d");
|
|
870
|
+
var digits = LONGEST_DUMMY_PHONE_NUMBER.match(pattern)[0];
|
|
871
|
+
if (nationalSignificantNumber.length > digits.length) return;
|
|
872
|
+
var strictPattern = new RegExp("^" + pattern + "$");
|
|
873
|
+
var nationalNumberDummyDigits = nationalSignificantNumber.replace(/\d/g, DUMMY_DIGIT);
|
|
874
|
+
if (strictPattern.test(nationalNumberDummyDigits)) digits = nationalNumberDummyDigits;
|
|
875
|
+
var numberFormat = this.getFormatFormat(format, international);
|
|
876
|
+
var nationalPrefixIncludedInTemplate;
|
|
877
|
+
if (this.shouldTryNationalPrefixFormattingRule(format, {
|
|
878
|
+
international,
|
|
879
|
+
nationalPrefix
|
|
880
|
+
})) {
|
|
881
|
+
var numberFormatWithNationalPrefix = numberFormat.replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule());
|
|
882
|
+
/* istanbul ignore else */
|
|
883
|
+
if (parseDigits(format.nationalPrefixFormattingRule()) === (nationalPrefix || "") + parseDigits("$1")) {
|
|
884
|
+
numberFormat = numberFormatWithNationalPrefix;
|
|
885
|
+
nationalPrefixIncludedInTemplate = true;
|
|
886
|
+
if (nationalPrefix) {
|
|
887
|
+
var i = nationalPrefix.length;
|
|
888
|
+
while (i > 0) {
|
|
889
|
+
numberFormat = numberFormat.replace(/\d/, "x");
|
|
890
|
+
i--;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
var template = digits.replace(new RegExp(pattern), numberFormat).replace(new RegExp(DUMMY_DIGIT, "g"), "x");
|
|
896
|
+
if (!nationalPrefixIncludedInTemplate) {
|
|
897
|
+
if (prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix) template = repeat("x", prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix.length) + " " + template;
|
|
898
|
+
else if (nationalPrefix) template = repeat("x", nationalPrefix.length) + this.getSeparatorAfterNationalPrefix(format) + template;
|
|
899
|
+
}
|
|
900
|
+
if (international) template = applyInternationalSeparatorStyle(template);
|
|
901
|
+
return template;
|
|
902
|
+
}
|
|
903
|
+
},
|
|
904
|
+
{
|
|
905
|
+
key: "formatNextNationalNumberDigits",
|
|
906
|
+
value: function formatNextNationalNumberDigits(digits) {
|
|
907
|
+
var result = populateTemplateWithDigits(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition, digits);
|
|
908
|
+
if (!result) {
|
|
909
|
+
this.resetFormat();
|
|
910
|
+
return;
|
|
911
|
+
}
|
|
912
|
+
this.populatedNationalNumberTemplate = result[0];
|
|
913
|
+
this.populatedNationalNumberTemplatePosition = result[1];
|
|
914
|
+
return cutAndStripNonPairedParens(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1);
|
|
915
|
+
}
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
key: "shouldTryNationalPrefixFormattingRule",
|
|
919
|
+
value: function shouldTryNationalPrefixFormattingRule(format, _ref5) {
|
|
920
|
+
var international = _ref5.international, nationalPrefix = _ref5.nationalPrefix;
|
|
921
|
+
if (format.nationalPrefixFormattingRule()) {
|
|
922
|
+
var usesNationalPrefix = format.usesNationalPrefix();
|
|
923
|
+
if (usesNationalPrefix && nationalPrefix || !usesNationalPrefix && !international) return true;
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
]);
|
|
928
|
+
}();
|
|
929
|
+
//#endregion
|
|
930
|
+
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/AsYouTypeParser.js
|
|
931
|
+
function _typeof$1(o) {
|
|
932
|
+
"@babel/helpers - typeof";
|
|
933
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
934
|
+
return typeof o;
|
|
935
|
+
} : function(o) {
|
|
936
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
937
|
+
}, _typeof$1(o);
|
|
938
|
+
}
|
|
939
|
+
function _slicedToArray$1(r, e) {
|
|
940
|
+
return _arrayWithHoles$1(r) || _iterableToArrayLimit$1(r, e) || _unsupportedIterableToArray$1(r, e) || _nonIterableRest$1();
|
|
941
|
+
}
|
|
942
|
+
function _nonIterableRest$1() {
|
|
943
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
944
|
+
}
|
|
945
|
+
function _unsupportedIterableToArray$1(r, a) {
|
|
946
|
+
if (r) {
|
|
947
|
+
if ("string" == typeof r) return _arrayLikeToArray$1(r, a);
|
|
948
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
949
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
function _arrayLikeToArray$1(r, a) {
|
|
953
|
+
(null == a || a > r.length) && (a = r.length);
|
|
954
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
955
|
+
return n;
|
|
956
|
+
}
|
|
957
|
+
function _iterableToArrayLimit$1(r, l) {
|
|
958
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
959
|
+
if (null != t) {
|
|
960
|
+
var e, n, i, u, a = [], f = !0, o = !1;
|
|
961
|
+
try {
|
|
962
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
963
|
+
if (Object(t) !== t) return;
|
|
964
|
+
f = !1;
|
|
965
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
966
|
+
} catch (r) {
|
|
967
|
+
o = !0, n = r;
|
|
968
|
+
} finally {
|
|
969
|
+
try {
|
|
970
|
+
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
971
|
+
} finally {
|
|
972
|
+
if (o) throw n;
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
return a;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
function _arrayWithHoles$1(r) {
|
|
979
|
+
if (Array.isArray(r)) return r;
|
|
980
|
+
}
|
|
981
|
+
function _classCallCheck$1(a, n) {
|
|
982
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
983
|
+
}
|
|
984
|
+
function _defineProperties$1(e, r) {
|
|
985
|
+
for (var t = 0; t < r.length; t++) {
|
|
986
|
+
var o = r[t];
|
|
987
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$1(o.key), o);
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
function _createClass$1(e, r, t) {
|
|
991
|
+
return r && _defineProperties$1(e.prototype, r), t && _defineProperties$1(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
992
|
+
}
|
|
993
|
+
function _toPropertyKey$1(t) {
|
|
994
|
+
var i = _toPrimitive$1(t, "string");
|
|
995
|
+
return "symbol" == _typeof$1(i) ? i : i + "";
|
|
996
|
+
}
|
|
997
|
+
function _toPrimitive$1(t, r) {
|
|
998
|
+
if ("object" != _typeof$1(t) || !t) return t;
|
|
999
|
+
var e = t[Symbol.toPrimitive];
|
|
1000
|
+
if (void 0 !== e) {
|
|
1001
|
+
var i = e.call(t, r || "default");
|
|
1002
|
+
if ("object" != _typeof$1(i)) return i;
|
|
1003
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1004
|
+
}
|
|
1005
|
+
return ("string" === r ? String : Number)(t);
|
|
1006
|
+
}
|
|
1007
|
+
var VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART = "[" + VALID_PUNCTUATION + VALID_DIGITS + "]+";
|
|
1008
|
+
var VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART_PATTERN = new RegExp("^" + VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART + "$", "i");
|
|
1009
|
+
var VALID_FORMATTED_PHONE_NUMBER_PART = "(?:[" + PLUS_CHARS + "][" + VALID_PUNCTUATION + VALID_DIGITS + "]*|[" + VALID_PUNCTUATION + VALID_DIGITS + "]+)";
|
|
1010
|
+
var AFTER_PHONE_NUMBER_DIGITS_END_PATTERN = new RegExp("[^" + VALID_PUNCTUATION + VALID_DIGITS + "]+.*$");
|
|
1011
|
+
var COMPLEX_NATIONAL_PREFIX = /[^\d\[\]]/;
|
|
1012
|
+
var AsYouTypeParser = /*#__PURE__*/ function() {
|
|
1013
|
+
function AsYouTypeParser(_ref) {
|
|
1014
|
+
var defaultCountry = _ref.defaultCountry, defaultCallingCode = _ref.defaultCallingCode, metadata = _ref.metadata, onNationalSignificantNumberChange = _ref.onNationalSignificantNumberChange;
|
|
1015
|
+
_classCallCheck$1(this, AsYouTypeParser);
|
|
1016
|
+
this.defaultCountry = defaultCountry;
|
|
1017
|
+
this.defaultCallingCode = defaultCallingCode;
|
|
1018
|
+
this.metadata = metadata;
|
|
1019
|
+
this.onNationalSignificantNumberChange = onNationalSignificantNumberChange;
|
|
1020
|
+
}
|
|
1021
|
+
return _createClass$1(AsYouTypeParser, [
|
|
1022
|
+
{
|
|
1023
|
+
key: "input",
|
|
1024
|
+
value: function input(text, state) {
|
|
1025
|
+
var _extractFormattedDigi2 = _slicedToArray$1(extractFormattedDigitsAndPlus(text), 2), formattedDigits = _extractFormattedDigi2[0], hasPlus = _extractFormattedDigi2[1];
|
|
1026
|
+
var digits = parseDigits(formattedDigits);
|
|
1027
|
+
var justLeadingPlus;
|
|
1028
|
+
if (hasPlus) {
|
|
1029
|
+
if (!state.digits) {
|
|
1030
|
+
state.startInternationalNumber(void 0, void 0);
|
|
1031
|
+
if (!digits) justLeadingPlus = true;
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
if (digits) this.inputDigits(digits, state);
|
|
1035
|
+
return {
|
|
1036
|
+
digits,
|
|
1037
|
+
justLeadingPlus
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1040
|
+
},
|
|
1041
|
+
{
|
|
1042
|
+
key: "inputDigits",
|
|
1043
|
+
value: function inputDigits(nextDigits, state) {
|
|
1044
|
+
var digits = state.digits;
|
|
1045
|
+
var hasReceivedThreeLeadingDigits = digits.length < 3 && digits.length + nextDigits.length >= 3;
|
|
1046
|
+
state.appendDigits(nextDigits);
|
|
1047
|
+
if (hasReceivedThreeLeadingDigits) this.extractIddPrefix(state);
|
|
1048
|
+
if (this.isWaitingForCountryCallingCode(state)) {
|
|
1049
|
+
if (!this.extractCountryCallingCode(state)) return;
|
|
1050
|
+
} else state.appendNationalSignificantNumberDigits(nextDigits);
|
|
1051
|
+
if (!state.international) {
|
|
1052
|
+
if (!this.hasExtractedNationalSignificantNumber) this.extractNationalSignificantNumber(state.getNationalDigits(), function(stateUpdate) {
|
|
1053
|
+
return state.update(stateUpdate);
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
},
|
|
1058
|
+
{
|
|
1059
|
+
key: "isWaitingForCountryCallingCode",
|
|
1060
|
+
value: function isWaitingForCountryCallingCode(_ref2) {
|
|
1061
|
+
var international = _ref2.international, callingCode = _ref2.callingCode;
|
|
1062
|
+
return international && !callingCode;
|
|
1063
|
+
}
|
|
1064
|
+
},
|
|
1065
|
+
{
|
|
1066
|
+
key: "extractCountryCallingCode",
|
|
1067
|
+
value: function extractCountryCallingCode$1(state) {
|
|
1068
|
+
var _extractCountryCallin = extractCountryCallingCode("+" + state.getDigitsWithoutInternationalPrefix(), state.country, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata), countryCallingCode = _extractCountryCallin.countryCallingCode, number = _extractCountryCallin.number;
|
|
1069
|
+
if (countryCallingCode) {
|
|
1070
|
+
state.setCallingCode(countryCallingCode);
|
|
1071
|
+
state.update({ nationalSignificantNumber: number });
|
|
1072
|
+
return true;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
key: "reset",
|
|
1078
|
+
value: function reset(numberingPlan) {
|
|
1079
|
+
if (numberingPlan) {
|
|
1080
|
+
this.hasSelectedNumberingPlan = true;
|
|
1081
|
+
var nationalPrefixForParsing = numberingPlan._nationalPrefixForParsing();
|
|
1082
|
+
this.couldPossiblyExtractAnotherNationalSignificantNumber = nationalPrefixForParsing && COMPLEX_NATIONAL_PREFIX.test(nationalPrefixForParsing);
|
|
1083
|
+
} else {
|
|
1084
|
+
this.hasSelectedNumberingPlan = void 0;
|
|
1085
|
+
this.couldPossiblyExtractAnotherNationalSignificantNumber = void 0;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
},
|
|
1089
|
+
{
|
|
1090
|
+
key: "extractNationalSignificantNumber",
|
|
1091
|
+
value: function extractNationalSignificantNumber(nationalDigits, setState) {
|
|
1092
|
+
if (!this.hasSelectedNumberingPlan) return;
|
|
1093
|
+
var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(nationalDigits, this.metadata), nationalPrefix = _extractNationalNumbe.nationalPrefix, nationalNumber = _extractNationalNumbe.nationalNumber, carrierCode = _extractNationalNumbe.carrierCode;
|
|
1094
|
+
if (nationalNumber === nationalDigits) return;
|
|
1095
|
+
this.onExtractedNationalNumber(nationalPrefix, carrierCode, nationalNumber, nationalDigits, setState);
|
|
1096
|
+
return true;
|
|
1097
|
+
}
|
|
1098
|
+
},
|
|
1099
|
+
{
|
|
1100
|
+
key: "extractAnotherNationalSignificantNumber",
|
|
1101
|
+
value: function extractAnotherNationalSignificantNumber(nationalDigits, prevNationalSignificantNumber, setState) {
|
|
1102
|
+
if (!this.hasExtractedNationalSignificantNumber) return this.extractNationalSignificantNumber(nationalDigits, setState);
|
|
1103
|
+
if (!this.couldPossiblyExtractAnotherNationalSignificantNumber) return;
|
|
1104
|
+
var _extractNationalNumbe2 = extractNationalNumberFromPossiblyIncompleteNumber(nationalDigits, this.metadata), nationalPrefix = _extractNationalNumbe2.nationalPrefix, nationalNumber = _extractNationalNumbe2.nationalNumber, carrierCode = _extractNationalNumbe2.carrierCode;
|
|
1105
|
+
/* istanbul ignore if */
|
|
1106
|
+
if (nationalNumber === prevNationalSignificantNumber) return;
|
|
1107
|
+
this.onExtractedNationalNumber(nationalPrefix, carrierCode, nationalNumber, nationalDigits, setState);
|
|
1108
|
+
return true;
|
|
1109
|
+
}
|
|
1110
|
+
},
|
|
1111
|
+
{
|
|
1112
|
+
key: "onExtractedNationalNumber",
|
|
1113
|
+
value: function onExtractedNationalNumber(nationalPrefix, carrierCode, nationalSignificantNumber, nationalDigits, setState) {
|
|
1114
|
+
var nationalSignificantNumberIsModified = false;
|
|
1115
|
+
var prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix;
|
|
1116
|
+
var nationalSignificantNumberIndex = nationalDigits.lastIndexOf(nationalSignificantNumber);
|
|
1117
|
+
if (nationalSignificantNumberIndex < 0 || nationalSignificantNumberIndex !== nationalDigits.length - nationalSignificantNumber.length) nationalSignificantNumberIsModified = true;
|
|
1118
|
+
else {
|
|
1119
|
+
var prefixBeforeNationalNumber = nationalDigits.slice(0, nationalSignificantNumberIndex);
|
|
1120
|
+
/* istanbul ignore if */
|
|
1121
|
+
if (prefixBeforeNationalNumber) {
|
|
1122
|
+
if (prefixBeforeNationalNumber !== nationalPrefix) prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix = prefixBeforeNationalNumber;
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
setState({
|
|
1126
|
+
nationalPrefix,
|
|
1127
|
+
carrierCode,
|
|
1128
|
+
nationalSignificantNumber,
|
|
1129
|
+
nationalSignificantNumberIsModified,
|
|
1130
|
+
prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix
|
|
1131
|
+
});
|
|
1132
|
+
this.hasExtractedNationalSignificantNumber = true;
|
|
1133
|
+
this.onNationalSignificantNumberChange();
|
|
1134
|
+
}
|
|
1135
|
+
},
|
|
1136
|
+
{
|
|
1137
|
+
key: "reExtractNationalSignificantNumber",
|
|
1138
|
+
value: function reExtractNationalSignificantNumber(state) {
|
|
1139
|
+
if (this.extractAnotherNationalSignificantNumber(state.getNationalDigits(), state.nationalSignificantNumber, function(stateUpdate) {
|
|
1140
|
+
return state.update(stateUpdate);
|
|
1141
|
+
})) return true;
|
|
1142
|
+
if (this.extractIddPrefix(state)) {
|
|
1143
|
+
this.extractCallingCodeAndNationalSignificantNumber(state);
|
|
1144
|
+
return true;
|
|
1145
|
+
}
|
|
1146
|
+
if (this.fixMissingPlus(state)) {
|
|
1147
|
+
this.extractCallingCodeAndNationalSignificantNumber(state);
|
|
1148
|
+
return true;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
},
|
|
1152
|
+
{
|
|
1153
|
+
key: "extractIddPrefix",
|
|
1154
|
+
value: function extractIddPrefix(state) {
|
|
1155
|
+
var international = state.international, IDDPrefix = state.IDDPrefix, digits = state.digits;
|
|
1156
|
+
state.nationalSignificantNumber;
|
|
1157
|
+
if (international || IDDPrefix) return;
|
|
1158
|
+
var numberWithoutIDD = stripIddPrefix(digits, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata);
|
|
1159
|
+
if (numberWithoutIDD !== void 0 && numberWithoutIDD !== digits) {
|
|
1160
|
+
state.update({ IDDPrefix: digits.slice(0, digits.length - numberWithoutIDD.length) });
|
|
1161
|
+
this.startInternationalNumber(state, {
|
|
1162
|
+
country: void 0,
|
|
1163
|
+
callingCode: void 0
|
|
1164
|
+
});
|
|
1165
|
+
return true;
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
},
|
|
1169
|
+
{
|
|
1170
|
+
key: "fixMissingPlus",
|
|
1171
|
+
value: function fixMissingPlus(state) {
|
|
1172
|
+
if (!state.international) {
|
|
1173
|
+
var newCallingCode = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(state.digits, state.country, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata).countryCallingCode;
|
|
1174
|
+
if (newCallingCode) {
|
|
1175
|
+
state.update({ missingPlus: true });
|
|
1176
|
+
this.startInternationalNumber(state, {
|
|
1177
|
+
country: state.country,
|
|
1178
|
+
callingCode: newCallingCode
|
|
1179
|
+
});
|
|
1180
|
+
return true;
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
},
|
|
1185
|
+
{
|
|
1186
|
+
key: "startInternationalNumber",
|
|
1187
|
+
value: function startInternationalNumber(state, _ref3) {
|
|
1188
|
+
var country = _ref3.country, callingCode = _ref3.callingCode;
|
|
1189
|
+
state.startInternationalNumber(country, callingCode);
|
|
1190
|
+
if (state.nationalSignificantNumber) {
|
|
1191
|
+
state.resetNationalSignificantNumber();
|
|
1192
|
+
this.onNationalSignificantNumberChange();
|
|
1193
|
+
this.hasExtractedNationalSignificantNumber = void 0;
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
},
|
|
1197
|
+
{
|
|
1198
|
+
key: "extractCallingCodeAndNationalSignificantNumber",
|
|
1199
|
+
value: function extractCallingCodeAndNationalSignificantNumber(state) {
|
|
1200
|
+
if (this.extractCountryCallingCode(state)) this.extractNationalSignificantNumber(state.getNationalDigits(), function(stateUpdate) {
|
|
1201
|
+
return state.update(stateUpdate);
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
]);
|
|
1206
|
+
}();
|
|
1207
|
+
function extractFormattedPhoneNumber(text) {
|
|
1208
|
+
var startsAt = text.search(VALID_FORMATTED_PHONE_NUMBER_PART);
|
|
1209
|
+
if (startsAt < 0) return;
|
|
1210
|
+
text = text.slice(startsAt);
|
|
1211
|
+
var hasPlus;
|
|
1212
|
+
if (text[0] === "+") {
|
|
1213
|
+
hasPlus = true;
|
|
1214
|
+
text = text.slice(1);
|
|
1215
|
+
}
|
|
1216
|
+
text = text.replace(AFTER_PHONE_NUMBER_DIGITS_END_PATTERN, "");
|
|
1217
|
+
if (hasPlus) text = "+" + text;
|
|
1218
|
+
return text;
|
|
1219
|
+
}
|
|
1220
|
+
/**
|
|
1221
|
+
* Extracts formatted phone number digits (and a `+`) from text (if there're any).
|
|
1222
|
+
* @param {string} text
|
|
1223
|
+
* @return {any[]}
|
|
1224
|
+
*/
|
|
1225
|
+
function _extractFormattedDigitsAndPlus(text) {
|
|
1226
|
+
var extractedNumber = extractFormattedPhoneNumber(text) || "";
|
|
1227
|
+
if (extractedNumber[0] === "+") return [extractedNumber.slice(1), true];
|
|
1228
|
+
return [extractedNumber];
|
|
1229
|
+
}
|
|
1230
|
+
/**
|
|
1231
|
+
* Extracts formatted phone number digits (and a `+`) from text (if there're any).
|
|
1232
|
+
* @param {string} text
|
|
1233
|
+
* @return {any[]}
|
|
1234
|
+
*/
|
|
1235
|
+
function extractFormattedDigitsAndPlus(text) {
|
|
1236
|
+
var _extractFormattedDigi4 = _slicedToArray$1(_extractFormattedDigitsAndPlus(text), 2), formattedDigits = _extractFormattedDigi4[0], hasPlus = _extractFormattedDigi4[1];
|
|
1237
|
+
if (!VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART_PATTERN.test(formattedDigits)) formattedDigits = "";
|
|
1238
|
+
return [formattedDigits, hasPlus];
|
|
1239
|
+
}
|
|
1240
|
+
//#endregion
|
|
1241
|
+
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/AsYouType.js
|
|
1242
|
+
function _typeof(o) {
|
|
1243
|
+
"@babel/helpers - typeof";
|
|
1244
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
1245
|
+
return typeof o;
|
|
1246
|
+
} : function(o) {
|
|
1247
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
1248
|
+
}, _typeof(o);
|
|
1249
|
+
}
|
|
1250
|
+
function _slicedToArray(r, e) {
|
|
1251
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
1252
|
+
}
|
|
1253
|
+
function _nonIterableRest() {
|
|
1254
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1255
|
+
}
|
|
1256
|
+
function _unsupportedIterableToArray(r, a) {
|
|
1257
|
+
if (r) {
|
|
1258
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
1259
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
1260
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
function _arrayLikeToArray(r, a) {
|
|
1264
|
+
(null == a || a > r.length) && (a = r.length);
|
|
1265
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
1266
|
+
return n;
|
|
1267
|
+
}
|
|
1268
|
+
function _iterableToArrayLimit(r, l) {
|
|
1269
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
1270
|
+
if (null != t) {
|
|
1271
|
+
var e, n, i, u, a = [], f = !0, o = !1;
|
|
1272
|
+
try {
|
|
1273
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
1274
|
+
if (Object(t) !== t) return;
|
|
1275
|
+
f = !1;
|
|
1276
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
1277
|
+
} catch (r) {
|
|
1278
|
+
o = !0, n = r;
|
|
1279
|
+
} finally {
|
|
1280
|
+
try {
|
|
1281
|
+
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
1282
|
+
} finally {
|
|
1283
|
+
if (o) throw n;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
return a;
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
function _arrayWithHoles(r) {
|
|
1290
|
+
if (Array.isArray(r)) return r;
|
|
1291
|
+
}
|
|
1292
|
+
function _classCallCheck(a, n) {
|
|
1293
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
1294
|
+
}
|
|
1295
|
+
function _defineProperties(e, r) {
|
|
1296
|
+
for (var t = 0; t < r.length; t++) {
|
|
1297
|
+
var o = r[t];
|
|
1298
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
function _createClass(e, r, t) {
|
|
1302
|
+
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
1303
|
+
}
|
|
1304
|
+
function _toPropertyKey(t) {
|
|
1305
|
+
var i = _toPrimitive(t, "string");
|
|
1306
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
1307
|
+
}
|
|
1308
|
+
function _toPrimitive(t, r) {
|
|
1309
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
1310
|
+
var e = t[Symbol.toPrimitive];
|
|
1311
|
+
if (void 0 !== e) {
|
|
1312
|
+
var i = e.call(t, r || "default");
|
|
1313
|
+
if ("object" != _typeof(i)) return i;
|
|
1314
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1315
|
+
}
|
|
1316
|
+
return ("string" === r ? String : Number)(t);
|
|
1317
|
+
}
|
|
1318
|
+
var USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;
|
|
1319
|
+
var AsYouType$1 = /*#__PURE__*/ function() {
|
|
1320
|
+
/**
|
|
1321
|
+
* @param {(string|object)?} [optionsOrDefaultCountry] - The default country used for parsing non-international phone numbers. Can also be an `options` object.
|
|
1322
|
+
* @param {Object} metadata
|
|
1323
|
+
*/
|
|
1324
|
+
function AsYouType(optionsOrDefaultCountry, metadata) {
|
|
1325
|
+
_classCallCheck(this, AsYouType);
|
|
1326
|
+
this.metadata = new Metadata(metadata);
|
|
1327
|
+
var _this$getCountryAndCa2 = _slicedToArray(this.getCountryAndCallingCode(optionsOrDefaultCountry), 2), defaultCountry = _this$getCountryAndCa2[0], defaultCallingCode = _this$getCountryAndCa2[1];
|
|
1328
|
+
this.defaultCountry = defaultCountry;
|
|
1329
|
+
this.defaultCallingCode = defaultCallingCode;
|
|
1330
|
+
this.reset();
|
|
1331
|
+
}
|
|
1332
|
+
return _createClass(AsYouType, [
|
|
1333
|
+
{
|
|
1334
|
+
key: "getCountryAndCallingCode",
|
|
1335
|
+
value: function getCountryAndCallingCode(optionsOrDefaultCountry) {
|
|
1336
|
+
var defaultCountry;
|
|
1337
|
+
var defaultCallingCode;
|
|
1338
|
+
if (optionsOrDefaultCountry) if (isObject(optionsOrDefaultCountry)) {
|
|
1339
|
+
defaultCountry = optionsOrDefaultCountry.defaultCountry;
|
|
1340
|
+
defaultCallingCode = optionsOrDefaultCountry.defaultCallingCode;
|
|
1341
|
+
} else defaultCountry = optionsOrDefaultCountry;
|
|
1342
|
+
if (defaultCountry && !this.metadata.hasCountry(defaultCountry)) defaultCountry = void 0;
|
|
1343
|
+
if (defaultCallingCode) {
|
|
1344
|
+
/* istanbul ignore if */
|
|
1345
|
+
if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {
|
|
1346
|
+
if (this.metadata.isNonGeographicCallingCode(defaultCallingCode)) defaultCountry = "001";
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
return [defaultCountry, defaultCallingCode];
|
|
1350
|
+
}
|
|
1351
|
+
},
|
|
1352
|
+
{
|
|
1353
|
+
key: "input",
|
|
1354
|
+
value: function input(text) {
|
|
1355
|
+
var _this$parser$input = this.parser.input(text, this.state), digits = _this$parser$input.digits;
|
|
1356
|
+
if (_this$parser$input.justLeadingPlus) this.formattedOutput = "+";
|
|
1357
|
+
else if (digits) {
|
|
1358
|
+
this.determineTheCountryIfNeeded();
|
|
1359
|
+
if (this.state.nationalSignificantNumber) this.formatter.narrowDownMatchingFormats(this.state);
|
|
1360
|
+
var formattedNationalNumber;
|
|
1361
|
+
if (this.metadata.hasSelectedNumberingPlan()) formattedNationalNumber = this.formatter.format(digits, this.state);
|
|
1362
|
+
if (formattedNationalNumber === void 0) {
|
|
1363
|
+
if (this.parser.reExtractNationalSignificantNumber(this.state)) {
|
|
1364
|
+
this.determineTheCountryIfNeeded();
|
|
1365
|
+
var nationalDigits = this.state.getNationalDigits();
|
|
1366
|
+
if (nationalDigits) formattedNationalNumber = this.formatter.format(nationalDigits, this.state);
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
this.formattedOutput = formattedNationalNumber ? this.getFullNumber(formattedNationalNumber) : this.getNonFormattedNumber();
|
|
1370
|
+
}
|
|
1371
|
+
return this.formattedOutput;
|
|
1372
|
+
}
|
|
1373
|
+
},
|
|
1374
|
+
{
|
|
1375
|
+
key: "reset",
|
|
1376
|
+
value: function reset() {
|
|
1377
|
+
var _this = this;
|
|
1378
|
+
this.state = new AsYouTypeState({
|
|
1379
|
+
onCountryChange: function onCountryChange(country) {
|
|
1380
|
+
_this.country = country;
|
|
1381
|
+
},
|
|
1382
|
+
onCallingCodeChange: function onCallingCodeChange(callingCode, country) {
|
|
1383
|
+
_this.metadata.selectNumberingPlan(country, callingCode);
|
|
1384
|
+
_this.formatter.reset(_this.metadata.numberingPlan, _this.state);
|
|
1385
|
+
_this.parser.reset(_this.metadata.numberingPlan);
|
|
1386
|
+
}
|
|
1387
|
+
});
|
|
1388
|
+
this.formatter = new AsYouTypeFormatter({
|
|
1389
|
+
state: this.state,
|
|
1390
|
+
metadata: this.metadata
|
|
1391
|
+
});
|
|
1392
|
+
this.parser = new AsYouTypeParser({
|
|
1393
|
+
defaultCountry: this.defaultCountry,
|
|
1394
|
+
defaultCallingCode: this.defaultCallingCode,
|
|
1395
|
+
metadata: this.metadata,
|
|
1396
|
+
state: this.state,
|
|
1397
|
+
onNationalSignificantNumberChange: function onNationalSignificantNumberChange() {
|
|
1398
|
+
_this.determineTheCountryIfNeeded();
|
|
1399
|
+
_this.formatter.reset(_this.metadata.numberingPlan, _this.state);
|
|
1400
|
+
}
|
|
1401
|
+
});
|
|
1402
|
+
this.state.reset({
|
|
1403
|
+
country: this.defaultCountry,
|
|
1404
|
+
callingCode: this.defaultCallingCode
|
|
1405
|
+
});
|
|
1406
|
+
this.formattedOutput = "";
|
|
1407
|
+
return this;
|
|
1408
|
+
}
|
|
1409
|
+
},
|
|
1410
|
+
{
|
|
1411
|
+
key: "isInternational",
|
|
1412
|
+
value: function isInternational() {
|
|
1413
|
+
return this.state.international;
|
|
1414
|
+
}
|
|
1415
|
+
},
|
|
1416
|
+
{
|
|
1417
|
+
key: "getCallingCode",
|
|
1418
|
+
value: function getCallingCode() {
|
|
1419
|
+
if (this.isInternational()) return this.state.callingCode;
|
|
1420
|
+
}
|
|
1421
|
+
},
|
|
1422
|
+
{
|
|
1423
|
+
key: "getCountryCallingCode",
|
|
1424
|
+
value: function getCountryCallingCode() {
|
|
1425
|
+
return this.getCallingCode();
|
|
1426
|
+
}
|
|
1427
|
+
},
|
|
1428
|
+
{
|
|
1429
|
+
key: "getCountry",
|
|
1430
|
+
value: function getCountry() {
|
|
1431
|
+
if (this.state.digits) return this._getCountry();
|
|
1432
|
+
}
|
|
1433
|
+
},
|
|
1434
|
+
{
|
|
1435
|
+
key: "_getCountry",
|
|
1436
|
+
value: function _getCountry() {
|
|
1437
|
+
var country = this.state.country;
|
|
1438
|
+
/* istanbul ignore if */
|
|
1439
|
+
if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {
|
|
1440
|
+
if (country === "001") return;
|
|
1441
|
+
}
|
|
1442
|
+
return country;
|
|
1443
|
+
}
|
|
1444
|
+
},
|
|
1445
|
+
{
|
|
1446
|
+
key: "determineTheCountryIfNeeded",
|
|
1447
|
+
value: function determineTheCountryIfNeeded() {
|
|
1448
|
+
if (!this.state.country || this.isCountryCallingCodeAmbiguous()) this.determineTheCountry();
|
|
1449
|
+
}
|
|
1450
|
+
},
|
|
1451
|
+
{
|
|
1452
|
+
key: "getFullNumber",
|
|
1453
|
+
value: function getFullNumber(formattedNationalNumber) {
|
|
1454
|
+
var _this2 = this;
|
|
1455
|
+
if (this.isInternational()) {
|
|
1456
|
+
var prefix = function prefix(text) {
|
|
1457
|
+
return _this2.formatter.getInternationalPrefixBeforeCountryCallingCode(_this2.state, { spacing: text ? true : false }) + text;
|
|
1458
|
+
};
|
|
1459
|
+
var callingCode = this.state.callingCode;
|
|
1460
|
+
if (!callingCode) return prefix("".concat(this.state.getDigitsWithoutInternationalPrefix()));
|
|
1461
|
+
if (!formattedNationalNumber) return prefix(callingCode);
|
|
1462
|
+
return prefix("".concat(callingCode, " ").concat(formattedNationalNumber));
|
|
1463
|
+
}
|
|
1464
|
+
return formattedNationalNumber;
|
|
1465
|
+
}
|
|
1466
|
+
},
|
|
1467
|
+
{
|
|
1468
|
+
key: "getNonFormattedNationalNumberWithPrefix",
|
|
1469
|
+
value: function getNonFormattedNationalNumberWithPrefix() {
|
|
1470
|
+
var _this$state = this.state, nationalSignificantNumber = _this$state.nationalSignificantNumber, prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix = _this$state.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix, nationalPrefix = _this$state.nationalPrefix;
|
|
1471
|
+
var number = nationalSignificantNumber;
|
|
1472
|
+
var prefix = prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix || nationalPrefix;
|
|
1473
|
+
if (prefix) number = prefix + number;
|
|
1474
|
+
return number;
|
|
1475
|
+
}
|
|
1476
|
+
},
|
|
1477
|
+
{
|
|
1478
|
+
key: "getNonFormattedNumber",
|
|
1479
|
+
value: function getNonFormattedNumber() {
|
|
1480
|
+
var nationalSignificantNumberIsModified = this.state.nationalSignificantNumberIsModified;
|
|
1481
|
+
return this.getFullNumber(nationalSignificantNumberIsModified ? this.state.getNationalDigits() : this.getNonFormattedNationalNumberWithPrefix());
|
|
1482
|
+
}
|
|
1483
|
+
},
|
|
1484
|
+
{
|
|
1485
|
+
key: "getNonFormattedTemplate",
|
|
1486
|
+
value: function getNonFormattedTemplate() {
|
|
1487
|
+
var number = this.getNonFormattedNumber();
|
|
1488
|
+
if (number) return number.replace(/[\+\d]/g, "x");
|
|
1489
|
+
}
|
|
1490
|
+
},
|
|
1491
|
+
{
|
|
1492
|
+
key: "isCountryCallingCodeAmbiguous",
|
|
1493
|
+
value: function isCountryCallingCodeAmbiguous() {
|
|
1494
|
+
var callingCode = this.state.callingCode;
|
|
1495
|
+
var countryCodes = this.metadata.getCountryCodesForCallingCode(callingCode);
|
|
1496
|
+
return countryCodes && countryCodes.length > 1;
|
|
1497
|
+
}
|
|
1498
|
+
},
|
|
1499
|
+
{
|
|
1500
|
+
key: "determineTheCountry",
|
|
1501
|
+
value: function determineTheCountry() {
|
|
1502
|
+
this.state.setCountry(getCountryByCallingCode(this.isInternational() ? this.state.callingCode : this.defaultCallingCode, {
|
|
1503
|
+
nationalNumber: this.state.nationalSignificantNumber,
|
|
1504
|
+
metadata: this.metadata
|
|
1505
|
+
}));
|
|
1506
|
+
}
|
|
1507
|
+
},
|
|
1508
|
+
{
|
|
1509
|
+
key: "getNumberValue",
|
|
1510
|
+
value: function getNumberValue() {
|
|
1511
|
+
var _this$state2 = this.state, digits = _this$state2.digits, callingCode = _this$state2.callingCode, country = _this$state2.country, nationalSignificantNumber = _this$state2.nationalSignificantNumber;
|
|
1512
|
+
if (!digits) return;
|
|
1513
|
+
if (this.isInternational()) if (callingCode) return "+" + callingCode + nationalSignificantNumber;
|
|
1514
|
+
else return "+" + digits;
|
|
1515
|
+
else if (country || callingCode) return "+" + (country ? this.metadata.countryCallingCode() : callingCode) + nationalSignificantNumber;
|
|
1516
|
+
}
|
|
1517
|
+
},
|
|
1518
|
+
{
|
|
1519
|
+
key: "getNumber",
|
|
1520
|
+
value: function getNumber() {
|
|
1521
|
+
var _this$state3 = this.state, nationalSignificantNumber = _this$state3.nationalSignificantNumber, carrierCode = _this$state3.carrierCode, callingCode = _this$state3.callingCode;
|
|
1522
|
+
var country = this._getCountry();
|
|
1523
|
+
if (!nationalSignificantNumber) return;
|
|
1524
|
+
if (!country && !callingCode) return;
|
|
1525
|
+
if (country) {
|
|
1526
|
+
if (country === this.defaultCountry) {
|
|
1527
|
+
var metadata = new Metadata(this.metadata.metadata);
|
|
1528
|
+
metadata.selectNumberingPlan(country);
|
|
1529
|
+
var _callingCode = metadata.numberingPlan.callingCode();
|
|
1530
|
+
var ambiguousCountries = this.metadata.getCountryCodesForCallingCode(_callingCode);
|
|
1531
|
+
if (ambiguousCountries.length > 1) {
|
|
1532
|
+
var exactCountry = getCountryByNationalNumber(nationalSignificantNumber, {
|
|
1533
|
+
countries: ambiguousCountries,
|
|
1534
|
+
metadata: this.metadata.metadata
|
|
1535
|
+
});
|
|
1536
|
+
if (exactCountry) country = exactCountry;
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
var phoneNumber = new PhoneNumber(country || callingCode, nationalSignificantNumber, this.metadata.metadata);
|
|
1541
|
+
if (carrierCode) phoneNumber.carrierCode = carrierCode;
|
|
1542
|
+
return phoneNumber;
|
|
1543
|
+
}
|
|
1544
|
+
},
|
|
1545
|
+
{
|
|
1546
|
+
key: "isPossible",
|
|
1547
|
+
value: function isPossible() {
|
|
1548
|
+
var phoneNumber = this.getNumber();
|
|
1549
|
+
if (!phoneNumber) return false;
|
|
1550
|
+
return phoneNumber.isPossible();
|
|
1551
|
+
}
|
|
1552
|
+
},
|
|
1553
|
+
{
|
|
1554
|
+
key: "isValid",
|
|
1555
|
+
value: function isValid() {
|
|
1556
|
+
var phoneNumber = this.getNumber();
|
|
1557
|
+
if (!phoneNumber) return false;
|
|
1558
|
+
return phoneNumber.isValid();
|
|
1559
|
+
}
|
|
1560
|
+
},
|
|
1561
|
+
{
|
|
1562
|
+
key: "getNationalNumber",
|
|
1563
|
+
value: function getNationalNumber() {
|
|
1564
|
+
return this.state.nationalSignificantNumber;
|
|
1565
|
+
}
|
|
1566
|
+
},
|
|
1567
|
+
{
|
|
1568
|
+
key: "getChars",
|
|
1569
|
+
value: function getChars() {
|
|
1570
|
+
return (this.state.international ? "+" : "") + this.state.digits;
|
|
1571
|
+
}
|
|
1572
|
+
},
|
|
1573
|
+
{
|
|
1574
|
+
key: "getTemplate",
|
|
1575
|
+
value: function getTemplate() {
|
|
1576
|
+
return this.formatter.getTemplate(this.state) || this.getNonFormattedTemplate() || "";
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
]);
|
|
1580
|
+
}();
|
|
1581
|
+
//#endregion
|
|
1582
|
+
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/getExampleNumber.js
|
|
1583
|
+
function getExampleNumber$1(country, examples, metadata) {
|
|
1584
|
+
if (examples[country]) return new PhoneNumber(country, examples[country], metadata);
|
|
1585
|
+
}
|
|
1586
|
+
//#endregion
|
|
1587
|
+
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/min/exports/AsYouType.js
|
|
1588
|
+
function AsYouType(country) {
|
|
1589
|
+
return AsYouType$1.call(this, country, metadata_min_json_default);
|
|
1590
|
+
}
|
|
1591
|
+
AsYouType.prototype = Object.create(AsYouType$1.prototype, {});
|
|
1592
|
+
AsYouType.prototype.constructor = AsYouType;
|
|
1593
|
+
//#endregion
|
|
1594
|
+
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/min/exports/getCountryCallingCode.js
|
|
1595
|
+
function getCountryCallingCode() {
|
|
1596
|
+
return withMetadataArgument(getCountryCallingCode$1, arguments);
|
|
1597
|
+
}
|
|
1598
|
+
//#endregion
|
|
1599
|
+
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/min/exports/getExampleNumber.js
|
|
1600
|
+
function getExampleNumber() {
|
|
1601
|
+
return withMetadataArgument(getExampleNumber$1, arguments);
|
|
1602
|
+
}
|
|
1603
|
+
//#endregion
|
|
1604
|
+
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/examples.mobile.json.js
|
|
1605
|
+
var examples_mobile_json_default = {
|
|
1606
|
+
"AC": "40123",
|
|
1607
|
+
"AD": "312345",
|
|
1608
|
+
"AE": "501234567",
|
|
1609
|
+
"AF": "701234567",
|
|
1610
|
+
"AG": "2684641234",
|
|
1611
|
+
"AI": "2642351234",
|
|
1612
|
+
"AL": "672123456",
|
|
1613
|
+
"AM": "77123456",
|
|
1614
|
+
"AO": "923123456",
|
|
1615
|
+
"AR": "91123456789",
|
|
1616
|
+
"AS": "6847331234",
|
|
1617
|
+
"AT": "664123456",
|
|
1618
|
+
"AU": "412345678",
|
|
1619
|
+
"AW": "5601234",
|
|
1620
|
+
"AX": "412345678",
|
|
1621
|
+
"AZ": "401234567",
|
|
1622
|
+
"BA": "61123456",
|
|
1623
|
+
"BB": "2462501234",
|
|
1624
|
+
"BD": "1812345678",
|
|
1625
|
+
"BE": "470123456",
|
|
1626
|
+
"BF": "70123456",
|
|
1627
|
+
"BG": "43012345",
|
|
1628
|
+
"BH": "36001234",
|
|
1629
|
+
"BI": "79561234",
|
|
1630
|
+
"BJ": "0195123456",
|
|
1631
|
+
"BL": "690001234",
|
|
1632
|
+
"BM": "4413701234",
|
|
1633
|
+
"BN": "7123456",
|
|
1634
|
+
"BO": "71234567",
|
|
1635
|
+
"BQ": "3181234",
|
|
1636
|
+
"BR": "11961234567",
|
|
1637
|
+
"BS": "2423591234",
|
|
1638
|
+
"BT": "17123456",
|
|
1639
|
+
"BW": "71123456",
|
|
1640
|
+
"BY": "294911911",
|
|
1641
|
+
"BZ": "6221234",
|
|
1642
|
+
"CA": "5062345678",
|
|
1643
|
+
"CC": "412345678",
|
|
1644
|
+
"CD": "991234567",
|
|
1645
|
+
"CF": "70012345",
|
|
1646
|
+
"CG": "061234567",
|
|
1647
|
+
"CH": "781234567",
|
|
1648
|
+
"CI": "0123456789",
|
|
1649
|
+
"CK": "71234",
|
|
1650
|
+
"CL": "221234567",
|
|
1651
|
+
"CM": "671234567",
|
|
1652
|
+
"CN": "13123456789",
|
|
1653
|
+
"CO": "3211234567",
|
|
1654
|
+
"CR": "83123456",
|
|
1655
|
+
"CU": "51234567",
|
|
1656
|
+
"CV": "9911234",
|
|
1657
|
+
"CW": "95181234",
|
|
1658
|
+
"CX": "412345678",
|
|
1659
|
+
"CY": "96123456",
|
|
1660
|
+
"CZ": "601123456",
|
|
1661
|
+
"DE": "15123456789",
|
|
1662
|
+
"DJ": "77831001",
|
|
1663
|
+
"DK": "34412345",
|
|
1664
|
+
"DM": "7672251234",
|
|
1665
|
+
"DO": "8092345678",
|
|
1666
|
+
"DZ": "551234567",
|
|
1667
|
+
"EC": "991234567",
|
|
1668
|
+
"EE": "51234567",
|
|
1669
|
+
"EG": "1001234567",
|
|
1670
|
+
"EH": "650123456",
|
|
1671
|
+
"ER": "7123456",
|
|
1672
|
+
"ES": "612345678",
|
|
1673
|
+
"ET": "911234567",
|
|
1674
|
+
"FI": "412345678",
|
|
1675
|
+
"FJ": "7012345",
|
|
1676
|
+
"FK": "51234",
|
|
1677
|
+
"FM": "3501234",
|
|
1678
|
+
"FO": "211234",
|
|
1679
|
+
"FR": "612345678",
|
|
1680
|
+
"GA": "06031234",
|
|
1681
|
+
"GB": "7400123456",
|
|
1682
|
+
"GD": "4734031234",
|
|
1683
|
+
"GE": "555123456",
|
|
1684
|
+
"GF": "694201234",
|
|
1685
|
+
"GG": "7781123456",
|
|
1686
|
+
"GH": "231234567",
|
|
1687
|
+
"GI": "57123456",
|
|
1688
|
+
"GL": "221234",
|
|
1689
|
+
"GM": "3012345",
|
|
1690
|
+
"GN": "601123456",
|
|
1691
|
+
"GP": "690001234",
|
|
1692
|
+
"GQ": "222123456",
|
|
1693
|
+
"GR": "6912345678",
|
|
1694
|
+
"GT": "51234567",
|
|
1695
|
+
"GU": "6713001234",
|
|
1696
|
+
"GW": "955012345",
|
|
1697
|
+
"GY": "6091234",
|
|
1698
|
+
"HK": "51234567",
|
|
1699
|
+
"HN": "91234567",
|
|
1700
|
+
"HR": "921234567",
|
|
1701
|
+
"HT": "34101234",
|
|
1702
|
+
"HU": "201234567",
|
|
1703
|
+
"ID": "812345678",
|
|
1704
|
+
"IE": "850123456",
|
|
1705
|
+
"IL": "502345678",
|
|
1706
|
+
"IM": "7924123456",
|
|
1707
|
+
"IN": "8123456789",
|
|
1708
|
+
"IO": "3801234",
|
|
1709
|
+
"IQ": "7912345678",
|
|
1710
|
+
"IR": "9123456789",
|
|
1711
|
+
"IS": "6111234",
|
|
1712
|
+
"IT": "3123456789",
|
|
1713
|
+
"JE": "7797712345",
|
|
1714
|
+
"JM": "8762101234",
|
|
1715
|
+
"JO": "790123456",
|
|
1716
|
+
"JP": "9012345678",
|
|
1717
|
+
"KE": "712123456",
|
|
1718
|
+
"KG": "700123456",
|
|
1719
|
+
"KH": "91234567",
|
|
1720
|
+
"KI": "72001234",
|
|
1721
|
+
"KM": "3212345",
|
|
1722
|
+
"KN": "8697652917",
|
|
1723
|
+
"KP": "1921234567",
|
|
1724
|
+
"KR": "1020000000",
|
|
1725
|
+
"KW": "50012345",
|
|
1726
|
+
"KY": "3453231234",
|
|
1727
|
+
"KZ": "7710009998",
|
|
1728
|
+
"LA": "2023123456",
|
|
1729
|
+
"LB": "71123456",
|
|
1730
|
+
"LC": "7582845678",
|
|
1731
|
+
"LI": "660234567",
|
|
1732
|
+
"LK": "712345678",
|
|
1733
|
+
"LR": "770123456",
|
|
1734
|
+
"LS": "50123456",
|
|
1735
|
+
"LT": "61234567",
|
|
1736
|
+
"LU": "628123456",
|
|
1737
|
+
"LV": "21234567",
|
|
1738
|
+
"LY": "912345678",
|
|
1739
|
+
"MA": "650123456",
|
|
1740
|
+
"MC": "612345678",
|
|
1741
|
+
"MD": "62112345",
|
|
1742
|
+
"ME": "60123456",
|
|
1743
|
+
"MF": "690001234",
|
|
1744
|
+
"MG": "321234567",
|
|
1745
|
+
"MH": "2351234",
|
|
1746
|
+
"MK": "72345678",
|
|
1747
|
+
"ML": "65012345",
|
|
1748
|
+
"MM": "92123456",
|
|
1749
|
+
"MN": "88123456",
|
|
1750
|
+
"MO": "66123456",
|
|
1751
|
+
"MP": "6702345678",
|
|
1752
|
+
"MQ": "696201234",
|
|
1753
|
+
"MR": "22123456",
|
|
1754
|
+
"MS": "6644923456",
|
|
1755
|
+
"MT": "96961234",
|
|
1756
|
+
"MU": "52512345",
|
|
1757
|
+
"MV": "7712345",
|
|
1758
|
+
"MW": "991234567",
|
|
1759
|
+
"MX": "2221234567",
|
|
1760
|
+
"MY": "123456789",
|
|
1761
|
+
"MZ": "821234567",
|
|
1762
|
+
"NA": "811234567",
|
|
1763
|
+
"NC": "751234",
|
|
1764
|
+
"NE": "93123456",
|
|
1765
|
+
"NF": "381234",
|
|
1766
|
+
"NG": "8021234567",
|
|
1767
|
+
"NI": "81234567",
|
|
1768
|
+
"NL": "612345678",
|
|
1769
|
+
"NO": "40612345",
|
|
1770
|
+
"NP": "9841234567",
|
|
1771
|
+
"NR": "5551234",
|
|
1772
|
+
"NU": "8884012",
|
|
1773
|
+
"NZ": "211234567",
|
|
1774
|
+
"OM": "92123456",
|
|
1775
|
+
"PA": "61234567",
|
|
1776
|
+
"PE": "912345678",
|
|
1777
|
+
"PF": "87123456",
|
|
1778
|
+
"PG": "70123456",
|
|
1779
|
+
"PH": "9051234567",
|
|
1780
|
+
"PK": "3012345678",
|
|
1781
|
+
"PL": "512345678",
|
|
1782
|
+
"PM": "551234",
|
|
1783
|
+
"PR": "7872345678",
|
|
1784
|
+
"PS": "599123456",
|
|
1785
|
+
"PT": "912345678",
|
|
1786
|
+
"PW": "6201234",
|
|
1787
|
+
"PY": "961456789",
|
|
1788
|
+
"QA": "33123456",
|
|
1789
|
+
"RE": "692123456",
|
|
1790
|
+
"RO": "712034567",
|
|
1791
|
+
"RS": "601234567",
|
|
1792
|
+
"RU": "9123456789",
|
|
1793
|
+
"RW": "720123456",
|
|
1794
|
+
"SA": "512345678",
|
|
1795
|
+
"SB": "7421234",
|
|
1796
|
+
"SC": "2510123",
|
|
1797
|
+
"SD": "911231234",
|
|
1798
|
+
"SE": "701234567",
|
|
1799
|
+
"SG": "81234567",
|
|
1800
|
+
"SH": "51234",
|
|
1801
|
+
"SI": "31234567",
|
|
1802
|
+
"SJ": "41234567",
|
|
1803
|
+
"SK": "912123456",
|
|
1804
|
+
"SL": "25123456",
|
|
1805
|
+
"SM": "66661212",
|
|
1806
|
+
"SN": "701234567",
|
|
1807
|
+
"SO": "71123456",
|
|
1808
|
+
"SR": "7412345",
|
|
1809
|
+
"SS": "977123456",
|
|
1810
|
+
"ST": "9812345",
|
|
1811
|
+
"SV": "70123456",
|
|
1812
|
+
"SX": "7215205678",
|
|
1813
|
+
"SY": "944567890",
|
|
1814
|
+
"SZ": "76123456",
|
|
1815
|
+
"TA": "8999",
|
|
1816
|
+
"TC": "6492311234",
|
|
1817
|
+
"TD": "63012345",
|
|
1818
|
+
"TG": "90112345",
|
|
1819
|
+
"TH": "812345678",
|
|
1820
|
+
"TJ": "917123456",
|
|
1821
|
+
"TK": "7290",
|
|
1822
|
+
"TL": "77212345",
|
|
1823
|
+
"TM": "66123456",
|
|
1824
|
+
"TN": "20123456",
|
|
1825
|
+
"TO": "7715123",
|
|
1826
|
+
"TR": "5012345678",
|
|
1827
|
+
"TT": "8682911234",
|
|
1828
|
+
"TV": "901234",
|
|
1829
|
+
"TW": "912345678",
|
|
1830
|
+
"TZ": "621234567",
|
|
1831
|
+
"UA": "501234567",
|
|
1832
|
+
"UG": "712345678",
|
|
1833
|
+
"US": "2015550123",
|
|
1834
|
+
"UY": "94231234",
|
|
1835
|
+
"UZ": "912345678",
|
|
1836
|
+
"VA": "3123456789",
|
|
1837
|
+
"VC": "7844301234",
|
|
1838
|
+
"VE": "4121234567",
|
|
1839
|
+
"VG": "2843001234",
|
|
1840
|
+
"VI": "3406421234",
|
|
1841
|
+
"VN": "912345678",
|
|
1842
|
+
"VU": "5912345",
|
|
1843
|
+
"WF": "821234",
|
|
1844
|
+
"WS": "7212345",
|
|
1845
|
+
"XK": "43201234",
|
|
1846
|
+
"YE": "712345678",
|
|
1847
|
+
"YT": "639012345",
|
|
1848
|
+
"ZA": "711234567",
|
|
1849
|
+
"ZM": "955123456",
|
|
1850
|
+
"ZW": "712345678"
|
|
1851
|
+
};
|
|
1852
|
+
//#endregion
|
|
1853
|
+
//#region ../infra/src/providers/browser/PhoneFormattingProvider.ts
|
|
1854
|
+
function stripTrunkPrefix(formatted, nationalNumber) {
|
|
1855
|
+
const formattedDigits = formatted.replace(/\D/g, "");
|
|
1856
|
+
if (formattedDigits === nationalNumber) return formatted;
|
|
1857
|
+
if (!formattedDigits.endsWith(nationalNumber)) return null;
|
|
1858
|
+
const trunkLen = formattedDigits.length - nationalNumber.length;
|
|
1859
|
+
if (trunkLen <= 0) return formatted;
|
|
1860
|
+
const bare = formatted.replace(/[()]/g, "");
|
|
1861
|
+
let digitsSeen = 0;
|
|
1862
|
+
for (let i = 0; i < bare.length; i++) if (/\d/.test(bare[i])) {
|
|
1863
|
+
digitsSeen++;
|
|
1864
|
+
if (digitsSeen === trunkLen) return bare.slice(i + 1).replace(/^\D+/, "");
|
|
1865
|
+
}
|
|
1866
|
+
return formatted;
|
|
1867
|
+
}
|
|
1868
|
+
var PhoneFormattingProvider = class {
|
|
1869
|
+
getCallingCode(country) {
|
|
1870
|
+
try {
|
|
1871
|
+
return `+${getCountryCallingCode(country)}`;
|
|
1872
|
+
} catch {
|
|
1873
|
+
return "";
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
formatAsYouType(nationalDigits, country) {
|
|
1877
|
+
const callingCode = this.getCallingCode(country);
|
|
1878
|
+
return new AsYouType(country).input(`${callingCode}${nationalDigits}`).replace(callingCode, "").trimStart();
|
|
1879
|
+
}
|
|
1880
|
+
formatExampleNumber(country) {
|
|
1881
|
+
const example = getExampleNumber(country, examples_mobile_json_default);
|
|
1882
|
+
if (!example) return "";
|
|
1883
|
+
return stripTrunkPrefix(example.formatNational(), example.nationalNumber) || this.formatAsYouType(example.nationalNumber, country);
|
|
1884
|
+
}
|
|
1885
|
+
parse(phone) {
|
|
1886
|
+
const parsed = parsePhoneNumber$1(phone);
|
|
1887
|
+
if (!parsed?.isValid() || !parsed.country) return null;
|
|
1888
|
+
return {
|
|
1889
|
+
country: parsed.country,
|
|
1890
|
+
national: new AsYouType(parsed.country).input(parsed.nationalNumber)
|
|
1891
|
+
};
|
|
1892
|
+
}
|
|
1893
|
+
};
|
|
1894
|
+
//#endregion
|
|
1895
|
+
//#region src/modules/phone-number/phoneNumber.ts
|
|
1896
|
+
const formatting = new PhoneFormattingProvider();
|
|
1897
|
+
const validation = new PhoneValidationProvider();
|
|
1898
|
+
/** Returns `+52` for `MX`, or an empty string for a country with no phone metadata. */
|
|
1899
|
+
function getCallingCode(country) {
|
|
1900
|
+
return formatting.getCallingCode(country);
|
|
1901
|
+
}
|
|
1902
|
+
/** Formats national digits while the user types them, without the calling code. */
|
|
1903
|
+
function formatPhoneAsYouType(nationalDigits, country) {
|
|
1904
|
+
return formatting.formatAsYouType(nationalDigits, country);
|
|
1905
|
+
}
|
|
1906
|
+
/** Returns an example mobile number in national format, without a trunk prefix. */
|
|
1907
|
+
function formatExamplePhoneNumber(country) {
|
|
1908
|
+
return formatting.formatExampleNumber(country);
|
|
1909
|
+
}
|
|
1910
|
+
/**
|
|
1911
|
+
* Finds the country of a valid international number (`+12025550123`) and
|
|
1912
|
+
* formats its national part. Returns `null` when the number is not valid.
|
|
1913
|
+
*/
|
|
1914
|
+
function parsePhoneNumber(phone) {
|
|
1915
|
+
return formatting.parse(phone);
|
|
1916
|
+
}
|
|
1917
|
+
/** Checks a full international number against the rules of `country`. */
|
|
1918
|
+
function isValidPhoneNumber(phone, country) {
|
|
1919
|
+
return validation.isValid(phone, country);
|
|
1920
|
+
}
|
|
1921
|
+
//#endregion
|
|
1922
|
+
export { formatExamplePhoneNumber, formatPhoneAsYouType, getCallingCode, isValidPhoneNumber, parsePhoneNumber };
|