vue-codemirror6 0.0.2 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,28 @@
1
- (function(wt,It){typeof exports=="object"&&typeof module<"u"?module.exports=It(require("vue")):typeof define=="function"&&define.amd?define(["vue"],It):(wt=typeof globalThis<"u"?globalThis:wt||self,wt.VueCodeMirror6=It(wt.Vue))})(this,function(wt){"use strict";function It(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var Be=It(wt);/**
2
- * vue-class-component v7.2.6
3
- * (c) 2015-present Evan You
4
- * @license MIT
5
- */function te(n){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?te=function(t){return typeof t}:te=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},te(n)}function Cr(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function Mr(n){return Tr(n)||Dr(n)||Pr()}function Tr(n){if(Array.isArray(n)){for(var t=0,e=new Array(n.length);t<n.length;t++)e[t]=n[t];return e}}function Dr(n){if(Symbol.iterator in Object(n)||Object.prototype.toString.call(n)==="[object Arguments]")return Array.from(n)}function Pr(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function Rr(){return typeof Reflect<"u"&&Reflect.defineMetadata&&Reflect.getOwnMetadataKeys}function Br(n,t){Ee(n,t),Object.getOwnPropertyNames(t.prototype).forEach(function(e){Ee(n.prototype,t.prototype,e)}),Object.getOwnPropertyNames(t).forEach(function(e){Ee(n,t,e)})}function Ee(n,t,e){var i=e?Reflect.getOwnMetadataKeys(t,e):Reflect.getOwnMetadataKeys(t);i.forEach(function(s){var r=e?Reflect.getOwnMetadata(s,t,e):Reflect.getOwnMetadata(s,t);e?Reflect.defineMetadata(s,r,n,e):Reflect.defineMetadata(s,r,n)})}var Er={__proto__:[]},_r=Er instanceof Array;function Ni(n){return function(t,e,i){var s=typeof t=="function"?t:t.constructor;s.__decorators__||(s.__decorators__=[]),typeof i!="number"&&(i=void 0),s.__decorators__.push(function(r){return n(r,e,i)})}}function Lr(n){var t=te(n);return n==null||t!=="object"&&t!=="function"}function Ir(n,t){var e=t.prototype._init;t.prototype._init=function(){var r=this,o=Object.getOwnPropertyNames(n);if(n.$options.props)for(var l in n.$options.props)n.hasOwnProperty(l)||o.push(l);o.forEach(function(a){Object.defineProperty(r,a,{get:function(){return n[a]},set:function(f){n[a]=f},configurable:!0})})};var i=new t;t.prototype._init=e;var s={};return Object.keys(i).forEach(function(r){i[r]!==void 0&&(s[r]=i[r])}),s}var _e=["data","beforeCreate","created","beforeMount","mounted","beforeDestroy","destroyed","beforeUpdate","updated","activated","deactivated","render","errorCaptured","serverPrefetch"];function Fi(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};t.name=t.name||n._componentTag||n.name;var e=n.prototype;Object.getOwnPropertyNames(e).forEach(function(l){if(l!=="constructor"){if(_e.indexOf(l)>-1){t[l]=e[l];return}var a=Object.getOwnPropertyDescriptor(e,l);a.value!==void 0?typeof a.value=="function"?(t.methods||(t.methods={}))[l]=a.value:(t.mixins||(t.mixins=[])).push({data:function(){return Cr({},l,a.value)}}):(a.get||a.set)&&((t.computed||(t.computed={}))[l]={get:a.get,set:a.set})}}),(t.mixins||(t.mixins=[])).push({data:function(){return Ir(this,n)}});var i=n.__decorators__;i&&(i.forEach(function(l){return l(t)}),delete n.__decorators__);var s=Object.getPrototypeOf(n.prototype),r=s instanceof Be.default?s.constructor:Be.default,o=r.extend(t);return Vr(o,n,r),Rr()&&Br(o,n),o}var $r={prototype:!0,arguments:!0,callee:!0,caller:!0};function Vr(n,t,e){Object.getOwnPropertyNames(t).forEach(function(i){if(!$r[i]){var s=Object.getOwnPropertyDescriptor(n,i);if(!(s&&!s.configurable)){var r=Object.getOwnPropertyDescriptor(t,i);if(!_r){if(i==="cid")return;var o=Object.getOwnPropertyDescriptor(e,i);if(!Lr(r.value)&&o&&o.value===r.value)return}Object.defineProperty(n,i,r)}}})}function Hi(n){return typeof n=="function"?Fi(n):function(t){return Fi(t,n)}}Hi.registerHooks=function(t){_e.push.apply(_e,Mr(t))},globalThis&&globalThis.__spreadArrays;var Nr=typeof Reflect<"u"&&typeof Reflect.getMetadata<"u";function Fr(n,t,e){if(Nr&&!Array.isArray(n)&&typeof n!="function"&&!n.hasOwnProperty("type")&&typeof n.type>"u"){var i=Reflect.getMetadata("design:type",t,e);i!==Object&&(n.type=i)}}function ft(n){return n===void 0&&(n={}),function(t,e){Fr(n,t,e),Ni(function(i,s){(i.props||(i.props={}))[s]=n})(t,e)}}function ji(n,t){t===void 0&&(t={});var e=t.deep,i=e===void 0?!1:e,s=t.immediate,r=s===void 0?!1:s;return Ni(function(o,l){typeof o.watch!="object"&&(o.watch=Object.create(null));var a=o.watch;typeof a[n]=="object"&&!Array.isArray(a[n])?a[n]=[a[n]]:typeof a[n]>"u"&&(a[n]=[]),a[n].push({handler:l,deep:i,immediate:r})})}let St="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(n=>n?parseInt(n,36):1);for(let n=1;n<St.length;n++)St[n]+=St[n-1];function Hr(n){for(let t=1;t<St.length;t+=2)if(St[t]>n)return St[t-1]<=n;return!1}function Wi(n){return n>=127462&&n<=127487}const zi=8205;function st(n,t,e=!0,i=!0){return(e?qi:jr)(n,t,i)}function qi(n,t,e){if(t==n.length)return t;t&&Gi(n.charCodeAt(t))&&Ki(n.charCodeAt(t-1))&&t--;let i=Le(n,t);for(t+=Ui(i);t<n.length;){let s=Le(n,t);if(i==zi||s==zi||e&&Hr(s))t+=Ui(s),i=s;else if(Wi(s)){let r=0,o=t-2;for(;o>=0&&Wi(Le(n,o));)r++,o-=2;if(r%2==0)break;t+=2}else break}return t}function jr(n,t,e){for(;t>0;){let i=qi(n,t-2,e);if(i<t)return i;t--}return 0}function Gi(n){return n>=56320&&n<57344}function Ki(n){return n>=55296&&n<56320}function Le(n,t){let e=n.charCodeAt(t);if(!Ki(e)||t+1==n.length)return e;let i=n.charCodeAt(t+1);return Gi(i)?(e-55296<<10)+(i-56320)+65536:e}function Ui(n){return n<65536?1:2}function Wr(n,t,e,i){for(let s=0,r=0;;){if(r>=t)return s;if(s==n.length)break;r+=n.charCodeAt(s)==9?e-r%e:1,s=st(n,s)}return i===!0?-1:n.length}class x{constructor(){}lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,i){let s=[];return this.decompose(0,t,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(e,this.length,s,1),Y.from(s,this.length-(e-t)+i.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){let i=[];return this.decompose(t,e,i,0),Y.from(i,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),i=this.length-this.scanIdentical(t,-1),s=new $t(this),r=new $t(t);for(let o=e,l=e;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(t=1){return new $t(this,t)}iterRange(t,e=this.length){return new Yi(this,t,e)}iterLines(t,e){let i;if(t==null)i=this.iter();else{e==null&&(e=this.lines+1);let s=this.line(t).from;i=this.iterRange(s,Math.max(s,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new Xi(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?x.empty:t.length<=32?new T(t):Y.from(T.split(t,[]))}}class T extends x{constructor(t,e=zr(t)){super();this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((e?i:l)>=t)return new qr(s,l,i,o);s=l+1,i++}}decompose(t,e,i,s){let r=t<=0&&e>=this.length?this:new T(Ji(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(s&1){let o=i.pop(),l=ee(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new T(l,o.length+r.length));else{let a=l.length>>1;i.push(new T(l.slice(0,a)),new T(l.slice(a)))}}else i.push(r)}replace(t,e,i){if(!(i instanceof T))return super.replace(t,e,i);let s=ee(this.text,ee(i.text,Ji(this.text,0,t)),e),r=this.length+i.length-(e-t);return s.length<=32?new T(s,r):Y.from(T.split(s,[]),r)}sliceString(t,e=this.length,i=`
6
- `){let s="";for(let r=0,o=0;r<=e&&o<this.text.length;o++){let l=this.text[o],a=r+l.length;r>t&&o&&(s+=i),t<a&&e>r&&(s+=l.slice(Math.max(0,t-r),e-r)),r=a+1}return s}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let i=[],s=-1;for(let r of t)i.push(r),s+=r.length+1,i.length==32&&(e.push(new T(i,s)),i=[],s=-1);return s>-1&&e.push(new T(i,s)),e}}class Y extends x{constructor(t,e){super();this.children=t,this.length=e,this.lines=0;for(let i of t)this.lines+=i.lines}lineInner(t,e,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=i+o.lines-1;if((e?a:l)>=t)return o.lineInner(t,e,i,s);s=l+1,i=a+1}}decompose(t,e,i,s){for(let r=0,o=0;o<=e&&r<this.children.length;r++){let l=this.children[r],a=o+l.length;if(t<=a&&e>=o){let h=s&((o<=t?1:0)|(a>=e?2:0));o>=t&&a<=e&&!h?i.push(l):l.decompose(t-o,e-o,i,h)}o=a+1}}replace(t,e,i){if(i.lines<this.lines)for(let s=0,r=0;s<this.children.length;s++){let o=this.children[s],l=r+o.length;if(t>=r&&e<=l){let a=o.replace(t-r,e-r,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>5-1&&a.lines>h>>5+1){let f=this.children.slice();return f[s]=a,new Y(f,this.length-(e-t)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(t,e,i)}sliceString(t,e=this.length,i=`
7
- `){let s="";for(let r=0,o=0;r<this.children.length&&o<=e;r++){let l=this.children[r],a=o+l.length;o>t&&r&&(s+=i),t<a&&e>o&&(s+=l.sliceString(t-o,e-o,i)),o=a+1}return s}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof Y))return 0;let i=0,[s,r,o,l]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;s+=e,r+=e){if(s==o||r==l)return i;let a=this.children[s],h=t.children[r];if(a!=h)return i+a.scanIdentical(h,e);i+=a.length+1}}static from(t,e=t.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let u of t)i+=u.lines;if(i<32){let u=[];for(let p of t)p.flatten(u);return new T(u,e)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],a=0,h=-1,f=[];function c(u){let p;if(u.lines>r&&u instanceof Y)for(let g of u.children)c(g);else u.lines>o&&(a>o||!a)?(d(),l.push(u)):u instanceof T&&a&&(p=f[f.length-1])instanceof T&&u.lines+p.lines<=32?(a+=u.lines,h+=u.length+1,f[f.length-1]=new T(p.text.concat(u.text),p.length+1+u.length)):(a+u.lines>s&&d(),a+=u.lines,h+=u.length+1,f.push(u))}function d(){a!=0&&(l.push(f.length==1?f[0]:Y.from(f,h)),h=-1,a=f.length=0)}for(let u of t)c(u);return d(),l.length==1?l[0]:new Y(l,e)}}x.empty=new T([""],0);function zr(n){let t=-1;for(let e of n)t+=e.length+1;return t}function ee(n,t,e=0,i=1e9){for(let s=0,r=0,o=!0;r<n.length&&s<=i;r++){let l=n[r],a=s+l.length;a>=e&&(a>i&&(l=l.slice(0,i-s)),s<e&&(l=l.slice(e-s)),o?(t[t.length-1]+=l,o=!1):t.push(l)),s=a+1}return t}function Ji(n,t,e){return ee(n,[""],t,e)}class $t{constructor(t,e=1){this.dir=e,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[e>0?1:(t instanceof T?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof T?s.text.length:s.children.length;if(o==(e>0?l:0)){if(i==0)return this.done=!0,this.value="",this;e>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(e>0?0:1)){if(this.offsets[i]+=e,t==0)return this.lineBreak=!0,this.value=`
8
- `,this;t--}else if(s instanceof T){let a=s.text[o+(e<0?-1:0)];if(this.offsets[i]+=e,a.length>Math.max(0,t))return this.value=t==0?a:e>0?a.slice(t):a.slice(0,a.length-t),this;t-=a.length}else{let a=s.children[o+(e<0?-1:0)];t>a.length?(t-=a.length,this.offsets[i]+=e):(e<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(e>0?1:(a instanceof T?a.text.length:a.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class Yi{constructor(t,e,i){this.value="",this.done=!1,this.cursor=new $t(t,e>i?-1:1),this.pos=e>i?t.length:0,this.from=Math.min(e,i),this.to=Math.max(e,i)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let i=e<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;let{value:s}=this.cursor.next(t);return this.pos+=(s.length+t)*e,this.value=s.length<=i?s:e<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Xi{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:i,value:s}=this.inner.next(t);return e?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(x.prototype[Symbol.iterator]=function(){return this.iter()},$t.prototype[Symbol.iterator]=Yi.prototype[Symbol.iterator]=Xi.prototype[Symbol.iterator]=function(){return this});class qr{constructor(t,e,i,s){this.from=t,this.to=e,this.number=i,this.text=s}get length(){return this.to-this.from}}const Ie=/\r\n?|\n/;var U=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(U||(U={}));class rt{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;e<this.sections.length;e+=2)t+=this.sections[e];return t}get newLength(){let t=0;for(let e=0;e<this.sections.length;e+=2){let i=this.sections[e+1];t+=i<0?this.sections[e]:i}return t}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(t){for(let e=0,i=0,s=0;e<this.sections.length;){let r=this.sections[e++],o=this.sections[e++];o<0?(t(i,s,r),s+=r):s+=o,i+=r}}iterChangedRanges(t,e=!1){$e(this,t,e)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let i=this.sections[e++],s=this.sections[e++];s<0?t.push(i,s):t.push(s,i)}return new rt(t)}composeDesc(t){return this.empty?t:t.empty?this:Zi(this,t)}mapDesc(t,e=!1){return t.empty?this:Ve(this,t,e)}mapPos(t,e=-1,i=U.Simple){let s=0,r=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=s+l;if(a<0){if(h>t)return r+(t-s);r+=l}else{if(i!=U.Simple&&h>=t&&(i==U.TrackDel&&s<t&&h>t||i==U.TrackBefore&&s<t||i==U.TrackAfter&&h>t))return null;if(h>t||h==t&&e<0&&!l)return t==s||e<0?r:r+a;r+=a}s=h}if(t>s)throw new RangeError(`Position ${t} is out of range for changeset of length ${s}`);return r}touchesRange(t,e=t){for(let i=0,s=0;i<this.sections.length&&s<=e;){let r=this.sections[i++],o=this.sections[i++],l=s+r;if(o>=0&&s<=e&&l>=t)return s<t&&l>e?"cover":!0;s=l}return!1}toString(){let t="";for(let e=0;e<this.sections.length;){let i=this.sections[e++],s=this.sections[e++];t+=(t?" ":"")+i+(s>=0?":"+s:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new rt(t)}}class L extends rt{constructor(t,e){super(t);this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return $e(this,(e,i,s,r,o)=>t=t.replace(s,s+(i-e),o),!1),t}mapDesc(t,e=!1){return Ve(this,t,e,!0)}invert(t){let e=this.sections.slice(),i=[];for(let s=0,r=0;s<e.length;s+=2){let o=e[s],l=e[s+1];if(l>=0){e[s]=l,e[s+1]=o;let a=s>>1;for(;i.length<a;)i.push(x.empty);i.push(o?t.slice(r,r+o):x.empty)}r+=o}return new L(e,i)}compose(t){return this.empty?t:t.empty?this:Zi(this,t,!0)}map(t,e=!1){return t.empty?this:Ve(this,t,e,!0)}iterChanges(t,e=!1){$e(this,t,e)}get desc(){return new rt(this.sections)}filter(t){let e=[],i=[],s=[],r=new Vt(this);t:for(let o=0,l=0;;){let a=o==t.length?1e9:t[o++];for(;l<a||l==a&&r.len==0;){if(r.done)break t;let f=Math.min(r.len,a-l);F(s,f,-1);let c=r.ins==-1?-1:r.off==0?r.ins:0;F(e,f,c),c>0&&ct(i,e,r.text),r.forward(f),l+=f}let h=t[o++];for(;l<h;){if(r.done)break t;let f=Math.min(r.len,h-l);F(e,f,-1),F(s,f,r.ins==-1?-1:r.off==0?r.ins:0),r.forward(f),l+=f}}return{changes:new L(e,i),filtered:new rt(s)}}toJSON(){let t=[];for(let e=0;e<this.sections.length;e+=2){let i=this.sections[e],s=this.sections[e+1];s<0?t.push(i):s==0?t.push([i]):t.push([i].concat(this.inserted[e>>1].toJSON()))}return t}static of(t,e,i){let s=[],r=[],o=0,l=null;function a(f=!1){if(!f&&!s.length)return;o<e&&F(s,e-o,-1);let c=new L(s,r);l=l?l.compose(c.map(l)):c,s=[],r=[],o=0}function h(f){if(Array.isArray(f))for(let c of f)h(c);else if(f instanceof L){if(f.length!=e)throw new RangeError(`Mismatched change set length (got ${f.length}, expected ${e})`);a(),l=l?l.compose(f.map(l)):f}else{let{from:c,to:d=c,insert:u}=f;if(c>d||c<0||d>e)throw new RangeError(`Invalid change range ${c} to ${d} (in doc of length ${e})`);let p=u?typeof u=="string"?x.of(u.split(i||Ie)):u:x.empty,g=p.length;if(c==d&&g==0)return;c<o&&a(),c>o&&F(s,c-o,-1),F(s,d-c,g),ct(r,s,p),o=d}}return h(t),a(!l),l}static empty(t){return new L(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let e=[],i=[];for(let s=0;s<t.length;s++){let r=t[s];if(typeof r=="number")e.push(r,-1);else{if(!Array.isArray(r)||typeof r[0]!="number"||r.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)e.push(r[0],0);else{for(;i.length<s;)i.push(x.empty);i[s]=x.of(r.slice(1)),e.push(r[0],i[s].length)}}}return new L(e,i)}}function F(n,t,e,i=!1){if(t==0&&e<=0)return;let s=n.length-2;s>=0&&e<=0&&e==n[s+1]?n[s]+=t:t==0&&n[s]==0?n[s+1]+=e:i?(n[s]+=t,n[s+1]+=e):n.push(t,e)}function ct(n,t,e){if(e.length==0)return;let i=t.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(e);else{for(;n.length<i;)n.push(x.empty);n.push(e)}}function $e(n,t,e){let i=n.inserted;for(let s=0,r=0,o=0;o<n.sections.length;){let l=n.sections[o++],a=n.sections[o++];if(a<0)s+=l,r+=l;else{let h=s,f=r,c=x.empty;for(;h+=l,f+=a,a&&i&&(c=c.append(i[o-2>>1])),!(e||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];t(s,h,r,f,c),s=h,r=f}}}function Ve(n,t,e,i=!1){let s=[],r=i?[]:null,o=new Vt(n),l=new Vt(t);for(let a=0,h=0;;)if(o.ins==-1)a+=o.len,o.next();else if(l.ins==-1&&h<a){let f=Math.min(l.len,a-h);l.forward(f),F(s,f,-1),h+=f}else if(l.ins>=0&&(o.done||h<a||h==a&&(l.len<o.len||l.len==o.len&&!e))){for(F(s,l.ins,-1);a>h&&!o.done&&a+o.len<h+l.len;)a+=o.len,o.next();h+=l.len,l.next()}else if(o.ins>=0){let f=0,c=a+o.len;for(;;)if(l.ins>=0&&h>a&&h+l.len<c)f+=l.ins,h+=l.len,l.next();else if(l.ins==-1&&h<c){let d=Math.min(l.len,c-h);f+=d,l.forward(d),h+=d}else break;F(s,f,o.ins),r&&ct(r,s,o.text),a=c,o.next()}else{if(o.done&&l.done)return r?new L(s,r):new rt(s);throw new Error("Mismatched change set lengths")}}function Zi(n,t,e=!1){let i=[],s=e?[]:null,r=new Vt(n),o=new Vt(t);for(let l=!1;;){if(r.done&&o.done)return s?new L(i,s):new rt(i);if(r.ins==0)F(i,r.len,0,l),r.next();else if(o.len==0&&!o.done)F(i,0,o.ins,l),s&&ct(s,i,o.text),o.next();else{if(r.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(r.len2,o.len),h=i.length;if(r.ins==-1){let f=o.ins==-1?-1:o.off?0:o.ins;F(i,a,f,l),s&&f&&ct(s,i,o.text)}else o.ins==-1?(F(i,r.off?0:r.len,a,l),s&&ct(s,i,r.textBit(a))):(F(i,r.off?0:r.len,o.off?0:o.ins,l),s&&!o.off&&ct(s,i,o.text));l=(r.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}class Vt{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i<t.length?(this.len=t[this.i++],this.ins=t[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:t}=this.set,e=this.i-2>>1;return e>=t.length?x.empty:t[e]}textBit(t){let{inserted:e}=this.set,i=this.i-2>>1;return i>=e.length&&!t?x.empty:e[i].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class xt{constructor(t,e,i){this.from=t,this.to=e,this.flags=i}get anchor(){return this.flags&16?this.to:this.from}get head(){return this.flags&16?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&4?-1:this.flags&8?1:0}get bidiLevel(){let t=this.flags&3;return t==3?null:t}get goalColumn(){let t=this.flags>>5;return t==33554431?void 0:t}map(t,e=-1){let i=t.mapPos(this.from,e),s=t.mapPos(this.to,e);return i==this.from&&s==this.to?this:new xt(i,s,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return y.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return y.range(this.anchor,i)}eq(t){return this.anchor==t.anchor&&this.head==t.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return y.range(t.anchor,t.head)}}class y{constructor(t,e=0){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:y.create(this.ranges.map(i=>i.map(t,e)),this.mainIndex)}eq(t){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let e=0;e<this.ranges.length;e++)if(!this.ranges[e].eq(t.ranges[e]))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new y([this.main])}addRange(t,e=!0){return y.create([t].concat(this.ranges),e?0:this.mainIndex+1)}replaceRange(t,e=this.mainIndex){let i=this.ranges.slice();return i[e]=t,y.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(t=>t.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new y(t.ranges.map(e=>xt.fromJSON(e)),t.main)}static single(t,e=t){return new y([y.range(t,e)],0)}static create(t,e=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;s<t.length;s++){let r=t[s];if(r.empty?r.from<=i:r.from<i)return Gr(t.slice(),e);i=r.to}return new y(t,e)}static cursor(t,e=0,i,s){return new xt(t,t,(e==0?0:e<0?4:8)|(i==null?3:Math.min(2,i))|(s??33554431)<<5)}static range(t,e,i){let s=(i??33554431)<<5;return e<t?new xt(e,t,16|s|8):new xt(t,e,s|(e>t?4:0))}}function Gr(n,t=0){let e=n[t];n.sort((i,s)=>i.from-s.from),t=n.indexOf(e);for(let i=1;i<n.length;i++){let s=n[i],r=n[i-1];if(s.empty?s.from<=r.to:s.from<r.to){let o=r.from,l=Math.max(s.to,r.to);i<=t&&t--,n.splice(--i,2,s.anchor>s.head?y.range(l,o):y.range(o,l))}}return new y(n,t)}function Qi(n,t){for(let e of n.ranges)if(e.to>t)throw new RangeError("Selection points outside of document")}let Ne=0;class S{constructor(t,e,i,s,r){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=s,this.extensions=r,this.id=Ne++,this.default=t([])}static define(t={}){return new S(t.combine||(e=>e),t.compareInput||((e,i)=>e===i),t.compare||(t.combine?(e,i)=>e===i:Fe),!!t.static,t.enables)}of(t){return new ie([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new ie(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new ie(t,this,2,e)}from(t,e){return e||(e=i=>i),this.compute([t],i=>e(i.field(t)))}}function Fe(n,t){return n==t||n.length==t.length&&n.every((e,i)=>e===t[i])}class ie{constructor(t,e,i,s){this.dependencies=t,this.facet=e,this.type=i,this.value=s,this.id=Ne++}dynamicSlot(t){var e;let i=this.value,s=this.facet.compareInput,r=t[this.id]>>1,o=this.type==2,l=!1,a=!1,h=[];for(let f of this.dependencies)f=="doc"?l=!0:f=="selection"?a=!0:(((e=t[f.id])!==null&&e!==void 0?e:1)&1)==0&&h.push(t[f.id]);return(f,c)=>{let d=f.values[r];if(d===ut)return f.values[r]=i(f),1;if(c&&(l&&c.docChanged||a&&(c.docChanged||c.selection)||h.some(p=>(Ft(f,p)&1)>0))){let p=i(f);if(o?!Kr(p,d,s):!s(p,d))return f.values[r]=p,1}return 0}}}function Kr(n,t,e){if(n.length!=t.length)return!1;for(let i=0;i<n.length;i++)if(!e(n[i],t[i]))return!1;return!0}function Ur(n,t,e){let i=e.map(l=>n[l.id]),s=e.map(l=>l.type),r=i.filter(l=>!(l&1)),o=n[t.id]>>1;return(l,a)=>{let h=l.values[o],f=h===ut;for(let u of r)Ft(l,u)&1&&(f=!0);if(!f)return 0;let c=[];for(let u=0;u<i.length;u++){let p=re(l,i[u]);if(s[u]==2)for(let g of p)c.push(g);else c.push(p)}let d=t.combine(c);return h!==ut&&t.compare(d,h)?0:(l.values[o]=d,1)}}const tn=S.define({static:!0});class Nt{constructor(t,e,i,s,r){this.id=t,this.createF=e,this.updateF=i,this.compareF=s,this.spec=r,this.provides=void 0}static define(t){let e=new Nt(Ne++,t.create,t.update,t.compare||((i,s)=>i===s),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(tn).find(i=>i.field==this);return((e==null?void 0:e.create)||this.createF)(t)}slot(t){let e=t[this.id]>>1;return(i,s)=>{let r=i.values[e];if(r===ut)return i.values[e]=this.create(i),1;if(s){let o=this.updateF(r,s);if(!this.compareF(r,o))return i.values[e]=o,1}return 0}}init(t){return[this,tn.of({field:this,create:t})]}get extension(){return this}}const tt={lowest:4,low:3,default:2,high:1,highest:0};function ot(n){return t=>new en(t,n)}const Jr={lowest:ot(tt.lowest),low:ot(tt.low),default:ot(tt.default),high:ot(tt.high),highest:ot(tt.highest),fallback:ot(tt.lowest),extend:ot(tt.high),override:ot(tt.highest)};class en{constructor(t,e){this.inner=t,this.prec=e}}class ne{of(t){return new He(this,t)}reconfigure(t){return ne.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class He{constructor(t,e){this.compartment=t,this.inner=e}}class se{constructor(t,e,i,s,r,o){for(this.base=t,this.compartments=e,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(t){let e=this.address[t.id];return e==null?t.default:this.staticValues[e>>1]}static resolve(t,e,i){let s=[],r=Object.create(null),o=new Map;for(let g of Yr(t,e,o))g instanceof Nt?s.push(g):(r[g.facet.id]||(r[g.facet.id]=[])).push(g);let l=Object.create(null),a=[],h=[],f=[];for(let g of s)l[g.id]=h.length<<1,h.push(m=>g.slot(m)),f.push(i&&i.config.address[g.id]!=null?i.field(g):ut);let c=new Map,d=g=>{if(!(g instanceof S))return!0;let m=c.get(g);if(m!=null)return m;if(c.set(g,!1),!(!u||!Fe(u[g.id]||[],r[g.id]||[]))){for(let b of r[g.id]||[])if(!b.dependencies.every(d))return;c.set(g,!0)}},u=i==null?void 0:i.config.facets;for(let g in r){let m=r[g],b=m[0].facet,E=u&&u[g]||[],Q=Fe(m,E);if(m.every(_=>_.type==0)){l[b.id]=a.length<<1|1;let _=Q?i.facet(b):b.combine(m.map(Re=>Re.value)),ht;!Q&&i&&b.compare(_,ht=i.facet(b))&&(_=ht),a.push(_)}else{for(let _ of m){let ht=_.dependencies.every(d);if(ht||(Q=!1),_.type==0)l[_.id]=a.length<<1|1,a.push(_.value);else{l[_.id]=h.length<<1,h.push(mp=>_.dynamicSlot(mp));let Re=i&&ht?i.config.address[_.id]:null;f.push(Re!=null?re(i,Re):ut)}}l[b.id]=h.length<<1,h.push(_=>Ur(_,b,m)),f.push(Q||E.length?i.facet(b):ut)}}let p=h.map(g=>g(l));return{configuration:new se(t,o,p,l,a,r),values:f}}}function Yr(n,t,e){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let a=s.get(o);if(a!=null){if(a>=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof He&&e.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof He){if(e.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=t.get(o.compartment)||o.inner;e.set(o.compartment,h),r(h,l)}else if(o instanceof en)r(o.inner,o.prec);else if(o instanceof Nt)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof ie)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,l);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(h,l)}}return r(n,tt.default),i.reduce((o,l)=>o.concat(l))}const ut={};function Ft(n,t){if(t&1)return 2;let e=t>>1,i=n.status[e];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[e]=4;let s=n.config.dynamicSlots[e](n,n.applying);return n.status[e]=2|s}function re(n,t){return t&1?n.config.staticValues[t>>1]:n.values[t>>1]}const nn=S.define(),sn=S.define({combine:n=>n.some(t=>t),static:!0}),rn=S.define({combine:n=>n.length?n[0]:void 0,static:!0}),on=S.define(),ln=S.define(),an=S.define(),hn=S.define({combine:n=>n.length?n[0]:!1});class Ht{constructor(t,e){this.type=t,this.value=e}static define(){return new Xr}}class Xr{of(t){return new Ht(this,t)}}class Zr{constructor(t){this.map=t}of(t){return new D(this,t)}}class D{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return e===void 0?void 0:e==this.value?this:new D(this.type,e)}is(t){return this.type==t}static define(t={}){return new Zr(t.map||(e=>e))}static mapEffects(t,e){if(!t.length)return t;let i=[];for(let s of t){let r=s.map(e);r&&i.push(r)}return i}}D.reconfigure=D.define(),D.appendConfig=D.define();class H{constructor(t,e,i,s,r,o){this.startState=t,this.changes=e,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Qi(i,e.newLength),r.some(l=>l.type==H.time)||(this.annotations=r.concat(H.time.of(Date.now())))}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(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(H.userEvent);return!!(e&&(e==t||e.length>t.length&&e.slice(0,t.length)==t&&e[t.length]=="."))}}H.time=Ht.define(),H.userEvent=Ht.define(),H.addToHistory=Ht.define(),H.remote=Ht.define();function Qr(n,t){let e=[];for(let i=0,s=0;;){let r,o;if(i<n.length&&(s==t.length||t[s]>=n[i]))r=n[i++],o=n[i++];else if(s<t.length)r=t[s++],o=t[s++];else return e;!e.length||e[e.length-1]<r?e.push(r,o):e[e.length-1]<o&&(e[e.length-1]=o)}}function fn(n,t,e){var i;let s,r,o;return e?(s=t.changes,r=L.empty(t.changes.length),o=n.changes.compose(t.changes)):(s=t.changes.map(n.changes),r=n.changes.mapDesc(t.changes,!0),o=n.changes.compose(s)),{changes:o,selection:t.selection?t.selection.map(r):(i=n.selection)===null||i===void 0?void 0:i.map(s),effects:D.mapEffects(n.effects,s).concat(D.mapEffects(t.effects,r)),annotations:n.annotations.length?n.annotations.concat(t.annotations):t.annotations,scrollIntoView:n.scrollIntoView||t.scrollIntoView}}function je(n,t,e){let i=t.selection,s=At(t.annotations);return t.userEvent&&(s=s.concat(H.userEvent.of(t.userEvent))),{changes:t.changes instanceof L?t.changes:L.of(t.changes||[],e,n.facet(rn)),selection:i&&(i instanceof y?i:y.single(i.anchor,i.head)),effects:At(t.effects),annotations:s,scrollIntoView:!!t.scrollIntoView}}function cn(n,t,e){let i=je(n,t.length?t[0]:{},n.doc.length);t.length&&t[0].filter===!1&&(e=!1);for(let r=1;r<t.length;r++){t[r].filter===!1&&(e=!1);let o=!!t[r].sequential;i=fn(i,je(n,t[r],o?i.changes.newLength:n.doc.length),o)}let s=new H(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return eo(e?to(s):s)}function to(n){let t=n.startState,e=!0;for(let s of t.facet(on)){let r=s(n);if(r===!1){e=!1;break}Array.isArray(r)&&(e=e===!0?r:Qr(e,r))}if(e!==!0){let s,r;if(e===!1)r=n.changes.invertedDesc,s=L.empty(t.doc.length);else{let o=n.changes.filter(e);s=o.changes,r=o.filtered.invertedDesc}n=new H(t,s,n.selection&&n.selection.map(r),D.mapEffects(n.effects,r),n.annotations,n.scrollIntoView)}let i=t.facet(ln);for(let s=i.length-1;s>=0;s--){let r=i[s](n);r instanceof H?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof H?n=r[0]:n=cn(t,At(r),!1)}return n}function eo(n){let t=n.startState,e=t.facet(an),i=n;for(let s=e.length-1;s>=0;s--){let r=e[s](n);r&&Object.keys(r).length&&(i=fn(n,je(t,r,n.changes.newLength),!0))}return i==n?n:new H(t,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const io=[];function At(n){return n==null?io:Array.isArray(n)?n:[n]}var et=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(et||(et={}));const no=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let We;try{We=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function so(n){if(We)return We.test(n);for(let t=0;t<n.length;t++){let e=n[t];if(/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||no.test(e)))return!0}return!1}function ro(n){return t=>{if(!/\S/.test(t))return et.Space;if(so(t))return et.Word;for(let e=0;e<n.length;e++)if(t.indexOf(n[e])>-1)return et.Word;return et.Other}}class w{constructor(t,e,i,s,r=null){this.config=t,this.doc=e,this.selection=i,this.values=s,this.applying=null,this.status=t.statusTemplate.slice(),this.applying=r,r&&(r._state=this);for(let o=0;o<this.config.dynamicSlots.length;o++)Ft(this,o<<1);this.applying=null}field(t,e=!0){let i=this.config.address[t.id];if(i==null){if(e)throw new RangeError("Field is not present in this state");return}return Ft(this,i),re(this,i)}update(...t){return cn(this,t,!0)}applyTransaction(t){let e=this.config,{base:i,compartments:s}=e;for(let o of t.effects)o.is(ne.reconfigure)?(e&&(s=new Map,e.compartments.forEach((l,a)=>s.set(a,l)),e=null),s.set(o.value.compartment,o.value.extension)):o.is(D.reconfigure)?(e=null,i=o.value):o.is(D.appendConfig)&&(e=null,i=At(i).concat(o.value));let r;if(e)r=t.startState.values.slice();else{let o=se.resolve(i,s,this);e=o.configuration,r=new w(e,this.doc,this.selection,o.values,null).values}new w(e,t.newDoc,t.newSelection,r,t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:t},range:y.cursor(e.from+t.length)}))}changeByRange(t){let e=this.selection,i=t(e.ranges[0]),s=this.changes(i.changes),r=[i.range],o=At(i.effects);for(let l=1;l<e.ranges.length;l++){let a=t(e.ranges[l]),h=this.changes(a.changes),f=h.map(s);for(let d=0;d<l;d++)r[d]=r[d].map(f);let c=s.mapDesc(h,!0);r.push(a.range.map(c)),s=s.compose(f),o=D.mapEffects(o,f).concat(D.mapEffects(At(a.effects),c))}return{changes:s,selection:y.create(r,e.mainIndex),effects:o}}changes(t=[]){return t instanceof L?t:L.of(t,this.doc.length,this.facet(w.lineSeparator))}toText(t){return x.of(t.split(this.facet(w.lineSeparator)||Ie))}sliceDoc(t=0,e=this.doc.length){return this.doc.sliceString(t,e,this.lineBreak)}facet(t){let e=this.config.address[t.id];return e==null?t.default:(Ft(this,e),re(this,e))}toJSON(t){let e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(let i in t){let s=t[i];s instanceof Nt&&(e[i]=s.spec.toJSON(this.field(t[i]),this))}return e}static fromJSON(t,e={},i){if(!t||typeof t.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(i)for(let r in i){let o=i[r],l=t[r];s.push(o.init(a=>o.spec.fromJSON(l,a)))}return w.create({doc:t.doc,selection:y.fromJSON(t.selection),extensions:e.extensions?s.concat([e.extensions]):s})}static create(t={}){let{configuration:e,values:i}=se.resolve(t.extensions||[],new Map),s=t.doc instanceof x?t.doc:x.of((t.doc||"").split(e.staticFacet(w.lineSeparator)||Ie)),r=t.selection?t.selection instanceof y?t.selection:y.single(t.selection.anchor,t.selection.head):y.single(0);return Qi(r,s.length),e.staticFacet(sn)||(r=r.asSingle()),new w(e,s,r,i)}get tabSize(){return this.facet(w.tabSize)}get lineBreak(){return this.facet(w.lineSeparator)||`
9
- `}get readOnly(){return this.facet(hn)}phrase(t){for(let e of this.facet(w.phrases))if(Object.prototype.hasOwnProperty.call(e,t))return e[t];return t}languageDataAt(t,e,i=-1){let s=[];for(let r of this.facet(nn))for(let o of r(this,e,i))Object.prototype.hasOwnProperty.call(o,t)&&s.push(o[t]);return s}charCategorizer(t){return ro(this.languageDataAt("wordChars",t).join(""))}wordAt(t){let{text:e,from:i,length:s}=this.doc.lineAt(t),r=this.charCategorizer(t),o=t-i,l=t-i;for(;o>0;){let a=st(e,o,!1);if(r(e.slice(a,o))!=et.Word)break;o=a}for(;l<s;){let a=st(e,l);if(r(e.slice(l,a))!=et.Word)break;l=a}return o==l?null:y.range(o+i,l+i)}}w.allowMultipleSelections=sn,w.tabSize=S.define({combine:n=>n.length?n[0]:4}),w.lineSeparator=rn,w.readOnly=hn,w.phrases=S.define(),w.languageData=nn,w.changeFilter=on,w.transactionFilter=ln,w.transactionExtender=an,ne.reconfigure=D.define();const ze="\u037C",un=typeof Symbol>"u"?"__"+ze:Symbol.for(ze),qe=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),dn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class kt{constructor(t,e){this.rules=[];let{finish:i}=e||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,a,h){let f=[],c=/^@(\w+)\b/.exec(o[0]),d=c&&c[1]=="keyframes";if(c&&l==null)return a.push(o[0]+";");for(let u in l){let p=l[u];if(/&/.test(u))r(u.split(/,\s*/).map(g=>o.map(m=>g.replace(/&/,m))).reduce((g,m)=>g.concat(m)),p,a);else if(p&&typeof p=="object"){if(!c)throw new RangeError("The value of a property ("+u+") should be a primitive value.");r(s(u),p,f,d)}else p!=null&&f.push(u.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+p+";")}(f.length||d)&&a.push((i&&!c&&!h?o.map(i):o).join(", ")+" {"+f.join(" ")+"}")}for(let o in t)r(s(o),t[o],this.rules)}getRules(){return this.rules.join(`
10
- `)}static newName(){let t=dn[un]||1;return dn[un]=t+1,ze+t.toString(36)}static mount(t,e){(t[qe]||new oo(t)).mount(Array.isArray(e)?e:[e])}}let oe=null;class oo{constructor(t){if(!t.head&&t.adoptedStyleSheets&&typeof CSSStyleSheet<"u"){if(oe)return t.adoptedStyleSheets=[oe.sheet].concat(t.adoptedStyleSheets),t[qe]=oe;this.sheet=new CSSStyleSheet,t.adoptedStyleSheets=[this.sheet].concat(t.adoptedStyleSheets),oe=this}else{this.styleTag=(t.ownerDocument||t).createElement("style");let e=t.head||t;e.insertBefore(this.styleTag,e.firstChild)}this.modules=[],t[qe]=this}mount(t){let e=this.sheet,i=0,s=0;for(let r=0;r<t.length;r++){let o=t[r],l=this.modules.indexOf(o);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,o),e)for(let a=0;a<o.rules.length;a++)e.insertRule(o.rules[a],i++)}else{for(;s<l;)i+=this.modules[s++].rules.length;i+=o.rules.length,s++}}if(!e){let r="";for(let o=0;o<this.modules.length;o++)r+=this.modules[o].getRules()+`
11
- `;this.styleTag.textContent=r}}}class jt{eq(t){return this==t}range(t,e=t){return new Ge(t,e,this)}}jt.prototype.startSide=jt.prototype.endSide=0,jt.prototype.point=!1,jt.prototype.mapMode=U.TrackDel;class Ge{constructor(t,e,i){this.from=t,this.to=e,this.value=i}}function Ke(n,t){return n.from-t.from||n.value.startSide-t.value.startSide}class Ue{constructor(t,e,i,s){this.from=t,this.to=e,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(t,e,i,s=0){let r=i?this.to:this.from;for(let o=s,l=r.length;;){if(o==l)return o;let a=o+l>>1,h=r[a]-t||(i?this.value[a].endSide:this.value[a].startSide)-e;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(t,e,i,s){for(let r=this.findIndex(e,-1e9,!0),o=this.findIndex(i,1e9,!1,r);r<o;r++)if(s(this.from[r]+t,this.to[r]+t,this.value[r])===!1)return!1}map(t,e){let i=[],s=[],r=[],o=-1,l=-1;for(let a=0;a<this.value.length;a++){let h=this.value[a],f=this.from[a]+t,c=this.to[a]+t,d,u;if(f==c){let p=e.mapPos(f,h.startSide,h.mapMode);if(p==null||(d=u=p,h.startSide!=h.endSide&&(u=e.mapPos(f,h.endSide),u<d)))continue}else if(d=e.mapPos(f,h.startSide),u=e.mapPos(c,h.endSide),d>u||d==u&&h.startSide>0&&h.endSide<=0)continue;(u-d||h.endSide-h.startSide)<0||(o<0&&(o=d),h.point&&(l=Math.max(l,u-d)),i.push(h),s.push(d-o),r.push(u-o))}return{mapped:i.length?new Ue(s,r,i,l):null,pos:o}}}class P{constructor(t,e,i=P.empty,s){this.chunkPos=t,this.chunk=e,this.nextLayer=i,this.maxPoint=s}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:i=!1,filterFrom:s=0,filterTo:r=this.length}=t,o=t.filter;if(e.length==0&&!o)return this;if(i&&e.slice().sort(Ke),this.isEmpty)return e.length?P.of(e):this;let l=new gn(this,null,-1).goto(0),a=0,h=[],f=new le;for(;l.value||a<e.length;)if(a<e.length&&(l.from-e[a].from||l.startSide-e[a].value.startSide)>=0){let c=e[a++];f.addInner(c.from,c.to,c.value)||h.push(c)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==e.length||this.chunkEnd(l.chunkIndex)<e[a].from)&&(!o||s>this.chunkEnd(l.chunkIndex)||r<this.chunkPos[l.chunkIndex])&&f.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||s>l.to||r<l.from||o(l.from,l.to,l.value))&&(f.addInner(l.from,l.to,l.value)||h.push(new Ge(l.from,l.to,l.value))),l.next());return f.finishInner(this.nextLayer.isEmpty&&!h.length?P.empty:this.nextLayer.update({add:h,filter:o,filterFrom:s,filterTo:r}))}map(t){if(t.length==0||this.isEmpty)return this;let e=[],i=[],s=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],a=this.chunk[o],h=t.touchesRange(l,l+a.length);if(h===!1)s=Math.max(s,a.maxPoint),e.push(a),i.push(t.mapPos(l));else if(h===!0){let{mapped:f,pos:c}=a.map(l,t);f&&(s=Math.max(s,f.maxPoint),e.push(f),i.push(c))}}let r=this.nextLayer.map(t);return e.length==0?r:new P(i,e,r,s)}between(t,e,i){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let r=this.chunkPos[s],o=this.chunk[s];if(e>=r&&t<=r+o.length&&o.between(r,t-r,e-r,i)===!1)return}this.nextLayer.between(t,e,i)}}iter(t=0){return Wt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Wt.from(t).goto(e)}static compare(t,e,i,s,r=-1){let o=t.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=r),l=e.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=r),a=pn(o,l,i),h=new zt(o,a,r),f=new zt(l,a,r);i.iterGaps((c,d,u)=>mn(h,c,f,d,u,s)),i.empty&&i.length==0&&mn(h,0,f,0,0,s)}static eq(t,e,i=0,s){s==null&&(s=1e9);let r=t.filter(f=>!f.isEmpty&&e.indexOf(f)<0),o=e.filter(f=>!f.isEmpty&&t.indexOf(f)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let l=pn(r,o),a=new zt(r,l,0).goto(i),h=new zt(o,l,0).goto(i);for(;;){if(a.to!=h.to||!Ye(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>s)return!0;a.next(),h.next()}}static spans(t,e,i,s,r=-1){var o;let l=new zt(t,null,r,(o=s.filterPoint)===null||o===void 0?void 0:o.bind(s)).goto(e),a=e,h=l.openStart;for(;;){let f=Math.min(l.to,i);if(l.point?(s.point(a,f,l.point,l.activeForPoint(l.to),h),h=l.openEnd(f)+(l.to>f?1:0)):f>a&&(s.span(a,f,l.active,h),h=l.openEnd(f)),l.to>i)break;a=l.to,l.next()}return h}static of(t,e=!1){let i=new le;for(let s of t instanceof Ge?[t]:e?lo(t):t)i.add(s.from,s.to,s.value);return i.finish()}}P.empty=new P([],[],null,-1);function lo(n){if(n.length>1)for(let t=n[0],e=1;e<n.length;e++){let i=n[e];if(Ke(t,i)>0)return n.slice().sort(Ke);t=i}return n}P.empty.nextLayer=P.empty;class le{constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}finishChunk(t){this.chunks.push(new Ue(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new le)).add(t,e,i)}addInner(t,e,i){let s=t-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=i,this.lastFrom=t,this.lastTo=e,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0)}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let i=e.value.length-1;return this.last=e.value[i],this.lastFrom=e.from[i]+t,this.lastTo=e.to[i]+t,!0}finish(){return this.finishInner(P.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let e=new P(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function pn(n,t,e){let i=new Map;for(let r of n)for(let o=0;o<r.chunk.length;o++)r.chunk[o].maxPoint<=0&&i.set(r.chunk[o],r.chunkPos[o]);let s=new Set;for(let r of t)for(let o=0;o<r.chunk.length;o++){let l=i.get(r.chunk[o]);l!=null&&(e?e.mapPos(l):l)==r.chunkPos[o]&&!(e==null?void 0:e.touchesRange(l,l+r.chunk[o].length))&&s.add(r.chunk[o])}return s}class gn{constructor(t,e,i,s=0){this.layer=t,this.skip=e,this.minPoint=i,this.rank=s}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(t,e=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,e,!1),this}gotoInner(t,e,i){for(;this.chunkIndex<this.layer.chunk.length;){let s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<t||s.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],e,!0);(!i||this.rangeIndex<s)&&this.setRangeIndex(s)}this.next()}forward(t,e){(this.to-t||this.endSide-e)<0&&this.gotoInner(t,e,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let t=this.layer.chunkPos[this.chunkIndex],e=this.layer.chunk[this.chunkIndex],i=t+e.from[this.rangeIndex];if(this.from=i,this.to=t+e.to[this.rangeIndex],this.value=e.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=t}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(t){return this.from-t.from||this.startSide-t.startSide||this.to-t.to||this.endSide-t.endSide}}class Wt{constructor(t){this.heap=t}static from(t,e=null,i=-1){let s=[];for(let r=0;r<t.length;r++)for(let o=t[r];!o.isEmpty;o=o.nextLayer)o.maxPoint>=i&&s.push(new gn(o,e,i,r));return s.length==1?s[0]:new Wt(s)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let i of this.heap)i.goto(t,e);for(let i=this.heap.length>>1;i>=0;i--)Je(this.heap,i);return this.next(),this}forward(t,e){for(let i of this.heap)i.forward(t,e);for(let i=this.heap.length>>1;i>=0;i--)Je(this.heap,i);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),Je(this.heap,0)}}}function Je(n,t){for(let e=n[t];;){let i=(t<<1)+1;if(i>=n.length)break;let s=n[i];if(i+1<n.length&&s.compare(n[i+1])>=0&&(s=n[i+1],i++),e.compare(s)<0)break;n[i]=e,n[t]=s,t=i}}class zt{constructor(t,e,i,s=()=>!0){this.minPoint=i,this.filterPoint=s,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Wt.from(t,e,i)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){ae(this.active,t),ae(this.activeTo,t),ae(this.activeRank,t),this.minActive=yn(this.active,this.activeTo)}addActive(t){let e=0,{value:i,to:s,rank:r}=this.cursor;for(;e<this.activeRank.length&&this.activeRank[e]<=r;)e++;he(this.active,e,i),he(this.activeTo,e,s),he(this.activeRank,e,r),t&&he(t,e,this.cursor.from),this.minActive=yn(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let i=this.openStart<0?[]:null,s=0;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>t){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),i&&ae(i,r)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let o=this.cursor.value;if(!o.point)this.addActive(i),this.cursor.next();else if(e&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else if(!this.filterPoint(this.cursor.from,this.cursor.to,this.cursor.value,this.cursor.rank))this.cursor.next();else{this.point=o,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=o.endSide,this.cursor.from<t&&(s=1),this.cursor.next(),this.to>t&&this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){let r=0;for(;r<i.length&&i[r]<t;)r++;this.openStart=r+s}}activeForPoint(t){if(!this.active.length)return this.active;let e=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>t||this.activeTo[i]==t&&this.active[i].endSide>=this.point.endSide)&&e.push(this.active[i]);return e.reverse()}openEnd(t){let e=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>t;i--)e++;return e}}function mn(n,t,e,i,s,r){n.goto(t),e.goto(i);let o=i+s,l=i,a=i-t;for(;;){let h=n.to+a-e.to||n.endSide-e.endSide,f=h<0?n.to+a:e.to,c=Math.min(f,o);if(n.point||e.point?n.point&&e.point&&(n.point==e.point||n.point.eq(e.point))&&Ye(n.activeForPoint(n.to+a),e.activeForPoint(e.to))||r.comparePoint(l,c,n.point,e.point):c>l&&!Ye(n.active,e.active)&&r.compareRange(l,c,n.active,e.active),f>o)break;l=f,h<=0&&n.next(),h>=0&&e.next()}}function Ye(n,t){if(n.length!=t.length)return!1;for(let e=0;e<n.length;e++)if(n[e]!=t[e]&&!n[e].eq(t[e]))return!1;return!0}function ae(n,t){for(let e=t,i=n.length-1;e<i;e++)n[e]=n[e+1];n.pop()}function he(n,t,e){for(let i=n.length-1;i>=t;i--)n[i+1]=n[i];n[t]=e}function yn(n,t){let e=-1,i=1e9;for(let s=0;s<t.length;s++)(t[s]-i||n[s].endSide-n[e].endSide)<0&&(e=s,i=t[s]);return e}var Ot={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:"'",229:"q"},Xe={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},vn=typeof navigator<"u"&&/Chrome\/(\d+)/.exec(navigator.userAgent);typeof navigator<"u"&&/Apple Computer/.test(navigator.vendor);var ao=typeof navigator<"u"&&/Gecko\/\d+/.test(navigator.userAgent),bn=typeof navigator<"u"&&/Mac/.test(navigator.platform);typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),vn&&(bn||+vn[1]<57);for(var I=0;I<10;I++)Ot[48+I]=Ot[96+I]=String(I);for(var I=1;I<=24;I++)Ot[I+111]="F"+I;for(var I=65;I<=90;I++)Ot[I]=String.fromCharCode(I+32),Xe[I]=String.fromCharCode(I);for(var Ze in Ot)Xe.hasOwnProperty(Ze)||(Xe[Ze]=Ot[Ze]);function fe(n){let t;return n.nodeType==11?t=n.getSelection?n:n.ownerDocument:t=n,t.getSelection()}function Qe(n,t){return t?n.contains(t.nodeType!=1?t.parentNode:t):!1}function ho(){let n=document.activeElement;for(;n&&n.shadowRoot;)n=n.shadowRoot.activeElement;return n}function ti(n,t){if(!t.anchorNode)return!1;try{return Qe(n,t.anchorNode)}catch{return!1}}function Ct(n){return n.nodeType==3?qt(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function ce(n,t,e,i){return e?wn(n,t,e,i,-1)||wn(n,t,e,i,1):!1}function ei(n){for(var t=0;;t++)if(n=n.previousSibling,!n)return t}function wn(n,t,e,i,s){for(;;){if(n==e&&t==i)return!0;if(t==(s<0?0:ue(n))){if(n.nodeName=="DIV")return!1;let r=n.parentNode;if(!r||r.nodeType!=1)return!1;t=ei(n)+(s<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[t+(s<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;t=s<0?ue(n):0}else return!1}}function ue(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}const Sn={left:0,right:0,top:0,bottom:0};function de(n,t){let e=t?n.left:n.right;return{left:e,right:e,top:n.top,bottom:n.bottom}}function fo(n){return{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function co(n,t,e,i,s,r,o,l){let a=n.ownerDocument,h=a.defaultView;for(let f=n;f;)if(f.nodeType==1){let c,d=f==a.body;if(d)c=fo(h);else{if(f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.parentNode;continue}let g=f.getBoundingClientRect();c={left:g.left,right:g.left+f.clientWidth,top:g.top,bottom:g.top+f.clientHeight}}let u=0,p=0;if(s=="nearest")t.top<c.top?(p=-(c.top-t.top+o),e>0&&t.bottom>c.bottom+p&&(p=t.bottom-c.bottom+p+o)):t.bottom>c.bottom&&(p=t.bottom-c.bottom+o,e<0&&t.top-p<c.top&&(p=-(c.top+p-t.top+o)));else{let g=t.bottom-t.top,m=c.bottom-c.top;p=(s=="center"&&g<=m?t.top+g/2-m/2:s=="start"||s=="center"&&e<0?t.top-o:t.bottom-m+o)-c.top}if(i=="nearest"?t.left<c.left?(u=-(c.left-t.left+r),e>0&&t.right>c.right+u&&(u=t.right-c.right+u+r)):t.right>c.right&&(u=t.right-c.right+r,e<0&&t.left<c.left+u&&(u=-(c.left+u-t.left+r))):u=(i=="center"?t.left+(t.right-t.left)/2-(c.right-c.left)/2:i=="start"==l?t.left-r:t.right-(c.right-c.left)+r)-c.left,u||p)if(d)h.scrollBy(u,p);else{if(p){let g=f.scrollTop;f.scrollTop+=p,p=f.scrollTop-g}if(u){let g=f.scrollLeft;f.scrollLeft+=u,u=f.scrollLeft-g}t={left:t.left-u,top:t.top-p,right:t.right-u,bottom:t.bottom-p}}if(d)break;f=f.assignedSlot||f.parentNode,i=s="nearest"}else if(f.nodeType==11)f=f.host;else break}class uo{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){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,s){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=s}}let Mt=null;function xn(n){if(n.setActive)return n.setActive();if(Mt)return n.focus(Mt);let t=[];for(let e=n;e&&(t.push(e,e.scrollTop,e.scrollLeft),e!=e.ownerDocument);e=e.parentNode);if(n.focus(Mt==null?{get preventScroll(){return Mt={preventScroll:!0},!0}}:void 0),!Mt){Mt=!1;for(let e=0;e<t.length;){let i=t[e++],s=t[e++],r=t[e++];i.scrollTop!=s&&(i.scrollTop=s),i.scrollLeft!=r&&(i.scrollLeft=r)}}}let An;function qt(n,t,e=t){let i=An||(An=document.createRange());return i.setEnd(n,e),i.setStart(n,t),i}function Gt(n,t,e){let i={key:t,code:t,keyCode:e,which:e,cancelable:!0},s=new KeyboardEvent("keydown",i);s.synthetic=!0,n.dispatchEvent(s);let r=new KeyboardEvent("keyup",i);return r.synthetic=!0,n.dispatchEvent(r),s.defaultPrevented||r.defaultPrevented}function po(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function kn(n){for(;n.attributes.length;)n.removeAttributeNode(n.attributes[0])}class V{constructor(t,e,i=!0){this.node=t,this.offset=e,this.precise=i}static before(t,e){return new V(t.parentNode,ei(t),e)}static after(t,e){return new V(t.parentNode,ei(t)+1,e)}}const ii=[];class C{constructor(){this.parent=null,this.dom=null,this.dirty=2}get editorView(){if(!this.parent)throw new Error("Accessing view in orphan content view");return this.parent.editorView}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t){let e=this.posAtStart;for(let i of this.children){if(i==t)return e;e+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}coordsAt(t,e){return null}sync(t){if(this.dirty&2){let e=this.dom,i=e.firstChild;for(let s of this.children){if(s.dirty){if(!s.dom&&i){let r=C.get(i);(!r||!r.parent&&r.constructor==s.constructor)&&s.reuseDOM(i)}s.sync(t),s.dirty=0}if(t&&!t.written&&t.node==e&&i!=s.dom&&(t.written=!0),s.dom.parentNode==e){for(;i&&i!=s.dom;)i=On(i);i=s.dom.nextSibling}else e.insertBefore(s.dom,i)}for(i&&t&&t.node==e&&(t.written=!0);i;)i=On(i)}else if(this.dirty&1)for(let e of this.children)e.dirty&&(e.sync(t),e.dirty=0)}reuseDOM(t){}localPosFromDOM(t,e){let i;if(t==this.dom)i=this.dom.childNodes[e];else{let s=ue(t)==0?0:e==0?-1:1;for(;;){let r=t.parentNode;if(r==this.dom)break;s==0&&r.firstChild!=r.lastChild&&(t==r.firstChild?s=-1:s=1),t=r}s<0?i=t:i=t.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!C.get(i);)i=i.nextSibling;if(!i)return this.length;for(let s=0,r=0;;s++){let o=this.children[s];if(o.dom==i)return r;r+=o.length+o.breakAfter}}domBoundsAround(t,e,i=0){let s=-1,r=-1,o=-1,l=-1;for(let a=0,h=i,f=i;a<this.children.length;a++){let c=this.children[a],d=h+c.length;if(h<t&&d>e)return c.domBoundsAround(t,e,h);if(d>=t&&s==-1&&(s=a,r=h),h>e&&c.dom.parentNode==this.dom){o=a,l=f;break}f=d,h=d+c.breakAfter}return{from:r,to:l<0?i+this.length:l,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}markDirty(t=!1){this.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),e.dirty&1)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(t){this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,i=ii){this.markDirty();for(let s=t;s<e;s++){let r=this.children[s];r.parent==this&&r.destroy()}this.children.splice(t,e-t,...i);for(let s=0;s<i.length;s++)i[s].setParent(this)}ignoreMutation(t){return!1}ignoreEvent(t){return!1}childCursor(t=this.length){return new Cn(this.children,t,this.children.length)}childPos(t,e=1){return this.childCursor().findPos(t,e)}toString(){let t=this.constructor.name.replace("View","");return t+(this.children.length?"("+this.children.join()+")":this.length?"["+(t=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(t){return t.cmView}get isEditable(){return!0}merge(t,e,i,s,r,o){return!1}become(t){return!1}getSide(){return 0}destroy(){this.parent=null}}C.prototype.breakAfter=0;function On(n){let t=n.nextSibling;return n.parentNode.removeChild(n),t}class Cn{constructor(t,e,i){this.children=t,this.pos=e,this.i=i,this.off=0}findPos(t,e=1){for(;;){if(t>this.pos||t==this.pos&&(e>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function Mn(n,t,e,i,s,r,o,l,a){let{children:h}=n,f=h.length?h[t]:null,c=r.length?r[r.length-1]:null,d=c?c.breakAfter:o;if(!(t==i&&f&&!o&&!d&&r.length<2&&f.merge(e,s,r.length?c:null,e==0,l,a))){if(i<h.length){let u=h[i];u&&s<u.length?(t==i&&(u=u.split(s),s=0),!d&&c&&u.merge(0,s,c,!0,0,a)?r[r.length-1]=u:(s&&u.merge(0,s,null,!1,0,a),r.push(u))):(u==null?void 0:u.breakAfter)&&(c?c.breakAfter=1:o=1),i++}for(f&&(f.breakAfter=o,e>0&&(!o&&r.length&&f.merge(e,f.length,r[0],!1,l,0)?f.breakAfter=r.shift().breakAfter:(e<f.length||f.children.length&&f.children[f.children.length-1].length==0)&&f.merge(e,f.length,null,!1,l,0),t++));t<i&&r.length;)if(h[i-1].become(r[r.length-1]))i--,r.pop(),a=r.length?0:l;else if(h[t].become(r[0]))t++,r.shift(),l=r.length?0:a;else break;!r.length&&t&&i<h.length&&!h[t-1].breakAfter&&h[i].merge(0,0,h[t-1],!1,l,a)&&t--,(t<i||r.length)&&n.replaceChildren(t,i,r)}}function Tn(n,t,e,i,s,r){let o=n.childCursor(),{i:l,off:a}=o.findPos(e,1),{i:h,off:f}=o.findPos(t,-1),c=t-e;for(let d of i)c+=d.length;n.length+=c,Mn(n,h,f,l,a,i,0,s,r)}let z=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},ni=typeof document<"u"?document:{documentElement:{style:{}}};const si=/Edge\/(\d+)/.exec(z.userAgent),Dn=/MSIE \d/.test(z.userAgent),ri=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(z.userAgent),pe=!!(Dn||ri||si),Pn=!pe&&/gecko\/(\d+)/i.test(z.userAgent),oi=!pe&&/Chrome\/(\d+)/.exec(z.userAgent),Rn="webkitFontSmoothing"in ni.documentElement.style,Bn=!pe&&/Apple Computer/.test(z.vendor),En=Bn&&(/Mobile\/\w+/.test(z.userAgent)||z.maxTouchPoints>2);var v={mac:En||/Mac/.test(z.platform),windows:/Win/.test(z.platform),linux:/Linux|X11/.test(z.platform),ie:pe,ie_version:Dn?ni.documentMode||6:ri?+ri[1]:si?+si[1]:0,gecko:Pn,gecko_version:Pn?+(/Firefox\/(\d+)/.exec(z.userAgent)||[0,0])[1]:0,chrome:!!oi,chrome_version:oi?+oi[1]:0,ios:En,android:/Android\b/.test(z.userAgent),webkit:Rn,safari:Bn,webkit_version:Rn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:ni.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const go=256;class dt extends C{constructor(t){super();this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){t.nodeType==3&&this.createDOM(t)}merge(t,e,i){return i&&(!(i instanceof dt)||this.length-(e-t)+i.length>go)?!1:(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new dt(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new V(this.dom,t)}domBoundsAround(t,e,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return _n(this.dom,t,e)}}class pt extends C{constructor(t,e=[],i=0){super();this.mark=t,this.children=e,this.length=i;for(let s of e)s.setParent(this)}setAttrs(t){if(kn(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t){this.dom?this.dirty&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t)}merge(t,e,i,s,r,o){return i&&(!(i instanceof pt&&i.mark.eq(this.mark))||t&&r<=0||e<this.length&&o<=0)?!1:(Tn(this,t,e,i?i.children:[],r-1,o-1),this.markDirty(),!0)}split(t){let e=[],i=0,s=-1,r=0;for(let l of this.children){let a=i+l.length;a>t&&e.push(i<t?l.split(t-i):l),s<0&&i>=t&&(s=r),i=a,r++}let o=this.length-t;return this.length=t,s>-1&&(this.children.length=s,this.markDirty()),new pt(this.mark,e,o)}domAtPos(t){return Ln(this.dom,this.children,t)}coordsAt(t,e){return $n(this,t,e)}}function _n(n,t,e){let i=n.nodeValue.length;t>i&&(t=i);let s=t,r=t,o=0;t==0&&e<0||t==i&&e>=0?v.chrome||v.gecko||(t?(s--,o=1):(r++,o=-1)):e<0?s--:r++;let l=qt(n,s,r).getClientRects();if(!l.length)return Sn;let a=l[(o?o<0:e>=0)?0:l.length-1];return v.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?de(a,o<0):a||null}class lt extends C{constructor(t,e,i){super();this.widget=t,this.length=e,this.side=i}static create(t,e,i){return new(t.customView||lt)(t,e,i)}split(t){let e=lt.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(){(!this.dom||!this.widget.updateDOM(this.dom))&&(this.setDOM(this.widget.toDOM(this.editorView)),this.dom.contentEditable="false")}getSide(){return this.side}merge(t,e,i,s,r,o){return i&&(!(i instanceof lt)||!this.widget.compare(i.widget)||t>0&&r<=0||e<this.length&&o<=0)?!1:(this.length=t+(i?i.length:0)+(this.length-e),!0)}become(t){return t.length==this.length&&t instanceof lt&&t.side==this.side&&this.widget.constructor==t.widget.constructor?(this.widget.eq(t.widget)||this.markDirty(!0),this.widget=t.widget,!0):!1}ignoreMutation(){return!0}ignoreEvent(t){return this.widget.ignoreEvent(t)}get overrideDOMText(){if(this.length==0)return x.empty;let t=this;for(;t.parent;)t=t.parent;let e=t.editorView,i=e&&e.state.doc,s=this.posAtStart;return i?i.slice(s,s+this.length):x.empty}domAtPos(t){return t==0?V.before(this.dom):V.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),s=null;if(!i.length)return Sn;for(let r=t>0?i.length-1:0;s=i[r],!(t>0?r==0:r==i.length-1||s.top<s.bottom);r+=t>0?-1:1);return t==0&&e>0||t==this.length&&e<=0?s:de(s,t==0)}get isEditable(){return!1}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class mo extends lt{domAtPos(t){return new V(this.widget.text,t)}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){return e?t.nodeType==3?Math.min(e,this.length):this.length:0}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){return _n(this.widget.text,t,e)}get isEditable(){return!0}}const li=v.android?"\u200B\u200B":"\u200B";class Tt extends C{constructor(t){super();this.side=t}get length(){return 0}merge(){return!1}become(t){return t instanceof Tt&&t.side==this.side}split(){return new Tt(this.side)}sync(){this.dom?this.dirty&&this.dom.nodeValue!=li&&(this.dom.nodeValue=li):this.setDOM(document.createTextNode(li))}getSide(){return this.side}domAtPos(t){return V.before(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=Ct(this.dom);return e[e.length-1]||null}get overrideDOMText(){return x.of([this.dom.nodeValue.replace(/\u200b/g,"")])}}dt.prototype.children=lt.prototype.children=Tt.prototype.children=ii;function Ln(n,t,e){let i=0;for(let s=0;i<t.length;i++){let r=t[i],o=s+r.length;if(!(o==s&&r.getSide()<=0)){if(e>s&&e<o&&r.dom.parentNode==n)return r.domAtPos(e-s);if(e<=s)break;s=o}}for(;i>0;i--){let s=t[i-1].dom;if(s.parentNode==n)return V.after(s)}return new V(n,0)}function In(n,t,e){let i,{children:s}=n;e>0&&t instanceof pt&&s.length&&(i=s[s.length-1])instanceof pt&&i.mark.eq(t.mark)?In(i,t.children[0],e-1):(s.push(t),t.setParent(n)),n.length+=t.length}function $n(n,t,e){for(let r=0,o=0;o<n.children.length;o++){let l=n.children[o],a=r+l.length,h;if((e<=0||a==n.length||l.getSide()>0?a>=t:a>t)&&(t<a||o+1==n.children.length||(h=n.children[o+1]).length||h.getSide()>0)){let f=0;if(a==r){if(l.getSide()<=0)continue;f=e=-l.getSide()}let c=l.coordsAt(t-r,e);return f&&c?de(c,e<0):c}r=a}let i=n.dom.lastChild;if(!i)return n.dom.getBoundingClientRect();let s=Ct(i);return s[s.length-1]||null}function ai(n,t){for(let e in n)e=="class"&&t.class?t.class+=" "+n.class:e=="style"&&t.style?t.style+=";"+n.style:t[e]=n[e];return t}function hi(n,t){if(n==t)return!0;if(!n||!t)return!1;let e=Object.keys(n),i=Object.keys(t);if(e.length!=i.length)return!1;for(let s of e)if(i.indexOf(s)==-1||n[s]!==t[s])return!1;return!0}function fi(n,t,e){if(t)for(let i in t)e&&i in e||n.removeAttribute(i);if(e)for(let i in e)t&&t[i]==e[i]||n.setAttribute(i,e[i])}class ge{eq(t){return!1}updateDOM(t){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}ignoreEvent(t){return!0}get customView(){return null}destroy(t){}}var R=function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n}(R||(R={}));class N extends jt{constructor(t,e,i,s){super();this.startSide=t,this.endSide=e,this.widget=i,this.spec=s}get heightRelevant(){return!1}static mark(t){return new me(t)}static widget(t){let e=t.side||0,i=!!t.block;return e+=i?e>0?3e8:-4e8:e>0?1e8:-1e8,new gt(t,e,e,i,t.widget||null,!1)}static replace(t){let e=!!t.block,{start:i,end:s}=Vn(t,e),r=(i?e?-3e8:-1:4e8)-1,o=(s?e?2e8:1:-5e8)+1;return new gt(t,r,o,e,t.widget||null,!0)}static line(t){return new Kt(t)}static set(t,e=!1){return P.of(t,e)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}N.none=P.empty;class me extends N{constructor(t){let{start:e,end:i}=Vn(t);super(e?-1:4e8,i?1:-5e8,null,t);this.tagName=t.tagName||"span",this.class=t.class||"",this.attrs=t.attributes||null}eq(t){return this==t||t instanceof me&&this.tagName==t.tagName&&this.class==t.class&&hi(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)}}me.prototype.point=!1;class Kt extends N{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof Kt&&hi(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)}}Kt.prototype.mapMode=U.TrackBefore,Kt.prototype.point=!0;class gt extends N{constructor(t,e,i,s,r,o){super(e,i,r,t);this.block=s,this.isReplace=o,this.mapMode=s?e<=0?U.TrackBefore:U.TrackAfter:U.TrackDel}get type(){return this.startSide<this.endSide?R.WidgetRange:this.startSide<=0?R.WidgetBefore:R.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&this.widget.estimatedHeight>=5}eq(t){return t instanceof gt&&yo(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)}}gt.prototype.point=!0;function Vn(n,t=!1){let{inclusiveStart:e,inclusiveEnd:i}=n;return e==null&&(e=n.inclusive),i==null&&(i=n.inclusive),{start:e??t,end:i??t}}function yo(n,t){return n==t||!!(n&&t&&n.compare(t))}function ci(n,t,e,i=0){let s=e.length-1;s>=0&&e[s]+i>=n?e[s]=Math.max(e[s],t):e.push(n,t)}class j extends C{constructor(){super(...arguments);this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(t,e,i,s,r,o){if(i){if(!(i instanceof j))return!1;this.dom||i.transferDOM(this)}return s&&this.setDeco(i?i.attrs:null),Tn(this,t,e,i?i.children:[],r,o),!0}split(t){let e=new j;if(e.breakAfter=this.breakAfter,this.length==0)return e;let{i,off:s}=this.childPos(t);s&&(e.append(this.children[i].split(s),0),this.children[i].merge(s,this.children[i].length,null,!1,0,0),i++);for(let r=i;r<this.children.length;r++)e.append(this.children[r],0);for(;i>0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=t,e}transferDOM(t){!this.dom||(t.setDOM(this.dom),t.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){hi(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){In(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=ai(e,this.attrs||{})),i&&(this.attrs=ai({class:i},this.attrs||{}))}domAtPos(t){return Ln(this.dom,this.children,t)}reuseDOM(t){t.nodeName=="DIV"&&(this.setDOM(t),this.dirty|=6)}sync(t){var e;this.dom?this.dirty&4&&(kn(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(fi(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t);let i=this.dom.lastChild;for(;i&&C.get(i)instanceof pt;)i=i.lastChild;if(!i||i.nodeName!="BR"&&((e=C.get(i))===null||e===void 0?void 0:e.isEditable)==!1&&(!v.ios||!this.children.some(s=>s instanceof dt))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let t=0;for(let e of this.children){if(!(e instanceof dt))return null;let i=Ct(e.dom);if(i.length!=1)return null;t+=i[0].width}return{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length}}coordsAt(t,e){return $n(this,t,e)}become(t){return!1}get type(){return R.Text}static find(t,e){for(let i=0,s=0;i<t.children.length;i++){let r=t.children[i],o=s+r.length;if(o>=e){if(r instanceof j)return r;if(o>e)break}s=o+r.breakAfter}return null}}class mt extends C{constructor(t,e,i){super();this.widget=t,this.length=e,this.type=i,this.breakAfter=0}merge(t,e,i,s,r,o){return i&&(!(i instanceof mt)||!this.widget.compare(i.widget)||t>0&&r<=0||e<this.length&&o<=0)?!1:(this.length=t+(i?i.length:0)+(this.length-e),!0)}domAtPos(t){return t==0?V.before(this.dom):V.after(this.dom,t==this.length)}split(t){let e=this.length-t;this.length=t;let i=new mt(this.widget,e,this.type);return i.breakAfter=this.breakAfter,i}get children(){return ii}sync(){(!this.dom||!this.widget.updateDOM(this.dom))&&(this.setDOM(this.widget.toDOM(this.editorView)),this.dom.contentEditable="false")}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):x.empty}domBoundsAround(){return null}become(t){return t instanceof mt&&t.type==this.type&&t.widget.constructor==this.widget.constructor?(t.widget.eq(this.widget)||this.markDirty(!0),this.widget=t.widget,this.length=t.length,this.breakAfter=t.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(t){return this.widget.ignoreEvent(t)}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class ui{constructor(t,e,i,s){this.doc=t,this.pos=e,this.end=i,this.disallowBlockEffectsBelow=s,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=t.iter(),this.skip=e}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let t=this.content[this.content.length-1];return!t.breakAfter&&!(t instanceof mt&&t.type==R.WidgetBefore)}getLine(){return this.curLine||(this.content.push(this.curLine=new j),this.atCursorPos=!0),this.curLine}flushBuffer(t){this.pendingBuffer&&(this.curLine.append(ye(new Tt(-1),t),t.length),this.pendingBuffer=0)}addBlockWidget(t){this.flushBuffer([]),this.curLine=null,this.content.push(t)}finish(t){t?this.pendingBuffer=0:this.flushBuffer([]),this.posCovered()||this.getLine()}buildText(t,e,i){for(;t>0;){if(this.textOff==this.text.length){let{value:r,lineBreak:o,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer([]),this.curLine=null,t--;continue}else this.text=r,this.textOff=0}let s=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(0,i)),this.getLine().append(ye(new dt(this.text.slice(this.textOff,this.textOff+s)),e),i),this.atCursorPos=!0,this.textOff+=s,t-=s,i=0}}span(t,e,i,s){this.buildText(e-t,i,s),this.pos=e,this.openStart<0&&(this.openStart=s)}point(t,e,i,s,r){let o=e-t;if(i instanceof gt)if(i.block){let{type:l}=i;l==R.WidgetAfter&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new mt(i.widget||new Nn("div"),o,l))}else{let l=lt.create(i.widget||new Nn("span"),o,i.startSide),a=this.atCursorPos&&!l.isEditable&&r<=s.length&&(t<e||i.startSide>0),h=!l.isEditable&&(t<e||i.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!a&&(this.pendingBuffer=0),this.flushBuffer(s),a&&(f.append(ye(new Tt(1),s),r),r=s.length+Math.max(0,r-s.length)),f.append(ye(l,s),r),this.atCursorPos=h,this.pendingBuffer=h?t<e?1:2:0}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);o&&(this.textOff+o<=this.text.length?this.textOff+=o:(this.skip+=o-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=r)}filterPoint(t,e,i,s){if(s<this.disallowBlockEffectsBelow&&i instanceof gt){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}return!0}static build(t,e,i,s,r){let o=new ui(t,e,i,r);return o.openEnd=P.spans(s,e,i,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function ye(n,t){for(let e of t)n=new pt(e,[n],n.length);return n}class Nn extends ge{constructor(t){super();this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}}const vo=[],Fn=S.define(),Hn=S.define(),jn=S.define(),Wn=S.define(),di=S.define(),zn=S.define(),pi=D.define({map:(n,t)=>n.map(t)}),qn=D.define({map:(n,t)=>n.map(t)});class Dt{constructor(t,e="nearest",i="nearest",s=5,r=5){this.range=t,this.y=e,this.x=i,this.yMargin=s,this.xMargin=r}map(t){return t.empty?this:new Dt(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const Gn=D.define({map:(n,t)=>n.map(t)});function yt(n,t,e){let i=n.facet(Wn);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)}const Ut=S.define({combine:n=>n.length?n[0]:!0});class bo{constructor(t,e){this.field=t,this.get=e}}class q{from(t){return new bo(this,t)}static define(){return new q}}q.decorations=q.define(),q.atomicRanges=q.define(),q.scrollMargins=q.define();let wo=0;const Jt=S.define();class ve{constructor(t,e,i){this.id=t,this.create=e,this.fields=i,this.extension=Jt.of(this)}static define(t,e){let{eventHandlers:i,provide:s,decorations:r}=e||{},o=[];if(s)for(let l of Array.isArray(s)?s:[s])o.push(l);return i&&o.push(Kn.from(l=>({plugin:l,handlers:i}))),r&&o.push(q.decorations.from(r)),new ve(wo++,t,o)}static fromClass(t,e){return ve.define(i=>new t(i),e)}}const Kn=q.define();class gi{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}takeField(t,e){if(this.spec)for(let{field:i,get:s}of this.spec.fields)i==t&&e.push(s(this.value))}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(yt(e.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(e){yt(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if((e=this.value)===null||e===void 0?void 0:e.destroy)try{this.value.destroy()}catch(i){yt(t.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Un=S.define(),Jn=S.define(),vt=S.define(),Yt=S.define();class it{constructor(t,e,i,s){this.fromA=t,this.toA=e,this.fromB=i,this.toB=s}join(t){return new it(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 s=t[e-1];if(!(s.fromA>i.toA)){if(s.toA<i.fromA)break;i=i.join(s),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 s=0,r=0,o=0,l=0;;s++){let a=s==t.length?null:t[s],h=o-l,f=a?a.fromB:1e9;for(;r<e.length&&e[r]<f;){let c=e[r],d=e[r+1],u=Math.max(l,c),p=Math.min(f,d);if(u<=p&&new it(u+h,p+h,u,p).addToSet(i),d>f)break;r+=2}if(!a)return i;new it(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),o=a.toA,l=a.toB}}}class Yn{constructor(t,e,i=vo){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=L.empty(this.startState.doc.length);for(let o of i)this.changes=this.changes.compose(o.changes);let s=[];this.changes.iterChangedRanges((o,l,a,h)=>s.push(new it(o,l,a,h))),this.changedRanges=s;let r=t.hasFocus;r!=t.inputState.notifiedFocused&&(t.inputState.notifiedFocused=r,this.flags|=1)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>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}}var G=function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n}(G||(G={}));const mi=G.LTR,So=G.RTL;function Xn(n){let t=[];for(let e=0;e<n.length;e++)t.push(1<<+n[e]);return t}const xo=Xn("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Ao=Xn("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),yi=Object.create(null),X=[];for(let n of["()","[]","{}"]){let t=n.charCodeAt(0),e=n.charCodeAt(1);yi[t]=e,yi[e]=-t}function ko(n){return n<=247?xo[n]:1424<=n&&n<=1524?2:1536<=n&&n<=1785?Ao[n-1536]:1774<=n&&n<=2220?4:8192<=n&&n<=8203||n==8204?256:1}const Oo=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;class Pt{constructor(t,e,i){this.from=t,this.to=e,this.level=i}get dir(){return this.level%2?So:mi}side(t,e){return this.dir==e==t?this.to:this.from}static find(t,e,i,s){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||(s!=0?s<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}}const O=[];function Co(n,t){let e=n.length,i=t==mi?1:2,s=t==mi?2:1;if(!n||i==1&&!Oo.test(n))return Zn(e);for(let o=0,l=i,a=i;o<e;o++){let h=ko(n.charCodeAt(o));h==512?h=l:h==8&&a==4&&(h=16),O[o]=h==4?2:h,h&7&&(a=h),l=h}for(let o=0,l=i,a=i;o<e;o++){let h=O[o];if(h==128)o<e-1&&l==O[o+1]&&l&24?h=O[o]=l:O[o]=256;else if(h==64){let f=o+1;for(;f<e&&O[f]==64;)f++;let c=o&&l==8||f<e&&O[f]==8?a==1?1:8:256;for(let d=o;d<f;d++)O[d]=c;o=f-1}else h==8&&a==1&&(O[o]=1);l=h,h&7&&(a=h)}for(let o=0,l=0,a=0,h,f,c;o<e;o++)if(f=yi[h=n.charCodeAt(o)])if(f<0){for(let d=l-3;d>=0;d-=3)if(X[d+1]==-f){let u=X[d+2],p=u&2?i:u&4?u&1?s:i:0;p&&(O[o]=O[X[d]]=p),l=d;break}}else{if(X.length==189)break;X[l++]=o,X[l++]=h,X[l++]=a}else if((c=O[o])==2||c==1){let d=c==i;a=d?0:1;for(let u=l-3;u>=0;u-=3){let p=X[u+2];if(p&2)break;if(d)X[u+2]|=2;else{if(p&4)break;X[u+2]|=4}}}for(let o=0;o<e;o++)if(O[o]==256){let l=o+1;for(;l<e&&O[l]==256;)l++;let a=(o?O[o-1]:i)==1,h=(l<e?O[l]:i)==1,f=a==h?a?1:2:i;for(let c=o;c<l;c++)O[c]=f;o=l-1}let r=[];if(i==1)for(let o=0;o<e;){let l=o,a=O[o++]!=1;for(;o<e&&a==(O[o]!=1);)o++;if(a)for(let h=o;h>l;){let f=h,c=O[--h]!=2;for(;h>l&&c==(O[h-1]!=2);)h--;r.push(new Pt(h,f,c?2:1))}else r.push(new Pt(l,o,0))}else for(let o=0;o<e;){let l=o,a=O[o++]==2;for(;o<e&&a==(O[o]==2);)o++;r.push(new Pt(l,o,a?1:2))}return r}function Zn(n){return[new Pt(0,n,0)]}let Qn="";function Mo(n,t,e,i,s){var r;let o=i.head-n.from,l=-1;if(o==0){if(!s||!n.length)return null;t[0].level!=e&&(o=t[0].side(!1,e),l=0)}else if(o==n.length){if(s)return null;let d=t[t.length-1];d.level!=e&&(o=d.side(!0,e),l=t.length-1)}l<0&&(l=Pt.find(t,o,(r=i.bidiLevel)!==null&&r!==void 0?r:-1,i.assoc));let a=t[l];o==a.side(s,e)&&(a=t[l+=s?1:-1],o=a.side(!s,e));let h=s==(a.dir==e),f=st(n.text,o,h);if(Qn=n.text.slice(Math.min(o,f),Math.max(o,f)),f!=a.side(s,e))return y.cursor(f+n.from,h?-1:1,a.level);let c=l==(s?t.length-1:0)?null:t[l+(s?1:-1)];return!c&&a.level!=e?y.cursor(s?n.to:n.from,s?-1:1,e):c&&c.level<a.level?y.cursor(c.side(!s,e)+n.from,s?1:-1,c.level):y.cursor(f+n.from,s?-1:1,a.level)}const at="\uFFFF";class ts{constructor(t,e){this.points=t,this.text="",this.lineSeparator=e.facet(w.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=at}readRange(t,e){if(!t)return this;let i=t.parentNode;for(let s=t;;){this.findPointBefore(i,s),this.readNode(s);let r=s.nextSibling;if(r==e)break;let o=C.get(s),l=C.get(r);(o&&l?o.breakAfter:(o?o.breakAfter:es(s))||es(r)&&(s.nodeName!="BR"||s.cmIgnore))&&this.lineBreak(),s=r}return this.findPointBefore(i,e),this}readTextNode(t){let e=t.nodeValue;for(let i of this.points)i.node==t&&(i.pos=this.text.length+Math.min(i.offset,e.length));for(let i=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,l;if(this.lineSeparator?(r=e.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=s.exec(e))&&(r=l.index,o=l[0].length),this.append(e.slice(i,r<0?e.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==t&&a.pos>this.text.length&&(a.pos-=o-1);i=r+o}}readNode(t){if(t.cmIgnore)return;let e=C.get(t),i=e&&e.overrideDOMText;if(i!=null){this.findPointInside(t,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName=="BR"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let i of this.points)i.node==t&&t.childNodes[i.offset]==e&&(i.pos=this.text.length)}findPointInside(t,e){for(let i of this.points)(t.nodeType==3?i.node==t:t.contains(i.node))&&(i.pos=this.text.length+Math.min(e,i.offset))}}function es(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}class is{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class ns extends C{constructor(t){super();this.view=t,this.compositionDeco=N.none,this.decorations=[],this.pluginDecorationLength=0,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new j],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new it(0,0,0,t.state.doc.length)],0)}get root(){return this.view.root}get editorView(){return this.view}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.every(({fromA:o,toA:l})=>l<this.minWidthFrom||o>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.view.inputState.composing<0?this.compositionDeco=N.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=Do(this.view,t.changes)),(v.ie||v.chrome)&&!this.compositionDeco.size&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,s=this.updateDeco(),r=Eo(i,s,t.changes);return e=it.extendWithRanges(e,r),this.dirty==0&&e.length==0?!1:(this.updateInner(e,t.startState.doc.length),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e);let{observer:i}=this.view;i.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.minWidth=this.minWidth?this.minWidth+"px":"";let r=v.chrome||v.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(r),this.dirty=0,r&&(r.written||i.selectionRange.focusNode!=r.node)&&(this.forceSelection=!0),this.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let r of this.children)r instanceof mt&&r.widget instanceof ss&&s.push(r.dom);i.updateGaps(s)}updateChildren(t,e){let i=this.childCursor(e);for(let s=t.length-1;;s--){let r=s>=0?t[s]:null;if(!r)break;let{fromA:o,toA:l,fromB:a,toB:h}=r,{content:f,breakAtStart:c,openStart:d,openEnd:u}=ui.build(this.view.state.doc,a,h,this.decorations,this.pluginDecorationLength),{i:p,off:g}=i.findPos(l,1),{i:m,off:b}=i.findPos(o,-1);Mn(this,m,b,p,g,f,c,d,u)}}updateSelection(t=!1,e=!1){if(t&&this.view.observer.readSelectionRange(),!(e||this.mayControlSelection())||v.ios&&this.view.inputState.rapidCompositionStart)return;let i=this.forceSelection;this.forceSelection=!1;let s=this.view.state.selection.main,r=this.domAtPos(s.anchor),o=s.empty?r:this.domAtPos(s.head);if(v.gecko&&s.empty&&To(r)){let a=document.createTextNode("");this.view.observer.ignore(()=>r.node.insertBefore(a,r.node.childNodes[r.offset]||null)),r=o=new V(a,0),i=!0}let l=this.view.observer.selectionRange;(i||!l.focusNode||!ce(r.node,r.offset,l.anchorNode,l.anchorOffset)||!ce(o.node,o.offset,l.focusNode,l.focusOffset))&&(this.view.observer.ignore(()=>{v.android&&v.chrome&&this.dom.contains(l.focusNode)&&_o(l.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let a=fe(this.root);if(s.empty){if(v.gecko){let h=Ro(r.node,r.offset);if(h&&h!=3){let f=os(r.node,r.offset,h==1?1:-1);f&&(r=new V(f,h==1?0:f.nodeValue.length))}}a.collapse(r.node,r.offset),s.bidiLevel!=null&&l.cursorBidiLevel!=null&&(l.cursorBidiLevel=s.bidiLevel)}else if(a.extend)a.collapse(r.node,r.offset),a.extend(o.node,o.offset);else{let h=document.createRange();s.anchor>s.head&&([r,o]=[o,r]),h.setEnd(o.node,o.offset),h.setStart(r.node,r.offset),a.removeAllRanges(),a.addRange(h)}}),this.view.observer.setSelectionRange(r,o)),this.impreciseAnchor=r.precise?null:new V(l.anchorNode,l.anchorOffset),this.impreciseHead=o.precise?null:new V(l.focusNode,l.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let t=this.view.state.selection.main,e=fe(this.root);if(!t.empty||!t.assoc||!e.modify)return;let i=j.find(this,t.head);if(!i)return;let s=i.posAtStart;if(t.head==s||t.head==s+i.length)return;let r=this.coordsAt(t.head,-1),o=this.coordsAt(t.head,1);if(!r||!o||r.bottom>o.top)return;let l=this.domAtPos(t.head+t.assoc);e.collapse(l.node,l.offset),e.modify("move",t.assoc<0?"forward":"backward","lineboundary")}mayControlSelection(){return this.view.state.facet(Ut)?this.root.activeElement==this.dom:ti(this.dom,this.view.observer.selectionRange)}nearest(t){for(let e=t;e;){let i=C.get(e);if(i&&i.rootView==this)return i;e=e.parentNode}return null}posFromDOM(t,e){let i=this.nearest(t);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(t,e)+i.posAtStart}domAtPos(t){let{i:e,off:i}=this.childCursor().findPos(t,-1);for(;e<this.children.length-1;){let s=this.children[e];if(i<s.length||s instanceof j)break;e++,i=0}return this.children[e].domAtPos(i)}coordsAt(t,e){for(let i=this.length,s=this.children.length-1;;s--){let r=this.children[s],o=i-r.breakAfter-r.length;if(t>o||t==o&&r.type!=R.WidgetBefore&&r.type!=R.WidgetAfter&&(!s||e==2||this.children[s-1].breakAfter||this.children[s-1].type==R.WidgetBefore&&e>-2))return r.coordsAt(t-o,e);i=o}}measureVisibleLineHeights(){let t=[],{from:e,to:i}=this.view.viewState.viewport,s=this.view.contentDOM.clientWidth,r=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1;for(let l=0,a=0;a<this.children.length;a++){let h=this.children[a],f=l+h.length;if(f>i)break;if(l>=e){let c=h.dom.getBoundingClientRect();if(t.push(c.height),r){let d=h.dom.lastChild,u=d?Ct(d):[];if(u.length){let p=u[u.length-1],g=this.view.textDirection==G.LTR?p.right-c.left:c.right-p.left;g>o&&(o=g,this.minWidth=s,this.minWidthFrom=l,this.minWidthTo=f)}}}l=f+h.breakAfter}return t}measureTextSize(){for(let s of this.children)if(s instanceof j){let r=s.measureTextSize();if(r)return r}let t=document.createElement("div"),e,i;return t.className="cm-line",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(t);let s=Ct(t.firstChild)[0];e=t.getBoundingClientRect().height,i=s?s.width/27:7,t.remove()}),{lineHeight:e,charWidth:i}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new Cn(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let i=0,s=0;;s++){let r=s==e.viewports.length?null:e.viewports[s],o=r?r.from-1:this.length;if(o>i){let l=e.lineBlockAt(o).bottom-e.lineBlockAt(i).top;t.push(N.replace({widget:new ss(l),block:!0,inclusive:!0}).range(i,o))}if(!r)break;i=r.to+1}return N.set(t)}updateDeco(){let t=this.view.pluginField(q.decorations);return this.pluginDecorationLength=t.length,this.decorations=[...t,...this.view.state.facet(vt),this.compositionDeco,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco]}scrollIntoView(t){let{range:e}=t,i=this.coordsAt(e.head,e.empty?e.assoc:e.head>e.anchor?-1:1),s;if(!i)return;!e.empty&&(s=this.coordsAt(e.anchor,e.anchor>e.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let r=0,o=0,l=0,a=0;for(let f of this.view.pluginField(q.scrollMargins))if(f){let{left:c,right:d,top:u,bottom:p}=f;c!=null&&(r=Math.max(r,c)),d!=null&&(o=Math.max(o,d)),u!=null&&(l=Math.max(l,u)),p!=null&&(a=Math.max(a,p))}let h={left:i.left-r,top:i.top-l,right:i.right+o,bottom:i.bottom+a};co(this.view.scrollDOM,h,e.head<e.anchor?-1:1,t.x,t.y,t.xMargin,t.yMargin,this.view.textDirection==G.LTR)}}function To(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")}class ss extends ge{constructor(t){super();this.height=t}toDOM(){let t=document.createElement("div");return this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}}function rs(n){let t=n.observer.selectionRange,e=t.focusNode&&os(t.focusNode,t.focusOffset,0);if(!e)return null;let i=n.docView.nearest(e);if(!i)return null;if(i instanceof j){let s=e;for(;s.parentNode!=i.dom;)s=s.parentNode;let r=s.previousSibling;for(;r&&!C.get(r);)r=r.previousSibling;let o=r?C.get(r).posAtEnd:i.posAtStart;return{from:o,to:o,node:s,text:e}}else{for(;;){let{parent:r}=i;if(!r)return null;if(r instanceof j)break;i=r}let s=i.posAtStart;return{from:s,to:s+i.length,node:i.dom,text:e}}}function Do(n,t){let e=rs(n);if(!e)return N.none;let{from:i,to:s,node:r,text:o}=e,l=t.mapPos(i,1),a=Math.max(l,t.mapPos(s,-1)),{state:h}=n,f=r.nodeType==3?r.nodeValue:new ts([],h).readRange(r.firstChild,null).text;if(a-l<f.length)if(h.doc.sliceString(l,Math.min(h.doc.length,l+f.length),at)==f)a=l+f.length;else if(h.doc.sliceString(Math.max(0,a-f.length),a,at)==f)l=a-f.length;else return N.none;else if(h.doc.sliceString(l,a,at)!=f)return N.none;return N.set(N.replace({widget:new Po(r,o)}).range(l,a))}class Po extends ge{constructor(t,e){super();this.top=t,this.text=e}eq(t){return this.top==t.top&&this.text==t.text}toDOM(){return this.top}ignoreEvent(){return!1}get customView(){return mo}}function os(n,t,e){for(;;){if(n.nodeType==3)return n;if(n.nodeType==1&&t>0&&e<=0)n=n.childNodes[t-1],t=ue(n);else if(n.nodeType==1&&t<n.childNodes.length&&e>=0)n=n.childNodes[t],t=0;else return null}}function Ro(n,t){return n.nodeType!=1?0:(t&&n.childNodes[t-1].contentEditable=="false"?1:0)|(t<n.childNodes.length&&n.childNodes[t].contentEditable=="false"?2:0)}class Bo{constructor(){this.changes=[]}compareRange(t,e){ci(t,e,this.changes)}comparePoint(t,e){ci(t,e,this.changes)}}function Eo(n,t,e){let i=new Bo;return P.compare(n,t,e,i),i.changes}function _o(n,t){for(let e=n;e&&e!=t;e=e.assignedSlot||e.parentNode)if(e.nodeType==1&&e.contentEditable=="false")return!0;return!1}function Lo(n,t,e=1){let i=n.charCategorizer(t),s=n.doc.lineAt(t),r=t-s.from;if(s.length==0)return y.cursor(t);r==0?e=1:r==s.length&&(e=-1);let o=r,l=r;e<0?o=st(s.text,r,!1):l=st(s.text,r);let a=i(s.text.slice(o,l));for(;o>0;){let h=st(s.text,o,!1);if(i(s.text.slice(h,o))!=a)break;o=h}for(;l<s.length;){let h=st(s.text,l);if(i(s.text.slice(l,h))!=a)break;l=h}return y.range(o+s.from,l+s.from)}function Io(n,t){return t.left>n?t.left-n:Math.max(0,n-t.right)}function $o(n,t){return t.top>n?t.top-n:Math.max(0,n-t.bottom)}function vi(n,t){return n.top<t.bottom-1&&n.bottom>t.top+1}function ls(n,t){return t<n.top?{top:t,left:n.left,right:n.right,bottom:n.bottom}:n}function as(n,t){return t>n.bottom?{top:n.top,left:n.left,right:n.right,bottom:t}:n}function bi(n,t,e){let i,s,r,o,l,a,h,f;for(let u=n.firstChild;u;u=u.nextSibling){let p=Ct(u);for(let g=0;g<p.length;g++){let m=p[g];s&&vi(s,m)&&(m=ls(as(m,s.bottom),s.top));let b=Io(t,m),E=$o(e,m);if(b==0&&E==0)return u.nodeType==3?hs(u,t,e):bi(u,t,e);(!i||o>E||o==E&&r>b)&&(i=u,s=m,r=b,o=E),b==0?e>m.bottom&&(!h||h.bottom<m.bottom)?(l=u,h=m):e<m.top&&(!f||f.top>m.top)&&(a=u,f=m):h&&vi(h,m)?h=as(h,m.bottom):f&&vi(f,m)&&(f=ls(f,m.top))}}if(h&&h.bottom>=e?(i=l,s=h):f&&f.top<=e&&(i=a,s=f),!i)return{node:n,offset:0};let c=Math.max(s.left,Math.min(s.right,t));if(i.nodeType==3)return hs(i,c,e);if(!r&&i.contentEditable=="true")return bi(i,c,e);let d=Array.prototype.indexOf.call(n.childNodes,i)+(t>=(s.left+s.right)/2?1:0);return{node:n,offset:d}}function hs(n,t,e){let i=n.nodeValue.length,s=-1,r=1e9,o=0;for(let l=0;l<i;l++){let a=qt(n,l,l+1).getClientRects();for(let h=0;h<a.length;h++){let f=a[h];if(f.top==f.bottom)continue;o||(o=t-f.left);let c=(f.top>e?f.top-e:e-f.bottom)-1;if(f.left-1<=t&&f.right+1>=t&&c<r){let d=t>=(f.left+f.right)/2,u=d;if((v.chrome||v.gecko)&&qt(n,l).getBoundingClientRect().left==f.right&&(u=!d),c<=0)return{node:n,offset:l+(u?1:0)};s=l+(u?1:0),r=c}}}return{node:n,offset:s>-1?s:o>0?n.nodeValue.length:0}}function fs(n,{x:t,y:e},i,s=-1){var r;let o=n.contentDOM.getBoundingClientRect(),l=o.top+n.viewState.paddingTop,a,{docHeight:h}=n.viewState,f=e-l;if(f<0)return 0;if(f>h)return n.state.doc.length;for(let b=n.defaultLineHeight/2,E=!1;a=n.elementAtHeight(f),a.type!=R.Text;)for(;f=s>0?a.bottom+b:a.top-b,!(f>=0&&f<=h);){if(E)return i?null:0;E=!0,s=-s}e=l+f;let c=a.from;if(c<n.viewport.from)return n.viewport.from==0?0:i?null:cs(n,o,a,t,e);if(c>n.viewport.to)return n.viewport.to==n.state.doc.length?n.state.doc.length:i?null:cs(n,o,a,t,e);let d=n.dom.ownerDocument,u=n.root.elementFromPoint?n.root:d,p=u.elementFromPoint(t,e);p&&!n.contentDOM.contains(p)&&(p=null),p||(t=Math.max(o.left+1,Math.min(o.right-1,t)),p=u.elementFromPoint(t,e),p&&!n.contentDOM.contains(p)&&(p=null));let g,m=-1;if(p&&((r=n.docView.nearest(p))===null||r===void 0?void 0:r.isEditable)!=!1){if(d.caretPositionFromPoint){let b=d.caretPositionFromPoint(t,e);b&&({offsetNode:g,offset:m}=b)}else if(d.caretRangeFromPoint){let b=d.caretRangeFromPoint(t,e);b&&({startContainer:g,startOffset:m}=b,v.safari&&Vo(g,m,t)&&(g=void 0))}}if(!g||!n.docView.dom.contains(g)){let b=j.find(n.docView,c);if(!b)return f>a.top+a.height/2?a.to:a.from;({node:g,offset:m}=bi(b.dom,t,e))}return n.docView.posFromDOM(g,m)}function cs(n,t,e,i,s){let r=Math.round((i-t.left)*n.defaultCharacterWidth);n.lineWrapping&&e.height>n.defaultLineHeight*1.5&&(r+=Math.floor((s-e.top)/n.defaultLineHeight)*n.viewState.heightOracle.lineLength);let o=n.state.sliceDoc(e.from,e.to);return e.from+Wr(o,r,n.state.tabSize)}function Vo(n,t,e){let i;if(n.nodeType!=3||t!=(i=n.nodeValue.length))return!1;for(let s=n.nextSibling;s;s=s.nextSibling)if(s.nodeType!=1||s.nodeName!="BR")return!1;return qt(n,i-1,i).getBoundingClientRect().left>e}function No(n,t,e,i){let s=n.state.doc.lineAt(t.head),r=!i||!n.lineWrapping?null:n.coordsAtPos(t.assoc<0&&t.head>s.from?t.head-1:t.head);if(r){let a=n.dom.getBoundingClientRect(),h=n.posAtCoords({x:e==(n.textDirection==G.LTR)?a.right-1:a.left+1,y:(r.top+r.bottom)/2});if(h!=null)return y.cursor(h,e?-1:1)}let o=j.find(n.docView,t.head),l=o?e?o.posAtEnd:o.posAtStart:e?s.to:s.from;return y.cursor(l,e?-1:1)}function us(n,t,e,i){let s=n.state.doc.lineAt(t.head),r=n.bidiSpans(s);for(let o=t,l=null;;){let a=Mo(s,r,n.textDirection,o,e),h=Qn;if(!a){if(s.number==(e?n.state.doc.lines:1))return o;h=`
12
- `,s=n.state.doc.line(s.number+(e?1:-1)),r=n.bidiSpans(s),a=y.cursor(e?s.from:s.to)}if(l){if(!l(h))return o}else{if(!i)return a;l=i(h)}o=a}}function Fo(n,t,e){let i=n.state.charCategorizer(t),s=i(e);return r=>{let o=i(r);return s==et.Space&&(s=o),s==o}}function Ho(n,t,e,i){let s=t.head,r=e?1:-1;if(s==(e?n.state.doc.length:0))return y.cursor(s,t.assoc);let o=t.goalColumn,l,a=n.contentDOM.getBoundingClientRect(),h=n.coordsAtPos(s),f=n.documentTop;if(h)o==null&&(o=h.left-a.left),l=r<0?h.top:h.bottom;else{let u=n.viewState.lineBlockAt(s-f);o==null&&(o=Math.min(a.right-a.left,n.defaultCharacterWidth*(s-u.from))),l=(r<0?u.top:u.bottom)+f}let c=a.left+o,d=i??n.defaultLineHeight>>1;for(let u=0;;u+=10){let p=l+(d+u)*r,g=fs(n,{x:c,y:p},!1,r);if(p<a.top||p>a.bottom||(r<0?g<s:g>s))return y.cursor(g,t.assoc,void 0,o)}}function wi(n,t,e){let i=n.pluginField(q.atomicRanges);for(;;){let s=!1;for(let r of i)r.between(e.from-1,e.from+1,(o,l,a)=>{e.from>o&&e.from<l&&(e=t.from>e.from?y.cursor(o,1):y.cursor(l,-1),s=!0)});if(!s)return e}}class jo{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.rapidCompositionStart=!1,this.mouseSelection=null;for(let e in B){let i=B[e];t.contentDOM.addEventListener(e,s=>{e=="keydown"&&this.keydown(t,s)||!ps(t,s)||this.ignoreDuringComposition(s)||(this.mustFlushObserver(s)&&t.observer.forceFlush(),this.runCustomHandlers(e,t,s)?s.preventDefault():i(t,s))}),this.registeredEvents.push(e)}this.notifiedFocused=t.hasFocus,this.ensureHandlers(t),v.safari&&t.contentDOM.addEventListener("input",()=>null)}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}ensureHandlers(t){let e=this.customHandlers=t.pluginField(Kn);for(let i of e)for(let s in i.handlers)this.registeredEvents.indexOf(s)<0&&s!="scroll"&&(this.registeredEvents.push(s),t.contentDOM.addEventListener(s,r=>{!ps(t,r)||this.runCustomHandlers(s,t,r)&&r.preventDefault()}))}runCustomHandlers(t,e,i){for(let s of this.customHandlers){let r=s.handlers[t];if(r)try{if(r.call(s.plugin,i,e)||i.defaultPrevented)return!0}catch(o){yt(e.state,o)}}return!1}runScrollHandlers(t,e){for(let i of this.customHandlers){let s=i.handlers.scroll;if(s)try{s.call(i.plugin,e,t)}catch(r){yt(t.state,r)}}}keydown(t,e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),this.screenKeyEvent(t,e))return!0;if(v.android&&v.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return t.observer.delayAndroidKey(e.key,e.keyCode),!0;let i;return v.ios&&(i=ds.find(s=>s.keyCode==e.keyCode))&&!(e.ctrlKey||e.altKey||e.metaKey)&&!e.synthetic?(this.pendingIOSKey=i,setTimeout(()=>this.flushIOSKey(t),250),!0):!1}flushIOSKey(t){let e=this.pendingIOSKey;return e?(this.pendingIOSKey=void 0,Gt(t.contentDOM,e.key,e.keyCode)):!1}ignoreDuringComposition(t){return/^key/.test(t.type)?this.composing>0?!0:v.safari&&Date.now()-this.compositionEndedAt<500?(this.compositionEndedAt=0,!0):!1:!1}screenKeyEvent(t,e){let i=e.keyCode==9&&Date.now()<this.lastEscPress+2e3;return e.keyCode==27?this.lastEscPress=Date.now():Wo.indexOf(e.keyCode)<0&&(this.lastEscPress=0),i}mustFlushObserver(t){return t.type=="keydown"&&t.keyCode!=229||t.type=="compositionend"&&!v.ios}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.mouseSelection&&this.mouseSelection.update(t),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}const ds=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Wo=[16,17,18,20,91,92,224,225];class zo{constructor(t,e,i,s){this.view=t,this.style=i,this.mustSelect=s,this.lastEvent=e;let r=t.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(w.allowMultipleSelections)&&qo(t,e),this.dragMove=Go(t,e),this.dragging=Ko(t,e)&&Si(e)==1?null:!1,this.dragging===!1&&(e.preventDefault(),this.select(e))}move(t){if(t.buttons==0)return this.destroy();this.dragging===!1&&this.select(this.lastEvent=t)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}select(t){let e=this.style.get(t,this.extend,this.multiple);(this.mustSelect||!e.eq(this.view.state.selection)||e.main.assoc!=this.view.state.selection.main.assoc)&&this.view.dispatch({selection:e,userEvent:"select.pointer",scrollIntoView:!0}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}function qo(n,t){let e=n.state.facet(Fn);return e.length?e[0](t):v.mac?t.metaKey:t.ctrlKey}function Go(n,t){let e=n.state.facet(Hn);return e.length?e[0](t):v.mac?!t.altKey:!t.ctrlKey}function Ko(n,t){let{main:e}=n.state.selection;if(e.empty)return!1;let i=fe(n.root);if(i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let r=0;r<s.length;r++){let o=s[r];if(o.left<=t.clientX&&o.right>=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function ps(n,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target,i;e!=n.contentDOM;e=e.parentNode)if(!e||e.nodeType==11||(i=C.get(e))&&i.ignoreEvent(t))return!1;return!0}const B=Object.create(null),gs=v.ie&&v.ie_version<15||v.ios&&v.webkit_version<604;function Uo(n){let t=n.dom.parentNode;if(!t)return;let e=t.appendChild(document.createElement("textarea"));e.style.cssText="position: fixed; left: -10000px; top: 10px",e.focus(),setTimeout(()=>{n.focus(),e.remove(),ms(n,e.value)},50)}function ms(n,t){let{state:e}=n,i,s=1,r=e.toText(t),o=r.lines==e.selection.ranges.length;if(xi!=null&&e.selection.ranges.every(a=>a.empty)&&xi==r.toString()){let a=-1;i=e.changeByRange(h=>{let f=e.doc.lineAt(h.from);if(f.from==a)return{range:h};a=f.from;let c=e.toText((o?r.line(s++).text:t)+e.lineBreak);return{changes:{from:f.from,insert:c},range:y.cursor(h.from+c.length)}})}else o?i=e.changeByRange(a=>{let h=r.line(s++);return{changes:{from:a.from,to:a.to,insert:h.text},range:y.cursor(a.from+h.length)}}):i=e.replaceSelection(r);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}B.keydown=(n,t)=>{n.inputState.setSelectionOrigin("select")};let ys=0;B.touchstart=(n,t)=>{ys=Date.now(),n.inputState.setSelectionOrigin("select.pointer")},B.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")},B.mousedown=(n,t)=>{if(n.observer.flush(),ys>Date.now()-2e3&&Si(t)==1)return;let e=null;for(let i of n.state.facet(jn))if(e=i(n,t),e)break;if(!e&&t.button==0&&(e=Xo(n,t)),e){let i=n.root.activeElement!=n.contentDOM;i&&n.observer.ignore(()=>xn(n.contentDOM)),n.inputState.startMouseSelection(new zo(n,t,e,i))}};function vs(n,t,e,i){if(i==1)return y.cursor(t,e);if(i==2)return Lo(n.state,t,e);{let s=j.find(n.docView,t),r=n.state.doc.lineAt(s?s.posAtEnd:t),o=s?s.posAtStart:r.from,l=s?s.posAtEnd:r.to;return l<n.state.doc.length&&l==r.to&&l++,y.range(o,l)}}let bs=(n,t)=>n>=t.top&&n<=t.bottom,ws=(n,t,e)=>bs(t,e)&&n>=e.left&&n<=e.right;function Jo(n,t,e,i){let s=j.find(n.docView,t);if(!s)return 1;let r=t-s.posAtStart;if(r==0)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&ws(e,i,o))return-1;let l=s.coordsAt(r,1);return l&&ws(e,i,l)?1:o&&bs(i,o)?-1:1}function Ss(n,t){let e=n.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:e,bias:Jo(n,e,t.clientX,t.clientY)}}const Yo=v.ie&&v.ie_version<=11;let xs=null,As=0,ks=0;function Si(n){if(!Yo)return n.detail;let t=xs,e=ks;return xs=n,ks=Date.now(),As=!t||e>Date.now()-400&&Math.abs(t.clientX-n.clientX)<2&&Math.abs(t.clientY-n.clientY)<2?(As+1)%3:1}function Xo(n,t){let e=Ss(n,t),i=Si(t),s=n.state.selection,r=e,o=t;return{update(l){l.docChanged&&(e&&(e.pos=l.changes.mapPos(e.pos)),s=s.map(l.changes),o=null)},get(l,a,h){let f;if(o&&l.clientX==o.clientX&&l.clientY==o.clientY?f=r:(f=r=Ss(n,l),o=l),!f||!e)return s;let c=vs(n,f.pos,f.bias,i);if(e.pos!=f.pos&&!a){let d=vs(n,e.pos,e.bias,i),u=Math.min(d.from,c.from),p=Math.max(d.to,c.to);c=u<c.from?y.range(u,p):y.range(p,u)}return a?s.replaceRange(s.main.extend(c.from,c.to)):h?s.addRange(c):y.create([c])}}}B.dragstart=(n,t)=>{let{selection:{main:e}}=n.state,{mouseSelection:i}=n.inputState;i&&(i.dragging=e),t.dataTransfer&&(t.dataTransfer.setData("Text",n.state.sliceDoc(e.from,e.to)),t.dataTransfer.effectAllowed="copyMove")};function Os(n,t,e,i){if(!e)return;let s=n.posAtCoords({x:t.clientX,y:t.clientY},!1);t.preventDefault();let{mouseSelection:r}=n.inputState,o=i&&r&&r.dragging&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,l={from:s,insert:e},a=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:a,selection:{anchor:a.mapPos(s,-1),head:a.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}B.drop=(n,t)=>{if(!t.dataTransfer)return;if(n.state.readOnly)return t.preventDefault();let e=t.dataTransfer.files;if(e&&e.length){t.preventDefault();let i=Array(e.length),s=0,r=()=>{++s==e.length&&Os(n,t,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o<e.length;o++){let l=new FileReader;l.onerror=r,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),r()},l.readAsText(e[o])}}else Os(n,t,t.dataTransfer.getData("Text"),!0)},B.paste=(n,t)=>{if(n.state.readOnly)return t.preventDefault();n.observer.flush();let e=gs?null:t.clipboardData;e?(ms(n,e.getData("text/plain")),t.preventDefault()):Uo(n)};function Zo(n,t){let e=n.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function Qo(n){let t=[],e=[],i=!1;for(let s of n.selection.ranges)s.empty||(t.push(n.sliceDoc(s.from,s.to)),e.push(s));if(!t.length){let s=-1;for(let{from:r}of n.selection.ranges){let o=n.doc.lineAt(r);o.number>s&&(t.push(o.text),e.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),s=o.number}i=!0}return{text:t.join(n.lineBreak),ranges:e,linewise:i}}let xi=null;B.copy=B.cut=(n,t)=>{let{text:e,ranges:i,linewise:s}=Qo(n.state);if(!e&&!s)return;xi=s?e:null;let r=gs?null:t.clipboardData;r?(t.preventDefault(),r.clearData(),r.setData("text/plain",e)):Zo(n,e),t.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"})},B.focus=B.blur=n=>{setTimeout(()=>{n.hasFocus!=n.inputState.notifiedFocused&&n.update([])},10)},B.beforeprint=n=>{n.viewState.printing=!0,n.requestMeasure(),setTimeout(()=>{n.viewState.printing=!1,n.requestMeasure()},2e3)};function Cs(n,t){if(n.docView.compositionDeco.size){n.inputState.rapidCompositionStart=t;try{n.update([])}finally{n.inputState.rapidCompositionStart=!1}}}B.compositionstart=B.compositionupdate=n=>{n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0,n.docView.compositionDeco.size&&(n.observer.flush(),Cs(n,!0)))},B.compositionend=n=>{n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionFirstChange=null,setTimeout(()=>{n.inputState.composing<0&&Cs(n,!1)},50)},B.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()},B.beforeinput=(n,t)=>{var e;let i;if(v.chrome&&v.android&&(i=ds.find(s=>s.inputType==t.inputType))&&(n.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((e=window.visualViewport)===null||e===void 0?void 0:e.height)||0;setTimeout(()=>{var r;(((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0)>s+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}};const Ms=["pre-wrap","normal","pre-line","break-spaces"];class tl{constructor(){this.doc=x.empty,this.lineWrapping=!1,this.direction=G.LTR,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.lineLength=30,this.heightChanged=!1}heightForGap(t,e){let i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength)),this.lineHeight*i}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForStyle(t,e){return Ms.indexOf(t)>-1!=this.lineWrapping||this.direction!=e}mustRefreshForHeights(t){let e=!1;for(let i=0;i<t.length;i++){let s=t[i];s<0?i++:this.heightSamples[Math.floor(s*10)]||(e=!0,this.heightSamples[Math.floor(s*10)]=!0)}return e}refresh(t,e,i,s,r,o){let l=Ms.indexOf(t)>-1,a=Math.round(i)!=Math.round(this.lineHeight)||this.lineWrapping!=l||this.direction!=e;if(this.lineWrapping=l,this.direction=e,this.lineHeight=i,this.charWidth=s,this.lineLength=r,a){this.heightSamples={};for(let h=0;h<o.length;h++){let f=o[h];f<0?h++:this.heightSamples[Math.floor(f*10)]=!0}}return a}}class el{constructor(t,e){this.from=t,this.heights=e,this.index=0}get more(){return this.index<this.heights.length}}class nt{constructor(t,e,i,s,r){this.from=t,this.length=e,this.top=i,this.height=s,this.type=r}get to(){return this.from+this.length}get bottom(){return this.top+this.height}join(t){let e=(Array.isArray(this.type)?this.type:[this]).concat(Array.isArray(t.type)?t.type:[t]);return new nt(this.from,this.length+t.length,this.top,this.height+t.height,e)}moveY(t){return t?new nt(this.from,this.length,this.top+t,this.height,Array.isArray(this.type)?this.type.map(e=>e.moveY(t)):this.type):this}}var A=function(n){return n[n.ByPos=0]="ByPos",n[n.ByHeight=1]="ByHeight",n[n.ByPosNoHeight=2]="ByPosNoHeight",n}(A||(A={}));const be=.001;class W{constructor(t,e,i=2){this.length=t,this.height=e,this.flags=i}get outdated(){return(this.flags&2)>0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>be&&(t.heightChanged=!0),this.height=e)}replace(t,e,i){return W.of(i)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,s){let r=this;for(let o=s.length-1;o>=0;o--){let{fromA:l,toA:a,fromB:h,toB:f}=s[o],c=r.lineAt(l,A.ByPosNoHeight,e,0,0),d=c.to>=a?c:r.lineAt(a,A.ByPosNoHeight,e,0,0);for(f+=d.to-a,a=d.to;o>0&&c.from<=s[o-1].toA;)l=s[o-1].fromA,h=s[o-1].fromB,o--,l<c.from&&(c=r.lineAt(l,A.ByPosNoHeight,e,0,0));h+=c.from-l,l=c.from;let u=Ai.build(i,t,h,f);r=r.replace(l,a,u)}return r.updateHeight(i,0)}static empty(){return new K(0,0)}static of(t){if(t.length==1)return t[0];let e=0,i=t.length,s=0,r=0;for(;;)if(e==i)if(s>r*2){let l=t[e-1];l.break?t.splice(--e,1,l.left,null,l.right):t.splice(--e,1,l.left,l.right),i+=1+l.break,s-=l.size}else if(r>s*2){let l=t[i];l.break?t.splice(i,1,l.left,null,l.right):t.splice(i,1,l.left,l.right),i+=2+l.break,r-=l.size}else break;else if(s<r){let l=t[e++];l&&(s+=l.size)}else{let l=t[--i];l&&(r+=l.size)}let o=0;return t[e-1]==null?(o=1,e--):t[e]==null&&(o=1,i++),new il(W.of(t.slice(0,e)),o,W.of(t.slice(i)))}}W.prototype.size=1;class Ts extends W{constructor(t,e,i){super(t,e);this.type=i}blockAt(t,e,i,s){return new nt(s,this.length,i,this.height,this.type)}lineAt(t,e,i,s,r){return this.blockAt(0,i,s,r)}forEachLine(t,e,i,s,r,o){o(this.blockAt(0,i,s,r))}updateHeight(t,e=0,i=!1,s){return s&&s.from<=e&&s.more&&this.setHeight(t,s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class K extends Ts{constructor(t,e){super(t,e,R.Text);this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let s=i[0];return i.length==1&&(s instanceof K||s instanceof $&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof $?s=new K(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):W.of(i)}updateHeight(t,e=0,i=!1,s){return s&&s.from<=e&&s.more?this.setHeight(t,s.heights[s.index++]):(i||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class $ extends W{constructor(t){super(t,0)}lines(t,e){let i=t.lineAt(e).number,s=t.lineAt(e+this.length).number;return{firstLine:i,lastLine:s,lineHeight:this.height/(s-i+1)}}blockAt(t,e,i,s){let{firstLine:r,lastLine:o,lineHeight:l}=this.lines(e,s),a=Math.max(0,Math.min(o-r,Math.floor((t-i)/l))),{from:h,length:f}=e.line(r+a);return new nt(h,f,i+l*a,l,R.Text)}lineAt(t,e,i,s,r){if(e==A.ByHeight)return this.blockAt(t,i,s,r);if(e==A.ByPosNoHeight){let{from:c,to:d}=i.lineAt(t);return new nt(c,d-c,0,0,R.Text)}let{firstLine:o,lineHeight:l}=this.lines(i,r),{from:a,length:h,number:f}=i.lineAt(t);return new nt(a,h,s+l*(f-o),l,R.Text)}forEachLine(t,e,i,s,r,o){let{firstLine:l,lineHeight:a}=this.lines(i,r);for(let h=Math.max(t,r),f=Math.min(r+this.length,e);h<=f;){let c=i.lineAt(h);h==t&&(s+=a*(c.number-l)),o(new nt(c.from,c.length,s,a,R.Text)),s+=a,h=c.to+1}}replace(t,e,i){let s=this.length-e;if(s>0){let r=i[i.length-1];r instanceof $?i[i.length-1]=new $(r.length+s):i.push(null,new $(s-1))}if(t>0){let r=i[0];r instanceof $?i[0]=new $(t+r.length):i.unshift(new $(t-1),null)}return W.of(i)}decomposeLeft(t,e){e.push(new $(t-1),null)}decomposeRight(t,e){e.push(null,new $(this.length-t-1))}updateHeight(t,e=0,i=!1,s){let r=e+this.length;if(s&&s.from<=e+this.length&&s.more){let o=[],l=Math.max(e,s.from),a=-1,h=t.heightChanged;for(s.from>e&&o.push(new $(s.from-e-1).updateHeight(t,e));l<=r&&s.more;){let c=t.doc.lineAt(l).length;o.length&&o.push(null);let d=s.heights[s.index++];a==-1?a=d:Math.abs(d-a)>=be&&(a=-2);let u=new K(c,d);u.outdated=!1,o.push(u),l+=c+1}l<=r&&o.push(null,new $(r-l).updateHeight(t,l));let f=W.of(o);return t.heightChanged=h||a<0||Math.abs(f.height-this.height)>=be||Math.abs(a-this.lines(t.doc,e).lineHeight)>=be,f}else(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class il extends W{constructor(t,e,i){super(t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0));this.left=t,this.right=i,this.size=t.size+i.size}get break(){return this.flags&1}blockAt(t,e,i,s){let r=i+this.left.height;return t<r?this.left.blockAt(t,e,i,s):this.right.blockAt(t,e,r,s+this.left.length+this.break)}lineAt(t,e,i,s,r){let o=s+this.left.height,l=r+this.left.length+this.break,a=e==A.ByHeight?t<o:t<l,h=a?this.left.lineAt(t,e,i,s,r):this.right.lineAt(t,e,i,o,l);if(this.break||(a?h.to<l:h.from>l))return h;let f=e==A.ByPosNoHeight?A.ByPosNoHeight:A.ByPos;return a?h.join(this.right.lineAt(l,f,i,o,l)):this.left.lineAt(l,f,i,s,r).join(h)}forEachLine(t,e,i,s,r,o){let l=s+this.left.height,a=r+this.left.length+this.break;if(this.break)t<a&&this.left.forEachLine(t,e,i,s,r,o),e>=a&&this.right.forEachLine(t,e,i,l,a,o);else{let h=this.lineAt(a,A.ByPos,i,s,r);t<h.from&&this.left.forEachLine(t,h.from-1,i,s,r,o),h.to>=t&&h.from<=e&&o(h),e>h.to&&this.right.forEachLine(h.to+1,e,i,l,a,o)}}replace(t,e,i){let s=this.left.length+this.break;if(e<s)return this.balanced(this.left.replace(t,e,i),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-s,e-s,i));let r=[];t>0&&this.decomposeLeft(t,r);let o=r.length;for(let l of i)r.push(l);if(t>0&&Ds(r,o-1),e<this.length){let l=r.length;this.decomposeRight(e,r),Ds(r,l)}return W.of(r)}decomposeLeft(t,e){let i=this.left.length;if(t<=i)return this.left.decomposeLeft(t,e);e.push(this.left),this.break&&(i++,t>=i&&e.push(null)),t>i&&this.right.decomposeLeft(t-i,e)}decomposeRight(t,e){let i=this.left.length,s=i+this.break;if(t>=s)return this.right.decomposeRight(t-s,e);t<i&&this.left.decomposeRight(t,e),this.break&&t<s&&e.push(null),e.push(this.right)}balanced(t,e){return t.size>2*e.size||e.size>2*t.size?W.of(this.break?[t,null,e]:[t,e]):(this.left=t,this.right=e,this.height=t.height+e.height,this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,i=!1,s){let{left:r,right:o}=this,l=e+r.length+this.break,a=null;return s&&s.from<=e+r.length&&s.more?a=r=r.updateHeight(t,e,i,s):r.updateHeight(t,e,i),s&&s.from<=l+o.length&&s.more?a=o=o.updateHeight(t,l,i,s):o.updateHeight(t,l,i),a?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Ds(n,t){let e,i;n[t]==null&&(e=n[t-1])instanceof $&&(i=n[t+1])instanceof $&&n.splice(t-1,3,new $(e.length+1+i.length))}const nl=5;class Ai{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let i=Math.min(e,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof K?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new K(i-this.pos,-1)),this.writtenTo=i,e>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,i){if(t<e||i.heightRelevant){let s=i.widget?i.widget.estimatedHeight:0;s<0&&(s=this.oracle.lineHeight);let r=e-t;i.block?this.addBlock(new Ts(r,s,i.type)):(r||s>=nl)&&this.addLineDeco(s,r)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTo<t&&((this.writtenTo<t-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new K(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new $(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof K)return t;let e=new K(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type==R.WidgetAfter&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=R.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(e instanceof K)&&!this.isCovered?this.nodes.push(new K(0,-1)):(this.writtenTo<this.pos||e==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=t;for(let s of this.nodes)s instanceof K&&s.updateHeight(this.oracle,i),i+=s?s.length:1;return this.nodes}static build(t,e,i,s){let r=new Ai(i,t);return P.spans(e,i,s,r,0),r.finish(i)}}function sl(n,t,e){let i=new rl;return P.compare(n,t,e,i,0),i.changes}class rl{constructor(){this.changes=[]}compareRange(){}comparePoint(t,e,i,s){(t<e||i&&i.heightRelevant||s&&s.heightRelevant)&&ci(t,e,this.changes,5)}}function ol(n,t){let e=n.getBoundingClientRect(),i=Math.max(0,e.left),s=Math.min(innerWidth,e.right),r=Math.max(0,e.top),o=Math.min(innerHeight,e.bottom),l=n.ownerDocument.body;for(let a=n.parentNode;a&&a!=l;)if(a.nodeType==1){let h=a,f=window.getComputedStyle(h);if((h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&f.overflow!="visible"){let c=h.getBoundingClientRect();i=Math.max(i,c.left),s=Math.min(s,c.right),r=Math.max(r,c.top),o=Math.min(o,c.bottom)}a=f.position=="absolute"||f.position=="fixed"?h.offsetParent:h.parentNode}else if(a.nodeType==11)a=a.host;else break;return{left:i-e.left,right:Math.max(i,s)-e.left,top:r-(e.top+t),bottom:Math.max(r,o)-(e.top+t)}}class ki{constructor(t,e,i){this.from=t,this.to=e,this.size=i}static same(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++){let s=t[i],r=e[i];if(s.from!=r.from||s.to!=r.to||s.size!=r.size)return!1}return!0}draw(t){return N.replace({widget:new ll(this.size,t)}).range(this.from,this.to)}}class ll extends ge{constructor(t,e){super();this.size=t,this.vertical=e}eq(t){return t.size==this.size&&t.vertical==this.vertical}toDOM(){let t=document.createElement("div");return this.vertical?t.style.height=this.size+"px":(t.style.width=this.size+"px",t.style.height="2px",t.style.display="inline-block"),t}get estimatedHeight(){return this.vertical?this.size:-1}}class Ps{constructor(t){this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.heightOracle=new tl,this.scaler=Es,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1,this.heightMap=W.empty().applyChanges(t.facet(vt),x.empty,this.heightOracle.setDoc(t.doc),[new it(0,0,0,t.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=N.set(this.lineGaps.map(e=>e.draw(!1))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let i=0;i<=1;i++){let s=i?e.head:e.anchor;if(!t.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);t.push(new we(r,o))}}this.viewports=t.sort((i,s)=>i.from-s.from),this.scaler=this.heightMap.height<=7e6?Es:new fl(this.heightOracle.doc,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.state.doc,0,0,t=>{this.viewportLines.push(this.scaler.scale==1?t:Xt(t,this.scaler))})}update(t,e=null){let i=this.state;this.state=t.state;let s=this.state.facet(vt),r=t.changedRanges,o=it.extendWithRanges(r,sl(t.startState.facet(vt),s,t?t.changes:L.empty(this.state.doc.length))),l=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(s,i.doc,this.heightOracle.setDoc(this.state.doc),o),this.heightMap.height!=l&&(t.flags|=2);let a=o.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.head<a.from||e.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,e));let h=!t.changes.empty||t.flags&2||a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,this.updateForViewport(),h&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,i=window.getComputedStyle(e),s=this.heightOracle,r=i.whiteSpace,o=i.direction=="rtl"?G.RTL:G.LTR,l=this.heightOracle.mustRefreshForStyle(r,o),a=l||this.mustMeasureContent||this.contentDOMHeight!=e.clientHeight,h=0,f=0;if(this.editorWidth!=t.scrollDOM.clientWidth&&(s.lineWrapping&&(a=!0),this.editorWidth=t.scrollDOM.clientWidth,h|=8),a){this.mustMeasureContent=!1,this.contentDOMHeight=e.clientHeight;let b=parseInt(i.paddingTop)||0,E=parseInt(i.paddingBottom)||0;(this.paddingTop!=b||this.paddingBottom!=E)&&(h|=8,this.paddingTop=b,this.paddingBottom=E)}let c=this.printing?{top:-1e8,bottom:1e8,left:-1e8,right:1e8}:ol(e,this.paddingTop),d=c.top-this.pixelViewport.top,u=c.bottom-this.pixelViewport.bottom;this.pixelViewport=c;let p=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(p!=this.inView&&(this.inView=p,p&&(a=!0)),!this.inView)return 0;let g=e.clientWidth;if((this.contentDOMWidth!=g||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=g,this.editorHeight=t.scrollDOM.clientHeight,h|=8),a){let b=t.docView.measureVisibleLineHeights();if(s.mustRefreshForHeights(b)&&(l=!0),l||s.lineWrapping&&Math.abs(g-this.contentDOMWidth)>s.charWidth){let{lineHeight:E,charWidth:Q}=t.docView.measureTextSize();l=s.refresh(r,o,E,Q,g/Q,b),l&&(t.docView.minWidth=0,h|=8)}d>0&&u>0?f=Math.max(d,u):d<0&&u<0&&(f=Math.min(d,u)),s.heightChanged=!1,this.heightMap=this.heightMap.updateHeight(s,0,l,new el(this.viewport.from,b)),s.heightChanged&&(h|=2)}let m=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return m&&(this.viewport=this.getViewport(f,this.scrollTarget)),this.updateForViewport(),(h&2||m)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(l?[]:this.lineGaps)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),s=this.heightMap,r=this.state.doc,{visibleTop:o,visibleBottom:l}=this,a=new we(s.lineAt(o-i*1e3,A.ByHeight,r,0,0).from,s.lineAt(l+(1-i)*1e3,A.ByHeight,r,0,0).to);if(e){let{head:h}=e.range;if(h<a.from||h>a.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=s.lineAt(h,A.ByPos,r,0,0),d;e.y=="center"?d=(c.top+c.bottom)/2-f/2:e.y=="start"||e.y=="nearest"&&h<a.from?d=c.top:d=c.bottom-f,a=new we(s.lineAt(d-1e3/2,A.ByHeight,r,0,0).from,s.lineAt(d+f+1e3/2,A.ByHeight,r,0,0).to)}}return a}mapViewport(t,e){let i=e.mapPos(t.from,-1),s=e.mapPos(t.to,1);return new we(this.heightMap.lineAt(i,A.ByPos,this.state.doc,0,0).from,this.heightMap.lineAt(s,A.ByPos,this.state.doc,0,0).to)}viewportIsAppropriate({from:t,to:e},i=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(t,A.ByPos,this.state.doc,0,0),{bottom:r}=this.heightMap.lineAt(e,A.ByPos,this.state.doc,0,0),{visibleTop:o,visibleBottom:l}=this;return(t==0||s<=o-Math.max(10,Math.min(-i,250)))&&(e==this.state.doc.length||r>=l+Math.max(10,Math.min(i,250)))&&s>o-2*1e3&&r<l+2*1e3}mapLineGaps(t,e){if(!t.length||e.empty)return t;let i=[];for(let s of t)e.touchesRange(s.from,s.to)||i.push(new ki(e.mapPos(s.from),e.mapPos(s.to),s.size));return i}ensureLineGaps(t){let e=[];if(this.heightOracle.direction!=G.LTR)return e;for(let i of this.viewportLines){if(i.length<4e3)continue;let s=al(i.from,i.to,this.state);if(s.total<4e3)continue;let r,o;if(this.heightOracle.lineWrapping){let h=2e3/this.heightOracle.lineLength*this.heightOracle.lineHeight;r=Se(s,(this.visibleTop-i.top-h)/i.height),o=Se(s,(this.visibleBottom-i.top+h)/i.height)}else{let h=s.total*this.heightOracle.charWidth,f=2e3*this.heightOracle.charWidth;r=Se(s,(this.pixelViewport.left-f)/h),o=Se(s,(this.pixelViewport.right+f)/h)}let l=[];r>i.from&&l.push({from:i.from,to:r}),o<i.to&&l.push({from:o,to:i.to});let a=this.state.selection.main;a.from>=i.from&&a.from<=i.to&&Bs(l,a.from-10,a.from+10),!a.empty&&a.to>=i.from&&a.to<=i.to&&Bs(l,a.to-10,a.to+10);for(let{from:h,to:f}of l)f-h>1e3&&e.push(hl(t,c=>c.from>=i.from&&c.to<=i.to&&Math.abs(c.from-h)<1e3&&Math.abs(c.to-f)<1e3)||new ki(h,f,this.gapSize(i,h,f,s)))}return e}gapSize(t,e,i,s){let r=Rs(s,i)-Rs(s,e);return this.heightOracle.lineWrapping?t.height*r:s.total*this.heightOracle.charWidth*r}updateLineGaps(t){ki.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=N.set(t.map(e=>e.draw(this.heightOracle.lineWrapping))))}computeVisibleRanges(){let t=this.state.facet(vt);this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];P.spans(t,this.viewport.from,this.viewport.to,{span(s,r){e.push({from:s,to:r})},point(){}},20);let i=e.length!=this.visibleRanges.length||this.visibleRanges.some((s,r)=>s.from!=e[r].from||s.to!=e[r].to);return this.visibleRanges=e,i?4:0}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||Xt(this.heightMap.lineAt(t,A.ByPos,this.state.doc,0,0),this.scaler)}lineBlockAtHeight(t){return Xt(this.heightMap.lineAt(this.scaler.fromDOM(t),A.ByHeight,this.state.doc,0,0),this.scaler)}elementAtHeight(t){return Xt(this.heightMap.blockAt(this.scaler.fromDOM(t),this.state.doc,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class we{constructor(t,e){this.from=t,this.to=e}}function al(n,t,e){let i=[],s=n,r=0;return P.spans(e.facet(vt),n,t,{span(){},point(o,l){o>s&&(i.push({from:s,to:o}),r+=o-s),s=l}},20),s<t&&(i.push({from:s,to:t}),r+=t-s),{total:r,ranges:i}}function Se({total:n,ranges:t},e){if(e<=0)return t[0].from;if(e>=1)return t[t.length-1].to;let i=Math.floor(n*e);for(let s=0;;s++){let{from:r,to:o}=t[s],l=o-r;if(i<=l)return r+i;i-=l}}function Rs(n,t){let e=0;for(let{from:i,to:s}of n.ranges){if(t<=s){e+=t-i;break}e+=s-i}return e/n.total}function Bs(n,t,e){for(let i=0;i<n.length;i++){let s=n[i];if(s.from<e&&s.to>t){let r=[];s.from<t&&r.push({from:s.from,to:t}),s.to>e&&r.push({from:e,to:s.to}),n.splice(i,1,...r),i+=r.length-1}}}function hl(n,t){for(let e of n)if(t(e))return e}const Es={toDOM(n){return n},fromDOM(n){return n},scale:1};class fl{constructor(t,e,i){let s=0,r=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=e.lineAt(l,A.ByPos,t,0,0).top,f=e.lineAt(a,A.ByPos,t,0,0).bottom;return s+=f-h,{from:l,to:a,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(e.height-s);for(let l of this.viewports)l.domTop=o+(l.top-r)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),r=l.bottom}toDOM(t){for(let e=0,i=0,s=0;;e++){let r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.top)return s+(t-i)*this.scale;if(t<=r.bottom)return r.domTop+(t-r.top);i=r.bottom,s=r.domBottom}}fromDOM(t){for(let e=0,i=0,s=0;;e++){let r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.domTop)return i+(t-s)/this.scale;if(t<=r.domBottom)return r.top+(t-r.domTop);i=r.bottom,s=r.domBottom}}}function Xt(n,t){if(t.scale==1)return n;let e=t.toDOM(n.top),i=t.toDOM(n.bottom);return new nt(n.from,n.length,e,i-e,Array.isArray(n.type)?n.type.map(s=>Xt(s,t)):n.type)}const _s=S.define({combine:n=>n.join(" ")}),Oi=S.define({combine:n=>n.indexOf(!0)>-1}),Ci=kt.newName(),Ls=kt.newName(),Is=kt.newName(),$s={"&light":"."+Ls,"&dark":"."+Is};function Mi(n,t,e){return new kt(t,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return n;if(!e||!e[s])throw new RangeError(`Unsupported selector: ${s}`);return e[s]}):n+" "+i}})}const cl=Mi("."+Ci,{"&.cm-editor":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,minHeight:"100%",display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere"},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 4px"},".cm-selectionLayer":{zIndex:-1,contain:"size style"},".cm-selectionBackground":{position:"absolute"},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{zIndex:100,contain:"size style",pointerEvents:"none"},"&.cm-focused .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{visibility:"hidden"},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{visibility:"hidden"},"100%":{}},".cm-cursor, .cm-dropCursor":{position:"absolute",borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},"&.cm-focused .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#f3f9ff"},"&dark .cm-activeLine":{backgroundColor:"#223039"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},$s),ul={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Ti=v.ie&&v.ie_version<=11;class dl{constructor(t,e,i){this.view=t,this.onChange=e,this.onScrollChanged=i,this.active=!1,this.selectionRange=new uo,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.scrollTargets=[],this.intersection=null,this.resize=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(s=>{for(let r of s)this.queue.push(r);(v.ie&&v.ie_version<=11||v.ios&&t.composing)&&s.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),Ti&&(this.onCharData=s=>{this.queue.push({target:s.target,type:"characterData",oldValue:s.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),typeof ResizeObserver=="function"&&(this.resize=new ResizeObserver(()=>{this.view.docView.lastUpdate<Date.now()-75&&this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}),this.resize.observe(t.scrollDOM)),this.start(),this.onScroll=this.onScroll.bind(this),window.addEventListener("scroll",this.onScroll),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(s=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),s.length>0&&s[s.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(s=>{s.length>0&&s[s.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange(),this.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,i)=>e!=t[i]))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:e}=this,i=this.selectionRange;if(e.state.facet(Ut)?e.root.activeElement!=this.dom:!ti(e.dom,i))return;let s=i.anchorNode&&e.docView.nearest(i.anchorNode);s&&s.ignoreEvent(t)||((v.ie&&v.ie_version<=11||v.android&&v.chrome)&&!e.state.selection.main.empty&&i.focusNode&&ce(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1))}readSelectionRange(){let{root:t}=this.view,e=fe(t),i=v.safari&&t.nodeType==11&&ho()==this.view.contentDOM&&pl(this.view)||e;return this.selectionRange.eq(i)?!1:(this.selectionRange.setRange(i),this.selectionChanged=!0)}setSelectionRange(t,e){this.selectionRange.set(t.node,t.offset,e.node,e.offset),this.selectionChanged=!1}listenForScroll(){this.parentCheck=-1;let t=0,e=null;for(let i=this.dom;i;)if(i.nodeType==1)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==i?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(t<this.scrollTargets.length&&!e&&(e=this.scrollTargets.slice(0,t)),e){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=e)i.addEventListener("scroll",this.onScroll)}}ignore(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,ul),Ti&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){!this.active||(this.active=!1,this.observer.disconnect(),Ti&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.observer.takeRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(t,e){this.delayedAndroidKey||requestAnimationFrame(()=>{let i=this.delayedAndroidKey;this.delayedAndroidKey=null;let s=this.view.state;Gt(this.view.contentDOM,i.key,i.keyCode)?this.processRecords():this.flush(),this.view.state==s&&this.view.update([])}),(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:e})}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=window.setTimeout(()=>{this.delayedFlush=-1,this.flush()},20))}forceFlush(){this.delayedFlush>=0&&(window.clearTimeout(this.delayedFlush),this.delayedFlush=-1,this.flush())}processRecords(){let t=this.queue;for(let r of this.observer.takeRecords())t.push(r);t.length&&(this.queue=[]);let e=-1,i=-1,s=!1;for(let r of t){let o=this.readMutation(r);!o||(o.typeOver&&(s=!0),e==-1?{from:e,to:i}=o:(e=Math.min(o.from,e),i=Math.max(o.to,i)))}return{from:e,to:i,typeOver:s}}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return;t&&this.readSelectionRange();let{from:e,to:i,typeOver:s}=this.processRecords(),r=this.selectionChanged&&ti(this.dom,this.selectionRange);if(e<0&&!r)return;this.selectionChanged=!1;let o=this.view.state;this.onChange(e,i,s),this.view.state==o&&this.view.update([])}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty(t.type=="attributes"),t.type=="attributes"&&(e.dirty|=4),t.type=="childList"){let i=Vs(e,t.previousSibling||t.target.previousSibling,-1),s=Vs(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:s?e.posBefore(s):e.posAtEnd,typeOver:!1}}else return t.type=="characterData"?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}destroy(){var t,e,i;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(e=this.gapIntersection)===null||e===void 0||e.disconnect(),(i=this.resize)===null||i===void 0||i.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);window.removeEventListener("scroll",this.onScroll),this.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout)}}function Vs(n,t,e){for(;t;){let i=C.get(t);if(i&&i.parent==n)return i;let s=t.parentNode;t=s!=n.dom?s:e>0?t.nextSibling:t.previousSibling}return null}function pl(n){let t=null;function e(a){a.preventDefault(),a.stopImmediatePropagation(),t=a.getTargetRanges()[0]}if(n.contentDOM.addEventListener("beforeinput",e,!0),document.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",e,!0),!t)return null;let i=t.startContainer,s=t.startOffset,r=t.endContainer,o=t.endOffset,l=n.docView.domAtPos(n.state.selection.main.anchor);return ce(l.node,l.offset,r,o)&&([i,s,r,o]=[r,o,i,s]),{anchorNode:i,anchorOffset:s,focusNode:r,focusOffset:o}}function gl(n,t,e,i){let s,r,o=n.state.selection.main;if(t>-1){let l=n.docView.domBoundsAround(t,e,0);if(!l||n.state.readOnly)return;let{from:a,to:h}=l,f=n.docView.impreciseHead||n.docView.impreciseAnchor?[]:yl(n),c=new ts(f,n.state);c.readRange(l.startDOM,l.endDOM);let d=o.from,u=null;(n.inputState.lastKeyCode===8&&n.inputState.lastKeyTime>Date.now()-100||v.android&&c.text.length<h-a)&&(d=o.to,u="end");let p=ml(n.state.doc.sliceString(a,h,at),c.text,d-a,u);if(p){let g=p;for(v.chrome&&n.inputState.lastKeyCode==13&&p.toB==p.from+2&&c.text.slice(p.from,p.toB)==at+at&&p.toB--;p.from<p.toB&&c.text[p.from]=="\u200B";)p={from:p.from+1,toA:p.toA,toB:p.toB},f.forEach(m=>m.pos-=m.pos>g.from?1:0);for(;p.toB>p.from&&c.text[p.toB-1]=="\u200B";)p={from:p.from,toA:p.toA,toB:p.toB-1},f.forEach(m=>m.pos-=m.pos>g.toB?1:0);s={from:a+p.from,to:a+p.toA,insert:x.of(c.text.slice(p.from,p.toB).split(at))}}r=vl(f,a)}else if(n.hasFocus||!n.state.facet(Ut)){let l=n.observer.selectionRange,{impreciseHead:a,impreciseAnchor:h}=n.docView,f=a&&a.node==l.focusNode&&a.offset==l.focusOffset||!Qe(n.contentDOM,l.focusNode)?n.state.selection.main.head:n.docView.posFromDOM(l.focusNode,l.focusOffset),c=h&&h.node==l.anchorNode&&h.offset==l.anchorOffset||!Qe(n.contentDOM,l.anchorNode)?n.state.selection.main.anchor:n.docView.posFromDOM(l.anchorNode,l.anchorOffset);(f!=o.head||c!=o.anchor)&&(r=y.single(c,f))}if(!(!s&&!r)){if(!s&&i&&!o.empty&&r&&r.main.empty?s={from:o.from,to:o.to,insert:n.state.doc.slice(o.from,o.to)}:s&&s.from>=o.from&&s.to<=o.to&&(s.from!=o.from||s.to!=o.to)&&o.to-o.from-(s.to-s.from)<=4&&(s={from:o.from,to:o.to,insert:n.state.doc.slice(o.from,s.from).append(s.insert).append(n.state.doc.slice(s.to,o.to))}),s){let l=n.state;if(v.ios&&n.inputState.flushIOSKey(n)||v.android&&(s.from==o.from&&s.to==o.to&&s.insert.length==1&&s.insert.lines==2&&Gt(n.contentDOM,"Enter",13)||s.from==o.from-1&&s.to==o.to&&s.insert.length==0&&Gt(n.contentDOM,"Backspace",8)||s.from==o.from&&s.to==o.to+1&&s.insert.length==0&&Gt(n.contentDOM,"Delete",46)))return;let a=s.insert.toString();if(n.state.facet(zn).some(c=>c(n,s.from,s.to,a)))return;n.inputState.composing>=0&&n.inputState.composing++;let h;if(s.from>=o.from&&s.to<=o.to&&s.to-s.from>=(o.to-o.from)/3&&(!r||r.main.empty&&r.main.from==s.from+s.insert.length)&&n.inputState.composing<0){let c=o.from<s.from?l.sliceDoc(o.from,s.from):"",d=o.to>s.to?l.sliceDoc(s.to,o.to):"";h=l.replaceSelection(n.state.toText(c+s.insert.sliceString(0,void 0,n.state.lineBreak)+d))}else{let c=l.changes(s),d=r&&!l.selection.main.eq(r.main)&&r.main.to<=c.newLength?r.main:void 0;if(l.selection.ranges.length>1&&n.inputState.composing>=0&&s.to<=o.to&&s.to>=o.to-10){let u=n.state.sliceDoc(s.from,s.to),p=rs(n)||n.state.doc.lineAt(o.head),g=o.to-s.to,m=o.to-o.from;h=l.changeByRange(b=>{if(b.from==o.from&&b.to==o.to)return{changes:c,range:d||b.map(c)};let E=b.to-g,Q=E-u.length;if(b.to-b.from!=m||n.state.sliceDoc(Q,E)!=u||p&&b.to>=p.from&&b.from<=p.to)return{range:b};let _=l.changes({from:Q,to:E,insert:s.insert}),ht=b.to-o.to;return{changes:_,range:d?y.range(Math.max(0,d.anchor+ht),Math.max(0,d.head+ht)):b.map(_)}})}else h={changes:c,selection:d&&l.selection.replaceRange(d)}}let f="input.type";n.composing&&(f+=".compose",n.inputState.compositionFirstChange&&(f+=".start",n.inputState.compositionFirstChange=!1)),n.dispatch(h,{scrollIntoView:!0,userEvent:f})}else if(r&&!r.main.eq(o)){let l=!1,a="select";n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(l=!0),a=n.inputState.lastSelectionOrigin),n.dispatch({selection:r,scrollIntoView:l,userEvent:a})}}}function ml(n,t,e,i){let s=Math.min(n.length,t.length),r=0;for(;r<s&&n.charCodeAt(r)==t.charCodeAt(r);)r++;if(r==s&&n.length==t.length)return null;let o=n.length,l=t.length;for(;o>0&&l>0&&n.charCodeAt(o-1)==t.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,r-Math.min(o,l));e-=o+a-r}return o<r&&n.length<t.length?(r-=e<=r&&e>=o?r-e:0,l=r+(l-o),o=r):l<r&&(r-=e<=r&&e>=l?r-e:0,o=r+(o-l),l=r),{from:r,toA:o,toB:l}}function yl(n){let t=[];if(n.root.activeElement!=n.contentDOM)return t;let{anchorNode:e,anchorOffset:i,focusNode:s,focusOffset:r}=n.observer.selectionRange;return e&&(t.push(new is(e,i)),(s!=e||r!=i)&&t.push(new is(s,r))),t}function vl(n,t){if(n.length==0)return null;let e=n[0].pos,i=n.length==2?n[1].pos:e;return e>-1&&i>-1?y.single(e+t,i+t):null}class M{constructor(t={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: absolute; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this._dispatch=t.dispatch||(e=>this.update([e])),this.dispatch=this.dispatch.bind(this),this.root=t.root||po(t.parent)||document,this.viewState=new Ps(t.state||w.create()),this.plugins=this.state.facet(Jt).map(e=>new gi(e));for(let e of this.plugins)e.update(this);this.observer=new dl(this,(e,i,s)=>{gl(this,e,i,s)},e=>{this.inputState.runScrollHandlers(this,e),this.observer.intersecting&&this.measure()}),this.inputState=new jo(this),this.docView=new ns(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,wl(),this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}dispatch(...t){this._dispatch(t.length==1&&t[0]instanceof H?t[0]:this.state.update(...t))}update(t){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let e=!1,i,s=this.state;for(let o of t){if(o.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=o.state}if(this.destroyed){this.viewState.state=s;return}if(s.facet(w.phrases)!=this.state.facet(w.phrases))return this.setState(s);i=new Yn(this,s,t);let r=this.viewState.scrollTarget;try{this.updateState=2;for(let o of t){if(r&&(r=r.map(o.changes)),o.scrollIntoView){let{main:l}=o.state.selection;r=new Dt(l.empty?l:y.cursor(l.head,l.head>l.anchor?-1:1))}for(let l of o.effects)l.is(pi)?r=new Dt(l.value):l.is(qn)?r=new Dt(l.value,"center"):l.is(Gn)&&(r=l.value)}this.viewState.update(i,r),this.bidiCache=xe.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),e=this.docView.update(i),this.state.facet(Yt)!=this.styleModules&&this.mountStyles(),this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(e,t.some(o=>o.isUserEvent("select.pointer")))}finally{this.updateState=0}if((e||r||this.viewState.mustEnforceCursorAssoc)&&this.requestMeasure(),!i.empty)for(let o of this.state.facet(di))o(i)}setState(t){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let e=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new Ps(t),this.plugins=t.facet(Jt).map(i=>new gi(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView=new ns(this),this.inputState.ensureHandlers(this),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(Jt),i=t.state.facet(Jt);if(e!=i){let s=[];for(let r of i){let o=e.indexOf(r);if(o<0)s.push(new gi(r));else{let l=this.plugins[o];l.mustUpdate=t,s.push(l)}}for(let r of this.plugins)r.mustUpdate!=t&&r.destroy(this);this.plugins=s,this.pluginMap.clear(),this.inputState.ensureHandlers(this)}else for(let s of this.plugins)s.mustUpdate=t;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this)}measure(t=!0){if(this.destroyed)return;this.measureScheduled>-1&&cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,t&&this.observer.flush();let e=null;try{for(let i=0;;i++){this.updateState=1;let s=this.viewport,r=this.viewState.measure(this);if(!r&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(i>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let o=[];r&4||([this.measureRequests,o]=[o,this.measureRequests]);let l=o.map(c=>{try{return c.read(this)}catch(d){return yt(this.state,d),Ns}}),a=new Yn(this,this.state),h=!1,f=!1;a.flags|=r,e?e.flags|=r:e=a,this.updateState=2,a.empty||(this.updatePlugins(a),this.inputState.update(a),this.updateAttrs(),h=this.docView.update(a));for(let c=0;c<o.length;c++)if(l[c]!=Ns)try{let d=o[c];d.write&&d.write(l[c],this)}catch(d){yt(this.state,d)}if(this.viewState.scrollTarget&&(this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,f=!0),h&&this.docView.updateSelection(!0),this.viewport.from==s.from&&this.viewport.to==s.to&&!f&&this.measureRequests.length==0)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let i of this.state.facet(di))i(e)}get themeClasses(){return Ci+" "+(this.state.facet(Oi)?Is:Ls)+" "+this.state.facet(_s)}updateAttrs(){let t=Fs(this,Un,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Ut)?"true":"false",class:"cm-content",style:`${v.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Fs(this,Jn,e),this.observer.ignore(()=>{fi(this.contentDOM,this.contentAttrs,e),fi(this.dom,this.editorAttrs,t)}),this.editorAttrs=t,this.contentAttrs=e}showAnnouncements(t){let e=!0;for(let i of t)for(let s of i.effects)if(s.is(M.announce)){e&&(this.announceDOM.textContent=""),e=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Yt),kt.mount(this.root,this.styleModules.concat(cl).reverse())}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=requestAnimationFrame(()=>this.measure())),t){if(t.key!=null){for(let e=0;e<this.measureRequests.length;e++)if(this.measureRequests[e].key===t.key){this.measureRequests[e]=t;return}}this.measureRequests.push(t)}}pluginField(t){let e=[];for(let i of this.plugins)i.update(this).takeField(t,e);return e}plugin(t){let e=this.pluginMap.get(t);return(e===void 0||e&&e.spec!=t)&&this.pluginMap.set(t,e=this.plugins.find(i=>i.spec==t)||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}blockAtHeight(t,e){let i=Di(e,this);return this.elementAtHeight(t-i).moveY(i)}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}visualLineAtHeight(t,e){let i=Di(e,this);return this.lineBlockAtHeight(t-i).moveY(i)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}viewportLines(t,e){let i=Di(e,this);for(let s of this.viewportLineBlocks)t(s.moveY(i))}get viewportLineBlocks(){return this.viewState.viewportLines}visualLineAt(t,e=0){return this.lineBlockAt(t).moveY(e+this.viewState.paddingTop)}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,i){return wi(this,t,us(this,t,e,i))}moveByGroup(t,e){return wi(this,t,us(this,t,e,i=>Fo(this,t.head,i)))}moveToLineBoundary(t,e,i=!0){return No(this,t,e,i)}moveVertically(t,e,i){return wi(this,t,Ho(this,t,e,i))}scrollPosIntoView(t){this.dispatch({effects:pi.of(y.cursor(t))})}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),fs(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(t),r=this.bidiSpans(s),o=r[Pt.find(r,t-s.from,-1,e)];return de(i,o.dir==G.LTR==e>0)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.heightOracle.direction}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>bl)return Zn(t.length);let e=this.textDirection;for(let s of this.bidiCache)if(s.from==t.from&&s.dir==e)return s.order;let i=Co(t.text,this.textDirection);return this.bidiCache.push(new xe(t.from,t.to,e,i)),i}get hasFocus(){var t;return(document.hasFocus()||v.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{xn(this.contentDOM),this.docView.updateSelection()})}destroy(){for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return Gn.of(new Dt(typeof t=="number"?y.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return ve.define(()=>({}),{eventHandlers:t})}static theme(t,e){let i=kt.newName(),s=[_s.of(i),Yt.of(Mi(`.${i}`,t))];return e&&e.dark&&s.push(Oi.of(!0)),s}static baseTheme(t){return Jr.lowest(Yt.of(Mi("."+Ci,t,$s)))}}M.scrollTo=pi,M.centerOn=qn,M.styleModule=Yt,M.inputHandler=zn,M.exceptionSink=Wn,M.updateListener=di,M.editable=Ut,M.mouseSelectionStyle=jn,M.dragMovesSelection=Hn,M.clickAddsSelectionRange=Fn,M.decorations=vt,M.darkTheme=Oi,M.contentAttributes=Jn,M.editorAttributes=Un,M.lineWrapping=M.contentAttributes.of({class:"cm-lineWrapping"}),M.announce=D.define();const bl=4096;function Di(n,t){return(n??t.contentDOM.getBoundingClientRect().top)+t.viewState.paddingTop}let Pi=-1;function wl(){window.addEventListener("resize",()=>{Pi==-1&&(Pi=setTimeout(Sl,50))})}function Sl(){Pi=-1;let n=document.querySelectorAll(".cm-content");for(let t=0;t<n.length;t++){let e=C.get(n[t]);e&&e.editorView.requestMeasure()}}const Ns={};class xe{constructor(t,e,i,s){this.from=t,this.to=e,this.dir=i,this.order=s}static update(t,e){if(e.empty)return t;let i=[],s=t.length?t[t.length-1].dir:G.LTR;for(let r=Math.max(0,t.length-10);r<t.length;r++){let o=t[r];o.dir==s&&!e.touchesRange(o.from,o.to)&&i.push(new xe(e.mapPos(o.from,1),e.mapPos(o.to,-1),o.dir,o.order))}return i}}function Fs(n,t,e){for(let i=n.state.facet(t),s=i.length-1;s>=0;s--){let r=i[s],o=typeof r=="function"?r(n):r;o&&ai(o,e)}return e}const xl=!v.ios,Al={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};xl&&(Al[".cm-line"].caretColor="transparent !important");var Ae=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function kl(){this.__data__=[],this.size=0}var Ol=kl;function Cl(n,t){return n===t||n!==n&&t!==t}var ke=Cl,Ml=ke;function Tl(n,t){for(var e=n.length;e--;)if(Ml(n[e][0],t))return e;return-1}var Oe=Tl,Dl=Oe,Pl=Array.prototype,Rl=Pl.splice;function Bl(n){var t=this.__data__,e=Dl(t,n);if(e<0)return!1;var i=t.length-1;return e==i?t.pop():Rl.call(t,e,1),--this.size,!0}var El=Bl,_l=Oe;function Ll(n){var t=this.__data__,e=_l(t,n);return e<0?void 0:t[e][1]}var Il=Ll,$l=Oe;function Vl(n){return $l(this.__data__,n)>-1}var Nl=Vl,Fl=Oe;function Hl(n,t){var e=this.__data__,i=Fl(e,n);return i<0?(++this.size,e.push([n,t])):e[i][1]=t,this}var jl=Hl,Wl=Ol,zl=El,ql=Il,Gl=Nl,Kl=jl;function Rt(n){var t=-1,e=n==null?0:n.length;for(this.clear();++t<e;){var i=n[t];this.set(i[0],i[1])}}Rt.prototype.clear=Wl,Rt.prototype.delete=zl,Rt.prototype.get=ql,Rt.prototype.has=Gl,Rt.prototype.set=Kl;var Ce=Rt,Ul=Ce;function Jl(){this.__data__=new Ul,this.size=0}var Yl=Jl;function Xl(n){var t=this.__data__,e=t.delete(n);return this.size=t.size,e}var Zl=Xl;function Ql(n){return this.__data__.get(n)}var ta=Ql;function ea(n){return this.__data__.has(n)}var ia=ea,na=typeof Ae=="object"&&Ae&&Ae.Object===Object&&Ae,Hs=na,sa=Hs,ra=typeof self=="object"&&self&&self.Object===Object&&self,oa=sa||ra||Function("return this")(),Bt=oa,la=Bt,aa=la.Symbol,js=aa,Ws=js,zs=Object.prototype,ha=zs.hasOwnProperty,fa=zs.toString,Zt=Ws?Ws.toStringTag:void 0;function ca(n){var t=ha.call(n,Zt),e=n[Zt];try{n[Zt]=void 0;var i=!0}catch{}var s=fa.call(n);return i&&(t?n[Zt]=e:delete n[Zt]),s}var ua=ca,da=Object.prototype,pa=da.toString;function ga(n){return pa.call(n)}var ma=ga,qs=js,ya=ua,va=ma,ba="[object Null]",wa="[object Undefined]",Gs=qs?qs.toStringTag:void 0;function Sa(n){return n==null?n===void 0?wa:ba:Gs&&Gs in Object(n)?ya(n):va(n)}var Me=Sa;function xa(n){var t=typeof n;return n!=null&&(t=="object"||t=="function")}var bt=xa,Aa=Me,ka=bt,Oa="[object AsyncFunction]",Ca="[object Function]",Ma="[object GeneratorFunction]",Ta="[object Proxy]";function Da(n){if(!ka(n))return!1;var t=Aa(n);return t==Ca||t==Ma||t==Oa||t==Ta}var Ri=Da,Pa=Bt,Ra=Pa["__core-js_shared__"],Ba=Ra,Bi=Ba,Ks=function(){var n=/[^.]+$/.exec(Bi&&Bi.keys&&Bi.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function Ea(n){return!!Ks&&Ks in n}var _a=Ea,La=Function.prototype,Ia=La.toString;function $a(n){if(n!=null){try{return Ia.call(n)}catch{}try{return n+""}catch{}}return""}var Va=$a,Na=Ri,Fa=_a,Ha=bt,ja=Va,Wa=/[\\^$.*+?()[\]{}|]/g,za=/^\[object .+?Constructor\]$/,qa=Function.prototype,Ga=Object.prototype,Ka=qa.toString,Ua=Ga.hasOwnProperty,Ja=RegExp("^"+Ka.call(Ua).replace(Wa,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ya(n){if(!Ha(n)||Fa(n))return!1;var t=Na(n)?Ja:za;return t.test(ja(n))}var Xa=Ya;function Za(n,t){return n==null?void 0:n[t]}var Qa=Za,th=Xa,eh=Qa;function ih(n,t){var e=eh(n,t);return th(e)?e:void 0}var Ei=ih,nh=Ei,sh=Bt,rh=nh(sh,"Map"),Us=rh,oh=Ei,lh=oh(Object,"create"),Te=lh,Js=Te;function ah(){this.__data__=Js?Js(null):{},this.size=0}var hh=ah;function fh(n){var t=this.has(n)&&delete this.__data__[n];return this.size-=t?1:0,t}var ch=fh,uh=Te,dh="__lodash_hash_undefined__",ph=Object.prototype,gh=ph.hasOwnProperty;function mh(n){var t=this.__data__;if(uh){var e=t[n];return e===dh?void 0:e}return gh.call(t,n)?t[n]:void 0}var yh=mh,vh=Te,bh=Object.prototype,wh=bh.hasOwnProperty;function Sh(n){var t=this.__data__;return vh?t[n]!==void 0:wh.call(t,n)}var xh=Sh,Ah=Te,kh="__lodash_hash_undefined__";function Oh(n,t){var e=this.__data__;return this.size+=this.has(n)?0:1,e[n]=Ah&&t===void 0?kh:t,this}var Ch=Oh,Mh=hh,Th=ch,Dh=yh,Ph=xh,Rh=Ch;function Et(n){var t=-1,e=n==null?0:n.length;for(this.clear();++t<e;){var i=n[t];this.set(i[0],i[1])}}Et.prototype.clear=Mh,Et.prototype.delete=Th,Et.prototype.get=Dh,Et.prototype.has=Ph,Et.prototype.set=Rh;var Bh=Et,Ys=Bh,Eh=Ce,_h=Us;function Lh(){this.size=0,this.__data__={hash:new Ys,map:new(_h||Eh),string:new Ys}}var Ih=Lh;function $h(n){var t=typeof n;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?n!=="__proto__":n===null}var Vh=$h,Nh=Vh;function Fh(n,t){var e=n.__data__;return Nh(t)?e[typeof t=="string"?"string":"hash"]:e.map}var De=Fh,Hh=De;function jh(n){var t=Hh(this,n).delete(n);return this.size-=t?1:0,t}var Wh=jh,zh=De;function qh(n){return zh(this,n).get(n)}var Gh=qh,Kh=De;function Uh(n){return Kh(this,n).has(n)}var Jh=Uh,Yh=De;function Xh(n,t){var e=Yh(this,n),i=e.size;return e.set(n,t),this.size+=e.size==i?0:1,this}var Zh=Xh,Qh=Ih,tf=Wh,ef=Gh,nf=Jh,sf=Zh;function _t(n){var t=-1,e=n==null?0:n.length;for(this.clear();++t<e;){var i=n[t];this.set(i[0],i[1])}}_t.prototype.clear=Qh,_t.prototype.delete=tf,_t.prototype.get=ef,_t.prototype.has=nf,_t.prototype.set=sf;var rf=_t,of=Ce,lf=Us,af=rf,hf=200;function ff(n,t){var e=this.__data__;if(e instanceof of){var i=e.__data__;if(!lf||i.length<hf-1)return i.push([n,t]),this.size=++e.size,this;e=this.__data__=new af(i)}return e.set(n,t),this.size=e.size,this}var cf=ff,uf=Ce,df=Yl,pf=Zl,gf=ta,mf=ia,yf=cf;function Lt(n){var t=this.__data__=new uf(n);this.size=t.size}Lt.prototype.clear=df,Lt.prototype.delete=pf,Lt.prototype.get=gf,Lt.prototype.has=mf,Lt.prototype.set=yf;var vf=Lt,bf=Ei,wf=function(){try{var n=bf(Object,"defineProperty");return n({},"",{}),n}catch{}}(),Xs=wf,Zs=Xs;function Sf(n,t,e){t=="__proto__"&&Zs?Zs(n,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):n[t]=e}var _i=Sf,xf=_i,Af=ke;function kf(n,t,e){(e!==void 0&&!Af(n[t],e)||e===void 0&&!(t in n))&&xf(n,t,e)}var Qs=kf;function Of(n){return function(t,e,i){for(var s=-1,r=Object(t),o=i(t),l=o.length;l--;){var a=o[n?l:++s];if(e(r[a],a,r)===!1)break}return t}}var Cf=Of,Mf=Cf,Tf=Mf(),Df=Tf,Li={exports:{}};(function(n,t){var e=Bt,i=t&&!t.nodeType&&t,s=i&&!0&&n&&!n.nodeType&&n,r=s&&s.exports===i,o=r?e.Buffer:void 0,l=o?o.allocUnsafe:void 0;function a(h,f){if(f)return h.slice();var c=h.length,d=l?l(c):new h.constructor(c);return h.copy(d),d}n.exports=a})(Li,Li.exports);var Pf=Bt,Rf=Pf.Uint8Array,Bf=Rf,tr=Bf;function Ef(n){var t=new n.constructor(n.byteLength);return new tr(t).set(new tr(n)),t}var _f=Ef,Lf=_f;function If(n,t){var e=t?Lf(n.buffer):n.buffer;return new n.constructor(e,n.byteOffset,n.length)}var $f=If;function Vf(n,t){var e=-1,i=n.length;for(t||(t=Array(i));++e<i;)t[e]=n[e];return t}var Nf=Vf,Ff=bt,er=Object.create,Hf=function(){function n(){}return function(t){if(!Ff(t))return{};if(er)return er(t);n.prototype=t;var e=new n;return n.prototype=void 0,e}}(),jf=Hf;function Wf(n,t){return function(e){return n(t(e))}}var zf=Wf,qf=zf,Gf=qf(Object.getPrototypeOf,Object),ir=Gf,Kf=Object.prototype;function Uf(n){var t=n&&n.constructor,e=typeof t=="function"&&t.prototype||Kf;return n===e}var nr=Uf,Jf=jf,Yf=ir,Xf=nr;function Zf(n){return typeof n.constructor=="function"&&!Xf(n)?Jf(Yf(n)):{}}var Qf=Zf;function tc(n){return n!=null&&typeof n=="object"}var Qt=tc,ec=Me,ic=Qt,nc="[object Arguments]";function sc(n){return ic(n)&&ec(n)==nc}var rc=sc,sr=rc,oc=Qt,rr=Object.prototype,lc=rr.hasOwnProperty,ac=rr.propertyIsEnumerable,hc=sr(function(){return arguments}())?sr:function(n){return oc(n)&&lc.call(n,"callee")&&!ac.call(n,"callee")},or=hc,fc=Array.isArray,lr=fc,cc=9007199254740991;function uc(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=cc}var ar=uc,dc=Ri,pc=ar;function gc(n){return n!=null&&pc(n.length)&&!dc(n)}var Ii=gc,mc=Ii,yc=Qt;function vc(n){return yc(n)&&mc(n)}var bc=vc,Pe={exports:{}};function wc(){return!1}var Sc=wc;(function(n,t){var e=Bt,i=Sc,s=t&&!t.nodeType&&t,r=s&&!0&&n&&!n.nodeType&&n,o=r&&r.exports===s,l=o?e.Buffer:void 0,a=l?l.isBuffer:void 0,h=a||i;n.exports=h})(Pe,Pe.exports);var xc=Me,Ac=ir,kc=Qt,Oc="[object Object]",Cc=Function.prototype,Mc=Object.prototype,hr=Cc.toString,Tc=Mc.hasOwnProperty,Dc=hr.call(Object);function Pc(n){if(!kc(n)||xc(n)!=Oc)return!1;var t=Ac(n);if(t===null)return!0;var e=Tc.call(t,"constructor")&&t.constructor;return typeof e=="function"&&e instanceof e&&hr.call(e)==Dc}var Rc=Pc,Bc=Me,Ec=ar,_c=Qt,Lc="[object Arguments]",Ic="[object Array]",$c="[object Boolean]",Vc="[object Date]",Nc="[object Error]",Fc="[object Function]",Hc="[object Map]",jc="[object Number]",Wc="[object Object]",zc="[object RegExp]",qc="[object Set]",Gc="[object String]",Kc="[object WeakMap]",Uc="[object ArrayBuffer]",Jc="[object DataView]",Yc="[object Float32Array]",Xc="[object Float64Array]",Zc="[object Int8Array]",Qc="[object Int16Array]",tu="[object Int32Array]",eu="[object Uint8Array]",iu="[object Uint8ClampedArray]",nu="[object Uint16Array]",su="[object Uint32Array]",k={};k[Yc]=k[Xc]=k[Zc]=k[Qc]=k[tu]=k[eu]=k[iu]=k[nu]=k[su]=!0,k[Lc]=k[Ic]=k[Uc]=k[$c]=k[Jc]=k[Vc]=k[Nc]=k[Fc]=k[Hc]=k[jc]=k[Wc]=k[zc]=k[qc]=k[Gc]=k[Kc]=!1;function ru(n){return _c(n)&&Ec(n.length)&&!!k[Bc(n)]}var ou=ru;function lu(n){return function(t){return n(t)}}var au=lu,$i={exports:{}};(function(n,t){var e=Hs,i=t&&!t.nodeType&&t,s=i&&!0&&n&&!n.nodeType&&n,r=s&&s.exports===i,o=r&&e.process,l=function(){try{var a=s&&s.require&&s.require("util").types;return a||o&&o.binding&&o.binding("util")}catch{}}();n.exports=l})($i,$i.exports);var hu=ou,fu=au,fr=$i.exports,cr=fr&&fr.isTypedArray,cu=cr?fu(cr):hu,ur=cu;function uu(n,t){if(!(t==="constructor"&&typeof n[t]=="function")&&t!="__proto__")return n[t]}var dr=uu,du=_i,pu=ke,gu=Object.prototype,mu=gu.hasOwnProperty;function yu(n,t,e){var i=n[t];(!(mu.call(n,t)&&pu(i,e))||e===void 0&&!(t in n))&&du(n,t,e)}var vu=yu,bu=vu,wu=_i;function Su(n,t,e,i){var s=!e;e||(e={});for(var r=-1,o=t.length;++r<o;){var l=t[r],a=i?i(e[l],n[l],l,e,n):void 0;a===void 0&&(a=n[l]),s?wu(e,l,a):bu(e,l,a)}return e}var xu=Su;function Au(n,t){for(var e=-1,i=Array(n);++e<n;)i[e]=t(e);return i}var ku=Au,Ou=9007199254740991,Cu=/^(?:0|[1-9]\d*)$/;function Mu(n,t){var e=typeof n;return t=t??Ou,!!t&&(e=="number"||e!="symbol"&&Cu.test(n))&&n>-1&&n%1==0&&n<t}var pr=Mu,Tu=ku,Du=or,Pu=lr,Ru=Pe.exports,Bu=pr,Eu=ur,_u=Object.prototype,Lu=_u.hasOwnProperty;function Iu(n,t){var e=Pu(n),i=!e&&Du(n),s=!e&&!i&&Ru(n),r=!e&&!i&&!s&&Eu(n),o=e||i||s||r,l=o?Tu(n.length,String):[],a=l.length;for(var h in n)(t||Lu.call(n,h))&&!(o&&(h=="length"||s&&(h=="offset"||h=="parent")||r&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||Bu(h,a)))&&l.push(h);return l}var $u=Iu;function Vu(n){var t=[];if(n!=null)for(var e in Object(n))t.push(e);return t}var Nu=Vu,Fu=bt,Hu=nr,ju=Nu,Wu=Object.prototype,zu=Wu.hasOwnProperty;function qu(n){if(!Fu(n))return ju(n);var t=Hu(n),e=[];for(var i in n)i=="constructor"&&(t||!zu.call(n,i))||e.push(i);return e}var Gu=qu,Ku=$u,Uu=Gu,Ju=Ii;function Yu(n){return Ju(n)?Ku(n,!0):Uu(n)}var gr=Yu,Xu=xu,Zu=gr;function Qu(n){return Xu(n,Zu(n))}var td=Qu,mr=Qs,ed=Li.exports,id=$f,nd=Nf,sd=Qf,yr=or,vr=lr,rd=bc,od=Pe.exports,ld=Ri,ad=bt,hd=Rc,fd=ur,br=dr,cd=td;function ud(n,t,e,i,s,r,o){var l=br(n,e),a=br(t,e),h=o.get(a);if(h){mr(n,e,h);return}var f=r?r(l,a,e+"",n,t,o):void 0,c=f===void 0;if(c){var d=vr(a),u=!d&&od(a),p=!d&&!u&&fd(a);f=a,d||u||p?vr(l)?f=l:rd(l)?f=nd(l):u?(c=!1,f=ed(a,!0)):p?(c=!1,f=id(a,!0)):f=[]:hd(a)||yr(a)?(f=l,yr(l)?f=cd(l):(!ad(l)||ld(l))&&(f=sd(a))):c=!1}c&&(o.set(a,f),s(f,a,i,r,o),o.delete(a)),mr(n,e,f)}var dd=ud,pd=vf,gd=Qs,md=Df,yd=dd,vd=bt,bd=gr,wd=dr;function wr(n,t,e,i,s){n!==t&&md(t,function(r,o){if(s||(s=new pd),vd(r))yd(n,t,o,e,wr,i,s);else{var l=i?i(wd(n,o),r,o+"",n,t,s):void 0;l===void 0&&(l=r),gd(n,o,l)}},bd)}var Sd=wr;function xd(n){return n}var Sr=xd;function Ad(n,t,e){switch(e.length){case 0:return n.call(t);case 1:return n.call(t,e[0]);case 2:return n.call(t,e[0],e[1]);case 3:return n.call(t,e[0],e[1],e[2])}return n.apply(t,e)}var kd=Ad,Od=kd,xr=Math.max;function Cd(n,t,e){return t=xr(t===void 0?n.length-1:t,0),function(){for(var i=arguments,s=-1,r=xr(i.length-t,0),o=Array(r);++s<r;)o[s]=i[t+s];s=-1;for(var l=Array(t+1);++s<t;)l[s]=i[s];return l[t]=e(o),Od(n,this,l)}}var Md=Cd;function Td(n){return function(){return n}}var Dd=Td,Pd=Dd,Ar=Xs,Rd=Sr,Bd=Ar?function(n,t){return Ar(n,"toString",{configurable:!0,enumerable:!1,value:Pd(t),writable:!0})}:Rd,Ed=Bd,_d=800,Ld=16,Id=Date.now;function $d(n){var t=0,e=0;return function(){var i=Id(),s=Ld-(i-e);if(e=i,s>0){if(++t>=_d)return arguments[0]}else t=0;return n.apply(void 0,arguments)}}var Vd=$d,Nd=Ed,Fd=Vd,Hd=Fd(Nd),jd=Hd,Wd=Sr,zd=Md,qd=jd;function Gd(n,t){return qd(zd(n,t,Wd),n+"")}var Kd=Gd,Ud=ke,Jd=Ii,Yd=pr,Xd=bt;function Zd(n,t,e){if(!Xd(e))return!1;var i=typeof t;return(i=="number"?Jd(e)&&Yd(t,e.length):i=="string"&&t in e)?Ud(e[t],n):!1}var Qd=Zd,tp=Kd,ep=Qd;function ip(n){return tp(function(t,e){var i=-1,s=e.length,r=s>1?e[s-1]:void 0,o=s>2?e[2]:void 0;for(r=n.length>3&&typeof r=="function"?(s--,r):void 0,o&&ep(e[0],e[1],o)&&(r=s<3?void 0:r,s=1),t=Object(t);++i<s;){var l=e[i];l&&n(t,l,i,r)}return t})}var np=ip,sp=Sd,rp=np,op=rp(function(n,t,e){sp(n,t,e)}),kr=op,lp=Object.defineProperty,ap=Object.getOwnPropertyDescriptor,Z=(n,t,e,i)=>{for(var s=i>1?void 0:i?ap(t,e):t,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(t,e,s):o(s))||s);return i&&s&&lp(t,e,s),s};let J=class extends Be.default{onValueChanged(){this.editor.dispatch({changes:{from:0,to:this.editor.state.doc.length,insert:this.value}})}onToggleDarkMode(){this.editor.setState(w.create({doc:this.value,extensions:this.extension}))}get extension(){const n=[w.phrases.of(this.phrases),M.updateListener.of(t=>this.$emit("update",t)),M.theme(this.theme,{dark:this.dark})];return this.lang&&n.push(this.lang),this.linter.length!==0&&kr(n,this.linter),this.extensions.length!==0&&kr(n,this.extensions),n}mounted(){this.editor=new M({state:w.create({doc:this.value,extensions:this.extension}),parent:this.$refs.editor,dispatch:n=>{this.editor.update([n]),!n.changes.empty&&this.$emit("input",this.editor.state.doc.toString())}})}beforeDestroy(){this.editor.destroy()}};Z([ft({type:Object})],J.prototype,"theme",2),Z([ft({type:Boolean,default:!1})],J.prototype,"dark",2),Z([ft({type:Object})],J.prototype,"phrases",2),Z([ft({type:Array,default:()=>[]})],J.prototype,"extensions",2),Z([ft({type:Object})],J.prototype,"lang",2),Z([ft({type:Array,default:()=>[]})],J.prototype,"linter",2),Z([ft({type:String,required:!0})],J.prototype,"value",2),Z([ji("value")],J.prototype,"onValueChanged",1),Z([ji("dark")],J.prototype,"onToggleDarkMode",1),J=Z([Hi],J);var hp=function(){var n=this,t=n.$createElement,e=n._self._c||t;return e("div",{ref:"editor"})},fp=[];function cp(n,t,e,i,s,r,o,l){var a=typeof n=="function"?n.options:n;t&&(a.render=t,a.staticRenderFns=e,a._compiled=!0),i&&(a.functional=!0),r&&(a._scopeId="data-v-"+r);var h;if(o?(h=function(d){d=d||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!d&&typeof __VUE_SSR_CONTEXT__<"u"&&(d=__VUE_SSR_CONTEXT__),s&&s.call(this,d),d&&d._registeredComponents&&d._registeredComponents.add(o)},a._ssrRegister=h):s&&(h=l?function(){s.call(this,(a.functional?this.parent:this).$root.$options.shadowRoot)}:s),h)if(a.functional){a._injectStyles=h;var f=a.render;a.render=function(u,p){return h.call(p),f(u,p)}}else{var c=a.beforeCreate;a.beforeCreate=c?[].concat(c,h):[h]}return{exports:n,options:a}}const Or={};var up=cp(J,hp,fp,!1,dp,null,null,null);function dp(n){for(let t in Or)this[t]=Or[t]}var pp=function(){return up.exports}(),Vi=(()=>{const n=pp;return n.install=t=>{t.component("CodeMirror",n)},n})(),gp=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:Vi});return Object.entries(gp).forEach(([n,t])=>{n!=="default"&&(Vi[n]=t)}),Vi});
1
+ (function(Y,jn){typeof exports=="object"&&typeof module<"u"?module.exports=jn(require("vue-property-decorator"),require("@codemirror/state"),require("@codemirror/view")):typeof define=="function"&&define.amd?define(["vue-property-decorator","@codemirror/state","@codemirror/view"],jn):(Y=typeof globalThis<"u"?globalThis:Y||self,Y.CodeMirror=jn(Y.vuePropertyDecorator,Y.state,Y.view))})(this,function(Y,jn,lr){"use strict";var qt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Kt={exports:{}};/**
2
+ * @license
3
+ * Lodash <https://lodash.com/>
4
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
5
+ * Released under MIT license <https://lodash.com/license>
6
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
7
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
8
+ */(function(I,M){(function(){var l,nt="4.17.21",Q=200,tt="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",K="Expected a function",ar="Invalid `variable` option passed into `_.template`",X="__lodash_hash_undefined__",Mn=500,Ct="__lodash_placeholder__",Tn=1,dn=2,et=4,$n=1,_e=2,vn=1,gt=2,Mi=4,Bn=8,Rt=16,Fn=32,Tt=64,Hn=128,zt=256,cr=512,Co=30,Ro="...",To=800,Eo=16,Bi=1,Io=2,Lo=3,_t=1/0,rt=9007199254740991,Oo=17976931348623157e292,pe=0/0,Un=4294967295,bo=Un-1,Wo=Un>>>1,Po=[["ary",Hn],["bind",vn],["bindKey",gt],["curry",Bn],["curryRight",Rt],["flip",cr],["partial",Fn],["partialRight",Tt],["rearg",zt]],Et="[object Arguments]",de="[object Array]",Mo="[object AsyncFunction]",Zt="[object Boolean]",Yt="[object Date]",Bo="[object DOMException]",ve="[object Error]",we="[object Function]",Fi="[object GeneratorFunction]",En="[object Map]",Xt="[object Number]",Fo="[object Null]",qn="[object Object]",Ui="[object Promise]",Uo="[object Proxy]",Jt="[object RegExp]",In="[object Set]",Qt="[object String]",xe="[object Symbol]",Do="[object Undefined]",Vt="[object WeakMap]",No="[object WeakSet]",kt="[object ArrayBuffer]",It="[object DataView]",hr="[object Float32Array]",gr="[object Float64Array]",_r="[object Int8Array]",pr="[object Int16Array]",dr="[object Int32Array]",vr="[object Uint8Array]",wr="[object Uint8ClampedArray]",xr="[object Uint16Array]",Ar="[object Uint32Array]",Go=/\b__p \+= '';/g,$o=/\b(__p \+=) '' \+/g,Ho=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Di=/&(?:amp|lt|gt|quot|#39);/g,Ni=/[&<>"']/g,qo=RegExp(Di.source),Ko=RegExp(Ni.source),zo=/<%-([\s\S]+?)%>/g,Zo=/<%([\s\S]+?)%>/g,Gi=/<%=([\s\S]+?)%>/g,Yo=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Xo=/^\w*$/,Jo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,mr=/[\\^$.*+?()[\]{}|]/g,Qo=RegExp(mr.source),yr=/^\s+/,Vo=/\s/,ko=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,jo=/\{\n\/\* \[wrapped with (.+)\] \*/,nl=/,? & /,tl=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,el=/[()=,{}\[\]\/\s]/,rl=/\\(\\)?/g,il=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,$i=/\w*$/,ul=/^[-+]0x[0-9a-f]+$/i,fl=/^0b[01]+$/i,ol=/^\[object .+?Constructor\]$/,ll=/^0o[0-7]+$/i,sl=/^(?:0|[1-9]\d*)$/,al=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ae=/($^)/,cl=/['\n\r\u2028\u2029\\]/g,me="\\ud800-\\udfff",hl="\\u0300-\\u036f",gl="\\ufe20-\\ufe2f",_l="\\u20d0-\\u20ff",Hi=hl+gl+_l,qi="\\u2700-\\u27bf",Ki="a-z\\xdf-\\xf6\\xf8-\\xff",pl="\\xac\\xb1\\xd7\\xf7",dl="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",vl="\\u2000-\\u206f",wl=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",zi="A-Z\\xc0-\\xd6\\xd8-\\xde",Zi="\\ufe0e\\ufe0f",Yi=pl+dl+vl+wl,Sr="['\u2019]",xl="["+me+"]",Xi="["+Yi+"]",ye="["+Hi+"]",Ji="\\d+",Al="["+qi+"]",Qi="["+Ki+"]",Vi="[^"+me+Yi+Ji+qi+Ki+zi+"]",Cr="\\ud83c[\\udffb-\\udfff]",ml="(?:"+ye+"|"+Cr+")",ki="[^"+me+"]",Rr="(?:\\ud83c[\\udde6-\\uddff]){2}",Tr="[\\ud800-\\udbff][\\udc00-\\udfff]",Lt="["+zi+"]",ji="\\u200d",nu="(?:"+Qi+"|"+Vi+")",yl="(?:"+Lt+"|"+Vi+")",tu="(?:"+Sr+"(?:d|ll|m|re|s|t|ve))?",eu="(?:"+Sr+"(?:D|LL|M|RE|S|T|VE))?",ru=ml+"?",iu="["+Zi+"]?",Sl="(?:"+ji+"(?:"+[ki,Rr,Tr].join("|")+")"+iu+ru+")*",Cl="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Rl="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",uu=iu+ru+Sl,Tl="(?:"+[Al,Rr,Tr].join("|")+")"+uu,El="(?:"+[ki+ye+"?",ye,Rr,Tr,xl].join("|")+")",Il=RegExp(Sr,"g"),Ll=RegExp(ye,"g"),Er=RegExp(Cr+"(?="+Cr+")|"+El+uu,"g"),Ol=RegExp([Lt+"?"+Qi+"+"+tu+"(?="+[Xi,Lt,"$"].join("|")+")",yl+"+"+eu+"(?="+[Xi,Lt+nu,"$"].join("|")+")",Lt+"?"+nu+"+"+tu,Lt+"+"+eu,Rl,Cl,Ji,Tl].join("|"),"g"),bl=RegExp("["+ji+me+Hi+Zi+"]"),Wl=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Pl=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ml=-1,D={};D[hr]=D[gr]=D[_r]=D[pr]=D[dr]=D[vr]=D[wr]=D[xr]=D[Ar]=!0,D[Et]=D[de]=D[kt]=D[Zt]=D[It]=D[Yt]=D[ve]=D[we]=D[En]=D[Xt]=D[qn]=D[Jt]=D[In]=D[Qt]=D[Vt]=!1;var U={};U[Et]=U[de]=U[kt]=U[It]=U[Zt]=U[Yt]=U[hr]=U[gr]=U[_r]=U[pr]=U[dr]=U[En]=U[Xt]=U[qn]=U[Jt]=U[In]=U[Qt]=U[xe]=U[vr]=U[wr]=U[xr]=U[Ar]=!0,U[ve]=U[we]=U[Vt]=!1;var Bl={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Fl={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ul={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Dl={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Nl=parseFloat,Gl=parseInt,fu=typeof qt=="object"&&qt&&qt.Object===Object&&qt,$l=typeof self=="object"&&self&&self.Object===Object&&self,V=fu||$l||Function("return this")(),Ir=M&&!M.nodeType&&M,pt=Ir&&!0&&I&&!I.nodeType&&I,ou=pt&&pt.exports===Ir,Lr=ou&&fu.process,wn=function(){try{var a=pt&&pt.require&&pt.require("util").types;return a||Lr&&Lr.binding&&Lr.binding("util")}catch{}}(),lu=wn&&wn.isArrayBuffer,su=wn&&wn.isDate,au=wn&&wn.isMap,cu=wn&&wn.isRegExp,hu=wn&&wn.isSet,gu=wn&&wn.isTypedArray;function sn(a,g,h){switch(h.length){case 0:return a.call(g);case 1:return a.call(g,h[0]);case 2:return a.call(g,h[0],h[1]);case 3:return a.call(g,h[0],h[1],h[2])}return a.apply(g,h)}function Hl(a,g,h,w){for(var S=-1,W=a==null?0:a.length;++S<W;){var z=a[S];g(w,z,h(z),a)}return w}function xn(a,g){for(var h=-1,w=a==null?0:a.length;++h<w&&g(a[h],h,a)!==!1;);return a}function ql(a,g){for(var h=a==null?0:a.length;h--&&g(a[h],h,a)!==!1;);return a}function _u(a,g){for(var h=-1,w=a==null?0:a.length;++h<w;)if(!g(a[h],h,a))return!1;return!0}function it(a,g){for(var h=-1,w=a==null?0:a.length,S=0,W=[];++h<w;){var z=a[h];g(z,h,a)&&(W[S++]=z)}return W}function Se(a,g){var h=a==null?0:a.length;return!!h&&Ot(a,g,0)>-1}function Or(a,g,h){for(var w=-1,S=a==null?0:a.length;++w<S;)if(h(g,a[w]))return!0;return!1}function N(a,g){for(var h=-1,w=a==null?0:a.length,S=Array(w);++h<w;)S[h]=g(a[h],h,a);return S}function ut(a,g){for(var h=-1,w=g.length,S=a.length;++h<w;)a[S+h]=g[h];return a}function br(a,g,h,w){var S=-1,W=a==null?0:a.length;for(w&&W&&(h=a[++S]);++S<W;)h=g(h,a[S],S,a);return h}function Kl(a,g,h,w){var S=a==null?0:a.length;for(w&&S&&(h=a[--S]);S--;)h=g(h,a[S],S,a);return h}function Wr(a,g){for(var h=-1,w=a==null?0:a.length;++h<w;)if(g(a[h],h,a))return!0;return!1}var zl=Pr("length");function Zl(a){return a.split("")}function Yl(a){return a.match(tl)||[]}function pu(a,g,h){var w;return h(a,function(S,W,z){if(g(S,W,z))return w=W,!1}),w}function Ce(a,g,h,w){for(var S=a.length,W=h+(w?1:-1);w?W--:++W<S;)if(g(a[W],W,a))return W;return-1}function Ot(a,g,h){return g===g?us(a,g,h):Ce(a,du,h)}function Xl(a,g,h,w){for(var S=h-1,W=a.length;++S<W;)if(w(a[S],g))return S;return-1}function du(a){return a!==a}function vu(a,g){var h=a==null?0:a.length;return h?Br(a,g)/h:pe}function Pr(a){return function(g){return g==null?l:g[a]}}function Mr(a){return function(g){return a==null?l:a[g]}}function wu(a,g,h,w,S){return S(a,function(W,z,F){h=w?(w=!1,W):g(h,W,z,F)}),h}function Jl(a,g){var h=a.length;for(a.sort(g);h--;)a[h]=a[h].value;return a}function Br(a,g){for(var h,w=-1,S=a.length;++w<S;){var W=g(a[w]);W!==l&&(h=h===l?W:h+W)}return h}function Fr(a,g){for(var h=-1,w=Array(a);++h<a;)w[h]=g(h);return w}function Ql(a,g){return N(g,function(h){return[h,a[h]]})}function xu(a){return a&&a.slice(0,Su(a)+1).replace(yr,"")}function an(a){return function(g){return a(g)}}function Ur(a,g){return N(g,function(h){return a[h]})}function jt(a,g){return a.has(g)}function Au(a,g){for(var h=-1,w=a.length;++h<w&&Ot(g,a[h],0)>-1;);return h}function mu(a,g){for(var h=a.length;h--&&Ot(g,a[h],0)>-1;);return h}function Vl(a,g){for(var h=a.length,w=0;h--;)a[h]===g&&++w;return w}var kl=Mr(Bl),jl=Mr(Fl);function ns(a){return"\\"+Dl[a]}function ts(a,g){return a==null?l:a[g]}function bt(a){return bl.test(a)}function es(a){return Wl.test(a)}function rs(a){for(var g,h=[];!(g=a.next()).done;)h.push(g.value);return h}function Dr(a){var g=-1,h=Array(a.size);return a.forEach(function(w,S){h[++g]=[S,w]}),h}function yu(a,g){return function(h){return a(g(h))}}function ft(a,g){for(var h=-1,w=a.length,S=0,W=[];++h<w;){var z=a[h];(z===g||z===Ct)&&(a[h]=Ct,W[S++]=h)}return W}function Re(a){var g=-1,h=Array(a.size);return a.forEach(function(w){h[++g]=w}),h}function is(a){var g=-1,h=Array(a.size);return a.forEach(function(w){h[++g]=[w,w]}),h}function us(a,g,h){for(var w=h-1,S=a.length;++w<S;)if(a[w]===g)return w;return-1}function fs(a,g,h){for(var w=h+1;w--;)if(a[w]===g)return w;return w}function Wt(a){return bt(a)?ls(a):zl(a)}function Ln(a){return bt(a)?ss(a):Zl(a)}function Su(a){for(var g=a.length;g--&&Vo.test(a.charAt(g)););return g}var os=Mr(Ul);function ls(a){for(var g=Er.lastIndex=0;Er.test(a);)++g;return g}function ss(a){return a.match(Er)||[]}function as(a){return a.match(Ol)||[]}var cs=function a(g){g=g==null?V:Pt.defaults(V.Object(),g,Pt.pick(V,Pl));var h=g.Array,w=g.Date,S=g.Error,W=g.Function,z=g.Math,F=g.Object,Nr=g.RegExp,hs=g.String,An=g.TypeError,Te=h.prototype,gs=W.prototype,Mt=F.prototype,Ee=g["__core-js_shared__"],Ie=gs.toString,B=Mt.hasOwnProperty,_s=0,Cu=function(){var n=/[^.]+$/.exec(Ee&&Ee.keys&&Ee.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),Le=Mt.toString,ps=Ie.call(F),ds=V._,vs=Nr("^"+Ie.call(B).replace(mr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Oe=ou?g.Buffer:l,ot=g.Symbol,be=g.Uint8Array,Ru=Oe?Oe.allocUnsafe:l,We=yu(F.getPrototypeOf,F),Tu=F.create,Eu=Mt.propertyIsEnumerable,Pe=Te.splice,Iu=ot?ot.isConcatSpreadable:l,ne=ot?ot.iterator:l,dt=ot?ot.toStringTag:l,Me=function(){try{var n=mt(F,"defineProperty");return n({},"",{}),n}catch{}}(),ws=g.clearTimeout!==V.clearTimeout&&g.clearTimeout,xs=w&&w.now!==V.Date.now&&w.now,As=g.setTimeout!==V.setTimeout&&g.setTimeout,Be=z.ceil,Fe=z.floor,Gr=F.getOwnPropertySymbols,ms=Oe?Oe.isBuffer:l,Lu=g.isFinite,ys=Te.join,Ss=yu(F.keys,F),Z=z.max,j=z.min,Cs=w.now,Rs=g.parseInt,Ou=z.random,Ts=Te.reverse,$r=mt(g,"DataView"),te=mt(g,"Map"),Hr=mt(g,"Promise"),Bt=mt(g,"Set"),ee=mt(g,"WeakMap"),re=mt(F,"create"),Ue=ee&&new ee,Ft={},Es=yt($r),Is=yt(te),Ls=yt(Hr),Os=yt(Bt),bs=yt(ee),De=ot?ot.prototype:l,ie=De?De.valueOf:l,bu=De?De.toString:l;function u(n){if($(n)&&!C(n)&&!(n instanceof O)){if(n instanceof mn)return n;if(B.call(n,"__wrapped__"))return Pf(n)}return new mn(n)}var Ut=function(){function n(){}return function(t){if(!G(t))return{};if(Tu)return Tu(t);n.prototype=t;var e=new n;return n.prototype=l,e}}();function Ne(){}function mn(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=l}u.templateSettings={escape:zo,evaluate:Zo,interpolate:Gi,variable:"",imports:{_:u}},u.prototype=Ne.prototype,u.prototype.constructor=u,mn.prototype=Ut(Ne.prototype),mn.prototype.constructor=mn;function O(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Un,this.__views__=[]}function Ws(){var n=new O(this.__wrapped__);return n.__actions__=un(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=un(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=un(this.__views__),n}function Ps(){if(this.__filtered__){var n=new O(this);n.__dir__=-1,n.__filtered__=!0}else n=this.clone(),n.__dir__*=-1;return n}function Ms(){var n=this.__wrapped__.value(),t=this.__dir__,e=C(n),r=t<0,i=e?n.length:0,f=Za(0,i,this.__views__),o=f.start,s=f.end,c=s-o,_=r?s:o-1,p=this.__iteratees__,d=p.length,v=0,x=j(c,this.__takeCount__);if(!e||!r&&i==c&&x==c)return tf(n,this.__actions__);var m=[];n:for(;c--&&v<x;){_+=t;for(var T=-1,y=n[_];++T<d;){var L=p[T],b=L.iteratee,gn=L.type,rn=b(y);if(gn==Io)y=rn;else if(!rn){if(gn==Bi)continue n;break n}}m[v++]=y}return m}O.prototype=Ut(Ne.prototype),O.prototype.constructor=O;function vt(n){var t=-1,e=n==null?0:n.length;for(this.clear();++t<e;){var r=n[t];this.set(r[0],r[1])}}function Bs(){this.__data__=re?re(null):{},this.size=0}function Fs(n){var t=this.has(n)&&delete this.__data__[n];return this.size-=t?1:0,t}function Us(n){var t=this.__data__;if(re){var e=t[n];return e===X?l:e}return B.call(t,n)?t[n]:l}function Ds(n){var t=this.__data__;return re?t[n]!==l:B.call(t,n)}function Ns(n,t){var e=this.__data__;return this.size+=this.has(n)?0:1,e[n]=re&&t===l?X:t,this}vt.prototype.clear=Bs,vt.prototype.delete=Fs,vt.prototype.get=Us,vt.prototype.has=Ds,vt.prototype.set=Ns;function Kn(n){var t=-1,e=n==null?0:n.length;for(this.clear();++t<e;){var r=n[t];this.set(r[0],r[1])}}function Gs(){this.__data__=[],this.size=0}function $s(n){var t=this.__data__,e=Ge(t,n);if(e<0)return!1;var r=t.length-1;return e==r?t.pop():Pe.call(t,e,1),--this.size,!0}function Hs(n){var t=this.__data__,e=Ge(t,n);return e<0?l:t[e][1]}function qs(n){return Ge(this.__data__,n)>-1}function Ks(n,t){var e=this.__data__,r=Ge(e,n);return r<0?(++this.size,e.push([n,t])):e[r][1]=t,this}Kn.prototype.clear=Gs,Kn.prototype.delete=$s,Kn.prototype.get=Hs,Kn.prototype.has=qs,Kn.prototype.set=Ks;function zn(n){var t=-1,e=n==null?0:n.length;for(this.clear();++t<e;){var r=n[t];this.set(r[0],r[1])}}function zs(){this.size=0,this.__data__={hash:new vt,map:new(te||Kn),string:new vt}}function Zs(n){var t=ke(this,n).delete(n);return this.size-=t?1:0,t}function Ys(n){return ke(this,n).get(n)}function Xs(n){return ke(this,n).has(n)}function Js(n,t){var e=ke(this,n),r=e.size;return e.set(n,t),this.size+=e.size==r?0:1,this}zn.prototype.clear=zs,zn.prototype.delete=Zs,zn.prototype.get=Ys,zn.prototype.has=Xs,zn.prototype.set=Js;function wt(n){var t=-1,e=n==null?0:n.length;for(this.__data__=new zn;++t<e;)this.add(n[t])}function Qs(n){return this.__data__.set(n,X),this}function Vs(n){return this.__data__.has(n)}wt.prototype.add=wt.prototype.push=Qs,wt.prototype.has=Vs;function On(n){var t=this.__data__=new Kn(n);this.size=t.size}function ks(){this.__data__=new Kn,this.size=0}function js(n){var t=this.__data__,e=t.delete(n);return this.size=t.size,e}function na(n){return this.__data__.get(n)}function ta(n){return this.__data__.has(n)}function ea(n,t){var e=this.__data__;if(e instanceof Kn){var r=e.__data__;if(!te||r.length<Q-1)return r.push([n,t]),this.size=++e.size,this;e=this.__data__=new zn(r)}return e.set(n,t),this.size=e.size,this}On.prototype.clear=ks,On.prototype.delete=js,On.prototype.get=na,On.prototype.has=ta,On.prototype.set=ea;function Wu(n,t){var e=C(n),r=!e&&St(n),i=!e&&!r&&ht(n),f=!e&&!r&&!i&&$t(n),o=e||r||i||f,s=o?Fr(n.length,hs):[],c=s.length;for(var _ in n)(t||B.call(n,_))&&!(o&&(_=="length"||i&&(_=="offset"||_=="parent")||f&&(_=="buffer"||_=="byteLength"||_=="byteOffset")||Jn(_,c)))&&s.push(_);return s}function Pu(n){var t=n.length;return t?n[jr(0,t-1)]:l}function ra(n,t){return je(un(n),xt(t,0,n.length))}function ia(n){return je(un(n))}function qr(n,t,e){(e!==l&&!bn(n[t],e)||e===l&&!(t in n))&&Zn(n,t,e)}function ue(n,t,e){var r=n[t];(!(B.call(n,t)&&bn(r,e))||e===l&&!(t in n))&&Zn(n,t,e)}function Ge(n,t){for(var e=n.length;e--;)if(bn(n[e][0],t))return e;return-1}function ua(n,t,e,r){return lt(n,function(i,f,o){t(r,i,e(i),o)}),r}function Mu(n,t){return n&&Nn(t,J(t),n)}function fa(n,t){return n&&Nn(t,on(t),n)}function Zn(n,t,e){t=="__proto__"&&Me?Me(n,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):n[t]=e}function Kr(n,t){for(var e=-1,r=t.length,i=h(r),f=n==null;++e<r;)i[e]=f?l:Ci(n,t[e]);return i}function xt(n,t,e){return n===n&&(e!==l&&(n=n<=e?n:e),t!==l&&(n=n>=t?n:t)),n}function yn(n,t,e,r,i,f){var o,s=t&Tn,c=t&dn,_=t&et;if(e&&(o=i?e(n,r,i,f):e(n)),o!==l)return o;if(!G(n))return n;var p=C(n);if(p){if(o=Xa(n),!s)return un(n,o)}else{var d=nn(n),v=d==we||d==Fi;if(ht(n))return uf(n,s);if(d==qn||d==Et||v&&!i){if(o=c||v?{}:Cf(n),!s)return c?Ua(n,fa(o,n)):Fa(n,Mu(o,n))}else{if(!U[d])return i?n:{};o=Ja(n,d,s)}}f||(f=new On);var x=f.get(n);if(x)return x;f.set(n,o),jf(n)?n.forEach(function(y){o.add(yn(y,t,e,y,n,f))}):Vf(n)&&n.forEach(function(y,L){o.set(L,yn(y,t,e,L,n,f))});var m=_?c?ai:si:c?on:J,T=p?l:m(n);return xn(T||n,function(y,L){T&&(L=y,y=n[L]),ue(o,L,yn(y,t,e,L,n,f))}),o}function oa(n){var t=J(n);return function(e){return Bu(e,n,t)}}function Bu(n,t,e){var r=e.length;if(n==null)return!r;for(n=F(n);r--;){var i=e[r],f=t[i],o=n[i];if(o===l&&!(i in n)||!f(o))return!1}return!0}function Fu(n,t,e){if(typeof n!="function")throw new An(K);return he(function(){n.apply(l,e)},t)}function fe(n,t,e,r){var i=-1,f=Se,o=!0,s=n.length,c=[],_=t.length;if(!s)return c;e&&(t=N(t,an(e))),r?(f=Or,o=!1):t.length>=Q&&(f=jt,o=!1,t=new wt(t));n:for(;++i<s;){var p=n[i],d=e==null?p:e(p);if(p=r||p!==0?p:0,o&&d===d){for(var v=_;v--;)if(t[v]===d)continue n;c.push(p)}else f(t,d,r)||c.push(p)}return c}var lt=af(Dn),Uu=af(Zr,!0);function la(n,t){var e=!0;return lt(n,function(r,i,f){return e=!!t(r,i,f),e}),e}function $e(n,t,e){for(var r=-1,i=n.length;++r<i;){var f=n[r],o=t(f);if(o!=null&&(s===l?o===o&&!hn(o):e(o,s)))var s=o,c=f}return c}function sa(n,t,e,r){var i=n.length;for(e=R(e),e<0&&(e=-e>i?0:i+e),r=r===l||r>i?i:R(r),r<0&&(r+=i),r=e>r?0:to(r);e<r;)n[e++]=t;return n}function Du(n,t){var e=[];return lt(n,function(r,i,f){t(r,i,f)&&e.push(r)}),e}function k(n,t,e,r,i){var f=-1,o=n.length;for(e||(e=Va),i||(i=[]);++f<o;){var s=n[f];t>0&&e(s)?t>1?k(s,t-1,e,r,i):ut(i,s):r||(i[i.length]=s)}return i}var zr=cf(),Nu=cf(!0);function Dn(n,t){return n&&zr(n,t,J)}function Zr(n,t){return n&&Nu(n,t,J)}function He(n,t){return it(t,function(e){return Qn(n[e])})}function At(n,t){t=at(t,n);for(var e=0,r=t.length;n!=null&&e<r;)n=n[Gn(t[e++])];return e&&e==r?n:l}function Gu(n,t,e){var r=t(n);return C(n)?r:ut(r,e(n))}function tn(n){return n==null?n===l?Do:Fo:dt&&dt in F(n)?za(n):ic(n)}function Yr(n,t){return n>t}function aa(n,t){return n!=null&&B.call(n,t)}function ca(n,t){return n!=null&&t in F(n)}function ha(n,t,e){return n>=j(t,e)&&n<Z(t,e)}function Xr(n,t,e){for(var r=e?Or:Se,i=n[0].length,f=n.length,o=f,s=h(f),c=1/0,_=[];o--;){var p=n[o];o&&t&&(p=N(p,an(t))),c=j(p.length,c),s[o]=!e&&(t||i>=120&&p.length>=120)?new wt(o&&p):l}p=n[0];var d=-1,v=s[0];n:for(;++d<i&&_.length<c;){var x=p[d],m=t?t(x):x;if(x=e||x!==0?x:0,!(v?jt(v,m):r(_,m,e))){for(o=f;--o;){var T=s[o];if(!(T?jt(T,m):r(n[o],m,e)))continue n}v&&v.push(m),_.push(x)}}return _}function ga(n,t,e,r){return Dn(n,function(i,f,o){t(r,e(i),f,o)}),r}function oe(n,t,e){t=at(t,n),n=If(n,t);var r=n==null?n:n[Gn(Cn(t))];return r==null?l:sn(r,n,e)}function $u(n){return $(n)&&tn(n)==Et}function _a(n){return $(n)&&tn(n)==kt}function pa(n){return $(n)&&tn(n)==Yt}function le(n,t,e,r,i){return n===t?!0:n==null||t==null||!$(n)&&!$(t)?n!==n&&t!==t:da(n,t,e,r,le,i)}function da(n,t,e,r,i,f){var o=C(n),s=C(t),c=o?de:nn(n),_=s?de:nn(t);c=c==Et?qn:c,_=_==Et?qn:_;var p=c==qn,d=_==qn,v=c==_;if(v&&ht(n)){if(!ht(t))return!1;o=!0,p=!1}if(v&&!p)return f||(f=new On),o||$t(n)?mf(n,t,e,r,i,f):qa(n,t,c,e,r,i,f);if(!(e&$n)){var x=p&&B.call(n,"__wrapped__"),m=d&&B.call(t,"__wrapped__");if(x||m){var T=x?n.value():n,y=m?t.value():t;return f||(f=new On),i(T,y,e,r,f)}}return v?(f||(f=new On),Ka(n,t,e,r,i,f)):!1}function va(n){return $(n)&&nn(n)==En}function Jr(n,t,e,r){var i=e.length,f=i,o=!r;if(n==null)return!f;for(n=F(n);i--;){var s=e[i];if(o&&s[2]?s[1]!==n[s[0]]:!(s[0]in n))return!1}for(;++i<f;){s=e[i];var c=s[0],_=n[c],p=s[1];if(o&&s[2]){if(_===l&&!(c in n))return!1}else{var d=new On;if(r)var v=r(_,p,c,n,t,d);if(!(v===l?le(p,_,$n|_e,r,d):v))return!1}}return!0}function Hu(n){if(!G(n)||ja(n))return!1;var t=Qn(n)?vs:ol;return t.test(yt(n))}function wa(n){return $(n)&&tn(n)==Jt}function xa(n){return $(n)&&nn(n)==In}function Aa(n){return $(n)&&ur(n.length)&&!!D[tn(n)]}function qu(n){return typeof n=="function"?n:n==null?ln:typeof n=="object"?C(n)?Zu(n[0],n[1]):zu(n):ho(n)}function Qr(n){if(!ce(n))return Ss(n);var t=[];for(var e in F(n))B.call(n,e)&&e!="constructor"&&t.push(e);return t}function ma(n){if(!G(n))return rc(n);var t=ce(n),e=[];for(var r in n)r=="constructor"&&(t||!B.call(n,r))||e.push(r);return e}function Vr(n,t){return n<t}function Ku(n,t){var e=-1,r=fn(n)?h(n.length):[];return lt(n,function(i,f,o){r[++e]=t(i,f,o)}),r}function zu(n){var t=hi(n);return t.length==1&&t[0][2]?Tf(t[0][0],t[0][1]):function(e){return e===n||Jr(e,n,t)}}function Zu(n,t){return _i(n)&&Rf(t)?Tf(Gn(n),t):function(e){var r=Ci(e,n);return r===l&&r===t?Ri(e,n):le(t,r,$n|_e)}}function qe(n,t,e,r,i){n!==t&&zr(t,function(f,o){if(i||(i=new On),G(f))ya(n,t,o,e,qe,r,i);else{var s=r?r(di(n,o),f,o+"",n,t,i):l;s===l&&(s=f),qr(n,o,s)}},on)}function ya(n,t,e,r,i,f,o){var s=di(n,e),c=di(t,e),_=o.get(c);if(_){qr(n,e,_);return}var p=f?f(s,c,e+"",n,t,o):l,d=p===l;if(d){var v=C(c),x=!v&&ht(c),m=!v&&!x&&$t(c);p=c,v||x||m?C(s)?p=s:H(s)?p=un(s):x?(d=!1,p=uf(c,!0)):m?(d=!1,p=ff(c,!0)):p=[]:ge(c)||St(c)?(p=s,St(s)?p=eo(s):(!G(s)||Qn(s))&&(p=Cf(c))):d=!1}d&&(o.set(c,p),i(p,c,r,f,o),o.delete(c)),qr(n,e,p)}function Yu(n,t){var e=n.length;if(!!e)return t+=t<0?e:0,Jn(t,e)?n[t]:l}function Xu(n,t,e){t.length?t=N(t,function(f){return C(f)?function(o){return At(o,f.length===1?f[0]:f)}:f}):t=[ln];var r=-1;t=N(t,an(A()));var i=Ku(n,function(f,o,s){var c=N(t,function(_){return _(f)});return{criteria:c,index:++r,value:f}});return Jl(i,function(f,o){return Ba(f,o,e)})}function Sa(n,t){return Ju(n,t,function(e,r){return Ri(n,r)})}function Ju(n,t,e){for(var r=-1,i=t.length,f={};++r<i;){var o=t[r],s=At(n,o);e(s,o)&&se(f,at(o,n),s)}return f}function Ca(n){return function(t){return At(t,n)}}function kr(n,t,e,r){var i=r?Xl:Ot,f=-1,o=t.length,s=n;for(n===t&&(t=un(t)),e&&(s=N(n,an(e)));++f<o;)for(var c=0,_=t[f],p=e?e(_):_;(c=i(s,p,c,r))>-1;)s!==n&&Pe.call(s,c,1),Pe.call(n,c,1);return n}function Qu(n,t){for(var e=n?t.length:0,r=e-1;e--;){var i=t[e];if(e==r||i!==f){var f=i;Jn(i)?Pe.call(n,i,1):ei(n,i)}}return n}function jr(n,t){return n+Fe(Ou()*(t-n+1))}function Ra(n,t,e,r){for(var i=-1,f=Z(Be((t-n)/(e||1)),0),o=h(f);f--;)o[r?f:++i]=n,n+=e;return o}function ni(n,t){var e="";if(!n||t<1||t>rt)return e;do t%2&&(e+=n),t=Fe(t/2),t&&(n+=n);while(t);return e}function E(n,t){return vi(Ef(n,t,ln),n+"")}function Ta(n){return Pu(Ht(n))}function Ea(n,t){var e=Ht(n);return je(e,xt(t,0,e.length))}function se(n,t,e,r){if(!G(n))return n;t=at(t,n);for(var i=-1,f=t.length,o=f-1,s=n;s!=null&&++i<f;){var c=Gn(t[i]),_=e;if(c==="__proto__"||c==="constructor"||c==="prototype")return n;if(i!=o){var p=s[c];_=r?r(p,c,s):l,_===l&&(_=G(p)?p:Jn(t[i+1])?[]:{})}ue(s,c,_),s=s[c]}return n}var Vu=Ue?function(n,t){return Ue.set(n,t),n}:ln,Ia=Me?function(n,t){return Me(n,"toString",{configurable:!0,enumerable:!1,value:Ei(t),writable:!0})}:ln;function La(n){return je(Ht(n))}function Sn(n,t,e){var r=-1,i=n.length;t<0&&(t=-t>i?0:i+t),e=e>i?i:e,e<0&&(e+=i),i=t>e?0:e-t>>>0,t>>>=0;for(var f=h(i);++r<i;)f[r]=n[r+t];return f}function Oa(n,t){var e;return lt(n,function(r,i,f){return e=t(r,i,f),!e}),!!e}function Ke(n,t,e){var r=0,i=n==null?r:n.length;if(typeof t=="number"&&t===t&&i<=Wo){for(;r<i;){var f=r+i>>>1,o=n[f];o!==null&&!hn(o)&&(e?o<=t:o<t)?r=f+1:i=f}return i}return ti(n,t,ln,e)}function ti(n,t,e,r){var i=0,f=n==null?0:n.length;if(f===0)return 0;t=e(t);for(var o=t!==t,s=t===null,c=hn(t),_=t===l;i<f;){var p=Fe((i+f)/2),d=e(n[p]),v=d!==l,x=d===null,m=d===d,T=hn(d);if(o)var y=r||m;else _?y=m&&(r||v):s?y=m&&v&&(r||!x):c?y=m&&v&&!x&&(r||!T):x||T?y=!1:y=r?d<=t:d<t;y?i=p+1:f=p}return j(f,bo)}function ku(n,t){for(var e=-1,r=n.length,i=0,f=[];++e<r;){var o=n[e],s=t?t(o):o;if(!e||!bn(s,c)){var c=s;f[i++]=o===0?0:o}}return f}function ju(n){return typeof n=="number"?n:hn(n)?pe:+n}function cn(n){if(typeof n=="string")return n;if(C(n))return N(n,cn)+"";if(hn(n))return bu?bu.call(n):"";var t=n+"";return t=="0"&&1/n==-_t?"-0":t}function st(n,t,e){var r=-1,i=Se,f=n.length,o=!0,s=[],c=s;if(e)o=!1,i=Or;else if(f>=Q){var _=t?null:$a(n);if(_)return Re(_);o=!1,i=jt,c=new wt}else c=t?[]:s;n:for(;++r<f;){var p=n[r],d=t?t(p):p;if(p=e||p!==0?p:0,o&&d===d){for(var v=c.length;v--;)if(c[v]===d)continue n;t&&c.push(d),s.push(p)}else i(c,d,e)||(c!==s&&c.push(d),s.push(p))}return s}function ei(n,t){return t=at(t,n),n=If(n,t),n==null||delete n[Gn(Cn(t))]}function nf(n,t,e,r){return se(n,t,e(At(n,t)),r)}function ze(n,t,e,r){for(var i=n.length,f=r?i:-1;(r?f--:++f<i)&&t(n[f],f,n););return e?Sn(n,r?0:f,r?f+1:i):Sn(n,r?f+1:0,r?i:f)}function tf(n,t){var e=n;return e instanceof O&&(e=e.value()),br(t,function(r,i){return i.func.apply(i.thisArg,ut([r],i.args))},e)}function ri(n,t,e){var r=n.length;if(r<2)return r?st(n[0]):[];for(var i=-1,f=h(r);++i<r;)for(var o=n[i],s=-1;++s<r;)s!=i&&(f[i]=fe(f[i]||o,n[s],t,e));return st(k(f,1),t,e)}function ef(n,t,e){for(var r=-1,i=n.length,f=t.length,o={};++r<i;){var s=r<f?t[r]:l;e(o,n[r],s)}return o}function ii(n){return H(n)?n:[]}function ui(n){return typeof n=="function"?n:ln}function at(n,t){return C(n)?n:_i(n,t)?[n]:Wf(P(n))}var ba=E;function ct(n,t,e){var r=n.length;return e=e===l?r:e,!t&&e>=r?n:Sn(n,t,e)}var rf=ws||function(n){return V.clearTimeout(n)};function uf(n,t){if(t)return n.slice();var e=n.length,r=Ru?Ru(e):new n.constructor(e);return n.copy(r),r}function fi(n){var t=new n.constructor(n.byteLength);return new be(t).set(new be(n)),t}function Wa(n,t){var e=t?fi(n.buffer):n.buffer;return new n.constructor(e,n.byteOffset,n.byteLength)}function Pa(n){var t=new n.constructor(n.source,$i.exec(n));return t.lastIndex=n.lastIndex,t}function Ma(n){return ie?F(ie.call(n)):{}}function ff(n,t){var e=t?fi(n.buffer):n.buffer;return new n.constructor(e,n.byteOffset,n.length)}function of(n,t){if(n!==t){var e=n!==l,r=n===null,i=n===n,f=hn(n),o=t!==l,s=t===null,c=t===t,_=hn(t);if(!s&&!_&&!f&&n>t||f&&o&&c&&!s&&!_||r&&o&&c||!e&&c||!i)return 1;if(!r&&!f&&!_&&n<t||_&&e&&i&&!r&&!f||s&&e&&i||!o&&i||!c)return-1}return 0}function Ba(n,t,e){for(var r=-1,i=n.criteria,f=t.criteria,o=i.length,s=e.length;++r<o;){var c=of(i[r],f[r]);if(c){if(r>=s)return c;var _=e[r];return c*(_=="desc"?-1:1)}}return n.index-t.index}function lf(n,t,e,r){for(var i=-1,f=n.length,o=e.length,s=-1,c=t.length,_=Z(f-o,0),p=h(c+_),d=!r;++s<c;)p[s]=t[s];for(;++i<o;)(d||i<f)&&(p[e[i]]=n[i]);for(;_--;)p[s++]=n[i++];return p}function sf(n,t,e,r){for(var i=-1,f=n.length,o=-1,s=e.length,c=-1,_=t.length,p=Z(f-s,0),d=h(p+_),v=!r;++i<p;)d[i]=n[i];for(var x=i;++c<_;)d[x+c]=t[c];for(;++o<s;)(v||i<f)&&(d[x+e[o]]=n[i++]);return d}function un(n,t){var e=-1,r=n.length;for(t||(t=h(r));++e<r;)t[e]=n[e];return t}function Nn(n,t,e,r){var i=!e;e||(e={});for(var f=-1,o=t.length;++f<o;){var s=t[f],c=r?r(e[s],n[s],s,e,n):l;c===l&&(c=n[s]),i?Zn(e,s,c):ue(e,s,c)}return e}function Fa(n,t){return Nn(n,gi(n),t)}function Ua(n,t){return Nn(n,yf(n),t)}function Ze(n,t){return function(e,r){var i=C(e)?Hl:ua,f=t?t():{};return i(e,n,A(r,2),f)}}function Dt(n){return E(function(t,e){var r=-1,i=e.length,f=i>1?e[i-1]:l,o=i>2?e[2]:l;for(f=n.length>3&&typeof f=="function"?(i--,f):l,o&&en(e[0],e[1],o)&&(f=i<3?l:f,i=1),t=F(t);++r<i;){var s=e[r];s&&n(t,s,r,f)}return t})}function af(n,t){return function(e,r){if(e==null)return e;if(!fn(e))return n(e,r);for(var i=e.length,f=t?i:-1,o=F(e);(t?f--:++f<i)&&r(o[f],f,o)!==!1;);return e}}function cf(n){return function(t,e,r){for(var i=-1,f=F(t),o=r(t),s=o.length;s--;){var c=o[n?s:++i];if(e(f[c],c,f)===!1)break}return t}}function Da(n,t,e){var r=t&vn,i=ae(n);function f(){var o=this&&this!==V&&this instanceof f?i:n;return o.apply(r?e:this,arguments)}return f}function hf(n){return function(t){t=P(t);var e=bt(t)?Ln(t):l,r=e?e[0]:t.charAt(0),i=e?ct(e,1).join(""):t.slice(1);return r[n]()+i}}function Nt(n){return function(t){return br(ao(so(t).replace(Il,"")),n,"")}}function ae(n){return function(){var t=arguments;switch(t.length){case 0:return new n;case 1:return new n(t[0]);case 2:return new n(t[0],t[1]);case 3:return new n(t[0],t[1],t[2]);case 4:return new n(t[0],t[1],t[2],t[3]);case 5:return new n(t[0],t[1],t[2],t[3],t[4]);case 6:return new n(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new n(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var e=Ut(n.prototype),r=n.apply(e,t);return G(r)?r:e}}function Na(n,t,e){var r=ae(n);function i(){for(var f=arguments.length,o=h(f),s=f,c=Gt(i);s--;)o[s]=arguments[s];var _=f<3&&o[0]!==c&&o[f-1]!==c?[]:ft(o,c);if(f-=_.length,f<e)return vf(n,t,Ye,i.placeholder,l,o,_,l,l,e-f);var p=this&&this!==V&&this instanceof i?r:n;return sn(p,this,o)}return i}function gf(n){return function(t,e,r){var i=F(t);if(!fn(t)){var f=A(e,3);t=J(t),e=function(s){return f(i[s],s,i)}}var o=n(t,e,r);return o>-1?i[f?t[o]:o]:l}}function _f(n){return Xn(function(t){var e=t.length,r=e,i=mn.prototype.thru;for(n&&t.reverse();r--;){var f=t[r];if(typeof f!="function")throw new An(K);if(i&&!o&&Ve(f)=="wrapper")var o=new mn([],!0)}for(r=o?r:e;++r<e;){f=t[r];var s=Ve(f),c=s=="wrapper"?ci(f):l;c&&pi(c[0])&&c[1]==(Hn|Bn|Fn|zt)&&!c[4].length&&c[9]==1?o=o[Ve(c[0])].apply(o,c[3]):o=f.length==1&&pi(f)?o[s]():o.thru(f)}return function(){var _=arguments,p=_[0];if(o&&_.length==1&&C(p))return o.plant(p).value();for(var d=0,v=e?t[d].apply(this,_):p;++d<e;)v=t[d].call(this,v);return v}})}function Ye(n,t,e,r,i,f,o,s,c,_){var p=t&Hn,d=t&vn,v=t&gt,x=t&(Bn|Rt),m=t&cr,T=v?l:ae(n);function y(){for(var L=arguments.length,b=h(L),gn=L;gn--;)b[gn]=arguments[gn];if(x)var rn=Gt(y),_n=Vl(b,rn);if(r&&(b=lf(b,r,i,x)),f&&(b=sf(b,f,o,x)),L-=_n,x&&L<_){var q=ft(b,rn);return vf(n,t,Ye,y.placeholder,e,b,q,s,c,_-L)}var Wn=d?e:this,kn=v?Wn[n]:n;return L=b.length,s?b=uc(b,s):m&&L>1&&b.reverse(),p&&c<L&&(b.length=c),this&&this!==V&&this instanceof y&&(kn=T||ae(kn)),kn.apply(Wn,b)}return y}function pf(n,t){return function(e,r){return ga(e,n,t(r),{})}}function Xe(n,t){return function(e,r){var i;if(e===l&&r===l)return t;if(e!==l&&(i=e),r!==l){if(i===l)return r;typeof e=="string"||typeof r=="string"?(e=cn(e),r=cn(r)):(e=ju(e),r=ju(r)),i=n(e,r)}return i}}function oi(n){return Xn(function(t){return t=N(t,an(A())),E(function(e){var r=this;return n(t,function(i){return sn(i,r,e)})})})}function Je(n,t){t=t===l?" ":cn(t);var e=t.length;if(e<2)return e?ni(t,n):t;var r=ni(t,Be(n/Wt(t)));return bt(t)?ct(Ln(r),0,n).join(""):r.slice(0,n)}function Ga(n,t,e,r){var i=t&vn,f=ae(n);function o(){for(var s=-1,c=arguments.length,_=-1,p=r.length,d=h(p+c),v=this&&this!==V&&this instanceof o?f:n;++_<p;)d[_]=r[_];for(;c--;)d[_++]=arguments[++s];return sn(v,i?e:this,d)}return o}function df(n){return function(t,e,r){return r&&typeof r!="number"&&en(t,e,r)&&(e=r=l),t=Vn(t),e===l?(e=t,t=0):e=Vn(e),r=r===l?t<e?1:-1:Vn(r),Ra(t,e,r,n)}}function Qe(n){return function(t,e){return typeof t=="string"&&typeof e=="string"||(t=Rn(t),e=Rn(e)),n(t,e)}}function vf(n,t,e,r,i,f,o,s,c,_){var p=t&Bn,d=p?o:l,v=p?l:o,x=p?f:l,m=p?l:f;t|=p?Fn:Tt,t&=~(p?Tt:Fn),t&Mi||(t&=~(vn|gt));var T=[n,t,i,x,d,m,v,s,c,_],y=e.apply(l,T);return pi(n)&&Lf(y,T),y.placeholder=r,Of(y,n,t)}function li(n){var t=z[n];return function(e,r){if(e=Rn(e),r=r==null?0:j(R(r),292),r&&Lu(e)){var i=(P(e)+"e").split("e"),f=t(i[0]+"e"+(+i[1]+r));return i=(P(f)+"e").split("e"),+(i[0]+"e"+(+i[1]-r))}return t(e)}}var $a=Bt&&1/Re(new Bt([,-0]))[1]==_t?function(n){return new Bt(n)}:Oi;function wf(n){return function(t){var e=nn(t);return e==En?Dr(t):e==In?is(t):Ql(t,n(t))}}function Yn(n,t,e,r,i,f,o,s){var c=t&gt;if(!c&&typeof n!="function")throw new An(K);var _=r?r.length:0;if(_||(t&=~(Fn|Tt),r=i=l),o=o===l?o:Z(R(o),0),s=s===l?s:R(s),_-=i?i.length:0,t&Tt){var p=r,d=i;r=i=l}var v=c?l:ci(n),x=[n,t,e,r,i,p,d,f,o,s];if(v&&ec(x,v),n=x[0],t=x[1],e=x[2],r=x[3],i=x[4],s=x[9]=x[9]===l?c?0:n.length:Z(x[9]-_,0),!s&&t&(Bn|Rt)&&(t&=~(Bn|Rt)),!t||t==vn)var m=Da(n,t,e);else t==Bn||t==Rt?m=Na(n,t,s):(t==Fn||t==(vn|Fn))&&!i.length?m=Ga(n,t,e,r):m=Ye.apply(l,x);var T=v?Vu:Lf;return Of(T(m,x),n,t)}function xf(n,t,e,r){return n===l||bn(n,Mt[e])&&!B.call(r,e)?t:n}function Af(n,t,e,r,i,f){return G(n)&&G(t)&&(f.set(t,n),qe(n,t,l,Af,f),f.delete(t)),n}function Ha(n){return ge(n)?l:n}function mf(n,t,e,r,i,f){var o=e&$n,s=n.length,c=t.length;if(s!=c&&!(o&&c>s))return!1;var _=f.get(n),p=f.get(t);if(_&&p)return _==t&&p==n;var d=-1,v=!0,x=e&_e?new wt:l;for(f.set(n,t),f.set(t,n);++d<s;){var m=n[d],T=t[d];if(r)var y=o?r(T,m,d,t,n,f):r(m,T,d,n,t,f);if(y!==l){if(y)continue;v=!1;break}if(x){if(!Wr(t,function(L,b){if(!jt(x,b)&&(m===L||i(m,L,e,r,f)))return x.push(b)})){v=!1;break}}else if(!(m===T||i(m,T,e,r,f))){v=!1;break}}return f.delete(n),f.delete(t),v}function qa(n,t,e,r,i,f,o){switch(e){case It:if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)return!1;n=n.buffer,t=t.buffer;case kt:return!(n.byteLength!=t.byteLength||!f(new be(n),new be(t)));case Zt:case Yt:case Xt:return bn(+n,+t);case ve:return n.name==t.name&&n.message==t.message;case Jt:case Qt:return n==t+"";case En:var s=Dr;case In:var c=r&$n;if(s||(s=Re),n.size!=t.size&&!c)return!1;var _=o.get(n);if(_)return _==t;r|=_e,o.set(n,t);var p=mf(s(n),s(t),r,i,f,o);return o.delete(n),p;case xe:if(ie)return ie.call(n)==ie.call(t)}return!1}function Ka(n,t,e,r,i,f){var o=e&$n,s=si(n),c=s.length,_=si(t),p=_.length;if(c!=p&&!o)return!1;for(var d=c;d--;){var v=s[d];if(!(o?v in t:B.call(t,v)))return!1}var x=f.get(n),m=f.get(t);if(x&&m)return x==t&&m==n;var T=!0;f.set(n,t),f.set(t,n);for(var y=o;++d<c;){v=s[d];var L=n[v],b=t[v];if(r)var gn=o?r(b,L,v,t,n,f):r(L,b,v,n,t,f);if(!(gn===l?L===b||i(L,b,e,r,f):gn)){T=!1;break}y||(y=v=="constructor")}if(T&&!y){var rn=n.constructor,_n=t.constructor;rn!=_n&&"constructor"in n&&"constructor"in t&&!(typeof rn=="function"&&rn instanceof rn&&typeof _n=="function"&&_n instanceof _n)&&(T=!1)}return f.delete(n),f.delete(t),T}function Xn(n){return vi(Ef(n,l,Ff),n+"")}function si(n){return Gu(n,J,gi)}function ai(n){return Gu(n,on,yf)}var ci=Ue?function(n){return Ue.get(n)}:Oi;function Ve(n){for(var t=n.name+"",e=Ft[t],r=B.call(Ft,t)?e.length:0;r--;){var i=e[r],f=i.func;if(f==null||f==n)return i.name}return t}function Gt(n){var t=B.call(u,"placeholder")?u:n;return t.placeholder}function A(){var n=u.iteratee||Ii;return n=n===Ii?qu:n,arguments.length?n(arguments[0],arguments[1]):n}function ke(n,t){var e=n.__data__;return ka(t)?e[typeof t=="string"?"string":"hash"]:e.map}function hi(n){for(var t=J(n),e=t.length;e--;){var r=t[e],i=n[r];t[e]=[r,i,Rf(i)]}return t}function mt(n,t){var e=ts(n,t);return Hu(e)?e:l}function za(n){var t=B.call(n,dt),e=n[dt];try{n[dt]=l;var r=!0}catch{}var i=Le.call(n);return r&&(t?n[dt]=e:delete n[dt]),i}var gi=Gr?function(n){return n==null?[]:(n=F(n),it(Gr(n),function(t){return Eu.call(n,t)}))}:bi,yf=Gr?function(n){for(var t=[];n;)ut(t,gi(n)),n=We(n);return t}:bi,nn=tn;($r&&nn(new $r(new ArrayBuffer(1)))!=It||te&&nn(new te)!=En||Hr&&nn(Hr.resolve())!=Ui||Bt&&nn(new Bt)!=In||ee&&nn(new ee)!=Vt)&&(nn=function(n){var t=tn(n),e=t==qn?n.constructor:l,r=e?yt(e):"";if(r)switch(r){case Es:return It;case Is:return En;case Ls:return Ui;case Os:return In;case bs:return Vt}return t});function Za(n,t,e){for(var r=-1,i=e.length;++r<i;){var f=e[r],o=f.size;switch(f.type){case"drop":n+=o;break;case"dropRight":t-=o;break;case"take":t=j(t,n+o);break;case"takeRight":n=Z(n,t-o);break}}return{start:n,end:t}}function Ya(n){var t=n.match(jo);return t?t[1].split(nl):[]}function Sf(n,t,e){t=at(t,n);for(var r=-1,i=t.length,f=!1;++r<i;){var o=Gn(t[r]);if(!(f=n!=null&&e(n,o)))break;n=n[o]}return f||++r!=i?f:(i=n==null?0:n.length,!!i&&ur(i)&&Jn(o,i)&&(C(n)||St(n)))}function Xa(n){var t=n.length,e=new n.constructor(t);return t&&typeof n[0]=="string"&&B.call(n,"index")&&(e.index=n.index,e.input=n.input),e}function Cf(n){return typeof n.constructor=="function"&&!ce(n)?Ut(We(n)):{}}function Ja(n,t,e){var r=n.constructor;switch(t){case kt:return fi(n);case Zt:case Yt:return new r(+n);case It:return Wa(n,e);case hr:case gr:case _r:case pr:case dr:case vr:case wr:case xr:case Ar:return ff(n,e);case En:return new r;case Xt:case Qt:return new r(n);case Jt:return Pa(n);case In:return new r;case xe:return Ma(n)}}function Qa(n,t){var e=t.length;if(!e)return n;var r=e-1;return t[r]=(e>1?"& ":"")+t[r],t=t.join(e>2?", ":" "),n.replace(ko,`{
9
+ /* [wrapped with `+t+`] */
10
+ `)}function Va(n){return C(n)||St(n)||!!(Iu&&n&&n[Iu])}function Jn(n,t){var e=typeof n;return t=t??rt,!!t&&(e=="number"||e!="symbol"&&sl.test(n))&&n>-1&&n%1==0&&n<t}function en(n,t,e){if(!G(e))return!1;var r=typeof t;return(r=="number"?fn(e)&&Jn(t,e.length):r=="string"&&t in e)?bn(e[t],n):!1}function _i(n,t){if(C(n))return!1;var e=typeof n;return e=="number"||e=="symbol"||e=="boolean"||n==null||hn(n)?!0:Xo.test(n)||!Yo.test(n)||t!=null&&n in F(t)}function ka(n){var t=typeof n;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?n!=="__proto__":n===null}function pi(n){var t=Ve(n),e=u[t];if(typeof e!="function"||!(t in O.prototype))return!1;if(n===e)return!0;var r=ci(e);return!!r&&n===r[0]}function ja(n){return!!Cu&&Cu in n}var nc=Ee?Qn:Wi;function ce(n){var t=n&&n.constructor,e=typeof t=="function"&&t.prototype||Mt;return n===e}function Rf(n){return n===n&&!G(n)}function Tf(n,t){return function(e){return e==null?!1:e[n]===t&&(t!==l||n in F(e))}}function tc(n){var t=rr(n,function(r){return e.size===Mn&&e.clear(),r}),e=t.cache;return t}function ec(n,t){var e=n[1],r=t[1],i=e|r,f=i<(vn|gt|Hn),o=r==Hn&&e==Bn||r==Hn&&e==zt&&n[7].length<=t[8]||r==(Hn|zt)&&t[7].length<=t[8]&&e==Bn;if(!(f||o))return n;r&vn&&(n[2]=t[2],i|=e&vn?0:Mi);var s=t[3];if(s){var c=n[3];n[3]=c?lf(c,s,t[4]):s,n[4]=c?ft(n[3],Ct):t[4]}return s=t[5],s&&(c=n[5],n[5]=c?sf(c,s,t[6]):s,n[6]=c?ft(n[5],Ct):t[6]),s=t[7],s&&(n[7]=s),r&Hn&&(n[8]=n[8]==null?t[8]:j(n[8],t[8])),n[9]==null&&(n[9]=t[9]),n[0]=t[0],n[1]=i,n}function rc(n){var t=[];if(n!=null)for(var e in F(n))t.push(e);return t}function ic(n){return Le.call(n)}function Ef(n,t,e){return t=Z(t===l?n.length-1:t,0),function(){for(var r=arguments,i=-1,f=Z(r.length-t,0),o=h(f);++i<f;)o[i]=r[t+i];i=-1;for(var s=h(t+1);++i<t;)s[i]=r[i];return s[t]=e(o),sn(n,this,s)}}function If(n,t){return t.length<2?n:At(n,Sn(t,0,-1))}function uc(n,t){for(var e=n.length,r=j(t.length,e),i=un(n);r--;){var f=t[r];n[r]=Jn(f,e)?i[f]:l}return n}function di(n,t){if(!(t==="constructor"&&typeof n[t]=="function")&&t!="__proto__")return n[t]}var Lf=bf(Vu),he=As||function(n,t){return V.setTimeout(n,t)},vi=bf(Ia);function Of(n,t,e){var r=t+"";return vi(n,Qa(r,fc(Ya(r),e)))}function bf(n){var t=0,e=0;return function(){var r=Cs(),i=Eo-(r-e);if(e=r,i>0){if(++t>=To)return arguments[0]}else t=0;return n.apply(l,arguments)}}function je(n,t){var e=-1,r=n.length,i=r-1;for(t=t===l?r:t;++e<t;){var f=jr(e,i),o=n[f];n[f]=n[e],n[e]=o}return n.length=t,n}var Wf=tc(function(n){var t=[];return n.charCodeAt(0)===46&&t.push(""),n.replace(Jo,function(e,r,i,f){t.push(i?f.replace(rl,"$1"):r||e)}),t});function Gn(n){if(typeof n=="string"||hn(n))return n;var t=n+"";return t=="0"&&1/n==-_t?"-0":t}function yt(n){if(n!=null){try{return Ie.call(n)}catch{}try{return n+""}catch{}}return""}function fc(n,t){return xn(Po,function(e){var r="_."+e[0];t&e[1]&&!Se(n,r)&&n.push(r)}),n.sort()}function Pf(n){if(n instanceof O)return n.clone();var t=new mn(n.__wrapped__,n.__chain__);return t.__actions__=un(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}function oc(n,t,e){(e?en(n,t,e):t===l)?t=1:t=Z(R(t),0);var r=n==null?0:n.length;if(!r||t<1)return[];for(var i=0,f=0,o=h(Be(r/t));i<r;)o[f++]=Sn(n,i,i+=t);return o}function lc(n){for(var t=-1,e=n==null?0:n.length,r=0,i=[];++t<e;){var f=n[t];f&&(i[r++]=f)}return i}function sc(){var n=arguments.length;if(!n)return[];for(var t=h(n-1),e=arguments[0],r=n;r--;)t[r-1]=arguments[r];return ut(C(e)?un(e):[e],k(t,1))}var ac=E(function(n,t){return H(n)?fe(n,k(t,1,H,!0)):[]}),cc=E(function(n,t){var e=Cn(t);return H(e)&&(e=l),H(n)?fe(n,k(t,1,H,!0),A(e,2)):[]}),hc=E(function(n,t){var e=Cn(t);return H(e)&&(e=l),H(n)?fe(n,k(t,1,H,!0),l,e):[]});function gc(n,t,e){var r=n==null?0:n.length;return r?(t=e||t===l?1:R(t),Sn(n,t<0?0:t,r)):[]}function _c(n,t,e){var r=n==null?0:n.length;return r?(t=e||t===l?1:R(t),t=r-t,Sn(n,0,t<0?0:t)):[]}function pc(n,t){return n&&n.length?ze(n,A(t,3),!0,!0):[]}function dc(n,t){return n&&n.length?ze(n,A(t,3),!0):[]}function vc(n,t,e,r){var i=n==null?0:n.length;return i?(e&&typeof e!="number"&&en(n,t,e)&&(e=0,r=i),sa(n,t,e,r)):[]}function Mf(n,t,e){var r=n==null?0:n.length;if(!r)return-1;var i=e==null?0:R(e);return i<0&&(i=Z(r+i,0)),Ce(n,A(t,3),i)}function Bf(n,t,e){var r=n==null?0:n.length;if(!r)return-1;var i=r-1;return e!==l&&(i=R(e),i=e<0?Z(r+i,0):j(i,r-1)),Ce(n,A(t,3),i,!0)}function Ff(n){var t=n==null?0:n.length;return t?k(n,1):[]}function wc(n){var t=n==null?0:n.length;return t?k(n,_t):[]}function xc(n,t){var e=n==null?0:n.length;return e?(t=t===l?1:R(t),k(n,t)):[]}function Ac(n){for(var t=-1,e=n==null?0:n.length,r={};++t<e;){var i=n[t];r[i[0]]=i[1]}return r}function Uf(n){return n&&n.length?n[0]:l}function mc(n,t,e){var r=n==null?0:n.length;if(!r)return-1;var i=e==null?0:R(e);return i<0&&(i=Z(r+i,0)),Ot(n,t,i)}function yc(n){var t=n==null?0:n.length;return t?Sn(n,0,-1):[]}var Sc=E(function(n){var t=N(n,ii);return t.length&&t[0]===n[0]?Xr(t):[]}),Cc=E(function(n){var t=Cn(n),e=N(n,ii);return t===Cn(e)?t=l:e.pop(),e.length&&e[0]===n[0]?Xr(e,A(t,2)):[]}),Rc=E(function(n){var t=Cn(n),e=N(n,ii);return t=typeof t=="function"?t:l,t&&e.pop(),e.length&&e[0]===n[0]?Xr(e,l,t):[]});function Tc(n,t){return n==null?"":ys.call(n,t)}function Cn(n){var t=n==null?0:n.length;return t?n[t-1]:l}function Ec(n,t,e){var r=n==null?0:n.length;if(!r)return-1;var i=r;return e!==l&&(i=R(e),i=i<0?Z(r+i,0):j(i,r-1)),t===t?fs(n,t,i):Ce(n,du,i,!0)}function Ic(n,t){return n&&n.length?Yu(n,R(t)):l}var Lc=E(Df);function Df(n,t){return n&&n.length&&t&&t.length?kr(n,t):n}function Oc(n,t,e){return n&&n.length&&t&&t.length?kr(n,t,A(e,2)):n}function bc(n,t,e){return n&&n.length&&t&&t.length?kr(n,t,l,e):n}var Wc=Xn(function(n,t){var e=n==null?0:n.length,r=Kr(n,t);return Qu(n,N(t,function(i){return Jn(i,e)?+i:i}).sort(of)),r});function Pc(n,t){var e=[];if(!(n&&n.length))return e;var r=-1,i=[],f=n.length;for(t=A(t,3);++r<f;){var o=n[r];t(o,r,n)&&(e.push(o),i.push(r))}return Qu(n,i),e}function wi(n){return n==null?n:Ts.call(n)}function Mc(n,t,e){var r=n==null?0:n.length;return r?(e&&typeof e!="number"&&en(n,t,e)?(t=0,e=r):(t=t==null?0:R(t),e=e===l?r:R(e)),Sn(n,t,e)):[]}function Bc(n,t){return Ke(n,t)}function Fc(n,t,e){return ti(n,t,A(e,2))}function Uc(n,t){var e=n==null?0:n.length;if(e){var r=Ke(n,t);if(r<e&&bn(n[r],t))return r}return-1}function Dc(n,t){return Ke(n,t,!0)}function Nc(n,t,e){return ti(n,t,A(e,2),!0)}function Gc(n,t){var e=n==null?0:n.length;if(e){var r=Ke(n,t,!0)-1;if(bn(n[r],t))return r}return-1}function $c(n){return n&&n.length?ku(n):[]}function Hc(n,t){return n&&n.length?ku(n,A(t,2)):[]}function qc(n){var t=n==null?0:n.length;return t?Sn(n,1,t):[]}function Kc(n,t,e){return n&&n.length?(t=e||t===l?1:R(t),Sn(n,0,t<0?0:t)):[]}function zc(n,t,e){var r=n==null?0:n.length;return r?(t=e||t===l?1:R(t),t=r-t,Sn(n,t<0?0:t,r)):[]}function Zc(n,t){return n&&n.length?ze(n,A(t,3),!1,!0):[]}function Yc(n,t){return n&&n.length?ze(n,A(t,3)):[]}var Xc=E(function(n){return st(k(n,1,H,!0))}),Jc=E(function(n){var t=Cn(n);return H(t)&&(t=l),st(k(n,1,H,!0),A(t,2))}),Qc=E(function(n){var t=Cn(n);return t=typeof t=="function"?t:l,st(k(n,1,H,!0),l,t)});function Vc(n){return n&&n.length?st(n):[]}function kc(n,t){return n&&n.length?st(n,A(t,2)):[]}function jc(n,t){return t=typeof t=="function"?t:l,n&&n.length?st(n,l,t):[]}function xi(n){if(!(n&&n.length))return[];var t=0;return n=it(n,function(e){if(H(e))return t=Z(e.length,t),!0}),Fr(t,function(e){return N(n,Pr(e))})}function Nf(n,t){if(!(n&&n.length))return[];var e=xi(n);return t==null?e:N(e,function(r){return sn(t,l,r)})}var nh=E(function(n,t){return H(n)?fe(n,t):[]}),th=E(function(n){return ri(it(n,H))}),eh=E(function(n){var t=Cn(n);return H(t)&&(t=l),ri(it(n,H),A(t,2))}),rh=E(function(n){var t=Cn(n);return t=typeof t=="function"?t:l,ri(it(n,H),l,t)}),ih=E(xi);function uh(n,t){return ef(n||[],t||[],ue)}function fh(n,t){return ef(n||[],t||[],se)}var oh=E(function(n){var t=n.length,e=t>1?n[t-1]:l;return e=typeof e=="function"?(n.pop(),e):l,Nf(n,e)});function Gf(n){var t=u(n);return t.__chain__=!0,t}function lh(n,t){return t(n),n}function nr(n,t){return t(n)}var sh=Xn(function(n){var t=n.length,e=t?n[0]:0,r=this.__wrapped__,i=function(f){return Kr(f,n)};return t>1||this.__actions__.length||!(r instanceof O)||!Jn(e)?this.thru(i):(r=r.slice(e,+e+(t?1:0)),r.__actions__.push({func:nr,args:[i],thisArg:l}),new mn(r,this.__chain__).thru(function(f){return t&&!f.length&&f.push(l),f}))});function ah(){return Gf(this)}function ch(){return new mn(this.value(),this.__chain__)}function hh(){this.__values__===l&&(this.__values__=no(this.value()));var n=this.__index__>=this.__values__.length,t=n?l:this.__values__[this.__index__++];return{done:n,value:t}}function gh(){return this}function _h(n){for(var t,e=this;e instanceof Ne;){var r=Pf(e);r.__index__=0,r.__values__=l,t?i.__wrapped__=r:t=r;var i=r;e=e.__wrapped__}return i.__wrapped__=n,t}function ph(){var n=this.__wrapped__;if(n instanceof O){var t=n;return this.__actions__.length&&(t=new O(this)),t=t.reverse(),t.__actions__.push({func:nr,args:[wi],thisArg:l}),new mn(t,this.__chain__)}return this.thru(wi)}function dh(){return tf(this.__wrapped__,this.__actions__)}var vh=Ze(function(n,t,e){B.call(n,e)?++n[e]:Zn(n,e,1)});function wh(n,t,e){var r=C(n)?_u:la;return e&&en(n,t,e)&&(t=l),r(n,A(t,3))}function xh(n,t){var e=C(n)?it:Du;return e(n,A(t,3))}var Ah=gf(Mf),mh=gf(Bf);function yh(n,t){return k(tr(n,t),1)}function Sh(n,t){return k(tr(n,t),_t)}function Ch(n,t,e){return e=e===l?1:R(e),k(tr(n,t),e)}function $f(n,t){var e=C(n)?xn:lt;return e(n,A(t,3))}function Hf(n,t){var e=C(n)?ql:Uu;return e(n,A(t,3))}var Rh=Ze(function(n,t,e){B.call(n,e)?n[e].push(t):Zn(n,e,[t])});function Th(n,t,e,r){n=fn(n)?n:Ht(n),e=e&&!r?R(e):0;var i=n.length;return e<0&&(e=Z(i+e,0)),fr(n)?e<=i&&n.indexOf(t,e)>-1:!!i&&Ot(n,t,e)>-1}var Eh=E(function(n,t,e){var r=-1,i=typeof t=="function",f=fn(n)?h(n.length):[];return lt(n,function(o){f[++r]=i?sn(t,o,e):oe(o,t,e)}),f}),Ih=Ze(function(n,t,e){Zn(n,e,t)});function tr(n,t){var e=C(n)?N:Ku;return e(n,A(t,3))}function Lh(n,t,e,r){return n==null?[]:(C(t)||(t=t==null?[]:[t]),e=r?l:e,C(e)||(e=e==null?[]:[e]),Xu(n,t,e))}var Oh=Ze(function(n,t,e){n[e?0:1].push(t)},function(){return[[],[]]});function bh(n,t,e){var r=C(n)?br:wu,i=arguments.length<3;return r(n,A(t,4),e,i,lt)}function Wh(n,t,e){var r=C(n)?Kl:wu,i=arguments.length<3;return r(n,A(t,4),e,i,Uu)}function Ph(n,t){var e=C(n)?it:Du;return e(n,ir(A(t,3)))}function Mh(n){var t=C(n)?Pu:Ta;return t(n)}function Bh(n,t,e){(e?en(n,t,e):t===l)?t=1:t=R(t);var r=C(n)?ra:Ea;return r(n,t)}function Fh(n){var t=C(n)?ia:La;return t(n)}function Uh(n){if(n==null)return 0;if(fn(n))return fr(n)?Wt(n):n.length;var t=nn(n);return t==En||t==In?n.size:Qr(n).length}function Dh(n,t,e){var r=C(n)?Wr:Oa;return e&&en(n,t,e)&&(t=l),r(n,A(t,3))}var Nh=E(function(n,t){if(n==null)return[];var e=t.length;return e>1&&en(n,t[0],t[1])?t=[]:e>2&&en(t[0],t[1],t[2])&&(t=[t[0]]),Xu(n,k(t,1),[])}),er=xs||function(){return V.Date.now()};function Gh(n,t){if(typeof t!="function")throw new An(K);return n=R(n),function(){if(--n<1)return t.apply(this,arguments)}}function qf(n,t,e){return t=e?l:t,t=n&&t==null?n.length:t,Yn(n,Hn,l,l,l,l,t)}function Kf(n,t){var e;if(typeof t!="function")throw new An(K);return n=R(n),function(){return--n>0&&(e=t.apply(this,arguments)),n<=1&&(t=l),e}}var Ai=E(function(n,t,e){var r=vn;if(e.length){var i=ft(e,Gt(Ai));r|=Fn}return Yn(n,r,t,e,i)}),zf=E(function(n,t,e){var r=vn|gt;if(e.length){var i=ft(e,Gt(zf));r|=Fn}return Yn(t,r,n,e,i)});function Zf(n,t,e){t=e?l:t;var r=Yn(n,Bn,l,l,l,l,l,t);return r.placeholder=Zf.placeholder,r}function Yf(n,t,e){t=e?l:t;var r=Yn(n,Rt,l,l,l,l,l,t);return r.placeholder=Yf.placeholder,r}function Xf(n,t,e){var r,i,f,o,s,c,_=0,p=!1,d=!1,v=!0;if(typeof n!="function")throw new An(K);t=Rn(t)||0,G(e)&&(p=!!e.leading,d="maxWait"in e,f=d?Z(Rn(e.maxWait)||0,t):f,v="trailing"in e?!!e.trailing:v);function x(q){var Wn=r,kn=i;return r=i=l,_=q,o=n.apply(kn,Wn),o}function m(q){return _=q,s=he(L,t),p?x(q):o}function T(q){var Wn=q-c,kn=q-_,go=t-Wn;return d?j(go,f-kn):go}function y(q){var Wn=q-c,kn=q-_;return c===l||Wn>=t||Wn<0||d&&kn>=f}function L(){var q=er();if(y(q))return b(q);s=he(L,T(q))}function b(q){return s=l,v&&r?x(q):(r=i=l,o)}function gn(){s!==l&&rf(s),_=0,r=c=i=s=l}function rn(){return s===l?o:b(er())}function _n(){var q=er(),Wn=y(q);if(r=arguments,i=this,c=q,Wn){if(s===l)return m(c);if(d)return rf(s),s=he(L,t),x(c)}return s===l&&(s=he(L,t)),o}return _n.cancel=gn,_n.flush=rn,_n}var $h=E(function(n,t){return Fu(n,1,t)}),Hh=E(function(n,t,e){return Fu(n,Rn(t)||0,e)});function qh(n){return Yn(n,cr)}function rr(n,t){if(typeof n!="function"||t!=null&&typeof t!="function")throw new An(K);var e=function(){var r=arguments,i=t?t.apply(this,r):r[0],f=e.cache;if(f.has(i))return f.get(i);var o=n.apply(this,r);return e.cache=f.set(i,o)||f,o};return e.cache=new(rr.Cache||zn),e}rr.Cache=zn;function ir(n){if(typeof n!="function")throw new An(K);return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function Kh(n){return Kf(2,n)}var zh=ba(function(n,t){t=t.length==1&&C(t[0])?N(t[0],an(A())):N(k(t,1),an(A()));var e=t.length;return E(function(r){for(var i=-1,f=j(r.length,e);++i<f;)r[i]=t[i].call(this,r[i]);return sn(n,this,r)})}),mi=E(function(n,t){var e=ft(t,Gt(mi));return Yn(n,Fn,l,t,e)}),Jf=E(function(n,t){var e=ft(t,Gt(Jf));return Yn(n,Tt,l,t,e)}),Zh=Xn(function(n,t){return Yn(n,zt,l,l,l,t)});function Yh(n,t){if(typeof n!="function")throw new An(K);return t=t===l?t:R(t),E(n,t)}function Xh(n,t){if(typeof n!="function")throw new An(K);return t=t==null?0:Z(R(t),0),E(function(e){var r=e[t],i=ct(e,0,t);return r&&ut(i,r),sn(n,this,i)})}function Jh(n,t,e){var r=!0,i=!0;if(typeof n!="function")throw new An(K);return G(e)&&(r="leading"in e?!!e.leading:r,i="trailing"in e?!!e.trailing:i),Xf(n,t,{leading:r,maxWait:t,trailing:i})}function Qh(n){return qf(n,1)}function Vh(n,t){return mi(ui(t),n)}function kh(){if(!arguments.length)return[];var n=arguments[0];return C(n)?n:[n]}function jh(n){return yn(n,et)}function ng(n,t){return t=typeof t=="function"?t:l,yn(n,et,t)}function tg(n){return yn(n,Tn|et)}function eg(n,t){return t=typeof t=="function"?t:l,yn(n,Tn|et,t)}function rg(n,t){return t==null||Bu(n,t,J(t))}function bn(n,t){return n===t||n!==n&&t!==t}var ig=Qe(Yr),ug=Qe(function(n,t){return n>=t}),St=$u(function(){return arguments}())?$u:function(n){return $(n)&&B.call(n,"callee")&&!Eu.call(n,"callee")},C=h.isArray,fg=lu?an(lu):_a;function fn(n){return n!=null&&ur(n.length)&&!Qn(n)}function H(n){return $(n)&&fn(n)}function og(n){return n===!0||n===!1||$(n)&&tn(n)==Zt}var ht=ms||Wi,lg=su?an(su):pa;function sg(n){return $(n)&&n.nodeType===1&&!ge(n)}function ag(n){if(n==null)return!0;if(fn(n)&&(C(n)||typeof n=="string"||typeof n.splice=="function"||ht(n)||$t(n)||St(n)))return!n.length;var t=nn(n);if(t==En||t==In)return!n.size;if(ce(n))return!Qr(n).length;for(var e in n)if(B.call(n,e))return!1;return!0}function cg(n,t){return le(n,t)}function hg(n,t,e){e=typeof e=="function"?e:l;var r=e?e(n,t):l;return r===l?le(n,t,l,e):!!r}function yi(n){if(!$(n))return!1;var t=tn(n);return t==ve||t==Bo||typeof n.message=="string"&&typeof n.name=="string"&&!ge(n)}function gg(n){return typeof n=="number"&&Lu(n)}function Qn(n){if(!G(n))return!1;var t=tn(n);return t==we||t==Fi||t==Mo||t==Uo}function Qf(n){return typeof n=="number"&&n==R(n)}function ur(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=rt}function G(n){var t=typeof n;return n!=null&&(t=="object"||t=="function")}function $(n){return n!=null&&typeof n=="object"}var Vf=au?an(au):va;function _g(n,t){return n===t||Jr(n,t,hi(t))}function pg(n,t,e){return e=typeof e=="function"?e:l,Jr(n,t,hi(t),e)}function dg(n){return kf(n)&&n!=+n}function vg(n){if(nc(n))throw new S(tt);return Hu(n)}function wg(n){return n===null}function xg(n){return n==null}function kf(n){return typeof n=="number"||$(n)&&tn(n)==Xt}function ge(n){if(!$(n)||tn(n)!=qn)return!1;var t=We(n);if(t===null)return!0;var e=B.call(t,"constructor")&&t.constructor;return typeof e=="function"&&e instanceof e&&Ie.call(e)==ps}var Si=cu?an(cu):wa;function Ag(n){return Qf(n)&&n>=-rt&&n<=rt}var jf=hu?an(hu):xa;function fr(n){return typeof n=="string"||!C(n)&&$(n)&&tn(n)==Qt}function hn(n){return typeof n=="symbol"||$(n)&&tn(n)==xe}var $t=gu?an(gu):Aa;function mg(n){return n===l}function yg(n){return $(n)&&nn(n)==Vt}function Sg(n){return $(n)&&tn(n)==No}var Cg=Qe(Vr),Rg=Qe(function(n,t){return n<=t});function no(n){if(!n)return[];if(fn(n))return fr(n)?Ln(n):un(n);if(ne&&n[ne])return rs(n[ne]());var t=nn(n),e=t==En?Dr:t==In?Re:Ht;return e(n)}function Vn(n){if(!n)return n===0?n:0;if(n=Rn(n),n===_t||n===-_t){var t=n<0?-1:1;return t*Oo}return n===n?n:0}function R(n){var t=Vn(n),e=t%1;return t===t?e?t-e:t:0}function to(n){return n?xt(R(n),0,Un):0}function Rn(n){if(typeof n=="number")return n;if(hn(n))return pe;if(G(n)){var t=typeof n.valueOf=="function"?n.valueOf():n;n=G(t)?t+"":t}if(typeof n!="string")return n===0?n:+n;n=xu(n);var e=fl.test(n);return e||ll.test(n)?Gl(n.slice(2),e?2:8):ul.test(n)?pe:+n}function eo(n){return Nn(n,on(n))}function Tg(n){return n?xt(R(n),-rt,rt):n===0?n:0}function P(n){return n==null?"":cn(n)}var Eg=Dt(function(n,t){if(ce(t)||fn(t)){Nn(t,J(t),n);return}for(var e in t)B.call(t,e)&&ue(n,e,t[e])}),ro=Dt(function(n,t){Nn(t,on(t),n)}),or=Dt(function(n,t,e,r){Nn(t,on(t),n,r)}),Ig=Dt(function(n,t,e,r){Nn(t,J(t),n,r)}),Lg=Xn(Kr);function Og(n,t){var e=Ut(n);return t==null?e:Mu(e,t)}var bg=E(function(n,t){n=F(n);var e=-1,r=t.length,i=r>2?t[2]:l;for(i&&en(t[0],t[1],i)&&(r=1);++e<r;)for(var f=t[e],o=on(f),s=-1,c=o.length;++s<c;){var _=o[s],p=n[_];(p===l||bn(p,Mt[_])&&!B.call(n,_))&&(n[_]=f[_])}return n}),Wg=E(function(n){return n.push(l,Af),sn(io,l,n)});function Pg(n,t){return pu(n,A(t,3),Dn)}function Mg(n,t){return pu(n,A(t,3),Zr)}function Bg(n,t){return n==null?n:zr(n,A(t,3),on)}function Fg(n,t){return n==null?n:Nu(n,A(t,3),on)}function Ug(n,t){return n&&Dn(n,A(t,3))}function Dg(n,t){return n&&Zr(n,A(t,3))}function Ng(n){return n==null?[]:He(n,J(n))}function Gg(n){return n==null?[]:He(n,on(n))}function Ci(n,t,e){var r=n==null?l:At(n,t);return r===l?e:r}function $g(n,t){return n!=null&&Sf(n,t,aa)}function Ri(n,t){return n!=null&&Sf(n,t,ca)}var Hg=pf(function(n,t,e){t!=null&&typeof t.toString!="function"&&(t=Le.call(t)),n[t]=e},Ei(ln)),qg=pf(function(n,t,e){t!=null&&typeof t.toString!="function"&&(t=Le.call(t)),B.call(n,t)?n[t].push(e):n[t]=[e]},A),Kg=E(oe);function J(n){return fn(n)?Wu(n):Qr(n)}function on(n){return fn(n)?Wu(n,!0):ma(n)}function zg(n,t){var e={};return t=A(t,3),Dn(n,function(r,i,f){Zn(e,t(r,i,f),r)}),e}function Zg(n,t){var e={};return t=A(t,3),Dn(n,function(r,i,f){Zn(e,i,t(r,i,f))}),e}var Yg=Dt(function(n,t,e){qe(n,t,e)}),io=Dt(function(n,t,e,r){qe(n,t,e,r)}),Xg=Xn(function(n,t){var e={};if(n==null)return e;var r=!1;t=N(t,function(f){return f=at(f,n),r||(r=f.length>1),f}),Nn(n,ai(n),e),r&&(e=yn(e,Tn|dn|et,Ha));for(var i=t.length;i--;)ei(e,t[i]);return e});function Jg(n,t){return uo(n,ir(A(t)))}var Qg=Xn(function(n,t){return n==null?{}:Sa(n,t)});function uo(n,t){if(n==null)return{};var e=N(ai(n),function(r){return[r]});return t=A(t),Ju(n,e,function(r,i){return t(r,i[0])})}function Vg(n,t,e){t=at(t,n);var r=-1,i=t.length;for(i||(i=1,n=l);++r<i;){var f=n==null?l:n[Gn(t[r])];f===l&&(r=i,f=e),n=Qn(f)?f.call(n):f}return n}function kg(n,t,e){return n==null?n:se(n,t,e)}function jg(n,t,e,r){return r=typeof r=="function"?r:l,n==null?n:se(n,t,e,r)}var fo=wf(J),oo=wf(on);function n_(n,t,e){var r=C(n),i=r||ht(n)||$t(n);if(t=A(t,4),e==null){var f=n&&n.constructor;i?e=r?new f:[]:G(n)?e=Qn(f)?Ut(We(n)):{}:e={}}return(i?xn:Dn)(n,function(o,s,c){return t(e,o,s,c)}),e}function t_(n,t){return n==null?!0:ei(n,t)}function e_(n,t,e){return n==null?n:nf(n,t,ui(e))}function r_(n,t,e,r){return r=typeof r=="function"?r:l,n==null?n:nf(n,t,ui(e),r)}function Ht(n){return n==null?[]:Ur(n,J(n))}function i_(n){return n==null?[]:Ur(n,on(n))}function u_(n,t,e){return e===l&&(e=t,t=l),e!==l&&(e=Rn(e),e=e===e?e:0),t!==l&&(t=Rn(t),t=t===t?t:0),xt(Rn(n),t,e)}function f_(n,t,e){return t=Vn(t),e===l?(e=t,t=0):e=Vn(e),n=Rn(n),ha(n,t,e)}function o_(n,t,e){if(e&&typeof e!="boolean"&&en(n,t,e)&&(t=e=l),e===l&&(typeof t=="boolean"?(e=t,t=l):typeof n=="boolean"&&(e=n,n=l)),n===l&&t===l?(n=0,t=1):(n=Vn(n),t===l?(t=n,n=0):t=Vn(t)),n>t){var r=n;n=t,t=r}if(e||n%1||t%1){var i=Ou();return j(n+i*(t-n+Nl("1e-"+((i+"").length-1))),t)}return jr(n,t)}var l_=Nt(function(n,t,e){return t=t.toLowerCase(),n+(e?lo(t):t)});function lo(n){return Ti(P(n).toLowerCase())}function so(n){return n=P(n),n&&n.replace(al,kl).replace(Ll,"")}function s_(n,t,e){n=P(n),t=cn(t);var r=n.length;e=e===l?r:xt(R(e),0,r);var i=e;return e-=t.length,e>=0&&n.slice(e,i)==t}function a_(n){return n=P(n),n&&Ko.test(n)?n.replace(Ni,jl):n}function c_(n){return n=P(n),n&&Qo.test(n)?n.replace(mr,"\\$&"):n}var h_=Nt(function(n,t,e){return n+(e?"-":"")+t.toLowerCase()}),g_=Nt(function(n,t,e){return n+(e?" ":"")+t.toLowerCase()}),__=hf("toLowerCase");function p_(n,t,e){n=P(n),t=R(t);var r=t?Wt(n):0;if(!t||r>=t)return n;var i=(t-r)/2;return Je(Fe(i),e)+n+Je(Be(i),e)}function d_(n,t,e){n=P(n),t=R(t);var r=t?Wt(n):0;return t&&r<t?n+Je(t-r,e):n}function v_(n,t,e){n=P(n),t=R(t);var r=t?Wt(n):0;return t&&r<t?Je(t-r,e)+n:n}function w_(n,t,e){return e||t==null?t=0:t&&(t=+t),Rs(P(n).replace(yr,""),t||0)}function x_(n,t,e){return(e?en(n,t,e):t===l)?t=1:t=R(t),ni(P(n),t)}function A_(){var n=arguments,t=P(n[0]);return n.length<3?t:t.replace(n[1],n[2])}var m_=Nt(function(n,t,e){return n+(e?"_":"")+t.toLowerCase()});function y_(n,t,e){return e&&typeof e!="number"&&en(n,t,e)&&(t=e=l),e=e===l?Un:e>>>0,e?(n=P(n),n&&(typeof t=="string"||t!=null&&!Si(t))&&(t=cn(t),!t&&bt(n))?ct(Ln(n),0,e):n.split(t,e)):[]}var S_=Nt(function(n,t,e){return n+(e?" ":"")+Ti(t)});function C_(n,t,e){return n=P(n),e=e==null?0:xt(R(e),0,n.length),t=cn(t),n.slice(e,e+t.length)==t}function R_(n,t,e){var r=u.templateSettings;e&&en(n,t,e)&&(t=l),n=P(n),t=or({},t,r,xf);var i=or({},t.imports,r.imports,xf),f=J(i),o=Ur(i,f),s,c,_=0,p=t.interpolate||Ae,d="__p += '",v=Nr((t.escape||Ae).source+"|"+p.source+"|"+(p===Gi?il:Ae).source+"|"+(t.evaluate||Ae).source+"|$","g"),x="//# sourceURL="+(B.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ml+"]")+`
11
+ `;n.replace(v,function(y,L,b,gn,rn,_n){return b||(b=gn),d+=n.slice(_,_n).replace(cl,ns),L&&(s=!0,d+=`' +
12
+ __e(`+L+`) +
13
+ '`),rn&&(c=!0,d+=`';
14
+ `+rn+`;
15
+ __p += '`),b&&(d+=`' +
16
+ ((__t = (`+b+`)) == null ? '' : __t) +
17
+ '`),_=_n+y.length,y}),d+=`';
18
+ `;var m=B.call(t,"variable")&&t.variable;if(!m)d=`with (obj) {
19
+ `+d+`
20
+ }
21
+ `;else if(el.test(m))throw new S(ar);d=(c?d.replace(Go,""):d).replace($o,"$1").replace(Ho,"$1;"),d="function("+(m||"obj")+`) {
22
+ `+(m?"":`obj || (obj = {});
23
+ `)+"var __t, __p = ''"+(s?", __e = _.escape":"")+(c?`, __j = Array.prototype.join;
24
+ function print() { __p += __j.call(arguments, '') }
25
+ `:`;
26
+ `)+d+`return __p
27
+ }`;var T=co(function(){return W(f,x+"return "+d).apply(l,o)});if(T.source=d,yi(T))throw T;return T}function T_(n){return P(n).toLowerCase()}function E_(n){return P(n).toUpperCase()}function I_(n,t,e){if(n=P(n),n&&(e||t===l))return xu(n);if(!n||!(t=cn(t)))return n;var r=Ln(n),i=Ln(t),f=Au(r,i),o=mu(r,i)+1;return ct(r,f,o).join("")}function L_(n,t,e){if(n=P(n),n&&(e||t===l))return n.slice(0,Su(n)+1);if(!n||!(t=cn(t)))return n;var r=Ln(n),i=mu(r,Ln(t))+1;return ct(r,0,i).join("")}function O_(n,t,e){if(n=P(n),n&&(e||t===l))return n.replace(yr,"");if(!n||!(t=cn(t)))return n;var r=Ln(n),i=Au(r,Ln(t));return ct(r,i).join("")}function b_(n,t){var e=Co,r=Ro;if(G(t)){var i="separator"in t?t.separator:i;e="length"in t?R(t.length):e,r="omission"in t?cn(t.omission):r}n=P(n);var f=n.length;if(bt(n)){var o=Ln(n);f=o.length}if(e>=f)return n;var s=e-Wt(r);if(s<1)return r;var c=o?ct(o,0,s).join(""):n.slice(0,s);if(i===l)return c+r;if(o&&(s+=c.length-s),Si(i)){if(n.slice(s).search(i)){var _,p=c;for(i.global||(i=Nr(i.source,P($i.exec(i))+"g")),i.lastIndex=0;_=i.exec(p);)var d=_.index;c=c.slice(0,d===l?s:d)}}else if(n.indexOf(cn(i),s)!=s){var v=c.lastIndexOf(i);v>-1&&(c=c.slice(0,v))}return c+r}function W_(n){return n=P(n),n&&qo.test(n)?n.replace(Di,os):n}var P_=Nt(function(n,t,e){return n+(e?" ":"")+t.toUpperCase()}),Ti=hf("toUpperCase");function ao(n,t,e){return n=P(n),t=e?l:t,t===l?es(n)?as(n):Yl(n):n.match(t)||[]}var co=E(function(n,t){try{return sn(n,l,t)}catch(e){return yi(e)?e:new S(e)}}),M_=Xn(function(n,t){return xn(t,function(e){e=Gn(e),Zn(n,e,Ai(n[e],n))}),n});function B_(n){var t=n==null?0:n.length,e=A();return n=t?N(n,function(r){if(typeof r[1]!="function")throw new An(K);return[e(r[0]),r[1]]}):[],E(function(r){for(var i=-1;++i<t;){var f=n[i];if(sn(f[0],this,r))return sn(f[1],this,r)}})}function F_(n){return oa(yn(n,Tn))}function Ei(n){return function(){return n}}function U_(n,t){return n==null||n!==n?t:n}var D_=_f(),N_=_f(!0);function ln(n){return n}function Ii(n){return qu(typeof n=="function"?n:yn(n,Tn))}function G_(n){return zu(yn(n,Tn))}function $_(n,t){return Zu(n,yn(t,Tn))}var H_=E(function(n,t){return function(e){return oe(e,n,t)}}),q_=E(function(n,t){return function(e){return oe(n,e,t)}});function Li(n,t,e){var r=J(t),i=He(t,r);e==null&&!(G(t)&&(i.length||!r.length))&&(e=t,t=n,n=this,i=He(t,J(t)));var f=!(G(e)&&"chain"in e)||!!e.chain,o=Qn(n);return xn(i,function(s){var c=t[s];n[s]=c,o&&(n.prototype[s]=function(){var _=this.__chain__;if(f||_){var p=n(this.__wrapped__),d=p.__actions__=un(this.__actions__);return d.push({func:c,args:arguments,thisArg:n}),p.__chain__=_,p}return c.apply(n,ut([this.value()],arguments))})}),n}function K_(){return V._===this&&(V._=ds),this}function Oi(){}function z_(n){return n=R(n),E(function(t){return Yu(t,n)})}var Z_=oi(N),Y_=oi(_u),X_=oi(Wr);function ho(n){return _i(n)?Pr(Gn(n)):Ca(n)}function J_(n){return function(t){return n==null?l:At(n,t)}}var Q_=df(),V_=df(!0);function bi(){return[]}function Wi(){return!1}function k_(){return{}}function j_(){return""}function np(){return!0}function tp(n,t){if(n=R(n),n<1||n>rt)return[];var e=Un,r=j(n,Un);t=A(t),n-=Un;for(var i=Fr(r,t);++e<n;)t(e);return i}function ep(n){return C(n)?N(n,Gn):hn(n)?[n]:un(Wf(P(n)))}function rp(n){var t=++_s;return P(n)+t}var ip=Xe(function(n,t){return n+t},0),up=li("ceil"),fp=Xe(function(n,t){return n/t},1),op=li("floor");function lp(n){return n&&n.length?$e(n,ln,Yr):l}function sp(n,t){return n&&n.length?$e(n,A(t,2),Yr):l}function ap(n){return vu(n,ln)}function cp(n,t){return vu(n,A(t,2))}function hp(n){return n&&n.length?$e(n,ln,Vr):l}function gp(n,t){return n&&n.length?$e(n,A(t,2),Vr):l}var _p=Xe(function(n,t){return n*t},1),pp=li("round"),dp=Xe(function(n,t){return n-t},0);function vp(n){return n&&n.length?Br(n,ln):0}function wp(n,t){return n&&n.length?Br(n,A(t,2)):0}return u.after=Gh,u.ary=qf,u.assign=Eg,u.assignIn=ro,u.assignInWith=or,u.assignWith=Ig,u.at=Lg,u.before=Kf,u.bind=Ai,u.bindAll=M_,u.bindKey=zf,u.castArray=kh,u.chain=Gf,u.chunk=oc,u.compact=lc,u.concat=sc,u.cond=B_,u.conforms=F_,u.constant=Ei,u.countBy=vh,u.create=Og,u.curry=Zf,u.curryRight=Yf,u.debounce=Xf,u.defaults=bg,u.defaultsDeep=Wg,u.defer=$h,u.delay=Hh,u.difference=ac,u.differenceBy=cc,u.differenceWith=hc,u.drop=gc,u.dropRight=_c,u.dropRightWhile=pc,u.dropWhile=dc,u.fill=vc,u.filter=xh,u.flatMap=yh,u.flatMapDeep=Sh,u.flatMapDepth=Ch,u.flatten=Ff,u.flattenDeep=wc,u.flattenDepth=xc,u.flip=qh,u.flow=D_,u.flowRight=N_,u.fromPairs=Ac,u.functions=Ng,u.functionsIn=Gg,u.groupBy=Rh,u.initial=yc,u.intersection=Sc,u.intersectionBy=Cc,u.intersectionWith=Rc,u.invert=Hg,u.invertBy=qg,u.invokeMap=Eh,u.iteratee=Ii,u.keyBy=Ih,u.keys=J,u.keysIn=on,u.map=tr,u.mapKeys=zg,u.mapValues=Zg,u.matches=G_,u.matchesProperty=$_,u.memoize=rr,u.merge=Yg,u.mergeWith=io,u.method=H_,u.methodOf=q_,u.mixin=Li,u.negate=ir,u.nthArg=z_,u.omit=Xg,u.omitBy=Jg,u.once=Kh,u.orderBy=Lh,u.over=Z_,u.overArgs=zh,u.overEvery=Y_,u.overSome=X_,u.partial=mi,u.partialRight=Jf,u.partition=Oh,u.pick=Qg,u.pickBy=uo,u.property=ho,u.propertyOf=J_,u.pull=Lc,u.pullAll=Df,u.pullAllBy=Oc,u.pullAllWith=bc,u.pullAt=Wc,u.range=Q_,u.rangeRight=V_,u.rearg=Zh,u.reject=Ph,u.remove=Pc,u.rest=Yh,u.reverse=wi,u.sampleSize=Bh,u.set=kg,u.setWith=jg,u.shuffle=Fh,u.slice=Mc,u.sortBy=Nh,u.sortedUniq=$c,u.sortedUniqBy=Hc,u.split=y_,u.spread=Xh,u.tail=qc,u.take=Kc,u.takeRight=zc,u.takeRightWhile=Zc,u.takeWhile=Yc,u.tap=lh,u.throttle=Jh,u.thru=nr,u.toArray=no,u.toPairs=fo,u.toPairsIn=oo,u.toPath=ep,u.toPlainObject=eo,u.transform=n_,u.unary=Qh,u.union=Xc,u.unionBy=Jc,u.unionWith=Qc,u.uniq=Vc,u.uniqBy=kc,u.uniqWith=jc,u.unset=t_,u.unzip=xi,u.unzipWith=Nf,u.update=e_,u.updateWith=r_,u.values=Ht,u.valuesIn=i_,u.without=nh,u.words=ao,u.wrap=Vh,u.xor=th,u.xorBy=eh,u.xorWith=rh,u.zip=ih,u.zipObject=uh,u.zipObjectDeep=fh,u.zipWith=oh,u.entries=fo,u.entriesIn=oo,u.extend=ro,u.extendWith=or,Li(u,u),u.add=ip,u.attempt=co,u.camelCase=l_,u.capitalize=lo,u.ceil=up,u.clamp=u_,u.clone=jh,u.cloneDeep=tg,u.cloneDeepWith=eg,u.cloneWith=ng,u.conformsTo=rg,u.deburr=so,u.defaultTo=U_,u.divide=fp,u.endsWith=s_,u.eq=bn,u.escape=a_,u.escapeRegExp=c_,u.every=wh,u.find=Ah,u.findIndex=Mf,u.findKey=Pg,u.findLast=mh,u.findLastIndex=Bf,u.findLastKey=Mg,u.floor=op,u.forEach=$f,u.forEachRight=Hf,u.forIn=Bg,u.forInRight=Fg,u.forOwn=Ug,u.forOwnRight=Dg,u.get=Ci,u.gt=ig,u.gte=ug,u.has=$g,u.hasIn=Ri,u.head=Uf,u.identity=ln,u.includes=Th,u.indexOf=mc,u.inRange=f_,u.invoke=Kg,u.isArguments=St,u.isArray=C,u.isArrayBuffer=fg,u.isArrayLike=fn,u.isArrayLikeObject=H,u.isBoolean=og,u.isBuffer=ht,u.isDate=lg,u.isElement=sg,u.isEmpty=ag,u.isEqual=cg,u.isEqualWith=hg,u.isError=yi,u.isFinite=gg,u.isFunction=Qn,u.isInteger=Qf,u.isLength=ur,u.isMap=Vf,u.isMatch=_g,u.isMatchWith=pg,u.isNaN=dg,u.isNative=vg,u.isNil=xg,u.isNull=wg,u.isNumber=kf,u.isObject=G,u.isObjectLike=$,u.isPlainObject=ge,u.isRegExp=Si,u.isSafeInteger=Ag,u.isSet=jf,u.isString=fr,u.isSymbol=hn,u.isTypedArray=$t,u.isUndefined=mg,u.isWeakMap=yg,u.isWeakSet=Sg,u.join=Tc,u.kebabCase=h_,u.last=Cn,u.lastIndexOf=Ec,u.lowerCase=g_,u.lowerFirst=__,u.lt=Cg,u.lte=Rg,u.max=lp,u.maxBy=sp,u.mean=ap,u.meanBy=cp,u.min=hp,u.minBy=gp,u.stubArray=bi,u.stubFalse=Wi,u.stubObject=k_,u.stubString=j_,u.stubTrue=np,u.multiply=_p,u.nth=Ic,u.noConflict=K_,u.noop=Oi,u.now=er,u.pad=p_,u.padEnd=d_,u.padStart=v_,u.parseInt=w_,u.random=o_,u.reduce=bh,u.reduceRight=Wh,u.repeat=x_,u.replace=A_,u.result=Vg,u.round=pp,u.runInContext=a,u.sample=Mh,u.size=Uh,u.snakeCase=m_,u.some=Dh,u.sortedIndex=Bc,u.sortedIndexBy=Fc,u.sortedIndexOf=Uc,u.sortedLastIndex=Dc,u.sortedLastIndexBy=Nc,u.sortedLastIndexOf=Gc,u.startCase=S_,u.startsWith=C_,u.subtract=dp,u.sum=vp,u.sumBy=wp,u.template=R_,u.times=tp,u.toFinite=Vn,u.toInteger=R,u.toLength=to,u.toLower=T_,u.toNumber=Rn,u.toSafeInteger=Tg,u.toString=P,u.toUpper=E_,u.trim=I_,u.trimEnd=L_,u.trimStart=O_,u.truncate=b_,u.unescape=W_,u.uniqueId=rp,u.upperCase=P_,u.upperFirst=Ti,u.each=$f,u.eachRight=Hf,u.first=Uf,Li(u,function(){var n={};return Dn(u,function(t,e){B.call(u.prototype,e)||(n[e]=t)}),n}(),{chain:!1}),u.VERSION=nt,xn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){u[n].placeholder=u}),xn(["drop","take"],function(n,t){O.prototype[n]=function(e){e=e===l?1:Z(R(e),0);var r=this.__filtered__&&!t?new O(this):this.clone();return r.__filtered__?r.__takeCount__=j(e,r.__takeCount__):r.__views__.push({size:j(e,Un),type:n+(r.__dir__<0?"Right":"")}),r},O.prototype[n+"Right"]=function(e){return this.reverse()[n](e).reverse()}}),xn(["filter","map","takeWhile"],function(n,t){var e=t+1,r=e==Bi||e==Lo;O.prototype[n]=function(i){var f=this.clone();return f.__iteratees__.push({iteratee:A(i,3),type:e}),f.__filtered__=f.__filtered__||r,f}}),xn(["head","last"],function(n,t){var e="take"+(t?"Right":"");O.prototype[n]=function(){return this[e](1).value()[0]}}),xn(["initial","tail"],function(n,t){var e="drop"+(t?"":"Right");O.prototype[n]=function(){return this.__filtered__?new O(this):this[e](1)}}),O.prototype.compact=function(){return this.filter(ln)},O.prototype.find=function(n){return this.filter(n).head()},O.prototype.findLast=function(n){return this.reverse().find(n)},O.prototype.invokeMap=E(function(n,t){return typeof n=="function"?new O(this):this.map(function(e){return oe(e,n,t)})}),O.prototype.reject=function(n){return this.filter(ir(A(n)))},O.prototype.slice=function(n,t){n=R(n);var e=this;return e.__filtered__&&(n>0||t<0)?new O(e):(n<0?e=e.takeRight(-n):n&&(e=e.drop(n)),t!==l&&(t=R(t),e=t<0?e.dropRight(-t):e.take(t-n)),e)},O.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},O.prototype.toArray=function(){return this.take(Un)},Dn(O.prototype,function(n,t){var e=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),i=u[r?"take"+(t=="last"?"Right":""):t],f=r||/^find/.test(t);!i||(u.prototype[t]=function(){var o=this.__wrapped__,s=r?[1]:arguments,c=o instanceof O,_=s[0],p=c||C(o),d=function(L){var b=i.apply(u,ut([L],s));return r&&v?b[0]:b};p&&e&&typeof _=="function"&&_.length!=1&&(c=p=!1);var v=this.__chain__,x=!!this.__actions__.length,m=f&&!v,T=c&&!x;if(!f&&p){o=T?o:new O(this);var y=n.apply(o,s);return y.__actions__.push({func:nr,args:[d],thisArg:l}),new mn(y,v)}return m&&T?n.apply(this,s):(y=this.thru(d),m?r?y.value()[0]:y.value():y)})}),xn(["pop","push","shift","sort","splice","unshift"],function(n){var t=Te[n],e=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",r=/^(?:pop|shift)$/.test(n);u.prototype[n]=function(){var i=arguments;if(r&&!this.__chain__){var f=this.value();return t.apply(C(f)?f:[],i)}return this[e](function(o){return t.apply(C(o)?o:[],i)})}}),Dn(O.prototype,function(n,t){var e=u[t];if(e){var r=e.name+"";B.call(Ft,r)||(Ft[r]=[]),Ft[r].push({name:t,func:e})}}),Ft[Ye(l,gt).name]=[{name:"wrapper",func:l}],O.prototype.clone=Ws,O.prototype.reverse=Ps,O.prototype.value=Ms,u.prototype.at=sh,u.prototype.chain=ah,u.prototype.commit=ch,u.prototype.next=hh,u.prototype.plant=_h,u.prototype.reverse=ph,u.prototype.toJSON=u.prototype.valueOf=u.prototype.value=dh,u.prototype.first=u.prototype.head,ne&&(u.prototype[ne]=gh),u},Pt=cs();pt?((pt.exports=Pt)._=Pt,Ir._=Pt):V._=Pt}).call(qt)})(Kt,Kt.exports);var _o=Object.defineProperty,po=Object.getOwnPropertyDescriptor,Pn=(I,M,l,nt)=>{for(var Q=nt>1?void 0:nt?po(M,l):M,tt=I.length-1,K;tt>=0;tt--)(K=I[tt])&&(Q=(nt?K(M,l,Q):K(Q))||Q);return nt&&Q&&_o(M,l,Q),Q};let pn=class extends Y.Vue{onValueChanged(){const I=this.editor.state.selection;this.editor.setState(jn.EditorState.create({doc:this.value,extensions:this.extension,selection:I}))}onToggleDarkMode(){this.editor.setState(jn.EditorState.create({doc:this.value,extensions:this.extension}))}get extension(){const I=Kt.exports.compact([lr.EditorView.updateListener.of(M=>this.$emit("update",M)),lr.EditorView.theme(this.theme,{dark:this.dark}),this.phrases?jn.EditorState.phrases.of(this.phrases):void 0,this.lang?this.lang:void 0]);return this.linter.length!==0&&Kt.exports.merge(I,this.linter),this.extensions.length!==0&&Kt.exports.merge(I,this.extensions),console.debug("[CodeMirror.vue] Loaded extensions:",I),I}mounted(){let I=this.value;!this.value&&this.$slots.default!==void 0&&(I=this.getChildrenTextContent(this.$slots.default)),this.editor=new lr.EditorView({state:jn.EditorState.create({doc:I,extensions:this.extension}),parent:this.$refs.editor,dispatch:M=>{this.editor.update([M]),!M.changes.empty&&this.$emit("input",this.editor.state.doc.toString())}})}beforeDestroy(){this.editor.destroy()}getChildrenTextContent(I){return I.map(M=>M.children?this.getChildrenTextContent(M.children):M.text||`
28
+ `).join("")}};Pn([Y.Prop({type:Object,default:()=>{}})],pn.prototype,"theme",2),Pn([Y.Prop({type:Boolean,default:!1})],pn.prototype,"dark",2),Pn([Y.Prop({type:Object})],pn.prototype,"phrases",2),Pn([Y.Prop({type:Array,default:()=>[]})],pn.prototype,"extensions",2),Pn([Y.Prop({type:Object})],pn.prototype,"lang",2),Pn([Y.Prop({type:Array,default:()=>[]})],pn.prototype,"linter",2),Pn([Y.Prop({type:String,default:""})],pn.prototype,"value",2),Pn([Y.Watch("value")],pn.prototype,"onValueChanged",1),Pn([Y.Watch("dark")],pn.prototype,"onToggleDarkMode",1),pn=Pn([Y.Component({name:"CodeMirror"})],pn);var vo=function(){var I=this,M=I.$createElement,l=I._self._c||M;return l("div",{ref:"editor"},[I.$slots.default?I._e():[I._t("default")]],2)},wo=[];function xo(I,M,l,nt,Q,tt,K,ar){var X=typeof I=="function"?I.options:I;M&&(X.render=M,X.staticRenderFns=l,X._compiled=!0),nt&&(X.functional=!0),tt&&(X._scopeId="data-v-"+tt);var Mn;if(K?(Mn=function(dn){dn=dn||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!dn&&typeof __VUE_SSR_CONTEXT__<"u"&&(dn=__VUE_SSR_CONTEXT__),Q&&Q.call(this,dn),dn&&dn._registeredComponents&&dn._registeredComponents.add(K)},X._ssrRegister=Mn):Q&&(Mn=ar?function(){Q.call(this,(X.functional?this.parent:this).$root.$options.shadowRoot)}:Q),Mn)if(X.functional){X._injectStyles=Mn;var Ct=X.render;X.render=function(et,$n){return Mn.call($n),Ct(et,$n)}}else{var Tn=X.beforeCreate;X.beforeCreate=Tn?[].concat(Tn,Mn):[Mn]}return{exports:I,options:X}}const Pi={};var Ao=xo(pn,vo,wo,!1,mo,null,null,null);function mo(I){for(let M in Pi)this[M]=Pi[M]}var yo=function(){return Ao.exports}(),sr=(()=>{const I=yo;return I.install=M=>{M.component("CodeMirror",I)},I})(),So=Object.freeze(Object.defineProperty({__proto__:null,default:sr},Symbol.toStringTag,{value:"Module"}));return Object.entries(So).forEach(([I,M])=>{I!=="default"&&(sr[I]=M)}),sr});