rb-document-form-constructor 0.8.54 → 0.8.55

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.
@@ -1,11 +1,16 @@
1
- 'use strict';var Vue=require('vue'),crypto=require('crypto');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var Vue__default=/*#__PURE__*/_interopDefaultLegacy(Vue);var crypto__default=/*#__PURE__*/_interopDefaultLegacy(crypto);function ownKeys(object, enumerableOnly) {
1
+ 'use strict';var Vue$1=require('vue'),crypto=require('crypto');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var Vue__default=/*#__PURE__*/_interopDefaultLegacy(Vue$1);var crypto__default=/*#__PURE__*/_interopDefaultLegacy(crypto);function ownKeys(object, enumerableOnly) {
2
2
  var keys = Object.keys(object);
3
3
 
4
4
  if (Object.getOwnPropertySymbols) {
5
5
  var symbols = Object.getOwnPropertySymbols(object);
6
- enumerableOnly && (symbols = symbols.filter(function (sym) {
7
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
8
- })), keys.push.apply(keys, symbols);
6
+
7
+ if (enumerableOnly) {
8
+ symbols = symbols.filter(function (sym) {
9
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
10
+ });
11
+ }
12
+
13
+ keys.push.apply(keys, symbols);
9
14
  }
10
15
 
11
16
  return keys;
@@ -13,12 +18,19 @@
13
18
 
14
19
  function _objectSpread2(target) {
15
20
  for (var i = 1; i < arguments.length; i++) {
16
- var source = null != arguments[i] ? arguments[i] : {};
17
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
18
- _defineProperty$1(target, key, source[key]);
19
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
20
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
21
- });
21
+ var source = arguments[i] != null ? arguments[i] : {};
22
+
23
+ if (i % 2) {
24
+ ownKeys(Object(source), true).forEach(function (key) {
25
+ _defineProperty$1(target, key, source[key]);
26
+ });
27
+ } else if (Object.getOwnPropertyDescriptors) {
28
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
29
+ } else {
30
+ ownKeys(Object(source)).forEach(function (key) {
31
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
32
+ });
33
+ }
22
34
  }
23
35
 
24
36
  return target;
@@ -4328,7 +4340,7 @@ function wrap(prim){
4328
4340
  result.prototype = proto;
4329
4341
  result.wrapped = true;
4330
4342
  return result
4331
- }var parse = esprima.parse;
4343
+ }var parse$2 = esprima.parse;
4332
4344
 
4333
4345
 
4334
4346
 
@@ -4358,7 +4370,7 @@ function FunctionFactory(parentContext){
4358
4370
  args = args.slice(0,-1);
4359
4371
  if (typeof src === 'string'){
4360
4372
  //HACK: esprima doesn't like returns outside functions
4361
- src = parse('function a(){' + src + '}').body[0].body;
4373
+ src = parse$2('function a(){' + src + '}').body[0].body;
4362
4374
  }
4363
4375
  var tree = prepareAst(src);
4364
4376
  return getFunction(tree, args, context)
@@ -4367,7 +4379,7 @@ function FunctionFactory(parentContext){
4367
4379
 
4368
4380
  // takes an AST or js source and returns an AST
4369
4381
  function prepareAst(src){
4370
- var tree = (typeof src === 'string') ? parse(src, {loc: true}) : src;
4382
+ var tree = (typeof src === 'string') ? parse$2(src, {loc: true}) : src;
4371
4383
  return hoister(tree)
4372
4384
  }
4373
4385
 
@@ -4771,7 +4783,7 @@ function unsupportedExpression(node){
4771
4783
  // walk a provided object's prototypal hierarchy to retrieve an inherited object
4772
4784
  function objectForKey(object, key, primitives){
4773
4785
  var proto = primitives.getPrototypeOf(object);
4774
- if (!proto || hasOwnProperty(object, key)){
4786
+ if (!proto || hasOwnProperty$1(object, key)){
4775
4787
  return object
4776
4788
  } else {
4777
4789
  return objectForKey(proto, key, primitives)
@@ -4780,7 +4792,7 @@ function objectForKey(object, key, primitives){
4780
4792
 
4781
4793
  function hasProperty(object, key, primitives){
4782
4794
  var proto = primitives.getPrototypeOf(object);
4783
- var hasOwn = hasOwnProperty(object, key);
4795
+ var hasOwn = hasOwnProperty$1(object, key);
4784
4796
  if (object[key] !== undefined){
4785
4797
  return true
4786
4798
  } else if (!proto || hasOwn){
@@ -4790,7 +4802,7 @@ function hasProperty(object, key, primitives){
4790
4802
  }
4791
4803
  }
4792
4804
 
4793
- function hasOwnProperty(object, key){
4805
+ function hasOwnProperty$1(object, key){
4794
4806
  return Object.prototype.hasOwnProperty.call(object, key)
4795
4807
  }
4796
4808
 
@@ -4805,7 +4817,7 @@ function canSetProperty(object, property, primitives){
4805
4817
  return false
4806
4818
  } else if (object != null){
4807
4819
 
4808
- if (hasOwnProperty(object, property)){
4820
+ if (hasOwnProperty$1(object, property)){
4809
4821
  if (propertyIsEnumerable(object, property)){
4810
4822
  return true
4811
4823
  } else {
@@ -5119,173 +5131,2406 @@ var fcInputs = {
5119
5131
  multiple: true
5120
5132
  }
5121
5133
  };
5122
- var fcPrimitiveInputs = {
5123
- string: [__clone(fcInputs.string), __clone(fcInputs.number), __clone(fcInputs.memo), __clone(fcInputs.phone)],
5124
- memo: [__clone(fcInputs.memo), __clone(fcInputs.string)],
5125
- number: [__clone(fcInputs.string), __clone(fcInputs.number)],
5126
- double: [__clone(fcInputs.string), __clone(fcInputs.number)],
5127
- float: [__clone(fcInputs.string), __clone(fcInputs.number)],
5128
- integer: [__clone(fcInputs.string), __clone(fcInputs.number)],
5129
- long: [__clone(fcInputs.string), __clone(fcInputs.number)],
5130
- date: [__clone(fcInputs.date)],
5131
- datetime: [__clone(fcInputs.datetime)],
5132
- boolean: [__clone(fcInputs.boolean)],
5133
- email: [__clone(fcInputs.email)]
5134
+ var fcPrimitiveInputs = {
5135
+ string: [__clone(fcInputs.string), __clone(fcInputs.number), __clone(fcInputs.memo), __clone(fcInputs.phone)],
5136
+ memo: [__clone(fcInputs.memo), __clone(fcInputs.string)],
5137
+ number: [__clone(fcInputs.string), __clone(fcInputs.number)],
5138
+ double: [__clone(fcInputs.string), __clone(fcInputs.number)],
5139
+ float: [__clone(fcInputs.string), __clone(fcInputs.number)],
5140
+ integer: [__clone(fcInputs.string), __clone(fcInputs.number)],
5141
+ long: [__clone(fcInputs.string), __clone(fcInputs.number)],
5142
+ date: [__clone(fcInputs.date)],
5143
+ datetime: [__clone(fcInputs.datetime)],
5144
+ boolean: [__clone(fcInputs.boolean)],
5145
+ email: [__clone(fcInputs.email)]
5146
+ };
5147
+ var fcDictInputs = [];
5148
+ var fcRefInputs = {};
5149
+ var fcRefInputConfigs = {};
5150
+ var baseConfig = {
5151
+ inputs: __clone(fcInputs),
5152
+ primitiveInputs: __clone(fcPrimitiveInputs),
5153
+ dictInputs: __clone(fcDictInputs),
5154
+ refInputs: __clone(fcRefInputs),
5155
+ refInputConfigs: __clone(fcRefInputConfigs),
5156
+ rules: [],
5157
+ icons: {
5158
+ iconExpandFacet: 'icon-chevron-down',
5159
+ iconCollapseFacet: 'icon-chevron-up',
5160
+ iconCloseFieldSidebar: 'icon-chevron-right',
5161
+ iconOpenFieldSidebar: 'icon-chevron-left',
5162
+ iconAdd: 'icon-add',
5163
+ iconEdit: 'icon-edit',
5164
+ iconDelete: 'icon-delete',
5165
+ iconDrag: 'icon-reorder'
5166
+ },
5167
+ ruleContext: {}
5168
+ };
5169
+ var UtFormConstructor = {
5170
+ config: {},
5171
+ init: function init(formConfig) {
5172
+ this.config = __clone(baseConfig);
5173
+
5174
+ if (formConfig) {
5175
+ if (formConfig.inputs) {
5176
+ __mergeInputsInMap(this.config.inputs, formConfig.inputs);
5177
+ }
5178
+
5179
+ if (formConfig.primitiveInputs) {
5180
+ __mergeInputInMapOfArrays(this.config.primitiveInputs, formConfig.primitiveInputs);
5181
+ }
5182
+
5183
+ if (formConfig.dictInputs) {
5184
+ __mergeInputsInArray(this.config.dictInputs, formConfig.dictInputs);
5185
+ }
5186
+
5187
+ if (formConfig.refInputs) {
5188
+ __mergeInputInMapOfArrays(this.config.refInputs, formConfig.refInputs);
5189
+ }
5190
+
5191
+ if (formConfig.refInputConfigs) {
5192
+ this.config.refInputConfigs = formConfig.refInputConfigs;
5193
+ }
5194
+
5195
+ if (formConfig.icons) {
5196
+ this.config.icons = _assign(this.config.icons, formConfig.icons);
5197
+ }
5198
+
5199
+ if (formConfig.rules) {
5200
+ this.config.rules = formConfig.rules;
5201
+ }
5202
+
5203
+ if (formConfig.ruleContext) {
5204
+ this.config.ruleContext = formConfig.ruleContext;
5205
+ }
5206
+ }
5207
+ },
5208
+ getInputTypes: function getInputTypes(field) {
5209
+ var inputs = [];
5210
+
5211
+ if (!field) {
5212
+ return inputs;
5213
+ }
5214
+
5215
+ if (field.dict && !this.config.refInputs[field.ref]) {
5216
+ inputs = __filterInputsByMultiple(this.config.dictInputs, field.multiple);
5217
+ } else if (field.ref) {
5218
+ inputs = __filterInputsByMultiple(this.config.refInputs[field.ref], field.multiple);
5219
+ } else {
5220
+ inputs = __filterInputsByMultiple(this.config.primitiveInputs[field.type], field.multiple);
5221
+ }
5222
+
5223
+ return inputs;
5224
+ },
5225
+ hasMultipleInputTypes: function hasMultipleInputTypes(field) {
5226
+ var inputs = this.getInputTypes(_objectSpread2(_objectSpread2({}, field), {}, {
5227
+ multiple: true
5228
+ }));
5229
+ return inputs && inputs.length > 0;
5230
+ },
5231
+ getDefaultInput: function getDefaultInput(field) {
5232
+ var input = null;
5233
+ var inputs = this.getInputTypes(field);
5234
+
5235
+ if (!inputs) {
5236
+ input = this.primitiveInputs[0];
5237
+ }
5238
+
5239
+ if (field.ref && this.config.refInputs[field.ref]) {
5240
+ input = __clone(inputs[0]);
5241
+
5242
+ __applyDefaultProps(input);
5243
+
5244
+ if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
5245
+ __applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
5246
+ }
5247
+ } else if (field.dict) {
5248
+ input = __clone(inputs[0]);
5249
+ input.props.dict.default = field.ref;
5250
+
5251
+ __applyDefaultProps(input);
5252
+ } else {
5253
+ input = __clone(inputs[0]);
5254
+
5255
+ __applyDefaultProps(input);
5256
+ }
5257
+
5258
+ return input;
5259
+ },
5260
+ getInputTypeByName: function getInputTypeByName(name, field) {
5261
+ var input = __clone(this.config.inputs[name]);
5262
+
5263
+ if (field.ref && this.config.refInputs[field.ref]) {
5264
+ __applyDefaultProps(input);
5265
+
5266
+ if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
5267
+ __applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
5268
+ }
5269
+ } else if (field.dict) {
5270
+ input.props.dict.default = field.ref;
5271
+
5272
+ __applyDefaultProps(input);
5273
+ } else {
5274
+ __applyDefaultProps(input, field);
5275
+ }
5276
+
5277
+ input.propsData['ref'] = field.name;
5278
+ return input;
5279
+ },
5280
+ getAvailableFieldRules: function getAvailableFieldRules(field) {
5281
+ return this.config.rules.filter(function (rule) {
5282
+ return !rule.fields || rule.fields.length === 0 || rule.fields.indexOf(field.name) >= 0;
5283
+ });
5284
+ },
5285
+ getRuleContext: function getRuleContext() {
5286
+ return this.config.ruleContext;
5287
+ },
5288
+ runRule: function runRule(context, script) {
5289
+ context = context ? context : {};
5290
+ context['console'] = console;
5291
+ context['Date'] = Date;
5292
+ context['Math'] = Math;
5293
+
5294
+ var func = function func(script) {
5295
+ return notevil(script, context);
5296
+ };
5297
+
5298
+ func.call(context, script);
5299
+ }
5300
+ };/*!
5301
+ * vue-i18n v8.28.2
5302
+ * (c) 2022 kazuya kawaguchi
5303
+ * Released under the MIT License.
5304
+ */
5305
+ /* */
5306
+
5307
+ /**
5308
+ * constants
5309
+ */
5310
+
5311
+ var numberFormatKeys = [
5312
+ 'compactDisplay',
5313
+ 'currency',
5314
+ 'currencyDisplay',
5315
+ 'currencySign',
5316
+ 'localeMatcher',
5317
+ 'notation',
5318
+ 'numberingSystem',
5319
+ 'signDisplay',
5320
+ 'style',
5321
+ 'unit',
5322
+ 'unitDisplay',
5323
+ 'useGrouping',
5324
+ 'minimumIntegerDigits',
5325
+ 'minimumFractionDigits',
5326
+ 'maximumFractionDigits',
5327
+ 'minimumSignificantDigits',
5328
+ 'maximumSignificantDigits'
5329
+ ];
5330
+
5331
+ var dateTimeFormatKeys = [
5332
+ 'dateStyle',
5333
+ 'timeStyle',
5334
+ 'calendar',
5335
+ 'localeMatcher',
5336
+ "hour12",
5337
+ "hourCycle",
5338
+ "timeZone",
5339
+ "formatMatcher",
5340
+ 'weekday',
5341
+ 'era',
5342
+ 'year',
5343
+ 'month',
5344
+ 'day',
5345
+ 'hour',
5346
+ 'minute',
5347
+ 'second',
5348
+ 'timeZoneName' ];
5349
+
5350
+ /**
5351
+ * utilities
5352
+ */
5353
+
5354
+ function warn (msg, err) {
5355
+ if (typeof console !== 'undefined') {
5356
+ console.warn('[vue-i18n] ' + msg);
5357
+ /* istanbul ignore if */
5358
+ if (err) {
5359
+ console.warn(err.stack);
5360
+ }
5361
+ }
5362
+ }
5363
+
5364
+ function error (msg, err) {
5365
+ if (typeof console !== 'undefined') {
5366
+ console.error('[vue-i18n] ' + msg);
5367
+ /* istanbul ignore if */
5368
+ if (err) {
5369
+ console.error(err.stack);
5370
+ }
5371
+ }
5372
+ }
5373
+
5374
+ var isArray = Array.isArray;
5375
+
5376
+ function isObject (obj) {
5377
+ return obj !== null && typeof obj === 'object'
5378
+ }
5379
+
5380
+ function isBoolean (val) {
5381
+ return typeof val === 'boolean'
5382
+ }
5383
+
5384
+ function isString (val) {
5385
+ return typeof val === 'string'
5386
+ }
5387
+
5388
+ var toString$1 = Object.prototype.toString;
5389
+ var OBJECT_STRING = '[object Object]';
5390
+ function isPlainObject (obj) {
5391
+ return toString$1.call(obj) === OBJECT_STRING
5392
+ }
5393
+
5394
+ function isNull (val) {
5395
+ return val === null || val === undefined
5396
+ }
5397
+
5398
+ function isFunction (val) {
5399
+ return typeof val === 'function'
5400
+ }
5401
+
5402
+ function parseArgs () {
5403
+ var args = [], len = arguments.length;
5404
+ while ( len-- ) args[ len ] = arguments[ len ];
5405
+
5406
+ var locale = null;
5407
+ var params = null;
5408
+ if (args.length === 1) {
5409
+ if (isObject(args[0]) || isArray(args[0])) {
5410
+ params = args[0];
5411
+ } else if (typeof args[0] === 'string') {
5412
+ locale = args[0];
5413
+ }
5414
+ } else if (args.length === 2) {
5415
+ if (typeof args[0] === 'string') {
5416
+ locale = args[0];
5417
+ }
5418
+ /* istanbul ignore if */
5419
+ if (isObject(args[1]) || isArray(args[1])) {
5420
+ params = args[1];
5421
+ }
5422
+ }
5423
+
5424
+ return { locale: locale, params: params }
5425
+ }
5426
+
5427
+ function looseClone (obj) {
5428
+ return JSON.parse(JSON.stringify(obj))
5429
+ }
5430
+
5431
+ function remove (arr, item) {
5432
+ if (arr.delete(item)) {
5433
+ return arr
5434
+ }
5435
+ }
5436
+
5437
+ function arrayFrom (arr) {
5438
+ var ret = [];
5439
+ arr.forEach(function (a) { return ret.push(a); });
5440
+ return ret
5441
+ }
5442
+
5443
+ function includes (arr, item) {
5444
+ return !!~arr.indexOf(item)
5445
+ }
5446
+
5447
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
5448
+ function hasOwn (obj, key) {
5449
+ return hasOwnProperty.call(obj, key)
5450
+ }
5451
+
5452
+ function merge (target) {
5453
+ var arguments$1 = arguments;
5454
+
5455
+ var output = Object(target);
5456
+ for (var i = 1; i < arguments.length; i++) {
5457
+ var source = arguments$1[i];
5458
+ if (source !== undefined && source !== null) {
5459
+ var key = (void 0);
5460
+ for (key in source) {
5461
+ if (hasOwn(source, key)) {
5462
+ if (isObject(source[key])) {
5463
+ output[key] = merge(output[key], source[key]);
5464
+ } else {
5465
+ output[key] = source[key];
5466
+ }
5467
+ }
5468
+ }
5469
+ }
5470
+ }
5471
+ return output
5472
+ }
5473
+
5474
+ function looseEqual (a, b) {
5475
+ if (a === b) { return true }
5476
+ var isObjectA = isObject(a);
5477
+ var isObjectB = isObject(b);
5478
+ if (isObjectA && isObjectB) {
5479
+ try {
5480
+ var isArrayA = isArray(a);
5481
+ var isArrayB = isArray(b);
5482
+ if (isArrayA && isArrayB) {
5483
+ return a.length === b.length && a.every(function (e, i) {
5484
+ return looseEqual(e, b[i])
5485
+ })
5486
+ } else if (!isArrayA && !isArrayB) {
5487
+ var keysA = Object.keys(a);
5488
+ var keysB = Object.keys(b);
5489
+ return keysA.length === keysB.length && keysA.every(function (key) {
5490
+ return looseEqual(a[key], b[key])
5491
+ })
5492
+ } else {
5493
+ /* istanbul ignore next */
5494
+ return false
5495
+ }
5496
+ } catch (e) {
5497
+ /* istanbul ignore next */
5498
+ return false
5499
+ }
5500
+ } else if (!isObjectA && !isObjectB) {
5501
+ return String(a) === String(b)
5502
+ } else {
5503
+ return false
5504
+ }
5505
+ }
5506
+
5507
+ /**
5508
+ * Sanitizes html special characters from input strings. For mitigating risk of XSS attacks.
5509
+ * @param rawText The raw input from the user that should be escaped.
5510
+ */
5511
+ function escapeHtml(rawText) {
5512
+ return rawText
5513
+ .replace(/</g, '&lt;')
5514
+ .replace(/>/g, '&gt;')
5515
+ .replace(/"/g, '&quot;')
5516
+ .replace(/'/g, '&apos;')
5517
+ }
5518
+
5519
+ /**
5520
+ * Escapes html tags and special symbols from all provided params which were returned from parseArgs().params.
5521
+ * This method performs an in-place operation on the params object.
5522
+ *
5523
+ * @param {any} params Parameters as provided from `parseArgs().params`.
5524
+ * May be either an array of strings or a string->any map.
5525
+ *
5526
+ * @returns The manipulated `params` object.
5527
+ */
5528
+ function escapeParams(params) {
5529
+ if(params != null) {
5530
+ Object.keys(params).forEach(function (key) {
5531
+ if(typeof(params[key]) == 'string') {
5532
+ params[key] = escapeHtml(params[key]);
5533
+ }
5534
+ });
5535
+ }
5536
+ return params
5537
+ }
5538
+
5539
+ /* */
5540
+
5541
+ function extend$1 (Vue) {
5542
+ if (!Vue.prototype.hasOwnProperty('$i18n')) {
5543
+ // $FlowFixMe
5544
+ Object.defineProperty(Vue.prototype, '$i18n', {
5545
+ get: function get () { return this._i18n }
5546
+ });
5547
+ }
5548
+
5549
+ Vue.prototype.$t = function (key) {
5550
+ var values = [], len = arguments.length - 1;
5551
+ while ( len-- > 0 ) values[ len ] = arguments[ len + 1 ];
5552
+
5553
+ var i18n = this.$i18n;
5554
+ return i18n._t.apply(i18n, [ key, i18n.locale, i18n._getMessages(), this ].concat( values ))
5555
+ };
5556
+
5557
+ Vue.prototype.$tc = function (key, choice) {
5558
+ var values = [], len = arguments.length - 2;
5559
+ while ( len-- > 0 ) values[ len ] = arguments[ len + 2 ];
5560
+
5561
+ var i18n = this.$i18n;
5562
+ return i18n._tc.apply(i18n, [ key, i18n.locale, i18n._getMessages(), this, choice ].concat( values ))
5563
+ };
5564
+
5565
+ Vue.prototype.$te = function (key, locale) {
5566
+ var i18n = this.$i18n;
5567
+ return i18n._te(key, i18n.locale, i18n._getMessages(), locale)
5568
+ };
5569
+
5570
+ Vue.prototype.$d = function (value) {
5571
+ var ref;
5572
+
5573
+ var args = [], len = arguments.length - 1;
5574
+ while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
5575
+ return (ref = this.$i18n).d.apply(ref, [ value ].concat( args ))
5576
+ };
5577
+
5578
+ Vue.prototype.$n = function (value) {
5579
+ var ref;
5580
+
5581
+ var args = [], len = arguments.length - 1;
5582
+ while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
5583
+ return (ref = this.$i18n).n.apply(ref, [ value ].concat( args ))
5584
+ };
5585
+ }
5586
+
5587
+ /* */
5588
+
5589
+ /**
5590
+ * Mixin
5591
+ *
5592
+ * If `bridge` mode, empty mixin is returned,
5593
+ * else regulary mixin implementation is returned.
5594
+ */
5595
+ function defineMixin (bridge) {
5596
+ if ( bridge === void 0 ) bridge = false;
5597
+
5598
+ function mounted () {
5599
+ if (this !== this.$root && this.$options.__INTLIFY_META__ && this.$el) {
5600
+ this.$el.setAttribute('data-intlify', this.$options.__INTLIFY_META__);
5601
+ }
5602
+ }
5603
+
5604
+ return bridge
5605
+ ? { mounted: mounted } // delegate `vue-i18n-bridge` mixin implementation
5606
+ : { // regulary
5607
+ beforeCreate: function beforeCreate () {
5608
+ var options = this.$options;
5609
+ options.i18n = options.i18n || ((options.__i18nBridge || options.__i18n) ? {} : null);
5610
+
5611
+ if (options.i18n) {
5612
+ if (options.i18n instanceof VueI18n) {
5613
+ // init locale messages via custom blocks
5614
+ if ((options.__i18nBridge || options.__i18n)) {
5615
+ try {
5616
+ var localeMessages = options.i18n && options.i18n.messages ? options.i18n.messages : {};
5617
+ var _i18n = options.__i18nBridge || options.__i18n;
5618
+ _i18n.forEach(function (resource) {
5619
+ localeMessages = merge(localeMessages, JSON.parse(resource));
5620
+ });
5621
+ Object.keys(localeMessages).forEach(function (locale) {
5622
+ options.i18n.mergeLocaleMessage(locale, localeMessages[locale]);
5623
+ });
5624
+ } catch (e) {
5625
+ }
5626
+ }
5627
+ this._i18n = options.i18n;
5628
+ this._i18nWatcher = this._i18n.watchI18nData();
5629
+ } else if (isPlainObject(options.i18n)) {
5630
+ var rootI18n = this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n
5631
+ ? this.$root.$i18n
5632
+ : null;
5633
+ // component local i18n
5634
+ if (rootI18n) {
5635
+ options.i18n.root = this.$root;
5636
+ options.i18n.formatter = rootI18n.formatter;
5637
+ options.i18n.fallbackLocale = rootI18n.fallbackLocale;
5638
+ options.i18n.formatFallbackMessages = rootI18n.formatFallbackMessages;
5639
+ options.i18n.silentTranslationWarn = rootI18n.silentTranslationWarn;
5640
+ options.i18n.silentFallbackWarn = rootI18n.silentFallbackWarn;
5641
+ options.i18n.pluralizationRules = rootI18n.pluralizationRules;
5642
+ options.i18n.preserveDirectiveContent = rootI18n.preserveDirectiveContent;
5643
+ }
5644
+
5645
+ // init locale messages via custom blocks
5646
+ if ((options.__i18nBridge || options.__i18n)) {
5647
+ try {
5648
+ var localeMessages$1 = options.i18n && options.i18n.messages ? options.i18n.messages : {};
5649
+ var _i18n$1 = options.__i18nBridge || options.__i18n;
5650
+ _i18n$1.forEach(function (resource) {
5651
+ localeMessages$1 = merge(localeMessages$1, JSON.parse(resource));
5652
+ });
5653
+ options.i18n.messages = localeMessages$1;
5654
+ } catch (e) {
5655
+ }
5656
+ }
5657
+
5658
+ var ref = options.i18n;
5659
+ var sharedMessages = ref.sharedMessages;
5660
+ if (sharedMessages && isPlainObject(sharedMessages)) {
5661
+ options.i18n.messages = merge(options.i18n.messages, sharedMessages);
5662
+ }
5663
+
5664
+ this._i18n = new VueI18n(options.i18n);
5665
+ this._i18nWatcher = this._i18n.watchI18nData();
5666
+
5667
+ if (options.i18n.sync === undefined || !!options.i18n.sync) {
5668
+ this._localeWatcher = this.$i18n.watchLocale();
5669
+ }
5670
+
5671
+ if (rootI18n) {
5672
+ rootI18n.onComponentInstanceCreated(this._i18n);
5673
+ }
5674
+ } else ;
5675
+ } else if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) {
5676
+ // root i18n
5677
+ this._i18n = this.$root.$i18n;
5678
+ } else if (options.parent && options.parent.$i18n && options.parent.$i18n instanceof VueI18n) {
5679
+ // parent i18n
5680
+ this._i18n = options.parent.$i18n;
5681
+ }
5682
+ },
5683
+
5684
+ beforeMount: function beforeMount () {
5685
+ var options = this.$options;
5686
+ options.i18n = options.i18n || ((options.__i18nBridge || options.__i18n) ? {} : null);
5687
+
5688
+ if (options.i18n) {
5689
+ if (options.i18n instanceof VueI18n) {
5690
+ // init locale messages via custom blocks
5691
+ this._i18n.subscribeDataChanging(this);
5692
+ this._subscribing = true;
5693
+ } else if (isPlainObject(options.i18n)) {
5694
+ this._i18n.subscribeDataChanging(this);
5695
+ this._subscribing = true;
5696
+ } else ;
5697
+ } else if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) {
5698
+ this._i18n.subscribeDataChanging(this);
5699
+ this._subscribing = true;
5700
+ } else if (options.parent && options.parent.$i18n && options.parent.$i18n instanceof VueI18n) {
5701
+ this._i18n.subscribeDataChanging(this);
5702
+ this._subscribing = true;
5703
+ }
5704
+ },
5705
+
5706
+ mounted: mounted,
5707
+
5708
+ beforeDestroy: function beforeDestroy () {
5709
+ if (!this._i18n) { return }
5710
+
5711
+ var self = this;
5712
+ this.$nextTick(function () {
5713
+ if (self._subscribing) {
5714
+ self._i18n.unsubscribeDataChanging(self);
5715
+ delete self._subscribing;
5716
+ }
5717
+
5718
+ if (self._i18nWatcher) {
5719
+ self._i18nWatcher();
5720
+ self._i18n.destroyVM();
5721
+ delete self._i18nWatcher;
5722
+ }
5723
+
5724
+ if (self._localeWatcher) {
5725
+ self._localeWatcher();
5726
+ delete self._localeWatcher;
5727
+ }
5728
+ });
5729
+ }
5730
+ }
5731
+ }
5732
+
5733
+ /* */
5734
+
5735
+ var interpolationComponent = {
5736
+ name: 'i18n',
5737
+ functional: true,
5738
+ props: {
5739
+ tag: {
5740
+ type: [String, Boolean, Object],
5741
+ default: 'span'
5742
+ },
5743
+ path: {
5744
+ type: String,
5745
+ required: true
5746
+ },
5747
+ locale: {
5748
+ type: String
5749
+ },
5750
+ places: {
5751
+ type: [Array, Object]
5752
+ }
5753
+ },
5754
+ render: function render (h, ref) {
5755
+ var data = ref.data;
5756
+ var parent = ref.parent;
5757
+ var props = ref.props;
5758
+ var slots = ref.slots;
5759
+
5760
+ var $i18n = parent.$i18n;
5761
+ if (!$i18n) {
5762
+ return
5763
+ }
5764
+
5765
+ var path = props.path;
5766
+ var locale = props.locale;
5767
+ var places = props.places;
5768
+ var params = slots();
5769
+ var children = $i18n.i(
5770
+ path,
5771
+ locale,
5772
+ onlyHasDefaultPlace(params) || places
5773
+ ? useLegacyPlaces(params.default, places)
5774
+ : params
5775
+ );
5776
+
5777
+ var tag = (!!props.tag && props.tag !== true) || props.tag === false ? props.tag : 'span';
5778
+ return tag ? h(tag, data, children) : children
5779
+ }
5780
+ };
5781
+
5782
+ function onlyHasDefaultPlace (params) {
5783
+ var prop;
5784
+ for (prop in params) {
5785
+ if (prop !== 'default') { return false }
5786
+ }
5787
+ return Boolean(prop)
5788
+ }
5789
+
5790
+ function useLegacyPlaces (children, places) {
5791
+ var params = places ? createParamsFromPlaces(places) : {};
5792
+
5793
+ if (!children) { return params }
5794
+
5795
+ // Filter empty text nodes
5796
+ children = children.filter(function (child) {
5797
+ return child.tag || child.text.trim() !== ''
5798
+ });
5799
+
5800
+ var everyPlace = children.every(vnodeHasPlaceAttribute);
5801
+
5802
+ return children.reduce(
5803
+ everyPlace ? assignChildPlace : assignChildIndex,
5804
+ params
5805
+ )
5806
+ }
5807
+
5808
+ function createParamsFromPlaces (places) {
5809
+
5810
+ return Array.isArray(places)
5811
+ ? places.reduce(assignChildIndex, {})
5812
+ : Object.assign({}, places)
5813
+ }
5814
+
5815
+ function assignChildPlace (params, child) {
5816
+ if (child.data && child.data.attrs && child.data.attrs.place) {
5817
+ params[child.data.attrs.place] = child;
5818
+ }
5819
+ return params
5820
+ }
5821
+
5822
+ function assignChildIndex (params, child, index) {
5823
+ params[index] = child;
5824
+ return params
5825
+ }
5826
+
5827
+ function vnodeHasPlaceAttribute (vnode) {
5828
+ return Boolean(vnode.data && vnode.data.attrs && vnode.data.attrs.place)
5829
+ }
5830
+
5831
+ /* */
5832
+
5833
+ var numberComponent = {
5834
+ name: 'i18n-n',
5835
+ functional: true,
5836
+ props: {
5837
+ tag: {
5838
+ type: [String, Boolean, Object],
5839
+ default: 'span'
5840
+ },
5841
+ value: {
5842
+ type: Number,
5843
+ required: true
5844
+ },
5845
+ format: {
5846
+ type: [String, Object]
5847
+ },
5848
+ locale: {
5849
+ type: String
5850
+ }
5851
+ },
5852
+ render: function render (h, ref) {
5853
+ var props = ref.props;
5854
+ var parent = ref.parent;
5855
+ var data = ref.data;
5856
+
5857
+ var i18n = parent.$i18n;
5858
+
5859
+ if (!i18n) {
5860
+ return null
5861
+ }
5862
+
5863
+ var key = null;
5864
+ var options = null;
5865
+
5866
+ if (isString(props.format)) {
5867
+ key = props.format;
5868
+ } else if (isObject(props.format)) {
5869
+ if (props.format.key) {
5870
+ key = props.format.key;
5871
+ }
5872
+
5873
+ // Filter out number format options only
5874
+ options = Object.keys(props.format).reduce(function (acc, prop) {
5875
+ var obj;
5876
+
5877
+ if (includes(numberFormatKeys, prop)) {
5878
+ return Object.assign({}, acc, ( obj = {}, obj[prop] = props.format[prop], obj ))
5879
+ }
5880
+ return acc
5881
+ }, null);
5882
+ }
5883
+
5884
+ var locale = props.locale || i18n.locale;
5885
+ var parts = i18n._ntp(props.value, locale, key, options);
5886
+
5887
+ var values = parts.map(function (part, index) {
5888
+ var obj;
5889
+
5890
+ var slot = data.scopedSlots && data.scopedSlots[part.type];
5891
+ return slot ? slot(( obj = {}, obj[part.type] = part.value, obj.index = index, obj.parts = parts, obj )) : part.value
5892
+ });
5893
+
5894
+ var tag = (!!props.tag && props.tag !== true) || props.tag === false ? props.tag : 'span';
5895
+ return tag
5896
+ ? h(tag, {
5897
+ attrs: data.attrs,
5898
+ 'class': data['class'],
5899
+ staticClass: data.staticClass
5900
+ }, values)
5901
+ : values
5902
+ }
5903
+ };
5904
+
5905
+ /* */
5906
+
5907
+ function bind (el, binding, vnode) {
5908
+ if (!assert(el, vnode)) { return }
5909
+
5910
+ t(el, binding, vnode);
5911
+ }
5912
+
5913
+ function update (el, binding, vnode, oldVNode) {
5914
+ if (!assert(el, vnode)) { return }
5915
+
5916
+ var i18n = vnode.context.$i18n;
5917
+ if (localeEqual(el, vnode) &&
5918
+ (looseEqual(binding.value, binding.oldValue) &&
5919
+ looseEqual(el._localeMessage, i18n.getLocaleMessage(i18n.locale)))) { return }
5920
+
5921
+ t(el, binding, vnode);
5922
+ }
5923
+
5924
+ function unbind (el, binding, vnode, oldVNode) {
5925
+ var vm = vnode.context;
5926
+ if (!vm) {
5927
+ warn('Vue instance does not exists in VNode context');
5928
+ return
5929
+ }
5930
+
5931
+ var i18n = vnode.context.$i18n || {};
5932
+ if (!binding.modifiers.preserve && !i18n.preserveDirectiveContent) {
5933
+ el.textContent = '';
5934
+ }
5935
+ el._vt = undefined;
5936
+ delete el['_vt'];
5937
+ el._locale = undefined;
5938
+ delete el['_locale'];
5939
+ el._localeMessage = undefined;
5940
+ delete el['_localeMessage'];
5941
+ }
5942
+
5943
+ function assert (el, vnode) {
5944
+ var vm = vnode.context;
5945
+ if (!vm) {
5946
+ warn('Vue instance does not exists in VNode context');
5947
+ return false
5948
+ }
5949
+
5950
+ if (!vm.$i18n) {
5951
+ warn('VueI18n instance does not exists in Vue instance');
5952
+ return false
5953
+ }
5954
+
5955
+ return true
5956
+ }
5957
+
5958
+ function localeEqual (el, vnode) {
5959
+ var vm = vnode.context;
5960
+ return el._locale === vm.$i18n.locale
5961
+ }
5962
+
5963
+ function t (el, binding, vnode) {
5964
+ var ref$1, ref$2;
5965
+
5966
+ var value = binding.value;
5967
+
5968
+ var ref = parseValue(value);
5969
+ var path = ref.path;
5970
+ var locale = ref.locale;
5971
+ var args = ref.args;
5972
+ var choice = ref.choice;
5973
+ if (!path && !locale && !args) {
5974
+ warn('value type not supported');
5975
+ return
5976
+ }
5977
+
5978
+ if (!path) {
5979
+ warn('`path` is required in v-t directive');
5980
+ return
5981
+ }
5982
+
5983
+ var vm = vnode.context;
5984
+ if (choice != null) {
5985
+ el._vt = el.textContent = (ref$1 = vm.$i18n).tc.apply(ref$1, [ path, choice ].concat( makeParams(locale, args) ));
5986
+ } else {
5987
+ el._vt = el.textContent = (ref$2 = vm.$i18n).t.apply(ref$2, [ path ].concat( makeParams(locale, args) ));
5988
+ }
5989
+ el._locale = vm.$i18n.locale;
5990
+ el._localeMessage = vm.$i18n.getLocaleMessage(vm.$i18n.locale);
5991
+ }
5992
+
5993
+ function parseValue (value) {
5994
+ var path;
5995
+ var locale;
5996
+ var args;
5997
+ var choice;
5998
+
5999
+ if (isString(value)) {
6000
+ path = value;
6001
+ } else if (isPlainObject(value)) {
6002
+ path = value.path;
6003
+ locale = value.locale;
6004
+ args = value.args;
6005
+ choice = value.choice;
6006
+ }
6007
+
6008
+ return { path: path, locale: locale, args: args, choice: choice }
6009
+ }
6010
+
6011
+ function makeParams (locale, args) {
6012
+ var params = [];
6013
+
6014
+ locale && params.push(locale);
6015
+ if (args && (Array.isArray(args) || isPlainObject(args))) {
6016
+ params.push(args);
6017
+ }
6018
+
6019
+ return params
6020
+ }
6021
+
6022
+ var Vue;
6023
+
6024
+ function install$1 (_Vue, options) {
6025
+ if ( options === void 0 ) options = { bridge: false };
6026
+ install$1.installed = true;
6027
+
6028
+ Vue = _Vue;
6029
+
6030
+ (Vue.version && Number(Vue.version.split('.')[0])) || -1;
6031
+
6032
+ extend$1(Vue);
6033
+ Vue.mixin(defineMixin(options.bridge));
6034
+ Vue.directive('t', { bind: bind, update: update, unbind: unbind });
6035
+ Vue.component(interpolationComponent.name, interpolationComponent);
6036
+ Vue.component(numberComponent.name, numberComponent);
6037
+
6038
+ // use simple mergeStrategies to prevent i18n instance lose '__proto__'
6039
+ var strats = Vue.config.optionMergeStrategies;
6040
+ strats.i18n = function (parentVal, childVal) {
6041
+ return childVal === undefined
6042
+ ? parentVal
6043
+ : childVal
6044
+ };
6045
+ }
6046
+
6047
+ /* */
6048
+
6049
+ var BaseFormatter = function BaseFormatter () {
6050
+ this._caches = Object.create(null);
6051
+ };
6052
+
6053
+ BaseFormatter.prototype.interpolate = function interpolate (message, values) {
6054
+ if (!values) {
6055
+ return [message]
6056
+ }
6057
+ var tokens = this._caches[message];
6058
+ if (!tokens) {
6059
+ tokens = parse(message);
6060
+ this._caches[message] = tokens;
6061
+ }
6062
+ return compile(tokens, values)
6063
+ };
6064
+
6065
+
6066
+
6067
+ var RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
6068
+ var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
6069
+
6070
+ function parse (format) {
6071
+ var tokens = [];
6072
+ var position = 0;
6073
+
6074
+ var text = '';
6075
+ while (position < format.length) {
6076
+ var char = format[position++];
6077
+ if (char === '{') {
6078
+ if (text) {
6079
+ tokens.push({ type: 'text', value: text });
6080
+ }
6081
+
6082
+ text = '';
6083
+ var sub = '';
6084
+ char = format[position++];
6085
+ while (char !== undefined && char !== '}') {
6086
+ sub += char;
6087
+ char = format[position++];
6088
+ }
6089
+ var isClosed = char === '}';
6090
+
6091
+ var type = RE_TOKEN_LIST_VALUE.test(sub)
6092
+ ? 'list'
6093
+ : isClosed && RE_TOKEN_NAMED_VALUE.test(sub)
6094
+ ? 'named'
6095
+ : 'unknown';
6096
+ tokens.push({ value: sub, type: type });
6097
+ } else if (char === '%') {
6098
+ // when found rails i18n syntax, skip text capture
6099
+ if (format[(position)] !== '{') {
6100
+ text += char;
6101
+ }
6102
+ } else {
6103
+ text += char;
6104
+ }
6105
+ }
6106
+
6107
+ text && tokens.push({ type: 'text', value: text });
6108
+
6109
+ return tokens
6110
+ }
6111
+
6112
+ function compile (tokens, values) {
6113
+ var compiled = [];
6114
+ var index = 0;
6115
+
6116
+ var mode = Array.isArray(values)
6117
+ ? 'list'
6118
+ : isObject(values)
6119
+ ? 'named'
6120
+ : 'unknown';
6121
+ if (mode === 'unknown') { return compiled }
6122
+
6123
+ while (index < tokens.length) {
6124
+ var token = tokens[index];
6125
+ switch (token.type) {
6126
+ case 'text':
6127
+ compiled.push(token.value);
6128
+ break
6129
+ case 'list':
6130
+ compiled.push(values[parseInt(token.value, 10)]);
6131
+ break
6132
+ case 'named':
6133
+ if (mode === 'named') {
6134
+ compiled.push((values)[token.value]);
6135
+ }
6136
+ break
6137
+ }
6138
+ index++;
6139
+ }
6140
+
6141
+ return compiled
6142
+ }
6143
+
6144
+ /* */
6145
+
6146
+ /**
6147
+ * Path parser
6148
+ * - Inspired:
6149
+ * Vue.js Path parser
6150
+ */
6151
+
6152
+ // actions
6153
+ var APPEND = 0;
6154
+ var PUSH = 1;
6155
+ var INC_SUB_PATH_DEPTH = 2;
6156
+ var PUSH_SUB_PATH = 3;
6157
+
6158
+ // states
6159
+ var BEFORE_PATH = 0;
6160
+ var IN_PATH = 1;
6161
+ var BEFORE_IDENT = 2;
6162
+ var IN_IDENT = 3;
6163
+ var IN_SUB_PATH = 4;
6164
+ var IN_SINGLE_QUOTE = 5;
6165
+ var IN_DOUBLE_QUOTE = 6;
6166
+ var AFTER_PATH = 7;
6167
+ var ERROR = 8;
6168
+
6169
+ var pathStateMachine = [];
6170
+
6171
+ pathStateMachine[BEFORE_PATH] = {
6172
+ 'ws': [BEFORE_PATH],
6173
+ 'ident': [IN_IDENT, APPEND],
6174
+ '[': [IN_SUB_PATH],
6175
+ 'eof': [AFTER_PATH]
6176
+ };
6177
+
6178
+ pathStateMachine[IN_PATH] = {
6179
+ 'ws': [IN_PATH],
6180
+ '.': [BEFORE_IDENT],
6181
+ '[': [IN_SUB_PATH],
6182
+ 'eof': [AFTER_PATH]
6183
+ };
6184
+
6185
+ pathStateMachine[BEFORE_IDENT] = {
6186
+ 'ws': [BEFORE_IDENT],
6187
+ 'ident': [IN_IDENT, APPEND],
6188
+ '0': [IN_IDENT, APPEND],
6189
+ 'number': [IN_IDENT, APPEND]
6190
+ };
6191
+
6192
+ pathStateMachine[IN_IDENT] = {
6193
+ 'ident': [IN_IDENT, APPEND],
6194
+ '0': [IN_IDENT, APPEND],
6195
+ 'number': [IN_IDENT, APPEND],
6196
+ 'ws': [IN_PATH, PUSH],
6197
+ '.': [BEFORE_IDENT, PUSH],
6198
+ '[': [IN_SUB_PATH, PUSH],
6199
+ 'eof': [AFTER_PATH, PUSH]
6200
+ };
6201
+
6202
+ pathStateMachine[IN_SUB_PATH] = {
6203
+ "'": [IN_SINGLE_QUOTE, APPEND],
6204
+ '"': [IN_DOUBLE_QUOTE, APPEND],
6205
+ '[': [IN_SUB_PATH, INC_SUB_PATH_DEPTH],
6206
+ ']': [IN_PATH, PUSH_SUB_PATH],
6207
+ 'eof': ERROR,
6208
+ 'else': [IN_SUB_PATH, APPEND]
6209
+ };
6210
+
6211
+ pathStateMachine[IN_SINGLE_QUOTE] = {
6212
+ "'": [IN_SUB_PATH, APPEND],
6213
+ 'eof': ERROR,
6214
+ 'else': [IN_SINGLE_QUOTE, APPEND]
6215
+ };
6216
+
6217
+ pathStateMachine[IN_DOUBLE_QUOTE] = {
6218
+ '"': [IN_SUB_PATH, APPEND],
6219
+ 'eof': ERROR,
6220
+ 'else': [IN_DOUBLE_QUOTE, APPEND]
6221
+ };
6222
+
6223
+ /**
6224
+ * Check if an expression is a literal value.
6225
+ */
6226
+
6227
+ var literalValueRE = /^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;
6228
+ function isLiteral (exp) {
6229
+ return literalValueRE.test(exp)
6230
+ }
6231
+
6232
+ /**
6233
+ * Strip quotes from a string
6234
+ */
6235
+
6236
+ function stripQuotes (str) {
6237
+ var a = str.charCodeAt(0);
6238
+ var b = str.charCodeAt(str.length - 1);
6239
+ return a === b && (a === 0x22 || a === 0x27)
6240
+ ? str.slice(1, -1)
6241
+ : str
6242
+ }
6243
+
6244
+ /**
6245
+ * Determine the type of a character in a keypath.
6246
+ */
6247
+
6248
+ function getPathCharType (ch) {
6249
+ if (ch === undefined || ch === null) { return 'eof' }
6250
+
6251
+ var code = ch.charCodeAt(0);
6252
+
6253
+ switch (code) {
6254
+ case 0x5B: // [
6255
+ case 0x5D: // ]
6256
+ case 0x2E: // .
6257
+ case 0x22: // "
6258
+ case 0x27: // '
6259
+ return ch
6260
+
6261
+ case 0x5F: // _
6262
+ case 0x24: // $
6263
+ case 0x2D: // -
6264
+ return 'ident'
6265
+
6266
+ case 0x09: // Tab
6267
+ case 0x0A: // Newline
6268
+ case 0x0D: // Return
6269
+ case 0xA0: // No-break space
6270
+ case 0xFEFF: // Byte Order Mark
6271
+ case 0x2028: // Line Separator
6272
+ case 0x2029: // Paragraph Separator
6273
+ return 'ws'
6274
+ }
6275
+
6276
+ return 'ident'
6277
+ }
6278
+
6279
+ /**
6280
+ * Format a subPath, return its plain form if it is
6281
+ * a literal string or number. Otherwise prepend the
6282
+ * dynamic indicator (*).
6283
+ */
6284
+
6285
+ function formatSubPath (path) {
6286
+ var trimmed = path.trim();
6287
+ // invalid leading 0
6288
+ if (path.charAt(0) === '0' && isNaN(path)) { return false }
6289
+
6290
+ return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed
6291
+ }
6292
+
6293
+ /**
6294
+ * Parse a string path into an array of segments
6295
+ */
6296
+
6297
+ function parse$1 (path) {
6298
+ var keys = [];
6299
+ var index = -1;
6300
+ var mode = BEFORE_PATH;
6301
+ var subPathDepth = 0;
6302
+ var c;
6303
+ var key;
6304
+ var newChar;
6305
+ var type;
6306
+ var transition;
6307
+ var action;
6308
+ var typeMap;
6309
+ var actions = [];
6310
+
6311
+ actions[PUSH] = function () {
6312
+ if (key !== undefined) {
6313
+ keys.push(key);
6314
+ key = undefined;
6315
+ }
6316
+ };
6317
+
6318
+ actions[APPEND] = function () {
6319
+ if (key === undefined) {
6320
+ key = newChar;
6321
+ } else {
6322
+ key += newChar;
6323
+ }
6324
+ };
6325
+
6326
+ actions[INC_SUB_PATH_DEPTH] = function () {
6327
+ actions[APPEND]();
6328
+ subPathDepth++;
6329
+ };
6330
+
6331
+ actions[PUSH_SUB_PATH] = function () {
6332
+ if (subPathDepth > 0) {
6333
+ subPathDepth--;
6334
+ mode = IN_SUB_PATH;
6335
+ actions[APPEND]();
6336
+ } else {
6337
+ subPathDepth = 0;
6338
+ if (key === undefined) { return false }
6339
+ key = formatSubPath(key);
6340
+ if (key === false) {
6341
+ return false
6342
+ } else {
6343
+ actions[PUSH]();
6344
+ }
6345
+ }
6346
+ };
6347
+
6348
+ function maybeUnescapeQuote () {
6349
+ var nextChar = path[index + 1];
6350
+ if ((mode === IN_SINGLE_QUOTE && nextChar === "'") ||
6351
+ (mode === IN_DOUBLE_QUOTE && nextChar === '"')) {
6352
+ index++;
6353
+ newChar = '\\' + nextChar;
6354
+ actions[APPEND]();
6355
+ return true
6356
+ }
6357
+ }
6358
+
6359
+ while (mode !== null) {
6360
+ index++;
6361
+ c = path[index];
6362
+
6363
+ if (c === '\\' && maybeUnescapeQuote()) {
6364
+ continue
6365
+ }
6366
+
6367
+ type = getPathCharType(c);
6368
+ typeMap = pathStateMachine[mode];
6369
+ transition = typeMap[type] || typeMap['else'] || ERROR;
6370
+
6371
+ if (transition === ERROR) {
6372
+ return // parse error
6373
+ }
6374
+
6375
+ mode = transition[0];
6376
+ action = actions[transition[1]];
6377
+ if (action) {
6378
+ newChar = transition[2];
6379
+ newChar = newChar === undefined
6380
+ ? c
6381
+ : newChar;
6382
+ if (action() === false) {
6383
+ return
6384
+ }
6385
+ }
6386
+
6387
+ if (mode === AFTER_PATH) {
6388
+ return keys
6389
+ }
6390
+ }
6391
+ }
6392
+
6393
+
6394
+
6395
+
6396
+
6397
+ var I18nPath = function I18nPath () {
6398
+ this._cache = Object.create(null);
6399
+ };
6400
+
6401
+ /**
6402
+ * External parse that check for a cache hit first
6403
+ */
6404
+ I18nPath.prototype.parsePath = function parsePath (path) {
6405
+ var hit = this._cache[path];
6406
+ if (!hit) {
6407
+ hit = parse$1(path);
6408
+ if (hit) {
6409
+ this._cache[path] = hit;
6410
+ }
6411
+ }
6412
+ return hit || []
6413
+ };
6414
+
6415
+ /**
6416
+ * Get path value from path string
6417
+ */
6418
+ I18nPath.prototype.getPathValue = function getPathValue (obj, path) {
6419
+ if (!isObject(obj)) { return null }
6420
+
6421
+ var paths = this.parsePath(path);
6422
+ if (paths.length === 0) {
6423
+ return null
6424
+ } else {
6425
+ var length = paths.length;
6426
+ var last = obj;
6427
+ var i = 0;
6428
+ while (i < length) {
6429
+ var value = last[paths[i]];
6430
+ if (value === undefined || value === null) {
6431
+ return null
6432
+ }
6433
+ last = value;
6434
+ i++;
6435
+ }
6436
+
6437
+ return last
6438
+ }
6439
+ };
6440
+
6441
+ /* */
6442
+
6443
+
6444
+
6445
+ var htmlTagMatcher = /<\/?[\w\s="/.':;#-\/]+>/;
6446
+ var linkKeyMatcher = /(?:@(?:\.[a-zA-Z]+)?:(?:[\w\-_|./]+|\([\w\-_:|./]+\)))/g;
6447
+ var linkKeyPrefixMatcher = /^@(?:\.([a-zA-Z]+))?:/;
6448
+ var bracketsMatcher = /[()]/g;
6449
+ var defaultModifiers = {
6450
+ 'upper': function (str) { return str.toLocaleUpperCase(); },
6451
+ 'lower': function (str) { return str.toLocaleLowerCase(); },
6452
+ 'capitalize': function (str) { return ("" + (str.charAt(0).toLocaleUpperCase()) + (str.substr(1))); }
6453
+ };
6454
+
6455
+ var defaultFormatter = new BaseFormatter();
6456
+
6457
+ var VueI18n = function VueI18n (options) {
6458
+ var this$1$1 = this;
6459
+ if ( options === void 0 ) options = {};
6460
+
6461
+ // Auto install if it is not done yet and `window` has `Vue`.
6462
+ // To allow users to avoid auto-installation in some cases,
6463
+ // this code should be placed here. See #290
6464
+ /* istanbul ignore if */
6465
+ if (!Vue && typeof window !== 'undefined' && window.Vue) {
6466
+ install$1(window.Vue);
6467
+ }
6468
+
6469
+ var locale = options.locale || 'en-US';
6470
+ var fallbackLocale = options.fallbackLocale === false
6471
+ ? false
6472
+ : options.fallbackLocale || 'en-US';
6473
+ var messages = options.messages || {};
6474
+ var dateTimeFormats = options.dateTimeFormats || options.datetimeFormats || {};
6475
+ var numberFormats = options.numberFormats || {};
6476
+
6477
+ this._vm = null;
6478
+ this._formatter = options.formatter || defaultFormatter;
6479
+ this._modifiers = options.modifiers || {};
6480
+ this._missing = options.missing || null;
6481
+ this._root = options.root || null;
6482
+ this._sync = options.sync === undefined ? true : !!options.sync;
6483
+ this._fallbackRoot = options.fallbackRoot === undefined
6484
+ ? true
6485
+ : !!options.fallbackRoot;
6486
+ this._fallbackRootWithEmptyString = options.fallbackRootWithEmptyString === undefined
6487
+ ? true
6488
+ : !!options.fallbackRootWithEmptyString;
6489
+ this._formatFallbackMessages = options.formatFallbackMessages === undefined
6490
+ ? false
6491
+ : !!options.formatFallbackMessages;
6492
+ this._silentTranslationWarn = options.silentTranslationWarn === undefined
6493
+ ? false
6494
+ : options.silentTranslationWarn;
6495
+ this._silentFallbackWarn = options.silentFallbackWarn === undefined
6496
+ ? false
6497
+ : !!options.silentFallbackWarn;
6498
+ this._dateTimeFormatters = {};
6499
+ this._numberFormatters = {};
6500
+ this._path = new I18nPath();
6501
+ this._dataListeners = new Set();
6502
+ this._componentInstanceCreatedListener = options.componentInstanceCreatedListener || null;
6503
+ this._preserveDirectiveContent = options.preserveDirectiveContent === undefined
6504
+ ? false
6505
+ : !!options.preserveDirectiveContent;
6506
+ this.pluralizationRules = options.pluralizationRules || {};
6507
+ this._warnHtmlInMessage = options.warnHtmlInMessage || 'off';
6508
+ this._postTranslation = options.postTranslation || null;
6509
+ this._escapeParameterHtml = options.escapeParameterHtml || false;
6510
+
6511
+ if ('__VUE_I18N_BRIDGE__' in options) {
6512
+ this.__VUE_I18N_BRIDGE__ = options.__VUE_I18N_BRIDGE__;
6513
+ }
6514
+
6515
+ /**
6516
+ * @param choice {number} a choice index given by the input to $tc: `$tc('path.to.rule', choiceIndex)`
6517
+ * @param choicesLength {number} an overall amount of available choices
6518
+ * @returns a final choice index
6519
+ */
6520
+ this.getChoiceIndex = function (choice, choicesLength) {
6521
+ var thisPrototype = Object.getPrototypeOf(this$1$1);
6522
+ if (thisPrototype && thisPrototype.getChoiceIndex) {
6523
+ var prototypeGetChoiceIndex = (thisPrototype.getChoiceIndex);
6524
+ return (prototypeGetChoiceIndex).call(this$1$1, choice, choicesLength)
6525
+ }
6526
+
6527
+ // Default (old) getChoiceIndex implementation - english-compatible
6528
+ var defaultImpl = function (_choice, _choicesLength) {
6529
+ _choice = Math.abs(_choice);
6530
+
6531
+ if (_choicesLength === 2) {
6532
+ return _choice
6533
+ ? _choice > 1
6534
+ ? 1
6535
+ : 0
6536
+ : 1
6537
+ }
6538
+
6539
+ return _choice ? Math.min(_choice, 2) : 0
6540
+ };
6541
+
6542
+ if (this$1$1.locale in this$1$1.pluralizationRules) {
6543
+ return this$1$1.pluralizationRules[this$1$1.locale].apply(this$1$1, [choice, choicesLength])
6544
+ } else {
6545
+ return defaultImpl(choice, choicesLength)
6546
+ }
6547
+ };
6548
+
6549
+
6550
+ this._exist = function (message, key) {
6551
+ if (!message || !key) { return false }
6552
+ if (!isNull(this$1$1._path.getPathValue(message, key))) { return true }
6553
+ // fallback for flat key
6554
+ if (message[key]) { return true }
6555
+ return false
6556
+ };
6557
+
6558
+ if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') {
6559
+ Object.keys(messages).forEach(function (locale) {
6560
+ this$1$1._checkLocaleMessage(locale, this$1$1._warnHtmlInMessage, messages[locale]);
6561
+ });
6562
+ }
6563
+
6564
+ this._initVM({
6565
+ locale: locale,
6566
+ fallbackLocale: fallbackLocale,
6567
+ messages: messages,
6568
+ dateTimeFormats: dateTimeFormats,
6569
+ numberFormats: numberFormats
6570
+ });
6571
+ };
6572
+
6573
+ var prototypeAccessors = { vm: { configurable: true },messages: { configurable: true },dateTimeFormats: { configurable: true },numberFormats: { configurable: true },availableLocales: { configurable: true },locale: { configurable: true },fallbackLocale: { configurable: true },formatFallbackMessages: { configurable: true },missing: { configurable: true },formatter: { configurable: true },silentTranslationWarn: { configurable: true },silentFallbackWarn: { configurable: true },preserveDirectiveContent: { configurable: true },warnHtmlInMessage: { configurable: true },postTranslation: { configurable: true },sync: { configurable: true } };
6574
+
6575
+ VueI18n.prototype._checkLocaleMessage = function _checkLocaleMessage (locale, level, message) {
6576
+ var paths = [];
6577
+
6578
+ var fn = function (level, locale, message, paths) {
6579
+ if (isPlainObject(message)) {
6580
+ Object.keys(message).forEach(function (key) {
6581
+ var val = message[key];
6582
+ if (isPlainObject(val)) {
6583
+ paths.push(key);
6584
+ paths.push('.');
6585
+ fn(level, locale, val, paths);
6586
+ paths.pop();
6587
+ paths.pop();
6588
+ } else {
6589
+ paths.push(key);
6590
+ fn(level, locale, val, paths);
6591
+ paths.pop();
6592
+ }
6593
+ });
6594
+ } else if (isArray(message)) {
6595
+ message.forEach(function (item, index) {
6596
+ if (isPlainObject(item)) {
6597
+ paths.push(("[" + index + "]"));
6598
+ paths.push('.');
6599
+ fn(level, locale, item, paths);
6600
+ paths.pop();
6601
+ paths.pop();
6602
+ } else {
6603
+ paths.push(("[" + index + "]"));
6604
+ fn(level, locale, item, paths);
6605
+ paths.pop();
6606
+ }
6607
+ });
6608
+ } else if (isString(message)) {
6609
+ var ret = htmlTagMatcher.test(message);
6610
+ if (ret) {
6611
+ var msg = "Detected HTML in message '" + message + "' of keypath '" + (paths.join('')) + "' at '" + locale + "'. Consider component interpolation with '<i18n>' to avoid XSS. See https://bit.ly/2ZqJzkp";
6612
+ if (level === 'warn') {
6613
+ warn(msg);
6614
+ } else if (level === 'error') {
6615
+ error(msg);
6616
+ }
6617
+ }
6618
+ }
6619
+ };
6620
+
6621
+ fn(level, locale, message, paths);
6622
+ };
6623
+
6624
+ VueI18n.prototype._initVM = function _initVM (data) {
6625
+ var silent = Vue.config.silent;
6626
+ Vue.config.silent = true;
6627
+ this._vm = new Vue({ data: data, __VUE18N__INSTANCE__: true });
6628
+ Vue.config.silent = silent;
6629
+ };
6630
+
6631
+ VueI18n.prototype.destroyVM = function destroyVM () {
6632
+ this._vm.$destroy();
6633
+ };
6634
+
6635
+ VueI18n.prototype.subscribeDataChanging = function subscribeDataChanging (vm) {
6636
+ this._dataListeners.add(vm);
6637
+ };
6638
+
6639
+ VueI18n.prototype.unsubscribeDataChanging = function unsubscribeDataChanging (vm) {
6640
+ remove(this._dataListeners, vm);
6641
+ };
6642
+
6643
+ VueI18n.prototype.watchI18nData = function watchI18nData () {
6644
+ var this$1$1 = this;
6645
+ return this._vm.$watch('$data', function () {
6646
+ var listeners = arrayFrom(this$1$1._dataListeners);
6647
+ var i = listeners.length;
6648
+ while(i--) {
6649
+ Vue.nextTick(function () {
6650
+ listeners[i] && listeners[i].$forceUpdate();
6651
+ });
6652
+ }
6653
+ }, { deep: true })
6654
+ };
6655
+
6656
+ VueI18n.prototype.watchLocale = function watchLocale (composer) {
6657
+ if (!composer) {
6658
+ /* istanbul ignore if */
6659
+ if (!this._sync || !this._root) { return null }
6660
+ var target = this._vm;
6661
+ return this._root.$i18n.vm.$watch('locale', function (val) {
6662
+ target.$set(target, 'locale', val);
6663
+ target.$forceUpdate();
6664
+ }, { immediate: true })
6665
+ } else {
6666
+ // deal with vue-i18n-bridge
6667
+ if (!this.__VUE_I18N_BRIDGE__) { return null }
6668
+ var self = this;
6669
+ var target$1 = this._vm;
6670
+ return this.vm.$watch('locale', function (val) {
6671
+ target$1.$set(target$1, 'locale', val);
6672
+ if (self.__VUE_I18N_BRIDGE__ && composer) {
6673
+ composer.locale.value = val;
6674
+ }
6675
+ target$1.$forceUpdate();
6676
+ }, { immediate: true })
6677
+ }
6678
+ };
6679
+
6680
+ VueI18n.prototype.onComponentInstanceCreated = function onComponentInstanceCreated (newI18n) {
6681
+ if (this._componentInstanceCreatedListener) {
6682
+ this._componentInstanceCreatedListener(newI18n, this);
6683
+ }
6684
+ };
6685
+
6686
+ prototypeAccessors.vm.get = function () { return this._vm };
6687
+
6688
+ prototypeAccessors.messages.get = function () { return looseClone(this._getMessages()) };
6689
+ prototypeAccessors.dateTimeFormats.get = function () { return looseClone(this._getDateTimeFormats()) };
6690
+ prototypeAccessors.numberFormats.get = function () { return looseClone(this._getNumberFormats()) };
6691
+ prototypeAccessors.availableLocales.get = function () { return Object.keys(this.messages).sort() };
6692
+
6693
+ prototypeAccessors.locale.get = function () { return this._vm.locale };
6694
+ prototypeAccessors.locale.set = function (locale) {
6695
+ this._vm.$set(this._vm, 'locale', locale);
6696
+ };
6697
+
6698
+ prototypeAccessors.fallbackLocale.get = function () { return this._vm.fallbackLocale };
6699
+ prototypeAccessors.fallbackLocale.set = function (locale) {
6700
+ this._localeChainCache = {};
6701
+ this._vm.$set(this._vm, 'fallbackLocale', locale);
6702
+ };
6703
+
6704
+ prototypeAccessors.formatFallbackMessages.get = function () { return this._formatFallbackMessages };
6705
+ prototypeAccessors.formatFallbackMessages.set = function (fallback) { this._formatFallbackMessages = fallback; };
6706
+
6707
+ prototypeAccessors.missing.get = function () { return this._missing };
6708
+ prototypeAccessors.missing.set = function (handler) { this._missing = handler; };
6709
+
6710
+ prototypeAccessors.formatter.get = function () { return this._formatter };
6711
+ prototypeAccessors.formatter.set = function (formatter) { this._formatter = formatter; };
6712
+
6713
+ prototypeAccessors.silentTranslationWarn.get = function () { return this._silentTranslationWarn };
6714
+ prototypeAccessors.silentTranslationWarn.set = function (silent) { this._silentTranslationWarn = silent; };
6715
+
6716
+ prototypeAccessors.silentFallbackWarn.get = function () { return this._silentFallbackWarn };
6717
+ prototypeAccessors.silentFallbackWarn.set = function (silent) { this._silentFallbackWarn = silent; };
6718
+
6719
+ prototypeAccessors.preserveDirectiveContent.get = function () { return this._preserveDirectiveContent };
6720
+ prototypeAccessors.preserveDirectiveContent.set = function (preserve) { this._preserveDirectiveContent = preserve; };
6721
+
6722
+ prototypeAccessors.warnHtmlInMessage.get = function () { return this._warnHtmlInMessage };
6723
+ prototypeAccessors.warnHtmlInMessage.set = function (level) {
6724
+ var this$1$1 = this;
6725
+
6726
+ var orgLevel = this._warnHtmlInMessage;
6727
+ this._warnHtmlInMessage = level;
6728
+ if (orgLevel !== level && (level === 'warn' || level === 'error')) {
6729
+ var messages = this._getMessages();
6730
+ Object.keys(messages).forEach(function (locale) {
6731
+ this$1$1._checkLocaleMessage(locale, this$1$1._warnHtmlInMessage, messages[locale]);
6732
+ });
6733
+ }
6734
+ };
6735
+
6736
+ prototypeAccessors.postTranslation.get = function () { return this._postTranslation };
6737
+ prototypeAccessors.postTranslation.set = function (handler) { this._postTranslation = handler; };
6738
+
6739
+ prototypeAccessors.sync.get = function () { return this._sync };
6740
+ prototypeAccessors.sync.set = function (val) { this._sync = val; };
6741
+
6742
+ VueI18n.prototype._getMessages = function _getMessages () { return this._vm.messages };
6743
+ VueI18n.prototype._getDateTimeFormats = function _getDateTimeFormats () { return this._vm.dateTimeFormats };
6744
+ VueI18n.prototype._getNumberFormats = function _getNumberFormats () { return this._vm.numberFormats };
6745
+
6746
+ VueI18n.prototype._warnDefault = function _warnDefault (locale, key, result, vm, values, interpolateMode) {
6747
+ if (!isNull(result)) { return result }
6748
+ if (this._missing) {
6749
+ var missingRet = this._missing.apply(null, [locale, key, vm, values]);
6750
+ if (isString(missingRet)) {
6751
+ return missingRet
6752
+ }
6753
+ }
6754
+
6755
+ if (this._formatFallbackMessages) {
6756
+ var parsedArgs = parseArgs.apply(void 0, values);
6757
+ return this._render(key, interpolateMode, parsedArgs.params, key)
6758
+ } else {
6759
+ return key
6760
+ }
6761
+ };
6762
+
6763
+ VueI18n.prototype._isFallbackRoot = function _isFallbackRoot (val) {
6764
+ return (this._fallbackRootWithEmptyString? !val : isNull(val)) && !isNull(this._root) && this._fallbackRoot
6765
+ };
6766
+
6767
+ VueI18n.prototype._isSilentFallbackWarn = function _isSilentFallbackWarn (key) {
6768
+ return this._silentFallbackWarn instanceof RegExp
6769
+ ? this._silentFallbackWarn.test(key)
6770
+ : this._silentFallbackWarn
6771
+ };
6772
+
6773
+ VueI18n.prototype._isSilentFallback = function _isSilentFallback (locale, key) {
6774
+ return this._isSilentFallbackWarn(key) && (this._isFallbackRoot() || locale !== this.fallbackLocale)
6775
+ };
6776
+
6777
+ VueI18n.prototype._isSilentTranslationWarn = function _isSilentTranslationWarn (key) {
6778
+ return this._silentTranslationWarn instanceof RegExp
6779
+ ? this._silentTranslationWarn.test(key)
6780
+ : this._silentTranslationWarn
6781
+ };
6782
+
6783
+ VueI18n.prototype._interpolate = function _interpolate (
6784
+ locale,
6785
+ message,
6786
+ key,
6787
+ host,
6788
+ interpolateMode,
6789
+ values,
6790
+ visitedLinkStack
6791
+ ) {
6792
+ if (!message) { return null }
6793
+
6794
+ var pathRet = this._path.getPathValue(message, key);
6795
+ if (isArray(pathRet) || isPlainObject(pathRet)) { return pathRet }
6796
+
6797
+ var ret;
6798
+ if (isNull(pathRet)) {
6799
+ /* istanbul ignore else */
6800
+ if (isPlainObject(message)) {
6801
+ ret = message[key];
6802
+ if (!(isString(ret) || isFunction(ret))) {
6803
+ return null
6804
+ }
6805
+ } else {
6806
+ return null
6807
+ }
6808
+ } else {
6809
+ /* istanbul ignore else */
6810
+ if (isString(pathRet) || isFunction(pathRet)) {
6811
+ ret = pathRet;
6812
+ } else {
6813
+ return null
6814
+ }
6815
+ }
6816
+
6817
+ // Check for the existence of links within the translated string
6818
+ if (isString(ret) && (ret.indexOf('@:') >= 0 || ret.indexOf('@.') >= 0)) {
6819
+ ret = this._link(locale, message, ret, host, 'raw', values, visitedLinkStack);
6820
+ }
6821
+
6822
+ return this._render(ret, interpolateMode, values, key)
6823
+ };
6824
+
6825
+ VueI18n.prototype._link = function _link (
6826
+ locale,
6827
+ message,
6828
+ str,
6829
+ host,
6830
+ interpolateMode,
6831
+ values,
6832
+ visitedLinkStack
6833
+ ) {
6834
+ var ret = str;
6835
+
6836
+ // Match all the links within the local
6837
+ // We are going to replace each of
6838
+ // them with its translation
6839
+ var matches = ret.match(linkKeyMatcher);
6840
+
6841
+ // eslint-disable-next-line no-autofix/prefer-const
6842
+ for (var idx in matches) {
6843
+ // ie compatible: filter custom array
6844
+ // prototype method
6845
+ if (!matches.hasOwnProperty(idx)) {
6846
+ continue
6847
+ }
6848
+ var link = matches[idx];
6849
+ var linkKeyPrefixMatches = link.match(linkKeyPrefixMatcher);
6850
+ var linkPrefix = linkKeyPrefixMatches[0];
6851
+ var formatterName = linkKeyPrefixMatches[1];
6852
+
6853
+ // Remove the leading @:, @.case: and the brackets
6854
+ var linkPlaceholder = link.replace(linkPrefix, '').replace(bracketsMatcher, '');
6855
+
6856
+ if (includes(visitedLinkStack, linkPlaceholder)) {
6857
+ return ret
6858
+ }
6859
+ visitedLinkStack.push(linkPlaceholder);
6860
+
6861
+ // Translate the link
6862
+ var translated = this._interpolate(
6863
+ locale, message, linkPlaceholder, host,
6864
+ interpolateMode === 'raw' ? 'string' : interpolateMode,
6865
+ interpolateMode === 'raw' ? undefined : values,
6866
+ visitedLinkStack
6867
+ );
6868
+
6869
+ if (this._isFallbackRoot(translated)) {
6870
+ /* istanbul ignore if */
6871
+ if (!this._root) { throw Error('unexpected error') }
6872
+ var root = this._root.$i18n;
6873
+ translated = root._translate(
6874
+ root._getMessages(), root.locale, root.fallbackLocale,
6875
+ linkPlaceholder, host, interpolateMode, values
6876
+ );
6877
+ }
6878
+ translated = this._warnDefault(
6879
+ locale, linkPlaceholder, translated, host,
6880
+ isArray(values) ? values : [values],
6881
+ interpolateMode
6882
+ );
6883
+
6884
+ if (this._modifiers.hasOwnProperty(formatterName)) {
6885
+ translated = this._modifiers[formatterName](translated);
6886
+ } else if (defaultModifiers.hasOwnProperty(formatterName)) {
6887
+ translated = defaultModifiers[formatterName](translated);
6888
+ }
6889
+
6890
+ visitedLinkStack.pop();
6891
+
6892
+ // Replace the link with the translated
6893
+ ret = !translated ? ret : ret.replace(link, translated);
6894
+ }
6895
+
6896
+ return ret
6897
+ };
6898
+
6899
+ VueI18n.prototype._createMessageContext = function _createMessageContext (values, formatter, path, interpolateMode) {
6900
+ var this$1$1 = this;
6901
+
6902
+ var _list = isArray(values) ? values : [];
6903
+ var _named = isObject(values) ? values : {};
6904
+ var list = function (index) { return _list[index]; };
6905
+ var named = function (key) { return _named[key]; };
6906
+ var messages = this._getMessages();
6907
+ var locale = this.locale;
6908
+
6909
+ return {
6910
+ list: list,
6911
+ named: named,
6912
+ values: values,
6913
+ formatter: formatter,
6914
+ path: path,
6915
+ messages: messages,
6916
+ locale: locale,
6917
+ linked: function (linkedKey) { return this$1$1._interpolate(locale, messages[locale] || {}, linkedKey, null, interpolateMode, undefined, [linkedKey]); }
6918
+ }
6919
+ };
6920
+
6921
+ VueI18n.prototype._render = function _render (message, interpolateMode, values, path) {
6922
+ if (isFunction(message)) {
6923
+ return message(
6924
+ this._createMessageContext(values, this._formatter || defaultFormatter, path, interpolateMode)
6925
+ )
6926
+ }
6927
+
6928
+ var ret = this._formatter.interpolate(message, values, path);
6929
+
6930
+ // If the custom formatter refuses to work - apply the default one
6931
+ if (!ret) {
6932
+ ret = defaultFormatter.interpolate(message, values, path);
6933
+ }
6934
+
6935
+ // if interpolateMode is **not** 'string' ('row'),
6936
+ // return the compiled data (e.g. ['foo', VNode, 'bar']) with formatter
6937
+ return interpolateMode === 'string' && !isString(ret) ? ret.join('') : ret
6938
+ };
6939
+
6940
+ VueI18n.prototype._appendItemToChain = function _appendItemToChain (chain, item, blocks) {
6941
+ var follow = false;
6942
+ if (!includes(chain, item)) {
6943
+ follow = true;
6944
+ if (item) {
6945
+ follow = item[item.length - 1] !== '!';
6946
+ item = item.replace(/!/g, '');
6947
+ chain.push(item);
6948
+ if (blocks && blocks[item]) {
6949
+ follow = blocks[item];
6950
+ }
6951
+ }
6952
+ }
6953
+ return follow
6954
+ };
6955
+
6956
+ VueI18n.prototype._appendLocaleToChain = function _appendLocaleToChain (chain, locale, blocks) {
6957
+ var follow;
6958
+ var tokens = locale.split('-');
6959
+ do {
6960
+ var item = tokens.join('-');
6961
+ follow = this._appendItemToChain(chain, item, blocks);
6962
+ tokens.splice(-1, 1);
6963
+ } while (tokens.length && (follow === true))
6964
+ return follow
6965
+ };
6966
+
6967
+ VueI18n.prototype._appendBlockToChain = function _appendBlockToChain (chain, block, blocks) {
6968
+ var follow = true;
6969
+ for (var i = 0; (i < block.length) && (isBoolean(follow)); i++) {
6970
+ var locale = block[i];
6971
+ if (isString(locale)) {
6972
+ follow = this._appendLocaleToChain(chain, locale, blocks);
6973
+ }
6974
+ }
6975
+ return follow
6976
+ };
6977
+
6978
+ VueI18n.prototype._getLocaleChain = function _getLocaleChain (start, fallbackLocale) {
6979
+ if (start === '') { return [] }
6980
+
6981
+ if (!this._localeChainCache) {
6982
+ this._localeChainCache = {};
6983
+ }
6984
+
6985
+ var chain = this._localeChainCache[start];
6986
+ if (!chain) {
6987
+ if (!fallbackLocale) {
6988
+ fallbackLocale = this.fallbackLocale;
6989
+ }
6990
+ chain = [];
6991
+
6992
+ // first block defined by start
6993
+ var block = [start];
6994
+
6995
+ // while any intervening block found
6996
+ while (isArray(block)) {
6997
+ block = this._appendBlockToChain(
6998
+ chain,
6999
+ block,
7000
+ fallbackLocale
7001
+ );
7002
+ }
7003
+
7004
+ // last block defined by default
7005
+ var defaults;
7006
+ if (isArray(fallbackLocale)) {
7007
+ defaults = fallbackLocale;
7008
+ } else if (isObject(fallbackLocale)) {
7009
+ /* $FlowFixMe */
7010
+ if (fallbackLocale['default']) {
7011
+ defaults = fallbackLocale['default'];
7012
+ } else {
7013
+ defaults = null;
7014
+ }
7015
+ } else {
7016
+ defaults = fallbackLocale;
7017
+ }
7018
+
7019
+ // convert defaults to array
7020
+ if (isString(defaults)) {
7021
+ block = [defaults];
7022
+ } else {
7023
+ block = defaults;
7024
+ }
7025
+ if (block) {
7026
+ this._appendBlockToChain(
7027
+ chain,
7028
+ block,
7029
+ null
7030
+ );
7031
+ }
7032
+ this._localeChainCache[start] = chain;
7033
+ }
7034
+ return chain
7035
+ };
7036
+
7037
+ VueI18n.prototype._translate = function _translate (
7038
+ messages,
7039
+ locale,
7040
+ fallback,
7041
+ key,
7042
+ host,
7043
+ interpolateMode,
7044
+ args
7045
+ ) {
7046
+ var chain = this._getLocaleChain(locale, fallback);
7047
+ var res;
7048
+ for (var i = 0; i < chain.length; i++) {
7049
+ var step = chain[i];
7050
+ res =
7051
+ this._interpolate(step, messages[step], key, host, interpolateMode, args, [key]);
7052
+ if (!isNull(res)) {
7053
+ if (step !== locale && "production" !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {
7054
+ warn(("Fall back to translate the keypath '" + key + "' with '" + step + "' locale."));
7055
+ }
7056
+ return res
7057
+ }
7058
+ }
7059
+ return null
5134
7060
  };
5135
- var fcDictInputs = [];
5136
- var fcRefInputs = {};
5137
- var fcRefInputConfigs = {};
5138
- var baseConfig = {
5139
- inputs: __clone(fcInputs),
5140
- primitiveInputs: __clone(fcPrimitiveInputs),
5141
- dictInputs: __clone(fcDictInputs),
5142
- refInputs: __clone(fcRefInputs),
5143
- refInputConfigs: __clone(fcRefInputConfigs),
5144
- rules: [],
5145
- icons: {
5146
- iconExpandFacet: 'icon-chevron-down',
5147
- iconCollapseFacet: 'icon-chevron-up',
5148
- iconCloseFieldSidebar: 'icon-chevron-right',
5149
- iconOpenFieldSidebar: 'icon-chevron-left',
5150
- iconAdd: 'icon-add',
5151
- iconEdit: 'icon-edit',
5152
- iconDelete: 'icon-delete',
5153
- iconDrag: 'icon-reorder'
5154
- },
5155
- ruleContext: {}
7061
+
7062
+ VueI18n.prototype._t = function _t (key, _locale, messages, host) {
7063
+ var ref;
7064
+
7065
+ var values = [], len = arguments.length - 4;
7066
+ while ( len-- > 0 ) values[ len ] = arguments[ len + 4 ];
7067
+ if (!key) { return '' }
7068
+
7069
+ var parsedArgs = parseArgs.apply(void 0, values);
7070
+ if(this._escapeParameterHtml) {
7071
+ parsedArgs.params = escapeParams(parsedArgs.params);
7072
+ }
7073
+
7074
+ var locale = parsedArgs.locale || _locale;
7075
+
7076
+ var ret = this._translate(
7077
+ messages, locale, this.fallbackLocale, key,
7078
+ host, 'string', parsedArgs.params
7079
+ );
7080
+ if (this._isFallbackRoot(ret)) {
7081
+ /* istanbul ignore if */
7082
+ if (!this._root) { throw Error('unexpected error') }
7083
+ return (ref = this._root).$t.apply(ref, [ key ].concat( values ))
7084
+ } else {
7085
+ ret = this._warnDefault(locale, key, ret, host, values, 'string');
7086
+ if (this._postTranslation && ret !== null && ret !== undefined) {
7087
+ ret = this._postTranslation(ret, key);
7088
+ }
7089
+ return ret
7090
+ }
5156
7091
  };
5157
- var UtFormConstructor = {
5158
- config: {},
5159
- init: function init(formConfig) {
5160
- this.config = __clone(baseConfig);
5161
7092
 
5162
- if (formConfig) {
5163
- if (formConfig.inputs) {
5164
- __mergeInputsInMap(this.config.inputs, formConfig.inputs);
5165
- }
7093
+ VueI18n.prototype.t = function t (key) {
7094
+ var ref;
5166
7095
 
5167
- if (formConfig.primitiveInputs) {
5168
- __mergeInputInMapOfArrays(this.config.primitiveInputs, formConfig.primitiveInputs);
5169
- }
7096
+ var values = [], len = arguments.length - 1;
7097
+ while ( len-- > 0 ) values[ len ] = arguments[ len + 1 ];
7098
+ return (ref = this)._t.apply(ref, [ key, this.locale, this._getMessages(), null ].concat( values ))
7099
+ };
5170
7100
 
5171
- if (formConfig.dictInputs) {
5172
- __mergeInputsInArray(this.config.dictInputs, formConfig.dictInputs);
5173
- }
7101
+ VueI18n.prototype._i = function _i (key, locale, messages, host, values) {
7102
+ var ret =
7103
+ this._translate(messages, locale, this.fallbackLocale, key, host, 'raw', values);
7104
+ if (this._isFallbackRoot(ret)) {
7105
+ if (!this._root) { throw Error('unexpected error') }
7106
+ return this._root.$i18n.i(key, locale, values)
7107
+ } else {
7108
+ return this._warnDefault(locale, key, ret, host, [values], 'raw')
7109
+ }
7110
+ };
5174
7111
 
5175
- if (formConfig.refInputs) {
5176
- __mergeInputInMapOfArrays(this.config.refInputs, formConfig.refInputs);
5177
- }
7112
+ VueI18n.prototype.i = function i (key, locale, values) {
7113
+ /* istanbul ignore if */
7114
+ if (!key) { return '' }
5178
7115
 
5179
- if (formConfig.refInputConfigs) {
5180
- this.config.refInputConfigs = formConfig.refInputConfigs;
7116
+ if (!isString(locale)) {
7117
+ locale = this.locale;
7118
+ }
7119
+
7120
+ return this._i(key, locale, this._getMessages(), null, values)
7121
+ };
7122
+
7123
+ VueI18n.prototype._tc = function _tc (
7124
+ key,
7125
+ _locale,
7126
+ messages,
7127
+ host,
7128
+ choice
7129
+ ) {
7130
+ var ref;
7131
+
7132
+ var values = [], len = arguments.length - 5;
7133
+ while ( len-- > 0 ) values[ len ] = arguments[ len + 5 ];
7134
+ if (!key) { return '' }
7135
+ if (choice === undefined) {
7136
+ choice = 1;
7137
+ }
7138
+
7139
+ var predefined = { 'count': choice, 'n': choice };
7140
+ var parsedArgs = parseArgs.apply(void 0, values);
7141
+ parsedArgs.params = Object.assign(predefined, parsedArgs.params);
7142
+ values = parsedArgs.locale === null ? [parsedArgs.params] : [parsedArgs.locale, parsedArgs.params];
7143
+ return this.fetchChoice((ref = this)._t.apply(ref, [ key, _locale, messages, host ].concat( values )), choice)
7144
+ };
7145
+
7146
+ VueI18n.prototype.fetchChoice = function fetchChoice (message, choice) {
7147
+ /* istanbul ignore if */
7148
+ if (!message || !isString(message)) { return null }
7149
+ var choices = message.split('|');
7150
+
7151
+ choice = this.getChoiceIndex(choice, choices.length);
7152
+ if (!choices[choice]) { return message }
7153
+ return choices[choice].trim()
7154
+ };
7155
+
7156
+ VueI18n.prototype.tc = function tc (key, choice) {
7157
+ var ref;
7158
+
7159
+ var values = [], len = arguments.length - 2;
7160
+ while ( len-- > 0 ) values[ len ] = arguments[ len + 2 ];
7161
+ return (ref = this)._tc.apply(ref, [ key, this.locale, this._getMessages(), null, choice ].concat( values ))
7162
+ };
7163
+
7164
+ VueI18n.prototype._te = function _te (key, locale, messages) {
7165
+ var args = [], len = arguments.length - 3;
7166
+ while ( len-- > 0 ) args[ len ] = arguments[ len + 3 ];
7167
+
7168
+ var _locale = parseArgs.apply(void 0, args).locale || locale;
7169
+ return this._exist(messages[_locale], key)
7170
+ };
7171
+
7172
+ VueI18n.prototype.te = function te (key, locale) {
7173
+ return this._te(key, this.locale, this._getMessages(), locale)
7174
+ };
7175
+
7176
+ VueI18n.prototype.getLocaleMessage = function getLocaleMessage (locale) {
7177
+ return looseClone(this._vm.messages[locale] || {})
7178
+ };
7179
+
7180
+ VueI18n.prototype.setLocaleMessage = function setLocaleMessage (locale, message) {
7181
+ if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') {
7182
+ this._checkLocaleMessage(locale, this._warnHtmlInMessage, message);
7183
+ }
7184
+ this._vm.$set(this._vm.messages, locale, message);
7185
+ };
7186
+
7187
+ VueI18n.prototype.mergeLocaleMessage = function mergeLocaleMessage (locale, message) {
7188
+ if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') {
7189
+ this._checkLocaleMessage(locale, this._warnHtmlInMessage, message);
7190
+ }
7191
+ this._vm.$set(this._vm.messages, locale, merge(
7192
+ typeof this._vm.messages[locale] !== 'undefined' && Object.keys(this._vm.messages[locale]).length
7193
+ ? Object.assign({}, this._vm.messages[locale])
7194
+ : {},
7195
+ message
7196
+ ));
7197
+ };
7198
+
7199
+ VueI18n.prototype.getDateTimeFormat = function getDateTimeFormat (locale) {
7200
+ return looseClone(this._vm.dateTimeFormats[locale] || {})
7201
+ };
7202
+
7203
+ VueI18n.prototype.setDateTimeFormat = function setDateTimeFormat (locale, format) {
7204
+ this._vm.$set(this._vm.dateTimeFormats, locale, format);
7205
+ this._clearDateTimeFormat(locale, format);
7206
+ };
7207
+
7208
+ VueI18n.prototype.mergeDateTimeFormat = function mergeDateTimeFormat (locale, format) {
7209
+ this._vm.$set(this._vm.dateTimeFormats, locale, merge(this._vm.dateTimeFormats[locale] || {}, format));
7210
+ this._clearDateTimeFormat(locale, format);
7211
+ };
7212
+
7213
+ VueI18n.prototype._clearDateTimeFormat = function _clearDateTimeFormat (locale, format) {
7214
+ // eslint-disable-next-line no-autofix/prefer-const
7215
+ for (var key in format) {
7216
+ var id = locale + "__" + key;
7217
+
7218
+ if (!this._dateTimeFormatters.hasOwnProperty(id)) {
7219
+ continue
7220
+ }
7221
+
7222
+ delete this._dateTimeFormatters[id];
7223
+ }
7224
+ };
7225
+
7226
+ VueI18n.prototype._localizeDateTime = function _localizeDateTime (
7227
+ value,
7228
+ locale,
7229
+ fallback,
7230
+ dateTimeFormats,
7231
+ key,
7232
+ options
7233
+ ) {
7234
+ var _locale = locale;
7235
+ var formats = dateTimeFormats[_locale];
7236
+
7237
+ var chain = this._getLocaleChain(locale, fallback);
7238
+ for (var i = 0; i < chain.length; i++) {
7239
+ var current = _locale;
7240
+ var step = chain[i];
7241
+ formats = dateTimeFormats[step];
7242
+ _locale = step;
7243
+ // fallback locale
7244
+ if (isNull(formats) || isNull(formats[key])) {
7245
+ if (step !== locale && "production" !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {
7246
+ warn(("Fall back to '" + step + "' datetime formats from '" + current + "' datetime formats."));
5181
7247
  }
7248
+ } else {
7249
+ break
7250
+ }
7251
+ }
5182
7252
 
5183
- if (formConfig.icons) {
5184
- this.config.icons = _assign(this.config.icons, formConfig.icons);
7253
+ if (isNull(formats) || isNull(formats[key])) {
7254
+ return null
7255
+ } else {
7256
+ var format = formats[key];
7257
+
7258
+ var formatter;
7259
+ if (options) {
7260
+ formatter = new Intl.DateTimeFormat(_locale, Object.assign({}, format, options));
7261
+ } else {
7262
+ var id = _locale + "__" + key;
7263
+ formatter = this._dateTimeFormatters[id];
7264
+ if (!formatter) {
7265
+ formatter = this._dateTimeFormatters[id] = new Intl.DateTimeFormat(_locale, format);
5185
7266
  }
7267
+ }
5186
7268
 
5187
- if (formConfig.rules) {
5188
- this.config.rules = formConfig.rules;
7269
+ return formatter.format(value)
7270
+ }
7271
+ };
7272
+
7273
+ VueI18n.prototype._d = function _d (value, locale, key, options) {
7274
+
7275
+ if (!key) {
7276
+ var dtf = !options ? new Intl.DateTimeFormat(locale) : new Intl.DateTimeFormat(locale, options);
7277
+ return dtf.format(value)
7278
+ }
7279
+
7280
+ var ret =
7281
+ this._localizeDateTime(value, locale, this.fallbackLocale, this._getDateTimeFormats(), key, options);
7282
+ if (this._isFallbackRoot(ret)) {
7283
+ /* istanbul ignore if */
7284
+ if (!this._root) { throw Error('unexpected error') }
7285
+ return this._root.$i18n.d(value, key, locale)
7286
+ } else {
7287
+ return ret || ''
7288
+ }
7289
+ };
7290
+
7291
+ VueI18n.prototype.d = function d (value) {
7292
+ var args = [], len = arguments.length - 1;
7293
+ while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
7294
+
7295
+ var locale = this.locale;
7296
+ var key = null;
7297
+ var options = null;
7298
+
7299
+ if (args.length === 1) {
7300
+ if (isString(args[0])) {
7301
+ key = args[0];
7302
+ } else if (isObject(args[0])) {
7303
+ if (args[0].locale) {
7304
+ locale = args[0].locale;
7305
+ }
7306
+ if (args[0].key) {
7307
+ key = args[0].key;
5189
7308
  }
7309
+ }
5190
7310
 
5191
- if (formConfig.ruleContext) {
5192
- this.config.ruleContext = formConfig.ruleContext;
7311
+ options = Object.keys(args[0]).reduce(function (acc, key) {
7312
+ var obj;
7313
+
7314
+ if (includes(dateTimeFormatKeys, key)) {
7315
+ return Object.assign({}, acc, ( obj = {}, obj[key] = args[0][key], obj ))
5193
7316
  }
7317
+ return acc
7318
+ }, null);
7319
+
7320
+ } else if (args.length === 2) {
7321
+ if (isString(args[0])) {
7322
+ key = args[0];
5194
7323
  }
5195
- },
5196
- getInputTypes: function getInputTypes(field) {
5197
- var inputs = [];
7324
+ if (isString(args[1])) {
7325
+ locale = args[1];
7326
+ }
7327
+ }
5198
7328
 
5199
- if (!field) {
5200
- return inputs;
7329
+ return this._d(value, locale, key, options)
7330
+ };
7331
+
7332
+ VueI18n.prototype.getNumberFormat = function getNumberFormat (locale) {
7333
+ return looseClone(this._vm.numberFormats[locale] || {})
7334
+ };
7335
+
7336
+ VueI18n.prototype.setNumberFormat = function setNumberFormat (locale, format) {
7337
+ this._vm.$set(this._vm.numberFormats, locale, format);
7338
+ this._clearNumberFormat(locale, format);
7339
+ };
7340
+
7341
+ VueI18n.prototype.mergeNumberFormat = function mergeNumberFormat (locale, format) {
7342
+ this._vm.$set(this._vm.numberFormats, locale, merge(this._vm.numberFormats[locale] || {}, format));
7343
+ this._clearNumberFormat(locale, format);
7344
+ };
7345
+
7346
+ VueI18n.prototype._clearNumberFormat = function _clearNumberFormat (locale, format) {
7347
+ // eslint-disable-next-line no-autofix/prefer-const
7348
+ for (var key in format) {
7349
+ var id = locale + "__" + key;
7350
+
7351
+ if (!this._numberFormatters.hasOwnProperty(id)) {
7352
+ continue
5201
7353
  }
5202
7354
 
5203
- if (field.dict && !this.config.refInputs[field.ref]) {
5204
- inputs = __filterInputsByMultiple(this.config.dictInputs, field.multiple);
5205
- } else if (field.ref) {
5206
- inputs = __filterInputsByMultiple(this.config.refInputs[field.ref], field.multiple);
7355
+ delete this._numberFormatters[id];
7356
+ }
7357
+ };
7358
+
7359
+ VueI18n.prototype._getNumberFormatter = function _getNumberFormatter (
7360
+ value,
7361
+ locale,
7362
+ fallback,
7363
+ numberFormats,
7364
+ key,
7365
+ options
7366
+ ) {
7367
+ var _locale = locale;
7368
+ var formats = numberFormats[_locale];
7369
+
7370
+ var chain = this._getLocaleChain(locale, fallback);
7371
+ for (var i = 0; i < chain.length; i++) {
7372
+ var current = _locale;
7373
+ var step = chain[i];
7374
+ formats = numberFormats[step];
7375
+ _locale = step;
7376
+ // fallback locale
7377
+ if (isNull(formats) || isNull(formats[key])) {
7378
+ if (step !== locale && "production" !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {
7379
+ warn(("Fall back to '" + step + "' number formats from '" + current + "' number formats."));
7380
+ }
5207
7381
  } else {
5208
- inputs = __filterInputsByMultiple(this.config.primitiveInputs[field.type], field.multiple);
7382
+ break
5209
7383
  }
7384
+ }
5210
7385
 
5211
- return inputs;
5212
- },
5213
- hasMultipleInputTypes: function hasMultipleInputTypes(field) {
5214
- var inputs = this.getInputTypes(_objectSpread2(_objectSpread2({}, field), {}, {
5215
- multiple: true
5216
- }));
5217
- return inputs && inputs.length > 0;
5218
- },
5219
- getDefaultInput: function getDefaultInput(field) {
5220
- var input = null;
5221
- var inputs = this.getInputTypes(field);
7386
+ if (isNull(formats) || isNull(formats[key])) {
7387
+ return null
7388
+ } else {
7389
+ var format = formats[key];
5222
7390
 
5223
- if (!inputs) {
5224
- input = this.primitiveInputs[0];
7391
+ var formatter;
7392
+ if (options) {
7393
+ // If options specified - create one time number formatter
7394
+ formatter = new Intl.NumberFormat(_locale, Object.assign({}, format, options));
7395
+ } else {
7396
+ var id = _locale + "__" + key;
7397
+ formatter = this._numberFormatters[id];
7398
+ if (!formatter) {
7399
+ formatter = this._numberFormatters[id] = new Intl.NumberFormat(_locale, format);
7400
+ }
5225
7401
  }
7402
+ return formatter
7403
+ }
7404
+ };
5226
7405
 
5227
- if (field.ref && this.config.refInputs[field.ref]) {
5228
- input = __clone(inputs[0]);
7406
+ VueI18n.prototype._n = function _n (value, locale, key, options) {
7407
+ /* istanbul ignore if */
7408
+ if (!VueI18n.availabilities.numberFormat) {
7409
+ return ''
7410
+ }
5229
7411
 
5230
- __applyDefaultProps(input);
7412
+ if (!key) {
7413
+ var nf = !options ? new Intl.NumberFormat(locale) : new Intl.NumberFormat(locale, options);
7414
+ return nf.format(value)
7415
+ }
5231
7416
 
5232
- if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
5233
- __applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
7417
+ var formatter = this._getNumberFormatter(value, locale, this.fallbackLocale, this._getNumberFormats(), key, options);
7418
+ var ret = formatter && formatter.format(value);
7419
+ if (this._isFallbackRoot(ret)) {
7420
+ /* istanbul ignore if */
7421
+ if (!this._root) { throw Error('unexpected error') }
7422
+ return this._root.$i18n.n(value, Object.assign({}, { key: key, locale: locale }, options))
7423
+ } else {
7424
+ return ret || ''
7425
+ }
7426
+ };
7427
+
7428
+ VueI18n.prototype.n = function n (value) {
7429
+ var args = [], len = arguments.length - 1;
7430
+ while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
7431
+
7432
+ var locale = this.locale;
7433
+ var key = null;
7434
+ var options = null;
7435
+
7436
+ if (args.length === 1) {
7437
+ if (isString(args[0])) {
7438
+ key = args[0];
7439
+ } else if (isObject(args[0])) {
7440
+ if (args[0].locale) {
7441
+ locale = args[0].locale;
7442
+ }
7443
+ if (args[0].key) {
7444
+ key = args[0].key;
5234
7445
  }
5235
- } else if (field.dict) {
5236
- input = __clone(inputs[0]);
5237
- input.props.dict.default = field.ref;
5238
7446
 
5239
- __applyDefaultProps(input);
5240
- } else {
5241
- input = __clone(inputs[0]);
7447
+ // Filter out number format options only
7448
+ options = Object.keys(args[0]).reduce(function (acc, key) {
7449
+ var obj;
5242
7450
 
5243
- __applyDefaultProps(input);
7451
+ if (includes(numberFormatKeys, key)) {
7452
+ return Object.assign({}, acc, ( obj = {}, obj[key] = args[0][key], obj ))
7453
+ }
7454
+ return acc
7455
+ }, null);
5244
7456
  }
7457
+ } else if (args.length === 2) {
7458
+ if (isString(args[0])) {
7459
+ key = args[0];
7460
+ }
7461
+ if (isString(args[1])) {
7462
+ locale = args[1];
7463
+ }
7464
+ }
5245
7465
 
5246
- return input;
5247
- },
5248
- getInputTypeByName: function getInputTypeByName(name, field) {
5249
- var input = __clone(this.config.inputs[name]);
7466
+ return this._n(value, locale, key, options)
7467
+ };
5250
7468
 
5251
- if (field.ref && this.config.refInputs[field.ref]) {
5252
- __applyDefaultProps(input);
7469
+ VueI18n.prototype._ntp = function _ntp (value, locale, key, options) {
7470
+ /* istanbul ignore if */
7471
+ if (!VueI18n.availabilities.numberFormat) {
7472
+ return []
7473
+ }
5253
7474
 
5254
- if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
5255
- __applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
5256
- }
5257
- } else if (field.dict) {
5258
- input.props.dict.default = field.ref;
7475
+ if (!key) {
7476
+ var nf = !options ? new Intl.NumberFormat(locale) : new Intl.NumberFormat(locale, options);
7477
+ return nf.formatToParts(value)
7478
+ }
5259
7479
 
5260
- __applyDefaultProps(input);
5261
- } else {
5262
- __applyDefaultProps(input, field);
7480
+ var formatter = this._getNumberFormatter(value, locale, this.fallbackLocale, this._getNumberFormats(), key, options);
7481
+ var ret = formatter && formatter.formatToParts(value);
7482
+ if (this._isFallbackRoot(ret)) {
7483
+ /* istanbul ignore if */
7484
+ if (!this._root) { throw Error('unexpected error') }
7485
+ return this._root.$i18n._ntp(value, locale, key, options)
7486
+ } else {
7487
+ return ret || []
7488
+ }
7489
+ };
7490
+
7491
+ Object.defineProperties( VueI18n.prototype, prototypeAccessors );
7492
+
7493
+ var availabilities;
7494
+ // $FlowFixMe
7495
+ Object.defineProperty(VueI18n, 'availabilities', {
7496
+ get: function get () {
7497
+ if (!availabilities) {
7498
+ var intlDefined = typeof Intl !== 'undefined';
7499
+ availabilities = {
7500
+ dateTimeFormat: intlDefined && typeof Intl.DateTimeFormat !== 'undefined',
7501
+ numberFormat: intlDefined && typeof Intl.NumberFormat !== 'undefined'
7502
+ };
5263
7503
  }
5264
7504
 
5265
- input.propsData['ref'] = field.name;
5266
- return input;
5267
- },
5268
- getAvailableFieldRules: function getAvailableFieldRules(field) {
5269
- return this.config.rules.filter(function (rule) {
5270
- return !rule.fields || rule.fields.length === 0 || rule.fields.indexOf(field.name) >= 0;
5271
- });
5272
- },
5273
- getRuleContext: function getRuleContext() {
5274
- return this.config.ruleContext;
5275
- },
5276
- runRule: function runRule(context, script) {
5277
- context = context ? context : {};
5278
- context['console'] = console;
5279
- context['Date'] = Date;
5280
- context['Math'] = Math;
7505
+ return availabilities
7506
+ }
7507
+ });
5281
7508
 
5282
- var func = function func(script) {
5283
- return notevil(script, context);
5284
- };
7509
+ VueI18n.install = install$1;
7510
+ VueI18n.version = '8.28.2';
5285
7511
 
5286
- func.call(context, script);
5287
- }
5288
- };//
7512
+ var VueI18n$1 = VueI18n;var validate$2 = {
7513
+ required: "Поле \"{field}\" обязательно",
7514
+ min: "Минимальное значение для этого поля {min}"
7515
+ };
7516
+ var Ru = {
7517
+ validate: validate$2
7518
+ };var validate$1 = {
7519
+ required: "\"{field}\" жолы міндетті",
7520
+ min: "Бұл жол үшін ең кіші мән {min}"
7521
+ };
7522
+ var Kz = {
7523
+ validate: validate$1
7524
+ };var locale = localStorage.getItem('lang') ? localStorage.getItem('lang') : 'Ru';
7525
+ Vue__default["default"].use(VueI18n$1);
7526
+ var i18n = new VueI18n$1({
7527
+ locale: locale,
7528
+ fallbackLocale: 'Ru',
7529
+ messages: {
7530
+ Ru: Ru,
7531
+ Kz: Kz
7532
+ }
7533
+ });//
5289
7534
  //
5290
7535
  //
5291
7536
  //
@@ -5489,7 +7734,7 @@ var __vue_inject_styles__$5 = undefined;
5489
7734
  var __vue_scope_id__$5 = undefined;
5490
7735
  /* module identifier */
5491
7736
 
5492
- var __vue_module_identifier__$5 = "data-v-4f837662";
7737
+ var __vue_module_identifier__$5 = "data-v-779f90b2";
5493
7738
  /* functional template */
5494
7739
 
5495
7740
  var __vue_is_functional_template__$5 = false;
@@ -11041,7 +13286,7 @@ var __vue_inject_styles__$4 = undefined;
11041
13286
  var __vue_scope_id__$4 = undefined;
11042
13287
  /* module identifier */
11043
13288
 
11044
- var __vue_module_identifier__$4 = "data-v-12095172";
13289
+ var __vue_module_identifier__$4 = "data-v-3e6871e0";
11045
13290
  /* functional template */
11046
13291
 
11047
13292
  var __vue_is_functional_template__$4 = false;
@@ -11289,11 +13534,15 @@ var _typeof = function(object) {
11289
13534
  var feedback = '';
11290
13535
 
11291
13536
  if (f.required && _this3.isValueEmpty(f.name)) {
11292
- feedback += "\u041F\u043E\u043B\u0435 \"".concat(_this3.getDisplayField(f), "\" \u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E");
13537
+ feedback += i18n.t('validate.required', {
13538
+ field: _this3.getDisplayField(f)
13539
+ });
11293
13540
  }
11294
13541
 
11295
13542
  if (f.type === 'integer' && _this3.isValueLessThanMin(f.name, f.input.propsData.min)) {
11296
- feedback += "\n\u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0434\u043B\u044F \u044D\u0442\u043E\u0433\u043E \u043F\u043E\u043B\u044F ".concat(f.input.propsData.min);
13543
+ feedback += "\n".concat(i18n.t('validate.min', {
13544
+ min: f.input.propsData.min
13545
+ }));
11297
13546
  } // TODO: Костыль так как на бэке нету типа memo
11298
13547
 
11299
13548
 
@@ -11402,10 +13651,10 @@ var __vue_render__$3 = function __vue_render__() {
11402
13651
 
11403
13652
  var _c = _vm._self._c || _h;
11404
13653
 
11405
- return _vm.formConfig ? _c('b-form', {
13654
+ return _vm.formConfig && _vm.formConfig.sections ? _c('b-form', {
11406
13655
  staticClass: "rb-doc-form"
11407
13656
  }, _vm._l(_vm.formConfig.sections, function (section) {
11408
- return _vm.formConfig && _vm.formConfig.sections ? _c('b-container', {
13657
+ return _c('b-container', {
11409
13658
  key: section.labelRu,
11410
13659
  staticClass: "rb-form-section"
11411
13660
  }, [_c('b-row', [_c('b-col', {
@@ -11491,7 +13740,7 @@ var __vue_render__$3 = function __vue_render__() {
11491
13740
  }
11492
13741
  }, 'component', field.input.propsData, false))], 1)], 1)], 1) : _vm._e()];
11493
13742
  })], 2)];
11494
- })], 2)], 1) : _vm._e();
13743
+ })], 2)], 1);
11495
13744
  }), 1) : _vm._e();
11496
13745
  };
11497
13746
 
@@ -11504,7 +13753,7 @@ var __vue_inject_styles__$3 = undefined;
11504
13753
  var __vue_scope_id__$3 = undefined;
11505
13754
  /* module identifier */
11506
13755
 
11507
- var __vue_module_identifier__$3 = "data-v-65d5941a";
13756
+ var __vue_module_identifier__$3 = "data-v-8544ae94";
11508
13757
  /* functional template */
11509
13758
 
11510
13759
  var __vue_is_functional_template__$3 = false;
@@ -11948,7 +14197,7 @@ var __vue_inject_styles__$2 = undefined;
11948
14197
  var __vue_scope_id__$2 = undefined;
11949
14198
  /* module identifier */
11950
14199
 
11951
- var __vue_module_identifier__$2 = "data-v-4391e2c5";
14200
+ var __vue_module_identifier__$2 = "data-v-229c821a";
11952
14201
  /* functional template */
11953
14202
 
11954
14203
  var __vue_is_functional_template__$2 = false;
@@ -12384,7 +14633,7 @@ var __vue_inject_styles__$1 = undefined;
12384
14633
  var __vue_scope_id__$1 = undefined;
12385
14634
  /* module identifier */
12386
14635
 
12387
- var __vue_module_identifier__$1 = "data-v-d1baa99a";
14636
+ var __vue_module_identifier__$1 = "data-v-47ee5630";
12388
14637
  /* functional template */
12389
14638
 
12390
14639
  var __vue_is_functional_template__$1 = false;
@@ -12495,11 +14744,11 @@ var DocTemplateFieldSidebar = __vue_component__$2;var script = {
12495
14744
  },
12496
14745
  removeSection: function removeSection(section, index) {
12497
14746
  this.formConfig.sections.splice(index, 1);
12498
- /*UtModal.showYesNoDialog('Вы действительно хотите удалить секцию?', {
12499
- onOk: (event, modal) => {
12500
- this.formConfig.sections.splice(index, 1);
12501
- UtModal.closeModal(modal);
12502
- }
14747
+ /*UtModal.showYesNoDialog('Вы действительно хотите удалить секцию?', {
14748
+ onOk: (event, modal) => {
14749
+ this.formConfig.sections.splice(index, 1);
14750
+ UtModal.closeModal(modal);
14751
+ }
12503
14752
  });*/
12504
14753
  },
12505
14754
  multipleFieldAreOnFormConfig: function multipleFieldAreOnFormConfig(field) {
@@ -12809,7 +15058,7 @@ var __vue_inject_styles__ = undefined;
12809
15058
  var __vue_scope_id__ = undefined;
12810
15059
  /* module identifier */
12811
15060
 
12812
- var __vue_module_identifier__ = "data-v-1d0e94ea";
15061
+ var __vue_module_identifier__ = "data-v-4b6e26ca";
12813
15062
  /* functional template */
12814
15063
 
12815
15064
  var __vue_is_functional_template__ = false;
@@ -12824,7 +15073,7 @@ var __vue_component__ = /*#__PURE__*/normalizeComponent({
12824
15073
  staticRenderFns: __vue_staticRenderFns__
12825
15074
  }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
12826
15075
 
12827
- var __vue_component__$1 = __vue_component__;/* eslint-disable import/prefer-default-export */var components$1=/*#__PURE__*/Object.freeze({__proto__:null,UtFormConfig:UtFormConfig,UtFormConstructor:UtFormConstructor,DocTemplateSectionModal:DocTemplateSectionModal,DocTemplateFacetList:DocTemplateFacetList,DocTemplateFieldSidebar:DocTemplateFieldSidebar,DocTemplateConstructor:__vue_component__$1,FieldRuleFormModal:FieldRuleFormModal,DocForm:DocForm});var install = function installRbDocumentFormConstructor(Vue) {
15076
+ var __vue_component__$1 = __vue_component__;/* eslint-disable import/prefer-default-export */var components$1=/*#__PURE__*/Object.freeze({__proto__:null,UtFormConfig:UtFormConfig,UtFormConstructor:UtFormConstructor,i18n:i18n,DocTemplateSectionModal:DocTemplateSectionModal,DocTemplateFacetList:DocTemplateFacetList,DocTemplateFieldSidebar:DocTemplateFieldSidebar,DocTemplateConstructor:__vue_component__$1,FieldRuleFormModal:FieldRuleFormModal,DocForm:DocForm});var install = function installRbDocumentFormConstructor(Vue) {
12828
15077
  Object.entries(components$1).forEach(function (_ref) {
12829
15078
  var _ref2 = _slicedToArray(_ref, 2),
12830
15079
  componentName = _ref2[0],
@@ -12833,7 +15082,7 @@ var __vue_component__$1 = __vue_component__;/* eslint-disable import/prefer-defa
12833
15082
  Vue.component(componentName, component);
12834
15083
  });
12835
15084
  }; // Create module definition for Vue.use()
12836
- var components=/*#__PURE__*/Object.freeze({__proto__:null,'default':install,UtFormConfig:UtFormConfig,UtFormConstructor:UtFormConstructor,DocTemplateSectionModal:DocTemplateSectionModal,DocTemplateFacetList:DocTemplateFacetList,DocTemplateFieldSidebar:DocTemplateFieldSidebar,DocTemplateConstructor:__vue_component__$1,FieldRuleFormModal:FieldRuleFormModal,DocForm:DocForm});// only expose one global var, with component exports exposed as properties of
15085
+ var components=/*#__PURE__*/Object.freeze({__proto__:null,'default':install,UtFormConfig:UtFormConfig,UtFormConstructor:UtFormConstructor,i18n:i18n,DocTemplateSectionModal:DocTemplateSectionModal,DocTemplateFacetList:DocTemplateFacetList,DocTemplateFieldSidebar:DocTemplateFieldSidebar,DocTemplateConstructor:__vue_component__$1,FieldRuleFormModal:FieldRuleFormModal,DocForm:DocForm});// only expose one global var, with component exports exposed as properties of
12837
15086
  // that global var (eg. plugin.component)
12838
15087
 
12839
15088
  Object.entries(components).forEach(function (_ref) {