@kosatyi/ejs 0.0.79 → 0.0.80

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.
@@ -385,33 +385,27 @@
385
385
  this.configure(config);
386
386
  }
387
387
 
388
- function _defineProperty(obj, key, value) {
389
- key = _toPropertyKey(key);
390
- if (key in obj) {
391
- Object.defineProperty(obj, key, {
392
- value: value,
393
- enumerable: true,
394
- configurable: true,
395
- writable: true
396
- });
397
- } else {
398
- obj[key] = value;
399
- }
400
- return obj;
388
+ function _defineProperty(e, r, t) {
389
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
390
+ value: t,
391
+ enumerable: !0,
392
+ configurable: !0,
393
+ writable: !0
394
+ }) : e[r] = t, e;
401
395
  }
402
- function _toPrimitive(input, hint) {
403
- if (typeof input !== "object" || input === null) return input;
404
- var prim = input[Symbol.toPrimitive];
405
- if (prim !== undefined) {
406
- var res = prim.call(input, hint || "default");
407
- if (typeof res !== "object") return res;
396
+ function _toPrimitive(t, r) {
397
+ if ("object" != typeof t || !t) return t;
398
+ var e = t[Symbol.toPrimitive];
399
+ if (void 0 !== e) {
400
+ var i = e.call(t, r || "default");
401
+ if ("object" != typeof i) return i;
408
402
  throw new TypeError("@@toPrimitive must return a primitive value.");
409
403
  }
410
- return (hint === "string" ? String : Number)(input);
404
+ return ("string" === r ? String : Number)(t);
411
405
  }
412
- function _toPropertyKey(arg) {
413
- var key = _toPrimitive(arg, "string");
414
- return typeof key === "symbol" ? key : String(key);
406
+ function _toPropertyKey(t) {
407
+ var i = _toPrimitive(t, "string");
408
+ return "symbol" == typeof i ? i : i + "";
415
409
  }
416
410
 
417
411
  var selfClosed = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
@@ -524,46 +518,46 @@
524
518
  extend(this, data || {});
525
519
  }
526
520
  Scope.prototype = extend({}, methods || {});
527
- Object.defineProperties(Scope.prototype, (_Object$definePropert = {}, _defineProperty(_Object$definePropert, BUFFER, {
521
+ Object.defineProperties(Scope.prototype, (_Object$definePropert = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, BUFFER, {
528
522
  value: createBuffer(),
529
523
  writable: true,
530
524
  configurable: false,
531
525
  enumerable: false
532
- }), _defineProperty(_Object$definePropert, BLOCKS, {
526
+ }), BLOCKS, {
533
527
  value: {},
534
528
  writable: true,
535
529
  configurable: false,
536
530
  enumerable: false
537
- }), _defineProperty(_Object$definePropert, MACRO, {
531
+ }), MACRO, {
538
532
  value: {},
539
533
  writable: true,
540
534
  configurable: false,
541
535
  enumerable: false
542
- }), _defineProperty(_Object$definePropert, LAYOUT, {
536
+ }), LAYOUT, {
543
537
  value: false,
544
538
  writable: true,
545
539
  configurable: false,
546
540
  enumerable: false
547
- }), _defineProperty(_Object$definePropert, EXTEND, {
541
+ }), EXTEND, {
548
542
  value: false,
549
543
  writable: true,
550
544
  configurable: false,
551
545
  enumerable: false
552
- }), _defineProperty(_Object$definePropert, "getMacro", {
546
+ }), "getMacro", {
553
547
  value: function value() {
554
548
  return this[MACRO];
555
549
  },
556
550
  writable: false,
557
551
  configurable: false,
558
552
  enumerable: false
559
- }), _defineProperty(_Object$definePropert, "getBuffer", {
553
+ }), "getBuffer", {
560
554
  value: function value() {
561
555
  return this[BUFFER];
562
556
  },
563
557
  writable: false,
564
558
  configurable: false,
565
559
  enumerable: false
566
- }), _defineProperty(_Object$definePropert, "getComponent", {
560
+ }), "getComponent", {
567
561
  value: function value() {
568
562
  var context = this;
569
563
  if (COMPONENT in context) {
@@ -578,42 +572,42 @@
578
572
  writable: false,
579
573
  configurable: false,
580
574
  enumerable: false
581
- }), _defineProperty(_Object$definePropert, "getBlocks", {
575
+ }), "getBlocks", {
582
576
  value: function value() {
583
577
  return this[BLOCKS];
584
578
  },
585
579
  writable: false,
586
580
  configurable: false,
587
581
  enumerable: false
588
- }), _defineProperty(_Object$definePropert, "setExtend", {
582
+ }), "setExtend", {
589
583
  value: function value(_value) {
590
584
  this[EXTEND] = _value;
591
585
  },
592
586
  writable: false,
593
587
  configurable: false,
594
588
  enumerable: false
595
- }), _defineProperty(_Object$definePropert, "getExtend", {
589
+ }), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "getExtend", {
596
590
  value: function value() {
597
591
  return this[EXTEND];
598
592
  },
599
593
  writable: false,
600
594
  configurable: false,
601
595
  enumerable: false
602
- }), _defineProperty(_Object$definePropert, "setLayout", {
596
+ }), "setLayout", {
603
597
  value: function value(layout) {
604
598
  this[LAYOUT] = layout;
605
599
  },
606
600
  writable: false,
607
601
  configurable: false,
608
602
  enumerable: false
609
- }), _defineProperty(_Object$definePropert, "getLayout", {
603
+ }), "getLayout", {
610
604
  value: function value() {
611
605
  return this[LAYOUT];
612
606
  },
613
607
  writable: false,
614
608
  configurable: false,
615
609
  enumerable: false
616
- }), _defineProperty(_Object$definePropert, "clone", {
610
+ }), "clone", {
617
611
  value: function value(exclude_blocks) {
618
612
  var filter = [LAYOUT, EXTEND, BUFFER];
619
613
  if (exclude_blocks === true) {
@@ -624,7 +618,7 @@
624
618
  writable: false,
625
619
  configurable: false,
626
620
  enumerable: false
627
- }), _defineProperty(_Object$definePropert, "extend", {
621
+ }), "extend", {
628
622
  value: function value(layout) {
629
623
  this.setExtend(true);
630
624
  this.setLayout(layout);
@@ -632,7 +626,7 @@
632
626
  writable: false,
633
627
  configurable: false,
634
628
  enumerable: false
635
- }), _defineProperty(_Object$definePropert, "echo", {
629
+ }), "echo", {
636
630
  value: function value(layout) {
637
631
  var buffer = this.getBuffer();
638
632
  var params = [].slice.call(arguments);
@@ -641,7 +635,7 @@
641
635
  writable: false,
642
636
  configurable: false,
643
637
  enumerable: false
644
- }), _defineProperty(_Object$definePropert, "fn", {
638
+ }), "fn", {
645
639
  value: function value(callback) {
646
640
  var buffer = this.getBuffer();
647
641
  var context = this;
@@ -656,7 +650,7 @@
656
650
  writable: false,
657
651
  configurable: false,
658
652
  enumerable: false
659
- }), _defineProperty(_Object$definePropert, "get", {
653
+ }), "get", {
660
654
  value: function value(name, defaults) {
661
655
  var path = getPath(this, name, true);
662
656
  var result = path.shift();
@@ -666,7 +660,7 @@
666
660
  writable: true,
667
661
  configurable: true,
668
662
  enumerable: false
669
- }), _defineProperty(_Object$definePropert, "set", {
663
+ }), "set", {
670
664
  value: function value(name, _value2) {
671
665
  var path = getPath(this, name, false);
672
666
  var result = path.shift();
@@ -679,7 +673,7 @@
679
673
  writable: false,
680
674
  configurable: false,
681
675
  enumerable: false
682
- }), _defineProperty(_Object$definePropert, "macro", {
676
+ }), "macro", {
683
677
  value: function value(name, callback) {
684
678
  var list = this.getMacro();
685
679
  var macro = this.fn(callback);
@@ -691,7 +685,7 @@
691
685
  writable: false,
692
686
  configurable: false,
693
687
  enumerable: false
694
- }), _defineProperty(_Object$definePropert, "call", {
688
+ }), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
695
689
  value: function value(name) {
696
690
  var list = this.getMacro();
697
691
  var macro = list[name];
@@ -703,7 +697,7 @@
703
697
  writable: false,
704
698
  configurable: false,
705
699
  enumerable: false
706
- }), _defineProperty(_Object$definePropert, "block", {
700
+ }), "block", {
707
701
  value: function value(name, callback) {
708
702
  var _this = this;
709
703
  var blocks = this.getBlocks();
@@ -714,29 +708,29 @@
714
708
  var current = function current() {
715
709
  return list.shift();
716
710
  };
717
- var next = function next() {
711
+ var _next = function next() {
718
712
  var parent = current();
719
713
  if (parent) {
720
714
  return function () {
721
- _this.echo(parent(next()));
715
+ _this.echo(parent(_next()));
722
716
  };
723
717
  } else {
724
718
  return noop;
725
719
  }
726
720
  };
727
- this.echo(current()(next()));
721
+ this.echo(current()(_next()));
728
722
  },
729
723
  writable: false,
730
724
  configurable: false,
731
725
  enumerable: false
732
- }), _defineProperty(_Object$definePropert, "hasBlock", {
726
+ }), "hasBlock", {
733
727
  value: function value(name) {
734
728
  return this.getBlocks().hasOwnProperty(name);
735
729
  },
736
730
  writable: false,
737
731
  configurable: false,
738
732
  enumerable: false
739
- }), _defineProperty(_Object$definePropert, "include", {
733
+ }), "include", {
740
734
  value: function value(path, data, cx) {
741
735
  var context = cx === false ? {} : this.clone(true);
742
736
  var params = extend(context, data || {});
@@ -746,7 +740,7 @@
746
740
  writable: false,
747
741
  configurable: false,
748
742
  enumerable: false
749
- }), _defineProperty(_Object$definePropert, "use", {
743
+ }), "use", {
750
744
  value: function value(path, namespace) {
751
745
  var promise = this.require(path);
752
746
  this.echo(resolve$1(promise, function (exports) {
@@ -759,7 +753,7 @@
759
753
  writable: false,
760
754
  configurable: false,
761
755
  enumerable: false
762
- }), _defineProperty(_Object$definePropert, "async", {
756
+ }), "async", {
763
757
  value: function value(promise, callback) {
764
758
  this.echo(resolve$1(promise, function (data) {
765
759
  return this.fn(callback)(data);
@@ -768,7 +762,7 @@
768
762
  writable: false,
769
763
  configurable: false,
770
764
  enumerable: false
771
- }), _defineProperty(_Object$definePropert, "each", {
765
+ }), "each", {
772
766
  value: function value(object, callback) {
773
767
  if (isString(object)) {
774
768
  object = this.get(object, []);
@@ -778,14 +772,14 @@
778
772
  writable: false,
779
773
  configurable: false,
780
774
  enumerable: false
781
- }), _defineProperty(_Object$definePropert, "element", {
775
+ }), "element", {
782
776
  value: function value(tag, attr, content) {
783
777
  return element(tag, attr, content);
784
778
  },
785
779
  writable: false,
786
780
  configurable: false,
787
781
  enumerable: false
788
- }), _defineProperty(_Object$definePropert, "el", {
782
+ }), "el", {
789
783
  value: function value(tag, attr, content) {
790
784
  if (isFunction(content)) {
791
785
  content = this.fn(content)();
@@ -797,7 +791,7 @@
797
791
  writable: false,
798
792
  configurable: false,
799
793
  enumerable: false
800
- }), _Object$definePropert));
794
+ })));
801
795
  };
802
796
  this.configure(config);
803
797
  }
@@ -829,7 +823,7 @@
829
823
  return scope.getMacro();
830
824
  });
831
825
  };
832
- var render = function render(name, data) {
826
+ var _render = function render(name, data) {
833
827
  var filepath = ext(name, config.extension);
834
828
  var scope = context.create(data);
835
829
  return output(filepath, scope).then(function (content) {
@@ -837,7 +831,7 @@
837
831
  scope.setExtend(false);
838
832
  var layout = scope.getLayout();
839
833
  var _data = scope.clone();
840
- return render(layout, _data);
834
+ return _render(layout, _data);
841
835
  }
842
836
  return content;
843
837
  });
@@ -852,7 +846,7 @@
852
846
  return config;
853
847
  };
854
848
  this.render = function (name, data) {
855
- return render(name, data);
849
+ return _render(name, data);
856
850
  };
857
851
  this.helpers = function (methods) {
858
852
  context.helpers(extend(scope, methods));
@@ -871,7 +865,7 @@
871
865
  };
872
866
  this.helpers({
873
867
  require: require,
874
- render: render
868
+ render: _render
875
869
  });
876
870
  return this;
877
871
  }
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ejs={})}(this,(function(e){"use strict";var t=function(){var e=[].slice.call(arguments),t=e.shift();return e.filter(t).pop()},n=function(e){return Array.isArray(e)},r=function(e){return"function"==typeof e},i=function(e){return"string"==typeof e},o=function(e){return"boolean"==typeof e},u=function(e){return void 0===e},c="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),a={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},l={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"},s=function(e){return new RegExp(["[",Object.keys(e).join(""),"]"].join(""),"g")},f=s(l),h=s(a),p=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(f,(function(e){return l[e]}))},b=function(e,t){var n=e;return null==n?"":!0===t?p(n):n},g=function(e,t){return Boolean(e instanceof t)},v=function(e,t,n){for(var i=e,o=String(t).split("."),u=o.pop(),c=0;c<o.length;c++){var a=o[c];if(r(i.toJSON)&&(i=i.toJSON()),n&&!1===i.hasOwnProperty(a)){i={};break}i=i[a]=i[a]||{}}return r(i.toJSON)&&(i=i.toJSON()),[i,u]},m=function(e,t){var n=e.split(".").pop();return n!==t&&(e=[e,t].join(".")),e},d=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.filter((function(e){return e})).reduce((function(e,t){return Object.assign(e,t)}),e)},w=function(){},y=function(e,t){var n;for(n in e)O(e,n)&&t(e[n],n,e)},j=function(e,t){return function(e,t){var n=e instanceof Array,r=n?[]:{};return y(e,(function(e,i,o){var c=t(e,i,o);!1===u(c)&&(n?r.push(c):r[i]=c)})),r}(e,(function(e,n){if(-1===t.indexOf(n))return e}))},E=function(e,t,n){return Promise.resolve(e).then(t.bind(n))},O=function(e,t){return e&&e.hasOwnProperty(t)},x={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(e,t){return Promise.resolve(["resolver is not defined",e,t].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},k=function(e,u){d(e,{path:t(i,x.path,e.path,u.path),export:t(i,x.export,e.export,u.export),resolver:t(r,x.resolver,e.resolver,u.resolver),extension:t(i,x.extension,e.extension,u.extension),withObject:t(o,x.withObject,e.withObject,u.withObject),rmWhitespace:t(o,x.rmWhitespace,e.rmWhitespace,u.rmWhitespace),cache:t(o,x.cache,e.cache,u.cache),token:d({},x.token,e.token,u.token),vars:d({},x.vars,e.vars,u.vars),globalHelpers:t(n,x.globalHelpers,e.globalHelpers,u.globalHelpers)})},F="undefined"!=typeof globalThis?globalThis:window||self;function S(e){if(!1===g(this,S))return new S;var t={enabled:!0,list:{}};this.configure=function(e){t.enabled=e.cache,!1===c&&this.load(F[e.export])},this.clear=function(){t.list={}},this.load=function(e){return t.enabled&&d(t.list,e||{}),this},this.get=function(e){if(t.enabled)return t.list[e]},this.set=function(e,n){return t.enabled&&(t.list[e]=n),this},this.resolve=function(e){return Promise.resolve(this.get(e))},this.remove=function(e){delete t.list[e]},this.exist=function(e){return O(t.list,e)}}var P=[{symbol:"-",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(e){return"')\n/**".concat(e,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(e){return"')\n".concat(e.trim(),"\n").concat(this.BUFFER,"('")}}];function B(e){if(!1===g(this,B))return new B(e);var t={};this.configure=function(e){t.withObject=e.withObject,t.rmWhitespace=e.rmWhitespace,t.token=e.token,t.vars=e.vars,t.globalHelpers=e.globalHelpers,t.matches=[],t.formats=[],t.slurp={match:"[ \\t]*",start:[t.token.start,"_"],end:["_",t.token.end]},P.forEach((function(e){t.matches.push(t.token.start.concat(e.symbol).concat(t.token.regex).concat(t.token.end)),t.formats.push(e.format.bind(t.vars))})),t.regex=new RegExp(t.matches.join("|").concat("|$"),"g"),t.slurpStart=new RegExp([t.slurp.match,t.slurp.start.join("")].join(""),"gm"),t.slurpEnd=new RegExp([t.slurp.end.join(""),t.slurp.match].join(""),"gm")},this.compile=function(e,n){var r=t.vars,i=r.SCOPE,o=r.SAFE,u=r.BUFFER,c=r.COMPONENT,l=t.globalHelpers;e=String(e),t.rmWhitespace&&(e=e.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),e=e.replace(t.slurpStart,t.token.start).replace(t.slurpEnd,t.token.end);var s,f,p,b="".concat(u,"('");s=t.regex,f=function(n,r,i){b+=(""+e.slice(r,i)).replace(h,(function(e){return"\\"+a[e]})),n.forEach((function(e,n){e&&(b+=t.formats[n](e))}))},p=0,e.replace(s,(function(){var e=[].slice.call(arguments,0,-1),t=e.pop(),n=e.shift();return f(e,p,t),p=t+n.length,n})),b="try{".concat(b+="');","}catch(e){return ").concat(u,".error(e)}"),t.withObject&&(b="with(".concat(i,"){").concat(b,"}")),b="".concat(u,".start();").concat(b,"return ").concat(u,".end();"),b+="\n//# sourceURL=".concat(n);var g=null,v=[i,c,u,o].concat(l);try{(g=Function.apply(null,v.concat(b))).source="(function(".concat(v.join(","),"){\n").concat(b,"\n})")}catch(e){throw e.filename=n,e.source=b,e}return g},this.configure(e)}function T(e,t,n){if(!1===g(this,T))return new T(e,t,n);if(!1===g(t,S))throw new TypeError("cache is not instance of Cache");if(!1===g(n,B))throw new TypeError("compiler is not instance of Compiler");var i={},o=function(e){return i.resolver(i.path,e)};this.configure=function(e){i.path=e.path,i.cache=e.cache,r(e.resolver)&&(i.resolver=e.resolver)},this.get=function(e){return t.exist(e)?t.resolve(e):o(e).then((function(i){return function(e,n){return t.set(e,n),n}(e,function(e,t){return r(e)?e:n.compile(e,t)}(i,e))}))},this.configure(e)}function R(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var N=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],$=" ",A='"',C="/",U="<",M=">",H=function(e,t,n){var r=[],i=-1===N.indexOf(e),o=function(e,t){var n=[];return y(e,(function(e,r,i){var o=t(e,r,i);!1===u(o)&&n.push(o)})),n}(t,(function(e,t){if(null!=e)return[p(t),[A,p(e),A].join("")].join("=")})).join($);return r.push([U,e,$,o,M].join("")),n&&r.push(n instanceof Array?n.join(""):n),i&&r.push([U,C,e,M].join("")),r.join("")};function L(e){this.code=1,this.name="TemplateError",this.message=e,Error.call(this)}function W(e){L.call(this),this.code=404,this.name="TemplateNotFound",this.message=e}function J(e){L.call(this),this.code=500,this.name="TemplateSyntaxError",this.message=e}function q(e){return Promise.all(e||[]).then((function(e){return e.join("")}))}function D(){var e=[],t=[];function n(e){t.push(e)}return n.start=function(){t=[]},n.backup=function(){e.push(t.concat()),t=[]},n.restore=function(){var n=t.concat();return t=e.pop(),q(n)},n.error=function(e){return t=e,Promise.reject(new J(t.message));var t},n.end=function(){return q(t)},n}function K(e){if(!1===g(this,K))return new K(e);this.configure=function(e,t){var n,o=e.vars,u=o.BLOCKS,c=o.MACRO,a=o.EXTEND,l=o.LAYOUT,s=o.BUFFER,f=o.COMPONENT;function h(e){this[u]={},this[c]={},d(this,e||{})}this.create=function(e){return new h(e)},this.helpers=function(e){d(h.prototype,e||{})},h.prototype=d({},t||{}),Object.defineProperties(h.prototype,(R(n={},s,{value:D(),writable:!0,configurable:!1,enumerable:!1}),R(n,u,{value:{},writable:!0,configurable:!1,enumerable:!1}),R(n,c,{value:{},writable:!0,configurable:!1,enumerable:!1}),R(n,l,{value:!1,writable:!0,configurable:!1,enumerable:!1}),R(n,a,{value:!1,writable:!0,configurable:!1,enumerable:!1}),R(n,"getMacro",{value:function(){return this[c]},writable:!1,configurable:!1,enumerable:!1}),R(n,"getBuffer",{value:function(){return this[s]},writable:!1,configurable:!1,enumerable:!1}),R(n,"getComponent",{value:function(){var e=this;return f in e?function(){return e[f].apply(e,arguments)}:function(){console.log("%s function not defined",f)}},writable:!1,configurable:!1,enumerable:!1}),R(n,"getBlocks",{value:function(){return this[u]},writable:!1,configurable:!1,enumerable:!1}),R(n,"setExtend",{value:function(e){this[a]=e},writable:!1,configurable:!1,enumerable:!1}),R(n,"getExtend",{value:function(){return this[a]},writable:!1,configurable:!1,enumerable:!1}),R(n,"setLayout",{value:function(e){this[l]=e},writable:!1,configurable:!1,enumerable:!1}),R(n,"getLayout",{value:function(){return this[l]},writable:!1,configurable:!1,enumerable:!1}),R(n,"clone",{value:function(e){var t=[l,a,s];return!0===e&&t.push(u),j(this,t)},writable:!1,configurable:!1,enumerable:!1}),R(n,"extend",{value:function(e){this.setExtend(!0),this.setLayout(e)},writable:!1,configurable:!1,enumerable:!1}),R(n,"echo",{value:function(e){var t=this.getBuffer();[].slice.call(arguments).forEach(t)},writable:!1,configurable:!1,enumerable:!1}),R(n,"fn",{value:function(e){var t=this.getBuffer(),n=this;return function(){return t.backup(),r(e)&&e.apply(n,arguments),t.restore()}},writable:!1,configurable:!1,enumerable:!1}),R(n,"get",{value:function(e,t){var n=v(this,e,!0),r=n.shift(),i=n.pop();return O(r,i)?r[i]:t},writable:!0,configurable:!0,enumerable:!1}),R(n,"set",{value:function(e,t){var n=v(this,e,!1),r=n.shift(),i=n.pop();return this.getExtend()&&O(r,i)?r[i]:r[i]=t},writable:!1,configurable:!1,enumerable:!1}),R(n,"macro",{value:function(e,t){var n=this.getMacro(),r=this.fn(t),i=this;n[e]=function(){return i.echo(r.apply(void 0,arguments))}},writable:!1,configurable:!1,enumerable:!1}),R(n,"call",{value:function(e){var t=this.getMacro()[e],n=[].slice.call(arguments,1);if(r(t))return t.apply(t,n)},writable:!1,configurable:!1,enumerable:!1}),R(n,"block",{value:function(e,t){var n=this,r=this.getBlocks();if(r[e]=r[e]||[],r[e].push(this.fn(t)),!this.getExtend()){var i=Object.assign([],r[e]),o=function(){return i.shift()};this.echo(o()(function e(){var t=o();return t?function(){n.echo(t(e()))}:w}()))}},writable:!1,configurable:!1,enumerable:!1}),R(n,"hasBlock",{value:function(e){return this.getBlocks().hasOwnProperty(e)},writable:!1,configurable:!1,enumerable:!1}),R(n,"include",{value:function(e,t,n){var r=!1===n?{}:this.clone(!0),i=d(r,t||{}),o=this.render(e,i);this.echo(o)},writable:!1,configurable:!1,enumerable:!1}),R(n,"use",{value:function(e,t){var n=this.require(e);this.echo(E(n,(function(e){var n=this.getMacro();y(e,(function(e,r){n[[t,r].join(".")]=e}))}),this))},writable:!1,configurable:!1,enumerable:!1}),R(n,"async",{value:function(e,t){this.echo(E(e,(function(e){return this.fn(t)(e)}),this))},writable:!1,configurable:!1,enumerable:!1}),R(n,"each",{value:function(e,t){i(e)&&(e=this.get(e,[])),y(e,t)},writable:!1,configurable:!1,enumerable:!1}),R(n,"element",{value:function(e,t,n){return H(e,t,n)},writable:!1,configurable:!1,enumerable:!1}),R(n,"el",{value:function(e,t,n){r(n)&&(n=this.fn(n)()),this.echo(E(n,(function(n){return this.element(e,t,n)}),this))},writable:!1,configurable:!1,enumerable:!1}),n))},this.configure(e)}Object.setPrototypeOf(W.prototype,Error.prototype),Object.setPrototypeOf(W.prototype,L.prototype),Object.setPrototypeOf(J.prototype,L.prototype);var X=new function e(t){if(!1===g(this,e))return new e(t);var n={},i={};k(i,t||{});var o=new K(i),u=new B(i),c=new S,a=new T(i,c,u),l=function(e,t){var n=i.globalHelpers,o=[t,t.getComponent(),t.getBuffer(),b].concat(n.filter((function(e){return r(t[e])})).map((function(e){return t[e].bind(t)})));return a.get(e).then((function(e){return e.apply(t,o)}))},s=function e(t,n){var r=m(t,i.extension),u=o.create(n);return l(r,u).then((function(t){if(u.getExtend()){u.setExtend(!1);var n=u.getLayout(),r=u.clone();return e(n,r)}return t}))};return this.configure=function(e){return k(i,e=e||{}),o.configure(i,n),u.configure(i),c.configure(i),a.configure(i),i},this.render=function(e,t){return s(e,t)},this.helpers=function(e){o.helpers(d(n,e))},this.preload=function(e){return c.load(e||{})},this.create=function(t){return new e(t)},this.compile=function(e,t){return u.compile(e,t)},this.context=function(e){return o.create(e)},this.helpers({require:function(e){var t=m(e,i.extension),n=o.create({});return l(t,n).then((function(){return n.getMacro()}))},render:s}),this}({resolver:function(e,t){return fetch(function(e,t){return(t=[e,t].join("/")).replace(/\/\//g,"/")}(e,t)).then((function(e){return e.text()}),(function(e){return new L(e)}))}}),Y=X.render,_=X.context,z=X.compile,G=X.helpers,I=X.preload,Q=X.configure,V=X.create;e.compile=z,e.configure=Q,e.context=_,e.create=V,e.helpers=G,e.preload=I,e.render=Y}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ejs={})}(this,(function(e){"use strict";var t=function(){var e=[].slice.call(arguments),t=e.shift();return e.filter(t).pop()},n=function(e){return Array.isArray(e)},r=function(e){return"function"==typeof e},i=function(e){return"string"==typeof e},o=function(e){return"boolean"==typeof e},u=function(e){return void 0===e},c="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),a={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},l={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"},s=function(e){return new RegExp(["[",Object.keys(e).join(""),"]"].join(""),"g")},f=s(l),h=s(a),p=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(f,(function(e){return l[e]}))},b=function(e,t){var n=e;return null==n?"":!0===t?p(n):n},g=function(e,t){return Boolean(e instanceof t)},v=function(e,t,n){for(var i=e,o=String(t).split("."),u=o.pop(),c=0;c<o.length;c++){var a=o[c];if(r(i.toJSON)&&(i=i.toJSON()),n&&!1===i.hasOwnProperty(a)){i={};break}i=i[a]=i[a]||{}}return r(i.toJSON)&&(i=i.toJSON()),[i,u]},m=function(e,t){var n=e.split(".").pop();return n!==t&&(e=[e,t].join(".")),e},d=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.filter((function(e){return e})).reduce((function(e,t){return Object.assign(e,t)}),e)},w=function(){},y=function(e,t){var n;for(n in e)O(e,n)&&t(e[n],n,e)},j=function(e,t){return function(e,t){var n=e instanceof Array,r=n?[]:{};return y(e,(function(e,i,o){var c=t(e,i,o);!1===u(c)&&(n?r.push(c):r[i]=c)})),r}(e,(function(e,n){if(-1===t.indexOf(n))return e}))},E=function(e,t,n){return Promise.resolve(e).then(t.bind(n))},O=function(e,t){return e&&e.hasOwnProperty(t)},x={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(e,t){return Promise.resolve(["resolver is not defined",e,t].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},k=function(e,u){d(e,{path:t(i,x.path,e.path,u.path),export:t(i,x.export,e.export,u.export),resolver:t(r,x.resolver,e.resolver,u.resolver),extension:t(i,x.extension,e.extension,u.extension),withObject:t(o,x.withObject,e.withObject,u.withObject),rmWhitespace:t(o,x.rmWhitespace,e.rmWhitespace,u.rmWhitespace),cache:t(o,x.cache,e.cache,u.cache),token:d({},x.token,e.token,u.token),vars:d({},x.vars,e.vars,u.vars),globalHelpers:t(n,x.globalHelpers,e.globalHelpers,u.globalHelpers)})},F="undefined"!=typeof globalThis?globalThis:window||self;function P(e){if(!1===g(this,P))return new P;var t={enabled:!0,list:{}};this.configure=function(e){t.enabled=e.cache,!1===c&&this.load(F[e.export])},this.clear=function(){t.list={}},this.load=function(e){return t.enabled&&d(t.list,e||{}),this},this.get=function(e){if(t.enabled)return t.list[e]},this.set=function(e,n){return t.enabled&&(t.list[e]=n),this},this.resolve=function(e){return Promise.resolve(this.get(e))},this.remove=function(e){delete t.list[e]},this.exist=function(e){return O(t.list,e)}}var S=[{symbol:"-",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(e){return"')\n/**".concat(e,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(e){return"')\n".concat(e.trim(),"\n").concat(this.BUFFER,"('")}}];function B(e){if(!1===g(this,B))return new B(e);var t={};this.configure=function(e){t.withObject=e.withObject,t.rmWhitespace=e.rmWhitespace,t.token=e.token,t.vars=e.vars,t.globalHelpers=e.globalHelpers,t.matches=[],t.formats=[],t.slurp={match:"[ \\t]*",start:[t.token.start,"_"],end:["_",t.token.end]},S.forEach((function(e){t.matches.push(t.token.start.concat(e.symbol).concat(t.token.regex).concat(t.token.end)),t.formats.push(e.format.bind(t.vars))})),t.regex=new RegExp(t.matches.join("|").concat("|$"),"g"),t.slurpStart=new RegExp([t.slurp.match,t.slurp.start.join("")].join(""),"gm"),t.slurpEnd=new RegExp([t.slurp.end.join(""),t.slurp.match].join(""),"gm")},this.compile=function(e,n){var r=t.vars,i=r.SCOPE,o=r.SAFE,u=r.BUFFER,c=r.COMPONENT,l=t.globalHelpers;e=String(e),t.rmWhitespace&&(e=e.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),e=e.replace(t.slurpStart,t.token.start).replace(t.slurpEnd,t.token.end);var s,f,p,b="".concat(u,"('");s=t.regex,f=function(n,r,i){b+=(""+e.slice(r,i)).replace(h,(function(e){return"\\"+a[e]})),n.forEach((function(e,n){e&&(b+=t.formats[n](e))}))},p=0,e.replace(s,(function(){var e=[].slice.call(arguments,0,-1),t=e.pop(),n=e.shift();return f(e,p,t),p=t+n.length,n})),b="try{".concat(b+="');","}catch(e){return ").concat(u,".error(e)}"),t.withObject&&(b="with(".concat(i,"){").concat(b,"}")),b="".concat(u,".start();").concat(b,"return ").concat(u,".end();"),b+="\n//# sourceURL=".concat(n);var g=null,v=[i,c,u,o].concat(l);try{(g=Function.apply(null,v.concat(b))).source="(function(".concat(v.join(","),"){\n").concat(b,"\n})")}catch(e){throw e.filename=n,e.source=b,e}return g},this.configure(e)}function T(e,t,n){if(!1===g(this,T))return new T(e,t,n);if(!1===g(t,P))throw new TypeError("cache is not instance of Cache");if(!1===g(n,B))throw new TypeError("compiler is not instance of Compiler");var i={},o=function(e){return i.resolver(i.path,e)};this.configure=function(e){i.path=e.path,i.cache=e.cache,r(e.resolver)&&(i.resolver=e.resolver)},this.get=function(e){return t.exist(e)?t.resolve(e):o(e).then((function(i){return function(e,n){return t.set(e,n),n}(e,function(e,t){return r(e)?e:n.compile(e,t)}(i,e))}))},this.configure(e)}function R(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var N=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],$=" ",A='"',C="/",U="<",M=">",H=function(e,t,n){var r=[],i=-1===N.indexOf(e),o=function(e,t){var n=[];return y(e,(function(e,r,i){var o=t(e,r,i);!1===u(o)&&n.push(o)})),n}(t,(function(e,t){if(null!=e)return[p(t),[A,p(e),A].join("")].join("=")})).join($);return r.push([U,e,$,o,M].join("")),n&&r.push(n instanceof Array?n.join(""):n),i&&r.push([U,C,e,M].join("")),r.join("")};function L(e){this.code=1,this.name="TemplateError",this.message=e,Error.call(this)}function W(e){L.call(this),this.code=404,this.name="TemplateNotFound",this.message=e}function J(e){L.call(this),this.code=500,this.name="TemplateSyntaxError",this.message=e}function q(e){return Promise.all(e||[]).then((function(e){return e.join("")}))}function D(){var e=[],t=[];function n(e){t.push(e)}return n.start=function(){t=[]},n.backup=function(){e.push(t.concat()),t=[]},n.restore=function(){var n=t.concat();return t=e.pop(),q(n)},n.error=function(e){return t=e,Promise.reject(new J(t.message));var t},n.end=function(){return q(t)},n}function K(e){if(!1===g(this,K))return new K(e);this.configure=function(e,t){var n,o=e.vars,u=o.BLOCKS,c=o.MACRO,a=o.EXTEND,l=o.LAYOUT,s=o.BUFFER,f=o.COMPONENT;function h(e){this[u]={},this[c]={},d(this,e||{})}this.create=function(e){return new h(e)},this.helpers=function(e){d(h.prototype,e||{})},h.prototype=d({},t||{}),Object.defineProperties(h.prototype,(R(R(R(R(R(R(R(R(R(R(n={},s,{value:D(),writable:!0,configurable:!1,enumerable:!1}),u,{value:{},writable:!0,configurable:!1,enumerable:!1}),c,{value:{},writable:!0,configurable:!1,enumerable:!1}),l,{value:!1,writable:!0,configurable:!1,enumerable:!1}),a,{value:!1,writable:!0,configurable:!1,enumerable:!1}),"getMacro",{value:function(){return this[c]},writable:!1,configurable:!1,enumerable:!1}),"getBuffer",{value:function(){return this[s]},writable:!1,configurable:!1,enumerable:!1}),"getComponent",{value:function(){var e=this;return f in e?function(){return e[f].apply(e,arguments)}:function(){console.log("%s function not defined",f)}},writable:!1,configurable:!1,enumerable:!1}),"getBlocks",{value:function(){return this[u]},writable:!1,configurable:!1,enumerable:!1}),"setExtend",{value:function(e){this[a]=e},writable:!1,configurable:!1,enumerable:!1}),R(R(R(R(R(R(R(R(R(R(n,"getExtend",{value:function(){return this[a]},writable:!1,configurable:!1,enumerable:!1}),"setLayout",{value:function(e){this[l]=e},writable:!1,configurable:!1,enumerable:!1}),"getLayout",{value:function(){return this[l]},writable:!1,configurable:!1,enumerable:!1}),"clone",{value:function(e){var t=[l,a,s];return!0===e&&t.push(u),j(this,t)},writable:!1,configurable:!1,enumerable:!1}),"extend",{value:function(e){this.setExtend(!0),this.setLayout(e)},writable:!1,configurable:!1,enumerable:!1}),"echo",{value:function(e){var t=this.getBuffer();[].slice.call(arguments).forEach(t)},writable:!1,configurable:!1,enumerable:!1}),"fn",{value:function(e){var t=this.getBuffer(),n=this;return function(){return t.backup(),r(e)&&e.apply(n,arguments),t.restore()}},writable:!1,configurable:!1,enumerable:!1}),"get",{value:function(e,t){var n=v(this,e,!0),r=n.shift(),i=n.pop();return O(r,i)?r[i]:t},writable:!0,configurable:!0,enumerable:!1}),"set",{value:function(e,t){var n=v(this,e,!1),r=n.shift(),i=n.pop();return this.getExtend()&&O(r,i)?r[i]:r[i]=t},writable:!1,configurable:!1,enumerable:!1}),"macro",{value:function(e,t){var n=this.getMacro(),r=this.fn(t),i=this;n[e]=function(){return i.echo(r.apply(void 0,arguments))}},writable:!1,configurable:!1,enumerable:!1}),R(R(R(R(R(R(R(R(R(n,"call",{value:function(e){var t=this.getMacro()[e],n=[].slice.call(arguments,1);if(r(t))return t.apply(t,n)},writable:!1,configurable:!1,enumerable:!1}),"block",{value:function(e,t){var n=this,r=this.getBlocks();if(r[e]=r[e]||[],r[e].push(this.fn(t)),!this.getExtend()){var i=Object.assign([],r[e]),o=function(){return i.shift()},u=function(){var e=o();return e?function(){n.echo(e(u()))}:w};this.echo(o()(u()))}},writable:!1,configurable:!1,enumerable:!1}),"hasBlock",{value:function(e){return this.getBlocks().hasOwnProperty(e)},writable:!1,configurable:!1,enumerable:!1}),"include",{value:function(e,t,n){var r=!1===n?{}:this.clone(!0),i=d(r,t||{}),o=this.render(e,i);this.echo(o)},writable:!1,configurable:!1,enumerable:!1}),"use",{value:function(e,t){var n=this.require(e);this.echo(E(n,(function(e){var n=this.getMacro();y(e,(function(e,r){n[[t,r].join(".")]=e}))}),this))},writable:!1,configurable:!1,enumerable:!1}),"async",{value:function(e,t){this.echo(E(e,(function(e){return this.fn(t)(e)}),this))},writable:!1,configurable:!1,enumerable:!1}),"each",{value:function(e,t){i(e)&&(e=this.get(e,[])),y(e,t)},writable:!1,configurable:!1,enumerable:!1}),"element",{value:function(e,t,n){return H(e,t,n)},writable:!1,configurable:!1,enumerable:!1}),"el",{value:function(e,t,n){r(n)&&(n=this.fn(n)()),this.echo(E(n,(function(n){return this.element(e,t,n)}),this))},writable:!1,configurable:!1,enumerable:!1})))},this.configure(e)}Object.setPrototypeOf(W.prototype,Error.prototype),Object.setPrototypeOf(W.prototype,L.prototype),Object.setPrototypeOf(J.prototype,L.prototype);var X=new function e(t){if(!1===g(this,e))return new e(t);var n={},i={};k(i,t||{});var o=new K(i),u=new B(i),c=new P,a=new T(i,c,u),l=function(e,t){var n=i.globalHelpers,o=[t,t.getComponent(),t.getBuffer(),b].concat(n.filter((function(e){return r(t[e])})).map((function(e){return t[e].bind(t)})));return a.get(e).then((function(e){return e.apply(t,o)}))},s=function(e,t){var n=m(e,i.extension),r=o.create(t);return l(n,r).then((function(e){if(r.getExtend()){r.setExtend(!1);var t=r.getLayout(),n=r.clone();return s(t,n)}return e}))};return this.configure=function(e){return k(i,e=e||{}),o.configure(i,n),u.configure(i),c.configure(i),a.configure(i),i},this.render=function(e,t){return s(e,t)},this.helpers=function(e){o.helpers(d(n,e))},this.preload=function(e){return c.load(e||{})},this.create=function(t){return new e(t)},this.compile=function(e,t){return u.compile(e,t)},this.context=function(e){return o.create(e)},this.helpers({require:function(e){var t=m(e,i.extension),n=o.create({});return l(t,n).then((function(){return n.getMacro()}))},render:s}),this}({resolver:function(e,t){return fetch(function(e,t){return(t=[e,t].join("/")).replace(/\/\//g,"/")}(e,t)).then((function(e){return e.text()}),(function(e){return new L(e)}))}}),Y=X.render,_=X.context,z=X.compile,G=X.helpers,I=X.preload,Q=X.configure,V=X.create;e.compile=z,e.configure=Q,e.context=_,e.create=V,e.helpers=G,e.preload=I,e.render=Y}));