@kosatyi/ejs 0.0.101 → 0.0.103
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/dist/cjs/browser.js +8 -5
- package/dist/cjs/index.js +8 -5
- package/dist/cjs/worker.js +8 -5
- package/dist/esm/browser.js +20 -11
- package/dist/esm/index.js +20 -11
- package/dist/esm/worker.js +20 -11
- package/dist/umd/browser.js +8 -5
- package/dist/umd/browser.min.js +1 -1
- package/dist/umd/index.js +8 -5
- package/dist/umd/index.min.js +1 -1
- package/dist/umd/worker.js +8 -5
- package/dist/umd/worker.min.js +1 -1
- package/package.json +1 -1
- package/types/ejs.d.ts +2 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -396,7 +396,9 @@ var Cache = /*#__PURE__*/function () {
|
|
|
396
396
|
}, {
|
|
397
397
|
key: "exist",
|
|
398
398
|
value: function exist(key) {
|
|
399
|
-
|
|
399
|
+
if (_classPrivateFieldGet2(_enabled, this)) {
|
|
400
|
+
return hasProp(_classPrivateFieldGet2(_list, this), key);
|
|
401
|
+
}
|
|
400
402
|
}
|
|
401
403
|
}, {
|
|
402
404
|
key: "clear",
|
|
@@ -509,7 +511,7 @@ var Compiler = /*#__PURE__*/function () {
|
|
|
509
511
|
source = "".concat(BUFFER, ".start();").concat(source, "return ").concat(BUFFER, ".end();");
|
|
510
512
|
source += "\n//# sourceURL=".concat(path);
|
|
511
513
|
var result = null;
|
|
512
|
-
var params = [SCOPE,
|
|
514
|
+
var params = [SCOPE, COMPONENT, ELEMENT, BUFFER, SAFE].concat(GLOBALS);
|
|
513
515
|
try {
|
|
514
516
|
result = Function.apply(null, params.concat(source));
|
|
515
517
|
result.source = "(function(".concat(params.join(','), "){\n").concat(source, "\n});");
|
|
@@ -1142,13 +1144,14 @@ var EJS = /*#__PURE__*/function () {
|
|
|
1142
1144
|
function _output(path, scope) {
|
|
1143
1145
|
var _classPrivateFieldGet2$1 = _classPrivateFieldGet2(_config, this),
|
|
1144
1146
|
globalHelpers = _classPrivateFieldGet2$1.globalHelpers;
|
|
1145
|
-
var params = [scope, scope.
|
|
1147
|
+
var params = [scope, scope.useComponent, scope.useElement, scope.getBuffer(), scope.useSafeValue];
|
|
1148
|
+
var globals = globalHelpers.filter(function (name) {
|
|
1146
1149
|
return isFunction(scope[name]);
|
|
1147
1150
|
}).map(function (name) {
|
|
1148
1151
|
return scope[name].bind(scope);
|
|
1149
|
-
})
|
|
1152
|
+
});
|
|
1150
1153
|
return _classPrivateFieldGet2(_template, this).get(path).then(function (callback) {
|
|
1151
|
-
return callback.apply(scope, params);
|
|
1154
|
+
return callback.apply(scope, params.concat(globals));
|
|
1152
1155
|
});
|
|
1153
1156
|
}
|
|
1154
1157
|
|
package/dist/cjs/index.js
CHANGED
|
@@ -399,7 +399,9 @@ var Cache = /*#__PURE__*/function () {
|
|
|
399
399
|
}, {
|
|
400
400
|
key: "exist",
|
|
401
401
|
value: function exist(key) {
|
|
402
|
-
|
|
402
|
+
if (_classPrivateFieldGet2(_enabled, this)) {
|
|
403
|
+
return hasProp(_classPrivateFieldGet2(_list, this), key);
|
|
404
|
+
}
|
|
403
405
|
}
|
|
404
406
|
}, {
|
|
405
407
|
key: "clear",
|
|
@@ -512,7 +514,7 @@ var Compiler = /*#__PURE__*/function () {
|
|
|
512
514
|
source = "".concat(BUFFER, ".start();").concat(source, "return ").concat(BUFFER, ".end();");
|
|
513
515
|
source += "\n//# sourceURL=".concat(path);
|
|
514
516
|
var result = null;
|
|
515
|
-
var params = [SCOPE,
|
|
517
|
+
var params = [SCOPE, COMPONENT, ELEMENT, BUFFER, SAFE].concat(GLOBALS);
|
|
516
518
|
try {
|
|
517
519
|
result = Function.apply(null, params.concat(source));
|
|
518
520
|
result.source = "(function(".concat(params.join(','), "){\n").concat(source, "\n});");
|
|
@@ -1145,13 +1147,14 @@ var EJS = /*#__PURE__*/function () {
|
|
|
1145
1147
|
function _output(path, scope) {
|
|
1146
1148
|
var _classPrivateFieldGet2$1 = _classPrivateFieldGet2(_config, this),
|
|
1147
1149
|
globalHelpers = _classPrivateFieldGet2$1.globalHelpers;
|
|
1148
|
-
var params = [scope, scope.
|
|
1150
|
+
var params = [scope, scope.useComponent, scope.useElement, scope.getBuffer(), scope.useSafeValue];
|
|
1151
|
+
var globals = globalHelpers.filter(function (name) {
|
|
1149
1152
|
return isFunction(scope[name]);
|
|
1150
1153
|
}).map(function (name) {
|
|
1151
1154
|
return scope[name].bind(scope);
|
|
1152
|
-
})
|
|
1155
|
+
});
|
|
1153
1156
|
return _classPrivateFieldGet2(_template, this).get(path).then(function (callback) {
|
|
1154
|
-
return callback.apply(scope, params);
|
|
1157
|
+
return callback.apply(scope, params.concat(globals));
|
|
1155
1158
|
});
|
|
1156
1159
|
}
|
|
1157
1160
|
|
package/dist/cjs/worker.js
CHANGED
|
@@ -717,7 +717,9 @@ var Cache = /*#__PURE__*/function () {
|
|
|
717
717
|
}, {
|
|
718
718
|
key: "exist",
|
|
719
719
|
value: function exist(key) {
|
|
720
|
-
|
|
720
|
+
if (_classPrivateFieldGet2(_enabled, this)) {
|
|
721
|
+
return hasProp(_classPrivateFieldGet2(_list, this), key);
|
|
722
|
+
}
|
|
721
723
|
}
|
|
722
724
|
}, {
|
|
723
725
|
key: "clear",
|
|
@@ -830,7 +832,7 @@ var Compiler = /*#__PURE__*/function () {
|
|
|
830
832
|
source = "".concat(BUFFER, ".start();").concat(source, "return ").concat(BUFFER, ".end();");
|
|
831
833
|
source += "\n//# sourceURL=".concat(path);
|
|
832
834
|
var result = null;
|
|
833
|
-
var params = [SCOPE,
|
|
835
|
+
var params = [SCOPE, COMPONENT, ELEMENT, BUFFER, SAFE].concat(GLOBALS);
|
|
834
836
|
try {
|
|
835
837
|
result = Function.apply(null, params.concat(source));
|
|
836
838
|
result.source = "(function(".concat(params.join(','), "){\n").concat(source, "\n});");
|
|
@@ -1463,13 +1465,14 @@ var EJS = /*#__PURE__*/function () {
|
|
|
1463
1465
|
function _output(path, scope) {
|
|
1464
1466
|
var _classPrivateFieldGet2$1 = _classPrivateFieldGet2(_config, this),
|
|
1465
1467
|
globalHelpers = _classPrivateFieldGet2$1.globalHelpers;
|
|
1466
|
-
var params = [scope, scope.
|
|
1468
|
+
var params = [scope, scope.useComponent, scope.useElement, scope.getBuffer(), scope.useSafeValue];
|
|
1469
|
+
var globals = globalHelpers.filter(function (name) {
|
|
1467
1470
|
return isFunction(scope[name]);
|
|
1468
1471
|
}).map(function (name) {
|
|
1469
1472
|
return scope[name].bind(scope);
|
|
1470
|
-
})
|
|
1473
|
+
});
|
|
1471
1474
|
return _classPrivateFieldGet2(_template, this).get(path).then(function (callback) {
|
|
1472
|
-
return callback.apply(scope, params);
|
|
1475
|
+
return callback.apply(scope, params.concat(globals));
|
|
1473
1476
|
});
|
|
1474
1477
|
}
|
|
1475
1478
|
|
package/dist/esm/browser.js
CHANGED
|
@@ -298,7 +298,9 @@ class Cache {
|
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
exist(key) {
|
|
301
|
-
|
|
301
|
+
if (this.#enabled) {
|
|
302
|
+
return hasProp(this.#list, key)
|
|
303
|
+
}
|
|
302
304
|
}
|
|
303
305
|
clear() {
|
|
304
306
|
this.#list = {};
|
|
@@ -415,7 +417,7 @@ class Compiler {
|
|
|
415
417
|
source = `${BUFFER}.start();${source}return ${BUFFER}.end();`;
|
|
416
418
|
source += `\n//# sourceURL=${path}`;
|
|
417
419
|
let result = null;
|
|
418
|
-
let params = [SCOPE,
|
|
420
|
+
let params = [SCOPE, COMPONENT, ELEMENT, BUFFER, SAFE].concat(GLOBALS);
|
|
419
421
|
try {
|
|
420
422
|
result = Function.apply(null, params.concat(source));
|
|
421
423
|
result.source = `(function(${params.join(',')}){\n${source}\n});`;
|
|
@@ -700,7 +702,6 @@ const createContextScope = (config, methods) => {
|
|
|
700
702
|
return this[BLOCKS]
|
|
701
703
|
}
|
|
702
704
|
},
|
|
703
|
-
|
|
704
705
|
/** @type {function} */
|
|
705
706
|
setExtend: {
|
|
706
707
|
value(value) {
|
|
@@ -947,37 +948,45 @@ class EJS {
|
|
|
947
948
|
this.#template.configure(this.#config);
|
|
948
949
|
return this.#config
|
|
949
950
|
}
|
|
951
|
+
|
|
950
952
|
filePath(name) {
|
|
951
953
|
return ext(name, this.#config.extension)
|
|
952
954
|
}
|
|
955
|
+
|
|
953
956
|
require(name) {
|
|
954
957
|
const scope = this.context({});
|
|
955
958
|
return this.#output(this.filePath(name), scope).then(() => scope.getMacro())
|
|
956
959
|
}
|
|
960
|
+
|
|
957
961
|
render(name, data) {
|
|
958
962
|
const scope = this.context(data);
|
|
959
|
-
return this.#output(this.filePath(name), scope).then(this.outputContent(name,scope))
|
|
963
|
+
return this.#output(this.filePath(name), scope).then(this.outputContent(name, scope))
|
|
960
964
|
}
|
|
961
|
-
|
|
965
|
+
|
|
966
|
+
outputContent(name, scope) {
|
|
962
967
|
return (content) => {
|
|
963
968
|
if (scope.getExtend()) {
|
|
964
969
|
scope.setExtend(false);
|
|
965
|
-
return this.renderLayout(scope.getLayout(),scope,name)
|
|
970
|
+
return this.renderLayout(scope.getLayout(), scope, name)
|
|
966
971
|
}
|
|
967
972
|
return content
|
|
968
973
|
}
|
|
969
974
|
}
|
|
975
|
+
|
|
970
976
|
renderLayout(name, data, parent) {
|
|
971
977
|
const scope = this.context(data);
|
|
972
978
|
if (parent) scope.setParentTemplate(parent);
|
|
973
|
-
return this.#output(this.filePath(name), scope).then(this.outputContent(name,scope))
|
|
979
|
+
return this.#output(this.filePath(name), scope).then(this.outputContent(name, scope))
|
|
974
980
|
}
|
|
981
|
+
|
|
975
982
|
helpers(methods) {
|
|
976
983
|
this.#context.helpers(extend(this.#extend, methods));
|
|
977
984
|
}
|
|
985
|
+
|
|
978
986
|
context(data) {
|
|
979
987
|
return this.#context.create(data)
|
|
980
988
|
}
|
|
989
|
+
|
|
981
990
|
compile(content, path) {
|
|
982
991
|
return this.#compiler.compile(content, path)
|
|
983
992
|
}
|
|
@@ -990,15 +999,15 @@ class EJS {
|
|
|
990
999
|
return new this.constructor(options)
|
|
991
1000
|
}
|
|
992
1001
|
|
|
993
|
-
|
|
994
1002
|
#output(path, scope) {
|
|
995
1003
|
const { globalHelpers } = this.#config;
|
|
996
|
-
const params = [scope, scope.
|
|
1004
|
+
const params = [scope, scope.useComponent, scope.useElement, scope.getBuffer(), scope.useSafeValue];
|
|
1005
|
+
const globals = globalHelpers
|
|
997
1006
|
.filter((name) => isFunction(scope[name]))
|
|
998
|
-
.map((name) => scope[name].bind(scope))
|
|
1007
|
+
.map((name) => scope[name].bind(scope));
|
|
999
1008
|
return this.#template
|
|
1000
1009
|
.get(path)
|
|
1001
|
-
.then((callback) => callback.apply(scope, params))
|
|
1010
|
+
.then((callback) => callback.apply(scope, params.concat(globals)))
|
|
1002
1011
|
}
|
|
1003
1012
|
}
|
|
1004
1013
|
|
package/dist/esm/index.js
CHANGED
|
@@ -301,7 +301,9 @@ class Cache {
|
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
303
|
exist(key) {
|
|
304
|
-
|
|
304
|
+
if (this.#enabled) {
|
|
305
|
+
return hasProp(this.#list, key)
|
|
306
|
+
}
|
|
305
307
|
}
|
|
306
308
|
clear() {
|
|
307
309
|
this.#list = {};
|
|
@@ -418,7 +420,7 @@ class Compiler {
|
|
|
418
420
|
source = `${BUFFER}.start();${source}return ${BUFFER}.end();`;
|
|
419
421
|
source += `\n//# sourceURL=${path}`;
|
|
420
422
|
let result = null;
|
|
421
|
-
let params = [SCOPE,
|
|
423
|
+
let params = [SCOPE, COMPONENT, ELEMENT, BUFFER, SAFE].concat(GLOBALS);
|
|
422
424
|
try {
|
|
423
425
|
result = Function.apply(null, params.concat(source));
|
|
424
426
|
result.source = `(function(${params.join(',')}){\n${source}\n});`;
|
|
@@ -703,7 +705,6 @@ const createContextScope = (config, methods) => {
|
|
|
703
705
|
return this[BLOCKS]
|
|
704
706
|
}
|
|
705
707
|
},
|
|
706
|
-
|
|
707
708
|
/** @type {function} */
|
|
708
709
|
setExtend: {
|
|
709
710
|
value(value) {
|
|
@@ -950,37 +951,45 @@ class EJS {
|
|
|
950
951
|
this.#template.configure(this.#config);
|
|
951
952
|
return this.#config
|
|
952
953
|
}
|
|
954
|
+
|
|
953
955
|
filePath(name) {
|
|
954
956
|
return ext(name, this.#config.extension)
|
|
955
957
|
}
|
|
958
|
+
|
|
956
959
|
require(name) {
|
|
957
960
|
const scope = this.context({});
|
|
958
961
|
return this.#output(this.filePath(name), scope).then(() => scope.getMacro())
|
|
959
962
|
}
|
|
963
|
+
|
|
960
964
|
render(name, data) {
|
|
961
965
|
const scope = this.context(data);
|
|
962
|
-
return this.#output(this.filePath(name), scope).then(this.outputContent(name,scope))
|
|
966
|
+
return this.#output(this.filePath(name), scope).then(this.outputContent(name, scope))
|
|
963
967
|
}
|
|
964
|
-
|
|
968
|
+
|
|
969
|
+
outputContent(name, scope) {
|
|
965
970
|
return (content) => {
|
|
966
971
|
if (scope.getExtend()) {
|
|
967
972
|
scope.setExtend(false);
|
|
968
|
-
return this.renderLayout(scope.getLayout(),scope,name)
|
|
973
|
+
return this.renderLayout(scope.getLayout(), scope, name)
|
|
969
974
|
}
|
|
970
975
|
return content
|
|
971
976
|
}
|
|
972
977
|
}
|
|
978
|
+
|
|
973
979
|
renderLayout(name, data, parent) {
|
|
974
980
|
const scope = this.context(data);
|
|
975
981
|
if (parent) scope.setParentTemplate(parent);
|
|
976
|
-
return this.#output(this.filePath(name), scope).then(this.outputContent(name,scope))
|
|
982
|
+
return this.#output(this.filePath(name), scope).then(this.outputContent(name, scope))
|
|
977
983
|
}
|
|
984
|
+
|
|
978
985
|
helpers(methods) {
|
|
979
986
|
this.#context.helpers(extend(this.#extend, methods));
|
|
980
987
|
}
|
|
988
|
+
|
|
981
989
|
context(data) {
|
|
982
990
|
return this.#context.create(data)
|
|
983
991
|
}
|
|
992
|
+
|
|
984
993
|
compile(content, path) {
|
|
985
994
|
return this.#compiler.compile(content, path)
|
|
986
995
|
}
|
|
@@ -993,15 +1002,15 @@ class EJS {
|
|
|
993
1002
|
return new this.constructor(options)
|
|
994
1003
|
}
|
|
995
1004
|
|
|
996
|
-
|
|
997
1005
|
#output(path, scope) {
|
|
998
1006
|
const { globalHelpers } = this.#config;
|
|
999
|
-
const params = [scope, scope.
|
|
1007
|
+
const params = [scope, scope.useComponent, scope.useElement, scope.getBuffer(), scope.useSafeValue];
|
|
1008
|
+
const globals = globalHelpers
|
|
1000
1009
|
.filter((name) => isFunction(scope[name]))
|
|
1001
|
-
.map((name) => scope[name].bind(scope))
|
|
1010
|
+
.map((name) => scope[name].bind(scope));
|
|
1002
1011
|
return this.#template
|
|
1003
1012
|
.get(path)
|
|
1004
|
-
.then((callback) => callback.apply(scope, params))
|
|
1013
|
+
.then((callback) => callback.apply(scope, params.concat(globals)))
|
|
1005
1014
|
}
|
|
1006
1015
|
}
|
|
1007
1016
|
|
package/dist/esm/worker.js
CHANGED
|
@@ -292,7 +292,9 @@ class Cache {
|
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
exist(key) {
|
|
295
|
-
|
|
295
|
+
if (this.#enabled) {
|
|
296
|
+
return hasProp(this.#list, key)
|
|
297
|
+
}
|
|
296
298
|
}
|
|
297
299
|
clear() {
|
|
298
300
|
this.#list = {};
|
|
@@ -409,7 +411,7 @@ class Compiler {
|
|
|
409
411
|
source = `${BUFFER}.start();${source}return ${BUFFER}.end();`;
|
|
410
412
|
source += `\n//# sourceURL=${path}`;
|
|
411
413
|
let result = null;
|
|
412
|
-
let params = [SCOPE,
|
|
414
|
+
let params = [SCOPE, COMPONENT, ELEMENT, BUFFER, SAFE].concat(GLOBALS);
|
|
413
415
|
try {
|
|
414
416
|
result = Function.apply(null, params.concat(source));
|
|
415
417
|
result.source = `(function(${params.join(',')}){\n${source}\n});`;
|
|
@@ -694,7 +696,6 @@ const createContextScope = (config, methods) => {
|
|
|
694
696
|
return this[BLOCKS]
|
|
695
697
|
}
|
|
696
698
|
},
|
|
697
|
-
|
|
698
699
|
/** @type {function} */
|
|
699
700
|
setExtend: {
|
|
700
701
|
value(value) {
|
|
@@ -941,37 +942,45 @@ class EJS {
|
|
|
941
942
|
this.#template.configure(this.#config);
|
|
942
943
|
return this.#config
|
|
943
944
|
}
|
|
945
|
+
|
|
944
946
|
filePath(name) {
|
|
945
947
|
return ext(name, this.#config.extension)
|
|
946
948
|
}
|
|
949
|
+
|
|
947
950
|
require(name) {
|
|
948
951
|
const scope = this.context({});
|
|
949
952
|
return this.#output(this.filePath(name), scope).then(() => scope.getMacro())
|
|
950
953
|
}
|
|
954
|
+
|
|
951
955
|
render(name, data) {
|
|
952
956
|
const scope = this.context(data);
|
|
953
|
-
return this.#output(this.filePath(name), scope).then(this.outputContent(name,scope))
|
|
957
|
+
return this.#output(this.filePath(name), scope).then(this.outputContent(name, scope))
|
|
954
958
|
}
|
|
955
|
-
|
|
959
|
+
|
|
960
|
+
outputContent(name, scope) {
|
|
956
961
|
return (content) => {
|
|
957
962
|
if (scope.getExtend()) {
|
|
958
963
|
scope.setExtend(false);
|
|
959
|
-
return this.renderLayout(scope.getLayout(),scope,name)
|
|
964
|
+
return this.renderLayout(scope.getLayout(), scope, name)
|
|
960
965
|
}
|
|
961
966
|
return content
|
|
962
967
|
}
|
|
963
968
|
}
|
|
969
|
+
|
|
964
970
|
renderLayout(name, data, parent) {
|
|
965
971
|
const scope = this.context(data);
|
|
966
972
|
if (parent) scope.setParentTemplate(parent);
|
|
967
|
-
return this.#output(this.filePath(name), scope).then(this.outputContent(name,scope))
|
|
973
|
+
return this.#output(this.filePath(name), scope).then(this.outputContent(name, scope))
|
|
968
974
|
}
|
|
975
|
+
|
|
969
976
|
helpers(methods) {
|
|
970
977
|
this.#context.helpers(extend(this.#extend, methods));
|
|
971
978
|
}
|
|
979
|
+
|
|
972
980
|
context(data) {
|
|
973
981
|
return this.#context.create(data)
|
|
974
982
|
}
|
|
983
|
+
|
|
975
984
|
compile(content, path) {
|
|
976
985
|
return this.#compiler.compile(content, path)
|
|
977
986
|
}
|
|
@@ -984,15 +993,15 @@ class EJS {
|
|
|
984
993
|
return new this.constructor(options)
|
|
985
994
|
}
|
|
986
995
|
|
|
987
|
-
|
|
988
996
|
#output(path, scope) {
|
|
989
997
|
const { globalHelpers } = this.#config;
|
|
990
|
-
const params = [scope, scope.
|
|
998
|
+
const params = [scope, scope.useComponent, scope.useElement, scope.getBuffer(), scope.useSafeValue];
|
|
999
|
+
const globals = globalHelpers
|
|
991
1000
|
.filter((name) => isFunction(scope[name]))
|
|
992
|
-
.map((name) => scope[name].bind(scope))
|
|
1001
|
+
.map((name) => scope[name].bind(scope));
|
|
993
1002
|
return this.#template
|
|
994
1003
|
.get(path)
|
|
995
|
-
.then((callback) => callback.apply(scope, params))
|
|
1004
|
+
.then((callback) => callback.apply(scope, params.concat(globals)))
|
|
996
1005
|
}
|
|
997
1006
|
}
|
|
998
1007
|
|
package/dist/umd/browser.js
CHANGED
|
@@ -400,7 +400,9 @@
|
|
|
400
400
|
}, {
|
|
401
401
|
key: "exist",
|
|
402
402
|
value: function exist(key) {
|
|
403
|
-
|
|
403
|
+
if (_classPrivateFieldGet2(_enabled, this)) {
|
|
404
|
+
return hasProp(_classPrivateFieldGet2(_list, this), key);
|
|
405
|
+
}
|
|
404
406
|
}
|
|
405
407
|
}, {
|
|
406
408
|
key: "clear",
|
|
@@ -513,7 +515,7 @@
|
|
|
513
515
|
source = "".concat(BUFFER, ".start();").concat(source, "return ").concat(BUFFER, ".end();");
|
|
514
516
|
source += "\n//# sourceURL=".concat(path);
|
|
515
517
|
var result = null;
|
|
516
|
-
var params = [SCOPE,
|
|
518
|
+
var params = [SCOPE, COMPONENT, ELEMENT, BUFFER, SAFE].concat(GLOBALS);
|
|
517
519
|
try {
|
|
518
520
|
result = Function.apply(null, params.concat(source));
|
|
519
521
|
result.source = "(function(".concat(params.join(','), "){\n").concat(source, "\n});");
|
|
@@ -1146,13 +1148,14 @@
|
|
|
1146
1148
|
function _output(path, scope) {
|
|
1147
1149
|
var _classPrivateFieldGet2$1 = _classPrivateFieldGet2(_config, this),
|
|
1148
1150
|
globalHelpers = _classPrivateFieldGet2$1.globalHelpers;
|
|
1149
|
-
var params = [scope, scope.
|
|
1151
|
+
var params = [scope, scope.useComponent, scope.useElement, scope.getBuffer(), scope.useSafeValue];
|
|
1152
|
+
var globals = globalHelpers.filter(function (name) {
|
|
1150
1153
|
return isFunction(scope[name]);
|
|
1151
1154
|
}).map(function (name) {
|
|
1152
1155
|
return scope[name].bind(scope);
|
|
1153
|
-
})
|
|
1156
|
+
});
|
|
1154
1157
|
return _classPrivateFieldGet2(_template, this).get(path).then(function (callback) {
|
|
1155
|
-
return callback.apply(scope, params);
|
|
1158
|
+
return callback.apply(scope, params.concat(globals));
|
|
1156
1159
|
});
|
|
1157
1160
|
}
|
|
1158
1161
|
|
package/dist/umd/browser.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ejs={})}(this,(function(t){"use strict";function e(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function n(t,e,n){return e=h(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,p()?Reflect.construct(e,n||[],h(t).constructor):e.apply(t,n))}function r(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,n){return t.get(e(t,n))}function u(t,e,n){r(t,e),e.set(t,n)}function c(t,n,r){return t.set(e(t,n),r),r}function a(t,e){r(t,e),e.add(t)}function s(t,e,n){return e&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,y(r.key),r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function f(t,e,n){return(e=y(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e)}function p(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(p=function(){return!!t})()}function v(t,e){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},v(t,e)}function y(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}function g(t){var e="function"==typeof Map?new Map:void 0;return g=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(p())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var i=new(t.bind.apply(t,r));return n&&v(i,n.prototype),i}(t,arguments,h(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),v(n,t)},g(t)}var d=function(){var t=[].slice.call(arguments),e=t.shift();return t.filter(e).pop()},b=function(t){return Array.isArray(t)},m=function(t){return"function"==typeof t},w=function(t){return"string"==typeof t},k=function(t){return"boolean"==typeof t},j=function(t){return void 0===t},E="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),O={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},x={"&":"&","<":"<",">":">",'"':""","'":"'"},P=function(t){return new RegExp(["[",Object.keys(t).join(""),"]"].join(""),"g")},S=P(x),M=P(O),T=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(S,(function(t){return x[t]}))},F=function(t,e){var n=t;return null==n?"":!0===Boolean(e)?T(n):n},W=function(t,e){if(!1===function(t,e){return Boolean(t instanceof e)}(t,e))throw new TypeError("".concat(t," in not instance of ").concat(e))},B=function(t,e,n){for(var r=t,i=String(e).split("."),o=i.pop(),u=0;u<i.length;u++){var c=i[u];if(m(r.toJSON)&&(r=r.toJSON()),n&&!1===r.hasOwnProperty(c)){r={};break}r=r[c]=r[c]||{}}return m(r.toJSON)&&(r=r.toJSON()),[r,o]},R=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.filter((function(t){return t})).reduce((function(t,e){return Object.assign(t,e)}),t)},C=function(){},A=function(t,e){var n;for(n in t)L(t,n)&&e(t[n],n,t)},N=function(t,e){return function(t,e){var n=t instanceof Array,r=n?[]:{};return A(t,(function(t,i,o){var u=e(t,i,o);!1===j(u)&&(n?r.push(u):r[i]=u)})),r}(t,(function(t,n){if(-1===e.indexOf(n))return t}))},L=function(t,e){return t&&t.hasOwnProperty(e)},$={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(t,e){return Promise.resolve(["resolver is not defined",t,e].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",ELEMENT:"el",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},U=function(t,e){R(t,{path:d(w,$.path,t.path,e.path),export:d(w,$.export,t.export,e.export),resolver:d(m,$.resolver,t.resolver,e.resolver),extension:d(w,$.extension,t.extension,e.extension),withObject:d(k,$.withObject,t.withObject,e.withObject),rmWhitespace:d(k,$.rmWhitespace,t.rmWhitespace,e.rmWhitespace),cache:d(k,$.cache,t.cache,e.cache),token:R({},$.token,t.token,e.token),vars:R({},$.vars,t.vars,e.vars),globalHelpers:d(b,$.globalHelpers,t.globalHelpers,e.globalHelpers)})},_="undefined"!=typeof globalThis?globalThis:window||self,H=new WeakMap,q=new WeakMap,J=function(){return s((function t(e){i(this,t),u(this,H,!0),u(this,q,{}),this.configure(e)}),[{key:"load",value:function(t){o(H,this)&&R(o(q,this),t||{})}},{key:"get",value:function(t){if(o(H,this))return o(q,this)[t]}},{key:"set",value:function(t,e){o(H,this)&&(o(q,this)[t]=e)}},{key:"exist",value:function(t){return L(o(q,this),t)}},{key:"clear",value:function(){c(q,this,{})}},{key:"remove",value:function(t){delete o(q,this)[t]}},{key:"resolve",value:function(t){return Promise.resolve(this.get(t))}},{key:"configure",value:function(t){c(H,this,t.cache),!1===E&&this.load(_[t.export])}}])}(),D=new WeakMap,K=new WeakMap,V=function(){return s((function t(e){i(this,t),u(this,D,{}),u(this,K,[{symbol:"-",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(t){return"')\n/**".concat(t,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(t){return"')\n".concat(t.trim(),"\n").concat(this.BUFFER,"('")}}]),this.configure(e)}),[{key:"configure",value:function(t){var e=this;o(D,this).withObject=t.withObject,o(D,this).rmWhitespace=t.rmWhitespace,o(D,this).token=t.token,o(D,this).vars=t.vars,o(D,this).globalHelpers=t.globalHelpers,o(D,this).matches=[],o(D,this).formats=[],o(D,this).slurp={match:"[s\t\n]*",start:[o(D,this).token.start,"_"],end:["_",o(D,this).token.end]},o(K,this).forEach((function(t){o(D,e).matches.push(o(D,e).token.start.concat(t.symbol).concat(o(D,e).token.regex).concat(o(D,e).token.end)),o(D,e).formats.push(t.format.bind(o(D,e).vars))})),o(D,this).regex=new RegExp(o(D,this).matches.join("|").concat("|$"),"g"),o(D,this).slurpStart=new RegExp([o(D,this).slurp.match,o(D,this).slurp.start.join("")].join(""),"gm"),o(D,this).slurpEnd=new RegExp([o(D,this).slurp.end.join(""),o(D,this).slurp.match].join(""),"gm")}},{key:"compile",value:function(t,e){var n=this,r=o(D,this).vars,i=r.SCOPE,u=r.SAFE,c=r.BUFFER,a=r.COMPONENT,s=r.ELEMENT,f=o(D,this).globalHelpers;o(D,this).rmWhitespace&&(t=String(t).replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),t=String(t).replace(o(D,this).slurpStart,o(D,this).token.start).replace(o(D,this).slurpEnd,o(D,this).token.end);var h,l,p,v="".concat(c,"('");h=o(D,this).regex,l=function(e,r,i){v+=(""+t.slice(r,i)).replace(M,(function(t){return"\\"+O[t]})),e.forEach((function(t,e){t&&(v+=o(D,n).formats[e](t))}))},p=0,t.replace(h,(function(){var t=[].slice.call(arguments,0,-1),e=t.pop(),n=t.shift();return l(t,p,e),p=e+n.length,n})),v="try{".concat(v+="');","}catch(e){return ").concat(c,".error(e)}"),o(D,this).withObject&&(v="with(".concat(i,"){").concat(v,"}")),v="".concat(c,".start();").concat(v,"return ").concat(c,".end();"),v+="\n//# sourceURL=".concat(e);var y=null,g=[i,c,u,a,s].concat(f);try{(y=Function.apply(null,g.concat(v))).source="(function(".concat(g.join(","),"){\n").concat(v,"\n});")}catch(t){throw t.filename=e,t.source=v,t}return y}}])}(),X=new WeakMap,Y=new WeakMap,z=new WeakMap,G=new WeakMap,I=new WeakSet,Q=function(){return s((function t(e,n,r){i(this,t),a(this,I),u(this,X,void 0),u(this,Y,void 0),u(this,z,void 0),u(this,G,void 0),W(n,J),W(r,V),c(Y,this,n),c(z,this,r),this.configure(e)}),[{key:"configure",value:function(t){c(X,this,t.path),m(t.resolver)&&c(G,this,t.resolver)}},{key:"get",value:function(t){var n=this;return o(Y,this).exist(t)?o(Y,this).resolve(t):e(I,this,Z).call(this,t).then((function(r){return e(I,n,tt).call(n,t,e(I,n,et).call(n,r,t))}))}}])}();function Z(t){return o(G,this).call(this,o(X,this),t)}function tt(t,e){return o(Y,this).set(t,e),e}function et(t,e){return m(t)?t:o(z,this).compile(t,e)}var nt=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],rt=" ",it='"',ot="/",ut="<",ct=">",at=function(t,e,n){var r=[],i=-1===nt.indexOf(t),o=function(t,e){var n=[];return A(t,(function(t,r,i){var o=e(t,r,i);!1===j(o)&&n.push(o)})),n}(e,(function(t,e){if(null!=t)return[T(e),[it,T(t),it].join("")].join("=")})).join(rt);return r.push([ut,t,rt,o,ct].join("")),n&&i&&r.push(n instanceof Array?n.join(""):n),i&&r.push([ut,ot,t,ct].join("")),r.join("")},st=function(t){function e(t){var r;return i(this,e),f(r=n(this,e),"code",0),r.message=t,r}return l(e,t),s(e,[{key:"getCode",value:function(){return this.code}},{key:"getMessage",value:function(){return this.message}},{key:"toString",value:function(){return this.getMessage()}}])}(g(Error)),ft=function(t){function e(){var t;i(this,e);for(var r=arguments.length,o=new Array(r),u=0;u<r;u++)o[u]=arguments[u];return f(t=n(this,e,[].concat(o)),"code",404),t}return l(e,t),s(e)}(st),ht=function(t){function e(){var t;i(this,e);for(var r=arguments.length,o=new Array(r),u=0;u<r;u++)o[u]=arguments[u];return f(t=n(this,e,[].concat(o)),"code",500),t}return l(e,t),s(e)}(st);function lt(t){return Promise.all(t||[]).then((function(t){return t.join("")})).catch((function(t){return t}))}function pt(){var t=[],e=[],n=function(t){e.push(t)};return n.start=function(){e=[]},n.backup=function(){t.push(e.concat()),e=[]},n.restore=function(){var n=e.concat();return e=t.pop(),lt(n)},n.error=function(t){return e=t,Promise.reject(new ht(e.message));var e},n.end=function(){return lt(e)},n}var vt=Symbol("ContextScope.parentTemplate"),yt=new WeakMap,gt=function(){return s((function t(e,n){i(this,t),u(this,yt,void 0),this.configure(e,n)}),[{key:"create",value:function(t){return new(o(yt,this))(t)}},{key:"configure",value:function(t,e){c(yt,this,function(t,e){var n=t.vars,r=n.BLOCKS,i=n.MACRO,o=n.EXTEND,u=n.LAYOUT,c=n.BUFFER,a=n.SAFE,s=n.SCOPE,f=n.COMPONENT,h=n.ELEMENT;function l(t){this[vt]=null,this[r]={},this[i]={},Object.assign(this,N(t,[s,c,a,f,h]))}return Object.assign(l.prototype,e),Object.defineProperty(l.prototype,c,{value:pt()}),Object.defineProperty(l.prototype,r,{value:{},writable:!0}),Object.defineProperty(l.prototype,i,{value:{},writable:!0}),Object.defineProperty(l.prototype,u,{value:!1,writable:!0}),Object.defineProperty(l.prototype,o,{value:!1,writable:!0}),Object.defineProperty(l.prototype,vt,{value:null,writable:!0}),Object.defineProperties(l.prototype,{setParentTemplate:{value:function(t){return this[vt]=t,this}},getParentTemplate:{value:function(){return this[vt]}},useSafeValue:{get:function(){return F}},useComponent:{get:function(){return m(this[f])?this[f].bind(this):function(){throw new Error("".concat(f," must be a function"))}}},useElement:{get:function(){return m(this[h])?this[h].bind(this):function(){throw new Error("".concat(h," must be a function"))}}},getMacro:{value:function(){return this[i]}},getBuffer:{value:function(){return this[c]}},getBlocks:{value:function(){return this[r]}},setExtend:{value:function(t){return this[o]=t,this}},getExtend:{value:function(){return this[o]}},setLayout:{value:function(t){return this[u]=t,this}},getLayout:{value:function(){return this[u]}},clone:{value:function(t){var e=[u,o,c];return!0===t&&e.push(r),N(this,e)}},extend:{value:function(t){this.setExtend(!0),this.setLayout(t)}},echo:{value:function(t){var e=this.getBuffer();[].slice.call(arguments).forEach(e)}},fn:{value:function(t){var e=this.getBuffer(),n=this;return function(){if(m(t))return e.backup(),e(t.apply(n,arguments)),e.restore()}}},macro:{value:function(t,e){var n=this.getMacro(),r=this.fn(e),i=this;n[t]=function(){return i.echo(r.apply(void 0,arguments))}}},call:{value:function(t){var e=this.getMacro()[t],n=[].slice.call(arguments,1);if(m(e))return e.apply(e,n)}},block:{value:function(t,e){var n=this,r=this.getBlocks();if(r[t]=r[t]||[],r[t].push(this.fn(e)),!this.getExtend()){var i=Object.assign([],r[t]),o=function(){return i.shift()},u=function(){var t=o();return t?function(){n.echo(t(u()))}:C};this.echo(o()(u()))}}},hasBlock:{value:function(t){return this.getBlocks().hasOwnProperty(t)}},include:{value:function(t,e,n){var r=!1===n?{}:this.clone(!0),i=R(r,e||{}),o=this.render(t,i);this.echo(o)}},use:{value:function(t,e){var n=this;this.echo(Promise.resolve(this.require(t)).then((function(t){var r=n.getMacro();A(t,(function(t,n){r[[e,n].join(".")]=t}))})))}},async:{value:function(t,e){this.echo(Promise.resolve(t).then(e))}},get:{value:function(t,e){var n=B(this,t,!0),r=n.shift(),i=n.pop();return L(r,i)?r[i]:e}},set:{value:function(t,e){var n=B(this,t,!1),r=n.shift(),i=n.pop();return this.getParentTemplate()&&L(r,i)?r[i]:r[i]=e}},each:{value:function(t,e){w(t)&&(t=this.get(t,[])),A(t,e)},writable:!0},el:{value:function(t,e,n){n=m(n)?this.fn(n)():n,this.echo(Promise.resolve(n).then((function(n){return at(t,e,n)})))},writable:!0},ui:{value:function(t){},writable:!0}}),l}(t,e))}},{key:"helpers",value:function(t){R(o(yt,this).prototype,t||{})}}])}(),dt=new WeakMap,bt=new WeakMap,mt=new WeakMap,wt=new WeakMap,kt=new WeakMap,jt=new WeakMap,Et=new WeakSet,Ot=function(){return s((function t(e){i(this,t),a(this,Et),u(this,dt,{}),u(this,bt,{}),u(this,mt,void 0),u(this,wt,void 0),u(this,kt,void 0),u(this,jt,void 0),U(o(dt,this),e||{}),c(mt,this,new gt(o(dt,this),o(bt,this))),c(wt,this,new V(o(dt,this))),c(kt,this,new J(o(dt,this))),c(jt,this,new Q(o(dt,this),o(kt,this),o(wt,this))),function(t){(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).forEach((function(e){e in t&&(t[e]=t[e].bind(t))}))}(this,["configure","create","render","require","context","preload","compile","helpers"]),this.helpers({require:this.require,render:this.render})}),[{key:"configure",value:function(t){return U(o(dt,this),t||{}),o(mt,this).configure(o(dt,this),o(bt,this)),o(wt,this).configure(o(dt,this)),o(kt,this).configure(o(dt,this)),o(jt,this).configure(o(dt,this)),o(dt,this)}},{key:"filePath",value:function(t){return function(t,e){var n=t.split(".").pop();return n!==e&&(t=[t,e].join(".")),t}(t,o(dt,this).extension)}},{key:"require",value:function(t){var n=this.context({});return e(Et,this,xt).call(this,this.filePath(t),n).then((function(){return n.getMacro()}))}},{key:"render",value:function(t,n){var r=this.context(n);return e(Et,this,xt).call(this,this.filePath(t),r).then(this.outputContent(t,r))}},{key:"outputContent",value:function(t,e){var n=this;return function(r){return e.getExtend()?(e.setExtend(!1),n.renderLayout(e.getLayout(),e,t)):r}}},{key:"renderLayout",value:function(t,n,r){var i=this.context(n);return r&&i.setParentTemplate(r),e(Et,this,xt).call(this,this.filePath(t),i).then(this.outputContent(t,i))}},{key:"helpers",value:function(t){o(mt,this).helpers(R(o(bt,this),t))}},{key:"context",value:function(t){return o(mt,this).create(t)}},{key:"compile",value:function(t,e){return o(wt,this).compile(t,e)}},{key:"preload",value:function(t){return o(kt,this).load(t||{})}},{key:"create",value:function(t){return new this.constructor(t)}}])}();function xt(t,e){var n=o(dt,this).globalHelpers,r=[e,e.getBuffer(),e.useSafeValue,e.useComponent,e.useElement].concat(n.filter((function(t){return m(e[t])})).map((function(t){return e[t].bind(e)})));return o(jt,this).get(t).then((function(t){return t.apply(e,r)}))}var Pt=new Ot({resolver:function(t,e){return fetch(function(t,e){return(e=[t,e].join("/")).replace(/\/\//g,"/")}(t,e)).then((function(t){return t.text()}),(function(t){return new st(t)}))}}),St=Pt.render,Mt=Pt.context,Tt=Pt.compile,Ft=Pt.helpers,Wt=Pt.preload,Bt=Pt.configure,Rt=Pt.create;t.TemplateError=st,t.TemplateNotFound=ft,t.TemplateSyntaxError=ht,t.compile=Tt,t.configure=Bt,t.context=Mt,t.create=Rt,t.helpers=Ft,t.preload=Wt,t.render=St}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ejs={})}(this,(function(t){"use strict";function e(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function n(t,e,n){return e=h(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,p()?Reflect.construct(e,n||[],h(t).constructor):e.apply(t,n))}function r(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,n){return t.get(e(t,n))}function u(t,e,n){r(t,e),e.set(t,n)}function c(t,n,r){return t.set(e(t,n),r),r}function a(t,e){r(t,e),e.add(t)}function s(t,e,n){return e&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,y(r.key),r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function f(t,e,n){return(e=y(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e)}function p(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(p=function(){return!!t})()}function v(t,e){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},v(t,e)}function y(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}function g(t){var e="function"==typeof Map?new Map:void 0;return g=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(p())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var i=new(t.bind.apply(t,r));return n&&v(i,n.prototype),i}(t,arguments,h(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),v(n,t)},g(t)}var d=function(){var t=[].slice.call(arguments),e=t.shift();return t.filter(e).pop()},b=function(t){return Array.isArray(t)},m=function(t){return"function"==typeof t},w=function(t){return"string"==typeof t},k=function(t){return"boolean"==typeof t},j=function(t){return void 0===t},E="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),O={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},x={"&":"&","<":"<",">":">",'"':""","'":"'"},P=function(t){return new RegExp(["[",Object.keys(t).join(""),"]"].join(""),"g")},S=P(x),M=P(O),T=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(S,(function(t){return x[t]}))},F=function(t,e){var n=t;return null==n?"":!0===Boolean(e)?T(n):n},W=function(t,e){if(!1===function(t,e){return Boolean(t instanceof e)}(t,e))throw new TypeError("".concat(t," in not instance of ").concat(e))},B=function(t,e,n){for(var r=t,i=String(e).split("."),o=i.pop(),u=0;u<i.length;u++){var c=i[u];if(m(r.toJSON)&&(r=r.toJSON()),n&&!1===r.hasOwnProperty(c)){r={};break}r=r[c]=r[c]||{}}return m(r.toJSON)&&(r=r.toJSON()),[r,o]},R=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.filter((function(t){return t})).reduce((function(t,e){return Object.assign(t,e)}),t)},C=function(){},A=function(t,e){var n;for(n in t)L(t,n)&&e(t[n],n,t)},N=function(t,e){return function(t,e){var n=t instanceof Array,r=n?[]:{};return A(t,(function(t,i,o){var u=e(t,i,o);!1===j(u)&&(n?r.push(u):r[i]=u)})),r}(t,(function(t,n){if(-1===e.indexOf(n))return t}))},L=function(t,e){return t&&t.hasOwnProperty(e)},$={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(t,e){return Promise.resolve(["resolver is not defined",t,e].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",ELEMENT:"el",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},U=function(t,e){R(t,{path:d(w,$.path,t.path,e.path),export:d(w,$.export,t.export,e.export),resolver:d(m,$.resolver,t.resolver,e.resolver),extension:d(w,$.extension,t.extension,e.extension),withObject:d(k,$.withObject,t.withObject,e.withObject),rmWhitespace:d(k,$.rmWhitespace,t.rmWhitespace,e.rmWhitespace),cache:d(k,$.cache,t.cache,e.cache),token:R({},$.token,t.token,e.token),vars:R({},$.vars,t.vars,e.vars),globalHelpers:d(b,$.globalHelpers,t.globalHelpers,e.globalHelpers)})},_="undefined"!=typeof globalThis?globalThis:window||self,H=new WeakMap,q=new WeakMap,J=function(){return s((function t(e){i(this,t),u(this,H,!0),u(this,q,{}),this.configure(e)}),[{key:"load",value:function(t){o(H,this)&&R(o(q,this),t||{})}},{key:"get",value:function(t){if(o(H,this))return o(q,this)[t]}},{key:"set",value:function(t,e){o(H,this)&&(o(q,this)[t]=e)}},{key:"exist",value:function(t){if(o(H,this))return L(o(q,this),t)}},{key:"clear",value:function(){c(q,this,{})}},{key:"remove",value:function(t){delete o(q,this)[t]}},{key:"resolve",value:function(t){return Promise.resolve(this.get(t))}},{key:"configure",value:function(t){c(H,this,t.cache),!1===E&&this.load(_[t.export])}}])}(),D=new WeakMap,K=new WeakMap,V=function(){return s((function t(e){i(this,t),u(this,D,{}),u(this,K,[{symbol:"-",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(t){return"')\n/**".concat(t,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(t){return"')\n".concat(t.trim(),"\n").concat(this.BUFFER,"('")}}]),this.configure(e)}),[{key:"configure",value:function(t){var e=this;o(D,this).withObject=t.withObject,o(D,this).rmWhitespace=t.rmWhitespace,o(D,this).token=t.token,o(D,this).vars=t.vars,o(D,this).globalHelpers=t.globalHelpers,o(D,this).matches=[],o(D,this).formats=[],o(D,this).slurp={match:"[s\t\n]*",start:[o(D,this).token.start,"_"],end:["_",o(D,this).token.end]},o(K,this).forEach((function(t){o(D,e).matches.push(o(D,e).token.start.concat(t.symbol).concat(o(D,e).token.regex).concat(o(D,e).token.end)),o(D,e).formats.push(t.format.bind(o(D,e).vars))})),o(D,this).regex=new RegExp(o(D,this).matches.join("|").concat("|$"),"g"),o(D,this).slurpStart=new RegExp([o(D,this).slurp.match,o(D,this).slurp.start.join("")].join(""),"gm"),o(D,this).slurpEnd=new RegExp([o(D,this).slurp.end.join(""),o(D,this).slurp.match].join(""),"gm")}},{key:"compile",value:function(t,e){var n=this,r=o(D,this).vars,i=r.SCOPE,u=r.SAFE,c=r.BUFFER,a=r.COMPONENT,s=r.ELEMENT,f=o(D,this).globalHelpers;o(D,this).rmWhitespace&&(t=String(t).replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),t=String(t).replace(o(D,this).slurpStart,o(D,this).token.start).replace(o(D,this).slurpEnd,o(D,this).token.end);var h,l,p,v="".concat(c,"('");h=o(D,this).regex,l=function(e,r,i){v+=(""+t.slice(r,i)).replace(M,(function(t){return"\\"+O[t]})),e.forEach((function(t,e){t&&(v+=o(D,n).formats[e](t))}))},p=0,t.replace(h,(function(){var t=[].slice.call(arguments,0,-1),e=t.pop(),n=t.shift();return l(t,p,e),p=e+n.length,n})),v="try{".concat(v+="');","}catch(e){return ").concat(c,".error(e)}"),o(D,this).withObject&&(v="with(".concat(i,"){").concat(v,"}")),v="".concat(c,".start();").concat(v,"return ").concat(c,".end();"),v+="\n//# sourceURL=".concat(e);var y=null,g=[i,a,s,c,u].concat(f);try{(y=Function.apply(null,g.concat(v))).source="(function(".concat(g.join(","),"){\n").concat(v,"\n});")}catch(t){throw t.filename=e,t.source=v,t}return y}}])}(),X=new WeakMap,Y=new WeakMap,z=new WeakMap,G=new WeakMap,I=new WeakSet,Q=function(){return s((function t(e,n,r){i(this,t),a(this,I),u(this,X,void 0),u(this,Y,void 0),u(this,z,void 0),u(this,G,void 0),W(n,J),W(r,V),c(Y,this,n),c(z,this,r),this.configure(e)}),[{key:"configure",value:function(t){c(X,this,t.path),m(t.resolver)&&c(G,this,t.resolver)}},{key:"get",value:function(t){var n=this;return o(Y,this).exist(t)?o(Y,this).resolve(t):e(I,this,Z).call(this,t).then((function(r){return e(I,n,tt).call(n,t,e(I,n,et).call(n,r,t))}))}}])}();function Z(t){return o(G,this).call(this,o(X,this),t)}function tt(t,e){return o(Y,this).set(t,e),e}function et(t,e){return m(t)?t:o(z,this).compile(t,e)}var nt=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],rt=" ",it='"',ot="/",ut="<",ct=">",at=function(t,e,n){var r=[],i=-1===nt.indexOf(t),o=function(t,e){var n=[];return A(t,(function(t,r,i){var o=e(t,r,i);!1===j(o)&&n.push(o)})),n}(e,(function(t,e){if(null!=t)return[T(e),[it,T(t),it].join("")].join("=")})).join(rt);return r.push([ut,t,rt,o,ct].join("")),n&&i&&r.push(n instanceof Array?n.join(""):n),i&&r.push([ut,ot,t,ct].join("")),r.join("")},st=function(t){function e(t){var r;return i(this,e),f(r=n(this,e),"code",0),r.message=t,r}return l(e,t),s(e,[{key:"getCode",value:function(){return this.code}},{key:"getMessage",value:function(){return this.message}},{key:"toString",value:function(){return this.getMessage()}}])}(g(Error)),ft=function(t){function e(){var t;i(this,e);for(var r=arguments.length,o=new Array(r),u=0;u<r;u++)o[u]=arguments[u];return f(t=n(this,e,[].concat(o)),"code",404),t}return l(e,t),s(e)}(st),ht=function(t){function e(){var t;i(this,e);for(var r=arguments.length,o=new Array(r),u=0;u<r;u++)o[u]=arguments[u];return f(t=n(this,e,[].concat(o)),"code",500),t}return l(e,t),s(e)}(st);function lt(t){return Promise.all(t||[]).then((function(t){return t.join("")})).catch((function(t){return t}))}function pt(){var t=[],e=[],n=function(t){e.push(t)};return n.start=function(){e=[]},n.backup=function(){t.push(e.concat()),e=[]},n.restore=function(){var n=e.concat();return e=t.pop(),lt(n)},n.error=function(t){return e=t,Promise.reject(new ht(e.message));var e},n.end=function(){return lt(e)},n}var vt=Symbol("ContextScope.parentTemplate"),yt=new WeakMap,gt=function(){return s((function t(e,n){i(this,t),u(this,yt,void 0),this.configure(e,n)}),[{key:"create",value:function(t){return new(o(yt,this))(t)}},{key:"configure",value:function(t,e){c(yt,this,function(t,e){var n=t.vars,r=n.BLOCKS,i=n.MACRO,o=n.EXTEND,u=n.LAYOUT,c=n.BUFFER,a=n.SAFE,s=n.SCOPE,f=n.COMPONENT,h=n.ELEMENT;function l(t){this[vt]=null,this[r]={},this[i]={},Object.assign(this,N(t,[s,c,a,f,h]))}return Object.assign(l.prototype,e),Object.defineProperty(l.prototype,c,{value:pt()}),Object.defineProperty(l.prototype,r,{value:{},writable:!0}),Object.defineProperty(l.prototype,i,{value:{},writable:!0}),Object.defineProperty(l.prototype,u,{value:!1,writable:!0}),Object.defineProperty(l.prototype,o,{value:!1,writable:!0}),Object.defineProperty(l.prototype,vt,{value:null,writable:!0}),Object.defineProperties(l.prototype,{setParentTemplate:{value:function(t){return this[vt]=t,this}},getParentTemplate:{value:function(){return this[vt]}},useSafeValue:{get:function(){return F}},useComponent:{get:function(){return m(this[f])?this[f].bind(this):function(){throw new Error("".concat(f," must be a function"))}}},useElement:{get:function(){return m(this[h])?this[h].bind(this):function(){throw new Error("".concat(h," must be a function"))}}},getMacro:{value:function(){return this[i]}},getBuffer:{value:function(){return this[c]}},getBlocks:{value:function(){return this[r]}},setExtend:{value:function(t){return this[o]=t,this}},getExtend:{value:function(){return this[o]}},setLayout:{value:function(t){return this[u]=t,this}},getLayout:{value:function(){return this[u]}},clone:{value:function(t){var e=[u,o,c];return!0===t&&e.push(r),N(this,e)}},extend:{value:function(t){this.setExtend(!0),this.setLayout(t)}},echo:{value:function(t){var e=this.getBuffer();[].slice.call(arguments).forEach(e)}},fn:{value:function(t){var e=this.getBuffer(),n=this;return function(){if(m(t))return e.backup(),e(t.apply(n,arguments)),e.restore()}}},macro:{value:function(t,e){var n=this.getMacro(),r=this.fn(e),i=this;n[t]=function(){return i.echo(r.apply(void 0,arguments))}}},call:{value:function(t){var e=this.getMacro()[t],n=[].slice.call(arguments,1);if(m(e))return e.apply(e,n)}},block:{value:function(t,e){var n=this,r=this.getBlocks();if(r[t]=r[t]||[],r[t].push(this.fn(e)),!this.getExtend()){var i=Object.assign([],r[t]),o=function(){return i.shift()},u=function(){var t=o();return t?function(){n.echo(t(u()))}:C};this.echo(o()(u()))}}},hasBlock:{value:function(t){return this.getBlocks().hasOwnProperty(t)}},include:{value:function(t,e,n){var r=!1===n?{}:this.clone(!0),i=R(r,e||{}),o=this.render(t,i);this.echo(o)}},use:{value:function(t,e){var n=this;this.echo(Promise.resolve(this.require(t)).then((function(t){var r=n.getMacro();A(t,(function(t,n){r[[e,n].join(".")]=t}))})))}},async:{value:function(t,e){this.echo(Promise.resolve(t).then(e))}},get:{value:function(t,e){var n=B(this,t,!0),r=n.shift(),i=n.pop();return L(r,i)?r[i]:e}},set:{value:function(t,e){var n=B(this,t,!1),r=n.shift(),i=n.pop();return this.getParentTemplate()&&L(r,i)?r[i]:r[i]=e}},each:{value:function(t,e){w(t)&&(t=this.get(t,[])),A(t,e)},writable:!0},el:{value:function(t,e,n){n=m(n)?this.fn(n)():n,this.echo(Promise.resolve(n).then((function(n){return at(t,e,n)})))},writable:!0},ui:{value:function(t){},writable:!0}}),l}(t,e))}},{key:"helpers",value:function(t){R(o(yt,this).prototype,t||{})}}])}(),dt=new WeakMap,bt=new WeakMap,mt=new WeakMap,wt=new WeakMap,kt=new WeakMap,jt=new WeakMap,Et=new WeakSet,Ot=function(){return s((function t(e){i(this,t),a(this,Et),u(this,dt,{}),u(this,bt,{}),u(this,mt,void 0),u(this,wt,void 0),u(this,kt,void 0),u(this,jt,void 0),U(o(dt,this),e||{}),c(mt,this,new gt(o(dt,this),o(bt,this))),c(wt,this,new V(o(dt,this))),c(kt,this,new J(o(dt,this))),c(jt,this,new Q(o(dt,this),o(kt,this),o(wt,this))),function(t){(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).forEach((function(e){e in t&&(t[e]=t[e].bind(t))}))}(this,["configure","create","render","require","context","preload","compile","helpers"]),this.helpers({require:this.require,render:this.render})}),[{key:"configure",value:function(t){return U(o(dt,this),t||{}),o(mt,this).configure(o(dt,this),o(bt,this)),o(wt,this).configure(o(dt,this)),o(kt,this).configure(o(dt,this)),o(jt,this).configure(o(dt,this)),o(dt,this)}},{key:"filePath",value:function(t){return function(t,e){var n=t.split(".").pop();return n!==e&&(t=[t,e].join(".")),t}(t,o(dt,this).extension)}},{key:"require",value:function(t){var n=this.context({});return e(Et,this,xt).call(this,this.filePath(t),n).then((function(){return n.getMacro()}))}},{key:"render",value:function(t,n){var r=this.context(n);return e(Et,this,xt).call(this,this.filePath(t),r).then(this.outputContent(t,r))}},{key:"outputContent",value:function(t,e){var n=this;return function(r){return e.getExtend()?(e.setExtend(!1),n.renderLayout(e.getLayout(),e,t)):r}}},{key:"renderLayout",value:function(t,n,r){var i=this.context(n);return r&&i.setParentTemplate(r),e(Et,this,xt).call(this,this.filePath(t),i).then(this.outputContent(t,i))}},{key:"helpers",value:function(t){o(mt,this).helpers(R(o(bt,this),t))}},{key:"context",value:function(t){return o(mt,this).create(t)}},{key:"compile",value:function(t,e){return o(wt,this).compile(t,e)}},{key:"preload",value:function(t){return o(kt,this).load(t||{})}},{key:"create",value:function(t){return new this.constructor(t)}}])}();function xt(t,e){var n=o(dt,this).globalHelpers,r=[e,e.useComponent,e.useElement,e.getBuffer(),e.useSafeValue],i=n.filter((function(t){return m(e[t])})).map((function(t){return e[t].bind(e)}));return o(jt,this).get(t).then((function(t){return t.apply(e,r.concat(i))}))}var Pt=new Ot({resolver:function(t,e){return fetch(function(t,e){return(e=[t,e].join("/")).replace(/\/\//g,"/")}(t,e)).then((function(t){return t.text()}),(function(t){return new st(t)}))}}),St=Pt.render,Mt=Pt.context,Tt=Pt.compile,Ft=Pt.helpers,Wt=Pt.preload,Bt=Pt.configure,Rt=Pt.create;t.TemplateError=st,t.TemplateNotFound=ft,t.TemplateSyntaxError=ht,t.compile=Tt,t.configure=Bt,t.context=Mt,t.create=Rt,t.helpers=Ft,t.preload=Wt,t.render=St}));
|
package/dist/umd/index.js
CHANGED
|
@@ -400,7 +400,9 @@
|
|
|
400
400
|
}, {
|
|
401
401
|
key: "exist",
|
|
402
402
|
value: function exist(key) {
|
|
403
|
-
|
|
403
|
+
if (_classPrivateFieldGet2(_enabled, this)) {
|
|
404
|
+
return hasProp(_classPrivateFieldGet2(_list, this), key);
|
|
405
|
+
}
|
|
404
406
|
}
|
|
405
407
|
}, {
|
|
406
408
|
key: "clear",
|
|
@@ -513,7 +515,7 @@
|
|
|
513
515
|
source = "".concat(BUFFER, ".start();").concat(source, "return ").concat(BUFFER, ".end();");
|
|
514
516
|
source += "\n//# sourceURL=".concat(path);
|
|
515
517
|
var result = null;
|
|
516
|
-
var params = [SCOPE,
|
|
518
|
+
var params = [SCOPE, COMPONENT, ELEMENT, BUFFER, SAFE].concat(GLOBALS);
|
|
517
519
|
try {
|
|
518
520
|
result = Function.apply(null, params.concat(source));
|
|
519
521
|
result.source = "(function(".concat(params.join(','), "){\n").concat(source, "\n});");
|
|
@@ -1146,13 +1148,14 @@
|
|
|
1146
1148
|
function _output(path, scope) {
|
|
1147
1149
|
var _classPrivateFieldGet2$1 = _classPrivateFieldGet2(_config, this),
|
|
1148
1150
|
globalHelpers = _classPrivateFieldGet2$1.globalHelpers;
|
|
1149
|
-
var params = [scope, scope.
|
|
1151
|
+
var params = [scope, scope.useComponent, scope.useElement, scope.getBuffer(), scope.useSafeValue];
|
|
1152
|
+
var globals = globalHelpers.filter(function (name) {
|
|
1150
1153
|
return isFunction(scope[name]);
|
|
1151
1154
|
}).map(function (name) {
|
|
1152
1155
|
return scope[name].bind(scope);
|
|
1153
|
-
})
|
|
1156
|
+
});
|
|
1154
1157
|
return _classPrivateFieldGet2(_template, this).get(path).then(function (callback) {
|
|
1155
|
-
return callback.apply(scope, params);
|
|
1158
|
+
return callback.apply(scope, params.concat(globals));
|
|
1156
1159
|
});
|
|
1157
1160
|
}
|
|
1158
1161
|
|
package/dist/umd/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ejs={})}(this,(function(t){"use strict";function e(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function n(t,e,n){return e=h(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,p()?Reflect.construct(e,n||[],h(t).constructor):e.apply(t,n))}function r(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,n){return t.get(e(t,n))}function u(t,e,n){r(t,e),e.set(t,n)}function c(t,n,r){return t.set(e(t,n),r),r}function a(t,e){r(t,e),e.add(t)}function s(t,e,n){return e&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,y(r.key),r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function f(t,e,n){return(e=y(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e)}function p(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(p=function(){return!!t})()}function v(t,e){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},v(t,e)}function y(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}function g(t){var e="function"==typeof Map?new Map:void 0;return g=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(p())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var i=new(t.bind.apply(t,r));return n&&v(i,n.prototype),i}(t,arguments,h(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),v(n,t)},g(t)}var d=function(){var t=[].slice.call(arguments),e=t.shift();return t.filter(e).pop()},b=function(t){return Array.isArray(t)},m=function(t){return"function"==typeof t},w=function(t){return"string"==typeof t},k=function(t){return"boolean"==typeof t},j=function(t){return void 0===t},E="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),O={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},x={"&":"&","<":"<",">":">",'"':""","'":"'"},P=function(t){return new RegExp(["[",Object.keys(t).join(""),"]"].join(""),"g")},S=P(x),M=P(O),T=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(S,(function(t){return x[t]}))},F=function(t,e){var n=t;return null==n?"":!0===Boolean(e)?T(n):n},W=function(t,e){if(!1===function(t,e){return Boolean(t instanceof e)}(t,e))throw new TypeError("".concat(t," in not instance of ").concat(e))},B=function(t,e,n){for(var r=t,i=String(e).split("."),o=i.pop(),u=0;u<i.length;u++){var c=i[u];if(m(r.toJSON)&&(r=r.toJSON()),n&&!1===r.hasOwnProperty(c)){r={};break}r=r[c]=r[c]||{}}return m(r.toJSON)&&(r=r.toJSON()),[r,o]},R=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.filter((function(t){return t})).reduce((function(t,e){return Object.assign(t,e)}),t)},C=function(){},A=function(t,e){var n;for(n in t)L(t,n)&&e(t[n],n,t)},N=function(t,e){return function(t,e){var n=t instanceof Array,r=n?[]:{};return A(t,(function(t,i,o){var u=e(t,i,o);!1===j(u)&&(n?r.push(u):r[i]=u)})),r}(t,(function(t,n){if(-1===e.indexOf(n))return t}))},L=function(t,e){return t&&t.hasOwnProperty(e)},$={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(t,e){return Promise.resolve(["resolver is not defined",t,e].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",ELEMENT:"el",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},U=function(t,e){R(t,{path:d(w,$.path,t.path,e.path),export:d(w,$.export,t.export,e.export),resolver:d(m,$.resolver,t.resolver,e.resolver),extension:d(w,$.extension,t.extension,e.extension),withObject:d(k,$.withObject,t.withObject,e.withObject),rmWhitespace:d(k,$.rmWhitespace,t.rmWhitespace,e.rmWhitespace),cache:d(k,$.cache,t.cache,e.cache),token:R({},$.token,t.token,e.token),vars:R({},$.vars,t.vars,e.vars),globalHelpers:d(b,$.globalHelpers,t.globalHelpers,e.globalHelpers)})},_="undefined"!=typeof globalThis?globalThis:window||self,H=new WeakMap,q=new WeakMap,J=function(){return s((function t(e){i(this,t),u(this,H,!0),u(this,q,{}),this.configure(e)}),[{key:"load",value:function(t){o(H,this)&&R(o(q,this),t||{})}},{key:"get",value:function(t){if(o(H,this))return o(q,this)[t]}},{key:"set",value:function(t,e){o(H,this)&&(o(q,this)[t]=e)}},{key:"exist",value:function(t){return L(o(q,this),t)}},{key:"clear",value:function(){c(q,this,{})}},{key:"remove",value:function(t){delete o(q,this)[t]}},{key:"resolve",value:function(t){return Promise.resolve(this.get(t))}},{key:"configure",value:function(t){c(H,this,t.cache),!1===E&&this.load(_[t.export])}}])}(),D=new WeakMap,K=new WeakMap,V=function(){return s((function t(e){i(this,t),u(this,D,{}),u(this,K,[{symbol:"-",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(t){return"')\n/**".concat(t,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(t){return"')\n".concat(t.trim(),"\n").concat(this.BUFFER,"('")}}]),this.configure(e)}),[{key:"configure",value:function(t){var e=this;o(D,this).withObject=t.withObject,o(D,this).rmWhitespace=t.rmWhitespace,o(D,this).token=t.token,o(D,this).vars=t.vars,o(D,this).globalHelpers=t.globalHelpers,o(D,this).matches=[],o(D,this).formats=[],o(D,this).slurp={match:"[s\t\n]*",start:[o(D,this).token.start,"_"],end:["_",o(D,this).token.end]},o(K,this).forEach((function(t){o(D,e).matches.push(o(D,e).token.start.concat(t.symbol).concat(o(D,e).token.regex).concat(o(D,e).token.end)),o(D,e).formats.push(t.format.bind(o(D,e).vars))})),o(D,this).regex=new RegExp(o(D,this).matches.join("|").concat("|$"),"g"),o(D,this).slurpStart=new RegExp([o(D,this).slurp.match,o(D,this).slurp.start.join("")].join(""),"gm"),o(D,this).slurpEnd=new RegExp([o(D,this).slurp.end.join(""),o(D,this).slurp.match].join(""),"gm")}},{key:"compile",value:function(t,e){var n=this,r=o(D,this).vars,i=r.SCOPE,u=r.SAFE,c=r.BUFFER,a=r.COMPONENT,s=r.ELEMENT,f=o(D,this).globalHelpers;o(D,this).rmWhitespace&&(t=String(t).replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),t=String(t).replace(o(D,this).slurpStart,o(D,this).token.start).replace(o(D,this).slurpEnd,o(D,this).token.end);var h,l,p,v="".concat(c,"('");h=o(D,this).regex,l=function(e,r,i){v+=(""+t.slice(r,i)).replace(M,(function(t){return"\\"+O[t]})),e.forEach((function(t,e){t&&(v+=o(D,n).formats[e](t))}))},p=0,t.replace(h,(function(){var t=[].slice.call(arguments,0,-1),e=t.pop(),n=t.shift();return l(t,p,e),p=e+n.length,n})),v="try{".concat(v+="');","}catch(e){return ").concat(c,".error(e)}"),o(D,this).withObject&&(v="with(".concat(i,"){").concat(v,"}")),v="".concat(c,".start();").concat(v,"return ").concat(c,".end();"),v+="\n//# sourceURL=".concat(e);var y=null,g=[i,c,u,a,s].concat(f);try{(y=Function.apply(null,g.concat(v))).source="(function(".concat(g.join(","),"){\n").concat(v,"\n});")}catch(t){throw t.filename=e,t.source=v,t}return y}}])}(),X=new WeakMap,Y=new WeakMap,z=new WeakMap,G=new WeakMap,I=new WeakSet,Q=function(){return s((function t(e,n,r){i(this,t),a(this,I),u(this,X,void 0),u(this,Y,void 0),u(this,z,void 0),u(this,G,void 0),W(n,J),W(r,V),c(Y,this,n),c(z,this,r),this.configure(e)}),[{key:"configure",value:function(t){c(X,this,t.path),m(t.resolver)&&c(G,this,t.resolver)}},{key:"get",value:function(t){var n=this;return o(Y,this).exist(t)?o(Y,this).resolve(t):e(I,this,Z).call(this,t).then((function(r){return e(I,n,tt).call(n,t,e(I,n,et).call(n,r,t))}))}}])}();function Z(t){return o(G,this).call(this,o(X,this),t)}function tt(t,e){return o(Y,this).set(t,e),e}function et(t,e){return m(t)?t:o(z,this).compile(t,e)}var nt=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],rt=" ",it='"',ot="/",ut="<",ct=">",at=function(t,e,n){var r=[],i=-1===nt.indexOf(t),o=function(t,e){var n=[];return A(t,(function(t,r,i){var o=e(t,r,i);!1===j(o)&&n.push(o)})),n}(e,(function(t,e){if(null!=t)return[T(e),[it,T(t),it].join("")].join("=")})).join(rt);return r.push([ut,t,rt,o,ct].join("")),n&&i&&r.push(n instanceof Array?n.join(""):n),i&&r.push([ut,ot,t,ct].join("")),r.join("")},st=function(t){function e(t){var r;return i(this,e),f(r=n(this,e),"code",0),r.message=t,r}return l(e,t),s(e,[{key:"getCode",value:function(){return this.code}},{key:"getMessage",value:function(){return this.message}},{key:"toString",value:function(){return this.getMessage()}}])}(g(Error)),ft=function(t){function e(){var t;i(this,e);for(var r=arguments.length,o=new Array(r),u=0;u<r;u++)o[u]=arguments[u];return f(t=n(this,e,[].concat(o)),"code",404),t}return l(e,t),s(e)}(st),ht=function(t){function e(){var t;i(this,e);for(var r=arguments.length,o=new Array(r),u=0;u<r;u++)o[u]=arguments[u];return f(t=n(this,e,[].concat(o)),"code",500),t}return l(e,t),s(e)}(st);function lt(t){return Promise.all(t||[]).then((function(t){return t.join("")})).catch((function(t){return t}))}function pt(){var t=[],e=[],n=function(t){e.push(t)};return n.start=function(){e=[]},n.backup=function(){t.push(e.concat()),e=[]},n.restore=function(){var n=e.concat();return e=t.pop(),lt(n)},n.error=function(t){return e=t,Promise.reject(new ht(e.message));var e},n.end=function(){return lt(e)},n}var vt=Symbol("ContextScope.parentTemplate"),yt=new WeakMap,gt=function(){return s((function t(e,n){i(this,t),u(this,yt,void 0),this.configure(e,n)}),[{key:"create",value:function(t){return new(o(yt,this))(t)}},{key:"configure",value:function(t,e){c(yt,this,function(t,e){var n=t.vars,r=n.BLOCKS,i=n.MACRO,o=n.EXTEND,u=n.LAYOUT,c=n.BUFFER,a=n.SAFE,s=n.SCOPE,f=n.COMPONENT,h=n.ELEMENT;function l(t){this[vt]=null,this[r]={},this[i]={},Object.assign(this,N(t,[s,c,a,f,h]))}return Object.assign(l.prototype,e),Object.defineProperty(l.prototype,c,{value:pt()}),Object.defineProperty(l.prototype,r,{value:{},writable:!0}),Object.defineProperty(l.prototype,i,{value:{},writable:!0}),Object.defineProperty(l.prototype,u,{value:!1,writable:!0}),Object.defineProperty(l.prototype,o,{value:!1,writable:!0}),Object.defineProperty(l.prototype,vt,{value:null,writable:!0}),Object.defineProperties(l.prototype,{setParentTemplate:{value:function(t){return this[vt]=t,this}},getParentTemplate:{value:function(){return this[vt]}},useSafeValue:{get:function(){return F}},useComponent:{get:function(){return m(this[f])?this[f].bind(this):function(){throw new Error("".concat(f," must be a function"))}}},useElement:{get:function(){return m(this[h])?this[h].bind(this):function(){throw new Error("".concat(h," must be a function"))}}},getMacro:{value:function(){return this[i]}},getBuffer:{value:function(){return this[c]}},getBlocks:{value:function(){return this[r]}},setExtend:{value:function(t){return this[o]=t,this}},getExtend:{value:function(){return this[o]}},setLayout:{value:function(t){return this[u]=t,this}},getLayout:{value:function(){return this[u]}},clone:{value:function(t){var e=[u,o,c];return!0===t&&e.push(r),N(this,e)}},extend:{value:function(t){this.setExtend(!0),this.setLayout(t)}},echo:{value:function(t){var e=this.getBuffer();[].slice.call(arguments).forEach(e)}},fn:{value:function(t){var e=this.getBuffer(),n=this;return function(){if(m(t))return e.backup(),e(t.apply(n,arguments)),e.restore()}}},macro:{value:function(t,e){var n=this.getMacro(),r=this.fn(e),i=this;n[t]=function(){return i.echo(r.apply(void 0,arguments))}}},call:{value:function(t){var e=this.getMacro()[t],n=[].slice.call(arguments,1);if(m(e))return e.apply(e,n)}},block:{value:function(t,e){var n=this,r=this.getBlocks();if(r[t]=r[t]||[],r[t].push(this.fn(e)),!this.getExtend()){var i=Object.assign([],r[t]),o=function(){return i.shift()},u=function(){var t=o();return t?function(){n.echo(t(u()))}:C};this.echo(o()(u()))}}},hasBlock:{value:function(t){return this.getBlocks().hasOwnProperty(t)}},include:{value:function(t,e,n){var r=!1===n?{}:this.clone(!0),i=R(r,e||{}),o=this.render(t,i);this.echo(o)}},use:{value:function(t,e){var n=this;this.echo(Promise.resolve(this.require(t)).then((function(t){var r=n.getMacro();A(t,(function(t,n){r[[e,n].join(".")]=t}))})))}},async:{value:function(t,e){this.echo(Promise.resolve(t).then(e))}},get:{value:function(t,e){var n=B(this,t,!0),r=n.shift(),i=n.pop();return L(r,i)?r[i]:e}},set:{value:function(t,e){var n=B(this,t,!1),r=n.shift(),i=n.pop();return this.getParentTemplate()&&L(r,i)?r[i]:r[i]=e}},each:{value:function(t,e){w(t)&&(t=this.get(t,[])),A(t,e)},writable:!0},el:{value:function(t,e,n){n=m(n)?this.fn(n)():n,this.echo(Promise.resolve(n).then((function(n){return at(t,e,n)})))},writable:!0},ui:{value:function(t){},writable:!0}}),l}(t,e))}},{key:"helpers",value:function(t){R(o(yt,this).prototype,t||{})}}])}(),dt=new WeakMap,bt=new WeakMap,mt=new WeakMap,wt=new WeakMap,kt=new WeakMap,jt=new WeakMap,Et=new WeakSet,Ot=function(){return s((function t(e){i(this,t),a(this,Et),u(this,dt,{}),u(this,bt,{}),u(this,mt,void 0),u(this,wt,void 0),u(this,kt,void 0),u(this,jt,void 0),U(o(dt,this),e||{}),c(mt,this,new gt(o(dt,this),o(bt,this))),c(wt,this,new V(o(dt,this))),c(kt,this,new J(o(dt,this))),c(jt,this,new Q(o(dt,this),o(kt,this),o(wt,this))),function(t){(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).forEach((function(e){e in t&&(t[e]=t[e].bind(t))}))}(this,["configure","create","render","require","context","preload","compile","helpers"]),this.helpers({require:this.require,render:this.render})}),[{key:"configure",value:function(t){return U(o(dt,this),t||{}),o(mt,this).configure(o(dt,this),o(bt,this)),o(wt,this).configure(o(dt,this)),o(kt,this).configure(o(dt,this)),o(jt,this).configure(o(dt,this)),o(dt,this)}},{key:"filePath",value:function(t){return function(t,e){var n=t.split(".").pop();return n!==e&&(t=[t,e].join(".")),t}(t,o(dt,this).extension)}},{key:"require",value:function(t){var n=this.context({});return e(Et,this,xt).call(this,this.filePath(t),n).then((function(){return n.getMacro()}))}},{key:"render",value:function(t,n){var r=this.context(n);return e(Et,this,xt).call(this,this.filePath(t),r).then(this.outputContent(t,r))}},{key:"outputContent",value:function(t,e){var n=this;return function(r){return e.getExtend()?(e.setExtend(!1),n.renderLayout(e.getLayout(),e,t)):r}}},{key:"renderLayout",value:function(t,n,r){var i=this.context(n);return r&&i.setParentTemplate(r),e(Et,this,xt).call(this,this.filePath(t),i).then(this.outputContent(t,i))}},{key:"helpers",value:function(t){o(mt,this).helpers(R(o(bt,this),t))}},{key:"context",value:function(t){return o(mt,this).create(t)}},{key:"compile",value:function(t,e){return o(wt,this).compile(t,e)}},{key:"preload",value:function(t){return o(kt,this).load(t||{})}},{key:"create",value:function(t){return new this.constructor(t)}}])}();function xt(t,e){var n=o(dt,this).globalHelpers,r=[e,e.getBuffer(),e.useSafeValue,e.useComponent,e.useElement].concat(n.filter((function(t){return m(e[t])})).map((function(t){return e[t].bind(e)})));return o(jt,this).get(t).then((function(t){return t.apply(e,r)}))}var Pt={};var St=new Ot({resolver:function(t,e){return new Promise((function(n,r){Pt.readFile(function(t,e){return(e=[t,e].join("/")).replace(/\/\//g,"/")}(t,e),(function(t,e){t?r(new st(t)):n(e.toString())}))}))}}),Mt=St.render,Tt=St.context,Ft=St.compile,Wt=St.helpers,Bt=St.preload,Rt=St.configure,Ct=St.create,At=function(t,e){return function(n,r,i){m(r)&&(i=r,r={});var o=R({},(r=r||{}).settings),u=d(w,$.path,o.views),c=d(k,$.cache,o["view cache"]),a=R({},o["view options"]),s=Pt.relative(u,n);return a.path=u,a.cache=c,t(a),e(s,r).then((function(t){i(null,t)})).catch((function(t){i(t)}))}}(Rt,Mt);t.TemplateError=st,t.TemplateNotFound=ft,t.TemplateSyntaxError=ht,t.__express=At,t.compile=Ft,t.configure=Rt,t.context=Tt,t.create=Ct,t.helpers=Wt,t.preload=Bt,t.render=Mt}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ejs={})}(this,(function(t){"use strict";function e(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function n(t,e,n){return e=h(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,p()?Reflect.construct(e,n||[],h(t).constructor):e.apply(t,n))}function r(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,n){return t.get(e(t,n))}function u(t,e,n){r(t,e),e.set(t,n)}function c(t,n,r){return t.set(e(t,n),r),r}function a(t,e){r(t,e),e.add(t)}function s(t,e,n){return e&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,y(r.key),r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function f(t,e,n){return(e=y(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e)}function p(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(p=function(){return!!t})()}function v(t,e){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},v(t,e)}function y(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}function g(t){var e="function"==typeof Map?new Map:void 0;return g=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(p())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var i=new(t.bind.apply(t,r));return n&&v(i,n.prototype),i}(t,arguments,h(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),v(n,t)},g(t)}var d=function(){var t=[].slice.call(arguments),e=t.shift();return t.filter(e).pop()},b=function(t){return Array.isArray(t)},m=function(t){return"function"==typeof t},w=function(t){return"string"==typeof t},k=function(t){return"boolean"==typeof t},j=function(t){return void 0===t},E="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),O={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},x={"&":"&","<":"<",">":">",'"':""","'":"'"},P=function(t){return new RegExp(["[",Object.keys(t).join(""),"]"].join(""),"g")},S=P(x),M=P(O),T=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(S,(function(t){return x[t]}))},F=function(t,e){var n=t;return null==n?"":!0===Boolean(e)?T(n):n},W=function(t,e){if(!1===function(t,e){return Boolean(t instanceof e)}(t,e))throw new TypeError("".concat(t," in not instance of ").concat(e))},B=function(t,e,n){for(var r=t,i=String(e).split("."),o=i.pop(),u=0;u<i.length;u++){var c=i[u];if(m(r.toJSON)&&(r=r.toJSON()),n&&!1===r.hasOwnProperty(c)){r={};break}r=r[c]=r[c]||{}}return m(r.toJSON)&&(r=r.toJSON()),[r,o]},R=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.filter((function(t){return t})).reduce((function(t,e){return Object.assign(t,e)}),t)},C=function(){},A=function(t,e){var n;for(n in t)L(t,n)&&e(t[n],n,t)},N=function(t,e){return function(t,e){var n=t instanceof Array,r=n?[]:{};return A(t,(function(t,i,o){var u=e(t,i,o);!1===j(u)&&(n?r.push(u):r[i]=u)})),r}(t,(function(t,n){if(-1===e.indexOf(n))return t}))},L=function(t,e){return t&&t.hasOwnProperty(e)},$={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(t,e){return Promise.resolve(["resolver is not defined",t,e].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",ELEMENT:"el",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},U=function(t,e){R(t,{path:d(w,$.path,t.path,e.path),export:d(w,$.export,t.export,e.export),resolver:d(m,$.resolver,t.resolver,e.resolver),extension:d(w,$.extension,t.extension,e.extension),withObject:d(k,$.withObject,t.withObject,e.withObject),rmWhitespace:d(k,$.rmWhitespace,t.rmWhitespace,e.rmWhitespace),cache:d(k,$.cache,t.cache,e.cache),token:R({},$.token,t.token,e.token),vars:R({},$.vars,t.vars,e.vars),globalHelpers:d(b,$.globalHelpers,t.globalHelpers,e.globalHelpers)})},_="undefined"!=typeof globalThis?globalThis:window||self,H=new WeakMap,q=new WeakMap,J=function(){return s((function t(e){i(this,t),u(this,H,!0),u(this,q,{}),this.configure(e)}),[{key:"load",value:function(t){o(H,this)&&R(o(q,this),t||{})}},{key:"get",value:function(t){if(o(H,this))return o(q,this)[t]}},{key:"set",value:function(t,e){o(H,this)&&(o(q,this)[t]=e)}},{key:"exist",value:function(t){if(o(H,this))return L(o(q,this),t)}},{key:"clear",value:function(){c(q,this,{})}},{key:"remove",value:function(t){delete o(q,this)[t]}},{key:"resolve",value:function(t){return Promise.resolve(this.get(t))}},{key:"configure",value:function(t){c(H,this,t.cache),!1===E&&this.load(_[t.export])}}])}(),D=new WeakMap,K=new WeakMap,V=function(){return s((function t(e){i(this,t),u(this,D,{}),u(this,K,[{symbol:"-",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(t){return"')\n/**".concat(t,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(t){return"')\n".concat(t.trim(),"\n").concat(this.BUFFER,"('")}}]),this.configure(e)}),[{key:"configure",value:function(t){var e=this;o(D,this).withObject=t.withObject,o(D,this).rmWhitespace=t.rmWhitespace,o(D,this).token=t.token,o(D,this).vars=t.vars,o(D,this).globalHelpers=t.globalHelpers,o(D,this).matches=[],o(D,this).formats=[],o(D,this).slurp={match:"[s\t\n]*",start:[o(D,this).token.start,"_"],end:["_",o(D,this).token.end]},o(K,this).forEach((function(t){o(D,e).matches.push(o(D,e).token.start.concat(t.symbol).concat(o(D,e).token.regex).concat(o(D,e).token.end)),o(D,e).formats.push(t.format.bind(o(D,e).vars))})),o(D,this).regex=new RegExp(o(D,this).matches.join("|").concat("|$"),"g"),o(D,this).slurpStart=new RegExp([o(D,this).slurp.match,o(D,this).slurp.start.join("")].join(""),"gm"),o(D,this).slurpEnd=new RegExp([o(D,this).slurp.end.join(""),o(D,this).slurp.match].join(""),"gm")}},{key:"compile",value:function(t,e){var n=this,r=o(D,this).vars,i=r.SCOPE,u=r.SAFE,c=r.BUFFER,a=r.COMPONENT,s=r.ELEMENT,f=o(D,this).globalHelpers;o(D,this).rmWhitespace&&(t=String(t).replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),t=String(t).replace(o(D,this).slurpStart,o(D,this).token.start).replace(o(D,this).slurpEnd,o(D,this).token.end);var h,l,p,v="".concat(c,"('");h=o(D,this).regex,l=function(e,r,i){v+=(""+t.slice(r,i)).replace(M,(function(t){return"\\"+O[t]})),e.forEach((function(t,e){t&&(v+=o(D,n).formats[e](t))}))},p=0,t.replace(h,(function(){var t=[].slice.call(arguments,0,-1),e=t.pop(),n=t.shift();return l(t,p,e),p=e+n.length,n})),v="try{".concat(v+="');","}catch(e){return ").concat(c,".error(e)}"),o(D,this).withObject&&(v="with(".concat(i,"){").concat(v,"}")),v="".concat(c,".start();").concat(v,"return ").concat(c,".end();"),v+="\n//# sourceURL=".concat(e);var y=null,g=[i,a,s,c,u].concat(f);try{(y=Function.apply(null,g.concat(v))).source="(function(".concat(g.join(","),"){\n").concat(v,"\n});")}catch(t){throw t.filename=e,t.source=v,t}return y}}])}(),X=new WeakMap,Y=new WeakMap,z=new WeakMap,G=new WeakMap,I=new WeakSet,Q=function(){return s((function t(e,n,r){i(this,t),a(this,I),u(this,X,void 0),u(this,Y,void 0),u(this,z,void 0),u(this,G,void 0),W(n,J),W(r,V),c(Y,this,n),c(z,this,r),this.configure(e)}),[{key:"configure",value:function(t){c(X,this,t.path),m(t.resolver)&&c(G,this,t.resolver)}},{key:"get",value:function(t){var n=this;return o(Y,this).exist(t)?o(Y,this).resolve(t):e(I,this,Z).call(this,t).then((function(r){return e(I,n,tt).call(n,t,e(I,n,et).call(n,r,t))}))}}])}();function Z(t){return o(G,this).call(this,o(X,this),t)}function tt(t,e){return o(Y,this).set(t,e),e}function et(t,e){return m(t)?t:o(z,this).compile(t,e)}var nt=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],rt=" ",it='"',ot="/",ut="<",ct=">",at=function(t,e,n){var r=[],i=-1===nt.indexOf(t),o=function(t,e){var n=[];return A(t,(function(t,r,i){var o=e(t,r,i);!1===j(o)&&n.push(o)})),n}(e,(function(t,e){if(null!=t)return[T(e),[it,T(t),it].join("")].join("=")})).join(rt);return r.push([ut,t,rt,o,ct].join("")),n&&i&&r.push(n instanceof Array?n.join(""):n),i&&r.push([ut,ot,t,ct].join("")),r.join("")},st=function(t){function e(t){var r;return i(this,e),f(r=n(this,e),"code",0),r.message=t,r}return l(e,t),s(e,[{key:"getCode",value:function(){return this.code}},{key:"getMessage",value:function(){return this.message}},{key:"toString",value:function(){return this.getMessage()}}])}(g(Error)),ft=function(t){function e(){var t;i(this,e);for(var r=arguments.length,o=new Array(r),u=0;u<r;u++)o[u]=arguments[u];return f(t=n(this,e,[].concat(o)),"code",404),t}return l(e,t),s(e)}(st),ht=function(t){function e(){var t;i(this,e);for(var r=arguments.length,o=new Array(r),u=0;u<r;u++)o[u]=arguments[u];return f(t=n(this,e,[].concat(o)),"code",500),t}return l(e,t),s(e)}(st);function lt(t){return Promise.all(t||[]).then((function(t){return t.join("")})).catch((function(t){return t}))}function pt(){var t=[],e=[],n=function(t){e.push(t)};return n.start=function(){e=[]},n.backup=function(){t.push(e.concat()),e=[]},n.restore=function(){var n=e.concat();return e=t.pop(),lt(n)},n.error=function(t){return e=t,Promise.reject(new ht(e.message));var e},n.end=function(){return lt(e)},n}var vt=Symbol("ContextScope.parentTemplate"),yt=new WeakMap,gt=function(){return s((function t(e,n){i(this,t),u(this,yt,void 0),this.configure(e,n)}),[{key:"create",value:function(t){return new(o(yt,this))(t)}},{key:"configure",value:function(t,e){c(yt,this,function(t,e){var n=t.vars,r=n.BLOCKS,i=n.MACRO,o=n.EXTEND,u=n.LAYOUT,c=n.BUFFER,a=n.SAFE,s=n.SCOPE,f=n.COMPONENT,h=n.ELEMENT;function l(t){this[vt]=null,this[r]={},this[i]={},Object.assign(this,N(t,[s,c,a,f,h]))}return Object.assign(l.prototype,e),Object.defineProperty(l.prototype,c,{value:pt()}),Object.defineProperty(l.prototype,r,{value:{},writable:!0}),Object.defineProperty(l.prototype,i,{value:{},writable:!0}),Object.defineProperty(l.prototype,u,{value:!1,writable:!0}),Object.defineProperty(l.prototype,o,{value:!1,writable:!0}),Object.defineProperty(l.prototype,vt,{value:null,writable:!0}),Object.defineProperties(l.prototype,{setParentTemplate:{value:function(t){return this[vt]=t,this}},getParentTemplate:{value:function(){return this[vt]}},useSafeValue:{get:function(){return F}},useComponent:{get:function(){return m(this[f])?this[f].bind(this):function(){throw new Error("".concat(f," must be a function"))}}},useElement:{get:function(){return m(this[h])?this[h].bind(this):function(){throw new Error("".concat(h," must be a function"))}}},getMacro:{value:function(){return this[i]}},getBuffer:{value:function(){return this[c]}},getBlocks:{value:function(){return this[r]}},setExtend:{value:function(t){return this[o]=t,this}},getExtend:{value:function(){return this[o]}},setLayout:{value:function(t){return this[u]=t,this}},getLayout:{value:function(){return this[u]}},clone:{value:function(t){var e=[u,o,c];return!0===t&&e.push(r),N(this,e)}},extend:{value:function(t){this.setExtend(!0),this.setLayout(t)}},echo:{value:function(t){var e=this.getBuffer();[].slice.call(arguments).forEach(e)}},fn:{value:function(t){var e=this.getBuffer(),n=this;return function(){if(m(t))return e.backup(),e(t.apply(n,arguments)),e.restore()}}},macro:{value:function(t,e){var n=this.getMacro(),r=this.fn(e),i=this;n[t]=function(){return i.echo(r.apply(void 0,arguments))}}},call:{value:function(t){var e=this.getMacro()[t],n=[].slice.call(arguments,1);if(m(e))return e.apply(e,n)}},block:{value:function(t,e){var n=this,r=this.getBlocks();if(r[t]=r[t]||[],r[t].push(this.fn(e)),!this.getExtend()){var i=Object.assign([],r[t]),o=function(){return i.shift()},u=function(){var t=o();return t?function(){n.echo(t(u()))}:C};this.echo(o()(u()))}}},hasBlock:{value:function(t){return this.getBlocks().hasOwnProperty(t)}},include:{value:function(t,e,n){var r=!1===n?{}:this.clone(!0),i=R(r,e||{}),o=this.render(t,i);this.echo(o)}},use:{value:function(t,e){var n=this;this.echo(Promise.resolve(this.require(t)).then((function(t){var r=n.getMacro();A(t,(function(t,n){r[[e,n].join(".")]=t}))})))}},async:{value:function(t,e){this.echo(Promise.resolve(t).then(e))}},get:{value:function(t,e){var n=B(this,t,!0),r=n.shift(),i=n.pop();return L(r,i)?r[i]:e}},set:{value:function(t,e){var n=B(this,t,!1),r=n.shift(),i=n.pop();return this.getParentTemplate()&&L(r,i)?r[i]:r[i]=e}},each:{value:function(t,e){w(t)&&(t=this.get(t,[])),A(t,e)},writable:!0},el:{value:function(t,e,n){n=m(n)?this.fn(n)():n,this.echo(Promise.resolve(n).then((function(n){return at(t,e,n)})))},writable:!0},ui:{value:function(t){},writable:!0}}),l}(t,e))}},{key:"helpers",value:function(t){R(o(yt,this).prototype,t||{})}}])}(),dt=new WeakMap,bt=new WeakMap,mt=new WeakMap,wt=new WeakMap,kt=new WeakMap,jt=new WeakMap,Et=new WeakSet,Ot=function(){return s((function t(e){i(this,t),a(this,Et),u(this,dt,{}),u(this,bt,{}),u(this,mt,void 0),u(this,wt,void 0),u(this,kt,void 0),u(this,jt,void 0),U(o(dt,this),e||{}),c(mt,this,new gt(o(dt,this),o(bt,this))),c(wt,this,new V(o(dt,this))),c(kt,this,new J(o(dt,this))),c(jt,this,new Q(o(dt,this),o(kt,this),o(wt,this))),function(t){(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).forEach((function(e){e in t&&(t[e]=t[e].bind(t))}))}(this,["configure","create","render","require","context","preload","compile","helpers"]),this.helpers({require:this.require,render:this.render})}),[{key:"configure",value:function(t){return U(o(dt,this),t||{}),o(mt,this).configure(o(dt,this),o(bt,this)),o(wt,this).configure(o(dt,this)),o(kt,this).configure(o(dt,this)),o(jt,this).configure(o(dt,this)),o(dt,this)}},{key:"filePath",value:function(t){return function(t,e){var n=t.split(".").pop();return n!==e&&(t=[t,e].join(".")),t}(t,o(dt,this).extension)}},{key:"require",value:function(t){var n=this.context({});return e(Et,this,xt).call(this,this.filePath(t),n).then((function(){return n.getMacro()}))}},{key:"render",value:function(t,n){var r=this.context(n);return e(Et,this,xt).call(this,this.filePath(t),r).then(this.outputContent(t,r))}},{key:"outputContent",value:function(t,e){var n=this;return function(r){return e.getExtend()?(e.setExtend(!1),n.renderLayout(e.getLayout(),e,t)):r}}},{key:"renderLayout",value:function(t,n,r){var i=this.context(n);return r&&i.setParentTemplate(r),e(Et,this,xt).call(this,this.filePath(t),i).then(this.outputContent(t,i))}},{key:"helpers",value:function(t){o(mt,this).helpers(R(o(bt,this),t))}},{key:"context",value:function(t){return o(mt,this).create(t)}},{key:"compile",value:function(t,e){return o(wt,this).compile(t,e)}},{key:"preload",value:function(t){return o(kt,this).load(t||{})}},{key:"create",value:function(t){return new this.constructor(t)}}])}();function xt(t,e){var n=o(dt,this).globalHelpers,r=[e,e.useComponent,e.useElement,e.getBuffer(),e.useSafeValue],i=n.filter((function(t){return m(e[t])})).map((function(t){return e[t].bind(e)}));return o(jt,this).get(t).then((function(t){return t.apply(e,r.concat(i))}))}var Pt={};var St=new Ot({resolver:function(t,e){return new Promise((function(n,r){Pt.readFile(function(t,e){return(e=[t,e].join("/")).replace(/\/\//g,"/")}(t,e),(function(t,e){t?r(new st(t)):n(e.toString())}))}))}}),Mt=St.render,Tt=St.context,Ft=St.compile,Wt=St.helpers,Bt=St.preload,Rt=St.configure,Ct=St.create,At=function(t,e){return function(n,r,i){m(r)&&(i=r,r={});var o=R({},(r=r||{}).settings),u=d(w,$.path,o.views),c=d(k,$.cache,o["view cache"]),a=R({},o["view options"]),s=Pt.relative(u,n);return a.path=u,a.cache=c,t(a),e(s,r).then((function(t){i(null,t)})).catch((function(t){i(t)}))}}(Rt,Mt);t.TemplateError=st,t.TemplateNotFound=ft,t.TemplateSyntaxError=ht,t.__express=At,t.compile=Ft,t.configure=Rt,t.context=Tt,t.create=Ct,t.helpers=Wt,t.preload=Bt,t.render=Mt}));
|
package/dist/umd/worker.js
CHANGED
|
@@ -721,7 +721,9 @@
|
|
|
721
721
|
}, {
|
|
722
722
|
key: "exist",
|
|
723
723
|
value: function exist(key) {
|
|
724
|
-
|
|
724
|
+
if (_classPrivateFieldGet2(_enabled, this)) {
|
|
725
|
+
return hasProp(_classPrivateFieldGet2(_list, this), key);
|
|
726
|
+
}
|
|
725
727
|
}
|
|
726
728
|
}, {
|
|
727
729
|
key: "clear",
|
|
@@ -834,7 +836,7 @@
|
|
|
834
836
|
source = "".concat(BUFFER, ".start();").concat(source, "return ").concat(BUFFER, ".end();");
|
|
835
837
|
source += "\n//# sourceURL=".concat(path);
|
|
836
838
|
var result = null;
|
|
837
|
-
var params = [SCOPE,
|
|
839
|
+
var params = [SCOPE, COMPONENT, ELEMENT, BUFFER, SAFE].concat(GLOBALS);
|
|
838
840
|
try {
|
|
839
841
|
result = Function.apply(null, params.concat(source));
|
|
840
842
|
result.source = "(function(".concat(params.join(','), "){\n").concat(source, "\n});");
|
|
@@ -1467,13 +1469,14 @@
|
|
|
1467
1469
|
function _output(path, scope) {
|
|
1468
1470
|
var _classPrivateFieldGet2$1 = _classPrivateFieldGet2(_config, this),
|
|
1469
1471
|
globalHelpers = _classPrivateFieldGet2$1.globalHelpers;
|
|
1470
|
-
var params = [scope, scope.
|
|
1472
|
+
var params = [scope, scope.useComponent, scope.useElement, scope.getBuffer(), scope.useSafeValue];
|
|
1473
|
+
var globals = globalHelpers.filter(function (name) {
|
|
1471
1474
|
return isFunction(scope[name]);
|
|
1472
1475
|
}).map(function (name) {
|
|
1473
1476
|
return scope[name].bind(scope);
|
|
1474
|
-
})
|
|
1477
|
+
});
|
|
1475
1478
|
return _classPrivateFieldGet2(_template, this).get(path).then(function (callback) {
|
|
1476
|
-
return callback.apply(scope, params);
|
|
1479
|
+
return callback.apply(scope, params.concat(globals));
|
|
1477
1480
|
});
|
|
1478
1481
|
}
|
|
1479
1482
|
|
package/dist/umd/worker.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ejs={})}(this,(function(t){"use strict";function e(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function n(t,e,n,r,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,o)}function r(t,e,n){return e=l(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,v()?Reflect.construct(e,n||[],l(t).constructor):e.apply(t,n))}function o(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,n){return t.get(e(t,n))}function a(t,e,n){o(t,e),e.set(t,n)}function c(t,n,r){return t.set(e(t,n),r),r}function s(t,e){o(t,e),e.add(t)}function h(t,e,n){return e&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,g(r.key),r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function f(t,e,n){return(e=g(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}function p(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}function v(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(v=function(){return!!t})()}function y(){y=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,u=Object.create(i.prototype),a=new F(r||[]);return o(u,"_invoke",{value:L(t,n,a)}),u}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var l="suspendedStart",p="suspendedYield",v="executing",d="completed",g={};function m(){}function w(){}function b(){}var E={};s(E,u,(function(){return this}));var j=Object.getPrototypeOf,k=j&&j(j(W([])));k&&k!==n&&r.call(k,u)&&(E=k);var O=b.prototype=m.prototype=Object.create(E);function x(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function n(o,i,u,a){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,h=s.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,u,a)}),(function(t){n("throw",t,u,a)})):e.resolve(h).then((function(t){s.value=t,u(s)}),(function(t){return n("throw",t,u,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function L(e,n,r){var o=l;return function(i,u){if(o===v)throw Error("Generator is already running");if(o===d){if("throw"===i)throw u;return{value:t,done:!0}}for(r.method=i,r.arg=u;;){var a=r.delegate;if(a){var c=S(a,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===l)throw o=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=v;var s=f(e,n,r);if("normal"===s.type){if(o=r.done?d:p,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=d,r.method="throw",r.arg=s.arg)}}}function S(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,S(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var u=i.arg;return u?u.done?(n[e.resultName]=u.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):u:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function F(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function W(e){if(e||""===e){var n=e[u];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return w.prototype=b,o(O,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:w,configurable:!0}),w.displayName=s(b,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,s(t,c,"GeneratorFunction")),t.prototype=Object.create(O),t},e.awrap=function(t){return{__await:t}},x(P.prototype),s(P.prototype,a,(function(){return this})),e.AsyncIterator=P,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var u=new P(h(t,n,r,o),i);return e.isGeneratorFunction(n)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},x(O),s(O,c,"Generator"),s(O,u,(function(){return this})),s(O,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=W,F.prototype={constructor:F,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return a.type="throw",a.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc)return o("end");if(u.tryLoc<=this.prev){var c=r.call(u,"catchLoc"),s=r.call(u,"finallyLoc");if(c&&s){if(this.prev<u.catchLoc)return o(u.catchLoc,!0);if(this.prev<u.finallyLoc)return o(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return o(u.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return o(u.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),M(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;M(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:W(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function d(t,e){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},d(t,e)}function g(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}function m(t){var e="function"==typeof Map?new Map:void 0;return m=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(v())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&d(o,n.prototype),o}(t,arguments,l(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,t)},m(t)}var w=function(){var t=[].slice.call(arguments),e=t.shift();return t.filter(e).pop()},b=function(t){return Array.isArray(t)},E=function(t){return"function"==typeof t},j=function(t){return"string"==typeof t},k=function(t){return"boolean"==typeof t},O=function(t){return void 0===t},x="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),P={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},L={"&":"&","<":"<",">":">",'"':""","'":"'"},S=function(t){return new RegExp(["[",Object.keys(t).join(""),"]"].join(""),"g")},T=S(L),M=S(P),F=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(T,(function(t){return L[t]}))},W=function(t,e){var n=t;return null==n?"":!0===Boolean(e)?F(n):n},_=function(t,e){if(!1===function(t,e){return Boolean(t instanceof e)}(t,e))throw new TypeError("".concat(t," in not instance of ").concat(e))},N=function(t,e,n){for(var r=t,o=String(e).split("."),i=o.pop(),u=0;u<o.length;u++){var a=o[u];if(E(r.toJSON)&&(r=r.toJSON()),n&&!1===r.hasOwnProperty(a)){r={};break}r=r[a]=r[a]||{}}return E(r.toJSON)&&(r=r.toJSON()),[r,i]},B=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.filter((function(t){return t})).reduce((function(t,e){return Object.assign(t,e)}),t)},R=function(){},C=function(t,e){var n;for(n in t)$(t,n)&&e(t[n],n,t)},A=function(t,e){return function(t,e){var n=t instanceof Array,r=n?[]:{};return C(t,(function(t,o,i){var u=e(t,o,i);!1===O(u)&&(n?r.push(u):r[o]=u)})),r}(t,(function(t,n){if(-1===e.indexOf(n))return t}))},$=function(t,e){return t&&t.hasOwnProperty(e)},U={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(t,e){return Promise.resolve(["resolver is not defined",t,e].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",ELEMENT:"el",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},q=function(t,e){B(t,{path:w(j,U.path,t.path,e.path),export:w(j,U.export,t.export,e.export),resolver:w(E,U.resolver,t.resolver,e.resolver),extension:w(j,U.extension,t.extension,e.extension),withObject:w(k,U.withObject,t.withObject,e.withObject),rmWhitespace:w(k,U.rmWhitespace,t.rmWhitespace,e.rmWhitespace),cache:w(k,U.cache,t.cache,e.cache),token:B({},U.token,t.token,e.token),vars:B({},U.vars,t.vars,e.vars),globalHelpers:w(b,U.globalHelpers,t.globalHelpers,e.globalHelpers)})},H="undefined"!=typeof globalThis?globalThis:window||self,G=new WeakMap,J=new WeakMap,Y=function(){return h((function t(e){i(this,t),a(this,G,!0),a(this,J,{}),this.configure(e)}),[{key:"load",value:function(t){u(G,this)&&B(u(J,this),t||{})}},{key:"get",value:function(t){if(u(G,this))return u(J,this)[t]}},{key:"set",value:function(t,e){u(G,this)&&(u(J,this)[t]=e)}},{key:"exist",value:function(t){return $(u(J,this),t)}},{key:"clear",value:function(){c(J,this,{})}},{key:"remove",value:function(t){delete u(J,this)[t]}},{key:"resolve",value:function(t){return Promise.resolve(this.get(t))}},{key:"configure",value:function(t){c(G,this,t.cache),!1===x&&this.load(H[t.export])}}])}(),D=new WeakMap,I=new WeakMap,K=function(){return h((function t(e){i(this,t),a(this,D,{}),a(this,I,[{symbol:"-",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(t){return"')\n/**".concat(t,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(t){return"')\n".concat(t.trim(),"\n").concat(this.BUFFER,"('")}}]),this.configure(e)}),[{key:"configure",value:function(t){var e=this;u(D,this).withObject=t.withObject,u(D,this).rmWhitespace=t.rmWhitespace,u(D,this).token=t.token,u(D,this).vars=t.vars,u(D,this).globalHelpers=t.globalHelpers,u(D,this).matches=[],u(D,this).formats=[],u(D,this).slurp={match:"[s\t\n]*",start:[u(D,this).token.start,"_"],end:["_",u(D,this).token.end]},u(I,this).forEach((function(t){u(D,e).matches.push(u(D,e).token.start.concat(t.symbol).concat(u(D,e).token.regex).concat(u(D,e).token.end)),u(D,e).formats.push(t.format.bind(u(D,e).vars))})),u(D,this).regex=new RegExp(u(D,this).matches.join("|").concat("|$"),"g"),u(D,this).slurpStart=new RegExp([u(D,this).slurp.match,u(D,this).slurp.start.join("")].join(""),"gm"),u(D,this).slurpEnd=new RegExp([u(D,this).slurp.end.join(""),u(D,this).slurp.match].join(""),"gm")}},{key:"compile",value:function(t,e){var n=this,r=u(D,this).vars,o=r.SCOPE,i=r.SAFE,a=r.BUFFER,c=r.COMPONENT,s=r.ELEMENT,h=u(D,this).globalHelpers;u(D,this).rmWhitespace&&(t=String(t).replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),t=String(t).replace(u(D,this).slurpStart,u(D,this).token.start).replace(u(D,this).slurpEnd,u(D,this).token.end);var f,l,p,v="".concat(a,"('");f=u(D,this).regex,l=function(e,r,o){v+=(""+t.slice(r,o)).replace(M,(function(t){return"\\"+P[t]})),e.forEach((function(t,e){t&&(v+=u(D,n).formats[e](t))}))},p=0,t.replace(f,(function(){var t=[].slice.call(arguments,0,-1),e=t.pop(),n=t.shift();return l(t,p,e),p=e+n.length,n})),v="try{".concat(v+="');","}catch(e){return ").concat(a,".error(e)}"),u(D,this).withObject&&(v="with(".concat(o,"){").concat(v,"}")),v="".concat(a,".start();").concat(v,"return ").concat(a,".end();"),v+="\n//# sourceURL=".concat(e);var y=null,d=[o,a,i,c,s].concat(h);try{(y=Function.apply(null,d.concat(v))).source="(function(".concat(d.join(","),"){\n").concat(v,"\n});")}catch(t){throw t.filename=e,t.source=v,t}return y}}])}(),V=new WeakMap,X=new WeakMap,z=new WeakMap,Q=new WeakMap,Z=new WeakSet,tt=function(){return h((function t(e,n,r){i(this,t),s(this,Z),a(this,V,void 0),a(this,X,void 0),a(this,z,void 0),a(this,Q,void 0),_(n,Y),_(r,K),c(X,this,n),c(z,this,r),this.configure(e)}),[{key:"configure",value:function(t){c(V,this,t.path),E(t.resolver)&&c(Q,this,t.resolver)}},{key:"get",value:function(t){var n=this;return u(X,this).exist(t)?u(X,this).resolve(t):e(Z,this,et).call(this,t).then((function(r){return e(Z,n,nt).call(n,t,e(Z,n,rt).call(n,r,t))}))}}])}();function et(t){return u(Q,this).call(this,u(V,this),t)}function nt(t,e){return u(X,this).set(t,e),e}function rt(t,e){return E(t)?t:u(z,this).compile(t,e)}var ot=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],it=" ",ut='"',at="/",ct="<",st=">",ht=function(t,e,n){var r=[],o=-1===ot.indexOf(t),i=function(t,e){var n=[];return C(t,(function(t,r,o){var i=e(t,r,o);!1===O(i)&&n.push(i)})),n}(e,(function(t,e){if(null!=t)return[F(e),[ut,F(t),ut].join("")].join("=")})).join(it);return r.push([ct,t,it,i,st].join("")),n&&o&&r.push(n instanceof Array?n.join(""):n),o&&r.push([ct,at,t,st].join("")),r.join("")},ft=function(t){function e(t){var n;return i(this,e),f(n=r(this,e),"code",0),n.message=t,n}return p(e,t),h(e,[{key:"getCode",value:function(){return this.code}},{key:"getMessage",value:function(){return this.message}},{key:"toString",value:function(){return this.getMessage()}}])}(m(Error)),lt=function(t){function e(){var t;i(this,e);for(var n=arguments.length,o=new Array(n),u=0;u<n;u++)o[u]=arguments[u];return f(t=r(this,e,[].concat(o)),"code",404),t}return p(e,t),h(e)}(ft),pt=function(t){function e(){var t;i(this,e);for(var n=arguments.length,o=new Array(n),u=0;u<n;u++)o[u]=arguments[u];return f(t=r(this,e,[].concat(o)),"code",500),t}return p(e,t),h(e)}(ft);function vt(t){return Promise.all(t||[]).then((function(t){return t.join("")})).catch((function(t){return t}))}function yt(){var t=[],e=[],n=function(t){e.push(t)};return n.start=function(){e=[]},n.backup=function(){t.push(e.concat()),e=[]},n.restore=function(){var n=e.concat();return e=t.pop(),vt(n)},n.error=function(t){return e=t,Promise.reject(new pt(e.message));var e},n.end=function(){return vt(e)},n}var dt=Symbol("ContextScope.parentTemplate"),gt=new WeakMap,mt=function(){return h((function t(e,n){i(this,t),a(this,gt,void 0),this.configure(e,n)}),[{key:"create",value:function(t){return new(u(gt,this))(t)}},{key:"configure",value:function(t,e){c(gt,this,function(t,e){var n=t.vars,r=n.BLOCKS,o=n.MACRO,i=n.EXTEND,u=n.LAYOUT,a=n.BUFFER,c=n.SAFE,s=n.SCOPE,h=n.COMPONENT,f=n.ELEMENT;function l(t){this[dt]=null,this[r]={},this[o]={},Object.assign(this,A(t,[s,a,c,h,f]))}return Object.assign(l.prototype,e),Object.defineProperty(l.prototype,a,{value:yt()}),Object.defineProperty(l.prototype,r,{value:{},writable:!0}),Object.defineProperty(l.prototype,o,{value:{},writable:!0}),Object.defineProperty(l.prototype,u,{value:!1,writable:!0}),Object.defineProperty(l.prototype,i,{value:!1,writable:!0}),Object.defineProperty(l.prototype,dt,{value:null,writable:!0}),Object.defineProperties(l.prototype,{setParentTemplate:{value:function(t){return this[dt]=t,this}},getParentTemplate:{value:function(){return this[dt]}},useSafeValue:{get:function(){return W}},useComponent:{get:function(){return E(this[h])?this[h].bind(this):function(){throw new Error("".concat(h," must be a function"))}}},useElement:{get:function(){return E(this[f])?this[f].bind(this):function(){throw new Error("".concat(f," must be a function"))}}},getMacro:{value:function(){return this[o]}},getBuffer:{value:function(){return this[a]}},getBlocks:{value:function(){return this[r]}},setExtend:{value:function(t){return this[i]=t,this}},getExtend:{value:function(){return this[i]}},setLayout:{value:function(t){return this[u]=t,this}},getLayout:{value:function(){return this[u]}},clone:{value:function(t){var e=[u,i,a];return!0===t&&e.push(r),A(this,e)}},extend:{value:function(t){this.setExtend(!0),this.setLayout(t)}},echo:{value:function(t){var e=this.getBuffer();[].slice.call(arguments).forEach(e)}},fn:{value:function(t){var e=this.getBuffer(),n=this;return function(){if(E(t))return e.backup(),e(t.apply(n,arguments)),e.restore()}}},macro:{value:function(t,e){var n=this.getMacro(),r=this.fn(e),o=this;n[t]=function(){return o.echo(r.apply(void 0,arguments))}}},call:{value:function(t){var e=this.getMacro()[t],n=[].slice.call(arguments,1);if(E(e))return e.apply(e,n)}},block:{value:function(t,e){var n=this,r=this.getBlocks();if(r[t]=r[t]||[],r[t].push(this.fn(e)),!this.getExtend()){var o=Object.assign([],r[t]),i=function(){return o.shift()},u=function(){var t=i();return t?function(){n.echo(t(u()))}:R};this.echo(i()(u()))}}},hasBlock:{value:function(t){return this.getBlocks().hasOwnProperty(t)}},include:{value:function(t,e,n){var r=!1===n?{}:this.clone(!0),o=B(r,e||{}),i=this.render(t,o);this.echo(i)}},use:{value:function(t,e){var n=this;this.echo(Promise.resolve(this.require(t)).then((function(t){var r=n.getMacro();C(t,(function(t,n){r[[e,n].join(".")]=t}))})))}},async:{value:function(t,e){this.echo(Promise.resolve(t).then(e))}},get:{value:function(t,e){var n=N(this,t,!0),r=n.shift(),o=n.pop();return $(r,o)?r[o]:e}},set:{value:function(t,e){var n=N(this,t,!1),r=n.shift(),o=n.pop();return this.getParentTemplate()&&$(r,o)?r[o]:r[o]=e}},each:{value:function(t,e){j(t)&&(t=this.get(t,[])),C(t,e)},writable:!0},el:{value:function(t,e,n){n=E(n)?this.fn(n)():n,this.echo(Promise.resolve(n).then((function(n){return ht(t,e,n)})))},writable:!0},ui:{value:function(t){},writable:!0}}),l}(t,e))}},{key:"helpers",value:function(t){B(u(gt,this).prototype,t||{})}}])}(),wt=new WeakMap,bt=new WeakMap,Et=new WeakMap,jt=new WeakMap,kt=new WeakMap,Ot=new WeakMap,xt=new WeakSet,Pt=function(){return h((function t(e){i(this,t),s(this,xt),a(this,wt,{}),a(this,bt,{}),a(this,Et,void 0),a(this,jt,void 0),a(this,kt,void 0),a(this,Ot,void 0),q(u(wt,this),e||{}),c(Et,this,new mt(u(wt,this),u(bt,this))),c(jt,this,new K(u(wt,this))),c(kt,this,new Y(u(wt,this))),c(Ot,this,new tt(u(wt,this),u(kt,this),u(jt,this))),function(t){(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).forEach((function(e){e in t&&(t[e]=t[e].bind(t))}))}(this,["configure","create","render","require","context","preload","compile","helpers"]),this.helpers({require:this.require,render:this.render})}),[{key:"configure",value:function(t){return q(u(wt,this),t||{}),u(Et,this).configure(u(wt,this),u(bt,this)),u(jt,this).configure(u(wt,this)),u(kt,this).configure(u(wt,this)),u(Ot,this).configure(u(wt,this)),u(wt,this)}},{key:"filePath",value:function(t){return function(t,e){var n=t.split(".").pop();return n!==e&&(t=[t,e].join(".")),t}(t,u(wt,this).extension)}},{key:"require",value:function(t){var n=this.context({});return e(xt,this,Lt).call(this,this.filePath(t),n).then((function(){return n.getMacro()}))}},{key:"render",value:function(t,n){var r=this.context(n);return e(xt,this,Lt).call(this,this.filePath(t),r).then(this.outputContent(t,r))}},{key:"outputContent",value:function(t,e){var n=this;return function(r){return e.getExtend()?(e.setExtend(!1),n.renderLayout(e.getLayout(),e,t)):r}}},{key:"renderLayout",value:function(t,n,r){var o=this.context(n);return r&&o.setParentTemplate(r),e(xt,this,Lt).call(this,this.filePath(t),o).then(this.outputContent(t,o))}},{key:"helpers",value:function(t){u(Et,this).helpers(B(u(bt,this),t))}},{key:"context",value:function(t){return u(Et,this).create(t)}},{key:"compile",value:function(t,e){return u(jt,this).compile(t,e)}},{key:"preload",value:function(t){return u(kt,this).load(t||{})}},{key:"create",value:function(t){return new this.constructor(t)}}])}();function Lt(t,e){var n=u(wt,this).globalHelpers,r=[e,e.getBuffer(),e.useSafeValue,e.useComponent,e.useElement].concat(n.filter((function(t){return E(e[t])})).map((function(t){return e[t].bind(e)})));return u(Ot,this).get(t).then((function(t){return t.apply(e,r)}))}var St={},Tt=function(t,e){return(t=new URL(t)).protocol=e?"https:":"http:",t.origin},Mt=new Pt({cache:!1,withObject:!1,resolver:function(t,e){return new Promise((function(t,n){St.hasOwnProperty(e)?t(St[e]):n(new lt("template ".concat(e," not found")))}))}}),Ft=Mt.render,Wt=Mt.context,_t=Mt.helpers,Nt=Mt.configure,Bt=Mt.create;t.TemplateError=ft,t.TemplateNotFound=lt,t.TemplateSyntaxError=pt,t.configure=Nt,t.context=Wt,t.create=Bt,t.helpers=_t,t.render=Ft,t.setRenderer=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.version,r=t.secure,o=void 0===r||r;return function(){var t,r=(t=y().mark((function t(n,r){return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.data=Wt({}),n.data.set("version",e),n.data.set("origin",Tt(n.req.url,o)),n.data.set("path",n.req.path),n.data.set("query",n.req.query()),n.ejs=function(t,e){return Ft(t,Object.assign({param:n.req.param()},n.data,e))},n.helpers=function(t){return _t(t)},n.render=function(t,e){return n.html(n.ejs(t,e))},t.next=10,r();case 10:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(o,i){var u=t.apply(e,r);function a(t){n(u,o,i,a,c,"next",t)}function c(t){n(u,o,i,a,c,"throw",t)}a(void 0)}))});return function(t,e){return r.apply(this,arguments)}}()},t.setTemplates=function(t){Object.assign(St,t||{})}}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ejs={})}(this,(function(t){"use strict";function e(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function n(t,e,n,r,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,o)}function r(t,e,n){return e=l(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,v()?Reflect.construct(e,n||[],l(t).constructor):e.apply(t,n))}function o(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,n){return t.get(e(t,n))}function a(t,e,n){o(t,e),e.set(t,n)}function c(t,n,r){return t.set(e(t,n),r),r}function s(t,e){o(t,e),e.add(t)}function h(t,e,n){return e&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,g(r.key),r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function f(t,e,n){return(e=g(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}function p(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}function v(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(v=function(){return!!t})()}function y(){y=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,u=Object.create(i.prototype),a=new F(r||[]);return o(u,"_invoke",{value:L(t,n,a)}),u}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var l="suspendedStart",p="suspendedYield",v="executing",d="completed",g={};function m(){}function w(){}function b(){}var E={};s(E,u,(function(){return this}));var j=Object.getPrototypeOf,k=j&&j(j(W([])));k&&k!==n&&r.call(k,u)&&(E=k);var O=b.prototype=m.prototype=Object.create(E);function x(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function n(o,i,u,a){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,h=s.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,u,a)}),(function(t){n("throw",t,u,a)})):e.resolve(h).then((function(t){s.value=t,u(s)}),(function(t){return n("throw",t,u,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function L(e,n,r){var o=l;return function(i,u){if(o===v)throw Error("Generator is already running");if(o===d){if("throw"===i)throw u;return{value:t,done:!0}}for(r.method=i,r.arg=u;;){var a=r.delegate;if(a){var c=S(a,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===l)throw o=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=v;var s=f(e,n,r);if("normal"===s.type){if(o=r.done?d:p,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=d,r.method="throw",r.arg=s.arg)}}}function S(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,S(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var u=i.arg;return u?u.done?(n[e.resultName]=u.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):u:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function F(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function W(e){if(e||""===e){var n=e[u];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return w.prototype=b,o(O,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:w,configurable:!0}),w.displayName=s(b,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,s(t,c,"GeneratorFunction")),t.prototype=Object.create(O),t},e.awrap=function(t){return{__await:t}},x(P.prototype),s(P.prototype,a,(function(){return this})),e.AsyncIterator=P,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var u=new P(h(t,n,r,o),i);return e.isGeneratorFunction(n)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},x(O),s(O,c,"Generator"),s(O,u,(function(){return this})),s(O,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=W,F.prototype={constructor:F,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return a.type="throw",a.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc)return o("end");if(u.tryLoc<=this.prev){var c=r.call(u,"catchLoc"),s=r.call(u,"finallyLoc");if(c&&s){if(this.prev<u.catchLoc)return o(u.catchLoc,!0);if(this.prev<u.finallyLoc)return o(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return o(u.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return o(u.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),M(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;M(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:W(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function d(t,e){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},d(t,e)}function g(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}function m(t){var e="function"==typeof Map?new Map:void 0;return m=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(v())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&d(o,n.prototype),o}(t,arguments,l(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,t)},m(t)}var w=function(){var t=[].slice.call(arguments),e=t.shift();return t.filter(e).pop()},b=function(t){return Array.isArray(t)},E=function(t){return"function"==typeof t},j=function(t){return"string"==typeof t},k=function(t){return"boolean"==typeof t},O=function(t){return void 0===t},x="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),P={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},L={"&":"&","<":"<",">":">",'"':""","'":"'"},S=function(t){return new RegExp(["[",Object.keys(t).join(""),"]"].join(""),"g")},T=S(L),M=S(P),F=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(T,(function(t){return L[t]}))},W=function(t,e){var n=t;return null==n?"":!0===Boolean(e)?F(n):n},_=function(t,e){if(!1===function(t,e){return Boolean(t instanceof e)}(t,e))throw new TypeError("".concat(t," in not instance of ").concat(e))},N=function(t,e,n){for(var r=t,o=String(e).split("."),i=o.pop(),u=0;u<o.length;u++){var a=o[u];if(E(r.toJSON)&&(r=r.toJSON()),n&&!1===r.hasOwnProperty(a)){r={};break}r=r[a]=r[a]||{}}return E(r.toJSON)&&(r=r.toJSON()),[r,i]},B=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.filter((function(t){return t})).reduce((function(t,e){return Object.assign(t,e)}),t)},R=function(){},C=function(t,e){var n;for(n in t)$(t,n)&&e(t[n],n,t)},A=function(t,e){return function(t,e){var n=t instanceof Array,r=n?[]:{};return C(t,(function(t,o,i){var u=e(t,o,i);!1===O(u)&&(n?r.push(u):r[o]=u)})),r}(t,(function(t,n){if(-1===e.indexOf(n))return t}))},$=function(t,e){return t&&t.hasOwnProperty(e)},U={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(t,e){return Promise.resolve(["resolver is not defined",t,e].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",ELEMENT:"el",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},q=function(t,e){B(t,{path:w(j,U.path,t.path,e.path),export:w(j,U.export,t.export,e.export),resolver:w(E,U.resolver,t.resolver,e.resolver),extension:w(j,U.extension,t.extension,e.extension),withObject:w(k,U.withObject,t.withObject,e.withObject),rmWhitespace:w(k,U.rmWhitespace,t.rmWhitespace,e.rmWhitespace),cache:w(k,U.cache,t.cache,e.cache),token:B({},U.token,t.token,e.token),vars:B({},U.vars,t.vars,e.vars),globalHelpers:w(b,U.globalHelpers,t.globalHelpers,e.globalHelpers)})},H="undefined"!=typeof globalThis?globalThis:window||self,G=new WeakMap,J=new WeakMap,Y=function(){return h((function t(e){i(this,t),a(this,G,!0),a(this,J,{}),this.configure(e)}),[{key:"load",value:function(t){u(G,this)&&B(u(J,this),t||{})}},{key:"get",value:function(t){if(u(G,this))return u(J,this)[t]}},{key:"set",value:function(t,e){u(G,this)&&(u(J,this)[t]=e)}},{key:"exist",value:function(t){if(u(G,this))return $(u(J,this),t)}},{key:"clear",value:function(){c(J,this,{})}},{key:"remove",value:function(t){delete u(J,this)[t]}},{key:"resolve",value:function(t){return Promise.resolve(this.get(t))}},{key:"configure",value:function(t){c(G,this,t.cache),!1===x&&this.load(H[t.export])}}])}(),D=new WeakMap,I=new WeakMap,K=function(){return h((function t(e){i(this,t),a(this,D,{}),a(this,I,[{symbol:"-",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(t){return"')\n/**".concat(t,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(t){return"')\n".concat(t.trim(),"\n").concat(this.BUFFER,"('")}}]),this.configure(e)}),[{key:"configure",value:function(t){var e=this;u(D,this).withObject=t.withObject,u(D,this).rmWhitespace=t.rmWhitespace,u(D,this).token=t.token,u(D,this).vars=t.vars,u(D,this).globalHelpers=t.globalHelpers,u(D,this).matches=[],u(D,this).formats=[],u(D,this).slurp={match:"[s\t\n]*",start:[u(D,this).token.start,"_"],end:["_",u(D,this).token.end]},u(I,this).forEach((function(t){u(D,e).matches.push(u(D,e).token.start.concat(t.symbol).concat(u(D,e).token.regex).concat(u(D,e).token.end)),u(D,e).formats.push(t.format.bind(u(D,e).vars))})),u(D,this).regex=new RegExp(u(D,this).matches.join("|").concat("|$"),"g"),u(D,this).slurpStart=new RegExp([u(D,this).slurp.match,u(D,this).slurp.start.join("")].join(""),"gm"),u(D,this).slurpEnd=new RegExp([u(D,this).slurp.end.join(""),u(D,this).slurp.match].join(""),"gm")}},{key:"compile",value:function(t,e){var n=this,r=u(D,this).vars,o=r.SCOPE,i=r.SAFE,a=r.BUFFER,c=r.COMPONENT,s=r.ELEMENT,h=u(D,this).globalHelpers;u(D,this).rmWhitespace&&(t=String(t).replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),t=String(t).replace(u(D,this).slurpStart,u(D,this).token.start).replace(u(D,this).slurpEnd,u(D,this).token.end);var f,l,p,v="".concat(a,"('");f=u(D,this).regex,l=function(e,r,o){v+=(""+t.slice(r,o)).replace(M,(function(t){return"\\"+P[t]})),e.forEach((function(t,e){t&&(v+=u(D,n).formats[e](t))}))},p=0,t.replace(f,(function(){var t=[].slice.call(arguments,0,-1),e=t.pop(),n=t.shift();return l(t,p,e),p=e+n.length,n})),v="try{".concat(v+="');","}catch(e){return ").concat(a,".error(e)}"),u(D,this).withObject&&(v="with(".concat(o,"){").concat(v,"}")),v="".concat(a,".start();").concat(v,"return ").concat(a,".end();"),v+="\n//# sourceURL=".concat(e);var y=null,d=[o,c,s,a,i].concat(h);try{(y=Function.apply(null,d.concat(v))).source="(function(".concat(d.join(","),"){\n").concat(v,"\n});")}catch(t){throw t.filename=e,t.source=v,t}return y}}])}(),V=new WeakMap,X=new WeakMap,z=new WeakMap,Q=new WeakMap,Z=new WeakSet,tt=function(){return h((function t(e,n,r){i(this,t),s(this,Z),a(this,V,void 0),a(this,X,void 0),a(this,z,void 0),a(this,Q,void 0),_(n,Y),_(r,K),c(X,this,n),c(z,this,r),this.configure(e)}),[{key:"configure",value:function(t){c(V,this,t.path),E(t.resolver)&&c(Q,this,t.resolver)}},{key:"get",value:function(t){var n=this;return u(X,this).exist(t)?u(X,this).resolve(t):e(Z,this,et).call(this,t).then((function(r){return e(Z,n,nt).call(n,t,e(Z,n,rt).call(n,r,t))}))}}])}();function et(t){return u(Q,this).call(this,u(V,this),t)}function nt(t,e){return u(X,this).set(t,e),e}function rt(t,e){return E(t)?t:u(z,this).compile(t,e)}var ot=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],it=" ",ut='"',at="/",ct="<",st=">",ht=function(t,e,n){var r=[],o=-1===ot.indexOf(t),i=function(t,e){var n=[];return C(t,(function(t,r,o){var i=e(t,r,o);!1===O(i)&&n.push(i)})),n}(e,(function(t,e){if(null!=t)return[F(e),[ut,F(t),ut].join("")].join("=")})).join(it);return r.push([ct,t,it,i,st].join("")),n&&o&&r.push(n instanceof Array?n.join(""):n),o&&r.push([ct,at,t,st].join("")),r.join("")},ft=function(t){function e(t){var n;return i(this,e),f(n=r(this,e),"code",0),n.message=t,n}return p(e,t),h(e,[{key:"getCode",value:function(){return this.code}},{key:"getMessage",value:function(){return this.message}},{key:"toString",value:function(){return this.getMessage()}}])}(m(Error)),lt=function(t){function e(){var t;i(this,e);for(var n=arguments.length,o=new Array(n),u=0;u<n;u++)o[u]=arguments[u];return f(t=r(this,e,[].concat(o)),"code",404),t}return p(e,t),h(e)}(ft),pt=function(t){function e(){var t;i(this,e);for(var n=arguments.length,o=new Array(n),u=0;u<n;u++)o[u]=arguments[u];return f(t=r(this,e,[].concat(o)),"code",500),t}return p(e,t),h(e)}(ft);function vt(t){return Promise.all(t||[]).then((function(t){return t.join("")})).catch((function(t){return t}))}function yt(){var t=[],e=[],n=function(t){e.push(t)};return n.start=function(){e=[]},n.backup=function(){t.push(e.concat()),e=[]},n.restore=function(){var n=e.concat();return e=t.pop(),vt(n)},n.error=function(t){return e=t,Promise.reject(new pt(e.message));var e},n.end=function(){return vt(e)},n}var dt=Symbol("ContextScope.parentTemplate"),gt=new WeakMap,mt=function(){return h((function t(e,n){i(this,t),a(this,gt,void 0),this.configure(e,n)}),[{key:"create",value:function(t){return new(u(gt,this))(t)}},{key:"configure",value:function(t,e){c(gt,this,function(t,e){var n=t.vars,r=n.BLOCKS,o=n.MACRO,i=n.EXTEND,u=n.LAYOUT,a=n.BUFFER,c=n.SAFE,s=n.SCOPE,h=n.COMPONENT,f=n.ELEMENT;function l(t){this[dt]=null,this[r]={},this[o]={},Object.assign(this,A(t,[s,a,c,h,f]))}return Object.assign(l.prototype,e),Object.defineProperty(l.prototype,a,{value:yt()}),Object.defineProperty(l.prototype,r,{value:{},writable:!0}),Object.defineProperty(l.prototype,o,{value:{},writable:!0}),Object.defineProperty(l.prototype,u,{value:!1,writable:!0}),Object.defineProperty(l.prototype,i,{value:!1,writable:!0}),Object.defineProperty(l.prototype,dt,{value:null,writable:!0}),Object.defineProperties(l.prototype,{setParentTemplate:{value:function(t){return this[dt]=t,this}},getParentTemplate:{value:function(){return this[dt]}},useSafeValue:{get:function(){return W}},useComponent:{get:function(){return E(this[h])?this[h].bind(this):function(){throw new Error("".concat(h," must be a function"))}}},useElement:{get:function(){return E(this[f])?this[f].bind(this):function(){throw new Error("".concat(f," must be a function"))}}},getMacro:{value:function(){return this[o]}},getBuffer:{value:function(){return this[a]}},getBlocks:{value:function(){return this[r]}},setExtend:{value:function(t){return this[i]=t,this}},getExtend:{value:function(){return this[i]}},setLayout:{value:function(t){return this[u]=t,this}},getLayout:{value:function(){return this[u]}},clone:{value:function(t){var e=[u,i,a];return!0===t&&e.push(r),A(this,e)}},extend:{value:function(t){this.setExtend(!0),this.setLayout(t)}},echo:{value:function(t){var e=this.getBuffer();[].slice.call(arguments).forEach(e)}},fn:{value:function(t){var e=this.getBuffer(),n=this;return function(){if(E(t))return e.backup(),e(t.apply(n,arguments)),e.restore()}}},macro:{value:function(t,e){var n=this.getMacro(),r=this.fn(e),o=this;n[t]=function(){return o.echo(r.apply(void 0,arguments))}}},call:{value:function(t){var e=this.getMacro()[t],n=[].slice.call(arguments,1);if(E(e))return e.apply(e,n)}},block:{value:function(t,e){var n=this,r=this.getBlocks();if(r[t]=r[t]||[],r[t].push(this.fn(e)),!this.getExtend()){var o=Object.assign([],r[t]),i=function(){return o.shift()},u=function(){var t=i();return t?function(){n.echo(t(u()))}:R};this.echo(i()(u()))}}},hasBlock:{value:function(t){return this.getBlocks().hasOwnProperty(t)}},include:{value:function(t,e,n){var r=!1===n?{}:this.clone(!0),o=B(r,e||{}),i=this.render(t,o);this.echo(i)}},use:{value:function(t,e){var n=this;this.echo(Promise.resolve(this.require(t)).then((function(t){var r=n.getMacro();C(t,(function(t,n){r[[e,n].join(".")]=t}))})))}},async:{value:function(t,e){this.echo(Promise.resolve(t).then(e))}},get:{value:function(t,e){var n=N(this,t,!0),r=n.shift(),o=n.pop();return $(r,o)?r[o]:e}},set:{value:function(t,e){var n=N(this,t,!1),r=n.shift(),o=n.pop();return this.getParentTemplate()&&$(r,o)?r[o]:r[o]=e}},each:{value:function(t,e){j(t)&&(t=this.get(t,[])),C(t,e)},writable:!0},el:{value:function(t,e,n){n=E(n)?this.fn(n)():n,this.echo(Promise.resolve(n).then((function(n){return ht(t,e,n)})))},writable:!0},ui:{value:function(t){},writable:!0}}),l}(t,e))}},{key:"helpers",value:function(t){B(u(gt,this).prototype,t||{})}}])}(),wt=new WeakMap,bt=new WeakMap,Et=new WeakMap,jt=new WeakMap,kt=new WeakMap,Ot=new WeakMap,xt=new WeakSet,Pt=function(){return h((function t(e){i(this,t),s(this,xt),a(this,wt,{}),a(this,bt,{}),a(this,Et,void 0),a(this,jt,void 0),a(this,kt,void 0),a(this,Ot,void 0),q(u(wt,this),e||{}),c(Et,this,new mt(u(wt,this),u(bt,this))),c(jt,this,new K(u(wt,this))),c(kt,this,new Y(u(wt,this))),c(Ot,this,new tt(u(wt,this),u(kt,this),u(jt,this))),function(t){(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).forEach((function(e){e in t&&(t[e]=t[e].bind(t))}))}(this,["configure","create","render","require","context","preload","compile","helpers"]),this.helpers({require:this.require,render:this.render})}),[{key:"configure",value:function(t){return q(u(wt,this),t||{}),u(Et,this).configure(u(wt,this),u(bt,this)),u(jt,this).configure(u(wt,this)),u(kt,this).configure(u(wt,this)),u(Ot,this).configure(u(wt,this)),u(wt,this)}},{key:"filePath",value:function(t){return function(t,e){var n=t.split(".").pop();return n!==e&&(t=[t,e].join(".")),t}(t,u(wt,this).extension)}},{key:"require",value:function(t){var n=this.context({});return e(xt,this,Lt).call(this,this.filePath(t),n).then((function(){return n.getMacro()}))}},{key:"render",value:function(t,n){var r=this.context(n);return e(xt,this,Lt).call(this,this.filePath(t),r).then(this.outputContent(t,r))}},{key:"outputContent",value:function(t,e){var n=this;return function(r){return e.getExtend()?(e.setExtend(!1),n.renderLayout(e.getLayout(),e,t)):r}}},{key:"renderLayout",value:function(t,n,r){var o=this.context(n);return r&&o.setParentTemplate(r),e(xt,this,Lt).call(this,this.filePath(t),o).then(this.outputContent(t,o))}},{key:"helpers",value:function(t){u(Et,this).helpers(B(u(bt,this),t))}},{key:"context",value:function(t){return u(Et,this).create(t)}},{key:"compile",value:function(t,e){return u(jt,this).compile(t,e)}},{key:"preload",value:function(t){return u(kt,this).load(t||{})}},{key:"create",value:function(t){return new this.constructor(t)}}])}();function Lt(t,e){var n=u(wt,this).globalHelpers,r=[e,e.useComponent,e.useElement,e.getBuffer(),e.useSafeValue],o=n.filter((function(t){return E(e[t])})).map((function(t){return e[t].bind(e)}));return u(Ot,this).get(t).then((function(t){return t.apply(e,r.concat(o))}))}var St={},Tt=function(t,e){return(t=new URL(t)).protocol=e?"https:":"http:",t.origin},Mt=new Pt({cache:!1,withObject:!1,resolver:function(t,e){return new Promise((function(t,n){St.hasOwnProperty(e)?t(St[e]):n(new lt("template ".concat(e," not found")))}))}}),Ft=Mt.render,Wt=Mt.context,_t=Mt.helpers,Nt=Mt.configure,Bt=Mt.create;t.TemplateError=ft,t.TemplateNotFound=lt,t.TemplateSyntaxError=pt,t.configure=Nt,t.context=Wt,t.create=Bt,t.helpers=_t,t.render=Ft,t.setRenderer=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.version,r=t.secure,o=void 0===r||r;return function(){var t,r=(t=y().mark((function t(n,r){return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.data=Wt({}),n.data.set("version",e),n.data.set("origin",Tt(n.req.url,o)),n.data.set("path",n.req.path),n.data.set("query",n.req.query()),n.ejs=function(t,e){return Ft(t,Object.assign({param:n.req.param()},n.data,e))},n.helpers=function(t){return _t(t)},n.render=function(t,e){return n.html(n.ejs(t,e))},t.next=10,r();case 10:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(o,i){var u=t.apply(e,r);function a(t){n(u,o,i,a,c,"next",t)}function c(t){n(u,o,i,a,c,"throw",t)}a(void 0)}))});return function(t,e){return r.apply(this,arguments)}}()},t.setTemplates=function(t){Object.assign(St,t||{})}}));
|
package/package.json
CHANGED
package/types/ejs.d.ts
CHANGED
|
@@ -33,8 +33,9 @@ export interface EJS {
|
|
|
33
33
|
* render ejs component
|
|
34
34
|
* @param {string} name
|
|
35
35
|
* @param {object} [props]
|
|
36
|
+
* @param {any} [content]
|
|
36
37
|
*/
|
|
37
|
-
ui(name: string, props?: object): any
|
|
38
|
+
ui(name: string, props?: object, content?: any): any
|
|
38
39
|
/**
|
|
39
40
|
* render html element
|
|
40
41
|
* @param {string} tag
|