Current File : /home/pacjaorg/public_html/kmm/media/vendor/codemirror/addon/search/search.min.js
(function(a){typeof exports=="object"&&typeof module=="object"?a(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):typeof define=="function"&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],a):a(CodeMirror)})(function(a){"use strict";a.defineOption("search",{bottom:!1});function m(e,n){return typeof e=="string"?e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),n?"gi":"g"):e.global||(e=new RegExp(e.source,e.ignoreCase?"gi":"g")),{token:function(t){e.lastIndex=t.pos;var r=e.exec(t.string);if(r&&r.index==t.pos)return t.pos+=r[0].length||1,"searching";r?t.pos=r.index:t.skipToEnd()}}}function T(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function y(e){return e.state.search||(e.state.search=new T)}function b(e){return typeof e=="string"&&e==e.toLowerCase()}function v(e,n,t){return e.getSearchCursor(n,t,{caseFold:b(n),multiline:!0})}function E(e,n,t,r,o){e.openDialog(n,r,{value:t,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){x(e)},onKeyDown:o,bottom:e.options.search.bottom})}function w(e,n,t,r,o){e.openDialog?e.openDialog(n,o,{value:r,selectValueOnOpen:!0,bottom:e.options.search.bottom}):o(prompt(t,r))}function Q(e,n,t,r){e.openConfirm?e.openConfirm(n,r):confirm(t)&&r[0]()}function O(e){return e.replace(/\\([nrt\\])/g,function(n,t){return t=="n"?`
`:t=="r"?"\r":t=="t"?"	":t=="\\"?"\\":n})}function R(e){var n=e.match(/^\/(.*)\/([a-z]*)$/);if(n)try{e=new RegExp(n[1],n[2].indexOf("i")==-1?"":"i")}catch{}else e=O(e);return(typeof e=="string"?e=="":e.test(""))&&(e=/x^/),e}function S(e,n,t){n.queryText=t,n.query=R(t),e.removeOverlay(n.overlay,b(n.query)),n.overlay=m(n.query,b(n.query)),e.addOverlay(n.overlay),e.showMatchesOnScrollbar&&(n.annotate&&(n.annotate.clear(),n.annotate=null),n.annotate=e.showMatchesOnScrollbar(n.query,b(n.query)))}function h(e,n,t,r){var o=y(e);if(o.query)return N(e,n);var i=e.getSelection()||o.lastQuery;if(i instanceof RegExp&&i.source=="x^"&&(i=null),t&&e.openDialog){var p=null,f=function(s,g){a.e_stop(g),s&&(s!=o.queryText&&(S(e,o,s),o.posFrom=o.posTo=e.getCursor()),p&&(p.style.opacity=1),N(e,g.shiftKey,function(d,c){var u;c.line<3&&document.querySelector&&(u=e.display.wrapper.querySelector(".CodeMirror-dialog"))&&u.getBoundingClientRect().bottom-4>e.cursorCoords(c,"window").top&&((p=u).style.opacity=.4)}))};E(e,C(e),i,f,function(s,g){var d=a.keyName(s),c=e.getOption("extraKeys"),u=c&&c[d]||a.keyMap[e.getOption("keyMap")][d];u=="findNext"||u=="findPrev"||u=="findPersistentNext"||u=="findPersistentPrev"?(a.e_stop(s),S(e,y(e),g),e.execCommand(u)):(u=="find"||u=="findPersistent")&&(a.e_stop(s),f(g,s))}),r&&i&&(S(e,o,i),N(e,n))}else w(e,C(e),"Search for:",i,function(s){s&&!o.query&&e.operation(function(){S(e,o,s),o.posFrom=o.posTo=e.getCursor(),N(e,n)})})}function N(e,n,t){e.operation(function(){var r=y(e),o=v(e,r.query,n?r.posFrom:r.posTo);!o.find(n)&&(o=v(e,r.query,n?a.Pos(e.lastLine()):a.Pos(e.firstLine(),0)),!o.find(n))||(e.setSelection(o.from(),o.to()),e.scrollIntoView({from:o.from(),to:o.to()},20),r.posFrom=o.from(),r.posTo=o.to(),t&&t(o.from(),o.to()))})}function x(e){e.operation(function(){var n=y(e);n.lastQuery=n.query,n.query&&(n.query=n.queryText=null,e.removeOverlay(n.overlay),n.annotate&&(n.annotate.clear(),n.annotate=null))})}function l(e,n){var t=e?document.createElement(e):document.createDocumentFragment();for(var r in n)t[r]=n[r];for(var o=2;o<arguments.length;o++){var i=arguments[o];t.appendChild(typeof i=="string"?document.createTextNode(i):i)}return t}function C(e){var n=l("label",{className:"CodeMirror-search-label"},e.phrase("Search:"),l("input",{type:"text",style:"width: 10em",className:"CodeMirror-search-field",id:"CodeMirror-search-field"}));return n.setAttribute("for","CodeMirror-search-field"),l("",null,n," ",l("span",{style:"color: #666",className:"CodeMirror-search-hint"},e.phrase("(Use /re/ syntax for regexp search)")))}function F(e){return l("",null," ",l("input",{type:"text",style:"width: 10em",className:"CodeMirror-search-field"})," ",l("span",{style:"color: #666",className:"CodeMirror-search-hint"},e.phrase("(Use /re/ syntax for regexp search)")))}function _(e){return l("",null,l("span",{className:"CodeMirror-search-label"},e.phrase("With:"))," ",l("input",{type:"text",style:"width: 10em",className:"CodeMirror-search-field"}))}function $(e){return l("",null,l("span",{className:"CodeMirror-search-label"},e.phrase("Replace?"))," ",l("button",{},e.phrase("Yes"))," ",l("button",{},e.phrase("No"))," ",l("button",{},e.phrase("All"))," ",l("button",{},e.phrase("Stop")))}function D(e,n,t){e.operation(function(){for(var r=v(e,n);r.findNext();)if(typeof n!="string"){var o=e.getRange(r.from(),r.to()).match(n);r.replace(t.replace(/\$(\d)/g,function(i,p){return o[p]}))}else r.replace(t)})}function P(e,n){if(!e.getOption("readOnly")){var t=e.getSelection()||y(e).lastQuery,r=n?e.phrase("Replace all:"):e.phrase("Replace:"),o=l("",null,l("span",{className:"CodeMirror-search-label"},r),F(e));w(e,o,r,t,function(i){i&&(i=R(i),w(e,_(e),e.phrase("Replace with:"),"",function(p){if(p=O(p),n)D(e,i,p);else{x(e);var f=v(e,i,e.getCursor("from")),s=function(){var d=f.from(),c;!(c=f.findNext())&&(f=v(e,i),!(c=f.findNext())||d&&f.from().line==d.line&&f.from().ch==d.ch)||(e.setSelection(f.from(),f.to()),e.scrollIntoView({from:f.from(),to:f.to()}),Q(e,$(e),e.phrase("Replace?"),[function(){g(c)},s,function(){D(e,i,p)}]))},g=function(d){f.replace(typeof i=="string"?p:p.replace(/\$(\d)/g,function(c,u){return d[u]})),s()};s()}}))})}}a.commands.find=function(e){x(e),h(e)},a.commands.findPersistent=function(e){x(e),h(e,!1,!0)},a.commands.findPersistentNext=function(e){h(e,!1,!0,!0)},a.commands.findPersistentPrev=function(e){h(e,!0,!0,!0)},a.commands.findNext=h,a.commands.findPrev=function(e){h(e,!0)},a.commands.clearSearch=x,a.commands.replace=P,a.commands.replaceAll=function(e){P(e,!0)}});
Site is undergoing maintenance

PACJA Events

Maintenance mode is on

Site will be available soon. Thank you for your patience!