intl-messageformat 10.3.2 → 10.3.4
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/intl-messageformat.esm.js +697 -1123
- package/intl-messageformat.iife.js +917 -1285
- package/lib/src/core.d.ts +2 -2
- package/lib/src/core.d.ts.map +1 -1
- package/lib/src/core.js +1 -2
- package/package.json +3 -3
- package/src/core.d.ts +2 -2
- package/src/core.d.ts.map +1 -1
- package/src/core.js +1 -2
- package/src/error.d.ts.map +1 -1
- package/src/formatters.d.ts.map +1 -1
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
var IntlMessageFormat = (() => {
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
6
|
var __export = (target, all) => {
|
|
12
7
|
for (var name in all)
|
|
13
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -20,453 +15,9 @@ var IntlMessageFormat = (() => {
|
|
|
20
15
|
}
|
|
21
16
|
return to;
|
|
22
17
|
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
19
|
|
|
29
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/
|
|
30
|
-
var require_tslib = __commonJS({
|
|
31
|
-
"../../../../../../../../execroot/formatjs/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/tslib@2.4.0/node_modules/tslib/tslib.js"(exports, module) {
|
|
32
|
-
var __extends2;
|
|
33
|
-
var __assign2;
|
|
34
|
-
var __rest2;
|
|
35
|
-
var __decorate2;
|
|
36
|
-
var __param2;
|
|
37
|
-
var __metadata2;
|
|
38
|
-
var __awaiter2;
|
|
39
|
-
var __generator2;
|
|
40
|
-
var __exportStar2;
|
|
41
|
-
var __values2;
|
|
42
|
-
var __read2;
|
|
43
|
-
var __spread2;
|
|
44
|
-
var __spreadArrays2;
|
|
45
|
-
var __spreadArray2;
|
|
46
|
-
var __await2;
|
|
47
|
-
var __asyncGenerator2;
|
|
48
|
-
var __asyncDelegator2;
|
|
49
|
-
var __asyncValues2;
|
|
50
|
-
var __makeTemplateObject2;
|
|
51
|
-
var __importStar2;
|
|
52
|
-
var __importDefault2;
|
|
53
|
-
var __classPrivateFieldGet2;
|
|
54
|
-
var __classPrivateFieldSet2;
|
|
55
|
-
var __classPrivateFieldIn2;
|
|
56
|
-
var __createBinding2;
|
|
57
|
-
(function(factory) {
|
|
58
|
-
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
|
|
59
|
-
if (typeof define === "function" && define.amd) {
|
|
60
|
-
define("tslib", ["exports"], function(exports2) {
|
|
61
|
-
factory(createExporter(root, createExporter(exports2)));
|
|
62
|
-
});
|
|
63
|
-
} else if (typeof module === "object" && typeof module.exports === "object") {
|
|
64
|
-
factory(createExporter(root, createExporter(module.exports)));
|
|
65
|
-
} else {
|
|
66
|
-
factory(createExporter(root));
|
|
67
|
-
}
|
|
68
|
-
function createExporter(exports2, previous) {
|
|
69
|
-
if (exports2 !== root) {
|
|
70
|
-
if (typeof Object.create === "function") {
|
|
71
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
72
|
-
} else {
|
|
73
|
-
exports2.__esModule = true;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return function(id, v) {
|
|
77
|
-
return exports2[id] = previous ? previous(id, v) : v;
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
})(function(exporter) {
|
|
81
|
-
var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) {
|
|
82
|
-
d.__proto__ = b;
|
|
83
|
-
} || function(d, b) {
|
|
84
|
-
for (var p in b)
|
|
85
|
-
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
86
|
-
d[p] = b[p];
|
|
87
|
-
};
|
|
88
|
-
__extends2 = function(d, b) {
|
|
89
|
-
if (typeof b !== "function" && b !== null)
|
|
90
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
91
|
-
extendStatics(d, b);
|
|
92
|
-
function __() {
|
|
93
|
-
this.constructor = d;
|
|
94
|
-
}
|
|
95
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
96
|
-
};
|
|
97
|
-
__assign2 = Object.assign || function(t) {
|
|
98
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
99
|
-
s = arguments[i];
|
|
100
|
-
for (var p in s)
|
|
101
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
102
|
-
t[p] = s[p];
|
|
103
|
-
}
|
|
104
|
-
return t;
|
|
105
|
-
};
|
|
106
|
-
__rest2 = function(s, e) {
|
|
107
|
-
var t = {};
|
|
108
|
-
for (var p in s)
|
|
109
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
110
|
-
t[p] = s[p];
|
|
111
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
112
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
113
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
114
|
-
t[p[i]] = s[p[i]];
|
|
115
|
-
}
|
|
116
|
-
return t;
|
|
117
|
-
};
|
|
118
|
-
__decorate2 = function(decorators, target, key, desc) {
|
|
119
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
120
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
121
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
122
|
-
else
|
|
123
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
124
|
-
if (d = decorators[i])
|
|
125
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
126
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
127
|
-
};
|
|
128
|
-
__param2 = function(paramIndex, decorator) {
|
|
129
|
-
return function(target, key) {
|
|
130
|
-
decorator(target, key, paramIndex);
|
|
131
|
-
};
|
|
132
|
-
};
|
|
133
|
-
__metadata2 = function(metadataKey, metadataValue) {
|
|
134
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
135
|
-
return Reflect.metadata(metadataKey, metadataValue);
|
|
136
|
-
};
|
|
137
|
-
__awaiter2 = function(thisArg, _arguments, P, generator) {
|
|
138
|
-
function adopt(value) {
|
|
139
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
140
|
-
resolve(value);
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
144
|
-
function fulfilled(value) {
|
|
145
|
-
try {
|
|
146
|
-
step(generator.next(value));
|
|
147
|
-
} catch (e) {
|
|
148
|
-
reject(e);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
function rejected(value) {
|
|
152
|
-
try {
|
|
153
|
-
step(generator["throw"](value));
|
|
154
|
-
} catch (e) {
|
|
155
|
-
reject(e);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
function step(result) {
|
|
159
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
160
|
-
}
|
|
161
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
162
|
-
});
|
|
163
|
-
};
|
|
164
|
-
__generator2 = function(thisArg, body) {
|
|
165
|
-
var _ = { label: 0, sent: function() {
|
|
166
|
-
if (t[0] & 1)
|
|
167
|
-
throw t[1];
|
|
168
|
-
return t[1];
|
|
169
|
-
}, trys: [], ops: [] }, f, y, t, g;
|
|
170
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
171
|
-
return this;
|
|
172
|
-
}), g;
|
|
173
|
-
function verb(n) {
|
|
174
|
-
return function(v) {
|
|
175
|
-
return step([n, v]);
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
function step(op) {
|
|
179
|
-
if (f)
|
|
180
|
-
throw new TypeError("Generator is already executing.");
|
|
181
|
-
while (_)
|
|
182
|
-
try {
|
|
183
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
184
|
-
return t;
|
|
185
|
-
if (y = 0, t)
|
|
186
|
-
op = [op[0] & 2, t.value];
|
|
187
|
-
switch (op[0]) {
|
|
188
|
-
case 0:
|
|
189
|
-
case 1:
|
|
190
|
-
t = op;
|
|
191
|
-
break;
|
|
192
|
-
case 4:
|
|
193
|
-
_.label++;
|
|
194
|
-
return { value: op[1], done: false };
|
|
195
|
-
case 5:
|
|
196
|
-
_.label++;
|
|
197
|
-
y = op[1];
|
|
198
|
-
op = [0];
|
|
199
|
-
continue;
|
|
200
|
-
case 7:
|
|
201
|
-
op = _.ops.pop();
|
|
202
|
-
_.trys.pop();
|
|
203
|
-
continue;
|
|
204
|
-
default:
|
|
205
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
206
|
-
_ = 0;
|
|
207
|
-
continue;
|
|
208
|
-
}
|
|
209
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
210
|
-
_.label = op[1];
|
|
211
|
-
break;
|
|
212
|
-
}
|
|
213
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
214
|
-
_.label = t[1];
|
|
215
|
-
t = op;
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
if (t && _.label < t[2]) {
|
|
219
|
-
_.label = t[2];
|
|
220
|
-
_.ops.push(op);
|
|
221
|
-
break;
|
|
222
|
-
}
|
|
223
|
-
if (t[2])
|
|
224
|
-
_.ops.pop();
|
|
225
|
-
_.trys.pop();
|
|
226
|
-
continue;
|
|
227
|
-
}
|
|
228
|
-
op = body.call(thisArg, _);
|
|
229
|
-
} catch (e) {
|
|
230
|
-
op = [6, e];
|
|
231
|
-
y = 0;
|
|
232
|
-
} finally {
|
|
233
|
-
f = t = 0;
|
|
234
|
-
}
|
|
235
|
-
if (op[0] & 5)
|
|
236
|
-
throw op[1];
|
|
237
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
__exportStar2 = function(m, o) {
|
|
241
|
-
for (var p in m)
|
|
242
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
243
|
-
__createBinding2(o, m, p);
|
|
244
|
-
};
|
|
245
|
-
__createBinding2 = Object.create ? function(o, m, k, k2) {
|
|
246
|
-
if (k2 === void 0)
|
|
247
|
-
k2 = k;
|
|
248
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
249
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
250
|
-
desc = { enumerable: true, get: function() {
|
|
251
|
-
return m[k];
|
|
252
|
-
} };
|
|
253
|
-
}
|
|
254
|
-
Object.defineProperty(o, k2, desc);
|
|
255
|
-
} : function(o, m, k, k2) {
|
|
256
|
-
if (k2 === void 0)
|
|
257
|
-
k2 = k;
|
|
258
|
-
o[k2] = m[k];
|
|
259
|
-
};
|
|
260
|
-
__values2 = function(o) {
|
|
261
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
262
|
-
if (m)
|
|
263
|
-
return m.call(o);
|
|
264
|
-
if (o && typeof o.length === "number")
|
|
265
|
-
return {
|
|
266
|
-
next: function() {
|
|
267
|
-
if (o && i >= o.length)
|
|
268
|
-
o = void 0;
|
|
269
|
-
return { value: o && o[i++], done: !o };
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
273
|
-
};
|
|
274
|
-
__read2 = function(o, n) {
|
|
275
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
276
|
-
if (!m)
|
|
277
|
-
return o;
|
|
278
|
-
var i = m.call(o), r, ar = [], e;
|
|
279
|
-
try {
|
|
280
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
281
|
-
ar.push(r.value);
|
|
282
|
-
} catch (error) {
|
|
283
|
-
e = { error };
|
|
284
|
-
} finally {
|
|
285
|
-
try {
|
|
286
|
-
if (r && !r.done && (m = i["return"]))
|
|
287
|
-
m.call(i);
|
|
288
|
-
} finally {
|
|
289
|
-
if (e)
|
|
290
|
-
throw e.error;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
return ar;
|
|
294
|
-
};
|
|
295
|
-
__spread2 = function() {
|
|
296
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
297
|
-
ar = ar.concat(__read2(arguments[i]));
|
|
298
|
-
return ar;
|
|
299
|
-
};
|
|
300
|
-
__spreadArrays2 = function() {
|
|
301
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
302
|
-
s += arguments[i].length;
|
|
303
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
304
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
305
|
-
r[k] = a[j];
|
|
306
|
-
return r;
|
|
307
|
-
};
|
|
308
|
-
__spreadArray2 = function(to, from, pack) {
|
|
309
|
-
if (pack || arguments.length === 2)
|
|
310
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
311
|
-
if (ar || !(i in from)) {
|
|
312
|
-
if (!ar)
|
|
313
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
|
314
|
-
ar[i] = from[i];
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
318
|
-
};
|
|
319
|
-
__await2 = function(v) {
|
|
320
|
-
return this instanceof __await2 ? (this.v = v, this) : new __await2(v);
|
|
321
|
-
};
|
|
322
|
-
__asyncGenerator2 = function(thisArg, _arguments, generator) {
|
|
323
|
-
if (!Symbol.asyncIterator)
|
|
324
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
325
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
326
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
|
|
327
|
-
return this;
|
|
328
|
-
}, i;
|
|
329
|
-
function verb(n) {
|
|
330
|
-
if (g[n])
|
|
331
|
-
i[n] = function(v) {
|
|
332
|
-
return new Promise(function(a, b) {
|
|
333
|
-
q.push([n, v, a, b]) > 1 || resume(n, v);
|
|
334
|
-
});
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
function resume(n, v) {
|
|
338
|
-
try {
|
|
339
|
-
step(g[n](v));
|
|
340
|
-
} catch (e) {
|
|
341
|
-
settle(q[0][3], e);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
function step(r) {
|
|
345
|
-
r.value instanceof __await2 ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
|
|
346
|
-
}
|
|
347
|
-
function fulfill(value) {
|
|
348
|
-
resume("next", value);
|
|
349
|
-
}
|
|
350
|
-
function reject(value) {
|
|
351
|
-
resume("throw", value);
|
|
352
|
-
}
|
|
353
|
-
function settle(f, v) {
|
|
354
|
-
if (f(v), q.shift(), q.length)
|
|
355
|
-
resume(q[0][0], q[0][1]);
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
__asyncDelegator2 = function(o) {
|
|
359
|
-
var i, p;
|
|
360
|
-
return i = {}, verb("next"), verb("throw", function(e) {
|
|
361
|
-
throw e;
|
|
362
|
-
}), verb("return"), i[Symbol.iterator] = function() {
|
|
363
|
-
return this;
|
|
364
|
-
}, i;
|
|
365
|
-
function verb(n, f) {
|
|
366
|
-
i[n] = o[n] ? function(v) {
|
|
367
|
-
return (p = !p) ? { value: __await2(o[n](v)), done: n === "return" } : f ? f(v) : v;
|
|
368
|
-
} : f;
|
|
369
|
-
}
|
|
370
|
-
};
|
|
371
|
-
__asyncValues2 = function(o) {
|
|
372
|
-
if (!Symbol.asyncIterator)
|
|
373
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
374
|
-
var m = o[Symbol.asyncIterator], i;
|
|
375
|
-
return m ? m.call(o) : (o = typeof __values2 === "function" ? __values2(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
|
|
376
|
-
return this;
|
|
377
|
-
}, i);
|
|
378
|
-
function verb(n) {
|
|
379
|
-
i[n] = o[n] && function(v) {
|
|
380
|
-
return new Promise(function(resolve, reject) {
|
|
381
|
-
v = o[n](v), settle(resolve, reject, v.done, v.value);
|
|
382
|
-
});
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
function settle(resolve, reject, d, v) {
|
|
386
|
-
Promise.resolve(v).then(function(v2) {
|
|
387
|
-
resolve({ value: v2, done: d });
|
|
388
|
-
}, reject);
|
|
389
|
-
}
|
|
390
|
-
};
|
|
391
|
-
__makeTemplateObject2 = function(cooked, raw) {
|
|
392
|
-
if (Object.defineProperty) {
|
|
393
|
-
Object.defineProperty(cooked, "raw", { value: raw });
|
|
394
|
-
} else {
|
|
395
|
-
cooked.raw = raw;
|
|
396
|
-
}
|
|
397
|
-
return cooked;
|
|
398
|
-
};
|
|
399
|
-
var __setModuleDefault = Object.create ? function(o, v) {
|
|
400
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
401
|
-
} : function(o, v) {
|
|
402
|
-
o["default"] = v;
|
|
403
|
-
};
|
|
404
|
-
__importStar2 = function(mod) {
|
|
405
|
-
if (mod && mod.__esModule)
|
|
406
|
-
return mod;
|
|
407
|
-
var result = {};
|
|
408
|
-
if (mod != null) {
|
|
409
|
-
for (var k in mod)
|
|
410
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
411
|
-
__createBinding2(result, mod, k);
|
|
412
|
-
}
|
|
413
|
-
__setModuleDefault(result, mod);
|
|
414
|
-
return result;
|
|
415
|
-
};
|
|
416
|
-
__importDefault2 = function(mod) {
|
|
417
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
418
|
-
};
|
|
419
|
-
__classPrivateFieldGet2 = function(receiver, state, kind, f) {
|
|
420
|
-
if (kind === "a" && !f)
|
|
421
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
422
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
423
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
424
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
425
|
-
};
|
|
426
|
-
__classPrivateFieldSet2 = function(receiver, state, value, kind, f) {
|
|
427
|
-
if (kind === "m")
|
|
428
|
-
throw new TypeError("Private method is not writable");
|
|
429
|
-
if (kind === "a" && !f)
|
|
430
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
431
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
432
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
433
|
-
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
434
|
-
};
|
|
435
|
-
__classPrivateFieldIn2 = function(state, receiver) {
|
|
436
|
-
if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function")
|
|
437
|
-
throw new TypeError("Cannot use 'in' operator on non-object");
|
|
438
|
-
return typeof state === "function" ? receiver === state : state.has(receiver);
|
|
439
|
-
};
|
|
440
|
-
exporter("__extends", __extends2);
|
|
441
|
-
exporter("__assign", __assign2);
|
|
442
|
-
exporter("__rest", __rest2);
|
|
443
|
-
exporter("__decorate", __decorate2);
|
|
444
|
-
exporter("__param", __param2);
|
|
445
|
-
exporter("__metadata", __metadata2);
|
|
446
|
-
exporter("__awaiter", __awaiter2);
|
|
447
|
-
exporter("__generator", __generator2);
|
|
448
|
-
exporter("__exportStar", __exportStar2);
|
|
449
|
-
exporter("__createBinding", __createBinding2);
|
|
450
|
-
exporter("__values", __values2);
|
|
451
|
-
exporter("__read", __read2);
|
|
452
|
-
exporter("__spread", __spread2);
|
|
453
|
-
exporter("__spreadArrays", __spreadArrays2);
|
|
454
|
-
exporter("__spreadArray", __spreadArray2);
|
|
455
|
-
exporter("__await", __await2);
|
|
456
|
-
exporter("__asyncGenerator", __asyncGenerator2);
|
|
457
|
-
exporter("__asyncDelegator", __asyncDelegator2);
|
|
458
|
-
exporter("__asyncValues", __asyncValues2);
|
|
459
|
-
exporter("__makeTemplateObject", __makeTemplateObject2);
|
|
460
|
-
exporter("__importStar", __importStar2);
|
|
461
|
-
exporter("__importDefault", __importDefault2);
|
|
462
|
-
exporter("__classPrivateFieldGet", __classPrivateFieldGet2);
|
|
463
|
-
exporter("__classPrivateFieldSet", __classPrivateFieldSet2);
|
|
464
|
-
exporter("__classPrivateFieldIn", __classPrivateFieldIn2);
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
});
|
|
468
|
-
|
|
469
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/darwin_arm64-fastbuild/bin/packages/intl-messageformat/lib/index.js
|
|
20
|
+
// ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/packages/intl-messageformat/lib/index.js
|
|
470
21
|
var lib_exports = {};
|
|
471
22
|
__export(lib_exports, {
|
|
472
23
|
ErrorCode: () => ErrorCode,
|
|
@@ -481,37 +32,63 @@ var IntlMessageFormat = (() => {
|
|
|
481
32
|
isFormatXMLElementFn: () => isFormatXMLElementFn
|
|
482
33
|
});
|
|
483
34
|
|
|
484
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/
|
|
485
|
-
var
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
35
|
+
// ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/node_modules/.aspect_rules_js/tslib@2.4.0/node_modules/tslib/tslib.es6.js
|
|
36
|
+
var extendStatics = function(d, b) {
|
|
37
|
+
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
38
|
+
d2.__proto__ = b2;
|
|
39
|
+
} || function(d2, b2) {
|
|
40
|
+
for (var p in b2)
|
|
41
|
+
if (Object.prototype.hasOwnProperty.call(b2, p))
|
|
42
|
+
d2[p] = b2[p];
|
|
43
|
+
};
|
|
44
|
+
return extendStatics(d, b);
|
|
45
|
+
};
|
|
46
|
+
function __extends(d, b) {
|
|
47
|
+
if (typeof b !== "function" && b !== null)
|
|
48
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
49
|
+
extendStatics(d, b);
|
|
50
|
+
function __() {
|
|
51
|
+
this.constructor = d;
|
|
52
|
+
}
|
|
53
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
54
|
+
}
|
|
55
|
+
var __assign = function() {
|
|
56
|
+
__assign = Object.assign || function __assign2(t) {
|
|
57
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
58
|
+
s = arguments[i];
|
|
59
|
+
for (var p in s)
|
|
60
|
+
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
61
|
+
t[p] = s[p];
|
|
62
|
+
}
|
|
63
|
+
return t;
|
|
64
|
+
};
|
|
65
|
+
return __assign.apply(this, arguments);
|
|
66
|
+
};
|
|
67
|
+
function __rest(s, e) {
|
|
68
|
+
var t = {};
|
|
69
|
+
for (var p in s)
|
|
70
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
71
|
+
t[p] = s[p];
|
|
72
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
73
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
74
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
75
|
+
t[p[i]] = s[p[i]];
|
|
76
|
+
}
|
|
77
|
+
return t;
|
|
78
|
+
}
|
|
79
|
+
function __spreadArray(to, from, pack) {
|
|
80
|
+
if (pack || arguments.length === 2)
|
|
81
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
82
|
+
if (ar || !(i in from)) {
|
|
83
|
+
if (!ar)
|
|
84
|
+
ar = Array.prototype.slice.call(from, 0, i);
|
|
85
|
+
ar[i] = from[i];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
89
|
+
}
|
|
513
90
|
|
|
514
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/
|
|
91
|
+
// ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/lib/error.js
|
|
515
92
|
var ErrorKind;
|
|
516
93
|
(function(ErrorKind2) {
|
|
517
94
|
ErrorKind2[ErrorKind2["EXPECT_ARGUMENT_CLOSING_BRACE"] = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE";
|
|
@@ -542,7 +119,7 @@ var IntlMessageFormat = (() => {
|
|
|
542
119
|
ErrorKind2[ErrorKind2["UNCLOSED_TAG"] = 27] = "UNCLOSED_TAG";
|
|
543
120
|
})(ErrorKind || (ErrorKind = {}));
|
|
544
121
|
|
|
545
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/
|
|
122
|
+
// ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/lib/types.js
|
|
546
123
|
var TYPE;
|
|
547
124
|
(function(TYPE2) {
|
|
548
125
|
TYPE2[TYPE2["literal"] = 0] = "literal";
|
|
@@ -594,10 +171,10 @@ var IntlMessageFormat = (() => {
|
|
|
594
171
|
return !!(el && typeof el === "object" && el.type === SKELETON_TYPE.dateTime);
|
|
595
172
|
}
|
|
596
173
|
|
|
597
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/
|
|
174
|
+
// ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/lib/regex.generated.js
|
|
598
175
|
var SPACE_SEPARATOR_REGEX = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/;
|
|
599
176
|
|
|
600
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/
|
|
177
|
+
// ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+icu-skeleton-parser@0.0.0/node_modules/@formatjs/icu-skeleton-parser/lib/date-time.js
|
|
601
178
|
var DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;
|
|
602
179
|
function parseDateTimeSkeleton(skeleton) {
|
|
603
180
|
var result = {};
|
|
@@ -698,10 +275,10 @@ var IntlMessageFormat = (() => {
|
|
|
698
275
|
return result;
|
|
699
276
|
}
|
|
700
277
|
|
|
701
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/
|
|
278
|
+
// ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+icu-skeleton-parser@0.0.0/node_modules/@formatjs/icu-skeleton-parser/lib/regex.generated.js
|
|
702
279
|
var WHITE_SPACE_REGEX = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i;
|
|
703
280
|
|
|
704
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/
|
|
281
|
+
// ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+icu-skeleton-parser@0.0.0/node_modules/@formatjs/icu-skeleton-parser/lib/number.js
|
|
705
282
|
function parseNumberSkeletonFromString(skeleton) {
|
|
706
283
|
if (skeleton.length === 0) {
|
|
707
284
|
throw new Error("Number skeleton cannot be empty");
|
|
@@ -967,7 +544,7 @@ var IntlMessageFormat = (() => {
|
|
|
967
544
|
return result;
|
|
968
545
|
}
|
|
969
546
|
|
|
970
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/
|
|
547
|
+
// ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/lib/time-data.generated.js
|
|
971
548
|
var timeData = {
|
|
972
549
|
"AX": [
|
|
973
550
|
"H"
|
|
@@ -2306,7 +1883,7 @@ var IntlMessageFormat = (() => {
|
|
|
2306
1883
|
]
|
|
2307
1884
|
};
|
|
2308
1885
|
|
|
2309
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/
|
|
1886
|
+
// ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/lib/date-time-pattern-generator.js
|
|
2310
1887
|
function getBestPattern(skeleton, locale) {
|
|
2311
1888
|
var skeletonCopy = "";
|
|
2312
1889
|
for (var patternPos = 0; patternPos < skeleton.length; patternPos++) {
|
|
@@ -2340,7 +1917,9 @@ var IntlMessageFormat = (() => {
|
|
|
2340
1917
|
}
|
|
2341
1918
|
function getDefaultHourSymbolFromLocale(locale) {
|
|
2342
1919
|
var hourCycle = locale.hourCycle;
|
|
2343
|
-
if (hourCycle === void 0 &&
|
|
1920
|
+
if (hourCycle === void 0 && // @ts-ignore hourCycle(s) is not identified yet
|
|
1921
|
+
locale.hourCycles && // @ts-ignore
|
|
1922
|
+
locale.hourCycles.length) {
|
|
2344
1923
|
hourCycle = locale.hourCycles[0];
|
|
2345
1924
|
}
|
|
2346
1925
|
if (hourCycle) {
|
|
@@ -2366,7 +1945,7 @@ var IntlMessageFormat = (() => {
|
|
|
2366
1945
|
return hourCycles[0];
|
|
2367
1946
|
}
|
|
2368
1947
|
|
|
2369
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/
|
|
1948
|
+
// ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/lib/parser.js
|
|
2370
1949
|
var _a;
|
|
2371
1950
|
var SPACE_SEPARATOR_START_REGEX = new RegExp("^".concat(SPACE_SEPARATOR_REGEX.source, "*"));
|
|
2372
1951
|
var SPACE_SEPARATOR_END_REGEX = new RegExp("".concat(SPACE_SEPARATOR_REGEX.source, "*$"));
|
|
@@ -2391,57 +1970,90 @@ var IntlMessageFormat = (() => {
|
|
|
2391
1970
|
REGEX_SUPPORTS_U_AND_Y = false;
|
|
2392
1971
|
}
|
|
2393
1972
|
var re;
|
|
2394
|
-
var startsWith = hasNativeStartsWith ?
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
};
|
|
2399
|
-
var fromCodePoint = hasNativeFromCodePoint ? String.fromCodePoint : function fromCodePoint2() {
|
|
2400
|
-
var codePoints = [];
|
|
2401
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2402
|
-
codePoints[_i] = arguments[_i];
|
|
1973
|
+
var startsWith = hasNativeStartsWith ? (
|
|
1974
|
+
// Native
|
|
1975
|
+
function startsWith2(s, search, position) {
|
|
1976
|
+
return s.startsWith(search, position);
|
|
2403
1977
|
}
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
while (length > i) {
|
|
2409
|
-
code = codePoints[i++];
|
|
2410
|
-
if (code > 1114111)
|
|
2411
|
-
throw RangeError(code + " is not a valid code point");
|
|
2412
|
-
elements += code < 65536 ? String.fromCharCode(code) : String.fromCharCode(((code -= 65536) >> 10) + 55296, code % 1024 + 56320);
|
|
1978
|
+
) : (
|
|
1979
|
+
// For IE11
|
|
1980
|
+
function startsWith3(s, search, position) {
|
|
1981
|
+
return s.slice(position, position + search.length) === search;
|
|
2413
1982
|
}
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
var
|
|
2420
|
-
|
|
1983
|
+
);
|
|
1984
|
+
var fromCodePoint = hasNativeFromCodePoint ? String.fromCodePoint : (
|
|
1985
|
+
// IE11
|
|
1986
|
+
function fromCodePoint2() {
|
|
1987
|
+
var codePoints = [];
|
|
1988
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1989
|
+
codePoints[_i] = arguments[_i];
|
|
1990
|
+
}
|
|
1991
|
+
var elements = "";
|
|
1992
|
+
var length = codePoints.length;
|
|
1993
|
+
var i = 0;
|
|
1994
|
+
var code;
|
|
1995
|
+
while (length > i) {
|
|
1996
|
+
code = codePoints[i++];
|
|
1997
|
+
if (code > 1114111)
|
|
1998
|
+
throw RangeError(code + " is not a valid code point");
|
|
1999
|
+
elements += code < 65536 ? String.fromCharCode(code) : String.fromCharCode(((code -= 65536) >> 10) + 55296, code % 1024 + 56320);
|
|
2000
|
+
}
|
|
2001
|
+
return elements;
|
|
2421
2002
|
}
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2003
|
+
);
|
|
2004
|
+
var fromEntries = (
|
|
2005
|
+
// native
|
|
2006
|
+
hasNativeFromEntries ? Object.fromEntries : (
|
|
2007
|
+
// Ponyfill
|
|
2008
|
+
function fromEntries2(entries) {
|
|
2009
|
+
var obj = {};
|
|
2010
|
+
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
2011
|
+
var _a2 = entries_1[_i], k = _a2[0], v = _a2[1];
|
|
2012
|
+
obj[k] = v;
|
|
2013
|
+
}
|
|
2014
|
+
return obj;
|
|
2015
|
+
}
|
|
2016
|
+
)
|
|
2017
|
+
);
|
|
2018
|
+
var codePointAt = hasNativeCodePointAt ? (
|
|
2019
|
+
// Native
|
|
2020
|
+
function codePointAt2(s, index) {
|
|
2021
|
+
return s.codePointAt(index);
|
|
2430
2022
|
}
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2023
|
+
) : (
|
|
2024
|
+
// IE 11
|
|
2025
|
+
function codePointAt3(s, index) {
|
|
2026
|
+
var size = s.length;
|
|
2027
|
+
if (index < 0 || index >= size) {
|
|
2028
|
+
return void 0;
|
|
2029
|
+
}
|
|
2030
|
+
var first = s.charCodeAt(index);
|
|
2031
|
+
var second;
|
|
2032
|
+
return first < 55296 || first > 56319 || index + 1 === size || (second = s.charCodeAt(index + 1)) < 56320 || second > 57343 ? first : (first - 55296 << 10) + (second - 56320) + 65536;
|
|
2033
|
+
}
|
|
2034
|
+
);
|
|
2035
|
+
var trimStart = hasTrimStart ? (
|
|
2036
|
+
// Native
|
|
2037
|
+
function trimStart2(s) {
|
|
2038
|
+
return s.trimStart();
|
|
2039
|
+
}
|
|
2040
|
+
) : (
|
|
2041
|
+
// Ponyfill
|
|
2042
|
+
function trimStart3(s) {
|
|
2043
|
+
return s.replace(SPACE_SEPARATOR_START_REGEX, "");
|
|
2044
|
+
}
|
|
2045
|
+
);
|
|
2046
|
+
var trimEnd = hasTrimEnd ? (
|
|
2047
|
+
// Native
|
|
2048
|
+
function trimEnd2(s) {
|
|
2049
|
+
return s.trimEnd();
|
|
2050
|
+
}
|
|
2051
|
+
) : (
|
|
2052
|
+
// Ponyfill
|
|
2053
|
+
function trimEnd3(s) {
|
|
2054
|
+
return s.replace(SPACE_SEPARATOR_END_REGEX, "");
|
|
2055
|
+
}
|
|
2056
|
+
);
|
|
2445
2057
|
function RE(s, flag) {
|
|
2446
2058
|
return new RegExp(s, flag);
|
|
2447
2059
|
}
|
|
@@ -2469,654 +2081,659 @@ var IntlMessageFormat = (() => {
|
|
|
2469
2081
|
};
|
|
2470
2082
|
}
|
|
2471
2083
|
var IDENTIFIER_PREFIX_RE_1;
|
|
2472
|
-
var Parser =
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
var
|
|
2494
|
-
|
|
2495
|
-
var
|
|
2496
|
-
if (
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
var position = this.clonePosition();
|
|
2504
|
-
this.bump();
|
|
2505
|
-
elements.push({
|
|
2506
|
-
type: TYPE.pound,
|
|
2507
|
-
location: createLocation(position, this.clonePosition())
|
|
2508
|
-
});
|
|
2509
|
-
} else if (char === 60 && !this.ignoreTag && this.peek() === 47) {
|
|
2510
|
-
if (expectingCloseTag) {
|
|
2084
|
+
var Parser = (
|
|
2085
|
+
/** @class */
|
|
2086
|
+
function() {
|
|
2087
|
+
function Parser2(message, options) {
|
|
2088
|
+
if (options === void 0) {
|
|
2089
|
+
options = {};
|
|
2090
|
+
}
|
|
2091
|
+
this.message = message;
|
|
2092
|
+
this.position = { offset: 0, line: 1, column: 1 };
|
|
2093
|
+
this.ignoreTag = !!options.ignoreTag;
|
|
2094
|
+
this.locale = options.locale;
|
|
2095
|
+
this.requiresOtherClause = !!options.requiresOtherClause;
|
|
2096
|
+
this.shouldParseSkeletons = !!options.shouldParseSkeletons;
|
|
2097
|
+
}
|
|
2098
|
+
Parser2.prototype.parse = function() {
|
|
2099
|
+
if (this.offset() !== 0) {
|
|
2100
|
+
throw Error("parser can only be used once");
|
|
2101
|
+
}
|
|
2102
|
+
return this.parseMessage(0, "", false);
|
|
2103
|
+
};
|
|
2104
|
+
Parser2.prototype.parseMessage = function(nestingLevel, parentArgType, expectingCloseTag) {
|
|
2105
|
+
var elements = [];
|
|
2106
|
+
while (!this.isEOF()) {
|
|
2107
|
+
var char = this.char();
|
|
2108
|
+
if (char === 123) {
|
|
2109
|
+
var result = this.parseArgument(nestingLevel, expectingCloseTag);
|
|
2110
|
+
if (result.err) {
|
|
2111
|
+
return result;
|
|
2112
|
+
}
|
|
2113
|
+
elements.push(result.val);
|
|
2114
|
+
} else if (char === 125 && nestingLevel > 0) {
|
|
2511
2115
|
break;
|
|
2116
|
+
} else if (char === 35 && (parentArgType === "plural" || parentArgType === "selectordinal")) {
|
|
2117
|
+
var position = this.clonePosition();
|
|
2118
|
+
this.bump();
|
|
2119
|
+
elements.push({
|
|
2120
|
+
type: TYPE.pound,
|
|
2121
|
+
location: createLocation(position, this.clonePosition())
|
|
2122
|
+
});
|
|
2123
|
+
} else if (char === 60 && !this.ignoreTag && this.peek() === 47) {
|
|
2124
|
+
if (expectingCloseTag) {
|
|
2125
|
+
break;
|
|
2126
|
+
} else {
|
|
2127
|
+
return this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(this.clonePosition(), this.clonePosition()));
|
|
2128
|
+
}
|
|
2129
|
+
} else if (char === 60 && !this.ignoreTag && _isAlpha(this.peek() || 0)) {
|
|
2130
|
+
var result = this.parseTag(nestingLevel, parentArgType);
|
|
2131
|
+
if (result.err) {
|
|
2132
|
+
return result;
|
|
2133
|
+
}
|
|
2134
|
+
elements.push(result.val);
|
|
2512
2135
|
} else {
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
return result;
|
|
2519
|
-
}
|
|
2520
|
-
elements.push(result.val);
|
|
2521
|
-
} else {
|
|
2522
|
-
var result = this.parseLiteral(nestingLevel, parentArgType);
|
|
2523
|
-
if (result.err) {
|
|
2524
|
-
return result;
|
|
2136
|
+
var result = this.parseLiteral(nestingLevel, parentArgType);
|
|
2137
|
+
if (result.err) {
|
|
2138
|
+
return result;
|
|
2139
|
+
}
|
|
2140
|
+
elements.push(result.val);
|
|
2525
2141
|
}
|
|
2526
|
-
elements.push(result.val);
|
|
2527
2142
|
}
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
if (this.bumpIf("/>")) {
|
|
2537
|
-
return {
|
|
2538
|
-
val: {
|
|
2539
|
-
type: TYPE.literal,
|
|
2540
|
-
value: "<".concat(tagName, "/>"),
|
|
2541
|
-
location: createLocation(startPosition, this.clonePosition())
|
|
2542
|
-
},
|
|
2543
|
-
err: null
|
|
2544
|
-
};
|
|
2545
|
-
} else if (this.bumpIf(">")) {
|
|
2546
|
-
var childrenResult = this.parseMessage(nestingLevel + 1, parentArgType, true);
|
|
2547
|
-
if (childrenResult.err) {
|
|
2548
|
-
return childrenResult;
|
|
2549
|
-
}
|
|
2550
|
-
var children = childrenResult.val;
|
|
2551
|
-
var endTagStartPosition = this.clonePosition();
|
|
2552
|
-
if (this.bumpIf("</")) {
|
|
2553
|
-
if (this.isEOF() || !_isAlpha(this.char())) {
|
|
2554
|
-
return this.error(ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));
|
|
2555
|
-
}
|
|
2556
|
-
var closingTagNameStartPosition = this.clonePosition();
|
|
2557
|
-
var closingTagName = this.parseTagName();
|
|
2558
|
-
if (tagName !== closingTagName) {
|
|
2559
|
-
return this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(closingTagNameStartPosition, this.clonePosition()));
|
|
2560
|
-
}
|
|
2561
|
-
this.bumpSpace();
|
|
2562
|
-
if (!this.bumpIf(">")) {
|
|
2563
|
-
return this.error(ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));
|
|
2564
|
-
}
|
|
2143
|
+
return { val: elements, err: null };
|
|
2144
|
+
};
|
|
2145
|
+
Parser2.prototype.parseTag = function(nestingLevel, parentArgType) {
|
|
2146
|
+
var startPosition = this.clonePosition();
|
|
2147
|
+
this.bump();
|
|
2148
|
+
var tagName = this.parseTagName();
|
|
2149
|
+
this.bumpSpace();
|
|
2150
|
+
if (this.bumpIf("/>")) {
|
|
2565
2151
|
return {
|
|
2566
2152
|
val: {
|
|
2567
|
-
type: TYPE.
|
|
2568
|
-
value: tagName,
|
|
2569
|
-
children,
|
|
2153
|
+
type: TYPE.literal,
|
|
2154
|
+
value: "<".concat(tagName, "/>"),
|
|
2570
2155
|
location: createLocation(startPosition, this.clonePosition())
|
|
2571
2156
|
},
|
|
2572
2157
|
err: null
|
|
2573
2158
|
};
|
|
2159
|
+
} else if (this.bumpIf(">")) {
|
|
2160
|
+
var childrenResult = this.parseMessage(nestingLevel + 1, parentArgType, true);
|
|
2161
|
+
if (childrenResult.err) {
|
|
2162
|
+
return childrenResult;
|
|
2163
|
+
}
|
|
2164
|
+
var children = childrenResult.val;
|
|
2165
|
+
var endTagStartPosition = this.clonePosition();
|
|
2166
|
+
if (this.bumpIf("</")) {
|
|
2167
|
+
if (this.isEOF() || !_isAlpha(this.char())) {
|
|
2168
|
+
return this.error(ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));
|
|
2169
|
+
}
|
|
2170
|
+
var closingTagNameStartPosition = this.clonePosition();
|
|
2171
|
+
var closingTagName = this.parseTagName();
|
|
2172
|
+
if (tagName !== closingTagName) {
|
|
2173
|
+
return this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(closingTagNameStartPosition, this.clonePosition()));
|
|
2174
|
+
}
|
|
2175
|
+
this.bumpSpace();
|
|
2176
|
+
if (!this.bumpIf(">")) {
|
|
2177
|
+
return this.error(ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));
|
|
2178
|
+
}
|
|
2179
|
+
return {
|
|
2180
|
+
val: {
|
|
2181
|
+
type: TYPE.tag,
|
|
2182
|
+
value: tagName,
|
|
2183
|
+
children,
|
|
2184
|
+
location: createLocation(startPosition, this.clonePosition())
|
|
2185
|
+
},
|
|
2186
|
+
err: null
|
|
2187
|
+
};
|
|
2188
|
+
} else {
|
|
2189
|
+
return this.error(ErrorKind.UNCLOSED_TAG, createLocation(startPosition, this.clonePosition()));
|
|
2190
|
+
}
|
|
2574
2191
|
} else {
|
|
2575
|
-
return this.error(ErrorKind.
|
|
2192
|
+
return this.error(ErrorKind.INVALID_TAG, createLocation(startPosition, this.clonePosition()));
|
|
2576
2193
|
}
|
|
2577
|
-
}
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
};
|
|
2581
|
-
Parser2.prototype.parseTagName = function() {
|
|
2582
|
-
var startOffset = this.offset();
|
|
2583
|
-
this.bump();
|
|
2584
|
-
while (!this.isEOF() && _isPotentialElementNameChar(this.char())) {
|
|
2194
|
+
};
|
|
2195
|
+
Parser2.prototype.parseTagName = function() {
|
|
2196
|
+
var startOffset = this.offset();
|
|
2585
2197
|
this.bump();
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
};
|
|
2589
|
-
Parser2.prototype.parseLiteral = function(nestingLevel, parentArgType) {
|
|
2590
|
-
var start = this.clonePosition();
|
|
2591
|
-
var value = "";
|
|
2592
|
-
while (true) {
|
|
2593
|
-
var parseQuoteResult = this.tryParseQuote(parentArgType);
|
|
2594
|
-
if (parseQuoteResult) {
|
|
2595
|
-
value += parseQuoteResult;
|
|
2596
|
-
continue;
|
|
2597
|
-
}
|
|
2598
|
-
var parseUnquotedResult = this.tryParseUnquoted(nestingLevel, parentArgType);
|
|
2599
|
-
if (parseUnquotedResult) {
|
|
2600
|
-
value += parseUnquotedResult;
|
|
2601
|
-
continue;
|
|
2198
|
+
while (!this.isEOF() && _isPotentialElementNameChar(this.char())) {
|
|
2199
|
+
this.bump();
|
|
2602
2200
|
}
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2201
|
+
return this.message.slice(startOffset, this.offset());
|
|
2202
|
+
};
|
|
2203
|
+
Parser2.prototype.parseLiteral = function(nestingLevel, parentArgType) {
|
|
2204
|
+
var start = this.clonePosition();
|
|
2205
|
+
var value = "";
|
|
2206
|
+
while (true) {
|
|
2207
|
+
var parseQuoteResult = this.tryParseQuote(parentArgType);
|
|
2208
|
+
if (parseQuoteResult) {
|
|
2209
|
+
value += parseQuoteResult;
|
|
2210
|
+
continue;
|
|
2211
|
+
}
|
|
2212
|
+
var parseUnquotedResult = this.tryParseUnquoted(nestingLevel, parentArgType);
|
|
2213
|
+
if (parseUnquotedResult) {
|
|
2214
|
+
value += parseUnquotedResult;
|
|
2215
|
+
continue;
|
|
2216
|
+
}
|
|
2217
|
+
var parseLeftAngleResult = this.tryParseLeftAngleBracket();
|
|
2218
|
+
if (parseLeftAngleResult) {
|
|
2219
|
+
value += parseLeftAngleResult;
|
|
2220
|
+
continue;
|
|
2221
|
+
}
|
|
2222
|
+
break;
|
|
2607
2223
|
}
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
err: null
|
|
2224
|
+
var location = createLocation(start, this.clonePosition());
|
|
2225
|
+
return {
|
|
2226
|
+
val: { type: TYPE.literal, value, location },
|
|
2227
|
+
err: null
|
|
2228
|
+
};
|
|
2614
2229
|
};
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
this.bump();
|
|
2619
|
-
return "<";
|
|
2620
|
-
}
|
|
2621
|
-
return null;
|
|
2622
|
-
};
|
|
2623
|
-
Parser2.prototype.tryParseQuote = function(parentArgType) {
|
|
2624
|
-
if (this.isEOF() || this.char() !== 39) {
|
|
2625
|
-
return null;
|
|
2626
|
-
}
|
|
2627
|
-
switch (this.peek()) {
|
|
2628
|
-
case 39:
|
|
2230
|
+
Parser2.prototype.tryParseLeftAngleBracket = function() {
|
|
2231
|
+
if (!this.isEOF() && this.char() === 60 && (this.ignoreTag || // If at the opening tag or closing tag position, bail.
|
|
2232
|
+
!_isAlphaOrSlash(this.peek() || 0))) {
|
|
2629
2233
|
this.bump();
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
break;
|
|
2637
|
-
case 35:
|
|
2638
|
-
if (parentArgType === "plural" || parentArgType === "selectordinal") {
|
|
2639
|
-
break;
|
|
2640
|
-
}
|
|
2641
|
-
return null;
|
|
2642
|
-
default:
|
|
2234
|
+
return "<";
|
|
2235
|
+
}
|
|
2236
|
+
return null;
|
|
2237
|
+
};
|
|
2238
|
+
Parser2.prototype.tryParseQuote = function(parentArgType) {
|
|
2239
|
+
if (this.isEOF() || this.char() !== 39) {
|
|
2643
2240
|
return null;
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
this.bump();
|
|
2648
|
-
while (!this.isEOF()) {
|
|
2649
|
-
var ch = this.char();
|
|
2650
|
-
if (ch === 39) {
|
|
2651
|
-
if (this.peek() === 39) {
|
|
2652
|
-
codePoints.push(39);
|
|
2241
|
+
}
|
|
2242
|
+
switch (this.peek()) {
|
|
2243
|
+
case 39:
|
|
2653
2244
|
this.bump();
|
|
2654
|
-
} else {
|
|
2655
2245
|
this.bump();
|
|
2246
|
+
return "'";
|
|
2247
|
+
case 123:
|
|
2248
|
+
case 60:
|
|
2249
|
+
case 62:
|
|
2250
|
+
case 125:
|
|
2656
2251
|
break;
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2252
|
+
case 35:
|
|
2253
|
+
if (parentArgType === "plural" || parentArgType === "selectordinal") {
|
|
2254
|
+
break;
|
|
2255
|
+
}
|
|
2256
|
+
return null;
|
|
2257
|
+
default:
|
|
2258
|
+
return null;
|
|
2660
2259
|
}
|
|
2661
2260
|
this.bump();
|
|
2662
|
-
|
|
2663
|
-
return fromCodePoint.apply(void 0, codePoints);
|
|
2664
|
-
};
|
|
2665
|
-
Parser2.prototype.tryParseUnquoted = function(nestingLevel, parentArgType) {
|
|
2666
|
-
if (this.isEOF()) {
|
|
2667
|
-
return null;
|
|
2668
|
-
}
|
|
2669
|
-
var ch = this.char();
|
|
2670
|
-
if (ch === 60 || ch === 123 || ch === 35 && (parentArgType === "plural" || parentArgType === "selectordinal") || ch === 125 && nestingLevel > 0) {
|
|
2671
|
-
return null;
|
|
2672
|
-
} else {
|
|
2673
|
-
this.bump();
|
|
2674
|
-
return fromCodePoint(ch);
|
|
2675
|
-
}
|
|
2676
|
-
};
|
|
2677
|
-
Parser2.prototype.parseArgument = function(nestingLevel, expectingCloseTag) {
|
|
2678
|
-
var openingBracePosition = this.clonePosition();
|
|
2679
|
-
this.bump();
|
|
2680
|
-
this.bumpSpace();
|
|
2681
|
-
if (this.isEOF()) {
|
|
2682
|
-
return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
2683
|
-
}
|
|
2684
|
-
if (this.char() === 125) {
|
|
2261
|
+
var codePoints = [this.char()];
|
|
2685
2262
|
this.bump();
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2263
|
+
while (!this.isEOF()) {
|
|
2264
|
+
var ch = this.char();
|
|
2265
|
+
if (ch === 39) {
|
|
2266
|
+
if (this.peek() === 39) {
|
|
2267
|
+
codePoints.push(39);
|
|
2268
|
+
this.bump();
|
|
2269
|
+
} else {
|
|
2270
|
+
this.bump();
|
|
2271
|
+
break;
|
|
2272
|
+
}
|
|
2273
|
+
} else {
|
|
2274
|
+
codePoints.push(ch);
|
|
2275
|
+
}
|
|
2698
2276
|
this.bump();
|
|
2699
|
-
return {
|
|
2700
|
-
val: {
|
|
2701
|
-
type: TYPE.argument,
|
|
2702
|
-
value,
|
|
2703
|
-
location: createLocation(openingBracePosition, this.clonePosition())
|
|
2704
|
-
},
|
|
2705
|
-
err: null
|
|
2706
|
-
};
|
|
2707
2277
|
}
|
|
2708
|
-
|
|
2278
|
+
return fromCodePoint.apply(void 0, codePoints);
|
|
2279
|
+
};
|
|
2280
|
+
Parser2.prototype.tryParseUnquoted = function(nestingLevel, parentArgType) {
|
|
2281
|
+
if (this.isEOF()) {
|
|
2282
|
+
return null;
|
|
2283
|
+
}
|
|
2284
|
+
var ch = this.char();
|
|
2285
|
+
if (ch === 60 || ch === 123 || ch === 35 && (parentArgType === "plural" || parentArgType === "selectordinal") || ch === 125 && nestingLevel > 0) {
|
|
2286
|
+
return null;
|
|
2287
|
+
} else {
|
|
2709
2288
|
this.bump();
|
|
2710
|
-
|
|
2711
|
-
if (this.isEOF()) {
|
|
2712
|
-
return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
2713
|
-
}
|
|
2714
|
-
return this.parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition);
|
|
2289
|
+
return fromCodePoint(ch);
|
|
2715
2290
|
}
|
|
2716
|
-
|
|
2291
|
+
};
|
|
2292
|
+
Parser2.prototype.parseArgument = function(nestingLevel, expectingCloseTag) {
|
|
2293
|
+
var openingBracePosition = this.clonePosition();
|
|
2294
|
+
this.bump();
|
|
2295
|
+
this.bumpSpace();
|
|
2296
|
+
if (this.isEOF()) {
|
|
2297
|
+
return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
2298
|
+
}
|
|
2299
|
+
if (this.char() === 125) {
|
|
2300
|
+
this.bump();
|
|
2301
|
+
return this.error(ErrorKind.EMPTY_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
|
|
2302
|
+
}
|
|
2303
|
+
var value = this.parseIdentifierIfPossible().value;
|
|
2304
|
+
if (!value) {
|
|
2717
2305
|
return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
switch (argType) {
|
|
2736
|
-
case "":
|
|
2737
|
-
return this.error(ErrorKind.EXPECT_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));
|
|
2738
|
-
case "number":
|
|
2739
|
-
case "date":
|
|
2740
|
-
case "time": {
|
|
2741
|
-
this.bumpSpace();
|
|
2742
|
-
var styleAndLocation = null;
|
|
2743
|
-
if (this.bumpIf(",")) {
|
|
2744
|
-
this.bumpSpace();
|
|
2745
|
-
var styleStartPosition = this.clonePosition();
|
|
2746
|
-
var result = this.parseSimpleArgStyleIfPossible();
|
|
2747
|
-
if (result.err) {
|
|
2748
|
-
return result;
|
|
2749
|
-
}
|
|
2750
|
-
var style = trimEnd(result.val);
|
|
2751
|
-
if (style.length === 0) {
|
|
2752
|
-
return this.error(ErrorKind.EXPECT_ARGUMENT_STYLE, createLocation(this.clonePosition(), this.clonePosition()));
|
|
2753
|
-
}
|
|
2754
|
-
var styleLocation = createLocation(styleStartPosition, this.clonePosition());
|
|
2755
|
-
styleAndLocation = { style, styleLocation };
|
|
2756
|
-
}
|
|
2757
|
-
var argCloseResult = this.tryParseArgumentClose(openingBracePosition);
|
|
2758
|
-
if (argCloseResult.err) {
|
|
2759
|
-
return argCloseResult;
|
|
2306
|
+
}
|
|
2307
|
+
this.bumpSpace();
|
|
2308
|
+
if (this.isEOF()) {
|
|
2309
|
+
return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
2310
|
+
}
|
|
2311
|
+
switch (this.char()) {
|
|
2312
|
+
case 125: {
|
|
2313
|
+
this.bump();
|
|
2314
|
+
return {
|
|
2315
|
+
val: {
|
|
2316
|
+
type: TYPE.argument,
|
|
2317
|
+
// value does not include the opening and closing braces.
|
|
2318
|
+
value,
|
|
2319
|
+
location: createLocation(openingBracePosition, this.clonePosition())
|
|
2320
|
+
},
|
|
2321
|
+
err: null
|
|
2322
|
+
};
|
|
2760
2323
|
}
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
if (
|
|
2765
|
-
|
|
2324
|
+
case 44: {
|
|
2325
|
+
this.bump();
|
|
2326
|
+
this.bumpSpace();
|
|
2327
|
+
if (this.isEOF()) {
|
|
2328
|
+
return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
2329
|
+
}
|
|
2330
|
+
return this.parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition);
|
|
2331
|
+
}
|
|
2332
|
+
default:
|
|
2333
|
+
return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
|
|
2334
|
+
}
|
|
2335
|
+
};
|
|
2336
|
+
Parser2.prototype.parseIdentifierIfPossible = function() {
|
|
2337
|
+
var startingPosition = this.clonePosition();
|
|
2338
|
+
var startOffset = this.offset();
|
|
2339
|
+
var value = matchIdentifierAtIndex(this.message, startOffset);
|
|
2340
|
+
var endOffset = startOffset + value.length;
|
|
2341
|
+
this.bumpTo(endOffset);
|
|
2342
|
+
var endPosition = this.clonePosition();
|
|
2343
|
+
var location = createLocation(startingPosition, endPosition);
|
|
2344
|
+
return { value, location };
|
|
2345
|
+
};
|
|
2346
|
+
Parser2.prototype.parseArgumentOptions = function(nestingLevel, expectingCloseTag, value, openingBracePosition) {
|
|
2347
|
+
var _a2;
|
|
2348
|
+
var typeStartPosition = this.clonePosition();
|
|
2349
|
+
var argType = this.parseIdentifierIfPossible().value;
|
|
2350
|
+
var typeEndPosition = this.clonePosition();
|
|
2351
|
+
switch (argType) {
|
|
2352
|
+
case "":
|
|
2353
|
+
return this.error(ErrorKind.EXPECT_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));
|
|
2354
|
+
case "number":
|
|
2355
|
+
case "date":
|
|
2356
|
+
case "time": {
|
|
2357
|
+
this.bumpSpace();
|
|
2358
|
+
var styleAndLocation = null;
|
|
2359
|
+
if (this.bumpIf(",")) {
|
|
2360
|
+
this.bumpSpace();
|
|
2361
|
+
var styleStartPosition = this.clonePosition();
|
|
2362
|
+
var result = this.parseSimpleArgStyleIfPossible();
|
|
2766
2363
|
if (result.err) {
|
|
2767
2364
|
return result;
|
|
2768
2365
|
}
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
};
|
|
2773
|
-
} else {
|
|
2774
|
-
if (skeleton.length === 0) {
|
|
2775
|
-
return this.error(ErrorKind.EXPECT_DATE_TIME_SKELETON, location_1);
|
|
2776
|
-
}
|
|
2777
|
-
var dateTimePattern = skeleton;
|
|
2778
|
-
if (this.locale) {
|
|
2779
|
-
dateTimePattern = getBestPattern(skeleton, this.locale);
|
|
2366
|
+
var style = trimEnd(result.val);
|
|
2367
|
+
if (style.length === 0) {
|
|
2368
|
+
return this.error(ErrorKind.EXPECT_ARGUMENT_STYLE, createLocation(this.clonePosition(), this.clonePosition()));
|
|
2780
2369
|
}
|
|
2781
|
-
var
|
|
2782
|
-
|
|
2783
|
-
pattern: dateTimePattern,
|
|
2784
|
-
location: styleAndLocation.styleLocation,
|
|
2785
|
-
parsedOptions: this.shouldParseSkeletons ? parseDateTimeSkeleton(dateTimePattern) : {}
|
|
2786
|
-
};
|
|
2787
|
-
var type = argType === "date" ? TYPE.date : TYPE.time;
|
|
2788
|
-
return {
|
|
2789
|
-
val: { type, value, location: location_1, style },
|
|
2790
|
-
err: null
|
|
2791
|
-
};
|
|
2370
|
+
var styleLocation = createLocation(styleStartPosition, this.clonePosition());
|
|
2371
|
+
styleAndLocation = { style, styleLocation };
|
|
2792
2372
|
}
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
type: argType === "number" ? TYPE.number : argType === "date" ? TYPE.date : TYPE.time,
|
|
2797
|
-
value,
|
|
2798
|
-
location: location_1,
|
|
2799
|
-
style: (_a2 = styleAndLocation === null || styleAndLocation === void 0 ? void 0 : styleAndLocation.style) !== null && _a2 !== void 0 ? _a2 : null
|
|
2800
|
-
},
|
|
2801
|
-
err: null
|
|
2802
|
-
};
|
|
2803
|
-
}
|
|
2804
|
-
case "plural":
|
|
2805
|
-
case "selectordinal":
|
|
2806
|
-
case "select": {
|
|
2807
|
-
var typeEndPosition_1 = this.clonePosition();
|
|
2808
|
-
this.bumpSpace();
|
|
2809
|
-
if (!this.bumpIf(",")) {
|
|
2810
|
-
return this.error(ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, createLocation(typeEndPosition_1, __assign({}, typeEndPosition_1)));
|
|
2811
|
-
}
|
|
2812
|
-
this.bumpSpace();
|
|
2813
|
-
var identifierAndLocation = this.parseIdentifierIfPossible();
|
|
2814
|
-
var pluralOffset = 0;
|
|
2815
|
-
if (argType !== "select" && identifierAndLocation.value === "offset") {
|
|
2816
|
-
if (!this.bumpIf(":")) {
|
|
2817
|
-
return this.error(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, createLocation(this.clonePosition(), this.clonePosition()));
|
|
2373
|
+
var argCloseResult = this.tryParseArgumentClose(openingBracePosition);
|
|
2374
|
+
if (argCloseResult.err) {
|
|
2375
|
+
return argCloseResult;
|
|
2818
2376
|
}
|
|
2819
|
-
this.
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2377
|
+
var location_1 = createLocation(openingBracePosition, this.clonePosition());
|
|
2378
|
+
if (styleAndLocation && startsWith(styleAndLocation === null || styleAndLocation === void 0 ? void 0 : styleAndLocation.style, "::", 0)) {
|
|
2379
|
+
var skeleton = trimStart(styleAndLocation.style.slice(2));
|
|
2380
|
+
if (argType === "number") {
|
|
2381
|
+
var result = this.parseNumberSkeletonFromString(skeleton, styleAndLocation.styleLocation);
|
|
2382
|
+
if (result.err) {
|
|
2383
|
+
return result;
|
|
2384
|
+
}
|
|
2385
|
+
return {
|
|
2386
|
+
val: { type: TYPE.number, value, location: location_1, style: result.val },
|
|
2387
|
+
err: null
|
|
2388
|
+
};
|
|
2389
|
+
} else {
|
|
2390
|
+
if (skeleton.length === 0) {
|
|
2391
|
+
return this.error(ErrorKind.EXPECT_DATE_TIME_SKELETON, location_1);
|
|
2392
|
+
}
|
|
2393
|
+
var dateTimePattern = skeleton;
|
|
2394
|
+
if (this.locale) {
|
|
2395
|
+
dateTimePattern = getBestPattern(skeleton, this.locale);
|
|
2396
|
+
}
|
|
2397
|
+
var style = {
|
|
2398
|
+
type: SKELETON_TYPE.dateTime,
|
|
2399
|
+
pattern: dateTimePattern,
|
|
2400
|
+
location: styleAndLocation.styleLocation,
|
|
2401
|
+
parsedOptions: this.shouldParseSkeletons ? parseDateTimeSkeleton(dateTimePattern) : {}
|
|
2402
|
+
};
|
|
2403
|
+
var type = argType === "date" ? TYPE.date : TYPE.time;
|
|
2404
|
+
return {
|
|
2405
|
+
val: { type, value, location: location_1, style },
|
|
2406
|
+
err: null
|
|
2407
|
+
};
|
|
2408
|
+
}
|
|
2823
2409
|
}
|
|
2824
|
-
this.bumpSpace();
|
|
2825
|
-
identifierAndLocation = this.parseIdentifierIfPossible();
|
|
2826
|
-
pluralOffset = result.val;
|
|
2827
|
-
}
|
|
2828
|
-
var optionsResult = this.tryParsePluralOrSelectOptions(nestingLevel, argType, expectingCloseTag, identifierAndLocation);
|
|
2829
|
-
if (optionsResult.err) {
|
|
2830
|
-
return optionsResult;
|
|
2831
|
-
}
|
|
2832
|
-
var argCloseResult = this.tryParseArgumentClose(openingBracePosition);
|
|
2833
|
-
if (argCloseResult.err) {
|
|
2834
|
-
return argCloseResult;
|
|
2835
|
-
}
|
|
2836
|
-
var location_2 = createLocation(openingBracePosition, this.clonePosition());
|
|
2837
|
-
if (argType === "select") {
|
|
2838
2410
|
return {
|
|
2839
2411
|
val: {
|
|
2840
|
-
type: TYPE.
|
|
2412
|
+
type: argType === "number" ? TYPE.number : argType === "date" ? TYPE.date : TYPE.time,
|
|
2841
2413
|
value,
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
},
|
|
2845
|
-
err: null
|
|
2846
|
-
};
|
|
2847
|
-
} else {
|
|
2848
|
-
return {
|
|
2849
|
-
val: {
|
|
2850
|
-
type: TYPE.plural,
|
|
2851
|
-
value,
|
|
2852
|
-
options: fromEntries(optionsResult.val),
|
|
2853
|
-
offset: pluralOffset,
|
|
2854
|
-
pluralType: argType === "plural" ? "cardinal" : "ordinal",
|
|
2855
|
-
location: location_2
|
|
2414
|
+
location: location_1,
|
|
2415
|
+
style: (_a2 = styleAndLocation === null || styleAndLocation === void 0 ? void 0 : styleAndLocation.style) !== null && _a2 !== void 0 ? _a2 : null
|
|
2856
2416
|
},
|
|
2857
2417
|
err: null
|
|
2858
2418
|
};
|
|
2859
2419
|
}
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
2868
|
-
}
|
|
2869
|
-
this.bump();
|
|
2870
|
-
return { val: true, err: null };
|
|
2871
|
-
};
|
|
2872
|
-
Parser2.prototype.parseSimpleArgStyleIfPossible = function() {
|
|
2873
|
-
var nestedBraces = 0;
|
|
2874
|
-
var startPosition = this.clonePosition();
|
|
2875
|
-
while (!this.isEOF()) {
|
|
2876
|
-
var ch = this.char();
|
|
2877
|
-
switch (ch) {
|
|
2878
|
-
case 39: {
|
|
2879
|
-
this.bump();
|
|
2880
|
-
var apostrophePosition = this.clonePosition();
|
|
2881
|
-
if (!this.bumpUntil("'")) {
|
|
2882
|
-
return this.error(ErrorKind.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, createLocation(apostrophePosition, this.clonePosition()));
|
|
2420
|
+
case "plural":
|
|
2421
|
+
case "selectordinal":
|
|
2422
|
+
case "select": {
|
|
2423
|
+
var typeEndPosition_1 = this.clonePosition();
|
|
2424
|
+
this.bumpSpace();
|
|
2425
|
+
if (!this.bumpIf(",")) {
|
|
2426
|
+
return this.error(ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, createLocation(typeEndPosition_1, __assign({}, typeEndPosition_1)));
|
|
2883
2427
|
}
|
|
2884
|
-
this.
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2428
|
+
this.bumpSpace();
|
|
2429
|
+
var identifierAndLocation = this.parseIdentifierIfPossible();
|
|
2430
|
+
var pluralOffset = 0;
|
|
2431
|
+
if (argType !== "select" && identifierAndLocation.value === "offset") {
|
|
2432
|
+
if (!this.bumpIf(":")) {
|
|
2433
|
+
return this.error(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, createLocation(this.clonePosition(), this.clonePosition()));
|
|
2434
|
+
}
|
|
2435
|
+
this.bumpSpace();
|
|
2436
|
+
var result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, ErrorKind.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);
|
|
2437
|
+
if (result.err) {
|
|
2438
|
+
return result;
|
|
2439
|
+
}
|
|
2440
|
+
this.bumpSpace();
|
|
2441
|
+
identifierAndLocation = this.parseIdentifierIfPossible();
|
|
2442
|
+
pluralOffset = result.val;
|
|
2443
|
+
}
|
|
2444
|
+
var optionsResult = this.tryParsePluralOrSelectOptions(nestingLevel, argType, expectingCloseTag, identifierAndLocation);
|
|
2445
|
+
if (optionsResult.err) {
|
|
2446
|
+
return optionsResult;
|
|
2447
|
+
}
|
|
2448
|
+
var argCloseResult = this.tryParseArgumentClose(openingBracePosition);
|
|
2449
|
+
if (argCloseResult.err) {
|
|
2450
|
+
return argCloseResult;
|
|
2451
|
+
}
|
|
2452
|
+
var location_2 = createLocation(openingBracePosition, this.clonePosition());
|
|
2453
|
+
if (argType === "select") {
|
|
2454
|
+
return {
|
|
2455
|
+
val: {
|
|
2456
|
+
type: TYPE.select,
|
|
2457
|
+
value,
|
|
2458
|
+
options: fromEntries(optionsResult.val),
|
|
2459
|
+
location: location_2
|
|
2460
|
+
},
|
|
2461
|
+
err: null
|
|
2462
|
+
};
|
|
2895
2463
|
} else {
|
|
2896
2464
|
return {
|
|
2897
|
-
val:
|
|
2465
|
+
val: {
|
|
2466
|
+
type: TYPE.plural,
|
|
2467
|
+
value,
|
|
2468
|
+
options: fromEntries(optionsResult.val),
|
|
2469
|
+
offset: pluralOffset,
|
|
2470
|
+
pluralType: argType === "plural" ? "cardinal" : "ordinal",
|
|
2471
|
+
location: location_2
|
|
2472
|
+
},
|
|
2898
2473
|
err: null
|
|
2899
2474
|
};
|
|
2900
2475
|
}
|
|
2901
|
-
break;
|
|
2902
2476
|
}
|
|
2903
2477
|
default:
|
|
2904
|
-
this.
|
|
2905
|
-
break;
|
|
2478
|
+
return this.error(ErrorKind.INVALID_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));
|
|
2906
2479
|
}
|
|
2907
|
-
}
|
|
2908
|
-
return {
|
|
2909
|
-
val: this.message.slice(startPosition.offset, this.offset()),
|
|
2910
|
-
err: null
|
|
2911
2480
|
};
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
return this.error(ErrorKind.INVALID_NUMBER_SKELETON, location);
|
|
2919
|
-
}
|
|
2920
|
-
return {
|
|
2921
|
-
val: {
|
|
2922
|
-
type: SKELETON_TYPE.number,
|
|
2923
|
-
tokens,
|
|
2924
|
-
location,
|
|
2925
|
-
parsedOptions: this.shouldParseSkeletons ? parseNumberSkeleton(tokens) : {}
|
|
2926
|
-
},
|
|
2927
|
-
err: null
|
|
2481
|
+
Parser2.prototype.tryParseArgumentClose = function(openingBracePosition) {
|
|
2482
|
+
if (this.isEOF() || this.char() !== 125) {
|
|
2483
|
+
return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
2484
|
+
}
|
|
2485
|
+
this.bump();
|
|
2486
|
+
return { val: true, err: null };
|
|
2928
2487
|
};
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2488
|
+
Parser2.prototype.parseSimpleArgStyleIfPossible = function() {
|
|
2489
|
+
var nestedBraces = 0;
|
|
2490
|
+
var startPosition = this.clonePosition();
|
|
2491
|
+
while (!this.isEOF()) {
|
|
2492
|
+
var ch = this.char();
|
|
2493
|
+
switch (ch) {
|
|
2494
|
+
case 39: {
|
|
2495
|
+
this.bump();
|
|
2496
|
+
var apostrophePosition = this.clonePosition();
|
|
2497
|
+
if (!this.bumpUntil("'")) {
|
|
2498
|
+
return this.error(ErrorKind.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, createLocation(apostrophePosition, this.clonePosition()));
|
|
2499
|
+
}
|
|
2500
|
+
this.bump();
|
|
2501
|
+
break;
|
|
2502
|
+
}
|
|
2503
|
+
case 123: {
|
|
2504
|
+
nestedBraces += 1;
|
|
2505
|
+
this.bump();
|
|
2506
|
+
break;
|
|
2507
|
+
}
|
|
2508
|
+
case 125: {
|
|
2509
|
+
if (nestedBraces > 0) {
|
|
2510
|
+
nestedBraces -= 1;
|
|
2511
|
+
} else {
|
|
2512
|
+
return {
|
|
2513
|
+
val: this.message.slice(startPosition.offset, this.offset()),
|
|
2514
|
+
err: null
|
|
2515
|
+
};
|
|
2516
|
+
}
|
|
2517
|
+
break;
|
|
2518
|
+
}
|
|
2519
|
+
default:
|
|
2520
|
+
this.bump();
|
|
2521
|
+
break;
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2524
|
+
return {
|
|
2525
|
+
val: this.message.slice(startPosition.offset, this.offset()),
|
|
2526
|
+
err: null
|
|
2527
|
+
};
|
|
2528
|
+
};
|
|
2529
|
+
Parser2.prototype.parseNumberSkeletonFromString = function(skeleton, location) {
|
|
2530
|
+
var tokens = [];
|
|
2531
|
+
try {
|
|
2532
|
+
tokens = parseNumberSkeletonFromString(skeleton);
|
|
2533
|
+
} catch (e) {
|
|
2534
|
+
return this.error(ErrorKind.INVALID_NUMBER_SKELETON, location);
|
|
2535
|
+
}
|
|
2536
|
+
return {
|
|
2537
|
+
val: {
|
|
2538
|
+
type: SKELETON_TYPE.number,
|
|
2539
|
+
tokens,
|
|
2540
|
+
location,
|
|
2541
|
+
parsedOptions: this.shouldParseSkeletons ? parseNumberSkeleton(tokens) : {}
|
|
2542
|
+
},
|
|
2543
|
+
err: null
|
|
2544
|
+
};
|
|
2545
|
+
};
|
|
2546
|
+
Parser2.prototype.tryParsePluralOrSelectOptions = function(nestingLevel, parentArgType, expectCloseTag, parsedFirstIdentifier) {
|
|
2547
|
+
var _a2;
|
|
2548
|
+
var hasOtherClause = false;
|
|
2549
|
+
var options = [];
|
|
2550
|
+
var parsedSelectors = /* @__PURE__ */ new Set();
|
|
2551
|
+
var selector = parsedFirstIdentifier.value, selectorLocation = parsedFirstIdentifier.location;
|
|
2552
|
+
while (true) {
|
|
2553
|
+
if (selector.length === 0) {
|
|
2554
|
+
var startPosition = this.clonePosition();
|
|
2555
|
+
if (parentArgType !== "select" && this.bumpIf("=")) {
|
|
2556
|
+
var result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, ErrorKind.INVALID_PLURAL_ARGUMENT_SELECTOR);
|
|
2557
|
+
if (result.err) {
|
|
2558
|
+
return result;
|
|
2559
|
+
}
|
|
2560
|
+
selectorLocation = createLocation(startPosition, this.clonePosition());
|
|
2561
|
+
selector = this.message.slice(startPosition.offset, this.offset());
|
|
2562
|
+
} else {
|
|
2563
|
+
break;
|
|
2943
2564
|
}
|
|
2944
|
-
|
|
2945
|
-
|
|
2565
|
+
}
|
|
2566
|
+
if (parsedSelectors.has(selector)) {
|
|
2567
|
+
return this.error(parentArgType === "select" ? ErrorKind.DUPLICATE_SELECT_ARGUMENT_SELECTOR : ErrorKind.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, selectorLocation);
|
|
2568
|
+
}
|
|
2569
|
+
if (selector === "other") {
|
|
2570
|
+
hasOtherClause = true;
|
|
2571
|
+
}
|
|
2572
|
+
this.bumpSpace();
|
|
2573
|
+
var openingBracePosition = this.clonePosition();
|
|
2574
|
+
if (!this.bumpIf("{")) {
|
|
2575
|
+
return this.error(parentArgType === "select" ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, createLocation(this.clonePosition(), this.clonePosition()));
|
|
2576
|
+
}
|
|
2577
|
+
var fragmentResult = this.parseMessage(nestingLevel + 1, parentArgType, expectCloseTag);
|
|
2578
|
+
if (fragmentResult.err) {
|
|
2579
|
+
return fragmentResult;
|
|
2580
|
+
}
|
|
2581
|
+
var argCloseResult = this.tryParseArgumentClose(openingBracePosition);
|
|
2582
|
+
if (argCloseResult.err) {
|
|
2583
|
+
return argCloseResult;
|
|
2584
|
+
}
|
|
2585
|
+
options.push([
|
|
2586
|
+
selector,
|
|
2587
|
+
{
|
|
2588
|
+
value: fragmentResult.val,
|
|
2589
|
+
location: createLocation(openingBracePosition, this.clonePosition())
|
|
2590
|
+
}
|
|
2591
|
+
]);
|
|
2592
|
+
parsedSelectors.add(selector);
|
|
2593
|
+
this.bumpSpace();
|
|
2594
|
+
_a2 = this.parseIdentifierIfPossible(), selector = _a2.value, selectorLocation = _a2.location;
|
|
2595
|
+
}
|
|
2596
|
+
if (options.length === 0) {
|
|
2597
|
+
return this.error(parentArgType === "select" ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, createLocation(this.clonePosition(), this.clonePosition()));
|
|
2598
|
+
}
|
|
2599
|
+
if (this.requiresOtherClause && !hasOtherClause) {
|
|
2600
|
+
return this.error(ErrorKind.MISSING_OTHER_CLAUSE, createLocation(this.clonePosition(), this.clonePosition()));
|
|
2601
|
+
}
|
|
2602
|
+
return { val: options, err: null };
|
|
2603
|
+
};
|
|
2604
|
+
Parser2.prototype.tryParseDecimalInteger = function(expectNumberError, invalidNumberError) {
|
|
2605
|
+
var sign = 1;
|
|
2606
|
+
var startingPosition = this.clonePosition();
|
|
2607
|
+
if (this.bumpIf("+")) {
|
|
2608
|
+
} else if (this.bumpIf("-")) {
|
|
2609
|
+
sign = -1;
|
|
2610
|
+
}
|
|
2611
|
+
var hasDigits = false;
|
|
2612
|
+
var decimal = 0;
|
|
2613
|
+
while (!this.isEOF()) {
|
|
2614
|
+
var ch = this.char();
|
|
2615
|
+
if (ch >= 48 && ch <= 57) {
|
|
2616
|
+
hasDigits = true;
|
|
2617
|
+
decimal = decimal * 10 + (ch - 48);
|
|
2618
|
+
this.bump();
|
|
2946
2619
|
} else {
|
|
2947
2620
|
break;
|
|
2948
2621
|
}
|
|
2949
2622
|
}
|
|
2950
|
-
|
|
2951
|
-
|
|
2623
|
+
var location = createLocation(startingPosition, this.clonePosition());
|
|
2624
|
+
if (!hasDigits) {
|
|
2625
|
+
return this.error(expectNumberError, location);
|
|
2952
2626
|
}
|
|
2953
|
-
|
|
2954
|
-
|
|
2627
|
+
decimal *= sign;
|
|
2628
|
+
if (!isSafeInteger(decimal)) {
|
|
2629
|
+
return this.error(invalidNumberError, location);
|
|
2955
2630
|
}
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2631
|
+
return { val: decimal, err: null };
|
|
2632
|
+
};
|
|
2633
|
+
Parser2.prototype.offset = function() {
|
|
2634
|
+
return this.position.offset;
|
|
2635
|
+
};
|
|
2636
|
+
Parser2.prototype.isEOF = function() {
|
|
2637
|
+
return this.offset() === this.message.length;
|
|
2638
|
+
};
|
|
2639
|
+
Parser2.prototype.clonePosition = function() {
|
|
2640
|
+
return {
|
|
2641
|
+
offset: this.position.offset,
|
|
2642
|
+
line: this.position.line,
|
|
2643
|
+
column: this.position.column
|
|
2644
|
+
};
|
|
2645
|
+
};
|
|
2646
|
+
Parser2.prototype.char = function() {
|
|
2647
|
+
var offset = this.position.offset;
|
|
2648
|
+
if (offset >= this.message.length) {
|
|
2649
|
+
throw Error("out of bound");
|
|
2650
|
+
}
|
|
2651
|
+
var code = codePointAt(this.message, offset);
|
|
2652
|
+
if (code === void 0) {
|
|
2653
|
+
throw Error("Offset ".concat(offset, " is at invalid UTF-16 code unit boundary"));
|
|
2654
|
+
}
|
|
2655
|
+
return code;
|
|
2656
|
+
};
|
|
2657
|
+
Parser2.prototype.error = function(kind, location) {
|
|
2658
|
+
return {
|
|
2659
|
+
val: null,
|
|
2660
|
+
err: {
|
|
2661
|
+
kind,
|
|
2662
|
+
message: this.message,
|
|
2663
|
+
location
|
|
2974
2664
|
}
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
return { val: options, err: null };
|
|
2987
|
-
};
|
|
2988
|
-
Parser2.prototype.tryParseDecimalInteger = function(expectNumberError, invalidNumberError) {
|
|
2989
|
-
var sign = 1;
|
|
2990
|
-
var startingPosition = this.clonePosition();
|
|
2991
|
-
if (this.bumpIf("+")) {
|
|
2992
|
-
} else if (this.bumpIf("-")) {
|
|
2993
|
-
sign = -1;
|
|
2994
|
-
}
|
|
2995
|
-
var hasDigits = false;
|
|
2996
|
-
var decimal = 0;
|
|
2997
|
-
while (!this.isEOF()) {
|
|
2998
|
-
var ch = this.char();
|
|
2999
|
-
if (ch >= 48 && ch <= 57) {
|
|
3000
|
-
hasDigits = true;
|
|
3001
|
-
decimal = decimal * 10 + (ch - 48);
|
|
3002
|
-
this.bump();
|
|
2665
|
+
};
|
|
2666
|
+
};
|
|
2667
|
+
Parser2.prototype.bump = function() {
|
|
2668
|
+
if (this.isEOF()) {
|
|
2669
|
+
return;
|
|
2670
|
+
}
|
|
2671
|
+
var code = this.char();
|
|
2672
|
+
if (code === 10) {
|
|
2673
|
+
this.position.line += 1;
|
|
2674
|
+
this.position.column = 1;
|
|
2675
|
+
this.position.offset += 1;
|
|
3003
2676
|
} else {
|
|
3004
|
-
|
|
2677
|
+
this.position.column += 1;
|
|
2678
|
+
this.position.offset += code < 65536 ? 1 : 2;
|
|
3005
2679
|
}
|
|
3006
|
-
}
|
|
3007
|
-
var location = createLocation(startingPosition, this.clonePosition());
|
|
3008
|
-
if (!hasDigits) {
|
|
3009
|
-
return this.error(expectNumberError, location);
|
|
3010
|
-
}
|
|
3011
|
-
decimal *= sign;
|
|
3012
|
-
if (!isSafeInteger(decimal)) {
|
|
3013
|
-
return this.error(invalidNumberError, location);
|
|
3014
|
-
}
|
|
3015
|
-
return { val: decimal, err: null };
|
|
3016
|
-
};
|
|
3017
|
-
Parser2.prototype.offset = function() {
|
|
3018
|
-
return this.position.offset;
|
|
3019
|
-
};
|
|
3020
|
-
Parser2.prototype.isEOF = function() {
|
|
3021
|
-
return this.offset() === this.message.length;
|
|
3022
|
-
};
|
|
3023
|
-
Parser2.prototype.clonePosition = function() {
|
|
3024
|
-
return {
|
|
3025
|
-
offset: this.position.offset,
|
|
3026
|
-
line: this.position.line,
|
|
3027
|
-
column: this.position.column
|
|
3028
2680
|
};
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
var code = codePointAt(this.message, offset);
|
|
3036
|
-
if (code === void 0) {
|
|
3037
|
-
throw Error("Offset ".concat(offset, " is at invalid UTF-16 code unit boundary"));
|
|
3038
|
-
}
|
|
3039
|
-
return code;
|
|
3040
|
-
};
|
|
3041
|
-
Parser2.prototype.error = function(kind, location) {
|
|
3042
|
-
return {
|
|
3043
|
-
val: null,
|
|
3044
|
-
err: {
|
|
3045
|
-
kind,
|
|
3046
|
-
message: this.message,
|
|
3047
|
-
location
|
|
2681
|
+
Parser2.prototype.bumpIf = function(prefix) {
|
|
2682
|
+
if (startsWith(this.message, prefix, this.offset())) {
|
|
2683
|
+
for (var i = 0; i < prefix.length; i++) {
|
|
2684
|
+
this.bump();
|
|
2685
|
+
}
|
|
2686
|
+
return true;
|
|
3048
2687
|
}
|
|
2688
|
+
return false;
|
|
3049
2689
|
};
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
this.position.offset += 1;
|
|
3060
|
-
} else {
|
|
3061
|
-
this.position.column += 1;
|
|
3062
|
-
this.position.offset += code < 65536 ? 1 : 2;
|
|
3063
|
-
}
|
|
3064
|
-
};
|
|
3065
|
-
Parser2.prototype.bumpIf = function(prefix) {
|
|
3066
|
-
if (startsWith(this.message, prefix, this.offset())) {
|
|
3067
|
-
for (var i = 0; i < prefix.length; i++) {
|
|
3068
|
-
this.bump();
|
|
2690
|
+
Parser2.prototype.bumpUntil = function(pattern) {
|
|
2691
|
+
var currentOffset = this.offset();
|
|
2692
|
+
var index = this.message.indexOf(pattern, currentOffset);
|
|
2693
|
+
if (index >= 0) {
|
|
2694
|
+
this.bumpTo(index);
|
|
2695
|
+
return true;
|
|
2696
|
+
} else {
|
|
2697
|
+
this.bumpTo(this.message.length);
|
|
2698
|
+
return false;
|
|
3069
2699
|
}
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
}
|
|
3089
|
-
targetOffset = Math.min(targetOffset, this.message.length);
|
|
3090
|
-
while (true) {
|
|
3091
|
-
var offset = this.offset();
|
|
3092
|
-
if (offset === targetOffset) {
|
|
3093
|
-
break;
|
|
2700
|
+
};
|
|
2701
|
+
Parser2.prototype.bumpTo = function(targetOffset) {
|
|
2702
|
+
if (this.offset() > targetOffset) {
|
|
2703
|
+
throw Error("targetOffset ".concat(targetOffset, " must be greater than or equal to the current offset ").concat(this.offset()));
|
|
2704
|
+
}
|
|
2705
|
+
targetOffset = Math.min(targetOffset, this.message.length);
|
|
2706
|
+
while (true) {
|
|
2707
|
+
var offset = this.offset();
|
|
2708
|
+
if (offset === targetOffset) {
|
|
2709
|
+
break;
|
|
2710
|
+
}
|
|
2711
|
+
if (offset > targetOffset) {
|
|
2712
|
+
throw Error("targetOffset ".concat(targetOffset, " is at invalid UTF-16 code unit boundary"));
|
|
2713
|
+
}
|
|
2714
|
+
this.bump();
|
|
2715
|
+
if (this.isEOF()) {
|
|
2716
|
+
break;
|
|
2717
|
+
}
|
|
3094
2718
|
}
|
|
3095
|
-
|
|
3096
|
-
|
|
2719
|
+
};
|
|
2720
|
+
Parser2.prototype.bumpSpace = function() {
|
|
2721
|
+
while (!this.isEOF() && _isWhiteSpace(this.char())) {
|
|
2722
|
+
this.bump();
|
|
3097
2723
|
}
|
|
3098
|
-
|
|
2724
|
+
};
|
|
2725
|
+
Parser2.prototype.peek = function() {
|
|
3099
2726
|
if (this.isEOF()) {
|
|
3100
|
-
|
|
2727
|
+
return null;
|
|
3101
2728
|
}
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
}
|
|
3109
|
-
|
|
3110
|
-
if (this.isEOF()) {
|
|
3111
|
-
return null;
|
|
3112
|
-
}
|
|
3113
|
-
var code = this.char();
|
|
3114
|
-
var offset = this.offset();
|
|
3115
|
-
var nextCode = this.message.charCodeAt(offset + (code >= 65536 ? 2 : 1));
|
|
3116
|
-
return nextCode !== null && nextCode !== void 0 ? nextCode : null;
|
|
3117
|
-
};
|
|
3118
|
-
return Parser2;
|
|
3119
|
-
}();
|
|
2729
|
+
var code = this.char();
|
|
2730
|
+
var offset = this.offset();
|
|
2731
|
+
var nextCode = this.message.charCodeAt(offset + (code >= 65536 ? 2 : 1));
|
|
2732
|
+
return nextCode !== null && nextCode !== void 0 ? nextCode : null;
|
|
2733
|
+
};
|
|
2734
|
+
return Parser2;
|
|
2735
|
+
}()
|
|
2736
|
+
);
|
|
3120
2737
|
function _isAlpha(codepoint) {
|
|
3121
2738
|
return codepoint >= 97 && codepoint <= 122 || codepoint >= 65 && codepoint <= 90;
|
|
3122
2739
|
}
|
|
@@ -3133,7 +2750,7 @@ var IntlMessageFormat = (() => {
|
|
|
3133
2750
|
return c >= 33 && c <= 35 || c === 36 || c >= 37 && c <= 39 || c === 40 || c === 41 || c === 42 || c === 43 || c === 44 || c === 45 || c >= 46 && c <= 47 || c >= 58 && c <= 59 || c >= 60 && c <= 62 || c >= 63 && c <= 64 || c === 91 || c === 92 || c === 93 || c === 94 || c === 96 || c === 123 || c === 124 || c === 125 || c === 126 || c === 161 || c >= 162 && c <= 165 || c === 166 || c === 167 || c === 169 || c === 171 || c === 172 || c === 174 || c === 176 || c === 177 || c === 182 || c === 187 || c === 191 || c === 215 || c === 247 || c >= 8208 && c <= 8213 || c >= 8214 && c <= 8215 || c === 8216 || c === 8217 || c === 8218 || c >= 8219 && c <= 8220 || c === 8221 || c === 8222 || c === 8223 || c >= 8224 && c <= 8231 || c >= 8240 && c <= 8248 || c === 8249 || c === 8250 || c >= 8251 && c <= 8254 || c >= 8257 && c <= 8259 || c === 8260 || c === 8261 || c === 8262 || c >= 8263 && c <= 8273 || c === 8274 || c === 8275 || c >= 8277 && c <= 8286 || c >= 8592 && c <= 8596 || c >= 8597 && c <= 8601 || c >= 8602 && c <= 8603 || c >= 8604 && c <= 8607 || c === 8608 || c >= 8609 && c <= 8610 || c === 8611 || c >= 8612 && c <= 8613 || c === 8614 || c >= 8615 && c <= 8621 || c === 8622 || c >= 8623 && c <= 8653 || c >= 8654 && c <= 8655 || c >= 8656 && c <= 8657 || c === 8658 || c === 8659 || c === 8660 || c >= 8661 && c <= 8691 || c >= 8692 && c <= 8959 || c >= 8960 && c <= 8967 || c === 8968 || c === 8969 || c === 8970 || c === 8971 || c >= 8972 && c <= 8991 || c >= 8992 && c <= 8993 || c >= 8994 && c <= 9e3 || c === 9001 || c === 9002 || c >= 9003 && c <= 9083 || c === 9084 || c >= 9085 && c <= 9114 || c >= 9115 && c <= 9139 || c >= 9140 && c <= 9179 || c >= 9180 && c <= 9185 || c >= 9186 && c <= 9254 || c >= 9255 && c <= 9279 || c >= 9280 && c <= 9290 || c >= 9291 && c <= 9311 || c >= 9472 && c <= 9654 || c === 9655 || c >= 9656 && c <= 9664 || c === 9665 || c >= 9666 && c <= 9719 || c >= 9720 && c <= 9727 || c >= 9728 && c <= 9838 || c === 9839 || c >= 9840 && c <= 10087 || c === 10088 || c === 10089 || c === 10090 || c === 10091 || c === 10092 || c === 10093 || c === 10094 || c === 10095 || c === 10096 || c === 10097 || c === 10098 || c === 10099 || c === 10100 || c === 10101 || c >= 10132 && c <= 10175 || c >= 10176 && c <= 10180 || c === 10181 || c === 10182 || c >= 10183 && c <= 10213 || c === 10214 || c === 10215 || c === 10216 || c === 10217 || c === 10218 || c === 10219 || c === 10220 || c === 10221 || c === 10222 || c === 10223 || c >= 10224 && c <= 10239 || c >= 10240 && c <= 10495 || c >= 10496 && c <= 10626 || c === 10627 || c === 10628 || c === 10629 || c === 10630 || c === 10631 || c === 10632 || c === 10633 || c === 10634 || c === 10635 || c === 10636 || c === 10637 || c === 10638 || c === 10639 || c === 10640 || c === 10641 || c === 10642 || c === 10643 || c === 10644 || c === 10645 || c === 10646 || c === 10647 || c === 10648 || c >= 10649 && c <= 10711 || c === 10712 || c === 10713 || c === 10714 || c === 10715 || c >= 10716 && c <= 10747 || c === 10748 || c === 10749 || c >= 10750 && c <= 11007 || c >= 11008 && c <= 11055 || c >= 11056 && c <= 11076 || c >= 11077 && c <= 11078 || c >= 11079 && c <= 11084 || c >= 11085 && c <= 11123 || c >= 11124 && c <= 11125 || c >= 11126 && c <= 11157 || c === 11158 || c >= 11159 && c <= 11263 || c >= 11776 && c <= 11777 || c === 11778 || c === 11779 || c === 11780 || c === 11781 || c >= 11782 && c <= 11784 || c === 11785 || c === 11786 || c === 11787 || c === 11788 || c === 11789 || c >= 11790 && c <= 11798 || c === 11799 || c >= 11800 && c <= 11801 || c === 11802 || c === 11803 || c === 11804 || c === 11805 || c >= 11806 && c <= 11807 || c === 11808 || c === 11809 || c === 11810 || c === 11811 || c === 11812 || c === 11813 || c === 11814 || c === 11815 || c === 11816 || c === 11817 || c >= 11818 && c <= 11822 || c === 11823 || c >= 11824 && c <= 11833 || c >= 11834 && c <= 11835 || c >= 11836 && c <= 11839 || c === 11840 || c === 11841 || c === 11842 || c >= 11843 && c <= 11855 || c >= 11856 && c <= 11857 || c === 11858 || c >= 11859 && c <= 11903 || c >= 12289 && c <= 12291 || c === 12296 || c === 12297 || c === 12298 || c === 12299 || c === 12300 || c === 12301 || c === 12302 || c === 12303 || c === 12304 || c === 12305 || c >= 12306 && c <= 12307 || c === 12308 || c === 12309 || c === 12310 || c === 12311 || c === 12312 || c === 12313 || c === 12314 || c === 12315 || c === 12316 || c === 12317 || c >= 12318 && c <= 12319 || c === 12320 || c === 12336 || c === 64830 || c === 64831 || c >= 65093 && c <= 65094;
|
|
3134
2751
|
}
|
|
3135
2752
|
|
|
3136
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/
|
|
2753
|
+
// ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/lib/index.js
|
|
3137
2754
|
function pruneLocation(els) {
|
|
3138
2755
|
els.forEach(function(el) {
|
|
3139
2756
|
delete el.location;
|
|
@@ -3169,7 +2786,7 @@ var IntlMessageFormat = (() => {
|
|
|
3169
2786
|
return result.val;
|
|
3170
2787
|
}
|
|
3171
2788
|
|
|
3172
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/
|
|
2789
|
+
// ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+fast-memoize@0.0.0/node_modules/@formatjs/fast-memoize/lib/index.js
|
|
3173
2790
|
function memoize(fn, options) {
|
|
3174
2791
|
var cache = options && options.cache ? options.cache : cacheDefault;
|
|
3175
2792
|
var serializer = options && options.serializer ? options.serializer : serializerDefault;
|
|
@@ -3236,49 +2853,61 @@ var IntlMessageFormat = (() => {
|
|
|
3236
2853
|
monadic: strategyMonadic
|
|
3237
2854
|
};
|
|
3238
2855
|
|
|
3239
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/
|
|
2856
|
+
// ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/packages/intl-messageformat/lib/src/error.js
|
|
3240
2857
|
var ErrorCode;
|
|
3241
2858
|
(function(ErrorCode2) {
|
|
3242
2859
|
ErrorCode2["MISSING_VALUE"] = "MISSING_VALUE";
|
|
3243
2860
|
ErrorCode2["INVALID_VALUE"] = "INVALID_VALUE";
|
|
3244
2861
|
ErrorCode2["MISSING_INTL_API"] = "MISSING_INTL_API";
|
|
3245
2862
|
})(ErrorCode || (ErrorCode = {}));
|
|
3246
|
-
var FormatError =
|
|
3247
|
-
|
|
3248
|
-
function
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
return
|
|
3270
|
-
}
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
2863
|
+
var FormatError = (
|
|
2864
|
+
/** @class */
|
|
2865
|
+
function(_super) {
|
|
2866
|
+
__extends(FormatError2, _super);
|
|
2867
|
+
function FormatError2(msg, code, originalMessage) {
|
|
2868
|
+
var _this = _super.call(this, msg) || this;
|
|
2869
|
+
_this.code = code;
|
|
2870
|
+
_this.originalMessage = originalMessage;
|
|
2871
|
+
return _this;
|
|
2872
|
+
}
|
|
2873
|
+
FormatError2.prototype.toString = function() {
|
|
2874
|
+
return "[formatjs Error: ".concat(this.code, "] ").concat(this.message);
|
|
2875
|
+
};
|
|
2876
|
+
return FormatError2;
|
|
2877
|
+
}(Error)
|
|
2878
|
+
);
|
|
2879
|
+
var InvalidValueError = (
|
|
2880
|
+
/** @class */
|
|
2881
|
+
function(_super) {
|
|
2882
|
+
__extends(InvalidValueError2, _super);
|
|
2883
|
+
function InvalidValueError2(variableId, value, options, originalMessage) {
|
|
2884
|
+
return _super.call(this, 'Invalid values for "'.concat(variableId, '": "').concat(value, '". Options are "').concat(Object.keys(options).join('", "'), '"'), ErrorCode.INVALID_VALUE, originalMessage) || this;
|
|
2885
|
+
}
|
|
2886
|
+
return InvalidValueError2;
|
|
2887
|
+
}(FormatError)
|
|
2888
|
+
);
|
|
2889
|
+
var InvalidValueTypeError = (
|
|
2890
|
+
/** @class */
|
|
2891
|
+
function(_super) {
|
|
2892
|
+
__extends(InvalidValueTypeError2, _super);
|
|
2893
|
+
function InvalidValueTypeError2(value, type, originalMessage) {
|
|
2894
|
+
return _super.call(this, 'Value for "'.concat(value, '" must be of type ').concat(type), ErrorCode.INVALID_VALUE, originalMessage) || this;
|
|
2895
|
+
}
|
|
2896
|
+
return InvalidValueTypeError2;
|
|
2897
|
+
}(FormatError)
|
|
2898
|
+
);
|
|
2899
|
+
var MissingValueError = (
|
|
2900
|
+
/** @class */
|
|
2901
|
+
function(_super) {
|
|
2902
|
+
__extends(MissingValueError2, _super);
|
|
2903
|
+
function MissingValueError2(variableId, originalMessage) {
|
|
2904
|
+
return _super.call(this, 'The intl string context variable "'.concat(variableId, '" was not provided to the string "').concat(originalMessage, '"'), ErrorCode.MISSING_VALUE, originalMessage) || this;
|
|
2905
|
+
}
|
|
2906
|
+
return MissingValueError2;
|
|
2907
|
+
}(FormatError)
|
|
2908
|
+
);
|
|
3280
2909
|
|
|
3281
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/
|
|
2910
|
+
// ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/packages/intl-messageformat/lib/src/formatters.js
|
|
3282
2911
|
var PART_TYPE;
|
|
3283
2912
|
(function(PART_TYPE2) {
|
|
3284
2913
|
PART_TYPE2[PART_TYPE2["literal"] = 0] = "literal";
|
|
@@ -3418,7 +3047,7 @@ var IntlMessageFormat = (() => {
|
|
|
3418
3047
|
return mergeLiteral(result);
|
|
3419
3048
|
}
|
|
3420
3049
|
|
|
3421
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/
|
|
3050
|
+
// ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/packages/intl-messageformat/lib/src/core.js
|
|
3422
3051
|
function mergeConfig(c1, c2) {
|
|
3423
3052
|
if (!c2) {
|
|
3424
3053
|
return c1;
|
|
@@ -3495,150 +3124,153 @@ var IntlMessageFormat = (() => {
|
|
|
3495
3124
|
})
|
|
3496
3125
|
};
|
|
3497
3126
|
}
|
|
3498
|
-
var IntlMessageFormat =
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
this.formatterCache = {
|
|
3505
|
-
number: {},
|
|
3506
|
-
dateTime: {},
|
|
3507
|
-
pluralRules: {}
|
|
3508
|
-
};
|
|
3509
|
-
this.format = function(values) {
|
|
3510
|
-
var parts = _this.formatToParts(values);
|
|
3511
|
-
if (parts.length === 1) {
|
|
3512
|
-
return parts[0].value;
|
|
3513
|
-
}
|
|
3514
|
-
var result = parts.reduce(function(all, part) {
|
|
3515
|
-
if (!all.length || part.type !== PART_TYPE.literal || typeof all[all.length - 1] !== "string") {
|
|
3516
|
-
all.push(part.value);
|
|
3517
|
-
} else {
|
|
3518
|
-
all[all.length - 1] += part.value;
|
|
3519
|
-
}
|
|
3520
|
-
return all;
|
|
3521
|
-
}, []);
|
|
3522
|
-
if (result.length <= 1) {
|
|
3523
|
-
return result[0] || "";
|
|
3127
|
+
var IntlMessageFormat = (
|
|
3128
|
+
/** @class */
|
|
3129
|
+
function() {
|
|
3130
|
+
function IntlMessageFormat2(message, locales, overrideFormats, opts) {
|
|
3131
|
+
if (locales === void 0) {
|
|
3132
|
+
locales = IntlMessageFormat2.defaultLocale;
|
|
3524
3133
|
}
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
this.resolvedOptions = function() {
|
|
3531
|
-
var _a3;
|
|
3532
|
-
return {
|
|
3533
|
-
locale: ((_a3 = _this.resolvedLocale) === null || _a3 === void 0 ? void 0 : _a3.toString()) || Intl.NumberFormat.supportedLocalesOf(_this.locales)[0]
|
|
3134
|
+
var _this = this;
|
|
3135
|
+
this.formatterCache = {
|
|
3136
|
+
number: {},
|
|
3137
|
+
dateTime: {},
|
|
3138
|
+
pluralRules: {}
|
|
3534
3139
|
};
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3140
|
+
this.format = function(values) {
|
|
3141
|
+
var parts = _this.formatToParts(values);
|
|
3142
|
+
if (parts.length === 1) {
|
|
3143
|
+
return parts[0].value;
|
|
3144
|
+
}
|
|
3145
|
+
var result = parts.reduce(function(all, part) {
|
|
3146
|
+
if (!all.length || part.type !== PART_TYPE.literal || typeof all[all.length - 1] !== "string") {
|
|
3147
|
+
all.push(part.value);
|
|
3148
|
+
} else {
|
|
3149
|
+
all[all.length - 1] += part.value;
|
|
3150
|
+
}
|
|
3151
|
+
return all;
|
|
3152
|
+
}, []);
|
|
3153
|
+
if (result.length <= 1) {
|
|
3154
|
+
return result[0] || "";
|
|
3155
|
+
}
|
|
3156
|
+
return result;
|
|
3157
|
+
};
|
|
3158
|
+
this.formatToParts = function(values) {
|
|
3159
|
+
return formatToParts(_this.ast, _this.locales, _this.formatters, _this.formats, values, void 0, _this.message);
|
|
3160
|
+
};
|
|
3161
|
+
this.resolvedOptions = function() {
|
|
3162
|
+
var _a3;
|
|
3163
|
+
return {
|
|
3164
|
+
locale: ((_a3 = _this.resolvedLocale) === null || _a3 === void 0 ? void 0 : _a3.toString()) || Intl.NumberFormat.supportedLocalesOf(_this.locales)[0]
|
|
3165
|
+
};
|
|
3166
|
+
};
|
|
3167
|
+
this.getAst = function() {
|
|
3168
|
+
return _this.ast;
|
|
3169
|
+
};
|
|
3170
|
+
this.locales = locales;
|
|
3171
|
+
this.resolvedLocale = IntlMessageFormat2.resolveLocale(locales);
|
|
3172
|
+
if (typeof message === "string") {
|
|
3173
|
+
this.message = message;
|
|
3174
|
+
if (!IntlMessageFormat2.__parse) {
|
|
3175
|
+
throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");
|
|
3176
|
+
}
|
|
3177
|
+
var _a2 = opts || {}, formatters = _a2.formatters, parseOpts = __rest(_a2, ["formatters"]);
|
|
3178
|
+
this.ast = IntlMessageFormat2.__parse(message, __assign(__assign({}, parseOpts), { locale: this.resolvedLocale }));
|
|
3179
|
+
} else {
|
|
3180
|
+
this.ast = message;
|
|
3545
3181
|
}
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
this.
|
|
3550
|
-
|
|
3551
|
-
if (!Array.isArray(this.ast)) {
|
|
3552
|
-
throw new TypeError("A message must be provided as a String or AST.");
|
|
3553
|
-
}
|
|
3554
|
-
this.formats = mergeConfigs(IntlMessageFormat2.formats, overrideFormats);
|
|
3555
|
-
this.formatters = opts && opts.formatters || createDefaultFormatters(this.formatterCache);
|
|
3556
|
-
}
|
|
3557
|
-
Object.defineProperty(IntlMessageFormat2, "defaultLocale", {
|
|
3558
|
-
get: function() {
|
|
3559
|
-
if (!IntlMessageFormat2.memoizedDefaultLocale) {
|
|
3560
|
-
IntlMessageFormat2.memoizedDefaultLocale = new Intl.NumberFormat().resolvedOptions().locale;
|
|
3561
|
-
}
|
|
3562
|
-
return IntlMessageFormat2.memoizedDefaultLocale;
|
|
3563
|
-
},
|
|
3564
|
-
enumerable: false,
|
|
3565
|
-
configurable: true
|
|
3566
|
-
});
|
|
3567
|
-
IntlMessageFormat2.memoizedDefaultLocale = null;
|
|
3568
|
-
IntlMessageFormat2.resolveLocale = function(locales) {
|
|
3569
|
-
if (typeof Intl.Locale === "undefined") {
|
|
3570
|
-
return;
|
|
3571
|
-
}
|
|
3572
|
-
var supportedLocales = Intl.NumberFormat.supportedLocalesOf(locales);
|
|
3573
|
-
if (supportedLocales.length > 0) {
|
|
3574
|
-
return new Intl.Locale(supportedLocales[0]);
|
|
3182
|
+
if (!Array.isArray(this.ast)) {
|
|
3183
|
+
throw new TypeError("A message must be provided as a String or AST.");
|
|
3184
|
+
}
|
|
3185
|
+
this.formats = mergeConfigs(IntlMessageFormat2.formats, overrideFormats);
|
|
3186
|
+
this.formatters = opts && opts.formatters || createDefaultFormatters(this.formatterCache);
|
|
3575
3187
|
}
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
maximumFractionDigits: 0
|
|
3583
|
-
},
|
|
3584
|
-
currency: {
|
|
3585
|
-
style: "currency"
|
|
3586
|
-
},
|
|
3587
|
-
percent: {
|
|
3588
|
-
style: "percent"
|
|
3589
|
-
}
|
|
3590
|
-
},
|
|
3591
|
-
date: {
|
|
3592
|
-
short: {
|
|
3593
|
-
month: "numeric",
|
|
3594
|
-
day: "numeric",
|
|
3595
|
-
year: "2-digit"
|
|
3596
|
-
},
|
|
3597
|
-
medium: {
|
|
3598
|
-
month: "short",
|
|
3599
|
-
day: "numeric",
|
|
3600
|
-
year: "numeric"
|
|
3601
|
-
},
|
|
3602
|
-
long: {
|
|
3603
|
-
month: "long",
|
|
3604
|
-
day: "numeric",
|
|
3605
|
-
year: "numeric"
|
|
3606
|
-
},
|
|
3607
|
-
full: {
|
|
3608
|
-
weekday: "long",
|
|
3609
|
-
month: "long",
|
|
3610
|
-
day: "numeric",
|
|
3611
|
-
year: "numeric"
|
|
3612
|
-
}
|
|
3613
|
-
},
|
|
3614
|
-
time: {
|
|
3615
|
-
short: {
|
|
3616
|
-
hour: "numeric",
|
|
3617
|
-
minute: "numeric"
|
|
3188
|
+
Object.defineProperty(IntlMessageFormat2, "defaultLocale", {
|
|
3189
|
+
get: function() {
|
|
3190
|
+
if (!IntlMessageFormat2.memoizedDefaultLocale) {
|
|
3191
|
+
IntlMessageFormat2.memoizedDefaultLocale = new Intl.NumberFormat().resolvedOptions().locale;
|
|
3192
|
+
}
|
|
3193
|
+
return IntlMessageFormat2.memoizedDefaultLocale;
|
|
3618
3194
|
},
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3195
|
+
enumerable: false,
|
|
3196
|
+
configurable: true
|
|
3197
|
+
});
|
|
3198
|
+
IntlMessageFormat2.memoizedDefaultLocale = null;
|
|
3199
|
+
IntlMessageFormat2.resolveLocale = function(locales) {
|
|
3200
|
+
if (typeof Intl.Locale === "undefined") {
|
|
3201
|
+
return;
|
|
3202
|
+
}
|
|
3203
|
+
var supportedLocales = Intl.NumberFormat.supportedLocalesOf(locales);
|
|
3204
|
+
if (supportedLocales.length > 0) {
|
|
3205
|
+
return new Intl.Locale(supportedLocales[0]);
|
|
3206
|
+
}
|
|
3207
|
+
return new Intl.Locale(typeof locales === "string" ? locales : locales[0]);
|
|
3208
|
+
};
|
|
3209
|
+
IntlMessageFormat2.__parse = parse;
|
|
3210
|
+
IntlMessageFormat2.formats = {
|
|
3211
|
+
number: {
|
|
3212
|
+
integer: {
|
|
3213
|
+
maximumFractionDigits: 0
|
|
3214
|
+
},
|
|
3215
|
+
currency: {
|
|
3216
|
+
style: "currency"
|
|
3217
|
+
},
|
|
3218
|
+
percent: {
|
|
3219
|
+
style: "percent"
|
|
3220
|
+
}
|
|
3623
3221
|
},
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3222
|
+
date: {
|
|
3223
|
+
short: {
|
|
3224
|
+
month: "numeric",
|
|
3225
|
+
day: "numeric",
|
|
3226
|
+
year: "2-digit"
|
|
3227
|
+
},
|
|
3228
|
+
medium: {
|
|
3229
|
+
month: "short",
|
|
3230
|
+
day: "numeric",
|
|
3231
|
+
year: "numeric"
|
|
3232
|
+
},
|
|
3233
|
+
long: {
|
|
3234
|
+
month: "long",
|
|
3235
|
+
day: "numeric",
|
|
3236
|
+
year: "numeric"
|
|
3237
|
+
},
|
|
3238
|
+
full: {
|
|
3239
|
+
weekday: "long",
|
|
3240
|
+
month: "long",
|
|
3241
|
+
day: "numeric",
|
|
3242
|
+
year: "numeric"
|
|
3243
|
+
}
|
|
3629
3244
|
},
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3245
|
+
time: {
|
|
3246
|
+
short: {
|
|
3247
|
+
hour: "numeric",
|
|
3248
|
+
minute: "numeric"
|
|
3249
|
+
},
|
|
3250
|
+
medium: {
|
|
3251
|
+
hour: "numeric",
|
|
3252
|
+
minute: "numeric",
|
|
3253
|
+
second: "numeric"
|
|
3254
|
+
},
|
|
3255
|
+
long: {
|
|
3256
|
+
hour: "numeric",
|
|
3257
|
+
minute: "numeric",
|
|
3258
|
+
second: "numeric",
|
|
3259
|
+
timeZoneName: "short"
|
|
3260
|
+
},
|
|
3261
|
+
full: {
|
|
3262
|
+
hour: "numeric",
|
|
3263
|
+
minute: "numeric",
|
|
3264
|
+
second: "numeric",
|
|
3265
|
+
timeZoneName: "short"
|
|
3266
|
+
}
|
|
3635
3267
|
}
|
|
3636
|
-
}
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3268
|
+
};
|
|
3269
|
+
return IntlMessageFormat2;
|
|
3270
|
+
}()
|
|
3271
|
+
);
|
|
3640
3272
|
|
|
3641
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/
|
|
3273
|
+
// ../../../../../../../../execroot/formatjs/bazel-out/darwin-fastbuild/bin/packages/intl-messageformat/lib/index.js
|
|
3642
3274
|
var lib_default = IntlMessageFormat;
|
|
3643
3275
|
return __toCommonJS(lib_exports);
|
|
3644
3276
|
})();
|