// Compiled by ClojureScript 0.0-2138
goog.provide('lt.plugins.auto_complete');
goog.require('cljs.core');
goog.require('lt.util.js');
goog.require('lt.objs.thread');
goog.require('lt.objs.sidebar.command');
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('lt.objs.editor.pool');
goog.require('clojure.string');
goog.require('lt.objs.command');
goog.require('lt.objs.thread');
goog.require('lt.util.load');
goog.require('clojure.string');
goog.require('lt.objs.sidebar.command');
goog.require('lt.objs.keyboard');
goog.require('lt.objs.editor');
goog.require('lt.object');
goog.require('lt.object');
goog.require('lt.util.load');
goog.require('lt.objs.editor');
goog.require('lt.objs.editor.pool');
goog.require('lt.objs.command');
goog.require('lt.objs.keyboard');
lt.plugins.auto_complete.stream = (function stream(str){return (new CodeMirror.StringStream(str));
});
lt.plugins.auto_complete.advance = (function advance(s){return s.start = s.pos;
});
lt.plugins.auto_complete.next_STAR_ = (function next_STAR_(s){return s.next();
});
lt.plugins.auto_complete.current = (function current(s){return s.current();
});
lt.plugins.auto_complete.peek_STAR_ = (function peek_STAR_(s){return s.peek();
});
lt.plugins.auto_complete.skip_space = (function skip_space(s){if(cljs.core.truth_((function (){var and__3508__auto__ = lt.plugins.auto_complete.peek_STAR_.call(null,s);if(cljs.core.truth_(and__3508__auto__))
{return cljs.core.re_seq.call(null,/\s/,lt.plugins.auto_complete.peek_STAR_.call(null,s));
} else
{return and__3508__auto__;
}
})()))
{s.eatSpace();
return lt.plugins.auto_complete.advance.call(null,s);
} else
{return null;
}
});
lt.plugins.auto_complete.eat_while = (function eat_while(s,r){return s.eatWhile(r);
});
lt.plugins.auto_complete.string__GT_tokens = (function string__GT_tokens(str,pattern){var s = lt.plugins.auto_complete.stream.call(null,str);var res = (function (){var obj14126 = {};return obj14126;
})();lt.plugins.auto_complete.skip_space.call(null,s);
while(true){
if(cljs.core.truth_(lt.plugins.auto_complete.peek_STAR_.call(null,s)))
{lt.plugins.auto_complete.eat_while.call(null,s,pattern);
if(!(cljs.core.empty_QMARK_.call(null,lt.plugins.auto_complete.current.call(null,s))))
{(res[lt.plugins.auto_complete.current.call(null,s)] = true);
lt.plugins.auto_complete.advance.call(null,s);
} else
{lt.plugins.auto_complete.next_STAR_.call(null,s);
lt.plugins.auto_complete.advance.call(null,s);
}
lt.plugins.auto_complete.skip_space.call(null,s);
{
continue;
}
} else
{}
break;
}
return cljs.core.into_array.call(null,cljs.core.map.call(null,(function (p1__14122_SHARP_){return {"completion": p1__14122_SHARP_};
}),Object.keys(res)));
});
lt.plugins.auto_complete.default_pattern = /[\w_$]/;
lt.plugins.auto_complete.get_pattern = (function get_pattern(ed){var mode = lt.objs.editor.inner_mode.call(null,ed);var or__3520__auto__ = new cljs.core.Keyword(null,"hint-pattern","hint-pattern",2825267644).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,ed));if(cljs.core.truth_(or__3520__auto__))
{return or__3520__auto__;
} else
{var or__3520__auto____$1 = (mode["hint-pattern"]);if(cljs.core.truth_(or__3520__auto____$1))
{return or__3520__auto____$1;
} else
{return lt.plugins.auto_complete.default_pattern;
}
}
});
lt.plugins.auto_complete.get_token = (function get_token(ed,pos){var line = lt.objs.editor.line.call(null,ed,new cljs.core.Keyword(null,"line","line",1017226086).cljs$core$IFn$_invoke$arity$1(pos));var pattern = lt.plugins.auto_complete.get_pattern.call(null,ed);var s = lt.plugins.auto_complete.stream.call(null,line);var ch = new cljs.core.Keyword(null,"ch","ch",1013907415).cljs$core$IFn$_invoke$arity$1(pos);lt.plugins.auto_complete.skip_space.call(null,s);
while(true){
lt.plugins.auto_complete.eat_while.call(null,s,pattern);
if((!(cljs.core.empty_QMARK_.call(null,lt.plugins.auto_complete.current.call(null,s)))) && ((s.start <= ch)) && ((s.pos >= ch)))
{return new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"start","start",1123661780),s.start,new cljs.core.Keyword(null,"end","end",1014004813),s.pos,new cljs.core.Keyword(null,"line","line",1017226086),new cljs.core.Keyword(null,"line","line",1017226086).cljs$core$IFn$_invoke$arity$1(pos),new cljs.core.Keyword(null,"string","string",4416885635),lt.plugins.auto_complete.current.call(null,s)], null);
} else
{if(cljs.core.not.call(null,lt.plugins.auto_complete.peek_STAR_.call(null,s)))
{return new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"line","line",1017226086),new cljs.core.Keyword(null,"line","line",1017226086).cljs$core$IFn$_invoke$arity$1(pos),new cljs.core.Keyword(null,"start","start",1123661780),new cljs.core.Keyword(null,"ch","ch",1013907415).cljs$core$IFn$_invoke$arity$1(pos),new cljs.core.Keyword(null,"end","end",1014004813),new cljs.core.Keyword(null,"ch","ch",1013907415).cljs$core$IFn$_invoke$arity$1(pos)], null);
} else
{lt.plugins.auto_complete.next_STAR_.call(null,s);
lt.plugins.auto_complete.advance.call(null,s);
lt.plugins.auto_complete.skip_space.call(null,s);
{
continue;
}
}
}
break;
}
});
lt.plugins.auto_complete.non_token_change_QMARK_ = (function non_token_change_QMARK_(ed,ch){var pattern = lt.plugins.auto_complete.get_pattern.call(null,ed);var text = cljs.core.map.call(null,cljs.core.str,ch.text);var pred__14131 = cljs.core._EQ_;var expr__14132 = ch.origin;if(cljs.core.truth_(pred__14131.call(null,"+input",expr__14132)))
{return cljs.core.some.call(null,(function (p1__14127_SHARP_){return cljs.core.not.call(null,cljs.core.re_seq.call(null,pattern,p1__14127_SHARP_));
}),text);
} else
{if(cljs.core.truth_(pred__14131.call(null,"paste",expr__14132)))
{return true;
} else
{return false;
}
}
});
lt.plugins.auto_complete.w = lt.objs.thread.thread_STAR_.call(null,(function tfun14135(){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,m){var StringStream = require([cljs.core.str(ltpath),cljs.core.str("/core/node_modules/codemirror/addon/runmode/runmode.node.js")].join('')).StringStream;var stream = ((function (StringStream){
return (function (s){return (new StringStream(s));
});})(StringStream))
;var advance = ((function (StringStream,stream){
return (function (s){return s.start = s.pos;
});})(StringStream,stream))
;var next_STAR_ = ((function (StringStream,stream,advance){
return (function (s){return s.next();
});})(StringStream,stream,advance))
;var peek_STAR_ = ((function (StringStream,stream,advance,next_STAR_){
return (function (s){return s.peek();
});})(StringStream,stream,advance,next_STAR_))
;var current = ((function (StringStream,stream,advance,next_STAR_,peek_STAR_){
return (function (s){return s.current();
});})(StringStream,stream,advance,next_STAR_,peek_STAR_))
;var skip_space = ((function (StringStream,stream,advance,next_STAR_,peek_STAR_,current){
return (function (s){if(cljs.core.truth_((function (){var and__3508__auto__ = peek_STAR_.call(null,s);if(cljs.core.truth_(and__3508__auto__))
{return cljs.core.re_seq.call(null,/\s/,peek_STAR_.call(null,s));
} else
{return and__3508__auto__;
}
})()))
{s.eatSpace();
return advance.call(null,s);
} else
{return null;
}
});})(StringStream,stream,advance,next_STAR_,peek_STAR_,current))
;var eat_while = ((function (StringStream,stream,advance,next_STAR_,peek_STAR_,current,skip_space){
return (function (s,r){return s.eatWhile(r);
});})(StringStream,stream,advance,next_STAR_,peek_STAR_,current,skip_space))
;var string__GT_tokens = ((function (StringStream,stream,advance,next_STAR_,peek_STAR_,current,skip_space,eat_while){
return (function (str,pattern){var s = stream.call(null,str);var pattern__$1 = cljs.core.re_pattern.call(null,pattern);var res = (function (){var obj14139 = {};return obj14139;
})();skip_space.call(null,s);
while(true){
if(cljs.core.truth_(peek_STAR_.call(null,s)))
{eat_while.call(null,s,pattern__$1);
if(!(cljs.core.empty_QMARK_.call(null,current.call(null,s))))
{(res[current.call(null,s)] = true);
advance.call(null,s);
} else
{next_STAR_.call(null,s);
advance.call(null,s);
}
skip_space.call(null,s);
{
continue;
}
} else
{}
break;
}
return cljs.core.into_array.call(null,cljs.core.map.call(null,((function (s,pattern__$1,res,StringStream,stream,advance,next_STAR_,peek_STAR_,current,skip_space,eat_while){
return (function (p1__14134_SHARP_){return {"completion": p1__14134_SHARP_};
});})(s,pattern__$1,res,StringStream,stream,advance,next_STAR_,peek_STAR_,current,skip_space,eat_while))
,Object.keys(res)));
});})(StringStream,stream,advance,next_STAR_,peek_STAR_,current,skip_space,eat_while))
;return _send(obj_id,new cljs.core.Keyword(null,"hint-tokens","hint-tokens",3416256274),string__GT_tokens.call(null,new cljs.core.Keyword(null,"string","string",4416885635).cljs$core$IFn$_invoke$arity$1(m),new cljs.core.Keyword(null,"pattern","pattern",4517781250).cljs$core$IFn$_invoke$arity$1(m)));
}).apply(null,args__3400__auto__);
}));
lt.plugins.auto_complete.async_hints = (function async_hints(this$){if(cljs.core.truth_(cljs.core.deref.call(null,this$)))
{return lt.plugins.auto_complete.w.call(null,this$,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"string","string",4416885635),lt.objs.editor.__GT_val.call(null,this$),new cljs.core.Keyword(null,"pattern","pattern",4517781250),lt.plugins.auto_complete.get_pattern.call(null,this$).source], null));
} else
{return null;
}
});
lt.plugins.auto_complete.text_BAR_completion = (function text_BAR_completion(x){var or__3520__auto__ = x.text;if(cljs.core.truth_(or__3520__auto__))
{return or__3520__auto__;
} else
{return x.completion;
}
});
lt.plugins.auto_complete.text_PLUS_completion = (function text_PLUS_completion(x){return [cljs.core.str(x.text),cljs.core.str(x.completion)].join('');
});
lt.plugins.auto_complete.distinct_completions = (function distinct_completions(hints){var seen = {};return cljs.core.filter.call(null,(function (hint){if((seen[hint.completion]) === true)
{return false;
} else
{return (seen[hint.completion] = true);
}
}),hints);
});
lt.plugins.auto_complete.remove_long_completions = (function remove_long_completions(hints){return cljs.core.filter.call(null,(function (p1__14140_SHARP_){return (p1__14140_SHARP_.completion.length < new cljs.core.Keyword(null,"hint-limit","hint-limit",945287271).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.plugins.auto_complete.hinter)));
}),hints);
});
lt.plugins.auto_complete.hinter = lt.object.add_tags.call(null,lt.objs.sidebar.command.filter_list.call(null,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"items","items",1114430258),(function (){var temp__4092__auto__ = lt.objs.editor.pool.last_active.call(null);if(cljs.core.truth_(temp__4092__auto__))
{var cur = temp__4092__auto__;var token = new cljs.core.Keyword(null,"string","string",4416885635).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"starting-token","starting-token",3199431070).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.plugins.auto_complete.hinter)));return lt.plugins.auto_complete.distinct_completions.call(null,lt.plugins.auto_complete.remove_long_completions.call(null,(cljs.core.truth_(token)?cljs.core.remove.call(null,(function (p1__14141_SHARP_){return cljs.core._EQ_.call(null,token,p1__14141_SHARP_.completion);
}),lt.object.raise_reduce.call(null,cur,new cljs.core.Keyword(null,"hints+","hints+",4091697745),cljs.core.PersistentVector.EMPTY,token)):lt.object.raise_reduce.call(null,cur,new cljs.core.Keyword(null,"hints+","hints+",4091697745),cljs.core.PersistentVector.EMPTY))));
} else
{return null;
}
}),new cljs.core.Keyword(null,"key","key",1014010321),lt.plugins.auto_complete.text_BAR_completion], null)),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"hinter","hinter",4091697382)], null));
lt.plugins.auto_complete.on_line_change = (function on_line_change(line,ch){return lt.object.raise.call(null,lt.plugins.auto_complete.hinter,new cljs.core.Keyword(null,"line-change","line-change",3952584475),line,ch);
});
lt.plugins.auto_complete.__BEH__set_hint_limit = (function __BEH__set_hint_limit(this$,n){return lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"hint-limit","hint-limit",945287271),n], null));
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.plugins.auto-complete","set-hint-limit","lt.plugins.auto-complete/set-hint-limit",1014037643),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.plugins.auto_complete.__BEH__set_hint_limit,new cljs.core.Keyword(null,"desc","desc",1016984067),"Auto-complete: Set maximum length of an autocomplete hint",new cljs.core.Keyword(null,"params","params",4313443576),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"label","label",1116631654),"Number",new cljs.core.Keyword(null,"example","example",3985900764),1000], null)], null),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),new cljs.core.Keyword(null,"type","type",1017479852),new cljs.core.Keyword(null,"user","user",1017503549));
lt.plugins.auto_complete.__BEH__textual_hints = (function __BEH__textual_hints(this$,hints){return cljs.core.concat.call(null,new cljs.core.Keyword("lt.plugins.auto-complete","hints","lt.plugins.auto-complete/hints",3881612567).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)),hints);
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.plugins.auto-complete","textual-hints","lt.plugins.auto-complete/textual-hints",1172342809),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.plugins.auto_complete.__BEH__textual_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));
lt.plugins.auto_complete.__BEH__escape_BANG_ = (function __BEH__escape_BANG_(this$,force_QMARK_){var elem = lt.object.__GT_content.call(null,this$);if(cljs.core.truth_(new cljs.core.Keyword(null,"line","line",1017226086).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$))))
{CodeMirror.off(new cljs.core.Keyword(null,"line","line",1017226086).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)),"change",lt.plugins.auto_complete.on_line_change);
} else
{}
lt.objs.context.out_BANG_.call(null,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"editor.keys.hinting.active","editor.keys.hinting.active",2111066372)], null));
lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"active","active",3885920888),false,new cljs.core.Keyword(null,"selected","selected",2205476365),0,new cljs.core.Keyword(null,"ed","ed",1013907473),null,new cljs.core.Keyword(null,"starting-token","starting-token",3199431070),null,new cljs.core.Keyword(null,"token","token",1124445547),null,new cljs.core.Keyword(null,"search","search",4402534682),""], null));
lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"inactive","inactive",1038569437));
if(cljs.core.truth_(lt.util.dom.parent.call(null,elem)))
{return lt.util.dom.remove.call(null,elem);
} else
{return null;
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.plugins.auto-complete","escape!","lt.plugins.auto-complete/escape!",2293504011),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.plugins.auto_complete.__BEH__escape_BANG_,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"escape!","escape!",3844244274),null], null), null));
lt.plugins.auto_complete.__BEH__select = (function __BEH__select(this$,c){var token = new cljs.core.Keyword(null,"token","token",1124445547).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$));var start = new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"line","line",1017226086),new cljs.core.Keyword(null,"line","line",1017226086).cljs$core$IFn$_invoke$arity$1(token),new cljs.core.Keyword(null,"ch","ch",1013907415),new cljs.core.Keyword(null,"start","start",1123661780).cljs$core$IFn$_invoke$arity$1(token)], null);var end = new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"line","line",1017226086),new cljs.core.Keyword(null,"line","line",1017226086).cljs$core$IFn$_invoke$arity$1(token),new cljs.core.Keyword(null,"ch","ch",1013907415),new cljs.core.Keyword(null,"end","end",1014004813).cljs$core$IFn$_invoke$arity$1(token)], null);lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"active","active",3885920888),false], null));
if(cljs.core.truth_(c.select))
{c.select.call(null,cljs.core.partial.call(null,lt.objs.editor.replace,new cljs.core.Keyword(null,"ed","ed",1013907473).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)),start,end),c);
} else
{lt.objs.editor.replace.call(null,new cljs.core.Keyword(null,"ed","ed",1013907473).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)),start,end,c.completion);
}
return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"escape!","escape!",3844244274));
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.plugins.auto-complete","select","lt.plugins.auto-complete/select",3556785863),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.plugins.auto_complete.__BEH__select,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"select","select",4402849902),null], null), null));
lt.plugins.auto_complete.__BEH__select_unknown = (function __BEH__select_unknown(this$,v){lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"escape!","escape!",3844244274));
return lt.objs.keyboard.passthrough.call(null);
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.plugins.auto-complete","select-unknown","lt.plugins.auto-complete/select-unknown",1183091522),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.plugins.auto_complete.__BEH__select_unknown,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"select-unknown","select-unknown",2733767659),null], null), null));
lt.plugins.auto_complete.__BEH__line_change = (function __BEH__line_change(this$,l,c){if(cljs.core.truth_(new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.plugins.auto_complete.hinter))))
{var pos = lt.objs.editor.__GT_cursor.call(null,new cljs.core.Keyword(null,"ed","ed",1013907473).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)));var token = lt.plugins.auto_complete.get_token.call(null,new cljs.core.Keyword(null,"ed","ed",1013907473).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)),pos);if(cljs.core.truth_((function (){var or__3520__auto__ = lt.plugins.auto_complete.non_token_change_QMARK_.call(null,new cljs.core.Keyword(null,"ed","ed",1013907473).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)),c);if(cljs.core.truth_(or__3520__auto__))
{return or__3520__auto__;
} else
{return (new cljs.core.Keyword(null,"ch","ch",1013907415).cljs$core$IFn$_invoke$arity$1(pos) < new cljs.core.Keyword(null,"start","start",1123661780).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"starting-token","starting-token",3199431070).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.plugins.auto_complete.hinter))));
}
})()))
{return lt.object.raise.call(null,lt.plugins.auto_complete.hinter,new cljs.core.Keyword(null,"escape!","escape!",3844244274));
} else
{lt.object.raise.call(null,lt.plugins.auto_complete.hinter,new cljs.core.Keyword(null,"change!","change!",1752847843),new cljs.core.Keyword(null,"string","string",4416885635).cljs$core$IFn$_invoke$arity$1(token));
if(cljs.core._EQ_.call(null,0,cljs.core.count.call(null,new cljs.core.Keyword(null,"cur","cur",1014003122).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.plugins.auto_complete.hinter)))))
{lt.objs.context.out_BANG_.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"editor.keys.hinting.active","editor.keys.hinting.active",2111066372),new cljs.core.Keyword(null,"filter-list.input","filter-list.input",2936258401)], null));
} else
{if(cljs.core.truth_(lt.objs.context.in_QMARK_.call(null,new cljs.core.Keyword(null,"editor.keys.hinting.active","editor.keys.hinting.active",2111066372))))
{} else
{lt.objs.context.in_BANG_.call(null,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"filter-list.input","filter-list.input",2936258401)], null),lt.plugins.auto_complete.hinter);
lt.objs.context.in_BANG_.call(null,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"editor.keys.hinting.active","editor.keys.hinting.active",2111066372)], null),new cljs.core.Keyword(null,"ed","ed",1013907473).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.plugins.auto_complete.hinter)));
}
}
return lt.object.merge_BANG_.call(null,lt.plugins.auto_complete.hinter,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"token","token",1124445547),token], null));
}
} else
{return null;
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.plugins.auto-complete","line-change","lt.plugins.auto-complete/line-change",2938041394),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.plugins.auto_complete.__BEH__line_change,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"line-change","line-change",3952584475),null], null), null));
lt.plugins.auto_complete.__BEH__async_hint_tokens = (function __BEH__async_hint_tokens(this$,tokens){return lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword("lt.plugins.auto-complete","hints","lt.plugins.auto-complete/hints",3881612567),tokens], null));
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.plugins.auto-complete","async-hint-tokens","lt.plugins.auto-complete/async-hint-tokens",2432908764),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.plugins.auto_complete.__BEH__async_hint_tokens,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"hint-tokens","hint-tokens",3416256274),null], null), null));
lt.plugins.auto_complete.__BEH__intra_buffer_string_hints = (function __BEH__intra_buffer_string_hints(this$,ch){if((cljs.core.not_EQ_.call(null,new cljs.core.Keyword(null,"ed","ed",1013907473).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.plugins.auto_complete.hinter)),this$)) || (cljs.core.not.call(null,new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.plugins.auto_complete.hinter)))))
{return lt.plugins.auto_complete.async_hints.call(null,this$);
} else
{return null;
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.plugins.auto-complete","intra-buffer-string-hints","lt.plugins.auto-complete/intra-buffer-string-hints",3686435669),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.plugins.auto_complete.__BEH__intra_buffer_string_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,"change","change",3947235106),null], null), null),new cljs.core.Keyword(null,"debounce","debounce",1556599227),400);
lt.plugins.auto_complete.start_hinting = (function() {
var start_hinting = null;
var start_hinting__1 = (function (this$){return start_hinting.call(null,this$,null);
});
var start_hinting__2 = (function (this$,opts){var pos = lt.objs.editor.__GT_cursor.call(null,this$);var token = lt.plugins.auto_complete.get_token.call(null,this$,pos);var line = lt.objs.editor.line_handle.call(null,this$,new cljs.core.Keyword(null,"line","line",1017226086).cljs$core$IFn$_invoke$arity$1(pos));var elem = lt.object.__GT_content.call(null,lt.plugins.auto_complete.hinter);lt.objs.context.in_BANG_.call(null,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"editor.keys.hinting.active","editor.keys.hinting.active",2111066372)], null),this$);
lt.object.merge_BANG_.call(null,lt.plugins.auto_complete.hinter,new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"token","token",1124445547),token,new cljs.core.Keyword(null,"starting-token","starting-token",3199431070),token,new cljs.core.Keyword(null,"ed","ed",1013907473),this$,new cljs.core.Keyword(null,"active","active",3885920888),true,new cljs.core.Keyword(null,"line","line",1017226086),line], null));
lt.object.raise.call(null,lt.plugins.auto_complete.hinter,new cljs.core.Keyword(null,"change!","change!",1752847843),new cljs.core.Keyword(null,"string","string",4416885635).cljs$core$IFn$_invoke$arity$1(token));
lt.object.raise.call(null,lt.plugins.auto_complete.hinter,new cljs.core.Keyword(null,"active","active",3885920888));
var count = cljs.core.count.call(null,new cljs.core.Keyword(null,"cur","cur",1014003122).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.plugins.auto_complete.hinter)));if(cljs.core._EQ_.call(null,0,count))
{return lt.objs.context.out_BANG_.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"editor.keys.hinting.active","editor.keys.hinting.active",2111066372),new cljs.core.Keyword(null,"filter-list.input","filter-list.input",2936258401)], null));
} else
{if(cljs.core.truth_((function (){var and__3508__auto__ = cljs.core._EQ_.call(null,1,count);if(and__3508__auto__)
{return new cljs.core.Keyword(null,"select-single","select-single",4748368299).cljs$core$IFn$_invoke$arity$1(opts);
} else
{return and__3508__auto__;
}
})()))
{return lt.object.raise.call(null,lt.plugins.auto_complete.hinter,new cljs.core.Keyword(null,"select!","select!",2992004631),0);
} else
{if(new cljs.core.Keyword(null,"else","else",1017020587))
{CodeMirror.on(line,"change",lt.plugins.auto_complete.on_line_change);
lt.util.dom.append.call(null,lt.util.dom.$.call(null,new cljs.core.Keyword(null,"body","body",1016933652)),elem);
return CodeMirror.positionHint(lt.objs.editor.__GT_cm_ed.call(null,this$),elem,new cljs.core.Keyword(null,"start","start",1123661780).cljs$core$IFn$_invoke$arity$1(token));
} else
{return null;
}
}
}
});
start_hinting = function(this$,opts){
switch(arguments.length){
case 1:
return start_hinting__1.call(this,this$);
case 2:
return start_hinting__2.call(this,this$,opts);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
start_hinting.cljs$core$IFn$_invoke$arity$1 = start_hinting__1;
start_hinting.cljs$core$IFn$_invoke$arity$2 = start_hinting__2;
return start_hinting;
})()
;
lt.plugins.auto_complete.__BEH__show_hint = (function __BEH__show_hint(this$,opts){var cur = clojure.string.trim.call(null,lt.objs.editor.get_char.call(null,this$,-1));var opts__$1 = cljs.core.merge.call(null,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"select-single","select-single",4748368299),true], null),opts);if(cljs.core.truth_((function (){var and__3508__auto__ = new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.plugins.auto_complete.hinter));if(cljs.core.truth_(and__3508__auto__))
{return cljs.core._EQ_.call(null,new cljs.core.Keyword(null,"ed","ed",1013907473).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.plugins.auto_complete.hinter)),this$);
} else
{return and__3508__auto__;
}
})()))
{return lt.object.raise.call(null,lt.plugins.auto_complete.hinter,new cljs.core.Keyword(null,"select!","select!",2992004631));
} else
{if((cljs.core.empty_QMARK_.call(null,cur)) && (cljs.core.not.call(null,new cljs.core.Keyword(null,"force?","force?",4040082982).cljs$core$IFn$_invoke$arity$1(opts__$1))))
{return lt.objs.keyboard.passthrough.call(null);
} else
{if(cljs.core.truth_(new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.plugins.auto_complete.hinter))))
{lt.object.raise.call(null,lt.plugins.auto_complete.hinter,new cljs.core.Keyword(null,"escape!","escape!",3844244274));
return lt.plugins.auto_complete.start_hinting.call(null,this$);
} else
{if(new cljs.core.Keyword(null,"else","else",1017020587))
{return lt.plugins.auto_complete.start_hinting.call(null,this$,opts__$1);
} else
{return null;
}
}
}
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.plugins.auto-complete","show-hint","lt.plugins.auto-complete/show-hint",2503474276),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.plugins.auto_complete.__BEH__show_hint,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"hint","hint",1017106937),null], null), null));
lt.plugins.auto_complete.__BEH__remove_on_scroll_inactive = (function __BEH__remove_on_scroll_inactive(this$){if(cljs.core.truth_(new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.plugins.auto_complete.hinter))))
{return lt.object.raise.call(null,lt.plugins.auto_complete.hinter,new cljs.core.Keyword(null,"escape!","escape!",3844244274));
} else
{return null;
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.plugins.auto-complete","remove-on-scroll-inactive","lt.plugins.auto-complete/remove-on-scroll-inactive",1443432557),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.plugins.auto_complete.__BEH__remove_on_scroll_inactive,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"inactive","inactive",1038569437),null,new cljs.core.Keyword(null,"scroll","scroll",4401191487),null], null), null));
lt.plugins.auto_complete.__BEH__remove_on_move_line = (function __BEH__remove_on_move_line(this$,c){if(cljs.core.truth_(new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.plugins.auto_complete.hinter))))
{return lt.util.js.wait.call(null,0,(function (){var starting = new cljs.core.Keyword(null,"starting-token","starting-token",3199431070).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.plugins.auto_complete.hinter));var cur = new cljs.core.Keyword(null,"token","token",1124445547).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.plugins.auto_complete.hinter));var cursor = lt.objs.editor.__GT_cursor.call(null,this$);if(cljs.core.truth_((function (){var and__3508__auto__ = starting;if(cljs.core.truth_(and__3508__auto__))
{var and__3508__auto____$1 = cur;if(cljs.core.truth_(and__3508__auto____$1))
{return (!(((new cljs.core.Keyword(null,"start","start",1123661780).cljs$core$IFn$_invoke$arity$1(cur) <= new cljs.core.Keyword(null,"ch","ch",1013907415).cljs$core$IFn$_invoke$arity$1(cursor))) && ((new cljs.core.Keyword(null,"ch","ch",1013907415).cljs$core$IFn$_invoke$arity$1(cursor) <= new cljs.core.Keyword(null,"end","end",1014004813).cljs$core$IFn$_invoke$arity$1(cur))))) || (cljs.core.not_EQ_.call(null,new cljs.core.Keyword(null,"line","line",1017226086).cljs$core$IFn$_invoke$arity$1(starting),new cljs.core.Keyword(null,"line","line",1017226086).cljs$core$IFn$_invoke$arity$1(cursor)));
} else
{return and__3508__auto____$1;
}
} else
{return and__3508__auto__;
}
})()))
{return lt.object.raise.call(null,lt.plugins.auto_complete.hinter,new cljs.core.Keyword(null,"escape!","escape!",3844244274));
} else
{return null;
}
}));
} else
{return null;
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.plugins.auto-complete","remove-on-move-line","lt.plugins.auto-complete/remove-on-move-line",607886136),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.plugins.auto_complete.__BEH__remove_on_move_line,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));
lt.plugins.auto_complete.__BEH__auto_show_on_input = (function __BEH__auto_show_on_input(this$,_,ch){if(cljs.core.truth_(lt.plugins.auto_complete.non_token_change_QMARK_.call(null,this$,ch)))
{return null;
} else
{if(cljs.core.truth_((function (){var and__3508__auto__ = new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.plugins.auto_complete.hinter));if(cljs.core.truth_(and__3508__auto__))
{return cljs.core._EQ_.call(null,new cljs.core.Keyword(null,"ed","ed",1013907473).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.plugins.auto_complete.hinter)),this$);
} else
{return and__3508__auto__;
}
})()))
{return null;
} else
{return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"hint","hint",1017106937),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"select-single","select-single",4748368299),false], null));
}
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.plugins.auto-complete","auto-show-on-input","lt.plugins.auto-complete/auto-show-on-input",2908044373),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.plugins.auto_complete.__BEH__auto_show_on_input,new cljs.core.Keyword(null,"desc","desc",1016984067),"Auto-complete: Show on change",new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"input","input",1114262332),null], null), null),new cljs.core.Keyword(null,"type","type",1017479852),new cljs.core.Keyword(null,"user","user",1017503549));
lt.objs.command.command.call(null,new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"command","command",1964298941),new cljs.core.Keyword(null,"auto-complete.remove","auto-complete.remove",4068728365),new cljs.core.Keyword(null,"hidden","hidden",4091384092),true,new cljs.core.Keyword(null,"desc","desc",1016984067),"Editor: Auto complete hide",new cljs.core.Keyword(null,"exec","exec",1017031683),(function (){if(cljs.core.truth_(new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.plugins.auto_complete.hinter))))
{lt.object.raise.call(null,lt.plugins.auto_complete.hinter,new cljs.core.Keyword(null,"escape!","escape!",3844244274));
} else
{}
return lt.objs.keyboard.passthrough.call(null);
})], null));
lt.objs.command.command.call(null,new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"command","command",1964298941),new cljs.core.Keyword(null,"auto-complete","auto-complete",1879752457),new cljs.core.Keyword(null,"hidden","hidden",4091384092),true,new cljs.core.Keyword(null,"desc","desc",1016984067),"Editor: Auto complete",new cljs.core.Keyword(null,"exec","exec",1017031683),(function (){var ed = lt.objs.editor.pool.last_active.call(null);if(cljs.core.not.call(null,lt.objs.editor.selection_QMARK_.call(null,ed)))
{return lt.object.raise.call(null,ed,new cljs.core.Keyword(null,"hint","hint",1017106937));
} else
{return lt.objs.keyboard.passthrough.call(null);
}
})], null));
lt.objs.command.command.call(null,new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"command","command",1964298941),new cljs.core.Keyword(null,"auto-complete.force","auto-complete.force",686025030),new cljs.core.Keyword(null,"hidden","hidden",4091384092),true,new cljs.core.Keyword(null,"desc","desc",1016984067),"Editor: Force auto complete",new cljs.core.Keyword(null,"exec","exec",1017031683),(function (){var ed = lt.objs.editor.pool.last_active.call(null);return lt.object.raise.call(null,ed,new cljs.core.Keyword(null,"hint","hint",1017106937),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"force?","force?",4040082982),true], null));
})], null));
lt.plugins.auto_complete.__BEH__init = (function __BEH__init(this$){lt.util.load.js.call(null,"core/node_modules/codemirror_addons/show-hint.js",new cljs.core.Keyword(null,"sync","sync",1017449997));
CodeMirror.extendMode("clojure",cljs.core.clj__GT_js.call(null,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"hint-pattern","hint-pattern",2825267644),/[\w\-\>\:\*\$\?\<\!\+\.\\/foo]/], null)));
CodeMirror.extendMode("text/x-clojurescript",cljs.core.clj__GT_js.call(null,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"hint-pattern","hint-pattern",2825267644),/[\w\-\>\:\*\$\?\<\!\+\.\\/foo]/], null)));
return CodeMirror.extendMode("css",cljs.core.clj__GT_js.call(null,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.plugins.auto-complete","init","lt.plugins.auto-complete/init",3795201691),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.plugins.auto_complete.__BEH__init,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"init","init",1017141378),null], null), null));
