CoreFiles by mySites.guru
codemirror-commands.min.js1 lines, 28,964 bytes, from Joomla_6.2.0-beta2-Beta-Full_Package.zip
Raw History Compare with 6.2.0-beta1
md5
880936c9e6bd46d689839f8fbddf816b
sha1
49c85b9f5e656599bddc7bd05bd684fd299a77ea
sha256
dcec82cfdaa92c7f5f6d6c150f33a98dbc32be9eab563b1cea11a0e4ecad0659
import{Annotation as Te,Facet as Oe,StateField as _t,Transaction as Y,ChangeSet as jt,ChangeDesc as en,EditorSelection as h,StateEffect as Ie,Text as ve,findClusterBreak as E,countColumn as Z,combineConfig as tn,CharCategory as D}from"@codemirror/state";import{EditorView as T,Direction as nn}from"@codemirror/view";import{IndentContext as Re,getIndentation as Fe,indentString as F,syntaxTree as _,matchBrackets as O,getIndentUnit as j,indentUnit as rn}from"@codemirror/language";import{NodeProp as ee}from"@lezer/common";const Ge=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=te(e.state,n.from);return r.line?Ue(e):r.block?Ne(e):!1};function L(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let l=e(t,n);return l?(r(n.update(l)),!0):!1}}const Ue=L(ne,0),on=L(ne,1),ln=L(ne,2),Ve=L(G,0),cn=L(G,1),sn=L(G,2),Ne=L((e,t)=>G(e,t,fn(t)),0);function te(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const v=50;function un(e,{open:t,close:n},r,l){let o=e.sliceDoc(r-v,r),c=e.sliceDoc(l,l+v),s=/\s*$/.exec(o)[0].length,i=/^\s*/.exec(c)[0].length,f=o.length-s;if(o.slice(f-t.length,f)==t&&c.slice(i,i+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:l+i,margin:i&&1}};let u,a;l-r<=2*v?u=a=e.sliceDoc(r,l):(u=e.sliceDoc(r,r+v),a=e.sliceDoc(l-v,l));let d=/^\s*/.exec(u)[0].length,B=/\s*$/.exec(a)[0].length,k=a.length-B-n.length;return u.slice(d,d+t.length)==t&&a.slice(k,k+n.length)==n?{open:{pos:r+d+t.length,margin:/\s/.test(u.charAt(d+t.length))?1:0},close:{pos:l-B-n.length,margin:/\s/.test(a.charAt(k-1))?1:0}}:null}function fn(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),l=n.to<=r.to?r:e.doc.lineAt(n.to);l.from>r.from&&l.from==n.to&&(l=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let o=t.length-1;o>=0&&t[o].to>r.from?t[o].to=l.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:l.to})}return t}function G(e,t,n=t.selection.ranges){let r=n.map(o=>te(t,o.from).block);if(!r.every(o=>o))return null;let l=n.map((o,c)=>un(t,r[c],o.from,o.to));if(e!=2&&!l.every(o=>o))return{changes:t.changes(n.map((o,c)=>l[c]?[]:[{from:o.from,insert:r[c].open+" "},{from:o.to,insert:" "+r[c].close}]))};if(e!=1&&l.some(o=>o)){let o=[];for(let c=0,s;c<l.length;c++)if(s=l[c]){let i=r[c],{open:f,close:u}=s;o.push({from:f.pos-i.open.length,to:f.pos+f.margin},{from:u.pos-u.margin,to:u.pos+i.close.length})}return{changes:o}}return null}function ne(e,t,n=t.selection.ranges){let r=[],l=-1;e:for(let{from:o,to:c}of n){let s=r.length,i=1e9,f;for(let u=o;u<=c;){let a=t.doc.lineAt(u);if(f==null&&(f=te(t,a.from).line,!f))continue e;if(a.from>l&&(o==c||c>a.from)){l=a.from;let d=/^\s*/.exec(a.text)[0].length,B=d==a.length,k=a.text.slice(d,d+f.length)==f?d:-1;d<a.text.length&&d<i&&(i=d),r.push({line:a,comment:k,token:f,indent:d,empty:B,single:!1})}u=a.to+1}if(i<1e9)for(let u=s;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=i);r.length==s+1&&(r[s].single=!0)}if(e!=2&&r.some(o=>o.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:s,token:i,indent:f,empty:u,single:a}of r)(a||!u)&&o.push({from:s.from+f,insert:i+" "});let c=t.changes(o);return{changes:c,selection:t.selection.map(c,1)}}else if(e!=1&&r.some(o=>o.comment>=0)){let o=[];for(let{line:c,comment:s,token:i}of r)if(s>=0){let f=c.from+s,u=f+i.length;c.text[u-c.from]==" "&&u++,o.push({from:f,to:u})}return{changes:o}}return null}const re=Te.define(),Pe=Te.define(),Je=Oe.define(),we=Oe.define({combine(e){return tn(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,l)=>t(r,l)||n(r,l)})}}),U=_t.define({create(){return C.empty},update(e,t){let n=t.state.facet(we),r=t.annotation(re);if(r){let i=y.fromTransaction(t,r.selection),f=r.side,u=f==0?e.undone:e.done;return i?u=P(u,u.length,n.minDepth,i):u=Ke(u,t.startState.selection),new C(f==0?r.rest:u,f==0?u:r.rest)}let l=t.annotation(Pe);if((l=="full"||l=="before")&&(e=e.isolate()),t.annotation(Y.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let o=y.fromTransaction(t),c=t.annotation(Y.time),s=t.annotation(Y.userEvent);return o?e=e.addChanges(o,c,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,c,s,n.newGroupDelay)),(l=="full"||l=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new C(e.done.map(y.fromJSON),e.undone.map(y.fromJSON))}});function an(e={}){return[U,we.of(e),T.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?oe:t.inputType=="historyRedo"?N:null;return r?(t.preventDefault(),r(n)):!1}})]}const hn=U;function V(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let l=n.field(U,!1);if(!l)return!1;let o=l.pop(e,n,t);return o?(r(o),!0):!1}}const oe=V(0,!1),N=V(1,!1),ze=V(0,!0),We=V(1,!0);function He(e){return function(t){let n=t.field(U,!1);if(!n)return 0;let r=e==0?n.done:n.undone;return r.length-(r.length&&!r[0].changes?1:0)}}const dn=He(0),mn=He(1);class y{constructor(t,n,r,l,o){this.changes=t,this.effects=n,this.mapped=r,this.startSelection=l,this.selectionsAfter=o}setSelAfter(t){return new y(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(l=>l.toJSON())}}static fromJSON(t){return new y(t.changes&&jt.fromJSON(t.changes),[],t.mapped&&en.fromJSON(t.mapped),t.startSelection&&h.fromJSON(t.startSelection),t.selectionsAfter.map(h.fromJSON))}static fromTransaction(t,n){let r=A;for(let l of t.startState.facet(Je)){let o=l(t);o.length&&(r=r.concat(o))}return!r.length&&t.changes.empty?null:new y(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,A)}static selection(t){return new y(void 0,A,void 0,void 0,t)}}function P(e,t,n,r){let l=t+1>n+20?t-n-1:0,o=e.slice(l,t);return o.push(r),o}function pn(e,t){let n=[],r=!1;return e.iterChangedRanges((l,o)=>n.push(l,o)),t.iterChangedRanges((l,o,c,s)=>{for(let i=0;i<n.length;){let f=n[i++],u=n[i++];s>=f&&c<=u&&(r=!0)}}),r}function gn(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function qe(e,t){return e.length?t.length?e.concat(t):e:t}const A=[],yn=200;function Ke(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-yn));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),P(e,e.length-1,1e9,n.setSelAfter(r)))}else return[y.selection([t])]}function kn(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function le(e,t){if(!e.length)return e;let n=e.length,r=A;for(;n;){let l=An(e[n-1],t,r);if(l.changes&&!l.changes.empty||l.effects.length){let o=e.slice(0,n);return o[n-1]=l,o}else t=l.mapped,n--,r=l.selectionsAfter}return r.length?[y.selection(r)]:A}function An(e,t,n){let r=qe(e.selectionsAfter.length?e.selectionsAfter.map(s=>s.map(t)):A,n);if(!e.changes)return y.selection(r);let l=e.changes.map(t),o=t.mapDesc(e.changes,!0),c=e.mapped?e.mapped.composeDesc(o):o;return new y(l,Ie.mapEffects(e.effects,t),c,e.startSelection.map(o),r)}const Bn=/^(input\.type|delete)($|\.)/;class C{constructor(t,n,r=0,l=void 0){this.done=t,this.undone=n,this.prevTime=r,this.prevUserEvent=l}isolate(){return this.prevTime?new C(this.done,this.undone):this}addChanges(t,n,r,l,o){let c=this.done,s=c[c.length-1];return s&&s.changes&&!s.changes.empty&&t.changes&&(!r||Bn.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<l.newGroupDelay&&l.joinToEvent(o,pn(s.changes,t.changes))||r=="input.type.compose")?c=P(c,c.length-1,l.minDepth,new y(t.changes.compose(s.changes),qe(Ie.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,A)):c=P(c,c.length,l.minDepth,t),new C(c,A,n,r)}addSelection(t,n,r,l){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:A;return o.length>0&&n-this.prevTime<l&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&gn(o[o.length-1],t)?this:new C(Ke(this.done,t),this.undone,n,r)}addMapping(t){return new C(le(this.done,t),le(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,r){let l=t==0?this.done:this.undone;if(l.length==0)return null;let o=l[l.length-1],c=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):n.selection);if(r&&o.selectionsAfter.length)return n.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:re.of({side:t,rest:kn(l),selection:c}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let s=l.length==1?A:l.slice(0,l.length-1);return o.mapped&&(s=le(s,o.mapped)),n.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:re.of({side:t,rest:s,selection:c}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}C.empty=new C(A,A);const Sn=[{key:"Mod-z",run:oe,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:N,preventDefault:!0},{linux:"Ctrl-Shift-z",run:N,preventDefault:!0},{key:"Mod-u",run:ze,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:We,preventDefault:!0}];function I(e,t){return h.create(e.ranges.map(t),e.mainIndex)}function S(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function g({state:e,dispatch:t},n){let r=I(e.selection,n);return r.eq(e.selection,!0)?!1:(t(S(e,r)),!0)}function M(e,t){return h.cursor(t?e.to:e.from)}function J(e,t){return g(e,n=>n.empty?e.moveByChar(n,t):M(n,t))}function m(e){return e.textDirectionAt(e.state.selection.main.head)==nn.LTR}const ce=e=>J(e,!m(e)),se=e=>J(e,m(e)),Cn=e=>J(e,!0),Dn=e=>J(e,!1);function ie(e,t,n){let r=t.head,l=e.doc.lineAt(r);return r==(n?l.to:l.from)?r=n?Math.min(e.doc.length,l.to+1):Math.max(0,l.from-1):r=l.from+E(l.text,r-l.from,n),h.cursor(r,n?-1:1)}function $e(e,t){return g(e,n=>n.empty?ie(e.state,n,t):M(n,t))}const xn=e=>$e(e,!0),Ln=e=>$e(e,!1);function w(e,t){return g(e,n=>n.empty?e.moveByGroup(n,t):M(n,t))}const Qe=e=>w(e,!m(e)),Xe=e=>w(e,m(e)),Mn=e=>w(e,!0),bn=e=>w(e,!1);function ue(e,t,n){let r=e.state.charCategorizer(t),l=r(n),o=l!=D.Space;return c=>{let s=r(c);return s!=D.Space?o&&s==l:(o=!1,!0)}}const En=e=>g(e,t=>t.empty?e.moveByChar(t,!0,n=>ue(e,t.head,n)):M(t,!0)),Ye=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function Ze(e,t,n){let r=e.state.charCategorizer(t.from),l=D.Space,o=t.from,c=0,s=!1,i=!1,f=!1,u=d=>{if(s)return!1;o+=n?d.length:-d.length;let B=r(d),k;if(B==D.Word&&d.charCodeAt(0)<128&&/[\W_]/.test(d)&&(B=-1),l==D.Space&&(l=B),l!=B)return!1;if(l==D.Word)if(d.toLowerCase()==d){if(!n&&i)return!1;f=!0}else if(f){if(n)return!1;s=!0}else{if(i&&n&&r(k=e.state.sliceDoc(o,o+1))==D.Word&&k.toLowerCase()==k)return!1;i=!0}return c++,!0},a=e.moveByChar(t,n,d=>(u(d),u));if(Ye&&l==D.Word&&a.from==t.from+c*(n?1:-1)){let d=Math.min(t.head,a.head),B=Math.max(t.head,a.head),k=e.state.sliceDoc(d,B);if(k.length>1&&/[\u4E00-\uffff]/.test(k)){let R=Array.from(Ye.segment(k));if(R.length>1)return n?h.cursor(t.head+R[1].index,-1):h.cursor(a.head+R[R.length-1].index,1)}}return a}function _e(e,t){return g(e,n=>n.empty?Ze(e,n,t):M(n,t))}const Tn=e=>_e(e,!0),On=e=>_e(e,!1);function In(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function z(e,t,n){let r=_(e).resolveInner(t.head),l=n?ee.closedBy:ee.openedBy;for(let i=t.head;;){let f=n?r.childAfter(i):r.childBefore(i);if(!f)break;In(e,f,l)?r=f:i=n?f.to:f.from}let o=r.type.prop(l),c,s;return o&&(c=n?O(e,r.from,1):O(e,r.to,-1))&&c.matched?s=n?c.end.to:c.end.from:s=n?r.to:r.from,h.cursor(s,n?-1:1)}const je=e=>g(e,t=>z(e.state,t,!m(e))),et=e=>g(e,t=>z(e.state,t,m(e)));function tt(e,t){return g(e,n=>{if(!n.empty)return M(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const fe=e=>tt(e,!1),ae=e=>tt(e,!0);function nt(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,l;if(t){for(let o of e.state.facet(T.scrollMargins)){let c=o(e);c?.top&&(n=Math.max(c?.top,n)),c?.bottom&&(r=Math.max(c?.bottom,r))}l=e.scrollDOM.clientHeight-n-r}else l=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,l-5)}}function rt(e,t){let n=nt(e),{state:r}=e,l=I(r.selection,c=>c.empty?e.moveVertically(c,t,n.height):M(c,t));if(l.eq(r.selection))return!1;let o;if(n.selfScroll){let c=e.coordsAtPos(r.selection.main.head),s=e.scrollDOM.getBoundingClientRect(),i=s.top+n.marginTop,f=s.bottom-n.marginBottom;c&&c.top>i&&c.bottom<f&&(o=T.scrollIntoView(l.main.head,{y:"start",yMargin:c.top-i}))}return e.dispatch(S(r,l),{effects:o}),!0}const he=e=>rt(e,!1),W=e=>rt(e,!0);function x(e,t,n){let r=e.lineBlockAt(t.head),l=e.moveToLineBoundary(t,n);if(l.head==t.head&&l.head!=(n?r.to:r.from)&&(l=e.moveToLineBoundary(t,n,!1)),!n&&l.head==r.from&&r.length){let o=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;o&&t.head!=r.from+o&&(l=h.cursor(r.from+o))}return l}const ot=e=>g(e,t=>x(e,t,!0)),lt=e=>g(e,t=>x(e,t,!1)),ct=e=>g(e,t=>x(e,t,!m(e))),st=e=>g(e,t=>x(e,t,m(e))),it=e=>g(e,t=>h.cursor(e.lineBlockAt(t.head).from,1)),ut=e=>g(e,t=>h.cursor(e.lineBlockAt(t.head).to,-1));function ft(e,t,n){let r=!1,l=I(e.selection,o=>{let c=O(e,o.head,-1)||O(e,o.head,1)||o.head>0&&O(e,o.head-1,1)||o.head<e.doc.length&&O(e,o.head+1,-1);if(!c||!c.end)return o;r=!0;let s=c.start.from==o.head?c.end.to:c.end.from;return n?h.range(o.anchor,s):h.cursor(s)});return r?(t(S(e,l)),!0):!1}const at=({state:e,dispatch:t})=>ft(e,t,!1),vn=({state:e,dispatch:t})=>ft(e,t,!0);function p(e,t){let n=I(e.state.selection,r=>{let l=t(r);return h.range(r.anchor,l.head,l.goalColumn,l.bidiLevel||void 0,l.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(S(e.state,n)),!0)}function H(e,t){return p(e,n=>e.moveByChar(n,t))}const de=e=>H(e,!m(e)),me=e=>H(e,m(e)),Rn=e=>H(e,!0),Fn=e=>H(e,!1),Gn=e=>p(e,t=>ie(e.state,t,!0)),Un=e=>p(e,t=>ie(e.state,t,!1));function q(e,t){return p(e,n=>e.moveByGroup(n,t))}const ht=e=>q(e,!m(e)),dt=e=>q(e,m(e)),Vn=e=>q(e,!0),Nn=e=>q(e,!1),Pn=e=>p(e,t=>e.moveByChar(t,!0,n=>ue(e,t.head,n)));function mt(e,t){return p(e,n=>Ze(e,n,t))}const Jn=e=>mt(e,!0),wn=e=>mt(e,!1),pt=e=>p(e,t=>z(e.state,t,!m(e))),gt=e=>p(e,t=>z(e.state,t,m(e)));function yt(e,t){return p(e,n=>e.moveVertically(n,t))}const pe=e=>yt(e,!1),ge=e=>yt(e,!0);function kt(e,t){return p(e,n=>e.moveVertically(n,t,nt(e).height))}const ye=e=>kt(e,!1),ke=e=>kt(e,!0),At=e=>p(e,t=>x(e,t,!0)),Bt=e=>p(e,t=>x(e,t,!1)),St=e=>p(e,t=>x(e,t,!m(e))),Ct=e=>p(e,t=>x(e,t,m(e))),Dt=e=>p(e,t=>h.cursor(e.lineBlockAt(t.head).from)),xt=e=>p(e,t=>h.cursor(e.lineBlockAt(t.head).to)),Ae=({state:e,dispatch:t})=>(t(S(e,{anchor:0})),!0),Be=({state:e,dispatch:t})=>(t(S(e,{anchor:e.doc.length})),!0),Se=({state:e,dispatch:t})=>(t(S(e,{anchor:e.selection.main.anchor,head:0})),!0),Ce=({state:e,dispatch:t})=>(t(S(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Lt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),Mt=({state:e,dispatch:t})=>{let n=Q(e).map(({from:r,to:l})=>h.range(r,Math.min(l+1,e.doc.length)));return t(e.update({selection:h.create(n),userEvent:"select"})),!0},bt=({state:e,dispatch:t})=>{let n=I(e.selection,r=>{let l=_(e),o=l.resolveStack(r.from,1);if(r.empty){let c=l.resolveStack(r.from,-1);c.node.from>=o.node.from&&c.node.to<=o.node.to&&(o=c)}for(let c=o;c;c=c.next){let{node:s}=c;if((s.from<r.from&&s.to>=r.to||s.to>r.to&&s.from<=r.from)&&c.next)return h.range(s.to,s.from)}return r});return n.eq(e.selection)?!1:(t(S(e,n)),!0)};function Et(e,t){let{state:n}=e,r=n.selection,l=n.selection.ranges.slice();for(let o of n.selection.ranges){let c=n.doc.lineAt(o.head);if(t?c.to<e.state.doc.length:c.from>0)for(let s=o;;){let i=e.moveVertically(s,t);if(i.head<c.from||i.head>c.to){l.some(f=>f.head==i.head)||l.push(i);break}else{if(i.head==s.head)break;s=i}}}return l.length==r.ranges.length?!1:(e.dispatch(S(n,h.create(l,l.length-1))),!0)}const Tt=e=>Et(e,!1),Ot=e=>Et(e,!0),It=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=h.create([n.main]):n.main.empty||(r=h.create([h.cursor(n.main.head)])),r?(t(S(e,r)),!0):!1};function b(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,l=r.changeByRange(o=>{let{from:c,to:s}=o;if(c==s){let i=t(o);i<c?(n="delete.backward",i=K(e,i,!1)):i>c&&(n="delete.forward",i=K(e,i,!0)),c=Math.min(c,i),s=Math.max(s,i)}else c=K(e,c,!1),s=K(e,s,!0);return c==s?{range:o}:{changes:{from:c,to:s},range:h.cursor(c,c<o.head?-1:1)}});return l.changes.empty?!1:(e.dispatch(r.update(l,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?T.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function K(e,t,n){if(e instanceof T)for(let r of e.state.facet(T.atomicRanges).map(l=>l(e)))r.between(t,t,(l,o)=>{l<t&&o>t&&(t=n?o:l)});return t}const De=(e,t,n)=>b(e,r=>{let l=r.from,{state:o}=e,c=o.doc.lineAt(l),s,i;if(n&&!t&&l>c.from&&l<c.from+200&&!/[^ \t]/.test(s=c.text.slice(0,l-c.from))){if(s[s.length-1]=="	")return l-1;let f=Z(s,o.tabSize),u=f%j(o)||j(o);for(let a=0;a<u&&s[s.length-1-a]==" ";a++)l--;i=l}else i=E(c.text,l-c.from,t,t)+c.from,i==l&&c.number!=(t?o.doc.lines:1)?i+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(c.text.slice(i-c.from,l-c.from))&&(i=E(c.text,i-c.from,!1,!1)+c.from);return i}),$=e=>De(e,!1,!0),zn=e=>De(e,!1,!1),xe=e=>De(e,!0,!1),vt=(e,t)=>b(e,n=>{let r=n.head,{state:l}=e,o=l.doc.lineAt(r),c=l.charCategorizer(r);for(let s=null;;){if(r==(t?o.to:o.from)){r==n.head&&o.number!=(t?l.doc.lines:1)&&(r+=t?1:-1);break}let i=E(o.text,r-o.from,t)+o.from,f=o.text.slice(Math.min(r,i)-o.from,Math.max(r,i)-o.from),u=c(f);if(s!=null&&u!=s)break;(f!=" "||r!=n.head)&&(s=u),r=i}return r}),Le=e=>vt(e,!1),Rt=e=>vt(e,!0),Wn=e=>b(e,t=>e.moveByChar(t,!0,n=>ue(e,t.head,n)).head),Ft=e=>b(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Hn=e=>b(e,t=>{let n=e.lineBlockAt(t.head).from;return t.head>n?n:Math.max(0,t.head-1)}),Gt=e=>b(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),Ut=e=>b(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),qn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=[];for(let r=0,l="",o=e.doc.iter();;){if(o.next(),o.lineBreak||o.done){let c=l.search(/\s+$/);if(c>-1&&n.push({from:r-(l.length-c),to:r}),o.done)break;l=""}else l=o.value;r+=o.value.length}return n.length?(t(e.update({changes:n,userEvent:"delete"})),!0):!1},Vt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:ve.of(["",""])},range:h.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},Nt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let l=r.from,o=e.doc.lineAt(l),c=l==o.from?l-1:E(o.text,l-o.from,!1)+o.from,s=l==o.to?l+1:E(o.text,l-o.from,!0)+o.from;return{changes:{from:c,to:s,insert:e.doc.slice(l,s).append(e.doc.slice(c,l))},range:h.cursor(s)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Q(e){let t=[],n=-1;for(let r of e.selection.ranges){let l=e.doc.lineAt(r.from),o=e.doc.lineAt(r.to);if(!r.empty&&r.to==o.from&&(o=e.doc.lineAt(r.to-1)),n>=l.number){let c=t[t.length-1];c.to=o.to,c.ranges.push(r)}else t.push({from:l.from,to:o.to,ranges:[r]});n=o.number+1}return t}function Pt(e,t,n){if(e.readOnly)return!1;let r=[],l=[];for(let o of Q(e)){if(n?o.to==e.doc.length:o.from==0)continue;let c=e.doc.lineAt(n?o.to+1:o.from-1),s=c.length+1;if(n){r.push({from:o.to,to:c.to},{from:o.from,insert:c.text+e.lineBreak});for(let i of o.ranges)l.push(h.range(Math.min(e.doc.length,i.anchor+s),Math.min(e.doc.length,i.head+s)))}else{r.push({from:c.from,to:o.from},{from:o.to,insert:e.lineBreak+c.text});for(let i of o.ranges)l.push(h.range(i.anchor-s,i.head-s))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:h.create(l,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Jt=({state:e,dispatch:t})=>Pt(e,t,!1),wt=({state:e,dispatch:t})=>Pt(e,t,!0);function zt(e,t,n){if(e.readOnly)return!1;let r=[];for(let o of Q(e))n?r.push({from:o.from,insert:e.doc.slice(o.from,o.to)+e.lineBreak}):r.push({from:o.to,insert:e.lineBreak+e.doc.slice(o.from,o.to)});let l=e.changes(r);return t(e.update({changes:l,selection:e.selection.map(l,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Wt=({state:e,dispatch:t})=>zt(e,t,!1),Ht=({state:e,dispatch:t})=>zt(e,t,!0),qt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Q(t).map(({from:l,to:o})=>(l>0?l--:o<t.doc.length&&o++,{from:l,to:o}))),r=I(t.selection,l=>{let o;if(e.lineWrapping){let c=e.lineBlockAt(l.head),s=e.coordsAtPos(l.head,l.assoc||1);s&&(o=c.bottom+e.documentTop-s.bottom+e.defaultLineHeight/2)}return e.moveVertically(l,!0,o)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0},Kn=({state:e,dispatch:t})=>(t(e.update(e.replaceSelection(e.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0),$n=({state:e,dispatch:t})=>(t(e.update(e.changeByRange(n=>{let r=/^\s*/.exec(e.doc.lineAt(n.from).text)[0];return{changes:{from:n.from,to:n.to,insert:e.lineBreak+r},range:h.cursor(n.from+r.length+1)}}),{scrollIntoView:!0,userEvent:"input"})),!0);function Qn(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=_(e).resolveInner(t),r=n.childBefore(t),l=n.childAfter(t),o;return r&&l&&r.to<=t&&l.from>=t&&(o=r.type.prop(ee.closedBy))&&o.indexOf(l.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(l.from).from&&!/\S/.test(e.sliceDoc(r.to,l.from))?{from:r.to,to:l.from}:null}const Me=$t(!1),Kt=$t(!0);function $t(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(l=>{let{from:o,to:c}=l,s=t.doc.lineAt(o),i=!e&&o==c&&Qn(t,o);e&&(o=c=(c<=s.to?s:t.doc.lineAt(c)).to);let f=new Re(t,{simulateBreak:o,simulateDoubleBreak:!!i}),u=Fe(f,o);for(u==null&&(u=Z(/^\s*/.exec(t.doc.lineAt(o).text)[0],t.tabSize));c<s.to&&/\s/.test(s.text[c-s.from]);)c++;i?{from:o,to:c}=i:o>s.from&&o<s.from+100&&!/\S/.test(s.text.slice(0,o))&&(o=s.from);let a=["",F(t,u)];return i&&a.push(F(t,f.lineIndent(s.from,-1))),{changes:{from:o,to:c,insert:ve.of(a)},range:h.cursor(o+1+a[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function be(e,t){let n=-1;return e.changeByRange(r=>{let l=[];for(let c=r.from;c<=r.to;){let s=e.doc.lineAt(c);s.number>n&&(r.empty||r.to>s.from)&&(t(s,l,r),n=s.number),c=s.to+1}let o=e.changes(l);return{changes:l,range:h.range(o.mapPos(r.anchor,1),o.mapPos(r.head,1))}})}const Qt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Re(e,{overrideIndentation:o=>{let c=n[o];return c??-1}}),l=be(e,(o,c,s)=>{let i=Fe(r,o.from);if(i==null)return;/\S/.test(o.text)||(i=0);let f=/^\s*/.exec(o.text)[0],u=F(e,i);(f!=u||s.from<o.from+f.length)&&(n[o.from]=i,c.push({from:o.from,to:o.from+f.length,insert:u}))});return l.changes.empty||t(e.update(l,{userEvent:"indent"})),!0},X=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(be(e,(n,r)=>{r.push({from:n.from,insert:e.facet(rn)})}),{userEvent:"input.indent"})),!0),Ee=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(be(e,(n,r)=>{let l=/^\s*/.exec(n.text)[0];if(!l)return;let o=Z(l,e.tabSize),c=0,s=F(e,Math.max(0,o-j(e)));for(;c<l.length&&c<s.length&&l.charCodeAt(c)==s.charCodeAt(c);)c++;r.push({from:n.from+c,to:n.from+l.length,insert:s.slice(c)})}),{userEvent:"delete.dedent"})),!0),Xt=e=>(e.setTabFocusMode(),!0),Xn=e=>(e.setTabFocusMode(2e3),!0),Yn=({state:e,dispatch:t})=>e.selection.ranges.some(n=>!n.empty)?X({state:e,dispatch:t}):(t(e.update(e.replaceSelection("	"),{scrollIntoView:!0,userEvent:"input"})),!0),Yt=[{key:"Ctrl-b",run:ce,shift:de,preventDefault:!0},{key:"Ctrl-f",run:se,shift:me},{key:"Ctrl-p",run:fe,shift:pe},{key:"Ctrl-n",run:ae,shift:ge},{key:"Ctrl-a",run:it,shift:Dt},{key:"Ctrl-e",run:ut,shift:xt},{key:"Ctrl-d",run:xe},{key:"Ctrl-h",run:$},{key:"Ctrl-k",run:Ft},{key:"Ctrl-Alt-h",run:Le},{key:"Ctrl-o",run:Vt},{key:"Ctrl-t",run:Nt},{key:"Ctrl-v",run:W}],Zt=[{key:"ArrowLeft",run:ce,shift:de,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Qe,shift:ht,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:ct,shift:St,preventDefault:!0},{key:"ArrowRight",run:se,shift:me,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Xe,shift:dt,preventDefault:!0},{mac:"Cmd-ArrowRight",run:st,shift:Ct,preventDefault:!0},{key:"ArrowUp",run:fe,shift:pe,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Ae,shift:Se},{mac:"Ctrl-ArrowUp",run:he,shift:ye},{key:"ArrowDown",run:ae,shift:ge,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Be,shift:Ce},{mac:"Ctrl-ArrowDown",run:W,shift:ke},{key:"PageUp",run:he,shift:ye},{key:"PageDown",run:W,shift:ke},{key:"Home",run:lt,shift:Bt,preventDefault:!0},{key:"Mod-Home",run:Ae,shift:Se},{key:"End",run:ot,shift:At,preventDefault:!0},{key:"Mod-End",run:Be,shift:Ce},{key:"Enter",run:Me,shift:Me},{key:"Mod-a",run:Lt},{key:"Backspace",run:$,shift:$,preventDefault:!0},{key:"Delete",run:xe,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Le,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Rt,preventDefault:!0},{mac:"Mod-Backspace",run:Gt,preventDefault:!0},{mac:"Mod-Delete",run:Ut,preventDefault:!0}].concat(Yt.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Zn=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:je,shift:pt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:et,shift:gt},{key:"Alt-ArrowUp",run:Jt},{key:"Shift-Alt-ArrowUp",run:Wt},{key:"Alt-ArrowDown",run:wt},{key:"Shift-Alt-ArrowDown",run:Ht},{key:"Mod-Alt-ArrowUp",run:Tt},{key:"Mod-Alt-ArrowDown",run:Ot},{key:"Escape",run:It},{key:"Mod-Enter",run:Kt},{key:"Alt-l",mac:"Ctrl-l",run:Mt},{key:"Mod-i",run:bt,preventDefault:!0},{key:"Mod-[",run:Ee},{key:"Mod-]",run:X},{key:"Mod-Alt-\\",run:Qt},{key:"Shift-Mod-k",run:qt},{key:"Shift-Mod-\\",run:at},{key:"Mod-/",run:Ge},{key:"Alt-A",run:Ve},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Xt}].concat(Zt),_n={key:"Tab",run:X,shift:Ee};export{Tt as addCursorAbove,Ot as addCursorBelow,cn as blockComment,sn as blockUncomment,Ht as copyLineDown,Wt as copyLineUp,Dn as cursorCharBackward,Ln as cursorCharBackwardLogical,Cn as cursorCharForward,xn as cursorCharForwardLogical,ce as cursorCharLeft,se as cursorCharRight,Be as cursorDocEnd,Ae as cursorDocStart,bn as cursorGroupBackward,Mn as cursorGroupForward,En as cursorGroupForwardWin,Qe as cursorGroupLeft,Xe as cursorGroupRight,lt as cursorLineBoundaryBackward,ot as cursorLineBoundaryForward,ct as cursorLineBoundaryLeft,st as cursorLineBoundaryRight,ae as cursorLineDown,ut as cursorLineEnd,it as cursorLineStart,fe as cursorLineUp,at as cursorMatchingBracket,W as cursorPageDown,he as cursorPageUp,On as cursorSubwordBackward,Tn as cursorSubwordForward,je as cursorSyntaxLeft,et as cursorSyntaxRight,Zn as defaultKeymap,$ as deleteCharBackward,zn as deleteCharBackwardStrict,xe as deleteCharForward,Le as deleteGroupBackward,Rt as deleteGroupForward,Wn as deleteGroupForwardWin,qt as deleteLine,Gt as deleteLineBoundaryBackward,Ut as deleteLineBoundaryForward,Ft as deleteToLineEnd,Hn as deleteToLineStart,qn as deleteTrailingWhitespace,Yt as emacsStyleKeymap,an as history,hn as historyField,Sn as historyKeymap,Ee as indentLess,X as indentMore,Qt as indentSelection,_n as indentWithTab,Kt as insertBlankLine,Kn as insertNewline,Me as insertNewlineAndIndent,$n as insertNewlineKeepIndent,Yn as insertTab,Je as invertedEffects,Pe as isolateHistory,on as lineComment,ln as lineUncomment,wt as moveLineDown,Jt as moveLineUp,N as redo,mn as redoDepth,We as redoSelection,Lt as selectAll,Fn as selectCharBackward,Un as selectCharBackwardLogical,Rn as selectCharForward,Gn as selectCharForwardLogical,de as selectCharLeft,me as selectCharRight,Ce as selectDocEnd,Se as selectDocStart,Nn as selectGroupBackward,Vn as selectGroupForward,Pn as selectGroupForwardWin,ht as selectGroupLeft,dt as selectGroupRight,Mt as selectLine,Bt as selectLineBoundaryBackward,At as selectLineBoundaryForward,St as selectLineBoundaryLeft,Ct as selectLineBoundaryRight,ge as selectLineDown,xt as selectLineEnd,Dt as selectLineStart,pe as selectLineUp,vn as selectMatchingBracket,ke as selectPageDown,ye as selectPageUp,bt as selectParentSyntax,wn as selectSubwordBackward,Jn as selectSubwordForward,pt as selectSyntaxLeft,gt as selectSyntaxRight,It as simplifySelection,Vt as splitLine,Zt as standardKeymap,Xn as temporarilySetTabFocusMode,Ve as toggleBlockComment,Ne as toggleBlockCommentByLine,Ge as toggleComment,Ue as toggleLineComment,Xt as toggleTabFocusMode,Nt as transposeChars,oe as undo,dn as undoDepth,ze as undoSelection};

The same content is in 21 releases, Joomla 6.1.0-beta3 to 6.2.0-beta2. See them all, or every version of this file.