@native-systems/utility 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/dist/index.cjs +668 -41
- package/dist/index.d.ts +153 -7
- package/dist/index.esm.js +668 -41
- package/package.json +16 -3
package/dist/index.esm.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import Handlebars from 'handlebars';
|
|
2
|
+
import sanitizeHtml, { simpleTransform } from 'sanitize-html';
|
|
3
|
+
import MarkdownIt from 'markdown-it';
|
|
4
|
+
|
|
1
5
|
var PostgresError = /*#__PURE__*/ (function (PostgresError) {
|
|
2
6
|
PostgresError['SUCCESSFUL_COMPLETION'] = '00000';
|
|
3
7
|
PostgresError['WARNING'] = '01000';
|
|
@@ -294,7 +298,7 @@ function _call_super$1(_this, derived, args) {
|
|
|
294
298
|
: derived.apply(_this, args)
|
|
295
299
|
);
|
|
296
300
|
}
|
|
297
|
-
function _class_call_check$
|
|
301
|
+
function _class_call_check$6(instance, Constructor) {
|
|
298
302
|
if (!(instance instanceof Constructor)) {
|
|
299
303
|
throw new TypeError('Cannot call a class as a function');
|
|
300
304
|
}
|
|
@@ -314,7 +318,7 @@ function _construct$1(Parent, args, Class) {
|
|
|
314
318
|
}
|
|
315
319
|
return _construct$1.apply(null, arguments);
|
|
316
320
|
}
|
|
317
|
-
function _define_property$
|
|
321
|
+
function _define_property$5(obj, key, value) {
|
|
318
322
|
if (key in obj) {
|
|
319
323
|
Object.defineProperty(obj, key, {
|
|
320
324
|
value: value,
|
|
@@ -352,7 +356,7 @@ function _is_native_function$1(fn) {
|
|
|
352
356
|
return Function.toString.call(fn).indexOf('[native code]') !== -1;
|
|
353
357
|
}
|
|
354
358
|
function _possible_constructor_return$1(self, call) {
|
|
355
|
-
if (call && (_type_of$
|
|
359
|
+
if (call && (_type_of$2(call) === 'object' || typeof call === 'function')) {
|
|
356
360
|
return call;
|
|
357
361
|
}
|
|
358
362
|
return _assert_this_initialized$1(self);
|
|
@@ -366,7 +370,7 @@ function _set_prototype_of$1(o, p) {
|
|
|
366
370
|
};
|
|
367
371
|
return _set_prototype_of$1(o, p);
|
|
368
372
|
}
|
|
369
|
-
function _type_of$
|
|
373
|
+
function _type_of$2(obj) {
|
|
370
374
|
'@swc/helpers - typeof';
|
|
371
375
|
return obj && typeof Symbol !== 'undefined' && obj.constructor === Symbol
|
|
372
376
|
? 'symbol'
|
|
@@ -415,10 +419,10 @@ function _is_native_reflect_construct$1() {
|
|
|
415
419
|
var NativeException = /*#__PURE__*/ (function (Error1) {
|
|
416
420
|
_inherits$1(NativeException, Error1);
|
|
417
421
|
function NativeException(code, message) {
|
|
418
|
-
_class_call_check$
|
|
422
|
+
_class_call_check$6(this, NativeException);
|
|
419
423
|
var _this;
|
|
420
424
|
(_this = _call_super$1(this, NativeException, [message])),
|
|
421
|
-
_define_property$
|
|
425
|
+
_define_property$5(_this, 'code', void 0);
|
|
422
426
|
_this.name = 'NativeError';
|
|
423
427
|
_this.code = code;
|
|
424
428
|
return _this;
|
|
@@ -447,7 +451,7 @@ function _call_super(_this, derived, args) {
|
|
|
447
451
|
: derived.apply(_this, args)
|
|
448
452
|
);
|
|
449
453
|
}
|
|
450
|
-
function _class_call_check$
|
|
454
|
+
function _class_call_check$5(instance, Constructor) {
|
|
451
455
|
if (!(instance instanceof Constructor)) {
|
|
452
456
|
throw new TypeError('Cannot call a class as a function');
|
|
453
457
|
}
|
|
@@ -467,7 +471,7 @@ function _construct(Parent, args, Class) {
|
|
|
467
471
|
}
|
|
468
472
|
return _construct.apply(null, arguments);
|
|
469
473
|
}
|
|
470
|
-
function _defineProperties$
|
|
474
|
+
function _defineProperties$5(target, props) {
|
|
471
475
|
for (var i = 0; i < props.length; i++) {
|
|
472
476
|
var descriptor = props[i];
|
|
473
477
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -476,11 +480,11 @@ function _defineProperties$3(target, props) {
|
|
|
476
480
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
477
481
|
}
|
|
478
482
|
}
|
|
479
|
-
function _create_class$
|
|
480
|
-
if (protoProps) _defineProperties$
|
|
483
|
+
function _create_class$5(Constructor, protoProps, staticProps) {
|
|
484
|
+
if (protoProps) _defineProperties$5(Constructor.prototype, protoProps);
|
|
481
485
|
return Constructor;
|
|
482
486
|
}
|
|
483
|
-
function _define_property$
|
|
487
|
+
function _define_property$4(obj, key, value) {
|
|
484
488
|
if (key in obj) {
|
|
485
489
|
Object.defineProperty(obj, key, {
|
|
486
490
|
value: value,
|
|
@@ -518,7 +522,7 @@ function _is_native_function(fn) {
|
|
|
518
522
|
return Function.toString.call(fn).indexOf('[native code]') !== -1;
|
|
519
523
|
}
|
|
520
524
|
function _possible_constructor_return(self, call) {
|
|
521
|
-
if (call && (_type_of(call) === 'object' || typeof call === 'function')) {
|
|
525
|
+
if (call && (_type_of$1(call) === 'object' || typeof call === 'function')) {
|
|
522
526
|
return call;
|
|
523
527
|
}
|
|
524
528
|
return _assert_this_initialized(self);
|
|
@@ -532,7 +536,7 @@ function _set_prototype_of(o, p) {
|
|
|
532
536
|
};
|
|
533
537
|
return _set_prototype_of(o, p);
|
|
534
538
|
}
|
|
535
|
-
function _type_of(obj) {
|
|
539
|
+
function _type_of$1(obj) {
|
|
536
540
|
'@swc/helpers - typeof';
|
|
537
541
|
return obj && typeof Symbol !== 'undefined' && obj.constructor === Symbol
|
|
538
542
|
? 'symbol'
|
|
@@ -577,17 +581,17 @@ function _is_native_reflect_construct() {
|
|
|
577
581
|
var PgException = /*#__PURE__*/ (function (Error1) {
|
|
578
582
|
_inherits(PgException, Error1);
|
|
579
583
|
function PgException(err, message, specific) {
|
|
580
|
-
_class_call_check$
|
|
584
|
+
_class_call_check$5(this, PgException);
|
|
581
585
|
var _this;
|
|
582
586
|
(_this = _call_super(this, PgException, [message])),
|
|
583
|
-
_define_property$
|
|
584
|
-
_define_property$
|
|
587
|
+
_define_property$4(_this, 'err', void 0),
|
|
588
|
+
_define_property$4(_this, 'specific', void 0);
|
|
585
589
|
_this.name = 'PgError';
|
|
586
590
|
_this.err = err;
|
|
587
591
|
_this.specific = specific;
|
|
588
592
|
return _this;
|
|
589
593
|
}
|
|
590
|
-
_create_class$
|
|
594
|
+
_create_class$5(PgException, [
|
|
591
595
|
{
|
|
592
596
|
key: 'getStatus',
|
|
593
597
|
value: function getStatus() {
|
|
@@ -614,12 +618,12 @@ var PgException = /*#__PURE__*/ (function (Error1) {
|
|
|
614
618
|
return PgException;
|
|
615
619
|
})(_wrap_native_super(Error));
|
|
616
620
|
|
|
617
|
-
function _class_call_check$
|
|
621
|
+
function _class_call_check$4(instance, Constructor) {
|
|
618
622
|
if (!(instance instanceof Constructor)) {
|
|
619
623
|
throw new TypeError('Cannot call a class as a function');
|
|
620
624
|
}
|
|
621
625
|
}
|
|
622
|
-
function _defineProperties$
|
|
626
|
+
function _defineProperties$4(target, props) {
|
|
623
627
|
for (var i = 0; i < props.length; i++) {
|
|
624
628
|
var descriptor = props[i];
|
|
625
629
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -628,11 +632,11 @@ function _defineProperties$2(target, props) {
|
|
|
628
632
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
629
633
|
}
|
|
630
634
|
}
|
|
631
|
-
function _create_class$
|
|
632
|
-
if (protoProps) _defineProperties$
|
|
635
|
+
function _create_class$4(Constructor, protoProps, staticProps) {
|
|
636
|
+
if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
|
|
633
637
|
return Constructor;
|
|
634
638
|
}
|
|
635
|
-
function _define_property$
|
|
639
|
+
function _define_property$3(obj, key, value) {
|
|
636
640
|
if (key in obj) {
|
|
637
641
|
Object.defineProperty(obj, key, {
|
|
638
642
|
value: value,
|
|
@@ -660,10 +664,10 @@ var NO_OP = function (_message) {
|
|
|
660
664
|
};
|
|
661
665
|
var ConsoleLogger = /*#__PURE__*/ (function () {
|
|
662
666
|
function ConsoleLogger(options) {
|
|
663
|
-
_class_call_check$
|
|
664
|
-
_define_property$
|
|
665
|
-
_define_property$
|
|
666
|
-
_define_property$
|
|
667
|
+
_class_call_check$4(this, ConsoleLogger);
|
|
668
|
+
_define_property$3(this, 'log', void 0);
|
|
669
|
+
_define_property$3(this, 'warn', void 0);
|
|
670
|
+
_define_property$3(this, 'error', void 0);
|
|
667
671
|
var level = (options || {}).level;
|
|
668
672
|
this.error = console.error.bind(console);
|
|
669
673
|
this.warn = NO_OP;
|
|
@@ -678,7 +682,7 @@ var ConsoleLogger = /*#__PURE__*/ (function () {
|
|
|
678
682
|
break;
|
|
679
683
|
}
|
|
680
684
|
}
|
|
681
|
-
_create_class$
|
|
685
|
+
_create_class$4(ConsoleLogger, [
|
|
682
686
|
{
|
|
683
687
|
key: 'disable',
|
|
684
688
|
value: function disable() {
|
|
@@ -714,12 +718,12 @@ var logger = new ConsoleLogger({
|
|
|
714
718
|
level: LOG_LEVEL,
|
|
715
719
|
});
|
|
716
720
|
|
|
717
|
-
function _class_call_check$
|
|
721
|
+
function _class_call_check$3(instance, Constructor) {
|
|
718
722
|
if (!(instance instanceof Constructor)) {
|
|
719
723
|
throw new TypeError('Cannot call a class as a function');
|
|
720
724
|
}
|
|
721
725
|
}
|
|
722
|
-
function _defineProperties$
|
|
726
|
+
function _defineProperties$3(target, props) {
|
|
723
727
|
for (var i = 0; i < props.length; i++) {
|
|
724
728
|
var descriptor = props[i];
|
|
725
729
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -728,15 +732,15 @@ function _defineProperties$1(target, props) {
|
|
|
728
732
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
729
733
|
}
|
|
730
734
|
}
|
|
731
|
-
function _create_class$
|
|
732
|
-
if (staticProps) _defineProperties$
|
|
735
|
+
function _create_class$3(Constructor, protoProps, staticProps) {
|
|
736
|
+
if (staticProps) _defineProperties$3(Constructor, staticProps);
|
|
733
737
|
return Constructor;
|
|
734
738
|
}
|
|
735
739
|
var HttpHandler = /*#__PURE__*/ (function () {
|
|
736
740
|
function HttpHandler() {
|
|
737
|
-
_class_call_check$
|
|
741
|
+
_class_call_check$3(this, HttpHandler);
|
|
738
742
|
}
|
|
739
|
-
_create_class$
|
|
743
|
+
_create_class$3(HttpHandler, null, [
|
|
740
744
|
{
|
|
741
745
|
key: 'response',
|
|
742
746
|
value: function response(response) {
|
|
@@ -780,12 +784,12 @@ var HttpHandler = /*#__PURE__*/ (function () {
|
|
|
780
784
|
return HttpHandler;
|
|
781
785
|
})();
|
|
782
786
|
|
|
783
|
-
function _class_call_check(instance, Constructor) {
|
|
787
|
+
function _class_call_check$2(instance, Constructor) {
|
|
784
788
|
if (!(instance instanceof Constructor)) {
|
|
785
789
|
throw new TypeError('Cannot call a class as a function');
|
|
786
790
|
}
|
|
787
791
|
}
|
|
788
|
-
function _defineProperties(target, props) {
|
|
792
|
+
function _defineProperties$2(target, props) {
|
|
789
793
|
for (var i = 0; i < props.length; i++) {
|
|
790
794
|
var descriptor = props[i];
|
|
791
795
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -794,11 +798,11 @@ function _defineProperties(target, props) {
|
|
|
794
798
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
795
799
|
}
|
|
796
800
|
}
|
|
797
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
798
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
801
|
+
function _create_class$2(Constructor, protoProps, staticProps) {
|
|
802
|
+
if (staticProps) _defineProperties$2(Constructor, staticProps);
|
|
799
803
|
return Constructor;
|
|
800
804
|
}
|
|
801
|
-
function _define_property(obj, key, value) {
|
|
805
|
+
function _define_property$2(obj, key, value) {
|
|
802
806
|
if (key in obj) {
|
|
803
807
|
Object.defineProperty(obj, key, {
|
|
804
808
|
value: value,
|
|
@@ -813,9 +817,9 @@ function _define_property(obj, key, value) {
|
|
|
813
817
|
}
|
|
814
818
|
var CookieHelper = /*#__PURE__*/ (function () {
|
|
815
819
|
function CookieHelper() {
|
|
816
|
-
_class_call_check(this, CookieHelper);
|
|
820
|
+
_class_call_check$2(this, CookieHelper);
|
|
817
821
|
}
|
|
818
|
-
_create_class(CookieHelper, null, [
|
|
822
|
+
_create_class$2(CookieHelper, null, [
|
|
819
823
|
{
|
|
820
824
|
key: 'isProduction',
|
|
821
825
|
value: function isProduction() {
|
|
@@ -831,13 +835,636 @@ var CookieHelper = /*#__PURE__*/ (function () {
|
|
|
831
835
|
]);
|
|
832
836
|
return CookieHelper;
|
|
833
837
|
})();
|
|
834
|
-
_define_property(CookieHelper, 'cookieSecurePrefix', '__Secure-');
|
|
838
|
+
_define_property$2(CookieHelper, 'cookieSecurePrefix', '__Secure-');
|
|
839
|
+
|
|
840
|
+
function _type_of(obj) {
|
|
841
|
+
'@swc/helpers - typeof';
|
|
842
|
+
return obj && typeof Symbol !== 'undefined' && obj.constructor === Symbol
|
|
843
|
+
? 'symbol'
|
|
844
|
+
: typeof obj;
|
|
845
|
+
}
|
|
846
|
+
function encodeReserved(str) {
|
|
847
|
+
return str
|
|
848
|
+
.split(/(%[0-9A-Fa-f]{2})/g)
|
|
849
|
+
.map(function (part) {
|
|
850
|
+
if (!/%[0-9A-Fa-f]/.test(part)) {
|
|
851
|
+
part = encodeURI(part).replace(/%5B/g, '[').replace(/%5D/g, ']');
|
|
852
|
+
}
|
|
853
|
+
return part;
|
|
854
|
+
})
|
|
855
|
+
.join('');
|
|
856
|
+
}
|
|
857
|
+
function encodeUnreserved(str) {
|
|
858
|
+
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
|
|
859
|
+
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
function encodeValue(operator, value, key) {
|
|
863
|
+
value =
|
|
864
|
+
operator === '+' || operator === '#'
|
|
865
|
+
? encodeReserved(value)
|
|
866
|
+
: encodeUnreserved(value);
|
|
867
|
+
if (key) {
|
|
868
|
+
return encodeUnreserved(key) + '=' + value;
|
|
869
|
+
} else {
|
|
870
|
+
return value;
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
function isDefined(value) {
|
|
874
|
+
return value !== undefined && value !== null;
|
|
875
|
+
}
|
|
876
|
+
function isKeyOperator(operator) {
|
|
877
|
+
return operator === ';' || operator === '&' || operator === '?';
|
|
878
|
+
}
|
|
879
|
+
function getValues(context, operator, key, modifier) {
|
|
880
|
+
var value = context[key],
|
|
881
|
+
result = [];
|
|
882
|
+
if (isDefined(value) && value !== '') {
|
|
883
|
+
if (
|
|
884
|
+
typeof value === 'string' ||
|
|
885
|
+
typeof value === 'number' ||
|
|
886
|
+
typeof value === 'boolean'
|
|
887
|
+
) {
|
|
888
|
+
value = value.toString();
|
|
889
|
+
if (modifier && modifier !== '*') {
|
|
890
|
+
value = value.substring(0, parseInt(modifier, 10));
|
|
891
|
+
}
|
|
892
|
+
result.push(
|
|
893
|
+
encodeValue(operator, value, isKeyOperator(operator) ? key : null)
|
|
894
|
+
);
|
|
895
|
+
} else {
|
|
896
|
+
if (modifier === '*') {
|
|
897
|
+
if (Array.isArray(value)) {
|
|
898
|
+
value.filter(isDefined).forEach(function (value) {
|
|
899
|
+
result.push(
|
|
900
|
+
encodeValue(
|
|
901
|
+
operator,
|
|
902
|
+
String(value),
|
|
903
|
+
isKeyOperator(operator) ? key : null
|
|
904
|
+
)
|
|
905
|
+
);
|
|
906
|
+
});
|
|
907
|
+
} else if (
|
|
908
|
+
(typeof value === 'undefined' ? 'undefined' : _type_of(value)) ===
|
|
909
|
+
'object' &&
|
|
910
|
+
value !== null
|
|
911
|
+
) {
|
|
912
|
+
Object.keys(value).forEach(function (k) {
|
|
913
|
+
if (isDefined(value[k])) {
|
|
914
|
+
result.push(encodeValue(operator, String(value[k]), k));
|
|
915
|
+
}
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
} else {
|
|
919
|
+
var tmp = [];
|
|
920
|
+
if (Array.isArray(value)) {
|
|
921
|
+
value.filter(isDefined).forEach(function (value) {
|
|
922
|
+
tmp.push(encodeValue(operator, String(value)));
|
|
923
|
+
});
|
|
924
|
+
} else if (
|
|
925
|
+
(typeof value === 'undefined' ? 'undefined' : _type_of(value)) ===
|
|
926
|
+
'object' &&
|
|
927
|
+
value !== null
|
|
928
|
+
) {
|
|
929
|
+
Object.keys(value).forEach(function (k) {
|
|
930
|
+
if (isDefined(value[k])) {
|
|
931
|
+
tmp.push(encodeUnreserved(k));
|
|
932
|
+
tmp.push(encodeValue(operator, String(value[k])));
|
|
933
|
+
}
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
if (isKeyOperator(operator)) {
|
|
937
|
+
result.push(encodeUnreserved(key) + '=' + tmp.join(','));
|
|
938
|
+
} else if (tmp.length !== 0) {
|
|
939
|
+
result.push(tmp.join(','));
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
} else {
|
|
944
|
+
if (operator === ';') {
|
|
945
|
+
if (isDefined(value)) {
|
|
946
|
+
result.push(encodeUnreserved(key));
|
|
947
|
+
}
|
|
948
|
+
} else if (value === '' && (operator === '&' || operator === '?')) {
|
|
949
|
+
result.push(encodeUnreserved(key) + '=');
|
|
950
|
+
} else if (value === '') {
|
|
951
|
+
result.push('');
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
return result;
|
|
955
|
+
}
|
|
956
|
+
function parseTemplate(template) {
|
|
957
|
+
var operators = ['+', '#', '.', '/', ';', '?', '&'];
|
|
958
|
+
return {
|
|
959
|
+
expand: function expand(context) {
|
|
960
|
+
return template.replace(
|
|
961
|
+
/\{([^{}]+)}|([^{}]+)/g,
|
|
962
|
+
function (_, expression, literal) {
|
|
963
|
+
if (expression) {
|
|
964
|
+
var operator = null,
|
|
965
|
+
values = [];
|
|
966
|
+
if (operators.indexOf(expression.charAt(0)) !== -1) {
|
|
967
|
+
operator = expression.charAt(0);
|
|
968
|
+
expression = expression.substring(1);
|
|
969
|
+
}
|
|
970
|
+
expression.split(/,/g).forEach(function (variable) {
|
|
971
|
+
var tmp = /([^:*]*)(?::(\d+)|(\*))?/.exec(variable);
|
|
972
|
+
if (tmp) {
|
|
973
|
+
values.push.apply(
|
|
974
|
+
values,
|
|
975
|
+
getValues(context, operator, tmp[1], tmp[2] || tmp[3])
|
|
976
|
+
);
|
|
977
|
+
}
|
|
978
|
+
});
|
|
979
|
+
if (operator && operator !== '+') {
|
|
980
|
+
var separator = ',';
|
|
981
|
+
if (operator === '?') {
|
|
982
|
+
separator = '&';
|
|
983
|
+
} else if (operator !== '#') {
|
|
984
|
+
separator = operator;
|
|
985
|
+
}
|
|
986
|
+
return (
|
|
987
|
+
(values.length !== 0 ? operator : '') + values.join(separator)
|
|
988
|
+
);
|
|
989
|
+
} else {
|
|
990
|
+
return values.join(',');
|
|
991
|
+
}
|
|
992
|
+
} else {
|
|
993
|
+
return encodeReserved(literal);
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
);
|
|
997
|
+
},
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
function _class_call_check$1(instance, Constructor) {
|
|
1002
|
+
if (!(instance instanceof Constructor)) {
|
|
1003
|
+
throw new TypeError('Cannot call a class as a function');
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
function _defineProperties$1(target, props) {
|
|
1007
|
+
for (var i = 0; i < props.length; i++) {
|
|
1008
|
+
var descriptor = props[i];
|
|
1009
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1010
|
+
descriptor.configurable = true;
|
|
1011
|
+
if ('value' in descriptor) descriptor.writable = true;
|
|
1012
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
function _create_class$1(Constructor, protoProps, staticProps) {
|
|
1016
|
+
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
|
1017
|
+
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
|
1018
|
+
return Constructor;
|
|
1019
|
+
}
|
|
1020
|
+
function _define_property$1(obj, key, value) {
|
|
1021
|
+
if (key in obj) {
|
|
1022
|
+
Object.defineProperty(obj, key, {
|
|
1023
|
+
value: value,
|
|
1024
|
+
enumerable: true,
|
|
1025
|
+
configurable: true,
|
|
1026
|
+
writable: true,
|
|
1027
|
+
});
|
|
1028
|
+
} else {
|
|
1029
|
+
obj[key] = value;
|
|
1030
|
+
}
|
|
1031
|
+
return obj;
|
|
1032
|
+
}
|
|
1033
|
+
function _object_spread(target) {
|
|
1034
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1035
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
1036
|
+
var ownKeys = Object.keys(source);
|
|
1037
|
+
if (typeof Object.getOwnPropertySymbols === 'function') {
|
|
1038
|
+
ownKeys = ownKeys.concat(
|
|
1039
|
+
Object.getOwnPropertySymbols(source).filter(function (sym) {
|
|
1040
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
1041
|
+
})
|
|
1042
|
+
);
|
|
1043
|
+
}
|
|
1044
|
+
ownKeys.forEach(function (key) {
|
|
1045
|
+
_define_property$1(target, key, source[key]);
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
return target;
|
|
1049
|
+
}
|
|
1050
|
+
var PatternCompiler = /*#__PURE__*/ (function () {
|
|
1051
|
+
function PatternCompiler(defaultView, installPlugins) {
|
|
1052
|
+
_class_call_check$1(this, PatternCompiler);
|
|
1053
|
+
_define_property$1(this, 'defaultView', void 0);
|
|
1054
|
+
_define_property$1(this, 'handlebars', void 0);
|
|
1055
|
+
this.defaultView = defaultView;
|
|
1056
|
+
this.handlebars = Handlebars.create();
|
|
1057
|
+
installPlugins(this.handlebars);
|
|
1058
|
+
}
|
|
1059
|
+
_create_class$1(
|
|
1060
|
+
PatternCompiler,
|
|
1061
|
+
[
|
|
1062
|
+
{
|
|
1063
|
+
key: 'compile',
|
|
1064
|
+
value: function compile(source, partialView) {
|
|
1065
|
+
if (!source) return '';
|
|
1066
|
+
var compiler = this.handlebars.compile(source);
|
|
1067
|
+
return compiler(_object_spread({}, this.defaultView, partialView));
|
|
1068
|
+
},
|
|
1069
|
+
},
|
|
1070
|
+
{
|
|
1071
|
+
key: 'keyToTemplate',
|
|
1072
|
+
value: function keyToTemplate(key) {
|
|
1073
|
+
return PatternCompiler.keyToTemplate(key);
|
|
1074
|
+
},
|
|
1075
|
+
},
|
|
1076
|
+
],
|
|
1077
|
+
[
|
|
1078
|
+
{
|
|
1079
|
+
key: 'keyToTemplate',
|
|
1080
|
+
value: function keyToTemplate(key) {
|
|
1081
|
+
return '{{'.concat(key, '}}');
|
|
1082
|
+
},
|
|
1083
|
+
},
|
|
1084
|
+
]
|
|
1085
|
+
);
|
|
1086
|
+
return PatternCompiler;
|
|
1087
|
+
})();
|
|
1088
|
+
|
|
1089
|
+
var eqPlugin = function (handlebars) {
|
|
1090
|
+
handlebars.registerHelper('eq', function (a, b) {
|
|
1091
|
+
return a === b;
|
|
1092
|
+
});
|
|
1093
|
+
};
|
|
1094
|
+
|
|
1095
|
+
function _array_like_to_array(arr, len) {
|
|
1096
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
1097
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
1098
|
+
return arr2;
|
|
1099
|
+
}
|
|
1100
|
+
function _array_without_holes(arr) {
|
|
1101
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
1102
|
+
}
|
|
1103
|
+
function _iterable_to_array(iter) {
|
|
1104
|
+
if (
|
|
1105
|
+
(typeof Symbol !== 'undefined' && iter[Symbol.iterator] != null) ||
|
|
1106
|
+
iter['@@iterator'] != null
|
|
1107
|
+
)
|
|
1108
|
+
return Array.from(iter);
|
|
1109
|
+
}
|
|
1110
|
+
function _non_iterable_spread() {
|
|
1111
|
+
throw new TypeError(
|
|
1112
|
+
'Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
|
|
1113
|
+
);
|
|
1114
|
+
}
|
|
1115
|
+
function _to_consumable_array(arr) {
|
|
1116
|
+
return (
|
|
1117
|
+
_array_without_holes(arr) ||
|
|
1118
|
+
_iterable_to_array(arr) ||
|
|
1119
|
+
_unsupported_iterable_to_array(arr) ||
|
|
1120
|
+
_non_iterable_spread()
|
|
1121
|
+
);
|
|
1122
|
+
}
|
|
1123
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
1124
|
+
if (!o) return;
|
|
1125
|
+
if (typeof o === 'string') return _array_like_to_array(o, minLen);
|
|
1126
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1127
|
+
if (n === 'Object' && o.constructor) n = o.constructor.name;
|
|
1128
|
+
if (n === 'Map' || n === 'Set') return Array.from(n);
|
|
1129
|
+
if (n === 'Arguments' || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
1130
|
+
return _array_like_to_array(o, minLen);
|
|
1131
|
+
}
|
|
1132
|
+
var mdParser = new MarkdownIt();
|
|
1133
|
+
var markdownPlugin = function (handlebars) {
|
|
1134
|
+
handlebars.registerHelper('md', function (markdownText) {
|
|
1135
|
+
if (!markdownText) return '';
|
|
1136
|
+
var cleanHtml = sanitizeHtml(mdParser.render(markdownText), {
|
|
1137
|
+
allowedTags: _to_consumable_array([
|
|
1138
|
+
'h1',
|
|
1139
|
+
'h2',
|
|
1140
|
+
'h3',
|
|
1141
|
+
'h4',
|
|
1142
|
+
'h5',
|
|
1143
|
+
'h6',
|
|
1144
|
+
'b',
|
|
1145
|
+
]).concat(
|
|
1146
|
+
_to_consumable_array([
|
|
1147
|
+
'i',
|
|
1148
|
+
'strong',
|
|
1149
|
+
'em',
|
|
1150
|
+
'a',
|
|
1151
|
+
'ul',
|
|
1152
|
+
'ol',
|
|
1153
|
+
'li',
|
|
1154
|
+
'p',
|
|
1155
|
+
'br',
|
|
1156
|
+
])
|
|
1157
|
+
),
|
|
1158
|
+
allowedAttributes: {
|
|
1159
|
+
a: ['href', 'title', 'target'],
|
|
1160
|
+
},
|
|
1161
|
+
transformTags: {
|
|
1162
|
+
a: simpleTransform('a', {
|
|
1163
|
+
target: '_blank',
|
|
1164
|
+
rel: 'noopener',
|
|
1165
|
+
}),
|
|
1166
|
+
},
|
|
1167
|
+
});
|
|
1168
|
+
return new Handlebars.SafeString(cleanHtml);
|
|
1169
|
+
});
|
|
1170
|
+
};
|
|
1171
|
+
|
|
1172
|
+
var stringPlugin = function (handlebars) {
|
|
1173
|
+
handlebars.registerHelper('subString', function (passedString, start, end) {
|
|
1174
|
+
var theString =
|
|
1175
|
+
passedString === null || passedString === void 0
|
|
1176
|
+
? void 0
|
|
1177
|
+
: passedString.substring(start, end);
|
|
1178
|
+
return new Handlebars.SafeString(
|
|
1179
|
+
theString !== null && theString !== void 0 ? theString : ''
|
|
1180
|
+
);
|
|
1181
|
+
});
|
|
1182
|
+
};
|
|
1183
|
+
|
|
1184
|
+
function _class_call_check(instance, Constructor) {
|
|
1185
|
+
if (!(instance instanceof Constructor)) {
|
|
1186
|
+
throw new TypeError('Cannot call a class as a function');
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
function _defineProperties(target, props) {
|
|
1190
|
+
for (var i = 0; i < props.length; i++) {
|
|
1191
|
+
var descriptor = props[i];
|
|
1192
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1193
|
+
descriptor.configurable = true;
|
|
1194
|
+
if ('value' in descriptor) descriptor.writable = true;
|
|
1195
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
1199
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
1200
|
+
return Constructor;
|
|
1201
|
+
}
|
|
1202
|
+
function _define_property(obj, key, value) {
|
|
1203
|
+
if (key in obj) {
|
|
1204
|
+
Object.defineProperty(obj, key, {
|
|
1205
|
+
value: value,
|
|
1206
|
+
enumerable: true,
|
|
1207
|
+
configurable: true,
|
|
1208
|
+
writable: true,
|
|
1209
|
+
});
|
|
1210
|
+
} else {
|
|
1211
|
+
obj[key] = value;
|
|
1212
|
+
}
|
|
1213
|
+
return obj;
|
|
1214
|
+
}
|
|
1215
|
+
function _instanceof(left, right) {
|
|
1216
|
+
if (
|
|
1217
|
+
right != null &&
|
|
1218
|
+
typeof Symbol !== 'undefined' &&
|
|
1219
|
+
right[Symbol.hasInstance]
|
|
1220
|
+
) {
|
|
1221
|
+
return !!right[Symbol.hasInstance](left);
|
|
1222
|
+
} else {
|
|
1223
|
+
return left instanceof right;
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
var DateFormatter = /*#__PURE__*/ (function () {
|
|
1227
|
+
function DateFormatter() {
|
|
1228
|
+
_class_call_check(this, DateFormatter);
|
|
1229
|
+
}
|
|
1230
|
+
_create_class(DateFormatter, null, [
|
|
1231
|
+
{
|
|
1232
|
+
key: 'format',
|
|
1233
|
+
value: function format(date) {
|
|
1234
|
+
var validDate;
|
|
1235
|
+
if (typeof date === 'string') {
|
|
1236
|
+
validDate = new Date(date);
|
|
1237
|
+
} else {
|
|
1238
|
+
validDate = date;
|
|
1239
|
+
}
|
|
1240
|
+
return new Intl.DateTimeFormat('de-DE', {
|
|
1241
|
+
day: '2-digit',
|
|
1242
|
+
month: '2-digit',
|
|
1243
|
+
year: 'numeric',
|
|
1244
|
+
hour: '2-digit',
|
|
1245
|
+
minute: '2-digit',
|
|
1246
|
+
}).format(validDate);
|
|
1247
|
+
},
|
|
1248
|
+
},
|
|
1249
|
+
{
|
|
1250
|
+
key: 'formatFormal',
|
|
1251
|
+
value: function formatFormal(date) {
|
|
1252
|
+
var validDate;
|
|
1253
|
+
if (typeof date === 'string') {
|
|
1254
|
+
validDate = new Date(date);
|
|
1255
|
+
} else if (_instanceof(date, Date)) {
|
|
1256
|
+
validDate = date;
|
|
1257
|
+
} else {
|
|
1258
|
+
return 'INVALID '.concat(date);
|
|
1259
|
+
}
|
|
1260
|
+
return new Intl.DateTimeFormat('de-DE', {
|
|
1261
|
+
day: '2-digit',
|
|
1262
|
+
month: '2-digit',
|
|
1263
|
+
year: 'numeric',
|
|
1264
|
+
}).format(validDate);
|
|
1265
|
+
},
|
|
1266
|
+
},
|
|
1267
|
+
{
|
|
1268
|
+
key: 'formatMini',
|
|
1269
|
+
value: function formatMini(date) {
|
|
1270
|
+
var validDate;
|
|
1271
|
+
if (typeof date === 'string') {
|
|
1272
|
+
validDate = new Date(date);
|
|
1273
|
+
} else if (_instanceof(date, Date)) {
|
|
1274
|
+
validDate = date;
|
|
1275
|
+
} else {
|
|
1276
|
+
throw new RangeError('Invalid time value: ' + date);
|
|
1277
|
+
}
|
|
1278
|
+
return new Intl.DateTimeFormat('de-DE', {
|
|
1279
|
+
day: 'numeric',
|
|
1280
|
+
month: 'long',
|
|
1281
|
+
year: 'numeric',
|
|
1282
|
+
}).format(validDate);
|
|
1283
|
+
},
|
|
1284
|
+
},
|
|
1285
|
+
]);
|
|
1286
|
+
return DateFormatter;
|
|
1287
|
+
})();
|
|
1288
|
+
_define_property(
|
|
1289
|
+
DateFormatter,
|
|
1290
|
+
'getZoneAdjustedWeekday',
|
|
1291
|
+
function (dateString, options) {
|
|
1292
|
+
var timezone = options.timezone;
|
|
1293
|
+
return new Date(dateString).toLocaleDateString(options.locale, {
|
|
1294
|
+
weekday: 'long',
|
|
1295
|
+
timeZone: timezone,
|
|
1296
|
+
});
|
|
1297
|
+
}
|
|
1298
|
+
);
|
|
1299
|
+
_define_property(
|
|
1300
|
+
DateFormatter,
|
|
1301
|
+
'getZoneAdjustedDate',
|
|
1302
|
+
function (dateString, options) {
|
|
1303
|
+
var timezone = options.timezone;
|
|
1304
|
+
return new Date(dateString).toLocaleDateString(options.locale, {
|
|
1305
|
+
month: 'long',
|
|
1306
|
+
day: 'numeric',
|
|
1307
|
+
timeZone: timezone,
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
);
|
|
1311
|
+
_define_property(
|
|
1312
|
+
DateFormatter,
|
|
1313
|
+
'getZoneAdjustedTime',
|
|
1314
|
+
function (dateString, options) {
|
|
1315
|
+
var timezone = options.timezone;
|
|
1316
|
+
return new Date(dateString)
|
|
1317
|
+
.toLocaleTimeString(options.locale, {
|
|
1318
|
+
hour: '2-digit',
|
|
1319
|
+
minute: '2-digit',
|
|
1320
|
+
hour12: false,
|
|
1321
|
+
timeZone: timezone,
|
|
1322
|
+
})
|
|
1323
|
+
.replace(/^0/, '');
|
|
1324
|
+
}
|
|
1325
|
+
);
|
|
1326
|
+
|
|
1327
|
+
var timezonePlugin = function (handlebars, param) {
|
|
1328
|
+
var timezone = param.timezone,
|
|
1329
|
+
locale = param.locale;
|
|
1330
|
+
handlebars.registerHelper('getZoneAdjustedWeekday', function (dateString) {
|
|
1331
|
+
return DateFormatter.getZoneAdjustedWeekday(dateString, {
|
|
1332
|
+
timezone: timezone,
|
|
1333
|
+
locale: locale,
|
|
1334
|
+
});
|
|
1335
|
+
});
|
|
1336
|
+
handlebars.registerHelper('getZoneAdjustedDate', function (dateString) {
|
|
1337
|
+
return DateFormatter.getZoneAdjustedDate(dateString, {
|
|
1338
|
+
timezone: timezone,
|
|
1339
|
+
locale: locale,
|
|
1340
|
+
});
|
|
1341
|
+
});
|
|
1342
|
+
handlebars.registerHelper('getZoneAdjustedTime', function (dateString) {
|
|
1343
|
+
return DateFormatter.getZoneAdjustedTime(dateString, {
|
|
1344
|
+
timezone: timezone,
|
|
1345
|
+
locale: locale,
|
|
1346
|
+
});
|
|
1347
|
+
});
|
|
1348
|
+
};
|
|
1349
|
+
|
|
1350
|
+
var urlPlugin = function (handlebars) {
|
|
1351
|
+
handlebars.registerHelper('urlSafe', function (inputString) {
|
|
1352
|
+
return encodeURIComponent(String(inputString));
|
|
1353
|
+
});
|
|
1354
|
+
};
|
|
1355
|
+
|
|
1356
|
+
var userTimezonePlugin = function (handlebars, param) {
|
|
1357
|
+
var timezone = param.timezone,
|
|
1358
|
+
locale = param.locale;
|
|
1359
|
+
handlebars.registerHelper(
|
|
1360
|
+
'getUserZoneAdjustedWeekday',
|
|
1361
|
+
function (dateString, options) {
|
|
1362
|
+
var _options_hash, _options_hash1;
|
|
1363
|
+
var _options_hash_timezone, _options_hash_locale;
|
|
1364
|
+
return DateFormatter.getZoneAdjustedWeekday(dateString, {
|
|
1365
|
+
timezone:
|
|
1366
|
+
(_options_hash_timezone =
|
|
1367
|
+
options === null || options === void 0
|
|
1368
|
+
? void 0
|
|
1369
|
+
: (_options_hash = options.hash) === null ||
|
|
1370
|
+
_options_hash === void 0
|
|
1371
|
+
? void 0
|
|
1372
|
+
: _options_hash.timezone) !== null &&
|
|
1373
|
+
_options_hash_timezone !== void 0
|
|
1374
|
+
? _options_hash_timezone
|
|
1375
|
+
: timezone,
|
|
1376
|
+
locale:
|
|
1377
|
+
(_options_hash_locale =
|
|
1378
|
+
options === null || options === void 0
|
|
1379
|
+
? void 0
|
|
1380
|
+
: (_options_hash1 = options.hash) === null ||
|
|
1381
|
+
_options_hash1 === void 0
|
|
1382
|
+
? void 0
|
|
1383
|
+
: _options_hash1.locale) !== null &&
|
|
1384
|
+
_options_hash_locale !== void 0
|
|
1385
|
+
? _options_hash_locale
|
|
1386
|
+
: locale,
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
);
|
|
1390
|
+
handlebars.registerHelper(
|
|
1391
|
+
'getUserZoneAdjustedDate',
|
|
1392
|
+
function (dateString, options) {
|
|
1393
|
+
var _options_hash, _options_hash1;
|
|
1394
|
+
var _options_hash_timezone, _options_hash_locale;
|
|
1395
|
+
return DateFormatter.getZoneAdjustedDate(dateString, {
|
|
1396
|
+
timezone:
|
|
1397
|
+
(_options_hash_timezone =
|
|
1398
|
+
options === null || options === void 0
|
|
1399
|
+
? void 0
|
|
1400
|
+
: (_options_hash = options.hash) === null ||
|
|
1401
|
+
_options_hash === void 0
|
|
1402
|
+
? void 0
|
|
1403
|
+
: _options_hash.timezone) !== null &&
|
|
1404
|
+
_options_hash_timezone !== void 0
|
|
1405
|
+
? _options_hash_timezone
|
|
1406
|
+
: timezone,
|
|
1407
|
+
locale:
|
|
1408
|
+
(_options_hash_locale =
|
|
1409
|
+
options === null || options === void 0
|
|
1410
|
+
? void 0
|
|
1411
|
+
: (_options_hash1 = options.hash) === null ||
|
|
1412
|
+
_options_hash1 === void 0
|
|
1413
|
+
? void 0
|
|
1414
|
+
: _options_hash1.locale) !== null &&
|
|
1415
|
+
_options_hash_locale !== void 0
|
|
1416
|
+
? _options_hash_locale
|
|
1417
|
+
: locale,
|
|
1418
|
+
});
|
|
1419
|
+
}
|
|
1420
|
+
);
|
|
1421
|
+
handlebars.registerHelper(
|
|
1422
|
+
'getUserZoneAdjustedTime',
|
|
1423
|
+
function (dateString, options) {
|
|
1424
|
+
var _options_hash, _options_hash1;
|
|
1425
|
+
var _options_hash_timezone, _options_hash_locale;
|
|
1426
|
+
return DateFormatter.getZoneAdjustedTime(dateString, {
|
|
1427
|
+
timezone:
|
|
1428
|
+
(_options_hash_timezone =
|
|
1429
|
+
options === null || options === void 0
|
|
1430
|
+
? void 0
|
|
1431
|
+
: (_options_hash = options.hash) === null ||
|
|
1432
|
+
_options_hash === void 0
|
|
1433
|
+
? void 0
|
|
1434
|
+
: _options_hash.timezone) !== null &&
|
|
1435
|
+
_options_hash_timezone !== void 0
|
|
1436
|
+
? _options_hash_timezone
|
|
1437
|
+
: timezone,
|
|
1438
|
+
locale:
|
|
1439
|
+
(_options_hash_locale =
|
|
1440
|
+
options === null || options === void 0
|
|
1441
|
+
? void 0
|
|
1442
|
+
: (_options_hash1 = options.hash) === null ||
|
|
1443
|
+
_options_hash1 === void 0
|
|
1444
|
+
? void 0
|
|
1445
|
+
: _options_hash1.locale) !== null &&
|
|
1446
|
+
_options_hash_locale !== void 0
|
|
1447
|
+
? _options_hash_locale
|
|
1448
|
+
: locale,
|
|
1449
|
+
});
|
|
1450
|
+
}
|
|
1451
|
+
);
|
|
1452
|
+
};
|
|
835
1453
|
|
|
836
1454
|
export {
|
|
837
1455
|
CookieHelper,
|
|
1456
|
+
DateFormatter,
|
|
838
1457
|
HttpHandler,
|
|
839
1458
|
NativeException,
|
|
1459
|
+
PatternCompiler,
|
|
840
1460
|
PgException,
|
|
841
1461
|
PostgresError,
|
|
1462
|
+
eqPlugin,
|
|
842
1463
|
logger,
|
|
1464
|
+
markdownPlugin,
|
|
1465
|
+
parseTemplate,
|
|
1466
|
+
stringPlugin,
|
|
1467
|
+
timezonePlugin,
|
|
1468
|
+
urlPlugin,
|
|
1469
|
+
userTimezonePlugin,
|
|
843
1470
|
};
|