// Compiled by ClojureScript 1.9.562 {}
goog.provide('weathergen.ui.common');
goog.require('cljs.core');
goog.require('cljs.pprint');
goog.require('clojure.string');
goog.require('garden.core');
goog.require('garden.selectors');
goog.require('garden.stylesheet');
goog.require('goog.string');
goog.require('goog.string.format');
goog.require('hoplon.storage_atom');
goog.require('hoplon.svg');
goog.require('taoensso.timbre');
goog.require('weathergen.falcon.files.images');
goog.require('weathergen.falcon.files.mission');
goog.require('weathergen.filesystem');
goog.require('weathergen.math');
goog.require('weathergen.settings');
goog.require('javelin.core');
goog.require('hoplon.jquery');
goog.require('hoplon.core');
weathergen.ui.common.tinycolor = module.exports;
/**
 * Returns a measurement string, e.g. '2px'. Allows multiple
 *   arguments, in which case it will return a margin-style string,
 *   e.g. `(measurement "px" 1 2)` returns '1px 2px'.
 */
weathergen.ui.common.measurement = (function weathergen$ui$common$measurement(var_args){
var args__24566__auto__ = [];
var len__24559__auto___36234 = arguments.length;
var i__24560__auto___36235 = (0);
while(true){
if((i__24560__auto___36235 < len__24559__auto___36234)){
args__24566__auto__.push((arguments[i__24560__auto___36235]));

var G__36236 = (i__24560__auto___36235 + (1));
i__24560__auto___36235 = G__36236;
continue;
} else {
}
break;
}

var argseq__24567__auto__ = ((((1) < args__24566__auto__.length))?(new cljs.core.IndexedSeq(args__24566__auto__.slice((1)),(0),null)):null);
return weathergen.ui.common.measurement.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__24567__auto__);
});

weathergen.ui.common.measurement.cljs$core$IFn$_invoke$arity$variadic = (function (unit,ns){
return clojure.string.join.call(null," ",cljs.core.map.call(null,(function (p1__36231_SHARP_){
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(p1__36231_SHARP_),cljs.core.str.cljs$core$IFn$_invoke$arity$1(unit)].join('');
}),ns));
});

weathergen.ui.common.measurement.cljs$lang$maxFixedArity = (1);

weathergen.ui.common.measurement.cljs$lang$applyTo = (function (seq36232){
var G__36233 = cljs.core.first.call(null,seq36232);
var seq36232__$1 = cljs.core.next.call(null,seq36232);
return weathergen.ui.common.measurement.cljs$core$IFn$_invoke$arity$variadic(G__36233,seq36232__$1);
});

/**
 * Returns a pixel measurement string, e.g. '2px'. See `measurement`.
 */
weathergen.ui.common.px = (function weathergen$ui$common$px(var_args){
var args__24566__auto__ = [];
var len__24559__auto___36238 = arguments.length;
var i__24560__auto___36239 = (0);
while(true){
if((i__24560__auto___36239 < len__24559__auto___36238)){
args__24566__auto__.push((arguments[i__24560__auto___36239]));

var G__36240 = (i__24560__auto___36239 + (1));
i__24560__auto___36239 = G__36240;
continue;
} else {
}
break;
}

var argseq__24567__auto__ = ((((0) < args__24566__auto__.length))?(new cljs.core.IndexedSeq(args__24566__auto__.slice((0)),(0),null)):null);
return weathergen.ui.common.px.cljs$core$IFn$_invoke$arity$variadic(argseq__24567__auto__);
});

weathergen.ui.common.px.cljs$core$IFn$_invoke$arity$variadic = (function (ns){
return cljs.core.apply.call(null,weathergen.ui.common.measurement,"px",ns);
});

weathergen.ui.common.px.cljs$lang$maxFixedArity = (0);

weathergen.ui.common.px.cljs$lang$applyTo = (function (seq36237){
return weathergen.ui.common.px.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq36237));
});

/**
 * Returns a percentage measurement string, e.g. '50%'. See `measurement`.
 */
weathergen.ui.common.pct = (function weathergen$ui$common$pct(var_args){
var args__24566__auto__ = [];
var len__24559__auto___36242 = arguments.length;
var i__24560__auto___36243 = (0);
while(true){
if((i__24560__auto___36243 < len__24559__auto___36242)){
args__24566__auto__.push((arguments[i__24560__auto___36243]));

var G__36244 = (i__24560__auto___36243 + (1));
i__24560__auto___36243 = G__36244;
continue;
} else {
}
break;
}

var argseq__24567__auto__ = ((((0) < args__24566__auto__.length))?(new cljs.core.IndexedSeq(args__24566__auto__.slice((0)),(0),null)):null);
return weathergen.ui.common.pct.cljs$core$IFn$_invoke$arity$variadic(argseq__24567__auto__);
});

weathergen.ui.common.pct.cljs$core$IFn$_invoke$arity$variadic = (function (ns){
return cljs.core.apply.call(null,weathergen.ui.common.measurement,"%",ns);
});

weathergen.ui.common.pct.cljs$lang$maxFixedArity = (0);

weathergen.ui.common.pct.cljs$lang$applyTo = (function (seq36241){
return weathergen.ui.common.pct.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq36241));
});

/**
 * Returns a measurement string in em, e.g. '2em'. See `measurement`.
 */
weathergen.ui.common.ems = (function weathergen$ui$common$ems(var_args){
var args__24566__auto__ = [];
var len__24559__auto___36246 = arguments.length;
var i__24560__auto___36247 = (0);
while(true){
if((i__24560__auto___36247 < len__24559__auto___36246)){
args__24566__auto__.push((arguments[i__24560__auto___36247]));

var G__36248 = (i__24560__auto___36247 + (1));
i__24560__auto___36247 = G__36248;
continue;
} else {
}
break;
}

var argseq__24567__auto__ = ((((0) < args__24566__auto__.length))?(new cljs.core.IndexedSeq(args__24566__auto__.slice((0)),(0),null)):null);
return weathergen.ui.common.ems.cljs$core$IFn$_invoke$arity$variadic(argseq__24567__auto__);
});

weathergen.ui.common.ems.cljs$core$IFn$_invoke$arity$variadic = (function (ns){
return cljs.core.apply.call(null,weathergen.ui.common.measurement,"em",ns);
});

weathergen.ui.common.ems.cljs$lang$maxFixedArity = (0);

weathergen.ui.common.ems.cljs$lang$applyTo = (function (seq36245){
return weathergen.ui.common.ems.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq36245));
});

weathergen.ui.common.colors = new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"invalid","invalid",412869516),"#c70505",new cljs.core.Keyword(null,"invalid-background","invalid-background",-917496690),"#fcc",new cljs.core.Keyword(null,"error-message","error-message",1756021561),"#c70505",new cljs.core.Keyword(null,"edit","edit",-1641834166),"rgba(128,128,255,0.5)",new cljs.core.Keyword(null,"header-background","header-background",1686840154),"lightgray",new cljs.core.Keyword(null,"team","team",1355747699),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"dark-text","dark-text",814777253),new cljs.core.PersistentArrayMap(null, 8, [new cljs.core.Keyword(null,"white","white",-483998618),"gray",new cljs.core.Keyword(null,"green","green",-945526839),"green",new cljs.core.Keyword(null,"blue","blue",-622100620),"blue",new cljs.core.Keyword(null,"brown","brown",1414854429),"#923c25",new cljs.core.Keyword(null,"orange","orange",73816386),"darkorange",new cljs.core.Keyword(null,"yellow","yellow",-881035449),"#caae18",new cljs.core.Keyword(null,"red","red",-969428204),"red",new cljs.core.Keyword(null,"gray","gray",1013268388),"darkgray"], null),new cljs.core.Keyword(null,"light-text","light-text",-274885440),new cljs.core.PersistentArrayMap(null, 8, [new cljs.core.Keyword(null,"white","white",-483998618),"white",new cljs.core.Keyword(null,"green","green",-945526839),"lightgreen",new cljs.core.Keyword(null,"blue","blue",-622100620),"#8ddbf5",new cljs.core.Keyword(null,"brown","brown",1414854429),"#e27e43",new cljs.core.Keyword(null,"orange","orange",73816386),"orange",new cljs.core.Keyword(null,"yellow","yellow",-881035449),"yellow",new cljs.core.Keyword(null,"red","red",-969428204),"#f9adad",new cljs.core.Keyword(null,"gray","gray",1013268388),"lightgray"], null)], null)], null);
/**
 * Returns a color for a team.
 */
weathergen.ui.common.team_color = (function weathergen$ui$common$team_color(team,type){
return cljs.core.get_in.call(null,weathergen.ui.common.colors,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"team","team",1355747699),type,weathergen.falcon.files.mission.team_color.call(null,team)], null));
});
/**
 * Given a keyword, returns a string safe to use as a css class name.
 */
weathergen.ui.common.class_for = cljs.core.memoize.call(null,(function (kw){
return clojure.string.replace.call(null,cljs.core.subs.call(null,[cljs.core.str.cljs$core$IFn$_invoke$arity$1(kw)].join(''),(1)),/[^a-zA-Z0-9]/,"-");
}));
/**
 * Given a keyword, returns a garden class selector usable with class-for.
 */
weathergen.ui.common.class_selector_for = (function weathergen$ui$common$class_selector_for(kw){
return garden.selectors.selector.call(null,[cljs.core.str.cljs$core$IFn$_invoke$arity$1("."),cljs.core.str.cljs$core$IFn$_invoke$arity$1(weathergen.ui.common.class_for.call(null,kw))].join(''));
});
weathergen.ui.common.registered_styles = cljs.core.atom.call(null,cljs.core.PersistentHashSet.EMPTY);
/**
 * Adds styles to the head of the document. If already registered under `key`, does nothing.
 */
weathergen.ui.common.register_styles_BANG_ = (function weathergen$ui$common$register_styles_BANG_(key,garden__$1){
if(cljs.core.contains_QMARK_.call(null,cljs.core.deref.call(null,weathergen.ui.common.registered_styles),key)){
return null;
} else {
var head = (document.getElementsByTagName("head")[(0)]);
var styles = javelin.core.formula.call(null,((function (head){
return (function (G__36251,G__36252){
return G__36251.call(null,G__36252);
});})(head))
).call(null,garden.core.css,garden__$1);
cljs.core.swap_BANG_.call(null,weathergen.ui.common.registered_styles,cljs.core.conj,key);

return hoplon.core.when_dom.call(null,head,((function (head,styles){
return (function (){
taoensso.timbre._log_BANG_.call(null,taoensso.timbre._STAR_config_STAR_,new cljs.core.Keyword(null,"debug","debug",-1608172596),"weathergen.ui.common",null,109,new cljs.core.Keyword(null,"p","p",151049309),new cljs.core.Keyword(null,"auto","auto",-566279492),(new cljs.core.Delay(((function (head,styles){
return (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, ["Registering style",[cljs.core.str.cljs$core$IFn$_invoke$arity$1(key)].join('')], null);
});})(head,styles))
,null)),null,502558705);

return head.appendChild(hoplon.core.style.call(null,new cljs.core.Keyword(null,"type","type",1174270348),"text/css",new cljs.core.Keyword(null,"debug","debug",-1608172596),[cljs.core.str.cljs$core$IFn$_invoke$arity$1(key)].join(''),styles));
});})(head,styles))
);
}
});
/**
 * Adds a style to the head of a document for abstract class `key`.
 *   `key` should be a namespaced keyword that can then be used as the
 *   `:class` of an element via `class-for`. `garden` is the tail of a
 *   garden style statement, i.e. everything except the seelctor.
 * 
 *   Example:
 * 
 *   (register-class!
 *  ::foobar
 *  [{:background "blue"} [:&:hover {:background "red"}]])
 */
weathergen.ui.common.register_class_BANG_ = (function weathergen$ui$common$register_class_BANG_(key,garden__$1){
return weathergen.ui.common.register_styles_BANG_.call(null,key,cljs.core.into.call(null,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [weathergen.ui.common.class_selector_for.call(null,key)], null),garden__$1));
});
/**
 * Returns a color that contrasts well with the specified color.
 *   Optionally, the colors to use for dark and light can be specified.
 */
weathergen.ui.common.contrasting = (function weathergen$ui$common$contrasting(var_args){
var args36253 = [];
var len__24559__auto___36257 = arguments.length;
var i__24560__auto___36258 = (0);
while(true){
if((i__24560__auto___36258 < len__24559__auto___36257)){
args36253.push((arguments[i__24560__auto___36258]));

var G__36259 = (i__24560__auto___36258 + (1));
i__24560__auto___36258 = G__36259;
continue;
} else {
}
break;
}

var G__36255 = args36253.length;
switch (G__36255) {
case 1:
return weathergen.ui.common.contrasting.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 3:
return weathergen.ui.common.contrasting.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args36253.length)].join('')));

}
});

weathergen.ui.common.contrasting.cljs$core$IFn$_invoke$arity$1 = (function (color){
return weathergen.ui.common.contrasting.call(null,color,"black","white");
});

weathergen.ui.common.contrasting.cljs$core$IFn$_invoke$arity$3 = (function (color,dark,light){
return (function (){var G__36256 = weathergen.ui.common.tinycolor.mostReadable(color,[dark,light]);
return G__36256;
})().toHexString();
});

weathergen.ui.common.contrasting.cljs$lang$maxFixedArity = 3;

/**
 * Darkens a color by an amount from 0-100.
 */
weathergen.ui.common.darken = (function weathergen$ui$common$darken(color,amount){
return (function (){var G__36263 = (function (){var G__36264 = weathergen.ui.common.tinycolor.call(null,color);
return G__36264;
})().darken(amount);
return G__36263;
})().toHexString();
});
/**
 * Lightens a color by an amount from 0-100.
 */
weathergen.ui.common.lighten = (function weathergen$ui$common$lighten(color,amount){
return (function (){var G__36267 = (function (){var G__36268 = weathergen.ui.common.tinycolor.call(null,color);
return G__36268;
})().lighten(amount);
return G__36267;
})().toHexString();
});
/**
 * Rotates a color by an amount from 0 to 360 degrees.
 */
weathergen.ui.common.spin = (function weathergen$ui$common$spin(color,amount){
return (function (){var G__36271 = (function (){var G__36272 = weathergen.ui.common.tinycolor.call(null,color);
return G__36272;
})().spin(amount);
return G__36271;
})().toHexString();
});
/**
 * Converts a color to a hex string.
 */
weathergen.ui.common.to_hex_str = (function weathergen$ui$common$to_hex_str(color){
return (function (){var G__36274 = weathergen.ui.common.tinycolor.call(null,color);
return G__36274;
})().toHexString();
});
/**
 * Creates an element which is a scope for a set of CSS rules,
 *   provided via a `:garden` attribute, by adding an element with a
 *   unique ID and new <style> element to the <head> of the document.
 * @param {...*} var_args
 */
weathergen.ui.common.styled = (function() { 
var weathergen$ui$common$styled__delegate = function (args__29776__auto__){
var vec__36284 = hoplon.core.parse_args.call(null,args__29776__auto__);
var attrs = cljs.core.nth.call(null,vec__36284,(0),null);
var content = cljs.core.nth.call(null,vec__36284,(1),null);
var map__36287 = attrs;
var map__36287__$1 = ((((!((map__36287 == null)))?((((map__36287.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36287.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36287):map__36287);
var garden__$1 = cljs.core.get.call(null,map__36287__$1,new cljs.core.Keyword(null,"garden","garden",-1966516149));
var attrs__$1 = cljs.core.dissoc.call(null,attrs,new cljs.core.Keyword(null,"garden","garden",-1966516149));
var head = (document.getElementsByTagName("head")[(0)]);
var id = [cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.gensym.call(null))].join('');
var styles = javelin.core.formula.call(null,((function (map__36287,map__36287__$1,garden__$1,attrs__$1,head,id,vec__36284,attrs,content){
return (function (G__36289,G__36292,G__36290,G__36291){
return G__36289.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [G__36290.call(null,[cljs.core.str.cljs$core$IFn$_invoke$arity$1("#"),cljs.core.str.cljs$core$IFn$_invoke$arity$1(G__36291)].join('')),G__36292], null));
});})(map__36287,map__36287__$1,garden__$1,attrs__$1,head,id,vec__36284,attrs,content))
).call(null,garden.core.css,garden__$1,cljs.core.keyword,id);
head.appendChild(hoplon.core.style.call(null,new cljs.core.Keyword(null,"type","type",1174270348),"text/css",styles));

return hoplon.core.div.call(null,cljs.core.merge.call(null,attrs__$1,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"id","id",-1388402092),id], null)),content);
};
var weathergen$ui$common$styled = function (var_args){
var args__29776__auto__ = null;
if (arguments.length > 0) {
var G__36293__i = 0, G__36293__a = new Array(arguments.length -  0);
while (G__36293__i < G__36293__a.length) {G__36293__a[G__36293__i] = arguments[G__36293__i + 0]; ++G__36293__i;}
  args__29776__auto__ = new cljs.core.IndexedSeq(G__36293__a,0,null);
} 
return weathergen$ui$common$styled__delegate.call(this,args__29776__auto__);};
weathergen$ui$common$styled.cljs$lang$maxFixedArity = 0;
weathergen$ui$common$styled.cljs$lang$applyTo = (function (arglist__36294){
var args__29776__auto__ = cljs.core.seq(arglist__36294);
return weathergen$ui$common$styled__delegate(args__29776__auto__);
});
weathergen$ui$common$styled.cljs$core$IFn$_invoke$arity$variadic = weathergen$ui$common$styled__delegate;
return weathergen$ui$common$styled;
})()
;
/**
 * @param {...*} var_args
 */
weathergen.ui.common.inl = (function() { 
var weathergen$ui$common$inl__delegate = function (args__29776__auto__){
var vec__36300 = hoplon.core.parse_args.call(null,args__29776__auto__);
var attrs = cljs.core.nth.call(null,vec__36300,(0),null);
var content = cljs.core.nth.call(null,vec__36300,(1),null);
var map__36303 = attrs;
var map__36303__$1 = ((((!((map__36303 == null)))?((((map__36303.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36303.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36303):map__36303);
var css = cljs.core.get.call(null,map__36303__$1,new cljs.core.Keyword(null,"css","css",1135045163));
return hoplon.core.div.call(null,cljs.core.update.call(null,attrs,new cljs.core.Keyword(null,"css","css",1135045163),((function (map__36303,map__36303__$1,css,vec__36300,attrs,content){
return (function (css_orig){
if(cljs.core.truth_(javelin.core.cell_QMARK_.call(null,css_orig))){
return javelin.core.formula.call(null,((function (map__36303,map__36303__$1,css,vec__36300,attrs,content){
return (function (css_orig__$1){
return cljs.core.assoc.call(null,css_orig__$1,new cljs.core.Keyword(null,"display","display",242065432),"inline-block");
});})(map__36303,map__36303__$1,css,vec__36300,attrs,content))
).call(null,css_orig);
} else {
return cljs.core.assoc.call(null,css_orig,new cljs.core.Keyword(null,"display","display",242065432),"inline-block");
}
});})(map__36303,map__36303__$1,css,vec__36300,attrs,content))
),content);
};
var weathergen$ui$common$inl = function (var_args){
var args__29776__auto__ = null;
if (arguments.length > 0) {
var G__36305__i = 0, G__36305__a = new Array(arguments.length -  0);
while (G__36305__i < G__36305__a.length) {G__36305__a[G__36305__i] = arguments[G__36305__i + 0]; ++G__36305__i;}
  args__29776__auto__ = new cljs.core.IndexedSeq(G__36305__a,0,null);
} 
return weathergen$ui$common$inl__delegate.call(this,args__29776__auto__);};
weathergen$ui$common$inl.cljs$lang$maxFixedArity = 0;
weathergen$ui$common$inl.cljs$lang$applyTo = (function (arglist__36306){
var args__29776__auto__ = cljs.core.seq(arglist__36306);
return weathergen$ui$common$inl__delegate(args__29776__auto__);
});
weathergen$ui$common$inl.cljs$core$IFn$_invoke$arity$variadic = weathergen$ui$common$inl__delegate;
return weathergen$ui$common$inl;
})()
;
/**
 * @param {...*} var_args
 */
weathergen.ui.common.triangle = (function() { 
var weathergen$ui$common$triangle__delegate = function (args__29776__auto__){
var vec__36317 = hoplon.core.parse_args.call(null,args__29776__auto__);
var attrs = cljs.core.nth.call(null,vec__36317,(0),null);
var _ = cljs.core.nth.call(null,vec__36317,(1),null);
var map__36320 = attrs;
var map__36320__$1 = ((((!((map__36320 == null)))?((((map__36320.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36320.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36320):map__36320);
var r = cljs.core.get.call(null,map__36320__$1,new cljs.core.Keyword(null,"r","r",-471384190));
var r_STAR_ = javelin.core.formula.call(null,((function (map__36320,map__36320__$1,r,vec__36317,attrs,_){
return (function (G__36322){
return G__36322;
});})(map__36320,map__36320__$1,r,vec__36317,attrs,_))
).call(null,r);
var attrs__$1 = cljs.core.dissoc.call(null,attrs,new cljs.core.Keyword(null,"r","r",-471384190));
var alpha = 0.8660254037844387;
var beta = 0.5;
var x = javelin.core.formula.call(null,((function (map__36320,map__36320__$1,r,r_STAR_,attrs__$1,alpha,beta,vec__36317,attrs,_){
return (function (G__36323,G__36324){
return (G__36323 * G__36324);
});})(map__36320,map__36320__$1,r,r_STAR_,attrs__$1,alpha,beta,vec__36317,attrs,_))
).call(null,r_STAR_,alpha);
var y = javelin.core.formula.call(null,((function (map__36320,map__36320__$1,r,r_STAR_,attrs__$1,alpha,beta,x,vec__36317,attrs,_){
return (function (G__36325,G__36326){
return (G__36325 * G__36326);
});})(map__36320,map__36320__$1,r,r_STAR_,attrs__$1,alpha,beta,x,vec__36317,attrs,_))
).call(null,r_STAR_,alpha);
return hoplon.svg.path.call(null,new cljs.core.Keyword(null,"d","d",1972142424),javelin.core.formula.call(null,((function (map__36320,map__36320__$1,r,r_STAR_,attrs__$1,alpha,beta,x,y,vec__36317,attrs,_){
return (function (x__$1,y__$1){
return goog.string.format("M%f,%f L%f,%f L%f,%f Z",(0),(- y__$1),x__$1,y__$1,(- x__$1),y__$1);
});})(map__36320,map__36320__$1,r,r_STAR_,attrs__$1,alpha,beta,x,y,vec__36317,attrs,_))
).call(null,x,y),attrs__$1);
};
var weathergen$ui$common$triangle = function (var_args){
var args__29776__auto__ = null;
if (arguments.length > 0) {
var G__36327__i = 0, G__36327__a = new Array(arguments.length -  0);
while (G__36327__i < G__36327__a.length) {G__36327__a[G__36327__i] = arguments[G__36327__i + 0]; ++G__36327__i;}
  args__29776__auto__ = new cljs.core.IndexedSeq(G__36327__a,0,null);
} 
return weathergen$ui$common$triangle__delegate.call(this,args__29776__auto__);};
weathergen$ui$common$triangle.cljs$lang$maxFixedArity = 0;
weathergen$ui$common$triangle.cljs$lang$applyTo = (function (arglist__36328){
var args__29776__auto__ = cljs.core.seq(arglist__36328);
return weathergen$ui$common$triangle__delegate(args__29776__auto__);
});
weathergen$ui$common$triangle.cljs$core$IFn$_invoke$arity$variadic = weathergen$ui$common$triangle__delegate;
return weathergen$ui$common$triangle;
})()
;
/**
 * Pretty-prints the value of cell c and displays it in a pre tag.
 */
weathergen.ui.common.pre_cell = (function weathergen$ui$common$pre_cell(title,c){
weathergen.ui.common.register_styles_BANG_.call(null,new cljs.core.Keyword("weathergen.ui.common","pre-cell","weathergen.ui.common/pre-cell",-1959908687),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,".pre-cell",".pre-cell",1928754490),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"background","background",-863952629),"black",new cljs.core.Keyword(null,"color","color",1011675173),"green",new cljs.core.Keyword(null,"font-family","font-family",-667419874),"monospace"], null)], null)], null));

return hoplon.core.div.call(null,new cljs.core.Keyword(null,"class","class",-2030961996),"pre-cell",hoplon.core.h4.call(null,title),hoplon.core.pre.call(null,new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"white-space","white-space",-707351930),"pre-wrap"], null),javelin.core.formula.call(null,(function (G__36331,G__36332){
return G__36331.call(null,G__36332,new cljs.core.Keyword(null,"stream","stream",1534941648),null,new cljs.core.Keyword(null,"pretty","pretty",-1916372486),true);
})).call(null,cljs.pprint.write,c)));
});
/**
 * @param {...*} var_args
 */
weathergen.ui.common.control_section = (function() { 
var weathergen$ui$common$control_section__delegate = function (args__29776__auto__){
var vec__36336 = hoplon.core.parse_args.call(null,args__29776__auto__);
var attributes = cljs.core.nth.call(null,vec__36336,(0),null);
var children = cljs.core.nth.call(null,vec__36336,(1),null);
var visible = javelin.core.cell.call(null,cljs.core.not.call(null,new cljs.core.Keyword(null,"collapsed?","collapsed?",-1661420674).cljs$core$IFn$_invoke$arity$1(attributes)));
var change_visibility = ((function (visible,vec__36336,attributes,children){
return (function (){
return cljs.core.swap_BANG_.call(null,visible,cljs.core.not);
});})(visible,vec__36336,attributes,children))
;
return hoplon.core.fieldset.call(null,new cljs.core.Keyword(null,"class","class",-2030961996),"controls",cljs.core.dissoc.call(null,attributes,new cljs.core.Keyword(null,"title","title",636505583),new cljs.core.Keyword(null,"collapsed?","collapsed?",-1661420674),new cljs.core.Keyword(null,"help-for","help-for",-1997101642)),hoplon.core.legend.call(null,hoplon.core.div.call(null,new cljs.core.Keyword(null,"click","click",1912301393),change_visibility,new cljs.core.Keyword(null,"class","class",-2030961996),javelin.core.formula.call(null,((function (visible,change_visibility,vec__36336,attributes,children){
return (function (visible__$1){
return new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"toggle","toggle",1291842030),true,new cljs.core.Keyword(null,"visible","visible",-1024216805),visible__$1], null);
});})(visible,change_visibility,vec__36336,attributes,children))
).call(null,visible),""),hoplon.core.span.call(null,new cljs.core.Keyword(null,"title","title",636505583).cljs$core$IFn$_invoke$arity$1(attributes))),hoplon.core.div.call(null,new cljs.core.Keyword(null,"class","class",-2030961996),"control-visibility-container",new cljs.core.Keyword(null,"toggle","toggle",1291842030),visible,new cljs.core.Keyword(null,"fade-toggle","fade-toggle",-1468421852),visible,hoplon.core.div.call(null,new cljs.core.Keyword(null,"class","class",-2030961996),"control-container",children)));
};
var weathergen$ui$common$control_section = function (var_args){
var args__29776__auto__ = null;
if (arguments.length > 0) {
var G__36339__i = 0, G__36339__a = new Array(arguments.length -  0);
while (G__36339__i < G__36339__a.length) {G__36339__a[G__36339__i] = arguments[G__36339__i + 0]; ++G__36339__i;}
  args__29776__auto__ = new cljs.core.IndexedSeq(G__36339__a,0,null);
} 
return weathergen$ui$common$control_section__delegate.call(this,args__29776__auto__);};
weathergen$ui$common$control_section.cljs$lang$maxFixedArity = 0;
weathergen$ui$common$control_section.cljs$lang$applyTo = (function (arglist__36340){
var args__29776__auto__ = cljs.core.seq(arglist__36340);
return weathergen$ui$common$control_section__delegate(args__29776__auto__);
});
weathergen$ui$common$control_section.cljs$core$IFn$_invoke$arity$variadic = weathergen$ui$common$control_section__delegate;
return weathergen$ui$common$control_section;
})()
;
/**
 * Formats a campaign time into a string. `opts` is a map of options:
 * 
 *   `:seconds?` - If true, format time including seconds.
 *   `:omit-day?` - If true, don't include the day in the result
 */
weathergen.ui.common.format_time = (function weathergen$ui$common$format_time(var_args){
var args36341 = [];
var len__24559__auto___36353 = arguments.length;
var i__24560__auto___36354 = (0);
while(true){
if((i__24560__auto___36354 < len__24559__auto___36353)){
args36341.push((arguments[i__24560__auto___36354]));

var G__36355 = (i__24560__auto___36354 + (1));
i__24560__auto___36354 = G__36355;
continue;
} else {
}
break;
}

var G__36343 = args36341.length;
switch (G__36343) {
case 1:
return weathergen.ui.common.format_time.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return weathergen.ui.common.format_time.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args36341.length)].join('')));

}
});

weathergen.ui.common.format_time.cljs$core$IFn$_invoke$arity$1 = (function (p__36344){
var map__36345 = p__36344;
var map__36345__$1 = ((((!((map__36345 == null)))?((((map__36345.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36345.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36345):map__36345);
var time = map__36345__$1;
var day = cljs.core.get.call(null,map__36345__$1,new cljs.core.Keyword(null,"day","day",-274800446));
var hour = cljs.core.get.call(null,map__36345__$1,new cljs.core.Keyword(null,"hour","hour",-555989214));
var minute = cljs.core.get.call(null,map__36345__$1,new cljs.core.Keyword(null,"minute","minute",-642875969));
var second = cljs.core.get.call(null,map__36345__$1,new cljs.core.Keyword(null,"second","second",-444702010));
return weathergen.ui.common.format_time.call(null,time,cljs.core.PersistentArrayMap.EMPTY);
});

weathergen.ui.common.format_time.cljs$core$IFn$_invoke$arity$2 = (function (p__36347,p__36348){
var map__36349 = p__36347;
var map__36349__$1 = ((((!((map__36349 == null)))?((((map__36349.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36349.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36349):map__36349);
var time = map__36349__$1;
var day = cljs.core.get.call(null,map__36349__$1,new cljs.core.Keyword(null,"day","day",-274800446));
var hour = cljs.core.get.call(null,map__36349__$1,new cljs.core.Keyword(null,"hour","hour",-555989214));
var minute = cljs.core.get.call(null,map__36349__$1,new cljs.core.Keyword(null,"minute","minute",-642875969));
var second = cljs.core.get.call(null,map__36349__$1,new cljs.core.Keyword(null,"second","second",-444702010));
var map__36350 = p__36348;
var map__36350__$1 = ((((!((map__36350 == null)))?((((map__36350.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36350.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36350):map__36350);
var opts = map__36350__$1;
var seconds_QMARK_ = cljs.core.get.call(null,map__36350__$1,new cljs.core.Keyword(null,"seconds?","seconds?",-1600404958));
var omit_day_QMARK_ = cljs.core.get.call(null,map__36350__$1,new cljs.core.Keyword(null,"omit-day?","omit-day?",1622751707));
if(cljs.core.truth_(time)){
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1((cljs.core.truth_(omit_day_QMARK_)?"":goog.string.format("%02d/",day))),cljs.core.str.cljs$core$IFn$_invoke$arity$1((cljs.core.truth_(seconds_QMARK_)?goog.string.format("%02d:%02d:%02d",hour,minute,second):goog.string.format("%02d:%02d",hour,minute)))].join('');
} else {
return null;
}
});

weathergen.ui.common.format_time.cljs$lang$maxFixedArity = 2;

/**
 * Formats a heading
 */
weathergen.ui.common.format_heading = (function weathergen$ui$common$format_heading(heading){
var G__36358 = heading;
if((G__36358 == null)){
return null;
} else {
return G__36358.toFixed((0));
}
});
/**
 * Formats a distance
 */
weathergen.ui.common.format_distance = (function weathergen$ui$common$format_distance(distance){
var G__36360 = distance;
if((G__36360 == null)){
return null;
} else {
return G__36360.toFixed((1));
}
});
/**
 * Formats a speed.
 */
weathergen.ui.common.format_speed = (function weathergen$ui$common$format_speed(speed){
var G__36362 = speed;
var G__36362__$1 = (((G__36362 == null))?null:weathergen.math.nearest.call(null,G__36362,(5)));
if((G__36362__$1 == null)){
return null;
} else {
return G__36362__$1.toFixed((0));
}
});
/**
 * Formats a Mach number.
 */
weathergen.ui.common.format_mach = (function weathergen$ui$common$format_mach(mach){
var G__36364 = mach;
if((G__36364 == null)){
return null;
} else {
return G__36364.toFixed((2));
}
});
/**
 * @param {...*} var_args
 */
weathergen.ui.common.color_picker = (function() { 
var weathergen$ui$common$color_picker__delegate = function (args__29776__auto__){
var vec__36372 = hoplon.core.parse_args.call(null,args__29776__auto__);
var attrs = cljs.core.nth.call(null,vec__36372,(0),null);
var _ = cljs.core.nth.call(null,vec__36372,(1),null);
var map__36375 = attrs;
var map__36375__$1 = ((((!((map__36375 == null)))?((((map__36375.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36375.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36375):map__36375);
var change = cljs.core.get.call(null,map__36375__$1,new cljs.core.Keyword(null,"change","change",-1163046502));
var hide = cljs.core.get.call(null,map__36375__$1,new cljs.core.Keyword(null,"hide","hide",-596913169));
var show = cljs.core.get.call(null,map__36375__$1,new cljs.core.Keyword(null,"show","show",-576705889));
var attrs_STAR_ = cljs.core.dissoc.call(null,attrs,new cljs.core.Keyword(null,"change","change",-1163046502),new cljs.core.Keyword(null,"hide","hide",-596913169),new cljs.core.Keyword(null,"show","show",-576705889));
var open_QMARK_ = cljs.core.atom.call(null,false);
var i = hoplon.core.input.call(null,attrs_STAR_,new cljs.core.Keyword(null,"class","class",-2030961996),"minicolors",new cljs.core.Keyword(null,"type","type",1174270348),"hidden",new cljs.core.Keyword(null,"change","change",-1163046502),((function (map__36375,map__36375__$1,change,hide,show,attrs_STAR_,open_QMARK_,vec__36372,attrs,_){
return (function (e){
if(cljs.core.truth_((function (){var and__23326__auto__ = change;
if(cljs.core.truth_(and__23326__auto__)){
return cljs.core.deref.call(null,open_QMARK_);
} else {
return and__23326__auto__;
}
})())){
return change.call(null,e);
} else {
return null;
}
});})(map__36375,map__36375__$1,change,hide,show,attrs_STAR_,open_QMARK_,vec__36372,attrs,_))
);
cljs.core.add_watch.call(null,new cljs.core.Keyword(null,"value","value",305978217).cljs$core$IFn$_invoke$arity$1(attrs),cljs.core.keyword.call(null,[cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.gensym.call(null))].join('')),((function (i,map__36375,map__36375__$1,change,hide,show,attrs_STAR_,open_QMARK_,vec__36372,attrs,_){
return (function (___$1,___$2,___$3,n){
if(cljs.core.truth_(n)){
return (function (){var G__36377 = jQuery(i);
return G__36377;
})().minicolors("value",weathergen.ui.common.to_hex_str.call(null,n));
} else {
return null;
}
});})(i,map__36375,map__36375__$1,change,hide,show,attrs_STAR_,open_QMARK_,vec__36372,attrs,_))
);

hoplon.core.when_dom.call(null,i,((function (i,map__36375,map__36375__$1,change,hide,show,attrs_STAR_,open_QMARK_,vec__36372,attrs,_){
return (function (){
return (function (){var G__36378 = jQuery(i);
return G__36378;
})().minicolors(({"theme": "weathergen", "show": ((function (i,map__36375,map__36375__$1,change,hide,show,attrs_STAR_,open_QMARK_,vec__36372,attrs,_){
return (function (){
cljs.core.reset_BANG_.call(null,open_QMARK_,true);

if(cljs.core.truth_(show)){
return show.call(null);
} else {
return null;
}
});})(i,map__36375,map__36375__$1,change,hide,show,attrs_STAR_,open_QMARK_,vec__36372,attrs,_))
, "hide": ((function (i,map__36375,map__36375__$1,change,hide,show,attrs_STAR_,open_QMARK_,vec__36372,attrs,_){
return (function (){
cljs.core.reset_BANG_.call(null,open_QMARK_,false);

if(cljs.core.truth_(hide)){
return hide.call(null);
} else {
return null;
}
});})(i,map__36375,map__36375__$1,change,hide,show,attrs_STAR_,open_QMARK_,vec__36372,attrs,_))
}));
});})(i,map__36375,map__36375__$1,change,hide,show,attrs_STAR_,open_QMARK_,vec__36372,attrs,_))
);

return i;
};
var weathergen$ui$common$color_picker = function (var_args){
var args__29776__auto__ = null;
if (arguments.length > 0) {
var G__36379__i = 0, G__36379__a = new Array(arguments.length -  0);
while (G__36379__i < G__36379__a.length) {G__36379__a[G__36379__i] = arguments[G__36379__i + 0]; ++G__36379__i;}
  args__29776__auto__ = new cljs.core.IndexedSeq(G__36379__a,0,null);
} 
return weathergen$ui$common$color_picker__delegate.call(this,args__29776__auto__);};
weathergen$ui$common$color_picker.cljs$lang$maxFixedArity = 0;
weathergen$ui$common$color_picker.cljs$lang$applyTo = (function (arglist__36380){
var args__29776__auto__ = cljs.core.seq(arglist__36380);
return weathergen$ui$common$color_picker__delegate(args__29776__auto__);
});
weathergen$ui$common$color_picker.cljs$core$IFn$_invoke$arity$variadic = weathergen$ui$common$color_picker__delegate;
return weathergen$ui$common$color_picker;
})()
;
/**
 * Returns UI for the display name of a side.
 * @param {...*} var_args
 */
weathergen.ui.common.side_label = (function() { 
var weathergen$ui$common$side_label__delegate = function (args__29776__auto__){
var vec__36405 = hoplon.core.parse_args.call(null,args__29776__auto__);
var attrs = cljs.core.nth.call(null,vec__36405,(0),null);
var _ = cljs.core.nth.call(null,vec__36405,(1),null);
var map__36408 = attrs;
var map__36408__$1 = ((((!((map__36408 == null)))?((((map__36408.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36408.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36408):map__36408);
var mission = cljs.core.get.call(null,map__36408__$1,new cljs.core.Keyword(null,"mission","mission",1740288522));
var side = cljs.core.get.call(null,map__36408__$1,new cljs.core.Keyword(null,"side","side",389652279));
var allies = javelin.core.formula.call(null,((function (map__36408,map__36408__$1,mission,side,vec__36405,attrs,_){
return (function (mission__$1,side__$1){
var side_teams = cljs.core.set.call(null,cljs.core.map.call(null,((function (map__36408,map__36408__$1,mission,side,vec__36405,attrs,_){
return (function (p1__36382_SHARP_){
return new cljs.core.Keyword(null,"who","who",-235935040).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"team","team",1355747699).cljs$core$IFn$_invoke$arity$1(p1__36382_SHARP_));
});})(map__36408,map__36408__$1,mission,side,vec__36405,attrs,_))
,cljs.core.filter.call(null,((function (map__36408,map__36408__$1,mission,side,vec__36405,attrs,_){
return (function (p1__36381_SHARP_){
return cljs.core._EQ_.call(null,new cljs.core.Keyword(null,"c-team","c-team",1058111407).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"team","team",1355747699).cljs$core$IFn$_invoke$arity$1(p1__36381_SHARP_)),side__$1);
});})(map__36408,map__36408__$1,mission,side,vec__36405,attrs,_))
,weathergen.falcon.files.mission.teams.call(null,mission__$1))));
return cljs.core.disj.call(null,side_teams,side__$1);
});})(map__36408,map__36408__$1,mission,side,vec__36405,attrs,_))
).call(null,mission,side);
return hoplon.core.div.call(null,cljs.core.dissoc.call(null,attrs,new cljs.core.Keyword(null,"mission","mission",1740288522),new cljs.core.Keyword(null,"side","side",389652279)),hoplon.core.loop_tpl_STAR_.call(null,javelin.core.formula.call(null,((function (map__36408,map__36408__$1,mission,side,allies,vec__36405,attrs,_){
return (function (mission__$1,side__$1,allies__$1){
return cljs.core.interpose.call(null,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"color","color",1011675173),"",new cljs.core.Keyword(null,"name","name",1843675177),"/"], null),(function (){var iter__24200__auto__ = ((function (map__36408,map__36408__$1,mission,side,allies,vec__36405,attrs,_){
return (function weathergen$ui$common$side_label_$_iter__36410(s__36411){
return (new cljs.core.LazySeq(null,((function (map__36408,map__36408__$1,mission,side,allies,vec__36405,attrs,_){
return (function (){
var s__36411__$1 = s__36411;
while(true){
var temp__5278__auto__ = cljs.core.seq.call(null,s__36411__$1);
if(temp__5278__auto__){
var s__36411__$2 = temp__5278__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__36411__$2)){
var c__24198__auto__ = cljs.core.chunk_first.call(null,s__36411__$2);
var size__24199__auto__ = cljs.core.count.call(null,c__24198__auto__);
var b__36413 = cljs.core.chunk_buffer.call(null,size__24199__auto__);
if((function (){var i__36412 = (0);
while(true){
if((i__36412 < size__24199__auto__)){
var team = cljs.core._nth.call(null,c__24198__auto__,i__36412);
cljs.core.chunk_append.call(null,b__36413,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"color","color",1011675173),weathergen.ui.common.team_color.call(null,team,new cljs.core.Keyword(null,"dark-text","dark-text",814777253)),new cljs.core.Keyword(null,"name","name",1843675177),weathergen.falcon.files.mission.team_name.call(null,mission__$1,team)], null));

var G__36427 = (i__36412 + (1));
i__36412 = G__36427;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__36413),weathergen$ui$common$side_label_$_iter__36410.call(null,cljs.core.chunk_rest.call(null,s__36411__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__36413),null);
}
} else {
var team = cljs.core.first.call(null,s__36411__$2);
return cljs.core.cons.call(null,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"color","color",1011675173),weathergen.ui.common.team_color.call(null,team,new cljs.core.Keyword(null,"dark-text","dark-text",814777253)),new cljs.core.Keyword(null,"name","name",1843675177),weathergen.falcon.files.mission.team_name.call(null,mission__$1,team)], null),weathergen$ui$common$side_label_$_iter__36410.call(null,cljs.core.rest.call(null,s__36411__$2)));
}
} else {
return null;
}
break;
}
});})(map__36408,map__36408__$1,mission,side,allies,vec__36405,attrs,_))
,null,null));
});})(map__36408,map__36408__$1,mission,side,allies,vec__36405,attrs,_))
;
return iter__24200__auto__.call(null,cljs.core.into.call(null,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [side__$1], null),allies__$1));
})());
});})(map__36408,map__36408__$1,mission,side,allies,vec__36405,attrs,_))
).call(null,mission,side,allies),((function (map__36408,map__36408__$1,mission,side,allies,vec__36405,attrs,_){
return (function (item__29820__auto__){
var vec__36414 = javelin.core.cell_map.call(null,cljs.core.identity,javelin.core.formula.call(null,((function (map__36408,map__36408__$1,mission,side,allies,vec__36405,attrs,_){
return (function (elem){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [elem], null);
});})(map__36408,map__36408__$1,mission,side,allies,vec__36405,attrs,_))
).call(null,item__29820__auto__));
var elem = cljs.core.nth.call(null,vec__36414,(0),null);
var vec__36419 = javelin.core.cell_map.call(null,cljs.core.identity,javelin.core.formula.call(null,((function (vec__36414,elem,map__36408,map__36408__$1,mission,side,allies,vec__36405,attrs,_){
return (function (p__36422){
var map__36423 = p__36422;
var map__36423__$1 = ((((!((map__36423 == null)))?((((map__36423.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36423.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36423):map__36423);
var color = cljs.core.get.call(null,map__36423__$1,new cljs.core.Keyword(null,"color","color",1011675173));
var name = cljs.core.get.call(null,map__36423__$1,new cljs.core.Keyword(null,"name","name",1843675177));
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [color,name], null);
});})(vec__36414,elem,map__36408,map__36408__$1,mission,side,allies,vec__36405,attrs,_))
).call(null,elem));
var color = cljs.core.nth.call(null,vec__36419,(0),null);
var name = cljs.core.nth.call(null,vec__36419,(1),null);
return hoplon.core.span.call(null,new cljs.core.Keyword(null,"css","css",1135045163),javelin.core.formula.call(null,((function (vec__36419,color,name,vec__36414,elem,map__36408,map__36408__$1,mission,side,allies,vec__36405,attrs,_){
return (function (G__36425){
return new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"color","color",1011675173),G__36425], null);
});})(vec__36419,color,name,vec__36414,elem,map__36408,map__36408__$1,mission,side,allies,vec__36405,attrs,_))
).call(null,color),javelin.core.formula.call(null,((function (vec__36419,color,name,vec__36414,elem,map__36408,map__36408__$1,mission,side,allies,vec__36405,attrs,_){
return (function (G__36426){
return G__36426;
});})(vec__36419,color,name,vec__36414,elem,map__36408,map__36408__$1,mission,side,allies,vec__36405,attrs,_))
).call(null,name));
});})(map__36408,map__36408__$1,mission,side,allies,vec__36405,attrs,_))
));
};
var weathergen$ui$common$side_label = function (var_args){
var args__29776__auto__ = null;
if (arguments.length > 0) {
var G__36428__i = 0, G__36428__a = new Array(arguments.length -  0);
while (G__36428__i < G__36428__a.length) {G__36428__a[G__36428__i] = arguments[G__36428__i + 0]; ++G__36428__i;}
  args__29776__auto__ = new cljs.core.IndexedSeq(G__36428__a,0,null);
} 
return weathergen$ui$common$side_label__delegate.call(this,args__29776__auto__);};
weathergen$ui$common$side_label.cljs$lang$maxFixedArity = 0;
weathergen$ui$common$side_label.cljs$lang$applyTo = (function (arglist__36429){
var args__29776__auto__ = cljs.core.seq(arglist__36429);
return weathergen$ui$common$side_label__delegate(args__29776__auto__);
});
weathergen$ui$common$side_label.cljs$core$IFn$_invoke$arity$variadic = weathergen$ui$common$side_label__delegate;
return weathergen$ui$common$side_label;
})()
;
/**
 * Returns a path to where we should cache an image.
 */
weathergen.ui.common.image_cache_path = (function weathergen$ui$common$image_cache_path(image_descriptor){
return weathergen.filesystem.path_combine.call(null,weathergen.settings.app_dir,"cache","images",[cljs.core.str.cljs$core$IFn$_invoke$arity$1(weathergen.falcon.files.images.cache_key.call(null,image_descriptor)),cljs.core.str.cljs$core$IFn$_invoke$arity$1(".png")].join(''));
});
/**
 * Asynchronously saves `blob` to `path`.
 */
weathergen.ui.common.save_blob_async = (function weathergen$ui$common$save_blob_async(blob,path){
var reader = (new FileReader());
reader.onload = ((function (reader){
return (function (){
return weathergen.filesystem.save_data.call(null,path,(new Buffer(reader.result)));
});})(reader))
;

return reader.readAsArrayBuffer(blob);
});
/**
 * Return a URL for the image identified by `image-descriptor`.
 */
weathergen.ui.common.get_image = (function weathergen$ui$common$get_image(mission,image_descriptor){
var path = weathergen.ui.common.image_cache_path.call(null,image_descriptor);
if(cljs.core.truth_(weathergen.filesystem.exists_QMARK_.call(null,path))){
return path;
} else {
var canvas = document.createElement("canvas");
var timer_name__15521__auto___36430 = [cljs.core.str.cljs$core$IFn$_invoke$arity$1("Loading image "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"image-id","image-id",-988480565).cljs$core$IFn$_invoke$arity$1(image_descriptor))].join('');
var ignore__15522__auto___36431 = console.time(timer_name__15521__auto___36430);
var result__15523__auto___36432 = weathergen.falcon.files.images.read_image.call(null,mission,image_descriptor,((function (timer_name__15521__auto___36430,ignore__15522__auto___36431,canvas,path){
return (function (width,height){
canvas.width = width;

canvas.height = height;

var context = canvas.getContext("2d");
var image_data = context.getImageData((0),(0),width,height);
var buf = (new ArrayBuffer(image_data.data.length));
var buf8 = (new Uint8ClampedArray(buf));
var data = (new Uint32Array(buf));
return new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"set-pixel!","set-pixel!",1287500897),((function (context,image_data,buf,buf8,data,timer_name__15521__auto___36430,ignore__15522__auto___36431,canvas,path){
return (function (x,y,argb){
return (data[(x + (y * width))] = argb);
});})(context,image_data,buf,buf8,data,timer_name__15521__auto___36430,ignore__15522__auto___36431,canvas,path))
,new cljs.core.Keyword(null,"finalize","finalize",-1152897571),((function (context,image_data,buf,buf8,data,timer_name__15521__auto___36430,ignore__15522__auto___36431,canvas,path){
return (function (){
image_data.data.set(buf8);

return context.putImageData(image_data,(0),(0));
});})(context,image_data,buf,buf8,data,timer_name__15521__auto___36430,ignore__15522__auto___36431,canvas,path))
], null);
});})(timer_name__15521__auto___36430,ignore__15522__auto___36431,canvas,path))
);
console.timeEnd(timer_name__15521__auto___36430);


canvas.toBlob(((function (canvas,path){
return (function (blob){
return weathergen.ui.common.save_blob_async.call(null,blob,path);
});})(canvas,path))
);

return canvas.toDataURL();
}
});
/**
 * Draws a grid of flags and checkboxes to pick teams.
 * @param {...*} var_args
 */
weathergen.ui.common.team_selector = (function() { 
var weathergen$ui$common$team_selector__delegate = function (args__29776__auto__){
var vec__36456 = hoplon.core.parse_args.call(null,args__29776__auto__);
var attrs = cljs.core.nth.call(null,vec__36456,(0),null);
var _ = cljs.core.nth.call(null,vec__36456,(1),null);
var map__36459 = attrs;
var map__36459__$1 = ((((!((map__36459 == null)))?((((map__36459.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36459.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36459):map__36459);
var selectable_teams = cljs.core.get.call(null,map__36459__$1,new cljs.core.Keyword(null,"selectable-teams","selectable-teams",1104557919));
var mission = cljs.core.get.call(null,map__36459__$1,new cljs.core.Keyword(null,"mission","mission",1740288522));
var selected_teams = cljs.core.get.call(null,map__36459__$1,new cljs.core.Keyword(null,"selected-teams","selected-teams",317107671));
var attrs__$1 = cljs.core.dissoc.call(null,attrs,new cljs.core.Keyword(null,"mission","mission",1740288522),new cljs.core.Keyword(null,"selected-teams","selected-teams",317107671),new cljs.core.Keyword(null,"selectable-teams","selectable-teams",1104557919));
return hoplon.core.div.call(null,new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"margin-bottom","margin-bottom",388334941),"5px"], null),attrs__$1,hoplon.core.loop_tpl_STAR_.call(null,javelin.core.formula.call(null,((function (map__36459,map__36459__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36456,attrs,_){
return (function (G__36461,G__36462){
return G__36461.call(null,G__36462);
});})(map__36459,map__36459__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36456,attrs,_))
).call(null,weathergen.falcon.files.mission.teams,mission),((function (map__36459,map__36459__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36456,attrs,_){
return (function (item__29820__auto__){
var vec__36463 = javelin.core.cell_map.call(null,cljs.core.identity,javelin.core.formula.call(null,((function (map__36459,map__36459__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36456,attrs,_){
return (function (team){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [team], null);
});})(map__36459,map__36459__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36456,attrs,_))
).call(null,item__29820__auto__));
var team = cljs.core.nth.call(null,vec__36463,(0),null);
return weathergen.ui.common.inl.call(null,new cljs.core.Keyword(null,"css","css",1135045163),javelin.core.formula.call(null,((function (vec__36463,team,map__36459,map__36459__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36456,attrs,_){
return (function (team__$1){
return new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"margin-right","margin-right",809689658),"3px",new cljs.core.Keyword(null,"padding","padding",1660304693),"3px",new cljs.core.Keyword(null,"border","border",1444987323),[cljs.core.str.cljs$core$IFn$_invoke$arity$1("2px solid "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(weathergen.ui.common.team_color.call(null,team__$1,new cljs.core.Keyword(null,"dark-text","dark-text",814777253)))].join(''),new cljs.core.Keyword(null,"text-align","text-align",1786091845),"center",new cljs.core.Keyword(null,"vertical-align","vertical-align",651007333),"top"], null);
});})(vec__36463,team,map__36459,map__36459__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36456,attrs,_))
).call(null,team),hoplon.core.img.call(null,new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"border","border",1444987323),"solid 1px black"], null),new cljs.core.Keyword(null,"src","src",-1651076051),javelin.core.formula.call(null,((function (vec__36463,team,map__36459,map__36459__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36456,attrs,_){
return (function (mission__$1,team__$1){
return weathergen.ui.common.get_image.call(null,mission__$1,weathergen.falcon.files.mission.team_flag.call(null,mission__$1,team__$1,new cljs.core.Keyword(null,"big-vert","big-vert",-1944398663)));
});})(vec__36463,team,map__36459,map__36459__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36456,attrs,_))
).call(null,mission,team)),hoplon.core.div.call(null,new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"text-align","text-align",1786091845),"center"], null),hoplon.core.span.call(null,new cljs.core.Keyword(null,"css","css",1135045163),javelin.core.formula.call(null,((function (vec__36463,team,map__36459,map__36459__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36456,attrs,_){
return (function (G__36467,G__36466){
return new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"color","color",1011675173),G__36466.call(null,G__36467,new cljs.core.Keyword(null,"dark-text","dark-text",814777253))], null);
});})(vec__36463,team,map__36459,map__36459__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36456,attrs,_))
).call(null,team,weathergen.ui.common.team_color),javelin.core.formula.call(null,((function (vec__36463,team,map__36459,map__36459__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36456,attrs,_){
return (function (G__36468,G__36469,G__36470){
return G__36468.call(null,G__36469,new cljs.core.Keyword(null,"who","who",-235935040).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"team","team",1355747699).cljs$core$IFn$_invoke$arity$1(G__36470)));
});})(vec__36463,team,map__36459,map__36459__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36456,attrs,_))
).call(null,weathergen.falcon.files.mission.team_name,mission,team))),hoplon.core.div.call(null,new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"text-align","text-align",1786091845),"center",new cljs.core.Keyword(null,"height","height",1025178622),"33px"], null),(function (){var val = javelin.core.formula.call(null,((function (vec__36463,team,map__36459,map__36459__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36456,attrs,_){
return (function (G__36471,G__36473,G__36474,G__36472){
return G__36471.call(null,G__36472,G__36473.call(null,G__36474));
});})(vec__36463,team,map__36459,map__36459__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36456,attrs,_))
).call(null,cljs.core.contains_QMARK_,weathergen.falcon.files.mission.team_number,team,selected_teams);
var enabled_QMARK_ = javelin.core.formula.call(null,((function (val,vec__36463,team,map__36459,map__36459__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36456,attrs,_){
return (function (G__36475,G__36476,G__36477,G__36478){
return G__36475.call(null,G__36476,G__36477.call(null,G__36478));
});})(val,vec__36463,team,map__36459,map__36459__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36456,attrs,_))
).call(null,cljs.core.contains_QMARK_,selectable_teams,weathergen.falcon.files.mission.team_number,team);
return hoplon.core.input.call(null,new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"margin","margin",-995903681),"auto"], null),new cljs.core.Keyword(null,"type","type",1174270348),"checkbox",new cljs.core.Keyword(null,"toggle","toggle",1291842030),enabled_QMARK_,new cljs.core.Keyword(null,"value","value",305978217),val,new cljs.core.Keyword(null,"change","change",-1163046502),((function (val,enabled_QMARK_,vec__36463,team,map__36459,map__36459__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36456,attrs,_){
return (function (){
return cljs.core.swap_BANG_.call(null,selected_teams,cljs.core.comp.call(null,cljs.core.set,(cljs.core.truth_(cljs.core.deref.call(null,val))?cljs.core.disj:cljs.core.conj)),weathergen.falcon.files.mission.team_number.call(null,cljs.core.deref.call(null,team)));
});})(val,enabled_QMARK_,vec__36463,team,map__36459,map__36459__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36456,attrs,_))
);
})()));
});})(map__36459,map__36459__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36456,attrs,_))
));
};
var weathergen$ui$common$team_selector = function (var_args){
var args__29776__auto__ = null;
if (arguments.length > 0) {
var G__36479__i = 0, G__36479__a = new Array(arguments.length -  0);
while (G__36479__i < G__36479__a.length) {G__36479__a[G__36479__i] = arguments[G__36479__i + 0]; ++G__36479__i;}
  args__29776__auto__ = new cljs.core.IndexedSeq(G__36479__a,0,null);
} 
return weathergen$ui$common$team_selector__delegate.call(this,args__29776__auto__);};
weathergen$ui$common$team_selector.cljs$lang$maxFixedArity = 0;
weathergen$ui$common$team_selector.cljs$lang$applyTo = (function (arglist__36480){
var args__29776__auto__ = cljs.core.seq(arglist__36480);
return weathergen$ui$common$team_selector__delegate(args__29776__auto__);
});
weathergen$ui$common$team_selector.cljs$core$IFn$_invoke$arity$variadic = weathergen$ui$common$team_selector__delegate;
return weathergen$ui$common$team_selector;
})()
;
/**
 * Draws a grid of flags and checkboxes to pick sides.
 * @param {...*} var_args
 */
weathergen.ui.common.side_selector = (function() { 
var weathergen$ui$common$side_selector__delegate = function (args__29776__auto__){
var vec__36501 = hoplon.core.parse_args.call(null,args__29776__auto__);
var attrs = cljs.core.nth.call(null,vec__36501,(0),null);
var _ = cljs.core.nth.call(null,vec__36501,(1),null);
var map__36504 = attrs;
var map__36504__$1 = ((((!((map__36504 == null)))?((((map__36504.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36504.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36504):map__36504);
var selected_sides = cljs.core.get.call(null,map__36504__$1,new cljs.core.Keyword(null,"selected-sides","selected-sides",-922979619));
var mission = cljs.core.get.call(null,map__36504__$1,new cljs.core.Keyword(null,"mission","mission",1740288522));
var attrs__$1 = cljs.core.dissoc.call(null,attrs,new cljs.core.Keyword(null,"mission","mission",1740288522),new cljs.core.Keyword(null,"selected-sides","selected-sides",-922979619));
return hoplon.core.div.call(null,new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"margin-bottom","margin-bottom",388334941),"5px"], null),attrs__$1,hoplon.core.loop_tpl_STAR_.call(null,javelin.core.formula.call(null,((function (map__36504,map__36504__$1,selected_sides,mission,attrs__$1,vec__36501,attrs,_){
return (function (G__36507,G__36506){
return G__36506.call(null,G__36507);
});})(map__36504,map__36504__$1,selected_sides,mission,attrs__$1,vec__36501,attrs,_))
).call(null,mission,weathergen.falcon.files.mission.sides),((function (map__36504,map__36504__$1,selected_sides,mission,attrs__$1,vec__36501,attrs,_){
return (function (item__29820__auto__){
var vec__36508 = javelin.core.cell_map.call(null,cljs.core.identity,javelin.core.formula.call(null,((function (map__36504,map__36504__$1,selected_sides,mission,attrs__$1,vec__36501,attrs,_){
return (function (side){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [side], null);
});})(map__36504,map__36504__$1,selected_sides,mission,attrs__$1,vec__36501,attrs,_))
).call(null,item__29820__auto__));
var side = cljs.core.nth.call(null,vec__36508,(0),null);
return weathergen.ui.common.inl.call(null,new cljs.core.Keyword(null,"css","css",1135045163),javelin.core.formula.call(null,((function (vec__36508,side,map__36504,map__36504__$1,selected_sides,mission,attrs__$1,vec__36501,attrs,_){
return (function (side__$1){
return new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"margin-right","margin-right",809689658),"3px",new cljs.core.Keyword(null,"padding","padding",1660304693),"3px",new cljs.core.Keyword(null,"border","border",1444987323),[cljs.core.str.cljs$core$IFn$_invoke$arity$1("2px solid "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(weathergen.ui.common.team_color.call(null,side__$1,new cljs.core.Keyword(null,"dark-text","dark-text",814777253)))].join(''),new cljs.core.Keyword(null,"text-align","text-align",1786091845),"center"], null);
});})(vec__36508,side,map__36504,map__36504__$1,selected_sides,mission,attrs__$1,vec__36501,attrs,_))
).call(null,side),hoplon.core.loop_tpl_STAR_.call(null,javelin.core.formula.call(null,((function (vec__36508,side,map__36504,map__36504__$1,selected_sides,mission,attrs__$1,vec__36501,attrs,_){
return (function (G__36512,G__36511,G__36513){
return G__36511.call(null,G__36512,G__36513);
});})(vec__36508,side,map__36504,map__36504__$1,selected_sides,mission,attrs__$1,vec__36501,attrs,_))
).call(null,mission,weathergen.falcon.files.mission.teams_for_side,side),((function (vec__36508,side,map__36504,map__36504__$1,selected_sides,mission,attrs__$1,vec__36501,attrs,_){
return (function (item__29820__auto____$1){
var vec__36514 = javelin.core.cell_map.call(null,cljs.core.identity,javelin.core.formula.call(null,((function (vec__36508,side,map__36504,map__36504__$1,selected_sides,mission,attrs__$1,vec__36501,attrs,_){
return (function (team){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [team], null);
});})(vec__36508,side,map__36504,map__36504__$1,selected_sides,mission,attrs__$1,vec__36501,attrs,_))
).call(null,item__29820__auto____$1));
var team = cljs.core.nth.call(null,vec__36514,(0),null);
return hoplon.core.img.call(null,new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"border","border",1444987323),"solid 1px black",new cljs.core.Keyword(null,"padding-right","padding-right",-1250249681),"2px"], null),new cljs.core.Keyword(null,"src","src",-1651076051),javelin.core.formula.call(null,((function (vec__36514,team,vec__36508,side,map__36504,map__36504__$1,selected_sides,mission,attrs__$1,vec__36501,attrs,_){
return (function (mission__$1,team__$1){
return weathergen.ui.common.get_image.call(null,mission__$1,weathergen.falcon.files.mission.team_flag.call(null,mission__$1,team__$1,new cljs.core.Keyword(null,"big-vert","big-vert",-1944398663)));
});})(vec__36514,team,vec__36508,side,map__36504,map__36504__$1,selected_sides,mission,attrs__$1,vec__36501,attrs,_))
).call(null,mission,team));
});})(vec__36508,side,map__36504,map__36504__$1,selected_sides,mission,attrs__$1,vec__36501,attrs,_))
),hoplon.core.div.call(null,new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"text-align","text-align",1786091845),"center"], null),weathergen.ui.common.side_label.call(null,new cljs.core.Keyword(null,"mission","mission",1740288522),mission,new cljs.core.Keyword(null,"side","side",389652279),side)),hoplon.core.div.call(null,new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"text-align","text-align",1786091845),"center"], null),(function (){var val = javelin.core.formula.call(null,((function (vec__36508,side,map__36504,map__36504__$1,selected_sides,mission,attrs__$1,vec__36501,attrs,_){
return (function (G__36517,G__36518,G__36519,G__36520){
return G__36517.call(null,G__36518,G__36519.call(null,G__36520));
});})(vec__36508,side,map__36504,map__36504__$1,selected_sides,mission,attrs__$1,vec__36501,attrs,_))
).call(null,cljs.core.contains_QMARK_,selected_sides,weathergen.falcon.files.mission.team_number,side);
return hoplon.core.input.call(null,new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"margin","margin",-995903681),"auto"], null),new cljs.core.Keyword(null,"type","type",1174270348),"checkbox",new cljs.core.Keyword(null,"value","value",305978217),val,new cljs.core.Keyword(null,"change","change",-1163046502),((function (val,vec__36508,side,map__36504,map__36504__$1,selected_sides,mission,attrs__$1,vec__36501,attrs,_){
return (function (){
return cljs.core.swap_BANG_.call(null,selected_sides,cljs.core.comp.call(null,cljs.core.set,(cljs.core.truth_(cljs.core.deref.call(null,val))?cljs.core.disj:cljs.core.conj)),weathergen.falcon.files.mission.team_number.call(null,cljs.core.deref.call(null,side)));
});})(val,vec__36508,side,map__36504,map__36504__$1,selected_sides,mission,attrs__$1,vec__36501,attrs,_))
);
})()));
});})(map__36504,map__36504__$1,selected_sides,mission,attrs__$1,vec__36501,attrs,_))
));
};
var weathergen$ui$common$side_selector = function (var_args){
var args__29776__auto__ = null;
if (arguments.length > 0) {
var G__36521__i = 0, G__36521__a = new Array(arguments.length -  0);
while (G__36521__i < G__36521__a.length) {G__36521__a[G__36521__i] = arguments[G__36521__i + 0]; ++G__36521__i;}
  args__29776__auto__ = new cljs.core.IndexedSeq(G__36521__a,0,null);
} 
return weathergen$ui$common$side_selector__delegate.call(this,args__29776__auto__);};
weathergen$ui$common$side_selector.cljs$lang$maxFixedArity = 0;
weathergen$ui$common$side_selector.cljs$lang$applyTo = (function (arglist__36522){
var args__29776__auto__ = cljs.core.seq(arglist__36522);
return weathergen$ui$common$side_selector__delegate(args__29776__auto__);
});
weathergen$ui$common$side_selector.cljs$core$IFn$_invoke$arity$variadic = weathergen$ui$common$side_selector__delegate;
return weathergen$ui$common$side_selector;
})()
;
/**
 * Renders an HTML select. Attrs include :value, a cell or lens
 *   containing the current choice, which will be updated when the choice
 *   changes, and :choices, a vector of maps containing :value and :label
 *   keys.
 * @param {...*} var_args
 */
weathergen.ui.common.dropdown = (function() { 
var weathergen$ui$common$dropdown__delegate = function (args__29776__auto__){
var vec__36557 = hoplon.core.parse_args.call(null,args__29776__auto__);
var attrs = cljs.core.nth.call(null,vec__36557,(0),null);
var _ = cljs.core.nth.call(null,vec__36557,(1),null);
var map__36560 = attrs;
var map__36560__$1 = ((((!((map__36560 == null)))?((((map__36560.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36560.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36560):map__36560);
var value = cljs.core.get.call(null,map__36560__$1,new cljs.core.Keyword(null,"value","value",305978217));
var choices = cljs.core.get.call(null,map__36560__$1,new cljs.core.Keyword(null,"choices","choices",1385611597));
var attrs__$1 = cljs.core.dissoc.call(null,attrs,new cljs.core.Keyword(null,"value","value",305978217),new cljs.core.Keyword(null,"choices","choices",1385611597));
var indexed = cljs.core.map_indexed.call(null,((function (map__36560,map__36560__$1,value,choices,attrs__$1,vec__36557,attrs,_){
return (function (i,c){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [[cljs.core.str.cljs$core$IFn$_invoke$arity$1(i)].join(''),cljs.core.assoc.call(null,c,new cljs.core.Keyword("weathergen.ui.common","index","weathergen.ui.common/index",-813327910),[cljs.core.str.cljs$core$IFn$_invoke$arity$1(i)].join(''))], null);
});})(map__36560,map__36560__$1,value,choices,attrs__$1,vec__36557,attrs,_))
,choices);
var by_index = cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,indexed);
var s = hoplon.core.select.call(null);
s.call(null,cljs.core.assoc.call(null,attrs__$1,new cljs.core.Keyword(null,"value","value",305978217),javelin.core.formula.call(null,((function (s,indexed,by_index,map__36560,map__36560__$1,value,choices,attrs__$1,vec__36557,attrs,_){
return (function (value__$1){
return new cljs.core.Keyword("weathergen.ui.common","index","weathergen.ui.common/index",-813327910).cljs$core$IFn$_invoke$arity$1(cljs.core.first.call(null,cljs.core.filter.call(null,((function (s,indexed,by_index,map__36560,map__36560__$1,value,choices,attrs__$1,vec__36557,attrs,_){
return (function (p1__36523_SHARP_){
return cljs.core._EQ_.call(null,value__$1,new cljs.core.Keyword(null,"value","value",305978217).cljs$core$IFn$_invoke$arity$1(p1__36523_SHARP_));
});})(s,indexed,by_index,map__36560,map__36560__$1,value,choices,attrs__$1,vec__36557,attrs,_))
,cljs.core.vals.call(null,indexed))));
});})(s,indexed,by_index,map__36560,map__36560__$1,value,choices,attrs__$1,vec__36557,attrs,_))
).call(null,value),new cljs.core.Keyword(null,"change","change",-1163046502),((function (s,indexed,by_index,map__36560,map__36560__$1,value,choices,attrs__$1,vec__36557,attrs,_){
return (function (v){
return cljs.core.reset_BANG_.call(null,value,new cljs.core.Keyword(null,"value","value",305978217).cljs$core$IFn$_invoke$arity$1(by_index.call(null,cljs.core.deref.call(null,v))));
});})(s,indexed,by_index,map__36560,map__36560__$1,value,choices,attrs__$1,vec__36557,attrs,_))
),(function (){var iter__24200__auto__ = ((function (s,indexed,by_index,map__36560,map__36560__$1,value,choices,attrs__$1,vec__36557,attrs,_){
return (function weathergen$ui$common$dropdown_$_iter__36562(s__36563){
return (new cljs.core.LazySeq(null,((function (s,indexed,by_index,map__36560,map__36560__$1,value,choices,attrs__$1,vec__36557,attrs,_){
return (function (){
var s__36563__$1 = s__36563;
while(true){
var temp__5278__auto__ = cljs.core.seq.call(null,s__36563__$1);
if(temp__5278__auto__){
var s__36563__$2 = temp__5278__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__36563__$2)){
var c__24198__auto__ = cljs.core.chunk_first.call(null,s__36563__$2);
var size__24199__auto__ = cljs.core.count.call(null,c__24198__auto__);
var b__36565 = cljs.core.chunk_buffer.call(null,size__24199__auto__);
if((function (){var i__36564 = (0);
while(true){
if((i__36564 < size__24199__auto__)){
var vec__36578 = cljs.core._nth.call(null,c__24198__auto__,i__36564);
var index = cljs.core.nth.call(null,vec__36578,(0),null);
var choice = cljs.core.nth.call(null,vec__36578,(1),null);
cljs.core.chunk_append.call(null,b__36565,hoplon.core.option.call(null,new cljs.core.Keyword(null,"value","value",305978217),index,new cljs.core.Keyword(null,"selected","selected",574897764),javelin.core.formula.call(null,((function (i__36564,vec__36578,index,choice,c__24198__auto__,size__24199__auto__,b__36565,s__36563__$2,temp__5278__auto__,s,indexed,by_index,map__36560,map__36560__$1,value,choices,attrs__$1,vec__36557,attrs,_){
return (function (G__36583,G__36581,G__36582){
return G__36581.call(null,G__36582,new cljs.core.Keyword(null,"value","value",305978217).cljs$core$IFn$_invoke$arity$1(G__36583));
});})(i__36564,vec__36578,index,choice,c__24198__auto__,size__24199__auto__,b__36565,s__36563__$2,temp__5278__auto__,s,indexed,by_index,map__36560,map__36560__$1,value,choices,attrs__$1,vec__36557,attrs,_))
).call(null,choice,cljs.core._EQ_,value),new cljs.core.Keyword(null,"label","label",1718410804).cljs$core$IFn$_invoke$arity$1(choice)));

var G__36590 = (i__36564 + (1));
i__36564 = G__36590;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__36565),weathergen$ui$common$dropdown_$_iter__36562.call(null,cljs.core.chunk_rest.call(null,s__36563__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__36565),null);
}
} else {
var vec__36584 = cljs.core.first.call(null,s__36563__$2);
var index = cljs.core.nth.call(null,vec__36584,(0),null);
var choice = cljs.core.nth.call(null,vec__36584,(1),null);
return cljs.core.cons.call(null,hoplon.core.option.call(null,new cljs.core.Keyword(null,"value","value",305978217),index,new cljs.core.Keyword(null,"selected","selected",574897764),javelin.core.formula.call(null,((function (vec__36584,index,choice,s__36563__$2,temp__5278__auto__,s,indexed,by_index,map__36560,map__36560__$1,value,choices,attrs__$1,vec__36557,attrs,_){
return (function (G__36589,G__36587,G__36588){
return G__36587.call(null,G__36588,new cljs.core.Keyword(null,"value","value",305978217).cljs$core$IFn$_invoke$arity$1(G__36589));
});})(vec__36584,index,choice,s__36563__$2,temp__5278__auto__,s,indexed,by_index,map__36560,map__36560__$1,value,choices,attrs__$1,vec__36557,attrs,_))
).call(null,choice,cljs.core._EQ_,value),new cljs.core.Keyword(null,"label","label",1718410804).cljs$core$IFn$_invoke$arity$1(choice)),weathergen$ui$common$dropdown_$_iter__36562.call(null,cljs.core.rest.call(null,s__36563__$2)));
}
} else {
return null;
}
break;
}
});})(s,indexed,by_index,map__36560,map__36560__$1,value,choices,attrs__$1,vec__36557,attrs,_))
,null,null));
});})(s,indexed,by_index,map__36560,map__36560__$1,value,choices,attrs__$1,vec__36557,attrs,_))
;
return iter__24200__auto__.call(null,indexed);
})());

return s;
};
var weathergen$ui$common$dropdown = function (var_args){
var args__29776__auto__ = null;
if (arguments.length > 0) {
var G__36591__i = 0, G__36591__a = new Array(arguments.length -  0);
while (G__36591__i < G__36591__a.length) {G__36591__a[G__36591__i] = arguments[G__36591__i + 0]; ++G__36591__i;}
  args__29776__auto__ = new cljs.core.IndexedSeq(G__36591__a,0,null);
} 
return weathergen$ui$common$dropdown__delegate.call(this,args__29776__auto__);};
weathergen$ui$common$dropdown.cljs$lang$maxFixedArity = 0;
weathergen$ui$common$dropdown.cljs$lang$applyTo = (function (arglist__36592){
var args__29776__auto__ = cljs.core.seq(arglist__36592);
return weathergen$ui$common$dropdown__delegate(args__29776__auto__);
});
weathergen$ui$common$dropdown.cljs$core$IFn$_invoke$arity$variadic = weathergen$ui$common$dropdown__delegate;
return weathergen$ui$common$dropdown;
})()
;
/**
 * Renders a group of HTML radio buttons. Attrs include :value, a cell
 *   or lens containing the current choice, which will be updated when
 *   the choice changes, and :choices, a vector of maps containing :value
 *   and :label keys.
 * @param {...*} var_args
 */
weathergen.ui.common.radio_group = (function() { 
var weathergen$ui$common$radio_group__delegate = function (args__29776__auto__){
var vec__36615 = hoplon.core.parse_args.call(null,args__29776__auto__);
var attrs = cljs.core.nth.call(null,vec__36615,(0),null);
var _ = cljs.core.nth.call(null,vec__36615,(1),null);
var map__36618 = attrs;
var map__36618__$1 = ((((!((map__36618 == null)))?((((map__36618.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36618.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36618):map__36618);
var value = cljs.core.get.call(null,map__36618__$1,new cljs.core.Keyword(null,"value","value",305978217));
var choices = cljs.core.get.call(null,map__36618__$1,new cljs.core.Keyword(null,"choices","choices",1385611597));
var attrs__$1 = cljs.core.dissoc.call(null,attrs,new cljs.core.Keyword(null,"value","value",305978217),new cljs.core.Keyword(null,"choices","choices",1385611597));
var choices_STAR_ = (cljs.core.truth_(javelin.core.cell_QMARK_.call(null,choices))?choices:javelin.core.cell.call(null,choices));
var indexed = javelin.core.formula.call(null,((function (choices_STAR_,map__36618,map__36618__$1,value,choices,attrs__$1,vec__36615,attrs,_){
return (function (choices_STAR___$1){
return cljs.core.map_indexed.call(null,((function (choices_STAR_,map__36618,map__36618__$1,value,choices,attrs__$1,vec__36615,attrs,_){
return (function (i,c){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [[cljs.core.str.cljs$core$IFn$_invoke$arity$1(i)].join(''),cljs.core.assoc.call(null,c,new cljs.core.Keyword("weathergen.ui.common","index","weathergen.ui.common/index",-813327910),[cljs.core.str.cljs$core$IFn$_invoke$arity$1(i)].join(''))], null);
});})(choices_STAR_,map__36618,map__36618__$1,value,choices,attrs__$1,vec__36615,attrs,_))
,choices_STAR___$1);
});})(choices_STAR_,map__36618,map__36618__$1,value,choices,attrs__$1,vec__36615,attrs,_))
).call(null,choices_STAR_);
var by_index = javelin.core.formula.call(null,((function (choices_STAR_,indexed,map__36618,map__36618__$1,value,choices,attrs__$1,vec__36615,attrs,_){
return (function (indexed__$1){
return cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,indexed__$1);
});})(choices_STAR_,indexed,map__36618,map__36618__$1,value,choices,attrs__$1,vec__36615,attrs,_))
).call(null,indexed);
var name = [cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.gensym)].join('');
return hoplon.core.div.call(null,hoplon.core.loop_tpl_STAR_.call(null,indexed,((function (choices_STAR_,indexed,by_index,name,map__36618,map__36618__$1,value,choices,attrs__$1,vec__36615,attrs,_){
return (function (item__29820__auto__){
var vec__36620 = javelin.core.cell_map.call(null,cljs.core.identity,javelin.core.formula.call(null,((function (choices_STAR_,indexed,by_index,name,map__36618,map__36618__$1,value,choices,attrs__$1,vec__36615,attrs,_){
return (function (item){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [item], null);
});})(choices_STAR_,indexed,by_index,name,map__36618,map__36618__$1,value,choices,attrs__$1,vec__36615,attrs,_))
).call(null,item__29820__auto__));
var item = cljs.core.nth.call(null,vec__36620,(0),null);
var vec__36629 = javelin.core.cell_map.call(null,cljs.core.identity,javelin.core.formula.call(null,((function (vec__36620,item,choices_STAR_,indexed,by_index,name,map__36618,map__36618__$1,value,choices,attrs__$1,vec__36615,attrs,_){
return (function (p__36632){
var vec__36633 = p__36632;
var index = cljs.core.nth.call(null,vec__36633,(0),null);
var choice = cljs.core.nth.call(null,vec__36633,(1),null);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [choice,index], null);
});})(vec__36620,item,choices_STAR_,indexed,by_index,name,map__36618,map__36618__$1,value,choices,attrs__$1,vec__36615,attrs,_))
).call(null,item));
var choice = cljs.core.nth.call(null,vec__36629,(0),null);
var index = cljs.core.nth.call(null,vec__36629,(1),null);
var id = [cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.gensym.call(null))].join('');
return hoplon.core.div.call(null,hoplon.core.input.call(null,new cljs.core.Keyword(null,"type","type",1174270348),"radio",new cljs.core.Keyword(null,"id","id",-1388402092),id,new cljs.core.Keyword(null,"name","name",1843675177),name,new cljs.core.Keyword(null,"value","value",305978217),index,new cljs.core.Keyword(null,"checked","checked",-50955819),javelin.core.formula.call(null,((function (id,vec__36629,choice,index,vec__36620,item,choices_STAR_,indexed,by_index,name,map__36618,map__36618__$1,value,choices,attrs__$1,vec__36615,attrs,_){
return (function (value__$1,choice__$1){
return cljs.core._EQ_.call(null,value__$1,new cljs.core.Keyword(null,"value","value",305978217).cljs$core$IFn$_invoke$arity$1(choice__$1));
});})(id,vec__36629,choice,index,vec__36620,item,choices_STAR_,indexed,by_index,name,map__36618,map__36618__$1,value,choices,attrs__$1,vec__36615,attrs,_))
).call(null,value,choice),new cljs.core.Keyword(null,"change","change",-1163046502),((function (id,vec__36629,choice,index,vec__36620,item,choices_STAR_,indexed,by_index,name,map__36618,map__36618__$1,value,choices,attrs__$1,vec__36615,attrs,_){
return (function (e){
console.log("Radio is changing",e);

return cljs.core.reset_BANG_.call(null,value,new cljs.core.Keyword(null,"value","value",305978217).cljs$core$IFn$_invoke$arity$1(cljs.core.get.call(null,cljs.core.deref.call(null,by_index),e.currentTarget.value)));
});})(id,vec__36629,choice,index,vec__36620,item,choices_STAR_,indexed,by_index,name,map__36618,map__36618__$1,value,choices,attrs__$1,vec__36615,attrs,_))
),hoplon.core.label.call(null,new cljs.core.Keyword(null,"for","for",-1323786319),id,javelin.core.formula.call(null,((function (id,vec__36629,choice,index,vec__36620,item,choices_STAR_,indexed,by_index,name,map__36618,map__36618__$1,value,choices,attrs__$1,vec__36615,attrs,_){
return (function (G__36636){
return new cljs.core.Keyword(null,"label","label",1718410804).cljs$core$IFn$_invoke$arity$1(G__36636);
});})(id,vec__36629,choice,index,vec__36620,item,choices_STAR_,indexed,by_index,name,map__36618,map__36618__$1,value,choices,attrs__$1,vec__36615,attrs,_))
).call(null,choice)));
});})(choices_STAR_,indexed,by_index,name,map__36618,map__36618__$1,value,choices,attrs__$1,vec__36615,attrs,_))
));
};
var weathergen$ui$common$radio_group = function (var_args){
var args__29776__auto__ = null;
if (arguments.length > 0) {
var G__36637__i = 0, G__36637__a = new Array(arguments.length -  0);
while (G__36637__i < G__36637__a.length) {G__36637__a[G__36637__i] = arguments[G__36637__i + 0]; ++G__36637__i;}
  args__29776__auto__ = new cljs.core.IndexedSeq(G__36637__a,0,null);
} 
return weathergen$ui$common$radio_group__delegate.call(this,args__29776__auto__);};
weathergen$ui$common$radio_group.cljs$lang$maxFixedArity = 0;
weathergen$ui$common$radio_group.cljs$lang$applyTo = (function (arglist__36638){
var args__29776__auto__ = cljs.core.seq(arglist__36638);
return weathergen$ui$common$radio_group__delegate(args__29776__auto__);
});
weathergen$ui$common$radio_group.cljs$core$IFn$_invoke$arity$variadic = weathergen$ui$common$radio_group__delegate;
return weathergen$ui$common$radio_group;
})()
;
/**
 * Returns a cell backed by local storage under `key` (a namespaced
 *   key), where, if the `default` contents change, a new cell will be
 *   allocated. This allows changing defaults in the code to overwrite
 *   any stored copies.
 */
weathergen.ui.common.versioned_local_storage = (function weathergen$ui$common$versioned_local_storage(key,default$){
return hoplon.storage_atom.local_storage.call(null,javelin.core.cell.call(null,default$),[cljs.core.str.cljs$core$IFn$_invoke$arity$1(key),cljs.core.str.cljs$core$IFn$_invoke$arity$1("-"),cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.hash.call(null,default$))].join(''));
});
/**
 * Returns an SVG scale string.
 */
weathergen.ui.common.svg_scale = (function weathergen$ui$common$svg_scale(var_args){
var args36639 = [];
var len__24559__auto___36642 = arguments.length;
var i__24560__auto___36643 = (0);
while(true){
if((i__24560__auto___36643 < len__24559__auto___36642)){
args36639.push((arguments[i__24560__auto___36643]));

var G__36644 = (i__24560__auto___36643 + (1));
i__24560__auto___36643 = G__36644;
continue;
} else {
}
break;
}

var G__36641 = args36639.length;
switch (G__36641) {
case 1:
return weathergen.ui.common.svg_scale.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return weathergen.ui.common.svg_scale.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args36639.length)].join('')));

}
});

weathergen.ui.common.svg_scale.cljs$core$IFn$_invoke$arity$1 = (function (s){
return goog.string.format("scale(%f)",s);
});

weathergen.ui.common.svg_scale.cljs$core$IFn$_invoke$arity$2 = (function (x,y){
return goog.string.format("scale(%f,%f)",x,y);
});

weathergen.ui.common.svg_scale.cljs$lang$maxFixedArity = 2;

/**
 * Returns an SVG translate string.
 */
weathergen.ui.common.svg_translate = (function weathergen$ui$common$svg_translate(x,y){
return goog.string.format("translate(%f,%f)",x,y);
});
/**
 * Returns an SVG rotate string.
 */
weathergen.ui.common.svg_rotate = (function weathergen$ui$common$svg_rotate(deg){
return goog.string.format("rotate(%f)",deg);
});
/**
 * Combines xforms into a single SVG transformation string
 */
weathergen.ui.common.svg_xform_combine = (function weathergen$ui$common$svg_xform_combine(var_args){
var args__24566__auto__ = [];
var len__24559__auto___36647 = arguments.length;
var i__24560__auto___36648 = (0);
while(true){
if((i__24560__auto___36648 < len__24559__auto___36647)){
args__24566__auto__.push((arguments[i__24560__auto___36648]));

var G__36649 = (i__24560__auto___36648 + (1));
i__24560__auto___36648 = G__36649;
continue;
} else {
}
break;
}

var argseq__24567__auto__ = ((((0) < args__24566__auto__.length))?(new cljs.core.IndexedSeq(args__24566__auto__.slice((0)),(0),null)):null);
return weathergen.ui.common.svg_xform_combine.cljs$core$IFn$_invoke$arity$variadic(argseq__24567__auto__);
});

weathergen.ui.common.svg_xform_combine.cljs$core$IFn$_invoke$arity$variadic = (function (xforms){
return clojure.string.join.call(null," ",xforms);
});

weathergen.ui.common.svg_xform_combine.cljs$lang$maxFixedArity = (0);

weathergen.ui.common.svg_xform_combine.cljs$lang$applyTo = (function (seq36646){
return weathergen.ui.common.svg_xform_combine.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq36646));
});

var interval_value_36650 = 0.45;
var interval_36651 = [cljs.core.str.cljs$core$IFn$_invoke$arity$1(interval_value_36650),cljs.core.str.cljs$core$IFn$_invoke$arity$1("s")].join('');
weathergen.ui.common.register_styles_BANG_.call(null,new cljs.core.Keyword("weathergen.ui.common","animations","weathergen.ui.common/animations",338673555),new cljs.core.PersistentVector(null, 6, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [garden.stylesheet.at_keyframes.call(null,weathergen.ui.common.class_for.call(null,new cljs.core.Keyword("weathergen.ui.common","pulse-animation","weathergen.ui.common/pulse-animation",-696492175)),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"from","from",1815293044),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"opacity","opacity",397153780),(1)], null)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"to","to",192099007),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"opacity","opacity",397153780),(0)], null)], null))], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [weathergen.ui.common.class_selector_for.call(null,new cljs.core.Keyword("weathergen.ui.common","pulse","weathergen.ui.common/pulse",-535065247)),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"animation-duration","animation-duration",-1261077706),interval_36651,new cljs.core.Keyword(null,"animation-name","animation-name",-302195330),weathergen.ui.common.class_for.call(null,new cljs.core.Keyword("weathergen.ui.common","pulse-animation","weathergen.ui.common/pulse-animation",-696492175)),new cljs.core.Keyword(null,"animation-iteration-count","animation-iteration-count",-1410888227),"infinite",new cljs.core.Keyword(null,"animation-timing-function","animation-timing-function",-1186881521),"ease-in-out",new cljs.core.Keyword(null,"animation-direction","animation-direction",-362912441),"alternate",new cljs.core.Keyword(null,"animation-delay","animation-delay",-488570176),interval_36651], null)], null),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [garden.stylesheet.at_keyframes.call(null,weathergen.ui.common.class_for.call(null,new cljs.core.Keyword("weathergen.ui.common","collapse-animation","weathergen.ui.common/collapse-animation",-506320172)),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"from","from",1815293044),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"transform","transform",1381301764),weathergen.ui.common.svg_scale.call(null,(1)),new cljs.core.Keyword(null,"stroke-dashoffset","stroke-dashoffset",-782320340),(0)], null)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"to","to",192099007),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"transform","transform",1381301764),weathergen.ui.common.svg_scale.call(null,0.02),new cljs.core.Keyword(null,"stroke-dashoffset","stroke-dashoffset",-782320340),(50)], null)], null))], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [weathergen.ui.common.class_selector_for.call(null,new cljs.core.Keyword("weathergen.ui.common","collapse","weathergen.ui.common/collapse",-901062267)),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"animation-duration","animation-duration",-1261077706),interval_36651,new cljs.core.Keyword(null,"animation-name","animation-name",-302195330),weathergen.ui.common.class_for.call(null,new cljs.core.Keyword("weathergen.ui.common","collapse-animation","weathergen.ui.common/collapse-animation",-506320172)),new cljs.core.Keyword(null,"animation-iteration-count","animation-iteration-count",-1410888227),(1),new cljs.core.Keyword(null,"animation-timing-function","animation-timing-function",-1186881521),"ease-out",new cljs.core.Keyword(null,"animation-direction","animation-direction",-362912441),"normal"], null)], null),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [garden.stylesheet.at_keyframes.call(null,weathergen.ui.common.class_for.call(null,new cljs.core.Keyword("weathergen.ui.common","delayed-fade-out-animation","weathergen.ui.common/delayed-fade-out-animation",-813416372)),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"from","from",1815293044),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"opacity","opacity",397153780),0.35], null)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, ["80%",new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"opacity","opacity",397153780),0.35], null)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"to","to",192099007),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"opacity","opacity",397153780),(0)], null)], null))], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [weathergen.ui.common.class_selector_for.call(null,new cljs.core.Keyword("weathergen.ui.common","delayed-fade-out","weathergen.ui.common/delayed-fade-out",1307931935)),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"animation-duration","animation-duration",-1261077706),[cljs.core.str.cljs$core$IFn$_invoke$arity$1((interval_value_36650 / 0.8)),cljs.core.str.cljs$core$IFn$_invoke$arity$1("s")].join(''),new cljs.core.Keyword(null,"animation-name","animation-name",-302195330),weathergen.ui.common.class_for.call(null,new cljs.core.Keyword("weathergen.ui.common","delayed-fade-out-animation","weathergen.ui.common/delayed-fade-out-animation",-813416372)),new cljs.core.Keyword(null,"animation-iteration-count","animation-iteration-count",-1410888227),(1),new cljs.core.Keyword(null,"animation-timing-function","animation-timing-function",-1186881521),"ease-out",new cljs.core.Keyword(null,"animation-direction","animation-direction",-362912441),"normal"], null)], null)], null));
weathergen.ui.common.pulse_class = weathergen.ui.common.class_for.call(null,new cljs.core.Keyword("weathergen.ui.common","pulse","weathergen.ui.common/pulse",-535065247));
weathergen.ui.common.collapse_class = weathergen.ui.common.class_for.call(null,new cljs.core.Keyword("weathergen.ui.common","collapse","weathergen.ui.common/collapse",-901062267));
weathergen.ui.common.delayed_fade_out_class = weathergen.ui.common.class_for.call(null,new cljs.core.Keyword("weathergen.ui.common","delayed-fade-out","weathergen.ui.common/delayed-fade-out",1307931935));
/**
 * Renders a heading - white text on a black background
 */
weathergen.ui.common.heading = (function weathergen$ui$common$heading(var_args){
var args36652 = [];
var len__24559__auto___36658 = arguments.length;
var i__24560__auto___36659 = (0);
while(true){
if((i__24560__auto___36659 < len__24559__auto___36658)){
args36652.push((arguments[i__24560__auto___36659]));

var G__36660 = (i__24560__auto___36659 + (1));
i__24560__auto___36659 = G__36660;
continue;
} else {
}
break;
}

var G__36654 = args36652.length;
switch (G__36654) {
case 1:
return weathergen.ui.common.heading.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return weathergen.ui.common.heading.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args36652.length)].join('')));

}
});

weathergen.ui.common.heading.cljs$core$IFn$_invoke$arity$1 = (function (content){
return weathergen.ui.common.heading.call(null,cljs.core.PersistentArrayMap.EMPTY,content);
});

weathergen.ui.common.heading.cljs$core$IFn$_invoke$arity$2 = (function (p__36655,content){
var map__36656 = p__36655;
var map__36656__$1 = ((((!((map__36656 == null)))?((((map__36656.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36656.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36656):map__36656);
var margin_top = cljs.core.get.call(null,map__36656__$1,new cljs.core.Keyword(null,"margin-top","margin-top",392161226));
return hoplon.core.div.call(null,new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"color","color",1011675173),"white",new cljs.core.Keyword(null,"background","background",-863952629),"black",new cljs.core.Keyword(null,"margin-top","margin-top",392161226),weathergen.ui.common.px.call(null,(function (){var or__23338__auto__ = margin_top;
if(cljs.core.truth_(or__23338__auto__)){
return or__23338__auto__;
} else {
return (15);
}
})()),new cljs.core.Keyword(null,"margin-bottom","margin-bottom",388334941),weathergen.ui.common.px.call(null,(5)),new cljs.core.Keyword(null,"padding","padding",1660304693),weathergen.ui.common.px.call(null,(2))], null),content);
});

weathergen.ui.common.heading.cljs$lang$maxFixedArity = 2;

/**
 * Returns a lens over a `get-in` style path `p` into cell `c`.
 */
weathergen.ui.common.path_lens = (function weathergen$ui$common$path_lens(c,p){
return javelin.core.lens.call(null,javelin.core.formula.call(null,(function (c__$1){
return cljs.core.get_in.call(null,c__$1,p);
})).call(null,c),(function (v){
return cljs.core.swap_BANG_.call(null,c,cljs.core.assoc_in,p,v);
}));
});
