@zsviczian/excalidraw
Version:
Excalidraw as a React component
2 lines • 8.38 MB
JavaScript
/*! For license information please see excalidraw.production.min.js.LICENSE.txt */
!function(A,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("react-dom"),require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["react","react-dom","react/jsx-runtime"],e):"object"==typeof exports?exports.ExcalidrawLib=e(require("react"),require("react-dom"),require("react/jsx-runtime")):A.ExcalidrawLib=e(A.React,A.ReactDOM,A.React.jsxRuntime)}(self,((A,e,t)=>(()=>{var i,n,a={234:(A,e,t)=>{"use strict";t.r(e),t.d(e,{default:()=>ol});var i=t(15442);let n=[],a=[];function r(A){if(A<768)return!1;for(let e=0,t=n.length;;){let i=e+t>>1;if(A<n[i])t=i;else{if(!(A>=a[i]))return!0;e=i+1}if(e==t)return!1}}function o(A){return A>=127462&&A<=127487}(()=>{let A="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((A=>A?parseInt(A,36):1));for(let e=0,t=0;e<A.length;e++)(e%2?a:n).push(t+=A[e])})();const s=8205;function g(A,e,t=!0,i=!0){return(t?l:c)(A,e,i)}function l(A,e,t){if(e==A.length)return e;e&&C(A.charCodeAt(e))&&I(A.charCodeAt(e-1))&&e--;let i=d(A,e);for(e+=h(i);e<A.length;){let n=d(A,e);if(i==s||n==s||t&&r(n))e+=h(n),i=n;else{if(!o(n))break;{let t=0,i=e-2;for(;i>=0&&o(d(A,i));)t++,i-=2;if(t%2==0)break;e+=2}}}return e}function c(A,e,t){for(;e>0;){let i=l(A,e-2,t);if(i<e)return i;e--}return 0}function d(A,e){let t=A.charCodeAt(e);if(!I(t)||e+1==A.length)return t;let i=A.charCodeAt(e+1);return C(i)?i-56320+(t-55296<<10)+65536:t}function C(A){return A>=56320&&A<57344}function I(A){return A>=55296&&A<56320}function h(A){return A<65536?1:2}class B{lineAt(A){if(A<0||A>this.length)throw new RangeError(`Invalid position ${A} in document of length ${this.length}`);return this.lineInner(A,!1,1,0)}line(A){if(A<1||A>this.lines)throw new RangeError(`Invalid line number ${A} in ${this.lines}-line document`);return this.lineInner(A,!0,1,0)}replace(A,e,t){[A,e]=b(this,A,e);let i=[];return this.decompose(0,A,i,2),t.length&&t.decompose(0,t.length,i,3),this.decompose(e,this.length,i,1),u.from(i,this.length-(e-A)+t.length)}append(A){return this.replace(this.length,this.length,A)}slice(A,e=this.length){[A,e]=b(this,A,e);let t=[];return this.decompose(A,e,t,0),u.from(t,e-A)}eq(A){if(A==this)return!0;if(A.length!=this.length||A.lines!=this.lines)return!1;let e=this.scanIdentical(A,1),t=this.length-this.scanIdentical(A,-1),i=new m(this),n=new m(A);for(let A=e,a=e;;){if(i.next(A),n.next(A),A=0,i.lineBreak!=n.lineBreak||i.done!=n.done||i.value!=n.value)return!1;if(a+=i.value.length,i.done||a>=t)return!0}}iter(A=1){return new m(this,A)}iterRange(A,e=this.length){return new f(this,A,e)}iterLines(A,e){let t;if(null==A)t=this.iter();else{null==e&&(e=this.lines+1);let i=this.line(A).from;t=this.iterRange(i,Math.max(i,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new w(t)}toString(){return this.sliceString(0)}toJSON(){let A=[];return this.flatten(A),A}constructor(){}static of(A){if(0==A.length)throw new RangeError("A document must have at least one line");return 1!=A.length||A[0]?A.length<=32?new E(A):u.from(E.split(A,[])):B.empty}}class E extends B{constructor(A,e=function(A){let e=-1;for(let t of A)e+=t.length+1;return e}(A)){super(),this.text=A,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(A,e,t,i){for(let n=0;;n++){let a=this.text[n],r=i+a.length;if((e?t:r)>=A)return new y(i,r,t,a);i=r+1,t++}}decompose(A,e,t,i){let n=A<=0&&e>=this.length?this:new E(p(this.text,A,e),Math.min(e,this.length)-Math.max(0,A));if(1&i){let A=t.pop(),e=Q(n.text,A.text.slice(),0,n.length);if(e.length<=32)t.push(new E(e,A.length+n.length));else{let A=e.length>>1;t.push(new E(e.slice(0,A)),new E(e.slice(A)))}}else t.push(n)}replace(A,e,t){if(!(t instanceof E))return super.replace(A,e,t);[A,e]=b(this,A,e);let i=Q(this.text,Q(t.text,p(this.text,0,A)),e),n=this.length+t.length-(e-A);return i.length<=32?new E(i,n):u.from(E.split(i,[]),n)}sliceString(A,e=this.length,t="\n"){[A,e]=b(this,A,e);let i="";for(let n=0,a=0;n<=e&&a<this.text.length;a++){let r=this.text[a],o=n+r.length;n>A&&a&&(i+=t),A<o&&e>n&&(i+=r.slice(Math.max(0,A-n),e-n)),n=o+1}return i}flatten(A){for(let e of this.text)A.push(e)}scanIdentical(){return 0}static split(A,e){let t=[],i=-1;for(let n of A)t.push(n),i+=n.length+1,32==t.length&&(e.push(new E(t,i)),t=[],i=-1);return i>-1&&e.push(new E(t,i)),e}}class u extends B{constructor(A,e){super(),this.children=A,this.length=e,this.lines=0;for(let e of A)this.lines+=e.lines}lineInner(A,e,t,i){for(let n=0;;n++){let a=this.children[n],r=i+a.length,o=t+a.lines-1;if((e?o:r)>=A)return a.lineInner(A,e,t,i);i=r+1,t=o+1}}decompose(A,e,t,i){for(let n=0,a=0;a<=e&&n<this.children.length;n++){let r=this.children[n],o=a+r.length;if(A<=o&&e>=a){let n=i&((a<=A?1:0)|(o>=e?2:0));a>=A&&o<=e&&!n?t.push(r):r.decompose(A-a,e-a,t,n)}a=o+1}}replace(A,e,t){if([A,e]=b(this,A,e),t.lines<this.lines)for(let i=0,n=0;i<this.children.length;i++){let a=this.children[i],r=n+a.length;if(A>=n&&e<=r){let o=a.replace(A-n,e-n,t),s=this.lines-a.lines+o.lines;if(o.lines<s>>4&&o.lines>s>>6){let n=this.children.slice();return n[i]=o,new u(n,this.length-(e-A)+t.length)}return super.replace(n,r,o)}n=r+1}return super.replace(A,e,t)}sliceString(A,e=this.length,t="\n"){[A,e]=b(this,A,e);let i="";for(let n=0,a=0;n<this.children.length&&a<=e;n++){let r=this.children[n],o=a+r.length;a>A&&n&&(i+=t),A<o&&e>a&&(i+=r.sliceString(A-a,e-a,t)),a=o+1}return i}flatten(A){for(let e of this.children)e.flatten(A)}scanIdentical(A,e){if(!(A instanceof u))return 0;let t=0,[i,n,a,r]=e>0?[0,0,this.children.length,A.children.length]:[this.children.length-1,A.children.length-1,-1,-1];for(;;i+=e,n+=e){if(i==a||n==r)return t;let o=this.children[i],s=A.children[n];if(o!=s)return t+o.scanIdentical(s,e);t+=o.length+1}}static from(A,e=A.reduce(((A,e)=>A+e.length+1),-1)){let t=0;for(let e of A)t+=e.lines;if(t<32){let t=[];for(let e of A)e.flatten(t);return new E(t,e)}let i=Math.max(32,t>>5),n=i<<1,a=i>>1,r=[],o=0,s=-1,g=[];function l(A){let e;if(A.lines>n&&A instanceof u)for(let e of A.children)l(e);else A.lines>a&&(o>a||!o)?(c(),r.push(A)):A instanceof E&&o&&(e=g[g.length-1])instanceof E&&A.lines+e.lines<=32?(o+=A.lines,s+=A.length+1,g[g.length-1]=new E(e.text.concat(A.text),e.length+1+A.length)):(o+A.lines>i&&c(),o+=A.lines,s+=A.length+1,g.push(A))}function c(){0!=o&&(r.push(1==g.length?g[0]:u.from(g,s)),s=-1,o=g.length=0)}for(let e of A)l(e);return c(),1==r.length?r[0]:new u(r,e)}}function Q(A,e,t=0,i=1e9){for(let n=0,a=0,r=!0;a<A.length&&n<=i;a++){let o=A[a],s=n+o.length;s>=t&&(s>i&&(o=o.slice(0,i-n)),n<t&&(o=o.slice(t-n)),r?(e[e.length-1]+=o,r=!1):e.push(o)),n=s+1}return e}function p(A,e,t){return Q(A,[""],e,t)}B.empty=new E([""],0);class m{constructor(A,e=1){this.dir=e,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[A],this.offsets=[e>0?1:(A instanceof E?A.text.length:A.children.length)<<1]}nextInner(A,e){for(this.done=this.lineBreak=!1;;){let t=this.nodes.length-1,i=this.nodes[t],n=this.offsets[t],a=n>>1,r=i instanceof E?i.text.length:i.children.length;if(a==(e>0?r:0)){if(0==t)return this.done=!0,this.value="",this;e>0&&this.offsets[t-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&n)==(e>0?0:1)){if(this.offsets[t]+=e,0==A)return this.lineBreak=!0,this.value="\n",this;A--}else if(i instanceof E){let n=i.text[a+(e<0?-1:0)];if(this.offsets[t]+=e,n.length>Math.max(0,A))return this.value=0==A?n:e>0?n.slice(A):n.slice(0,n.length-A),this;A-=n.length}else{let n=i.children[a+(e<0?-1:0)];A>n.length?(A-=n.length,this.offsets[t]+=e):(e<0&&this.offsets[t]--,this.nodes.push(n),this.offsets.push(e>0?1:(n instanceof E?n.text.length:n.children.length)<<1))}}}next(A=0){return A<0&&(this.nextInner(-A,-this.dir),A=this.value.length),this.nextInner(A,this.dir)}}class f{constructor(A,e,t){this.value="",this.done=!1,this.cursor=new m(A,e>t?-1:1),this.pos=e>t?A.length:0,this.from=Math.min(e,t),this.to=Math.max(e,t)}nextInner(A,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;A+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let t=e<0?this.pos-this.from:this.to-this.pos;A>t&&(A=t),t-=A;let{value:i}=this.cursor.next(A);return this.pos+=(i.length+A)*e,this.value=i.length<=t?i:e<0?i.slice(i.length-t):i.slice(0,t),this.done=!this.value,this}next(A=0){return A<0?A=Math.max(A,this.from-this.pos):A>0&&(A=Math.min(A,this.to-this.pos)),this.nextInner(A,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class w{constructor(A){this.inner=A,this.afterBreak=!0,this.value="",this.done=!1}next(A=0){let{done:e,lineBreak:t,value:i}=this.inner.next(A);return e&&this.afterBreak?(this.value="",this.afterBreak=!1):e?(this.done=!0,this.value=""):t?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(B.prototype[Symbol.iterator]=function(){return this.iter()},m.prototype[Symbol.iterator]=f.prototype[Symbol.iterator]=w.prototype[Symbol.iterator]=function(){return this});class y{constructor(A,e,t,i){this.from=A,this.to=e,this.number=t,this.text=i}get length(){return this.to-this.from}}function b(A,e,t){return[e=Math.max(0,Math.min(A.length,e)),Math.max(e,Math.min(A.length,t))]}function D(A,e,t=!0,i=!0){return g(A,e,t,i)}const k=/\r\n?|\n/;var v=function(A){return A[A.Simple=0]="Simple",A[A.TrackDel=1]="TrackDel",A[A.TrackBefore=2]="TrackBefore",A[A.TrackAfter=3]="TrackAfter",A}(v||(v={}));class x{constructor(A){this.sections=A}get length(){let A=0;for(let e=0;e<this.sections.length;e+=2)A+=this.sections[e];return A}get newLength(){let A=0;for(let e=0;e<this.sections.length;e+=2){let t=this.sections[e+1];A+=t<0?this.sections[e]:t}return A}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(A){for(let e=0,t=0,i=0;e<this.sections.length;){let n=this.sections[e++],a=this.sections[e++];a<0?(A(t,i,n),i+=n):i+=a,t+=n}}iterChangedRanges(A,e=!1){N(this,A,e)}get invertedDesc(){let A=[];for(let e=0;e<this.sections.length;){let t=this.sections[e++],i=this.sections[e++];i<0?A.push(t,i):A.push(i,t)}return new x(A)}composeDesc(A){return this.empty?A:A.empty?this:R(this,A)}mapDesc(A,e=!1){return A.empty?this:U(this,A,e)}mapPos(A,e=-1,t=v.Simple){let i=0,n=0;for(let a=0;a<this.sections.length;){let r=this.sections[a++],o=this.sections[a++],s=i+r;if(o<0){if(s>A)return n+(A-i);n+=r}else{if(t!=v.Simple&&s>=A&&(t==v.TrackDel&&i<A&&s>A||t==v.TrackBefore&&i<A||t==v.TrackAfter&&s>A))return null;if(s>A||s==A&&e<0&&!r)return A==i||e<0?n:n+o;n+=o}i=s}if(A>i)throw new RangeError(`Position ${A} is out of range for changeset of length ${i}`);return n}touchesRange(A,e=A){for(let t=0,i=0;t<this.sections.length&&i<=e;){let n=i+this.sections[t++];if(this.sections[t++]>=0&&i<=e&&n>=A)return!(i<A&&n>e)||"cover";i=n}return!1}toString(){let A="";for(let e=0;e<this.sections.length;){let t=this.sections[e++],i=this.sections[e++];A+=(A?" ":"")+t+(i>=0?":"+i:"")}return A}toJSON(){return this.sections}static fromJSON(A){if(!Array.isArray(A)||A.length%2||A.some((A=>"number"!=typeof A)))throw new RangeError("Invalid JSON representation of ChangeDesc");return new x(A)}static create(A){return new x(A)}}class S extends x{constructor(A,e){super(A),this.inserted=e}apply(A){if(this.length!=A.length)throw new RangeError("Applying change set to a document with the wrong length");return N(this,((e,t,i,n,a)=>A=A.replace(i,i+(t-e),a)),!1),A}mapDesc(A,e=!1){return U(this,A,e,!0)}invert(A){let e=this.sections.slice(),t=[];for(let i=0,n=0;i<e.length;i+=2){let a=e[i],r=e[i+1];if(r>=0){e[i]=r,e[i+1]=a;let o=i>>1;for(;t.length<o;)t.push(B.empty);t.push(a?A.slice(n,n+a):B.empty)}n+=a}return new S(e,t)}compose(A){return this.empty?A:A.empty?this:R(this,A,!0)}map(A,e=!1){return A.empty?this:U(this,A,e,!0)}iterChanges(A,e=!1){N(this,A,e)}get desc(){return x.create(this.sections)}filter(A){let e=[],t=[],i=[],n=new M(this);A:for(let a=0,r=0;;){let o=a==A.length?1e9:A[a++];for(;r<o||r==o&&0==n.len;){if(n.done)break A;let A=Math.min(n.len,o-r);L(i,A,-1);let a=-1==n.ins?-1:0==n.off?n.ins:0;L(e,A,a),a>0&&G(t,e,n.text),n.forward(A),r+=A}let s=A[a++];for(;r<s;){if(n.done)break A;let A=Math.min(n.len,s-r);L(e,A,-1),L(i,A,-1==n.ins?-1:0==n.off?n.ins:0),n.forward(A),r+=A}}return{changes:new S(e,t),filtered:x.create(i)}}toJSON(){let A=[];for(let e=0;e<this.sections.length;e+=2){let t=this.sections[e],i=this.sections[e+1];i<0?A.push(t):0==i?A.push([t]):A.push([t].concat(this.inserted[e>>1].toJSON()))}return A}static of(A,e,t){let i=[],n=[],a=0,r=null;function o(A=!1){if(!A&&!i.length)return;a<e&&L(i,e-a,-1);let t=new S(i,n);r=r?r.compose(t.map(r)):t,i=[],n=[],a=0}return function A(s){if(Array.isArray(s))for(let e of s)A(e);else if(s instanceof S){if(s.length!=e)throw new RangeError(`Mismatched change set length (got ${s.length}, expected ${e})`);o(),r=r?r.compose(s.map(r)):s}else{let{from:A,to:r=A,insert:g}=s;if(A>r||A<0||r>e)throw new RangeError(`Invalid change range ${A} to ${r} (in doc of length ${e})`);let l=g?"string"==typeof g?B.of(g.split(t||k)):g:B.empty,c=l.length;if(A==r&&0==c)return;A<a&&o(),A>a&&L(i,A-a,-1),L(i,r-A,c),G(n,i,l),a=r}}(A),o(!r),r}static empty(A){return new S(A?[A,-1]:[],[])}static fromJSON(A){if(!Array.isArray(A))throw new RangeError("Invalid JSON representation of ChangeSet");let e=[],t=[];for(let i=0;i<A.length;i++){let n=A[i];if("number"==typeof n)e.push(n,-1);else{if(!Array.isArray(n)||"number"!=typeof n[0]||n.some(((A,e)=>e&&"string"!=typeof A)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==n.length)e.push(n[0],0);else{for(;t.length<i;)t.push(B.empty);t[i]=B.of(n.slice(1)),e.push(n[0],t[i].length)}}}return new S(e,t)}static createSet(A,e){return new S(A,e)}}function L(A,e,t,i=!1){if(0==e&&t<=0)return;let n=A.length-2;n>=0&&t<=0&&t==A[n+1]?A[n]+=e:n>=0&&0==e&&0==A[n]?A[n+1]+=t:i?(A[n]+=e,A[n+1]+=t):A.push(e,t)}function G(A,e,t){if(0==t.length)return;let i=e.length-2>>1;if(i<A.length)A[A.length-1]=A[A.length-1].append(t);else{for(;A.length<i;)A.push(B.empty);A.push(t)}}function N(A,e,t){let i=A.inserted;for(let n=0,a=0,r=0;r<A.sections.length;){let o=A.sections[r++],s=A.sections[r++];if(s<0)n+=o,a+=o;else{let g=n,l=a,c=B.empty;for(;g+=o,l+=s,s&&i&&(c=c.append(i[r-2>>1])),!(t||r==A.sections.length||A.sections[r+1]<0);)o=A.sections[r++],s=A.sections[r++];e(n,g,a,l,c),n=g,a=l}}}function U(A,e,t,i=!1){let n=[],a=i?[]:null,r=new M(A),o=new M(e);for(let A=-1;;){if(r.done&&o.len||o.done&&r.len)throw new Error("Mismatched change set lengths");if(-1==r.ins&&-1==o.ins){let A=Math.min(r.len,o.len);L(n,A,-1),r.forward(A),o.forward(A)}else if(o.ins>=0&&(r.ins<0||A==r.i||0==r.off&&(o.len<r.len||o.len==r.len&&!t))){let e=o.len;for(L(n,o.ins,-1);e;){let t=Math.min(r.len,e);r.ins>=0&&A<r.i&&r.len<=t&&(L(n,0,r.ins),a&&G(a,n,r.text),A=r.i),r.forward(t),e-=t}o.next()}else{if(!(r.ins>=0)){if(r.done&&o.done)return a?S.createSet(n,a):x.create(n);throw new Error("Mismatched change set lengths")}{let e=0,t=r.len;for(;t;)if(-1==o.ins){let A=Math.min(t,o.len);e+=A,t-=A,o.forward(A)}else{if(!(0==o.ins&&o.len<t))break;t-=o.len,o.next()}L(n,e,A<r.i?r.ins:0),a&&A<r.i&&G(a,n,r.text),A=r.i,r.forward(r.len-t)}}}}function R(A,e,t=!1){let i=[],n=t?[]:null,a=new M(A),r=new M(e);for(let A=!1;;){if(a.done&&r.done)return n?S.createSet(i,n):x.create(i);if(0==a.ins)L(i,a.len,0,A),a.next();else if(0!=r.len||r.done){if(a.done||r.done)throw new Error("Mismatched change set lengths");{let e=Math.min(a.len2,r.len),t=i.length;if(-1==a.ins){let t=-1==r.ins?-1:r.off?0:r.ins;L(i,e,t,A),n&&t&&G(n,i,r.text)}else-1==r.ins?(L(i,a.off?0:a.len,e,A),n&&G(n,i,a.textBit(e))):(L(i,a.off?0:a.len,r.off?0:r.ins,A),n&&!r.off&&G(n,i,r.text));A=(a.ins>e||r.ins>=0&&r.len>e)&&(A||i.length>t),a.forward2(e),r.forward(e)}}else L(i,0,r.ins,A),n&&G(n,i,r.text),r.next()}}class M{constructor(A){this.set=A,this.i=0,this.next()}next(){let{sections:A}=this.set;this.i<A.length?(this.len=A[this.i++],this.ins=A[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return-2==this.ins}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:A}=this.set,e=this.i-2>>1;return e>=A.length?B.empty:A[e]}textBit(A){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length&&!A?B.empty:e[t].slice(this.off,null==A?void 0:this.off+A)}forward(A){A==this.len?this.next():(this.len-=A,this.off+=A)}forward2(A){-1==this.ins?this.forward(A):A==this.ins?this.next():(this.ins-=A,this.off+=A)}}class F{constructor(A,e,t){this.from=A,this.to=e,this.flags=t}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let A=7&this.flags;return 7==A?null:A}get goalColumn(){let A=this.flags>>6;return 16777215==A?void 0:A}map(A,e=-1){let t,i;return this.empty?t=i=A.mapPos(this.from,e):(t=A.mapPos(this.from,1),i=A.mapPos(this.to,-1)),t==this.from&&i==this.to?this:new F(t,i,this.flags)}extend(A,e=A){if(A<=this.anchor&&e>=this.anchor)return Y.range(A,e);let t=Math.abs(A-this.anchor)>Math.abs(e-this.anchor)?A:e;return Y.range(this.anchor,t)}eq(A,e=!1){return!(this.anchor!=A.anchor||this.head!=A.head||this.goalColumn!=A.goalColumn||e&&this.empty&&this.assoc!=A.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(A){if(!A||"number"!=typeof A.anchor||"number"!=typeof A.head)throw new RangeError("Invalid JSON representation for SelectionRange");return Y.range(A.anchor,A.head)}static create(A,e,t){return new F(A,e,t)}}class Y{constructor(A,e){this.ranges=A,this.mainIndex=e}map(A,e=-1){return A.empty?this:Y.create(this.ranges.map((t=>t.map(A,e))),this.mainIndex)}eq(A,e=!1){if(this.ranges.length!=A.ranges.length||this.mainIndex!=A.mainIndex)return!1;for(let t=0;t<this.ranges.length;t++)if(!this.ranges[t].eq(A.ranges[t],e))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new Y([this.main],0)}addRange(A,e=!0){return Y.create([A].concat(this.ranges),e?0:this.mainIndex+1)}replaceRange(A,e=this.mainIndex){let t=this.ranges.slice();return t[e]=A,Y.create(t,this.mainIndex)}toJSON(){return{ranges:this.ranges.map((A=>A.toJSON())),main:this.mainIndex}}static fromJSON(A){if(!A||!Array.isArray(A.ranges)||"number"!=typeof A.main||A.main>=A.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Y(A.ranges.map((A=>F.fromJSON(A))),A.main)}static single(A,e=A){return new Y([Y.range(A,e)],0)}static create(A,e=0){if(0==A.length)throw new RangeError("A selection needs at least one range");for(let t=0,i=0;i<A.length;i++){let n=A[i];if(n.empty?n.from<=t:n.from<t)return Y.normalized(A.slice(),e);t=n.to}return new Y(A,e)}static cursor(A,e=0,t,i){return F.create(A,A,(0==e?0:e<0?8:16)|(null==t?7:Math.min(6,t))|(null!=i?i:16777215)<<6)}static range(A,e,t,i){let n=(null!=t?t:16777215)<<6|(null==i?7:Math.min(6,i));return e<A?F.create(e,A,48|n):F.create(A,e,(e>A?8:0)|n)}static normalized(A,e=0){let t=A[e];A.sort(((A,e)=>A.from-e.from)),e=A.indexOf(t);for(let t=1;t<A.length;t++){let i=A[t],n=A[t-1];if(i.empty?i.from<=n.to:i.from<n.to){let a=n.from,r=Math.max(i.to,n.to);t<=e&&e--,A.splice(--t,2,i.anchor>i.head?Y.range(r,a):Y.range(a,r))}}return new Y(A,e)}}function K(A,e){for(let t of A.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let H=0;class T{constructor(A,e,t,i,n){this.combine=A,this.compareInput=e,this.compare=t,this.isStatic=i,this.id=H++,this.default=A([]),this.extensions="function"==typeof n?n(this):n}get reader(){return this}static define(A={}){return new T(A.combine||(A=>A),A.compareInput||((A,e)=>A===e),A.compare||(A.combine?(A,e)=>A===e:J),!!A.static,A.enables)}of(A){return new O([],this,0,A)}compute(A,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new O(A,this,1,e)}computeN(A,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new O(A,this,2,e)}from(A,e){return e||(e=A=>A),this.compute([A],(t=>e(t.field(A))))}}function J(A,e){return A==e||A.length==e.length&&A.every(((A,t)=>A===e[t]))}class O{constructor(A,e,t,i){this.dependencies=A,this.facet=e,this.type=t,this.value=i,this.id=H++}dynamicSlot(A){var e;let t=this.value,i=this.facet.compareInput,n=this.id,a=A[n]>>1,r=2==this.type,o=!1,s=!1,g=[];for(let t of this.dependencies)"doc"==t?o=!0:"selection"==t?s=!0:1&(null!==(e=A[t.id])&&void 0!==e?e:1)||g.push(A[t.id]);return{create:A=>(A.values[a]=t(A),1),update(A,e){if(o&&e.docChanged||s&&(e.docChanged||e.selection)||j(A,g)){let e=t(A);if(r?!P(e,A.values[a],i):!i(e,A.values[a]))return A.values[a]=e,1}return 0},reconfigure:(A,e)=>{let o,s=e.config.address[n];if(null!=s){let n=rA(e,s);if(this.dependencies.every((t=>t instanceof T?e.facet(t)===A.facet(t):!(t instanceof Z)||e.field(t,!1)==A.field(t,!1)))||(r?P(o=t(A),n,i):i(o=t(A),n)))return A.values[a]=n,0}else o=t(A);return A.values[a]=o,1}}}}function P(A,e,t){if(A.length!=e.length)return!1;for(let i=0;i<A.length;i++)if(!t(A[i],e[i]))return!1;return!0}function j(A,e){let t=!1;for(let i of e)1&aA(A,i)&&(t=!0);return t}function W(A,e,t){let i=t.map((e=>A[e.id])),n=t.map((A=>A.type)),a=i.filter((A=>!(1&A))),r=A[e.id]>>1;function o(A){let t=[];for(let e=0;e<i.length;e++){let a=rA(A,i[e]);if(2==n[e])for(let A of a)t.push(A);else t.push(a)}return e.combine(t)}return{create(A){for(let e of i)aA(A,e);return A.values[r]=o(A),1},update(A,t){if(!j(A,a))return 0;let i=o(A);return e.compare(i,A.values[r])?0:(A.values[r]=i,1)},reconfigure(A,n){let a=j(A,i),s=n.config.facets[e.id],g=n.facet(e);if(s&&!a&&J(t,s))return A.values[r]=g,0;let l=o(A);return e.compare(l,g)?(A.values[r]=g,0):(A.values[r]=l,1)}}}const q=T.define({static:!0});class Z{constructor(A,e,t,i,n){this.id=A,this.createF=e,this.updateF=t,this.compareF=i,this.spec=n,this.provides=void 0}static define(A){let e=new Z(H++,A.create,A.update,A.compare||((A,e)=>A===e),A);return A.provide&&(e.provides=A.provide(e)),e}create(A){let e=A.facet(q).find((A=>A.field==this));return((null==e?void 0:e.create)||this.createF)(A)}slot(A){let e=A[this.id]>>1;return{create:A=>(A.values[e]=this.create(A),1),update:(A,t)=>{let i=A.values[e],n=this.updateF(i,t);return this.compareF(i,n)?0:(A.values[e]=n,1)},reconfigure:(A,t)=>{let i,n=A.facet(q),a=t.facet(q);return(i=n.find((A=>A.field==this)))&&i!=a.find((A=>A.field==this))?(A.values[e]=i.create(A),1):null!=t.config.address[this.id]?(A.values[e]=t.field(this),0):(A.values[e]=this.create(A),1)}}}init(A){return[this,q.of({field:this,create:A})]}get extension(){return this}}const z=4,V=3,X=2,_=1;function $(A){return e=>new eA(e,A)}const AA={highest:$(0),high:$(_),default:$(X),low:$(V),lowest:$(z)};class eA{constructor(A,e){this.inner=A,this.prec=e}}class tA{of(A){return new iA(this,A)}reconfigure(A){return tA.reconfigure.of({compartment:this,extension:A})}get(A){return A.config.compartments.get(this)}}class iA{constructor(A,e){this.compartment=A,this.inner=e}}class nA{constructor(A,e,t,i,n,a){for(this.base=A,this.compartments=e,this.dynamicSlots=t,this.address=i,this.staticValues=n,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<t.length;)this.statusTemplate.push(0)}staticFacet(A){let e=this.address[A.id];return null==e?A.default:this.staticValues[e>>1]}static resolve(A,e,t){let i=[],n=Object.create(null),a=new Map;for(let t of function(A,e,t){let i=[[],[],[],[],[]],n=new Map;function a(A,r){let o=n.get(A);if(null!=o){if(o<=r)return;let e=i[o].indexOf(A);e>-1&&i[o].splice(e,1),A instanceof iA&&t.delete(A.compartment)}if(n.set(A,r),Array.isArray(A))for(let e of A)a(e,r);else if(A instanceof iA){if(t.has(A.compartment))throw new RangeError("Duplicate use of compartment in extensions");let i=e.get(A.compartment)||A.inner;t.set(A.compartment,i),a(i,r)}else if(A instanceof eA)a(A.inner,A.prec);else if(A instanceof Z)i[r].push(A),A.provides&&a(A.provides,r);else if(A instanceof O)i[r].push(A),A.facet.extensions&&a(A.facet.extensions,X);else{let e=A.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${A}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(e,r)}}return a(A,X),i.reduce(((A,e)=>A.concat(e)))}(A,e,a))t instanceof Z?i.push(t):(n[t.facet.id]||(n[t.facet.id]=[])).push(t);let r=Object.create(null),o=[],s=[];for(let A of i)r[A.id]=s.length<<1,s.push((e=>A.slot(e)));let g=null==t?void 0:t.config.facets;for(let A in n){let e=n[A],i=e[0].facet,a=g&&g[A]||[];if(e.every((A=>0==A.type)))if(r[i.id]=o.length<<1|1,J(a,e))o.push(t.facet(i));else{let A=i.combine(e.map((A=>A.value)));o.push(t&&i.compare(A,t.facet(i))?t.facet(i):A)}else{for(let A of e)0==A.type?(r[A.id]=o.length<<1|1,o.push(A.value)):(r[A.id]=s.length<<1,s.push((e=>A.dynamicSlot(e))));r[i.id]=s.length<<1,s.push((A=>W(A,i,e)))}}let l=s.map((A=>A(r)));return new nA(A,a,l,r,o,n)}}function aA(A,e){if(1&e)return 2;let t=e>>1,i=A.status[t];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;A.status[t]=4;let n=A.computeSlot(A,A.config.dynamicSlots[t]);return A.status[t]=2|n}function rA(A,e){return 1&e?A.config.staticValues[e>>1]:A.values[e>>1]}const oA=T.define(),sA=T.define({combine:A=>A.some((A=>A)),static:!0}),gA=T.define({combine:A=>A.length?A[0]:void 0,static:!0}),lA=T.define(),cA=T.define(),dA=T.define(),CA=T.define({combine:A=>!!A.length&&A[0]});class IA{constructor(A,e){this.type=A,this.value=e}static define(){return new hA}}class hA{of(A){return new IA(this,A)}}class BA{constructor(A){this.map=A}of(A){return new EA(this,A)}}class EA{constructor(A,e){this.type=A,this.value=e}map(A){let e=this.type.map(this.value,A);return void 0===e?void 0:e==this.value?this:new EA(this.type,e)}is(A){return this.type==A}static define(A={}){return new BA(A.map||(A=>A))}static mapEffects(A,e){if(!A.length)return A;let t=[];for(let i of A){let A=i.map(e);A&&t.push(A)}return t}}EA.reconfigure=EA.define(),EA.appendConfig=EA.define();class uA{constructor(A,e,t,i,n,a){this.startState=A,this.changes=e,this.selection=t,this.effects=i,this.annotations=n,this.scrollIntoView=a,this._doc=null,this._state=null,t&&K(t,e.newLength),n.some((A=>A.type==uA.time))||(this.annotations=n.concat(uA.time.of(Date.now())))}static create(A,e,t,i,n,a){return new uA(A,e,t,i,n,a)}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(A){for(let e of this.annotations)if(e.type==A)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(A){let e=this.annotation(uA.userEvent);return!(!e||!(e==A||e.length>A.length&&e.slice(0,A.length)==A&&"."==e[A.length]))}}function QA(A,e){let t=[];for(let i=0,n=0;;){let a,r;if(i<A.length&&(n==e.length||e[n]>=A[i]))a=A[i++],r=A[i++];else{if(!(n<e.length))return t;a=e[n++],r=e[n++]}!t.length||t[t.length-1]<a?t.push(a,r):t[t.length-1]<r&&(t[t.length-1]=r)}}function pA(A,e,t){var i;let n,a,r;return t?(n=e.changes,a=S.empty(e.changes.length),r=A.changes.compose(e.changes)):(n=e.changes.map(A.changes),a=A.changes.mapDesc(e.changes,!0),r=A.changes.compose(n)),{changes:r,selection:e.selection?e.selection.map(a):null===(i=A.selection)||void 0===i?void 0:i.map(n),effects:EA.mapEffects(A.effects,n).concat(EA.mapEffects(e.effects,a)),annotations:A.annotations.length?A.annotations.concat(e.annotations):e.annotations,scrollIntoView:A.scrollIntoView||e.scrollIntoView}}function mA(A,e,t){let i=e.selection,n=yA(e.annotations);return e.userEvent&&(n=n.concat(uA.userEvent.of(e.userEvent))),{changes:e.changes instanceof S?e.changes:S.of(e.changes||[],t,A.facet(gA)),selection:i&&(i instanceof Y?i:Y.single(i.anchor,i.head)),effects:yA(e.effects),annotations:n,scrollIntoView:!!e.scrollIntoView}}function fA(A,e,t){let i=mA(A,e.length?e[0]:{},A.doc.length);e.length&&!1===e[0].filter&&(t=!1);for(let n=1;n<e.length;n++){!1===e[n].filter&&(t=!1);let a=!!e[n].sequential;i=pA(i,mA(A,e[n],a?i.changes.newLength:A.doc.length),a)}let n=uA.create(A,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return function(A){let e=A.startState,t=e.facet(dA),i=A;for(let n=t.length-1;n>=0;n--){let a=t[n](A);a&&Object.keys(a).length&&(i=pA(i,mA(e,a,A.changes.newLength),!0))}return i==A?A:uA.create(e,A.changes,A.selection,i.effects,i.annotations,i.scrollIntoView)}(t?function(A){let e=A.startState,t=!0;for(let i of e.facet(lA)){let e=i(A);if(!1===e){t=!1;break}Array.isArray(e)&&(t=!0===t?e:QA(t,e))}if(!0!==t){let i,n;if(!1===t)n=A.changes.invertedDesc,i=S.empty(e.doc.length);else{let e=A.changes.filter(t);i=e.changes,n=e.filtered.mapDesc(e.changes).invertedDesc}A=uA.create(e,i,A.selection&&A.selection.map(n),EA.mapEffects(A.effects,n),A.annotations,A.scrollIntoView)}let i=e.facet(cA);for(let t=i.length-1;t>=0;t--){let n=i[t](A);A=n instanceof uA?n:Array.isArray(n)&&1==n.length&&n[0]instanceof uA?n[0]:fA(e,yA(n),!1)}return A}(n):n)}uA.time=IA.define(),uA.userEvent=IA.define(),uA.addToHistory=IA.define(),uA.remote=IA.define();const wA=[];function yA(A){return null==A?wA:Array.isArray(A)?A:[A]}var bA=function(A){return A[A.Word=0]="Word",A[A.Space=1]="Space",A[A.Other=2]="Other",A}(bA||(bA={}));const DA=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let kA;try{kA=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(A){}function vA(A){return e=>{if(!/\S/.test(e))return bA.Space;if(function(A){if(kA)return kA.test(A);for(let e=0;e<A.length;e++){let t=A[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||DA.test(t)))return!0}return!1}(e))return bA.Word;for(let t=0;t<A.length;t++)if(e.indexOf(A[t])>-1)return bA.Word;return bA.Other}}class xA{constructor(A,e,t,i,n,a){this.config=A,this.doc=e,this.selection=t,this.values=i,this.status=A.statusTemplate.slice(),this.computeSlot=n,a&&(a._state=this);for(let A=0;A<this.config.dynamicSlots.length;A++)aA(this,A<<1);this.computeSlot=null}field(A,e=!0){let t=this.config.address[A.id];if(null!=t)return aA(this,t),rA(this,t);if(e)throw new RangeError("Field is not present in this state")}update(...A){return fA(this,A,!0)}applyTransaction(A){let e,t=this.config,{base:i,compartments:n}=t;for(let e of A.effects)e.is(tA.reconfigure)?(t&&(n=new Map,t.compartments.forEach(((A,e)=>n.set(e,A))),t=null),n.set(e.value.compartment,e.value.extension)):e.is(EA.reconfigure)?(t=null,i=e.value):e.is(EA.appendConfig)&&(t=null,i=yA(i).concat(e.value));if(t)e=A.startState.values.slice();else{t=nA.resolve(i,n,this),e=new xA(t,this.doc,this.selection,t.dynamicSlots.map((()=>null)),((A,e)=>e.reconfigure(A,this)),null).values}let a=A.startState.facet(sA)?A.newSelection:A.newSelection.asSingle();new xA(t,A.newDoc,a,e,((e,t)=>t.update(e,A)),A)}replaceSelection(A){return"string"==typeof A&&(A=this.toText(A)),this.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:A},range:Y.cursor(e.from+A.length)})))}changeByRange(A){let e=this.selection,t=A(e.ranges[0]),i=this.changes(t.changes),n=[t.range],a=yA(t.effects);for(let t=1;t<e.ranges.length;t++){let r=A(e.ranges[t]),o=this.changes(r.changes),s=o.map(i);for(let A=0;A<t;A++)n[A]=n[A].map(s);let g=i.mapDesc(o,!0);n.push(r.range.map(g)),i=i.compose(s),a=EA.mapEffects(a,s).concat(EA.mapEffects(yA(r.effects),g))}return{changes:i,selection:Y.create(n,e.mainIndex),effects:a}}changes(A=[]){return A instanceof S?A:S.of(A,this.doc.length,this.facet(xA.lineSeparator))}toText(A){return B.of(A.split(this.facet(xA.lineSeparator)||k))}sliceDoc(A=0,e=this.doc.length){return this.doc.sliceString(A,e,this.lineBreak)}facet(A){let e=this.config.address[A.id];return null==e?A.default:(aA(this,e),rA(this,e))}toJSON(A){let e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(A)for(let t in A){let i=A[t];i instanceof Z&&null!=this.config.address[i.id]&&(e[t]=i.spec.toJSON(this.field(A[t]),this))}return e}static fromJSON(A,e={},t){if(!A||"string"!=typeof A.doc)throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(t)for(let e in t)if(Object.prototype.hasOwnProperty.call(A,e)){let n=t[e],a=A[e];i.push(n.init((A=>n.spec.fromJSON(a,A))))}return xA.create({doc:A.doc,selection:Y.fromJSON(A.selection),extensions:e.extensions?i.concat([e.extensions]):i})}static create(A={}){let e=nA.resolve(A.extensions||[],new Map),t=A.doc instanceof B?A.doc:B.of((A.doc||"").split(e.staticFacet(xA.lineSeparator)||k)),i=A.selection?A.selection instanceof Y?A.selection:Y.single(A.selection.anchor,A.selection.head):Y.single(0);return K(i,t.length),e.staticFacet(sA)||(i=i.asSingle()),new xA(e,t,i,e.dynamicSlots.map((()=>null)),((A,e)=>e.create(A)),null)}get tabSize(){return this.facet(xA.tabSize)}get lineBreak(){return this.facet(xA.lineSeparator)||"\n"}get readOnly(){return this.facet(CA)}phrase(A,...e){for(let e of this.facet(xA.phrases))if(Object.prototype.hasOwnProperty.call(e,A)){A=e[A];break}return e.length&&(A=A.replace(/\$(\$|\d*)/g,((A,t)=>{if("$"==t)return"$";let i=+(t||1);return!i||i>e.length?A:e[i-1]}))),A}languageDataAt(A,e,t=-1){let i=[];for(let n of this.facet(oA))for(let a of n(this,e,t))Object.prototype.hasOwnProperty.call(a,A)&&i.push(a[A]);return i}charCategorizer(A){let e=this.languageDataAt("wordChars",A);return vA(e.length?e[0]:"")}wordAt(A){let{text:e,from:t,length:i}=this.doc.lineAt(A),n=this.charCategorizer(A),a=A-t,r=A-t;for(;a>0;){let A=D(e,a,!1);if(n(e.slice(A,a))!=bA.Word)break;a=A}for(;r<i;){let A=D(e,r);if(n(e.slice(r,A))!=bA.Word)break;r=A}return a==r?null:Y.range(a+t,r+t)}}function SA(A,e,t={}){let i={};for(let e of A)for(let A of Object.keys(e)){let n=e[A],a=i[A];if(void 0===a)i[A]=n;else if(a===n||void 0===n);else{if(!Object.hasOwnProperty.call(t,A))throw new Error("Config merge conflict for field "+A);i[A]=t[A](a,n)}}for(let A in e)void 0===i[A]&&(i[A]=e[A]);return i}xA.allowMultipleSelections=sA,xA.tabSize=T.define({combine:A=>A.length?A[0]:4}),xA.lineSeparator=gA,xA.readOnly=CA,xA.phrases=T.define({compare(A,e){let t=Object.keys(A),i=Object.keys(e);return t.length==i.length&&t.every((t=>A[t]==e[t]))}}),xA.languageData=oA,xA.changeFilter=lA,xA.transactionFilter=cA,xA.transactionExtender=dA,tA.reconfigure=EA.define();class LA{eq(A){return this==A}range(A,e=A){return NA.create(A,e,this)}}function GA(A,e){return A==e||A.constructor==e.constructor&&A.eq(e)}LA.prototype.startSide=LA.prototype.endSide=0,LA.prototype.point=!1,LA.prototype.mapMode=v.TrackDel;class NA{constructor(A,e,t){this.from=A,this.to=e,this.value=t}static create(A,e,t){return new NA(A,e,t)}}function UA(A,e){return A.from-e.from||A.value.startSide-e.value.startSide}class RA{constructor(A,e,t,i){this.from=A,this.to=e,this.value=t,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(A,e,t,i=0){let n=t?this.to:this.from;for(let a=i,r=n.length;;){if(a==r)return a;let i=a+r>>1,o=n[i]-A||(t?this.value[i].endSide:this.value[i].startSide)-e;if(i==a)return o>=0?a:r;o>=0?r=i:a=i+1}}between(A,e,t,i){for(let n=this.findIndex(e,-1e9,!0),a=this.findIndex(t,1e9,!1,n);n<a;n++)if(!1===i(this.from[n]+A,this.to[n]+A,this.value[n]))return!1}map(A,e){let t=[],i=[],n=[],a=-1,r=-1;for(let o=0;o<this.value.length;o++){let s,g,l=this.value[o],c=this.from[o]+A,d=this.to[o]+A;if(c==d){let A=e.mapPos(c,l.startSide,l.mapMode);if(null==A)continue;if(s=g=A,l.startSide!=l.endSide&&(g=e.mapPos(c,l.endSide),g<s))continue}else if(s=e.mapPos(c,l.startSide),g=e.mapPos(d,l.endSide),s>g||s==g&&l.startSide>0&&l.endSide<=0)continue;(g-s||l.endSide-l.startSide)<0||(a<0&&(a=s),l.point&&(r=Math.max(r,g-s)),t.push(l),i.push(s-a),n.push(g-a))}return{mapped:t.length?new RA(i,n,t,r):null,pos:a}}}class MA{constructor(A,e,t,i){this.chunkPos=A,this.chunk=e,this.nextLayer=t,this.maxPoint=i}static create(A,e,t,i){return new MA(A,e,t,i)}get length(){let A=this.chunk.length-1;return A<0?0:Math.max(this.chunkEnd(A),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let A=this.nextLayer.size;for(let e of this.chunk)A+=e.value.length;return A}chunkEnd(A){return this.chunkPos[A]+this.chunk[A].length}update(A){let{add:e=[],sort:t=!1,filterFrom:i=0,filterTo:n=this.length}=A,a=A.filter;if(0==e.length&&!a)return this;if(t&&(e=e.slice().sort(UA)),this.isEmpty)return e.length?MA.of(e):this;let r=new KA(this,null,-1).goto(0),o=0,s=[],g=new FA;for(;r.value||o<e.length;)if(o<e.length&&(r.from-e[o].from||r.startSide-e[o].value.startSide)>=0){let A=e[o++];g.addInner(A.from,A.to,A.value)||s.push(A)}else 1==r.rangeIndex&&r.chunkIndex<this.chunk.length&&(o==e.length||this.chunkEnd(r.chunkIndex)<e[o].from)&&(!a||i>this.chunkEnd(r.chunkIndex)||n<this.chunkPos[r.chunkIndex])&&g.addChunk(this.chunkPos[r.chunkIndex],this.chunk[r.chunkIndex])?r.nextChunk():((!a||i>r.to||n<r.from||a(r.from,r.to,r.value))&&(g.addInner(r.from,r.to,r.value)||s.push(NA.create(r.from,r.to,r.value))),r.next());return g.finishInner(this.nextLayer.isEmpty&&!s.length?MA.empty:this.nextLayer.update({add:s,filter:a,filterFrom:i,filterTo:n}))}map(A){if(A.empty||this.isEmpty)return this;let e=[],t=[],i=-1;for(let n=0;n<this.chunk.length;n++){let a=this.chunkPos[n],r=this.chunk[n],o=A.touchesRange(a,a+r.length);if(!1===o)i=Math.max(i,r.maxPoint),e.push(r),t.push(A.mapPos(a));else if(!0===o){let{mapped:n,pos:o}=r.map(a,A);n&&(i=Math.max(i,n.maxPoint),e.push(n),t.push(o))}}let n=this.nextLayer.map(A);return 0==e.length?n:new MA(t,e,n||MA.empty,i)}between(A,e,t){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let n=this.chunkPos[i],a=this.chunk[i];if(e>=n&&A<=n+a.length&&!1===a.between(n,A-n,e-n,t))return}this.nextLayer.between(A,e,t)}}iter(A=0){return HA.from([this]).goto(A)}get isEmpty(){return this.nextLayer==this}static iter(A,e=0){return HA.from(A).goto(e)}static compare(A,e,t,i,n=-1){let a=A.filter((A=>A.maxPoint>0||!A.isEmpty&&A.maxPoint>=n)),r=e.filter((A=>A.maxPoint>0||!A.isEmpty&&A.maxPoint>=n)),o=YA(a,r,t),s=new JA(a,o,n),g=new JA(r,o,n);t.iterGaps(((A,e,t)=>OA(s,A,g,e,t,i))),t.empty&&0==t.length&&OA(s,0,g,0,0,i)}static eq(A,e,t=0,i){null==i&&(i=999999999);let n=A.filter((A=>!A.isEmpty&&e.indexOf(A)<0)),a=e.filter((e=>!e.isEmpty&&A.indexOf(e)<0));if(n.length!=a.length)return!1;if(!n.length)return!0;let r=YA(n,a),o=new JA(n,r,0).goto(t),s=new JA(a,r,0).goto(t);for(;;){if(o.to!=s.to||!PA(o.active,s.active)||o.point&&(!s.point||!GA(o.point,s.point)))return!1;if(o.to>i)return!0;o.next(),s.next()}}static spans(A,e,t,i,n=-1){let a=new JA(A,null,n).goto(e),r=e,o=a.openStart;for(;;){let A=Math.min(a.to,t);if(a.point){let t=a.activeForPoint(a.to),n=a.pointFrom<e?t.length+1:a.point.startSide<0?t.length:Math.min(t.length,o);i.point(r,A,a.point,t,n,a.pointRank),o=Math.min(a.openEnd(A),t.length)}else A>r&&(i.span(r,A,a.active,o),o=a.openEnd(A));if(a.to>t)return o+(a.point&&a.to>t?1:0);r=a.to,a.next()}}static of(A,e=!1){let t=new FA;for(let i of A instanceof NA?[A]:e?function(A){if(A.length>1)for(let e=A[0],t=1;t<A.length;t++){let i=A[t];if(UA(e,i)>0)return A.slice().sort(UA);e=i}return A}(A):A)t.add(i.from,i.to,i.value);return t.finish()}static join(A){if(!A.length)return MA.empty;let e=A[A.length-1];for(let t=A.length-2;t>=0;t--)for(let i=A[t];i!=MA.empty;i=i.nextLayer)e=new MA(i.chunkPos,i.chunk,e,Math.max(i.maxPoint,e.maxPoint));return e}}MA.empty=new MA([],[],null,-1),MA.empty.nextLayer=MA.empty;class FA{finishChunk(A){this.chunks.push(new RA(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,A&&(this.from=[],this.to=[],this.value=[])}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}add(A,e,t){this.addInner(A,e,t)||(this.nextLayer||(this.nextLayer=new FA)).add(A,e,t)}addInner(A,e,t){let i=A-this.lastTo||t.startSide-this.last.endSide;if(i<=0&&(A-this.lastFrom||t.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=A),this.from.push(A-this.chunkStart),this.to.push(e-this.chunkStart),this.last=t,this.lastFrom=A,this.lastTo=e,this.value.push(t),t.point&&(this.maxPoint=Math.max(this.maxPoint,e-A)),!0)}addChunk(A,e){if((A-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(A);let t=e.value.length-1;return this.last=e.value[t],this.lastFrom=e.from[t]+A,this.lastTo=e.to[t]+A,!0}finish(){return this.finishInner(MA.empty)}finishInner(A){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return A;let e=MA.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(A):A,this.setMaxPoint);return this.from=null,e}}function YA(A,e,t){let i=new Map;for(let e of A)for(let A=0;A<e.chunk.length;A++)e.chunk[A].maxPoint<=0&&i.set(e.chunk[A],e.chunkPos[A]);let n=new Set;for(let A of e)for(let e=0;e<A.chunk.length;e++){let a=i.get(A.chunk[e]);null==a||(t?t.mapPos(a):a)!=A.chunkPos[e]||(null==t?void 0:t.touchesRange(a,a+A.chunk[e].length))||n.add(A.chunk[e])}return n}class KA{constructor(A,e,t,i=0){this.layer=A,this.skip=e,this.minPoint=t,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(A,e=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(A,e,!1),this}gotoInner(A,e,t){for(;this.chunkIndex<this.layer.chunk.length;){let e=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(e)||this.layer.chunkEnd(this.chunkIndex)<A||e.maxPoint<this.minPoint))break;this.chunkIndex++,t=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(A-this.layer.chunkPos[this.chunkIndex],e,!0);(!t||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(A,e){(this.to-A||this.endSide-e)<0&&this.gotoInner(A,e,!0)}next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}{let A=this.layer.chunkPos[this.chunkIndex],e=this.layer.chunk[this.chunkIndex],t=A+e.from[this.rangeIndex];if(this.from=t,this.to=A+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(A){if(A==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=A}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(A){return this.from-A.from||this.startSide-A.startSide||this.rank-A.rank||this.to-A.to||this.endSide-A.endSide}}class HA{constructor(A){this.heap=A}static from(A,e=null,t=-1){let i=[];for(let n=0;n<A.length;n++)for(let a=A[n];!a.isEmpty;a=a.nextLayer)a.maxPoint>=t&&i.push(new KA(a,e,t,n));return 1==i.length?i[0]:new HA(i)}get startSide(){return this.value?this.value.startSide:0}goto(A,e=-1e9){for(let t of this.heap)t.goto(A,e);for(let A=this.heap.length>>1;A>=0;A--)TA(this.heap,A);return this.next(),this}forward(A,e){for(let t of this.heap)t.forward(A,e);for(let A=this.heap.length>>1;A>=0;A--)TA(this.heap,A);(this.to-A||this.value.endSide-e)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let A=this.heap[0];this.from=A.from,this.to=A.to,this.value=A.value,this.rank=A.rank,A.value&&A.next(),TA(this.heap,0)}}}function TA(A,e){for(let t=A[e];;){let i=1+(e<<1);if(i>=A.length)break;let n=A[i];if(i+1<A.length&&n.compare(A[i+1])>=0&&(n=A[i+1],i++),t.compare(n)<0)break;A[i]=t,A[e]=n,e=i}}class JA{constructor(A,e,t){this.minPoint=t,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=HA.from(A,e,t)}goto(A,e=-1e9){return this.cursor.goto(A,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=A,this.endSide=e,this.openStart=-1,this.next(),this}forward(A,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-A||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(A,e)}removeActive(A){jA(this.active,A),jA(this.activeTo,A),jA(this.activeRank,A),this.minActive=qA(this.active,this.activeTo)}addActive(A){let e=0,{value:t,to:i,rank:n}=this.cursor;for(;e<this.activeRank.length&&(n-this.activeRank[e]||i-this.activeTo[e])>0;)e++;WA(this.active,e,t),WA(this.activeTo,e,i),WA(this.activeRank,e,n),A&&WA(A,e,this.cursor.from),this.minActive=qA(this.active,this.activeTo)}next(){let A=this.to,e=this.point;this.point=null;let t=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>A){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),t&&jA(t,i)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>A){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let A=this.cursor.value;if(A.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=A,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=A.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(t),this.cursor.next()}}}if(t){this.openStart=0;for(let e=t.length-1;e>=0&&t[e]<A;e--)this.openStart++}}activeForPoint(A){if(!this.active.length)return this.active;let e=[];for(let t=this.active.length-1;t>=0&&!(this.activeRank[t]<this.pointRank);t--)(this.activeTo[t]>A||this.activeTo[t]==A&&this.active[t].endSide>=this.point.endSide)&&e.push(this.active[t]);return e.reverse()}openEnd(A){let e=0;for(let t=this.activeTo.length-1;t>=0&&this.activeTo[t]>A;t--)e++;return e}}function OA(A,e,t,i,n,a){A.goto(e),t.goto(i);let r=i+n,o=i,s=i-e,g=!!a.boundChange;for(let e=!1;;){let i=A.to+s-t.to,n=i||A.endSide-t.endSide,l=n<0?A.to+s:t.to,c=Math.min(l,r);if(A.point||t.point?(A.point&&t.point&&GA(A.point,t.point)&&PA(A.activeForPoint(A.to),t.activeForPoint(t.to))||a.comparePoint(o,c,A.point,t.point),e=!1):(e&&a.boundChange(o),c>o&&!PA(A.active,t.active)&&a.compareRange(o,c,A.active,t.active),g&&c<r&&(i||A.openEnd(l)!=t.openEnd(l))&&(e=!0)),l>r)break;o=l,n<=0&&A.next(),n>=0&&t.next()}}function PA(A,e){if(A.length!=e.length)return!1;for(let t=0;t<A.length;t++)if(A[t]!=e[t]&&!GA(A[t],e[t]))return!1;return!0}function jA(A,e){for(let t=e,i=A.length-1;t<i;t++)A[t]=A[t+1];A.pop()}function WA(A,e,t){for(let t=A.length-1;t>=e;t--)A[t+1]=A[t];A[e]=t}function qA(A,e){let t=-1,i=1e9;for(let n=0;n<e.length;n++)(e[n]-i||A[n].endSide-A[t].endSide)<0&&(t=n,i=e[n]);return t}function ZA(A,e,t=A.length){let i=0;for(let n=0;n<t&&n<A.length;)9==A.charCodeAt(n)?(i+=e-i%e,n++):(i++,n=D(A,n));return i}const zA="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),VA="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),XA="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class _A{constructor(A,e){this.rules=[];let{finish:t}=e||{};function i(A){return/^@/.test(A)?[A]:A.split(/,\s*/)}function n(A,e,a,r){let o=[],s=/^@(\w+)\b/.exec(A[0]),g=s&&"keyframes"==s[1];if(s&&null==e)return a.push(A[0]+";");for(let t in e){let r=e[t];if(/&/.test(t))n(t.split(/,\s*/).map((e=>A.map((A=>e.replace(/&/,A))))).reduce(((A,e)=>A.concat(e))),r,a);else if(r&&"object"==typeof r){if(!s)throw new RangeError("The value of a property ("+t+") should be a primitive value.");n(i(t),r,o,g)}else null!=r&&o.push(t.replace(/_.*/,"").replace(/[A-Z]/g,(A=>"-"+A.toLowerCase()))+": "+r+";")}(o.length||g)&&a.push((!t||s||r?A:A.map(t)).join(", ")+" {"+o.join(" ")+"}")}for(let e in A)n(i(e),A[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let A=XA[zA]||1;return XA[zA]=A+1,"ͼ"+A.toString(36)}static mount(A,e,t){let i=A[VA],n=t&&t.nonce;i?n&&i.setNonce(n):i=new Ae(A,n),i.mount(Array.isArray(e)?e:[e],A)}}let $A=new Map;class Ae{constructor(A,e){let t=A.ownerDocument||A,i=t.defaultView;if(!A.head&&A.adoptedStyleSheets&&i.CSSStyleSheet){let e=$A.get(t);if(e)return A[VA]=e;this.sheet=new i.CSSStyleSheet,$A.set(t,this)}else this.styleTag=t.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);this.m