// Compiled by ClojureScript 0.0-2138
goog.provide('crate.compiler');
goog.require('cljs.core');
goog.require('crate.binding');
goog.require('crate.binding');
goog.require('clojure.string');
goog.require('clojure.string');
goog.require('goog.style');
goog.require('goog.style');
goog.require('goog.dom');
goog.require('goog.dom');
crate.compiler.xmlns = new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"xhtml","xhtml",1127939989),"http://www.w3.org/1999/xhtml",new cljs.core.Keyword(null,"svg","svg",1014018518),"http://www.w3.org/2000/svg"], null);
crate.compiler.group_id = cljs.core.atom.call(null,0);
crate.compiler.bindings = cljs.core.atom.call(null,cljs.core.PersistentVector.EMPTY);
crate.compiler.capture_binding = (function capture_binding(tag,b){return cljs.core.swap_BANG_.call(null,crate.compiler.bindings,cljs.core.conj,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [tag,b], null));
});
crate.compiler.Element = (function (){var obj16049 = {};return obj16049;
})();
crate.compiler._elem = (function _elem(this$){if((function (){var and__3508__auto__ = this$;if(and__3508__auto__)
{return this$.crate$compiler$Element$_elem$arity$1;
} else
{return and__3508__auto__;
}
})())
{return this$.crate$compiler$Element$_elem$arity$1(this$);
} else
{var x__4141__auto__ = (((this$ == null))?null:this$);return (function (){var or__3520__auto__ = (crate.compiler._elem[goog.typeOf(x__4141__auto__)]);if(or__3520__auto__)
{return or__3520__auto__;
} else
{var or__3520__auto____$1 = (crate.compiler._elem["_"]);if(or__3520__auto____$1)
{return or__3520__auto____$1;
} else
{throw cljs.core.missing_protocol.call(null,"Element.-elem",this$);
}
}
})().call(null,this$);
}
});
crate.compiler.as_content = (function as_content(parent,content){var seq__16056 = cljs.core.seq.call(null,content);var chunk__16057 = null;var count__16058 = 0;var i__16059 = 0;while(true){
if((i__16059 < count__16058))
{var c = cljs.core._nth.call(null,chunk__16057,i__16059);var child_16062 = (((function (){var G__16060 = c;if(G__16060)
{var bit__4164__auto__ = null;if(cljs.core.truth_((function (){var or__3520__auto__ = bit__4164__auto__;if(cljs.core.truth_(or__3520__auto__))
{return or__3520__auto__;
} else
{return G__16060.crate$compiler$Element$;
}
})()))
{return true;
} else
{if((!G__16060.cljs$lang$protocol_mask$partition$))
{return cljs.core.native_satisfies_QMARK_.call(null,crate.compiler.Element,G__16060);
} else
{return false;
}
}
} else
{return cljs.core.native_satisfies_QMARK_.call(null,crate.compiler.Element,G__16060);
}
})())?crate.compiler._elem.call(null,c):(((c == null))?null:((cljs.core.map_QMARK_.call(null,c))?(function(){throw "Maps cannot be used as content"})():((typeof c === 'string')?goog.dom.createTextNode(c):((cljs.core.vector_QMARK_.call(null,c))?crate.compiler.elem_factory.call(null,c):((cljs.core.seq_QMARK_.call(null,c))?as_content.call(null,parent,c):((crate.binding.binding_coll_QMARK_.call(null,c))?(function (){crate.compiler.capture_binding.call(null,new cljs.core.Keyword(null,"coll","coll",1016963678),c);
return as_content.call(null,parent,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [crate.binding.value.call(null,c)], null));
})():((crate.binding.binding_QMARK_.call(null,c))?(function (){crate.compiler.capture_binding.call(null,new cljs.core.Keyword(null,"text","text",1017460895),c);
return as_content.call(null,parent,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [crate.binding.value.call(null,c)], null));
})():(cljs.core.truth_(c.nodeName)?c:(cljs.core.truth_(c.get)?c.get(0):((new cljs.core.Keyword(null,"else","else",1017020587))?goog.dom.createTextNode([cljs.core.str(c)].join('')):null)))))))))));if(cljs.core.truth_(child_16062))
{goog.dom.appendChild(parent,child_16062);
} else
{}
{
var G__16063 = seq__16056;
var G__16064 = chunk__16057;
var G__16065 = count__16058;
var G__16066 = (i__16059 + 1);
seq__16056 = G__16063;
chunk__16057 = G__16064;
count__16058 = G__16065;
i__16059 = G__16066;
continue;
}
} else
{var temp__4092__auto__ = cljs.core.seq.call(null,seq__16056);if(temp__4092__auto__)
{var seq__16056__$1 = temp__4092__auto__;if(cljs.core.chunked_seq_QMARK_.call(null,seq__16056__$1))
{var c__4262__auto__ = cljs.core.chunk_first.call(null,seq__16056__$1);{
var G__16067 = cljs.core.chunk_rest.call(null,seq__16056__$1);
var G__16068 = c__4262__auto__;
var G__16069 = cljs.core.count.call(null,c__4262__auto__);
var G__16070 = 0;
seq__16056 = G__16067;
chunk__16057 = G__16068;
count__16058 = G__16069;
i__16059 = G__16070;
continue;
}
} else
{var c = cljs.core.first.call(null,seq__16056__$1);var child_16071 = (((function (){var G__16061 = c;if(G__16061)
{var bit__4164__auto__ = null;if(cljs.core.truth_((function (){var or__3520__auto__ = bit__4164__auto__;if(cljs.core.truth_(or__3520__auto__))
{return or__3520__auto__;
} else
{return G__16061.crate$compiler$Element$;
}
})()))
{return true;
} else
{if((!G__16061.cljs$lang$protocol_mask$partition$))
{return cljs.core.native_satisfies_QMARK_.call(null,crate.compiler.Element,G__16061);
} else
{return false;
}
}
} else
{return cljs.core.native_satisfies_QMARK_.call(null,crate.compiler.Element,G__16061);
}
})())?crate.compiler._elem.call(null,c):(((c == null))?null:((cljs.core.map_QMARK_.call(null,c))?(function(){throw "Maps cannot be used as content"})():((typeof c === 'string')?goog.dom.createTextNode(c):((cljs.core.vector_QMARK_.call(null,c))?crate.compiler.elem_factory.call(null,c):((cljs.core.seq_QMARK_.call(null,c))?as_content.call(null,parent,c):((crate.binding.binding_coll_QMARK_.call(null,c))?(function (){crate.compiler.capture_binding.call(null,new cljs.core.Keyword(null,"coll","coll",1016963678),c);
return as_content.call(null,parent,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [crate.binding.value.call(null,c)], null));
})():((crate.binding.binding_QMARK_.call(null,c))?(function (){crate.compiler.capture_binding.call(null,new cljs.core.Keyword(null,"text","text",1017460895),c);
return as_content.call(null,parent,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [crate.binding.value.call(null,c)], null));
})():(cljs.core.truth_(c.nodeName)?c:(cljs.core.truth_(c.get)?c.get(0):((new cljs.core.Keyword(null,"else","else",1017020587))?goog.dom.createTextNode([cljs.core.str(c)].join('')):null)))))))))));if(cljs.core.truth_(child_16071))
{goog.dom.appendChild(parent,child_16071);
} else
{}
{
var G__16072 = cljs.core.next.call(null,seq__16056__$1);
var G__16073 = null;
var G__16074 = 0;
var G__16075 = 0;
seq__16056 = G__16072;
chunk__16057 = G__16073;
count__16058 = G__16074;
i__16059 = G__16075;
continue;
}
}
} else
{return null;
}
}
break;
}
});
crate.compiler.dom_binding = (function (){var method_table__4372__auto__ = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);var prefer_table__4373__auto__ = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);var method_cache__4374__auto__ = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);var cached_hierarchy__4375__auto__ = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);var hierarchy__4376__auto__ = cljs.core.get.call(null,cljs.core.PersistentArrayMap.EMPTY,new cljs.core.Keyword(null,"hierarchy","hierarchy",3129050535),cljs.core.get_global_hierarchy.call(null));return (new cljs.core.MultiFn("dom-binding",(function (type,_,___$1){return type;
}),new cljs.core.Keyword(null,"default","default",2558708147),hierarchy__4376__auto__,method_table__4372__auto__,prefer_table__4373__auto__,method_cache__4374__auto__,cached_hierarchy__4375__auto__));
})();
cljs.core._add_method.call(null,crate.compiler.dom_binding,new cljs.core.Keyword(null,"text","text",1017460895),(function (_,b,elem){return crate.binding.on_change.call(null,b,(function (v){goog.dom.removeChildren(elem);
return crate.compiler.as_content.call(null,elem,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [v], null));
}));
}));
cljs.core._add_method.call(null,crate.compiler.dom_binding,new cljs.core.Keyword(null,"attr","attr",1016909155),(function (_,p__16076,elem){var vec__16077 = p__16076;var k = cljs.core.nth.call(null,vec__16077,0,null);var b = cljs.core.nth.call(null,vec__16077,1,null);return crate.binding.on_change.call(null,b,(function (v){return crate.compiler.dom_attr.call(null,elem,k,v);
}));
}));
cljs.core._add_method.call(null,crate.compiler.dom_binding,new cljs.core.Keyword(null,"style","style",1123684643),(function (_,p__16078,elem){var vec__16079 = p__16078;var k = cljs.core.nth.call(null,vec__16079,0,null);var b = cljs.core.nth.call(null,vec__16079,1,null);return crate.binding.on_change.call(null,b,(function (v){if(cljs.core.truth_(k))
{return crate.compiler.dom_style.call(null,elem,k,v);
} else
{return crate.compiler.dom_style.call(null,elem,v);
}
}));
}));
crate.compiler.dom_add = (function dom_add(bc,parent,elem,v){var temp__4090__auto__ = crate.binding.opt.call(null,bc,new cljs.core.Keyword(null,"add","add",1014000659));if(cljs.core.truth_(temp__4090__auto__))
{var adder = temp__4090__auto__;return adder.call(null,parent,elem,v);
} else
{return goog.dom.appendChild(parent,elem);
}
});
crate.compiler.dom_remove = (function dom_remove(bc,elem){var temp__4090__auto__ = crate.binding.opt.call(null,bc,new cljs.core.Keyword(null,"remove","remove",4374260726));if(cljs.core.truth_(temp__4090__auto__))
{var remover = temp__4090__auto__;return remover.call(null,elem);
} else
{return goog.dom.removeNode(elem);
}
});
cljs.core._add_method.call(null,crate.compiler.dom_binding,new cljs.core.Keyword(null,"coll","coll",1016963678),(function (_,bc,parent){return crate.binding.on_change.call(null,bc,(function (type,elem,v){var pred__16080 = cljs.core._EQ_;var expr__16081 = type;if(cljs.core.truth_(pred__16080.call(null,new cljs.core.Keyword(null,"add","add",1014000659),expr__16081)))
{return crate.compiler.dom_add.call(null,bc,parent,elem,v);
} else
{if(cljs.core.truth_(pred__16080.call(null,new cljs.core.Keyword(null,"remove","remove",4374260726),expr__16081)))
{return crate.compiler.dom_remove.call(null,bc,elem);
} else
{throw (new Error([cljs.core.str("No matching clause: "),cljs.core.str(expr__16081)].join('')));
}
}
}));
}));
crate.compiler.handle_bindings = (function handle_bindings(bs,elem){var seq__16089 = cljs.core.seq.call(null,bs);var chunk__16090 = null;var count__16091 = 0;var i__16092 = 0;while(true){
if((i__16092 < count__16091))
{var vec__16093 = cljs.core._nth.call(null,chunk__16090,i__16092);var type = cljs.core.nth.call(null,vec__16093,0,null);var b = cljs.core.nth.call(null,vec__16093,1,null);crate.compiler.dom_binding.call(null,type,b,elem);
{
var G__16095 = seq__16089;
var G__16096 = chunk__16090;
var G__16097 = count__16091;
var G__16098 = (i__16092 + 1);
seq__16089 = G__16095;
chunk__16090 = G__16096;
count__16091 = G__16097;
i__16092 = G__16098;
continue;
}
} else
{var temp__4092__auto__ = cljs.core.seq.call(null,seq__16089);if(temp__4092__auto__)
{var seq__16089__$1 = temp__4092__auto__;if(cljs.core.chunked_seq_QMARK_.call(null,seq__16089__$1))
{var c__4262__auto__ = cljs.core.chunk_first.call(null,seq__16089__$1);{
var G__16099 = cljs.core.chunk_rest.call(null,seq__16089__$1);
var G__16100 = c__4262__auto__;
var G__16101 = cljs.core.count.call(null,c__4262__auto__);
var G__16102 = 0;
seq__16089 = G__16099;
chunk__16090 = G__16100;
count__16091 = G__16101;
i__16092 = G__16102;
continue;
}
} else
{var vec__16094 = cljs.core.first.call(null,seq__16089__$1);var type = cljs.core.nth.call(null,vec__16094,0,null);var b = cljs.core.nth.call(null,vec__16094,1,null);crate.compiler.dom_binding.call(null,type,b,elem);
{
var G__16103 = cljs.core.next.call(null,seq__16089__$1);
var G__16104 = null;
var G__16105 = 0;
var G__16106 = 0;
seq__16089 = G__16103;
chunk__16090 = G__16104;
count__16091 = G__16105;
i__16092 = G__16106;
continue;
}
}
} else
{return null;
}
}
break;
}
});
crate.compiler.dom_style = (function() {
var dom_style = null;
var dom_style__2 = (function (elem,v){if(typeof v === 'string')
{elem.setAttribute("style",v);
} else
{if(cljs.core.map_QMARK_.call(null,v))
{var seq__16113_16119 = cljs.core.seq.call(null,v);var chunk__16114_16120 = null;var count__16115_16121 = 0;var i__16116_16122 = 0;while(true){
if((i__16116_16122 < count__16115_16121))
{var vec__16117_16123 = cljs.core._nth.call(null,chunk__16114_16120,i__16116_16122);var k_16124 = cljs.core.nth.call(null,vec__16117_16123,0,null);var v_16125__$1 = cljs.core.nth.call(null,vec__16117_16123,1,null);dom_style.call(null,elem,k_16124,v_16125__$1);
{
var G__16126 = seq__16113_16119;
var G__16127 = chunk__16114_16120;
var G__16128 = count__16115_16121;
var G__16129 = (i__16116_16122 + 1);
seq__16113_16119 = G__16126;
chunk__16114_16120 = G__16127;
count__16115_16121 = G__16128;
i__16116_16122 = G__16129;
continue;
}
} else
{var temp__4092__auto___16130 = cljs.core.seq.call(null,seq__16113_16119);if(temp__4092__auto___16130)
{var seq__16113_16131__$1 = temp__4092__auto___16130;if(cljs.core.chunked_seq_QMARK_.call(null,seq__16113_16131__$1))
{var c__4262__auto___16132 = cljs.core.chunk_first.call(null,seq__16113_16131__$1);{
var G__16133 = cljs.core.chunk_rest.call(null,seq__16113_16131__$1);
var G__16134 = c__4262__auto___16132;
var G__16135 = cljs.core.count.call(null,c__4262__auto___16132);
var G__16136 = 0;
seq__16113_16119 = G__16133;
chunk__16114_16120 = G__16134;
count__16115_16121 = G__16135;
i__16116_16122 = G__16136;
continue;
}
} else
{var vec__16118_16137 = cljs.core.first.call(null,seq__16113_16131__$1);var k_16138 = cljs.core.nth.call(null,vec__16118_16137,0,null);var v_16139__$1 = cljs.core.nth.call(null,vec__16118_16137,1,null);dom_style.call(null,elem,k_16138,v_16139__$1);
{
var G__16140 = cljs.core.next.call(null,seq__16113_16131__$1);
var G__16141 = null;
var G__16142 = 0;
var G__16143 = 0;
seq__16113_16119 = G__16140;
chunk__16114_16120 = G__16141;
count__16115_16121 = G__16142;
i__16116_16122 = G__16143;
continue;
}
}
} else
{}
}
break;
}
} else
{if(crate.binding.binding_QMARK_.call(null,v))
{crate.compiler.capture_binding.call(null,new cljs.core.Keyword(null,"style","style",1123684643),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [null,v], null));
dom_style.call(null,elem,crate.binding.value.call(null,v));
} else
{}
}
}
return elem;
});
var dom_style__3 = (function (elem,k,v){var v__$1 = ((crate.binding.binding_QMARK_.call(null,v))?(function (){crate.compiler.capture_binding.call(null,new cljs.core.Keyword(null,"style","style",1123684643),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [k,v], null));
return crate.binding.value.call(null,v);
})():v);return goog.style.setStyle(elem,cljs.core.name.call(null,k),v__$1);
});
dom_style = function(elem,k,v){
switch(arguments.length){
case 2:
return dom_style__2.call(this,elem,k);
case 3:
return dom_style__3.call(this,elem,k,v);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
dom_style.cljs$core$IFn$_invoke$arity$2 = dom_style__2;
dom_style.cljs$core$IFn$_invoke$arity$3 = dom_style__3;
return dom_style;
})()
;
crate.compiler.dom_attr = (function() {
var dom_attr = null;
var dom_attr__2 = (function (elem,attrs){if(cljs.core.truth_(elem))
{if(!(cljs.core.map_QMARK_.call(null,attrs)))
{return elem.getAttribute(cljs.core.name.call(null,attrs));
} else
{var seq__16150_16156 = cljs.core.seq.call(null,attrs);var chunk__16151_16157 = null;var count__16152_16158 = 0;var i__16153_16159 = 0;while(true){
if((i__16153_16159 < count__16152_16158))
{var vec__16154_16160 = cljs.core._nth.call(null,chunk__16151_16157,i__16153_16159);var k_16161 = cljs.core.nth.call(null,vec__16154_16160,0,null);var v_16162 = cljs.core.nth.call(null,vec__16154_16160,1,null);dom_attr.call(null,elem,k_16161,v_16162);
{
var G__16163 = seq__16150_16156;
var G__16164 = chunk__16151_16157;
var G__16165 = count__16152_16158;
var G__16166 = (i__16153_16159 + 1);
seq__16150_16156 = G__16163;
chunk__16151_16157 = G__16164;
count__16152_16158 = G__16165;
i__16153_16159 = G__16166;
continue;
}
} else
{var temp__4092__auto___16167 = cljs.core.seq.call(null,seq__16150_16156);if(temp__4092__auto___16167)
{var seq__16150_16168__$1 = temp__4092__auto___16167;if(cljs.core.chunked_seq_QMARK_.call(null,seq__16150_16168__$1))
{var c__4262__auto___16169 = cljs.core.chunk_first.call(null,seq__16150_16168__$1);{
var G__16170 = cljs.core.chunk_rest.call(null,seq__16150_16168__$1);
var G__16171 = c__4262__auto___16169;
var G__16172 = cljs.core.count.call(null,c__4262__auto___16169);
var G__16173 = 0;
seq__16150_16156 = G__16170;
chunk__16151_16157 = G__16171;
count__16152_16158 = G__16172;
i__16153_16159 = G__16173;
continue;
}
} else
{var vec__16155_16174 = cljs.core.first.call(null,seq__16150_16168__$1);var k_16175 = cljs.core.nth.call(null,vec__16155_16174,0,null);var v_16176 = cljs.core.nth.call(null,vec__16155_16174,1,null);dom_attr.call(null,elem,k_16175,v_16176);
{
var G__16177 = cljs.core.next.call(null,seq__16150_16168__$1);
var G__16178 = null;
var G__16179 = 0;
var G__16180 = 0;
seq__16150_16156 = G__16177;
chunk__16151_16157 = G__16178;
count__16152_16158 = G__16179;
i__16153_16159 = G__16180;
continue;
}
}
} else
{}
}
break;
}
return elem;
}
} else
{return null;
}
});
var dom_attr__3 = (function (elem,k,v){if(cljs.core._EQ_.call(null,k,new cljs.core.Keyword(null,"style","style",1123684643)))
{crate.compiler.dom_style.call(null,elem,v);
} else
{var v_16181__$1 = ((crate.binding.binding_QMARK_.call(null,v))?(function (){crate.compiler.capture_binding.call(null,new cljs.core.Keyword(null,"attr","attr",1016909155),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [k,v], null));
return crate.binding.value.call(null,v);
})():v);elem.setAttribute(cljs.core.name.call(null,k),v_16181__$1);
}
return elem;
});
dom_attr = function(elem,k,v){
switch(arguments.length){
case 2:
return dom_attr__2.call(this,elem,k);
case 3:
return dom_attr__3.call(this,elem,k,v);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
dom_attr.cljs$core$IFn$_invoke$arity$2 = dom_attr__2;
dom_attr.cljs$core$IFn$_invoke$arity$3 = dom_attr__3;
return dom_attr;
})()
;
/**
* Regular expression that parses a CSS-style id and class from a tag name.
*/
crate.compiler.re_tag = /([^\s\.#]+)(?:#([^\s\.#]+))?(?:\.([^\s#]+))?/;
crate.compiler.normalize_map_attrs = (function normalize_map_attrs(map_attrs){return cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,cljs.core.map.call(null,(function (p__16184){var vec__16185 = p__16184;var n = cljs.core.nth.call(null,vec__16185,0,null);var v = cljs.core.nth.call(null,vec__16185,1,null);if(v === true)
{return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [n,cljs.core.name.call(null,n)], null);
} else
{return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [n,v], null);
}
}),cljs.core.filter.call(null,cljs.core.comp.call(null,cljs.core.boolean$,cljs.core.second),map_attrs)));
});
/**
* Ensure a tag vector is of the form [tag-name attrs content].
*/
crate.compiler.normalize_element = (function normalize_element(p__16187){var vec__16192 = p__16187;var tag = cljs.core.nth.call(null,vec__16192,0,null);var content = cljs.core.nthnext.call(null,vec__16192,1);if(!(((tag instanceof cljs.core.Keyword)) || ((tag instanceof cljs.core.Symbol)) || (typeof tag === 'string')))
{throw [cljs.core.str(tag),cljs.core.str(" is not a valid tag name.")].join('');
} else
{}
var vec__16193 = cljs.core.re_matches.call(null,crate.compiler.re_tag,cljs.core.name.call(null,tag));var _ = cljs.core.nth.call(null,vec__16193,0,null);var tag__$1 = cljs.core.nth.call(null,vec__16193,1,null);var id = cljs.core.nth.call(null,vec__16193,2,null);var class$ = cljs.core.nth.call(null,vec__16193,3,null);var vec__16194 = (function (){var vec__16195 = clojure.string.split.call(null,tag__$1,/:/);var nsp = cljs.core.nth.call(null,vec__16195,0,null);var t = cljs.core.nth.call(null,vec__16195,1,null);var ns_xmlns = crate.compiler.xmlns.call(null,cljs.core.keyword.call(null,nsp));if(cljs.core.truth_(t))
{return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(function (){var or__3520__auto__ = ns_xmlns;if(cljs.core.truth_(or__3520__auto__))
{return or__3520__auto__;
} else
{return nsp;
}
})(),t], null);
} else
{return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"xhtml","xhtml",1127939989).cljs$core$IFn$_invoke$arity$1(crate.compiler.xmlns),nsp], null);
}
})();var nsp = cljs.core.nth.call(null,vec__16194,0,null);var tag__$2 = cljs.core.nth.call(null,vec__16194,1,null);var tag_attrs = cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,cljs.core.filter.call(null,((function (vec__16193,_,tag__$1,id,class$,vec__16194,nsp,tag__$2){
return (function (p1__16186_SHARP_){return !((cljs.core.second.call(null,p1__16186_SHARP_) == null));
});})(vec__16193,_,tag__$1,id,class$,vec__16194,nsp,tag__$2))
,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"id","id",1013907597),(function (){var or__3520__auto__ = id;if(cljs.core.truth_(or__3520__auto__))
{return or__3520__auto__;
} else
{return null;
}
})(),new cljs.core.Keyword(null,"class","class",1108647146),(cljs.core.truth_(class$)?clojure.string.replace.call(null,class$,/\./," "):null)], null)));var map_attrs = cljs.core.first.call(null,content);if(cljs.core.map_QMARK_.call(null,map_attrs))
{return new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [nsp,tag__$2,cljs.core.merge.call(null,tag_attrs,crate.compiler.normalize_map_attrs.call(null,map_attrs)),cljs.core.next.call(null,content)], null);
} else
{return new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [nsp,tag__$2,tag_attrs,content], null);
}
});
crate.compiler.parse_content = (function parse_content(elem,content){var attrs = cljs.core.first.call(null,content);if(cljs.core.map_QMARK_.call(null,attrs))
{crate.compiler.dom_attr.call(null,elem,attrs);
return cljs.core.rest.call(null,content);
} else
{return content;
}
});
crate.compiler.create_elem = (cljs.core.truth_(document.createElementNS)?(function (nsp,tag){return document.createElementNS(nsp,tag);
}):(function (_,tag){return document.createElement(tag);
}));
crate.compiler.elem_factory = (function elem_factory(tag_def){var bindings16198 = crate.compiler.bindings;try{crate.compiler.bindings = cljs.core.atom.call(null,cljs.core.PersistentVector.EMPTY);
var vec__16199 = crate.compiler.normalize_element.call(null,tag_def);var nsp = cljs.core.nth.call(null,vec__16199,0,null);var tag = cljs.core.nth.call(null,vec__16199,1,null);var attrs = cljs.core.nth.call(null,vec__16199,2,null);var content = cljs.core.nth.call(null,vec__16199,3,null);var elem = crate.compiler.create_elem.call(null,nsp,tag);crate.compiler.dom_attr.call(null,elem,attrs);
crate.compiler.as_content.call(null,elem,content);
crate.compiler.handle_bindings.call(null,cljs.core.deref.call(null,crate.compiler.bindings),elem);
return elem;
}finally {crate.compiler.bindings = bindings16198;
}});
/**
* Add an optional attribute argument to a function that returns a vector tag.
*/
crate.compiler.add_optional_attrs = (function add_optional_attrs(func){return (function() { 
var G__16202__delegate = function (args){if(cljs.core.map_QMARK_.call(null,cljs.core.first.call(null,args)))
{var vec__16201 = cljs.core.apply.call(null,func,cljs.core.rest.call(null,args));var tag = cljs.core.nth.call(null,vec__16201,0,null);var body = cljs.core.nthnext.call(null,vec__16201,1);if(cljs.core.map_QMARK_.call(null,cljs.core.first.call(null,body)))
{return cljs.core.apply.call(null,cljs.core.vector,tag,cljs.core.merge.call(null,cljs.core.first.call(null,body),cljs.core.first.call(null,args)),cljs.core.rest.call(null,body));
} else
{return cljs.core.apply.call(null,cljs.core.vector,tag,cljs.core.first.call(null,args),body);
}
} else
{return cljs.core.apply.call(null,func,args);
}
};
var G__16202 = function (var_args){
var args = null;if (arguments.length > 0) {
  args = cljs.core.array_seq(Array.prototype.slice.call(arguments, 0),0);} 
return G__16202__delegate.call(this,args);};
G__16202.cljs$lang$maxFixedArity = 0;
G__16202.cljs$lang$applyTo = (function (arglist__16203){
var args = cljs.core.seq(arglist__16203);
return G__16202__delegate(args);
});
G__16202.cljs$core$IFn$_invoke$arity$variadic = G__16202__delegate;
return G__16202;
})()
;
});
