rb-document-form-constructor 0.8.90 → 0.8.92

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
- 'use strict';var Vue$1=require('vue');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var Vue__default=/*#__PURE__*/_interopDefaultLegacy(Vue$1);function _iterableToArrayLimit(arr, i) {
1
+ 'use strict';var Vue=require('vue');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var Vue__default=/*#__PURE__*/_interopDefaultLegacy(Vue);function _iterableToArrayLimit(arr, i) {
2
2
  var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
3
3
  if (null != _i) {
4
4
  var _s,
@@ -557,2240 +557,7 @@ var UtFormConstructor = {
557
557
  };
558
558
  func.call(context, appendScript + script);
559
559
  }
560
- };/*!
561
- * vue-i18n v8.28.2
562
- * (c) 2022 kazuya kawaguchi
563
- * Released under the MIT License.
564
- */
565
- /* */
566
-
567
- /**
568
- * constants
569
- */
570
-
571
- var numberFormatKeys = [
572
- 'compactDisplay',
573
- 'currency',
574
- 'currencyDisplay',
575
- 'currencySign',
576
- 'localeMatcher',
577
- 'notation',
578
- 'numberingSystem',
579
- 'signDisplay',
580
- 'style',
581
- 'unit',
582
- 'unitDisplay',
583
- 'useGrouping',
584
- 'minimumIntegerDigits',
585
- 'minimumFractionDigits',
586
- 'maximumFractionDigits',
587
- 'minimumSignificantDigits',
588
- 'maximumSignificantDigits'
589
- ];
590
-
591
- var dateTimeFormatKeys = [
592
- 'dateStyle',
593
- 'timeStyle',
594
- 'calendar',
595
- 'localeMatcher',
596
- "hour12",
597
- "hourCycle",
598
- "timeZone",
599
- "formatMatcher",
600
- 'weekday',
601
- 'era',
602
- 'year',
603
- 'month',
604
- 'day',
605
- 'hour',
606
- 'minute',
607
- 'second',
608
- 'timeZoneName' ];
609
-
610
- /**
611
- * utilities
612
- */
613
-
614
- function warn (msg, err) {
615
- if (typeof console !== 'undefined') {
616
- console.warn('[vue-i18n] ' + msg);
617
- /* istanbul ignore if */
618
- if (err) {
619
- console.warn(err.stack);
620
- }
621
- }
622
- }
623
-
624
- function error (msg, err) {
625
- if (typeof console !== 'undefined') {
626
- console.error('[vue-i18n] ' + msg);
627
- /* istanbul ignore if */
628
- if (err) {
629
- console.error(err.stack);
630
- }
631
- }
632
- }
633
-
634
- var isArray = Array.isArray;
635
-
636
- function isObject (obj) {
637
- return obj !== null && typeof obj === 'object'
638
- }
639
-
640
- function isBoolean (val) {
641
- return typeof val === 'boolean'
642
- }
643
-
644
- function isString (val) {
645
- return typeof val === 'string'
646
- }
647
-
648
- var toString$1 = Object.prototype.toString;
649
- var OBJECT_STRING = '[object Object]';
650
- function isPlainObject (obj) {
651
- return toString$1.call(obj) === OBJECT_STRING
652
- }
653
-
654
- function isNull (val) {
655
- return val === null || val === undefined
656
- }
657
-
658
- function isFunction (val) {
659
- return typeof val === 'function'
660
- }
661
-
662
- function parseArgs () {
663
- var args = [], len = arguments.length;
664
- while ( len-- ) args[ len ] = arguments[ len ];
665
-
666
- var locale = null;
667
- var params = null;
668
- if (args.length === 1) {
669
- if (isObject(args[0]) || isArray(args[0])) {
670
- params = args[0];
671
- } else if (typeof args[0] === 'string') {
672
- locale = args[0];
673
- }
674
- } else if (args.length === 2) {
675
- if (typeof args[0] === 'string') {
676
- locale = args[0];
677
- }
678
- /* istanbul ignore if */
679
- if (isObject(args[1]) || isArray(args[1])) {
680
- params = args[1];
681
- }
682
- }
683
-
684
- return { locale: locale, params: params }
685
- }
686
-
687
- function looseClone (obj) {
688
- return JSON.parse(JSON.stringify(obj))
689
- }
690
-
691
- function remove (arr, item) {
692
- if (arr.delete(item)) {
693
- return arr
694
- }
695
- }
696
-
697
- function arrayFrom (arr) {
698
- var ret = [];
699
- arr.forEach(function (a) { return ret.push(a); });
700
- return ret
701
- }
702
-
703
- function includes (arr, item) {
704
- return !!~arr.indexOf(item)
705
- }
706
-
707
- var hasOwnProperty = Object.prototype.hasOwnProperty;
708
- function hasOwn (obj, key) {
709
- return hasOwnProperty.call(obj, key)
710
- }
711
-
712
- function merge (target) {
713
- var arguments$1 = arguments;
714
-
715
- var output = Object(target);
716
- for (var i = 1; i < arguments.length; i++) {
717
- var source = arguments$1[i];
718
- if (source !== undefined && source !== null) {
719
- var key = (void 0);
720
- for (key in source) {
721
- if (hasOwn(source, key)) {
722
- if (isObject(source[key])) {
723
- output[key] = merge(output[key], source[key]);
724
- } else {
725
- output[key] = source[key];
726
- }
727
- }
728
- }
729
- }
730
- }
731
- return output
732
- }
733
-
734
- function looseEqual (a, b) {
735
- if (a === b) { return true }
736
- var isObjectA = isObject(a);
737
- var isObjectB = isObject(b);
738
- if (isObjectA && isObjectB) {
739
- try {
740
- var isArrayA = isArray(a);
741
- var isArrayB = isArray(b);
742
- if (isArrayA && isArrayB) {
743
- return a.length === b.length && a.every(function (e, i) {
744
- return looseEqual(e, b[i])
745
- })
746
- } else if (!isArrayA && !isArrayB) {
747
- var keysA = Object.keys(a);
748
- var keysB = Object.keys(b);
749
- return keysA.length === keysB.length && keysA.every(function (key) {
750
- return looseEqual(a[key], b[key])
751
- })
752
- } else {
753
- /* istanbul ignore next */
754
- return false
755
- }
756
- } catch (e) {
757
- /* istanbul ignore next */
758
- return false
759
- }
760
- } else if (!isObjectA && !isObjectB) {
761
- return String(a) === String(b)
762
- } else {
763
- return false
764
- }
765
- }
766
-
767
- /**
768
- * Sanitizes html special characters from input strings. For mitigating risk of XSS attacks.
769
- * @param rawText The raw input from the user that should be escaped.
770
- */
771
- function escapeHtml(rawText) {
772
- return rawText
773
- .replace(/</g, '&lt;')
774
- .replace(/>/g, '&gt;')
775
- .replace(/"/g, '&quot;')
776
- .replace(/'/g, '&apos;')
777
- }
778
-
779
- /**
780
- * Escapes html tags and special symbols from all provided params which were returned from parseArgs().params.
781
- * This method performs an in-place operation on the params object.
782
- *
783
- * @param {any} params Parameters as provided from `parseArgs().params`.
784
- * May be either an array of strings or a string->any map.
785
- *
786
- * @returns The manipulated `params` object.
787
- */
788
- function escapeParams(params) {
789
- if(params != null) {
790
- Object.keys(params).forEach(function (key) {
791
- if(typeof(params[key]) == 'string') {
792
- params[key] = escapeHtml(params[key]);
793
- }
794
- });
795
- }
796
- return params
797
- }
798
-
799
- /* */
800
-
801
- function extend$1 (Vue) {
802
- if (!Vue.prototype.hasOwnProperty('$i18n')) {
803
- // $FlowFixMe
804
- Object.defineProperty(Vue.prototype, '$i18n', {
805
- get: function get () { return this._i18n }
806
- });
807
- }
808
-
809
- Vue.prototype.$t = function (key) {
810
- var values = [], len = arguments.length - 1;
811
- while ( len-- > 0 ) values[ len ] = arguments[ len + 1 ];
812
-
813
- var i18n = this.$i18n;
814
- return i18n._t.apply(i18n, [ key, i18n.locale, i18n._getMessages(), this ].concat( values ))
815
- };
816
-
817
- Vue.prototype.$tc = function (key, choice) {
818
- var values = [], len = arguments.length - 2;
819
- while ( len-- > 0 ) values[ len ] = arguments[ len + 2 ];
820
-
821
- var i18n = this.$i18n;
822
- return i18n._tc.apply(i18n, [ key, i18n.locale, i18n._getMessages(), this, choice ].concat( values ))
823
- };
824
-
825
- Vue.prototype.$te = function (key, locale) {
826
- var i18n = this.$i18n;
827
- return i18n._te(key, i18n.locale, i18n._getMessages(), locale)
828
- };
829
-
830
- Vue.prototype.$d = function (value) {
831
- var ref;
832
-
833
- var args = [], len = arguments.length - 1;
834
- while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
835
- return (ref = this.$i18n).d.apply(ref, [ value ].concat( args ))
836
- };
837
-
838
- Vue.prototype.$n = function (value) {
839
- var ref;
840
-
841
- var args = [], len = arguments.length - 1;
842
- while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
843
- return (ref = this.$i18n).n.apply(ref, [ value ].concat( args ))
844
- };
845
- }
846
-
847
- /* */
848
-
849
- /**
850
- * Mixin
851
- *
852
- * If `bridge` mode, empty mixin is returned,
853
- * else regulary mixin implementation is returned.
854
- */
855
- function defineMixin (bridge) {
856
- if ( bridge === void 0 ) bridge = false;
857
-
858
- function mounted () {
859
- if (this !== this.$root && this.$options.__INTLIFY_META__ && this.$el) {
860
- this.$el.setAttribute('data-intlify', this.$options.__INTLIFY_META__);
861
- }
862
- }
863
-
864
- return bridge
865
- ? { mounted: mounted } // delegate `vue-i18n-bridge` mixin implementation
866
- : { // regulary
867
- beforeCreate: function beforeCreate () {
868
- var options = this.$options;
869
- options.i18n = options.i18n || ((options.__i18nBridge || options.__i18n) ? {} : null);
870
-
871
- if (options.i18n) {
872
- if (options.i18n instanceof VueI18n) {
873
- // init locale messages via custom blocks
874
- if ((options.__i18nBridge || options.__i18n)) {
875
- try {
876
- var localeMessages = options.i18n && options.i18n.messages ? options.i18n.messages : {};
877
- var _i18n = options.__i18nBridge || options.__i18n;
878
- _i18n.forEach(function (resource) {
879
- localeMessages = merge(localeMessages, JSON.parse(resource));
880
- });
881
- Object.keys(localeMessages).forEach(function (locale) {
882
- options.i18n.mergeLocaleMessage(locale, localeMessages[locale]);
883
- });
884
- } catch (e) {
885
- }
886
- }
887
- this._i18n = options.i18n;
888
- this._i18nWatcher = this._i18n.watchI18nData();
889
- } else if (isPlainObject(options.i18n)) {
890
- var rootI18n = this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n
891
- ? this.$root.$i18n
892
- : null;
893
- // component local i18n
894
- if (rootI18n) {
895
- options.i18n.root = this.$root;
896
- options.i18n.formatter = rootI18n.formatter;
897
- options.i18n.fallbackLocale = rootI18n.fallbackLocale;
898
- options.i18n.formatFallbackMessages = rootI18n.formatFallbackMessages;
899
- options.i18n.silentTranslationWarn = rootI18n.silentTranslationWarn;
900
- options.i18n.silentFallbackWarn = rootI18n.silentFallbackWarn;
901
- options.i18n.pluralizationRules = rootI18n.pluralizationRules;
902
- options.i18n.preserveDirectiveContent = rootI18n.preserveDirectiveContent;
903
- }
904
-
905
- // init locale messages via custom blocks
906
- if ((options.__i18nBridge || options.__i18n)) {
907
- try {
908
- var localeMessages$1 = options.i18n && options.i18n.messages ? options.i18n.messages : {};
909
- var _i18n$1 = options.__i18nBridge || options.__i18n;
910
- _i18n$1.forEach(function (resource) {
911
- localeMessages$1 = merge(localeMessages$1, JSON.parse(resource));
912
- });
913
- options.i18n.messages = localeMessages$1;
914
- } catch (e) {
915
- }
916
- }
917
-
918
- var ref = options.i18n;
919
- var sharedMessages = ref.sharedMessages;
920
- if (sharedMessages && isPlainObject(sharedMessages)) {
921
- options.i18n.messages = merge(options.i18n.messages, sharedMessages);
922
- }
923
-
924
- this._i18n = new VueI18n(options.i18n);
925
- this._i18nWatcher = this._i18n.watchI18nData();
926
-
927
- if (options.i18n.sync === undefined || !!options.i18n.sync) {
928
- this._localeWatcher = this.$i18n.watchLocale();
929
- }
930
-
931
- if (rootI18n) {
932
- rootI18n.onComponentInstanceCreated(this._i18n);
933
- }
934
- } else ;
935
- } else if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) {
936
- // root i18n
937
- this._i18n = this.$root.$i18n;
938
- } else if (options.parent && options.parent.$i18n && options.parent.$i18n instanceof VueI18n) {
939
- // parent i18n
940
- this._i18n = options.parent.$i18n;
941
- }
942
- },
943
-
944
- beforeMount: function beforeMount () {
945
- var options = this.$options;
946
- options.i18n = options.i18n || ((options.__i18nBridge || options.__i18n) ? {} : null);
947
-
948
- if (options.i18n) {
949
- if (options.i18n instanceof VueI18n) {
950
- // init locale messages via custom blocks
951
- this._i18n.subscribeDataChanging(this);
952
- this._subscribing = true;
953
- } else if (isPlainObject(options.i18n)) {
954
- this._i18n.subscribeDataChanging(this);
955
- this._subscribing = true;
956
- } else ;
957
- } else if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) {
958
- this._i18n.subscribeDataChanging(this);
959
- this._subscribing = true;
960
- } else if (options.parent && options.parent.$i18n && options.parent.$i18n instanceof VueI18n) {
961
- this._i18n.subscribeDataChanging(this);
962
- this._subscribing = true;
963
- }
964
- },
965
-
966
- mounted: mounted,
967
-
968
- beforeDestroy: function beforeDestroy () {
969
- if (!this._i18n) { return }
970
-
971
- var self = this;
972
- this.$nextTick(function () {
973
- if (self._subscribing) {
974
- self._i18n.unsubscribeDataChanging(self);
975
- delete self._subscribing;
976
- }
977
-
978
- if (self._i18nWatcher) {
979
- self._i18nWatcher();
980
- self._i18n.destroyVM();
981
- delete self._i18nWatcher;
982
- }
983
-
984
- if (self._localeWatcher) {
985
- self._localeWatcher();
986
- delete self._localeWatcher;
987
- }
988
- });
989
- }
990
- }
991
- }
992
-
993
- /* */
994
-
995
- var interpolationComponent = {
996
- name: 'i18n',
997
- functional: true,
998
- props: {
999
- tag: {
1000
- type: [String, Boolean, Object],
1001
- default: 'span'
1002
- },
1003
- path: {
1004
- type: String,
1005
- required: true
1006
- },
1007
- locale: {
1008
- type: String
1009
- },
1010
- places: {
1011
- type: [Array, Object]
1012
- }
1013
- },
1014
- render: function render (h, ref) {
1015
- var data = ref.data;
1016
- var parent = ref.parent;
1017
- var props = ref.props;
1018
- var slots = ref.slots;
1019
-
1020
- var $i18n = parent.$i18n;
1021
- if (!$i18n) {
1022
- return
1023
- }
1024
-
1025
- var path = props.path;
1026
- var locale = props.locale;
1027
- var places = props.places;
1028
- var params = slots();
1029
- var children = $i18n.i(
1030
- path,
1031
- locale,
1032
- onlyHasDefaultPlace(params) || places
1033
- ? useLegacyPlaces(params.default, places)
1034
- : params
1035
- );
1036
-
1037
- var tag = (!!props.tag && props.tag !== true) || props.tag === false ? props.tag : 'span';
1038
- return tag ? h(tag, data, children) : children
1039
- }
1040
- };
1041
-
1042
- function onlyHasDefaultPlace (params) {
1043
- var prop;
1044
- for (prop in params) {
1045
- if (prop !== 'default') { return false }
1046
- }
1047
- return Boolean(prop)
1048
- }
1049
-
1050
- function useLegacyPlaces (children, places) {
1051
- var params = places ? createParamsFromPlaces(places) : {};
1052
-
1053
- if (!children) { return params }
1054
-
1055
- // Filter empty text nodes
1056
- children = children.filter(function (child) {
1057
- return child.tag || child.text.trim() !== ''
1058
- });
1059
-
1060
- var everyPlace = children.every(vnodeHasPlaceAttribute);
1061
-
1062
- return children.reduce(
1063
- everyPlace ? assignChildPlace : assignChildIndex,
1064
- params
1065
- )
1066
- }
1067
-
1068
- function createParamsFromPlaces (places) {
1069
-
1070
- return Array.isArray(places)
1071
- ? places.reduce(assignChildIndex, {})
1072
- : Object.assign({}, places)
1073
- }
1074
-
1075
- function assignChildPlace (params, child) {
1076
- if (child.data && child.data.attrs && child.data.attrs.place) {
1077
- params[child.data.attrs.place] = child;
1078
- }
1079
- return params
1080
- }
1081
-
1082
- function assignChildIndex (params, child, index) {
1083
- params[index] = child;
1084
- return params
1085
- }
1086
-
1087
- function vnodeHasPlaceAttribute (vnode) {
1088
- return Boolean(vnode.data && vnode.data.attrs && vnode.data.attrs.place)
1089
- }
1090
-
1091
- /* */
1092
-
1093
- var numberComponent = {
1094
- name: 'i18n-n',
1095
- functional: true,
1096
- props: {
1097
- tag: {
1098
- type: [String, Boolean, Object],
1099
- default: 'span'
1100
- },
1101
- value: {
1102
- type: Number,
1103
- required: true
1104
- },
1105
- format: {
1106
- type: [String, Object]
1107
- },
1108
- locale: {
1109
- type: String
1110
- }
1111
- },
1112
- render: function render (h, ref) {
1113
- var props = ref.props;
1114
- var parent = ref.parent;
1115
- var data = ref.data;
1116
-
1117
- var i18n = parent.$i18n;
1118
-
1119
- if (!i18n) {
1120
- return null
1121
- }
1122
-
1123
- var key = null;
1124
- var options = null;
1125
-
1126
- if (isString(props.format)) {
1127
- key = props.format;
1128
- } else if (isObject(props.format)) {
1129
- if (props.format.key) {
1130
- key = props.format.key;
1131
- }
1132
-
1133
- // Filter out number format options only
1134
- options = Object.keys(props.format).reduce(function (acc, prop) {
1135
- var obj;
1136
-
1137
- if (includes(numberFormatKeys, prop)) {
1138
- return Object.assign({}, acc, ( obj = {}, obj[prop] = props.format[prop], obj ))
1139
- }
1140
- return acc
1141
- }, null);
1142
- }
1143
-
1144
- var locale = props.locale || i18n.locale;
1145
- var parts = i18n._ntp(props.value, locale, key, options);
1146
-
1147
- var values = parts.map(function (part, index) {
1148
- var obj;
1149
-
1150
- var slot = data.scopedSlots && data.scopedSlots[part.type];
1151
- return slot ? slot(( obj = {}, obj[part.type] = part.value, obj.index = index, obj.parts = parts, obj )) : part.value
1152
- });
1153
-
1154
- var tag = (!!props.tag && props.tag !== true) || props.tag === false ? props.tag : 'span';
1155
- return tag
1156
- ? h(tag, {
1157
- attrs: data.attrs,
1158
- 'class': data['class'],
1159
- staticClass: data.staticClass
1160
- }, values)
1161
- : values
1162
- }
1163
- };
1164
-
1165
- /* */
1166
-
1167
- function bind (el, binding, vnode) {
1168
- if (!assert(el, vnode)) { return }
1169
-
1170
- t(el, binding, vnode);
1171
- }
1172
-
1173
- function update (el, binding, vnode, oldVNode) {
1174
- if (!assert(el, vnode)) { return }
1175
-
1176
- var i18n = vnode.context.$i18n;
1177
- if (localeEqual(el, vnode) &&
1178
- (looseEqual(binding.value, binding.oldValue) &&
1179
- looseEqual(el._localeMessage, i18n.getLocaleMessage(i18n.locale)))) { return }
1180
-
1181
- t(el, binding, vnode);
1182
- }
1183
-
1184
- function unbind (el, binding, vnode, oldVNode) {
1185
- var vm = vnode.context;
1186
- if (!vm) {
1187
- warn('Vue instance does not exists in VNode context');
1188
- return
1189
- }
1190
-
1191
- var i18n = vnode.context.$i18n || {};
1192
- if (!binding.modifiers.preserve && !i18n.preserveDirectiveContent) {
1193
- el.textContent = '';
1194
- }
1195
- el._vt = undefined;
1196
- delete el['_vt'];
1197
- el._locale = undefined;
1198
- delete el['_locale'];
1199
- el._localeMessage = undefined;
1200
- delete el['_localeMessage'];
1201
- }
1202
-
1203
- function assert (el, vnode) {
1204
- var vm = vnode.context;
1205
- if (!vm) {
1206
- warn('Vue instance does not exists in VNode context');
1207
- return false
1208
- }
1209
-
1210
- if (!vm.$i18n) {
1211
- warn('VueI18n instance does not exists in Vue instance');
1212
- return false
1213
- }
1214
-
1215
- return true
1216
- }
1217
-
1218
- function localeEqual (el, vnode) {
1219
- var vm = vnode.context;
1220
- return el._locale === vm.$i18n.locale
1221
- }
1222
-
1223
- function t (el, binding, vnode) {
1224
- var ref$1, ref$2;
1225
-
1226
- var value = binding.value;
1227
-
1228
- var ref = parseValue(value);
1229
- var path = ref.path;
1230
- var locale = ref.locale;
1231
- var args = ref.args;
1232
- var choice = ref.choice;
1233
- if (!path && !locale && !args) {
1234
- warn('value type not supported');
1235
- return
1236
- }
1237
-
1238
- if (!path) {
1239
- warn('`path` is required in v-t directive');
1240
- return
1241
- }
1242
-
1243
- var vm = vnode.context;
1244
- if (choice != null) {
1245
- el._vt = el.textContent = (ref$1 = vm.$i18n).tc.apply(ref$1, [ path, choice ].concat( makeParams(locale, args) ));
1246
- } else {
1247
- el._vt = el.textContent = (ref$2 = vm.$i18n).t.apply(ref$2, [ path ].concat( makeParams(locale, args) ));
1248
- }
1249
- el._locale = vm.$i18n.locale;
1250
- el._localeMessage = vm.$i18n.getLocaleMessage(vm.$i18n.locale);
1251
- }
1252
-
1253
- function parseValue (value) {
1254
- var path;
1255
- var locale;
1256
- var args;
1257
- var choice;
1258
-
1259
- if (isString(value)) {
1260
- path = value;
1261
- } else if (isPlainObject(value)) {
1262
- path = value.path;
1263
- locale = value.locale;
1264
- args = value.args;
1265
- choice = value.choice;
1266
- }
1267
-
1268
- return { path: path, locale: locale, args: args, choice: choice }
1269
- }
1270
-
1271
- function makeParams (locale, args) {
1272
- var params = [];
1273
-
1274
- locale && params.push(locale);
1275
- if (args && (Array.isArray(args) || isPlainObject(args))) {
1276
- params.push(args);
1277
- }
1278
-
1279
- return params
1280
- }
1281
-
1282
- var Vue;
1283
-
1284
- function install$1 (_Vue, options) {
1285
- if ( options === void 0 ) options = { bridge: false };
1286
- install$1.installed = true;
1287
-
1288
- Vue = _Vue;
1289
-
1290
- (Vue.version && Number(Vue.version.split('.')[0])) || -1;
1291
-
1292
- extend$1(Vue);
1293
- Vue.mixin(defineMixin(options.bridge));
1294
- Vue.directive('t', { bind: bind, update: update, unbind: unbind });
1295
- Vue.component(interpolationComponent.name, interpolationComponent);
1296
- Vue.component(numberComponent.name, numberComponent);
1297
-
1298
- // use simple mergeStrategies to prevent i18n instance lose '__proto__'
1299
- var strats = Vue.config.optionMergeStrategies;
1300
- strats.i18n = function (parentVal, childVal) {
1301
- return childVal === undefined
1302
- ? parentVal
1303
- : childVal
1304
- };
1305
- }
1306
-
1307
- /* */
1308
-
1309
- var BaseFormatter = function BaseFormatter () {
1310
- this._caches = Object.create(null);
1311
- };
1312
-
1313
- BaseFormatter.prototype.interpolate = function interpolate (message, values) {
1314
- if (!values) {
1315
- return [message]
1316
- }
1317
- var tokens = this._caches[message];
1318
- if (!tokens) {
1319
- tokens = parse(message);
1320
- this._caches[message] = tokens;
1321
- }
1322
- return compile(tokens, values)
1323
- };
1324
-
1325
-
1326
-
1327
- var RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
1328
- var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
1329
-
1330
- function parse (format) {
1331
- var tokens = [];
1332
- var position = 0;
1333
-
1334
- var text = '';
1335
- while (position < format.length) {
1336
- var char = format[position++];
1337
- if (char === '{') {
1338
- if (text) {
1339
- tokens.push({ type: 'text', value: text });
1340
- }
1341
-
1342
- text = '';
1343
- var sub = '';
1344
- char = format[position++];
1345
- while (char !== undefined && char !== '}') {
1346
- sub += char;
1347
- char = format[position++];
1348
- }
1349
- var isClosed = char === '}';
1350
-
1351
- var type = RE_TOKEN_LIST_VALUE.test(sub)
1352
- ? 'list'
1353
- : isClosed && RE_TOKEN_NAMED_VALUE.test(sub)
1354
- ? 'named'
1355
- : 'unknown';
1356
- tokens.push({ value: sub, type: type });
1357
- } else if (char === '%') {
1358
- // when found rails i18n syntax, skip text capture
1359
- if (format[(position)] !== '{') {
1360
- text += char;
1361
- }
1362
- } else {
1363
- text += char;
1364
- }
1365
- }
1366
-
1367
- text && tokens.push({ type: 'text', value: text });
1368
-
1369
- return tokens
1370
- }
1371
-
1372
- function compile (tokens, values) {
1373
- var compiled = [];
1374
- var index = 0;
1375
-
1376
- var mode = Array.isArray(values)
1377
- ? 'list'
1378
- : isObject(values)
1379
- ? 'named'
1380
- : 'unknown';
1381
- if (mode === 'unknown') { return compiled }
1382
-
1383
- while (index < tokens.length) {
1384
- var token = tokens[index];
1385
- switch (token.type) {
1386
- case 'text':
1387
- compiled.push(token.value);
1388
- break
1389
- case 'list':
1390
- compiled.push(values[parseInt(token.value, 10)]);
1391
- break
1392
- case 'named':
1393
- if (mode === 'named') {
1394
- compiled.push((values)[token.value]);
1395
- }
1396
- break
1397
- }
1398
- index++;
1399
- }
1400
-
1401
- return compiled
1402
- }
1403
-
1404
- /* */
1405
-
1406
- /**
1407
- * Path parser
1408
- * - Inspired:
1409
- * Vue.js Path parser
1410
- */
1411
-
1412
- // actions
1413
- var APPEND = 0;
1414
- var PUSH = 1;
1415
- var INC_SUB_PATH_DEPTH = 2;
1416
- var PUSH_SUB_PATH = 3;
1417
-
1418
- // states
1419
- var BEFORE_PATH = 0;
1420
- var IN_PATH = 1;
1421
- var BEFORE_IDENT = 2;
1422
- var IN_IDENT = 3;
1423
- var IN_SUB_PATH = 4;
1424
- var IN_SINGLE_QUOTE = 5;
1425
- var IN_DOUBLE_QUOTE = 6;
1426
- var AFTER_PATH = 7;
1427
- var ERROR = 8;
1428
-
1429
- var pathStateMachine = [];
1430
-
1431
- pathStateMachine[BEFORE_PATH] = {
1432
- 'ws': [BEFORE_PATH],
1433
- 'ident': [IN_IDENT, APPEND],
1434
- '[': [IN_SUB_PATH],
1435
- 'eof': [AFTER_PATH]
1436
- };
1437
-
1438
- pathStateMachine[IN_PATH] = {
1439
- 'ws': [IN_PATH],
1440
- '.': [BEFORE_IDENT],
1441
- '[': [IN_SUB_PATH],
1442
- 'eof': [AFTER_PATH]
1443
- };
1444
-
1445
- pathStateMachine[BEFORE_IDENT] = {
1446
- 'ws': [BEFORE_IDENT],
1447
- 'ident': [IN_IDENT, APPEND],
1448
- '0': [IN_IDENT, APPEND],
1449
- 'number': [IN_IDENT, APPEND]
1450
- };
1451
-
1452
- pathStateMachine[IN_IDENT] = {
1453
- 'ident': [IN_IDENT, APPEND],
1454
- '0': [IN_IDENT, APPEND],
1455
- 'number': [IN_IDENT, APPEND],
1456
- 'ws': [IN_PATH, PUSH],
1457
- '.': [BEFORE_IDENT, PUSH],
1458
- '[': [IN_SUB_PATH, PUSH],
1459
- 'eof': [AFTER_PATH, PUSH]
1460
- };
1461
-
1462
- pathStateMachine[IN_SUB_PATH] = {
1463
- "'": [IN_SINGLE_QUOTE, APPEND],
1464
- '"': [IN_DOUBLE_QUOTE, APPEND],
1465
- '[': [IN_SUB_PATH, INC_SUB_PATH_DEPTH],
1466
- ']': [IN_PATH, PUSH_SUB_PATH],
1467
- 'eof': ERROR,
1468
- 'else': [IN_SUB_PATH, APPEND]
1469
- };
1470
-
1471
- pathStateMachine[IN_SINGLE_QUOTE] = {
1472
- "'": [IN_SUB_PATH, APPEND],
1473
- 'eof': ERROR,
1474
- 'else': [IN_SINGLE_QUOTE, APPEND]
1475
- };
1476
-
1477
- pathStateMachine[IN_DOUBLE_QUOTE] = {
1478
- '"': [IN_SUB_PATH, APPEND],
1479
- 'eof': ERROR,
1480
- 'else': [IN_DOUBLE_QUOTE, APPEND]
1481
- };
1482
-
1483
- /**
1484
- * Check if an expression is a literal value.
1485
- */
1486
-
1487
- var literalValueRE = /^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;
1488
- function isLiteral (exp) {
1489
- return literalValueRE.test(exp)
1490
- }
1491
-
1492
- /**
1493
- * Strip quotes from a string
1494
- */
1495
-
1496
- function stripQuotes (str) {
1497
- var a = str.charCodeAt(0);
1498
- var b = str.charCodeAt(str.length - 1);
1499
- return a === b && (a === 0x22 || a === 0x27)
1500
- ? str.slice(1, -1)
1501
- : str
1502
- }
1503
-
1504
- /**
1505
- * Determine the type of a character in a keypath.
1506
- */
1507
-
1508
- function getPathCharType (ch) {
1509
- if (ch === undefined || ch === null) { return 'eof' }
1510
-
1511
- var code = ch.charCodeAt(0);
1512
-
1513
- switch (code) {
1514
- case 0x5B: // [
1515
- case 0x5D: // ]
1516
- case 0x2E: // .
1517
- case 0x22: // "
1518
- case 0x27: // '
1519
- return ch
1520
-
1521
- case 0x5F: // _
1522
- case 0x24: // $
1523
- case 0x2D: // -
1524
- return 'ident'
1525
-
1526
- case 0x09: // Tab
1527
- case 0x0A: // Newline
1528
- case 0x0D: // Return
1529
- case 0xA0: // No-break space
1530
- case 0xFEFF: // Byte Order Mark
1531
- case 0x2028: // Line Separator
1532
- case 0x2029: // Paragraph Separator
1533
- return 'ws'
1534
- }
1535
-
1536
- return 'ident'
1537
- }
1538
-
1539
- /**
1540
- * Format a subPath, return its plain form if it is
1541
- * a literal string or number. Otherwise prepend the
1542
- * dynamic indicator (*).
1543
- */
1544
-
1545
- function formatSubPath (path) {
1546
- var trimmed = path.trim();
1547
- // invalid leading 0
1548
- if (path.charAt(0) === '0' && isNaN(path)) { return false }
1549
-
1550
- return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed
1551
- }
1552
-
1553
- /**
1554
- * Parse a string path into an array of segments
1555
- */
1556
-
1557
- function parse$1 (path) {
1558
- var keys = [];
1559
- var index = -1;
1560
- var mode = BEFORE_PATH;
1561
- var subPathDepth = 0;
1562
- var c;
1563
- var key;
1564
- var newChar;
1565
- var type;
1566
- var transition;
1567
- var action;
1568
- var typeMap;
1569
- var actions = [];
1570
-
1571
- actions[PUSH] = function () {
1572
- if (key !== undefined) {
1573
- keys.push(key);
1574
- key = undefined;
1575
- }
1576
- };
1577
-
1578
- actions[APPEND] = function () {
1579
- if (key === undefined) {
1580
- key = newChar;
1581
- } else {
1582
- key += newChar;
1583
- }
1584
- };
1585
-
1586
- actions[INC_SUB_PATH_DEPTH] = function () {
1587
- actions[APPEND]();
1588
- subPathDepth++;
1589
- };
1590
-
1591
- actions[PUSH_SUB_PATH] = function () {
1592
- if (subPathDepth > 0) {
1593
- subPathDepth--;
1594
- mode = IN_SUB_PATH;
1595
- actions[APPEND]();
1596
- } else {
1597
- subPathDepth = 0;
1598
- if (key === undefined) { return false }
1599
- key = formatSubPath(key);
1600
- if (key === false) {
1601
- return false
1602
- } else {
1603
- actions[PUSH]();
1604
- }
1605
- }
1606
- };
1607
-
1608
- function maybeUnescapeQuote () {
1609
- var nextChar = path[index + 1];
1610
- if ((mode === IN_SINGLE_QUOTE && nextChar === "'") ||
1611
- (mode === IN_DOUBLE_QUOTE && nextChar === '"')) {
1612
- index++;
1613
- newChar = '\\' + nextChar;
1614
- actions[APPEND]();
1615
- return true
1616
- }
1617
- }
1618
-
1619
- while (mode !== null) {
1620
- index++;
1621
- c = path[index];
1622
-
1623
- if (c === '\\' && maybeUnescapeQuote()) {
1624
- continue
1625
- }
1626
-
1627
- type = getPathCharType(c);
1628
- typeMap = pathStateMachine[mode];
1629
- transition = typeMap[type] || typeMap['else'] || ERROR;
1630
-
1631
- if (transition === ERROR) {
1632
- return // parse error
1633
- }
1634
-
1635
- mode = transition[0];
1636
- action = actions[transition[1]];
1637
- if (action) {
1638
- newChar = transition[2];
1639
- newChar = newChar === undefined
1640
- ? c
1641
- : newChar;
1642
- if (action() === false) {
1643
- return
1644
- }
1645
- }
1646
-
1647
- if (mode === AFTER_PATH) {
1648
- return keys
1649
- }
1650
- }
1651
- }
1652
-
1653
-
1654
-
1655
-
1656
-
1657
- var I18nPath = function I18nPath () {
1658
- this._cache = Object.create(null);
1659
- };
1660
-
1661
- /**
1662
- * External parse that check for a cache hit first
1663
- */
1664
- I18nPath.prototype.parsePath = function parsePath (path) {
1665
- var hit = this._cache[path];
1666
- if (!hit) {
1667
- hit = parse$1(path);
1668
- if (hit) {
1669
- this._cache[path] = hit;
1670
- }
1671
- }
1672
- return hit || []
1673
- };
1674
-
1675
- /**
1676
- * Get path value from path string
1677
- */
1678
- I18nPath.prototype.getPathValue = function getPathValue (obj, path) {
1679
- if (!isObject(obj)) { return null }
1680
-
1681
- var paths = this.parsePath(path);
1682
- if (paths.length === 0) {
1683
- return null
1684
- } else {
1685
- var length = paths.length;
1686
- var last = obj;
1687
- var i = 0;
1688
- while (i < length) {
1689
- var value = last[paths[i]];
1690
- if (value === undefined || value === null) {
1691
- return null
1692
- }
1693
- last = value;
1694
- i++;
1695
- }
1696
-
1697
- return last
1698
- }
1699
- };
1700
-
1701
- /* */
1702
-
1703
-
1704
-
1705
- var htmlTagMatcher = /<\/?[\w\s="/.':;#-\/]+>/;
1706
- var linkKeyMatcher = /(?:@(?:\.[a-zA-Z]+)?:(?:[\w\-_|./]+|\([\w\-_:|./]+\)))/g;
1707
- var linkKeyPrefixMatcher = /^@(?:\.([a-zA-Z]+))?:/;
1708
- var bracketsMatcher = /[()]/g;
1709
- var defaultModifiers = {
1710
- 'upper': function (str) { return str.toLocaleUpperCase(); },
1711
- 'lower': function (str) { return str.toLocaleLowerCase(); },
1712
- 'capitalize': function (str) { return ("" + (str.charAt(0).toLocaleUpperCase()) + (str.substr(1))); }
1713
- };
1714
-
1715
- var defaultFormatter = new BaseFormatter();
1716
-
1717
- var VueI18n = function VueI18n (options) {
1718
- var this$1$1 = this;
1719
- if ( options === void 0 ) options = {};
1720
-
1721
- // Auto install if it is not done yet and `window` has `Vue`.
1722
- // To allow users to avoid auto-installation in some cases,
1723
- // this code should be placed here. See #290
1724
- /* istanbul ignore if */
1725
- if (!Vue && typeof window !== 'undefined' && window.Vue) {
1726
- install$1(window.Vue);
1727
- }
1728
-
1729
- var locale = options.locale || 'en-US';
1730
- var fallbackLocale = options.fallbackLocale === false
1731
- ? false
1732
- : options.fallbackLocale || 'en-US';
1733
- var messages = options.messages || {};
1734
- var dateTimeFormats = options.dateTimeFormats || options.datetimeFormats || {};
1735
- var numberFormats = options.numberFormats || {};
1736
-
1737
- this._vm = null;
1738
- this._formatter = options.formatter || defaultFormatter;
1739
- this._modifiers = options.modifiers || {};
1740
- this._missing = options.missing || null;
1741
- this._root = options.root || null;
1742
- this._sync = options.sync === undefined ? true : !!options.sync;
1743
- this._fallbackRoot = options.fallbackRoot === undefined
1744
- ? true
1745
- : !!options.fallbackRoot;
1746
- this._fallbackRootWithEmptyString = options.fallbackRootWithEmptyString === undefined
1747
- ? true
1748
- : !!options.fallbackRootWithEmptyString;
1749
- this._formatFallbackMessages = options.formatFallbackMessages === undefined
1750
- ? false
1751
- : !!options.formatFallbackMessages;
1752
- this._silentTranslationWarn = options.silentTranslationWarn === undefined
1753
- ? false
1754
- : options.silentTranslationWarn;
1755
- this._silentFallbackWarn = options.silentFallbackWarn === undefined
1756
- ? false
1757
- : !!options.silentFallbackWarn;
1758
- this._dateTimeFormatters = {};
1759
- this._numberFormatters = {};
1760
- this._path = new I18nPath();
1761
- this._dataListeners = new Set();
1762
- this._componentInstanceCreatedListener = options.componentInstanceCreatedListener || null;
1763
- this._preserveDirectiveContent = options.preserveDirectiveContent === undefined
1764
- ? false
1765
- : !!options.preserveDirectiveContent;
1766
- this.pluralizationRules = options.pluralizationRules || {};
1767
- this._warnHtmlInMessage = options.warnHtmlInMessage || 'off';
1768
- this._postTranslation = options.postTranslation || null;
1769
- this._escapeParameterHtml = options.escapeParameterHtml || false;
1770
-
1771
- if ('__VUE_I18N_BRIDGE__' in options) {
1772
- this.__VUE_I18N_BRIDGE__ = options.__VUE_I18N_BRIDGE__;
1773
- }
1774
-
1775
- /**
1776
- * @param choice {number} a choice index given by the input to $tc: `$tc('path.to.rule', choiceIndex)`
1777
- * @param choicesLength {number} an overall amount of available choices
1778
- * @returns a final choice index
1779
- */
1780
- this.getChoiceIndex = function (choice, choicesLength) {
1781
- var thisPrototype = Object.getPrototypeOf(this$1$1);
1782
- if (thisPrototype && thisPrototype.getChoiceIndex) {
1783
- var prototypeGetChoiceIndex = (thisPrototype.getChoiceIndex);
1784
- return (prototypeGetChoiceIndex).call(this$1$1, choice, choicesLength)
1785
- }
1786
-
1787
- // Default (old) getChoiceIndex implementation - english-compatible
1788
- var defaultImpl = function (_choice, _choicesLength) {
1789
- _choice = Math.abs(_choice);
1790
-
1791
- if (_choicesLength === 2) {
1792
- return _choice
1793
- ? _choice > 1
1794
- ? 1
1795
- : 0
1796
- : 1
1797
- }
1798
-
1799
- return _choice ? Math.min(_choice, 2) : 0
1800
- };
1801
-
1802
- if (this$1$1.locale in this$1$1.pluralizationRules) {
1803
- return this$1$1.pluralizationRules[this$1$1.locale].apply(this$1$1, [choice, choicesLength])
1804
- } else {
1805
- return defaultImpl(choice, choicesLength)
1806
- }
1807
- };
1808
-
1809
-
1810
- this._exist = function (message, key) {
1811
- if (!message || !key) { return false }
1812
- if (!isNull(this$1$1._path.getPathValue(message, key))) { return true }
1813
- // fallback for flat key
1814
- if (message[key]) { return true }
1815
- return false
1816
- };
1817
-
1818
- if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') {
1819
- Object.keys(messages).forEach(function (locale) {
1820
- this$1$1._checkLocaleMessage(locale, this$1$1._warnHtmlInMessage, messages[locale]);
1821
- });
1822
- }
1823
-
1824
- this._initVM({
1825
- locale: locale,
1826
- fallbackLocale: fallbackLocale,
1827
- messages: messages,
1828
- dateTimeFormats: dateTimeFormats,
1829
- numberFormats: numberFormats
1830
- });
1831
- };
1832
-
1833
- 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 } };
1834
-
1835
- VueI18n.prototype._checkLocaleMessage = function _checkLocaleMessage (locale, level, message) {
1836
- var paths = [];
1837
-
1838
- var fn = function (level, locale, message, paths) {
1839
- if (isPlainObject(message)) {
1840
- Object.keys(message).forEach(function (key) {
1841
- var val = message[key];
1842
- if (isPlainObject(val)) {
1843
- paths.push(key);
1844
- paths.push('.');
1845
- fn(level, locale, val, paths);
1846
- paths.pop();
1847
- paths.pop();
1848
- } else {
1849
- paths.push(key);
1850
- fn(level, locale, val, paths);
1851
- paths.pop();
1852
- }
1853
- });
1854
- } else if (isArray(message)) {
1855
- message.forEach(function (item, index) {
1856
- if (isPlainObject(item)) {
1857
- paths.push(("[" + index + "]"));
1858
- paths.push('.');
1859
- fn(level, locale, item, paths);
1860
- paths.pop();
1861
- paths.pop();
1862
- } else {
1863
- paths.push(("[" + index + "]"));
1864
- fn(level, locale, item, paths);
1865
- paths.pop();
1866
- }
1867
- });
1868
- } else if (isString(message)) {
1869
- var ret = htmlTagMatcher.test(message);
1870
- if (ret) {
1871
- 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";
1872
- if (level === 'warn') {
1873
- warn(msg);
1874
- } else if (level === 'error') {
1875
- error(msg);
1876
- }
1877
- }
1878
- }
1879
- };
1880
-
1881
- fn(level, locale, message, paths);
1882
- };
1883
-
1884
- VueI18n.prototype._initVM = function _initVM (data) {
1885
- var silent = Vue.config.silent;
1886
- Vue.config.silent = true;
1887
- this._vm = new Vue({ data: data, __VUE18N__INSTANCE__: true });
1888
- Vue.config.silent = silent;
1889
- };
1890
-
1891
- VueI18n.prototype.destroyVM = function destroyVM () {
1892
- this._vm.$destroy();
1893
- };
1894
-
1895
- VueI18n.prototype.subscribeDataChanging = function subscribeDataChanging (vm) {
1896
- this._dataListeners.add(vm);
1897
- };
1898
-
1899
- VueI18n.prototype.unsubscribeDataChanging = function unsubscribeDataChanging (vm) {
1900
- remove(this._dataListeners, vm);
1901
- };
1902
-
1903
- VueI18n.prototype.watchI18nData = function watchI18nData () {
1904
- var this$1$1 = this;
1905
- return this._vm.$watch('$data', function () {
1906
- var listeners = arrayFrom(this$1$1._dataListeners);
1907
- var i = listeners.length;
1908
- while(i--) {
1909
- Vue.nextTick(function () {
1910
- listeners[i] && listeners[i].$forceUpdate();
1911
- });
1912
- }
1913
- }, { deep: true })
1914
- };
1915
-
1916
- VueI18n.prototype.watchLocale = function watchLocale (composer) {
1917
- if (!composer) {
1918
- /* istanbul ignore if */
1919
- if (!this._sync || !this._root) { return null }
1920
- var target = this._vm;
1921
- return this._root.$i18n.vm.$watch('locale', function (val) {
1922
- target.$set(target, 'locale', val);
1923
- target.$forceUpdate();
1924
- }, { immediate: true })
1925
- } else {
1926
- // deal with vue-i18n-bridge
1927
- if (!this.__VUE_I18N_BRIDGE__) { return null }
1928
- var self = this;
1929
- var target$1 = this._vm;
1930
- return this.vm.$watch('locale', function (val) {
1931
- target$1.$set(target$1, 'locale', val);
1932
- if (self.__VUE_I18N_BRIDGE__ && composer) {
1933
- composer.locale.value = val;
1934
- }
1935
- target$1.$forceUpdate();
1936
- }, { immediate: true })
1937
- }
1938
- };
1939
-
1940
- VueI18n.prototype.onComponentInstanceCreated = function onComponentInstanceCreated (newI18n) {
1941
- if (this._componentInstanceCreatedListener) {
1942
- this._componentInstanceCreatedListener(newI18n, this);
1943
- }
1944
- };
1945
-
1946
- prototypeAccessors.vm.get = function () { return this._vm };
1947
-
1948
- prototypeAccessors.messages.get = function () { return looseClone(this._getMessages()) };
1949
- prototypeAccessors.dateTimeFormats.get = function () { return looseClone(this._getDateTimeFormats()) };
1950
- prototypeAccessors.numberFormats.get = function () { return looseClone(this._getNumberFormats()) };
1951
- prototypeAccessors.availableLocales.get = function () { return Object.keys(this.messages).sort() };
1952
-
1953
- prototypeAccessors.locale.get = function () { return this._vm.locale };
1954
- prototypeAccessors.locale.set = function (locale) {
1955
- this._vm.$set(this._vm, 'locale', locale);
1956
- };
1957
-
1958
- prototypeAccessors.fallbackLocale.get = function () { return this._vm.fallbackLocale };
1959
- prototypeAccessors.fallbackLocale.set = function (locale) {
1960
- this._localeChainCache = {};
1961
- this._vm.$set(this._vm, 'fallbackLocale', locale);
1962
- };
1963
-
1964
- prototypeAccessors.formatFallbackMessages.get = function () { return this._formatFallbackMessages };
1965
- prototypeAccessors.formatFallbackMessages.set = function (fallback) { this._formatFallbackMessages = fallback; };
1966
-
1967
- prototypeAccessors.missing.get = function () { return this._missing };
1968
- prototypeAccessors.missing.set = function (handler) { this._missing = handler; };
1969
-
1970
- prototypeAccessors.formatter.get = function () { return this._formatter };
1971
- prototypeAccessors.formatter.set = function (formatter) { this._formatter = formatter; };
1972
-
1973
- prototypeAccessors.silentTranslationWarn.get = function () { return this._silentTranslationWarn };
1974
- prototypeAccessors.silentTranslationWarn.set = function (silent) { this._silentTranslationWarn = silent; };
1975
-
1976
- prototypeAccessors.silentFallbackWarn.get = function () { return this._silentFallbackWarn };
1977
- prototypeAccessors.silentFallbackWarn.set = function (silent) { this._silentFallbackWarn = silent; };
1978
-
1979
- prototypeAccessors.preserveDirectiveContent.get = function () { return this._preserveDirectiveContent };
1980
- prototypeAccessors.preserveDirectiveContent.set = function (preserve) { this._preserveDirectiveContent = preserve; };
1981
-
1982
- prototypeAccessors.warnHtmlInMessage.get = function () { return this._warnHtmlInMessage };
1983
- prototypeAccessors.warnHtmlInMessage.set = function (level) {
1984
- var this$1$1 = this;
1985
-
1986
- var orgLevel = this._warnHtmlInMessage;
1987
- this._warnHtmlInMessage = level;
1988
- if (orgLevel !== level && (level === 'warn' || level === 'error')) {
1989
- var messages = this._getMessages();
1990
- Object.keys(messages).forEach(function (locale) {
1991
- this$1$1._checkLocaleMessage(locale, this$1$1._warnHtmlInMessage, messages[locale]);
1992
- });
1993
- }
1994
- };
1995
-
1996
- prototypeAccessors.postTranslation.get = function () { return this._postTranslation };
1997
- prototypeAccessors.postTranslation.set = function (handler) { this._postTranslation = handler; };
1998
-
1999
- prototypeAccessors.sync.get = function () { return this._sync };
2000
- prototypeAccessors.sync.set = function (val) { this._sync = val; };
2001
-
2002
- VueI18n.prototype._getMessages = function _getMessages () { return this._vm.messages };
2003
- VueI18n.prototype._getDateTimeFormats = function _getDateTimeFormats () { return this._vm.dateTimeFormats };
2004
- VueI18n.prototype._getNumberFormats = function _getNumberFormats () { return this._vm.numberFormats };
2005
-
2006
- VueI18n.prototype._warnDefault = function _warnDefault (locale, key, result, vm, values, interpolateMode) {
2007
- if (!isNull(result)) { return result }
2008
- if (this._missing) {
2009
- var missingRet = this._missing.apply(null, [locale, key, vm, values]);
2010
- if (isString(missingRet)) {
2011
- return missingRet
2012
- }
2013
- }
2014
-
2015
- if (this._formatFallbackMessages) {
2016
- var parsedArgs = parseArgs.apply(void 0, values);
2017
- return this._render(key, interpolateMode, parsedArgs.params, key)
2018
- } else {
2019
- return key
2020
- }
2021
- };
2022
-
2023
- VueI18n.prototype._isFallbackRoot = function _isFallbackRoot (val) {
2024
- return (this._fallbackRootWithEmptyString? !val : isNull(val)) && !isNull(this._root) && this._fallbackRoot
2025
- };
2026
-
2027
- VueI18n.prototype._isSilentFallbackWarn = function _isSilentFallbackWarn (key) {
2028
- return this._silentFallbackWarn instanceof RegExp
2029
- ? this._silentFallbackWarn.test(key)
2030
- : this._silentFallbackWarn
2031
- };
2032
-
2033
- VueI18n.prototype._isSilentFallback = function _isSilentFallback (locale, key) {
2034
- return this._isSilentFallbackWarn(key) && (this._isFallbackRoot() || locale !== this.fallbackLocale)
2035
- };
2036
-
2037
- VueI18n.prototype._isSilentTranslationWarn = function _isSilentTranslationWarn (key) {
2038
- return this._silentTranslationWarn instanceof RegExp
2039
- ? this._silentTranslationWarn.test(key)
2040
- : this._silentTranslationWarn
2041
- };
2042
-
2043
- VueI18n.prototype._interpolate = function _interpolate (
2044
- locale,
2045
- message,
2046
- key,
2047
- host,
2048
- interpolateMode,
2049
- values,
2050
- visitedLinkStack
2051
- ) {
2052
- if (!message) { return null }
2053
-
2054
- var pathRet = this._path.getPathValue(message, key);
2055
- if (isArray(pathRet) || isPlainObject(pathRet)) { return pathRet }
2056
-
2057
- var ret;
2058
- if (isNull(pathRet)) {
2059
- /* istanbul ignore else */
2060
- if (isPlainObject(message)) {
2061
- ret = message[key];
2062
- if (!(isString(ret) || isFunction(ret))) {
2063
- return null
2064
- }
2065
- } else {
2066
- return null
2067
- }
2068
- } else {
2069
- /* istanbul ignore else */
2070
- if (isString(pathRet) || isFunction(pathRet)) {
2071
- ret = pathRet;
2072
- } else {
2073
- return null
2074
- }
2075
- }
2076
-
2077
- // Check for the existence of links within the translated string
2078
- if (isString(ret) && (ret.indexOf('@:') >= 0 || ret.indexOf('@.') >= 0)) {
2079
- ret = this._link(locale, message, ret, host, 'raw', values, visitedLinkStack);
2080
- }
2081
-
2082
- return this._render(ret, interpolateMode, values, key)
2083
- };
2084
-
2085
- VueI18n.prototype._link = function _link (
2086
- locale,
2087
- message,
2088
- str,
2089
- host,
2090
- interpolateMode,
2091
- values,
2092
- visitedLinkStack
2093
- ) {
2094
- var ret = str;
2095
-
2096
- // Match all the links within the local
2097
- // We are going to replace each of
2098
- // them with its translation
2099
- var matches = ret.match(linkKeyMatcher);
2100
-
2101
- // eslint-disable-next-line no-autofix/prefer-const
2102
- for (var idx in matches) {
2103
- // ie compatible: filter custom array
2104
- // prototype method
2105
- if (!matches.hasOwnProperty(idx)) {
2106
- continue
2107
- }
2108
- var link = matches[idx];
2109
- var linkKeyPrefixMatches = link.match(linkKeyPrefixMatcher);
2110
- var linkPrefix = linkKeyPrefixMatches[0];
2111
- var formatterName = linkKeyPrefixMatches[1];
2112
-
2113
- // Remove the leading @:, @.case: and the brackets
2114
- var linkPlaceholder = link.replace(linkPrefix, '').replace(bracketsMatcher, '');
2115
-
2116
- if (includes(visitedLinkStack, linkPlaceholder)) {
2117
- return ret
2118
- }
2119
- visitedLinkStack.push(linkPlaceholder);
2120
-
2121
- // Translate the link
2122
- var translated = this._interpolate(
2123
- locale, message, linkPlaceholder, host,
2124
- interpolateMode === 'raw' ? 'string' : interpolateMode,
2125
- interpolateMode === 'raw' ? undefined : values,
2126
- visitedLinkStack
2127
- );
2128
-
2129
- if (this._isFallbackRoot(translated)) {
2130
- /* istanbul ignore if */
2131
- if (!this._root) { throw Error('unexpected error') }
2132
- var root = this._root.$i18n;
2133
- translated = root._translate(
2134
- root._getMessages(), root.locale, root.fallbackLocale,
2135
- linkPlaceholder, host, interpolateMode, values
2136
- );
2137
- }
2138
- translated = this._warnDefault(
2139
- locale, linkPlaceholder, translated, host,
2140
- isArray(values) ? values : [values],
2141
- interpolateMode
2142
- );
2143
-
2144
- if (this._modifiers.hasOwnProperty(formatterName)) {
2145
- translated = this._modifiers[formatterName](translated);
2146
- } else if (defaultModifiers.hasOwnProperty(formatterName)) {
2147
- translated = defaultModifiers[formatterName](translated);
2148
- }
2149
-
2150
- visitedLinkStack.pop();
2151
-
2152
- // Replace the link with the translated
2153
- ret = !translated ? ret : ret.replace(link, translated);
2154
- }
2155
-
2156
- return ret
2157
- };
2158
-
2159
- VueI18n.prototype._createMessageContext = function _createMessageContext (values, formatter, path, interpolateMode) {
2160
- var this$1$1 = this;
2161
-
2162
- var _list = isArray(values) ? values : [];
2163
- var _named = isObject(values) ? values : {};
2164
- var list = function (index) { return _list[index]; };
2165
- var named = function (key) { return _named[key]; };
2166
- var messages = this._getMessages();
2167
- var locale = this.locale;
2168
-
2169
- return {
2170
- list: list,
2171
- named: named,
2172
- values: values,
2173
- formatter: formatter,
2174
- path: path,
2175
- messages: messages,
2176
- locale: locale,
2177
- linked: function (linkedKey) { return this$1$1._interpolate(locale, messages[locale] || {}, linkedKey, null, interpolateMode, undefined, [linkedKey]); }
2178
- }
2179
- };
2180
-
2181
- VueI18n.prototype._render = function _render (message, interpolateMode, values, path) {
2182
- if (isFunction(message)) {
2183
- return message(
2184
- this._createMessageContext(values, this._formatter || defaultFormatter, path, interpolateMode)
2185
- )
2186
- }
2187
-
2188
- var ret = this._formatter.interpolate(message, values, path);
2189
-
2190
- // If the custom formatter refuses to work - apply the default one
2191
- if (!ret) {
2192
- ret = defaultFormatter.interpolate(message, values, path);
2193
- }
2194
-
2195
- // if interpolateMode is **not** 'string' ('row'),
2196
- // return the compiled data (e.g. ['foo', VNode, 'bar']) with formatter
2197
- return interpolateMode === 'string' && !isString(ret) ? ret.join('') : ret
2198
- };
2199
-
2200
- VueI18n.prototype._appendItemToChain = function _appendItemToChain (chain, item, blocks) {
2201
- var follow = false;
2202
- if (!includes(chain, item)) {
2203
- follow = true;
2204
- if (item) {
2205
- follow = item[item.length - 1] !== '!';
2206
- item = item.replace(/!/g, '');
2207
- chain.push(item);
2208
- if (blocks && blocks[item]) {
2209
- follow = blocks[item];
2210
- }
2211
- }
2212
- }
2213
- return follow
2214
- };
2215
-
2216
- VueI18n.prototype._appendLocaleToChain = function _appendLocaleToChain (chain, locale, blocks) {
2217
- var follow;
2218
- var tokens = locale.split('-');
2219
- do {
2220
- var item = tokens.join('-');
2221
- follow = this._appendItemToChain(chain, item, blocks);
2222
- tokens.splice(-1, 1);
2223
- } while (tokens.length && (follow === true))
2224
- return follow
2225
- };
2226
-
2227
- VueI18n.prototype._appendBlockToChain = function _appendBlockToChain (chain, block, blocks) {
2228
- var follow = true;
2229
- for (var i = 0; (i < block.length) && (isBoolean(follow)); i++) {
2230
- var locale = block[i];
2231
- if (isString(locale)) {
2232
- follow = this._appendLocaleToChain(chain, locale, blocks);
2233
- }
2234
- }
2235
- return follow
2236
- };
2237
-
2238
- VueI18n.prototype._getLocaleChain = function _getLocaleChain (start, fallbackLocale) {
2239
- if (start === '') { return [] }
2240
-
2241
- if (!this._localeChainCache) {
2242
- this._localeChainCache = {};
2243
- }
2244
-
2245
- var chain = this._localeChainCache[start];
2246
- if (!chain) {
2247
- if (!fallbackLocale) {
2248
- fallbackLocale = this.fallbackLocale;
2249
- }
2250
- chain = [];
2251
-
2252
- // first block defined by start
2253
- var block = [start];
2254
-
2255
- // while any intervening block found
2256
- while (isArray(block)) {
2257
- block = this._appendBlockToChain(
2258
- chain,
2259
- block,
2260
- fallbackLocale
2261
- );
2262
- }
2263
-
2264
- // last block defined by default
2265
- var defaults;
2266
- if (isArray(fallbackLocale)) {
2267
- defaults = fallbackLocale;
2268
- } else if (isObject(fallbackLocale)) {
2269
- /* $FlowFixMe */
2270
- if (fallbackLocale['default']) {
2271
- defaults = fallbackLocale['default'];
2272
- } else {
2273
- defaults = null;
2274
- }
2275
- } else {
2276
- defaults = fallbackLocale;
2277
- }
2278
-
2279
- // convert defaults to array
2280
- if (isString(defaults)) {
2281
- block = [defaults];
2282
- } else {
2283
- block = defaults;
2284
- }
2285
- if (block) {
2286
- this._appendBlockToChain(
2287
- chain,
2288
- block,
2289
- null
2290
- );
2291
- }
2292
- this._localeChainCache[start] = chain;
2293
- }
2294
- return chain
2295
- };
2296
-
2297
- VueI18n.prototype._translate = function _translate (
2298
- messages,
2299
- locale,
2300
- fallback,
2301
- key,
2302
- host,
2303
- interpolateMode,
2304
- args
2305
- ) {
2306
- var chain = this._getLocaleChain(locale, fallback);
2307
- var res;
2308
- for (var i = 0; i < chain.length; i++) {
2309
- var step = chain[i];
2310
- res =
2311
- this._interpolate(step, messages[step], key, host, interpolateMode, args, [key]);
2312
- if (!isNull(res)) {
2313
- if (step !== locale && "production" !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {
2314
- warn(("Fall back to translate the keypath '" + key + "' with '" + step + "' locale."));
2315
- }
2316
- return res
2317
- }
2318
- }
2319
- return null
2320
- };
2321
-
2322
- VueI18n.prototype._t = function _t (key, _locale, messages, host) {
2323
- var ref;
2324
-
2325
- var values = [], len = arguments.length - 4;
2326
- while ( len-- > 0 ) values[ len ] = arguments[ len + 4 ];
2327
- if (!key) { return '' }
2328
-
2329
- var parsedArgs = parseArgs.apply(void 0, values);
2330
- if(this._escapeParameterHtml) {
2331
- parsedArgs.params = escapeParams(parsedArgs.params);
2332
- }
2333
-
2334
- var locale = parsedArgs.locale || _locale;
2335
-
2336
- var ret = this._translate(
2337
- messages, locale, this.fallbackLocale, key,
2338
- host, 'string', parsedArgs.params
2339
- );
2340
- if (this._isFallbackRoot(ret)) {
2341
- /* istanbul ignore if */
2342
- if (!this._root) { throw Error('unexpected error') }
2343
- return (ref = this._root).$t.apply(ref, [ key ].concat( values ))
2344
- } else {
2345
- ret = this._warnDefault(locale, key, ret, host, values, 'string');
2346
- if (this._postTranslation && ret !== null && ret !== undefined) {
2347
- ret = this._postTranslation(ret, key);
2348
- }
2349
- return ret
2350
- }
2351
- };
2352
-
2353
- VueI18n.prototype.t = function t (key) {
2354
- var ref;
2355
-
2356
- var values = [], len = arguments.length - 1;
2357
- while ( len-- > 0 ) values[ len ] = arguments[ len + 1 ];
2358
- return (ref = this)._t.apply(ref, [ key, this.locale, this._getMessages(), null ].concat( values ))
2359
- };
2360
-
2361
- VueI18n.prototype._i = function _i (key, locale, messages, host, values) {
2362
- var ret =
2363
- this._translate(messages, locale, this.fallbackLocale, key, host, 'raw', values);
2364
- if (this._isFallbackRoot(ret)) {
2365
- if (!this._root) { throw Error('unexpected error') }
2366
- return this._root.$i18n.i(key, locale, values)
2367
- } else {
2368
- return this._warnDefault(locale, key, ret, host, [values], 'raw')
2369
- }
2370
- };
2371
-
2372
- VueI18n.prototype.i = function i (key, locale, values) {
2373
- /* istanbul ignore if */
2374
- if (!key) { return '' }
2375
-
2376
- if (!isString(locale)) {
2377
- locale = this.locale;
2378
- }
2379
-
2380
- return this._i(key, locale, this._getMessages(), null, values)
2381
- };
2382
-
2383
- VueI18n.prototype._tc = function _tc (
2384
- key,
2385
- _locale,
2386
- messages,
2387
- host,
2388
- choice
2389
- ) {
2390
- var ref;
2391
-
2392
- var values = [], len = arguments.length - 5;
2393
- while ( len-- > 0 ) values[ len ] = arguments[ len + 5 ];
2394
- if (!key) { return '' }
2395
- if (choice === undefined) {
2396
- choice = 1;
2397
- }
2398
-
2399
- var predefined = { 'count': choice, 'n': choice };
2400
- var parsedArgs = parseArgs.apply(void 0, values);
2401
- parsedArgs.params = Object.assign(predefined, parsedArgs.params);
2402
- values = parsedArgs.locale === null ? [parsedArgs.params] : [parsedArgs.locale, parsedArgs.params];
2403
- return this.fetchChoice((ref = this)._t.apply(ref, [ key, _locale, messages, host ].concat( values )), choice)
2404
- };
2405
-
2406
- VueI18n.prototype.fetchChoice = function fetchChoice (message, choice) {
2407
- /* istanbul ignore if */
2408
- if (!message || !isString(message)) { return null }
2409
- var choices = message.split('|');
2410
-
2411
- choice = this.getChoiceIndex(choice, choices.length);
2412
- if (!choices[choice]) { return message }
2413
- return choices[choice].trim()
2414
- };
2415
-
2416
- VueI18n.prototype.tc = function tc (key, choice) {
2417
- var ref;
2418
-
2419
- var values = [], len = arguments.length - 2;
2420
- while ( len-- > 0 ) values[ len ] = arguments[ len + 2 ];
2421
- return (ref = this)._tc.apply(ref, [ key, this.locale, this._getMessages(), null, choice ].concat( values ))
2422
- };
2423
-
2424
- VueI18n.prototype._te = function _te (key, locale, messages) {
2425
- var args = [], len = arguments.length - 3;
2426
- while ( len-- > 0 ) args[ len ] = arguments[ len + 3 ];
2427
-
2428
- var _locale = parseArgs.apply(void 0, args).locale || locale;
2429
- return this._exist(messages[_locale], key)
2430
- };
2431
-
2432
- VueI18n.prototype.te = function te (key, locale) {
2433
- return this._te(key, this.locale, this._getMessages(), locale)
2434
- };
2435
-
2436
- VueI18n.prototype.getLocaleMessage = function getLocaleMessage (locale) {
2437
- return looseClone(this._vm.messages[locale] || {})
2438
- };
2439
-
2440
- VueI18n.prototype.setLocaleMessage = function setLocaleMessage (locale, message) {
2441
- if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') {
2442
- this._checkLocaleMessage(locale, this._warnHtmlInMessage, message);
2443
- }
2444
- this._vm.$set(this._vm.messages, locale, message);
2445
- };
2446
-
2447
- VueI18n.prototype.mergeLocaleMessage = function mergeLocaleMessage (locale, message) {
2448
- if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') {
2449
- this._checkLocaleMessage(locale, this._warnHtmlInMessage, message);
2450
- }
2451
- this._vm.$set(this._vm.messages, locale, merge(
2452
- typeof this._vm.messages[locale] !== 'undefined' && Object.keys(this._vm.messages[locale]).length
2453
- ? Object.assign({}, this._vm.messages[locale])
2454
- : {},
2455
- message
2456
- ));
2457
- };
2458
-
2459
- VueI18n.prototype.getDateTimeFormat = function getDateTimeFormat (locale) {
2460
- return looseClone(this._vm.dateTimeFormats[locale] || {})
2461
- };
2462
-
2463
- VueI18n.prototype.setDateTimeFormat = function setDateTimeFormat (locale, format) {
2464
- this._vm.$set(this._vm.dateTimeFormats, locale, format);
2465
- this._clearDateTimeFormat(locale, format);
2466
- };
2467
-
2468
- VueI18n.prototype.mergeDateTimeFormat = function mergeDateTimeFormat (locale, format) {
2469
- this._vm.$set(this._vm.dateTimeFormats, locale, merge(this._vm.dateTimeFormats[locale] || {}, format));
2470
- this._clearDateTimeFormat(locale, format);
2471
- };
2472
-
2473
- VueI18n.prototype._clearDateTimeFormat = function _clearDateTimeFormat (locale, format) {
2474
- // eslint-disable-next-line no-autofix/prefer-const
2475
- for (var key in format) {
2476
- var id = locale + "__" + key;
2477
-
2478
- if (!this._dateTimeFormatters.hasOwnProperty(id)) {
2479
- continue
2480
- }
2481
-
2482
- delete this._dateTimeFormatters[id];
2483
- }
2484
- };
2485
-
2486
- VueI18n.prototype._localizeDateTime = function _localizeDateTime (
2487
- value,
2488
- locale,
2489
- fallback,
2490
- dateTimeFormats,
2491
- key,
2492
- options
2493
- ) {
2494
- var _locale = locale;
2495
- var formats = dateTimeFormats[_locale];
2496
-
2497
- var chain = this._getLocaleChain(locale, fallback);
2498
- for (var i = 0; i < chain.length; i++) {
2499
- var current = _locale;
2500
- var step = chain[i];
2501
- formats = dateTimeFormats[step];
2502
- _locale = step;
2503
- // fallback locale
2504
- if (isNull(formats) || isNull(formats[key])) {
2505
- if (step !== locale && "production" !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {
2506
- warn(("Fall back to '" + step + "' datetime formats from '" + current + "' datetime formats."));
2507
- }
2508
- } else {
2509
- break
2510
- }
2511
- }
2512
-
2513
- if (isNull(formats) || isNull(formats[key])) {
2514
- return null
2515
- } else {
2516
- var format = formats[key];
2517
-
2518
- var formatter;
2519
- if (options) {
2520
- formatter = new Intl.DateTimeFormat(_locale, Object.assign({}, format, options));
2521
- } else {
2522
- var id = _locale + "__" + key;
2523
- formatter = this._dateTimeFormatters[id];
2524
- if (!formatter) {
2525
- formatter = this._dateTimeFormatters[id] = new Intl.DateTimeFormat(_locale, format);
2526
- }
2527
- }
2528
-
2529
- return formatter.format(value)
2530
- }
2531
- };
2532
-
2533
- VueI18n.prototype._d = function _d (value, locale, key, options) {
2534
-
2535
- if (!key) {
2536
- var dtf = !options ? new Intl.DateTimeFormat(locale) : new Intl.DateTimeFormat(locale, options);
2537
- return dtf.format(value)
2538
- }
2539
-
2540
- var ret =
2541
- this._localizeDateTime(value, locale, this.fallbackLocale, this._getDateTimeFormats(), key, options);
2542
- if (this._isFallbackRoot(ret)) {
2543
- /* istanbul ignore if */
2544
- if (!this._root) { throw Error('unexpected error') }
2545
- return this._root.$i18n.d(value, key, locale)
2546
- } else {
2547
- return ret || ''
2548
- }
2549
- };
2550
-
2551
- VueI18n.prototype.d = function d (value) {
2552
- var args = [], len = arguments.length - 1;
2553
- while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
2554
-
2555
- var locale = this.locale;
2556
- var key = null;
2557
- var options = null;
2558
-
2559
- if (args.length === 1) {
2560
- if (isString(args[0])) {
2561
- key = args[0];
2562
- } else if (isObject(args[0])) {
2563
- if (args[0].locale) {
2564
- locale = args[0].locale;
2565
- }
2566
- if (args[0].key) {
2567
- key = args[0].key;
2568
- }
2569
- }
2570
-
2571
- options = Object.keys(args[0]).reduce(function (acc, key) {
2572
- var obj;
2573
-
2574
- if (includes(dateTimeFormatKeys, key)) {
2575
- return Object.assign({}, acc, ( obj = {}, obj[key] = args[0][key], obj ))
2576
- }
2577
- return acc
2578
- }, null);
2579
-
2580
- } else if (args.length === 2) {
2581
- if (isString(args[0])) {
2582
- key = args[0];
2583
- }
2584
- if (isString(args[1])) {
2585
- locale = args[1];
2586
- }
2587
- }
2588
-
2589
- return this._d(value, locale, key, options)
2590
- };
2591
-
2592
- VueI18n.prototype.getNumberFormat = function getNumberFormat (locale) {
2593
- return looseClone(this._vm.numberFormats[locale] || {})
2594
- };
2595
-
2596
- VueI18n.prototype.setNumberFormat = function setNumberFormat (locale, format) {
2597
- this._vm.$set(this._vm.numberFormats, locale, format);
2598
- this._clearNumberFormat(locale, format);
2599
- };
2600
-
2601
- VueI18n.prototype.mergeNumberFormat = function mergeNumberFormat (locale, format) {
2602
- this._vm.$set(this._vm.numberFormats, locale, merge(this._vm.numberFormats[locale] || {}, format));
2603
- this._clearNumberFormat(locale, format);
2604
- };
2605
-
2606
- VueI18n.prototype._clearNumberFormat = function _clearNumberFormat (locale, format) {
2607
- // eslint-disable-next-line no-autofix/prefer-const
2608
- for (var key in format) {
2609
- var id = locale + "__" + key;
2610
-
2611
- if (!this._numberFormatters.hasOwnProperty(id)) {
2612
- continue
2613
- }
2614
-
2615
- delete this._numberFormatters[id];
2616
- }
2617
- };
2618
-
2619
- VueI18n.prototype._getNumberFormatter = function _getNumberFormatter (
2620
- value,
2621
- locale,
2622
- fallback,
2623
- numberFormats,
2624
- key,
2625
- options
2626
- ) {
2627
- var _locale = locale;
2628
- var formats = numberFormats[_locale];
2629
-
2630
- var chain = this._getLocaleChain(locale, fallback);
2631
- for (var i = 0; i < chain.length; i++) {
2632
- var current = _locale;
2633
- var step = chain[i];
2634
- formats = numberFormats[step];
2635
- _locale = step;
2636
- // fallback locale
2637
- if (isNull(formats) || isNull(formats[key])) {
2638
- if (step !== locale && "production" !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {
2639
- warn(("Fall back to '" + step + "' number formats from '" + current + "' number formats."));
2640
- }
2641
- } else {
2642
- break
2643
- }
2644
- }
2645
-
2646
- if (isNull(formats) || isNull(formats[key])) {
2647
- return null
2648
- } else {
2649
- var format = formats[key];
2650
-
2651
- var formatter;
2652
- if (options) {
2653
- // If options specified - create one time number formatter
2654
- formatter = new Intl.NumberFormat(_locale, Object.assign({}, format, options));
2655
- } else {
2656
- var id = _locale + "__" + key;
2657
- formatter = this._numberFormatters[id];
2658
- if (!formatter) {
2659
- formatter = this._numberFormatters[id] = new Intl.NumberFormat(_locale, format);
2660
- }
2661
- }
2662
- return formatter
2663
- }
2664
- };
2665
-
2666
- VueI18n.prototype._n = function _n (value, locale, key, options) {
2667
- /* istanbul ignore if */
2668
- if (!VueI18n.availabilities.numberFormat) {
2669
- return ''
2670
- }
2671
-
2672
- if (!key) {
2673
- var nf = !options ? new Intl.NumberFormat(locale) : new Intl.NumberFormat(locale, options);
2674
- return nf.format(value)
2675
- }
2676
-
2677
- var formatter = this._getNumberFormatter(value, locale, this.fallbackLocale, this._getNumberFormats(), key, options);
2678
- var ret = formatter && formatter.format(value);
2679
- if (this._isFallbackRoot(ret)) {
2680
- /* istanbul ignore if */
2681
- if (!this._root) { throw Error('unexpected error') }
2682
- return this._root.$i18n.n(value, Object.assign({}, { key: key, locale: locale }, options))
2683
- } else {
2684
- return ret || ''
2685
- }
2686
- };
2687
-
2688
- VueI18n.prototype.n = function n (value) {
2689
- var args = [], len = arguments.length - 1;
2690
- while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
2691
-
2692
- var locale = this.locale;
2693
- var key = null;
2694
- var options = null;
2695
-
2696
- if (args.length === 1) {
2697
- if (isString(args[0])) {
2698
- key = args[0];
2699
- } else if (isObject(args[0])) {
2700
- if (args[0].locale) {
2701
- locale = args[0].locale;
2702
- }
2703
- if (args[0].key) {
2704
- key = args[0].key;
2705
- }
2706
-
2707
- // Filter out number format options only
2708
- options = Object.keys(args[0]).reduce(function (acc, key) {
2709
- var obj;
2710
-
2711
- if (includes(numberFormatKeys, key)) {
2712
- return Object.assign({}, acc, ( obj = {}, obj[key] = args[0][key], obj ))
2713
- }
2714
- return acc
2715
- }, null);
2716
- }
2717
- } else if (args.length === 2) {
2718
- if (isString(args[0])) {
2719
- key = args[0];
2720
- }
2721
- if (isString(args[1])) {
2722
- locale = args[1];
2723
- }
2724
- }
2725
-
2726
- return this._n(value, locale, key, options)
2727
- };
2728
-
2729
- VueI18n.prototype._ntp = function _ntp (value, locale, key, options) {
2730
- /* istanbul ignore if */
2731
- if (!VueI18n.availabilities.numberFormat) {
2732
- return []
2733
- }
2734
-
2735
- if (!key) {
2736
- var nf = !options ? new Intl.NumberFormat(locale) : new Intl.NumberFormat(locale, options);
2737
- return nf.formatToParts(value)
2738
- }
2739
-
2740
- var formatter = this._getNumberFormatter(value, locale, this.fallbackLocale, this._getNumberFormats(), key, options);
2741
- var ret = formatter && formatter.formatToParts(value);
2742
- if (this._isFallbackRoot(ret)) {
2743
- /* istanbul ignore if */
2744
- if (!this._root) { throw Error('unexpected error') }
2745
- return this._root.$i18n._ntp(value, locale, key, options)
2746
- } else {
2747
- return ret || []
2748
- }
2749
- };
2750
-
2751
- Object.defineProperties( VueI18n.prototype, prototypeAccessors );
2752
-
2753
- var availabilities;
2754
- // $FlowFixMe
2755
- Object.defineProperty(VueI18n, 'availabilities', {
2756
- get: function get () {
2757
- if (!availabilities) {
2758
- var intlDefined = typeof Intl !== 'undefined';
2759
- availabilities = {
2760
- dateTimeFormat: intlDefined && typeof Intl.DateTimeFormat !== 'undefined',
2761
- numberFormat: intlDefined && typeof Intl.NumberFormat !== 'undefined'
2762
- };
2763
- }
2764
-
2765
- return availabilities
2766
- }
2767
- });
2768
-
2769
- VueI18n.install = install$1;
2770
- VueI18n.version = '8.28.2';
2771
-
2772
- var VueI18n$1 = VueI18n;var validate$1 = {
2773
- required: "Поле \"{field}\" обязательно",
2774
- min: "Минимальное значение для этого поля {min}"
2775
- };
2776
- var Ru = {
2777
- validate: validate$1
2778
- };var validate = {
2779
- required: "\"{field}\" жолы міндетті",
2780
- min: "Бұл жол үшін ең кіші мән {min}"
2781
- };
2782
- var Kz = {
2783
- validate: validate
2784
- };var locale = localStorage.getItem('lang') ? localStorage.getItem('lang') : 'Ru';
2785
- Vue__default["default"].use(VueI18n$1);
2786
- var i18n = new VueI18n$1({
2787
- locale: locale,
2788
- fallbackLocale: 'Ru',
2789
- messages: {
2790
- Ru: Ru,
2791
- Kz: Kz
2792
- }
2793
- });//
560
+ };//
2794
561
  //
2795
562
  //
2796
563
  //
@@ -8475,7 +6242,7 @@ var __vue_render__$4 = function __vue_render__() {
8475
6242
  var _c = _vm._self._c || _h;
8476
6243
  return _c('div', {
8477
6244
  staticClass: "rb-facets-sidebar"
8478
- }, [_vm._ssrNode("<h4>Компоненты</h4> "), _c('b-form', [_c('b-form-row', [_c('b-col', {
6245
+ }, [_vm._ssrNode("<div class=\"d-flex justify-content-between align-items-center\">", "</div>", [_vm._ssrNode("<h4>Компоненты</h4> "), _vm._t("default")], 2), _vm._ssrNode(" "), _c('b-form', [_c('b-form-row', [_c('b-col', {
8479
6246
  attrs: {
8480
6247
  "lg": "12"
8481
6248
  }
@@ -8538,7 +6305,7 @@ var __vue_inject_styles__$4 = undefined;
8538
6305
  /* scoped */
8539
6306
  var __vue_scope_id__$4 = undefined;
8540
6307
  /* module identifier */
8541
- var __vue_module_identifier__$4 = "data-v-12095172";
6308
+ var __vue_module_identifier__$4 = "data-v-0376446f";
8542
6309
  /* functional template */
8543
6310
  var __vue_is_functional_template__$4 = false;
8544
6311
  /* style inject */
@@ -8718,14 +6485,10 @@ var _typeof = function(object) {
8718
6485
  var _f$input$propsData;
8719
6486
  var feedback = '';
8720
6487
  if (f.required && _this3.isValueEmpty(f.name)) {
8721
- feedback += i18n.t('validate.required', {
8722
- field: _this3.getDisplayField(f)
8723
- });
6488
+ feedback += _this3.getDisplayField(f);
8724
6489
  }
8725
6490
  if (f.type === 'integer' && _this3.isValueLessThanMin(f.name, f.input.propsData.min)) {
8726
- feedback += "\n".concat(i18n.t('validate.min', {
8727
- min: f.input.propsData.min
8728
- }));
6491
+ feedback += f.input.propsData.min;
8729
6492
  }
8730
6493
  // TODO: Костыль так как на бэке нету типа memo
8731
6494
  if (f.input.type === 'b-form-textarea' && _this3.isValueLessThanMax(f.name, (_f$input$propsData = f.input.propsData) === null || _f$input$propsData === void 0 ? void 0 : _f$input$propsData.max)) {
@@ -8930,7 +6693,7 @@ var __vue_inject_styles__$3 = undefined;
8930
6693
  /* scoped */
8931
6694
  var __vue_scope_id__$3 = undefined;
8932
6695
  /* module identifier */
8933
- var __vue_module_identifier__$3 = "data-v-58358fb8";
6696
+ var __vue_module_identifier__$3 = "data-v-107e5361";
8934
6697
  /* functional template */
8935
6698
  var __vue_is_functional_template__$3 = false;
8936
6699
  /* style inject */
@@ -10206,7 +7969,7 @@ var __vue_component__ = /*#__PURE__*/normalizeComponent({
10206
7969
  render: __vue_render__,
10207
7970
  staticRenderFns: __vue_staticRenderFns__
10208
7971
  }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
10209
- 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});// install function executed by Vue.use()
7972
+ 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});// install function executed by Vue.use()
10210
7973
  var install = function installRbDocumentFormConstructor(Vue) {
10211
7974
  Object.entries(components$1).forEach(function (_ref) {
10212
7975
  var _ref2 = _slicedToArray(_ref, 2),
@@ -10214,7 +7977,7 @@ var install = function installRbDocumentFormConstructor(Vue) {
10214
7977
  component = _ref2[1];
10215
7978
  Vue.component(componentName, component);
10216
7979
  });
10217
- };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});// Attach named exports directly to plugin. IIFE/CJS will
7980
+ };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});// Attach named exports directly to plugin. IIFE/CJS will
10218
7981
  // only expose one global var, with component exports exposed as properties of
10219
7982
  // that global var (eg. plugin.component)
10220
7983
  Object.entries(components).forEach(function (_ref) {