@kosatyi/ejs 0.0.99 → 0.0.100
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 +238 -181
- package/dist/cjs/index.js +238 -181
- package/dist/cjs/worker.js +238 -181
- package/dist/esm/browser.js +19 -19
- package/dist/esm/index.js +19 -19
- package/dist/esm/worker.js +19 -19
- package/dist/umd/browser.js +238 -181
- package/dist/umd/browser.min.js +1 -1
- package/dist/umd/index.js +238 -181
- package/dist/umd/index.min.js +1 -1
- package/dist/umd/worker.js +238 -181
- package/dist/umd/worker.min.js +1 -1
- package/package.json +1 -1
package/dist/umd/browser.js
CHANGED
|
@@ -706,7 +706,6 @@
|
|
|
706
706
|
}
|
|
707
707
|
|
|
708
708
|
var createContextScope = function createContextScope(config, methods) {
|
|
709
|
-
var _Object$definePropert;
|
|
710
709
|
var _config$vars = config.vars,
|
|
711
710
|
BLOCKS = _config$vars.BLOCKS,
|
|
712
711
|
MACRO = _config$vars.MACRO,
|
|
@@ -728,206 +727,264 @@
|
|
|
728
727
|
Object.assign(this, omit(data, [SCOPE, BUFFER, SAFE, COMPONENT, ELEMENT]));
|
|
729
728
|
}
|
|
730
729
|
Object.assign(ContextScope.prototype, methods);
|
|
731
|
-
Object.
|
|
730
|
+
Object.defineProperty(ContextScope.prototype, BUFFER, {
|
|
732
731
|
value: createBuffer()
|
|
733
|
-
})
|
|
732
|
+
});
|
|
733
|
+
Object.defineProperty(ContextScope.prototype, BLOCKS, {
|
|
734
734
|
value: {},
|
|
735
735
|
writable: true
|
|
736
|
-
})
|
|
736
|
+
});
|
|
737
|
+
Object.defineProperty(ContextScope.prototype, MACRO, {
|
|
737
738
|
value: {},
|
|
738
739
|
writable: true
|
|
739
|
-
})
|
|
740
|
+
});
|
|
741
|
+
Object.defineProperty(ContextScope.prototype, LAYOUT, {
|
|
740
742
|
value: false,
|
|
741
743
|
writable: true
|
|
742
|
-
})
|
|
744
|
+
});
|
|
745
|
+
Object.defineProperty(ContextScope.prototype, EXTEND, {
|
|
743
746
|
value: false,
|
|
744
747
|
writable: true
|
|
745
|
-
})
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
if (isFunction(this[COMPONENT])) {
|
|
752
|
-
return this[COMPONENT].bind(this);
|
|
753
|
-
} else {
|
|
754
|
-
return function () {
|
|
755
|
-
throw new Error("".concat(COMPONENT, " must be a function"));
|
|
756
|
-
};
|
|
748
|
+
});
|
|
749
|
+
Object.defineProperties(ContextScope.prototype, {
|
|
750
|
+
/** @type {function} */
|
|
751
|
+
useSafeValue: {
|
|
752
|
+
get: function get() {
|
|
753
|
+
return safeValue;
|
|
757
754
|
}
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
755
|
+
},
|
|
756
|
+
/** @type {function} */
|
|
757
|
+
useComponent: {
|
|
758
|
+
get: function get() {
|
|
759
|
+
if (isFunction(this[COMPONENT])) {
|
|
760
|
+
return this[COMPONENT].bind(this);
|
|
761
|
+
} else {
|
|
762
|
+
return function () {
|
|
763
|
+
throw new Error("".concat(COMPONENT, " must be a function"));
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
},
|
|
768
|
+
/** @type {function} */
|
|
769
|
+
useElement: {
|
|
770
|
+
get: function get() {
|
|
771
|
+
if (isFunction(this[ELEMENT])) {
|
|
772
|
+
return this[ELEMENT].bind(this);
|
|
773
|
+
} else {
|
|
774
|
+
return function () {
|
|
775
|
+
throw new Error("".concat(ELEMENT, " must be a function"));
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
},
|
|
780
|
+
/** @type {()=>this[MACRO]} */
|
|
781
|
+
getMacro: {
|
|
782
|
+
value: function value() {
|
|
783
|
+
return this[MACRO];
|
|
784
|
+
}
|
|
785
|
+
},
|
|
786
|
+
/** @type {function} */
|
|
787
|
+
getBuffer: {
|
|
788
|
+
value: function value() {
|
|
789
|
+
return this[BUFFER];
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
/** @type {function} */
|
|
793
|
+
getBlocks: {
|
|
794
|
+
value: function value() {
|
|
795
|
+
return this[BLOCKS];
|
|
796
|
+
}
|
|
797
|
+
},
|
|
798
|
+
/** @type {function} */
|
|
799
|
+
setExtend: {
|
|
800
|
+
value: function value(_value) {
|
|
801
|
+
this[EXTEND] = _value;
|
|
802
|
+
}
|
|
803
|
+
},
|
|
804
|
+
/** @type {function} */
|
|
805
|
+
getExtend: {
|
|
806
|
+
value: function value() {
|
|
807
|
+
return this[EXTEND];
|
|
808
|
+
}
|
|
809
|
+
},
|
|
810
|
+
/** @type {function} */
|
|
811
|
+
setLayout: {
|
|
812
|
+
value: function value(layout) {
|
|
813
|
+
this[LAYOUT] = layout;
|
|
814
|
+
}
|
|
815
|
+
},
|
|
816
|
+
/** @type {function} */
|
|
817
|
+
getLayout: {
|
|
818
|
+
value: function value() {
|
|
819
|
+
return this[LAYOUT];
|
|
820
|
+
}
|
|
821
|
+
},
|
|
822
|
+
/** @type {function} */
|
|
823
|
+
clone: {
|
|
824
|
+
value: function value(exclude_blocks) {
|
|
825
|
+
var filter = [LAYOUT, EXTEND, BUFFER];
|
|
826
|
+
if (exclude_blocks === true) {
|
|
827
|
+
filter.push(BLOCKS);
|
|
828
|
+
}
|
|
829
|
+
return omit(this, filter);
|
|
830
|
+
}
|
|
831
|
+
},
|
|
832
|
+
/** @type {function} */
|
|
833
|
+
extend: {
|
|
834
|
+
value: function value(layout) {
|
|
835
|
+
this.setExtend(true);
|
|
836
|
+
this.setLayout(layout);
|
|
837
|
+
}
|
|
838
|
+
},
|
|
839
|
+
/** @type {function} */
|
|
840
|
+
echo: {
|
|
841
|
+
value: function value(layout) {
|
|
842
|
+
var buffer = this.getBuffer();
|
|
843
|
+
var params = [].slice.call(arguments);
|
|
844
|
+
params.forEach(buffer);
|
|
845
|
+
}
|
|
846
|
+
},
|
|
847
|
+
/** @type {function} */
|
|
848
|
+
fn: {
|
|
849
|
+
value: function value(callback) {
|
|
850
|
+
var buffer = this.getBuffer();
|
|
851
|
+
var context = this;
|
|
764
852
|
return function () {
|
|
765
|
-
|
|
853
|
+
if (isFunction(callback)) {
|
|
854
|
+
buffer.backup();
|
|
855
|
+
buffer(callback.apply(context, arguments));
|
|
856
|
+
return buffer.restore();
|
|
857
|
+
}
|
|
766
858
|
};
|
|
767
859
|
}
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
value: function value() {
|
|
779
|
-
return this[BLOCKS];
|
|
780
|
-
}
|
|
781
|
-
}), "setExtend", {
|
|
782
|
-
value: function value(_value) {
|
|
783
|
-
this[EXTEND] = _value;
|
|
784
|
-
}
|
|
785
|
-
}), "getExtend", {
|
|
786
|
-
value: function value() {
|
|
787
|
-
return this[EXTEND];
|
|
788
|
-
}
|
|
789
|
-
}), "setLayout", {
|
|
790
|
-
value: function value(layout) {
|
|
791
|
-
this[LAYOUT] = layout;
|
|
792
|
-
}
|
|
793
|
-
}), "getLayout", {
|
|
794
|
-
value: function value() {
|
|
795
|
-
return this[LAYOUT];
|
|
796
|
-
}
|
|
797
|
-
}), "clone", {
|
|
798
|
-
value: function value(exclude_blocks) {
|
|
799
|
-
var filter = [LAYOUT, EXTEND, BUFFER];
|
|
800
|
-
if (exclude_blocks === true) {
|
|
801
|
-
filter.push(BLOCKS);
|
|
860
|
+
},
|
|
861
|
+
/** @type {function} */
|
|
862
|
+
macro: {
|
|
863
|
+
value: function value(name, callback) {
|
|
864
|
+
var list = this.getMacro();
|
|
865
|
+
var macro = this.fn(callback);
|
|
866
|
+
var context = this;
|
|
867
|
+
list[name] = function () {
|
|
868
|
+
return context.echo(macro.apply(undefined, arguments));
|
|
869
|
+
};
|
|
802
870
|
}
|
|
803
|
-
|
|
804
|
-
}
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
var buffer = this.getBuffer();
|
|
813
|
-
var params = [].slice.call(arguments);
|
|
814
|
-
params.forEach(buffer);
|
|
815
|
-
}
|
|
816
|
-
}), "fn", {
|
|
817
|
-
value: function value(callback) {
|
|
818
|
-
var buffer = this.getBuffer();
|
|
819
|
-
var context = this;
|
|
820
|
-
return function () {
|
|
821
|
-
if (isFunction(callback)) {
|
|
822
|
-
buffer.backup();
|
|
823
|
-
buffer(callback.apply(context, arguments));
|
|
824
|
-
return buffer.restore();
|
|
871
|
+
},
|
|
872
|
+
/** @type {function} */
|
|
873
|
+
call: {
|
|
874
|
+
value: function value(name) {
|
|
875
|
+
var list = this.getMacro();
|
|
876
|
+
var macro = list[name];
|
|
877
|
+
var params = [].slice.call(arguments, 1);
|
|
878
|
+
if (isFunction(macro)) {
|
|
879
|
+
return macro.apply(macro, params);
|
|
825
880
|
}
|
|
826
|
-
};
|
|
827
|
-
}
|
|
828
|
-
}), "macro", {
|
|
829
|
-
value: function value(name, callback) {
|
|
830
|
-
var list = this.getMacro();
|
|
831
|
-
var macro = this.fn(callback);
|
|
832
|
-
var context = this;
|
|
833
|
-
list[name] = function () {
|
|
834
|
-
return context.echo(macro.apply(undefined, arguments));
|
|
835
|
-
};
|
|
836
|
-
}
|
|
837
|
-
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
|
|
838
|
-
value: function value(name) {
|
|
839
|
-
var list = this.getMacro();
|
|
840
|
-
var macro = list[name];
|
|
841
|
-
var params = [].slice.call(arguments, 1);
|
|
842
|
-
if (isFunction(macro)) {
|
|
843
|
-
return macro.apply(macro, params);
|
|
844
881
|
}
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
var
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
}), "hasBlock", {
|
|
870
|
-
value: function value(name) {
|
|
871
|
-
return this.getBlocks().hasOwnProperty(name);
|
|
872
|
-
}
|
|
873
|
-
}), "include", {
|
|
874
|
-
value: function value(path, data, cx) {
|
|
875
|
-
var context = cx === false ? {} : this.clone(true);
|
|
876
|
-
var params = extend(context, data || {});
|
|
877
|
-
var promise = this.render(path, params);
|
|
878
|
-
this.echo(promise);
|
|
879
|
-
}
|
|
880
|
-
}), "use", {
|
|
881
|
-
value: function value(path, namespace) {
|
|
882
|
-
var _this2 = this;
|
|
883
|
-
this.echo(Promise.resolve(this.require(path)).then(function (exports) {
|
|
884
|
-
var list = _this2.getMacro();
|
|
885
|
-
each(exports, function (macro, name) {
|
|
886
|
-
list[[namespace, name].join('.')] = macro;
|
|
887
|
-
});
|
|
888
|
-
}));
|
|
889
|
-
}
|
|
890
|
-
}), "async", {
|
|
891
|
-
value: function value(promise, callback) {
|
|
892
|
-
this.echo(Promise.resolve(promise).then(callback));
|
|
893
|
-
}
|
|
894
|
-
}), "get", {
|
|
895
|
-
value: function value(name, defaults) {
|
|
896
|
-
var path = getPath(this, name, true);
|
|
897
|
-
var result = path.shift();
|
|
898
|
-
var prop = path.pop();
|
|
899
|
-
return hasProp(result, prop) ? result[prop] : defaults;
|
|
900
|
-
}
|
|
901
|
-
}), "set", {
|
|
902
|
-
value: function value(name, _value2) {
|
|
903
|
-
var path = getPath(this, name, false);
|
|
904
|
-
var result = path.shift();
|
|
905
|
-
var prop = path.pop();
|
|
906
|
-
if (this.getExtend() && hasProp(result, prop)) {
|
|
907
|
-
return result[prop];
|
|
882
|
+
},
|
|
883
|
+
/** @type {function} */
|
|
884
|
+
block: {
|
|
885
|
+
value: function value(name, callback) {
|
|
886
|
+
var _this = this;
|
|
887
|
+
var blocks = this.getBlocks();
|
|
888
|
+
blocks[name] = blocks[name] || [];
|
|
889
|
+
blocks[name].push(this.fn(callback));
|
|
890
|
+
if (this.getExtend()) return;
|
|
891
|
+
var list = Object.assign([], blocks[name]);
|
|
892
|
+
var current = function current() {
|
|
893
|
+
return list.shift();
|
|
894
|
+
};
|
|
895
|
+
var _next = function next() {
|
|
896
|
+
var parent = current();
|
|
897
|
+
if (parent) {
|
|
898
|
+
return function () {
|
|
899
|
+
_this.echo(parent(_next()));
|
|
900
|
+
};
|
|
901
|
+
} else {
|
|
902
|
+
return noop;
|
|
903
|
+
}
|
|
904
|
+
};
|
|
905
|
+
this.echo(current()(_next()));
|
|
908
906
|
}
|
|
909
|
-
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
object = this.get(object, []);
|
|
907
|
+
},
|
|
908
|
+
/** @type {function} */
|
|
909
|
+
hasBlock: {
|
|
910
|
+
value: function value(name) {
|
|
911
|
+
return this.getBlocks().hasOwnProperty(name);
|
|
915
912
|
}
|
|
916
|
-
each(object, callback);
|
|
917
913
|
},
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
914
|
+
/** @type {function} */
|
|
915
|
+
include: {
|
|
916
|
+
value: function value(path, data, cx) {
|
|
917
|
+
var context = cx === false ? {} : this.clone(true);
|
|
918
|
+
var params = extend(context, data || {});
|
|
919
|
+
var promise = this.render(path, params);
|
|
920
|
+
this.echo(promise);
|
|
921
|
+
}
|
|
925
922
|
},
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
923
|
+
/** @type {function} */
|
|
924
|
+
use: {
|
|
925
|
+
value: function value(path, namespace) {
|
|
926
|
+
var _this2 = this;
|
|
927
|
+
this.echo(Promise.resolve(this.require(path)).then(function (exports) {
|
|
928
|
+
var list = _this2.getMacro();
|
|
929
|
+
each(exports, function (macro, name) {
|
|
930
|
+
list[[namespace, name].join('.')] = macro;
|
|
931
|
+
});
|
|
932
|
+
}));
|
|
933
|
+
}
|
|
934
|
+
},
|
|
935
|
+
/** @type {function} */
|
|
936
|
+
async: {
|
|
937
|
+
value: function value(promise, callback) {
|
|
938
|
+
this.echo(Promise.resolve(promise).then(callback));
|
|
939
|
+
}
|
|
940
|
+
},
|
|
941
|
+
/** @type {function} */
|
|
942
|
+
get: {
|
|
943
|
+
value: function value(name, defaults) {
|
|
944
|
+
var path = getPath(this, name, true);
|
|
945
|
+
var result = path.shift();
|
|
946
|
+
var prop = path.pop();
|
|
947
|
+
return hasProp(result, prop) ? result[prop] : defaults;
|
|
948
|
+
}
|
|
949
|
+
},
|
|
950
|
+
/** @type {function} */
|
|
951
|
+
set: {
|
|
952
|
+
value: function value(name, _value2) {
|
|
953
|
+
var path = getPath(this, name, false);
|
|
954
|
+
var result = path.shift();
|
|
955
|
+
var prop = path.pop();
|
|
956
|
+
if (this.getExtend() && hasProp(result, prop)) {
|
|
957
|
+
return result[prop];
|
|
958
|
+
}
|
|
959
|
+
return result[prop] = _value2;
|
|
960
|
+
}
|
|
961
|
+
},
|
|
962
|
+
/** @type {function} */
|
|
963
|
+
each: {
|
|
964
|
+
value: function value(object, callback) {
|
|
965
|
+
if (isString(object)) {
|
|
966
|
+
object = this.get(object, []);
|
|
967
|
+
}
|
|
968
|
+
each(object, callback);
|
|
969
|
+
},
|
|
970
|
+
writable: true
|
|
971
|
+
},
|
|
972
|
+
/** @type {function} */
|
|
973
|
+
el: {
|
|
974
|
+
value: function value(tag, attr, content) {
|
|
975
|
+
content = isFunction(content) ? this.fn(content)() : content;
|
|
976
|
+
this.echo(Promise.resolve(content).then(function (content) {
|
|
977
|
+
return element(tag, attr, content);
|
|
978
|
+
}));
|
|
979
|
+
},
|
|
980
|
+
writable: true
|
|
981
|
+
},
|
|
982
|
+
/** @type {function} */
|
|
983
|
+
ui: {
|
|
984
|
+
value: function value(layout) {},
|
|
985
|
+
writable: true
|
|
986
|
+
}
|
|
987
|
+
});
|
|
931
988
|
return ContextScope;
|
|
932
989
|
};
|
|
933
990
|
var _scope = /*#__PURE__*/new WeakMap();
|
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 s(t,e){r(t,e),e.add(t)}function a(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)},w=function(t){return"function"==typeof t},m=function(t){return"string"==typeof t},k=function(t){return"boolean"==typeof t},E=function(t){return void 0===t},j="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),O={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},x={"&":"&","<":"<",">":">",'"':""","'":"'"},M=function(t){return new RegExp(["[",Object.keys(t).join(""),"]"].join(""),"g")},S=M(x),P=M(O),F=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(S,(function(t){return x[t]}))},T=function(t,e){var n=t;return null==n?"":!0===Boolean(e)?F(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(w(r.toJSON)&&(r=r.toJSON()),n&&!1===r.hasOwnProperty(c)){r={};break}r=r[c]=r[c]||{}}return w(r.toJSON)&&(r=r.toJSON()),[r,o]},R=function(t,e){var n=t.split(".").pop();return n!==e&&(t=[t,e].join(".")),t},A=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)},N=function(){},C=function(t,e){var n;for(n in t)L(t,n)&&e(t[n],n,t)},$=function(t,e){return function(t,e){var n=t instanceof Array,r=n?[]:{};return C(t,(function(t,i,o){var u=e(t,i,o);!1===E(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)},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]+?)"}},_=function(t,e){A(t,{path:d(m,U.path,t.path,e.path),export:d(m,U.export,t.export,e.export),resolver:d(w,U.resolver,t.resolver,e.resolver),extension:d(m,U.extension,t.extension,e.extension),withObject:d(k,U.withObject,t.withObject,e.withObject),rmWhitespace:d(k,U.rmWhitespace,t.rmWhitespace,e.rmWhitespace),cache:d(k,U.cache,t.cache,e.cache),token:A({},U.token,t.token,e.token),vars:A({},U.vars,t.vars,e.vars),globalHelpers:d(b,U.globalHelpers,t.globalHelpers,e.globalHelpers)})},H="undefined"!=typeof globalThis?globalThis:window||self,q=new WeakMap,J=new WeakMap,D=function(){return a((function t(e){i(this,t),u(this,q,!0),u(this,J,{}),this.configure(e)}),[{key:"load",value:function(t){o(q,this)&&A(o(J,this),t||{})}},{key:"get",value:function(t){if(o(q,this))return o(J,this)[t]}},{key:"set",value:function(t,e){o(q,this)&&(o(J,this)[t]=e)}},{key:"exist",value:function(t){return L(o(J,this),t)}},{key:"clear",value:function(){c(J,this,{})}},{key:"remove",value:function(t){delete o(J,this)[t]}},{key:"resolve",value:function(t){return Promise.resolve(this.get(t))}},{key:"configure",value:function(t){c(q,this,t.cache),!1===j&&this.load(H[t.export])}}])}(),K=new WeakMap,V=new WeakMap,X=function(){return a((function t(e){i(this,t),u(this,K,{}),u(this,V,[{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(K,this).withObject=t.withObject,o(K,this).rmWhitespace=t.rmWhitespace,o(K,this).token=t.token,o(K,this).vars=t.vars,o(K,this).globalHelpers=t.globalHelpers,o(K,this).matches=[],o(K,this).formats=[],o(K,this).slurp={match:"[s\t\n]*",start:[o(K,this).token.start,"_"],end:["_",o(K,this).token.end]},o(V,this).forEach((function(t){o(K,e).matches.push(o(K,e).token.start.concat(t.symbol).concat(o(K,e).token.regex).concat(o(K,e).token.end)),o(K,e).formats.push(t.format.bind(o(K,e).vars))})),o(K,this).regex=new RegExp(o(K,this).matches.join("|").concat("|$"),"g"),o(K,this).slurpStart=new RegExp([o(K,this).slurp.match,o(K,this).slurp.start.join("")].join(""),"gm"),o(K,this).slurpEnd=new RegExp([o(K,this).slurp.end.join(""),o(K,this).slurp.match].join(""),"gm")}},{key:"compile",value:function(t,e){var n=this,r=o(K,this).vars,i=r.SCOPE,u=r.SAFE,c=r.BUFFER,s=r.COMPONENT,a=r.ELEMENT,f=o(K,this).globalHelpers;o(K,this).rmWhitespace&&(t=String(t).replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),t=String(t).replace(o(K,this).slurpStart,o(K,this).token.start).replace(o(K,this).slurpEnd,o(K,this).token.end);var h,l,p,v="".concat(c,"('");h=o(K,this).regex,l=function(e,r,i){v+=(""+t.slice(r,i)).replace(P,(function(t){return"\\"+O[t]})),e.forEach((function(t,e){t&&(v+=o(K,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(K,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,s,a].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}}])}(),Y=new WeakMap,z=new WeakMap,G=new WeakMap,I=new WeakMap,Q=new WeakSet,Z=function(){return a((function t(e,n,r){i(this,t),s(this,Q),u(this,Y,void 0),u(this,z,void 0),u(this,G,void 0),u(this,I,void 0),W(n,D),W(r,X),c(z,this,n),c(G,this,r),this.configure(e)}),[{key:"configure",value:function(t){c(Y,this,t.path),w(t.resolver)&&c(I,this,t.resolver)}},{key:"get",value:function(t){var n=this;return o(z,this).exist(t)?o(z,this).resolve(t):e(Q,this,tt).call(this,t).then((function(r){return e(Q,n,et).call(n,t,e(Q,n,nt).call(n,r,t))}))}}])}();function tt(t){return o(I,this).call(this,o(Y,this),t)}function et(t,e){return o(z,this).set(t,e),e}function nt(t,e){return w(t)?t:o(G,this).compile(t,e)}var rt=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],it=" ",ot='"',ut="/",ct="<",st=">",at=function(t,e,n){var r=[],i=-1===rt.indexOf(t),o=function(t,e){var n=[];return C(t,(function(t,r,i){var o=e(t,r,i);!1===E(o)&&n.push(o)})),n}(e,(function(t,e){if(null!=t)return[F(e),[ot,F(t),ot].join("")].join("=")})).join(it);return r.push([ct,t,it,o,st].join("")),n&&i&&r.push(n instanceof Array?n.join(""):n),i&&r.push([ct,ut,t,st].join("")),r.join("")},ft=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),a(e,[{key:"getCode",value:function(){return this.code}},{key:"getMessage",value:function(){return this.message}},{key:"toString",value:function(){return this.getMessage()}}])}(g(Error)),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",404),t}return l(e,t),a(e)}(ft),lt=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),a(e)}(ft);function pt(t){return Promise.all(t||[]).then((function(t){return t.join("")})).catch((function(t){return t}))}function vt(){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(),pt(n)},n.error=function(t){return e=t,Promise.reject(new lt(e.message));var e},n.end=function(){return pt(e)},n}var yt=new WeakMap,gt=function(){return a((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,r=t.vars,i=r.BLOCKS,o=r.MACRO,u=r.EXTEND,c=r.LAYOUT,s=r.BUFFER,a=r.SAFE,h=r.SCOPE,l=r.COMPONENT,p=r.ELEMENT;function v(t){this[i]={},this[o]={},Object.assign(this,$(t,[h,s,a,l,p]))}return Object.assign(v.prototype,e),Object.defineProperties(v.prototype,(f(f(f(f(f(f(f(f(f(f(n={},s,{value:vt()}),i,{value:{},writable:!0}),o,{value:{},writable:!0}),c,{value:!1,writable:!0}),u,{value:!1,writable:!0}),"useSafeValue",{get:function(){return T}}),"useComponent",{get:function(){return w(this[l])?this[l].bind(this):function(){throw new Error("".concat(l," must be a function"))}}}),"useElement",{get:function(){return w(this[p])?this[p].bind(this):function(){throw new Error("".concat(p," must be a function"))}}}),"getMacro",{value:function(){return this[o]}}),"getBuffer",{value:function(){return this[s]}}),f(f(f(f(f(f(f(f(f(f(n,"getBlocks",{value:function(){return this[i]}}),"setExtend",{value:function(t){this[u]=t}}),"getExtend",{value:function(){return this[u]}}),"setLayout",{value:function(t){this[c]=t}}),"getLayout",{value:function(){return this[c]}}),"clone",{value:function(t){var e=[c,u,s];return!0===t&&e.push(i),$(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(w(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))}}}),f(f(f(f(f(f(f(f(f(f(n,"call",{value:function(t){var e=this.getMacro()[t],n=[].slice.call(arguments,1);if(w(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()))}:N};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=A(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();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=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.getExtend()&&L(r,i)?r[i]:r[i]=e}}),"each",{value:function(t,e){m(t)&&(t=this.get(t,[])),C(t,e)},writable:!0}),"el",{value:function(t,e,n){n=w(n)?this.fn(n)():n,this.echo(Promise.resolve(n).then((function(n){return at(t,e,n)})))},writable:!0}),f(n,"ui",{value:function(t){},writable:!0}))),v}(t,e))}},{key:"helpers",value:function(t){A(o(yt,this).prototype,t||{})}}])}(),dt=new WeakMap,bt=new WeakMap,wt=new WeakMap,mt=new WeakMap,kt=new WeakMap,Et=new WeakMap,jt=new WeakSet,Ot=function(){return a((function t(e){i(this,t),s(this,jt),u(this,dt,{}),u(this,bt,{}),u(this,wt,void 0),u(this,mt,void 0),u(this,kt,void 0),u(this,Et,void 0),_(o(dt,this),e||{}),c(wt,this,new gt(o(dt,this),o(bt,this))),c(mt,this,new X(o(dt,this))),c(kt,this,new D(o(dt,this))),c(Et,this,new Z(o(dt,this),o(kt,this),o(mt,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 _(o(dt,this),t||{}),o(wt,this).configure(o(dt,this),o(bt,this)),o(mt,this).configure(o(dt,this)),o(kt,this).configure(o(dt,this)),o(Et,this).configure(o(dt,this)),o(dt,this)}},{key:"render",value:function(t,n){var r=this,i=R(t,o(dt,this).extension),u=this.context(n);return e(jt,this,xt).call(this,i,u).then((function(t){if(u.getExtend()){u.setExtend(!1);var e=u.getLayout(),n=u.clone();return r.render(e,n)}return t}))}},{key:"helpers",value:function(t){o(wt,this).helpers(A(o(bt,this),t))}},{key:"context",value:function(t){return o(wt,this).create(t)}},{key:"compile",value:function(t,e){return o(mt,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)}},{key:"require",value:function(t){var n=R(t,o(dt,this).extension),r=this.context({});return e(jt,this,xt).call(this,n,r).then((function(){return r.getMacro()}))}}])}();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 w(e[t])})).map((function(t){return e[t].bind(e)})));return o(Et,this).get(t).then((function(t){return t.apply(e,r)}))}var Mt=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 ft(t)}))}}),St=Mt.render,Pt=Mt.context,Ft=Mt.compile,Tt=Mt.helpers,Wt=Mt.preload,Bt=Mt.configure,Rt=Mt.create;t.TemplateError=ft,t.TemplateNotFound=ht,t.TemplateSyntaxError=lt,t.compile=Ft,t.configure=Bt,t.context=Pt,t.create=Rt,t.helpers=Tt,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 s(t,e){r(t,e),e.add(t)}function a(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)},w=function(t){return"function"==typeof t},m=function(t){return"string"==typeof t},k=function(t){return"boolean"==typeof t},E=function(t){return void 0===t},j="[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")},M=P(x),S=P(O),F=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(M,(function(t){return x[t]}))},T=function(t,e){var n=t;return null==n?"":!0===Boolean(e)?F(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(w(r.toJSON)&&(r=r.toJSON()),n&&!1===r.hasOwnProperty(c)){r={};break}r=r[c]=r[c]||{}}return w(r.toJSON)&&(r=r.toJSON()),[r,o]},R=function(t,e){var n=t.split(".").pop();return n!==e&&(t=[t,e].join(".")),t},A=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)},N=function(){},C=function(t,e){var n;for(n in t)L(t,n)&&e(t[n],n,t)},$=function(t,e){return function(t,e){var n=t instanceof Array,r=n?[]:{};return C(t,(function(t,i,o){var u=e(t,i,o);!1===E(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)},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]+?)"}},_=function(t,e){A(t,{path:d(m,U.path,t.path,e.path),export:d(m,U.export,t.export,e.export),resolver:d(w,U.resolver,t.resolver,e.resolver),extension:d(m,U.extension,t.extension,e.extension),withObject:d(k,U.withObject,t.withObject,e.withObject),rmWhitespace:d(k,U.rmWhitespace,t.rmWhitespace,e.rmWhitespace),cache:d(k,U.cache,t.cache,e.cache),token:A({},U.token,t.token,e.token),vars:A({},U.vars,t.vars,e.vars),globalHelpers:d(b,U.globalHelpers,t.globalHelpers,e.globalHelpers)})},H="undefined"!=typeof globalThis?globalThis:window||self,q=new WeakMap,J=new WeakMap,D=function(){return a((function t(e){i(this,t),u(this,q,!0),u(this,J,{}),this.configure(e)}),[{key:"load",value:function(t){o(q,this)&&A(o(J,this),t||{})}},{key:"get",value:function(t){if(o(q,this))return o(J,this)[t]}},{key:"set",value:function(t,e){o(q,this)&&(o(J,this)[t]=e)}},{key:"exist",value:function(t){return L(o(J,this),t)}},{key:"clear",value:function(){c(J,this,{})}},{key:"remove",value:function(t){delete o(J,this)[t]}},{key:"resolve",value:function(t){return Promise.resolve(this.get(t))}},{key:"configure",value:function(t){c(q,this,t.cache),!1===j&&this.load(H[t.export])}}])}(),K=new WeakMap,V=new WeakMap,X=function(){return a((function t(e){i(this,t),u(this,K,{}),u(this,V,[{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(K,this).withObject=t.withObject,o(K,this).rmWhitespace=t.rmWhitespace,o(K,this).token=t.token,o(K,this).vars=t.vars,o(K,this).globalHelpers=t.globalHelpers,o(K,this).matches=[],o(K,this).formats=[],o(K,this).slurp={match:"[s\t\n]*",start:[o(K,this).token.start,"_"],end:["_",o(K,this).token.end]},o(V,this).forEach((function(t){o(K,e).matches.push(o(K,e).token.start.concat(t.symbol).concat(o(K,e).token.regex).concat(o(K,e).token.end)),o(K,e).formats.push(t.format.bind(o(K,e).vars))})),o(K,this).regex=new RegExp(o(K,this).matches.join("|").concat("|$"),"g"),o(K,this).slurpStart=new RegExp([o(K,this).slurp.match,o(K,this).slurp.start.join("")].join(""),"gm"),o(K,this).slurpEnd=new RegExp([o(K,this).slurp.end.join(""),o(K,this).slurp.match].join(""),"gm")}},{key:"compile",value:function(t,e){var n=this,r=o(K,this).vars,i=r.SCOPE,u=r.SAFE,c=r.BUFFER,s=r.COMPONENT,a=r.ELEMENT,f=o(K,this).globalHelpers;o(K,this).rmWhitespace&&(t=String(t).replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),t=String(t).replace(o(K,this).slurpStart,o(K,this).token.start).replace(o(K,this).slurpEnd,o(K,this).token.end);var h,l,p,v="".concat(c,"('");h=o(K,this).regex,l=function(e,r,i){v+=(""+t.slice(r,i)).replace(S,(function(t){return"\\"+O[t]})),e.forEach((function(t,e){t&&(v+=o(K,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(K,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,s,a].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}}])}(),Y=new WeakMap,z=new WeakMap,G=new WeakMap,I=new WeakMap,Q=new WeakSet,Z=function(){return a((function t(e,n,r){i(this,t),s(this,Q),u(this,Y,void 0),u(this,z,void 0),u(this,G,void 0),u(this,I,void 0),W(n,D),W(r,X),c(z,this,n),c(G,this,r),this.configure(e)}),[{key:"configure",value:function(t){c(Y,this,t.path),w(t.resolver)&&c(I,this,t.resolver)}},{key:"get",value:function(t){var n=this;return o(z,this).exist(t)?o(z,this).resolve(t):e(Q,this,tt).call(this,t).then((function(r){return e(Q,n,et).call(n,t,e(Q,n,nt).call(n,r,t))}))}}])}();function tt(t){return o(I,this).call(this,o(Y,this),t)}function et(t,e){return o(z,this).set(t,e),e}function nt(t,e){return w(t)?t:o(G,this).compile(t,e)}var rt=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],it=" ",ot='"',ut="/",ct="<",st=">",at=function(t,e,n){var r=[],i=-1===rt.indexOf(t),o=function(t,e){var n=[];return C(t,(function(t,r,i){var o=e(t,r,i);!1===E(o)&&n.push(o)})),n}(e,(function(t,e){if(null!=t)return[F(e),[ot,F(t),ot].join("")].join("=")})).join(it);return r.push([ct,t,it,o,st].join("")),n&&i&&r.push(n instanceof Array?n.join(""):n),i&&r.push([ct,ut,t,st].join("")),r.join("")},ft=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),a(e,[{key:"getCode",value:function(){return this.code}},{key:"getMessage",value:function(){return this.message}},{key:"toString",value:function(){return this.getMessage()}}])}(g(Error)),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",404),t}return l(e,t),a(e)}(ft),lt=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),a(e)}(ft);function pt(t){return Promise.all(t||[]).then((function(t){return t.join("")})).catch((function(t){return t}))}function vt(){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(),pt(n)},n.error=function(t){return e=t,Promise.reject(new lt(e.message));var e},n.end=function(){return pt(e)},n}var yt=new WeakMap,gt=function(){return a((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,s=n.SAFE,a=n.SCOPE,f=n.COMPONENT,h=n.ELEMENT;function l(t){this[r]={},this[i]={},Object.assign(this,$(t,[a,c,s,f,h]))}return Object.assign(l.prototype,e),Object.defineProperty(l.prototype,c,{value:vt()}),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.defineProperties(l.prototype,{useSafeValue:{get:function(){return T}},useComponent:{get:function(){return w(this[f])?this[f].bind(this):function(){throw new Error("".concat(f," must be a function"))}}},useElement:{get:function(){return w(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){this[o]=t}},getExtend:{value:function(){return this[o]}},setLayout:{value:function(t){this[u]=t}},getLayout:{value:function(){return this[u]}},clone:{value:function(t){var e=[u,o,c];return!0===t&&e.push(r),$(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(w(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(w(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()))}:N};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=A(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();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=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.getExtend()&&L(r,i)?r[i]:r[i]=e}},each:{value:function(t,e){m(t)&&(t=this.get(t,[])),C(t,e)},writable:!0},el:{value:function(t,e,n){n=w(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){A(o(yt,this).prototype,t||{})}}])}(),dt=new WeakMap,bt=new WeakMap,wt=new WeakMap,mt=new WeakMap,kt=new WeakMap,Et=new WeakMap,jt=new WeakSet,Ot=function(){return a((function t(e){i(this,t),s(this,jt),u(this,dt,{}),u(this,bt,{}),u(this,wt,void 0),u(this,mt,void 0),u(this,kt,void 0),u(this,Et,void 0),_(o(dt,this),e||{}),c(wt,this,new gt(o(dt,this),o(bt,this))),c(mt,this,new X(o(dt,this))),c(kt,this,new D(o(dt,this))),c(Et,this,new Z(o(dt,this),o(kt,this),o(mt,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 _(o(dt,this),t||{}),o(wt,this).configure(o(dt,this),o(bt,this)),o(mt,this).configure(o(dt,this)),o(kt,this).configure(o(dt,this)),o(Et,this).configure(o(dt,this)),o(dt,this)}},{key:"render",value:function(t,n){var r=this,i=R(t,o(dt,this).extension),u=this.context(n);return e(jt,this,xt).call(this,i,u).then((function(t){if(u.getExtend()){u.setExtend(!1);var e=u.getLayout(),n=u.clone();return r.render(e,n)}return t}))}},{key:"helpers",value:function(t){o(wt,this).helpers(A(o(bt,this),t))}},{key:"context",value:function(t){return o(wt,this).create(t)}},{key:"compile",value:function(t,e){return o(mt,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)}},{key:"require",value:function(t){var n=R(t,o(dt,this).extension),r=this.context({});return e(jt,this,xt).call(this,n,r).then((function(){return r.getMacro()}))}}])}();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 w(e[t])})).map((function(t){return e[t].bind(e)})));return o(Et,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 ft(t)}))}}),Mt=Pt.render,St=Pt.context,Ft=Pt.compile,Tt=Pt.helpers,Wt=Pt.preload,Bt=Pt.configure,Rt=Pt.create;t.TemplateError=ft,t.TemplateNotFound=ht,t.TemplateSyntaxError=lt,t.compile=Ft,t.configure=Bt,t.context=St,t.create=Rt,t.helpers=Tt,t.preload=Wt,t.render=Mt}));
|