Home
last modified time | relevance | path

Searched refs:sliceDoc (Results 1 – 8 of 8) sorted by relevance

/plugin/mizarverifiabledocs/dist/
H A Dscript.js1sliceDoc(t=0,e=this.doc.length){return this.doc.sliceString(t,e,this.lineBreak)}facet(t){let e=thi… method in o.E.constructor.tx
H A Dscript.js.map1sliceDoc(from = 0, to = this.doc.length) {\n return this.doc.sliceString(from, to, this.lin…
/plugin/mizarveifiabledocs/dist/
Dscript.js1sliceDoc(t=0,e=this.doc.length){return this.doc.sliceString(t,e,this.lineBreak)}facet(t){let e=thi… method in p.R.constructor.tC
Dscript.js.map1sliceDoc(from = 0, to = this.doc.length) {\n return this.doc.sliceString(from, to, this.lin…
/plugin/mizarproofchecker/dist/
Dscript.js1sliceDoc(t=0,e=this.doc.length){return this.doc.sliceString(t,e,this.lineBreak)}facet(t){let e=thi… method in p.R.constructor.tC
Dscript.js.map1sliceDoc(from = 0, to = this.doc.length) {\n return this.doc.sliceString(from, to, this.lin…
/plugin/bpmnio/vendor/dmn-js/dist/
H A Ddmn-viewer.production.min.js19 `,this;e--}else if(r instanceof mt){let l=r.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=r.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof mt?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},ll=class{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Mi(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=i?r:t<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},cl=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol!="undefined"&&(J.prototype[Symbol.iterator]=function(){return this.iter()},Mi.prototype[Symbol.iterator]=ll.prototype[Symbol.iterator]=cl.prototype[Symbol.iterator]=function(){return this});var Wu=class{constructor(e,t,i,r){this.from=e,this.to=t,this.number=i,this.text=r}get length(){return this.to-this.from}};function Kr(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function Re(n,e,t=!0,i=!0){return ty(n,e,t,i)}function FC(n){return n>=56320&&n<57344}function jC(n){return n>=55296&&n<56320}function At(n,e){let t=n.charCodeAt(e);if(!jC(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return FC(i)?(t-55296<<10)+(i-56320)+65536:t}function sf(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function un(n){return n<65536?1:2}var Hu=/\r\n?|\n/,Ee=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(Ee||(Ee={})),Tn=class n{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,r=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(i,r,s),r+=s):r+=o,i+=s}}iterChangedRanges(e,t=!1){Xu(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];r<0?e.push(i,r):e.push(r,i)}return new n(e)}composeDesc(e){return this.empty?e:e.empty?this:uy(this,e)}mapDesc(e,t=!1){return e.empty?this:Uu(this,e,t)}mapPos(e,t=-1,i=Ee.Simple){let r=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=r+a;if(l<0){if(c>e)return s+(e-r);s+=a}else{if(i!=Ee.Simple&&c>=e&&(i==Ee.TrackDel&&r<e&&c>e||i==Ee.TrackBefore&&r<e||i==Ee.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!a)return e==r||t<0?s:s+l;s+=l}r=c}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,t=e){for(let i=0,r=0;i<this.sections.length&&r<=t;){let s=this.sections[i++],o=this.sections[i++],a=r+s;if(o>=0&&r<=t&&a>=e)return r<e&&a>t?"cover":!0;r=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new n(e)}static create(e){return new n(e)}},Je=class n extends Tn{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Xu(this,(t,i,r,s,o)=>e=e.replace(r,r+(i-t),o),!1),e}mapDesc(e,t=!1){return Uu(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let r=0,s=0;r<t.length;r+=2){let o=t[r],a=t[r+1];if(a>=0){t[r]=a,t[r+1]=o;let l=r>>1;for(;i.length<l;)i.push(J.empty);i.push(o?e.slice(s,s+o):J.empty)}s+=o}return new n(t,i)}compose(e){return this.empty?e:e.empty?this:uy(this,e,!0)}map(e,t=!1){return e.empty?this:Uu(this,e,t,!0)}iterChanges(e,t=!1){Xu(this,e,t)}get desc(){return Tn.create(this.sections)}filter(e){let t=[],i=[],r=[],s=new Ri(this);e:for(let o=0,a=0;;){let l=o==e.length?1e9:e[o++];for(;a<l||a==l&&s.len==0;){if(s.done)break e;let u=Math.min(s.len,l-a);Qe(r,u,-1);let f=s.ins==-1?-1:s.off==0?s.ins:0;Qe(t,u,f),f>0&&Zn(i,t,s.text),s.forward(u),a+=u}let c=e[o++];for(;a<c;){if(s.done)break e;let u=Math.min(s.len,c-a);Qe(t,u,-1),Qe(r,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),a+=u}}return{changes:new n(t,i),filtered:Tn.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],r=this.sections[t+1];r<0?e.push(i):r==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let r=[],s=[],o=0,a=null;function l(u=!1){if(!u&&!r.length)return;o<t&&Qe(r,t-o,-1);let f=new n(r,s);a=a?a.compose(f.map(a)):f,r=[],s=[],o=0}function c(u){if(Array.isArray(u))for(let f of u)c(f);else if(u instanceof n){if(u.length!=t)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${t})`);l(),a=a?a.compose(u.map(a)):u}else{let{from:f,to:h=f,insert:d}=u;if(f>h||f<0||h>t)throw new RangeError(`Invalid change range ${f} to ${h} (in doc of length ${t})`);let p=d?typeof d=="string"?J.of(d.split(i||Hu)):d:J.empty,m=p.length;if(f==h&&m==0)return;f<o&&l(),f>o&&Qe(r,f-o,-1),Qe(r,h-f,m),Zn(s,r,p),o=h}}return c(e),l(!a),a}static empty(e){return new n(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let r=0;r<e.length;r++){let s=e[r];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length<r;)i.push(J.empty);i[r]=J.of(s.slice(1)),t.push(s[0],i[r].length)}}}return new n(t,i)}static createSet(e,t){return new n(e,t)}};function Qe(n,e,t,i=!1){if(e==0&&t<=0)return;let r=n.length-2;r>=0&&t<=0&&t==n[r+1]?n[r]+=e:r>=0&&e==0&&n[r]==0?n[r+1]+=t:i?(n[r]+=e,n[r+1]+=t):n.push(e,t)}function Zn(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(J.empty);n.push(t)}}function Xu(n,e,t){let i=n.inserted;for(let r=0,s=0,o=0;o<n.sections.length;){let a=n.sections[o++],l=n.sections[o++];if(l<0)r+=a,s+=a;else{let c=r,u=s,f=J.empty;for(;c+=a,u+=l,l&&i&&(f=f.append(i[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)a=n.sections[o++],l=n.sections[o++];e(r,c,s,u,f),r=c,s=u}}}function Uu(n,e,t,i=!1){let r=[],s=i?[]:null,o=new Ri(n),a=new Ri(e);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);Qe(r,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!t))){let c=a.len;for(Qe(r,a.ins,-1);c;){let u=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=u&&(Qe(r,0,o.ins),s&&Zn(s,r,o.text),l=o.i),o.forward(u),c-=u}a.next()}else if(o.ins>=0){let c=0,u=o.len;for(;u;)if(a.ins==-1){let f=Math.min(u,a.len);c+=f,u-=f,a.forward(f)}else if(a.ins==0&&a.len<u)u-=a.len,a.next();else break;Qe(r,c,l<o.i?o.ins:0),s&&l<o.i&&Zn(s,r,o.text),l=o.i,o.forward(o.len-u)}else{if(o.done&&a.done)return s?Je.createSet(r,s):Tn.create(r);throw new Error("Mismatched change set lengths")}}}function uy(n,e,t=!1){let i=[],r=t?[]:null,s=new Ri(n),o=new Ri(e);for(let a=!1;;){if(s.done&&o.done)return r?Je.createSet(i,r):Tn.create(i);if(s.ins==0)Qe(i,s.len,0,a),s.next();else if(o.len==0&&!o.done)Qe(i,0,o.ins,a),r&&Zn(r,i,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(s.len2,o.len),c=i.length;if(s.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;Qe(i,l,u,a),r&&u&&Zn(r,i,o.text)}else o.ins==-1?(Qe(i,s.off?0:s.len,l,a),r&&Zn(r,i,s.textBit(l))):(Qe(i,s.off?0:s.len,o.off?0:o.ins,a),r&&!o.off&&Zn(r,i,o.text));a=(s.ins>l||o.ins>=0&&o.len>l)&&(a||i.length>c),s.forward2(l),o.forward(l)}}}}var Ri=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?J.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?J.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},Hr=class n{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,r;return this.empty?i=r=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new n(i,r,this.flags)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return R.range(e,t,void 0,void 0,i);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return R.range(this.anchor,r,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return R.range(e.anchor,e.head)}static create(e,t,i){return new n(e,t,i)}},R=class n{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:n.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new n([this.main],0)}addRange(e,t=!0){return n.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,n.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new n(e.ranges.map(t=>Hr.fromJSON(t)),e.main)}static single(e,t=e){return new n([n.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;r<e.length;r++){let s=e[r];if(s.empty?s.from<=i:s.from<i)return n.normalized(e.slice(),t);i=s.to}return new n(e,t)}static cursor(e,t=0,i,r){return Hr.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(r!=null?r:16777215)<<6)}static range(e,t,i,r,s){let o=(i!=null?i:16777215)<<6|(r==null?7:Math.min(6,r));return!s&&e!=t&&(s=t<e?1:-1),t<e?Hr.create(t,e,48|o):Hr.create(e,t,(s?s<0?8:16:0)|o)}static normalized(e,t=0){let i=e[t];e.sort((r,s)=>r.from-s.from),t=e.indexOf(i);for(let r=1;r<e.length;r++){let s=e[r],o=e[r-1];if(s.empty?s.from<=o.to:s.from<o.to){let a=o.from,l=Math.max(s.to,o.to);r<=t&&t--,e.splice(--r,2,s.anchor>s.head?n.range(l,a):n.range(a,l))}}return new n(e,t)}};function fy(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}var of=0,L=class n{constructor(e,t,i,r,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=r,this.id=of++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new n(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:af),!!e.static,e.enables)}of(e){return new Ur([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ur(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ur(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}};function af(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}var Ur=class{constructor(e,t,i,r){this.dependencies=e,this.facet=t,this.type=i,this.value=r,this.id=of++}dynamicSlot(e){var t;let i=this.value,r=this.facet.compareInput,s=this.id,o=e[s]>>1,a=this.type==2,l=!1,c=!1,u=[];for(let f of this.dependencies)f=="doc"?l=!0:f=="selection"?c=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&u.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,h){if(l&&h.docChanged||c&&(h.docChanged||h.selection)||Yu(f,u)){let d=i(f);if(a?!oy(d,f.values[o],r):!r(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,h)=>{let d,p=h.config.address[s];if(p!=null){let m=hl(h,p);if(this.dependencies.every(y=>y instanceof L?h.facet(y)===f.facet(y):y instanceof Ne?h.field(y,!1)==f.field(y,!1):!0)||(a?oy(d=i(f),m,r):r(d=i(f),m)))return f.values[o]=m,0}else d=i(f);return f.values[o]=d,1}}}};function oy(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function Yu(n,e){let t=!1;for(let i of e)wo(n,i)&1&&(t=!0);return t}function VC(n,e,t){let i=t.map(l=>n[l.id]),r=t.map(l=>l.type),s=i.filter(l=>!(l&1)),o=n[e.id]>>1;function a(l){let c=[];for(let u=0;u<i.length;u++){let f=hl(l,i[u]);if(r[u]==2)for(let h of f)c.push(h);else c.push(f)}return e.combine(c)}return{create(l){for(let c of i)wo(l,c);return l.values[o]=a(l),1},update(l,c){if(!Yu(l,s))return 0;let u=a(l);return e.compare(u,l.values[o])?0:(l.values[o]=u,1)},reconfigure(l,c){let u=Yu(l,i),f=c.config.facets[e.id],h=c.facet(e);if(f&&!u&&af(t,f))return l.values[o]=h,0;let d=a(l);return e.compare(d,h)?(l.values[o]=h,0):(l.values[o]=d,1)}}}var rl=L.define({static:!0}),Ne=class n{constructor(e,t,i,r,s){this.id=e,this.createF=t,this.updateF=i,this.compareF=r,this.spec=s,this.provides=void 0}static define(e){let t=new n(of++,e.create,e.update,e.compare||((i,r)=>i===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(rl).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,r)=>{let s=i.values[t],o=this.updateF(s,r);return this.compareF(s,o)?0:(i.values[t]=o,1)},reconfigure:(i,r)=>{let s=i.facet(rl),o=r.facet(rl),a;return(a=s.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(i.values[t]=a.create(i),1):r.config.address[this.id]!=null?(i.values[t]=r.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,rl.of({field:this,create:e})]}get extension(){return this}},_i={lowest:4,low:3,default:2,high:1,highest:0};function bo(n){return e=>new ul(e,n)}var Rn={highest:bo(_i.highest),high:bo(_i.high),default:bo(_i.default),low:bo(_i.low),lowest:bo(_i.lowest)},ul=class{constructor(e,t){this.inner=e,this.prec=t}},Pi=class n{of(e){return new Oo(this,e)}reconfigure(e){return n.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}},Oo=class{constructor(e,t){this.compartment=e,this.inner=t}},fl=class n{constructor(e,t,i,r,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=r,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let r=[],s=Object.create(null),o=new Map;for(let h of QC(e,t,o))h instanceof Ne?r.push(h):(s[h.facet.id]||(s[h.facet.id]=[])).push(h);let a=Object.create(null),l=[],c=[];for(let h of r)a[h.id]=c.length<<1,c.push(d=>h.slot(d));let u=i==null?void 0:i.config.facets;for(let h in s){let d=s[h],p=d[0].facet,m=u&&u[h]||[];if(d.every(y=>y.type==0))if(a[p.id]=l.length<<1|1,af(m,d))l.push(i.facet(p));else{let y=p.combine(d.map(g=>g.value));l.push(i&&p.compare(y,i.facet(p))?i.facet(p):y)}else{for(let y of d)y.type==0?(a[y.id]=l.length<<1|1,l.push(y.value)):(a[y.id]=c.length<<1,c.push(g=>y.dynamicSlot(g)));a[p.id]=c.length<<1,c.push(y=>VC(y,p,d))}}let f=c.map(h=>h(a));return new n(e,o,f,a,l,s)}};function QC(n,e,t){let i=[[],[],[],[],[]],r=new Map;function s(o,a){let l=r.get(o);if(l!=null){if(l<=a)return;let c=i[l].indexOf(o);c>-1&&i[l].splice(c,1),o instanceof Oo&&t.delete(o.compartment)}if(r.set(o,a),Array.isArray(o))for(let c of o)s(c,a);else if(o instanceof Oo){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;t.set(o.compartment,c),s(c,a)}else if(o instanceof ul)s(o.inner,o.prec);else if(o instanceof Ne)i[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof Ur)i[a].push(o),o.facet.extensions&&s(o.facet.extensions,_i.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(c,a)}}return s(n,_i.default),i.reduce((o,a)=>o.concat(a))}function wo(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let r=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|r}function hl(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}var hy=L.define(),Ku=L.define({combine:n=>n.some(e=>e),static:!0}),dy=L.define({combine:n=>n.length?n[0]:void 0,static:!0}),py=L.define(),my=L.define(),gy=L.define(),yy=L.define({combine:n=>n.length?n[0]:!1}),gt=class{constructor(e,t){this.type=e,this.value=t}static define(){return new Gu}},Gu=class{of(e){return new gt(this,e)}},Ju=class{constructor(e){this.map=e}of(e){return new U(this,e)}},U=class n{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new n(this.type,t)}is(e){return this.type==e}static define(e={}){return new Ju(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let r of e){let s=r.map(t);s&&i.push(s)}return i}};U.reconfigure=U.define();U.appendConfig=U.define();var Le=class n{constructor(e,t,i,r,s,o){this.startState=e,this.changes=t,this.selection=i,this.effects=r,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,i&&fy(i,t.newLength),s.some(a=>a.type==n.time)||(this.annotations=s.concat(n.time.of(Date.now())))}static create(e,t,i,r,s,o){return new n(e,t,i,r,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(n.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}};Le.time=gt.define();Le.userEvent=gt.define();Le.addToHistory=gt.define();Le.remote=gt.define();function zC(n,e){let t=[];for(let i=0,r=0;;){let s,o;if(i<n.length&&(r==e.length||e[r]>=n[i]))s=n[i++],o=n[i++];else if(r<e.length)s=e[r++],o=e[r++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function vy(n,e,t){var i;let r,s,o;return t?(r=e.changes,s=Je.empty(e.changes.length),o=n.changes.compose(e.changes)):(r=e.changes.map(n.changes),s=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(r)),{changes:o,selection:e.selection?e.selection.map(s):(i=n.selection)===null||i===void 0?void 0:i.map(r),effects:U.mapEffects(n.effects,r).concat(U.mapEffects(e.effects,s)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function Zu(n,e,t){let i=e.selection,r=Yr(e.annotations);return e.userEvent&&(r=r.concat(Le.userEvent.of(e.userEvent))),{changes:e.changes instanceof Je?e.changes:Je.of(e.changes||[],t,n.facet(dy)),selection:i&&(i instanceof R?i:R.single(i.anchor,i.head)),effects:Yr(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function xy(n,e,t){let i=Zu(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;i=vy(i,Zu(n,e[s],o?i.changes.newLength:n.doc.length),o)}let r=Le.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return HC(t?WC(r):r)}function WC(n){let e=n.startState,t=!0;for(let r of e.facet(py)){let s=r(n);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:zC(t,s))}if(t!==!0){let r,s;if(t===!1)s=n.changes.invertedDesc,r=Je.empty(e.doc.length);else{let o=n.changes.filter(t);r=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}n=Le.create(e,r,n.selection&&n.selection.map(s),U.mapEffects(n.effects,s),n.annotations,n.scrollIntoView)}let i=e.facet(my);for(let r=i.length-1;r>=0;r--){let s=i[r](n);s instanceof Le?n=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Le?n=s[0]:n=xy(e,Yr(s),!1)}return n}function HC(n){let e=n.startState,t=e.facet(gy),i=n;for(let r=t.length-1;r>=0;r--){let s=t[r](n);s&&Object.keys(s).length&&(i=vy(i,Zu(e,s,n.changes.newLength),!0))}return i==n?n:Le.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}var XC=[];function Yr(n){return n==null?XC:Array.isArray(n)?n:[n]}var Ge=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(Ge||(Ge={})),UC=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,ef;try{ef=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function YC(n){if(ef)return ef.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>"\x80"&&(t.toUpperCase()!=t.toLowerCase()||UC.test(t)))return!0}return!1}function KC(n){return e=>{if(!/\S/.test(e))return Ge.Space;if(YC(e))return Ge.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return Ge.Word;return Ge.Other}}var he=class n{constructor(e,t,i,r,s,o){this.config=e,this.doc=t,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)wo(this,a<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return wo(this,i),hl(this,i)}update(...e){return xy(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:r}=t;for(let a of e.effects)a.is(Pi.reconfigure)?(t&&(r=new Map,t.compartments.forEach((l,c)=>r.set(c,l)),t=null),r.set(a.value.compartment,a.value.extension)):a.is(U.reconfigure)?(t=null,i=a.value):a.is(U.appendConfig)&&(t=null,i=Yr(i).concat(a.value));let s;t?s=e.startState.values.slice():(t=fl.resolve(i,r,this),s=new n(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=e.startState.facet(Ku)?e.newSelection:e.newSelection.asSingle();new n(t,e.newDoc,o,s,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:R.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),r=this.changes(i.changes),s=[i.range],o=Yr(i.effects);for(let a=1;a<t.ranges.length;a++){let l=e(t.ranges[a]),c=this.changes(l.changes),u=c.map(r);for(let h=0;h<a;h++)s[h]=s[h].map(u);let f=r.mapDesc(c,!0);s.push(l.range.map(f)),r=r.compose(u),o=U.mapEffects(o,u).concat(U.mapEffects(Yr(l.effects),f))}return{changes:r,selection:R.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof Je?e:Je.of(e,this.doc.length,this.facet(n.lineSeparator))}toText(e){return J.of(e.split(this.facet(n.lineSeparator)||Hu))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(wo(this,t),hl(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let r=e[i];r instanceof Ne&&this.config.address[r.id]!=null&&(t[i]=r.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let o=i[s],a=e[s];r.push(o.init(l=>o.spec.fromJSON(a,l)))}}return n.create({doc:e.doc,selection:R.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=fl.resolve(e.extensions||[],new Map),i=e.doc instanceof J?e.doc:J.of((e.doc||"").split(t.staticFacet(n.lineSeparator)||Hu)),r=e.selection?e.selection instanceof R?e.selection:R.single(e.selection.anchor,e.selection.head):R.single(0);return fy(r,i.length),t.staticFacet(Ku)||(r=r.asSingle()),new n(t,i,r,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(n.tabSize)}get lineBreak(){return this.facet(n.lineSeparator)||` method in anonymousFunctionfc9810193db00.tg.Ga.anonymousObjectfc98101948605.constructor.anonymousObjectfc9810194b505.constructor.anonymousObjectfc9810194ea05.constructor.st.AC.ty.Tn.constructor.Je.constructor.he
22 `;this.styleTag.textContent=o;let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var Pn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Gr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},JC=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),ZC=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Se=0;Se<10;Se++)Pn[48+Se]=Pn[96+Se]=String(Se);var Se;for(Se=1;Se<=24;Se++)Pn[Se+111]="F"+Se;var Se;for(Se=65;Se<=90;Se++)Pn[Se]=String.fromCharCode(Se+32),Gr[Se]=String.fromCharCode(Se);var Se;for(pl in Pn)Gr.hasOwnProperty(pl)||(Gr[pl]=Pn[pl]);var pl;function Cy(n){var e=JC&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||ZC&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Gr:Pn)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function yt(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var r=t[i];typeof r=="string"?n.setAttribute(i,r):r!=null&&(n[i]=r)}e++}for(;e<arguments.length;e++)Sy(n,arguments[e]);return n}function Sy(n,e){if(typeof e=="string")n.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)n.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)Sy(n,e[t]);else throw new RangeError("Unsupported child node: "+e)}var Ze=typeof navigator!="undefined"?navigator:{userAgent:"",vendor:"",platform:""},gf=typeof document!="undefined"?document:{documentElement:{style:{}}},yf=/Edge\/(\d+)/.exec(Ze.userAgent),i0=/MSIE \d/.test(Ze.userAgent),vf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ze.userAgent),Vl=!!(i0||vf||yf),Ey=!Vl&&/gecko\/(\d+)/i.test(Ze.userAgent),ff=!Vl&&/Chrome\/(\d+)/.exec(Ze.userAgent),Ay="webkitFontSmoothing"in gf.documentElement.style,xf=!Vl&&/Apple Computer/.test(Ze.vendor),_y=xf&&(/Mobile\/\w+/.test(Ze.userAgent)||Ze.maxTouchPoints>2),N={mac:_y||/Mac/.test(Ze.platform),windows:/Win/.test(Ze.platform),linux:/Linux|X11/.test(Ze.platform),ie:Vl,ie_version:i0?gf.documentMode||6:vf?+vf[1]:yf?+yf[1]:0,gecko:Ey,gecko_version:Ey?+(/Firefox\/(\d+)/.exec(Ze.userAgent)||[0,0])[1]:0,chrome:!!ff,chrome_version:ff?+ff[1]:0,ios:_y,android:/Android\b/.test(Ze.userAgent),webkit:Ay,webkit_version:Ay?+(/\bAppleWebKit\/(\d+)/.exec(Ze.userAgent)||[0,0])[1]:0,safari:xf,safari_version:xf?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Ze.userAgent)||[0,0])[1]:0,tabSize:gf.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function nh(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}var El=Object.create(null);function ih(n,e,t){if(n==e)return!0;n||(n=El),e||(e=El);let i=Object.keys(n),r=Object.keys(e);if(i.length-(t&&i.indexOf(t)>-1?1:0)!=r.length-(t&&r.indexOf(t)>-1?1:0))return!1;for(let s of i)if(s!=t&&(r.indexOf(s)==-1||n[s]!==e[s]))return!1;return!0}function eS(n,e){for(let t=n.attributes.length-1;t>=0;t--){let i=n.attributes[t].name;e[i]==null&&n.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?n.style.cssText=i:n.getAttribute(t)!=i&&n.setAttribute(t,i)}}function Ty(n,e,t){let i=!1;if(e)for(let r in e)t&&r in t||(i=!0,r=="style"?n.style.cssText="":n.removeAttribute(r));if(t)for(let r in t)e&&e[r]==t[r]||(i=!0,r=="style"?n.style.cssText=t[r]:n.setAttribute(r,t[r]));return i}function tS(n){let e=Object.create(null);for(let t=0;t<n.attributes.length;t++){let i=n.attributes[t];e[i.name]=i.value}return e}var Dt=class{eq(e){return!1}updateDOM(e,t,i){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},Pt=(function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n})(Pt||(Pt={})),X=class extends Et{constructor(e,t,i,r){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=r}get heightRelevant(){return!1}static mark(e){return new Io(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new $i(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,r;if(e.isBlockGap)i=-5e8,r=4e8;else{let{start:s,end:o}=r0(e,t);i=(s?t?-3e8:-1:5e8)-1,r=(o?t?2e8:1:-6e8)+1}return new $i(e,i,r,t,e.widget||null,!0)}static line(e){return new $o(e)}static set(e,t=!1){return re.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};X.none=re.empty;var Io=class n extends X{constructor(e){let{start:t,end:i}=r0(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?nh(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||El}eq(e){return this==e||e instanceof n&&this.tagName==e.tagName&&ih(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}};Io.prototype.point=!1;var $o=class n extends X{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof n&&this.spec.class==e.spec.class&&ih(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}};$o.prototype.mapMode=Ee.TrackBefore;$o.prototype.point=!0;var $i=class n extends X{constructor(e,t,i,r,s,o){super(t,i,s,e),this.block=r,this.isReplace=o,this.mapMode=r?t<=0?Ee.TrackBefore:Ee.TrackAfter:Ee.TrackDel}get type(){return this.startSide!=this.endSide?Pt.WidgetRange:this.startSide<=0?Pt.WidgetBefore:Pt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof n&&nS(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}};$i.prototype.point=!0;function r0(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t!=null?t:e,end:i!=null?i:e}}function nS(n,e){return n==e||!!(n&&e&&n.compare(e))}function ns(n,e,t,i=0){let r=t.length-1;r>=0&&t[r]+i>=n?t[r]=Math.max(t[r],e):t.push(n,e)}var Al=class n extends Et{constructor(e,t,i){super(),this.tagName=e,this.attributes=t,this.rank=i}eq(e){return e==this||e instanceof n&&this.tagName==e.tagName&&ih(this.attributes,e.attributes)}static create(e){return new n(e.tagName,e.attributes||El,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return re.of(e,t)}};Al.prototype.startSide=Al.prototype.endSide=-1;function Lo(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function bf(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function Ao(n,e){if(!e.anchorNode)return!1;try{return bf(n,e.anchorNode)}catch{return!1}}function _o(n){return n.nodeType==3?qo(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function To(n,e,t,i){return t?My(n,e,t,i,-1)||My(n,e,t,i,1):!1}function ii(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function _l(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function My(n,e,t,i,r){for(;;){if(n==t&&e==i)return!0;if(e==(r<0?0:In(n))){if(n.nodeName=="DIV")return!1;let s=n.parentNode;if(!s||s.nodeType!=1)return!1;e=ii(n)+(r<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(r<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=r<0?In(n):0}else return!1}}function In(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function No(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function iS(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function s0(n,e){let t=e.width/n.offsetWidth,i=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-n.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function rS(n,e,t,i,r,s,o,a){let l=n.ownerDocument,c=l.defaultView||window;for(let u=n,f=!1;u&&!f;)if(u.nodeType==1){let h,d=u==l.body,p=1,m=1;if(d)h=iS(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(f=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let w=u.getBoundingClientRect();({scaleX:p,scaleY:m}=s0(u,w)),h={left:w.left,right:w.left+u.clientWidth*p,top:w.top,bottom:w.top+u.clientHeight*m}}let y=0,g=0;if(r=="nearest")e.top<h.top+o?(g=e.top-(h.top+o),t>0&&e.bottom>h.bottom+g&&(g=e.bottom-h.bottom+o)):e.bottom>h.bottom-o&&(g=e.bottom-h.bottom+o,t<0&&e.top-g<h.top&&(g=e.top-(h.top+o)));else{let w=e.bottom-e.top,x=h.bottom-h.top;g=(r=="center"&&w<=x?e.top+w/2-x/2:r=="start"||r=="center"&&t<0?e.top-o:e.bottom-x+o)-h.top}if(i=="nearest"?e.left<h.left+s?(y=e.left-(h.left+s),t>0&&e.right>h.right+y&&(y=e.right-h.right+s)):e.right>h.right-s&&(y=e.right-h.right+s,t<0&&e.left<h.left+y&&(y=e.left-(h.left+s))):y=(i=="center"?e.left+(e.right-e.left)/2-(h.right-h.left)/2:i=="start"==a?e.left-s:e.right-(h.right-h.left)+s)-h.left,y||g)if(d)c.scrollBy(y,g);else{let w=0,x=0;if(g){let b=u.scrollTop;u.scrollTop+=g/m,x=(u.scrollTop-b)*m}if(y){let b=u.scrollLeft;u.scrollLeft+=y/p,w=(u.scrollLeft-b)*p}e={left:e.left-w,top:e.top-x,right:e.right-w,bottom:e.bottom-x},w&&Math.abs(w-y)<1&&(i="nearest"),x&&Math.abs(x-g)<1&&(r="nearest")}if(d)break;(e.top<h.top||e.bottom>h.bottom||e.left<h.left||e.right>h.right)&&(e={left:Math.max(e.left,h.left),right:Math.min(e.right,h.right),top:Math.max(e.top,h.top),bottom:Math.min(e.bottom,h.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function o0(n,e=!0){let t=n.ownerDocument,i=null,r=null;for(let s=n.parentNode;s&&!(s==t.body||(!e||i)&&r);)if(s.nodeType==1)!r&&s.scrollHeight>s.clientHeight&&(r=s),e&&!i&&s.scrollWidth>s.clientWidth&&(i=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:i,y:r}}var wf=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?In(t):0),i,Math.min(e.focusOffset,i?In(i):0))}set(e,t,i,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=r}},Bi=null;N.safari&&N.safari_version>=26&&(Bi=!1);function a0(n){if(n.setActive)return n.setActive();if(Bi)return n.focus(Bi);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(Bi==null?{get preventScroll(){return Bi={preventScroll:!0},!0}}:void 0),!Bi){Bi=!1;for(let t=0;t<e.length;){let i=e[t++],r=e[t++],s=e[t++];i.scrollTop!=r&&(i.scrollTop=r),i.scrollLeft!=s&&(i.scrollLeft=s)}}}var Ry;function qo(n,e,t=e){let i=Ry||(Ry=document.createRange());return i.setEnd(n,t),i.setStart(n,e),i}function is(n,e,t,i){let r={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=i);let s=new KeyboardEvent("keydown",r);s.synthetic=!0,n.dispatchEvent(s);let o=new KeyboardEvent("keyup",r);return o.synthetic=!0,n.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function sS(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function oS(n,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(i=Math.min(i,In(t));;)if(i){if(t.nodeType!=1)return!1;let r=t.childNodes[i-1];r.contentEditable=="false"?i--:(t=r,i=In(t))}else{if(t==n)return!0;i=ii(t),t=t.parentNode}}function l0(n){return n instanceof Window?n.pageYOffset>Math.max(0,n.document.documentElement.scrollHeight-n.innerHeight-4):n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function c0(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=In(t)}else if(t.parentNode&&!_l(t))i=ii(t),t=t.parentNode;else return null}}function u0(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i<t.nodeValue.length)return{node:t,offset:i};if(t.nodeType==1&&i<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[i],i=0}else if(t.parentNode&&!_l(t))i=ii(t)+1,t=t.parentNode;else return null}}var hn=class n{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new n(e.parentNode,ii(e),t)}static after(e,t){return new n(e.parentNode,ii(e)+1,t)}},ue=(function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n})(ue||(ue={})),Li=ue.LTR,rh=ue.RTL;function f0(n){let e=[];for(let t=0;t<n.length;t++)e.push(1<<+n[t]);return e}var aS=f0("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),lS=f0("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Of=Object.create(null),fn=[];for(let n of["()","[]","{}"]){let e=n.charCodeAt(0),t=n.charCodeAt(1);Of[e]=t,Of[t]=-e}function h0(n){return n<=247?aS[n]:1424<=n&&n<=1524?2:1536<=n&&n<=1785?lS[n-1536]:1774<=n&&n<=2220?4:8192<=n&&n<=8204?256:64336<=n&&n<=65023?4:1}var cS=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,Rt=class{get dir(){return this.level%2?rh:Li}constructor(e,t,i){this.from=e,this.to=t,this.level=i}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,i,r){let s=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=t&&a.to>=t){if(a.level==i)return o;(s<0||(r!=0?r<0?a.from<t:a.to>t:e[s].level>a.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}};function d0(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++){let i=n[t],r=e[t];if(i.from!=r.from||i.to!=r.to||i.direction!=r.direction||!d0(i.inner,r.inner))return!1}return!0}var se=[];function uS(n,e,t,i,r){for(let s=0;s<=i.length;s++){let o=s?i[s-1].to:e,a=s<i.length?i[s].from:t,l=s?256:r;for(let c=o,u=l,f=l;c<a;c++){let h=h0(n.charCodeAt(c));h==512?h=u:h==8&&f==4&&(h=16),se[c]=h==4?2:h,h&7&&(f=h),u=h}for(let c=o,u=l,f=l;c<a;c++){let h=se[c];if(h==128)c<a-1&&u==se[c+1]&&u&24?h=se[c]=u:se[c]=256;else if(h==64){let d=c+1;for(;d<a&&se[d]==64;)d++;let p=c&&u==8||d<t&&se[d]==8?f==1?1:8:256;for(let m=c;m<d;m++)se[m]=p;c=d-1}else h==8&&f==1&&(se[c]=1);u=h,h&7&&(f=h)}}}function fS(n,e,t,i,r){let s=r==1?2:1;for(let o=0,a=0,l=0;o<=i.length;o++){let c=o?i[o-1].to:e,u=o<i.length?i[o].from:t;for(let f=c,h,d,p;f<u;f++)if(d=Of[h=n.charCodeAt(f)])if(d<0){for(let m=a-3;m>=0;m-=3)if(fn[m+1]==-d){let y=fn[m+2],g=y&2?r:y&4?y&1?s:r:0;g&&(se[f]=se[fn[m]]=g),a=m;break}}else{if(fn.length==189)break;fn[a++]=f,fn[a++]=h,fn[a++]=l}else if((p=se[f])==2||p==1){let m=p==r;l=m?0:1;for(let y=a-3;y>=0;y-=3){let g=fn[y+2];if(g&2)break;if(m)fn[y+2]|=2;else{if(g&4)break;fn[y+2]|=4}}}}}function hS(n,e,t,i){for(let r=0,s=i;r<=t.length;r++){let o=r?t[r-1].to:n,a=r<t.length?t[r].from:e;for(let l=o;l<a;){let c=se[l];if(c==256){let u=l+1;for(;;)if(u==a){if(r==t.length)break;u=t[r++].to,a=r<t.length?t[r].from:e}else if(se[u]==256)u++;else break;let f=s==1,h=(u<e?se[u]:i)==1,d=f==h?f?1:2:i;for(let p=u,m=r,y=m?t[m-1].to:n;p>l;)p==y&&(p=t[--m].from,y=m?t[m-1].to:n),se[--p]=d;l=u}else s=c,l++}}}function kf(n,e,t,i,r,s,o){let a=i%2?2:1;if(i%2==r%2)for(let l=e,c=0;l<t;){let u=!0,f=!1;if(c==s.length||l<s[c].from){let m=se[l];m!=a&&(u=!1,f=m==16)}let h=!u&&a==1?[]:null,d=u?i:i+1,p=l;e:for(;;)if(c<s.length&&p==s[c].from){if(f)break e;let m=s[c];if(!u)for(let y=m.to,g=c+1;;){if(y==t)break e;if(g<s.length&&s[g].from==y)y=s[g++].to;else{if(se[y]==a)break e;break}}if(c++,h)h.push(m);else{m.from>l&&o.push(new Rt(l,m.from,d));let y=m.direction==Li!=!(d%2);Cf(n,y?i+1:i,r,m.inner,m.from,m.to,o),l=m.to}p=m.to}else{if(p==t||(u?se[p]!=a:se[p]==a))break;p++}h?kf(n,l,p,i+1,r,h,o):l<p&&o.push(new Rt(l,p,d)),l=p}else for(let l=t,c=s.length;l>e;){let u=!0,f=!1;if(!c||l>s[c-1].to){let m=se[l-1];m!=a&&(u=!1,f=m==16)}let h=!u&&a==1?[]:null,d=u?i:i+1,p=l;e:for(;;)if(c&&p==s[c-1].to){if(f)break e;let m=s[--c];if(!u)for(let y=m.from,g=c;;){if(y==e)break e;if(g&&s[g-1].to==y)y=s[--g].from;else{if(se[y-1]==a)break e;break}}if(h)h.push(m);else{m.to<l&&o.push(new Rt(m.to,l,d));let y=m.direction==Li!=!(d%2);Cf(n,y?i+1:i,r,m.inner,m.from,m.to,o),l=m.from}p=m.from}else{if(p==e||(u?se[p-1]!=a:se[p-1]==a))break;p--}h?kf(n,p,l,i+1,r,h,o):p<l&&o.push(new Rt(p,l,d)),l=p}}function Cf(n,e,t,i,r,s,o){let a=e%2?2:1;uS(n,r,s,i,a),fS(n,r,s,i,a),hS(r,s,i,a),kf(n,r,s,e,t,i,o)}function dS(n,e,t){if(!n)return[new Rt(0,0,e==rh?1:0)];if(e==Li&&!t.length&&!cS.test(n))return p0(n.length);if(t.length)for(;n.length>se.length;)se[se.length]=256;let i=[],r=e==Li?0:1;return Cf(n,r,r,t,0,n.length,i),i}function p0(n){return[new Rt(0,n,0)]}var m0="";function pS(n,e,t,i,r){var s;let o=i.head-n.from,a=Rt.find(e,o,(s=i.bidiLevel)!==null&&s!==void 0?s:-1,i.assoc),l=e[a],c=l.side(r,t);if(o==c){let h=a+=r?1:-1;if(h<0||h>=e.length)return null;l=e[a=h],o=l.side(!r,t),c=l.side(r,t)}let u=Re(n.text,o,l.forward(r,t));(u<l.from||u>l.to)&&(u=c),m0=n.text.slice(Math.min(o,u),Math.max(o,u));let f=a==(r?e.length-1:0)?null:e[a+(r?1:-1)];return f&&u==c&&f.level+(r?0:1)<l.level?R.cursor(f.side(!r,t)+n.from,f.forward(r,t)?1:-1,f.level):R.cursor(u+n.from,l.forward(r,t)?-1:1,l.level)}function mS(n,e,t){for(let i=e;i<t;i++){let r=h0(n.charCodeAt(i));if(r==1)return Li;if(r==2||r==4)return rh}return Li}var g0=L.define(),y0=L.define(),v0=L.define(),x0=L.define(),Sf=L.define(),b0=L.define(),w0=L.define(),sh=L.define(),oh=L.define(),O0=L.define({combine:n=>n.some(e=>e)}),gS=L.define({combine:n=>n.some(e=>e)}),k0=L.define(),Mo=class n{constructor(e,t,i,r,s,o=!1){this.range=e,this.y=t,this.x=i,this.yMargin=r,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new n(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new n(R.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},ml=U.define({map:(n,e)=>n.map(e)}),C0=U.define();function Pe(n,e,t){let i=n.facet(x0);i.length?i[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}var Dn=L.define({combine:n=>n.length?n[0]:!0}),yS=0,Zr=L.define({combine(n){return n.filter((e,t)=>{for(let i=0;i<t;i++)if(n[i].plugin==e.plugin)return!1;return!0})}}),ze=class n{constructor(e,t,i,r,s){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=r,this.baseExtensions=s(this),this.extension=this.baseExtensions.concat(Zr.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Zr.of({plugin:this,arg:e}))}static define(e,t){let{eventHandlers:i,eventObservers:r,provide:s,decorations:o}=t||{};return new n(yS++,e,i,r,a=>{let l=[];return o&&l.push(Ql.of(c=>{let u=c.plugin(a);return u?o(u):X.none})),s&&l.push(s(a)),l})}static fromClass(e,t){return n.define((i,r)=>new e(i,r),t)}},Ro=class{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(Pe(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Pe(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){Pe(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}},S0=L.define(),ah=L.define(),Ql=L.define(),E0=L.define(),lh=L.define(),Fo=L.define(),A0=L.define();function Py(n,e){let t=n.state.facet(A0);if(!t.length)return t;let i=t.map(s=>s instanceof Function?s(n):s),r=[];return re.spans(i,e.from,e.to,{point(){},span(s,o,a,l){let c=s-e.from,u=o-e.from,f=r;for(let h=a.length-1;h>=0;h--,l--){let d=a[h].spec.bidiIsolate,p;if(d==null&&(d=mS(e.text,c,u)),l>0&&f.length&&(p=f[f.length-1]).to==c&&p.direction==d)p.to=u,f=p.inner;else{let m={from:c,to:u,direction:d,inner:[]};f.push(m),f=m.inner}}}}),r}var _0=L.define();function ch(n){let e=0,t=0,i=0,r=0;for(let s of n.state.facet(_0)){let o=s(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(r=Math.max(r,o.bottom)))}return{left:e,right:t,top:i,bottom:r}}var So=L.define(),Ht=class n{constructor(e,t,i,r){this.fromA=e,this.toA=t,this.fromB=i,this.toB=r}join(e){return new n(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>i.toA)){if(r.toA<i.fromA)break;i=i.join(r),e.splice(t-1,1)}}return e.splice(t,0,i),e}static extendWithRanges(e,t){if(t.length==0)return e;let i=[];for(let r=0,s=0,o=0;;){let a=r<e.length?e[r].fromB:1e9,l=s<t.length?t[s]:1e9,c=Math.min(a,l);if(c==1e9)break;let u=c+o,f=c,h=u;for(;;)if(s<t.length&&t[s]<=f){let d=t[s+1];s+=2,f=Math.max(f,d);for(let p=r;p<e.length&&e[p].fromB<=f;p++)o=e[p].toA-e[p].toB;h=Math.max(h,d+o)}else if(r<e.length&&e[r].fromB<=f){let d=e[r++];f=Math.max(f,d.toB),h=Math.max(h,d.toA),o=d.toA-d.toB}else break;i.push(new n(u,h,c,f))}return i}},Tl=class n{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=Je.empty(this.startState.doc.length);for(let s of i)this.changes=this.changes.compose(s.changes);let r=[];this.changes.iterChangedRanges((s,o,a,l)=>r.push(new Ht(s,o,a,l))),this.changedRanges=r}static create(e,t,i){return new n(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},vS=[],pe=class{constructor(e,t,i=0){this.dom=e,this.length=t,this.flags=i,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return vS}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&eS(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let i=t;for(let r of this.children){if(r==e)return i;i+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let i=ii(this.dom),r=this.length?e>0:t>0;return new hn(this.parent.dom,i+(r?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof ss)return e;return null}static get(e){return e.cmTile}},rs=class extends pe{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,i=null,r,s=(e==null?void 0:e.node)==t?e:null,o=0;for(let a of this.children){if(a.sync(e),o+=a.length+a.breakAfter,r=i?i.nextSibling:t.firstChild,s&&r!=a.dom&&(s.written=!0),a.dom.parentNode==t)for(;r&&r!=a.dom;)r=Dy(r);else t.insertBefore(a.dom,r);i=a.dom}for(r=i?i.nextSibling:t.firstChild,s&&r&&(s.written=!0);r;)r=Dy(r);this.length=o}};function Dy(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}var ss=class extends rs{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=pe.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],i=this,r=0,s=0;;)if(r==i.children.length){if(!t.length)return;i=i.parent,i.breakAfter&&s++,r=t.pop()}else{let o=i.children[r++];if(o instanceof Bn)t.push(r),i=o,r=0;else{let a=s+o.length,l=e(o,s);if(l!==void 0)return l;s=a+o.breakAfter}}}resolveBlock(e,t){let i,r=-1,s,o=-1;if(this.blockTiles((a,l)=>{let c=l+a.length;if(e>=l&&e<=c){if(a.isWidget()&&t>=-1&&t<=1){if(a.flags&32)return!0;a.flags&16&&(i=void 0)}(l<e||e==c&&(t<-1?a.length:a.covers(1)))&&(!i||!a.isWidget()&&i.isWidget())&&(i=a,r=e-l),(c>e||e==l&&(t>1?a.length:a.covers(-1)))&&(!s||!a.isWidget()&&s.isWidget())&&(s=a,o=e-l)}}),!i&&!s)throw new Error("No tile at position "+e);return i&&t<0||!s?{tile:i,offset:r}:{tile:s,offset:o}}},Bn=class n extends rs{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let i=new n(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}},os=class n extends rs{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,i){let r=new n(t||document.createElement("div"),e);return(!t||!i)&&(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(e,t,i){let r=null,s=-1,o=null,a=-1;function l(u,f){for(let h=0,d=0;h<u.children.length&&d<=f;h++){let p=u.children[h],m=d+p.length;m>=f&&(p.isComposite()?l(p,f-d):(!o||o.isHidden&&(t>0||i&&bS(o,p)))&&(m>f||p.flags&32)?(o=p,a=f-d):(d<f||p.flags&16&&!p.isHidden)&&(r=p,s=f-d)),d=m}}l(this,e);let c=(t<0?r:o)||r||o;return c?{tile:c,offset:c==r?s:a}:null}coordsIn(e,t){let i=this.resolveInline(e,t,!0);return i?i.tile.coordsIn(Math.max(0,i.offset),t):xS(this)}domIn(e,t){let i=this.resolveInline(e,t);if(i){let{tile:r,offset:s}=i;if(this.dom.contains(r.dom))return r.isText()?new hn(r.dom,Math.min(r.dom.nodeValue.length,s)):r.domPosFor(s,r.flags&16?1:r.flags&32?-1:t);let o=i.tile.parent,a=!1;for(let l of o.children){if(a)return new hn(l.dom,0);l==i.tile&&(a=!0)}}return new hn(this.dom,0)}};function xS(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=_o(e);return t[t.length-1]||null}function bS(n,e){let t=n.coordsIn(0,1),i=e.coordsIn(0,1);return t&&i&&i.top<t.bottom}var ot=class n extends rs{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let i=new n(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}},Ii=class n extends pe{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t){let i=this.dom.nodeValue.length;e>i&&(e=i);let r=e,s=e,o=0;e==0&&t<0||e==i&&t>=0?N.chrome||N.gecko||(e?(r--,o=1):s<i&&(s++,o=-1)):t<0?r--:s<i&&s++;let a=qo(this.dom,r,s).getClientRects();if(!a.length)return null;let l=a[(o?o<0:t>=0)?0:a.length-1];return N.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?No(l,o<0):l||null}static of(e,t){let i=new n(t||document.createTextNode(e),e);return t||(i.flags|=2),i}},Ni=class n extends pe{constructor(e,t,i,r){super(e,t,r),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,i){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(i)return No(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let s=this.dom.getClientRects(),o=null;if(!s.length)return null;let a=this.flags&16?!0:this.flags&32?!1:e>0;for(let l=a?s.length-1:0;o=s[l],!(e>0?l==0:l==s.length-1||o.top<o.bottom);l+=a?-1:1);return No(o,!a)}}get overrideDOMText(){if(!this.length)return J.empty;let{root:e}=this;if(!e)return J.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,i,r,s){return s||(s=e.toDOM(t),e.editable||(s.contentEditable="false")),new n(s,i,e,r)}},as=class extends pe{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return J.empty}coordsIn(e){return this.dom.getBoundingClientRect()}},Ef=class{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,i){let{tile:r,index:s,beforeBreak:o,parents:a}=this;for(;e||t>0;)if(r.isComposite())if(o){if(!e)break;i&&i.break(),e--,o=!1}else if(s==r.children.length){if(!e&&!a.length)break;i&&i.leave(r),o=!!r.breakAfter,{tile:r,index:s}=a.pop(),s++}else{let l=r.children[s],c=l.breakAfter;(t>0?l.length<=e:l.length<e)&&(!i||i.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!c,s++,e-=l.length):(a.push({tile:r,index:s}),r=l,s=0,i&&l.isComposite()&&i.enter(l))}else if(s==r.length)o=!!r.breakAfter,{tile:r,index:s}=a.pop(),s++;else if(e){let l=Math.min(e,r.length-s);i&&i.skip(r,s,s+l),e-=l,s+=l}else break;return this.tile=r,this.index=s,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}},Af=class{constructor(e,t,i,r){this.from=e,this.to=t,this.wrapper=i,this.rank=r}},_f=class{constructor(e,t,i){this.cache=e,this.root=t,this.blockWrappers=i,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,i,r){var s;this.flushBuffer();let o=this.ensureMarks(t,i),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+e.length<512){this.cache.reused.set(a,2);let l=o.children[o.children.length-1]=new Ii(a.dom,a.text+e);l.parent=o}else o.append(r||Ii.of(e,(s=this.cache.find(Ii))===null||s===void 0?void 0:s.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let i=this.curLine;i.dom!=t.line.dom&&(i.setDOM(this.cache.reused.has(t.line)?hf(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let r=i;for(let a=t.marks.length-1;a>=0;a--){let l=t.marks[a],c=r.lastChild;if(c instanceof ot&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM(hf(l.dom)),r=c;else{if(this.cache.reused.get(l)){let f=pe.get(l.dom);f&&f.setDOM(hf(l.dom))}let u=ot.of(l.mark,l.dom);r.append(u),r=u}this.cache.reused.set(l,2)}let s=pe.get(e.text);s&&this.cache.reused.set(s,2);let o=new Ii(e.text,e.text.nodeValue);o.flags|=8,this.pos=e.range.toB,r.append(o)}addInlineWidget(e,t,i){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let s=this.ensureMarks(t,i);!r&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,i){this.flushBuffer(),this.ensureMarks(t,i).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var i;e||(e=T0);let r=os.start(e,t||((i=this.cache.find(os))===null||i===void 0?void 0:i.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var i;let r=this.curLine;for(let s=e.length-1;s>=0;s--){let o=e[s],a;if(t>0&&(a=r.lastChild)&&a instanceof ot&&a.mark.eq(o))r=a,t--;else{let l=ot.of(o,(i=this.cache.find(ot,c=>c.mark.eq(o)))===null||i===void 0?void 0:i.dom);r.append(l),r=l,t=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!By(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(N.ios&&By(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(df,0,32)||new Ni(df.toDOM(),0,df,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=e.rank*102+e.value.rank,i=new Af(e.from,e.to,e.value,t),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-i.rank||this.wrappers[r-1].to-i.to)<0;)r--;this.wrappers.splice(r,0,i)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let i of this.wrappers){let r=t.lastChild;if(i.from<this.pos&&r instanceof Bn&&r.wrapper.eq(i.wrapper))t=r;else{let s=Bn.of(i.wrapper,(e=this.cache.find(Bn,o=>o.wrapper.eq(i.wrapper)))===null||e===void 0?void 0:e.dom);t.append(s),t=s}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),i=this.cache.find(as,void 0,1);return i&&(i.flags=t),i||new as(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},Tf=class{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:r,lineBreak:s,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=r;let a=this.textOff=Math.min(e,r.length);return s?null:r.slice(0,a)}let t=Math.min(this.text.length,this.textOff+e),i=this.text.slice(this.textOff,t);return this.textOff=t,i}},Ml=[Ni,os,Ii,ot,as,Bn,ss];for(let n=0;n<Ml.length;n++)Ml[n].bucket=n;var Mf=class{constructor(e){this.view=e,this.buckets=Ml.map(()=>[]),this.index=Ml.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,i=this.buckets[t];i.length<6?i.push(e):i[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,i=2){let r=e.bucket,s=this.buckets[r],o=this.index[r];for(let a=s.length-1;a>=0;a--){let l=(a+o)%s.length,c=s[l];if((!t||t(c))&&!this.reused.has(c))return s.splice(l,1),l<o&&this.index[r]--,this.reused.set(c,i),c}return null}findWidget(e,t,i){let r=this.buckets[0];if(r.length)for(let s=0,o=0;;s++){if(s==r.length){if(o)return null;o=1,s=0}let a=r[s];if(!this.reused.has(a)&&(o==0?a.widget.compare(e):a.widget.constructor==e.constructor&&e.updateDOM(a.dom,this.view,a.widget)))return r.splice(s,1),s<this.index[0]&&this.index[0]--,a.widget==e&&a.length==t&&(a.flags&497)==i?(this.reused.set(a,1),a):(this.reused.set(a,2),new Ni(a.dom,t,e,a.flags&-498|i))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}},Rf=class{constructor(e,t,i,r,s){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=s,this.openWidget=!1,this.openMarks=0,this.cache=new Mf(e),this.text=new Tf(e.state.doc),this.builder=new _f(this.cache,new ss(e,e.contentDOM),re.iter(i)),this.cache.reused.set(t,2),this.old=new Ef(t),this.reuseWalker={skip:(o,a,l)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let i=t&&this.getCompositionContext(t.text);for(let r=0,s=0,o=0;;){let a=o<e.length?e[o++]:null,l=a?a.fromA:this.old.root.length;if(l>r){let c=l-r;this.preserve(c,!o,!a),r=l,s+=c}if(!a)break;t&&a.fromA<=t.range.fromA&&a.toA>=t.range.toA?(this.forward(a.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(s,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,i),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,a.toA),this.emit(t.range.toB,a.toB)):(this.forward(a.fromA,a.toA),this.emit(s,a.toB)),s=a.toB,r=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,i){let r=kS(this.old),s=this.openMarks;this.old.advance(e,i?1:-1,{skip:(o,a,l)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(l-a);else{let c=l>0||a<o.length?Ni.of(o.widget,this.view,l-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);c.flags&256?(c.flags&=-2,this.builder.addBlockWidget(c)):(this.builder.ensureLine(null),this.builder.addInlineWidget(c,r,s),s=r.length)}else if(o.isText())this.builder.ensureLine(null),!a&&l==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,r,s,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,l),r,s)),s=r.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof as)this.cache.add(o);else if(o instanceof ot)this.builder.ensureLine(null),this.builder.addMark(o,r,s),this.cache.reused.set(o,1),s=r.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof ot&&r.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?r.length&&(r.length=s=0):o instanceof ot&&(r.shift(),s=Math.min(s,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let i=null,r=this.builder,s=0,o=re.spans(this.decorations,e,t,{point:(a,l,c,u,f,h)=>{if(c instanceof $i){if(this.disallowBlockEffectsFor[h]){if(c.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=u.length,f>u.length)r.continueWidget(l-a);else{let d=c.widget||(c.block?ri.block:ri.inline),p=wS(c),m=this.cache.findWidget(d,l-a,p)||Ni.of(d,this.view,l-a,p);c.block?(c.startSide>0&&r.addLineStartIfNotCovered(i),r.addBlockWidget(m)):(r.ensureLine(i),r.addInlineWidget(m,u,f))}i=null}else i=OS(i,c);l>a&&this.text.skip(l-a)},span:(a,l,c,u)=>{for(let f=a;f<l;){let h=this.text.next(Math.min(512,l-f));h==null?(r.addLineStartIfNotCovered(i),r.addBreak(),f++):(r.ensureLine(i),r.addText(h,c,f==a?u:c.length),f+=h.length),i=null}}});r.addLineStartIfNotCovered(i),this.openWidget=o>s,this.openMarks=o}forward(e,t,i=1){t-e<=10?this.old.advance(t-e,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(e){let t=[],i=null;for(let r=e.parentNode;;r=r.parentNode){let s=pe.get(r);if(r==this.view.contentDOM)break;s instanceof ot?t.push(s):s!=null&&s.isLine()?i=s:s instanceof Bn||(r.nodeName=="DIV"&&!i&&r!=this.view.contentDOM?i=new os(r,T0):i||t.push(ot.of(new Io({tagName:r.nodeName.toLowerCase(),attributes:tS(r)}),r)))}return{line:i,marks:t}}};function By(n,e){let t=i=>{for(let r of i.children)if((e?r.isText():r.length)||t(r))return!0;return!1};return t(n)}function wS(n){let e=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(e|=256),e}var T0={class:"cm-line"};function OS(n,e){let t=e.spec.attributes,i=e.spec.class;return!t&&!i||(n||(n={class:"cm-line"}),t&&nh(t,n),i&&(n.class+=" "+i)),n}function kS(n){let e=[];for(let t=n.parents.length;t>1;t--){let i=t==n.parents.length?n.tile:n.parents[t].tile;i instanceof ot&&e.push(i.mark)}return e}function hf(n){let e=pe.get(n);return e&&e.setDOM(n.cloneNode()),n}var ri=class extends Dt{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}};ri.inline=new ri("span");ri.block=new ri("div");var df=new class extends Dt{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}},Rl=class{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=X.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new ss(e,e.contentDOM),this.updateInner([new Ht(0,0,0,e.state.doc.length)],null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:u,toA:f})=>f<this.minWidthFrom||u>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?r=this.domChanged.newSel.head:!RS(e.changes,this.hasComposition)&&!e.selectionSet&&(r=e.state.selection.main.head));let s=r>-1?SS(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:u,to:f}=this.hasComposition;i=new Ht(u,f,e.changes.mapPos(u,-1),e.changes.mapPos(f,1)).addToSet(i.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(N.ie||N.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=_S(o,this.decorations,e.changes);l.length&&(i=Ht.extendWithRanges(i,l));let c=TS(a,this.blockWrappers,e.changes);return c.length&&(i=Ht.extendWithRanges(i,c)),s&&!i.some(u=>u.fromA<=s.range.fromA&&u.toA>=s.range.toA)&&(i=s.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(t||e.length){let o=this.tile,a=new Rf(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&pe.get(t.text)&&a.cache.reused.set(pe.get(t.text),2),this.tile=a.run(e,t),Pf(o,a.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=N.chrome||N.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||i.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let s of this.tile.children)s.isWidget()&&s.widget instanceof Po&&r.push(s.dom);i.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let i of t.effects)i.is(C0)&&(this.editContextFormatting=i.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:i}=this.tile,r=this.view.root.activeElement,s=r==i,o=!s&&!(this.view.state.facet(Dn)||i.tabIndex>-1)&&Ao(i,this.view.observer.selectionRange)&&!(r&&i.contains(r));if(!(s||t||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c,u;if(l.empty?u=c=this.inlineDOMNearPos(l.anchor,l.assoc||1):(u=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),c=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),N.gecko&&l.empty&&!this.hasComposition&&CS(c)){let h=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(h,c.node.childNodes[c.offset]||null)),c=u=new hn(h,0),a=!0}let f=this.view.observer.selectionRange;(a||!f.focusNode||(!To(c.node,c.offset,f.anchorNode,f.anchorOffset)||!To(u.node,u.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,l))&&(this.view.observer.ignore(()=>{N.android&&N.chrome&&i.contains(f.focusNode)&&MS(f.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let h=Lo(this.view.root);if(h)if(l.empty){if(N.gecko){let d=ES(c.node,c.offset);if(d&&d!=3){let p=(d==1?c0:u0)(c.node,c.offset);p&&(c=new hn(p.node,p.offset))}}h.collapse(c.node,c.offset),l.bidiLevel!=null&&h.caretBidiLevel!==void 0&&(h.caretBidiLevel=l.bidiLevel)}else if(h.extend){h.collapse(c.node,c.offset);try{h.extend(u.node,u.offset)}catch{}}else{let d=document.createRange();l.anchor>l.head&&([c,u]=[u,c]),d.setEnd(u.node,u.offset),d.setStart(c.node,c.offset),h.removeAllRanges(),h.addRange(d)}o&&this.view.root.activeElement==i&&(i.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,u)),this.impreciseAnchor=c.precise?null:new hn(f.anchorNode,f.anchorOffset),this.impreciseHead=u.precise?null:new hn(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&To(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=Lo(e.root),{anchorNode:r,anchorOffset:s}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let a=o.posAtStart;if(t.head==a||t.head==a+o.length)return;let l=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!l||!c||l.bottom>c.top)return;let u=this.domAtPos(t.head+t.assoc,t.assoc);i.collapse(u.node,u.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from&&i.collapse(r,s)}posFromDOM(e,t){let i=this.tile.nearest(e);if(!i)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=i.posAtStart;if(i.isComposite()){let s;if(e==i.dom)s=i.dom.childNodes[t];else{let o=In(e)==0?0:t==0?-1:1;for(;;){let a=e.parentNode;if(a==i.dom)break;o==0&&a.firstChild!=a.lastChild&&(e==a.firstChild?o=-1:o=1),e=a}o<0?s=e:s=e.nextSibling}if(s==i.dom.firstChild)return r;for(;s&&!pe.get(s);)s=s.nextSibling;if(!s)return r+i.length;for(let o=0,a=r;;o++){let l=i.children[o];if(l.dom==s)return a;a+=l.length+l.breakAfter}}else return i.isText()?e==i.dom?r+t:r+(t?i.length:0):r}domAtPos(e,t){let{tile:i,offset:r}=this.tile.resolveBlock(e,t);return i.isWidget()?i.domPosFor(e,t):i.domIn(r,t)}inlineDOMNearPos(e,t){let i,r=-1,s=!1,o,a=-1,l=!1;return this.tile.blockTiles((c,u)=>{if(c.isWidget()){if(c.flags&32&&u>=e)return!0;c.flags&16&&(s=!0)}else{let f=u+c.length;if(u<=e&&(i=c,r=e-u,s=f<e),f>=e&&!o&&(o=c,a=e-u,l=u>e),u>e&&o)return!0}}),!i&&!o?this.domAtPos(e,t):(s&&o?i=null:l&&i&&(o=null),i&&t<0||!o?i.domIn(r,t):o.domIn(a,t))}coordsAt(e,t){let{tile:i,offset:r}=this.tile.resolveBlock(e,t);return i.isWidget()?i.widget instanceof Po?null:i.coordsInWidget(r,t,!0):i.coordsIn(r,t)}lineAt(e,t){let{tile:i}=this.tile.resolveBlock(e,t);return i.isLine()?i:null}coordsForChar(e){let{tile:t,offset:i}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(s,o){if(s.isComposite())for(let a of s.children){if(a.length>=o){let l=r(a,o);if(l)return l}if(o-=a.length,o<0)break}else if(s.isText()&&o<s.length){let a=Re(s.text,o);if(a==o)return null;let l=qo(s.dom,o,a).getClientRects();for(let c=0;c<l.length;c++){let u=l[c];if(c==l.length-1||u.top<u.bottom&&u.left<u.right)return u}}return null}return r(t,i)}measureVisibleLineHeights(e){let t=[],{from:i,to:r}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==ue.LTR,c=0,u=(f,h,d)=>{for(let p=0;p<f.children.length&&!(h>r);p++){let m=f.children[p],y=h+m.length,g=m.dom.getBoundingClientRect(),{height:w}=g;if(d&&!p&&(c+=g.top-d.top),m instanceof Bn)y>i&&u(m,h,g);else if(h>=i&&(c>0&&t.push(-c),t.push(w+c),c=0,o)){let x=m.dom.lastChild,b=x?_o(x):[];if(b.length){let C=b[b.length-1],k=l?C.right-g.left:g.right-C.left;k>a&&(a=k,this.minWidth=s,this.minWidthFrom=h,this.minWidthTo=y)}}d&&p==f.children.length-1&&(c+=d.bottom-g.bottom),h=y+m.breakAfter}};return u(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?ue.RTL:ue.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let c of o.children){if(!c.isText()||/[^ -~]/.test(c.text))return;let u=_o(c.dom);if(u.length!=1)return;a+=u[0].width,l=u[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:l}}});if(e)return e;let t=document.createElement("div"),i,r,s;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=_o(t.firstChild)[0];i=t.getBoundingClientRect().height,r=o&&o.width?o.width/27:7,s=o&&o.height?o.height:i,t.remove()}),{lineHeight:i,charWidth:r,textHeight:s}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,r=0;;r++){let s=r==t.viewports.length?null:t.viewports[r],o=s?s.from-1:this.view.state.doc.length;if(o>i){let a=(t.lineBlockAt(o).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(X.replace({widget:new Po(a),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!s)break;i=s.to+1}return X.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Ql).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),i=!1,r=this.view.state.facet(lh).map((s,o)=>{let a=typeof s=="function";return a&&(i=!0),a?s(this.view):s});for(r.length&&(this.dynamicDecorationMap[e++]=i,t.push(re.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(E0).map(s=>typeof s=="function"?s(this.view):s)}scrollIntoView(e){var t;if(e.isSnapshot){let u=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=u.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let u of this.view.state.facet(k0))try{if(u(this.view,e.range,e))return!0}catch(f){Pe(this.view.state,f,"scroll handler")}let{range:i}=e,r=this.coordsAt(i.head,(t=i.assoc)!==null&&t!==void 0?t:i.empty?0:i.head>i.anchor?-1:1),s;if(!r)return;!i.empty&&(s=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let o=ch(this.view),a={left:r.left-o.left,top:r.top-o.top,right:r.right+o.right,bottom:r.bottom+o.bottom},{offsetWidth:l,offsetHeight:c}=this.view.scrollDOM;if(rS(this.view.scrollDOM,a,i.head<i.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,l),-l),Math.max(Math.min(e.yMargin,c),-c),this.view.textDirection==ue.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(r.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||r.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let u=this.view.docView.lineAt(i.head,1);u&&u.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let t=i=>i.isWidget()||i.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Pf(this.tile)}};function Pf(n,e){let t=e==null?void 0:e.get(n);if(t!=1){t==null&&n.destroy();for(let i of n.children)Pf(i,e)}}function CS(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function M0(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let i=c0(t.focusNode,t.focusOffset),r=u0(t.focusNode,t.focusOffset),s=i||r;if(r&&i&&r.node!=i.node){let a=pe.get(r.node);if(!a||a.isText()&&a.text!=r.node.nodeValue)s=r;else if(n.docView.lastCompositionAfterCursor){let l=pe.get(i.node);!l||l.isText()&&l.text!=i.node.nodeValue||(s=r)}}if(n.docView.lastCompositionAfterCursor=s!=i,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function SS(n,e,t){let i=M0(n,t);if(!i)return null;let{node:r,from:s,to:o}=i,a=r.nodeValue;if(/[\n\r]/.test(a)||n.state.doc.sliceString(i.from,i.to)!=a)return null;let l=e.invertedDesc;return{range:new Ht(l.mapPos(s),l.mapPos(o),s,o),text:r}}function ES(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e<n.childNodes.length&&n.childNodes[e].contentEditable=="false"?2:0)}var AS=class{constructor(){this.changes=[]}compareRange(e,t){ns(e,t,this.changes)}comparePoint(e,t){ns(e,t,this.changes)}boundChange(e){ns(e,e,this.changes)}};function _S(n,e,t){let i=new AS;return re.compare(n,e,t,i),i.changes}var Df=class{constructor(){this.changes=[]}compareRange(e,t){ns(e,t,this.changes)}comparePoint(){}boundChange(e){ns(e,e,this.changes)}};function TS(n,e,t){let i=new Df;return re.compare(n,e,t,i),i.changes}function MS(n,e){for(let t=n;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function RS(n,e){let t=!1;return e&&n.iterChangedRanges((i,r)=>{i<e.to&&r>e.from&&(t=!0)}),t}var Po=class extends Dt{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}};function PS(n,e,t=1){let i=n.charCategorizer(e),r=n.doc.lineAt(e),s=e-r.from;if(r.length==0)return R.cursor(e);s==0?t=1:s==r.length&&(t=-1);let o=s,a=s;t<0?o=Re(r.text,s,!1):a=Re(r.text,s);let l=i(r.text.slice(o,a));for(;o>0;){let c=Re(r.text,o,!1);if(i(r.text.slice(c,o))!=l)break;o=c}for(;a<r.length;){let c=Re(r.text,a);if(i(r.text.slice(a,c))!=l)break;a=c}return R.range(o+r.from,a+r.from)}function DS(n,e,t,i,r){let s=Math.round((i-e.left)*n.defaultCharacterWidth);if(n.lineWrapping&&t.height>n.defaultLineHeight*1.5){let a=n.viewState.heightOracle.textHeight,l=Math.floor((r-t.top-(n.defaultLineHeight-a)*.5)/a);s+=l*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+by(o,s,n.state.tabSize)}function BS(n,e,t){let i=n.lineBlockAt(e);if(Array.isArray(i.type)){let r;for(let s of i.type){if(s.from>e)break;if(!(s.to<e)){if(s.from<e&&s.to>e)return s;(!r||s.type==Pt.Text&&(r.type!=s.type||(t<0?s.from<e:s.to>e)))&&(r=s)}}return r||i}return i}function IS(n,e,t,i){let r=BS(n,e.head,e.assoc||-1),s=!i||r.type!=Pt.Text||!(n.lineWrapping||r.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head);if(s){let o=n.dom.getBoundingClientRect(),a=n.textDirectionAt(r.from),l=n.posAtCoords({x:t==(a==ue.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(l!=null)return R.cursor(l,t?-1:1)}return R.cursor(t?r.to:r.from,t?-1:1)}function Iy(n,e,t,i){let r=n.state.doc.lineAt(e.head),s=n.bidiSpans(r),o=n.textDirectionAt(r.from);for(let a=e,l=null;;){let c=pS(r,s,o,a,t),u=m0;if(!c){if(r.number==(t?n.state.doc.lines:1))return a;u=`
24 `&&n.lineWrapping&&(i&&(i=R.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:J.of([" "])}),t)return uh(n,t,i,o);if(i&&!Dl(i,s)){let a=!1,l="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(a=!0),l=n.inputState.lastSelectionOrigin,l=="select.pointer"&&(i=R0(r.facet(Fo).map(c=>c(n)),i))),n.dispatch({selection:i,scrollIntoView:a,userEvent:l}),!0}else return!1}function uh(n,e,t,i=-1){if(N.ios&&n.inputState.flushIOSKey(e))return!0;let r=n.state.selection.main;if(N.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&n.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&is(n.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&is(n.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&is(n.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,a=()=>o||(o=FS(n,e,t));return n.state.facet(b0).some(l=>l(n,e.from,e.to,s,a))||n.dispatch(a()),!0}function FS(n,e,t){let i,r=n.state,s=r.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let l=e.from<s.from?-1:1,c=l<0?s.from:s.to,u=Do(r.facet(Fo).map(f=>f(n)),c,l);e.from==u&&(o=u)}if(o>-1)i={changes:e,selection:R.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let l=s.from<e.from?r.sliceDoc(s.from,e.from):"",c=s.to>e.to?r.sliceDoc(e.to,s.to):"";i=r.replaceSelection(n.state.toText(l+e.insert.sliceString(0,void 0,n.state.lineBreak)+c))}else{let l=r.changes(e),c=t&&t.main.to<=l.newLength?t.main:void 0;if(r.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let u=n.state.sliceDoc(e.from,e.to),f,h=t&&M0(n,t.main.head);if(h){let p=e.insert.length-(e.to-e.from);f={from:h.from,to:h.to-p}}else f=n.state.doc.lineAt(s.head);let d=s.to-e.to;i=r.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:l,range:c||p.map(l)};let m=p.to-d,y=m-u.length;if(n.state.sliceDoc(y,m)!=u||m>=f.from&&y<=f.to)return{range:p};let g=r.changes({from:y,to:m,insert:e.insert}),w=p.to-s.to;return{changes:g,range:c?R.range(Math.max(0,c.anchor+w),Math.max(0,c.head+w)):p.map(g)}})}else i={changes:l,selection:c&&r.selection.replaceRange(c)}}let a="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,a+=".compose",n.inputState.compositionFirstChange&&(a+=".start",n.inputState.compositionFirstChange=!1)),r.update(i,{userEvent:a,scrollIntoView:!0})}function B0(n,e,t,i){let r=Math.min(n.length,e.length),s=0;for(;s<r&&n.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==r&&n.length==e.length)return null;let o=n.length,a=e.length;for(;o>0&&a>0&&n.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(i=="end"){let l=Math.max(0,s-Math.min(o,a));t-=o+l-s}if(o<s&&n.length<e.length){let l=t<=s&&t>=o?s-t:0;s-=l,a=s+(a-o),o=s}else if(a<s){let l=t<=s&&t>=a?s-t:0;s-=l,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function jS(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:r,focusOffset:s}=n.observer.selectionRange;return t&&(e.push(new Pl(t,i)),(r!=t||s!=i)&&e.push(new Pl(r,s))),e}function VS(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?R.single(t+e,i+e):null}function Dl(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}var Nf=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,N.safari&&e.contentDOM.addEventListener("input",()=>null),N.gecko&&nE(e.contentDOM.ownerDocument)}handleEvent(e){!YS(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let r of i.observers)r(this.view,t);for(let r of i.handlers){if(t.defaultPrevented)break;if(r(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=QS(e),i=this.handlers,r=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,a=i[s];a&&o!=!a.handlers.length&&(r.removeEventListener(s,this.handleEvent),a=null),a||r.addEventListener(s,this.handleEvent,{passive:o})}for(let s in i)s!="scroll"&&!t[s]&&r.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&$0.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),N.android&&N.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return N.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&!e.shiftKey&&((t=I0.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||zS.indexOf(e.key)>-1&&e.ctrlKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,is(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:N.safari&&!N.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function $y(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(r){Pe(t.state,r)}}}function QS(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let r=i.spec,s=r&&r.plugin.domEventHandlers,o=r&&r.plugin.domEventObservers;if(s)for(let a in s){let l=s[a];l&&t(a).handlers.push($y(i.value,l))}if(o)for(let a in o){let l=o[a];l&&t(a).observers.push($y(i.value,l))}}for(let i in Xt)t(i).handlers.push(Xt[i]);for(let i in at)t(i).observers.push(at[i]);return e}var I0=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],zS="dthko",$0=[16,17,18,20,91,92,224,225],gl=6;function yl(n){return Math.max(0,n)*.7+8}function WS(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}var qf=class{constructor(e,t,i,r){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=o0(e.contentDOM),this.atoms=e.state.facet(Fo).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(he.allowMultipleSelections)&&HS(e,t),this.dragging=US(e,t)&&q0(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&WS(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,r=0,s=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=ch(this.view);e.clientX-l.left<=r+gl?t=-yl(r-e.clientX):e.clientX+l.right>=o-gl&&(t=yl(e.clientX-o)),e.clientY-l.top<=s+gl?i=-yl(s-e.clientY):e.clientY+l.bottom>=a-gl&&(i=yl(e.clientY-a)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,i=R0(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}};function HS(n,e){let t=n.state.facet(g0);return t.length?t[0](e):N.mac?e.metaKey:e.ctrlKey}function XS(n,e){let t=n.state.facet(y0);return t.length?t[0](e):N.mac?!e.altKey:!e.ctrlKey}function US(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=Lo(n.root);if(!i||i.rangeCount==0)return!0;let r=i.getRangeAt(0).getClientRects();for(let s=0;s<r.length;s++){let o=r[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function YS(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=pe.get(t))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0}var Xt=Object.create(null),at=Object.create(null),L0=N.ie&&N.ie_version<15||N.ios&&N.webkit_version<604;function KS(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),N0(n,t.value)},50)}function zl(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function N0(n,e){e=zl(n.state,sh,e);let{state:t}=n,i,r=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(Ff!=null&&t.selection.ranges.every(l=>l.empty)&&Ff==s.toString()){let l=-1;i=t.changeByRange(c=>{let u=t.doc.lineAt(c.from);if(u.from==l)return{range:c};l=u.from;let f=t.toText((o?s.line(r++).text:e)+t.lineBreak);return{changes:{from:u.from,insert:f},range:R.cursor(c.from+f.length)}})}else o?i=t.changeByRange(l=>{let c=s.line(r++);return{changes:{from:l.from,to:l.to,insert:c.text},range:R.cursor(l.from+c.length)}}):i=t.replaceSelection(s);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}at.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};at.wheel=at.mousewheel=n=>{n.inputState.lastWheelEvent=Date.now()};Xt.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);at.touchstart=(n,e)=>{let t=n.inputState,i=e.targetTouches[0];t.lastTouchTime=Date.now(),i&&(t.lastTouchX=i.clientX,t.lastTouchY=i.clientY),t.setSelectionOrigin("select.pointer")};at.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};Xt.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(v0))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=JS(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new qf(n,e,t,i)),i&&n.observer.ignore(()=>{a0(n.contentDOM);let s=n.root.activeElement;s&&!s.contains(n.contentDOM)&&s.blur()});let r=n.inputState.mouseSelection;if(r)return r.start(e),r.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function Ly(n,e,t,i){if(i==1)return R.cursor(e,t);if(i==2)return PS(n.state,e,t);{let r=n.docView.lineAt(e,t),s=n.state.doc.lineAt(r?r.posAtEnd:e),o=r?r.posAtStart:s.from,a=r?r.posAtEnd:s.to;return a<n.state.doc.length&&a==s.to&&a++,R.range(o,a)}}var GS=N.ie&&N.ie_version<=11,Ny=null,qy=0,Fy=0;function q0(n){if(!GS)return n.detail;let e=Ny,t=Fy;return Ny=n,Fy=Date.now(),qy=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(qy+1)%3:1}function JS(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),i=q0(e),r=n.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),r=r.map(s.changes))},get(s,o,a){let l=n.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),c,u=Ly(n,l.pos,l.assoc,i);if(t.pos!=l.pos&&!o){let f=Ly(n,t.pos,t.assoc,i),h=Math.min(f.from,u.from),d=Math.max(f.to,u.to);u=h<u.from?R.range(h,d,u.assoc):R.range(d,h,u.assoc)}return o?r.replaceRange(r.main.extend(u.from,u.to,u.assoc)):a&&i==1&&r.ranges.length>1&&(c=ZS(r,l.pos))?c:a?r.addRange(u):R.create([u])}}}function ZS(n,e){for(let t=0;t<n.ranges.length;t++){let{from:i,to:r}=n.ranges[t];if(i<=e&&r>=e)return R.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}Xt.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let r=n.docView.tile.nearest(e.target);if(r&&r.isWidget()){let s=r.posAtStart,o=s+r.length;(s>=t.to||o<=t.from)&&(t=R.range(s,o))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",zl(n.state,oh,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Xt.dragend=n=>(n.inputState.draggedContent=null,!1);function jy(n,e,t,i){if(t=zl(n.state,sh,t),!t)return;let r=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=n.inputState,o=i&&s&&XS(n,e)?{from:s.from,to:s.to}:null,a={from:r,insert:t},l=n.state.changes(o?[o,a]:a);n.focus(),n.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}Xt.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),r=0,s=()=>{++r==t.length&&jy(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let a=new FileReader;a.onerror=s,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(i[o]=a.result),s()},a.readAsText(t[o])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return jy(n,e,i,!0),!0}return!1};Xt.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=L0?null:e.clipboardData;return t?(N0(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(KS(n),!1)};function eE(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function tE(n){let e=[],t=[],i=!1;for(let r of n.selection.ranges)r.empty||(e.push(n.sliceDoc(
[all...]
H A Ddmn-modeler.production.min.js278 `,this;e--}else if(r instanceof An){let l=r.text[s+(t<0?-1:0)];if(this.offsets[i]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=r.children[s+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof An?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},xg=class{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Ls(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=i?r:t<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},bg=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol!="undefined"&&(be.prototype[Symbol.iterator]=function(){return this.iter()},Ls.prototype[Symbol.iterator]=xg.prototype[Symbol.iterator]=bg.prototype[Symbol.iterator]=function(){return this});var f0=class{constructor(e,t,i,r){this.from=e,this.to=t,this.number=i,this.text=r}get length(){return this.to-this.from}};function Ql(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function Dt(n,e,t=!0,i=!0){return VR(n,e,t,i)}function J5(n){return n>=56320&&n<57344}function eq(n){return n>=55296&&n<56320}function ti(n,e){let t=n.charCodeAt(e);if(!eq(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return J5(i)?(t-55296<<10)+(i-56320)+65536:t}function E0(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Yi(n){return n<65536?1:2}var h0=/\r\n?|\n/,Ot=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(Ot||(Ot={})),Br=class n{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,r=0;t<this.sections.length;){let o=this.sections[t++],s=this.sections[t++];s<0?(e(i,r,o),r+=o):r+=s,i+=o}}iterChangedRanges(e,t=!1){d0(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];r<0?e.push(i,r):e.push(r,i)}return new n(e)}composeDesc(e){return this.empty?e:e.empty?this:YR(this,e)}mapDesc(e,t=!1){return e.empty?this:p0(this,e,t)}mapPos(e,t=-1,i=Ot.Simple){let r=0,o=0;for(let s=0;s<this.sections.length;){let a=this.sections[s++],l=this.sections[s++],c=r+a;if(l<0){if(c>e)return o+(e-r);o+=a}else{if(i!=Ot.Simple&&c>=e&&(i==Ot.TrackDel&&r<e&&c>e||i==Ot.TrackBefore&&r<e||i==Ot.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!a)return e==r||t<0?o:o+l;o+=l}r=c}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return o}touchesRange(e,t=e){for(let i=0,r=0;i<this.sections.length&&r<=t;){let o=this.sections[i++],s=this.sections[i++],a=r+o;if(s>=0&&r<=t&&a>=e)return r<e&&a>t?"cover":!0;r=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new n(e)}static create(e){return new n(e)}},cn=class n extends Br{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return d0(this,(t,i,r,o,s)=>e=e.replace(r,r+(i-t),s),!1),e}mapDesc(e,t=!1){return p0(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let r=0,o=0;r<t.length;r+=2){let s=t[r],a=t[r+1];if(a>=0){t[r]=a,t[r+1]=s;let l=r>>1;for(;i.length<l;)i.push(be.empty);i.push(s?e.slice(o,o+s):be.empty)}o+=s}return new n(t,i)}compose(e){return this.empty?e:e.empty?this:YR(this,e,!0)}map(e,t=!1){return e.empty?this:p0(this,e,t,!0)}iterChanges(e,t=!1){d0(this,e,t)}get desc(){return Br.create(this.sections)}filter(e){let t=[],i=[],r=[],o=new Bs(this);e:for(let s=0,a=0;;){let l=s==e.length?1e9:e[s++];for(;a<l||a==l&&o.len==0;){if(o.done)break e;let u=Math.min(o.len,l-a);Xt(r,u,-1);let f=o.ins==-1?-1:o.off==0?o.ins:0;Xt(t,u,f),f>0&&Do(i,t,o.text),o.forward(u),a+=u}let c=e[s++];for(;a<c;){if(o.done)break e;let u=Math.min(o.len,c-a);Xt(t,u,-1),Xt(r,u,o.ins==-1?-1:o.off==0?o.ins:0),o.forward(u),a+=u}}return{changes:new n(t,i),filtered:Br.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],r=this.sections[t+1];r<0?e.push(i):r==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let r=[],o=[],s=0,a=null;function l(u=!1){if(!u&&!r.length)return;s<t&&Xt(r,t-s,-1);let f=new n(r,o);a=a?a.compose(f.map(a)):f,r=[],o=[],s=0}function c(u){if(Array.isArray(u))for(let f of u)c(f);else if(u instanceof n){if(u.length!=t)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${t})`);l(),a=a?a.compose(u.map(a)):u}else{let{from:f,to:h=f,insert:d}=u;if(f>h||f<0||h>t)throw new RangeError(`Invalid change range ${f} to ${h} (in doc of length ${t})`);let p=d?typeof d=="string"?be.of(d.split(i||h0)):d:be.empty,m=p.length;if(f==h&&m==0)return;f<s&&l(),f>s&&Xt(r,f-s,-1),Xt(r,h-f,m),Do(o,r,p),s=h}}return c(e),l(!a),a}static empty(e){return new n(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let r=0;r<e.length;r++){let o=e[r];if(typeof o=="number")t.push(o,-1);else{if(!Array.isArray(o)||typeof o[0]!="number"||o.some((s,a)=>a&&typeof s!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)t.push(o[0],0);else{for(;i.length<r;)i.push(be.empty);i[r]=be.of(o.slice(1)),t.push(o[0],i[r].length)}}}return new n(t,i)}static createSet(e,t){return new n(e,t)}};function Xt(n,e,t,i=!1){if(e==0&&t<=0)return;let r=n.length-2;r>=0&&t<=0&&t==n[r+1]?n[r]+=e:r>=0&&e==0&&n[r]==0?n[r+1]+=t:i?(n[r]+=e,n[r+1]+=t):n.push(e,t)}function Do(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(be.empty);n.push(t)}}function d0(n,e,t){let i=n.inserted;for(let r=0,o=0,s=0;s<n.sections.length;){let a=n.sections[s++],l=n.sections[s++];if(l<0)r+=a,o+=a;else{let c=r,u=o,f=be.empty;for(;c+=a,u+=l,l&&i&&(f=f.append(i[s-2>>1])),!(t||s==n.sections.length||n.sections[s+1]<0);)a=n.sections[s++],l=n.sections[s++];e(r,c,o,u,f),r=c,o=u}}}function p0(n,e,t,i=!1){let r=[],o=i?[]:null,s=new Bs(n),a=new Bs(e);for(let l=-1;;){if(s.done&&a.len||a.done&&s.len)throw new Error("Mismatched change set lengths");if(s.ins==-1&&a.ins==-1){let c=Math.min(s.len,a.len);Xt(r,c,-1),s.forward(c),a.forward(c)}else if(a.ins>=0&&(s.ins<0||l==s.i||s.off==0&&(a.len<s.len||a.len==s.len&&!t))){let c=a.len;for(Xt(r,a.ins,-1);c;){let u=Math.min(s.len,c);s.ins>=0&&l<s.i&&s.len<=u&&(Xt(r,0,s.ins),o&&Do(o,r,s.text),l=s.i),s.forward(u),c-=u}a.next()}else if(s.ins>=0){let c=0,u=s.len;for(;u;)if(a.ins==-1){let f=Math.min(u,a.len);c+=f,u-=f,a.forward(f)}else if(a.ins==0&&a.len<u)u-=a.len,a.next();else break;Xt(r,c,l<s.i?s.ins:0),o&&l<s.i&&Do(o,r,s.text),l=s.i,s.forward(s.len-u)}else{if(s.done&&a.done)return o?cn.createSet(r,o):Br.create(r);throw new Error("Mismatched change set lengths")}}}function YR(n,e,t=!1){let i=[],r=t?[]:null,o=new Bs(n),s=new Bs(e);for(let a=!1;;){if(o.done&&s.done)return r?cn.createSet(i,r):Br.create(i);if(o.ins==0)Xt(i,o.len,0,a),o.next();else if(s.len==0&&!s.done)Xt(i,0,s.ins,a),r&&Do(r,i,s.text),s.next();else{if(o.done||s.done)throw new Error("Mismatched change set lengths");{let l=Math.min(o.len2,s.len),c=i.length;if(o.ins==-1){let u=s.ins==-1?-1:s.off?0:s.ins;Xt(i,l,u,a),r&&u&&Do(r,i,s.text)}else s.ins==-1?(Xt(i,o.off?0:o.len,l,a),r&&Do(r,i,o.textBit(l))):(Xt(i,o.off?0:o.len,s.off?0:s.ins,a),r&&!s.off&&Do(r,i,s.text));a=(o.ins>l||s.ins>=0&&s.len>l)&&(a||i.length>c),o.forward2(l),s.forward(l)}}}}var Bs=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?be.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?be.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},Hl=class n{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,r;return this.empty?i=r=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new n(i,r,this.flags)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return $.range(e,t,void 0,void 0,i);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return $.range(this.anchor,r,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return $.range(e.anchor,e.head)}static create(e,t,i){return new n(e,t,i)}},$=class n{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:n.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new n([this.main],0)}addRange(e,t=!0){return n.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,n.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new n(e.ranges.map(t=>Hl.fromJSON(t)),e.main)}static single(e,t=e){return new n([n.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;r<e.length;r++){let o=e[r];if(o.empty?o.from<=i:o.from<i)return n.normalized(e.slice(),t);i=o.to}return new n(e,t)}static cursor(e,t=0,i,r){return Hl.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(r!=null?r:16777215)<<6)}static range(e,t,i,r,o){let s=(i!=null?i:16777215)<<6|(r==null?7:Math.min(6,r));return!o&&e!=t&&(o=t<e?1:-1),t<e?Hl.create(t,e,48|s):Hl.create(e,t,(o?o<0?8:16:0)|s)}static normalized(e,t=0){let i=e[t];e.sort((r,o)=>r.from-o.from),t=e.indexOf(i);for(let r=1;r<e.length;r++){let o=e[r],s=e[r-1];if(o.empty?o.from<=s.to:o.from<s.to){let a=s.from,l=Math.max(o.to,s.to);r<=t&&t--,e.splice(--r,2,o.anchor>o.head?n.range(l,a):n.range(a,l))}}return new n(e,t)}};function ZR(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}var S0=0,H=class n{constructor(e,t,i,r,o){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=r,this.id=S0++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new n(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:O0),!!e.static,e.enables)}of(e){return new Wl([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Wl(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Wl(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}};function O0(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}var Wl=class{constructor(e,t,i,r){this.dependencies=e,this.facet=t,this.type=i,this.value=r,this.id=S0++}dynamicSlot(e){var t;let i=this.value,r=this.facet.compareInput,o=this.id,s=e[o]>>1,a=this.type==2,l=!1,c=!1,u=[];for(let f of this.dependencies)f=="doc"?l=!0:f=="selection"?c=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&u.push(e[f.id]);return{create(f){return f.values[s]=i(f),1},update(f,h){if(l&&h.docChanged||c&&(h.docChanged||h.selection)||m0(f,u)){let d=i(f);if(a?!QR(d,f.values[s],r):!r(d,f.values[s]))return f.values[s]=d,1}return 0},reconfigure:(f,h)=>{let d,p=h.config.address[o];if(p!=null){let m=Cg(h,p);if(this.dependencies.every(g=>g instanceof H?h.facet(g)===f.facet(g):g instanceof qt?h.field(g,!1)==f.field(g,!1):!0)||(a?QR(d=i(f),m,r):r(d=i(f),m)))return f.values[s]=m,0}else d=i(f);return f.values[s]=d,1}}}};function QR(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function m0(n,e){let t=!1;for(let i of e)dh(n,i)&1&&(t=!0);return t}function tq(n,e,t){let i=t.map(l=>n[l.id]),r=t.map(l=>l.type),o=i.filter(l=>!(l&1)),s=n[e.id]>>1;function a(l){let c=[];for(let u=0;u<i.length;u++){let f=Cg(l,i[u]);if(r[u]==2)for(let h of f)c.push(h);else c.push(f)}return e.combine(c)}return{create(l){for(let c of i)dh(l,c);return l.values[s]=a(l),1},update(l,c){if(!m0(l,o))return 0;let u=a(l);return e.compare(u,l.values[s])?0:(l.values[s]=u,1)},reconfigure(l,c){let u=m0(l,i),f=c.config.facets[e.id],h=c.facet(e);if(f&&!u&&O0(t,f))return l.values[s]=h,0;let d=a(l);return e.compare(d,h)?(l.values[s]=h,0):(l.values[s]=d,1)}}}var mg=H.define({static:!0}),qt=class n{constructor(e,t,i,r,o){this.id=e,this.createF=t,this.updateF=i,this.compareF=r,this.spec=o,this.provides=void 0}static define(e){let t=new n(S0++,e.create,e.update,e.compare||((i,r)=>i===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(mg).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,r)=>{let o=i.values[t],s=this.updateF(o,r);return this.compareF(o,s)?0:(i.values[t]=s,1)},reconfigure:(i,r)=>{let o=i.facet(mg),s=r.facet(mg),a;return(a=o.find(l=>l.field==this))&&a!=s.find(l=>l.field==this)?(i.values[t]=a.create(i),1):r.config.address[this.id]!=null?(i.values[t]=r.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,mg.of({field:this,create:e})]}get extension(){return this}},Ds={lowest:4,low:3,default:2,high:1,highest:0};function hh(n){return e=>new _g(e,n)}var $r={highest:hh(Ds.highest),high:hh(Ds.high),default:hh(Ds.default),low:hh(Ds.low),lowest:hh(Ds.lowest)},_g=class{constructor(e,t){this.inner=e,this.prec=t}},Ns=class n{of(e){return new ph(this,e)}reconfigure(e){return n.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}},ph=class{constructor(e,t){this.compartment=e,this.inner=t}},wg=class n{constructor(e,t,i,r,o,s){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=r,this.staticValues=o,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let r=[],o=Object.create(null),s=new Map;for(let h of nq(e,t,s))h instanceof qt?r.push(h):(o[h.facet.id]||(o[h.facet.id]=[])).push(h);let a=Object.create(null),l=[],c=[];for(let h of r)a[h.id]=c.length<<1,c.push(d=>h.slot(d));let u=i==null?void 0:i.config.facets;for(let h in o){let d=o[h],p=d[0].facet,m=u&&u[h]||[];if(d.every(g=>g.type==0))if(a[p.id]=l.length<<1|1,O0(m,d))l.push(i.facet(p));else{let g=p.combine(d.map(b=>b.value));l.push(i&&p.compare(g,i.facet(p))?i.facet(p):g)}else{for(let g of d)g.type==0?(a[g.id]=l.length<<1|1,l.push(g.value)):(a[g.id]=c.length<<1,c.push(b=>g.dynamicSlot(b)));a[p.id]=c.length<<1,c.push(g=>tq(g,p,d))}}let f=c.map(h=>h(a));return new n(e,s,f,a,l,o)}};function nq(n,e,t){let i=[[],[],[],[],[]],r=new Map;function o(s,a){let l=r.get(s);if(l!=null){if(l<=a)return;let c=i[l].indexOf(s);c>-1&&i[l].splice(c,1),s instanceof ph&&t.delete(s.compartment)}if(r.set(s,a),Array.isArray(s))for(let c of s)o(c,a);else if(s instanceof ph){if(t.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(s.compartment)||s.inner;t.set(s.compartment,c),o(c,a)}else if(s instanceof _g)o(s.inner,s.prec);else if(s instanceof qt)i[a].push(s),s.provides&&o(s.provides,a);else if(s instanceof Wl)i[a].push(s),s.facet.extensions&&o(s.facet.extensions,Ds.default);else{let c=s.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(c,a)}}return o(n,Ds.default),i.reduce((s,a)=>s.concat(a))}function dh(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let r=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|r}function Cg(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}var JR=H.define(),g0=H.define({combine:n=>n.some(e=>e),static:!0}),eT=H.define({combine:n=>n.length?n[0]:void 0,static:!0}),tT=H.define(),nT=H.define(),iT=H.define(),rT=H.define({combine:n=>n.length?n[0]:!1}),Mn=class{constructor(e,t){this.type=e,this.value=t}static define(){return new y0}},y0=class{of(e){return new Mn(this,e)}},v0=class{constructor(e){this.map=e}of(e){return new de(this,e)}},de=class n{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new n(this.type,t)}is(e){return this.type==e}static define(e={}){return new v0(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let r of e){let o=r.map(t);o&&i.push(o)}return i}};de.reconfigure=de.define();de.appendConfig=de.define();var Ft=class n{constructor(e,t,i,r,o,s){this.startState=e,this.changes=t,this.selection=i,this.effects=r,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,i&&ZR(i,t.newLength),o.some(a=>a.type==n.time)||(this.annotations=o.concat(n.time.of(Date.now())))}static create(e,t,i,r,o,s){return new n(e,t,i,r,o,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(n.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}};Ft.time=Mn.define();Ft.userEvent=Mn.define();Ft.addToHistory=Mn.define();Ft.remote=Mn.define();function iq(n,e){let t=[];for(let i=0,r=0;;){let o,s;if(i<n.length&&(r==e.length||e[r]>=n[i]))o=n[i++],s=n[i++];else if(r<e.length)o=e[r++],s=e[r++];else return t;!t.length||t[t.length-1]<o?t.push(o,s):t[t.length-1]<s&&(t[t.length-1]=s)}}function oT(n,e,t){var i;let r,o,s;return t?(r=e.changes,o=cn.empty(e.changes.length),s=n.changes.compose(e.changes)):(r=e.changes.map(n.changes),o=n.changes.mapDesc(e.changes,!0),s=n.changes.compose(r)),{changes:s,selection:e.selection?e.selection.map(o):(i=n.selection)===null||i===void 0?void 0:i.map(r),effects:de.mapEffects(n.effects,r).concat(de.mapEffects(e.effects,o)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function x0(n,e,t){let i=e.selection,r=Ul(e.annotations);return e.userEvent&&(r=r.concat(Ft.userEvent.of(e.userEvent))),{changes:e.changes instanceof cn?e.changes:cn.of(e.changes||[],t,n.facet(eT)),selection:i&&(i instanceof $?i:$.single(i.anchor,i.head)),effects:Ul(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function sT(n,e,t){let i=x0(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let o=1;o<e.length;o++){e[o].filter===!1&&(t=!1);let s=!!e[o].sequential;i=oT(i,x0(n,e[o],s?i.changes.newLength:n.doc.length),s)}let r=Ft.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return oq(t?rq(r):r)}function rq(n){let e=n.startState,t=!0;for(let r of e.facet(tT)){let o=r(n);if(o===!1){t=!1;break}Array.isArray(o)&&(t=t===!0?o:iq(t,o))}if(t!==!0){let r,o;if(t===!1)o=n.changes.invertedDesc,r=cn.empty(e.doc.length);else{let s=n.changes.filter(t);r=s.changes,o=s.filtered.mapDesc(s.changes).invertedDesc}n=Ft.create(e,r,n.selection&&n.selection.map(o),de.mapEffects(n.effects,o),n.annotations,n.scrollIntoView)}let i=e.facet(nT);for(let r=i.length-1;r>=0;r--){let o=i[r](n);o instanceof Ft?n=o:Array.isArray(o)&&o.length==1&&o[0]instanceof Ft?n=o[0]:n=sT(e,Ul(o),!1)}return n}function oq(n){let e=n.startState,t=e.facet(iT),i=n;for(let r=t.length-1;r>=0;r--){let o=t[r](n);o&&Object.keys(o).length&&(i=oT(i,x0(e,o,n.changes.newLength),!0))}return i==n?n:Ft.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}var sq=[];function Ul(n){return n==null?sq:Array.isArray(n)?n:[n]}var ln=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(ln||(ln={})),aq=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,b0;try{b0=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function lq(n){if(b0)return b0.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>"\x80"&&(t.toUpperCase()!=t.toLowerCase()||aq.test(t)))return!0}return!1}function cq(n){return e=>{if(!/\S/.test(e))return ln.Space;if(lq(e))return ln.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return ln.Word;return ln.Other}}var Ze=class n{constructor(e,t,i,r,o,s){this.config=e,this.doc=t,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=o,s&&(s._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)dh(this,a<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return dh(this,i),Cg(this,i)}update(...e){return sT(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:r}=t;for(let a of e.effects)a.is(Ns.reconfigure)?(t&&(r=new Map,t.compartments.forEach((l,c)=>r.set(c,l)),t=null),r.set(a.value.compartment,a.value.extension)):a.is(de.reconfigure)?(t=null,i=a.value):a.is(de.appendConfig)&&(t=null,i=Ul(i).concat(a.value));let o;t?o=e.startState.values.slice():(t=wg.resolve(i,r,this),o=new n(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let s=e.startState.facet(g0)?e.newSelection:e.newSelection.asSingle();new n(t,e.newDoc,s,o,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:$.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),r=this.changes(i.changes),o=[i.range],s=Ul(i.effects);for(let a=1;a<t.ranges.length;a++){let l=e(t.ranges[a]),c=this.changes(l.changes),u=c.map(r);for(let h=0;h<a;h++)o[h]=o[h].map(u);let f=r.mapDesc(c,!0);o.push(l.range.map(f)),r=r.compose(u),s=de.mapEffects(s,u).concat(de.mapEffects(Ul(l.effects),f))}return{changes:r,selection:$.create(o,t.mainIndex),effects:s}}changes(e=[]){return e instanceof cn?e:cn.of(e,this.doc.length,this.facet(n.lineSeparator))}toText(e){return be.of(e.split(this.facet(n.lineSeparator)||h0))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(dh(this,t),Cg(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let r=e[i];r instanceof qt&&this.config.address[r.id]!=null&&(t[i]=r.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(i){for(let o in i)if(Object.prototype.hasOwnProperty.call(e,o)){let s=i[o],a=e[o];r.push(s.init(l=>s.spec.fromJSON(a,l)))}}return n.create({doc:e.doc,selection:$.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=wg.resolve(e.extensions||[],new Map),i=e.doc instanceof be?e.doc:be.of((e.doc||"").split(t.staticFacet(n.lineSeparator)||h0)),r=e.selection?e.selection instanceof $?e.selection:$.single(e.selection.anchor,e.selection.head):$.single(0);return ZR(r,i.length),t.staticFacet(g0)||(r=r.asSingle()),new n(t,i,r,t.dynamicSlots.map(()=>null),(o,s)=>s.create(o),null)}get tabSize(){return this.facet(n.tabSize)}get lineBreak(){return this.facet(n.lineSeparator)||`
281 `;this.styleTag.textContent=s;let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var jr={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Kl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},fq=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),hq=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(wt=0;wt<10;wt++)jr[48+wt]=jr[96+wt]=String(wt);var wt;for(wt=1;wt<=24;wt++)jr[wt+111]="F"+wt;var wt;for(wt=65;wt<=90;wt++)jr[wt]=String.fromCharCode(wt+32),Kl[wt]=String.fromCharCode(wt);var wt;for(Sg in jr)Kl.hasOwnProperty(Sg)||(Kl[Sg]=jr[Sg]);var Sg;function fT(n){var e=fq&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||hq&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Kl:jr)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function Pn(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var r=t[i];typeof r=="string"?n.setAttribute(i,r):r!=null&&(n[i]=r)}e++}for(;e<arguments.length;e++)hT(n,arguments[e]);return n}function hT(n,e){if(typeof e=="string")n.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)n.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)hT(n,e[t]);else throw new RangeError("Unsupported child node: "+e)}var un=typeof navigator!="undefined"?navigator:{userAgent:"",vendor:"",platform:""},L0=typeof document!="undefined"?document:{documentElement:{style:{}}},B0=/Edge\/(\d+)/.exec(un.userAgent),zT=/MSIE \d/.test(un.userAgent),N0=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(un.userAgent),Jg=!!(zT||N0||B0),dT=!Jg&&/gecko\/(\d+)/i.test(un.userAgent),A0=!Jg&&/Chrome\/(\d+)/.exec(un.userAgent),pT="webkitFontSmoothing"in L0.documentElement.style,$0=!Jg&&/Apple Computer/.test(un.vendor),mT=$0&&(/Mobile\/\w+/.test(un.userAgent)||un.maxTouchPoints>2),z={mac:mT||/Mac/.test(un.platform),windows:/Win/.test(un.platform),linux:/Linux|X11/.test(un.platform),ie:Jg,ie_version:zT?L0.documentMode||6:N0?+N0[1]:B0?+B0[1]:0,gecko:dT,gecko_version:dT?+(/Firefox\/(\d+)/.exec(un.userAgent)||[0,0])[1]:0,chrome:!!A0,chrome_version:A0?+A0[1]:0,ios:mT,android:/Android\b/.test(un.userAgent),webkit:pT,webkit_version:pT?+(/\bAppleWebKit\/(\d+)/.exec(un.userAgent)||[0,0])[1]:0,safari:$0,safari_version:$0?+(/\bVersion\/(\d+(\.\d+)?)/.exec(un.userAgent)||[0,0])[1]:0,tabSize:L0.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function _b(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}var Ng=Object.create(null);function wb(n,e,t){if(n==e)return!0;n||(n=Ng),e||(e=Ng);let i=Object.keys(n),r=Object.keys(e);if(i.length-(t&&i.indexOf(t)>-1?1:0)!=r.length-(t&&r.indexOf(t)>-1?1:0))return!1;for(let o of i)if(o!=t&&(r.indexOf(o)==-1||n[o]!==e[o]))return!1;return!0}function dq(n,e){for(let t=n.attributes.length-1;t>=0;t--){let i=n.attributes[t].name;e[i]==null&&n.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?n.style.cssText=i:n.getAttribute(t)!=i&&n.setAttribute(t,i)}}function gT(n,e,t){let i=!1;if(e)for(let r in e)t&&r in t||(i=!0,r=="style"?n.style.cssText="":n.removeAttribute(r));if(t)for(let r in t)e&&e[r]==t[r]||(i=!0,r=="style"?n.style.cssText=t[r]:n.setAttribute(r,t[r]));return i}function pq(n){let e=Object.create(null);for(let t=0;t<n.attributes.length;t++){let i=n.attributes[t];e[i.name]=i.value}return e}var ai=class{eq(e){return!1}updateDOM(e,t,i){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},si=(function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n})(si||(si={})),he=class extends ei{constructor(e,t,i,r){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=r}get heightRelevant(){return!1}static mark(e){return new kh(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new qs(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,r;if(e.isBlockGap)i=-5e8,r=4e8;else{let{start:o,end:s}=WT(e,t);i=(o?t?-3e8:-1:5e8)-1,r=(s?t?2e8:1:-6e8)+1}return new qs(e,i,r,t,e.widget||null,!0)}static line(e){return new Rh(e)}static set(e,t=!1){return Be.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};he.none=Be.empty;var kh=class n extends he{constructor(e){let{start:t,end:i}=WT(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?_b(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Ng}eq(e){return this==e||e instanceof n&&this.tagName==e.tagName&&wb(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}};kh.prototype.point=!1;var Rh=class n extends he{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof n&&this.spec.class==e.spec.class&&wb(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}};Rh.prototype.mapMode=Ot.TrackBefore;Rh.prototype.point=!0;var qs=class n extends he{constructor(e,t,i,r,o,s){super(t,i,o,e),this.block=r,this.isReplace=s,this.mapMode=r?t<=0?Ot.TrackBefore:Ot.TrackAfter:Ot.TrackDel}get type(){return this.startSide!=this.endSide?si.WidgetRange:this.startSide<=0?si.WidgetBefore:si.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof n&&mq(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}};qs.prototype.point=!0;function WT(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t!=null?t:e,end:i!=null?i:e}}function mq(n,e){return n==e||!!(n&&e&&n.compare(e))}function Jl(n,e,t,i=0){let r=t.length-1;r>=0&&t[r]+i>=n?t[r]=Math.max(t[r],e):t.push(n,e)}var $g=class n extends ei{constructor(e,t,i){super(),this.tagName=e,this.attributes=t,this.rank=i}eq(e){return e==this||e instanceof n&&this.tagName==e.tagName&&wb(this.attributes,e.attributes)}static create(e){return new n(e.tagName,e.attributes||Ng,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return Be.of(e,t)}};$g.prototype.startSide=$g.prototype.endSide=-1;function Th(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function j0(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function xh(n,e){if(!e.anchorNode)return!1;try{return j0(n,e.anchorNode)}catch{return!1}}function bh(n){return n.nodeType==3?Mh(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function _h(n,e,t,i){return t?yT(n,e,t,i,-1)||yT(n,e,t,i,1):!1}function No(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function jg(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function yT(n,e,t,i,r){for(;;){if(n==t&&e==i)return!0;if(e==(r<0?0:Vr(n))){if(n.nodeName=="DIV")return!1;let o=n.parentNode;if(!o||o.nodeType!=1)return!1;e=No(n)+(r<0?0:1),n=o}else if(n.nodeType==1){if(n=n.childNodes[e+(r<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=r<0?Vr(n):0}else return!1}}function Vr(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Ah(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function gq(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function UT(n,e){let t=e.width/n.offsetWidth,i=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-n.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function yq(n,e,t,i,r,o,s,a){let l=n.ownerDocument,c=l.defaultView||window;for(let u=n,f=!1;u&&!f;)if(u.nodeType==1){let h,d=u==l.body,p=1,m=1;if(d)h=gq(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(f=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let _=u.getBoundingClientRect();({scaleX:p,scaleY:m}=UT(u,_)),h={left:_.left,right:_.left+u.clientWidth*p,top:_.top,bottom:_.top+u.clientHeight*m}}let g=0,b=0;if(r=="nearest")e.top<h.top+s?(b=e.top-(h.top+s),t>0&&e.bottom>h.bottom+b&&(b=e.bottom-h.bottom+s)):e.bottom>h.bottom-s&&(b=e.bottom-h.bottom+s,t<0&&e.top-b<h.top&&(b=e.top-(h.top+s)));else{let _=e.bottom-e.top,v=h.bottom-h.top;b=(r=="center"&&_<=v?e.top+_/2-v/2:r=="start"||r=="center"&&t<0?e.top-s:e.bottom-v+s)-h.top}if(i=="nearest"?e.left<h.left+o?(g=e.left-(h.left+o),t>0&&e.right>h.right+g&&(g=e.right-h.right+o)):e.right>h.right-o&&(g=e.right-h.right+o,t<0&&e.left<h.left+g&&(g=e.left-(h.left+o))):g=(i=="center"?e.left+(e.right-e.left)/2-(h.right-h.left)/2:i=="start"==a?e.left-o:e.right-(h.right-h.left)+o)-h.left,g||b)if(d)c.scrollBy(g,b);else{let _=0,v=0;if(b){let x=u.scrollTop;u.scrollTop+=b/m,v=(u.scrollTop-x)*m}if(g){let x=u.scrollLeft;u.scrollLeft+=g/p,_=(u.scrollLeft-x)*p}e={left:e.left-_,top:e.top-v,right:e.right-_,bottom:e.bottom-v},_&&Math.abs(_-g)<1&&(i="nearest"),v&&Math.abs(v-b)<1&&(r="nearest")}if(d)break;(e.top<h.top||e.bottom>h.bottom||e.left<h.left||e.right>h.right)&&(e={left:Math.max(e.left,h.left),right:Math.min(e.right,h.right),top:Math.max(e.top,h.top),bottom:Math.min(e.bottom,h.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function QT(n,e=!0){let t=n.ownerDocument,i=null,r=null;for(let o=n.parentNode;o&&!(o==t.body||(!e||i)&&r);)if(o.nodeType==1)!r&&o.scrollHeight>o.clientHeight&&(r=o),e&&!i&&o.scrollWidth>o.clientWidth&&(i=o),o=o.assignedSlot||o.parentNode;else if(o.nodeType==11)o=o.host;else break;return{x:i,y:r}}var F0=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?Vr(t):0),i,Math.min(e.focusOffset,i?Vr(i):0))}set(e,t,i,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=r}},js=null;z.safari&&z.safari_version>=26&&(js=!1);function KT(n){if(n.setActive)return n.setActive();if(js)return n.focus(js);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(js==null?{get preventScroll(){return js={preventScroll:!0},!0}}:void 0),!js){js=!1;for(let t=0;t<e.length;){let i=e[t++],r=e[t++],o=e[t++];i.scrollTop!=r&&(i.scrollTop=r),i.scrollLeft!=o&&(i.scrollLeft=o)}}}var vT;function Mh(n,e,t=e){let i=vT||(vT=document.createRange());return i.setEnd(n,t),i.setStart(n,e),i}function ec(n,e,t,i){let r={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=i);let o=new KeyboardEvent("keydown",r);o.synthetic=!0,n.dispatchEvent(o);let s=new KeyboardEvent("keyup",r);return s.synthetic=!0,n.dispatchEvent(s),o.defaultPrevented||s.defaultPrevented}function vq(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function xq(n,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(i=Math.min(i,Vr(t));;)if(i){if(t.nodeType!=1)return!1;let r=t.childNodes[i-1];r.contentEditable=="false"?i--:(t=r,i=Vr(t))}else{if(t==n)return!0;i=No(t),t=t.parentNode}}function GT(n){return n instanceof Window?n.pageYOffset>Math.max(0,n.document.documentElement.scrollHeight-n.innerHeight-4):n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function XT(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=Vr(t)}else if(t.parentNode&&!jg(t))i=No(t),t=t.parentNode;else return null}}function YT(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i<t.nodeValue.length)return{node:t,offset:i};if(t.nodeType==1&&i<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[i],i=0}else if(t.parentNode&&!jg(t))i=No(t)+1,t=t.parentNode;else return null}}var Ji=class n{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new n(e.parentNode,No(e),t)}static after(e,t){return new n(e.parentNode,No(e)+1,t)}},We=(function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n})(We||(We={})),Vs=We.LTR,Cb=We.RTL;function ZT(n){let e=[];for(let t=0;t<n.length;t++)e.push(1<<+n[t]);return e}var bq=ZT("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),_q=ZT("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),q0=Object.create(null),Zi=[];for(let n of["()","[]","{}"]){let e=n.charCodeAt(0),t=n.charCodeAt(1);q0[e]=t,q0[t]=-e}function JT(n){return n<=247?bq[n]:1424<=n&&n<=1524?2:1536<=n&&n<=1785?_q[n-1536]:1774<=n&&n<=2220?4:8192<=n&&n<=8204?256:64336<=n&&n<=65023?4:1}var wq=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,oi=class{get dir(){return this.level%2?Cb:Vs}constructor(e,t,i){this.from=e,this.to=t,this.level=i}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,i,r){let o=-1;for(let s=0;s<e.length;s++){let a=e[s];if(a.from<=t&&a.to>=t){if(a.level==i)return s;(o<0||(r!=0?r<0?a.from<t:a.to>t:e[o].level>a.level))&&(o=s)}}if(o<0)throw new RangeError("Index out of range");return o}};function eA(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++){let i=n[t],r=e[t];if(i.from!=r.from||i.to!=r.to||i.direction!=r.direction||!eA(i.inner,r.inner))return!1}return!0}var Ne=[];function Cq(n,e,t,i,r){for(let o=0;o<=i.length;o++){let s=o?i[o-1].to:e,a=o<i.length?i[o].from:t,l=o?256:r;for(let c=s,u=l,f=l;c<a;c++){let h=JT(n.charCodeAt(c));h==512?h=u:h==8&&f==4&&(h=16),Ne[c]=h==4?2:h,h&7&&(f=h),u=h}for(let c=s,u=l,f=l;c<a;c++){let h=Ne[c];if(h==128)c<a-1&&u==Ne[c+1]&&u&24?h=Ne[c]=u:Ne[c]=256;else if(h==64){let d=c+1;for(;d<a&&Ne[d]==64;)d++;let p=c&&u==8||d<t&&Ne[d]==8?f==1?1:8:256;for(let m=c;m<d;m++)Ne[m]=p;c=d-1}else h==8&&f==1&&(Ne[c]=1);u=h,h&7&&(f=h)}}}function Eq(n,e,t,i,r){let o=r==1?2:1;for(let s=0,a=0,l=0;s<=i.length;s++){let c=s?i[s-1].to:e,u=s<i.length?i[s].from:t;for(let f=c,h,d,p;f<u;f++)if(d=q0[h=n.charCodeAt(f)])if(d<0){for(let m=a-3;m>=0;m-=3)if(Zi[m+1]==-d){let g=Zi[m+2],b=g&2?r:g&4?g&1?o:r:0;b&&(Ne[f]=Ne[Zi[m]]=b),a=m;break}}else{if(Zi.length==189)break;Zi[a++]=f,Zi[a++]=h,Zi[a++]=l}else if((p=Ne[f])==2||p==1){let m=p==r;l=m?0:1;for(let g=a-3;g>=0;g-=3){let b=Zi[g+2];if(b&2)break;if(m)Zi[g+2]|=2;else{if(b&4)break;Zi[g+2]|=4}}}}}function Sq(n,e,t,i){for(let r=0,o=i;r<=t.length;r++){let s=r?t[r-1].to:n,a=r<t.length?t[r].from:e;for(let l=s;l<a;){let c=Ne[l];if(c==256){let u=l+1;for(;;)if(u==a){if(r==t.length)break;u=t[r++].to,a=r<t.length?t[r].from:e}else if(Ne[u]==256)u++;else break;let f=o==1,h=(u<e?Ne[u]:i)==1,d=f==h?f?1:2:i;for(let p=u,m=r,g=m?t[m-1].to:n;p>l;)p==g&&(p=t[--m].from,g=m?t[m-1].to:n),Ne[--p]=d;l=u}else o=c,l++}}}function V0(n,e,t,i,r,o,s){let a=i%2?2:1;if(i%2==r%2)for(let l=e,c=0;l<t;){let u=!0,f=!1;if(c==o.length||l<o[c].from){let m=Ne[l];m!=a&&(u=!1,f=m==16)}let h=!u&&a==1?[]:null,d=u?i:i+1,p=l;e:for(;;)if(c<o.length&&p==o[c].from){if(f)break e;let m=o[c];if(!u)for(let g=m.to,b=c+1;;){if(g==t)break e;if(b<o.length&&o[b].from==g)g=o[b++].to;else{if(Ne[g]==a)break e;break}}if(c++,h)h.push(m);else{m.from>l&&s.push(new oi(l,m.from,d));let g=m.direction==Vs!=!(d%2);H0(n,g?i+1:i,r,m.inner,m.from,m.to,s),l=m.to}p=m.to}else{if(p==t||(u?Ne[p]!=a:Ne[p]==a))break;p++}h?V0(n,l,p,i+1,r,h,s):l<p&&s.push(new oi(l,p,d)),l=p}else for(let l=t,c=o.length;l>e;){let u=!0,f=!1;if(!c||l>o[c-1].to){let m=Ne[l-1];m!=a&&(u=!1,f=m==16)}let h=!u&&a==1?[]:null,d=u?i:i+1,p=l;e:for(;;)if(c&&p==o[c-1].to){if(f)break e;let m=o[--c];if(!u)for(let g=m.from,b=c;;){if(g==e)break e;if(b&&o[b-1].to==g)g=o[--b].from;else{if(Ne[g-1]==a)break e;break}}if(h)h.push(m);else{m.to<l&&s.push(new oi(m.to,l,d));let g=m.direction==Vs!=!(d%2);H0(n,g?i+1:i,r,m.inner,m.from,m.to,s),l=m.from}p=m.from}else{if(p==e||(u?Ne[p-1]!=a:Ne[p-1]==a))break;p--}h?V0(n,p,l,i+1,r,h,s):p<l&&s.push(new oi(p,l,d)),l=p}}function H0(n,e,t,i,r,o,s){let a=e%2?2:1;Cq(n,r,o,i,a),Eq(n,r,o,i,a),Sq(r,o,i,a),V0(n,r,o,e,t,i,s)}function Oq(n,e,t){if(!n)return[new oi(0,0,e==Cb?1:0)];if(e==Vs&&!t.length&&!wq.test(n))return tA(n.length);if(t.length)for(;n.length>Ne.length;)Ne[Ne.length]=256;let i=[],r=e==Vs?0:1;return H0(n,r,r,t,0,n.length,i),i}function tA(n){return[new oi(0,n,0)]}var nA="";function kq(n,e,t,i,r){var o;let s=i.head-n.from,a=oi.find(e,s,(o=i.bidiLevel)!==null&&o!==void 0?o:-1,i.assoc),l=e[a],c=l.side(r,t);if(s==c){let h=a+=r?1:-1;if(h<0||h>=e.length)return null;l=e[a=h],s=l.side(!r,t),c=l.side(r,t)}let u=Dt(n.text,s,l.forward(r,t));(u<l.from||u>l.to)&&(u=c),nA=n.text.slice(Math.min(s,u),Math.max(s,u));let f=a==(r?e.length-1:0)?null:e[a+(r?1:-1)];return f&&u==c&&f.level+(r?0:1)<l.level?$.cursor(f.side(!r,t)+n.from,f.forward(r,t)?1:-1,f.level):$.cursor(u+n.from,l.forward(r,t)?-1:1,l.level)}function Rq(n,e,t){for(let i=e;i<t;i++){let r=JT(n.charCodeAt(i));if(r==1)return Vs;if(r==2||r==4)return Cb}return Vs}var iA=H.define(),rA=H.define(),oA=H.define(),sA=H.define(),z0=H.define(),aA=H.define(),lA=H.define(),Eb=H.define(),Sb=H.define(),cA=H.define({combine:n=>n.some(e=>e)}),Tq=H.define({combine:n=>n.some(e=>e)}),uA=H.define(),wh=class n{constructor(e,t,i,r,o,s=!1){this.range=e,this.y=t,this.x=i,this.yMargin=r,this.xMargin=o,this.isSnapshot=s}map(e){return e.empty?this:new n(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new n($.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},Og=de.define({map:(n,e)=>n.map(e)}),fA=de.define();function It(n,e,t){let i=n.facet(sA);i.length?i[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}var Fr=H.define({combine:n=>n.length?n[0]:!0}),Aq=0,Xl=H.define({combine(n){return n.filter((e,t)=>{for(let i=0;i<t;i++)if(n[i].plugin==e.plugin)return!1;return!0})}}),Yt=class n{constructor(e,t,i,r,o){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=r,this.baseExtensions=o(this),this.extension=this.baseExtensions.concat(Xl.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Xl.of({plugin:this,arg:e}))}static define(e,t){let{eventHandlers:i,eventObservers:r,provide:o,decorations:s}=t||{};return new n(Aq++,e,i,r,a=>{let l=[];return s&&l.push(ey.of(c=>{let u=c.plugin(a);return u?s(u):he.none})),o&&l.push(o(a)),l})}static fromClass(e,t){return n.define((i,r)=>new e(i,r),t)}},Ch=class{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(It(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){It(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){It(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}},hA=H.define(),Ob=H.define(),ey=H.define(),dA=H.define(),kb=H.define(),Ph=H.define(),pA=H.define();function xT(n,e){let t=n.state.facet(pA);if(!t.length)return t;let i=t.map(o=>o instanceof Function?o(n):o),r=[];return Be.spans(i,e.from,e.to,{point(){},span(o,s,a,l){let c=o-e.from,u=s-e.from,f=r;for(let h=a.length-1;h>=0;h--,l--){let d=a[h].spec.bidiIsolate,p;if(d==null&&(d=Rq(e.text,c,u)),l>0&&f.length&&(p=f[f.length-1]).to==c&&p.direction==d)p.to=u,f=p.inner;else{let m={from:c,to:u,direction:d,inner:[]};f.push(m),f=m.inner}}}}),r}var mA=H.define();function Rb(n){let e=0,t=0,i=0,r=0;for(let o of n.state.facet(mA)){let s=o(n);s&&(s.left!=null&&(e=Math.max(e,s.left)),s.right!=null&&(t=Math.max(t,s.right)),s.top!=null&&(i=Math.max(i,s.top)),s.bottom!=null&&(r=Math.max(r,s.bottom)))}return{left:e,right:t,top:i,bottom:r}}var yh=H.define(),_i=class n{constructor(e,t,i,r){this.fromA=e,this.toA=t,this.fromB=i,this.toB=r}join(e){return new n(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>i.toA)){if(r.toA<i.fromA)break;i=i.join(r),e.splice(t-1,1)}}return e.splice(t,0,i),e}static extendWithRanges(e,t){if(t.length==0)return e;let i=[];for(let r=0,o=0,s=0;;){let a=r<e.length?e[r].fromB:1e9,l=o<t.length?t[o]:1e9,c=Math.min(a,l);if(c==1e9)break;let u=c+s,f=c,h=u;for(;;)if(o<t.length&&t[o]<=f){let d=t[o+1];o+=2,f=Math.max(f,d);for(let p=r;p<e.length&&e[p].fromB<=f;p++)s=e[p].toA-e[p].toB;h=Math.max(h,d+s)}else if(r<e.length&&e[r].fromB<=f){let d=e[r++];f=Math.max(f,d.toB),h=Math.max(h,d.toA),s=d.toA-d.toB}else break;i.push(new n(u,h,c,f))}return i}},Fg=class n{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=cn.empty(this.startState.doc.length);for(let o of i)this.changes=this.changes.compose(o.changes);let r=[];this.changes.iterChangedRanges((o,s,a,l)=>r.push(new _i(o,s,a,l))),this.changedRanges=r}static create(e,t,i){return new n(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},Mq=[],it=class{constructor(e,t,i=0){this.dom=e,this.length=t,this.flags=i,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return Mq}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&dq(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let i=t;for(let r of this.children){if(r==e)return i;i+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let i=No(this.dom),r=this.length?e>0:t>0;return new Ji(this.parent.dom,i+(r?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof nc)return e;return null}static get(e){return e.cmTile}},tc=class extends it{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,i=null,r,o=(e==null?void 0:e.node)==t?e:null,s=0;for(let a of this.children){if(a.sync(e),s+=a.length+a.breakAfter,r=i?i.nextSibling:t.firstChild,o&&r!=a.dom&&(o.written=!0),a.dom.parentNode==t)for(;r&&r!=a.dom;)r=bT(r);else t.insertBefore(a.dom,r);i=a.dom}for(r=i?i.nextSibling:t.firstChild,o&&r&&(o.written=!0);r;)r=bT(r);this.length=s}};function bT(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}var nc=class extends tc{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=it.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],i=this,r=0,o=0;;)if(r==i.children.length){if(!t.length)return;i=i.parent,i.breakAfter&&o++,r=t.pop()}else{let s=i.children[r++];if(s instanceof qr)t.push(r),i=s,r=0;else{let a=o+s.length,l=e(s,o);if(l!==void 0)return l;o=a+s.breakAfter}}}resolveBlock(e,t){let i,r=-1,o,s=-1;if(this.blockTiles((a,l)=>{let c=l+a.length;if(e>=l&&e<=c){if(a.isWidget()&&t>=-1&&t<=1){if(a.flags&32)return!0;a.flags&16&&(i=void 0)}(l<e||e==c&&(t<-1?a.length:a.covers(1)))&&(!i||!a.isWidget()&&i.isWidget())&&(i=a,r=e-l),(c>e||e==l&&(t>1?a.length:a.covers(-1)))&&(!o||!a.isWidget()&&o.isWidget())&&(o=a,s=e-l)}}),!i&&!o)throw new Error("No tile at position "+e);return i&&t<0||!o?{tile:i,offset:r}:{tile:o,offset:s}}},qr=class n extends tc{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let i=new n(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}},ic=class n extends tc{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,i){let r=new n(t||document.createElement("div"),e);return(!t||!i)&&(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(e,t,i){let r=null,o=-1,s=null,a=-1;function l(u,f){for(let h=0,d=0;h<u.children.length&&d<=f;h++){let p=u.children[h],m=d+p.length;m>=f&&(p.isComposite()?l(p,f-d):(!s||s.isHidden&&(t>0||i&&Dq(s,p)))&&(m>f||p.flags&32)?(s=p,a=f-d):(d<f||p.flags&16&&!p.isHidden)&&(r=p,o=f-d)),d=m}}l(this,e);let c=(t<0?r:s)||r||s;return c?{tile:c,offset:c==r?o:a}:null}coordsIn(e,t){let i=this.resolveInline(e,t,!0);return i?i.tile.coordsIn(Math.max(0,i.offset),t):Pq(this)}domIn(e,t){let i=this.resolveInline(e,t);if(i){let{tile:r,offset:o}=i;if(this.dom.contains(r.dom))return r.isText()?new Ji(r.dom,Math.min(r.dom.nodeValue.length,o)):r.domPosFor(o,r.flags&16?1:r.flags&32?-1:t);let s=i.tile.parent,a=!1;for(let l of s.children){if(a)return new Ji(l.dom,0);l==i.tile&&(a=!0)}}return new Ji(this.dom,0)}};function Pq(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=bh(e);return t[t.length-1]||null}function Dq(n,e){let t=n.coordsIn(0,1),i=e.coordsIn(0,1);return t&&i&&i.top<t.bottom}var bn=class n extends tc{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let i=new n(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}},Fs=class n extends it{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t){let i=this.dom.nodeValue.length;e>i&&(e=i);let r=e,o=e,s=0;e==0&&t<0||e==i&&t>=0?z.chrome||z.gecko||(e?(r--,s=1):o<i&&(o++,s=-1)):t<0?r--:o<i&&o++;let a=Mh(this.dom,r,o).getClientRects();if(!a.length)return null;let l=a[(s?s<0:t>=0)?0:a.length-1];return z.safari&&!s&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),s?Ah(l,s<0):l||null}static of(e,t){let i=new n(t||document.createTextNode(e),e);return t||(i.flags|=2),i}},Hs=class n extends it{constructor(e,t,i,r){super(e,t,r),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,i){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(i)return Ah(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let o=this.dom.getClientRects(),s=null;if(!o.length)return null;let a=this.flags&16?!0:this.flags&32?!1:e>0;for(let l=a?o.length-1:0;s=o[l],!(e>0?l==0:l==o.length-1||s.top<s.bottom);l+=a?-1:1);return Ah(s,!a)}}get overrideDOMText(){if(!this.length)return be.empty;let{root:e}=this;if(!e)return be.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,i,r,o){return o||(o=e.toDOM(t),e.editable||(o.contentEditable="false")),new n(o,i,e,r)}},rc=class extends it{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return be.empty}coordsIn(e){return this.dom.getBoundingClientRect()}},W0=class{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,i){let{tile:r,index:o,beforeBreak:s,parents:a}=this;for(;e||t>0;)if(r.isComposite())if(s){if(!e)break;i&&i.break(),e--,s=!1}else if(o==r.children.length){if(!e&&!a.length)break;i&&i.leave(r),s=!!r.breakAfter,{tile:r,index:o}=a.pop(),o++}else{let l=r.children[o],c=l.breakAfter;(t>0?l.length<=e:l.length<e)&&(!i||i.skip(l,0,l.length)!==!1||!l.isComposite)?(s=!!c,o++,e-=l.length):(a.push({tile:r,index:o}),r=l,o=0,i&&l.isComposite()&&i.enter(l))}else if(o==r.length)s=!!r.breakAfter,{tile:r,index:o}=a.pop(),o++;else if(e){let l=Math.min(e,r.length-o);i&&i.skip(r,o,o+l),e-=l,o+=l}else break;return this.tile=r,this.index=o,this.beforeBreak=s,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}},U0=class{constructor(e,t,i,r){this.from=e,this.to=t,this.wrapper=i,this.rank=r}},Q0=class{constructor(e,t,i){this.cache=e,this.root=t,this.blockWrappers=i,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,i,r){var o;this.flushBuffer();let s=this.ensureMarks(t,i),a=s.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+e.length<512){this.cache.reused.set(a,2);let l=s.children[s.children.length-1]=new Fs(a.dom,a.text+e);l.parent=s}else s.append(r||Fs.of(e,(o=this.cache.find(Fs))===null||o===void 0?void 0:o.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let i=this.curLine;i.dom!=t.line.dom&&(i.setDOM(this.cache.reused.has(t.line)?M0(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let r=i;for(let a=t.marks.length-1;a>=0;a--){let l=t.marks[a],c=r.lastChild;if(c instanceof bn&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM(M0(l.dom)),r=c;else{if(this.cache.reused.get(l)){let f=it.get(l.dom);f&&f.setDOM(M0(l.dom))}let u=bn.of(l.mark,l.dom);r.append(u),r=u}this.cache.reused.set(l,2)}let o=it.get(e.text);o&&this.cache.reused.set(o,2);let s=new Fs(e.text,e.text.nodeValue);s.flags|=8,this.pos=e.range.toB,r.append(s)}addInlineWidget(e,t,i){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let o=this.ensureMarks(t,i);!r&&!(e.flags&16)&&o.append(this.getBuffer(1)),o.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,i){this.flushBuffer(),this.ensureMarks(t,i).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var i;e||(e=gA);let r=ic.start(e,t||((i=this.cache.find(ic))===null||i===void 0?void 0:i.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var i;let r=this.curLine;for(let o=e.length-1;o>=0;o--){let s=e[o],a;if(t>0&&(a=r.lastChild)&&a instanceof bn&&a.mark.eq(s))r=a,t--;else{let l=bn.of(s,(i=this.cache.find(bn,c=>c.mark.eq(s)))===null||i===void 0?void 0:i.dom);r.append(l),r=l,t=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!_T(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(z.ios&&_T(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(P0,0,32)||new Hs(P0.toDOM(),0,P0,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=e.rank*102+e.value.rank,i=new U0(e.from,e.to,e.value,t),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-i.rank||this.wrappers[r-1].to-i.to)<0;)r--;this.wrappers.splice(r,0,i)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let i of this.wrappers){let r=t.lastChild;if(i.from<this.pos&&r instanceof qr&&r.wrapper.eq(i.wrapper))t=r;else{let o=qr.of(i.wrapper,(e=this.cache.find(qr,s=>s.wrapper.eq(i.wrapper)))===null||e===void 0?void 0:e.dom);t.append(o),t=o}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),i=this.cache.find(rc,void 0,1);return i&&(i.flags=t),i||new rc(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},K0=class{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:r,lineBreak:o,done:s}=this.cursor.next(this.skipCount);if(this.skipCount=0,s)throw new Error("Ran out of text content when drawing inline views");this.text=r;let a=this.textOff=Math.min(e,r.length);return o?null:r.slice(0,a)}let t=Math.min(this.text.length,this.textOff+e),i=this.text.slice(this.textOff,t);return this.textOff=t,i}},qg=[Hs,ic,Fs,bn,rc,qr,nc];for(let n=0;n<qg.length;n++)qg[n].bucket=n;var G0=class{constructor(e){this.view=e,this.buckets=qg.map(()=>[]),this.index=qg.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,i=this.buckets[t];i.length<6?i.push(e):i[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,i=2){let r=e.bucket,o=this.buckets[r],s=this.index[r];for(let a=o.length-1;a>=0;a--){let l=(a+s)%o.length,c=o[l];if((!t||t(c))&&!this.reused.has(c))return o.splice(l,1),l<s&&this.index[r]--,this.reused.set(c,i),c}return null}findWidget(e,t,i){let r=this.buckets[0];if(r.length)for(let o=0,s=0;;o++){if(o==r.length){if(s)return null;s=1,o=0}let a=r[o];if(!this.reused.has(a)&&(s==0?a.widget.compare(e):a.widget.constructor==e.constructor&&e.updateDOM(a.dom,this.view,a.widget)))return r.splice(o,1),o<this.index[0]&&this.index[0]--,a.widget==e&&a.length==t&&(a.flags&497)==i?(this.reused.set(a,1),a):(this.reused.set(a,2),new Hs(a.dom,t,e,a.flags&-498|i))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}},X0=class{constructor(e,t,i,r,o){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=o,this.openWidget=!1,this.openMarks=0,this.cache=new G0(e),this.text=new K0(e.state.doc),this.builder=new Q0(this.cache,new nc(e,e.contentDOM),Be.iter(i)),this.cache.reused.set(t,2),this.old=new W0(t),this.reuseWalker={skip:(s,a,l)=>{if(this.cache.add(s),s.isComposite())return!1},enter:s=>this.cache.add(s),leave:()=>{},break:()=>{}}}run(e,t){let i=t&&this.getCompositionContext(t.text);for(let r=0,o=0,s=0;;){let a=s<e.length?e[s++]:null,l=a?a.fromA:this.old.root.length;if(l>r){let c=l-r;this.preserve(c,!s,!a),r=l,o+=c}if(!a)break;t&&a.fromA<=t.range.fromA&&a.toA>=t.range.toA?(this.forward(a.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(o,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,i),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,a.toA),this.emit(t.range.toB,a.toB)):(this.forward(a.fromA,a.toA),this.emit(o,a.toB)),o=a.toB,r=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,i){let r=Bq(this.old),o=this.openMarks;this.old.advance(e,i?1:-1,{skip:(s,a,l)=>{if(s.isWidget())if(this.openWidget)this.builder.continueWidget(l-a);else{let c=l>0||a<s.length?Hs.of(s.widget,this.view,l-a,s.flags&496,this.cache.maybeReuse(s)):this.cache.reuse(s);c.flags&256?(c.flags&=-2,this.builder.addBlockWidget(c)):(this.builder.ensureLine(null),this.builder.addInlineWidget(c,r,o),o=r.length)}else if(s.isText())this.builder.ensureLine(null),!a&&l==s.length&&!this.cache.reused.has(s)?this.builder.addText(s.text,r,o,this.cache.reuse(s)):(this.cache.add(s),this.builder.addText(s.text.slice(a,l),r,o)),o=r.length;else if(s.isLine())s.flags&=-2,this.cache.reused.set(s,1),this.builder.addLine(s);else if(s instanceof rc)this.cache.add(s);else if(s instanceof bn)this.builder.ensureLine(null),this.builder.addMark(s,r,o),this.cache.reused.set(s,1),o=r.length;else return!1;this.openWidget=!1},enter:s=>{s.isLine()?this.builder.addLineStart(s.attrs,this.cache.maybeReuse(s)):(this.cache.add(s),s instanceof bn&&r.unshift(s.mark)),this.openWidget=!1},leave:s=>{s.isLine()?r.length&&(r.length=o=0):s instanceof bn&&(r.shift(),o=Math.min(o,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let i=null,r=this.builder,o=0,s=Be.spans(this.decorations,e,t,{point:(a,l,c,u,f,h)=>{if(c instanceof qs){if(this.disallowBlockEffectsFor[h]){if(c.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(o=u.length,f>u.length)r.continueWidget(l-a);else{let d=c.widget||(c.block?$o.block:$o.inline),p=Iq(c),m=this.cache.findWidget(d,l-a,p)||Hs.of(d,this.view,l-a,p);c.block?(c.startSide>0&&r.addLineStartIfNotCovered(i),r.addBlockWidget(m)):(r.ensureLine(i),r.addInlineWidget(m,u,f))}i=null}else i=Lq(i,c);l>a&&this.text.skip(l-a)},span:(a,l,c,u)=>{for(let f=a;f<l;){let h=this.text.next(Math.min(512,l-f));h==null?(r.addLineStartIfNotCovered(i),r.addBreak(),f++):(r.ensureLine(i),r.addText(h,c,f==a?u:c.length),f+=h.length),i=null}}});r.addLineStartIfNotCovered(i),this.openWidget=s>o,this.openMarks=s}forward(e,t,i=1){t-e<=10?this.old.advance(t-e,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(e){let t=[],i=null;for(let r=e.parentNode;;r=r.parentNode){let o=it.get(r);if(r==this.view.contentDOM)break;o instanceof bn?t.push(o):o!=null&&o.isLine()?i=o:o instanceof qr||(r.nodeName=="DIV"&&!i&&r!=this.view.contentDOM?i=new ic(r,gA):i||t.push(bn.of(new kh({tagName:r.nodeName.toLowerCase(),attributes:pq(r)}),r)))}return{line:i,marks:t}}};function _T(n,e){let t=i=>{for(let r of i.children)if((e?r.isText():r.length)||t(r))return!0;return!1};return t(n)}function Iq(n){let e=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(e|=256),e}var gA={class:"cm-line"};function Lq(n,e){let t=e.spec.attributes,i=e.spec.class;return!t&&!i||(n||(n={class:"cm-line"}),t&&_b(t,n),i&&(n.class+=" "+i)),n}function Bq(n){let e=[];for(let t=n.parents.length;t>1;t--){let i=t==n.parents.length?n.tile:n.parents[t].tile;i instanceof bn&&e.push(i.mark)}return e}function M0(n){let e=it.get(n);return e&&e.setDOM(n.cloneNode()),n}var $o=class extends ai{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}};$o.inline=new $o("span");$o.block=new $o("div");var P0=new class extends ai{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}},Vg=class{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=he.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new nc(e,e.contentDOM),this.updateInner([new _i(0,0,0,e.state.doc.length)],null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:u,toA:f})=>f<this.minWidthFrom||u>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?r=this.domChanged.newSel.head:!zq(e.changes,this.hasComposition)&&!e.selectionSet&&(r=e.state.selection.main.head));let o=r>-1?$q(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:u,to:f}=this.hasComposition;i=new _i(u,f,e.changes.mapPos(u,-1),e.changes.mapPos(f,1)).addToSet(i.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(z.ie||z.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let s=this.decorations,a=this.blockWrappers;this.updateDeco();let l=qq(s,this.decorations,e.changes);l.length&&(i=_i.extendWithRanges(i,l));let c=Vq(a,this.blockWrappers,e.changes);return c.length&&(i=_i.extendWithRanges(i,c)),o&&!i.some(u=>u.fromA<=o.range.fromA&&u.toA>=o.range.toA)&&(i=o.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(t||e.length){let s=this.tile,a=new X0(this.view,s,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&it.get(t.text)&&a.cache.reused.set(it.get(t.text),2),this.tile=a.run(e,t),Y0(s,a.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=z.chrome||z.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(o),o&&(o.written||i.selectionRange.focusNode!=o.node||!this.tile.dom.contains(o.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let o of this.tile.children)o.isWidget()&&o.widget instanceof Eh&&r.push(o.dom);i.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let i of t.effects)i.is(fA)&&(this.editContextFormatting=i.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:i}=this.tile,r=this.view.root.activeElement,o=r==i,s=!o&&!(this.view.state.facet(Fr)||i.tabIndex>-1)&&xh(i,this.view.observer.selectionRange)&&!(r&&i.contains(r));if(!(o||t||s))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c,u;if(l.empty?u=c=this.inlineDOMNearPos(l.anchor,l.assoc||1):(u=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),c=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),z.gecko&&l.empty&&!this.hasComposition&&Nq(c)){let h=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(h,c.node.childNodes[c.offset]||null)),c=u=new Ji(h,0),a=!0}let f=this.view.observer.selectionRange;(a||!f.focusNode||(!_h(c.node,c.offset,f.anchorNode,f.anchorOffset)||!_h(u.node,u.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,l))&&(this.view.observer.ignore(()=>{z.android&&z.chrome&&i.contains(f.focusNode)&&Hq(f.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let h=Th(this.view.root);if(h)if(l.empty){if(z.gecko){let d=jq(c.node,c.offset);if(d&&d!=3){let p=(d==1?XT:YT)(c.node,c.offset);p&&(c=new Ji(p.node,p.offset))}}h.collapse(c.node,c.offset),l.bidiLevel!=null&&h.caretBidiLevel!==void 0&&(h.caretBidiLevel=l.bidiLevel)}else if(h.extend){h.collapse(c.node,c.offset);try{h.extend(u.node,u.offset)}catch{}}else{let d=document.createRange();l.anchor>l.head&&([c,u]=[u,c]),d.setEnd(u.node,u.offset),d.setStart(c.node,c.offset),h.removeAllRanges(),h.addRange(d)}s&&this.view.root.activeElement==i&&(i.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,u)),this.impreciseAnchor=c.precise?null:new Ji(f.anchorNode,f.anchorOffset),this.impreciseHead=u.precise?null:new Ji(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&_h(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=Th(e.root),{anchorNode:r,anchorOffset:o}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let s=this.lineAt(t.head,t.assoc);if(!s)return;let a=s.posAtStart;if(t.head==a||t.head==a+s.length)return;let l=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!l||!c||l.bottom>c.top)return;let u=this.domAtPos(t.head+t.assoc,t.assoc);i.collapse(u.node,u.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from&&i.collapse(r,o)}posFromDOM(e,t){let i=this.tile.nearest(e);if(!i)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=i.posAtStart;if(i.isComposite()){let o;if(e==i.dom)o=i.dom.childNodes[t];else{let s=Vr(e)==0?0:t==0?-1:1;for(;;){let a=e.parentNode;if(a==i.dom)break;s==0&&a.firstChild!=a.lastChild&&(e==a.firstChild?s=-1:s=1),e=a}s<0?o=e:o=e.nextSibling}if(o==i.dom.firstChild)return r;for(;o&&!it.get(o);)o=o.nextSibling;if(!o)return r+i.length;for(let s=0,a=r;;s++){let l=i.children[s];if(l.dom==o)return a;a+=l.length+l.breakAfter}}else return i.isText()?e==i.dom?r+t:r+(t?i.length:0):r}domAtPos(e,t){let{tile:i,offset:r}=this.tile.resolveBlock(e,t);return i.isWidget()?i.domPosFor(e,t):i.domIn(r,t)}inlineDOMNearPos(e,t){let i,r=-1,o=!1,s,a=-1,l=!1;return this.tile.blockTiles((c,u)=>{if(c.isWidget()){if(c.flags&32&&u>=e)return!0;c.flags&16&&(o=!0)}else{let f=u+c.length;if(u<=e&&(i=c,r=e-u,o=f<e),f>=e&&!s&&(s=c,a=e-u,l=u>e),u>e&&s)return!0}}),!i&&!s?this.domAtPos(e,t):(o&&s?i=null:l&&i&&(s=null),i&&t<0||!s?i.domIn(r,t):s.domIn(a,t))}coordsAt(e,t){let{tile:i,offset:r}=this.tile.resolveBlock(e,t);return i.isWidget()?i.widget instanceof Eh?null:i.coordsInWidget(r,t,!0):i.coordsIn(r,t)}lineAt(e,t){let{tile:i}=this.tile.resolveBlock(e,t);return i.isLine()?i:null}coordsForChar(e){let{tile:t,offset:i}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(o,s){if(o.isComposite())for(let a of o.children){if(a.length>=s){let l=r(a,s);if(l)return l}if(s-=a.length,s<0)break}else if(o.isText()&&s<o.length){let a=Dt(o.text,s);if(a==s)return null;let l=Mh(o.dom,s,a).getClientRects();for(let c=0;c<l.length;c++){let u=l[c];if(c==l.length-1||u.top<u.bottom&&u.left<u.right)return u}}return null}return r(t,i)}measureVisibleLineHeights(e){let t=[],{from:i,to:r}=e,o=this.view.contentDOM.clientWidth,s=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==We.LTR,c=0,u=(f,h,d)=>{for(let p=0;p<f.children.length&&!(h>r);p++){let m=f.children[p],g=h+m.length,b=m.dom.getBoundingClientRect(),{height:_}=b;if(d&&!p&&(c+=b.top-d.top),m instanceof qr)g>i&&u(m,h,b);else if(h>=i&&(c>0&&t.push(-c),t.push(_+c),c=0,s)){let v=m.dom.lastChild,x=v?bh(v):[];if(x.length){let C=x[x.length-1],E=l?C.right-b.left:b.right-C.left;E>a&&(a=E,this.minWidth=o,this.minWidthFrom=h,this.minWidthTo=g)}}d&&p==f.children.length-1&&(c+=d.bottom-b.bottom),h=g+m.breakAfter}};return u(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?We.RTL:We.LTR}measureTextSize(){let e=this.tile.blockTiles(s=>{if(s.isLine()&&s.children.length&&s.length<=20){let a=0,l;for(let c of s.children){if(!c.isText()||/[^ -~]/.test(c.text))return;let u=bh(c.dom);if(u.length!=1)return;a+=u[0].width,l=u[0].height}if(a)return{lineHeight:s.dom.getBoundingClientRect().height,charWidth:a/s.length,textHeight:l}}});if(e)return e;let t=document.createElement("div"),i,r,o;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let s=bh(t.firstChild)[0];i=t.getBoundingClientRect().height,r=s&&s.width?s.width/27:7,o=s&&s.height?s.height:i,t.remove()}),{lineHeight:i,charWidth:r,textHeight:o}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,r=0;;r++){let o=r==t.viewports.length?null:t.viewports[r],s=o?o.from-1:this.view.state.doc.length;if(s>i){let a=(t.lineBlockAt(s).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(he.replace({widget:new Eh(a),block:!0,inclusive:!0,isBlockGap:!0}).range(i,s))}if(!o)break;i=o.to+1}return he.set(e)}updateDeco(){let e=1,t=this.view.state.facet(ey).map(o=>(this.dynamicDecorationMap[e++]=typeof o=="function")?o(this.view):o),i=!1,r=this.view.state.facet(kb).map((o,s)=>{let a=typeof o=="function";return a&&(i=!0),a?o(this.view):o});for(r.length&&(this.dynamicDecorationMap[e++]=i,t.push(Be.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(dA).map(o=>typeof o=="function"?o(this.view):o)}scrollIntoView(e){var t;if(e.isSnapshot){let u=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=u.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let u of this.view.state.facet(uA))try{if(u(this.view,e.range,e))return!0}catch(f){It(this.view.state,f,"scroll handler")}let{range:i}=e,r=this.coordsAt(i.head,(t=i.assoc)!==null&&t!==void 0?t:i.empty?0:i.head>i.anchor?-1:1),o;if(!r)return;!i.empty&&(o=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(r={left:Math.min(r.left,o.left),top:Math.min(r.top,o.top),right:Math.max(r.right,o.right),bottom:Math.max(r.bottom,o.bottom)});let s=Rb(this.view),a={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:l,offsetHeight:c}=this.view.scrollDOM;if(yq(this.view.scrollDOM,a,i.head<i.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,l),-l),Math.max(Math.min(e.yMargin,c),-c),this.view.textDirection==We.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(r.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||r.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let u=this.view.docView.lineAt(i.head,1);u&&u.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let t=i=>i.isWidget()||i.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Y0(this.tile)}};function Y0(n,e){let t=e==null?void 0:e.get(n);if(t!=1){t==null&&n.destroy();for(let i of n.children)Y0(i,e)}}function Nq(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function yA(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let i=XT(t.focusNode,t.focusOffset),r=YT(t.focusNode,t.focusOffset),o=i||r;if(r&&i&&r.node!=i.node){let a=it.get(r.node);if(!a||a.isText()&&a.text!=r.node.nodeValue)o=r;else if(n.docView.lastCompositionAfterCursor){let l=it.get(i.node);!l||l.isText()&&l.text!=i.node.nodeValue||(o=r)}}if(n.docView.lastCompositionAfterCursor=o!=i,!o)return null;let s=e-o.offset;return{from:s,to:s+o.node.nodeValue.length,node:o.node}}function $q(n,e,t){let i=yA(n,t);if(!i)return null;let{node:r,from:o,to:s}=i,a=r.nodeValue;if(/[\n\r]/.test(a)||n.state.doc.sliceString(i.from,i.to)!=a)return null;let l=e.invertedDesc;return{range:new _i(l.mapPos(o),l.mapPos(s),o,s),text:r}}function jq(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e<n.childNodes.length&&n.childNodes[e].contentEditable=="false"?2:0)}var Fq=class{constructor(){this.changes=[]}compareRange(e,t){Jl(e,t,this.changes)}comparePoint(e,t){Jl(e,t,this.changes)}boundChange(e){Jl(e,e,this.changes)}};function qq(n,e,t){let i=new Fq;return Be.compare(n,e,t,i),i.changes}var Z0=class{constructor(){this.changes=[]}compareRange(e,t){Jl(e,t,this.changes)}comparePoint(){}boundChange(e){Jl(e,e,this.changes)}};function Vq(n,e,t){let i=new Z0;return Be.compare(n,e,t,i),i.changes}function Hq(n,e){for(let t=n;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function zq(n,e){let t=!1;return e&&n.iterChangedRanges((i,r)=>{i<e.to&&r>e.from&&(t=!0)}),t}var Eh=class extends ai{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}};function Wq(n,e,t=1){let i=n.charCategorizer(e),r=n.doc.lineAt(e),o=e-r.from;if(r.length==0)return $.cursor(e);o==0?t=1:o==r.length&&(t=-1);let s=o,a=o;t<0?s=Dt(r.text,o,!1):a=Dt(r.text,o);let l=i(r.text.slice(s,a));for(;s>0;){let c=Dt(r.text,s,!1);if(i(r.text.slice(c,s))!=l)break;s=c}for(;a<r.length;){let c=Dt(r.text,a);if(i(r.text.slice(a,c))!=l)break;a=c}return $.range(s+r.from,a+r.from)}function Uq(n,e,t,i,r){let o=Math.round((i-e.left)*n.defaultCharacterWidth);if(n.lineWrapping&&t.height>n.defaultLineHeight*1.5){let a=n.viewState.heightOracle.textHeight,l=Math.floor((r-t.top-(n.defaultLineHeight-a)*.5)/a);o+=l*n.viewState.heightOracle.lineLength}let s=n.state.sliceDoc(t.from,t.to);return t.from+aT(s,o,n.state.tabSize)}function Qq(n,e,t){let i=n.lineBlockAt(e);if(Array.isArray(i.type)){let r;for(let o of i.type){if(o.from>e)break;if(!(o.to<e)){if(o.from<e&&o.to>e)return o;(!r||o.type==si.Text&&(r.type!=o.type||(t<0?o.from<e:o.to>e)))&&(r=o)}}return r||i}return i}function Kq(n,e,t,i){let r=Qq(n,e.head,e.assoc||-1),o=!i||r.type!=si.Text||!(n.lineWrapping||r.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head);if(o){let s=n.dom.getBoundingClientRect(),a=n.textDirectionAt(r.from),l=n.posAtCoords({x:t==(a==We.LTR)?s.right-1:s.left+1,y:(o.top+o.bottom)/2});if(l!=null)return $.cursor(l,t?-1:1)}return $.cursor(t?r.to:r.from,t?-1:1)}function wT(n,e,t,i){let r=n.state.doc.lineAt(e.head),o=n.bidiSpans(r),s=n.textDirectionAt(r.from);for(let a=e,l=null;;){let c=kq(r,o,s,a,t),u=nA;if(!c){if(r.number==(t?n.state.doc.lines:1))return a;u=`
283 `&&n.lineWrapping&&(i&&(i=$.single(i.main.anchor-1,i.main.head-1)),t={from:o.from,to:o.to,insert:be.of([" "])}),t)return Tb(n,t,i,s);if(i&&!zg(i,o)){let a=!1,l="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(a=!0),l=n.inputState.lastSelectionOrigin,l=="select.pointer"&&(i=vA(r.facet(Ph).map(c=>c(n)),i))),n.dispatch({selection:i,scrollIntoView:a,userEvent:l}),!0}else return!1}function Tb(n,e,t,i=-1){if(z.ios&&n.inputState.flushIOSKey(e))return!0;let r=n.state.selection.main;if(z.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&n.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&ec(n.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&ec(n.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&ec(n.contentDOM,"Delete",46)))return!0;let o=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let s,a=()=>s||(s=Jq(n,e,t));return n.state.facet(aA).some(l=>l(n,e.from,e.to,o,a))||n.dispatch(a()),!0}function Jq(n,e,t){let i,r=n.state,o=r.selection.main,s=-1;if(e.from==e.to&&e.from<o.from||e.from>o.to){let l=e.from<o.from?-1:1,c=l<0?o.from:o.to,u=Sh(r.facet(Ph).map(f=>f(n)),c,l);e.from==u&&(s=u)}if(s>-1)i={changes:e,selection:$.cursor(e.from+e.insert.length,-1)};else if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let l=o.from<e.from?r.sliceDoc(o.from,e.from):"",c=o.to>e.to?r.sliceDoc(e.to,o.to):"";i=r.replaceSelection(n.state.toText(l+e.insert.sliceString(0,void 0,n.state.lineBreak)+c))}else{let l=r.changes(e),c=t&&t.main.to<=l.newLength?t.main:void 0;if(r.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=o.to+10&&e.to>=o.to-10){let u=n.state.sliceDoc(e.from,e.to),f,h=t&&yA(n,t.main.head);if(h){let p=e.insert.length-(e.to-e.from);f={from:h.from,to:h.to-p}}else f=n.state.doc.lineAt(o.head);let d=o.to-e.to;i=r.changeByRange(p=>{if(p.from==o.from&&p.to==o.to)return{changes:l,range:c||p.map(l)};let m=p.to-d,g=m-u.length;if(n.state.sliceDoc(g,m)!=u||m>=f.from&&g<=f.to)return{range:p};let b=r.changes({from:g,to:m,insert:e.insert}),_=p.to-o.to;return{changes:b,range:c?$.range(Math.max(0,c.anchor+_),Math.max(0,c.head+_)):p.map(b)}})}else i={changes:l,selection:c&&r.selection.replaceRange(c)}}let a="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,a+=".compose",n.inputState.compositionFirstChange&&(a+=".start",n.inputState.compositionFirstChange=!1)),r.update(i,{userEvent:a,scrollIntoView:!0})}function _A(n,e,t,i){let r=Math.min(n.length,e.length),o=0;for(;o<r&&n.charCodeAt(o)==e.charCodeAt(o);)o++;if(o==r&&n.length==e.length)return null;let s=n.length,a=e.length;for(;s>0&&a>0&&n.charCodeAt(s-1)==e.charCodeAt(a-1);)s--,a--;if(i=="end"){let l=Math.max(0,o-Math.min(s,a));t-=s+l-o}if(s<o&&n.length<e.length){let l=t<=o&&t>=s?o-t:0;o-=l,a=o+(a-s),s=o}else if(a<o){let l=t<=o&&t>=a?o-t:0;o-=l,s=o+(s-a),a=o}return{from:o,toA:s,toB:a}}function eV(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:r,focusOffset:o}=n.observer.selectionRange;return t&&(e.push(new Hg(t,i)),(r!=t||o!=i)&&e.push(new Hg(r,o))),e}function tV(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?$.single(t+e,i+e):null}function zg(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}var ib=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,z.safari&&e.contentDOM.addEventListener("input",()=>null),z.gecko&&mV(e.contentDOM.ownerDocument)}handleEvent(e){!lV(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let r of i.observers)r(this.view,t);for(let r of i.handlers){if(t.defaultPrevented)break;if(r(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=nV(e),i=this.handlers,r=this.view.contentDOM;for(let o in t)if(o!="scroll"){let s=!t[o].handlers.length,a=i[o];a&&s!=!a.handlers.length&&(r.removeEventListener(o,this.handleEvent),a=null),a||r.addEventListener(o,this.handleEvent,{passive:s})}for(let o in i)o!="scroll"&&!t[o]&&r.removeEventListener(o,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&CA.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),z.android&&z.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return z.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&!e.shiftKey&&((t=wA.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||iV.indexOf(e.key)>-1&&e.ctrlKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,ec(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:z.safari&&!z.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function CT(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(r){It(t.state,r)}}}function nV(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let r=i.spec,o=r&&r.plugin.domEventHandlers,s=r&&r.plugin.domEventObservers;if(o)for(let a in o){let l=o[a];l&&t(a).handlers.push(CT(i.value,l))}if(s)for(let a in s){let l=s[a];l&&t(a).observers.push(CT(i.value,l))}}for(let i in wi)t(i).handlers.push(wi[i]);for(let i in _n)t(i).observers.push(_n[i]);return e}var wA=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],iV="dthko",CA=[16,17,18,20,91,92,224,225],kg=6;function Rg(n){return Math.max(0,n)*.7+8}function rV(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}var rb=class{constructor(e,t,i,r){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=QT(e.contentDOM),this.atoms=e.state.facet(Ph).map(s=>s(e));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(Ze.allowMultipleSelections)&&oV(e,t),this.dragging=aV(e,t)&&OA(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&rV(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,r=0,o=0,s=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:s}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=Rb(this.view);e.clientX-l.left<=r+kg?t=-Rg(r-e.clientX):e.clientX+l.right>=s-kg&&(t=Rg(e.clientX-s)),e.clientY-l.top<=o+kg?i=-Rg(o-e.clientY):e.clientY+l.bottom>=a-kg&&(i=Rg(e.clientY-a)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,i=vA(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}};function oV(n,e){let t=n.state.facet(iA);return t.length?t[0](e):z.mac?e.metaKey:e.ctrlKey}function sV(n,e){let t=n.state.facet(rA);return t.length?t[0](e):z.mac?!e.altKey:!e.ctrlKey}function aV(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=Th(n.root);if(!i||i.rangeCount==0)return!0;let r=i.getRangeAt(0).getClientRects();for(let o=0;o<r.length;o++){let s=r[o];if(s.left<=e.clientX&&s.right>=e.clientX&&s.top<=e.clientY&&s.bottom>=e.clientY)return!0}return!1}function lV(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=it.get(t))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0}var wi=Object.create(null),_n=Object.create(null),EA=z.ie&&z.ie_version<15||z.ios&&z.webkit_version<604;function cV(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),SA(n,t.value)},50)}function ty(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function SA(n,e){e=ty(n.state,Eb,e);let{state:t}=n,i,r=1,o=t.toText(e),s=o.lines==t.selection.ranges.length;if(ob!=null&&t.selection.ranges.every(l=>l.empty)&&ob==o.toString()){let l=-1;i=t.changeByRange(c=>{let u=t.doc.lineAt(c.from);if(u.from==l)return{range:c};l=u.from;let f=t.toText((s?o.line(r++).text:e)+t.lineBreak);return{changes:{from:u.from,insert:f},range:$.cursor(c.from+f.length)}})}else s?i=t.changeByRange(l=>{let c=o.line(r++);return{changes:{from:l.from,to:l.to,insert:c.text},range:$.cursor(l.from+c.length)}}):i=t.replaceSelection(o);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}_n.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};_n.wheel=_n.mousewheel=n=>{n.inputState.lastWheelEvent=Date.now()};wi.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);_n.touchstart=(n,e)=>{let t=n.inputState,i=e.targetTouches[0];t.lastTouchTime=Date.now(),i&&(t.lastTouchX=i.clientX,t.lastTouchY=i.clientY),t.setSelectionOrigin("select.pointer")};_n.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};wi.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(oA))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=fV(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new rb(n,e,t,i)),i&&n.observer.ignore(()=>{KT(n.contentDOM);let o=n.root.activeElement;o&&!o.contains(n.contentDOM)&&o.blur()});let r=n.inputState.mouseSelection;if(r)return r.start(e),r.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function ET(n,e,t,i){if(i==1)return $.cursor(e,t);if(i==2)return Wq(n.state,e,t);{let r=n.docView.lineAt(e,t),o=n.state.doc.lineAt(r?r.posAtEnd:e),s=r?r.posAtStart:o.from,a=r?r.posAtEnd:o.to;return a<n.state.doc.length&&a==o.to&&a++,$.range(s,a)}}var uV=z.ie&&z.ie_version<=11,ST=null,OT=0,kT=0;function OA(n){if(!uV)return n.detail;let e=ST,t=kT;return ST=n,kT=Date.now(),OT=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(OT+1)%3:1}function fV(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),i=OA(e),r=n.state.selection;return{update(o){o.docChanged&&(t.pos=o.changes.mapPos(t.pos),r=r.map(o.changes))},get(o,s,a){let l=n.posAndSideAtCoords({x:o.clientX,y:o.clientY},!1),c,u=ET(n,l.pos,l.assoc,i);if(t.pos!=l.pos&&!s){let f=ET(n,t.pos,t.assoc,i),h=Math.min(f.from,u.from),d=Math.max(f.to,u.to);u=h<u.from?$.range(h,d,u.assoc):$.range(d,h,u.assoc)}return s?r.replaceRange(r.main.extend(u.from,u.to,u.assoc)):a&&i==1&&r.ranges.length>1&&(c=hV(r,l.pos))?c:a?r.addRange(u):$.create([u])}}}function hV(n,e){for(let t=0;t<n.ranges.length;t++){let{from:i,to:r}=n.ranges[t];if(i<=e&&r>=e)return $.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}wi.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let r=n.docView.tile.nearest(e.target);if(r&&r.isWidget()){let o=r.posAtStart,s=o+r.length;(o>=t.to||s<=t.from)&&(t=$.range(o,s))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",ty(n.state,Sb,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};wi.dragend=n=>(n.inputState.draggedContent=null,!1);function RT(n,e,t,i){if(t=ty(n.state,Eb,t),!t)return;let r=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=n.inputState,s=i&&o&&sV(n,e)?{from:o.from,to:o.to}:null,a={from:r,insert:t},l=n.state.changes(s?[s,a]:a);n.focus(),n.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:s?"move.drop":"input.drop"}),n.inputState.draggedContent=null}wi.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),r=0,o=()=>{++r==t.length&&RT(n,e,i.filter(s=>s!=null).join(n.state.lineBreak),!1)};for(let s=0;s<t.length;s++){let a=new FileReader;a.onerror=o,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(i[s]=a.result),o()},a.readAsText(t[s])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return RT(n,e,i,!0),!0}return!1};wi.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=EA?null:e.clipboardData;return t?(SA(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(cV(n),!1)};function dV(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function pV(n){let e=[],t=[],i=!1;for(let r of n.selection.ranges)r.empty||(e.push(n.sliceDoc(
227 `,this;e--}else if(r instanceof An){let l=r.text[s+(t<0?-1:0)];if(this.offsets[i]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l. global() method in FR.Lr.constructor.ln.constructor.Ke
[all...]