// 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$files34573 !== 'undefined'){
} else {

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

weathergen.falcon.files.t_weathergen$falcon$files34573.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34575){
var self__ = this;
var _34575__$1 = this;
return self__.meta34574;
});

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

weathergen.falcon.files.t_weathergen$falcon$files34573.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,-724607045);

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,984028981);

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,-950012383);

return result__14684__auto__;
}catch (e34576){if((e34576 instanceof Error)){
var e__14646__auto__ = e34576;
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,-729985656);

throw e__14646__auto__;
} else {
throw e34576;

}
}});

weathergen.falcon.files.t_weathergen$falcon$files34573.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,"meta34574","meta34574",2080480850,null)], null);
});

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

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

weathergen.falcon.files.t_weathergen$falcon$files34573.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/t_weathergen$falcon$files34573");
});

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

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34573(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$files34581 !== '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$files34581 = (function (length_spec,len_size,meta34582){
this.length_spec = length_spec;
this.len_size = len_size;
this.meta34582 = meta34582;
this.cljs$lang$protocol_mask$partition0$ = 393217;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34581.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (len_size){
return (function (_34583,meta34582__$1){
var self__ = this;
var _34583__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34581(self__.length_spec,self__.len_size,meta34582__$1));
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34581.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (len_size){
return (function (_34583){
var self__ = this;
var _34583__$1 = this;
return self__.meta34582;
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34581.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$files34581.prototype.apply = ((function (len_size){
return (function (self__,args34584){
var self__ = this;
var self____$1 = this;
return self____$1.call.apply(self____$1,[self____$1].concat(cljs.core.aclone.call(null,args34584)));
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34581.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$files34581.prototype.octet$spec$ISpecDynamicSize$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.t_weathergen$falcon$files34581.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$files34581.prototype.octet$spec$ISpec$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.t_weathergen$falcon$files34581.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$files34581.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$files34581.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,"meta34582","meta34582",-448557054,null)], null);
});})(len_size))
;

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

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

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

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

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34581(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__34585_SHARP_){
return !((p1__34585_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$files34592 !== '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$files34592 = (function (size,spc,meta34593){
this.size = size;
this.spc = spc;
this.meta34593 = meta34593;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34592.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (spc){
return (function (_34594,meta34593__$1){
var self__ = this;
var _34594__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34592(self__.size,self__.spc,meta34593__$1));
});})(spc))
;

weathergen.falcon.files.t_weathergen$falcon$files34592.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (spc){
return (function (_34594){
var self__ = this;
var _34594__$1 = this;
return self__.meta34593;
});})(spc))
;

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

weathergen.falcon.files.t_weathergen$falcon$files34592.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$files34592.prototype.octet$spec$ISpec$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.t_weathergen$falcon$files34592.prototype.octet$spec$ISpec$read$arity$3 = ((function (spc){
return (function (_,buff,pos){
var self__ = this;
var ___$1 = this;
var vec__34595 = 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__34595,(0),null);
var data = cljs.core.nth.call(null,vec__34595,(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$files34592.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$files34592.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,"meta34593","meta34593",2087788581,null)], null);
});})(spc))
;

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

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

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

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

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34592(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$files34605 !== '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$files34605 = (function (length_spec,item_spec,len_size,meta34606){
this.length_spec = length_spec;
this.item_spec = item_spec;
this.len_size = len_size;
this.meta34606 = meta34606;
this.cljs$lang$protocol_mask$partition0$ = 393217;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34605.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (len_size){
return (function (_34607,meta34606__$1){
var self__ = this;
var _34607__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34605(self__.length_spec,self__.item_spec,self__.len_size,meta34606__$1));
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34605.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (len_size){
return (function (_34607){
var self__ = this;
var _34607__$1 = this;
return self__.meta34606;
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34605.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$files34605.prototype.apply = ((function (len_size){
return (function (self__,args34608){
var self__ = this;
var self____$1 = this;
return self____$1.call.apply(self____$1,[self____$1].concat(cljs.core.aclone.call(null,args34608)));
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34605.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$files34605.prototype.octet$spec$ISpecDynamicSize$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.t_weathergen$falcon$files34605.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$files34605.prototype.octet$spec$ISpec$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.t_weathergen$falcon$files34605.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__34609 = 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__34609,(0),null);
var data = cljs.core.nth.call(null,vec__34609,(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$files34605.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$files34605.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,"meta34606","meta34606",-2025580824,null)], null);
});})(len_size))
;

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

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

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

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

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34605(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$files34618 !== '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$files34618 = (function (item_spec,m,meta34619){
this.item_spec = item_spec;
this.m = m;
this.meta34619 = meta34619;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34618.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_34620,meta34619__$1){
var self__ = this;
var _34620__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34618(self__.item_spec,self__.m,meta34619__$1));
});

weathergen.falcon.files.t_weathergen$falcon$files34618.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34620){
var self__ = this;
var _34620__$1 = this;
return self__.meta34619;
});

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

weathergen.falcon.files.t_weathergen$falcon$files34618.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$files34618.prototype.octet$spec$ISpec$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.t_weathergen$falcon$files34618.prototype.octet$spec$ISpec$read$arity$3 = (function (_,buf,pos){
var self__ = this;
var ___$1 = this;
var vec__34621 = 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__34621,(0),null);
var val = cljs.core.nth.call(null,vec__34621,(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$files34618.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,"meta34619","meta34619",-1381634563,null)], null);
});

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

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

weathergen.falcon.files.t_weathergen$falcon$files34618.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/t_weathergen$falcon$files34618");
});

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

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34618(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$files34646 !== 'undefined'){
} else {

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

weathergen.falcon.files.t_weathergen$falcon$files34646.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34648){
var self__ = this;
var _34648__$1 = this;
return self__.meta34647;
});

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

weathergen.falcon.files.t_weathergen$falcon$files34646.prototype.octet$spec$ISpec$read$arity$3 = (function (_,buf,pos){
var self__ = this;
var ___$1 = this;
var vec__34649 = 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__34649,(0),null);
var val = cljs.core.nth.call(null,vec__34649,(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__24010__auto__ = ((function (vec__34649,datasize,val,___$1){
return (function weathergen$falcon$files$bitflags_$_iter__34652(s__34653){
return (new cljs.core.LazySeq(null,((function (vec__34649,datasize,val,___$1){
return (function (){
var s__34653__$1 = s__34653;
while(true){
var temp__5278__auto__ = cljs.core.seq.call(null,s__34653__$1);
if(temp__5278__auto__){
var s__34653__$2 = temp__5278__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__34653__$2)){
var c__24008__auto__ = cljs.core.chunk_first.call(null,s__34653__$2);
var size__24009__auto__ = cljs.core.count.call(null,c__24008__auto__);
var b__34655 = cljs.core.chunk_buffer.call(null,size__24009__auto__);
if((function (){var i__34654 = (0);
while(true){
if((i__34654 < size__24009__auto__)){
var vec__34662 = cljs.core._nth.call(null,c__24008__auto__,i__34654);
var flag = cljs.core.nth.call(null,vec__34662,(0),null);
var mask = cljs.core.nth.call(null,vec__34662,(1),null);
cljs.core.chunk_append.call(null,b__34655,(cljs.core.truth_(weathergen.util.has_flag_QMARK_.call(null,val,mask))?flag:null));

var G__34668 = (i__34654 + (1));
i__34654 = G__34668;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__34655),weathergen$falcon$files$bitflags_$_iter__34652.call(null,cljs.core.chunk_rest.call(null,s__34653__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__34655),null);
}
} else {
var vec__34665 = cljs.core.first.call(null,s__34653__$2);
var flag = cljs.core.nth.call(null,vec__34665,(0),null);
var mask = cljs.core.nth.call(null,vec__34665,(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__34652.call(null,cljs.core.rest.call(null,s__34653__$2)));
}
} else {
return null;
}
break;
}
});})(vec__34649,datasize,val,___$1))
,null,null));
});})(vec__34649,datasize,val,___$1))
;
return iter__24010__auto__.call(null,self__.m);
})()))], null);
});

weathergen.falcon.files.t_weathergen$falcon$files34646.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,"meta34647","meta34647",1269020302,null)], null);
});

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

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

weathergen.falcon.files.t_weathergen$falcon$files34646.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/t_weathergen$falcon$files34646");
});

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

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34646(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$files34672 !== 'undefined'){
} else {

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

weathergen.falcon.files.t_weathergen$falcon$files34672.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34674){
var self__ = this;
var _34674__$1 = this;
return self__.meta34673;
});

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

weathergen.falcon.files.t_weathergen$falcon$files34672.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$files34672.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$files34672.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,"meta34673","meta34673",633313372,null)], null);
});

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

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

weathergen.falcon.files.t_weathergen$falcon$files34672.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/t_weathergen$falcon$files34672");
});

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

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34672(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__24376__auto__ = [];
var len__24369__auto___34691 = arguments.length;
var i__24370__auto___34692 = (0);
while(true){
if((i__24370__auto___34692 < len__24369__auto___34691)){
args__24376__auto__.push((arguments[i__24370__auto___34692]));

var G__34693 = (i__24370__auto___34692 + (1));
i__24370__auto___34692 = G__34693;
continue;
} else {
}
break;
}

var argseq__24377__auto__ = ((((2) < args__24376__auto__.length))?(new cljs.core.IndexedSeq(args__24376__auto__.slice((2)),(0),null)):null);
return weathergen.falcon.files.read__GT_.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__24377__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__34681 = spec_fns;
var vec__34682 = G__34681;
var seq__34683 = cljs.core.seq.call(null,vec__34682);
var first__34684 = cljs.core.first.call(null,seq__34683);
var seq__34683__$1 = cljs.core.next.call(null,seq__34683);
var spec_fn = first__34684;
var more = seq__34683__$1;
var size__$1 = size;
var data__$1 = data;
var G__34681__$1 = G__34681;
while(true){
var size__$2 = size__$1;
var data__$2 = data__$1;
var vec__34685 = G__34681__$1;
var seq__34686 = cljs.core.seq.call(null,vec__34685);
var first__34687 = cljs.core.first.call(null,seq__34686);
var seq__34686__$1 = cljs.core.next.call(null,seq__34686);
var spec_fn__$1 = first__34687;
var more__$1 = seq__34686__$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__34688 = 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__34688,(0),null);
var data_STAR_ = cljs.core.nth.call(null,vec__34688,(1),null);
var G__34694 = (size__$2 + size_STAR_);
var G__34695 = cljs.core.merge.call(null,data__$2,data_STAR_);
var G__34696 = more__$1;
size__$1 = G__34694;
data__$1 = G__34695;
G__34681__$1 = G__34696;
continue;
}
break;
}
});

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

weathergen.falcon.files.read__GT_.cljs$lang$applyTo = (function (seq34675){
var G__34676 = cljs.core.first.call(null,seq34675);
var seq34675__$1 = cljs.core.next.call(null,seq34675);
var G__34677 = cljs.core.first.call(null,seq34675__$1);
var seq34675__$2 = cljs.core.next.call(null,seq34675__$1);
return weathergen.falcon.files.read__GT_.cljs$core$IFn$_invoke$arity$variadic(G__34676,G__34677,seq34675__$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$files34706 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
weathergen.falcon.files.t_weathergen$falcon$files34706 = (function (flag_key,flag_spec,flag_pred,branch_key,true_spec,false_spec,meta34707){
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.meta34707 = meta34707;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34706.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_34708,meta34707__$1){
var self__ = this;
var _34708__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34706(self__.flag_key,self__.flag_spec,self__.flag_pred,self__.branch_key,self__.true_spec,self__.false_spec,meta34707__$1));
});

weathergen.falcon.files.t_weathergen$falcon$files34706.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34708){
var self__ = this;
var _34708__$1 = this;
return self__.meta34707;
});

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

weathergen.falcon.files.t_weathergen$falcon$files34706.prototype.octet$spec$ISpec$read$arity$3 = (function (_,buf,pos){
var self__ = this;
var ___$1 = this;
var vec__34709 = 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__34709,(0),null);
var flag_val = cljs.core.nth.call(null,vec__34709,(1),null);
var vec__34712 = 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__34712,(0),null);
var branch_val = cljs.core.nth.call(null,vec__34712,(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$files34706.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,"meta34707","meta34707",1697968944,null)], null);
});

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

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

weathergen.falcon.files.t_weathergen$falcon$files34706.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/t_weathergen$falcon$files34706");
});

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

}

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