(function(t,e,n,r){function i(r){if(!n[r]){if(!e[r]){if(t)return t(r);throw Error("Cannot find module '"+r+"'")}var o=n[r]={exports:{}};e[r][0](function(t){var n=e[r][1][t];return i(n?n:t)},o,o.exports)}return n[r].exports}for(var o=0;r.length>o;o++)i(r[o]);return i})("undefined"!=typeof require&&require,{1:[function(t,e){var n,r,i,o,s,u=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};s=t("../lib/lodash.js"),o=t("./helpers"),r=t("./context"),i={},i.render=function(t,e,n,u){var l,a;return null==e&&(e=[]),null==n&&(n={}),null==u&&(u={}),l=u.debug&&console?o.consoleLogger:o.nullLogger,l("Transparency.render:",t,e,n,u),t?(s.isArray(e)||(e=[e]),t=(a=o.data(t)).context||(a.context=new r(t,i)),t.render(e,n,u).el):void 0},i.matcher=function(t,e){return t.el.id===e||u.call(t.classNames,e)>=0||t.el.name===e||t.el.getAttribute("data-bind")===e},i.clone=function(t){return n(t).clone()[0]},i.jQueryPlugin=o.chainable(function(t,e,n){var r,o,s,u;for(u=[],o=0,s=this.length;s>o;o++)r=this[o],u.push(i.render(r,t,e,n));return u}),("undefined"!=typeof jQuery&&null!==jQuery||"undefined"!=typeof Zepto&&null!==Zepto)&&(n=jQuery||Zepto,null!=n&&(n.fn.render=i.jQueryPlugin)),(e!==void 0&&null!==e?e.exports:void 0)&&(e.exports=i),"undefined"!=typeof window&&null!==window&&(window.Transparency=i),("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define(function(){return i})},{"../lib/lodash.js":2,"./helpers":3,"./context":4}],2:[function(t,e,n){var r={};r.toString=Object.prototype.toString,r.toArray=function(t){for(var e=Array(t.length),n=0;t.length>n;n++)e[n]=t[n];return e},r.isString=function(t){return"[object String]"==r.toString.call(t)},r.isNumber=function(t){return"[object Number]"==r.toString.call(t)},r.isArray=Array.isArray||function(t){return"[object Array]"===r.toString.call(t)},r.isDate=function(t){return"[object Date]"===r.toString.call(t)},r.isElement=function(t){return!(!t||1!==t.nodeType)},r.isPlainValue=function(t){var e;return e=typeof t,"object"!==e&&"function"!==e||n.isDate(t)},r.isBoolean=function(t){return t===!0||t===!1},e.exports=r},{}],3:[function(t,e,n){var r,i,o,s;r=t("./elementFactory"),n.before=function(t){return function(e){return function(){return t.apply(this,arguments),e.apply(this,arguments)}}},n.after=function(t){return function(e){return function(){return e.apply(this,arguments),t.apply(this,arguments)}}},n.chainable=n.after(function(){return this}),n.onlyWith$=function(t){return"undefined"!=typeof jQuery&&null!==jQuery||"undefined"!=typeof Zepto&&null!==Zepto?function(){return t(arguments)}(jQuery||Zepto):void 0},n.getElements=function(t){var e;return e=[],s(t,e),e},s=function(t,e){var i,o;for(i=t.firstChild,o=[];i;)i.nodeType===n.ELEMENT_NODE&&(e.push(new r.createElement(i)),s(i,e)),o.push(i=i.nextSibling);return o},n.ELEMENT_NODE=1,n.TEXT_NODE=3,o=function(){return"<:nav></:nav>"!==document.createElement("nav").cloneNode(!0).outerHTML},n.cloneNode="undefined"==typeof document||null===document||o()?function(t){return t.cloneNode(!0)}:function(t){var e,r,o,s,u;if(e=Transparency.clone(t),e.nodeType===n.ELEMENT_NODE)for(e.removeAttribute(i),u=e.getElementsByTagName("*"),o=0,s=u.length;s>o;o++)r=u[o],r.removeAttribute(i);return e},i="transparency",n.data=function(t){return t[i]||(t[i]={})},n.nullLogger=function(){},n.consoleLogger=function(){return console.log(arguments)},n.log=n.nullLogger},{"./elementFactory":5}],4:[function(t,e){var n,r,i,o,s,u,l;l=t("./helpers"),o=l.before,i=l.after,s=l.chainable,u=l.cloneNode,r=t("./instance"),e.exports=n=function(){function t(t,e){this.el=t,this.Transparency=e,this.template=u(this.el),this.instances=[new r(this.el,this.Transparency)],this.instanceCache=[]}var e,n;return n=s(function(){return this.parent=this.el.parentNode,this.parent?(this.nextSibling=this.el.nextSibling,this.parent.removeChild(this.el)):void 0}),e=s(function(){return this.parent?this.nextSibling?this.parent.insertBefore(this.el,this.nextSibling):this.parent.appendChild(this.el):void 0}),t.prototype.render=o(n)(i(e)(s(function(t,e,n){for(var i,o,s,l,a,h,c;t.length<this.instances.length;)this.instanceCache.push(this.instances.pop().remove());for(;t.length>this.instances.length;)s=this.instanceCache.pop()||new r(u(this.template),this.Transparency),this.instances.push(s.appendTo(this.el));for(c=[],o=a=0,h=t.length;h>a;o=++a)l=t[o],s=this.instances[o],i=[],c.push(s.prepare(l,i).renderValues(l,i).renderDirectives(l,o,e).renderChildren(l,i,e,n));return c}))),t}()},{"./helpers":3,"./instance":6}],5:[function(t,e){var n,r,i,o,s,u,l,a,h,c,p,f,d,m,y,g,v={}.hasOwnProperty,b=function(t,e){function n(){this.constructor=t}for(var r in e)v.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};p=t("../lib/lodash.js"),c=t("./helpers"),n=t("./attributeFactory"),e.exports=o={Elements:{input:{}},createElement:function(t){var e,n;return e="input"===(n=t.nodeName.toLowerCase())?o.Elements[n][t.type.toLowerCase()]||s:o.Elements[n]||i,new e(t)}},i=function(){function t(t){this.el=t,this.attributes={},this.childNodes=p.toArray(this.el.childNodes),this.nodeName=this.el.nodeName.toLowerCase(),this.classNames=this.el.className.split(" "),this.originalAttributes={}}return t.prototype.empty=function(){for(var t;t=this.el.firstChild;)this.el.removeChild(t);return this},t.prototype.reset=function(){var t,e,n,r;n=this.attributes,r=[];for(e in n)t=n[e],r.push(t.set(t.templateValue));return r},t.prototype.render=function(t){return this.attr("text",t)},t.prototype.attr=function(t,e){var r,i;return r=(i=this.attributes)[t]||(i[t]=n.createAttribute(this.el,t,e)),null!=e&&r.set(e),r},t.prototype.renderDirectives=function(t,e,n){var r,i,o,s;s=[];for(i in n)v.call(n,i)&&(r=n[i],"function"==typeof r&&(o=r.call(t,{element:this.el,index:e,value:this.attr(i).templateValue}),null!=o?s.push(this.attr(i,o)):s.push(void 0)));return s},t}(),l=function(t){function e(t){e.__super__.constructor.call(this,t),this.elements=c.getElements(t)}return b(e,t),o.Elements.select=e,e.prototype.render=function(t){var e,n,r,i,o;for(t=""+t,i=this.elements,o=[],n=0,r=i.length;r>n;n++)e=i[n],"option"===e.nodeName&&o.push(e.attr("selected",e.el.value===t));return o},e}(i),h=function(t){function e(){return f=e.__super__.constructor.apply(this,arguments)}var n,r,i,s;for(b(e,t),n=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],i=0,s=n.length;s>i;i++)r=n[i],o.Elements[r]=e;return e.prototype.attr=function(t,n){return"text"!==t&&"html"!==t?e.__super__.attr.call(this,t,n):void 0},e}(i),s=function(t){function e(){return d=e.__super__.constructor.apply(this,arguments)}return b(e,t),e.prototype.render=function(t){return this.attr("value",t)},e}(h),a=function(t){function e(){return m=e.__super__.constructor.apply(this,arguments)}return b(e,t),o.Elements.textarea=e,e}(s),r=function(t){function e(){return y=e.__super__.constructor.apply(this,arguments)}return b(e,t),o.Elements.input.checkbox=e,e.prototype.render=function(t){return this.attr("checked",Boolean(t))},e}(s),u=function(t){function e(){return g=e.__super__.constructor.apply(this,arguments)}return b(e,t),o.Elements.input.radio=e,e}(r)},{"../lib/lodash.js":2,"./helpers":3,"./attributeFactory":7}],6:[function(t,e){var n,r,i,o,s={}.hasOwnProperty;o=t("../lib/lodash.js"),r=(i=t("./helpers")).chainable,e.exports=n=function(){function t(t,e){this.Transparency=e,this.queryCache={},this.childNodes=o.toArray(t.childNodes),this.elements=i.getElements(t)}return t.prototype.remove=r(function(){var t,e,n,r,i;for(r=this.childNodes,i=[],e=0,n=r.length;n>e;e++)t=r[e],i.push(t.parentNode.removeChild(t));return i}),t.prototype.appendTo=r(function(t){var e,n,r,i,o;for(i=this.childNodes,o=[],n=0,r=i.length;r>n;n++)e=i[n],o.push(t.appendChild(e));return o}),t.prototype.prepare=r(function(t){var e,n,r,o,s;for(o=this.elements,s=[],n=0,r=o.length;r>n;n++)e=o[n],e.reset(),s.push(i.data(e.el).model=t);return s}),t.prototype.renderValues=r(function(t,e){var n,r,i,u;if(o.isElement(t)&&(n=this.elements[0]))return n.empty().el.appendChild(t);if("object"==typeof t){u=[];for(r in t)s.call(t,r)&&(i=t[r],null!=i&&(o.isString(i)||o.isNumber(i)||o.isBoolean(i)||o.isDate(i)?u.push(function(){var t,e,o,s;for(o=this.matchingElements(r),s=[],t=0,e=o.length;e>t;t++)n=o[t],s.push(n.render(i));return s}.call(this)):"object"==typeof i?u.push(e.push(r)):u.push(void 0)));return u}}),t.prototype.renderDirectives=r(function(t,e,n){var r,i,o,u;u=[];for(o in n)s.call(n,o)&&(r=n[o],"object"==typeof r&&("object"!=typeof t&&(t={value:t}),u.push(function(){var n,s,u,l;for(u=this.matchingElements(o),l=[],n=0,s=u.length;s>n;n++)i=u[n],l.push(i.renderDirectives(t,e,r));return l}.call(this))));return u}),t.prototype.renderChildren=r(function(t,e,n,r){var i,o,s,u,l;for(l=[],s=0,u=e.length;u>s;s++)o=e[s],l.push(function(){var e,s,u,l;for(u=this.matchingElements(o),l=[],e=0,s=u.length;s>e;e++)i=u[e],l.push(this.Transparency.render(i.el,t[o],n[o],r));return l}.call(this));return l}),t.prototype.matchingElements=function(t){var e,n,r;return n=(r=this.queryCache)[t]||(r[t]=function(){var n,r,i,o;for(i=this.elements,o=[],n=0,r=i.length;r>n;n++)e=i[n],this.Transparency.matcher(e,t)&&o.push(e);return o}.call(this)),i.log("Matching elements for '"+t+"':",n),n},t}()},{"../lib/lodash.js":2,"./helpers":3}],7:[function(t,e){var n,r,i,o,s,u,l,a,h={}.hasOwnProperty,c=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};a=t("../lib/lodash"),l=t("./helpers"),e.exports=r={Attributes:{},createAttribute:function(t,e){var i;return i=r.Attributes[e]||n,new i(t,e)}},n=function(){function t(t,e){this.el=t,this.name=e,this.templateValue=this.el.getAttribute(this.name)||""}return t.prototype.set=function(t){return this.el[this.name]=t,this.el.setAttribute(this.name,""+t)},t}(),i=function(t){function e(t,e){this.el=t,this.name=e,this.templateValue=this.el.getAttribute(this.name)||!1}var n,i,o,s;for(c(e,t),n=["hidden","async","defer","autofocus","formnovalidate","disabled","autofocus","formnovalidate","multiple","readonly","required","checked","scoped","reversed","selected","loop","muted","autoplay","controls","seamless","default","ismap","novalidate","open","typemustmatch","truespeed"],o=0,s=n.length;s>o;o++)i=n[o],r.Attributes[i]=e;return e.prototype.set=function(t){return this.el[this.name]=t,t?this.el.setAttribute(this.name,this.name):this.el.removeAttribute(this.name)},e}(n),u=function(t){function e(t,e){var n;this.el=t,this.name=e,this.templateValue=function(){var t,e,r,i;for(r=this.el.childNodes,i=[],t=0,e=r.length;e>t;t++)n=r[t],n.nodeType===l.TEXT_NODE&&i.push(n.nodeValue);return i}.call(this).join(""),this.children=a.toArray(this.el.children),(this.textNode=this.el.firstChild)?this.textNode.nodeType!==l.TEXT_NODE&&(this.textNode=this.el.insertBefore(this.el.ownerDocument.createTextNode(""),this.textNode)):this.el.appendChild(this.textNode=this.el.ownerDocument.createTextNode(""))}return c(e,t),r.Attributes.text=e,e.prototype.set=function(t){for(var e,n,r,i,o;e=this.el.firstChild;)this.el.removeChild(e);for(this.textNode.nodeValue=t,this.el.appendChild(this.textNode),i=this.children,o=[],n=0,r=i.length;r>n;n++)e=i[n],o.push(this.el.appendChild(e));return o},e}(n),s=function(t){function e(t){this.el=t,this.templateValue="",this.children=a.toArray(this.el.children)}return c(e,t),r.Attributes.html=e,e.prototype.set=function(t){for(var e,n,r,i,o;e=this.el.firstChild;)this.el.removeChild(e);for(this.el.innerHTML=t+this.templateValue,i=this.children,o=[],n=0,r=i.length;r>n;n++)e=i[n],o.push(this.el.appendChild(e));return o},e}(n),o=function(t){function e(t){e.__super__.constructor.call(this,t,"class")}return c(e,t),r.Attributes["class"]=e,e}(n)},{"../lib/lodash":2,"./helpers":3}]},{},[1]);