@kosatyi/ejs 0.0.96 → 0.0.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +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},o=function(e){return"string"==typeof e},i=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"},s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"},l=function(e){return new RegExp(["[",Object.keys(e).join(""),"]"].join(""),"g")},f=l(s),h=l(a),p=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(f,(function(e){return s[e]}))},b=function(e,t){var n=e;return null==n?"":!0===Boolean(t)?p(n):n},g=function(e,t){return Boolean(e instanceof t)},v=function(e,t,n){for(var o=e,i=String(t).split("."),u=i.pop(),c=0;c<i.length;c++){var a=i[c];if(r(o.toJSON)&&(o=o.toJSON()),n&&!1===o.hasOwnProperty(a)){o={};break}o=o[a]=o[a]||{}}return r(o.toJSON)&&(o=o.toJSON()),[o,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)E(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,o,i){var c=t(e,o,i);!1===u(c)&&(n?r.push(c):r[o]=c)})),r}(e,(function(e,n){if(-1===t.indexOf(n))return e}))},E=function(e,t){return e&&e.hasOwnProperty(t)},O={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]+?)"}},x=function(e,u){d(e,{path:t(o,O.path,e.path,u.path),export:t(o,O.export,e.export,u.export),resolver:t(r,O.resolver,e.resolver,u.resolver),extension:t(o,O.extension,e.extension,u.extension),withObject:t(i,O.withObject,e.withObject,u.withObject),rmWhitespace:t(i,O.rmWhitespace,e.rmWhitespace,u.rmWhitespace),cache:t(i,O.cache,e.cache,u.cache),token:d({},O.token,e.token,u.token),vars:d({},O.vars,e.vars,u.vars),globalHelpers:t(n,O.globalHelpers,e.globalHelpers,u.globalHelpers)})},k="undefined"!=typeof globalThis?globalThis:window||self;function F(e){if(!1===g(this,F))return new F;var t={enabled:!0,list:{}};this.configure=function(e){t.enabled=e.cache,!1===c&&this.load(k[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 E(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 P(e){if(!1===g(this,P))return new P(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:"[s\t\n]*",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,o=r.SCOPE,i=r.SAFE,u=r.BUFFER,c=r.COMPONENT,s=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 l,f,p,b="".concat(u,"('");l=t.regex,f=function(n,r,o){b+=(""+e.slice(r,o)).replace(h,(function(e){return"\\"+a[e]})),n.forEach((function(e,n){e&&(b+=t.formats[n](e))}))},p=0,e.replace(l,(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(o,"){").concat(b,"}")),b="".concat(u,".start();").concat(b,"return ").concat(u,".end();"),b+="\n//# sourceURL=".concat(n);var g=null,v=[o,c,u,i].concat(s);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 B(e,t,n){if(!1===g(this,B))return new B(e,t,n);if(!1===g(t,F))throw new TypeError("cache is not instance of Cache");if(!1===g(n,P))throw new TypeError("compiler is not instance of Compiler");var o={},i=function(e){return o.resolver(o.path,e)};this.configure=function(e){o.path=e.path,o.cache=e.cache,r(e.resolver)&&(o.resolver=e.resolver)},this.get=function(e){return t.exist(e)?t.resolve(e):i(e).then((function(o){return function(e,n){return t.set(e,n),n}(e,function(e,t){return r(e)?e:n.compile(e,t)}(o,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 T=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],N=" ",C='"',$="/",A="<",M=">",U=function(e,t,n){var r=[],o=-1===T.indexOf(e),i=function(e,t){var n=[];return y(e,(function(e,r,o){var i=t(e,r,o);!1===u(i)&&n.push(i)})),n}(t,(function(e,t){if(null!=e)return[p(t),[C,p(e),C].join("")].join("=")})).join(N);return r.push([A,e,N,i,M].join("")),n&&r.push(n instanceof Array?n.join(""):n),o&&r.push([A,$,e,M].join("")),r.join("")};function H(e){this.name="TemplateError",this.message=e,Error.call(this)}function L(e){H.call(this),this.name="TemplateNotFound",this.message=e}function W(e){H.call(this),this.name="TemplateSyntaxError",this.message=e}function J(e){return Promise.all(e||[]).then((function(e){return e.join("")})).catch((function(e){return e}))}function _(){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(),J(n)},n.error=function(e){return t=e,Promise.reject(new W(t.message));var t},n.end=function(){return J(t)},n}function q(e){if(!1===g(this,q))return new q(e);this.configure=function(e,t){var n,i=e.vars,u=i.BLOCKS,c=i.MACRO,a=i.EXTEND,s=i.LAYOUT,l=i.BUFFER,f=i.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={},l,{value:_(),writable:!0,configurable:!1,enumerable:!1}),u,{value:{},writable:!0,configurable:!1,enumerable:!1}),c,{value:{},writable:!0,configurable:!1,enumerable:!1}),s,{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[l]},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[s]=e},writable:!1,configurable:!1,enumerable:!1}),"getLayout",{value:function(){return this[s]},writable:!1,configurable:!1,enumerable:!1}),"clone",{value:function(e){var t=[s,a,l];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(),o=n.pop();return E(r,o)?r[o]:t},writable:!0,configurable:!0,enumerable:!1}),"set",{value:function(e,t){var n=v(this,e,!1),r=n.shift(),o=n.pop();return this.getExtend()&&E(r,o)?r[o]:r[o]=t},writable:!1,configurable:!1,enumerable:!1}),"macro",{value:function(e,t){var n=this.getMacro(),r=this.fn(t),o=this;n[e]=function(){return o.echo(r.apply(void 0,arguments))}},writable:!1,configurable:!1,enumerable:!1}),R(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 o=Object.assign([],r[e]),i=function(){return o.shift()},u=function(){var e=i();return e?function(){n.echo(e(u()))}:w};this.echo(i()(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),o=d(r,t||{}),i=this.render(e,o);this.echo(i)},writable:!1,configurable:!1,enumerable:!1}),"promiseResolve",{value:function(e,t){return Promise.resolve(r(e)?this.fn(e)():e).then(t.bind(this))},writable:!1,configurable:!1,enumerable:!1}),"use",{value:function(e,t){this.echo(this.promiseResolve(this.require(e),(function(e){var n=this.getMacro();y(e,(function(e,r){n[[t,r].join(".")]=e}))})))},writable:!1,configurable:!1,enumerable:!1}),"async",{value:function(e,t){this.echo(this.promiseResolve(e,(function(e){return this.fn(t)(e)})))},writable:!1,configurable:!1,enumerable:!1}),"each",{value:function(e,t){o(e)&&(e=this.get(e,[])),y(e,t)},writable:!1,configurable:!1,enumerable:!1}),"element",{value:function(e,t,n){return U(e,t,n)},writable:!1,configurable:!1,enumerable:!1}),"el",{value:function(e,t,n){this.echo(this.promiseResolve(n,(function(n){return this.element(e,t,n)})))},writable:!1,configurable:!1,enumerable:!1})))},this.configure(e)}Object.setPrototypeOf(H.prototype,Error.prototype),Object.assign(H.prototype,{code:1}),H.prototype.getCode=function(){return this.code},H.prototype.getMessage=function(){return this.message},H.prototype.toString=function(){return this.getMessage()},Object.setPrototypeOf(L.prototype,H.prototype),Object.assign(L.prototype,{code:404}),Object.setPrototypeOf(W.prototype,H.prototype),Object.assign(W.prototype,{code:500});var D={};var K=new function e(t){if(!1===g(this,e))return new e(t);var n={},o={};x(o,t||{});var i=new q(o),u=new P(o),c=new F,a=new B(o,c,u),s=function(e,t){var n=o.globalHelpers,i=[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,i)}))},l=function(e,t){var n=m(e,o.extension),r=i.create(t);return s(n,r).then((function(e){if(r.getExtend()){r.setExtend(!1);var t=r.getLayout(),n=r.clone();return l(t,n)}return e}))};return this.configure=function(e){return x(o,e=e||{}),i.configure(o,n),u.configure(o),c.configure(o),a.configure(o),o},this.render=function(e,t){return l(e,t)},this.helpers=function(e){i.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 i.create(e)},this.helpers({require:function(e){var t=m(e,o.extension),n=i.create({});return s(t,n).then((function(){return n.getMacro()}))},render:l}),this}({resolver:function(e,t){return new Promise((function(n,r){D.readFile(function(e,t){return(t=[e,t].join("/")).replace(/\/\//g,"/")}(e,t),(function(e,t){e?r(new H(e)):n(t.toString())}))}))}}),X=K.render,Y=K.context,z=K.compile,G=K.helpers,I=K.preload,Q=K.configure,V=K.create,Z=function(e){return function(n,u,c){r(u)&&(c=u,u={});var a=d({},(u=u||{}).settings),s=t(o,O.path,a.views),l=t(i,O.cache,a["view cache"]),f=d({},a["view options"]),h=D.relative(s,n);return f.path=s,f.cache=l,e.configure(f),e.render(h,u).then((function(e){c(null,e)})).catch((function(e){c(e)}))}}(K);e.TemplateError=H,e.TemplateNotFound=L,e.TemplateSyntaxError=W,e.__express=Z,e.compile=z,e.configure=Q,e.context=Y,e.create=V,e.helpers=G,e.preload=I,e.render=X}));
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 c(t,e,n){r(t,e),e.set(t,n)}function u(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,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 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 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 y(t){var e="function"==typeof Map?new Map:void 0;return y=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)},y(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},O="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),E={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},x={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"},S=function(t){return new RegExp(["[",Object.keys(t).join(""),"]"].join(""),"g")},M=S(x),P=S(E),F=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(M,(function(t){return x[t]}))},W=function(t,e){var n=t;return null==n?"":!0===Boolean(e)?F(n):n},R=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(),c=0;c<i.length;c++){var u=i[c];if(m(r.toJSON)&&(r=r.toJSON()),n&&!1===r.hasOwnProperty(u)){r={};break}r=r[u]=r[u]||{}}return m(r.toJSON)&&(r=r.toJSON()),[r,o]},T=function(t){(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).forEach((function(e){e in t&&(t[e]=t[e].bind(t))}))},A=function(t,e){var n=t.split(".").pop();return n!==e&&(t=[t,e].join(".")),t},C=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)},$=function(){},N=function(t,e){var n;for(n in t)_(t,n)&&e(t[n],n,t)},U=function(t,e){return function(t,e){var n=t instanceof Array,r=n?[]:{};return N(t,(function(t,i,o){var c=e(t,i,o);!1===j(c)&&(n?r.push(c):r[i]=c)})),r}(t,(function(t,n){if(-1===e.indexOf(n))return t}))},_=function(t,e){return t&&t.hasOwnProperty(e)},H={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",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},L=function(t,e){C(t,{path:d(w,H.path,t.path,e.path),export:d(w,H.export,t.export,e.export),resolver:d(m,H.resolver,t.resolver,e.resolver),extension:d(w,H.extension,t.extension,e.extension),withObject:d(k,H.withObject,t.withObject,e.withObject),rmWhitespace:d(k,H.rmWhitespace,t.rmWhitespace,e.rmWhitespace),cache:d(k,H.cache,t.cache,e.cache),token:C({},H.token,t.token,e.token),vars:C({},H.vars,t.vars,e.vars),globalHelpers:d(b,H.globalHelpers,t.globalHelpers,e.globalHelpers)})},J="undefined"!=typeof globalThis?globalThis:window||self,q=new WeakMap,D=new WeakMap,K=function(){return a((function t(e){i(this,t),c(this,q,!0),c(this,D,{}),T(this,["configure"]),this.configure(e)}),[{key:"load",value:function(t){o(q,this)&&C(o(D,this),t||{})}},{key:"get",value:function(t){if(o(q,this))return o(D,this)[t]}},{key:"set",value:function(t,e){o(q,this)&&(o(D,this)[t]=e)}},{key:"exist",value:function(t){return _(o(D,this),t)}},{key:"clear",value:function(){u(D,this,{})}},{key:"remove",value:function(t){delete o(D,this)[t]}},{key:"resolve",value:function(t){return Promise.resolve(this.get(t))}},{key:"configure",value:function(t){u(q,this,t.cache),!1===O&&this.load(J[t.export])}}])}(),X=new WeakMap,Y=new WeakMap,z=function(){return a((function t(e){i(this,t),c(this,X,{}),c(this,Y,[{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,"('")}}]),T(this,["configure","compile"]),this.configure(e)}),[{key:"configure",value:function(t){var e=this;o(X,this).withObject=t.withObject,o(X,this).rmWhitespace=t.rmWhitespace,o(X,this).token=t.token,o(X,this).vars=t.vars,o(X,this).globalHelpers=t.globalHelpers,o(X,this).matches=[],o(X,this).formats=[],o(X,this).slurp={match:"[s\t\n]*",start:[o(X,this).token.start,"_"],end:["_",o(X,this).token.end]},o(Y,this).forEach((function(t){o(X,e).matches.push(o(X,e).token.start.concat(t.symbol).concat(o(X,e).token.regex).concat(o(X,e).token.end)),o(X,e).formats.push(t.format.bind(o(X,e).vars))})),o(X,this).regex=new RegExp(o(X,this).matches.join("|").concat("|$"),"g"),o(X,this).slurpStart=new RegExp([o(X,this).slurp.match,o(X,this).slurp.start.join("")].join(""),"gm"),o(X,this).slurpEnd=new RegExp([o(X,this).slurp.end.join(""),o(X,this).slurp.match].join(""),"gm")}},{key:"compile",value:function(t,e){var n=this,r=o(X,this).vars,i=r.SCOPE,c=r.SAFE,u=r.BUFFER,s=r.COMPONENT,a=o(X,this).globalHelpers;o(X,this).rmWhitespace&&(t=String(t).replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),t=String(t).replace(o(X,this).slurpStart,o(X,this).token.start).replace(o(X,this).slurpEnd,o(X,this).token.end);var f,h,l,p="".concat(u,"('");f=o(X,this).regex,h=function(e,r,i){p+=(""+t.slice(r,i)).replace(P,(function(t){return"\\"+E[t]})),e.forEach((function(t,e){t&&(p+=o(X,n).formats[e](t))}))},l=0,t.replace(f,(function(){var t=[].slice.call(arguments,0,-1),e=t.pop(),n=t.shift();return h(t,l,e),l=e+n.length,n})),p="try{".concat(p+="');","}catch(e){return ").concat(u,".error(e)}"),o(X,this).withObject&&(p="with(".concat(i,"){").concat(p,"}")),p="".concat(u,".start();").concat(p,"return ").concat(u,".end();"),p+="\n//# sourceURL=".concat(e);var v=null,g=[i,s,u,c].concat(a);try{(v=Function.apply(null,g.concat(p))).source="(function(".concat(g.join(","),"){\n").concat(p,"\n});")}catch(t){throw t.filename=e,t.source=p,t}return v}}])}(),G=new WeakMap,I=new WeakMap,Q=new WeakMap,V=new WeakMap,Z=new WeakSet,tt=function(){return a((function t(e,n,r){i(this,t),s(this,Z),c(this,G,void 0),c(this,I,void 0),c(this,Q,void 0),c(this,V,void 0),R(n,K),R(r,z),u(I,this,n),u(Q,this,r),T(this,["configure","get"]),this.configure(e)}),[{key:"configure",value:function(t){u(G,this,t.path),m(t.resolver)&&u(V,this,t.resolver)}},{key:"get",value:function(t){var n=this;return o(I,this).exist(t)?o(I,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 o(V,this).call(this,o(G,this),t)}function nt(t,e){return o(I,this).set(t,e),e}function rt(t,e){return m(t)?t:o(Q,this).compile(t,e)}var it=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],ot=" ",ct='"',ut="/",st="<",at=">",ft=function(t,e,n){var r=[],i=-1===it.indexOf(t),o=function(t,e){var n=[];return N(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[F(e),[ct,F(t),ct].join("")].join("=")})).join(ot);return r.push([st,t,ot,o,at].join("")),n&&i&&r.push(n instanceof Array?n.join(""):n),i&&r.push([st,ut,t,at].join("")),r.join("")},ht=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()}}])}(y(Error)),lt=function(t){function e(){var t;i(this,e);for(var r=arguments.length,o=new Array(r),c=0;c<r;c++)o[c]=arguments[c];return f(t=n(this,e,[].concat(o)),"code",404),t}return l(e,t),a(e)}(ht),pt=function(t){function e(){var t;i(this,e);for(var r=arguments.length,o=new Array(r),c=0;c<r;c++)o[c]=arguments[c];return f(t=n(this,e,[].concat(o)),"code",500),t}return l(e,t),a(e)}(ht);function vt(t){return Promise.all(t||[]).then((function(t){return t.join("")})).catch((function(t){return t}))}function gt(){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 yt=new WeakMap,dt=function(){return a((function t(e,n){i(this,t),c(this,yt,void 0),T(this,["create","helpers","configure"]),this.configure(e,n)}),[{key:"create",value:function(t){return new(o(yt,this))(t)}},{key:"configure",value:function(t,e){u(yt,this,function(t,e){var n,r=t.vars,i=r.BLOCKS,o=r.MACRO,c=r.EXTEND,u=r.LAYOUT,s=r.BUFFER,a=r.COMPONENT,h=r.SAFE,l=r.SCOPE;function p(t){this[i]={},this[o]={},Object.assign(this,U(t,[l,s,h,a]))}return Object.assign(p.prototype,e),Object.defineProperties(p.prototype,(f(f(f(f(f(f(f(f(f(f(n={},s,{value:gt()}),i,{value:{},writable:!0}),o,{value:{},writable:!0}),u,{value:!1,writable:!0}),c,{value:!1,writable:!0}),"getMacro",{value:function(){return this[o]}}),"getBuffer",{value:function(){return this[s]}}),"getComponent",{value:function(){var t=this;return a in t?function(){return t[a].apply(t,arguments)}:function(){console.log("%s function not defined",a)}}}),"getBlocks",{value:function(){return this[i]}}),"setExtend",{value:function(t){this[c]=t}}),f(f(f(f(f(f(f(f(f(f(n,"getExtend",{value:function(){return this[c]}}),"setLayout",{value:function(t){this[u]=t}}),"getLayout",{value:function(){return this[u]}}),"clone",{value:function(t){var e=[u,c,s];return!0===t&&e.push(i),U(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(){return e.backup(),m(t)&&t.apply(n,arguments),e.restore()}}}),"get",{value:function(t,e){var n=B(this,t,!0),r=n.shift(),i=n.pop();return _(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()&&_(r,i)?r[i]:r[i]=e}}),"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(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()},c=function(){var t=o();return t?function(){n.echo(t(c()))}:$};this.echo(o()(c()))}}}),"hasBlock",{value:function(t){return this.getBlocks().hasOwnProperty(t)}}),"include",{value:function(t,e,n){var r=!1===n?{}:this.clone(!0),i=C(r,e||{}),o=this.render(t,i);this.echo(o)}}),"promiseResolve",{value:function(t,e){return Promise.resolve(m(t)?this.fn(t)():t).then(e.bind(this))}}),"use",{value:function(t,e){this.echo(this.promiseResolve(this.require(t),(function(t){var n=this.getMacro();N(t,(function(t,r){n[[e,r].join(".")]=t}))})))}}),"async",{value:function(t,e){this.echo(this.promiseResolve(t,(function(t){return this.fn(e)(t)})))}}),"each",{value:function(t,e){w(t)&&(t=this.get(t,[])),N(t,e)}}),"element",{value:function(t,e,n){return ft(t,e,n)}}),"el",{value:function(t,e,n){this.echo(this.promiseResolve(n,(function(n){return this.element(t,e,n)})))}}))),p}(t,e))}},{key:"helpers",value:function(t){C(o(yt,this).prototype,t||{})}}])}(),bt=new WeakMap,mt=new WeakMap,wt=new WeakMap,kt=new WeakMap,jt=new WeakMap,Ot=new WeakMap,Et=new WeakSet,xt=function(){return a((function t(n){i(this,t),s(this,Et),c(this,bt,{}),c(this,mt,{}),c(this,wt,void 0),c(this,kt,void 0),c(this,jt,void 0),c(this,Ot,void 0),L(o(bt,this),n||{}),u(wt,this,new dt(o(bt,this),o(mt,this))),u(kt,this,new z(o(bt,this))),u(jt,this,new K(o(bt,this))),u(Ot,this,new tt(o(bt,this),o(jt,this),o(kt,this))),T(this,["configure","create","render","context","preload","compile","helpers"]),this.helpers({require:e(Et,this,Mt),render:this.render})}),[{key:"configure",value:function(t){return L(o(bt,this),t||{}),o(wt,this).configure(o(bt,this),o(mt,this)),o(kt,this).configure(o(bt,this)),o(jt,this).configure(o(bt,this)),o(Ot,this).configure(o(bt,this)),o(bt,this)}},{key:"render",value:function(t,n){var r=this,i=A(t,o(bt,this).extension),c=this.context(n);return e(Et,this,St).call(this,i,c).then((function(t){if(c.getExtend()){c.setExtend(!1);var e=c.getLayout(),n=c.clone();return r.render(e,n)}return t}))}},{key:"helpers",value:function(t){o(wt,this).helpers(C(o(mt,this),t))}},{key:"context",value:function(t){return o(wt,this).create(t)}},{key:"compile",value:function(t,e){return o(kt,this).compile(t,e)}},{key:"preload",value:function(t){return o(jt,this).load(t||{})}},{key:"create",value:function(t){return new this.constructor(t)}}])}();function St(t,e){var n=o(bt,this).globalHelpers,r=[e,e.getComponent(),e.getBuffer(),W].concat(n.filter((function(t){return m(e[t])})).map((function(t){return e[t].bind(e)})));return o(Ot,this).get(t).then((function(t){return t.apply(e,r)}))}function Mt(t){var n=A(t,o(bt,this).extension),r=this.context({});return e(Et,this,St).call(this,n,r).then((function(){return r.getMacro()}))}var Pt={};var Ft=new xt({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 ht(t)):n(e.toString())}))}))}}),Wt=Ft.render,Rt=Ft.context,Bt=Ft.compile,Tt=Ft.helpers,At=Ft.preload,Ct=Ft.configure,$t=Ft.create,Nt=function(t,e){return function(n,r,i){m(r)&&(i=r,r={});var o=C({},(r=r||{}).settings),c=d(w,H.path,o.views),u=d(k,H.cache,o["view cache"]),s=C({},o["view options"]),a=Pt.relative(c,n);return s.path=c,s.cache=u,t(s),e(a,r).then((function(t){i(null,t)})).catch((function(t){i(t)}))}}(Ct,Wt);t.TemplateError=ht,t.TemplateNotFound=lt,t.TemplateSyntaxError=pt,t.__express=Nt,t.compile=Bt,t.configure=Ct,t.context=Rt,t.create=$t,t.helpers=Tt,t.preload=At,t.render=Wt}));