// Compiled by ClojureScript 1.9.562 {}
goog.provide('hoplon.jquery');
goog.require('cljs.core');
goog.require('hoplon.core');
hoplon.jquery.set_attributes_BANG_ = (function hoplon$jquery$set_attributes_BANG_(var_args){
var args31103 = [];
var len__24369__auto___31122 = arguments.length;
var i__24370__auto___31123 = (0);
while(true){
if((i__24370__auto___31123 < len__24369__auto___31122)){
args31103.push((arguments[i__24370__auto___31123]));

var G__31124 = (i__24370__auto___31123 + (1));
i__24370__auto___31123 = G__31124;
continue;
} else {
}
break;
}

var G__31109 = args31103.length;
switch (G__31109) {
case 2:
return hoplon.jquery.set_attributes_BANG_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
var argseq__24392__auto__ = (new cljs.core.IndexedSeq(args31103.slice((3)),(0),null));
return hoplon.jquery.set_attributes_BANG_.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),argseq__24392__auto__);

}
});

hoplon.jquery.set_attributes_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (this$,kvs){
var e = jQuery(this$);
var seq__31110 = cljs.core.seq.call(null,kvs);
var chunk__31112 = null;
var count__31113 = (0);
var i__31114 = (0);
while(true){
if((i__31114 < count__31113)){
var vec__31116 = cljs.core._nth.call(null,chunk__31112,i__31114);
var k = cljs.core.nth.call(null,vec__31116,(0),null);
var v = cljs.core.nth.call(null,vec__31116,(1),null);
var k_31126__$1 = cljs.core.name.call(null,k);
if(cljs.core.not.call(null,v)){
e.removeAttr(k_31126__$1);
} else {
e.attr(k_31126__$1,((cljs.core._EQ_.call(null,true,v))?k_31126__$1:v));
}

var G__31127 = seq__31110;
var G__31128 = chunk__31112;
var G__31129 = count__31113;
var G__31130 = (i__31114 + (1));
seq__31110 = G__31127;
chunk__31112 = G__31128;
count__31113 = G__31129;
i__31114 = G__31130;
continue;
} else {
var temp__5278__auto__ = cljs.core.seq.call(null,seq__31110);
if(temp__5278__auto__){
var seq__31110__$1 = temp__5278__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,seq__31110__$1)){
var c__24059__auto__ = cljs.core.chunk_first.call(null,seq__31110__$1);
var G__31131 = cljs.core.chunk_rest.call(null,seq__31110__$1);
var G__31132 = c__24059__auto__;
var G__31133 = cljs.core.count.call(null,c__24059__auto__);
var G__31134 = (0);
seq__31110 = G__31131;
chunk__31112 = G__31132;
count__31113 = G__31133;
i__31114 = G__31134;
continue;
} else {
var vec__31119 = cljs.core.first.call(null,seq__31110__$1);
var k = cljs.core.nth.call(null,vec__31119,(0),null);
var v = cljs.core.nth.call(null,vec__31119,(1),null);
var k_31135__$1 = cljs.core.name.call(null,k);
if(cljs.core.not.call(null,v)){
e.removeAttr(k_31135__$1);
} else {
e.attr(k_31135__$1,((cljs.core._EQ_.call(null,true,v))?k_31135__$1:v));
}

var G__31136 = cljs.core.next.call(null,seq__31110__$1);
var G__31137 = null;
var G__31138 = (0);
var G__31139 = (0);
seq__31110 = G__31136;
chunk__31112 = G__31137;
count__31113 = G__31138;
i__31114 = G__31139;
continue;
}
} else {
return null;
}
}
break;
}
});

hoplon.jquery.set_attributes_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (this$,k,v,kvs){
return hoplon.jquery.set_attributes_BANG_.call(null,this$,cljs.core.apply.call(null,cljs.core.hash_map,k,v,kvs));
});

hoplon.jquery.set_attributes_BANG_.cljs$lang$applyTo = (function (seq31104){
var G__31105 = cljs.core.first.call(null,seq31104);
var seq31104__$1 = cljs.core.next.call(null,seq31104);
var G__31106 = cljs.core.first.call(null,seq31104__$1);
var seq31104__$2 = cljs.core.next.call(null,seq31104__$1);
var G__31107 = cljs.core.first.call(null,seq31104__$2);
var seq31104__$3 = cljs.core.next.call(null,seq31104__$2);
return hoplon.jquery.set_attributes_BANG_.cljs$core$IFn$_invoke$arity$variadic(G__31105,G__31106,G__31107,seq31104__$3);
});

hoplon.jquery.set_attributes_BANG_.cljs$lang$maxFixedArity = (3);

hoplon.jquery.set_styles_BANG_ = (function hoplon$jquery$set_styles_BANG_(var_args){
var args31140 = [];
var len__24369__auto___31157 = arguments.length;
var i__24370__auto___31158 = (0);
while(true){
if((i__24370__auto___31158 < len__24369__auto___31157)){
args31140.push((arguments[i__24370__auto___31158]));

var G__31159 = (i__24370__auto___31158 + (1));
i__24370__auto___31158 = G__31159;
continue;
} else {
}
break;
}

var G__31146 = args31140.length;
switch (G__31146) {
case 2:
return hoplon.jquery.set_styles_BANG_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
var argseq__24392__auto__ = (new cljs.core.IndexedSeq(args31140.slice((3)),(0),null));
return hoplon.jquery.set_styles_BANG_.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),argseq__24392__auto__);

}
});

hoplon.jquery.set_styles_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (this$,kvs){
var e = jQuery(this$);
var seq__31147 = cljs.core.seq.call(null,kvs);
var chunk__31148 = null;
var count__31149 = (0);
var i__31150 = (0);
while(true){
if((i__31150 < count__31149)){
var vec__31151 = cljs.core._nth.call(null,chunk__31148,i__31150);
var k = cljs.core.nth.call(null,vec__31151,(0),null);
var v = cljs.core.nth.call(null,vec__31151,(1),null);
e.css(cljs.core.name.call(null,k),[cljs.core.str.cljs$core$IFn$_invoke$arity$1(v)].join(''));

var G__31161 = seq__31147;
var G__31162 = chunk__31148;
var G__31163 = count__31149;
var G__31164 = (i__31150 + (1));
seq__31147 = G__31161;
chunk__31148 = G__31162;
count__31149 = G__31163;
i__31150 = G__31164;
continue;
} else {
var temp__5278__auto__ = cljs.core.seq.call(null,seq__31147);
if(temp__5278__auto__){
var seq__31147__$1 = temp__5278__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,seq__31147__$1)){
var c__24059__auto__ = cljs.core.chunk_first.call(null,seq__31147__$1);
var G__31165 = cljs.core.chunk_rest.call(null,seq__31147__$1);
var G__31166 = c__24059__auto__;
var G__31167 = cljs.core.count.call(null,c__24059__auto__);
var G__31168 = (0);
seq__31147 = G__31165;
chunk__31148 = G__31166;
count__31149 = G__31167;
i__31150 = G__31168;
continue;
} else {
var vec__31154 = cljs.core.first.call(null,seq__31147__$1);
var k = cljs.core.nth.call(null,vec__31154,(0),null);
var v = cljs.core.nth.call(null,vec__31154,(1),null);
e.css(cljs.core.name.call(null,k),[cljs.core.str.cljs$core$IFn$_invoke$arity$1(v)].join(''));

var G__31169 = cljs.core.next.call(null,seq__31147__$1);
var G__31170 = null;
var G__31171 = (0);
var G__31172 = (0);
seq__31147 = G__31169;
chunk__31148 = G__31170;
count__31149 = G__31171;
i__31150 = G__31172;
continue;
}
} else {
return null;
}
}
break;
}
});

hoplon.jquery.set_styles_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (this$,k,v,kvs){
return hoplon.jquery.set_styles_BANG_.call(null,this$,cljs.core.apply.call(null,cljs.core.hash_map,k,v,kvs));
});

hoplon.jquery.set_styles_BANG_.cljs$lang$applyTo = (function (seq31141){
var G__31142 = cljs.core.first.call(null,seq31141);
var seq31141__$1 = cljs.core.next.call(null,seq31141);
var G__31143 = cljs.core.first.call(null,seq31141__$1);
var seq31141__$2 = cljs.core.next.call(null,seq31141__$1);
var G__31144 = cljs.core.first.call(null,seq31141__$2);
var seq31141__$3 = cljs.core.next.call(null,seq31141__$2);
return hoplon.jquery.set_styles_BANG_.cljs$core$IFn$_invoke$arity$variadic(G__31142,G__31143,G__31144,seq31141__$3);
});

hoplon.jquery.set_styles_BANG_.cljs$lang$maxFixedArity = (3);

hoplon.jquery.text_val_BANG_ = (function hoplon$jquery$text_val_BANG_(var_args){
var args31173 = [];
var len__24369__auto___31176 = arguments.length;
var i__24370__auto___31177 = (0);
while(true){
if((i__24370__auto___31177 < len__24369__auto___31176)){
args31173.push((arguments[i__24370__auto___31177]));

var G__31178 = (i__24370__auto___31177 + (1));
i__24370__auto___31177 = G__31178;
continue;
} else {
}
break;
}

var G__31175 = args31173.length;
switch (G__31175) {
case 1:
return hoplon.jquery.text_val_BANG_.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return hoplon.jquery.text_val_BANG_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args31173.length)].join('')));

}
});

hoplon.jquery.text_val_BANG_.cljs$core$IFn$_invoke$arity$1 = (function (e){
return e.val();
});

hoplon.jquery.text_val_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (e,v){
var v__$1 = [cljs.core.str.cljs$core$IFn$_invoke$arity$1(v)].join('');
if(cljs.core.not_EQ_.call(null,v__$1,hoplon.jquery.text_val_BANG_.call(null,e))){
return e.val(v__$1);
} else {
return null;
}
});

hoplon.jquery.text_val_BANG_.cljs$lang$maxFixedArity = 2;

hoplon.jquery.check_val_BANG_ = (function hoplon$jquery$check_val_BANG_(var_args){
var args31180 = [];
var len__24369__auto___31183 = arguments.length;
var i__24370__auto___31184 = (0);
while(true){
if((i__24370__auto___31184 < len__24369__auto___31183)){
args31180.push((arguments[i__24370__auto___31184]));

var G__31185 = (i__24370__auto___31184 + (1));
i__24370__auto___31184 = G__31185;
continue;
} else {
}
break;
}

var G__31182 = args31180.length;
switch (G__31182) {
case 1:
return hoplon.jquery.check_val_BANG_.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return hoplon.jquery.check_val_BANG_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args31180.length)].join('')));

}
});

hoplon.jquery.check_val_BANG_.cljs$core$IFn$_invoke$arity$1 = (function (e){
return e.is(":checked");
});

hoplon.jquery.check_val_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (e,v){
return e.prop("checked",cljs.core.boolean$.call(null,v));
});

hoplon.jquery.check_val_BANG_.cljs$lang$maxFixedArity = 2;

cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword("hoplon.core","default","hoplon.core/default",-778824365),(function (elem,key,val){
return hoplon.core.do_BANG_.call(null,elem,new cljs.core.Keyword(null,"attr","attr",-604132353),cljs.core.PersistentArrayMap.createAsIfByAssoc([key,val]));
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword("css","*","css/*",-1295355419),(function (elem,key,val){
return hoplon.jquery.set_styles_BANG_.call(null,elem,key,val);
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword("html","*","html/*",-1283138243),(function (elem,key,val){
return hoplon.jquery.set_attributes_BANG_.call(null,elem,key,val);
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword("svg","*","svg/*",-1295405562),(function (elem,key,val){
return hoplon.jquery.set_attributes_BANG_.call(null,elem,key,val);
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword("attr","*","attr/*",-1283077225),(function (elem,_,kvs){
return hoplon.jquery.set_attributes_BANG_.call(null,elem,kvs);
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword("prop","*","prop/*",-1283942139),(function (elem,key,val){
var e = jQuery(elem);
return e.prop(cljs.core.name.call(null,key),val);
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword("data","*","data/*",-1283013312),(function (elem,key,val){
var e = jQuery(elem);
return e.data(cljs.core.name.call(null,key),val);
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"attr","attr",-604132353),(function (elem,_,kvs){
return hoplon.jquery.set_attributes_BANG_.call(null,elem,kvs);
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"css","css",1135045163),(function (elem,_,kvs){
return hoplon.jquery.set_styles_BANG_.call(null,elem,kvs);
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"value","value",305978217),(function() { 
var G__31187__delegate = function (elem,_,args){
var e = jQuery(elem);
return cljs.core.apply.call(null,((cljs.core._EQ_.call(null,"checkbox",e.attr("type")))?hoplon.jquery.check_val_BANG_:hoplon.jquery.text_val_BANG_),e,args);
};
var G__31187 = function (elem,_,var_args){
var args = null;
if (arguments.length > 2) {
var G__31188__i = 0, G__31188__a = new Array(arguments.length -  2);
while (G__31188__i < G__31188__a.length) {G__31188__a[G__31188__i] = arguments[G__31188__i + 2]; ++G__31188__i;}
  args = new cljs.core.IndexedSeq(G__31188__a,0,null);
} 
return G__31187__delegate.call(this,elem,_,args);};
G__31187.cljs$lang$maxFixedArity = 2;
G__31187.cljs$lang$applyTo = (function (arglist__31189){
var elem = cljs.core.first(arglist__31189);
arglist__31189 = cljs.core.next(arglist__31189);
var _ = cljs.core.first(arglist__31189);
var args = cljs.core.rest(arglist__31189);
return G__31187__delegate(elem,_,args);
});
G__31187.cljs$core$IFn$_invoke$arity$variadic = G__31187__delegate;
return G__31187;
})()
);
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"class","class",-2030961996),(function (elem,_,kvs){
var elem__$1 = jQuery(elem);
var clmap = hoplon.core.normalize_class.call(null,kvs);
var seq__31190 = cljs.core.seq.call(null,clmap);
var chunk__31191 = null;
var count__31192 = (0);
var i__31193 = (0);
while(true){
if((i__31193 < count__31192)){
var vec__31194 = cljs.core._nth.call(null,chunk__31191,i__31193);
var c = cljs.core.nth.call(null,vec__31194,(0),null);
var p_QMARK_ = cljs.core.nth.call(null,vec__31194,(1),null);
elem__$1.toggleClass(cljs.core.name.call(null,c),cljs.core.boolean$.call(null,p_QMARK_));

var G__31200 = seq__31190;
var G__31201 = chunk__31191;
var G__31202 = count__31192;
var G__31203 = (i__31193 + (1));
seq__31190 = G__31200;
chunk__31191 = G__31201;
count__31192 = G__31202;
i__31193 = G__31203;
continue;
} else {
var temp__5278__auto__ = cljs.core.seq.call(null,seq__31190);
if(temp__5278__auto__){
var seq__31190__$1 = temp__5278__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,seq__31190__$1)){
var c__24059__auto__ = cljs.core.chunk_first.call(null,seq__31190__$1);
var G__31204 = cljs.core.chunk_rest.call(null,seq__31190__$1);
var G__31205 = c__24059__auto__;
var G__31206 = cljs.core.count.call(null,c__24059__auto__);
var G__31207 = (0);
seq__31190 = G__31204;
chunk__31191 = G__31205;
count__31192 = G__31206;
i__31193 = G__31207;
continue;
} else {
var vec__31197 = cljs.core.first.call(null,seq__31190__$1);
var c = cljs.core.nth.call(null,vec__31197,(0),null);
var p_QMARK_ = cljs.core.nth.call(null,vec__31197,(1),null);
elem__$1.toggleClass(cljs.core.name.call(null,c),cljs.core.boolean$.call(null,p_QMARK_));

var G__31208 = cljs.core.next.call(null,seq__31190__$1);
var G__31209 = null;
var G__31210 = (0);
var G__31211 = (0);
seq__31190 = G__31208;
chunk__31191 = G__31209;
count__31192 = G__31210;
i__31193 = G__31211;
continue;
}
} else {
return null;
}
}
break;
}
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"toggle","toggle",1291842030),(function (elem,_,v){
return jQuery(elem).toggle(cljs.core.boolean$.call(null,v));
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"slide-toggle","slide-toggle",968641513),(function (elem,_,v){
if(cljs.core.truth_(v)){
return jQuery(elem).hide().slideDown("fast");
} else {
return jQuery(elem).slideUp("fast");
}
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"fade-toggle","fade-toggle",-1468421852),(function (elem,_,v){
if(cljs.core.truth_(v)){
return jQuery(elem).hide().fadeIn("fast");
} else {
return jQuery(elem).fadeOut("fast");
}
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"focus","focus",234677911),(function (elem,_,v){
return setTimeout((function (){
if(cljs.core.truth_(v)){
return jQuery(elem).focus();
} else {
return jQuery(elem).focusout();
}
}),(0));
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"select","select",1147833503),(function (elem,_,___$1){
return jQuery(elem).select();
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"focus-select","focus-select",1107982934),(function (elem,_,v){
if(cljs.core.truth_(v)){
hoplon.core.do_BANG_.call(null,elem,new cljs.core.Keyword(null,"focus","focus",234677911),v);

return hoplon.core.do_BANG_.call(null,elem,new cljs.core.Keyword(null,"select","select",1147833503),v);
} else {
return null;
}
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"text","text",-1790561697),(function (elem,_,v){
return jQuery(elem).text([cljs.core.str.cljs$core$IFn$_invoke$arity$1(v)].join(''));
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"html","html",-998796897),(function (elem,_,v){
return jQuery(elem).html(v);
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"scroll-to","scroll-to",-34957602),(function (elem,_,v){
if(cljs.core.truth_(v)){
var body = jQuery("body,html");
var elem__$1 = jQuery(elem);
return body.animate(cljs.core.clj__GT_js.call(null,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"scrollTop","scrollTop",-1143661921),elem__$1.offset().top], null)));
} else {
return null;
}
}));
jQuery.Event.prototype.cljs$core$IDeref$ = cljs.core.PROTOCOL_SENTINEL;

jQuery.Event.prototype.cljs$core$IDeref$_deref$arity$1 = (function (this$){
var this$__$1 = this;
return jQuery(this$__$1.target).val();
});
cljs.core._add_method.call(null,hoplon.core.on_BANG_,new cljs.core.Keyword("hoplon.core","default","hoplon.core/default",-778824365),(function (elem,event,callback){
return hoplon.core.when_dom.call(null,elem,(function (){
return jQuery(elem).on(cljs.core.name.call(null,event),callback);
}));
}));
cljs.core._add_method.call(null,hoplon.core.on_BANG_,new cljs.core.Keyword("html","*","html/*",-1283138243),(function (elem,event,callback){
return hoplon.core.when_dom.call(null,elem,(function (){
return jQuery(elem).on(cljs.core.name.call(null,event),callback);
}));
}));
