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

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

weathergen.falcon.files.t_weathergen$falcon$files34395.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34397){
var self__ = this;
var _34397__$1 = this;
return self__.meta34396;
});

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

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

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

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

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

throw e__14646__auto__;
} else {
throw e34398;

}
}});

weathergen.falcon.files.t_weathergen$falcon$files34395.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,"meta34396","meta34396",-1293751021,null)], null);
});

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

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

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

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

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34395(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$files34403 !== '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$files34403 = (function (length_spec,len_size,meta34404){
this.length_spec = length_spec;
this.len_size = len_size;
this.meta34404 = meta34404;
this.cljs$lang$protocol_mask$partition0$ = 393217;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34403.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (len_size){
return (function (_34405,meta34404__$1){
var self__ = this;
var _34405__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34403(self__.length_spec,self__.len_size,meta34404__$1));
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34403.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (len_size){
return (function (_34405){
var self__ = this;
var _34405__$1 = this;
return self__.meta34404;
});})(len_size))
;

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

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

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

weathergen.falcon.files.t_weathergen$falcon$files34403.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$files34403.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$files34403.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,"meta34404","meta34404",1485708569,null)], null);
});})(len_size))
;

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

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

weathergen.falcon.files.t_weathergen$falcon$files34403.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$files34403");
});})(len_size))
;

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

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34403(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__34407_SHARP_){
return !((p1__34407_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$files34414 !== '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$files34414 = (function (size,spc,meta34415){
this.size = size;
this.spc = spc;
this.meta34415 = meta34415;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34414.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (spc){
return (function (_34416,meta34415__$1){
var self__ = this;
var _34416__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34414(self__.size,self__.spc,meta34415__$1));
});})(spc))
;

weathergen.falcon.files.t_weathergen$falcon$files34414.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (spc){
return (function (_34416){
var self__ = this;
var _34416__$1 = this;
return self__.meta34415;
});})(spc))
;

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

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

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

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

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

weathergen.falcon.files.t_weathergen$falcon$files34414.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$files34414");
});})(spc))
;

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

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34414(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$files34427 !== '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$files34427 = (function (length_spec,item_spec,len_size,meta34428){
this.length_spec = length_spec;
this.item_spec = item_spec;
this.len_size = len_size;
this.meta34428 = meta34428;
this.cljs$lang$protocol_mask$partition0$ = 393217;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34427.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (len_size){
return (function (_34429,meta34428__$1){
var self__ = this;
var _34429__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34427(self__.length_spec,self__.item_spec,self__.len_size,meta34428__$1));
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34427.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (len_size){
return (function (_34429){
var self__ = this;
var _34429__$1 = this;
return self__.meta34428;
});})(len_size))
;

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

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

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

weathergen.falcon.files.t_weathergen$falcon$files34427.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__34431 = 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__34431,(0),null);
var data = cljs.core.nth.call(null,vec__34431,(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$files34427.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$files34427.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,"meta34428","meta34428",189787722,null)], null);
});})(len_size))
;

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

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

weathergen.falcon.files.t_weathergen$falcon$files34427.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$files34427");
});})(len_size))
;

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

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34427(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$files34440 !== '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$files34440 = (function (item_spec,m,meta34441){
this.item_spec = item_spec;
this.m = m;
this.meta34441 = meta34441;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34440.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_34442,meta34441__$1){
var self__ = this;
var _34442__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34440(self__.item_spec,self__.m,meta34441__$1));
});

weathergen.falcon.files.t_weathergen$falcon$files34440.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34442){
var self__ = this;
var _34442__$1 = this;
return self__.meta34441;
});

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

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

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

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

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

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

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

}

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

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

weathergen.falcon.files.t_weathergen$falcon$files34468.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34470){
var self__ = this;
var _34470__$1 = this;
return self__.meta34469;
});

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

weathergen.falcon.files.t_weathergen$falcon$files34468.prototype.octet$spec$ISpec$read$arity$3 = (function (_,buf,pos){
var self__ = this;
var ___$1 = this;
var vec__34471 = 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__34471,(0),null);
var val = cljs.core.nth.call(null,vec__34471,(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__34471,datasize,val,___$1){
return (function weathergen$falcon$files$bitflags_$_iter__34474(s__34475){
return (new cljs.core.LazySeq(null,((function (vec__34471,datasize,val,___$1){
return (function (){
var s__34475__$1 = s__34475;
while(true){
var temp__5278__auto__ = cljs.core.seq.call(null,s__34475__$1);
if(temp__5278__auto__){
var s__34475__$2 = temp__5278__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__34475__$2)){
var c__24198__auto__ = cljs.core.chunk_first.call(null,s__34475__$2);
var size__24199__auto__ = cljs.core.count.call(null,c__24198__auto__);
var b__34477 = cljs.core.chunk_buffer.call(null,size__24199__auto__);
if((function (){var i__34476 = (0);
while(true){
if((i__34476 < size__24199__auto__)){
var vec__34484 = cljs.core._nth.call(null,c__24198__auto__,i__34476);
var flag = cljs.core.nth.call(null,vec__34484,(0),null);
var mask = cljs.core.nth.call(null,vec__34484,(1),null);
cljs.core.chunk_append.call(null,b__34477,(cljs.core.truth_(weathergen.util.has_flag_QMARK_.call(null,val,mask))?flag:null));

var G__34490 = (i__34476 + (1));
i__34476 = G__34490;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__34477),weathergen$falcon$files$bitflags_$_iter__34474.call(null,cljs.core.chunk_rest.call(null,s__34475__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__34477),null);
}
} else {
var vec__34487 = cljs.core.first.call(null,s__34475__$2);
var flag = cljs.core.nth.call(null,vec__34487,(0),null);
var mask = cljs.core.nth.call(null,vec__34487,(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__34474.call(null,cljs.core.rest.call(null,s__34475__$2)));
}
} else {
return null;
}
break;
}
});})(vec__34471,datasize,val,___$1))
,null,null));
});})(vec__34471,datasize,val,___$1))
;
return iter__24200__auto__.call(null,self__.m);
})()))], null);
});

weathergen.falcon.files.t_weathergen$falcon$files34468.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,"meta34469","meta34469",1811922290,null)], null);
});

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

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

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

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

}

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

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

weathergen.falcon.files.t_weathergen$falcon$files34494.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34496){
var self__ = this;
var _34496__$1 = this;
return self__.meta34495;
});

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

weathergen.falcon.files.t_weathergen$falcon$files34494.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$files34494.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$files34494.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,"meta34495","meta34495",1553728778,null)], null);
});

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

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

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

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

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34494(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___34513 = arguments.length;
var i__24560__auto___34514 = (0);
while(true){
if((i__24560__auto___34514 < len__24559__auto___34513)){
args__24566__auto__.push((arguments[i__24560__auto___34514]));

var G__34515 = (i__24560__auto___34514 + (1));
i__24560__auto___34514 = G__34515;
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__34503 = spec_fns;
var vec__34504 = G__34503;
var seq__34505 = cljs.core.seq.call(null,vec__34504);
var first__34506 = cljs.core.first.call(null,seq__34505);
var seq__34505__$1 = cljs.core.next.call(null,seq__34505);
var spec_fn = first__34506;
var more = seq__34505__$1;
var size__$1 = size;
var data__$1 = data;
var G__34503__$1 = G__34503;
while(true){
var size__$2 = size__$1;
var data__$2 = data__$1;
var vec__34507 = G__34503__$1;
var seq__34508 = cljs.core.seq.call(null,vec__34507);
var first__34509 = cljs.core.first.call(null,seq__34508);
var seq__34508__$1 = cljs.core.next.call(null,seq__34508);
var spec_fn__$1 = first__34509;
var more__$1 = seq__34508__$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__34510 = 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__34510,(0),null);
var data_STAR_ = cljs.core.nth.call(null,vec__34510,(1),null);
var G__34516 = (size__$2 + size_STAR_);
var G__34517 = cljs.core.merge.call(null,data__$2,data_STAR_);
var G__34518 = more__$1;
size__$1 = G__34516;
data__$1 = G__34517;
G__34503__$1 = G__34518;
continue;
}
break;
}
});

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

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

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

weathergen.falcon.files.t_weathergen$falcon$files34528.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34530){
var self__ = this;
var _34530__$1 = this;
return self__.meta34529;
});

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

weathergen.falcon.files.t_weathergen$falcon$files34528.prototype.octet$spec$ISpec$read$arity$3 = (function (_,buf,pos){
var self__ = this;
var ___$1 = this;
var vec__34531 = 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__34531,(0),null);
var flag_val = cljs.core.nth.call(null,vec__34531,(1),null);
var vec__34534 = 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__34534,(0),null);
var branch_val = cljs.core.nth.call(null,vec__34534,(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$files34528.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,"meta34529","meta34529",1019277678,null)], null);
});

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

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

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

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

}

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