3 lines
7.2 KiB
JavaScript
3 lines
7.2 KiB
JavaScript
|
function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},t.apply(this,arguments)}class e{constructor(t){this.cache=void 0,this.cache=t}define(t,e){this.cache[t]=e}get(t){return this.cache[t]}remove(t){delete this.cache[t]}reset(){this.cache={}}load(e){this.cache=t({},this.cache,e)}}class n extends Error{constructor(t){super(t),this.name="Eta Error"}}class s extends n{constructor(t){super(t),this.name="EtaParser Error"}}class i extends n{constructor(t){super(t),this.name="EtaRuntime Error"}}class r extends n{constructor(t){super(t),this.name="EtaNameResolution Error"}}function a(t,e,n){const i=e.slice(0,n).split(/\n/),r=i.length,a=i[r-1].length+1;throw t+=" at line "+r+" col "+a+":\n\n "+e.split(/\n/)[r-1]+"\n "+Array(a).join(" ")+"^",new s(t)}function c(t,e,n,s){const r=e.split("\n"),a=Math.max(n-3,0),c=Math.min(r.length,n+3),l=s,o=r.slice(a,c).map(function(t,e){const s=e+a+1;return(s==n?" >> ":" ")+s+"| "+t}).join("\n"),h=new i((l?l+":"+n+"\n":"line "+n+"\n")+o+"\n\n"+t.message);throw h.name=t.name,h}const l=async function(){}.constructor;function o(t,e){const n=this.config,i=e&&e.async?l:Function;try{return new i(n.varName,"options",this.compileToString.call(this,t,e))}catch(n){throw n instanceof SyntaxError?new s("Bad template syntax\n\n"+n.message+"\n"+Array(n.message.length+1).join("=")+"\n"+this.compileToString.call(this,t,e)+"\n"):n}}function h(t,e){const n=this.config,s=e&&e.async,i=this.compileBody,r=this.parse.call(this,t);let a=`${n.functionHeader}\nlet include = (template, data) => this.render(template, data, options);\nlet includeAsync = (template, data) => this.renderAsync(template, data, options);\n\nlet __eta = {res: "", e: this.config.escapeFunction, f: this.config.filterFunction${n.debug?', line: 1, templateStr: "'+t.replace(/\\|"/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n")+'"':""}};\n\nfunction layout(path, data) {\n __eta.layout = path;\n __eta.layoutData = data;\n}${n.debug?"try {":""}${n.useWith?"with("+n.varName+"||{}){":""}\n\n${i.call(this,r)}\nif (__eta.layout) {\n __eta.res = ${s?"await includeAsync":"include"} (__eta.layout, {...${n.varName}, body: __eta.res, ...__eta.layoutData});\n}\n${n.useWith?"}":""}${n.debug?"} catch (e) { this.RuntimeErr(e, __eta.templateStr, __eta.line, options.filepath) }":""}\nreturn __eta.res;\n`;if(n.plugins)for(let t=0;t<n.plugins.length;t++){const e=n.plugins[t];e.processFnString&&(a=e.processFnString(a,n))}return a}function u(t){const e=this.config;let n=0;const s=t.length;let i="";for(;n<s;n++){const s=t[n];if("string"==typeof s)i+="__eta.res+='"+s+"'\n";else{const t=s.t;let n=s.val||"";e.debug&&(i+="__eta.line="+s.lineNo+"\n"),"r"===t?(e.autoFilter&&(n="__eta.f("+n+")"),i+="__eta.res+="+n+"\n"):"i"===t?(e.autoFilter&&(n="__eta.f("+n+")"),e.autoEscape&&(n="__eta.e("+n+")"),i+="__eta.res+="+n+"\n"):"e"===t&&(i+=n+"\n")}}return i}const p={"&":"&","<":"<",">":">",'"':""","'":"'"};function g(t){return p[t]}const d={autoEscape:!0,autoFilter:!1,autoTrim:[!1,"nl"],cache:!1,cacheFilepaths:!0,debug:!1,escapeFunction:function(t){const e=String(t);return/[&<>"']/.test(e)?e.replace(/[&<>"']/g,g):e},filterFunction:t=>String(t),functionHeader:"",parse:{exec:"",interpolate:"=",raw:"~"},plugins:[],rmWhitespace:!1,tags:["<%","%>"],useWith:!1,varName:"it",defaultExtension:".eta"},f=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,m=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,x=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;function y(t){return t.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")}function _(t,e){return t.slice(0,e).split("\n").length}function w(t){const e=this.config;let n=[],s=!1,i=0;const r=e.parse;if(e.plugins)for(let n=0;n<e.plugins.length;n++){const s=e.plugins[n];s.processTemplate&&(t=s.processTemplate(t,e))}function c(t,i){t&&(t=function(t,e,n,s){let i,r;return Array.isArray(e.autoTrim)?(i=e.autoTrim[1],r=e.autoTrim[0]):i=r=e.autoTrim,(n||!1===n)&&(i=n),(s||!1===s)&&(r=s),r||i?"slurp"===i&&"slurp"==
|
||
|
//# sourceMappingURL=browser.module.mjs.map
|