text: ﻿(function(){function e(t){return t.type==CKEDITOR.NODE_TEXT&&0<t.getLength()&&(!n||!t.isReadOnly())}function i(n){return!(n.type==CKEDITOR.NODE_ELEMENT&&n.isBlockBoundary(CKEDITOR.tools.extend({},CKEDITOR.dtd.$empty,CKEDITOR.dtd.$nonEditable)))}function r(r,o){function c(n,t){var u=this,r=new CKEDITOR.dom.walker(n);r.guard=t?i:function(n){i(n)||(u._.matchBoundary=!0)};r.evaluator=e;r.breakOnFalse=1;n.startContainer.type==CKEDITOR.NODE_TEXT&&(this.textNode=n.startContainer,this.offset=n.startOffset-1);this._={matchWord:t,walker:r,matchBoundary:!1}}function y(n,t){var i=r.createRange();return i.setStart(n.textNode,t?n.offset:n.offset+1),i.setEndAt(r.editable(),CKEDITOR.POSITION_BEFORE_END),i}function a(n){var t=r.getSelection(),i=r.editable();return t&&!n?(n=t.getRanges()[0].clone(),n.collapse(!0)):(n=r.createRange(),n.setStartAt(i,CKEDITOR.POSITION_AFTER_START)),n.setEndAt(i,CKEDITOR.POSITION_BEFORE_END),n}var p=new CKEDITOR.style(CKEDITOR.tools.extend({attributes:{"data-cke-highlight":1},fullMatch:1,ignoreReadonly:1,childRule:function(){return 0}},r.config.find_highlight,!0)),l,v;c.prototype={next:function(){return this.move()},back:function(){return this.move(!0)},move:function(n){var t=this.textNode;if(null===t)return u.call(this);if(this._.matchBoundary=!1,t&&n&&0<this.offset)this.offset--;else if(t&&this.offset<t.getLength()-1)this.offset++;else{for(t=null;!t&&!(t=this._.walker[n?"previous":"next"].call(this._.walker),this._.matchWord&&!t||this._.walker._.end););this.offset=(this.textNode=t)?n?t.getLength()-1:0:0}return u.call(this)}};l=function(n,t){this._={walker:n,cursors:[],rangeLength:t,highlightRange:null,isMatched:0}};l.prototype={toDomRange:function(){var i=r.createRange(),n=this._.cursors,t;if(1>n.length)if(t=this._.walker.textNode,t)i.setStartAfter(t);else return null;else t=n[0],n=n[n.length-1],i.setStart(t.textNode,t.offset),i.setEnd(n.textNode,n.offset+1);return i},updateFromDomRange:function(n){var t=new c(n);this._.cursors=[];do n=t.next(),n.character&&this._.cursors.push(n);while(n.character);this._.rangeLength=this._.cursors.length},setMatched:function(){this._.isMatched=!0},clearMatched:function(){this._.isMatched=!1},isMatched:function(){return this._.isMatched},highlight:function(){if(!(1>this._.cursors.length)){this._.highlightRange&&this.removeHighlight();var n=this.toDomRange(),t=n.createBookmark();p.applyToRange(n,r);n.moveToBookmark(t);this._.highlightRange=n;t=n.startContainer;t.type!=CKEDITOR.NODE_ELEMENT&&(t=t.getParent());t.scrollIntoView();this.updateFromDomRange(n)}},removeHighlight:function(){if(this._.highlightRange){var n=this._.highlightRange.createBookmark();p.removeFromRange(this._.highlightRange,r);this._.highlightRange.moveToBookmark(n);this.updateFromDomRange(this._.highlightRange);this._.highlightRange=null}},isReadOnly:function(){return this._.highlightRange?this._.highlightRange.startContainer.isReadOnly():0},moveBack:function(){var t=this._.walker.back(),n=this._.cursors;return t.hitMatchBoundary&&(this._.cursors=n=[]),n.unshift(t),n.length>this._.rangeLength&&n.pop(),t},moveNext:function(){var t=this._.walker.next(),n=this._.cursors;return t.hitMatchBoundary&&(this._.cursors=n=[]),n.push(t),n.length>this._.rangeLength&&n.shift(),t},getEndCharacter:function(){var n=this._.cursors;return 1>n.length?null:n[n.length-1].character},getNextCharacterRange:function(n){var i,t;return t=this._.cursors,t=(i=t[t.length-1])&&i.textNode?new c(y(i)):this._.walker,new l(t,n)},getCursors:function(){return this._.cursors}};v=function(n,t){var r=[-1],i;for(t&&(n=n.toLowerCase()),i=0;i<n.length;i++)for(r.push(r[i]+1);0<r[i+1]&&n.charAt(i)!=n.charAt(r[i+1]-1);)r[i+1]=r[r[i+1]-1]+1;this._={overlap:r,state:0,ignoreCase:!!t,pattern:n}};v.prototype={feedCharacter:function(n){for(this._.ignoreCase&&(n=n.toLowerCase());;){if(n==this._.pattern.charAt(this._.state))return this._.state++,this._.state==this._.pattern.length?(this._.state=0,2):1;if(this._.state)this._.state=this._.overlap[this._.state];else return 0}},reset:function(){this._.state=0}};var b=/[.,"'?!;: \u0085\u00a0\u1680\u280e\u2028\u2029\u202f\u205f\u3000]/,w=function(n){if(!n)return!0;var t=n.charCodeAt(0);return 9<=t&&13>=t||8192<=t&&8202>=t||b.test(n)},h={searchRange:null,matchRange:null,find:function(n,t,i,u,f,e){this.matchRange?(this.matchRange.removeHighlight(),this.matchRange=this.matchRange.getNextCharacterRange(n.length)):this.matchRange=new l(new c(this.searchRange),n.length);for(var k=new v(n,!t),h=0,p="%";null!==p;){for(this.matchRange.moveNext();p=this.matchRange.getEndCharacter();){if(h=k.feedCharacter(p),2==h)break;this.matchRange.moveNext().hitMatchBoundary&&k.reset()}if(2==h){if(i){var o=this.matchRange.getCursors(),s=o[o.length-1],o=o[0],b=r.createRange();if(b.setStartAt(r.editable(),CKEDITOR.POSITION_AFTER_START),b.setEnd(o.textNode,o.offset),o=b,s=y(s),o.trim(),s.trim(),o=new c(o,!0),s=new c(s,!0),!w(o.back().character)||!w(s.next().character))continue}return this.matchRange.setMatched(),!1!==f&&this.matchRange.highlight(),!0}}return this.matchRange.clearMatched(),this.matchRange.removeHighlight(),u&&!e?(this.searchRange=a(1),this.matchRange=null,arguments.callee.apply(this,Array.prototype.slice.call(arguments).concat([!0]))):!1},replaceCounter:0,replace:function(t,i,u,f,e,o,s){if(n=1,t=0,this.matchRange&&this.matchRange.isMatched()&&!this.matchRange._.isReplaced&&!this.matchRange.isReadOnly()){if(this.matchRange.removeHighlight(),i=this.matchRange.toDomRange(),u=r.document.createText(u),!s){var h=r.getSelection();h.selectRanges([i]);r.fire("saveSnapshot")}i.deleteContents();i.insertNode(u);s||(h.selectRanges([i]),r.fire("saveSnapshot"));this.matchRange.updateFromDomRange(i);s||this.matchRange.highlight();this.matchRange._.isReplaced=!0;this.replaceCounter++;t=1}else t=this.find(i,f,e,o,!s);return n=0,t}},s=r.lang.find;return{title:s.title,resizable:CKEDITOR.DIALOG_RESIZE_NONE,minWidth:350,minHeight:170,buttons:[CKEDITOR.dialog.cancelButton(r,{label:r.lang.common.close})],contents:[{id:"find",label:s.find,title:s.find,accessKey:"",elements:[{type:"hbox",widths:["230px","90px"],children:[{type:"text",id:"txtFindFind",label:s.findWhat,isChanged:!1,labelLayout:"horizontal",accessKey:"F"},{type:"button",id:"btnFind",align:"left",style:"width:100%",label:s.find,onClick:function(){var n=this.getDialog();h.find(n.getValueOf("find","txtFindFind"),n.getValueOf("find","txtFindCaseChk"),n.getValueOf("find","txtFindWordChk"),n.getValueOf("find","txtFindCyclic"))||alert(s.notFoundMsg)}}]},{type:"fieldset",label:CKEDITOR.tools.htmlEncode(s.findOptions),style:"margin-top:29px",children:[{type:"vbox",padding:0,children:[{type:"checkbox",id:"txtFindCaseChk",isChanged:!1,label:s.matchCase},{type:"checkbox",id:"txtFindWordChk",isChanged:!1,label:s.matchWord},{type:"checkbox",id:"txtFindCyclic",isChanged:!1,"default":!0,label:s.matchCyclic}]}]}]},{id:"replace",label:s.replace,accessKey:"M",elements:[{type:"hbox",widths:["230px","90px"],children:[{type:"text",id:"txtFindReplace",label:s.findWhat,isChanged:!1,labelLayout:"horizontal",accessKey:"F"},{type:"button",id:"btnFindReplace",align:"left",style:"width:100%",label:s.replace,onClick:function(){var n=this.getDialog();h.replace(n,n.getValueOf("replace","txtFindReplace"),n.getValueOf("replace","txtReplace"),n.getValueOf("replace","txtReplaceCaseChk"),n.getValueOf("replace","txtReplaceWordChk"),n.getValueOf("replace","txtReplaceCyclic"))||alert(s.notFoundMsg)}}]},{type:"hbox",widths:["230px","90px"],children:[{type:"text",id:"txtReplace",label:s.replaceWith,isChanged:!1,labelLayout:"horizontal",accessKey:"R"},{type:"button",id:"btnReplaceAll",align:"left",style:"width:100%",label:s.replaceAll,isChanged:!1,onClick:function(){var n=this.getDialog();for(h.replaceCounter=0,h.searchRange=a(1),h.matchRange&&(h.matchRange.removeHighlight(),h.matchRange=null),r.fire("saveSnapshot");h.replace(n,n.getValueOf("replace","txtFindReplace"),n.getValueOf("replace","txtReplace"),n.getValueOf("replace","txtReplaceCaseChk"),n.getValueOf("replace","txtReplaceWordChk"),!1,!0););h.replaceCounter?(alert(s.replaceSuccessMsg.replace(/%1/,h.replaceCounter)),r.fire("saveSnapshot")):alert(s.notFoundMsg)}}]},{type:"fieldset",label:CKEDITOR.tools.htmlEncode(s.findOptions),children:[{type:"vbox",padding:0,children:[{type:"checkbox",id:"txtReplaceCaseChk",isChanged:!1,label:s.matchCase},{type:"checkbox",id:"txtReplaceWordChk",isChanged:!1,label:s.matchWord},{type:"checkbox",id:"txtReplaceCyclic",isChanged:!1,"default":!0,label:s.matchCyclic}]}]}]}],onLoad:function(){var n=this,r,i=0;this.on("hide",function(){i=0});this.on("show",function(){i=1});this.selectPage=CKEDITOR.tools.override(this.selectPage,function(u){return function(e){var h,c,o,s,l;if(u.call(n,e),o=n._.tabs[e],h="find"===e?"txtFindWordChk":"txtReplaceWordChk",r=n.getContentElement(e,"find"===e?"txtFindFind":"txtFindReplace"),n.getContentElement(e,h),o.initialized||(CKEDITOR.document.getById(r._.inputId),o.initialized=!0),i)for(e="find"===e?1:0,o=1-e,l=t.length,s=0;s<l;s++)h=this.getContentElement(f[e],t[s][e]),c=this.getContentElement(f[o],t[s][o]),c.setValue(h.getValue())}})},onShow:function(){h.searchRange=a();var t=this.getParentEditor().getSelection().getSelectedText(),n=this.getContentElement(o,"find"==o?"txtFindFind":"txtFindReplace");n.setValue(t);n.select();this.selectPage(o);this[("find"==o&&this._.editor.readOnly?"hide":"show")+"Page"]("replace")},onHide:function(){var n;h.matchRange&&h.matchRange.isMatched()&&(h.matchRange.removeHighlight(),r.focus(),(n=h.matchRange.toDomRange())&&r.getSelection().selectRanges([n]));delete h.matchRange},onFocus:function(){return"replace"==o?this.getContentElement("replace","txtFindReplace"):this.getContentElement("find","txtFindFind")}}}var n,u=function(){return{textNode:this.textNode,offset:this.offset,character:this.textNode?this.textNode.getText().charAt(this.offset):null,hitMatchBoundary:this._.matchBoundary}},f=["find","replace"],t=[["txtFindFind","txtFindReplace"],["txtFindCaseChk","txtReplaceCaseChk"],["txtFindWordChk","txtReplaceWordChk"],["txtFindCyclic","txtReplaceCyclic"]];CKEDITOR.dialog.add("find",function(n){return r(n,"find")});CKEDITOR.dialog.add("replace",function(n){return r(n,"replace")})})();
  //# sourceMappingURL=find.min.js.map
  