// Compiled by ClojureScript 1.9.562 {}
goog.provide('weathergen.ui.tabs');
goog.require('cljs.core');
goog.require('weathergen.ui.common');
goog.require('javelin.core');
goog.require('hoplon.jquery');
goog.require('hoplon.core');
/**
 * Renders a tab control. `selected` is a cell containing the ID of
 *   the currently selected tab. `tabs` is a vector maps describing the
 *   tabs.
 * 
 *   Keys include:
 * 
 *   `:id` - Unique ID for the tab.
 *   `:title` - Title for the tab.
 *   `:ui` - Content for the tab.
 *   
 * @param {...*} var_args
 */
weathergen.ui.tabs.tabs = (function() { 
var weathergen$ui$tabs$tabs__delegate = function (args__29774__auto__){
var vec__38494 = hoplon.core.parse_args.call(null,args__29774__auto__);
var attrs = cljs.core.nth.call(null,vec__38494,(0),null);
var _ = cljs.core.nth.call(null,vec__38494,(1),null);
var map__38497 = attrs;
var map__38497__$1 = ((((!((map__38497 == null)))?((((map__38497.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__38497.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__38497):map__38497);
var selected = cljs.core.get.call(null,map__38497__$1,new cljs.core.Keyword(null,"selected","selected",574897764));
var tabs = cljs.core.get.call(null,map__38497__$1,new cljs.core.Keyword(null,"tabs","tabs",-779855354));
return hoplon.core.div.call(null,hoplon.core.div.call(null,new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"margin-bottom","margin-bottom",388334941),"7px",new cljs.core.Keyword(null,"border-bottom","border-bottom",2110948415),"1px solid lightgray"], null),(function (){var iter__24200__auto__ = ((function (map__38497,map__38497__$1,selected,tabs,vec__38494,attrs,_){
return (function weathergen$ui$tabs$tabs_$_iter__38499(s__38500){
return (new cljs.core.LazySeq(null,((function (map__38497,map__38497__$1,selected,tabs,vec__38494,attrs,_){
return (function (){
var s__38500__$1 = s__38500;
while(true){
var temp__5278__auto__ = cljs.core.seq.call(null,s__38500__$1);
if(temp__5278__auto__){
var s__38500__$2 = temp__5278__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__38500__$2)){
var c__24198__auto__ = cljs.core.chunk_first.call(null,s__38500__$2);
var size__24199__auto__ = cljs.core.count.call(null,c__24198__auto__);
var b__38502 = cljs.core.chunk_buffer.call(null,size__24199__auto__);
if((function (){var i__38501 = (0);
while(true){
if((i__38501 < size__24199__auto__)){
var map__38507 = cljs.core._nth.call(null,c__24198__auto__,i__38501);
var map__38507__$1 = ((((!((map__38507 == null)))?((((map__38507.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__38507.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__38507):map__38507);
var title = cljs.core.get.call(null,map__38507__$1,new cljs.core.Keyword(null,"title","title",636505583));
var id = cljs.core.get.call(null,map__38507__$1,new cljs.core.Keyword(null,"id","id",-1388402092));
cljs.core.chunk_append.call(null,b__38502,weathergen.ui.common.inl.call(null,new cljs.core.Keyword(null,"click","click",1912301393),((function (i__38501,map__38507,map__38507__$1,title,id,c__24198__auto__,size__24199__auto__,b__38502,s__38500__$2,temp__5278__auto__,map__38497,map__38497__$1,selected,tabs,vec__38494,attrs,_){
return (function (){
return cljs.core.reset_BANG_.call(null,selected,id);
});})(i__38501,map__38507,map__38507__$1,title,id,c__24198__auto__,size__24199__auto__,b__38502,s__38500__$2,temp__5278__auto__,map__38497,map__38497__$1,selected,tabs,vec__38494,attrs,_))
,new cljs.core.Keyword(null,"css","css",1135045163),javelin.core.formula.call(null,((function (i__38501,map__38507,map__38507__$1,title,id,c__24198__auto__,size__24199__auto__,b__38502,s__38500__$2,temp__5278__auto__,map__38497,map__38497__$1,selected,tabs,vec__38494,attrs,_){
return (function (selected__$1){
return new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"background","background",-863952629),((cljs.core._EQ_.call(null,selected__$1,id))?"black":null),new cljs.core.Keyword(null,"color","color",1011675173),((cljs.core._EQ_.call(null,selected__$1,id))?"white":"#737373"),new cljs.core.Keyword(null,"font-size","font-size",-1847940346),"120%",new cljs.core.Keyword(null,"padding","padding",1660304693),((cljs.core._EQ_.call(null,selected__$1,id))?"0 10px":(0)),new cljs.core.Keyword(null,"margin","margin",-995903681),((cljs.core._EQ_.call(null,selected__$1,id))?(0):"0 10px"),new cljs.core.Keyword(null,"cursor","cursor",1011937484),"pointer"], null);
});})(i__38501,map__38507,map__38507__$1,title,id,c__24198__auto__,size__24199__auto__,b__38502,s__38500__$2,temp__5278__auto__,map__38497,map__38497__$1,selected,tabs,vec__38494,attrs,_))
).call(null,selected),title));

var G__38535 = (i__38501 + (1));
i__38501 = G__38535;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__38502),weathergen$ui$tabs$tabs_$_iter__38499.call(null,cljs.core.chunk_rest.call(null,s__38500__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__38502),null);
}
} else {
var map__38509 = cljs.core.first.call(null,s__38500__$2);
var map__38509__$1 = ((((!((map__38509 == null)))?((((map__38509.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__38509.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__38509):map__38509);
var title = cljs.core.get.call(null,map__38509__$1,new cljs.core.Keyword(null,"title","title",636505583));
var id = cljs.core.get.call(null,map__38509__$1,new cljs.core.Keyword(null,"id","id",-1388402092));
return cljs.core.cons.call(null,weathergen.ui.common.inl.call(null,new cljs.core.Keyword(null,"click","click",1912301393),((function (map__38509,map__38509__$1,title,id,s__38500__$2,temp__5278__auto__,map__38497,map__38497__$1,selected,tabs,vec__38494,attrs,_){
return (function (){
return cljs.core.reset_BANG_.call(null,selected,id);
});})(map__38509,map__38509__$1,title,id,s__38500__$2,temp__5278__auto__,map__38497,map__38497__$1,selected,tabs,vec__38494,attrs,_))
,new cljs.core.Keyword(null,"css","css",1135045163),javelin.core.formula.call(null,((function (map__38509,map__38509__$1,title,id,s__38500__$2,temp__5278__auto__,map__38497,map__38497__$1,selected,tabs,vec__38494,attrs,_){
return (function (selected__$1){
return new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"background","background",-863952629),((cljs.core._EQ_.call(null,selected__$1,id))?"black":null),new cljs.core.Keyword(null,"color","color",1011675173),((cljs.core._EQ_.call(null,selected__$1,id))?"white":"#737373"),new cljs.core.Keyword(null,"font-size","font-size",-1847940346),"120%",new cljs.core.Keyword(null,"padding","padding",1660304693),((cljs.core._EQ_.call(null,selected__$1,id))?"0 10px":(0)),new cljs.core.Keyword(null,"margin","margin",-995903681),((cljs.core._EQ_.call(null,selected__$1,id))?(0):"0 10px"),new cljs.core.Keyword(null,"cursor","cursor",1011937484),"pointer"], null);
});})(map__38509,map__38509__$1,title,id,s__38500__$2,temp__5278__auto__,map__38497,map__38497__$1,selected,tabs,vec__38494,attrs,_))
).call(null,selected),title),weathergen$ui$tabs$tabs_$_iter__38499.call(null,cljs.core.rest.call(null,s__38500__$2)));
}
} else {
return null;
}
break;
}
});})(map__38497,map__38497__$1,selected,tabs,vec__38494,attrs,_))
,null,null));
});})(map__38497,map__38497__$1,selected,tabs,vec__38494,attrs,_))
;
return iter__24200__auto__.call(null,tabs);
})()),(function (){var iter__24200__auto__ = ((function (map__38497,map__38497__$1,selected,tabs,vec__38494,attrs,_){
return (function weathergen$ui$tabs$tabs_$_iter__38511(s__38512){
return (new cljs.core.LazySeq(null,((function (map__38497,map__38497__$1,selected,tabs,vec__38494,attrs,_){
return (function (){
var s__38512__$1 = s__38512;
while(true){
var temp__5278__auto__ = cljs.core.seq.call(null,s__38512__$1);
if(temp__5278__auto__){
var s__38512__$2 = temp__5278__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__38512__$2)){
var c__24198__auto__ = cljs.core.chunk_first.call(null,s__38512__$2);
var size__24199__auto__ = cljs.core.count.call(null,c__24198__auto__);
var b__38514 = cljs.core.chunk_buffer.call(null,size__24199__auto__);
if((function (){var i__38513 = (0);
while(true){
if((i__38513 < size__24199__auto__)){
var map__38525 = cljs.core._nth.call(null,c__24198__auto__,i__38513);
var map__38525__$1 = ((((!((map__38525 == null)))?((((map__38525.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__38525.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__38525):map__38525);
var id = cljs.core.get.call(null,map__38525__$1,new cljs.core.Keyword(null,"id","id",-1388402092));
var ui = cljs.core.get.call(null,map__38525__$1,new cljs.core.Keyword(null,"ui","ui",-469653645));
cljs.core.chunk_append.call(null,b__38514,hoplon.core.div.call(null,new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"padding","padding",1660304693),"0 3px"], null),new cljs.core.Keyword(null,"toggle","toggle",1291842030),javelin.core.formula.call(null,((function (i__38513,map__38525,map__38525__$1,id,ui,c__24198__auto__,size__24199__auto__,b__38514,s__38512__$2,temp__5278__auto__,map__38497,map__38497__$1,selected,tabs,vec__38494,attrs,_){
return (function (G__38527,G__38529,G__38528){
return G__38527.call(null,G__38528,G__38529);
});})(i__38513,map__38525,map__38525__$1,id,ui,c__24198__auto__,size__24199__auto__,b__38514,s__38512__$2,temp__5278__auto__,map__38497,map__38497__$1,selected,tabs,vec__38494,attrs,_))
).call(null,cljs.core._EQ_,selected,id),ui));

var G__38536 = (i__38513 + (1));
i__38513 = G__38536;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__38514),weathergen$ui$tabs$tabs_$_iter__38511.call(null,cljs.core.chunk_rest.call(null,s__38512__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__38514),null);
}
} else {
var map__38530 = cljs.core.first.call(null,s__38512__$2);
var map__38530__$1 = ((((!((map__38530 == null)))?((((map__38530.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__38530.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__38530):map__38530);
var id = cljs.core.get.call(null,map__38530__$1,new cljs.core.Keyword(null,"id","id",-1388402092));
var ui = cljs.core.get.call(null,map__38530__$1,new cljs.core.Keyword(null,"ui","ui",-469653645));
return cljs.core.cons.call(null,hoplon.core.div.call(null,new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"padding","padding",1660304693),"0 3px"], null),new cljs.core.Keyword(null,"toggle","toggle",1291842030),javelin.core.formula.call(null,((function (map__38530,map__38530__$1,id,ui,s__38512__$2,temp__5278__auto__,map__38497,map__38497__$1,selected,tabs,vec__38494,attrs,_){
return (function (G__38532,G__38534,G__38533){
return G__38532.call(null,G__38533,G__38534);
});})(map__38530,map__38530__$1,id,ui,s__38512__$2,temp__5278__auto__,map__38497,map__38497__$1,selected,tabs,vec__38494,attrs,_))
).call(null,cljs.core._EQ_,selected,id),ui),weathergen$ui$tabs$tabs_$_iter__38511.call(null,cljs.core.rest.call(null,s__38512__$2)));
}
} else {
return null;
}
break;
}
});})(map__38497,map__38497__$1,selected,tabs,vec__38494,attrs,_))
,null,null));
});})(map__38497,map__38497__$1,selected,tabs,vec__38494,attrs,_))
;
return iter__24200__auto__.call(null,tabs);
})());
};
var weathergen$ui$tabs$tabs = function (var_args){
var args__29774__auto__ = null;
if (arguments.length > 0) {
var G__38537__i = 0, G__38537__a = new Array(arguments.length -  0);
while (G__38537__i < G__38537__a.length) {G__38537__a[G__38537__i] = arguments[G__38537__i + 0]; ++G__38537__i;}
  args__29774__auto__ = new cljs.core.IndexedSeq(G__38537__a,0,null);
} 
return weathergen$ui$tabs$tabs__delegate.call(this,args__29774__auto__);};
weathergen$ui$tabs$tabs.cljs$lang$maxFixedArity = 0;
weathergen$ui$tabs$tabs.cljs$lang$applyTo = (function (arglist__38538){
var args__29774__auto__ = cljs.core.seq(arglist__38538);
return weathergen$ui$tabs$tabs__delegate(args__29774__auto__);
});
weathergen$ui$tabs$tabs.cljs$core$IFn$_invoke$arity$variadic = weathergen$ui$tabs$tabs__delegate;
return weathergen$ui$tabs$tabs;
})()
;
