!function(){function t(t,e,i){this.editor=t,this.lastMatched=null,this.ignoreNext=!1,this.callback=e,this.ignoredKeys=[16,17,18,91,35,36,37,38,39,40,33,34],this._listeners=[],this.throttle=i||0,this._buffer=NEW_CKEDITOR.tools.throttle(this.throttle,(function(t){(t=this.callback(t))?t.text!=this.lastMatched&&(this.lastMatched=t.text,this.fire("matched",t)):this.lastMatched&&this.unmatch()}),this)}NEW_CKEDITOR.plugins.add("textwatcher",{}),t.prototype={attach:function(){function t(){var t=s.editable();this._listeners.push(t.attachListener(t,"keyup",e,this))}function e(t){this.check(t)}function i(){this.unmatch()}var s=this.editor;return this._listeners.push(s.on("contentDom",t,this)),this._listeners.push(s.on("blur",i,this)),this._listeners.push(s.on("beforeModeUnload",i,this)),this._listeners.push(s.on("setData",i,this)),this._listeners.push(s.on("afterCommandExec",i,this)),s.editable()&&t.call(this),this},check:function(t){this.ignoreNext?this.ignoreNext=!1:t&&"keyup"==t.name&&-1!=NEW_CKEDITOR.tools.array.indexOf(this.ignoredKeys,t.data.getKey())||(t=this.editor.getSelection())&&(t=t.getRanges()[0])&&this._buffer.input(t)},consumeNext:function(){return this.ignoreNext=!0,this},unmatch:function(){return this.lastMatched=null,this.fire("unmatched"),this},destroy:function(){NEW_CKEDITOR.tools.array.forEach(this._listeners,(function(t){t.removeListener()})),this._listeners=[]}},NEW_CKEDITOR.event.implementOn(t.prototype),NEW_CKEDITOR.plugins.textWatcher=t}();