p3x-redis-ui-material
Version:
💿 P3X Redis UI triple frontend — Angular + React/MUI + Vue/Vuetify with 54 languages, 7 themes, Socket.IO, desktop notifications, and full feature parity
2 lines • 19.8 kB
JavaScript
import{S as e,_ as t,a as n,d as r,i,l as a,m as o,o as s,p as c,s as l,v as u,w as d,y as f}from"./dist-CXQINIyJ.js";import{a as p,c as m,f as ee,h,m as te,p as ne,r as g,t as _}from"./dist-BKX20y_2.js";var v=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,y=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(v(e)):v,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return t(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=d(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=u(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let a=r.charCodeAt(e),o=this.match(a,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(o)return this.value=o,this;break}i==n&&e<t.length&&t.charCodeAt(e)==a&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],a=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,a=!0)),a||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}};typeof Symbol<`u`&&(y.prototype[Symbol.iterator]=function(){return this});var b={from:-1,to:-1,match:/.*/.exec(``)},x=`gm`+(/x/.unicode==null?``:`u`),S=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=b,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new T(e,t,n,r,i);this.re=new RegExp(t,x+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=E(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=E(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},C=new WeakMap,w=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=C.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return C.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),C.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},T=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=b,this.matchPos=E(e,r),this.re=new RegExp(t,x+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=w.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=E(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=w.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(S.prototype[Symbol.iterator]=T.prototype[Symbol.iterator]=function(){return this});function re(e){try{return new RegExp(e,x),!0}catch{return!1}}function E(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var ie=e=>{let{state:t}=e,r=String(t.doc.lineAt(e.state.selection.main.head).number),{close:i,result:a}=ne(e,{label:t.phrase(`Go to line`),input:{type:`text`,name:`line`,value:r},focus:!0,submitLabel:t.phrase(`go`)});return a.then(r=>{let a=r&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.elements.line.value);if(!a){e.dispatch({effects:i});return}let o=t.doc.lineAt(t.selection.main.head),[,s,c,l,u]=a,d=l?+l.slice(1):0,f=c?+c:o.number;if(c&&u){let e=f/100;s&&(e=e*(s==`-`?-1:1)+o.number/t.doc.lines),f=Math.round(t.doc.lines*e)}else c&&s&&(f=f*(s==`-`?-1:1)+o.number);let p=t.doc.line(Math.max(1,Math.min(t.doc.lines,f))),m=n.cursor(p.from+Math.max(0,Math.min(d,p.length)));e.dispatch({effects:[i,g.scrollIntoView(m.from,{y:`center`})],selection:m})}),!0},ae={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},D=l.define({combine(e){return f(e,ae,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function oe(e){let t=[de,ue];return e&&t.push(D.of(e)),t}var se=_.mark({class:`cm-selectionMatch`}),ce=_.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function O(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=i.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=i.Word)}function le(e,t,n,r){return e(t.sliceDoc(n,n+1))==i.Word&&e(t.sliceDoc(r-1,r))==i.Word}var ue=p.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(D),{state:n}=e,r=n.selection;if(r.ranges.length>1)return _.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return _.none;let e=n.wordAt(i.head);if(!e)return _.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return _.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(O(o,n,i.from,i.to)&&le(o,n,i.from,i.to)))return _.none}else if(a=n.sliceDoc(i.from,i.to),!a)return _.none}let s=[];for(let r of e.visibleRanges){let e=new y(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||O(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(ce.range(r,a)):(r>=i.to||a<=i.from)&&s.push(se.range(r,a)),s.length>t.maxMatches))return _.none}}return _.set(s)}},{decorations:e=>e.decorations}),de=g.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),fe=({state:e,dispatch:t})=>{let{selection:r}=e,i=n.create(r.ranges.map(t=>e.wordAt(t.head)||n.cursor(t.head)),r.mainIndex);return i.eq(r)?!1:(t(e.update({selection:i})),!0)};function pe(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new y(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new y(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var me=({state:e,dispatch:t})=>{let{ranges:r}=e.selection;if(r.some(e=>e.from===e.to))return fe({state:e,dispatch:t});let i=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=i))return!1;let a=pe(e,i);return a?(t(e.update({selection:e.selection.addRange(n.range(a.from,a.to),!1),effects:g.scrollIntoView(a.to)})),!0):!1},k=l.define({combine(e){return f(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Oe(e),scrollToMatch:e=>g.scrollIntoView(e)})}}),A=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||re(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
`:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new be(this):new _e(this)}getCursor(e,t=0,n){let r=e.doc?e:s.create({doc:e});return n??=r.doc.length,this.regexp?N(this,r,t,n):M(this,r,t,n)}},j=class{constructor(e){this.spec=e}};function he(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function M(e,t,n,r){let i;return e.wholeWord&&(i=ge(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=he(e.test,t,i)),new y(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function ge(e,t){return(n,r,a,o)=>((o>n||o+a.length<r)&&(o=Math.max(0,n-2),a=e.sliceString(o,Math.min(e.length,r+2))),(t(P(a,n-o))!=i.Word||t(F(a,n-o))!=i.Word)&&(t(F(a,r-o))!=i.Word||t(P(a,r-o))!=i.Word))}var _e=class extends j{constructor(e){super(e)}nextMatch(e,t,n){let r=M(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=M(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=M(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=M(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=M(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function ve(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function N(e,t,n,r){let i;return e.wholeWord&&(i=ye(t.charCategorizer(t.selection.main.head))),e.test&&(i=ve(e.test,t,i)),new S(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function P(t,n){return t.slice(e(t,n,!1),n)}function F(t,n){return t.slice(n,e(t,n))}function ye(e){return(t,n,r)=>!r[0].length||(e(P(r.input,r.index))!=i.Word||e(F(r.input,r.index))!=i.Word)&&(e(F(r.input,r.index+r[0].length))!=i.Word||e(P(r.input,r.index+r[0].length))!=i.Word)}var be=class extends j{nextMatch(e,t,n){let r=N(this.spec,e,n,e.doc.length).next();return r.done&&(r=N(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=N(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=N(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=N(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},I=c.define(),L=c.define(),R=o.define({create(e){return new z(G(e).create(),null)},update(e,t){for(let n of t.effects)n.is(I)?e=new z(n.value.create(),e.panel):n.is(L)&&(e=new z(e.query,n.value?W:null));return e},provide:e=>te.from(e,e=>e.panel)}),z=class{constructor(e,t){this.query=e,this.panel=t}},xe=_.mark({class:`cm-searchMatch`}),Se=_.mark({class:`cm-searchMatch cm-searchMatch-selected`}),Ce=p.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(R))}update(e){let t=e.state.field(R);(t!=e.startState.field(R)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return _.none;let{view:n}=this,i=new r;for(let t=0,r=n.visibleRanges,a=r.length;t<a;t++){let{from:o,to:s}=r[t];for(;t<a-1&&s>r[t+1].from-500;)s=r[++t].to;e.highlight(n.state,o,s,(e,t)=>{let r=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);i.add(e,t,r?Se:xe)})}return i.finish()}},{decorations:e=>e.decorations});function B(e){return t=>{let n=t.state.field(R,!1);return n&&n.query.spec.valid?e(t,n):J(t)}}var V=B((e,{query:t})=>{let{to:r}=e.state.selection.main,i=t.nextMatch(e.state,r,r);if(!i)return!1;let a=n.single(i.from,i.to),o=e.state.facet(k);return e.dispatch({selection:a,effects:[$(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),q(e),!0}),H=B((e,{query:t})=>{let{state:r}=e,{from:i}=r.selection.main,a=t.prevMatch(r,i,i);if(!a)return!1;let o=n.single(a.from,a.to),s=e.state.facet(k);return e.dispatch({selection:o,effects:[$(e,a),s.scrollToMatch(o.main,e)],userEvent:`select.search`}),q(e),!0}),we=B((e,{query:t})=>{let r=t.matchAll(e.state,1e3);return!r||!r.length?!1:(e.dispatch({selection:n.create(r.map(e=>n.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),Te=({state:e,dispatch:t})=>{let r=e.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:i,to:a}=r.main,o=[],s=0;for(let t=new y(e.doc,e.sliceDoc(i,a));!t.next().done;){if(o.length>1e3)return!1;t.value.from==i&&(s=o.length),o.push(n.range(t.value.from,t.value.to))}return t(e.update({selection:n.create(o,s),userEvent:`select.search.matches`})),!0},U=B((e,{query:t})=>{let{state:r}=e,{from:i,to:a}=r.selection.main;if(r.readOnly)return!1;let o=t.nextMatch(r,i,i);if(!o)return!1;let s=o,c=[],l,u,d=[];s.from==i&&s.to==a&&(u=r.toText(t.getReplacement(s)),c.push({from:s.from,to:s.to,insert:u}),s=t.nextMatch(r,s.from,s.to),d.push(g.announce.of(r.phrase(`replaced match on line $`,r.doc.lineAt(i).number)+`.`)));let f=e.state.changes(c);return s&&(l=n.single(s.from,s.to).map(f),d.push($(e,s)),d.push(r.facet(k).scrollToMatch(l.main,e))),e.dispatch({changes:f,selection:l,effects:d,userEvent:`input.replace`}),!0}),Ee=B((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:g.announce.of(r),userEvent:`input.replace.all`}),!0});function W(e){return e.state.facet(k).createPanel(e)}function G(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(k);return new A({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function K(e){let t=m(e,W);return t&&t.dom.querySelector(`[main-field]`)}function q(e){let t=K(e);t&&t==e.root.activeElement&&t.select()}var J=e=>{let t=e.state.field(R,!1);if(t&&t.panel){let n=K(e);if(n&&n!=e.root.activeElement){let r=G(e.state,t.query.spec);r.valid&&e.dispatch({effects:I.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[L.of(!0),t?I.of(G(e.state,t.query.spec)):c.appendConfig.of(Ae)]});return!0},Y=e=>{let t=e.state.field(R,!1);if(!t||!t.panel)return!1;let n=m(e,W);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:L.of(!1)}),!0},De=[{key:`Mod-f`,run:J,scope:`editor search-panel`},{key:`F3`,run:V,shift:H,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:V,shift:H,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:Y,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:Te},{key:`Mod-Alt-g`,run:ie},{key:`Mod-d`,run:me,preventDefault:!0}],Oe=class{constructor(e){this.view=e;let t=this.query=e.state.field(R).query.spec;this.commit=this.commit.bind(this),this.searchField=h(`input`,{value:t.search,placeholder:X(e,`Find`),"aria-label":X(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=h(`input`,{value:t.replace,placeholder:X(e,`Replace`),"aria-label":X(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=h(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=h(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=h(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return h(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=h(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>V(e),[X(e,`next`)]),n(`prev`,()=>H(e),[X(e,`previous`)]),n(`select`,()=>we(e),[X(e,`all`)]),h(`label`,null,[this.caseField,X(e,`match case`)]),h(`label`,null,[this.reField,X(e,`regexp`)]),h(`label`,null,[this.wordField,X(e,`by word`)]),...e.state.readOnly?[]:[h(`br`),this.replaceField,n(`replace`,()=>U(e),[X(e,`replace`)]),n(`replaceAll`,()=>Ee(e),[X(e,`replace all`)])],h(`button`,{name:`close`,onclick:()=>Y(e),"aria-label":X(e,`close`),type:`button`},[`×`])])}commit(){let e=new A({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:I.of(e)}))}keydown(e){ee(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?H:V)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),U(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(I)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(k).top}};function X(e,t){return e.state.phrase(t)}var Z=30,Q=/[\s\.,:;?!]/;function $(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-Z),o=Math.min(i,n+Z),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<Z;e++)if(!Q.test(s[e+1])&&Q.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-Z;e--)if(!Q.test(s[e-1])&&Q.test(s[e])){s=s.slice(0,e);break}}return g.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var ke=g.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),Ae=[R,a.low(Ce),ke];export{oe as highlightSelectionMatches,De as searchKeymap};