templates.js.render.min.js Maven / Gradle / Ivy
/*! JsRender v1.0.0-beta: http://github.com/BorisMoore/jsrender and http://jsviews.com/jsviews
informal pre V1.0 commit counter: 54 */
(function(n,t,i){"use strict";function bt(n){return n}function tr(n){return n}function kt(n){o._dbgMode=n;yt=n?"Unavailable (nested view): use #getIndex()":"";g("dbg",hi.dbg=it.dbg=n?tr:bt)}function dt(n){return{getTgt:n,map:function(t){var r,i=this;i.src!==t&&(i.src&&i.unmap(),typeof t=="object"&&(r=n.apply(i,arguments),i.src=t,i.tgt=r))}}}function ot(n){this.name=(u.link?"JsViews":"JsRender")+" Error";this.message=n||this.name}function f(n,t){var i;n=n||{};for(i in t)n[i]=t[i];return n}function tt(n){return typeof n=="function"}function gt(n,t,i){return(!a.rTag||n)&&(p=n?n.charAt(0):p,w=n?n.charAt(1):w,s=t?t.charAt(0):s,v=t?t.charAt(1):v,nt=i||nt,n="\\"+p+"(\\"+nt+")?\\"+w,t="\\"+s+"\\"+v,y="(?:(?:(\\w+(?=[\\/\\s\\"+s+"]))|(?:(\\w+)?(:)|(>)|!--((?:[^-]|-(?!-))*)--|(\\*)))\\s*((?:[^\\"+s+"]|\\"+s+"(?!\\"+v+"))*?)",a.rTag=y+")",y=new RegExp(n+y+"(\\/)?|(?:\\/(\\w+)))"+t,"g"),vt=new RegExp("<.*>|([^\\\\]|^)[{}]|"+n+".*"+t)),[p,w,s,v,nt]}function ir(n,t){t||(t=n,n=i);var e,f,o,u,r=this,s=!t||t==="root";if(n){if(u=r.type===t?r:i,!u)if(e=r.views,r._.useKey){for(f in e)if(u=e[f].get(n,t))break}else for(f=0,o=e.length;!u&&f0){try{a=u.nodeType>0?u:!vt.test(u)&&t&&t(n.document).find(u)[0]}catch(c){}return a&&(u=e[r=r||a.getAttribute(et)],u||(r=r||"_"+gi++,a.setAttribute(et,r),u=e[r]=ii(r,a.innerHTML,f,o,s,h)),a=i),u}}var c,a;return u=u||"",c=v(u),h=h||(u.markup?u:{}),h.tmplName=r,f&&(h._parentTmpl=f),!c&&u.markup&&(c=v(u.markup))&&c.fn&&(c.debug!==u.debug||c.allowCode!==u.allowCode)&&(c=c.markup),c!==i?(r&&!f&&(wt[r]=function(){return u.render.apply(u,arguments)}),c.fn||u.fn?c.fn&&(u=r&&r!==c.tmplName?l(h,c):c):(u=ri(c,h),ct(c.replace(yi,"\\$&"),u)),or(h),u):void 0}function ri(n,t){var i,e=o.wrapMap||{},r=f({markup:n,tmpls:[],links:{},tags:{},bnds:[],_is:"template",render:ui},t);return t.htmlTag||(i=bi.exec(n),r.htmlTag=i?i[1].toLowerCase():""),i=e[r.htmlTag],i&&i!==e.div&&(r.markup=u.trim(r.markup)),r}function hr(n,t){function u(e,o,s){var l,h,v,c;if(e&&""+e!==e&&!e.nodeType&&!e.markup){for(v in e)u(v,e[v],o);return r}return o===i&&(o=e,e=i),e&&""+e!==e&&(s=o,o=e,e=i),c=s?s[f]=s[f]||{}:u,h=t.compile,(l=a.onBeforeStoreItem)&&(h=l(c,e,o,h)||h),e?o===null?delete c[e]:c[e]=h?o=h(e,o,s,n,t):o:o=h(i,o),h&&o&&(o._is=n),(l=a.onStoreItem)&&l(c,e,o,h),o}var f=n+"s";r[f]=u;k[n]=t}function cr(n,t){var i=this.jquery&&(this[0]||h('Unknown template: "'+self.selector+'"')),r=i.getAttribute(et);return ui.call(r?e[r]:e(i),n,t)}function ht(n,t,i){if(o._dbgMode)try{return n.fn(t,i,r)}catch(u){return h(u,i)}return n.fn(t,i,r)}function ui(n,t,i,r,f,e){var o=this;return!r&&o.fn._nvw&&!u.isArray(n)?ht(o,n,{tmpl:o}):fi.call(o,n,t,i,r,f,e)}function fi(n,t,r,f,o,s){var y,ut,g,a,nt,tt,it,p,v,rt,w,ft,h,et,c=this,k="";if(!!t===t&&(r=t,t=i),o===!0&&(it=!0,o=0),c.tag?(p=c,c=c.tag,rt=c._,ft=c.tagName,h=rt.tmpl||p.tmpl,et=c.attr&&c.attr!==b,t=l(t,c.ctx),v=p.content,p.props.link===!1&&(t=t||{},t.link=!1),f=f||p.view,n=arguments.length?n:f):h=c,h&&(!f&&n&&n._is==="view"&&(f=n),f&&(v=v||f.content,s=s||f._.onRender,n===f&&(n=f.data),t=l(t,f.ctx)),f&&f.data!==i||((t=t||{}).root=n),h.fn||(h=e[h]||e(h)),h)){if(s=(t&&t.link)!==!1&&!et&&s,w=s,s===!0&&(w=i,s=f._.onRender),t=h.helpers?l(h.helpers,t):t,u.isArray(n)&&!r)for(a=it?f:o!==i&&f||new d(t,"array",f,n,h,o,v,s),y=0,ut=n.length;yyt-bt&&(bt=pt.slice(bt,yt+1),lt=w+":"+bt+s,wt=v[lt],wt||(v[lt]=1,v[lt]=wt=ct(lt,i||t,!0),wt.paths.push({_jsvOb:wt})),wt!==1&&(o||t).push({_jsvOb:wt}))),e?(e=!ot,e?p:'"'):f?(f=!st,f?p:'"'):(k?(r++,y[r]=yt++,k):"")+(vt?r?"":(h=pt.slice(h,yt),u?(u=l=o=!1,"\b"):"\b,")+h+(h=yt+p.length,"\b"):it?(r&&c(n),u=g,l=d,h=yt+p.length,g+":"):g?g.split("^").join(".").replace(li,dt)+(ut?(a[++r]=!0,g.charAt(0)!=="."&&(y[r]=yt),kt?"":ut):nt):nt?nt:ht?(a[r--]=!1,ht)+(ut?(a[++r]=!0,ut):""):ft?(a[r]||c(n),","):b?"":(e=ot,f=st,'"'));c(n)}var u,o,l,f,e,h=0,v=i?i.links:t&&(t.links=t.links||{}),a={},y={0:-1},r=0;return(n+(i?" ":"")).replace(/\)\^/g,").").replace(ai,p)}function lt(n,i,r){var y,f,e,l,d,ht,ct,wt,at,g,rt,p,o,ft,et,v,nt,w,tt,vt,k,yt,pt,ot,s,a,st,h=0,u="",it={},bt=n.length;for(""+i===i?(v=r?'data-link="'+i.replace(ut," ").slice(1,-1)+'"':i,i=0):(v=i.tmplName||"unnamed",i.allowCode&&(it.allowCode=!0),i.debug&&(it.debug=!0),p=i.bnds,et=i.tmpls),y=0;y":l+e):(tt&&(nt=ri(vt,it),nt.tmplName=v+"/"+e,lt(tt,nt),et.push(nt)),pt||(w=e,yt=u,u=""),k=n[y+1],k=k&&k[0]==="else"),st=a?";\ntry{\nret+=":"\n+",ot&&(o||l&&l!==b)){if(s="return {"+d+"};",a&&(s="try {\n"+s+"\n}catch(e){return {error: j._err(e,view,"+a+")}}\n"),s=new Function("data,view,j,u"," // "+v+" "+h+" "+e+"\n"+s),s.paths=o,s._tag=e,r)return s;rt=1}if(u+=ot?(r?(a?"\ntry{\n":"")+"return ":st)+(rt?(rt=0,g=at=!0,'c("'+l+'",view,'+(o?(p[h-1]=s,h):"{"+d+"}")+")"):e===">"?(ct=!0,"h("+ft[0]+")"):(wt=!0,"((v="+ft[0]+')!=null?v:"")')):(g=ht=!0,"\n{view:view,tmpl:"+(tt?et.length:"0")+","+d+"},"),w&&!k){if(u="["+u.slice(0,-1)+"]",(r||o)&&(u=new Function("data,view,j,u"," // "+v+" "+h+" "+w+"\nreturn "+u+";"),o&&((p[h-1]=u).paths=o),u._tag=e,r))return u;u=yt+st+'t("'+w+'",view,this,'+(h||u)+")";o=0;w=0}a&&(g=!0,u+=";\n}catch(e){ret"+(r?"urn ":"+=")+"j._err(e,view,"+a+");}\n"+(r?"":"ret=ret"))}u="// "+v+"\nj=j||"+(t?"jQuery.":"jsviews.")+"views;var v"+(ht?",t=j._tag":"")+(at?",c=j._cnvt":"")+(ct?",h=j.converters.html":"")+(r?";\n":',ret=""\n')+(it.debug?"debugger;":"")+u+(r?"\n":";\nreturn ret;");try{u=new Function("data,view,j,u",u)}catch(kt){c("Compiled template code:\n\n"+u+'\n: "'+kt.message+'"')}return i&&(i.fn=u),g||(u._nvw=!0),u}function l(n,t){return n&&n!==t?t?f(f({},t),n):n:t&&f({},t)}function lr(n){return pt[n]||(pt[n]=""+n.charCodeAt(0)+";")}function ar(n){var i,t,r=[];if(typeof n=="object")for(i in n)t=n[i],t&&t.toJSON&&!t.toJSON()||tt(t)||r.push({key:i,prop:n[i]});return r}function ci(n){return n!=null?ki.test(n)&&(""+n).replace(di,lr)||n:""}if((!t||!t.views)&&!n.jsviews){var u,rt,y,vt,yt,p="{",w="{",s="}",v="}",nt="^",li=/^(!*?)(?:null|true|false|\d[\d.]*|([\w$]+|\.|~([\w$]+)|#(view|([\w$]+))?)([\w$.^]*?)(?:[.[^]([\w$]+)\]?)?)$/g,ai=/(\()(?=\s*\()|(?:([([])\s*)?(?:(\^?)(!*?[#~]?[\w$.^]+)?\s*((\+\+|--)|\+|-|&&|\|\||===|!==|==|!=|<=|>=|[<>%*:?\/]|(=))\s*|(!*?[#~]?[\w$.^]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*(([)\]])(?=\s*\.|\s*\^|\s*$)|[)\]])([([]?))|(\s+)/g,ut=/[ \t]*(\r\n|\n|\r)/g,vi=/\\(['"])/g,yi=/['"\\]/g,pi=/(?:\x08|^)(onerror:)?(?:(~?)(([\w$]+):)?([^\x08]+))\x08(,)?([^\x08]+)/gi,wi=/^if\s/,bi=/<(\w+)[>\s]/,ki=/[\x00`><\"'&]/,ft=/^on[A-Z]|^convert(Back)?$/,di=/[\x00`><"'&]/g,gi=0,nr=0,pt={"&":"&","<":"<",">":">","\x00":"","'":"'",'"':""","`":"`"},b="html",et="data-jsv-tmpl",wt={},k={template:{compile:ii},tag:{compile:sr},helper:{},converter:{}},r={jsviews:"v1.0.0-beta",settings:function(n){f(o,n);kt(o._dbgMode);o.jsv&&o.jsv()},sub:{View:d,Err:ot,tmplFn:ct,cvt:st,parse:si,extend:f,syntaxErr:c,DataMap:dt},_cnvt:ur,_tag:er,_err:h};(ot.prototype=new Error).constructor=ot;ni.depends=function(){return[this.get("item"),"index"]};ti.depends=function(){return["index"]};d.prototype={get:ir,getIndex:ti,getRsc:fr,hlp:rr,_is:"view"};for(rt in k)hr(rt,k[rt]);var at,e=r.templates,it=r.converters,hi=r.helpers,g=r.tags,a=r.sub,o=r.settings;t?(u=t,u.fn.render=cr,(at=u.observable)&&(f(a,at.sub),delete at.sub)):(u=n.jsviews={},u.isArray=Array&&Array.isArray||function(n){return Object.prototype.toString.call(n)==="[object Array]"});u.render=wt;u.views=r;u.templates=e=r.templates;o({debugMode:kt,delimiters:gt,onError:function(n,t,r){return t&&(n=r===i?"{Error: "+n+"}":tt(r)?r(n,t):r),n},_dbgMode:!0});g({"else":function(){},"if":{render:function(n){var t=this;return t.rendering.done||!n&&(arguments.length||!t.tagCtx.index)?"":(t.rendering.done=!0,t.selected=t.tagCtx.index,t.tagCtx.render(t.tagCtx.view,!0))},onUpdate:function(n,t,i){for(var r,f,u=0;(r=this.tagCtxs[u])&&r.args.length;u++)if(r=r.args[0],f=!r!=!i[u].args[0],!this.convert&&!!r||f)return f;return!1},flow:!0},"for":{render:function(n){var f,t=this,r=t.tagCtx,e="",o=0;return t.rendering.done||((f=!arguments.length)&&(n=r.view.data),n!==i&&(e+=r.render(n,f),o+=u.isArray(n)?n.length:1),(t.rendering.done=o)&&(t.selected=r.index)),e},flow:!0,autoBind:!0},include:{flow:!0,autoBind:!0},"*":{render:bt,flow:!0}});g({props:f(f({},g["for"]),dt(ar))});g.props.autoBind=!0;it({html:ci,attr:ci,url:function(n){return n!=i?encodeURI(""+n):n===null?n:""}});gt()}})(this,this.jQuery);
/*
//# sourceMappingURL=jsrender.min.js.map
*/ © 2015 - 2025 Weber Informatics LLC | Privacy Policy