@incodetech/web 2.3.2 → 2.4.0-rc.1
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 +0 -3
- package/dist/GeolocationPermissionDenied-BFMCy-vh.js +444 -0
- package/dist/ae-signature/ae-signature.es.js +3 -3
- package/dist/{af-ZA-OntsEubt.js → af-ZA-BrjGHv_T.js} +33 -6
- package/dist/ageVerification-DGLniT4Y.js +77 -0
- package/dist/{am-yUcnt3vq.js → am-DE3X3yyA.js} +33 -6
- package/dist/antifraud/antifraud.es.js +3 -3
- package/dist/antifraud/styles.css +0 -1
- package/dist/{ar-AE-BfxiKovT.js → ar-AE-CMTI-_Uo.js} +34 -7
- package/dist/{ar-57Dd-l4I.js → ar-BNacVOWD.js} +34 -7
- package/dist/{ar-EG-BgDjHJBi.js → ar-EG-D9uwNPoU.js} +33 -6
- package/dist/authentication/authentication.es.js +4 -4
- package/dist/{autoFocusTitle-DebebrwQ.js → autoFocusTitle-shYRUp-4.js} +1 -1
- package/dist/{az-dT363k-q.js → az-Wr9zZpTx.js} +33 -6
- package/dist/back-horizontal-hint-BztyPanp.js +134 -0
- package/dist/back-vertical-hint-BSzA4QbJ.js +127 -0
- package/dist/base.css +1 -7230
- package/dist/{baseTutorial-CyVBbj9b.js → baseTutorial-D_Jq0Kz2.js} +13 -24
- package/dist/{bn-CKZ00roT.js → bn-C_dbLk3y.js} +33 -6
- package/dist/{bottomSheet-DpSr7d9-.js → bottomSheet-Cdwz_7C5.js} +2 -2
- package/dist/{bs-BnLdLnmZ.js → bs-C30W6le2.js} +33 -6
- package/dist/{ca-D3PGkuQc.js → ca-5-jdy0XG.js} +33 -6
- package/dist/cameraOverlay-rWy5OHQK.js +2 -0
- package/dist/cameraOverlayHeader-DUwk9XJR.js +83 -0
- package/dist/{cameraView-CoWyMnTT.js → cameraView-DJhoELeE.js} +2 -2
- package/dist/{ceb-R-2VANeF.js → ceb-D91AsHCc.js} +33 -6
- package/dist/certificate-issuance/certificate-issuance.es.js +9 -8
- package/dist/certificate-issuance/styles.css +1 -72
- package/dist/certificate-issuance/styles.css.js +1 -1
- package/dist/check-icon-BpjpKqhJ.js +48 -0
- package/dist/{checkbox-CNc8kQS0.js → checkbox-BCr_W3eL.js} +2 -2
- package/dist/connectionError-D4qOfYzz.js +45 -0
- package/dist/consent/consent.es.js +8 -6
- package/dist/consent/styles.css +1 -129
- package/dist/consent/styles.css.js +1 -1
- package/dist/countryDefinitions-BO9OSKQO.js +555 -0
- package/dist/countryFlag-2Vj85OIZ.js +67 -0
- package/dist/{countrySelector-BlC5_2rW.js → countrySelector-ck-DQ89q.js} +6 -5
- package/dist/cross-document-data-match/cross-document-data-match.es.js +3 -3
- package/dist/{cs-bm9MEri0.js → cs-C4eEOpdT.js} +33 -6
- package/dist/{cs-CZ-CEidLhWp.js → cs-CZ-DiJ5MEfY.js} +33 -6
- package/dist/curp-validation/curp-validation.es.js +13 -11
- package/dist/curp-validation/styles.css +1 -128
- package/dist/curp-validation/styles.css.js +1 -1
- package/dist/custom-fields/styles.css +1 -21
- package/dist/custom-fields/styles.css.js +1 -1
- package/dist/{customFields-C_iIhQYG.js → customFields-CihI8HLg.js} +10 -9
- package/dist/{customWatchlist-utPTNwCU.js → customWatchlist-avefsmET.js} +6 -6
- package/dist/{da-DK-BuSuFTsg.js → da-DK-C3zlFkKn.js} +33 -6
- package/dist/{dashboardTheme-DdWs3tlN.js → dashboardTheme-CL3jdGes.js} +1 -1
- package/dist/dateInputComposed-9c_0YlmT.js +1 -0
- package/dist/{dateInputComposed-CylyZPCj.js → dateInputComposed-BNmac2I-.js} +4 -4
- package/dist/{de-BCPdribE.js → de-BefcT58V.js} +33 -6
- package/dist/denied-Cs9yuLM4.js +1871 -0
- package/dist/deviceWallet-B0fJl22u.js +66 -0
- package/dist/digitalIdRedirect-BMakPQkG.js +162 -0
- package/dist/digitalIdUpload-D39gUOUa.js +496 -0
- package/dist/document-capture/document-capture.es.js +1 -1
- package/dist/document-capture/styles.css +1 -378
- package/dist/document-capture/styles.css.js +1 -1
- package/dist/{documentCapture-BrhKPBNZ.js → documentCapture-64bza6r6.js} +127 -180
- package/dist/documentCapture-D_cQ0luo.js +2 -0
- package/dist/{dropdownComposed-B0WxIm-I.js → dropdownComposed-DMsLAeKB.js} +8 -14
- package/dist/dropdownComposed-MlXFSguX.js +1 -0
- package/dist/dynamic-forms/dynamic-forms.es.js +13 -12
- package/dist/dynamic-forms/styles.css +1 -104
- package/dist/dynamic-forms/styles.css.js +1 -1
- package/dist/ekyb/ekyb.es.js +1 -1
- package/dist/ekyb/styles.css +1 -113
- package/dist/ekyb/styles.css.js +1 -1
- package/dist/ekybModule-B1gUqxgm.js +2 -0
- package/dist/{ekybModule-BwD2ohHx.js → ekybModule-ChOhP6uM.js} +13 -12
- package/dist/ekyc/ekyc.es.js +1 -1
- package/dist/ekyc/styles.css +1 -108
- package/dist/ekyc/styles.css.js +1 -1
- package/dist/{ekycModule-Y9GYfYAt.js → ekycModule-4q3A2JP3.js} +46 -14
- package/dist/ekycModule-DTIkPJjl.js +2 -0
- package/dist/{el-60ThHM2U.js → el-BqLmhuTU.js} +34 -7
- package/dist/{el-GR-D6WIhwC3.js → el-GR-BN31SzAR.js} +33 -6
- package/dist/electronic-signature/electronic-signature.es.js +1 -1
- package/dist/electronic-signature/styles.css +1 -407
- package/dist/electronic-signature/styles.css.js +1 -1
- package/dist/{electronic-signature-Bmn4AOpj.js → electronic-signature-Dhw2cLem.js} +24 -21
- package/dist/email/email.es.js +8 -7
- package/dist/email/styles.css +1 -11
- package/dist/email/styles.css.js +1 -1
- package/dist/{emailInput-DgQXpURU.js → emailInput-yOCErcEc.js} +3 -3
- package/dist/{en-ISV8KwbL.js → en-CJnRQ8fU.js} +33 -6
- package/dist/{en-DG-Crvtj3p2.js → en-DG-Dx4B_KVS.js} +33 -6
- package/dist/{errorContent-XVdZTMAl.js → errorContent-mqhVNRSO.js} +5 -5
- package/dist/{es-419-pXqNpSti.js → es-419-Dl-olR1G.js} +33 -6
- package/dist/{es-1QCV_aoe.js → es-BZmJSsux.js} +33 -6
- package/dist/{es-ES-BIYzpL_B.js → es-ES-1YZMu7Kf.js} +33 -6
- package/dist/{es-MX-Cih_nZPr.js → es-MX-CyxCkl1y.js} +33 -6
- package/dist/esm-15CISqPe.js +430 -0
- package/dist/{et-CgCGIoIQ.js → et-C1S6VW9K.js} +33 -6
- package/dist/{expiredId-BhQM_AcZ.js → expiredId-DfqiC9HI.js} +6 -6
- package/dist/extensibility.es.js +38 -36
- package/dist/{fa-IR-YnGtqwsy.js → fa-IR-BPyBkaiF.js} +33 -6
- package/dist/face-match/face-match.es.js +1 -1
- package/dist/face-match/styles.css +1 -535
- package/dist/face-match/styles.css.js +1 -1
- package/dist/faceMatch-BgN3CPdN.js +2 -0
- package/dist/faceMatch-UbygvNeb.js +336 -0
- package/dist/{fi-FI-3XXKPtj1.js → fi-FI-CfKLgU-O.js} +33 -6
- package/dist/field-comparison/field-comparison.es.js +1 -1
- package/dist/field-comparison/styles.css +1 -27
- package/dist/field-comparison/styles.css.js +1 -1
- package/dist/fieldComparison-CNaAVsGY.js +2 -0
- package/dist/{fieldComparison-D7rZ657j.js → fieldComparison-CmRsH7pg.js} +13 -7
- package/dist/finalSuccessScreen-2-RZENUP.js +500 -0
- package/dist/fiscal-qr/fiscal-qr.es.js +28 -23
- package/dist/fiscal-qr/styles.css +1 -82
- package/dist/fiscal-qr/styles.css.js +1 -1
- package/dist/{flipAnimation-BGXItWj0.js → flipAnimation-DI5Gw5Ks.js} +643 -355
- package/dist/flow/flow.es.js +41 -24
- package/dist/flow/shell/styles.css +1 -401
- package/dist/flow/shell/styles.css.js +1 -1
- package/dist/flow/styles.css +1 -5702
- package/dist/{formField-Cf25rdkJ.js → formField-2VLEaztk.js} +2 -2
- package/dist/{fr-CA-DULWz0cf.js → fr-CA-BJlED1CS.js} +33 -6
- package/dist/{fr-BwDYP0LQ.js → fr-yKqRZbZ6.js} +33 -6
- package/dist/front-horizontal-hint-DEHmtcdg.js +379 -0
- package/dist/{front-vertical-hint-qXMVdLri.js → front-vertical-hint-Cb1NO-xT.js} +71 -72
- package/dist/geolocation/geolocation.es.js +26 -459
- package/dist/geolocation/styles.css +1 -165
- package/dist/geolocation/styles.css.js +1 -1
- package/dist/government-validation/government-validation.es.js +15 -13
- package/dist/government-validation/styles.css +1 -4
- package/dist/government-validation/styles.css.js +1 -1
- package/dist/{he-BZVxeCzZ.js → he-Dr88a3D5.js} +33 -6
- package/dist/{hi-Bp8GM653.js → hi-ac5Rf53r.js} +33 -6
- package/dist/{hmn-Bj6F8ToZ.js → hmn-bwkkfetx.js} +33 -6
- package/dist/{homeScreen-eYD0Zo8Y.js → homeScreen-BezGnGit.js} +10 -11
- package/dist/{hr-uz9DXHS8.js → hr-CHcVE152.js} +33 -6
- package/dist/{ht-BGd4L5Je.js → ht-IPMniPpi.js} +33 -6
- package/dist/{hu-BvTVDhN5.js → hu-CG5ZOzy2.js} +33 -6
- package/dist/icons-CSP6Tne6.js +535 -0
- package/dist/id/id.es.js +315 -1174
- package/dist/id/styles.css +1 -1691
- package/dist/id/styles.css.js +1 -1
- package/dist/{id-D0EG-hya.js → id-DYinFjLQ.js} +33 -6
- package/dist/id-back-of-card-C7Au2tqk.js +71 -0
- package/dist/id-back-of-card-vertical-CtQBFw8w.js +74 -0
- package/dist/id-front-of-card-BmHL_keG.js +305 -0
- package/dist/id-front-of-card-vertical-DkNUn2Vx.js +253 -0
- package/dist/id-ocr/styles.css +1 -55
- package/dist/id-ocr/styles.css.js +1 -1
- package/dist/id-selfie-flow/id-selfie-flow.es.js +12 -9
- package/dist/id-selfie-flow/styles.css +1 -780
- package/dist/id-verification/id-verification.es.js +6 -5
- package/dist/{idOcr-66OmIUeD.js → idOcr-DN1gTAJ7.js} +12 -11
- package/dist/identity-reuse/identity-reuse.es.js +167 -139
- package/dist/identity-reuse/styles.css +1 -216
- package/dist/incode-logo-DIujvtwd.js +341 -0
- package/dist/{incodeComponent--XJZ07QN.js → incodeComponent-WXvcRKkM.js} +147 -269
- package/dist/incodeModule-DsWO19Nv.js +68 -0
- package/dist/index.es.js +4 -3
- package/dist/{inputComposed-ByIWAPSr.js → inputComposed-D-WVQEpg.js} +2 -2
- package/dist/inputComposed-Dca8NJxF.js +1 -0
- package/dist/{it-DWY7_sYa.js → it-pBVnbw9L.js} +34 -7
- package/dist/{ja-z6DqLSKX.js → ja-BtG6-Vh2.js} +33 -6
- package/dist/{ja-JP-DvHAizEm.js → ja-JP-CuWo_Mj3.js} +33 -6
- package/dist/{jv-CkRJjzon.js → jv-BT_G8rCL.js} +33 -6
- package/dist/{ka-BvgWMiTW.js → ka-WxIHXEYK.js} +33 -6
- package/dist/{kk-BAYGOXZ1.js → kk-qwv1f2i0.js} +33 -6
- package/dist/{km-Bn1-UMaR.js → km-CMxgTPm2.js} +40 -13
- package/dist/{ko-CtAqOkND.js → ko-ByRDnTNU.js} +33 -6
- package/dist/{ko-KP-kVzak00f.js → ko-KP-DT8OH4nm.js} +33 -6
- package/dist/{ky-Cegtfua2.js → ky-DrRlDMWB.js} +33 -6
- package/dist/{lo-DtW4luOG.js → lo-CazQUHLa.js} +33 -6
- package/dist/{lt-CnaDc_UD.js → lt-CBMtCNcX.js} +33 -6
- package/dist/{lv-SBquFvpr.js → lv-QLEUT4Fk.js} +33 -6
- package/dist/{mandatoryConsent-BMvNiuiY.js → mandatoryConsent-B8JxEysm.js} +8 -6
- package/dist/{manualCaptureButton-6HOiu1ud.js → manualCaptureButton-CortdhZS.js} +5 -5
- package/dist/{manualCaptureButton-CI-lIiuA.js → manualCaptureButton-XLjthVmp.js} +43 -34
- package/dist/{mk-Bym8Rbmu.js → mk-DDDwwQ8b.js} +33 -6
- package/dist/{mn-C-EiXg08.js → mn-CKxduUYN.js} +33 -6
- package/dist/{ms-k_GCoKmE.js → ms-CFER5NeU.js} +33 -6
- package/dist/{my-v5GqdpqS.js → my-mmwQAfjf.js} +33 -6
- package/dist/{nb-NO-Ca1WyJtF.js → nb-NO-CGgKs8rj.js} +33 -6
- package/dist/{ne-DZ1xJQOA.js → ne-BJqy-qcj.js} +33 -6
- package/dist/{nl-DsWJVGHj.js → nl-DJr6e9c-.js} +33 -6
- package/dist/{optionAccessibleLabel-CkP9Zu6D.js → optionAccessibleLabel-Da2eL5BH.js} +5 -5
- package/dist/{otpInput-CmcE2rnQ.js → otpInput-DhyZLO7E.js} +6 -6
- package/dist/page-BksTT2IT.js +299 -0
- package/dist/{passport-horizontal-hint-6Ghn2EEN.js → passport-horizontal-hint-DgNc6F0-.js} +48 -49
- package/dist/{passport-vertical-hint-UPFFpdf4.js → passport-vertical-hint-B-toVsfT.js} +42 -42
- package/dist/{passwordInputComposed-DkHtXfpN.js → passwordInputComposed-DUuchiG5.js} +4 -4
- package/dist/{pdf-CFubyG0B.js → pdf-BKHLi5Ac.js} +2 -2
- package/dist/pdf.worker.min-BM1b2w9V.js +4 -0
- package/dist/pdfViewer-DI6ftHlp.js +2 -0
- package/dist/pdfViewer-jx6A8s9-.js +154 -0
- package/dist/{permissions-D85sVpRH.js → permissions-CSwqOb8W.js} +41 -14
- package/dist/phone/phone.es.js +9 -8
- package/dist/phone/styles.css +1 -10
- package/dist/phone/styles.css.js +1 -1
- package/dist/phoneInputComposed-B-rmar65.js +249 -0
- package/dist/{pl-B32zvfat.js → pl-eSIxcu-k.js} +33 -6
- package/dist/policyUrls-B3M8nLRh.js +7 -0
- package/dist/{processing-DB6ZtByy.js → processing-DXSGB91D.js} +1 -1
- package/dist/progressBar-CFcaF74Q.js +27 -0
- package/dist/{pt-BR-CZSBmrhf.js → pt-BR-CJA5ZG6e.js} +33 -6
- package/dist/{pt-CI9A94gT.js → pt-CmJV-wZ-.js} +33 -6
- package/dist/{pt-PT-dD8X7Uk-.js → pt-PT-BFdqErGN.js} +33 -6
- package/dist/{spacer-Csi6kZZI.js → purify.es-0fCPkEV1.js} +2 -740
- package/dist/qe-signature/qe-signature.es.js +3 -3
- package/dist/radioGroupComposed-BDYikM_v.js +1 -0
- package/dist/{radioGroupComposed-BKEEwEPO.js → radioGroupComposed-CP8O7fH0.js} +2 -2
- package/dist/redirect-to-mobile/redirect-to-mobile.es.js +116 -13
- package/dist/redirect-to-mobile/styles.css +1 -323
- package/dist/redirect-to-mobile/styles.css.js +1 -1
- package/dist/reload-icon-elAFo9-k.js +70 -0
- package/dist/{resendTimer-QICiM2K0.js → resendTimer-B57abKjj.js} +1 -1
- package/dist/{richText-2CpStx6w.js → richText-aCnLd3j2.js} +2 -2
- package/dist/{ro-9pJ4k0ri.js → ro-CWG17Pwq.js} +33 -6
- package/dist/{ru-RU-Bbq_NDQg.js → ru-RU-B92HlMCp.js} +33 -6
- package/dist/{ru-DU8F6ner.js → ru-ax21b71G.js} +33 -6
- package/dist/sanitizeSvg-BC-qLUgS.js +35 -0
- package/dist/selfie/selfie.es.js +9 -184
- package/dist/selfie/styles.css +1 -501
- package/dist/selfie/styles.css.js +1 -1
- package/dist/signature/signature.es.js +8 -7
- package/dist/signature/styles.css +1 -116
- package/dist/signature/styles.css.js +1 -1
- package/dist/{sk-COjINm80.js → sk-Ds3au8Jk.js} +35 -8
- package/dist/{sl-BHEN5hgb.js → sl-B6IDJen8.js} +33 -6
- package/dist/{smsTabContent-6ehe5Tx-.js → smsTabContent-BlG83kTA.js} +6 -7
- package/dist/{so-BK_1PgA0.js → so-YhVExrIs.js} +33 -6
- package/dist/spacer-CkjGrKvv.js +741 -0
- package/dist/{spinner-C9D0Usrj.js → spinner-ceW7fzMV.js} +2 -2
- package/dist/{sr-CXHt_PCR.js → sr-DHyxTTRS.js} +33 -6
- package/dist/{sr-Latn-BBXL4zhk.js → sr-Latn-DVXk3-Ar.js} +40 -13
- package/dist/{sr-YU-D3DxWT8Q.js → sr-YU-A98YyASK.js} +33 -6
- package/dist/{statusPage-BbOa8Zsp.js → statusPage-DcunZz7q.js} +3 -3
- package/dist/{sv-SE-B6_0mJU7.js → sv-SE-BKSmMaSz.js} +33 -6
- package/dist/{sw-BUZuOFDH.js → sw-BlrxyPqO.js} +33 -6
- package/dist/{th-DZN2Iv8L.js → th-Bwohp3kt.js} +33 -6
- package/dist/{th-TH-B5S1TAOp.js → th-TH-CJpVz2u5.js} +33 -6
- package/dist/themes/dark.css +1 -1537
- package/dist/themes/light.css +1 -1413
- package/dist/{tl-DO_ExzG4.js → tl-D-896paK.js} +33 -6
- package/dist/{tl-PH-CbqgynTp.js → tl-PH-CpeFjacJ.js} +33 -6
- package/dist/{tr-DuzhV6aC.js → tr-UpF9aXXo.js} +34 -7
- package/dist/transitionSpinner-t_urdfwD.js +76 -0
- package/dist/{tutorial-CGHCyHq1.js → tutorial-Hoic1tQU.js} +14 -18
- package/dist/types/ae-signature.d.ts +27 -5
- package/dist/types/antifraud.d.ts +27 -5
- package/dist/types/authentication.d.ts +27 -5
- package/dist/types/certificate-issuance.d.ts +27 -5
- package/dist/types/consent.d.ts +27 -3
- package/dist/types/cross-document-data-match.d.ts +32 -2
- package/dist/types/curp-validation.d.ts +27 -5
- package/dist/types/document-capture.d.ts +32 -2
- package/dist/types/dynamic-forms.d.ts +27 -5
- package/dist/types/ekyb.d.ts +32 -2
- package/dist/types/ekyc.d.ts +32 -2
- package/dist/types/electronic-signature.d.ts +27 -5
- package/dist/types/email.d.ts +27 -3
- package/dist/types/extensibility.d.ts +135 -27
- package/dist/types/face-match.d.ts +32 -2
- package/dist/types/field-comparison.d.ts +32 -2
- package/dist/types/fiscal-qr.d.ts +27 -3
- package/dist/types/flow.d.ts +27 -3
- package/dist/types/geolocation.d.ts +27 -3
- package/dist/types/government-validation.d.ts +32 -2
- package/dist/types/id-selfie-flow.d.ts +27 -14
- package/dist/types/id-verification.d.ts +27 -5
- package/dist/types/id.d.ts +27 -3
- package/dist/types/identity-reuse.d.ts +27 -5
- package/dist/types/index.d.ts +52 -1
- package/dist/types/phone.d.ts +27 -3
- package/dist/types/qe-signature.d.ts +27 -5
- package/dist/types/selfie.d.ts +27 -3
- package/dist/types/signature.d.ts +27 -5
- package/dist/types/video-selfie.d.ts +5 -2
- package/dist/types/watchlist.d.ts +27 -5
- package/dist/types/workflow.d.ts +50 -4
- package/dist/{typography-Ck7V6DNZ.js → typography-CjBuzXWX.js} +1 -1
- package/dist/{uiConfig-Dd7jp1PI.js → uiConfig-Bh5WEbvy.js} +256 -874
- package/dist/{uk-BLrKoj8p.js → uk-DsTY-qEZ.js} +33 -6
- package/dist/{uk-UA-D6AgqKAE.js → uk-UA-BsILxTGz.js} +33 -6
- package/dist/{ur-uciedoGK.js → ur-n9ZinGDJ.js} +33 -6
- package/dist/useCaptureHelpButton-f7JWgp_k.js +86 -0
- package/dist/useCoverMedia-VLw3OYN_.js +149 -0
- package/dist/{uz-D1RcQJml.js → uz-C-oPc-JB.js} +33 -6
- package/dist/{verificationResult-CMeZfcp-.js → verificationResult-M2YRY8Gb.js} +6 -6
- package/dist/{vi-ftDWx05b.js → vi-CwwSd-oQ.js} +33 -6
- package/dist/video-selfie/styles.css +1 -864
- package/dist/video-selfie/styles.css.js +1 -1
- package/dist/video-selfie/video-selfie.es.js +15 -12
- package/dist/watchlist/watchlist.es.js +6 -6
- package/dist/watchlist-for-business/styles.css +1 -17
- package/dist/watchlist-for-business/styles.css.js +1 -1
- package/dist/{watchlistForBusiness-CAVtOlvf.js → watchlistForBusiness-CAUTDAJh.js} +265 -8
- package/dist/{resolveApiKey-uVJm2km3.js → withEndScreenTexts-VQlYb0bU.js} +53 -25
- package/dist/workflow/styles.css +1 -5116
- package/dist/workflow/workflow.es.js +83 -28
- package/dist/{zh-CN-C6BX8R6-.js → zh-CN-Dc3X6PNO.js} +35 -8
- package/dist/{zh-CJ974_0X.js → zh-Dgdyqejo.js} +33 -6
- package/dist/{zh-HANT-CbCj1ENS.js → zh-HANT-BDp9XkY7.js} +33 -6
- package/dist/{zh-TW-DGxz1fli.js → zh-TW-QBmOmVhc.js} +33 -6
- package/package.json +8 -6
- package/dist/back-horizontal-hint-UQ7Nof6k.js +0 -137
- package/dist/back-vertical-hint-Crc8ybfk.js +0 -128
- package/dist/cameraOverlay-Dp8micQ1.js +0 -2
- package/dist/cameraOverlayHeader-BMfNitmC.js +0 -43
- package/dist/captureFooter-xMZdYH2O.js +0 -67
- package/dist/connectionError-BhxGYSwy.js +0 -45
- package/dist/countries-5e8kwG_m.js +0 -8560
- package/dist/dateInputComposed-DM6MXdpn.js +0 -1
- package/dist/denied-PJnw8fbL.js +0 -2191
- package/dist/documentCapture-Bcw3g1Q1.js +0 -2
- package/dist/dropdownComposed-C2bmup-w.js +0 -1
- package/dist/ekybModule-DHJWniii.js +0 -2
- package/dist/ekycModule-5d4qgrAk.js +0 -2
- package/dist/faceMatch-B7ayVA3N.js +0 -2
- package/dist/faceMatch-Tj39bhkm.js +0 -334
- package/dist/fieldComparison-75FGbygj.js +0 -2
- package/dist/finalSuccessScreen-ikiIjPhC.js +0 -499
- package/dist/front-horizontal-hint-mgovnJf3.js +0 -380
- package/dist/icons-DO-rf5yd.js +0 -533
- package/dist/id-back-of-card-B6EcmiCs.js +0 -83
- package/dist/id-back-of-card-vertical-B3FXhPpj.js +0 -88
- package/dist/id-front-of-card-V_BlLaZr.js +0 -308
- package/dist/id-front-of-card-vertical-CuZjL8kc.js +0 -278
- package/dist/incode-logo-BzJOZr3f.js +0 -4
- package/dist/incodeModule-n_Am6zwM.js +0 -31
- package/dist/inputComposed-B33LMERA.js +0 -1
- package/dist/modal-DNfrzKC7.js +0 -140
- package/dist/modal.hooks-B0Wrc9s2.js +0 -201
- package/dist/pdfViewer-CygtdQPU.js +0 -149
- package/dist/pdfViewer-Yf7ZKXLz.js +0 -2
- package/dist/phoneInputComposed-7i6GGW1B.js +0 -3751
- package/dist/radioGroupComposed-Bm3iEn-6.js +0 -1
- package/dist/tabs-CW12_glt.js +0 -104
- /package/dist/{aligndevicelottie-B12hbVhG.js → aligndevicelottie-BARt-rhe.js} +0 -0
- /package/dist/{back-tutorial-XdmQ0Wml.js → back-tutorial-CZrMmj1_.js} +0 -0
- /package/dist/{backdevicelottie-m_DOD8xE.js → backdevicelottie-CIM3ekd8.js} +0 -0
- /package/dist/{blurdevicelottie-DQo_hTMD.js → blurdevicelottie-BRyXfLB6.js} +0 -0
- /package/dist/{browser-ponyfill-ZkeBm4ji.js → browser-ponyfill-DT11p-Ob.js} +0 -0
- /package/dist/{defineProperty-BojnCa44.js → defineProperty-CjeJoXkx.js} +0 -0
- /package/dist/{flip-animation-VicedlT5.js → flip-animation-BU5LNKYx.js} +0 -0
- /package/dist/{frontdevicelottie-CyIerlMv.js → frontdevicelottie-arpyu_Fz.js} +0 -0
- /package/dist/{glaredevicelottie-QM2C6Ivp.js → glaredevicelottie-TwTFxe7h.js} +0 -0
- /package/dist/{id-laser-h-B0-iXcvl.js → id-laser-h-Dr-hBxrq.js} +0 -0
- /package/dist/{id-laser-v-Bqh6vimi.js → id-laser-v-D_r0QNY8.js} +0 -0
- /package/dist/{id-tutorial-IhmAzrIF.js → id-tutorial-DM9Pkfs-.js} +0 -0
- /package/dist/{lottie_light-CzZ3CHBk.js → lottie_light-aMg9Q9iO.js} +0 -0
- /package/dist/{numberedStep-C8e_uPaz.js → numberedStep-CvbL3ht2.js} +0 -0
- /package/dist/{passport-tutorial-61vlloJS.js → passport-tutorial-CKZZuDf_.js} +0 -0
- /package/dist/{registerIncodeElement-CbZczi4S.js → registerIncodeElement-D_cn4dSI.js} +0 -0
- /package/dist/{selfieTutorial-BRQ2QNxQ.js → selfieTutorial-Dz6lDFMn.js} +0 -0
- /package/dist/{useModuleLoader-DpcbSKBH.js → useModuleLoader-BdIp6TNQ.js} +0 -0
|
@@ -1,3751 +0,0 @@
|
|
|
1
|
-
import { S as k, _ as y, c as A, f as d, h as q, i as D, u as T, v as u } from "./vendor-preact-C0jX1Cbq.js";
|
|
2
|
-
import { b as ErrorIcon, r as SuccessIcon } from "./icons-DO-rf5yd.js";
|
|
3
|
-
import { t as InputComposed } from "./inputComposed-ByIWAPSr.js";
|
|
4
|
-
import { t as FieldLabelHint } from "./fieldLabelHint-CxjArYkQ.js";
|
|
5
|
-
import { a as getCountryByCode, c as getCountryCallingCode, d as isObject, f as withMetadataArgument, l as isSupportedCountry, o as getCountryCallingCode$1, p as metadata_min_json_default, r as countries, s as Metadata, u as validateMetadata } from "./countries-5e8kwG_m.js";
|
|
6
|
-
import { t as DropdownComposed } from "./dropdownComposed-B0WxIm-I.js";
|
|
7
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/mergeArrays.js
|
|
8
|
-
function _createForOfIteratorHelperLoose$7(r, e) {
|
|
9
|
-
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
10
|
-
if (t) return (t = t.call(r)).next.bind(t);
|
|
11
|
-
if (Array.isArray(r) || (t = _unsupportedIterableToArray$10(r)) || e && r && "number" == typeof r.length) {
|
|
12
|
-
t && (r = t);
|
|
13
|
-
var o = 0;
|
|
14
|
-
return function() {
|
|
15
|
-
return o >= r.length ? { done: !0 } : {
|
|
16
|
-
done: !1,
|
|
17
|
-
value: r[o++]
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
22
|
-
}
|
|
23
|
-
function _unsupportedIterableToArray$10(r, a) {
|
|
24
|
-
if (r) {
|
|
25
|
-
if ("string" == typeof r) return _arrayLikeToArray$10(r, a);
|
|
26
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
27
|
-
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$10(r, a) : void 0;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function _arrayLikeToArray$10(r, a) {
|
|
31
|
-
(null == a || a > r.length) && (a = r.length);
|
|
32
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
33
|
-
return n;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Merges two arrays.
|
|
37
|
-
* @param {*} a
|
|
38
|
-
* @param {*} b
|
|
39
|
-
* @return {*}
|
|
40
|
-
*/
|
|
41
|
-
function mergeArrays(a, b) {
|
|
42
|
-
var merged = a.slice();
|
|
43
|
-
for (var _iterator = _createForOfIteratorHelperLoose$7(b), _step; !(_step = _iterator()).done;) {
|
|
44
|
-
var element = _step.value;
|
|
45
|
-
if (a.indexOf(element) < 0) merged.push(element);
|
|
46
|
-
}
|
|
47
|
-
return merged.sort(function(a, b) {
|
|
48
|
-
return a - b;
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
//#endregion
|
|
52
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js
|
|
53
|
-
function checkNumberLength(nationalNumber, country, metadata) {
|
|
54
|
-
return checkNumberLengthForType(nationalNumber, country, void 0, metadata);
|
|
55
|
-
}
|
|
56
|
-
function checkNumberLengthForType(nationalNumber, country, type, metadata) {
|
|
57
|
-
if (country) {
|
|
58
|
-
metadata = new Metadata(metadata.metadata);
|
|
59
|
-
metadata.selectNumberingPlan(country);
|
|
60
|
-
}
|
|
61
|
-
var type_info = metadata.type(type);
|
|
62
|
-
var possible_lengths = type_info && type_info.possibleLengths() || metadata.possibleLengths();
|
|
63
|
-
if (!possible_lengths) return "IS_POSSIBLE";
|
|
64
|
-
if (type === "FIXED_LINE_OR_MOBILE") {
|
|
65
|
-
/* istanbul ignore next */
|
|
66
|
-
if (!metadata.type("FIXED_LINE")) return checkNumberLengthForType(nationalNumber, country, "MOBILE", metadata);
|
|
67
|
-
var mobile_type = metadata.type("MOBILE");
|
|
68
|
-
if (mobile_type) possible_lengths = mergeArrays(possible_lengths, mobile_type.possibleLengths());
|
|
69
|
-
} else if (type && !type_info) return "INVALID_LENGTH";
|
|
70
|
-
var actual_length = nationalNumber.length;
|
|
71
|
-
var minimum_length = possible_lengths[0];
|
|
72
|
-
if (minimum_length === actual_length) return "IS_POSSIBLE";
|
|
73
|
-
if (minimum_length > actual_length) return "TOO_SHORT";
|
|
74
|
-
if (possible_lengths[possible_lengths.length - 1] < actual_length) return "TOO_LONG";
|
|
75
|
-
return possible_lengths.indexOf(actual_length, 1) >= 0 ? "IS_POSSIBLE" : "INVALID_LENGTH";
|
|
76
|
-
}
|
|
77
|
-
//#endregion
|
|
78
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/isPossible.js
|
|
79
|
-
/**
|
|
80
|
-
* Checks if a phone number is "possible" (basically just checks its length).
|
|
81
|
-
*
|
|
82
|
-
* isPossible(phoneNumberInstance, { ..., v2: true }, metadata)
|
|
83
|
-
*
|
|
84
|
-
* isPossible({ phone: '8005553535', country: 'RU' }, { ... }, metadata)
|
|
85
|
-
* isPossible({ phone: '8005553535', country: 'RU' }, undefined, metadata)
|
|
86
|
-
*
|
|
87
|
-
* @param {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`.
|
|
88
|
-
* @param {object} [options]
|
|
89
|
-
* @param {object} metadata
|
|
90
|
-
* @return {string}
|
|
91
|
-
*/
|
|
92
|
-
function isPossiblePhoneNumber(input, options, metadata) {
|
|
93
|
-
/* istanbul ignore if */
|
|
94
|
-
if (options === void 0) options = {};
|
|
95
|
-
metadata = new Metadata(metadata);
|
|
96
|
-
if (options.v2) {
|
|
97
|
-
if (!input.countryCallingCode) throw new Error("Invalid phone number object passed");
|
|
98
|
-
metadata.selectNumberingPlan(input.countryCallingCode);
|
|
99
|
-
} else {
|
|
100
|
-
if (!input.phone) return false;
|
|
101
|
-
if (input.country) {
|
|
102
|
-
if (!metadata.hasCountry(input.country)) throw new Error("Unknown country: ".concat(input.country));
|
|
103
|
-
metadata.selectNumberingPlan(input.country);
|
|
104
|
-
} else {
|
|
105
|
-
if (!input.countryCallingCode) throw new Error("Invalid phone number object passed");
|
|
106
|
-
metadata.selectNumberingPlan(input.countryCallingCode);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
if (metadata.possibleLengths()) return isPossibleNumber(input.phone || input.nationalNumber, input.country, metadata);
|
|
110
|
-
else if (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) return true;
|
|
111
|
-
else throw new Error("Missing \"possibleLengths\" in metadata. Perhaps the metadata has been generated before v1.0.18.");
|
|
112
|
-
}
|
|
113
|
-
function isPossibleNumber(nationalNumber, country, metadata) {
|
|
114
|
-
switch (checkNumberLength(nationalNumber, country, metadata)) {
|
|
115
|
-
case "IS_POSSIBLE": return true;
|
|
116
|
-
default: return false;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
//#endregion
|
|
120
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js
|
|
121
|
-
/**
|
|
122
|
-
* Checks whether the entire input sequence can be matched
|
|
123
|
-
* against the regular expression.
|
|
124
|
-
* @return {boolean}
|
|
125
|
-
*/
|
|
126
|
-
function matchesEntirely(text, regularExpressionText) {
|
|
127
|
-
text = text || "";
|
|
128
|
-
return new RegExp("^(?:" + regularExpressionText + ")$").test(text);
|
|
129
|
-
}
|
|
130
|
-
//#endregion
|
|
131
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/getNumberType.js
|
|
132
|
-
function _createForOfIteratorHelperLoose$6(r, e) {
|
|
133
|
-
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
134
|
-
if (t) return (t = t.call(r)).next.bind(t);
|
|
135
|
-
if (Array.isArray(r) || (t = _unsupportedIterableToArray$9(r)) || e && r && "number" == typeof r.length) {
|
|
136
|
-
t && (r = t);
|
|
137
|
-
var o = 0;
|
|
138
|
-
return function() {
|
|
139
|
-
return o >= r.length ? { done: !0 } : {
|
|
140
|
-
done: !1,
|
|
141
|
-
value: r[o++]
|
|
142
|
-
};
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
146
|
-
}
|
|
147
|
-
function _unsupportedIterableToArray$9(r, a) {
|
|
148
|
-
if (r) {
|
|
149
|
-
if ("string" == typeof r) return _arrayLikeToArray$9(r, a);
|
|
150
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
151
|
-
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$9(r, a) : void 0;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
function _arrayLikeToArray$9(r, a) {
|
|
155
|
-
(null == a || a > r.length) && (a = r.length);
|
|
156
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
157
|
-
return n;
|
|
158
|
-
}
|
|
159
|
-
var NON_FIXED_LINE_PHONE_TYPES = [
|
|
160
|
-
"MOBILE",
|
|
161
|
-
"PREMIUM_RATE",
|
|
162
|
-
"TOLL_FREE",
|
|
163
|
-
"SHARED_COST",
|
|
164
|
-
"VOIP",
|
|
165
|
-
"PERSONAL_NUMBER",
|
|
166
|
-
"PAGER",
|
|
167
|
-
"UAN",
|
|
168
|
-
"VOICEMAIL"
|
|
169
|
-
];
|
|
170
|
-
function getNumberType(input, options, metadata) {
|
|
171
|
-
options = options || {};
|
|
172
|
-
if (!input.country && !input.countryCallingCode) return;
|
|
173
|
-
metadata = new Metadata(metadata);
|
|
174
|
-
metadata.selectNumberingPlan(input.country, input.countryCallingCode);
|
|
175
|
-
var nationalNumber = options.v2 ? input.nationalNumber : input.phone;
|
|
176
|
-
if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern())) return;
|
|
177
|
-
if (isNumberTypeEqualTo(nationalNumber, "FIXED_LINE", metadata)) {
|
|
178
|
-
if (metadata.type("MOBILE") && metadata.type("MOBILE").pattern() === "") return "FIXED_LINE_OR_MOBILE";
|
|
179
|
-
if (!metadata.type("MOBILE")) return "FIXED_LINE_OR_MOBILE";
|
|
180
|
-
/* istanbul ignore if */
|
|
181
|
-
if (isNumberTypeEqualTo(nationalNumber, "MOBILE", metadata)) return "FIXED_LINE_OR_MOBILE";
|
|
182
|
-
return "FIXED_LINE";
|
|
183
|
-
}
|
|
184
|
-
for (var _iterator = _createForOfIteratorHelperLoose$6(NON_FIXED_LINE_PHONE_TYPES), _step; !(_step = _iterator()).done;) {
|
|
185
|
-
var type = _step.value;
|
|
186
|
-
if (isNumberTypeEqualTo(nationalNumber, type, metadata)) return type;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
function isNumberTypeEqualTo(nationalNumber, type, metadata) {
|
|
190
|
-
type = metadata.type(type);
|
|
191
|
-
if (!type || !type.pattern()) return false;
|
|
192
|
-
if (type.possibleLengths() && type.possibleLengths().indexOf(nationalNumber.length) < 0) return false;
|
|
193
|
-
return matchesEntirely(nationalNumber, type.pattern());
|
|
194
|
-
}
|
|
195
|
-
//#endregion
|
|
196
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/isValid.js
|
|
197
|
-
/**
|
|
198
|
-
* Checks if a given phone number is valid.
|
|
199
|
-
*
|
|
200
|
-
* isValid(phoneNumberInstance, { ..., v2: true }, metadata)
|
|
201
|
-
*
|
|
202
|
-
* isPossible({ phone: '8005553535', country: 'RU' }, { ... }, metadata)
|
|
203
|
-
* isPossible({ phone: '8005553535', country: 'RU' }, undefined, metadata)
|
|
204
|
-
*
|
|
205
|
-
* If the `number` is a string, it will be parsed to an object,
|
|
206
|
-
* but only if it contains only valid phone number characters (including punctuation).
|
|
207
|
-
* If the `number` is an object, it is used as is.
|
|
208
|
-
*
|
|
209
|
-
* The optional `defaultCountry` argument is the default country.
|
|
210
|
-
* I.e. it does not restrict to just that country,
|
|
211
|
-
* e.g. in those cases where several countries share
|
|
212
|
-
* the same phone numbering rules (NANPA, Britain, etc).
|
|
213
|
-
* For example, even though the number `07624 369230`
|
|
214
|
-
* belongs to the Isle of Man ("IM" country code)
|
|
215
|
-
* calling `isValidNumber('07624369230', 'GB', metadata)`
|
|
216
|
-
* still returns `true` because the country is not restricted to `GB`,
|
|
217
|
-
* it's just that `GB` is the default one for the phone numbering rules.
|
|
218
|
-
* For restricting the country see `isValidNumberForRegion()`
|
|
219
|
-
* though restricting a country might not be a good idea.
|
|
220
|
-
* https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion
|
|
221
|
-
*
|
|
222
|
-
* Examples:
|
|
223
|
-
*
|
|
224
|
-
* ```js
|
|
225
|
-
* isValidNumber('+78005553535', metadata)
|
|
226
|
-
* isValidNumber('8005553535', 'RU', metadata)
|
|
227
|
-
* isValidNumber('88005553535', 'RU', metadata)
|
|
228
|
-
* isValidNumber({ phone: '8005553535', country: 'RU' }, metadata)
|
|
229
|
-
* ```
|
|
230
|
-
*/
|
|
231
|
-
function isValidNumber(input, options, metadata) {
|
|
232
|
-
options = options || {};
|
|
233
|
-
metadata = new Metadata(metadata);
|
|
234
|
-
metadata.selectNumberingPlan(input.country, input.countryCallingCode);
|
|
235
|
-
if (metadata.hasTypes()) return getNumberType(input, options, metadata.metadata) !== void 0;
|
|
236
|
-
return matchesEntirely(options.v2 ? input.nationalNumber : input.phone, metadata.nationalNumberPattern());
|
|
237
|
-
}
|
|
238
|
-
//#endregion
|
|
239
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js
|
|
240
|
-
/**
|
|
241
|
-
* Returns a list of countries that the phone number could potentially belong to.
|
|
242
|
-
* @param {string} callingCode — Calling code.
|
|
243
|
-
* @param {string} nationalNumber — National (significant) number.
|
|
244
|
-
* @param {object} metadata — Metadata.
|
|
245
|
-
* @return {string[]} A list of possible countries.
|
|
246
|
-
*/
|
|
247
|
-
function getPossibleCountriesForNumber(callingCode, nationalNumber, metadata) {
|
|
248
|
-
var possibleCountries = new Metadata(metadata).getCountryCodesForCallingCode(callingCode);
|
|
249
|
-
if (!possibleCountries) return [];
|
|
250
|
-
return possibleCountries.filter(function(country) {
|
|
251
|
-
return couldNationalNumberBelongToCountry(nationalNumber, country, metadata);
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
function couldNationalNumberBelongToCountry(nationalNumber, country, metadata) {
|
|
255
|
-
var _metadata = new Metadata(metadata);
|
|
256
|
-
_metadata.selectNumberingPlan(country);
|
|
257
|
-
if (_metadata.numberingPlan.possibleLengths().indexOf(nationalNumber.length) >= 0) return true;
|
|
258
|
-
return false;
|
|
259
|
-
}
|
|
260
|
-
//#endregion
|
|
261
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/constants.js
|
|
262
|
-
var VALID_DIGITS = "0-90-9٠-٩۰-۹";
|
|
263
|
-
var VALID_PUNCTUATION = "".concat("-‐-―−ー-").concat("//").concat("..").concat(" \xA0 ").concat("()()[]\\[\\]").concat("~⁓∼~");
|
|
264
|
-
var PLUS_CHARS = "++";
|
|
265
|
-
//#endregion
|
|
266
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js
|
|
267
|
-
var CAPTURING_DIGIT_PATTERN = new RegExp("([" + VALID_DIGITS + "])");
|
|
268
|
-
function stripIddPrefix(number, country, callingCode, metadata) {
|
|
269
|
-
if (!country) return;
|
|
270
|
-
var countryMetadata = new Metadata(metadata);
|
|
271
|
-
countryMetadata.selectNumberingPlan(country, callingCode);
|
|
272
|
-
var IDDPrefixPattern = new RegExp(countryMetadata.IDDPrefix());
|
|
273
|
-
if (number.search(IDDPrefixPattern) !== 0) return;
|
|
274
|
-
number = number.slice(number.match(IDDPrefixPattern)[0].length);
|
|
275
|
-
var matchedGroups = number.match(CAPTURING_DIGIT_PATTERN);
|
|
276
|
-
if (matchedGroups && matchedGroups[1] != null && matchedGroups[1].length > 0) {
|
|
277
|
-
if (matchedGroups[1] === "0") return;
|
|
278
|
-
}
|
|
279
|
-
return number;
|
|
280
|
-
}
|
|
281
|
-
//#endregion
|
|
282
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js
|
|
283
|
-
/**
|
|
284
|
-
* Strips any national prefix (such as 0, 1) present in a
|
|
285
|
-
* (possibly incomplete) number provided.
|
|
286
|
-
* "Carrier codes" are only used in Colombia and Brazil,
|
|
287
|
-
* and only when dialing within those countries from a mobile phone to a fixed line number.
|
|
288
|
-
* Sometimes it won't actually strip national prefix
|
|
289
|
-
* and will instead prepend some digits to the `number`:
|
|
290
|
-
* for example, when number `2345678` is passed with `VI` country selected,
|
|
291
|
-
* it will return `{ number: "3402345678" }`, because `340` area code is prepended.
|
|
292
|
-
* @param {string} number — National number digits.
|
|
293
|
-
* @param {object} metadata — Metadata with country selected.
|
|
294
|
-
* @return {object} `{ nationalNumber: string, nationalPrefix: string? carrierCode: string? }`. Even if a national prefix was extracted, it's not necessarily present in the returned object, so don't rely on its presence in the returned object in order to find out whether a national prefix has been extracted or not.
|
|
295
|
-
*/
|
|
296
|
-
function extractNationalNumberFromPossiblyIncompleteNumber(number, metadata) {
|
|
297
|
-
if (number && metadata.numberingPlan.nationalPrefixForParsing()) {
|
|
298
|
-
var prefixPattern = new RegExp("^(?:" + metadata.numberingPlan.nationalPrefixForParsing() + ")");
|
|
299
|
-
var prefixMatch = prefixPattern.exec(number);
|
|
300
|
-
if (prefixMatch) {
|
|
301
|
-
var nationalNumber;
|
|
302
|
-
var carrierCode;
|
|
303
|
-
var capturedGroupsCount = prefixMatch.length - 1;
|
|
304
|
-
var hasCapturedGroups = capturedGroupsCount > 0 && prefixMatch[capturedGroupsCount];
|
|
305
|
-
if (metadata.nationalPrefixTransformRule() && hasCapturedGroups) {
|
|
306
|
-
nationalNumber = number.replace(prefixPattern, metadata.nationalPrefixTransformRule());
|
|
307
|
-
if (capturedGroupsCount > 1) carrierCode = prefixMatch[1];
|
|
308
|
-
} else {
|
|
309
|
-
var prefixBeforeNationalNumber = prefixMatch[0];
|
|
310
|
-
nationalNumber = number.slice(prefixBeforeNationalNumber.length);
|
|
311
|
-
if (hasCapturedGroups) carrierCode = prefixMatch[1];
|
|
312
|
-
}
|
|
313
|
-
var nationalPrefix;
|
|
314
|
-
if (hasCapturedGroups) {
|
|
315
|
-
var possiblePositionOfTheFirstCapturedGroup = number.indexOf(prefixMatch[1]);
|
|
316
|
-
if (number.slice(0, possiblePositionOfTheFirstCapturedGroup) === metadata.numberingPlan.nationalPrefix()) nationalPrefix = metadata.numberingPlan.nationalPrefix();
|
|
317
|
-
} else nationalPrefix = prefixMatch[0];
|
|
318
|
-
return {
|
|
319
|
-
nationalNumber,
|
|
320
|
-
nationalPrefix,
|
|
321
|
-
carrierCode
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
return { nationalNumber: number };
|
|
326
|
-
}
|
|
327
|
-
//#endregion
|
|
328
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js
|
|
329
|
-
function _createForOfIteratorHelperLoose$5(r, e) {
|
|
330
|
-
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
331
|
-
if (t) return (t = t.call(r)).next.bind(t);
|
|
332
|
-
if (Array.isArray(r) || (t = _unsupportedIterableToArray$8(r)) || e && r && "number" == typeof r.length) {
|
|
333
|
-
t && (r = t);
|
|
334
|
-
var o = 0;
|
|
335
|
-
return function() {
|
|
336
|
-
return o >= r.length ? { done: !0 } : {
|
|
337
|
-
done: !1,
|
|
338
|
-
value: r[o++]
|
|
339
|
-
};
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
343
|
-
}
|
|
344
|
-
function _unsupportedIterableToArray$8(r, a) {
|
|
345
|
-
if (r) {
|
|
346
|
-
if ("string" == typeof r) return _arrayLikeToArray$8(r, a);
|
|
347
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
348
|
-
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$8(r, a) : void 0;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
function _arrayLikeToArray$8(r, a) {
|
|
352
|
-
(null == a || a > r.length) && (a = r.length);
|
|
353
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
354
|
-
return n;
|
|
355
|
-
}
|
|
356
|
-
function getCountryByNationalNumber(nationalPhoneNumber, _ref) {
|
|
357
|
-
var countries = _ref.countries, metadata = _ref.metadata;
|
|
358
|
-
metadata = new Metadata(metadata);
|
|
359
|
-
for (var _iterator = _createForOfIteratorHelperLoose$5(countries), _step; !(_step = _iterator()).done;) {
|
|
360
|
-
var country = _step.value;
|
|
361
|
-
metadata.selectNumberingPlan(country);
|
|
362
|
-
if (metadata.leadingDigits()) {
|
|
363
|
-
if (nationalPhoneNumber && nationalPhoneNumber.search(metadata.leadingDigits()) === 0) return country;
|
|
364
|
-
} else if (getNumberType({
|
|
365
|
-
phone: nationalPhoneNumber,
|
|
366
|
-
country
|
|
367
|
-
}, void 0, metadata.metadata)) return country;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
//#endregion
|
|
371
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js
|
|
372
|
-
var USE_NON_GEOGRAPHIC_COUNTRY_CODE$3 = false;
|
|
373
|
-
function getCountryByCallingCode(callingCode, _ref) {
|
|
374
|
-
var nationalPhoneNumber = _ref.nationalNumber, metadata = _ref.metadata;
|
|
375
|
-
/* istanbul ignore if */
|
|
376
|
-
if (USE_NON_GEOGRAPHIC_COUNTRY_CODE$3) {
|
|
377
|
-
if (metadata.isNonGeographicCallingCode(callingCode)) return "001";
|
|
378
|
-
}
|
|
379
|
-
var possibleCountries = metadata.getCountryCodesForCallingCode(callingCode);
|
|
380
|
-
if (!possibleCountries) return;
|
|
381
|
-
if (possibleCountries.length === 1) return possibleCountries[0];
|
|
382
|
-
return getCountryByNationalNumber(nationalPhoneNumber, {
|
|
383
|
-
countries: possibleCountries,
|
|
384
|
-
metadata: metadata.metadata
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
//#endregion
|
|
388
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js
|
|
389
|
-
/**
|
|
390
|
-
* Strips national prefix and carrier code from a complete phone number.
|
|
391
|
-
* The difference from the non-"FromCompleteNumber" function is that
|
|
392
|
-
* it won't extract national prefix if the resultant number is too short
|
|
393
|
-
* to be a complete number for the selected phone numbering plan.
|
|
394
|
-
* @param {string} number — Complete phone number digits.
|
|
395
|
-
* @param {string?} country — Country, if known.
|
|
396
|
-
* @param {Metadata} metadata — Metadata with a phone numbering plan selected.
|
|
397
|
-
* @return {object} `{ nationalNumber: string, carrierCode: string? }`.
|
|
398
|
-
*/
|
|
399
|
-
function extractNationalNumber(number, country, metadata) {
|
|
400
|
-
var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(number, metadata), carrierCode = _extractNationalNumbe.carrierCode, nationalNumber = _extractNationalNumbe.nationalNumber;
|
|
401
|
-
if (nationalNumber !== number) {
|
|
402
|
-
if (!shouldHaveExtractedNationalPrefix(number, nationalNumber, metadata)) return { nationalNumber: number };
|
|
403
|
-
if (metadata.numberingPlan.possibleLengths()) {
|
|
404
|
-
if (!country) country = getCountryByCallingCode(metadata.numberingPlan.callingCode(), {
|
|
405
|
-
nationalNumber,
|
|
406
|
-
metadata
|
|
407
|
-
});
|
|
408
|
-
if (!isPossibleIncompleteNationalNumber(nationalNumber, country, metadata)) return { nationalNumber: number };
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
return {
|
|
412
|
-
nationalNumber,
|
|
413
|
-
carrierCode
|
|
414
|
-
};
|
|
415
|
-
}
|
|
416
|
-
function shouldHaveExtractedNationalPrefix(nationalNumberBefore, nationalNumberAfter, metadata) {
|
|
417
|
-
if (matchesEntirely(nationalNumberBefore, metadata.nationalNumberPattern()) && !matchesEntirely(nationalNumberAfter, metadata.nationalNumberPattern())) return false;
|
|
418
|
-
return true;
|
|
419
|
-
}
|
|
420
|
-
function isPossibleIncompleteNationalNumber(nationalNumber, country, metadata) {
|
|
421
|
-
switch (checkNumberLength(nationalNumber, country, metadata)) {
|
|
422
|
-
case "TOO_SHORT":
|
|
423
|
-
case "INVALID_LENGTH": return false;
|
|
424
|
-
default: return true;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
//#endregion
|
|
428
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js
|
|
429
|
-
/**
|
|
430
|
-
* Sometimes some people incorrectly input international phone numbers
|
|
431
|
-
* without the leading `+`. This function corrects such input.
|
|
432
|
-
* @param {string} number — Phone number digits.
|
|
433
|
-
* @param {string} [country] — Exact country of the phone number.
|
|
434
|
-
* @param {string} [defaultCountry]
|
|
435
|
-
* @param {string} [defaultCallingCode]
|
|
436
|
-
* @param {object} metadata
|
|
437
|
-
* @return {object} `{ countryCallingCode: string?, number: string }`.
|
|
438
|
-
*/
|
|
439
|
-
function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, defaultCountry, defaultCallingCode, metadata) {
|
|
440
|
-
var countryCallingCode = country || defaultCountry ? getCountryCallingCode(country || defaultCountry, metadata) : defaultCallingCode;
|
|
441
|
-
if (number.indexOf(countryCallingCode) === 0) {
|
|
442
|
-
metadata = new Metadata(metadata);
|
|
443
|
-
metadata.selectNumberingPlan(country || defaultCountry, countryCallingCode);
|
|
444
|
-
var possibleShorterNumber = number.slice(countryCallingCode.length);
|
|
445
|
-
var possibleShorterNationalNumber = extractNationalNumber(possibleShorterNumber, country, metadata).nationalNumber;
|
|
446
|
-
var nationalNumber = extractNationalNumber(number, country, metadata).nationalNumber;
|
|
447
|
-
if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) && matchesEntirely(possibleShorterNationalNumber, metadata.nationalNumberPattern()) || checkNumberLength(nationalNumber, country, metadata) === "TOO_LONG") return {
|
|
448
|
-
countryCallingCode,
|
|
449
|
-
number: possibleShorterNumber
|
|
450
|
-
};
|
|
451
|
-
}
|
|
452
|
-
return { number };
|
|
453
|
-
}
|
|
454
|
-
//#endregion
|
|
455
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js
|
|
456
|
-
/**
|
|
457
|
-
* Converts a phone number digits (possibly with a `+`)
|
|
458
|
-
* into a calling code and the rest phone number digits.
|
|
459
|
-
* The "rest phone number digits" could include
|
|
460
|
-
* a national prefix, carrier code, and national
|
|
461
|
-
* (significant) number.
|
|
462
|
-
* @param {string} number — Phone number digits (possibly with a `+`).
|
|
463
|
-
* @param {string} [country] — Country.
|
|
464
|
-
* @param {string} [defaultCountry] — Default country.
|
|
465
|
-
* @param {string} [defaultCallingCode] — Default calling code (some phone numbering plans are non-geographic).
|
|
466
|
-
* @param {object} metadata
|
|
467
|
-
* @return {object} `{ countryCallingCodeSource: string?, countryCallingCode: string?, number: string }`
|
|
468
|
-
* @example
|
|
469
|
-
* // Returns `{ countryCallingCode: "1", number: "2133734253" }`.
|
|
470
|
-
* extractCountryCallingCode('2133734253', null, 'US', null, metadata)
|
|
471
|
-
* extractCountryCallingCode('2133734253', null, null, '1', metadata)
|
|
472
|
-
* extractCountryCallingCode('+12133734253', null, null, null, metadata)
|
|
473
|
-
* extractCountryCallingCode('+12133734253', null, 'RU', null, metadata)
|
|
474
|
-
*/
|
|
475
|
-
function extractCountryCallingCode(number, country, defaultCountry, defaultCallingCode, metadata) {
|
|
476
|
-
if (!number) return {};
|
|
477
|
-
var isNumberWithIddPrefix;
|
|
478
|
-
if (number[0] !== "+") {
|
|
479
|
-
var numberWithoutIDD = stripIddPrefix(number, country || defaultCountry, defaultCallingCode, metadata);
|
|
480
|
-
if (numberWithoutIDD && numberWithoutIDD !== number) {
|
|
481
|
-
isNumberWithIddPrefix = true;
|
|
482
|
-
number = "+" + numberWithoutIDD;
|
|
483
|
-
} else {
|
|
484
|
-
if (country || defaultCountry || defaultCallingCode) {
|
|
485
|
-
var _extractCountryCallin = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, defaultCountry, defaultCallingCode, metadata), countryCallingCode = _extractCountryCallin.countryCallingCode, shorterNumber = _extractCountryCallin.number;
|
|
486
|
-
if (countryCallingCode) return {
|
|
487
|
-
countryCallingCodeSource: "FROM_NUMBER_WITHOUT_PLUS_SIGN",
|
|
488
|
-
countryCallingCode,
|
|
489
|
-
number: shorterNumber
|
|
490
|
-
};
|
|
491
|
-
}
|
|
492
|
-
return { number };
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
if (number[1] === "0") return {};
|
|
496
|
-
metadata = new Metadata(metadata);
|
|
497
|
-
var i = 2;
|
|
498
|
-
while (i - 1 <= 3 && i <= number.length) {
|
|
499
|
-
var _countryCallingCode = number.slice(1, i);
|
|
500
|
-
if (metadata.hasCallingCode(_countryCallingCode)) {
|
|
501
|
-
metadata.selectNumberingPlan(_countryCallingCode);
|
|
502
|
-
return {
|
|
503
|
-
countryCallingCodeSource: isNumberWithIddPrefix ? "FROM_NUMBER_WITH_IDD" : "FROM_NUMBER_WITH_PLUS_SIGN",
|
|
504
|
-
countryCallingCode: _countryCallingCode,
|
|
505
|
-
number: number.slice(i)
|
|
506
|
-
};
|
|
507
|
-
}
|
|
508
|
-
i++;
|
|
509
|
-
}
|
|
510
|
-
return {};
|
|
511
|
-
}
|
|
512
|
-
//#endregion
|
|
513
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js
|
|
514
|
-
function applyInternationalSeparatorStyle(formattedNumber) {
|
|
515
|
-
return formattedNumber.replace(new RegExp("[".concat(VALID_PUNCTUATION, "]+"), "g"), " ").trim();
|
|
516
|
-
}
|
|
517
|
-
//#endregion
|
|
518
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js
|
|
519
|
-
var FIRST_GROUP_PATTERN = /(\$\d)/;
|
|
520
|
-
function formatNationalNumberUsingFormat(number, format, _ref) {
|
|
521
|
-
var useInternationalFormat = _ref.useInternationalFormat, withNationalPrefix = _ref.withNationalPrefix;
|
|
522
|
-
_ref.carrierCode;
|
|
523
|
-
_ref.metadata;
|
|
524
|
-
var formattedNumber = number.replace(new RegExp(format.pattern()), useInternationalFormat ? format.internationalFormat() : withNationalPrefix && format.nationalPrefixFormattingRule() ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()) : format.format());
|
|
525
|
-
if (useInternationalFormat) return applyInternationalSeparatorStyle(formattedNumber);
|
|
526
|
-
return formattedNumber;
|
|
527
|
-
}
|
|
528
|
-
//#endregion
|
|
529
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/getIddPrefix.js
|
|
530
|
-
/**
|
|
531
|
-
* Pattern that makes it easy to distinguish whether a region has a single
|
|
532
|
-
* international dialing prefix or not. If a region has a single international
|
|
533
|
-
* prefix (e.g. 011 in USA), it will be represented as a string that contains
|
|
534
|
-
* a sequence of ASCII digits, and possibly a tilde, which signals waiting for
|
|
535
|
-
* the tone. If there are multiple available international prefixes in a
|
|
536
|
-
* region, they will be represented as a regex string that always contains one
|
|
537
|
-
* or more characters that are not ASCII digits or a tilde.
|
|
538
|
-
*/
|
|
539
|
-
var SINGLE_IDD_PREFIX_REG_EXP = /^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;
|
|
540
|
-
function getIddPrefix(country, callingCode, metadata) {
|
|
541
|
-
var countryMetadata = new Metadata(metadata);
|
|
542
|
-
countryMetadata.selectNumberingPlan(country, callingCode);
|
|
543
|
-
if (countryMetadata.defaultIDDPrefix()) return countryMetadata.defaultIDDPrefix();
|
|
544
|
-
if (SINGLE_IDD_PREFIX_REG_EXP.test(countryMetadata.IDDPrefix())) return countryMetadata.IDDPrefix();
|
|
545
|
-
}
|
|
546
|
-
//#endregion
|
|
547
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js
|
|
548
|
-
var RFC3966_EXTN_PREFIX = ";ext=";
|
|
549
|
-
/**
|
|
550
|
-
* Helper method for constructing regular expressions for parsing. Creates
|
|
551
|
-
* an expression that captures up to max_length digits.
|
|
552
|
-
* @return {string} RegEx pattern to capture extension digits.
|
|
553
|
-
*/
|
|
554
|
-
var getExtensionDigitsPattern = function getExtensionDigitsPattern(maxLength) {
|
|
555
|
-
return "([".concat(VALID_DIGITS, "]{1,").concat(maxLength, "})");
|
|
556
|
-
};
|
|
557
|
-
/**
|
|
558
|
-
* Helper initialiser method to create the regular-expression pattern to match
|
|
559
|
-
* extensions.
|
|
560
|
-
* Copy-pasted from Google's `libphonenumber`:
|
|
561
|
-
* https://github.com/google/libphonenumber/blob/55b2646ec9393f4d3d6661b9c82ef9e258e8b829/javascript/i18n/phonenumbers/phonenumberutil.js#L759-L766
|
|
562
|
-
* @return {string} RegEx pattern to capture extensions.
|
|
563
|
-
*/
|
|
564
|
-
function createExtensionPattern(purpose) {
|
|
565
|
-
/** @type {string} */
|
|
566
|
-
var extLimitAfterExplicitLabel = "20";
|
|
567
|
-
/** @type {string} */
|
|
568
|
-
var extLimitAfterLikelyLabel = "15";
|
|
569
|
-
/** @type {string} */
|
|
570
|
-
var extLimitAfterAmbiguousChar = "9";
|
|
571
|
-
/** @type {string} */
|
|
572
|
-
var extLimitWhenNotSure = "6";
|
|
573
|
-
/** @type {string} */
|
|
574
|
-
var possibleSeparatorsBetweenNumberAndExtLabel = "[ \xA0\\t,]*";
|
|
575
|
-
/** @type {string} */
|
|
576
|
-
var possibleCharsAfterExtLabel = "[:\\..]?[ \xA0\\t,-]*";
|
|
577
|
-
/** @type {string} */
|
|
578
|
-
var optionalExtnSuffix = "#?";
|
|
579
|
-
/** @type {string} */
|
|
580
|
-
var explicitExtLabels = "(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)";
|
|
581
|
-
/** @type {string} */
|
|
582
|
-
var ambiguousExtLabels = "(?:[xx##~~]|int|int)";
|
|
583
|
-
/** @type {string} */
|
|
584
|
-
var ambiguousSeparator = "[- ]+";
|
|
585
|
-
/** @type {string} */
|
|
586
|
-
var possibleSeparatorsNumberExtLabelNoComma = "[ \xA0\\t]*";
|
|
587
|
-
/** @type {string} */
|
|
588
|
-
var autoDiallingAndExtLabelsFound = "(?:,{2}|;)";
|
|
589
|
-
/** @type {string} */
|
|
590
|
-
var rfcExtn = RFC3966_EXTN_PREFIX + getExtensionDigitsPattern(extLimitAfterExplicitLabel);
|
|
591
|
-
/** @type {string} */
|
|
592
|
-
var explicitExtn = possibleSeparatorsBetweenNumberAndExtLabel + explicitExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterExplicitLabel) + optionalExtnSuffix;
|
|
593
|
-
/** @type {string} */
|
|
594
|
-
var ambiguousExtn = possibleSeparatorsBetweenNumberAndExtLabel + ambiguousExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix;
|
|
595
|
-
/** @type {string} */
|
|
596
|
-
var americanStyleExtnWithSuffix = ambiguousSeparator + getExtensionDigitsPattern(extLimitWhenNotSure) + "#";
|
|
597
|
-
/** @type {string} */
|
|
598
|
-
var autoDiallingExtn = possibleSeparatorsNumberExtLabelNoComma + autoDiallingAndExtLabelsFound + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterLikelyLabel) + optionalExtnSuffix;
|
|
599
|
-
/** @type {string} */
|
|
600
|
-
var onlyCommasExtn = possibleSeparatorsNumberExtLabelNoComma + "(?:,)+" + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix;
|
|
601
|
-
return rfcExtn + "|" + explicitExtn + "|" + ambiguousExtn + "|" + americanStyleExtnWithSuffix + "|" + autoDiallingExtn + "|" + onlyCommasExtn;
|
|
602
|
-
}
|
|
603
|
-
//#endregion
|
|
604
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/isViablePhoneNumber.js
|
|
605
|
-
var MIN_LENGTH_PHONE_NUMBER_PATTERN = "[" + VALID_DIGITS + "]{2}";
|
|
606
|
-
var VALID_PHONE_NUMBER = "[" + PLUS_CHARS + "]{0,1}(?:[" + VALID_PUNCTUATION + "]*[" + VALID_DIGITS + "]){3,}[" + VALID_PUNCTUATION + VALID_DIGITS + "]*";
|
|
607
|
-
var VALID_PHONE_NUMBER_START_REG_EXP = new RegExp("^[" + PLUS_CHARS + "]{0,1}(?:[" + VALID_PUNCTUATION + "]*[" + VALID_DIGITS + "]){1,2}$", "i");
|
|
608
|
-
var VALID_PHONE_NUMBER_WITH_EXTENSION = VALID_PHONE_NUMBER + "(?:" + createExtensionPattern() + ")?";
|
|
609
|
-
var VALID_PHONE_NUMBER_PATTERN = new RegExp("^" + MIN_LENGTH_PHONE_NUMBER_PATTERN + "$|^" + VALID_PHONE_NUMBER_WITH_EXTENSION + "$", "i");
|
|
610
|
-
function isViablePhoneNumber(number) {
|
|
611
|
-
return number.length >= 2 && VALID_PHONE_NUMBER_PATTERN.test(number);
|
|
612
|
-
}
|
|
613
|
-
function isViablePhoneNumberStart(number) {
|
|
614
|
-
return VALID_PHONE_NUMBER_START_REG_EXP.test(number);
|
|
615
|
-
}
|
|
616
|
-
//#endregion
|
|
617
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/RFC3966.js
|
|
618
|
-
/**
|
|
619
|
-
* @param {object} - `{ ?number, ?extension }`.
|
|
620
|
-
* @return {string} Phone URI (RFC 3966).
|
|
621
|
-
*/
|
|
622
|
-
function formatRFC3966(_ref) {
|
|
623
|
-
var number = _ref.number, ext = _ref.ext;
|
|
624
|
-
if (!number) return "";
|
|
625
|
-
if (number[0] !== "+") throw new Error("\"formatRFC3966()\" expects \"number\" to be in E.164 format.");
|
|
626
|
-
return "tel:".concat(number).concat(ext ? ";ext=" + ext : "");
|
|
627
|
-
}
|
|
628
|
-
//#endregion
|
|
629
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/format.js
|
|
630
|
-
var DEFAULT_OPTIONS = { formatExtension: function formatExtension(formattedNumber, extension, metadata) {
|
|
631
|
-
return "".concat(formattedNumber).concat(metadata.ext()).concat(extension);
|
|
632
|
-
} };
|
|
633
|
-
/**
|
|
634
|
-
* Formats a phone number.
|
|
635
|
-
*
|
|
636
|
-
* format(phoneNumberInstance, 'INTERNATIONAL', { ..., v2: true }, metadata)
|
|
637
|
-
* format(phoneNumberInstance, 'NATIONAL', { ..., v2: true }, metadata)
|
|
638
|
-
*
|
|
639
|
-
* format({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL', { ... }, metadata)
|
|
640
|
-
* format({ phone: '8005553535', country: 'RU' }, 'NATIONAL', undefined, metadata)
|
|
641
|
-
*
|
|
642
|
-
* @param {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`.
|
|
643
|
-
* @param {string} format
|
|
644
|
-
* @param {object} [options]
|
|
645
|
-
* @param {object} metadata
|
|
646
|
-
* @return {string}
|
|
647
|
-
*/
|
|
648
|
-
function formatNumber(input, format, options, metadata) {
|
|
649
|
-
if (options) options = merge({}, DEFAULT_OPTIONS, options);
|
|
650
|
-
else options = DEFAULT_OPTIONS;
|
|
651
|
-
metadata = new Metadata(metadata);
|
|
652
|
-
if (input.country && input.country !== "001") {
|
|
653
|
-
if (!metadata.hasCountry(input.country)) throw new Error("Unknown country: ".concat(input.country));
|
|
654
|
-
metadata.selectNumberingPlan(input.country);
|
|
655
|
-
} else if (input.countryCallingCode) metadata.selectNumberingPlan(input.countryCallingCode);
|
|
656
|
-
else return input.phone || "";
|
|
657
|
-
var countryCallingCode = metadata.countryCallingCode();
|
|
658
|
-
var nationalNumber = options.v2 ? input.nationalNumber : input.phone;
|
|
659
|
-
var number;
|
|
660
|
-
switch (format) {
|
|
661
|
-
case "NATIONAL":
|
|
662
|
-
if (!nationalNumber) return "";
|
|
663
|
-
number = formatNationalNumber$2(nationalNumber, input.carrierCode, "NATIONAL", metadata, options);
|
|
664
|
-
return addExtension(number, input.ext, metadata, options.formatExtension);
|
|
665
|
-
case "INTERNATIONAL":
|
|
666
|
-
if (!nationalNumber) return "+".concat(countryCallingCode);
|
|
667
|
-
number = formatNationalNumber$2(nationalNumber, null, "INTERNATIONAL", metadata, options);
|
|
668
|
-
number = "+".concat(countryCallingCode, " ").concat(number);
|
|
669
|
-
return addExtension(number, input.ext, metadata, options.formatExtension);
|
|
670
|
-
case "E.164": return "+".concat(countryCallingCode).concat(nationalNumber);
|
|
671
|
-
case "RFC3966": return formatRFC3966({
|
|
672
|
-
number: "+".concat(countryCallingCode).concat(nationalNumber),
|
|
673
|
-
ext: input.ext
|
|
674
|
-
});
|
|
675
|
-
case "IDD":
|
|
676
|
-
if (!options.fromCountry) return;
|
|
677
|
-
return addExtension(formatIDD(nationalNumber, input.carrierCode, countryCallingCode, options.fromCountry, metadata), input.ext, metadata, options.formatExtension);
|
|
678
|
-
default: throw new Error("Unknown \"format\" argument passed to \"formatNumber()\": \"".concat(format, "\""));
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
function formatNationalNumber$2(number, carrierCode, formatAs, metadata, options) {
|
|
682
|
-
var format = chooseFormatForNumber(metadata.formats(), number);
|
|
683
|
-
if (!format) return number;
|
|
684
|
-
return formatNationalNumberUsingFormat(number, format, {
|
|
685
|
-
useInternationalFormat: formatAs === "INTERNATIONAL",
|
|
686
|
-
withNationalPrefix: format.nationalPrefixIsOptionalWhenFormattingInNationalFormat() && options && options.nationalPrefix === false ? false : true,
|
|
687
|
-
carrierCode,
|
|
688
|
-
metadata
|
|
689
|
-
});
|
|
690
|
-
}
|
|
691
|
-
function chooseFormatForNumber(availableFormats, nationalNumber) {
|
|
692
|
-
return pickFirstMatchingElement(availableFormats, function(format) {
|
|
693
|
-
if (format.leadingDigitsPatterns().length > 0) {
|
|
694
|
-
var lastLeadingDigitsPattern = format.leadingDigitsPatterns()[format.leadingDigitsPatterns().length - 1];
|
|
695
|
-
if (nationalNumber.search(lastLeadingDigitsPattern) !== 0) return false;
|
|
696
|
-
}
|
|
697
|
-
return matchesEntirely(nationalNumber, format.pattern());
|
|
698
|
-
});
|
|
699
|
-
}
|
|
700
|
-
function addExtension(formattedNumber, ext, metadata, formatExtension) {
|
|
701
|
-
return ext ? formatExtension(formattedNumber, ext, metadata) : formattedNumber;
|
|
702
|
-
}
|
|
703
|
-
function formatIDD(nationalNumber, carrierCode, countryCallingCode, fromCountry, metadata) {
|
|
704
|
-
if (getCountryCallingCode(fromCountry, metadata.metadata) === countryCallingCode) {
|
|
705
|
-
var formattedNumber = formatNationalNumber$2(nationalNumber, carrierCode, "NATIONAL", metadata);
|
|
706
|
-
if (countryCallingCode === "1") return countryCallingCode + " " + formattedNumber;
|
|
707
|
-
return formattedNumber;
|
|
708
|
-
}
|
|
709
|
-
var iddPrefix = getIddPrefix(fromCountry, void 0, metadata.metadata);
|
|
710
|
-
if (iddPrefix) return "".concat(iddPrefix, " ").concat(countryCallingCode, " ").concat(formatNationalNumber$2(nationalNumber, null, "INTERNATIONAL", metadata));
|
|
711
|
-
}
|
|
712
|
-
function merge() {
|
|
713
|
-
var i = 1;
|
|
714
|
-
for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) objects[_key] = arguments[_key];
|
|
715
|
-
while (i < objects.length) {
|
|
716
|
-
if (objects[i]) for (var key in objects[i]) objects[0][key] = objects[i][key];
|
|
717
|
-
i++;
|
|
718
|
-
}
|
|
719
|
-
return objects[0];
|
|
720
|
-
}
|
|
721
|
-
function pickFirstMatchingElement(elements, testFunction) {
|
|
722
|
-
var i = 0;
|
|
723
|
-
while (i < elements.length) {
|
|
724
|
-
if (testFunction(elements[i])) return elements[i];
|
|
725
|
-
i++;
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
//#endregion
|
|
729
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/PhoneNumber.js
|
|
730
|
-
function _typeof$10(o) {
|
|
731
|
-
"@babel/helpers - typeof";
|
|
732
|
-
return _typeof$10 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
733
|
-
return typeof o;
|
|
734
|
-
} : function(o) {
|
|
735
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
736
|
-
}, _typeof$10(o);
|
|
737
|
-
}
|
|
738
|
-
function ownKeys$3(e, r) {
|
|
739
|
-
var t = Object.keys(e);
|
|
740
|
-
if (Object.getOwnPropertySymbols) {
|
|
741
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
742
|
-
r && (o = o.filter(function(r) {
|
|
743
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
744
|
-
})), t.push.apply(t, o);
|
|
745
|
-
}
|
|
746
|
-
return t;
|
|
747
|
-
}
|
|
748
|
-
function _objectSpread$3(e) {
|
|
749
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
750
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
751
|
-
r % 2 ? ownKeys$3(Object(t), !0).forEach(function(r) {
|
|
752
|
-
_defineProperty$3(e, r, t[r]);
|
|
753
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function(r) {
|
|
754
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
755
|
-
});
|
|
756
|
-
}
|
|
757
|
-
return e;
|
|
758
|
-
}
|
|
759
|
-
function _defineProperty$3(e, r, t) {
|
|
760
|
-
return (r = _toPropertyKey$10(r)) in e ? Object.defineProperty(e, r, {
|
|
761
|
-
value: t,
|
|
762
|
-
enumerable: !0,
|
|
763
|
-
configurable: !0,
|
|
764
|
-
writable: !0
|
|
765
|
-
}) : e[r] = t, e;
|
|
766
|
-
}
|
|
767
|
-
function _classCallCheck$7(a, n) {
|
|
768
|
-
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
769
|
-
}
|
|
770
|
-
function _defineProperties$7(e, r) {
|
|
771
|
-
for (var t = 0; t < r.length; t++) {
|
|
772
|
-
var o = r[t];
|
|
773
|
-
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$10(o.key), o);
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
function _createClass$7(e, r, t) {
|
|
777
|
-
return r && _defineProperties$7(e.prototype, r), t && _defineProperties$7(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
778
|
-
}
|
|
779
|
-
function _toPropertyKey$10(t) {
|
|
780
|
-
var i = _toPrimitive$10(t, "string");
|
|
781
|
-
return "symbol" == _typeof$10(i) ? i : i + "";
|
|
782
|
-
}
|
|
783
|
-
function _toPrimitive$10(t, r) {
|
|
784
|
-
if ("object" != _typeof$10(t) || !t) return t;
|
|
785
|
-
var e = t[Symbol.toPrimitive];
|
|
786
|
-
if (void 0 !== e) {
|
|
787
|
-
var i = e.call(t, r || "default");
|
|
788
|
-
if ("object" != _typeof$10(i)) return i;
|
|
789
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
790
|
-
}
|
|
791
|
-
return ("string" === r ? String : Number)(t);
|
|
792
|
-
}
|
|
793
|
-
var USE_NON_GEOGRAPHIC_COUNTRY_CODE$2 = false;
|
|
794
|
-
var PhoneNumber = /* @__PURE__ */ function() {
|
|
795
|
-
/**
|
|
796
|
-
* @param {string} countryOrCountryCallingCode
|
|
797
|
-
* @param {string} nationalNumber
|
|
798
|
-
* @param {object} metadata — Metadata JSON
|
|
799
|
-
* @return {PhoneNumber}
|
|
800
|
-
*/
|
|
801
|
-
function PhoneNumber(countryOrCountryCallingCode, nationalNumber, metadata) {
|
|
802
|
-
_classCallCheck$7(this, PhoneNumber);
|
|
803
|
-
if (!countryOrCountryCallingCode) throw new TypeError("First argument is required");
|
|
804
|
-
if (typeof countryOrCountryCallingCode !== "string") throw new TypeError("First argument must be a string");
|
|
805
|
-
if (countryOrCountryCallingCode[0] === "+" && !nationalNumber) throw new TypeError("`metadata` argument not passed");
|
|
806
|
-
if (isObject(nationalNumber) && isObject(nationalNumber.countries)) {
|
|
807
|
-
metadata = nationalNumber;
|
|
808
|
-
var e164Number = countryOrCountryCallingCode;
|
|
809
|
-
if (!E164_NUMBER_REGEXP.test(e164Number)) throw new Error("Invalid `number` argument passed: must consist of a \"+\" followed by digits");
|
|
810
|
-
var _extractCountryCallin = extractCountryCallingCode(e164Number, void 0, void 0, void 0, metadata), _countryCallingCode = _extractCountryCallin.countryCallingCode;
|
|
811
|
-
nationalNumber = _extractCountryCallin.number;
|
|
812
|
-
countryOrCountryCallingCode = _countryCallingCode;
|
|
813
|
-
if (!nationalNumber) throw new Error("Invalid `number` argument passed: too short");
|
|
814
|
-
}
|
|
815
|
-
if (!nationalNumber) throw new TypeError("`nationalNumber` argument is required");
|
|
816
|
-
if (typeof nationalNumber !== "string") throw new TypeError("`nationalNumber` argument must be a string");
|
|
817
|
-
validateMetadata(metadata);
|
|
818
|
-
var _getCountryAndCountry = getCountryAndCountryCallingCode(countryOrCountryCallingCode, metadata), country = _getCountryAndCountry.country, countryCallingCode = _getCountryAndCountry.countryCallingCode;
|
|
819
|
-
this.country = country;
|
|
820
|
-
this.countryCallingCode = countryCallingCode;
|
|
821
|
-
this.nationalNumber = nationalNumber;
|
|
822
|
-
this.number = "+" + this.countryCallingCode + this.nationalNumber;
|
|
823
|
-
this.getMetadata = function() {
|
|
824
|
-
return metadata;
|
|
825
|
-
};
|
|
826
|
-
}
|
|
827
|
-
return _createClass$7(PhoneNumber, [
|
|
828
|
-
{
|
|
829
|
-
key: "setExt",
|
|
830
|
-
value: function setExt(ext) {
|
|
831
|
-
this.ext = ext;
|
|
832
|
-
}
|
|
833
|
-
},
|
|
834
|
-
{
|
|
835
|
-
key: "getPossibleCountries",
|
|
836
|
-
value: function getPossibleCountries() {
|
|
837
|
-
if (this.country) return [this.country];
|
|
838
|
-
return getPossibleCountriesForNumber(this.countryCallingCode, this.nationalNumber, this.getMetadata());
|
|
839
|
-
}
|
|
840
|
-
},
|
|
841
|
-
{
|
|
842
|
-
key: "isPossible",
|
|
843
|
-
value: function isPossible() {
|
|
844
|
-
return isPossiblePhoneNumber(this, { v2: true }, this.getMetadata());
|
|
845
|
-
}
|
|
846
|
-
},
|
|
847
|
-
{
|
|
848
|
-
key: "isValid",
|
|
849
|
-
value: function isValid() {
|
|
850
|
-
return isValidNumber(this, { v2: true }, this.getMetadata());
|
|
851
|
-
}
|
|
852
|
-
},
|
|
853
|
-
{
|
|
854
|
-
key: "isNonGeographic",
|
|
855
|
-
value: function isNonGeographic() {
|
|
856
|
-
return new Metadata(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode);
|
|
857
|
-
}
|
|
858
|
-
},
|
|
859
|
-
{
|
|
860
|
-
key: "isEqual",
|
|
861
|
-
value: function isEqual(phoneNumber) {
|
|
862
|
-
return this.number === phoneNumber.number && this.ext === phoneNumber.ext;
|
|
863
|
-
}
|
|
864
|
-
},
|
|
865
|
-
{
|
|
866
|
-
key: "getType",
|
|
867
|
-
value: function getType() {
|
|
868
|
-
return getNumberType(this, { v2: true }, this.getMetadata());
|
|
869
|
-
}
|
|
870
|
-
},
|
|
871
|
-
{
|
|
872
|
-
key: "format",
|
|
873
|
-
value: function format(_format, options) {
|
|
874
|
-
return formatNumber(this, _format, options ? _objectSpread$3(_objectSpread$3({}, options), {}, { v2: true }) : { v2: true }, this.getMetadata());
|
|
875
|
-
}
|
|
876
|
-
},
|
|
877
|
-
{
|
|
878
|
-
key: "formatNational",
|
|
879
|
-
value: function formatNational(options) {
|
|
880
|
-
return this.format("NATIONAL", options);
|
|
881
|
-
}
|
|
882
|
-
},
|
|
883
|
-
{
|
|
884
|
-
key: "formatInternational",
|
|
885
|
-
value: function formatInternational(options) {
|
|
886
|
-
return this.format("INTERNATIONAL", options);
|
|
887
|
-
}
|
|
888
|
-
},
|
|
889
|
-
{
|
|
890
|
-
key: "getURI",
|
|
891
|
-
value: function getURI(options) {
|
|
892
|
-
return this.format("RFC3966", options);
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
]);
|
|
896
|
-
}();
|
|
897
|
-
var isCountryCode = function isCountryCode(value) {
|
|
898
|
-
return /^[A-Z]{2}$/.test(value);
|
|
899
|
-
};
|
|
900
|
-
function getCountryAndCountryCallingCode(countryOrCountryCallingCode, metadataJson) {
|
|
901
|
-
var country;
|
|
902
|
-
var countryCallingCode;
|
|
903
|
-
var metadata = new Metadata(metadataJson);
|
|
904
|
-
if (isCountryCode(countryOrCountryCallingCode)) {
|
|
905
|
-
country = countryOrCountryCallingCode;
|
|
906
|
-
metadata.selectNumberingPlan(country);
|
|
907
|
-
countryCallingCode = metadata.countryCallingCode();
|
|
908
|
-
} else {
|
|
909
|
-
countryCallingCode = countryOrCountryCallingCode;
|
|
910
|
-
/* istanbul ignore if */
|
|
911
|
-
if (USE_NON_GEOGRAPHIC_COUNTRY_CODE$2) {
|
|
912
|
-
if (metadata.isNonGeographicCallingCode(countryCallingCode)) country = "001";
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
return {
|
|
916
|
-
country,
|
|
917
|
-
countryCallingCode
|
|
918
|
-
};
|
|
919
|
-
}
|
|
920
|
-
var E164_NUMBER_REGEXP = /^\+\d+$/;
|
|
921
|
-
//#endregion
|
|
922
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/ParseError.js
|
|
923
|
-
function _typeof$9(o) {
|
|
924
|
-
"@babel/helpers - typeof";
|
|
925
|
-
return _typeof$9 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
926
|
-
return typeof o;
|
|
927
|
-
} : function(o) {
|
|
928
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
929
|
-
}, _typeof$9(o);
|
|
930
|
-
}
|
|
931
|
-
function _defineProperties$6(e, r) {
|
|
932
|
-
for (var t = 0; t < r.length; t++) {
|
|
933
|
-
var o = r[t];
|
|
934
|
-
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$9(o.key), o);
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
function _createClass$6(e, r, t) {
|
|
938
|
-
return r && _defineProperties$6(e.prototype, r), t && _defineProperties$6(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
939
|
-
}
|
|
940
|
-
function _toPropertyKey$9(t) {
|
|
941
|
-
var i = _toPrimitive$9(t, "string");
|
|
942
|
-
return "symbol" == _typeof$9(i) ? i : i + "";
|
|
943
|
-
}
|
|
944
|
-
function _toPrimitive$9(t, r) {
|
|
945
|
-
if ("object" != _typeof$9(t) || !t) return t;
|
|
946
|
-
var e = t[Symbol.toPrimitive];
|
|
947
|
-
if (void 0 !== e) {
|
|
948
|
-
var i = e.call(t, r || "default");
|
|
949
|
-
if ("object" != _typeof$9(i)) return i;
|
|
950
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
951
|
-
}
|
|
952
|
-
return ("string" === r ? String : Number)(t);
|
|
953
|
-
}
|
|
954
|
-
function _classCallCheck$6(a, n) {
|
|
955
|
-
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
956
|
-
}
|
|
957
|
-
function _callSuper(t, o, e) {
|
|
958
|
-
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
|
|
959
|
-
}
|
|
960
|
-
function _possibleConstructorReturn(t, e) {
|
|
961
|
-
if (e && ("object" == _typeof$9(e) || "function" == typeof e)) return e;
|
|
962
|
-
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
963
|
-
return _assertThisInitialized(t);
|
|
964
|
-
}
|
|
965
|
-
function _assertThisInitialized(e) {
|
|
966
|
-
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
967
|
-
return e;
|
|
968
|
-
}
|
|
969
|
-
function _inherits(t, e) {
|
|
970
|
-
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
971
|
-
t.prototype = Object.create(e && e.prototype, { constructor: {
|
|
972
|
-
value: t,
|
|
973
|
-
writable: !0,
|
|
974
|
-
configurable: !0
|
|
975
|
-
} }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e);
|
|
976
|
-
}
|
|
977
|
-
function _wrapNativeSuper(t) {
|
|
978
|
-
var r = "function" == typeof Map ? /* @__PURE__ */ new Map() : void 0;
|
|
979
|
-
return _wrapNativeSuper = function _wrapNativeSuper(t) {
|
|
980
|
-
if (null === t || !_isNativeFunction(t)) return t;
|
|
981
|
-
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
|
|
982
|
-
if (void 0 !== r) {
|
|
983
|
-
if (r.has(t)) return r.get(t);
|
|
984
|
-
r.set(t, Wrapper);
|
|
985
|
-
}
|
|
986
|
-
function Wrapper() {
|
|
987
|
-
return _construct(t, arguments, _getPrototypeOf(this).constructor);
|
|
988
|
-
}
|
|
989
|
-
return Wrapper.prototype = Object.create(t.prototype, { constructor: {
|
|
990
|
-
value: Wrapper,
|
|
991
|
-
enumerable: !1,
|
|
992
|
-
writable: !0,
|
|
993
|
-
configurable: !0
|
|
994
|
-
} }), _setPrototypeOf(Wrapper, t);
|
|
995
|
-
}, _wrapNativeSuper(t);
|
|
996
|
-
}
|
|
997
|
-
function _construct(t, e, r) {
|
|
998
|
-
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
999
|
-
var o = [null];
|
|
1000
|
-
o.push.apply(o, e);
|
|
1001
|
-
var p = new (t.bind.apply(t, o))();
|
|
1002
|
-
return r && _setPrototypeOf(p, r.prototype), p;
|
|
1003
|
-
}
|
|
1004
|
-
function _isNativeReflectConstruct() {
|
|
1005
|
-
try {
|
|
1006
|
-
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
1007
|
-
} catch (t) {}
|
|
1008
|
-
return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
|
|
1009
|
-
return !!t;
|
|
1010
|
-
})();
|
|
1011
|
-
}
|
|
1012
|
-
function _isNativeFunction(t) {
|
|
1013
|
-
try {
|
|
1014
|
-
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
1015
|
-
} catch (n) {
|
|
1016
|
-
return "function" == typeof t;
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
function _setPrototypeOf(t, e) {
|
|
1020
|
-
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
|
|
1021
|
-
return t.__proto__ = e, t;
|
|
1022
|
-
}, _setPrototypeOf(t, e);
|
|
1023
|
-
}
|
|
1024
|
-
function _getPrototypeOf(t) {
|
|
1025
|
-
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
1026
|
-
return t.__proto__ || Object.getPrototypeOf(t);
|
|
1027
|
-
}, _getPrototypeOf(t);
|
|
1028
|
-
}
|
|
1029
|
-
var ParseError = /* @__PURE__ */ function(_Error) {
|
|
1030
|
-
function ParseError(code) {
|
|
1031
|
-
var _this;
|
|
1032
|
-
_classCallCheck$6(this, ParseError);
|
|
1033
|
-
_this = _callSuper(this, ParseError, [code]);
|
|
1034
|
-
Object.setPrototypeOf(_this, ParseError.prototype);
|
|
1035
|
-
_this.name = _this.constructor.name;
|
|
1036
|
-
return _this;
|
|
1037
|
-
}
|
|
1038
|
-
_inherits(ParseError, _Error);
|
|
1039
|
-
return _createClass$6(ParseError);
|
|
1040
|
-
}(/* @__PURE__ */ _wrapNativeSuper(Error));
|
|
1041
|
-
//#endregion
|
|
1042
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/extension/extractExtension.js
|
|
1043
|
-
var EXTN_PATTERN = new RegExp("(?:" + createExtensionPattern() + ")$", "i");
|
|
1044
|
-
function extractExtension(number) {
|
|
1045
|
-
var start = number.search(EXTN_PATTERN);
|
|
1046
|
-
if (start < 0) return {};
|
|
1047
|
-
var numberWithoutExtension = number.slice(0, start);
|
|
1048
|
-
var matches = number.match(EXTN_PATTERN);
|
|
1049
|
-
var i = 1;
|
|
1050
|
-
while (i < matches.length) {
|
|
1051
|
-
if (matches[i]) return {
|
|
1052
|
-
number: numberWithoutExtension,
|
|
1053
|
-
ext: matches[i]
|
|
1054
|
-
};
|
|
1055
|
-
i++;
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
//#endregion
|
|
1059
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/parseDigits.js
|
|
1060
|
-
function _createForOfIteratorHelperLoose$4(r, e) {
|
|
1061
|
-
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
1062
|
-
if (t) return (t = t.call(r)).next.bind(t);
|
|
1063
|
-
if (Array.isArray(r) || (t = _unsupportedIterableToArray$7(r)) || e && r && "number" == typeof r.length) {
|
|
1064
|
-
t && (r = t);
|
|
1065
|
-
var o = 0;
|
|
1066
|
-
return function() {
|
|
1067
|
-
return o >= r.length ? { done: !0 } : {
|
|
1068
|
-
done: !1,
|
|
1069
|
-
value: r[o++]
|
|
1070
|
-
};
|
|
1071
|
-
};
|
|
1072
|
-
}
|
|
1073
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1074
|
-
}
|
|
1075
|
-
function _unsupportedIterableToArray$7(r, a) {
|
|
1076
|
-
if (r) {
|
|
1077
|
-
if ("string" == typeof r) return _arrayLikeToArray$7(r, a);
|
|
1078
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
1079
|
-
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$7(r, a) : void 0;
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
function _arrayLikeToArray$7(r, a) {
|
|
1083
|
-
(null == a || a > r.length) && (a = r.length);
|
|
1084
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
1085
|
-
return n;
|
|
1086
|
-
}
|
|
1087
|
-
var DIGITS = {
|
|
1088
|
-
"0": "0",
|
|
1089
|
-
"1": "1",
|
|
1090
|
-
"2": "2",
|
|
1091
|
-
"3": "3",
|
|
1092
|
-
"4": "4",
|
|
1093
|
-
"5": "5",
|
|
1094
|
-
"6": "6",
|
|
1095
|
-
"7": "7",
|
|
1096
|
-
"8": "8",
|
|
1097
|
-
"9": "9",
|
|
1098
|
-
"0": "0",
|
|
1099
|
-
"1": "1",
|
|
1100
|
-
"2": "2",
|
|
1101
|
-
"3": "3",
|
|
1102
|
-
"4": "4",
|
|
1103
|
-
"5": "5",
|
|
1104
|
-
"6": "6",
|
|
1105
|
-
"7": "7",
|
|
1106
|
-
"8": "8",
|
|
1107
|
-
"9": "9",
|
|
1108
|
-
"٠": "0",
|
|
1109
|
-
"١": "1",
|
|
1110
|
-
"٢": "2",
|
|
1111
|
-
"٣": "3",
|
|
1112
|
-
"٤": "4",
|
|
1113
|
-
"٥": "5",
|
|
1114
|
-
"٦": "6",
|
|
1115
|
-
"٧": "7",
|
|
1116
|
-
"٨": "8",
|
|
1117
|
-
"٩": "9",
|
|
1118
|
-
"۰": "0",
|
|
1119
|
-
"۱": "1",
|
|
1120
|
-
"۲": "2",
|
|
1121
|
-
"۳": "3",
|
|
1122
|
-
"۴": "4",
|
|
1123
|
-
"۵": "5",
|
|
1124
|
-
"۶": "6",
|
|
1125
|
-
"۷": "7",
|
|
1126
|
-
"۸": "8",
|
|
1127
|
-
"۹": "9"
|
|
1128
|
-
};
|
|
1129
|
-
function parseDigit(character) {
|
|
1130
|
-
return DIGITS[character];
|
|
1131
|
-
}
|
|
1132
|
-
/**
|
|
1133
|
-
* Parses phone number digits from a string.
|
|
1134
|
-
* Drops all punctuation leaving only digits.
|
|
1135
|
-
* Also converts wide-ascii and arabic-indic numerals to conventional numerals.
|
|
1136
|
-
* E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.
|
|
1137
|
-
* @param {string} string
|
|
1138
|
-
* @return {string}
|
|
1139
|
-
* @example
|
|
1140
|
-
* ```js
|
|
1141
|
-
* parseDigits('8 (800) 555')
|
|
1142
|
-
* // Outputs '8800555'.
|
|
1143
|
-
* ```
|
|
1144
|
-
*/
|
|
1145
|
-
function parseDigits(string) {
|
|
1146
|
-
var result = "";
|
|
1147
|
-
for (var _iterator = _createForOfIteratorHelperLoose$4(string.split("")), _step; !(_step = _iterator()).done;) {
|
|
1148
|
-
var character = _step.value;
|
|
1149
|
-
var digit = parseDigit(character);
|
|
1150
|
-
if (digit) result += digit;
|
|
1151
|
-
}
|
|
1152
|
-
return result;
|
|
1153
|
-
}
|
|
1154
|
-
//#endregion
|
|
1155
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js
|
|
1156
|
-
function _createForOfIteratorHelperLoose$3(r, e) {
|
|
1157
|
-
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
1158
|
-
if (t) return (t = t.call(r)).next.bind(t);
|
|
1159
|
-
if (Array.isArray(r) || (t = _unsupportedIterableToArray$6(r)) || e && r && "number" == typeof r.length) {
|
|
1160
|
-
t && (r = t);
|
|
1161
|
-
var o = 0;
|
|
1162
|
-
return function() {
|
|
1163
|
-
return o >= r.length ? { done: !0 } : {
|
|
1164
|
-
done: !1,
|
|
1165
|
-
value: r[o++]
|
|
1166
|
-
};
|
|
1167
|
-
};
|
|
1168
|
-
}
|
|
1169
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1170
|
-
}
|
|
1171
|
-
function _unsupportedIterableToArray$6(r, a) {
|
|
1172
|
-
if (r) {
|
|
1173
|
-
if ("string" == typeof r) return _arrayLikeToArray$6(r, a);
|
|
1174
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
1175
|
-
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$6(r, a) : void 0;
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
function _arrayLikeToArray$6(r, a) {
|
|
1179
|
-
(null == a || a > r.length) && (a = r.length);
|
|
1180
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
1181
|
-
return n;
|
|
1182
|
-
}
|
|
1183
|
-
/**
|
|
1184
|
-
* Parses phone number characters from a string.
|
|
1185
|
-
* Drops all punctuation leaving only digits and the leading `+` sign (if any).
|
|
1186
|
-
* Also converts wide-ascii and arabic-indic numerals to conventional numerals.
|
|
1187
|
-
* E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.
|
|
1188
|
-
* @param {string} string
|
|
1189
|
-
* @return {string}
|
|
1190
|
-
* @example
|
|
1191
|
-
* ```js
|
|
1192
|
-
* // Outputs '8800555'.
|
|
1193
|
-
* parseIncompletePhoneNumber('8 (800) 555')
|
|
1194
|
-
* // Outputs '+7800555'.
|
|
1195
|
-
* parseIncompletePhoneNumber('+7 800 555')
|
|
1196
|
-
* ```
|
|
1197
|
-
*/
|
|
1198
|
-
function parseIncompletePhoneNumber(string) {
|
|
1199
|
-
var result = "";
|
|
1200
|
-
for (var _iterator = _createForOfIteratorHelperLoose$3(string.split("")), _step; !(_step = _iterator()).done;) {
|
|
1201
|
-
var character = _step.value;
|
|
1202
|
-
result += parsePhoneNumberCharacter(character, result) || "";
|
|
1203
|
-
}
|
|
1204
|
-
return result;
|
|
1205
|
-
}
|
|
1206
|
-
/**
|
|
1207
|
-
* Parses next character while parsing phone number digits (including a `+`)
|
|
1208
|
-
* from text: discards everything except `+` and digits, and `+` is only allowed
|
|
1209
|
-
* at the start of a phone number.
|
|
1210
|
-
* For example, is used in `react-phone-number-input` where it uses
|
|
1211
|
-
* [`input-format`](https://gitlab.com/catamphetamine/input-format).
|
|
1212
|
-
* @param {string} character - Yet another character from raw input string.
|
|
1213
|
-
* @param {string?} prevParsedCharacters - Previous parsed characters.
|
|
1214
|
-
* @param {function?} eventListener - An optional "on event" function.
|
|
1215
|
-
* @return {string?} The parsed character.
|
|
1216
|
-
*/
|
|
1217
|
-
function parsePhoneNumberCharacter(character, prevParsedCharacters, eventListener) {
|
|
1218
|
-
if (character === "+") {
|
|
1219
|
-
if (prevParsedCharacters) {
|
|
1220
|
-
if (typeof eventListener === "function") eventListener("end");
|
|
1221
|
-
return;
|
|
1222
|
-
}
|
|
1223
|
-
return "+";
|
|
1224
|
-
}
|
|
1225
|
-
return parseDigit(character);
|
|
1226
|
-
}
|
|
1227
|
-
var RFC3966_PHONE_DIGIT_ = "([" + VALID_DIGITS + "]|[\\-\\.\\(\\)]?)";
|
|
1228
|
-
var RFC3966_GLOBAL_NUMBER_DIGITS_ = "^\\+" + RFC3966_PHONE_DIGIT_ + "*[" + VALID_DIGITS + "]" + RFC3966_PHONE_DIGIT_ + "*$";
|
|
1229
|
-
/**
|
|
1230
|
-
* Regular expression of valid global-number-digits for the phone-context
|
|
1231
|
-
* parameter, following the syntax defined in RFC3966.
|
|
1232
|
-
*/
|
|
1233
|
-
var RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_ = new RegExp(RFC3966_GLOBAL_NUMBER_DIGITS_, "g");
|
|
1234
|
-
var ALPHANUM_ = VALID_DIGITS;
|
|
1235
|
-
var RFC3966_DOMAINLABEL_ = "[" + ALPHANUM_ + "]+((\\-)*[" + ALPHANUM_ + "])*";
|
|
1236
|
-
var RFC3966_TOPLABEL_ = "[a-zA-Z]+((\\-)*[" + ALPHANUM_ + "])*";
|
|
1237
|
-
var RFC3966_DOMAINNAME_ = "^(" + RFC3966_DOMAINLABEL_ + "\\.)*" + RFC3966_TOPLABEL_ + "\\.?$";
|
|
1238
|
-
/**
|
|
1239
|
-
* Regular expression of valid domainname for the phone-context parameter,
|
|
1240
|
-
* following the syntax defined in RFC3966.
|
|
1241
|
-
*/
|
|
1242
|
-
var RFC3966_DOMAINNAME_PATTERN_ = new RegExp(RFC3966_DOMAINNAME_, "g");
|
|
1243
|
-
var RFC3966_PREFIX_ = "tel:";
|
|
1244
|
-
var RFC3966_PHONE_CONTEXT_ = ";phone-context=";
|
|
1245
|
-
var RFC3966_ISDN_SUBADDRESS_ = ";isub=";
|
|
1246
|
-
/**
|
|
1247
|
-
* Extracts the value of the phone-context parameter of `numberToExtractFrom`,
|
|
1248
|
-
* following the syntax defined in RFC3966.
|
|
1249
|
-
*
|
|
1250
|
-
* @param {string} numberToExtractFrom
|
|
1251
|
-
* @return {string|null} the extracted string (possibly empty), or `null` if no phone-context parameter is found.
|
|
1252
|
-
*/
|
|
1253
|
-
function extractPhoneContext(numberToExtractFrom) {
|
|
1254
|
-
var indexOfPhoneContext = numberToExtractFrom.indexOf(RFC3966_PHONE_CONTEXT_);
|
|
1255
|
-
if (indexOfPhoneContext < 0) return null;
|
|
1256
|
-
var phoneContextStart = indexOfPhoneContext + RFC3966_PHONE_CONTEXT_.length;
|
|
1257
|
-
if (phoneContextStart >= numberToExtractFrom.length) return "";
|
|
1258
|
-
var phoneContextEnd = numberToExtractFrom.indexOf(";", phoneContextStart);
|
|
1259
|
-
if (phoneContextEnd >= 0) return numberToExtractFrom.substring(phoneContextStart, phoneContextEnd);
|
|
1260
|
-
else return numberToExtractFrom.substring(phoneContextStart);
|
|
1261
|
-
}
|
|
1262
|
-
/**
|
|
1263
|
-
* Returns whether the value of phoneContext follows the syntax defined in RFC3966.
|
|
1264
|
-
*
|
|
1265
|
-
* @param {string|null} phoneContext
|
|
1266
|
-
* @return {boolean}
|
|
1267
|
-
*/
|
|
1268
|
-
function isPhoneContextValid(phoneContext) {
|
|
1269
|
-
if (phoneContext === null) return true;
|
|
1270
|
-
if (phoneContext.length === 0) return false;
|
|
1271
|
-
return RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_.test(phoneContext) || RFC3966_DOMAINNAME_PATTERN_.test(phoneContext);
|
|
1272
|
-
}
|
|
1273
|
-
//#endregion
|
|
1274
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js
|
|
1275
|
-
/**
|
|
1276
|
-
* @param {string} numberToParse
|
|
1277
|
-
* @param {string} nationalNumber
|
|
1278
|
-
* @return {}
|
|
1279
|
-
*/
|
|
1280
|
-
function extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(numberToParse, _ref) {
|
|
1281
|
-
var extractFormattedPhoneNumber = _ref.extractFormattedPhoneNumber;
|
|
1282
|
-
var phoneContext = extractPhoneContext(numberToParse);
|
|
1283
|
-
if (!isPhoneContextValid(phoneContext)) throw new ParseError("NOT_A_NUMBER");
|
|
1284
|
-
var phoneNumberString;
|
|
1285
|
-
if (phoneContext === null) phoneNumberString = extractFormattedPhoneNumber(numberToParse) || "";
|
|
1286
|
-
else {
|
|
1287
|
-
phoneNumberString = "";
|
|
1288
|
-
if (phoneContext.charAt(0) === "+") phoneNumberString += phoneContext;
|
|
1289
|
-
var indexOfRfc3966Prefix = numberToParse.indexOf(RFC3966_PREFIX_);
|
|
1290
|
-
var indexOfNationalNumber;
|
|
1291
|
-
/* istanbul ignore else */
|
|
1292
|
-
if (indexOfRfc3966Prefix >= 0) indexOfNationalNumber = indexOfRfc3966Prefix + RFC3966_PREFIX_.length;
|
|
1293
|
-
else indexOfNationalNumber = 0;
|
|
1294
|
-
var indexOfPhoneContext = numberToParse.indexOf(RFC3966_PHONE_CONTEXT_);
|
|
1295
|
-
phoneNumberString += numberToParse.substring(indexOfNationalNumber, indexOfPhoneContext);
|
|
1296
|
-
}
|
|
1297
|
-
var indexOfIsdn = phoneNumberString.indexOf(RFC3966_ISDN_SUBADDRESS_);
|
|
1298
|
-
if (indexOfIsdn > 0) phoneNumberString = phoneNumberString.substring(0, indexOfIsdn);
|
|
1299
|
-
if (phoneNumberString !== "") return phoneNumberString;
|
|
1300
|
-
}
|
|
1301
|
-
//#endregion
|
|
1302
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/parse.js
|
|
1303
|
-
var MAX_INPUT_STRING_LENGTH = 250;
|
|
1304
|
-
var PHONE_NUMBER_START_PATTERN = new RegExp("[" + PLUS_CHARS + VALID_DIGITS + "]");
|
|
1305
|
-
var AFTER_PHONE_NUMBER_END_PATTERN = new RegExp("[^" + VALID_DIGITS + "#]+$");
|
|
1306
|
-
var USE_NON_GEOGRAPHIC_COUNTRY_CODE$1 = false;
|
|
1307
|
-
/**
|
|
1308
|
-
* Parses a phone number.
|
|
1309
|
-
*
|
|
1310
|
-
* parse('123456789', { defaultCountry: 'RU', v2: true }, metadata)
|
|
1311
|
-
* parse('123456789', { defaultCountry: 'RU' }, metadata)
|
|
1312
|
-
* parse('123456789', undefined, metadata)
|
|
1313
|
-
*
|
|
1314
|
-
* @param {string} input
|
|
1315
|
-
* @param {object} [options]
|
|
1316
|
-
* @param {object} metadata
|
|
1317
|
-
* @return {object|PhoneNumber?} If `options.v2: true` flag is passed, it returns a `PhoneNumber?` instance. Otherwise, returns an object of shape `{ phone: '...', country: '...' }` (or just `{}` if no phone number was parsed).
|
|
1318
|
-
*/
|
|
1319
|
-
function parse(text, options, metadata) {
|
|
1320
|
-
options = options || {};
|
|
1321
|
-
metadata = new Metadata(metadata);
|
|
1322
|
-
if (options.defaultCountry && !metadata.hasCountry(options.defaultCountry)) {
|
|
1323
|
-
if (options.v2) throw new ParseError("INVALID_COUNTRY");
|
|
1324
|
-
throw new Error("Unknown country: ".concat(options.defaultCountry));
|
|
1325
|
-
}
|
|
1326
|
-
var _parseInput = parseInput(text, options.v2, options.extract), formattedPhoneNumber = _parseInput.number, ext = _parseInput.ext, error = _parseInput.error;
|
|
1327
|
-
if (!formattedPhoneNumber) {
|
|
1328
|
-
if (options.v2) {
|
|
1329
|
-
if (error === "TOO_SHORT") throw new ParseError("TOO_SHORT");
|
|
1330
|
-
throw new ParseError("NOT_A_NUMBER");
|
|
1331
|
-
}
|
|
1332
|
-
return {};
|
|
1333
|
-
}
|
|
1334
|
-
var _parsePhoneNumber = parsePhoneNumber$3(formattedPhoneNumber, options.defaultCountry, options.defaultCallingCode, metadata), country = _parsePhoneNumber.country, nationalNumber = _parsePhoneNumber.nationalNumber, countryCallingCode = _parsePhoneNumber.countryCallingCode, countryCallingCodeSource = _parsePhoneNumber.countryCallingCodeSource, carrierCode = _parsePhoneNumber.carrierCode;
|
|
1335
|
-
if (!metadata.hasSelectedNumberingPlan()) {
|
|
1336
|
-
if (options.v2) throw new ParseError("INVALID_COUNTRY");
|
|
1337
|
-
return {};
|
|
1338
|
-
}
|
|
1339
|
-
if (!nationalNumber || nationalNumber.length < 2) {
|
|
1340
|
-
/* istanbul ignore if */
|
|
1341
|
-
if (options.v2) throw new ParseError("TOO_SHORT");
|
|
1342
|
-
return {};
|
|
1343
|
-
}
|
|
1344
|
-
if (nationalNumber.length > 17) {
|
|
1345
|
-
if (options.v2) throw new ParseError("TOO_LONG");
|
|
1346
|
-
return {};
|
|
1347
|
-
}
|
|
1348
|
-
if (options.v2) {
|
|
1349
|
-
var phoneNumber = new PhoneNumber(countryCallingCode, nationalNumber, metadata.metadata);
|
|
1350
|
-
if (country) phoneNumber.country = country;
|
|
1351
|
-
if (carrierCode) phoneNumber.carrierCode = carrierCode;
|
|
1352
|
-
if (ext) phoneNumber.ext = ext;
|
|
1353
|
-
phoneNumber.__countryCallingCodeSource = countryCallingCodeSource;
|
|
1354
|
-
return phoneNumber;
|
|
1355
|
-
}
|
|
1356
|
-
var valid = (options.extended ? metadata.hasSelectedNumberingPlan() : country) ? matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) : false;
|
|
1357
|
-
if (!options.extended) return valid ? result(country, nationalNumber, ext) : {};
|
|
1358
|
-
return {
|
|
1359
|
-
country,
|
|
1360
|
-
countryCallingCode,
|
|
1361
|
-
carrierCode,
|
|
1362
|
-
valid,
|
|
1363
|
-
possible: valid ? true : options.extended === true && metadata.possibleLengths() && isPossibleNumber(nationalNumber, country, metadata) ? true : false,
|
|
1364
|
-
phone: nationalNumber,
|
|
1365
|
-
ext
|
|
1366
|
-
};
|
|
1367
|
-
}
|
|
1368
|
-
/**
|
|
1369
|
-
* Extracts a formatted phone number from text.
|
|
1370
|
-
* Doesn't guarantee that the extracted phone number
|
|
1371
|
-
* is a valid phone number (for example, doesn't validate its length).
|
|
1372
|
-
* @param {string} text
|
|
1373
|
-
* @param {boolean} [extract] — If `false`, then will parse the entire `text` as a phone number.
|
|
1374
|
-
* @param {boolean} [throwOnError] — By default, it won't throw if the text is too long.
|
|
1375
|
-
* @return {string}
|
|
1376
|
-
* @example
|
|
1377
|
-
* // Returns "(213) 373-4253".
|
|
1378
|
-
* extractFormattedPhoneNumber("Call (213) 373-4253 for assistance.")
|
|
1379
|
-
*/
|
|
1380
|
-
function _extractFormattedPhoneNumber(text, extract, throwOnError) {
|
|
1381
|
-
if (!text) return;
|
|
1382
|
-
if (text.length > MAX_INPUT_STRING_LENGTH) {
|
|
1383
|
-
if (throwOnError) throw new ParseError("TOO_LONG");
|
|
1384
|
-
return;
|
|
1385
|
-
}
|
|
1386
|
-
if (extract === false) return text;
|
|
1387
|
-
var startsAt = text.search(PHONE_NUMBER_START_PATTERN);
|
|
1388
|
-
if (startsAt < 0) return;
|
|
1389
|
-
return text.slice(startsAt).replace(AFTER_PHONE_NUMBER_END_PATTERN, "");
|
|
1390
|
-
}
|
|
1391
|
-
/**
|
|
1392
|
-
* @param {string} text - Input.
|
|
1393
|
-
* @param {boolean} v2 - Legacy API functions don't pass `v2: true` flag.
|
|
1394
|
-
* @param {boolean} [extract] - Whether to extract a phone number from `text`, or attempt to parse the entire text as a phone number.
|
|
1395
|
-
* @return {object} `{ ?number, ?ext }`.
|
|
1396
|
-
*/
|
|
1397
|
-
function parseInput(text, v2, extract) {
|
|
1398
|
-
var number = extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(text, { extractFormattedPhoneNumber: function extractFormattedPhoneNumber(text) {
|
|
1399
|
-
return _extractFormattedPhoneNumber(text, extract, v2);
|
|
1400
|
-
} });
|
|
1401
|
-
if (!number) return {};
|
|
1402
|
-
if (!isViablePhoneNumber(number)) {
|
|
1403
|
-
if (isViablePhoneNumberStart(number)) return { error: "TOO_SHORT" };
|
|
1404
|
-
return {};
|
|
1405
|
-
}
|
|
1406
|
-
var withExtensionStripped = extractExtension(number);
|
|
1407
|
-
if (withExtensionStripped.ext) return withExtensionStripped;
|
|
1408
|
-
return { number };
|
|
1409
|
-
}
|
|
1410
|
-
/**
|
|
1411
|
-
* Creates `parse()` result object.
|
|
1412
|
-
*/
|
|
1413
|
-
function result(country, nationalNumber, ext) {
|
|
1414
|
-
var result = {
|
|
1415
|
-
country,
|
|
1416
|
-
phone: nationalNumber
|
|
1417
|
-
};
|
|
1418
|
-
if (ext) result.ext = ext;
|
|
1419
|
-
return result;
|
|
1420
|
-
}
|
|
1421
|
-
/**
|
|
1422
|
-
* Parses a viable phone number.
|
|
1423
|
-
* @param {string} formattedPhoneNumber — Example: "(213) 373-4253".
|
|
1424
|
-
* @param {string} [defaultCountry]
|
|
1425
|
-
* @param {string} [defaultCallingCode]
|
|
1426
|
-
* @param {Metadata} metadata
|
|
1427
|
-
* @return {object} Returns `{ country: string?, countryCallingCode: string?, nationalNumber: string? }`.
|
|
1428
|
-
*/
|
|
1429
|
-
function parsePhoneNumber$3(formattedPhoneNumber, defaultCountry, defaultCallingCode, metadata) {
|
|
1430
|
-
var _extractCountryCallin = extractCountryCallingCode(parseIncompletePhoneNumber(formattedPhoneNumber), void 0, defaultCountry, defaultCallingCode, metadata.metadata), countryCallingCodeSource = _extractCountryCallin.countryCallingCodeSource, countryCallingCode = _extractCountryCallin.countryCallingCode, number = _extractCountryCallin.number;
|
|
1431
|
-
var country;
|
|
1432
|
-
if (countryCallingCode) metadata.selectNumberingPlan(countryCallingCode);
|
|
1433
|
-
else if (number && (defaultCountry || defaultCallingCode)) {
|
|
1434
|
-
metadata.selectNumberingPlan(defaultCountry, defaultCallingCode);
|
|
1435
|
-
if (defaultCountry) country = defaultCountry;
|
|
1436
|
-
else if (USE_NON_GEOGRAPHIC_COUNTRY_CODE$1) {
|
|
1437
|
-
if (metadata.isNonGeographicCallingCode(defaultCallingCode)) country = "001";
|
|
1438
|
-
}
|
|
1439
|
-
countryCallingCode = defaultCallingCode || getCountryCallingCode(defaultCountry, metadata.metadata);
|
|
1440
|
-
} else return {};
|
|
1441
|
-
if (!number) return {
|
|
1442
|
-
countryCallingCodeSource,
|
|
1443
|
-
countryCallingCode
|
|
1444
|
-
};
|
|
1445
|
-
var _extractNationalNumbe = extractNationalNumber(parseIncompletePhoneNumber(number), country, metadata), nationalNumber = _extractNationalNumbe.nationalNumber, carrierCode = _extractNationalNumbe.carrierCode;
|
|
1446
|
-
var exactCountry = getCountryByCallingCode(countryCallingCode, {
|
|
1447
|
-
nationalNumber,
|
|
1448
|
-
metadata
|
|
1449
|
-
});
|
|
1450
|
-
if (exactCountry) {
|
|
1451
|
-
country = exactCountry;
|
|
1452
|
-
/* istanbul ignore if */
|
|
1453
|
-
if (exactCountry === "001") {} else metadata.selectNumberingPlan(country);
|
|
1454
|
-
}
|
|
1455
|
-
return {
|
|
1456
|
-
country,
|
|
1457
|
-
countryCallingCode,
|
|
1458
|
-
countryCallingCodeSource,
|
|
1459
|
-
nationalNumber,
|
|
1460
|
-
carrierCode
|
|
1461
|
-
};
|
|
1462
|
-
}
|
|
1463
|
-
//#endregion
|
|
1464
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js
|
|
1465
|
-
function _typeof$8(o) {
|
|
1466
|
-
"@babel/helpers - typeof";
|
|
1467
|
-
return _typeof$8 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
1468
|
-
return typeof o;
|
|
1469
|
-
} : function(o) {
|
|
1470
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
1471
|
-
}, _typeof$8(o);
|
|
1472
|
-
}
|
|
1473
|
-
function ownKeys$2(e, r) {
|
|
1474
|
-
var t = Object.keys(e);
|
|
1475
|
-
if (Object.getOwnPropertySymbols) {
|
|
1476
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
1477
|
-
r && (o = o.filter(function(r) {
|
|
1478
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
1479
|
-
})), t.push.apply(t, o);
|
|
1480
|
-
}
|
|
1481
|
-
return t;
|
|
1482
|
-
}
|
|
1483
|
-
function _objectSpread$2(e) {
|
|
1484
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
1485
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
1486
|
-
r % 2 ? ownKeys$2(Object(t), !0).forEach(function(r) {
|
|
1487
|
-
_defineProperty$2(e, r, t[r]);
|
|
1488
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function(r) {
|
|
1489
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
1490
|
-
});
|
|
1491
|
-
}
|
|
1492
|
-
return e;
|
|
1493
|
-
}
|
|
1494
|
-
function _defineProperty$2(e, r, t) {
|
|
1495
|
-
return (r = _toPropertyKey$8(r)) in e ? Object.defineProperty(e, r, {
|
|
1496
|
-
value: t,
|
|
1497
|
-
enumerable: !0,
|
|
1498
|
-
configurable: !0,
|
|
1499
|
-
writable: !0
|
|
1500
|
-
}) : e[r] = t, e;
|
|
1501
|
-
}
|
|
1502
|
-
function _toPropertyKey$8(t) {
|
|
1503
|
-
var i = _toPrimitive$8(t, "string");
|
|
1504
|
-
return "symbol" == _typeof$8(i) ? i : i + "";
|
|
1505
|
-
}
|
|
1506
|
-
function _toPrimitive$8(t, r) {
|
|
1507
|
-
if ("object" != _typeof$8(t) || !t) return t;
|
|
1508
|
-
var e = t[Symbol.toPrimitive];
|
|
1509
|
-
if (void 0 !== e) {
|
|
1510
|
-
var i = e.call(t, r || "default");
|
|
1511
|
-
if ("object" != _typeof$8(i)) return i;
|
|
1512
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1513
|
-
}
|
|
1514
|
-
return ("string" === r ? String : Number)(t);
|
|
1515
|
-
}
|
|
1516
|
-
function parsePhoneNumberWithError(text, options, metadata) {
|
|
1517
|
-
return parse(text, _objectSpread$2(_objectSpread$2({}, options), {}, { v2: true }), metadata);
|
|
1518
|
-
}
|
|
1519
|
-
//#endregion
|
|
1520
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/normalizeArguments.js
|
|
1521
|
-
function _typeof$7(o) {
|
|
1522
|
-
"@babel/helpers - typeof";
|
|
1523
|
-
return _typeof$7 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
1524
|
-
return typeof o;
|
|
1525
|
-
} : function(o) {
|
|
1526
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
1527
|
-
}, _typeof$7(o);
|
|
1528
|
-
}
|
|
1529
|
-
function ownKeys$1(e, r) {
|
|
1530
|
-
var t = Object.keys(e);
|
|
1531
|
-
if (Object.getOwnPropertySymbols) {
|
|
1532
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
1533
|
-
r && (o = o.filter(function(r) {
|
|
1534
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
1535
|
-
})), t.push.apply(t, o);
|
|
1536
|
-
}
|
|
1537
|
-
return t;
|
|
1538
|
-
}
|
|
1539
|
-
function _objectSpread$1(e) {
|
|
1540
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
1541
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
1542
|
-
r % 2 ? ownKeys$1(Object(t), !0).forEach(function(r) {
|
|
1543
|
-
_defineProperty$1(e, r, t[r]);
|
|
1544
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r) {
|
|
1545
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
1546
|
-
});
|
|
1547
|
-
}
|
|
1548
|
-
return e;
|
|
1549
|
-
}
|
|
1550
|
-
function _defineProperty$1(e, r, t) {
|
|
1551
|
-
return (r = _toPropertyKey$7(r)) in e ? Object.defineProperty(e, r, {
|
|
1552
|
-
value: t,
|
|
1553
|
-
enumerable: !0,
|
|
1554
|
-
configurable: !0,
|
|
1555
|
-
writable: !0
|
|
1556
|
-
}) : e[r] = t, e;
|
|
1557
|
-
}
|
|
1558
|
-
function _toPropertyKey$7(t) {
|
|
1559
|
-
var i = _toPrimitive$7(t, "string");
|
|
1560
|
-
return "symbol" == _typeof$7(i) ? i : i + "";
|
|
1561
|
-
}
|
|
1562
|
-
function _toPrimitive$7(t, r) {
|
|
1563
|
-
if ("object" != _typeof$7(t) || !t) return t;
|
|
1564
|
-
var e = t[Symbol.toPrimitive];
|
|
1565
|
-
if (void 0 !== e) {
|
|
1566
|
-
var i = e.call(t, r || "default");
|
|
1567
|
-
if ("object" != _typeof$7(i)) return i;
|
|
1568
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1569
|
-
}
|
|
1570
|
-
return ("string" === r ? String : Number)(t);
|
|
1571
|
-
}
|
|
1572
|
-
function _slicedToArray$2(r, e) {
|
|
1573
|
-
return _arrayWithHoles$2(r) || _iterableToArrayLimit$2(r, e) || _unsupportedIterableToArray$5(r, e) || _nonIterableRest$2();
|
|
1574
|
-
}
|
|
1575
|
-
function _nonIterableRest$2() {
|
|
1576
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1577
|
-
}
|
|
1578
|
-
function _unsupportedIterableToArray$5(r, a) {
|
|
1579
|
-
if (r) {
|
|
1580
|
-
if ("string" == typeof r) return _arrayLikeToArray$5(r, a);
|
|
1581
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
1582
|
-
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$5(r, a) : void 0;
|
|
1583
|
-
}
|
|
1584
|
-
}
|
|
1585
|
-
function _arrayLikeToArray$5(r, a) {
|
|
1586
|
-
(null == a || a > r.length) && (a = r.length);
|
|
1587
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
1588
|
-
return n;
|
|
1589
|
-
}
|
|
1590
|
-
function _iterableToArrayLimit$2(r, l) {
|
|
1591
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
1592
|
-
if (null != t) {
|
|
1593
|
-
var e, n, i, u, a = [], f = !0, o = !1;
|
|
1594
|
-
try {
|
|
1595
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
1596
|
-
if (Object(t) !== t) return;
|
|
1597
|
-
f = !1;
|
|
1598
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
1599
|
-
} catch (r) {
|
|
1600
|
-
o = !0, n = r;
|
|
1601
|
-
} finally {
|
|
1602
|
-
try {
|
|
1603
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
1604
|
-
} finally {
|
|
1605
|
-
if (o) throw n;
|
|
1606
|
-
}
|
|
1607
|
-
}
|
|
1608
|
-
return a;
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1611
|
-
function _arrayWithHoles$2(r) {
|
|
1612
|
-
if (Array.isArray(r)) return r;
|
|
1613
|
-
}
|
|
1614
|
-
function normalizeArguments(args) {
|
|
1615
|
-
var _Array$prototype$slic2 = _slicedToArray$2(Array.prototype.slice.call(args), 4), arg_1 = _Array$prototype$slic2[0], arg_2 = _Array$prototype$slic2[1], arg_3 = _Array$prototype$slic2[2], arg_4 = _Array$prototype$slic2[3];
|
|
1616
|
-
var text;
|
|
1617
|
-
var options;
|
|
1618
|
-
var metadata;
|
|
1619
|
-
if (typeof arg_1 === "string") text = arg_1;
|
|
1620
|
-
else throw new TypeError("A text for parsing must be a string.");
|
|
1621
|
-
if (!arg_2 || typeof arg_2 === "string") {
|
|
1622
|
-
if (arg_4) {
|
|
1623
|
-
options = arg_3;
|
|
1624
|
-
metadata = arg_4;
|
|
1625
|
-
} else {
|
|
1626
|
-
options = void 0;
|
|
1627
|
-
metadata = arg_3;
|
|
1628
|
-
}
|
|
1629
|
-
if (arg_2) options = _objectSpread$1({ defaultCountry: arg_2 }, options);
|
|
1630
|
-
} else if (isObject(arg_2)) if (arg_3) {
|
|
1631
|
-
options = arg_2;
|
|
1632
|
-
metadata = arg_3;
|
|
1633
|
-
} else metadata = arg_2;
|
|
1634
|
-
else throw new Error("Invalid second argument: ".concat(arg_2));
|
|
1635
|
-
return {
|
|
1636
|
-
text,
|
|
1637
|
-
options,
|
|
1638
|
-
metadata
|
|
1639
|
-
};
|
|
1640
|
-
}
|
|
1641
|
-
//#endregion
|
|
1642
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/parsePhoneNumber_.js
|
|
1643
|
-
function _typeof$6(o) {
|
|
1644
|
-
"@babel/helpers - typeof";
|
|
1645
|
-
return _typeof$6 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
1646
|
-
return typeof o;
|
|
1647
|
-
} : function(o) {
|
|
1648
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
1649
|
-
}, _typeof$6(o);
|
|
1650
|
-
}
|
|
1651
|
-
function ownKeys(e, r) {
|
|
1652
|
-
var t = Object.keys(e);
|
|
1653
|
-
if (Object.getOwnPropertySymbols) {
|
|
1654
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
1655
|
-
r && (o = o.filter(function(r) {
|
|
1656
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
1657
|
-
})), t.push.apply(t, o);
|
|
1658
|
-
}
|
|
1659
|
-
return t;
|
|
1660
|
-
}
|
|
1661
|
-
function _objectSpread(e) {
|
|
1662
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
1663
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
1664
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
1665
|
-
_defineProperty(e, r, t[r]);
|
|
1666
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
1667
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
1668
|
-
});
|
|
1669
|
-
}
|
|
1670
|
-
return e;
|
|
1671
|
-
}
|
|
1672
|
-
function _defineProperty(e, r, t) {
|
|
1673
|
-
return (r = _toPropertyKey$6(r)) in e ? Object.defineProperty(e, r, {
|
|
1674
|
-
value: t,
|
|
1675
|
-
enumerable: !0,
|
|
1676
|
-
configurable: !0,
|
|
1677
|
-
writable: !0
|
|
1678
|
-
}) : e[r] = t, e;
|
|
1679
|
-
}
|
|
1680
|
-
function _toPropertyKey$6(t) {
|
|
1681
|
-
var i = _toPrimitive$6(t, "string");
|
|
1682
|
-
return "symbol" == _typeof$6(i) ? i : i + "";
|
|
1683
|
-
}
|
|
1684
|
-
function _toPrimitive$6(t, r) {
|
|
1685
|
-
if ("object" != _typeof$6(t) || !t) return t;
|
|
1686
|
-
var e = t[Symbol.toPrimitive];
|
|
1687
|
-
if (void 0 !== e) {
|
|
1688
|
-
var i = e.call(t, r || "default");
|
|
1689
|
-
if ("object" != _typeof$6(i)) return i;
|
|
1690
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1691
|
-
}
|
|
1692
|
-
return ("string" === r ? String : Number)(t);
|
|
1693
|
-
}
|
|
1694
|
-
function parsePhoneNumber$2(text, options, metadata) {
|
|
1695
|
-
if (options && options.defaultCountry && !isSupportedCountry(options.defaultCountry, metadata)) options = _objectSpread(_objectSpread({}, options), {}, { defaultCountry: void 0 });
|
|
1696
|
-
try {
|
|
1697
|
-
return parsePhoneNumberWithError(text, options, metadata);
|
|
1698
|
-
} catch (error) {
|
|
1699
|
-
/* istanbul ignore else */
|
|
1700
|
-
if (error instanceof ParseError) {} else throw error;
|
|
1701
|
-
}
|
|
1702
|
-
}
|
|
1703
|
-
//#endregion
|
|
1704
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/parsePhoneNumber.js
|
|
1705
|
-
function parsePhoneNumber$1() {
|
|
1706
|
-
var _normalizeArguments = normalizeArguments(arguments), text = _normalizeArguments.text, options = _normalizeArguments.options, metadata = _normalizeArguments.metadata;
|
|
1707
|
-
return parsePhoneNumber$2(text, options, metadata);
|
|
1708
|
-
}
|
|
1709
|
-
//#endregion
|
|
1710
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/AsYouTypeState.js
|
|
1711
|
-
function _typeof$5(o) {
|
|
1712
|
-
"@babel/helpers - typeof";
|
|
1713
|
-
return _typeof$5 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
1714
|
-
return typeof o;
|
|
1715
|
-
} : function(o) {
|
|
1716
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
1717
|
-
}, _typeof$5(o);
|
|
1718
|
-
}
|
|
1719
|
-
function _classCallCheck$5(a, n) {
|
|
1720
|
-
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
1721
|
-
}
|
|
1722
|
-
function _defineProperties$5(e, r) {
|
|
1723
|
-
for (var t = 0; t < r.length; t++) {
|
|
1724
|
-
var o = r[t];
|
|
1725
|
-
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$5(o.key), o);
|
|
1726
|
-
}
|
|
1727
|
-
}
|
|
1728
|
-
function _createClass$5(e, r, t) {
|
|
1729
|
-
return r && _defineProperties$5(e.prototype, r), t && _defineProperties$5(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
1730
|
-
}
|
|
1731
|
-
function _toPropertyKey$5(t) {
|
|
1732
|
-
var i = _toPrimitive$5(t, "string");
|
|
1733
|
-
return "symbol" == _typeof$5(i) ? i : i + "";
|
|
1734
|
-
}
|
|
1735
|
-
function _toPrimitive$5(t, r) {
|
|
1736
|
-
if ("object" != _typeof$5(t) || !t) return t;
|
|
1737
|
-
var e = t[Symbol.toPrimitive];
|
|
1738
|
-
if (void 0 !== e) {
|
|
1739
|
-
var i = e.call(t, r || "default");
|
|
1740
|
-
if ("object" != _typeof$5(i)) return i;
|
|
1741
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1742
|
-
}
|
|
1743
|
-
return ("string" === r ? String : Number)(t);
|
|
1744
|
-
}
|
|
1745
|
-
var AsYouTypeState = /* @__PURE__ */ function() {
|
|
1746
|
-
function AsYouTypeState(_ref) {
|
|
1747
|
-
var onCountryChange = _ref.onCountryChange, onCallingCodeChange = _ref.onCallingCodeChange;
|
|
1748
|
-
_classCallCheck$5(this, AsYouTypeState);
|
|
1749
|
-
this.onCountryChange = onCountryChange;
|
|
1750
|
-
this.onCallingCodeChange = onCallingCodeChange;
|
|
1751
|
-
}
|
|
1752
|
-
return _createClass$5(AsYouTypeState, [
|
|
1753
|
-
{
|
|
1754
|
-
key: "reset",
|
|
1755
|
-
value: function reset(_ref2) {
|
|
1756
|
-
var country = _ref2.country, callingCode = _ref2.callingCode;
|
|
1757
|
-
this.international = false;
|
|
1758
|
-
this.missingPlus = false;
|
|
1759
|
-
this.IDDPrefix = void 0;
|
|
1760
|
-
this.callingCode = void 0;
|
|
1761
|
-
this.digits = "";
|
|
1762
|
-
this.resetNationalSignificantNumber();
|
|
1763
|
-
this.initCountryAndCallingCode(country, callingCode);
|
|
1764
|
-
}
|
|
1765
|
-
},
|
|
1766
|
-
{
|
|
1767
|
-
key: "resetNationalSignificantNumber",
|
|
1768
|
-
value: function resetNationalSignificantNumber() {
|
|
1769
|
-
this.nationalSignificantNumber = this.getNationalDigits();
|
|
1770
|
-
this.nationalSignificantNumberIsModified = false;
|
|
1771
|
-
this.nationalPrefix = void 0;
|
|
1772
|
-
this.carrierCode = void 0;
|
|
1773
|
-
this.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix = void 0;
|
|
1774
|
-
}
|
|
1775
|
-
},
|
|
1776
|
-
{
|
|
1777
|
-
key: "update",
|
|
1778
|
-
value: function update(properties) {
|
|
1779
|
-
for (var _i = 0, _Object$keys = Object.keys(properties); _i < _Object$keys.length; _i++) {
|
|
1780
|
-
var key = _Object$keys[_i];
|
|
1781
|
-
this[key] = properties[key];
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
|
-
},
|
|
1785
|
-
{
|
|
1786
|
-
key: "initCountryAndCallingCode",
|
|
1787
|
-
value: function initCountryAndCallingCode(country, callingCode) {
|
|
1788
|
-
this.setCountry(country);
|
|
1789
|
-
this.setCallingCode(callingCode);
|
|
1790
|
-
}
|
|
1791
|
-
},
|
|
1792
|
-
{
|
|
1793
|
-
key: "setCountry",
|
|
1794
|
-
value: function setCountry(country) {
|
|
1795
|
-
this.country = country;
|
|
1796
|
-
this.onCountryChange(country);
|
|
1797
|
-
}
|
|
1798
|
-
},
|
|
1799
|
-
{
|
|
1800
|
-
key: "setCallingCode",
|
|
1801
|
-
value: function setCallingCode(callingCode) {
|
|
1802
|
-
this.callingCode = callingCode;
|
|
1803
|
-
this.onCallingCodeChange(callingCode, this.country);
|
|
1804
|
-
}
|
|
1805
|
-
},
|
|
1806
|
-
{
|
|
1807
|
-
key: "startInternationalNumber",
|
|
1808
|
-
value: function startInternationalNumber(country, callingCode) {
|
|
1809
|
-
this.international = true;
|
|
1810
|
-
this.initCountryAndCallingCode(country, callingCode);
|
|
1811
|
-
}
|
|
1812
|
-
},
|
|
1813
|
-
{
|
|
1814
|
-
key: "appendDigits",
|
|
1815
|
-
value: function appendDigits(nextDigits) {
|
|
1816
|
-
this.digits += nextDigits;
|
|
1817
|
-
}
|
|
1818
|
-
},
|
|
1819
|
-
{
|
|
1820
|
-
key: "appendNationalSignificantNumberDigits",
|
|
1821
|
-
value: function appendNationalSignificantNumberDigits(nextDigits) {
|
|
1822
|
-
this.nationalSignificantNumber += nextDigits;
|
|
1823
|
-
}
|
|
1824
|
-
},
|
|
1825
|
-
{
|
|
1826
|
-
key: "getNationalDigits",
|
|
1827
|
-
value: function getNationalDigits() {
|
|
1828
|
-
if (this.international) return this.digits.slice((this.IDDPrefix ? this.IDDPrefix.length : 0) + (this.callingCode ? this.callingCode.length : 0));
|
|
1829
|
-
return this.digits;
|
|
1830
|
-
}
|
|
1831
|
-
},
|
|
1832
|
-
{
|
|
1833
|
-
key: "getDigitsWithoutInternationalPrefix",
|
|
1834
|
-
value: function getDigitsWithoutInternationalPrefix() {
|
|
1835
|
-
if (this.international) {
|
|
1836
|
-
if (this.IDDPrefix) return this.digits.slice(this.IDDPrefix.length);
|
|
1837
|
-
}
|
|
1838
|
-
return this.digits;
|
|
1839
|
-
}
|
|
1840
|
-
}
|
|
1841
|
-
]);
|
|
1842
|
-
}();
|
|
1843
|
-
//#endregion
|
|
1844
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.util.js
|
|
1845
|
-
function _createForOfIteratorHelperLoose$2(r, e) {
|
|
1846
|
-
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
1847
|
-
if (t) return (t = t.call(r)).next.bind(t);
|
|
1848
|
-
if (Array.isArray(r) || (t = _unsupportedIterableToArray$4(r)) || e && r && "number" == typeof r.length) {
|
|
1849
|
-
t && (r = t);
|
|
1850
|
-
var o = 0;
|
|
1851
|
-
return function() {
|
|
1852
|
-
return o >= r.length ? { done: !0 } : {
|
|
1853
|
-
done: !1,
|
|
1854
|
-
value: r[o++]
|
|
1855
|
-
};
|
|
1856
|
-
};
|
|
1857
|
-
}
|
|
1858
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1859
|
-
}
|
|
1860
|
-
function _unsupportedIterableToArray$4(r, a) {
|
|
1861
|
-
if (r) {
|
|
1862
|
-
if ("string" == typeof r) return _arrayLikeToArray$4(r, a);
|
|
1863
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
1864
|
-
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;
|
|
1865
|
-
}
|
|
1866
|
-
}
|
|
1867
|
-
function _arrayLikeToArray$4(r, a) {
|
|
1868
|
-
(null == a || a > r.length) && (a = r.length);
|
|
1869
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
1870
|
-
return n;
|
|
1871
|
-
}
|
|
1872
|
-
var DIGIT_PLACEHOLDER_MATCHER = /* @__PURE__ */ new RegExp("x");
|
|
1873
|
-
function repeat(string, times) {
|
|
1874
|
-
if (times < 1) return "";
|
|
1875
|
-
var result = "";
|
|
1876
|
-
while (times > 1) {
|
|
1877
|
-
if (times & 1) result += string;
|
|
1878
|
-
times >>= 1;
|
|
1879
|
-
string += string;
|
|
1880
|
-
}
|
|
1881
|
-
return result + string;
|
|
1882
|
-
}
|
|
1883
|
-
function cutAndStripNonPairedParens(string, cutBeforeIndex) {
|
|
1884
|
-
if (string[cutBeforeIndex] === ")") cutBeforeIndex++;
|
|
1885
|
-
return stripNonPairedParens(string.slice(0, cutBeforeIndex));
|
|
1886
|
-
}
|
|
1887
|
-
function stripNonPairedParens(string) {
|
|
1888
|
-
var dangling_braces = [];
|
|
1889
|
-
var i = 0;
|
|
1890
|
-
while (i < string.length) {
|
|
1891
|
-
if (string[i] === "(") dangling_braces.push(i);
|
|
1892
|
-
else if (string[i] === ")") dangling_braces.pop();
|
|
1893
|
-
i++;
|
|
1894
|
-
}
|
|
1895
|
-
var start = 0;
|
|
1896
|
-
var cleared_string = "";
|
|
1897
|
-
dangling_braces.push(string.length);
|
|
1898
|
-
for (var _i = 0, _dangling_braces = dangling_braces; _i < _dangling_braces.length; _i++) {
|
|
1899
|
-
var index = _dangling_braces[_i];
|
|
1900
|
-
cleared_string += string.slice(start, index);
|
|
1901
|
-
start = index + 1;
|
|
1902
|
-
}
|
|
1903
|
-
return cleared_string;
|
|
1904
|
-
}
|
|
1905
|
-
function populateTemplateWithDigits(template, position, digits) {
|
|
1906
|
-
for (var _iterator2 = _createForOfIteratorHelperLoose$2(digits.split("")), _step2; !(_step2 = _iterator2()).done;) {
|
|
1907
|
-
var digit = _step2.value;
|
|
1908
|
-
if (template.slice(position + 1).search(DIGIT_PLACEHOLDER_MATCHER) < 0) return;
|
|
1909
|
-
position = template.search(DIGIT_PLACEHOLDER_MATCHER);
|
|
1910
|
-
template = template.replace(DIGIT_PLACEHOLDER_MATCHER, digit);
|
|
1911
|
-
}
|
|
1912
|
-
return [template, position];
|
|
1913
|
-
}
|
|
1914
|
-
//#endregion
|
|
1915
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.complete.js
|
|
1916
|
-
function formatCompleteNumber(state, format, _ref) {
|
|
1917
|
-
var metadata = _ref.metadata, shouldTryNationalPrefixFormattingRule = _ref.shouldTryNationalPrefixFormattingRule, getSeparatorAfterNationalPrefix = _ref.getSeparatorAfterNationalPrefix;
|
|
1918
|
-
if (new RegExp("^(?:".concat(format.pattern(), ")$")).test(state.nationalSignificantNumber)) return formatNationalNumberWithAndWithoutNationalPrefixFormattingRule(state, format, {
|
|
1919
|
-
metadata,
|
|
1920
|
-
shouldTryNationalPrefixFormattingRule,
|
|
1921
|
-
getSeparatorAfterNationalPrefix
|
|
1922
|
-
});
|
|
1923
|
-
}
|
|
1924
|
-
function canFormatCompleteNumber(nationalSignificantNumber, country, metadata) {
|
|
1925
|
-
return checkNumberLength(nationalSignificantNumber, country, metadata) === "IS_POSSIBLE";
|
|
1926
|
-
}
|
|
1927
|
-
function formatNationalNumberWithAndWithoutNationalPrefixFormattingRule(state, format, _ref2) {
|
|
1928
|
-
var metadata = _ref2.metadata, shouldTryNationalPrefixFormattingRule = _ref2.shouldTryNationalPrefixFormattingRule, getSeparatorAfterNationalPrefix = _ref2.getSeparatorAfterNationalPrefix;
|
|
1929
|
-
state.nationalSignificantNumber;
|
|
1930
|
-
state.international;
|
|
1931
|
-
state.nationalPrefix;
|
|
1932
|
-
state.carrierCode;
|
|
1933
|
-
if (shouldTryNationalPrefixFormattingRule(format)) {
|
|
1934
|
-
var formattedNumber = formatNationalNumber$1(state, format, {
|
|
1935
|
-
useNationalPrefixFormattingRule: true,
|
|
1936
|
-
getSeparatorAfterNationalPrefix,
|
|
1937
|
-
metadata
|
|
1938
|
-
});
|
|
1939
|
-
if (formattedNumber) return formattedNumber;
|
|
1940
|
-
}
|
|
1941
|
-
return formatNationalNumber$1(state, format, {
|
|
1942
|
-
useNationalPrefixFormattingRule: false,
|
|
1943
|
-
getSeparatorAfterNationalPrefix,
|
|
1944
|
-
metadata
|
|
1945
|
-
});
|
|
1946
|
-
}
|
|
1947
|
-
function formatNationalNumber$1(state, format, _ref3) {
|
|
1948
|
-
var metadata = _ref3.metadata, useNationalPrefixFormattingRule = _ref3.useNationalPrefixFormattingRule, getSeparatorAfterNationalPrefix = _ref3.getSeparatorAfterNationalPrefix;
|
|
1949
|
-
var formattedNationalNumber = formatNationalNumberUsingFormat(state.nationalSignificantNumber, format, {
|
|
1950
|
-
carrierCode: state.carrierCode,
|
|
1951
|
-
useInternationalFormat: state.international,
|
|
1952
|
-
withNationalPrefix: useNationalPrefixFormattingRule,
|
|
1953
|
-
metadata
|
|
1954
|
-
});
|
|
1955
|
-
if (!useNationalPrefixFormattingRule) {
|
|
1956
|
-
if (state.nationalPrefix) formattedNationalNumber = state.nationalPrefix + getSeparatorAfterNationalPrefix(format) + formattedNationalNumber;
|
|
1957
|
-
else if (state.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix) formattedNationalNumber = state.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix + " " + formattedNationalNumber;
|
|
1958
|
-
}
|
|
1959
|
-
if (isValidFormattedNationalNumber(formattedNationalNumber, state)) return formattedNationalNumber;
|
|
1960
|
-
}
|
|
1961
|
-
function isValidFormattedNationalNumber(formattedNationalNumber, state) {
|
|
1962
|
-
return parseDigits(formattedNationalNumber) === state.getNationalDigits();
|
|
1963
|
-
}
|
|
1964
|
-
//#endregion
|
|
1965
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.PatternParser.js
|
|
1966
|
-
function _typeof$4(o) {
|
|
1967
|
-
"@babel/helpers - typeof";
|
|
1968
|
-
return _typeof$4 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
1969
|
-
return typeof o;
|
|
1970
|
-
} : function(o) {
|
|
1971
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
1972
|
-
}, _typeof$4(o);
|
|
1973
|
-
}
|
|
1974
|
-
function _classCallCheck$4(a, n) {
|
|
1975
|
-
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
1976
|
-
}
|
|
1977
|
-
function _defineProperties$4(e, r) {
|
|
1978
|
-
for (var t = 0; t < r.length; t++) {
|
|
1979
|
-
var o = r[t];
|
|
1980
|
-
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$4(o.key), o);
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
function _createClass$4(e, r, t) {
|
|
1984
|
-
return r && _defineProperties$4(e.prototype, r), t && _defineProperties$4(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
1985
|
-
}
|
|
1986
|
-
function _toPropertyKey$4(t) {
|
|
1987
|
-
var i = _toPrimitive$4(t, "string");
|
|
1988
|
-
return "symbol" == _typeof$4(i) ? i : i + "";
|
|
1989
|
-
}
|
|
1990
|
-
function _toPrimitive$4(t, r) {
|
|
1991
|
-
if ("object" != _typeof$4(t) || !t) return t;
|
|
1992
|
-
var e = t[Symbol.toPrimitive];
|
|
1993
|
-
if (void 0 !== e) {
|
|
1994
|
-
var i = e.call(t, r || "default");
|
|
1995
|
-
if ("object" != _typeof$4(i)) return i;
|
|
1996
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1997
|
-
}
|
|
1998
|
-
return ("string" === r ? String : Number)(t);
|
|
1999
|
-
}
|
|
2000
|
-
var PatternParser = /* @__PURE__ */ function() {
|
|
2001
|
-
function PatternParser() {
|
|
2002
|
-
_classCallCheck$4(this, PatternParser);
|
|
2003
|
-
}
|
|
2004
|
-
return _createClass$4(PatternParser, [
|
|
2005
|
-
{
|
|
2006
|
-
key: "parse",
|
|
2007
|
-
value: function parse(pattern) {
|
|
2008
|
-
this.context = [{
|
|
2009
|
-
or: true,
|
|
2010
|
-
instructions: []
|
|
2011
|
-
}];
|
|
2012
|
-
this.parsePattern(pattern);
|
|
2013
|
-
if (this.context.length !== 1) throw new Error("Non-finalized contexts left when pattern parse ended");
|
|
2014
|
-
var _this$context$ = this.context[0], branches = _this$context$.branches, instructions = _this$context$.instructions;
|
|
2015
|
-
if (branches) return {
|
|
2016
|
-
op: "|",
|
|
2017
|
-
args: branches.concat([expandSingleElementArray(instructions)])
|
|
2018
|
-
};
|
|
2019
|
-
/* istanbul ignore if */
|
|
2020
|
-
if (instructions.length === 0) throw new Error("Pattern is required");
|
|
2021
|
-
if (instructions.length === 1) return instructions[0];
|
|
2022
|
-
return instructions;
|
|
2023
|
-
}
|
|
2024
|
-
},
|
|
2025
|
-
{
|
|
2026
|
-
key: "startContext",
|
|
2027
|
-
value: function startContext(context) {
|
|
2028
|
-
this.context.push(context);
|
|
2029
|
-
}
|
|
2030
|
-
},
|
|
2031
|
-
{
|
|
2032
|
-
key: "endContext",
|
|
2033
|
-
value: function endContext() {
|
|
2034
|
-
this.context.pop();
|
|
2035
|
-
}
|
|
2036
|
-
},
|
|
2037
|
-
{
|
|
2038
|
-
key: "getContext",
|
|
2039
|
-
value: function getContext() {
|
|
2040
|
-
return this.context[this.context.length - 1];
|
|
2041
|
-
}
|
|
2042
|
-
},
|
|
2043
|
-
{
|
|
2044
|
-
key: "parsePattern",
|
|
2045
|
-
value: function parsePattern(pattern) {
|
|
2046
|
-
if (!pattern) throw new Error("Pattern is required");
|
|
2047
|
-
var match = pattern.match(OPERATOR);
|
|
2048
|
-
if (!match) {
|
|
2049
|
-
if (ILLEGAL_CHARACTER_REGEXP.test(pattern)) throw new Error("Illegal characters found in a pattern: ".concat(pattern));
|
|
2050
|
-
this.getContext().instructions = this.getContext().instructions.concat(pattern.split(""));
|
|
2051
|
-
return;
|
|
2052
|
-
}
|
|
2053
|
-
var operator = match[1];
|
|
2054
|
-
var before = pattern.slice(0, match.index);
|
|
2055
|
-
var rightPart = pattern.slice(match.index + operator.length);
|
|
2056
|
-
switch (operator) {
|
|
2057
|
-
case "(?:":
|
|
2058
|
-
if (before) this.parsePattern(before);
|
|
2059
|
-
this.startContext({
|
|
2060
|
-
or: true,
|
|
2061
|
-
instructions: [],
|
|
2062
|
-
branches: []
|
|
2063
|
-
});
|
|
2064
|
-
break;
|
|
2065
|
-
case ")":
|
|
2066
|
-
if (!this.getContext().or) throw new Error("\")\" operator must be preceded by \"(?:\" operator");
|
|
2067
|
-
if (before) this.parsePattern(before);
|
|
2068
|
-
if (this.getContext().instructions.length === 0) throw new Error("No instructions found after \"|\" operator in an \"or\" group");
|
|
2069
|
-
var branches = this.getContext().branches;
|
|
2070
|
-
branches.push(expandSingleElementArray(this.getContext().instructions));
|
|
2071
|
-
this.endContext();
|
|
2072
|
-
this.getContext().instructions.push({
|
|
2073
|
-
op: "|",
|
|
2074
|
-
args: branches
|
|
2075
|
-
});
|
|
2076
|
-
break;
|
|
2077
|
-
case "|":
|
|
2078
|
-
if (!this.getContext().or) throw new Error("\"|\" operator can only be used inside \"or\" groups");
|
|
2079
|
-
if (before) this.parsePattern(before);
|
|
2080
|
-
if (!this.getContext().branches)
|
|
2081
|
-
/* istanbul ignore else */
|
|
2082
|
-
if (this.context.length === 1) this.getContext().branches = [];
|
|
2083
|
-
else throw new Error("\"branches\" not found in an \"or\" group context");
|
|
2084
|
-
this.getContext().branches.push(expandSingleElementArray(this.getContext().instructions));
|
|
2085
|
-
this.getContext().instructions = [];
|
|
2086
|
-
break;
|
|
2087
|
-
case "[":
|
|
2088
|
-
if (before) this.parsePattern(before);
|
|
2089
|
-
this.startContext({ oneOfSet: true });
|
|
2090
|
-
break;
|
|
2091
|
-
case "]":
|
|
2092
|
-
if (!this.getContext().oneOfSet) throw new Error("\"]\" operator must be preceded by \"[\" operator");
|
|
2093
|
-
this.endContext();
|
|
2094
|
-
this.getContext().instructions.push({
|
|
2095
|
-
op: "[]",
|
|
2096
|
-
args: parseOneOfSet(before)
|
|
2097
|
-
});
|
|
2098
|
-
break;
|
|
2099
|
-
default: throw new Error("Unknown operator: ".concat(operator));
|
|
2100
|
-
}
|
|
2101
|
-
if (rightPart) this.parsePattern(rightPart);
|
|
2102
|
-
}
|
|
2103
|
-
}
|
|
2104
|
-
]);
|
|
2105
|
-
}();
|
|
2106
|
-
function parseOneOfSet(pattern) {
|
|
2107
|
-
var values = [];
|
|
2108
|
-
var i = 0;
|
|
2109
|
-
while (i < pattern.length) {
|
|
2110
|
-
if (pattern[i] === "-") {
|
|
2111
|
-
if (i === 0 || i === pattern.length - 1) throw new Error("Couldn't parse a one-of set pattern: ".concat(pattern));
|
|
2112
|
-
var prevValue = pattern[i - 1].charCodeAt(0) + 1;
|
|
2113
|
-
var nextValue = pattern[i + 1].charCodeAt(0) - 1;
|
|
2114
|
-
var value = prevValue;
|
|
2115
|
-
while (value <= nextValue) {
|
|
2116
|
-
values.push(String.fromCharCode(value));
|
|
2117
|
-
value++;
|
|
2118
|
-
}
|
|
2119
|
-
} else values.push(pattern[i]);
|
|
2120
|
-
i++;
|
|
2121
|
-
}
|
|
2122
|
-
return values;
|
|
2123
|
-
}
|
|
2124
|
-
var ILLEGAL_CHARACTER_REGEXP = /[\(\)\[\]\?\:\|]/;
|
|
2125
|
-
var OPERATOR = /* @__PURE__ */ new RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");
|
|
2126
|
-
function expandSingleElementArray(array) {
|
|
2127
|
-
if (array.length === 1) return array[0];
|
|
2128
|
-
return array;
|
|
2129
|
-
}
|
|
2130
|
-
//#endregion
|
|
2131
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.PatternMatcher.js
|
|
2132
|
-
function _createForOfIteratorHelperLoose$1(r, e) {
|
|
2133
|
-
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
2134
|
-
if (t) return (t = t.call(r)).next.bind(t);
|
|
2135
|
-
if (Array.isArray(r) || (t = _unsupportedIterableToArray$3(r)) || e && r && "number" == typeof r.length) {
|
|
2136
|
-
t && (r = t);
|
|
2137
|
-
var o = 0;
|
|
2138
|
-
return function() {
|
|
2139
|
-
return o >= r.length ? { done: !0 } : {
|
|
2140
|
-
done: !1,
|
|
2141
|
-
value: r[o++]
|
|
2142
|
-
};
|
|
2143
|
-
};
|
|
2144
|
-
}
|
|
2145
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2146
|
-
}
|
|
2147
|
-
function _unsupportedIterableToArray$3(r, a) {
|
|
2148
|
-
if (r) {
|
|
2149
|
-
if ("string" == typeof r) return _arrayLikeToArray$3(r, a);
|
|
2150
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
2151
|
-
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;
|
|
2152
|
-
}
|
|
2153
|
-
}
|
|
2154
|
-
function _arrayLikeToArray$3(r, a) {
|
|
2155
|
-
(null == a || a > r.length) && (a = r.length);
|
|
2156
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
2157
|
-
return n;
|
|
2158
|
-
}
|
|
2159
|
-
function _typeof$3(o) {
|
|
2160
|
-
"@babel/helpers - typeof";
|
|
2161
|
-
return _typeof$3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
2162
|
-
return typeof o;
|
|
2163
|
-
} : function(o) {
|
|
2164
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
2165
|
-
}, _typeof$3(o);
|
|
2166
|
-
}
|
|
2167
|
-
function _classCallCheck$3(a, n) {
|
|
2168
|
-
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
2169
|
-
}
|
|
2170
|
-
function _defineProperties$3(e, r) {
|
|
2171
|
-
for (var t = 0; t < r.length; t++) {
|
|
2172
|
-
var o = r[t];
|
|
2173
|
-
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$3(o.key), o);
|
|
2174
|
-
}
|
|
2175
|
-
}
|
|
2176
|
-
function _createClass$3(e, r, t) {
|
|
2177
|
-
return r && _defineProperties$3(e.prototype, r), t && _defineProperties$3(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
2178
|
-
}
|
|
2179
|
-
function _toPropertyKey$3(t) {
|
|
2180
|
-
var i = _toPrimitive$3(t, "string");
|
|
2181
|
-
return "symbol" == _typeof$3(i) ? i : i + "";
|
|
2182
|
-
}
|
|
2183
|
-
function _toPrimitive$3(t, r) {
|
|
2184
|
-
if ("object" != _typeof$3(t) || !t) return t;
|
|
2185
|
-
var e = t[Symbol.toPrimitive];
|
|
2186
|
-
if (void 0 !== e) {
|
|
2187
|
-
var i = e.call(t, r || "default");
|
|
2188
|
-
if ("object" != _typeof$3(i)) return i;
|
|
2189
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2190
|
-
}
|
|
2191
|
-
return ("string" === r ? String : Number)(t);
|
|
2192
|
-
}
|
|
2193
|
-
var PatternMatcher = /* @__PURE__ */ function() {
|
|
2194
|
-
function PatternMatcher(pattern) {
|
|
2195
|
-
_classCallCheck$3(this, PatternMatcher);
|
|
2196
|
-
this.matchTree = new PatternParser().parse(pattern);
|
|
2197
|
-
}
|
|
2198
|
-
return _createClass$3(PatternMatcher, [{
|
|
2199
|
-
key: "match",
|
|
2200
|
-
value: function match(string) {
|
|
2201
|
-
var allowOverflow = (arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}).allowOverflow;
|
|
2202
|
-
if (!string) throw new Error("String is required");
|
|
2203
|
-
var result = _match(string.split(""), this.matchTree, true);
|
|
2204
|
-
if (result && result.match) delete result.matchedChars;
|
|
2205
|
-
if (result && result.overflow) {
|
|
2206
|
-
if (!allowOverflow) return;
|
|
2207
|
-
}
|
|
2208
|
-
return result;
|
|
2209
|
-
}
|
|
2210
|
-
}]);
|
|
2211
|
-
}();
|
|
2212
|
-
function _match(characters, tree, last) {
|
|
2213
|
-
if (typeof tree === "string") {
|
|
2214
|
-
var characterString = characters.join("");
|
|
2215
|
-
if (tree.indexOf(characterString) === 0) {
|
|
2216
|
-
/* istanbul ignore else */
|
|
2217
|
-
if (characters.length === tree.length) return {
|
|
2218
|
-
match: true,
|
|
2219
|
-
matchedChars: characters
|
|
2220
|
-
};
|
|
2221
|
-
/* istanbul ignore next */
|
|
2222
|
-
return { partialMatch: true };
|
|
2223
|
-
}
|
|
2224
|
-
if (characterString.indexOf(tree) === 0) {
|
|
2225
|
-
if (last) {
|
|
2226
|
-
/* istanbul ignore else */
|
|
2227
|
-
if (characters.length > tree.length) return { overflow: true };
|
|
2228
|
-
}
|
|
2229
|
-
return {
|
|
2230
|
-
match: true,
|
|
2231
|
-
matchedChars: characters.slice(0, tree.length)
|
|
2232
|
-
};
|
|
2233
|
-
}
|
|
2234
|
-
return;
|
|
2235
|
-
}
|
|
2236
|
-
if (Array.isArray(tree)) {
|
|
2237
|
-
var restCharacters = characters.slice();
|
|
2238
|
-
var i = 0;
|
|
2239
|
-
while (i < tree.length) {
|
|
2240
|
-
var subtree = tree[i];
|
|
2241
|
-
var result = _match(restCharacters, subtree, last && i === tree.length - 1);
|
|
2242
|
-
if (!result) return;
|
|
2243
|
-
else if (result.overflow) return result;
|
|
2244
|
-
else if (result.match) {
|
|
2245
|
-
restCharacters = restCharacters.slice(result.matchedChars.length);
|
|
2246
|
-
if (restCharacters.length === 0) if (i === tree.length - 1) return {
|
|
2247
|
-
match: true,
|
|
2248
|
-
matchedChars: characters
|
|
2249
|
-
};
|
|
2250
|
-
else return { partialMatch: true };
|
|
2251
|
-
} else if (result.partialMatch) return { partialMatch: true };
|
|
2252
|
-
else throw new Error("Unsupported match result:\n".concat(JSON.stringify(result, null, 2)));
|
|
2253
|
-
i++;
|
|
2254
|
-
}
|
|
2255
|
-
/* istanbul ignore if */
|
|
2256
|
-
if (last) return { overflow: true };
|
|
2257
|
-
return {
|
|
2258
|
-
match: true,
|
|
2259
|
-
matchedChars: characters.slice(0, characters.length - restCharacters.length)
|
|
2260
|
-
};
|
|
2261
|
-
}
|
|
2262
|
-
switch (tree.op) {
|
|
2263
|
-
case "|":
|
|
2264
|
-
var partialMatch;
|
|
2265
|
-
for (var _iterator = _createForOfIteratorHelperLoose$1(tree.args), _step; !(_step = _iterator()).done;) {
|
|
2266
|
-
var branch = _step.value;
|
|
2267
|
-
var _result = _match(characters, branch, last);
|
|
2268
|
-
if (_result) if (_result.overflow) return _result;
|
|
2269
|
-
else if (_result.match) return {
|
|
2270
|
-
match: true,
|
|
2271
|
-
matchedChars: _result.matchedChars
|
|
2272
|
-
};
|
|
2273
|
-
else if (_result.partialMatch) partialMatch = true;
|
|
2274
|
-
else throw new Error("Unsupported match result:\n".concat(JSON.stringify(_result, null, 2)));
|
|
2275
|
-
}
|
|
2276
|
-
if (partialMatch) return { partialMatch: true };
|
|
2277
|
-
return;
|
|
2278
|
-
case "[]":
|
|
2279
|
-
for (var _iterator2 = _createForOfIteratorHelperLoose$1(tree.args), _step2; !(_step2 = _iterator2()).done;) {
|
|
2280
|
-
var _char = _step2.value;
|
|
2281
|
-
if (characters[0] === _char) {
|
|
2282
|
-
if (characters.length === 1) return {
|
|
2283
|
-
match: true,
|
|
2284
|
-
matchedChars: characters
|
|
2285
|
-
};
|
|
2286
|
-
if (last) return { overflow: true };
|
|
2287
|
-
return {
|
|
2288
|
-
match: true,
|
|
2289
|
-
matchedChars: [_char]
|
|
2290
|
-
};
|
|
2291
|
-
}
|
|
2292
|
-
}
|
|
2293
|
-
return;
|
|
2294
|
-
default: throw new Error("Unsupported instruction tree: ".concat(tree));
|
|
2295
|
-
}
|
|
2296
|
-
}
|
|
2297
|
-
//#endregion
|
|
2298
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.js
|
|
2299
|
-
function _typeof$2(o) {
|
|
2300
|
-
"@babel/helpers - typeof";
|
|
2301
|
-
return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
2302
|
-
return typeof o;
|
|
2303
|
-
} : function(o) {
|
|
2304
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
2305
|
-
}, _typeof$2(o);
|
|
2306
|
-
}
|
|
2307
|
-
function _createForOfIteratorHelperLoose(r, e) {
|
|
2308
|
-
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
2309
|
-
if (t) return (t = t.call(r)).next.bind(t);
|
|
2310
|
-
if (Array.isArray(r) || (t = _unsupportedIterableToArray$2(r)) || e && r && "number" == typeof r.length) {
|
|
2311
|
-
t && (r = t);
|
|
2312
|
-
var o = 0;
|
|
2313
|
-
return function() {
|
|
2314
|
-
return o >= r.length ? { done: !0 } : {
|
|
2315
|
-
done: !1,
|
|
2316
|
-
value: r[o++]
|
|
2317
|
-
};
|
|
2318
|
-
};
|
|
2319
|
-
}
|
|
2320
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2321
|
-
}
|
|
2322
|
-
function _unsupportedIterableToArray$2(r, a) {
|
|
2323
|
-
if (r) {
|
|
2324
|
-
if ("string" == typeof r) return _arrayLikeToArray$2(r, a);
|
|
2325
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
2326
|
-
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;
|
|
2327
|
-
}
|
|
2328
|
-
}
|
|
2329
|
-
function _arrayLikeToArray$2(r, a) {
|
|
2330
|
-
(null == a || a > r.length) && (a = r.length);
|
|
2331
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
2332
|
-
return n;
|
|
2333
|
-
}
|
|
2334
|
-
function _classCallCheck$2(a, n) {
|
|
2335
|
-
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
2336
|
-
}
|
|
2337
|
-
function _defineProperties$2(e, r) {
|
|
2338
|
-
for (var t = 0; t < r.length; t++) {
|
|
2339
|
-
var o = r[t];
|
|
2340
|
-
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$2(o.key), o);
|
|
2341
|
-
}
|
|
2342
|
-
}
|
|
2343
|
-
function _createClass$2(e, r, t) {
|
|
2344
|
-
return r && _defineProperties$2(e.prototype, r), t && _defineProperties$2(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
2345
|
-
}
|
|
2346
|
-
function _toPropertyKey$2(t) {
|
|
2347
|
-
var i = _toPrimitive$2(t, "string");
|
|
2348
|
-
return "symbol" == _typeof$2(i) ? i : i + "";
|
|
2349
|
-
}
|
|
2350
|
-
function _toPrimitive$2(t, r) {
|
|
2351
|
-
if ("object" != _typeof$2(t) || !t) return t;
|
|
2352
|
-
var e = t[Symbol.toPrimitive];
|
|
2353
|
-
if (void 0 !== e) {
|
|
2354
|
-
var i = e.call(t, r || "default");
|
|
2355
|
-
if ("object" != _typeof$2(i)) return i;
|
|
2356
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2357
|
-
}
|
|
2358
|
-
return ("string" === r ? String : Number)(t);
|
|
2359
|
-
}
|
|
2360
|
-
var DUMMY_DIGIT = "9";
|
|
2361
|
-
var LONGEST_DUMMY_PHONE_NUMBER = repeat(DUMMY_DIGIT, 15);
|
|
2362
|
-
var NATIONAL_PREFIX_SEPARATORS_PATTERN = /[- ]/;
|
|
2363
|
-
var SUPPORT_LEGACY_FORMATTING_PATTERNS = true;
|
|
2364
|
-
var CREATE_CHARACTER_CLASS_PATTERN = SUPPORT_LEGACY_FORMATTING_PATTERNS && function() {
|
|
2365
|
-
return /\[([^\[\]])*\]/g;
|
|
2366
|
-
};
|
|
2367
|
-
var CREATE_STANDALONE_DIGIT_PATTERN = SUPPORT_LEGACY_FORMATTING_PATTERNS && function() {
|
|
2368
|
-
return /\d(?=[^,}][^,}])/g;
|
|
2369
|
-
};
|
|
2370
|
-
var NON_ALTERING_FORMAT_REG_EXP = new RegExp("[" + VALID_PUNCTUATION + "]*\\$1[" + VALID_PUNCTUATION + "]*(\\$\\d[" + VALID_PUNCTUATION + "]*)*$");
|
|
2371
|
-
var MIN_LEADING_DIGITS_LENGTH = 3;
|
|
2372
|
-
var AsYouTypeFormatter = /* @__PURE__ */ function() {
|
|
2373
|
-
function AsYouTypeFormatter(_ref) {
|
|
2374
|
-
_ref.state;
|
|
2375
|
-
var metadata = _ref.metadata;
|
|
2376
|
-
_classCallCheck$2(this, AsYouTypeFormatter);
|
|
2377
|
-
this.metadata = metadata;
|
|
2378
|
-
this.resetFormat();
|
|
2379
|
-
}
|
|
2380
|
-
return _createClass$2(AsYouTypeFormatter, [
|
|
2381
|
-
{
|
|
2382
|
-
key: "resetFormat",
|
|
2383
|
-
value: function resetFormat() {
|
|
2384
|
-
this.chosenFormat = void 0;
|
|
2385
|
-
this.template = void 0;
|
|
2386
|
-
this.nationalNumberTemplate = void 0;
|
|
2387
|
-
this.populatedNationalNumberTemplate = void 0;
|
|
2388
|
-
this.populatedNationalNumberTemplatePosition = -1;
|
|
2389
|
-
}
|
|
2390
|
-
},
|
|
2391
|
-
{
|
|
2392
|
-
key: "reset",
|
|
2393
|
-
value: function reset(numberingPlan, state) {
|
|
2394
|
-
this.resetFormat();
|
|
2395
|
-
if (numberingPlan) {
|
|
2396
|
-
this.isNANP = numberingPlan.callingCode() === "1";
|
|
2397
|
-
this.matchingFormats = numberingPlan.formats();
|
|
2398
|
-
if (state.nationalSignificantNumber) this.narrowDownMatchingFormats(state);
|
|
2399
|
-
} else {
|
|
2400
|
-
this.isNANP = void 0;
|
|
2401
|
-
this.matchingFormats = [];
|
|
2402
|
-
}
|
|
2403
|
-
}
|
|
2404
|
-
},
|
|
2405
|
-
{
|
|
2406
|
-
key: "format",
|
|
2407
|
-
value: function format(nextDigits, state) {
|
|
2408
|
-
var _this = this;
|
|
2409
|
-
if (canFormatCompleteNumber(state.nationalSignificantNumber, state.country, this.metadata)) for (var _iterator = _createForOfIteratorHelperLoose(this.matchingFormats), _step; !(_step = _iterator()).done;) {
|
|
2410
|
-
var _format = _step.value;
|
|
2411
|
-
var formattedCompleteNumber = formatCompleteNumber(state, _format, {
|
|
2412
|
-
metadata: this.metadata,
|
|
2413
|
-
shouldTryNationalPrefixFormattingRule: function shouldTryNationalPrefixFormattingRule(format) {
|
|
2414
|
-
return _this.shouldTryNationalPrefixFormattingRule(format, {
|
|
2415
|
-
international: state.international,
|
|
2416
|
-
nationalPrefix: state.nationalPrefix
|
|
2417
|
-
});
|
|
2418
|
-
},
|
|
2419
|
-
getSeparatorAfterNationalPrefix: function getSeparatorAfterNationalPrefix(format) {
|
|
2420
|
-
return _this.getSeparatorAfterNationalPrefix(format);
|
|
2421
|
-
}
|
|
2422
|
-
});
|
|
2423
|
-
if (formattedCompleteNumber) {
|
|
2424
|
-
this.resetFormat();
|
|
2425
|
-
this.chosenFormat = _format;
|
|
2426
|
-
this.setNationalNumberTemplate(formattedCompleteNumber.replace(/\d/g, "x"), state);
|
|
2427
|
-
this.populatedNationalNumberTemplate = formattedCompleteNumber;
|
|
2428
|
-
this.populatedNationalNumberTemplatePosition = this.template.lastIndexOf("x");
|
|
2429
|
-
return formattedCompleteNumber;
|
|
2430
|
-
}
|
|
2431
|
-
}
|
|
2432
|
-
return this.formatNationalNumberWithNextDigits(nextDigits, state);
|
|
2433
|
-
}
|
|
2434
|
-
},
|
|
2435
|
-
{
|
|
2436
|
-
key: "formatNationalNumberWithNextDigits",
|
|
2437
|
-
value: function formatNationalNumberWithNextDigits(nextDigits, state) {
|
|
2438
|
-
var previouslyChosenFormat = this.chosenFormat;
|
|
2439
|
-
var newlyChosenFormat = this.chooseFormat(state);
|
|
2440
|
-
if (newlyChosenFormat) if (newlyChosenFormat === previouslyChosenFormat) return this.formatNextNationalNumberDigits(nextDigits);
|
|
2441
|
-
else return this.formatNextNationalNumberDigits(state.getNationalDigits());
|
|
2442
|
-
}
|
|
2443
|
-
},
|
|
2444
|
-
{
|
|
2445
|
-
key: "narrowDownMatchingFormats",
|
|
2446
|
-
value: function narrowDownMatchingFormats(_ref2) {
|
|
2447
|
-
var _this2 = this;
|
|
2448
|
-
var nationalSignificantNumber = _ref2.nationalSignificantNumber, nationalPrefix = _ref2.nationalPrefix, international = _ref2.international;
|
|
2449
|
-
var leadingDigits = nationalSignificantNumber;
|
|
2450
|
-
var leadingDigitsPatternIndex = leadingDigits.length - MIN_LEADING_DIGITS_LENGTH;
|
|
2451
|
-
if (leadingDigitsPatternIndex < 0) leadingDigitsPatternIndex = 0;
|
|
2452
|
-
this.matchingFormats = this.matchingFormats.filter(function(format) {
|
|
2453
|
-
return _this2.formatSuits(format, international, nationalPrefix) && _this2.formatMatches(format, leadingDigits, leadingDigitsPatternIndex);
|
|
2454
|
-
});
|
|
2455
|
-
if (this.chosenFormat && this.matchingFormats.indexOf(this.chosenFormat) === -1) this.resetFormat();
|
|
2456
|
-
}
|
|
2457
|
-
},
|
|
2458
|
-
{
|
|
2459
|
-
key: "formatSuits",
|
|
2460
|
-
value: function formatSuits(format, international, nationalPrefix) {
|
|
2461
|
-
if (nationalPrefix && !format.usesNationalPrefix() && !format.nationalPrefixIsOptionalWhenFormattingInNationalFormat()) return false;
|
|
2462
|
-
if (!international && !nationalPrefix && format.nationalPrefixIsMandatoryWhenFormattingInNationalFormat()) return false;
|
|
2463
|
-
return true;
|
|
2464
|
-
}
|
|
2465
|
-
},
|
|
2466
|
-
{
|
|
2467
|
-
key: "formatMatches",
|
|
2468
|
-
value: function formatMatches(format, leadingDigits, leadingDigitsPatternIndex) {
|
|
2469
|
-
var leadingDigitsPatternsCount = format.leadingDigitsPatterns().length;
|
|
2470
|
-
if (leadingDigitsPatternsCount === 0) return true;
|
|
2471
|
-
leadingDigitsPatternIndex = Math.min(leadingDigitsPatternIndex, leadingDigitsPatternsCount - 1);
|
|
2472
|
-
var leadingDigitsPattern = format.leadingDigitsPatterns()[leadingDigitsPatternIndex];
|
|
2473
|
-
if (leadingDigits.length < MIN_LEADING_DIGITS_LENGTH) try {
|
|
2474
|
-
return new PatternMatcher(leadingDigitsPattern).match(leadingDigits, { allowOverflow: true }) !== void 0;
|
|
2475
|
-
} catch (error) /* istanbul ignore next */ {
|
|
2476
|
-
console.error(error);
|
|
2477
|
-
return true;
|
|
2478
|
-
}
|
|
2479
|
-
return new RegExp("^(".concat(leadingDigitsPattern, ")")).test(leadingDigits);
|
|
2480
|
-
}
|
|
2481
|
-
},
|
|
2482
|
-
{
|
|
2483
|
-
key: "getFormatFormat",
|
|
2484
|
-
value: function getFormatFormat(format, international) {
|
|
2485
|
-
return international ? format.internationalFormat() : format.format();
|
|
2486
|
-
}
|
|
2487
|
-
},
|
|
2488
|
-
{
|
|
2489
|
-
key: "chooseFormat",
|
|
2490
|
-
value: function chooseFormat(state) {
|
|
2491
|
-
var _this3 = this;
|
|
2492
|
-
var _loop = function _loop() {
|
|
2493
|
-
var format = _step2.value;
|
|
2494
|
-
if (_this3.chosenFormat === format) return 0;
|
|
2495
|
-
/* istanbul ignore if */
|
|
2496
|
-
if (!NON_ALTERING_FORMAT_REG_EXP.test(_this3.getFormatFormat(format, state.international))) return 1;
|
|
2497
|
-
if (!_this3.createTemplateForFormat(format, state)) {
|
|
2498
|
-
_this3.matchingFormats = _this3.matchingFormats.filter(function(_) {
|
|
2499
|
-
return _ !== format;
|
|
2500
|
-
});
|
|
2501
|
-
return 1;
|
|
2502
|
-
}
|
|
2503
|
-
_this3.chosenFormat = format;
|
|
2504
|
-
return 0;
|
|
2505
|
-
}, _ret;
|
|
2506
|
-
/* istanbul ignore next */
|
|
2507
|
-
for (var _iterator2 = _createForOfIteratorHelperLoose(this.matchingFormats.slice()), _step2; !(_step2 = _iterator2()).done;) {
|
|
2508
|
-
_ret = _loop();
|
|
2509
|
-
if (_ret === 0) break;
|
|
2510
|
-
if (_ret === 1) continue;
|
|
2511
|
-
}
|
|
2512
|
-
if (!this.chosenFormat) this.resetFormat();
|
|
2513
|
-
return this.chosenFormat;
|
|
2514
|
-
}
|
|
2515
|
-
},
|
|
2516
|
-
{
|
|
2517
|
-
key: "createTemplateForFormat",
|
|
2518
|
-
value: function createTemplateForFormat(format, state) {
|
|
2519
|
-
/* istanbul ignore if */
|
|
2520
|
-
if (SUPPORT_LEGACY_FORMATTING_PATTERNS && format.pattern().indexOf("|") >= 0) return;
|
|
2521
|
-
var template = this.getTemplateForFormat(format, state);
|
|
2522
|
-
if (template) {
|
|
2523
|
-
this.setNationalNumberTemplate(template, state);
|
|
2524
|
-
return true;
|
|
2525
|
-
}
|
|
2526
|
-
}
|
|
2527
|
-
},
|
|
2528
|
-
{
|
|
2529
|
-
key: "getSeparatorAfterNationalPrefix",
|
|
2530
|
-
value: function getSeparatorAfterNationalPrefix(format) {
|
|
2531
|
-
if (this.isNANP) return " ";
|
|
2532
|
-
if (format && format.nationalPrefixFormattingRule() && NATIONAL_PREFIX_SEPARATORS_PATTERN.test(format.nationalPrefixFormattingRule())) return " ";
|
|
2533
|
-
return "";
|
|
2534
|
-
}
|
|
2535
|
-
},
|
|
2536
|
-
{
|
|
2537
|
-
key: "getInternationalPrefixBeforeCountryCallingCode",
|
|
2538
|
-
value: function getInternationalPrefixBeforeCountryCallingCode(_ref3, options) {
|
|
2539
|
-
var IDDPrefix = _ref3.IDDPrefix, missingPlus = _ref3.missingPlus;
|
|
2540
|
-
if (IDDPrefix) return options && options.spacing === false ? IDDPrefix : IDDPrefix + " ";
|
|
2541
|
-
if (missingPlus) return "";
|
|
2542
|
-
return "+";
|
|
2543
|
-
}
|
|
2544
|
-
},
|
|
2545
|
-
{
|
|
2546
|
-
key: "getTemplate",
|
|
2547
|
-
value: function getTemplate(state) {
|
|
2548
|
-
if (!this.template) return;
|
|
2549
|
-
var index = -1;
|
|
2550
|
-
var i = 0;
|
|
2551
|
-
var internationalPrefix = state.international ? this.getInternationalPrefixBeforeCountryCallingCode(state, { spacing: false }) : "";
|
|
2552
|
-
while (i < internationalPrefix.length + state.getDigitsWithoutInternationalPrefix().length) {
|
|
2553
|
-
index = this.template.indexOf("x", index + 1);
|
|
2554
|
-
i++;
|
|
2555
|
-
}
|
|
2556
|
-
return cutAndStripNonPairedParens(this.template, index + 1);
|
|
2557
|
-
}
|
|
2558
|
-
},
|
|
2559
|
-
{
|
|
2560
|
-
key: "setNationalNumberTemplate",
|
|
2561
|
-
value: function setNationalNumberTemplate(template, state) {
|
|
2562
|
-
this.nationalNumberTemplate = template;
|
|
2563
|
-
this.populatedNationalNumberTemplate = template;
|
|
2564
|
-
this.populatedNationalNumberTemplatePosition = -1;
|
|
2565
|
-
if (state.international) this.template = this.getInternationalPrefixBeforeCountryCallingCode(state).replace(/[\d\+]/g, "x") + repeat("x", state.callingCode.length) + " " + template;
|
|
2566
|
-
else this.template = template;
|
|
2567
|
-
}
|
|
2568
|
-
},
|
|
2569
|
-
{
|
|
2570
|
-
key: "getTemplateForFormat",
|
|
2571
|
-
value: function getTemplateForFormat(format, _ref4) {
|
|
2572
|
-
var nationalSignificantNumber = _ref4.nationalSignificantNumber, international = _ref4.international, nationalPrefix = _ref4.nationalPrefix, prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix = _ref4.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix;
|
|
2573
|
-
var pattern = format.pattern();
|
|
2574
|
-
/* istanbul ignore else */
|
|
2575
|
-
if (SUPPORT_LEGACY_FORMATTING_PATTERNS) pattern = pattern.replace(CREATE_CHARACTER_CLASS_PATTERN(), "\\d").replace(CREATE_STANDALONE_DIGIT_PATTERN(), "\\d");
|
|
2576
|
-
var digits = LONGEST_DUMMY_PHONE_NUMBER.match(pattern)[0];
|
|
2577
|
-
if (nationalSignificantNumber.length > digits.length) return;
|
|
2578
|
-
var strictPattern = new RegExp("^" + pattern + "$");
|
|
2579
|
-
var nationalNumberDummyDigits = nationalSignificantNumber.replace(/\d/g, DUMMY_DIGIT);
|
|
2580
|
-
if (strictPattern.test(nationalNumberDummyDigits)) digits = nationalNumberDummyDigits;
|
|
2581
|
-
var numberFormat = this.getFormatFormat(format, international);
|
|
2582
|
-
var nationalPrefixIncludedInTemplate;
|
|
2583
|
-
if (this.shouldTryNationalPrefixFormattingRule(format, {
|
|
2584
|
-
international,
|
|
2585
|
-
nationalPrefix
|
|
2586
|
-
})) {
|
|
2587
|
-
var numberFormatWithNationalPrefix = numberFormat.replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule());
|
|
2588
|
-
/* istanbul ignore else */
|
|
2589
|
-
if (parseDigits(format.nationalPrefixFormattingRule()) === (nationalPrefix || "") + parseDigits("$1")) {
|
|
2590
|
-
numberFormat = numberFormatWithNationalPrefix;
|
|
2591
|
-
nationalPrefixIncludedInTemplate = true;
|
|
2592
|
-
if (nationalPrefix) {
|
|
2593
|
-
var i = nationalPrefix.length;
|
|
2594
|
-
while (i > 0) {
|
|
2595
|
-
numberFormat = numberFormat.replace(/\d/, "x");
|
|
2596
|
-
i--;
|
|
2597
|
-
}
|
|
2598
|
-
}
|
|
2599
|
-
}
|
|
2600
|
-
}
|
|
2601
|
-
var template = digits.replace(new RegExp(pattern), numberFormat).replace(new RegExp(DUMMY_DIGIT, "g"), "x");
|
|
2602
|
-
if (!nationalPrefixIncludedInTemplate) {
|
|
2603
|
-
if (prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix) template = repeat("x", prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix.length) + " " + template;
|
|
2604
|
-
else if (nationalPrefix) template = repeat("x", nationalPrefix.length) + this.getSeparatorAfterNationalPrefix(format) + template;
|
|
2605
|
-
}
|
|
2606
|
-
if (international) template = applyInternationalSeparatorStyle(template);
|
|
2607
|
-
return template;
|
|
2608
|
-
}
|
|
2609
|
-
},
|
|
2610
|
-
{
|
|
2611
|
-
key: "formatNextNationalNumberDigits",
|
|
2612
|
-
value: function formatNextNationalNumberDigits(digits) {
|
|
2613
|
-
var result = populateTemplateWithDigits(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition, digits);
|
|
2614
|
-
if (!result) {
|
|
2615
|
-
this.resetFormat();
|
|
2616
|
-
return;
|
|
2617
|
-
}
|
|
2618
|
-
this.populatedNationalNumberTemplate = result[0];
|
|
2619
|
-
this.populatedNationalNumberTemplatePosition = result[1];
|
|
2620
|
-
return cutAndStripNonPairedParens(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1);
|
|
2621
|
-
}
|
|
2622
|
-
},
|
|
2623
|
-
{
|
|
2624
|
-
key: "shouldTryNationalPrefixFormattingRule",
|
|
2625
|
-
value: function shouldTryNationalPrefixFormattingRule(format, _ref5) {
|
|
2626
|
-
var international = _ref5.international, nationalPrefix = _ref5.nationalPrefix;
|
|
2627
|
-
if (format.nationalPrefixFormattingRule()) {
|
|
2628
|
-
var usesNationalPrefix = format.usesNationalPrefix();
|
|
2629
|
-
if (usesNationalPrefix && nationalPrefix || !usesNationalPrefix && !international) return true;
|
|
2630
|
-
}
|
|
2631
|
-
}
|
|
2632
|
-
}
|
|
2633
|
-
]);
|
|
2634
|
-
}();
|
|
2635
|
-
//#endregion
|
|
2636
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/AsYouTypeParser.js
|
|
2637
|
-
function _typeof$1(o) {
|
|
2638
|
-
"@babel/helpers - typeof";
|
|
2639
|
-
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
2640
|
-
return typeof o;
|
|
2641
|
-
} : function(o) {
|
|
2642
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
2643
|
-
}, _typeof$1(o);
|
|
2644
|
-
}
|
|
2645
|
-
function _slicedToArray$1(r, e) {
|
|
2646
|
-
return _arrayWithHoles$1(r) || _iterableToArrayLimit$1(r, e) || _unsupportedIterableToArray$1(r, e) || _nonIterableRest$1();
|
|
2647
|
-
}
|
|
2648
|
-
function _nonIterableRest$1() {
|
|
2649
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2650
|
-
}
|
|
2651
|
-
function _unsupportedIterableToArray$1(r, a) {
|
|
2652
|
-
if (r) {
|
|
2653
|
-
if ("string" == typeof r) return _arrayLikeToArray$1(r, a);
|
|
2654
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
2655
|
-
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;
|
|
2656
|
-
}
|
|
2657
|
-
}
|
|
2658
|
-
function _arrayLikeToArray$1(r, a) {
|
|
2659
|
-
(null == a || a > r.length) && (a = r.length);
|
|
2660
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
2661
|
-
return n;
|
|
2662
|
-
}
|
|
2663
|
-
function _iterableToArrayLimit$1(r, l) {
|
|
2664
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
2665
|
-
if (null != t) {
|
|
2666
|
-
var e, n, i, u, a = [], f = !0, o = !1;
|
|
2667
|
-
try {
|
|
2668
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
2669
|
-
if (Object(t) !== t) return;
|
|
2670
|
-
f = !1;
|
|
2671
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
2672
|
-
} catch (r) {
|
|
2673
|
-
o = !0, n = r;
|
|
2674
|
-
} finally {
|
|
2675
|
-
try {
|
|
2676
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
2677
|
-
} finally {
|
|
2678
|
-
if (o) throw n;
|
|
2679
|
-
}
|
|
2680
|
-
}
|
|
2681
|
-
return a;
|
|
2682
|
-
}
|
|
2683
|
-
}
|
|
2684
|
-
function _arrayWithHoles$1(r) {
|
|
2685
|
-
if (Array.isArray(r)) return r;
|
|
2686
|
-
}
|
|
2687
|
-
function _classCallCheck$1(a, n) {
|
|
2688
|
-
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
2689
|
-
}
|
|
2690
|
-
function _defineProperties$1(e, r) {
|
|
2691
|
-
for (var t = 0; t < r.length; t++) {
|
|
2692
|
-
var o = r[t];
|
|
2693
|
-
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$1(o.key), o);
|
|
2694
|
-
}
|
|
2695
|
-
}
|
|
2696
|
-
function _createClass$1(e, r, t) {
|
|
2697
|
-
return r && _defineProperties$1(e.prototype, r), t && _defineProperties$1(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
2698
|
-
}
|
|
2699
|
-
function _toPropertyKey$1(t) {
|
|
2700
|
-
var i = _toPrimitive$1(t, "string");
|
|
2701
|
-
return "symbol" == _typeof$1(i) ? i : i + "";
|
|
2702
|
-
}
|
|
2703
|
-
function _toPrimitive$1(t, r) {
|
|
2704
|
-
if ("object" != _typeof$1(t) || !t) return t;
|
|
2705
|
-
var e = t[Symbol.toPrimitive];
|
|
2706
|
-
if (void 0 !== e) {
|
|
2707
|
-
var i = e.call(t, r || "default");
|
|
2708
|
-
if ("object" != _typeof$1(i)) return i;
|
|
2709
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2710
|
-
}
|
|
2711
|
-
return ("string" === r ? String : Number)(t);
|
|
2712
|
-
}
|
|
2713
|
-
var VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART = "[" + VALID_PUNCTUATION + VALID_DIGITS + "]+";
|
|
2714
|
-
var VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART_PATTERN = new RegExp("^" + VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART + "$", "i");
|
|
2715
|
-
var VALID_FORMATTED_PHONE_NUMBER_PART = "(?:[" + PLUS_CHARS + "][" + VALID_PUNCTUATION + VALID_DIGITS + "]*|[" + VALID_PUNCTUATION + VALID_DIGITS + "]+)";
|
|
2716
|
-
var AFTER_PHONE_NUMBER_DIGITS_END_PATTERN = new RegExp("[^" + VALID_PUNCTUATION + VALID_DIGITS + "]+.*$");
|
|
2717
|
-
var COMPLEX_NATIONAL_PREFIX = /[^\d\[\]]/;
|
|
2718
|
-
var AsYouTypeParser = /* @__PURE__ */ function() {
|
|
2719
|
-
function AsYouTypeParser(_ref) {
|
|
2720
|
-
var defaultCountry = _ref.defaultCountry, defaultCallingCode = _ref.defaultCallingCode, metadata = _ref.metadata, onNationalSignificantNumberChange = _ref.onNationalSignificantNumberChange;
|
|
2721
|
-
_classCallCheck$1(this, AsYouTypeParser);
|
|
2722
|
-
this.defaultCountry = defaultCountry;
|
|
2723
|
-
this.defaultCallingCode = defaultCallingCode;
|
|
2724
|
-
this.metadata = metadata;
|
|
2725
|
-
this.onNationalSignificantNumberChange = onNationalSignificantNumberChange;
|
|
2726
|
-
}
|
|
2727
|
-
return _createClass$1(AsYouTypeParser, [
|
|
2728
|
-
{
|
|
2729
|
-
key: "input",
|
|
2730
|
-
value: function input(text, state) {
|
|
2731
|
-
var _extractFormattedDigi2 = _slicedToArray$1(extractFormattedDigitsAndPlus(text), 2), formattedDigits = _extractFormattedDigi2[0], hasPlus = _extractFormattedDigi2[1];
|
|
2732
|
-
var digits = parseDigits(formattedDigits);
|
|
2733
|
-
var justLeadingPlus;
|
|
2734
|
-
if (hasPlus) {
|
|
2735
|
-
if (!state.digits) {
|
|
2736
|
-
state.startInternationalNumber(void 0, void 0);
|
|
2737
|
-
if (!digits) justLeadingPlus = true;
|
|
2738
|
-
}
|
|
2739
|
-
}
|
|
2740
|
-
if (digits) this.inputDigits(digits, state);
|
|
2741
|
-
return {
|
|
2742
|
-
digits,
|
|
2743
|
-
justLeadingPlus
|
|
2744
|
-
};
|
|
2745
|
-
}
|
|
2746
|
-
},
|
|
2747
|
-
{
|
|
2748
|
-
key: "inputDigits",
|
|
2749
|
-
value: function inputDigits(nextDigits, state) {
|
|
2750
|
-
var digits = state.digits;
|
|
2751
|
-
var hasReceivedThreeLeadingDigits = digits.length < 3 && digits.length + nextDigits.length >= 3;
|
|
2752
|
-
state.appendDigits(nextDigits);
|
|
2753
|
-
if (hasReceivedThreeLeadingDigits) this.extractIddPrefix(state);
|
|
2754
|
-
if (this.isWaitingForCountryCallingCode(state)) {
|
|
2755
|
-
if (!this.extractCountryCallingCode(state)) return;
|
|
2756
|
-
} else state.appendNationalSignificantNumberDigits(nextDigits);
|
|
2757
|
-
if (!state.international) {
|
|
2758
|
-
if (!this.hasExtractedNationalSignificantNumber) this.extractNationalSignificantNumber(state.getNationalDigits(), function(stateUpdate) {
|
|
2759
|
-
return state.update(stateUpdate);
|
|
2760
|
-
});
|
|
2761
|
-
}
|
|
2762
|
-
}
|
|
2763
|
-
},
|
|
2764
|
-
{
|
|
2765
|
-
key: "isWaitingForCountryCallingCode",
|
|
2766
|
-
value: function isWaitingForCountryCallingCode(_ref2) {
|
|
2767
|
-
var international = _ref2.international, callingCode = _ref2.callingCode;
|
|
2768
|
-
return international && !callingCode;
|
|
2769
|
-
}
|
|
2770
|
-
},
|
|
2771
|
-
{
|
|
2772
|
-
key: "extractCountryCallingCode",
|
|
2773
|
-
value: function extractCountryCallingCode$1(state) {
|
|
2774
|
-
var _extractCountryCallin = extractCountryCallingCode("+" + state.getDigitsWithoutInternationalPrefix(), state.country, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata), countryCallingCode = _extractCountryCallin.countryCallingCode, number = _extractCountryCallin.number;
|
|
2775
|
-
if (countryCallingCode) {
|
|
2776
|
-
state.setCallingCode(countryCallingCode);
|
|
2777
|
-
state.update({ nationalSignificantNumber: number });
|
|
2778
|
-
return true;
|
|
2779
|
-
}
|
|
2780
|
-
}
|
|
2781
|
-
},
|
|
2782
|
-
{
|
|
2783
|
-
key: "reset",
|
|
2784
|
-
value: function reset(numberingPlan) {
|
|
2785
|
-
if (numberingPlan) {
|
|
2786
|
-
this.hasSelectedNumberingPlan = true;
|
|
2787
|
-
var nationalPrefixForParsing = numberingPlan._nationalPrefixForParsing();
|
|
2788
|
-
this.couldPossiblyExtractAnotherNationalSignificantNumber = nationalPrefixForParsing && COMPLEX_NATIONAL_PREFIX.test(nationalPrefixForParsing);
|
|
2789
|
-
} else {
|
|
2790
|
-
this.hasSelectedNumberingPlan = void 0;
|
|
2791
|
-
this.couldPossiblyExtractAnotherNationalSignificantNumber = void 0;
|
|
2792
|
-
}
|
|
2793
|
-
}
|
|
2794
|
-
},
|
|
2795
|
-
{
|
|
2796
|
-
key: "extractNationalSignificantNumber",
|
|
2797
|
-
value: function extractNationalSignificantNumber(nationalDigits, setState) {
|
|
2798
|
-
if (!this.hasSelectedNumberingPlan) return;
|
|
2799
|
-
var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(nationalDigits, this.metadata), nationalPrefix = _extractNationalNumbe.nationalPrefix, nationalNumber = _extractNationalNumbe.nationalNumber, carrierCode = _extractNationalNumbe.carrierCode;
|
|
2800
|
-
if (nationalNumber === nationalDigits) return;
|
|
2801
|
-
this.onExtractedNationalNumber(nationalPrefix, carrierCode, nationalNumber, nationalDigits, setState);
|
|
2802
|
-
return true;
|
|
2803
|
-
}
|
|
2804
|
-
},
|
|
2805
|
-
{
|
|
2806
|
-
key: "extractAnotherNationalSignificantNumber",
|
|
2807
|
-
value: function extractAnotherNationalSignificantNumber(nationalDigits, prevNationalSignificantNumber, setState) {
|
|
2808
|
-
if (!this.hasExtractedNationalSignificantNumber) return this.extractNationalSignificantNumber(nationalDigits, setState);
|
|
2809
|
-
if (!this.couldPossiblyExtractAnotherNationalSignificantNumber) return;
|
|
2810
|
-
var _extractNationalNumbe2 = extractNationalNumberFromPossiblyIncompleteNumber(nationalDigits, this.metadata), nationalPrefix = _extractNationalNumbe2.nationalPrefix, nationalNumber = _extractNationalNumbe2.nationalNumber, carrierCode = _extractNationalNumbe2.carrierCode;
|
|
2811
|
-
/* istanbul ignore if */
|
|
2812
|
-
if (nationalNumber === prevNationalSignificantNumber) return;
|
|
2813
|
-
this.onExtractedNationalNumber(nationalPrefix, carrierCode, nationalNumber, nationalDigits, setState);
|
|
2814
|
-
return true;
|
|
2815
|
-
}
|
|
2816
|
-
},
|
|
2817
|
-
{
|
|
2818
|
-
key: "onExtractedNationalNumber",
|
|
2819
|
-
value: function onExtractedNationalNumber(nationalPrefix, carrierCode, nationalSignificantNumber, nationalDigits, setState) {
|
|
2820
|
-
var nationalSignificantNumberIsModified = false;
|
|
2821
|
-
var prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix;
|
|
2822
|
-
var nationalSignificantNumberIndex = nationalDigits.lastIndexOf(nationalSignificantNumber);
|
|
2823
|
-
if (nationalSignificantNumberIndex < 0 || nationalSignificantNumberIndex !== nationalDigits.length - nationalSignificantNumber.length) nationalSignificantNumberIsModified = true;
|
|
2824
|
-
else {
|
|
2825
|
-
var prefixBeforeNationalNumber = nationalDigits.slice(0, nationalSignificantNumberIndex);
|
|
2826
|
-
/* istanbul ignore if */
|
|
2827
|
-
if (prefixBeforeNationalNumber) {
|
|
2828
|
-
if (prefixBeforeNationalNumber !== nationalPrefix) prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix = prefixBeforeNationalNumber;
|
|
2829
|
-
}
|
|
2830
|
-
}
|
|
2831
|
-
setState({
|
|
2832
|
-
nationalPrefix,
|
|
2833
|
-
carrierCode,
|
|
2834
|
-
nationalSignificantNumber,
|
|
2835
|
-
nationalSignificantNumberIsModified,
|
|
2836
|
-
prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix
|
|
2837
|
-
});
|
|
2838
|
-
this.hasExtractedNationalSignificantNumber = true;
|
|
2839
|
-
this.onNationalSignificantNumberChange();
|
|
2840
|
-
}
|
|
2841
|
-
},
|
|
2842
|
-
{
|
|
2843
|
-
key: "reExtractNationalSignificantNumber",
|
|
2844
|
-
value: function reExtractNationalSignificantNumber(state) {
|
|
2845
|
-
if (this.extractAnotherNationalSignificantNumber(state.getNationalDigits(), state.nationalSignificantNumber, function(stateUpdate) {
|
|
2846
|
-
return state.update(stateUpdate);
|
|
2847
|
-
})) return true;
|
|
2848
|
-
if (this.extractIddPrefix(state)) {
|
|
2849
|
-
this.extractCallingCodeAndNationalSignificantNumber(state);
|
|
2850
|
-
return true;
|
|
2851
|
-
}
|
|
2852
|
-
if (this.fixMissingPlus(state)) {
|
|
2853
|
-
this.extractCallingCodeAndNationalSignificantNumber(state);
|
|
2854
|
-
return true;
|
|
2855
|
-
}
|
|
2856
|
-
}
|
|
2857
|
-
},
|
|
2858
|
-
{
|
|
2859
|
-
key: "extractIddPrefix",
|
|
2860
|
-
value: function extractIddPrefix(state) {
|
|
2861
|
-
var international = state.international, IDDPrefix = state.IDDPrefix, digits = state.digits;
|
|
2862
|
-
state.nationalSignificantNumber;
|
|
2863
|
-
if (international || IDDPrefix) return;
|
|
2864
|
-
var numberWithoutIDD = stripIddPrefix(digits, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata);
|
|
2865
|
-
if (numberWithoutIDD !== void 0 && numberWithoutIDD !== digits) {
|
|
2866
|
-
state.update({ IDDPrefix: digits.slice(0, digits.length - numberWithoutIDD.length) });
|
|
2867
|
-
this.startInternationalNumber(state, {
|
|
2868
|
-
country: void 0,
|
|
2869
|
-
callingCode: void 0
|
|
2870
|
-
});
|
|
2871
|
-
return true;
|
|
2872
|
-
}
|
|
2873
|
-
}
|
|
2874
|
-
},
|
|
2875
|
-
{
|
|
2876
|
-
key: "fixMissingPlus",
|
|
2877
|
-
value: function fixMissingPlus(state) {
|
|
2878
|
-
if (!state.international) {
|
|
2879
|
-
var newCallingCode = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(state.digits, state.country, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata).countryCallingCode;
|
|
2880
|
-
if (newCallingCode) {
|
|
2881
|
-
state.update({ missingPlus: true });
|
|
2882
|
-
this.startInternationalNumber(state, {
|
|
2883
|
-
country: state.country,
|
|
2884
|
-
callingCode: newCallingCode
|
|
2885
|
-
});
|
|
2886
|
-
return true;
|
|
2887
|
-
}
|
|
2888
|
-
}
|
|
2889
|
-
}
|
|
2890
|
-
},
|
|
2891
|
-
{
|
|
2892
|
-
key: "startInternationalNumber",
|
|
2893
|
-
value: function startInternationalNumber(state, _ref3) {
|
|
2894
|
-
var country = _ref3.country, callingCode = _ref3.callingCode;
|
|
2895
|
-
state.startInternationalNumber(country, callingCode);
|
|
2896
|
-
if (state.nationalSignificantNumber) {
|
|
2897
|
-
state.resetNationalSignificantNumber();
|
|
2898
|
-
this.onNationalSignificantNumberChange();
|
|
2899
|
-
this.hasExtractedNationalSignificantNumber = void 0;
|
|
2900
|
-
}
|
|
2901
|
-
}
|
|
2902
|
-
},
|
|
2903
|
-
{
|
|
2904
|
-
key: "extractCallingCodeAndNationalSignificantNumber",
|
|
2905
|
-
value: function extractCallingCodeAndNationalSignificantNumber(state) {
|
|
2906
|
-
if (this.extractCountryCallingCode(state)) this.extractNationalSignificantNumber(state.getNationalDigits(), function(stateUpdate) {
|
|
2907
|
-
return state.update(stateUpdate);
|
|
2908
|
-
});
|
|
2909
|
-
}
|
|
2910
|
-
}
|
|
2911
|
-
]);
|
|
2912
|
-
}();
|
|
2913
|
-
function extractFormattedPhoneNumber(text) {
|
|
2914
|
-
var startsAt = text.search(VALID_FORMATTED_PHONE_NUMBER_PART);
|
|
2915
|
-
if (startsAt < 0) return;
|
|
2916
|
-
text = text.slice(startsAt);
|
|
2917
|
-
var hasPlus;
|
|
2918
|
-
if (text[0] === "+") {
|
|
2919
|
-
hasPlus = true;
|
|
2920
|
-
text = text.slice(1);
|
|
2921
|
-
}
|
|
2922
|
-
text = text.replace(AFTER_PHONE_NUMBER_DIGITS_END_PATTERN, "");
|
|
2923
|
-
if (hasPlus) text = "+" + text;
|
|
2924
|
-
return text;
|
|
2925
|
-
}
|
|
2926
|
-
/**
|
|
2927
|
-
* Extracts formatted phone number digits (and a `+`) from text (if there're any).
|
|
2928
|
-
* @param {string} text
|
|
2929
|
-
* @return {any[]}
|
|
2930
|
-
*/
|
|
2931
|
-
function _extractFormattedDigitsAndPlus(text) {
|
|
2932
|
-
var extractedNumber = extractFormattedPhoneNumber(text) || "";
|
|
2933
|
-
if (extractedNumber[0] === "+") return [extractedNumber.slice(1), true];
|
|
2934
|
-
return [extractedNumber];
|
|
2935
|
-
}
|
|
2936
|
-
/**
|
|
2937
|
-
* Extracts formatted phone number digits (and a `+`) from text (if there're any).
|
|
2938
|
-
* @param {string} text
|
|
2939
|
-
* @return {any[]}
|
|
2940
|
-
*/
|
|
2941
|
-
function extractFormattedDigitsAndPlus(text) {
|
|
2942
|
-
var _extractFormattedDigi4 = _slicedToArray$1(_extractFormattedDigitsAndPlus(text), 2), formattedDigits = _extractFormattedDigi4[0], hasPlus = _extractFormattedDigi4[1];
|
|
2943
|
-
if (!VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART_PATTERN.test(formattedDigits)) formattedDigits = "";
|
|
2944
|
-
return [formattedDigits, hasPlus];
|
|
2945
|
-
}
|
|
2946
|
-
//#endregion
|
|
2947
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/AsYouType.js
|
|
2948
|
-
function _typeof(o) {
|
|
2949
|
-
"@babel/helpers - typeof";
|
|
2950
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
2951
|
-
return typeof o;
|
|
2952
|
-
} : function(o) {
|
|
2953
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
2954
|
-
}, _typeof(o);
|
|
2955
|
-
}
|
|
2956
|
-
function _slicedToArray(r, e) {
|
|
2957
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
2958
|
-
}
|
|
2959
|
-
function _nonIterableRest() {
|
|
2960
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2961
|
-
}
|
|
2962
|
-
function _unsupportedIterableToArray(r, a) {
|
|
2963
|
-
if (r) {
|
|
2964
|
-
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
2965
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
2966
|
-
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;
|
|
2967
|
-
}
|
|
2968
|
-
}
|
|
2969
|
-
function _arrayLikeToArray(r, a) {
|
|
2970
|
-
(null == a || a > r.length) && (a = r.length);
|
|
2971
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
2972
|
-
return n;
|
|
2973
|
-
}
|
|
2974
|
-
function _iterableToArrayLimit(r, l) {
|
|
2975
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
2976
|
-
if (null != t) {
|
|
2977
|
-
var e, n, i, u, a = [], f = !0, o = !1;
|
|
2978
|
-
try {
|
|
2979
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
2980
|
-
if (Object(t) !== t) return;
|
|
2981
|
-
f = !1;
|
|
2982
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
2983
|
-
} catch (r) {
|
|
2984
|
-
o = !0, n = r;
|
|
2985
|
-
} finally {
|
|
2986
|
-
try {
|
|
2987
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
2988
|
-
} finally {
|
|
2989
|
-
if (o) throw n;
|
|
2990
|
-
}
|
|
2991
|
-
}
|
|
2992
|
-
return a;
|
|
2993
|
-
}
|
|
2994
|
-
}
|
|
2995
|
-
function _arrayWithHoles(r) {
|
|
2996
|
-
if (Array.isArray(r)) return r;
|
|
2997
|
-
}
|
|
2998
|
-
function _classCallCheck(a, n) {
|
|
2999
|
-
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
3000
|
-
}
|
|
3001
|
-
function _defineProperties(e, r) {
|
|
3002
|
-
for (var t = 0; t < r.length; t++) {
|
|
3003
|
-
var o = r[t];
|
|
3004
|
-
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
3005
|
-
}
|
|
3006
|
-
}
|
|
3007
|
-
function _createClass(e, r, t) {
|
|
3008
|
-
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
3009
|
-
}
|
|
3010
|
-
function _toPropertyKey(t) {
|
|
3011
|
-
var i = _toPrimitive(t, "string");
|
|
3012
|
-
return "symbol" == _typeof(i) ? i : i + "";
|
|
3013
|
-
}
|
|
3014
|
-
function _toPrimitive(t, r) {
|
|
3015
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
3016
|
-
var e = t[Symbol.toPrimitive];
|
|
3017
|
-
if (void 0 !== e) {
|
|
3018
|
-
var i = e.call(t, r || "default");
|
|
3019
|
-
if ("object" != _typeof(i)) return i;
|
|
3020
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
3021
|
-
}
|
|
3022
|
-
return ("string" === r ? String : Number)(t);
|
|
3023
|
-
}
|
|
3024
|
-
var USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;
|
|
3025
|
-
var AsYouType$1 = /* @__PURE__ */ function() {
|
|
3026
|
-
/**
|
|
3027
|
-
* @param {(string|object)?} [optionsOrDefaultCountry] - The default country used for parsing non-international phone numbers. Can also be an `options` object.
|
|
3028
|
-
* @param {Object} metadata
|
|
3029
|
-
*/
|
|
3030
|
-
function AsYouType(optionsOrDefaultCountry, metadata) {
|
|
3031
|
-
_classCallCheck(this, AsYouType);
|
|
3032
|
-
this.metadata = new Metadata(metadata);
|
|
3033
|
-
var _this$getCountryAndCa2 = _slicedToArray(this.getCountryAndCallingCode(optionsOrDefaultCountry), 2), defaultCountry = _this$getCountryAndCa2[0], defaultCallingCode = _this$getCountryAndCa2[1];
|
|
3034
|
-
this.defaultCountry = defaultCountry;
|
|
3035
|
-
this.defaultCallingCode = defaultCallingCode;
|
|
3036
|
-
this.reset();
|
|
3037
|
-
}
|
|
3038
|
-
return _createClass(AsYouType, [
|
|
3039
|
-
{
|
|
3040
|
-
key: "getCountryAndCallingCode",
|
|
3041
|
-
value: function getCountryAndCallingCode(optionsOrDefaultCountry) {
|
|
3042
|
-
var defaultCountry;
|
|
3043
|
-
var defaultCallingCode;
|
|
3044
|
-
if (optionsOrDefaultCountry) if (isObject(optionsOrDefaultCountry)) {
|
|
3045
|
-
defaultCountry = optionsOrDefaultCountry.defaultCountry;
|
|
3046
|
-
defaultCallingCode = optionsOrDefaultCountry.defaultCallingCode;
|
|
3047
|
-
} else defaultCountry = optionsOrDefaultCountry;
|
|
3048
|
-
if (defaultCountry && !this.metadata.hasCountry(defaultCountry)) defaultCountry = void 0;
|
|
3049
|
-
if (defaultCallingCode) {
|
|
3050
|
-
/* istanbul ignore if */
|
|
3051
|
-
if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {
|
|
3052
|
-
if (this.metadata.isNonGeographicCallingCode(defaultCallingCode)) defaultCountry = "001";
|
|
3053
|
-
}
|
|
3054
|
-
}
|
|
3055
|
-
return [defaultCountry, defaultCallingCode];
|
|
3056
|
-
}
|
|
3057
|
-
},
|
|
3058
|
-
{
|
|
3059
|
-
key: "input",
|
|
3060
|
-
value: function input(text) {
|
|
3061
|
-
var _this$parser$input = this.parser.input(text, this.state), digits = _this$parser$input.digits;
|
|
3062
|
-
if (_this$parser$input.justLeadingPlus) this.formattedOutput = "+";
|
|
3063
|
-
else if (digits) {
|
|
3064
|
-
this.determineTheCountryIfNeeded();
|
|
3065
|
-
if (this.state.nationalSignificantNumber) this.formatter.narrowDownMatchingFormats(this.state);
|
|
3066
|
-
var formattedNationalNumber;
|
|
3067
|
-
if (this.metadata.hasSelectedNumberingPlan()) formattedNationalNumber = this.formatter.format(digits, this.state);
|
|
3068
|
-
if (formattedNationalNumber === void 0) {
|
|
3069
|
-
if (this.parser.reExtractNationalSignificantNumber(this.state)) {
|
|
3070
|
-
this.determineTheCountryIfNeeded();
|
|
3071
|
-
var nationalDigits = this.state.getNationalDigits();
|
|
3072
|
-
if (nationalDigits) formattedNationalNumber = this.formatter.format(nationalDigits, this.state);
|
|
3073
|
-
}
|
|
3074
|
-
}
|
|
3075
|
-
this.formattedOutput = formattedNationalNumber ? this.getFullNumber(formattedNationalNumber) : this.getNonFormattedNumber();
|
|
3076
|
-
}
|
|
3077
|
-
return this.formattedOutput;
|
|
3078
|
-
}
|
|
3079
|
-
},
|
|
3080
|
-
{
|
|
3081
|
-
key: "reset",
|
|
3082
|
-
value: function reset() {
|
|
3083
|
-
var _this = this;
|
|
3084
|
-
this.state = new AsYouTypeState({
|
|
3085
|
-
onCountryChange: function onCountryChange(country) {
|
|
3086
|
-
_this.country = country;
|
|
3087
|
-
},
|
|
3088
|
-
onCallingCodeChange: function onCallingCodeChange(callingCode, country) {
|
|
3089
|
-
_this.metadata.selectNumberingPlan(country, callingCode);
|
|
3090
|
-
_this.formatter.reset(_this.metadata.numberingPlan, _this.state);
|
|
3091
|
-
_this.parser.reset(_this.metadata.numberingPlan);
|
|
3092
|
-
}
|
|
3093
|
-
});
|
|
3094
|
-
this.formatter = new AsYouTypeFormatter({
|
|
3095
|
-
state: this.state,
|
|
3096
|
-
metadata: this.metadata
|
|
3097
|
-
});
|
|
3098
|
-
this.parser = new AsYouTypeParser({
|
|
3099
|
-
defaultCountry: this.defaultCountry,
|
|
3100
|
-
defaultCallingCode: this.defaultCallingCode,
|
|
3101
|
-
metadata: this.metadata,
|
|
3102
|
-
state: this.state,
|
|
3103
|
-
onNationalSignificantNumberChange: function onNationalSignificantNumberChange() {
|
|
3104
|
-
_this.determineTheCountryIfNeeded();
|
|
3105
|
-
_this.formatter.reset(_this.metadata.numberingPlan, _this.state);
|
|
3106
|
-
}
|
|
3107
|
-
});
|
|
3108
|
-
this.state.reset({
|
|
3109
|
-
country: this.defaultCountry,
|
|
3110
|
-
callingCode: this.defaultCallingCode
|
|
3111
|
-
});
|
|
3112
|
-
this.formattedOutput = "";
|
|
3113
|
-
return this;
|
|
3114
|
-
}
|
|
3115
|
-
},
|
|
3116
|
-
{
|
|
3117
|
-
key: "isInternational",
|
|
3118
|
-
value: function isInternational() {
|
|
3119
|
-
return this.state.international;
|
|
3120
|
-
}
|
|
3121
|
-
},
|
|
3122
|
-
{
|
|
3123
|
-
key: "getCallingCode",
|
|
3124
|
-
value: function getCallingCode() {
|
|
3125
|
-
if (this.isInternational()) return this.state.callingCode;
|
|
3126
|
-
}
|
|
3127
|
-
},
|
|
3128
|
-
{
|
|
3129
|
-
key: "getCountryCallingCode",
|
|
3130
|
-
value: function getCountryCallingCode() {
|
|
3131
|
-
return this.getCallingCode();
|
|
3132
|
-
}
|
|
3133
|
-
},
|
|
3134
|
-
{
|
|
3135
|
-
key: "getCountry",
|
|
3136
|
-
value: function getCountry() {
|
|
3137
|
-
if (this.state.digits) return this._getCountry();
|
|
3138
|
-
}
|
|
3139
|
-
},
|
|
3140
|
-
{
|
|
3141
|
-
key: "_getCountry",
|
|
3142
|
-
value: function _getCountry() {
|
|
3143
|
-
var country = this.state.country;
|
|
3144
|
-
/* istanbul ignore if */
|
|
3145
|
-
if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {
|
|
3146
|
-
if (country === "001") return;
|
|
3147
|
-
}
|
|
3148
|
-
return country;
|
|
3149
|
-
}
|
|
3150
|
-
},
|
|
3151
|
-
{
|
|
3152
|
-
key: "determineTheCountryIfNeeded",
|
|
3153
|
-
value: function determineTheCountryIfNeeded() {
|
|
3154
|
-
if (!this.state.country || this.isCountryCallingCodeAmbiguous()) this.determineTheCountry();
|
|
3155
|
-
}
|
|
3156
|
-
},
|
|
3157
|
-
{
|
|
3158
|
-
key: "getFullNumber",
|
|
3159
|
-
value: function getFullNumber(formattedNationalNumber) {
|
|
3160
|
-
var _this2 = this;
|
|
3161
|
-
if (this.isInternational()) {
|
|
3162
|
-
var prefix = function prefix(text) {
|
|
3163
|
-
return _this2.formatter.getInternationalPrefixBeforeCountryCallingCode(_this2.state, { spacing: text ? true : false }) + text;
|
|
3164
|
-
};
|
|
3165
|
-
var callingCode = this.state.callingCode;
|
|
3166
|
-
if (!callingCode) return prefix("".concat(this.state.getDigitsWithoutInternationalPrefix()));
|
|
3167
|
-
if (!formattedNationalNumber) return prefix(callingCode);
|
|
3168
|
-
return prefix("".concat(callingCode, " ").concat(formattedNationalNumber));
|
|
3169
|
-
}
|
|
3170
|
-
return formattedNationalNumber;
|
|
3171
|
-
}
|
|
3172
|
-
},
|
|
3173
|
-
{
|
|
3174
|
-
key: "getNonFormattedNationalNumberWithPrefix",
|
|
3175
|
-
value: function getNonFormattedNationalNumberWithPrefix() {
|
|
3176
|
-
var _this$state = this.state, nationalSignificantNumber = _this$state.nationalSignificantNumber, prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix = _this$state.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix, nationalPrefix = _this$state.nationalPrefix;
|
|
3177
|
-
var number = nationalSignificantNumber;
|
|
3178
|
-
var prefix = prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix || nationalPrefix;
|
|
3179
|
-
if (prefix) number = prefix + number;
|
|
3180
|
-
return number;
|
|
3181
|
-
}
|
|
3182
|
-
},
|
|
3183
|
-
{
|
|
3184
|
-
key: "getNonFormattedNumber",
|
|
3185
|
-
value: function getNonFormattedNumber() {
|
|
3186
|
-
var nationalSignificantNumberIsModified = this.state.nationalSignificantNumberIsModified;
|
|
3187
|
-
return this.getFullNumber(nationalSignificantNumberIsModified ? this.state.getNationalDigits() : this.getNonFormattedNationalNumberWithPrefix());
|
|
3188
|
-
}
|
|
3189
|
-
},
|
|
3190
|
-
{
|
|
3191
|
-
key: "getNonFormattedTemplate",
|
|
3192
|
-
value: function getNonFormattedTemplate() {
|
|
3193
|
-
var number = this.getNonFormattedNumber();
|
|
3194
|
-
if (number) return number.replace(/[\+\d]/g, "x");
|
|
3195
|
-
}
|
|
3196
|
-
},
|
|
3197
|
-
{
|
|
3198
|
-
key: "isCountryCallingCodeAmbiguous",
|
|
3199
|
-
value: function isCountryCallingCodeAmbiguous() {
|
|
3200
|
-
var callingCode = this.state.callingCode;
|
|
3201
|
-
var countryCodes = this.metadata.getCountryCodesForCallingCode(callingCode);
|
|
3202
|
-
return countryCodes && countryCodes.length > 1;
|
|
3203
|
-
}
|
|
3204
|
-
},
|
|
3205
|
-
{
|
|
3206
|
-
key: "determineTheCountry",
|
|
3207
|
-
value: function determineTheCountry() {
|
|
3208
|
-
this.state.setCountry(getCountryByCallingCode(this.isInternational() ? this.state.callingCode : this.defaultCallingCode, {
|
|
3209
|
-
nationalNumber: this.state.nationalSignificantNumber,
|
|
3210
|
-
metadata: this.metadata
|
|
3211
|
-
}));
|
|
3212
|
-
}
|
|
3213
|
-
},
|
|
3214
|
-
{
|
|
3215
|
-
key: "getNumberValue",
|
|
3216
|
-
value: function getNumberValue() {
|
|
3217
|
-
var _this$state2 = this.state, digits = _this$state2.digits, callingCode = _this$state2.callingCode, country = _this$state2.country, nationalSignificantNumber = _this$state2.nationalSignificantNumber;
|
|
3218
|
-
if (!digits) return;
|
|
3219
|
-
if (this.isInternational()) if (callingCode) return "+" + callingCode + nationalSignificantNumber;
|
|
3220
|
-
else return "+" + digits;
|
|
3221
|
-
else if (country || callingCode) return "+" + (country ? this.metadata.countryCallingCode() : callingCode) + nationalSignificantNumber;
|
|
3222
|
-
}
|
|
3223
|
-
},
|
|
3224
|
-
{
|
|
3225
|
-
key: "getNumber",
|
|
3226
|
-
value: function getNumber() {
|
|
3227
|
-
var _this$state3 = this.state, nationalSignificantNumber = _this$state3.nationalSignificantNumber, carrierCode = _this$state3.carrierCode, callingCode = _this$state3.callingCode;
|
|
3228
|
-
var country = this._getCountry();
|
|
3229
|
-
if (!nationalSignificantNumber) return;
|
|
3230
|
-
if (!country && !callingCode) return;
|
|
3231
|
-
if (country) {
|
|
3232
|
-
if (country === this.defaultCountry) {
|
|
3233
|
-
var metadata = new Metadata(this.metadata.metadata);
|
|
3234
|
-
metadata.selectNumberingPlan(country);
|
|
3235
|
-
var _callingCode = metadata.numberingPlan.callingCode();
|
|
3236
|
-
var ambiguousCountries = this.metadata.getCountryCodesForCallingCode(_callingCode);
|
|
3237
|
-
if (ambiguousCountries.length > 1) {
|
|
3238
|
-
var exactCountry = getCountryByNationalNumber(nationalSignificantNumber, {
|
|
3239
|
-
countries: ambiguousCountries,
|
|
3240
|
-
metadata: this.metadata.metadata
|
|
3241
|
-
});
|
|
3242
|
-
if (exactCountry) country = exactCountry;
|
|
3243
|
-
}
|
|
3244
|
-
}
|
|
3245
|
-
}
|
|
3246
|
-
var phoneNumber = new PhoneNumber(country || callingCode, nationalSignificantNumber, this.metadata.metadata);
|
|
3247
|
-
if (carrierCode) phoneNumber.carrierCode = carrierCode;
|
|
3248
|
-
return phoneNumber;
|
|
3249
|
-
}
|
|
3250
|
-
},
|
|
3251
|
-
{
|
|
3252
|
-
key: "isPossible",
|
|
3253
|
-
value: function isPossible() {
|
|
3254
|
-
var phoneNumber = this.getNumber();
|
|
3255
|
-
if (!phoneNumber) return false;
|
|
3256
|
-
return phoneNumber.isPossible();
|
|
3257
|
-
}
|
|
3258
|
-
},
|
|
3259
|
-
{
|
|
3260
|
-
key: "isValid",
|
|
3261
|
-
value: function isValid() {
|
|
3262
|
-
var phoneNumber = this.getNumber();
|
|
3263
|
-
if (!phoneNumber) return false;
|
|
3264
|
-
return phoneNumber.isValid();
|
|
3265
|
-
}
|
|
3266
|
-
},
|
|
3267
|
-
{
|
|
3268
|
-
key: "getNationalNumber",
|
|
3269
|
-
value: function getNationalNumber() {
|
|
3270
|
-
return this.state.nationalSignificantNumber;
|
|
3271
|
-
}
|
|
3272
|
-
},
|
|
3273
|
-
{
|
|
3274
|
-
key: "getChars",
|
|
3275
|
-
value: function getChars() {
|
|
3276
|
-
return (this.state.international ? "+" : "") + this.state.digits;
|
|
3277
|
-
}
|
|
3278
|
-
},
|
|
3279
|
-
{
|
|
3280
|
-
key: "getTemplate",
|
|
3281
|
-
value: function getTemplate() {
|
|
3282
|
-
return this.formatter.getTemplate(this.state) || this.getNonFormattedTemplate() || "";
|
|
3283
|
-
}
|
|
3284
|
-
}
|
|
3285
|
-
]);
|
|
3286
|
-
}();
|
|
3287
|
-
//#endregion
|
|
3288
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/es6/getExampleNumber.js
|
|
3289
|
-
function getExampleNumber$1(country, examples, metadata) {
|
|
3290
|
-
if (examples[country]) return new PhoneNumber(country, examples[country], metadata);
|
|
3291
|
-
}
|
|
3292
|
-
//#endregion
|
|
3293
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/min/exports/parsePhoneNumber.js
|
|
3294
|
-
function parsePhoneNumber() {
|
|
3295
|
-
return withMetadataArgument(parsePhoneNumber$1, arguments);
|
|
3296
|
-
}
|
|
3297
|
-
//#endregion
|
|
3298
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/min/exports/AsYouType.js
|
|
3299
|
-
function AsYouType(country) {
|
|
3300
|
-
return AsYouType$1.call(this, country, metadata_min_json_default);
|
|
3301
|
-
}
|
|
3302
|
-
AsYouType.prototype = Object.create(AsYouType$1.prototype, {});
|
|
3303
|
-
AsYouType.prototype.constructor = AsYouType;
|
|
3304
|
-
//#endregion
|
|
3305
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/min/exports/getExampleNumber.js
|
|
3306
|
-
function getExampleNumber() {
|
|
3307
|
-
return withMetadataArgument(getExampleNumber$1, arguments);
|
|
3308
|
-
}
|
|
3309
|
-
//#endregion
|
|
3310
|
-
//#region ../../node_modules/.pnpm/libphonenumber-js@1.12.31/node_modules/libphonenumber-js/examples.mobile.json.js
|
|
3311
|
-
var examples_mobile_json_default = {
|
|
3312
|
-
"AC": "40123",
|
|
3313
|
-
"AD": "312345",
|
|
3314
|
-
"AE": "501234567",
|
|
3315
|
-
"AF": "701234567",
|
|
3316
|
-
"AG": "2684641234",
|
|
3317
|
-
"AI": "2642351234",
|
|
3318
|
-
"AL": "672123456",
|
|
3319
|
-
"AM": "77123456",
|
|
3320
|
-
"AO": "923123456",
|
|
3321
|
-
"AR": "91123456789",
|
|
3322
|
-
"AS": "6847331234",
|
|
3323
|
-
"AT": "664123456",
|
|
3324
|
-
"AU": "412345678",
|
|
3325
|
-
"AW": "5601234",
|
|
3326
|
-
"AX": "412345678",
|
|
3327
|
-
"AZ": "401234567",
|
|
3328
|
-
"BA": "61123456",
|
|
3329
|
-
"BB": "2462501234",
|
|
3330
|
-
"BD": "1812345678",
|
|
3331
|
-
"BE": "470123456",
|
|
3332
|
-
"BF": "70123456",
|
|
3333
|
-
"BG": "43012345",
|
|
3334
|
-
"BH": "36001234",
|
|
3335
|
-
"BI": "79561234",
|
|
3336
|
-
"BJ": "0195123456",
|
|
3337
|
-
"BL": "690001234",
|
|
3338
|
-
"BM": "4413701234",
|
|
3339
|
-
"BN": "7123456",
|
|
3340
|
-
"BO": "71234567",
|
|
3341
|
-
"BQ": "3181234",
|
|
3342
|
-
"BR": "11961234567",
|
|
3343
|
-
"BS": "2423591234",
|
|
3344
|
-
"BT": "17123456",
|
|
3345
|
-
"BW": "71123456",
|
|
3346
|
-
"BY": "294911911",
|
|
3347
|
-
"BZ": "6221234",
|
|
3348
|
-
"CA": "5062345678",
|
|
3349
|
-
"CC": "412345678",
|
|
3350
|
-
"CD": "991234567",
|
|
3351
|
-
"CF": "70012345",
|
|
3352
|
-
"CG": "061234567",
|
|
3353
|
-
"CH": "781234567",
|
|
3354
|
-
"CI": "0123456789",
|
|
3355
|
-
"CK": "71234",
|
|
3356
|
-
"CL": "221234567",
|
|
3357
|
-
"CM": "671234567",
|
|
3358
|
-
"CN": "13123456789",
|
|
3359
|
-
"CO": "3211234567",
|
|
3360
|
-
"CR": "83123456",
|
|
3361
|
-
"CU": "51234567",
|
|
3362
|
-
"CV": "9911234",
|
|
3363
|
-
"CW": "95181234",
|
|
3364
|
-
"CX": "412345678",
|
|
3365
|
-
"CY": "96123456",
|
|
3366
|
-
"CZ": "601123456",
|
|
3367
|
-
"DE": "15123456789",
|
|
3368
|
-
"DJ": "77831001",
|
|
3369
|
-
"DK": "34412345",
|
|
3370
|
-
"DM": "7672251234",
|
|
3371
|
-
"DO": "8092345678",
|
|
3372
|
-
"DZ": "551234567",
|
|
3373
|
-
"EC": "991234567",
|
|
3374
|
-
"EE": "51234567",
|
|
3375
|
-
"EG": "1001234567",
|
|
3376
|
-
"EH": "650123456",
|
|
3377
|
-
"ER": "7123456",
|
|
3378
|
-
"ES": "612345678",
|
|
3379
|
-
"ET": "911234567",
|
|
3380
|
-
"FI": "412345678",
|
|
3381
|
-
"FJ": "7012345",
|
|
3382
|
-
"FK": "51234",
|
|
3383
|
-
"FM": "3501234",
|
|
3384
|
-
"FO": "211234",
|
|
3385
|
-
"FR": "612345678",
|
|
3386
|
-
"GA": "06031234",
|
|
3387
|
-
"GB": "7400123456",
|
|
3388
|
-
"GD": "4734031234",
|
|
3389
|
-
"GE": "555123456",
|
|
3390
|
-
"GF": "694201234",
|
|
3391
|
-
"GG": "7781123456",
|
|
3392
|
-
"GH": "231234567",
|
|
3393
|
-
"GI": "57123456",
|
|
3394
|
-
"GL": "221234",
|
|
3395
|
-
"GM": "3012345",
|
|
3396
|
-
"GN": "601123456",
|
|
3397
|
-
"GP": "690001234",
|
|
3398
|
-
"GQ": "222123456",
|
|
3399
|
-
"GR": "6912345678",
|
|
3400
|
-
"GT": "51234567",
|
|
3401
|
-
"GU": "6713001234",
|
|
3402
|
-
"GW": "955012345",
|
|
3403
|
-
"GY": "6091234",
|
|
3404
|
-
"HK": "51234567",
|
|
3405
|
-
"HN": "91234567",
|
|
3406
|
-
"HR": "921234567",
|
|
3407
|
-
"HT": "34101234",
|
|
3408
|
-
"HU": "201234567",
|
|
3409
|
-
"ID": "812345678",
|
|
3410
|
-
"IE": "850123456",
|
|
3411
|
-
"IL": "502345678",
|
|
3412
|
-
"IM": "7924123456",
|
|
3413
|
-
"IN": "8123456789",
|
|
3414
|
-
"IO": "3801234",
|
|
3415
|
-
"IQ": "7912345678",
|
|
3416
|
-
"IR": "9123456789",
|
|
3417
|
-
"IS": "6111234",
|
|
3418
|
-
"IT": "3123456789",
|
|
3419
|
-
"JE": "7797712345",
|
|
3420
|
-
"JM": "8762101234",
|
|
3421
|
-
"JO": "790123456",
|
|
3422
|
-
"JP": "9012345678",
|
|
3423
|
-
"KE": "712123456",
|
|
3424
|
-
"KG": "700123456",
|
|
3425
|
-
"KH": "91234567",
|
|
3426
|
-
"KI": "72001234",
|
|
3427
|
-
"KM": "3212345",
|
|
3428
|
-
"KN": "8697652917",
|
|
3429
|
-
"KP": "1921234567",
|
|
3430
|
-
"KR": "1020000000",
|
|
3431
|
-
"KW": "50012345",
|
|
3432
|
-
"KY": "3453231234",
|
|
3433
|
-
"KZ": "7710009998",
|
|
3434
|
-
"LA": "2023123456",
|
|
3435
|
-
"LB": "71123456",
|
|
3436
|
-
"LC": "7582845678",
|
|
3437
|
-
"LI": "660234567",
|
|
3438
|
-
"LK": "712345678",
|
|
3439
|
-
"LR": "770123456",
|
|
3440
|
-
"LS": "50123456",
|
|
3441
|
-
"LT": "61234567",
|
|
3442
|
-
"LU": "628123456",
|
|
3443
|
-
"LV": "21234567",
|
|
3444
|
-
"LY": "912345678",
|
|
3445
|
-
"MA": "650123456",
|
|
3446
|
-
"MC": "612345678",
|
|
3447
|
-
"MD": "62112345",
|
|
3448
|
-
"ME": "60123456",
|
|
3449
|
-
"MF": "690001234",
|
|
3450
|
-
"MG": "321234567",
|
|
3451
|
-
"MH": "2351234",
|
|
3452
|
-
"MK": "72345678",
|
|
3453
|
-
"ML": "65012345",
|
|
3454
|
-
"MM": "92123456",
|
|
3455
|
-
"MN": "88123456",
|
|
3456
|
-
"MO": "66123456",
|
|
3457
|
-
"MP": "6702345678",
|
|
3458
|
-
"MQ": "696201234",
|
|
3459
|
-
"MR": "22123456",
|
|
3460
|
-
"MS": "6644923456",
|
|
3461
|
-
"MT": "96961234",
|
|
3462
|
-
"MU": "52512345",
|
|
3463
|
-
"MV": "7712345",
|
|
3464
|
-
"MW": "991234567",
|
|
3465
|
-
"MX": "2221234567",
|
|
3466
|
-
"MY": "123456789",
|
|
3467
|
-
"MZ": "821234567",
|
|
3468
|
-
"NA": "811234567",
|
|
3469
|
-
"NC": "751234",
|
|
3470
|
-
"NE": "93123456",
|
|
3471
|
-
"NF": "381234",
|
|
3472
|
-
"NG": "8021234567",
|
|
3473
|
-
"NI": "81234567",
|
|
3474
|
-
"NL": "612345678",
|
|
3475
|
-
"NO": "40612345",
|
|
3476
|
-
"NP": "9841234567",
|
|
3477
|
-
"NR": "5551234",
|
|
3478
|
-
"NU": "8884012",
|
|
3479
|
-
"NZ": "211234567",
|
|
3480
|
-
"OM": "92123456",
|
|
3481
|
-
"PA": "61234567",
|
|
3482
|
-
"PE": "912345678",
|
|
3483
|
-
"PF": "87123456",
|
|
3484
|
-
"PG": "70123456",
|
|
3485
|
-
"PH": "9051234567",
|
|
3486
|
-
"PK": "3012345678",
|
|
3487
|
-
"PL": "512345678",
|
|
3488
|
-
"PM": "551234",
|
|
3489
|
-
"PR": "7872345678",
|
|
3490
|
-
"PS": "599123456",
|
|
3491
|
-
"PT": "912345678",
|
|
3492
|
-
"PW": "6201234",
|
|
3493
|
-
"PY": "961456789",
|
|
3494
|
-
"QA": "33123456",
|
|
3495
|
-
"RE": "692123456",
|
|
3496
|
-
"RO": "712034567",
|
|
3497
|
-
"RS": "601234567",
|
|
3498
|
-
"RU": "9123456789",
|
|
3499
|
-
"RW": "720123456",
|
|
3500
|
-
"SA": "512345678",
|
|
3501
|
-
"SB": "7421234",
|
|
3502
|
-
"SC": "2510123",
|
|
3503
|
-
"SD": "911231234",
|
|
3504
|
-
"SE": "701234567",
|
|
3505
|
-
"SG": "81234567",
|
|
3506
|
-
"SH": "51234",
|
|
3507
|
-
"SI": "31234567",
|
|
3508
|
-
"SJ": "41234567",
|
|
3509
|
-
"SK": "912123456",
|
|
3510
|
-
"SL": "25123456",
|
|
3511
|
-
"SM": "66661212",
|
|
3512
|
-
"SN": "701234567",
|
|
3513
|
-
"SO": "71123456",
|
|
3514
|
-
"SR": "7412345",
|
|
3515
|
-
"SS": "977123456",
|
|
3516
|
-
"ST": "9812345",
|
|
3517
|
-
"SV": "70123456",
|
|
3518
|
-
"SX": "7215205678",
|
|
3519
|
-
"SY": "944567890",
|
|
3520
|
-
"SZ": "76123456",
|
|
3521
|
-
"TA": "8999",
|
|
3522
|
-
"TC": "6492311234",
|
|
3523
|
-
"TD": "63012345",
|
|
3524
|
-
"TG": "90112345",
|
|
3525
|
-
"TH": "812345678",
|
|
3526
|
-
"TJ": "917123456",
|
|
3527
|
-
"TK": "7290",
|
|
3528
|
-
"TL": "77212345",
|
|
3529
|
-
"TM": "66123456",
|
|
3530
|
-
"TN": "20123456",
|
|
3531
|
-
"TO": "7715123",
|
|
3532
|
-
"TR": "5012345678",
|
|
3533
|
-
"TT": "8682911234",
|
|
3534
|
-
"TV": "901234",
|
|
3535
|
-
"TW": "912345678",
|
|
3536
|
-
"TZ": "621234567",
|
|
3537
|
-
"UA": "501234567",
|
|
3538
|
-
"UG": "712345678",
|
|
3539
|
-
"US": "2015550123",
|
|
3540
|
-
"UY": "94231234",
|
|
3541
|
-
"UZ": "912345678",
|
|
3542
|
-
"VA": "3123456789",
|
|
3543
|
-
"VC": "7844301234",
|
|
3544
|
-
"VE": "4121234567",
|
|
3545
|
-
"VG": "2843001234",
|
|
3546
|
-
"VI": "3406421234",
|
|
3547
|
-
"VN": "912345678",
|
|
3548
|
-
"VU": "5912345",
|
|
3549
|
-
"WF": "821234",
|
|
3550
|
-
"WS": "7212345",
|
|
3551
|
-
"XK": "43201234",
|
|
3552
|
-
"YE": "712345678",
|
|
3553
|
-
"YT": "639012345",
|
|
3554
|
-
"ZA": "711234567",
|
|
3555
|
-
"ZM": "955123456",
|
|
3556
|
-
"ZW": "712345678"
|
|
3557
|
-
};
|
|
3558
|
-
//#endregion
|
|
3559
|
-
//#region src/shared/phoneInputComposed/phoneInputComposed.tsx
|
|
3560
|
-
function formatNationalNumber(nationalDigits, callingCode, code) {
|
|
3561
|
-
return new AsYouType(code).input(`${callingCode}${nationalDigits}`).replace(callingCode, "").trimStart();
|
|
3562
|
-
}
|
|
3563
|
-
function stripTrunkPrefix(formatted, nationalNumber) {
|
|
3564
|
-
const formattedDigits = formatted.replace(/\D/g, "");
|
|
3565
|
-
if (formattedDigits === nationalNumber) return formatted;
|
|
3566
|
-
if (!formattedDigits.endsWith(nationalNumber)) return null;
|
|
3567
|
-
const trunkLen = formattedDigits.length - nationalNumber.length;
|
|
3568
|
-
if (trunkLen <= 0) return formatted;
|
|
3569
|
-
const bare = formatted.replace(/[()]/g, "");
|
|
3570
|
-
let digitsSeen = 0;
|
|
3571
|
-
for (let i = 0; i < bare.length; i++) if (/\d/.test(bare[i])) {
|
|
3572
|
-
digitsSeen++;
|
|
3573
|
-
if (digitsSeen === trunkLen) return bare.slice(i + 1).replace(/^\D+/, "");
|
|
3574
|
-
}
|
|
3575
|
-
return formatted;
|
|
3576
|
-
}
|
|
3577
|
-
var HARDCODED_PLACEHOLDERS = {
|
|
3578
|
-
US: "(123) 456-7890",
|
|
3579
|
-
CA: "(123) 456-7890"
|
|
3580
|
-
};
|
|
3581
|
-
function getPhonePlaceholder(code) {
|
|
3582
|
-
const hardcoded = HARDCODED_PLACEHOLDERS[code];
|
|
3583
|
-
if (hardcoded) return hardcoded;
|
|
3584
|
-
const example = getExampleNumber(code, examples_mobile_json_default);
|
|
3585
|
-
if (!example) return "";
|
|
3586
|
-
const stripped = stripTrunkPrefix(example.formatNational(), example.nationalNumber);
|
|
3587
|
-
if (stripped) return stripped;
|
|
3588
|
-
const callingCode = `+${getCountryCallingCode$1(code)}`;
|
|
3589
|
-
return formatNationalNumber(example.nationalNumber, callingCode, code);
|
|
3590
|
-
}
|
|
3591
|
-
var PhoneInputComposed = D(({ id, label, labelHint, countryCode = "US", value, placeholder, error, showFormatHintInError = false, helper, showErrorIcon, showHelperIcon, disabled = false, disableCountrySelector = false, required, onChange, formatHintBuilder, countryAriaLabelBuilder, "aria-labelledby": ariaLabelledBy, "data-testid": dataTestId, ...restProps }, ref) => {
|
|
3592
|
-
const [selectedCountryCode, setSelectedCountryCode] = d(countryCode);
|
|
3593
|
-
const [localPhone, setLocalPhone] = d("");
|
|
3594
|
-
const initialised = A(false);
|
|
3595
|
-
const dropdownOptions = T(() => countries.map((c) => ({
|
|
3596
|
-
value: c.code,
|
|
3597
|
-
label: `${c.emoji} ${c.callingCode} ${c.name}`,
|
|
3598
|
-
ariaLabel: `${c.callingCode} ${c.name}`
|
|
3599
|
-
})), []);
|
|
3600
|
-
const selectedCountry = T(() => getCountryByCode(selectedCountryCode) ?? getCountryByCode("US"), [selectedCountryCode]);
|
|
3601
|
-
const effectivePlaceholder = T(() => placeholder ?? getPhonePlaceholder(selectedCountryCode), [placeholder, selectedCountryCode]);
|
|
3602
|
-
const formatHintId = `${id}-phone-format-hint`;
|
|
3603
|
-
const formatHintText = T(() => formatHintBuilder?.(effectivePlaceholder), [formatHintBuilder, effectivePlaceholder]);
|
|
3604
|
-
const formatHintTextForSr = T(() => formatHintText?.replace(/\d/g, "$& ").trim(), [formatHintText]);
|
|
3605
|
-
const showStandaloneFormatHint = !error && !!formatHintText;
|
|
3606
|
-
const showErrorFormatHint = showFormatHintInError && !!error && !!formatHintText;
|
|
3607
|
-
y(() => {
|
|
3608
|
-
if (initialised.current || !value || !selectedCountry) return;
|
|
3609
|
-
initialised.current = true;
|
|
3610
|
-
const parsed = parsePhoneNumber(value.startsWith("+") ? value : `+${value}`);
|
|
3611
|
-
if (parsed?.isValid() && parsed.country) {
|
|
3612
|
-
if (parsed.country !== selectedCountryCode) setSelectedCountryCode(parsed.country);
|
|
3613
|
-
setLocalPhone(new AsYouType(parsed.country).input(parsed.nationalNumber));
|
|
3614
|
-
}
|
|
3615
|
-
}, [
|
|
3616
|
-
value,
|
|
3617
|
-
selectedCountry,
|
|
3618
|
-
selectedCountryCode
|
|
3619
|
-
]);
|
|
3620
|
-
const validateAndNotify = q((rawDigits, country) => {
|
|
3621
|
-
const full = `${country.callingCode}${rawDigits.replace(/\D/g, "")}`;
|
|
3622
|
-
try {
|
|
3623
|
-
const parsed = parsePhoneNumber(full, country.code);
|
|
3624
|
-
onChange?.(full, parsed?.isValid() ?? false);
|
|
3625
|
-
} catch {
|
|
3626
|
-
onChange?.(full, false);
|
|
3627
|
-
}
|
|
3628
|
-
}, [onChange]);
|
|
3629
|
-
const handleCountryChange = q((newCode) => {
|
|
3630
|
-
setSelectedCountryCode(newCode);
|
|
3631
|
-
const country = getCountryByCode(newCode);
|
|
3632
|
-
if (country && localPhone) validateAndNotify(localPhone, country);
|
|
3633
|
-
}, [localPhone, validateAndNotify]);
|
|
3634
|
-
const handlePhoneInput = q((e) => {
|
|
3635
|
-
const raw = e.target.value;
|
|
3636
|
-
if (!selectedCountry) {
|
|
3637
|
-
setLocalPhone(raw);
|
|
3638
|
-
return;
|
|
3639
|
-
}
|
|
3640
|
-
setLocalPhone(formatNationalNumber(raw, selectedCountry.callingCode, selectedCountry.code));
|
|
3641
|
-
validateAndNotify(raw, selectedCountry);
|
|
3642
|
-
}, [selectedCountry, validateAndNotify]);
|
|
3643
|
-
const countryDropdownId = `${id}-country`;
|
|
3644
|
-
const phoneInputId = `${id}-phone`;
|
|
3645
|
-
const helperId = `${phoneInputId}-helper`;
|
|
3646
|
-
const errorId = `${phoneInputId}-error`;
|
|
3647
|
-
const describedByIds = [
|
|
3648
|
-
showStandaloneFormatHint ? formatHintId : null,
|
|
3649
|
-
helper ? helperId : null,
|
|
3650
|
-
error ? errorId : null
|
|
3651
|
-
].filter(Boolean).join(" ");
|
|
3652
|
-
return /* @__PURE__ */ u("div", {
|
|
3653
|
-
class: "IncodePhoneInputComposed",
|
|
3654
|
-
children: [
|
|
3655
|
-
label && /* @__PURE__ */ u("label", {
|
|
3656
|
-
class: "IncodePhoneInputComposedLabel",
|
|
3657
|
-
htmlFor: phoneInputId,
|
|
3658
|
-
"data-testid": `${id}-label`,
|
|
3659
|
-
children: [label, /* @__PURE__ */ u(FieldLabelHint, {
|
|
3660
|
-
className: "IncodePhoneInputComposedLabelHint",
|
|
3661
|
-
hint: labelHint,
|
|
3662
|
-
required,
|
|
3663
|
-
testId: `${id}-label-hint`
|
|
3664
|
-
})]
|
|
3665
|
-
}),
|
|
3666
|
-
/* @__PURE__ */ u(DropdownComposed, {
|
|
3667
|
-
id: countryDropdownId,
|
|
3668
|
-
options: dropdownOptions,
|
|
3669
|
-
value: selectedCountryCode,
|
|
3670
|
-
onChange: handleCountryChange,
|
|
3671
|
-
disabled: disabled || disableCountrySelector,
|
|
3672
|
-
required,
|
|
3673
|
-
searchable: true,
|
|
3674
|
-
searchPlaceholder: "Search countries...",
|
|
3675
|
-
suppressMessages: true,
|
|
3676
|
-
"aria-label": countryAriaLabelBuilder?.({
|
|
3677
|
-
callingCode: selectedCountry.callingCode,
|
|
3678
|
-
countryName: selectedCountry.name
|
|
3679
|
-
}) ?? `Country code ${selectedCountry.callingCode}, ${selectedCountry.name}`,
|
|
3680
|
-
renderSelectedLabel: (option) => {
|
|
3681
|
-
const c = getCountryByCode(option.value);
|
|
3682
|
-
return c ? `${c.emoji} ${c.callingCode}` : option.label;
|
|
3683
|
-
},
|
|
3684
|
-
"data-testid": `${countryDropdownId}-selector`,
|
|
3685
|
-
class: "IncodePhoneInputComposedDropdown",
|
|
3686
|
-
siblingElement: /* @__PURE__ */ u(InputComposed, {
|
|
3687
|
-
id: phoneInputId,
|
|
3688
|
-
ref,
|
|
3689
|
-
type: "tel",
|
|
3690
|
-
value: localPhone,
|
|
3691
|
-
onInput: handlePhoneInput,
|
|
3692
|
-
placeholder: effectivePlaceholder,
|
|
3693
|
-
error,
|
|
3694
|
-
disabled,
|
|
3695
|
-
required,
|
|
3696
|
-
suppressMessages: true,
|
|
3697
|
-
"aria-label": !label ? "Phone number" : void 0,
|
|
3698
|
-
"aria-labelledby": ariaLabelledBy,
|
|
3699
|
-
"aria-describedby": describedByIds || void 0,
|
|
3700
|
-
"aria-invalid": error ? "true" : void 0,
|
|
3701
|
-
"data-testid": dataTestId,
|
|
3702
|
-
...restProps
|
|
3703
|
-
})
|
|
3704
|
-
}),
|
|
3705
|
-
showStandaloneFormatHint && /* @__PURE__ */ u("span", {
|
|
3706
|
-
id: formatHintId,
|
|
3707
|
-
class: "IncodeSrOnly",
|
|
3708
|
-
"data-testid": `${id}-format-hint`,
|
|
3709
|
-
children: formatHintTextForSr
|
|
3710
|
-
}),
|
|
3711
|
-
error && /* @__PURE__ */ u("div", {
|
|
3712
|
-
class: "IncodePhoneInputComposedErrorWrapper",
|
|
3713
|
-
role: "alert",
|
|
3714
|
-
"data-testid": `${id}-error-wrapper`,
|
|
3715
|
-
children: [showErrorIcon && /* @__PURE__ */ u("div", {
|
|
3716
|
-
class: "IncodePhoneInputComposedIconWrapper",
|
|
3717
|
-
children: /* @__PURE__ */ u(ErrorIcon, { size: 16 })
|
|
3718
|
-
}), /* @__PURE__ */ u("p", {
|
|
3719
|
-
id: errorId,
|
|
3720
|
-
class: "IncodePhoneInputComposedError",
|
|
3721
|
-
children: [error, showErrorFormatHint && /* @__PURE__ */ u(k, { children: [
|
|
3722
|
-
" ",
|
|
3723
|
-
/* @__PURE__ */ u("span", {
|
|
3724
|
-
"aria-hidden": "true",
|
|
3725
|
-
children: formatHintText
|
|
3726
|
-
}),
|
|
3727
|
-
/* @__PURE__ */ u("span", {
|
|
3728
|
-
class: "IncodeSrOnly",
|
|
3729
|
-
children: formatHintTextForSr
|
|
3730
|
-
})
|
|
3731
|
-
] })]
|
|
3732
|
-
})]
|
|
3733
|
-
}),
|
|
3734
|
-
helper && !error && /* @__PURE__ */ u("div", {
|
|
3735
|
-
class: "IncodePhoneInputComposedHelperWrapper",
|
|
3736
|
-
"data-testid": `${id}-helper-wrapper`,
|
|
3737
|
-
children: [showHelperIcon && /* @__PURE__ */ u("div", {
|
|
3738
|
-
class: "IncodePhoneInputComposedIconWrapper",
|
|
3739
|
-
children: /* @__PURE__ */ u(SuccessIcon, { size: 16 })
|
|
3740
|
-
}), /* @__PURE__ */ u("p", {
|
|
3741
|
-
id: helperId,
|
|
3742
|
-
class: "IncodePhoneInputComposedHelper",
|
|
3743
|
-
children: helper
|
|
3744
|
-
})]
|
|
3745
|
-
})
|
|
3746
|
-
]
|
|
3747
|
-
});
|
|
3748
|
-
});
|
|
3749
|
-
PhoneInputComposed.displayName = "PhoneInputComposed";
|
|
3750
|
-
//#endregion
|
|
3751
|
-
export { PhoneInputComposed as t };
|