// Compiled by ClojureScript 1.9.562 {}
goog.provide('weathergen.falcon.files');
goog.require('cljs.core');
goog.require('clojure.string');
goog.require('octet.core');
goog.require('taoensso.timbre');
goog.require('weathergen.util');
weathergen.falcon.files.all_errors = new cljs.core.Keyword(null,"default","default",-1987822328);
weathergen.falcon.files.read_trace = (function weathergen$falcon$files$read_trace(msg,spec){
if(typeof weathergen.falcon.files.t_weathergen$falcon$files34497 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
weathergen.falcon.files.t_weathergen$falcon$files34497 = (function (msg,spec,meta34498){
this.msg = msg;
this.spec = spec;
this.meta34498 = meta34498;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34497.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_34499,meta34498__$1){
var self__ = this;
var _34499__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34497(self__.msg,self__.spec,meta34498__$1));
});

weathergen.falcon.files.t_weathergen$falcon$files34497.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34499){
var self__ = this;
var _34499__$1 = this;
return self__.meta34498;
});

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

weathergen.falcon.files.t_weathergen$falcon$files34497.prototype.octet$spec$ISpec$read$arity$3 = (function (_,buf,pos){
var self__ = this;
var ___$1 = this;
taoensso.timbre._log_BANG_.call(null,taoensso.timbre._STAR_config_STAR_,new cljs.core.Keyword(null,"debug","debug",-1608172596),"weathergen.falcon.files",null,21,new cljs.core.Keyword(null,"p","p",151049309),new cljs.core.Keyword(null,"auto","auto",-566279492),(new cljs.core.Delay(((function (___$1){
return (function (){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [[cljs.core.str.cljs$core$IFn$_invoke$arity$1("start: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(self__.msg),cljs.core.str.cljs$core$IFn$_invoke$arity$1("@"),cljs.core.str.cljs$core$IFn$_invoke$arity$1(pos)].join('')], null);
});})(___$1))
,null)),null,-397939334);

var result = octet.spec.read.call(null,self__.spec,buf,pos);
taoensso.timbre._log_BANG_.call(null,taoensso.timbre._STAR_config_STAR_,new cljs.core.Keyword(null,"debug","debug",-1608172596),"weathergen.falcon.files",null,23,new cljs.core.Keyword(null,"p","p",151049309),new cljs.core.Keyword(null,"auto","auto",-566279492),(new cljs.core.Delay(((function (result,___$1){
return (function (){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [[cljs.core.str.cljs$core$IFn$_invoke$arity$1("end: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(self__.msg)].join('')], null);
});})(result,___$1))
,null)),null,-1233326185);

try{var result__14684__auto__ = result;
taoensso.timbre._log_BANG_.call(null,taoensso.timbre._STAR_config_STAR_,new cljs.core.Keyword(null,"debug","debug",-1608172596),"weathergen.falcon.files",null,24,new cljs.core.Keyword(null,"p","p",151049309),new cljs.core.Keyword(null,"auto","auto",-566279492),(new cljs.core.Delay(((function (result__14684__auto__,result,___$1){
return (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"result","result",-1239343558,null),"=>",result__14684__auto__], null);
});})(result__14684__auto__,result,___$1))
,null)),null,2090150711);

return result__14684__auto__;
}catch (e34500){if((e34500 instanceof Error)){
var e__14646__auto__ = e34500;
taoensso.timbre._log_BANG_.call(null,taoensso.timbre._STAR_config_STAR_,new cljs.core.Keyword(null,"error","error",-978969032),"weathergen.falcon.files",null,24,new cljs.core.Keyword(null,"p","p",151049309),new cljs.core.Keyword(null,"auto","auto",-566279492),(new cljs.core.Delay(((function (e__14646__auto__,result,___$1){
return (function (){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [e__14646__auto__], null);
});})(e__14646__auto__,result,___$1))
,null)),null,1640997652);

throw e__14646__auto__;
} else {
throw e34500;

}
}});

weathergen.falcon.files.t_weathergen$falcon$files34497.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"msg","msg",254428083,null),new cljs.core.Symbol(null,"spec","spec",1988051928,null),new cljs.core.Symbol(null,"meta34498","meta34498",1171582828,null)], null);
});

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

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

weathergen.falcon.files.t_weathergen$falcon$files34497.cljs$lang$ctorPrWriter = (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"weathergen.falcon.files/t_weathergen$falcon$files34497");
});

weathergen.falcon.files.__GT_t_weathergen$falcon$files34497 = (function weathergen$falcon$files$read_trace_$___GT_t_weathergen$falcon$files34497(msg__$1,spec__$1,meta34498){
return (new weathergen.falcon.files.t_weathergen$falcon$files34497(msg__$1,spec__$1,meta34498));
});

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34497(msg,spec,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Length prefixed string
 */
weathergen.falcon.files.lstring = (function weathergen$falcon$files$lstring(length_spec){
var len_size = octet.core.size.call(null,length_spec);
if(typeof weathergen.falcon.files.t_weathergen$falcon$files34505 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {cljs.core.IFn}
 * @implements {octet.spec.ISpecDynamicSize}
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
weathergen.falcon.files.t_weathergen$falcon$files34505 = (function (length_spec,len_size,meta34506){
this.length_spec = length_spec;
this.len_size = len_size;
this.meta34506 = meta34506;
this.cljs$lang$protocol_mask$partition0$ = 393217;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34505.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (len_size){
return (function (_34507,meta34506__$1){
var self__ = this;
var _34507__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34505(self__.length_spec,self__.len_size,meta34506__$1));
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34505.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (len_size){
return (function (_34507){
var self__ = this;
var _34507__$1 = this;
return self__.meta34506;
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34505.prototype.call = ((function (len_size){
return (function (self__){
var self__ = this;
var self____$1 = this;
var s = self____$1;
return s;
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34505.prototype.apply = ((function (len_size){
return (function (self__,args34508){
var self__ = this;
var self____$1 = this;
return self____$1.call.apply(self____$1,[self____$1].concat(cljs.core.aclone.call(null,args34508)));
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34505.prototype.cljs$core$IFn$_invoke$arity$0 = ((function (len_size){
return (function (){
var self__ = this;
var s = this;
return s;
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34505.prototype.octet$spec$ISpecDynamicSize$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.t_weathergen$falcon$files34505.prototype.octet$spec$ISpecDynamicSize$size_STAR_$arity$2 = ((function (len_size){
return (function (_,data){
var self__ = this;
var ___$1 = this;
var data__$1 = octet.spec.string.string__GT_bytes.call(null,data);
return (self__.len_size + cljs.core.count.call(null,data__$1));
});})(len_size))
;

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

weathergen.falcon.files.t_weathergen$falcon$files34505.prototype.octet$spec$ISpec$read$arity$3 = ((function (len_size){
return (function (_,buff,pos){
var self__ = this;
var ___$1 = this;
var datasize = octet.core.read.call(null,buff,self__.length_spec,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),pos], null));
var data = octet.buffer.read_bytes.call(null,buff,(pos + self__.len_size),datasize);
var data__$1 = octet.spec.string.bytes__GT_string.call(null,data,datasize);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(datasize + self__.len_size),data__$1], null);
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34505.prototype.octet$spec$ISpec$write$arity$4 = ((function (len_size){
return (function (_,buff,pos,value){
var self__ = this;
var ___$1 = this;
var input = octet.spec.string.string__GT_bytes.call(null,value);
var length = cljs.core.count.call(null,input);
octet.core.write_BANG_.call(null,buff,self__.length_spec,pos,length);

octet.buffer.write_bytes.call(null,buff,(pos + self__.len_size),length,input);

return (length + self__.len_size);
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34505.getBasis = ((function (len_size){
return (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"length-spec","length-spec",-1802545726,null),new cljs.core.Symbol(null,"len-size","len-size",1194866842,null),new cljs.core.Symbol(null,"meta34506","meta34506",169847325,null)], null);
});})(len_size))
;

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

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

weathergen.falcon.files.t_weathergen$falcon$files34505.cljs$lang$ctorPrWriter = ((function (len_size){
return (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"weathergen.falcon.files/t_weathergen$falcon$files34505");
});})(len_size))
;

weathergen.falcon.files.__GT_t_weathergen$falcon$files34505 = ((function (len_size){
return (function weathergen$falcon$files$lstring_$___GT_t_weathergen$falcon$files34505(length_spec__$1,len_size__$1,meta34506){
return (new weathergen.falcon.files.t_weathergen$falcon$files34505(length_spec__$1,len_size__$1,meta34506));
});})(len_size))
;

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34505(length_spec,len_size,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Returns `s` trimmed of any trailing null characters.
 */
weathergen.falcon.files.remove_trailing_nulls = (function weathergen$falcon$files$remove_trailing_nulls(s){
return cljs.core.subs.call(null,s,(0),cljs.core.count.call(null,cljs.core.take_while.call(null,(function (p1__34509_SHARP_){
return !((p1__34509_SHARP_.charCodeAt() === (0)));
}),s)));
});
/**
 * Octet spec for a string of a fixed size. Removes trailing null
 *   characters, if any, unline `buf/string`.
 */
weathergen.falcon.files.fixed_string = (function weathergen$falcon$files$fixed_string(size){
var spc = octet.core.string.call(null,size);
if(typeof weathergen.falcon.files.t_weathergen$falcon$files34516 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
 * @implements {octet.spec.ISpecSize}
*/
weathergen.falcon.files.t_weathergen$falcon$files34516 = (function (size,spc,meta34517){
this.size = size;
this.spc = spc;
this.meta34517 = meta34517;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34516.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (spc){
return (function (_34518,meta34517__$1){
var self__ = this;
var _34518__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34516(self__.size,self__.spc,meta34517__$1));
});})(spc))
;

weathergen.falcon.files.t_weathergen$falcon$files34516.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (spc){
return (function (_34518){
var self__ = this;
var _34518__$1 = this;
return self__.meta34517;
});})(spc))
;

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

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

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

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

weathergen.falcon.files.t_weathergen$falcon$files34516.prototype.octet$spec$ISpec$write$arity$4 = ((function (spc){
return (function (_,buff,pos,value){
var self__ = this;
var ___$1 = this;
return octet.core.write_BANG_.call(null,buff,self__.spc,value,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),pos], null));
});})(spc))
;

weathergen.falcon.files.t_weathergen$falcon$files34516.getBasis = ((function (spc){
return (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"size","size",-1555742762,null),new cljs.core.Symbol(null,"spc","spc",-189939168,null),new cljs.core.Symbol(null,"meta34517","meta34517",-1525761406,null)], null);
});})(spc))
;

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

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

weathergen.falcon.files.t_weathergen$falcon$files34516.cljs$lang$ctorPrWriter = ((function (spc){
return (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"weathergen.falcon.files/t_weathergen$falcon$files34516");
});})(spc))
;

weathergen.falcon.files.__GT_t_weathergen$falcon$files34516 = ((function (spc){
return (function weathergen$falcon$files$fixed_string_$___GT_t_weathergen$falcon$files34516(size__$1,spc__$1,meta34517){
return (new weathergen.falcon.files.t_weathergen$falcon$files34516(size__$1,spc__$1,meta34517));
});})(spc))
;

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34516(size,spc,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Octet spec for a length prefixed array.
 */
weathergen.falcon.files.larray = (function weathergen$falcon$files$larray(length_spec,item_spec){
var len_size = octet.core.size.call(null,length_spec);
if(typeof weathergen.falcon.files.t_weathergen$falcon$files34529 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {cljs.core.IFn}
 * @implements {octet.spec.ISpecDynamicSize}
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
weathergen.falcon.files.t_weathergen$falcon$files34529 = (function (length_spec,item_spec,len_size,meta34530){
this.length_spec = length_spec;
this.item_spec = item_spec;
this.len_size = len_size;
this.meta34530 = meta34530;
this.cljs$lang$protocol_mask$partition0$ = 393217;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34529.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (len_size){
return (function (_34531,meta34530__$1){
var self__ = this;
var _34531__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34529(self__.length_spec,self__.item_spec,self__.len_size,meta34530__$1));
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34529.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (len_size){
return (function (_34531){
var self__ = this;
var _34531__$1 = this;
return self__.meta34530;
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34529.prototype.call = ((function (len_size){
return (function (self__){
var self__ = this;
var self____$1 = this;
var s = self____$1;
return s;
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34529.prototype.apply = ((function (len_size){
return (function (self__,args34532){
var self__ = this;
var self____$1 = this;
return self____$1.call.apply(self____$1,[self____$1].concat(cljs.core.aclone.call(null,args34532)));
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34529.prototype.cljs$core$IFn$_invoke$arity$0 = ((function (len_size){
return (function (){
var self__ = this;
var s = this;
return s;
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34529.prototype.octet$spec$ISpecDynamicSize$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.t_weathergen$falcon$files34529.prototype.octet$spec$ISpecDynamicSize$size_STAR_$arity$2 = ((function (len_size){
return (function (_,data){
var self__ = this;
var ___$1 = this;
return (self__.len_size + (octet.core.size.call(null,self__.item_spec) * cljs.core.count.call(null,data)));
});})(len_size))
;

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

weathergen.falcon.files.t_weathergen$falcon$files34529.prototype.octet$spec$ISpec$read$arity$3 = ((function (len_size){
return (function (_,buff,pos){
var self__ = this;
var ___$1 = this;
var n = octet.core.read.call(null,buff,self__.length_spec,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),pos], null));
var vec__34533 = octet.core.read_STAR_.call(null,buff,octet.core.repeat.call(null,n,self__.item_spec),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),(pos + self__.len_size)], null));
var datasize = cljs.core.nth.call(null,vec__34533,(0),null);
var data = cljs.core.nth.call(null,vec__34533,(1),null);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(datasize + self__.len_size),data], null);
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34529.prototype.octet$spec$ISpec$write$arity$4 = ((function (len_size){
return (function (_,buff,pos,value){
var self__ = this;
var ___$1 = this;
var n = cljs.core.count.call(null,value);
return (octet.core.write_BANG_.call(null,buff,n,self__.length_spec,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),pos], null)) + octet.core.write_BANG_.call(null,buff,value,octet.core.repeat.call(null,n,self__.item_spec),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),(pos + self__.len_size)], null)));
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34529.getBasis = ((function (len_size){
return (function (){
return new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"length-spec","length-spec",-1802545726,null),new cljs.core.Symbol(null,"item-spec","item-spec",1394678941,null),new cljs.core.Symbol(null,"len-size","len-size",1194866842,null),new cljs.core.Symbol(null,"meta34530","meta34530",371477463,null)], null);
});})(len_size))
;

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

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

weathergen.falcon.files.t_weathergen$falcon$files34529.cljs$lang$ctorPrWriter = ((function (len_size){
return (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"weathergen.falcon.files/t_weathergen$falcon$files34529");
});})(len_size))
;

weathergen.falcon.files.__GT_t_weathergen$falcon$files34529 = ((function (len_size){
return (function weathergen$falcon$files$larray_$___GT_t_weathergen$falcon$files34529(length_spec__$1,item_spec__$1,len_size__$1,meta34530){
return (new weathergen.falcon.files.t_weathergen$falcon$files34529(length_spec__$1,item_spec__$1,len_size__$1,meta34530));
});})(len_size))
;

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34529(length_spec,item_spec,len_size,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Returns a spec that decodes from read values via the mapping in m.
 */
weathergen.falcon.files.enum$ = (function weathergen$falcon$files$enum(item_spec,m){
if(typeof weathergen.falcon.files.t_weathergen$falcon$files34542 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
 * @implements {octet.spec.ISpecSize}
*/
weathergen.falcon.files.t_weathergen$falcon$files34542 = (function (item_spec,m,meta34543){
this.item_spec = item_spec;
this.m = m;
this.meta34543 = meta34543;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34542.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_34544,meta34543__$1){
var self__ = this;
var _34544__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34542(self__.item_spec,self__.m,meta34543__$1));
});

weathergen.falcon.files.t_weathergen$falcon$files34542.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34544){
var self__ = this;
var _34544__$1 = this;
return self__.meta34543;
});

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

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

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

weathergen.falcon.files.t_weathergen$falcon$files34542.prototype.octet$spec$ISpec$read$arity$3 = (function (_,buf,pos){
var self__ = this;
var ___$1 = this;
var vec__34545 = octet.core.read_STAR_.call(null,buf,self__.item_spec,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),pos], null));
var datasize = cljs.core.nth.call(null,vec__34545,(0),null);
var val = cljs.core.nth.call(null,vec__34545,(1),null);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [datasize,self__.m.call(null,val,val)], null);
});

weathergen.falcon.files.t_weathergen$falcon$files34542.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"item-spec","item-spec",1394678941,null),new cljs.core.Symbol(null,"m","m",-1021758608,null),new cljs.core.Symbol(null,"meta34543","meta34543",978882012,null)], null);
});

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

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

weathergen.falcon.files.t_weathergen$falcon$files34542.cljs$lang$ctorPrWriter = (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"weathergen.falcon.files/t_weathergen$falcon$files34542");
});

weathergen.falcon.files.__GT_t_weathergen$falcon$files34542 = (function weathergen$falcon$files$enum_$___GT_t_weathergen$falcon$files34542(item_spec__$1,m__$1,meta34543){
return (new weathergen.falcon.files.t_weathergen$falcon$files34542(item_spec__$1,m__$1,meta34543));
});

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34542(item_spec,m,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Returns a spec that decodes from a read value into a set of bits
 *   based on the mapping in m.
 */
weathergen.falcon.files.bitflags = (function weathergen$falcon$files$bitflags(item_spec,m){
if(typeof weathergen.falcon.files.t_weathergen$falcon$files34570 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
weathergen.falcon.files.t_weathergen$falcon$files34570 = (function (item_spec,m,meta34571){
this.item_spec = item_spec;
this.m = m;
this.meta34571 = meta34571;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34570.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_34572,meta34571__$1){
var self__ = this;
var _34572__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34570(self__.item_spec,self__.m,meta34571__$1));
});

weathergen.falcon.files.t_weathergen$falcon$files34570.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34572){
var self__ = this;
var _34572__$1 = this;
return self__.meta34571;
});

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

weathergen.falcon.files.t_weathergen$falcon$files34570.prototype.octet$spec$ISpec$read$arity$3 = (function (_,buf,pos){
var self__ = this;
var ___$1 = this;
var vec__34573 = octet.core.read_STAR_.call(null,buf,self__.item_spec,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),pos], null));
var datasize = cljs.core.nth.call(null,vec__34573,(0),null);
var val = cljs.core.nth.call(null,vec__34573,(1),null);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [datasize,cljs.core.set.call(null,cljs.core.remove.call(null,cljs.core.nil_QMARK_,(function (){var iter__24200__auto__ = ((function (vec__34573,datasize,val,___$1){
return (function weathergen$falcon$files$bitflags_$_iter__34576(s__34577){
return (new cljs.core.LazySeq(null,((function (vec__34573,datasize,val,___$1){
return (function (){
var s__34577__$1 = s__34577;
while(true){
var temp__5278__auto__ = cljs.core.seq.call(null,s__34577__$1);
if(temp__5278__auto__){
var s__34577__$2 = temp__5278__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__34577__$2)){
var c__24198__auto__ = cljs.core.chunk_first.call(null,s__34577__$2);
var size__24199__auto__ = cljs.core.count.call(null,c__24198__auto__);
var b__34579 = cljs.core.chunk_buffer.call(null,size__24199__auto__);
if((function (){var i__34578 = (0);
while(true){
if((i__34578 < size__24199__auto__)){
var vec__34586 = cljs.core._nth.call(null,c__24198__auto__,i__34578);
var flag = cljs.core.nth.call(null,vec__34586,(0),null);
var mask = cljs.core.nth.call(null,vec__34586,(1),null);
cljs.core.chunk_append.call(null,b__34579,(cljs.core.truth_(weathergen.util.has_flag_QMARK_.call(null,val,mask))?flag:null));

var G__34592 = (i__34578 + (1));
i__34578 = G__34592;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__34579),weathergen$falcon$files$bitflags_$_iter__34576.call(null,cljs.core.chunk_rest.call(null,s__34577__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__34579),null);
}
} else {
var vec__34589 = cljs.core.first.call(null,s__34577__$2);
var flag = cljs.core.nth.call(null,vec__34589,(0),null);
var mask = cljs.core.nth.call(null,vec__34589,(1),null);
return cljs.core.cons.call(null,(cljs.core.truth_(weathergen.util.has_flag_QMARK_.call(null,val,mask))?flag:null),weathergen$falcon$files$bitflags_$_iter__34576.call(null,cljs.core.rest.call(null,s__34577__$2)));
}
} else {
return null;
}
break;
}
});})(vec__34573,datasize,val,___$1))
,null,null));
});})(vec__34573,datasize,val,___$1))
;
return iter__24200__auto__.call(null,self__.m);
})()))], null);
});

weathergen.falcon.files.t_weathergen$falcon$files34570.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"item-spec","item-spec",1394678941,null),new cljs.core.Symbol(null,"m","m",-1021758608,null),new cljs.core.Symbol(null,"meta34571","meta34571",1368008105,null)], null);
});

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

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

weathergen.falcon.files.t_weathergen$falcon$files34570.cljs$lang$ctorPrWriter = (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"weathergen.falcon.files/t_weathergen$falcon$files34570");
});

weathergen.falcon.files.__GT_t_weathergen$falcon$files34570 = (function weathergen$falcon$files$bitflags_$___GT_t_weathergen$falcon$files34570(item_spec__$1,m__$1,meta34571){
return (new weathergen.falcon.files.t_weathergen$falcon$files34570(item_spec__$1,m__$1,meta34571));
});

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34570(item_spec,m,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Returns a spec that consumes and produces no data, but reads a
 *   constant value.
 */
weathergen.falcon.files.constant = (function weathergen$falcon$files$constant(val){
if(typeof weathergen.falcon.files.t_weathergen$falcon$files34596 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
weathergen.falcon.files.t_weathergen$falcon$files34596 = (function (val,meta34597){
this.val = val;
this.meta34597 = meta34597;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34596.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_34598,meta34597__$1){
var self__ = this;
var _34598__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34596(self__.val,meta34597__$1));
});

weathergen.falcon.files.t_weathergen$falcon$files34596.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34598){
var self__ = this;
var _34598__$1 = this;
return self__.meta34597;
});

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

weathergen.falcon.files.t_weathergen$falcon$files34596.prototype.octet$spec$ISpec$read$arity$3 = (function (_,___$1,___$2){
var self__ = this;
var ___$3 = this;
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(0),self__.val], null);
});

weathergen.falcon.files.t_weathergen$falcon$files34596.prototype.octet$spec$ISpec$write$arity$4 = (function (_,___$1,___$2,___$3){
var self__ = this;
var ___$4 = this;
return null;
});

weathergen.falcon.files.t_weathergen$falcon$files34596.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"val","val",1769233139,null),new cljs.core.Symbol(null,"meta34597","meta34597",1594035290,null)], null);
});

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

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

weathergen.falcon.files.t_weathergen$falcon$files34596.cljs$lang$ctorPrWriter = (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"weathergen.falcon.files/t_weathergen$falcon$files34596");
});

weathergen.falcon.files.__GT_t_weathergen$falcon$files34596 = (function weathergen$falcon$files$constant_$___GT_t_weathergen$falcon$files34596(val__$1,meta34597){
return (new weathergen.falcon.files.t_weathergen$falcon$files34596(val__$1,meta34597));
});

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34596(val,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Read thread operator. Composes a read against multiple (potentially
 *   dynamically determined) specs passing the accumulated read value in
 *   turn through spec-fns, each a function from the accumulator to a
 *   spec.
 */
weathergen.falcon.files.read__GT_ = (function weathergen$falcon$files$read__GT_(var_args){
var args__24566__auto__ = [];
var len__24559__auto___34615 = arguments.length;
var i__24560__auto___34616 = (0);
while(true){
if((i__24560__auto___34616 < len__24559__auto___34615)){
args__24566__auto__.push((arguments[i__24560__auto___34616]));

var G__34617 = (i__24560__auto___34616 + (1));
i__24560__auto___34616 = G__34617;
continue;
} else {
}
break;
}

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

weathergen.falcon.files.read__GT_.cljs$core$IFn$_invoke$arity$variadic = (function (buf,offset,spec_fns){
var size = (0);
var data = cljs.core.PersistentArrayMap.EMPTY;
var G__34605 = spec_fns;
var vec__34606 = G__34605;
var seq__34607 = cljs.core.seq.call(null,vec__34606);
var first__34608 = cljs.core.first.call(null,seq__34607);
var seq__34607__$1 = cljs.core.next.call(null,seq__34607);
var spec_fn = first__34608;
var more = seq__34607__$1;
var size__$1 = size;
var data__$1 = data;
var G__34605__$1 = G__34605;
while(true){
var size__$2 = size__$1;
var data__$2 = data__$1;
var vec__34609 = G__34605__$1;
var seq__34610 = cljs.core.seq.call(null,vec__34609);
var first__34611 = cljs.core.first.call(null,seq__34610);
var seq__34610__$1 = cljs.core.next.call(null,seq__34610);
var spec_fn__$1 = first__34611;
var more__$1 = seq__34610__$1;
if(cljs.core.not.call(null,spec_fn__$1)){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [size__$2,data__$2], null);
} else {
var vec__34612 = octet.core.read_STAR_.call(null,buf,spec_fn__$1.call(null,data__$2),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),(offset + size__$2)], null));
var size_STAR_ = cljs.core.nth.call(null,vec__34612,(0),null);
var data_STAR_ = cljs.core.nth.call(null,vec__34612,(1),null);
var G__34618 = (size__$2 + size_STAR_);
var G__34619 = cljs.core.merge.call(null,data__$2,data_STAR_);
var G__34620 = more__$1;
size__$1 = G__34618;
data__$1 = G__34619;
G__34605__$1 = G__34620;
continue;
}
break;
}
});

weathergen.falcon.files.read__GT_.cljs$lang$maxFixedArity = (2);

weathergen.falcon.files.read__GT_.cljs$lang$applyTo = (function (seq34599){
var G__34600 = cljs.core.first.call(null,seq34599);
var seq34599__$1 = cljs.core.next.call(null,seq34599);
var G__34601 = cljs.core.first.call(null,seq34599__$1);
var seq34599__$2 = cljs.core.next.call(null,seq34599__$1);
return weathergen.falcon.files.read__GT_.cljs$core$IFn$_invoke$arity$variadic(G__34600,G__34601,seq34599__$2);
});

/**
 * Returns a spec that conditionally reads/write a map. It first reads
 *   `flag-spec`, then passes the value to `flag-pred`. Depending on the
 *   value returned, either reads `true-spec` or `false-spec`. Read
 *   values are returned under keys `flag-key` and `branch-key`.
 */
weathergen.falcon.files.spec_if = (function weathergen$falcon$files$spec_if(flag_key,flag_spec,flag_pred,branch_key,true_spec,false_spec){
if(typeof weathergen.falcon.files.t_weathergen$falcon$files34630 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
weathergen.falcon.files.t_weathergen$falcon$files34630 = (function (flag_key,flag_spec,flag_pred,branch_key,true_spec,false_spec,meta34631){
this.flag_key = flag_key;
this.flag_spec = flag_spec;
this.flag_pred = flag_pred;
this.branch_key = branch_key;
this.true_spec = true_spec;
this.false_spec = false_spec;
this.meta34631 = meta34631;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34630.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_34632,meta34631__$1){
var self__ = this;
var _34632__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34630(self__.flag_key,self__.flag_spec,self__.flag_pred,self__.branch_key,self__.true_spec,self__.false_spec,meta34631__$1));
});

weathergen.falcon.files.t_weathergen$falcon$files34630.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34632){
var self__ = this;
var _34632__$1 = this;
return self__.meta34631;
});

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

weathergen.falcon.files.t_weathergen$falcon$files34630.prototype.octet$spec$ISpec$read$arity$3 = (function (_,buf,pos){
var self__ = this;
var ___$1 = this;
var vec__34633 = octet.core.read_STAR_.call(null,buf,self__.flag_spec,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),pos], null));
var flag_size = cljs.core.nth.call(null,vec__34633,(0),null);
var flag_val = cljs.core.nth.call(null,vec__34633,(1),null);
var vec__34636 = octet.core.read_STAR_.call(null,buf,(cljs.core.truth_(self__.flag_pred.call(null,flag_val))?self__.true_spec:self__.false_spec),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),(pos + flag_size)], null));
var branch_size = cljs.core.nth.call(null,vec__34636,(0),null);
var branch_val = cljs.core.nth.call(null,vec__34636,(1),null);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(flag_size + branch_size),cljs.core.PersistentHashMap.fromArrays([self__.flag_key,self__.branch_key],[flag_val,branch_val])], null);
});

weathergen.falcon.files.t_weathergen$falcon$files34630.getBasis = (function (){
return new cljs.core.PersistentVector(null, 7, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"flag-key","flag-key",-1036087809,null),new cljs.core.Symbol(null,"flag-spec","flag-spec",-648358532,null),new cljs.core.Symbol(null,"flag-pred","flag-pred",-548885820,null),new cljs.core.Symbol(null,"branch-key","branch-key",1453905826,null),new cljs.core.Symbol(null,"true-spec","true-spec",-704610023,null),new cljs.core.Symbol(null,"false-spec","false-spec",432945414,null),new cljs.core.Symbol(null,"meta34631","meta34631",1029649704,null)], null);
});

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

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

weathergen.falcon.files.t_weathergen$falcon$files34630.cljs$lang$ctorPrWriter = (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"weathergen.falcon.files/t_weathergen$falcon$files34630");
});

weathergen.falcon.files.__GT_t_weathergen$falcon$files34630 = (function weathergen$falcon$files$spec_if_$___GT_t_weathergen$falcon$files34630(flag_key__$1,flag_spec__$1,flag_pred__$1,branch_key__$1,true_spec__$1,false_spec__$1,meta34631){
return (new weathergen.falcon.files.t_weathergen$falcon$files34630(flag_key__$1,flag_spec__$1,flag_pred__$1,branch_key__$1,true_spec__$1,false_spec__$1,meta34631));
});

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34630(flag_key,flag_spec,flag_pred,branch_key,true_spec,false_spec,cljs.core.PersistentArrayMap.EMPTY));
});
