p3x-redis-ui-material
Version:
💿 P3X Redis UI triple frontend — Angular + React/MUI + Vue/Vuetify with 54 languages, 7 themes, Socket.IO, desktop notifications, and full feature parity
3 lines • 200 kB
JavaScript
import{A as ks,B as ni,C as ge,a as z,c as ht,d as ii,f as xs,g as bt,i as si,k as v,l as C,m as fe,n as de,p as vs,s as $,t as Ss,u as Cs,v as Tt,w as ue,x as pe,z as B}from"./chunk-62NZHGBY.js";import{a as ei}from"./chunk-O7S4L63H.js";var Ms=typeof Symbol>"u"?"__\u037C":Symbol.for("\u037C"),ri=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),As=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},et=class{constructor(t,e){this.rules=[];let{finish:i}=e||{};function n(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,a,h){let c=[],f=/^@(\w+)\b/.exec(o[0]),d=f&&f[1]=="keyframes";if(f&&l==null)return a.push(o[0]+";");for(let p in l){let u=l[p];if(/&/.test(p))r(p.split(/,\s*/).map(g=>o.map(m=>g.replace(/&/,m))).reduce((g,m)=>g.concat(m)),u,a);else if(u&&typeof u=="object"){if(!f)throw new RangeError("The value of a property ("+p+") should be a primitive value.");r(n(p),u,c,d)}else u!=null&&c.push(p.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+u+";")}(c.length||d)&&a.push((i&&!f&&!h?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in t)r(n(o),t[o],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let t=As[Ms]||1;return As[Ms]=t+1,"\u037C"+t.toString(36)}static mount(t,e,i){let n=t[ri],r=i&&i.nonce;n?r&&n.setNonce(r):n=new oi(t,r),n.mount(Array.isArray(e)?e:[e],t)}},Ts=new Map,oi=class{constructor(t,e){let i=t.ownerDocument||t,n=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&n.CSSStyleSheet){let r=Ts.get(i);if(r)return t[ri]=r;this.sheet=new n.CSSStyleSheet,Ts.set(i,this)}else this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);this.modules=[],t[ri]=this}mount(t,e){let i=this.sheet,n=0,r=0;for(let o=0;o<t.length;o++){let l=t[o],a=this.modules.indexOf(l);if(a<r&&a>-1&&(this.modules.splice(a,1),r--,a=-1),a==-1){if(this.modules.splice(r++,0,l),i)for(let h=0;h<l.rules.length;h++)i.insertRule(l.rules[h],n++)}else{for(;r<a;)n+=this.modules[r++].rules.length;n+=l.rules.length,r++}}if(i)e.adoptedStyleSheets.indexOf(this.sheet)<0&&(e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets]);else{let o="";for(let a=0;a<this.modules.length;a++)o+=this.modules[a].getRules()+`
`;this.styleTag.textContent=o;let l=e.head||e;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}};var it={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:"'"},Dt={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},xr=typeof navigator<"u"&&/Mac/.test(navigator.platform),vr=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(E=0;E<10;E++)it[48+E]=it[96+E]=String(E);var E;for(E=1;E<=24;E++)it[E+111]="F"+E;var E;for(E=65;E<=90;E++)it[E]=String.fromCharCode(E+32),Dt[E]=String.fromCharCode(E);var E;for(me in it)Dt.hasOwnProperty(me)||(Dt[me]=it[me]);var me;function Ds(s){var t=xr&&s.metaKey&&s.shiftKey&&!s.ctrlKey&&!s.altKey||vr&&s.shiftKey&&s.key&&s.key.length==1||s.key=="Unidentified",e=!t&&s.key||(s.shiftKey?Dt:it)[s.keyCode]||s.key||"Unidentified";return e=="Esc"&&(e="Escape"),e=="Del"&&(e="Delete"),e=="Left"&&(e="ArrowLeft"),e=="Up"&&(e="ArrowUp"),e=="Right"&&(e="ArrowRight"),e=="Down"&&(e="ArrowDown"),e}function ct(){var s=arguments[0];typeof s=="string"&&(s=document.createElement(s));var t=1,e=arguments[1];if(e&&typeof e=="object"&&e.nodeType==null&&!Array.isArray(e)){for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var n=e[i];typeof n=="string"?s.setAttribute(i,n):n!=null&&(s[i]=n)}t++}for(;t<arguments.length;t++)Os(s,arguments[t]);return s}function Os(s,t){if(typeof t=="string")s.appendChild(document.createTextNode(t));else if(t!=null)if(t.nodeType!=null)s.appendChild(t);else if(Array.isArray(t))for(var e=0;e<t.length;e++)Os(s,t[e]);else throw new RangeError("Unsupported child node: "+t)}var W=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},mi=typeof document<"u"?document:{documentElement:{style:{}}},bi=/Edge\/(\d+)/.exec(W.userAgent),bn=/MSIE \d/.test(W.userAgent),yi=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(W.userAgent),Qe=!!(bn||yi||bi),Ls=!Qe&&/gecko\/(\d+)/i.test(W.userAgent),li=!Qe&&/Chrome\/(\d+)/.exec(W.userAgent),Rs="webkitFontSmoothing"in mi.documentElement.style,wi=!Qe&&/Apple Computer/.test(W.vendor),Bs=wi&&(/Mobile\/\w+/.test(W.userAgent)||W.maxTouchPoints>2),y={mac:Bs||/Mac/.test(W.platform),windows:/Win/.test(W.platform),linux:/Linux|X11/.test(W.platform),ie:Qe,ie_version:bn?mi.documentMode||6:yi?+yi[1]:bi?+bi[1]:0,gecko:Ls,gecko_version:Ls?+(/Firefox\/(\d+)/.exec(W.userAgent)||[0,0])[1]:0,chrome:!!li,chrome_version:li?+li[1]:0,ios:Bs,android:/Android\b/.test(W.userAgent),webkit:Rs,webkit_version:Rs?+(/\bAppleWebKit\/(\d+)/.exec(W.userAgent)||[0,0])[1]:0,safari:wi,safari_version:wi?+(/\bVersion\/(\d+(\.\d+)?)/.exec(W.userAgent)||[0,0])[1]:0,tabSize:mi.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function cs(s,t){for(let e in s)e=="class"&&t.class?t.class+=" "+s.class:e=="style"&&t.style?t.style+=";"+s.style:t[e]=s[e];return t}var Be=Object.create(null);function fs(s,t,e){if(s==t)return!0;s||(s=Be),t||(t=Be);let i=Object.keys(s),n=Object.keys(t);if(i.length-(e&&i.indexOf(e)>-1?1:0)!=n.length-(e&&n.indexOf(e)>-1?1:0))return!1;for(let r of i)if(r!=e&&(n.indexOf(r)==-1||s[r]!==t[r]))return!1;return!0}function Sr(s,t){for(let e=s.attributes.length-1;e>=0;e--){let i=s.attributes[e].name;t[i]==null&&s.removeAttribute(i)}for(let e in t){let i=t[e];e=="style"?s.style.cssText=i:s.getAttribute(e)!=i&&s.setAttribute(e,i)}}function Es(s,t,e){let i=!1;if(t)for(let n in t)e&&n in e||(i=!0,n=="style"?s.style.cssText="":s.removeAttribute(n));if(e)for(let n in e)t&&t[n]==e[n]||(i=!0,n=="style"?s.style.cssText=e[n]:s.setAttribute(n,e[n]));return i}function Cr(s){let t=Object.create(null);for(let e=0;e<s.attributes.length;e++){let i=s.attributes[e];t[i.name]=i.value}return t}var rt=class{eq(t){return!1}updateDOM(t,e,i){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}},P=(function(s){return s[s.Text=0]="Text",s[s.WidgetBefore=1]="WidgetBefore",s[s.WidgetAfter=2]="WidgetAfter",s[s.WidgetRange=3]="WidgetRange",s})(P||(P={})),A=class extends pe{constructor(t,e,i,n){super(),this.startSide=t,this.endSide=e,this.widget=i,this.spec=n}get heightRelevant(){return!1}static mark(t){return new te(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),i=!!t.block;return e+=i&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new vt(t,e,e,i,t.widget||null,!1)}static replace(t){let e=!!t.block,i,n;if(t.isBlockGap)i=-5e8,n=4e8;else{let{start:r,end:o}=yn(t,e);i=(r?e?-3e8:-1:5e8)-1,n=(o?e?2e8:1:-6e8)+1}return new vt(t,i,n,e,t.widget||null,!0)}static line(t){return new ee(t)}static set(t,e=!1){return B.of(t,e)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};A.none=B.empty;var te=class s extends A{constructor(t){let{start:e,end:i}=yn(t);super(e?-1:5e8,i?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?cs(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||Be}eq(t){return this==t||t instanceof s&&this.tagName==t.tagName&&fs(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}};te.prototype.point=!1;var ee=class s extends A{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof s&&this.spec.class==t.spec.class&&fs(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}};ee.prototype.mapMode=bt.TrackBefore;ee.prototype.point=!0;var vt=class s extends A{constructor(t,e,i,n,r,o){super(e,i,r,t),this.block=n,this.isReplace=o,this.mapMode=n?e<=0?bt.TrackBefore:bt.TrackAfter:bt.TrackDel}get type(){return this.startSide!=this.endSide?P.WidgetRange:this.startSide<=0?P.WidgetBefore:P.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof s&&kr(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}};vt.prototype.point=!0;function yn(s,t=!1){let{inclusiveStart:e,inclusiveEnd:i}=s;return e==null&&(e=s.inclusive),i==null&&(i=s.inclusive),{start:e??t,end:i??t}}function kr(s,t){return s==t||!!(s&&t&&s.compare(t))}function Ht(s,t,e,i=0){let n=e.length-1;n>=0&&e[n]+i>=s?e[n]=Math.max(e[n],t):e.push(s,t)}var Ee=class s extends pe{constructor(t,e){super(),this.tagName=t,this.attributes=e}eq(t){return t==this||t instanceof s&&this.tagName==t.tagName&&fs(this.attributes,t.attributes)}static create(t){return new s(t.tagName,t.attributes||Be)}static set(t,e=!1){return B.of(t,e)}};Ee.prototype.startSide=Ee.prototype.endSide=-1;function ie(s){let t;return s.nodeType==11?t=s.getSelection?s:s.ownerDocument:t=s,t.getSelection()}function xi(s,t){return t?s==t||s.contains(t.nodeType!=1?t.parentNode:t):!1}function _t(s,t){if(!t.anchorNode)return!1;try{return xi(s,t.anchorNode)}catch(e){return!1}}function jt(s){return s.nodeType==3?ne(s,0,s.nodeValue.length).getClientRects():s.nodeType==1?s.getClientRects():[]}function Yt(s,t,e,i){return e?Hs(s,t,e,i,-1)||Hs(s,t,e,i,1):!1}function ut(s){for(var t=0;;t++)if(s=s.previousSibling,!s)return t}function He(s){return s.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(s.nodeName)}function Hs(s,t,e,i,n){for(;;){if(s==e&&t==i)return!0;if(t==(n<0?0:ot(s))){if(s.nodeName=="DIV")return!1;let r=s.parentNode;if(!r||r.nodeType!=1)return!1;t=ut(s)+(n<0?0:1),s=r}else if(s.nodeType==1){if(s=s.childNodes[t+(n<0?-1:0)],s.nodeType==1&&s.contentEditable=="false")return!1;t=n<0?ot(s):0}else return!1}}function ot(s){return s.nodeType==3?s.nodeValue.length:s.childNodes.length}function se(s,t){let e=t?s.left:s.right;return{left:e,right:e,top:s.top,bottom:s.bottom}}function Mr(s){let t=s.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:s.innerWidth,top:0,bottom:s.innerHeight}}function wn(s,t){let e=t.width/s.offsetWidth,i=t.height/s.offsetHeight;return(e>.995&&e<1.005||!isFinite(e)||Math.abs(t.width-s.offsetWidth)<1)&&(e=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.height-s.offsetHeight)<1)&&(i=1),{scaleX:e,scaleY:i}}function Ar(s,t,e,i,n,r,o,l){let a=s.ownerDocument,h=a.defaultView||window;for(let c=s,f=!1;c&&!f;)if(c.nodeType==1){let d,p=c==a.body,u=1,g=1;if(p)d=Mr(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let w=c.getBoundingClientRect();({scaleX:u,scaleY:g}=wn(c,w)),d={left:w.left,right:w.left+c.clientWidth*u,top:w.top,bottom:w.top+c.clientHeight*g}}let m=0,b=0;if(n=="nearest")t.top<d.top+o?(b=t.top-(d.top+o),e>0&&t.bottom>d.bottom+b&&(b=t.bottom-d.bottom+o)):t.bottom>d.bottom-o&&(b=t.bottom-d.bottom+o,e<0&&t.top-b<d.top&&(b=t.top-(d.top+o)));else{let w=t.bottom-t.top,S=d.bottom-d.top;b=(n=="center"&&w<=S?t.top+w/2-S/2:n=="start"||n=="center"&&e<0?t.top-o:t.bottom-S+o)-d.top}if(i=="nearest"?t.left<d.left+r?(m=t.left-(d.left+r),e>0&&t.right>d.right+m&&(m=t.right-d.right+r)):t.right>d.right-r&&(m=t.right-d.right+r,e<0&&t.left<d.left+m&&(m=t.left-(d.left+r))):m=(i=="center"?t.left+(t.right-t.left)/2-(d.right-d.left)/2:i=="start"==l?t.left-r:t.right-(d.right-d.left)+r)-d.left,m||b)if(p)h.scrollBy(m,b);else{let w=0,S=0;if(b){let M=c.scrollTop;c.scrollTop+=b/g,S=(c.scrollTop-M)*g}if(m){let M=c.scrollLeft;c.scrollLeft+=m/u,w=(c.scrollLeft-M)*u}t={left:t.left-w,top:t.top-S,right:t.right-w,bottom:t.bottom-S},w&&Math.abs(w-m)<1&&(i="nearest"),S&&Math.abs(S-b)<1&&(n="nearest")}if(p)break;(t.top<d.top||t.bottom>d.bottom||t.left<d.left||t.right>d.right)&&(t={left:Math.max(t.left,d.left),right:Math.min(t.right,d.right),top:Math.max(t.top,d.top),bottom:Math.min(t.bottom,d.bottom)}),c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function xn(s,t=!0){let e=s.ownerDocument,i=null,n=null;for(let r=s.parentNode;r&&!(r==e.body||(!t||i)&&n);)if(r.nodeType==1)!n&&r.scrollHeight>r.clientHeight&&(n=r),t&&!i&&r.scrollWidth>r.clientWidth&&(i=r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;return{x:i,y:n}}var vi=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:i}=t;this.set(e,Math.min(t.anchorOffset,e?ot(e):0),i,Math.min(t.focusOffset,i?ot(i):0))}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}},yt=null;y.safari&&y.safari_version>=26&&(yt=!1);function vn(s){if(s.setActive)return s.setActive();if(yt)return s.focus(yt);let t=[];for(let e=s;e&&(t.push(e,e.scrollTop,e.scrollLeft),e!=e.ownerDocument);e=e.parentNode);if(s.focus(yt==null?{get preventScroll(){return yt={preventScroll:!0},!0}}:void 0),!yt){yt=!1;for(let e=0;e<t.length;){let i=t[e++],n=t[e++],r=t[e++];i.scrollTop!=n&&(i.scrollTop=n),i.scrollLeft!=r&&(i.scrollLeft=r)}}}var Ps;function ne(s,t,e=t){let i=Ps||(Ps=document.createRange());return i.setEnd(s,e),i.setStart(s,t),i}function Pt(s,t,e,i){let n={key:t,code:t,keyCode:e,which:e,cancelable:!0};i&&({altKey:n.altKey,ctrlKey:n.ctrlKey,shiftKey:n.shiftKey,metaKey:n.metaKey}=i);let r=new KeyboardEvent("keydown",n);r.synthetic=!0,s.dispatchEvent(r);let o=new KeyboardEvent("keyup",n);return o.synthetic=!0,s.dispatchEvent(o),r.defaultPrevented||o.defaultPrevented}function Tr(s){for(;s;){if(s&&(s.nodeType==9||s.nodeType==11&&s.host))return s;s=s.assignedSlot||s.parentNode}return null}function Dr(s,t){let e=t.focusNode,i=t.focusOffset;if(!e||t.anchorNode!=e||t.anchorOffset!=i)return!1;for(i=Math.min(i,ot(e));;)if(i){if(e.nodeType!=1)return!1;let n=e.childNodes[i-1];n.contentEditable=="false"?i--:(e=n,i=ot(e))}else{if(e==s)return!0;i=ut(e),e=e.parentNode}}function Sn(s){return s instanceof Window?s.pageYOffset>Math.max(0,s.document.documentElement.scrollHeight-s.innerHeight-4):s.scrollTop>Math.max(1,s.scrollHeight-s.clientHeight-4)}function Cn(s,t){for(let e=s,i=t;;){if(e.nodeType==3&&i>0)return{node:e,offset:i};if(e.nodeType==1&&i>0){if(e.contentEditable=="false")return null;e=e.childNodes[i-1],i=ot(e)}else if(e.parentNode&&!He(e))i=ut(e),e=e.parentNode;else return null}}function kn(s,t){for(let e=s,i=t;;){if(e.nodeType==3&&i<e.nodeValue.length)return{node:e,offset:i};if(e.nodeType==1&&i<e.childNodes.length){if(e.contentEditable=="false")return null;e=e.childNodes[i],i=0}else if(e.parentNode&&!He(e))i=ut(e)+1,e=e.parentNode;else return null}}var U=class s{constructor(t,e,i=!0){this.node=t,this.offset=e,this.precise=i}static before(t,e){return new s(t.parentNode,ut(t),e)}static after(t,e){return new s(t.parentNode,ut(t)+1,e)}},R=(function(s){return s[s.LTR=0]="LTR",s[s.RTL=1]="RTL",s})(R||(R={})),St=R.LTR,ds=R.RTL;function Mn(s){let t=[];for(let e=0;e<s.length;e++)t.push(1<<+s[e]);return t}var Or=Mn("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Lr=Mn("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Si=Object.create(null),G=[];for(let s of["()","[]","{}"]){let t=s.charCodeAt(0),e=s.charCodeAt(1);Si[t]=e,Si[e]=-t}function An(s){return s<=247?Or[s]:1424<=s&&s<=1524?2:1536<=s&&s<=1785?Lr[s-1536]:1774<=s&&s<=2220?4:8192<=s&&s<=8204?256:64336<=s&&s<=65023?4:1}var Rr=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,_=class{get dir(){return this.level%2?ds:St}constructor(t,e,i){this.from=t,this.to=e,this.level=i}side(t,e){return this.dir==e==t?this.to:this.from}forward(t,e){return t==(this.dir==e)}static find(t,e,i,n){let r=-1;for(let o=0;o<t.length;o++){let l=t[o];if(l.from<=e&&l.to>=e){if(l.level==i)return o;(r<0||(n!=0?n<0?l.from<e:l.to>e:t[r].level>l.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}};function Tn(s,t){if(s.length!=t.length)return!1;for(let e=0;e<s.length;e++){let i=s[e],n=t[e];if(i.from!=n.from||i.to!=n.to||i.direction!=n.direction||!Tn(i.inner,n.inner))return!1}return!0}var O=[];function Br(s,t,e,i,n){for(let r=0;r<=i.length;r++){let o=r?i[r-1].to:t,l=r<i.length?i[r].from:e,a=r?256:n;for(let h=o,c=a,f=a;h<l;h++){let d=An(s.charCodeAt(h));d==512?d=c:d==8&&f==4&&(d=16),O[h]=d==4?2:d,d&7&&(f=d),c=d}for(let h=o,c=a,f=a;h<l;h++){let d=O[h];if(d==128)h<l-1&&c==O[h+1]&&c&24?d=O[h]=c:O[h]=256;else if(d==64){let p=h+1;for(;p<l&&O[p]==64;)p++;let u=h&&c==8||p<e&&O[p]==8?f==1?1:8:256;for(let g=h;g<p;g++)O[g]=u;h=p-1}else d==8&&f==1&&(O[h]=1);c=d,d&7&&(f=d)}}}function Er(s,t,e,i,n){let r=n==1?2:1;for(let o=0,l=0,a=0;o<=i.length;o++){let h=o?i[o-1].to:t,c=o<i.length?i[o].from:e;for(let f=h,d,p,u;f<c;f++)if(p=Si[d=s.charCodeAt(f)])if(p<0){for(let g=l-3;g>=0;g-=3)if(G[g+1]==-p){let m=G[g+2],b=m&2?n:m&4?m&1?r:n:0;b&&(O[f]=O[G[g]]=b),l=g;break}}else{if(G.length==189)break;G[l++]=f,G[l++]=d,G[l++]=a}else if((u=O[f])==2||u==1){let g=u==n;a=g?0:1;for(let m=l-3;m>=0;m-=3){let b=G[m+2];if(b&2)break;if(g)G[m+2]|=2;else{if(b&4)break;G[m+2]|=4}}}}}function Hr(s,t,e,i){for(let n=0,r=i;n<=e.length;n++){let o=n?e[n-1].to:s,l=n<e.length?e[n].from:t;for(let a=o;a<l;){let h=O[a];if(h==256){let c=a+1;for(;;)if(c==l){if(n==e.length)break;c=e[n++].to,l=n<e.length?e[n].from:t}else if(O[c]==256)c++;else break;let f=r==1,d=(c<t?O[c]:i)==1,p=f==d?f?1:2:i;for(let u=c,g=n,m=g?e[g-1].to:s;u>a;)u==m&&(u=e[--g].from,m=g?e[g-1].to:s),O[--u]=p;a=c}else r=h,a++}}}function Ci(s,t,e,i,n,r,o){let l=i%2?2:1;if(i%2==n%2)for(let a=t,h=0;a<e;){let c=!0,f=!1;if(h==r.length||a<r[h].from){let g=O[a];g!=l&&(c=!1,f=g==16)}let d=!c&&l==1?[]:null,p=c?i:i+1,u=a;t:for(;;)if(h<r.length&&u==r[h].from){if(f)break t;let g=r[h];if(!c)for(let m=g.to,b=h+1;;){if(m==e)break t;if(b<r.length&&r[b].from==m)m=r[b++].to;else{if(O[m]==l)break t;break}}if(h++,d)d.push(g);else{g.from>a&&o.push(new _(a,g.from,p));let m=g.direction==St!=!(p%2);ki(s,m?i+1:i,n,g.inner,g.from,g.to,o),a=g.to}u=g.to}else{if(u==e||(c?O[u]!=l:O[u]==l))break;u++}d?Ci(s,a,u,i+1,n,d,o):a<u&&o.push(new _(a,u,p)),a=u}else for(let a=e,h=r.length;a>t;){let c=!0,f=!1;if(!h||a>r[h-1].to){let g=O[a-1];g!=l&&(c=!1,f=g==16)}let d=!c&&l==1?[]:null,p=c?i:i+1,u=a;t:for(;;)if(h&&u==r[h-1].to){if(f)break t;let g=r[--h];if(!c)for(let m=g.from,b=h;;){if(m==t)break t;if(b&&r[b-1].to==m)m=r[--b].from;else{if(O[m-1]==l)break t;break}}if(d)d.push(g);else{g.to<a&&o.push(new _(g.to,a,p));let m=g.direction==St!=!(p%2);ki(s,m?i+1:i,n,g.inner,g.from,g.to,o),a=g.from}u=g.from}else{if(u==t||(c?O[u-1]!=l:O[u-1]==l))break;u--}d?Ci(s,u,a,i+1,n,d,o):u<a&&o.push(new _(u,a,p)),a=u}}function ki(s,t,e,i,n,r,o){let l=t%2?2:1;Br(s,n,r,i,l),Er(s,n,r,i,l),Hr(n,r,i,l),Ci(s,n,r,t,e,i,o)}function Dn(s,t,e){if(!s)return[new _(0,0,t==ds?1:0)];if(t==St&&!e.length&&!Rr.test(s))return On(s.length);if(e.length)for(;s.length>O.length;)O[O.length]=256;let i=[],n=t==St?0:1;return ki(s,n,n,e,0,s.length,i),i}function On(s){return[new _(0,s,0)]}var Ln="";function Rn(s,t,e,i,n){var r;let o=i.head-s.from,l=_.find(t,o,(r=i.bidiLevel)!==null&&r!==void 0?r:-1,i.assoc),a=t[l],h=a.side(n,e);if(o==h){let d=l+=n?1:-1;if(d<0||d>=t.length)return null;a=t[l=d],o=a.side(!n,e),h=a.side(n,e)}let c=ht(s.text,o,a.forward(n,e));(c<a.from||c>a.to)&&(c=h),Ln=s.text.slice(Math.min(o,c),Math.max(o,c));let f=l==(n?t.length-1:0)?null:t[l+(n?1:-1)];return f&&c==h&&f.level+(n?0:1)<a.level?v.cursor(f.side(!n,e)+s.from,f.forward(n,e)?1:-1,f.level):v.cursor(c+s.from,a.forward(n,e)?-1:1,a.level)}function Pr(s,t,e){for(let i=t;i<e;i++){let n=An(s.charCodeAt(i));if(n==1)return St;if(n==2||n==4)return ds}return St}var Bn=C.define(),En=C.define(),Hn=C.define(),Pn=C.define(),ai=C.define(),Nn=C.define(),Wn=C.define(),us=C.define(),ps=C.define(),Ns=C.define({combine:s=>s.some(t=>t)}),Vn=C.define({combine:s=>s.some(t=>t)}),Fn=C.define(),Xt=class s{constructor(t,e,i,n,r,o=!1){this.range=t,this.y=e,this.x=i,this.yMargin=n,this.xMargin=r,this.isSnapshot=o}map(t){return t.empty?this:new s(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new s(v.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},be=$.define({map:(s,t)=>s.map(t)}),In=$.define();function Q(s,t,e){let i=s.facet(Pn);i.length?i[0](t):window.onerror&&window.onerror(String(t),e,void 0,void 0,t)||(e?console.error(e+":",t):console.error(t))}var st=C.define({combine:s=>s.length?s[0]:!0}),Nr=0,Lt=C.define({combine(s){return s.filter((t,e)=>{for(let i=0;i<e;i++)if(s[i].plugin==t.plugin)return!1;return!0})}}),N=class s{constructor(t,e,i,n,r){this.id=t,this.create=e,this.domEventHandlers=i,this.domEventObservers=n,this.baseExtensions=r(this),this.extension=this.baseExtensions.concat(Lt.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(Lt.of({plugin:this,arg:t}))}static define(t,e){let{eventHandlers:i,eventObservers:n,provide:r,decorations:o}=e||{};return new s(Nr++,t,i,n,l=>{let a=[];return o&&a.push(Je.of(h=>{let c=h.plugin(l);return c?o(c):A.none})),r&&a.push(r(l)),a})}static fromClass(t,e){return s.define((i,n)=>new t(i,n),e)}},$t=class{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(i){if(Q(e.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(n){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(e){Q(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(!((e=this.value)===null||e===void 0)&&e.destroy)try{this.value.destroy()}catch(i){Q(t.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}},Ws=C.define(),Pe=C.define(),Je=C.define(),zn=C.define(),gs=C.define(),le=C.define(),Kn=C.define();function Vs(s,t){let e=s.state.facet(Kn);if(!e.length)return e;let i=e.map(r=>r instanceof Function?r(s):r),n=[];return B.spans(i,t.from,t.to,{point(){},span(r,o,l,a){let h=r-t.from,c=o-t.from,f=n;for(let d=l.length-1;d>=0;d--,a--){let p=l[d].spec.bidiIsolate,u;if(p==null&&(p=Pr(t.text,h,c)),a>0&&f.length&&(u=f[f.length-1]).to==h&&u.direction==p)u.to=c,f=u.inner;else{let g={from:h,to:c,direction:p,inner:[]};f.push(g),f=g.inner}}}}),n}var qn=C.define();function ms(s){let t=0,e=0,i=0,n=0;for(let r of s.state.facet(qn)){let o=r(s);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(e=Math.max(e,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(n=Math.max(n,o.bottom)))}return{left:t,right:e,top:i,bottom:n}}var zt=C.define(),j=class s{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new s(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,i=this;for(;e>0;e--){let n=t[e-1];if(!(n.fromA>i.toA)){if(n.toA<i.fromA)break;i=i.join(n),t.splice(e-1,1)}}return t.splice(e,0,i),t}static extendWithRanges(t,e){if(e.length==0)return t;let i=[];for(let n=0,r=0,o=0;;){let l=n<t.length?t[n].fromB:1e9,a=r<e.length?e[r]:1e9,h=Math.min(l,a);if(h==1e9)break;let c=h+o,f=h,d=c;for(;;)if(r<e.length&&e[r]<=f){let p=e[r+1];r+=2,f=Math.max(f,p);for(let u=n;u<t.length&&t[u].fromB<=f;u++)o=t[u].toA-t[u].toB;d=Math.max(d,p+o)}else if(n<t.length&&t[n].fromB<=f){let p=t[n++];f=Math.max(f,p.toB),d=Math.max(d,p.toA),o=p.toA-p.toB}else break;i.push(new s(c,d,h,f))}return i}},Ne=class s{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=si.empty(this.startState.doc.length);for(let r of i)this.changes=this.changes.compose(r.changes);let n=[];this.changes.iterChangedRanges((r,o,l,a)=>n.push(new j(r,o,l,a))),this.changedRanges=n}static create(t,e,i){return new s(t,e,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(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},Wr=[],L=class{constructor(t,e,i=0){this.dom=t,this.length=e,this.flags=i,this.parent=null,t.cmTile=this}get breakAfter(){return this.flags&1}get children(){return Wr}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(t){if(this.flags|=2,this.flags&4){this.flags&=-5;let e=this.domAttrs;e&&Sr(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(t){this.dom=t,t.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t,e=this.posAtStart){let i=e;for(let n of this.children){if(n==t)return i;i+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}covers(t){return!0}coordsIn(t,e){return null}domPosFor(t,e){let i=ut(this.dom),n=this.length?t>0:e>0;return new U(this.parent.dom,i+(n?1:0),t==0||t==this.length)}markDirty(t){this.flags&=-3,t&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let t=this;t;t=t.parent)if(t instanceof Wt)return t;return null}static get(t){return t.cmTile}},Nt=class extends L{constructor(t){super(t,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(t){this.children.push(t),t.parent=this}sync(t){if(this.flags&2)return;super.sync(t);let e=this.dom,i=null,n,r=t?.node==e?t:null,o=0;for(let l of this.children){if(l.sync(t),o+=l.length+l.breakAfter,n=i?i.nextSibling:e.firstChild,r&&n!=l.dom&&(r.written=!0),l.dom.parentNode==e)for(;n&&n!=l.dom;)n=Fs(n);else e.insertBefore(l.dom,n);i=l.dom}for(n=i?i.nextSibling:e.firstChild,r&&n&&(r.written=!0);n;)n=Fs(n);this.length=o}};function Fs(s){let t=s.nextSibling;return s.parentNode.removeChild(s),t}var Wt=class extends Nt{constructor(t,e){super(e),this.view=t}owns(t){for(;t;t=t.parent)if(t==this)return!0;return!1}isBlock(){return!0}nearest(t){for(;;){if(!t)return null;let e=L.get(t);if(e&&this.owns(e))return e;t=t.parentNode}}blockTiles(t){for(let e=[],i=this,n=0,r=0;;)if(n==i.children.length){if(!e.length)return;i=i.parent,i.breakAfter&&r++,n=e.pop()}else{let o=i.children[n++];if(o instanceof nt)e.push(n),i=o,n=0;else{let l=r+o.length,a=t(o,r);if(a!==void 0)return a;r=l+o.breakAfter}}}resolveBlock(t,e){let i,n=-1,r,o=-1;if(this.blockTiles((l,a)=>{let h=a+l.length;if(t>=a&&t<=h){if(l.isWidget()&&e>=-1&&e<=1){if(l.flags&32)return!0;l.flags&16&&(i=void 0)}(a<t||t==h&&(e<-1?l.length:l.covers(1)))&&(!i||!l.isWidget()&&i.isWidget())&&(i=l,n=t-a),(h>t||t==a&&(e>1?l.length:l.covers(-1)))&&(!r||!l.isWidget()&&r.isWidget())&&(r=l,o=t-a)}}),!i&&!r)throw new Error("No tile at position "+t);return i&&e<0||!r?{tile:i,offset:n}:{tile:r,offset:o}}},nt=class s extends Nt{constructor(t,e){super(t),this.wrapper=e}isBlock(){return!0}covers(t){return this.children.length?t<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,e){let i=new s(e||document.createElement(t.tagName),t);return e||(i.flags|=4),i}},Vt=class s extends Nt{constructor(t,e){super(t),this.attrs=e}isLine(){return!0}static start(t,e,i){let n=new s(e||document.createElement("div"),t);return(!e||!i)&&(n.flags|=4),n}get domAttrs(){return this.attrs}resolveInline(t,e,i){let n=null,r=-1,o=null,l=-1;function a(c,f){for(let d=0,p=0;d<c.children.length&&p<=f;d++){let u=c.children[d],g=p+u.length;g>=f&&(u.isComposite()?a(u,f-p):(!o||o.isHidden&&(e>0||i&&Fr(o,u)))&&(g>f||u.flags&32)?(o=u,l=f-p):(p<f||u.flags&16&&!u.isHidden)&&(n=u,r=f-p)),p=g}}a(this,t);let h=(e<0?n:o)||n||o;return h?{tile:h,offset:h==n?r:l}:null}coordsIn(t,e){let i=this.resolveInline(t,e,!0);return i?i.tile.coordsIn(Math.max(0,i.offset),e):Vr(this)}domIn(t,e){let i=this.resolveInline(t,e);if(i){let{tile:n,offset:r}=i;if(this.dom.contains(n.dom))return n.isText()?new U(n.dom,Math.min(n.dom.nodeValue.length,r)):n.domPosFor(r,n.flags&16?1:n.flags&32?-1:e);let o=i.tile.parent,l=!1;for(let a of o.children){if(l)return new U(a.dom,0);a==i.tile&&(l=!0)}}return new U(this.dom,0)}};function Vr(s){let t=s.dom.lastChild;if(!t)return s.dom.getBoundingClientRect();let e=jt(t);return e[e.length-1]||null}function Fr(s,t){let e=s.coordsIn(0,1),i=t.coordsIn(0,1);return e&&i&&i.top<e.bottom}var V=class s extends Nt{constructor(t,e){super(t),this.mark=e}get domAttrs(){return this.mark.attrs}static of(t,e){let i=new s(e||document.createElement(t.tagName),t);return e||(i.flags|=4),i}},wt=class s extends L{constructor(t,e){super(t,e.length),this.text=e}sync(t){this.flags&2||(super.sync(t),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(t,e){let i=this.dom.nodeValue.length;t>i&&(t=i);let n=t,r=t,o=0;t==0&&e<0||t==i&&e>=0?y.chrome||y.gecko||(t?(n--,o=1):r<i&&(r++,o=-1)):e<0?n--:r<i&&r++;let l=ne(this.dom,n,r).getClientRects();if(!l.length)return null;let a=l[(o?o<0:e>=0)?0:l.length-1];return y.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?se(a,o<0):a||null}static of(t,e){let i=new s(e||document.createTextNode(t),t);return e||(i.flags|=2),i}},Ct=class s extends L{constructor(t,e,i,n){super(t,e,n),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(t){return this.flags&48?!1:(this.flags&(t<0?64:128))>0}coordsIn(t,e){return this.coordsInWidget(t,e,!1)}coordsInWidget(t,e,i){let n=this.widget.coordsAt(this.dom,t,e);if(n)return n;if(i)return se(this.dom.getBoundingClientRect(),this.length?t==0:e<=0);{let r=this.dom.getClientRects(),o=null;if(!r.length)return null;let l=this.flags&16?!0:this.flags&32?!1:t>0;for(let a=l?r.length-1:0;o=r[a],!(t>0?a==0:a==r.length-1||o.top<o.bottom);a+=l?-1:1);return se(o,!l)}}get overrideDOMText(){if(!this.length)return z.empty;let{root:t}=this;if(!t)return z.empty;let e=this.posAtStart;return t.view.state.doc.slice(e,e+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,e,i,n,r){return r||(r=t.toDOM(e),t.editable||(r.contentEditable="false")),new s(r,i,t,n)}},Ft=class extends L{constructor(t){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),super(e,0,t)}get isHidden(){return!0}get overrideDOMText(){return z.empty}coordsIn(t){return this.dom.getBoundingClientRect()}},Mi=class{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,e,i){let{tile:n,index:r,beforeBreak:o,parents:l}=this;for(;t||e>0;)if(n.isComposite())if(o){if(!t)break;i&&i.break(),t--,o=!1}else if(r==n.children.length){if(!t&&!l.length)break;i&&i.leave(n),o=!!n.breakAfter,{tile:n,index:r}=l.pop(),r++}else{let a=n.children[r],h=a.breakAfter;(e>0?a.length<=t:a.length<t)&&(!i||i.skip(a,0,a.length)!==!1||!a.isComposite)?(o=!!h,r++,t-=a.length):(l.push({tile:n,index:r}),n=a,r=0,i&&a.isComposite()&&i.enter(a))}else if(r==n.length)o=!!n.breakAfter,{tile:n,index:r}=l.pop(),r++;else if(t){let a=Math.min(t,n.length-r);i&&i.skip(n,r,r+a),t-=a,r+=a}else break;return this.tile=n,this.index=r,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}},Ai=class{constructor(t,e,i,n){this.from=t,this.to=e,this.wrapper=i,this.rank=n}},Ti=class{constructor(t,e,i){this.cache=t,this.root=e,this.blockWrappers=i,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(t,e,i,n){var r;this.flushBuffer();let o=this.ensureMarks(e,i),l=o.lastChild;if(l&&l.isText()&&!(l.flags&8)&&l.length+t.length<512){this.cache.reused.set(l,2);let a=o.children[o.children.length-1]=new wt(l.dom,l.text+t);a.parent=o}else o.append(n||wt.of(t,(r=this.cache.find(wt))===null||r===void 0?void 0:r.dom));this.pos+=t.length,this.afterWidget=null}addComposition(t,e){let i=this.curLine;i.dom!=e.line.dom&&(i.setDOM(this.cache.reused.has(e.line)?hi(e.line.dom):e.line.dom),this.cache.reused.set(e.line,2));let n=i;for(let l=e.marks.length-1;l>=0;l--){let a=e.marks[l],h=n.lastChild;if(h instanceof V&&h.mark.eq(a.mark))h.dom!=a.dom&&h.setDOM(hi(a.dom)),n=h;else{if(this.cache.reused.get(a)){let f=L.get(a.dom);f&&f.setDOM(hi(a.dom))}let c=V.of(a.mark,a.dom);n.append(c),n=c}this.cache.reused.set(a,2)}let r=L.get(t.text);r&&this.cache.reused.set(r,2);let o=new wt(t.text,t.text.nodeValue);o.flags|=8,this.pos=t.range.toB,n.append(o)}addInlineWidget(t,e,i){let n=this.afterWidget&&t.flags&48&&(this.afterWidget.flags&48)==(t.flags&48);n||this.flushBuffer();let r=this.ensureMarks(e,i);!n&&!(t.flags&16)&&r.append(this.getBuffer(1)),r.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,e,i){this.flushBuffer(),this.ensureMarks(e,i).append(t),this.pos+=t.length,this.afterWidget=null}addBlockWidget(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}continueWidget(t){let e=this.afterWidget||this.lastBlock;e.length+=t,this.pos+=t}addLineStart(t,e){var i;t||(t=_n);let n=Vt.start(t,e||((i=this.cache.find(Vt))===null||i===void 0?void 0:i.dom),!!e);this.getBlockPos().append(this.lastBlock=this.curLine=n)}addLine(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(t){this.blockPosCovered()||this.addLineStart(t)}ensureLine(t){this.curLine||this.addLineStart(t)}ensureMarks(t,e){var i;let n=this.curLine;for(let r=t.length-1;r>=0;r--){let o=t[r],l;if(e>0&&(l=n.lastChild)&&l instanceof V&&l.mark.eq(o))n=l,e--;else{let a=V.of(o,(i=this.cache.find(V,h=>h.mark.eq(o)))===null||i===void 0?void 0:i.dom);n.append(a),n=a,e=0}}return n}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!Is(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(y.ios&&Is(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(ci,0,32)||new Ct(ci.toDOM(),0,ci,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let t=this.wrappers.length-1;t>=0;t--)this.wrappers[t].to<this.pos&&this.wrappers.splice(t,1);for(let t=this.blockWrappers;t.value&&t.from<=this.pos;t.next())if(t.to>=this.pos){let e=new Ai(t.from,t.to,t.value,t.rank),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-e.rank||this.wrappers[i-1].to-e.to)<0;)i--;this.wrappers.splice(i,0,e)}this.wrapperPos=this.pos}getBlockPos(){var t;this.updateBlockWrappers();let e=this.root;for(let i of this.wrappers){let n=e.lastChild;if(i.from<this.pos&&n instanceof nt&&n.wrapper.eq(i.wrapper))e=n;else{let r=nt.of(i.wrapper,(t=this.cache.find(nt,o=>o.wrapper.eq(i.wrapper)))===null||t===void 0?void 0:t.dom);e.append(r),e=r}}return e}blockPosCovered(){let t=this.lastBlock;return t!=null&&!t.breakAfter&&(!t.isWidget()||(t.flags&160)>0)}getBuffer(t){let e=2|(t<0?16:32),i=this.cache.find(Ft,void 0,1);return i&&(i.flags=e),i||new Ft(e)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},Di=class{constructor(t){this.skipCount=0,this.text="",this.textOff=0,this.cursor=t.iter()}skip(t){this.textOff+t<=this.text.length?this.textOff+=t:(this.skipCount+=t-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(t){if(this.textOff==this.text.length){let{value:n,lineBreak:r,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=n;let l=this.textOff=Math.min(t,n.length);return r?null:n.slice(0,l)}let e=Math.min(this.text.length,this.textOff+t),i=this.text.slice(this.textOff,e);return this.textOff=e,i}},We=[Ct,Vt,wt,V,Ft,nt,Wt];for(let s=0;s<We.length;s++)We[s].bucket=s;var Oi=class{constructor(t){this.view=t,this.buckets=We.map(()=>[]),this.index=We.map(()=>0),this.reused=new Map}add(t){let e=t.constructor.bucket,i=this.buckets[e];i.length<6?i.push(t):i[this.index[e]=(this.index[e]+1)%6]=t}find(t,e,i=2){let n=t.bucket,r=this.buckets[n],o=this.index[n];for(let l=r.length-1;l>=0;l--){let a=(l+o)%r.length,h=r[a];if((!e||e(h))&&!this.reused.has(h))return r.splice(a,1),a<o&&this.index[n]--,this.reused.set(h,i),h}return null}findWidget(t,e,i){let n=this.buckets[0];if(n.length)for(let r=0,o=0;;r++){if(r==n.length){if(o)return null;o=1,r=0}let l=n[r];if(!this.reused.has(l)&&(o==0?l.widget.compare(t):l.widget.constructor==t.constructor&&t.updateDOM(l.dom,this.view,l.widget)))return n.splice(r,1),r<this.index[0]&&this.index[0]--,l.widget==t&&l.length==e&&(l.flags&497)==i?(this.reused.set(l,1),l):(this.reused.set(l,2),new Ct(l.dom,e,t,l.flags&-498|i))}}reuse(t){return this.reused.set(t,1),t}maybeReuse(t,e=2){if(!this.reused.has(t))return this.reused.set(t,e),t.dom}clear(){for(let t=0;t<this.buckets.length;t++)this.buckets[t].length=this.index[t]=0}},Li=class{constructor(t,e,i,n,r){this.view=t,this.decorations=n,this.disallowBlockEffectsFor=r,this.openWidget=!1,this.openMarks=0,this.cache=new Oi(t),this.text=new Di(t.state.doc),this.builder=new Ti(this.cache,new Wt(t,t.contentDOM),B.iter(i)),this.cache.reused.set(e,2),this.old=new Mi(e),this.reuseWalker={skip:(o,l,a)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(t,e){let i=e&&this.getCompositionContext(e.text);for(let n=0,r=0,o=0;;){let l=o<t.length?t[o++]:null,a=l?l.fromA:this.old.root.length;if(a>n){let h=a-n;this.preserve(h,!o,!l),n=a,r+=h}if(!l)break;e&&l.fromA<=e.range.fromA&&l.toA>=e.range.toA?(this.forward(l.fromA,e.range.fromA,e.range.fromA<e.range.toA?1:-1),this.emit(r,e.range.fromB),this.cache.clear(),this.builder.addComposition(e,i),this.text.skip(e.range.toB-e.range.fromB),this.forward(e.range.fromA,l.toA),this.emit(e.range.toB,l.toB)):(this.forward(l.fromA,l.toA),this.emit(r,l.toB)),r=l.toB,n=l.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(t,e,i){let n=Kr(this.old),r=this.openMarks;this.old.advance(t,i?1:-1,{skip:(o,l,a)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(a-l);else{let h=a>0||l<o.length?Ct.of(o.widget,this.view,a-l,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);h.flags&256?(h.flags&=-2,this.builder.addBlockWidget(h)):(this.builder.ensureLine(null),this.builder.addInlineWidget(h,n,r),r=n.length)}else if(o.isText())this.builder.ensureLine(null),!l&&a==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,n,r,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(l,a),n,r)),r=n.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof Ft)this.cache.add(o);else if(o instanceof V)this.builder.ensureLine(null),this.builder.addMark(o,n,r),this.cache.reused.set(o,1),r=n.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 V&&n.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?n.length&&(n.length=r=0):o instanceof V&&(n.shift(),r=Math.min(r,n.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,e){let i=null,n=this.builder,r=0,o=B.spans(this.decorations,t,e,{point:(l,a,h,c,f,d)=>{if(h instanceof vt){if(this.disallowBlockEffectsFor[d]){if(h.block)throw new RangeError("Block decorations may not be specified via plugins");if(a>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(r=c.length,f>c.length)n.continueWidget(a-l);else{let p=h.widget||(h.block?zs.block:zs.inline),u=Ir(h),g=this.cache.findWidget(p,a-l,u)||Ct.of(p,this.view,a-l,u);h.block?(h.startSide>0&&n.addLineStartIfNotCovered(i),n.addBlockWidget(g)):(n.ensureLine(i),n.addInlineWidget(g,c,f))}i=null}else i=zr(i,h);a>l&&this.text.skip(a-l)},span:(l,a,h,c)=>{for(let f=l;f<a;){let d=this.text.next(Math.min(512,a-f));d==null?(n.addLineStartIfNotCovered(i),n.addBreak(),f++):(n.ensureLine(i),n.addText(d,h,f==l?c:h.length),f+=d.length),i=null}}});n.addLineStartIfNotCovered(i),this.openWidget=o>r,this.openMarks=o}forward(t,e,i=1){e-t<=10?this.old.advance(e-t,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(e-t-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(t){let e=[],i=null;for(let n=t.parentNode;;n=n.parentNode){let r=L.get(n);if(n==this.view.contentDOM)break;r instanceof V?e.push(r):r?.isLine()?i=r:r instanceof nt||(n.nodeName=="DIV"&&!i&&n!=this.view.contentDOM?i=new Vt(n,_n):i||e.push(V.of(new te({tagName:n.nodeName.toLowerCase(),attributes:Cr(n)}),n)))}return{line:i,marks:e}}};function Is(s,t){let e=i=>{for(let n of i.children)if((t?n.isText():n.length)||e(n))return!0;return!1};return e(s)}function Ir(s){let t=s.isReplace?(s.startSide<0?64:0)|(s.endSide>0?128:0):s.startSide>0?32:16;return s.block&&(t|=256),t}var _n={class:"cm-line"};function zr(s,t){let e=t.spec.attributes,i=t.spec.class;return!e&&!i||(s||(s={class:"cm-line"}),e&&cs(e,s),i&&(s.class+=" "+i)),s}function Kr(s){let t=[];for(let e=s.parents.length;e>1;e--){let i=e==s.parents.length?s.tile:s.parents[e].tile;i instanceof V&&t.push(i.mark)}return t}function hi(s){let t=L.get(s);return t&&t.setDOM(s.cloneNode()),s}var zs=(()=>{class s extends rt{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}}return s.inline=new s("span"),s.block=new s("div"),s})(),ci=new class extends rt{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}},Ve=class{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=A.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 Wt(t,t.contentDOM),this.updateInner([new j(0,0,0,t.state.doc.length)],null)}update(t){var e;let i=t.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:c,toA:f})=>f<this.minWidthFrom||c>this.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((e=this.domChanged)===null||e===void 0)&&e.newSel?n=this.domChanged.newSel.head:!Ur(t.changes,this.hasComposition)&&!t.selectionSet&&(n=t.state.selection.main.head));let r=n>-1?_r(this.view,t.changes,n):null;if(this.domChanged=null,this.hasComposition){let{from:c,to:f}=this.hasComposition;i=new j(c,f,t.changes.mapPos(c,-1),t.changes.mapPos(f,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(y.ie||y.chrome)&&!r&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let a=Xr(o,this.decorations,t.changes);a.length&&(i=j.extendWithRanges(i,a));let h=$r(l,this.blockWrappers,t.changes);return h.length&&(i=j.extendWithRanges(i,h)),r&&!i.some(c=>c.fromA<=r.range.fromA&&c.toA>=r.range.toA)&&(i=r.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,r),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(e||t.length){let o=this.tile,l=new Li(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);e&&L.get(e.text)&&l.cache.reused.set(L.get(e.text),2),this.tile=l.run(t,e),Ri(o,l.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 r=y.chrome||y.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),r&&(r.written||i.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let n=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let r of this.tile.children)r.isWidget()&&r.widget instanceof Gt&&n.push(r.dom);i.updateGaps(n)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let e of t.transactions)for(let i of e.effects)i.is(In)&&(this.editContextFormatting=i.value)}updateSelection(t=!1,e=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:i}=this.tile,n=this.view.root.activeElement,r=n==i,o=!r&&!(this.view.state.facet(st)||i.tabIndex>-1)&&_t(i,this.view.observer.selectionRange)&&!(n&&i.contains(n));if(!(r||e||o))return;let l=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,h,c;if(a.empty?c=h=this.inlineDOMNearPos(a.anchor,a.assoc||1):(c=this.inlineDOMNearPos(a.head,a.head==a.from?1:-1),h=this.inlineDOMNearPos(a.anchor,a.anchor==a.from?1:-1)),y.gecko&&a.empty&&!this.hasComposition&&qr(h)){let d=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(d,h.node.childNodes[h.offset]||null)),h=c=new U(d,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!Yt(h.node,h.offset,f.anchorNode,f.anchorOffset)||!Yt(c.node,c.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,a))&&(this.view.observer.ignore(()=>{y.android&&y.chrome&&i.contains(f.focusNode)&&Gr(f.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let d=ie(this.view.root);if(d)if(a.empty){if(y.gecko){let p=jr(h.node,h.offset);if(p&&p!=3){let u=(p==1?Cn:kn)(h.node,h.offset);u&&(h=new U(u.node,u.offset))}}d.collapse(h.node,h.offset),a.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=a.bidiLevel)}else if(d.extend){d.collapse(h.node,h.offset);try{d.extend(c.node,c.offset)}catch(p){}}else{let p=document.createRange();a.anchor>a.head&&([h,c]=[c,h]),p.setEnd(c.node,c.offset),p.setStart(h.node,h.offset),d.removeAllRanges(),d.addRange(p)}o&&this.view.root.activeElement==i&&(i.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(h,c)),this.impreciseAnchor=h.precise?null:new U(f.anchorNode,f.anchorOffset),this.impreciseHead=c.precise?null:new U(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&Yt(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,i=ie(t.root),{anchorNode:n,anchorOffset:r}=t.observer.selectionRange;if(!i||!e.empty||!e.assoc||!i.modify)return;let o=this.lineAt(e.head,e.assoc);if(!o)return;let l=o.posAtStart;if(e.head==l||e.head==l+o.length)return;let a=this.coordsAt(e.head,-1),h=this.coordsAt(e.head,1);if(!a||!h||a.bottom>h.top)return;let c=this.domAtPos(e.head+e.assoc,e.assoc);i.collapse(c.node,c.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let f=t.observer.selectionRange;t.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=e.from&&i.collapse(n,r)}posFromDOM(t,e){let i=this.tile.nearest(t);if(!i)return this.tile.dom.compareDocumentPosition(t)&2?0:this.view.state.doc.length;let n=i.posAtStart;if(i.isComposite()){let r;if(t==i.dom)r=i.dom.childNodes[e];else{let o=ot(t)==0?0:e==0?-1:1;for(;;){let l=t.parentNode;if(l==i.dom)break;o==0&&l.firstChild!=l.lastChild&&(t==l.firstChild?o=-1:o=1),t=l}o<0?r=t:r=t.nextSibling}if(r==i.dom.firstChild)return n;for(;r&&!L.get(r);)r=r.nextSibling;if(!r)return n+i.length;for(let o=0,l=n;;o++){let a=i.children[o];if(a.dom==r)return l;l+=a.length+a.breakAfter}}else return i.isText()?t==i.dom?n+e:n+(e?i.length:0):n}domAtPos(t,e){let{ti