/*!
Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
@license Proprietary

This software is the confidential and proprietary property of Lenovo SSG BASD.
You shall not disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement.

--- Build Info ---
Version: 1.1.1
Build Time: 2026/2/26 17:21:00
Build Commit: 81e556ed827e2f043668506dae6fae8dbb9ef395
*/
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../view/dist/index.js"),t=require("../../state/dist/index.js"),r=require("../../../crelt/index.js"),i="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class n{constructor(e,t,r=0,n=e.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,n),this.bufferStart=r,this.normalize=s?e=>s(i(e)):i,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.codePointAt(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 r=t.fromCodePoint(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=t.codePointSize(e);let n=this.normalize(r);if(n.length)for(let t=0,s=i;;t++){let e=n.charCodeAt(t),o=this.match(e,s,this.bufferPos+this.bufferStart);if(t==n.length-1){if(o)return this.value=o,this;break}s==i&&t<r.length&&r.charCodeAt(t)==e&&s++}}}match(e,t,r){let i=null;for(let n=0;n<this.matches.length;n+=2){let t=this.matches[n],s=!1;this.query.charCodeAt(t)==e&&(t==this.query.length-1?i={from:this.matches[n+1],to:r}:(this.matches[n]++,s=!0)),s||(this.matches.splice(n,2),n-=2)}return this.query.charCodeAt(0)==e&&(1==this.query.length?i={from:t,to:r}:this.matches.push(1,t)),i&&this.test&&!this.test(i.from,i.to,this.buffer,this.bufferStart)&&(i=null),i}}"undefined"!=typeof Symbol&&(n.prototype[Symbol.iterator]=function(){return this});const s={from:-1,to:-1,match:/.*/.exec("")},o="gm"+(null==/x/.unicode?"":"u");class l{constructor(e,t,r,i=0,n=e.length){if(this.text=e,this.to=n,this.curLine="",this.done=!1,this.value=s,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new h(e,t,r,i,n);this.re=new RegExp(t,o+((null==r?void 0:r.ignoreCase)?"i":"")),this.test=null==r?void 0:r.test,this.iter=e.iter();let l=e.lineAt(i);this.curLineStart=l.from,this.matchPos=u(e,i),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 r=this.curLineStart+t.index,i=r+t[0].length;if(this.matchPos=u(this.text,i+(r==i?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<i||r>this.value.to)&&(!this.test||this.test(r,i,t)))return this.value={from:r,to:i,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),e=0}}}}const a=new WeakMap;class c{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,r){let i=a.get(e);if(!i||i.from>=r||i.to<=t){let i=new c(t,e.sliceString(t,r));return a.set(e,i),i}if(i.from==t&&i.to==r)return i;let{text:n,from:s}=i;return s>t&&(n=e.sliceString(t,s)+n,s=t),i.to<r&&(n+=e.sliceString(i.to,r)),a.set(e,new c(s,n)),new c(t,n.slice(t-s,r-s))}}class h{constructor(e,t,r,i,n){this.text=e,this.to=n,this.done=!1,this.value=s,this.matchPos=u(e,i),this.re=new RegExp(t,o+((null==r?void 0:r.ignoreCase)?"i":"")),this.test=null==r?void 0:r.test,this.flat=c.get(e,i,this.chunkEnd(i+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,r=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,r,t)))return this.value={from:e,to:r,match:t},this.matchPos=u(this.text,r+(e==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=c.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function u(e,t){if(t>=e.length)return t;let r,i=e.lineAt(t);for(;t<i.to&&(r=i.text.charCodeAt(t-i.from))>=56320&&r<57344;)t++;return t}"undefined"!=typeof Symbol&&(l.prototype[Symbol.iterator]=h.prototype[Symbol.iterator]=function(){return this});const f=r=>{let{state:i}=r,n=String(i.doc.lineAt(r.state.selection.main.head).number),{close:s,result:o}=e.showDialog(r,{label:i.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:i.phrase("go")});return o.then(n=>{let o=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!o)return void r.dispatch({effects:s});let l=i.doc.lineAt(i.selection.main.head),[,a,c,h,u]=o,f=h?+h.slice(1):0,d=c?+c:l.number;if(c&&u){let e=d/100;a&&(e=e*("-"==a?-1:1)+l.number/i.doc.lines),d=Math.round(i.doc.lines*e)}else c&&a&&(d=d*("-"==a?-1:1)+l.number);let m=i.doc.line(Math.max(1,Math.min(i.doc.lines,d))),p=t.EditorSelection.cursor(m.from+Math.max(0,Math.min(f,m.length)));r.dispatch({effects:[s,e.EditorView.scrollIntoView(p.from,{y:"center"})],selection:p})}),!0},d={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},m=t.Facet.define({combine:e=>t.combineConfig(e,d,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})});const p=e.Decoration.mark({class:"cm-selectionMatch"}),g=e.Decoration.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function x(e,r,i,n){return!(0!=i&&e(r.sliceDoc(i-1,i))==t.CharCategory.Word||n!=r.doc.length&&e(r.sliceDoc(n,n+1))==t.CharCategory.Word)}const v=e.ViewPlugin.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(r){let i=r.state.facet(m),{state:s}=r,o=s.selection;if(o.ranges.length>1)return e.Decoration.none;let l,a=o.main,c=null;if(a.empty){if(!i.highlightWordAroundCursor)return e.Decoration.none;let t=s.wordAt(a.head);if(!t)return e.Decoration.none;c=s.charCategorizer(a.head),l=s.sliceDoc(t.from,t.to)}else{let r=a.to-a.from;if(r<i.minSelectionLength||r>200)return e.Decoration.none;if(i.wholeWords){if(l=s.sliceDoc(a.from,a.to),c=s.charCategorizer(a.head),!x(c,s,a.from,a.to)||!function(e,r,i,n){return e(r.sliceDoc(i,i+1))==t.CharCategory.Word&&e(r.sliceDoc(n-1,n))==t.CharCategory.Word}(c,s,a.from,a.to))return e.Decoration.none}else if(l=s.sliceDoc(a.from,a.to),!l)return e.Decoration.none}let h=[];for(let t of r.visibleRanges){let r=new n(s.doc,l,t.from,t.to);for(;!r.next().done;){let{from:t,to:n}=r.value;if((!c||x(c,s,t,n))&&(a.empty&&t<=a.from&&n>=a.to?h.push(g.range(t,n)):(t>=a.to||n<=a.from)&&h.push(p.range(t,n)),h.length>i.maxMatches))return e.Decoration.none}}return e.Decoration.set(h)}},{decorations:e=>e.decorations}),y=e.EditorView.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const w=({state:r,dispatch:i})=>{let{ranges:s}=r.selection;if(s.some(e=>e.from===e.to))return(({state:e,dispatch:r})=>{let{selection:i}=e,n=t.EditorSelection.create(i.ranges.map(r=>e.wordAt(r.head)||t.EditorSelection.cursor(r.head)),i.mainIndex);return!n.eq(i)&&(r(e.update({selection:n})),!0)})({state:r,dispatch:i});let o=r.sliceDoc(s[0].from,s[0].to);if(r.selection.ranges.some(e=>r.sliceDoc(e.from,e.to)!=o))return!1;let l=function(e,t){let{main:r,ranges:i}=e.selection,s=e.wordAt(r.head),o=s&&s.from==r.from&&s.to==r.to;for(let l=!1,a=new n(e.doc,t,i[i.length-1].to);;){if(a.next(),!a.done){if(l&&i.some(e=>e.from==a.value.from))continue;if(o){let t=e.wordAt(a.value.from);if(!t||t.from!=a.value.from||t.to!=a.value.to)continue}return a.value}if(l)return null;a=new n(e.doc,t,0,Math.max(0,i[i.length-1].from-1)),l=!0}}(r,o);return!!l&&(i(r.update({selection:r.selection.addRange(t.EditorSelection.range(l.from,l.to),!1),effects:e.EditorView.scrollIntoView(l.to)})),!0)},S=t.Facet.define({combine:r=>t.combineConfig(r,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Y(e),scrollToMatch:t=>e.EditorView.scrollIntoView(t)})});class b{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||function(e){try{return new RegExp(e,o),!0}catch(t){return!1}}(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)=>"n"==t?"\n":"r"==t?"\r":"t"==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 L(this):new k(this)}getCursor(e,r=0,i){let n=e.doc?e:t.EditorState.create({doc:e});return null==i&&(i=n.doc.length),this.regexp?q(this,n,r,i):M(this,n,r,i)}}class C{constructor(e){this.spec=e}}function M(e,r,i,s){let o;var l,a;return e.wholeWord&&(l=r.doc,a=r.charCategorizer(r.selection.main.head),o=(e,r,i,n)=>((n>e||n+i.length<r)&&(n=Math.max(0,e-2),i=l.sliceString(n,Math.min(l.length,r+2))),!(a(E(i,e-n))==t.CharCategory.Word&&a(D(i,e-n))==t.CharCategory.Word||a(D(i,r-n))==t.CharCategory.Word&&a(E(i,r-n))==t.CharCategory.Word))),e.test&&(o=function(e,t,r){return(i,n,s,o)=>{if(r&&!r(i,n,s,o))return!1;let l=i>=o&&n<=o+s.length?s.slice(i-o,n-o):t.doc.sliceString(i,n);return e(l,t,i,n)}}(e.test,r,o)),new n(r.doc,e.unquoted,i,s,e.caseSensitive?void 0:e=>e.toLowerCase(),o)}class k extends C{constructor(e){super(e)}nextMatch(e,t,r){let i=M(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let r=Math.min(e.doc.length,t+this.spec.unquoted.length);i=M(this.spec,e,0,r).nextOverlapping()}return i.done||i.value.from==t&&i.value.to==r?null:i.value}prevMatchInRange(e,t,r){for(let i=r;;){let r=Math.max(t,i-1e4-this.spec.unquoted.length),n=M(this.spec,e,r,i),s=null;for(;!n.nextOverlapping().done;)s=n.value;if(s)return s;if(r==t)return null;i-=1e4}}prevMatch(e,t,r){let i=this.prevMatchInRange(e,0,t);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),!i||i.from==t&&i.to==r?null:i}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let r=M(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let n=M(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!n.next().done;)i(n.value.from,n.value.to)}}function q(e,r,i,n){let s;var o;return e.wholeWord&&(o=r.charCategorizer(r.selection.main.head),s=(e,r,i)=>!i[0].length||(o(E(i.input,i.index))!=t.CharCategory.Word||o(D(i.input,i.index))!=t.CharCategory.Word)&&(o(D(i.input,i.index+i[0].length))!=t.CharCategory.Word||o(E(i.input,i.index+i[0].length))!=t.CharCategory.Word)),e.test&&(s=function(e,t,r){return(i,n,s)=>(!r||r(i,n,s))&&e(s[0],t,i,n)}(e.test,r,s)),new l(r.doc,e.search,{ignoreCase:!e.caseSensitive,test:s},i,n)}function E(e,r){return e.slice(t.findClusterBreak(e,r,!1),r)}function D(e,r){return e.slice(r,t.findClusterBreak(e,r))}class L extends C{nextMatch(e,t,r){let i=q(this.spec,e,r,e.doc.length).next();return i.done&&(i=q(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,r){for(let i=1;;i++){let n=Math.max(t,r-1e4*i),s=q(this.spec,e,n,r),o=null;for(;!s.next().done;)o=s.value;if(o&&(n==t||o.from>n+10))return o;if(n==t)return null}}prevMatch(e,t,r){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,r)=>{if("&"==r)return e.match[0];if("$"==r)return"$";for(let i=r.length;i>0;i--){let t=+r.slice(0,i);if(t>0&&t<e.match.length)return e.match[t]+r.slice(i)}return t})}matchAll(e,t){let r=q(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let n=q(this.spec,e,Math.max(0,t-250),Math.min(r+250,e.doc.length));for(;!n.next().done;)i(n.value.from,n.value.to)}}const W=t.StateEffect.define(),F=t.StateEffect.define(),P=t.StateField.define({create:e=>new A(K(e).create(),null),update(e,t){for(let r of t.effects)r.is(W)?e=new A(r.value.create(),e.panel):r.is(F)&&(e=new A(e.query,r.value?Q:null));return e},provide:t=>e.showPanel.from(t,e=>e.panel)});class A{constructor(e,t){this.query=e,this.panel=t}}const R=e.Decoration.mark({class:"cm-searchMatch"}),I=e.Decoration.mark({class:"cm-searchMatch cm-searchMatch-selected"}),V=e.ViewPlugin.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(P))}update(e){let t=e.state.field(P);(t!=e.startState.field(P)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:r,panel:i}){if(!i||!r.spec.valid)return e.Decoration.none;let{view:n}=this,s=new t.RangeSetBuilder;for(let e=0,t=n.visibleRanges,o=t.length;e<o;e++){let{from:i,to:l}=t[e];for(;e<o-1&&l>t[e+1].from-500;)l=t[++e].to;r.highlight(n.state,i,l,(e,t)=>{let r=n.state.selection.ranges.some(r=>r.from==e&&r.to==t);s.add(e,t,r?I:R)})}return s.finish()}},{decorations:e=>e.decorations});function z(e){return t=>{let r=t.state.field(P,!1);return r&&r.query.spec.valid?e(t,r):J(t)}}const $=z((e,{query:r})=>{let{to:i}=e.state.selection.main,n=r.nextMatch(e.state,i,i);if(!n)return!1;let s=t.EditorSelection.single(n.from,n.to),o=e.state.facet(S);return e.dispatch({selection:s,effects:[te(e,n),o.scrollToMatch(s.main,e)],userEvent:"select.search"}),H(e),!0}),O=z((e,{query:r})=>{let{state:i}=e,{from:n}=i.selection.main,s=r.prevMatch(i,n,n);if(!s)return!1;let o=t.EditorSelection.single(s.from,s.to),l=e.state.facet(S);return e.dispatch({selection:o,effects:[te(e,s),l.scrollToMatch(o.main,e)],userEvent:"select.search"}),H(e),!0}),T=z((e,{query:r})=>{let i=r.matchAll(e.state,1e3);return!(!i||!i.length)&&(e.dispatch({selection:t.EditorSelection.create(i.map(e=>t.EditorSelection.range(e.from,e.to))),userEvent:"select.search.matches"}),!0)}),j=({state:e,dispatch:r})=>{let i=e.selection;if(i.ranges.length>1||i.main.empty)return!1;let{from:s,to:o}=i.main,l=[],a=0;for(let c=new n(e.doc,e.sliceDoc(s,o));!c.next().done;){if(l.length>1e3)return!1;c.value.from==s&&(a=l.length),l.push(t.EditorSelection.range(c.value.from,c.value.to))}return r(e.update({selection:t.EditorSelection.create(l,a),userEvent:"select.search.matches"})),!0},B=z((r,{query:i})=>{let{state:n}=r,{from:s,to:o}=n.selection.main;if(n.readOnly)return!1;let l=i.nextMatch(n,s,s);if(!l)return!1;let a,c,h=l,u=[],f=[];h.from==s&&h.to==o&&(c=n.toText(i.getReplacement(h)),u.push({from:h.from,to:h.to,insert:c}),h=i.nextMatch(n,h.from,h.to),f.push(e.EditorView.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(s).number)+".")));let d=r.state.changes(u);return h&&(a=t.EditorSelection.single(h.from,h.to).map(d),f.push(te(r,h)),f.push(n.facet(S).scrollToMatch(a.main,r))),r.dispatch({changes:d,selection:a,effects:f,userEvent:"input.replace"}),!0}),N=z((t,{query:r})=>{if(t.state.readOnly)return!1;let i=r.matchAll(t.state,1e9).map(e=>{let{from:t,to:i}=e;return{from:t,to:i,insert:r.getReplacement(e)}});if(!i.length)return!1;let n=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:e.EditorView.announce.of(n),userEvent:"input.replace.all"}),!0});function Q(e){return e.state.facet(S).createPanel(e)}function K(e,t){var r,i,n,s,o;let l=e.selection.main,a=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(t&&!a)return t;let c=e.facet(S);return new b({search:(null!==(r=null==t?void 0:t.literal)&&void 0!==r?r:c.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(i=null==t?void 0:t.caseSensitive)&&void 0!==i?i:c.caseSensitive,literal:null!==(n=null==t?void 0:t.literal)&&void 0!==n?n:c.literal,regexp:null!==(s=null==t?void 0:t.regexp)&&void 0!==s?s:c.regexp,wholeWord:null!==(o=null==t?void 0:t.wholeWord)&&void 0!==o?o:c.wholeWord})}function G(t){let r=e.getPanel(t,Q);return r&&r.dom.querySelector("[main-field]")}function H(e){let t=G(e);t&&t==e.root.activeElement&&t.select()}const J=e=>{let r=e.state.field(P,!1);if(r&&r.panel){let t=G(e);if(t&&t!=e.root.activeElement){let i=K(e.state,r.query.spec);i.valid&&e.dispatch({effects:W.of(i)}),t.focus(),t.select()}}else e.dispatch({effects:[F.of(!0),r?W.of(K(e.state,r.query.spec)):t.StateEffect.appendConfig.of(ie)]});return!0},U=t=>{let r=t.state.field(P,!1);if(!r||!r.panel)return!1;let i=e.getPanel(t,Q);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:F.of(!1)}),!0},X=[{key:"Mod-f",run:J,scope:"editor search-panel"},{key:"F3",run:$,shift:O,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:$,shift:O,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:U,scope:"editor search-panel"},{key:"Mod-Shift-l",run:j},{key:"Mod-Alt-g",run:f},{key:"Mod-d",run:w,preventDefault:!0}];class Y{constructor(e){this.view=e;let t=this.query=e.state.field(P).query.spec;function i(e,t,i){return r.default("button",{class:"cm-button",name:e,onclick:t,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=r.default("input",{value:t.search,placeholder:Z(e,"Find"),"aria-label":Z(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=r.default("input",{value:t.replace,placeholder:Z(e,"Replace"),"aria-label":Z(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=r.default("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=r.default("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=r.default("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=r.default("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,i("next",()=>$(e),[Z(e,"next")]),i("prev",()=>O(e),[Z(e,"previous")]),i("select",()=>T(e),[Z(e,"all")]),r.default("label",null,[this.caseField,Z(e,"match case")]),r.default("label",null,[this.reField,Z(e,"regexp")]),r.default("label",null,[this.wordField,Z(e,"by word")]),...e.state.readOnly?[]:[r.default("br"),this.replaceField,i("replace",()=>B(e),[Z(e,"replace")]),i("replaceAll",()=>N(e),[Z(e,"replace all")])],r.default("button",{name:"close",onclick:()=>U(e),"aria-label":Z(e,"close"),type:"button"},["×"])])}commit(){let e=new b({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:W.of(e)}))}keydown(t){e.runScopeHandlers(this.view,t,"search-panel")?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?O:$)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),B(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(W)&&!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(S).top}}function Z(e,t){return e.state.phrase(t)}const _=30,ee=/[\s\.,:;?!]/;function te(t,{from:r,to:i}){let n=t.state.doc.lineAt(r),s=t.state.doc.lineAt(i).to,o=Math.max(n.from,r-_),l=Math.min(s,i+_),a=t.state.sliceDoc(o,l);if(o!=n.from)for(let e=0;e<_;e++)if(!ee.test(a[e+1])&&ee.test(a[e])){a=a.slice(e);break}if(l!=s)for(let e=a.length-1;e>a.length-_;e--)if(!ee.test(a[e-1])&&ee.test(a[e])){a=a.slice(0,e);break}return e.EditorView.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const re=e.EditorView.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"}}),ie=[P,t.Prec.low(V),re];exports.RegExpCursor=l,exports.SearchCursor=n,exports.SearchQuery=b,exports.closeSearchPanel=U,exports.findNext=$,exports.findPrevious=O,exports.gotoLine=f,exports.highlightSelectionMatches=function(e){return[y,v]},exports.openSearchPanel=J,exports.replaceAll=N,exports.replaceNext=B,exports.searchKeymap=X,exports.selectMatches=T,exports.selectNextOccurrence=w,exports.selectSelectionMatches=j,exports.setSearchQuery=W;