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