(function(a){if(typeof exports=="object"&&typeof module=="object"){a(require("../../lib/codemirror"))}else{if(typeof define=="function"&&define.amd){define(["../../lib/codemirror"],a)}else{a(CodeMirror)}}})(function(d){var l=d.Pos;function g(p,r){for(var q=0,s=p.length;q<s;++q){r(p[q])}}function e(p,r){if(!Array.prototype.indexOf){var q=p.length;while(q--){if(p[q]===r){return true}}return false}return p.indexOf(r)!=-1}function h(u,t,w,q){var v=u.getCursor(),s=w(u,v);if(/\b(?:string|comment)\b/.test(s.type)){return}s.state=d.innerMode(u.getMode(),s.state).state;if(!/^[\w$_]*$/.test(s.string)){s={start:v.ch,end:v.ch,string:"",state:s.state,type:s.string=="."?"property":null}}else{if(s.end>v.ch){s.end=v.ch;s.string=s.string.slice(0,v.ch-s.start)}}var p=s;while(p.type=="property"){p=w(u,l(v.line,p.start));if(p.string!="."){return}p=w(u,l(v.line,p.start));if(!r){var r=[]}r.push(p)}return{list:i(s,r,t,q),from:l(v.line,s.start),to:l(v.line,s.end)}}function a(q,p){return h(q,c,function(r,s){return r.getTokenAt(s)},p)}d.registerHelper("hint","javascript",a);function b(q,r){var p=q.getTokenAt(r);if(r.ch==p.start+1&&p.string.charAt(0)=="."){p.end=p.start;p.string=".";p.type="property"}else{if(/^\.[\w$_]*$/.test(p.string)){p.type="property";p.start++;p.string=p.string.replace(/\./,"")}}return p}function j(q,p){return h(q,n,b,p)}d.registerHelper("hint","coffeescript",j);var m=("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight toUpperCase toLowerCase split concat match replace search").split(" ");var o=("length concat join splice push pop shift unshift slice reverse sort indexOf lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");var f="prototype apply call bind".split(" ");var c=("break case catch continue debugger default delete do else false finally for function if in instanceof new null return switch throw true try typeof var void while with").split(" ");var n=("and break catch class continue delete do else extends false finally for if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" ");function k(q,s){if(!Object.getOwnPropertyNames||!Object.getPrototypeOf){for(var p in q){s(p)}}else{for(var r=q;r;r=Object.getPrototypeOf(r)){Object.getOwnPropertyNames(r).forEach(s)}}}function i(u,t,y,B){var A=[],r=u.string,s=B&&B.globalScope||window;function w(v){if(v.lastIndexOf(r,0)==0&&!e(A,v)){A.push(v)}}function q(v){if(typeof v=="string"){g(m,w)}else{if(v instanceof Array){g(o,w)}else{if(v instanceof Function){g(f,w)}}}k(v,w)}if(t&&t.length){var x=t.pop(),p;if(x.type&&x.type.indexOf("variable")===0){if(B&&B.additionalContext){p=B.additionalContext[x.string]}if(!B||B.useGlobalScope!==false){p=p||s[x.string]}}else{if(x.type=="string"){p=""}else{if(x.type=="atom"){p=1}else{if(x.type=="function"){if(s.jQuery!=null&&(x.string=="$"||x.string=="jQuery")&&(typeof s.jQuery=="function")){p=s.jQuery()}else{if(s._!=null&&(x.string=="_")&&(typeof s._=="function")){p=s._()}}}}}}while(p!=null&&t.length){p=p[t.pop().string]}if(p!=null){q(p)}}else{for(var z=u.state.localVars;z;z=z.next){w(z.name)}for(var z=u.state.globalVars;z;z=z.next){w(z.name)}if(!B||B.useGlobalScope!==false){q(s)}g(y,w)}return A}});