// Compiled by ClojureScript 0.0-2138
goog.provide('lt.objs.bottombar');
goog.require('cljs.core');
goog.require('lt.util.style');
goog.require('lt.util.cljs');
goog.require('crate.binding');
goog.require('lt.objs.tabs');
goog.require('lt.objs.animations');
goog.require('lt.objs.canvas');
goog.require('lt.util.cljs');
goog.require('lt.objs.animations');
goog.require('crate.binding');
goog.require('lt.objs.canvas');
goog.require('lt.object');
goog.require('lt.object');
goog.require('lt.util.style');
goog.require('lt.objs.tabs');
lt.objs.bottombar.min_height = 30;
lt.objs.bottombar.default_height = 130;
lt.objs.bottombar.horizontal_grip = (function horizontal_grip(this$){var e__3325__auto__ = crate.core.html.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div.horizontal-grip","div.horizontal-grip",642788208),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"draggable","draggable",709423359),"true"], null)], null));var seq__9113_9119 = cljs.core.seq.call(null,cljs.core.partition.call(null,2,new cljs.core.PersistentVector(null, 6, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"dragstart","dragstart",721070880),(function (e){return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"start-drag","start-drag",3689081649));
}),new cljs.core.Keyword(null,"dragend","dragend",2926432921),(function (e){return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"end-drag","end-drag",2692811352));
}),new cljs.core.Keyword(null,"drag","drag",1016996006),(function (e){return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"height!","height!",1816692556),e);
})], null)));var chunk__9114_9120 = null;var count__9115_9121 = 0;var i__9116_9122 = 0;while(true){
if((i__9116_9122 < count__9115_9121))
{var vec__9117_9123 = cljs.core._nth.call(null,chunk__9114_9120,i__9116_9122);var ev__3326__auto___9124 = cljs.core.nth.call(null,vec__9117_9123,0,null);var func__3327__auto___9125 = cljs.core.nth.call(null,vec__9117_9123,1,null);lt.util.dom.on.call(null,e__3325__auto__,ev__3326__auto___9124,func__3327__auto___9125);
{
var G__9126 = seq__9113_9119;
var G__9127 = chunk__9114_9120;
var G__9128 = count__9115_9121;
var G__9129 = (i__9116_9122 + 1);
seq__9113_9119 = G__9126;
chunk__9114_9120 = G__9127;
count__9115_9121 = G__9128;
i__9116_9122 = G__9129;
continue;
}
} else
{var temp__4092__auto___9130 = cljs.core.seq.call(null,seq__9113_9119);if(temp__4092__auto___9130)
{var seq__9113_9131__$1 = temp__4092__auto___9130;if(cljs.core.chunked_seq_QMARK_.call(null,seq__9113_9131__$1))
{var c__4262__auto___9132 = cljs.core.chunk_first.call(null,seq__9113_9131__$1);{
var G__9133 = cljs.core.chunk_rest.call(null,seq__9113_9131__$1);
var G__9134 = c__4262__auto___9132;
var G__9135 = cljs.core.count.call(null,c__4262__auto___9132);
var G__9136 = 0;
seq__9113_9119 = G__9133;
chunk__9114_9120 = G__9134;
count__9115_9121 = G__9135;
i__9116_9122 = G__9136;
continue;
}
} else
{var vec__9118_9137 = cljs.core.first.call(null,seq__9113_9131__$1);var ev__3326__auto___9138 = cljs.core.nth.call(null,vec__9118_9137,0,null);var func__3327__auto___9139 = cljs.core.nth.call(null,vec__9118_9137,1,null);lt.util.dom.on.call(null,e__3325__auto__,ev__3326__auto___9138,func__3327__auto___9139);
{
var G__9140 = cljs.core.next.call(null,seq__9113_9131__$1);
var G__9141 = null;
var G__9142 = 0;
var G__9143 = 0;
seq__9113_9119 = G__9140;
chunk__9114_9120 = G__9141;
count__9115_9121 = G__9142;
i__9116_9122 = G__9143;
continue;
}
}
} else
{}
}
break;
}
return e__3325__auto__;
});
lt.objs.bottombar.active_content = (function active_content(active){if(cljs.core.truth_(active))
{return lt.object.__GT_content.call(null,active);
} else
{return null;
}
});
lt.objs.bottombar.active_QMARK_ = (function active_QMARK_(item){return cljs.core._EQ_.call(null,new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.objs.bottombar.bottombar)),item);
});
lt.objs.bottombar.__GT_active_class = (function __GT_active_class(p__9144){var map__9146 = p__9144;var map__9146__$1 = ((cljs.core.seq_QMARK_.call(null,map__9146))?cljs.core.apply.call(null,cljs.core.hash_map,map__9146):map__9146);var active = cljs.core.get.call(null,map__9146__$1,new cljs.core.Keyword(null,"active","active",3885920888));if(cljs.core.truth_(active))
{return "open";
} else
{return "closed";
}
});
lt.objs.bottombar.add_item = (function add_item(item){return lt.object.update_BANG_.call(null,lt.objs.bottombar.bottombar,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"items","items",1114430258)], null),cljs.core.assoc,new cljs.core.Keyword(null,"order","order",1119910592).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,item)),item);
});
lt.object.object_STAR_.call(null,new cljs.core.Keyword("lt.objs.bottombar","bottombar","lt.objs.bottombar/bottombar",1537782029),new cljs.core.Keyword(null,"tags","tags",1017456523),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"bottombar","bottombar",3453493626),null], null), null),new cljs.core.Keyword(null,"items","items",1114430258),cljs.core.sorted_map_by.call(null,cljs.core._GT_),new cljs.core.Keyword(null,"height","height",4087841945),0,new cljs.core.Keyword(null,"max-height","max-height",585117986),lt.objs.bottombar.default_height,new cljs.core.Keyword(null,"init","init",1017141378),(function (this$){return new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div#bottombar","div#bottombar",676879368),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"class","class",1108647146),crate.binding.bound.call(null,this$,lt.objs.bottombar.__GT_active_class),new cljs.core.Keyword(null,"style","style",1123684643),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"left","left",1017222009),crate.binding.bound.call(null,crate.binding.subatom.call(null,lt.objs.tabs.multi,new cljs.core.Keyword(null,"left","left",1017222009)),lt.util.style.__GT_px),new cljs.core.Keyword(null,"right","right",1122416014),crate.binding.bound.call(null,crate.binding.subatom.call(null,lt.objs.tabs.multi,new cljs.core.Keyword(null,"right","right",1122416014)),lt.util.style.__GT_px),new cljs.core.Keyword(null,"height","height",4087841945),crate.binding.bound.call(null,crate.binding.subatom.call(null,this$,new cljs.core.Keyword(null,"height","height",4087841945)),lt.util.style.__GT_px)], null)], null),lt.objs.bottombar.horizontal_grip.call(null,this$),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div.content","div.content",3533478798),crate.binding.bound.call(null,crate.binding.subatom.call(null,this$,new cljs.core.Keyword(null,"active","active",3885920888)),lt.objs.bottombar.active_content)], null)], null);
}));
lt.objs.bottombar.bottombar = lt.object.create.call(null,new cljs.core.Keyword("lt.objs.bottombar","bottombar","lt.objs.bottombar/bottombar",1537782029));
lt.objs.canvas.add_BANG_.call(null,lt.objs.bottombar.bottombar);
lt.objs.bottombar.__BEH__no_anim_on_drag = (function __BEH__no_anim_on_drag(this$){return lt.objs.animations.off.call(null);
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.bottombar","no-anim-on-drag","lt.objs.bottombar/no-anim-on-drag",685212711),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.bottombar.__BEH__no_anim_on_drag,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"start-drag","start-drag",3689081649),null], null), null));
lt.objs.bottombar.__BEH__reanim_on_drop = (function __BEH__reanim_on_drop(this$){return lt.objs.animations.on.call(null);
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.bottombar","reanim-on-drop","lt.objs.bottombar/reanim-on-drop",2397266689),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.bottombar.__BEH__reanim_on_drop,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"end-drag","end-drag",2692811352),null], null), null));
lt.objs.bottombar.__BEH__height_BANG_ = (function __BEH__height_BANG_(this$,e){if(cljs.core._EQ_.call(null,0,e.clientY))
{return null;
} else
{var win_height = window.innerHeight;var height = (function (){var x__3827__auto__ = (win_height - e.clientY);var y__3828__auto__ = lt.objs.bottombar.min_height;return ((x__3827__auto__ > y__3828__auto__) ? x__3827__auto__ : y__3828__auto__);
})();lt.object.raise.call(null,lt.objs.tabs.multi,new cljs.core.Keyword(null,"bottom!","bottom!",1083481800),(height - new cljs.core.Keyword(null,"height","height",4087841945).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$))));
return lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"height","height",4087841945),height,new cljs.core.Keyword(null,"max-height","max-height",585117986),height], null));
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.bottombar","height!","lt.objs.bottombar/height!",3122217663),new cljs.core.Keyword(null,"throttle","throttle",2497347228),16,new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.bottombar.__BEH__height_BANG_,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"height!","height!",1816692556),null], null), null));
lt.objs.bottombar.__BEH__show_item = (function __BEH__show_item(this$,item){if(cljs.core.not_EQ_.call(null,item,new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$))))
{lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"active","active",3885920888),item,new cljs.core.Keyword(null,"height","height",4087841945),new cljs.core.Keyword(null,"max-height","max-height",585117986).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$))], null));
return lt.object.raise.call(null,lt.objs.tabs.multi,new cljs.core.Keyword(null,"bottom!","bottom!",1083481800),new cljs.core.Keyword(null,"max-height","max-height",585117986).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)));
} else
{return null;
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.bottombar","show-item","lt.objs.bottombar/show-item",1162331896),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.bottombar.__BEH__show_item,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"show!","show!",1123317814),null], null), null));
lt.objs.bottombar.__BEH__hide_item = (function __BEH__hide_item(this$,item,force_QMARK_){if(cljs.core.truth_((function (){var or__3520__auto__ = cljs.core._EQ_.call(null,item,new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)));if(or__3520__auto__)
{return or__3520__auto__;
} else
{return force_QMARK_;
}
})()))
{lt.object.raise.call(null,lt.objs.tabs.multi,new cljs.core.Keyword(null,"bottom!","bottom!",1083481800),(- new cljs.core.Keyword(null,"max-height","max-height",585117986).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$))));
return lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"active","active",3885920888),null,new cljs.core.Keyword(null,"height","height",4087841945),0], null));
} else
{return null;
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.bottombar","hide-item","lt.objs.bottombar/hide-item",3118213019),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.bottombar.__BEH__hide_item,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"hide!","hide!",1113177745),null], null), null));
lt.objs.bottombar.__BEH__item_toggled = (function __BEH__item_toggled(this$,item,force_QMARK_){if(cljs.core.truth_((function (){var or__3520__auto__ = cljs.core.not_EQ_.call(null,item,new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)));if(or__3520__auto__)
{return or__3520__auto__;
} else
{return force_QMARK_;
}
})()))
{return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"show!","show!",1123317814),item);
} else
{return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"hide!","hide!",1113177745),item);
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.bottombar","item-toggled","lt.objs.bottombar/item-toggled",2840037827),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.bottombar.__BEH__item_toggled,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"toggle","toggle",4440567494),null], null), null));
