!function(){function t(t,e){for(var n=t.length,r=0,a=0;a<n;a+=1){var s=t[a];if(e>=r&&r+s.getText().length>=e)return{element:s,offset:e-r};r+=s.getText().length}return null}CKEDITOR.plugins.add("textmatch",{}),CKEDITOR.plugins.textMatch={},CKEDITOR.plugins.textMatch.match=function(t,e){var n=CKEDITOR.plugins.textMatch.getTextAndOffset(t),r=CKEDITOR.dom.selection.FILLING_CHAR_SEQUENCE,a=0;if(n)return 0==n.text.indexOf(r)&&(a=r.length,n.text=n.text.replace(r,""),n.offset-=a),(r=e(n.text,n.offset))?{range:CKEDITOR.plugins.textMatch.getRangeInText(t,r.start,r.end+a),text:n.text.slice(r.start,r.end)}:null},CKEDITOR.plugins.textMatch.getTextAndOffset=function(t){if(!t.collapsed)return null;var e,n="",r=0,a=CKEDITOR.plugins.textMatch.getAdjacentTextNodes(t),s=!1,g=t.startContainer.type!=CKEDITOR.NODE_ELEMENT;e=g?function(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return n;return-1}(a,(function(e){return t.startContainer.equals(e)})):t.startOffset-(a[0]?a[0].getIndex():0);for(var f=a.length,l=0;l<f;l+=1){var i=a[l];n=n+i.getText();s||(g?l==e?(s=!0,r+=t.startOffset):r+=i.getText().length:(l==e&&(s=!0),0<l&&(r+=a[l-1].getText().length),f==e&&l+1==f&&(r+=i.getText().length)))}return{text:n,offset:r}},CKEDITOR.plugins.textMatch.getRangeInText=function(e,n,r){var a=new CKEDITOR.dom.range(e.root);return n=t(e=CKEDITOR.plugins.textMatch.getAdjacentTextNodes(e),n),r=t(e,r),a.setStart(n.element,n.offset),a.setEnd(r.element,r.offset),a},CKEDITOR.plugins.textMatch.getAdjacentTextNodes=function(t){if(!t.collapsed)return[];var e,n,r,a=[];for(t.startContainer.type!=CKEDITOR.NODE_ELEMENT?(e=t.startContainer.getParent().getChildren(),t=t.startContainer.getIndex()):(e=t.startContainer.getChildren(),t=t.startOffset),r=t;(n=e.getItem(--r))&&n.type==CKEDITOR.NODE_TEXT;)a.unshift(n);for(r=t;(n=e.getItem(r++))&&n.type==CKEDITOR.NODE_TEXT;)a.push(n);return a}}();