@rhinostone/swig 2.8.2 → 2.8.4
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.
- package/HISTORY.md +12 -0
- package/README.md +4 -16
- package/ROADMAP.md +11 -0
- package/dist/swig.js +37 -10
- package/dist/swig.min.js +15 -2
- package/dist/swig.min.js.map +1 -1
- package/dist/swig.runtime.js +2 -2
- package/dist/swig.runtime.min.js +2 -2
- package/lib/parser.js +30 -2
- package/lib/runtime.js +1 -1
- package/lib/swig.js +2 -2
- package/lib/tags/include.js +1 -1
- package/package.json +2 -2
package/dist/swig.runtime.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! Swig v2.8.
|
|
1
|
+
/*! Swig v2.8.4 | https://github.com/gina-io/swig | @license https://github.com/gina-io/swig/blob/master/LICENSE */
|
|
2
2
|
/*! DateZ (c) 2011 Tomo Universalis | @license https://github.com/tn0ms/DateZ/blob/master/LISENCE */
|
|
3
|
-
(()=>{var e=Object.getOwnPropertyNames,t=(t,r)=>function(){try{return r||(0,t[e(t)[0]])((r={exports:{}}).exports,r),r.exports}catch(e){throw r=0,e}},r=t({"packages/swig-core/lib/security.js"(e){e.dangerousProps=["__proto__","constructor","prototype"]}}),n=t({"packages/swig-core/lib/utils.js"(e){var t,n=r();function o(e,t){var r;if(null!=e&&-1===n.dangerousProps.indexOf(t)){if("function"==typeof(r=e[t])){if(!0===r.alters_data)return;if(!0===r.do_not_call_in_templates)return r;try{return r.call(e)}catch(e){return}}return r}}e.strip=function(e){return e.replace(/^\s+|\s+$/g,"")},e.startsWith=function(e,t){return 0===e.indexOf(t)},e.endsWith=function(e,t){return-1!==e.indexOf(t,e.length-t.length)},e.each=function(e,r){var n,o;if(t(e))for(n=0,o=e.length;n<o&&!1!==r(e[n],n,e);n+=1);else for(n in e)if(e.hasOwnProperty(n)&&!1===r(e[n],n,e))break;return e},e.isArray=t=Array.hasOwnProperty("isArray")?Array.isArray:function(e){return!!e&&("object"==typeof e&&-1!==Object.prototype.toString.call(e).indexOf())},e.some=function(r,n){var o,i,a=0;if(t(r))for(i=r.length;a<i&&!(o=n(r[a],a,r));a+=1);else e.each(r,function(e,t){return!(o=n(e,t,r))});return!!o},e.map=function(e,r){var n,o=0,i=[];if(t(e))for(n=e.length;o<n;o+=1)i[o]=r(e[o],o);else for(o in e)e.hasOwnProperty(o)&&(i[o]=r(e[o],o));return i},e.extend=function(){for(var e,t,r=arguments,n=r[0],o=r.length>1?Array.prototype.slice.call(r,1):[],i=0,a=o.length;i<a;i+=1)for(e in t=o[i]||{})t.hasOwnProperty(e)&&(n[e]=t[e]);return n},e.keys=function(t){return t?Object.keys?Object.keys(t):e.map(t,function(e,t){return t}):[]},e.throwError=function(e,t,r){throw t&&(e+=" on line "+t),r&&(e+=" in file "+r),new Error(e+".")},e.range=function(e,t){var r,n,o,i=[];if("number"==typeof e&&"number"==typeof t){if(!isFinite(e)||!isFinite(t))return i;if(e<=t)for(r=e;r<=t;r+=1)i.push(r);else for(r=e;r>=t;r-=1)i.push(r);return i}if("string"==typeof e&&"string"==typeof t&&1===e.length&&1===t.length){if((n=e.charCodeAt(0))<=(o=t.charCodeAt(0)))for(r=n;r<=o;r+=1)i.push(String.fromCharCode(r));else for(r=n;r>=o;r-=1)i.push(String.fromCharCode(r));return i}return i},e.slice=function(e,t,r,n){var o,i,a,s,u,l,c="string"==typeof e,f=[];function g(e){return e=Number(e),isNaN(e)?NaN:e<0?Math.ceil(e):Math.floor(e)}function h(e,t){return null==e?t:(e=g(e),isNaN(e)?t:(e<0?(e+=o)<i&&(e=i):e>a&&(e=a),e))}if(null==e||"number"!=typeof e.length)return c?"":[];if(o=e.length,null==n?n=1:(n=g(n),(isNaN(n)||0===n)&&(n=1)),n<0?(i=-1,a=o-1):(i=0,a=o),s=h(t,n<0?a:i),u=h(r,n<0?i:a),n>0)for(l=s;l<u;l+=n)f.push(e[l]);else for(l=s;l>u;l+=n)f.push(e[l]);return c?f.join(""):f},e.coerceOutput=function(e){return null==e?"":e},e.resolve=function(e,t){var r,n=e;for(r=0;r<t.length;r+=1)if(null==(n=o(n,t[r])))return n;return n}}}),o=t({"packages/swig-core/lib/cache.js"(e){e.shouldCache=function(e,t){return(e=e||{}).hasOwnProperty("cache")&&!e.cache||!t},e.cacheGet=function(t,r,n,o){if(!e.shouldCache(r,n))return"memory"===n?Object.prototype.hasOwnProperty.call(o,t)?o[t]:void 0:n.get(t)},e.cacheSet=function(t,r,n,o,i){e.shouldCache(r,o)||("memory"!==o?o.set(t,n):i[t]=n)}}}),i=t({"node_modules/path-browserify/index.js"(e,t){"use strict";function r(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function n(e,t){for(var r,n="",o=0,i=-1,a=0,s=0;s<=e.length;++s){if(s<e.length)r=e.charCodeAt(s);else{if(47===r)break;r=47}if(47===r){if(i===s-1||1===a);else if(i!==s-1&&2===a){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var u=n.lastIndexOf("/");if(u!==n.length-1){-1===u?(n="",o=0):o=(n=n.slice(0,u)).length-1-n.lastIndexOf("/"),i=s,a=0;continue}}else if(2===n.length||1===n.length){n="",o=0,i=s,a=0;continue}t&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+e.slice(i+1,s):n=e.slice(i+1,s),o=s-i-1;i=s,a=0}else 46===r&&-1!==a?++a:a=-1}return n}var o={resolve:function(){for(var e,t="",o=!1,i=arguments.length-1;i>=-1&&!o;i--){var a;i>=0?a=arguments[i]:(void 0===e&&(e=process.cwd()),a=e),r(a),0!==a.length&&(t=a+"/"+t,o=47===a.charCodeAt(0))}return t=n(t,!o),o?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(e){if(r(e),0===e.length)return".";var t=47===e.charCodeAt(0),o=47===e.charCodeAt(e.length-1);return 0!==(e=n(e,!t)).length||t||(e="."),e.length>0&&o&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return r(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var n=arguments[t];r(n),n.length>0&&(void 0===e?e=n:e+="/"+n)}return void 0===e?".":o.normalize(e)},relative:function(e,t){if(r(e),r(t),e===t)return"";if((e=o.resolve(e))===(t=o.resolve(t)))return"";for(var n=1;n<e.length&&47===e.charCodeAt(n);++n);for(var i=e.length,a=i-n,s=1;s<t.length&&47===t.charCodeAt(s);++s);for(var u=t.length-s,l=a<u?a:u,c=-1,f=0;f<=l;++f){if(f===l){if(u>l){if(47===t.charCodeAt(s+f))return t.slice(s+f+1);if(0===f)return t.slice(s+f)}else a>l&&(47===e.charCodeAt(n+f)?c=f:0===f&&(c=0));break}var g=e.charCodeAt(n+f);if(g!==t.charCodeAt(s+f))break;47===g&&(c=f)}var h="";for(f=n+c+1;f<=i;++f)f!==i&&47!==e.charCodeAt(f)||(0===h.length?h+="..":h+="/..");return h.length>0?h+t.slice(s+c):(s+=c,47===t.charCodeAt(s)&&++s,t.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(r(e),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,o=-1,i=!0,a=e.length-1;a>=1;--a)if(47===(t=e.charCodeAt(a))){if(!i){o=a;break}}else i=!1;return-1===o?n?"/":".":n&&1===o?"//":e.slice(0,o)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');r(e);var n,o=0,i=-1,a=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var s=t.length-1,u=-1;for(n=e.length-1;n>=0;--n){var l=e.charCodeAt(n);if(47===l){if(!a){o=n+1;break}}else-1===u&&(a=!1,u=n+1),s>=0&&(l===t.charCodeAt(s)?-1===--s&&(i=n):(s=-1,i=u))}return o===i?i=u:-1===i&&(i=e.length),e.slice(o,i)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!a){o=n+1;break}}else-1===i&&(a=!1,i=n+1);return-1===i?"":e.slice(o,i)},extname:function(e){r(e);for(var t=-1,n=0,o=-1,i=!0,a=0,s=e.length-1;s>=0;--s){var u=e.charCodeAt(s);if(47!==u)-1===o&&(i=!1,o=s+1),46===u?-1===t?t=s:1!==a&&(a=1):-1!==t&&(a=-1);else if(!i){n=s+1;break}}return-1===t||-1===o||0===a||1===a&&t===o-1&&t===n+1?"":e.slice(t,o)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}("/",e)},parse:function(e){r(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var n,o=e.charCodeAt(0),i=47===o;i?(t.root="/",n=1):n=0;for(var a=-1,s=0,u=-1,l=!0,c=e.length-1,f=0;c>=n;--c)if(47!==(o=e.charCodeAt(c)))-1===u&&(l=!1,u=c+1),46===o?-1===a?a=c:1!==f&&(f=1):-1!==a&&(f=-1);else if(!l){s=c+1;break}return-1===a||-1===u||0===f||1===f&&a===u-1&&a===s+1?-1!==u&&(t.base=t.name=0===s&&i?e.slice(1,u):e.slice(s,u)):(0===s&&i?(t.name=e.slice(1,a),t.base=e.slice(1,u)):(t.name=e.slice(s,a),t.base=e.slice(s,u)),t.ext=e.slice(a,u)),s>0?t.dir=e.slice(0,s-1):i&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};o.posix=o,t.exports=o}}),a=t({"packages/swig-core/lib/loaders/memory.js"(e,t){var r=i(),o=n();t.exports=function(e,t){var n={};return t=t?r.normalize(t):null,n.resolve=function(e,n){return t?(/^\.\.([\\/]|$)/.test(r.normalize(e))&&o.throwError('Template "'+e+'" resolves outside the loader root "'+t+'".'),n=t):n=n?r.dirname(n):"/",r.resolve(n,e)},n.load=function(t,r){var n,i;if(i=[t,t.replace(/^(\/|\\)/,"")],(n=e[i[0]]||e[i[1]])||o.throwError('Unable to find template "'+t+'".'),!r)return n;r(null,n)},n}}}),s=t({"packages/swig-core/lib/runtime.js"(e){var t=n(),r=o(),i=a();function s(){return""}function u(e){return new Error(e+" — the runtime-only build has no compiler. Precompile with the swig CLI (swig compile --recursive --register) and register the output, or load the full swig bundle instead.")}e.create=function(e){var n=t.extend({},e.filters),o={};function a(e){if(e){if(e.hasOwnProperty("loader")&&e.loader&&(!e.loader.load||!e.loader.resolve))throw new Error("Invalid loader option "+JSON.stringify(e.loader)+" found. Expected { load: function (pathname, cb) { ... }, resolve: function (to, from) { ... } }.");if(e.hasOwnProperty("cache")&&e.cache&&"memory"!==e.cache&&(!e.cache.get||!e.cache.set))throw new Error("Invalid cache option "+JSON.stringify(e.cache)+' found. Expected "memory" or { get: function (key) { ... }, set: function (key, value) { ... } }.')}}function l(e){return e&&e.locals?t.extend({},o.options.locals,e.locals):o.options.locals}function c(e,t,n){r.cacheSet(e,t,n,o.options.cache,o.cache)}function f(e){var r=l(),i=t.keys(r).length;return function(a,u){var l;return l=a&&i?t.extend({},r,a):a&&!i?a:!a&&i?r:{},e(o,l,n,t,s,u)}}function g(e,t){if("string"!=typeof e||!e.length)throw new Error("Template registration path must be a non-empty string.");if("function"!=typeof t)throw new Error('Registered template for "'+e+'" is not a function. Pass a pre-compiled template function.');if(!o.options.cache)throw new Error("Cannot register templates while caching is disabled (cache: "+o.options.cache+"). The registry is the compile cache.")}return a(e.defaults),o.options=t.extend({autoescape:!0,locals:{},cache:"memory",loader:i({},"/")},e.defaults||{}),o.cache={},o.extensions={},o.setDefaults=function(e){a(e),o.options=t.extend(o.options,e||{})},o.invalidateCache=function(){"memory"===o.options.cache&&(o.cache={})},o.setFilter=function(e,t){if("function"!=typeof t)throw new Error('Filter "'+e+'" is not a valid function.');n[e]=t},o.setExtension=function(e,t){o.extensions[e]=t},o.register=function(e,t){return g(e,t),c(o.options.loader.resolve(e),{},f(t)),o},o.registerBundle=function(e){var r=[];if(!e||"object"!=typeof e)throw new Error("Template bundle must be an object of { path: templateFn } pairs.");return t.each(e,function(e,t){r.push([t,e]),g(t,e)}),t.each(r,function(e){o.register(e[0],e[1])}),o},o.run=function(e,r,i){var a=l({locals:r});return i&&c(o.options.loader.resolve(i),{},f(e)),e(o,a,n,t,s)},o.compileFile=function(e,t,n){var i,a;if(t||(t={}),i=function(e,t){return r.cacheGet(e,t,o.options.cache,o.cache)}(o.options.loader.resolve(e,t.resolveFrom),t),i)return n?void n(null,i):i;if(a=u('Template "'+e+'" is not registered'),!n)throw a;n(a)},o.renderFile=function(e,t,r){if(!r)return o.compileFile(e)(t);o.compileFile(e,{},function(e,n){var o;if(e)r(e);else{try{o=n(t)}catch(e){return void r(e)}r(null,o)}})},o.getTemplate=function(e){return Promise.reject(u('Async template loading of "'+e+'" is unavailable'))},o.parse=function(){throw u("parse() is unavailable")},o.parseFile=function(){throw u("parseFile() is unavailable")},o.precompile=function(){throw u("precompile() is unavailable")},o.compile=function(){throw u("compile() is unavailable")},o.render=function(){throw u("render(source) is unavailable")},o.setTag=function(){throw u("setTag() is parse-time machinery and is unavailable")},o.renderFileAsync=function(){throw u("renderFileAsync() is unavailable")},o.compileFileAsync=function(){throw u("compileFileAsync() is unavailable")},o}}}),u=t({"lib/utils.js"(e,t){t.exports=n()}}),l=t({"packages/swig-core/lib/dateformatter.js"(e){var t=n(),r={full:["January","February","March","April","May","June","July","August","September","October","November","December"],abbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},o={full:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],alt:{"-1":"Yesterday",0:"Today",1:"Tomorrow"}};e.tzOffset=0,e.DateZ=function(){var r=["getUTCDate","getUTCDay","getUTCFullYear","getUTCHours","getUTCMilliseconds","getUTCMinutes","getUTCMonth","getUTCSeconds","toISOString","toGMTString","toUTCString","valueOf","getTime"],n=["getDate","getDay","getFullYear","getHours","getMilliseconds","getMinutes","getMonth","getSeconds","getYear","toDateString","toLocaleDateString","toLocaleTimeString"],o=this;o.date=o.dateZ=arguments.length>1?new Date(Date.UTC.apply(Date,arguments)+6e4*(new Date).getTimezoneOffset()):1===arguments.length?new Date(new Date(arguments[0])):new Date,o.timezoneOffset=o.dateZ.getTimezoneOffset(),t.each(n,function(e){o[e]=function(){return o.dateZ[e]()}}),t.each(r,function(e){o[e]=function(){return o.date[e]()}}),this.setTimezoneOffset(e.tzOffset)},e.DateZ.prototype={getTimezoneOffset:function(){return this.timezoneOffset},setTimezoneOffset:function(e){return this.timezoneOffset=e,this.dateZ=new Date(this.date.getTime()+6e4*this.date.getTimezoneOffset()-6e4*this.timezoneOffset),this}},e.d=function(e){return(e.getDate()<10?"0":"")+e.getDate()},e.D=function(e){return o.abbr[e.getDay()]},e.j=function(e){return e.getDate()},e.l=function(e){return o.full[e.getDay()]},e.N=function(e){var t=e.getDay();return t>=1?t:7},e.S=function(e){var t=e.getDate();return t%10==1&&11!==t?"st":t%10==2&&12!==t?"nd":t%10==3&&13!==t?"rd":"th"},e.w=function(e){return e.getDay()},e.z=function(t,r,n){var o=t.getFullYear(),i=new e.DateZ(o,t.getMonth(),t.getDate(),12,0,0),a=new e.DateZ(o,0,1,12,0,0);return i.setTimezoneOffset(r,n),a.setTimezoneOffset(r,n),Math.round((i-a)/864e5)},e.W=function(e){var t,r=new Date(e.valueOf()),n=(e.getDay()+6)%7;return r.setDate(r.getDate()-n+3),t=r.valueOf(),r.setMonth(0,1),4!==r.getDay()&&r.setMonth(0,1+(4-r.getDay()+7)%7),1+Math.ceil((t-r)/6048e5)},e.F=function(e){return r.full[e.getMonth()]},e.m=function(e){return(e.getMonth()<9?"0":"")+(e.getMonth()+1)},e.M=function(e){return r.abbr[e.getMonth()]},e.n=function(e){return e.getMonth()+1},e.t=function(e){return 32-new Date(e.getFullYear(),e.getMonth(),32).getDate()},e.L=function(e){return 29===new Date(e.getFullYear(),1,29).getDate()},e.o=function(e){var t=new Date(e.valueOf());return t.setDate(t.getDate()-(e.getDay()+6)%7+3),t.getFullYear()},e.Y=function(e){return e.getFullYear()},e.y=function(e){return e.getFullYear().toString().substr(2)},e.a=function(e){return e.getHours()<12?"am":"pm"},e.A=function(e){return e.getHours()<12?"AM":"PM"},e.B=function(e){var t,r=e.getUTCHours();return r=23===r?0:r+1,t=Math.abs((60*(60*r+e.getUTCMinutes())+e.getUTCSeconds())/86.4).toFixed(0),"000".concat(t).slice(t.length)},e.g=function(e){var t=e.getHours();return 0===t?12:t>12?t-12:t},e.G=function(e){return e.getHours()},e.h=function(e){var t=e.getHours();return(t<10||12<t&&22>t?"0":"")+(t<12?t:t-12)},e.H=function(e){var t=e.getHours();return(t<10?"0":"")+t},e.i=function(e){var t=e.getMinutes();return(t<10?"0":"")+t},e.s=function(e){var t=e.getSeconds();return(t<10?"0":"")+t},e.O=function(e){var t=e.getTimezoneOffset();return(t<0?"-":"+")+(t/60<10?"0":"")+Math.abs(t/60)+"00"},e.Z=function(e){return 60*e.getTimezoneOffset()},e.c=function(e){return e.toISOString()},e.r=function(e){return e.toUTCString()},e.U=function(e){return e.getTime()/1e3}}}),c=t({"lib/dateformatter.js"(e,t){t.exports=l()}}),f=t({"packages/swig-core/lib/filters.js"(e){var t=n();e.iterateFilter=function(e){var r=this,n={};return t.isArray(e)?t.map(e,function(e){return r.apply(null,arguments)}):"object"==typeof e?(t.each(e,function(e,t){n[t]=r.apply(null,arguments)}),n):void 0}}}),g=t({"lib/filters.js"(e){var t=u(),r=c(),n=f().iterateFilter;function o(e){return"<"===e?"<":">"===e?">":'"'===e?""":"'"}e.addslashes=function(t){var r=n.apply(e.addslashes,arguments);return void 0!==r?r:t.replace(/\\/g,"\\\\").replace(/\'/g,"\\'").replace(/\"/g,'\\"')},e.capitalize=function(t){var r=n.apply(e.capitalize,arguments);return void 0!==r?r:t.toString().charAt(0).toUpperCase()+t.toString().substr(1).toLowerCase()},e.date=function(e,t,n,o){var i,a=t.length,s=new r.DateZ(e),u=0,l="";for(n&&s.setTimezoneOffset(n,o);u<a;u+=1)"\\"===(i=t.charAt(u))?l+=(u+=1)<a?t.charAt(u):i:r.hasOwnProperty(i)?l+=r[i](s,n,o):l+=i;return l},e.default=function(e,t){return void 0===e||!e&&"number"!=typeof e?t:e},e.escape=function(t,r){var i,a,s,u,l;if(null==t)return t;if("string"!==(i=typeof t))return"object"===i&&void 0!==(s=n.apply(e.escape,arguments))?s:t;if("js"===r){for(a=t.replace(/\\/g,"\\u005C"),s="",u=0;u<a.length;u+=1)s+=(l=a.charCodeAt(u))<32?"\\u00"+(l=(l=l.toString(16).toUpperCase()).length<2?"0"+l:l):a[u];return s.replace(/&/g,"\\u0026").replace(/</g,"\\u003C").replace(/>/g,"\\u003E").replace(/\'/g,"\\u0027").replace(/"/g,"\\u0022").replace(/\=/g,"\\u003D").replace(/-/g,"\\u002D").replace(/;/g,"\\u003B")}return t.replace(/&(?!amp;|lt;|gt;|quot;|#39;)/g,"&").replace(/[<>"']/g,o)},e.e=e.escape,e.first=function(e){return"object"!=typeof e||t.isArray(e)?"string"==typeof e?e.substr(0,1):e[0]:e[t.keys(e)[0]]},e.groupBy=function(e,r){if(!t.isArray(e))return e;var n={};return t.each(e,function(e){if(e.hasOwnProperty(r)){var o=e[r],i=t.extend({},e);delete i[r],n[o]||(n[o]=[]),n[o].push(i)}}),n},e.join=function(e,r){if(t.isArray(e))return e.join(r);if("object"==typeof e){var n=[];return t.each(e,function(e){n.push(e)}),n.join(r)}return e},e.json=function(e,t){var r=JSON.stringify(e,null,t||0);return"string"!=typeof r?r:r.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/'/g,"\\u0027")},e.json.safe=!0,e.json_encode=e.json,e.last=function(e){if("object"==typeof e&&!t.isArray(e)){var r=t.keys(e);return e[r[r.length-1]]}return"string"==typeof e?e.charAt(e.length-1):e[e.length-1]},e.length=function(e){return"object"!=typeof e||t.isArray(e)?e.hasOwnProperty("length")?e.length:"":t.keys(e).length},e.lower=function(t){var r=n.apply(e.lower,arguments);return void 0!==r?r:t.toString().toLowerCase()},e.raw=function(t){return e.safe(t)},e.raw.safe=!0,e.replace=function(e,t,r,n){var o=new RegExp(t,n);return e.replace(o,r)},e.reverse=function(t){return e.sort(t,!0)},e.safe=function(e){return e},e.safe.safe=!0,e.sort=function(e,r){var n;if(t.isArray(e))n=t.extend([],e).sort();else switch(typeof e){case"object":n=t.keys(e).sort();break;case"string":return n=e.split(""),r?n.reverse().join(""):n.sort().join("")}return n&&r?n.reverse():n||e},e.striptags=function(t){var r=n.apply(e.striptags,arguments);return void 0!==r?r:t.toString().replace(/(<([^>]+)>)/gi,"")},e.title=function(t){var r=n.apply(e.title,arguments);return void 0!==r?r:t.toString().replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})},e.uniq=function(e){var r;return e&&t.isArray(e)?(r=[],t.each(e,function(e){-1===r.indexOf(e)&&r.push(e)}),r):""},e.upper=function(t){var r=n.apply(e.upper,arguments);return void 0!==r?r:t.toString().toUpperCase()},e.url_encode=function(t){var r=n.apply(e.url_encode,arguments);return void 0!==r?r:encodeURIComponent(t)},e.url_encode.safe=!0,e.url_decode=function(t){var r=n.apply(e.url_decode,arguments);return void 0!==r?r:decodeURIComponent(t)}}}),h=t({"browser/stubs/fs.js"(e,t){t.exports={}}}),p=t({"packages/swig-core/lib/loaders/filesystem.js"(e,t){var r=h(),n=i();t.exports=function(e,t,o){var i={};return t=t||"utf8",e=e?n.resolve(e):null,i.resolve=function(t,r){var i,a;if(r=e||(r?n.dirname(r):process.cwd()),i=n.resolve(r,t),e&&!o&&(a=n.normalize(e+n.sep),i!==e&&0!==i.indexOf(a)))throw new Error('Template "'+t+'" resolves outside the loader root "'+e+'" (CVE-2023-25345).');return i},i.load=function(e,n){if(!r||n&&!r.readFile||!r.readFileSync)throw new Error("Unable to find file "+e+" because there is no filesystem to read from.");if(e=i.resolve(e),!n)return r.readFileSync(e,t);r.readFile(e,t,n)},i}}}),d=t({"packages/swig-core/lib/loaders/index.js"(e){e.fs=p(),e.memory=a()}}),v=t({"lib/loaders/index.js"(e,t){t.exports=d()}}),y=t({"lib/runtime.js"(e){var t=s(),r=g(),n=c(),o=v();e.version="2.8.2";var i=t.create({filters:r});e.Swig=function(e){return t.create({filters:r,defaults:e})},e.loaders=o,e.register=i.register,e.registerBundle=i.registerBundle,e.run=i.run,e.compileFile=i.compileFile,e.renderFile=i.renderFile,e.setFilter=i.setFilter,e.setExtension=i.setExtension,e.setDefaults=i.setDefaults,e.invalidateCache=i.invalidateCache,e.setDefaultTZOffset=function(e){n.tzOffset=e},e.parse=i.parse,e.parseFile=i.parseFile,e.precompile=i.precompile,e.compile=i.compile,e.render=i.render,e.setTag=i.setTag,e.renderFileAsync=i.renderFileAsync,e.compileFileAsync=i.compileFileAsync}});t({"browser/runtime.js"(e){var t=y(),r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:e;"function"==typeof r.define&&"object"==typeof r.define.amd&&r.define("swig",[],function(){return t}),r.swig||(r.swig=t)}})()})();
|
|
3
|
+
(()=>{var e=Object.getOwnPropertyNames,t=(t,r)=>function(){try{return r||(0,t[e(t)[0]])((r={exports:{}}).exports,r),r.exports}catch(e){throw r=0,e}},r=t({"packages/swig-core/lib/security.js"(e){e.dangerousProps=["__proto__","constructor","prototype"]}}),n=t({"packages/swig-core/lib/utils.js"(e){var t,n=r();function o(e,t){var r;if(null!=e&&-1===n.dangerousProps.indexOf(t)){if("function"==typeof(r=e[t])){if(!0===r.alters_data)return;if(!0===r.do_not_call_in_templates)return r;try{return r.call(e)}catch(e){return}}return r}}e.strip=function(e){return e.replace(/^\s+|\s+$/g,"")},e.startsWith=function(e,t){return 0===e.indexOf(t)},e.endsWith=function(e,t){return-1!==e.indexOf(t,e.length-t.length)},e.each=function(e,r){var n,o;if(t(e))for(n=0,o=e.length;n<o&&!1!==r(e[n],n,e);n+=1);else for(n in e)if(e.hasOwnProperty(n)&&!1===r(e[n],n,e))break;return e},e.isArray=t=Array.hasOwnProperty("isArray")?Array.isArray:function(e){return!!e&&("object"==typeof e&&-1!==Object.prototype.toString.call(e).indexOf())},e.some=function(r,n){var o,i,a=0;if(t(r))for(i=r.length;a<i&&!(o=n(r[a],a,r));a+=1);else e.each(r,function(e,t){return!(o=n(e,t,r))});return!!o},e.map=function(e,r){var n,o=0,i=[];if(t(e))for(n=e.length;o<n;o+=1)i[o]=r(e[o],o);else for(o in e)e.hasOwnProperty(o)&&(i[o]=r(e[o],o));return i},e.extend=function(){for(var e,t,r=arguments,n=r[0],o=r.length>1?Array.prototype.slice.call(r,1):[],i=0,a=o.length;i<a;i+=1)for(e in t=o[i]||{})t.hasOwnProperty(e)&&(n[e]=t[e]);return n},e.keys=function(t){return t?Object.keys?Object.keys(t):e.map(t,function(e,t){return t}):[]},e.throwError=function(e,t,r){throw t&&(e+=" on line "+t),r&&(e+=" in file "+r),new Error(e+".")},e.range=function(e,t){var r,n,o,i=[];if("number"==typeof e&&"number"==typeof t){if(!isFinite(e)||!isFinite(t))return i;if(e<=t)for(r=e;r<=t;r+=1)i.push(r);else for(r=e;r>=t;r-=1)i.push(r);return i}if("string"==typeof e&&"string"==typeof t&&1===e.length&&1===t.length){if((n=e.charCodeAt(0))<=(o=t.charCodeAt(0)))for(r=n;r<=o;r+=1)i.push(String.fromCharCode(r));else for(r=n;r>=o;r-=1)i.push(String.fromCharCode(r));return i}return i},e.slice=function(e,t,r,n){var o,i,a,s,u,l,c="string"==typeof e,f=[];function g(e){return e=Number(e),isNaN(e)?NaN:e<0?Math.ceil(e):Math.floor(e)}function h(e,t){return null==e?t:(e=g(e),isNaN(e)?t:(e<0?(e+=o)<i&&(e=i):e>a&&(e=a),e))}if(null==e||"number"!=typeof e.length)return c?"":[];if(o=e.length,null==n?n=1:(n=g(n),(isNaN(n)||0===n)&&(n=1)),n<0?(i=-1,a=o-1):(i=0,a=o),s=h(t,n<0?a:i),u=h(r,n<0?i:a),n>0)for(l=s;l<u;l+=n)f.push(e[l]);else for(l=s;l>u;l+=n)f.push(e[l]);return c?f.join(""):f},e.coerceOutput=function(e){return null==e?"":e},e.resolve=function(e,t){var r,n=e;for(r=0;r<t.length;r+=1)if(null==(n=o(n,t[r])))return n;return n}}}),o=t({"packages/swig-core/lib/cache.js"(e){e.shouldCache=function(e,t){return(e=e||{}).hasOwnProperty("cache")&&!e.cache||!t},e.cacheGet=function(t,r,n,o){if(!e.shouldCache(r,n))return"memory"===n?Object.prototype.hasOwnProperty.call(o,t)?o[t]:void 0:n.get(t)},e.cacheSet=function(t,r,n,o,i){e.shouldCache(r,o)||("memory"!==o?o.set(t,n):i[t]=n)}}}),i=t({"node_modules/path-browserify/index.js"(e,t){"use strict";function r(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function n(e,t){for(var r,n="",o=0,i=-1,a=0,s=0;s<=e.length;++s){if(s<e.length)r=e.charCodeAt(s);else{if(47===r)break;r=47}if(47===r){if(i===s-1||1===a);else if(i!==s-1&&2===a){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var u=n.lastIndexOf("/");if(u!==n.length-1){-1===u?(n="",o=0):o=(n=n.slice(0,u)).length-1-n.lastIndexOf("/"),i=s,a=0;continue}}else if(2===n.length||1===n.length){n="",o=0,i=s,a=0;continue}t&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+e.slice(i+1,s):n=e.slice(i+1,s),o=s-i-1;i=s,a=0}else 46===r&&-1!==a?++a:a=-1}return n}var o={resolve:function(){for(var e,t="",o=!1,i=arguments.length-1;i>=-1&&!o;i--){var a;i>=0?a=arguments[i]:(void 0===e&&(e=process.cwd()),a=e),r(a),0!==a.length&&(t=a+"/"+t,o=47===a.charCodeAt(0))}return t=n(t,!o),o?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(e){if(r(e),0===e.length)return".";var t=47===e.charCodeAt(0),o=47===e.charCodeAt(e.length-1);return 0!==(e=n(e,!t)).length||t||(e="."),e.length>0&&o&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return r(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var n=arguments[t];r(n),n.length>0&&(void 0===e?e=n:e+="/"+n)}return void 0===e?".":o.normalize(e)},relative:function(e,t){if(r(e),r(t),e===t)return"";if((e=o.resolve(e))===(t=o.resolve(t)))return"";for(var n=1;n<e.length&&47===e.charCodeAt(n);++n);for(var i=e.length,a=i-n,s=1;s<t.length&&47===t.charCodeAt(s);++s);for(var u=t.length-s,l=a<u?a:u,c=-1,f=0;f<=l;++f){if(f===l){if(u>l){if(47===t.charCodeAt(s+f))return t.slice(s+f+1);if(0===f)return t.slice(s+f)}else a>l&&(47===e.charCodeAt(n+f)?c=f:0===f&&(c=0));break}var g=e.charCodeAt(n+f);if(g!==t.charCodeAt(s+f))break;47===g&&(c=f)}var h="";for(f=n+c+1;f<=i;++f)f!==i&&47!==e.charCodeAt(f)||(0===h.length?h+="..":h+="/..");return h.length>0?h+t.slice(s+c):(s+=c,47===t.charCodeAt(s)&&++s,t.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(r(e),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,o=-1,i=!0,a=e.length-1;a>=1;--a)if(47===(t=e.charCodeAt(a))){if(!i){o=a;break}}else i=!1;return-1===o?n?"/":".":n&&1===o?"//":e.slice(0,o)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');r(e);var n,o=0,i=-1,a=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var s=t.length-1,u=-1;for(n=e.length-1;n>=0;--n){var l=e.charCodeAt(n);if(47===l){if(!a){o=n+1;break}}else-1===u&&(a=!1,u=n+1),s>=0&&(l===t.charCodeAt(s)?-1===--s&&(i=n):(s=-1,i=u))}return o===i?i=u:-1===i&&(i=e.length),e.slice(o,i)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!a){o=n+1;break}}else-1===i&&(a=!1,i=n+1);return-1===i?"":e.slice(o,i)},extname:function(e){r(e);for(var t=-1,n=0,o=-1,i=!0,a=0,s=e.length-1;s>=0;--s){var u=e.charCodeAt(s);if(47!==u)-1===o&&(i=!1,o=s+1),46===u?-1===t?t=s:1!==a&&(a=1):-1!==t&&(a=-1);else if(!i){n=s+1;break}}return-1===t||-1===o||0===a||1===a&&t===o-1&&t===n+1?"":e.slice(t,o)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}("/",e)},parse:function(e){r(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var n,o=e.charCodeAt(0),i=47===o;i?(t.root="/",n=1):n=0;for(var a=-1,s=0,u=-1,l=!0,c=e.length-1,f=0;c>=n;--c)if(47!==(o=e.charCodeAt(c)))-1===u&&(l=!1,u=c+1),46===o?-1===a?a=c:1!==f&&(f=1):-1!==a&&(f=-1);else if(!l){s=c+1;break}return-1===a||-1===u||0===f||1===f&&a===u-1&&a===s+1?-1!==u&&(t.base=t.name=0===s&&i?e.slice(1,u):e.slice(s,u)):(0===s&&i?(t.name=e.slice(1,a),t.base=e.slice(1,u)):(t.name=e.slice(s,a),t.base=e.slice(s,u)),t.ext=e.slice(a,u)),s>0?t.dir=e.slice(0,s-1):i&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};o.posix=o,t.exports=o}}),a=t({"packages/swig-core/lib/loaders/memory.js"(e,t){var r=i(),o=n();t.exports=function(e,t){var n={};return t=t?r.normalize(t):null,n.resolve=function(e,n){return t?(/^\.\.([\\/]|$)/.test(r.normalize(e))&&o.throwError('Template "'+e+'" resolves outside the loader root "'+t+'".'),n=t):n=n?r.dirname(n):"/",r.resolve(n,e)},n.load=function(t,r){var n,i;if(i=[t,t.replace(/^(\/|\\)/,"")],(n=e[i[0]]||e[i[1]])||o.throwError('Unable to find template "'+t+'".'),!r)return n;r(null,n)},n}}}),s=t({"packages/swig-core/lib/runtime.js"(e){var t=n(),r=o(),i=a();function s(){return""}function u(e){return new Error(e+" — the runtime-only build has no compiler. Precompile with the swig CLI (swig compile --recursive --register) and register the output, or load the full swig bundle instead.")}e.create=function(e){var n=t.extend({},e.filters),o={};function a(e){if(e){if(e.hasOwnProperty("loader")&&e.loader&&(!e.loader.load||!e.loader.resolve))throw new Error("Invalid loader option "+JSON.stringify(e.loader)+" found. Expected { load: function (pathname, cb) { ... }, resolve: function (to, from) { ... } }.");if(e.hasOwnProperty("cache")&&e.cache&&"memory"!==e.cache&&(!e.cache.get||!e.cache.set))throw new Error("Invalid cache option "+JSON.stringify(e.cache)+' found. Expected "memory" or { get: function (key) { ... }, set: function (key, value) { ... } }.')}}function l(e){return e&&e.locals?t.extend({},o.options.locals,e.locals):o.options.locals}function c(e,t,n){r.cacheSet(e,t,n,o.options.cache,o.cache)}function f(e){var r=l(),i=t.keys(r).length;return function(a,u){var l;return l=a&&i?t.extend({},r,a):a&&!i?a:!a&&i?r:{},e(o,l,n,t,s,u)}}function g(e,t){if("string"!=typeof e||!e.length)throw new Error("Template registration path must be a non-empty string.");if("function"!=typeof t)throw new Error('Registered template for "'+e+'" is not a function. Pass a pre-compiled template function.');if(!o.options.cache)throw new Error("Cannot register templates while caching is disabled (cache: "+o.options.cache+"). The registry is the compile cache.")}return a(e.defaults),o.options=t.extend({autoescape:!0,locals:{},cache:"memory",loader:i({},"/")},e.defaults||{}),o.cache={},o.extensions={},o.setDefaults=function(e){a(e),o.options=t.extend(o.options,e||{})},o.invalidateCache=function(){"memory"===o.options.cache&&(o.cache={})},o.setFilter=function(e,t){if("function"!=typeof t)throw new Error('Filter "'+e+'" is not a valid function.');n[e]=t},o.setExtension=function(e,t){o.extensions[e]=t},o.register=function(e,t){return g(e,t),c(o.options.loader.resolve(e),{},f(t)),o},o.registerBundle=function(e){var r=[];if(!e||"object"!=typeof e)throw new Error("Template bundle must be an object of { path: templateFn } pairs.");return t.each(e,function(e,t){r.push([t,e]),g(t,e)}),t.each(r,function(e){o.register(e[0],e[1])}),o},o.run=function(e,r,i){var a=l({locals:r});return i&&c(o.options.loader.resolve(i),{},f(e)),e(o,a,n,t,s)},o.compileFile=function(e,t,n){var i,a;if(t||(t={}),i=function(e,t){return r.cacheGet(e,t,o.options.cache,o.cache)}(o.options.loader.resolve(e,t.resolveFrom),t),i)return n?void n(null,i):i;if(a=u('Template "'+e+'" is not registered'),!n)throw a;n(a)},o.renderFile=function(e,t,r){if(!r)return o.compileFile(e)(t);o.compileFile(e,{},function(e,n){var o;if(e)r(e);else{try{o=n(t)}catch(e){return void r(e)}r(null,o)}})},o.getTemplate=function(e){return Promise.reject(u('Async template loading of "'+e+'" is unavailable'))},o.parse=function(){throw u("parse() is unavailable")},o.parseFile=function(){throw u("parseFile() is unavailable")},o.precompile=function(){throw u("precompile() is unavailable")},o.compile=function(){throw u("compile() is unavailable")},o.render=function(){throw u("render(source) is unavailable")},o.setTag=function(){throw u("setTag() is parse-time machinery and is unavailable")},o.renderFileAsync=function(){throw u("renderFileAsync() is unavailable")},o.compileFileAsync=function(){throw u("compileFileAsync() is unavailable")},o}}}),u=t({"lib/utils.js"(e,t){t.exports=n()}}),l=t({"packages/swig-core/lib/dateformatter.js"(e){var t=n(),r={full:["January","February","March","April","May","June","July","August","September","October","November","December"],abbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},o={full:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],alt:{"-1":"Yesterday",0:"Today",1:"Tomorrow"}};e.tzOffset=0,e.DateZ=function(){var r=["getUTCDate","getUTCDay","getUTCFullYear","getUTCHours","getUTCMilliseconds","getUTCMinutes","getUTCMonth","getUTCSeconds","toISOString","toGMTString","toUTCString","valueOf","getTime"],n=["getDate","getDay","getFullYear","getHours","getMilliseconds","getMinutes","getMonth","getSeconds","getYear","toDateString","toLocaleDateString","toLocaleTimeString"],o=this;o.date=o.dateZ=arguments.length>1?new Date(Date.UTC.apply(Date,arguments)+6e4*(new Date).getTimezoneOffset()):1===arguments.length?new Date(new Date(arguments[0])):new Date,o.timezoneOffset=o.dateZ.getTimezoneOffset(),t.each(n,function(e){o[e]=function(){return o.dateZ[e]()}}),t.each(r,function(e){o[e]=function(){return o.date[e]()}}),this.setTimezoneOffset(e.tzOffset)},e.DateZ.prototype={getTimezoneOffset:function(){return this.timezoneOffset},setTimezoneOffset:function(e){return this.timezoneOffset=e,this.dateZ=new Date(this.date.getTime()+6e4*this.date.getTimezoneOffset()-6e4*this.timezoneOffset),this}},e.d=function(e){return(e.getDate()<10?"0":"")+e.getDate()},e.D=function(e){return o.abbr[e.getDay()]},e.j=function(e){return e.getDate()},e.l=function(e){return o.full[e.getDay()]},e.N=function(e){var t=e.getDay();return t>=1?t:7},e.S=function(e){var t=e.getDate();return t%10==1&&11!==t?"st":t%10==2&&12!==t?"nd":t%10==3&&13!==t?"rd":"th"},e.w=function(e){return e.getDay()},e.z=function(t,r,n){var o=t.getFullYear(),i=new e.DateZ(o,t.getMonth(),t.getDate(),12,0,0),a=new e.DateZ(o,0,1,12,0,0);return i.setTimezoneOffset(r,n),a.setTimezoneOffset(r,n),Math.round((i-a)/864e5)},e.W=function(e){var t,r=new Date(e.valueOf()),n=(e.getDay()+6)%7;return r.setDate(r.getDate()-n+3),t=r.valueOf(),r.setMonth(0,1),4!==r.getDay()&&r.setMonth(0,1+(4-r.getDay()+7)%7),1+Math.ceil((t-r)/6048e5)},e.F=function(e){return r.full[e.getMonth()]},e.m=function(e){return(e.getMonth()<9?"0":"")+(e.getMonth()+1)},e.M=function(e){return r.abbr[e.getMonth()]},e.n=function(e){return e.getMonth()+1},e.t=function(e){return 32-new Date(e.getFullYear(),e.getMonth(),32).getDate()},e.L=function(e){return 29===new Date(e.getFullYear(),1,29).getDate()},e.o=function(e){var t=new Date(e.valueOf());return t.setDate(t.getDate()-(e.getDay()+6)%7+3),t.getFullYear()},e.Y=function(e){return e.getFullYear()},e.y=function(e){return e.getFullYear().toString().substr(2)},e.a=function(e){return e.getHours()<12?"am":"pm"},e.A=function(e){return e.getHours()<12?"AM":"PM"},e.B=function(e){var t,r=e.getUTCHours();return r=23===r?0:r+1,t=Math.abs((60*(60*r+e.getUTCMinutes())+e.getUTCSeconds())/86.4).toFixed(0),"000".concat(t).slice(t.length)},e.g=function(e){var t=e.getHours();return 0===t?12:t>12?t-12:t},e.G=function(e){return e.getHours()},e.h=function(e){var t=e.getHours();return(t<10||12<t&&22>t?"0":"")+(t<12?t:t-12)},e.H=function(e){var t=e.getHours();return(t<10?"0":"")+t},e.i=function(e){var t=e.getMinutes();return(t<10?"0":"")+t},e.s=function(e){var t=e.getSeconds();return(t<10?"0":"")+t},e.O=function(e){var t=e.getTimezoneOffset();return(t<0?"-":"+")+(t/60<10?"0":"")+Math.abs(t/60)+"00"},e.Z=function(e){return 60*e.getTimezoneOffset()},e.c=function(e){return e.toISOString()},e.r=function(e){return e.toUTCString()},e.U=function(e){return e.getTime()/1e3}}}),c=t({"lib/dateformatter.js"(e,t){t.exports=l()}}),f=t({"packages/swig-core/lib/filters.js"(e){var t=n();e.iterateFilter=function(e){var r=this,n={};return t.isArray(e)?t.map(e,function(e){return r.apply(null,arguments)}):"object"==typeof e?(t.each(e,function(e,t){n[t]=r.apply(null,arguments)}),n):void 0}}}),g=t({"lib/filters.js"(e){var t=u(),r=c(),n=f().iterateFilter;function o(e){return"<"===e?"<":">"===e?">":'"'===e?""":"'"}e.addslashes=function(t){var r=n.apply(e.addslashes,arguments);return void 0!==r?r:t.replace(/\\/g,"\\\\").replace(/\'/g,"\\'").replace(/\"/g,'\\"')},e.capitalize=function(t){var r=n.apply(e.capitalize,arguments);return void 0!==r?r:t.toString().charAt(0).toUpperCase()+t.toString().substr(1).toLowerCase()},e.date=function(e,t,n,o){var i,a=t.length,s=new r.DateZ(e),u=0,l="";for(n&&s.setTimezoneOffset(n,o);u<a;u+=1)"\\"===(i=t.charAt(u))?l+=(u+=1)<a?t.charAt(u):i:r.hasOwnProperty(i)?l+=r[i](s,n,o):l+=i;return l},e.default=function(e,t){return void 0===e||!e&&"number"!=typeof e?t:e},e.escape=function(t,r){var i,a,s,u,l;if(null==t)return t;if("string"!==(i=typeof t))return"object"===i&&void 0!==(s=n.apply(e.escape,arguments))?s:t;if("js"===r){for(a=t.replace(/\\/g,"\\u005C"),s="",u=0;u<a.length;u+=1)s+=(l=a.charCodeAt(u))<32?"\\u00"+(l=(l=l.toString(16).toUpperCase()).length<2?"0"+l:l):a[u];return s.replace(/&/g,"\\u0026").replace(/</g,"\\u003C").replace(/>/g,"\\u003E").replace(/\'/g,"\\u0027").replace(/"/g,"\\u0022").replace(/\=/g,"\\u003D").replace(/-/g,"\\u002D").replace(/;/g,"\\u003B")}return t.replace(/&(?!amp;|lt;|gt;|quot;|#39;)/g,"&").replace(/[<>"']/g,o)},e.e=e.escape,e.first=function(e){return"object"!=typeof e||t.isArray(e)?"string"==typeof e?e.substr(0,1):e[0]:e[t.keys(e)[0]]},e.groupBy=function(e,r){if(!t.isArray(e))return e;var n={};return t.each(e,function(e){if(e.hasOwnProperty(r)){var o=e[r],i=t.extend({},e);delete i[r],n[o]||(n[o]=[]),n[o].push(i)}}),n},e.join=function(e,r){if(t.isArray(e))return e.join(r);if("object"==typeof e){var n=[];return t.each(e,function(e){n.push(e)}),n.join(r)}return e},e.json=function(e,t){var r=JSON.stringify(e,null,t||0);return"string"!=typeof r?r:r.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/'/g,"\\u0027")},e.json.safe=!0,e.json_encode=e.json,e.last=function(e){if("object"==typeof e&&!t.isArray(e)){var r=t.keys(e);return e[r[r.length-1]]}return"string"==typeof e?e.charAt(e.length-1):e[e.length-1]},e.length=function(e){return"object"!=typeof e||t.isArray(e)?e.hasOwnProperty("length")?e.length:"":t.keys(e).length},e.lower=function(t){var r=n.apply(e.lower,arguments);return void 0!==r?r:t.toString().toLowerCase()},e.raw=function(t){return e.safe(t)},e.raw.safe=!0,e.replace=function(e,t,r,n){var o=new RegExp(t,n);return e.replace(o,r)},e.reverse=function(t){return e.sort(t,!0)},e.safe=function(e){return e},e.safe.safe=!0,e.sort=function(e,r){var n;if(t.isArray(e))n=t.extend([],e).sort();else switch(typeof e){case"object":n=t.keys(e).sort();break;case"string":return n=e.split(""),r?n.reverse().join(""):n.sort().join("")}return n&&r?n.reverse():n||e},e.striptags=function(t){var r=n.apply(e.striptags,arguments);return void 0!==r?r:t.toString().replace(/(<([^>]+)>)/gi,"")},e.title=function(t){var r=n.apply(e.title,arguments);return void 0!==r?r:t.toString().replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})},e.uniq=function(e){var r;return e&&t.isArray(e)?(r=[],t.each(e,function(e){-1===r.indexOf(e)&&r.push(e)}),r):""},e.upper=function(t){var r=n.apply(e.upper,arguments);return void 0!==r?r:t.toString().toUpperCase()},e.url_encode=function(t){var r=n.apply(e.url_encode,arguments);return void 0!==r?r:encodeURIComponent(t)},e.url_encode.safe=!0,e.url_decode=function(t){var r=n.apply(e.url_decode,arguments);return void 0!==r?r:decodeURIComponent(t)}}}),h=t({"browser/stubs/fs.js"(e,t){t.exports={}}}),p=t({"packages/swig-core/lib/loaders/filesystem.js"(e,t){var r=h(),n=i();t.exports=function(e,t,o){var i={};return t=t||"utf8",e=e?n.resolve(e):null,i.resolve=function(t,r){var i,a;if(r=e||(r?n.dirname(r):process.cwd()),i=n.resolve(r,t),e&&!o&&(a=n.normalize(e+n.sep),i!==e&&0!==i.indexOf(a)))throw new Error('Template "'+t+'" resolves outside the loader root "'+e+'" (CVE-2023-25345).');return i},i.load=function(e,n){if(!r||n&&!r.readFile||!r.readFileSync)throw new Error("Unable to find file "+e+" because there is no filesystem to read from.");if(e=i.resolve(e),!n)return r.readFileSync(e,t);r.readFile(e,t,n)},i}}}),d=t({"packages/swig-core/lib/loaders/index.js"(e){e.fs=p(),e.memory=a()}}),v=t({"lib/loaders/index.js"(e,t){t.exports=d()}}),y=t({"lib/runtime.js"(e){var t=s(),r=g(),n=c(),o=v();e.version="2.8.4";var i=t.create({filters:r});e.Swig=function(e){return t.create({filters:r,defaults:e})},e.loaders=o,e.register=i.register,e.registerBundle=i.registerBundle,e.run=i.run,e.compileFile=i.compileFile,e.renderFile=i.renderFile,e.setFilter=i.setFilter,e.setExtension=i.setExtension,e.setDefaults=i.setDefaults,e.invalidateCache=i.invalidateCache,e.setDefaultTZOffset=function(e){n.tzOffset=e},e.parse=i.parse,e.parseFile=i.parseFile,e.precompile=i.precompile,e.compile=i.compile,e.render=i.render,e.setTag=i.setTag,e.renderFileAsync=i.renderFileAsync,e.compileFileAsync=i.compileFileAsync}});t({"browser/runtime.js"(e){var t=y(),r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:e;"function"==typeof r.define&&"object"==typeof r.define.amd&&r.define("swig",[],function(){return t}),r.swig||(r.swig=t)}})()})();
|
|
4
4
|
/*!
|
|
5
5
|
* Resolve a single path segment against a value, Django-style. A plain
|
|
6
6
|
* property access (`obj[seg]`) covers dictionary, attribute, and array /
|
package/lib/parser.js
CHANGED
|
@@ -48,6 +48,34 @@ function escapeRegExp(str) {
|
|
|
48
48
|
return str.replace(/[\-\/\\\^$*+?.()|\[\]{}]/g, '\\$&');
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/*!
|
|
52
|
+
* Turn a string autoescape option into the string literal that the
|
|
53
|
+
* autoescape tail writes into the compiled template as the e filter's
|
|
54
|
+
* strategy argument; the bare option used to be written there as code.
|
|
55
|
+
* The tail doubles every backslash, so the value is wrapped in double
|
|
56
|
+
* quotes without escaping it, and a value holding a double quote or a line
|
|
57
|
+
* break is rejected. One pair of matching outer quotes is removed first,
|
|
58
|
+
* so a value that was already quoted keeps working. A value that is not a
|
|
59
|
+
* non-empty string is returned unchanged.
|
|
60
|
+
* @param {*} value The autoescape option.
|
|
61
|
+
* @return {*}
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
64
|
+
function quoteEscapeOption(value) {
|
|
65
|
+
var quote;
|
|
66
|
+
if (typeof value !== 'string' || value === '') {
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
quote = value.charAt(0);
|
|
70
|
+
if (value.length > 1 && (quote === '"' || quote === "'") && value.charAt(value.length - 1) === quote) {
|
|
71
|
+
value = value.slice(1, -1);
|
|
72
|
+
}
|
|
73
|
+
if (/["\n\r\u2028\u2029]/.test(value)) {
|
|
74
|
+
throw new Error('Option "autoescape" must be true, false or an escape strategy name without double quotes or line breaks.');
|
|
75
|
+
}
|
|
76
|
+
return '"' + value + '"';
|
|
77
|
+
}
|
|
78
|
+
|
|
51
79
|
|
|
52
80
|
/**
|
|
53
81
|
* Parse a source string into tokens that are ready for compilation.
|
|
@@ -65,7 +93,7 @@ function escapeRegExp(str) {
|
|
|
65
93
|
*/
|
|
66
94
|
exports.parse = function (swig, source, opts, tags, filters) {
|
|
67
95
|
source = source.replace(/\r\n/g, '\n');
|
|
68
|
-
var escape = opts.autoescape,
|
|
96
|
+
var escape = quoteEscapeOption(opts.autoescape),
|
|
69
97
|
tagOpen = opts.tagControls[0],
|
|
70
98
|
tagClose = opts.tagControls[1],
|
|
71
99
|
varOpen = opts.varControls[0],
|
|
@@ -143,7 +171,7 @@ exports.parse = function (swig, source, opts, tags, filters) {
|
|
|
143
171
|
if (last && last.name === str.split(/\s+/)[0].replace(/^end/, '') && last.ends) {
|
|
144
172
|
switch (last.name) {
|
|
145
173
|
case 'autoescape':
|
|
146
|
-
escape = opts.autoescape;
|
|
174
|
+
escape = quoteEscapeOption(opts.autoescape);
|
|
147
175
|
break;
|
|
148
176
|
case 'raw':
|
|
149
177
|
inRaw = false;
|
package/lib/runtime.js
CHANGED
package/lib/swig.js
CHANGED
|
@@ -14,12 +14,12 @@ var utils = require('./utils'),
|
|
|
14
14
|
*
|
|
15
15
|
* @type {String}
|
|
16
16
|
*/
|
|
17
|
-
exports.version = "2.8.
|
|
17
|
+
exports.version = "2.8.4";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Swig Options Object. This object can be passed to many of the API-level Swig methods to control various aspects of the engine. All keys are optional.
|
|
21
21
|
* @typedef {Object} SwigOpts
|
|
22
|
-
* @property {boolean} autoescape Controls whether or not variable output will automatically be escaped for safe HTML output. Defaults to <code data-language="js">true</code>. Functions executed in variable statements will not be auto-escaped. Your application/functions should take care of their own auto-escaping.
|
|
22
|
+
* @property {boolean|string} autoescape Controls whether or not variable output will automatically be escaped for safe HTML output. Defaults to <code data-language="js">true</code>. A string names the escape strategy passed to the <code data-language="js">e</code> filter, such as <code data-language="js">"js"</code> or <code data-language="js">"html"</code>; it must not contain a double quote or a line break. Functions executed in variable statements will not be auto-escaped. Your application/functions should take care of their own auto-escaping.
|
|
23
23
|
* @property {array} varControls Open and close controls for variables. Defaults to <code data-language="js">['{{', '}}']</code>.
|
|
24
24
|
* @property {array} tagControls Open and close controls for tags. Defaults to <code data-language="js">['{%', '%}']</code>.
|
|
25
25
|
* @property {array} cmtControls Open and close controls for comments. Defaults to <code data-language="js">['{#', '#}']</code>.
|
package/lib/tags/include.js
CHANGED
|
@@ -35,7 +35,7 @@ exports.compile = function (compiler, args, content, parents, options, blockName
|
|
|
35
35
|
var file = args.shift(),
|
|
36
36
|
onlyIdx = args.indexOf(only),
|
|
37
37
|
onlyCtx = onlyIdx !== -1 ? args.splice(onlyIdx, 1) : false,
|
|
38
|
-
parentFile = (args.pop() || '')
|
|
38
|
+
parentFile = (args.pop() || ''),
|
|
39
39
|
ignoreMissing = args[args.length - 1] === missing ? (args.pop()) : false,
|
|
40
40
|
w = args.join('');
|
|
41
41
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhinostone/swig",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.4",
|
|
4
4
|
"description": "A simple, powerful, and extendable templating engine for node.js and browsers, similar to Django, Jinja2, and Twig.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"template",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"Rhinostone <contact@gina.io>"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@rhinostone/swig-core": "2.8.
|
|
24
|
+
"@rhinostone/swig-core": "2.8.4"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"esbuild": "^0.28.0",
|