// 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___36134 = arguments.length;
var i__24560__auto___36135 = (0);
while(true){
if((i__24560__auto___36135 < len__24559__auto___36134)){
args__24566__auto__.push((arguments[i__24560__auto___36135]));

var G__36136 = (i__24560__auto___36135 + (1));
i__24560__auto___36135 = G__36136;
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__36131_SHARP_){
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(p1__36131_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 (seq36132){
var G__36133 = cljs.core.first.call(null,seq36132);
var seq36132__$1 = cljs.core.next.call(null,seq36132);
return weathergen.ui.common.measurement.cljs$core$IFn$_invoke$arity$variadic(G__36133,seq36132__$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___36138 = arguments.length;
var i__24560__auto___36139 = (0);
while(true){
if((i__24560__auto___36139 < len__24559__auto___36138)){
args__24566__auto__.push((arguments[i__24560__auto___36139]));

var G__36140 = (i__24560__auto___36139 + (1));
i__24560__auto___36139 = G__36140;
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 (seq36137){
return weathergen.ui.common.px.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq36137));
});

/**
 * 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___36142 = arguments.length;
var i__24560__auto___36143 = (0);
while(true){
if((i__24560__auto___36143 < len__24559__auto___36142)){
args__24566__auto__.push((arguments[i__24560__auto___36143]));

var G__36144 = (i__24560__auto___36143 + (1));
i__24560__auto___36143 = G__36144;
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 (seq36141){
return weathergen.ui.common.pct.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq36141));
});

/**
 * 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___36146 = arguments.length;
var i__24560__auto___36147 = (0);
while(true){
if((i__24560__auto___36147 < len__24559__auto___36146)){
args__24566__auto__.push((arguments[i__24560__auto___36147]));

var G__36148 = (i__24560__auto___36147 + (1));
i__24560__auto___36147 = G__36148;
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 (seq36145){
return weathergen.ui.common.ems.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq36145));
});

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__36151,G__36152){
return G__36151.call(null,G__36152);
});})(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,40358038);

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 args36153 = [];
var len__24559__auto___36157 = arguments.length;
var i__24560__auto___36158 = (0);
while(true){
if((i__24560__auto___36158 < len__24559__auto___36157)){
args36153.push((arguments[i__24560__auto___36158]));

var G__36159 = (i__24560__auto___36158 + (1));
i__24560__auto___36158 = G__36159;
continue;
} else {
}
break;
}

var G__36155 = args36153.length;
switch (G__36155) {
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(args36153.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__36156 = weathergen.ui.common.tinycolor.mostReadable(color,[dark,light]);
return G__36156;
})().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__36163 = (function (){var G__36164 = weathergen.ui.common.tinycolor.call(null,color);
return G__36164;
})().darken(amount);
return G__36163;
})().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__36167 = (function (){var G__36168 = weathergen.ui.common.tinycolor.call(null,color);
return G__36168;
})().lighten(amount);
return G__36167;
})().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__36171 = (function (){var G__36172 = weathergen.ui.common.tinycolor.call(null,color);
return G__36172;
})().spin(amount);
return G__36171;
})().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__36174 = weathergen.ui.common.tinycolor.call(null,color);
return G__36174;
})().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__29774__auto__){
var vec__36184 = hoplon.core.parse_args.call(null,args__29774__auto__);
var attrs = cljs.core.nth.call(null,vec__36184,(0),null);
var content = cljs.core.nth.call(null,vec__36184,(1),null);
var map__36187 = attrs;
var map__36187__$1 = ((((!((map__36187 == null)))?((((map__36187.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36187.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36187):map__36187);
var garden__$1 = cljs.core.get.call(null,map__36187__$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__36187,map__36187__$1,garden__$1,attrs__$1,head,id,vec__36184,attrs,content){
return (function (G__36189,G__36192,G__36190,G__36191){
return G__36189.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [G__36190.call(null,[cljs.core.str.cljs$core$IFn$_invoke$arity$1("#"),cljs.core.str.cljs$core$IFn$_invoke$arity$1(G__36191)].join('')),G__36192], null));
});})(map__36187,map__36187__$1,garden__$1,attrs__$1,head,id,vec__36184,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__29774__auto__ = null;
if (arguments.length > 0) {
var G__36193__i = 0, G__36193__a = new Array(arguments.length -  0);
while (G__36193__i < G__36193__a.length) {G__36193__a[G__36193__i] = arguments[G__36193__i + 0]; ++G__36193__i;}
  args__29774__auto__ = new cljs.core.IndexedSeq(G__36193__a,0,null);
} 
return weathergen$ui$common$styled__delegate.call(this,args__29774__auto__);};
weathergen$ui$common$styled.cljs$lang$maxFixedArity = 0;
weathergen$ui$common$styled.cljs$lang$applyTo = (function (arglist__36194){
var args__29774__auto__ = cljs.core.seq(arglist__36194);
return weathergen$ui$common$styled__delegate(args__29774__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__29774__auto__){
var vec__36200 = hoplon.core.parse_args.call(null,args__29774__auto__);
var attrs = cljs.core.nth.call(null,vec__36200,(0),null);
var content = cljs.core.nth.call(null,vec__36200,(1),null);
var map__36203 = attrs;
var map__36203__$1 = ((((!((map__36203 == null)))?((((map__36203.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36203.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36203):map__36203);
var css = cljs.core.get.call(null,map__36203__$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__36203,map__36203__$1,css,vec__36200,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__36203,map__36203__$1,css,vec__36200,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__36203,map__36203__$1,css,vec__36200,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__36203,map__36203__$1,css,vec__36200,attrs,content))
),content);
};
var weathergen$ui$common$inl = function (var_args){
var args__29774__auto__ = null;
if (arguments.length > 0) {
var G__36205__i = 0, G__36205__a = new Array(arguments.length -  0);
while (G__36205__i < G__36205__a.length) {G__36205__a[G__36205__i] = arguments[G__36205__i + 0]; ++G__36205__i;}
  args__29774__auto__ = new cljs.core.IndexedSeq(G__36205__a,0,null);
} 
return weathergen$ui$common$inl__delegate.call(this,args__29774__auto__);};
weathergen$ui$common$inl.cljs$lang$maxFixedArity = 0;
weathergen$ui$common$inl.cljs$lang$applyTo = (function (arglist__36206){
var args__29774__auto__ = cljs.core.seq(arglist__36206);
return weathergen$ui$common$inl__delegate(args__29774__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__29774__auto__){
var vec__36217 = hoplon.core.parse_args.call(null,args__29774__auto__);
var attrs = cljs.core.nth.call(null,vec__36217,(0),null);
var _ = cljs.core.nth.call(null,vec__36217,(1),null);
var map__36220 = attrs;
var map__36220__$1 = ((((!((map__36220 == null)))?((((map__36220.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36220.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36220):map__36220);
var r = cljs.core.get.call(null,map__36220__$1,new cljs.core.Keyword(null,"r","r",-471384190));
var r_STAR_ = javelin.core.formula.call(null,((function (map__36220,map__36220__$1,r,vec__36217,attrs,_){
return (function (G__36222){
return G__36222;
});})(map__36220,map__36220__$1,r,vec__36217,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__36220,map__36220__$1,r,r_STAR_,attrs__$1,alpha,beta,vec__36217,attrs,_){
return (function (G__36223,G__36224){
return (G__36223 * G__36224);
});})(map__36220,map__36220__$1,r,r_STAR_,attrs__$1,alpha,beta,vec__36217,attrs,_))
).call(null,r_STAR_,alpha);
var y = javelin.core.formula.call(null,((function (map__36220,map__36220__$1,r,r_STAR_,attrs__$1,alpha,beta,x,vec__36217,attrs,_){
return (function (G__36225,G__36226){
return (G__36225 * G__36226);
});})(map__36220,map__36220__$1,r,r_STAR_,attrs__$1,alpha,beta,x,vec__36217,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__36220,map__36220__$1,r,r_STAR_,attrs__$1,alpha,beta,x,y,vec__36217,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__36220,map__36220__$1,r,r_STAR_,attrs__$1,alpha,beta,x,y,vec__36217,attrs,_))
).call(null,x,y),attrs__$1);
};
var weathergen$ui$common$triangle = function (var_args){
var args__29774__auto__ = null;
if (arguments.length > 0) {
var G__36227__i = 0, G__36227__a = new Array(arguments.length -  0);
while (G__36227__i < G__36227__a.length) {G__36227__a[G__36227__i] = arguments[G__36227__i + 0]; ++G__36227__i;}
  args__29774__auto__ = new cljs.core.IndexedSeq(G__36227__a,0,null);
} 
return weathergen$ui$common$triangle__delegate.call(this,args__29774__auto__);};
weathergen$ui$common$triangle.cljs$lang$maxFixedArity = 0;
weathergen$ui$common$triangle.cljs$lang$applyTo = (function (arglist__36228){
var args__29774__auto__ = cljs.core.seq(arglist__36228);
return weathergen$ui$common$triangle__delegate(args__29774__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__36231,G__36232){
return G__36231.call(null,G__36232,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__29774__auto__){
var vec__36236 = hoplon.core.parse_args.call(null,args__29774__auto__);
var attributes = cljs.core.nth.call(null,vec__36236,(0),null);
var children = cljs.core.nth.call(null,vec__36236,(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__36236,attributes,children){
return (function (){
return cljs.core.swap_BANG_.call(null,visible,cljs.core.not);
});})(visible,vec__36236,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__36236,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__36236,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__29774__auto__ = null;
if (arguments.length > 0) {
var G__36239__i = 0, G__36239__a = new Array(arguments.length -  0);
while (G__36239__i < G__36239__a.length) {G__36239__a[G__36239__i] = arguments[G__36239__i + 0]; ++G__36239__i;}
  args__29774__auto__ = new cljs.core.IndexedSeq(G__36239__a,0,null);
} 
return weathergen$ui$common$control_section__delegate.call(this,args__29774__auto__);};
weathergen$ui$common$control_section.cljs$lang$maxFixedArity = 0;
weathergen$ui$common$control_section.cljs$lang$applyTo = (function (arglist__36240){
var args__29774__auto__ = cljs.core.seq(arglist__36240);
return weathergen$ui$common$control_section__delegate(args__29774__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 args36241 = [];
var len__24559__auto___36253 = arguments.length;
var i__24560__auto___36254 = (0);
while(true){
if((i__24560__auto___36254 < len__24559__auto___36253)){
args36241.push((arguments[i__24560__auto___36254]));

var G__36255 = (i__24560__auto___36254 + (1));
i__24560__auto___36254 = G__36255;
continue;
} else {
}
break;
}

var G__36243 = args36241.length;
switch (G__36243) {
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(args36241.length)].join('')));

}
});

weathergen.ui.common.format_time.cljs$core$IFn$_invoke$arity$1 = (function (p__36244){
var map__36245 = p__36244;
var map__36245__$1 = ((((!((map__36245 == null)))?((((map__36245.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36245.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36245):map__36245);
var time = map__36245__$1;
var day = cljs.core.get.call(null,map__36245__$1,new cljs.core.Keyword(null,"day","day",-274800446));
var hour = cljs.core.get.call(null,map__36245__$1,new cljs.core.Keyword(null,"hour","hour",-555989214));
var minute = cljs.core.get.call(null,map__36245__$1,new cljs.core.Keyword(null,"minute","minute",-642875969));
var second = cljs.core.get.call(null,map__36245__$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__36247,p__36248){
var map__36249 = p__36247;
var map__36249__$1 = ((((!((map__36249 == null)))?((((map__36249.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36249.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36249):map__36249);
var time = map__36249__$1;
var day = cljs.core.get.call(null,map__36249__$1,new cljs.core.Keyword(null,"day","day",-274800446));
var hour = cljs.core.get.call(null,map__36249__$1,new cljs.core.Keyword(null,"hour","hour",-555989214));
var minute = cljs.core.get.call(null,map__36249__$1,new cljs.core.Keyword(null,"minute","minute",-642875969));
var second = cljs.core.get.call(null,map__36249__$1,new cljs.core.Keyword(null,"second","second",-444702010));
var map__36250 = p__36248;
var map__36250__$1 = ((((!((map__36250 == null)))?((((map__36250.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36250.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36250):map__36250);
var opts = map__36250__$1;
var seconds_QMARK_ = cljs.core.get.call(null,map__36250__$1,new cljs.core.Keyword(null,"seconds?","seconds?",-1600404958));
var omit_day_QMARK_ = cljs.core.get.call(null,map__36250__$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__36258 = heading;
if((G__36258 == null)){
return null;
} else {
return G__36258.toFixed((0));
}
});
/**
 * Formats a distance
 */
weathergen.ui.common.format_distance = (function weathergen$ui$common$format_distance(distance){
var G__36260 = distance;
if((G__36260 == null)){
return null;
} else {
return G__36260.toFixed((1));
}
});
/**
 * Formats a speed.
 */
weathergen.ui.common.format_speed = (function weathergen$ui$common$format_speed(speed){
var G__36262 = speed;
var G__36262__$1 = (((G__36262 == null))?null:weathergen.math.nearest.call(null,G__36262,(5)));
if((G__36262__$1 == null)){
return null;
} else {
return G__36262__$1.toFixed((0));
}
});
/**
 * Formats a Mach number.
 */
weathergen.ui.common.format_mach = (function weathergen$ui$common$format_mach(mach){
var G__36264 = mach;
if((G__36264 == null)){
return null;
} else {
return G__36264.toFixed((2));
}
});
/**
 * @param {...*} var_args
 */
weathergen.ui.common.color_picker = (function() { 
var weathergen$ui$common$color_picker__delegate = function (args__29774__auto__){
var vec__36272 = hoplon.core.parse_args.call(null,args__29774__auto__);
var attrs = cljs.core.nth.call(null,vec__36272,(0),null);
var _ = cljs.core.nth.call(null,vec__36272,(1),null);
var map__36275 = attrs;
var map__36275__$1 = ((((!((map__36275 == null)))?((((map__36275.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36275.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36275):map__36275);
var change = cljs.core.get.call(null,map__36275__$1,new cljs.core.Keyword(null,"change","change",-1163046502));
var hide = cljs.core.get.call(null,map__36275__$1,new cljs.core.Keyword(null,"hide","hide",-596913169));
var show = cljs.core.get.call(null,map__36275__$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__36275,map__36275__$1,change,hide,show,attrs_STAR_,open_QMARK_,vec__36272,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__36275,map__36275__$1,change,hide,show,attrs_STAR_,open_QMARK_,vec__36272,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__36275,map__36275__$1,change,hide,show,attrs_STAR_,open_QMARK_,vec__36272,attrs,_){
return (function (___$1,___$2,___$3,n){
if(cljs.core.truth_(n)){
return (function (){var G__36277 = jQuery(i);
return G__36277;
})().minicolors("value",weathergen.ui.common.to_hex_str.call(null,n));
} else {
return null;
}
});})(i,map__36275,map__36275__$1,change,hide,show,attrs_STAR_,open_QMARK_,vec__36272,attrs,_))
);

hoplon.core.when_dom.call(null,i,((function (i,map__36275,map__36275__$1,change,hide,show,attrs_STAR_,open_QMARK_,vec__36272,attrs,_){
return (function (){
return (function (){var G__36278 = jQuery(i);
return G__36278;
})().minicolors(({"theme": "weathergen", "show": ((function (i,map__36275,map__36275__$1,change,hide,show,attrs_STAR_,open_QMARK_,vec__36272,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__36275,map__36275__$1,change,hide,show,attrs_STAR_,open_QMARK_,vec__36272,attrs,_))
, "hide": ((function (i,map__36275,map__36275__$1,change,hide,show,attrs_STAR_,open_QMARK_,vec__36272,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__36275,map__36275__$1,change,hide,show,attrs_STAR_,open_QMARK_,vec__36272,attrs,_))
}));
});})(i,map__36275,map__36275__$1,change,hide,show,attrs_STAR_,open_QMARK_,vec__36272,attrs,_))
);

return i;
};
var weathergen$ui$common$color_picker = function (var_args){
var args__29774__auto__ = null;
if (arguments.length > 0) {
var G__36279__i = 0, G__36279__a = new Array(arguments.length -  0);
while (G__36279__i < G__36279__a.length) {G__36279__a[G__36279__i] = arguments[G__36279__i + 0]; ++G__36279__i;}
  args__29774__auto__ = new cljs.core.IndexedSeq(G__36279__a,0,null);
} 
return weathergen$ui$common$color_picker__delegate.call(this,args__29774__auto__);};
weathergen$ui$common$color_picker.cljs$lang$maxFixedArity = 0;
weathergen$ui$common$color_picker.cljs$lang$applyTo = (function (arglist__36280){
var args__29774__auto__ = cljs.core.seq(arglist__36280);
return weathergen$ui$common$color_picker__delegate(args__29774__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__29774__auto__){
var vec__36305 = hoplon.core.parse_args.call(null,args__29774__auto__);
var attrs = cljs.core.nth.call(null,vec__36305,(0),null);
var _ = cljs.core.nth.call(null,vec__36305,(1),null);
var map__36308 = attrs;
var map__36308__$1 = ((((!((map__36308 == null)))?((((map__36308.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36308.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36308):map__36308);
var mission = cljs.core.get.call(null,map__36308__$1,new cljs.core.Keyword(null,"mission","mission",1740288522));
var side = cljs.core.get.call(null,map__36308__$1,new cljs.core.Keyword(null,"side","side",389652279));
var allies = javelin.core.formula.call(null,((function (map__36308,map__36308__$1,mission,side,vec__36305,attrs,_){
return (function (mission__$1,side__$1){
var side_teams = cljs.core.set.call(null,cljs.core.map.call(null,((function (map__36308,map__36308__$1,mission,side,vec__36305,attrs,_){
return (function (p1__36282_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__36282_SHARP_));
});})(map__36308,map__36308__$1,mission,side,vec__36305,attrs,_))
,cljs.core.filter.call(null,((function (map__36308,map__36308__$1,mission,side,vec__36305,attrs,_){
return (function (p1__36281_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__36281_SHARP_)),side__$1);
});})(map__36308,map__36308__$1,mission,side,vec__36305,attrs,_))
,weathergen.falcon.files.mission.teams.call(null,mission__$1))));
return cljs.core.disj.call(null,side_teams,side__$1);
});})(map__36308,map__36308__$1,mission,side,vec__36305,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__36308,map__36308__$1,mission,side,allies,vec__36305,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__36308,map__36308__$1,mission,side,allies,vec__36305,attrs,_){
return (function weathergen$ui$common$side_label_$_iter__36310(s__36311){
return (new cljs.core.LazySeq(null,((function (map__36308,map__36308__$1,mission,side,allies,vec__36305,attrs,_){
return (function (){
var s__36311__$1 = s__36311;
while(true){
var temp__5278__auto__ = cljs.core.seq.call(null,s__36311__$1);
if(temp__5278__auto__){
var s__36311__$2 = temp__5278__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__36311__$2)){
var c__24198__auto__ = cljs.core.chunk_first.call(null,s__36311__$2);
var size__24199__auto__ = cljs.core.count.call(null,c__24198__auto__);
var b__36313 = cljs.core.chunk_buffer.call(null,size__24199__auto__);
if((function (){var i__36312 = (0);
while(true){
if((i__36312 < size__24199__auto__)){
var team = cljs.core._nth.call(null,c__24198__auto__,i__36312);
cljs.core.chunk_append.call(null,b__36313,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__36327 = (i__36312 + (1));
i__36312 = G__36327;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__36313),weathergen$ui$common$side_label_$_iter__36310.call(null,cljs.core.chunk_rest.call(null,s__36311__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__36313),null);
}
} else {
var team = cljs.core.first.call(null,s__36311__$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__36310.call(null,cljs.core.rest.call(null,s__36311__$2)));
}
} else {
return null;
}
break;
}
});})(map__36308,map__36308__$1,mission,side,allies,vec__36305,attrs,_))
,null,null));
});})(map__36308,map__36308__$1,mission,side,allies,vec__36305,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__36308,map__36308__$1,mission,side,allies,vec__36305,attrs,_))
).call(null,mission,side,allies),((function (map__36308,map__36308__$1,mission,side,allies,vec__36305,attrs,_){
return (function (item__29818__auto__){
var vec__36314 = javelin.core.cell_map.call(null,cljs.core.identity,javelin.core.formula.call(null,((function (map__36308,map__36308__$1,mission,side,allies,vec__36305,attrs,_){
return (function (elem){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [elem], null);
});})(map__36308,map__36308__$1,mission,side,allies,vec__36305,attrs,_))
).call(null,item__29818__auto__));
var elem = cljs.core.nth.call(null,vec__36314,(0),null);
var vec__36319 = javelin.core.cell_map.call(null,cljs.core.identity,javelin.core.formula.call(null,((function (vec__36314,elem,map__36308,map__36308__$1,mission,side,allies,vec__36305,attrs,_){
return (function (p__36322){
var map__36323 = p__36322;
var map__36323__$1 = ((((!((map__36323 == null)))?((((map__36323.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36323.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36323):map__36323);
var color = cljs.core.get.call(null,map__36323__$1,new cljs.core.Keyword(null,"color","color",1011675173));
var name = cljs.core.get.call(null,map__36323__$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__36314,elem,map__36308,map__36308__$1,mission,side,allies,vec__36305,attrs,_))
).call(null,elem));
var color = cljs.core.nth.call(null,vec__36319,(0),null);
var name = cljs.core.nth.call(null,vec__36319,(1),null);
return hoplon.core.span.call(null,new cljs.core.Keyword(null,"css","css",1135045163),javelin.core.formula.call(null,((function (vec__36319,color,name,vec__36314,elem,map__36308,map__36308__$1,mission,side,allies,vec__36305,attrs,_){
return (function (G__36325){
return new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"color","color",1011675173),G__36325], null);
});})(vec__36319,color,name,vec__36314,elem,map__36308,map__36308__$1,mission,side,allies,vec__36305,attrs,_))
).call(null,color),javelin.core.formula.call(null,((function (vec__36319,color,name,vec__36314,elem,map__36308,map__36308__$1,mission,side,allies,vec__36305,attrs,_){
return (function (G__36326){
return G__36326;
});})(vec__36319,color,name,vec__36314,elem,map__36308,map__36308__$1,mission,side,allies,vec__36305,attrs,_))
).call(null,name));
});})(map__36308,map__36308__$1,mission,side,allies,vec__36305,attrs,_))
));
};
var weathergen$ui$common$side_label = function (var_args){
var args__29774__auto__ = null;
if (arguments.length > 0) {
var G__36328__i = 0, G__36328__a = new Array(arguments.length -  0);
while (G__36328__i < G__36328__a.length) {G__36328__a[G__36328__i] = arguments[G__36328__i + 0]; ++G__36328__i;}
  args__29774__auto__ = new cljs.core.IndexedSeq(G__36328__a,0,null);
} 
return weathergen$ui$common$side_label__delegate.call(this,args__29774__auto__);};
weathergen$ui$common$side_label.cljs$lang$maxFixedArity = 0;
weathergen$ui$common$side_label.cljs$lang$applyTo = (function (arglist__36329){
var args__29774__auto__ = cljs.core.seq(arglist__36329);
return weathergen$ui$common$side_label__delegate(args__29774__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___36330 = [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___36331 = console.time(timer_name__15521__auto___36330);
var result__15523__auto___36332 = weathergen.falcon.files.images.read_image.call(null,mission,image_descriptor,((function (timer_name__15521__auto___36330,ignore__15522__auto___36331,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___36330,ignore__15522__auto___36331,canvas,path){
return (function (x,y,argb){
return (data[(x + (y * width))] = argb);
});})(context,image_data,buf,buf8,data,timer_name__15521__auto___36330,ignore__15522__auto___36331,canvas,path))
,new cljs.core.Keyword(null,"finalize","finalize",-1152897571),((function (context,image_data,buf,buf8,data,timer_name__15521__auto___36330,ignore__15522__auto___36331,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___36330,ignore__15522__auto___36331,canvas,path))
], null);
});})(timer_name__15521__auto___36330,ignore__15522__auto___36331,canvas,path))
);
console.timeEnd(timer_name__15521__auto___36330);


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__29774__auto__){
var vec__36356 = hoplon.core.parse_args.call(null,args__29774__auto__);
var attrs = cljs.core.nth.call(null,vec__36356,(0),null);
var _ = cljs.core.nth.call(null,vec__36356,(1),null);
var map__36359 = attrs;
var map__36359__$1 = ((((!((map__36359 == null)))?((((map__36359.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36359.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36359):map__36359);
var selectable_teams = cljs.core.get.call(null,map__36359__$1,new cljs.core.Keyword(null,"selectable-teams","selectable-teams",1104557919));
var mission = cljs.core.get.call(null,map__36359__$1,new cljs.core.Keyword(null,"mission","mission",1740288522));
var selected_teams = cljs.core.get.call(null,map__36359__$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__36359,map__36359__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36356,attrs,_){
return (function (G__36361,G__36362){
return G__36361.call(null,G__36362);
});})(map__36359,map__36359__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36356,attrs,_))
).call(null,weathergen.falcon.files.mission.teams,mission),((function (map__36359,map__36359__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36356,attrs,_){
return (function (item__29818__auto__){
var vec__36363 = javelin.core.cell_map.call(null,cljs.core.identity,javelin.core.formula.call(null,((function (map__36359,map__36359__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36356,attrs,_){
return (function (team){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [team], null);
});})(map__36359,map__36359__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36356,attrs,_))
).call(null,item__29818__auto__));
var team = cljs.core.nth.call(null,vec__36363,(0),null);
return weathergen.ui.common.inl.call(null,new cljs.core.Keyword(null,"css","css",1135045163),javelin.core.formula.call(null,((function (vec__36363,team,map__36359,map__36359__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36356,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__36363,team,map__36359,map__36359__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36356,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__36363,team,map__36359,map__36359__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36356,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__36363,team,map__36359,map__36359__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36356,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__36363,team,map__36359,map__36359__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36356,attrs,_){
return (function (G__36367,G__36366){
return new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"color","color",1011675173),G__36366.call(null,G__36367,new cljs.core.Keyword(null,"dark-text","dark-text",814777253))], null);
});})(vec__36363,team,map__36359,map__36359__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36356,attrs,_))
).call(null,team,weathergen.ui.common.team_color),javelin.core.formula.call(null,((function (vec__36363,team,map__36359,map__36359__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36356,attrs,_){
return (function (G__36368,G__36369,G__36370){
return G__36368.call(null,G__36369,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__36370)));
});})(vec__36363,team,map__36359,map__36359__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36356,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__36363,team,map__36359,map__36359__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36356,attrs,_){
return (function (G__36371,G__36373,G__36374,G__36372){
return G__36371.call(null,G__36372,G__36373.call(null,G__36374));
});})(vec__36363,team,map__36359,map__36359__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36356,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__36363,team,map__36359,map__36359__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36356,attrs,_){
return (function (G__36375,G__36376,G__36377,G__36378){
return G__36375.call(null,G__36376,G__36377.call(null,G__36378));
});})(val,vec__36363,team,map__36359,map__36359__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36356,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__36363,team,map__36359,map__36359__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36356,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__36363,team,map__36359,map__36359__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36356,attrs,_))
);
})()));
});})(map__36359,map__36359__$1,selectable_teams,mission,selected_teams,attrs__$1,vec__36356,attrs,_))
));
};
var weathergen$ui$common$team_selector = function (var_args){
var args__29774__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__29774__auto__ = new cljs.core.IndexedSeq(G__36379__a,0,null);
} 
return weathergen$ui$common$team_selector__delegate.call(this,args__29774__auto__);};
weathergen$ui$common$team_selector.cljs$lang$maxFixedArity = 0;
weathergen$ui$common$team_selector.cljs$lang$applyTo = (function (arglist__36380){
var args__29774__auto__ = cljs.core.seq(arglist__36380);
return weathergen$ui$common$team_selector__delegate(args__29774__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__29774__auto__){
var vec__36401 = hoplon.core.parse_args.call(null,args__29774__auto__);
var attrs = cljs.core.nth.call(null,vec__36401,(0),null);
var _ = cljs.core.nth.call(null,vec__36401,(1),null);
var map__36404 = attrs;
var map__36404__$1 = ((((!((map__36404 == null)))?((((map__36404.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36404.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36404):map__36404);
var selected_sides = cljs.core.get.call(null,map__36404__$1,new cljs.core.Keyword(null,"selected-sides","selected-sides",-922979619));
var mission = cljs.core.get.call(null,map__36404__$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__36404,map__36404__$1,selected_sides,mission,attrs__$1,vec__36401,attrs,_){
return (function (G__36407,G__36406){
return G__36406.call(null,G__36407);
});})(map__36404,map__36404__$1,selected_sides,mission,attrs__$1,vec__36401,attrs,_))
).call(null,mission,weathergen.falcon.files.mission.sides),((function (map__36404,map__36404__$1,selected_sides,mission,attrs__$1,vec__36401,attrs,_){
return (function (item__29818__auto__){
var vec__36408 = javelin.core.cell_map.call(null,cljs.core.identity,javelin.core.formula.call(null,((function (map__36404,map__36404__$1,selected_sides,mission,attrs__$1,vec__36401,attrs,_){
return (function (side){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [side], null);
});})(map__36404,map__36404__$1,selected_sides,mission,attrs__$1,vec__36401,attrs,_))
).call(null,item__29818__auto__));
var side = cljs.core.nth.call(null,vec__36408,(0),null);
return weathergen.ui.common.inl.call(null,new cljs.core.Keyword(null,"css","css",1135045163),javelin.core.formula.call(null,((function (vec__36408,side,map__36404,map__36404__$1,selected_sides,mission,attrs__$1,vec__36401,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__36408,side,map__36404,map__36404__$1,selected_sides,mission,attrs__$1,vec__36401,attrs,_))
).call(null,side),hoplon.core.loop_tpl_STAR_.call(null,javelin.core.formula.call(null,((function (vec__36408,side,map__36404,map__36404__$1,selected_sides,mission,attrs__$1,vec__36401,attrs,_){
return (function (G__36412,G__36411,G__36413){
return G__36411.call(null,G__36412,G__36413);
});})(vec__36408,side,map__36404,map__36404__$1,selected_sides,mission,attrs__$1,vec__36401,attrs,_))
).call(null,mission,weathergen.falcon.files.mission.teams_for_side,side),((function (vec__36408,side,map__36404,map__36404__$1,selected_sides,mission,attrs__$1,vec__36401,attrs,_){
return (function (item__29818__auto____$1){
var vec__36414 = javelin.core.cell_map.call(null,cljs.core.identity,javelin.core.formula.call(null,((function (vec__36408,side,map__36404,map__36404__$1,selected_sides,mission,attrs__$1,vec__36401,attrs,_){
return (function (team){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [team], null);
});})(vec__36408,side,map__36404,map__36404__$1,selected_sides,mission,attrs__$1,vec__36401,attrs,_))
).call(null,item__29818__auto____$1));
var team = cljs.core.nth.call(null,vec__36414,(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__36414,team,vec__36408,side,map__36404,map__36404__$1,selected_sides,mission,attrs__$1,vec__36401,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__36414,team,vec__36408,side,map__36404,map__36404__$1,selected_sides,mission,attrs__$1,vec__36401,attrs,_))
).call(null,mission,team));
});})(vec__36408,side,map__36404,map__36404__$1,selected_sides,mission,attrs__$1,vec__36401,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__36408,side,map__36404,map__36404__$1,selected_sides,mission,attrs__$1,vec__36401,attrs,_){
return (function (G__36417,G__36418,G__36419,G__36420){
return G__36417.call(null,G__36418,G__36419.call(null,G__36420));
});})(vec__36408,side,map__36404,map__36404__$1,selected_sides,mission,attrs__$1,vec__36401,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__36408,side,map__36404,map__36404__$1,selected_sides,mission,attrs__$1,vec__36401,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__36408,side,map__36404,map__36404__$1,selected_sides,mission,attrs__$1,vec__36401,attrs,_))
);
})()));
});})(map__36404,map__36404__$1,selected_sides,mission,attrs__$1,vec__36401,attrs,_))
));
};
var weathergen$ui$common$side_selector = function (var_args){
var args__29774__auto__ = null;
if (arguments.length > 0) {
var G__36421__i = 0, G__36421__a = new Array(arguments.length -  0);
while (G__36421__i < G__36421__a.length) {G__36421__a[G__36421__i] = arguments[G__36421__i + 0]; ++G__36421__i;}
  args__29774__auto__ = new cljs.core.IndexedSeq(G__36421__a,0,null);
} 
return weathergen$ui$common$side_selector__delegate.call(this,args__29774__auto__);};
weathergen$ui$common$side_selector.cljs$lang$maxFixedArity = 0;
weathergen$ui$common$side_selector.cljs$lang$applyTo = (function (arglist__36422){
var args__29774__auto__ = cljs.core.seq(arglist__36422);
return weathergen$ui$common$side_selector__delegate(args__29774__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__29774__auto__){
var vec__36457 = hoplon.core.parse_args.call(null,args__29774__auto__);
var attrs = cljs.core.nth.call(null,vec__36457,(0),null);
var _ = cljs.core.nth.call(null,vec__36457,(1),null);
var map__36460 = attrs;
var map__36460__$1 = ((((!((map__36460 == null)))?((((map__36460.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36460.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36460):map__36460);
var value = cljs.core.get.call(null,map__36460__$1,new cljs.core.Keyword(null,"value","value",305978217));
var choices = cljs.core.get.call(null,map__36460__$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__36460,map__36460__$1,value,choices,attrs__$1,vec__36457,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__36460,map__36460__$1,value,choices,attrs__$1,vec__36457,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__36460,map__36460__$1,value,choices,attrs__$1,vec__36457,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__36460,map__36460__$1,value,choices,attrs__$1,vec__36457,attrs,_){
return (function (p1__36423_SHARP_){
return cljs.core._EQ_.call(null,value__$1,new cljs.core.Keyword(null,"value","value",305978217).cljs$core$IFn$_invoke$arity$1(p1__36423_SHARP_));
});})(s,indexed,by_index,map__36460,map__36460__$1,value,choices,attrs__$1,vec__36457,attrs,_))
,cljs.core.vals.call(null,indexed))));
});})(s,indexed,by_index,map__36460,map__36460__$1,value,choices,attrs__$1,vec__36457,attrs,_))
).call(null,value),new cljs.core.Keyword(null,"change","change",-1163046502),((function (s,indexed,by_index,map__36460,map__36460__$1,value,choices,attrs__$1,vec__36457,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__36460,map__36460__$1,value,choices,attrs__$1,vec__36457,attrs,_))
),(function (){var iter__24200__auto__ = ((function (s,indexed,by_index,map__36460,map__36460__$1,value,choices,attrs__$1,vec__36457,attrs,_){
return (function weathergen$ui$common$dropdown_$_iter__36462(s__36463){
return (new cljs.core.LazySeq(null,((function (s,indexed,by_index,map__36460,map__36460__$1,value,choices,attrs__$1,vec__36457,attrs,_){
return (function (){
var s__36463__$1 = s__36463;
while(true){
var temp__5278__auto__ = cljs.core.seq.call(null,s__36463__$1);
if(temp__5278__auto__){
var s__36463__$2 = temp__5278__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__36463__$2)){
var c__24198__auto__ = cljs.core.chunk_first.call(null,s__36463__$2);
var size__24199__auto__ = cljs.core.count.call(null,c__24198__auto__);
var b__36465 = cljs.core.chunk_buffer.call(null,size__24199__auto__);
if((function (){var i__36464 = (0);
while(true){
if((i__36464 < size__24199__auto__)){
var vec__36478 = cljs.core._nth.call(null,c__24198__auto__,i__36464);
var index = cljs.core.nth.call(null,vec__36478,(0),null);
var choice = cljs.core.nth.call(null,vec__36478,(1),null);
cljs.core.chunk_append.call(null,b__36465,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__36464,vec__36478,index,choice,c__24198__auto__,size__24199__auto__,b__36465,s__36463__$2,temp__5278__auto__,s,indexed,by_index,map__36460,map__36460__$1,value,choices,attrs__$1,vec__36457,attrs,_){
return (function (G__36483,G__36481,G__36482){
return G__36481.call(null,G__36482,new cljs.core.Keyword(null,"value","value",305978217).cljs$core$IFn$_invoke$arity$1(G__36483));
});})(i__36464,vec__36478,index,choice,c__24198__auto__,size__24199__auto__,b__36465,s__36463__$2,temp__5278__auto__,s,indexed,by_index,map__36460,map__36460__$1,value,choices,attrs__$1,vec__36457,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__36490 = (i__36464 + (1));
i__36464 = G__36490;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__36465),weathergen$ui$common$dropdown_$_iter__36462.call(null,cljs.core.chunk_rest.call(null,s__36463__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__36465),null);
}
} else {
var vec__36484 = cljs.core.first.call(null,s__36463__$2);
var index = cljs.core.nth.call(null,vec__36484,(0),null);
var choice = cljs.core.nth.call(null,vec__36484,(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__36484,index,choice,s__36463__$2,temp__5278__auto__,s,indexed,by_index,map__36460,map__36460__$1,value,choices,attrs__$1,vec__36457,attrs,_){
return (function (G__36489,G__36487,G__36488){
return G__36487.call(null,G__36488,new cljs.core.Keyword(null,"value","value",305978217).cljs$core$IFn$_invoke$arity$1(G__36489));
});})(vec__36484,index,choice,s__36463__$2,temp__5278__auto__,s,indexed,by_index,map__36460,map__36460__$1,value,choices,attrs__$1,vec__36457,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__36462.call(null,cljs.core.rest.call(null,s__36463__$2)));
}
} else {
return null;
}
break;
}
});})(s,indexed,by_index,map__36460,map__36460__$1,value,choices,attrs__$1,vec__36457,attrs,_))
,null,null));
});})(s,indexed,by_index,map__36460,map__36460__$1,value,choices,attrs__$1,vec__36457,attrs,_))
;
return iter__24200__auto__.call(null,indexed);
})());

return s;
};
var weathergen$ui$common$dropdown = function (var_args){
var args__29774__auto__ = null;
if (arguments.length > 0) {
var G__36491__i = 0, G__36491__a = new Array(arguments.length -  0);
while (G__36491__i < G__36491__a.length) {G__36491__a[G__36491__i] = arguments[G__36491__i + 0]; ++G__36491__i;}
  args__29774__auto__ = new cljs.core.IndexedSeq(G__36491__a,0,null);
} 
return weathergen$ui$common$dropdown__delegate.call(this,args__29774__auto__);};
weathergen$ui$common$dropdown.cljs$lang$maxFixedArity = 0;
weathergen$ui$common$dropdown.cljs$lang$applyTo = (function (arglist__36492){
var args__29774__auto__ = cljs.core.seq(arglist__36492);
return weathergen$ui$common$dropdown__delegate(args__29774__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__29774__auto__){
var vec__36515 = hoplon.core.parse_args.call(null,args__29774__auto__);
var attrs = cljs.core.nth.call(null,vec__36515,(0),null);
var _ = cljs.core.nth.call(null,vec__36515,(1),null);
var map__36518 = attrs;
var map__36518__$1 = ((((!((map__36518 == null)))?((((map__36518.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36518.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36518):map__36518);
var value = cljs.core.get.call(null,map__36518__$1,new cljs.core.Keyword(null,"value","value",305978217));
var choices = cljs.core.get.call(null,map__36518__$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__36518,map__36518__$1,value,choices,attrs__$1,vec__36515,attrs,_){
return (function (choices_STAR___$1){
return cljs.core.map_indexed.call(null,((function (choices_STAR_,map__36518,map__36518__$1,value,choices,attrs__$1,vec__36515,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__36518,map__36518__$1,value,choices,attrs__$1,vec__36515,attrs,_))
,choices_STAR___$1);
});})(choices_STAR_,map__36518,map__36518__$1,value,choices,attrs__$1,vec__36515,attrs,_))
).call(null,choices_STAR_);
var by_index = javelin.core.formula.call(null,((function (choices_STAR_,indexed,map__36518,map__36518__$1,value,choices,attrs__$1,vec__36515,attrs,_){
return (function (indexed__$1){
return cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,indexed__$1);
});})(choices_STAR_,indexed,map__36518,map__36518__$1,value,choices,attrs__$1,vec__36515,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__36518,map__36518__$1,value,choices,attrs__$1,vec__36515,attrs,_){
return (function (item__29818__auto__){
var vec__36520 = javelin.core.cell_map.call(null,cljs.core.identity,javelin.core.formula.call(null,((function (choices_STAR_,indexed,by_index,name,map__36518,map__36518__$1,value,choices,attrs__$1,vec__36515,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__36518,map__36518__$1,value,choices,attrs__$1,vec__36515,attrs,_))
).call(null,item__29818__auto__));
var item = cljs.core.nth.call(null,vec__36520,(0),null);
var vec__36529 = javelin.core.cell_map.call(null,cljs.core.identity,javelin.core.formula.call(null,((function (vec__36520,item,choices_STAR_,indexed,by_index,name,map__36518,map__36518__$1,value,choices,attrs__$1,vec__36515,attrs,_){
return (function (p__36532){
var vec__36533 = p__36532;
var index = cljs.core.nth.call(null,vec__36533,(0),null);
var choice = cljs.core.nth.call(null,vec__36533,(1),null);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [choice,index], null);
});})(vec__36520,item,choices_STAR_,indexed,by_index,name,map__36518,map__36518__$1,value,choices,attrs__$1,vec__36515,attrs,_))
).call(null,item));
var choice = cljs.core.nth.call(null,vec__36529,(0),null);
var index = cljs.core.nth.call(null,vec__36529,(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__36529,choice,index,vec__36520,item,choices_STAR_,indexed,by_index,name,map__36518,map__36518__$1,value,choices,attrs__$1,vec__36515,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__36529,choice,index,vec__36520,item,choices_STAR_,indexed,by_index,name,map__36518,map__36518__$1,value,choices,attrs__$1,vec__36515,attrs,_))
).call(null,value,choice),new cljs.core.Keyword(null,"change","change",-1163046502),((function (id,vec__36529,choice,index,vec__36520,item,choices_STAR_,indexed,by_index,name,map__36518,map__36518__$1,value,choices,attrs__$1,vec__36515,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__36529,choice,index,vec__36520,item,choices_STAR_,indexed,by_index,name,map__36518,map__36518__$1,value,choices,attrs__$1,vec__36515,attrs,_))
),hoplon.core.label.call(null,new cljs.core.Keyword(null,"for","for",-1323786319),id,javelin.core.formula.call(null,((function (id,vec__36529,choice,index,vec__36520,item,choices_STAR_,indexed,by_index,name,map__36518,map__36518__$1,value,choices,attrs__$1,vec__36515,attrs,_){
return (function (G__36536){
return new cljs.core.Keyword(null,"label","label",1718410804).cljs$core$IFn$_invoke$arity$1(G__36536);
});})(id,vec__36529,choice,index,vec__36520,item,choices_STAR_,indexed,by_index,name,map__36518,map__36518__$1,value,choices,attrs__$1,vec__36515,attrs,_))
).call(null,choice)));
});})(choices_STAR_,indexed,by_index,name,map__36518,map__36518__$1,value,choices,attrs__$1,vec__36515,attrs,_))
));
};
var weathergen$ui$common$radio_group = function (var_args){
var args__29774__auto__ = null;
if (arguments.length > 0) {
var G__36537__i = 0, G__36537__a = new Array(arguments.length -  0);
while (G__36537__i < G__36537__a.length) {G__36537__a[G__36537__i] = arguments[G__36537__i + 0]; ++G__36537__i;}
  args__29774__auto__ = new cljs.core.IndexedSeq(G__36537__a,0,null);
} 
return weathergen$ui$common$radio_group__delegate.call(this,args__29774__auto__);};
weathergen$ui$common$radio_group.cljs$lang$maxFixedArity = 0;
weathergen$ui$common$radio_group.cljs$lang$applyTo = (function (arglist__36538){
var args__29774__auto__ = cljs.core.seq(arglist__36538);
return weathergen$ui$common$radio_group__delegate(args__29774__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 args36539 = [];
var len__24559__auto___36542 = arguments.length;
var i__24560__auto___36543 = (0);
while(true){
if((i__24560__auto___36543 < len__24559__auto___36542)){
args36539.push((arguments[i__24560__auto___36543]));

var G__36544 = (i__24560__auto___36543 + (1));
i__24560__auto___36543 = G__36544;
continue;
} else {
}
break;
}

var G__36541 = args36539.length;
switch (G__36541) {
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(args36539.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___36547 = arguments.length;
var i__24560__auto___36548 = (0);
while(true){
if((i__24560__auto___36548 < len__24559__auto___36547)){
args__24566__auto__.push((arguments[i__24560__auto___36548]));

var G__36549 = (i__24560__auto___36548 + (1));
i__24560__auto___36548 = G__36549;
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 (seq36546){
return weathergen.ui.common.svg_xform_combine.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq36546));
});

var interval_value_36550 = 0.45;
var interval_36551 = [cljs.core.str.cljs$core$IFn$_invoke$arity$1(interval_value_36550),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_36551,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_36551], 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_36551,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_36550 / 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 args36552 = [];
var len__24559__auto___36558 = arguments.length;
var i__24560__auto___36559 = (0);
while(true){
if((i__24560__auto___36559 < len__24559__auto___36558)){
args36552.push((arguments[i__24560__auto___36559]));

var G__36560 = (i__24560__auto___36559 + (1));
i__24560__auto___36559 = G__36560;
continue;
} else {
}
break;
}

var G__36554 = args36552.length;
switch (G__36554) {
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(args36552.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__36555,content){
var map__36556 = p__36555;
var map__36556__$1 = ((((!((map__36556 == null)))?((((map__36556.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__36556.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__36556):map__36556);
var margin_top = cljs.core.get.call(null,map__36556__$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);
}));
});
