From 3ec0ce265749a3cc14fd6e72d02b00ff3c689243 Mon Sep 17 00:00:00 2001 From: umakantp Date: Thu, 27 May 2021 15:48:59 +0530 Subject: [PATCH] update package versions --- README.md | 2 +- dist/jsmart.js | 2 +- dist/jsmart.min.js | 6 +++--- package-lock.json | 4 ++-- src/wrapper.js | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3eba843..2b7e6e0 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Play with JsFiddle [demo page](https://jsfiddle.net/8p8xua0k/1/) ``` https://cdn.jsdelivr.net/npm/jsmart/dist/jsmart.min.js ``` -##### Current latest version (3.1.0) +##### Current latest version (4.0.0) ``` https://cdn.jsdelivr.net/npm/jsmart@3.1.0/dist/jsmart.min.js ``` diff --git a/dist/jsmart.js b/dist/jsmart.js index 22e783b..dd69352 100644 --- a/dist/jsmart.js +++ b/dist/jsmart.js @@ -6,7 +6,7 @@ * Max Miroshnikov * https://opensource.org/licenses/MIT * - * Date: 2021-05-27T09:58Z + * Date: 2021-05-27T10:17Z */ (function (factory) { 'use strict' diff --git a/dist/jsmart.min.js b/dist/jsmart.min.js index e6c960f..2fbd8d2 100644 --- a/dist/jsmart.min.js +++ b/dist/jsmart.min.js @@ -1,10 +1,10 @@ /*! - * jSmart JavaScript template engine (v3.1.0) + * jSmart JavaScript template engine (v4.0.0) * https://github.com/umakantp/jsmart * https://opensource.org/licenses/MIT * - * Copyright 2011-2017, Umakant Patil + * Copyright 2011-2021, Umakant Patil * Max Miroshnikov */ -!function(e){"use strict";"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=e():("object"==typeof window&&window.document&&(window.jSmart=e()),"function"==typeof define&&define.amd&&define("jSmart",[],e))}(function(){"use strict";function objectMerge(e,t){for(var r=1;r0){for(var r=[],a=0;a2?r[2].replace(/^\s+|\s+$/g,""):"",a in this.buildInFunctions){var p=this.buildInFunctions[a],u=("parseParams"in p?p.parseParams.bind(this):this.parseParams.bind(this))(n);if("block"===p.type){e=e.replace(/^\n/,""),i=this.findCloseTag("/"+a,a+" +[^}]*",e);var c=p.parse.call(this,u,e.slice(0,i.index));c&&(o=o.concat(c)),e=e.slice(i.index+i[0].length)}else"extends"===a&&o.splice(0,o.length),o=o.concat(p.parse.call(this,u)),"extends"===a&&(l=o.length);e=e.replace(/^\n/,"")}else if(a in this.runTimePlugins)o=o.concat(this.parsePluginFunc(a,this.parseParams(n)));else if(a in this.plugins){var g=this.plugins[a];"block"===g.type?(i=this.findCloseTag("/"+a,a+" +[^}]*",e),o=o.concat(this.parsePluginBlock(a,this.parseParams(n),e.slice(0,i.index))),e=e.slice(i.index+i[0].length)):"function"===g.type&&(o=o.concat(this.parsePluginFunc(a,this.parseParams(n)))),"append"!==a&&"assign"!==a&&"capture"!==a&&"eval"!==a&&"include"!==a||(e=e.replace(/^\n/,""))}else s=this.buildInFunctions.expression.parse.call(this,t[1]),o.push(s);else"build-in"===(s=this.buildInFunctions.expression.parse.call(this,t[1])).expression.type&&"operator"===s.expression.name&&"="===s.expression.op&&(e=e.replace(/^\n/,"")),o.push(s);return e&&(o=o.concat(this.parseText(e))),o.usedExtends=l,o},findTag:function(e,t){var r,a,n=0,s=0,i=this.ldelim,o=this.rdelim,l=this.autoLiteral,p=e?new RegExp("^\\s*("+e+")\\s*$","i"):/^\s*(.+)\s*$/i;for(r=0;r=0&&t.substr(r-1,1).match(/\s/))continue;if(!--n&&(a=t.slice(i.length,r).replace(/[\r\n]/g," ").match(p)))return a.index=s,a[0]=t.slice(0,r+o.length),a;n<0&&(n=0)}return null},findElseTag:function(e,t,r,a){for(var n=0,s=this.findTag(r,a);s;s=this.findTag(r,a)){var i=this.findTag(e,a);if(!i||i.index>s.index)return s.index+=n,s;a=a.slice(i.index+i[0].length),n+=i.index+i[0].length;var o=this.findCloseTag(t,e,a);a=a.slice(o.index+o[0].length),n+=o.index+o[0].length}return null},findCloseTag:function(e,t,r){var a="",n=null,s=null,i=0;do{if(n&&(i+=n[0].length),!(n=this.findTag(e,r)))throw new Error("Unclosed "+this.ldelim+t+this.rdelim);a+=r.slice(0,n.index),i+=n.index,r=r.slice(n.index+n[0].length),(s=this.findTag(t,a))&&(a=a.slice(s.index+s[0].length))}while(s);return n.index=i,n},bundleOp:function(e,t,r){var a=t[e];if("operator"===a.name&&a.precedence===r&&!a.params.__parsed){if("binary"===a.optype)return a.params.__parsed=[t[e-1],t[e+1]],t.splice(e-1,3,a),[!0,t];if("post-unary"===a.optype)return a.params.__parsed=[t[e-1]],t.splice(e-1,2,a),[!0,t];a.params.__parsed=[t[e+1]],t.splice(e,2,a)}return[!1,t]},composeExpression:function(e){var t,r=0;for(r=0;r0;--r)r-=(t=this.bundleOp(r-1,e,a))[0],e=t[1];else for(r=0;r\s*|\[\s*)/,i={value:"",tree:[]},o=[{type:"text",data:t.replace(/^(\w+)@(key|index|iteration|first|last|show|total)/gi,"$1__$2")}],l=r;for(r||(l=r=t),a=e.match(s);a;a=e.match(s)){if(r+=a[0],e=e.slice(a[0].length),a[0].match(/\[/)){(i=this.parseExpression(e,!0)).tree&&(r+=i.value,o.push(i.tree),e=e.slice(i.value.length));var p=e.match(/\s*\]/);p&&(r+=p[0],e=e.slice(p[0].length))}else{var u=this.parseModifiersStop;if(this.parseModifiersStop=!0,n=this.lookUp(e,""))if(i.tree=[].concat(i.tree,n.tree),i.value=n.value,r+=n.value,n.ret){var c=i.tree[i.tree.length-1];"plugin"===c.type&&"__func"===c.name&&(c.hasOwner=!0),o.push(c),e=e.slice(i.value.length)}else i=!1;this.parseModifiersStop=u}i||o.push({type:"text",data:""})}return{s:e,token:r,tree:[{type:"var",parts:o}],value:r.substr(l.length)}},parseFunc:function(e,t,r){return t.__parsed.name=this.parseText(e,[])[0],r.push({type:"plugin",name:"__func",params:t}),r},parseOperator:function(e,t,r){return[{type:"build-in",name:"operator",op:e,optype:t,precedence:r,params:{}}]},parsePluginBlock:function(e,t,r){return[{type:"plugin",name:e,params:t,subTree:this.parse(r,[])}]},parsePluginFunc:function(e,t){return[{type:"plugin",name:e,params:t}]},parseModifiers:function(e,t){var r,a=e.match(/^\|(\w+)/),n="";if(!this.parseModifiersStop&&a){n+=a[0],r="default"===a[1]?"defaultValue":a[1],e=e.slice(a[0].length).replace(/^\s+/,""),this.parseModifiersStop=!0;for(var s=[],i=e.match(/^\s*:\s*/);i;i=e.match(/^\s*:\s*/)){n+=e.slice(0,i[0].length),e=e.slice(i[0].length);var o=this.lookUp(e,"");o.ret?(n+=o.value,s.push(o.tree[0]),e=e.slice(o.value.length)):s.push(this.parseText(""))}this.parseModifiersStop=!1,s.unshift(t.pop());var l=this.parseFunc(r,{__parsed:s},[]);t.push(l[0]);var p=this.parseModifiers(e,t);return p&&(t=t.concat(p.tree)),{value:n,tree:t}}},parseParams:function(e,t,r){var a=e.replace(/\n/g," ").replace(/^\s+|\s+$/g,""),n=[];if(e="",n.__parsed=[],!a)return n;for(t||(t=/^\s+/,r=/^(\w+)\s*=\s*/);a;){var s=null;if(r){var i=a.match(r);if(i){var o=i[1].charAt(0).match(/^\d+/);"true"!==i[1]&&"false"!==i[1]&&"null"!==i[1]||(o=!0),o||(s=trimAllQuotes(i[1]),e+=a.slice(0,i[0].length),a=a.slice(i[0].length))}}var l=this.parseExpression(a);if(!l)break;s?(n[s]=l.value,n.__parsed[s]=l.tree):(n.push(l.value),n.__parsed.push(l.tree)),e+=a.slice(0,l.value.length);var p=(a=a.slice(l.value.length)).match(t);if(!p)break;e+=a.slice(0,p[0].length),a=a.slice(p[0].length)}return n.toString=function(){return e},n},lookUp:function(e,t){var r,a=[];if(!e)return!1;if(e.substr(0,this.ldelim.length)===this.ldelim&&(t+=(r=this.findTag("",e))[0],r)){var n=this.parse(r[0]);a=a.concat(n);var s=this.parseModifiers(e.slice(t.length),a);return s?{ret:!0,tree:s.tree,value:s.value}:{ret:!0,tree:a,value:t}}var i=this.getMatchingToken(e);if(!1!==i){t+=RegExp.lastMatch;var o=this.tokens[i].parse.call(this,e.slice(RegExp.lastMatch.length),{tree:a,token:RegExp.lastMatch});if("string"==typeof o)if("parenStart"===o){var l=[];a.push(l),l.parent=a,a=l}else"parenEnd"===o&&a.parent&&(a=a.parent);else o&&o.constructor===Object?(t+=o.value,o=o.tree,a=a.concat(o)):a=a.concat(o);return{ret:!0,tree:a,value:t}}return{ret:!1,tree:a,value:t}},parseExpression:function(e){var t,r=[],a="";for(this.lastTreeInExpression=r;(t=this.lookUp(e.slice(a.length),a))&&(r=r.concat(t.tree),a=t.value,this.lastTreeInExpression=r,t.ret););return r.length&&(r=this.composeExpression(r)),{tree:r,value:a}},parseBool:function(e){return[{type:"boolean",data:e}]},parseText:function(e){var t=[];if(this.parseEmbeddedVars)for(var r=/([$][\w@]+)|`([^`]*)`/,a=r.exec(e);a;a=r.exec(e)){t.push({type:"text",data:e.slice(0,a.index)});var n=this.parseExpression(a[1]?a[1]:a[2]);t.push(n.tree),e=e.slice(a.index+a[0].length)}return t.push({type:"text",data:e}),t},loadTemplate:function(e,t){var r=[];if(!t&&e in this.files)r=this.files[e];else{var a=this.getTemplate(e);if("string"!=typeof a)throw new Error("No template for "+e);r=this.getTree(a),this.files[e]=r}return r},removeComments:function(e){for(var t=new RegExp(this.ldelim+"\\*"),r=new RegExp("\\*"+this.rdelim),a="",n=e.match(t);n;n=e.match(t)){a+=e.slice(0,n.index);var s=(e=e.slice(n.index+n[0].length)).match(r);if(!s)throw new Error("Unclosed "+t+"*");e=e.slice(s.index+s[0].length)}return a+e},applyFilters:function(e,t){for(var r=0;r=|<>|<|>)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1.replace(/<>/,"!="),"binary",5)}},{regex:/^\s+(lt|lte|le|gt|gte|ge)\s+/i,parse:function(e,t){var r=RegExp.$1.replace(/l(t)?e/,"<").replace(/lt/,"<=").replace(/g(t)?e/,">").replace(/gt/,">=");return this.parseOperator(r,"binary",5)}},{regex:/^\s+(is\s+(not\s+)?div\s+by)\s+/i,parse:function(e,t){return this.parseOperator(RegExp.$2?"div_not":"div","binary",7)}},{regex:/^\s+is\s+(not\s+)?(even|odd)(\s+by\s+)?\s*/i,parse:function(e,t){var r=RegExp.$1?"odd"===RegExp.$2?"even":"even_not":"odd"===RegExp.$2?"even_not":"even",a=this.parseOperator(r,"binary",7);return RegExp.$3?a:a.concat(this.parseText("1",a))}},{regex:/^\s*(&&)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1,"binary",8)}},{regex:/^\s*(\|\|)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1,"binary",9)}},{regex:/^\s+and\s+/i,parse:function(e,t){return this.parseOperator("&&","binary",11)}},{regex:/^\s+xor\s+/i,parse:function(e,t){return this.parseOperator("xor","binary",12)}},{regex:/^\s+or\s+/i,parse:function(e,t){return this.parseOperator("||","binary",13)}},{regex:/^#(\w+)#/,parse:function(e,t){var r=this.parseVar(".config."+RegExp.$1,"smarty","$smarty"),a=this.parseModifiers(r.s,r.tree);return a?(r.value+=a.value,a):r}},{regex:/^\s*\[\s*/,parse:function(e,t){var r=this.parseParams(e,/^\s*,\s*/,/^('[^'\\]*(?:\\.[^'\\]*)*'|"[^"\\]*(?:\\.[^"\\]*)*"|\w+)\s*=>\s*/),a=this.parsePluginFunc("__array",r),n=r.toString(),s=e.slice(r.toString().length).match(/\s*\]/);return s&&(n+=s[0]),{tree:a,value:n}}},{regex:/^[\d.]+/,parse:function(e,t){t.token.indexOf(".")>-1?t.token=parseFloat(t.token):t.token=parseInt(t.token,10);var r=this.parseText(t.token),a=this.parseModifiers(e,r);return a||r}},{regex:/^\w+/,parse:function(e,t){var r=this.parseText(t.token),a=this.parseModifiers(e,r);return a||r}}],buildInFunctions:{expression:{parse:function(e){var t=this.parseExpression(e);return{type:"build-in",name:"expression",expression:t.tree,params:this.parseParams(e.slice(t.value.length).replace(/^\s+|\s+$/g,""))}}},section:{type:"block",parse:function(e,t){var r=[],a=[],n=this.findElseTag("section [^}]+","/section","sectionelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length).replace(/^[\r\n]/,""))):r=this.parse(t),{type:"build-in",name:"section",params:e,subTree:r,subTreeElse:a}}},setfilter:{type:"block",parseParams:function(e){return[this.parseExpression("__t()|"+e).tree]},parse:function(e,t){return{type:"build-in",name:"setfilter",params:e,subTree:this.parse(t)}}},config_load:{type:"function",parse:function(e){var t=trimAllQuotes(e.file?e.file:e[0]);return{type:"build-in",name:"config_load",params:e,content:this.getConfig(t),section:trimAllQuotes(e.section?e.section:e[1]?e[1]:"")}}},append:{type:"function",parse:function(e){return{type:"build-in",name:"append",params:e}}},assign:{type:"function",parse:function(e){return{type:"build-in",name:"assign",params:e}}},break:{type:"function",parse:function(e){return{type:"build-in",name:"break",params:e}}},continue:{type:"function",parse:function(e){return{type:"build-in",name:"continue",params:e}}},call:{type:"function",parse:function(e){return{type:"build-in",name:"call",params:e}}},capture:{type:"block",parse:function(e,t){return{type:"build-in",name:"capture",params:e,subTree:this.parse(t)}}},nocache:{type:"block",parse:function(e,t){return{type:"build-in",name:"nocache",params:e,subTree:this.parse(t)}}},eval:{type:"function",parse:function(e){return this.parsePluginFunc("eval",e)}},include:{type:"function",parse:function(e){var t=trimAllQuotes(e.file?e.file:e[0]),r=findInArray(e,"nocache")>=0;return{type:"build-in",name:"include",params:e,subTree:this.loadTemplate(t,r)}}},for:{type:"block",parseParams:function(e){var t=e.match(/^\s*\$(\w+)\s*=\s*([^\s]+)\s*to\s*([^\s]+)\s*(?:step\s*([^\s]+))?\s*(.*)$/);if(!t)throw new Error("Invalid {for} parameters: "+e);return this.parseParams("varName='"+t[1]+"' from="+t[2]+" to="+t[3]+" step="+(t[4]?t[4]:"1")+" "+t[5])},parse:function(e,t){var r=[],a=[],n=this.findElseTag("for\\s[^}]+","/for","forelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length))):r=this.parse(t),{type:"build-in",name:"for",params:e,subTree:r,subTreeElse:a}}},if:{type:"block",parse:function(e,t){var r=[],a=[],n=this.findElseTag("if\\s+[^}]+","/if","else[^}]*",t);if(n){r=this.parse(t.slice(0,n.index)),t=t.slice(n.index+n[0].length);var s=n[1].match(/^else\s*if(.*)/);a=s?this.buildInFunctions.if.parse.call(this,this.parseParams(s[1]),t.replace(/^\n/,"")):this.parse(t.replace(/^\n/,""))}else r=this.parse(t);return[{type:"build-in",name:"if",params:e,subTreeIf:r,subTreeElse:a}]}},foreach:{type:"block",parseParams:function(e){var t=e.match(/^\s*([$].+)\s*as\s*[$](\w+)\s*(=>\s*[$](\w+))?\s*$/i);return t&&(e="from="+t[1]+" item="+(t[4]||t[2]),t[4]&&(e+=" key="+t[2])),this.parseParams(e)},parse:function(e,t){var r=[],a=[],n=this.findElseTag("foreach\\s[^}]+","/foreach","foreachelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length).replace(/^[\r\n]/,""))):r=this.parse(t),{type:"build-in",name:"foreach",params:e,subTree:r,subTreeElse:a}}},function:{type:"block",parse:function(e,t){this.runTimePlugins[trimAllQuotes(e.name?e.name:e[0])]=!0;var r=this.parse(t);return this.runTimePlugins[trimAllQuotes(e.name?e.name:e[0])]={tree:r,defaultParams:e},!1}},extends:{type:"function",parse:function(e){return this.loadTemplate(trimAllQuotes(e.file?e.file:e[0]),!0)}},block:{type:"block",parse:function(e,t){var r;e.append=findInArray(e,"append")>=0,e.prepend=findInArray(e,"prepend")>=0,e.hide=findInArray(e,"hide")>=0;var a,n=this.parse(t,[]),s=trimAllQuotes(e.name?e.name:e[0]);return s in this.blocks?(this.outerBlocks[s]=[],this.outerBlocks[s]={tree:n,params:e},a="outer",r=t.match(/smarty.block.parent/),e.needParent=!1,r&&(e.needParent=!0)):(this.blocks[s]=[],this.blocks[s]={tree:n,params:e},a="inner",r=t.match(/smarty.block.child/),e.needChild=!1,r&&(e.needChild=!0)),{type:"build-in",name:"block",params:e,location:a}}},strip:{type:"block",parse:function(e,t){return this.parse(t.replace(/[ \t]*[\r\n]+[ \t]*/g,""))}},literal:{type:"block",parse:function(e,t){return this.parseText(t)}},ldelim:{type:"function",parse:function(e){return this.parseText(this.ldelim)}},rdelim:{type:"function",parse:function(e){return this.parseText(this.rdelim)}},while:{type:"block",parse:function(e,t){return{type:"build-in",name:"while",params:e,subTree:this.parse(t)}}}}};function isEmptyObject(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}function countProperties(e){var t=0;for(var r in e)e.hasOwnProperty(r)&&t++;return t}var jSmartProcessor={tplModifiers:[],runTimePlugins:{},plugins:{},modifiers:{},defaultModifiers:{},escapeHtml:!1,variableFilters:[],outerBlocks:{},blocks:{},debugging:!1,clear:function(){this.runTimePlugins={},this.variableFilters=[],this.escapeHtml=!1,this.defaultModifiers={},this.modifiers={},this.plugins={},this.blocks={},this.outerBlocks={},this.debugging=!1,this.includedTemplates=[]},getProcessed:function(e,t){var r=this.process(e,t);return this.debugging&&this.plugins.debug.process([],{includedTemplates:this.includedTemplates,assignedVars:t}),this.clear(),{output:r.tpl,smarty:r.smarty}},process:function(e,t){for(var r,a,n,s,i="",o=0;o":return s>r;case"===":return s===r;case">=":return s>=r;case"!==":return s!==r}}},section:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a={},n=r.__get("show",!0);if(t.smarty.section[r.__get("name",null,0)]=a,a.show=n,!n)return this.process(e.subTreeElse,t);var s=parseInt(r.__get("start",0),10),i=r.loop instanceof Object?countProperties(r.loop):isNaN(r.loop)?0:parseInt(r.loop),o=parseInt(r.__get("step",1),10),l=parseInt(r.__get("max"),10);isNaN(l)&&(l=Number.MAX_VALUE),s<0?(s+=i)<0&&(s=0):s>=i&&(s=i?i-1:0);var p=0,u=s;p=0;var c="";for(u=s;u>=0&&u=i,a.index=u,a.index_prev=u-o,a.index_next=u+o,a.iteration=a.rownum=p+1,a.total=p,a.loop=p;var g=this.process(e.subTree,t);void 0!==g&&(t=g.data,c+=g.tpl),t.smarty.continue=!1}return a.total=p,a.loop=p,t.smarty.break=!1,p?{tpl:c,data:t}:this.process(e.subTreeElse,t)}},setfilter:{process:function(e,t){this.tplModifiers.push(e.params);var r=this.process(e.subTree,t);return void 0!==r&&(t=r.data,r=r.tpl),this.tplModifiers.pop(),{tpl:r,data:t}}},for:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a=parseInt(r.__get("from"),10),n=parseInt(r.__get("to"),10),s=parseInt(r.__get("step"),10);isNaN(s)&&(s=1);var i=parseInt(r.__get("max"),10);isNaN(i)&&(i=Number.MAX_VALUE);for(var o=0,l="",p=Math.min(Math.ceil((1+(s>0?n-a:a-n))/Math.abs(s)),i),u=parseInt(r.from,10);o0,r.name&&(t.smarty.foreach[r.name].show=i>0?1:""),i>0?s:this.process(e.subTreeElse,t)}},break:{process:function(e,t){return t.smarty.break=!0,{tpl:"",data:t}}},continue:{process:function(e,t){return t.smarty.continue=!0,{tpl:"",data:t}}},block:{process:function(e,t){var r,a,n,s=trimAllQuotes(e.params.name?e.params.name:e.params[0]),i=this.blocks[s],o=this.outerBlocks[s];return"inner"===e.location?(i.params.needChild?(void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),t.smarty.block.child=a,void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=r):o.params.needParent?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),t.smarty.block.parent=r,void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),n=a):(void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),o.params.append?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=a+r):o.params.prepend?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=r+a):n=a),n):""}},call:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a={name:r.__get("name")?r.__get("name"):r.__get("0"),params:e.params},n=this.buildInFunctions.function.process.call(this,a,t),s=r.__get("assign",!1);return s?{tpl:"",data:this.assignVar(s,n,t)}:n}},include:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a=r.__get("file",null,0);this.includedTemplates.push(a);var n=objectMerge({},t,r);n.smarty.template=a;var s=this.process(e.subTree,n);return void 0!==s&&(s=s.tpl),r.assign?{tpl:"",data:this.assignVar(r.assign,s,t)}:s}},function:{process:function(e,t){var r=this.runTimePlugins[e.name],a=this.getActualParamValues(r.defaultParams,t);delete a.name;var n=this.getActualParamValues(e.params,t);return this.process(r.tree,objectMerge({},t,a,n)).tpl}},while:{process:function(e,t){for(var r="";this.getActualParamValues(e.params,t)[0]&&!t.smarty.break;){var a=this.process(e.subTree,t);void 0!==a&&(t=a.data,r+=a.tpl),t.smarty.continue=!1}return t.smarty.break=!1,{tpl:r,data:t}}}}},version="3.1.0",jSmart=function(e,t){this.smarty={block:{},break:!1,capture:{},continue:!1,counter:{},cycle:{},foreach:{},section:{},now:Math.floor((new Date).getTime()/1e3),const:{},config:{},current_dir:"/",template:"",ldelim:"{",rdelim:"}",version:version},this.autoLiteral=!0,this.escapeHtml=!1,this.debugging=!1,this.outerBlocks={},this.blocks={},this.parse(e,t)};function getHtmlTranslationTable(e,t){var r,a,n,s={},i={},o={},l={};if(o[0]="HTML_SPECIALCHARS",o[1]="HTML_ENTITIES",l[0]="ENT_NOQUOTES",l[2]="ENT_COMPAT",l[3]="ENT_QUOTES",a=isNaN(e)?e?e.toUpperCase():"HTML_SPECIALCHARS":o[e],n=isNaN(t)?t?t.toUpperCase():"ENT_COMPAT":l[t],"HTML_SPECIALCHARS"!==a&&"HTML_ENTITIES"!==a)throw new Error("Table: "+a+" not supported");s[38]="&","HTML_ENTITIES"===a&&(s[160]=" ",s[161]="¡",s[162]="¢",s[163]="£",s[164]="¤",s[165]="¥",s[166]="¦",s[167]="§",s[168]="¨",s[169]="©",s[170]="ª",s[171]="«",s[172]="¬",s[173]="­",s[174]="®",s[175]="¯",s[176]="°",s[177]="±",s[178]="²",s[179]="³",s[180]="´",s[181]="µ",s[182]="¶",s[183]="·",s[184]="¸",s[185]="¹",s[186]="º",s[187]="»",s[188]="¼",s[189]="½",s[190]="¾",s[191]="¿",s[192]="À",s[193]="Á",s[194]="Â",s[195]="Ã",s[196]="Ä",s[197]="Å",s[198]="Æ",s[199]="Ç",s[200]="È",s[201]="É",s[202]="Ê",s[203]="Ë",s[204]="Ì",s[205]="Í",s[206]="Î",s[207]="Ï",s[208]="Ð",s[209]="Ñ",s[210]="Ò",s[211]="Ó",s[212]="Ô",s[213]="Õ",s[214]="Ö",s[215]="×",s[216]="Ø",s[217]="Ù",s[218]="Ú",s[219]="Û",s[220]="Ü",s[221]="Ý",s[222]="Þ",s[223]="ß",s[224]="à",s[225]="á",s[226]="â",s[227]="ã",s[228]="ä",s[229]="å",s[230]="æ",s[231]="ç",s[232]="è",s[233]="é",s[234]="ê",s[235]="ë",s[236]="ì",s[237]="í",s[238]="î",s[239]="ï",s[240]="ð",s[241]="ñ",s[242]="ò",s[243]="ó",s[244]="ô",s[245]="õ",s[246]="ö",s[247]="÷",s[248]="ø",s[249]="ù",s[250]="ú",s[251]="û",s[252]="ü",s[253]="ý",s[254]="þ",s[255]="ÿ",s[8364]="€"),"ENT_NOQUOTES"!==n&&(s[34]="""),"ENT_QUOTES"===n&&(s[39]="'"),s[60]="<",s[62]=">";for(r in s)s.hasOwnProperty(r)&&(i[String.fromCharCode(r)]=s[r]);return i}jSmart.prototype={constructor:jSmart,tree:[],scripts:{},modifiers:{},defaultModifiers:[],defaultModifiersGlobal:[],globalAndDefaultModifiers:[],filters:{variable:[],post:[]},filtersGlobal:{pre:[],variable:[],post:[]},globalAndDefaultFilters:[],buildInFunctions:{},plugins:{},runTimePlugins:{},parse:function(e,t){var r;t||(t={}),t.rdelim?this.smarty.rdelim=t.rdelim:jSmart.prototype.right_delimiter?this.smarty.rdelim=jSmart.prototype.right_delimiter:this.smarty.rdelim="}",t.ldelim?this.smarty.ldelim=t.ldelim:jSmart.prototype.left_delimiter?this.smarty.ldelim=jSmart.prototype.left_delimiter:this.smarty.ldelim="{",void 0!==t.autoLiteral?this.autoLiteral=t.autoLiteral:void 0!==jSmart.prototype.auto_literal&&(this.autoLiteral=jSmart.prototype.auto_literal),void 0!==t.debugging?this.debugging=t.debugging:void 0!==jSmart.prototype.debugging&&(this.debugging=jSmart.prototype.debugging),void 0!==t.escapeHtml?this.escapeHtml=t.escapeHtml:void 0!==jSmart.prototype.escape_html&&(this.escapeHtml=jSmart.prototype.escape_html),e=String(e||""),jSmartParser.clear(),jSmartParser.rdelim=this.smarty.rdelim,jSmartParser.ldelim=this.smarty.ldelim,jSmartParser.getTemplate=this.getTemplate,jSmartParser.getConfig=this.getConfig,jSmartParser.autoLiteral=this.autoLiteral,jSmartParser.plugins=this.plugins,jSmartParser.preFilters=this.filtersGlobal.pre,r=jSmartParser.getParsed(e),this.tree=r.tree,this.runTimePlugins=r.runTimePlugins,this.blocks=r.blocks,this.outerBlocks=r.outerBlocks},fetch:function(e){var t;return"object"!=typeof e&&(e={}),e.smarty={},objectMerge(e.smarty,this.smarty),this.globalAndDefaultModifiers=jSmart.prototype.defaultModifiersGlobal.concat(this.defaultModifiers),this.globalAndDefaultFilters=jSmart.prototype.filtersGlobal.variable.concat(this.filters.variable),jSmartProcessor.clear(),jSmartProcessor.plugins=this.plugins,jSmartProcessor.modifiers=this.modifiers,jSmartProcessor.defaultModifiers=this.defaultModifiers,jSmartProcessor.escapeHtml=this.escapeHtml,jSmartProcessor.variableFilters=this.globalAndDefaultFilters,jSmartProcessor.runTimePlugins=this.runTimePlugins,jSmartProcessor.blocks=this.blocks,jSmartProcessor.outerBlocks=this.outerBlocks,jSmartProcessor.debugging=this.debugging,t=jSmartProcessor.getProcessed(this.tree,e,this.smarty),objectMerge(this.smarty,t.smarty),this.applyFilters(jSmart.prototype.filtersGlobal.post.concat(this.filters.post),t.output)},applyFilters:function(e,t){for(var r=0;r "+this.printR(e[a],t+"  ",t+t));return n+=r+")\n"}if(e instanceof Array){n="Array (\n";for(a in e)e.hasOwnProperty(a)&&(n+=t+t+"["+a+"] => "+this.printR(e[a],t+"  ",t+t));return n+=r+")\n"}if(e instanceof Boolean){var s="false";return!0===s&&(s="true"),s+"\n"}return e+"\n"},registerPlugin:function(e,t,r){"modifier"===e?this.modifiers[t]=r:this.plugins[t]={type:e,process:r}},registerFilter:function(e,t){(this.tree?this.filters:jSmart.prototype.filtersGlobal)["output"===e?"post":e].push(t)},addDefaultModifier:function(e){e instanceof Array||(e=[e]);for(var t=0;t=55296&&r<=56319){var a=r;return 1===t.length?r:1024*(a-55296)+(t.charCodeAt(1)-56320)+65536}return r},bin2Hex:function(e){var t,r,a,n="";for(t=0,r=(e+="").length;t1?a?s["&"]+e.substr(1):e:s[e]})},rawUrlDecode:function(e){return decodeURIComponent((e+"").replace(/%(?![\da-f]{2})/gi,function(){return"%25"}))},rawUrlEncode:function(e){return e+="",encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")},sprintf:function(){var e=arguments,t=0,r=function(e,t,r,a){r||(r=" ");var n=e.length>=t?"":new Array(1+t-e.length>>>0).join(r);return a?e+n:n+e},a=function(e,t,a,n,s,i){var o=n-e.length;return o>0&&(e=a||!s?r(e,n,i,a):[e.slice(0,t.length),r("",o,"0",!0),e.slice(t.length)].join("")),e},n=function(e,t,n,s,i,o,l){var p=e>>>0;return e=(n=n&&p&&{2:"0b",8:"0",16:"0x"}[t]||"")+r(p.toString(t),o||0,"0",!1),a(e,n,s,i,l)},s=function(e,t,r,n,s,i){return null!==n&&void 0!==n&&(e=e.slice(0,n)),a(e,"",t,r,s,i)};return e[t++].replace(/%%|%(\d+\$)?([-+'#0 ]*)(\*\d+\$|\*|\d+)?(?:\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,function(i,o,l,p,u,c){var g,h,f,d,m;if("%%"===i)return"%";var y,v=!1,b="",_=!1,x=!1,w=" ",j=l.length;for(y=0;y-1?6:"d"===c?0:void 0,m=o?e[o.slice(0,-1)]:e[t++],c){case"s":return s(m+"",v,p,u,_,w);case"c":return s(String.fromCharCode(+m),v,p,u,_);case"b":return n(m,2,x,v,p,u,_);case"o":return n(m,8,x,v,p,u,_);case"x":return n(m,16,x,v,p,u,_);case"X":return n(m,16,x,v,p,u,_).toUpperCase();case"u":return n(m,10,x,v,p,u,_);case"i":case"d":return g=+m||0,m=(h=(g=Math.round(g-g%1))<0?"-":b)+r(String(Math.abs(g)),u,"0",!1),a(m,h,v,p,_);case"e":case"E":case"f":case"F":case"g":case"G":return h=(g=+m)<0?"-":b,f=["toExponential","toFixed","toPrecision"]["efg".indexOf(c.toLowerCase())],d=["toString","toUpperCase"]["eEfFgG".indexOf(c)%2],m=h+Math.abs(g)[f](u),phpJs.justify(m,h,v,p,_)[d]();default:return i}})},makeTimeStamp:function(e){if(!e)return Math.floor((new Date).getTime()/1e3);if(isNaN(e)){var t=phpJs.strtotime(e);return-1===t||!1===t?Math.floor((new Date).getTime()/1e3):t}return 14===(e+="").length&&-1!==e.search(/^[\d]+$/g)?phpJs.mktime(e.substr(8,2),e.substr(10,2),e.substr(12,2),e.substr(4,2),e.substr(6,2),e.substr(0,4)):Number(e)},mktime:function(){var e=new Date,t=arguments,r=0,a=["Hours","Minutes","Seconds","Month","Date","FullYear"];for(r=0;r=0?t[5]<=69?2e3:t[5]<=100?1900:0:0,e.setFullYear(t[5],t[3]-1,t[4]),e.setHours(t[0],t[1],t[2]);var n=e.getTime();return(n/1e3>>0)-(n<0)},_pad:function(e,t,r,a){r||(r=" ");var n=e.length>=t?"":new Array(1+t-e.length>>>0).join(r);return a?e+n:n+e},justify:function(e,t,r,a,n,s){var i=a-e.length;return i>0&&(e=r||!n?phpJs._pad(e,a,s,r):[e.slice(0,t.length),phpJs._pad("",i,"0",!0),e.slice(t.length)].join("")),e},strtotime:function(e,t){var r,a,n,s,i,o,l,p,u,c,g;if(!e)return!1;e=e.replace(/^\s+|\s+$/g,"").replace(/\s{2,}/g," ").replace(/[\t\r\n]/g,"").toLowerCase();var h=new RegExp(["^(\\d{1,4})","([\\-\\.\\/:])","(\\d{1,2})","([\\-\\.\\/:])","(\\d{1,4})","(?:\\s(\\d{1,2}):(\\d{2})?:?(\\d{2})?)?","(?:\\s([A-Z]+)?)?$"].join(""));if((a=e.match(h))&&a[2]===a[4])if(a[1]>1901)switch(a[2]){case"-":return!(a[3]>12||a[5]>31)&&new Date(a[1],parseInt(a[3],10)-1,a[5],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3;case".":return!1;case"/":return!(a[3]>12||a[5]>31)&&new Date(a[1],parseInt(a[3],10)-1,a[5],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3}else if(a[5]>1901)switch(a[2]){case"-":case".":return!(a[3]>12||a[1]>31)&&new Date(a[5],parseInt(a[3],10)-1,a[1],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3;case"/":return!(a[1]>12||a[3]>31)&&new Date(a[5],parseInt(a[1],10)-1,a[3],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3}else switch(a[2]){case"-":return!(a[3]>12||a[5]>31||a[1]<70&&a[1]>38)&&(s=a[1]>=0&&a[1]<=38?+a[1]+2e3:a[1],new Date(s,parseInt(a[3],10)-1,a[5],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3);case".":return a[5]>=70?!(a[3]>12||a[1]>31)&&new Date(a[5],parseInt(a[3],10)-1,a[1],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3:a[5]<60&&!a[6]&&(!(a[1]>23||a[3]>59)&&(n=new Date,new Date(n.getFullYear(),n.getMonth(),n.getDate(),a[1]||0,a[3]||0,a[5]||0,a[9]||0)/1e3));case"/":return!(a[1]>12||a[3]>31||a[5]<70&&a[5]>38)&&(s=a[5]>=0&&a[5]<=38?+a[5]+2e3:a[5],new Date(s,parseInt(a[1],10)-1,a[3],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3);case":":return!(a[1]>23||a[3]>59||a[5]>59)&&(n=new Date,new Date(n.getFullYear(),n.getMonth(),n.getDate(),a[1]||0,a[3]||0,a[5]||0)/1e3)}if("now"===e)return null===t||isNaN(t)?(new Date).getTime()/1e3|0:0|t;if(!isNaN(r=Date.parse(e)))return r/1e3|0;if(h=new RegExp(["^([0-9]{4}-[0-9]{2}-[0-9]{2})","[ t]","([0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?)","([\\+-][0-9]{2}(:[0-9]{2})?|z)"].join("")),(a=e.match(h))&&("z"===a[4]?a[4]="Z":a[4].match(/^([+-][0-9]{2})$/)&&(a[4]=a[4]+":00"),!isNaN(r=Date.parse(a[1]+"T"+a[2]+a[4]))))return r/1e3|0;function f(e){var t,r,a,n,s=e.split(" "),p=s[0],u=s[1].substring(0,3),c=/\d+/.test(p),g="ago"===s[2],h=("last"===p?-1:1)*(g?-1:1);if(c&&(h*=parseInt(p,10)),l.hasOwnProperty(u)&&!s[1].match(/^mon(day|\.)?$/i))return i["set"+l[u]](i["get"+l[u]]()+h);if("wee"===u)return i.setDate(i.getDate()+7*h);if("next"===p||"last"===p)t=p,r=h,void 0!==(n=o[u])&&(0==(a=n-i.getDay())?a=7*r:a>0&&"last"===t?a-=7:a<0&&"next"===t&&(a+=7),i.setDate(i.getDate()+a));else if(!c)return!1;return!0}if(i=t?new Date(1e3*t):new Date,o={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6},l={yea:"FullYear",mon:"Month",day:"Date",hou:"Hours",min:"Minutes",sec:"Seconds"},c="([+-]?\\d+\\s"+(u="(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)")+"|(last|next)\\s"+u+")(\\sago)?",!(a=e.match(new RegExp(c,"gi"))))return!1;for(g=0,p=a.length;g1;r/=10)e=t.toString()+e;return e.toString()},a={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %r %Z",p:["AM","PM"],P:["am","pm"],r:"%I:%M:%S %p",x:"%m/%d/%Y",X:"%r",alt_digits:"",ERA:"",ERA_YEAR:"",ERA_D_T_FMT:"",ERA_D_FMT:"",ERA_T_FMT:""},n={a:function(e){return a.a[e.getDay()]},A:function(e){return a.A[e.getDay()]},b:function(e){return a.b[e.getMonth()]},B:function(e){return a.B[e.getMonth()]},C:function(e){return r(parseInt(e.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(e){return r(parseInt(this.G(e)/100,10),0)},G:function(e){var t=e.getFullYear(),r=parseInt(n.V(e),10),a=parseInt(n.W(e),10);return a>r?t++:0===a&&r>=52&&t--,t},H:["getHours","0"],I:function(e){var t=e.getHours()%12;return r(0===t?12:t,0)},j:function(e){var t=e-new Date(e.getFullYear()+"/1/1 GMT");t+=6e4*e.getTimezoneOffset();var a=parseInt(t/6e4/60/24,10)+1;return r(a,0,100)},k:["getHours","0"],l:function(e){var t=e.getHours()%12;return r(0===t?12:t," ")},m:function(e){return r(e.getMonth()+1,0)},M:["getMinutes","0"],p:function(e){return a.p[e.getHours()>=12?1:0]},P:function(e){return a.P[e.getHours()>=12?1:0]},s:function(e){return Date.parse(e)/1e3},S:["getSeconds","0"],u:function(e){var t=e.getDay();return 0===t?7:t},U:function(e){var t=parseInt(n.j(e),10),a=6-e.getDay(),s=parseInt((t+a)/7,10);return r(s,0)},V:function(e){var t=parseInt(n.W(e),10),a=new Date(e.getFullYear()+"/1/1").getDay(),s=t+(a>4||a<=1?0:1);return 53===s&&new Date(e.getFullYear()+"/12/31").getDay()<4?s=1:0===s&&(s=n.V(new Date(e.getFullYear()-1+"/12/31"))),r(s,0)},w:"getDay",W:function(e){var t=parseInt(n.j(e),10),a=7-n.u(e),s=parseInt((t+a)/7,10);return r(s,0,10)},y:function(e){return r(e.getFullYear()%100,0)},Y:"getFullYear",z:function(e){var t=e.getTimezoneOffset(),a=r(parseInt(Math.abs(t/60),10),0),n=r(t%60,0);return(t>0?"-":"+")+a+n},Z:function(e){return e.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(e){return"%"}},s=void 0===t?new Date:t instanceof Date?new Date(t):new Date(1e3*t),i={c:"locale",D:"%m/%d/%y",F:"%y-%m-%d",h:"%b",n:"\n",r:"locale",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};e.match(/%[cDFhnrRtTxX]/);)e=e.replace(/%([cDFhnrRtTxX])/g,function(e,t){var r=i[t];return"locale"===r?a[t]:r});return e.replace(/%([aAbBCdegGHIjklmMpPsSuUVwWyYzZ%])/g,function(e,t){var a=n[t];return"string"==typeof a?s[a]():"function"==typeof a?a(s):"object"==typeof a&&"string"==typeof a[0]?r(s[a[0]](),a[1]):t})}};return jSmart.prototype.registerPlugin("modifier","capitalize",function(e,t,r){if("string"!=typeof e)return e;var a,n=new RegExp(t?"[^a-zA-Z_à-ü]+":"[^a-zA-Z0-9_à-ü]"),s=null,i="";for(r&&(e=e.toLowerCase()),s=e.match(n);s;s=e.match(n))(a=e.slice(0,s.index)).match(/\d/)?i+=a:i+=a.charAt(0).toUpperCase()+a.slice(1),i+=e.slice(s.index,s.index+s[0].length),e=e.slice(s.index+s[0].length);return e.match(/\d/)?i+e:i+e.charAt(0).toUpperCase()+e.slice(1)}),jSmart.prototype.registerPlugin("modifier","cat",function(e,t){return t=t||"",String(e)+t}),jSmart.prototype.registerPlugin("modifier","count",function(e){if(e instanceof Array)return e.length;if("object"==typeof e){if(Object.keys)return Object.keys(e).length;var t=0;for(var r in e)e.hasOwnProperty(r)&&++t;return t}return 0}),jSmart.prototype.registerPlugin("modifier","count_characters",function(e,t){return e=String(e),t?e.length:e.replace(/\s/g,"").length}),jSmart.prototype.registerPlugin("modifier","count_paragraphs",function(e){var t=String(e).match(/\n+/g);return t?t.length+1:1}),jSmart.prototype.registerPlugin("modifier","count_sentences",function(e){if("string"==typeof e){var t=e.match(/\w[.?!](\W|$)/g);if(t)return t.length}return 0}),jSmart.prototype.registerPlugin("modifier","count_words",function(e){if("string"==typeof e){var t=e.match(/\w+/g);if(t)return t.length}return 0}),jSmart.prototype.registerPlugin("modifier","date_format",function(e,t,r){return phpJs.strftime(t||"%b %e, %Y",phpJs.makeTimeStamp(e||r))}),jSmart.prototype.registerPlugin("modifier","debug_print_var",function(e){console.log(e+"--");var t="";return"object"==typeof module&&module&&"object"==typeof module.exports?t="node":"object"==typeof window&&window.document&&(t="browser"),""===t?"":"browser"===t?jSmart.prototype.printR(e):void console.log(e)}),jSmart.prototype.registerPlugin("modifier","defaultValue",function(e,t){return t=t||"",e&&"null"!==e&&void 0!==e?e:t}),jSmart.prototype.registerPlugin("modifier","escape",function(e,t,r,a){e=String(e),t=t||"html",r=r||"UTF-8",a=void 0===a||Boolean(a);var n,s="";switch(t){case"html":return a&&(e=e.replace(/&/g,"&")),e.replace(//g,">").replace(/'/g,"'").replace(/"/g,""");case"htmlall":return phpJs.htmlEntities(e,3,r);case"url":return phpJs.rawUrlEncode(e);case"urlpathinfo":return phpJs.rawUrlEncode(e).replace(/%2F/g,"/");case"quotes":return e.replace(/(^|[^\\])'/g,"$1\\'");case"hex":for(s="",n=0;n=126?"&#"+i+";":e.substr(n,1)}return s;case"javascript":return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/<\//g,"")}),jSmart.prototype.registerPlugin("modifier","regex_replace",function(e,t,r){var a=t.match(/^ *\/(.*)\/(.*) *$/);return String(e).replace(new RegExp(a[1],"g"+(a.length>1?a[2]:"")),r)}),jSmart.prototype.registerPlugin("modifier","replace",function(e,t,r){if(!t)return e;e=String(e),t=String(t),r=String(r);var a="",n=-1;for(n=e.indexOf(t);n>=0;n=e.indexOf(t))a+=e.slice(0,n)+r,n+=t.length,e=e.slice(n);return a+e}),jSmart.prototype.registerPlugin("modifier","spacify",function(e,t){return t||(t=" "),String(e).replace(/(\n|.)(?!$)/g,"$1"+t)}),jSmart.prototype.registerPlugin("modifier","string_format",function(e,t){return phpJs.sprintf(t,e)}),jSmart.prototype.registerPlugin("modifier","strip",function(e,t){return t=t||" ",String(e).replace(/[\s]+/g,t)}),jSmart.prototype.registerPlugin("modifier","strip_tags",function(e,t,r){if(null===t&&(t=!0),r||!0!==t&&!1!==t&&(t+"").length>0&&(r=t,t=!0),r){var a=r.split(">");return a.splice(-1,1),e=String(e).replace(/<[^>]*?>/g,function(e,r,n){for(var s=e.match(/\w+/),i=0;i").match(/\w+/);if(s[0]===o[0])return e}return t?" ":""})}return String(e).replace(/<[^>]*?>/g,t?" ":"")}),jSmart.prototype.registerPlugin("modifier","to_charset",function(e){return e}),jSmart.prototype.registerPlugin("modifier","truncate",function(e,t,r,a,n){return e=String(e),t=t||80,r=null!=r?r:"...",e.length<=t?e:(t-=Math.min(t,r.length),n?e.slice(0,Math.floor(t/2))+r+e.slice(e.length-Math.floor(t/2)):(a||(e=e.slice(0,t+1).replace(/\s+?(\S+)?$/,"")),e.slice(0,t)+r))}),jSmart.prototype.registerPlugin("modifier","unescape",function(e,t,r){switch(e=String(e),t=t||"html",r=r||"UTF-8",t){case"html":return e.replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,'"');case"entity":case"htmlall":return phpJs.htmlEntityDecode(e,1);case"url":return phpJs.rawUrlDecode(e)}return e}),jSmart.prototype.registerPlugin("modifier","upper",function(e){return String(e).toUpperCase()}),jSmart.prototype.registerPlugin("modifier","wordwrap",function(e,t,r,a){t=t||80,r=r||"\n";for(var n=String(e).split("\n"),s=0;st;){for(var l=0,p=i.slice(l).match(/\s+/);p&&l+p.index<=t;p=i.slice(l).match(/\s+/))l+=p.index+p[0].length;l=a?t-1:l||(p?p.index+p[0].length:i.length),o+=i.slice(0,l).replace(/\s+$/,""),l=t.smarty.cycle[r].arr.length||a)&&(t.smarty.cycle[r].index=0),e.__get("assign",!1)?(this.assignVar(e.assign,t.smarty.cycle[r].arr[t.smarty.cycle[r].index],t),""):e.__get("print",!0)?t.smarty.cycle[r].arr[t.smarty.cycle[r].index]:""}),jSmart.prototype.registerPlugin("function","eval",function(e,t){var r=e.var;return"assign"in e?(this.assignVar(e.assign,r,t),""):r}),jSmart.prototype.registerPlugin("function","debug",function(e,t){var r="";if("object"==typeof module&&module&&"object"==typeof module.exports?r="node":"object"==typeof window&&window.document&&(r="browser"),""===r)return"";if("browser"===r){window.jsmartDebug&&window.jsmartDebug.close(),window.jsmartDebug=window.open("","","width=680, height=600,resizable,scrollbars=yes");var a="",n="",s=0;for(var i in t.includedTemplates)a+=""+t.includedTemplates[i]+"";""!==a&&(a="

included templates

"+a+"

"),s=0;for(var o in t.assignedVars)n+="["+o+"]"+jSmart.prototype.printR(t.assignedVars[o])+"";""!==n&&(n="

assigned template variables

"+n+"
");var l="jSmart Debug Console

jSmart Debug Console


"+a+n+"
";window.jsmartDebug.document.write(l)}else"undefined"!=typeof console&&(console.log("included templates:- "+JSON.stringify(a)),console.log("assigned template variables:- "+JSON.stringify(n)));return""}),jSmart.prototype.registerPlugin("function","fetch",function(e,t){var r=jSmart.prototype.getFile(e.__get("file",null,0));return"assign"in e?(this.assignVar(e.assign,r,t),""):r}),jSmart.prototype.registerPlugin("function","html_checkboxes",function(e,t){var r,a,n,s=e.__get("type","checkbox"),i=e.__get("name",s),o=i,l=e.__get("values",e.options),p=e.__get("options",[]),u="options"in e,c=e.__get("selected",!1),g=e.__get("separator",""),h=Boolean(e.__get("labels",!0)),f=Boolean(e.__get("label_ids",!1)),d=[],m=0,y="";if("checkbox"===s&&(i+="[]"),!u)for(r in e.output)p.push(e.output[r]);for(r in l)l.hasOwnProperty(r)&&(n=o+"_"+(a=u?r:l[r]),y=h?f?'";for(var x=0;x"+d["right"===g?x:d.length-1-x]+"";_+="\n"}return"
"+(i?"\n":"")+_+"\n\n"+y+"\n
"+i+"
\n"}),jSmart.prototype.registerPlugin("function","mailto",function(e,t){var r,a,n=e.__get("address",null),s=e.__get("encode","none"),i=e.__get("text",n),o=phpJs.rawUrlEncode(e.__get("cc","")).replace(/%40/g,"@").replace(/%2C/g,","),l=phpJs.rawUrlEncode(e.__get("bcc","")).replace(/%40/g,"@").replace(/%2C/g,","),p=phpJs.rawUrlEncode(e.__get("followupto","")).replace(/%40/g,"@").replace(/%2C/g,","),u=phpJs.rawUrlEncode(e.__get("subject","")),c=phpJs.rawUrlEncode(e.__get("newsgroups","")),g=e.__get("extra","");if(n+=o?"?cc="+o:"",n+=l?(o?"&":"?")+"bcc="+l:"",n+=u?(o||l?"&":"?")+"subject="+u:"",n+=c?(o||l||u?"&":"?")+"newsgroups="+c:"",r='"+i+"","javascript"===s){r="document.write('"+r+"');";var h="";for(a=0;aeval(unescape(\''+h+"'))<\/script>"}if("javascript_charcode"===s){var f=[];for(a=0;a\n\x3c!--\n{document.write(String.fromCharCode('+f.join(",")+"))}\n//--\x3e\n<\/script>\n"}if("hex"===s){if(n.match(/^.+\?.+$/))throw new Error("mailto: hex encoding does not work with extra attributes. Try javascript.");var d="";for(a=0;a"+(m=m.toLowerCase())+""}return r}),jSmart.prototype.registerPlugin("function","math",function(params,data){var equation=params.__get("equation",null).replace(/pi\(\s*\)/g,"PI");equation=equation.replace(/ceil/g,"Math.ceil").replace(/abs/g,"Math.abs").replace(/cos/g,"Math.cos").replace(/exp/g,"Math.exp").replace(/floor/g,"Math.floor").replace(/log/g,"Math.log").replace(/max/g,"Math.max").replace(/min/g,"Math.min").replace(/PI/g,"Math.PI").replace(/pow/g,"Math.pow").replace(/rand/g,"Math.rand").replace(/round/g,"Math.round").replace(/sin/g,"Math.sin").replace(/sqrt/g,"Math.sqrt").replace(/srans/g,"Math.srans").replace(/tan/g,"Math.tan");var words=equation.match(/\w+/g),i,j,tmp,banned=["ceil","abs","cos","exp","floor","log10","log","max","min","pi","pow","rand","round","sin","sqrt","srans","tan"];for(i=0;i(words[j+1]+"").length&&(tmp=words[j],words[j]=words[j+1],words[j+1]=tmp);for(i=0;i0&&(f=c+f),f=this.modifiers.wordwrap(f,n-l,s,i),l>0&&(f=f.replace(/^/gm,p)),g[h]=f)}var d=g.join(s+s);return"assign"in e?(this.assignVar(e.assign,d,r),""):d}),String.prototype.fetch=function(e){return new jSmart(this).fetch(e)},jSmart}); \ No newline at end of file +!function(e){"use strict";"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=e():("object"==typeof window&&window.document&&(window.jSmart=e()),"function"==typeof define&&define.amd&&define("jSmart",[],e))}(function(){"use strict";function objectMerge(e,t){for(var r=1;rs.index)return s.index+=a,s;n=n.slice(i.index+i[0].length),a+=i.index+i[0].length;i=this.findCloseTag(t,e,n);n=n.slice(i.index+i[0].length),a+=i.index+i[0].length}return null},findCloseTag:function(e,t,r){var n,a="",s=null,i=0;do{if(s&&(i+=s[0].length),!(s=this.findTag(e,r)))throw new Error("Unclosed "+this.ldelim+t+this.rdelim)}while(a+=r.slice(0,s.index),i+=s.index,r=r.slice(s.index+s[0].length),(n=this.findTag(t,a))&&(a=a.slice(n.index+n[0].length)),n);return s.index=i,s},bundleOp:function(e,t,r){var n=t[e];if("operator"===n.name&&n.precedence===r&&!n.params.__parsed){if("binary"===n.optype)return n.params.__parsed=[t[e-1],t[e+1]],t.splice(e-1,3,n),[!0,t];if("post-unary"===n.optype)return n.params.__parsed=[t[e-1]],t.splice(e-1,2,n),[!0,t];n.params.__parsed=[t[e+1]],t.splice(e,2,n)}return[!1,t]},composeExpression:function(e){for(var t,r=0,r=0;r\s*|\[\s*)/,l={value:"",tree:[]},p=[{type:"text",data:t.replace(/^(\w+)@(key|index|iteration|first|last|show|total)/gi,"$1__$2")}],u=r;for(r||(u=r=t),n=e.match(o);n;n=e.match(o))r+=n[0],e=e.slice(n[0].length),n[0].match(/\[/)?((l=this.parseExpression(e,!0)).tree&&(r+=l.value,p.push(l.tree),e=e.slice(l.value.length)),(i=e.match(/\s*\]/))&&(r+=i[0],e=e.slice(i[0].length))):(s=this.parseModifiersStop,this.parseModifiersStop=!0,(i=this.lookUp(e,""))&&(l.tree=[].concat(l.tree,i.tree),l.value=i.value,r+=i.value,i.ret?("plugin"===(i=l.tree[l.tree.length-1]).type&&"__func"===i.name&&(i.hasOwner=!0),p.push(i),e=e.slice(l.value.length)):l=!1),this.parseModifiersStop=s),l||p.push({type:"text",data:""});return a=r.substr(u.length),{s:e,token:r,tree:[{type:"var",parts:p}],value:a}},parseFunc:function(e,t,r){return t.__parsed.name=this.parseText(e,[])[0],r.push({type:"plugin",name:"__func",params:t}),r},parseOperator:function(e,t,r){return[{type:"build-in",name:"operator",op:e,optype:t,precedence:r,params:{}}]},parsePluginBlock:function(e,t,r){return[{type:"plugin",name:e,params:t,subTree:this.parse(r,[])}]},parsePluginFunc:function(e,t){return[{type:"plugin",name:e,params:t}]},parseModifiers:function(e,t){var r=e.match(/^\|(\w+)/),n="";if(!this.parseModifiersStop&&r){n+=r[0],o="default"===r[1]?"defaultValue":r[1],e=e.slice(r[0].length).replace(/^\s+/,""),this.parseModifiersStop=!0;for(var a=[],s=e.match(/^\s*:\s*/);s;s=e.match(/^\s*:\s*/)){n+=e.slice(0,s[0].length),e=e.slice(s[0].length);var i=this.lookUp(e,"");i.ret?(n+=i.value,a.push(i.tree[0]),e=e.slice(i.value.length)):a.push(this.parseText(""))}this.parseModifiersStop=!1,a.unshift(t.pop());var o=this.parseFunc(o,{__parsed:a},[]);t.push(o[0]);o=this.parseModifiers(e,t);return{value:n,tree:t=o?t.concat(o.tree):t}}},parseParams:function(e,t,r){var n=e.replace(/\n/g," ").replace(/^\s+|\s+$/g,""),a=[];if(e="",a.__parsed=[],!n)return a;for(t||(t=/^\s+/,r=/^(\w+)\s*=\s*/);n;){var s,i=null;!r||(o=n.match(r))&&(s=o[1].charAt(0).match(/^\d+/),(s="true"===o[1]||"false"===o[1]||"null"===o[1]?!0:s)||(i=trimAllQuotes(o[1]),e+=n.slice(0,o[0].length),n=n.slice(o[0].length)));var o=this.parseExpression(n);if(!o)break;i?(a[i]=o.value,a.__parsed[i]=o.tree):(a.push(o.value),a.__parsed.push(o.tree)),e+=n.slice(0,o.value.length);o=(n=n.slice(o.value.length)).match(t);if(!o)break;e+=n.slice(0,o[0].length),n=n.slice(o[0].length)}return a.toString=function(){return e},a},lookUp:function(e,t){var r,n=[];if(!e)return!1;if(e.substr(0,this.ldelim.length)===this.ldelim&&(t+=(r=this.findTag("",e))[0],r)){var a=this.parse(r[0]),n=n.concat(a),a=this.parseModifiers(e.slice(t.length),n);return a?{ret:!0,tree:a.tree,value:a.value}:{ret:!0,tree:n,value:t}}a=this.getMatchingToken(e);if(!1===a)return{ret:!1,tree:n,value:t};t+=RegExp.lastMatch;a=this.tokens[a].parse.call(this,e.slice(RegExp.lastMatch.length),{tree:n,token:RegExp.lastMatch});return"string"==typeof a?"parenStart"===a?(n.push(e=[]),e.parent=n,n=e):"parenEnd"===a&&n.parent&&(n=n.parent):n=(a&&a.constructor===Object&&(t+=a.value,a=a.tree),n.concat(a)),{ret:!0,tree:n,value:t}},parseExpression:function(e){var t,r=[],n="";for(this.lastTreeInExpression=r;(t=this.lookUp(e.slice(n.length),n))&&(r=r.concat(t.tree),n=t.value,this.lastTreeInExpression=r,t.ret););return{tree:r=r.length?this.composeExpression(r):r,value:n}},parseBool:function(e){return[{type:"boolean",data:e}]},parseText:function(e){var t=[];if(this.parseEmbeddedVars)for(var r=/([$][\w@]+)|`([^`]*)`/,n=r.exec(e);n;n=r.exec(e)){t.push({type:"text",data:e.slice(0,n.index)});var a=this.parseExpression(n[1]||n[2]);t.push(a.tree),e=e.slice(n.index+n[0].length)}return t.push({type:"text",data:e}),t},loadTemplate:function(e,t){var r=[];if(!t&&e in this.files)r=this.files[e];else{this.files[e]={};t=this.getTemplate(e);if("string"!=typeof t)throw new Error("No template for "+e);r=this.getTree(t),this.files[e]=r}return r},removeComments:function(e){for(var t=new RegExp(this.ldelim+"\\*"),r=new RegExp("\\*"+this.rdelim),n="",a=e.match(t);a;a=e.match(t)){n+=e.slice(0,a.index);var s=(e=e.slice(a.index+a[0].length)).match(r);if(!s)throw new Error("Unclosed "+t+"*");e=e.slice(s.index+s[0].length)}return n+e},applyFilters:function(e,t){for(var r=0;r=|<>|<|>)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1.replace(/<>/,"!="),"binary",5)}},{regex:/^\s+(lt|lte|le|gt|gte|ge)\s+/i,parse:function(e,t){var r=RegExp.$1.replace(/l(t)?e/,"<").replace(/lt/,"<=").replace(/g(t)?e/,">").replace(/gt/,">=");return this.parseOperator(r,"binary",5)}},{regex:/^\s+(is\s+(not\s+)?div\s+by)\s+/i,parse:function(e,t){return this.parseOperator(RegExp.$2?"div_not":"div","binary",7)}},{regex:/^\s+is\s+(not\s+)?(even|odd)(\s+by\s+)?\s*/i,parse:function(e,t){var r=RegExp.$1?"odd"===RegExp.$2?"even":"even_not":"odd"===RegExp.$2?"even_not":"even",r=this.parseOperator(r,"binary",7);return RegExp.$3?r:r.concat(this.parseText("1",r))}},{regex:/^\s*(&&)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1,"binary",8)}},{regex:/^\s*(\|\|)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1,"binary",9)}},{regex:/^\s+and\s+/i,parse:function(e,t){return this.parseOperator("&&","binary",11)}},{regex:/^\s+xor\s+/i,parse:function(e,t){return this.parseOperator("xor","binary",12)}},{regex:/^\s+or\s+/i,parse:function(e,t){return this.parseOperator("||","binary",13)}},{regex:/^#(\w+)#/,parse:function(e,t){var r=this.parseVar(".config."+RegExp.$1,"smarty","$smarty"),n=this.parseModifiers(r.s,r.tree);return n?(r.value+=n.value,n):r}},{regex:/^\s*\[\s*/,parse:function(e,t){var r=this.parseParams(e,/^\s*,\s*/,/^('[^'\\]*(?:\\.[^'\\]*)*'|"[^"\\]*(?:\\.[^"\\]*)*"|\w+)\s*=>\s*/),n=this.parsePluginFunc("__array",r),a=r.toString(),r=e.slice(r.toString().length).match(/\s*\]/);return r&&(a+=r[0]),{tree:n,value:a}}},{regex:/^[\d.]+/,parse:function(e,t){-1\s*[$](\w+))?\s*$/i);return t&&(e="from="+t[1]+" item="+(t[4]||t[2]),t[4]&&(e+=" key="+t[2])),this.parseParams(e)},parse:function(e,t){var r=[],n=[],a=this.findElseTag("foreach\\s[^}]+","/foreach","foreachelse",t);return a?(r=this.parse(t.slice(0,a.index)),n=this.parse(t.slice(a.index+a[0].length).replace(/^[\r\n]/,""))):r=this.parse(t),{type:"build-in",name:"foreach",params:e,subTree:r,subTreeElse:n}}},function:{type:"block",parse:function(e,t){this.runTimePlugins[trimAllQuotes(e.name||e[0])]=!0;t=this.parse(t);return!(this.runTimePlugins[trimAllQuotes(e.name||e[0])]={tree:t,defaultParams:e})}},extends:{type:"function",parse:function(e){return this.loadTemplate(trimAllQuotes(e.file||e[0]),!0)}},block:{type:"block",parse:function(e,t){var r;e.append=0<=findInArray(e,"append"),e.prepend=0<=findInArray(e,"prepend"),e.hide=0<=findInArray(e,"hide");var n,a=this.parse(t,[]),s=trimAllQuotes(e.name||e[0]);return s in this.blocks?(this.outerBlocks[s]=[],this.outerBlocks[s]={tree:a,params:e},n="outer",r=t.match(/smarty.block.parent/),e.needParent=!1,r&&(e.needParent=!0)):(this.blocks[s]=[],this.blocks[s]={tree:a,params:e},n="inner",r=t.match(/smarty.block.child/),e.needChild=!1,r&&(e.needChild=!0)),{type:"build-in",name:"block",params:e,location:n}}},strip:{type:"block",parse:function(e,t){return this.parse(t.replace(/[ \t]*[\r\n]+[ \t]*/g,""))}},literal:{type:"block",parse:function(e,t){return this.parseText(t)}},ldelim:{type:"function",parse:function(e){return this.parseText(this.ldelim)}},rdelim:{type:"function",parse:function(e){return this.parseText(this.rdelim)}},while:{type:"block",parse:function(e,t){return{type:"build-in",name:"while",params:e,subTree:this.parse(t)}}}}};function isEmptyObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return;return 1}function countProperties(e){var t,r=0;for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&r++;return r}var jSmartProcessor={tplModifiers:[],runTimePlugins:{},plugins:{},modifiers:{},defaultModifiers:{},escapeHtml:!1,variableFilters:[],outerBlocks:{},blocks:{},debugging:!1,clear:function(){this.runTimePlugins={},this.variableFilters=[],this.escapeHtml=!1,this.defaultModifiers={},this.modifiers={},this.plugins={},this.blocks={},this.outerBlocks={},this.debugging=!1,this.includedTemplates=[]},getProcessed:function(e,t){e=this.process(e,t);return this.debugging&&this.plugins.debug.process([],{includedTemplates:this.includedTemplates,assignedVars:t}),this.clear(),{output:e.tpl,smarty:e.smarty}},process:function(e,t,r){for(var n,a,s,i,o="",l=0;l":return i=":return i<=n;case"!==":return n!==i}}},section:{process:function(e,t){var r=this.getActualParamValues(e.params,t),n={},a=r.__get("show",!0);if(!((t.smarty.section[r.__get("name",null,0)]=n).show=a))return this.process(e.subTreeElse,t);var s=parseInt(r.__get("start",0),10),i=r.loop instanceof Object?countProperties(r.loop):isNaN(r.loop)?0:parseInt(r.loop),o=parseInt(r.__get("step",1),10),l=parseInt(r.__get("max"),10);isNaN(l)&&(l=Number.MAX_VALUE),s<0?(s+=i)<0&&(s=0):i<=s&&(s=i?i-1:0);for(var p=0,u=s,p=0,c="",u=s;0<=u&&u "+this.printR(e[n],t+"  ",t+t));return a+=r+")\n"}if(e instanceof Array){for(n in a="Array (\n",e)Object.prototype.hasOwnProperty.call(e,n)&&(a+=t+t+"["+n+"] => "+this.printR(e[n],t+"  ",t+t));return a+=r+")\n"}if(e instanceof Boolean){r="false";return(r=!0===r?"true":r)+"\n"}return e+"\n"},registerPlugin:function(e,t,r){"modifier"===e?this.modifiers[t]=r:this.plugins[t]={type:e,process:r}},registerFilter:function(e,t){(this.tree?this.filters:jSmart.prototype.filtersGlobal)["output"===e?"post":e].push(t)},addDefaultModifier:function(e){e instanceof Array||(e=[e]);for(var t=0;t=t?"":new Array(1+t-e.length>>>0).join(r),n?e+r:r+e}function _(e,t,r,n,a,s){var i=n-e.length;return e=0>>0;return e=(r=r&&o&&{2:"0b",8:"0",16:"0x"}[t]||"")+b(o.toString(t),s||0,"0",!1),_(e,r,n,a,i)}function w(e,t,r,n,a,s){return null!=n&&(e=e.slice(0,n)),_(e,"",t,r,a,s)}var x=arguments,j=0,e=x[j++];return e.replace(/%%|%(\d+\$)?([-+'#0 ]*)(\*\d+\$|\*|\d+)?(?:\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,function(e,t,r,n,a,s){var i,o,l,p,u;if("%%"===e)return"%";for(var c=!1,g="",h=!1,f=!1,d=" ",m=r.length,y=0;y>0)-(a<0)},_pad:function(e,t,r,n){r=r||" ";r=e.length>=t?"":new Array(1+t-e.length>>>0).join(r);return n?e+r:r+e},justify:function(e,t,r,n,a,s){var i=n-e.length;return e=0/g,">").replace(/'/g,"'").replace(/"/g,""");case"htmlall":return phpJs.htmlEntities(e,3,r);case"url":return phpJs.rawUrlEncode(e);case"urlpathinfo":return phpJs.rawUrlEncode(e).replace(/%2F/g,"/");case"quotes":return e.replace(/(^|[^\\])'/g,"$1\\'");case"hex":for(s="",a=0;a")}),jSmart.prototype.registerPlugin("modifier","regex_replace",function(e,t,r){t=t.match(/^ *\/(.*)\/(.*) *$/);return String(e).replace(new RegExp(t[1],"g"+(1");return o.splice(-1,1),e=String(e).replace(/<[^>]*?>/g,function(e,t,r){for(var n=e.match(/\w+/),a=0;a").match(/\w+/);if(n[0]===s[0])return e}return i?" ":""})}return String(e).replace(/<[^>]*?>/g,i?" ":"")}),jSmart.prototype.registerPlugin("modifier","to_charset",function(e){return e}),jSmart.prototype.registerPlugin("modifier","truncate",function(e,t,r,n,a){return r=null!=r?r:"...",(e=String(e)).length<=(t=t||80)?e:(t-=Math.min(t,r.length),a?e.slice(0,Math.floor(t/2))+r+e.slice(e.length-Math.floor(t/2)):(e=!n?e.slice(0,t+1).replace(/\s+?(\S+)?$/,""):e).slice(0,t)+r)}),jSmart.prototype.registerPlugin("modifier","unescape",function(e,t,r){switch(e=String(e),t=t||"html"){case"html":return e.replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,'"');case"entity":case"htmlall":return phpJs.htmlEntityDecode(e,1);case"url":return phpJs.rawUrlDecode(e)}return e}),jSmart.prototype.registerPlugin("modifier","upper",function(e){return String(e).toUpperCase()}),jSmart.prototype.registerPlugin("modifier","wordwrap",function(e,t,r,n){t=t||80,r=r||"\n";for(var a=String(e).split("\n"),s=0;st;){for(var l=0,p=i.slice(l).match(/\s+/);p&&l+p.index<=t;p=i.slice(l).match(/\s+/))l+=p.index+p[0].length;l=n?t-1:l||(p?p.index+p[0].length:i.length),o+=i.slice(0,l).replace(/\s+$/,""),l=t.smarty.cycle[r].arr.length||n)&&(t.smarty.cycle[r].index=0),e.__get("assign",!1)?(this.assignVar(e.assign,t.smarty.cycle[r].arr[t.smarty.cycle[r].index],t),""):e.__get("print",!0)?t.smarty.cycle[r].arr[t.smarty.cycle[r].index]:""}),jSmart.prototype.registerPlugin("function","eval",function(e,t){var r=e.var;return"assign"in e?(this.assignVar(e.assign,r,t),""):r}),jSmart.prototype.registerPlugin("function","debug",function(e,t){var r="";if("object"==typeof module&&module&&"object"==typeof module.exports?r="node":"object"==typeof window&&window.document&&(r="browser"),""===r)return"";if("browser"===r){window.jsmartDebug&&window.jsmartDebug.close(),window.jsmartDebug=window.open("","","width=680, height=600,resizable,scrollbars=yes");var n,a,s="",i="",o=0;for(n in t.includedTemplates)s+=""+t.includedTemplates[n]+"";for(a in""!==s&&(s="

included templates

"+s+"

"),o=0,t.assignedVars)i+="["+a+"]"+jSmart.prototype.printR(t.assignedVars[a])+"";""!==i&&(i="

assigned template variables

"+i+"
"),window.jsmartDebug.document.write("jSmart Debug Console

jSmart Debug Console


"+s+i+"
")}else"undefined"!=typeof console&&(console.log("included templates:- "+JSON.stringify(s)),console.log("assigned template variables:- "+JSON.stringify(i)));return""}),jSmart.prototype.registerPlugin("function","fetch",function(e,t){var r=jSmart.prototype.getFile(e.__get("file",null,0));return"assign"in e?(this.assignVar(e.assign,r,t),""):r}),jSmart.prototype.registerPlugin("function","html_checkboxes",function(e,t){var r,n,a,s=e.__get("type","checkbox"),i=e.__get("name",s),o=i,l=e.__get("values",e.options),p=e.__get("options",[]),u="options"in e,c=e.__get("selected",!1),g=e.__get("separator",""),h=Boolean(e.__get("labels",!0)),f=Boolean(e.__get("label_ids",!1)),d=[],m=0,y="";if("checkbox"===s&&(i+="[]"),!u)for(r in e.output)p.push(e.output[r]);for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(a=o+"_"+(n=u?r:l[r]),y=h?f?'",w=0;w"+d["right"===g?w:d.length-1-w]+"";v+="\n"}return"
"+(i?"\n":"")+v+"\n\n"+y+"\n
"+i+"
\n"}),jSmart.prototype.registerPlugin("function","mailto",function(e,t){var r=e.__get("address",null),n=e.__get("encode","none"),a=e.__get("text",r),s=phpJs.rawUrlEncode(e.__get("cc","")).replace(/%40/g,"@").replace(/%2C/g,","),i=phpJs.rawUrlEncode(e.__get("bcc","")).replace(/%40/g,"@").replace(/%2C/g,","),o=phpJs.rawUrlEncode(e.__get("followupto","")).replace(/%40/g,"@").replace(/%2C/g,","),l=phpJs.rawUrlEncode(e.__get("subject","")),p=phpJs.rawUrlEncode(e.__get("newsgroups","")),e=e.__get("extra","");if(r+=s?"?cc="+s:"",r+=i?(s?"&":"?")+"bcc="+i:"",r+=l?(s||i?"&":"?")+"subject="+l:"",r+=p?(s||i||l?"&":"?")+"newsgroups="+p:"",u='"+a+"","javascript"===n){for(var u="document.write('"+u+"');",c="",g=0;geval(unescape(\''+c+"'))<\/script>"}if("javascript_charcode"===n){var h=[];for(g=0;g\n\x3c!--\n{document.write(String.fromCharCode('+h.join(",")+"))}\n//--\x3e\n<\/script>\n"}if("hex"!==n)return u;if(r.match(/^.+\?.+$/))throw new Error("mailto: hex encoding does not work with extra attributes. Try javascript.");var f="";for(g=0;g"+(d=d.toLowerCase())+""}),jSmart.prototype.registerPlugin("function","math",function(params,data){for(var equation=params.__get("equation",null).replace(/pi\(\s*\)/g,"PI"),equation=equation.replace(/ceil/g,"Math.ceil").replace(/abs/g,"Math.abs").replace(/cos/g,"Math.cos").replace(/exp/g,"Math.exp").replace(/floor/g,"Math.floor").replace(/log/g,"Math.log").replace(/max/g,"Math.max").replace(/min/g,"Math.min").replace(/PI/g,"Math.PI").replace(/pow/g,"Math.pow").replace(/rand/g,"Math.rand").replace(/round/g,"Math.round").replace(/sin/g,"Math.sin").replace(/sqrt/g,"Math.sqrt").replace(/srans/g,"Math.srans").replace(/tan/g,"Math.tan"),words=equation.match(/\w+/g),i,j,tmp,banned=["ceil","abs","cos","exp","floor","log10","log","max","min","pi","pow","rand","round","sin","sqrt","srans","tan"],i=0;i(words[j+1]+"").length&&(tmp=words[j],words[j]=words[j+1],words[j+1]=tmp);for(i=0;i + * Copyright 2011-2021, Umakant Patil * Max Miroshnikov * https://opensource.org/licenses/MIT *