(function(){function q(a){a=a.innerHTML;var b=a.indexOf("\x3c!--");0<=b&&(a=a.substring(b+4,a.lastIndexOf("--\x3e")));return(a=a.trim())?"<div>"+a.trim()+"</div>":null}function l(a,b,c,e){var d;if(a&&(d=a.firstChild)){do{var f=d.nextSibling;a.removeChild(d);b.push(d);d=f}while(d);a=b.length;if(!e||!1!==e.replaceHTML){e=[c];if(1<a)for(d=c.parentNode,f=c.nextSibling,c=a;0<--c;){var h=document.createElement("DIV");e.push(h);d.insertBefore(h,f)}for(c=0;c<a;++c)b[c].replaceHTML(e[c])}return 1>=b.length?
b[0]:b}}function r(a){var b={},c=[];m(a,b);for(var e in b)c.push(e);return c.join(",")}function m(a,b){var c=a.tagName;if("zk"!=c&&"attribute"!=c){if(!zk.Widget.getClass(c)){var e=zk.wgt.WidgetInfo.getClassName(c);if(!e)throw"Unknown tag: "+c;c=e.lastIndexOf(".");0<=c&&(b[e.substring(0,c)]=!0)}for(a=a.firstChild;a;a=a.nextSibling)1==a.nodeType&&m(a,b)}}function n(a,b,c,e){if(!b)return null;var d=k(a,b.getAttribute("forEach"),c);if(null!=d){for(var f=window.each,h=d.length,g=0;g<h;g++)window.each=
d[g],p(a,b,c,e);window.each=f}else p(a,b,c,e)}function p(a,b,c,e){var d=k(a,b.getAttribute("if"),c),f=k(a,b.getAttribute("unless"),c);if(!(null!=d&&!d||null!=f&&f)){d=b.tagName;if("zk"==d)d=a;else{if("attribute"==d){c=k(a,b.getAttribute("name"),c);if(!c)throw"The name attribute required, "+b;a.set(c,zk.xml.Utl.getElementValue(b));return}f=b.attributes;d=zk.Widget.newInstance(d);e&&e.push(d);a&&a.appendChild(d);a=f.length;for(e=0;e<a;++e){var h=f[e];d.set(h.name,k(d,h.value,c))}}for(b=b.firstChild;b;b=
b.nextSibling)if(a=b.nodeType,1==a){if(a=[],n(d,b,c,a),g&&(a=a[0])){a.prolog=g;var g=null}}else 3==a&&(a=k(d,b.nodeValue,c),a.trim().length?(f=new zk.Native,f.prolog=a,d.appendChild(f)):d.blankPreserved&&(g=a))}}function k(a,b,c){if(b)for(var e=0,d,f,h=b.length-1,g;;){d=b.indexOf("#{",e);if(0>d&&(d=b.indexOf("${",e),0>d)){g&&(b=g+b.substring(e));break}f=b.substring(e,d);e=b.indexOf("}",d+2);if(0>e){b=g?g+f:f;break}g=g?g+f:f;f=b.substring(d+2,e);try{var k=new Function("var _=arguments[0];return "+
f);f=a?k.call(a,c):k(c)}catch(t){throw"Failed to evaluate "+f;}if(!g&&e==h)return f;f&&(g+=f);e+=1}return b}zk.zuml.Parser={create:function(a,b,c,e){"function"!=typeof c||e||(e=c,c=null);b=("string"==typeof b?zk.xml.Utl.parseXML(b):b).documentElement;var d=[];zk.load(r(b),function(){n(a,b,c,d);e&&e(1>=d.length?d[0]:d)});return 1>=d.length?d[0]:d},createAt:function(a,b,c,e){"function"!=typeof c||e||(e=c,c=null);a=jq(a)[0];var d=q(a);if(d){var f=[];c=zk.zuml.Parser.create(null,d,c,function(c){c=l(c,
f,a,b);e&&e(c)});return l(c,f,a,b)}}}})();
