@kosatyi/ejs 0.0.104 → 0.0.106

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(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ejs={})}(this,(function(t){"use strict";function e(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function n(t,e,n){return e=h(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,p()?Reflect.construct(e,n||[],h(t).constructor):e.apply(t,n))}function r(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,n){return t.get(e(t,n))}function u(t,e,n){r(t,e),e.set(t,n)}function c(t,n,r){return t.set(e(t,n),r),r}function a(t,e){r(t,e),e.add(t)}function s(t,e,n){return e&&function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,y(r.key),r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function f(t,e,n){return(e=y(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e)}function p(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(p=function(){return!!t})()}function v(t,e){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},v(t,e)}function y(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}function g(t){var e="function"==typeof Map?new Map:void 0;return g=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(p())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var i=new(t.bind.apply(t,r));return n&&v(i,n.prototype),i}(t,arguments,h(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),v(n,t)},g(t)}var d=function(){var t=[].slice.call(arguments),e=t.shift();return t.filter(e).pop()},b=function(t){return Array.isArray(t)},m=function(t){return"function"==typeof t},w=function(t){return"string"==typeof t},k=function(t){return"boolean"==typeof t},j=function(t){return void 0===t},E="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),O={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},x={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"},P=function(t){return new RegExp(["[",Object.keys(t).join(""),"]"].join(""),"g")},S=P(x),M=P(O),T=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(S,(function(t){return x[t]}))},F=function(t,e){var n=t;return null==n?"":!0===Boolean(e)?T(n):n},W=function(t,e){if(!1===function(t,e){return Boolean(t instanceof e)}(t,e))throw new TypeError("".concat(t," in not instance of ").concat(e))},B=function(t,e,n){for(var r=t,i=String(e).split("."),o=i.pop(),u=0;u<i.length;u++){var c=i[u];if(m(r.toJSON)&&(r=r.toJSON()),n&&!1===r.hasOwnProperty(c)){r={};break}r=r[c]=r[c]||{}}return m(r.toJSON)&&(r=r.toJSON()),[r,o]},R=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.filter((function(t){return t})).reduce((function(t,e){return Object.assign(t,e)}),t)},C=function(){},A=function(t,e){var n;for(n in t)L(t,n)&&e(t[n],n,t)},N=function(t,e){return function(t,e){var n=t instanceof Array,r=n?[]:{};return A(t,(function(t,i,o){var u=e(t,i,o);!1===j(u)&&(n?r.push(u):r[i]=u)})),r}(t,(function(t,n){if(-1===e.indexOf(n))return t}))},L=function(t,e){return t&&t.hasOwnProperty(e)},$={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(t,e){return Promise.resolve(["resolver is not defined",t,e].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",ELEMENT:"el",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},U=function(t,e){R(t,{path:d(w,$.path,t.path,e.path),export:d(w,$.export,t.export,e.export),resolver:d(m,$.resolver,t.resolver,e.resolver),extension:d(w,$.extension,t.extension,e.extension),withObject:d(k,$.withObject,t.withObject,e.withObject),rmWhitespace:d(k,$.rmWhitespace,t.rmWhitespace,e.rmWhitespace),cache:d(k,$.cache,t.cache,e.cache),token:R({},$.token,t.token,e.token),vars:R({},$.vars,t.vars,e.vars),globalHelpers:d(b,$.globalHelpers,t.globalHelpers,e.globalHelpers)})},_="undefined"!=typeof globalThis?globalThis:window||self,H=new WeakMap,q=new WeakMap,J=function(){return s((function t(e){i(this,t),u(this,H,!0),u(this,q,{}),this.configure(e)}),[{key:"load",value:function(t){o(H,this)&&R(o(q,this),t||{})}},{key:"get",value:function(t){if(o(H,this))return o(q,this)[t]}},{key:"set",value:function(t,e){o(H,this)&&(o(q,this)[t]=e)}},{key:"exist",value:function(t){if(o(H,this))return L(o(q,this),t)}},{key:"clear",value:function(){c(q,this,{})}},{key:"remove",value:function(t){delete o(q,this)[t]}},{key:"resolve",value:function(t){return Promise.resolve(this.get(t))}},{key:"configure",value:function(t){c(H,this,t.cache),!1===E&&this.load(_[t.export])}}])}(),D=new WeakMap,K=new WeakMap,V=function(){return s((function t(e){i(this,t),u(this,D,{}),u(this,K,[{symbol:"-",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(t){return"')\n/**".concat(t,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(t){return"')\n".concat(t.trim(),"\n").concat(this.BUFFER,"('")}}]),this.configure(e)}),[{key:"configure",value:function(t){var e=this;o(D,this).withObject=t.withObject,o(D,this).rmWhitespace=t.rmWhitespace,o(D,this).token=t.token,o(D,this).vars=t.vars,o(D,this).globalHelpers=t.globalHelpers,o(D,this).matches=[],o(D,this).formats=[],o(D,this).slurp={match:"[s\t\n]*",start:[o(D,this).token.start,"_"],end:["_",o(D,this).token.end]},o(K,this).forEach((function(t){o(D,e).matches.push(o(D,e).token.start.concat(t.symbol).concat(o(D,e).token.regex).concat(o(D,e).token.end)),o(D,e).formats.push(t.format.bind(o(D,e).vars))})),o(D,this).regex=new RegExp(o(D,this).matches.join("|").concat("|$"),"g"),o(D,this).slurpStart=new RegExp([o(D,this).slurp.match,o(D,this).slurp.start.join("")].join(""),"gm"),o(D,this).slurpEnd=new RegExp([o(D,this).slurp.end.join(""),o(D,this).slurp.match].join(""),"gm")}},{key:"compile",value:function(t,e){var n=this,r=o(D,this).vars,i=r.SCOPE,u=r.SAFE,c=r.BUFFER,a=r.COMPONENT,s=r.ELEMENT,f=o(D,this).globalHelpers;o(D,this).rmWhitespace&&(t=String(t).replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),t=String(t).replace(o(D,this).slurpStart,o(D,this).token.start).replace(o(D,this).slurpEnd,o(D,this).token.end);var h,l,p,v="".concat(c,"('");h=o(D,this).regex,l=function(e,r,i){v+=(""+t.slice(r,i)).replace(M,(function(t){return"\\"+O[t]})),e.forEach((function(t,e){t&&(v+=o(D,n).formats[e](t))}))},p=0,t.replace(h,(function(){var t=[].slice.call(arguments,0,-1),e=t.pop(),n=t.shift();return l(t,p,e),p=e+n.length,n})),v="try{".concat(v+="');","}catch(e){return ").concat(c,".error(e)}"),o(D,this).withObject&&(v="with(".concat(i,"){").concat(v,"}")),v="".concat(c,".start();").concat(v,"return ").concat(c,".end();"),v+="\n//# sourceURL=".concat(e);var y=null,g=[i,a,s,c,u].concat(f);try{(y=Function.apply(null,g.concat(v))).source="(function(".concat(g.join(","),"){\n").concat(v,"\n});")}catch(t){throw t.filename=e,t.source=v,t}return y}}])}(),X=new WeakMap,Y=new WeakMap,z=new WeakMap,G=new WeakMap,I=new WeakSet,Q=function(){return s((function t(e,n,r){i(this,t),a(this,I),u(this,X,void 0),u(this,Y,void 0),u(this,z,void 0),u(this,G,void 0),W(n,J),W(r,V),c(Y,this,n),c(z,this,r),this.configure(e)}),[{key:"configure",value:function(t){c(X,this,t.path),m(t.resolver)&&c(G,this,t.resolver)}},{key:"get",value:function(t){var n=this;return o(Y,this).exist(t)?o(Y,this).resolve(t):e(I,this,Z).call(this,t).then((function(r){return e(I,n,tt).call(n,t,e(I,n,et).call(n,r,t))}))}}])}();function Z(t){return o(G,this).call(this,o(X,this),t)}function tt(t,e){return o(Y,this).set(t,e),e}function et(t,e){return m(t)?t:o(z,this).compile(t,e)}var nt=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],rt=" ",it='"',ot="/",ut="<",ct=">",at=function(t,e,n){var r=[],i=-1===nt.indexOf(t),o=function(t,e){var n=[];return A(t,(function(t,r,i){var o=e(t,r,i);!1===j(o)&&n.push(o)})),n}(e,(function(t,e){if(null!=t)return[T(e),[it,T(t),it].join("")].join("=")})).join(rt);return r.push([ut,t,rt,o,ct].join("")),n&&i&&r.push(n instanceof Array?n.join(""):n),i&&r.push([ut,ot,t,ct].join("")),r.join("")},st=function(t){function e(t){var r;return i(this,e),f(r=n(this,e),"code",0),r.message=t,r}return l(e,t),s(e,[{key:"getCode",value:function(){return this.code}},{key:"getMessage",value:function(){return this.message}},{key:"toString",value:function(){return this.getMessage()}}])}(g(Error)),ft=function(t){function e(){var t;i(this,e);for(var r=arguments.length,o=new Array(r),u=0;u<r;u++)o[u]=arguments[u];return f(t=n(this,e,[].concat(o)),"code",404),t}return l(e,t),s(e)}(st),ht=function(t){function e(){var t;i(this,e);for(var r=arguments.length,o=new Array(r),u=0;u<r;u++)o[u]=arguments[u];return f(t=n(this,e,[].concat(o)),"code",500),t}return l(e,t),s(e)}(st);function lt(t){return Promise.all(t||[]).then((function(t){return t.join("")})).catch((function(t){return t}))}function pt(){var t=[],e=[],n=function(t){e.push(t)};return n.start=function(){e=[]},n.backup=function(){t.push(e.concat()),e=[]},n.restore=function(){var n=e.concat();return e=t.pop(),lt(n)},n.error=function(t){return e=t,Promise.reject(new ht(e.message));var e},n.end=function(){return lt(e)},n}var vt=Symbol("ContextScope.parentTemplate"),yt=new WeakMap,gt=function(){return s((function t(e,n){i(this,t),u(this,yt,void 0),this.configure(e,n)}),[{key:"create",value:function(t){return new(o(yt,this))(t)}},{key:"configure",value:function(t,e){c(yt,this,function(t,e){var n=t.vars,r=n.BLOCKS,i=n.MACRO,o=n.EXTEND,u=n.LAYOUT,c=n.BUFFER,a=n.SAFE,s=n.SCOPE,f=n.COMPONENT,h=n.ELEMENT;function l(t){this[vt]=null,this[r]={},this[i]={},Object.assign(this,N(t,[s,c,a,f,h]))}return Object.assign(l.prototype,e),Object.defineProperty(l.prototype,c,{value:pt()}),Object.defineProperty(l.prototype,r,{value:{},writable:!0}),Object.defineProperty(l.prototype,i,{value:{},writable:!0}),Object.defineProperty(l.prototype,u,{value:!1,writable:!0}),Object.defineProperty(l.prototype,o,{value:!1,writable:!0}),Object.defineProperty(l.prototype,vt,{value:null,writable:!0}),Object.defineProperties(l.prototype,{setParentTemplate:{value:function(t){return this[vt]=t,this}},getParentTemplate:{value:function(){return this[vt]}},useSafeValue:{get:function(){return F}},useComponent:{get:function(){return m(this[f])?this[f].bind(this):function(){throw new Error("".concat(f," must be a function"))}}},useElement:{get:function(){return m(this[h])?this[h].bind(this):function(){throw new Error("".concat(h," must be a function"))}}},getMacro:{value:function(){return this[i]}},getBuffer:{value:function(){return this[c]}},getBlocks:{value:function(){return this[r]}},setExtend:{value:function(t){return this[o]=t,this}},getExtend:{value:function(){return this[o]}},setLayout:{value:function(t){return this[u]=t,this}},getLayout:{value:function(){return this[u]}},clone:{value:function(t){var e=[u,o,c];return!0===t&&e.push(r),N(this,e)}},extend:{value:function(t){this.setExtend(!0),this.setLayout(t)}},echo:{value:function(t){var e=this.getBuffer();[].slice.call(arguments).forEach(e)}},fn:{value:function(t){var e=this.getBuffer(),n=this;return function(){if(m(t))return e.backup(),e(t.apply(n,arguments)),e.restore()}}},macro:{value:function(t,e){var n=this.getMacro(),r=this.fn(e),i=this;n[t]=function(){return i.echo(r.apply(void 0,arguments))}}},call:{value:function(t){var e=this.getMacro()[t],n=[].slice.call(arguments,1);if(m(e))return e.apply(e,n)}},block:{value:function(t,e){var n=this,r=this.getBlocks();if(r[t]=r[t]||[],r[t].push(this.fn(e)),!this.getExtend()){var i=Object.assign([],r[t]),o=function(){return i.shift()},u=function(){var t=o();return t?function(){n.echo(t(u()))}:C};this.echo(o()(u()))}}},hasBlock:{value:function(t){return this.getBlocks().hasOwnProperty(t)}},include:{value:function(t,e,n){var r=!1===n?{}:this.clone(!0),i=R(r,e||{}),o=this.render(t,i);this.echo(o)}},use:{value:function(t,e){var n=this;this.echo(Promise.resolve(this.require(t)).then((function(t){var r=n.getMacro();A(t,(function(t,n){r[[e,n].join(".")]=t}))})))}},async:{value:function(t,e){this.echo(Promise.resolve(t).then(e))}},get:{value:function(t,e){var n=B(this,t,!0),r=n.shift(),i=n.pop();return L(r,i)?r[i]:e}},set:{value:function(t,e){var n=B(this,t,!1),r=n.shift(),i=n.pop();return this.getParentTemplate()&&L(r,i)?r[i]:r[i]=e}},each:{value:function(t,e){w(t)&&(t=this.get(t,[])),A(t,e)},writable:!0},el:{value:function(t,e,n){n=m(n)?this.fn(n)():n,this.echo(Promise.resolve(n).then((function(n){return at(t,e,n)})))},writable:!0},ui:{value:function(t){},writable:!0}}),l}(t,e))}},{key:"helpers",value:function(t){R(o(yt,this).prototype,t||{})}}])}(),dt=new WeakMap,bt=new WeakMap,mt=new WeakMap,wt=new WeakMap,kt=new WeakMap,jt=new WeakMap,Et=new WeakSet,Ot=function(){return s((function t(e){i(this,t),a(this,Et),u(this,dt,{}),u(this,bt,{}),u(this,mt,void 0),u(this,wt,void 0),u(this,kt,void 0),u(this,jt,void 0),U(o(dt,this),e||{}),c(mt,this,new gt(o(dt,this),o(bt,this))),c(wt,this,new V(o(dt,this))),c(kt,this,new J(o(dt,this))),c(jt,this,new Q(o(dt,this),o(kt,this),o(wt,this))),function(t){(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).forEach((function(e){e in t&&(t[e]=t[e].bind(t))}))}(this,["configure","create","render","require","context","preload","compile","helpers"]),this.helpers({require:this.require,render:this.render})}),[{key:"configure",value:function(t){return U(o(dt,this),t||{}),o(mt,this).configure(o(dt,this),o(bt,this)),o(wt,this).configure(o(dt,this)),o(kt,this).configure(o(dt,this)),o(jt,this).configure(o(dt,this)),o(dt,this)}},{key:"filePath",value:function(t){return function(t,e){var n=t.split(".").pop();return n!==e&&(t=[t,e].join(".")),t}(t,o(dt,this).extension)}},{key:"require",value:function(t){var n=this.context({});return e(Et,this,xt).call(this,this.filePath(t),n).then((function(){return n.getMacro()}))}},{key:"render",value:function(t,n){var r=this.context(n);return e(Et,this,xt).call(this,this.filePath(t),r).then(this.outputContent(t,r))}},{key:"outputContent",value:function(t,e){var n=this;return function(r){return e.getExtend()?(e.setExtend(!1),n.renderLayout(e.getLayout(),e,t)):r}}},{key:"renderLayout",value:function(t,n,r){var i=this.context(n);return r&&i.setParentTemplate(r),e(Et,this,xt).call(this,this.filePath(t),i).then(this.outputContent(t,i))}},{key:"helpers",value:function(t){o(mt,this).helpers(R(o(bt,this),t))}},{key:"context",value:function(t){return o(mt,this).create(t)}},{key:"compile",value:function(t,e){return o(wt,this).compile(t,e)}},{key:"preload",value:function(t){return o(kt,this).load(t||{})}},{key:"create",value:function(t){return new this.constructor(t)}}])}();function xt(t,e){var n=o(dt,this).globalHelpers,r=[e,e.useComponent,e.useElement,e.getBuffer(),e.useSafeValue],i=n.filter((function(t){return m(e[t])})).map((function(t){return e[t].bind(e)}));return o(jt,this).get(t).then((function(t){return t.apply(e,r.concat(i))}))}var Pt=new Ot({resolver:function(t,e){return fetch(function(t,e){return(e=[t,e].join("/")).replace(/\/\//g,"/")}(t,e)).then((function(t){return t.text()}),(function(t){return new st(t)}))}}),St=Pt.render,Mt=Pt.context,Tt=Pt.compile,Ft=Pt.helpers,Wt=Pt.preload,Bt=Pt.configure,Rt=Pt.create;t.TemplateError=st,t.TemplateNotFound=ft,t.TemplateSyntaxError=ht,t.compile=Tt,t.configure=Bt,t.context=Mt,t.create=Rt,t.helpers=Ft,t.preload=Wt,t.render=St}));
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";var e=function(){var t=[].slice.call(arguments),e=t.shift();return t.filter(e).pop()},n=function(t){return Array.isArray(t)},r=function(t){return"function"==typeof t},o=function(t){return"string"==typeof t},i=function(t){return"boolean"==typeof t},c=function(t){return void 0===t},u="[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;"},f=function(t){return new RegExp(["[",Object.keys(t).join(""),"]"].join(""),"g")},l=f(s),p=f(a),h=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(l,(function(t){return s[t]}))},v=function(t,e){var n=t;return null==n?"":!0===Boolean(e)?h(n):n},g=function(t,e,n){for(var o=t,i=String(e).split("."),c=i.pop(),u=0;u<i.length;u++){var a=i[u];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,c]},d=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)},b=function(){},m=function(t,e){var n;for(n in t)E(t,n)&&e(t[n],n,t)},y=function(t,e){return function(t,e){var n=t instanceof Array,r=n?[]:{};return m(t,(function(t,o,i){var u=e(t,o,i);!1===c(u)&&(n?r.push(u):r[o]=u)})),r}(t,(function(t,n){if(-1===e.indexOf(n))return t}))},E=function(t,e){return t&&t.hasOwnProperty(e)},j={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]+?)"}},O=function(t,c){return d(t,{path:e(o,j.path,t.path,c.path),export:e(o,j.export,t.export,c.export),resolver:e(r,j.resolver,t.resolver,c.resolver),extension:e(o,j.extension,t.extension,c.extension),withObject:e(i,j.withObject,t.withObject,c.withObject),rmWhitespace:e(i,j.rmWhitespace,t.rmWhitespace,c.rmWhitespace),cache:e(i,j.cache,t.cache,c.cache),token:d({},j.token,t.token,c.token),vars:d({},j.vars,t.vars,c.vars),globalHelpers:e(n,j.globalHelpers,t.globalHelpers,c.globalHelpers)})},x=function(t,e,n){var o={path:null,resolver:null},i=function(t,e){return r(t)?t:n.compile(t,e)},c=function(t){o.path=t.path,r(t.resolver)&&(o.resolver=t.resolver)};return c(t),{get:function(t){return e.exist(t)?e.resolve(t):(n=t,o.resolver(o.path,n)).then((function(n){return function(t,n){return e.set(t,n),n}(t,i(n,t))}));var n},configure:c,compile:i}},w=[{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,"('")}}],P=function(t){var e={},n=function(t){e.withObject=t.withObject,e.rmWhitespace=t.rmWhitespace,e.token=t.token,e.vars=t.vars,e.globalHelpers=t.globalHelpers,e.matches=[],e.formats=[],e.slurp={match:"[s\t\n]*",start:[e.token.start,"_"],end:["_",e.token.end]},w.forEach((function(t){e.matches.push(e.token.start.concat(t.symbol).concat(e.token.regex).concat(e.token.end)),e.formats.push(t.format.bind(e.vars))})),e.regex=new RegExp(e.matches.join("|").concat("|$"),"g"),e.slurpStart=new RegExp([e.slurp.match,e.slurp.start.join("")].join(""),"gm"),e.slurpEnd=new RegExp([e.slurp.end.join(""),e.slurp.match].join(""),"gm")};return n(t),{configure:n,compile:function(t,n){var r=e.vars,o=r.SCOPE,i=r.SAFE,c=r.BUFFER,u=r.COMPONENT,s=r.ELEMENT,f=e.globalHelpers;e.rmWhitespace&&(t=String(t).replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),t=String(t).replace(e.slurpStart,e.token.start).replace(e.slurpEnd,e.token.end);var l,h,v,g="".concat(c,"('");l=e.regex,h=function(n,r,o){g+=(""+t.slice(r,o)).replace(p,(function(t){return"\\"+a[t]})),n.forEach((function(t,n){t&&(g+=e.formats[n](t))}))},v=0,t.replace(l,(function(){var t=[].slice.call(arguments,0,-1),e=t.pop(),n=t.shift();return h(t,v,e),v=e+n.length,n})),g="try{".concat(g+="');","}catch(e){return ").concat(c,".error(e)}"),e.withObject&&(g="with(".concat(o,"){").concat(g,"}")),g="".concat(c,".start();").concat(g,"return ").concat(c,".end();"),g+="\n//# sourceURL=".concat(n);var d=null,b=[o,u,s,c,i].concat(f);try{(d=Function.apply(null,b.concat(g))).source="(function(".concat(b.join(","),"){\n").concat(g,"\n});")}catch(t){throw t.filename=n,t.source=g,t}return d}}},k="undefined"!=typeof globalThis?globalThis:window||self,S=function(){var t={},e={},n=function(n){t.enabled&&d(e,n||{})},r=function(n){if(t.enabled)return e[n]},o=function(t){delete e[t]},i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.enabled=e.cache,t.export=e.export,!1===u&&n(k[t.export])};return i(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{configure:i,load:n,set:function(n,r){t.enabled&&(e[n]=r)},get:r,exist:function(n){if(t.enabled)return E(e,n)},clear:function(){Object.keys(e).forEach(o)},remove:o,resolve:function(t){return Promise.resolve(r(t))}}},F=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],T=" ",B='"',C="/",N="<",R=">",M=function(t,e,n){var r=[],o=-1===F.indexOf(t),i=function(t,e){var n=[];return m(t,(function(t,r,o){var i=e(t,r,o);!1===c(i)&&n.push(i)})),n}(e,(function(t,e){if(null!=t)return[h(e),[B,h(t),B].join("")].join("=")})).join(T);return r.push([N,t,T,i,R].join("")),n&&o&&r.push(n instanceof Array?n.join(""):n),o&&r.push([N,C,t,R].join("")),r.join("")};function A(){A.call(this)}function $(){A.call(this)}function L(){A.call(this)}function U(t){return Promise.all(t||[]).then((function(t){return t.join("")})).catch((function(t){return t}))}function H(){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(),U(n)},n.error=function(t){return e=t,Promise.reject(new L(e.message));var e},n.end=function(){return U(e)},n}Object.setPrototypeOf(A.prototype,Error.prototype),Object.assign(A.prototype,{code:0,getCode:function(){return this.code},getMessage:function(){return this.message},toString:function(){return this.getMessage()}}),Object.setPrototypeOf($.prototype,A.prototype),Object.assign($.prototype,{code:404}),Object.setPrototypeOf(L.prototype,A.prototype),Object.assign(L.prototype,{code:500});var W=Symbol("ContextScope.parentTemplate"),q=function(t,e){var n,i=function(t,e){n=function(t,e){var n=t.vars,i=n.BLOCKS,c=n.MACRO,u=n.EXTEND,a=n.LAYOUT,s=n.BUFFER,f=n.SAFE,l=n.SCOPE,p=n.COMPONENT,h=n.ELEMENT;function j(t){this[W]=null,this[i]={},this[c]={},Object.assign(this,y(t,[l,s,f,p,h]))}return Object.assign(j.prototype,e),Object.defineProperty(j.prototype,s,{value:H()}),Object.defineProperty(j.prototype,i,{value:{},writable:!0}),Object.defineProperty(j.prototype,c,{value:{},writable:!0}),Object.defineProperty(j.prototype,a,{value:!1,writable:!0}),Object.defineProperty(j.prototype,u,{value:!1,writable:!0}),Object.defineProperty(j.prototype,W,{value:null,writable:!0}),Object.defineProperties(j.prototype,{setParentTemplate:{value:function(t){return this[W]=t,this}},getParentTemplate:{value:function(){return this[W]}},useSafeValue:{get:function(){return v}},useComponent:{get:function(){return r(this[p])?this[p].bind(this):function(){throw new Error("".concat(p," must be a function"))}}},useElement:{get:function(){return r(this[h])?this[h].bind(this):function(){throw new Error("".concat(h," must be a function"))}}},getMacro:{value:function(){return this[c]}},getBuffer:{value:function(){return this[s]}},getBlocks:{value:function(){return this[i]}},setExtend:{value:function(t){return this[u]=t,this}},getExtend:{value:function(){return this[u]}},setLayout:{value:function(t){return this[a]=t,this}},getLayout:{value:function(){return this[a]}},clone:{value:function(t){var e=[a,u,s];return!0===t&&e.push(i),y(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(r(t))return e.backup(),e(t.apply(n,arguments)),e.restore()}}},macro:{value:function(t,e){var n=this.getMacro(),r=this.fn(e),o=this;n[t]=function(){return o.echo(r.apply(void 0,arguments))}}},call:{value:function(t){var e=this.getMacro()[t],n=[].slice.call(arguments,1);if(r(e))return e.apply(e,n)}},block:{value:function(t,e){var n=this,r=this.getBlocks();if(r[t]=r[t]||[],r[t].push(this.fn(e)),!this.getExtend()){var o=Object.assign([],r[t]),i=function(){return o.shift()},c=function(){var t=i();return t?function(){n.echo(t(c()))}:b};this.echo(i()(c()))}}},hasBlock:{value:function(t){return this.getBlocks().hasOwnProperty(t)}},include:{value:function(t,e,n){var r=!1===n?{}:this.clone(!0),o=d(r,e||{}),i=this.render(t,o);this.echo(i)}},use:{value:function(t,e){var n=this;this.echo(Promise.resolve(this.require(t)).then((function(t){var r=n.getMacro();m(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=g(this,t,!0),r=n.shift(),o=n.pop();return E(r,o)?r[o]:e}},set:{value:function(t,e){var n=g(this,t,!1),r=n.shift(),o=n.pop();return this.getParentTemplate()&&E(r,o)?r[o]:r[o]=e}},each:{value:function(t,e){o(t)&&(t=this.get(t,[])),m(t,e)},writable:!0},el:{value:function(t,e,n){n=r(n)?this.fn(n)():n,this.echo(Promise.resolve(n).then((function(n){return M(t,e,n)})))},writable:!0},ui:{value:function(t){},writable:!0}}),j}(t,e)};return i(t,e),{configure:i,create:function(t){return new n(t)},helpers:function(t){d(n.prototype,t||{})}}},J=function(){var t=O({},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),e={},n=q(t,e),o=P(t),i=S(t),c=x(t,i,o),u=function(e){return function(t,e){var n=t.split(".").pop();return n!==e&&(t=[t,e].join(".")),t}(e,t.extension)},a=function(t){var e=h({});return v(u(t),e).then((function(){return e.getMacro()}))},s=function(t,e){var n=h(e);return v(u(t),n).then(f(t,n))},f=function(t,e){return function(n){return e.getExtend()?(e.setExtend(!1),l(e.getLayout(),e,t)):n}},l=function(t,e,n){var r=h(e);return n&&r.setParentTemplate(n),v(u(t),r).then(f(t,r))},p=function(t){n.helpers(d(e,t))},h=function(t){return n.create(t)},v=function(e,n){var o=[n,n.useComponent,n.useElement,n.getBuffer(),n.useSafeValue],i=t.globalHelpers.filter((function(t){return r(n[t])})).map((function(t){return n[t].bind(n)}));return c.get(e).then((function(t){return t.apply(n,o.concat(i))}))};return p({render:s,require:a}),{configure:function(){return O(t,(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})||{}),n.configure(t,e),o.configure(t),i.configure(t),c.configure(t),t},create:function(t){return J(t)},createContext:h,render:s,require:a,preload:function(t){return i.load(t||{})},compile:function(t,e){return o.compile(t,e)},helpers:p}},D=J({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 A}))}}),K=D.render,V=D.createContext,X=D.compile,Y=D.helpers,_=D.preload,z=D.configure,G=D.create;t.TemplateError=A,t.TemplateNotFound=$,t.TemplateSyntaxError=L,t.compile=X,t.configure=z,t.create=G,t.createContext=V,t.helpers=Y,t.preload=_,t.render=K}));