ios-dev/comments/Home/node_modules/eta/dist/browser.module.mjs

3 lines
7.0 KiB
JavaScript
Raw Permalink Normal View History

2024-03-11 14:47:28 +03:00
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"}}function s(t,e,s){const i=e.slice(0,s).split(/\n/),a=i.length,r=i[a-1].length+1;throw t+=" at line "+a+" col "+r+":\n\n "+e.split(/\n/)[a-1]+"\n "+Array(r).join(" ")+"^",new n(t)}function i(t,e,s,i){const a=e.split("\n"),r=Math.max(s-3,0),c=Math.min(a.length,s+3),l=i,o=a.slice(r,c).map(function(t,e){const n=e+r+1;return(n==s?" >> ":" ")+n+"| "+t}).join("\n"),h=new n((l?l+":"+s+"\n":"line "+s+"\n")+o+"\n\n"+t.message);throw h.name=t.name,h}const a=async function(){}.constructor;function r(t,e){const s=this.config,i=e&&e.async?a:Function;try{return new i(s.varName,"options",this.compileToString.call(this,t,e))}catch(s){throw s instanceof SyntaxError?new n("Bad template syntax\n\n"+s.message+"\n"+Array(s.message.length+1).join("=")+"\n"+this.compileToString.call(this,t,e)+"\n"):s}}function c(t,e){const n=this.config,s=e&&e.async,i=this.compileBody,a=this.parse.call(this,t);let r=`${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,a)}\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&&(r=e.processFnString(r,n))}return r}function l(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 o={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function h(t){return o[t]}const u={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,h):e},filterFunction:t=>String(t),functionHeader:"",parse:{exec:"",interpolate:"=",raw:"~"},plugins:[],rmWhitespace:!1,tags:["<%","%>"],useWith:!1,varName:"it",defaultExtension:".eta"},p=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,g=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,d=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;function f(t){return t.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")}function m(t,e){return t.slice(0,e).split("\n").length}function y(t){const e=this.config;let n=[],i=!1,a=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,s){t&&(t=function(t,e,n,s){let i,a;return Array.isArray(e.autoTrim)?(i=e.autoTrim[1],a=e.autoTrim[0]):i=a=e.autoTrim,(n||!1===n)&&(i=n),(s||!1===s)&&(a=s),a||i?"slurp"===i&&"slurp"===a?t.trim():("_"===i||"slurp"===i?t=t.trimStart():"-"!==i&&"nl"!==i||(t=t.replace(/^(?:\r\n|\n|\r)/,"")),"_"===a||"slurp"===a?t=t.trimEnd():"-"!==a&&"nl"!==a||(t=t.replace(/(?:\r\n|\n|\r)$/,"")),t):t}(t,e,i,s),t&&(t=t.repl
//# sourceMappingURL=browser.module.mjs.map