@rpcbase/ui 0.207.0 → 0.208.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/dist/index.js +7 -7
  2. package/dist/index19.js +1 -1
  3. package/dist/index19.js.map +1 -1
  4. package/dist/index200.js +56 -55
  5. package/dist/index200.js.map +1 -1
  6. package/dist/index201.js +60 -8
  7. package/dist/index201.js.map +1 -1
  8. package/dist/index202.js +7 -15
  9. package/dist/index202.js.map +1 -1
  10. package/dist/index203.js +15 -143
  11. package/dist/index203.js.map +1 -1
  12. package/dist/index204.js +145 -4
  13. package/dist/index204.js.map +1 -1
  14. package/dist/index205.js +4 -11
  15. package/dist/index205.js.map +1 -1
  16. package/dist/index206.js +10 -104
  17. package/dist/index206.js.map +1 -1
  18. package/dist/index207.js +94 -347
  19. package/dist/index207.js.map +1 -1
  20. package/dist/index208.js +349 -87
  21. package/dist/index208.js.map +1 -1
  22. package/dist/index209.js +73 -304
  23. package/dist/index209.js.map +1 -1
  24. package/dist/index210.js +309 -193
  25. package/dist/index210.js.map +1 -1
  26. package/dist/index211.js +211 -19
  27. package/dist/index211.js.map +1 -1
  28. package/dist/index212.js +18 -27
  29. package/dist/index212.js.map +1 -1
  30. package/dist/index213.js +27 -187
  31. package/dist/index213.js.map +1 -1
  32. package/dist/index214.js +186 -16
  33. package/dist/index214.js.map +1 -1
  34. package/dist/index215.js +18 -44
  35. package/dist/index215.js.map +1 -1
  36. package/dist/index216.js +60 -8
  37. package/dist/index216.js.map +1 -1
  38. package/dist/index217.js +42 -23
  39. package/dist/index217.js.map +1 -1
  40. package/dist/index218.js +9 -44
  41. package/dist/index218.js.map +1 -1
  42. package/dist/index219.js +25 -18
  43. package/dist/index219.js.map +1 -1
  44. package/dist/index220.js +45 -3
  45. package/dist/index220.js.map +1 -1
  46. package/dist/index221.js +17 -4
  47. package/dist/index221.js.map +1 -1
  48. package/dist/index222.js +3 -21
  49. package/dist/index222.js.map +1 -1
  50. package/dist/index223.js +4 -24
  51. package/dist/index223.js.map +1 -1
  52. package/dist/index224.js +17 -64
  53. package/dist/index224.js.map +1 -1
  54. package/dist/index225.js +23 -13
  55. package/dist/index225.js.map +1 -1
  56. package/dist/index226.js +68 -4
  57. package/dist/index226.js.map +1 -1
  58. package/dist/index227.js +14 -50
  59. package/dist/index227.js.map +1 -1
  60. package/dist/index228.js +4 -6
  61. package/dist/index228.js.map +1 -1
  62. package/dist/index229.js +50 -26
  63. package/dist/index229.js.map +1 -1
  64. package/dist/index230.js +5 -13
  65. package/dist/index230.js.map +1 -1
  66. package/dist/index231.js +25 -8
  67. package/dist/index231.js.map +1 -1
  68. package/dist/index232.js +17 -3
  69. package/dist/index232.js.map +1 -0
  70. package/dist/index233.js +8 -24
  71. package/dist/index233.js.map +1 -1
  72. package/dist/index234.js +2 -71
  73. package/dist/index235.js +29 -3
  74. package/dist/index235.js.map +1 -0
  75. package/dist/index236.js +69 -12
  76. package/dist/index236.js.map +1 -1
  77. package/dist/index237.js +3 -54
  78. package/dist/index238.js +11 -114
  79. package/dist/index238.js.map +1 -1
  80. package/dist/index239.js +51 -6
  81. package/dist/index239.js.map +1 -1
  82. package/dist/index240.js +115 -13
  83. package/dist/index240.js.map +1 -1
  84. package/dist/index241.js +6 -687
  85. package/dist/index241.js.map +1 -1
  86. package/dist/index242.js +13 -253
  87. package/dist/index242.js.map +1 -1
  88. package/dist/index243.js +662 -676
  89. package/dist/index243.js.map +1 -1
  90. package/dist/index244.js +252 -7430
  91. package/dist/index244.js.map +1 -1
  92. package/dist/index245.js +700 -6
  93. package/dist/index245.js.map +1 -1
  94. package/dist/index246.js +7429 -11
  95. package/dist/index246.js.map +1 -1
  96. package/dist/index247.js +5 -4
  97. package/dist/index247.js.map +1 -1
  98. package/dist/index248.js +11 -458
  99. package/dist/index248.js.map +1 -1
  100. package/dist/index249.js +5 -37
  101. package/dist/index249.js.map +1 -1
  102. package/dist/index250.js +458 -18
  103. package/dist/index250.js.map +1 -1
  104. package/dist/index251.js +34 -24
  105. package/dist/index251.js.map +1 -1
  106. package/dist/index252.js +19 -4
  107. package/dist/index252.js.map +1 -1
  108. package/dist/index253.js +23 -54
  109. package/dist/index253.js.map +1 -1
  110. package/dist/index254.js +4 -7
  111. package/dist/index254.js.map +1 -1
  112. package/dist/index255.js +57 -11
  113. package/dist/index255.js.map +1 -1
  114. package/dist/index256.js +8 -3
  115. package/dist/index256.js.map +1 -1
  116. package/dist/index257.js +12 -16
  117. package/dist/index257.js.map +1 -1
  118. package/dist/index258.js +3 -26
  119. package/dist/index258.js.map +1 -1
  120. package/dist/index259.js +15 -42
  121. package/dist/index259.js.map +1 -1
  122. package/dist/index260.js +25 -13
  123. package/dist/index260.js.map +1 -1
  124. package/dist/index261.js +40 -22
  125. package/dist/index261.js.map +1 -1
  126. package/dist/index262.js +13 -17
  127. package/dist/index262.js.map +1 -1
  128. package/dist/index263.js +24 -34
  129. package/dist/index263.js.map +1 -1
  130. package/dist/index264.js +17 -5
  131. package/dist/index264.js.map +1 -1
  132. package/dist/index265.js +35 -9
  133. package/dist/index265.js.map +1 -1
  134. package/dist/index266.js +5 -8
  135. package/dist/index266.js.map +1 -1
  136. package/dist/index267.js +9 -9
  137. package/dist/index267.js.map +1 -1
  138. package/dist/index268.js +8 -10
  139. package/dist/index268.js.map +1 -1
  140. package/dist/index269.js +9 -7
  141. package/dist/index269.js.map +1 -1
  142. package/dist/index270.js +9 -72
  143. package/dist/index270.js.map +1 -1
  144. package/dist/index271.js +7 -171
  145. package/dist/index271.js.map +1 -1
  146. package/dist/index272.js +63 -104
  147. package/dist/index272.js.map +1 -1
  148. package/dist/index273.js +169 -12
  149. package/dist/index273.js.map +1 -1
  150. package/dist/index274.js +109 -75
  151. package/dist/index274.js.map +1 -1
  152. package/dist/index275.js +12 -44
  153. package/dist/index275.js.map +1 -1
  154. package/dist/index276.js +79 -12
  155. package/dist/index276.js.map +1 -1
  156. package/dist/index277.js +45 -15
  157. package/dist/index277.js.map +1 -1
  158. package/dist/index278.js +12 -98
  159. package/dist/index278.js.map +1 -1
  160. package/dist/index279.js +15 -55
  161. package/dist/index279.js.map +1 -1
  162. package/dist/index280.js +89 -98
  163. package/dist/index280.js.map +1 -1
  164. package/dist/index281.js +27 -42
  165. package/dist/index281.js.map +1 -1
  166. package/dist/index282.js +92 -97
  167. package/dist/index282.js.map +1 -1
  168. package/dist/index283.js +62 -46
  169. package/dist/index283.js.map +1 -1
  170. package/dist/index284.js +108 -38
  171. package/dist/index284.js.map +1 -1
  172. package/dist/index285.js +48 -135
  173. package/dist/index285.js.map +1 -1
  174. package/dist/index286.js +43 -139
  175. package/dist/index286.js.map +1 -1
  176. package/dist/index287.js +105 -217
  177. package/dist/index287.js.map +1 -1
  178. package/dist/index288.js +109 -210
  179. package/dist/index288.js.map +1 -1
  180. package/dist/index289.js +168 -212
  181. package/dist/index289.js.map +1 -1
  182. package/dist/index290.js +240 -5
  183. package/dist/index290.js.map +1 -1
  184. package/dist/index291.js +298 -6
  185. package/dist/index291.js.map +1 -1
  186. package/dist/index292.js +5 -7
  187. package/dist/index292.js.map +1 -1
  188. package/dist/index293.js +4 -4
  189. package/dist/index293.js.map +1 -1
  190. package/dist/index294.js +7 -6
  191. package/dist/index294.js.map +1 -1
  192. package/dist/index295.js +6 -21
  193. package/dist/index295.js.map +1 -1
  194. package/dist/index296.js +6 -10
  195. package/dist/index296.js.map +1 -1
  196. package/dist/index297.js +18 -123
  197. package/dist/index297.js.map +1 -1
  198. package/dist/index298.js +10 -164
  199. package/dist/index298.js.map +1 -1
  200. package/dist/index299.js +116 -58
  201. package/dist/index299.js.map +1 -1
  202. package/dist/index300.js +161 -106
  203. package/dist/index300.js.map +1 -1
  204. package/dist/index301.js +66 -489
  205. package/dist/index301.js.map +1 -1
  206. package/dist/index302.js +106 -59
  207. package/dist/index302.js.map +1 -1
  208. package/dist/index303.js +492 -4
  209. package/dist/index303.js.map +1 -1
  210. package/dist/index304.js +62 -27
  211. package/dist/index304.js.map +1 -1
  212. package/dist/index305.js +4 -66
  213. package/dist/index305.js.map +1 -1
  214. package/dist/index306.js +27 -152
  215. package/dist/index306.js.map +1 -1
  216. package/dist/index307.js +59 -555
  217. package/dist/index307.js.map +1 -1
  218. package/dist/index308.js +143 -201
  219. package/dist/index308.js.map +1 -1
  220. package/dist/index309.js +56 -326
  221. package/dist/index309.js.map +1 -1
  222. package/dist/index310.js +553 -260
  223. package/dist/index310.js.map +1 -1
  224. package/dist/index311.js +214 -0
  225. package/dist/index311.js.map +1 -0
  226. package/dist/index312.js +335 -0
  227. package/dist/index312.js.map +1 -0
  228. package/dist/index313.js +272 -0
  229. package/dist/index313.js.map +1 -0
  230. package/package.json +2 -2
  231. package/dist/index234.js.map +0 -1
  232. package/dist/index237.js.map +0 -1
package/dist/index289.js CHANGED
@@ -1,302 +1,258 @@
1
- import e from "./index247.js";
2
- import { Metadata as t } from "./index248.js";
3
- import n from "./index259.js";
4
- import r from "./index260.js";
5
- import { PhoneNumber as i } from "./index271.js";
6
- import { AsYouTypeState as a } from "./index282.js";
7
- import { AsYouTypeFormatter as o } from "./index287.js";
8
- import { AsYouTypeParser as s } from "./index288.js";
9
- //#region ../../node_modules/libphonenumber-js/es6/AsYouType.js
10
- function c(e) {
1
+ import { VALID_PUNCTUATION as e } from "./index258.js";
2
+ import t from "./index266.js";
3
+ import { FIRST_GROUP_PATTERN as n } from "./index267.js";
4
+ import r from "./index276.js";
5
+ import { cutAndStripNonPairedParens as i, populateTemplateWithDigits as a, repeat as o } from "./index285.js";
6
+ import s, { canFormatCompleteNumber as c } from "./index286.js";
7
+ import { PatternMatcher as l } from "./index288.js";
8
+ //#region ../../node_modules/libphonenumber-js/es6/AsYouTypeFormatter.js
9
+ function u(e) {
11
10
  "@babel/helpers - typeof";
12
- return c = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
11
+ return u = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
13
12
  return typeof e;
14
13
  } : function(e) {
15
14
  return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
16
- }, c(e);
17
- }
18
- function l(e, t) {
19
- return m(e) || p(e, t) || d(e, t) || u();
20
- }
21
- function u() {
22
- throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
15
+ }, u(e);
23
16
  }
24
17
  function d(e, t) {
18
+ var n = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
19
+ if (n) return (n = n.call(e)).next.bind(n);
20
+ if (Array.isArray(e) || (n = f(e)) || t && e && typeof e.length == "number") {
21
+ n && (e = n);
22
+ var r = 0;
23
+ return function() {
24
+ return r >= e.length ? { done: !0 } : {
25
+ done: !1,
26
+ value: e[r++]
27
+ };
28
+ };
29
+ }
30
+ throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
31
+ }
32
+ function f(e, t) {
25
33
  if (e) {
26
- if (typeof e == "string") return f(e, t);
34
+ if (typeof e == "string") return p(e, t);
27
35
  var n = {}.toString.call(e).slice(8, -1);
28
- return n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set" ? Array.from(e) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? f(e, t) : void 0;
36
+ return n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set" ? Array.from(e) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? p(e, t) : void 0;
29
37
  }
30
38
  }
31
- function f(e, t) {
39
+ function p(e, t) {
32
40
  (t == null || t > e.length) && (t = e.length);
33
41
  for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
34
42
  return r;
35
43
  }
36
- function p(e, t) {
37
- var n = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
38
- if (n != null) {
39
- var r, i, a, o, s = [], c = !0, l = !1;
40
- try {
41
- if (a = (n = n.call(e)).next, t === 0) {
42
- if (Object(n) !== n) return;
43
- c = !1;
44
- } else for (; !(c = (r = a.call(n)).done) && (s.push(r.value), s.length !== t); c = !0);
45
- } catch (e) {
46
- l = !0, i = e;
47
- } finally {
48
- try {
49
- if (!c && n.return != null && (o = n.return(), Object(o) !== o)) return;
50
- } finally {
51
- if (l) throw i;
52
- }
53
- }
54
- return s;
55
- }
56
- }
57
- function m(e) {
58
- if (Array.isArray(e)) return e;
59
- }
60
- function h(e, t) {
44
+ function m(e, t) {
61
45
  if (!(e instanceof t)) throw TypeError("Cannot call a class as a function");
62
46
  }
63
- function g(e, t) {
47
+ function h(e, t) {
64
48
  for (var n = 0; n < t.length; n++) {
65
49
  var r = t[n];
66
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, v(r.key), r);
50
+ r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, _(r.key), r);
67
51
  }
68
52
  }
69
- function _(e, t, n) {
70
- return t && g(e.prototype, t), n && g(e, n), Object.defineProperty(e, "prototype", { writable: !1 }), e;
53
+ function g(e, t, n) {
54
+ return t && h(e.prototype, t), n && h(e, n), Object.defineProperty(e, "prototype", { writable: !1 }), e;
71
55
  }
72
- function v(e) {
73
- var t = y(e, "string");
74
- return c(t) == "symbol" ? t : t + "";
56
+ function _(e) {
57
+ var t = v(e, "string");
58
+ return u(t) == "symbol" ? t : t + "";
75
59
  }
76
- function y(e, t) {
77
- if (c(e) != "object" || !e) return e;
60
+ function v(e, t) {
61
+ if (u(e) != "object" || !e) return e;
78
62
  var n = e[Symbol.toPrimitive];
79
63
  if (n !== void 0) {
80
64
  var r = n.call(e, t || "default");
81
- if (c(r) != "object") return r;
65
+ if (u(r) != "object") return r;
82
66
  throw TypeError("@@toPrimitive must return a primitive value.");
83
67
  }
84
68
  return (t === "string" ? String : Number)(e);
85
69
  }
86
- var b = !1, x = /* @__PURE__ */ function() {
87
- function c(e, n) {
88
- h(this, c), this.metadata = new t(n);
89
- var r = l(this.getCountryAndCallingCode(e), 2), i = r[0], a = r[1];
90
- this.defaultCountry = i, this.defaultCallingCode = a, this.reset();
70
+ var y = "9", b = o(y, 15), x = /[- ]/, S = !0, C = S && function() {
71
+ return /\[([^\[\]])*\]/g;
72
+ }, w = S && function() {
73
+ return /\d(?=[^,}][^,}])/g;
74
+ }, T = RegExp("[" + e + "]*\\$1[" + e + "]*(\\$\\d[" + e + "]*)*$"), E = 3, D = /* @__PURE__ */ function() {
75
+ function e(t) {
76
+ t.state;
77
+ var n = t.metadata;
78
+ m(this, e), this.metadata = n, this.resetFormat();
91
79
  }
92
- return _(c, [
80
+ return g(e, [
93
81
  {
94
- key: "getCountryAndCallingCode",
95
- value: function(t) {
96
- var n, r;
97
- return t && (e(t) ? (n = t.defaultCountry, r = t.defaultCallingCode) : n = t), n && !this.metadata.hasCountry(n) && (n = void 0), r && b && this.metadata.isNonGeographicCallingCode(r) && (n = "001"), [n, r];
98
- }
99
- },
100
- {
101
- key: "input",
102
- value: function(e) {
103
- var t = this.parser.input(e, this.state), n = t.digits;
104
- if (t.justLeadingPlus) this.formattedOutput = "+";
105
- else if (n) {
106
- this.determineTheCountryIfNeeded(), this.state.nationalSignificantNumber && this.formatter.narrowDownMatchingFormats(this.state);
107
- var r;
108
- if (this.metadata.hasSelectedNumberingPlan() && (r = this.formatter.format(n, this.state)), r === void 0 && this.parser.reExtractNationalSignificantNumber(this.state)) {
109
- this.determineTheCountryIfNeeded();
110
- var i = this.state.getNationalDigits();
111
- i && (r = this.formatter.format(i, this.state));
112
- }
113
- this.formattedOutput = r ? this.getFullNumber(r) : this.getNonFormattedNumber();
114
- }
115
- return this.formattedOutput;
82
+ key: "resetFormat",
83
+ value: function() {
84
+ this.chosenFormat = void 0, this.template = void 0, this.nationalNumberTemplate = void 0, this.populatedNationalNumberTemplate = void 0, this.populatedNationalNumberTemplatePosition = -1;
116
85
  }
117
86
  },
118
87
  {
119
88
  key: "reset",
120
- value: function() {
121
- var e = this;
122
- return this.state = new a({
123
- onCountryChange: function(t) {
124
- e.country = t;
125
- },
126
- onCallingCodeChange: function(t, n) {
127
- e.metadata.selectNumberingPlan(n, t), e.formatter.reset(e.metadata.numberingPlan, e.state), e.parser.reset(e.metadata.numberingPlan);
128
- }
129
- }), this.formatter = new o({
130
- state: this.state,
131
- metadata: this.metadata
132
- }), this.parser = new s({
133
- defaultCountry: this.defaultCountry,
134
- defaultCallingCode: this.defaultCallingCode,
135
- metadata: this.metadata,
136
- state: this.state,
137
- onNationalSignificantNumberChange: function() {
138
- e.determineTheCountryIfNeeded(), e.formatter.reset(e.metadata.numberingPlan, e.state);
139
- }
140
- }), this.state.reset({
141
- country: this.defaultCountry,
142
- callingCode: this.defaultCallingCode
143
- }), this.formattedOutput = "", this;
89
+ value: function(e, t) {
90
+ this.resetFormat(), e ? (this.isNANP = e.callingCode() === "1", this.matchingFormats = e.formats(), t.nationalSignificantNumber && this.narrowDownMatchingFormats(t)) : (this.isNANP = void 0, this.matchingFormats = []);
144
91
  }
145
92
  },
146
93
  {
147
- key: "isInternational",
148
- value: function() {
149
- return this.state.international;
94
+ key: "format",
95
+ value: function(e, t) {
96
+ var n = this;
97
+ if (c(t.nationalSignificantNumber, t.country, this.metadata)) for (var r = d(this.matchingFormats), i; !(i = r()).done;) {
98
+ var a = i.value, o = s(t, a, {
99
+ metadata: this.metadata,
100
+ shouldTryNationalPrefixFormattingRule: function(e) {
101
+ return n.shouldTryNationalPrefixFormattingRule(e, {
102
+ international: t.international,
103
+ nationalPrefix: t.nationalPrefix
104
+ });
105
+ },
106
+ getSeparatorAfterNationalPrefix: function(e) {
107
+ return n.getSeparatorAfterNationalPrefix(e);
108
+ }
109
+ });
110
+ if (o) return this.resetFormat(), this.chosenFormat = a, this.setNationalNumberTemplate(o.replace(/\d/g, "x"), t), this.populatedNationalNumberTemplate = o, this.populatedNationalNumberTemplatePosition = this.template.lastIndexOf("x"), o;
111
+ }
112
+ return this.formatNationalNumberWithNextDigits(e, t);
150
113
  }
151
114
  },
152
115
  {
153
- key: "getCallingCode",
154
- value: function() {
155
- if (this.isInternational()) return this.state.callingCode;
116
+ key: "formatNationalNumberWithNextDigits",
117
+ value: function(e, t) {
118
+ var n = this.chosenFormat, r = this.chooseFormat(t);
119
+ if (r) return r === n ? this.formatNextNationalNumberDigits(e) : this.formatNextNationalNumberDigits(t.getNationalDigits());
156
120
  }
157
121
  },
158
122
  {
159
- key: "getCountryCallingCode",
160
- value: function() {
161
- return this.getCallingCode();
123
+ key: "narrowDownMatchingFormats",
124
+ value: function(e) {
125
+ var t = this, n = e.nationalSignificantNumber, r = e.nationalPrefix, i = e.international, a = n, o = a.length - E;
126
+ o < 0 && (o = 0), this.matchingFormats = this.matchingFormats.filter(function(e) {
127
+ return t.formatSuits(e, i, r) && t.formatMatches(e, a, o);
128
+ }), this.chosenFormat && this.matchingFormats.indexOf(this.chosenFormat) === -1 && this.resetFormat();
162
129
  }
163
130
  },
164
131
  {
165
- key: "getCountry",
166
- value: function() {
167
- if (this.state.digits) return this._getCountry();
132
+ key: "formatSuits",
133
+ value: function(e, t, n) {
134
+ return !(n && !e.usesNationalPrefix() && !e.nationalPrefixIsOptionalWhenFormattingInNationalFormat() || !t && !n && e.nationalPrefixIsMandatoryWhenFormattingInNationalFormat());
168
135
  }
169
136
  },
170
137
  {
171
- key: "_getCountry",
172
- value: function() {
173
- var e = this.state.country;
174
- if (!(b && e === "001")) return e;
138
+ key: "formatMatches",
139
+ value: function(e, t, n) {
140
+ var r = e.leadingDigitsPatterns().length;
141
+ if (r === 0) return !0;
142
+ n = Math.min(n, r - 1);
143
+ var i = e.leadingDigitsPatterns()[n];
144
+ if (t.length < E) try {
145
+ return new l(i).match(t, { allowOverflow: !0 }) !== void 0;
146
+ } catch (e) /* istanbul ignore next */ {
147
+ return console.error(e), !0;
148
+ }
149
+ return RegExp(`^(${i})`).test(t);
175
150
  }
176
151
  },
177
152
  {
178
- key: "determineTheCountryIfNeeded",
179
- value: function() {
180
- (!this.state.country || this.isCountryCallingCodeAmbiguous()) && this.determineTheCountry();
153
+ key: "getFormatFormat",
154
+ value: function(e, t) {
155
+ return t ? e.internationalFormat() : e.format();
181
156
  }
182
157
  },
183
158
  {
184
- key: "getFullNumber",
159
+ key: "chooseFormat",
185
160
  value: function(e) {
186
- var t = this;
187
- if (this.isInternational()) {
188
- var n = function(e) {
189
- return t.formatter.getInternationalPrefixBeforeCountryCallingCode(t.state, { spacing: !!e }) + e;
190
- }, r = this.state.callingCode;
191
- return n(r ? e ? `${r} ${e}` : r : `${this.state.getDigitsWithoutInternationalPrefix()}`);
192
- }
193
- return e;
161
+ /* istanbul ignore next */
162
+ for (var t = this, n = function() {
163
+ var n = a.value;
164
+ return t.chosenFormat === n ? 0 : T.test(t.getFormatFormat(n, e.international)) ? t.createTemplateForFormat(n, e) ? (t.chosenFormat = n, 0) : (t.matchingFormats = t.matchingFormats.filter(function(e) {
165
+ return e !== n;
166
+ }), 1) : 1;
167
+ }, r, i = d(this.matchingFormats.slice()), a; !(a = i()).done && (r = n(), r !== 0););
168
+ return this.chosenFormat || this.resetFormat(), this.chosenFormat;
194
169
  }
195
170
  },
196
171
  {
197
- key: "getNonFormattedNationalNumberWithPrefix",
198
- value: function() {
199
- var e = this.state, t = e.nationalSignificantNumber, n = e.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix, r = e.nationalPrefix, i = t, a = n || r;
200
- return a && (i = a + i), i;
201
- }
202
- },
203
- {
204
- key: "getNonFormattedNumber",
205
- value: function() {
206
- var e = this.state.nationalSignificantNumberIsModified;
207
- return this.getFullNumber(e ? this.state.getNationalDigits() : this.getNonFormattedNationalNumberWithPrefix());
172
+ key: "createTemplateForFormat",
173
+ value: function(e, t) {
174
+ if (!(S && e.pattern().indexOf("|") >= 0)) {
175
+ var n = this.getTemplateForFormat(e, t);
176
+ if (n) return this.setNationalNumberTemplate(n, t), !0;
177
+ }
208
178
  }
209
179
  },
210
180
  {
211
- key: "getNonFormattedTemplate",
212
- value: function() {
213
- var e = this.getNonFormattedNumber();
214
- if (e) return e.replace(/[\+\d]/g, "x");
181
+ key: "getSeparatorAfterNationalPrefix",
182
+ value: function(e) {
183
+ return this.isNANP || e && e.nationalPrefixFormattingRule() && x.test(e.nationalPrefixFormattingRule()) ? " " : "";
215
184
  }
216
185
  },
217
186
  {
218
- key: "isCountryCallingCodeAmbiguous",
219
- value: function() {
220
- var e = this.state.callingCode, t = this.metadata.getCountryCodesForCallingCode(e);
221
- return t && t.length > 1;
187
+ key: "getInternationalPrefixBeforeCountryCallingCode",
188
+ value: function(e, t) {
189
+ var n = e.IDDPrefix, r = e.missingPlus;
190
+ return n ? t && t.spacing === !1 ? n : n + " " : r ? "" : "+";
222
191
  }
223
192
  },
224
193
  {
225
- key: "determineTheCountry",
226
- value: function() {
227
- this.state.setCountry(r(this.isInternational() ? this.state.callingCode : this.defaultCallingCode, {
228
- nationalNumber: this.state.nationalSignificantNumber,
229
- metadata: this.metadata
230
- }));
194
+ key: "getTemplate",
195
+ value: function(e) {
196
+ if (this.template) {
197
+ for (var t = -1, n = 0, r = e.international ? this.getInternationalPrefixBeforeCountryCallingCode(e, { spacing: !1 }) : ""; n < r.length + e.getDigitsWithoutInternationalPrefix().length;) t = this.template.indexOf("x", t + 1), n++;
198
+ return i(this.template, t + 1);
199
+ }
231
200
  }
232
201
  },
233
202
  {
234
- key: "getNumberValue",
235
- value: function() {
236
- var e = this.state, t = e.digits, n = e.callingCode, r = e.country, i = e.nationalSignificantNumber;
237
- if (t) {
238
- if (this.isInternational()) return n ? "+" + n + i : "+" + t;
239
- if (r || n) return "+" + (r ? this.metadata.countryCallingCode() : n) + i;
240
- }
203
+ key: "setNationalNumberTemplate",
204
+ value: function(e, t) {
205
+ this.nationalNumberTemplate = e, this.populatedNationalNumberTemplate = e, this.populatedNationalNumberTemplatePosition = -1, t.international ? this.template = this.getInternationalPrefixBeforeCountryCallingCode(t).replace(/[\d\+]/g, "x") + o("x", t.callingCode.length) + " " + e : this.template = e;
241
206
  }
242
207
  },
243
208
  {
244
- key: "getNumber",
245
- value: function() {
246
- var e = this.state, r = e.nationalSignificantNumber, a = e.carrierCode, o = e.callingCode, s = this._getCountry();
247
- if (r && !(!s && !o)) {
248
- if (s && s === this.defaultCountry) {
249
- var c = new t(this.metadata.metadata);
250
- c.selectNumberingPlan(s);
251
- var l = c.numberingPlan.callingCode(), u = this.metadata.getCountryCodesForCallingCode(l);
252
- if (u.length > 1) {
253
- var d = n(r, {
254
- countries: u,
255
- metadata: this.metadata.metadata
256
- });
257
- d && (s = d);
258
- }
209
+ key: "getTemplateForFormat",
210
+ value: function(e, i) {
211
+ var a = i.nationalSignificantNumber, s = i.international, c = i.nationalPrefix, l = i.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix, u = e.pattern();
212
+ /* istanbul ignore else */
213
+ S && (u = u.replace(C(), "\\d").replace(w(), "\\d"));
214
+ var d = b.match(u)[0];
215
+ if (!(a.length > d.length)) {
216
+ var f = RegExp("^" + u + "$"), p = a.replace(/\d/g, y);
217
+ f.test(p) && (d = p);
218
+ var m = this.getFormatFormat(e, s), h;
219
+ if (this.shouldTryNationalPrefixFormattingRule(e, {
220
+ international: s,
221
+ nationalPrefix: c
222
+ })) {
223
+ var g = m.replace(n, e.nationalPrefixFormattingRule());
224
+ /* istanbul ignore else */
225
+ if (r(e.nationalPrefixFormattingRule()) === (c || "") + r("$1") && (m = g, h = !0, c)) for (var _ = c.length; _ > 0;) m = m.replace(/\d/, "x"), _--;
259
226
  }
260
- var f = new i(s || o, r, this.metadata.metadata);
261
- return a && (f.carrierCode = a), f;
227
+ var v = d.replace(new RegExp(u), m).replace(new RegExp(y, "g"), "x");
228
+ return h || (l ? v = o("x", l.length) + " " + v : c && (v = o("x", c.length) + this.getSeparatorAfterNationalPrefix(e) + v)), s && (v = t(v)), v;
262
229
  }
263
230
  }
264
231
  },
265
232
  {
266
- key: "isPossible",
267
- value: function() {
268
- var e = this.getNumber();
269
- return e ? e.isPossible() : !1;
270
- }
271
- },
272
- {
273
- key: "isValid",
274
- value: function() {
275
- var e = this.getNumber();
276
- return e ? e.isValid() : !1;
277
- }
278
- },
279
- {
280
- key: "getNationalNumber",
281
- value: function() {
282
- return this.state.nationalSignificantNumber;
283
- }
284
- },
285
- {
286
- key: "getChars",
287
- value: function() {
288
- return (this.state.international ? "+" : "") + this.state.digits;
233
+ key: "formatNextNationalNumberDigits",
234
+ value: function(e) {
235
+ var t = a(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition, e);
236
+ if (!t) {
237
+ this.resetFormat();
238
+ return;
239
+ }
240
+ return this.populatedNationalNumberTemplate = t[0], this.populatedNationalNumberTemplatePosition = t[1], i(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1);
289
241
  }
290
242
  },
291
243
  {
292
- key: "getTemplate",
293
- value: function() {
294
- return this.formatter.getTemplate(this.state) || this.getNonFormattedTemplate() || "";
244
+ key: "shouldTryNationalPrefixFormattingRule",
245
+ value: function(e, t) {
246
+ var n = t.international, r = t.nationalPrefix;
247
+ if (e.nationalPrefixFormattingRule()) {
248
+ var i = e.usesNationalPrefix();
249
+ if (i && r || !i && !n) return !0;
250
+ }
295
251
  }
296
252
  }
297
253
  ]);
298
254
  }();
299
255
  //#endregion
300
- export { x as AsYouType };
256
+ export { D as AsYouTypeFormatter };
301
257
 
302
258
  //# sourceMappingURL=index289.js.map