// 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__29571__auto__){
var vec__36687 = hoplon.core.parse_args.call(null,args__29571__auto__);
var attrs = cljs.core.nth.call(null,vec__36687,(0),null);
var _ = cljs.core.nth.call(null,vec__36687,(1),null);
var map__36690 = attrs;
var map__36690__$1 = ((((!((map__36690 == null)))?((((map__36690.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36690.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36690):map__36690);
var selected = cljs.core.get.call(null,map__36690__$1,new cljs.core.Keyword(null,"selected","selected",574897764));
var tabs = cljs.core.get.call(null,map__36690__$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__24010__auto__ = ((function (map__36690,map__36690__$1,selected,tabs,vec__36687,attrs,_){
return (function weathergen$ui$tabs$tabs_$_iter__36692(s__36693){
return (new cljs.core.LazySeq(null,((function (map__36690,map__36690__$1,selected,tabs,vec__36687,attrs,_){
return (function (){
var s__36693__$1 = s__36693;
while(true){
var temp__5278__auto__ = cljs.core.seq.call(null,s__36693__$1);
if(temp__5278__auto__){
var s__36693__$2 = temp__5278__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__36693__$2)){
var c__24008__auto__ = cljs.core.chunk_first.call(null,s__36693__$2);
var size__24009__auto__ = cljs.core.count.call(null,c__24008__auto__);
var b__36695 = cljs.core.chunk_buffer.call(null,size__24009__auto__);
if((function (){var i__36694 = (0);
while(true){
if((i__36694 < size__24009__auto__)){
var map__36700 = cljs.core._nth.call(null,c__24008__auto__,i__36694);
var map__36700__$1 = ((((!((map__36700 == null)))?((((map__36700.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36700.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36700):map__36700);
var title = cljs.core.get.call(null,map__36700__$1,new cljs.core.Keyword(null,"title","title",636505583));
var id = cljs.core.get.call(null,map__36700__$1,new cljs.core.Keyword(null,"id","id",-1388402092));
cljs.core.chunk_append.call(null,b__36695,weathergen.ui.common.inl.call(null,new cljs.core.Keyword(null,"click","click",1912301393),((function (i__36694,map__36700,map__36700__$1,title,id,c__24008__auto__,size__24009__auto__,b__36695,s__36693__$2,temp__5278__auto__,map__36690,map__36690__$1,selected,tabs,vec__36687,attrs,_){
return (function (){
return cljs.core.reset_BANG_.call(null,selected,id);
});})(i__36694,map__36700,map__36700__$1,title,id,c__24008__auto__,size__24009__auto__,b__36695,s__36693__$2,temp__5278__auto__,map__36690,map__36690__$1,selected,tabs,vec__36687,attrs,_))
,new cljs.core.Keyword(null,"css","css",1135045163),javelin.core.formula.call(null,((function (i__36694,map__36700,map__36700__$1,title,id,c__24008__auto__,size__24009__auto__,b__36695,s__36693__$2,temp__5278__auto__,map__36690,map__36690__$1,selected,tabs,vec__36687,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__36694,map__36700,map__36700__$1,title,id,c__24008__auto__,size__24009__auto__,b__36695,s__36693__$2,temp__5278__auto__,map__36690,map__36690__$1,selected,tabs,vec__36687,attrs,_))
).call(null,selected),title));

var G__36728 = (i__36694 + (1));
i__36694 = G__36728;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__36695),weathergen$ui$tabs$tabs_$_iter__36692.call(null,cljs.core.chunk_rest.call(null,s__36693__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__36695),null);
}
} else {
var map__36702 = cljs.core.first.call(null,s__36693__$2);
var map__36702__$1 = ((((!((map__36702 == null)))?((((map__36702.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36702.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36702):map__36702);
var title = cljs.core.get.call(null,map__36702__$1,new cljs.core.Keyword(null,"title","title",636505583));
var id = cljs.core.get.call(null,map__36702__$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__36702,map__36702__$1,title,id,s__36693__$2,temp__5278__auto__,map__36690,map__36690__$1,selected,tabs,vec__36687,attrs,_){
return (function (){
return cljs.core.reset_BANG_.call(null,selected,id);
});})(map__36702,map__36702__$1,title,id,s__36693__$2,temp__5278__auto__,map__36690,map__36690__$1,selected,tabs,vec__36687,attrs,_))
,new cljs.core.Keyword(null,"css","css",1135045163),javelin.core.formula.call(null,((function (map__36702,map__36702__$1,title,id,s__36693__$2,temp__5278__auto__,map__36690,map__36690__$1,selected,tabs,vec__36687,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__36702,map__36702__$1,title,id,s__36693__$2,temp__5278__auto__,map__36690,map__36690__$1,selected,tabs,vec__36687,attrs,_))
).call(null,selected),title),weathergen$ui$tabs$tabs_$_iter__36692.call(null,cljs.core.rest.call(null,s__36693__$2)));
}
} else {
return null;
}
break;
}
});})(map__36690,map__36690__$1,selected,tabs,vec__36687,attrs,_))
,null,null));
});})(map__36690,map__36690__$1,selected,tabs,vec__36687,attrs,_))
;
return iter__24010__auto__.call(null,tabs);
})()),(function (){var iter__24010__auto__ = ((function (map__36690,map__36690__$1,selected,tabs,vec__36687,attrs,_){
return (function weathergen$ui$tabs$tabs_$_iter__36704(s__36705){
return (new cljs.core.LazySeq(null,((function (map__36690,map__36690__$1,selected,tabs,vec__36687,attrs,_){
return (function (){
var s__36705__$1 = s__36705;
while(true){
var temp__5278__auto__ = cljs.core.seq.call(null,s__36705__$1);
if(temp__5278__auto__){
var s__36705__$2 = temp__5278__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__36705__$2)){
var c__24008__auto__ = cljs.core.chunk_first.call(null,s__36705__$2);
var size__24009__auto__ = cljs.core.count.call(null,c__24008__auto__);
var b__36707 = cljs.core.chunk_buffer.call(null,size__24009__auto__);
if((function (){var i__36706 = (0);
while(true){
if((i__36706 < size__24009__auto__)){
var map__36718 = cljs.core._nth.call(null,c__24008__auto__,i__36706);
var map__36718__$1 = ((((!((map__36718 == null)))?((((map__36718.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36718.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36718):map__36718);
var id = cljs.core.get.call(null,map__36718__$1,new cljs.core.Keyword(null,"id","id",-1388402092));
var ui = cljs.core.get.call(null,map__36718__$1,new cljs.core.Keyword(null,"ui","ui",-469653645));
cljs.core.chunk_append.call(null,b__36707,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__36706,map__36718,map__36718__$1,id,ui,c__24008__auto__,size__24009__auto__,b__36707,s__36705__$2,temp__5278__auto__,map__36690,map__36690__$1,selected,tabs,vec__36687,attrs,_){
return (function (G__36720,G__36722,G__36721){
return G__36720.call(null,G__36721,G__36722);
});})(i__36706,map__36718,map__36718__$1,id,ui,c__24008__auto__,size__24009__auto__,b__36707,s__36705__$2,temp__5278__auto__,map__36690,map__36690__$1,selected,tabs,vec__36687,attrs,_))
).call(null,cljs.core._EQ_,selected,id),ui));

var G__36729 = (i__36706 + (1));
i__36706 = G__36729;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__36707),weathergen$ui$tabs$tabs_$_iter__36704.call(null,cljs.core.chunk_rest.call(null,s__36705__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__36707),null);
}
} else {
var map__36723 = cljs.core.first.call(null,s__36705__$2);
var map__36723__$1 = ((((!((map__36723 == null)))?((((map__36723.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36723.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36723):map__36723);
var id = cljs.core.get.call(null,map__36723__$1,new cljs.core.Keyword(null,"id","id",-1388402092));
var ui = cljs.core.get.call(null,map__36723__$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__36723,map__36723__$1,id,ui,s__36705__$2,temp__5278__auto__,map__36690,map__36690__$1,selected,tabs,vec__36687,attrs,_){
return (function (G__36725,G__36727,G__36726){
return G__36725.call(null,G__36726,G__36727);
});})(map__36723,map__36723__$1,id,ui,s__36705__$2,temp__5278__auto__,map__36690,map__36690__$1,selected,tabs,vec__36687,attrs,_))
).call(null,cljs.core._EQ_,selected,id),ui),weathergen$ui$tabs$tabs_$_iter__36704.call(null,cljs.core.rest.call(null,s__36705__$2)));
}
} else {
return null;
}
break;
}
});})(map__36690,map__36690__$1,selected,tabs,vec__36687,attrs,_))
,null,null));
});})(map__36690,map__36690__$1,selected,tabs,vec__36687,attrs,_))
;
return iter__24010__auto__.call(null,tabs);
})());
};
var weathergen$ui$tabs$tabs = function (var_args){
var args__29571__auto__ = null;
if (arguments.length > 0) {
var G__36730__i = 0, G__36730__a = new Array(arguments.length -  0);
while (G__36730__i < G__36730__a.length) {G__36730__a[G__36730__i] = arguments[G__36730__i + 0]; ++G__36730__i;}
  args__29571__auto__ = new cljs.core.IndexedSeq(G__36730__a,0,null);
} 
return weathergen$ui$tabs$tabs__delegate.call(this,args__29571__auto__);};
weathergen$ui$tabs$tabs.cljs$lang$maxFixedArity = 0;
weathergen$ui$tabs$tabs.cljs$lang$applyTo = (function (arglist__36731){
var args__29571__auto__ = cljs.core.seq(arglist__36731);
return weathergen$ui$tabs$tabs__delegate(args__29571__auto__);
});
weathergen$ui$tabs$tabs.cljs$core$IFn$_invoke$arity$variadic = weathergen$ui$tabs$tabs__delegate;
return weathergen$ui$tabs$tabs;
})()
;
