// Compiled by ClojureScript 1.9.562 {}
goog.provide('weathergen.falcon.files.mission');
goog.require('cljs.core');
goog.require('clojure.set');
goog.require('clojure.string');
goog.require('octet.core');
goog.require('taoensso.timbre');
goog.require('weathergen.coordinates');
goog.require('weathergen.falcon.constants');
goog.require('weathergen.falcon.files');
goog.require('weathergen.falcon.files.images');
goog.require('weathergen.filesystem');
goog.require('weathergen.lzss');
goog.require('weathergen.math');
goog.require('weathergen.progress');
goog.require('weathergen.time');
goog.require('weathergen.util');
/**
 * Given an entity, return its entry in the class table.
 */
weathergen.falcon.files.mission.class_table_entry = (function weathergen$falcon$files$mission$class_table_entry(mission,entity){
return cljs.core.nth.call(null,new cljs.core.Keyword(null,"class-table","class-table",207400992).cljs$core$IFn$_invoke$arity$1(mission),(new cljs.core.Keyword(null,"entity-type","entity-type",-1957300125).cljs$core$IFn$_invoke$arity$1(entity) - weathergen.falcon.constants.VU_LAST_ENTITY_TYPE));
});
/**
 * Retrieves the unit class info (the most important elements of which
 *   are things like domain and type) for a given unit type.
 */
weathergen.falcon.files.mission.class_info = (function weathergen$falcon$files$mission$class_info(p__34860,type_id){
var map__34863 = p__34860;
var map__34863__$1 = ((((!((map__34863 == null)))?((((map__34863.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__34863.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__34863):map__34863);
var mission = map__34863__$1;
var class_table = cljs.core.get.call(null,map__34863__$1,new cljs.core.Keyword(null,"class-table","class-table",207400992));
var class_entry = cljs.core.nth.call(null,class_table,(type_id - weathergen.falcon.constants.VU_LAST_ENTITY_TYPE));
return new cljs.core.Keyword(null,"class-info","class-info",-467052058).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"vu-class-data","vu-class-data",-1868219799).cljs$core$IFn$_invoke$arity$1(class_entry));
});
/**
 * Returns an objective's entry from the objectives class table.
 */
weathergen.falcon.files.mission.objective_class_entry = (function weathergen$falcon$files$mission$objective_class_entry(mission,objective){
return cljs.core.nth.call(null,new cljs.core.Keyword(null,"objective-class-data","objective-class-data",-2036255156).cljs$core$IFn$_invoke$arity$1(mission),new cljs.core.Keyword(null,"data-pointer","data-pointer",-1957576382).cljs$core$IFn$_invoke$arity$1(weathergen.falcon.files.mission.class_table_entry.call(null,mission,objective)));
});
/**
 * Returns a unit's entry from the unit class table.
 */
weathergen.falcon.files.mission.unit_class_entry = (function weathergen$falcon$files$mission$unit_class_entry(mission,unit){
return cljs.core.nth.call(null,new cljs.core.Keyword(null,"unit-class-data","unit-class-data",2122324209).cljs$core$IFn$_invoke$arity$1(mission),new cljs.core.Keyword(null,"data-pointer","data-pointer",-1957576382).cljs$core$IFn$_invoke$arity$1(weathergen.falcon.files.mission.class_table_entry.call(null,mission,unit)));
});
/**
 * Returns the class data entry of a weapon.
 */
weathergen.falcon.files.mission.weapon_class_entry = (function weathergen$falcon$files$mission$weapon_class_entry(mission,id){
var map__34867 = mission;
var map__34867__$1 = ((((!((map__34867 == null)))?((((map__34867.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__34867.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__34867):map__34867);
var weapon_class_data = cljs.core.get.call(null,map__34867__$1,new cljs.core.Keyword(null,"weapon-class-data","weapon-class-data",-1828241433));
return cljs.core.nth.call(null,weapon_class_data,id);
});
/**
 * Return a seq of the units in `mission` that are not inactive.
 */
weathergen.falcon.files.mission.active_units = (function weathergen$falcon$files$mission$active_units(mission){
return cljs.core.remove.call(null,(function (p1__34869_SHARP_){
return new cljs.core.Keyword(null,"inactive","inactive",-306247616).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"unit-flags","unit-flags",-1443684773).cljs$core$IFn$_invoke$arity$1(p1__34869_SHARP_));
}),new cljs.core.Keyword(null,"units","units",-533089095).cljs$core$IFn$_invoke$arity$1(mission));
});
/**
 * Given an objective, return its numeric type.
 */
weathergen.falcon.files.mission.objective_type = (function weathergen$falcon$files$mission$objective_type(mission,objective){
return new cljs.core.Keyword(null,"type","type",1174270348).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"class-info","class-info",-467052058).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"vu-class-data","vu-class-data",-1868219799).cljs$core$IFn$_invoke$arity$1(weathergen.falcon.files.mission.class_table_entry.call(null,mission,objective))));
});
/**
 * Given an objective, returns the name of its type. E.g. 'Bridge'.
 */
weathergen.falcon.files.mission.objective_type_name = (function weathergen$falcon$files$mission$objective_type_name(mission,objective){
return cljs.core.get_in.call(null,mission,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"strings","strings",-2055406807),new cljs.core.Keyword(null,"objective-type-names","objective-type-names",-2115502438),weathergen.falcon.files.mission.objective_type.call(null,mission,objective)], null));
});
/**
 * Find an objective by the criteria given, or nil if the item can't be found.
 */
weathergen.falcon.files.mission.find_objective = (function weathergen$falcon$files$mission$find_objective(mission,criteria,value){
var pred__34874 = cljs.core._EQ_;
var expr__34875 = criteria;
if(cljs.core.truth_(pred__34874.call(null,new cljs.core.Keyword(null,"id","id",-1388402092),expr__34875))){
return cljs.core.first.call(null,cljs.core.filter.call(null,((function (pred__34874,expr__34875){
return (function (p1__34870_SHARP_){
return cljs.core._EQ_.call(null,new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(p1__34870_SHARP_),value);
});})(pred__34874,expr__34875))
,new cljs.core.Keyword(null,"objectives","objectives",933939509).cljs$core$IFn$_invoke$arity$1(mission)));
} else {
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("No matching clause: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(expr__34875)].join('')));
}
});
/**
 * Find a unit by the criteria given, or nil if the item can't be found.
 */
weathergen.falcon.files.mission.find_unit = (function weathergen$falcon$files$mission$find_unit(mission,criteria,value){
var pred__34881 = cljs.core._EQ_;
var expr__34882 = criteria;
if(cljs.core.truth_(pred__34881.call(null,new cljs.core.Keyword(null,"id","id",-1388402092),expr__34882))){
return cljs.core.first.call(null,cljs.core.filter.call(null,((function (pred__34881,expr__34882){
return (function (p1__34877_SHARP_){
return cljs.core._EQ_.call(null,new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(p1__34877_SHARP_),value);
});})(pred__34881,expr__34882))
,weathergen.falcon.files.mission.active_units.call(null,mission)));
} else {
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("No matching clause: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(expr__34882)].join('')));
}
});
/**
 * Returns the name of the given objective.
 */
weathergen.falcon.files.mission.objective_name = (function weathergen$falcon$files$mission$objective_name(mission,objective){
var map__34886 = mission;
var map__34886__$1 = ((((!((map__34886 == null)))?((((map__34886.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__34886.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__34886):map__34886);
var class_table = cljs.core.get.call(null,map__34886__$1,new cljs.core.Keyword(null,"class-table","class-table",207400992));
var objective_class_data = cljs.core.get.call(null,map__34886__$1,new cljs.core.Keyword(null,"objective-class-data","objective-class-data",-2036255156));
var names = cljs.core.get.call(null,map__34886__$1,new cljs.core.Keyword(null,"names","names",-1943074658));
var strings = cljs.core.get.call(null,map__34886__$1,new cljs.core.Keyword(null,"strings","strings",-2055406807));
var name_id = new cljs.core.Keyword(null,"name-id","name-id",-279275372).cljs$core$IFn$_invoke$arity$1(objective);
if((name_id == null)){
return "N/A";
} else {
if(!((name_id === (0)))){
var or__23148__auto__ = names.call(null,name_id);
if(cljs.core.truth_(or__23148__auto__)){
return or__23148__auto__;
} else {
var or__23148__auto____$1 = new cljs.core.Keyword("weathergen.falcon.files.mission","name","weathergen.falcon.files.mission/name",1235339975).cljs$core$IFn$_invoke$arity$1(objective);
if(cljs.core.truth_(or__23148__auto____$1)){
return or__23148__auto____$1;
} else {
return "Unnamed objective";
}
}
} else {
var temp__5276__auto__ = weathergen.falcon.files.mission.find_objective.call(null,mission,new cljs.core.Keyword(null,"id","id",-1388402092),new cljs.core.Keyword(null,"parent","parent",-878878779).cljs$core$IFn$_invoke$arity$1(objective));
if(cljs.core.truth_(temp__5276__auto__)){
var parent = temp__5276__auto__;
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(names.call(null,new cljs.core.Keyword(null,"name-id","name-id",-279275372).cljs$core$IFn$_invoke$arity$1(parent))),cljs.core.str.cljs$core$IFn$_invoke$arity$1(" "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(weathergen.falcon.files.mission.objective_type_name.call(null,mission,objective))].join('');
} else {
return names.call(null,(0));
}

}
}
});
/**
 * Returns the appropriate ordinal suffix for a given number. I.e. "st" for 1, to give "1st".
 */
weathergen.falcon.files.mission.ordinal_suffix = (function weathergen$falcon$files$mission$ordinal_suffix(mission,n){
var strings = new cljs.core.Keyword(null,"fn","fn",-1175266204).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"strings","strings",-2055406807).cljs$core$IFn$_invoke$arity$1(mission));
if((cljs.core._EQ_.call(null,(1),cljs.core.mod.call(null,n,(10)))) && (cljs.core.not_EQ_.call(null,n,(11)))){
return strings.call(null,(15));
} else {
if((cljs.core._EQ_.call(null,(2),cljs.core.mod.call(null,n,(10)))) && (cljs.core.not_EQ_.call(null,n,(12)))){
return strings.call(null,(16));
} else {
if((cljs.core._EQ_.call(null,(3),cljs.core.mod.call(null,n,(10)))) && (cljs.core.not_EQ_.call(null,n,(13)))){
return strings.call(null,(17));
} else {
return strings.call(null,(18));

}
}
}
});
/**
 * Returns true if the coll1 and coll2 have corresponding elements
 *   equal, ignoring any excess.
 */
weathergen.falcon.files.mission.partial_EQ_ = (function weathergen$falcon$files$mission$partial_EQ_(coll1,coll2){
return cljs.core.every_QMARK_.call(null,cljs.core.identity,cljs.core.map.call(null,cljs.core._EQ_,coll1,coll2));
});
/**
 * Returns the size portion of a unit name
 */
weathergen.falcon.files.mission.get_size_name = (function weathergen$falcon$files$mission$get_size_name(mission,unit){
var map__34895 = unit;
var map__34895__$1 = ((((!((map__34895 == null)))?((((map__34895.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__34895.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__34895):map__34895);
var type_id = cljs.core.get.call(null,map__34895__$1,new cljs.core.Keyword(null,"type-id","type-id",2030062700));
var map__34896 = weathergen.falcon.files.mission.class_info.call(null,mission,type_id);
var map__34896__$1 = ((((!((map__34896 == null)))?((((map__34896.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__34896.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__34896):map__34896);
var type = cljs.core.get.call(null,map__34896__$1,new cljs.core.Keyword(null,"type","type",1174270348));
var domain = cljs.core.get.call(null,map__34896__$1,new cljs.core.Keyword(null,"domain","domain",1847214937));
var strings = new cljs.core.Keyword(null,"fn","fn",-1175266204).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"strings","strings",-2055406807).cljs$core$IFn$_invoke$arity$1(mission));
return strings.call(null,(function (){var pred__34899 = weathergen.falcon.files.mission.partial_EQ_;
var expr__34900 = new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [domain,type], null);
if(cljs.core.truth_(pred__34899.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [weathergen.falcon.constants.DOMAIN_AIR,weathergen.falcon.constants.TYPE_SQUADRON], null),expr__34900))){
return (610);
} else {
if(cljs.core.truth_(pred__34899.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [weathergen.falcon.constants.DOMAIN_AIR,weathergen.falcon.constants.TYPE_FLIGHT], null),expr__34900))){
return (611);
} else {
if(cljs.core.truth_(pred__34899.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [weathergen.falcon.constants.DOMAIN_AIR,weathergen.falcon.constants.TYPE_PACKAGE], null),expr__34900))){
return (612);
} else {
if(cljs.core.truth_(pred__34899.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [weathergen.falcon.constants.DOMAIN_LAND,weathergen.falcon.constants.TYPE_BRIGADE], null),expr__34900))){
return (614);
} else {
if(cljs.core.truth_(pred__34899.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [weathergen.falcon.constants.DOMAIN_LAND,weathergen.falcon.constants.TYPE_BATTALION], null),expr__34900))){
return (615);
} else {
if(cljs.core.truth_(pred__34899.call(null,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [weathergen.falcon.constants.DOMAIN_SEA], null),expr__34900))){
return (616);
} else {
return (617);
}
}
}
}
}
}
})());
});
/**
 * Returns a human-readable name for the given unit
 */
weathergen.falcon.files.mission.unit_name = (function weathergen$falcon$files$mission$unit_name(mission,unit){
var map__34917 = unit;
var map__34917__$1 = ((((!((map__34917 == null)))?((((map__34917.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__34917.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__34917):map__34917);
var name_id = cljs.core.get.call(null,map__34917__$1,new cljs.core.Keyword(null,"name-id","name-id",-279275372));
var type_id = cljs.core.get.call(null,map__34917__$1,new cljs.core.Keyword(null,"type-id","type-id",2030062700));
var map__34918 = weathergen.falcon.files.mission.unit_class_entry.call(null,mission,unit);
var map__34918__$1 = ((((!((map__34918 == null)))?((((map__34918.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__34918.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__34918):map__34918);
var name = cljs.core.get.call(null,map__34918__$1,new cljs.core.Keyword(null,"name","name",1843675177));
var map__34919 = weathergen.falcon.files.mission.class_info.call(null,mission,type_id);
var map__34919__$1 = ((((!((map__34919 == null)))?((((map__34919.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__34919.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__34919):map__34919);
var ci = map__34919__$1;
var domain = cljs.core.get.call(null,map__34919__$1,new cljs.core.Keyword(null,"domain","domain",1847214937));
var type = cljs.core.get.call(null,map__34919__$1,new cljs.core.Keyword(null,"type","type",1174270348));
var strings = new cljs.core.Keyword(null,"fn","fn",-1175266204).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"strings","strings",-2055406807).cljs$core$IFn$_invoke$arity$1(mission));
var pred__34923 = cljs.core._EQ_;
var expr__34924 = new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [domain,type], null);
if(cljs.core.truth_(pred__34923.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [weathergen.falcon.constants.DOMAIN_AIR,weathergen.falcon.constants.TYPE_FLIGHT], null),expr__34924))){
var map__34926 = unit;
var map__34926__$1 = ((((!((map__34926 == null)))?((((map__34926.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__34926.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__34926):map__34926);
var callsign_id = cljs.core.get.call(null,map__34926__$1,new cljs.core.Keyword(null,"callsign-id","callsign-id",501232863));
var callsign_num = cljs.core.get.call(null,map__34926__$1,new cljs.core.Keyword(null,"callsign-num","callsign-num",-1771041170));
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(strings.call(null,(weathergen.falcon.constants.FIRST_CALLSIGN_ID + callsign_id))),cljs.core.str.cljs$core$IFn$_invoke$arity$1(" "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(callsign_num)].join('');
} else {
if(cljs.core.truth_(pred__34923.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [weathergen.falcon.constants.DOMAIN_AIR,weathergen.falcon.constants.TYPE_PACKAGE], null),expr__34924))){
var map__34928 = unit;
var map__34928__$1 = ((((!((map__34928 == null)))?((((map__34928.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__34928.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__34928):map__34928);
var camp_id = cljs.core.get.call(null,map__34928__$1,new cljs.core.Keyword(null,"camp-id","camp-id",618705690));
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1("Package "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(camp_id)].join('');
} else {
var map__34930 = unit;
var map__34930__$1 = ((((!((map__34930 == null)))?((((map__34930.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__34930.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__34930):map__34930);
var name_id__$1 = cljs.core.get.call(null,map__34930__$1,new cljs.core.Keyword(null,"name-id","name-id",-279275372));
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(name_id__$1),cljs.core.str.cljs$core$IFn$_invoke$arity$1(weathergen.falcon.files.mission.ordinal_suffix.call(null,mission,name_id__$1)),cljs.core.str.cljs$core$IFn$_invoke$arity$1(" "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(name),cljs.core.str.cljs$core$IFn$_invoke$arity$1(" "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(weathergen.falcon.files.mission.get_size_name.call(null,mission,unit))].join('');
}
}
});
weathergen.falcon.files.mission.vu_id = octet.core.spec.call(null,new cljs.core.Keyword(null,"name","name",1843675177),octet.core.uint32,new cljs.core.Keyword(null,"creator","creator",-1069241724),octet.core.uint32);
weathergen.falcon.files.mission.campaign_time = (function (){
if(typeof weathergen.falcon.files.mission.t_weathergen$falcon$files$mission34932 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
 * @implements {octet.spec.ISpecSize}
*/
weathergen.falcon.files.mission.t_weathergen$falcon$files$mission34932 = (function (meta34933){
this.meta34933 = meta34933;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.mission.t_weathergen$falcon$files$mission34932.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_34934,meta34933__$1){
var self__ = this;
var _34934__$1 = this;
return (new weathergen.falcon.files.mission.t_weathergen$falcon$files$mission34932(meta34933__$1));
});

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission34932.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34934){
var self__ = this;
var _34934__$1 = this;
return self__.meta34933;
});

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission34932.prototype.octet$spec$ISpecSize$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission34932.prototype.octet$spec$ISpecSize$size$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return octet.core.size.call(null,octet.core.uint32);
});

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission34932.prototype.octet$spec$ISpec$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission34932.prototype.octet$spec$ISpec$read$arity$3 = (function (_,buff,pos){
var self__ = this;
var ___$1 = this;
var vec__34935 = octet.core.read_STAR_.call(null,buff,octet.core.uint32,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),pos], null));
var size = cljs.core.nth.call(null,vec__34935,(0),null);
var data = cljs.core.nth.call(null,vec__34935,(1),null);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [size,weathergen.time.ms__GT_campaign_time.call(null,data)], null);
});

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission34932.prototype.octet$spec$ISpec$write$arity$4 = (function (_,buff,pos,t){
var self__ = this;
var ___$1 = this;
return octet.core.write_BANG_.call(null,buff,octet.core.int32,weathergen.time.campaign_time__GT_ms.call(null,t));
});

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission34932.getBasis = (function (){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"meta34933","meta34933",1417526932,null)], null);
});

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission34932.cljs$lang$type = true;

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission34932.cljs$lang$ctorStr = "weathergen.falcon.files.mission/t_weathergen$falcon$files$mission34932";

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission34932.cljs$lang$ctorPrWriter = (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"weathergen.falcon.files.mission/t_weathergen$falcon$files$mission34932");
});

weathergen.falcon.files.mission.__GT_t_weathergen$falcon$files$mission34932 = (function weathergen$falcon$files$mission$__GT_t_weathergen$falcon$files$mission34932(meta34933){
return (new weathergen.falcon.files.mission.t_weathergen$falcon$files$mission34932(meta34933));
});

}

return (new weathergen.falcon.files.mission.t_weathergen$falcon$files$mission34932(cljs.core.PersistentArrayMap.EMPTY));
})()
;
weathergen.falcon.files.mission.vector3 = octet.core.spec.call(null,new cljs.core.Keyword(null,"x","x",2099068185),octet.core.float$,new cljs.core.Keyword(null,"y","y",-1757859776),octet.core.float$,new cljs.core.Keyword(null,"z","z",-789527183),octet.core.float$);
weathergen.falcon.files.mission.vu_entity_fields = cljs.core.PersistentVector.fromArray([new cljs.core.Keyword(null,"id","id",-1388402092),octet.core.uint16,new cljs.core.Keyword(null,"collision-type","collision-type",1031477978),octet.core.uint16,new cljs.core.Keyword(null,"collision-radius","collision-radius",2064718833),octet.core.float$,new cljs.core.Keyword(null,"class-info","class-info",-467052058),octet.core.spec.call(null,new cljs.core.Keyword(null,"domain","domain",1847214937),octet.core.ubyte,new cljs.core.Keyword(null,"class","class",-2030961996),octet.core.ubyte,new cljs.core.Keyword(null,"type","type",1174270348),octet.core.ubyte,new cljs.core.Keyword(null,"stype","stype",-63678419),octet.core.ubyte,new cljs.core.Keyword(null,"sptype","sptype",-1425026030),octet.core.ubyte,new cljs.core.Keyword(null,"owner","owner",-392611939),octet.core.ubyte,new cljs.core.Keyword(null,"field6","field6",-1844847589),octet.core.ubyte,new cljs.core.Keyword(null,"field7","field7",-882507065),octet.core.ubyte),new cljs.core.Keyword(null,"update-rate","update-rate",549997679),octet.core.uint32,new cljs.core.Keyword(null,"update-tolerance","update-tolerance",1242588651),octet.core.uint32,new cljs.core.Keyword(null,"fine-update-range","fine-update-range",-2006748049),octet.core.float$,new cljs.core.Keyword(null,"fine-update-force-range","fine-update-force-range",-703217754),octet.core.float$,new cljs.core.Keyword(null,"fine-update-multiplier","fine-update-multiplier",1301129404),octet.core.float$,new cljs.core.Keyword(null,"damage-speed","damage-speed",1800211525),octet.core.uint32,new cljs.core.Keyword(null,"hitpoints","hitpoints",-575579159),octet.core.int32,new cljs.core.Keyword(null,"major-revision-number","major-revision-number",473159511),octet.core.uint16,new cljs.core.Keyword(null,"minor-revision-number","minor-revision-number",-358429843),octet.core.uint16,new cljs.core.Keyword(null,"create-priority","create-priority",-433275059),octet.core.uint16,new cljs.core.Keyword(null,"management-domain","management-domain",-382123626),octet.core.ubyte,new cljs.core.Keyword(null,"transferable","transferable",-243006862),octet.core.ubyte,new cljs.core.Keyword(null,"private","private",-558947994),octet.core.ubyte,new cljs.core.Keyword(null,"tangible","tangible",1450746508),octet.core.ubyte,new cljs.core.Keyword(null,"collidable","collidable",232142278),octet.core.ubyte,new cljs.core.Keyword(null,"global","global",93595047),octet.core.ubyte,new cljs.core.Keyword(null,"persistent","persistent",885415113),octet.core.ubyte,new cljs.core.Keyword(null,"padding","padding",1660304693),octet.core.repeat.call(null,(3),octet.core.byte$)], true);
weathergen.falcon.files.mission.falcon4_entity_fields = new cljs.core.PersistentVector(null, 10, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"vu-class-data","vu-class-data",-1868219799),cljs.core.apply.call(null,octet.core.spec,weathergen.falcon.files.mission.vu_entity_fields),new cljs.core.Keyword(null,"vis-type","vis-type",802477693),octet.core.repeat.call(null,(7),octet.core.int16),new cljs.core.Keyword(null,"vehicle-data-index","vehicle-data-index",1750693686),octet.core.int16,new cljs.core.Keyword(null,"data-type","data-type",-326421468),octet.core.ubyte,new cljs.core.Keyword(null,"data-pointer","data-pointer",-1957576382),octet.core.int32], null);
weathergen.falcon.files.mission.camp_base_fields = new cljs.core.PersistentVector(null, 20, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"id","id",-1388402092),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"entity-type","entity-type",-1957300125),octet.core.uint16,new cljs.core.Keyword(null,"x","x",2099068185),octet.core.int16,new cljs.core.Keyword(null,"y","y",-1757859776),octet.core.int16,new cljs.core.Keyword(null,"z","z",-789527183),octet.core.float$,new cljs.core.Keyword(null,"spot-time","spot-time",644875706),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"spotted","spotted",183372374),octet.core.int16,new cljs.core.Keyword(null,"base-flags","base-flags",-1180150392),octet.core.int16,new cljs.core.Keyword(null,"owner","owner",-392611939),octet.core.ubyte,new cljs.core.Keyword(null,"camp-id","camp-id",618705690),octet.core.int16], null);
/**
 * Given a directory with a `name`.idx and `name`.wch files, return a
 *   function that given an index that will yield the string at that
 *   index, or nil if the index is not in range.
 */
weathergen.falcon.files.mission.read_strings = (function weathergen$falcon$files$mission$read_strings(dir,name){
var idx_buf = weathergen.filesystem.file_buf.call(null,weathergen.filesystem.path_combine.call(null,dir,[cljs.core.str.cljs$core$IFn$_invoke$arity$1(name),cljs.core.str.cljs$core$IFn$_invoke$arity$1(".idx")].join('')));
var _STAR_byte_order_STAR_34939 = octet.buffer._STAR_byte_order_STAR_;
octet.buffer._STAR_byte_order_STAR_ = new cljs.core.Keyword(null,"little-endian","little-endian",1877303413);

try{var n = octet.core.read.call(null,idx_buf,octet.core.uint16);
var indices = octet.core.read.call(null,idx_buf,octet.core.repeat.call(null,n,octet.core.uint16),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),(2)], null));
var strings = weathergen.filesystem.file_text.call(null,weathergen.filesystem.path_combine.call(null,dir,[cljs.core.str.cljs$core$IFn$_invoke$arity$1(name),cljs.core.str.cljs$core$IFn$_invoke$arity$1(".wch")].join('')));
return ((function (n,indices,strings,_STAR_byte_order_STAR_34939,idx_buf){
return (function (idx){
if((idx < (n - (1)))){
return cljs.core.subs.call(null,strings,cljs.core.nth.call(null,indices,idx),((cljs.core._EQ_.call(null,idx,(n - (1))))?cljs.core.count.call(null,strings):cljs.core.nth.call(null,indices,(idx + (1)))));
} else {
return null;
}
});
;})(n,indices,strings,_STAR_byte_order_STAR_34939,idx_buf))
}finally {octet.buffer._STAR_byte_order_STAR_ = _STAR_byte_order_STAR_34939;
}});
/**
 * Reads the strings.idx/wch file from the campaign directory and
 *   returns a map with the strings data. Also returns, under the `:fn`
 *   key, a function that will read any string given its index .
 */
weathergen.falcon.files.mission.read_strings_file = (function weathergen$falcon$files$mission$read_strings_file(campaign_dir){
var strings = weathergen.falcon.files.mission.read_strings.call(null,campaign_dir,"strings");
var indexed = ((function (strings){
return (function (start,count){
return cljs.core.into.call(null,cljs.core.sorted_map.call(null),cljs.core.map_indexed.call(null,cljs.core.vector,cljs.core.map.call(null,strings,cljs.core.range.call(null,start,(start + count)))));
});})(strings))
;
return cljs.core.PersistentHashMap.fromArrays([new cljs.core.Keyword(null,"country-names","country-names",-1652413855),new cljs.core.Keyword(null,"fn","fn",-1175266204),new cljs.core.Keyword(null,"ground-stype-names","ground-stype-names",-543566554),new cljs.core.Keyword(null,"air-stype-names","air-stype-names",-1744167443),new cljs.core.Keyword(null,"time-compression-names","time-compression-names",-311196976),new cljs.core.Keyword(null,"unit-name-format","unit-name-format",-1907370252),new cljs.core.Keyword(null,"waypoint-type-names","waypoint-type-names",719960758),new cljs.core.Keyword(null,"objective-type-names","objective-type-names",-2115502438),new cljs.core.Keyword(null,"camera-label-names","camera-label-names",-192056963),new cljs.core.Keyword(null,"mission-type-names","mission-type-names",-1426382657),new cljs.core.Keyword(null,"naval-stype-names","naval-stype-names",140822175)],[indexed.call(null,(40),weathergen.falcon.constants.NUM_COUNS),strings,indexed.call(null,(560),(20)),indexed.call(null,(540),(20)),indexed.call(null,(75),(5)),strings.call(null,(58)),indexed.call(null,(350),weathergen.falcon.constants.WP_LAST),indexed.call(null,(500),weathergen.falcon.constants.MAXIMUM_OBJTYPES),indexed.call(null,(60),weathergen.falcon.constants.NUM_CAMERA_LABELS),indexed.call(null,(300),weathergen.falcon.constants.AMIS_OTHER),indexed.call(null,(580),(20))]);
});
weathergen.falcon.files.mission.unit_class_data = octet.core.spec.call(null,new cljs.core.Keyword(null,"index","index",-1531685915),octet.core.int32,new cljs.core.Keyword(null,"num-elements","num-elements",1960422107),octet.core.repeat.call(null,weathergen.falcon.constants.VEHICLE_GROUPS_PER_UNIT,octet.core.int32),new cljs.core.Keyword(null,"vehicle-type","vehicle-type",-362045068),octet.core.repeat.call(null,weathergen.falcon.constants.VEHICLE_GROUPS_PER_UNIT,octet.core.int16),new cljs.core.Keyword(null,"vehicle-class","vehicle-class",-1789622839),octet.core.repeat.call(null,weathergen.falcon.constants.VEHICLE_GROUPS_PER_UNIT,octet.core.repeat.call(null,(8),octet.core.ubyte)),new cljs.core.Keyword(null,"flags","flags",1775418075),octet.core.uint16,new cljs.core.Keyword(null,"name","name",1843675177),weathergen.falcon.files.fixed_string.call(null,(20)),new cljs.core.Keyword(null,"padding","padding",1660304693),octet.core.int16,new cljs.core.Keyword(null,"movement-type","movement-type",-1340819145),octet.core.int32,new cljs.core.Keyword(null,"movement-speed","movement-speed",-1779674971),octet.core.int16,new cljs.core.Keyword(null,"max-range","max-range",623016397),octet.core.int16,new cljs.core.Keyword(null,"fuel","fuel",10405485),octet.core.int32,new cljs.core.Keyword(null,"rate","rate",-1428659698),octet.core.int16,new cljs.core.Keyword(null,"pt-data-index","pt-data-index",-54255967),octet.core.int16,new cljs.core.Keyword(null,"scores","scores",-1267421800),octet.core.repeat.call(null,weathergen.falcon.constants.MAXIMUM_ROLES,octet.core.ubyte),new cljs.core.Keyword(null,"role","role",-736691072),octet.core.ubyte,new cljs.core.Keyword(null,"hit-chance","hit-chance",-2087636980),octet.core.repeat.call(null,weathergen.falcon.constants.MOVEMENT_TYPES,octet.core.ubyte),new cljs.core.Keyword(null,"strength","strength",-415606478),octet.core.repeat.call(null,weathergen.falcon.constants.MOVEMENT_TYPES,octet.core.ubyte),new cljs.core.Keyword(null,"range","range",1639692286),octet.core.repeat.call(null,weathergen.falcon.constants.MOVEMENT_TYPES,octet.core.ubyte),new cljs.core.Keyword(null,"detection","detection",-1580072483),octet.core.repeat.call(null,weathergen.falcon.constants.MOVEMENT_TYPES,octet.core.ubyte),new cljs.core.Keyword(null,"damage-mod","damage-mod",-756867116),octet.core.repeat.call(null,(weathergen.falcon.constants.OtherDam + (1)),octet.core.ubyte),new cljs.core.Keyword(null,"radar-vehicle","radar-vehicle",-457407214),octet.core.ubyte,new cljs.core.Keyword(null,"padding2","padding2",1017532826),octet.core.byte$,new cljs.core.Keyword(null,"special-index","special-index",-545525937),octet.core.int16,new cljs.core.Keyword(null,"icon-index","icon-index",-42714286),octet.core.uint16,new cljs.core.Keyword(null,"padding3","padding3",358697252),octet.core.repeat.call(null,(2),octet.core.byte$));
weathergen.falcon.files.mission.objective_class_data = octet.core.spec.call(null,new cljs.core.Keyword(null,"index","index",-1531685915),octet.core.int16,new cljs.core.Keyword(null,"name","name",1843675177),weathergen.falcon.files.fixed_string.call(null,(20)),new cljs.core.Keyword(null,"data-rate","data-rate",-1399941497),octet.core.int16,new cljs.core.Keyword(null,"deag-distance","deag-distance",-1721226571),octet.core.int16,new cljs.core.Keyword(null,"pt-data-index","pt-data-index",-54255967),octet.core.int16,new cljs.core.Keyword(null,"detection","detection",-1580072483),octet.core.repeat.call(null,weathergen.falcon.constants.MOVEMENT_TYPES,octet.core.ubyte),new cljs.core.Keyword(null,"damage-mod","damage-mod",-756867116),octet.core.repeat.call(null,(weathergen.falcon.constants.OtherDam + (1)),octet.core.ubyte),new cljs.core.Keyword(null,"mystery","mystery",-686775643),octet.core.ubyte,new cljs.core.Keyword(null,"icon-index","icon-index",-42714286),octet.core.uint16,new cljs.core.Keyword(null,"features","features",-1146962336),octet.core.ubyte,new cljs.core.Keyword(null,"radar-feature","radar-feature",2111876796),octet.core.ubyte,new cljs.core.Keyword(null,"first-feature","first-feature",-1395776257),octet.core.int16);
weathergen.falcon.files.mission.vehicle_class_data = octet.core.spec.call(null,new cljs.core.Keyword(null,"index","index",-1531685915),octet.core.int16,new cljs.core.Keyword(null,"hit-points","hit-points",-906296276),octet.core.int16,new cljs.core.Keyword(null,"flags","flags",1775418075),octet.core.uint32,new cljs.core.Keyword(null,"name","name",1843675177),weathergen.falcon.files.fixed_string.call(null,(15)),new cljs.core.Keyword(null,"nctr","nctr",1306882980),weathergen.falcon.files.fixed_string.call(null,(5)),new cljs.core.Keyword(null,"rcs-factor","rcs-factor",-693378533),octet.core.float$,new cljs.core.Keyword(null,"max-wt","max-wt",220395483),octet.core.int32,new cljs.core.Keyword(null,"empty-wt","empty-wt",1037790536),octet.core.int32,new cljs.core.Keyword(null,"fuel-wt","fuel-wt",-1341155598),octet.core.int32,new cljs.core.Keyword(null,"fuel-econ","fuel-econ",-1774342065),octet.core.int16,new cljs.core.Keyword(null,"engine-sound","engine-sound",-1018050458),octet.core.int16,new cljs.core.Keyword(null,"high-alt","high-alt",-1378024467),octet.core.int16,new cljs.core.Keyword(null,"low-alt","low-alt",-228079593),octet.core.int16,new cljs.core.Keyword(null,"cruise-alt","cruise-alt",2005550721),octet.core.int16,new cljs.core.Keyword(null,"max-speed","max-speed",-997417461),octet.core.int16,new cljs.core.Keyword(null,"radar-type","radar-type",-1913447362),octet.core.int16,new cljs.core.Keyword(null,"number-of-pilots","number-of-pilots",-393973473),octet.core.int16,new cljs.core.Keyword(null,"rack-flags","rack-flags",-1071125122),octet.core.uint16,new cljs.core.Keyword(null,"visible-flags","visible-flags",1830152500),octet.core.uint16,new cljs.core.Keyword(null,"callsign-index","callsign-index",-2090912473),octet.core.ubyte,new cljs.core.Keyword(null,"callsign-slots","callsign-slots",-1388847774),octet.core.ubyte,new cljs.core.Keyword(null,"hit-chance","hit-chance",-2087636980),octet.core.repeat.call(null,weathergen.falcon.constants.MOVEMENT_TYPES,octet.core.ubyte),new cljs.core.Keyword(null,"strength","strength",-415606478),octet.core.repeat.call(null,weathergen.falcon.constants.MOVEMENT_TYPES,octet.core.ubyte),new cljs.core.Keyword(null,"range","range",1639692286),octet.core.repeat.call(null,weathergen.falcon.constants.MOVEMENT_TYPES,octet.core.ubyte),new cljs.core.Keyword(null,"detection","detection",-1580072483),octet.core.repeat.call(null,weathergen.falcon.constants.MOVEMENT_TYPES,octet.core.ubyte),new cljs.core.Keyword(null,"weapon","weapon",-504830232),octet.core.repeat.call(null,weathergen.falcon.constants.HARDPOINT_MAX,octet.core.int16),new cljs.core.Keyword(null,"weapons","weapons",-1983639898),octet.core.repeat.call(null,weathergen.falcon.constants.HARDPOINT_MAX,octet.core.ubyte),new cljs.core.Keyword(null,"damage-mod","damage-mod",-756867116),octet.core.repeat.call(null,(weathergen.falcon.constants.OtherDam + (1)),octet.core.ubyte),new cljs.core.Keyword(null,"mystery","mystery",-686775643),octet.core.repeat.call(null,(3),octet.core.ubyte));
weathergen.falcon.files.mission.weapon_class_data = octet.core.spec.call(null,new cljs.core.Keyword(null,"index","index",-1531685915),octet.core.int16,new cljs.core.Keyword(null,"strength","strength",-415606478),octet.core.uint16,new cljs.core.Keyword(null,"damage-type","damage-type",898770578),octet.core.uint16,new cljs.core.Keyword(null,"padding","padding",1660304693),octet.core.repeat.call(null,(2),octet.core.ubyte),new cljs.core.Keyword(null,"range","range",1639692286),octet.core.int16,new cljs.core.Keyword(null,"flags","flags",1775418075),octet.core.uint16,new cljs.core.Keyword(null,"name","name",1843675177),weathergen.falcon.files.fixed_string.call(null,(20)),new cljs.core.Keyword(null,"hit-chance","hit-chance",-2087636980),octet.core.repeat.call(null,weathergen.falcon.constants.MOVEMENT_TYPES,octet.core.ubyte),new cljs.core.Keyword(null,"fire-rate","fire-rate",-1458689931),octet.core.ubyte,new cljs.core.Keyword(null,"rariety","rariety",1749498612),octet.core.ubyte,new cljs.core.Keyword(null,"guidance-flags","guidance-flags",343892844),octet.core.uint16,new cljs.core.Keyword(null,"collective","collective",-1678283599),octet.core.ubyte,new cljs.core.Keyword(null,"padding2","padding2",1017532826),octet.core.ubyte,new cljs.core.Keyword(null,"simweap-index","simweap-index",1674222081),octet.core.int16,new cljs.core.Keyword(null,"drag-index","drag-index",-207918117),octet.core.int16,new cljs.core.Keyword(null,"blast-radius","blast-radius",796954270),octet.core.uint16,new cljs.core.Keyword(null,"radar-type","radar-type",-1913447362),octet.core.int16,new cljs.core.Keyword(null,"sim-data-idx","sim-data-idx",-713604174),octet.core.int16,new cljs.core.Keyword(null,"max-alt","max-alt",-363233306),octet.core.byte$,new cljs.core.Keyword(null,"padding3","padding3",358697252),octet.core.ubyte,new cljs.core.Keyword(null,"weight","weight",-1262796205),octet.core.uint16);
weathergen.falcon.files.mission.feature_class_data = octet.core.spec.call(null,new cljs.core.Keyword(null,"index","index",-1531685915),octet.core.int16,new cljs.core.Keyword(null,"repair-time","repair-time",699642051),octet.core.int16,new cljs.core.Keyword(null,"priority","priority",1431093715),octet.core.byte$,new cljs.core.Keyword(null,"padding1","padding1",-1028565124),octet.core.byte$,new cljs.core.Keyword(null,"flags","flags",1775418075),octet.core.uint16,new cljs.core.Keyword(null,"name","name",1843675177),weathergen.falcon.files.fixed_string.call(null,(20)),new cljs.core.Keyword(null,"hit-points","hit-points",-906296276),octet.core.int16,new cljs.core.Keyword(null,"height","height",1025178622),octet.core.int16,new cljs.core.Keyword(null,"angle","angle",1622094254),octet.core.float$,new cljs.core.Keyword(null,"radar-type","radar-type",-1913447362),octet.core.int16,new cljs.core.Keyword(null,"detection","detection",-1580072483),octet.core.repeat.call(null,weathergen.falcon.constants.MOVEMENT_TYPES,octet.core.ubyte),new cljs.core.Keyword(null,"damage-mod","damage-mod",-756867116),octet.core.repeat.call(null,(weathergen.falcon.constants.OtherDam + (1)),octet.core.ubyte),new cljs.core.Keyword(null,"padding2","padding2",1017532826),octet.core.repeat.call(null,(3),octet.core.ubyte));
weathergen.falcon.files.mission.feature_entry_data = octet.core.spec.call(null,new cljs.core.Keyword(null,"index","index",-1531685915),octet.core.int16,new cljs.core.Keyword(null,"flags","flags",1775418075),octet.core.uint16,new cljs.core.Keyword(null,"entity-class","entity-class",-1906919579),octet.core.repeat.call(null,(8),octet.core.ubyte),new cljs.core.Keyword(null,"value","value",305978217),octet.core.ubyte,new cljs.core.Keyword(null,"padding1","padding1",-1028565124),octet.core.repeat.call(null,(3),octet.core.byte$),new cljs.core.Keyword(null,"offset","offset",296498311),weathergen.falcon.files.mission.vector3,new cljs.core.Keyword(null,"facing","facing",-854439413),octet.core.int16,new cljs.core.Keyword(null,"padding2","padding2",1017532826),octet.core.repeat.call(null,(2),octet.core.byte$));
weathergen.falcon.files.mission.point_header_data = octet.core.spec.call(null,new cljs.core.Keyword(null,"obj-id","obj-id",1871733713),octet.core.int16,new cljs.core.Keyword(null,"type","type",1174270348),octet.core.ubyte,new cljs.core.Keyword(null,"count","count",2139924085),octet.core.ubyte,new cljs.core.Keyword(null,"features","features",-1146962336),octet.core.repeat.call(null,weathergen.falcon.constants.MAX_FEAT_DEPEND,octet.core.ubyte),new cljs.core.Keyword(null,"padding","padding",1660304693),octet.core.byte$,new cljs.core.Keyword(null,"data","data",-232669377),octet.core.int16,new cljs.core.Keyword(null,"sin-heading","sin-heading",-1506379307),octet.core.float$,new cljs.core.Keyword(null,"cos-heading","cos-heading",-514525192),octet.core.float$,new cljs.core.Keyword(null,"first","first",-644103046),octet.core.int16,new cljs.core.Keyword(null,"tex-idx","tex-idx",1332437579),octet.core.int16,new cljs.core.Keyword(null,"runway-num","runway-num",-1171395800),octet.core.byte$,new cljs.core.Keyword(null,"ltrt","ltrt",2069439),octet.core.byte$,new cljs.core.Keyword(null,"next-header","next-header",1386001069),octet.core.int16);
weathergen.falcon.files.mission.extension = (function weathergen$falcon$files$mission$extension(file_name){
var i = clojure.string.last_index_of.call(null,file_name,".");
return cljs.core.subs.call(null,file_name,i);
});
weathergen.falcon.files.mission.file_types = cljs.core.PersistentHashMap.fromArrays([".PLT",".OBD",".UNI",".PST",".VER",".POL",".TE",".EVT",".CMP",".TEA",".WTH",".OBJ"],[new cljs.core.Keyword(null,"pilots","pilots",353525853),new cljs.core.Keyword(null,"objective-deltas","objective-deltas",710518611),new cljs.core.Keyword(null,"units","units",-533089095),new cljs.core.Keyword(null,"persistent-objects","persistent-objects",137656263),new cljs.core.Keyword(null,"version","version",425292698),new cljs.core.Keyword(null,"primary-objectives","primary-objectives",-2010039039),new cljs.core.Keyword(null,"victory-conditions","victory-conditions",-1943285833),new cljs.core.Keyword(null,"events","events",1792552201),new cljs.core.Keyword(null,"campaign-info","campaign-info",1158908966),new cljs.core.Keyword(null,"teams","teams",1677714510),new cljs.core.Keyword(null,"weather","weather",1320452344),new cljs.core.Keyword(null,"objectives","objectives",933939509)]);
weathergen.falcon.files.mission.file_type = (function weathergen$falcon$files$mission$file_type(file_name){
return cljs.core.get.call(null,weathergen.falcon.files.mission.file_types,clojure.string.upper_case.call(null,weathergen.falcon.files.mission.extension.call(null,file_name)),new cljs.core.Keyword(null,"unknown","unknown",-935977881));
});
weathergen.falcon.files.mission.file_type_description = cljs.core.PersistentHashMap.fromArrays([new cljs.core.Keyword(null,"primary-objectives","primary-objectives",-2010039039),new cljs.core.Keyword(null,"campaign-info","campaign-info",1158908966),new cljs.core.Keyword(null,"persistent-objects","persistent-objects",137656263),new cljs.core.Keyword(null,"events","events",1792552201),new cljs.core.Keyword(null,"teams","teams",1677714510),new cljs.core.Keyword(null,"objective-deltas","objective-deltas",710518611),new cljs.core.Keyword(null,"objectives","objectives",933939509),new cljs.core.Keyword(null,"victory-conditions","victory-conditions",-1943285833),new cljs.core.Keyword(null,"weather","weather",1320452344),new cljs.core.Keyword(null,"units","units",-533089095),new cljs.core.Keyword(null,"version","version",425292698),new cljs.core.Keyword(null,"pilots","pilots",353525853)],["primary objectives","campaign info","persistent objects","events","teams","objective deltas","objectives","victory conditions","weather","units","version","pilots"]);
if(typeof weathergen.falcon.files.mission.read_embedded_file_STAR_ !== 'undefined'){
} else {
weathergen.falcon.files.mission.read_embedded_file_STAR_ = (function (){var method_table__24179__auto__ = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
var prefer_table__24180__auto__ = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
var method_cache__24181__auto__ = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
var cached_hierarchy__24182__auto__ = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
var hierarchy__24183__auto__ = cljs.core.get.call(null,cljs.core.PersistentArrayMap.EMPTY,new cljs.core.Keyword(null,"hierarchy","hierarchy",-1053470341),cljs.core.get_global_hierarchy.call(null));
return (new cljs.core.MultiFn(cljs.core.symbol.call(null,"weathergen.falcon.files.mission","read-embedded-file*"),((function (method_table__24179__auto__,prefer_table__24180__auto__,method_cache__24181__auto__,cached_hierarchy__24182__auto__,hierarchy__24183__auto__){
return (function (type,entry,buf,database){
return type;
});})(method_table__24179__auto__,prefer_table__24180__auto__,method_cache__24181__auto__,cached_hierarchy__24182__auto__,hierarchy__24183__auto__))
,new cljs.core.Keyword(null,"default","default",-1987822328),hierarchy__24183__auto__,method_table__24179__auto__,prefer_table__24180__auto__,method_cache__24181__auto__,cached_hierarchy__24182__auto__));
})();
}
weathergen.falcon.files.mission.read_embedded_file = (function weathergen$falcon$files$mission$read_embedded_file(type,entry,buf,database){
taoensso.timbre._log_BANG_.call(null,taoensso.timbre._STAR_config_STAR_,new cljs.core.Keyword(null,"debug","debug",-1608172596),"weathergen.falcon.files.mission",null,554,new cljs.core.Keyword(null,"p","p",151049309),new cljs.core.Keyword(null,"auto","auto",-566279492),(new cljs.core.Delay((function (){
return new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, ["read-embedded-file",new cljs.core.Keyword(null,"type","type",1174270348),type,new cljs.core.Keyword(null,"file-name","file-name",-1654217259),new cljs.core.Keyword(null,"file-name","file-name",-1654217259).cljs$core$IFn$_invoke$arity$1(entry)], null);
}),null)),null,-1354810189);

weathergen.progress.report.call(null,[cljs.core.str.cljs$core$IFn$_invoke$arity$1("Reading "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.get.call(null,weathergen.falcon.files.mission.file_type_description,type,"data"))].join(''));

return weathergen.falcon.files.mission.read_embedded_file_STAR_.call(null,type,entry,buf,database);
});
weathergen.falcon.files.mission.directory_entry = octet.core.spec.call(null,new cljs.core.Keyword(null,"file-name","file-name",-1654217259),weathergen.falcon.files.lstring.call(null,octet.core.ubyte),new cljs.core.Keyword(null,"offset","offset",296498311),octet.core.uint32,new cljs.core.Keyword(null,"length","length",588987862),octet.core.uint32);
/**
 * Given a path somewhere in the filesystem, figure out which theater
 *   it's in and return a map describing it.
 */
weathergen.falcon.files.mission.find_install_dir = (function weathergen$falcon$files$mission$find_install_dir(path){
var dir = weathergen.filesystem.parent.call(null,path);
while(true){
if(cljs.core.truth_(dir)){
if(cljs.core.every_QMARK_.call(null,((function (dir){
return (function (p1__34940_SHARP_){
return weathergen.filesystem.exists_QMARK_.call(null,weathergen.filesystem.path_combine.call(null,dir,p1__34940_SHARP_));
});})(dir))
,new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, ["Bin","Data","Tools","User"], null))){
return dir;
} else {
var G__34941 = weathergen.filesystem.parent.call(null,dir);
dir = G__34941;
continue;
}
} else {
return null;
}
break;
}
});
/**
 * Return the path to the campaign directory.
 */
weathergen.falcon.files.mission.campaign_dir = (function weathergen$falcon$files$mission$campaign_dir(var_args){
var args34942 = [];
var len__24369__auto___34947 = arguments.length;
var i__24370__auto___34948 = (0);
while(true){
if((i__24370__auto___34948 < len__24369__auto___34947)){
args34942.push((arguments[i__24370__auto___34948]));

var G__34949 = (i__24370__auto___34948 + (1));
i__24370__auto___34948 = G__34949;
continue;
} else {
}
break;
}

var G__34944 = args34942.length;
switch (G__34944) {
case 1:
return weathergen.falcon.files.mission.campaign_dir.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return weathergen.falcon.files.mission.campaign_dir.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(args34942.length)].join('')));

}
});

weathergen.falcon.files.mission.campaign_dir.cljs$core$IFn$_invoke$arity$1 = (function (mission){
var map__34945 = mission;
var map__34945__$1 = ((((!((map__34945 == null)))?((((map__34945.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__34945.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__34945):map__34945);
var installation = cljs.core.get.call(null,map__34945__$1,new cljs.core.Keyword(null,"installation","installation",943147954));
var theater = cljs.core.get.call(null,map__34945__$1,new cljs.core.Keyword(null,"theater","theater",258922071));
return weathergen.falcon.files.mission.campaign_dir.call(null,installation,theater);
});

weathergen.falcon.files.mission.campaign_dir.cljs$core$IFn$_invoke$arity$2 = (function (installation,theater){
return weathergen.filesystem.path_combine.call(null,new cljs.core.Keyword(null,"data-dir","data-dir",2038801936).cljs$core$IFn$_invoke$arity$1(installation),new cljs.core.Keyword(null,"campaign-dir","campaign-dir",-1278307883).cljs$core$IFn$_invoke$arity$1(theater));
});

weathergen.falcon.files.mission.campaign_dir.cljs$lang$maxFixedArity = 2;

/**
 * Return the path to the objects directory.
 */
weathergen.falcon.files.mission.object_dir = (function weathergen$falcon$files$mission$object_dir(installation,theater){
return weathergen.filesystem.path_combine.call(null,new cljs.core.Keyword(null,"data-dir","data-dir",2038801936).cljs$core$IFn$_invoke$arity$1(installation),(function (){var or__23148__auto__ = new cljs.core.Keyword(null,"object-dir","object-dir",-2124784896).cljs$core$IFn$_invoke$arity$1(theater);
if(cljs.core.truth_(or__23148__auto__)){
return or__23148__auto__;
} else {
return new cljs.core.Keyword(null,"object-dir","object-dir",-2124784896).cljs$core$IFn$_invoke$arity$1(installation);
}
})());
});
/**
 * Parse a line from the theater.tdf file.
 */
weathergen.falcon.files.mission.parse_theater_def_line = (function weathergen$falcon$files$mission$parse_theater_def_line(line){
var temp__5276__auto__ = clojure.string.index_of.call(null,line," ");
if(cljs.core.truth_(temp__5276__auto__)){
var idx = temp__5276__auto__;
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.keyword.call(null,cljs.core.subs.call(null,line,(0),idx)),cljs.core.subs.call(null,line,(idx + (1)))], null);
} else {
return null;
}
});
/**
 * Fix up the art directory, since KTO is special - all other theaters
 *   don't include the Art subdirectory in the path. Which is nonsense.
 *   So we add it.
 */
weathergen.falcon.files.mission.adjust_art_dir = (function weathergen$falcon$files$mission$adjust_art_dir(theater){
var G__34952 = theater;
if(cljs.core.not_EQ_.call(null,clojure.string.lower_case.call(null,new cljs.core.Keyword(null,"art-dir","art-dir",67381390).cljs$core$IFn$_invoke$arity$1(theater)),"art")){
return cljs.core.update.call(null,G__34952,new cljs.core.Keyword(null,"art-dir","art-dir",67381390),weathergen.filesystem.path_combine,"Art");
} else {
return G__34952;
}
});
/**
 * Reads the theater TDF from the given path, relative to `data-dir`.
 */
weathergen.falcon.files.mission.read_theater_def = (function weathergen$falcon$files$mission$read_theater_def(data_dir,path){
var d = cljs.core.into.call(null,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"path","path",-188191168),path], null),cljs.core.map.call(null,weathergen.falcon.files.mission.parse_theater_def_line,cljs.core.remove.call(null,(function (p1__34953_SHARP_){
return p1__34953_SHARP_.startsWith("#");
}),cljs.core.remove.call(null,clojure.string.blank_QMARK_,cljs.core.map.call(null,clojure.string.trim,clojure.string.split_lines.call(null,weathergen.filesystem.file_text.call(null,weathergen.filesystem.path_combine.call(null,data_dir,path))))))));
return weathergen.falcon.files.mission.adjust_art_dir.call(null,clojure.set.rename_keys.call(null,d,cljs.core.PersistentHashMap.fromArrays([new cljs.core.Keyword(null,"misctexdir","misctexdir",1667285632),new cljs.core.Keyword(null,"objectdir","objectdir",407109125),new cljs.core.Keyword(null,"mintact","mintact",-890985755),new cljs.core.Keyword(null,"terraindir","terraindir",1329705160),new cljs.core.Keyword(null,"artdir","artdir",-194008055),new cljs.core.Keyword(null,"campaigndir","campaigndir",1669742857),new cljs.core.Keyword(null,"simdatadir","simdatadir",-85891831),new cljs.core.Keyword(null,"3ddatadir","3ddatadir",1203546287),new cljs.core.Keyword(null,"sounddir","sounddir",2140813242)],[new cljs.core.Keyword(null,"misc-tex-dir","misc-tex-dir",2025463376),new cljs.core.Keyword(null,"object-dir","object-dir",-2124784896),new cljs.core.Keyword(null,"min-tacan","min-tacan",767695708),new cljs.core.Keyword(null,"terrain-dir","terrain-dir",-682919794),new cljs.core.Keyword(null,"art-dir","art-dir",67381390),new cljs.core.Keyword(null,"campaign-dir","campaign-dir",-1278307883),new cljs.core.Keyword(null,"sim-data-dir","sim-data-dir",-1889768986),new cljs.core.Keyword(null,"3d-data-dir","3d-data-dir",-1538342822),new cljs.core.Keyword(null,"sound-dir","sound-dir",604246964)])));
});
/**
 * Read, parse, and return information about the installled theaters
 *   from the theater list.
 */
weathergen.falcon.files.mission.read_theater_defs = (function weathergen$falcon$files$mission$read_theater_defs(data_dir){
return cljs.core.map.call(null,(function (p1__34955_SHARP_){
return weathergen.falcon.files.mission.read_theater_def.call(null,data_dir,p1__34955_SHARP_);
}),cljs.core.remove.call(null,clojure.string.blank_QMARK_,cljs.core.remove.call(null,(function (p1__34954_SHARP_){
return p1__34954_SHARP_.startsWith("#");
}),cljs.core.map.call(null,clojure.string.trim,clojure.string.split_lines.call(null,weathergen.filesystem.file_text.call(null,weathergen.filesystem.path_combine.call(null,data_dir,"Terrdata/theaterdefinition/theater.lst")))))));
});
/**
 * Reads an id list file consisting of pairs of names and ids. Returns
 *   a seq of those pairs.
 */
weathergen.falcon.files.mission.read_id_list_file = (function weathergen$falcon$files$mission$read_id_list_file(installation,path){
return cljs.core.map.call(null,(function (p__34961){
var vec__34962 = p__34961;
var name = cljs.core.nth.call(null,vec__34962,(0),null);
var id = cljs.core.nth.call(null,vec__34962,(1),null);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [name,(function (){var or__23148__auto__ = weathergen.util.str__GT_long.call(null,id);
if(cljs.core.truth_(or__23148__auto__)){
return or__23148__auto__;
} else {
taoensso.timbre._log_BANG_.call(null,taoensso.timbre._STAR_config_STAR_,new cljs.core.Keyword(null,"error","error",-978969032),"weathergen.falcon.files.mission",null,663,new cljs.core.Keyword(null,"p","p",151049309),new cljs.core.Keyword(null,"auto","auto",-566279492),(new cljs.core.Delay(((function (or__23148__auto__,vec__34962,name,id){
return (function (){
return new cljs.core.PersistentVector(null, 7, 5, cljs.core.PersistentVector.EMPTY_NODE, ["Error parsing image id",new cljs.core.Keyword(null,"name","name",1843675177),name,new cljs.core.Keyword(null,"id","id",-1388402092),id,new cljs.core.Keyword(null,"path","path",-188191168),path], null);
});})(or__23148__auto__,vec__34962,name,id))
,null)),null,964368352);

return null;
}
})()], null);
}),cljs.core.map.call(null,(function (p1__34956_SHARP_){
return clojure.string.split.call(null,p1__34956_SHARP_,/[ \t=]+/);
}),cljs.core.remove.call(null,clojure.string.blank_QMARK_,cljs.core.map.call(null,clojure.string.trim,clojure.string.split_lines.call(null,weathergen.filesystem.file_text.call(null,weathergen.filesystem.path_combine.call(null,new cljs.core.Keyword(null,"data-dir","data-dir",2038801936).cljs$core$IFn$_invoke$arity$1(installation),path)))))));
});
/**
 * Read in the id list file with `id`
 */
weathergen.falcon.files.mission.read_id_list = (function weathergen$falcon$files$mission$read_id_list(installation,id){
var pairs = cljs.core.mapcat.call(null,(function (p1__34965_SHARP_){
return weathergen.falcon.files.mission.read_id_list_file.call(null,installation,p1__34965_SHARP_);
}),cljs.core.remove.call(null,clojure.string.blank_QMARK_,cljs.core.map.call(null,clojure.string.trim,clojure.string.split_lines.call(null,weathergen.filesystem.file_text.call(null,weathergen.filesystem.path_combine.call(null,new cljs.core.Keyword(null,"data-dir","data-dir",2038801936).cljs$core$IFn$_invoke$arity$1(installation),new cljs.core.Keyword(null,"art-dir","art-dir",67381390).cljs$core$IFn$_invoke$arity$1(installation),[cljs.core.str.cljs$core$IFn$_invoke$arity$1(id),cljs.core.str.cljs$core$IFn$_invoke$arity$1(".LST")].join('')))))));
return new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"name->id","name->id",-338114168),cljs.core.zipmap.call(null,cljs.core.map.call(null,cljs.core.first,pairs),cljs.core.map.call(null,cljs.core.second,pairs)),new cljs.core.Keyword(null,"id->name","id->name",249122446),cljs.core.zipmap.call(null,cljs.core.map.call(null,cljs.core.second,pairs),cljs.core.map.call(null,cljs.core.first,pairs))], null);
});
/**
 * Read in the image IDs in this installation. Returns a map with
 *   keys :id->name and :name->id mapping in each direction.
 */
weathergen.falcon.files.mission.read_image_ids = (function weathergen$falcon$files$mission$read_image_ids(installation){
return weathergen.falcon.files.mission.read_id_list.call(null,installation,"IMAGEIDS");
});
/**
 * Read in the user IDs in this installation. Returns a map with
 *   keys :id->name and :name->id mapping in each direction.
 */
weathergen.falcon.files.mission.read_user_ids = (function weathergen$falcon$files$mission$read_user_ids(installation){
return weathergen.falcon.files.mission.read_id_list.call(null,installation,"USERIDS");
});
/**
 * Return information about the installed theaters.
 */
weathergen.falcon.files.mission.load_installation = (function weathergen$falcon$files$mission$load_installation(install_dir){
var data_dir = weathergen.filesystem.path_combine.call(null,install_dir,"Data");
var art_dir = "Art";
var object_dir = "Terrdata/objects";
return new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"install-dir","install-dir",2018055118),install_dir,new cljs.core.Keyword(null,"data-dir","data-dir",2038801936),data_dir,new cljs.core.Keyword(null,"art-dir","art-dir",67381390),art_dir,new cljs.core.Keyword(null,"object-dir","object-dir",-2124784896),object_dir,new cljs.core.Keyword(null,"theaters","theaters",-1420445930),weathergen.falcon.files.mission.read_theater_defs.call(null,data_dir)], null);
});
/**
 * Given the path to a mission file, return the theater it's in.
 */
weathergen.falcon.files.mission.find_theater = (function weathergen$falcon$files$mission$find_theater(installation,path){
return cljs.core.first.call(null,cljs.core.filter.call(null,(function (p1__34966_SHARP_){
return weathergen.filesystem.ancestor_QMARK_.call(null,weathergen.falcon.files.mission.campaign_dir.call(null,installation,p1__34966_SHARP_),path);
}),new cljs.core.Keyword(null,"theaters","theaters",-1420445930).cljs$core$IFn$_invoke$arity$1(installation)));
});
/**
 * Returns the display name of the theater as given in the theaterdef file.
 */
weathergen.falcon.files.mission.theaterdef_name = (function weathergen$falcon$files$mission$theaterdef_name(mission){
return cljs.core.get_in.call(null,mission,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"theater","theater",258922071),new cljs.core.Keyword(null,"name","name",1843675177)], null));
});
/**
 * Load the files in known locations needed to process a mission in a
 *   given theater.
 */
weathergen.falcon.files.mission.load_initial_database = (function weathergen$falcon$files$mission$load_initial_database(installation,theater){
return cljs.core.merge.call(null,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"image-ids","image-ids",-529925649),weathergen.falcon.files.mission.read_image_ids.call(null,installation),new cljs.core.Keyword(null,"user-ids","user-ids",-652076250),weathergen.falcon.files.mission.read_user_ids.call(null,installation)], null),cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,(function (){var iter__24010__auto__ = (function weathergen$falcon$files$mission$load_initial_database_$_iter__34987(s__34988){
return (new cljs.core.LazySeq(null,(function (){
var s__34988__$1 = s__34988;
while(true){
var temp__5278__auto__ = cljs.core.seq.call(null,s__34988__$1);
if(temp__5278__auto__){
var s__34988__$2 = temp__5278__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__34988__$2)){
var c__24008__auto__ = cljs.core.chunk_first.call(null,s__34988__$2);
var size__24009__auto__ = cljs.core.count.call(null,c__24008__auto__);
var b__34990 = cljs.core.chunk_buffer.call(null,size__24009__auto__);
if((function (){var i__34989 = (0);
while(true){
if((i__34989 < size__24009__auto__)){
var vec__34999 = cljs.core._nth.call(null,c__24008__auto__,i__34989);
var file = cljs.core.nth.call(null,vec__34999,(0),null);
var k = cljs.core.nth.call(null,vec__34999,(1),null);
var spec = cljs.core.nth.call(null,vec__34999,(2),null);
cljs.core.chunk_append.call(null,b__34990,(function (){var path = weathergen.filesystem.path_combine.call(null,weathergen.falcon.files.mission.object_dir.call(null,installation,theater),file);
var buf = weathergen.filesystem.file_buf.call(null,path);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [k,(function (){var _STAR_byte_order_STAR_35002 = octet.buffer._STAR_byte_order_STAR_;
octet.buffer._STAR_byte_order_STAR_ = new cljs.core.Keyword(null,"little-endian","little-endian",1877303413);

try{return cljs.core.map_indexed.call(null,((function (i__34989,_STAR_byte_order_STAR_35002,path,buf,vec__34999,file,k,spec,c__24008__auto__,size__24009__auto__,b__34990,s__34988__$2,temp__5278__auto__){
return (function (i,v){
return cljs.core.assoc.call(null,v,new cljs.core.Keyword("weathergen.falcon.files.mission","index","weathergen.falcon.files.mission/index",-1989089649),i);
});})(i__34989,_STAR_byte_order_STAR_35002,path,buf,vec__34999,file,k,spec,c__24008__auto__,size__24009__auto__,b__34990,s__34988__$2,temp__5278__auto__))
,octet.core.read.call(null,weathergen.filesystem.file_buf.call(null,weathergen.filesystem.path_combine.call(null,weathergen.falcon.files.mission.object_dir.call(null,installation,theater),file)),weathergen.falcon.files.larray.call(null,octet.core.uint16,spec)));
}finally {octet.buffer._STAR_byte_order_STAR_ = _STAR_byte_order_STAR_35002;
}})()], null);
})());

var G__35007 = (i__34989 + (1));
i__34989 = G__35007;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__34990),weathergen$falcon$files$mission$load_initial_database_$_iter__34987.call(null,cljs.core.chunk_rest.call(null,s__34988__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__34990),null);
}
} else {
var vec__35003 = cljs.core.first.call(null,s__34988__$2);
var file = cljs.core.nth.call(null,vec__35003,(0),null);
var k = cljs.core.nth.call(null,vec__35003,(1),null);
var spec = cljs.core.nth.call(null,vec__35003,(2),null);
return cljs.core.cons.call(null,(function (){var path = weathergen.filesystem.path_combine.call(null,weathergen.falcon.files.mission.object_dir.call(null,installation,theater),file);
var buf = weathergen.filesystem.file_buf.call(null,path);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [k,(function (){var _STAR_byte_order_STAR_35006 = octet.buffer._STAR_byte_order_STAR_;
octet.buffer._STAR_byte_order_STAR_ = new cljs.core.Keyword(null,"little-endian","little-endian",1877303413);

try{return cljs.core.map_indexed.call(null,((function (_STAR_byte_order_STAR_35006,path,buf,vec__35003,file,k,spec,s__34988__$2,temp__5278__auto__){
return (function (i,v){
return cljs.core.assoc.call(null,v,new cljs.core.Keyword("weathergen.falcon.files.mission","index","weathergen.falcon.files.mission/index",-1989089649),i);
});})(_STAR_byte_order_STAR_35006,path,buf,vec__35003,file,k,spec,s__34988__$2,temp__5278__auto__))
,octet.core.read.call(null,weathergen.filesystem.file_buf.call(null,weathergen.filesystem.path_combine.call(null,weathergen.falcon.files.mission.object_dir.call(null,installation,theater),file)),weathergen.falcon.files.larray.call(null,octet.core.uint16,spec)));
}finally {octet.buffer._STAR_byte_order_STAR_ = _STAR_byte_order_STAR_35006;
}})()], null);
})(),weathergen$falcon$files$mission$load_initial_database_$_iter__34987.call(null,cljs.core.rest.call(null,s__34988__$2)));
}
} else {
return null;
}
break;
}
}),null,null));
});
return iter__24010__auto__.call(null,new cljs.core.PersistentVector(null, 8, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, ["FALCON4.ct",new cljs.core.Keyword(null,"class-table","class-table",207400992),cljs.core.apply.call(null,octet.core.spec,weathergen.falcon.files.mission.falcon4_entity_fields)], null),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, ["FALCON4.UCD",new cljs.core.Keyword(null,"unit-class-data","unit-class-data",2122324209),weathergen.falcon.files.mission.unit_class_data], null),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, ["FALCON4.OCD",new cljs.core.Keyword(null,"objective-class-data","objective-class-data",-2036255156),weathergen.falcon.files.mission.objective_class_data], null),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, ["FALCON4.VCD",new cljs.core.Keyword(null,"vehicle-class-data","vehicle-class-data",1666024339),weathergen.falcon.files.mission.vehicle_class_data], null),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, ["FALCON4.WCD",new cljs.core.Keyword(null,"weapon-class-data","weapon-class-data",-1828241433),weathergen.falcon.files.mission.weapon_class_data], null),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, ["FALCON4.FCD",new cljs.core.Keyword(null,"feature-class-data","feature-class-data",-794349644),weathergen.falcon.files.mission.feature_class_data], null),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, ["falcon4.fed",new cljs.core.Keyword(null,"feature-entry-data","feature-entry-data",-87481893),weathergen.falcon.files.mission.feature_entry_data], null),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, ["FALCON4.PHD",new cljs.core.Keyword(null,"point-header-data","point-header-data",2108405911),weathergen.falcon.files.mission.point_header_data], null)], null));
})()));
});
/**
 * Reads and parses a .tac/.cmp file, returning a map from the
 *   embedded file type to its contents.
 */
weathergen.falcon.files.mission.read_embedded_files = (function weathergen$falcon$files$mission$read_embedded_files(path,database){
var buf = weathergen.filesystem.file_buf.call(null,path);
var _STAR_byte_order_STAR_35013 = octet.buffer._STAR_byte_order_STAR_;
octet.buffer._STAR_byte_order_STAR_ = new cljs.core.Keyword(null,"little-endian","little-endian",1877303413);

try{var dir_offset = octet.core.read.call(null,buf,octet.core.uint32);
var dir_file_count = octet.core.read.call(null,buf,octet.core.uint32,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),dir_offset], null));
var directory = octet.core.read.call(null,buf,octet.core.repeat.call(null,dir_file_count,weathergen.falcon.files.mission.directory_entry),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),(dir_offset + (4))], null));
var files = (function (){var iter__24010__auto__ = ((function (dir_offset,dir_file_count,directory,_STAR_byte_order_STAR_35013,buf){
return (function weathergen$falcon$files$mission$read_embedded_files_$_iter__35014(s__35015){
return (new cljs.core.LazySeq(null,((function (dir_offset,dir_file_count,directory,_STAR_byte_order_STAR_35013,buf){
return (function (){
var s__35015__$1 = s__35015;
while(true){
var temp__5278__auto__ = cljs.core.seq.call(null,s__35015__$1);
if(temp__5278__auto__){
var s__35015__$2 = temp__5278__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__35015__$2)){
var c__24008__auto__ = cljs.core.chunk_first.call(null,s__35015__$2);
var size__24009__auto__ = cljs.core.count.call(null,c__24008__auto__);
var b__35017 = cljs.core.chunk_buffer.call(null,size__24009__auto__);
if((function (){var i__35016 = (0);
while(true){
if((i__35016 < size__24009__auto__)){
var entry = cljs.core._nth.call(null,c__24008__auto__,i__35016);
var type = weathergen.falcon.files.mission.file_type.call(null,new cljs.core.Keyword(null,"file-name","file-name",-1654217259).cljs$core$IFn$_invoke$arity$1(entry));
cljs.core.chunk_append.call(null,b__35017,cljs.core.assoc.call(null,entry,new cljs.core.Keyword(null,"type","type",1174270348),type,new cljs.core.Keyword(null,"data","data",-232669377),weathergen.falcon.files.mission.read_embedded_file.call(null,type,entry,buf,database)));

var G__35018 = (i__35016 + (1));
i__35016 = G__35018;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__35017),weathergen$falcon$files$mission$read_embedded_files_$_iter__35014.call(null,cljs.core.chunk_rest.call(null,s__35015__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__35017),null);
}
} else {
var entry = cljs.core.first.call(null,s__35015__$2);
var type = weathergen.falcon.files.mission.file_type.call(null,new cljs.core.Keyword(null,"file-name","file-name",-1654217259).cljs$core$IFn$_invoke$arity$1(entry));
return cljs.core.cons.call(null,cljs.core.assoc.call(null,entry,new cljs.core.Keyword(null,"type","type",1174270348),type,new cljs.core.Keyword(null,"data","data",-232669377),weathergen.falcon.files.mission.read_embedded_file.call(null,type,entry,buf,database)),weathergen$falcon$files$mission$read_embedded_files_$_iter__35014.call(null,cljs.core.rest.call(null,s__35015__$2)));
}
} else {
return null;
}
break;
}
});})(dir_offset,dir_file_count,directory,_STAR_byte_order_STAR_35013,buf))
,null,null));
});})(dir_offset,dir_file_count,directory,_STAR_byte_order_STAR_35013,buf))
;
return iter__24010__auto__.call(null,directory);
})();
if(cljs.core._EQ_.call(null,cljs.core.count.call(null,files),cljs.core.count.call(null,cljs.core.distinct.call(null,cljs.core.map.call(null,new cljs.core.Keyword(null,"type","type",1174270348),files))))){
} else {
throw (new Error("Assert failed: (->> files (map :type) distinct count (= (count files)))"));
}

return cljs.core.zipmap.call(null,cljs.core.map.call(null,new cljs.core.Keyword(null,"type","type",1174270348),files),cljs.core.map.call(null,new cljs.core.Keyword(null,"data","data",-232669377),files));
}finally {octet.buffer._STAR_byte_order_STAR_ = _STAR_byte_order_STAR_35013;
}});
/**
 * Given objectives and objective deltas, merge the deltas and return
 *   an updated objectives list.
 */
weathergen.falcon.files.mission.merge_objective_deltas = (function weathergen$falcon$files$mission$merge_objective_deltas(objectives,deltas){
var objectives_map = cljs.core.zipmap.call(null,cljs.core.map.call(null,new cljs.core.Keyword(null,"id","id",-1388402092),objectives),objectives);
return cljs.core.vec.call(null,cljs.core.vals.call(null,cljs.core.reduce.call(null,((function (objectives_map){
return (function (objectives_map__$1,delta){
return cljs.core.update.call(null,objectives_map__$1,new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(delta),cljs.core.merge,delta);
});})(objectives_map))
,objectives_map,deltas)));
});
/**
 * Given a path to a mission (.cam/.tac/.trn) file, read,
 *   parse, and return it.
 */
weathergen.falcon.files.mission.read_mission = (function weathergen$falcon$files$mission$read_mission(installs,path){
var install_dir = weathergen.falcon.files.mission.find_install_dir.call(null,path);
var installation = weathergen.falcon.files.mission.load_installation.call(null,install_dir);
var theater = weathergen.falcon.files.mission.find_theater.call(null,installation,path);
var strings = weathergen.falcon.files.mission.read_strings_file.call(null,weathergen.falcon.files.mission.campaign_dir.call(null,installation,theater));
var database = cljs.core.assoc.call(null,weathergen.falcon.files.mission.load_initial_database.call(null,installation,theater),new cljs.core.Keyword(null,"strings","strings",-2055406807),strings);
var _ = weathergen.progress.report.call(null,[cljs.core.str.cljs$core$IFn$_invoke$arity$1("Reading mission files from"),cljs.core.str.cljs$core$IFn$_invoke$arity$1(path)].join(''));
var mission_files = weathergen.falcon.files.mission.read_embedded_files.call(null,path,database);
var map__35025 = new cljs.core.Keyword(null,"campaign-info","campaign-info",1158908966).cljs$core$IFn$_invoke$arity$1(mission_files);
var map__35025__$1 = ((((!((map__35025 == null)))?((((map__35025.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35025.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35025):map__35025);
var theater_name = cljs.core.get.call(null,map__35025__$1,new cljs.core.Keyword(null,"theater-name","theater-name",2077458810));
var scenario = cljs.core.get.call(null,map__35025__$1,new cljs.core.Keyword(null,"scenario","scenario",-316635333));
var names = weathergen.falcon.files.mission.read_strings.call(null,weathergen.falcon.files.mission.campaign_dir.call(null,installation,theater),theater_name);
var scenario_file = [cljs.core.str.cljs$core$IFn$_invoke$arity$1(scenario),cljs.core.str.cljs$core$IFn$_invoke$arity$1(weathergen.falcon.files.mission.extension.call(null,path))].join('');
var scenario_path = weathergen.filesystem.path_combine.call(null,weathergen.filesystem.parent.call(null,path),scenario_file);
var ___$1 = weathergen.progress.report.call(null,[cljs.core.str.cljs$core$IFn$_invoke$arity$1("Reading scenario file: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(scenario_file)].join(''));
var scenario_files = weathergen.falcon.files.mission.read_embedded_files.call(null,scenario_path,database);
var mission = cljs.core.merge.call(null,database,mission_files,cljs.core.PersistentHashMap.fromArrays([new cljs.core.Keyword(null,"path","path",-188191168),new cljs.core.Keyword(null,"installs","installs",-915592927),new cljs.core.Keyword(null,"mission-name","mission-name",1479736582),new cljs.core.Keyword(null,"candidate-installs","candidate-installs",1512655313),new cljs.core.Keyword(null,"installation","installation",943147954),new cljs.core.Keyword(null,"objectives","objectives",933939509),new cljs.core.Keyword(null,"theater","theater",258922071),new cljs.core.Keyword(null,"names","names",-1943074658),new cljs.core.Keyword(null,"scenario-files","scenario-files",-1697993090)],[path,installs,weathergen.filesystem.basename.call(null,path),cljs.core.mapv.call(null,cljs.core.key,cljs.core.filter.call(null,((function (install_dir,installation,theater,strings,database,_,mission_files,map__35025,map__35025__$1,theater_name,scenario,names,scenario_file,scenario_path,___$1,scenario_files){
return (function (p__35027){
var vec__35028 = p__35027;
var name = cljs.core.nth.call(null,vec__35028,(0),null);
var dir = cljs.core.nth.call(null,vec__35028,(1),null);
var and__23136__auto__ = weathergen.filesystem.exists_QMARK_.call(null,dir);
if(cljs.core.truth_(and__23136__auto__)){
var and__23136__auto____$1 = weathergen.filesystem.exists_QMARK_.call(null,install_dir);
if(cljs.core.truth_(and__23136__auto____$1)){
return weathergen.filesystem.identical_QMARK_.call(null,dir,install_dir);
} else {
return and__23136__auto____$1;
}
} else {
return and__23136__auto__;
}
});})(install_dir,installation,theater,strings,database,_,mission_files,map__35025,map__35025__$1,theater_name,scenario,names,scenario_file,scenario_path,___$1,scenario_files))
,installs)),installation,weathergen.falcon.files.mission.merge_objective_deltas.call(null,new cljs.core.Keyword(null,"objectives","objectives",933939509).cljs$core$IFn$_invoke$arity$1(scenario_files),new cljs.core.Keyword(null,"objective-deltas","objective-deltas",710518611).cljs$core$IFn$_invoke$arity$1(mission_files)),theater,names,scenario_files]));
return cljs.core.assoc.call(null,mission,new cljs.core.Keyword(null,"map-image","map-image",-5560498),weathergen.falcon.files.images.make_descriptor.call(null,mission,"resource/campmap","BIG_MAP_ID"));
});
/**
 * Converts a mission to a 'briefing', which is a serializable version
 *   of the mission, containing everything needed to rehydrate the
 *   mission later.
 */
weathergen.falcon.files.mission.mission__GT_briefing = (function weathergen$falcon$files$mission$mission__GT_briefing(mission,install_id){
return cljs.core.merge.call(null,new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"theaterdef-name","theaterdef-name",-635231832),weathergen.falcon.files.mission.theaterdef_name.call(null,mission),new cljs.core.Keyword(null,"extension","extension",1453374065),weathergen.falcon.files.mission.extension.call(null,new cljs.core.Keyword(null,"path","path",-188191168).cljs$core$IFn$_invoke$arity$1(mission)),new cljs.core.Keyword(null,"install-id","install-id",-1310868737),install_id], null),cljs.core.select_keys.call(null,mission,cljs.core.concat.call(null,cljs.core.vals.call(null,weathergen.falcon.files.mission.file_types),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"mission-name","mission-name",1479736582)], null))));
});
/**
 * Loads a mission given a briefing (see `mission->briefing`).
 */
weathergen.falcon.files.mission.briefing__GT_mission = (function weathergen$falcon$files$mission$briefing__GT_mission(installs,briefing){
var map__35036 = briefing;
var map__35036__$1 = ((((!((map__35036 == null)))?((((map__35036.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35036.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35036):map__35036);
var theaterdef_name = cljs.core.get.call(null,map__35036__$1,new cljs.core.Keyword(null,"theaterdef-name","theaterdef-name",-635231832));
var install_id = cljs.core.get.call(null,map__35036__$1,new cljs.core.Keyword(null,"install-id","install-id",-1310868737));
var install_dir = cljs.core.get.call(null,installs,install_id);
var installation = weathergen.falcon.files.mission.load_installation.call(null,install_dir);
var theater = cljs.core.first.call(null,cljs.core.filter.call(null,((function (map__35036,map__35036__$1,theaterdef_name,install_id,install_dir,installation){
return (function (p1__35031_SHARP_){
return cljs.core._EQ_.call(null,theaterdef_name,new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(p1__35031_SHARP_));
});})(map__35036,map__35036__$1,theaterdef_name,install_id,install_dir,installation))
,new cljs.core.Keyword(null,"theaters","theaters",-1420445930).cljs$core$IFn$_invoke$arity$1(installation)));
var _ = (cljs.core.truth_(theater)?null:(function(){throw cljs.core.ex_info.call(null,[cljs.core.str.cljs$core$IFn$_invoke$arity$1("Theater "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(theaterdef_name),cljs.core.str.cljs$core$IFn$_invoke$arity$1(" does not seem to be installed.")].join(''),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"reason","reason",-2070751759),new cljs.core.Keyword("weathergen.falcon.files.mission","theater-not-found","weathergen.falcon.files.mission/theater-not-found",259752510),new cljs.core.Keyword(null,"install-dir","install-dir",2018055118),install_dir,new cljs.core.Keyword(null,"theaterdef-name","theaterdef-name",-635231832),theaterdef_name], null))})());
var strings = weathergen.falcon.files.mission.read_strings_file.call(null,weathergen.falcon.files.mission.campaign_dir.call(null,installation,theater));
var database = cljs.core.assoc.call(null,weathergen.falcon.files.mission.load_initial_database.call(null,installation,theater),new cljs.core.Keyword(null,"strings","strings",-2055406807),strings);
var map__35037 = new cljs.core.Keyword(null,"campaign-info","campaign-info",1158908966).cljs$core$IFn$_invoke$arity$1(briefing);
var map__35037__$1 = ((((!((map__35037 == null)))?((((map__35037.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35037.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35037):map__35037);
var theater_name = cljs.core.get.call(null,map__35037__$1,new cljs.core.Keyword(null,"theater-name","theater-name",2077458810));
var scenario = cljs.core.get.call(null,map__35037__$1,new cljs.core.Keyword(null,"scenario","scenario",-316635333));
var names = weathergen.falcon.files.mission.read_strings.call(null,weathergen.falcon.files.mission.campaign_dir.call(null,installation,theater),theater_name);
var database__$1 = cljs.core.assoc.call(null,weathergen.falcon.files.mission.load_initial_database.call(null,installation,theater),new cljs.core.Keyword(null,"strings","strings",-2055406807),strings);
var scenario_file = [cljs.core.str.cljs$core$IFn$_invoke$arity$1(scenario),cljs.core.str.cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"extension","extension",1453374065).cljs$core$IFn$_invoke$arity$1(briefing))].join('');
var scenario_path = weathergen.filesystem.path_combine.call(null,weathergen.falcon.files.mission.campaign_dir.call(null,installation,theater),scenario_file);
var ___$1 = weathergen.progress.report.call(null,[cljs.core.str.cljs$core$IFn$_invoke$arity$1("Reading scenario file: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(scenario_file)].join(''));
var scenario_files = weathergen.falcon.files.mission.read_embedded_files.call(null,scenario_path,database__$1);
var mission = cljs.core.merge.call(null,database__$1,briefing,new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"objectives","objectives",933939509),weathergen.falcon.files.mission.merge_objective_deltas.call(null,new cljs.core.Keyword(null,"objectives","objectives",933939509).cljs$core$IFn$_invoke$arity$1(scenario_files),new cljs.core.Keyword(null,"objective-deltas","objective-deltas",710518611).cljs$core$IFn$_invoke$arity$1(briefing)),new cljs.core.Keyword(null,"scenario-files","scenario-files",-1697993090),scenario_files,new cljs.core.Keyword(null,"names","names",-1943074658),names,new cljs.core.Keyword(null,"installation","installation",943147954),installation,new cljs.core.Keyword(null,"theater","theater",258922071),theater], null));
return cljs.core.assoc.call(null,mission,new cljs.core.Keyword(null,"map-image","map-image",-5560498),weathergen.falcon.files.images.make_descriptor.call(null,mission,"resource/campmap","BIG_MAP_ID"));
});
weathergen.falcon.files.mission.team_basic_info = octet.core.spec.call(null,new cljs.core.Keyword(null,"flag","flag",1088647881),octet.core.ubyte,new cljs.core.Keyword(null,"color","color",1011675173),octet.core.ubyte,new cljs.core.Keyword(null,"name","name",1843675177),weathergen.falcon.files.fixed_string.call(null,(20)),new cljs.core.Keyword(null,"motto","motto",-708709752),weathergen.falcon.files.fixed_string.call(null,(200)));
weathergen.falcon.files.mission.squadron_info = octet.core.spec.call(null,new cljs.core.Keyword(null,"x","x",2099068185),octet.core.float$,new cljs.core.Keyword(null,"y","y",-1757859776),octet.core.float$,new cljs.core.Keyword(null,"id","id",-1388402092),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"description-index","description-index",1949024606),octet.core.int16,new cljs.core.Keyword(null,"name-id","name-id",-279275372),octet.core.int16,new cljs.core.Keyword(null,"airbase-icon","airbase-icon",-1322581504),octet.core.int16,new cljs.core.Keyword(null,"squadron-patch","squadron-patch",883934030),octet.core.int16,new cljs.core.Keyword(null,"specialty","specialty",-159219386),octet.core.ubyte,new cljs.core.Keyword(null,"current-strength","current-strength",-809786824),octet.core.ubyte,new cljs.core.Keyword(null,"country","country",312965309),octet.core.ubyte,new cljs.core.Keyword(null,"airbase-name","airbase-name",-1509991393),weathergen.falcon.files.fixed_string.call(null,(40)),new cljs.core.Keyword(null,"padding","padding",1660304693),octet.core.byte$);
weathergen.falcon.files.mission.event_node = octet.core.spec.call(null,new cljs.core.Keyword(null,"x","x",2099068185),octet.core.int16,new cljs.core.Keyword(null,"y","y",-1757859776),octet.core.int16,new cljs.core.Keyword(null,"time","time",1385887882),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"flags","flags",1775418075),octet.core.ubyte,new cljs.core.Keyword(null,"team","team",1355747699),octet.core.ubyte,new cljs.core.Keyword(null,"padding","padding",1660304693),octet.core.repeat.call(null,(2),octet.core.byte$),new cljs.core.Keyword(null,"event-text","event-text",-1878870726),octet.core.int32,new cljs.core.Keyword(null,"ui-event-node","ui-event-node",-1345265994),octet.core.int32,new cljs.core.Keyword(null,"event-text","event-text",-1878870726),weathergen.falcon.files.lstring.call(null,octet.core.uint16));
weathergen.falcon.files.mission.cmp_spec = octet.core.spec.call(null,new cljs.core.Keyword(null,"current-time","current-time",-1609407134),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"te-start","te-start",-810002242),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"te-time-limit","te-time-limit",-309642932),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"te-victory-points","te-victory-points",132309627),octet.core.int32,new cljs.core.Keyword(null,"te-type","te-type",-255361660),octet.core.int32,new cljs.core.Keyword(null,"te-num-teams","te-num-teams",-1586070853),octet.core.int32,new cljs.core.Keyword(null,"te-num-aircraft","te-num-aircraft",318417356),octet.core.repeat.call(null,(8),octet.core.int32),new cljs.core.Keyword(null,"te-num-f16s","te-num-f16s",-1823950404),octet.core.repeat.call(null,(8),octet.core.int32),new cljs.core.Keyword(null,"te-team","te-team",268867708),octet.core.int32,new cljs.core.Keyword(null,"te-team-points","te-team-points",2095170901),octet.core.repeat.call(null,(8),octet.core.int32),new cljs.core.Keyword(null,"te-flags","te-flags",354248005),octet.core.int32,new cljs.core.Keyword(null,"team-info","team-info",-1689319883),octet.core.repeat.call(null,(8),weathergen.falcon.files.mission.team_basic_info),new cljs.core.Keyword(null,"last-major-event","last-major-event",659606992),octet.core.uint32,new cljs.core.Keyword(null,"last-resupply","last-resupply",1047033340),octet.core.uint32,new cljs.core.Keyword(null,"last-repair","last-repair",1138109175),octet.core.uint32,new cljs.core.Keyword(null,"last-reinforcement","last-reinforcement",292779879),octet.core.uint32,new cljs.core.Keyword(null,"time-stamp","time-stamp",-1161230692),octet.core.int16,new cljs.core.Keyword(null,"group","group",582596132),octet.core.int16,new cljs.core.Keyword(null,"ground-ratio","ground-ratio",-2128608539),octet.core.int16,new cljs.core.Keyword(null,"air-ratio","air-ratio",1013948242),octet.core.int16,new cljs.core.Keyword(null,"air-defense-ratio","air-defense-ratio",1236036225),octet.core.int16,new cljs.core.Keyword(null,"naval-ratio","naval-ratio",1923404214),octet.core.int16,new cljs.core.Keyword(null,"brief","brief",-1044220717),octet.core.int16,new cljs.core.Keyword(null,"theater-size-x","theater-size-x",1642493141),octet.core.int16,new cljs.core.Keyword(null,"theater-size-y","theater-size-y",-1863614166),octet.core.int16,new cljs.core.Keyword(null,"current-day","current-day",129141412),octet.core.ubyte,new cljs.core.Keyword(null,"active-team","active-team",-709241146),octet.core.ubyte,new cljs.core.Keyword(null,"day-zero","day-zero",1149503524),octet.core.ubyte,new cljs.core.Keyword(null,"endgame-result","endgame-result",-117243832),octet.core.ubyte,new cljs.core.Keyword(null,"situation","situation",-1432089725),octet.core.ubyte,new cljs.core.Keyword(null,"enemy-air-exp","enemy-air-exp",1693726133),octet.core.ubyte,new cljs.core.Keyword(null,"enemy-ad-exp","enemy-ad-exp",1654067742),octet.core.ubyte,new cljs.core.Keyword(null,"bullseye-name","bullseye-name",-1974521298),octet.core.ubyte,new cljs.core.Keyword(null,"bullseye-x","bullseye-x",-1698783852),octet.core.int16,new cljs.core.Keyword(null,"bullseye-y","bullseye-y",904460818),octet.core.int16,new cljs.core.Keyword(null,"theater-name","theater-name",2077458810),weathergen.falcon.files.fixed_string.call(null,(40)),new cljs.core.Keyword(null,"scenario","scenario",-316635333),weathergen.falcon.files.fixed_string.call(null,(40)),new cljs.core.Keyword(null,"save-file","save-file",-250442926),weathergen.falcon.files.fixed_string.call(null,(40)),new cljs.core.Keyword(null,"ui-name","ui-name",-5784516),weathergen.falcon.files.fixed_string.call(null,(40)),new cljs.core.Keyword(null,"player-squadron-id","player-squadron-id",269963792),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"recent-event-entries","recent-event-entries",1549481754),weathergen.falcon.files.larray.call(null,octet.core.int16,weathergen.falcon.files.mission.event_node),new cljs.core.Keyword(null,"priority-event-entries","priority-event-entries",1522743125),weathergen.falcon.files.larray.call(null,octet.core.int16,weathergen.falcon.files.mission.event_node),new cljs.core.Keyword(null,"map","map",1371690461),weathergen.falcon.files.larray.call(null,octet.core.int16,octet.core.ubyte),new cljs.core.Keyword(null,"last-index-num","last-index-num",508638070),octet.core.int16,new cljs.core.Keyword(null,"squadron-info","squadron-info",-818676314),weathergen.falcon.files.larray.call(null,octet.core.int16,weathergen.falcon.files.mission.squadron_info),new cljs.core.Keyword(null,"tempo","tempo",-1555208453),octet.core.ubyte,new cljs.core.Keyword(null,"creator-ip","creator-ip",1390615344),octet.core.int32,new cljs.core.Keyword(null,"creation-time","creation-time",-1921334563),octet.core.int32,new cljs.core.Keyword(null,"creation-rand","creation-rand",-844614550),octet.core.int32);
cljs.core._add_method.call(null,weathergen.falcon.files.mission.read_embedded_file_STAR_,new cljs.core.Keyword(null,"campaign-info","campaign-info",1158908966),(function (_,p__35040,buf,___$1){
var map__35041 = p__35040;
var map__35041__$1 = ((((!((map__35041 == null)))?((((map__35041.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35041.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35041):map__35041);
var entry = map__35041__$1;
var offset = cljs.core.get.call(null,map__35041__$1,new cljs.core.Keyword(null,"offset","offset",296498311));
var length = cljs.core.get.call(null,map__35041__$1,new cljs.core.Keyword(null,"length","length",588987862));
var _STAR_byte_order_STAR_35043 = octet.buffer._STAR_byte_order_STAR_;
octet.buffer._STAR_byte_order_STAR_ = new cljs.core.Keyword(null,"little-endian","little-endian",1877303413);

try{var header_spec = octet.core.spec.call(null,new cljs.core.Keyword(null,"compressed-size","compressed-size",-1517579578),octet.core.int32,new cljs.core.Keyword(null,"uncompressed-size","uncompressed-size",-434136147),octet.core.int32);
var map__35044 = octet.core.read.call(null,buf,header_spec,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),offset], null));
var map__35044__$1 = ((((!((map__35044 == null)))?((((map__35044.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35044.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35044):map__35044);
var compressed_size = cljs.core.get.call(null,map__35044__$1,new cljs.core.Keyword(null,"compressed-size","compressed-size",-1517579578));
var uncompressed_size = cljs.core.get.call(null,map__35044__$1,new cljs.core.Keyword(null,"uncompressed-size","uncompressed-size",-434136147));
var adjusted_compressed_size = (compressed_size - octet.core.size.call(null,octet.core.int32));
var data = weathergen.lzss.expand.call(null,buf,(offset + octet.core.size.call(null,header_spec)),adjusted_compressed_size,uncompressed_size);
return cljs.core.into.call(null,cljs.core.sorted_map.call(null),octet.core.read.call(null,data,weathergen.falcon.files.mission.cmp_spec));
}finally {octet.buffer._STAR_byte_order_STAR_ = _STAR_byte_order_STAR_35043;
}}));
weathergen.falcon.files.mission.objective_link = octet.core.spec.call(null,new cljs.core.Keyword(null,"costs","costs",2093295309),octet.core.repeat.call(null,weathergen.falcon.constants.MOVEMENT_TYPES,octet.core.ubyte),new cljs.core.Keyword(null,"id","id",-1388402092),weathergen.falcon.files.mission.vu_id);
weathergen.falcon.files.mission.objective_fields = weathergen.util.concatv.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"objective-type","objective-type",1907988670),octet.core.uint16], null),weathergen.falcon.files.mission.camp_base_fields,new cljs.core.PersistentVector(null, 24, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"last-repair","last-repair",1138109175),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"obj-flags","obj-flags",-864355993),octet.core.uint32,new cljs.core.Keyword(null,"supply","supply",-1701696309),octet.core.ubyte,new cljs.core.Keyword(null,"fuel","fuel",10405485),octet.core.ubyte,new cljs.core.Keyword(null,"losses","losses",-189206407),octet.core.ubyte,new cljs.core.Keyword(null,"f-status","f-status",782756103),weathergen.falcon.files.larray.call(null,octet.core.ubyte,octet.core.ubyte),new cljs.core.Keyword(null,"priority","priority",1431093715),octet.core.ubyte,new cljs.core.Keyword(null,"name-id","name-id",-279275372),octet.core.int16,new cljs.core.Keyword(null,"parent","parent",-878878779),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"first-owner","first-owner",911218300),octet.core.ubyte,new cljs.core.Keyword(null,"links","links",-654507394),weathergen.falcon.files.larray.call(null,octet.core.ubyte,weathergen.falcon.files.mission.objective_link),new cljs.core.Keyword(null,"radar-data","radar-data",-2114904134),weathergen.falcon.files.spec_if.call(null,new cljs.core.Keyword(null,"has-radar-data","has-radar-data",-1734005648),octet.core.byte$,(function (p1__35046_SHARP_){
return cljs.core._EQ_.call(null,(1),p1__35046_SHARP_);
}),new cljs.core.Keyword(null,"detect-ratio","detect-ratio",-1552651193),octet.core.repeat.call(null,weathergen.falcon.constants.NUM_RADAR_ARCS,octet.core.float$),weathergen.falcon.files.constant.call(null,null))], null));
cljs.core._add_method.call(null,weathergen.falcon.files.mission.read_embedded_file_STAR_,new cljs.core.Keyword(null,"objectives","objectives",933939509),(function (_,p__35047,buf,___$1){
var map__35048 = p__35047;
var map__35048__$1 = ((((!((map__35048 == null)))?((((map__35048.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35048.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35048):map__35048);
var entry = map__35048__$1;
var offset = cljs.core.get.call(null,map__35048__$1,new cljs.core.Keyword(null,"offset","offset",296498311));
var length = cljs.core.get.call(null,map__35048__$1,new cljs.core.Keyword(null,"length","length",588987862));
var _STAR_byte_order_STAR_35050 = octet.buffer._STAR_byte_order_STAR_;
octet.buffer._STAR_byte_order_STAR_ = new cljs.core.Keyword(null,"little-endian","little-endian",1877303413);

try{var header_spec = octet.core.spec.call(null,new cljs.core.Keyword(null,"num-objectives","num-objectives",-1302595446),octet.core.int16,new cljs.core.Keyword(null,"uncompressed-size","uncompressed-size",-434136147),octet.core.int32,new cljs.core.Keyword(null,"compressed-size","compressed-size",-1517579578),octet.core.int32);
var map__35051 = octet.core.read.call(null,buf,header_spec,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),offset], null));
var map__35051__$1 = ((((!((map__35051 == null)))?((((map__35051.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35051.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35051):map__35051);
var num_objectives = cljs.core.get.call(null,map__35051__$1,new cljs.core.Keyword(null,"num-objectives","num-objectives",-1302595446));
var compressed_size = cljs.core.get.call(null,map__35051__$1,new cljs.core.Keyword(null,"compressed-size","compressed-size",-1517579578));
var uncompressed_size = cljs.core.get.call(null,map__35051__$1,new cljs.core.Keyword(null,"uncompressed-size","uncompressed-size",-434136147));
var data = weathergen.lzss.expand.call(null,buf,(offset + octet.core.size.call(null,header_spec)),compressed_size,uncompressed_size);
return octet.core.read.call(null,data,octet.core.repeat.call(null,num_objectives,cljs.core.apply.call(null,octet.core.spec,weathergen.falcon.files.mission.objective_fields)));
}finally {octet.buffer._STAR_byte_order_STAR_ = _STAR_byte_order_STAR_35050;
}}));
weathergen.falcon.files.mission.objective_delta = octet.core.spec.call(null,new cljs.core.Keyword(null,"id","id",-1388402092),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"last-repair","last-repair",1138109175),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"owner","owner",-392611939),octet.core.ubyte,new cljs.core.Keyword(null,"supply","supply",-1701696309),octet.core.ubyte,new cljs.core.Keyword(null,"fuel","fuel",10405485),octet.core.ubyte,new cljs.core.Keyword(null,"losses","losses",-189206407),octet.core.ubyte,new cljs.core.Keyword(null,"f-status","f-status",782756103),weathergen.falcon.files.larray.call(null,octet.core.ubyte,octet.core.ubyte));
cljs.core._add_method.call(null,weathergen.falcon.files.mission.read_embedded_file_STAR_,new cljs.core.Keyword(null,"objective-deltas","objective-deltas",710518611),(function (_,p__35053,buf,___$1){
var map__35054 = p__35053;
var map__35054__$1 = ((((!((map__35054 == null)))?((((map__35054.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35054.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35054):map__35054);
var entry = map__35054__$1;
var offset = cljs.core.get.call(null,map__35054__$1,new cljs.core.Keyword(null,"offset","offset",296498311));
var length = cljs.core.get.call(null,map__35054__$1,new cljs.core.Keyword(null,"length","length",588987862));
var _STAR_byte_order_STAR_35056 = octet.buffer._STAR_byte_order_STAR_;
octet.buffer._STAR_byte_order_STAR_ = new cljs.core.Keyword(null,"little-endian","little-endian",1877303413);

try{var header_spec = octet.core.spec.call(null,new cljs.core.Keyword(null,"compressed-size","compressed-size",-1517579578),octet.core.int32,new cljs.core.Keyword(null,"num-deltas","num-deltas",543784659),octet.core.int16,new cljs.core.Keyword(null,"uncompressed-size","uncompressed-size",-434136147),octet.core.int32);
var map__35057 = octet.core.read.call(null,buf,header_spec,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),offset], null));
var map__35057__$1 = ((((!((map__35057 == null)))?((((map__35057.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35057.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35057):map__35057);
var num_deltas = cljs.core.get.call(null,map__35057__$1,new cljs.core.Keyword(null,"num-deltas","num-deltas",543784659));
var compressed_size = cljs.core.get.call(null,map__35057__$1,new cljs.core.Keyword(null,"compressed-size","compressed-size",-1517579578));
var uncompressed_size = cljs.core.get.call(null,map__35057__$1,new cljs.core.Keyword(null,"uncompressed-size","uncompressed-size",-434136147));
var data = weathergen.lzss.expand.call(null,buf,(offset + octet.core.size.call(null,header_spec)),compressed_size,uncompressed_size);
return octet.core.read.call(null,data,octet.core.repeat.call(null,num_deltas,weathergen.falcon.files.mission.objective_delta));
}finally {octet.buffer._STAR_byte_order_STAR_ = _STAR_byte_order_STAR_35056;
}}));
cljs.core._add_method.call(null,weathergen.falcon.files.mission.read_embedded_file_STAR_,new cljs.core.Keyword(null,"victory-conditions","victory-conditions",-1943285833),(function (_,p__35059,buf,___$1){
var map__35060 = p__35059;
var map__35060__$1 = ((((!((map__35060 == null)))?((((map__35060.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35060.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35060):map__35060);
var entry = map__35060__$1;
var offset = cljs.core.get.call(null,map__35060__$1,new cljs.core.Keyword(null,"offset","offset",296498311));
var length = cljs.core.get.call(null,map__35060__$1,new cljs.core.Keyword(null,"length","length",588987862));
return octet.core.read.call(null,buf,weathergen.falcon.files.fixed_string.call(null,length),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),offset], null));
}));
weathergen.falcon.files.mission.team_air_action = octet.core.spec.call(null,new cljs.core.Keyword(null,"start","start",-355208981),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"stop","stop",-2140911342),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"objective","objective",1301058585),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"last-objective","last-objective",-1761076877),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"type","type",1174270348),octet.core.ubyte,new cljs.core.Keyword(null,"padding","padding",1660304693),octet.core.repeat.call(null,(3),octet.core.byte$));
weathergen.falcon.files.mission.team_ground_action = octet.core.spec.call(null,new cljs.core.Keyword(null,"time","time",1385887882),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"timeout","timeout",-318625318),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"objective","objective",1301058585),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"type","type",1174270348),octet.core.ubyte,new cljs.core.Keyword(null,"tempo","tempo",-1555208453),octet.core.ubyte,new cljs.core.Keyword(null,"points","points",-1486596883),octet.core.ubyte);
weathergen.falcon.files.mission.team_status = octet.core.spec.call(null,new cljs.core.Keyword(null,"air-defence-vehicles","air-defence-vehicles",933914278),octet.core.uint16,new cljs.core.Keyword(null,"aircraft","aircraft",-790597916),octet.core.uint16,new cljs.core.Keyword(null,"ground-vehicles","ground-vehicles",-103851136),octet.core.uint16,new cljs.core.Keyword(null,"ships","ships",-875113158),octet.core.uint16,new cljs.core.Keyword(null,"supply","supply",-1701696309),octet.core.uint16,new cljs.core.Keyword(null,"fuel","fuel",10405485),octet.core.uint16,new cljs.core.Keyword(null,"airbases","airbases",-1848087775),octet.core.uint16,new cljs.core.Keyword(null,"supply-level","supply-level",8080947),octet.core.ubyte,new cljs.core.Keyword(null,"fuel-level","fuel-level",1060451052),octet.core.ubyte);
weathergen.falcon.files.mission.atm_airbase = octet.core.spec.call(null,new cljs.core.Keyword(null,"id","id",-1388402092),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"schedule","schedule",349275266),octet.core.repeat.call(null,weathergen.falcon.constants.ATM_MAX_CYCLES,octet.core.ubyte));
weathergen.falcon.files.mission.tasking_manager_fields = new cljs.core.PersistentVector(null, 8, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"id","id",-1388402092),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"entity-type","entity-type",-1957300125),octet.core.uint16,new cljs.core.Keyword(null,"manager-flags","manager-flags",2031008919),octet.core.int16,new cljs.core.Keyword(null,"owner","owner",-392611939),octet.core.ubyte], null);
weathergen.falcon.files.mission.mission_request = octet.core.spec.call(null,new cljs.core.Keyword(null,"requester","requester",2032946161),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"target","target",253001721),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"secondary","secondary",-669381460),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"pak","pak",-1071422534),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"who","who",-235935040),octet.core.ubyte,new cljs.core.Keyword(null,"vs","vs",-2022097090),octet.core.ubyte,new cljs.core.Keyword(null,"padding","padding",1660304693),octet.core.repeat.call(null,(2),octet.core.byte$),new cljs.core.Keyword(null,"tot","tot",2086174646),octet.core.uint32,new cljs.core.Keyword(null,"tx","tx",466630418),octet.core.int16,new cljs.core.Keyword(null,"ty","ty",158290825),octet.core.int16,new cljs.core.Keyword(null,"flags","flags",1775418075),octet.core.uint32,new cljs.core.Keyword(null,"caps","caps",-183763072),octet.core.int16,new cljs.core.Keyword(null,"target-num","target-num",1623497814),octet.core.int16,new cljs.core.Keyword(null,"speed","speed",1257663751),octet.core.int16,new cljs.core.Keyword(null,"match-strength","match-strength",1432664922),octet.core.int16,new cljs.core.Keyword(null,"priority","priority",1431093715),octet.core.int16,new cljs.core.Keyword(null,"tot-type","tot-type",-524162589),octet.core.ubyte,new cljs.core.Keyword(null,"action-type","action-type",-1141667361),octet.core.ubyte,new cljs.core.Keyword(null,"mission","mission",1740288522),octet.core.ubyte,new cljs.core.Keyword(null,"aircraft","aircraft",-790597916),octet.core.ubyte,new cljs.core.Keyword(null,"context","context",-830191113),octet.core.ubyte,new cljs.core.Keyword(null,"roe-check","roe-check",-302273906),octet.core.ubyte,new cljs.core.Keyword(null,"delayed","delayed",251992229),octet.core.ubyte,new cljs.core.Keyword(null,"start-block","start-block",885980136),octet.core.ubyte,new cljs.core.Keyword(null,"final-block","final-block",-1801414066),octet.core.ubyte,new cljs.core.Keyword(null,"slots","slots",276818598),octet.core.repeat.call(null,(4),octet.core.ubyte),new cljs.core.Keyword(null,"min-to","min-to",-486357137),octet.core.byte$,new cljs.core.Keyword(null,"max-to","max-to",801697233),octet.core.byte$,new cljs.core.Keyword(null,"padding","padding",1660304693),octet.core.repeat.call(null,(3),octet.core.byte$));
weathergen.falcon.files.mission.air_tasking_manager = cljs.core.apply.call(null,octet.core.spec,cljs.core.into.call(null,weathergen.falcon.files.mission.tasking_manager_fields,new cljs.core.PersistentVector(null, 14, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"flags","flags",1775418075),octet.core.int16,new cljs.core.Keyword(null,"average-ca-strength","average-ca-strength",1605217659),octet.core.int16,new cljs.core.Keyword(null,"average-ca-missions","average-ca-missions",1515247290),octet.core.int16,new cljs.core.Keyword(null,"sample-cycles","sample-cycles",1176043458),octet.core.ubyte,new cljs.core.Keyword(null,"airbases","airbases",-1848087775),weathergen.falcon.files.larray.call(null,octet.core.ubyte,weathergen.falcon.files.mission.atm_airbase),new cljs.core.Keyword(null,"cycle","cycle",710365284),octet.core.ubyte,new cljs.core.Keyword(null,"mission-requests","mission-requests",75740277),weathergen.falcon.files.larray.call(null,octet.core.int16,weathergen.falcon.files.mission.mission_request)], null)));
weathergen.falcon.files.mission.ground_tasking_manager = cljs.core.apply.call(null,octet.core.spec,cljs.core.into.call(null,weathergen.falcon.files.mission.tasking_manager_fields,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"flags","flags",1775418075),octet.core.int16], null)));
weathergen.falcon.files.mission.naval_tasking_manager = cljs.core.apply.call(null,octet.core.spec,cljs.core.into.call(null,weathergen.falcon.files.mission.tasking_manager_fields,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"flags","flags",1775418075),octet.core.int16], null)));
weathergen.falcon.files.mission.team = octet.core.spec.call(null,new cljs.core.Keyword(null,"id","id",-1388402092),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"entity-type","entity-type",-1957300125),octet.core.uint16,new cljs.core.Keyword(null,"who","who",-235935040),octet.core.ubyte,new cljs.core.Keyword(null,"c-team","c-team",1058111407),octet.core.ubyte,new cljs.core.Keyword(null,"flags","flags",1775418075),octet.core.uint16,new cljs.core.Keyword(null,"members","members",159001018),octet.core.repeat.call(null,(8),octet.core.ubyte),new cljs.core.Keyword(null,"stance","stance",1737508388),octet.core.repeat.call(null,(8),octet.core.int16),new cljs.core.Keyword(null,"first-colonel","first-colonel",1587615555),octet.core.int16,new cljs.core.Keyword(null,"first-commander","first-commander",813403189),octet.core.int16,new cljs.core.Keyword(null,"first-wingman","first-wingman",1224041428),octet.core.int16,new cljs.core.Keyword(null,"last-wingman","last-wingman",199145869),octet.core.int16,new cljs.core.Keyword(null,"air-experience","air-experience",1765463253),octet.core.ubyte,new cljs.core.Keyword(null,"air-defense-experience","air-defense-experience",-1710546376),octet.core.ubyte,new cljs.core.Keyword(null,"ground-experience","ground-experience",107729084),octet.core.ubyte,new cljs.core.Keyword(null,"naval-experience","naval-experience",-527591070),octet.core.ubyte,new cljs.core.Keyword(null,"initiatve","initiatve",-26014217),octet.core.int16,new cljs.core.Keyword(null,"supply-available","supply-available",2126380660),octet.core.uint16,new cljs.core.Keyword(null,"fuel-available","fuel-available",-1529395011),octet.core.uint16,new cljs.core.Keyword(null,"replacements-available","replacements-available",-1198113611),octet.core.uint16,new cljs.core.Keyword(null,"player-rating","player-rating",-961496862),octet.core.float$,new cljs.core.Keyword(null,"last-player-mission","last-player-mission",-137478691),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"current-stats","current-stats",-1217775099),weathergen.falcon.files.mission.team_status,new cljs.core.Keyword(null,"start-stats","start-stats",-1172674533),weathergen.falcon.files.mission.team_status,new cljs.core.Keyword(null,"reinforcement","reinforcement",-1971947958),octet.core.int16,new cljs.core.Keyword(null,"bonus-objs","bonus-objs",-1412153629),octet.core.repeat.call(null,(20),weathergen.falcon.files.mission.vu_id),new cljs.core.Keyword(null,"bonus-time","bonus-time",-1996956468),octet.core.repeat.call(null,(20),octet.core.uint32),new cljs.core.Keyword(null,"obj-type-priority","obj-type-priority",-1521374560),octet.core.repeat.call(null,(36),octet.core.ubyte),new cljs.core.Keyword(null,"unit-type-priority","unit-type-priority",-1360846399),octet.core.repeat.call(null,(20),octet.core.ubyte),new cljs.core.Keyword(null,"mission-priority","mission-priority",1715506931),octet.core.repeat.call(null,(41),octet.core.ubyte),new cljs.core.Keyword(null,"max-vehicle","max-vehicle",1951303391),octet.core.repeat.call(null,(4),octet.core.ubyte),new cljs.core.Keyword(null,"team-flag","team-flag",-1307034656),octet.core.ubyte,new cljs.core.Keyword(null,"team-color","team-color",206199444),octet.core.ubyte,new cljs.core.Keyword(null,"equipment","equipment",790435115),octet.core.ubyte,new cljs.core.Keyword(null,"name","name",1843675177),weathergen.falcon.files.fixed_string.call(null,(20)),new cljs.core.Keyword(null,"motto","motto",-708709752),weathergen.falcon.files.fixed_string.call(null,(200)),new cljs.core.Keyword(null,"ground-action","ground-action",858540012),weathergen.falcon.files.mission.team_ground_action,new cljs.core.Keyword(null,"defensive-air-action","defensive-air-action",-480842903),weathergen.falcon.files.mission.team_air_action,new cljs.core.Keyword(null,"offensive-air-action","offensive-air-action",955423612),weathergen.falcon.files.mission.team_air_action);
weathergen.falcon.files.mission.team_record = octet.core.spec.call(null,new cljs.core.Keyword(null,"team","team",1355747699),weathergen.falcon.files.mission.team,new cljs.core.Keyword(null,"air-tasking-manager","air-tasking-manager",-279900872),weathergen.falcon.files.mission.air_tasking_manager,new cljs.core.Keyword(null,"ground-tasking-manager","ground-tasking-manager",1373954444),weathergen.falcon.files.mission.ground_tasking_manager,new cljs.core.Keyword(null,"naval-tasking-manager","naval-tasking-manager",862649185),weathergen.falcon.files.mission.naval_tasking_manager);
cljs.core._add_method.call(null,weathergen.falcon.files.mission.read_embedded_file_STAR_,new cljs.core.Keyword(null,"teams","teams",1677714510),(function (_,p__35062,buf,___$1){
var map__35063 = p__35062;
var map__35063__$1 = ((((!((map__35063 == null)))?((((map__35063.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35063.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35063):map__35063);
var entry = map__35063__$1;
var offset = cljs.core.get.call(null,map__35063__$1,new cljs.core.Keyword(null,"offset","offset",296498311));
var length = cljs.core.get.call(null,map__35063__$1,new cljs.core.Keyword(null,"length","length",588987862));
var _STAR_byte_order_STAR_35065 = octet.buffer._STAR_byte_order_STAR_;
octet.buffer._STAR_byte_order_STAR_ = new cljs.core.Keyword(null,"little-endian","little-endian",1877303413);

try{return octet.core.read.call(null,buf,weathergen.falcon.files.larray.call(null,octet.core.int16,weathergen.falcon.files.mission.team_record),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),offset], null));
}finally {octet.buffer._STAR_byte_order_STAR_ = _STAR_byte_order_STAR_35065;
}}));
cljs.core._add_method.call(null,weathergen.falcon.files.mission.read_embedded_file_STAR_,new cljs.core.Keyword(null,"version","version",425292698),(function (_,p__35066,buf,___$1){
var map__35067 = p__35066;
var map__35067__$1 = ((((!((map__35067 == null)))?((((map__35067.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35067.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35067):map__35067);
var entry = map__35067__$1;
var offset = cljs.core.get.call(null,map__35067__$1,new cljs.core.Keyword(null,"offset","offset",296498311));
var length = cljs.core.get.call(null,map__35067__$1,new cljs.core.Keyword(null,"length","length",588987862));
var version_string = octet.core.read.call(null,buf,weathergen.falcon.files.fixed_string.call(null,length),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),offset], null));
return new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"version","version",425292698),cljs.core.long$.call(null,(new Number(version_string)).valueOf())], null);
}));
weathergen.falcon.files.mission.waypoint = (function (){
if(typeof weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35069 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35069 = (function (meta35070){
this.meta35070 = meta35070;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35069.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_35071,meta35070__$1){
var self__ = this;
var _35071__$1 = this;
return (new weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35069(meta35070__$1));
});

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35069.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_35071){
var self__ = this;
var _35071__$1 = this;
return self__.meta35070;
});

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35069.prototype.octet$spec$ISpec$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35069.prototype.octet$spec$ISpec$read$arity$3 = (function (_,buf,pos){
var self__ = this;
var ___$1 = this;
return weathergen.falcon.files.read__GT_.call(null,buf,pos,cljs.core.constantly.call(null,octet.core.spec.call(null,new cljs.core.Keyword(null,"haves","haves",-405191810),weathergen.falcon.files.bitflags.call(null,octet.core.ubyte,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"deptime","deptime",1842159584),(1),new cljs.core.Keyword(null,"target","target",253001721),(2)], null)),new cljs.core.Keyword(null,"grid-x","grid-x",1935903622),octet.core.int16,new cljs.core.Keyword(null,"grid-y","grid-y",1140315474),octet.core.int16,new cljs.core.Keyword(null,"grid-z","grid-z",855482282),octet.core.int16,new cljs.core.Keyword(null,"arrive","arrive",-284644322),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"action","action",-811238024),octet.core.ubyte,new cljs.core.Keyword(null,"route-action","route-action",1993857154),octet.core.ubyte,new cljs.core.Keyword(null,"formation","formation",-38517787),octet.core.ubyte,new cljs.core.Keyword(null,"flags","flags",1775418075),octet.core.uint32)),((function (___$1){
return (function (p__35072){
var map__35073 = p__35072;
var map__35073__$1 = ((((!((map__35073 == null)))?((((map__35073.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35073.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35073):map__35073);
var haves = cljs.core.get.call(null,map__35073__$1,new cljs.core.Keyword(null,"haves","haves",-405191810));
if(cljs.core.truth_(haves.call(null,new cljs.core.Keyword(null,"target","target",253001721)))){
return octet.core.spec.call(null,new cljs.core.Keyword(null,"target-id","target-id",-1438159155),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"target-building","target-building",-464097984),octet.core.ubyte);
} else {
return weathergen.falcon.files.constant.call(null,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"target-id","target-id",-1438159155),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"name","name",1843675177),(0),new cljs.core.Keyword(null,"creator","creator",-1069241724),(0)], null),new cljs.core.Keyword(null,"target-building","target-building",-464097984),(255)], null));
}
});})(___$1))
,((function (___$1){
return (function (p__35075){
var map__35076 = p__35075;
var map__35076__$1 = ((((!((map__35076 == null)))?((((map__35076.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35076.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35076):map__35076);
var haves = cljs.core.get.call(null,map__35076__$1,new cljs.core.Keyword(null,"haves","haves",-405191810));
var arrive = cljs.core.get.call(null,map__35076__$1,new cljs.core.Keyword(null,"arrive","arrive",-284644322));
if(cljs.core.truth_(haves.call(null,new cljs.core.Keyword(null,"deptime","deptime",1842159584)))){
return octet.core.spec.call(null,new cljs.core.Keyword(null,"depart","depart",-100007287),weathergen.falcon.files.mission.campaign_time);
} else {
return weathergen.falcon.files.constant.call(null,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"depart","depart",-100007287),arrive], null));
}
});})(___$1))
);
});

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35069.getBasis = (function (){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"meta35070","meta35070",-1158904340,null)], null);
});

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35069.cljs$lang$type = true;

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35069.cljs$lang$ctorStr = "weathergen.falcon.files.mission/t_weathergen$falcon$files$mission35069";

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35069.cljs$lang$ctorPrWriter = (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"weathergen.falcon.files.mission/t_weathergen$falcon$files$mission35069");
});

weathergen.falcon.files.mission.__GT_t_weathergen$falcon$files$mission35069 = (function weathergen$falcon$files$mission$__GT_t_weathergen$falcon$files$mission35069(meta35070){
return (new weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35069(meta35070));
});

}

return (new weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35069(cljs.core.PersistentArrayMap.EMPTY));
})()
;
weathergen.falcon.files.mission.unit_fields = cljs.core.into.call(null,weathergen.falcon.files.mission.camp_base_fields,new cljs.core.PersistentVector(null, 28, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"last-check","last-check",-339535317),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"roster","roster",-2092272532),octet.core.int32,new cljs.core.Keyword(null,"unit-flags","unit-flags",-1443684773),weathergen.falcon.files.bitflags.call(null,octet.core.int32,cljs.core.PersistentHashMap.fromArrays([new cljs.core.Keyword(null,"inactive","inactive",-306247616),new cljs.core.Keyword(null,"targeted","targeted",1866166976),new cljs.core.Keyword(null,"scripted","scripted",841874113),new cljs.core.Keyword(null,"cargo","cargo",1523239588),new cljs.core.Keyword(null,"dead","dead",-1946604091),new cljs.core.Keyword(null,"parent","parent",-878878779),new cljs.core.Keyword(null,"no-abort","no-abort",-1391513562),new cljs.core.Keyword(null,"broken","broken",-1742446874),new cljs.core.Keyword(null,"supported","supported",495067239),new cljs.core.Keyword(null,"engaged","engaged",-2134702904),new cljs.core.Keyword(null,"b1","b1",-1270036758),new cljs.core.Keyword(null,"diverted","diverted",-1205267702),new cljs.core.Keyword(null,"assigned","assigned",902306794),new cljs.core.Keyword(null,"commando","commando",-1208493780),new cljs.core.Keyword(null,"detached","detached",-1742825972),new cljs.core.Keyword(null,"final","final",1157881357),new cljs.core.Keyword(null,"retreating","retreating",939624530),new cljs.core.Keyword(null,"ordered","ordered",1187041426),new cljs.core.Keyword(null,"temp-dest","temp-dest",1981885235),new cljs.core.Keyword(null,"locked","locked",-1658763820),new cljs.core.Keyword(null,"has-ecm","has-ecm",-911757707),new cljs.core.Keyword(null,"fired","fired",847762742),new cljs.core.Keyword(null,"b3","b3",1128981270),new cljs.core.Keyword(null,"has-pilots","has-pilots",2107982743),new cljs.core.Keyword(null,"fragmented","fragmented",2137375992),new cljs.core.Keyword(null,"moving","moving",1760797240),new cljs.core.Keyword(null,"losses","losses",-189206407),new cljs.core.Keyword(null,"no-pllaning","no-pllaning",391157466),new cljs.core.Keyword(null,"ia-kill","ia-kill",-551424899),new cljs.core.Keyword(null,"refused","refused",1763905885),new cljs.core.Keyword(null,"combat","combat",517558269)],[(131072),(1048576),(256),(8192),(1),(32),(67108864),(32768),(8388608),(64),(128),(4194304),(4),(512),(4194304),(1048576),(2097152),(8),(16777216),(16777216),(4096),(8388608),(2),(2097152),(262144),(1024),(65536),(16),(33554432),(2048),(16384)])),new cljs.core.Keyword(null,"destination-x","destination-x",360399650),octet.core.int16,new cljs.core.Keyword(null,"destination-y","destination-y",1591470692),octet.core.int16,new cljs.core.Keyword(null,"target-id","target-id",-1438159155),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"cargo-id","cargo-id",-1256830674),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"moved","moved",486549219),octet.core.ubyte,new cljs.core.Keyword(null,"losses","losses",-189206407),octet.core.ubyte,new cljs.core.Keyword(null,"tactic","tactic",-761722830),octet.core.ubyte,new cljs.core.Keyword(null,"current-wp","current-wp",-661271807),octet.core.uint16,new cljs.core.Keyword(null,"name-id","name-id",-279275372),octet.core.int16,new cljs.core.Keyword(null,"reinforcement","reinforcement",-1971947958),octet.core.int16,new cljs.core.Keyword(null,"waypoints","waypoints",-844253224),weathergen.falcon.files.larray.call(null,octet.core.uint16,weathergen.falcon.files.mission.waypoint)], null));
weathergen.falcon.files.mission.pilot = octet.core.spec.call(null,new cljs.core.Keyword(null,"id","id",-1388402092),octet.core.int16,new cljs.core.Keyword(null,"skill-and-rating","skill-and-rating",749733118),octet.core.ubyte,new cljs.core.Keyword(null,"status","status",-1997798413),octet.core.ubyte,new cljs.core.Keyword(null,"aa-kills","aa-kills",-876434324),octet.core.ubyte,new cljs.core.Keyword(null,"ag-kills","ag-kills",-1864909861),octet.core.ubyte,new cljs.core.Keyword(null,"as-kills","as-kills",-1944782407),octet.core.ubyte,new cljs.core.Keyword(null,"an-kills","an-kills",-1903966172),octet.core.ubyte,new cljs.core.Keyword(null,"missions-flown","missions-flown",-1901147427),octet.core.int16);
weathergen.falcon.files.mission.loadout = octet.core.spec.call(null,new cljs.core.Keyword(null,"id","id",-1388402092),octet.core.repeat.call(null,(16),octet.core.uint16),new cljs.core.Keyword(null,"count","count",2139924085),octet.core.repeat.call(null,(16),octet.core.ubyte));
weathergen.falcon.files.mission.flight = cljs.core.apply.call(null,octet.core.spec,cljs.core.into.call(null,weathergen.falcon.files.mission.unit_fields,cljs.core.PersistentVector.fromArray([new cljs.core.Keyword(null,"type","type",1174270348),weathergen.falcon.files.constant.call(null,new cljs.core.Keyword(null,"flight","flight",-764860679)),new cljs.core.Keyword(null,"pos-z","pos-z",-2046554196),octet.core.float$,new cljs.core.Keyword(null,"fuel-burnt","fuel-burnt",1132148442),octet.core.int32,new cljs.core.Keyword(null,"last-move","last-move",2069214404),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"last-combat","last-combat",406442709),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"time-on-target","time-on-target",-857850216),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"mission-over-time","mission-over-time",949947865),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"mission-target","mission-target",467808629),octet.core.int16,new cljs.core.Keyword(null,"loadouts","loadouts",1824879361),weathergen.falcon.files.larray.call(null,octet.core.ubyte,weathergen.falcon.files.mission.loadout),new cljs.core.Keyword(null,"mission","mission",1740288522),octet.core.ubyte,new cljs.core.Keyword(null,"old-mission","old-mission",-292358051),octet.core.ubyte,new cljs.core.Keyword(null,"last-direction","last-direction",-1676432794),octet.core.ubyte,new cljs.core.Keyword(null,"priority","priority",1431093715),octet.core.ubyte,new cljs.core.Keyword(null,"mission-id","mission-id",1232466132),octet.core.ubyte,new cljs.core.Keyword(null,"eval-flags","eval-flags",1604606092),octet.core.ubyte,new cljs.core.Keyword(null,"mission-context","mission-context",-1613541188),octet.core.ubyte,new cljs.core.Keyword(null,"package","package",1189062786),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"squadron","squadron",-1131671273),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"requester","requester",2032946161),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"slots","slots",276818598),octet.core.repeat.call(null,(4),octet.core.ubyte),new cljs.core.Keyword(null,"pilots","pilots",353525853),octet.core.repeat.call(null,(4),octet.core.ubyte),new cljs.core.Keyword(null,"plane-stats","plane-stats",-4010361),octet.core.repeat.call(null,(4),octet.core.ubyte),new cljs.core.Keyword(null,"player-slots","player-slots",-2024567622),octet.core.repeat.call(null,(4),octet.core.ubyte),new cljs.core.Keyword(null,"last-player-slot","last-player-slot",-1491370688),octet.core.ubyte,new cljs.core.Keyword(null,"callsign-id","callsign-id",501232863),octet.core.ubyte,new cljs.core.Keyword(null,"callsign-num","callsign-num",-1771041170),octet.core.ubyte,new cljs.core.Keyword(null,"refuel-quantity","refuel-quantity",-765272130),octet.core.uint32], true)));
weathergen.falcon.files.mission.squadron = cljs.core.apply.call(null,octet.core.spec,cljs.core.into.call(null,weathergen.falcon.files.mission.unit_fields,cljs.core.PersistentVector.fromArray([new cljs.core.Keyword(null,"type","type",1174270348),weathergen.falcon.files.constant.call(null,new cljs.core.Keyword(null,"squadron","squadron",-1131671273)),new cljs.core.Keyword(null,"fuel","fuel",10405485),octet.core.int32,new cljs.core.Keyword(null,"specialty","specialty",-159219386),octet.core.ubyte,new cljs.core.Keyword(null,"stores","stores",1203804823),octet.core.repeat.call(null,(600),octet.core.ubyte),new cljs.core.Keyword(null,"pilots","pilots",353525853),octet.core.repeat.call(null,(48),weathergen.falcon.files.mission.pilot),new cljs.core.Keyword(null,"schedule","schedule",349275266),octet.core.repeat.call(null,(16),octet.core.int32),new cljs.core.Keyword(null,"airbase-id","airbase-id",-1975592308),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"hot-spot","hot-spot",-1626884754),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"rating","rating",144173662),octet.core.repeat.call(null,(16),octet.core.ubyte),new cljs.core.Keyword(null,"aa-kills","aa-kills",-876434324),octet.core.int16,new cljs.core.Keyword(null,"ag-kills","ag-kills",-1864909861),octet.core.int16,new cljs.core.Keyword(null,"as-kills","as-kills",-1944782407),octet.core.int16,new cljs.core.Keyword(null,"an-kills","an-kills",-1903966172),octet.core.int16,new cljs.core.Keyword(null,"missions-flown","missions-flown",-1901147427),octet.core.int16,new cljs.core.Keyword(null,"mission-score","mission-score",1969337799),octet.core.int16,new cljs.core.Keyword(null,"total-losses","total-losses",-404891334),octet.core.ubyte,new cljs.core.Keyword(null,"pilot-losses","pilot-losses",-1237633377),octet.core.ubyte,new cljs.core.Keyword(null,"squadron-patch","squadron-patch",883934030),octet.core.ubyte], true)));
weathergen.falcon.files.mission.package$ = (function (){var package_common = cljs.core.apply.call(null,octet.core.spec,cljs.core.into.call(null,weathergen.falcon.files.mission.unit_fields,new cljs.core.PersistentVector(null, 16, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"type","type",1174270348),weathergen.falcon.files.constant.call(null,new cljs.core.Keyword(null,"package","package",1189062786)),new cljs.core.Keyword(null,"elements","elements",657646735),weathergen.falcon.files.larray.call(null,octet.core.ubyte,weathergen.falcon.files.mission.vu_id),new cljs.core.Keyword(null,"interceptor","interceptor",1127739076),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"awacs","awacs",296317915),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"jstar","jstar",942398657),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"ecm","ecm",1070201018),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"tanker","tanker",932081370),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"wait-cycles","wait-cycles",1056333577),octet.core.ubyte], null)));
if(typeof weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35078 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35078 = (function (package_common,meta35079){
this.package_common = package_common;
this.meta35079 = meta35079;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35078.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (package_common){
return (function (_35080,meta35079__$1){
var self__ = this;
var _35080__$1 = this;
return (new weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35078(self__.package_common,meta35079__$1));
});})(package_common))
;

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35078.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (package_common){
return (function (_35080){
var self__ = this;
var _35080__$1 = this;
return self__.meta35079;
});})(package_common))
;

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35078.prototype.octet$spec$ISpec$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35078.prototype.octet$spec$ISpec$read$arity$3 = ((function (package_common){
return (function (_,buf,pos){
var self__ = this;
var ___$1 = this;
return weathergen.falcon.files.read__GT_.call(null,buf,pos,cljs.core.constantly.call(null,self__.package_common),((function (___$1,package_common){
return (function (p__35081){
var map__35082 = p__35081;
var map__35082__$1 = ((((!((map__35082 == null)))?((((map__35082.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35082.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35082):map__35082);
var val = map__35082__$1;
var unit_flags = cljs.core.get.call(null,map__35082__$1,new cljs.core.Keyword(null,"unit-flags","unit-flags",-1443684773));
var wait_cycles = cljs.core.get.call(null,map__35082__$1,new cljs.core.Keyword(null,"wait-cycles","wait-cycles",1056333577));
if(cljs.core.truth_((function (){var and__23136__auto__ = (wait_cycles === (0));
if(and__23136__auto__){
return unit_flags.call(null,new cljs.core.Keyword(null,"final","final",1157881357));
} else {
return and__23136__auto__;
}
})())){
return octet.core.spec.call(null,new cljs.core.Keyword(null,"requests","requests",-733055638),octet.core.int16,new cljs.core.Keyword(null,"responses","responses",1257546453),octet.core.int16,new cljs.core.Keyword(null,"mission-request","mission-request",1082141061),octet.core.spec.call(null,new cljs.core.Keyword(null,"mission","mission",1740288522),octet.core.int16,new cljs.core.Keyword(null,"context","context",-830191113),octet.core.int16,new cljs.core.Keyword(null,"requester","requester",2032946161),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"target","target",253001721),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"tot","tot",2086174646),octet.core.uint32,new cljs.core.Keyword(null,"action-type","action-type",-1141667361),octet.core.ubyte,new cljs.core.Keyword(null,"priority","priority",1431093715),octet.core.int16,new cljs.core.Keyword(null,"package-flags","package-flags",-1703964557),weathergen.falcon.files.constant.call(null,(0))));
} else {
return octet.core.spec.call(null,new cljs.core.Keyword(null,"flights","flights",-1637719124),octet.core.ubyte,new cljs.core.Keyword(null,"wait-for","wait-for",603509654),octet.core.int16,new cljs.core.Keyword(null,"iax","iax",-433137964),octet.core.int16,new cljs.core.Keyword(null,"iay","iay",-521538055),octet.core.int16,new cljs.core.Keyword(null,"eax","eax",-547444364),octet.core.int16,new cljs.core.Keyword(null,"eay","eay",1273269818),octet.core.int16,new cljs.core.Keyword(null,"bpx","bpx",1117947531),octet.core.int16,new cljs.core.Keyword(null,"bpy","bpy",1257027485),octet.core.int16,new cljs.core.Keyword(null,"tpx","tpx",-159997489),octet.core.int16,new cljs.core.Keyword(null,"tpy","tpy",-1818085337),octet.core.int16,new cljs.core.Keyword(null,"takeoff","takeoff",719937767),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"tp-time","tp-time",1666792567),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"package-flags","package-flags",-1703964557),octet.core.uint32,new cljs.core.Keyword(null,"caps","caps",-183763072),octet.core.int16,new cljs.core.Keyword(null,"requests","requests",-733055638),octet.core.int16,new cljs.core.Keyword(null,"responses","responses",1257546453),octet.core.int16,new cljs.core.Keyword(null,"ingress-waypoints","ingress-waypoints",-335959125),weathergen.falcon.files.larray.call(null,octet.core.ubyte,weathergen.falcon.files.mission.waypoint),new cljs.core.Keyword(null,"egress-waypoints","egress-waypoints",1279029151),weathergen.falcon.files.larray.call(null,octet.core.ubyte,weathergen.falcon.files.mission.waypoint),new cljs.core.Keyword(null,"mission-request","mission-request",1082141061),weathergen.falcon.files.mission.mission_request);
}
});})(___$1,package_common))
);
});})(package_common))
;

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35078.getBasis = ((function (package_common){
return (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"package-common","package-common",119587311,null),new cljs.core.Symbol(null,"meta35079","meta35079",-1459211621,null)], null);
});})(package_common))
;

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35078.cljs$lang$type = true;

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35078.cljs$lang$ctorStr = "weathergen.falcon.files.mission/t_weathergen$falcon$files$mission35078";

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35078.cljs$lang$ctorPrWriter = ((function (package_common){
return (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"weathergen.falcon.files.mission/t_weathergen$falcon$files$mission35078");
});})(package_common))
;

weathergen.falcon.files.mission.__GT_t_weathergen$falcon$files$mission35078 = ((function (package_common){
return (function weathergen$falcon$files$mission$__GT_t_weathergen$falcon$files$mission35078(package_common__$1,meta35079){
return (new weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35078(package_common__$1,meta35079));
});})(package_common))
;

}

return (new weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35078(package_common,cljs.core.PersistentArrayMap.EMPTY));
})();
weathergen.falcon.files.mission.ground_unit_fields = cljs.core.into.call(null,weathergen.falcon.files.mission.unit_fields,new cljs.core.PersistentVector(null, 6, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"orders","orders",-1032870176),octet.core.ubyte,new cljs.core.Keyword(null,"division","division",259369926),octet.core.int16,new cljs.core.Keyword(null,"aobj","aobj",-793409761),weathergen.falcon.files.mission.vu_id], null));
weathergen.falcon.files.mission.brigade = cljs.core.apply.call(null,octet.core.spec,cljs.core.into.call(null,weathergen.falcon.files.mission.ground_unit_fields,new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"type","type",1174270348),weathergen.falcon.files.constant.call(null,new cljs.core.Keyword(null,"brigade","brigade",1288936530)),new cljs.core.Keyword(null,"elements","elements",657646735),weathergen.falcon.files.larray.call(null,octet.core.ubyte,weathergen.falcon.files.mission.vu_id)], null)));
weathergen.falcon.files.mission.battalion = cljs.core.apply.call(null,octet.core.spec,cljs.core.into.call(null,weathergen.falcon.files.mission.ground_unit_fields,new cljs.core.PersistentVector(null, 22, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"type","type",1174270348),weathergen.falcon.files.constant.call(null,new cljs.core.Keyword(null,"battalion","battalion",1283181700)),new cljs.core.Keyword(null,"last-move","last-move",2069214404),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"last-combat","last-combat",406442709),weathergen.falcon.files.mission.campaign_time,new cljs.core.Keyword(null,"parent-id","parent-id",-1400729131),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"last-obj","last-obj",-2066143568),weathergen.falcon.files.mission.vu_id,new cljs.core.Keyword(null,"supply","supply",-1701696309),octet.core.ubyte,new cljs.core.Keyword(null,"fatigue","fatigue",435886183),octet.core.ubyte,new cljs.core.Keyword(null,"morale","morale",980493731),octet.core.ubyte,new cljs.core.Keyword(null,"heading","heading",-1312171873),octet.core.ubyte,new cljs.core.Keyword(null,"final-heading","final-heading",-13156462),octet.core.ubyte,new cljs.core.Keyword(null,"position","position",-2011731912),octet.core.ubyte], null)));
weathergen.falcon.files.mission.task_force = cljs.core.apply.call(null,octet.core.spec,cljs.core.into.call(null,weathergen.falcon.files.mission.unit_fields,new cljs.core.PersistentVector(null, 6, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"type","type",1174270348),weathergen.falcon.files.constant.call(null,new cljs.core.Keyword(null,"task-force","task-force",1860415305)),new cljs.core.Keyword(null,"orders","orders",-1032870176),octet.core.ubyte,new cljs.core.Keyword(null,"supply","supply",-1701696309),octet.core.ubyte], null)));
/**
 * Returns an octet spec for unit records against the given
 *   class table.
 */
weathergen.falcon.files.mission.unit_record = (function weathergen$falcon$files$mission$unit_record(database){
if(typeof weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35096 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35096 = (function (database,meta35097){
this.database = database;
this.meta35097 = meta35097;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35096.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_35098,meta35097__$1){
var self__ = this;
var _35098__$1 = this;
return (new weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35096(self__.database,meta35097__$1));
});

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35096.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_35098){
var self__ = this;
var _35098__$1 = this;
return self__.meta35097;
});

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35096.prototype.octet$spec$ISpec$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35096.prototype.octet$spec$ISpec$read$arity$3 = (function (_,buf,pos){
var self__ = this;
var ___$1 = this;
var type_id = octet.core.read.call(null,buf,octet.core.int16,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),pos], null));
if((type_id === (0))){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(2),null], null);
} else {
var map__35099 = weathergen.falcon.files.mission.class_info.call(null,self__.database,type_id);
var map__35099__$1 = ((((!((map__35099 == null)))?((((map__35099.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35099.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35099):map__35099);
var domain = cljs.core.get.call(null,map__35099__$1,new cljs.core.Keyword(null,"domain","domain",1847214937));
var type = cljs.core.get.call(null,map__35099__$1,new cljs.core.Keyword(null,"type","type",1174270348));
var spc = (function (){var pred__35104 = cljs.core._EQ_;
var expr__35105 = new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [domain,type], null);
if(cljs.core.truth_(pred__35104.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [weathergen.falcon.constants.DOMAIN_AIR,weathergen.falcon.constants.TYPE_FLIGHT], null),expr__35105))){
return weathergen.falcon.files.mission.flight;
} else {
if(cljs.core.truth_(pred__35104.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [weathergen.falcon.constants.DOMAIN_AIR,weathergen.falcon.constants.TYPE_PACKAGE], null),expr__35105))){
return weathergen.falcon.files.mission.package$;
} else {
if(cljs.core.truth_(pred__35104.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [weathergen.falcon.constants.DOMAIN_AIR,weathergen.falcon.constants.TYPE_SQUADRON], null),expr__35105))){
return weathergen.falcon.files.mission.squadron;
} else {
if(cljs.core.truth_(pred__35104.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [weathergen.falcon.constants.DOMAIN_LAND,weathergen.falcon.constants.TYPE_BATTALION], null),expr__35105))){
return weathergen.falcon.files.mission.battalion;
} else {
if(cljs.core.truth_(pred__35104.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [weathergen.falcon.constants.DOMAIN_LAND,weathergen.falcon.constants.TYPE_BRIGADE], null),expr__35105))){
return weathergen.falcon.files.mission.brigade;
} else {
if(cljs.core.truth_(pred__35104.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [weathergen.falcon.constants.DOMAIN_SEA,weathergen.falcon.constants.TYPE_TASKFORCE], null),expr__35105))){
return weathergen.falcon.files.mission.task_force;
} else {
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("No matching clause: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(expr__35105)].join('')));
}
}
}
}
}
}
})();
var vec__35100 = (function (){try{return octet.core.read_STAR_.call(null,buf,spc,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),(pos + (2))], null));
}catch (e35107){var x = e35107;
taoensso.timbre._log_BANG_.call(null,taoensso.timbre._STAR_config_STAR_,new cljs.core.Keyword(null,"error","error",-978969032),"weathergen.falcon.files.mission",null,1529,new cljs.core.Keyword(null,"p","p",151049309),new cljs.core.Keyword(null,"auto","auto",-566279492),(new cljs.core.Delay(((function (x,map__35099,map__35099__$1,domain,type,spc,type_id,___$1){
return (function (){
return new cljs.core.PersistentVector(null, 8, 5, cljs.core.PersistentVector.EMPTY_NODE, [x,"unit-record read",new cljs.core.Keyword(null,"domain","domain",1847214937),domain,new cljs.core.Keyword(null,"type","type",1174270348),type,new cljs.core.Keyword(null,"pos","pos",-864607220),pos], null);
});})(x,map__35099,map__35099__$1,domain,type,spc,type_id,___$1))
,null)),null,1334452685);

throw x;
}})();
var datasize = cljs.core.nth.call(null,vec__35100,(0),null);
var data = cljs.core.nth.call(null,vec__35100,(1),null);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(datasize + (2)),cljs.core.assoc.call(null,data,new cljs.core.Keyword(null,"type-id","type-id",2030062700),type_id)], null);
}
});

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35096.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"database","database",-805348194,null),new cljs.core.Symbol(null,"meta35097","meta35097",1283079274,null)], null);
});

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35096.cljs$lang$type = true;

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35096.cljs$lang$ctorStr = "weathergen.falcon.files.mission/t_weathergen$falcon$files$mission35096";

weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35096.cljs$lang$ctorPrWriter = (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"weathergen.falcon.files.mission/t_weathergen$falcon$files$mission35096");
});

weathergen.falcon.files.mission.__GT_t_weathergen$falcon$files$mission35096 = (function weathergen$falcon$files$mission$unit_record_$___GT_t_weathergen$falcon$files$mission35096(database__$1,meta35097){
return (new weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35096(database__$1,meta35097));
});

}

return (new weathergen.falcon.files.mission.t_weathergen$falcon$files$mission35096(database,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Given a seq of units, return the one with the given id.
 */
weathergen.falcon.files.mission.unit_lookup_by_id = (function weathergen$falcon$files$mission$unit_lookup_by_id(units,id){
return cljs.core.some.call(null,(function (unit){
if(cljs.core._EQ_.call(null,id,new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(unit))){
return unit;
} else {
return null;
}
}),units);
});
cljs.core._add_method.call(null,weathergen.falcon.files.mission.read_embedded_file_STAR_,new cljs.core.Keyword(null,"units","units",-533089095),(function (_,p__35108,buf,p__35109){
var map__35110 = p__35108;
var map__35110__$1 = ((((!((map__35110 == null)))?((((map__35110.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35110.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35110):map__35110);
var entry = map__35110__$1;
var offset = cljs.core.get.call(null,map__35110__$1,new cljs.core.Keyword(null,"offset","offset",296498311));
var length = cljs.core.get.call(null,map__35110__$1,new cljs.core.Keyword(null,"length","length",588987862));
var map__35111 = p__35109;
var map__35111__$1 = ((((!((map__35111 == null)))?((((map__35111.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35111.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35111):map__35111);
var database = map__35111__$1;
var class_table = cljs.core.get.call(null,map__35111__$1,new cljs.core.Keyword(null,"class-table","class-table",207400992));
var _STAR_byte_order_STAR_35114 = octet.buffer._STAR_byte_order_STAR_;
octet.buffer._STAR_byte_order_STAR_ = new cljs.core.Keyword(null,"little-endian","little-endian",1877303413);

try{var header_spec = octet.core.spec.call(null,new cljs.core.Keyword(null,"compressed-size","compressed-size",-1517579578),octet.core.int32,new cljs.core.Keyword(null,"num-units","num-units",1389753073),octet.core.int16,new cljs.core.Keyword(null,"uncompressed-size","uncompressed-size",-434136147),octet.core.int32);
var map__35115 = octet.core.read.call(null,buf,header_spec,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),offset], null));
var map__35115__$1 = ((((!((map__35115 == null)))?((((map__35115.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35115.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35115):map__35115);
var compressed_size = cljs.core.get.call(null,map__35115__$1,new cljs.core.Keyword(null,"compressed-size","compressed-size",-1517579578));
var num_units = cljs.core.get.call(null,map__35115__$1,new cljs.core.Keyword(null,"num-units","num-units",1389753073));
var uncompressed_size = cljs.core.get.call(null,map__35115__$1,new cljs.core.Keyword(null,"uncompressed-size","uncompressed-size",-434136147));
var data = weathergen.lzss.expand.call(null,buf,(offset + octet.core.size.call(null,header_spec)),(length - (6)),uncompressed_size);
return cljs.core.mapv.call(null,((function (header_spec,map__35115,map__35115__$1,compressed_size,num_units,uncompressed_size,data,_STAR_byte_order_STAR_35114,map__35110,map__35110__$1,entry,offset,length,map__35111,map__35111__$1,database,class_table){
return (function (unit){
return cljs.core.assoc.call(null,unit,new cljs.core.Keyword(null,"name","name",1843675177),weathergen.falcon.files.mission.unit_name.call(null,database,unit));
});})(header_spec,map__35115,map__35115__$1,compressed_size,num_units,uncompressed_size,data,_STAR_byte_order_STAR_35114,map__35110,map__35110__$1,entry,offset,length,map__35111,map__35111__$1,database,class_table))
,cljs.core.remove.call(null,cljs.core.nil_QMARK_,octet.core.read.call(null,data,octet.core.repeat.call(null,num_units,weathergen.falcon.files.mission.unit_record.call(null,database)))));
}finally {octet.buffer._STAR_byte_order_STAR_ = _STAR_byte_order_STAR_35114;
}}));
cljs.core._add_method.call(null,weathergen.falcon.files.mission.read_embedded_file_STAR_,new cljs.core.Keyword(null,"default","default",-1987822328),(function (_,entry,buf,___$1){
return new cljs.core.Keyword(null,"not-yet-implemented","not-yet-implemented",354832030);
}));
/**
 * Returns the number of aircraft in `flight`.
 */
weathergen.falcon.files.mission.flight_aircraft_quantity = (function weathergen$falcon$files$mission$flight_aircraft_quantity(flight){
return cljs.core.count.call(null,cljs.core.remove.call(null,cljs.core.PersistentHashSet.createAsIfByAssoc([weathergen.falcon.constants.AIRCRAFT_NOT_ASSIGNED]),new cljs.core.Keyword(null,"plane-stats","plane-stats",-4010361).cljs$core$IFn$_invoke$arity$1(flight)));
});
/**
 * Returns a seq of maps describing weapons in a loadout. Maps contain
 *   `:quantity` and `:name` keys.
 */
weathergen.falcon.files.mission.loadout_weapons = (function weathergen$falcon$files$mission$loadout_weapons(mission,loadout){
var map__35127 = loadout;
var map__35127__$1 = ((((!((map__35127 == null)))?((((map__35127.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35127.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35127):map__35127);
var ids = cljs.core.get.call(null,map__35127__$1,new cljs.core.Keyword(null,"id","id",-1388402092));
var counts = cljs.core.get.call(null,map__35127__$1,new cljs.core.Keyword(null,"count","count",2139924085));
return cljs.core.mapv.call(null,((function (map__35127,map__35127__$1,ids,counts){
return (function (p__35129){
var vec__35130 = p__35129;
var k = cljs.core.nth.call(null,vec__35130,(0),null);
var v = cljs.core.nth.call(null,vec__35130,(1),null);
var weapon = weathergen.falcon.files.mission.weapon_class_entry.call(null,mission,k);
return new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(weapon),new cljs.core.Keyword(null,"quantity","quantity",-1929050694),(v * (cljs.core.truth_(weathergen.util.has_flag_QMARK_.call(null,new cljs.core.Keyword(null,"flags","flags",1775418075).cljs$core$IFn$_invoke$arity$1(weapon),weathergen.falcon.constants.WEAP_ONETENTH))?(10):(1)))], null);
});})(map__35127,map__35127__$1,ids,counts))
,cljs.core.reduce.call(null,((function (map__35127,map__35127__$1,ids,counts){
return (function (m,p__35133){
var vec__35134 = p__35133;
var id = cljs.core.nth.call(null,vec__35134,(0),null);
var count = cljs.core.nth.call(null,vec__35134,(1),null);
if(((id === (0))) || ((count === (0)))){
return m;
} else {
return cljs.core.update.call(null,m,id,cljs.core.fnil.call(null,cljs.core._PLUS_,(0)),count);
}
});})(map__35127,map__35127__$1,ids,counts))
,cljs.core.PersistentArrayMap.EMPTY,cljs.core.map.call(null,cljs.core.vector,ids,counts)));
});
/**
 * Given a flight, returns a seq of maps describing the loadouts.
 */
weathergen.falcon.files.mission.flight_loadouts = (function weathergen$falcon$files$mission$flight_loadouts(mission,flight){
var loadouts = new cljs.core.Keyword(null,"loadouts","loadouts",1824879361).cljs$core$IFn$_invoke$arity$1(flight);
var num_ac = weathergen.falcon.files.mission.flight_aircraft_quantity.call(null,flight);
var iter__24010__auto__ = ((function (loadouts,num_ac){
return (function weathergen$falcon$files$mission$flight_loadouts_$_iter__35141(s__35142){
return (new cljs.core.LazySeq(null,((function (loadouts,num_ac){
return (function (){
var s__35142__$1 = s__35142;
while(true){
var temp__5278__auto__ = cljs.core.seq.call(null,s__35142__$1);
if(temp__5278__auto__){
var s__35142__$2 = temp__5278__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__35142__$2)){
var c__24008__auto__ = cljs.core.chunk_first.call(null,s__35142__$2);
var size__24009__auto__ = cljs.core.count.call(null,c__24008__auto__);
var b__35144 = cljs.core.chunk_buffer.call(null,size__24009__auto__);
if((function (){var i__35143 = (0);
while(true){
if((i__35143 < size__24009__auto__)){
var i = cljs.core._nth.call(null,c__24008__auto__,i__35143);
cljs.core.chunk_append.call(null,b__35144,weathergen.falcon.files.mission.loadout_weapons.call(null,mission,((cljs.core._EQ_.call(null,cljs.core.count.call(null,loadouts),num_ac))?cljs.core.nth.call(null,loadouts,i):cljs.core.first.call(null,loadouts))));

var G__35145 = (i__35143 + (1));
i__35143 = G__35145;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__35144),weathergen$falcon$files$mission$flight_loadouts_$_iter__35141.call(null,cljs.core.chunk_rest.call(null,s__35142__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__35144),null);
}
} else {
var i = cljs.core.first.call(null,s__35142__$2);
return cljs.core.cons.call(null,weathergen.falcon.files.mission.loadout_weapons.call(null,mission,((cljs.core._EQ_.call(null,cljs.core.count.call(null,loadouts),num_ac))?cljs.core.nth.call(null,loadouts,i):cljs.core.first.call(null,loadouts))),weathergen$falcon$files$mission$flight_loadouts_$_iter__35141.call(null,cljs.core.rest.call(null,s__35142__$2)));
}
} else {
return null;
}
break;
}
});})(loadouts,num_ac))
,null,null));
});})(loadouts,num_ac))
;
return iter__24010__auto__.call(null,cljs.core.range.call(null,num_ac));
});
/**
 * Given a ground speed in kts and an altitude in feet, returns mach and IAS in kts.
 */
weathergen.falcon.files.mission.compute_speed = (function weathergen$falcon$files$mission$compute_speed(speed,altitude){
var ttheta = (((altitude <= (36089)))?(1.0 - (6.875E-6 * altitude)):0.7519);
var rsigma = (((altitude <= (36089)))?Math.pow(ttheta,4.256):(0.2971 * Math.pow(2.718,(4.806E-5 * (36089.0 - altitude)))));
var mach = (speed / (weathergen.falcon.constants.AASLK * Math.sqrt(ttheta)));
var pa = ((ttheta * rsigma) * weathergen.falcon.constants.PASL);
var qc = (((mach <= 1.0))?(pa * (Math.pow((1.0 + ((0.2 * mach) * mach)),3.5) - 1.0)):(pa * ((((166.9 * mach) * mach) / Math.pow((7.0 - (1.0 / (mach * mach))),2.5)) - 1.0)));
var qpasl1 = (1.0 + (qc / weathergen.falcon.constants.PASL));
var vcas = (1479.12 * Math.sqrt((Math.pow(qpasl1,0.285714) - 1.0)));
var ias = (((1889.65 < qc))?(function (){var oper = (qpasl1 * Math.pow((7.0 - ((weathergen.falcon.constants.AASLK * weathergen.falcon.constants.AASLK) / (vcas * vcas))),2.5));
return (51.1987 * Math.sqrt((((oper < (0)))?0.1:oper)));
})():vcas);
return new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"mach","mach",172480995),mach,new cljs.core.Keyword(null,"ias","ias",291909619),ias,new cljs.core.Keyword(null,"cas","cas",-451543220),vcas,new cljs.core.Keyword(null,"qc","qc",-7621727),qc], null);
});
/**
 * Return the comments section of the flight briefing for a waypoint
 */
weathergen.falcon.files.mission.waypoint_comments = (function weathergen$falcon$files$mission$waypoint_comments(mission,w){
var strings = cljs.core.get_in.call(null,mission,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"strings","strings",-2055406807),new cljs.core.Keyword(null,"fn","fn",-1175266204)], null));
var map__35148 = w;
var map__35148__$1 = ((((!((map__35148 == null)))?((((map__35148.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35148.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35148):map__35148);
var flags = cljs.core.get.call(null,map__35148__$1,new cljs.core.Keyword(null,"flags","flags",1775418075));
var action = cljs.core.get.call(null,map__35148__$1,new cljs.core.Keyword(null,"action","action",-811238024));
var route_action = cljs.core.get.call(null,map__35148__$1,new cljs.core.Keyword(null,"route-action","route-action",1993857154));
if(cljs.core.truth_(weathergen.util.has_flag_QMARK_.call(null,flags,weathergen.falcon.constants.WPF_ALTERNATE))){
return strings.call(null,(237));
} else {
if(cljs.core.truth_(weathergen.util.has_flag_QMARK_.call(null,flags,weathergen.falcon.constants.WPF_REPEAT))){
return strings.call(null,(247));
} else {
if(cljs.core._EQ_.call(null,weathergen.falcon.constants.WP_NOTHING,action)){
return strings.call(null,((1650) + route_action));
} else {
return strings.call(null,((1650) + action));

}
}
}
});
/**
 * Given a flight, returns a seq of maps describing the waypoints
 */
weathergen.falcon.files.mission.flight_waypoints = (function weathergen$falcon$files$mission$flight_waypoints(mission,flight){
var waypoints = cljs.core.map_indexed.call(null,(function (i,w){
var map__35164 = w;
var map__35164__$1 = ((((!((map__35164 == null)))?((((map__35164.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35164.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35164):map__35164);
var action = cljs.core.get.call(null,map__35164__$1,new cljs.core.Keyword(null,"action","action",-811238024));
var route_action = cljs.core.get.call(null,map__35164__$1,new cljs.core.Keyword(null,"route-action","route-action",1993857154));
var arrive = cljs.core.get.call(null,map__35164__$1,new cljs.core.Keyword(null,"arrive","arrive",-284644322));
var depart = cljs.core.get.call(null,map__35164__$1,new cljs.core.Keyword(null,"depart","depart",-100007287));
var haves = cljs.core.get.call(null,map__35164__$1,new cljs.core.Keyword(null,"haves","haves",-405191810));
var action_name = cljs.core.get_in.call(null,mission,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"strings","strings",-2055406807),new cljs.core.Keyword(null,"waypoint-type-names","waypoint-type-names",719960758),action], null));
var enroute_action_name = cljs.core.get_in.call(null,mission,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"strings","strings",-2055406807),new cljs.core.Keyword(null,"waypoint-type-names","waypoint-type-names",719960758),route_action], null));
return cljs.core.assoc.call(null,w,new cljs.core.Keyword("weathergen.falcon.files.mission","number","weathergen.falcon.files.mission/number",-1176793792),(i + (1)),new cljs.core.Keyword("weathergen.falcon.files.mission","action-name","weathergen.falcon.files.mission/action-name",-1230729595),action_name,new cljs.core.Keyword("weathergen.falcon.files.mission","enroute-action-name","weathergen.falcon.files.mission/enroute-action-name",-95379962),action_name,new cljs.core.Keyword("weathergen.falcon.files.mission","description","weathergen.falcon.files.mission/description",-1977659382),((cljs.core._EQ_.call(null,action,weathergen.falcon.constants.WP_NOTHING))?enroute_action_name:action_name),new cljs.core.Keyword("weathergen.falcon.files.mission","remain","weathergen.falcon.files.mission/remain",1849736680),(cljs.core.truth_(haves.call(null,new cljs.core.Keyword(null,"deptime","deptime",1842159584)))?weathergen.time.difference_hms.call(null,arrive,depart):null),new cljs.core.Keyword("weathergen.falcon.files.mission","altitude","weathergen.falcon.files.mission/altitude",543643555),(new cljs.core.Keyword(null,"grid-z","grid-z",855482282).cljs$core$IFn$_invoke$arity$1(w) * weathergen.falcon.constants.GRIDZ_SCALE_FACTOR),new cljs.core.Keyword("weathergen.falcon.files.mission","comments","weathergen.falcon.files.mission/comments",-1789953753),weathergen.falcon.files.mission.waypoint_comments.call(null,mission,w));
}),new cljs.core.Keyword(null,"waypoints","waypoints",-844253224).cljs$core$IFn$_invoke$arity$1(flight));
return cljs.core.map.call(null,((function (waypoints){
return (function (w){
if(cljs.core.not.call(null,(function (){var map__35166 = w;
var map__35166__$1 = ((((!((map__35166 == null)))?((((map__35166.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35166.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35166):map__35166);
var action = cljs.core.get.call(null,map__35166__$1,new cljs.core.Keyword(null,"action","action",-811238024));
var flags = cljs.core.get.call(null,map__35166__$1,new cljs.core.Keyword(null,"flags","flags",1775418075));
var or__23148__auto__ = weathergen.util.has_flag_QMARK_.call(null,flags,weathergen.falcon.constants.WPF_ALTERNATE);
if(cljs.core.truth_(or__23148__auto__)){
return or__23148__auto__;
} else {
return cljs.core._EQ_.call(null,weathergen.falcon.constants.WP_REFUEL,action);
}
})())){
return w;
} else {
return cljs.core.dissoc.call(null,w,new cljs.core.Keyword(null,"arrive","arrive",-284644322),new cljs.core.Keyword(null,"depart","depart",-100007287),new cljs.core.Keyword("weathergen.falcon.files.mission","distance","weathergen.falcon.files.mission/distance",18637316),new cljs.core.Keyword("weathergen.falcon.files.mission","heading","weathergen.falcon.files.mission/heading",361734949),new cljs.core.Keyword("weathergen.falcon.files.mission","speed-ias","weathergen.falcon.files.mission/speed-ias",-2064912472),new cljs.core.Keyword("weathergen.falcon.files.mission","speed-cas","weathergen.falcon.files.mission/speed-cas",-588060328),new cljs.core.Keyword("weathergen.falcon.files.mission","speed-gnd","weathergen.falcon.files.mission/speed-gnd",-39445006),new cljs.core.Keyword("weathergen.falcon.files.mission","speed-mach","weathergen.falcon.files.mission/speed-mach",-185245472),new cljs.core.Keyword("weathergen.falcon.files.mission","speed-tas","weathergen.falcon.files.mission/speed-tas",568219840));
}
});})(waypoints))
,cljs.core.into.call(null,cljs.core.vec.call(null,cljs.core.take.call(null,(1),waypoints)),cljs.core.map.call(null,((function (waypoints){
return (function (p__35168){
var vec__35169 = p__35168;
var prev = cljs.core.nth.call(null,vec__35169,(0),null);
var curr = cljs.core.nth.call(null,vec__35169,(1),null);
var map__35172 = curr;
var map__35172__$1 = ((((!((map__35172 == null)))?((((map__35172.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35172.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35172):map__35172);
var curr_x = cljs.core.get.call(null,map__35172__$1,new cljs.core.Keyword(null,"grid-x","grid-x",1935903622));
var curr_y = cljs.core.get.call(null,map__35172__$1,new cljs.core.Keyword(null,"grid-y","grid-y",1140315474));
var map__35173 = prev;
var map__35173__$1 = ((((!((map__35173 == null)))?((((map__35173.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35173.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35173):map__35173);
var prev_x = cljs.core.get.call(null,map__35173__$1,new cljs.core.Keyword(null,"grid-x","grid-x",1935903622));
var prev_y = cljs.core.get.call(null,map__35173__$1,new cljs.core.Keyword(null,"grid-y","grid-y",1140315474));
var dx = (curr_x - prev_x);
var dy = (curr_y - prev_y);
var dv = new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [dx,dy], null);
var distance = weathergen.coordinates.fgrid__GT_nm.call(null,weathergen.math.magnitude.call(null,dv));
var delta_t = ((((weathergen.time.campaign_time__GT_ms.call(null,new cljs.core.Keyword(null,"arrive","arrive",-284644322).cljs$core$IFn$_invoke$arity$1(curr)) - weathergen.time.campaign_time__GT_ms.call(null,new cljs.core.Keyword(null,"depart","depart",-100007287).cljs$core$IFn$_invoke$arity$1(prev))) / (1000)) / (60)) / (60));
var gnd_speed = (distance / delta_t);
var altitude = (cljs.core.truth_(weathergen.util.has_flag_QMARK_.call(null,new cljs.core.Keyword(null,"flags","flags",1775418075).cljs$core$IFn$_invoke$arity$1(curr),weathergen.falcon.constants.WPF_HOLDCURRENT))?new cljs.core.Keyword("weathergen.falcon.files.mission","altitude","weathergen.falcon.files.mission/altitude",543643555).cljs$core$IFn$_invoke$arity$1(prev):new cljs.core.Keyword("weathergen.falcon.files.mission","altitude","weathergen.falcon.files.mission/altitude",543643555).cljs$core$IFn$_invoke$arity$1(curr));
var map__35174 = weathergen.falcon.files.mission.compute_speed.call(null,gnd_speed,altitude);
var map__35174__$1 = ((((!((map__35174 == null)))?((((map__35174.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35174.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35174):map__35174);
var mach = cljs.core.get.call(null,map__35174__$1,new cljs.core.Keyword(null,"mach","mach",172480995));
var ias = cljs.core.get.call(null,map__35174__$1,new cljs.core.Keyword(null,"ias","ias",291909619));
var cas = cljs.core.get.call(null,map__35174__$1,new cljs.core.Keyword(null,"cas","cas",-451543220));
return cljs.core.assoc.call(null,curr,new cljs.core.Keyword("weathergen.falcon.files.mission","distance","weathergen.falcon.files.mission/distance",18637316),distance,new cljs.core.Keyword("weathergen.falcon.files.mission","heading","weathergen.falcon.files.mission/heading",361734949),weathergen.math.heading.call(null,dv),new cljs.core.Keyword("weathergen.falcon.files.mission","speed-ias","weathergen.falcon.files.mission/speed-ias",-2064912472),ias,new cljs.core.Keyword("weathergen.falcon.files.mission","speed-cas","weathergen.falcon.files.mission/speed-cas",-588060328),cas,new cljs.core.Keyword("weathergen.falcon.files.mission","speed-tas","weathergen.falcon.files.mission/speed-tas",568219840),gnd_speed,new cljs.core.Keyword("weathergen.falcon.files.mission","speed-gnd","weathergen.falcon.files.mission/speed-gnd",-39445006),gnd_speed,new cljs.core.Keyword("weathergen.falcon.files.mission","speed-mach","weathergen.falcon.files.mission/speed-mach",-185245472),mach);
});})(waypoints))
,cljs.core.partition.call(null,(2),(1),waypoints))));
});
/**
 * Given a flight, returns the name of a flight mission type, e.g. BARCAP.
 */
weathergen.falcon.files.mission.flight_mission_name = (function weathergen$falcon$files$mission$flight_mission_name(mission,flight){
return cljs.core.get_in.call(null,mission,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"strings","strings",-2055406807),new cljs.core.Keyword(null,"mission-type-names","mission-type-names",-1426382657),new cljs.core.Keyword(null,"mission","mission",1740288522).cljs$core$IFn$_invoke$arity$1(flight)], null));
});
/**
 * Given a flight, return its mission category, e.g. ATO_DCA.
 */
weathergen.falcon.files.mission.flight_mission_category = (function weathergen$falcon$files$mission$flight_mission_category(mission,flight){
var map__35183 = flight;
var map__35183__$1 = ((((!((map__35183 == null)))?((((map__35183.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35183.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35183):map__35183);
var mission__$1 = cljs.core.get.call(null,map__35183__$1,new cljs.core.Keyword(null,"mission","mission",1740288522));
var pred__35185 = cljs.core.contains_QMARK_;
var expr__35186 = mission__$1;
if(cljs.core.truth_(pred__35185.call(null,cljs.core.PersistentHashSet.createAsIfByAssoc([weathergen.falcon.constants.AMIS_ESCORT,weathergen.falcon.constants.AMIS_OCASTRIKE,weathergen.falcon.constants.AMIS_SWEEP,weathergen.falcon.constants.AMIS_TARCAP]),expr__35186))){
return weathergen.falcon.constants.ATO_OCA;
} else {
if(cljs.core.truth_(pred__35185.call(null,cljs.core.PersistentHashSet.createAsIfByAssoc([weathergen.falcon.constants.AMIS_STRIKE,weathergen.falcon.constants.AMIS_STRATBOMB,weathergen.falcon.constants.AMIS_STSTRIKE,weathergen.falcon.constants.AMIS_DEEPSTRIKE]),expr__35186))){
return weathergen.falcon.constants.ATO_STRIKE;
} else {
if(cljs.core.truth_(pred__35185.call(null,cljs.core.PersistentHashSet.createAsIfByAssoc([weathergen.falcon.constants.AMIS_INT,weathergen.falcon.constants.AMIS_SAD,weathergen.falcon.constants.AMIS_BAI,weathergen.falcon.constants.AMIS_INTSTRIKE]),expr__35186))){
return weathergen.falcon.constants.ATO_INTERDICTION;
} else {
if(cljs.core.truth_(pred__35185.call(null,cljs.core.PersistentHashSet.createAsIfByAssoc([weathergen.falcon.constants.AMIS_SEADESCORT,weathergen.falcon.constants.AMIS_SEADSTRIKE]),expr__35186))){
return weathergen.falcon.constants.ATO_SEAD;
} else {
if(cljs.core.truth_(pred__35185.call(null,cljs.core.PersistentHashSet.createAsIfByAssoc([weathergen.falcon.constants.AMIS_CAS,weathergen.falcon.constants.AMIS_PRPLANCAS,weathergen.falcon.constants.AMIS_FAC,weathergen.falcon.constants.AMIS_ONCALLCAS]),expr__35186))){
return weathergen.falcon.constants.ATO_CAS;
} else {
if(cljs.core.truth_(pred__35185.call(null,cljs.core.PersistentHashSet.createAsIfByAssoc([weathergen.falcon.constants.AMIS_ALERT,weathergen.falcon.constants.AMIS_HAVCAP,weathergen.falcon.constants.AMIS_AMBUSHCAP,weathergen.falcon.constants.AMIS_BARCAP2,weathergen.falcon.constants.AMIS_BARCAP,weathergen.falcon.constants.AMIS_INTERCEPT]),expr__35186))){
return weathergen.falcon.constants.ATO_DCA;
} else {
if(cljs.core.truth_(pred__35185.call(null,cljs.core.PersistentHashSet.createAsIfByAssoc([weathergen.falcon.constants.AMIS_PATROL,weathergen.falcon.constants.AMIS_RECON,weathergen.falcon.constants.AMIS_RECONPATROL,weathergen.falcon.constants.AMIS_BDA,weathergen.falcon.constants.AMIS_JSTAR,weathergen.falcon.constants.AMIS_AWACS,weathergen.falcon.constants.AMIS_ECM]),expr__35186))){
return weathergen.falcon.constants.ATO_CCCI;
} else {
if(cljs.core.truth_(pred__35185.call(null,cljs.core.PersistentHashSet.createAsIfByAssoc([weathergen.falcon.constants.AMIS_ASW,weathergen.falcon.constants.AMIS_ASHIP]),expr__35186))){
return weathergen.falcon.constants.ATO_MARITIME;
} else {
if(cljs.core.truth_(pred__35185.call(null,cljs.core.PersistentHashSet.createAsIfByAssoc([weathergen.falcon.constants.AMIS_RESCAP,weathergen.falcon.constants.AMIS_TANKER,weathergen.falcon.constants.AMIS_SAR,weathergen.falcon.constants.AMIS_AIRLIFT]),expr__35186))){
return weathergen.falcon.constants.ATO_SUPPORT;
} else {
return weathergen.falcon.constants.ATO_OTHER;
}
}
}
}
}
}
}
}
}
});
/**
 * Returns the team number given a team or team number.
 */
weathergen.falcon.files.mission.team_number = (function weathergen$falcon$files$mission$team_number(team_or_number){
if((team_or_number == null)){
return (0);
} else {
if(typeof team_or_number === 'number'){
return team_or_number;
} else {
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(team_or_number));

}
}
});
/**
 * Given a team, return its name, e.g. 'DPRK'.
 */
weathergen.falcon.files.mission.team_name = (function weathergen$falcon$files$mission$team_name(mission,team){
return new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"team","team",1355747699).cljs$core$IFn$_invoke$arity$1(cljs.core.nth.call(null,new cljs.core.Keyword(null,"teams","teams",1677714510).cljs$core$IFn$_invoke$arity$1(mission),weathergen.falcon.files.mission.team_number.call(null,team))));
});
/**
 * Returns an image descriptor for the flag of `team`. `flag-type` can
 *   be one of `:big-vert-dark`, `:big-vert`, `:big-horiz`, and
 *   `:small-horiz`.
 */
weathergen.falcon.files.mission.team_flag = (function weathergen$falcon$files$mission$team_flag(mission,team,flag_type){
var team_info = cljs.core.get_in.call(null,mission,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"campaign-info","campaign-info",1158908966),new cljs.core.Keyword(null,"team-info","team-info",-1689319883),weathergen.falcon.files.mission.team_number.call(null,team)], null));
var icon_index = cljs.core.get_in.call(null,weathergen.falcon.constants.FlagImageID,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"flag","flag",1088647881).cljs$core$IFn$_invoke$arity$1(team_info),flag_type], null));
var image_id = cljs.core.get_in.call(null,mission,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"image-ids","image-ids",-529925649),new cljs.core.Keyword(null,"id->name","id->name",249122446),icon_index], null));
return weathergen.falcon.files.images.make_descriptor.call(null,mission,"resource/main",image_id);
});
/**
 * Returns the side number given a team. Team indicates the individual
 *   combatant, side denots the alliance.
 */
weathergen.falcon.files.mission.side = (function weathergen$falcon$files$mission$side(mission,team){
return 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(cljs.core.nth.call(null,new cljs.core.Keyword(null,"teams","teams",1677714510).cljs$core$IFn$_invoke$arity$1(mission),weathergen.falcon.files.mission.team_number.call(null,team))));
});
/**
 * Returns a sort priority for `team` relative to `who` - allies
 *   first, then enemies, then neutrals.
 */
weathergen.falcon.files.mission.team_priority = (function weathergen$falcon$files$mission$team_priority(mission,who,team){
var stance = cljs.core.nth.call(null,new cljs.core.Keyword(null,"stance","stance",1737508388).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"team","team",1355747699).cljs$core$IFn$_invoke$arity$1(cljs.core.nth.call(null,new cljs.core.Keyword(null,"teams","teams",1677714510).cljs$core$IFn$_invoke$arity$1(mission),who))),weathergen.falcon.files.mission.team_number.call(null,team));
return cljs.core.PersistentArrayMap.createAsIfByAssoc([weathergen.falcon.constants.Allied,(0),weathergen.falcon.constants.Friendly,(1),weathergen.falcon.constants.War,(2),weathergen.falcon.constants.Hostile,(3),weathergen.falcon.constants.Neutral,(4)]).call(null,stance,(5));
});
/**
 * Returns a seq of the teams.
 */
weathergen.falcon.files.mission.teams = (function weathergen$falcon$files$mission$teams(mission){
var teams_with_units = cljs.core.set.call(null,cljs.core.distinct.call(null,cljs.core.map.call(null,new cljs.core.Keyword(null,"owner","owner",-392611939),new cljs.core.Keyword(null,"units","units",-533089095).cljs$core$IFn$_invoke$arity$1(mission))));
var teams_with_objectives = cljs.core.set.call(null,cljs.core.distinct.call(null,cljs.core.map.call(null,new cljs.core.Keyword(null,"owner","owner",-392611939),new cljs.core.Keyword(null,"objectives","objectives",933939509).cljs$core$IFn$_invoke$arity$1(mission))));
var active_team_nums = cljs.core.into.call(null,teams_with_units,teams_with_objectives);
var active_teams = cljs.core.filter.call(null,((function (teams_with_units,teams_with_objectives,active_team_nums){
return (function (p1__35188_SHARP_){
return active_team_nums.call(null,weathergen.falcon.files.mission.team_number.call(null,p1__35188_SHARP_));
});})(teams_with_units,teams_with_objectives,active_team_nums))
,new cljs.core.Keyword(null,"teams","teams",1677714510).cljs$core$IFn$_invoke$arity$1(mission));
var first_team_num = 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(cljs.core.first.call(null,active_teams)));
return cljs.core.sort_by.call(null,((function (teams_with_units,teams_with_objectives,active_team_nums,active_teams,first_team_num){
return (function (p1__35189_SHARP_){
return weathergen.falcon.files.mission.team_priority.call(null,mission,first_team_num,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__35189_SHARP_)));
});})(teams_with_units,teams_with_objectives,active_team_nums,active_teams,first_team_num))
,active_teams);
});
/**
 * Returns the team with the most-recently player-played mission.
 */
weathergen.falcon.files.mission.last_player_team = (function weathergen$falcon$files$mission$last_player_team(mission){
return cljs.core.first.call(null,cljs.core.sort_by.call(null,(function (p1__35190_SHARP_){
return (- weathergen.time.campaign_time__GT_ms.call(null,new cljs.core.Keyword(null,"last-player-mission","last-player-mission",-137478691).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"team","team",1355747699).cljs$core$IFn$_invoke$arity$1(p1__35190_SHARP_))));
}),weathergen.falcon.files.mission.teams.call(null,mission)));
});
/**
 * Returns a seq of team numbers representing the sides.
 */
weathergen.falcon.files.mission.sides = (function weathergen$falcon$files$mission$sides(mission){
return cljs.core.distinct.call(null,cljs.core.map.call(null,new cljs.core.Keyword(null,"c-team","c-team",1058111407),cljs.core.map.call(null,new cljs.core.Keyword(null,"team","team",1355747699),weathergen.falcon.files.mission.teams.call(null,mission))));
});
/**
 * Returns a set of the team numbers for a given side.
 */
weathergen.falcon.files.mission.teams_for_side = (function weathergen$falcon$files$mission$teams_for_side(mission,side){
return cljs.core.set.call(null,cljs.core.map.call(null,weathergen.falcon.files.mission.team_number,cljs.core.filter.call(null,(function (p1__35191_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__35191_SHARP_)),side);
}),weathergen.falcon.files.mission.teams.call(null,mission))));
});
/**
 * Returns the abstract color corresponding to `team-or-number`.
 */
weathergen.falcon.files.mission.team_color = (function weathergen$falcon$files$mission$team_color(team){
return cljs.core.nth.call(null,new cljs.core.PersistentVector(null, 8, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"white","white",-483998618),new cljs.core.Keyword(null,"green","green",-945526839),new cljs.core.Keyword(null,"blue","blue",-622100620),new cljs.core.Keyword(null,"brown","brown",1414854429),new cljs.core.Keyword(null,"orange","orange",73816386),new cljs.core.Keyword(null,"yellow","yellow",-881035449),new cljs.core.Keyword(null,"red","red",-969428204),new cljs.core.Keyword(null,"grey","grey",1875582333)], null),weathergen.falcon.files.mission.team_number.call(null,team));
});
/**
 * Given a package ID, return its string name, e.g. Package 12345.
 */
weathergen.falcon.files.mission.package_name = (function weathergen$falcon$files$mission$package_name(mission,package_id){
var packages = weathergen.util.filter_EQ_.call(null,new cljs.core.Keyword(null,"type","type",1174270348),new cljs.core.Keyword(null,"package","package",1189062786),new cljs.core.Keyword(null,"units","units",-533089095).cljs$core$IFn$_invoke$arity$1(mission));
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"name-id","name-id",-279275372).cljs$core$IFn$_invoke$arity$1(weathergen.falcon.files.mission.unit_lookup_by_id.call(null,packages,package_id)))].join('');
});
/**
 * Returns a map of `:airframe` and `:quantity` for a squadron.
 */
weathergen.falcon.files.mission.squadron_aircraft = (function weathergen$falcon$files$mission$squadron_aircraft(mission,squadron){
return new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"airframe","airframe",643222926),new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(cljs.core.nth.call(null,new cljs.core.Keyword(null,"vehicle-class-data","vehicle-class-data",1666024339).cljs$core$IFn$_invoke$arity$1(mission),new cljs.core.Keyword(null,"data-pointer","data-pointer",-1957576382).cljs$core$IFn$_invoke$arity$1(cljs.core.nth.call(null,new cljs.core.Keyword(null,"class-table","class-table",207400992).cljs$core$IFn$_invoke$arity$1(mission),cljs.core.first.call(null,new cljs.core.Keyword(null,"vehicle-type","vehicle-type",-362045068).cljs$core$IFn$_invoke$arity$1(cljs.core.nth.call(null,new cljs.core.Keyword(null,"unit-class-data","unit-class-data",2122324209).cljs$core$IFn$_invoke$arity$1(mission),new cljs.core.Keyword(null,"data-pointer","data-pointer",-1957576382).cljs$core$IFn$_invoke$arity$1(cljs.core.nth.call(null,new cljs.core.Keyword(null,"class-table","class-table",207400992).cljs$core$IFn$_invoke$arity$1(mission),(new cljs.core.Keyword(null,"type-id","type-id",2030062700).cljs$core$IFn$_invoke$arity$1(squadron) - (100))))))))))),new cljs.core.Keyword(null,"quantity","quantity",-1929050694),cljs.core.reduce.call(null,cljs.core._PLUS_,(function (){var iter__24010__auto__ = (function weathergen$falcon$files$mission$squadron_aircraft_$_iter__35196(s__35197){
return (new cljs.core.LazySeq(null,(function (){
var s__35197__$1 = s__35197;
while(true){
var temp__5278__auto__ = cljs.core.seq.call(null,s__35197__$1);
if(temp__5278__auto__){
var s__35197__$2 = temp__5278__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__35197__$2)){
var c__24008__auto__ = cljs.core.chunk_first.call(null,s__35197__$2);
var size__24009__auto__ = cljs.core.count.call(null,c__24008__auto__);
var b__35199 = cljs.core.chunk_buffer.call(null,size__24009__auto__);
if((function (){var i__35198 = (0);
while(true){
if((i__35198 < size__24009__auto__)){
var i = cljs.core._nth.call(null,c__24008__auto__,i__35198);
cljs.core.chunk_append.call(null,b__35199,((new cljs.core.Keyword(null,"roster","roster",-2092272532).cljs$core$IFn$_invoke$arity$1(squadron) >> (i * (2))) & (3)));

var G__35200 = (i__35198 + (1));
i__35198 = G__35200;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__35199),weathergen$falcon$files$mission$squadron_aircraft_$_iter__35196.call(null,cljs.core.chunk_rest.call(null,s__35197__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__35199),null);
}
} else {
var i = cljs.core.first.call(null,s__35197__$2);
return cljs.core.cons.call(null,((new cljs.core.Keyword(null,"roster","roster",-2092272532).cljs$core$IFn$_invoke$arity$1(squadron) >> (i * (2))) & (3)),weathergen$falcon$files$mission$squadron_aircraft_$_iter__35196.call(null,cljs.core.rest.call(null,s__35197__$2)));
}
} else {
return null;
}
break;
}
}),null,null));
});
return iter__24010__auto__.call(null,cljs.core.range.call(null,(16)));
})())], null);
});
/**
 * Return the status of an airbase as a number from 0 to 100.
 */
weathergen.falcon.files.mission.airbase_status = (function weathergen$falcon$files$mission$airbase_status(mission,airbase){
var map__35217 = mission;
var map__35217__$1 = ((((!((map__35217 == null)))?((((map__35217.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35217.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35217):map__35217);
var class_table = cljs.core.get.call(null,map__35217__$1,new cljs.core.Keyword(null,"class-table","class-table",207400992));
var objective_class_data = cljs.core.get.call(null,map__35217__$1,new cljs.core.Keyword(null,"objective-class-data","objective-class-data",-2036255156));
var feature_class_data = cljs.core.get.call(null,map__35217__$1,new cljs.core.Keyword(null,"feature-class-data","feature-class-data",-794349644));
var feature_entry_data = cljs.core.get.call(null,map__35217__$1,new cljs.core.Keyword(null,"feature-entry-data","feature-entry-data",-87481893));
var point_header_data = cljs.core.get.call(null,map__35217__$1,new cljs.core.Keyword(null,"point-header-data","point-header-data",2108405911));
var airbase_class = cljs.core.nth.call(null,objective_class_data,new cljs.core.Keyword(null,"data-pointer","data-pointer",-1957576382).cljs$core$IFn$_invoke$arity$1(weathergen.falcon.files.mission.class_table_entry.call(null,mission,airbase)));
var map__35218 = airbase_class;
var map__35218__$1 = ((((!((map__35218 == null)))?((((map__35218.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35218.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35218):map__35218);
var features = cljs.core.get.call(null,map__35218__$1,new cljs.core.Keyword(null,"features","features",-1146962336));
var first_feature = cljs.core.get.call(null,map__35218__$1,new cljs.core.Keyword(null,"first-feature","first-feature",-1395776257));
var feature_info = cljs.core.map.call(null,((function (map__35217,map__35217__$1,class_table,objective_class_data,feature_class_data,feature_entry_data,point_header_data,airbase_class,map__35218,map__35218__$1,features,first_feature){
return (function (p1__35201_SHARP_){
return cljs.core.nth.call(null,feature_entry_data,p1__35201_SHARP_);
});})(map__35217,map__35217__$1,class_table,objective_class_data,feature_class_data,feature_entry_data,point_header_data,airbase_class,map__35218,map__35218__$1,features,first_feature))
,cljs.core.range.call(null,first_feature,(first_feature + features)));
var feature_status = (function (){var iter__24010__auto__ = ((function (map__35217,map__35217__$1,class_table,objective_class_data,feature_class_data,feature_entry_data,point_header_data,airbase_class,map__35218,map__35218__$1,features,first_feature,feature_info){
return (function weathergen$falcon$files$mission$airbase_status_$_iter__35222(s__35223){
return (new cljs.core.LazySeq(null,((function (map__35217,map__35217__$1,class_table,objective_class_data,feature_class_data,feature_entry_data,point_header_data,airbase_class,map__35218,map__35218__$1,features,first_feature,feature_info){
return (function (){
var s__35223__$1 = s__35223;
while(true){
var temp__5278__auto__ = cljs.core.seq.call(null,s__35223__$1);
if(temp__5278__auto__){
var s__35223__$2 = temp__5278__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__35223__$2)){
var c__24008__auto__ = cljs.core.chunk_first.call(null,s__35223__$2);
var size__24009__auto__ = cljs.core.count.call(null,c__24008__auto__);
var b__35225 = cljs.core.chunk_buffer.call(null,size__24009__auto__);
if((function (){var i__35224 = (0);
while(true){
if((i__35224 < size__24009__auto__)){
var f = cljs.core._nth.call(null,c__24008__auto__,i__35224);
cljs.core.chunk_append.call(null,b__35225,(function (){var i = cljs.core.long$.call(null,(f / (4)));
var f_STAR_ = (f - (i * (4)));
if(((f_STAR_ < (0))) || (((255) < f_STAR_)) || ((cljs.core.count.call(null,new cljs.core.Keyword(null,"f-status","f-status",782756103).cljs$core$IFn$_invoke$arity$1(airbase)) <= i))){
return (0);
} else {
return ((cljs.core.nth.call(null,new cljs.core.Keyword(null,"f-status","f-status",782756103).cljs$core$IFn$_invoke$arity$1(airbase),i,(0)) >> (f_STAR_ * (2))) & (3));
}
})());

var G__35230 = (i__35224 + (1));
i__35224 = G__35230;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__35225),weathergen$falcon$files$mission$airbase_status_$_iter__35222.call(null,cljs.core.chunk_rest.call(null,s__35223__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__35225),null);
}
} else {
var f = cljs.core.first.call(null,s__35223__$2);
return cljs.core.cons.call(null,(function (){var i = cljs.core.long$.call(null,(f / (4)));
var f_STAR_ = (f - (i * (4)));
if(((f_STAR_ < (0))) || (((255) < f_STAR_)) || ((cljs.core.count.call(null,new cljs.core.Keyword(null,"f-status","f-status",782756103).cljs$core$IFn$_invoke$arity$1(airbase)) <= i))){
return (0);
} else {
return ((cljs.core.nth.call(null,new cljs.core.Keyword(null,"f-status","f-status",782756103).cljs$core$IFn$_invoke$arity$1(airbase),i,(0)) >> (f_STAR_ * (2))) & (3));
}
})(),weathergen$falcon$files$mission$airbase_status_$_iter__35222.call(null,cljs.core.rest.call(null,s__35223__$2)));
}
} else {
return null;
}
break;
}
});})(map__35217,map__35217__$1,class_table,objective_class_data,feature_class_data,feature_entry_data,point_header_data,airbase_class,map__35218,map__35218__$1,features,first_feature,feature_info))
,null,null));
});})(map__35217,map__35217__$1,class_table,objective_class_data,feature_class_data,feature_entry_data,point_header_data,airbase_class,map__35218,map__35218__$1,features,first_feature,feature_info))
;
return iter__24010__auto__.call(null,cljs.core.range.call(null,features));
})();
var feature_class_info = cljs.core.map.call(null,((function (map__35217,map__35217__$1,class_table,objective_class_data,feature_class_data,feature_entry_data,point_header_data,airbase_class,map__35218,map__35218__$1,features,first_feature,feature_info,feature_status){
return (function (feature){
var ci = cljs.core.nth.call(null,class_table,new cljs.core.Keyword(null,"index","index",-1531685915).cljs$core$IFn$_invoke$arity$1(feature));
return cljs.core.assoc.call(null,ci,new cljs.core.Keyword(null,"feature-class-info","feature-class-info",1970317689),cljs.core.nth.call(null,feature_class_data,new cljs.core.Keyword(null,"data-pointer","data-pointer",-1957576382).cljs$core$IFn$_invoke$arity$1(ci)));
});})(map__35217,map__35217__$1,class_table,objective_class_data,feature_class_data,feature_entry_data,point_header_data,airbase_class,map__35218,map__35218__$1,features,first_feature,feature_info,feature_status))
,feature_info);
var feature_info__$1 = cljs.core.map.call(null,((function (map__35217,map__35217__$1,class_table,objective_class_data,feature_class_data,feature_entry_data,point_header_data,airbase_class,map__35218,map__35218__$1,features,first_feature,feature_info,feature_status,feature_class_info){
return (function (fi,fs,fci){
return cljs.core.assoc.call(null,fi,new cljs.core.Keyword(null,"status","status",-1997798413),fs,new cljs.core.Keyword(null,"class-info","class-info",-467052058),fci);
});})(map__35217,map__35217__$1,class_table,objective_class_data,feature_class_data,feature_entry_data,point_header_data,airbase_class,map__35218,map__35218__$1,features,first_feature,feature_info,feature_status,feature_class_info))
,feature_info,feature_status,feature_class_info);
var runway_QMARK_ = ((function (map__35217,map__35217__$1,class_table,objective_class_data,feature_class_data,feature_entry_data,point_header_data,airbase_class,map__35218,map__35218__$1,features,first_feature,feature_info,feature_status,feature_class_info,feature_info__$1){
return (function (feature){
return cljs.core._EQ_.call(null,new cljs.core.Keyword(null,"type","type",1174270348).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"class-info","class-info",-467052058).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"vu-class-data","vu-class-data",-1868219799).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"class-info","class-info",-467052058).cljs$core$IFn$_invoke$arity$1(feature)))),weathergen.falcon.constants.TYPE_RUNWAY);
});})(map__35217,map__35217__$1,class_table,objective_class_data,feature_class_data,feature_entry_data,point_header_data,airbase_class,map__35218,map__35218__$1,features,first_feature,feature_info,feature_status,feature_class_info,feature_info__$1))
;
var nonrunway_statuses = (function (){var x__23486__auto__ = (0);
var y__23487__auto__ = ((100) - cljs.core.reduce.call(null,((function (x__23486__auto__,map__35217,map__35217__$1,class_table,objective_class_data,feature_class_data,feature_entry_data,point_header_data,airbase_class,map__35218,map__35218__$1,features,first_feature,feature_info,feature_status,feature_class_info,feature_info__$1,runway_QMARK_){
return (function (score,feature){
return (score + (function (){var pred__35226 = cljs.core._EQ_;
var expr__35227 = new cljs.core.Keyword(null,"status","status",-1997798413).cljs$core$IFn$_invoke$arity$1(feature);
if(cljs.core.truth_(pred__35226.call(null,weathergen.falcon.constants.VIS_DAMAGED,expr__35227))){
return cljs.core.long$.call(null,(new cljs.core.Keyword(null,"value","value",305978217).cljs$core$IFn$_invoke$arity$1(feature) / (2)));
} else {
if(cljs.core.truth_(pred__35226.call(null,weathergen.falcon.constants.VIS_DESTROYED,expr__35227))){
return new cljs.core.Keyword(null,"value","value",305978217).cljs$core$IFn$_invoke$arity$1(feature);
} else {
return (0);
}
}
})());
});})(x__23486__auto__,map__35217,map__35217__$1,class_table,objective_class_data,feature_class_data,feature_entry_data,point_header_data,airbase_class,map__35218,map__35218__$1,features,first_feature,feature_info,feature_status,feature_class_info,feature_info__$1,runway_QMARK_))
,(0),cljs.core.remove.call(null,runway_QMARK_,feature_info__$1)));
return ((x__23486__auto__ > y__23487__auto__) ? x__23486__auto__ : y__23487__auto__);
})();
var runway_statuses = (function (){var index = new cljs.core.Keyword(null,"pt-data-index","pt-data-index",-54255967).cljs$core$IFn$_invoke$arity$1(airbase_class);
var runway_stats = new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"total","total",1916810418),(0),new cljs.core.Keyword(null,"destroyed","destroyed",-427566535),(0)], null);
while(true){
var point_header = cljs.core.nth.call(null,point_header_data,index);
if((index === (0))){
return runway_stats;
} else {
var G__35231 = new cljs.core.Keyword(null,"next-header","next-header",1386001069).cljs$core$IFn$_invoke$arity$1(point_header);
var G__35232 = ((!(cljs.core._EQ_.call(null,weathergen.falcon.constants.RunwayPt,new cljs.core.Keyword(null,"type","type",1174270348).cljs$core$IFn$_invoke$arity$1(point_header))))?runway_stats:cljs.core.update.call(null,cljs.core.update.call(null,runway_stats,new cljs.core.Keyword(null,"total","total",1916810418),cljs.core.inc),new cljs.core.Keyword(null,"destroyed","destroyed",-427566535),cljs.core._PLUS_,(cljs.core.truth_(cljs.core.some.call(null,cljs.core.PersistentHashSet.createAsIfByAssoc([weathergen.falcon.constants.VIS_DESTROYED]),cljs.core.map.call(null,new cljs.core.Keyword(null,"status","status",-1997798413),cljs.core.map.call(null,((function (index,runway_stats,point_header,map__35217,map__35217__$1,class_table,objective_class_data,feature_class_data,feature_entry_data,point_header_data,airbase_class,map__35218,map__35218__$1,features,first_feature,feature_info,feature_status,feature_class_info,feature_info__$1,runway_QMARK_,nonrunway_statuses){
return (function (p1__35203_SHARP_){
return cljs.core.nth.call(null,feature_info__$1,p1__35203_SHARP_);
});})(index,runway_stats,point_header,map__35217,map__35217__$1,class_table,objective_class_data,feature_class_data,feature_entry_data,point_header_data,airbase_class,map__35218,map__35218__$1,features,first_feature,feature_info,feature_status,feature_class_info,feature_info__$1,runway_QMARK_,nonrunway_statuses))
,cljs.core.take_while.call(null,((function (index,runway_stats,point_header,map__35217,map__35217__$1,class_table,objective_class_data,feature_class_data,feature_entry_data,point_header_data,airbase_class,map__35218,map__35218__$1,features,first_feature,feature_info,feature_status,feature_class_info,feature_info__$1,runway_QMARK_,nonrunway_statuses){
return (function (p1__35202_SHARP_){
return (p1__35202_SHARP_ < (255));
});})(index,runway_stats,point_header,map__35217,map__35217__$1,class_table,objective_class_data,feature_class_data,feature_entry_data,point_header_data,airbase_class,map__35218,map__35218__$1,features,first_feature,feature_info,feature_status,feature_class_info,feature_info__$1,runway_QMARK_,nonrunway_statuses))
,new cljs.core.Keyword(null,"features","features",-1146962336).cljs$core$IFn$_invoke$arity$1(point_header))))))?(1):(0))));
index = G__35231;
runway_stats = G__35232;
continue;

}
break;
}
})();
var map__35219 = runway_statuses;
var map__35219__$1 = ((((!((map__35219 == null)))?((((map__35219.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35219.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35219):map__35219);
var total = cljs.core.get.call(null,map__35219__$1,new cljs.core.Keyword(null,"total","total",1916810418));
var destroyed = cljs.core.get.call(null,map__35219__$1,new cljs.core.Keyword(null,"destroyed","destroyed",-427566535));
var runway_score = (((total === (0)))?(100):((100) - cljs.core.long$.call(null,((100) * (destroyed / total)))));
var x__23493__auto__ = runway_score;
var y__23494__auto__ = nonrunway_statuses;
return ((x__23493__auto__ < y__23494__auto__) ? x__23493__auto__ : y__23494__auto__);
});
weathergen.falcon.files.mission.objective_status = (function weathergen$falcon$files$mission$objective_status(mission,objective){
return weathergen.falcon.files.mission.airbase_status.call(null,mission,objective);
});
/**
 * Returns all the airbase and airstrip objectives.
 */
weathergen.falcon.files.mission.airbases = (function weathergen$falcon$files$mission$airbases(mission){
var airbase_classes = cljs.core.set.call(null,cljs.core.map.call(null,new cljs.core.Keyword("weathergen.falcon.files.mission","index","weathergen.falcon.files.mission/index",-1989089649),cljs.core.remove.call(null,(function (cls){
return cljs.core._EQ_.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(7),(7)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.get_in.call(null,cls,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"vu-class-data","vu-class-data",-1868219799),new cljs.core.Keyword(null,"class-info","class-info",-467052058),new cljs.core.Keyword(null,"stype","stype",-63678419)], null)),cljs.core.get_in.call(null,cls,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"vu-class-data","vu-class-data",-1868219799),new cljs.core.Keyword(null,"class-info","class-info",-467052058),new cljs.core.Keyword(null,"sptype","sptype",-1425026030)], null))], null));
}),cljs.core.filter.call(null,(function (p1__35235_SHARP_){
return cljs.core.PersistentHashSet.createAsIfByAssoc([weathergen.falcon.constants.TYPE_AIRBASE,weathergen.falcon.constants.TYPE_AIRSTRIP]).call(null,cljs.core.get_in.call(null,p1__35235_SHARP_,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"vu-class-data","vu-class-data",-1868219799),new cljs.core.Keyword(null,"class-info","class-info",-467052058),new cljs.core.Keyword(null,"type","type",1174270348)], null)));
}),weathergen.util.filter_EQ_.call(null,(function (p1__35234_SHARP_){
return cljs.core.get_in.call(null,p1__35234_SHARP_,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"vu-class-data","vu-class-data",-1868219799),new cljs.core.Keyword(null,"class-info","class-info",-467052058),new cljs.core.Keyword(null,"class","class",-2030961996)], null));
}),weathergen.falcon.constants.CLASS_OBJECTIVE,weathergen.util.filter_EQ_.call(null,(function (p1__35233_SHARP_){
return cljs.core.get_in.call(null,p1__35233_SHARP_,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"vu-class-data","vu-class-data",-1868219799),new cljs.core.Keyword(null,"class-info","class-info",-467052058),new cljs.core.Keyword(null,"domain","domain",1847214937)], null));
}),weathergen.falcon.constants.DOMAIN_LAND,new cljs.core.Keyword(null,"class-table","class-table",207400992).cljs$core$IFn$_invoke$arity$1(mission)))))));
return cljs.core.filterv.call(null,((function (airbase_classes){
return (function (objective){
return airbase_classes.call(null,(new cljs.core.Keyword(null,"entity-type","entity-type",-1957300125).cljs$core$IFn$_invoke$arity$1(objective) - (100)));
});})(airbase_classes))
,new cljs.core.Keyword(null,"objectives","objectives",933939509).cljs$core$IFn$_invoke$arity$1(mission));
});
/**
 * Returns all the carrier task force units in the mission.
 */
weathergen.falcon.files.mission.carriers = (function weathergen$falcon$files$mission$carriers(mission){
var carrier_classes = cljs.core.set.call(null,cljs.core.map.call(null,new cljs.core.Keyword("weathergen.falcon.files.mission","index","weathergen.falcon.files.mission/index",-1989089649),weathergen.util.filter_EQ_.call(null,(function (p1__35239_SHARP_){
return cljs.core.get_in.call(null,p1__35239_SHARP_,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"vu-class-data","vu-class-data",-1868219799),new cljs.core.Keyword(null,"class-info","class-info",-467052058),new cljs.core.Keyword(null,"stype","stype",-63678419)], null));
}),weathergen.falcon.constants.STYPE_UNIT_CARRIER,weathergen.util.filter_EQ_.call(null,(function (p1__35238_SHARP_){
return cljs.core.get_in.call(null,p1__35238_SHARP_,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"vu-class-data","vu-class-data",-1868219799),new cljs.core.Keyword(null,"class-info","class-info",-467052058),new cljs.core.Keyword(null,"type","type",1174270348)], null));
}),weathergen.falcon.constants.TYPE_TASKFORCE,weathergen.util.filter_EQ_.call(null,(function (p1__35237_SHARP_){
return cljs.core.get_in.call(null,p1__35237_SHARP_,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"vu-class-data","vu-class-data",-1868219799),new cljs.core.Keyword(null,"class-info","class-info",-467052058),new cljs.core.Keyword(null,"class","class",-2030961996)], null));
}),weathergen.falcon.constants.CLASS_UNIT,weathergen.util.filter_EQ_.call(null,(function (p1__35236_SHARP_){
return cljs.core.get_in.call(null,p1__35236_SHARP_,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"vu-class-data","vu-class-data",-1868219799),new cljs.core.Keyword(null,"class-info","class-info",-467052058),new cljs.core.Keyword(null,"domain","domain",1847214937)], null),weathergen.falcon.constants.DOMAIN_SEA);
}),weathergen.falcon.constants.DOMAIN_SEA,new cljs.core.Keyword(null,"class-table","class-table",207400992).cljs$core$IFn$_invoke$arity$1(mission)))))));
return cljs.core.filterv.call(null,((function (carrier_classes){
return (function (unit){
return carrier_classes.call(null,(new cljs.core.Keyword(null,"entity-type","entity-type",-1957300125).cljs$core$IFn$_invoke$arity$1(unit) - (100)));
});})(carrier_classes))
,weathergen.falcon.files.mission.active_units.call(null,mission));
});
/**
 * Returns all the army base objectives.
 */
weathergen.falcon.files.mission.army_bases = (function weathergen$falcon$files$mission$army_bases(mission){
var armybase_classes = cljs.core.set.call(null,cljs.core.map.call(null,new cljs.core.Keyword("weathergen.falcon.files.mission","index","weathergen.falcon.files.mission/index",-1989089649),weathergen.util.filter_EQ_.call(null,(function (p1__35242_SHARP_){
return cljs.core.get_in.call(null,p1__35242_SHARP_,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"vu-class-data","vu-class-data",-1868219799),new cljs.core.Keyword(null,"class-info","class-info",-467052058),new cljs.core.Keyword(null,"type","type",1174270348)], null));
}),weathergen.falcon.constants.TYPE_ARMYBASE,weathergen.util.filter_EQ_.call(null,(function (p1__35241_SHARP_){
return cljs.core.get_in.call(null,p1__35241_SHARP_,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"vu-class-data","vu-class-data",-1868219799),new cljs.core.Keyword(null,"class-info","class-info",-467052058),new cljs.core.Keyword(null,"class","class",-2030961996)], null));
}),weathergen.falcon.constants.CLASS_OBJECTIVE,weathergen.util.filter_EQ_.call(null,(function (p1__35240_SHARP_){
return cljs.core.get_in.call(null,p1__35240_SHARP_,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"vu-class-data","vu-class-data",-1868219799),new cljs.core.Keyword(null,"class-info","class-info",-467052058),new cljs.core.Keyword(null,"domain","domain",1847214937)], null));
}),weathergen.falcon.constants.DOMAIN_LAND,new cljs.core.Keyword(null,"class-table","class-table",207400992).cljs$core$IFn$_invoke$arity$1(mission))))));
return cljs.core.filterv.call(null,((function (armybase_classes){
return (function (objective){
return armybase_classes.call(null,(new cljs.core.Keyword(null,"entity-type","entity-type",-1957300125).cljs$core$IFn$_invoke$arity$1(objective) - (100)));
});})(armybase_classes))
,new cljs.core.Keyword(null,"objectives","objectives",933939509).cljs$core$IFn$_invoke$arity$1(mission));
});
/**
 * Returns the name of a carrier task force unit.
 */
weathergen.falcon.files.mission.carrier_name = (function weathergen$falcon$files$mission$carrier_name(mission,carrier){
return new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(cljs.core.nth.call(null,new cljs.core.Keyword(null,"vehicle-class-data","vehicle-class-data",1666024339).cljs$core$IFn$_invoke$arity$1(mission),new cljs.core.Keyword(null,"data-pointer","data-pointer",-1957576382).cljs$core$IFn$_invoke$arity$1(weathergen.falcon.files.mission.class_table_entry.call(null,mission,carrier))));
});
weathergen.falcon.files.mission.air_icon_resource_prefix = new cljs.core.PersistentArrayMap(null, 8, [new cljs.core.Keyword(null,"white","white",-483998618),"wh",new cljs.core.Keyword(null,"green","green",-945526839),"gn",new cljs.core.Keyword(null,"blue","blue",-622100620),"bl",new cljs.core.Keyword(null,"brown","brown",1414854429),"br",new cljs.core.Keyword(null,"orange","orange",73816386),"or",new cljs.core.Keyword(null,"yellow","yellow",-881035449),"yl",new cljs.core.Keyword(null,"red","red",-969428204),"rd",new cljs.core.Keyword(null,"grey","grey",1875582333),"gy"], null);
/**
 * Returns an image descriptor for a squadron.
 */
weathergen.falcon.files.mission.squadron_image = (function weathergen$falcon$files$mission$squadron_image(mission,squadron){
var map__35249 = squadron;
var map__35249__$1 = ((((!((map__35249 == null)))?((((map__35249.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35249.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35249):map__35249);
var owner = cljs.core.get.call(null,map__35249__$1,new cljs.core.Keyword(null,"owner","owner",-392611939));
var map__35250 = weathergen.falcon.files.mission.unit_class_entry.call(null,mission,squadron);
var map__35250__$1 = ((((!((map__35250 == null)))?((((map__35250.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35250.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35250):map__35250);
var icon_index = cljs.core.get.call(null,map__35250__$1,new cljs.core.Keyword(null,"icon-index","icon-index",-42714286));
var map__35251 = mission;
var map__35251__$1 = ((((!((map__35251 == null)))?((((map__35251.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35251.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35251):map__35251);
var image_ids = cljs.core.get.call(null,map__35251__$1,new cljs.core.Keyword(null,"image-ids","image-ids",-529925649));
return weathergen.falcon.files.images.make_descriptor.call(null,mission,[cljs.core.str.cljs$core$IFn$_invoke$arity$1("resource/"),cljs.core.str.cljs$core$IFn$_invoke$arity$1(weathergen.falcon.files.mission.air_icon_resource_prefix.call(null,weathergen.falcon.files.mission.team_color.call(null,owner))),cljs.core.str.cljs$core$IFn$_invoke$arity$1("air_nn")].join(''),cljs.core.get_in.call(null,image_ids,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"id->name","id->name",249122446),icon_index], null)));
});
weathergen.falcon.files.mission.icon_resource_prefix = new cljs.core.PersistentArrayMap(null, 8, [new cljs.core.Keyword(null,"white","white",-483998618),"wht",new cljs.core.Keyword(null,"green","green",-945526839),"grn",new cljs.core.Keyword(null,"blue","blue",-622100620),"blu",new cljs.core.Keyword(null,"brown","brown",1414854429),"brn",new cljs.core.Keyword(null,"orange","orange",73816386),"orn",new cljs.core.Keyword(null,"yellow","yellow",-881035449),"ylw",new cljs.core.Keyword(null,"red","red",-969428204),"red",new cljs.core.Keyword(null,"grey","grey",1875582333),"gry"], null);
/**
 * Returns an image descriptor for an objective.
 */
weathergen.falcon.files.mission.objective_image = (function weathergen$falcon$files$mission$objective_image(mission,objective){
var map__35261 = objective;
var map__35261__$1 = ((((!((map__35261 == null)))?((((map__35261.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35261.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35261):map__35261);
var owner = cljs.core.get.call(null,map__35261__$1,new cljs.core.Keyword(null,"owner","owner",-392611939));
var map__35262 = weathergen.falcon.files.mission.objective_class_entry.call(null,mission,objective);
var map__35262__$1 = ((((!((map__35262 == null)))?((((map__35262.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35262.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35262):map__35262);
var icon_index = cljs.core.get.call(null,map__35262__$1,new cljs.core.Keyword(null,"icon-index","icon-index",-42714286));
var map__35263 = mission;
var map__35263__$1 = ((((!((map__35263 == null)))?((((map__35263.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35263.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35263):map__35263);
var image_ids = cljs.core.get.call(null,map__35263__$1,new cljs.core.Keyword(null,"image-ids","image-ids",-529925649));
return weathergen.falcon.files.images.make_descriptor.call(null,mission,[cljs.core.str.cljs$core$IFn$_invoke$arity$1("resource/"),cljs.core.str.cljs$core$IFn$_invoke$arity$1(weathergen.falcon.files.mission.icon_resource_prefix.call(null,weathergen.falcon.files.mission.team_color.call(null,owner))),cljs.core.str.cljs$core$IFn$_invoke$arity$1("dark")].join(''),cljs.core.get_in.call(null,image_ids,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"id->name","id->name",249122446),icon_index], null)));
});
/**
 * Returns an image descriptor for a unit.
 */
weathergen.falcon.files.mission.unit_image = (function weathergen$falcon$files$mission$unit_image(mission,unit){
var map__35273 = unit;
var map__35273__$1 = ((((!((map__35273 == null)))?((((map__35273.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35273.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35273):map__35273);
var owner = cljs.core.get.call(null,map__35273__$1,new cljs.core.Keyword(null,"owner","owner",-392611939));
var map__35274 = weathergen.falcon.files.mission.unit_class_entry.call(null,mission,unit);
var map__35274__$1 = ((((!((map__35274 == null)))?((((map__35274.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35274.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35274):map__35274);
var icon_index = cljs.core.get.call(null,map__35274__$1,new cljs.core.Keyword(null,"icon-index","icon-index",-42714286));
var map__35275 = mission;
var map__35275__$1 = ((((!((map__35275 == null)))?((((map__35275.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35275.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35275):map__35275);
var image_ids = cljs.core.get.call(null,map__35275__$1,new cljs.core.Keyword(null,"image-ids","image-ids",-529925649));
return weathergen.falcon.files.images.make_descriptor.call(null,mission,[cljs.core.str.cljs$core$IFn$_invoke$arity$1("resource/"),cljs.core.str.cljs$core$IFn$_invoke$arity$1(weathergen.falcon.files.mission.icon_resource_prefix.call(null,weathergen.falcon.files.mission.team_color.call(null,owner))),cljs.core.str.cljs$core$IFn$_invoke$arity$1("dark")].join(''),cljs.core.get_in.call(null,image_ids,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"id->name","id->name",249122446),icon_index], null)));
});
/**
 * Returns a string describing the type of the squadron - Fighter,
 *   Attack, etc.
 */
weathergen.falcon.files.mission.squadron_type = (function weathergen$falcon$files$mission$squadron_type(mission,squadron){
return new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(weathergen.falcon.files.mission.unit_class_entry.call(null,mission,squadron));
});
/**
 * Returns the airbase objective for the given squadron.
 */
weathergen.falcon.files.mission.squadron_airbase = (function weathergen$falcon$files$mission$squadron_airbase(mission,squadron){
var temp__5276__auto__ = weathergen.falcon.files.mission.find_objective.call(null,mission,new cljs.core.Keyword(null,"id","id",-1388402092),new cljs.core.Keyword(null,"airbase-id","airbase-id",-1975592308).cljs$core$IFn$_invoke$arity$1(squadron));
if(cljs.core.truth_(temp__5276__auto__)){
var airbase = temp__5276__auto__;
return cljs.core.assoc.call(null,airbase,new cljs.core.Keyword("weathergen.falcon.files.mission","name","weathergen.falcon.files.mission/name",1235339975),weathergen.falcon.files.mission.objective_name.call(null,mission,airbase));
} else {
var carrier = weathergen.falcon.files.mission.find_unit.call(null,mission,new cljs.core.Keyword(null,"id","id",-1388402092),new cljs.core.Keyword(null,"airbase-id","airbase-id",-1975592308).cljs$core$IFn$_invoke$arity$1(squadron));
return cljs.core.assoc.call(null,carrier,new cljs.core.Keyword("weathergen.falcon.files.mission","name","weathergen.falcon.files.mission/name",1235339975),weathergen.falcon.files.mission.carrier_name.call(null,mission,carrier));
}
});
/**
 * Return a seq of all the flights in a mission
 */
weathergen.falcon.files.mission.flights = (function weathergen$falcon$files$mission$flights(mission){
var G__35281 = mission;
var G__35281__$1 = (((G__35281 == null))?null:weathergen.falcon.files.mission.active_units.call(null,G__35281));
var G__35281__$2 = (((G__35281__$1 == null))?null:cljs.core.filter.call(null,((function (G__35281,G__35281__$1){
return (function (p1__35279_SHARP_){
return cljs.core._EQ_.call(null,new cljs.core.Keyword(null,"type","type",1174270348).cljs$core$IFn$_invoke$arity$1(p1__35279_SHARP_),new cljs.core.Keyword(null,"flight","flight",-764860679));
});})(G__35281,G__35281__$1))
,G__35281__$1));
if((G__35281__$2 == null)){
return null;
} else {
return cljs.core.map.call(null,((function (G__35281,G__35281__$1,G__35281__$2){
return (function (flight){
var squadron = weathergen.falcon.files.mission.find_unit.call(null,mission,new cljs.core.Keyword(null,"id","id",-1388402092),new cljs.core.Keyword(null,"squadron","squadron",-1131671273).cljs$core$IFn$_invoke$arity$1(flight));
return cljs.core.assoc.call(null,flight,new cljs.core.Keyword("weathergen.falcon.files.mission","mission","weathergen.falcon.files.mission/mission",43331456),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"name","name",1843675177),weathergen.falcon.files.mission.flight_mission_name.call(null,mission,flight),new cljs.core.Keyword(null,"category","category",-593092832),weathergen.falcon.files.mission.flight_mission_category.call(null,mission,flight)], null),new cljs.core.Keyword("weathergen.falcon.files.mission","squadron","weathergen.falcon.files.mission/squadron",463902337),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"name","name",1843675177),((cljs.core.not.call(null,squadron))?"Unknown":weathergen.falcon.files.mission.unit_name.call(null,mission,squadron))], null),new cljs.core.Keyword("weathergen.falcon.files.mission","airbase","weathergen.falcon.files.mission/airbase",-1926407441),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"name","name",1843675177),((cljs.core.not.call(null,squadron))?"Unknown":new cljs.core.Keyword("weathergen.falcon.files.mission","name","weathergen.falcon.files.mission/name",1235339975).cljs$core$IFn$_invoke$arity$1(weathergen.falcon.files.mission.squadron_airbase.call(null,mission,squadron)))], null),new cljs.core.Keyword("weathergen.falcon.files.mission","package","weathergen.falcon.files.mission/package",-1415630340),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"name","name",1843675177),weathergen.falcon.files.mission.package_name.call(null,mission,new cljs.core.Keyword(null,"package","package",1189062786).cljs$core$IFn$_invoke$arity$1(flight))], null),new cljs.core.Keyword("weathergen.falcon.files.mission","waypoints","weathergen.falcon.files.mission/waypoints",712228162),weathergen.falcon.files.mission.flight_waypoints.call(null,mission,flight),new cljs.core.Keyword("weathergen.falcon.files.mission","loadouts","weathergen.falcon.files.mission/loadouts",142269567),weathergen.falcon.files.mission.flight_loadouts.call(null,mission,flight),new cljs.core.Keyword("weathergen.falcon.files.mission","aircraft","weathergen.falcon.files.mission/aircraft",774567258),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"airframe","airframe",643222926),((cljs.core.not.call(null,squadron))?"Unknown":new cljs.core.Keyword(null,"airframe","airframe",643222926).cljs$core$IFn$_invoke$arity$1(weathergen.falcon.files.mission.squadron_aircraft.call(null,mission,squadron))),new cljs.core.Keyword(null,"quantity","quantity",-1929050694),weathergen.falcon.files.mission.flight_aircraft_quantity.call(null,flight)], null));
});})(G__35281,G__35281__$1,G__35281__$2))
,G__35281__$2);
}
});
/**
 * Returns a seq of airbases.
 */
weathergen.falcon.files.mission.oob_air = (function weathergen$falcon$files$mission$oob_air(mission){
var squadrons = cljs.core.group_by.call(null,new cljs.core.Keyword(null,"airbase-id","airbase-id",-1975592308),cljs.core.map.call(null,(function (squadron){
return cljs.core.assoc.call(null,squadron,new cljs.core.Keyword("weathergen.falcon.files.mission","aircraft","weathergen.falcon.files.mission/aircraft",774567258),weathergen.falcon.files.mission.squadron_aircraft.call(null,mission,squadron),new cljs.core.Keyword("weathergen.falcon.files.mission","squadron-type","weathergen.falcon.files.mission/squadron-type",1124226793),weathergen.falcon.files.mission.squadron_type.call(null,mission,squadron),new cljs.core.Keyword("weathergen.falcon.files.mission","image","weathergen.falcon.files.mission/image",-1683332210),weathergen.falcon.files.mission.squadron_image.call(null,mission,squadron));
}),new cljs.core.Keyword(null,"squadron","squadron",-1131671273).cljs$core$IFn$_invoke$arity$1(cljs.core.group_by.call(null,new cljs.core.Keyword(null,"type","type",1174270348),weathergen.falcon.files.mission.active_units.call(null,mission)))));
var airbases = weathergen.falcon.files.mission.airbases.call(null,mission);
var carriers = weathergen.falcon.files.mission.carriers.call(null,mission);
var army_bases = weathergen.falcon.files.mission.army_bases.call(null,mission);
var airbases_STAR_ = cljs.core.mapv.call(null,((function (squadrons,airbases,carriers,army_bases){
return (function (p1__35282_SHARP_){
return cljs.core.assoc.call(null,p1__35282_SHARP_,new cljs.core.Keyword("weathergen.falcon.files.mission","location","weathergen.falcon.files.mission/location",125705122),cljs.core.select_keys.call(null,p1__35282_SHARP_,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"x","x",2099068185),new cljs.core.Keyword(null,"y","y",-1757859776)], null)),new cljs.core.Keyword("weathergen.falcon.files.mission","status","weathergen.falcon.files.mission/status",667063917),weathergen.falcon.files.mission.airbase_status.call(null,mission,p1__35282_SHARP_),new cljs.core.Keyword("weathergen.falcon.files.mission","squadrons","weathergen.falcon.files.mission/squadrons",47769110),cljs.core.get.call(null,squadrons,new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(p1__35282_SHARP_)),new cljs.core.Keyword("weathergen.falcon.files.mission","image","weathergen.falcon.files.mission/image",-1683332210),weathergen.falcon.files.mission.objective_image.call(null,mission,p1__35282_SHARP_),new cljs.core.Keyword("weathergen.falcon.files.mission","name","weathergen.falcon.files.mission/name",1235339975),weathergen.falcon.files.mission.objective_name.call(null,mission,p1__35282_SHARP_));
});})(squadrons,airbases,carriers,army_bases))
,airbases);
var carriers_STAR_ = cljs.core.mapv.call(null,((function (squadrons,airbases,carriers,army_bases,airbases_STAR_){
return (function (p1__35283_SHARP_){
return cljs.core.assoc.call(null,p1__35283_SHARP_,new cljs.core.Keyword("weathergen.falcon.files.mission","location","weathergen.falcon.files.mission/location",125705122),cljs.core.select_keys.call(null,p1__35283_SHARP_,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"x","x",2099068185),new cljs.core.Keyword(null,"y","y",-1757859776)], null)),new cljs.core.Keyword("weathergen.falcon.files.mission","status","weathergen.falcon.files.mission/status",667063917),(100),new cljs.core.Keyword("weathergen.falcon.files.mission","squadrons","weathergen.falcon.files.mission/squadrons",47769110),cljs.core.get.call(null,squadrons,new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(p1__35283_SHARP_)),new cljs.core.Keyword("weathergen.falcon.files.mission","image","weathergen.falcon.files.mission/image",-1683332210),weathergen.falcon.files.mission.unit_image.call(null,mission,p1__35283_SHARP_),new cljs.core.Keyword("weathergen.falcon.files.mission","name","weathergen.falcon.files.mission/name",1235339975),weathergen.falcon.files.mission.carrier_name.call(null,mission,p1__35283_SHARP_));
});})(squadrons,airbases,carriers,army_bases,airbases_STAR_))
,carriers);
var army_bases_STAR_ = cljs.core.mapv.call(null,((function (squadrons,airbases,carriers,army_bases,airbases_STAR_,carriers_STAR_){
return (function (p1__35284_SHARP_){
return cljs.core.assoc.call(null,p1__35284_SHARP_,new cljs.core.Keyword("weathergen.falcon.files.mission","location","weathergen.falcon.files.mission/location",125705122),cljs.core.select_keys.call(null,p1__35284_SHARP_,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"x","x",2099068185),new cljs.core.Keyword(null,"y","y",-1757859776)], null)),new cljs.core.Keyword("weathergen.falcon.files.mission","status","weathergen.falcon.files.mission/status",667063917),weathergen.falcon.files.mission.objective_status.call(null,mission,p1__35284_SHARP_),new cljs.core.Keyword("weathergen.falcon.files.mission","squadrons","weathergen.falcon.files.mission/squadrons",47769110),cljs.core.get.call(null,squadrons,new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(p1__35284_SHARP_)),new cljs.core.Keyword("weathergen.falcon.files.mission","image","weathergen.falcon.files.mission/image",-1683332210),weathergen.falcon.files.mission.objective_image.call(null,mission,p1__35284_SHARP_),new cljs.core.Keyword("weathergen.falcon.files.mission","name","weathergen.falcon.files.mission/name",1235339975),weathergen.falcon.files.mission.objective_name.call(null,mission,p1__35284_SHARP_));
});})(squadrons,airbases,carriers,army_bases,airbases_STAR_,carriers_STAR_))
,army_bases);
return cljs.core.vec.call(null,cljs.core.concat.call(null,airbases_STAR_,carriers_STAR_,army_bases_STAR_));
});
/**
 * Returns the order of battle, a map from category (air,
 *   army, naval, objective) to entries (specific to category).
 */
weathergen.falcon.files.mission.order_of_battle = (function weathergen$falcon$files$mission$order_of_battle(mission){
return new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"air","air",-104121788),weathergen.falcon.files.mission.oob_air.call(null,mission)], null);
});
/**
 * Returns the current time in the virtual world.
 */
weathergen.falcon.files.mission.mission_time = (function weathergen$falcon$files$mission$mission_time(mission){
return new cljs.core.Keyword(null,"current-time","current-time",-1609407134).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"campaign-info","campaign-info",1158908966).cljs$core$IFn$_invoke$arity$1(mission));
});
