// Compiled by ClojureScript 0.0-2138
goog.provide('lt.objs.langs.behaviors');
goog.require('cljs.core');
goog.require('lt.util.js');
goog.require('lt.objs.thread');
goog.require('lt.util.js');
goog.require('lt.util.dom');
goog.require('lt.objs.context');
goog.require('lt.objs.context');
goog.require('lt.util.dom');
goog.require('clojure.string');
goog.require('lt.objs.command');
goog.require('clojure.string');
goog.require('lt.objs.editor');
goog.require('lt.object');
goog.require('lt.object');
goog.require('lt.objs.editor');
goog.require('lt.objs.command');
lt.objs.langs.behaviors.flat_parser = lt.objs.thread.thread_STAR_.call(null,(function tfun12729(){var orig__3398__auto__ = argsArray(arguments);var msg__3399__auto__ = orig__3398__auto__.shift();var args__3400__auto__ = orig__3398__auto__.map(cljs.reader.read_string);var raise = ((function (orig__3398__auto__,msg__3399__auto__,args__3400__auto__){
return (function (obj__3401__auto__,k__3402__auto__,v__3403__auto__){return _send(obj__3401__auto__,k__3402__auto__,cljs.core.pr_str.call(null,v__3403__auto__),"clj");
});})(orig__3398__auto__,msg__3399__auto__,args__3400__auto__))
;args__3400__auto__.unshift(msg__3399__auto__.obj);
return (function (obj_id,contents){var StringStream = require([cljs.core.str(ltpath),cljs.core.str("/core/node_modules/codemirror/addon/runmode/runmode.node.js")].join('')).StringStream;var parser = require([cljs.core.str(ltpath),cljs.core.str("/core/node_modules/lighttable/background/behaviorsParser.js")].join('')).parseFlat;var parsed = parser.call(null,(new StringStream(contents)));return _send(obj_id,new cljs.core.Keyword(null,"parsed","parsed",4313460611),parsed);
}).apply(null,args__3400__auto__);
}));
lt.objs.langs.behaviors.str__GT_ns_keyword = (function str__GT_ns_keyword(s){if(cljs.core.truth_(s))
{var s__$1 = ((cljs.core._EQ_.call(null,":",cljs.core.first.call(null,s)))?cljs.core.subs.call(null,s,1):s);var parts = clojure.string.split.call(null,s__$1,"/");if(cljs.core.seq.call(null,parts))
{return cljs.core.apply.call(null,cljs.core.keyword,parts);
} else
{return null;
}
} else
{return null;
}
});
lt.objs.langs.behaviors.__GT_index = (function __GT_index(this$){return lt.objs.editor.pos__GT_index.call(null,this$,lt.objs.editor.cursor.call(null,this$));
});
lt.objs.langs.behaviors.idx__GT_item = (function idx__GT_item(idx,items){return cljs.core.first.call(null,cljs.core.filter.call(null,(function (p1__12730_SHARP_){return (((new cljs.core.Keyword(null,"end","end",1014004813).cljs$core$IFn$_invoke$arity$1(cljs.core.second.call(null,p1__12730_SHARP_)) + 1) > idx)) && ((idx > (new cljs.core.Keyword(null,"start","start",1123661780).cljs$core$IFn$_invoke$arity$1(cljs.core.second.call(null,p1__12730_SHARP_)) - 1)));
}),cljs.core.map_indexed.call(null,cljs.core.vector,items)));
});
lt.objs.langs.behaviors.idx__GT_entry_info = (function idx__GT_entry_info(idx,entries){var vec__12734 = lt.objs.langs.behaviors.idx__GT_item.call(null,idx,entries);var ix = cljs.core.nth.call(null,vec__12734,0,null);var entry = cljs.core.nth.call(null,vec__12734,1,null);var vec__12735 = lt.objs.langs.behaviors.idx__GT_item.call(null,idx,new cljs.core.Keyword(null,"tokens","tokens",4440684812).cljs$core$IFn$_invoke$arity$1(entry));var tokenIx = cljs.core.nth.call(null,vec__12735,0,null);var token = cljs.core.nth.call(null,vec__12735,1,null);var vec__12736 = new cljs.core.Keyword(null,"tokens","tokens",4440684812).cljs$core$IFn$_invoke$arity$1(entry);var tag = cljs.core.nth.call(null,vec__12736,0,null);var behavior = cljs.core.nth.call(null,vec__12736,1,null);var args = cljs.core.nthnext.call(null,vec__12736,2);var tag__$1 = (cljs.core.truth_(tag)?lt.objs.langs.behaviors.str__GT_ns_keyword.call(null,new cljs.core.Keyword(null,"value","value",1125876963).cljs$core$IFn$_invoke$arity$1(tag)):null);var behavior__$1 = (cljs.core.truth_(behavior)?lt.objs.langs.behaviors.str__GT_ns_keyword.call(null,new cljs.core.Keyword(null,"value","value",1125876963).cljs$core$IFn$_invoke$arity$1(behavior)):null);var past_last_token = (idx > (new cljs.core.Keyword(null,"end","end",1014004813).cljs$core$IFn$_invoke$arity$1(cljs.core.last.call(null,new cljs.core.Keyword(null,"tokens","tokens",4440684812).cljs$core$IFn$_invoke$arity$1(entry))) + 1));var pos = (((cljs.core.not.call(null,tokenIx)) && (past_last_token))?cljs.core.count.call(null,new cljs.core.Keyword(null,"tokens","tokens",4440684812).cljs$core$IFn$_invoke$arity$1(entry)):((cljs.core.not.call(null,tokenIx))?(cljs.core.count.call(null,new cljs.core.Keyword(null,"tokens","tokens",4440684812).cljs$core$IFn$_invoke$arity$1(entry)) - 1):((new cljs.core.Keyword(null,"else","else",1017020587))?tokenIx:null)));var param_pos = (((pos > 1))?(pos - 2):null);return new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"tag","tag",1014018828),tag__$1,new cljs.core.Keyword(null,"behavior","behavior",2524816836),behavior__$1,new cljs.core.Keyword(null,"param-pos","param-pos",2966692998),param_pos,new cljs.core.Keyword(null,"pos","pos",1014015430),pos], null);
});
lt.objs.langs.behaviors.user_behavior_completions = (function user_behavior_completions(token,_,___$1){if(cljs.core.truth_((function (){var and__3508__auto__ = token;if(cljs.core.truth_(and__3508__auto__))
{return cljs.core._EQ_.call(null,cljs.core.subs.call(null,token,0,1),":");
} else
{return and__3508__auto__;
}
})()))
{return cljs.core.map.call(null,(function (p1__12737_SHARP_){return {"completion": [cljs.core.str(new cljs.core.Keyword(null,"name","name",1017277949).cljs$core$IFn$_invoke$arity$1(p1__12737_SHARP_))].join(''), "text": [cljs.core.str(new cljs.core.Keyword(null,"name","name",1017277949).cljs$core$IFn$_invoke$arity$1(p1__12737_SHARP_))].join('')};
}),cljs.core.vals.call(null,cljs.core.deref.call(null,lt.object.behaviors)));
} else
{return cljs.core.map.call(null,(function (p1__12738_SHARP_){if(cljs.core.not.call(null,new cljs.core.Keyword(null,"desc","desc",1016984067).cljs$core$IFn$_invoke$arity$1(p1__12738_SHARP_)))
{return {"completion": [cljs.core.str(new cljs.core.Keyword(null,"name","name",1017277949).cljs$core$IFn$_invoke$arity$1(p1__12738_SHARP_))].join(''), "text": [cljs.core.str(new cljs.core.Keyword(null,"name","name",1017277949).cljs$core$IFn$_invoke$arity$1(p1__12738_SHARP_))].join('')};
} else
{return {"completion": [cljs.core.str(new cljs.core.Keyword(null,"name","name",1017277949).cljs$core$IFn$_invoke$arity$1(p1__12738_SHARP_))].join(''), "text": new cljs.core.Keyword(null,"desc","desc",1016984067).cljs$core$IFn$_invoke$arity$1(p1__12738_SHARP_)};
}
}),cljs.core.filter.call(null,(function (p1__12739_SHARP_){return cljs.core._EQ_.call(null,new cljs.core.Keyword(null,"type","type",1017479852).cljs$core$IFn$_invoke$arity$1(p1__12739_SHARP_),new cljs.core.Keyword(null,"user","user",1017503549));
}),cljs.core.vals.call(null,cljs.core.deref.call(null,lt.object.behaviors))));
}
});
lt.objs.langs.behaviors.completions = new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"tag","tag",1014018828),(function (){return cljs.core.map.call(null,(function (p1__12740_SHARP_){return {"completion": [cljs.core.str(p1__12740_SHARP_)].join(''), "text": [cljs.core.str(p1__12740_SHARP_)].join('')};
}),cljs.core.keys.call(null,cljs.core.deref.call(null,lt.object.tags)));
}),new cljs.core.Keyword(null,"behavior","behavior",2524816836),lt.objs.langs.behaviors.user_behavior_completions,new cljs.core.Keyword(null,"behavior-param","behavior-param",2920369348),(function (token,beh,param_pos){var params = new cljs.core.Keyword(null,"params","params",4313443576).cljs$core$IFn$_invoke$arity$1(beh);var param = cljs.core.get.call(null,params,param_pos);if(cljs.core._EQ_.call(null,new cljs.core.Keyword(null,"type","type",1017479852).cljs$core$IFn$_invoke$arity$1(param),new cljs.core.Keyword(null,"list","list",1017226256)))
{if(cljs.core.fn_QMARK_.call(null,new cljs.core.Keyword(null,"items","items",1114430258).cljs$core$IFn$_invoke$arity$1(param)))
{return new cljs.core.Keyword(null,"items","items",1114430258).cljs$core$IFn$_invoke$arity$1(param).call(null);
} else
{return new cljs.core.Keyword(null,"items","items",1114430258).cljs$core$IFn$_invoke$arity$1(param);
}
} else
{return null;
}
})], null);
lt.objs.langs.behaviors.pos__GT_token_type = (function pos__GT_token_type(pos){var pred__12744 = cljs.core._EQ_;var expr__12745 = pos;if(cljs.core.truth_(pred__12744.call(null,0,expr__12745)))
{return new cljs.core.Keyword(null,"tag","tag",1014018828);
} else
{if(cljs.core.truth_(pred__12744.call(null,1,expr__12745)))
{return new cljs.core.Keyword(null,"behavior","behavior",2524816836);
} else
{return new cljs.core.Keyword(null,"behavior-param","behavior-param",2920369348);
}
}
});
lt.objs.langs.behaviors.__BEH__behavior_hints = (function __BEH__behavior_hints(this$,hints,token){var idx = lt.objs.langs.behaviors.__GT_index.call(null,this$);var map__12748 = lt.objs.langs.behaviors.idx__GT_entry_info.call(null,idx,new cljs.core.Keyword(null,"entries","entries",3717298178).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)));var map__12748__$1 = ((cljs.core.seq_QMARK_.call(null,map__12748))?cljs.core.apply.call(null,cljs.core.hash_map,map__12748):map__12748);var info = map__12748__$1;var pos = cljs.core.get.call(null,map__12748__$1,new cljs.core.Keyword(null,"pos","pos",1014015430));var param_pos = cljs.core.get.call(null,map__12748__$1,new cljs.core.Keyword(null,"param-pos","param-pos",2966692998));var behavior = cljs.core.get.call(null,map__12748__$1,new cljs.core.Keyword(null,"behavior","behavior",2524816836));var tag = cljs.core.get.call(null,map__12748__$1,new cljs.core.Keyword(null,"tag","tag",1014018828));var behavior_info = cljs.core.deref.call(null,lt.object.behaviors).call(null,behavior);var token_type = lt.objs.langs.behaviors.pos__GT_token_type.call(null,pos);var completions_set = lt.objs.langs.behaviors.completions.call(null,token_type);return completions_set.call(null,token,behavior_info,param_pos,token);
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.langs.behaviors","behavior-hints","lt.objs.langs.behaviors/behavior-hints",2823940026),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.langs.behaviors.__BEH__behavior_hints,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"hints+","hints+",4091697745),null], null), null),new cljs.core.Keyword(null,"exclusive","exclusive",2700522000),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword("lt.plugins.auto-complete","textual-hints","lt.plugins.auto-complete/textual-hints",1172342809)], null));
lt.objs.langs.behaviors.__BEH__show_info_on_move = (function __BEH__show_info_on_move(this$){var idx = lt.objs.langs.behaviors.__GT_index.call(null,this$);var map__12750 = lt.objs.langs.behaviors.idx__GT_entry_info.call(null,idx,new cljs.core.Keyword(null,"entries","entries",3717298178).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)));var map__12750__$1 = ((cljs.core.seq_QMARK_.call(null,map__12750))?cljs.core.apply.call(null,cljs.core.hash_map,map__12750):map__12750);var info = map__12750__$1;var param_pos = cljs.core.get.call(null,map__12750__$1,new cljs.core.Keyword(null,"param-pos","param-pos",2966692998));var behavior = cljs.core.get.call(null,map__12750__$1,new cljs.core.Keyword(null,"behavior","behavior",2524816836));var tag = cljs.core.get.call(null,map__12750__$1,new cljs.core.Keyword(null,"tag","tag",1014018828));var behavior_info = cljs.core.deref.call(null,lt.object.behaviors).call(null,behavior);if(cljs.core.truth_(new cljs.core.Keyword(null,"desc","desc",1016984067).cljs$core$IFn$_invoke$arity$1(behavior_info)))
{return lt.object.raise.call(null,lt.objs.langs.behaviors.helper,new cljs.core.Keyword(null,"show!","show!",1123317814),this$,behavior_info,param_pos);
} else
{return lt.object.raise.call(null,lt.objs.langs.behaviors.helper,new cljs.core.Keyword(null,"clear!","clear!",3951036134));
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.langs.behaviors","show-info-on-move","lt.objs.langs.behaviors/show-info-on-move",2847824345),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.langs.behaviors.__BEH__show_info_on_move,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"move","move",1017261891),null], null), null),new cljs.core.Keyword(null,"debounce","debounce",1556599227),200);
lt.objs.langs.behaviors.__BEH__behavior_hint_pattern = (function __BEH__behavior_hint_pattern(this$){return lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"hint-pattern","hint-pattern",2825267644),/[\w\-\>\:\*\$\?\<\!\+\.\"\\/]/], null));
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.langs.behaviors","behavior-hint-pattern","lt.objs.langs.behaviors/behavior-hint-pattern",4504292902),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.langs.behaviors.__BEH__behavior_hint_pattern,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"object.instant","object.instant",773332388),null], null), null));
lt.objs.langs.behaviors.__BEH__on_changed = (function __BEH__on_changed(this$){return lt.objs.langs.behaviors.flat_parser.call(null,this$,lt.objs.editor.__GT_val.call(null,this$));
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.langs.behaviors","on-changed","lt.objs.langs.behaviors/on-changed",1403950855),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.langs.behaviors.__BEH__on_changed,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"change","change",3947235106),null,new cljs.core.Keyword(null,"create","create",3956577390),null], null), null),new cljs.core.Keyword(null,"debounce","debounce",1556599227),100);
lt.objs.langs.behaviors.__BEH__parsed = (function __BEH__parsed(this$,results){lt.object.merge_BANG_.call(null,this$,cljs.core.js__GT_clj.call(null,results,new cljs.core.Keyword(null,"keywordize-keys","keywordize-keys",4191781672),true));
return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"move","move",1017261891));
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.langs.behaviors","parsed","lt.objs.langs.behaviors/parsed",4692889658),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.langs.behaviors.__BEH__parsed,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"parsed","parsed",4313460611),null], null), null));
lt.objs.langs.behaviors.inline = (function inline(this$,ed,opts){return lt.object.create.call(null,new cljs.core.Keyword("lt.objs.eval","inline-result","lt.objs.eval/inline-result",1807255869),new cljs.core.PersistentArrayMap(null, 7, [new cljs.core.Keyword(null,"ed","ed",1013907473),ed,new cljs.core.Keyword(null,"class","class",1108647146),"behavior-helper",new cljs.core.Keyword(null,"opts","opts",1017322386),opts,new cljs.core.Keyword(null,"result","result",4374444943),lt.object.__GT_content.call(null,this$),new cljs.core.Keyword(null,"above","above",1106515727),cljs.core.boolean$.call(null,(new cljs.core.Keyword(null,"prev-line","prev-line",4421028544).cljs$core$IFn$_invoke$arity$1(opts) < new cljs.core.Keyword(null,"line","line",1017226086).cljs$core$IFn$_invoke$arity$1(opts))),new cljs.core.Keyword(null,"loc","loc",1014011570),opts,new cljs.core.Keyword(null,"line","line",1017226086),lt.objs.editor.line_handle.call(null,ed,new cljs.core.Keyword(null,"line","line",1017226086).cljs$core$IFn$_invoke$arity$1(opts))], null));
});
lt.objs.langs.behaviors.__GT_helper = (function __GT_helper(beh){var e__3325__auto__ = crate.core.html.call(null,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div","div",1014003715),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"h2","h2",1013907516),new cljs.core.Keyword(null,"desc","desc",1016984067).cljs$core$IFn$_invoke$arity$2(beh,new cljs.core.Keyword(null,"name","name",1017277949).cljs$core$IFn$_invoke$arity$1(beh))], null),(cljs.core.truth_(new cljs.core.Keyword(null,"params","params",4313443576).cljs$core$IFn$_invoke$arity$1(beh))?new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div","div",1014003715),(function (){var iter__4231__auto__ = (function iter__12761(s__12762){return (new cljs.core.LazySeq(null,(function (){var s__12762__$1 = s__12762;while(true){
var temp__4092__auto__ = cljs.core.seq.call(null,s__12762__$1);if(temp__4092__auto__)
{var s__12762__$2 = temp__4092__auto__;if(cljs.core.chunked_seq_QMARK_.call(null,s__12762__$2))
{var c__4229__auto__ = cljs.core.chunk_first.call(null,s__12762__$2);var size__4230__auto__ = cljs.core.count.call(null,c__4229__auto__);var b__12764 = cljs.core.chunk_buffer.call(null,size__4230__auto__);if((function (){var i__12763 = 0;while(true){
if((i__12763 < size__4230__auto__))
{var p = cljs.core._nth.call(null,c__4229__auto__,i__12763);cljs.core.chunk_append.call(null,b__12764,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"span.param","span.param",1131663451),new cljs.core.Keyword(null,"label","label",1116631654).cljs$core$IFn$_invoke$arity$1(p),(cljs.core.truth_(new cljs.core.Keyword(null,"example","example",3985900764).cljs$core$IFn$_invoke$arity$1(p))?cljs.core._conj.call(null,cljs.core._conj.call(null,cljs.core.List.EMPTY,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"pre.example","pre.example",4358698129),new cljs.core.Keyword(null,"example","example",3985900764).cljs$core$IFn$_invoke$arity$1(p)], null))," =>"):null)], null));
{
var G__12771 = (i__12763 + 1);
i__12763 = G__12771;
continue;
}
} else
{return true;
}
break;
}
})())
{return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__12764),iter__12761.call(null,cljs.core.chunk_rest.call(null,s__12762__$2)));
} else
{return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__12764),null);
}
} else
{var p = cljs.core.first.call(null,s__12762__$2);return cljs.core.cons.call(null,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"span.param","span.param",1131663451),new cljs.core.Keyword(null,"label","label",1116631654).cljs$core$IFn$_invoke$arity$1(p),(cljs.core.truth_(new cljs.core.Keyword(null,"example","example",3985900764).cljs$core$IFn$_invoke$arity$1(p))?cljs.core._conj.call(null,cljs.core._conj.call(null,cljs.core.List.EMPTY,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"pre.example","pre.example",4358698129),new cljs.core.Keyword(null,"example","example",3985900764).cljs$core$IFn$_invoke$arity$1(p)], null))," =>"):null)], null),iter__12761.call(null,cljs.core.rest.call(null,s__12762__$2)));
}
} else
{return null;
}
break;
}
}),null,null));
});return iter__4231__auto__.call(null,new cljs.core.Keyword(null,"params","params",4313443576).cljs$core$IFn$_invoke$arity$1(beh));
})()], null):null)], null));var seq__12765_12772 = cljs.core.seq.call(null,cljs.core.partition.call(null,2,cljs.core.PersistentVector.EMPTY));var chunk__12766_12773 = null;var count__12767_12774 = 0;var i__12768_12775 = 0;while(true){
if((i__12768_12775 < count__12767_12774))
{var vec__12769_12776 = cljs.core._nth.call(null,chunk__12766_12773,i__12768_12775);var ev__3326__auto___12777 = cljs.core.nth.call(null,vec__12769_12776,0,null);var func__3327__auto___12778 = cljs.core.nth.call(null,vec__12769_12776,1,null);lt.util.dom.on.call(null,e__3325__auto__,ev__3326__auto___12777,func__3327__auto___12778);
{
var G__12779 = seq__12765_12772;
var G__12780 = chunk__12766_12773;
var G__12781 = count__12767_12774;
var G__12782 = (i__12768_12775 + 1);
seq__12765_12772 = G__12779;
chunk__12766_12773 = G__12780;
count__12767_12774 = G__12781;
i__12768_12775 = G__12782;
continue;
}
} else
{var temp__4092__auto___12783 = cljs.core.seq.call(null,seq__12765_12772);if(temp__4092__auto___12783)
{var seq__12765_12784__$1 = temp__4092__auto___12783;if(cljs.core.chunked_seq_QMARK_.call(null,seq__12765_12784__$1))
{var c__4262__auto___12785 = cljs.core.chunk_first.call(null,seq__12765_12784__$1);{
var G__12786 = cljs.core.chunk_rest.call(null,seq__12765_12784__$1);
var G__12787 = c__4262__auto___12785;
var G__12788 = cljs.core.count.call(null,c__4262__auto___12785);
var G__12789 = 0;
seq__12765_12772 = G__12786;
chunk__12766_12773 = G__12787;
count__12767_12774 = G__12788;
i__12768_12775 = G__12789;
continue;
}
} else
{var vec__12770_12790 = cljs.core.first.call(null,seq__12765_12784__$1);var ev__3326__auto___12791 = cljs.core.nth.call(null,vec__12770_12790,0,null);var func__3327__auto___12792 = cljs.core.nth.call(null,vec__12770_12790,1,null);lt.util.dom.on.call(null,e__3325__auto__,ev__3326__auto___12791,func__3327__auto___12792);
{
var G__12793 = cljs.core.next.call(null,seq__12765_12784__$1);
var G__12794 = null;
var G__12795 = 0;
var G__12796 = 0;
seq__12765_12772 = G__12793;
chunk__12766_12773 = G__12794;
count__12767_12774 = G__12795;
i__12768_12775 = G__12796;
continue;
}
}
} else
{}
}
break;
}
return e__3325__auto__;
});
lt.objs.langs.behaviors.set_param = (function set_param(this$,idx){var lis = lt.util.dom.$$.call(null,"span.param",lt.object.__GT_content.call(null,this$));var seq__12801_12805 = cljs.core.seq.call(null,lis);var chunk__12802_12806 = null;var count__12803_12807 = 0;var i__12804_12808 = 0;while(true){
if((i__12804_12808 < count__12803_12807))
{var li_12809 = cljs.core._nth.call(null,chunk__12802_12806,i__12804_12808);lt.util.dom.remove_class.call(null,li_12809,new cljs.core.Keyword(null,"active","active",3885920888));
{
var G__12810 = seq__12801_12805;
var G__12811 = chunk__12802_12806;
var G__12812 = count__12803_12807;
var G__12813 = (i__12804_12808 + 1);
seq__12801_12805 = G__12810;
chunk__12802_12806 = G__12811;
count__12803_12807 = G__12812;
i__12804_12808 = G__12813;
continue;
}
} else
{var temp__4092__auto___12814 = cljs.core.seq.call(null,seq__12801_12805);if(temp__4092__auto___12814)
{var seq__12801_12815__$1 = temp__4092__auto___12814;if(cljs.core.chunked_seq_QMARK_.call(null,seq__12801_12815__$1))
{var c__4262__auto___12816 = cljs.core.chunk_first.call(null,seq__12801_12815__$1);{
var G__12817 = cljs.core.chunk_rest.call(null,seq__12801_12815__$1);
var G__12818 = c__4262__auto___12816;
var G__12819 = cljs.core.count.call(null,c__4262__auto___12816);
var G__12820 = 0;
seq__12801_12805 = G__12817;
chunk__12802_12806 = G__12818;
count__12803_12807 = G__12819;
i__12804_12808 = G__12820;
continue;
}
} else
{var li_12821 = cljs.core.first.call(null,seq__12801_12815__$1);lt.util.dom.remove_class.call(null,li_12821,new cljs.core.Keyword(null,"active","active",3885920888));
{
var G__12822 = cljs.core.next.call(null,seq__12801_12815__$1);
var G__12823 = null;
var G__12824 = 0;
var G__12825 = 0;
seq__12801_12805 = G__12822;
chunk__12802_12806 = G__12823;
count__12803_12807 = G__12824;
i__12804_12808 = G__12825;
continue;
}
}
} else
{}
}
break;
}
if(cljs.core.truth_(idx))
{return lt.util.dom.add_class.call(null,(lis[idx]),new cljs.core.Keyword(null,"active","active",3885920888));
} else
{return null;
}
});
lt.object.object_STAR_.call(null,new cljs.core.Keyword("lt.objs.langs.behaviors","helper","lt.objs.langs.behaviors/helper",3930620895),new cljs.core.Keyword(null,"tags","tags",1017456523),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"editor.behaviors.helper","editor.behaviors.helper",3298048942),null], null), null));
lt.objs.langs.behaviors.__BEH__helper__DOT__clear_BANG_ = (function __BEH__helper__DOT__clear_BANG_(this$){if(cljs.core.truth_(new cljs.core.Keyword(null,"mark","mark",1017248319).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$))))
{if(cljs.core.truth_((function (){var and__3508__auto__ = new cljs.core.Keyword(null,"ed","ed",1013907473).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$));if(cljs.core.truth_(and__3508__auto__))
{return cljs.core.deref.call(null,new cljs.core.Keyword(null,"ed","ed",1013907473).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)));
} else
{return and__3508__auto__;
}
})()))
{lt.objs.editor._line_class.call(null,new cljs.core.Keyword(null,"ed","ed",1013907473).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)),new cljs.core.Keyword(null,"line","line",1017226086).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)),new cljs.core.Keyword(null,"text","text",1017460895),"behavior-helper-line");
} else
{}
lt.object.raise.call(null,new cljs.core.Keyword(null,"mark","mark",1017248319).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)),new cljs.core.Keyword(null,"clear!","clear!",3951036134));
} else
{}
lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"content","content",1965434859),null], null));
return lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"mark","mark",1017248319),null,new cljs.core.Keyword(null,"behavior","behavior",2524816836),null,new cljs.core.Keyword(null,"line","line",1017226086),null,new cljs.core.Keyword(null,"ed","ed",1013907473),null], null));
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.langs.behaviors","helper.clear!","lt.objs.langs.behaviors/helper.clear!",3552557557),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.langs.behaviors.__BEH__helper__DOT__clear_BANG_,new cljs.core.Keyword(null,"desc","desc",1016984067),"Behaviors.helper: clear",new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"clear!","clear!",3951036134),null], null), null));
lt.objs.langs.behaviors.__BEH__helper__DOT__show_BANG_ = (function __BEH__helper__DOT__show_BANG_(this$,ed,beh,param_idx){var loc = lt.objs.editor.__GT_cursor.call(null,ed);if((cljs.core.not_EQ_.call(null,beh,new cljs.core.Keyword(null,"behavior","behavior",2524816836).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)))) || (cljs.core.not_EQ_.call(null,ed,new cljs.core.Keyword(null,"ed","ed",1013907473).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)))))
{if(cljs.core.truth_(new cljs.core.Keyword(null,"mark","mark",1017248319).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$))))
{lt.objs.editor._line_class.call(null,ed,new cljs.core.Keyword(null,"line","line",1017226086).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)),new cljs.core.Keyword(null,"text","text",1017460895),"behavior-helper-line");
lt.object.raise.call(null,new cljs.core.Keyword(null,"mark","mark",1017248319).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)),new cljs.core.Keyword(null,"clear!","clear!",3951036134));
} else
{}
lt.objs.editor._PLUS_line_class.call(null,ed,new cljs.core.Keyword(null,"line","line",1017226086).cljs$core$IFn$_invoke$arity$1(loc),new cljs.core.Keyword(null,"text","text",1017460895),"behavior-helper-line");
lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"content","content",1965434859),lt.objs.langs.behaviors.__GT_helper.call(null,beh)], null));
lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"mark","mark",1017248319),lt.objs.langs.behaviors.inline.call(null,this$,ed,cljs.core.assoc.call(null,loc,new cljs.core.Keyword(null,"prev-line","prev-line",4421028544),new cljs.core.Keyword(null,"line","line",1017226086).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)))),new cljs.core.Keyword(null,"behavior","behavior",2524816836),beh,new cljs.core.Keyword(null,"line","line",1017226086),new cljs.core.Keyword(null,"line","line",1017226086).cljs$core$IFn$_invoke$arity$1(loc),new cljs.core.Keyword(null,"ed","ed",1013907473),ed], null));
} else
{}
return lt.objs.langs.behaviors.set_param.call(null,this$,param_idx);
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.langs.behaviors","helper.show!","lt.objs.langs.behaviors/helper.show!",4057136325),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.langs.behaviors.__BEH__helper__DOT__show_BANG_,new cljs.core.Keyword(null,"desc","desc",1016984067),"Behaviors.helper: show",new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"show!","show!",1123317814),null], null), null));
lt.objs.langs.behaviors.helper = lt.object.create.call(null,new cljs.core.Keyword("lt.objs.langs.behaviors","helper","lt.objs.langs.behaviors/helper",3930620895));
