From 09f54bbddb3713668cfb3135dac68914ad0fc4b2 Mon Sep 17 00:00:00 2001 From: leomcelroy Date: Fri, 3 May 2024 05:54:29 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20leomcelr?= =?UTF-8?q?oy/svg-pcb@53838386633140e27af7cd7a25ec2fcb00c39b15=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{index-502f3513.js => index-129df1fd.js} | 318 +++++++++--------- index.html | 2 +- 2 files changed, 165 insertions(+), 155 deletions(-) rename assets/{index-502f3513.js => index-129df1fd.js} (87%) diff --git a/assets/index-502f3513.js b/assets/index-129df1fd.js similarity index 87% rename from assets/index-502f3513.js rename to assets/index-129df1fd.js index 3bb6f28..02ae607 100644 --- a/assets/index-502f3513.js +++ b/assets/index-129df1fd.js @@ -8,10 +8,10 @@ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/js JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE -*/(function(i,t){(function(e){i.exports=e()})(function(){return function e(n,r,o){function s(u,c){if(!r[u]){if(!n[u]){var d=typeof Xo=="function"&&Xo;if(!c&&d)return d(u,!0);if(a)return a(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var g=r[u]={exports:{}};n[u][0].call(g.exports,function(x){var m=n[u][1][x];return s(m||x)},g,g.exports,e,n,r,o)}return r[u].exports}for(var a=typeof Xo=="function"&&Xo,l=0;l>2,g=(3&u)<<4|c>>4,x=1>6:64,m=2>4,c=(15&f)<<4|(g=a.indexOf(l.charAt(m++)))>>2,d=(3&g)<<6|(x=a.indexOf(l.charAt(m++))),b[v++]=u,g!==64&&(b[v++]=c),x!==64&&(b[v++]=d);return b}},{"./support":30,"./utils":32}],2:[function(e,n,r){var o=e("./external"),s=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),l=e("./stream/DataLengthProbe");function u(c,d,f,g,x){this.compressedSize=c,this.uncompressedSize=d,this.crc32=f,this.compression=g,this.compressedContent=x}u.prototype={getContentWorker:function(){var c=new s(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),d=this;return c.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),c},getCompressedWorker:function(){return new s(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(c,d,f){return c.pipe(new a).pipe(new l("uncompressedSize")).pipe(d.compressWorker(f)).pipe(new l("compressedSize")).withStreamInfo("compression",d)},n.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,n,r){var o=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,n,r){var o=e("./utils"),s=function(){for(var a,l=[],u=0;u<256;u++){a=u;for(var c=0;c<8;c++)a=1&a?3988292384^a>>>1:a>>>1;l[u]=a}return l}();n.exports=function(a,l){return a!==void 0&&a.length?o.getTypeOf(a)!=="string"?function(u,c,d,f){var g=s,x=f+d;u^=-1;for(var m=f;m>>8^g[255&(u^c[m])];return-1^u}(0|l,a,a.length,0):function(u,c,d,f){var g=s,x=f+d;u^=-1;for(var m=f;m>>8^g[255&(u^c.charCodeAt(m))];return-1^u}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(e,n,r){r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,n,r){var o=null;o=typeof Promise<"u"?Promise:e("lie"),n.exports={Promise:o}},{lie:37}],7:[function(e,n,r){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=e("pako"),a=e("./utils"),l=e("./stream/GenericWorker"),u=o?"uint8array":"array";function c(d,f){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=f,this.meta={}}r.magic="\b\0",a.inherits(c,l),c.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,d.data),!1)},c.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(f){d.push({data:f,meta:d.meta})}},r.compressWorker=function(d){return new c("Deflate",d)},r.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,n,r){function o(g,x){var m,v="";for(m=0;m>>=8;return v}function s(g,x,m,v,O,b){var k,E,$=g.file,N=g.compression,X=b!==u.utf8encode,R=a.transformTo("string",b($.name)),W=a.transformTo("string",u.utf8encode($.name)),D=$.comment,z=a.transformTo("string",b(D)),Q=a.transformTo("string",u.utf8encode(D)),U=W.length!==$.name.length,T=Q.length!==D.length,H="",gt="",at="",Et=$.dir,pt=$.date,Pt={crc32:0,compressedSize:0,uncompressedSize:0};x&&!m||(Pt.crc32=g.crc32,Pt.compressedSize=g.compressedSize,Pt.uncompressedSize=g.uncompressedSize);var nt=0;x&&(nt|=8),X||!U&&!T||(nt|=2048);var it=0,It=0;Et&&(it|=16),O==="UNIX"?(It=798,it|=function(xt,Kt){var Ct=xt;return xt||(Ct=Kt?16893:33204),(65535&Ct)<<16}($.unixPermissions,Et)):(It=20,it|=function(xt){return 63&(xt||0)}($.dosPermissions)),k=pt.getUTCHours(),k<<=6,k|=pt.getUTCMinutes(),k<<=5,k|=pt.getUTCSeconds()/2,E=pt.getUTCFullYear()-1980,E<<=4,E|=pt.getUTCMonth()+1,E<<=5,E|=pt.getUTCDate(),U&&(gt=o(1,1)+o(c(R),4)+W,H+="up"+o(gt.length,2)+gt),T&&(at=o(1,1)+o(c(z),4)+Q,H+="uc"+o(at.length,2)+at);var kt="";return kt+=` -\0`,kt+=o(nt,2),kt+=N.magic,kt+=o(k,2),kt+=o(E,2),kt+=o(Pt.crc32,4),kt+=o(Pt.compressedSize,4),kt+=o(Pt.uncompressedSize,4),kt+=o(R.length,2),kt+=o(H.length,2),{fileRecord:d.LOCAL_FILE_HEADER+kt+R+H,dirRecord:d.CENTRAL_FILE_HEADER+o(It,2)+kt+o(z.length,2)+"\0\0\0\0"+o(it,4)+o(v,4)+R+H+z}}var a=e("../utils"),l=e("../stream/GenericWorker"),u=e("../utf8"),c=e("../crc32"),d=e("../signature");function f(g,x,m,v){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=x,this.zipPlatform=m,this.encodeFileName=v,this.streamFiles=g,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(f,l),f.prototype.push=function(g){var x=g.meta.percent||0,m=this.entriesCount,v=this._sources.length;this.accumulate?this.contentBuffer.push(g):(this.bytesWritten+=g.data.length,l.prototype.push.call(this,{data:g.data,meta:{currentFile:this.currentFile,percent:m?(x+100*(m-v-1))/m:100}}))},f.prototype.openedSource=function(g){this.currentSourceOffset=this.bytesWritten,this.currentFile=g.file.name;var x=this.streamFiles&&!g.file.dir;if(x){var m=s(g,x,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(g){this.accumulate=!1;var x=this.streamFiles&&!g.file.dir,m=s(g,x,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),x)this.push({data:function(v){return d.DATA_DESCRIPTOR+o(v.crc32,4)+o(v.compressedSize,4)+o(v.uncompressedSize,4)}(g),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var g=this.bytesWritten,x=0;x=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return o.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},n.exports=s},{"../utils":32}],19:[function(e,n,r){var o=e("./Uint8ArrayReader");function s(a){o.call(this,a)}e("../utils").inherits(s,o),s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,n,r){var o=e("./DataReader");function s(a){o.call(this,a)}e("../utils").inherits(s,o),s.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},s.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},s.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=s},{"../utils":32,"./DataReader":18}],21:[function(e,n,r){var o=e("./ArrayReader");function s(a){o.call(this,a)}e("../utils").inherits(s,o),s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(e,n,r){var o=e("../utils"),s=e("../support"),a=e("./ArrayReader"),l=e("./StringReader"),u=e("./NodeBufferReader"),c=e("./Uint8ArrayReader");n.exports=function(d){var f=o.getTypeOf(d);return o.checkSupport(f),f!=="string"||s.uint8array?f==="nodebuffer"?new u(d):s.uint8array?new c(o.transformTo("uint8array",d)):new a(o.transformTo("array",d)):new l(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,n,r){r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(e,n,r){var o=e("./GenericWorker"),s=e("../utils");function a(l){o.call(this,"ConvertWorker to "+l),this.destType=l}s.inherits(a,o),a.prototype.processChunk=function(l){this.push({data:s.transformTo(this.destType,l.data),meta:l.meta})},n.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,n,r){var o=e("./GenericWorker"),s=e("../crc32");function a(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(a,o),a.prototype.processChunk=function(l){this.streamInfo.crc32=s(l.data,this.streamInfo.crc32||0),this.push(l)},n.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,n,r){var o=e("../utils"),s=e("./GenericWorker");function a(l){s.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}o.inherits(a,s),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}s.prototype.processChunk.call(this,l)},n.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,n,r){var o=e("../utils"),s=e("./GenericWorker");function a(l){s.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(c){u.dataIsReady=!0,u.data=c,u.max=c&&c.length||0,u.type=o.getTypeOf(c),u.isPaused||u._tickAndRepeat()},function(c){u.error(c)})}o.inherits(a,s),a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,n,r){function o(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,a){return this._listeners[s].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,a){if(this._listeners[s])for(var l=0;l "+s:s}},n.exports=o},{}],29:[function(e,n,r){var o=e("../utils"),s=e("./ConvertWorker"),a=e("./GenericWorker"),l=e("../base64"),u=e("../support"),c=e("../external"),d=null;if(u.nodestream)try{d=e("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(x,m){return new c.Promise(function(v,O){var b=[],k=x._internalType,E=x._outputType,$=x._mimeType;x.on("data",function(N,X){b.push(N),m&&m(X)}).on("error",function(N){b=[],O(N)}).on("end",function(){try{var N=function(X,R,W){switch(X){case"blob":return o.newBlob(o.transformTo("arraybuffer",R),W);case"base64":return l.encode(R);default:return o.transformTo(X,R)}}(E,function(X,R){var W,D=0,z=null,Q=0;for(W=0;W"u")r.blob=!1;else{var o=new ArrayBuffer(0);try{r.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(o),r.blob=s.getBlob("application/zip").size===0}catch{r.blob=!1}}}try{r.nodestream=!!e("readable-stream").Readable}catch{r.nodestream=!1}},{"readable-stream":16}],31:[function(e,n,r){for(var o=e("./utils"),s=e("./support"),a=e("./nodejsUtils"),l=e("./stream/GenericWorker"),u=new Array(256),c=0;c<256;c++)u[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;u[254]=u[254]=1;function d(){l.call(this,"utf-8 decode"),this.leftOver=null}function f(){l.call(this,"utf-8 encode")}r.utf8encode=function(g){return s.nodebuffer?a.newBufferFrom(g,"utf-8"):function(x){var m,v,O,b,k,E=x.length,$=0;for(b=0;b>>6:(v<65536?m[k++]=224|v>>>12:(m[k++]=240|v>>>18,m[k++]=128|v>>>12&63),m[k++]=128|v>>>6&63),m[k++]=128|63&v);return m}(g)},r.utf8decode=function(g){return s.nodebuffer?o.transformTo("nodebuffer",g).toString("utf-8"):function(x){var m,v,O,b,k=x.length,E=new Array(2*k);for(m=v=0;m>10&1023,E[v++]=56320|1023&O)}return E.length!==v&&(E.subarray?E=E.subarray(0,v):E.length=v),o.applyFromCharCode(E)}(g=o.transformTo(s.uint8array?"uint8array":"array",g))},o.inherits(d,l),d.prototype.processChunk=function(g){var x=o.transformTo(s.uint8array?"uint8array":"array",g.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var m=x;(x=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),x.set(m,this.leftOver.length)}else x=this.leftOver.concat(x);this.leftOver=null}var v=function(b,k){var E;for((k=k||b.length)>b.length&&(k=b.length),E=k-1;0<=E&&(192&b[E])==128;)E--;return E<0||E===0?k:E+u[b[E]]>k?E:k}(x),O=x;v!==x.length&&(s.uint8array?(O=x.subarray(0,v),this.leftOver=x.subarray(v,x.length)):(O=x.slice(0,v),this.leftOver=x.slice(v,x.length))),this.push({data:r.utf8decode(O),meta:g.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=d,o.inherits(f,l),f.prototype.processChunk=function(g){this.push({data:r.utf8encode(g.data),meta:g.meta})},r.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,n,r){var o=e("./support"),s=e("./base64"),a=e("./nodejsUtils"),l=e("./external");function u(m){return m}function c(m,v){for(var O=0;O>8;this.dir=!!(16&this.externalFileAttributes),g==0&&(this.dosPermissions=63&this.externalFileAttributes),g==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var g=o(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=g.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=g.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=g.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=g.readInt(4))}},readExtraFields:function(g){var x,m,v,O=g.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});g.index+4>>6:(g<65536?f[v++]=224|g>>>12:(f[v++]=240|g>>>18,f[v++]=128|g>>>12&63),f[v++]=128|g>>>6&63),f[v++]=128|63&g);return f},r.buf2binstring=function(d){return c(d,d.length)},r.binstring2buf=function(d){for(var f=new o.Buf8(d.length),g=0,x=f.length;g>10&1023,b[x++]=56320|1023&m)}return c(b,x)},r.utf8border=function(d,f){var g;for((f=f||d.length)>d.length&&(f=d.length),g=f-1;0<=g&&(192&d[g])==128;)g--;return g<0||g===0?f:g+l[d[g]]>f?g:f}},{"./common":41}],43:[function(e,n,r){n.exports=function(o,s,a,l){for(var u=65535&o|0,c=o>>>16&65535|0,d=0;a!==0;){for(a-=d=2e3>>1:s>>>1;a[l]=s}return a}();n.exports=function(s,a,l,u){var c=o,d=u+l;s^=-1;for(var f=u;f>>8^c[255&(s^a[f])];return-1^s}},{}],46:[function(e,n,r){var o,s=e("../utils/common"),a=e("./trees"),l=e("./adler32"),u=e("./crc32"),c=e("./messages"),d=0,f=4,g=0,x=-2,m=-1,v=4,O=2,b=8,k=9,E=286,$=30,N=19,X=2*E+1,R=15,W=3,D=258,z=D+W+1,Q=42,U=113,T=1,H=2,gt=3,at=4;function Et(B,ut){return B.msg=c[ut],ut}function pt(B){return(B<<1)-(4B.avail_out&&(ft=B.avail_out),ft!==0&&(s.arraySet(B.output,ut.pending_buf,ut.pending_out,ft,B.next_out),B.next_out+=ft,ut.pending_out+=ft,B.total_out+=ft,B.avail_out-=ft,ut.pending-=ft,ut.pending===0&&(ut.pending_out=0))}function it(B,ut){a._tr_flush_block(B,0<=B.block_start?B.block_start:-1,B.strstart-B.block_start,ut),B.block_start=B.strstart,nt(B.strm)}function It(B,ut){B.pending_buf[B.pending++]=ut}function kt(B,ut){B.pending_buf[B.pending++]=ut>>>8&255,B.pending_buf[B.pending++]=255&ut}function xt(B,ut){var ft,G,V=B.max_chain_length,rt=B.strstart,bt=B.prev_length,wt=B.nice_match,ot=B.strstart>B.w_size-z?B.strstart-(B.w_size-z):0,Dt=B.window,Xt=B.w_mask,Tt=B.prev,qt=B.strstart+D,fe=Dt[rt+bt-1],ae=Dt[rt+bt];B.prev_length>=B.good_match&&(V>>=2),wt>B.lookahead&&(wt=B.lookahead);do if(Dt[(ft=ut)+bt]===ae&&Dt[ft+bt-1]===fe&&Dt[ft]===Dt[rt]&&Dt[++ft]===Dt[rt+1]){rt+=2,ft++;do;while(Dt[++rt]===Dt[++ft]&&Dt[++rt]===Dt[++ft]&&Dt[++rt]===Dt[++ft]&&Dt[++rt]===Dt[++ft]&&Dt[++rt]===Dt[++ft]&&Dt[++rt]===Dt[++ft]&&Dt[++rt]===Dt[++ft]&&Dt[++rt]===Dt[++ft]&&rtot&&--V!=0);return bt<=B.lookahead?bt:B.lookahead}function Kt(B){var ut,ft,G,V,rt,bt,wt,ot,Dt,Xt,Tt=B.w_size;do{if(V=B.window_size-B.lookahead-B.strstart,B.strstart>=Tt+(Tt-z)){for(s.arraySet(B.window,B.window,Tt,Tt,0),B.match_start-=Tt,B.strstart-=Tt,B.block_start-=Tt,ut=ft=B.hash_size;G=B.head[--ut],B.head[ut]=Tt<=G?G-Tt:0,--ft;);for(ut=ft=Tt;G=B.prev[--ut],B.prev[ut]=Tt<=G?G-Tt:0,--ft;);V+=Tt}if(B.strm.avail_in===0)break;if(bt=B.strm,wt=B.window,ot=B.strstart+B.lookahead,Dt=V,Xt=void 0,Xt=bt.avail_in,Dt=W)for(rt=B.strstart-B.insert,B.ins_h=B.window[rt],B.ins_h=(B.ins_h<=W&&(B.ins_h=(B.ins_h<=W)if(G=a._tr_tally(B,B.strstart-B.match_start,B.match_length-W),B.lookahead-=B.match_length,B.match_length<=B.max_lazy_match&&B.lookahead>=W){for(B.match_length--;B.strstart++,B.ins_h=(B.ins_h<=W&&(B.ins_h=(B.ins_h<=W&&B.match_length<=B.prev_length){for(V=B.strstart+B.lookahead-W,G=a._tr_tally(B,B.strstart-1-B.prev_match,B.prev_length-W),B.lookahead-=B.prev_length-1,B.prev_length-=2;++B.strstart<=V&&(B.ins_h=(B.ins_h<B.pending_buf_size-5&&(ft=B.pending_buf_size-5);;){if(B.lookahead<=1){if(Kt(B),B.lookahead===0&&ut===d)return T;if(B.lookahead===0)break}B.strstart+=B.lookahead,B.lookahead=0;var G=B.block_start+ft;if((B.strstart===0||B.strstart>=G)&&(B.lookahead=B.strstart-G,B.strstart=G,it(B,!1),B.strm.avail_out===0)||B.strstart-B.block_start>=B.w_size-z&&(it(B,!1),B.strm.avail_out===0))return T}return B.insert=0,ut===f?(it(B,!0),B.strm.avail_out===0?gt:at):(B.strstart>B.block_start&&(it(B,!1),B.strm.avail_out),T)}),new Yt(4,4,8,4,Ct),new Yt(4,5,16,8,Ct),new Yt(4,6,32,32,Ct),new Yt(4,4,16,16,Wt),new Yt(8,16,32,32,Wt),new Yt(8,16,128,128,Wt),new Yt(8,32,128,256,Wt),new Yt(32,128,258,1024,Wt),new Yt(32,258,258,4096,Wt)],r.deflateInit=function(B,ut){return oe(B,ut,b,15,8,0)},r.deflateInit2=oe,r.deflateReset=xe,r.deflateResetKeep=Jt,r.deflateSetHeader=function(B,ut){return B&&B.state?B.state.wrap!==2?x:(B.state.gzhead=ut,g):x},r.deflate=function(B,ut){var ft,G,V,rt;if(!B||!B.state||5>8&255),It(G,G.gzhead.time>>16&255),It(G,G.gzhead.time>>24&255),It(G,G.level===9?2:2<=G.strategy||G.level<2?4:0),It(G,255&G.gzhead.os),G.gzhead.extra&&G.gzhead.extra.length&&(It(G,255&G.gzhead.extra.length),It(G,G.gzhead.extra.length>>8&255)),G.gzhead.hcrc&&(B.adler=u(B.adler,G.pending_buf,G.pending,0)),G.gzindex=0,G.status=69):(It(G,0),It(G,0),It(G,0),It(G,0),It(G,0),It(G,G.level===9?2:2<=G.strategy||G.level<2?4:0),It(G,3),G.status=U);else{var bt=b+(G.w_bits-8<<4)<<8;bt|=(2<=G.strategy||G.level<2?0:G.level<6?1:G.level===6?2:3)<<6,G.strstart!==0&&(bt|=32),bt+=31-bt%31,G.status=U,kt(G,bt),G.strstart!==0&&(kt(G,B.adler>>>16),kt(G,65535&B.adler)),B.adler=1}if(G.status===69)if(G.gzhead.extra){for(V=G.pending;G.gzindex<(65535&G.gzhead.extra.length)&&(G.pending!==G.pending_buf_size||(G.gzhead.hcrc&&G.pending>V&&(B.adler=u(B.adler,G.pending_buf,G.pending-V,V)),nt(B),V=G.pending,G.pending!==G.pending_buf_size));)It(G,255&G.gzhead.extra[G.gzindex]),G.gzindex++;G.gzhead.hcrc&&G.pending>V&&(B.adler=u(B.adler,G.pending_buf,G.pending-V,V)),G.gzindex===G.gzhead.extra.length&&(G.gzindex=0,G.status=73)}else G.status=73;if(G.status===73)if(G.gzhead.name){V=G.pending;do{if(G.pending===G.pending_buf_size&&(G.gzhead.hcrc&&G.pending>V&&(B.adler=u(B.adler,G.pending_buf,G.pending-V,V)),nt(B),V=G.pending,G.pending===G.pending_buf_size)){rt=1;break}rt=G.gzindexV&&(B.adler=u(B.adler,G.pending_buf,G.pending-V,V)),rt===0&&(G.gzindex=0,G.status=91)}else G.status=91;if(G.status===91)if(G.gzhead.comment){V=G.pending;do{if(G.pending===G.pending_buf_size&&(G.gzhead.hcrc&&G.pending>V&&(B.adler=u(B.adler,G.pending_buf,G.pending-V,V)),nt(B),V=G.pending,G.pending===G.pending_buf_size)){rt=1;break}rt=G.gzindexV&&(B.adler=u(B.adler,G.pending_buf,G.pending-V,V)),rt===0&&(G.status=103)}else G.status=103;if(G.status===103&&(G.gzhead.hcrc?(G.pending+2>G.pending_buf_size&&nt(B),G.pending+2<=G.pending_buf_size&&(It(G,255&B.adler),It(G,B.adler>>8&255),B.adler=0,G.status=U)):G.status=U),G.pending!==0){if(nt(B),B.avail_out===0)return G.last_flush=-1,g}else if(B.avail_in===0&&pt(ut)<=pt(ft)&&ut!==f)return Et(B,-5);if(G.status===666&&B.avail_in!==0)return Et(B,-5);if(B.avail_in!==0||G.lookahead!==0||ut!==d&&G.status!==666){var wt=G.strategy===2?function(ot,Dt){for(var Xt;;){if(ot.lookahead===0&&(Kt(ot),ot.lookahead===0)){if(Dt===d)return T;break}if(ot.match_length=0,Xt=a._tr_tally(ot,0,ot.window[ot.strstart]),ot.lookahead--,ot.strstart++,Xt&&(it(ot,!1),ot.strm.avail_out===0))return T}return ot.insert=0,Dt===f?(it(ot,!0),ot.strm.avail_out===0?gt:at):ot.last_lit&&(it(ot,!1),ot.strm.avail_out===0)?T:H}(G,ut):G.strategy===3?function(ot,Dt){for(var Xt,Tt,qt,fe,ae=ot.window;;){if(ot.lookahead<=D){if(Kt(ot),ot.lookahead<=D&&Dt===d)return T;if(ot.lookahead===0)break}if(ot.match_length=0,ot.lookahead>=W&&0ot.lookahead&&(ot.match_length=ot.lookahead)}if(ot.match_length>=W?(Xt=a._tr_tally(ot,1,ot.match_length-W),ot.lookahead-=ot.match_length,ot.strstart+=ot.match_length,ot.match_length=0):(Xt=a._tr_tally(ot,0,ot.window[ot.strstart]),ot.lookahead--,ot.strstart++),Xt&&(it(ot,!1),ot.strm.avail_out===0))return T}return ot.insert=0,Dt===f?(it(ot,!0),ot.strm.avail_out===0?gt:at):ot.last_lit&&(it(ot,!1),ot.strm.avail_out===0)?T:H}(G,ut):o[G.level].func(G,ut);if(wt!==gt&&wt!==at||(G.status=666),wt===T||wt===gt)return B.avail_out===0&&(G.last_flush=-1),g;if(wt===H&&(ut===1?a._tr_align(G):ut!==5&&(a._tr_stored_block(G,0,0,!1),ut===3&&(Pt(G.head),G.lookahead===0&&(G.strstart=0,G.block_start=0,G.insert=0))),nt(B),B.avail_out===0))return G.last_flush=-1,g}return ut!==f?g:G.wrap<=0?1:(G.wrap===2?(It(G,255&B.adler),It(G,B.adler>>8&255),It(G,B.adler>>16&255),It(G,B.adler>>24&255),It(G,255&B.total_in),It(G,B.total_in>>8&255),It(G,B.total_in>>16&255),It(G,B.total_in>>24&255)):(kt(G,B.adler>>>16),kt(G,65535&B.adler)),nt(B),0=ft.w_size&&(rt===0&&(Pt(ft.head),ft.strstart=0,ft.block_start=0,ft.insert=0),Dt=new s.Buf8(ft.w_size),s.arraySet(Dt,ut,Xt-ft.w_size,ft.w_size,0),ut=Dt,Xt=ft.w_size),bt=B.avail_in,wt=B.next_in,ot=B.input,B.avail_in=Xt,B.next_in=0,B.input=ut,Kt(ft);ft.lookahead>=W;){for(G=ft.strstart,V=ft.lookahead-(W-1);ft.ins_h=(ft.ins_h<>>=W=R>>>24,k-=W,(W=R>>>16&255)===0)H[c++]=65535&R;else{if(!(16&W)){if(!(64&W)){R=E[(65535&R)+(b&(1<>>=W,k-=W),k<15&&(b+=T[l++]<>>=W=R>>>24,k-=W,!(16&(W=R>>>16&255))){if(!(64&W)){R=$[(65535&R)+(b&(1<>>=W,k-=W,(W=c-d)>3,b&=(1<<(k-=D<<3))-1,o.next_in=l,o.next_out=c,o.avail_in=l>>24&255)+(Q>>>8&65280)+((65280&Q)<<8)+((255&Q)<<24)}function b(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function k(Q){var U;return Q&&Q.state?(U=Q.state,Q.total_in=Q.total_out=U.total=0,Q.msg="",U.wrap&&(Q.adler=1&U.wrap),U.mode=x,U.last=0,U.havedict=0,U.dmax=32768,U.head=null,U.hold=0,U.bits=0,U.lencode=U.lendyn=new o.Buf32(m),U.distcode=U.distdyn=new o.Buf32(v),U.sane=1,U.back=-1,f):g}function E(Q){var U;return Q&&Q.state?((U=Q.state).wsize=0,U.whave=0,U.wnext=0,k(Q)):g}function $(Q,U){var T,H;return Q&&Q.state?(H=Q.state,U<0?(T=0,U=-U):(T=1+(U>>4),U<48&&(U&=15)),U&&(U<8||15=at.wsize?(o.arraySet(at.window,U,T-at.wsize,at.wsize,0),at.wnext=0,at.whave=at.wsize):(H<(gt=at.wsize-at.wnext)&&(gt=H),o.arraySet(at.window,U,T-H,gt,at.wnext),(H-=gt)?(o.arraySet(at.window,U,T-H,H,0),at.wnext=H,at.whave=at.wsize):(at.wnext+=gt,at.wnext===at.wsize&&(at.wnext=0),at.whave>>8&255,T.check=a(T.check,rt,2,0),it=nt=0,T.mode=2;break}if(T.flags=0,T.head&&(T.head.done=!1),!(1&T.wrap)||(((255&nt)<<8)+(nt>>8))%31){Q.msg="incorrect header check",T.mode=30;break}if((15&nt)!=8){Q.msg="unknown compression method",T.mode=30;break}if(it-=4,B=8+(15&(nt>>>=4)),T.wbits===0)T.wbits=B;else if(B>T.wbits){Q.msg="invalid window size",T.mode=30;break}T.dmax=1<>8&1),512&T.flags&&(rt[0]=255&nt,rt[1]=nt>>>8&255,T.check=a(T.check,rt,2,0)),it=nt=0,T.mode=3;case 3:for(;it<32;){if(pt===0)break t;pt--,nt+=H[at++]<>>8&255,rt[2]=nt>>>16&255,rt[3]=nt>>>24&255,T.check=a(T.check,rt,4,0)),it=nt=0,T.mode=4;case 4:for(;it<16;){if(pt===0)break t;pt--,nt+=H[at++]<>8),512&T.flags&&(rt[0]=255&nt,rt[1]=nt>>>8&255,T.check=a(T.check,rt,2,0)),it=nt=0,T.mode=5;case 5:if(1024&T.flags){for(;it<16;){if(pt===0)break t;pt--,nt+=H[at++]<>>8&255,T.check=a(T.check,rt,2,0)),it=nt=0}else T.head&&(T.head.extra=null);T.mode=6;case 6:if(1024&T.flags&&(pt<(xt=T.length)&&(xt=pt),xt&&(T.head&&(B=T.head.extra_len-T.length,T.head.extra||(T.head.extra=new Array(T.head.extra_len)),o.arraySet(T.head.extra,H,at,xt,B)),512&T.flags&&(T.check=a(T.check,H,xt,at)),pt-=xt,at+=xt,T.length-=xt),T.length))break t;T.length=0,T.mode=7;case 7:if(2048&T.flags){if(pt===0)break t;for(xt=0;B=H[at+xt++],T.head&&B&&T.length<65536&&(T.head.name+=String.fromCharCode(B)),B&&xt>9&1,T.head.done=!0),Q.adler=T.check=0,T.mode=12;break;case 10:for(;it<32;){if(pt===0)break t;pt--,nt+=H[at++]<>>=7&it,it-=7&it,T.mode=27;break}for(;it<3;){if(pt===0)break t;pt--,nt+=H[at++]<>>=1)){case 0:T.mode=14;break;case 1:if(D(T),T.mode=20,U!==6)break;nt>>>=2,it-=2;break t;case 2:T.mode=17;break;case 3:Q.msg="invalid block type",T.mode=30}nt>>>=2,it-=2;break;case 14:for(nt>>>=7&it,it-=7⁢it<32;){if(pt===0)break t;pt--,nt+=H[at++]<>>16^65535)){Q.msg="invalid stored block lengths",T.mode=30;break}if(T.length=65535&nt,it=nt=0,T.mode=15,U===6)break t;case 15:T.mode=16;case 16:if(xt=T.length){if(pt>>=5,it-=5,T.ndist=1+(31&nt),nt>>>=5,it-=5,T.ncode=4+(15&nt),nt>>>=4,it-=4,286>>=3,it-=3}for(;T.have<19;)T.lens[bt[T.have++]]=0;if(T.lencode=T.lendyn,T.lenbits=7,ft={bits:T.lenbits},ut=u(0,T.lens,0,19,T.lencode,0,T.work,ft),T.lenbits=ft.bits,ut){Q.msg="invalid code lengths set",T.mode=30;break}T.have=0,T.mode=19;case 19:for(;T.have>>16&255,te=65535&V,!((Wt=V>>>24)<=it);){if(pt===0)break t;pt--,nt+=H[at++]<>>=Wt,it-=Wt,T.lens[T.have++]=te;else{if(te===16){for(G=Wt+2;it>>=Wt,it-=Wt,T.have===0){Q.msg="invalid bit length repeat",T.mode=30;break}B=T.lens[T.have-1],xt=3+(3&nt),nt>>>=2,it-=2}else if(te===17){for(G=Wt+3;it>>=Wt)),nt>>>=3,it-=3}else{for(G=Wt+7;it>>=Wt)),nt>>>=7,it-=7}if(T.have+xt>T.nlen+T.ndist){Q.msg="invalid bit length repeat",T.mode=30;break}for(;xt--;)T.lens[T.have++]=B}}if(T.mode===30)break;if(T.lens[256]===0){Q.msg="invalid code -- missing end-of-block",T.mode=30;break}if(T.lenbits=9,ft={bits:T.lenbits},ut=u(c,T.lens,0,T.nlen,T.lencode,0,T.work,ft),T.lenbits=ft.bits,ut){Q.msg="invalid literal/lengths set",T.mode=30;break}if(T.distbits=6,T.distcode=T.distdyn,ft={bits:T.distbits},ut=u(d,T.lens,T.nlen,T.ndist,T.distcode,0,T.work,ft),T.distbits=ft.bits,ut){Q.msg="invalid distances set",T.mode=30;break}if(T.mode=20,U===6)break t;case 20:T.mode=21;case 21:if(6<=pt&&258<=Pt){Q.next_out=Et,Q.avail_out=Pt,Q.next_in=at,Q.avail_in=pt,T.hold=nt,T.bits=it,l(Q,kt),Et=Q.next_out,gt=Q.output,Pt=Q.avail_out,at=Q.next_in,H=Q.input,pt=Q.avail_in,nt=T.hold,it=T.bits,T.mode===12&&(T.back=-1);break}for(T.back=0;Yt=(V=T.lencode[nt&(1<>>16&255,te=65535&V,!((Wt=V>>>24)<=it);){if(pt===0)break t;pt--,nt+=H[at++]<>Jt)])>>>16&255,te=65535&V,!(Jt+(Wt=V>>>24)<=it);){if(pt===0)break t;pt--,nt+=H[at++]<>>=Jt,it-=Jt,T.back+=Jt}if(nt>>>=Wt,it-=Wt,T.back+=Wt,T.length=te,Yt===0){T.mode=26;break}if(32&Yt){T.back=-1,T.mode=12;break}if(64&Yt){Q.msg="invalid literal/length code",T.mode=30;break}T.extra=15&Yt,T.mode=22;case 22:if(T.extra){for(G=T.extra;it>>=T.extra,it-=T.extra,T.back+=T.extra}T.was=T.length,T.mode=23;case 23:for(;Yt=(V=T.distcode[nt&(1<>>16&255,te=65535&V,!((Wt=V>>>24)<=it);){if(pt===0)break t;pt--,nt+=H[at++]<>Jt)])>>>16&255,te=65535&V,!(Jt+(Wt=V>>>24)<=it);){if(pt===0)break t;pt--,nt+=H[at++]<>>=Jt,it-=Jt,T.back+=Jt}if(nt>>>=Wt,it-=Wt,T.back+=Wt,64&Yt){Q.msg="invalid distance code",T.mode=30;break}T.offset=te,T.extra=15&Yt,T.mode=24;case 24:if(T.extra){for(G=T.extra;it>>=T.extra,it-=T.extra,T.back+=T.extra}if(T.offset>T.dmax){Q.msg="invalid distance too far back",T.mode=30;break}T.mode=25;case 25:if(Pt===0)break t;if(xt=kt-Pt,T.offset>xt){if((xt=T.offset-xt)>T.whave&&T.sane){Q.msg="invalid distance too far back",T.mode=30;break}Kt=xt>T.wnext?(xt-=T.wnext,T.wsize-xt):T.wnext-xt,xt>T.length&&(xt=T.length),Ct=T.window}else Ct=gt,Kt=Et-T.offset,xt=T.length;for(PtX?(W=Kt[Ct+v[U]],it[It+v[U]]):(W=96,0),b=1<>Et)+(k-=b)]=R<<24|W<<16|D|0,k!==0;);for(b=1<>=1;if(b!==0?(nt&=b-1,nt+=b):nt=0,U++,--kt[Q]==0){if(Q===H)break;Q=d[f+v[U]]}if(gt>>7)]}function It(V,rt){V.pending_buf[V.pending++]=255&rt,V.pending_buf[V.pending++]=rt>>>8&255}function kt(V,rt,bt){V.bi_valid>O-bt?(V.bi_buf|=rt<>O-V.bi_valid,V.bi_valid+=bt-O):(V.bi_buf|=rt<>>=1,bt<<=1,0<--rt;);return bt>>>1}function Ct(V,rt,bt){var wt,ot,Dt=new Array(v+1),Xt=0;for(wt=1;wt<=v;wt++)Dt[wt]=Xt=Xt+bt[wt-1]<<1;for(ot=0;ot<=rt;ot++){var Tt=V[2*ot+1];Tt!==0&&(V[2*ot]=Kt(Dt[Tt]++,Tt))}}function Wt(V){var rt;for(rt=0;rt>1;1<=bt;bt--)Jt(V,Dt,bt);for(ot=qt;bt=V.heap[1],V.heap[1]=V.heap[V.heap_len--],Jt(V,Dt,1),wt=V.heap[1],V.heap[--V.heap_max]=bt,V.heap[--V.heap_max]=wt,Dt[2*ot]=Dt[2*bt]+Dt[2*wt],V.depth[ot]=(V.depth[bt]>=V.depth[wt]?V.depth[bt]:V.depth[wt])+1,Dt[2*bt+1]=Dt[2*wt+1]=ot,V.heap[1]=ot++,Jt(V,Dt,1),2<=V.heap_len;);V.heap[--V.heap_max]=V.heap[1],function(ae,be){var wi,pe,Vi,Ae,sn,on,le=be.dyn_tree,Ze=be.max_code,Le=be.stat_desc.static_tree,We=be.stat_desc.has_stree,ui=be.stat_desc.extra_bits,wn=be.stat_desc.extra_base,st=be.stat_desc.max_length,dt=0;for(Ae=0;Ae<=v;Ae++)ae.bl_count[Ae]=0;for(le[2*ae.heap[ae.heap_max]+1]=0,wi=ae.heap_max+1;wi>=7;ot>>=1)if(1&fe&&Tt.dyn_ltree[2*qt]!==0)return s;if(Tt.dyn_ltree[18]!==0||Tt.dyn_ltree[20]!==0||Tt.dyn_ltree[26]!==0)return a;for(qt=32;qt>>3,(Dt=V.static_len+3+7>>>3)<=ot&&(ot=Dt)):ot=Dt=bt+5,bt+4<=ot&&rt!==-1?G(V,rt,bt,wt):V.strategy===4||Dt===ot?(kt(V,2+(wt?1:0),3),xe(V,z,Q)):(kt(V,4+(wt?1:0),3),function(Tt,qt,fe,ae){var be;for(kt(Tt,qt-257,5),kt(Tt,fe-1,5),kt(Tt,ae-4,4),be=0;be>>8&255,V.pending_buf[V.d_buf+2*V.last_lit+1]=255&rt,V.pending_buf[V.l_buf+V.last_lit]=255&bt,V.last_lit++,rt===0?V.dyn_ltree[2*bt]++:(V.matches++,rt--,V.dyn_ltree[2*(T[bt]+d+1)]++,V.dyn_dtree[2*it(rt)]++),V.last_lit===V.lit_bufsize-1},r._tr_align=function(V){kt(V,2,3),xt(V,k,z),function(rt){rt.bi_valid===16?(It(rt,rt.bi_buf),rt.bi_buf=0,rt.bi_valid=0):8<=rt.bi_valid&&(rt.pending_buf[rt.pending++]=255&rt.bi_buf,rt.bi_buf>>=8,rt.bi_valid-=8)}(V)}},{"../utils/common":41}],53:[function(e,n,r){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,n,r){(function(o){(function(s,a){if(!s.setImmediate){var l,u,c,d,f=1,g={},x=!1,m=s.document,v=Object.getPrototypeOf&&Object.getPrototypeOf(s);v=v&&v.setTimeout?v:s,l={}.toString.call(s.process)==="[object process]"?function(E){process.nextTick(function(){b(E)})}:function(){if(s.postMessage&&!s.importScripts){var E=!0,$=s.onmessage;return s.onmessage=function(){E=!1},s.postMessage("","*"),s.onmessage=$,E}}()?(d="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",k,!1):s.attachEvent("onmessage",k),function(E){s.postMessage(d+E,"*")}):s.MessageChannel?((c=new MessageChannel).port1.onmessage=function(E){b(E.data)},function(E){c.port2.postMessage(E)}):m&&"onreadystatechange"in m.createElement("script")?(u=m.documentElement,function(E){var $=m.createElement("script");$.onreadystatechange=function(){b(E),$.onreadystatechange=null,u.removeChild($),$=null},u.appendChild($)}):function(E){setTimeout(b,0,E)},v.setImmediate=function(E){typeof E!="function"&&(E=new Function(""+E));for(var $=new Array(arguments.length-1),N=0;N<$.length;N++)$[N]=arguments[N+1];var X={callback:E,args:$};return g[f]=X,l(f),f++},v.clearImmediate=O}function O(E){delete g[E]}function b(E){if(x)setTimeout(b,0,E);else{var $=g[E];if($){x=!0;try{(function(N){var X=N.callback,R=N.args;switch(R.length){case 0:X();break;case 1:X(R[0]);break;case 2:X(R[0],R[1]);break;case 3:X(R[0],R[1],R[2]);break;default:X.apply(a,R)}})($)}finally{O(E),x=!1}}}}function k(E){E.source===s&&typeof E.data=="string"&&E.data.indexOf(d)===0&&b(+E.data.slice(d.length))}})(typeof self>"u"?o===void 0?this:o:self)}).call(this,typeof pn<"u"?pn:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(F0);var L1=F0.exports;const X0=B0(L1);var R0={exports:{}};(function(i,t){(function(e,n){n()})(pn,function(){function e(u,c){return typeof c>"u"?c={autoBom:!1}:typeof c!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),c={autoBom:!c}),c.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(u.type)?new Blob(["\uFEFF",u],{type:u.type}):u}function n(u,c,d){var f=new XMLHttpRequest;f.open("GET",u),f.responseType="blob",f.onload=function(){l(f.response,c,d)},f.onerror=function(){console.error("could not download file")},f.send()}function r(u){var c=new XMLHttpRequest;c.open("HEAD",u,!1);try{c.send()}catch{}return 200<=c.status&&299>=c.status}function o(u){try{u.dispatchEvent(new MouseEvent("click"))}catch{var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),u.dispatchEvent(c)}}var s=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof pn=="object"&&pn.global===pn?pn:void 0,a=s.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=s.saveAs||(typeof window!="object"||window!==s?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(u,c,d){var f=s.URL||s.webkitURL,g=document.createElement("a");c=c||u.name||"download",g.download=c,g.rel="noopener",typeof u=="string"?(g.href=u,g.origin===location.origin?o(g):r(g.href)?n(u,c,d):o(g,g.target="_blank")):(g.href=f.createObjectURL(u),setTimeout(function(){f.revokeObjectURL(g.href)},4e4),setTimeout(function(){o(g)},0))}:"msSaveOrOpenBlob"in navigator?function(u,c,d){if(c=c||u.name||"download",typeof u!="string")navigator.msSaveOrOpenBlob(e(u,d),c);else if(r(u))n(u,c,d);else{var f=document.createElement("a");f.href=u,f.target="_blank",setTimeout(function(){o(f)})}}:function(u,c,d,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof u=="string")return n(u,c,d);var g=u.type==="application/octet-stream",x=/constructor/i.test(s.HTMLElement)||s.safari,m=/CriOS\/[\d]+/.test(navigator.userAgent);if((m||g&&x||a)&&typeof FileReader<"u"){var v=new FileReader;v.onloadend=function(){var k=v.result;k=m?k:k.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=k:location=k,f=null},v.readAsDataURL(u)}else{var O=s.URL||s.webkitURL,b=O.createObjectURL(u);f?f.location=b:location.href=b,f=null,setTimeout(function(){O.revokeObjectURL(b)},4e4)}});s.saveAs=l.saveAs=l,i.exports=l})})(R0);var Y0=R0.exports;const Ef=25.4,A1="SvgPcb",E1=i=>([t,e])=>{const[n,r,o,s,a,l]=D1(i);return[t*n+e*o+a,t*r+e*s+l]};function D1({dx:i,dy:t,sx:e,sy:n,rotate:r,skew:o}){return i??(i=0),t??(t=0),e??(e=1),n??(n=1),r??(r=0),o??(o=0),r=r/180*Math.PI,T1(i,t,e,n,r,o)}function T1(i,t,e,n,r,o){var s=[1,0,0,1,0,0];return a(i,t),u(r),c(o),l(e,n),s;function a(d,f){s[4]+=s[0]*d+s[2]*f,s[5]+=s[1]*d+s[3]*f}function l(d,f){s[0]*=d,s[1]*=d,s[2]*=f,s[3]*=f}function u(d){var f=Math.cos(d),g=Math.sin(d),x=s[0]*f+s[2]*g,m=s[1]*f+s[3]*g,v=-s[0]*g+s[2]*f,O=-s[1]*g+s[3]*f;s[0]=x,s[1]=m,s[2]=v,s[3]=O}function c(d){var f=Math.cos(r),g=Math.sin(r);s[2]+=d*f,s[3]+=d*g}}function Z0(i,t){const e=E1(t);return i.forEach((n,r)=>{i[r]=n.map(e)}),i}var P={};P.version="6.4.2.2";P.use_lines=!0;P.use_xyz=!1;var W0=!1;typeof module<"u"&&module.exports?(module.exports=P,W0=!0):typeof document<"u"?window.ClipperLib=P:self.ClipperLib=P;if(W0)var hi="chrome";else var hi=navigator.userAgent.toString().toLowerCase();hi.indexOf("chrome")!=-1&&hi.indexOf("chromium")==-1;hi.indexOf("chromium")!=-1;hi.indexOf("safari")!=-1&&hi.indexOf("chrome")==-1&&hi.indexOf("chromium")==-1;hi.indexOf("firefox")!=-1;hi.indexOf("firefox/17")!=-1;hi.indexOf("firefox/15")!=-1;hi.indexOf("firefox/3")!=-1;hi.indexOf("opera")!=-1;hi.indexOf("msie 10")!=-1;hi.indexOf("msie 9")!=-1;hi.indexOf("msie 8")!=-1;hi.indexOf("msie 7")!=-1;hi.indexOf("msie ")!=-1;var U0=function(i,t){var e;if(typeof Object.getOwnPropertyNames>"u"){for(e in t.prototype)(typeof i.prototype[e]>"u"||i.prototype[e]===Object.prototype[e])&&(i.prototype[e]=t.prototype[e]);for(e in t)typeof i[e]>"u"&&(i[e]=t[e]);i.$baseCtor=t}else{for(var n=Object.getOwnPropertyNames(t.prototype),r=0;r"u"&&Object.defineProperty(i.prototype,n[r],Object.getOwnPropertyDescriptor(t.prototype,n[r]));for(e in t)typeof i[e]>"u"&&(i[e]=t[e]);i.$baseCtor=t}};P.Path=function(){return[]};P.Path.prototype.push=Array.prototype.push;P.Paths=function(){return[]};P.Paths.prototype.push=Array.prototype.push;P.PolyNode=function(){this.m_Parent=null,this.m_polygon=new P.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1};P.PolyNode.prototype.IsHoleNode=function(){for(var i=!0,t=this.m_Parent;t!==null;)i=!i,t=t.m_Parent;return i};P.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length};P.PolyNode.prototype.Contour=function(){return this.m_polygon};P.PolyNode.prototype.AddChild=function(i){var t=this.m_Childs.length;this.m_Childs.push(i),i.m_Parent=this,i.m_Index=t};P.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()};P.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index===this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]};P.PolyNode.prototype.Childs=function(){return this.m_Childs};P.PolyNode.prototype.Parent=function(){return this.m_Parent};P.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()};P.PolyTree=function(){this.m_AllPolys=[],P.PolyNode.call(this)};P.PolyTree.prototype.Clear=function(){for(var i=0,t=this.m_AllPolys.length;i0?this.m_Childs[0]:null};P.PolyTree.prototype.Total=function(){var i=this.m_AllPolys.length;return i>0&&this.m_Childs[0]!==this.m_AllPolys[0]&&i--,i};U0(P.PolyTree,P.PolyNode);P.Clear=function(i){i.length=0};P.PI=3.141592653589793;P.PI2=2*3.141592653589793;P.FPoint=function(){var i=arguments,t=i.length;if(this.X=0,this.Y=0,P.use_xyz)if(this.Z=0,t===3)this.X=i[0],this.Y=i[1],this.Z=i[2];else if(t===2)this.X=i[0],this.Y=i[1],this.Z=0;else if(t===1)if(i[0]instanceof P.FPoint){var e=i[0];this.X=e.X,this.Y=e.Y,this.Z=0}else{var n=i[0];typeof n.Z>"u"&&(n.Z=0),this.X=n.X,this.Y=n.Y,this.Z=n.Z}else this.X=0,this.Y=0,this.Z=0;else if(t===2)this.X=i[0],this.Y=i[1];else if(t===1)if(i[0]instanceof P.FPoint){var e=i[0];this.X=e.X,this.Y=e.Y}else{var n=i[0];this.X=n.X,this.Y=n.Y}else this.X=0,this.Y=0};P.FPoint.op_Equality=function(i,t){return i.X===t.X&&i.Y===t.Y};P.FPoint.op_Inequality=function(i,t){return i.X!==t.X||i.Y!==t.Y};P.FPoint0=function(){this.X=0,this.Y=0,P.use_xyz&&(this.Z=0)};P.FPoint0.prototype=P.FPoint.prototype;P.FPoint1=function(i){this.X=i.X,this.Y=i.Y,P.use_xyz&&(typeof i.Z>"u"?this.Z=0:this.Z=i.Z)};P.FPoint1.prototype=P.FPoint.prototype;P.FPoint1dp=function(i){this.X=i.X,this.Y=i.Y,P.use_xyz&&(this.Z=0)};P.FPoint1dp.prototype=P.FPoint.prototype;P.FPoint2=function(i,t,e){this.X=i,this.Y=t,P.use_xyz&&(typeof e>"u"?this.Z=0:this.Z=e)};P.FPoint2.prototype=P.FPoint.prototype;P.FRect=function(){var i=arguments,t=i.length;if(t===4)this.left=i[0],this.top=i[1],this.right=i[2],this.bottom=i[3];else if(t===1){var e=i[0];this.left=e.left,this.top=e.top,this.right=e.right,this.bottom=e.bottom}else this.left=0,this.top=0,this.right=0,this.bottom=0};P.FRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0};P.FRect0.prototype=P.FRect.prototype;P.FRect1=function(i){this.left=i.left,this.top=i.top,this.right=i.right,this.bottom=i.bottom};P.FRect1.prototype=P.FRect.prototype;P.FRect4=function(i,t,e,n){this.left=i,this.top=t,this.right=e,this.bottom=n};P.FRect4.prototype=P.FRect.prototype;P.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3};P.PolyType={ptSubject:0,ptClip:1};P.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3};P.JoinType={jtSquare:0,jtRound:1,jtMiter:2};P.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4};P.EdgeSide={esLeft:0,esRight:1};P.Direction={dRightToLeft:0,dLeftToRight:1};P.TEdge=function(){this.Bot=new P.FPoint0,this.Curr=new P.FPoint0,this.Top=new P.FPoint0,this.Delta=new P.FPoint0,this.Dx=0,this.PolyTyp=P.PolyType.ptSubject,this.Side=P.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null};P.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new P.FPoint0};P.MyIntersectNodeSort=function(){};P.MyIntersectNodeSort.Compare=function(i,t){var e=t.Pt.Y-i.Pt.Y;return e>0?1:e<0?-1:0};P.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null};P.Scanbeam=function(){this.Y=0,this.Next=null};P.Maxima=function(){this.X=0,this.Next=null,this.Prev=null};P.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null};P.OutPt=function(){this.Idx=0,this.Pt=new P.FPoint0,this.Next=null,this.Prev=null};P.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new P.FPoint0};P.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_Scanbeam=null,this.m_PolyOuts=null,this.m_ActiveEdges=null};P.ClipperBase.horizontal=-34e37;P.ClipperBase.Skip=-2;P.ClipperBase.Unassigned=-1;P.ClipperBase.tolerance=1e-20;P.ClipperBase.maxValue=Math.sqrt(Number.MAX_VALUE);P.ClipperBase.minValue=Math.sqrt(Number.MIN_VALUE);P.ClipperBase.near_zero=function(i){return i>-P.ClipperBase.tolerance&&it.X==i.Xt.Y==i.YP.ClipperBase.maxValue||i.X<-P.ClipperBase.maxValue||i.Y>P.ClipperBase.maxValue||i.Y<-P.ClipperBase.maxValue||i.X>0&&i.X0&&i.Y-P.ClipperBase.minValue||i.Y<0&&i.Y>-P.ClipperBase.minValue)&&P.Error("Coordinate outside allowed range in RangeTest().")};P.ClipperBase.prototype.InitEdge=function(i,t,e,n){i.Next=t,i.Prev=e,i.Curr.X=n.X,i.Curr.Y=n.Y,P.use_xyz&&(i.Curr.Z=n.Z),i.OutIdx=-1};P.ClipperBase.prototype.InitEdge2=function(i,t){i.Curr.Y>=i.Next.Curr.Y?(i.Bot.X=i.Curr.X,i.Bot.Y=i.Curr.Y,P.use_xyz&&(i.Bot.Z=i.Curr.Z),i.Top.X=i.Next.Curr.X,i.Top.Y=i.Next.Curr.Y,P.use_xyz&&(i.Top.Z=i.Next.Curr.Z)):(i.Top.X=i.Curr.X,i.Top.Y=i.Curr.Y,P.use_xyz&&(i.Top.Z=i.Curr.Z),i.Bot.X=i.Next.Curr.X,i.Bot.Y=i.Next.Curr.Y,P.use_xyz&&(i.Bot.Z=i.Next.Curr.Z)),this.SetDx(i),i.PolyTyp=t};P.ClipperBase.prototype.FindNextLocMin=function(i){for(var t;;){for(;P.FPoint.op_Inequality(i.Bot,i.Prev.Bot)||P.FPoint.op_Equality(i.Curr,i.Top);)i=i.Next;if(i.Dx!==P.ClipperBase.horizontal&&i.Prev.Dx!==P.ClipperBase.horizontal)break;for(;i.Prev.Dx===P.ClipperBase.horizontal;)i=i.Prev;for(t=i;i.Dx===P.ClipperBase.horizontal;)i=i.Next;if(i.Top.Y!==i.Prev.Bot.Y){t.Prev.Bot.Xn.Next.Top.X&&(n=r.Prev)}for(;i!==n;)i.NextInLML=i.Next,i.Dx===P.ClipperBase.horizontal&&i!==e&&i.Bot.X!==i.Prev.Top.X&&this.ReverseHorizontal(i),i=i.Next;i.Dx===P.ClipperBase.horizontal&&i!==e&&i.Bot.X!==i.Prev.Top.X&&this.ReverseHorizontal(i),n=n.Next}else{for(;n.Top.Y===n.Prev.Bot.Y&&n.Prev.OutIdx!==P.ClipperBase.Skip;)n=n.Prev;if(n.Dx===P.ClipperBase.horizontal&&n.Prev.OutIdx!==P.ClipperBase.Skip){for(r=n;r.Next.Dx===P.ClipperBase.horizontal;)r=r.Next;(r.Next.Top.X===n.Prev.Top.X||r.Next.Top.X>n.Prev.Top.X)&&(n=r.Next)}for(;i!==n;)i.NextInLML=i.Prev,i.Dx===P.ClipperBase.horizontal&&i!==e&&i.Bot.X!==i.Next.Top.X&&this.ReverseHorizontal(i),i=i.Prev;i.Dx===P.ClipperBase.horizontal&&i!==e&&i.Bot.X!==i.Next.Top.X&&this.ReverseHorizontal(i),n=n.Prev}return n};P.ClipperBase.prototype.AddPath=function(i,t,e){P.use_lines?!e&&t===P.PolyType.ptClip&&P.Error("AddPath: Open paths must be subject."):e||P.Error("AddPath: Open paths have been disabled.");var n=i.length-1;if(e)for(;n>0&&P.FPoint.op_Equality(i[n],i[0]);)--n;for(;n>0&&P.FPoint.op_Equality(i[n],i[n-1]);)--n;if(e&&n<2||!e&&n<1)return!1;for(var r=new Array,o=0;o<=n;o++)r.push(new P.TEdge);var s=!0;r[1].Curr.X=i[1].X,r[1].Curr.Y=i[1].Y,P.use_xyz&&(r[1].Curr.Z=i[1].Z),this.RangeTest(i[0]),this.RangeTest(i[n]),this.InitEdge(r[0],r[1],r[n],i[0]),this.InitEdge(r[n],r[0],r[n-1],i[n]);for(var o=n-1;o>=1;--o)this.RangeTest(i[o]),this.InitEdge(r[o],r[o+1],r[o-1],i[o]);for(var a=r[0],l=a,u=a;;){if(l.Curr===l.Next.Curr&&(e||l.Next!==a)){if(l===l.Next)break;l===a&&(a=l.Next),l=this.RemoveEdge(l),u=l;continue}if(l.Prev===l.Next)break;if(e&&P.ClipperBase.SlopesEqual4(l.Prev.Curr,l.Curr,l.Next.Curr)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(l.Prev.Curr,l.Curr,l.Next.Curr))){l===a&&(a=l.Next),l=this.RemoveEdge(l),l=l.Prev,u=l;continue}if(l=l.Next,l===u||!e&&l.Next===a)break}if(!e&&l===l.Next||e&&l.Prev===l.Next)return!1;e||(this.m_HasOpenPaths=!0,a.Prev.OutIdx=P.ClipperBase.Skip),l=a;do this.InitEdge2(l,t),l=l.Next,s&&l.Curr.Y!==a.Curr.Y&&(s=!1);while(l!==a);if(s){if(e)return!1;l.Prev.OutIdx=P.ClipperBase.Skip;var c=new P.LocalMinima;for(c.Next=null,c.Y=l.Bot.Y,c.LeftBound=null,c.RightBound=l,c.RightBound.Side=P.EdgeSide.esRight,c.RightBound.WindDelta=0;l.Bot.X!==l.Prev.Top.X&&this.ReverseHorizontal(l),l.Next.OutIdx!==P.ClipperBase.Skip;)l.NextInLML=l.Next,l=l.Next;return this.InsertLocalMinima(c),this.m_edges.push(r),!0}this.m_edges.push(r);var d,f=null;for(P.FPoint.op_Equality(l.Prev.Bot,l.Prev.Top)&&(l=l.Next);l=this.FindNextLocMin(l),l!==f;){f===null&&(f=l);var c=new P.LocalMinima;c.Next=null,c.Y=l.Bot.Y,l.Dxi.X==t.Xi.Y==t.Y=this.m_MinimaList.Y)i.Next=this.m_MinimaList,this.m_MinimaList=i;else{for(var t=this.m_MinimaList;t.Next!==null&&i.Ythis.m_Scanbeam.Y){var t=new P.Scanbeam;t.Y=i,t.Next=this.m_Scanbeam,this.m_Scanbeam=t}else{for(var e=this.m_Scanbeam;e.Next!==null&&i<=e.Next.Y;)e=e.Next;if(i===e.Y)return;var n=new P.Scanbeam;n.Y=i,n.Next=e.Next,e.Next=n}};P.ClipperBase.prototype.PopScanbeam=function(i){return this.m_Scanbeam===null?(i.v=0,!1):(i.v=this.m_Scanbeam.Y,this.m_Scanbeam=this.m_Scanbeam.Next,!0)};P.ClipperBase.prototype.LocalMinimaPending=function(){return this.m_CurrentLM!==null};P.ClipperBase.prototype.CreateOutRec=function(){var i=new P.OutRec;return i.Idx=P.ClipperBase.Unassigned,i.IsHole=!1,i.IsOpen=!1,i.FirstLeft=null,i.Pts=null,i.BottomPt=null,i.PolyNode=null,this.m_PolyOuts.push(i),i.Idx=this.m_PolyOuts.length-1,i};P.ClipperBase.prototype.DisposeOutRec=function(i){var t=this.m_PolyOuts[i];t.Pts=null,t=null,this.m_PolyOuts[i]=null};P.ClipperBase.prototype.UpdateEdgeIntoAEL=function(i){i.NextInLML===null&&P.Error("UpdateEdgeIntoAEL: invalid call");var t=i.PrevInAEL,e=i.NextInAEL;return i.NextInLML.OutIdx=i.OutIdx,t!==null?t.NextInAEL=i.NextInLML:this.m_ActiveEdges=i.NextInLML,e!==null&&(e.PrevInAEL=i.NextInLML),i.NextInLML.Side=i.Side,i.NextInLML.WindDelta=i.WindDelta,i.NextInLML.WindCnt=i.WindCnt,i.NextInLML.WindCnt2=i.WindCnt2,i=i.NextInLML,i.Curr.X=i.Bot.X,i.Curr.Y=i.Bot.Y,i.PrevInAEL=t,i.NextInAEL=e,P.ClipperBase.IsHorizontal(i)||this.InsertScanbeam(i.Top.Y),i};P.ClipperBase.prototype.SwapPositionsInAEL=function(i,t){if(!(i.NextInAEL===i.PrevInAEL||t.NextInAEL===t.PrevInAEL)){if(i.NextInAEL===t){var e=t.NextInAEL;e!==null&&(e.PrevInAEL=i);var n=i.PrevInAEL;n!==null&&(n.NextInAEL=t),t.PrevInAEL=n,t.NextInAEL=i,i.PrevInAEL=t,i.NextInAEL=e}else if(t.NextInAEL===i){var r=i.NextInAEL;r!==null&&(r.PrevInAEL=t);var o=t.PrevInAEL;o!==null&&(o.NextInAEL=i),i.PrevInAEL=o,i.NextInAEL=t,t.PrevInAEL=i,t.NextInAEL=r}else{var s=i.NextInAEL,a=i.PrevInAEL;i.NextInAEL=t.NextInAEL,i.NextInAEL!==null&&(i.NextInAEL.PrevInAEL=i),i.PrevInAEL=t.PrevInAEL,i.PrevInAEL!==null&&(i.PrevInAEL.NextInAEL=i),t.NextInAEL=s,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=t),t.PrevInAEL=a,t.PrevInAEL!==null&&(t.PrevInAEL.NextInAEL=t)}i.PrevInAEL===null?this.m_ActiveEdges=i:t.PrevInAEL===null&&(this.m_ActiveEdges=t)}};P.ClipperBase.prototype.DeleteFromAEL=function(i){var t=i.PrevInAEL,e=i.NextInAEL;t===null&&e===null&&i!==this.m_ActiveEdges||(t!==null?t.NextInAEL=e:this.m_ActiveEdges=e,e!==null&&(e.PrevInAEL=t),i.NextInAEL=null,i.PrevInAEL=null)};P.Clipper=function(i){typeof i>"u"&&(i=0),this.m_PolyOuts=null,this.m_ClipType=P.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=P.PolyFillType.pftEvenOdd,this.m_SubjFillType=P.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,P.ClipperBase.call(this),this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=P.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=(1&i)!==0,this.StrictlySimple=(2&i)!==0,this.PreserveCollinear=(4&i)!==0,P.use_xyz&&(this.ZFillFunction=null)};P.Clipper.ioReverseSolution=1;P.Clipper.ioStrictlySimple=2;P.Clipper.ioPreserveCollinear=4;P.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),P.ClipperBase.prototype.Clear.call(this))};P.Clipper.prototype.InsertMaxima=function(i){var t=new P.Maxima;if(t.X=i,this.m_Maxima===null)this.m_Maxima=t,this.m_Maxima.Next=null,this.m_Maxima.Prev=null;else if(i=e.Next.X;)e=e.Next;if(i===e.X)return;t.Next=e.Next,t.Prev=e,e.Next!==null&&(e.Next.Prev=t),e.Next=t}};P.Clipper.prototype.Execute=function(){var i=arguments,t=i.length,e=i[1]instanceof P.PolyTree;if(t===4&&!e){var n=i[0],r=i[1],o=i[2],s=i[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&P.Error("Error: PolyTree struct is needed for open path clipping."),this.m_ExecuteLocked=!0,P.Clear(r),this.m_SubjFillType=o,this.m_ClipFillType=s,this.m_ClipType=n,this.m_UsingPolyTree=!1;try{var a=this.ExecuteInternal();a&&this.BuildResult(r)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return a}else if(t===4&&e){var n=i[0],l=i[1],o=i[2],s=i[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=o,this.m_ClipFillType=s,this.m_ClipType=n,this.m_UsingPolyTree=!0;try{var a=this.ExecuteInternal();a&&this.BuildResult2(l)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return a}else if(t===2&&!e){var n=i[0],r=i[1];return this.Execute(n,r,P.PolyFillType.pftEvenOdd,P.PolyFillType.pftEvenOdd)}else if(t===2&&e){var n=i[0],l=i[1];return this.Execute(n,l,P.PolyFillType.pftEvenOdd,P.PolyFillType.pftEvenOdd)}};P.Clipper.prototype.FixHoleLinkage=function(i){if(!(i.FirstLeft===null||i.IsHole!==i.FirstLeft.IsHole&&i.FirstLeft.Pts!==null)){for(var t=i.FirstLeft;t!==null&&(t.IsHole===i.IsHole||t.Pts===null);)t=t.FirstLeft;i.FirstLeft=t}};P.Clipper.prototype.ExecuteInternal=function(){try{this.Reset(),this.m_SortedEdges=null,this.m_Maxima=null;var i={},t={};if(!this.PopScanbeam(i))return!1;for(this.InsertLocalMinimaIntoAEL(i.v);this.PopScanbeam(t)||this.LocalMinimaPending();){if(this.ProcessHorizontals(),this.m_GhostJoins.length=0,!this.ProcessIntersections(t.v))return!1;this.ProcessEdgesAtTopOfScanbeam(t.v),i.v=t.v,this.InsertLocalMinimaIntoAEL(i.v)}var e,n,r;for(n=0,r=this.m_PolyOuts.length;n0&&this.ReversePolyPtLinks(e.Pts);for(this.JoinCommonEdges(),n=0,r=this.m_PolyOuts.length;n0&&n.WindDelta!==0)for(var o=0,s=this.m_GhostJoins.length;o=0&&e.PrevInAEL!==null&&e.PrevInAEL.Curr.X===e.Bot.X&&e.PrevInAEL.OutIdx>=0&&P.ClipperBase.SlopesEqual5(e.PrevInAEL.Curr,e.PrevInAEL.Top,e.Curr,e.Top)&&e.WindDelta!==0&&e.PrevInAEL.WindDelta!==0){var l=this.AddOutPt(e.PrevInAEL,e.Bot);this.AddJoin(r,l,e.Top)}if(e.NextInAEL!==n){if(n.OutIdx>=0&&n.PrevInAEL.OutIdx>=0&&P.ClipperBase.SlopesEqual5(n.PrevInAEL.Curr,n.PrevInAEL.Top,n.Curr,n.Top)&&n.WindDelta!==0&&n.PrevInAEL.WindDelta!==0){var l=this.AddOutPt(n.PrevInAEL,n.Bot);this.AddJoin(r,l,n.Top)}var u=e.NextInAEL;if(u!==null)for(;u!==n;)this.IntersectEdges(n,u,e.Curr),u=u.NextInAEL}}}};P.Clipper.prototype.InsertEdgeIntoAEL=function(i,t){if(this.m_ActiveEdges===null)i.PrevInAEL=null,i.NextInAEL=null,this.m_ActiveEdges=i;else if(t===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,i))i.PrevInAEL=null,i.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=i,this.m_ActiveEdges=i;else{for(t===null&&(t=this.m_ActiveEdges);t.NextInAEL!==null&&!this.E2InsertsBeforeE1(t.NextInAEL,i);)t=t.NextInAEL;i.NextInAEL=t.NextInAEL,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=i),i.PrevInAEL=t,t.NextInAEL=i}};P.Clipper.prototype.E2InsertsBeforeE1=function(i,t){return t.Curr.X===i.Curr.X?t.Top.Y>i.Top.Y?t.Top.XP.Clipper.TopX(t,i.Top.Y):t.Curr.X0;default:return i.WindCnt2<0}case P.ClipType.ctUnion:switch(e){case P.PolyFillType.pftEvenOdd:case P.PolyFillType.pftNonZero:return i.WindCnt2===0;case P.PolyFillType.pftPositive:return i.WindCnt2<=0;default:return i.WindCnt2>=0}case P.ClipType.ctDifference:if(i.PolyTyp===P.PolyType.ptSubject)switch(e){case P.PolyFillType.pftEvenOdd:case P.PolyFillType.pftNonZero:return i.WindCnt2===0;case P.PolyFillType.pftPositive:return i.WindCnt2<=0;default:return i.WindCnt2>=0}else switch(e){case P.PolyFillType.pftEvenOdd:case P.PolyFillType.pftNonZero:return i.WindCnt2!==0;case P.PolyFillType.pftPositive:return i.WindCnt2>0;default:return i.WindCnt2<0}case P.ClipType.ctXor:if(i.WindDelta===0)switch(e){case P.PolyFillType.pftEvenOdd:case P.PolyFillType.pftNonZero:return i.WindCnt2===0;case P.PolyFillType.pftPositive:return i.WindCnt2<=0;default:return i.WindCnt2>=0}else return!0}return!0};P.Clipper.prototype.SetWindingCount=function(i){for(var t=i.PrevInAEL;t!==null&&(t.PolyTyp!==i.PolyTyp||t.WindDelta===0);)t=t.PrevInAEL;if(t===null){var e=i.PolyTyp===P.PolyType.ptSubject?this.m_SubjFillType:this.m_ClipFillType;i.WindDelta===0?i.WindCnt=e===P.PolyFillType.pftNegative?-1:1:i.WindCnt=i.WindDelta,i.WindCnt2=0,t=this.m_ActiveEdges}else if(i.WindDelta===0&&this.m_ClipType!==P.ClipType.ctUnion)i.WindCnt=1,i.WindCnt2=t.WindCnt2,t=t.NextInAEL;else if(this.IsEvenOddFillType(i)){if(i.WindDelta===0){for(var n=!0,r=t.PrevInAEL;r!==null;)r.PolyTyp===t.PolyTyp&&r.WindDelta!==0&&(n=!n),r=r.PrevInAEL;i.WindCnt=n?0:1}else i.WindCnt=i.WindDelta;i.WindCnt2=t.WindCnt2,t=t.NextInAEL}else t.WindCnt*t.WindDelta<0?Math.abs(t.WindCnt)>1?t.WindDelta*i.WindDelta<0?i.WindCnt=t.WindCnt:i.WindCnt=t.WindCnt+i.WindDelta:i.WindCnt=i.WindDelta===0?1:i.WindDelta:i.WindDelta===0?i.WindCnt=t.WindCnt<0?t.WindCnt-1:t.WindCnt+1:t.WindDelta*i.WindDelta<0?i.WindCnt=t.WindCnt:i.WindCnt=t.WindCnt+i.WindDelta,i.WindCnt2=t.WindCnt2,t=t.NextInAEL;if(this.IsEvenOddAltFillType(i))for(;t!==i;)t.WindDelta!==0&&(i.WindCnt2=i.WindCnt2===0?1:0),t=t.NextInAEL;else for(;t!==i;)i.WindCnt2+=t.WindDelta,t=t.NextInAEL};P.Clipper.prototype.AddEdgeToSEL=function(i){this.m_SortedEdges===null?(this.m_SortedEdges=i,i.PrevInSEL=null,i.NextInSEL=null):(i.NextInSEL=this.m_SortedEdges,i.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=i,this.m_SortedEdges=i)};P.Clipper.prototype.PopEdgeFromSEL=function(i){if(i.v=this.m_SortedEdges,i.v===null)return!1;var t=i.v;return this.m_SortedEdges=i.v.NextInSEL,this.m_SortedEdges!==null&&(this.m_SortedEdges.PrevInSEL=null),t.NextInSEL=null,t.PrevInSEL=null,!0};P.Clipper.prototype.CopyAELToSEL=function(){var i=this.m_ActiveEdges;for(this.m_SortedEdges=i;i!==null;)i.PrevInSEL=i.PrevInAEL,i.NextInSEL=i.NextInAEL,i=i.NextInAEL};P.Clipper.prototype.SwapPositionsInSEL=function(i,t){if(!(i.NextInSEL===null&&i.PrevInSEL===null)&&!(t.NextInSEL===null&&t.PrevInSEL===null)){if(i.NextInSEL===t){var e=t.NextInSEL;e!==null&&(e.PrevInSEL=i);var n=i.PrevInSEL;n!==null&&(n.NextInSEL=t),t.PrevInSEL=n,t.NextInSEL=i,i.PrevInSEL=t,i.NextInSEL=e}else if(t.NextInSEL===i){var e=i.NextInSEL;e!==null&&(e.PrevInSEL=t);var n=t.PrevInSEL;n!==null&&(n.NextInSEL=i),i.PrevInSEL=n,i.NextInSEL=t,t.PrevInSEL=i,t.NextInSEL=e}else{var e=i.NextInSEL,n=i.PrevInSEL;i.NextInSEL=t.NextInSEL,i.NextInSEL!==null&&(i.NextInSEL.PrevInSEL=i),i.PrevInSEL=t.PrevInSEL,i.PrevInSEL!==null&&(i.PrevInSEL.NextInSEL=i),t.NextInSEL=e,t.NextInSEL!==null&&(t.NextInSEL.PrevInSEL=t),t.PrevInSEL=n,t.PrevInSEL!==null&&(t.PrevInSEL.NextInSEL=t)}i.PrevInSEL===null?this.m_SortedEdges=i:t.PrevInSEL===null&&(this.m_SortedEdges=t)}};P.Clipper.prototype.AddLocalMaxPoly=function(i,t,e){this.AddOutPt(i,e),t.WindDelta===0&&this.AddOutPt(t,e),i.OutIdx===t.OutIdx?(i.OutIdx=-1,t.OutIdx=-1):i.OutIdxt.Dx?(n=this.AddOutPt(i,e),t.OutIdx=i.OutIdx,i.Side=P.EdgeSide.esLeft,t.Side=P.EdgeSide.esRight,r=i,r.PrevInAEL===t?o=t.PrevInAEL:o=r.PrevInAEL):(n=this.AddOutPt(t,e),i.OutIdx=t.OutIdx,i.Side=P.EdgeSide.esRight,t.Side=P.EdgeSide.esLeft,r=t,r.PrevInAEL===i?o=i.PrevInAEL:o=r.PrevInAEL),o!==null&&o.OutIdx>=0&&o.Top.Yt&&(r=i,i=t,t=r),e>n&&(r=e,e=n,n=r),i=0&&e.WindDelta!==0&&(n===null?n=e:n.OutIdx===e.OutIdx&&(n=null)),e=e.PrevInAEL;n===null?(t.FirstLeft=null,t.IsHole=!1):(t.FirstLeft=this.m_PolyOuts[n.OutIdx],t.IsHole=!t.FirstLeft.IsHole)};P.Clipper.prototype.GetDx=function(i,t){return i.Y===t.Y?P.ClipperBase.horizontal:(t.X-i.X)/(t.Y-i.Y)};P.Clipper.prototype.FirstIsBottomPt=function(i,t){for(var e=i.Prev;P.FPoint.op_Equality(e.Pt,i.Pt)&&e!==i;)e=e.Prev;var n=Math.abs(this.GetDx(i.Pt,e.Pt));for(e=i.Next;P.FPoint.op_Equality(e.Pt,i.Pt)&&e!==i;)e=e.Next;var r=Math.abs(this.GetDx(i.Pt,e.Pt));for(e=t.Prev;P.FPoint.op_Equality(e.Pt,t.Pt)&&e!==t;)e=e.Prev;var o=Math.abs(this.GetDx(t.Pt,e.Pt));for(e=t.Next;P.FPoint.op_Equality(e.Pt,t.Pt)&&e!==t;)e=e.Next;var s=Math.abs(this.GetDx(t.Pt,e.Pt));return Math.max(n,r)===Math.max(o,s)&&Math.min(n,r)===Math.min(o,s)?this.Area(i)>0:n>=o&&n>=s||r>=o&&r>=s};P.Clipper.prototype.GetBottomPt=function(i){for(var t=null,e=i.Next;e!==i;)e.Pt.Y>i.Pt.Y?(i=e,t=null):e.Pt.Y===i.Pt.Y&&e.Pt.X<=i.Pt.X&&(e.Pt.Xn.Pt.Y?i:e.Pt.Yn.Pt.X||e.Next===e?t:n.Next===n||this.FirstIsBottomPt(e,n)?i:t};P.Clipper.prototype.OutRec1RightOfOutRec2=function(i,t){do if(i=i.FirstLeft,i===t)return!0;while(i!==null);return!1};P.Clipper.prototype.GetOutRec=function(i){for(var t=this.m_PolyOuts[i];t!==this.m_PolyOuts[t.Idx];)t=this.m_PolyOuts[t.Idx];return t};P.Clipper.prototype.AppendPolygon=function(i,t){var e=this.m_PolyOuts[i.OutIdx],n=this.m_PolyOuts[t.OutIdx],r;this.OutRec1RightOfOutRec2(e,n)?r=n:this.OutRec1RightOfOutRec2(n,e)?r=e:r=this.GetLowermostRec(e,n);var o=e.Pts,s=o.Prev,a=n.Pts,l=a.Prev;i.Side===P.EdgeSide.esLeft?t.Side===P.EdgeSide.esLeft?(this.ReversePolyPtLinks(a),a.Next=o,o.Prev=a,s.Next=l,l.Prev=s,e.Pts=l):(l.Next=o,o.Prev=l,a.Prev=s,s.Next=a,e.Pts=a):t.Side===P.EdgeSide.esRight?(this.ReversePolyPtLinks(a),s.Next=l,l.Prev=s,a.Next=o,o.Prev=a):(s.Next=a,a.Prev=s,o.Prev=l,l.Next=o),e.BottomPt=null,r===n&&(n.FirstLeft!==e&&(e.FirstLeft=n.FirstLeft),e.IsHole=n.IsHole),n.Pts=null,n.BottomPt=null,n.FirstLeft=e;var u=i.OutIdx,c=t.OutIdx;i.OutIdx=-1,t.OutIdx=-1;for(var d=this.m_ActiveEdges;d!==null;){if(d.OutIdx===c){d.OutIdx=u,d.Side=i.Side;break}d=d.NextInAEL}n.Idx=e.Idx};P.Clipper.prototype.ReversePolyPtLinks=function(i){if(i!==null){var t,e;t=i;do e=t.Next,t.Next=t.Prev,t.Prev=e,t=e;while(t!==i)}};P.Clipper.SwapSides=function(i,t){var e=i.Side;i.Side=t.Side,t.Side=e};P.Clipper.SwapPolyIndexes=function(i,t){var e=i.OutIdx;i.OutIdx=t.OutIdx,t.OutIdx=e};P.Clipper.prototype.IntersectEdges=function(i,t,e){var n=i.OutIdx>=0,r=t.OutIdx>=0;if(P.use_xyz&&this.SetZ(e,i,t),P.use_lines&&(i.WindDelta===0||t.WindDelta===0)){if(i.WindDelta===0&&t.WindDelta===0)return;i.PolyTyp===t.PolyTyp&&i.WindDelta!==t.WindDelta&&this.m_ClipType===P.ClipType.ctUnion?i.WindDelta===0?r&&(this.AddOutPt(i,e),n&&(i.OutIdx=-1)):n&&(this.AddOutPt(t,e),r&&(t.OutIdx=-1)):i.PolyTyp!==t.PolyTyp&&(i.WindDelta===0&&Math.abs(t.WindCnt)===1&&(this.m_ClipType!==P.ClipType.ctUnion||t.WindCnt2===0)?(this.AddOutPt(i,e),n&&(i.OutIdx=-1)):t.WindDelta===0&&Math.abs(i.WindCnt)===1&&(this.m_ClipType!==P.ClipType.ctUnion||i.WindCnt2===0)&&(this.AddOutPt(t,e),r&&(t.OutIdx=-1)));return}if(i.PolyTyp===t.PolyTyp)if(this.IsEvenOddFillType(i)){var o=i.WindCnt;i.WindCnt=t.WindCnt,t.WindCnt=o}else i.WindCnt+t.WindDelta===0?i.WindCnt=-i.WindCnt:i.WindCnt+=t.WindDelta,t.WindCnt-i.WindDelta===0?t.WindCnt=-t.WindCnt:t.WindCnt-=i.WindDelta;else this.IsEvenOddFillType(t)?i.WindCnt2=i.WindCnt2===0?1:0:i.WindCnt2+=t.WindDelta,this.IsEvenOddFillType(i)?t.WindCnt2=t.WindCnt2===0?1:0:t.WindCnt2-=i.WindDelta;var s,a,l,u;i.PolyTyp===P.PolyType.ptSubject?(s=this.m_SubjFillType,l=this.m_ClipFillType):(s=this.m_ClipFillType,l=this.m_SubjFillType),t.PolyTyp===P.PolyType.ptSubject?(a=this.m_SubjFillType,u=this.m_ClipFillType):(a=this.m_ClipFillType,u=this.m_SubjFillType);var c,d;switch(s){case P.PolyFillType.pftPositive:c=i.WindCnt;break;case P.PolyFillType.pftNegative:c=-i.WindCnt;break;default:c=Math.abs(i.WindCnt);break}switch(a){case P.PolyFillType.pftPositive:d=t.WindCnt;break;case P.PolyFillType.pftNegative:d=-t.WindCnt;break;default:d=Math.abs(t.WindCnt);break}if(n&&r)c!==0&&c!==1||d!==0&&d!==1||i.PolyTyp!==t.PolyTyp&&this.m_ClipType!==P.ClipType.ctXor?this.AddLocalMaxPoly(i,t,e):(this.AddOutPt(i,e),this.AddOutPt(t,e),P.Clipper.SwapSides(i,t),P.Clipper.SwapPolyIndexes(i,t));else if(n)(d===0||d===1)&&(this.AddOutPt(i,e),P.Clipper.SwapSides(i,t),P.Clipper.SwapPolyIndexes(i,t));else if(r)(c===0||c===1)&&(this.AddOutPt(t,e),P.Clipper.SwapSides(i,t),P.Clipper.SwapPolyIndexes(i,t));else if((c===0||c===1)&&(d===0||d===1)){var f,g;switch(l){case P.PolyFillType.pftPositive:f=i.WindCnt2;break;case P.PolyFillType.pftNegative:f=-i.WindCnt2;break;default:f=Math.abs(i.WindCnt2);break}switch(u){case P.PolyFillType.pftPositive:g=t.WindCnt2;break;case P.PolyFillType.pftNegative:g=-t.WindCnt2;break;default:g=Math.abs(t.WindCnt2);break}if(i.PolyTyp!==t.PolyTyp)this.AddLocalMinPoly(i,t,e);else if(c===1&&d===1)switch(this.m_ClipType){case P.ClipType.ctIntersection:f>0&&g>0&&this.AddLocalMinPoly(i,t,e);break;case P.ClipType.ctUnion:f<=0&&g<=0&&this.AddLocalMinPoly(i,t,e);break;case P.ClipType.ctDifference:(i.PolyTyp===P.PolyType.ptClip&&f>0&&g>0||i.PolyTyp===P.PolyType.ptSubject&&f<=0&&g<=0)&&this.AddLocalMinPoly(i,t,e);break;case P.ClipType.ctXor:this.AddLocalMinPoly(i,t,e);break}else P.Clipper.SwapSides(i,t)}};P.Clipper.prototype.DeleteFromSEL=function(i){var t=i.PrevInSEL,e=i.NextInSEL;t===null&&e===null&&i!==this.m_SortedEdges||(t!==null?t.NextInSEL=e:this.m_SortedEdges=e,e!==null&&(e.PrevInSEL=t),i.NextInSEL=null,i.PrevInSEL=null)};P.Clipper.prototype.ProcessHorizontals=function(){for(var i={};this.PopEdgeFromSEL(i);)this.ProcessHorizontal(i.v)};P.Clipper.prototype.GetHorzDirection=function(i,t){i.Bot.X=s.Top.X&&(l=null)}else{for(;l.Next!==null&&l.Next.X=0&&!o&&this.AddOutPt(i,new P.FPoint2(l.X,i.Bot.Y)),l=l.Next;else for(;l!==null&&l.X>d.Curr.X;)i.OutIdx>=0&&!o&&this.AddOutPt(i,new P.FPoint2(l.X,i.Bot.Y)),l=l.Prev;if(e===P.Direction.dLeftToRight&&d.Curr.X>r||e===P.Direction.dRightToLeft&&d.Curr.X=0&&!o){P.use_xyz&&(e===P.Direction.dLeftToRight?this.SetZ(d.Curr,i,d):this.SetZ(d.Curr,d,i)),u=this.AddOutPt(i,d.Curr);for(var f=this.m_SortedEdges;f!==null;){if(f.OutIdx>=0&&this.HorzSegmentsOverlap(i.Bot.X,i.Top.X,f.Bot.X,f.Top.X)){var g=this.GetLastOutPt(f);this.AddJoin(g,u,f.Top)}f=f.NextInSEL}this.AddGhostJoin(u,i.Bot)}if(d===a&&c){i.OutIdx>=0&&this.AddLocalMaxPoly(i,a,i.Top),this.DeleteFromAEL(i),this.DeleteFromAEL(a);return}if(e===P.Direction.dLeftToRight){var x=new P.FPoint2(d.Curr.X,i.Curr.Y);this.IntersectEdges(i,d,x)}else{var x=new P.FPoint2(d.Curr.X,i.Curr.Y);this.IntersectEdges(d,i,x)}var m=this.GetNextInAEL(d,e);this.SwapPositionsInAEL(i,d),d=m}if(i.NextInLML===null||!P.ClipperBase.IsHorizontal(i.NextInLML))break;i=this.UpdateEdgeIntoAEL(i),i.OutIdx>=0&&this.AddOutPt(i,i.Bot),t={Dir:e,Left:n,Right:r},this.GetHorzDirection(i,t),e=t.Dir,n=t.Left,r=t.Right}if(i.OutIdx>=0&&u===null){u=this.GetLastOutPt(i);for(var f=this.m_SortedEdges;f!==null;){if(f.OutIdx>=0&&this.HorzSegmentsOverlap(i.Bot.X,i.Top.X,f.Bot.X,f.Top.X)){var g=this.GetLastOutPt(f);this.AddJoin(g,u,f.Top)}f=f.NextInSEL}this.AddGhostJoin(u,i.Top)}if(i.NextInLML!==null)if(i.OutIdx>=0){if(u=this.AddOutPt(i,i.Top),i=this.UpdateEdgeIntoAEL(i),i.WindDelta===0)return;var v=i.PrevInAEL,m=i.NextInAEL;if(v!==null&&v.Curr.X===i.Bot.X&&v.Curr.Y===i.Bot.Y&&v.WindDelta===0&&v.OutIdx>=0&&v.Curr.Y>v.Top.Y&&P.ClipperBase.SlopesEqual3(i,v)){var g=this.AddOutPt(v,i.Bot);this.AddJoin(u,g,i.Top)}else if(m!==null&&m.Curr.X===i.Bot.X&&m.Curr.Y===i.Bot.Y&&m.WindDelta!==0&&m.OutIdx>=0&&m.Curr.Y>m.Top.Y&&P.ClipperBase.SlopesEqual3(i,m)){var g=this.AddOutPt(m,i.Bot);this.AddJoin(u,g,i.Top)}}else i=this.UpdateEdgeIntoAEL(i);else i.OutIdx>=0&&this.AddOutPt(i,i.Top),this.DeleteFromAEL(i)};P.Clipper.prototype.GetNextInAEL=function(i,t){return t===P.Direction.dLeftToRight?i.NextInAEL:i.PrevInAEL};P.Clipper.prototype.IsMinima=function(i){return i!==null&&i.Prev.NextInLML!==i&&i.Next.NextInLML!==i};P.Clipper.prototype.IsMaxima=function(i,t){return i!==null&&i.Top.Y===t&&i.NextInLML===null};P.Clipper.prototype.IsIntermediate=function(i,t){return i.Top.Y===t&&i.NextInLML!==null};P.Clipper.prototype.GetMaximaPair=function(i){return P.FPoint.op_Equality(i.Next.Top,i.Top)&&i.Next.NextInLML===null?i.Next:P.FPoint.op_Equality(i.Prev.Top,i.Top)&&i.Prev.NextInLML===null?i.Prev:null};P.Clipper.prototype.GetMaximaPairEx=function(i){var t=this.GetMaximaPair(i);return t===null||t.OutIdx===P.ClipperBase.Skip||t.NextInAEL===t.PrevInAEL&&!P.ClipperBase.IsHorizontal(t)?null:t};P.Clipper.prototype.ProcessIntersections=function(i){if(this.m_ActiveEdges===null)return!0;try{if(this.BuildIntersectList(i),this.m_IntersectList.length===0)return!0;if(this.m_IntersectList.length===1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch{this.m_SortedEdges=null,this.m_IntersectList.length=0,P.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0};P.Clipper.prototype.BuildIntersectList=function(i){if(this.m_ActiveEdges!==null){var t=this.m_ActiveEdges;for(this.m_SortedEdges=t;t!==null;)t.PrevInSEL=t.PrevInAEL,t.NextInSEL=t.NextInAEL,t.Curr.X=P.Clipper.TopX(t,i),t=t.NextInAEL;for(var e=!0;e&&this.m_SortedEdges!==null;){for(e=!1,t=this.m_SortedEdges;t.NextInSEL!==null;){var n=t.NextInSEL,r=new P.FPoint0;if(t.Curr.X>n.Curr.X){this.IntersectPoint(t,n,r),r.Yt.Top.Y)return e.Y=i.Top.Y,e.X=P.Clipper.TopX(t,i.Top.Y),e.Xi.Curr.Y&&(e.Y=i.Curr.Y,Math.abs(i.Dx)>Math.abs(t.Dx)?e.X=P.Clipper.TopX(t,e.Y):e.X=P.Clipper.TopX(i,e.Y))};P.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(i){for(var t=this.m_ActiveEdges;t!==null;){var e=this.IsMaxima(t,i);if(e){var n=this.GetMaximaPairEx(t);e=n===null||!P.ClipperBase.IsHorizontal(n)}if(e){this.StrictlySimple&&this.InsertMaxima(t.Top.X);var r=t.PrevInAEL;this.DoMaxima(t),r===null?t=this.m_ActiveEdges:t=r.NextInAEL}else{if(this.IsIntermediate(t,i)&&P.ClipperBase.IsHorizontal(t.NextInLML)?(t=this.UpdateEdgeIntoAEL(t),t.OutIdx>=0&&this.AddOutPt(t,t.Bot),this.AddEdgeToSEL(t)):(t.Curr.X=P.Clipper.TopX(t,i),t.Curr.Y=i),P.use_xyz&&(t.Top.Y===i?t.Curr.Z=t.Top.Z:t.Bot.Y===i?t.Curr.Z=t.Bot.Z:t.Curr.Z=0),this.StrictlySimple){var r=t.PrevInAEL;if(t.OutIdx>=0&&t.WindDelta!==0&&r!==null&&r.OutIdx>=0&&r.Curr.X===t.Curr.X&&r.WindDelta!==0){var o=new P.FPoint1(t.Curr);P.use_xyz&&this.SetZ(o,r,t);var s=this.AddOutPt(r,o),a=this.AddOutPt(t,o);this.AddJoin(s,a,o)}}t=t.NextInAEL}}for(this.ProcessHorizontals(),this.m_Maxima=null,t=this.m_ActiveEdges;t!==null;){if(this.IsIntermediate(t,i)){var s=null;t.OutIdx>=0&&(s=this.AddOutPt(t,t.Top)),t=this.UpdateEdgeIntoAEL(t);var r=t.PrevInAEL,l=t.NextInAEL;if(r!==null&&r.Curr.X===t.Bot.X&&r.Curr.Y===t.Bot.Y&&s!==null&&r.OutIdx>=0&&r.Curr.Y===r.Top.Y&&P.ClipperBase.SlopesEqual5(t.Curr,t.Top,r.Curr,r.Top)&&t.WindDelta!==0&&r.WindDelta!==0){var a=this.AddOutPt(ePrev2,t.Bot);this.AddJoin(s,a,t.Top)}else if(l!==null&&l.Curr.X===t.Bot.X&&l.Curr.Y===t.Bot.Y&&s!==null&&l.OutIdx>=0&&l.Curr.Y===l.Top.Y&&P.ClipperBase.SlopesEqual5(t.Curr,t.Top,l.Curr,l.Top)&&t.WindDelta!==0&&l.WindDelta!==0){var a=this.AddOutPt(l,t.Bot);this.AddJoin(s,a,t.Top)}}t=t.NextInAEL}};P.Clipper.prototype.DoMaxima=function(i){var t=this.GetMaximaPairEx(i);if(t===null){i.OutIdx>=0&&this.AddOutPt(i,i.Top),this.DeleteFromAEL(i);return}for(var e=i.NextInAEL;e!==null&&e!==t;)this.IntersectEdges(i,e,i.Top),this.SwapPositionsInAEL(i,e),e=i.NextInAEL;i.OutIdx===-1&&t.OutIdx===-1?(this.DeleteFromAEL(i),this.DeleteFromAEL(t)):i.OutIdx>=0&&t.OutIdx>=0?(i.OutIdx>=0&&this.AddLocalMaxPoly(i,t,i.Top),this.DeleteFromAEL(i),this.DeleteFromAEL(t)):P.use_lines&&i.WindDelta===0?(i.OutIdx>=0&&(this.AddOutPt(i,i.Top),i.OutIdx=P.ClipperBase.Unassigned),this.DeleteFromAEL(i),t.OutIdx>=0&&(this.AddOutPt(t,i.Top),t.OutIdx=P.ClipperBase.Unassigned),this.DeleteFromAEL(t)):P.Error("DoMaxima error")};P.Clipper.ReversePaths=function(i){for(var t=0,e=i.length;t=0};P.Clipper.prototype.PointCount=function(i){if(i===null)return 0;var t=0,e=i;do t++,e=e.Next;while(e!==i);return t};P.Clipper.prototype.BuildResult=function(i){P.Clear(i);for(var t=0,e=this.m_PolyOuts.length;tt.Pt.X?P.Direction.dRightToLeft:P.Direction.dLeftToRight,a=e.Pt.X>n.Pt.X?P.Direction.dRightToLeft:P.Direction.dLeftToRight;if(s===a)return!1;if(s===P.Direction.dLeftToRight){for(;i.Next.Pt.X<=r.X&&i.Next.Pt.X>=i.Pt.X&&i.Next.Pt.Y===r.Y;)i=i.Next;o&&i.Pt.X!==r.X&&(i=i.Next),t=this.DupOutPt(i,!o),P.FPoint.op_Inequality(t.Pt,r)&&(i=t,i.Pt.X=r.X,i.Pt.Y=r.Y,P.use_xyz&&(i.Pt.Z=r.Z),t=this.DupOutPt(i,!o))}else{for(;i.Next.Pt.X>=r.X&&i.Next.Pt.X<=i.Pt.X&&i.Next.Pt.Y===r.Y;)i=i.Next;!o&&i.Pt.X!==r.X&&(i=i.Next),t=this.DupOutPt(i,o),P.FPoint.op_Inequality(t.Pt,r)&&(i=t,i.Pt.X=r.X,i.Pt.Y=r.Y,P.use_xyz&&(i.Pt.Z=r.Z),t=this.DupOutPt(i,o))}if(a===P.Direction.dLeftToRight){for(;e.Next.Pt.X<=r.X&&e.Next.Pt.X>=e.Pt.X&&e.Next.Pt.Y===r.Y;)e=e.Next;o&&e.Pt.X!==r.X&&(e=e.Next),n=this.DupOutPt(e,!o),P.FPoint.op_Inequality(n.Pt,r)&&(e=n,e.Pt.X=r.X,e.Pt.Y=r.Y,P.use_xyz&&(e.Pt.Z=r.Z),n=this.DupOutPt(e,!o))}else{for(;e.Next.Pt.X>=r.X&&e.Next.Pt.X<=e.Pt.X&&e.Next.Pt.Y===r.Y;)e=e.Next;!o&&e.Pt.X!==r.X&&(e=e.Next),n=this.DupOutPt(e,o),P.FPoint.op_Inequality(n.Pt,r)&&(e=n,e.Pt.X=r.X,e.Pt.Y=r.Y,P.use_xyz&&(e.Pt.Z=r.Z),n=this.DupOutPt(e,o))}return s===P.Direction.dLeftToRight===o?(i.Prev=e,e.Next=i,t.Next=n,n.Prev=t):(i.Next=e,e.Prev=i,t.Prev=n,n.Next=t),!0};P.Clipper.prototype.JoinPoints=function(i,t,e){var n=i.OutPt1,r=new P.OutPt,o=i.OutPt2,s=new P.OutPt,a=i.OutPt1.Pt.Y===i.OffPt.Y;if(a&&P.FPoint.op_Equality(i.OffPt,i.OutPt1.Pt)&&P.FPoint.op_Equality(i.OffPt,i.OutPt2.Pt)){if(t!==e)return!1;for(r=i.OutPt1.Next;r!==n&&P.FPoint.op_Equality(r.Pt,i.OffPt);)r=r.Next;var l=r.Pt.Y>i.OffPt.Y;for(s=i.OutPt2.Next;s!==o&&P.FPoint.op_Equality(s.Pt,i.OffPt);)s=s.Next;var u=s.Pt.Y>i.OffPt.Y;return l===u?!1:l?(r=this.DupOutPt(n,!1),s=this.DupOutPt(o,!0),n.Prev=o,o.Next=n,r.Next=s,s.Prev=r,i.OutPt1=n,i.OutPt2=r,!0):(r=this.DupOutPt(n,!0),s=this.DupOutPt(o,!1),n.Next=o,o.Prev=n,r.Prev=s,s.Next=r,i.OutPt1=n,i.OutPt2=r,!0)}else if(a){for(r=n;n.Prev.Pt.Y===n.Pt.Y&&n.Prev!==r&&n.Prev!==o;)n=n.Prev;for(;r.Next.Pt.Y===r.Pt.Y&&r.Next!==n&&r.Next!==o;)r=r.Next;if(r.Next===n||r.Next===o)return!1;for(s=o;o.Prev.Pt.Y===o.Pt.Y&&o.Prev!==s&&o.Prev!==r;)o=o.Prev;for(;s.Next.Pt.Y===s.Pt.Y&&s.Next!==o&&s.Next!==n;)s=s.Next;if(s.Next===o||s.Next===n)return!1;var c={Left:null,Right:null};if(!this.GetOverlap(n.Pt.X,r.Pt.X,o.Pt.X,s.Pt.X,c))return!1;var d=c.Left,f=c.Right,g=new P.FPoint0,x;return n.Pt.X>=d&&n.Pt.X<=f?(g.X=n.Pt.X,g.Y=n.Pt.Y,P.use_xyz&&(g.Z=n.Pt.Z),x=n.Pt.X>r.Pt.X):o.Pt.X>=d&&o.Pt.X<=f?(g.X=o.Pt.X,g.Y=o.Pt.Y,P.use_xyz&&(g.Z=o.Pt.Z),x=o.Pt.X>s.Pt.X):r.Pt.X>=d&&r.Pt.X<=f?(g.X=r.Pt.X,g.Y=r.Pt.Y,P.use_xyz&&(g.Z=r.Pt.Z),x=r.Pt.X>n.Pt.X):(g.X=s.Pt.X,g.Y=s.Pt.Y,P.use_xyz&&(g.Z=s.Pt.Z),x=s.Pt.X>o.Pt.X),i.OutPt1=n,i.OutPt2=o,this.JoinHorz(n,r,o,s,g,x)}else{for(r=n.Next;P.FPoint.op_Equality(r.Pt,n.Pt)&&r!==n;)r=r.Next;var m=r.Pt.Y>n.Pt.Y||!P.ClipperBase.SlopesEqual4(n.Pt,r.Pt,i.OffPt);if(m){for(r=n.Prev;P.FPoint.op_Equality(r.Pt,n.Pt)&&r!==n;)r=r.Prev;if(r.Pt.Y>n.Pt.Y||!P.ClipperBase.SlopesEqual4(n.Pt,r.Pt,i.OffPt))return!1}for(s=o.Next;P.FPoint.op_Equality(s.Pt,o.Pt)&&s!==o;)s=s.Next;var v=s.Pt.Y>o.Pt.Y||!P.ClipperBase.SlopesEqual4(o.Pt,s.Pt,i.OffPt);if(v){for(s=o.Prev;P.FPoint.op_Equality(s.Pt,o.Pt)&&s!==o;)s=s.Prev;if(s.Pt.Y>o.Pt.Y||!P.ClipperBase.SlopesEqual4(o.Pt,s.Pt,i.OffPt))return!1}return r===n||s===o||r===s||t===e&&m===v?!1:m?(r=this.DupOutPt(n,!1),s=this.DupOutPt(o,!0),n.Prev=o,o.Next=n,r.Next=s,s.Prev=r,i.OutPt1=n,i.OutPt2=r,!0):(r=this.DupOutPt(n,!0),s=this.DupOutPt(o,!1),n.Next=o,o.Prev=n,r.Prev=s,s.Next=r,i.OutPt1=n,i.OutPt2=r,!0)}};P.Clipper.GetBounds=function(i){for(var t=0,e=i.length;tn.right&&(n.right=i[t][r].X),i[t][r].Yn.bottom&&(n.bottom=i[t][r].Y);return n};P.Clipper.prototype.GetBounds2=function(i){var t=i,e=new P.FRect;for(e.left=i.Pt.X,e.right=i.Pt.X,e.top=i.Pt.Y,e.bottom=i.Pt.Y,i=i.Next;i!==t;)i.Pt.Xe.right&&(e.right=i.Pt.X),i.Pt.Ye.bottom&&(e.bottom=i.Pt.Y),i=i.Next;return e};P.Clipper.PointInPolygon=function(i,t){var e=0,n=t.length;if(n<3)return 0;for(var r=t[0],o=1;o<=n;++o){var s=o===n?t[0]:t[o];if(s.Y===i.Y&&(s.X===i.X||r.Y===i.Y&&s.X>i.X==r.X=i.X)if(s.X>i.X)e=1-e;else{var a=(r.X-i.X)*(s.Y-i.Y)-(s.X-i.X)*(r.Y-i.Y);if(a===0)return-1;a>0==s.Y>r.Y&&(e=1-e)}else if(s.X>i.X){var a=(r.X-i.X)*(s.Y-i.Y)-(s.X-i.X)*(r.Y-i.Y);if(a===0)return-1;a>0==s.Y>r.Y&&(e=1-e)}}r=s}return e};P.Clipper.prototype.PointInPolygon=function(i,t){var e=0,n=t,r=i.X,o=i.Y,s=t.Pt.X,a=t.Pt.Y;do{t=t.Next;var l=t.Pt.X,u=t.Pt.Y;if(u===o&&(l===r||a===o&&l>r==s=r)if(l>r)e=1-e;else{var c=(s-r)*(u-o)-(l-r)*(a-o);if(c===0)return-1;c>0==u>a&&(e=1-e)}else if(l>r){var c=(s-r)*(u-o)-(l-r)*(a-o);if(c===0)return-1;c>0==u>a&&(e=1-e)}}s=l,a=u}while(n!==t);return e};P.Clipper.prototype.Poly2ContainsPoly1=function(i,t){var e=i;do{var n=this.PointInPolygon(e.Pt,t);if(n>=0)return n>0;e=e.Next}while(e!==i);return!0};P.Clipper.prototype.FixupFirstLefts1=function(i,t){for(var e,n,r=0,o=this.m_PolyOuts.length;r0&&this.ReversePolyPtLinks(r.Pts)):this.Poly2ContainsPoly1(n.Pts,r.Pts)?(r.IsHole=n.IsHole,n.IsHole=!r.IsHole,r.FirstLeft=n.FirstLeft,n.FirstLeft=r,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,r),(n.IsHole^this.ReverseSolution)==this.Area$1(n)>0&&this.ReversePolyPtLinks(n.Pts)):(r.IsHole=n.IsHole,r.FirstLeft=n.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(n,r))):(r.Pts=null,r.BottomPt=null,r.Idx=n.Idx,n.IsHole=o.IsHole,o===r&&(n.FirstLeft=r.FirstLeft),r.FirstLeft=n,this.m_UsingPolyTree&&this.FixupFirstLefts3(r,n)))}}};P.Clipper.prototype.UpdateOutPtIdxs=function(i){var t=i.Pts;do t.Idx=i.Idx,t=t.Prev;while(t!==i.Pts)};P.Clipper.prototype.DoSimplePolygons=function(){for(var i=0;i"u"&&(t=P.PolyFillType.pftEvenOdd);var e=new Array,n=new P.Clipper(0);return n.StrictlySimple=!0,n.AddPaths(i,P.PolyType.ptSubject,!0),n.Execute(P.ClipType.ctUnion,e,t,t),e};P.Clipper.DistanceSqrd=function(i,t){var e=i.X-t.X,n=i.Y-t.Y;return e*e+n*n};P.Clipper.DistanceFromLineSqrd=function(i,t,e){var n=t.Y-e.Y,r=e.X-t.X,o=n*t.X+r*t.Y;return o=n*i.X+r*i.Y-o,o*o/(n*n+r*r)};P.Clipper.SlopesNearCollinear=function(i,t,e,n){return Math.abs(i.X-t.X)>Math.abs(i.Y-t.Y)?i.X>t.X==i.Xi.X==t.Xt.Y==i.Yi.Y==t.Y"u"&&(t=1.415);var e=i.length;if(e===0)return new Array;for(var n=new Array(e),r=0;r0&&n&&e.push(i.m_polygon);for(var r=0,o=i.Childs(),s=o.length,a=o[r];r"u"&&(i=2),typeof t>"u"&&(t=P.ClipperOffset.def_arc_tolerance),this.m_destPolys=new P.Paths,this.m_srcPoly=new P.Path,this.m_destPoly=new P.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new P.FPoint0,this.m_polyNodes=new P.PolyNode,this.MiterLimit=i,this.ArcTolerance=t,this.m_lowest.X=-1};P.ClipperOffset.two_pi=6.28318530717959;P.ClipperOffset.def_arc_tolerance=.25;P.ClipperOffset.prototype.Clear=function(){P.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1};P.ClipperOffset.prototype.AddPath=function(i,t,e){var n=i.length-1;if(!(n<0)){var r=new P.PolyNode;if(r.m_jointype=t,r.m_endtype=e,e===P.EndType.etClosedLine||e===P.EndType.etClosedPolygon)for(;n>0&&P.FPoint.op_Equality(i[0],i[n]);)n--;r.m_polygon.push(i[0]);for(var o=0,s=0,a=1;a<=n;a++)P.FPoint.op_Inequality(r.m_polygon[o],i[a])&&(o++,r.m_polygon.push(i[a]),(i[a].Y>r.m_polygon[s].Y||i[a].Y===r.m_polygon[s].Y&&i[a].Xl.Y||r.m_polygon[s].Y===l.Y&&r.m_polygon[s].X=0&&!P.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var i=0;i2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var n;this.ArcTolerance<=0?n=P.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(i)*P.ClipperOffset.def_arc_tolerance?n=Math.abs(i)*P.ClipperOffset.def_arc_tolerance:n=this.ArcTolerance;var r=3.14159265358979/Math.acos(1-n/Math.abs(i));this.m_sin=Math.sin(P.ClipperOffset.two_pi/r),this.m_cos=Math.cos(P.ClipperOffset.two_pi/r),this.m_StepsPerRad=r/P.ClipperOffset.two_pi,i<0&&(this.m_sin=-this.m_sin);for(var t=0;t0;l--)this.m_normals[l]=new P.FPoint2(-this.m_normals[l-1].X,-this.m_normals[l-1].Y);this.m_normals[0]=new P.FPoint2(-d.X,-d.Y),c=0;for(var l=o-1;l>=0;l--)c=this.OffsetPoint(l,c,e.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var c=0,l=1;l0;l--)this.m_normals[l]=new P.FPoint2(-this.m_normals[l-1].X,-this.m_normals[l-1].Y);this.m_normals[0]=new P.FPoint2(-this.m_normals[1].X,-this.m_normals[1].Y),c=o-1;for(var l=c-1;l>0;--l)c=this.OffsetPoint(l,c,e.m_jointype);e.m_endtype===P.EndType.etOpenButt?(f=new P.FPoint2(this.m_srcPoly[0].X-this.m_normals[0].X*i,this.m_srcPoly[0].Y-this.m_normals[0].Y*i),this.m_destPoly.push(f),f=new P.FPoint2(this.m_srcPoly[0].X+this.m_normals[0].X*i,this.m_srcPoly[0].Y+this.m_normals[0].Y*i),this.m_destPoly.push(f)):(c=1,this.m_sinA=0,e.m_endtype===P.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}};P.ClipperOffset.prototype.Execute=function(){var i=arguments,t=i[0]instanceof P.PolyTree;if(t){var e=i[0],n=i[1];e.Clear(),this.FixOrientations(),this.DoOffset(n);var r=new P.Clipper(0);if(r.AddPaths(this.m_destPolys,P.PolyType.ptSubject,!0),n>0)r.Execute(P.ClipType.ctUnion,e,P.PolyFillType.pftPositive,P.PolyFillType.pftPositive);else{var o=P.Clipper.GetBounds(this.m_destPolys),s=new P.Path;if(s.push(new P.FPoint2(o.left-10,o.bottom+10)),s.push(new P.FPoint2(o.right+10,o.bottom+10)),s.push(new P.FPoint2(o.right+10,o.top-10)),s.push(new P.FPoint2(o.left-10,o.top-10)),r.AddPath(s,P.PolyType.ptSubject,!0),r.ReverseSolution=!0,r.Execute(P.ClipType.ctUnion,e,P.PolyFillType.pftNegative,P.PolyFillType.pftNegative),e.ChildCount()===1&&e.Childs()[0].ChildCount()>0){var a=e.Childs()[0];e.Childs()[0]=a.Childs()[0],e.Childs()[0].m_Parent=e;for(var l=1;l0)r.Execute(P.ClipType.ctUnion,e,P.PolyFillType.pftPositive,P.PolyFillType.pftPositive);else{var o=P.Clipper.GetBounds(this.m_destPolys),s=new P.Path;s.push(new P.FPoint2(o.left-10,o.bottom+10)),s.push(new P.FPoint2(o.right+10,o.bottom+10)),s.push(new P.FPoint2(o.right+10,o.top-10)),s.push(new P.FPoint2(o.left-10,o.top-10)),r.AddPath(s,P.PolyType.ptSubject,!0),r.ReverseSolution=!0,r.Execute(P.ClipType.ctUnion,e,P.PolyFillType.pftNegative,P.PolyFillType.pftNegative),e.length>0&&e.splice(0,1)}}};P.ClipperOffset.prototype.OffsetPoint=function(i,t,e){if(this.m_sinA=this.m_normals[t].X*this.m_normals[i].Y-this.m_normals[i].X*this.m_normals[t].Y,this.m_sinA===0)return t;if(this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1),this.m_sinA*this.m_delta<0)this.m_destPoly.push(new P.FPoint2(this.m_srcPoly[i].X+this.m_normals[t].X*this.m_delta,this.m_srcPoly[i].Y+this.m_normals[t].Y*this.m_delta)),this.m_destPoly.push(new P.FPoint1(this.m_srcPoly[i])),this.m_destPoly.push(new P.FPoint2(this.m_srcPoly[i].X+this.m_normals[i].X*this.m_delta,this.m_srcPoly[i].Y+this.m_normals[i].Y*this.m_delta));else switch(e){case P.JoinType.jtMiter:{var n=1+(this.m_normals[i].X*this.m_normals[t].X+this.m_normals[i].Y*this.m_normals[t].Y);n>=this.m_miterLim?this.DoMiter(i,t,n):this.DoSquare(i,t);break}case P.JoinType.jtSquare:this.DoSquare(i,t);break;case P.JoinType.jtRound:this.DoRound(i,t);break}return t=i,t};P.ClipperOffset.prototype.DoSquare=function(i,t){var e=Math.tan(Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[i].X+this.m_normals[t].Y*this.m_normals[i].Y)/4);this.m_destPoly.push(new P.FPoint2(this.m_srcPoly[i].X+this.m_delta*(this.m_normals[t].X-this.m_normals[t].Y*e),this.m_srcPoly[i].Y+this.m_delta*(this.m_normals[t].Y+this.m_normals[t].X*e))),this.m_destPoly.push(new P.FPoint2(this.m_srcPoly[i].X+this.m_delta*(this.m_normals[i].X+this.m_normals[i].Y*e),this.m_srcPoly[i].Y+this.m_delta*(this.m_normals[i].Y-this.m_normals[i].X*e)))};P.ClipperOffset.prototype.DoMiter=function(i,t,e){var n=this.m_delta/e;this.m_destPoly.push(new P.FPoint2(this.m_srcPoly[i].X+(this.m_normals[t].X+this.m_normals[i].X)*n,this.m_srcPoly[i].Y+(this.m_normals[t].Y+this.m_normals[i].Y)*n))};P.ClipperOffset.prototype.DoRound=function(i,t){for(var e=Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[i].X+this.m_normals[t].Y*this.m_normals[i].Y),n=Math.max(Math.round(this.m_StepsPerRad*Math.abs(e)),1),r=this.m_normals[t].X,o=this.m_normals[t].Y,s,a=0;a1?(b=c.X,k=c.Y):O>0&&(b+=m*O,k+=v*O)),m=d.X-b,v=d.Y-k,f=m*m+v*v,f<=$&&(g[r+1]=1,r++);for(a.push({X:o[0].X,Y:o[0].Y}),r=1;r2&&N.push(a)}return e||(N=N[0]),typeof N>"u"&&(N=[]),N};P.JS.PerimeterOfPath=function(i,t){if(typeof i>"u")return 0;var e=Math.sqrt,n=0,r,o,s=0,a=0,l=0,u=0,c=i.length;if(c<2)return 0;for(t&&(i[c]=i[0],c++);--c;)r=i[c],s=r.X,a=r.Y,o=i[c-1],l=o.X,u=o.Y,n+=e((s-l)*(s-l)+(a-u)*(a-u));return t&&i.pop(),n};P.JS.PerimeterOfPaths=function(i,t){for(var e=0,n=0;n1e-8>Math.abs(i[0]-t[0])+Math.abs(i[1]-t[1]),M1=i=>{if(i.length===0)return!0;const t=i[0][0],e=i.at(-1).at(-1);return I1(t,e)};function Sl(i,t,e={}){const n={openSquare:0,openRound:1,openButt:2,closedLine:3,closedPolygon:4},r={square:0,round:1,miter:2};let o=e.endType;o in n||(o="closedPolygon");let s=e.joinType;s in r||(s="round");const a=e.miterLimit||2,l=e.arcTolerance||.1,u=n[o],c=r[s],d=O=>O.map(([b,k])=>({X:b,Y:k})),f=O=>O.map(({X:b,Y:k})=>[b,k]);M1(i);const g=i.map(d),x=new P.ClipperOffset(a,l);x.AddPaths(g,c,u);const m=new P.Paths;x.Execute(m,t);const v=m.map(f);for(;i.length>v.length;)i.pop();return v.forEach((O,b)=>{i[b]=O,i[b].push([O[0][0],O[0][1]])}),i}const $1="modulepreload",Q1=function(i,t){return new URL(i,t).href},Df={},N1=function(t,e,n){if(!e||e.length===0)return t();const r=document.getElementsByTagName("link");return Promise.all(e.map(o=>{if(o=Q1(o,n),o in Df)return;Df[o]=!0;const s=o.endsWith(".css"),a=s?'[rel="stylesheet"]':"";if(!!n)for(let c=r.length-1;c>=0;c--){const d=r[c];if(d.href===o&&(!s||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${a}`))return;const u=document.createElement("link");if(u.rel=s?"stylesheet":$1,s||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),s)return new Promise((c,d)=>{u.addEventListener("load",c),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>t()).catch(o=>{const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o})};let Gs,mu;(()=>{const i=new Map;Gs={register(a,l,u){i.set(a,{d:l,f:u,exp:{}})}};async function t(a,l){let u=a.replace(/\.\w+$/i,"");if(u.includes("./")){const[c,...d]=u.split("/").reverse(),[,...f]=l.split("/").reverse(),g=[c];let x=0,m;for(;m=d.shift();)if(m==="..")x++;else{if(m===".")break;g.push(m)}ximport(a),[],import.meta.url)}function e(a,l){return{id:a,import:u=>t(u,a),meta:{url:a,main:l}}}function n(a){return(l,u)=>{u=typeof l=="string"?{[l]:u}:l;for(const[c,d]of Object.entries(u))Object.defineProperty(a,c,{value:d,writable:!0,enumerable:!0})}}function r(a){for(const[l,u]of i.entries()){const{f:c,exp:d}=u,{execute:f,setters:g}=c(n(d),e(l,l===a));delete u.f,u.e=f,u.s=g}}async function o(a){if(!i.has(a))return;const l=i.get(a);if(l.s){const{d:u,e:c,s:d}=l;delete l.s,delete l.e;for(let g=0;g(Gs=mu=void 0,r(a),s(a))})();Gs.register("-/clipper-lib@v6.4.2-JisZmmhC7gDAFmHQLYDu/dist=es2020/clipper-lib",[],function(i,t){var e;t&&t.id;function n(o,s,a){return a={path:s,exports:{},require:function(l,u){return r(l,u??a.path)}},o(a,a.exports),a.exports}function r(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}return{setters:[],execute:function(){e=n(function(o){(function(){var s={};s.version="6.4.2.2",s.use_lines=!0,s.use_xyz=!1;var a=!1;o.exports?(o.exports=s,a=!0):typeof document<"u"?window.ClipperLib=s:self.ClipperLib=s;var l;if(a){var u="chrome";l="Netscape"}else{var u=navigator.userAgent.toString().toLowerCase();l=navigator.appName}var c={};u.indexOf("chrome")!=-1&&u.indexOf("chromium")==-1?c.chrome=1:c.chrome=0,u.indexOf("chromium")!=-1?c.chromium=1:c.chromium=0,u.indexOf("safari")!=-1&&u.indexOf("chrome")==-1&&u.indexOf("chromium")==-1?c.safari=1:c.safari=0,u.indexOf("firefox")!=-1?c.firefox=1:c.firefox=0,u.indexOf("firefox/17")!=-1?c.firefox17=1:c.firefox17=0,u.indexOf("firefox/15")!=-1?c.firefox15=1:c.firefox15=0,u.indexOf("firefox/3")!=-1?c.firefox3=1:c.firefox3=0,u.indexOf("opera")!=-1?c.opera=1:c.opera=0,u.indexOf("msie 10")!=-1?c.msie10=1:c.msie10=0,u.indexOf("msie 9")!=-1?c.msie9=1:c.msie9=0,u.indexOf("msie 8")!=-1?c.msie8=1:c.msie8=0,u.indexOf("msie 7")!=-1?c.msie7=1:c.msie7=0,u.indexOf("msie ")!=-1?c.msie=1:c.msie=0,s.biginteger_used=null;var d;function f(h,p,_){s.biginteger_used=1,h!=null&&(typeof h=="number"&&typeof p>"u"?this.fromInt(h):typeof h=="number"?this.fromNumber(h,p,_):p==null&&typeof h!="string"?this.fromString(h,256):this.fromString(h,p))}function g(){return new f(null,void 0,void 0)}function x(h,p,_,S,A,F){for(;--F>=0;){var Z=p*this[h++]+_[S]+A;A=Math.floor(Z/67108864),_[S++]=Z&67108863}return A}function m(h,p,_,S,A,F){for(var Z=p&32767,J=p>>15;--F>=0;){var K=this[h]&32767,lt=this[h++]>>15,St=J*K+lt*Z;K=Z*K+((St&32767)<<15)+_[S]+(A&1073741823),A=(K>>>30)+(St>>>15)+J*lt+(A>>>30),_[S++]=K&1073741823}return A}function v(h,p,_,S,A,F){for(var Z=p&16383,J=p>>14;--F>=0;){var K=this[h]&16383,lt=this[h++]>>14,St=J*K+lt*Z;K=Z*K+((St&16383)<<14)+_[S]+A,A=(K>>28)+(St>>14)+J*lt,_[S++]=K&268435455}return A}l=="Microsoft Internet Explorer"?(f.prototype.am=m,d=30):l!="Netscape"?(f.prototype.am=x,d=26):(f.prototype.am=v,d=28),f.prototype.DB=d,f.prototype.DM=(1<=0;--p)h[p]=this[p];h.t=this.t,h.s=this.s}function W(h){this.t=1,this.s=h<0?-1:0,h>0?this[0]=h:h<-1?this[0]=h+this.DV:this.t=0}function D(h){var p=g();return p.fromInt(h),p}function z(h,p){var _;if(p==16)_=4;else if(p==8)_=3;else if(p==256)_=8;else if(p==2)_=1;else if(p==32)_=5;else if(p==4)_=2;else{this.fromRadix(h,p);return}this.t=0,this.s=0;for(var S=h.length,A=!1,F=0;--S>=0;){var Z=_==8?h[S]&255:X(h,S);if(Z<0){h.charAt(S)=="-"&&(A=!0);continue}A=!1,F==0?this[this.t++]=Z:F+_>this.DB?(this[this.t-1]|=(Z&(1<>this.DB-F):this[this.t-1]|=Z<=this.DB&&(F-=this.DB)}_==8&&h[0]&128&&(this.s=-1,F>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==h;)--this.t}function U(h){if(this.s<0)return"-"+this.negate().toString(h);var p;if(h==16)p=4;else if(h==8)p=3;else if(h==2)p=1;else if(h==32)p=5;else if(h==4)p=2;else return this.toRadix(h);var _=(1<0)for(J>J)>0&&(A=!0,F=N(S));Z>=0;)J>(J+=this.DB-p)):(S=this[Z]>>(J-=p)&_,J<=0&&(J+=this.DB,--Z)),S>0&&(A=!0),A&&(F+=N(S));return A?F:"0"}function T(){var h=g();return f.ZERO.subTo(this,h),h}function H(){return this.s<0?this.negate():this}function gt(h){var p=this.s-h.s;if(p!=0)return p;var _=this.t;if(p=_-h.t,p!=0)return this.s<0?-p:p;for(;--_>=0;)if((p=this[_]-h[_])!=0)return p;return 0}function at(h){var p=1,_;return(_=h>>>16)!=0&&(h=_,p+=16),(_=h>>8)!=0&&(h=_,p+=8),(_=h>>4)!=0&&(h=_,p+=4),(_=h>>2)!=0&&(h=_,p+=2),(_=h>>1)!=0&&(h=_,p+=1),p}function Et(){return this.t<=0?0:this.DB*(this.t-1)+at(this[this.t-1]^this.s&this.DM)}function pt(h,p){var _;for(_=this.t-1;_>=0;--_)p[_+h]=this[_];for(_=h-1;_>=0;--_)p[_]=0;p.t=this.t+h,p.s=this.s}function Pt(h,p){for(var _=h;_=0;--J)p[J+F+1]=this[J]>>S|Z,Z=(this[J]&A)<<_;for(J=F-1;J>=0;--J)p[J]=0;p[F]=Z,p.t=this.t+F+1,p.s=this.s,p.clamp()}function it(h,p){p.s=this.s;var _=Math.floor(h/this.DB);if(_>=this.t){p.t=0;return}var S=h%this.DB,A=this.DB-S,F=(1<>S;for(var Z=_+1;Z>S;S>0&&(p[this.t-_-1]|=(this.s&F)<>=this.DB;if(h.t>=this.DB;S+=this.s}else{for(S+=this.s;_>=this.DB;S-=h.s}p.s=S<0?-1:0,S<-1?p[_++]=this.DV+S:S>0&&(p[_++]=S),p.t=_,p.clamp()}function kt(h,p){var _=this.abs(),S=h.abs(),A=_.t;for(p.t=A+S.t;--A>=0;)p[A]=0;for(A=0;A=0;)h[_]=0;for(_=0;_=p.DV&&(h[_+p.t]-=p.DV,h[_+p.t+1]=1)}h.t>0&&(h[h.t-1]+=p.am(_,p[_],h,2*_,0,1)),h.s=0,h.clamp()}function Kt(h,p,_){var S=h.abs();if(!(S.t<=0)){var A=this.abs();if(A.t0?(S.lShiftTo(K,F),A.lShiftTo(K,_)):(S.copyTo(F),A.copyTo(_));var lt=F.t,St=F[lt-1];if(St!=0){var Ot=St*(1<1?F[lt-2]>>this.F2:0),$t=this.FV/Ot,jt=(1<=0&&(_[_.t++]=1,_.subTo(ci,_)),f.ONE.dlShiftTo(lt,ci),ci.subTo(F,F);F.t=0;){var Fi=_[--ee]==St?this.DM:Math.floor(_[ee]*$t+(_[ee-1]+ue)*jt);if((_[ee]+=F.am(0,Fi,_,Se,0,lt))0&&_.rShiftTo(K,_),Z<0&&f.ZERO.subTo(_,_)}}}function Ct(h){var p=g();return this.abs().divRemTo(h,null,p),this.s<0&&p.compareTo(f.ZERO)>0&&h.subTo(p,p),p}function Wt(h){this.m=h}function Yt(h){return h.s<0||h.compareTo(this.m)>=0?h.mod(this.m):h}function te(h){return h}function Jt(h){h.divRemTo(this.m,null,h)}function xe(h,p,_){h.multiplyTo(p,_),this.reduce(_)}function oe(h,p){h.squareTo(p),this.reduce(p)}Wt.prototype.convert=Yt,Wt.prototype.revert=te,Wt.prototype.reduce=Jt,Wt.prototype.mulTo=xe,Wt.prototype.sqrTo=oe;function B(){if(this.t<1)return 0;var h=this[0];if(!(h&1))return 0;var p=h&3;return p=p*(2-(h&15)*p)&15,p=p*(2-(h&255)*p)&255,p=p*(2-((h&65535)*p&65535))&65535,p=p*(2-h*p%this.DV)%this.DV,p>0?this.DV-p:-p}function ut(h){this.m=h,this.mp=h.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(p,p),p}function G(h){var p=g();return h.copyTo(p),this.reduce(p),p}function V(h){for(;h.t<=this.mt2;)h[h.t++]=0;for(var p=0;p>15)*this.mpl&this.um)<<15)&h.DM;for(_=p+this.m.t,h[_]+=this.m.am(0,S,h,p,0,this.m.t);h[_]>=h.DV;)h[_]-=h.DV,h[++_]++}h.clamp(),h.drShiftTo(this.m.t,h),h.compareTo(this.m)>=0&&h.subTo(this.m,h)}function rt(h,p){h.squareTo(p),this.reduce(p)}function bt(h,p,_){h.multiplyTo(p,_),this.reduce(_)}ut.prototype.convert=ft,ut.prototype.revert=G,ut.prototype.reduce=V,ut.prototype.mulTo=bt,ut.prototype.sqrTo=rt;function wt(){return(this.t>0?this[0]&1:this.s)==0}function ot(h,p){if(h>4294967295||h<1)return f.ONE;var _=g(),S=g(),A=p.convert(this),F=at(h)-1;for(A.copyTo(_);--F>=0;)if(p.sqrTo(_,S),(h&1<0)p.mulTo(S,A,_);else{var Z=_;_=S,S=Z}return p.revert(_)}function Dt(h,p){var _;return h<256||p.isEven()?_=new Wt(p):_=new ut(p),this.exp(h,_)}f.prototype.copyTo=R,f.prototype.fromInt=W,f.prototype.fromString=z,f.prototype.clamp=Q,f.prototype.dlShiftTo=pt,f.prototype.drShiftTo=Pt,f.prototype.lShiftTo=nt,f.prototype.rShiftTo=it,f.prototype.subTo=It,f.prototype.multiplyTo=kt,f.prototype.squareTo=xt,f.prototype.divRemTo=Kt,f.prototype.invDigit=B,f.prototype.isEven=wt,f.prototype.exp=ot,f.prototype.toString=U,f.prototype.negate=T,f.prototype.abs=H,f.prototype.compareTo=gt,f.prototype.bitLength=Et,f.prototype.mod=Ct,f.prototype.modPowInt=Dt,f.ZERO=D(0),f.ONE=D(1);function Xt(){var h=g();return this.copyTo(h),h}function Tt(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function fe(){return this.t==0?this.s:this[0]<<16>>16}function ae(h){return Math.floor(Math.LN2*this.DB/Math.log(h))}function be(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function wi(h){if(h==null&&(h=10),this.signum()==0||h<2||h>36)return"0";var p=this.chunkSize(h),_=Math.pow(h,p),S=D(_),A=g(),F=g(),Z="";for(this.divRemTo(S,A,F);A.signum()>0;)Z=(_+F.intValue()).toString(h).substr(1)+Z,A.divRemTo(S,A,F);return F.intValue().toString(h)+Z}function pe(h,p){this.fromInt(0),p==null&&(p=10);for(var _=this.chunkSize(p),S=Math.pow(p,_),A=!1,F=0,Z=0,J=0;J=_&&(this.dMultiply(S),this.dAddOffset(Z,0),F=0,Z=0)}F>0&&(this.dMultiply(Math.pow(p,F)),this.dAddOffset(Z,0)),A&&f.ZERO.subTo(this,this)}function Vi(h,p,_){if(typeof p=="number")if(h<2)this.fromInt(1);else for(this.fromNumber(h,_),this.testBit(h-1)||this.bitwiseTo(f.ONE.shiftLeft(h-1),ui,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(p);)this.dAddOffset(2,0),this.bitLength()>h&&this.subTo(f.ONE.shiftLeft(h-1),this);else{var S=new Array,A=h&7;S.length=(h>>3)+1,p.nextBytes(S),A>0?S[0]&=(1<0)for(_>_)!=(this.s&this.DM)>>_&&(p[A++]=S|this.s<=0;)_<8?(S=(this[h]&(1<<_)-1)<<8-_,S|=this[--h]>>(_+=this.DB-8)):(S=this[h]>>(_-=8)&255,_<=0&&(_+=this.DB,--h)),S&128&&(S|=-256),A==0&&(this.s&128)!=(S&128)&&++A,(A>0||S!=this.s)&&(p[A++]=S);return p}function sn(h){return this.compareTo(h)==0}function on(h){return this.compareTo(h)<0?this:h}function le(h){return this.compareTo(h)>0?this:h}function Ze(h,p,_){var S,A,F=Math.min(h.t,this.t);for(S=0;S>=16,p+=16),h&255||(h>>=8,p+=8),h&15||(h>>=4,p+=4),h&3||(h>>=2,p+=2),h&1||++p,p}function Ao(){for(var h=0;h=this.t?this.s!=0:(this[p]&1<>=this.DB;if(h.t>=this.DB;S+=this.s}else{for(S+=this.s;_>=this.DB;S+=h.s}p.s=S<0?-1:0,S>0?p[_++]=S:S<-1&&(p[_++]=this.DV+S),p.t=_,p.clamp()}function Mr(h){var p=g();return this.addTo(h,p),p}function Gl(h){var p=g();return this.subTo(h,p),p}function Eo(h){var p=g();return this.multiplyTo(h,p),p}function Do(){var h=g();return this.squareTo(h),h}function Hl(h){var p=g();return this.divRemTo(h,p,null),p}function To(h){var p=g();return this.divRemTo(h,null,p),p}function Jl(h){var p=g(),_=g();return this.divRemTo(h,p,_),new Array(p,_)}function Kl(h){this[this.t]=this.am(0,h-1,this,0,0,this.t),++this.t,this.clamp()}function th(h,p){if(h!=0){for(;this.t<=p;)this[this.t++]=0;for(this[p]+=h;this[p]>=this.DV;)this[p]-=this.DV,++p>=this.t&&(this[this.t++]=0),++this[p]}}function Nn(){}function $r(h){return h}function eh(h,p,_){h.multiplyTo(p,_)}function Hi(h,p){h.squareTo(p)}Nn.prototype.convert=$r,Nn.prototype.revert=$r,Nn.prototype.mulTo=eh,Nn.prototype.sqrTo=Hi;function ih(h){return this.exp(h,new Nn)}function Io(h,p,_){var S=Math.min(this.t+h.t,p);for(_.s=0,_.t=S;S>0;)_[--S]=0;var A;for(A=_.t-this.t;S=0;)_[S]=0;for(S=Math.max(p-this.t,0);S2*this.m.t)return h.mod(this.m);if(h.compareTo(this.m)<0)return h;var p=g();return h.copyTo(p),this.reduce(p),p}function nh(h){return h}function Qo(h){for(h.drShiftTo(this.m.t-1,this.r2),h.t>this.m.t+1&&(h.t=this.m.t+1,h.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);h.compareTo(this.r2)<0;)h.dAddOffset(1,this.m.t+1);for(h.subTo(this.r2,h);h.compareTo(this.m)>=0;)h.subTo(this.m,h)}function Bi(h,p){h.squareTo(p),this.reduce(p)}function rh(h,p,_){h.multiplyTo(p,_),this.reduce(_)}Bn.prototype.convert=$o,Bn.prototype.revert=nh,Bn.prototype.reduce=Qo,Bn.prototype.mulTo=rh,Bn.prototype.sqrTo=Bi;function sh(h,p){var _=h.bitLength(),S,A=D(1),F;if(_<=0)return A;_<18?S=1:_<48?S=3:_<144?S=4:_<768?S=5:S=6,_<8?F=new Wt(p):p.isEven()?F=new Bn(p):F=new ut(p);var Z=new Array,J=3,K=S-1,lt=(1<1){var St=g();for(F.sqrTo(Z[1],St);J<=lt;)Z[J]=g(),F.mulTo(St,Z[J-2],Z[J]),J+=2}var Ot=h.t-1,$t,jt=!0,ue=g(),ee;for(_=at(h[Ot])-1;Ot>=0;){for(_>=K?$t=h[Ot]>>_-K<:($t=(h[Ot]&(1<<_+1)-1)<0&&($t|=h[Ot-1]>>this.DB+_-K)),J=S;!($t&1);)$t>>=1,--J;if((_-=J)<0&&(_+=this.DB,--Ot),jt)Z[$t].copyTo(A),jt=!1;else{for(;J>1;)F.sqrTo(A,ue),F.sqrTo(ue,A),J-=2;J>0?F.sqrTo(A,ue):(ee=A,A=ue,ue=ee),F.mulTo(ue,Z[$t],A)}for(;Ot>=0&&!(h[Ot]&1<<_);)F.sqrTo(A,ue),ee=A,A=ue,ue=ee,--_<0&&(_=this.DB-1,--Ot)}return F.revert(A)}function No(h){var p=this.s<0?this.negate():this.clone(),_=h.s<0?h.negate():h.clone();if(p.compareTo(_)<0){var S=p;p=_,_=S}var A=p.getLowestSetBit(),F=_.getLowestSetBit();if(F<0)return p;for(A0&&(p.rShiftTo(F,p),_.rShiftTo(F,_));p.signum()>0;)(A=p.getLowestSetBit())>0&&p.rShiftTo(A,p),(A=_.getLowestSetBit())>0&&_.rShiftTo(A,_),p.compareTo(_)>=0?(p.subTo(_,p),p.rShiftTo(1,p)):(_.subTo(p,_),_.rShiftTo(1,_));return F>0&&_.lShiftTo(F,_),_}function Bo(h){if(h<=0)return 0;var p=this.DV%h,_=this.s<0?h-1:0;if(this.t>0)if(p==0)_=this[0]%h;else for(var S=this.t-1;S>=0;--S)_=(p*_+this[S])%h;return _}function oh(h){var p=h.isEven();if(this.isEven()&&p||h.signum()==0)return f.ZERO;for(var _=h.clone(),S=this.clone(),A=D(1),F=D(0),Z=D(0),J=D(1);_.signum()!=0;){for(;_.isEven();)_.rShiftTo(1,_),p?((!A.isEven()||!F.isEven())&&(A.addTo(this,A),F.subTo(h,F)),A.rShiftTo(1,A)):F.isEven()||F.subTo(h,F),F.rShiftTo(1,F);for(;S.isEven();)S.rShiftTo(1,S),p?((!Z.isEven()||!J.isEven())&&(Z.addTo(this,Z),J.subTo(h,J)),Z.rShiftTo(1,Z)):J.isEven()||J.subTo(h,J),J.rShiftTo(1,J);_.compareTo(S)>=0?(_.subTo(S,_),p&&A.subTo(Z,A),F.subTo(J,F)):(S.subTo(_,S),p&&Z.subTo(A,Z),J.subTo(F,J))}if(S.compareTo(f.ONE)!=0)return f.ZERO;if(J.compareTo(h)>=0)return J.subtract(h);if(J.signum()<0)J.addTo(h,J);else return J;return J.signum()<0?J.add(h):J}var ii=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],ah=(1<<26)/ii[ii.length-1];function Fo(h){var p,_=this.abs();if(_.t==1&&_[0]<=ii[ii.length-1]){for(p=0;p>1,h>ii.length&&(h=ii.length);for(var A=g(),F=0;F0},he.op_LessThan=function(h,p){return h.compareTo(p)<0},he.op_Addition=function(h,p){return new he(h,void 0,void 0).add(new he(p,void 0,void 0))},he.op_Subtraction=function(h,p){return new he(h,void 0,void 0).subtract(new he(p,void 0,void 0))},he.Int128Mul=function(h,p){return new he(h,void 0,void 0).multiply(new he(p,void 0,void 0))},he.op_Division=function(h,p){return h.divide(p)},he.prototype.ToDouble=function(){return parseFloat(this.toString())};var Ji=function(h,p){var _;if(typeof Object.getOwnPropertyNames>"u"){for(_ in p.prototype)(typeof h.prototype[_]>"u"||h.prototype[_]===Object.prototype[_])&&(h.prototype[_]=p.prototype[_]);for(_ in p)typeof h[_]>"u"&&(h[_]=p[_]);h.$baseCtor=p}else{for(var S=Object.getOwnPropertyNames(p.prototype),A=0;A"u"&&Object.defineProperty(h.prototype,S[A],Object.getOwnPropertyDescriptor(p.prototype,S[A]));for(_ in p)typeof h[_]>"u"&&(h[_]=p[_]);h.$baseCtor=p}};s.Path=function(){return[]},s.Path.prototype.push=Array.prototype.push,s.Paths=function(){return[]},s.Paths.prototype.push=Array.prototype.push,s.DoublePoint=function(){var h=arguments;this.X=0,this.Y=0,h.length===1?(this.X=h[0].X,this.Y=h[0].Y):h.length===2&&(this.X=h[0],this.Y=h[1])},s.DoublePoint0=function(){this.X=0,this.Y=0},s.DoublePoint0.prototype=s.DoublePoint.prototype,s.DoublePoint1=function(h){this.X=h.X,this.Y=h.Y},s.DoublePoint1.prototype=s.DoublePoint.prototype,s.DoublePoint2=function(h,p){this.X=h,this.Y=p},s.DoublePoint2.prototype=s.DoublePoint.prototype,s.PolyNode=function(){this.m_Parent=null,this.m_polygon=new s.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1},s.PolyNode.prototype.IsHoleNode=function(){for(var h=!0,p=this.m_Parent;p!==null;)h=!h,p=p.m_Parent;return h},s.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length},s.PolyNode.prototype.Contour=function(){return this.m_polygon},s.PolyNode.prototype.AddChild=function(h){var p=this.m_Childs.length;this.m_Childs.push(h),h.m_Parent=this,h.m_Index=p},s.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()},s.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index===this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]},s.PolyNode.prototype.Childs=function(){return this.m_Childs},s.PolyNode.prototype.Parent=function(){return this.m_Parent},s.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()},s.PolyTree=function(){this.m_AllPolys=[],s.PolyNode.call(this)},s.PolyTree.prototype.Clear=function(){for(var h=0,p=this.m_AllPolys.length;h0?this.m_Childs[0]:null},s.PolyTree.prototype.Total=function(){var h=this.m_AllPolys.length;return h>0&&this.m_Childs[0]!==this.m_AllPolys[0]&&h--,h},Ji(s.PolyTree,s.PolyNode),s.Math_Abs_Int64=s.Math_Abs_Int32=s.Math_Abs_Double=function(h){return Math.abs(h)},s.Math_Max_Int32_Int32=function(h,p){return Math.max(h,p)},c.msie||c.opera||c.safari?s.Cast_Int32=function(h){return h|0}:s.Cast_Int32=function(h){return~~h},typeof Number.toInteger>"u"&&(Number.toInteger=null),c.chrome?s.Cast_Int64=function(h){return h<-2147483648||h>2147483647?h<0?Math.ceil(h):Math.floor(h):~~h}:c.firefox&&typeof Number.toInteger=="function"?s.Cast_Int64=function(h){return Number.toInteger(h)}:c.msie7||c.msie8?s.Cast_Int64=function(h){return parseInt(h,10)}:c.msie?s.Cast_Int64=function(h){return h<-2147483648||h>2147483647?h<0?Math.ceil(h):Math.floor(h):h|0}:s.Cast_Int64=function(h){return h<0?Math.ceil(h):Math.floor(h)},s.Clear=function(h){h.length=0},s.PI=3.141592653589793,s.PI2=2*3.141592653589793,s.IntPoint=function(){var h=arguments,p=h.length;if(this.X=0,this.Y=0,s.use_xyz)if(this.Z=0,p===3)this.X=h[0],this.Y=h[1],this.Z=h[2];else if(p===2)this.X=h[0],this.Y=h[1],this.Z=0;else if(p===1)if(h[0]instanceof s.DoublePoint){var _=h[0];this.X=s.Clipper.Round(_.X),this.Y=s.Clipper.Round(_.Y),this.Z=0}else{var S=h[0];typeof S.Z>"u"&&(S.Z=0),this.X=S.X,this.Y=S.Y,this.Z=S.Z}else this.X=0,this.Y=0,this.Z=0;else if(p===2)this.X=h[0],this.Y=h[1];else if(p===1)if(h[0]instanceof s.DoublePoint){var _=h[0];this.X=s.Clipper.Round(_.X),this.Y=s.Clipper.Round(_.Y)}else{var S=h[0];this.X=S.X,this.Y=S.Y}else this.X=0,this.Y=0},s.IntPoint.op_Equality=function(h,p){return h.X===p.X&&h.Y===p.Y},s.IntPoint.op_Inequality=function(h,p){return h.X!==p.X||h.Y!==p.Y},s.IntPoint0=function(){this.X=0,this.Y=0,s.use_xyz&&(this.Z=0)},s.IntPoint0.prototype=s.IntPoint.prototype,s.IntPoint1=function(h){this.X=h.X,this.Y=h.Y,s.use_xyz&&(typeof h.Z>"u"?this.Z=0:this.Z=h.Z)},s.IntPoint1.prototype=s.IntPoint.prototype,s.IntPoint1dp=function(h){this.X=s.Clipper.Round(h.X),this.Y=s.Clipper.Round(h.Y),s.use_xyz&&(this.Z=0)},s.IntPoint1dp.prototype=s.IntPoint.prototype,s.IntPoint2=function(h,p,_){this.X=h,this.Y=p,s.use_xyz&&(typeof _>"u"?this.Z=0:this.Z=_)},s.IntPoint2.prototype=s.IntPoint.prototype,s.IntRect=function(){var h=arguments,p=h.length;if(p===4)this.left=h[0],this.top=h[1],this.right=h[2],this.bottom=h[3];else if(p===1){var _=h[0];this.left=_.left,this.top=_.top,this.right=_.right,this.bottom=_.bottom}else this.left=0,this.top=0,this.right=0,this.bottom=0},s.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0},s.IntRect0.prototype=s.IntRect.prototype,s.IntRect1=function(h){this.left=h.left,this.top=h.top,this.right=h.right,this.bottom=h.bottom},s.IntRect1.prototype=s.IntRect.prototype,s.IntRect4=function(h,p,_,S){this.left=h,this.top=p,this.right=_,this.bottom=S},s.IntRect4.prototype=s.IntRect.prototype,s.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3},s.PolyType={ptSubject:0,ptClip:1},s.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3},s.JoinType={jtSquare:0,jtRound:1,jtMiter:2},s.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4},s.EdgeSide={esLeft:0,esRight:1},s.Direction={dRightToLeft:0,dLeftToRight:1},s.TEdge=function(){this.Bot=new s.IntPoint0,this.Curr=new s.IntPoint0,this.Top=new s.IntPoint0,this.Delta=new s.IntPoint0,this.Dx=0,this.PolyTyp=s.PolyType.ptSubject,this.Side=s.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null},s.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new s.IntPoint0},s.MyIntersectNodeSort=function(){},s.MyIntersectNodeSort.Compare=function(h,p){var _=p.Pt.Y-h.Pt.Y;return _>0?1:_<0?-1:0},s.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null},s.Scanbeam=function(){this.Y=0,this.Next=null},s.Maxima=function(){this.X=0,this.Next=null,this.Prev=null},s.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null},s.OutPt=function(){this.Idx=0,this.Pt=new s.IntPoint0,this.Next=null,this.Prev=null},s.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new s.IntPoint0},s.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_Scanbeam=null,this.m_PolyOuts=null,this.m_ActiveEdges=null},s.ClipperBase.horizontal=-9007199254740992,s.ClipperBase.Skip=-2,s.ClipperBase.Unassigned=-1,s.ClipperBase.tolerance=1e-20,s.ClipperBase.loRange=47453132,s.ClipperBase.hiRange=0xfffffffffffff,s.ClipperBase.near_zero=function(h){return h>-s.ClipperBase.tolerance&&hp.X==h.X<_.X&&h.Y>p.Y==h.Y<_.Y&&he.op_Equality(he.Int128Mul(h.X-p.X,_.Y-p.Y),he.Int128Mul(_.X-p.X,h.Y-p.Y)):h.X===p.X&&h.Y===p.Y||h.X===_.X&&h.Y===_.Y||h.X>p.X==h.X<_.X&&h.Y>p.Y==h.Y<_.Y&&(h.X-p.X)*(_.Y-p.Y)===(_.X-p.X)*(h.Y-p.Y)},s.ClipperBase.prototype.PointOnPolygon=function(h,p,_){for(var S=p;;){if(this.PointOnLineSegment(h,S.Pt,S.Next.Pt,_))return!0;if(S=S.Next,S===p)break}return!1},s.ClipperBase.prototype.SlopesEqual=s.ClipperBase.SlopesEqual=function(){var h=arguments,p=h.length,_,S,A,F,Z,J,K;return p===3?(_=h[0],S=h[1],K=h[2],K?he.op_Equality(he.Int128Mul(_.Delta.Y,S.Delta.X),he.Int128Mul(_.Delta.X,S.Delta.Y)):s.Cast_Int64(_.Delta.Y*S.Delta.X)===s.Cast_Int64(_.Delta.X*S.Delta.Y)):p===4?(A=h[0],F=h[1],Z=h[2],K=h[3],K?he.op_Equality(he.Int128Mul(A.Y-F.Y,F.X-Z.X),he.Int128Mul(A.X-F.X,F.Y-Z.Y)):s.Cast_Int64((A.Y-F.Y)*(F.X-Z.X))-s.Cast_Int64((A.X-F.X)*(F.Y-Z.Y))===0):(A=h[0],F=h[1],Z=h[2],J=h[3],K=h[4],K?he.op_Equality(he.Int128Mul(A.Y-F.Y,Z.X-J.X),he.Int128Mul(A.X-F.X,Z.Y-J.Y)):s.Cast_Int64((A.Y-F.Y)*(Z.X-J.X))-s.Cast_Int64((A.X-F.X)*(Z.Y-J.Y))===0)},s.ClipperBase.SlopesEqual3=function(h,p,_){return _?he.op_Equality(he.Int128Mul(h.Delta.Y,p.Delta.X),he.Int128Mul(h.Delta.X,p.Delta.Y)):s.Cast_Int64(h.Delta.Y*p.Delta.X)===s.Cast_Int64(h.Delta.X*p.Delta.Y)},s.ClipperBase.SlopesEqual4=function(h,p,_,S){return S?he.op_Equality(he.Int128Mul(h.Y-p.Y,p.X-_.X),he.Int128Mul(h.X-p.X,p.Y-_.Y)):s.Cast_Int64((h.Y-p.Y)*(p.X-_.X))-s.Cast_Int64((h.X-p.X)*(p.Y-_.Y))===0},s.ClipperBase.SlopesEqual5=function(h,p,_,S,A){return A?he.op_Equality(he.Int128Mul(h.Y-p.Y,_.X-S.X),he.Int128Mul(h.X-p.X,_.Y-S.Y)):s.Cast_Int64((h.Y-p.Y)*(_.X-S.X))-s.Cast_Int64((h.X-p.X)*(_.Y-S.Y))===0},s.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var h=0,p=this.m_edges.length;hs.ClipperBase.hiRange||h.Y>s.ClipperBase.hiRange||-h.X>s.ClipperBase.hiRange||-h.Y>s.ClipperBase.hiRange)&&s.Error("Coordinate outside allowed range in RangeTest()."):(h.X>s.ClipperBase.loRange||h.Y>s.ClipperBase.loRange||-h.X>s.ClipperBase.loRange||-h.Y>s.ClipperBase.loRange)&&(p.Value=!0,this.RangeTest(h,p))},s.ClipperBase.prototype.InitEdge=function(h,p,_,S){h.Next=p,h.Prev=_,h.Curr.X=S.X,h.Curr.Y=S.Y,s.use_xyz&&(h.Curr.Z=S.Z),h.OutIdx=-1},s.ClipperBase.prototype.InitEdge2=function(h,p){h.Curr.Y>=h.Next.Curr.Y?(h.Bot.X=h.Curr.X,h.Bot.Y=h.Curr.Y,s.use_xyz&&(h.Bot.Z=h.Curr.Z),h.Top.X=h.Next.Curr.X,h.Top.Y=h.Next.Curr.Y,s.use_xyz&&(h.Top.Z=h.Next.Curr.Z)):(h.Top.X=h.Curr.X,h.Top.Y=h.Curr.Y,s.use_xyz&&(h.Top.Z=h.Curr.Z),h.Bot.X=h.Next.Curr.X,h.Bot.Y=h.Next.Curr.Y,s.use_xyz&&(h.Bot.Z=h.Next.Curr.Z)),this.SetDx(h),h.PolyTyp=p},s.ClipperBase.prototype.FindNextLocMin=function(h){for(var p;;){for(;s.IntPoint.op_Inequality(h.Bot,h.Prev.Bot)||s.IntPoint.op_Equality(h.Curr,h.Top);)h=h.Next;if(h.Dx!==s.ClipperBase.horizontal&&h.Prev.Dx!==s.ClipperBase.horizontal)break;for(;h.Prev.Dx===s.ClipperBase.horizontal;)h=h.Prev;for(p=h;h.Dx===s.ClipperBase.horizontal;)h=h.Next;if(h.Top.Y!==h.Prev.Bot.Y){p.Prev.Bot.XS.Next.Top.X&&(S=A.Prev)}for(;h!==S;)h.NextInLML=h.Next,h.Dx===s.ClipperBase.horizontal&&h!==_&&h.Bot.X!==h.Prev.Top.X&&this.ReverseHorizontal(h),h=h.Next;h.Dx===s.ClipperBase.horizontal&&h!==_&&h.Bot.X!==h.Prev.Top.X&&this.ReverseHorizontal(h),S=S.Next}else{for(;S.Top.Y===S.Prev.Bot.Y&&S.Prev.OutIdx!==s.ClipperBase.Skip;)S=S.Prev;if(S.Dx===s.ClipperBase.horizontal&&S.Prev.OutIdx!==s.ClipperBase.Skip){for(A=S;A.Next.Dx===s.ClipperBase.horizontal;)A=A.Next;(A.Next.Top.X===S.Prev.Top.X||A.Next.Top.X>S.Prev.Top.X)&&(S=A.Next)}for(;h!==S;)h.NextInLML=h.Prev,h.Dx===s.ClipperBase.horizontal&&h!==_&&h.Bot.X!==h.Next.Top.X&&this.ReverseHorizontal(h),h=h.Prev;h.Dx===s.ClipperBase.horizontal&&h!==_&&h.Bot.X!==h.Next.Top.X&&this.ReverseHorizontal(h),S=S.Prev}return S},s.ClipperBase.prototype.AddPath=function(h,p,_){s.use_lines?!_&&p===s.PolyType.ptClip&&s.Error("AddPath: Open paths must be subject."):_||s.Error("AddPath: Open paths have been disabled.");var S=h.length-1;if(_)for(;S>0&&s.IntPoint.op_Equality(h[S],h[0]);)--S;for(;S>0&&s.IntPoint.op_Equality(h[S],h[S-1]);)--S;if(_&&S<2||!_&&S<1)return!1;for(var A=new Array,F=0;F<=S;F++)A.push(new s.TEdge);var Z=!0;A[1].Curr.X=h[1].X,A[1].Curr.Y=h[1].Y,s.use_xyz&&(A[1].Curr.Z=h[1].Z);var J={Value:this.m_UseFullRange};this.RangeTest(h[0],J),this.m_UseFullRange=J.Value,J.Value=this.m_UseFullRange,this.RangeTest(h[S],J),this.m_UseFullRange=J.Value,this.InitEdge(A[0],A[1],A[S],h[0]),this.InitEdge(A[S],A[0],A[S-1],h[S]);for(var F=S-1;F>=1;--F)J.Value=this.m_UseFullRange,this.RangeTest(h[F],J),this.m_UseFullRange=J.Value,this.InitEdge(A[F],A[F+1],A[F-1],h[F]);for(var K=A[0],lt=K,St=K;;){if(lt.Curr===lt.Next.Curr&&(_||lt.Next!==K)){if(lt===lt.Next)break;lt===K&&(K=lt.Next),lt=this.RemoveEdge(lt),St=lt;continue}if(lt.Prev===lt.Next)break;if(_&&s.ClipperBase.SlopesEqual4(lt.Prev.Curr,lt.Curr,lt.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(lt.Prev.Curr,lt.Curr,lt.Next.Curr))){lt===K&&(K=lt.Next),lt=this.RemoveEdge(lt),lt=lt.Prev,St=lt;continue}if(lt=lt.Next,lt===St||!_&<.Next===K)break}if(!_&<===lt.Next||_&<.Prev===lt.Next)return!1;_||(this.m_HasOpenPaths=!0,K.Prev.OutIdx=s.ClipperBase.Skip),lt=K;do this.InitEdge2(lt,p),lt=lt.Next,Z&<.Curr.Y!==K.Curr.Y&&(Z=!1);while(lt!==K);if(Z){if(_)return!1;lt.Prev.OutIdx=s.ClipperBase.Skip;var Ot=new s.LocalMinima;for(Ot.Next=null,Ot.Y=lt.Bot.Y,Ot.LeftBound=null,Ot.RightBound=lt,Ot.RightBound.Side=s.EdgeSide.esRight,Ot.RightBound.WindDelta=0;lt.Bot.X!==lt.Prev.Top.X&&this.ReverseHorizontal(lt),lt.Next.OutIdx!==s.ClipperBase.Skip;)lt.NextInLML=lt.Next,lt=lt.Next;return this.InsertLocalMinima(Ot),this.m_edges.push(A),!0}this.m_edges.push(A);var $t,jt=null;for(s.IntPoint.op_Equality(lt.Prev.Bot,lt.Prev.Top)&&(lt=lt.Next);lt=this.FindNextLocMin(lt),lt!==jt;){jt===null&&(jt=lt);var Ot=new s.LocalMinima;Ot.Next=null,Ot.Y=lt.Bot.Y,lt.Dxh.X==p.X<_.X:p.Y>h.Y==p.Y<_.Y},s.ClipperBase.prototype.RemoveEdge=function(h){h.Prev.Next=h.Next,h.Next.Prev=h.Prev;var p=h.Next;return h.Prev=null,p},s.ClipperBase.prototype.SetDx=function(h){h.Delta.X=h.Top.X-h.Bot.X,h.Delta.Y=h.Top.Y-h.Bot.Y,h.Delta.Y===0?h.Dx=s.ClipperBase.horizontal:h.Dx=h.Delta.X/h.Delta.Y},s.ClipperBase.prototype.InsertLocalMinima=function(h){if(this.m_MinimaList===null)this.m_MinimaList=h;else if(h.Y>=this.m_MinimaList.Y)h.Next=this.m_MinimaList,this.m_MinimaList=h;else{for(var p=this.m_MinimaList;p.Next!==null&&h.Ythis.m_Scanbeam.Y){var p=new s.Scanbeam;p.Y=h,p.Next=this.m_Scanbeam,this.m_Scanbeam=p}else{for(var _=this.m_Scanbeam;_.Next!==null&&h<=_.Next.Y;)_=_.Next;if(h===_.Y)return;var S=new s.Scanbeam;S.Y=h,S.Next=_.Next,_.Next=S}},s.ClipperBase.prototype.PopScanbeam=function(h){return this.m_Scanbeam===null?(h.v=0,!1):(h.v=this.m_Scanbeam.Y,this.m_Scanbeam=this.m_Scanbeam.Next,!0)},s.ClipperBase.prototype.LocalMinimaPending=function(){return this.m_CurrentLM!==null},s.ClipperBase.prototype.CreateOutRec=function(){var h=new s.OutRec;return h.Idx=s.ClipperBase.Unassigned,h.IsHole=!1,h.IsOpen=!1,h.FirstLeft=null,h.Pts=null,h.BottomPt=null,h.PolyNode=null,this.m_PolyOuts.push(h),h.Idx=this.m_PolyOuts.length-1,h},s.ClipperBase.prototype.DisposeOutRec=function(h){var p=this.m_PolyOuts[h];p.Pts=null,p=null,this.m_PolyOuts[h]=null},s.ClipperBase.prototype.UpdateEdgeIntoAEL=function(h){h.NextInLML===null&&s.Error("UpdateEdgeIntoAEL: invalid call");var p=h.PrevInAEL,_=h.NextInAEL;return h.NextInLML.OutIdx=h.OutIdx,p!==null?p.NextInAEL=h.NextInLML:this.m_ActiveEdges=h.NextInLML,_!==null&&(_.PrevInAEL=h.NextInLML),h.NextInLML.Side=h.Side,h.NextInLML.WindDelta=h.WindDelta,h.NextInLML.WindCnt=h.WindCnt,h.NextInLML.WindCnt2=h.WindCnt2,h=h.NextInLML,h.Curr.X=h.Bot.X,h.Curr.Y=h.Bot.Y,h.PrevInAEL=p,h.NextInAEL=_,s.ClipperBase.IsHorizontal(h)||this.InsertScanbeam(h.Top.Y),h},s.ClipperBase.prototype.SwapPositionsInAEL=function(h,p){if(!(h.NextInAEL===h.PrevInAEL||p.NextInAEL===p.PrevInAEL)){if(h.NextInAEL===p){var _=p.NextInAEL;_!==null&&(_.PrevInAEL=h);var S=h.PrevInAEL;S!==null&&(S.NextInAEL=p),p.PrevInAEL=S,p.NextInAEL=h,h.PrevInAEL=p,h.NextInAEL=_}else if(p.NextInAEL===h){var A=h.NextInAEL;A!==null&&(A.PrevInAEL=p);var F=p.PrevInAEL;F!==null&&(F.NextInAEL=h),h.PrevInAEL=F,h.NextInAEL=p,p.PrevInAEL=h,p.NextInAEL=A}else{var Z=h.NextInAEL,J=h.PrevInAEL;h.NextInAEL=p.NextInAEL,h.NextInAEL!==null&&(h.NextInAEL.PrevInAEL=h),h.PrevInAEL=p.PrevInAEL,h.PrevInAEL!==null&&(h.PrevInAEL.NextInAEL=h),p.NextInAEL=Z,p.NextInAEL!==null&&(p.NextInAEL.PrevInAEL=p),p.PrevInAEL=J,p.PrevInAEL!==null&&(p.PrevInAEL.NextInAEL=p)}h.PrevInAEL===null?this.m_ActiveEdges=h:p.PrevInAEL===null&&(this.m_ActiveEdges=p)}},s.ClipperBase.prototype.DeleteFromAEL=function(h){var p=h.PrevInAEL,_=h.NextInAEL;p===null&&_===null&&h!==this.m_ActiveEdges||(p!==null?p.NextInAEL=_:this.m_ActiveEdges=_,_!==null&&(_.PrevInAEL=p),h.NextInAEL=null,h.PrevInAEL=null)},s.Clipper=function(h){typeof h>"u"&&(h=0),this.m_PolyOuts=null,this.m_ClipType=s.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=s.PolyFillType.pftEvenOdd,this.m_SubjFillType=s.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,s.ClipperBase.call(this),this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=s.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=(1&h)!==0,this.StrictlySimple=(2&h)!==0,this.PreserveCollinear=(4&h)!==0,s.use_xyz&&(this.ZFillFunction=null)},s.Clipper.ioReverseSolution=1,s.Clipper.ioStrictlySimple=2,s.Clipper.ioPreserveCollinear=4,s.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),s.ClipperBase.prototype.Clear.call(this))},s.Clipper.prototype.InsertMaxima=function(h){var p=new s.Maxima;if(p.X=h,this.m_Maxima===null)this.m_Maxima=p,this.m_Maxima.Next=null,this.m_Maxima.Prev=null;else if(h=_.Next.X;)_=_.Next;if(h===_.X)return;p.Next=_.Next,p.Prev=_,_.Next!==null&&(_.Next.Prev=p),_.Next=p}},s.Clipper.prototype.Execute=function(){var h=arguments,p=h.length,_=h[1]instanceof s.PolyTree;if(p===4&&!_){var S=h[0],A=h[1],F=h[2],Z=h[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&s.Error("Error: PolyTree struct is needed for open path clipping."),this.m_ExecuteLocked=!0,s.Clear(A),this.m_SubjFillType=F,this.m_ClipFillType=Z,this.m_ClipType=S,this.m_UsingPolyTree=!1;try{var J=this.ExecuteInternal();J&&this.BuildResult(A)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return J}else if(p===4&&_){var S=h[0],K=h[1],F=h[2],Z=h[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=F,this.m_ClipFillType=Z,this.m_ClipType=S,this.m_UsingPolyTree=!0;try{var J=this.ExecuteInternal();J&&this.BuildResult2(K)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return J}else if(p===2&&!_){var S=h[0],A=h[1];return this.Execute(S,A,s.PolyFillType.pftEvenOdd,s.PolyFillType.pftEvenOdd)}else if(p===2&&_){var S=h[0],K=h[1];return this.Execute(S,K,s.PolyFillType.pftEvenOdd,s.PolyFillType.pftEvenOdd)}},s.Clipper.prototype.FixHoleLinkage=function(h){if(!(h.FirstLeft===null||h.IsHole!==h.FirstLeft.IsHole&&h.FirstLeft.Pts!==null)){for(var p=h.FirstLeft;p!==null&&(p.IsHole===h.IsHole||p.Pts===null);)p=p.FirstLeft;h.FirstLeft=p}},s.Clipper.prototype.ExecuteInternal=function(){try{this.Reset(),this.m_SortedEdges=null,this.m_Maxima=null;var h={},p={};if(!this.PopScanbeam(h))return!1;for(this.InsertLocalMinimaIntoAEL(h.v);this.PopScanbeam(p)||this.LocalMinimaPending();){if(this.ProcessHorizontals(),this.m_GhostJoins.length=0,!this.ProcessIntersections(p.v))return!1;this.ProcessEdgesAtTopOfScanbeam(p.v),h.v=p.v,this.InsertLocalMinimaIntoAEL(h.v)}var _,S,A;for(S=0,A=this.m_PolyOuts.length;S0&&this.ReversePolyPtLinks(_.Pts);for(this.JoinCommonEdges(),S=0,A=this.m_PolyOuts.length;S0&&S.WindDelta!==0)for(var F=0,Z=this.m_GhostJoins.length;F=0&&_.PrevInAEL!==null&&_.PrevInAEL.Curr.X===_.Bot.X&&_.PrevInAEL.OutIdx>=0&&s.ClipperBase.SlopesEqual5(_.PrevInAEL.Curr,_.PrevInAEL.Top,_.Curr,_.Top,this.m_UseFullRange)&&_.WindDelta!==0&&_.PrevInAEL.WindDelta!==0){var K=this.AddOutPt(_.PrevInAEL,_.Bot);this.AddJoin(A,K,_.Top)}if(_.NextInAEL!==S){if(S.OutIdx>=0&&S.PrevInAEL.OutIdx>=0&&s.ClipperBase.SlopesEqual5(S.PrevInAEL.Curr,S.PrevInAEL.Top,S.Curr,S.Top,this.m_UseFullRange)&&S.WindDelta!==0&&S.PrevInAEL.WindDelta!==0){var K=this.AddOutPt(S.PrevInAEL,S.Bot);this.AddJoin(A,K,S.Top)}var lt=_.NextInAEL;if(lt!==null)for(;lt!==S;)this.IntersectEdges(S,lt,_.Curr),lt=lt.NextInAEL}}}},s.Clipper.prototype.InsertEdgeIntoAEL=function(h,p){if(this.m_ActiveEdges===null)h.PrevInAEL=null,h.NextInAEL=null,this.m_ActiveEdges=h;else if(p===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,h))h.PrevInAEL=null,h.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=h,this.m_ActiveEdges=h;else{for(p===null&&(p=this.m_ActiveEdges);p.NextInAEL!==null&&!this.E2InsertsBeforeE1(p.NextInAEL,h);)p=p.NextInAEL;h.NextInAEL=p.NextInAEL,p.NextInAEL!==null&&(p.NextInAEL.PrevInAEL=h),h.PrevInAEL=p,p.NextInAEL=h}},s.Clipper.prototype.E2InsertsBeforeE1=function(h,p){return p.Curr.X===h.Curr.X?p.Top.Y>h.Top.Y?p.Top.Xs.Clipper.TopX(p,h.Top.Y):p.Curr.X0;default:return h.WindCnt2<0}case s.ClipType.ctUnion:switch(_){case s.PolyFillType.pftEvenOdd:case s.PolyFillType.pftNonZero:return h.WindCnt2===0;case s.PolyFillType.pftPositive:return h.WindCnt2<=0;default:return h.WindCnt2>=0}case s.ClipType.ctDifference:if(h.PolyTyp===s.PolyType.ptSubject)switch(_){case s.PolyFillType.pftEvenOdd:case s.PolyFillType.pftNonZero:return h.WindCnt2===0;case s.PolyFillType.pftPositive:return h.WindCnt2<=0;default:return h.WindCnt2>=0}else switch(_){case s.PolyFillType.pftEvenOdd:case s.PolyFillType.pftNonZero:return h.WindCnt2!==0;case s.PolyFillType.pftPositive:return h.WindCnt2>0;default:return h.WindCnt2<0}case s.ClipType.ctXor:if(h.WindDelta===0)switch(_){case s.PolyFillType.pftEvenOdd:case s.PolyFillType.pftNonZero:return h.WindCnt2===0;case s.PolyFillType.pftPositive:return h.WindCnt2<=0;default:return h.WindCnt2>=0}else return!0}return!0},s.Clipper.prototype.SetWindingCount=function(h){for(var p=h.PrevInAEL;p!==null&&(p.PolyTyp!==h.PolyTyp||p.WindDelta===0);)p=p.PrevInAEL;if(p===null){var _=h.PolyTyp===s.PolyType.ptSubject?this.m_SubjFillType:this.m_ClipFillType;h.WindDelta===0?h.WindCnt=_===s.PolyFillType.pftNegative?-1:1:h.WindCnt=h.WindDelta,h.WindCnt2=0,p=this.m_ActiveEdges}else if(h.WindDelta===0&&this.m_ClipType!==s.ClipType.ctUnion)h.WindCnt=1,h.WindCnt2=p.WindCnt2,p=p.NextInAEL;else if(this.IsEvenOddFillType(h)){if(h.WindDelta===0){for(var S=!0,A=p.PrevInAEL;A!==null;)A.PolyTyp===p.PolyTyp&&A.WindDelta!==0&&(S=!S),A=A.PrevInAEL;h.WindCnt=S?0:1}else h.WindCnt=h.WindDelta;h.WindCnt2=p.WindCnt2,p=p.NextInAEL}else p.WindCnt*p.WindDelta<0?Math.abs(p.WindCnt)>1?p.WindDelta*h.WindDelta<0?h.WindCnt=p.WindCnt:h.WindCnt=p.WindCnt+h.WindDelta:h.WindCnt=h.WindDelta===0?1:h.WindDelta:h.WindDelta===0?h.WindCnt=p.WindCnt<0?p.WindCnt-1:p.WindCnt+1:p.WindDelta*h.WindDelta<0?h.WindCnt=p.WindCnt:h.WindCnt=p.WindCnt+h.WindDelta,h.WindCnt2=p.WindCnt2,p=p.NextInAEL;if(this.IsEvenOddAltFillType(h))for(;p!==h;)p.WindDelta!==0&&(h.WindCnt2=h.WindCnt2===0?1:0),p=p.NextInAEL;else for(;p!==h;)h.WindCnt2+=p.WindDelta,p=p.NextInAEL},s.Clipper.prototype.AddEdgeToSEL=function(h){this.m_SortedEdges===null?(this.m_SortedEdges=h,h.PrevInSEL=null,h.NextInSEL=null):(h.NextInSEL=this.m_SortedEdges,h.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=h,this.m_SortedEdges=h)},s.Clipper.prototype.PopEdgeFromSEL=function(h){if(h.v=this.m_SortedEdges,h.v===null)return!1;var p=h.v;return this.m_SortedEdges=h.v.NextInSEL,this.m_SortedEdges!==null&&(this.m_SortedEdges.PrevInSEL=null),p.NextInSEL=null,p.PrevInSEL=null,!0},s.Clipper.prototype.CopyAELToSEL=function(){var h=this.m_ActiveEdges;for(this.m_SortedEdges=h;h!==null;)h.PrevInSEL=h.PrevInAEL,h.NextInSEL=h.NextInAEL,h=h.NextInAEL},s.Clipper.prototype.SwapPositionsInSEL=function(h,p){if(!(h.NextInSEL===null&&h.PrevInSEL===null)&&!(p.NextInSEL===null&&p.PrevInSEL===null)){if(h.NextInSEL===p){var _=p.NextInSEL;_!==null&&(_.PrevInSEL=h);var S=h.PrevInSEL;S!==null&&(S.NextInSEL=p),p.PrevInSEL=S,p.NextInSEL=h,h.PrevInSEL=p,h.NextInSEL=_}else if(p.NextInSEL===h){var _=h.NextInSEL;_!==null&&(_.PrevInSEL=p);var S=p.PrevInSEL;S!==null&&(S.NextInSEL=h),h.PrevInSEL=S,h.NextInSEL=p,p.PrevInSEL=h,p.NextInSEL=_}else{var _=h.NextInSEL,S=h.PrevInSEL;h.NextInSEL=p.NextInSEL,h.NextInSEL!==null&&(h.NextInSEL.PrevInSEL=h),h.PrevInSEL=p.PrevInSEL,h.PrevInSEL!==null&&(h.PrevInSEL.NextInSEL=h),p.NextInSEL=_,p.NextInSEL!==null&&(p.NextInSEL.PrevInSEL=p),p.PrevInSEL=S,p.PrevInSEL!==null&&(p.PrevInSEL.NextInSEL=p)}h.PrevInSEL===null?this.m_SortedEdges=h:p.PrevInSEL===null&&(this.m_SortedEdges=p)}},s.Clipper.prototype.AddLocalMaxPoly=function(h,p,_){this.AddOutPt(h,_),p.WindDelta===0&&this.AddOutPt(p,_),h.OutIdx===p.OutIdx?(h.OutIdx=-1,p.OutIdx=-1):h.OutIdxp.Dx?(S=this.AddOutPt(h,_),p.OutIdx=h.OutIdx,h.Side=s.EdgeSide.esLeft,p.Side=s.EdgeSide.esRight,A=h,A.PrevInAEL===p?F=p.PrevInAEL:F=A.PrevInAEL):(S=this.AddOutPt(p,_),h.OutIdx=p.OutIdx,h.Side=s.EdgeSide.esRight,p.Side=s.EdgeSide.esLeft,A=p,A.PrevInAEL===h?F=h.PrevInAEL:F=A.PrevInAEL),F!==null&&F.OutIdx>=0&&F.Top.Y<_.Y&&A.Top.Y<_.Y){var Z=s.Clipper.TopX(F,_.Y),J=s.Clipper.TopX(A,_.Y);if(Z===J&&A.WindDelta!==0&&F.WindDelta!==0&&s.ClipperBase.SlopesEqual5(new s.IntPoint2(Z,_.Y),F.Top,new s.IntPoint2(J,_.Y),A.Top,this.m_UseFullRange)){var K=this.AddOutPt(F,_);this.AddJoin(S,K,A.Top)}}return S},s.Clipper.prototype.AddOutPt=function(h,p){if(h.OutIdx<0){var _=this.CreateOutRec();_.IsOpen=h.WindDelta===0;var S=new s.OutPt;return _.Pts=S,S.Idx=_.Idx,S.Pt.X=p.X,S.Pt.Y=p.Y,s.use_xyz&&(S.Pt.Z=p.Z),S.Next=S,S.Prev=S,_.IsOpen||this.SetHoleState(h,_),h.OutIdx=_.Idx,S}else{var _=this.m_PolyOuts[h.OutIdx],A=_.Pts,F=h.Side===s.EdgeSide.esLeft;if(F&&s.IntPoint.op_Equality(p,A.Pt))return A;if(!F&&s.IntPoint.op_Equality(p,A.Prev.Pt))return A.Prev;var S=new s.OutPt;return S.Idx=_.Idx,S.Pt.X=p.X,S.Pt.Y=p.Y,s.use_xyz&&(S.Pt.Z=p.Z),S.Next=A,S.Prev=A.Prev,S.Prev.Next=S,A.Prev=S,F&&(_.Pts=S),S}},s.Clipper.prototype.GetLastOutPt=function(h){var p=this.m_PolyOuts[h.OutIdx];return h.Side===s.EdgeSide.esLeft?p.Pts:p.Pts.Prev},s.Clipper.prototype.SwapPoints=function(h,p){var _=new s.IntPoint1(h.Value);h.Value.X=p.Value.X,h.Value.Y=p.Value.Y,s.use_xyz&&(h.Value.Z=p.Value.Z),p.Value.X=_.X,p.Value.Y=_.Y,s.use_xyz&&(p.Value.Z=_.Z)},s.Clipper.prototype.HorzSegmentsOverlap=function(h,p,_,S){var A;return h>p&&(A=h,h=p,p=A),_>S&&(A=_,_=S,S=A),h=0&&_.WindDelta!==0&&(S===null?S=_:S.OutIdx===_.OutIdx&&(S=null)),_=_.PrevInAEL;S===null?(p.FirstLeft=null,p.IsHole=!1):(p.FirstLeft=this.m_PolyOuts[S.OutIdx],p.IsHole=!p.FirstLeft.IsHole)},s.Clipper.prototype.GetDx=function(h,p){return h.Y===p.Y?s.ClipperBase.horizontal:(p.X-h.X)/(p.Y-h.Y)},s.Clipper.prototype.FirstIsBottomPt=function(h,p){for(var _=h.Prev;s.IntPoint.op_Equality(_.Pt,h.Pt)&&_!==h;)_=_.Prev;var S=Math.abs(this.GetDx(h.Pt,_.Pt));for(_=h.Next;s.IntPoint.op_Equality(_.Pt,h.Pt)&&_!==h;)_=_.Next;var A=Math.abs(this.GetDx(h.Pt,_.Pt));for(_=p.Prev;s.IntPoint.op_Equality(_.Pt,p.Pt)&&_!==p;)_=_.Prev;var F=Math.abs(this.GetDx(p.Pt,_.Pt));for(_=p.Next;s.IntPoint.op_Equality(_.Pt,p.Pt)&&_!==p;)_=_.Next;var Z=Math.abs(this.GetDx(p.Pt,_.Pt));return Math.max(S,A)===Math.max(F,Z)&&Math.min(S,A)===Math.min(F,Z)?this.Area(h)>0:S>=F&&S>=Z||A>=F&&A>=Z},s.Clipper.prototype.GetBottomPt=function(h){for(var p=null,_=h.Next;_!==h;)_.Pt.Y>h.Pt.Y?(h=_,p=null):_.Pt.Y===h.Pt.Y&&_.Pt.X<=h.Pt.X&&(_.Pt.XS.Pt.Y?h:_.Pt.YS.Pt.X||_.Next===_?p:S.Next===S||this.FirstIsBottomPt(_,S)?h:p},s.Clipper.prototype.OutRec1RightOfOutRec2=function(h,p){do if(h=h.FirstLeft,h===p)return!0;while(h!==null);return!1},s.Clipper.prototype.GetOutRec=function(h){for(var p=this.m_PolyOuts[h];p!==this.m_PolyOuts[p.Idx];)p=this.m_PolyOuts[p.Idx];return p},s.Clipper.prototype.AppendPolygon=function(h,p){var _=this.m_PolyOuts[h.OutIdx],S=this.m_PolyOuts[p.OutIdx],A;this.OutRec1RightOfOutRec2(_,S)?A=S:this.OutRec1RightOfOutRec2(S,_)?A=_:A=this.GetLowermostRec(_,S);var F=_.Pts,Z=F.Prev,J=S.Pts,K=J.Prev;h.Side===s.EdgeSide.esLeft?p.Side===s.EdgeSide.esLeft?(this.ReversePolyPtLinks(J),J.Next=F,F.Prev=J,Z.Next=K,K.Prev=Z,_.Pts=K):(K.Next=F,F.Prev=K,J.Prev=Z,Z.Next=J,_.Pts=J):p.Side===s.EdgeSide.esRight?(this.ReversePolyPtLinks(J),Z.Next=K,K.Prev=Z,J.Next=F,F.Prev=J):(Z.Next=J,J.Prev=Z,F.Prev=K,K.Next=F),_.BottomPt=null,A===S&&(S.FirstLeft!==_&&(_.FirstLeft=S.FirstLeft),_.IsHole=S.IsHole),S.Pts=null,S.BottomPt=null,S.FirstLeft=_;var lt=h.OutIdx,St=p.OutIdx;h.OutIdx=-1,p.OutIdx=-1;for(var Ot=this.m_ActiveEdges;Ot!==null;){if(Ot.OutIdx===St){Ot.OutIdx=lt,Ot.Side=h.Side;break}Ot=Ot.NextInAEL}S.Idx=_.Idx},s.Clipper.prototype.ReversePolyPtLinks=function(h){if(h!==null){var p,_;p=h;do _=p.Next,p.Next=p.Prev,p.Prev=_,p=_;while(p!==h)}},s.Clipper.SwapSides=function(h,p){var _=h.Side;h.Side=p.Side,p.Side=_},s.Clipper.SwapPolyIndexes=function(h,p){var _=h.OutIdx;h.OutIdx=p.OutIdx,p.OutIdx=_},s.Clipper.prototype.IntersectEdges=function(h,p,_){var S=h.OutIdx>=0,A=p.OutIdx>=0;if(s.use_xyz&&this.SetZ(_,h,p),s.use_lines&&(h.WindDelta===0||p.WindDelta===0)){if(h.WindDelta===0&&p.WindDelta===0)return;h.PolyTyp===p.PolyTyp&&h.WindDelta!==p.WindDelta&&this.m_ClipType===s.ClipType.ctUnion?h.WindDelta===0?A&&(this.AddOutPt(h,_),S&&(h.OutIdx=-1)):S&&(this.AddOutPt(p,_),A&&(p.OutIdx=-1)):h.PolyTyp!==p.PolyTyp&&(h.WindDelta===0&&Math.abs(p.WindCnt)===1&&(this.m_ClipType!==s.ClipType.ctUnion||p.WindCnt2===0)?(this.AddOutPt(h,_),S&&(h.OutIdx=-1)):p.WindDelta===0&&Math.abs(h.WindCnt)===1&&(this.m_ClipType!==s.ClipType.ctUnion||h.WindCnt2===0)&&(this.AddOutPt(p,_),A&&(p.OutIdx=-1)));return}if(h.PolyTyp===p.PolyTyp)if(this.IsEvenOddFillType(h)){var F=h.WindCnt;h.WindCnt=p.WindCnt,p.WindCnt=F}else h.WindCnt+p.WindDelta===0?h.WindCnt=-h.WindCnt:h.WindCnt+=p.WindDelta,p.WindCnt-h.WindDelta===0?p.WindCnt=-p.WindCnt:p.WindCnt-=h.WindDelta;else this.IsEvenOddFillType(p)?h.WindCnt2=h.WindCnt2===0?1:0:h.WindCnt2+=p.WindDelta,this.IsEvenOddFillType(h)?p.WindCnt2=p.WindCnt2===0?1:0:p.WindCnt2-=h.WindDelta;var Z,J,K,lt;h.PolyTyp===s.PolyType.ptSubject?(Z=this.m_SubjFillType,K=this.m_ClipFillType):(Z=this.m_ClipFillType,K=this.m_SubjFillType),p.PolyTyp===s.PolyType.ptSubject?(J=this.m_SubjFillType,lt=this.m_ClipFillType):(J=this.m_ClipFillType,lt=this.m_SubjFillType);var St,Ot;switch(Z){case s.PolyFillType.pftPositive:St=h.WindCnt;break;case s.PolyFillType.pftNegative:St=-h.WindCnt;break;default:St=Math.abs(h.WindCnt);break}switch(J){case s.PolyFillType.pftPositive:Ot=p.WindCnt;break;case s.PolyFillType.pftNegative:Ot=-p.WindCnt;break;default:Ot=Math.abs(p.WindCnt);break}if(S&&A)St!==0&&St!==1||Ot!==0&&Ot!==1||h.PolyTyp!==p.PolyTyp&&this.m_ClipType!==s.ClipType.ctXor?this.AddLocalMaxPoly(h,p,_):(this.AddOutPt(h,_),this.AddOutPt(p,_),s.Clipper.SwapSides(h,p),s.Clipper.SwapPolyIndexes(h,p));else if(S)(Ot===0||Ot===1)&&(this.AddOutPt(h,_),s.Clipper.SwapSides(h,p),s.Clipper.SwapPolyIndexes(h,p));else if(A)(St===0||St===1)&&(this.AddOutPt(p,_),s.Clipper.SwapSides(h,p),s.Clipper.SwapPolyIndexes(h,p));else if((St===0||St===1)&&(Ot===0||Ot===1)){var $t,jt;switch(K){case s.PolyFillType.pftPositive:$t=h.WindCnt2;break;case s.PolyFillType.pftNegative:$t=-h.WindCnt2;break;default:$t=Math.abs(h.WindCnt2);break}switch(lt){case s.PolyFillType.pftPositive:jt=p.WindCnt2;break;case s.PolyFillType.pftNegative:jt=-p.WindCnt2;break;default:jt=Math.abs(p.WindCnt2);break}if(h.PolyTyp!==p.PolyTyp)this.AddLocalMinPoly(h,p,_);else if(St===1&&Ot===1)switch(this.m_ClipType){case s.ClipType.ctIntersection:$t>0&&jt>0&&this.AddLocalMinPoly(h,p,_);break;case s.ClipType.ctUnion:$t<=0&&jt<=0&&this.AddLocalMinPoly(h,p,_);break;case s.ClipType.ctDifference:(h.PolyTyp===s.PolyType.ptClip&&$t>0&&jt>0||h.PolyTyp===s.PolyType.ptSubject&&$t<=0&&jt<=0)&&this.AddLocalMinPoly(h,p,_);break;case s.ClipType.ctXor:this.AddLocalMinPoly(h,p,_);break}else s.Clipper.SwapSides(h,p)}},s.Clipper.prototype.DeleteFromSEL=function(h){var p=h.PrevInSEL,_=h.NextInSEL;p===null&&_===null&&h!==this.m_SortedEdges||(p!==null?p.NextInSEL=_:this.m_SortedEdges=_,_!==null&&(_.PrevInSEL=p),h.NextInSEL=null,h.PrevInSEL=null)},s.Clipper.prototype.ProcessHorizontals=function(){for(var h={};this.PopEdgeFromSEL(h);)this.ProcessHorizontal(h.v)},s.Clipper.prototype.GetHorzDirection=function(h,p){h.Bot.X=Z.Top.X&&(K=null)}else{for(;K.Next!==null&&K.Next.X=0&&!F&&this.AddOutPt(h,new s.IntPoint2(K.X,h.Bot.Y)),K=K.Next;else for(;K!==null&&K.X>Ot.Curr.X;)h.OutIdx>=0&&!F&&this.AddOutPt(h,new s.IntPoint2(K.X,h.Bot.Y)),K=K.Prev;if(_===s.Direction.dLeftToRight&&Ot.Curr.X>A||_===s.Direction.dRightToLeft&&Ot.Curr.X=0&&!F){s.use_xyz&&(_===s.Direction.dLeftToRight?this.SetZ(Ot.Curr,h,Ot):this.SetZ(Ot.Curr,Ot,h)),lt=this.AddOutPt(h,Ot.Curr);for(var $t=this.m_SortedEdges;$t!==null;){if($t.OutIdx>=0&&this.HorzSegmentsOverlap(h.Bot.X,h.Top.X,$t.Bot.X,$t.Top.X)){var jt=this.GetLastOutPt($t);this.AddJoin(jt,lt,$t.Top)}$t=$t.NextInSEL}this.AddGhostJoin(lt,h.Bot)}if(Ot===J&&St){h.OutIdx>=0&&this.AddLocalMaxPoly(h,J,h.Top),this.DeleteFromAEL(h),this.DeleteFromAEL(J);return}if(_===s.Direction.dLeftToRight){var ue=new s.IntPoint2(Ot.Curr.X,h.Curr.Y);this.IntersectEdges(h,Ot,ue)}else{var ue=new s.IntPoint2(Ot.Curr.X,h.Curr.Y);this.IntersectEdges(Ot,h,ue)}var ee=this.GetNextInAEL(Ot,_);this.SwapPositionsInAEL(h,Ot),Ot=ee}if(h.NextInLML===null||!s.ClipperBase.IsHorizontal(h.NextInLML))break;h=this.UpdateEdgeIntoAEL(h),h.OutIdx>=0&&this.AddOutPt(h,h.Bot),p={Dir:_,Left:S,Right:A},this.GetHorzDirection(h,p),_=p.Dir,S=p.Left,A=p.Right}if(h.OutIdx>=0&<===null){lt=this.GetLastOutPt(h);for(var $t=this.m_SortedEdges;$t!==null;){if($t.OutIdx>=0&&this.HorzSegmentsOverlap(h.Bot.X,h.Top.X,$t.Bot.X,$t.Top.X)){var jt=this.GetLastOutPt($t);this.AddJoin(jt,lt,$t.Top)}$t=$t.NextInSEL}this.AddGhostJoin(lt,h.Top)}if(h.NextInLML!==null)if(h.OutIdx>=0){if(lt=this.AddOutPt(h,h.Top),h=this.UpdateEdgeIntoAEL(h),h.WindDelta===0)return;var Se=h.PrevInAEL,ee=h.NextInAEL;if(Se!==null&&Se.Curr.X===h.Bot.X&&Se.Curr.Y===h.Bot.Y&&Se.WindDelta===0&&Se.OutIdx>=0&&Se.Curr.Y>Se.Top.Y&&s.ClipperBase.SlopesEqual3(h,Se,this.m_UseFullRange)){var jt=this.AddOutPt(Se,h.Bot);this.AddJoin(lt,jt,h.Top)}else if(ee!==null&&ee.Curr.X===h.Bot.X&&ee.Curr.Y===h.Bot.Y&&ee.WindDelta!==0&&ee.OutIdx>=0&&ee.Curr.Y>ee.Top.Y&&s.ClipperBase.SlopesEqual3(h,ee,this.m_UseFullRange)){var jt=this.AddOutPt(ee,h.Bot);this.AddJoin(lt,jt,h.Top)}}else h=this.UpdateEdgeIntoAEL(h);else h.OutIdx>=0&&this.AddOutPt(h,h.Top),this.DeleteFromAEL(h)},s.Clipper.prototype.GetNextInAEL=function(h,p){return p===s.Direction.dLeftToRight?h.NextInAEL:h.PrevInAEL},s.Clipper.prototype.IsMinima=function(h){return h!==null&&h.Prev.NextInLML!==h&&h.Next.NextInLML!==h},s.Clipper.prototype.IsMaxima=function(h,p){return h!==null&&h.Top.Y===p&&h.NextInLML===null},s.Clipper.prototype.IsIntermediate=function(h,p){return h.Top.Y===p&&h.NextInLML!==null},s.Clipper.prototype.GetMaximaPair=function(h){return s.IntPoint.op_Equality(h.Next.Top,h.Top)&&h.Next.NextInLML===null?h.Next:s.IntPoint.op_Equality(h.Prev.Top,h.Top)&&h.Prev.NextInLML===null?h.Prev:null},s.Clipper.prototype.GetMaximaPairEx=function(h){var p=this.GetMaximaPair(h);return p===null||p.OutIdx===s.ClipperBase.Skip||p.NextInAEL===p.PrevInAEL&&!s.ClipperBase.IsHorizontal(p)?null:p},s.Clipper.prototype.ProcessIntersections=function(h){if(this.m_ActiveEdges===null)return!0;try{if(this.BuildIntersectList(h),this.m_IntersectList.length===0)return!0;if(this.m_IntersectList.length===1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch{this.m_SortedEdges=null,this.m_IntersectList.length=0,s.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0},s.Clipper.prototype.BuildIntersectList=function(h){if(this.m_ActiveEdges!==null){var p=this.m_ActiveEdges;for(this.m_SortedEdges=p;p!==null;)p.PrevInSEL=p.PrevInAEL,p.NextInSEL=p.NextInAEL,p.Curr.X=s.Clipper.TopX(p,h),p=p.NextInAEL;for(var _=!0;_&&this.m_SortedEdges!==null;){for(_=!1,p=this.m_SortedEdges;p.NextInSEL!==null;){var S=p.NextInSEL,A=new s.IntPoint0;if(p.Curr.X>S.Curr.X){this.IntersectPoint(p,S,A),A.Y2147483647?Math.floor(h):h|0)};c.msie?s.Clipper.Round=Pe:c.chromium?s.Clipper.Round=Qr:c.safari?s.Clipper.Round=uh:s.Clipper.Round=hh,s.Clipper.TopX=function(h,p){return p===h.Top.Y?h.Top.X:h.Bot.X+s.Clipper.Round(h.Dx*(p-h.Bot.Y))},s.Clipper.prototype.IntersectPoint=function(h,p,_){_.X=0,_.Y=0;var S,A;if(h.Dx===p.Dx){_.Y=h.Curr.Y,_.X=s.Clipper.TopX(h,_.Y);return}if(h.Delta.X===0)_.X=h.Bot.X,s.ClipperBase.IsHorizontal(p)?_.Y=p.Bot.Y:(A=p.Bot.Y-p.Bot.X/p.Dx,_.Y=s.Clipper.Round(_.X/p.Dx+A));else if(p.Delta.X===0)_.X=p.Bot.X,s.ClipperBase.IsHorizontal(h)?_.Y=h.Bot.Y:(S=h.Bot.Y-h.Bot.X/h.Dx,_.Y=s.Clipper.Round(_.X/h.Dx+S));else{S=h.Bot.X-h.Bot.Y*h.Dx,A=p.Bot.X-p.Bot.Y*p.Dx;var F=(A-S)/(h.Dx-p.Dx);_.Y=s.Clipper.Round(F),Math.abs(h.Dx)p.Top.Y)return _.Y=h.Top.Y,_.X=s.Clipper.TopX(p,h.Top.Y),_.Xh.Curr.Y&&(_.Y=h.Curr.Y,Math.abs(h.Dx)>Math.abs(p.Dx)?_.X=s.Clipper.TopX(p,_.Y):_.X=s.Clipper.TopX(h,_.Y))},s.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(h){for(var p=this.m_ActiveEdges;p!==null;){var _=this.IsMaxima(p,h);if(_){var S=this.GetMaximaPairEx(p);_=S===null||!s.ClipperBase.IsHorizontal(S)}if(_){this.StrictlySimple&&this.InsertMaxima(p.Top.X);var A=p.PrevInAEL;this.DoMaxima(p),A===null?p=this.m_ActiveEdges:p=A.NextInAEL}else{if(this.IsIntermediate(p,h)&&s.ClipperBase.IsHorizontal(p.NextInLML)?(p=this.UpdateEdgeIntoAEL(p),p.OutIdx>=0&&this.AddOutPt(p,p.Bot),this.AddEdgeToSEL(p)):(p.Curr.X=s.Clipper.TopX(p,h),p.Curr.Y=h),s.use_xyz&&(p.Top.Y===h?p.Curr.Z=p.Top.Z:p.Bot.Y===h?p.Curr.Z=p.Bot.Z:p.Curr.Z=0),this.StrictlySimple){var A=p.PrevInAEL;if(p.OutIdx>=0&&p.WindDelta!==0&&A!==null&&A.OutIdx>=0&&A.Curr.X===p.Curr.X&&A.WindDelta!==0){var F=new s.IntPoint1(p.Curr);s.use_xyz&&this.SetZ(F,A,p);var Z=this.AddOutPt(A,F),J=this.AddOutPt(p,F);this.AddJoin(Z,J,F)}}p=p.NextInAEL}}for(this.ProcessHorizontals(),this.m_Maxima=null,p=this.m_ActiveEdges;p!==null;){if(this.IsIntermediate(p,h)){var Z=null;p.OutIdx>=0&&(Z=this.AddOutPt(p,p.Top)),p=this.UpdateEdgeIntoAEL(p);var A=p.PrevInAEL,K=p.NextInAEL;if(A!==null&&A.Curr.X===p.Bot.X&&A.Curr.Y===p.Bot.Y&&Z!==null&&A.OutIdx>=0&&A.Curr.Y===A.Top.Y&&s.ClipperBase.SlopesEqual5(p.Curr,p.Top,A.Curr,A.Top,this.m_UseFullRange)&&p.WindDelta!==0&&A.WindDelta!==0){var J=this.AddOutPt(ePrev2,p.Bot);this.AddJoin(Z,J,p.Top)}else if(K!==null&&K.Curr.X===p.Bot.X&&K.Curr.Y===p.Bot.Y&&Z!==null&&K.OutIdx>=0&&K.Curr.Y===K.Top.Y&&s.ClipperBase.SlopesEqual5(p.Curr,p.Top,K.Curr,K.Top,this.m_UseFullRange)&&p.WindDelta!==0&&K.WindDelta!==0){var J=this.AddOutPt(K,p.Bot);this.AddJoin(Z,J,p.Top)}}p=p.NextInAEL}},s.Clipper.prototype.DoMaxima=function(h){var p=this.GetMaximaPairEx(h);if(p===null){h.OutIdx>=0&&this.AddOutPt(h,h.Top),this.DeleteFromAEL(h);return}for(var _=h.NextInAEL;_!==null&&_!==p;)this.IntersectEdges(h,_,h.Top),this.SwapPositionsInAEL(h,_),_=h.NextInAEL;h.OutIdx===-1&&p.OutIdx===-1?(this.DeleteFromAEL(h),this.DeleteFromAEL(p)):h.OutIdx>=0&&p.OutIdx>=0?(h.OutIdx>=0&&this.AddLocalMaxPoly(h,p,h.Top),this.DeleteFromAEL(h),this.DeleteFromAEL(p)):s.use_lines&&h.WindDelta===0?(h.OutIdx>=0&&(this.AddOutPt(h,h.Top),h.OutIdx=s.ClipperBase.Unassigned),this.DeleteFromAEL(h),p.OutIdx>=0&&(this.AddOutPt(p,h.Top),p.OutIdx=s.ClipperBase.Unassigned),this.DeleteFromAEL(p)):s.Error("DoMaxima error")},s.Clipper.ReversePaths=function(h){for(var p=0,_=h.length;p<_;p++)h[p].reverse()},s.Clipper.Orientation=function(h){return s.Clipper.Area(h)>=0},s.Clipper.prototype.PointCount=function(h){if(h===null)return 0;var p=0,_=h;do p++,_=_.Next;while(_!==h);return p},s.Clipper.prototype.BuildResult=function(h){s.Clear(h);for(var p=0,_=this.m_PolyOuts.length;p<_;p++){var S=this.m_PolyOuts[p];if(S.Pts!==null){var A=S.Pts.Prev,F=this.PointCount(A);if(!(F<2)){for(var Z=new Array(F),J=0;Jp.Pt.X?s.Direction.dRightToLeft:s.Direction.dLeftToRight,J=_.Pt.X>S.Pt.X?s.Direction.dRightToLeft:s.Direction.dLeftToRight;if(Z===J)return!1;if(Z===s.Direction.dLeftToRight){for(;h.Next.Pt.X<=A.X&&h.Next.Pt.X>=h.Pt.X&&h.Next.Pt.Y===A.Y;)h=h.Next;F&&h.Pt.X!==A.X&&(h=h.Next),p=this.DupOutPt(h,!F),s.IntPoint.op_Inequality(p.Pt,A)&&(h=p,h.Pt.X=A.X,h.Pt.Y=A.Y,s.use_xyz&&(h.Pt.Z=A.Z),p=this.DupOutPt(h,!F))}else{for(;h.Next.Pt.X>=A.X&&h.Next.Pt.X<=h.Pt.X&&h.Next.Pt.Y===A.Y;)h=h.Next;!F&&h.Pt.X!==A.X&&(h=h.Next),p=this.DupOutPt(h,F),s.IntPoint.op_Inequality(p.Pt,A)&&(h=p,h.Pt.X=A.X,h.Pt.Y=A.Y,s.use_xyz&&(h.Pt.Z=A.Z),p=this.DupOutPt(h,F))}if(J===s.Direction.dLeftToRight){for(;_.Next.Pt.X<=A.X&&_.Next.Pt.X>=_.Pt.X&&_.Next.Pt.Y===A.Y;)_=_.Next;F&&_.Pt.X!==A.X&&(_=_.Next),S=this.DupOutPt(_,!F),s.IntPoint.op_Inequality(S.Pt,A)&&(_=S,_.Pt.X=A.X,_.Pt.Y=A.Y,s.use_xyz&&(_.Pt.Z=A.Z),S=this.DupOutPt(_,!F))}else{for(;_.Next.Pt.X>=A.X&&_.Next.Pt.X<=_.Pt.X&&_.Next.Pt.Y===A.Y;)_=_.Next;!F&&_.Pt.X!==A.X&&(_=_.Next),S=this.DupOutPt(_,F),s.IntPoint.op_Inequality(S.Pt,A)&&(_=S,_.Pt.X=A.X,_.Pt.Y=A.Y,s.use_xyz&&(_.Pt.Z=A.Z),S=this.DupOutPt(_,F))}return Z===s.Direction.dLeftToRight===F?(h.Prev=_,_.Next=h,p.Next=S,S.Prev=p):(h.Next=_,_.Prev=h,p.Prev=S,S.Next=p),!0},s.Clipper.prototype.JoinPoints=function(h,p,_){var S=h.OutPt1,A=new s.OutPt,F=h.OutPt2,Z=new s.OutPt,J=h.OutPt1.Pt.Y===h.OffPt.Y;if(J&&s.IntPoint.op_Equality(h.OffPt,h.OutPt1.Pt)&&s.IntPoint.op_Equality(h.OffPt,h.OutPt2.Pt)){if(p!==_)return!1;for(A=h.OutPt1.Next;A!==S&&s.IntPoint.op_Equality(A.Pt,h.OffPt);)A=A.Next;var K=A.Pt.Y>h.OffPt.Y;for(Z=h.OutPt2.Next;Z!==F&&s.IntPoint.op_Equality(Z.Pt,h.OffPt);)Z=Z.Next;var lt=Z.Pt.Y>h.OffPt.Y;return K===lt?!1:K?(A=this.DupOutPt(S,!1),Z=this.DupOutPt(F,!0),S.Prev=F,F.Next=S,A.Next=Z,Z.Prev=A,h.OutPt1=S,h.OutPt2=A,!0):(A=this.DupOutPt(S,!0),Z=this.DupOutPt(F,!1),S.Next=F,F.Prev=S,A.Prev=Z,Z.Next=A,h.OutPt1=S,h.OutPt2=A,!0)}else if(J){for(A=S;S.Prev.Pt.Y===S.Pt.Y&&S.Prev!==A&&S.Prev!==F;)S=S.Prev;for(;A.Next.Pt.Y===A.Pt.Y&&A.Next!==S&&A.Next!==F;)A=A.Next;if(A.Next===S||A.Next===F)return!1;for(Z=F;F.Prev.Pt.Y===F.Pt.Y&&F.Prev!==Z&&F.Prev!==A;)F=F.Prev;for(;Z.Next.Pt.Y===Z.Pt.Y&&Z.Next!==F&&Z.Next!==S;)Z=Z.Next;if(Z.Next===F||Z.Next===S)return!1;var St={Left:null,Right:null};if(!this.GetOverlap(S.Pt.X,A.Pt.X,F.Pt.X,Z.Pt.X,St))return!1;var Ot=St.Left,$t=St.Right,jt=new s.IntPoint0,ue;return S.Pt.X>=Ot&&S.Pt.X<=$t?(jt.X=S.Pt.X,jt.Y=S.Pt.Y,s.use_xyz&&(jt.Z=S.Pt.Z),ue=S.Pt.X>A.Pt.X):F.Pt.X>=Ot&&F.Pt.X<=$t?(jt.X=F.Pt.X,jt.Y=F.Pt.Y,s.use_xyz&&(jt.Z=F.Pt.Z),ue=F.Pt.X>Z.Pt.X):A.Pt.X>=Ot&&A.Pt.X<=$t?(jt.X=A.Pt.X,jt.Y=A.Pt.Y,s.use_xyz&&(jt.Z=A.Pt.Z),ue=A.Pt.X>S.Pt.X):(jt.X=Z.Pt.X,jt.Y=Z.Pt.Y,s.use_xyz&&(jt.Z=Z.Pt.Z),ue=Z.Pt.X>F.Pt.X),h.OutPt1=S,h.OutPt2=F,this.JoinHorz(S,A,F,Z,jt,ue)}else{for(A=S.Next;s.IntPoint.op_Equality(A.Pt,S.Pt)&&A!==S;)A=A.Next;var ee=A.Pt.Y>S.Pt.Y||!s.ClipperBase.SlopesEqual4(S.Pt,A.Pt,h.OffPt,this.m_UseFullRange);if(ee){for(A=S.Prev;s.IntPoint.op_Equality(A.Pt,S.Pt)&&A!==S;)A=A.Prev;if(A.Pt.Y>S.Pt.Y||!s.ClipperBase.SlopesEqual4(S.Pt,A.Pt,h.OffPt,this.m_UseFullRange))return!1}for(Z=F.Next;s.IntPoint.op_Equality(Z.Pt,F.Pt)&&Z!==F;)Z=Z.Next;var Se=Z.Pt.Y>F.Pt.Y||!s.ClipperBase.SlopesEqual4(F.Pt,Z.Pt,h.OffPt,this.m_UseFullRange);if(Se){for(Z=F.Prev;s.IntPoint.op_Equality(Z.Pt,F.Pt)&&Z!==F;)Z=Z.Prev;if(Z.Pt.Y>F.Pt.Y||!s.ClipperBase.SlopesEqual4(F.Pt,Z.Pt,h.OffPt,this.m_UseFullRange))return!1}return A===S||Z===F||A===Z||p===_&&ee===Se?!1:ee?(A=this.DupOutPt(S,!1),Z=this.DupOutPt(F,!0),S.Prev=F,F.Next=S,A.Next=Z,Z.Prev=A,h.OutPt1=S,h.OutPt2=A,!0):(A=this.DupOutPt(S,!0),Z=this.DupOutPt(F,!1),S.Next=F,F.Prev=S,A.Prev=Z,Z.Next=A,h.OutPt1=S,h.OutPt2=A,!0)}},s.Clipper.GetBounds=function(h){for(var p=0,_=h.length;p<_&&h[p].length===0;)p++;if(p===_)return new s.IntRect(0,0,0,0);var S=new s.IntRect;for(S.left=h[p][0].X,S.right=S.left,S.top=h[p][0].Y,S.bottom=S.top;p<_;p++)for(var A=0,F=h[p].length;AS.right&&(S.right=h[p][A].X),h[p][A].YS.bottom&&(S.bottom=h[p][A].Y);return S},s.Clipper.prototype.GetBounds2=function(h){var p=h,_=new s.IntRect;for(_.left=h.Pt.X,_.right=h.Pt.X,_.top=h.Pt.Y,_.bottom=h.Pt.Y,h=h.Next;h!==p;)h.Pt.X<_.left&&(_.left=h.Pt.X),h.Pt.X>_.right&&(_.right=h.Pt.X),h.Pt.Y<_.top&&(_.top=h.Pt.Y),h.Pt.Y>_.bottom&&(_.bottom=h.Pt.Y),h=h.Next;return _},s.Clipper.PointInPolygon=function(h,p){var _=0,S=p.length;if(S<3)return 0;for(var A=p[0],F=1;F<=S;++F){var Z=F===S?p[0]:p[F];if(Z.Y===h.Y&&(Z.X===h.X||A.Y===h.Y&&Z.X>h.X==A.X=h.X)if(Z.X>h.X)_=1-_;else{var J=(A.X-h.X)*(Z.Y-h.Y)-(Z.X-h.X)*(A.Y-h.Y);if(J===0)return-1;J>0==Z.Y>A.Y&&(_=1-_)}else if(Z.X>h.X){var J=(A.X-h.X)*(Z.Y-h.Y)-(Z.X-h.X)*(A.Y-h.Y);if(J===0)return-1;J>0==Z.Y>A.Y&&(_=1-_)}}A=Z}return _},s.Clipper.prototype.PointInPolygon=function(h,p){var _=0,S=p,A=h.X,F=h.Y,Z=p.Pt.X,J=p.Pt.Y;do{p=p.Next;var K=p.Pt.X,lt=p.Pt.Y;if(lt===F&&(K===A||J===F&&K>A==Z=A)if(K>A)_=1-_;else{var St=(Z-A)*(lt-F)-(K-A)*(J-F);if(St===0)return-1;St>0==lt>J&&(_=1-_)}else if(K>A){var St=(Z-A)*(lt-F)-(K-A)*(J-F);if(St===0)return-1;St>0==lt>J&&(_=1-_)}}Z=K,J=lt}while(S!==p);return _},s.Clipper.prototype.Poly2ContainsPoly1=function(h,p){var _=h;do{var S=this.PointInPolygon(_.Pt,p);if(S>=0)return S>0;_=_.Next}while(_!==h);return!0},s.Clipper.prototype.FixupFirstLefts1=function(h,p){for(var _,S,A=0,F=this.m_PolyOuts.length;A0&&this.ReversePolyPtLinks(A.Pts)):this.Poly2ContainsPoly1(S.Pts,A.Pts)?(A.IsHole=S.IsHole,S.IsHole=!A.IsHole,A.FirstLeft=S.FirstLeft,S.FirstLeft=A,this.m_UsingPolyTree&&this.FixupFirstLefts2(S,A),(S.IsHole^this.ReverseSolution)==this.Area$1(S)>0&&this.ReversePolyPtLinks(S.Pts)):(A.IsHole=S.IsHole,A.FirstLeft=S.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(S,A))):(A.Pts=null,A.BottomPt=null,A.Idx=S.Idx,S.IsHole=F.IsHole,F===A&&(S.FirstLeft=A.FirstLeft),A.FirstLeft=S,this.m_UsingPolyTree&&this.FixupFirstLefts3(A,S)))}}},s.Clipper.prototype.UpdateOutPtIdxs=function(h){var p=h.Pts;do p.Idx=h.Idx,p=p.Prev;while(p!==h.Pts)},s.Clipper.prototype.DoSimplePolygons=function(){for(var h=0;h"u"&&(p=s.PolyFillType.pftEvenOdd);var _=new Array,S=new s.Clipper(0);return S.StrictlySimple=!0,S.AddPaths(h,s.PolyType.ptSubject,!0),S.Execute(s.ClipType.ctUnion,_,p,p),_},s.Clipper.DistanceSqrd=function(h,p){var _=h.X-p.X,S=h.Y-p.Y;return _*_+S*S},s.Clipper.DistanceFromLineSqrd=function(h,p,_){var S=p.Y-_.Y,A=_.X-p.X,F=S*p.X+A*p.Y;return F=S*h.X+A*h.Y-F,F*F/(S*S+A*A)},s.Clipper.SlopesNearCollinear=function(h,p,_,S){return Math.abs(h.X-p.X)>Math.abs(h.Y-p.Y)?h.X>p.X==h.X<_.X?s.Clipper.DistanceFromLineSqrd(h,p,_)h.X==p.X<_.X?s.Clipper.DistanceFromLineSqrd(p,h,_)p.Y==h.Y<_.Y?s.Clipper.DistanceFromLineSqrd(h,p,_)h.Y==p.Y<_.Y?s.Clipper.DistanceFromLineSqrd(p,h,_)"u"&&(p=1.415);var _=h.length;if(_===0)return new Array;for(var S=new Array(_),A=0;A<_;++A)S[A]=new s.OutPt;for(var A=0;A<_;++A)S[A].Pt=h[A],S[A].Next=S[(A+1)%_],S[A].Next.Prev=S[A],S[A].Idx=0;for(var F=p*p,Z=S[0];Z.Idx===0&&Z.Next!==Z.Prev;)s.Clipper.PointsAreClose(Z.Pt,Z.Prev.Pt,F)?(Z=s.Clipper.ExcludeOp(Z),_--):s.Clipper.PointsAreClose(Z.Prev.Pt,Z.Next.Pt,F)?(s.Clipper.ExcludeOp(Z.Next),Z=s.Clipper.ExcludeOp(Z),_-=2):s.Clipper.SlopesNearCollinear(Z.Prev.Pt,Z.Pt,Z.Next.Pt,F)?(Z=s.Clipper.ExcludeOp(Z),_--):(Z.Idx=1,Z=Z.Next);_<3&&(_=0);for(var J=new Array(_),A=0;A<_;++A)J[A]=new s.IntPoint1(Z.Pt),Z=Z.Next;return S=null,J},s.Clipper.CleanPolygons=function(h,p){for(var _=new Array(h.length),S=0,A=h.length;S0&&S&&_.push(h.m_polygon);for(var A=0,F=h.Childs(),Z=F.length,J=F[A];A"u"&&(h=2),typeof p>"u"&&(p=s.ClipperOffset.def_arc_tolerance),this.m_destPolys=new s.Paths,this.m_srcPoly=new s.Path,this.m_destPoly=new s.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new s.IntPoint0,this.m_polyNodes=new s.PolyNode,this.MiterLimit=h,this.ArcTolerance=p,this.m_lowest.X=-1},s.ClipperOffset.two_pi=6.28318530717959,s.ClipperOffset.def_arc_tolerance=.25,s.ClipperOffset.prototype.Clear=function(){s.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1},s.ClipperOffset.Round=s.Clipper.Round,s.ClipperOffset.prototype.AddPath=function(h,p,_){var S=h.length-1;if(!(S<0)){var A=new s.PolyNode;if(A.m_jointype=p,A.m_endtype=_,_===s.EndType.etClosedLine||_===s.EndType.etClosedPolygon)for(;S>0&&s.IntPoint.op_Equality(h[0],h[S]);)S--;A.m_polygon.push(h[0]);for(var F=0,Z=0,J=1;J<=S;J++)s.IntPoint.op_Inequality(A.m_polygon[F],h[J])&&(F++,A.m_polygon.push(h[J]),(h[J].Y>A.m_polygon[Z].Y||h[J].Y===A.m_polygon[Z].Y&&h[J].XK.Y||A.m_polygon[Z].Y===K.Y&&A.m_polygon[Z].X=0&&!s.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var h=0;h2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var S;this.ArcTolerance<=0?S=s.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(h)*s.ClipperOffset.def_arc_tolerance?S=Math.abs(h)*s.ClipperOffset.def_arc_tolerance:S=this.ArcTolerance;var A=3.14159265358979/Math.acos(1-S/Math.abs(h));this.m_sin=Math.sin(s.ClipperOffset.two_pi/A),this.m_cos=Math.cos(s.ClipperOffset.two_pi/A),this.m_StepsPerRad=A/s.ClipperOffset.two_pi,h<0&&(this.m_sin=-this.m_sin);for(var p=0;p0;K--)this.m_normals[K]=new s.DoublePoint2(-this.m_normals[K-1].X,-this.m_normals[K-1].Y);this.m_normals[0]=new s.DoublePoint2(-Ot.X,-Ot.Y),St=0;for(var K=F-1;K>=0;K--)St=this.OffsetPoint(K,St,_.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var St=0,K=1;K0;K--)this.m_normals[K]=new s.DoublePoint2(-this.m_normals[K-1].X,-this.m_normals[K-1].Y);this.m_normals[0]=new s.DoublePoint2(-this.m_normals[1].X,-this.m_normals[1].Y),St=F-1;for(var K=St-1;K>0;--K)St=this.OffsetPoint(K,St,_.m_jointype);_.m_endtype===s.EndType.etOpenButt?($t=new s.IntPoint2(s.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*h),s.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*h)),this.m_destPoly.push($t),$t=new s.IntPoint2(s.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*h),s.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*h)),this.m_destPoly.push($t)):(St=1,this.m_sinA=0,_.m_endtype===s.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}},s.ClipperOffset.prototype.Execute=function(){var h=arguments,p=h[0]instanceof s.PolyTree;if(p){var _=h[0],S=h[1];_.Clear(),this.FixOrientations(),this.DoOffset(S);var A=new s.Clipper(0);if(A.AddPaths(this.m_destPolys,s.PolyType.ptSubject,!0),S>0)A.Execute(s.ClipType.ctUnion,_,s.PolyFillType.pftPositive,s.PolyFillType.pftPositive);else{var F=s.Clipper.GetBounds(this.m_destPolys),Z=new s.Path;if(Z.push(new s.IntPoint2(F.left-10,F.bottom+10)),Z.push(new s.IntPoint2(F.right+10,F.bottom+10)),Z.push(new s.IntPoint2(F.right+10,F.top-10)),Z.push(new s.IntPoint2(F.left-10,F.top-10)),A.AddPath(Z,s.PolyType.ptSubject,!0),A.ReverseSolution=!0,A.Execute(s.ClipType.ctUnion,_,s.PolyFillType.pftNegative,s.PolyFillType.pftNegative),_.ChildCount()===1&&_.Childs()[0].ChildCount()>0){var J=_.Childs()[0];_.Childs()[0]=J.Childs()[0],_.Childs()[0].m_Parent=_;for(var K=1;K0)A.Execute(s.ClipType.ctUnion,_,s.PolyFillType.pftPositive,s.PolyFillType.pftPositive);else{var F=s.Clipper.GetBounds(this.m_destPolys),Z=new s.Path;Z.push(new s.IntPoint2(F.left-10,F.bottom+10)),Z.push(new s.IntPoint2(F.right+10,F.bottom+10)),Z.push(new s.IntPoint2(F.right+10,F.top-10)),Z.push(new s.IntPoint2(F.left-10,F.top-10)),A.AddPath(Z,s.PolyType.ptSubject,!0),A.ReverseSolution=!0,A.Execute(s.ClipType.ctUnion,_,s.PolyFillType.pftNegative,s.PolyFillType.pftNegative),_.length>0&&_.splice(0,1)}}},s.ClipperOffset.prototype.OffsetPoint=function(h,p,_){if(this.m_sinA=this.m_normals[p].X*this.m_normals[h].Y-this.m_normals[h].X*this.m_normals[p].Y,Math.abs(this.m_sinA*this.m_delta)<1){var S=this.m_normals[p].X*this.m_normals[h].X+this.m_normals[h].Y*this.m_normals[p].Y;if(S>0)return this.m_destPoly.push(new s.IntPoint2(s.ClipperOffset.Round(this.m_srcPoly[h].X+this.m_normals[p].X*this.m_delta),s.ClipperOffset.Round(this.m_srcPoly[h].Y+this.m_normals[p].Y*this.m_delta))),p}else this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1);if(this.m_sinA*this.m_delta<0)this.m_destPoly.push(new s.IntPoint2(s.ClipperOffset.Round(this.m_srcPoly[h].X+this.m_normals[p].X*this.m_delta),s.ClipperOffset.Round(this.m_srcPoly[h].Y+this.m_normals[p].Y*this.m_delta))),this.m_destPoly.push(new s.IntPoint1(this.m_srcPoly[h])),this.m_destPoly.push(new s.IntPoint2(s.ClipperOffset.Round(this.m_srcPoly[h].X+this.m_normals[h].X*this.m_delta),s.ClipperOffset.Round(this.m_srcPoly[h].Y+this.m_normals[h].Y*this.m_delta)));else switch(_){case s.JoinType.jtMiter:{var A=1+(this.m_normals[h].X*this.m_normals[p].X+this.m_normals[h].Y*this.m_normals[p].Y);A>=this.m_miterLim?this.DoMiter(h,p,A):this.DoSquare(h,p);break}case s.JoinType.jtSquare:this.DoSquare(h,p);break;case s.JoinType.jtRound:this.DoRound(h,p);break}return p=h,p},s.ClipperOffset.prototype.DoSquare=function(h,p){var _=Math.tan(Math.atan2(this.m_sinA,this.m_normals[p].X*this.m_normals[h].X+this.m_normals[p].Y*this.m_normals[h].Y)/4);this.m_destPoly.push(new s.IntPoint2(s.ClipperOffset.Round(this.m_srcPoly[h].X+this.m_delta*(this.m_normals[p].X-this.m_normals[p].Y*_)),s.ClipperOffset.Round(this.m_srcPoly[h].Y+this.m_delta*(this.m_normals[p].Y+this.m_normals[p].X*_)))),this.m_destPoly.push(new s.IntPoint2(s.ClipperOffset.Round(this.m_srcPoly[h].X+this.m_delta*(this.m_normals[h].X+this.m_normals[h].Y*_)),s.ClipperOffset.Round(this.m_srcPoly[h].Y+this.m_delta*(this.m_normals[h].Y-this.m_normals[h].X*_))))},s.ClipperOffset.prototype.DoMiter=function(h,p,_){var S=this.m_delta/_;this.m_destPoly.push(new s.IntPoint2(s.ClipperOffset.Round(this.m_srcPoly[h].X+(this.m_normals[p].X+this.m_normals[h].X)*S),s.ClipperOffset.Round(this.m_srcPoly[h].Y+(this.m_normals[p].Y+this.m_normals[h].Y)*S)))},s.ClipperOffset.prototype.DoRound=function(h,p){for(var _=Math.atan2(this.m_sinA,this.m_normals[p].X*this.m_normals[h].X+this.m_normals[p].Y*this.m_normals[h].Y),S=Math.max(s.Cast_Int32(s.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(_))),1),A=this.m_normals[p].X,F=this.m_normals[p].Y,Z,J=0;J1?(Fi=St.X,Fn=St.Y):ci>0&&(Fi+=ee*ci,Fn+=Se*ci)),ee=Ot.X-Fi,Se=Ot.Y-Fn,$t=ee*ee+Se*Se,$t<=fh&&(jt[A+1]=1,A++);for(J.push({X:F[0].X,Y:F[0].Y}),A=1;A2&&Sn.push(J)}return _||(Sn=Sn[0]),typeof Sn>"u"&&(Sn=[]),Sn},s.JS.PerimeterOfPath=function(h,p,_){if(typeof h>"u")return 0;var S=Math.sqrt,A=0,F,Z,J=0,K=0,lt=0,St=0,Ot=h.length;if(Ot<2)return 0;for(p&&(h[Ot]=h[0],Ot++);--Ot;)F=h[Ot],J=F.X,K=F.Y,Z=h[Ot-1],lt=Z.X,St=Z.Y,A+=S((J-lt)*(J-lt)+(K-St)*(K-St));return p&&h.pop(),A/_},s.JS.PerimeterOfPaths=function(h,p,_){_||(_=1);for(var S=0,A=0;A0}},{key:"fixOrientation",value:function(){return this.closed?(this.totalArea()<0&&this.reverse(),this):this}},{key:"removeOverlap",value:function(){console.warn("Shape.removeOverlap is being depricated, use Shape.simplify('pftNonZero') instead"),this.simplify("pftNonZero")}},{key:"simplify",value:function(U){if(this.closed){var T=d.default.Clipper.SimplifyPolygons(this.paths,d.default.PolyFillType[U]);return new z(T,!0)}else return this}},{key:"seperateShapes",value:function(){var U=this,T=[];if(this.closed)(function(){for(var nt=new WeakMap,it=[],It=[],kt=0;kt1e-8>Math.abs(i[0]-t[0])+Math.abs(i[1]-t[1]);function j0(i,t,e={}){let{endType:n,jointType:r="jtRound",miterLimit:o=2,roundPrecision:s=.25}=e;if(!n){const f=i[0][0],g=i.at(-1).at(-1);n=F1(f,g)?"etClosedRound":"etOpenRound"}const{data:a,scale:l}=Y1(i,t),c=new B1(a,!0).offset(t*l,{jointType:r,endType:n,miterLimit:o,roundPrecision:s}),d=Z1(c,l);for(;i.length>d.length;)i.pop();return d.forEach((f,g)=>{i[g]=f}),i}const X1=(i,t)=>{const e={};return e.X=Math.round(i[0]*t),e.Y=Math.round(i[1]*t),e},R1=(i,t)=>Math.sqrt((t[0]-i[0])**2+(t[1]-i[1])**2);function Y1(i,t){const e=[],n=i.flat();for(let s=0;ss.map(l=>X1(l,r))),scale:r}}function Z1(i,t){return Object.values(i.paths).map(n=>(n=n.map(({X:r,Y:o})=>[r/t,o/t]),[...n,n[0]],[...n,n[0]]))}function yo(i,t,e){const n=f=>f.map(([g,x])=>({X:g,Y:x})),r=f=>f.map(({X:g,Y:x})=>[g,x]),a=i.map(n);t=t.map(n);const l=new P.Paths,u=new P.Clipper;u.AddPaths(a,P.PolyType.ptSubject,!0),u.AddPaths(t,P.PolyType.ptClip,!0);const c={intersection:P.ClipType.ctIntersection,union:P.ClipType.ctUnion,difference:P.ClipType.ctDifference,xor:P.ClipType.ctXor};u.Execute(c[e],l);const d=l.map(r);for(;i.length>d.length;)i.pop();return d.forEach((f,g)=>{i[g]=f,i[g].push([f[0][0],f[0][1]])}),i}// @license +*/(function(i,t){(function(e){i.exports=e()})(function(){return function e(n,r,o){function s(u,c){if(!r[u]){if(!n[u]){var d=typeof Xo=="function"&&Xo;if(!c&&d)return d(u,!0);if(a)return a(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var g=r[u]={exports:{}};n[u][0].call(g.exports,function(x){var m=n[u][1][x];return s(m||x)},g,g.exports,e,n,r,o)}return r[u].exports}for(var a=typeof Xo=="function"&&Xo,l=0;l>2,g=(3&u)<<4|c>>4,x=1>6:64,m=2>4,c=(15&f)<<4|(g=a.indexOf(l.charAt(m++)))>>2,d=(3&g)<<6|(x=a.indexOf(l.charAt(m++))),b[v++]=u,g!==64&&(b[v++]=c),x!==64&&(b[v++]=d);return b}},{"./support":30,"./utils":32}],2:[function(e,n,r){var o=e("./external"),s=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),l=e("./stream/DataLengthProbe");function u(c,d,f,g,x){this.compressedSize=c,this.uncompressedSize=d,this.crc32=f,this.compression=g,this.compressedContent=x}u.prototype={getContentWorker:function(){var c=new s(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),d=this;return c.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),c},getCompressedWorker:function(){return new s(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(c,d,f){return c.pipe(new a).pipe(new l("uncompressedSize")).pipe(d.compressWorker(f)).pipe(new l("compressedSize")).withStreamInfo("compression",d)},n.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,n,r){var o=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,n,r){var o=e("./utils"),s=function(){for(var a,l=[],u=0;u<256;u++){a=u;for(var c=0;c<8;c++)a=1&a?3988292384^a>>>1:a>>>1;l[u]=a}return l}();n.exports=function(a,l){return a!==void 0&&a.length?o.getTypeOf(a)!=="string"?function(u,c,d,f){var g=s,x=f+d;u^=-1;for(var m=f;m>>8^g[255&(u^c[m])];return-1^u}(0|l,a,a.length,0):function(u,c,d,f){var g=s,x=f+d;u^=-1;for(var m=f;m>>8^g[255&(u^c.charCodeAt(m))];return-1^u}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(e,n,r){r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,n,r){var o=null;o=typeof Promise<"u"?Promise:e("lie"),n.exports={Promise:o}},{lie:37}],7:[function(e,n,r){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=e("pako"),a=e("./utils"),l=e("./stream/GenericWorker"),u=o?"uint8array":"array";function c(d,f){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=f,this.meta={}}r.magic="\b\0",a.inherits(c,l),c.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,d.data),!1)},c.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(f){d.push({data:f,meta:d.meta})}},r.compressWorker=function(d){return new c("Deflate",d)},r.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,n,r){function o(g,x){var m,v="";for(m=0;m>>=8;return v}function s(g,x,m,v,O,b){var k,E,$=g.file,Q=g.compression,X=b!==u.utf8encode,R=a.transformTo("string",b($.name)),W=a.transformTo("string",u.utf8encode($.name)),D=$.comment,z=a.transformTo("string",b(D)),N=a.transformTo("string",u.utf8encode(D)),U=W.length!==$.name.length,T=N.length!==D.length,H="",gt="",at="",Et=$.dir,pt=$.date,Pt={crc32:0,compressedSize:0,uncompressedSize:0};x&&!m||(Pt.crc32=g.crc32,Pt.compressedSize=g.compressedSize,Pt.uncompressedSize=g.uncompressedSize);var nt=0;x&&(nt|=8),X||!U&&!T||(nt|=2048);var it=0,It=0;Et&&(it|=16),O==="UNIX"?(It=798,it|=function(xt,Kt){var Ct=xt;return xt||(Ct=Kt?16893:33204),(65535&Ct)<<16}($.unixPermissions,Et)):(It=20,it|=function(xt){return 63&(xt||0)}($.dosPermissions)),k=pt.getUTCHours(),k<<=6,k|=pt.getUTCMinutes(),k<<=5,k|=pt.getUTCSeconds()/2,E=pt.getUTCFullYear()-1980,E<<=4,E|=pt.getUTCMonth()+1,E<<=5,E|=pt.getUTCDate(),U&&(gt=o(1,1)+o(c(R),4)+W,H+="up"+o(gt.length,2)+gt),T&&(at=o(1,1)+o(c(z),4)+N,H+="uc"+o(at.length,2)+at);var kt="";return kt+=` +\0`,kt+=o(nt,2),kt+=Q.magic,kt+=o(k,2),kt+=o(E,2),kt+=o(Pt.crc32,4),kt+=o(Pt.compressedSize,4),kt+=o(Pt.uncompressedSize,4),kt+=o(R.length,2),kt+=o(H.length,2),{fileRecord:d.LOCAL_FILE_HEADER+kt+R+H,dirRecord:d.CENTRAL_FILE_HEADER+o(It,2)+kt+o(z.length,2)+"\0\0\0\0"+o(it,4)+o(v,4)+R+H+z}}var a=e("../utils"),l=e("../stream/GenericWorker"),u=e("../utf8"),c=e("../crc32"),d=e("../signature");function f(g,x,m,v){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=x,this.zipPlatform=m,this.encodeFileName=v,this.streamFiles=g,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(f,l),f.prototype.push=function(g){var x=g.meta.percent||0,m=this.entriesCount,v=this._sources.length;this.accumulate?this.contentBuffer.push(g):(this.bytesWritten+=g.data.length,l.prototype.push.call(this,{data:g.data,meta:{currentFile:this.currentFile,percent:m?(x+100*(m-v-1))/m:100}}))},f.prototype.openedSource=function(g){this.currentSourceOffset=this.bytesWritten,this.currentFile=g.file.name;var x=this.streamFiles&&!g.file.dir;if(x){var m=s(g,x,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(g){this.accumulate=!1;var x=this.streamFiles&&!g.file.dir,m=s(g,x,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),x)this.push({data:function(v){return d.DATA_DESCRIPTOR+o(v.crc32,4)+o(v.compressedSize,4)+o(v.uncompressedSize,4)}(g),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var g=this.bytesWritten,x=0;x=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return o.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},n.exports=s},{"../utils":32}],19:[function(e,n,r){var o=e("./Uint8ArrayReader");function s(a){o.call(this,a)}e("../utils").inherits(s,o),s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,n,r){var o=e("./DataReader");function s(a){o.call(this,a)}e("../utils").inherits(s,o),s.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},s.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},s.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=s},{"../utils":32,"./DataReader":18}],21:[function(e,n,r){var o=e("./ArrayReader");function s(a){o.call(this,a)}e("../utils").inherits(s,o),s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(e,n,r){var o=e("../utils"),s=e("../support"),a=e("./ArrayReader"),l=e("./StringReader"),u=e("./NodeBufferReader"),c=e("./Uint8ArrayReader");n.exports=function(d){var f=o.getTypeOf(d);return o.checkSupport(f),f!=="string"||s.uint8array?f==="nodebuffer"?new u(d):s.uint8array?new c(o.transformTo("uint8array",d)):new a(o.transformTo("array",d)):new l(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,n,r){r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(e,n,r){var o=e("./GenericWorker"),s=e("../utils");function a(l){o.call(this,"ConvertWorker to "+l),this.destType=l}s.inherits(a,o),a.prototype.processChunk=function(l){this.push({data:s.transformTo(this.destType,l.data),meta:l.meta})},n.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,n,r){var o=e("./GenericWorker"),s=e("../crc32");function a(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(a,o),a.prototype.processChunk=function(l){this.streamInfo.crc32=s(l.data,this.streamInfo.crc32||0),this.push(l)},n.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,n,r){var o=e("../utils"),s=e("./GenericWorker");function a(l){s.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}o.inherits(a,s),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}s.prototype.processChunk.call(this,l)},n.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,n,r){var o=e("../utils"),s=e("./GenericWorker");function a(l){s.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(c){u.dataIsReady=!0,u.data=c,u.max=c&&c.length||0,u.type=o.getTypeOf(c),u.isPaused||u._tickAndRepeat()},function(c){u.error(c)})}o.inherits(a,s),a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,n,r){function o(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,a){return this._listeners[s].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,a){if(this._listeners[s])for(var l=0;l "+s:s}},n.exports=o},{}],29:[function(e,n,r){var o=e("../utils"),s=e("./ConvertWorker"),a=e("./GenericWorker"),l=e("../base64"),u=e("../support"),c=e("../external"),d=null;if(u.nodestream)try{d=e("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(x,m){return new c.Promise(function(v,O){var b=[],k=x._internalType,E=x._outputType,$=x._mimeType;x.on("data",function(Q,X){b.push(Q),m&&m(X)}).on("error",function(Q){b=[],O(Q)}).on("end",function(){try{var Q=function(X,R,W){switch(X){case"blob":return o.newBlob(o.transformTo("arraybuffer",R),W);case"base64":return l.encode(R);default:return o.transformTo(X,R)}}(E,function(X,R){var W,D=0,z=null,N=0;for(W=0;W"u")r.blob=!1;else{var o=new ArrayBuffer(0);try{r.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(o),r.blob=s.getBlob("application/zip").size===0}catch{r.blob=!1}}}try{r.nodestream=!!e("readable-stream").Readable}catch{r.nodestream=!1}},{"readable-stream":16}],31:[function(e,n,r){for(var o=e("./utils"),s=e("./support"),a=e("./nodejsUtils"),l=e("./stream/GenericWorker"),u=new Array(256),c=0;c<256;c++)u[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;u[254]=u[254]=1;function d(){l.call(this,"utf-8 decode"),this.leftOver=null}function f(){l.call(this,"utf-8 encode")}r.utf8encode=function(g){return s.nodebuffer?a.newBufferFrom(g,"utf-8"):function(x){var m,v,O,b,k,E=x.length,$=0;for(b=0;b>>6:(v<65536?m[k++]=224|v>>>12:(m[k++]=240|v>>>18,m[k++]=128|v>>>12&63),m[k++]=128|v>>>6&63),m[k++]=128|63&v);return m}(g)},r.utf8decode=function(g){return s.nodebuffer?o.transformTo("nodebuffer",g).toString("utf-8"):function(x){var m,v,O,b,k=x.length,E=new Array(2*k);for(m=v=0;m>10&1023,E[v++]=56320|1023&O)}return E.length!==v&&(E.subarray?E=E.subarray(0,v):E.length=v),o.applyFromCharCode(E)}(g=o.transformTo(s.uint8array?"uint8array":"array",g))},o.inherits(d,l),d.prototype.processChunk=function(g){var x=o.transformTo(s.uint8array?"uint8array":"array",g.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var m=x;(x=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),x.set(m,this.leftOver.length)}else x=this.leftOver.concat(x);this.leftOver=null}var v=function(b,k){var E;for((k=k||b.length)>b.length&&(k=b.length),E=k-1;0<=E&&(192&b[E])==128;)E--;return E<0||E===0?k:E+u[b[E]]>k?E:k}(x),O=x;v!==x.length&&(s.uint8array?(O=x.subarray(0,v),this.leftOver=x.subarray(v,x.length)):(O=x.slice(0,v),this.leftOver=x.slice(v,x.length))),this.push({data:r.utf8decode(O),meta:g.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=d,o.inherits(f,l),f.prototype.processChunk=function(g){this.push({data:r.utf8encode(g.data),meta:g.meta})},r.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,n,r){var o=e("./support"),s=e("./base64"),a=e("./nodejsUtils"),l=e("./external");function u(m){return m}function c(m,v){for(var O=0;O>8;this.dir=!!(16&this.externalFileAttributes),g==0&&(this.dosPermissions=63&this.externalFileAttributes),g==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var g=o(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=g.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=g.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=g.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=g.readInt(4))}},readExtraFields:function(g){var x,m,v,O=g.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});g.index+4>>6:(g<65536?f[v++]=224|g>>>12:(f[v++]=240|g>>>18,f[v++]=128|g>>>12&63),f[v++]=128|g>>>6&63),f[v++]=128|63&g);return f},r.buf2binstring=function(d){return c(d,d.length)},r.binstring2buf=function(d){for(var f=new o.Buf8(d.length),g=0,x=f.length;g>10&1023,b[x++]=56320|1023&m)}return c(b,x)},r.utf8border=function(d,f){var g;for((f=f||d.length)>d.length&&(f=d.length),g=f-1;0<=g&&(192&d[g])==128;)g--;return g<0||g===0?f:g+l[d[g]]>f?g:f}},{"./common":41}],43:[function(e,n,r){n.exports=function(o,s,a,l){for(var u=65535&o|0,c=o>>>16&65535|0,d=0;a!==0;){for(a-=d=2e3>>1:s>>>1;a[l]=s}return a}();n.exports=function(s,a,l,u){var c=o,d=u+l;s^=-1;for(var f=u;f>>8^c[255&(s^a[f])];return-1^s}},{}],46:[function(e,n,r){var o,s=e("../utils/common"),a=e("./trees"),l=e("./adler32"),u=e("./crc32"),c=e("./messages"),d=0,f=4,g=0,x=-2,m=-1,v=4,O=2,b=8,k=9,E=286,$=30,Q=19,X=2*E+1,R=15,W=3,D=258,z=D+W+1,N=42,U=113,T=1,H=2,gt=3,at=4;function Et(B,ut){return B.msg=c[ut],ut}function pt(B){return(B<<1)-(4B.avail_out&&(ft=B.avail_out),ft!==0&&(s.arraySet(B.output,ut.pending_buf,ut.pending_out,ft,B.next_out),B.next_out+=ft,ut.pending_out+=ft,B.total_out+=ft,B.avail_out-=ft,ut.pending-=ft,ut.pending===0&&(ut.pending_out=0))}function it(B,ut){a._tr_flush_block(B,0<=B.block_start?B.block_start:-1,B.strstart-B.block_start,ut),B.block_start=B.strstart,nt(B.strm)}function It(B,ut){B.pending_buf[B.pending++]=ut}function kt(B,ut){B.pending_buf[B.pending++]=ut>>>8&255,B.pending_buf[B.pending++]=255&ut}function xt(B,ut){var ft,G,V=B.max_chain_length,rt=B.strstart,bt=B.prev_length,wt=B.nice_match,ot=B.strstart>B.w_size-z?B.strstart-(B.w_size-z):0,Dt=B.window,Xt=B.w_mask,Tt=B.prev,qt=B.strstart+D,fe=Dt[rt+bt-1],ae=Dt[rt+bt];B.prev_length>=B.good_match&&(V>>=2),wt>B.lookahead&&(wt=B.lookahead);do if(Dt[(ft=ut)+bt]===ae&&Dt[ft+bt-1]===fe&&Dt[ft]===Dt[rt]&&Dt[++ft]===Dt[rt+1]){rt+=2,ft++;do;while(Dt[++rt]===Dt[++ft]&&Dt[++rt]===Dt[++ft]&&Dt[++rt]===Dt[++ft]&&Dt[++rt]===Dt[++ft]&&Dt[++rt]===Dt[++ft]&&Dt[++rt]===Dt[++ft]&&Dt[++rt]===Dt[++ft]&&Dt[++rt]===Dt[++ft]&&rtot&&--V!=0);return bt<=B.lookahead?bt:B.lookahead}function Kt(B){var ut,ft,G,V,rt,bt,wt,ot,Dt,Xt,Tt=B.w_size;do{if(V=B.window_size-B.lookahead-B.strstart,B.strstart>=Tt+(Tt-z)){for(s.arraySet(B.window,B.window,Tt,Tt,0),B.match_start-=Tt,B.strstart-=Tt,B.block_start-=Tt,ut=ft=B.hash_size;G=B.head[--ut],B.head[ut]=Tt<=G?G-Tt:0,--ft;);for(ut=ft=Tt;G=B.prev[--ut],B.prev[ut]=Tt<=G?G-Tt:0,--ft;);V+=Tt}if(B.strm.avail_in===0)break;if(bt=B.strm,wt=B.window,ot=B.strstart+B.lookahead,Dt=V,Xt=void 0,Xt=bt.avail_in,Dt=W)for(rt=B.strstart-B.insert,B.ins_h=B.window[rt],B.ins_h=(B.ins_h<=W&&(B.ins_h=(B.ins_h<=W)if(G=a._tr_tally(B,B.strstart-B.match_start,B.match_length-W),B.lookahead-=B.match_length,B.match_length<=B.max_lazy_match&&B.lookahead>=W){for(B.match_length--;B.strstart++,B.ins_h=(B.ins_h<=W&&(B.ins_h=(B.ins_h<=W&&B.match_length<=B.prev_length){for(V=B.strstart+B.lookahead-W,G=a._tr_tally(B,B.strstart-1-B.prev_match,B.prev_length-W),B.lookahead-=B.prev_length-1,B.prev_length-=2;++B.strstart<=V&&(B.ins_h=(B.ins_h<B.pending_buf_size-5&&(ft=B.pending_buf_size-5);;){if(B.lookahead<=1){if(Kt(B),B.lookahead===0&&ut===d)return T;if(B.lookahead===0)break}B.strstart+=B.lookahead,B.lookahead=0;var G=B.block_start+ft;if((B.strstart===0||B.strstart>=G)&&(B.lookahead=B.strstart-G,B.strstart=G,it(B,!1),B.strm.avail_out===0)||B.strstart-B.block_start>=B.w_size-z&&(it(B,!1),B.strm.avail_out===0))return T}return B.insert=0,ut===f?(it(B,!0),B.strm.avail_out===0?gt:at):(B.strstart>B.block_start&&(it(B,!1),B.strm.avail_out),T)}),new Yt(4,4,8,4,Ct),new Yt(4,5,16,8,Ct),new Yt(4,6,32,32,Ct),new Yt(4,4,16,16,Wt),new Yt(8,16,32,32,Wt),new Yt(8,16,128,128,Wt),new Yt(8,32,128,256,Wt),new Yt(32,128,258,1024,Wt),new Yt(32,258,258,4096,Wt)],r.deflateInit=function(B,ut){return oe(B,ut,b,15,8,0)},r.deflateInit2=oe,r.deflateReset=xe,r.deflateResetKeep=Jt,r.deflateSetHeader=function(B,ut){return B&&B.state?B.state.wrap!==2?x:(B.state.gzhead=ut,g):x},r.deflate=function(B,ut){var ft,G,V,rt;if(!B||!B.state||5>8&255),It(G,G.gzhead.time>>16&255),It(G,G.gzhead.time>>24&255),It(G,G.level===9?2:2<=G.strategy||G.level<2?4:0),It(G,255&G.gzhead.os),G.gzhead.extra&&G.gzhead.extra.length&&(It(G,255&G.gzhead.extra.length),It(G,G.gzhead.extra.length>>8&255)),G.gzhead.hcrc&&(B.adler=u(B.adler,G.pending_buf,G.pending,0)),G.gzindex=0,G.status=69):(It(G,0),It(G,0),It(G,0),It(G,0),It(G,0),It(G,G.level===9?2:2<=G.strategy||G.level<2?4:0),It(G,3),G.status=U);else{var bt=b+(G.w_bits-8<<4)<<8;bt|=(2<=G.strategy||G.level<2?0:G.level<6?1:G.level===6?2:3)<<6,G.strstart!==0&&(bt|=32),bt+=31-bt%31,G.status=U,kt(G,bt),G.strstart!==0&&(kt(G,B.adler>>>16),kt(G,65535&B.adler)),B.adler=1}if(G.status===69)if(G.gzhead.extra){for(V=G.pending;G.gzindex<(65535&G.gzhead.extra.length)&&(G.pending!==G.pending_buf_size||(G.gzhead.hcrc&&G.pending>V&&(B.adler=u(B.adler,G.pending_buf,G.pending-V,V)),nt(B),V=G.pending,G.pending!==G.pending_buf_size));)It(G,255&G.gzhead.extra[G.gzindex]),G.gzindex++;G.gzhead.hcrc&&G.pending>V&&(B.adler=u(B.adler,G.pending_buf,G.pending-V,V)),G.gzindex===G.gzhead.extra.length&&(G.gzindex=0,G.status=73)}else G.status=73;if(G.status===73)if(G.gzhead.name){V=G.pending;do{if(G.pending===G.pending_buf_size&&(G.gzhead.hcrc&&G.pending>V&&(B.adler=u(B.adler,G.pending_buf,G.pending-V,V)),nt(B),V=G.pending,G.pending===G.pending_buf_size)){rt=1;break}rt=G.gzindexV&&(B.adler=u(B.adler,G.pending_buf,G.pending-V,V)),rt===0&&(G.gzindex=0,G.status=91)}else G.status=91;if(G.status===91)if(G.gzhead.comment){V=G.pending;do{if(G.pending===G.pending_buf_size&&(G.gzhead.hcrc&&G.pending>V&&(B.adler=u(B.adler,G.pending_buf,G.pending-V,V)),nt(B),V=G.pending,G.pending===G.pending_buf_size)){rt=1;break}rt=G.gzindexV&&(B.adler=u(B.adler,G.pending_buf,G.pending-V,V)),rt===0&&(G.status=103)}else G.status=103;if(G.status===103&&(G.gzhead.hcrc?(G.pending+2>G.pending_buf_size&&nt(B),G.pending+2<=G.pending_buf_size&&(It(G,255&B.adler),It(G,B.adler>>8&255),B.adler=0,G.status=U)):G.status=U),G.pending!==0){if(nt(B),B.avail_out===0)return G.last_flush=-1,g}else if(B.avail_in===0&&pt(ut)<=pt(ft)&&ut!==f)return Et(B,-5);if(G.status===666&&B.avail_in!==0)return Et(B,-5);if(B.avail_in!==0||G.lookahead!==0||ut!==d&&G.status!==666){var wt=G.strategy===2?function(ot,Dt){for(var Xt;;){if(ot.lookahead===0&&(Kt(ot),ot.lookahead===0)){if(Dt===d)return T;break}if(ot.match_length=0,Xt=a._tr_tally(ot,0,ot.window[ot.strstart]),ot.lookahead--,ot.strstart++,Xt&&(it(ot,!1),ot.strm.avail_out===0))return T}return ot.insert=0,Dt===f?(it(ot,!0),ot.strm.avail_out===0?gt:at):ot.last_lit&&(it(ot,!1),ot.strm.avail_out===0)?T:H}(G,ut):G.strategy===3?function(ot,Dt){for(var Xt,Tt,qt,fe,ae=ot.window;;){if(ot.lookahead<=D){if(Kt(ot),ot.lookahead<=D&&Dt===d)return T;if(ot.lookahead===0)break}if(ot.match_length=0,ot.lookahead>=W&&0ot.lookahead&&(ot.match_length=ot.lookahead)}if(ot.match_length>=W?(Xt=a._tr_tally(ot,1,ot.match_length-W),ot.lookahead-=ot.match_length,ot.strstart+=ot.match_length,ot.match_length=0):(Xt=a._tr_tally(ot,0,ot.window[ot.strstart]),ot.lookahead--,ot.strstart++),Xt&&(it(ot,!1),ot.strm.avail_out===0))return T}return ot.insert=0,Dt===f?(it(ot,!0),ot.strm.avail_out===0?gt:at):ot.last_lit&&(it(ot,!1),ot.strm.avail_out===0)?T:H}(G,ut):o[G.level].func(G,ut);if(wt!==gt&&wt!==at||(G.status=666),wt===T||wt===gt)return B.avail_out===0&&(G.last_flush=-1),g;if(wt===H&&(ut===1?a._tr_align(G):ut!==5&&(a._tr_stored_block(G,0,0,!1),ut===3&&(Pt(G.head),G.lookahead===0&&(G.strstart=0,G.block_start=0,G.insert=0))),nt(B),B.avail_out===0))return G.last_flush=-1,g}return ut!==f?g:G.wrap<=0?1:(G.wrap===2?(It(G,255&B.adler),It(G,B.adler>>8&255),It(G,B.adler>>16&255),It(G,B.adler>>24&255),It(G,255&B.total_in),It(G,B.total_in>>8&255),It(G,B.total_in>>16&255),It(G,B.total_in>>24&255)):(kt(G,B.adler>>>16),kt(G,65535&B.adler)),nt(B),0=ft.w_size&&(rt===0&&(Pt(ft.head),ft.strstart=0,ft.block_start=0,ft.insert=0),Dt=new s.Buf8(ft.w_size),s.arraySet(Dt,ut,Xt-ft.w_size,ft.w_size,0),ut=Dt,Xt=ft.w_size),bt=B.avail_in,wt=B.next_in,ot=B.input,B.avail_in=Xt,B.next_in=0,B.input=ut,Kt(ft);ft.lookahead>=W;){for(G=ft.strstart,V=ft.lookahead-(W-1);ft.ins_h=(ft.ins_h<>>=W=R>>>24,k-=W,(W=R>>>16&255)===0)H[c++]=65535&R;else{if(!(16&W)){if(!(64&W)){R=E[(65535&R)+(b&(1<>>=W,k-=W),k<15&&(b+=T[l++]<>>=W=R>>>24,k-=W,!(16&(W=R>>>16&255))){if(!(64&W)){R=$[(65535&R)+(b&(1<>>=W,k-=W,(W=c-d)>3,b&=(1<<(k-=D<<3))-1,o.next_in=l,o.next_out=c,o.avail_in=l>>24&255)+(N>>>8&65280)+((65280&N)<<8)+((255&N)<<24)}function b(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function k(N){var U;return N&&N.state?(U=N.state,N.total_in=N.total_out=U.total=0,N.msg="",U.wrap&&(N.adler=1&U.wrap),U.mode=x,U.last=0,U.havedict=0,U.dmax=32768,U.head=null,U.hold=0,U.bits=0,U.lencode=U.lendyn=new o.Buf32(m),U.distcode=U.distdyn=new o.Buf32(v),U.sane=1,U.back=-1,f):g}function E(N){var U;return N&&N.state?((U=N.state).wsize=0,U.whave=0,U.wnext=0,k(N)):g}function $(N,U){var T,H;return N&&N.state?(H=N.state,U<0?(T=0,U=-U):(T=1+(U>>4),U<48&&(U&=15)),U&&(U<8||15=at.wsize?(o.arraySet(at.window,U,T-at.wsize,at.wsize,0),at.wnext=0,at.whave=at.wsize):(H<(gt=at.wsize-at.wnext)&&(gt=H),o.arraySet(at.window,U,T-H,gt,at.wnext),(H-=gt)?(o.arraySet(at.window,U,T-H,H,0),at.wnext=H,at.whave=at.wsize):(at.wnext+=gt,at.wnext===at.wsize&&(at.wnext=0),at.whave>>8&255,T.check=a(T.check,rt,2,0),it=nt=0,T.mode=2;break}if(T.flags=0,T.head&&(T.head.done=!1),!(1&T.wrap)||(((255&nt)<<8)+(nt>>8))%31){N.msg="incorrect header check",T.mode=30;break}if((15&nt)!=8){N.msg="unknown compression method",T.mode=30;break}if(it-=4,B=8+(15&(nt>>>=4)),T.wbits===0)T.wbits=B;else if(B>T.wbits){N.msg="invalid window size",T.mode=30;break}T.dmax=1<>8&1),512&T.flags&&(rt[0]=255&nt,rt[1]=nt>>>8&255,T.check=a(T.check,rt,2,0)),it=nt=0,T.mode=3;case 3:for(;it<32;){if(pt===0)break t;pt--,nt+=H[at++]<>>8&255,rt[2]=nt>>>16&255,rt[3]=nt>>>24&255,T.check=a(T.check,rt,4,0)),it=nt=0,T.mode=4;case 4:for(;it<16;){if(pt===0)break t;pt--,nt+=H[at++]<>8),512&T.flags&&(rt[0]=255&nt,rt[1]=nt>>>8&255,T.check=a(T.check,rt,2,0)),it=nt=0,T.mode=5;case 5:if(1024&T.flags){for(;it<16;){if(pt===0)break t;pt--,nt+=H[at++]<>>8&255,T.check=a(T.check,rt,2,0)),it=nt=0}else T.head&&(T.head.extra=null);T.mode=6;case 6:if(1024&T.flags&&(pt<(xt=T.length)&&(xt=pt),xt&&(T.head&&(B=T.head.extra_len-T.length,T.head.extra||(T.head.extra=new Array(T.head.extra_len)),o.arraySet(T.head.extra,H,at,xt,B)),512&T.flags&&(T.check=a(T.check,H,xt,at)),pt-=xt,at+=xt,T.length-=xt),T.length))break t;T.length=0,T.mode=7;case 7:if(2048&T.flags){if(pt===0)break t;for(xt=0;B=H[at+xt++],T.head&&B&&T.length<65536&&(T.head.name+=String.fromCharCode(B)),B&&xt>9&1,T.head.done=!0),N.adler=T.check=0,T.mode=12;break;case 10:for(;it<32;){if(pt===0)break t;pt--,nt+=H[at++]<>>=7&it,it-=7&it,T.mode=27;break}for(;it<3;){if(pt===0)break t;pt--,nt+=H[at++]<>>=1)){case 0:T.mode=14;break;case 1:if(D(T),T.mode=20,U!==6)break;nt>>>=2,it-=2;break t;case 2:T.mode=17;break;case 3:N.msg="invalid block type",T.mode=30}nt>>>=2,it-=2;break;case 14:for(nt>>>=7&it,it-=7⁢it<32;){if(pt===0)break t;pt--,nt+=H[at++]<>>16^65535)){N.msg="invalid stored block lengths",T.mode=30;break}if(T.length=65535&nt,it=nt=0,T.mode=15,U===6)break t;case 15:T.mode=16;case 16:if(xt=T.length){if(pt>>=5,it-=5,T.ndist=1+(31&nt),nt>>>=5,it-=5,T.ncode=4+(15&nt),nt>>>=4,it-=4,286>>=3,it-=3}for(;T.have<19;)T.lens[bt[T.have++]]=0;if(T.lencode=T.lendyn,T.lenbits=7,ft={bits:T.lenbits},ut=u(0,T.lens,0,19,T.lencode,0,T.work,ft),T.lenbits=ft.bits,ut){N.msg="invalid code lengths set",T.mode=30;break}T.have=0,T.mode=19;case 19:for(;T.have>>16&255,te=65535&V,!((Wt=V>>>24)<=it);){if(pt===0)break t;pt--,nt+=H[at++]<>>=Wt,it-=Wt,T.lens[T.have++]=te;else{if(te===16){for(G=Wt+2;it>>=Wt,it-=Wt,T.have===0){N.msg="invalid bit length repeat",T.mode=30;break}B=T.lens[T.have-1],xt=3+(3&nt),nt>>>=2,it-=2}else if(te===17){for(G=Wt+3;it>>=Wt)),nt>>>=3,it-=3}else{for(G=Wt+7;it>>=Wt)),nt>>>=7,it-=7}if(T.have+xt>T.nlen+T.ndist){N.msg="invalid bit length repeat",T.mode=30;break}for(;xt--;)T.lens[T.have++]=B}}if(T.mode===30)break;if(T.lens[256]===0){N.msg="invalid code -- missing end-of-block",T.mode=30;break}if(T.lenbits=9,ft={bits:T.lenbits},ut=u(c,T.lens,0,T.nlen,T.lencode,0,T.work,ft),T.lenbits=ft.bits,ut){N.msg="invalid literal/lengths set",T.mode=30;break}if(T.distbits=6,T.distcode=T.distdyn,ft={bits:T.distbits},ut=u(d,T.lens,T.nlen,T.ndist,T.distcode,0,T.work,ft),T.distbits=ft.bits,ut){N.msg="invalid distances set",T.mode=30;break}if(T.mode=20,U===6)break t;case 20:T.mode=21;case 21:if(6<=pt&&258<=Pt){N.next_out=Et,N.avail_out=Pt,N.next_in=at,N.avail_in=pt,T.hold=nt,T.bits=it,l(N,kt),Et=N.next_out,gt=N.output,Pt=N.avail_out,at=N.next_in,H=N.input,pt=N.avail_in,nt=T.hold,it=T.bits,T.mode===12&&(T.back=-1);break}for(T.back=0;Yt=(V=T.lencode[nt&(1<>>16&255,te=65535&V,!((Wt=V>>>24)<=it);){if(pt===0)break t;pt--,nt+=H[at++]<>Jt)])>>>16&255,te=65535&V,!(Jt+(Wt=V>>>24)<=it);){if(pt===0)break t;pt--,nt+=H[at++]<>>=Jt,it-=Jt,T.back+=Jt}if(nt>>>=Wt,it-=Wt,T.back+=Wt,T.length=te,Yt===0){T.mode=26;break}if(32&Yt){T.back=-1,T.mode=12;break}if(64&Yt){N.msg="invalid literal/length code",T.mode=30;break}T.extra=15&Yt,T.mode=22;case 22:if(T.extra){for(G=T.extra;it>>=T.extra,it-=T.extra,T.back+=T.extra}T.was=T.length,T.mode=23;case 23:for(;Yt=(V=T.distcode[nt&(1<>>16&255,te=65535&V,!((Wt=V>>>24)<=it);){if(pt===0)break t;pt--,nt+=H[at++]<>Jt)])>>>16&255,te=65535&V,!(Jt+(Wt=V>>>24)<=it);){if(pt===0)break t;pt--,nt+=H[at++]<>>=Jt,it-=Jt,T.back+=Jt}if(nt>>>=Wt,it-=Wt,T.back+=Wt,64&Yt){N.msg="invalid distance code",T.mode=30;break}T.offset=te,T.extra=15&Yt,T.mode=24;case 24:if(T.extra){for(G=T.extra;it>>=T.extra,it-=T.extra,T.back+=T.extra}if(T.offset>T.dmax){N.msg="invalid distance too far back",T.mode=30;break}T.mode=25;case 25:if(Pt===0)break t;if(xt=kt-Pt,T.offset>xt){if((xt=T.offset-xt)>T.whave&&T.sane){N.msg="invalid distance too far back",T.mode=30;break}Kt=xt>T.wnext?(xt-=T.wnext,T.wsize-xt):T.wnext-xt,xt>T.length&&(xt=T.length),Ct=T.window}else Ct=gt,Kt=Et-T.offset,xt=T.length;for(PtX?(W=Kt[Ct+v[U]],it[It+v[U]]):(W=96,0),b=1<>Et)+(k-=b)]=R<<24|W<<16|D|0,k!==0;);for(b=1<>=1;if(b!==0?(nt&=b-1,nt+=b):nt=0,U++,--kt[N]==0){if(N===H)break;N=d[f+v[U]]}if(gt>>7)]}function It(V,rt){V.pending_buf[V.pending++]=255&rt,V.pending_buf[V.pending++]=rt>>>8&255}function kt(V,rt,bt){V.bi_valid>O-bt?(V.bi_buf|=rt<>O-V.bi_valid,V.bi_valid+=bt-O):(V.bi_buf|=rt<>>=1,bt<<=1,0<--rt;);return bt>>>1}function Ct(V,rt,bt){var wt,ot,Dt=new Array(v+1),Xt=0;for(wt=1;wt<=v;wt++)Dt[wt]=Xt=Xt+bt[wt-1]<<1;for(ot=0;ot<=rt;ot++){var Tt=V[2*ot+1];Tt!==0&&(V[2*ot]=Kt(Dt[Tt]++,Tt))}}function Wt(V){var rt;for(rt=0;rt>1;1<=bt;bt--)Jt(V,Dt,bt);for(ot=qt;bt=V.heap[1],V.heap[1]=V.heap[V.heap_len--],Jt(V,Dt,1),wt=V.heap[1],V.heap[--V.heap_max]=bt,V.heap[--V.heap_max]=wt,Dt[2*ot]=Dt[2*bt]+Dt[2*wt],V.depth[ot]=(V.depth[bt]>=V.depth[wt]?V.depth[bt]:V.depth[wt])+1,Dt[2*bt+1]=Dt[2*wt+1]=ot,V.heap[1]=ot++,Jt(V,Dt,1),2<=V.heap_len;);V.heap[--V.heap_max]=V.heap[1],function(ae,be){var wi,pe,Vi,Ae,sn,on,le=be.dyn_tree,Ze=be.max_code,Le=be.stat_desc.static_tree,We=be.stat_desc.has_stree,ui=be.stat_desc.extra_bits,wn=be.stat_desc.extra_base,st=be.stat_desc.max_length,dt=0;for(Ae=0;Ae<=v;Ae++)ae.bl_count[Ae]=0;for(le[2*ae.heap[ae.heap_max]+1]=0,wi=ae.heap_max+1;wi>=7;ot>>=1)if(1&fe&&Tt.dyn_ltree[2*qt]!==0)return s;if(Tt.dyn_ltree[18]!==0||Tt.dyn_ltree[20]!==0||Tt.dyn_ltree[26]!==0)return a;for(qt=32;qt>>3,(Dt=V.static_len+3+7>>>3)<=ot&&(ot=Dt)):ot=Dt=bt+5,bt+4<=ot&&rt!==-1?G(V,rt,bt,wt):V.strategy===4||Dt===ot?(kt(V,2+(wt?1:0),3),xe(V,z,N)):(kt(V,4+(wt?1:0),3),function(Tt,qt,fe,ae){var be;for(kt(Tt,qt-257,5),kt(Tt,fe-1,5),kt(Tt,ae-4,4),be=0;be>>8&255,V.pending_buf[V.d_buf+2*V.last_lit+1]=255&rt,V.pending_buf[V.l_buf+V.last_lit]=255&bt,V.last_lit++,rt===0?V.dyn_ltree[2*bt]++:(V.matches++,rt--,V.dyn_ltree[2*(T[bt]+d+1)]++,V.dyn_dtree[2*it(rt)]++),V.last_lit===V.lit_bufsize-1},r._tr_align=function(V){kt(V,2,3),xt(V,k,z),function(rt){rt.bi_valid===16?(It(rt,rt.bi_buf),rt.bi_buf=0,rt.bi_valid=0):8<=rt.bi_valid&&(rt.pending_buf[rt.pending++]=255&rt.bi_buf,rt.bi_buf>>=8,rt.bi_valid-=8)}(V)}},{"../utils/common":41}],53:[function(e,n,r){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,n,r){(function(o){(function(s,a){if(!s.setImmediate){var l,u,c,d,f=1,g={},x=!1,m=s.document,v=Object.getPrototypeOf&&Object.getPrototypeOf(s);v=v&&v.setTimeout?v:s,l={}.toString.call(s.process)==="[object process]"?function(E){process.nextTick(function(){b(E)})}:function(){if(s.postMessage&&!s.importScripts){var E=!0,$=s.onmessage;return s.onmessage=function(){E=!1},s.postMessage("","*"),s.onmessage=$,E}}()?(d="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",k,!1):s.attachEvent("onmessage",k),function(E){s.postMessage(d+E,"*")}):s.MessageChannel?((c=new MessageChannel).port1.onmessage=function(E){b(E.data)},function(E){c.port2.postMessage(E)}):m&&"onreadystatechange"in m.createElement("script")?(u=m.documentElement,function(E){var $=m.createElement("script");$.onreadystatechange=function(){b(E),$.onreadystatechange=null,u.removeChild($),$=null},u.appendChild($)}):function(E){setTimeout(b,0,E)},v.setImmediate=function(E){typeof E!="function"&&(E=new Function(""+E));for(var $=new Array(arguments.length-1),Q=0;Q<$.length;Q++)$[Q]=arguments[Q+1];var X={callback:E,args:$};return g[f]=X,l(f),f++},v.clearImmediate=O}function O(E){delete g[E]}function b(E){if(x)setTimeout(b,0,E);else{var $=g[E];if($){x=!0;try{(function(Q){var X=Q.callback,R=Q.args;switch(R.length){case 0:X();break;case 1:X(R[0]);break;case 2:X(R[0],R[1]);break;case 3:X(R[0],R[1],R[2]);break;default:X.apply(a,R)}})($)}finally{O(E),x=!1}}}}function k(E){E.source===s&&typeof E.data=="string"&&E.data.indexOf(d)===0&&b(+E.data.slice(d.length))}})(typeof self>"u"?o===void 0?this:o:self)}).call(this,typeof pn<"u"?pn:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(F0);var L1=F0.exports;const X0=B0(L1);var R0={exports:{}};(function(i,t){(function(e,n){n()})(pn,function(){function e(u,c){return typeof c>"u"?c={autoBom:!1}:typeof c!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),c={autoBom:!c}),c.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(u.type)?new Blob(["\uFEFF",u],{type:u.type}):u}function n(u,c,d){var f=new XMLHttpRequest;f.open("GET",u),f.responseType="blob",f.onload=function(){l(f.response,c,d)},f.onerror=function(){console.error("could not download file")},f.send()}function r(u){var c=new XMLHttpRequest;c.open("HEAD",u,!1);try{c.send()}catch{}return 200<=c.status&&299>=c.status}function o(u){try{u.dispatchEvent(new MouseEvent("click"))}catch{var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),u.dispatchEvent(c)}}var s=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof pn=="object"&&pn.global===pn?pn:void 0,a=s.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=s.saveAs||(typeof window!="object"||window!==s?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(u,c,d){var f=s.URL||s.webkitURL,g=document.createElement("a");c=c||u.name||"download",g.download=c,g.rel="noopener",typeof u=="string"?(g.href=u,g.origin===location.origin?o(g):r(g.href)?n(u,c,d):o(g,g.target="_blank")):(g.href=f.createObjectURL(u),setTimeout(function(){f.revokeObjectURL(g.href)},4e4),setTimeout(function(){o(g)},0))}:"msSaveOrOpenBlob"in navigator?function(u,c,d){if(c=c||u.name||"download",typeof u!="string")navigator.msSaveOrOpenBlob(e(u,d),c);else if(r(u))n(u,c,d);else{var f=document.createElement("a");f.href=u,f.target="_blank",setTimeout(function(){o(f)})}}:function(u,c,d,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof u=="string")return n(u,c,d);var g=u.type==="application/octet-stream",x=/constructor/i.test(s.HTMLElement)||s.safari,m=/CriOS\/[\d]+/.test(navigator.userAgent);if((m||g&&x||a)&&typeof FileReader<"u"){var v=new FileReader;v.onloadend=function(){var k=v.result;k=m?k:k.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=k:location=k,f=null},v.readAsDataURL(u)}else{var O=s.URL||s.webkitURL,b=O.createObjectURL(u);f?f.location=b:location.href=b,f=null,setTimeout(function(){O.revokeObjectURL(b)},4e4)}});s.saveAs=l.saveAs=l,i.exports=l})})(R0);var Y0=R0.exports;const Ef=25.4,A1="SvgPcb",E1=i=>([t,e])=>{const[n,r,o,s,a,l]=D1(i);return[t*n+e*o+a,t*r+e*s+l]};function D1({dx:i,dy:t,sx:e,sy:n,rotate:r,skew:o}){return i??(i=0),t??(t=0),e??(e=1),n??(n=1),r??(r=0),o??(o=0),r=r/180*Math.PI,T1(i,t,e,n,r,o)}function T1(i,t,e,n,r,o){var s=[1,0,0,1,0,0];return a(i,t),u(r),c(o),l(e,n),s;function a(d,f){s[4]+=s[0]*d+s[2]*f,s[5]+=s[1]*d+s[3]*f}function l(d,f){s[0]*=d,s[1]*=d,s[2]*=f,s[3]*=f}function u(d){var f=Math.cos(d),g=Math.sin(d),x=s[0]*f+s[2]*g,m=s[1]*f+s[3]*g,v=-s[0]*g+s[2]*f,O=-s[1]*g+s[3]*f;s[0]=x,s[1]=m,s[2]=v,s[3]=O}function c(d){var f=Math.cos(r),g=Math.sin(r);s[2]+=d*f,s[3]+=d*g}}function Z0(i,t){const e=E1(t);return i.forEach((n,r)=>{i[r]=n.map(e)}),i}var P={};P.version="6.4.2.2";P.use_lines=!0;P.use_xyz=!1;var W0=!1;typeof module<"u"&&module.exports?(module.exports=P,W0=!0):typeof document<"u"?window.ClipperLib=P:self.ClipperLib=P;if(W0)var hi="chrome";else var hi=navigator.userAgent.toString().toLowerCase();hi.indexOf("chrome")!=-1&&hi.indexOf("chromium")==-1;hi.indexOf("chromium")!=-1;hi.indexOf("safari")!=-1&&hi.indexOf("chrome")==-1&&hi.indexOf("chromium")==-1;hi.indexOf("firefox")!=-1;hi.indexOf("firefox/17")!=-1;hi.indexOf("firefox/15")!=-1;hi.indexOf("firefox/3")!=-1;hi.indexOf("opera")!=-1;hi.indexOf("msie 10")!=-1;hi.indexOf("msie 9")!=-1;hi.indexOf("msie 8")!=-1;hi.indexOf("msie 7")!=-1;hi.indexOf("msie ")!=-1;var U0=function(i,t){var e;if(typeof Object.getOwnPropertyNames>"u"){for(e in t.prototype)(typeof i.prototype[e]>"u"||i.prototype[e]===Object.prototype[e])&&(i.prototype[e]=t.prototype[e]);for(e in t)typeof i[e]>"u"&&(i[e]=t[e]);i.$baseCtor=t}else{for(var n=Object.getOwnPropertyNames(t.prototype),r=0;r"u"&&Object.defineProperty(i.prototype,n[r],Object.getOwnPropertyDescriptor(t.prototype,n[r]));for(e in t)typeof i[e]>"u"&&(i[e]=t[e]);i.$baseCtor=t}};P.Path=function(){return[]};P.Path.prototype.push=Array.prototype.push;P.Paths=function(){return[]};P.Paths.prototype.push=Array.prototype.push;P.PolyNode=function(){this.m_Parent=null,this.m_polygon=new P.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1};P.PolyNode.prototype.IsHoleNode=function(){for(var i=!0,t=this.m_Parent;t!==null;)i=!i,t=t.m_Parent;return i};P.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length};P.PolyNode.prototype.Contour=function(){return this.m_polygon};P.PolyNode.prototype.AddChild=function(i){var t=this.m_Childs.length;this.m_Childs.push(i),i.m_Parent=this,i.m_Index=t};P.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()};P.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index===this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]};P.PolyNode.prototype.Childs=function(){return this.m_Childs};P.PolyNode.prototype.Parent=function(){return this.m_Parent};P.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()};P.PolyTree=function(){this.m_AllPolys=[],P.PolyNode.call(this)};P.PolyTree.prototype.Clear=function(){for(var i=0,t=this.m_AllPolys.length;i0?this.m_Childs[0]:null};P.PolyTree.prototype.Total=function(){var i=this.m_AllPolys.length;return i>0&&this.m_Childs[0]!==this.m_AllPolys[0]&&i--,i};U0(P.PolyTree,P.PolyNode);P.Clear=function(i){i.length=0};P.PI=3.141592653589793;P.PI2=2*3.141592653589793;P.FPoint=function(){var i=arguments,t=i.length;if(this.X=0,this.Y=0,P.use_xyz)if(this.Z=0,t===3)this.X=i[0],this.Y=i[1],this.Z=i[2];else if(t===2)this.X=i[0],this.Y=i[1],this.Z=0;else if(t===1)if(i[0]instanceof P.FPoint){var e=i[0];this.X=e.X,this.Y=e.Y,this.Z=0}else{var n=i[0];typeof n.Z>"u"&&(n.Z=0),this.X=n.X,this.Y=n.Y,this.Z=n.Z}else this.X=0,this.Y=0,this.Z=0;else if(t===2)this.X=i[0],this.Y=i[1];else if(t===1)if(i[0]instanceof P.FPoint){var e=i[0];this.X=e.X,this.Y=e.Y}else{var n=i[0];this.X=n.X,this.Y=n.Y}else this.X=0,this.Y=0};P.FPoint.op_Equality=function(i,t){return i.X===t.X&&i.Y===t.Y};P.FPoint.op_Inequality=function(i,t){return i.X!==t.X||i.Y!==t.Y};P.FPoint0=function(){this.X=0,this.Y=0,P.use_xyz&&(this.Z=0)};P.FPoint0.prototype=P.FPoint.prototype;P.FPoint1=function(i){this.X=i.X,this.Y=i.Y,P.use_xyz&&(typeof i.Z>"u"?this.Z=0:this.Z=i.Z)};P.FPoint1.prototype=P.FPoint.prototype;P.FPoint1dp=function(i){this.X=i.X,this.Y=i.Y,P.use_xyz&&(this.Z=0)};P.FPoint1dp.prototype=P.FPoint.prototype;P.FPoint2=function(i,t,e){this.X=i,this.Y=t,P.use_xyz&&(typeof e>"u"?this.Z=0:this.Z=e)};P.FPoint2.prototype=P.FPoint.prototype;P.FRect=function(){var i=arguments,t=i.length;if(t===4)this.left=i[0],this.top=i[1],this.right=i[2],this.bottom=i[3];else if(t===1){var e=i[0];this.left=e.left,this.top=e.top,this.right=e.right,this.bottom=e.bottom}else this.left=0,this.top=0,this.right=0,this.bottom=0};P.FRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0};P.FRect0.prototype=P.FRect.prototype;P.FRect1=function(i){this.left=i.left,this.top=i.top,this.right=i.right,this.bottom=i.bottom};P.FRect1.prototype=P.FRect.prototype;P.FRect4=function(i,t,e,n){this.left=i,this.top=t,this.right=e,this.bottom=n};P.FRect4.prototype=P.FRect.prototype;P.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3};P.PolyType={ptSubject:0,ptClip:1};P.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3};P.JoinType={jtSquare:0,jtRound:1,jtMiter:2};P.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4};P.EdgeSide={esLeft:0,esRight:1};P.Direction={dRightToLeft:0,dLeftToRight:1};P.TEdge=function(){this.Bot=new P.FPoint0,this.Curr=new P.FPoint0,this.Top=new P.FPoint0,this.Delta=new P.FPoint0,this.Dx=0,this.PolyTyp=P.PolyType.ptSubject,this.Side=P.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null};P.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new P.FPoint0};P.MyIntersectNodeSort=function(){};P.MyIntersectNodeSort.Compare=function(i,t){var e=t.Pt.Y-i.Pt.Y;return e>0?1:e<0?-1:0};P.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null};P.Scanbeam=function(){this.Y=0,this.Next=null};P.Maxima=function(){this.X=0,this.Next=null,this.Prev=null};P.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null};P.OutPt=function(){this.Idx=0,this.Pt=new P.FPoint0,this.Next=null,this.Prev=null};P.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new P.FPoint0};P.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_Scanbeam=null,this.m_PolyOuts=null,this.m_ActiveEdges=null};P.ClipperBase.horizontal=-34e37;P.ClipperBase.Skip=-2;P.ClipperBase.Unassigned=-1;P.ClipperBase.tolerance=1e-20;P.ClipperBase.maxValue=Math.sqrt(Number.MAX_VALUE);P.ClipperBase.minValue=Math.sqrt(Number.MIN_VALUE);P.ClipperBase.near_zero=function(i){return i>-P.ClipperBase.tolerance&&it.X==i.Xt.Y==i.YP.ClipperBase.maxValue||i.X<-P.ClipperBase.maxValue||i.Y>P.ClipperBase.maxValue||i.Y<-P.ClipperBase.maxValue||i.X>0&&i.X0&&i.Y-P.ClipperBase.minValue||i.Y<0&&i.Y>-P.ClipperBase.minValue)&&P.Error("Coordinate outside allowed range in RangeTest().")};P.ClipperBase.prototype.InitEdge=function(i,t,e,n){i.Next=t,i.Prev=e,i.Curr.X=n.X,i.Curr.Y=n.Y,P.use_xyz&&(i.Curr.Z=n.Z),i.OutIdx=-1};P.ClipperBase.prototype.InitEdge2=function(i,t){i.Curr.Y>=i.Next.Curr.Y?(i.Bot.X=i.Curr.X,i.Bot.Y=i.Curr.Y,P.use_xyz&&(i.Bot.Z=i.Curr.Z),i.Top.X=i.Next.Curr.X,i.Top.Y=i.Next.Curr.Y,P.use_xyz&&(i.Top.Z=i.Next.Curr.Z)):(i.Top.X=i.Curr.X,i.Top.Y=i.Curr.Y,P.use_xyz&&(i.Top.Z=i.Curr.Z),i.Bot.X=i.Next.Curr.X,i.Bot.Y=i.Next.Curr.Y,P.use_xyz&&(i.Bot.Z=i.Next.Curr.Z)),this.SetDx(i),i.PolyTyp=t};P.ClipperBase.prototype.FindNextLocMin=function(i){for(var t;;){for(;P.FPoint.op_Inequality(i.Bot,i.Prev.Bot)||P.FPoint.op_Equality(i.Curr,i.Top);)i=i.Next;if(i.Dx!==P.ClipperBase.horizontal&&i.Prev.Dx!==P.ClipperBase.horizontal)break;for(;i.Prev.Dx===P.ClipperBase.horizontal;)i=i.Prev;for(t=i;i.Dx===P.ClipperBase.horizontal;)i=i.Next;if(i.Top.Y!==i.Prev.Bot.Y){t.Prev.Bot.Xn.Next.Top.X&&(n=r.Prev)}for(;i!==n;)i.NextInLML=i.Next,i.Dx===P.ClipperBase.horizontal&&i!==e&&i.Bot.X!==i.Prev.Top.X&&this.ReverseHorizontal(i),i=i.Next;i.Dx===P.ClipperBase.horizontal&&i!==e&&i.Bot.X!==i.Prev.Top.X&&this.ReverseHorizontal(i),n=n.Next}else{for(;n.Top.Y===n.Prev.Bot.Y&&n.Prev.OutIdx!==P.ClipperBase.Skip;)n=n.Prev;if(n.Dx===P.ClipperBase.horizontal&&n.Prev.OutIdx!==P.ClipperBase.Skip){for(r=n;r.Next.Dx===P.ClipperBase.horizontal;)r=r.Next;(r.Next.Top.X===n.Prev.Top.X||r.Next.Top.X>n.Prev.Top.X)&&(n=r.Next)}for(;i!==n;)i.NextInLML=i.Prev,i.Dx===P.ClipperBase.horizontal&&i!==e&&i.Bot.X!==i.Next.Top.X&&this.ReverseHorizontal(i),i=i.Prev;i.Dx===P.ClipperBase.horizontal&&i!==e&&i.Bot.X!==i.Next.Top.X&&this.ReverseHorizontal(i),n=n.Prev}return n};P.ClipperBase.prototype.AddPath=function(i,t,e){P.use_lines?!e&&t===P.PolyType.ptClip&&P.Error("AddPath: Open paths must be subject."):e||P.Error("AddPath: Open paths have been disabled.");var n=i.length-1;if(e)for(;n>0&&P.FPoint.op_Equality(i[n],i[0]);)--n;for(;n>0&&P.FPoint.op_Equality(i[n],i[n-1]);)--n;if(e&&n<2||!e&&n<1)return!1;for(var r=new Array,o=0;o<=n;o++)r.push(new P.TEdge);var s=!0;r[1].Curr.X=i[1].X,r[1].Curr.Y=i[1].Y,P.use_xyz&&(r[1].Curr.Z=i[1].Z),this.RangeTest(i[0]),this.RangeTest(i[n]),this.InitEdge(r[0],r[1],r[n],i[0]),this.InitEdge(r[n],r[0],r[n-1],i[n]);for(var o=n-1;o>=1;--o)this.RangeTest(i[o]),this.InitEdge(r[o],r[o+1],r[o-1],i[o]);for(var a=r[0],l=a,u=a;;){if(l.Curr===l.Next.Curr&&(e||l.Next!==a)){if(l===l.Next)break;l===a&&(a=l.Next),l=this.RemoveEdge(l),u=l;continue}if(l.Prev===l.Next)break;if(e&&P.ClipperBase.SlopesEqual4(l.Prev.Curr,l.Curr,l.Next.Curr)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(l.Prev.Curr,l.Curr,l.Next.Curr))){l===a&&(a=l.Next),l=this.RemoveEdge(l),l=l.Prev,u=l;continue}if(l=l.Next,l===u||!e&&l.Next===a)break}if(!e&&l===l.Next||e&&l.Prev===l.Next)return!1;e||(this.m_HasOpenPaths=!0,a.Prev.OutIdx=P.ClipperBase.Skip),l=a;do this.InitEdge2(l,t),l=l.Next,s&&l.Curr.Y!==a.Curr.Y&&(s=!1);while(l!==a);if(s){if(e)return!1;l.Prev.OutIdx=P.ClipperBase.Skip;var c=new P.LocalMinima;for(c.Next=null,c.Y=l.Bot.Y,c.LeftBound=null,c.RightBound=l,c.RightBound.Side=P.EdgeSide.esRight,c.RightBound.WindDelta=0;l.Bot.X!==l.Prev.Top.X&&this.ReverseHorizontal(l),l.Next.OutIdx!==P.ClipperBase.Skip;)l.NextInLML=l.Next,l=l.Next;return this.InsertLocalMinima(c),this.m_edges.push(r),!0}this.m_edges.push(r);var d,f=null;for(P.FPoint.op_Equality(l.Prev.Bot,l.Prev.Top)&&(l=l.Next);l=this.FindNextLocMin(l),l!==f;){f===null&&(f=l);var c=new P.LocalMinima;c.Next=null,c.Y=l.Bot.Y,l.Dxi.X==t.Xi.Y==t.Y=this.m_MinimaList.Y)i.Next=this.m_MinimaList,this.m_MinimaList=i;else{for(var t=this.m_MinimaList;t.Next!==null&&i.Ythis.m_Scanbeam.Y){var t=new P.Scanbeam;t.Y=i,t.Next=this.m_Scanbeam,this.m_Scanbeam=t}else{for(var e=this.m_Scanbeam;e.Next!==null&&i<=e.Next.Y;)e=e.Next;if(i===e.Y)return;var n=new P.Scanbeam;n.Y=i,n.Next=e.Next,e.Next=n}};P.ClipperBase.prototype.PopScanbeam=function(i){return this.m_Scanbeam===null?(i.v=0,!1):(i.v=this.m_Scanbeam.Y,this.m_Scanbeam=this.m_Scanbeam.Next,!0)};P.ClipperBase.prototype.LocalMinimaPending=function(){return this.m_CurrentLM!==null};P.ClipperBase.prototype.CreateOutRec=function(){var i=new P.OutRec;return i.Idx=P.ClipperBase.Unassigned,i.IsHole=!1,i.IsOpen=!1,i.FirstLeft=null,i.Pts=null,i.BottomPt=null,i.PolyNode=null,this.m_PolyOuts.push(i),i.Idx=this.m_PolyOuts.length-1,i};P.ClipperBase.prototype.DisposeOutRec=function(i){var t=this.m_PolyOuts[i];t.Pts=null,t=null,this.m_PolyOuts[i]=null};P.ClipperBase.prototype.UpdateEdgeIntoAEL=function(i){i.NextInLML===null&&P.Error("UpdateEdgeIntoAEL: invalid call");var t=i.PrevInAEL,e=i.NextInAEL;return i.NextInLML.OutIdx=i.OutIdx,t!==null?t.NextInAEL=i.NextInLML:this.m_ActiveEdges=i.NextInLML,e!==null&&(e.PrevInAEL=i.NextInLML),i.NextInLML.Side=i.Side,i.NextInLML.WindDelta=i.WindDelta,i.NextInLML.WindCnt=i.WindCnt,i.NextInLML.WindCnt2=i.WindCnt2,i=i.NextInLML,i.Curr.X=i.Bot.X,i.Curr.Y=i.Bot.Y,i.PrevInAEL=t,i.NextInAEL=e,P.ClipperBase.IsHorizontal(i)||this.InsertScanbeam(i.Top.Y),i};P.ClipperBase.prototype.SwapPositionsInAEL=function(i,t){if(!(i.NextInAEL===i.PrevInAEL||t.NextInAEL===t.PrevInAEL)){if(i.NextInAEL===t){var e=t.NextInAEL;e!==null&&(e.PrevInAEL=i);var n=i.PrevInAEL;n!==null&&(n.NextInAEL=t),t.PrevInAEL=n,t.NextInAEL=i,i.PrevInAEL=t,i.NextInAEL=e}else if(t.NextInAEL===i){var r=i.NextInAEL;r!==null&&(r.PrevInAEL=t);var o=t.PrevInAEL;o!==null&&(o.NextInAEL=i),i.PrevInAEL=o,i.NextInAEL=t,t.PrevInAEL=i,t.NextInAEL=r}else{var s=i.NextInAEL,a=i.PrevInAEL;i.NextInAEL=t.NextInAEL,i.NextInAEL!==null&&(i.NextInAEL.PrevInAEL=i),i.PrevInAEL=t.PrevInAEL,i.PrevInAEL!==null&&(i.PrevInAEL.NextInAEL=i),t.NextInAEL=s,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=t),t.PrevInAEL=a,t.PrevInAEL!==null&&(t.PrevInAEL.NextInAEL=t)}i.PrevInAEL===null?this.m_ActiveEdges=i:t.PrevInAEL===null&&(this.m_ActiveEdges=t)}};P.ClipperBase.prototype.DeleteFromAEL=function(i){var t=i.PrevInAEL,e=i.NextInAEL;t===null&&e===null&&i!==this.m_ActiveEdges||(t!==null?t.NextInAEL=e:this.m_ActiveEdges=e,e!==null&&(e.PrevInAEL=t),i.NextInAEL=null,i.PrevInAEL=null)};P.Clipper=function(i){typeof i>"u"&&(i=0),this.m_PolyOuts=null,this.m_ClipType=P.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=P.PolyFillType.pftEvenOdd,this.m_SubjFillType=P.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,P.ClipperBase.call(this),this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=P.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=(1&i)!==0,this.StrictlySimple=(2&i)!==0,this.PreserveCollinear=(4&i)!==0,P.use_xyz&&(this.ZFillFunction=null)};P.Clipper.ioReverseSolution=1;P.Clipper.ioStrictlySimple=2;P.Clipper.ioPreserveCollinear=4;P.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),P.ClipperBase.prototype.Clear.call(this))};P.Clipper.prototype.InsertMaxima=function(i){var t=new P.Maxima;if(t.X=i,this.m_Maxima===null)this.m_Maxima=t,this.m_Maxima.Next=null,this.m_Maxima.Prev=null;else if(i=e.Next.X;)e=e.Next;if(i===e.X)return;t.Next=e.Next,t.Prev=e,e.Next!==null&&(e.Next.Prev=t),e.Next=t}};P.Clipper.prototype.Execute=function(){var i=arguments,t=i.length,e=i[1]instanceof P.PolyTree;if(t===4&&!e){var n=i[0],r=i[1],o=i[2],s=i[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&P.Error("Error: PolyTree struct is needed for open path clipping."),this.m_ExecuteLocked=!0,P.Clear(r),this.m_SubjFillType=o,this.m_ClipFillType=s,this.m_ClipType=n,this.m_UsingPolyTree=!1;try{var a=this.ExecuteInternal();a&&this.BuildResult(r)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return a}else if(t===4&&e){var n=i[0],l=i[1],o=i[2],s=i[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=o,this.m_ClipFillType=s,this.m_ClipType=n,this.m_UsingPolyTree=!0;try{var a=this.ExecuteInternal();a&&this.BuildResult2(l)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return a}else if(t===2&&!e){var n=i[0],r=i[1];return this.Execute(n,r,P.PolyFillType.pftEvenOdd,P.PolyFillType.pftEvenOdd)}else if(t===2&&e){var n=i[0],l=i[1];return this.Execute(n,l,P.PolyFillType.pftEvenOdd,P.PolyFillType.pftEvenOdd)}};P.Clipper.prototype.FixHoleLinkage=function(i){if(!(i.FirstLeft===null||i.IsHole!==i.FirstLeft.IsHole&&i.FirstLeft.Pts!==null)){for(var t=i.FirstLeft;t!==null&&(t.IsHole===i.IsHole||t.Pts===null);)t=t.FirstLeft;i.FirstLeft=t}};P.Clipper.prototype.ExecuteInternal=function(){try{this.Reset(),this.m_SortedEdges=null,this.m_Maxima=null;var i={},t={};if(!this.PopScanbeam(i))return!1;for(this.InsertLocalMinimaIntoAEL(i.v);this.PopScanbeam(t)||this.LocalMinimaPending();){if(this.ProcessHorizontals(),this.m_GhostJoins.length=0,!this.ProcessIntersections(t.v))return!1;this.ProcessEdgesAtTopOfScanbeam(t.v),i.v=t.v,this.InsertLocalMinimaIntoAEL(i.v)}var e,n,r;for(n=0,r=this.m_PolyOuts.length;n0&&this.ReversePolyPtLinks(e.Pts);for(this.JoinCommonEdges(),n=0,r=this.m_PolyOuts.length;n0&&n.WindDelta!==0)for(var o=0,s=this.m_GhostJoins.length;o=0&&e.PrevInAEL!==null&&e.PrevInAEL.Curr.X===e.Bot.X&&e.PrevInAEL.OutIdx>=0&&P.ClipperBase.SlopesEqual5(e.PrevInAEL.Curr,e.PrevInAEL.Top,e.Curr,e.Top)&&e.WindDelta!==0&&e.PrevInAEL.WindDelta!==0){var l=this.AddOutPt(e.PrevInAEL,e.Bot);this.AddJoin(r,l,e.Top)}if(e.NextInAEL!==n){if(n.OutIdx>=0&&n.PrevInAEL.OutIdx>=0&&P.ClipperBase.SlopesEqual5(n.PrevInAEL.Curr,n.PrevInAEL.Top,n.Curr,n.Top)&&n.WindDelta!==0&&n.PrevInAEL.WindDelta!==0){var l=this.AddOutPt(n.PrevInAEL,n.Bot);this.AddJoin(r,l,n.Top)}var u=e.NextInAEL;if(u!==null)for(;u!==n;)this.IntersectEdges(n,u,e.Curr),u=u.NextInAEL}}}};P.Clipper.prototype.InsertEdgeIntoAEL=function(i,t){if(this.m_ActiveEdges===null)i.PrevInAEL=null,i.NextInAEL=null,this.m_ActiveEdges=i;else if(t===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,i))i.PrevInAEL=null,i.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=i,this.m_ActiveEdges=i;else{for(t===null&&(t=this.m_ActiveEdges);t.NextInAEL!==null&&!this.E2InsertsBeforeE1(t.NextInAEL,i);)t=t.NextInAEL;i.NextInAEL=t.NextInAEL,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=i),i.PrevInAEL=t,t.NextInAEL=i}};P.Clipper.prototype.E2InsertsBeforeE1=function(i,t){return t.Curr.X===i.Curr.X?t.Top.Y>i.Top.Y?t.Top.XP.Clipper.TopX(t,i.Top.Y):t.Curr.X0;default:return i.WindCnt2<0}case P.ClipType.ctUnion:switch(e){case P.PolyFillType.pftEvenOdd:case P.PolyFillType.pftNonZero:return i.WindCnt2===0;case P.PolyFillType.pftPositive:return i.WindCnt2<=0;default:return i.WindCnt2>=0}case P.ClipType.ctDifference:if(i.PolyTyp===P.PolyType.ptSubject)switch(e){case P.PolyFillType.pftEvenOdd:case P.PolyFillType.pftNonZero:return i.WindCnt2===0;case P.PolyFillType.pftPositive:return i.WindCnt2<=0;default:return i.WindCnt2>=0}else switch(e){case P.PolyFillType.pftEvenOdd:case P.PolyFillType.pftNonZero:return i.WindCnt2!==0;case P.PolyFillType.pftPositive:return i.WindCnt2>0;default:return i.WindCnt2<0}case P.ClipType.ctXor:if(i.WindDelta===0)switch(e){case P.PolyFillType.pftEvenOdd:case P.PolyFillType.pftNonZero:return i.WindCnt2===0;case P.PolyFillType.pftPositive:return i.WindCnt2<=0;default:return i.WindCnt2>=0}else return!0}return!0};P.Clipper.prototype.SetWindingCount=function(i){for(var t=i.PrevInAEL;t!==null&&(t.PolyTyp!==i.PolyTyp||t.WindDelta===0);)t=t.PrevInAEL;if(t===null){var e=i.PolyTyp===P.PolyType.ptSubject?this.m_SubjFillType:this.m_ClipFillType;i.WindDelta===0?i.WindCnt=e===P.PolyFillType.pftNegative?-1:1:i.WindCnt=i.WindDelta,i.WindCnt2=0,t=this.m_ActiveEdges}else if(i.WindDelta===0&&this.m_ClipType!==P.ClipType.ctUnion)i.WindCnt=1,i.WindCnt2=t.WindCnt2,t=t.NextInAEL;else if(this.IsEvenOddFillType(i)){if(i.WindDelta===0){for(var n=!0,r=t.PrevInAEL;r!==null;)r.PolyTyp===t.PolyTyp&&r.WindDelta!==0&&(n=!n),r=r.PrevInAEL;i.WindCnt=n?0:1}else i.WindCnt=i.WindDelta;i.WindCnt2=t.WindCnt2,t=t.NextInAEL}else t.WindCnt*t.WindDelta<0?Math.abs(t.WindCnt)>1?t.WindDelta*i.WindDelta<0?i.WindCnt=t.WindCnt:i.WindCnt=t.WindCnt+i.WindDelta:i.WindCnt=i.WindDelta===0?1:i.WindDelta:i.WindDelta===0?i.WindCnt=t.WindCnt<0?t.WindCnt-1:t.WindCnt+1:t.WindDelta*i.WindDelta<0?i.WindCnt=t.WindCnt:i.WindCnt=t.WindCnt+i.WindDelta,i.WindCnt2=t.WindCnt2,t=t.NextInAEL;if(this.IsEvenOddAltFillType(i))for(;t!==i;)t.WindDelta!==0&&(i.WindCnt2=i.WindCnt2===0?1:0),t=t.NextInAEL;else for(;t!==i;)i.WindCnt2+=t.WindDelta,t=t.NextInAEL};P.Clipper.prototype.AddEdgeToSEL=function(i){this.m_SortedEdges===null?(this.m_SortedEdges=i,i.PrevInSEL=null,i.NextInSEL=null):(i.NextInSEL=this.m_SortedEdges,i.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=i,this.m_SortedEdges=i)};P.Clipper.prototype.PopEdgeFromSEL=function(i){if(i.v=this.m_SortedEdges,i.v===null)return!1;var t=i.v;return this.m_SortedEdges=i.v.NextInSEL,this.m_SortedEdges!==null&&(this.m_SortedEdges.PrevInSEL=null),t.NextInSEL=null,t.PrevInSEL=null,!0};P.Clipper.prototype.CopyAELToSEL=function(){var i=this.m_ActiveEdges;for(this.m_SortedEdges=i;i!==null;)i.PrevInSEL=i.PrevInAEL,i.NextInSEL=i.NextInAEL,i=i.NextInAEL};P.Clipper.prototype.SwapPositionsInSEL=function(i,t){if(!(i.NextInSEL===null&&i.PrevInSEL===null)&&!(t.NextInSEL===null&&t.PrevInSEL===null)){if(i.NextInSEL===t){var e=t.NextInSEL;e!==null&&(e.PrevInSEL=i);var n=i.PrevInSEL;n!==null&&(n.NextInSEL=t),t.PrevInSEL=n,t.NextInSEL=i,i.PrevInSEL=t,i.NextInSEL=e}else if(t.NextInSEL===i){var e=i.NextInSEL;e!==null&&(e.PrevInSEL=t);var n=t.PrevInSEL;n!==null&&(n.NextInSEL=i),i.PrevInSEL=n,i.NextInSEL=t,t.PrevInSEL=i,t.NextInSEL=e}else{var e=i.NextInSEL,n=i.PrevInSEL;i.NextInSEL=t.NextInSEL,i.NextInSEL!==null&&(i.NextInSEL.PrevInSEL=i),i.PrevInSEL=t.PrevInSEL,i.PrevInSEL!==null&&(i.PrevInSEL.NextInSEL=i),t.NextInSEL=e,t.NextInSEL!==null&&(t.NextInSEL.PrevInSEL=t),t.PrevInSEL=n,t.PrevInSEL!==null&&(t.PrevInSEL.NextInSEL=t)}i.PrevInSEL===null?this.m_SortedEdges=i:t.PrevInSEL===null&&(this.m_SortedEdges=t)}};P.Clipper.prototype.AddLocalMaxPoly=function(i,t,e){this.AddOutPt(i,e),t.WindDelta===0&&this.AddOutPt(t,e),i.OutIdx===t.OutIdx?(i.OutIdx=-1,t.OutIdx=-1):i.OutIdxt.Dx?(n=this.AddOutPt(i,e),t.OutIdx=i.OutIdx,i.Side=P.EdgeSide.esLeft,t.Side=P.EdgeSide.esRight,r=i,r.PrevInAEL===t?o=t.PrevInAEL:o=r.PrevInAEL):(n=this.AddOutPt(t,e),i.OutIdx=t.OutIdx,i.Side=P.EdgeSide.esRight,t.Side=P.EdgeSide.esLeft,r=t,r.PrevInAEL===i?o=i.PrevInAEL:o=r.PrevInAEL),o!==null&&o.OutIdx>=0&&o.Top.Yt&&(r=i,i=t,t=r),e>n&&(r=e,e=n,n=r),i=0&&e.WindDelta!==0&&(n===null?n=e:n.OutIdx===e.OutIdx&&(n=null)),e=e.PrevInAEL;n===null?(t.FirstLeft=null,t.IsHole=!1):(t.FirstLeft=this.m_PolyOuts[n.OutIdx],t.IsHole=!t.FirstLeft.IsHole)};P.Clipper.prototype.GetDx=function(i,t){return i.Y===t.Y?P.ClipperBase.horizontal:(t.X-i.X)/(t.Y-i.Y)};P.Clipper.prototype.FirstIsBottomPt=function(i,t){for(var e=i.Prev;P.FPoint.op_Equality(e.Pt,i.Pt)&&e!==i;)e=e.Prev;var n=Math.abs(this.GetDx(i.Pt,e.Pt));for(e=i.Next;P.FPoint.op_Equality(e.Pt,i.Pt)&&e!==i;)e=e.Next;var r=Math.abs(this.GetDx(i.Pt,e.Pt));for(e=t.Prev;P.FPoint.op_Equality(e.Pt,t.Pt)&&e!==t;)e=e.Prev;var o=Math.abs(this.GetDx(t.Pt,e.Pt));for(e=t.Next;P.FPoint.op_Equality(e.Pt,t.Pt)&&e!==t;)e=e.Next;var s=Math.abs(this.GetDx(t.Pt,e.Pt));return Math.max(n,r)===Math.max(o,s)&&Math.min(n,r)===Math.min(o,s)?this.Area(i)>0:n>=o&&n>=s||r>=o&&r>=s};P.Clipper.prototype.GetBottomPt=function(i){for(var t=null,e=i.Next;e!==i;)e.Pt.Y>i.Pt.Y?(i=e,t=null):e.Pt.Y===i.Pt.Y&&e.Pt.X<=i.Pt.X&&(e.Pt.Xn.Pt.Y?i:e.Pt.Yn.Pt.X||e.Next===e?t:n.Next===n||this.FirstIsBottomPt(e,n)?i:t};P.Clipper.prototype.OutRec1RightOfOutRec2=function(i,t){do if(i=i.FirstLeft,i===t)return!0;while(i!==null);return!1};P.Clipper.prototype.GetOutRec=function(i){for(var t=this.m_PolyOuts[i];t!==this.m_PolyOuts[t.Idx];)t=this.m_PolyOuts[t.Idx];return t};P.Clipper.prototype.AppendPolygon=function(i,t){var e=this.m_PolyOuts[i.OutIdx],n=this.m_PolyOuts[t.OutIdx],r;this.OutRec1RightOfOutRec2(e,n)?r=n:this.OutRec1RightOfOutRec2(n,e)?r=e:r=this.GetLowermostRec(e,n);var o=e.Pts,s=o.Prev,a=n.Pts,l=a.Prev;i.Side===P.EdgeSide.esLeft?t.Side===P.EdgeSide.esLeft?(this.ReversePolyPtLinks(a),a.Next=o,o.Prev=a,s.Next=l,l.Prev=s,e.Pts=l):(l.Next=o,o.Prev=l,a.Prev=s,s.Next=a,e.Pts=a):t.Side===P.EdgeSide.esRight?(this.ReversePolyPtLinks(a),s.Next=l,l.Prev=s,a.Next=o,o.Prev=a):(s.Next=a,a.Prev=s,o.Prev=l,l.Next=o),e.BottomPt=null,r===n&&(n.FirstLeft!==e&&(e.FirstLeft=n.FirstLeft),e.IsHole=n.IsHole),n.Pts=null,n.BottomPt=null,n.FirstLeft=e;var u=i.OutIdx,c=t.OutIdx;i.OutIdx=-1,t.OutIdx=-1;for(var d=this.m_ActiveEdges;d!==null;){if(d.OutIdx===c){d.OutIdx=u,d.Side=i.Side;break}d=d.NextInAEL}n.Idx=e.Idx};P.Clipper.prototype.ReversePolyPtLinks=function(i){if(i!==null){var t,e;t=i;do e=t.Next,t.Next=t.Prev,t.Prev=e,t=e;while(t!==i)}};P.Clipper.SwapSides=function(i,t){var e=i.Side;i.Side=t.Side,t.Side=e};P.Clipper.SwapPolyIndexes=function(i,t){var e=i.OutIdx;i.OutIdx=t.OutIdx,t.OutIdx=e};P.Clipper.prototype.IntersectEdges=function(i,t,e){var n=i.OutIdx>=0,r=t.OutIdx>=0;if(P.use_xyz&&this.SetZ(e,i,t),P.use_lines&&(i.WindDelta===0||t.WindDelta===0)){if(i.WindDelta===0&&t.WindDelta===0)return;i.PolyTyp===t.PolyTyp&&i.WindDelta!==t.WindDelta&&this.m_ClipType===P.ClipType.ctUnion?i.WindDelta===0?r&&(this.AddOutPt(i,e),n&&(i.OutIdx=-1)):n&&(this.AddOutPt(t,e),r&&(t.OutIdx=-1)):i.PolyTyp!==t.PolyTyp&&(i.WindDelta===0&&Math.abs(t.WindCnt)===1&&(this.m_ClipType!==P.ClipType.ctUnion||t.WindCnt2===0)?(this.AddOutPt(i,e),n&&(i.OutIdx=-1)):t.WindDelta===0&&Math.abs(i.WindCnt)===1&&(this.m_ClipType!==P.ClipType.ctUnion||i.WindCnt2===0)&&(this.AddOutPt(t,e),r&&(t.OutIdx=-1)));return}if(i.PolyTyp===t.PolyTyp)if(this.IsEvenOddFillType(i)){var o=i.WindCnt;i.WindCnt=t.WindCnt,t.WindCnt=o}else i.WindCnt+t.WindDelta===0?i.WindCnt=-i.WindCnt:i.WindCnt+=t.WindDelta,t.WindCnt-i.WindDelta===0?t.WindCnt=-t.WindCnt:t.WindCnt-=i.WindDelta;else this.IsEvenOddFillType(t)?i.WindCnt2=i.WindCnt2===0?1:0:i.WindCnt2+=t.WindDelta,this.IsEvenOddFillType(i)?t.WindCnt2=t.WindCnt2===0?1:0:t.WindCnt2-=i.WindDelta;var s,a,l,u;i.PolyTyp===P.PolyType.ptSubject?(s=this.m_SubjFillType,l=this.m_ClipFillType):(s=this.m_ClipFillType,l=this.m_SubjFillType),t.PolyTyp===P.PolyType.ptSubject?(a=this.m_SubjFillType,u=this.m_ClipFillType):(a=this.m_ClipFillType,u=this.m_SubjFillType);var c,d;switch(s){case P.PolyFillType.pftPositive:c=i.WindCnt;break;case P.PolyFillType.pftNegative:c=-i.WindCnt;break;default:c=Math.abs(i.WindCnt);break}switch(a){case P.PolyFillType.pftPositive:d=t.WindCnt;break;case P.PolyFillType.pftNegative:d=-t.WindCnt;break;default:d=Math.abs(t.WindCnt);break}if(n&&r)c!==0&&c!==1||d!==0&&d!==1||i.PolyTyp!==t.PolyTyp&&this.m_ClipType!==P.ClipType.ctXor?this.AddLocalMaxPoly(i,t,e):(this.AddOutPt(i,e),this.AddOutPt(t,e),P.Clipper.SwapSides(i,t),P.Clipper.SwapPolyIndexes(i,t));else if(n)(d===0||d===1)&&(this.AddOutPt(i,e),P.Clipper.SwapSides(i,t),P.Clipper.SwapPolyIndexes(i,t));else if(r)(c===0||c===1)&&(this.AddOutPt(t,e),P.Clipper.SwapSides(i,t),P.Clipper.SwapPolyIndexes(i,t));else if((c===0||c===1)&&(d===0||d===1)){var f,g;switch(l){case P.PolyFillType.pftPositive:f=i.WindCnt2;break;case P.PolyFillType.pftNegative:f=-i.WindCnt2;break;default:f=Math.abs(i.WindCnt2);break}switch(u){case P.PolyFillType.pftPositive:g=t.WindCnt2;break;case P.PolyFillType.pftNegative:g=-t.WindCnt2;break;default:g=Math.abs(t.WindCnt2);break}if(i.PolyTyp!==t.PolyTyp)this.AddLocalMinPoly(i,t,e);else if(c===1&&d===1)switch(this.m_ClipType){case P.ClipType.ctIntersection:f>0&&g>0&&this.AddLocalMinPoly(i,t,e);break;case P.ClipType.ctUnion:f<=0&&g<=0&&this.AddLocalMinPoly(i,t,e);break;case P.ClipType.ctDifference:(i.PolyTyp===P.PolyType.ptClip&&f>0&&g>0||i.PolyTyp===P.PolyType.ptSubject&&f<=0&&g<=0)&&this.AddLocalMinPoly(i,t,e);break;case P.ClipType.ctXor:this.AddLocalMinPoly(i,t,e);break}else P.Clipper.SwapSides(i,t)}};P.Clipper.prototype.DeleteFromSEL=function(i){var t=i.PrevInSEL,e=i.NextInSEL;t===null&&e===null&&i!==this.m_SortedEdges||(t!==null?t.NextInSEL=e:this.m_SortedEdges=e,e!==null&&(e.PrevInSEL=t),i.NextInSEL=null,i.PrevInSEL=null)};P.Clipper.prototype.ProcessHorizontals=function(){for(var i={};this.PopEdgeFromSEL(i);)this.ProcessHorizontal(i.v)};P.Clipper.prototype.GetHorzDirection=function(i,t){i.Bot.X=s.Top.X&&(l=null)}else{for(;l.Next!==null&&l.Next.X=0&&!o&&this.AddOutPt(i,new P.FPoint2(l.X,i.Bot.Y)),l=l.Next;else for(;l!==null&&l.X>d.Curr.X;)i.OutIdx>=0&&!o&&this.AddOutPt(i,new P.FPoint2(l.X,i.Bot.Y)),l=l.Prev;if(e===P.Direction.dLeftToRight&&d.Curr.X>r||e===P.Direction.dRightToLeft&&d.Curr.X=0&&!o){P.use_xyz&&(e===P.Direction.dLeftToRight?this.SetZ(d.Curr,i,d):this.SetZ(d.Curr,d,i)),u=this.AddOutPt(i,d.Curr);for(var f=this.m_SortedEdges;f!==null;){if(f.OutIdx>=0&&this.HorzSegmentsOverlap(i.Bot.X,i.Top.X,f.Bot.X,f.Top.X)){var g=this.GetLastOutPt(f);this.AddJoin(g,u,f.Top)}f=f.NextInSEL}this.AddGhostJoin(u,i.Bot)}if(d===a&&c){i.OutIdx>=0&&this.AddLocalMaxPoly(i,a,i.Top),this.DeleteFromAEL(i),this.DeleteFromAEL(a);return}if(e===P.Direction.dLeftToRight){var x=new P.FPoint2(d.Curr.X,i.Curr.Y);this.IntersectEdges(i,d,x)}else{var x=new P.FPoint2(d.Curr.X,i.Curr.Y);this.IntersectEdges(d,i,x)}var m=this.GetNextInAEL(d,e);this.SwapPositionsInAEL(i,d),d=m}if(i.NextInLML===null||!P.ClipperBase.IsHorizontal(i.NextInLML))break;i=this.UpdateEdgeIntoAEL(i),i.OutIdx>=0&&this.AddOutPt(i,i.Bot),t={Dir:e,Left:n,Right:r},this.GetHorzDirection(i,t),e=t.Dir,n=t.Left,r=t.Right}if(i.OutIdx>=0&&u===null){u=this.GetLastOutPt(i);for(var f=this.m_SortedEdges;f!==null;){if(f.OutIdx>=0&&this.HorzSegmentsOverlap(i.Bot.X,i.Top.X,f.Bot.X,f.Top.X)){var g=this.GetLastOutPt(f);this.AddJoin(g,u,f.Top)}f=f.NextInSEL}this.AddGhostJoin(u,i.Top)}if(i.NextInLML!==null)if(i.OutIdx>=0){if(u=this.AddOutPt(i,i.Top),i=this.UpdateEdgeIntoAEL(i),i.WindDelta===0)return;var v=i.PrevInAEL,m=i.NextInAEL;if(v!==null&&v.Curr.X===i.Bot.X&&v.Curr.Y===i.Bot.Y&&v.WindDelta===0&&v.OutIdx>=0&&v.Curr.Y>v.Top.Y&&P.ClipperBase.SlopesEqual3(i,v)){var g=this.AddOutPt(v,i.Bot);this.AddJoin(u,g,i.Top)}else if(m!==null&&m.Curr.X===i.Bot.X&&m.Curr.Y===i.Bot.Y&&m.WindDelta!==0&&m.OutIdx>=0&&m.Curr.Y>m.Top.Y&&P.ClipperBase.SlopesEqual3(i,m)){var g=this.AddOutPt(m,i.Bot);this.AddJoin(u,g,i.Top)}}else i=this.UpdateEdgeIntoAEL(i);else i.OutIdx>=0&&this.AddOutPt(i,i.Top),this.DeleteFromAEL(i)};P.Clipper.prototype.GetNextInAEL=function(i,t){return t===P.Direction.dLeftToRight?i.NextInAEL:i.PrevInAEL};P.Clipper.prototype.IsMinima=function(i){return i!==null&&i.Prev.NextInLML!==i&&i.Next.NextInLML!==i};P.Clipper.prototype.IsMaxima=function(i,t){return i!==null&&i.Top.Y===t&&i.NextInLML===null};P.Clipper.prototype.IsIntermediate=function(i,t){return i.Top.Y===t&&i.NextInLML!==null};P.Clipper.prototype.GetMaximaPair=function(i){return P.FPoint.op_Equality(i.Next.Top,i.Top)&&i.Next.NextInLML===null?i.Next:P.FPoint.op_Equality(i.Prev.Top,i.Top)&&i.Prev.NextInLML===null?i.Prev:null};P.Clipper.prototype.GetMaximaPairEx=function(i){var t=this.GetMaximaPair(i);return t===null||t.OutIdx===P.ClipperBase.Skip||t.NextInAEL===t.PrevInAEL&&!P.ClipperBase.IsHorizontal(t)?null:t};P.Clipper.prototype.ProcessIntersections=function(i){if(this.m_ActiveEdges===null)return!0;try{if(this.BuildIntersectList(i),this.m_IntersectList.length===0)return!0;if(this.m_IntersectList.length===1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch{this.m_SortedEdges=null,this.m_IntersectList.length=0,P.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0};P.Clipper.prototype.BuildIntersectList=function(i){if(this.m_ActiveEdges!==null){var t=this.m_ActiveEdges;for(this.m_SortedEdges=t;t!==null;)t.PrevInSEL=t.PrevInAEL,t.NextInSEL=t.NextInAEL,t.Curr.X=P.Clipper.TopX(t,i),t=t.NextInAEL;for(var e=!0;e&&this.m_SortedEdges!==null;){for(e=!1,t=this.m_SortedEdges;t.NextInSEL!==null;){var n=t.NextInSEL,r=new P.FPoint0;if(t.Curr.X>n.Curr.X){this.IntersectPoint(t,n,r),r.Yt.Top.Y)return e.Y=i.Top.Y,e.X=P.Clipper.TopX(t,i.Top.Y),e.Xi.Curr.Y&&(e.Y=i.Curr.Y,Math.abs(i.Dx)>Math.abs(t.Dx)?e.X=P.Clipper.TopX(t,e.Y):e.X=P.Clipper.TopX(i,e.Y))};P.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(i){for(var t=this.m_ActiveEdges;t!==null;){var e=this.IsMaxima(t,i);if(e){var n=this.GetMaximaPairEx(t);e=n===null||!P.ClipperBase.IsHorizontal(n)}if(e){this.StrictlySimple&&this.InsertMaxima(t.Top.X);var r=t.PrevInAEL;this.DoMaxima(t),r===null?t=this.m_ActiveEdges:t=r.NextInAEL}else{if(this.IsIntermediate(t,i)&&P.ClipperBase.IsHorizontal(t.NextInLML)?(t=this.UpdateEdgeIntoAEL(t),t.OutIdx>=0&&this.AddOutPt(t,t.Bot),this.AddEdgeToSEL(t)):(t.Curr.X=P.Clipper.TopX(t,i),t.Curr.Y=i),P.use_xyz&&(t.Top.Y===i?t.Curr.Z=t.Top.Z:t.Bot.Y===i?t.Curr.Z=t.Bot.Z:t.Curr.Z=0),this.StrictlySimple){var r=t.PrevInAEL;if(t.OutIdx>=0&&t.WindDelta!==0&&r!==null&&r.OutIdx>=0&&r.Curr.X===t.Curr.X&&r.WindDelta!==0){var o=new P.FPoint1(t.Curr);P.use_xyz&&this.SetZ(o,r,t);var s=this.AddOutPt(r,o),a=this.AddOutPt(t,o);this.AddJoin(s,a,o)}}t=t.NextInAEL}}for(this.ProcessHorizontals(),this.m_Maxima=null,t=this.m_ActiveEdges;t!==null;){if(this.IsIntermediate(t,i)){var s=null;t.OutIdx>=0&&(s=this.AddOutPt(t,t.Top)),t=this.UpdateEdgeIntoAEL(t);var r=t.PrevInAEL,l=t.NextInAEL;if(r!==null&&r.Curr.X===t.Bot.X&&r.Curr.Y===t.Bot.Y&&s!==null&&r.OutIdx>=0&&r.Curr.Y===r.Top.Y&&P.ClipperBase.SlopesEqual5(t.Curr,t.Top,r.Curr,r.Top)&&t.WindDelta!==0&&r.WindDelta!==0){var a=this.AddOutPt(ePrev2,t.Bot);this.AddJoin(s,a,t.Top)}else if(l!==null&&l.Curr.X===t.Bot.X&&l.Curr.Y===t.Bot.Y&&s!==null&&l.OutIdx>=0&&l.Curr.Y===l.Top.Y&&P.ClipperBase.SlopesEqual5(t.Curr,t.Top,l.Curr,l.Top)&&t.WindDelta!==0&&l.WindDelta!==0){var a=this.AddOutPt(l,t.Bot);this.AddJoin(s,a,t.Top)}}t=t.NextInAEL}};P.Clipper.prototype.DoMaxima=function(i){var t=this.GetMaximaPairEx(i);if(t===null){i.OutIdx>=0&&this.AddOutPt(i,i.Top),this.DeleteFromAEL(i);return}for(var e=i.NextInAEL;e!==null&&e!==t;)this.IntersectEdges(i,e,i.Top),this.SwapPositionsInAEL(i,e),e=i.NextInAEL;i.OutIdx===-1&&t.OutIdx===-1?(this.DeleteFromAEL(i),this.DeleteFromAEL(t)):i.OutIdx>=0&&t.OutIdx>=0?(i.OutIdx>=0&&this.AddLocalMaxPoly(i,t,i.Top),this.DeleteFromAEL(i),this.DeleteFromAEL(t)):P.use_lines&&i.WindDelta===0?(i.OutIdx>=0&&(this.AddOutPt(i,i.Top),i.OutIdx=P.ClipperBase.Unassigned),this.DeleteFromAEL(i),t.OutIdx>=0&&(this.AddOutPt(t,i.Top),t.OutIdx=P.ClipperBase.Unassigned),this.DeleteFromAEL(t)):P.Error("DoMaxima error")};P.Clipper.ReversePaths=function(i){for(var t=0,e=i.length;t=0};P.Clipper.prototype.PointCount=function(i){if(i===null)return 0;var t=0,e=i;do t++,e=e.Next;while(e!==i);return t};P.Clipper.prototype.BuildResult=function(i){P.Clear(i);for(var t=0,e=this.m_PolyOuts.length;tt.Pt.X?P.Direction.dRightToLeft:P.Direction.dLeftToRight,a=e.Pt.X>n.Pt.X?P.Direction.dRightToLeft:P.Direction.dLeftToRight;if(s===a)return!1;if(s===P.Direction.dLeftToRight){for(;i.Next.Pt.X<=r.X&&i.Next.Pt.X>=i.Pt.X&&i.Next.Pt.Y===r.Y;)i=i.Next;o&&i.Pt.X!==r.X&&(i=i.Next),t=this.DupOutPt(i,!o),P.FPoint.op_Inequality(t.Pt,r)&&(i=t,i.Pt.X=r.X,i.Pt.Y=r.Y,P.use_xyz&&(i.Pt.Z=r.Z),t=this.DupOutPt(i,!o))}else{for(;i.Next.Pt.X>=r.X&&i.Next.Pt.X<=i.Pt.X&&i.Next.Pt.Y===r.Y;)i=i.Next;!o&&i.Pt.X!==r.X&&(i=i.Next),t=this.DupOutPt(i,o),P.FPoint.op_Inequality(t.Pt,r)&&(i=t,i.Pt.X=r.X,i.Pt.Y=r.Y,P.use_xyz&&(i.Pt.Z=r.Z),t=this.DupOutPt(i,o))}if(a===P.Direction.dLeftToRight){for(;e.Next.Pt.X<=r.X&&e.Next.Pt.X>=e.Pt.X&&e.Next.Pt.Y===r.Y;)e=e.Next;o&&e.Pt.X!==r.X&&(e=e.Next),n=this.DupOutPt(e,!o),P.FPoint.op_Inequality(n.Pt,r)&&(e=n,e.Pt.X=r.X,e.Pt.Y=r.Y,P.use_xyz&&(e.Pt.Z=r.Z),n=this.DupOutPt(e,!o))}else{for(;e.Next.Pt.X>=r.X&&e.Next.Pt.X<=e.Pt.X&&e.Next.Pt.Y===r.Y;)e=e.Next;!o&&e.Pt.X!==r.X&&(e=e.Next),n=this.DupOutPt(e,o),P.FPoint.op_Inequality(n.Pt,r)&&(e=n,e.Pt.X=r.X,e.Pt.Y=r.Y,P.use_xyz&&(e.Pt.Z=r.Z),n=this.DupOutPt(e,o))}return s===P.Direction.dLeftToRight===o?(i.Prev=e,e.Next=i,t.Next=n,n.Prev=t):(i.Next=e,e.Prev=i,t.Prev=n,n.Next=t),!0};P.Clipper.prototype.JoinPoints=function(i,t,e){var n=i.OutPt1,r=new P.OutPt,o=i.OutPt2,s=new P.OutPt,a=i.OutPt1.Pt.Y===i.OffPt.Y;if(a&&P.FPoint.op_Equality(i.OffPt,i.OutPt1.Pt)&&P.FPoint.op_Equality(i.OffPt,i.OutPt2.Pt)){if(t!==e)return!1;for(r=i.OutPt1.Next;r!==n&&P.FPoint.op_Equality(r.Pt,i.OffPt);)r=r.Next;var l=r.Pt.Y>i.OffPt.Y;for(s=i.OutPt2.Next;s!==o&&P.FPoint.op_Equality(s.Pt,i.OffPt);)s=s.Next;var u=s.Pt.Y>i.OffPt.Y;return l===u?!1:l?(r=this.DupOutPt(n,!1),s=this.DupOutPt(o,!0),n.Prev=o,o.Next=n,r.Next=s,s.Prev=r,i.OutPt1=n,i.OutPt2=r,!0):(r=this.DupOutPt(n,!0),s=this.DupOutPt(o,!1),n.Next=o,o.Prev=n,r.Prev=s,s.Next=r,i.OutPt1=n,i.OutPt2=r,!0)}else if(a){for(r=n;n.Prev.Pt.Y===n.Pt.Y&&n.Prev!==r&&n.Prev!==o;)n=n.Prev;for(;r.Next.Pt.Y===r.Pt.Y&&r.Next!==n&&r.Next!==o;)r=r.Next;if(r.Next===n||r.Next===o)return!1;for(s=o;o.Prev.Pt.Y===o.Pt.Y&&o.Prev!==s&&o.Prev!==r;)o=o.Prev;for(;s.Next.Pt.Y===s.Pt.Y&&s.Next!==o&&s.Next!==n;)s=s.Next;if(s.Next===o||s.Next===n)return!1;var c={Left:null,Right:null};if(!this.GetOverlap(n.Pt.X,r.Pt.X,o.Pt.X,s.Pt.X,c))return!1;var d=c.Left,f=c.Right,g=new P.FPoint0,x;return n.Pt.X>=d&&n.Pt.X<=f?(g.X=n.Pt.X,g.Y=n.Pt.Y,P.use_xyz&&(g.Z=n.Pt.Z),x=n.Pt.X>r.Pt.X):o.Pt.X>=d&&o.Pt.X<=f?(g.X=o.Pt.X,g.Y=o.Pt.Y,P.use_xyz&&(g.Z=o.Pt.Z),x=o.Pt.X>s.Pt.X):r.Pt.X>=d&&r.Pt.X<=f?(g.X=r.Pt.X,g.Y=r.Pt.Y,P.use_xyz&&(g.Z=r.Pt.Z),x=r.Pt.X>n.Pt.X):(g.X=s.Pt.X,g.Y=s.Pt.Y,P.use_xyz&&(g.Z=s.Pt.Z),x=s.Pt.X>o.Pt.X),i.OutPt1=n,i.OutPt2=o,this.JoinHorz(n,r,o,s,g,x)}else{for(r=n.Next;P.FPoint.op_Equality(r.Pt,n.Pt)&&r!==n;)r=r.Next;var m=r.Pt.Y>n.Pt.Y||!P.ClipperBase.SlopesEqual4(n.Pt,r.Pt,i.OffPt);if(m){for(r=n.Prev;P.FPoint.op_Equality(r.Pt,n.Pt)&&r!==n;)r=r.Prev;if(r.Pt.Y>n.Pt.Y||!P.ClipperBase.SlopesEqual4(n.Pt,r.Pt,i.OffPt))return!1}for(s=o.Next;P.FPoint.op_Equality(s.Pt,o.Pt)&&s!==o;)s=s.Next;var v=s.Pt.Y>o.Pt.Y||!P.ClipperBase.SlopesEqual4(o.Pt,s.Pt,i.OffPt);if(v){for(s=o.Prev;P.FPoint.op_Equality(s.Pt,o.Pt)&&s!==o;)s=s.Prev;if(s.Pt.Y>o.Pt.Y||!P.ClipperBase.SlopesEqual4(o.Pt,s.Pt,i.OffPt))return!1}return r===n||s===o||r===s||t===e&&m===v?!1:m?(r=this.DupOutPt(n,!1),s=this.DupOutPt(o,!0),n.Prev=o,o.Next=n,r.Next=s,s.Prev=r,i.OutPt1=n,i.OutPt2=r,!0):(r=this.DupOutPt(n,!0),s=this.DupOutPt(o,!1),n.Next=o,o.Prev=n,r.Prev=s,s.Next=r,i.OutPt1=n,i.OutPt2=r,!0)}};P.Clipper.GetBounds=function(i){for(var t=0,e=i.length;tn.right&&(n.right=i[t][r].X),i[t][r].Yn.bottom&&(n.bottom=i[t][r].Y);return n};P.Clipper.prototype.GetBounds2=function(i){var t=i,e=new P.FRect;for(e.left=i.Pt.X,e.right=i.Pt.X,e.top=i.Pt.Y,e.bottom=i.Pt.Y,i=i.Next;i!==t;)i.Pt.Xe.right&&(e.right=i.Pt.X),i.Pt.Ye.bottom&&(e.bottom=i.Pt.Y),i=i.Next;return e};P.Clipper.PointInPolygon=function(i,t){var e=0,n=t.length;if(n<3)return 0;for(var r=t[0],o=1;o<=n;++o){var s=o===n?t[0]:t[o];if(s.Y===i.Y&&(s.X===i.X||r.Y===i.Y&&s.X>i.X==r.X=i.X)if(s.X>i.X)e=1-e;else{var a=(r.X-i.X)*(s.Y-i.Y)-(s.X-i.X)*(r.Y-i.Y);if(a===0)return-1;a>0==s.Y>r.Y&&(e=1-e)}else if(s.X>i.X){var a=(r.X-i.X)*(s.Y-i.Y)-(s.X-i.X)*(r.Y-i.Y);if(a===0)return-1;a>0==s.Y>r.Y&&(e=1-e)}}r=s}return e};P.Clipper.prototype.PointInPolygon=function(i,t){var e=0,n=t,r=i.X,o=i.Y,s=t.Pt.X,a=t.Pt.Y;do{t=t.Next;var l=t.Pt.X,u=t.Pt.Y;if(u===o&&(l===r||a===o&&l>r==s=r)if(l>r)e=1-e;else{var c=(s-r)*(u-o)-(l-r)*(a-o);if(c===0)return-1;c>0==u>a&&(e=1-e)}else if(l>r){var c=(s-r)*(u-o)-(l-r)*(a-o);if(c===0)return-1;c>0==u>a&&(e=1-e)}}s=l,a=u}while(n!==t);return e};P.Clipper.prototype.Poly2ContainsPoly1=function(i,t){var e=i;do{var n=this.PointInPolygon(e.Pt,t);if(n>=0)return n>0;e=e.Next}while(e!==i);return!0};P.Clipper.prototype.FixupFirstLefts1=function(i,t){for(var e,n,r=0,o=this.m_PolyOuts.length;r0&&this.ReversePolyPtLinks(r.Pts)):this.Poly2ContainsPoly1(n.Pts,r.Pts)?(r.IsHole=n.IsHole,n.IsHole=!r.IsHole,r.FirstLeft=n.FirstLeft,n.FirstLeft=r,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,r),(n.IsHole^this.ReverseSolution)==this.Area$1(n)>0&&this.ReversePolyPtLinks(n.Pts)):(r.IsHole=n.IsHole,r.FirstLeft=n.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(n,r))):(r.Pts=null,r.BottomPt=null,r.Idx=n.Idx,n.IsHole=o.IsHole,o===r&&(n.FirstLeft=r.FirstLeft),r.FirstLeft=n,this.m_UsingPolyTree&&this.FixupFirstLefts3(r,n)))}}};P.Clipper.prototype.UpdateOutPtIdxs=function(i){var t=i.Pts;do t.Idx=i.Idx,t=t.Prev;while(t!==i.Pts)};P.Clipper.prototype.DoSimplePolygons=function(){for(var i=0;i"u"&&(t=P.PolyFillType.pftEvenOdd);var e=new Array,n=new P.Clipper(0);return n.StrictlySimple=!0,n.AddPaths(i,P.PolyType.ptSubject,!0),n.Execute(P.ClipType.ctUnion,e,t,t),e};P.Clipper.DistanceSqrd=function(i,t){var e=i.X-t.X,n=i.Y-t.Y;return e*e+n*n};P.Clipper.DistanceFromLineSqrd=function(i,t,e){var n=t.Y-e.Y,r=e.X-t.X,o=n*t.X+r*t.Y;return o=n*i.X+r*i.Y-o,o*o/(n*n+r*r)};P.Clipper.SlopesNearCollinear=function(i,t,e,n){return Math.abs(i.X-t.X)>Math.abs(i.Y-t.Y)?i.X>t.X==i.Xi.X==t.Xt.Y==i.Yi.Y==t.Y"u"&&(t=1.415);var e=i.length;if(e===0)return new Array;for(var n=new Array(e),r=0;r0&&n&&e.push(i.m_polygon);for(var r=0,o=i.Childs(),s=o.length,a=o[r];r"u"&&(i=2),typeof t>"u"&&(t=P.ClipperOffset.def_arc_tolerance),this.m_destPolys=new P.Paths,this.m_srcPoly=new P.Path,this.m_destPoly=new P.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new P.FPoint0,this.m_polyNodes=new P.PolyNode,this.MiterLimit=i,this.ArcTolerance=t,this.m_lowest.X=-1};P.ClipperOffset.two_pi=6.28318530717959;P.ClipperOffset.def_arc_tolerance=.25;P.ClipperOffset.prototype.Clear=function(){P.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1};P.ClipperOffset.prototype.AddPath=function(i,t,e){var n=i.length-1;if(!(n<0)){var r=new P.PolyNode;if(r.m_jointype=t,r.m_endtype=e,e===P.EndType.etClosedLine||e===P.EndType.etClosedPolygon)for(;n>0&&P.FPoint.op_Equality(i[0],i[n]);)n--;r.m_polygon.push(i[0]);for(var o=0,s=0,a=1;a<=n;a++)P.FPoint.op_Inequality(r.m_polygon[o],i[a])&&(o++,r.m_polygon.push(i[a]),(i[a].Y>r.m_polygon[s].Y||i[a].Y===r.m_polygon[s].Y&&i[a].Xl.Y||r.m_polygon[s].Y===l.Y&&r.m_polygon[s].X=0&&!P.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var i=0;i2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var n;this.ArcTolerance<=0?n=P.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(i)*P.ClipperOffset.def_arc_tolerance?n=Math.abs(i)*P.ClipperOffset.def_arc_tolerance:n=this.ArcTolerance;var r=3.14159265358979/Math.acos(1-n/Math.abs(i));this.m_sin=Math.sin(P.ClipperOffset.two_pi/r),this.m_cos=Math.cos(P.ClipperOffset.two_pi/r),this.m_StepsPerRad=r/P.ClipperOffset.two_pi,i<0&&(this.m_sin=-this.m_sin);for(var t=0;t0;l--)this.m_normals[l]=new P.FPoint2(-this.m_normals[l-1].X,-this.m_normals[l-1].Y);this.m_normals[0]=new P.FPoint2(-d.X,-d.Y),c=0;for(var l=o-1;l>=0;l--)c=this.OffsetPoint(l,c,e.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var c=0,l=1;l0;l--)this.m_normals[l]=new P.FPoint2(-this.m_normals[l-1].X,-this.m_normals[l-1].Y);this.m_normals[0]=new P.FPoint2(-this.m_normals[1].X,-this.m_normals[1].Y),c=o-1;for(var l=c-1;l>0;--l)c=this.OffsetPoint(l,c,e.m_jointype);e.m_endtype===P.EndType.etOpenButt?(f=new P.FPoint2(this.m_srcPoly[0].X-this.m_normals[0].X*i,this.m_srcPoly[0].Y-this.m_normals[0].Y*i),this.m_destPoly.push(f),f=new P.FPoint2(this.m_srcPoly[0].X+this.m_normals[0].X*i,this.m_srcPoly[0].Y+this.m_normals[0].Y*i),this.m_destPoly.push(f)):(c=1,this.m_sinA=0,e.m_endtype===P.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}};P.ClipperOffset.prototype.Execute=function(){var i=arguments,t=i[0]instanceof P.PolyTree;if(t){var e=i[0],n=i[1];e.Clear(),this.FixOrientations(),this.DoOffset(n);var r=new P.Clipper(0);if(r.AddPaths(this.m_destPolys,P.PolyType.ptSubject,!0),n>0)r.Execute(P.ClipType.ctUnion,e,P.PolyFillType.pftPositive,P.PolyFillType.pftPositive);else{var o=P.Clipper.GetBounds(this.m_destPolys),s=new P.Path;if(s.push(new P.FPoint2(o.left-10,o.bottom+10)),s.push(new P.FPoint2(o.right+10,o.bottom+10)),s.push(new P.FPoint2(o.right+10,o.top-10)),s.push(new P.FPoint2(o.left-10,o.top-10)),r.AddPath(s,P.PolyType.ptSubject,!0),r.ReverseSolution=!0,r.Execute(P.ClipType.ctUnion,e,P.PolyFillType.pftNegative,P.PolyFillType.pftNegative),e.ChildCount()===1&&e.Childs()[0].ChildCount()>0){var a=e.Childs()[0];e.Childs()[0]=a.Childs()[0],e.Childs()[0].m_Parent=e;for(var l=1;l0)r.Execute(P.ClipType.ctUnion,e,P.PolyFillType.pftPositive,P.PolyFillType.pftPositive);else{var o=P.Clipper.GetBounds(this.m_destPolys),s=new P.Path;s.push(new P.FPoint2(o.left-10,o.bottom+10)),s.push(new P.FPoint2(o.right+10,o.bottom+10)),s.push(new P.FPoint2(o.right+10,o.top-10)),s.push(new P.FPoint2(o.left-10,o.top-10)),r.AddPath(s,P.PolyType.ptSubject,!0),r.ReverseSolution=!0,r.Execute(P.ClipType.ctUnion,e,P.PolyFillType.pftNegative,P.PolyFillType.pftNegative),e.length>0&&e.splice(0,1)}}};P.ClipperOffset.prototype.OffsetPoint=function(i,t,e){if(this.m_sinA=this.m_normals[t].X*this.m_normals[i].Y-this.m_normals[i].X*this.m_normals[t].Y,this.m_sinA===0)return t;if(this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1),this.m_sinA*this.m_delta<0)this.m_destPoly.push(new P.FPoint2(this.m_srcPoly[i].X+this.m_normals[t].X*this.m_delta,this.m_srcPoly[i].Y+this.m_normals[t].Y*this.m_delta)),this.m_destPoly.push(new P.FPoint1(this.m_srcPoly[i])),this.m_destPoly.push(new P.FPoint2(this.m_srcPoly[i].X+this.m_normals[i].X*this.m_delta,this.m_srcPoly[i].Y+this.m_normals[i].Y*this.m_delta));else switch(e){case P.JoinType.jtMiter:{var n=1+(this.m_normals[i].X*this.m_normals[t].X+this.m_normals[i].Y*this.m_normals[t].Y);n>=this.m_miterLim?this.DoMiter(i,t,n):this.DoSquare(i,t);break}case P.JoinType.jtSquare:this.DoSquare(i,t);break;case P.JoinType.jtRound:this.DoRound(i,t);break}return t=i,t};P.ClipperOffset.prototype.DoSquare=function(i,t){var e=Math.tan(Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[i].X+this.m_normals[t].Y*this.m_normals[i].Y)/4);this.m_destPoly.push(new P.FPoint2(this.m_srcPoly[i].X+this.m_delta*(this.m_normals[t].X-this.m_normals[t].Y*e),this.m_srcPoly[i].Y+this.m_delta*(this.m_normals[t].Y+this.m_normals[t].X*e))),this.m_destPoly.push(new P.FPoint2(this.m_srcPoly[i].X+this.m_delta*(this.m_normals[i].X+this.m_normals[i].Y*e),this.m_srcPoly[i].Y+this.m_delta*(this.m_normals[i].Y-this.m_normals[i].X*e)))};P.ClipperOffset.prototype.DoMiter=function(i,t,e){var n=this.m_delta/e;this.m_destPoly.push(new P.FPoint2(this.m_srcPoly[i].X+(this.m_normals[t].X+this.m_normals[i].X)*n,this.m_srcPoly[i].Y+(this.m_normals[t].Y+this.m_normals[i].Y)*n))};P.ClipperOffset.prototype.DoRound=function(i,t){for(var e=Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[i].X+this.m_normals[t].Y*this.m_normals[i].Y),n=Math.max(Math.round(this.m_StepsPerRad*Math.abs(e)),1),r=this.m_normals[t].X,o=this.m_normals[t].Y,s,a=0;a1?(b=c.X,k=c.Y):O>0&&(b+=m*O,k+=v*O)),m=d.X-b,v=d.Y-k,f=m*m+v*v,f<=$&&(g[r+1]=1,r++);for(a.push({X:o[0].X,Y:o[0].Y}),r=1;r2&&Q.push(a)}return e||(Q=Q[0]),typeof Q>"u"&&(Q=[]),Q};P.JS.PerimeterOfPath=function(i,t){if(typeof i>"u")return 0;var e=Math.sqrt,n=0,r,o,s=0,a=0,l=0,u=0,c=i.length;if(c<2)return 0;for(t&&(i[c]=i[0],c++);--c;)r=i[c],s=r.X,a=r.Y,o=i[c-1],l=o.X,u=o.Y,n+=e((s-l)*(s-l)+(a-u)*(a-u));return t&&i.pop(),n};P.JS.PerimeterOfPaths=function(i,t){for(var e=0,n=0;n1e-8>Math.abs(i[0]-t[0])+Math.abs(i[1]-t[1]),M1=i=>{if(i.length===0)return!0;const t=i[0][0],e=i.at(-1).at(-1);return I1(t,e)};function Sl(i,t,e={}){const n={openSquare:0,openRound:1,openButt:2,closedLine:3,closedPolygon:4},r={square:0,round:1,miter:2};let o=e.endType;o in n||(o="closedPolygon");let s=e.joinType;s in r||(s="round");const a=e.miterLimit||2,l=e.arcTolerance||.1,u=n[o],c=r[s],d=O=>O.map(([b,k])=>({X:b,Y:k})),f=O=>O.map(({X:b,Y:k})=>[b,k]);M1(i);const g=i.map(d),x=new P.ClipperOffset(a,l);x.AddPaths(g,c,u);const m=new P.Paths;x.Execute(m,t);const v=m.map(f);for(;i.length>v.length;)i.pop();return v.forEach((O,b)=>{i[b]=O,i[b].push([O[0][0],O[0][1]])}),i}const $1="modulepreload",Q1=function(i,t){return new URL(i,t).href},Df={},N1=function(t,e,n){if(!e||e.length===0)return t();const r=document.getElementsByTagName("link");return Promise.all(e.map(o=>{if(o=Q1(o,n),o in Df)return;Df[o]=!0;const s=o.endsWith(".css"),a=s?'[rel="stylesheet"]':"";if(!!n)for(let c=r.length-1;c>=0;c--){const d=r[c];if(d.href===o&&(!s||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${a}`))return;const u=document.createElement("link");if(u.rel=s?"stylesheet":$1,s||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),s)return new Promise((c,d)=>{u.addEventListener("load",c),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>t()).catch(o=>{const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o})};let Gs,mu;(()=>{const i=new Map;Gs={register(a,l,u){i.set(a,{d:l,f:u,exp:{}})}};async function t(a,l){let u=a.replace(/\.\w+$/i,"");if(u.includes("./")){const[c,...d]=u.split("/").reverse(),[,...f]=l.split("/").reverse(),g=[c];let x=0,m;for(;m=d.shift();)if(m==="..")x++;else{if(m===".")break;g.push(m)}ximport(a),[],import.meta.url)}function e(a,l){return{id:a,import:u=>t(u,a),meta:{url:a,main:l}}}function n(a){return(l,u)=>{u=typeof l=="string"?{[l]:u}:l;for(const[c,d]of Object.entries(u))Object.defineProperty(a,c,{value:d,writable:!0,enumerable:!0})}}function r(a){for(const[l,u]of i.entries()){const{f:c,exp:d}=u,{execute:f,setters:g}=c(n(d),e(l,l===a));delete u.f,u.e=f,u.s=g}}async function o(a){if(!i.has(a))return;const l=i.get(a);if(l.s){const{d:u,e:c,s:d}=l;delete l.s,delete l.e;for(let g=0;g(Gs=mu=void 0,r(a),s(a))})();Gs.register("-/clipper-lib@v6.4.2-JisZmmhC7gDAFmHQLYDu/dist=es2020/clipper-lib",[],function(i,t){var e;t&&t.id;function n(o,s,a){return a={path:s,exports:{},require:function(l,u){return r(l,u??a.path)}},o(a,a.exports),a.exports}function r(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}return{setters:[],execute:function(){e=n(function(o){(function(){var s={};s.version="6.4.2.2",s.use_lines=!0,s.use_xyz=!1;var a=!1;o.exports?(o.exports=s,a=!0):typeof document<"u"?window.ClipperLib=s:self.ClipperLib=s;var l;if(a){var u="chrome";l="Netscape"}else{var u=navigator.userAgent.toString().toLowerCase();l=navigator.appName}var c={};u.indexOf("chrome")!=-1&&u.indexOf("chromium")==-1?c.chrome=1:c.chrome=0,u.indexOf("chromium")!=-1?c.chromium=1:c.chromium=0,u.indexOf("safari")!=-1&&u.indexOf("chrome")==-1&&u.indexOf("chromium")==-1?c.safari=1:c.safari=0,u.indexOf("firefox")!=-1?c.firefox=1:c.firefox=0,u.indexOf("firefox/17")!=-1?c.firefox17=1:c.firefox17=0,u.indexOf("firefox/15")!=-1?c.firefox15=1:c.firefox15=0,u.indexOf("firefox/3")!=-1?c.firefox3=1:c.firefox3=0,u.indexOf("opera")!=-1?c.opera=1:c.opera=0,u.indexOf("msie 10")!=-1?c.msie10=1:c.msie10=0,u.indexOf("msie 9")!=-1?c.msie9=1:c.msie9=0,u.indexOf("msie 8")!=-1?c.msie8=1:c.msie8=0,u.indexOf("msie 7")!=-1?c.msie7=1:c.msie7=0,u.indexOf("msie ")!=-1?c.msie=1:c.msie=0,s.biginteger_used=null;var d;function f(h,p,_){s.biginteger_used=1,h!=null&&(typeof h=="number"&&typeof p>"u"?this.fromInt(h):typeof h=="number"?this.fromNumber(h,p,_):p==null&&typeof h!="string"?this.fromString(h,256):this.fromString(h,p))}function g(){return new f(null,void 0,void 0)}function x(h,p,_,S,A,F){for(;--F>=0;){var Z=p*this[h++]+_[S]+A;A=Math.floor(Z/67108864),_[S++]=Z&67108863}return A}function m(h,p,_,S,A,F){for(var Z=p&32767,J=p>>15;--F>=0;){var K=this[h]&32767,lt=this[h++]>>15,St=J*K+lt*Z;K=Z*K+((St&32767)<<15)+_[S]+(A&1073741823),A=(K>>>30)+(St>>>15)+J*lt+(A>>>30),_[S++]=K&1073741823}return A}function v(h,p,_,S,A,F){for(var Z=p&16383,J=p>>14;--F>=0;){var K=this[h]&16383,lt=this[h++]>>14,St=J*K+lt*Z;K=Z*K+((St&16383)<<14)+_[S]+A,A=(K>>28)+(St>>14)+J*lt,_[S++]=K&268435455}return A}l=="Microsoft Internet Explorer"?(f.prototype.am=m,d=30):l!="Netscape"?(f.prototype.am=x,d=26):(f.prototype.am=v,d=28),f.prototype.DB=d,f.prototype.DM=(1<=0;--p)h[p]=this[p];h.t=this.t,h.s=this.s}function W(h){this.t=1,this.s=h<0?-1:0,h>0?this[0]=h:h<-1?this[0]=h+this.DV:this.t=0}function D(h){var p=g();return p.fromInt(h),p}function z(h,p){var _;if(p==16)_=4;else if(p==8)_=3;else if(p==256)_=8;else if(p==2)_=1;else if(p==32)_=5;else if(p==4)_=2;else{this.fromRadix(h,p);return}this.t=0,this.s=0;for(var S=h.length,A=!1,F=0;--S>=0;){var Z=_==8?h[S]&255:X(h,S);if(Z<0){h.charAt(S)=="-"&&(A=!0);continue}A=!1,F==0?this[this.t++]=Z:F+_>this.DB?(this[this.t-1]|=(Z&(1<>this.DB-F):this[this.t-1]|=Z<=this.DB&&(F-=this.DB)}_==8&&h[0]&128&&(this.s=-1,F>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==h;)--this.t}function U(h){if(this.s<0)return"-"+this.negate().toString(h);var p;if(h==16)p=4;else if(h==8)p=3;else if(h==2)p=1;else if(h==32)p=5;else if(h==4)p=2;else return this.toRadix(h);var _=(1<0)for(J>J)>0&&(A=!0,F=Q(S));Z>=0;)J>(J+=this.DB-p)):(S=this[Z]>>(J-=p)&_,J<=0&&(J+=this.DB,--Z)),S>0&&(A=!0),A&&(F+=Q(S));return A?F:"0"}function T(){var h=g();return f.ZERO.subTo(this,h),h}function H(){return this.s<0?this.negate():this}function gt(h){var p=this.s-h.s;if(p!=0)return p;var _=this.t;if(p=_-h.t,p!=0)return this.s<0?-p:p;for(;--_>=0;)if((p=this[_]-h[_])!=0)return p;return 0}function at(h){var p=1,_;return(_=h>>>16)!=0&&(h=_,p+=16),(_=h>>8)!=0&&(h=_,p+=8),(_=h>>4)!=0&&(h=_,p+=4),(_=h>>2)!=0&&(h=_,p+=2),(_=h>>1)!=0&&(h=_,p+=1),p}function Et(){return this.t<=0?0:this.DB*(this.t-1)+at(this[this.t-1]^this.s&this.DM)}function pt(h,p){var _;for(_=this.t-1;_>=0;--_)p[_+h]=this[_];for(_=h-1;_>=0;--_)p[_]=0;p.t=this.t+h,p.s=this.s}function Pt(h,p){for(var _=h;_=0;--J)p[J+F+1]=this[J]>>S|Z,Z=(this[J]&A)<<_;for(J=F-1;J>=0;--J)p[J]=0;p[F]=Z,p.t=this.t+F+1,p.s=this.s,p.clamp()}function it(h,p){p.s=this.s;var _=Math.floor(h/this.DB);if(_>=this.t){p.t=0;return}var S=h%this.DB,A=this.DB-S,F=(1<>S;for(var Z=_+1;Z>S;S>0&&(p[this.t-_-1]|=(this.s&F)<>=this.DB;if(h.t>=this.DB;S+=this.s}else{for(S+=this.s;_>=this.DB;S-=h.s}p.s=S<0?-1:0,S<-1?p[_++]=this.DV+S:S>0&&(p[_++]=S),p.t=_,p.clamp()}function kt(h,p){var _=this.abs(),S=h.abs(),A=_.t;for(p.t=A+S.t;--A>=0;)p[A]=0;for(A=0;A=0;)h[_]=0;for(_=0;_=p.DV&&(h[_+p.t]-=p.DV,h[_+p.t+1]=1)}h.t>0&&(h[h.t-1]+=p.am(_,p[_],h,2*_,0,1)),h.s=0,h.clamp()}function Kt(h,p,_){var S=h.abs();if(!(S.t<=0)){var A=this.abs();if(A.t0?(S.lShiftTo(K,F),A.lShiftTo(K,_)):(S.copyTo(F),A.copyTo(_));var lt=F.t,St=F[lt-1];if(St!=0){var Ot=St*(1<1?F[lt-2]>>this.F2:0),$t=this.FV/Ot,jt=(1<=0&&(_[_.t++]=1,_.subTo(ci,_)),f.ONE.dlShiftTo(lt,ci),ci.subTo(F,F);F.t=0;){var Fi=_[--ee]==St?this.DM:Math.floor(_[ee]*$t+(_[ee-1]+ue)*jt);if((_[ee]+=F.am(0,Fi,_,Se,0,lt))0&&_.rShiftTo(K,_),Z<0&&f.ZERO.subTo(_,_)}}}function Ct(h){var p=g();return this.abs().divRemTo(h,null,p),this.s<0&&p.compareTo(f.ZERO)>0&&h.subTo(p,p),p}function Wt(h){this.m=h}function Yt(h){return h.s<0||h.compareTo(this.m)>=0?h.mod(this.m):h}function te(h){return h}function Jt(h){h.divRemTo(this.m,null,h)}function xe(h,p,_){h.multiplyTo(p,_),this.reduce(_)}function oe(h,p){h.squareTo(p),this.reduce(p)}Wt.prototype.convert=Yt,Wt.prototype.revert=te,Wt.prototype.reduce=Jt,Wt.prototype.mulTo=xe,Wt.prototype.sqrTo=oe;function B(){if(this.t<1)return 0;var h=this[0];if(!(h&1))return 0;var p=h&3;return p=p*(2-(h&15)*p)&15,p=p*(2-(h&255)*p)&255,p=p*(2-((h&65535)*p&65535))&65535,p=p*(2-h*p%this.DV)%this.DV,p>0?this.DV-p:-p}function ut(h){this.m=h,this.mp=h.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(p,p),p}function G(h){var p=g();return h.copyTo(p),this.reduce(p),p}function V(h){for(;h.t<=this.mt2;)h[h.t++]=0;for(var p=0;p>15)*this.mpl&this.um)<<15)&h.DM;for(_=p+this.m.t,h[_]+=this.m.am(0,S,h,p,0,this.m.t);h[_]>=h.DV;)h[_]-=h.DV,h[++_]++}h.clamp(),h.drShiftTo(this.m.t,h),h.compareTo(this.m)>=0&&h.subTo(this.m,h)}function rt(h,p){h.squareTo(p),this.reduce(p)}function bt(h,p,_){h.multiplyTo(p,_),this.reduce(_)}ut.prototype.convert=ft,ut.prototype.revert=G,ut.prototype.reduce=V,ut.prototype.mulTo=bt,ut.prototype.sqrTo=rt;function wt(){return(this.t>0?this[0]&1:this.s)==0}function ot(h,p){if(h>4294967295||h<1)return f.ONE;var _=g(),S=g(),A=p.convert(this),F=at(h)-1;for(A.copyTo(_);--F>=0;)if(p.sqrTo(_,S),(h&1<0)p.mulTo(S,A,_);else{var Z=_;_=S,S=Z}return p.revert(_)}function Dt(h,p){var _;return h<256||p.isEven()?_=new Wt(p):_=new ut(p),this.exp(h,_)}f.prototype.copyTo=R,f.prototype.fromInt=W,f.prototype.fromString=z,f.prototype.clamp=N,f.prototype.dlShiftTo=pt,f.prototype.drShiftTo=Pt,f.prototype.lShiftTo=nt,f.prototype.rShiftTo=it,f.prototype.subTo=It,f.prototype.multiplyTo=kt,f.prototype.squareTo=xt,f.prototype.divRemTo=Kt,f.prototype.invDigit=B,f.prototype.isEven=wt,f.prototype.exp=ot,f.prototype.toString=U,f.prototype.negate=T,f.prototype.abs=H,f.prototype.compareTo=gt,f.prototype.bitLength=Et,f.prototype.mod=Ct,f.prototype.modPowInt=Dt,f.ZERO=D(0),f.ONE=D(1);function Xt(){var h=g();return this.copyTo(h),h}function Tt(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function fe(){return this.t==0?this.s:this[0]<<16>>16}function ae(h){return Math.floor(Math.LN2*this.DB/Math.log(h))}function be(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function wi(h){if(h==null&&(h=10),this.signum()==0||h<2||h>36)return"0";var p=this.chunkSize(h),_=Math.pow(h,p),S=D(_),A=g(),F=g(),Z="";for(this.divRemTo(S,A,F);A.signum()>0;)Z=(_+F.intValue()).toString(h).substr(1)+Z,A.divRemTo(S,A,F);return F.intValue().toString(h)+Z}function pe(h,p){this.fromInt(0),p==null&&(p=10);for(var _=this.chunkSize(p),S=Math.pow(p,_),A=!1,F=0,Z=0,J=0;J=_&&(this.dMultiply(S),this.dAddOffset(Z,0),F=0,Z=0)}F>0&&(this.dMultiply(Math.pow(p,F)),this.dAddOffset(Z,0)),A&&f.ZERO.subTo(this,this)}function Vi(h,p,_){if(typeof p=="number")if(h<2)this.fromInt(1);else for(this.fromNumber(h,_),this.testBit(h-1)||this.bitwiseTo(f.ONE.shiftLeft(h-1),ui,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(p);)this.dAddOffset(2,0),this.bitLength()>h&&this.subTo(f.ONE.shiftLeft(h-1),this);else{var S=new Array,A=h&7;S.length=(h>>3)+1,p.nextBytes(S),A>0?S[0]&=(1<0)for(_>_)!=(this.s&this.DM)>>_&&(p[A++]=S|this.s<=0;)_<8?(S=(this[h]&(1<<_)-1)<<8-_,S|=this[--h]>>(_+=this.DB-8)):(S=this[h]>>(_-=8)&255,_<=0&&(_+=this.DB,--h)),S&128&&(S|=-256),A==0&&(this.s&128)!=(S&128)&&++A,(A>0||S!=this.s)&&(p[A++]=S);return p}function sn(h){return this.compareTo(h)==0}function on(h){return this.compareTo(h)<0?this:h}function le(h){return this.compareTo(h)>0?this:h}function Ze(h,p,_){var S,A,F=Math.min(h.t,this.t);for(S=0;S>=16,p+=16),h&255||(h>>=8,p+=8),h&15||(h>>=4,p+=4),h&3||(h>>=2,p+=2),h&1||++p,p}function Ao(){for(var h=0;h=this.t?this.s!=0:(this[p]&1<>=this.DB;if(h.t>=this.DB;S+=this.s}else{for(S+=this.s;_>=this.DB;S+=h.s}p.s=S<0?-1:0,S>0?p[_++]=S:S<-1&&(p[_++]=this.DV+S),p.t=_,p.clamp()}function Mr(h){var p=g();return this.addTo(h,p),p}function Gl(h){var p=g();return this.subTo(h,p),p}function Eo(h){var p=g();return this.multiplyTo(h,p),p}function Do(){var h=g();return this.squareTo(h),h}function Hl(h){var p=g();return this.divRemTo(h,p,null),p}function To(h){var p=g();return this.divRemTo(h,null,p),p}function Jl(h){var p=g(),_=g();return this.divRemTo(h,p,_),new Array(p,_)}function Kl(h){this[this.t]=this.am(0,h-1,this,0,0,this.t),++this.t,this.clamp()}function th(h,p){if(h!=0){for(;this.t<=p;)this[this.t++]=0;for(this[p]+=h;this[p]>=this.DV;)this[p]-=this.DV,++p>=this.t&&(this[this.t++]=0),++this[p]}}function Nn(){}function $r(h){return h}function eh(h,p,_){h.multiplyTo(p,_)}function Hi(h,p){h.squareTo(p)}Nn.prototype.convert=$r,Nn.prototype.revert=$r,Nn.prototype.mulTo=eh,Nn.prototype.sqrTo=Hi;function ih(h){return this.exp(h,new Nn)}function Io(h,p,_){var S=Math.min(this.t+h.t,p);for(_.s=0,_.t=S;S>0;)_[--S]=0;var A;for(A=_.t-this.t;S=0;)_[S]=0;for(S=Math.max(p-this.t,0);S2*this.m.t)return h.mod(this.m);if(h.compareTo(this.m)<0)return h;var p=g();return h.copyTo(p),this.reduce(p),p}function nh(h){return h}function Qo(h){for(h.drShiftTo(this.m.t-1,this.r2),h.t>this.m.t+1&&(h.t=this.m.t+1,h.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);h.compareTo(this.r2)<0;)h.dAddOffset(1,this.m.t+1);for(h.subTo(this.r2,h);h.compareTo(this.m)>=0;)h.subTo(this.m,h)}function Bi(h,p){h.squareTo(p),this.reduce(p)}function rh(h,p,_){h.multiplyTo(p,_),this.reduce(_)}Bn.prototype.convert=$o,Bn.prototype.revert=nh,Bn.prototype.reduce=Qo,Bn.prototype.mulTo=rh,Bn.prototype.sqrTo=Bi;function sh(h,p){var _=h.bitLength(),S,A=D(1),F;if(_<=0)return A;_<18?S=1:_<48?S=3:_<144?S=4:_<768?S=5:S=6,_<8?F=new Wt(p):p.isEven()?F=new Bn(p):F=new ut(p);var Z=new Array,J=3,K=S-1,lt=(1<1){var St=g();for(F.sqrTo(Z[1],St);J<=lt;)Z[J]=g(),F.mulTo(St,Z[J-2],Z[J]),J+=2}var Ot=h.t-1,$t,jt=!0,ue=g(),ee;for(_=at(h[Ot])-1;Ot>=0;){for(_>=K?$t=h[Ot]>>_-K<:($t=(h[Ot]&(1<<_+1)-1)<0&&($t|=h[Ot-1]>>this.DB+_-K)),J=S;!($t&1);)$t>>=1,--J;if((_-=J)<0&&(_+=this.DB,--Ot),jt)Z[$t].copyTo(A),jt=!1;else{for(;J>1;)F.sqrTo(A,ue),F.sqrTo(ue,A),J-=2;J>0?F.sqrTo(A,ue):(ee=A,A=ue,ue=ee),F.mulTo(ue,Z[$t],A)}for(;Ot>=0&&!(h[Ot]&1<<_);)F.sqrTo(A,ue),ee=A,A=ue,ue=ee,--_<0&&(_=this.DB-1,--Ot)}return F.revert(A)}function No(h){var p=this.s<0?this.negate():this.clone(),_=h.s<0?h.negate():h.clone();if(p.compareTo(_)<0){var S=p;p=_,_=S}var A=p.getLowestSetBit(),F=_.getLowestSetBit();if(F<0)return p;for(A0&&(p.rShiftTo(F,p),_.rShiftTo(F,_));p.signum()>0;)(A=p.getLowestSetBit())>0&&p.rShiftTo(A,p),(A=_.getLowestSetBit())>0&&_.rShiftTo(A,_),p.compareTo(_)>=0?(p.subTo(_,p),p.rShiftTo(1,p)):(_.subTo(p,_),_.rShiftTo(1,_));return F>0&&_.lShiftTo(F,_),_}function Bo(h){if(h<=0)return 0;var p=this.DV%h,_=this.s<0?h-1:0;if(this.t>0)if(p==0)_=this[0]%h;else for(var S=this.t-1;S>=0;--S)_=(p*_+this[S])%h;return _}function oh(h){var p=h.isEven();if(this.isEven()&&p||h.signum()==0)return f.ZERO;for(var _=h.clone(),S=this.clone(),A=D(1),F=D(0),Z=D(0),J=D(1);_.signum()!=0;){for(;_.isEven();)_.rShiftTo(1,_),p?((!A.isEven()||!F.isEven())&&(A.addTo(this,A),F.subTo(h,F)),A.rShiftTo(1,A)):F.isEven()||F.subTo(h,F),F.rShiftTo(1,F);for(;S.isEven();)S.rShiftTo(1,S),p?((!Z.isEven()||!J.isEven())&&(Z.addTo(this,Z),J.subTo(h,J)),Z.rShiftTo(1,Z)):J.isEven()||J.subTo(h,J),J.rShiftTo(1,J);_.compareTo(S)>=0?(_.subTo(S,_),p&&A.subTo(Z,A),F.subTo(J,F)):(S.subTo(_,S),p&&Z.subTo(A,Z),J.subTo(F,J))}if(S.compareTo(f.ONE)!=0)return f.ZERO;if(J.compareTo(h)>=0)return J.subtract(h);if(J.signum()<0)J.addTo(h,J);else return J;return J.signum()<0?J.add(h):J}var ii=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],ah=(1<<26)/ii[ii.length-1];function Fo(h){var p,_=this.abs();if(_.t==1&&_[0]<=ii[ii.length-1]){for(p=0;p>1,h>ii.length&&(h=ii.length);for(var A=g(),F=0;F0},he.op_LessThan=function(h,p){return h.compareTo(p)<0},he.op_Addition=function(h,p){return new he(h,void 0,void 0).add(new he(p,void 0,void 0))},he.op_Subtraction=function(h,p){return new he(h,void 0,void 0).subtract(new he(p,void 0,void 0))},he.Int128Mul=function(h,p){return new he(h,void 0,void 0).multiply(new he(p,void 0,void 0))},he.op_Division=function(h,p){return h.divide(p)},he.prototype.ToDouble=function(){return parseFloat(this.toString())};var Ji=function(h,p){var _;if(typeof Object.getOwnPropertyNames>"u"){for(_ in p.prototype)(typeof h.prototype[_]>"u"||h.prototype[_]===Object.prototype[_])&&(h.prototype[_]=p.prototype[_]);for(_ in p)typeof h[_]>"u"&&(h[_]=p[_]);h.$baseCtor=p}else{for(var S=Object.getOwnPropertyNames(p.prototype),A=0;A"u"&&Object.defineProperty(h.prototype,S[A],Object.getOwnPropertyDescriptor(p.prototype,S[A]));for(_ in p)typeof h[_]>"u"&&(h[_]=p[_]);h.$baseCtor=p}};s.Path=function(){return[]},s.Path.prototype.push=Array.prototype.push,s.Paths=function(){return[]},s.Paths.prototype.push=Array.prototype.push,s.DoublePoint=function(){var h=arguments;this.X=0,this.Y=0,h.length===1?(this.X=h[0].X,this.Y=h[0].Y):h.length===2&&(this.X=h[0],this.Y=h[1])},s.DoublePoint0=function(){this.X=0,this.Y=0},s.DoublePoint0.prototype=s.DoublePoint.prototype,s.DoublePoint1=function(h){this.X=h.X,this.Y=h.Y},s.DoublePoint1.prototype=s.DoublePoint.prototype,s.DoublePoint2=function(h,p){this.X=h,this.Y=p},s.DoublePoint2.prototype=s.DoublePoint.prototype,s.PolyNode=function(){this.m_Parent=null,this.m_polygon=new s.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1},s.PolyNode.prototype.IsHoleNode=function(){for(var h=!0,p=this.m_Parent;p!==null;)h=!h,p=p.m_Parent;return h},s.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length},s.PolyNode.prototype.Contour=function(){return this.m_polygon},s.PolyNode.prototype.AddChild=function(h){var p=this.m_Childs.length;this.m_Childs.push(h),h.m_Parent=this,h.m_Index=p},s.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()},s.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index===this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]},s.PolyNode.prototype.Childs=function(){return this.m_Childs},s.PolyNode.prototype.Parent=function(){return this.m_Parent},s.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()},s.PolyTree=function(){this.m_AllPolys=[],s.PolyNode.call(this)},s.PolyTree.prototype.Clear=function(){for(var h=0,p=this.m_AllPolys.length;h0?this.m_Childs[0]:null},s.PolyTree.prototype.Total=function(){var h=this.m_AllPolys.length;return h>0&&this.m_Childs[0]!==this.m_AllPolys[0]&&h--,h},Ji(s.PolyTree,s.PolyNode),s.Math_Abs_Int64=s.Math_Abs_Int32=s.Math_Abs_Double=function(h){return Math.abs(h)},s.Math_Max_Int32_Int32=function(h,p){return Math.max(h,p)},c.msie||c.opera||c.safari?s.Cast_Int32=function(h){return h|0}:s.Cast_Int32=function(h){return~~h},typeof Number.toInteger>"u"&&(Number.toInteger=null),c.chrome?s.Cast_Int64=function(h){return h<-2147483648||h>2147483647?h<0?Math.ceil(h):Math.floor(h):~~h}:c.firefox&&typeof Number.toInteger=="function"?s.Cast_Int64=function(h){return Number.toInteger(h)}:c.msie7||c.msie8?s.Cast_Int64=function(h){return parseInt(h,10)}:c.msie?s.Cast_Int64=function(h){return h<-2147483648||h>2147483647?h<0?Math.ceil(h):Math.floor(h):h|0}:s.Cast_Int64=function(h){return h<0?Math.ceil(h):Math.floor(h)},s.Clear=function(h){h.length=0},s.PI=3.141592653589793,s.PI2=2*3.141592653589793,s.IntPoint=function(){var h=arguments,p=h.length;if(this.X=0,this.Y=0,s.use_xyz)if(this.Z=0,p===3)this.X=h[0],this.Y=h[1],this.Z=h[2];else if(p===2)this.X=h[0],this.Y=h[1],this.Z=0;else if(p===1)if(h[0]instanceof s.DoublePoint){var _=h[0];this.X=s.Clipper.Round(_.X),this.Y=s.Clipper.Round(_.Y),this.Z=0}else{var S=h[0];typeof S.Z>"u"&&(S.Z=0),this.X=S.X,this.Y=S.Y,this.Z=S.Z}else this.X=0,this.Y=0,this.Z=0;else if(p===2)this.X=h[0],this.Y=h[1];else if(p===1)if(h[0]instanceof s.DoublePoint){var _=h[0];this.X=s.Clipper.Round(_.X),this.Y=s.Clipper.Round(_.Y)}else{var S=h[0];this.X=S.X,this.Y=S.Y}else this.X=0,this.Y=0},s.IntPoint.op_Equality=function(h,p){return h.X===p.X&&h.Y===p.Y},s.IntPoint.op_Inequality=function(h,p){return h.X!==p.X||h.Y!==p.Y},s.IntPoint0=function(){this.X=0,this.Y=0,s.use_xyz&&(this.Z=0)},s.IntPoint0.prototype=s.IntPoint.prototype,s.IntPoint1=function(h){this.X=h.X,this.Y=h.Y,s.use_xyz&&(typeof h.Z>"u"?this.Z=0:this.Z=h.Z)},s.IntPoint1.prototype=s.IntPoint.prototype,s.IntPoint1dp=function(h){this.X=s.Clipper.Round(h.X),this.Y=s.Clipper.Round(h.Y),s.use_xyz&&(this.Z=0)},s.IntPoint1dp.prototype=s.IntPoint.prototype,s.IntPoint2=function(h,p,_){this.X=h,this.Y=p,s.use_xyz&&(typeof _>"u"?this.Z=0:this.Z=_)},s.IntPoint2.prototype=s.IntPoint.prototype,s.IntRect=function(){var h=arguments,p=h.length;if(p===4)this.left=h[0],this.top=h[1],this.right=h[2],this.bottom=h[3];else if(p===1){var _=h[0];this.left=_.left,this.top=_.top,this.right=_.right,this.bottom=_.bottom}else this.left=0,this.top=0,this.right=0,this.bottom=0},s.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0},s.IntRect0.prototype=s.IntRect.prototype,s.IntRect1=function(h){this.left=h.left,this.top=h.top,this.right=h.right,this.bottom=h.bottom},s.IntRect1.prototype=s.IntRect.prototype,s.IntRect4=function(h,p,_,S){this.left=h,this.top=p,this.right=_,this.bottom=S},s.IntRect4.prototype=s.IntRect.prototype,s.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3},s.PolyType={ptSubject:0,ptClip:1},s.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3},s.JoinType={jtSquare:0,jtRound:1,jtMiter:2},s.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4},s.EdgeSide={esLeft:0,esRight:1},s.Direction={dRightToLeft:0,dLeftToRight:1},s.TEdge=function(){this.Bot=new s.IntPoint0,this.Curr=new s.IntPoint0,this.Top=new s.IntPoint0,this.Delta=new s.IntPoint0,this.Dx=0,this.PolyTyp=s.PolyType.ptSubject,this.Side=s.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null},s.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new s.IntPoint0},s.MyIntersectNodeSort=function(){},s.MyIntersectNodeSort.Compare=function(h,p){var _=p.Pt.Y-h.Pt.Y;return _>0?1:_<0?-1:0},s.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null},s.Scanbeam=function(){this.Y=0,this.Next=null},s.Maxima=function(){this.X=0,this.Next=null,this.Prev=null},s.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null},s.OutPt=function(){this.Idx=0,this.Pt=new s.IntPoint0,this.Next=null,this.Prev=null},s.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new s.IntPoint0},s.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_Scanbeam=null,this.m_PolyOuts=null,this.m_ActiveEdges=null},s.ClipperBase.horizontal=-9007199254740992,s.ClipperBase.Skip=-2,s.ClipperBase.Unassigned=-1,s.ClipperBase.tolerance=1e-20,s.ClipperBase.loRange=47453132,s.ClipperBase.hiRange=0xfffffffffffff,s.ClipperBase.near_zero=function(h){return h>-s.ClipperBase.tolerance&&hp.X==h.X<_.X&&h.Y>p.Y==h.Y<_.Y&&he.op_Equality(he.Int128Mul(h.X-p.X,_.Y-p.Y),he.Int128Mul(_.X-p.X,h.Y-p.Y)):h.X===p.X&&h.Y===p.Y||h.X===_.X&&h.Y===_.Y||h.X>p.X==h.X<_.X&&h.Y>p.Y==h.Y<_.Y&&(h.X-p.X)*(_.Y-p.Y)===(_.X-p.X)*(h.Y-p.Y)},s.ClipperBase.prototype.PointOnPolygon=function(h,p,_){for(var S=p;;){if(this.PointOnLineSegment(h,S.Pt,S.Next.Pt,_))return!0;if(S=S.Next,S===p)break}return!1},s.ClipperBase.prototype.SlopesEqual=s.ClipperBase.SlopesEqual=function(){var h=arguments,p=h.length,_,S,A,F,Z,J,K;return p===3?(_=h[0],S=h[1],K=h[2],K?he.op_Equality(he.Int128Mul(_.Delta.Y,S.Delta.X),he.Int128Mul(_.Delta.X,S.Delta.Y)):s.Cast_Int64(_.Delta.Y*S.Delta.X)===s.Cast_Int64(_.Delta.X*S.Delta.Y)):p===4?(A=h[0],F=h[1],Z=h[2],K=h[3],K?he.op_Equality(he.Int128Mul(A.Y-F.Y,F.X-Z.X),he.Int128Mul(A.X-F.X,F.Y-Z.Y)):s.Cast_Int64((A.Y-F.Y)*(F.X-Z.X))-s.Cast_Int64((A.X-F.X)*(F.Y-Z.Y))===0):(A=h[0],F=h[1],Z=h[2],J=h[3],K=h[4],K?he.op_Equality(he.Int128Mul(A.Y-F.Y,Z.X-J.X),he.Int128Mul(A.X-F.X,Z.Y-J.Y)):s.Cast_Int64((A.Y-F.Y)*(Z.X-J.X))-s.Cast_Int64((A.X-F.X)*(Z.Y-J.Y))===0)},s.ClipperBase.SlopesEqual3=function(h,p,_){return _?he.op_Equality(he.Int128Mul(h.Delta.Y,p.Delta.X),he.Int128Mul(h.Delta.X,p.Delta.Y)):s.Cast_Int64(h.Delta.Y*p.Delta.X)===s.Cast_Int64(h.Delta.X*p.Delta.Y)},s.ClipperBase.SlopesEqual4=function(h,p,_,S){return S?he.op_Equality(he.Int128Mul(h.Y-p.Y,p.X-_.X),he.Int128Mul(h.X-p.X,p.Y-_.Y)):s.Cast_Int64((h.Y-p.Y)*(p.X-_.X))-s.Cast_Int64((h.X-p.X)*(p.Y-_.Y))===0},s.ClipperBase.SlopesEqual5=function(h,p,_,S,A){return A?he.op_Equality(he.Int128Mul(h.Y-p.Y,_.X-S.X),he.Int128Mul(h.X-p.X,_.Y-S.Y)):s.Cast_Int64((h.Y-p.Y)*(_.X-S.X))-s.Cast_Int64((h.X-p.X)*(_.Y-S.Y))===0},s.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var h=0,p=this.m_edges.length;hs.ClipperBase.hiRange||h.Y>s.ClipperBase.hiRange||-h.X>s.ClipperBase.hiRange||-h.Y>s.ClipperBase.hiRange)&&s.Error("Coordinate outside allowed range in RangeTest()."):(h.X>s.ClipperBase.loRange||h.Y>s.ClipperBase.loRange||-h.X>s.ClipperBase.loRange||-h.Y>s.ClipperBase.loRange)&&(p.Value=!0,this.RangeTest(h,p))},s.ClipperBase.prototype.InitEdge=function(h,p,_,S){h.Next=p,h.Prev=_,h.Curr.X=S.X,h.Curr.Y=S.Y,s.use_xyz&&(h.Curr.Z=S.Z),h.OutIdx=-1},s.ClipperBase.prototype.InitEdge2=function(h,p){h.Curr.Y>=h.Next.Curr.Y?(h.Bot.X=h.Curr.X,h.Bot.Y=h.Curr.Y,s.use_xyz&&(h.Bot.Z=h.Curr.Z),h.Top.X=h.Next.Curr.X,h.Top.Y=h.Next.Curr.Y,s.use_xyz&&(h.Top.Z=h.Next.Curr.Z)):(h.Top.X=h.Curr.X,h.Top.Y=h.Curr.Y,s.use_xyz&&(h.Top.Z=h.Curr.Z),h.Bot.X=h.Next.Curr.X,h.Bot.Y=h.Next.Curr.Y,s.use_xyz&&(h.Bot.Z=h.Next.Curr.Z)),this.SetDx(h),h.PolyTyp=p},s.ClipperBase.prototype.FindNextLocMin=function(h){for(var p;;){for(;s.IntPoint.op_Inequality(h.Bot,h.Prev.Bot)||s.IntPoint.op_Equality(h.Curr,h.Top);)h=h.Next;if(h.Dx!==s.ClipperBase.horizontal&&h.Prev.Dx!==s.ClipperBase.horizontal)break;for(;h.Prev.Dx===s.ClipperBase.horizontal;)h=h.Prev;for(p=h;h.Dx===s.ClipperBase.horizontal;)h=h.Next;if(h.Top.Y!==h.Prev.Bot.Y){p.Prev.Bot.XS.Next.Top.X&&(S=A.Prev)}for(;h!==S;)h.NextInLML=h.Next,h.Dx===s.ClipperBase.horizontal&&h!==_&&h.Bot.X!==h.Prev.Top.X&&this.ReverseHorizontal(h),h=h.Next;h.Dx===s.ClipperBase.horizontal&&h!==_&&h.Bot.X!==h.Prev.Top.X&&this.ReverseHorizontal(h),S=S.Next}else{for(;S.Top.Y===S.Prev.Bot.Y&&S.Prev.OutIdx!==s.ClipperBase.Skip;)S=S.Prev;if(S.Dx===s.ClipperBase.horizontal&&S.Prev.OutIdx!==s.ClipperBase.Skip){for(A=S;A.Next.Dx===s.ClipperBase.horizontal;)A=A.Next;(A.Next.Top.X===S.Prev.Top.X||A.Next.Top.X>S.Prev.Top.X)&&(S=A.Next)}for(;h!==S;)h.NextInLML=h.Prev,h.Dx===s.ClipperBase.horizontal&&h!==_&&h.Bot.X!==h.Next.Top.X&&this.ReverseHorizontal(h),h=h.Prev;h.Dx===s.ClipperBase.horizontal&&h!==_&&h.Bot.X!==h.Next.Top.X&&this.ReverseHorizontal(h),S=S.Prev}return S},s.ClipperBase.prototype.AddPath=function(h,p,_){s.use_lines?!_&&p===s.PolyType.ptClip&&s.Error("AddPath: Open paths must be subject."):_||s.Error("AddPath: Open paths have been disabled.");var S=h.length-1;if(_)for(;S>0&&s.IntPoint.op_Equality(h[S],h[0]);)--S;for(;S>0&&s.IntPoint.op_Equality(h[S],h[S-1]);)--S;if(_&&S<2||!_&&S<1)return!1;for(var A=new Array,F=0;F<=S;F++)A.push(new s.TEdge);var Z=!0;A[1].Curr.X=h[1].X,A[1].Curr.Y=h[1].Y,s.use_xyz&&(A[1].Curr.Z=h[1].Z);var J={Value:this.m_UseFullRange};this.RangeTest(h[0],J),this.m_UseFullRange=J.Value,J.Value=this.m_UseFullRange,this.RangeTest(h[S],J),this.m_UseFullRange=J.Value,this.InitEdge(A[0],A[1],A[S],h[0]),this.InitEdge(A[S],A[0],A[S-1],h[S]);for(var F=S-1;F>=1;--F)J.Value=this.m_UseFullRange,this.RangeTest(h[F],J),this.m_UseFullRange=J.Value,this.InitEdge(A[F],A[F+1],A[F-1],h[F]);for(var K=A[0],lt=K,St=K;;){if(lt.Curr===lt.Next.Curr&&(_||lt.Next!==K)){if(lt===lt.Next)break;lt===K&&(K=lt.Next),lt=this.RemoveEdge(lt),St=lt;continue}if(lt.Prev===lt.Next)break;if(_&&s.ClipperBase.SlopesEqual4(lt.Prev.Curr,lt.Curr,lt.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(lt.Prev.Curr,lt.Curr,lt.Next.Curr))){lt===K&&(K=lt.Next),lt=this.RemoveEdge(lt),lt=lt.Prev,St=lt;continue}if(lt=lt.Next,lt===St||!_&<.Next===K)break}if(!_&<===lt.Next||_&<.Prev===lt.Next)return!1;_||(this.m_HasOpenPaths=!0,K.Prev.OutIdx=s.ClipperBase.Skip),lt=K;do this.InitEdge2(lt,p),lt=lt.Next,Z&<.Curr.Y!==K.Curr.Y&&(Z=!1);while(lt!==K);if(Z){if(_)return!1;lt.Prev.OutIdx=s.ClipperBase.Skip;var Ot=new s.LocalMinima;for(Ot.Next=null,Ot.Y=lt.Bot.Y,Ot.LeftBound=null,Ot.RightBound=lt,Ot.RightBound.Side=s.EdgeSide.esRight,Ot.RightBound.WindDelta=0;lt.Bot.X!==lt.Prev.Top.X&&this.ReverseHorizontal(lt),lt.Next.OutIdx!==s.ClipperBase.Skip;)lt.NextInLML=lt.Next,lt=lt.Next;return this.InsertLocalMinima(Ot),this.m_edges.push(A),!0}this.m_edges.push(A);var $t,jt=null;for(s.IntPoint.op_Equality(lt.Prev.Bot,lt.Prev.Top)&&(lt=lt.Next);lt=this.FindNextLocMin(lt),lt!==jt;){jt===null&&(jt=lt);var Ot=new s.LocalMinima;Ot.Next=null,Ot.Y=lt.Bot.Y,lt.Dxh.X==p.X<_.X:p.Y>h.Y==p.Y<_.Y},s.ClipperBase.prototype.RemoveEdge=function(h){h.Prev.Next=h.Next,h.Next.Prev=h.Prev;var p=h.Next;return h.Prev=null,p},s.ClipperBase.prototype.SetDx=function(h){h.Delta.X=h.Top.X-h.Bot.X,h.Delta.Y=h.Top.Y-h.Bot.Y,h.Delta.Y===0?h.Dx=s.ClipperBase.horizontal:h.Dx=h.Delta.X/h.Delta.Y},s.ClipperBase.prototype.InsertLocalMinima=function(h){if(this.m_MinimaList===null)this.m_MinimaList=h;else if(h.Y>=this.m_MinimaList.Y)h.Next=this.m_MinimaList,this.m_MinimaList=h;else{for(var p=this.m_MinimaList;p.Next!==null&&h.Ythis.m_Scanbeam.Y){var p=new s.Scanbeam;p.Y=h,p.Next=this.m_Scanbeam,this.m_Scanbeam=p}else{for(var _=this.m_Scanbeam;_.Next!==null&&h<=_.Next.Y;)_=_.Next;if(h===_.Y)return;var S=new s.Scanbeam;S.Y=h,S.Next=_.Next,_.Next=S}},s.ClipperBase.prototype.PopScanbeam=function(h){return this.m_Scanbeam===null?(h.v=0,!1):(h.v=this.m_Scanbeam.Y,this.m_Scanbeam=this.m_Scanbeam.Next,!0)},s.ClipperBase.prototype.LocalMinimaPending=function(){return this.m_CurrentLM!==null},s.ClipperBase.prototype.CreateOutRec=function(){var h=new s.OutRec;return h.Idx=s.ClipperBase.Unassigned,h.IsHole=!1,h.IsOpen=!1,h.FirstLeft=null,h.Pts=null,h.BottomPt=null,h.PolyNode=null,this.m_PolyOuts.push(h),h.Idx=this.m_PolyOuts.length-1,h},s.ClipperBase.prototype.DisposeOutRec=function(h){var p=this.m_PolyOuts[h];p.Pts=null,p=null,this.m_PolyOuts[h]=null},s.ClipperBase.prototype.UpdateEdgeIntoAEL=function(h){h.NextInLML===null&&s.Error("UpdateEdgeIntoAEL: invalid call");var p=h.PrevInAEL,_=h.NextInAEL;return h.NextInLML.OutIdx=h.OutIdx,p!==null?p.NextInAEL=h.NextInLML:this.m_ActiveEdges=h.NextInLML,_!==null&&(_.PrevInAEL=h.NextInLML),h.NextInLML.Side=h.Side,h.NextInLML.WindDelta=h.WindDelta,h.NextInLML.WindCnt=h.WindCnt,h.NextInLML.WindCnt2=h.WindCnt2,h=h.NextInLML,h.Curr.X=h.Bot.X,h.Curr.Y=h.Bot.Y,h.PrevInAEL=p,h.NextInAEL=_,s.ClipperBase.IsHorizontal(h)||this.InsertScanbeam(h.Top.Y),h},s.ClipperBase.prototype.SwapPositionsInAEL=function(h,p){if(!(h.NextInAEL===h.PrevInAEL||p.NextInAEL===p.PrevInAEL)){if(h.NextInAEL===p){var _=p.NextInAEL;_!==null&&(_.PrevInAEL=h);var S=h.PrevInAEL;S!==null&&(S.NextInAEL=p),p.PrevInAEL=S,p.NextInAEL=h,h.PrevInAEL=p,h.NextInAEL=_}else if(p.NextInAEL===h){var A=h.NextInAEL;A!==null&&(A.PrevInAEL=p);var F=p.PrevInAEL;F!==null&&(F.NextInAEL=h),h.PrevInAEL=F,h.NextInAEL=p,p.PrevInAEL=h,p.NextInAEL=A}else{var Z=h.NextInAEL,J=h.PrevInAEL;h.NextInAEL=p.NextInAEL,h.NextInAEL!==null&&(h.NextInAEL.PrevInAEL=h),h.PrevInAEL=p.PrevInAEL,h.PrevInAEL!==null&&(h.PrevInAEL.NextInAEL=h),p.NextInAEL=Z,p.NextInAEL!==null&&(p.NextInAEL.PrevInAEL=p),p.PrevInAEL=J,p.PrevInAEL!==null&&(p.PrevInAEL.NextInAEL=p)}h.PrevInAEL===null?this.m_ActiveEdges=h:p.PrevInAEL===null&&(this.m_ActiveEdges=p)}},s.ClipperBase.prototype.DeleteFromAEL=function(h){var p=h.PrevInAEL,_=h.NextInAEL;p===null&&_===null&&h!==this.m_ActiveEdges||(p!==null?p.NextInAEL=_:this.m_ActiveEdges=_,_!==null&&(_.PrevInAEL=p),h.NextInAEL=null,h.PrevInAEL=null)},s.Clipper=function(h){typeof h>"u"&&(h=0),this.m_PolyOuts=null,this.m_ClipType=s.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=s.PolyFillType.pftEvenOdd,this.m_SubjFillType=s.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,s.ClipperBase.call(this),this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=s.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=(1&h)!==0,this.StrictlySimple=(2&h)!==0,this.PreserveCollinear=(4&h)!==0,s.use_xyz&&(this.ZFillFunction=null)},s.Clipper.ioReverseSolution=1,s.Clipper.ioStrictlySimple=2,s.Clipper.ioPreserveCollinear=4,s.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),s.ClipperBase.prototype.Clear.call(this))},s.Clipper.prototype.InsertMaxima=function(h){var p=new s.Maxima;if(p.X=h,this.m_Maxima===null)this.m_Maxima=p,this.m_Maxima.Next=null,this.m_Maxima.Prev=null;else if(h=_.Next.X;)_=_.Next;if(h===_.X)return;p.Next=_.Next,p.Prev=_,_.Next!==null&&(_.Next.Prev=p),_.Next=p}},s.Clipper.prototype.Execute=function(){var h=arguments,p=h.length,_=h[1]instanceof s.PolyTree;if(p===4&&!_){var S=h[0],A=h[1],F=h[2],Z=h[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&s.Error("Error: PolyTree struct is needed for open path clipping."),this.m_ExecuteLocked=!0,s.Clear(A),this.m_SubjFillType=F,this.m_ClipFillType=Z,this.m_ClipType=S,this.m_UsingPolyTree=!1;try{var J=this.ExecuteInternal();J&&this.BuildResult(A)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return J}else if(p===4&&_){var S=h[0],K=h[1],F=h[2],Z=h[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=F,this.m_ClipFillType=Z,this.m_ClipType=S,this.m_UsingPolyTree=!0;try{var J=this.ExecuteInternal();J&&this.BuildResult2(K)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return J}else if(p===2&&!_){var S=h[0],A=h[1];return this.Execute(S,A,s.PolyFillType.pftEvenOdd,s.PolyFillType.pftEvenOdd)}else if(p===2&&_){var S=h[0],K=h[1];return this.Execute(S,K,s.PolyFillType.pftEvenOdd,s.PolyFillType.pftEvenOdd)}},s.Clipper.prototype.FixHoleLinkage=function(h){if(!(h.FirstLeft===null||h.IsHole!==h.FirstLeft.IsHole&&h.FirstLeft.Pts!==null)){for(var p=h.FirstLeft;p!==null&&(p.IsHole===h.IsHole||p.Pts===null);)p=p.FirstLeft;h.FirstLeft=p}},s.Clipper.prototype.ExecuteInternal=function(){try{this.Reset(),this.m_SortedEdges=null,this.m_Maxima=null;var h={},p={};if(!this.PopScanbeam(h))return!1;for(this.InsertLocalMinimaIntoAEL(h.v);this.PopScanbeam(p)||this.LocalMinimaPending();){if(this.ProcessHorizontals(),this.m_GhostJoins.length=0,!this.ProcessIntersections(p.v))return!1;this.ProcessEdgesAtTopOfScanbeam(p.v),h.v=p.v,this.InsertLocalMinimaIntoAEL(h.v)}var _,S,A;for(S=0,A=this.m_PolyOuts.length;S0&&this.ReversePolyPtLinks(_.Pts);for(this.JoinCommonEdges(),S=0,A=this.m_PolyOuts.length;S0&&S.WindDelta!==0)for(var F=0,Z=this.m_GhostJoins.length;F=0&&_.PrevInAEL!==null&&_.PrevInAEL.Curr.X===_.Bot.X&&_.PrevInAEL.OutIdx>=0&&s.ClipperBase.SlopesEqual5(_.PrevInAEL.Curr,_.PrevInAEL.Top,_.Curr,_.Top,this.m_UseFullRange)&&_.WindDelta!==0&&_.PrevInAEL.WindDelta!==0){var K=this.AddOutPt(_.PrevInAEL,_.Bot);this.AddJoin(A,K,_.Top)}if(_.NextInAEL!==S){if(S.OutIdx>=0&&S.PrevInAEL.OutIdx>=0&&s.ClipperBase.SlopesEqual5(S.PrevInAEL.Curr,S.PrevInAEL.Top,S.Curr,S.Top,this.m_UseFullRange)&&S.WindDelta!==0&&S.PrevInAEL.WindDelta!==0){var K=this.AddOutPt(S.PrevInAEL,S.Bot);this.AddJoin(A,K,S.Top)}var lt=_.NextInAEL;if(lt!==null)for(;lt!==S;)this.IntersectEdges(S,lt,_.Curr),lt=lt.NextInAEL}}}},s.Clipper.prototype.InsertEdgeIntoAEL=function(h,p){if(this.m_ActiveEdges===null)h.PrevInAEL=null,h.NextInAEL=null,this.m_ActiveEdges=h;else if(p===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,h))h.PrevInAEL=null,h.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=h,this.m_ActiveEdges=h;else{for(p===null&&(p=this.m_ActiveEdges);p.NextInAEL!==null&&!this.E2InsertsBeforeE1(p.NextInAEL,h);)p=p.NextInAEL;h.NextInAEL=p.NextInAEL,p.NextInAEL!==null&&(p.NextInAEL.PrevInAEL=h),h.PrevInAEL=p,p.NextInAEL=h}},s.Clipper.prototype.E2InsertsBeforeE1=function(h,p){return p.Curr.X===h.Curr.X?p.Top.Y>h.Top.Y?p.Top.Xs.Clipper.TopX(p,h.Top.Y):p.Curr.X0;default:return h.WindCnt2<0}case s.ClipType.ctUnion:switch(_){case s.PolyFillType.pftEvenOdd:case s.PolyFillType.pftNonZero:return h.WindCnt2===0;case s.PolyFillType.pftPositive:return h.WindCnt2<=0;default:return h.WindCnt2>=0}case s.ClipType.ctDifference:if(h.PolyTyp===s.PolyType.ptSubject)switch(_){case s.PolyFillType.pftEvenOdd:case s.PolyFillType.pftNonZero:return h.WindCnt2===0;case s.PolyFillType.pftPositive:return h.WindCnt2<=0;default:return h.WindCnt2>=0}else switch(_){case s.PolyFillType.pftEvenOdd:case s.PolyFillType.pftNonZero:return h.WindCnt2!==0;case s.PolyFillType.pftPositive:return h.WindCnt2>0;default:return h.WindCnt2<0}case s.ClipType.ctXor:if(h.WindDelta===0)switch(_){case s.PolyFillType.pftEvenOdd:case s.PolyFillType.pftNonZero:return h.WindCnt2===0;case s.PolyFillType.pftPositive:return h.WindCnt2<=0;default:return h.WindCnt2>=0}else return!0}return!0},s.Clipper.prototype.SetWindingCount=function(h){for(var p=h.PrevInAEL;p!==null&&(p.PolyTyp!==h.PolyTyp||p.WindDelta===0);)p=p.PrevInAEL;if(p===null){var _=h.PolyTyp===s.PolyType.ptSubject?this.m_SubjFillType:this.m_ClipFillType;h.WindDelta===0?h.WindCnt=_===s.PolyFillType.pftNegative?-1:1:h.WindCnt=h.WindDelta,h.WindCnt2=0,p=this.m_ActiveEdges}else if(h.WindDelta===0&&this.m_ClipType!==s.ClipType.ctUnion)h.WindCnt=1,h.WindCnt2=p.WindCnt2,p=p.NextInAEL;else if(this.IsEvenOddFillType(h)){if(h.WindDelta===0){for(var S=!0,A=p.PrevInAEL;A!==null;)A.PolyTyp===p.PolyTyp&&A.WindDelta!==0&&(S=!S),A=A.PrevInAEL;h.WindCnt=S?0:1}else h.WindCnt=h.WindDelta;h.WindCnt2=p.WindCnt2,p=p.NextInAEL}else p.WindCnt*p.WindDelta<0?Math.abs(p.WindCnt)>1?p.WindDelta*h.WindDelta<0?h.WindCnt=p.WindCnt:h.WindCnt=p.WindCnt+h.WindDelta:h.WindCnt=h.WindDelta===0?1:h.WindDelta:h.WindDelta===0?h.WindCnt=p.WindCnt<0?p.WindCnt-1:p.WindCnt+1:p.WindDelta*h.WindDelta<0?h.WindCnt=p.WindCnt:h.WindCnt=p.WindCnt+h.WindDelta,h.WindCnt2=p.WindCnt2,p=p.NextInAEL;if(this.IsEvenOddAltFillType(h))for(;p!==h;)p.WindDelta!==0&&(h.WindCnt2=h.WindCnt2===0?1:0),p=p.NextInAEL;else for(;p!==h;)h.WindCnt2+=p.WindDelta,p=p.NextInAEL},s.Clipper.prototype.AddEdgeToSEL=function(h){this.m_SortedEdges===null?(this.m_SortedEdges=h,h.PrevInSEL=null,h.NextInSEL=null):(h.NextInSEL=this.m_SortedEdges,h.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=h,this.m_SortedEdges=h)},s.Clipper.prototype.PopEdgeFromSEL=function(h){if(h.v=this.m_SortedEdges,h.v===null)return!1;var p=h.v;return this.m_SortedEdges=h.v.NextInSEL,this.m_SortedEdges!==null&&(this.m_SortedEdges.PrevInSEL=null),p.NextInSEL=null,p.PrevInSEL=null,!0},s.Clipper.prototype.CopyAELToSEL=function(){var h=this.m_ActiveEdges;for(this.m_SortedEdges=h;h!==null;)h.PrevInSEL=h.PrevInAEL,h.NextInSEL=h.NextInAEL,h=h.NextInAEL},s.Clipper.prototype.SwapPositionsInSEL=function(h,p){if(!(h.NextInSEL===null&&h.PrevInSEL===null)&&!(p.NextInSEL===null&&p.PrevInSEL===null)){if(h.NextInSEL===p){var _=p.NextInSEL;_!==null&&(_.PrevInSEL=h);var S=h.PrevInSEL;S!==null&&(S.NextInSEL=p),p.PrevInSEL=S,p.NextInSEL=h,h.PrevInSEL=p,h.NextInSEL=_}else if(p.NextInSEL===h){var _=h.NextInSEL;_!==null&&(_.PrevInSEL=p);var S=p.PrevInSEL;S!==null&&(S.NextInSEL=h),h.PrevInSEL=S,h.NextInSEL=p,p.PrevInSEL=h,p.NextInSEL=_}else{var _=h.NextInSEL,S=h.PrevInSEL;h.NextInSEL=p.NextInSEL,h.NextInSEL!==null&&(h.NextInSEL.PrevInSEL=h),h.PrevInSEL=p.PrevInSEL,h.PrevInSEL!==null&&(h.PrevInSEL.NextInSEL=h),p.NextInSEL=_,p.NextInSEL!==null&&(p.NextInSEL.PrevInSEL=p),p.PrevInSEL=S,p.PrevInSEL!==null&&(p.PrevInSEL.NextInSEL=p)}h.PrevInSEL===null?this.m_SortedEdges=h:p.PrevInSEL===null&&(this.m_SortedEdges=p)}},s.Clipper.prototype.AddLocalMaxPoly=function(h,p,_){this.AddOutPt(h,_),p.WindDelta===0&&this.AddOutPt(p,_),h.OutIdx===p.OutIdx?(h.OutIdx=-1,p.OutIdx=-1):h.OutIdxp.Dx?(S=this.AddOutPt(h,_),p.OutIdx=h.OutIdx,h.Side=s.EdgeSide.esLeft,p.Side=s.EdgeSide.esRight,A=h,A.PrevInAEL===p?F=p.PrevInAEL:F=A.PrevInAEL):(S=this.AddOutPt(p,_),h.OutIdx=p.OutIdx,h.Side=s.EdgeSide.esRight,p.Side=s.EdgeSide.esLeft,A=p,A.PrevInAEL===h?F=h.PrevInAEL:F=A.PrevInAEL),F!==null&&F.OutIdx>=0&&F.Top.Y<_.Y&&A.Top.Y<_.Y){var Z=s.Clipper.TopX(F,_.Y),J=s.Clipper.TopX(A,_.Y);if(Z===J&&A.WindDelta!==0&&F.WindDelta!==0&&s.ClipperBase.SlopesEqual5(new s.IntPoint2(Z,_.Y),F.Top,new s.IntPoint2(J,_.Y),A.Top,this.m_UseFullRange)){var K=this.AddOutPt(F,_);this.AddJoin(S,K,A.Top)}}return S},s.Clipper.prototype.AddOutPt=function(h,p){if(h.OutIdx<0){var _=this.CreateOutRec();_.IsOpen=h.WindDelta===0;var S=new s.OutPt;return _.Pts=S,S.Idx=_.Idx,S.Pt.X=p.X,S.Pt.Y=p.Y,s.use_xyz&&(S.Pt.Z=p.Z),S.Next=S,S.Prev=S,_.IsOpen||this.SetHoleState(h,_),h.OutIdx=_.Idx,S}else{var _=this.m_PolyOuts[h.OutIdx],A=_.Pts,F=h.Side===s.EdgeSide.esLeft;if(F&&s.IntPoint.op_Equality(p,A.Pt))return A;if(!F&&s.IntPoint.op_Equality(p,A.Prev.Pt))return A.Prev;var S=new s.OutPt;return S.Idx=_.Idx,S.Pt.X=p.X,S.Pt.Y=p.Y,s.use_xyz&&(S.Pt.Z=p.Z),S.Next=A,S.Prev=A.Prev,S.Prev.Next=S,A.Prev=S,F&&(_.Pts=S),S}},s.Clipper.prototype.GetLastOutPt=function(h){var p=this.m_PolyOuts[h.OutIdx];return h.Side===s.EdgeSide.esLeft?p.Pts:p.Pts.Prev},s.Clipper.prototype.SwapPoints=function(h,p){var _=new s.IntPoint1(h.Value);h.Value.X=p.Value.X,h.Value.Y=p.Value.Y,s.use_xyz&&(h.Value.Z=p.Value.Z),p.Value.X=_.X,p.Value.Y=_.Y,s.use_xyz&&(p.Value.Z=_.Z)},s.Clipper.prototype.HorzSegmentsOverlap=function(h,p,_,S){var A;return h>p&&(A=h,h=p,p=A),_>S&&(A=_,_=S,S=A),h=0&&_.WindDelta!==0&&(S===null?S=_:S.OutIdx===_.OutIdx&&(S=null)),_=_.PrevInAEL;S===null?(p.FirstLeft=null,p.IsHole=!1):(p.FirstLeft=this.m_PolyOuts[S.OutIdx],p.IsHole=!p.FirstLeft.IsHole)},s.Clipper.prototype.GetDx=function(h,p){return h.Y===p.Y?s.ClipperBase.horizontal:(p.X-h.X)/(p.Y-h.Y)},s.Clipper.prototype.FirstIsBottomPt=function(h,p){for(var _=h.Prev;s.IntPoint.op_Equality(_.Pt,h.Pt)&&_!==h;)_=_.Prev;var S=Math.abs(this.GetDx(h.Pt,_.Pt));for(_=h.Next;s.IntPoint.op_Equality(_.Pt,h.Pt)&&_!==h;)_=_.Next;var A=Math.abs(this.GetDx(h.Pt,_.Pt));for(_=p.Prev;s.IntPoint.op_Equality(_.Pt,p.Pt)&&_!==p;)_=_.Prev;var F=Math.abs(this.GetDx(p.Pt,_.Pt));for(_=p.Next;s.IntPoint.op_Equality(_.Pt,p.Pt)&&_!==p;)_=_.Next;var Z=Math.abs(this.GetDx(p.Pt,_.Pt));return Math.max(S,A)===Math.max(F,Z)&&Math.min(S,A)===Math.min(F,Z)?this.Area(h)>0:S>=F&&S>=Z||A>=F&&A>=Z},s.Clipper.prototype.GetBottomPt=function(h){for(var p=null,_=h.Next;_!==h;)_.Pt.Y>h.Pt.Y?(h=_,p=null):_.Pt.Y===h.Pt.Y&&_.Pt.X<=h.Pt.X&&(_.Pt.XS.Pt.Y?h:_.Pt.YS.Pt.X||_.Next===_?p:S.Next===S||this.FirstIsBottomPt(_,S)?h:p},s.Clipper.prototype.OutRec1RightOfOutRec2=function(h,p){do if(h=h.FirstLeft,h===p)return!0;while(h!==null);return!1},s.Clipper.prototype.GetOutRec=function(h){for(var p=this.m_PolyOuts[h];p!==this.m_PolyOuts[p.Idx];)p=this.m_PolyOuts[p.Idx];return p},s.Clipper.prototype.AppendPolygon=function(h,p){var _=this.m_PolyOuts[h.OutIdx],S=this.m_PolyOuts[p.OutIdx],A;this.OutRec1RightOfOutRec2(_,S)?A=S:this.OutRec1RightOfOutRec2(S,_)?A=_:A=this.GetLowermostRec(_,S);var F=_.Pts,Z=F.Prev,J=S.Pts,K=J.Prev;h.Side===s.EdgeSide.esLeft?p.Side===s.EdgeSide.esLeft?(this.ReversePolyPtLinks(J),J.Next=F,F.Prev=J,Z.Next=K,K.Prev=Z,_.Pts=K):(K.Next=F,F.Prev=K,J.Prev=Z,Z.Next=J,_.Pts=J):p.Side===s.EdgeSide.esRight?(this.ReversePolyPtLinks(J),Z.Next=K,K.Prev=Z,J.Next=F,F.Prev=J):(Z.Next=J,J.Prev=Z,F.Prev=K,K.Next=F),_.BottomPt=null,A===S&&(S.FirstLeft!==_&&(_.FirstLeft=S.FirstLeft),_.IsHole=S.IsHole),S.Pts=null,S.BottomPt=null,S.FirstLeft=_;var lt=h.OutIdx,St=p.OutIdx;h.OutIdx=-1,p.OutIdx=-1;for(var Ot=this.m_ActiveEdges;Ot!==null;){if(Ot.OutIdx===St){Ot.OutIdx=lt,Ot.Side=h.Side;break}Ot=Ot.NextInAEL}S.Idx=_.Idx},s.Clipper.prototype.ReversePolyPtLinks=function(h){if(h!==null){var p,_;p=h;do _=p.Next,p.Next=p.Prev,p.Prev=_,p=_;while(p!==h)}},s.Clipper.SwapSides=function(h,p){var _=h.Side;h.Side=p.Side,p.Side=_},s.Clipper.SwapPolyIndexes=function(h,p){var _=h.OutIdx;h.OutIdx=p.OutIdx,p.OutIdx=_},s.Clipper.prototype.IntersectEdges=function(h,p,_){var S=h.OutIdx>=0,A=p.OutIdx>=0;if(s.use_xyz&&this.SetZ(_,h,p),s.use_lines&&(h.WindDelta===0||p.WindDelta===0)){if(h.WindDelta===0&&p.WindDelta===0)return;h.PolyTyp===p.PolyTyp&&h.WindDelta!==p.WindDelta&&this.m_ClipType===s.ClipType.ctUnion?h.WindDelta===0?A&&(this.AddOutPt(h,_),S&&(h.OutIdx=-1)):S&&(this.AddOutPt(p,_),A&&(p.OutIdx=-1)):h.PolyTyp!==p.PolyTyp&&(h.WindDelta===0&&Math.abs(p.WindCnt)===1&&(this.m_ClipType!==s.ClipType.ctUnion||p.WindCnt2===0)?(this.AddOutPt(h,_),S&&(h.OutIdx=-1)):p.WindDelta===0&&Math.abs(h.WindCnt)===1&&(this.m_ClipType!==s.ClipType.ctUnion||h.WindCnt2===0)&&(this.AddOutPt(p,_),A&&(p.OutIdx=-1)));return}if(h.PolyTyp===p.PolyTyp)if(this.IsEvenOddFillType(h)){var F=h.WindCnt;h.WindCnt=p.WindCnt,p.WindCnt=F}else h.WindCnt+p.WindDelta===0?h.WindCnt=-h.WindCnt:h.WindCnt+=p.WindDelta,p.WindCnt-h.WindDelta===0?p.WindCnt=-p.WindCnt:p.WindCnt-=h.WindDelta;else this.IsEvenOddFillType(p)?h.WindCnt2=h.WindCnt2===0?1:0:h.WindCnt2+=p.WindDelta,this.IsEvenOddFillType(h)?p.WindCnt2=p.WindCnt2===0?1:0:p.WindCnt2-=h.WindDelta;var Z,J,K,lt;h.PolyTyp===s.PolyType.ptSubject?(Z=this.m_SubjFillType,K=this.m_ClipFillType):(Z=this.m_ClipFillType,K=this.m_SubjFillType),p.PolyTyp===s.PolyType.ptSubject?(J=this.m_SubjFillType,lt=this.m_ClipFillType):(J=this.m_ClipFillType,lt=this.m_SubjFillType);var St,Ot;switch(Z){case s.PolyFillType.pftPositive:St=h.WindCnt;break;case s.PolyFillType.pftNegative:St=-h.WindCnt;break;default:St=Math.abs(h.WindCnt);break}switch(J){case s.PolyFillType.pftPositive:Ot=p.WindCnt;break;case s.PolyFillType.pftNegative:Ot=-p.WindCnt;break;default:Ot=Math.abs(p.WindCnt);break}if(S&&A)St!==0&&St!==1||Ot!==0&&Ot!==1||h.PolyTyp!==p.PolyTyp&&this.m_ClipType!==s.ClipType.ctXor?this.AddLocalMaxPoly(h,p,_):(this.AddOutPt(h,_),this.AddOutPt(p,_),s.Clipper.SwapSides(h,p),s.Clipper.SwapPolyIndexes(h,p));else if(S)(Ot===0||Ot===1)&&(this.AddOutPt(h,_),s.Clipper.SwapSides(h,p),s.Clipper.SwapPolyIndexes(h,p));else if(A)(St===0||St===1)&&(this.AddOutPt(p,_),s.Clipper.SwapSides(h,p),s.Clipper.SwapPolyIndexes(h,p));else if((St===0||St===1)&&(Ot===0||Ot===1)){var $t,jt;switch(K){case s.PolyFillType.pftPositive:$t=h.WindCnt2;break;case s.PolyFillType.pftNegative:$t=-h.WindCnt2;break;default:$t=Math.abs(h.WindCnt2);break}switch(lt){case s.PolyFillType.pftPositive:jt=p.WindCnt2;break;case s.PolyFillType.pftNegative:jt=-p.WindCnt2;break;default:jt=Math.abs(p.WindCnt2);break}if(h.PolyTyp!==p.PolyTyp)this.AddLocalMinPoly(h,p,_);else if(St===1&&Ot===1)switch(this.m_ClipType){case s.ClipType.ctIntersection:$t>0&&jt>0&&this.AddLocalMinPoly(h,p,_);break;case s.ClipType.ctUnion:$t<=0&&jt<=0&&this.AddLocalMinPoly(h,p,_);break;case s.ClipType.ctDifference:(h.PolyTyp===s.PolyType.ptClip&&$t>0&&jt>0||h.PolyTyp===s.PolyType.ptSubject&&$t<=0&&jt<=0)&&this.AddLocalMinPoly(h,p,_);break;case s.ClipType.ctXor:this.AddLocalMinPoly(h,p,_);break}else s.Clipper.SwapSides(h,p)}},s.Clipper.prototype.DeleteFromSEL=function(h){var p=h.PrevInSEL,_=h.NextInSEL;p===null&&_===null&&h!==this.m_SortedEdges||(p!==null?p.NextInSEL=_:this.m_SortedEdges=_,_!==null&&(_.PrevInSEL=p),h.NextInSEL=null,h.PrevInSEL=null)},s.Clipper.prototype.ProcessHorizontals=function(){for(var h={};this.PopEdgeFromSEL(h);)this.ProcessHorizontal(h.v)},s.Clipper.prototype.GetHorzDirection=function(h,p){h.Bot.X=Z.Top.X&&(K=null)}else{for(;K.Next!==null&&K.Next.X=0&&!F&&this.AddOutPt(h,new s.IntPoint2(K.X,h.Bot.Y)),K=K.Next;else for(;K!==null&&K.X>Ot.Curr.X;)h.OutIdx>=0&&!F&&this.AddOutPt(h,new s.IntPoint2(K.X,h.Bot.Y)),K=K.Prev;if(_===s.Direction.dLeftToRight&&Ot.Curr.X>A||_===s.Direction.dRightToLeft&&Ot.Curr.X=0&&!F){s.use_xyz&&(_===s.Direction.dLeftToRight?this.SetZ(Ot.Curr,h,Ot):this.SetZ(Ot.Curr,Ot,h)),lt=this.AddOutPt(h,Ot.Curr);for(var $t=this.m_SortedEdges;$t!==null;){if($t.OutIdx>=0&&this.HorzSegmentsOverlap(h.Bot.X,h.Top.X,$t.Bot.X,$t.Top.X)){var jt=this.GetLastOutPt($t);this.AddJoin(jt,lt,$t.Top)}$t=$t.NextInSEL}this.AddGhostJoin(lt,h.Bot)}if(Ot===J&&St){h.OutIdx>=0&&this.AddLocalMaxPoly(h,J,h.Top),this.DeleteFromAEL(h),this.DeleteFromAEL(J);return}if(_===s.Direction.dLeftToRight){var ue=new s.IntPoint2(Ot.Curr.X,h.Curr.Y);this.IntersectEdges(h,Ot,ue)}else{var ue=new s.IntPoint2(Ot.Curr.X,h.Curr.Y);this.IntersectEdges(Ot,h,ue)}var ee=this.GetNextInAEL(Ot,_);this.SwapPositionsInAEL(h,Ot),Ot=ee}if(h.NextInLML===null||!s.ClipperBase.IsHorizontal(h.NextInLML))break;h=this.UpdateEdgeIntoAEL(h),h.OutIdx>=0&&this.AddOutPt(h,h.Bot),p={Dir:_,Left:S,Right:A},this.GetHorzDirection(h,p),_=p.Dir,S=p.Left,A=p.Right}if(h.OutIdx>=0&<===null){lt=this.GetLastOutPt(h);for(var $t=this.m_SortedEdges;$t!==null;){if($t.OutIdx>=0&&this.HorzSegmentsOverlap(h.Bot.X,h.Top.X,$t.Bot.X,$t.Top.X)){var jt=this.GetLastOutPt($t);this.AddJoin(jt,lt,$t.Top)}$t=$t.NextInSEL}this.AddGhostJoin(lt,h.Top)}if(h.NextInLML!==null)if(h.OutIdx>=0){if(lt=this.AddOutPt(h,h.Top),h=this.UpdateEdgeIntoAEL(h),h.WindDelta===0)return;var Se=h.PrevInAEL,ee=h.NextInAEL;if(Se!==null&&Se.Curr.X===h.Bot.X&&Se.Curr.Y===h.Bot.Y&&Se.WindDelta===0&&Se.OutIdx>=0&&Se.Curr.Y>Se.Top.Y&&s.ClipperBase.SlopesEqual3(h,Se,this.m_UseFullRange)){var jt=this.AddOutPt(Se,h.Bot);this.AddJoin(lt,jt,h.Top)}else if(ee!==null&&ee.Curr.X===h.Bot.X&&ee.Curr.Y===h.Bot.Y&&ee.WindDelta!==0&&ee.OutIdx>=0&&ee.Curr.Y>ee.Top.Y&&s.ClipperBase.SlopesEqual3(h,ee,this.m_UseFullRange)){var jt=this.AddOutPt(ee,h.Bot);this.AddJoin(lt,jt,h.Top)}}else h=this.UpdateEdgeIntoAEL(h);else h.OutIdx>=0&&this.AddOutPt(h,h.Top),this.DeleteFromAEL(h)},s.Clipper.prototype.GetNextInAEL=function(h,p){return p===s.Direction.dLeftToRight?h.NextInAEL:h.PrevInAEL},s.Clipper.prototype.IsMinima=function(h){return h!==null&&h.Prev.NextInLML!==h&&h.Next.NextInLML!==h},s.Clipper.prototype.IsMaxima=function(h,p){return h!==null&&h.Top.Y===p&&h.NextInLML===null},s.Clipper.prototype.IsIntermediate=function(h,p){return h.Top.Y===p&&h.NextInLML!==null},s.Clipper.prototype.GetMaximaPair=function(h){return s.IntPoint.op_Equality(h.Next.Top,h.Top)&&h.Next.NextInLML===null?h.Next:s.IntPoint.op_Equality(h.Prev.Top,h.Top)&&h.Prev.NextInLML===null?h.Prev:null},s.Clipper.prototype.GetMaximaPairEx=function(h){var p=this.GetMaximaPair(h);return p===null||p.OutIdx===s.ClipperBase.Skip||p.NextInAEL===p.PrevInAEL&&!s.ClipperBase.IsHorizontal(p)?null:p},s.Clipper.prototype.ProcessIntersections=function(h){if(this.m_ActiveEdges===null)return!0;try{if(this.BuildIntersectList(h),this.m_IntersectList.length===0)return!0;if(this.m_IntersectList.length===1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch{this.m_SortedEdges=null,this.m_IntersectList.length=0,s.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0},s.Clipper.prototype.BuildIntersectList=function(h){if(this.m_ActiveEdges!==null){var p=this.m_ActiveEdges;for(this.m_SortedEdges=p;p!==null;)p.PrevInSEL=p.PrevInAEL,p.NextInSEL=p.NextInAEL,p.Curr.X=s.Clipper.TopX(p,h),p=p.NextInAEL;for(var _=!0;_&&this.m_SortedEdges!==null;){for(_=!1,p=this.m_SortedEdges;p.NextInSEL!==null;){var S=p.NextInSEL,A=new s.IntPoint0;if(p.Curr.X>S.Curr.X){this.IntersectPoint(p,S,A),A.Y2147483647?Math.floor(h):h|0)};c.msie?s.Clipper.Round=Pe:c.chromium?s.Clipper.Round=Qr:c.safari?s.Clipper.Round=uh:s.Clipper.Round=hh,s.Clipper.TopX=function(h,p){return p===h.Top.Y?h.Top.X:h.Bot.X+s.Clipper.Round(h.Dx*(p-h.Bot.Y))},s.Clipper.prototype.IntersectPoint=function(h,p,_){_.X=0,_.Y=0;var S,A;if(h.Dx===p.Dx){_.Y=h.Curr.Y,_.X=s.Clipper.TopX(h,_.Y);return}if(h.Delta.X===0)_.X=h.Bot.X,s.ClipperBase.IsHorizontal(p)?_.Y=p.Bot.Y:(A=p.Bot.Y-p.Bot.X/p.Dx,_.Y=s.Clipper.Round(_.X/p.Dx+A));else if(p.Delta.X===0)_.X=p.Bot.X,s.ClipperBase.IsHorizontal(h)?_.Y=h.Bot.Y:(S=h.Bot.Y-h.Bot.X/h.Dx,_.Y=s.Clipper.Round(_.X/h.Dx+S));else{S=h.Bot.X-h.Bot.Y*h.Dx,A=p.Bot.X-p.Bot.Y*p.Dx;var F=(A-S)/(h.Dx-p.Dx);_.Y=s.Clipper.Round(F),Math.abs(h.Dx)p.Top.Y)return _.Y=h.Top.Y,_.X=s.Clipper.TopX(p,h.Top.Y),_.Xh.Curr.Y&&(_.Y=h.Curr.Y,Math.abs(h.Dx)>Math.abs(p.Dx)?_.X=s.Clipper.TopX(p,_.Y):_.X=s.Clipper.TopX(h,_.Y))},s.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(h){for(var p=this.m_ActiveEdges;p!==null;){var _=this.IsMaxima(p,h);if(_){var S=this.GetMaximaPairEx(p);_=S===null||!s.ClipperBase.IsHorizontal(S)}if(_){this.StrictlySimple&&this.InsertMaxima(p.Top.X);var A=p.PrevInAEL;this.DoMaxima(p),A===null?p=this.m_ActiveEdges:p=A.NextInAEL}else{if(this.IsIntermediate(p,h)&&s.ClipperBase.IsHorizontal(p.NextInLML)?(p=this.UpdateEdgeIntoAEL(p),p.OutIdx>=0&&this.AddOutPt(p,p.Bot),this.AddEdgeToSEL(p)):(p.Curr.X=s.Clipper.TopX(p,h),p.Curr.Y=h),s.use_xyz&&(p.Top.Y===h?p.Curr.Z=p.Top.Z:p.Bot.Y===h?p.Curr.Z=p.Bot.Z:p.Curr.Z=0),this.StrictlySimple){var A=p.PrevInAEL;if(p.OutIdx>=0&&p.WindDelta!==0&&A!==null&&A.OutIdx>=0&&A.Curr.X===p.Curr.X&&A.WindDelta!==0){var F=new s.IntPoint1(p.Curr);s.use_xyz&&this.SetZ(F,A,p);var Z=this.AddOutPt(A,F),J=this.AddOutPt(p,F);this.AddJoin(Z,J,F)}}p=p.NextInAEL}}for(this.ProcessHorizontals(),this.m_Maxima=null,p=this.m_ActiveEdges;p!==null;){if(this.IsIntermediate(p,h)){var Z=null;p.OutIdx>=0&&(Z=this.AddOutPt(p,p.Top)),p=this.UpdateEdgeIntoAEL(p);var A=p.PrevInAEL,K=p.NextInAEL;if(A!==null&&A.Curr.X===p.Bot.X&&A.Curr.Y===p.Bot.Y&&Z!==null&&A.OutIdx>=0&&A.Curr.Y===A.Top.Y&&s.ClipperBase.SlopesEqual5(p.Curr,p.Top,A.Curr,A.Top,this.m_UseFullRange)&&p.WindDelta!==0&&A.WindDelta!==0){var J=this.AddOutPt(ePrev2,p.Bot);this.AddJoin(Z,J,p.Top)}else if(K!==null&&K.Curr.X===p.Bot.X&&K.Curr.Y===p.Bot.Y&&Z!==null&&K.OutIdx>=0&&K.Curr.Y===K.Top.Y&&s.ClipperBase.SlopesEqual5(p.Curr,p.Top,K.Curr,K.Top,this.m_UseFullRange)&&p.WindDelta!==0&&K.WindDelta!==0){var J=this.AddOutPt(K,p.Bot);this.AddJoin(Z,J,p.Top)}}p=p.NextInAEL}},s.Clipper.prototype.DoMaxima=function(h){var p=this.GetMaximaPairEx(h);if(p===null){h.OutIdx>=0&&this.AddOutPt(h,h.Top),this.DeleteFromAEL(h);return}for(var _=h.NextInAEL;_!==null&&_!==p;)this.IntersectEdges(h,_,h.Top),this.SwapPositionsInAEL(h,_),_=h.NextInAEL;h.OutIdx===-1&&p.OutIdx===-1?(this.DeleteFromAEL(h),this.DeleteFromAEL(p)):h.OutIdx>=0&&p.OutIdx>=0?(h.OutIdx>=0&&this.AddLocalMaxPoly(h,p,h.Top),this.DeleteFromAEL(h),this.DeleteFromAEL(p)):s.use_lines&&h.WindDelta===0?(h.OutIdx>=0&&(this.AddOutPt(h,h.Top),h.OutIdx=s.ClipperBase.Unassigned),this.DeleteFromAEL(h),p.OutIdx>=0&&(this.AddOutPt(p,h.Top),p.OutIdx=s.ClipperBase.Unassigned),this.DeleteFromAEL(p)):s.Error("DoMaxima error")},s.Clipper.ReversePaths=function(h){for(var p=0,_=h.length;p<_;p++)h[p].reverse()},s.Clipper.Orientation=function(h){return s.Clipper.Area(h)>=0},s.Clipper.prototype.PointCount=function(h){if(h===null)return 0;var p=0,_=h;do p++,_=_.Next;while(_!==h);return p},s.Clipper.prototype.BuildResult=function(h){s.Clear(h);for(var p=0,_=this.m_PolyOuts.length;p<_;p++){var S=this.m_PolyOuts[p];if(S.Pts!==null){var A=S.Pts.Prev,F=this.PointCount(A);if(!(F<2)){for(var Z=new Array(F),J=0;Jp.Pt.X?s.Direction.dRightToLeft:s.Direction.dLeftToRight,J=_.Pt.X>S.Pt.X?s.Direction.dRightToLeft:s.Direction.dLeftToRight;if(Z===J)return!1;if(Z===s.Direction.dLeftToRight){for(;h.Next.Pt.X<=A.X&&h.Next.Pt.X>=h.Pt.X&&h.Next.Pt.Y===A.Y;)h=h.Next;F&&h.Pt.X!==A.X&&(h=h.Next),p=this.DupOutPt(h,!F),s.IntPoint.op_Inequality(p.Pt,A)&&(h=p,h.Pt.X=A.X,h.Pt.Y=A.Y,s.use_xyz&&(h.Pt.Z=A.Z),p=this.DupOutPt(h,!F))}else{for(;h.Next.Pt.X>=A.X&&h.Next.Pt.X<=h.Pt.X&&h.Next.Pt.Y===A.Y;)h=h.Next;!F&&h.Pt.X!==A.X&&(h=h.Next),p=this.DupOutPt(h,F),s.IntPoint.op_Inequality(p.Pt,A)&&(h=p,h.Pt.X=A.X,h.Pt.Y=A.Y,s.use_xyz&&(h.Pt.Z=A.Z),p=this.DupOutPt(h,F))}if(J===s.Direction.dLeftToRight){for(;_.Next.Pt.X<=A.X&&_.Next.Pt.X>=_.Pt.X&&_.Next.Pt.Y===A.Y;)_=_.Next;F&&_.Pt.X!==A.X&&(_=_.Next),S=this.DupOutPt(_,!F),s.IntPoint.op_Inequality(S.Pt,A)&&(_=S,_.Pt.X=A.X,_.Pt.Y=A.Y,s.use_xyz&&(_.Pt.Z=A.Z),S=this.DupOutPt(_,!F))}else{for(;_.Next.Pt.X>=A.X&&_.Next.Pt.X<=_.Pt.X&&_.Next.Pt.Y===A.Y;)_=_.Next;!F&&_.Pt.X!==A.X&&(_=_.Next),S=this.DupOutPt(_,F),s.IntPoint.op_Inequality(S.Pt,A)&&(_=S,_.Pt.X=A.X,_.Pt.Y=A.Y,s.use_xyz&&(_.Pt.Z=A.Z),S=this.DupOutPt(_,F))}return Z===s.Direction.dLeftToRight===F?(h.Prev=_,_.Next=h,p.Next=S,S.Prev=p):(h.Next=_,_.Prev=h,p.Prev=S,S.Next=p),!0},s.Clipper.prototype.JoinPoints=function(h,p,_){var S=h.OutPt1,A=new s.OutPt,F=h.OutPt2,Z=new s.OutPt,J=h.OutPt1.Pt.Y===h.OffPt.Y;if(J&&s.IntPoint.op_Equality(h.OffPt,h.OutPt1.Pt)&&s.IntPoint.op_Equality(h.OffPt,h.OutPt2.Pt)){if(p!==_)return!1;for(A=h.OutPt1.Next;A!==S&&s.IntPoint.op_Equality(A.Pt,h.OffPt);)A=A.Next;var K=A.Pt.Y>h.OffPt.Y;for(Z=h.OutPt2.Next;Z!==F&&s.IntPoint.op_Equality(Z.Pt,h.OffPt);)Z=Z.Next;var lt=Z.Pt.Y>h.OffPt.Y;return K===lt?!1:K?(A=this.DupOutPt(S,!1),Z=this.DupOutPt(F,!0),S.Prev=F,F.Next=S,A.Next=Z,Z.Prev=A,h.OutPt1=S,h.OutPt2=A,!0):(A=this.DupOutPt(S,!0),Z=this.DupOutPt(F,!1),S.Next=F,F.Prev=S,A.Prev=Z,Z.Next=A,h.OutPt1=S,h.OutPt2=A,!0)}else if(J){for(A=S;S.Prev.Pt.Y===S.Pt.Y&&S.Prev!==A&&S.Prev!==F;)S=S.Prev;for(;A.Next.Pt.Y===A.Pt.Y&&A.Next!==S&&A.Next!==F;)A=A.Next;if(A.Next===S||A.Next===F)return!1;for(Z=F;F.Prev.Pt.Y===F.Pt.Y&&F.Prev!==Z&&F.Prev!==A;)F=F.Prev;for(;Z.Next.Pt.Y===Z.Pt.Y&&Z.Next!==F&&Z.Next!==S;)Z=Z.Next;if(Z.Next===F||Z.Next===S)return!1;var St={Left:null,Right:null};if(!this.GetOverlap(S.Pt.X,A.Pt.X,F.Pt.X,Z.Pt.X,St))return!1;var Ot=St.Left,$t=St.Right,jt=new s.IntPoint0,ue;return S.Pt.X>=Ot&&S.Pt.X<=$t?(jt.X=S.Pt.X,jt.Y=S.Pt.Y,s.use_xyz&&(jt.Z=S.Pt.Z),ue=S.Pt.X>A.Pt.X):F.Pt.X>=Ot&&F.Pt.X<=$t?(jt.X=F.Pt.X,jt.Y=F.Pt.Y,s.use_xyz&&(jt.Z=F.Pt.Z),ue=F.Pt.X>Z.Pt.X):A.Pt.X>=Ot&&A.Pt.X<=$t?(jt.X=A.Pt.X,jt.Y=A.Pt.Y,s.use_xyz&&(jt.Z=A.Pt.Z),ue=A.Pt.X>S.Pt.X):(jt.X=Z.Pt.X,jt.Y=Z.Pt.Y,s.use_xyz&&(jt.Z=Z.Pt.Z),ue=Z.Pt.X>F.Pt.X),h.OutPt1=S,h.OutPt2=F,this.JoinHorz(S,A,F,Z,jt,ue)}else{for(A=S.Next;s.IntPoint.op_Equality(A.Pt,S.Pt)&&A!==S;)A=A.Next;var ee=A.Pt.Y>S.Pt.Y||!s.ClipperBase.SlopesEqual4(S.Pt,A.Pt,h.OffPt,this.m_UseFullRange);if(ee){for(A=S.Prev;s.IntPoint.op_Equality(A.Pt,S.Pt)&&A!==S;)A=A.Prev;if(A.Pt.Y>S.Pt.Y||!s.ClipperBase.SlopesEqual4(S.Pt,A.Pt,h.OffPt,this.m_UseFullRange))return!1}for(Z=F.Next;s.IntPoint.op_Equality(Z.Pt,F.Pt)&&Z!==F;)Z=Z.Next;var Se=Z.Pt.Y>F.Pt.Y||!s.ClipperBase.SlopesEqual4(F.Pt,Z.Pt,h.OffPt,this.m_UseFullRange);if(Se){for(Z=F.Prev;s.IntPoint.op_Equality(Z.Pt,F.Pt)&&Z!==F;)Z=Z.Prev;if(Z.Pt.Y>F.Pt.Y||!s.ClipperBase.SlopesEqual4(F.Pt,Z.Pt,h.OffPt,this.m_UseFullRange))return!1}return A===S||Z===F||A===Z||p===_&&ee===Se?!1:ee?(A=this.DupOutPt(S,!1),Z=this.DupOutPt(F,!0),S.Prev=F,F.Next=S,A.Next=Z,Z.Prev=A,h.OutPt1=S,h.OutPt2=A,!0):(A=this.DupOutPt(S,!0),Z=this.DupOutPt(F,!1),S.Next=F,F.Prev=S,A.Prev=Z,Z.Next=A,h.OutPt1=S,h.OutPt2=A,!0)}},s.Clipper.GetBounds=function(h){for(var p=0,_=h.length;p<_&&h[p].length===0;)p++;if(p===_)return new s.IntRect(0,0,0,0);var S=new s.IntRect;for(S.left=h[p][0].X,S.right=S.left,S.top=h[p][0].Y,S.bottom=S.top;p<_;p++)for(var A=0,F=h[p].length;AS.right&&(S.right=h[p][A].X),h[p][A].YS.bottom&&(S.bottom=h[p][A].Y);return S},s.Clipper.prototype.GetBounds2=function(h){var p=h,_=new s.IntRect;for(_.left=h.Pt.X,_.right=h.Pt.X,_.top=h.Pt.Y,_.bottom=h.Pt.Y,h=h.Next;h!==p;)h.Pt.X<_.left&&(_.left=h.Pt.X),h.Pt.X>_.right&&(_.right=h.Pt.X),h.Pt.Y<_.top&&(_.top=h.Pt.Y),h.Pt.Y>_.bottom&&(_.bottom=h.Pt.Y),h=h.Next;return _},s.Clipper.PointInPolygon=function(h,p){var _=0,S=p.length;if(S<3)return 0;for(var A=p[0],F=1;F<=S;++F){var Z=F===S?p[0]:p[F];if(Z.Y===h.Y&&(Z.X===h.X||A.Y===h.Y&&Z.X>h.X==A.X=h.X)if(Z.X>h.X)_=1-_;else{var J=(A.X-h.X)*(Z.Y-h.Y)-(Z.X-h.X)*(A.Y-h.Y);if(J===0)return-1;J>0==Z.Y>A.Y&&(_=1-_)}else if(Z.X>h.X){var J=(A.X-h.X)*(Z.Y-h.Y)-(Z.X-h.X)*(A.Y-h.Y);if(J===0)return-1;J>0==Z.Y>A.Y&&(_=1-_)}}A=Z}return _},s.Clipper.prototype.PointInPolygon=function(h,p){var _=0,S=p,A=h.X,F=h.Y,Z=p.Pt.X,J=p.Pt.Y;do{p=p.Next;var K=p.Pt.X,lt=p.Pt.Y;if(lt===F&&(K===A||J===F&&K>A==Z=A)if(K>A)_=1-_;else{var St=(Z-A)*(lt-F)-(K-A)*(J-F);if(St===0)return-1;St>0==lt>J&&(_=1-_)}else if(K>A){var St=(Z-A)*(lt-F)-(K-A)*(J-F);if(St===0)return-1;St>0==lt>J&&(_=1-_)}}Z=K,J=lt}while(S!==p);return _},s.Clipper.prototype.Poly2ContainsPoly1=function(h,p){var _=h;do{var S=this.PointInPolygon(_.Pt,p);if(S>=0)return S>0;_=_.Next}while(_!==h);return!0},s.Clipper.prototype.FixupFirstLefts1=function(h,p){for(var _,S,A=0,F=this.m_PolyOuts.length;A0&&this.ReversePolyPtLinks(A.Pts)):this.Poly2ContainsPoly1(S.Pts,A.Pts)?(A.IsHole=S.IsHole,S.IsHole=!A.IsHole,A.FirstLeft=S.FirstLeft,S.FirstLeft=A,this.m_UsingPolyTree&&this.FixupFirstLefts2(S,A),(S.IsHole^this.ReverseSolution)==this.Area$1(S)>0&&this.ReversePolyPtLinks(S.Pts)):(A.IsHole=S.IsHole,A.FirstLeft=S.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(S,A))):(A.Pts=null,A.BottomPt=null,A.Idx=S.Idx,S.IsHole=F.IsHole,F===A&&(S.FirstLeft=A.FirstLeft),A.FirstLeft=S,this.m_UsingPolyTree&&this.FixupFirstLefts3(A,S)))}}},s.Clipper.prototype.UpdateOutPtIdxs=function(h){var p=h.Pts;do p.Idx=h.Idx,p=p.Prev;while(p!==h.Pts)},s.Clipper.prototype.DoSimplePolygons=function(){for(var h=0;h"u"&&(p=s.PolyFillType.pftEvenOdd);var _=new Array,S=new s.Clipper(0);return S.StrictlySimple=!0,S.AddPaths(h,s.PolyType.ptSubject,!0),S.Execute(s.ClipType.ctUnion,_,p,p),_},s.Clipper.DistanceSqrd=function(h,p){var _=h.X-p.X,S=h.Y-p.Y;return _*_+S*S},s.Clipper.DistanceFromLineSqrd=function(h,p,_){var S=p.Y-_.Y,A=_.X-p.X,F=S*p.X+A*p.Y;return F=S*h.X+A*h.Y-F,F*F/(S*S+A*A)},s.Clipper.SlopesNearCollinear=function(h,p,_,S){return Math.abs(h.X-p.X)>Math.abs(h.Y-p.Y)?h.X>p.X==h.X<_.X?s.Clipper.DistanceFromLineSqrd(h,p,_)h.X==p.X<_.X?s.Clipper.DistanceFromLineSqrd(p,h,_)p.Y==h.Y<_.Y?s.Clipper.DistanceFromLineSqrd(h,p,_)h.Y==p.Y<_.Y?s.Clipper.DistanceFromLineSqrd(p,h,_)"u"&&(p=1.415);var _=h.length;if(_===0)return new Array;for(var S=new Array(_),A=0;A<_;++A)S[A]=new s.OutPt;for(var A=0;A<_;++A)S[A].Pt=h[A],S[A].Next=S[(A+1)%_],S[A].Next.Prev=S[A],S[A].Idx=0;for(var F=p*p,Z=S[0];Z.Idx===0&&Z.Next!==Z.Prev;)s.Clipper.PointsAreClose(Z.Pt,Z.Prev.Pt,F)?(Z=s.Clipper.ExcludeOp(Z),_--):s.Clipper.PointsAreClose(Z.Prev.Pt,Z.Next.Pt,F)?(s.Clipper.ExcludeOp(Z.Next),Z=s.Clipper.ExcludeOp(Z),_-=2):s.Clipper.SlopesNearCollinear(Z.Prev.Pt,Z.Pt,Z.Next.Pt,F)?(Z=s.Clipper.ExcludeOp(Z),_--):(Z.Idx=1,Z=Z.Next);_<3&&(_=0);for(var J=new Array(_),A=0;A<_;++A)J[A]=new s.IntPoint1(Z.Pt),Z=Z.Next;return S=null,J},s.Clipper.CleanPolygons=function(h,p){for(var _=new Array(h.length),S=0,A=h.length;S0&&S&&_.push(h.m_polygon);for(var A=0,F=h.Childs(),Z=F.length,J=F[A];A"u"&&(h=2),typeof p>"u"&&(p=s.ClipperOffset.def_arc_tolerance),this.m_destPolys=new s.Paths,this.m_srcPoly=new s.Path,this.m_destPoly=new s.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new s.IntPoint0,this.m_polyNodes=new s.PolyNode,this.MiterLimit=h,this.ArcTolerance=p,this.m_lowest.X=-1},s.ClipperOffset.two_pi=6.28318530717959,s.ClipperOffset.def_arc_tolerance=.25,s.ClipperOffset.prototype.Clear=function(){s.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1},s.ClipperOffset.Round=s.Clipper.Round,s.ClipperOffset.prototype.AddPath=function(h,p,_){var S=h.length-1;if(!(S<0)){var A=new s.PolyNode;if(A.m_jointype=p,A.m_endtype=_,_===s.EndType.etClosedLine||_===s.EndType.etClosedPolygon)for(;S>0&&s.IntPoint.op_Equality(h[0],h[S]);)S--;A.m_polygon.push(h[0]);for(var F=0,Z=0,J=1;J<=S;J++)s.IntPoint.op_Inequality(A.m_polygon[F],h[J])&&(F++,A.m_polygon.push(h[J]),(h[J].Y>A.m_polygon[Z].Y||h[J].Y===A.m_polygon[Z].Y&&h[J].XK.Y||A.m_polygon[Z].Y===K.Y&&A.m_polygon[Z].X=0&&!s.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var h=0;h2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var S;this.ArcTolerance<=0?S=s.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(h)*s.ClipperOffset.def_arc_tolerance?S=Math.abs(h)*s.ClipperOffset.def_arc_tolerance:S=this.ArcTolerance;var A=3.14159265358979/Math.acos(1-S/Math.abs(h));this.m_sin=Math.sin(s.ClipperOffset.two_pi/A),this.m_cos=Math.cos(s.ClipperOffset.two_pi/A),this.m_StepsPerRad=A/s.ClipperOffset.two_pi,h<0&&(this.m_sin=-this.m_sin);for(var p=0;p0;K--)this.m_normals[K]=new s.DoublePoint2(-this.m_normals[K-1].X,-this.m_normals[K-1].Y);this.m_normals[0]=new s.DoublePoint2(-Ot.X,-Ot.Y),St=0;for(var K=F-1;K>=0;K--)St=this.OffsetPoint(K,St,_.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var St=0,K=1;K0;K--)this.m_normals[K]=new s.DoublePoint2(-this.m_normals[K-1].X,-this.m_normals[K-1].Y);this.m_normals[0]=new s.DoublePoint2(-this.m_normals[1].X,-this.m_normals[1].Y),St=F-1;for(var K=St-1;K>0;--K)St=this.OffsetPoint(K,St,_.m_jointype);_.m_endtype===s.EndType.etOpenButt?($t=new s.IntPoint2(s.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*h),s.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*h)),this.m_destPoly.push($t),$t=new s.IntPoint2(s.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*h),s.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*h)),this.m_destPoly.push($t)):(St=1,this.m_sinA=0,_.m_endtype===s.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}},s.ClipperOffset.prototype.Execute=function(){var h=arguments,p=h[0]instanceof s.PolyTree;if(p){var _=h[0],S=h[1];_.Clear(),this.FixOrientations(),this.DoOffset(S);var A=new s.Clipper(0);if(A.AddPaths(this.m_destPolys,s.PolyType.ptSubject,!0),S>0)A.Execute(s.ClipType.ctUnion,_,s.PolyFillType.pftPositive,s.PolyFillType.pftPositive);else{var F=s.Clipper.GetBounds(this.m_destPolys),Z=new s.Path;if(Z.push(new s.IntPoint2(F.left-10,F.bottom+10)),Z.push(new s.IntPoint2(F.right+10,F.bottom+10)),Z.push(new s.IntPoint2(F.right+10,F.top-10)),Z.push(new s.IntPoint2(F.left-10,F.top-10)),A.AddPath(Z,s.PolyType.ptSubject,!0),A.ReverseSolution=!0,A.Execute(s.ClipType.ctUnion,_,s.PolyFillType.pftNegative,s.PolyFillType.pftNegative),_.ChildCount()===1&&_.Childs()[0].ChildCount()>0){var J=_.Childs()[0];_.Childs()[0]=J.Childs()[0],_.Childs()[0].m_Parent=_;for(var K=1;K0)A.Execute(s.ClipType.ctUnion,_,s.PolyFillType.pftPositive,s.PolyFillType.pftPositive);else{var F=s.Clipper.GetBounds(this.m_destPolys),Z=new s.Path;Z.push(new s.IntPoint2(F.left-10,F.bottom+10)),Z.push(new s.IntPoint2(F.right+10,F.bottom+10)),Z.push(new s.IntPoint2(F.right+10,F.top-10)),Z.push(new s.IntPoint2(F.left-10,F.top-10)),A.AddPath(Z,s.PolyType.ptSubject,!0),A.ReverseSolution=!0,A.Execute(s.ClipType.ctUnion,_,s.PolyFillType.pftNegative,s.PolyFillType.pftNegative),_.length>0&&_.splice(0,1)}}},s.ClipperOffset.prototype.OffsetPoint=function(h,p,_){if(this.m_sinA=this.m_normals[p].X*this.m_normals[h].Y-this.m_normals[h].X*this.m_normals[p].Y,Math.abs(this.m_sinA*this.m_delta)<1){var S=this.m_normals[p].X*this.m_normals[h].X+this.m_normals[h].Y*this.m_normals[p].Y;if(S>0)return this.m_destPoly.push(new s.IntPoint2(s.ClipperOffset.Round(this.m_srcPoly[h].X+this.m_normals[p].X*this.m_delta),s.ClipperOffset.Round(this.m_srcPoly[h].Y+this.m_normals[p].Y*this.m_delta))),p}else this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1);if(this.m_sinA*this.m_delta<0)this.m_destPoly.push(new s.IntPoint2(s.ClipperOffset.Round(this.m_srcPoly[h].X+this.m_normals[p].X*this.m_delta),s.ClipperOffset.Round(this.m_srcPoly[h].Y+this.m_normals[p].Y*this.m_delta))),this.m_destPoly.push(new s.IntPoint1(this.m_srcPoly[h])),this.m_destPoly.push(new s.IntPoint2(s.ClipperOffset.Round(this.m_srcPoly[h].X+this.m_normals[h].X*this.m_delta),s.ClipperOffset.Round(this.m_srcPoly[h].Y+this.m_normals[h].Y*this.m_delta)));else switch(_){case s.JoinType.jtMiter:{var A=1+(this.m_normals[h].X*this.m_normals[p].X+this.m_normals[h].Y*this.m_normals[p].Y);A>=this.m_miterLim?this.DoMiter(h,p,A):this.DoSquare(h,p);break}case s.JoinType.jtSquare:this.DoSquare(h,p);break;case s.JoinType.jtRound:this.DoRound(h,p);break}return p=h,p},s.ClipperOffset.prototype.DoSquare=function(h,p){var _=Math.tan(Math.atan2(this.m_sinA,this.m_normals[p].X*this.m_normals[h].X+this.m_normals[p].Y*this.m_normals[h].Y)/4);this.m_destPoly.push(new s.IntPoint2(s.ClipperOffset.Round(this.m_srcPoly[h].X+this.m_delta*(this.m_normals[p].X-this.m_normals[p].Y*_)),s.ClipperOffset.Round(this.m_srcPoly[h].Y+this.m_delta*(this.m_normals[p].Y+this.m_normals[p].X*_)))),this.m_destPoly.push(new s.IntPoint2(s.ClipperOffset.Round(this.m_srcPoly[h].X+this.m_delta*(this.m_normals[h].X+this.m_normals[h].Y*_)),s.ClipperOffset.Round(this.m_srcPoly[h].Y+this.m_delta*(this.m_normals[h].Y-this.m_normals[h].X*_))))},s.ClipperOffset.prototype.DoMiter=function(h,p,_){var S=this.m_delta/_;this.m_destPoly.push(new s.IntPoint2(s.ClipperOffset.Round(this.m_srcPoly[h].X+(this.m_normals[p].X+this.m_normals[h].X)*S),s.ClipperOffset.Round(this.m_srcPoly[h].Y+(this.m_normals[p].Y+this.m_normals[h].Y)*S)))},s.ClipperOffset.prototype.DoRound=function(h,p){for(var _=Math.atan2(this.m_sinA,this.m_normals[p].X*this.m_normals[h].X+this.m_normals[p].Y*this.m_normals[h].Y),S=Math.max(s.Cast_Int32(s.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(_))),1),A=this.m_normals[p].X,F=this.m_normals[p].Y,Z,J=0;J1?(Fi=St.X,Fn=St.Y):ci>0&&(Fi+=ee*ci,Fn+=Se*ci)),ee=Ot.X-Fi,Se=Ot.Y-Fn,$t=ee*ee+Se*Se,$t<=fh&&(jt[A+1]=1,A++);for(J.push({X:F[0].X,Y:F[0].Y}),A=1;A2&&Sn.push(J)}return _||(Sn=Sn[0]),typeof Sn>"u"&&(Sn=[]),Sn},s.JS.PerimeterOfPath=function(h,p,_){if(typeof h>"u")return 0;var S=Math.sqrt,A=0,F,Z,J=0,K=0,lt=0,St=0,Ot=h.length;if(Ot<2)return 0;for(p&&(h[Ot]=h[0],Ot++);--Ot;)F=h[Ot],J=F.X,K=F.Y,Z=h[Ot-1],lt=Z.X,St=Z.Y,A+=S((J-lt)*(J-lt)+(K-St)*(K-St));return p&&h.pop(),A/_},s.JS.PerimeterOfPaths=function(h,p,_){_||(_=1);for(var S=0,A=0;A0}},{key:"fixOrientation",value:function(){return this.closed?(this.totalArea()<0&&this.reverse(),this):this}},{key:"removeOverlap",value:function(){console.warn("Shape.removeOverlap is being depricated, use Shape.simplify('pftNonZero') instead"),this.simplify("pftNonZero")}},{key:"simplify",value:function(U){if(this.closed){var T=d.default.Clipper.SimplifyPolygons(this.paths,d.default.PolyFillType[U]);return new z(T,!0)}else return this}},{key:"seperateShapes",value:function(){var U=this,T=[];if(this.closed)(function(){for(var nt=new WeakMap,it=[],It=[],kt=0;kt1e-8>Math.abs(i[0]-t[0])+Math.abs(i[1]-t[1]);function j0(i,t,e={}){let{endType:n,jointType:r="jtRound",miterLimit:o=2,roundPrecision:s=.25}=e;if(!n){const f=i[0][0],g=i.at(-1).at(-1);n=F1(f,g)?"etClosedRound":"etOpenRound"}const{data:a,scale:l}=Y1(i,t),c=new B1(a,!0).offset(t*l,{jointType:r,endType:n,miterLimit:o,roundPrecision:s}),d=Z1(c,l);for(;i.length>d.length;)i.pop();return d.forEach((f,g)=>{i[g]=f}),i}const X1=(i,t)=>{const e={};return e.X=Math.round(i[0]*t),e.Y=Math.round(i[1]*t),e},R1=(i,t)=>Math.sqrt((t[0]-i[0])**2+(t[1]-i[1])**2);function Y1(i,t){const e=[],n=i.flat();for(let s=0;ss.map(l=>X1(l,r))),scale:r}}function Z1(i,t){return Object.values(i.paths).map(n=>(n=n.map(({X:r,Y:o})=>[r/t,o/t]),[...n,n[0]],[...n,n[0]]))}function yo(i,t,e){const n=f=>f.map(([g,x])=>({X:g,Y:x})),r=f=>f.map(({X:g,Y:x})=>[g,x]),a=i.map(n);t=t.map(n);const l=new P.Paths,u=new P.Clipper;u.AddPaths(a,P.PolyType.ptSubject,!0),u.AddPaths(t,P.PolyType.ptClip,!0);const c={intersection:P.ClipType.ctIntersection,union:P.ClipType.ctUnion,difference:P.ClipType.ctDifference,xor:P.ClipType.ctXor};u.Execute(c[e],l);const d=l.map(r);for(;i.length>d.length;)i.pop();return d.forEach((f,g)=>{i[g]=f,i[g].push([f[0][0],f[0][1]])}),i}// @license const Ro={Z:"Z",M:"M",L:"L",C:"C",Q:"Q",A:"A",H:"H",V:"V",S:"S",T:"T",z:"Z",m:"m",l:"l",c:"c",q:"q",a:"a",h:"h",v:"v",s:"s",t:"t"},q0=function(i){this._string=i,this._currentIndex=0,this._endIndex=this._string.length,this._prevCommand=null,this._skipOptionalSpaces()};q0.prototype={parseSegment:function(){var i=this._string[this._currentIndex],t=Ro[i]?Ro[i]:null;if(t===null){if(this._prevCommand===null||((i==="+"||i==="-"||i==="."||i>="0"&&i<="9")&&this._prevCommand!=="Z"?this._prevCommand==="M"?t="L":this._prevCommand==="m"?t="l":t=this._prevCommand:t=null,t===null))return null}else this._currentIndex+=1;this._prevCommand=t;var e=null,n=t.toUpperCase();return n==="H"||n==="V"?e=[this._parseNumber()]:n==="M"||n==="L"||n==="T"?e=[this._parseNumber(),this._parseNumber()]:n==="S"||n==="Q"?e=[this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseNumber()]:n==="C"?e=[this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseNumber()]:n==="A"?e=[this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseArcFlag(),this._parseArcFlag(),this._parseNumber(),this._parseNumber()]:n==="Z"&&(this._skipOptionalSpaces(),e=[]),e===null||e.indexOf(null)>=0?null:{type:t,values:e}},hasMoreData:function(){return this._currentIndex"9")&&this._string[this._currentIndex]!==".")return null;for(var a=this._currentIndex;this._currentIndex="0"&&this._string[this._currentIndex]<="9";)this._currentIndex+=1;if(this._currentIndex!==a)for(var l=this._currentIndex-1,u=1;l>=a;)t+=u*(this._string[l]-"0"),l-=1,u*=10;if(this._currentIndex=this._endIndex||this._string[this._currentIndex]<"0"||this._string[this._currentIndex]>"9")return null;for(;this._currentIndex="0"&&this._string[this._currentIndex]<="9";)e*=10,n+=(this._string.charAt(this._currentIndex)-"0")/e,this._currentIndex+=1}if(this._currentIndex!==s&&this._currentIndex+1=this._endIndex||this._string[this._currentIndex]<"0"||this._string[this._currentIndex]>"9")return null;for(;this._currentIndex="0"&&this._string[this._currentIndex]<="9";)i*=10,i+=this._string[this._currentIndex]-"0",this._currentIndex+=1}var c=t+n;return c*=r,i&&(c*=Math.pow(10,o*i)),s===this._currentIndex?null:(this._skipOptionalSpacesOrDelimiter(),c)},_parseArcFlag:function(){if(this._currentIndex>=this._endIndex)return null;var i=null,t=this._string[this._currentIndex];if(this._currentIndex+=1,t==="0")i=0;else if(t==="1")i=1;else return null;return this._skipOptionalSpacesOrDelimiter(),i}};const Tf=function(i){if(!i||i.length===0)return[];var t=new q0(i),e=[];if(t.initialCommandIsMoveTo())for(;t.hasMoreData();){var n=t.parseSegment();if(n===null)break;e.push(n)}return e},Nr=typeof Symbol<"u"?Symbol():"__cachedPathData",yh=typeof Symbol<"u"?Symbol():"__cachedNormalizedPathData";var V0=function(i,t,e,n,r,o,s,a,l,u){var c=function(Jt){return Math.PI*Jt/180},d=function(Jt,xe,oe){var B=Jt*Math.cos(oe)-xe*Math.sin(oe),ut=Jt*Math.sin(oe)+xe*Math.cos(oe);return{x:B,y:ut}},f=c(s),g=[],x,m,v,O;if(u)x=u[0],m=u[1],v=u[2],O=u[3];else{var b=d(i,t,-f);i=b.x,t=b.y;var k=d(e,n,-f);e=k.x,n=k.y;var E=(i-e)/2,$=(t-n)/2,N=E*E/(r*r)+$*$/(o*o);N>1&&(N=Math.sqrt(N),r=N*r,o=N*o);var X;a===l?X=-1:X=1;var R=r*r,W=o*o,D=R*W-R*$*$-W*E*E,z=R*$*$+W*E*E,Q=X*Math.sqrt(Math.abs(D/z));v=Q*r*$/o+(i+e)/2,O=Q*-o*E/r+(t+n)/2,x=Math.asin(parseFloat(((t-O)/o).toFixed(9))),m=Math.asin(parseFloat(((n-O)/o).toFixed(9))),im&&(x=x-Math.PI*2),!l&&m>x&&(m=m-Math.PI*2)}var U=m-x;if(Math.abs(U)>Math.PI*120/180){var T=m,H=e,gt=n;l&&m>x?m=x+Math.PI*120/180*1:m=x+Math.PI*120/180*-1,e=v+r*Math.cos(m),n=O+o*Math.sin(m),g=V0(e,n,H,gt,r,o,s,0,l,[m,T,v,O])}U=m-x;var at=Math.cos(x),Et=Math.sin(x),pt=Math.cos(m),Pt=Math.sin(m),nt=Math.tan(U/4),it=4/3*r*nt,It=4/3*o*nt,kt=[i,t],xt=[i+it*Et,t-It*at],Kt=[e+it*Pt,n-It*pt],Ct=[e,n];if(xt[0]=2*kt[0]-xt[0],xt[1]=2*kt[1]-xt[1],u)return[xt,Kt,Ct].concat(g);g=[xt,Kt,Ct].concat(g);for(var Wt=[],Yt=0;Ytt in i&&"baseVal"in i[t]?i[t].baseVal.value:+i.getAttribute(t),U1=function(i){if(i&&i.normalize){if(this[yh])return Br(this[yh]);var t;this[Nr]?t=Br(this[Nr]):(t=Tf(this.getAttribute("d")||""),this[Nr]=Br(t));var e=Cl(W1(t));return this[yh]=Br(e),e}else{if(this[Nr])return Br(this[Nr]);var t=Tf(this.getAttribute("d")||"");return this[Nr]=Br(t),t}},z1=function(i){var t=qe(this,"x"),e=qe(this,"y"),n=qe(this,"width"),r=qe(this,"height"),o=this.hasAttribute("rx")?qe(this,"rx"):qe(this,"ry"),s=this.hasAttribute("ry")?qe(this,"ry"):qe(this,"rx");o>n/2&&(o=n/2),s>r/2&&(s=r/2);var a=[{type:"M",values:[t+o,e]},{type:"H",values:[t+n-o]},{type:"A",values:[o,s,0,0,1,t+n,e+s]},{type:"V",values:[e+r-s]},{type:"A",values:[o,s,0,0,1,t+n-o,e+r]},{type:"H",values:[t+o]},{type:"A",values:[o,s,0,0,1,t,e+r-s]},{type:"V",values:[e+s]},{type:"A",values:[o,s,0,0,1,t+o,e]},{type:"Z",values:[]}];return a=a.filter(function(l){return!(l.type==="A"&&(l.values[0]===0||l.values[1]===0))}),i&&i.normalize===!0&&(a=Cl(a)),a},j1=function(i){var t=qe(this,"cx"),e=qe(this,"cy"),n=qe(this,"r"),r=[{type:"M",values:[t+n,e]},{type:"A",values:[n,n,0,0,1,t,e+n]},{type:"A",values:[n,n,0,0,1,t-n,e]},{type:"A",values:[n,n,0,0,1,t,e-n]},{type:"A",values:[n,n,0,0,1,t+n,e]},{type:"Z",values:[]}];return i&&i.normalize===!0&&(r=Cl(r)),r},q1=function(i){var t=qe(this,"cx"),e=qe(this,"cy"),n=qe(this,"rx"),r=qe(this,"ry"),o=[{type:"M",values:[t+n,e]},{type:"A",values:[n,r,0,0,1,t,e+r]},{type:"A",values:[n,r,0,0,1,t-n,e]},{type:"A",values:[n,r,0,0,1,t,e-r]},{type:"A",values:[n,r,0,0,1,t+n,e]},{type:"Z",values:[]}];return i&&i.normalize===!0&&(o=Cl(o)),o},V1=function(){const i=qe(this,"x1"),t=qe(this,"x2"),e=qe(this,"y1"),n=qe(this,"y2");return[{type:"M",values:[i,e]},{type:"L",values:[t,n]}]},G1=function(){for(var i=[],t=0;tn&&!K1(s,t)){const u=tO(s,.5),c=(a+l)/2;o(u[0],a,c),o(u[1],c,l)}else{const u=s[6]-s[0],c=s[7]-s[1];Math.sqrt(u*u+c*c)>0&&r.push(s)}}return o(i,0,1),r}function iO(i,t={}){const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d",i);const{maxError:n=.1}=t,r=[],o=([u,c])=>[u,c],s=J1(e,{normalize:!0});let a=null,l=null;for(const u of s)if(u.type==="M")a=o(u.values),l=a,r.push({points:[a]});else if(u.type==="L")a=o(u.values),r[r.length-1].points.push(a);else if(u.type==="C"){const[c,d,f,g,x,m]=u.values,[v,O]=a,[b,k]=o([c,d]),[E,$]=o([f,g]),[N,X]=o([x,m]),R=eO([v,O,b,k,E,$,N,X],n);for(const W of R)r[r.length-1].points.push([W[6],W[7]]);a=[N,X]}else if(u.type==="A"){const[c,d,f,g,x,m,v]=u.values,O=f,b=x,k=g,{cos:E,sin:$,atan2:N,sqrt:X,sign:R,acos:W,abs:D,ceil:z}=Math,Q=(a[0]-m)/2,U=(a[1]-v)/2,T=E(O)*Q+$(O)*U,H=-$(O)*Q+E(O)*U,gt=T*T,at=H*H,Et=gt/(c*c)+at/(d*d),pt=Et<=1?X(Et)*c:c,Pt=Et<=1?X(Et)*d:d,nt=pt*pt,it=Pt*Pt;let It=(nt*it-nt*at-it*gt)/(nt*at+it*gt);if(D(It)<1e-4&&(It=0),It<0)throw new Error(`bad arc args ${It}`);const kt=(k===b?-1:1)*X(It),xt=kt*pt*H/Pt,Kt=kt*-Pt*T/pt,Ct=E(O)*xt-$(O)*Kt+(a[0]+m)/2,Wt=$(O)*xt+E(O)*Kt+(a[1]+v)/2,Yt=(ut,ft,G,V)=>N(ut*V-ft*G,ut*G+ft*V),te=Yt(1,0,(T-xt)/pt,(H-Kt)/Pt),Jt=Yt((T-xt)/pt,(H-Kt)/Pt,(-T-xt)/pt,(-H-Kt)/Pt)%(Math.PI*2),xe=b===0&&Jt>0?Jt-Math.PI*2:b===1&&Jt<0?Jt+Math.PI*2:Jt,oe=n,B=z(D(xe)/W(1-oe/pt));for(let ut=1;ut<=B;ut++){const ft=te+xe*ut/B,G=E(O)*pt*E(ft)-$(O)*Pt*$(ft)+Ct,V=$(O)*pt*E(ft)+E(O)*Pt*$(ft)+Wt;r[r.length-1].points.push([G,V])}a=[m,v]}else if(u.type==="Z")l&&(a[0]!==l[0]||a[1]!==l[1])&&r[r.length-1].points.push(l);else throw Error(`Unexpected path command: "${u}"`);return r}const Mf=(i,t,e)=>[(1-i)*t.x+i*e.x,(1-i)*t.y+i*e.y],G0=(i,t,e,...n)=>n.length>0?[Mf(i,t,e),...G0(i,e,...n)]:[Mf(i,t,e)],H0=(i,t)=>t.length>1?H0(i,G0(i,...t)):t[0],nO=i=>Array.isArray(i)?{x:i[0],y:i[1]}:i;function rO(i,...t){t=t.map(nO),i.length<0&&(i=[[[0,0]]]),t=[i.at(-1).at(-1),...t];const n=[];for(let r=0;r<=1;r+=1/32){const o=H0(r,t);n.push(o)}return n.forEach(r=>i.at(-1).push(r)),i}const er=(i,t,e=[0,0])=>{const[n,r]=e,[o,s]=t,a=o-n,l=s-r;return sO(i,c=>[c[0]+a,c[1]+l])},sO=(i,t)=>(i.forEach((e,n)=>{i[n]=e.map(t)}),i),Oo=i=>{let t=Number.POSITIVE_INFINITY,e=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return i.flat().forEach(o=>{const[s,a]=o;t>s&&(t=s),ea&&(n=a),r{if(i.length===0&&i.push([0,0]),t==="start")return i[0][0];if(t==="end")return i.at(-1).at(-1);let{xMax:e,xMin:n,yMax:r,yMin:o}=Oo(i),s=(e+n)/2,a=(r+o)/2;if(t==="cc")return[s,a];if(t==="lb")return[n,o];if(t==="rt")return[e,r];if(t==="lc")return[n,a];if(t==="lt")return[n,r];if(t==="cb")return[s,o];if(t==="ct")return[s,r];if(t==="rb")return[e,o];if(t==="rc")return[e,a];throw'"'+t+'" is not an origin point. "right" or "left" come first then "bottom" or "top"'},Pc=(i,t,e)=>(e||(e=br(i,"cc")),oO(i,r=>{let o=t/180*Math.PI,s=r[0]-e[0],a=r[1]-e[1];return[s*Math.cos(o)-a*Math.sin(o)+e[0],a*Math.cos(o)+s*Math.sin(o)+e[1]]})),oO=(i,t)=>(i.forEach((e,n)=>{i[n]=e.map(t)}),i),J0=(i,t,e)=>{if(i.length===0&&i.push([[0,0]]),e===0)return i;const n=i.at(-1).at(-1),r=aO(i)+t,o=Math.cos($f(r)),s=Math.sin($f(r)),a=n[0]+e*o,l=n[1]+e*s;return i.at(-1).push([a,l]),i};function aO(i){const t=i.at(-1);if(t.length<2)return 0;const e=t.at(-1),n=t.at(-2),r=e[0]-n[0],o=e[1]-n[1];return Math.atan2(o,r)*180/Math.PI}const $f=i=>i/180*Math.PI;function Qf(i){const t=i.at(-1);if(t.length<2)return 0;const e=t.at(-1),n=t.at(-2),r=e[0]-n[0],o=e[1]-n[1];return Math.atan2(o,r)*180/Math.PI}const lO=(i,t,e)=>{if(t===0||e===0)return i;i.length===0&&i.push([[0,0]]);const n=32,r=[[]],o=t/180*Math.PI,s=i.at(-1).at(-1),a=Qf(i),l=(d,f)=>f*Math.cos(d),u=(d,f)=>f*Math.sin(d);for(let d=0;d<=n;d++){const f=o/n*d,g=l(f,e),x=u(f,e);r[0].push([g,x])}er(r,s,r[0][0]),Pc(r,a+(t<0?90:-90),r[0][0]),r[0].slice(1).forEach(d=>i.at(-1).push(d));const c=Qf(i);return J0(i,t+a-c,e/1e12),i},Pl=(i,t,e)=>{if(i.length===0)return i;e||(e=br(i,"cc"));const[n,r]=e;typeof t=="number"&&(t=[t,t]);const[o,s]=t;return hO(i,l=>[(l[0]-n)*o+n,(l[1]-r)*s+r])},hO=(i,t)=>(i.forEach((e,n)=>{i[n]=e.map(t)}),i),bs=(i,t)=>gu(i,t)<1e-6,gu=([i,t],[e,n])=>Math.sqrt((e-i)**2+(n-t)**2),uO=(i,t)=>Math.sqrt((t[0]-i[0])**2+(t[1]-i[1])**2),Yo=(i,t)=>{const e=uO(i,t);return[(t[0]-i[0])/e,(t[1]-i[1])/e]},cO=i=>{const t=Math.sqrt(i[0]**2+i[1]**2);return[i[0]/t,i[1]/t]},fO=(i,t,e,n)=>{const r=Math.sin(n*(1-i))/Math.sin(n),o=Math.sin(n*i)/Math.sin(n);return[t[0]*r+e[0]*o,t[1]*r+e[1]*o]};function Nf(i){if(typeof i[0]!="string")return i;if(i[0]==="chamfer"){const[t,e,n]=i;return n}else if(i[0]==="fillet"){const[t,e,n]=i;return n}else{if(i[0]==="bezier")throw"Can't begin wire with bezier.";return null}}function dO(i){const t=[];let e=!1;return i.forEach(n=>{n[0]==="bezier"&&e===!0?t.at(-1).push(...n.slice(1)):(t.push(n),e=!1),n[0]==="bezier"&&(e=!0)}),t}function pO(i){if(i.length===0)return[[]];i=dO(i);let t=Nf(i[0]);const e=[t];for(let n=1;n0&&e.push(...c)}else throw"Beziers requires previous and next points.";t=e.at(-1)}}return[e]}const Bf=(i,t,e)=>[(1-i)*t[0]+i*e[0],(1-i)*t[1]+i*e[1]],K0=(i,t,e,...n)=>n.length>0?[Bf(i,t,e),...K0(i,e,...n)]:[Bf(i,t,e)],tm=(i,t)=>t.length>1?tm(i,K0(i,...t)):t[0];function mO(i){const t=[];for(let e=0;e<=1;e+=1/64){const n=tm(e,i);t.push(n)}return t}const Zs=(i,t)=>vu(i,t)<1e-6,vu=([i,t],[e,n])=>Math.sqrt((e-i)**2+(n-t)**2),gO=(i,t)=>Math.sqrt((t[0]-i[0])**2+(t[1]-i[1])**2),Ff=(i,t)=>{const e=gO(i,t);return[(t[0]-i[0])/e,(t[1]-i[1])/e]},vO=i=>{const t=Math.sqrt(i[0]**2+i[1]**2);return[i[0]/t,i[1]/t]};function Zo(i,t=[0,0],e=[0,0]){if(typeof i[0]!="string")return i;if(i[0]==="chamfer"){const[n,r,o]=i;return o}else if(i[0]==="fillet"){const[n,r,o]=i;return o}else if(i[0]==="cubic"){const[n,r,o,s]=i;return o}else if(i[0]==="rel"){const[n,r,o]=i;return[t[0]+r,t[1]+o]}else if(i[0]==="turnForward"){const[n,r,o]=i,s=r/180*Math.PI,a=xO(t,e)+s;return[t[0]+Math.cos(a)*o,t[1]+Math.sin(a)*o]}else return null}function yO(i){if(typeof i[0]!="string")return i;if(i[0]==="chamfer"){const[t,e,n]=i;return n}else if(i[0]==="fillet"){const[t,e,n]=i;return n}else if(i[0]==="cubic"){const[t,e,n,r]=i;return r}else return null}function OO(i,t,e){const[n,r]=i,[o,s]=t,[a,l]=e,u=n-a,c=r-l,d=o-a,f=s-l,g=u*u+c*c,x=g+u*d+c*f,m=4/3*(Math.sqrt(2*g*x)-x)/(u*f-c*d),v=a+u-m*c,O=l+c+m*u,b=a+d+m*f,k=l+f-m*d;return[[n,r],[v,O],[b,k],[o,s]]}function _O(i,t,e,n){if(Zs(t,i)||Zs(t,e)||Zs(i,e)||n<=0)return null;const r=Ff(t,i),o=Ff(t,e),s=Math.acos(r[0]*o[0]+r[1]*o[1]);let a=n/Math.tan(s/2);const l=vu(i,t),u=vu(e,t);a=Math.min(l,u,a),n=Math.min(a*Math.tan(s/2),n);const c=[t[0]+r[0]*a,t[1]+r[1]*a],d=[t[0]+o[0]*a,t[1]+o[1]*a],f=vO([r[0]+o[0],r[1]+o[1]]),g=Math.sqrt(a**2+n**2),x=[t[0]+f[0]*g,t[1]+f[1]*g];return[c,d,x]}function xO(i,t){const e=i[0]-t[0],n=i[1]-t[1];return Math.atan2(n,e)}function bO(i){const t=[],e=[];if(i.length===0)return{cubics:t,filletsAndChamfers:e};let n=Zo(i[0]),r=yO(i[0]);r===null&&(r=n);const o=()=>t.length>0?wa(t.at(-1),32).slice(-2).reverse():[n,n];for(let s=1;s{d.cubicIndex===a&&a!==t.length-1&&(d.ptIndex=n.length-1,d.lowerIndex=u,d.upperIndex=d.ptIndex+wa(t[a+1],r).length-1,o.push(d))};e.forEach(c)}let s=0;return o.forEach(a=>{if(a.radius<=0||a.upperIndex-a.lowerIndex>2)return;let l=-1,u=1;if(l=Math.max(l,a.lowerIndex-a.ptIndex),u=Math.min(u,a.upperIndex-a.ptIndex),l>=u)return;const c=a.ptIndex+s,d=n[c],f=n[c+l],g=n[c+u],x=_O(f,d,g,a.radius);if(x){const[m,v,O]=x,b=c+l+1,k=c+u,E=a.type==="fillet"?wa(OO(m,v,O),r):[m,v];n=[...n.slice(0,b),...E,...n.slice(k)],s+=E.length-(u-l-1)}}),n}const Xf=(i,t,e)=>[(1-i)*t[0]+i*e[0],(1-i)*t[1]+i*e[1]],im=(i,t,e,...n)=>n.length>0?[Xf(i,t,e),...im(i,e,...n)]:[Xf(i,t,e)],nm=(i,t)=>t.length>1?nm(i,im(i,...t)):t[0];function wa(i,t){if(Zs(i[0],i[1])&&Zs(i[2],i[3]))return[i[0],i[3]];const e=[];for(let n=0;n<=1*t;n+=1){const r=nm(n/t,i);e.push(r)}return e}function wO(i,t,e){typeof t=="number"&&(t=[t]);let n=0,r=[];for(const o of i){r.push([]);for(let s=1;si.push(o)),i}const Rf=(i,t)=>yu(i,t)<1e-6,yu=([i,t],[e,n])=>Math.sqrt((e-i)**2+(n-t)**2),SO=(i,t)=>Math.sqrt((t[0]-i[0])**2+(t[1]-i[1])**2),Yf=(i,t)=>{const e=SO(i,t);return[(t[0]-i[0])/e,(t[1]-i[1])/e]},CO=i=>{const t=Math.sqrt(i[0]**2+i[1]**2);return[i[0]/t,i[1]/t]},PO=(i,t,e,n)=>{const r=Math.sin(n*(1-i))/Math.sin(n),o=Math.sin(n*i)/Math.sin(n);return[t[0]*r+e[0]*o,t[1]*r+e[1]*o]};function rm(){const[i,...t]=arguments;return t.reduce((e,n)=>yo(e,n,"union"),i)}function kO(){const[i,...t]=arguments;return t.reduce((e,n)=>yo(e,n,"intersect"),i)}function LO(){const[i,...t]=arguments;return t.reduce((e,n)=>yo(e,n,"difference"),i)}function AO(){const[i,...t]=arguments;return t.reduce((e,n)=>yo(e,n,"xor"),i)}function EO(i){if(i.length===0)throw new Error("Shape must have at least one pt.");const t=i.at(-1);if(t.length<2)return 0;const e=t.at(-1),n=t.at(-2),r=e[0]-n[0],o=e[1]-n[1];return Math.atan2(o,r)*180/Math.PI}const DO=(i,[t,e])=>{i.length===0&&i.push([[0,0]]);const[n,r]=i.at(-1).at(-1);return i.at(-1).push([n+t,r+e]),i},TO=i=>{if(i.length===0)throw new Error("Shape must have at least one pt.");const[t,e]=i[0][0];return i.at(-1).push([t,e]),i},IO=i=>{const t=i.flat();if(t.length===1)return t[0];if(t.length===2)return{x:(t[0][0]+t[1][0])/2,y:(t[0][1]+t[1][1])/2};var e=t[0],n=t[t.length-1];(e[0]!=n[0]||e[1]!=n[1])&&t.push(e);for(var r=0,o=0,s=0,a=t.length,l,u,c,d=0,f=a-1;dJSON.parse(JSON.stringify(i)),sm=i=>{const{xMin:t,xMax:e}=Oo(i);return e-t},om=i=>{const{yMin:t,yMax:e}=Oo(i);return e-t},MO=i=>{const t=br(i,"cc");return er(i,[0,0],t)},$O=(i,t)=>(i.at(-1).push(t),i),QO=i=>i.map(t=>t.reverse()).reverse(),NO=i=>Sl(i,0,{endType:"etClosedPolygon"}),BO=(i,t)=>Sl(i,t,{endType:"etClosedPolygon"}),FO=(i,t)=>{const e=(s,a)=>1e-8>Math.abs(s[0]-a[0])+Math.abs(s[1]-a[1]),n=i[0][0],r=i.at(-1).at(-1),o=e(n,r)?"etClosedLine":"etOpenButt";return Sl(i,t/2,{endType:o,jointType:"jtMiter"})},XO=(i,t,e)=>{const n=kc(i);for(let r=0;r{let t="";return i.forEach(e=>{const[n,r]=e[0];t+=`M ${n},${r}`,e.slice(1).forEach(o=>{const[s,a]=o;t+=`L ${s},${a}`})}),t};function Cr(i,t){return iO(t,{maxError:.001}).map(n=>n.points).forEach(n=>i.push(n)),i}const RO=(i,t)=>{const e=[-i/2,t/2],n=[i/2,t/2],r=[i/2,-t/2],o=[-i/2,-t/2];return[[e,n,r,o,e]]},am=i=>{const e=[],n=(a,l)=>l*Math.cos(a),r=(a,l)=>l*Math.sin(a);for(let a=0;a<180;a++){const l=Math.PI*2/180*a,u=n(l,i),c=r(l,i);e.push([u,c])}const[o,s]=e[0];return e.push([o,s]),[e]},YO=i=>i.map(t=>t.map(([e,n])=>({x:e,y:n}))),ZO=Object.freeze(Object.defineProperty({__proto__:null,arc:lO,bezier:rO,boolean:yo,centroid:IO,circle:am,close:TO,convertPtType:YO,copy:kc,copyPaste:XO,difference:LO,expand:BO,extrema:Oo,fillet:wO,getAngle:EO,getPathData:An,getPoint:br,goTo:$O,height:om,intersect:kO,offset:Sl,offset2:j0,originate:MO,outline:NO,path:pO,path2:em,pathD:Cr,rectangle:RO,reverse:QO,rotate:Pc,scale:Pl,thicken:FO,transform:Z0,translate:er,turnForward:J0,union:rm,vec:DO,width:sm,xor:AO},Symbol.toStringTag,{value:"Module"})),WO=1.6,UO="User",zO=297,ur=210,jO="20221018",qO=0;function ri(i){return i*Mt.mm_per_unit}const cn=Object.freeze({RECTANGLE:"rect",CIRCLE:"circle"}),Ri=Object.freeze({PRIMITIVE:"PRIMITIVE",POLYGON:"POLYGON"});var po,mo,fl;class lm{constructor(t={}){ke(this,po,"SvgPcb");ke(this,mo,Ri.POLYGON);ke(this,fl,cn.RECTANGLE);t.libraryName&&(zt(this,po,t.libraryName),zt(this,mo,t.padShapeType))}get libraryName(){return Qt(this,po)}get padShapeType(){return Qt(this,mo)}get padPrimitiveShape(){return Qt(this,fl)}}po=new WeakMap,mo=new WeakMap,fl=new WeakMap;var di,is,dl,hm,pl,um,ns,Sa,go,Ou;class VO{constructor(t){ke(this,dl);ke(this,pl);ke(this,ns);ke(this,go);ke(this,di,"");ke(this,is,new lm);zt(this,di,""),zt(this,is,t)}plotWires(t,e){const n=[];t.forEach(r=>{r.type==="wire"&&n.push(r)}),n.forEach(r=>{const o=ri(r.thickness).toFixed(3),s=e,a=0;r.shape.forEach(u=>{for(let c=0;c"9")&&this._string[this._currentIndex]!==".")return null;for(var a=this._currentIndex;this._currentIndex="0"&&this._string[this._currentIndex]<="9";)this._currentIndex+=1;if(this._currentIndex!==a)for(var l=this._currentIndex-1,u=1;l>=a;)t+=u*(this._string[l]-"0"),l-=1,u*=10;if(this._currentIndex=this._endIndex||this._string[this._currentIndex]<"0"||this._string[this._currentIndex]>"9")return null;for(;this._currentIndex="0"&&this._string[this._currentIndex]<="9";)e*=10,n+=(this._string.charAt(this._currentIndex)-"0")/e,this._currentIndex+=1}if(this._currentIndex!==s&&this._currentIndex+1=this._endIndex||this._string[this._currentIndex]<"0"||this._string[this._currentIndex]>"9")return null;for(;this._currentIndex="0"&&this._string[this._currentIndex]<="9";)i*=10,i+=this._string[this._currentIndex]-"0",this._currentIndex+=1}var c=t+n;return c*=r,i&&(c*=Math.pow(10,o*i)),s===this._currentIndex?null:(this._skipOptionalSpacesOrDelimiter(),c)},_parseArcFlag:function(){if(this._currentIndex>=this._endIndex)return null;var i=null,t=this._string[this._currentIndex];if(this._currentIndex+=1,t==="0")i=0;else if(t==="1")i=1;else return null;return this._skipOptionalSpacesOrDelimiter(),i}};const Tf=function(i){if(!i||i.length===0)return[];var t=new q0(i),e=[];if(t.initialCommandIsMoveTo())for(;t.hasMoreData();){var n=t.parseSegment();if(n===null)break;e.push(n)}return e},Nr=typeof Symbol<"u"?Symbol():"__cachedPathData",yh=typeof Symbol<"u"?Symbol():"__cachedNormalizedPathData";var V0=function(i,t,e,n,r,o,s,a,l,u){var c=function(Jt){return Math.PI*Jt/180},d=function(Jt,xe,oe){var B=Jt*Math.cos(oe)-xe*Math.sin(oe),ut=Jt*Math.sin(oe)+xe*Math.cos(oe);return{x:B,y:ut}},f=c(s),g=[],x,m,v,O;if(u)x=u[0],m=u[1],v=u[2],O=u[3];else{var b=d(i,t,-f);i=b.x,t=b.y;var k=d(e,n,-f);e=k.x,n=k.y;var E=(i-e)/2,$=(t-n)/2,Q=E*E/(r*r)+$*$/(o*o);Q>1&&(Q=Math.sqrt(Q),r=Q*r,o=Q*o);var X;a===l?X=-1:X=1;var R=r*r,W=o*o,D=R*W-R*$*$-W*E*E,z=R*$*$+W*E*E,N=X*Math.sqrt(Math.abs(D/z));v=N*r*$/o+(i+e)/2,O=N*-o*E/r+(t+n)/2,x=Math.asin(parseFloat(((t-O)/o).toFixed(9))),m=Math.asin(parseFloat(((n-O)/o).toFixed(9))),im&&(x=x-Math.PI*2),!l&&m>x&&(m=m-Math.PI*2)}var U=m-x;if(Math.abs(U)>Math.PI*120/180){var T=m,H=e,gt=n;l&&m>x?m=x+Math.PI*120/180*1:m=x+Math.PI*120/180*-1,e=v+r*Math.cos(m),n=O+o*Math.sin(m),g=V0(e,n,H,gt,r,o,s,0,l,[m,T,v,O])}U=m-x;var at=Math.cos(x),Et=Math.sin(x),pt=Math.cos(m),Pt=Math.sin(m),nt=Math.tan(U/4),it=4/3*r*nt,It=4/3*o*nt,kt=[i,t],xt=[i+it*Et,t-It*at],Kt=[e+it*Pt,n-It*pt],Ct=[e,n];if(xt[0]=2*kt[0]-xt[0],xt[1]=2*kt[1]-xt[1],u)return[xt,Kt,Ct].concat(g);g=[xt,Kt,Ct].concat(g);for(var Wt=[],Yt=0;Ytt in i&&"baseVal"in i[t]?i[t].baseVal.value:+i.getAttribute(t),U1=function(i){if(i&&i.normalize){if(this[yh])return Br(this[yh]);var t;this[Nr]?t=Br(this[Nr]):(t=Tf(this.getAttribute("d")||""),this[Nr]=Br(t));var e=Cl(W1(t));return this[yh]=Br(e),e}else{if(this[Nr])return Br(this[Nr]);var t=Tf(this.getAttribute("d")||"");return this[Nr]=Br(t),t}},z1=function(i){var t=qe(this,"x"),e=qe(this,"y"),n=qe(this,"width"),r=qe(this,"height"),o=this.hasAttribute("rx")?qe(this,"rx"):qe(this,"ry"),s=this.hasAttribute("ry")?qe(this,"ry"):qe(this,"rx");o>n/2&&(o=n/2),s>r/2&&(s=r/2);var a=[{type:"M",values:[t+o,e]},{type:"H",values:[t+n-o]},{type:"A",values:[o,s,0,0,1,t+n,e+s]},{type:"V",values:[e+r-s]},{type:"A",values:[o,s,0,0,1,t+n-o,e+r]},{type:"H",values:[t+o]},{type:"A",values:[o,s,0,0,1,t,e+r-s]},{type:"V",values:[e+s]},{type:"A",values:[o,s,0,0,1,t+o,e]},{type:"Z",values:[]}];return a=a.filter(function(l){return!(l.type==="A"&&(l.values[0]===0||l.values[1]===0))}),i&&i.normalize===!0&&(a=Cl(a)),a},j1=function(i){var t=qe(this,"cx"),e=qe(this,"cy"),n=qe(this,"r"),r=[{type:"M",values:[t+n,e]},{type:"A",values:[n,n,0,0,1,t,e+n]},{type:"A",values:[n,n,0,0,1,t-n,e]},{type:"A",values:[n,n,0,0,1,t,e-n]},{type:"A",values:[n,n,0,0,1,t+n,e]},{type:"Z",values:[]}];return i&&i.normalize===!0&&(r=Cl(r)),r},q1=function(i){var t=qe(this,"cx"),e=qe(this,"cy"),n=qe(this,"rx"),r=qe(this,"ry"),o=[{type:"M",values:[t+n,e]},{type:"A",values:[n,r,0,0,1,t,e+r]},{type:"A",values:[n,r,0,0,1,t-n,e]},{type:"A",values:[n,r,0,0,1,t,e-r]},{type:"A",values:[n,r,0,0,1,t+n,e]},{type:"Z",values:[]}];return i&&i.normalize===!0&&(o=Cl(o)),o},V1=function(){const i=qe(this,"x1"),t=qe(this,"x2"),e=qe(this,"y1"),n=qe(this,"y2");return[{type:"M",values:[i,e]},{type:"L",values:[t,n]}]},G1=function(){for(var i=[],t=0;tn&&!K1(s,t)){const u=tO(s,.5),c=(a+l)/2;o(u[0],a,c),o(u[1],c,l)}else{const u=s[6]-s[0],c=s[7]-s[1];Math.sqrt(u*u+c*c)>0&&r.push(s)}}return o(i,0,1),r}function iO(i,t={}){const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d",i);const{maxError:n=.1}=t,r=[],o=([u,c])=>[u,c],s=J1(e,{normalize:!0});let a=null,l=null;for(const u of s)if(u.type==="M")a=o(u.values),l=a,r.push({points:[a]});else if(u.type==="L")a=o(u.values),r[r.length-1].points.push(a);else if(u.type==="C"){const[c,d,f,g,x,m]=u.values,[v,O]=a,[b,k]=o([c,d]),[E,$]=o([f,g]),[Q,X]=o([x,m]),R=eO([v,O,b,k,E,$,Q,X],n);for(const W of R)r[r.length-1].points.push([W[6],W[7]]);a=[Q,X]}else if(u.type==="A"){const[c,d,f,g,x,m,v]=u.values,O=f,b=x,k=g,{cos:E,sin:$,atan2:Q,sqrt:X,sign:R,acos:W,abs:D,ceil:z}=Math,N=(a[0]-m)/2,U=(a[1]-v)/2,T=E(O)*N+$(O)*U,H=-$(O)*N+E(O)*U,gt=T*T,at=H*H,Et=gt/(c*c)+at/(d*d),pt=Et<=1?X(Et)*c:c,Pt=Et<=1?X(Et)*d:d,nt=pt*pt,it=Pt*Pt;let It=(nt*it-nt*at-it*gt)/(nt*at+it*gt);if(D(It)<1e-4&&(It=0),It<0)throw new Error(`bad arc args ${It}`);const kt=(k===b?-1:1)*X(It),xt=kt*pt*H/Pt,Kt=kt*-Pt*T/pt,Ct=E(O)*xt-$(O)*Kt+(a[0]+m)/2,Wt=$(O)*xt+E(O)*Kt+(a[1]+v)/2,Yt=(ut,ft,G,V)=>Q(ut*V-ft*G,ut*G+ft*V),te=Yt(1,0,(T-xt)/pt,(H-Kt)/Pt),Jt=Yt((T-xt)/pt,(H-Kt)/Pt,(-T-xt)/pt,(-H-Kt)/Pt)%(Math.PI*2),xe=b===0&&Jt>0?Jt-Math.PI*2:b===1&&Jt<0?Jt+Math.PI*2:Jt,oe=n,B=z(D(xe)/W(1-oe/pt));for(let ut=1;ut<=B;ut++){const ft=te+xe*ut/B,G=E(O)*pt*E(ft)-$(O)*Pt*$(ft)+Ct,V=$(O)*pt*E(ft)+E(O)*Pt*$(ft)+Wt;r[r.length-1].points.push([G,V])}a=[m,v]}else if(u.type==="Z")l&&(a[0]!==l[0]||a[1]!==l[1])&&r[r.length-1].points.push(l);else throw Error(`Unexpected path command: "${u}"`);return r}const Mf=(i,t,e)=>[(1-i)*t.x+i*e.x,(1-i)*t.y+i*e.y],G0=(i,t,e,...n)=>n.length>0?[Mf(i,t,e),...G0(i,e,...n)]:[Mf(i,t,e)],H0=(i,t)=>t.length>1?H0(i,G0(i,...t)):t[0],nO=i=>Array.isArray(i)?{x:i[0],y:i[1]}:i;function rO(i,...t){t=t.map(nO),i.length<0&&(i=[[[0,0]]]),t=[i.at(-1).at(-1),...t];const n=[];for(let r=0;r<=1;r+=1/32){const o=H0(r,t);n.push(o)}return n.forEach(r=>i.at(-1).push(r)),i}const er=(i,t,e=[0,0])=>{const[n,r]=e,[o,s]=t,a=o-n,l=s-r;return sO(i,c=>[c[0]+a,c[1]+l])},sO=(i,t)=>(i.forEach((e,n)=>{i[n]=e.map(t)}),i),Oo=i=>{let t=Number.POSITIVE_INFINITY,e=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return i.flat().forEach(o=>{const[s,a]=o;t>s&&(t=s),ea&&(n=a),r{if(i.length===0&&i.push([0,0]),t==="start")return i[0][0];if(t==="end")return i.at(-1).at(-1);let{xMax:e,xMin:n,yMax:r,yMin:o}=Oo(i),s=(e+n)/2,a=(r+o)/2;if(t==="cc")return[s,a];if(t==="lb")return[n,o];if(t==="rt")return[e,r];if(t==="lc")return[n,a];if(t==="lt")return[n,r];if(t==="cb")return[s,o];if(t==="ct")return[s,r];if(t==="rb")return[e,o];if(t==="rc")return[e,a];throw'"'+t+'" is not an origin point. "right" or "left" come first then "bottom" or "top"'},Pc=(i,t,e)=>(e||(e=br(i,"cc")),oO(i,r=>{let o=t/180*Math.PI,s=r[0]-e[0],a=r[1]-e[1];return[s*Math.cos(o)-a*Math.sin(o)+e[0],a*Math.cos(o)+s*Math.sin(o)+e[1]]})),oO=(i,t)=>(i.forEach((e,n)=>{i[n]=e.map(t)}),i),J0=(i,t,e)=>{if(i.length===0&&i.push([[0,0]]),e===0)return i;const n=i.at(-1).at(-1),r=aO(i)+t,o=Math.cos($f(r)),s=Math.sin($f(r)),a=n[0]+e*o,l=n[1]+e*s;return i.at(-1).push([a,l]),i};function aO(i){const t=i.at(-1);if(t.length<2)return 0;const e=t.at(-1),n=t.at(-2),r=e[0]-n[0],o=e[1]-n[1];return Math.atan2(o,r)*180/Math.PI}const $f=i=>i/180*Math.PI;function Qf(i){const t=i.at(-1);if(t.length<2)return 0;const e=t.at(-1),n=t.at(-2),r=e[0]-n[0],o=e[1]-n[1];return Math.atan2(o,r)*180/Math.PI}const lO=(i,t,e)=>{if(t===0||e===0)return i;i.length===0&&i.push([[0,0]]);const n=32,r=[[]],o=t/180*Math.PI,s=i.at(-1).at(-1),a=Qf(i),l=(d,f)=>f*Math.cos(d),u=(d,f)=>f*Math.sin(d);for(let d=0;d<=n;d++){const f=o/n*d,g=l(f,e),x=u(f,e);r[0].push([g,x])}er(r,s,r[0][0]),Pc(r,a+(t<0?90:-90),r[0][0]),r[0].slice(1).forEach(d=>i.at(-1).push(d));const c=Qf(i);return J0(i,t+a-c,e/1e12),i},Pl=(i,t,e)=>{if(i.length===0)return i;e||(e=br(i,"cc"));const[n,r]=e;typeof t=="number"&&(t=[t,t]);const[o,s]=t;return hO(i,l=>[(l[0]-n)*o+n,(l[1]-r)*s+r])},hO=(i,t)=>(i.forEach((e,n)=>{i[n]=e.map(t)}),i),bs=(i,t)=>gu(i,t)<1e-6,gu=([i,t],[e,n])=>Math.sqrt((e-i)**2+(n-t)**2),uO=(i,t)=>Math.sqrt((t[0]-i[0])**2+(t[1]-i[1])**2),Yo=(i,t)=>{const e=uO(i,t);return[(t[0]-i[0])/e,(t[1]-i[1])/e]},cO=i=>{const t=Math.sqrt(i[0]**2+i[1]**2);return[i[0]/t,i[1]/t]},fO=(i,t,e,n)=>{const r=Math.sin(n*(1-i))/Math.sin(n),o=Math.sin(n*i)/Math.sin(n);return[t[0]*r+e[0]*o,t[1]*r+e[1]*o]};function Nf(i){if(typeof i[0]!="string")return i;if(i[0]==="chamfer"){const[t,e,n]=i;return n}else if(i[0]==="fillet"){const[t,e,n]=i;return n}else{if(i[0]==="bezier")throw"Can't begin wire with bezier.";return null}}function dO(i){const t=[];let e=!1;return i.forEach(n=>{n[0]==="bezier"&&e===!0?t.at(-1).push(...n.slice(1)):(t.push(n),e=!1),n[0]==="bezier"&&(e=!0)}),t}function pO(i){if(i.length===0)return[[]];i=dO(i);let t=Nf(i[0]);const e=[t];for(let n=1;n0&&e.push(...c)}else throw"Beziers requires previous and next points.";t=e.at(-1)}}return[e]}const Bf=(i,t,e)=>[(1-i)*t[0]+i*e[0],(1-i)*t[1]+i*e[1]],K0=(i,t,e,...n)=>n.length>0?[Bf(i,t,e),...K0(i,e,...n)]:[Bf(i,t,e)],tm=(i,t)=>t.length>1?tm(i,K0(i,...t)):t[0];function mO(i){const t=[];for(let e=0;e<=1;e+=1/64){const n=tm(e,i);t.push(n)}return t}const Zs=(i,t)=>vu(i,t)<1e-6,vu=([i,t],[e,n])=>Math.sqrt((e-i)**2+(n-t)**2),gO=(i,t)=>Math.sqrt((t[0]-i[0])**2+(t[1]-i[1])**2),Ff=(i,t)=>{const e=gO(i,t);return[(t[0]-i[0])/e,(t[1]-i[1])/e]},vO=i=>{const t=Math.sqrt(i[0]**2+i[1]**2);return[i[0]/t,i[1]/t]};function Zo(i,t=[0,0],e=[0,0]){if(typeof i[0]!="string")return i;if(i[0]==="chamfer"){const[n,r,o]=i;return o}else if(i[0]==="fillet"){const[n,r,o]=i;return o}else if(i[0]==="cubic"){const[n,r,o,s]=i;return o}else if(i[0]==="rel"){const[n,r,o]=i;return[t[0]+r,t[1]+o]}else if(i[0]==="turnForward"){const[n,r,o]=i,s=r/180*Math.PI,a=xO(t,e)+s;return[t[0]+Math.cos(a)*o,t[1]+Math.sin(a)*o]}else return null}function yO(i){if(typeof i[0]!="string")return i;if(i[0]==="chamfer"){const[t,e,n]=i;return n}else if(i[0]==="fillet"){const[t,e,n]=i;return n}else if(i[0]==="cubic"){const[t,e,n,r]=i;return r}else return null}function OO(i,t,e){const[n,r]=i,[o,s]=t,[a,l]=e,u=n-a,c=r-l,d=o-a,f=s-l,g=u*u+c*c,x=g+u*d+c*f,m=4/3*(Math.sqrt(2*g*x)-x)/(u*f-c*d),v=a+u-m*c,O=l+c+m*u,b=a+d+m*f,k=l+f-m*d;return[[n,r],[v,O],[b,k],[o,s]]}function _O(i,t,e,n){if(Zs(t,i)||Zs(t,e)||Zs(i,e)||n<=0)return null;const r=Ff(t,i),o=Ff(t,e),s=Math.acos(r[0]*o[0]+r[1]*o[1]);let a=n/Math.tan(s/2);const l=vu(i,t),u=vu(e,t);a=Math.min(l,u,a),n=Math.min(a*Math.tan(s/2),n);const c=[t[0]+r[0]*a,t[1]+r[1]*a],d=[t[0]+o[0]*a,t[1]+o[1]*a],f=vO([r[0]+o[0],r[1]+o[1]]),g=Math.sqrt(a**2+n**2),x=[t[0]+f[0]*g,t[1]+f[1]*g];return[c,d,x]}function xO(i,t){const e=i[0]-t[0],n=i[1]-t[1];return Math.atan2(n,e)}function bO(i){const t=[],e=[];if(i.length===0)return{cubics:t,filletsAndChamfers:e};let n=Zo(i[0]),r=yO(i[0]);r===null&&(r=n);const o=()=>t.length>0?wa(t.at(-1),32).slice(-2).reverse():[n,n];for(let s=1;s{d.cubicIndex===a&&a!==t.length-1&&(d.ptIndex=n.length-1,d.lowerIndex=u,d.upperIndex=d.ptIndex+wa(t[a+1],r).length-1,o.push(d))};e.forEach(c)}let s=0;return o.forEach(a=>{if(a.radius<=0||a.upperIndex-a.lowerIndex>2)return;let l=-1,u=1;if(l=Math.max(l,a.lowerIndex-a.ptIndex),u=Math.min(u,a.upperIndex-a.ptIndex),l>=u)return;const c=a.ptIndex+s,d=n[c],f=n[c+l],g=n[c+u],x=_O(f,d,g,a.radius);if(x){const[m,v,O]=x,b=c+l+1,k=c+u,E=a.type==="fillet"?wa(OO(m,v,O),r):[m,v];n=[...n.slice(0,b),...E,...n.slice(k)],s+=E.length-(u-l-1)}}),n}const Xf=(i,t,e)=>[(1-i)*t[0]+i*e[0],(1-i)*t[1]+i*e[1]],im=(i,t,e,...n)=>n.length>0?[Xf(i,t,e),...im(i,e,...n)]:[Xf(i,t,e)],nm=(i,t)=>t.length>1?nm(i,im(i,...t)):t[0];function wa(i,t){if(Zs(i[0],i[1])&&Zs(i[2],i[3]))return[i[0],i[3]];const e=[];for(let n=0;n<=1*t;n+=1){const r=nm(n/t,i);e.push(r)}return e}function wO(i,t,e){typeof t=="number"&&(t=[t]);let n=0,r=[];for(const o of i){r.push([]);for(let s=1;si.push(o)),i}const Rf=(i,t)=>yu(i,t)<1e-6,yu=([i,t],[e,n])=>Math.sqrt((e-i)**2+(n-t)**2),SO=(i,t)=>Math.sqrt((t[0]-i[0])**2+(t[1]-i[1])**2),Yf=(i,t)=>{const e=SO(i,t);return[(t[0]-i[0])/e,(t[1]-i[1])/e]},CO=i=>{const t=Math.sqrt(i[0]**2+i[1]**2);return[i[0]/t,i[1]/t]},PO=(i,t,e,n)=>{const r=Math.sin(n*(1-i))/Math.sin(n),o=Math.sin(n*i)/Math.sin(n);return[t[0]*r+e[0]*o,t[1]*r+e[1]*o]};function rm(){const[i,...t]=arguments;return t.reduce((e,n)=>yo(e,n,"union"),i)}function kO(){const[i,...t]=arguments;return t.reduce((e,n)=>yo(e,n,"intersect"),i)}function LO(){const[i,...t]=arguments;return t.reduce((e,n)=>yo(e,n,"difference"),i)}function AO(){const[i,...t]=arguments;return t.reduce((e,n)=>yo(e,n,"xor"),i)}function EO(i){if(i.length===0)throw new Error("Shape must have at least one pt.");const t=i.at(-1);if(t.length<2)return 0;const e=t.at(-1),n=t.at(-2),r=e[0]-n[0],o=e[1]-n[1];return Math.atan2(o,r)*180/Math.PI}const DO=(i,[t,e])=>{i.length===0&&i.push([[0,0]]);const[n,r]=i.at(-1).at(-1);return i.at(-1).push([n+t,r+e]),i},TO=i=>{if(i.length===0)throw new Error("Shape must have at least one pt.");const[t,e]=i[0][0];return i.at(-1).push([t,e]),i},IO=i=>{const t=i.flat();if(t.length===1)return t[0];if(t.length===2)return{x:(t[0][0]+t[1][0])/2,y:(t[0][1]+t[1][1])/2};var e=t[0],n=t[t.length-1];(e[0]!=n[0]||e[1]!=n[1])&&t.push(e);for(var r=0,o=0,s=0,a=t.length,l,u,c,d=0,f=a-1;dJSON.parse(JSON.stringify(i)),sm=i=>{const{xMin:t,xMax:e}=Oo(i);return e-t},om=i=>{const{yMin:t,yMax:e}=Oo(i);return e-t},MO=i=>{const t=br(i,"cc");return er(i,[0,0],t)},$O=(i,t)=>(i.at(-1).push(t),i),QO=i=>i.map(t=>t.reverse()).reverse(),NO=i=>Sl(i,0,{endType:"etClosedPolygon"}),BO=(i,t)=>Sl(i,t,{endType:"etClosedPolygon"}),FO=(i,t)=>{const e=(s,a)=>1e-8>Math.abs(s[0]-a[0])+Math.abs(s[1]-a[1]),n=i[0][0],r=i.at(-1).at(-1),o=e(n,r)?"etClosedLine":"etOpenButt";return Sl(i,t/2,{endType:o,jointType:"jtMiter"})},XO=(i,t,e)=>{const n=kc(i);for(let r=0;r{let t="";return i.forEach(e=>{const[n,r]=e[0];t+=`M ${n},${r}`,e.slice(1).forEach(o=>{const[s,a]=o;t+=`L ${s},${a}`})}),t};function Cr(i,t){return iO(t,{maxError:.001}).map(n=>n.points).forEach(n=>i.push(n)),i}const RO=(i,t)=>{const e=[-i/2,t/2],n=[i/2,t/2],r=[i/2,-t/2],o=[-i/2,-t/2];return[[e,n,r,o,e]]},am=i=>{const e=[],n=(a,l)=>l*Math.cos(a),r=(a,l)=>l*Math.sin(a);for(let a=0;a<180;a++){const l=Math.PI*2/180*a,u=n(l,i),c=r(l,i);e.push([u,c])}const[o,s]=e[0];return e.push([o,s]),[e]},YO=i=>i.map(t=>t.map(([e,n])=>({x:e,y:n}))),ZO=Object.freeze(Object.defineProperty({__proto__:null,arc:lO,bezier:rO,boolean:yo,centroid:IO,circle:am,close:TO,convertPtType:YO,copy:kc,copyPaste:XO,difference:LO,expand:BO,extrema:Oo,fillet:wO,getAngle:EO,getPathData:An,getPoint:br,goTo:$O,height:om,intersect:kO,offset:Sl,offset2:j0,originate:MO,outline:NO,path:pO,path2:em,pathD:Cr,rectangle:RO,reverse:QO,rotate:Pc,scale:Pl,thicken:FO,transform:Z0,translate:er,turnForward:J0,union:rm,vec:DO,width:sm,xor:AO},Symbol.toStringTag,{value:"Module"})),WO=1.6,UO="User",zO=297,ur=210,jO="20221018",qO=0;function ri(i){return i*Mt.mm_per_unit}const cn=Object.freeze({RECTANGLE:"rect",CIRCLE:"circle"}),Ri=Object.freeze({PRIMITIVE:"PRIMITIVE",POLYGON:"POLYGON"});var po,mo,fl;class lm{constructor(t={}){ke(this,po,"SvgPcb");ke(this,mo,Ri.POLYGON);ke(this,fl,cn.RECTANGLE);t.libraryName&&(zt(this,po,t.libraryName),zt(this,mo,t.padShapeType))}get libraryName(){return Qt(this,po)}get padShapeType(){return Qt(this,mo)}get padPrimitiveShape(){return Qt(this,fl)}}po=new WeakMap,mo=new WeakMap,fl=new WeakMap;var di,is,dl,hm,pl,um,ns,Sa,go,Ou;class VO{constructor(t){ke(this,dl);ke(this,pl);ke(this,ns);ke(this,go);ke(this,di,"");ke(this,is,new lm);zt(this,di,""),zt(this,is,t)}plotWires(t,e){const n=[];t.forEach(r=>{r.type==="wire"&&n.push(r)}),n.forEach(r=>{const o=ri(r.thickness).toFixed(3),s=e,a=0;r.shape.forEach(u=>{for(let c=0;c{Object.keys(a.footprint).includes("via")?r.push(a):n.push(a)});const o=Object.values(n).map(a=>({id:a.id,reference:a.id,footprint:a.id,position:{x:ri(a._pos[0]).toFixed(3),y:(ri(-a._pos[1])+ur).toFixed(3)},rotation:a.rotation,layer:Object.values(a.footprint)[0].layers[0],pads:Object.entries(a.footprint).map(([u,c])=>({number:c.index,name:u,position:{x:ri(c.pos[0]).toFixed(3),y:ri(-c.pos[1]).toFixed(3)},shape:Ce(this,ns,Sa).call(this,c.shape),layers:c.layers,size:Ce(this,go,Ou).call(this,Ce(this,ns,Sa).call(this,c.shape))}))}));console.log(o),o.forEach(a=>{const l=a.id,u=a.footprint,c=a.position,d=a.rotation;zt(this,di,Qt(this,di)+`(footprint "${Qt(this,is).libraryName}:${u}" (layer "${a.layer}") `),zt(this,di,Qt(this,di)+`(tstamp ${l}) `),zt(this,di,Qt(this,di)+`(at ${c.x} ${c.y} ${d})`),zt(this,di,Qt(this,di)+`(attr smd) @@ -95,8 +95,8 @@ const Ro={Z:"Z",M:"M",L:"L",C:"C",Q:"Q",A:"A",H:"H",V:"V",S:"S",T:"T",z:"Z",m:"m `:t+=`INCH `,t},bl=new WeakSet,ym=function(){let t=`T0 `;return t+=`M30 -`,t},wl=new WeakSet,Om=function(){const t=Qt(this,vo);return vh(this,vo)._++,t};function JO(i){const t=i.pcb.layers,e=i.pcb;var n=new X0;let r;for(const o of i.downloadGerberOptions.layers.keys())if(o.toLowerCase().includes("interior")||o.toLowerCase().includes("edge")||o.toLowerCase().includes("cuts")||o.toLowerCase().includes("outline")||o.toLowerCase().includes("mechanical")||o.toLowerCase().includes("dimension")){r=o;break}i.downloadGerberOptions.layers.forEach((o,s)=>{if(!o)return;const a=s;if(a=="F.Cu"){const l=new Rn;l.setFileFunction("Copper,L1,Top"),l.setFilePolarity("Positive"),l.plotPads(t[a]),l.plotWires(t[a]),i.downloadGerberOptions.includeOutline&&l.plotOutline(t[r]),n.file(Cn(i,a),l.toString())}else if(a=="B.Cu"){const l=new Rn;l.setFileFunction("Copper,L2,Bot"),l.setFilePolarity("Positive"),l.plotPads(t[s]),l.plotWires(t[s]),i.downloadGerberOptions.includeOutline&&l.plotOutline(t[r]),n.file(Cn(i,a),l.toString())}else if(a=="F.Mask"){const l=new Rn;l.setFileFunction("Soldermask,Top"),l.setFilePolarity("Negative"),l.plotPads(t[a],.1),i.downloadGerberOptions.includeOutline&&l.plotOutline(t[r]),n.file(Cn(i,a),l.toString())}else if(a=="B.Mask"){const l=new Rn;l.setFileFunction("Soldermask,Bot"),l.setFilePolarity("Negative"),l.plotPads(t[a],.1),i.downloadGerberOptions.includeOutline&&l.plotOutline(t[r]),n.file(Cn(i,a),l.toString())}else if(a=="F.Silkscreen"){const l=new Rn;l.setFileFunction("Legend,Top"),l.setFilePolarity("Positive"),l.plotSilkscreen(t[a]),i.downloadGerberOptions.includeOutline&&l.plotOutline(t[r]),n.file(Cn(i,a),l.toString())}else if(a=="B.Silkscreen"){const l=new Rn;l.setFileFunction("Legend,Top"),l.setFilePolarity("Positive"),l.plotSilkscreen(t[a]),i.downloadGerberOptions.includeOutline&&l.plotOutline(t[r]),n.file(Cn(i,a),l.toString())}else if(a==r){const l=new Rn;l.setFileFunction("Profile,NP"),l.plotOutline(t[a]),n.file(Cn(i,a),l.toString())}if(i.downloadGerberOptions.drillFormat==jn.EXCELLON){const l=new HO(i);l.plotDrills(e),n.file(Cn(i,"Drills"),l.toString())}else if(i.downloadGerberOptions.drillFormat==jn.GERBER){const l=new Rn;l.setFileFunction("Plated,1,2,PTH,Drill"),l.setFilePolarity("Positive"),l.plotDrills(e),n.file(Cn(i,"Drills"),l.toString())}}),n.generateAsync({type:"blob"}).then(o=>{Y0.saveAs(o,`${i.name===""?"Untitled":i.name}-Gerbers.zip`)})}const Mt={version:"v0.2.0",codemirror:void 0,pcb:void 0,heldKeys:new Set,transforming:!1,transformUpdate:()=>{},fileHandle:null,needsSaving:!1,selectBox:{},footprints:{},shapes:[],astInfo:{},idToName:{},limits:{x:[0,1],y:[0,1]},mm_per_unit:25.4,background:"#00000000",grid:!0,gridSize:.05,adaptiveGrid:!1,snapToPad:!0,snapToPadRadius:.025,viewHandles:!0,panZoomParams:void 0,previewFootprint:null,vimMode:!1,preview:null,paths:[],cubicHandleManipulation:"symmetric",selectedPathIndex:-1,selectedPath:null,selectablePaths:[],pts:[],layers:[],inputs:[],componentMenu:!1,componentSearch:"",downloadGerberModal:!1,downloadKiCadModal:!1,name:"",error:"",downloadGerberOptions:{layers:new Map([]),includeOutline:!0,excellonMetric:!0,protelFilenames:!1,drillFormat:jn.EXCELLON},downloadKiCadOptions:{footprintLibraryName:"SvgPcb",padShapeType:Ri.POLYGON,padPrimitiveShape:cn.RECTANGLE},svgToModsOptions:{selectedMachine:void 0}};var _m={exports:{}};(function(i,t){(function(n,r){i.exports=r()})(pn,function(){return function(e){var n={};function r(o){if(n[o])return n[o].exports;var s=n[o]={exports:{},id:o,loaded:!1};return e[o].call(s.exports,s,s.exports,r),s.loaded=!0,s.exports}return r.m=e,r.c=n,r.p="",r(0)}([function(e,n,r){Object.defineProperty(n,"__esModule",{value:!0});var o=r(1),s=r(3),a=r(8),l=r(15);function u(x,m,v){var O=null,b=function(D,z){v&&v(D,z),O&&O.visit(D,z)},k=typeof v=="function"?b:null,E=!1;if(m){E=typeof m.comment=="boolean"&&m.comment;var $=typeof m.attachComment=="boolean"&&m.attachComment;(E||$)&&(O=new o.CommentHandler,O.attach=$,m.comment=!0,k=b)}var N=!1;m&&typeof m.sourceType=="string"&&(N=m.sourceType==="module");var X;m&&typeof m.jsx=="boolean"&&m.jsx?X=new s.JSXParser(x,m,k):X=new a.Parser(x,m,k);var R=N?X.parseModule():X.parseScript(),W=R;return E&&O&&(W.comments=O.comments),X.config.tokens&&(W.tokens=X.tokens),X.config.tolerant&&(W.errors=X.errorHandler.errors),W}n.parse=u;function c(x,m,v){var O=m||{};return O.sourceType="module",u(x,O,v)}n.parseModule=c;function d(x,m,v){var O=m||{};return O.sourceType="script",u(x,O,v)}n.parseScript=d;function f(x,m,v){var O=new l.Tokenizer(x,m),b;b=[];try{for(;;){var k=O.getNextToken();if(!k)break;v&&(k=v(k)),b.push(k)}}catch(E){O.errorHandler.tolerate(E)}return O.errorHandler.tolerant&&(b.errors=O.errors()),b}n.tokenize=f;var g=r(2);n.Syntax=g.Syntax,n.version="4.0.1"},function(e,n,r){Object.defineProperty(n,"__esModule",{value:!0});var o=r(2),s=function(){function a(){this.attach=!1,this.comments=[],this.stack=[],this.leading=[],this.trailing=[]}return a.prototype.insertInnerComments=function(l,u){if(l.type===o.Syntax.BlockStatement&&l.body.length===0){for(var c=[],d=this.leading.length-1;d>=0;--d){var f=this.leading[d];u.end.offset>=f.start&&(c.unshift(f.comment),this.leading.splice(d,1),this.trailing.splice(d,1))}c.length&&(l.innerComments=c)}},a.prototype.findTrailingComments=function(l){var u=[];if(this.trailing.length>0){for(var c=this.trailing.length-1;c>=0;--c){var d=this.trailing[c];d.start>=l.end.offset&&u.unshift(d.comment)}return this.trailing.length=0,u}var f=this.stack[this.stack.length-1];if(f&&f.node.trailingComments){var g=f.node.trailingComments[0];g&&g.range[0]>=l.end.offset&&(u=f.node.trailingComments,delete f.node.trailingComments)}return u},a.prototype.findLeadingComments=function(l){for(var u=[],c;this.stack.length>0;){var d=this.stack[this.stack.length-1];if(d&&d.start>=l.start.offset)c=d.node,this.stack.pop();else break}if(c){for(var f=c.leadingComments?c.leadingComments.length:0,g=f-1;g>=0;--g){var x=c.leadingComments[g];x.range[1]<=l.start.offset&&(u.unshift(x),c.leadingComments.splice(g,1))}return c.leadingComments&&c.leadingComments.length===0&&delete c.leadingComments,u}for(var g=this.leading.length-1;g>=0;--g){var d=this.leading[g];d.start<=l.start.offset&&(u.unshift(d.comment),this.leading.splice(g,1))}return u},a.prototype.visitNode=function(l,u){if(!(l.type===o.Syntax.Program&&l.body.length>0)){this.insertInnerComments(l,u);var c=this.findTrailingComments(u),d=this.findLeadingComments(u);d.length>0&&(l.leadingComments=d),c.length>0&&(l.trailingComments=c),this.stack.push({node:l,start:u.start.offset})}},a.prototype.visitComment=function(l,u){var c=l.type[0]==="L"?"Line":"Block",d={type:c,value:l.value};if(l.range&&(d.range=l.range),l.loc&&(d.loc=l.loc),this.comments.push(d),this.attach){var f={comment:{type:c,value:l.value,range:[u.start.offset,u.end.offset]},start:u.start.offset};l.loc&&(f.comment.loc=l.loc),l.type=c,this.leading.push(f),this.trailing.push(f)}},a.prototype.visit=function(l,u){l.type==="LineComment"?this.visitComment(l,u):l.type==="BlockComment"?this.visitComment(l,u):this.attach&&this.visitNode(l,u)},a}();n.CommentHandler=s},function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.Syntax={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForOfStatement:"ForOfStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"}},function(e,n,r){var o=this&&this.__extends||function(){var m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,O){v.__proto__=O}||function(v,O){for(var b in O)O.hasOwnProperty(b)&&(v[b]=O[b])};return function(v,O){m(v,O);function b(){this.constructor=v}v.prototype=O===null?Object.create(O):(b.prototype=O.prototype,new b)}}();Object.defineProperty(n,"__esModule",{value:!0});var s=r(4),a=r(5),l=r(6),u=r(7),c=r(8),d=r(13),f=r(14);d.TokenName[100]="JSXIdentifier",d.TokenName[101]="JSXText";function g(m){var v;switch(m.type){case l.JSXSyntax.JSXIdentifier:var O=m;v=O.name;break;case l.JSXSyntax.JSXNamespacedName:var b=m;v=g(b.namespace)+":"+g(b.name);break;case l.JSXSyntax.JSXMemberExpression:var k=m;v=g(k.object)+"."+g(k.property);break}return v}var x=function(m){o(v,m);function v(O,b,k){return m.call(this,O,b,k)||this}return v.prototype.parsePrimaryExpression=function(){return this.match("<")?this.parseJSXRoot():m.prototype.parsePrimaryExpression.call(this)},v.prototype.startJSX=function(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.line,this.scanner.lineStart=this.startMarker.index-this.startMarker.column},v.prototype.finishJSX=function(){this.nextToken()},v.prototype.reenterJSX=function(){this.startJSX(),this.expectJSX("}"),this.config.tokens&&this.tokens.pop()},v.prototype.createJSXNode=function(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},v.prototype.createJSXChildNode=function(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},v.prototype.scanXHTMLEntity=function(O){for(var b="&",k=!0,E=!1,$=!1,N=!1;!this.scanner.eof()&&k&&!E;){var X=this.scanner.source[this.scanner.index];if(X===O)break;if(E=X===";",b+=X,++this.scanner.index,!E)switch(b.length){case 2:$=X==="#";break;case 3:$&&(N=X==="x",k=N||s.Character.isDecimalDigit(X.charCodeAt(0)),$=$&&!N);break;default:k=k&&!($&&!s.Character.isDecimalDigit(X.charCodeAt(0))),k=k&&!(N&&!s.Character.isHexDigit(X.charCodeAt(0)));break}}if(k&&E&&b.length>2){var R=b.substr(1,b.length-2);$&&R.length>1?b=String.fromCharCode(parseInt(R.substr(1),10)):N&&R.length>2?b=String.fromCharCode(parseInt("0"+R.substr(1),16)):!$&&!N&&f.XHTMLEntities[R]&&(b=f.XHTMLEntities[R])}return b},v.prototype.lexJSX=function(){var O=this.scanner.source.charCodeAt(this.scanner.index);if(O===60||O===62||O===47||O===58||O===61||O===123||O===125){var b=this.scanner.source[this.scanner.index++];return{type:7,value:b,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index}}if(O===34||O===39){for(var k=this.scanner.index,E=this.scanner.source[this.scanner.index++],$="";!this.scanner.eof();){var N=this.scanner.source[this.scanner.index++];if(N===E)break;N==="&"?$+=this.scanXHTMLEntity(E):$+=N}return{type:8,value:$,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:k,end:this.scanner.index}}if(O===46){var X=this.scanner.source.charCodeAt(this.scanner.index+1),R=this.scanner.source.charCodeAt(this.scanner.index+2),b=X===46&&R===46?"...":".",k=this.scanner.index;return this.scanner.index+=b.length,{type:7,value:b,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:k,end:this.scanner.index}}if(O===96)return{type:10,value:"",lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index,end:this.scanner.index};if(s.Character.isIdentifierStart(O)&&O!==92){var k=this.scanner.index;for(++this.scanner.index;!this.scanner.eof();){var N=this.scanner.source.charCodeAt(this.scanner.index);if(s.Character.isIdentifierPart(N)&&N!==92)++this.scanner.index;else if(N===45)++this.scanner.index;else break}var W=this.scanner.source.slice(k,this.scanner.index);return{type:100,value:W,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:k,end:this.scanner.index}}return this.scanner.lex()},v.prototype.nextJSXToken=function(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;var O=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(O)),O},v.prototype.nextJSXText=function(){this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;for(var O=this.scanner.index,b="";!this.scanner.eof();){var k=this.scanner.source[this.scanner.index];if(k==="{"||k==="<")break;++this.scanner.index,b+=k,s.Character.isLineTerminator(k.charCodeAt(0))&&(++this.scanner.lineNumber,k==="\r"&&this.scanner.source[this.scanner.index]===` -`&&++this.scanner.index,this.scanner.lineStart=this.scanner.index)}this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart;var E={type:101,value:b,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:O,end:this.scanner.index};return b.length>0&&this.config.tokens&&this.tokens.push(this.convertToken(E)),E},v.prototype.peekJSXToken=function(){var O=this.scanner.saveState();this.scanner.scanComments();var b=this.lexJSX();return this.scanner.restoreState(O),b},v.prototype.expectJSX=function(O){var b=this.nextJSXToken();(b.type!==7||b.value!==O)&&this.throwUnexpectedToken(b)},v.prototype.matchJSX=function(O){var b=this.peekJSXToken();return b.type===7&&b.value===O},v.prototype.parseJSXIdentifier=function(){var O=this.createJSXNode(),b=this.nextJSXToken();return b.type!==100&&this.throwUnexpectedToken(b),this.finalize(O,new a.JSXIdentifier(b.value))},v.prototype.parseJSXElementName=function(){var O=this.createJSXNode(),b=this.parseJSXIdentifier();if(this.matchJSX(":")){var k=b;this.expectJSX(":");var E=this.parseJSXIdentifier();b=this.finalize(O,new a.JSXNamespacedName(k,E))}else if(this.matchJSX("."))for(;this.matchJSX(".");){var $=b;this.expectJSX(".");var N=this.parseJSXIdentifier();b=this.finalize(O,new a.JSXMemberExpression($,N))}return b},v.prototype.parseJSXAttributeName=function(){var O=this.createJSXNode(),b,k=this.parseJSXIdentifier();if(this.matchJSX(":")){var E=k;this.expectJSX(":");var $=this.parseJSXIdentifier();b=this.finalize(O,new a.JSXNamespacedName(E,$))}else b=k;return b},v.prototype.parseJSXStringLiteralAttribute=function(){var O=this.createJSXNode(),b=this.nextJSXToken();b.type!==8&&this.throwUnexpectedToken(b);var k=this.getTokenRaw(b);return this.finalize(O,new u.Literal(b.value,k))},v.prototype.parseJSXExpressionAttribute=function(){var O=this.createJSXNode();this.expectJSX("{"),this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression");var b=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(O,new a.JSXExpressionContainer(b))},v.prototype.parseJSXAttributeValue=function(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()},v.prototype.parseJSXNameValueAttribute=function(){var O=this.createJSXNode(),b=this.parseJSXAttributeName(),k=null;return this.matchJSX("=")&&(this.expectJSX("="),k=this.parseJSXAttributeValue()),this.finalize(O,new a.JSXAttribute(b,k))},v.prototype.parseJSXSpreadAttribute=function(){var O=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();var b=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(O,new a.JSXSpreadAttribute(b))},v.prototype.parseJSXAttributes=function(){for(var O=[];!this.matchJSX("/")&&!this.matchJSX(">");){var b=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute();O.push(b)}return O},v.prototype.parseJSXOpeningElement=function(){var O=this.createJSXNode();this.expectJSX("<");var b=this.parseJSXElementName(),k=this.parseJSXAttributes(),E=this.matchJSX("/");return E&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(O,new a.JSXOpeningElement(b,E,k))},v.prototype.parseJSXBoundaryElement=function(){var O=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){this.expectJSX("/");var b=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(O,new a.JSXClosingElement(b))}var k=this.parseJSXElementName(),E=this.parseJSXAttributes(),$=this.matchJSX("/");return $&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(O,new a.JSXOpeningElement(k,$,E))},v.prototype.parseJSXEmptyExpression=function(){var O=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.finalize(O,new a.JSXEmptyExpression)},v.prototype.parseJSXExpressionContainer=function(){var O=this.createJSXNode();this.expectJSX("{");var b;return this.matchJSX("}")?(b=this.parseJSXEmptyExpression(),this.expectJSX("}")):(this.finishJSX(),b=this.parseAssignmentExpression(),this.reenterJSX()),this.finalize(O,new a.JSXExpressionContainer(b))},v.prototype.parseJSXChildren=function(){for(var O=[];!this.scanner.eof();){var b=this.createJSXChildNode(),k=this.nextJSXText();if(k.start0){var N=this.finalize(O.node,new a.JSXElement(O.opening,O.children,O.closing));O=b[b.length-1],O.children.push(N),b.pop()}else break}}return O},v.prototype.parseJSXElement=function(){var O=this.createJSXNode(),b=this.parseJSXOpeningElement(),k=[],E=null;if(!b.selfClosing){var $=this.parseComplexJSXElement({node:O,opening:b,closing:E,children:k});k=$.children,E=$.closing}return this.finalize(O,new a.JSXElement(b,k,E))},v.prototype.parseJSXRoot=function(){this.config.tokens&&this.tokens.pop(),this.startJSX();var O=this.parseJSXElement();return this.finishJSX(),O},v.prototype.isStartOfExpression=function(){return m.prototype.isStartOfExpression.call(this)||this.match("<")},v}(c.Parser);n.JSXParser=x},function(e,n){Object.defineProperty(n,"__esModule",{value:!0});var r={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/};n.Character={fromCodePoint:function(o){return o<65536?String.fromCharCode(o):String.fromCharCode(55296+(o-65536>>10))+String.fromCharCode(56320+(o-65536&1023))},isWhiteSpace:function(o){return o===32||o===9||o===11||o===12||o===160||o>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(o)>=0},isLineTerminator:function(o){return o===10||o===13||o===8232||o===8233},isIdentifierStart:function(o){return o===36||o===95||o>=65&&o<=90||o>=97&&o<=122||o===92||o>=128&&r.NonAsciiIdentifierStart.test(n.Character.fromCodePoint(o))},isIdentifierPart:function(o){return o===36||o===95||o>=65&&o<=90||o>=97&&o<=122||o>=48&&o<=57||o===92||o>=128&&r.NonAsciiIdentifierPart.test(n.Character.fromCodePoint(o))},isDecimalDigit:function(o){return o>=48&&o<=57},isHexDigit:function(o){return o>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102},isOctalDigit:function(o){return o>=48&&o<=55}}},function(e,n,r){Object.defineProperty(n,"__esModule",{value:!0});var o=r(6),s=function(){function O(b){this.type=o.JSXSyntax.JSXClosingElement,this.name=b}return O}();n.JSXClosingElement=s;var a=function(){function O(b,k,E){this.type=o.JSXSyntax.JSXElement,this.openingElement=b,this.children=k,this.closingElement=E}return O}();n.JSXElement=a;var l=function(){function O(){this.type=o.JSXSyntax.JSXEmptyExpression}return O}();n.JSXEmptyExpression=l;var u=function(){function O(b){this.type=o.JSXSyntax.JSXExpressionContainer,this.expression=b}return O}();n.JSXExpressionContainer=u;var c=function(){function O(b){this.type=o.JSXSyntax.JSXIdentifier,this.name=b}return O}();n.JSXIdentifier=c;var d=function(){function O(b,k){this.type=o.JSXSyntax.JSXMemberExpression,this.object=b,this.property=k}return O}();n.JSXMemberExpression=d;var f=function(){function O(b,k){this.type=o.JSXSyntax.JSXAttribute,this.name=b,this.value=k}return O}();n.JSXAttribute=f;var g=function(){function O(b,k){this.type=o.JSXSyntax.JSXNamespacedName,this.namespace=b,this.name=k}return O}();n.JSXNamespacedName=g;var x=function(){function O(b,k,E){this.type=o.JSXSyntax.JSXOpeningElement,this.name=b,this.selfClosing=k,this.attributes=E}return O}();n.JSXOpeningElement=x;var m=function(){function O(b){this.type=o.JSXSyntax.JSXSpreadAttribute,this.argument=b}return O}();n.JSXSpreadAttribute=m;var v=function(){function O(b,k){this.type=o.JSXSyntax.JSXText,this.value=b,this.raw=k}return O}();n.JSXText=v},function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.JSXSyntax={JSXAttribute:"JSXAttribute",JSXClosingElement:"JSXClosingElement",JSXElement:"JSXElement",JSXEmptyExpression:"JSXEmptyExpression",JSXExpressionContainer:"JSXExpressionContainer",JSXIdentifier:"JSXIdentifier",JSXMemberExpression:"JSXMemberExpression",JSXNamespacedName:"JSXNamespacedName",JSXOpeningElement:"JSXOpeningElement",JSXSpreadAttribute:"JSXSpreadAttribute",JSXText:"JSXText"}},function(e,n,r){Object.defineProperty(n,"__esModule",{value:!0});var o=r(2),s=function(){function st(dt){this.type=o.Syntax.ArrayExpression,this.elements=dt}return st}();n.ArrayExpression=s;var a=function(){function st(dt){this.type=o.Syntax.ArrayPattern,this.elements=dt}return st}();n.ArrayPattern=a;var l=function(){function st(dt,Lt,ne){this.type=o.Syntax.ArrowFunctionExpression,this.id=null,this.params=dt,this.body=Lt,this.generator=!1,this.expression=ne,this.async=!1}return st}();n.ArrowFunctionExpression=l;var u=function(){function st(dt,Lt,ne){this.type=o.Syntax.AssignmentExpression,this.operator=dt,this.left=Lt,this.right=ne}return st}();n.AssignmentExpression=u;var c=function(){function st(dt,Lt){this.type=o.Syntax.AssignmentPattern,this.left=dt,this.right=Lt}return st}();n.AssignmentPattern=c;var d=function(){function st(dt,Lt,ne){this.type=o.Syntax.ArrowFunctionExpression,this.id=null,this.params=dt,this.body=Lt,this.generator=!1,this.expression=ne,this.async=!0}return st}();n.AsyncArrowFunctionExpression=d;var f=function(){function st(dt,Lt,ne){this.type=o.Syntax.FunctionDeclaration,this.id=dt,this.params=Lt,this.body=ne,this.generator=!1,this.expression=!1,this.async=!0}return st}();n.AsyncFunctionDeclaration=f;var g=function(){function st(dt,Lt,ne){this.type=o.Syntax.FunctionExpression,this.id=dt,this.params=Lt,this.body=ne,this.generator=!1,this.expression=!1,this.async=!0}return st}();n.AsyncFunctionExpression=g;var x=function(){function st(dt){this.type=o.Syntax.AwaitExpression,this.argument=dt}return st}();n.AwaitExpression=x;var m=function(){function st(dt,Lt,ne){var ei=dt==="||"||dt==="&&";this.type=ei?o.Syntax.LogicalExpression:o.Syntax.BinaryExpression,this.operator=dt,this.left=Lt,this.right=ne}return st}();n.BinaryExpression=m;var v=function(){function st(dt){this.type=o.Syntax.BlockStatement,this.body=dt}return st}();n.BlockStatement=v;var O=function(){function st(dt){this.type=o.Syntax.BreakStatement,this.label=dt}return st}();n.BreakStatement=O;var b=function(){function st(dt,Lt){this.type=o.Syntax.CallExpression,this.callee=dt,this.arguments=Lt}return st}();n.CallExpression=b;var k=function(){function st(dt,Lt){this.type=o.Syntax.CatchClause,this.param=dt,this.body=Lt}return st}();n.CatchClause=k;var E=function(){function st(dt){this.type=o.Syntax.ClassBody,this.body=dt}return st}();n.ClassBody=E;var $=function(){function st(dt,Lt,ne){this.type=o.Syntax.ClassDeclaration,this.id=dt,this.superClass=Lt,this.body=ne}return st}();n.ClassDeclaration=$;var N=function(){function st(dt,Lt,ne){this.type=o.Syntax.ClassExpression,this.id=dt,this.superClass=Lt,this.body=ne}return st}();n.ClassExpression=N;var X=function(){function st(dt,Lt){this.type=o.Syntax.MemberExpression,this.computed=!0,this.object=dt,this.property=Lt}return st}();n.ComputedMemberExpression=X;var R=function(){function st(dt,Lt,ne){this.type=o.Syntax.ConditionalExpression,this.test=dt,this.consequent=Lt,this.alternate=ne}return st}();n.ConditionalExpression=R;var W=function(){function st(dt){this.type=o.Syntax.ContinueStatement,this.label=dt}return st}();n.ContinueStatement=W;var D=function(){function st(){this.type=o.Syntax.DebuggerStatement}return st}();n.DebuggerStatement=D;var z=function(){function st(dt,Lt){this.type=o.Syntax.ExpressionStatement,this.expression=dt,this.directive=Lt}return st}();n.Directive=z;var Q=function(){function st(dt,Lt){this.type=o.Syntax.DoWhileStatement,this.body=dt,this.test=Lt}return st}();n.DoWhileStatement=Q;var U=function(){function st(){this.type=o.Syntax.EmptyStatement}return st}();n.EmptyStatement=U;var T=function(){function st(dt){this.type=o.Syntax.ExportAllDeclaration,this.source=dt}return st}();n.ExportAllDeclaration=T;var H=function(){function st(dt){this.type=o.Syntax.ExportDefaultDeclaration,this.declaration=dt}return st}();n.ExportDefaultDeclaration=H;var gt=function(){function st(dt,Lt,ne){this.type=o.Syntax.ExportNamedDeclaration,this.declaration=dt,this.specifiers=Lt,this.source=ne}return st}();n.ExportNamedDeclaration=gt;var at=function(){function st(dt,Lt){this.type=o.Syntax.ExportSpecifier,this.exported=Lt,this.local=dt}return st}();n.ExportSpecifier=at;var Et=function(){function st(dt){this.type=o.Syntax.ExpressionStatement,this.expression=dt}return st}();n.ExpressionStatement=Et;var pt=function(){function st(dt,Lt,ne){this.type=o.Syntax.ForInStatement,this.left=dt,this.right=Lt,this.body=ne,this.each=!1}return st}();n.ForInStatement=pt;var Pt=function(){function st(dt,Lt,ne){this.type=o.Syntax.ForOfStatement,this.left=dt,this.right=Lt,this.body=ne}return st}();n.ForOfStatement=Pt;var nt=function(){function st(dt,Lt,ne,ei){this.type=o.Syntax.ForStatement,this.init=dt,this.test=Lt,this.update=ne,this.body=ei}return st}();n.ForStatement=nt;var it=function(){function st(dt,Lt,ne,ei){this.type=o.Syntax.FunctionDeclaration,this.id=dt,this.params=Lt,this.body=ne,this.generator=ei,this.expression=!1,this.async=!1}return st}();n.FunctionDeclaration=it;var It=function(){function st(dt,Lt,ne,ei){this.type=o.Syntax.FunctionExpression,this.id=dt,this.params=Lt,this.body=ne,this.generator=ei,this.expression=!1,this.async=!1}return st}();n.FunctionExpression=It;var kt=function(){function st(dt){this.type=o.Syntax.Identifier,this.name=dt}return st}();n.Identifier=kt;var xt=function(){function st(dt,Lt,ne){this.type=o.Syntax.IfStatement,this.test=dt,this.consequent=Lt,this.alternate=ne}return st}();n.IfStatement=xt;var Kt=function(){function st(dt,Lt){this.type=o.Syntax.ImportDeclaration,this.specifiers=dt,this.source=Lt}return st}();n.ImportDeclaration=Kt;var Ct=function(){function st(dt){this.type=o.Syntax.ImportDefaultSpecifier,this.local=dt}return st}();n.ImportDefaultSpecifier=Ct;var Wt=function(){function st(dt){this.type=o.Syntax.ImportNamespaceSpecifier,this.local=dt}return st}();n.ImportNamespaceSpecifier=Wt;var Yt=function(){function st(dt,Lt){this.type=o.Syntax.ImportSpecifier,this.local=dt,this.imported=Lt}return st}();n.ImportSpecifier=Yt;var te=function(){function st(dt,Lt){this.type=o.Syntax.LabeledStatement,this.label=dt,this.body=Lt}return st}();n.LabeledStatement=te;var Jt=function(){function st(dt,Lt){this.type=o.Syntax.Literal,this.value=dt,this.raw=Lt}return st}();n.Literal=Jt;var xe=function(){function st(dt,Lt){this.type=o.Syntax.MetaProperty,this.meta=dt,this.property=Lt}return st}();n.MetaProperty=xe;var oe=function(){function st(dt,Lt,ne,ei,$n){this.type=o.Syntax.MethodDefinition,this.key=dt,this.computed=Lt,this.value=ne,this.kind=ei,this.static=$n}return st}();n.MethodDefinition=oe;var B=function(){function st(dt){this.type=o.Syntax.Program,this.body=dt,this.sourceType="module"}return st}();n.Module=B;var ut=function(){function st(dt,Lt){this.type=o.Syntax.NewExpression,this.callee=dt,this.arguments=Lt}return st}();n.NewExpression=ut;var ft=function(){function st(dt){this.type=o.Syntax.ObjectExpression,this.properties=dt}return st}();n.ObjectExpression=ft;var G=function(){function st(dt){this.type=o.Syntax.ObjectPattern,this.properties=dt}return st}();n.ObjectPattern=G;var V=function(){function st(dt,Lt,ne,ei,$n,_s){this.type=o.Syntax.Property,this.key=Lt,this.computed=ne,this.value=ei,this.kind=dt,this.method=$n,this.shorthand=_s}return st}();n.Property=V;var rt=function(){function st(dt,Lt,ne,ei){this.type=o.Syntax.Literal,this.value=dt,this.raw=Lt,this.regex={pattern:ne,flags:ei}}return st}();n.RegexLiteral=rt;var bt=function(){function st(dt){this.type=o.Syntax.RestElement,this.argument=dt}return st}();n.RestElement=bt;var wt=function(){function st(dt){this.type=o.Syntax.ReturnStatement,this.argument=dt}return st}();n.ReturnStatement=wt;var ot=function(){function st(dt){this.type=o.Syntax.Program,this.body=dt,this.sourceType="script"}return st}();n.Script=ot;var Dt=function(){function st(dt){this.type=o.Syntax.SequenceExpression,this.expressions=dt}return st}();n.SequenceExpression=Dt;var Xt=function(){function st(dt){this.type=o.Syntax.SpreadElement,this.argument=dt}return st}();n.SpreadElement=Xt;var Tt=function(){function st(dt,Lt){this.type=o.Syntax.MemberExpression,this.computed=!1,this.object=dt,this.property=Lt}return st}();n.StaticMemberExpression=Tt;var qt=function(){function st(){this.type=o.Syntax.Super}return st}();n.Super=qt;var fe=function(){function st(dt,Lt){this.type=o.Syntax.SwitchCase,this.test=dt,this.consequent=Lt}return st}();n.SwitchCase=fe;var ae=function(){function st(dt,Lt){this.type=o.Syntax.SwitchStatement,this.discriminant=dt,this.cases=Lt}return st}();n.SwitchStatement=ae;var be=function(){function st(dt,Lt){this.type=o.Syntax.TaggedTemplateExpression,this.tag=dt,this.quasi=Lt}return st}();n.TaggedTemplateExpression=be;var wi=function(){function st(dt,Lt){this.type=o.Syntax.TemplateElement,this.value=dt,this.tail=Lt}return st}();n.TemplateElement=wi;var pe=function(){function st(dt,Lt){this.type=o.Syntax.TemplateLiteral,this.quasis=dt,this.expressions=Lt}return st}();n.TemplateLiteral=pe;var Vi=function(){function st(){this.type=o.Syntax.ThisExpression}return st}();n.ThisExpression=Vi;var Ae=function(){function st(dt){this.type=o.Syntax.ThrowStatement,this.argument=dt}return st}();n.ThrowStatement=Ae;var sn=function(){function st(dt,Lt,ne){this.type=o.Syntax.TryStatement,this.block=dt,this.handler=Lt,this.finalizer=ne}return st}();n.TryStatement=sn;var on=function(){function st(dt,Lt){this.type=o.Syntax.UnaryExpression,this.operator=dt,this.argument=Lt,this.prefix=!0}return st}();n.UnaryExpression=on;var le=function(){function st(dt,Lt,ne){this.type=o.Syntax.UpdateExpression,this.operator=dt,this.argument=Lt,this.prefix=ne}return st}();n.UpdateExpression=le;var Ze=function(){function st(dt,Lt){this.type=o.Syntax.VariableDeclaration,this.declarations=dt,this.kind=Lt}return st}();n.VariableDeclaration=Ze;var Le=function(){function st(dt,Lt){this.type=o.Syntax.VariableDeclarator,this.id=dt,this.init=Lt}return st}();n.VariableDeclarator=Le;var We=function(){function st(dt,Lt){this.type=o.Syntax.WhileStatement,this.test=dt,this.body=Lt}return st}();n.WhileStatement=We;var ui=function(){function st(dt,Lt){this.type=o.Syntax.WithStatement,this.object=dt,this.body=Lt}return st}();n.WithStatement=ui;var wn=function(){function st(dt,Lt){this.type=o.Syntax.YieldExpression,this.argument=dt,this.delegate=Lt}return st}();n.YieldExpression=wn},function(e,n,r){Object.defineProperty(n,"__esModule",{value:!0});var o=r(9),s=r(10),a=r(11),l=r(7),u=r(12),c=r(2),d=r(13),f="ArrowParameterPlaceHolder",g=function(){function x(m,v,O){v===void 0&&(v={}),this.config={range:typeof v.range=="boolean"&&v.range,loc:typeof v.loc=="boolean"&&v.loc,source:null,tokens:typeof v.tokens=="boolean"&&v.tokens,comment:typeof v.comment=="boolean"&&v.comment,tolerant:typeof v.tolerant=="boolean"&&v.tolerant},this.config.loc&&v.source&&v.source!==null&&(this.config.source=String(v.source)),this.delegate=O,this.errorHandler=new s.ErrorHandler,this.errorHandler.tolerant=this.config.tolerant,this.scanner=new u.Scanner(m,this.errorHandler),this.scanner.trackComment=this.config.comment,this.operatorPrecedence={")":0,";":0,",":0,"=":0,"]":0,"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":11,"/":11,"%":11},this.lookahead={type:2,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0},this.hasLineTerminator=!1,this.context={isModule:!1,await:!1,allowIn:!0,allowStrictDirective:!0,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,labelSet:{},strict:!1},this.tokens=[],this.startMarker={index:0,line:this.scanner.lineNumber,column:0},this.lastMarker={index:0,line:this.scanner.lineNumber,column:0},this.nextToken(),this.lastMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}return x.prototype.throwError=function(m){var v=Array.prototype.slice.call(arguments,1),O=m.replace(/%(\d)/g,function($,N){return o.assert(N0&&this.delegate)for(var v=0;v>="||m===">>>="||m==="&="||m==="^="||m==="|="},x.prototype.isolateCoverGrammar=function(m){var v=this.context.isBindingElement,O=this.context.isAssignmentTarget,b=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var k=m.call(this);return this.context.firstCoverInitializedNameError!==null&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=v,this.context.isAssignmentTarget=O,this.context.firstCoverInitializedNameError=b,k},x.prototype.inheritCoverGrammar=function(m){var v=this.context.isBindingElement,O=this.context.isAssignmentTarget,b=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var k=m.call(this);return this.context.isBindingElement=this.context.isBindingElement&&v,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&O,this.context.firstCoverInitializedNameError=b||this.context.firstCoverInitializedNameError,k},x.prototype.consumeSemicolon=function(){this.match(";")?this.nextToken():this.hasLineTerminator||(this.lookahead.type!==2&&!this.match("}")&&this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.line=this.startMarker.line,this.lastMarker.column=this.startMarker.column)},x.prototype.parsePrimaryExpression=function(){var m=this.createNode(),v,O,b;switch(this.lookahead.type){case 3:(this.context.isModule||this.context.await)&&this.lookahead.value==="await"&&this.tolerateUnexpectedToken(this.lookahead),v=this.matchAsyncFunction()?this.parseFunctionExpression():this.finalize(m,new l.Identifier(this.nextToken().value));break;case 6:case 8:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,a.Messages.StrictOctalLiteral),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,O=this.nextToken(),b=this.getTokenRaw(O),v=this.finalize(m,new l.Literal(O.value,b));break;case 1:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,O=this.nextToken(),b=this.getTokenRaw(O),v=this.finalize(m,new l.Literal(O.value==="true",b));break;case 5:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,O=this.nextToken(),b=this.getTokenRaw(O),v=this.finalize(m,new l.Literal(null,b));break;case 10:v=this.parseTemplateLiteral();break;case 7:switch(this.lookahead.value){case"(":this.context.isBindingElement=!1,v=this.inheritCoverGrammar(this.parseGroupExpression);break;case"[":v=this.inheritCoverGrammar(this.parseArrayInitializer);break;case"{":v=this.inheritCoverGrammar(this.parseObjectInitializer);break;case"/":case"/=":this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,O=this.nextRegexToken(),b=this.getTokenRaw(O),v=this.finalize(m,new l.RegexLiteral(O.regex,b,O.pattern,O.flags));break;default:v=this.throwUnexpectedToken(this.nextToken())}break;case 4:!this.context.strict&&this.context.allowYield&&this.matchKeyword("yield")?v=this.parseIdentifierName():!this.context.strict&&this.matchKeyword("let")?v=this.finalize(m,new l.Identifier(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword("function")?v=this.parseFunctionExpression():this.matchKeyword("this")?(this.nextToken(),v=this.finalize(m,new l.ThisExpression)):this.matchKeyword("class")?v=this.parseClassExpression():v=this.throwUnexpectedToken(this.nextToken()));break;default:v=this.throwUnexpectedToken(this.nextToken())}return v},x.prototype.parseSpreadElement=function(){var m=this.createNode();this.expect("...");var v=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(m,new l.SpreadElement(v))},x.prototype.parseArrayInitializer=function(){var m=this.createNode(),v=[];for(this.expect("[");!this.match("]");)if(this.match(","))this.nextToken(),v.push(null);else if(this.match("...")){var O=this.parseSpreadElement();this.match("]")||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(",")),v.push(O)}else v.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match("]")||this.expect(",");return this.expect("]"),this.finalize(m,new l.ArrayExpression(v))},x.prototype.parsePropertyMethod=function(m){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var v=this.context.strict,O=this.context.allowStrictDirective;this.context.allowStrictDirective=m.simple;var b=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&m.firstRestricted&&this.tolerateUnexpectedToken(m.firstRestricted,m.message),this.context.strict&&m.stricted&&this.tolerateUnexpectedToken(m.stricted,m.message),this.context.strict=v,this.context.allowStrictDirective=O,b},x.prototype.parsePropertyMethodFunction=function(){var m=!1,v=this.createNode(),O=this.context.allowYield;this.context.allowYield=!0;var b=this.parseFormalParameters(),k=this.parsePropertyMethod(b);return this.context.allowYield=O,this.finalize(v,new l.FunctionExpression(null,b.params,k,m))},x.prototype.parsePropertyMethodAsyncFunction=function(){var m=this.createNode(),v=this.context.allowYield,O=this.context.await;this.context.allowYield=!1,this.context.await=!0;var b=this.parseFormalParameters(),k=this.parsePropertyMethod(b);return this.context.allowYield=v,this.context.await=O,this.finalize(m,new l.AsyncFunctionExpression(null,b.params,k))},x.prototype.parseObjectPropertyKey=function(){var m=this.createNode(),v=this.nextToken(),O;switch(v.type){case 8:case 6:this.context.strict&&v.octal&&this.tolerateUnexpectedToken(v,a.Messages.StrictOctalLiteral);var b=this.getTokenRaw(v);O=this.finalize(m,new l.Literal(v.value,b));break;case 3:case 1:case 5:case 4:O=this.finalize(m,new l.Identifier(v.value));break;case 7:v.value==="["?(O=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect("]")):O=this.throwUnexpectedToken(v);break;default:O=this.throwUnexpectedToken(v)}return O},x.prototype.isPropertyKey=function(m,v){return m.type===c.Syntax.Identifier&&m.name===v||m.type===c.Syntax.Literal&&m.value===v},x.prototype.parseObjectProperty=function(m){var v=this.createNode(),O=this.lookahead,b,k=null,E=null,$=!1,N=!1,X=!1,R=!1;if(O.type===3){var W=O.value;this.nextToken(),$=this.match("["),R=!this.hasLineTerminator&&W==="async"&&!this.match(":")&&!this.match("(")&&!this.match("*")&&!this.match(","),k=R?this.parseObjectPropertyKey():this.finalize(v,new l.Identifier(W))}else this.match("*")?this.nextToken():($=this.match("["),k=this.parseObjectPropertyKey());var D=this.qualifiedPropertyName(this.lookahead);if(O.type===3&&!R&&O.value==="get"&&D)b="get",$=this.match("["),k=this.parseObjectPropertyKey(),this.context.allowYield=!1,E=this.parseGetterMethod();else if(O.type===3&&!R&&O.value==="set"&&D)b="set",$=this.match("["),k=this.parseObjectPropertyKey(),E=this.parseSetterMethod();else if(O.type===7&&O.value==="*"&&D)b="init",$=this.match("["),k=this.parseObjectPropertyKey(),E=this.parseGeneratorMethod(),N=!0;else if(k||this.throwUnexpectedToken(this.lookahead),b="init",this.match(":")&&!R)!$&&this.isPropertyKey(k,"__proto__")&&(m.value&&this.tolerateError(a.Messages.DuplicateProtoProperty),m.value=!0),this.nextToken(),E=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match("("))E=R?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),N=!0;else if(O.type===3){var W=this.finalize(v,new l.Identifier(O.value));if(this.match("=")){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),X=!0;var z=this.isolateCoverGrammar(this.parseAssignmentExpression);E=this.finalize(v,new l.AssignmentPattern(W,z))}else X=!0,E=W}else this.throwUnexpectedToken(this.nextToken());return this.finalize(v,new l.Property(b,k,$,E,N,X))},x.prototype.parseObjectInitializer=function(){var m=this.createNode();this.expect("{");for(var v=[],O={value:!1};!this.match("}");)v.push(this.parseObjectProperty(O)),this.match("}")||this.expectCommaSeparator();return this.expect("}"),this.finalize(m,new l.ObjectExpression(v))},x.prototype.parseTemplateHead=function(){o.assert(this.lookahead.head,"Template literal must start with a template head");var m=this.createNode(),v=this.nextToken(),O=v.value,b=v.cooked;return this.finalize(m,new l.TemplateElement({raw:O,cooked:b},v.tail))},x.prototype.parseTemplateElement=function(){this.lookahead.type!==10&&this.throwUnexpectedToken();var m=this.createNode(),v=this.nextToken(),O=v.value,b=v.cooked;return this.finalize(m,new l.TemplateElement({raw:O,cooked:b},v.tail))},x.prototype.parseTemplateLiteral=function(){var m=this.createNode(),v=[],O=[],b=this.parseTemplateHead();for(O.push(b);!b.tail;)v.push(this.parseExpression()),b=this.parseTemplateElement(),O.push(b);return this.finalize(m,new l.TemplateLiteral(O,v))},x.prototype.reinterpretExpressionAsPattern=function(m){switch(m.type){case c.Syntax.Identifier:case c.Syntax.MemberExpression:case c.Syntax.RestElement:case c.Syntax.AssignmentPattern:break;case c.Syntax.SpreadElement:m.type=c.Syntax.RestElement,this.reinterpretExpressionAsPattern(m.argument);break;case c.Syntax.ArrayExpression:m.type=c.Syntax.ArrayPattern;for(var v=0;v")||this.expect("=>"),m={type:f,params:[],async:!1};else{var v=this.lookahead,O=[];if(this.match("..."))m=this.parseRestElement(O),this.expect(")"),this.match("=>")||this.expect("=>"),m={type:f,params:[m],async:!1};else{var b=!1;if(this.context.isBindingElement=!0,m=this.inheritCoverGrammar(this.parseAssignmentExpression),this.match(",")){var k=[];for(this.context.isAssignmentTarget=!1,k.push(m);this.lookahead.type!==2&&this.match(",");){if(this.nextToken(),this.match(")")){this.nextToken();for(var E=0;E")||this.expect("=>"),this.context.isBindingElement=!1;for(var E=0;E")&&(m.type===c.Syntax.Identifier&&m.name==="yield"&&(b=!0,m={type:f,params:[m],async:!1}),!b)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),m.type===c.Syntax.SequenceExpression)for(var E=0;E")){for(var N=0;N<$.length;++N)this.reinterpretExpressionAsPattern($[N]);b={type:f,params:$,async:!0}}}else if(this.match("[")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!0,this.expect("[");var k=this.isolateCoverGrammar(this.parseExpression);this.expect("]"),b=this.finalize(this.startNode(m),new l.ComputedMemberExpression(b,k))}else if(this.lookahead.type===10&&this.lookahead.head){var X=this.parseTemplateLiteral();b=this.finalize(this.startNode(m),new l.TaggedTemplateExpression(b,X))}else break;return this.context.allowIn=O,b},x.prototype.parseSuper=function(){var m=this.createNode();return this.expectKeyword("super"),!this.match("[")&&!this.match(".")&&this.throwUnexpectedToken(this.lookahead),this.finalize(m,new l.Super)},x.prototype.parseLeftHandSideExpression=function(){o.assert(this.context.allowIn,"callee of new expression always allow in keyword.");for(var m=this.startNode(this.lookahead),v=this.matchKeyword("super")&&this.context.inFunctionBody?this.parseSuper():this.inheritCoverGrammar(this.matchKeyword("new")?this.parseNewExpression:this.parsePrimaryExpression);;)if(this.match("[")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!0,this.expect("[");var O=this.isolateCoverGrammar(this.parseExpression);this.expect("]"),v=this.finalize(m,new l.ComputedMemberExpression(v,O))}else if(this.match(".")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!0,this.expect(".");var O=this.parseIdentifierName();v=this.finalize(m,new l.StaticMemberExpression(v,O))}else if(this.lookahead.type===10&&this.lookahead.head){var b=this.parseTemplateLiteral();v=this.finalize(m,new l.TaggedTemplateExpression(v,b))}else break;return v},x.prototype.parseUpdateExpression=function(){var m,v=this.lookahead;if(this.match("++")||this.match("--")){var O=this.startNode(v),b=this.nextToken();m=this.inheritCoverGrammar(this.parseUnaryExpression),this.context.strict&&m.type===c.Syntax.Identifier&&this.scanner.isRestrictedWord(m.name)&&this.tolerateError(a.Messages.StrictLHSPrefix),this.context.isAssignmentTarget||this.tolerateError(a.Messages.InvalidLHSInAssignment);var k=!0;m=this.finalize(O,new l.UpdateExpression(b.value,m,k)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}else if(m=this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall),!this.hasLineTerminator&&this.lookahead.type===7&&(this.match("++")||this.match("--"))){this.context.strict&&m.type===c.Syntax.Identifier&&this.scanner.isRestrictedWord(m.name)&&this.tolerateError(a.Messages.StrictLHSPostfix),this.context.isAssignmentTarget||this.tolerateError(a.Messages.InvalidLHSInAssignment),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var E=this.nextToken().value,k=!1;m=this.finalize(this.startNode(v),new l.UpdateExpression(E,m,k))}return m},x.prototype.parseAwaitExpression=function(){var m=this.createNode();this.nextToken();var v=this.parseUnaryExpression();return this.finalize(m,new l.AwaitExpression(v))},x.prototype.parseUnaryExpression=function(){var m;if(this.match("+")||this.match("-")||this.match("~")||this.match("!")||this.matchKeyword("delete")||this.matchKeyword("void")||this.matchKeyword("typeof")){var v=this.startNode(this.lookahead),O=this.nextToken();m=this.inheritCoverGrammar(this.parseUnaryExpression),m=this.finalize(v,new l.UnaryExpression(O.value,m)),this.context.strict&&m.operator==="delete"&&m.argument.type===c.Syntax.Identifier&&this.tolerateError(a.Messages.StrictDelete),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}else this.context.await&&this.matchContextualKeyword("await")?m=this.parseAwaitExpression():m=this.parseUpdateExpression();return m},x.prototype.parseExponentiationExpression=function(){var m=this.lookahead,v=this.inheritCoverGrammar(this.parseUnaryExpression);if(v.type!==c.Syntax.UnaryExpression&&this.match("**")){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var O=v,b=this.isolateCoverGrammar(this.parseExponentiationExpression);v=this.finalize(this.startNode(m),new l.BinaryExpression("**",O,b))}return v},x.prototype.binaryPrecedence=function(m){var v=m.value,O;return m.type===7?O=this.operatorPrecedence[v]||0:m.type===4?O=v==="instanceof"||this.context.allowIn&&v==="in"?7:0:O=0,O},x.prototype.parseBinaryExpression=function(){var m=this.lookahead,v=this.inheritCoverGrammar(this.parseExponentiationExpression),O=this.lookahead,b=this.binaryPrecedence(O);if(b>0){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;for(var k=[m,this.lookahead],E=v,$=this.isolateCoverGrammar(this.parseExponentiationExpression),N=[E,O.value,$],X=[b];b=this.binaryPrecedence(this.lookahead),!(b<=0);){for(;N.length>2&&b<=X[X.length-1];){$=N.pop();var R=N.pop();X.pop(),E=N.pop(),k.pop();var W=this.startNode(k[k.length-1]);N.push(this.finalize(W,new l.BinaryExpression(R,E,$)))}N.push(this.nextToken().value),X.push(b),k.push(this.lookahead),N.push(this.isolateCoverGrammar(this.parseExponentiationExpression))}var D=N.length-1;v=N[D];for(var z=k.pop();D>1;){var Q=k.pop(),U=z&&z.lineStart,W=this.startNode(Q,U),R=N[D-1];v=this.finalize(W,new l.BinaryExpression(R,N[D-2],v)),D-=2,z=Q}}return v},x.prototype.parseConditionalExpression=function(){var m=this.lookahead,v=this.inheritCoverGrammar(this.parseBinaryExpression);if(this.match("?")){this.nextToken();var O=this.context.allowIn;this.context.allowIn=!0;var b=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowIn=O,this.expect(":");var k=this.isolateCoverGrammar(this.parseAssignmentExpression);v=this.finalize(this.startNode(m),new l.ConditionalExpression(v,b,k)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return v},x.prototype.checkPatternParam=function(m,v){switch(v.type){case c.Syntax.Identifier:this.validateParam(m,v,v.name);break;case c.Syntax.RestElement:this.checkPatternParam(m,v.argument);break;case c.Syntax.AssignmentPattern:this.checkPatternParam(m,v.left);break;case c.Syntax.ArrayPattern:for(var O=0;O")){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var k=m.async,E=this.reinterpretAsCoverFormalsList(m);if(E){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;var $=this.context.strict,N=this.context.allowStrictDirective;this.context.allowStrictDirective=E.simple;var X=this.context.allowYield,R=this.context.await;this.context.allowYield=!0,this.context.await=k;var W=this.startNode(v);this.expect("=>");var D=void 0;if(this.match("{")){var z=this.context.allowIn;this.context.allowIn=!0,D=this.parseFunctionSourceElements(),this.context.allowIn=z}else D=this.isolateCoverGrammar(this.parseAssignmentExpression);var Q=D.type!==c.Syntax.BlockStatement;this.context.strict&&E.firstRestricted&&this.throwUnexpectedToken(E.firstRestricted,E.message),this.context.strict&&E.stricted&&this.tolerateUnexpectedToken(E.stricted,E.message),m=k?this.finalize(W,new l.AsyncArrowFunctionExpression(E.params,D,Q)):this.finalize(W,new l.ArrowFunctionExpression(E.params,D,Q)),this.context.strict=$,this.context.allowStrictDirective=N,this.context.allowYield=X,this.context.await=R}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(a.Messages.InvalidLHSInAssignment),this.context.strict&&m.type===c.Syntax.Identifier){var U=m;this.scanner.isRestrictedWord(U.name)&&this.tolerateUnexpectedToken(O,a.Messages.StrictLHSAssignment),this.scanner.isStrictModeReservedWord(U.name)&&this.tolerateUnexpectedToken(O,a.Messages.StrictReservedWord)}this.match("=")?this.reinterpretExpressionAsPattern(m):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1),O=this.nextToken();var T=O.value,H=this.isolateCoverGrammar(this.parseAssignmentExpression);m=this.finalize(this.startNode(v),new l.AssignmentExpression(T,m,H)),this.context.firstCoverInitializedNameError=null}}return m},x.prototype.parseExpression=function(){var m=this.lookahead,v=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){var O=[];for(O.push(v);this.lookahead.type!==2&&this.match(",");)this.nextToken(),O.push(this.isolateCoverGrammar(this.parseAssignmentExpression));v=this.finalize(this.startNode(m),new l.SequenceExpression(O))}return v},x.prototype.parseStatementListItem=function(){var m;if(this.context.isAssignmentTarget=!0,this.context.isBindingElement=!0,this.lookahead.type===4)switch(this.lookahead.value){case"export":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,a.Messages.IllegalExportDeclaration),m=this.parseExportDeclaration();break;case"import":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,a.Messages.IllegalImportDeclaration),m=this.parseImportDeclaration();break;case"const":m=this.parseLexicalDeclaration({inFor:!1});break;case"function":m=this.parseFunctionDeclaration();break;case"class":m=this.parseClassDeclaration();break;case"let":m=this.isLexicalDeclaration()?this.parseLexicalDeclaration({inFor:!1}):this.parseStatement();break;default:m=this.parseStatement();break}else m=this.parseStatement();return m},x.prototype.parseBlock=function(){var m=this.createNode();this.expect("{");for(var v=[];!this.match("}");)v.push(this.parseStatementListItem());return this.expect("}"),this.finalize(m,new l.BlockStatement(v))},x.prototype.parseLexicalBinding=function(m,v){var O=this.createNode(),b=[],k=this.parsePattern(b,m);this.context.strict&&k.type===c.Syntax.Identifier&&this.scanner.isRestrictedWord(k.name)&&this.tolerateError(a.Messages.StrictVarName);var E=null;return m==="const"?!this.matchKeyword("in")&&!this.matchContextualKeyword("of")&&(this.match("=")?(this.nextToken(),E=this.isolateCoverGrammar(this.parseAssignmentExpression)):this.throwError(a.Messages.DeclarationMissingInitializer,"const")):(!v.inFor&&k.type!==c.Syntax.Identifier||this.match("="))&&(this.expect("="),E=this.isolateCoverGrammar(this.parseAssignmentExpression)),this.finalize(O,new l.VariableDeclarator(k,E))},x.prototype.parseBindingList=function(m,v){for(var O=[this.parseLexicalBinding(m,v)];this.match(",");)this.nextToken(),O.push(this.parseLexicalBinding(m,v));return O},x.prototype.isLexicalDeclaration=function(){var m=this.scanner.saveState();this.scanner.scanComments();var v=this.scanner.lex();return this.scanner.restoreState(m),v.type===3||v.type===7&&v.value==="["||v.type===7&&v.value==="{"||v.type===4&&v.value==="let"||v.type===4&&v.value==="yield"},x.prototype.parseLexicalDeclaration=function(m){var v=this.createNode(),O=this.nextToken().value;o.assert(O==="let"||O==="const","Lexical declaration must be either let or const");var b=this.parseBindingList(O,m);return this.consumeSemicolon(),this.finalize(v,new l.VariableDeclaration(b,O))},x.prototype.parseBindingRestElement=function(m,v){var O=this.createNode();this.expect("...");var b=this.parsePattern(m,v);return this.finalize(O,new l.RestElement(b))},x.prototype.parseArrayPattern=function(m,v){var O=this.createNode();this.expect("[");for(var b=[];!this.match("]");)if(this.match(","))this.nextToken(),b.push(null);else{if(this.match("...")){b.push(this.parseBindingRestElement(m,v));break}else b.push(this.parsePatternWithDefault(m,v));this.match("]")||this.expect(",")}return this.expect("]"),this.finalize(O,new l.ArrayPattern(b))},x.prototype.parsePropertyPattern=function(m,v){var O=this.createNode(),b=!1,k=!1,E=!1,$,N;if(this.lookahead.type===3){var X=this.lookahead;$=this.parseVariableIdentifier();var R=this.finalize(O,new l.Identifier(X.value));if(this.match("=")){m.push(X),k=!0,this.nextToken();var W=this.parseAssignmentExpression();N=this.finalize(this.startNode(X),new l.AssignmentPattern(R,W))}else this.match(":")?(this.expect(":"),N=this.parsePatternWithDefault(m,v)):(m.push(X),k=!0,N=R)}else b=this.match("["),$=this.parseObjectPropertyKey(),this.expect(":"),N=this.parsePatternWithDefault(m,v);return this.finalize(O,new l.Property("init",$,b,N,E,k))},x.prototype.parseObjectPattern=function(m,v){var O=this.createNode(),b=[];for(this.expect("{");!this.match("}");)b.push(this.parsePropertyPattern(m,v)),this.match("}")||this.expect(",");return this.expect("}"),this.finalize(O,new l.ObjectPattern(b))},x.prototype.parsePattern=function(m,v){var O;return this.match("[")?O=this.parseArrayPattern(m,v):this.match("{")?O=this.parseObjectPattern(m,v):(this.matchKeyword("let")&&(v==="const"||v==="let")&&this.tolerateUnexpectedToken(this.lookahead,a.Messages.LetInLexicalBinding),m.push(this.lookahead),O=this.parseVariableIdentifier(v)),O},x.prototype.parsePatternWithDefault=function(m,v){var O=this.lookahead,b=this.parsePattern(m,v);if(this.match("=")){this.nextToken();var k=this.context.allowYield;this.context.allowYield=!0;var E=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowYield=k,b=this.finalize(this.startNode(O),new l.AssignmentPattern(b,E))}return b},x.prototype.parseVariableIdentifier=function(m){var v=this.createNode(),O=this.nextToken();return O.type===4&&O.value==="yield"?this.context.strict?this.tolerateUnexpectedToken(O,a.Messages.StrictReservedWord):this.context.allowYield||this.throwUnexpectedToken(O):O.type!==3?this.context.strict&&O.type===4&&this.scanner.isStrictModeReservedWord(O.value)?this.tolerateUnexpectedToken(O,a.Messages.StrictReservedWord):(this.context.strict||O.value!=="let"||m!=="var")&&this.throwUnexpectedToken(O):(this.context.isModule||this.context.await)&&O.type===3&&O.value==="await"&&this.tolerateUnexpectedToken(O),this.finalize(v,new l.Identifier(O.value))},x.prototype.parseVariableDeclaration=function(m){var v=this.createNode(),O=[],b=this.parsePattern(O,"var");this.context.strict&&b.type===c.Syntax.Identifier&&this.scanner.isRestrictedWord(b.name)&&this.tolerateError(a.Messages.StrictVarName);var k=null;return this.match("=")?(this.nextToken(),k=this.isolateCoverGrammar(this.parseAssignmentExpression)):b.type!==c.Syntax.Identifier&&!m.inFor&&this.expect("="),this.finalize(v,new l.VariableDeclarator(b,k))},x.prototype.parseVariableDeclarationList=function(m){var v={inFor:m.inFor},O=[];for(O.push(this.parseVariableDeclaration(v));this.match(",");)this.nextToken(),O.push(this.parseVariableDeclaration(v));return O},x.prototype.parseVariableStatement=function(){var m=this.createNode();this.expectKeyword("var");var v=this.parseVariableDeclarationList({inFor:!1});return this.consumeSemicolon(),this.finalize(m,new l.VariableDeclaration(v,"var"))},x.prototype.parseEmptyStatement=function(){var m=this.createNode();return this.expect(";"),this.finalize(m,new l.EmptyStatement)},x.prototype.parseExpressionStatement=function(){var m=this.createNode(),v=this.parseExpression();return this.consumeSemicolon(),this.finalize(m,new l.ExpressionStatement(v))},x.prototype.parseIfClause=function(){return this.context.strict&&this.matchKeyword("function")&&this.tolerateError(a.Messages.StrictFunction),this.parseStatement()},x.prototype.parseIfStatement=function(){var m=this.createNode(),v,O=null;this.expectKeyword("if"),this.expect("(");var b=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),v=this.finalize(this.createNode(),new l.EmptyStatement)):(this.expect(")"),v=this.parseIfClause(),this.matchKeyword("else")&&(this.nextToken(),O=this.parseIfClause())),this.finalize(m,new l.IfStatement(b,v,O))},x.prototype.parseDoWhileStatement=function(){var m=this.createNode();this.expectKeyword("do");var v=this.context.inIteration;this.context.inIteration=!0;var O=this.parseStatement();this.context.inIteration=v,this.expectKeyword("while"),this.expect("(");var b=this.parseExpression();return!this.match(")")&&this.config.tolerant?this.tolerateUnexpectedToken(this.nextToken()):(this.expect(")"),this.match(";")&&this.nextToken()),this.finalize(m,new l.DoWhileStatement(O,b))},x.prototype.parseWhileStatement=function(){var m=this.createNode(),v;this.expectKeyword("while"),this.expect("(");var O=this.parseExpression();if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),v=this.finalize(this.createNode(),new l.EmptyStatement);else{this.expect(")");var b=this.context.inIteration;this.context.inIteration=!0,v=this.parseStatement(),this.context.inIteration=b}return this.finalize(m,new l.WhileStatement(O,v))},x.prototype.parseForStatement=function(){var m=null,v=null,O=null,b=!0,k,E,$=this.createNode();if(this.expectKeyword("for"),this.expect("("),this.match(";"))this.nextToken();else if(this.matchKeyword("var")){m=this.createNode(),this.nextToken();var N=this.context.allowIn;this.context.allowIn=!1;var X=this.parseVariableDeclarationList({inFor:!0});if(this.context.allowIn=N,X.length===1&&this.matchKeyword("in")){var R=X[0];R.init&&(R.id.type===c.Syntax.ArrayPattern||R.id.type===c.Syntax.ObjectPattern||this.context.strict)&&this.tolerateError(a.Messages.ForInOfLoopInitializer,"for-in"),m=this.finalize(m,new l.VariableDeclaration(X,"var")),this.nextToken(),k=m,E=this.parseExpression(),m=null}else X.length===1&&X[0].init===null&&this.matchContextualKeyword("of")?(m=this.finalize(m,new l.VariableDeclaration(X,"var")),this.nextToken(),k=m,E=this.parseAssignmentExpression(),m=null,b=!1):(m=this.finalize(m,new l.VariableDeclaration(X,"var")),this.expect(";"))}else if(this.matchKeyword("const")||this.matchKeyword("let")){m=this.createNode();var W=this.nextToken().value;if(!this.context.strict&&this.lookahead.value==="in")m=this.finalize(m,new l.Identifier(W)),this.nextToken(),k=m,E=this.parseExpression(),m=null;else{var N=this.context.allowIn;this.context.allowIn=!1;var X=this.parseBindingList(W,{inFor:!0});this.context.allowIn=N,X.length===1&&X[0].init===null&&this.matchKeyword("in")?(m=this.finalize(m,new l.VariableDeclaration(X,W)),this.nextToken(),k=m,E=this.parseExpression(),m=null):X.length===1&&X[0].init===null&&this.matchContextualKeyword("of")?(m=this.finalize(m,new l.VariableDeclaration(X,W)),this.nextToken(),k=m,E=this.parseAssignmentExpression(),m=null,b=!1):(this.consumeSemicolon(),m=this.finalize(m,new l.VariableDeclaration(X,W)))}}else{var D=this.lookahead,N=this.context.allowIn;if(this.context.allowIn=!1,m=this.inheritCoverGrammar(this.parseAssignmentExpression),this.context.allowIn=N,this.matchKeyword("in"))(!this.context.isAssignmentTarget||m.type===c.Syntax.AssignmentExpression)&&this.tolerateError(a.Messages.InvalidLHSInForIn),this.nextToken(),this.reinterpretExpressionAsPattern(m),k=m,E=this.parseExpression(),m=null;else if(this.matchContextualKeyword("of"))(!this.context.isAssignmentTarget||m.type===c.Syntax.AssignmentExpression)&&this.tolerateError(a.Messages.InvalidLHSInForLoop),this.nextToken(),this.reinterpretExpressionAsPattern(m),k=m,E=this.parseAssignmentExpression(),m=null,b=!1;else{if(this.match(",")){for(var z=[m];this.match(",");)this.nextToken(),z.push(this.isolateCoverGrammar(this.parseAssignmentExpression));m=this.finalize(this.startNode(D),new l.SequenceExpression(z))}this.expect(";")}}typeof k>"u"&&(this.match(";")||(v=this.parseExpression()),this.expect(";"),this.match(")")||(O=this.parseExpression()));var Q;if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),Q=this.finalize(this.createNode(),new l.EmptyStatement);else{this.expect(")");var U=this.context.inIteration;this.context.inIteration=!0,Q=this.isolateCoverGrammar(this.parseStatement),this.context.inIteration=U}return typeof k>"u"?this.finalize($,new l.ForStatement(m,v,O,Q)):b?this.finalize($,new l.ForInStatement(k,E,Q)):this.finalize($,new l.ForOfStatement(k,E,Q))},x.prototype.parseContinueStatement=function(){var m=this.createNode();this.expectKeyword("continue");var v=null;if(this.lookahead.type===3&&!this.hasLineTerminator){var O=this.parseVariableIdentifier();v=O;var b="$"+O.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,b)||this.throwError(a.Messages.UnknownLabel,O.name)}return this.consumeSemicolon(),v===null&&!this.context.inIteration&&this.throwError(a.Messages.IllegalContinue),this.finalize(m,new l.ContinueStatement(v))},x.prototype.parseBreakStatement=function(){var m=this.createNode();this.expectKeyword("break");var v=null;if(this.lookahead.type===3&&!this.hasLineTerminator){var O=this.parseVariableIdentifier(),b="$"+O.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,b)||this.throwError(a.Messages.UnknownLabel,O.name),v=O}return this.consumeSemicolon(),v===null&&!this.context.inIteration&&!this.context.inSwitch&&this.throwError(a.Messages.IllegalBreak),this.finalize(m,new l.BreakStatement(v))},x.prototype.parseReturnStatement=function(){this.context.inFunctionBody||this.tolerateError(a.Messages.IllegalReturn);var m=this.createNode();this.expectKeyword("return");var v=!this.match(";")&&!this.match("}")&&!this.hasLineTerminator&&this.lookahead.type!==2||this.lookahead.type===8||this.lookahead.type===10,O=v?this.parseExpression():null;return this.consumeSemicolon(),this.finalize(m,new l.ReturnStatement(O))},x.prototype.parseWithStatement=function(){this.context.strict&&this.tolerateError(a.Messages.StrictModeWith);var m=this.createNode(),v;this.expectKeyword("with"),this.expect("(");var O=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),v=this.finalize(this.createNode(),new l.EmptyStatement)):(this.expect(")"),v=this.parseStatement()),this.finalize(m,new l.WithStatement(O,v))},x.prototype.parseSwitchCase=function(){var m=this.createNode(),v;this.matchKeyword("default")?(this.nextToken(),v=null):(this.expectKeyword("case"),v=this.parseExpression()),this.expect(":");for(var O=[];!(this.match("}")||this.matchKeyword("default")||this.matchKeyword("case"));)O.push(this.parseStatementListItem());return this.finalize(m,new l.SwitchCase(v,O))},x.prototype.parseSwitchStatement=function(){var m=this.createNode();this.expectKeyword("switch"),this.expect("(");var v=this.parseExpression();this.expect(")");var O=this.context.inSwitch;this.context.inSwitch=!0;var b=[],k=!1;for(this.expect("{");!this.match("}");){var E=this.parseSwitchCase();E.test===null&&(k&&this.throwError(a.Messages.MultipleDefaultsInSwitch),k=!0),b.push(E)}return this.expect("}"),this.context.inSwitch=O,this.finalize(m,new l.SwitchStatement(v,b))},x.prototype.parseLabelledStatement=function(){var m=this.createNode(),v=this.parseExpression(),O;if(v.type===c.Syntax.Identifier&&this.match(":")){this.nextToken();var b=v,k="$"+b.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,k)&&this.throwError(a.Messages.Redeclaration,"Label",b.name),this.context.labelSet[k]=!0;var E=void 0;if(this.matchKeyword("class"))this.tolerateUnexpectedToken(this.lookahead),E=this.parseClassDeclaration();else if(this.matchKeyword("function")){var $=this.lookahead,N=this.parseFunctionDeclaration();this.context.strict?this.tolerateUnexpectedToken($,a.Messages.StrictFunction):N.generator&&this.tolerateUnexpectedToken($,a.Messages.GeneratorInLegacyContext),E=N}else E=this.parseStatement();delete this.context.labelSet[k],O=new l.LabeledStatement(b,E)}else this.consumeSemicolon(),O=new l.ExpressionStatement(v);return this.finalize(m,O)},x.prototype.parseThrowStatement=function(){var m=this.createNode();this.expectKeyword("throw"),this.hasLineTerminator&&this.throwError(a.Messages.NewlineAfterThrow);var v=this.parseExpression();return this.consumeSemicolon(),this.finalize(m,new l.ThrowStatement(v))},x.prototype.parseCatchClause=function(){var m=this.createNode();this.expectKeyword("catch"),this.expect("("),this.match(")")&&this.throwUnexpectedToken(this.lookahead);for(var v=[],O=this.parsePattern(v),b={},k=0;k0&&this.tolerateError(a.Messages.BadGetterArity);var k=this.parsePropertyMethod(b);return this.context.allowYield=O,this.finalize(m,new l.FunctionExpression(null,b.params,k,v))},x.prototype.parseSetterMethod=function(){var m=this.createNode(),v=!1,O=this.context.allowYield;this.context.allowYield=!v;var b=this.parseFormalParameters();b.params.length!==1?this.tolerateError(a.Messages.BadSetterArity):b.params[0]instanceof l.RestElement&&this.tolerateError(a.Messages.BadSetterRestParameter);var k=this.parsePropertyMethod(b);return this.context.allowYield=O,this.finalize(m,new l.FunctionExpression(null,b.params,k,v))},x.prototype.parseGeneratorMethod=function(){var m=this.createNode(),v=!0,O=this.context.allowYield;this.context.allowYield=!0;var b=this.parseFormalParameters();this.context.allowYield=!1;var k=this.parsePropertyMethod(b);return this.context.allowYield=O,this.finalize(m,new l.FunctionExpression(null,b.params,k,v))},x.prototype.isStartOfExpression=function(){var m=!0,v=this.lookahead.value;switch(this.lookahead.type){case 7:m=v==="["||v==="("||v==="{"||v==="+"||v==="-"||v==="!"||v==="~"||v==="++"||v==="--"||v==="/"||v==="/=";break;case 4:m=v==="class"||v==="delete"||v==="function"||v==="let"||v==="new"||v==="super"||v==="this"||v==="typeof"||v==="void"||v==="yield";break}return m},x.prototype.parseYieldExpression=function(){var m=this.createNode();this.expectKeyword("yield");var v=null,O=!1;if(!this.hasLineTerminator){var b=this.context.allowYield;this.context.allowYield=!1,O=this.match("*"),O?(this.nextToken(),v=this.parseAssignmentExpression()):this.isStartOfExpression()&&(v=this.parseAssignmentExpression()),this.context.allowYield=b}return this.finalize(m,new l.YieldExpression(v,O))},x.prototype.parseClassElement=function(m){var v=this.lookahead,O=this.createNode(),b="",k=null,E=null,$=!1,N=!1,X=!1,R=!1;if(this.match("*"))this.nextToken();else{$=this.match("["),k=this.parseObjectPropertyKey();var W=k;if(W.name==="static"&&(this.qualifiedPropertyName(this.lookahead)||this.match("*"))&&(v=this.lookahead,X=!0,$=this.match("["),this.match("*")?this.nextToken():k=this.parseObjectPropertyKey()),v.type===3&&!this.hasLineTerminator&&v.value==="async"){var D=this.lookahead.value;D!==":"&&D!=="("&&D!=="*"&&(R=!0,v=this.lookahead,k=this.parseObjectPropertyKey(),v.type===3&&v.value==="constructor"&&this.tolerateUnexpectedToken(v,a.Messages.ConstructorIsAsync))}}var z=this.qualifiedPropertyName(this.lookahead);return v.type===3?v.value==="get"&&z?(b="get",$=this.match("["),k=this.parseObjectPropertyKey(),this.context.allowYield=!1,E=this.parseGetterMethod()):v.value==="set"&&z&&(b="set",$=this.match("["),k=this.parseObjectPropertyKey(),E=this.parseSetterMethod()):v.type===7&&v.value==="*"&&z&&(b="init",$=this.match("["),k=this.parseObjectPropertyKey(),E=this.parseGeneratorMethod(),N=!0),!b&&k&&this.match("(")&&(b="init",E=R?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),N=!0),b||this.throwUnexpectedToken(this.lookahead),b==="init"&&(b="method"),$||(X&&this.isPropertyKey(k,"prototype")&&this.throwUnexpectedToken(v,a.Messages.StaticPrototype),!X&&this.isPropertyKey(k,"constructor")&&((b!=="method"||!N||E&&E.generator)&&this.throwUnexpectedToken(v,a.Messages.ConstructorSpecialMethod),m.value?this.throwUnexpectedToken(v,a.Messages.DuplicateConstructor):m.value=!0,b="constructor")),this.finalize(O,new l.MethodDefinition(k,$,E,b,X))},x.prototype.parseClassElementList=function(){var m=[],v={value:!1};for(this.expect("{");!this.match("}");)this.match(";")?this.nextToken():m.push(this.parseClassElement(v));return this.expect("}"),m},x.prototype.parseClassBody=function(){var m=this.createNode(),v=this.parseClassElementList();return this.finalize(m,new l.ClassBody(v))},x.prototype.parseClassDeclaration=function(m){var v=this.createNode(),O=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var b=m&&this.lookahead.type!==3?null:this.parseVariableIdentifier(),k=null;this.matchKeyword("extends")&&(this.nextToken(),k=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var E=this.parseClassBody();return this.context.strict=O,this.finalize(v,new l.ClassDeclaration(b,k,E))},x.prototype.parseClassExpression=function(){var m=this.createNode(),v=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var O=this.lookahead.type===3?this.parseVariableIdentifier():null,b=null;this.matchKeyword("extends")&&(this.nextToken(),b=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var k=this.parseClassBody();return this.context.strict=v,this.finalize(m,new l.ClassExpression(O,b,k))},x.prototype.parseModule=function(){this.context.strict=!0,this.context.isModule=!0,this.scanner.isModule=!0;for(var m=this.createNode(),v=this.parseDirectivePrologues();this.lookahead.type!==2;)v.push(this.parseStatementListItem());return this.finalize(m,new l.Module(v))},x.prototype.parseScript=function(){for(var m=this.createNode(),v=this.parseDirectivePrologues();this.lookahead.type!==2;)v.push(this.parseStatementListItem());return this.finalize(m,new l.Script(v))},x.prototype.parseModuleSpecifier=function(){var m=this.createNode();this.lookahead.type!==8&&this.throwError(a.Messages.InvalidModuleSpecifier);var v=this.nextToken(),O=this.getTokenRaw(v);return this.finalize(m,new l.Literal(v.value,O))},x.prototype.parseImportSpecifier=function(){var m=this.createNode(),v,O;return this.lookahead.type===3?(v=this.parseVariableIdentifier(),O=v,this.matchContextualKeyword("as")&&(this.nextToken(),O=this.parseVariableIdentifier())):(v=this.parseIdentifierName(),O=v,this.matchContextualKeyword("as")?(this.nextToken(),O=this.parseVariableIdentifier()):this.throwUnexpectedToken(this.nextToken())),this.finalize(m,new l.ImportSpecifier(O,v))},x.prototype.parseNamedImports=function(){this.expect("{");for(var m=[];!this.match("}");)m.push(this.parseImportSpecifier()),this.match("}")||this.expect(",");return this.expect("}"),m},x.prototype.parseImportDefaultSpecifier=function(){var m=this.createNode(),v=this.parseIdentifierName();return this.finalize(m,new l.ImportDefaultSpecifier(v))},x.prototype.parseImportNamespaceSpecifier=function(){var m=this.createNode();this.expect("*"),this.matchContextualKeyword("as")||this.throwError(a.Messages.NoAsAfterImportNamespace),this.nextToken();var v=this.parseIdentifierName();return this.finalize(m,new l.ImportNamespaceSpecifier(v))},x.prototype.parseImportDeclaration=function(){this.context.inFunctionBody&&this.throwError(a.Messages.IllegalImportDeclaration);var m=this.createNode();this.expectKeyword("import");var v,O=[];if(this.lookahead.type===8)v=this.parseModuleSpecifier();else{if(this.match("{")?O=O.concat(this.parseNamedImports()):this.match("*")?O.push(this.parseImportNamespaceSpecifier()):this.isIdentifierName(this.lookahead)&&!this.matchKeyword("default")?(O.push(this.parseImportDefaultSpecifier()),this.match(",")&&(this.nextToken(),this.match("*")?O.push(this.parseImportNamespaceSpecifier()):this.match("{")?O=O.concat(this.parseNamedImports()):this.throwUnexpectedToken(this.lookahead))):this.throwUnexpectedToken(this.nextToken()),!this.matchContextualKeyword("from")){var b=this.lookahead.value?a.Messages.UnexpectedToken:a.Messages.MissingFromClause;this.throwError(b,this.lookahead.value)}this.nextToken(),v=this.parseModuleSpecifier()}return this.consumeSemicolon(),this.finalize(m,new l.ImportDeclaration(O,v))},x.prototype.parseExportSpecifier=function(){var m=this.createNode(),v=this.parseIdentifierName(),O=v;return this.matchContextualKeyword("as")&&(this.nextToken(),O=this.parseIdentifierName()),this.finalize(m,new l.ExportSpecifier(v,O))},x.prototype.parseExportDeclaration=function(){this.context.inFunctionBody&&this.throwError(a.Messages.IllegalExportDeclaration);var m=this.createNode();this.expectKeyword("export");var v;if(this.matchKeyword("default"))if(this.nextToken(),this.matchKeyword("function")){var O=this.parseFunctionDeclaration(!0);v=this.finalize(m,new l.ExportDefaultDeclaration(O))}else if(this.matchKeyword("class")){var O=this.parseClassDeclaration(!0);v=this.finalize(m,new l.ExportDefaultDeclaration(O))}else if(this.matchContextualKeyword("async")){var O=this.matchAsyncFunction()?this.parseFunctionDeclaration(!0):this.parseAssignmentExpression();v=this.finalize(m,new l.ExportDefaultDeclaration(O))}else{this.matchContextualKeyword("from")&&this.throwError(a.Messages.UnexpectedToken,this.lookahead.value);var O=this.match("{")?this.parseObjectInitializer():this.match("[")?this.parseArrayInitializer():this.parseAssignmentExpression();this.consumeSemicolon(),v=this.finalize(m,new l.ExportDefaultDeclaration(O))}else if(this.match("*")){if(this.nextToken(),!this.matchContextualKeyword("from")){var b=this.lookahead.value?a.Messages.UnexpectedToken:a.Messages.MissingFromClause;this.throwError(b,this.lookahead.value)}this.nextToken();var k=this.parseModuleSpecifier();this.consumeSemicolon(),v=this.finalize(m,new l.ExportAllDeclaration(k))}else if(this.lookahead.type===4){var O=void 0;switch(this.lookahead.value){case"let":case"const":O=this.parseLexicalDeclaration({inFor:!1});break;case"var":case"class":case"function":O=this.parseStatementListItem();break;default:this.throwUnexpectedToken(this.lookahead)}v=this.finalize(m,new l.ExportNamedDeclaration(O,[],null))}else if(this.matchAsyncFunction()){var O=this.parseFunctionDeclaration();v=this.finalize(m,new l.ExportNamedDeclaration(O,[],null))}else{var E=[],$=null,N=!1;for(this.expect("{");!this.match("}");)N=N||this.matchKeyword("default"),E.push(this.parseExportSpecifier()),this.match("}")||this.expect(",");if(this.expect("}"),this.matchContextualKeyword("from"))this.nextToken(),$=this.parseModuleSpecifier(),this.consumeSemicolon();else if(N){var b=this.lookahead.value?a.Messages.UnexpectedToken:a.Messages.MissingFromClause;this.throwError(b,this.lookahead.value)}else this.consumeSemicolon();v=this.finalize(m,new l.ExportNamedDeclaration(null,E,$))}return v},x}();n.Parser=g},function(e,n){Object.defineProperty(n,"__esModule",{value:!0});function r(o,s){if(!o)throw new Error("ASSERT: "+s)}n.assert=r},function(e,n){Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function o(){this.errors=[],this.tolerant=!1}return o.prototype.recordError=function(s){this.errors.push(s)},o.prototype.tolerate=function(s){if(this.tolerant)this.recordError(s);else throw s},o.prototype.constructError=function(s,a){var l=new Error(s);try{throw l}catch(u){Object.create&&Object.defineProperty&&(l=Object.create(u),Object.defineProperty(l,"column",{value:a}))}return l},o.prototype.createError=function(s,a,l,u){var c="Line "+a+": "+u,d=this.constructError(c,l);return d.index=s,d.lineNumber=a,d.description=u,d},o.prototype.throwError=function(s,a,l,u){throw this.createError(s,a,l,u)},o.prototype.tolerateError=function(s,a,l,u){var c=this.createError(s,a,l,u);if(this.tolerant)this.recordError(c);else throw c},o}();n.ErrorHandler=r},function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.Messages={BadGetterArity:"Getter must not have any formal parameters",BadSetterArity:"Setter must have exactly one formal parameter",BadSetterRestParameter:"Setter function argument must not be a rest parameter",ConstructorIsAsync:"Class constructor may not be an async method",ConstructorSpecialMethod:"Class constructor may not be an accessor",DeclarationMissingInitializer:"Missing initializer in %0 declaration",DefaultRestParameter:"Unexpected token =",DuplicateBinding:"Duplicate binding %0",DuplicateConstructor:"A class may only have one constructor",DuplicateProtoProperty:"Duplicate __proto__ fields are not allowed in object literals",ForInOfLoopInitializer:"%0 loop variable declaration may not have an initializer",GeneratorInLegacyContext:"Generator declarations are not allowed in legacy contexts",IllegalBreak:"Illegal break statement",IllegalContinue:"Illegal continue statement",IllegalExportDeclaration:"Unexpected token",IllegalImportDeclaration:"Unexpected token",IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list",IllegalReturn:"Illegal return statement",InvalidEscapedReservedWord:"Keyword must not contain escaped characters",InvalidHexEscapeSequence:"Invalid hexadecimal escape sequence",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",InvalidLHSInForLoop:"Invalid left-hand side in for-loop",InvalidModuleSpecifier:"Unexpected token",InvalidRegExp:"Invalid regular expression",LetInLexicalBinding:"let is disallowed as a lexically bound name",MissingFromClause:"Unexpected token",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NewlineAfterThrow:"Illegal newline after throw",NoAsAfterImportNamespace:"Unexpected token",NoCatchOrFinally:"Missing catch or finally after try",ParameterAfterRestParameter:"Rest parameter must be last formal parameter",Redeclaration:"%0 '%1' has already been declared",StaticPrototype:"Classes may not have static property named prototype",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictModeWith:"Strict mode code may not include a with statement",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictReservedWord:"Use of future reserved word in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",TemplateOctalLiteral:"Octal literals are not allowed in template strings.",UnexpectedEOS:"Unexpected end of input",UnexpectedIdentifier:"Unexpected identifier",UnexpectedNumber:"Unexpected number",UnexpectedReserved:"Unexpected reserved word",UnexpectedString:"Unexpected string",UnexpectedTemplate:"Unexpected quasi %0",UnexpectedToken:"Unexpected token %0",UnexpectedTokenIllegal:"Unexpected token ILLEGAL",UnknownLabel:"Undefined label '%0'",UnterminatedRegExp:"Invalid regular expression: missing /"}},function(e,n,r){Object.defineProperty(n,"__esModule",{value:!0});var o=r(9),s=r(4),a=r(11);function l(d){return"0123456789abcdef".indexOf(d.toLowerCase())}function u(d){return"01234567".indexOf(d)}var c=function(){function d(f,g){this.source=f,this.errorHandler=g,this.trackComment=!1,this.isModule=!1,this.length=f.length,this.index=0,this.lineNumber=f.length>0?1:0,this.lineStart=0,this.curlyStack=[]}return d.prototype.saveState=function(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart}},d.prototype.restoreState=function(f){this.index=f.index,this.lineNumber=f.lineNumber,this.lineStart=f.lineStart},d.prototype.eof=function(){return this.index>=this.length},d.prototype.throwUnexpectedToken=function(f){return f===void 0&&(f=a.Messages.UnexpectedTokenIllegal),this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,f)},d.prototype.tolerateUnexpectedToken=function(f){f===void 0&&(f=a.Messages.UnexpectedTokenIllegal),this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,f)},d.prototype.skipSingleLineComment=function(f){var g=[],x,m;for(this.trackComment&&(g=[],x=this.index-f,m={start:{line:this.lineNumber,column:this.index-this.lineStart-f},end:{}});!this.eof();){var v=this.source.charCodeAt(this.index);if(++this.index,s.Character.isLineTerminator(v)){if(this.trackComment){m.end={line:this.lineNumber,column:this.index-this.lineStart-1};var O={multiLine:!1,slice:[x+f,this.index-1],range:[x,this.index-1],loc:m};g.push(O)}return v===13&&this.source.charCodeAt(this.index)===10&&++this.index,++this.lineNumber,this.lineStart=this.index,g}}if(this.trackComment){m.end={line:this.lineNumber,column:this.index-this.lineStart};var O={multiLine:!1,slice:[x+f,this.index],range:[x,this.index],loc:m};g.push(O)}return g},d.prototype.skipMultiLineComment=function(){var f=[],g,x;for(this.trackComment&&(f=[],g=this.index-2,x={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){var m=this.source.charCodeAt(this.index);if(s.Character.isLineTerminator(m))m===13&&this.source.charCodeAt(this.index+1)===10&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(m===42){if(this.source.charCodeAt(this.index+1)===47){if(this.index+=2,this.trackComment){x.end={line:this.lineNumber,column:this.index-this.lineStart};var v={multiLine:!0,slice:[g+2,this.index-2],range:[g,this.index],loc:x};f.push(v)}return f}++this.index}else++this.index}if(this.trackComment){x.end={line:this.lineNumber,column:this.index-this.lineStart};var v={multiLine:!0,slice:[g+2,this.index],range:[g,this.index],loc:x};f.push(v)}return this.tolerateUnexpectedToken(),f},d.prototype.scanComments=function(){var f;this.trackComment&&(f=[]);for(var g=this.index===0;!this.eof();){var x=this.source.charCodeAt(this.index);if(s.Character.isWhiteSpace(x))++this.index;else if(s.Character.isLineTerminator(x))++this.index,x===13&&this.source.charCodeAt(this.index)===10&&++this.index,++this.lineNumber,this.lineStart=this.index,g=!0;else if(x===47)if(x=this.source.charCodeAt(this.index+1),x===47){this.index+=2;var m=this.skipSingleLineComment(2);this.trackComment&&(f=f.concat(m)),g=!0}else if(x===42){this.index+=2;var m=this.skipMultiLineComment();this.trackComment&&(f=f.concat(m))}else break;else if(g&&x===45)if(this.source.charCodeAt(this.index+1)===45&&this.source.charCodeAt(this.index+2)===62){this.index+=3;var m=this.skipSingleLineComment(3);this.trackComment&&(f=f.concat(m))}else break;else if(x===60&&!this.isModule)if(this.source.slice(this.index+1,this.index+4)==="!--"){this.index+=4;var m=this.skipSingleLineComment(4);this.trackComment&&(f=f.concat(m))}else break;else break}return f},d.prototype.isFutureReservedWord=function(f){switch(f){case"enum":case"export":case"import":case"super":return!0;default:return!1}},d.prototype.isStrictModeReservedWord=function(f){switch(f){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}},d.prototype.isRestrictedWord=function(f){return f==="eval"||f==="arguments"},d.prototype.isKeyword=function(f){switch(f.length){case 2:return f==="if"||f==="in"||f==="do";case 3:return f==="var"||f==="for"||f==="new"||f==="try"||f==="let";case 4:return f==="this"||f==="else"||f==="case"||f==="void"||f==="with"||f==="enum";case 5:return f==="while"||f==="break"||f==="catch"||f==="throw"||f==="const"||f==="yield"||f==="class"||f==="super";case 6:return f==="return"||f==="typeof"||f==="delete"||f==="switch"||f==="export"||f==="import";case 7:return f==="default"||f==="finally"||f==="extends";case 8:return f==="function"||f==="continue"||f==="debugger";case 10:return f==="instanceof";default:return!1}},d.prototype.codePointAt=function(f){var g=this.source.charCodeAt(f);if(g>=55296&&g<=56319){var x=this.source.charCodeAt(f+1);if(x>=56320&&x<=57343){var m=g;g=(m-55296)*1024+x-56320+65536}}return g},d.prototype.scanHexEscape=function(f){for(var g=f==="u"?4:2,x=0,m=0;m1114111||f!=="}")&&this.throwUnexpectedToken(),s.Character.fromCodePoint(g)},d.prototype.getIdentifier=function(){for(var f=this.index++;!this.eof();){var g=this.source.charCodeAt(this.index);if(g===92)return this.index=f,this.getComplexIdentifier();if(g>=55296&&g<57343)return this.index=f,this.getComplexIdentifier();if(s.Character.isIdentifierPart(g))++this.index;else break}return this.source.slice(f,this.index)},d.prototype.getComplexIdentifier=function(){var f=this.codePointAt(this.index),g=s.Character.fromCodePoint(f);this.index+=g.length;var x;for(f===92&&(this.source.charCodeAt(this.index)!==117&&this.throwUnexpectedToken(),++this.index,this.source[this.index]==="{"?(++this.index,x=this.scanUnicodeCodePointEscape()):(x=this.scanHexEscape("u"),(x===null||x==="\\"||!s.Character.isIdentifierStart(x.charCodeAt(0)))&&this.throwUnexpectedToken()),g=x);!this.eof()&&(f=this.codePointAt(this.index),!!s.Character.isIdentifierPart(f));)x=s.Character.fromCodePoint(f),g+=x,this.index+=x.length,f===92&&(g=g.substr(0,g.length-1),this.source.charCodeAt(this.index)!==117&&this.throwUnexpectedToken(),++this.index,this.source[this.index]==="{"?(++this.index,x=this.scanUnicodeCodePointEscape()):(x=this.scanHexEscape("u"),(x===null||x==="\\"||!s.Character.isIdentifierPart(x.charCodeAt(0)))&&this.throwUnexpectedToken()),g+=x);return g},d.prototype.octalToDecimal=function(f){var g=f!=="0",x=u(f);return!this.eof()&&s.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(g=!0,x=x*8+u(this.source[this.index++]),"0123".indexOf(f)>=0&&!this.eof()&&s.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(x=x*8+u(this.source[this.index++]))),{code:x,octal:g}},d.prototype.scanIdentifier=function(){var f,g=this.index,x=this.source.charCodeAt(g)===92?this.getComplexIdentifier():this.getIdentifier();if(x.length===1?f=3:this.isKeyword(x)?f=4:x==="null"?f=5:x==="true"||x==="false"?f=1:f=3,f!==3&&g+x.length!==this.index){var m=this.index;this.index=g,this.tolerateUnexpectedToken(a.Messages.InvalidEscapedReservedWord),this.index=m}return{type:f,value:x,lineNumber:this.lineNumber,lineStart:this.lineStart,start:g,end:this.index}},d.prototype.scanPunctuator=function(){var f=this.index,g=this.source[this.index];switch(g){case"(":case"{":g==="{"&&this.curlyStack.push("{"),++this.index;break;case".":++this.index,this.source[this.index]==="."&&this.source[this.index+1]==="."&&(this.index+=2,g="...");break;case"}":++this.index,this.curlyStack.pop();break;case")":case";":case",":case"[":case"]":case":":case"?":case"~":++this.index;break;default:g=this.source.substr(this.index,4),g===">>>="?this.index+=4:(g=g.substr(0,3),g==="==="||g==="!=="||g===">>>"||g==="<<="||g===">>="||g==="**="?this.index+=3:(g=g.substr(0,2),g==="&&"||g==="||"||g==="=="||g==="!="||g==="+="||g==="-="||g==="*="||g==="/="||g==="++"||g==="--"||g==="<<"||g===">>"||g==="&="||g==="|="||g==="^="||g==="%="||g==="<="||g===">="||g==="=>"||g==="**"?this.index+=2:(g=this.source[this.index],"<>=!+-*%&|^/".indexOf(g)>=0&&++this.index)))}return this.index===f&&this.throwUnexpectedToken(),{type:7,value:g,lineNumber:this.lineNumber,lineStart:this.lineStart,start:f,end:this.index}},d.prototype.scanHexLiteral=function(f){for(var g="";!this.eof()&&s.Character.isHexDigit(this.source.charCodeAt(this.index));)g+=this.source[this.index++];return g.length===0&&this.throwUnexpectedToken(),s.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseInt("0x"+g,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:f,end:this.index}},d.prototype.scanBinaryLiteral=function(f){for(var g="",x;!this.eof()&&(x=this.source[this.index],!(x!=="0"&&x!=="1"));)g+=this.source[this.index++];return g.length===0&&this.throwUnexpectedToken(),this.eof()||(x=this.source.charCodeAt(this.index),(s.Character.isIdentifierStart(x)||s.Character.isDecimalDigit(x))&&this.throwUnexpectedToken()),{type:6,value:parseInt(g,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:f,end:this.index}},d.prototype.scanOctalLiteral=function(f,g){var x="",m=!1;for(s.Character.isOctalDigit(f.charCodeAt(0))?(m=!0,x="0"+this.source[this.index++]):++this.index;!this.eof()&&s.Character.isOctalDigit(this.source.charCodeAt(this.index));)x+=this.source[this.index++];return!m&&x.length===0&&this.throwUnexpectedToken(),(s.Character.isIdentifierStart(this.source.charCodeAt(this.index))||s.Character.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:6,value:parseInt(x,8),octal:m,lineNumber:this.lineNumber,lineStart:this.lineStart,start:g,end:this.index}},d.prototype.isImplicitOctalLiteral=function(){for(var f=this.index+1;f{if(!o)return;const a=s;if(a=="F.Cu"){const l=new Rn;l.setFileFunction("Copper,L1,Top"),l.setFilePolarity("Positive"),l.plotPads(t[a]),l.plotWires(t[a]),i.downloadGerberOptions.includeOutline&&l.plotOutline(t[r]),n.file(Cn(i,a),l.toString())}else if(a=="B.Cu"){const l=new Rn;l.setFileFunction("Copper,L2,Bot"),l.setFilePolarity("Positive"),l.plotPads(t[s]),l.plotWires(t[s]),i.downloadGerberOptions.includeOutline&&l.plotOutline(t[r]),n.file(Cn(i,a),l.toString())}else if(a=="F.Mask"){const l=new Rn;l.setFileFunction("Soldermask,Top"),l.setFilePolarity("Negative"),l.plotPads(t[a],.1),i.downloadGerberOptions.includeOutline&&l.plotOutline(t[r]),n.file(Cn(i,a),l.toString())}else if(a=="B.Mask"){const l=new Rn;l.setFileFunction("Soldermask,Bot"),l.setFilePolarity("Negative"),l.plotPads(t[a],.1),i.downloadGerberOptions.includeOutline&&l.plotOutline(t[r]),n.file(Cn(i,a),l.toString())}else if(a=="F.Silkscreen"){const l=new Rn;l.setFileFunction("Legend,Top"),l.setFilePolarity("Positive"),l.plotSilkscreen(t[a]),i.downloadGerberOptions.includeOutline&&l.plotOutline(t[r]),n.file(Cn(i,a),l.toString())}else if(a=="B.Silkscreen"){const l=new Rn;l.setFileFunction("Legend,Top"),l.setFilePolarity("Positive"),l.plotSilkscreen(t[a]),i.downloadGerberOptions.includeOutline&&l.plotOutline(t[r]),n.file(Cn(i,a),l.toString())}else if(a==r){const l=new Rn;l.setFileFunction("Profile,NP"),l.plotOutline(t[a]),n.file(Cn(i,a),l.toString())}if(i.downloadGerberOptions.drillFormat==jn.EXCELLON){const l=new HO(i);l.plotDrills(e),n.file(Cn(i,"Drills"),l.toString())}else if(i.downloadGerberOptions.drillFormat==jn.GERBER){const l=new Rn;l.setFileFunction("Plated,1,2,PTH,Drill"),l.setFilePolarity("Positive"),l.plotDrills(e),n.file(Cn(i,"Drills"),l.toString())}}),n.generateAsync({type:"blob"}).then(o=>{Y0.saveAs(o,`${i.name===""?"Untitled":i.name}-Gerbers.zip`)})}const Mt={version:"v0.2.0",codemirror:void 0,pcb:void 0,heldKeys:new Set,transforming:!1,transformUpdate:()=>{},fileHandle:null,needsSaving:!1,selectBox:{},footprints:{},shapes:[],astInfo:{},idToName:{},limits:{x:[0,1],y:[0,1]},mm_per_unit:25.4,background:"#00000000",grid:!0,gridSize:.05,adaptiveGrid:!1,snapToPad:!0,snapToPadRadius:.025,showNetlist:!0,viewHandles:!0,panZoomParams:void 0,previewFootprint:null,vimMode:!1,preview:null,paths:[],cubicHandleManipulation:"symmetric",selectedPathIndex:-1,selectedPath:null,selectablePaths:[],pts:[],layers:[],inputs:[],componentMenu:!1,componentSearch:"",downloadGerberModal:!1,downloadKiCadModal:!1,name:"",error:"",downloadGerberOptions:{layers:new Map([]),includeOutline:!0,excellonMetric:!0,protelFilenames:!1,drillFormat:jn.EXCELLON},downloadKiCadOptions:{footprintLibraryName:"SvgPcb",padShapeType:Ri.POLYGON,padPrimitiveShape:cn.RECTANGLE},svgToModsOptions:{selectedMachine:void 0}};var _m={exports:{}};(function(i,t){(function(n,r){i.exports=r()})(pn,function(){return function(e){var n={};function r(o){if(n[o])return n[o].exports;var s=n[o]={exports:{},id:o,loaded:!1};return e[o].call(s.exports,s,s.exports,r),s.loaded=!0,s.exports}return r.m=e,r.c=n,r.p="",r(0)}([function(e,n,r){Object.defineProperty(n,"__esModule",{value:!0});var o=r(1),s=r(3),a=r(8),l=r(15);function u(x,m,v){var O=null,b=function(D,z){v&&v(D,z),O&&O.visit(D,z)},k=typeof v=="function"?b:null,E=!1;if(m){E=typeof m.comment=="boolean"&&m.comment;var $=typeof m.attachComment=="boolean"&&m.attachComment;(E||$)&&(O=new o.CommentHandler,O.attach=$,m.comment=!0,k=b)}var Q=!1;m&&typeof m.sourceType=="string"&&(Q=m.sourceType==="module");var X;m&&typeof m.jsx=="boolean"&&m.jsx?X=new s.JSXParser(x,m,k):X=new a.Parser(x,m,k);var R=Q?X.parseModule():X.parseScript(),W=R;return E&&O&&(W.comments=O.comments),X.config.tokens&&(W.tokens=X.tokens),X.config.tolerant&&(W.errors=X.errorHandler.errors),W}n.parse=u;function c(x,m,v){var O=m||{};return O.sourceType="module",u(x,O,v)}n.parseModule=c;function d(x,m,v){var O=m||{};return O.sourceType="script",u(x,O,v)}n.parseScript=d;function f(x,m,v){var O=new l.Tokenizer(x,m),b;b=[];try{for(;;){var k=O.getNextToken();if(!k)break;v&&(k=v(k)),b.push(k)}}catch(E){O.errorHandler.tolerate(E)}return O.errorHandler.tolerant&&(b.errors=O.errors()),b}n.tokenize=f;var g=r(2);n.Syntax=g.Syntax,n.version="4.0.1"},function(e,n,r){Object.defineProperty(n,"__esModule",{value:!0});var o=r(2),s=function(){function a(){this.attach=!1,this.comments=[],this.stack=[],this.leading=[],this.trailing=[]}return a.prototype.insertInnerComments=function(l,u){if(l.type===o.Syntax.BlockStatement&&l.body.length===0){for(var c=[],d=this.leading.length-1;d>=0;--d){var f=this.leading[d];u.end.offset>=f.start&&(c.unshift(f.comment),this.leading.splice(d,1),this.trailing.splice(d,1))}c.length&&(l.innerComments=c)}},a.prototype.findTrailingComments=function(l){var u=[];if(this.trailing.length>0){for(var c=this.trailing.length-1;c>=0;--c){var d=this.trailing[c];d.start>=l.end.offset&&u.unshift(d.comment)}return this.trailing.length=0,u}var f=this.stack[this.stack.length-1];if(f&&f.node.trailingComments){var g=f.node.trailingComments[0];g&&g.range[0]>=l.end.offset&&(u=f.node.trailingComments,delete f.node.trailingComments)}return u},a.prototype.findLeadingComments=function(l){for(var u=[],c;this.stack.length>0;){var d=this.stack[this.stack.length-1];if(d&&d.start>=l.start.offset)c=d.node,this.stack.pop();else break}if(c){for(var f=c.leadingComments?c.leadingComments.length:0,g=f-1;g>=0;--g){var x=c.leadingComments[g];x.range[1]<=l.start.offset&&(u.unshift(x),c.leadingComments.splice(g,1))}return c.leadingComments&&c.leadingComments.length===0&&delete c.leadingComments,u}for(var g=this.leading.length-1;g>=0;--g){var d=this.leading[g];d.start<=l.start.offset&&(u.unshift(d.comment),this.leading.splice(g,1))}return u},a.prototype.visitNode=function(l,u){if(!(l.type===o.Syntax.Program&&l.body.length>0)){this.insertInnerComments(l,u);var c=this.findTrailingComments(u),d=this.findLeadingComments(u);d.length>0&&(l.leadingComments=d),c.length>0&&(l.trailingComments=c),this.stack.push({node:l,start:u.start.offset})}},a.prototype.visitComment=function(l,u){var c=l.type[0]==="L"?"Line":"Block",d={type:c,value:l.value};if(l.range&&(d.range=l.range),l.loc&&(d.loc=l.loc),this.comments.push(d),this.attach){var f={comment:{type:c,value:l.value,range:[u.start.offset,u.end.offset]},start:u.start.offset};l.loc&&(f.comment.loc=l.loc),l.type=c,this.leading.push(f),this.trailing.push(f)}},a.prototype.visit=function(l,u){l.type==="LineComment"?this.visitComment(l,u):l.type==="BlockComment"?this.visitComment(l,u):this.attach&&this.visitNode(l,u)},a}();n.CommentHandler=s},function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.Syntax={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForOfStatement:"ForOfStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"}},function(e,n,r){var o=this&&this.__extends||function(){var m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,O){v.__proto__=O}||function(v,O){for(var b in O)O.hasOwnProperty(b)&&(v[b]=O[b])};return function(v,O){m(v,O);function b(){this.constructor=v}v.prototype=O===null?Object.create(O):(b.prototype=O.prototype,new b)}}();Object.defineProperty(n,"__esModule",{value:!0});var s=r(4),a=r(5),l=r(6),u=r(7),c=r(8),d=r(13),f=r(14);d.TokenName[100]="JSXIdentifier",d.TokenName[101]="JSXText";function g(m){var v;switch(m.type){case l.JSXSyntax.JSXIdentifier:var O=m;v=O.name;break;case l.JSXSyntax.JSXNamespacedName:var b=m;v=g(b.namespace)+":"+g(b.name);break;case l.JSXSyntax.JSXMemberExpression:var k=m;v=g(k.object)+"."+g(k.property);break}return v}var x=function(m){o(v,m);function v(O,b,k){return m.call(this,O,b,k)||this}return v.prototype.parsePrimaryExpression=function(){return this.match("<")?this.parseJSXRoot():m.prototype.parsePrimaryExpression.call(this)},v.prototype.startJSX=function(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.line,this.scanner.lineStart=this.startMarker.index-this.startMarker.column},v.prototype.finishJSX=function(){this.nextToken()},v.prototype.reenterJSX=function(){this.startJSX(),this.expectJSX("}"),this.config.tokens&&this.tokens.pop()},v.prototype.createJSXNode=function(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},v.prototype.createJSXChildNode=function(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},v.prototype.scanXHTMLEntity=function(O){for(var b="&",k=!0,E=!1,$=!1,Q=!1;!this.scanner.eof()&&k&&!E;){var X=this.scanner.source[this.scanner.index];if(X===O)break;if(E=X===";",b+=X,++this.scanner.index,!E)switch(b.length){case 2:$=X==="#";break;case 3:$&&(Q=X==="x",k=Q||s.Character.isDecimalDigit(X.charCodeAt(0)),$=$&&!Q);break;default:k=k&&!($&&!s.Character.isDecimalDigit(X.charCodeAt(0))),k=k&&!(Q&&!s.Character.isHexDigit(X.charCodeAt(0)));break}}if(k&&E&&b.length>2){var R=b.substr(1,b.length-2);$&&R.length>1?b=String.fromCharCode(parseInt(R.substr(1),10)):Q&&R.length>2?b=String.fromCharCode(parseInt("0"+R.substr(1),16)):!$&&!Q&&f.XHTMLEntities[R]&&(b=f.XHTMLEntities[R])}return b},v.prototype.lexJSX=function(){var O=this.scanner.source.charCodeAt(this.scanner.index);if(O===60||O===62||O===47||O===58||O===61||O===123||O===125){var b=this.scanner.source[this.scanner.index++];return{type:7,value:b,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index}}if(O===34||O===39){for(var k=this.scanner.index,E=this.scanner.source[this.scanner.index++],$="";!this.scanner.eof();){var Q=this.scanner.source[this.scanner.index++];if(Q===E)break;Q==="&"?$+=this.scanXHTMLEntity(E):$+=Q}return{type:8,value:$,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:k,end:this.scanner.index}}if(O===46){var X=this.scanner.source.charCodeAt(this.scanner.index+1),R=this.scanner.source.charCodeAt(this.scanner.index+2),b=X===46&&R===46?"...":".",k=this.scanner.index;return this.scanner.index+=b.length,{type:7,value:b,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:k,end:this.scanner.index}}if(O===96)return{type:10,value:"",lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index,end:this.scanner.index};if(s.Character.isIdentifierStart(O)&&O!==92){var k=this.scanner.index;for(++this.scanner.index;!this.scanner.eof();){var Q=this.scanner.source.charCodeAt(this.scanner.index);if(s.Character.isIdentifierPart(Q)&&Q!==92)++this.scanner.index;else if(Q===45)++this.scanner.index;else break}var W=this.scanner.source.slice(k,this.scanner.index);return{type:100,value:W,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:k,end:this.scanner.index}}return this.scanner.lex()},v.prototype.nextJSXToken=function(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;var O=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(O)),O},v.prototype.nextJSXText=function(){this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;for(var O=this.scanner.index,b="";!this.scanner.eof();){var k=this.scanner.source[this.scanner.index];if(k==="{"||k==="<")break;++this.scanner.index,b+=k,s.Character.isLineTerminator(k.charCodeAt(0))&&(++this.scanner.lineNumber,k==="\r"&&this.scanner.source[this.scanner.index]===` +`&&++this.scanner.index,this.scanner.lineStart=this.scanner.index)}this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart;var E={type:101,value:b,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:O,end:this.scanner.index};return b.length>0&&this.config.tokens&&this.tokens.push(this.convertToken(E)),E},v.prototype.peekJSXToken=function(){var O=this.scanner.saveState();this.scanner.scanComments();var b=this.lexJSX();return this.scanner.restoreState(O),b},v.prototype.expectJSX=function(O){var b=this.nextJSXToken();(b.type!==7||b.value!==O)&&this.throwUnexpectedToken(b)},v.prototype.matchJSX=function(O){var b=this.peekJSXToken();return b.type===7&&b.value===O},v.prototype.parseJSXIdentifier=function(){var O=this.createJSXNode(),b=this.nextJSXToken();return b.type!==100&&this.throwUnexpectedToken(b),this.finalize(O,new a.JSXIdentifier(b.value))},v.prototype.parseJSXElementName=function(){var O=this.createJSXNode(),b=this.parseJSXIdentifier();if(this.matchJSX(":")){var k=b;this.expectJSX(":");var E=this.parseJSXIdentifier();b=this.finalize(O,new a.JSXNamespacedName(k,E))}else if(this.matchJSX("."))for(;this.matchJSX(".");){var $=b;this.expectJSX(".");var Q=this.parseJSXIdentifier();b=this.finalize(O,new a.JSXMemberExpression($,Q))}return b},v.prototype.parseJSXAttributeName=function(){var O=this.createJSXNode(),b,k=this.parseJSXIdentifier();if(this.matchJSX(":")){var E=k;this.expectJSX(":");var $=this.parseJSXIdentifier();b=this.finalize(O,new a.JSXNamespacedName(E,$))}else b=k;return b},v.prototype.parseJSXStringLiteralAttribute=function(){var O=this.createJSXNode(),b=this.nextJSXToken();b.type!==8&&this.throwUnexpectedToken(b);var k=this.getTokenRaw(b);return this.finalize(O,new u.Literal(b.value,k))},v.prototype.parseJSXExpressionAttribute=function(){var O=this.createJSXNode();this.expectJSX("{"),this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression");var b=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(O,new a.JSXExpressionContainer(b))},v.prototype.parseJSXAttributeValue=function(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()},v.prototype.parseJSXNameValueAttribute=function(){var O=this.createJSXNode(),b=this.parseJSXAttributeName(),k=null;return this.matchJSX("=")&&(this.expectJSX("="),k=this.parseJSXAttributeValue()),this.finalize(O,new a.JSXAttribute(b,k))},v.prototype.parseJSXSpreadAttribute=function(){var O=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();var b=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(O,new a.JSXSpreadAttribute(b))},v.prototype.parseJSXAttributes=function(){for(var O=[];!this.matchJSX("/")&&!this.matchJSX(">");){var b=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute();O.push(b)}return O},v.prototype.parseJSXOpeningElement=function(){var O=this.createJSXNode();this.expectJSX("<");var b=this.parseJSXElementName(),k=this.parseJSXAttributes(),E=this.matchJSX("/");return E&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(O,new a.JSXOpeningElement(b,E,k))},v.prototype.parseJSXBoundaryElement=function(){var O=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){this.expectJSX("/");var b=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(O,new a.JSXClosingElement(b))}var k=this.parseJSXElementName(),E=this.parseJSXAttributes(),$=this.matchJSX("/");return $&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(O,new a.JSXOpeningElement(k,$,E))},v.prototype.parseJSXEmptyExpression=function(){var O=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.finalize(O,new a.JSXEmptyExpression)},v.prototype.parseJSXExpressionContainer=function(){var O=this.createJSXNode();this.expectJSX("{");var b;return this.matchJSX("}")?(b=this.parseJSXEmptyExpression(),this.expectJSX("}")):(this.finishJSX(),b=this.parseAssignmentExpression(),this.reenterJSX()),this.finalize(O,new a.JSXExpressionContainer(b))},v.prototype.parseJSXChildren=function(){for(var O=[];!this.scanner.eof();){var b=this.createJSXChildNode(),k=this.nextJSXText();if(k.start0){var Q=this.finalize(O.node,new a.JSXElement(O.opening,O.children,O.closing));O=b[b.length-1],O.children.push(Q),b.pop()}else break}}return O},v.prototype.parseJSXElement=function(){var O=this.createJSXNode(),b=this.parseJSXOpeningElement(),k=[],E=null;if(!b.selfClosing){var $=this.parseComplexJSXElement({node:O,opening:b,closing:E,children:k});k=$.children,E=$.closing}return this.finalize(O,new a.JSXElement(b,k,E))},v.prototype.parseJSXRoot=function(){this.config.tokens&&this.tokens.pop(),this.startJSX();var O=this.parseJSXElement();return this.finishJSX(),O},v.prototype.isStartOfExpression=function(){return m.prototype.isStartOfExpression.call(this)||this.match("<")},v}(c.Parser);n.JSXParser=x},function(e,n){Object.defineProperty(n,"__esModule",{value:!0});var r={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/};n.Character={fromCodePoint:function(o){return o<65536?String.fromCharCode(o):String.fromCharCode(55296+(o-65536>>10))+String.fromCharCode(56320+(o-65536&1023))},isWhiteSpace:function(o){return o===32||o===9||o===11||o===12||o===160||o>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(o)>=0},isLineTerminator:function(o){return o===10||o===13||o===8232||o===8233},isIdentifierStart:function(o){return o===36||o===95||o>=65&&o<=90||o>=97&&o<=122||o===92||o>=128&&r.NonAsciiIdentifierStart.test(n.Character.fromCodePoint(o))},isIdentifierPart:function(o){return o===36||o===95||o>=65&&o<=90||o>=97&&o<=122||o>=48&&o<=57||o===92||o>=128&&r.NonAsciiIdentifierPart.test(n.Character.fromCodePoint(o))},isDecimalDigit:function(o){return o>=48&&o<=57},isHexDigit:function(o){return o>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102},isOctalDigit:function(o){return o>=48&&o<=55}}},function(e,n,r){Object.defineProperty(n,"__esModule",{value:!0});var o=r(6),s=function(){function O(b){this.type=o.JSXSyntax.JSXClosingElement,this.name=b}return O}();n.JSXClosingElement=s;var a=function(){function O(b,k,E){this.type=o.JSXSyntax.JSXElement,this.openingElement=b,this.children=k,this.closingElement=E}return O}();n.JSXElement=a;var l=function(){function O(){this.type=o.JSXSyntax.JSXEmptyExpression}return O}();n.JSXEmptyExpression=l;var u=function(){function O(b){this.type=o.JSXSyntax.JSXExpressionContainer,this.expression=b}return O}();n.JSXExpressionContainer=u;var c=function(){function O(b){this.type=o.JSXSyntax.JSXIdentifier,this.name=b}return O}();n.JSXIdentifier=c;var d=function(){function O(b,k){this.type=o.JSXSyntax.JSXMemberExpression,this.object=b,this.property=k}return O}();n.JSXMemberExpression=d;var f=function(){function O(b,k){this.type=o.JSXSyntax.JSXAttribute,this.name=b,this.value=k}return O}();n.JSXAttribute=f;var g=function(){function O(b,k){this.type=o.JSXSyntax.JSXNamespacedName,this.namespace=b,this.name=k}return O}();n.JSXNamespacedName=g;var x=function(){function O(b,k,E){this.type=o.JSXSyntax.JSXOpeningElement,this.name=b,this.selfClosing=k,this.attributes=E}return O}();n.JSXOpeningElement=x;var m=function(){function O(b){this.type=o.JSXSyntax.JSXSpreadAttribute,this.argument=b}return O}();n.JSXSpreadAttribute=m;var v=function(){function O(b,k){this.type=o.JSXSyntax.JSXText,this.value=b,this.raw=k}return O}();n.JSXText=v},function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.JSXSyntax={JSXAttribute:"JSXAttribute",JSXClosingElement:"JSXClosingElement",JSXElement:"JSXElement",JSXEmptyExpression:"JSXEmptyExpression",JSXExpressionContainer:"JSXExpressionContainer",JSXIdentifier:"JSXIdentifier",JSXMemberExpression:"JSXMemberExpression",JSXNamespacedName:"JSXNamespacedName",JSXOpeningElement:"JSXOpeningElement",JSXSpreadAttribute:"JSXSpreadAttribute",JSXText:"JSXText"}},function(e,n,r){Object.defineProperty(n,"__esModule",{value:!0});var o=r(2),s=function(){function st(dt){this.type=o.Syntax.ArrayExpression,this.elements=dt}return st}();n.ArrayExpression=s;var a=function(){function st(dt){this.type=o.Syntax.ArrayPattern,this.elements=dt}return st}();n.ArrayPattern=a;var l=function(){function st(dt,Lt,ne){this.type=o.Syntax.ArrowFunctionExpression,this.id=null,this.params=dt,this.body=Lt,this.generator=!1,this.expression=ne,this.async=!1}return st}();n.ArrowFunctionExpression=l;var u=function(){function st(dt,Lt,ne){this.type=o.Syntax.AssignmentExpression,this.operator=dt,this.left=Lt,this.right=ne}return st}();n.AssignmentExpression=u;var c=function(){function st(dt,Lt){this.type=o.Syntax.AssignmentPattern,this.left=dt,this.right=Lt}return st}();n.AssignmentPattern=c;var d=function(){function st(dt,Lt,ne){this.type=o.Syntax.ArrowFunctionExpression,this.id=null,this.params=dt,this.body=Lt,this.generator=!1,this.expression=ne,this.async=!0}return st}();n.AsyncArrowFunctionExpression=d;var f=function(){function st(dt,Lt,ne){this.type=o.Syntax.FunctionDeclaration,this.id=dt,this.params=Lt,this.body=ne,this.generator=!1,this.expression=!1,this.async=!0}return st}();n.AsyncFunctionDeclaration=f;var g=function(){function st(dt,Lt,ne){this.type=o.Syntax.FunctionExpression,this.id=dt,this.params=Lt,this.body=ne,this.generator=!1,this.expression=!1,this.async=!0}return st}();n.AsyncFunctionExpression=g;var x=function(){function st(dt){this.type=o.Syntax.AwaitExpression,this.argument=dt}return st}();n.AwaitExpression=x;var m=function(){function st(dt,Lt,ne){var ei=dt==="||"||dt==="&&";this.type=ei?o.Syntax.LogicalExpression:o.Syntax.BinaryExpression,this.operator=dt,this.left=Lt,this.right=ne}return st}();n.BinaryExpression=m;var v=function(){function st(dt){this.type=o.Syntax.BlockStatement,this.body=dt}return st}();n.BlockStatement=v;var O=function(){function st(dt){this.type=o.Syntax.BreakStatement,this.label=dt}return st}();n.BreakStatement=O;var b=function(){function st(dt,Lt){this.type=o.Syntax.CallExpression,this.callee=dt,this.arguments=Lt}return st}();n.CallExpression=b;var k=function(){function st(dt,Lt){this.type=o.Syntax.CatchClause,this.param=dt,this.body=Lt}return st}();n.CatchClause=k;var E=function(){function st(dt){this.type=o.Syntax.ClassBody,this.body=dt}return st}();n.ClassBody=E;var $=function(){function st(dt,Lt,ne){this.type=o.Syntax.ClassDeclaration,this.id=dt,this.superClass=Lt,this.body=ne}return st}();n.ClassDeclaration=$;var Q=function(){function st(dt,Lt,ne){this.type=o.Syntax.ClassExpression,this.id=dt,this.superClass=Lt,this.body=ne}return st}();n.ClassExpression=Q;var X=function(){function st(dt,Lt){this.type=o.Syntax.MemberExpression,this.computed=!0,this.object=dt,this.property=Lt}return st}();n.ComputedMemberExpression=X;var R=function(){function st(dt,Lt,ne){this.type=o.Syntax.ConditionalExpression,this.test=dt,this.consequent=Lt,this.alternate=ne}return st}();n.ConditionalExpression=R;var W=function(){function st(dt){this.type=o.Syntax.ContinueStatement,this.label=dt}return st}();n.ContinueStatement=W;var D=function(){function st(){this.type=o.Syntax.DebuggerStatement}return st}();n.DebuggerStatement=D;var z=function(){function st(dt,Lt){this.type=o.Syntax.ExpressionStatement,this.expression=dt,this.directive=Lt}return st}();n.Directive=z;var N=function(){function st(dt,Lt){this.type=o.Syntax.DoWhileStatement,this.body=dt,this.test=Lt}return st}();n.DoWhileStatement=N;var U=function(){function st(){this.type=o.Syntax.EmptyStatement}return st}();n.EmptyStatement=U;var T=function(){function st(dt){this.type=o.Syntax.ExportAllDeclaration,this.source=dt}return st}();n.ExportAllDeclaration=T;var H=function(){function st(dt){this.type=o.Syntax.ExportDefaultDeclaration,this.declaration=dt}return st}();n.ExportDefaultDeclaration=H;var gt=function(){function st(dt,Lt,ne){this.type=o.Syntax.ExportNamedDeclaration,this.declaration=dt,this.specifiers=Lt,this.source=ne}return st}();n.ExportNamedDeclaration=gt;var at=function(){function st(dt,Lt){this.type=o.Syntax.ExportSpecifier,this.exported=Lt,this.local=dt}return st}();n.ExportSpecifier=at;var Et=function(){function st(dt){this.type=o.Syntax.ExpressionStatement,this.expression=dt}return st}();n.ExpressionStatement=Et;var pt=function(){function st(dt,Lt,ne){this.type=o.Syntax.ForInStatement,this.left=dt,this.right=Lt,this.body=ne,this.each=!1}return st}();n.ForInStatement=pt;var Pt=function(){function st(dt,Lt,ne){this.type=o.Syntax.ForOfStatement,this.left=dt,this.right=Lt,this.body=ne}return st}();n.ForOfStatement=Pt;var nt=function(){function st(dt,Lt,ne,ei){this.type=o.Syntax.ForStatement,this.init=dt,this.test=Lt,this.update=ne,this.body=ei}return st}();n.ForStatement=nt;var it=function(){function st(dt,Lt,ne,ei){this.type=o.Syntax.FunctionDeclaration,this.id=dt,this.params=Lt,this.body=ne,this.generator=ei,this.expression=!1,this.async=!1}return st}();n.FunctionDeclaration=it;var It=function(){function st(dt,Lt,ne,ei){this.type=o.Syntax.FunctionExpression,this.id=dt,this.params=Lt,this.body=ne,this.generator=ei,this.expression=!1,this.async=!1}return st}();n.FunctionExpression=It;var kt=function(){function st(dt){this.type=o.Syntax.Identifier,this.name=dt}return st}();n.Identifier=kt;var xt=function(){function st(dt,Lt,ne){this.type=o.Syntax.IfStatement,this.test=dt,this.consequent=Lt,this.alternate=ne}return st}();n.IfStatement=xt;var Kt=function(){function st(dt,Lt){this.type=o.Syntax.ImportDeclaration,this.specifiers=dt,this.source=Lt}return st}();n.ImportDeclaration=Kt;var Ct=function(){function st(dt){this.type=o.Syntax.ImportDefaultSpecifier,this.local=dt}return st}();n.ImportDefaultSpecifier=Ct;var Wt=function(){function st(dt){this.type=o.Syntax.ImportNamespaceSpecifier,this.local=dt}return st}();n.ImportNamespaceSpecifier=Wt;var Yt=function(){function st(dt,Lt){this.type=o.Syntax.ImportSpecifier,this.local=dt,this.imported=Lt}return st}();n.ImportSpecifier=Yt;var te=function(){function st(dt,Lt){this.type=o.Syntax.LabeledStatement,this.label=dt,this.body=Lt}return st}();n.LabeledStatement=te;var Jt=function(){function st(dt,Lt){this.type=o.Syntax.Literal,this.value=dt,this.raw=Lt}return st}();n.Literal=Jt;var xe=function(){function st(dt,Lt){this.type=o.Syntax.MetaProperty,this.meta=dt,this.property=Lt}return st}();n.MetaProperty=xe;var oe=function(){function st(dt,Lt,ne,ei,$n){this.type=o.Syntax.MethodDefinition,this.key=dt,this.computed=Lt,this.value=ne,this.kind=ei,this.static=$n}return st}();n.MethodDefinition=oe;var B=function(){function st(dt){this.type=o.Syntax.Program,this.body=dt,this.sourceType="module"}return st}();n.Module=B;var ut=function(){function st(dt,Lt){this.type=o.Syntax.NewExpression,this.callee=dt,this.arguments=Lt}return st}();n.NewExpression=ut;var ft=function(){function st(dt){this.type=o.Syntax.ObjectExpression,this.properties=dt}return st}();n.ObjectExpression=ft;var G=function(){function st(dt){this.type=o.Syntax.ObjectPattern,this.properties=dt}return st}();n.ObjectPattern=G;var V=function(){function st(dt,Lt,ne,ei,$n,_s){this.type=o.Syntax.Property,this.key=Lt,this.computed=ne,this.value=ei,this.kind=dt,this.method=$n,this.shorthand=_s}return st}();n.Property=V;var rt=function(){function st(dt,Lt,ne,ei){this.type=o.Syntax.Literal,this.value=dt,this.raw=Lt,this.regex={pattern:ne,flags:ei}}return st}();n.RegexLiteral=rt;var bt=function(){function st(dt){this.type=o.Syntax.RestElement,this.argument=dt}return st}();n.RestElement=bt;var wt=function(){function st(dt){this.type=o.Syntax.ReturnStatement,this.argument=dt}return st}();n.ReturnStatement=wt;var ot=function(){function st(dt){this.type=o.Syntax.Program,this.body=dt,this.sourceType="script"}return st}();n.Script=ot;var Dt=function(){function st(dt){this.type=o.Syntax.SequenceExpression,this.expressions=dt}return st}();n.SequenceExpression=Dt;var Xt=function(){function st(dt){this.type=o.Syntax.SpreadElement,this.argument=dt}return st}();n.SpreadElement=Xt;var Tt=function(){function st(dt,Lt){this.type=o.Syntax.MemberExpression,this.computed=!1,this.object=dt,this.property=Lt}return st}();n.StaticMemberExpression=Tt;var qt=function(){function st(){this.type=o.Syntax.Super}return st}();n.Super=qt;var fe=function(){function st(dt,Lt){this.type=o.Syntax.SwitchCase,this.test=dt,this.consequent=Lt}return st}();n.SwitchCase=fe;var ae=function(){function st(dt,Lt){this.type=o.Syntax.SwitchStatement,this.discriminant=dt,this.cases=Lt}return st}();n.SwitchStatement=ae;var be=function(){function st(dt,Lt){this.type=o.Syntax.TaggedTemplateExpression,this.tag=dt,this.quasi=Lt}return st}();n.TaggedTemplateExpression=be;var wi=function(){function st(dt,Lt){this.type=o.Syntax.TemplateElement,this.value=dt,this.tail=Lt}return st}();n.TemplateElement=wi;var pe=function(){function st(dt,Lt){this.type=o.Syntax.TemplateLiteral,this.quasis=dt,this.expressions=Lt}return st}();n.TemplateLiteral=pe;var Vi=function(){function st(){this.type=o.Syntax.ThisExpression}return st}();n.ThisExpression=Vi;var Ae=function(){function st(dt){this.type=o.Syntax.ThrowStatement,this.argument=dt}return st}();n.ThrowStatement=Ae;var sn=function(){function st(dt,Lt,ne){this.type=o.Syntax.TryStatement,this.block=dt,this.handler=Lt,this.finalizer=ne}return st}();n.TryStatement=sn;var on=function(){function st(dt,Lt){this.type=o.Syntax.UnaryExpression,this.operator=dt,this.argument=Lt,this.prefix=!0}return st}();n.UnaryExpression=on;var le=function(){function st(dt,Lt,ne){this.type=o.Syntax.UpdateExpression,this.operator=dt,this.argument=Lt,this.prefix=ne}return st}();n.UpdateExpression=le;var Ze=function(){function st(dt,Lt){this.type=o.Syntax.VariableDeclaration,this.declarations=dt,this.kind=Lt}return st}();n.VariableDeclaration=Ze;var Le=function(){function st(dt,Lt){this.type=o.Syntax.VariableDeclarator,this.id=dt,this.init=Lt}return st}();n.VariableDeclarator=Le;var We=function(){function st(dt,Lt){this.type=o.Syntax.WhileStatement,this.test=dt,this.body=Lt}return st}();n.WhileStatement=We;var ui=function(){function st(dt,Lt){this.type=o.Syntax.WithStatement,this.object=dt,this.body=Lt}return st}();n.WithStatement=ui;var wn=function(){function st(dt,Lt){this.type=o.Syntax.YieldExpression,this.argument=dt,this.delegate=Lt}return st}();n.YieldExpression=wn},function(e,n,r){Object.defineProperty(n,"__esModule",{value:!0});var o=r(9),s=r(10),a=r(11),l=r(7),u=r(12),c=r(2),d=r(13),f="ArrowParameterPlaceHolder",g=function(){function x(m,v,O){v===void 0&&(v={}),this.config={range:typeof v.range=="boolean"&&v.range,loc:typeof v.loc=="boolean"&&v.loc,source:null,tokens:typeof v.tokens=="boolean"&&v.tokens,comment:typeof v.comment=="boolean"&&v.comment,tolerant:typeof v.tolerant=="boolean"&&v.tolerant},this.config.loc&&v.source&&v.source!==null&&(this.config.source=String(v.source)),this.delegate=O,this.errorHandler=new s.ErrorHandler,this.errorHandler.tolerant=this.config.tolerant,this.scanner=new u.Scanner(m,this.errorHandler),this.scanner.trackComment=this.config.comment,this.operatorPrecedence={")":0,";":0,",":0,"=":0,"]":0,"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":11,"/":11,"%":11},this.lookahead={type:2,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0},this.hasLineTerminator=!1,this.context={isModule:!1,await:!1,allowIn:!0,allowStrictDirective:!0,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,labelSet:{},strict:!1},this.tokens=[],this.startMarker={index:0,line:this.scanner.lineNumber,column:0},this.lastMarker={index:0,line:this.scanner.lineNumber,column:0},this.nextToken(),this.lastMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}return x.prototype.throwError=function(m){var v=Array.prototype.slice.call(arguments,1),O=m.replace(/%(\d)/g,function($,Q){return o.assert(Q0&&this.delegate)for(var v=0;v>="||m===">>>="||m==="&="||m==="^="||m==="|="},x.prototype.isolateCoverGrammar=function(m){var v=this.context.isBindingElement,O=this.context.isAssignmentTarget,b=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var k=m.call(this);return this.context.firstCoverInitializedNameError!==null&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=v,this.context.isAssignmentTarget=O,this.context.firstCoverInitializedNameError=b,k},x.prototype.inheritCoverGrammar=function(m){var v=this.context.isBindingElement,O=this.context.isAssignmentTarget,b=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var k=m.call(this);return this.context.isBindingElement=this.context.isBindingElement&&v,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&O,this.context.firstCoverInitializedNameError=b||this.context.firstCoverInitializedNameError,k},x.prototype.consumeSemicolon=function(){this.match(";")?this.nextToken():this.hasLineTerminator||(this.lookahead.type!==2&&!this.match("}")&&this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.line=this.startMarker.line,this.lastMarker.column=this.startMarker.column)},x.prototype.parsePrimaryExpression=function(){var m=this.createNode(),v,O,b;switch(this.lookahead.type){case 3:(this.context.isModule||this.context.await)&&this.lookahead.value==="await"&&this.tolerateUnexpectedToken(this.lookahead),v=this.matchAsyncFunction()?this.parseFunctionExpression():this.finalize(m,new l.Identifier(this.nextToken().value));break;case 6:case 8:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,a.Messages.StrictOctalLiteral),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,O=this.nextToken(),b=this.getTokenRaw(O),v=this.finalize(m,new l.Literal(O.value,b));break;case 1:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,O=this.nextToken(),b=this.getTokenRaw(O),v=this.finalize(m,new l.Literal(O.value==="true",b));break;case 5:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,O=this.nextToken(),b=this.getTokenRaw(O),v=this.finalize(m,new l.Literal(null,b));break;case 10:v=this.parseTemplateLiteral();break;case 7:switch(this.lookahead.value){case"(":this.context.isBindingElement=!1,v=this.inheritCoverGrammar(this.parseGroupExpression);break;case"[":v=this.inheritCoverGrammar(this.parseArrayInitializer);break;case"{":v=this.inheritCoverGrammar(this.parseObjectInitializer);break;case"/":case"/=":this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,O=this.nextRegexToken(),b=this.getTokenRaw(O),v=this.finalize(m,new l.RegexLiteral(O.regex,b,O.pattern,O.flags));break;default:v=this.throwUnexpectedToken(this.nextToken())}break;case 4:!this.context.strict&&this.context.allowYield&&this.matchKeyword("yield")?v=this.parseIdentifierName():!this.context.strict&&this.matchKeyword("let")?v=this.finalize(m,new l.Identifier(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword("function")?v=this.parseFunctionExpression():this.matchKeyword("this")?(this.nextToken(),v=this.finalize(m,new l.ThisExpression)):this.matchKeyword("class")?v=this.parseClassExpression():v=this.throwUnexpectedToken(this.nextToken()));break;default:v=this.throwUnexpectedToken(this.nextToken())}return v},x.prototype.parseSpreadElement=function(){var m=this.createNode();this.expect("...");var v=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(m,new l.SpreadElement(v))},x.prototype.parseArrayInitializer=function(){var m=this.createNode(),v=[];for(this.expect("[");!this.match("]");)if(this.match(","))this.nextToken(),v.push(null);else if(this.match("...")){var O=this.parseSpreadElement();this.match("]")||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(",")),v.push(O)}else v.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match("]")||this.expect(",");return this.expect("]"),this.finalize(m,new l.ArrayExpression(v))},x.prototype.parsePropertyMethod=function(m){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var v=this.context.strict,O=this.context.allowStrictDirective;this.context.allowStrictDirective=m.simple;var b=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&m.firstRestricted&&this.tolerateUnexpectedToken(m.firstRestricted,m.message),this.context.strict&&m.stricted&&this.tolerateUnexpectedToken(m.stricted,m.message),this.context.strict=v,this.context.allowStrictDirective=O,b},x.prototype.parsePropertyMethodFunction=function(){var m=!1,v=this.createNode(),O=this.context.allowYield;this.context.allowYield=!0;var b=this.parseFormalParameters(),k=this.parsePropertyMethod(b);return this.context.allowYield=O,this.finalize(v,new l.FunctionExpression(null,b.params,k,m))},x.prototype.parsePropertyMethodAsyncFunction=function(){var m=this.createNode(),v=this.context.allowYield,O=this.context.await;this.context.allowYield=!1,this.context.await=!0;var b=this.parseFormalParameters(),k=this.parsePropertyMethod(b);return this.context.allowYield=v,this.context.await=O,this.finalize(m,new l.AsyncFunctionExpression(null,b.params,k))},x.prototype.parseObjectPropertyKey=function(){var m=this.createNode(),v=this.nextToken(),O;switch(v.type){case 8:case 6:this.context.strict&&v.octal&&this.tolerateUnexpectedToken(v,a.Messages.StrictOctalLiteral);var b=this.getTokenRaw(v);O=this.finalize(m,new l.Literal(v.value,b));break;case 3:case 1:case 5:case 4:O=this.finalize(m,new l.Identifier(v.value));break;case 7:v.value==="["?(O=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect("]")):O=this.throwUnexpectedToken(v);break;default:O=this.throwUnexpectedToken(v)}return O},x.prototype.isPropertyKey=function(m,v){return m.type===c.Syntax.Identifier&&m.name===v||m.type===c.Syntax.Literal&&m.value===v},x.prototype.parseObjectProperty=function(m){var v=this.createNode(),O=this.lookahead,b,k=null,E=null,$=!1,Q=!1,X=!1,R=!1;if(O.type===3){var W=O.value;this.nextToken(),$=this.match("["),R=!this.hasLineTerminator&&W==="async"&&!this.match(":")&&!this.match("(")&&!this.match("*")&&!this.match(","),k=R?this.parseObjectPropertyKey():this.finalize(v,new l.Identifier(W))}else this.match("*")?this.nextToken():($=this.match("["),k=this.parseObjectPropertyKey());var D=this.qualifiedPropertyName(this.lookahead);if(O.type===3&&!R&&O.value==="get"&&D)b="get",$=this.match("["),k=this.parseObjectPropertyKey(),this.context.allowYield=!1,E=this.parseGetterMethod();else if(O.type===3&&!R&&O.value==="set"&&D)b="set",$=this.match("["),k=this.parseObjectPropertyKey(),E=this.parseSetterMethod();else if(O.type===7&&O.value==="*"&&D)b="init",$=this.match("["),k=this.parseObjectPropertyKey(),E=this.parseGeneratorMethod(),Q=!0;else if(k||this.throwUnexpectedToken(this.lookahead),b="init",this.match(":")&&!R)!$&&this.isPropertyKey(k,"__proto__")&&(m.value&&this.tolerateError(a.Messages.DuplicateProtoProperty),m.value=!0),this.nextToken(),E=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match("("))E=R?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),Q=!0;else if(O.type===3){var W=this.finalize(v,new l.Identifier(O.value));if(this.match("=")){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),X=!0;var z=this.isolateCoverGrammar(this.parseAssignmentExpression);E=this.finalize(v,new l.AssignmentPattern(W,z))}else X=!0,E=W}else this.throwUnexpectedToken(this.nextToken());return this.finalize(v,new l.Property(b,k,$,E,Q,X))},x.prototype.parseObjectInitializer=function(){var m=this.createNode();this.expect("{");for(var v=[],O={value:!1};!this.match("}");)v.push(this.parseObjectProperty(O)),this.match("}")||this.expectCommaSeparator();return this.expect("}"),this.finalize(m,new l.ObjectExpression(v))},x.prototype.parseTemplateHead=function(){o.assert(this.lookahead.head,"Template literal must start with a template head");var m=this.createNode(),v=this.nextToken(),O=v.value,b=v.cooked;return this.finalize(m,new l.TemplateElement({raw:O,cooked:b},v.tail))},x.prototype.parseTemplateElement=function(){this.lookahead.type!==10&&this.throwUnexpectedToken();var m=this.createNode(),v=this.nextToken(),O=v.value,b=v.cooked;return this.finalize(m,new l.TemplateElement({raw:O,cooked:b},v.tail))},x.prototype.parseTemplateLiteral=function(){var m=this.createNode(),v=[],O=[],b=this.parseTemplateHead();for(O.push(b);!b.tail;)v.push(this.parseExpression()),b=this.parseTemplateElement(),O.push(b);return this.finalize(m,new l.TemplateLiteral(O,v))},x.prototype.reinterpretExpressionAsPattern=function(m){switch(m.type){case c.Syntax.Identifier:case c.Syntax.MemberExpression:case c.Syntax.RestElement:case c.Syntax.AssignmentPattern:break;case c.Syntax.SpreadElement:m.type=c.Syntax.RestElement,this.reinterpretExpressionAsPattern(m.argument);break;case c.Syntax.ArrayExpression:m.type=c.Syntax.ArrayPattern;for(var v=0;v")||this.expect("=>"),m={type:f,params:[],async:!1};else{var v=this.lookahead,O=[];if(this.match("..."))m=this.parseRestElement(O),this.expect(")"),this.match("=>")||this.expect("=>"),m={type:f,params:[m],async:!1};else{var b=!1;if(this.context.isBindingElement=!0,m=this.inheritCoverGrammar(this.parseAssignmentExpression),this.match(",")){var k=[];for(this.context.isAssignmentTarget=!1,k.push(m);this.lookahead.type!==2&&this.match(",");){if(this.nextToken(),this.match(")")){this.nextToken();for(var E=0;E")||this.expect("=>"),this.context.isBindingElement=!1;for(var E=0;E")&&(m.type===c.Syntax.Identifier&&m.name==="yield"&&(b=!0,m={type:f,params:[m],async:!1}),!b)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),m.type===c.Syntax.SequenceExpression)for(var E=0;E")){for(var Q=0;Q<$.length;++Q)this.reinterpretExpressionAsPattern($[Q]);b={type:f,params:$,async:!0}}}else if(this.match("[")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!0,this.expect("[");var k=this.isolateCoverGrammar(this.parseExpression);this.expect("]"),b=this.finalize(this.startNode(m),new l.ComputedMemberExpression(b,k))}else if(this.lookahead.type===10&&this.lookahead.head){var X=this.parseTemplateLiteral();b=this.finalize(this.startNode(m),new l.TaggedTemplateExpression(b,X))}else break;return this.context.allowIn=O,b},x.prototype.parseSuper=function(){var m=this.createNode();return this.expectKeyword("super"),!this.match("[")&&!this.match(".")&&this.throwUnexpectedToken(this.lookahead),this.finalize(m,new l.Super)},x.prototype.parseLeftHandSideExpression=function(){o.assert(this.context.allowIn,"callee of new expression always allow in keyword.");for(var m=this.startNode(this.lookahead),v=this.matchKeyword("super")&&this.context.inFunctionBody?this.parseSuper():this.inheritCoverGrammar(this.matchKeyword("new")?this.parseNewExpression:this.parsePrimaryExpression);;)if(this.match("[")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!0,this.expect("[");var O=this.isolateCoverGrammar(this.parseExpression);this.expect("]"),v=this.finalize(m,new l.ComputedMemberExpression(v,O))}else if(this.match(".")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!0,this.expect(".");var O=this.parseIdentifierName();v=this.finalize(m,new l.StaticMemberExpression(v,O))}else if(this.lookahead.type===10&&this.lookahead.head){var b=this.parseTemplateLiteral();v=this.finalize(m,new l.TaggedTemplateExpression(v,b))}else break;return v},x.prototype.parseUpdateExpression=function(){var m,v=this.lookahead;if(this.match("++")||this.match("--")){var O=this.startNode(v),b=this.nextToken();m=this.inheritCoverGrammar(this.parseUnaryExpression),this.context.strict&&m.type===c.Syntax.Identifier&&this.scanner.isRestrictedWord(m.name)&&this.tolerateError(a.Messages.StrictLHSPrefix),this.context.isAssignmentTarget||this.tolerateError(a.Messages.InvalidLHSInAssignment);var k=!0;m=this.finalize(O,new l.UpdateExpression(b.value,m,k)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}else if(m=this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall),!this.hasLineTerminator&&this.lookahead.type===7&&(this.match("++")||this.match("--"))){this.context.strict&&m.type===c.Syntax.Identifier&&this.scanner.isRestrictedWord(m.name)&&this.tolerateError(a.Messages.StrictLHSPostfix),this.context.isAssignmentTarget||this.tolerateError(a.Messages.InvalidLHSInAssignment),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var E=this.nextToken().value,k=!1;m=this.finalize(this.startNode(v),new l.UpdateExpression(E,m,k))}return m},x.prototype.parseAwaitExpression=function(){var m=this.createNode();this.nextToken();var v=this.parseUnaryExpression();return this.finalize(m,new l.AwaitExpression(v))},x.prototype.parseUnaryExpression=function(){var m;if(this.match("+")||this.match("-")||this.match("~")||this.match("!")||this.matchKeyword("delete")||this.matchKeyword("void")||this.matchKeyword("typeof")){var v=this.startNode(this.lookahead),O=this.nextToken();m=this.inheritCoverGrammar(this.parseUnaryExpression),m=this.finalize(v,new l.UnaryExpression(O.value,m)),this.context.strict&&m.operator==="delete"&&m.argument.type===c.Syntax.Identifier&&this.tolerateError(a.Messages.StrictDelete),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}else this.context.await&&this.matchContextualKeyword("await")?m=this.parseAwaitExpression():m=this.parseUpdateExpression();return m},x.prototype.parseExponentiationExpression=function(){var m=this.lookahead,v=this.inheritCoverGrammar(this.parseUnaryExpression);if(v.type!==c.Syntax.UnaryExpression&&this.match("**")){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var O=v,b=this.isolateCoverGrammar(this.parseExponentiationExpression);v=this.finalize(this.startNode(m),new l.BinaryExpression("**",O,b))}return v},x.prototype.binaryPrecedence=function(m){var v=m.value,O;return m.type===7?O=this.operatorPrecedence[v]||0:m.type===4?O=v==="instanceof"||this.context.allowIn&&v==="in"?7:0:O=0,O},x.prototype.parseBinaryExpression=function(){var m=this.lookahead,v=this.inheritCoverGrammar(this.parseExponentiationExpression),O=this.lookahead,b=this.binaryPrecedence(O);if(b>0){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;for(var k=[m,this.lookahead],E=v,$=this.isolateCoverGrammar(this.parseExponentiationExpression),Q=[E,O.value,$],X=[b];b=this.binaryPrecedence(this.lookahead),!(b<=0);){for(;Q.length>2&&b<=X[X.length-1];){$=Q.pop();var R=Q.pop();X.pop(),E=Q.pop(),k.pop();var W=this.startNode(k[k.length-1]);Q.push(this.finalize(W,new l.BinaryExpression(R,E,$)))}Q.push(this.nextToken().value),X.push(b),k.push(this.lookahead),Q.push(this.isolateCoverGrammar(this.parseExponentiationExpression))}var D=Q.length-1;v=Q[D];for(var z=k.pop();D>1;){var N=k.pop(),U=z&&z.lineStart,W=this.startNode(N,U),R=Q[D-1];v=this.finalize(W,new l.BinaryExpression(R,Q[D-2],v)),D-=2,z=N}}return v},x.prototype.parseConditionalExpression=function(){var m=this.lookahead,v=this.inheritCoverGrammar(this.parseBinaryExpression);if(this.match("?")){this.nextToken();var O=this.context.allowIn;this.context.allowIn=!0;var b=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowIn=O,this.expect(":");var k=this.isolateCoverGrammar(this.parseAssignmentExpression);v=this.finalize(this.startNode(m),new l.ConditionalExpression(v,b,k)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return v},x.prototype.checkPatternParam=function(m,v){switch(v.type){case c.Syntax.Identifier:this.validateParam(m,v,v.name);break;case c.Syntax.RestElement:this.checkPatternParam(m,v.argument);break;case c.Syntax.AssignmentPattern:this.checkPatternParam(m,v.left);break;case c.Syntax.ArrayPattern:for(var O=0;O")){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var k=m.async,E=this.reinterpretAsCoverFormalsList(m);if(E){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;var $=this.context.strict,Q=this.context.allowStrictDirective;this.context.allowStrictDirective=E.simple;var X=this.context.allowYield,R=this.context.await;this.context.allowYield=!0,this.context.await=k;var W=this.startNode(v);this.expect("=>");var D=void 0;if(this.match("{")){var z=this.context.allowIn;this.context.allowIn=!0,D=this.parseFunctionSourceElements(),this.context.allowIn=z}else D=this.isolateCoverGrammar(this.parseAssignmentExpression);var N=D.type!==c.Syntax.BlockStatement;this.context.strict&&E.firstRestricted&&this.throwUnexpectedToken(E.firstRestricted,E.message),this.context.strict&&E.stricted&&this.tolerateUnexpectedToken(E.stricted,E.message),m=k?this.finalize(W,new l.AsyncArrowFunctionExpression(E.params,D,N)):this.finalize(W,new l.ArrowFunctionExpression(E.params,D,N)),this.context.strict=$,this.context.allowStrictDirective=Q,this.context.allowYield=X,this.context.await=R}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(a.Messages.InvalidLHSInAssignment),this.context.strict&&m.type===c.Syntax.Identifier){var U=m;this.scanner.isRestrictedWord(U.name)&&this.tolerateUnexpectedToken(O,a.Messages.StrictLHSAssignment),this.scanner.isStrictModeReservedWord(U.name)&&this.tolerateUnexpectedToken(O,a.Messages.StrictReservedWord)}this.match("=")?this.reinterpretExpressionAsPattern(m):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1),O=this.nextToken();var T=O.value,H=this.isolateCoverGrammar(this.parseAssignmentExpression);m=this.finalize(this.startNode(v),new l.AssignmentExpression(T,m,H)),this.context.firstCoverInitializedNameError=null}}return m},x.prototype.parseExpression=function(){var m=this.lookahead,v=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){var O=[];for(O.push(v);this.lookahead.type!==2&&this.match(",");)this.nextToken(),O.push(this.isolateCoverGrammar(this.parseAssignmentExpression));v=this.finalize(this.startNode(m),new l.SequenceExpression(O))}return v},x.prototype.parseStatementListItem=function(){var m;if(this.context.isAssignmentTarget=!0,this.context.isBindingElement=!0,this.lookahead.type===4)switch(this.lookahead.value){case"export":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,a.Messages.IllegalExportDeclaration),m=this.parseExportDeclaration();break;case"import":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,a.Messages.IllegalImportDeclaration),m=this.parseImportDeclaration();break;case"const":m=this.parseLexicalDeclaration({inFor:!1});break;case"function":m=this.parseFunctionDeclaration();break;case"class":m=this.parseClassDeclaration();break;case"let":m=this.isLexicalDeclaration()?this.parseLexicalDeclaration({inFor:!1}):this.parseStatement();break;default:m=this.parseStatement();break}else m=this.parseStatement();return m},x.prototype.parseBlock=function(){var m=this.createNode();this.expect("{");for(var v=[];!this.match("}");)v.push(this.parseStatementListItem());return this.expect("}"),this.finalize(m,new l.BlockStatement(v))},x.prototype.parseLexicalBinding=function(m,v){var O=this.createNode(),b=[],k=this.parsePattern(b,m);this.context.strict&&k.type===c.Syntax.Identifier&&this.scanner.isRestrictedWord(k.name)&&this.tolerateError(a.Messages.StrictVarName);var E=null;return m==="const"?!this.matchKeyword("in")&&!this.matchContextualKeyword("of")&&(this.match("=")?(this.nextToken(),E=this.isolateCoverGrammar(this.parseAssignmentExpression)):this.throwError(a.Messages.DeclarationMissingInitializer,"const")):(!v.inFor&&k.type!==c.Syntax.Identifier||this.match("="))&&(this.expect("="),E=this.isolateCoverGrammar(this.parseAssignmentExpression)),this.finalize(O,new l.VariableDeclarator(k,E))},x.prototype.parseBindingList=function(m,v){for(var O=[this.parseLexicalBinding(m,v)];this.match(",");)this.nextToken(),O.push(this.parseLexicalBinding(m,v));return O},x.prototype.isLexicalDeclaration=function(){var m=this.scanner.saveState();this.scanner.scanComments();var v=this.scanner.lex();return this.scanner.restoreState(m),v.type===3||v.type===7&&v.value==="["||v.type===7&&v.value==="{"||v.type===4&&v.value==="let"||v.type===4&&v.value==="yield"},x.prototype.parseLexicalDeclaration=function(m){var v=this.createNode(),O=this.nextToken().value;o.assert(O==="let"||O==="const","Lexical declaration must be either let or const");var b=this.parseBindingList(O,m);return this.consumeSemicolon(),this.finalize(v,new l.VariableDeclaration(b,O))},x.prototype.parseBindingRestElement=function(m,v){var O=this.createNode();this.expect("...");var b=this.parsePattern(m,v);return this.finalize(O,new l.RestElement(b))},x.prototype.parseArrayPattern=function(m,v){var O=this.createNode();this.expect("[");for(var b=[];!this.match("]");)if(this.match(","))this.nextToken(),b.push(null);else{if(this.match("...")){b.push(this.parseBindingRestElement(m,v));break}else b.push(this.parsePatternWithDefault(m,v));this.match("]")||this.expect(",")}return this.expect("]"),this.finalize(O,new l.ArrayPattern(b))},x.prototype.parsePropertyPattern=function(m,v){var O=this.createNode(),b=!1,k=!1,E=!1,$,Q;if(this.lookahead.type===3){var X=this.lookahead;$=this.parseVariableIdentifier();var R=this.finalize(O,new l.Identifier(X.value));if(this.match("=")){m.push(X),k=!0,this.nextToken();var W=this.parseAssignmentExpression();Q=this.finalize(this.startNode(X),new l.AssignmentPattern(R,W))}else this.match(":")?(this.expect(":"),Q=this.parsePatternWithDefault(m,v)):(m.push(X),k=!0,Q=R)}else b=this.match("["),$=this.parseObjectPropertyKey(),this.expect(":"),Q=this.parsePatternWithDefault(m,v);return this.finalize(O,new l.Property("init",$,b,Q,E,k))},x.prototype.parseObjectPattern=function(m,v){var O=this.createNode(),b=[];for(this.expect("{");!this.match("}");)b.push(this.parsePropertyPattern(m,v)),this.match("}")||this.expect(",");return this.expect("}"),this.finalize(O,new l.ObjectPattern(b))},x.prototype.parsePattern=function(m,v){var O;return this.match("[")?O=this.parseArrayPattern(m,v):this.match("{")?O=this.parseObjectPattern(m,v):(this.matchKeyword("let")&&(v==="const"||v==="let")&&this.tolerateUnexpectedToken(this.lookahead,a.Messages.LetInLexicalBinding),m.push(this.lookahead),O=this.parseVariableIdentifier(v)),O},x.prototype.parsePatternWithDefault=function(m,v){var O=this.lookahead,b=this.parsePattern(m,v);if(this.match("=")){this.nextToken();var k=this.context.allowYield;this.context.allowYield=!0;var E=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowYield=k,b=this.finalize(this.startNode(O),new l.AssignmentPattern(b,E))}return b},x.prototype.parseVariableIdentifier=function(m){var v=this.createNode(),O=this.nextToken();return O.type===4&&O.value==="yield"?this.context.strict?this.tolerateUnexpectedToken(O,a.Messages.StrictReservedWord):this.context.allowYield||this.throwUnexpectedToken(O):O.type!==3?this.context.strict&&O.type===4&&this.scanner.isStrictModeReservedWord(O.value)?this.tolerateUnexpectedToken(O,a.Messages.StrictReservedWord):(this.context.strict||O.value!=="let"||m!=="var")&&this.throwUnexpectedToken(O):(this.context.isModule||this.context.await)&&O.type===3&&O.value==="await"&&this.tolerateUnexpectedToken(O),this.finalize(v,new l.Identifier(O.value))},x.prototype.parseVariableDeclaration=function(m){var v=this.createNode(),O=[],b=this.parsePattern(O,"var");this.context.strict&&b.type===c.Syntax.Identifier&&this.scanner.isRestrictedWord(b.name)&&this.tolerateError(a.Messages.StrictVarName);var k=null;return this.match("=")?(this.nextToken(),k=this.isolateCoverGrammar(this.parseAssignmentExpression)):b.type!==c.Syntax.Identifier&&!m.inFor&&this.expect("="),this.finalize(v,new l.VariableDeclarator(b,k))},x.prototype.parseVariableDeclarationList=function(m){var v={inFor:m.inFor},O=[];for(O.push(this.parseVariableDeclaration(v));this.match(",");)this.nextToken(),O.push(this.parseVariableDeclaration(v));return O},x.prototype.parseVariableStatement=function(){var m=this.createNode();this.expectKeyword("var");var v=this.parseVariableDeclarationList({inFor:!1});return this.consumeSemicolon(),this.finalize(m,new l.VariableDeclaration(v,"var"))},x.prototype.parseEmptyStatement=function(){var m=this.createNode();return this.expect(";"),this.finalize(m,new l.EmptyStatement)},x.prototype.parseExpressionStatement=function(){var m=this.createNode(),v=this.parseExpression();return this.consumeSemicolon(),this.finalize(m,new l.ExpressionStatement(v))},x.prototype.parseIfClause=function(){return this.context.strict&&this.matchKeyword("function")&&this.tolerateError(a.Messages.StrictFunction),this.parseStatement()},x.prototype.parseIfStatement=function(){var m=this.createNode(),v,O=null;this.expectKeyword("if"),this.expect("(");var b=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),v=this.finalize(this.createNode(),new l.EmptyStatement)):(this.expect(")"),v=this.parseIfClause(),this.matchKeyword("else")&&(this.nextToken(),O=this.parseIfClause())),this.finalize(m,new l.IfStatement(b,v,O))},x.prototype.parseDoWhileStatement=function(){var m=this.createNode();this.expectKeyword("do");var v=this.context.inIteration;this.context.inIteration=!0;var O=this.parseStatement();this.context.inIteration=v,this.expectKeyword("while"),this.expect("(");var b=this.parseExpression();return!this.match(")")&&this.config.tolerant?this.tolerateUnexpectedToken(this.nextToken()):(this.expect(")"),this.match(";")&&this.nextToken()),this.finalize(m,new l.DoWhileStatement(O,b))},x.prototype.parseWhileStatement=function(){var m=this.createNode(),v;this.expectKeyword("while"),this.expect("(");var O=this.parseExpression();if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),v=this.finalize(this.createNode(),new l.EmptyStatement);else{this.expect(")");var b=this.context.inIteration;this.context.inIteration=!0,v=this.parseStatement(),this.context.inIteration=b}return this.finalize(m,new l.WhileStatement(O,v))},x.prototype.parseForStatement=function(){var m=null,v=null,O=null,b=!0,k,E,$=this.createNode();if(this.expectKeyword("for"),this.expect("("),this.match(";"))this.nextToken();else if(this.matchKeyword("var")){m=this.createNode(),this.nextToken();var Q=this.context.allowIn;this.context.allowIn=!1;var X=this.parseVariableDeclarationList({inFor:!0});if(this.context.allowIn=Q,X.length===1&&this.matchKeyword("in")){var R=X[0];R.init&&(R.id.type===c.Syntax.ArrayPattern||R.id.type===c.Syntax.ObjectPattern||this.context.strict)&&this.tolerateError(a.Messages.ForInOfLoopInitializer,"for-in"),m=this.finalize(m,new l.VariableDeclaration(X,"var")),this.nextToken(),k=m,E=this.parseExpression(),m=null}else X.length===1&&X[0].init===null&&this.matchContextualKeyword("of")?(m=this.finalize(m,new l.VariableDeclaration(X,"var")),this.nextToken(),k=m,E=this.parseAssignmentExpression(),m=null,b=!1):(m=this.finalize(m,new l.VariableDeclaration(X,"var")),this.expect(";"))}else if(this.matchKeyword("const")||this.matchKeyword("let")){m=this.createNode();var W=this.nextToken().value;if(!this.context.strict&&this.lookahead.value==="in")m=this.finalize(m,new l.Identifier(W)),this.nextToken(),k=m,E=this.parseExpression(),m=null;else{var Q=this.context.allowIn;this.context.allowIn=!1;var X=this.parseBindingList(W,{inFor:!0});this.context.allowIn=Q,X.length===1&&X[0].init===null&&this.matchKeyword("in")?(m=this.finalize(m,new l.VariableDeclaration(X,W)),this.nextToken(),k=m,E=this.parseExpression(),m=null):X.length===1&&X[0].init===null&&this.matchContextualKeyword("of")?(m=this.finalize(m,new l.VariableDeclaration(X,W)),this.nextToken(),k=m,E=this.parseAssignmentExpression(),m=null,b=!1):(this.consumeSemicolon(),m=this.finalize(m,new l.VariableDeclaration(X,W)))}}else{var D=this.lookahead,Q=this.context.allowIn;if(this.context.allowIn=!1,m=this.inheritCoverGrammar(this.parseAssignmentExpression),this.context.allowIn=Q,this.matchKeyword("in"))(!this.context.isAssignmentTarget||m.type===c.Syntax.AssignmentExpression)&&this.tolerateError(a.Messages.InvalidLHSInForIn),this.nextToken(),this.reinterpretExpressionAsPattern(m),k=m,E=this.parseExpression(),m=null;else if(this.matchContextualKeyword("of"))(!this.context.isAssignmentTarget||m.type===c.Syntax.AssignmentExpression)&&this.tolerateError(a.Messages.InvalidLHSInForLoop),this.nextToken(),this.reinterpretExpressionAsPattern(m),k=m,E=this.parseAssignmentExpression(),m=null,b=!1;else{if(this.match(",")){for(var z=[m];this.match(",");)this.nextToken(),z.push(this.isolateCoverGrammar(this.parseAssignmentExpression));m=this.finalize(this.startNode(D),new l.SequenceExpression(z))}this.expect(";")}}typeof k>"u"&&(this.match(";")||(v=this.parseExpression()),this.expect(";"),this.match(")")||(O=this.parseExpression()));var N;if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),N=this.finalize(this.createNode(),new l.EmptyStatement);else{this.expect(")");var U=this.context.inIteration;this.context.inIteration=!0,N=this.isolateCoverGrammar(this.parseStatement),this.context.inIteration=U}return typeof k>"u"?this.finalize($,new l.ForStatement(m,v,O,N)):b?this.finalize($,new l.ForInStatement(k,E,N)):this.finalize($,new l.ForOfStatement(k,E,N))},x.prototype.parseContinueStatement=function(){var m=this.createNode();this.expectKeyword("continue");var v=null;if(this.lookahead.type===3&&!this.hasLineTerminator){var O=this.parseVariableIdentifier();v=O;var b="$"+O.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,b)||this.throwError(a.Messages.UnknownLabel,O.name)}return this.consumeSemicolon(),v===null&&!this.context.inIteration&&this.throwError(a.Messages.IllegalContinue),this.finalize(m,new l.ContinueStatement(v))},x.prototype.parseBreakStatement=function(){var m=this.createNode();this.expectKeyword("break");var v=null;if(this.lookahead.type===3&&!this.hasLineTerminator){var O=this.parseVariableIdentifier(),b="$"+O.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,b)||this.throwError(a.Messages.UnknownLabel,O.name),v=O}return this.consumeSemicolon(),v===null&&!this.context.inIteration&&!this.context.inSwitch&&this.throwError(a.Messages.IllegalBreak),this.finalize(m,new l.BreakStatement(v))},x.prototype.parseReturnStatement=function(){this.context.inFunctionBody||this.tolerateError(a.Messages.IllegalReturn);var m=this.createNode();this.expectKeyword("return");var v=!this.match(";")&&!this.match("}")&&!this.hasLineTerminator&&this.lookahead.type!==2||this.lookahead.type===8||this.lookahead.type===10,O=v?this.parseExpression():null;return this.consumeSemicolon(),this.finalize(m,new l.ReturnStatement(O))},x.prototype.parseWithStatement=function(){this.context.strict&&this.tolerateError(a.Messages.StrictModeWith);var m=this.createNode(),v;this.expectKeyword("with"),this.expect("(");var O=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),v=this.finalize(this.createNode(),new l.EmptyStatement)):(this.expect(")"),v=this.parseStatement()),this.finalize(m,new l.WithStatement(O,v))},x.prototype.parseSwitchCase=function(){var m=this.createNode(),v;this.matchKeyword("default")?(this.nextToken(),v=null):(this.expectKeyword("case"),v=this.parseExpression()),this.expect(":");for(var O=[];!(this.match("}")||this.matchKeyword("default")||this.matchKeyword("case"));)O.push(this.parseStatementListItem());return this.finalize(m,new l.SwitchCase(v,O))},x.prototype.parseSwitchStatement=function(){var m=this.createNode();this.expectKeyword("switch"),this.expect("(");var v=this.parseExpression();this.expect(")");var O=this.context.inSwitch;this.context.inSwitch=!0;var b=[],k=!1;for(this.expect("{");!this.match("}");){var E=this.parseSwitchCase();E.test===null&&(k&&this.throwError(a.Messages.MultipleDefaultsInSwitch),k=!0),b.push(E)}return this.expect("}"),this.context.inSwitch=O,this.finalize(m,new l.SwitchStatement(v,b))},x.prototype.parseLabelledStatement=function(){var m=this.createNode(),v=this.parseExpression(),O;if(v.type===c.Syntax.Identifier&&this.match(":")){this.nextToken();var b=v,k="$"+b.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,k)&&this.throwError(a.Messages.Redeclaration,"Label",b.name),this.context.labelSet[k]=!0;var E=void 0;if(this.matchKeyword("class"))this.tolerateUnexpectedToken(this.lookahead),E=this.parseClassDeclaration();else if(this.matchKeyword("function")){var $=this.lookahead,Q=this.parseFunctionDeclaration();this.context.strict?this.tolerateUnexpectedToken($,a.Messages.StrictFunction):Q.generator&&this.tolerateUnexpectedToken($,a.Messages.GeneratorInLegacyContext),E=Q}else E=this.parseStatement();delete this.context.labelSet[k],O=new l.LabeledStatement(b,E)}else this.consumeSemicolon(),O=new l.ExpressionStatement(v);return this.finalize(m,O)},x.prototype.parseThrowStatement=function(){var m=this.createNode();this.expectKeyword("throw"),this.hasLineTerminator&&this.throwError(a.Messages.NewlineAfterThrow);var v=this.parseExpression();return this.consumeSemicolon(),this.finalize(m,new l.ThrowStatement(v))},x.prototype.parseCatchClause=function(){var m=this.createNode();this.expectKeyword("catch"),this.expect("("),this.match(")")&&this.throwUnexpectedToken(this.lookahead);for(var v=[],O=this.parsePattern(v),b={},k=0;k0&&this.tolerateError(a.Messages.BadGetterArity);var k=this.parsePropertyMethod(b);return this.context.allowYield=O,this.finalize(m,new l.FunctionExpression(null,b.params,k,v))},x.prototype.parseSetterMethod=function(){var m=this.createNode(),v=!1,O=this.context.allowYield;this.context.allowYield=!v;var b=this.parseFormalParameters();b.params.length!==1?this.tolerateError(a.Messages.BadSetterArity):b.params[0]instanceof l.RestElement&&this.tolerateError(a.Messages.BadSetterRestParameter);var k=this.parsePropertyMethod(b);return this.context.allowYield=O,this.finalize(m,new l.FunctionExpression(null,b.params,k,v))},x.prototype.parseGeneratorMethod=function(){var m=this.createNode(),v=!0,O=this.context.allowYield;this.context.allowYield=!0;var b=this.parseFormalParameters();this.context.allowYield=!1;var k=this.parsePropertyMethod(b);return this.context.allowYield=O,this.finalize(m,new l.FunctionExpression(null,b.params,k,v))},x.prototype.isStartOfExpression=function(){var m=!0,v=this.lookahead.value;switch(this.lookahead.type){case 7:m=v==="["||v==="("||v==="{"||v==="+"||v==="-"||v==="!"||v==="~"||v==="++"||v==="--"||v==="/"||v==="/=";break;case 4:m=v==="class"||v==="delete"||v==="function"||v==="let"||v==="new"||v==="super"||v==="this"||v==="typeof"||v==="void"||v==="yield";break}return m},x.prototype.parseYieldExpression=function(){var m=this.createNode();this.expectKeyword("yield");var v=null,O=!1;if(!this.hasLineTerminator){var b=this.context.allowYield;this.context.allowYield=!1,O=this.match("*"),O?(this.nextToken(),v=this.parseAssignmentExpression()):this.isStartOfExpression()&&(v=this.parseAssignmentExpression()),this.context.allowYield=b}return this.finalize(m,new l.YieldExpression(v,O))},x.prototype.parseClassElement=function(m){var v=this.lookahead,O=this.createNode(),b="",k=null,E=null,$=!1,Q=!1,X=!1,R=!1;if(this.match("*"))this.nextToken();else{$=this.match("["),k=this.parseObjectPropertyKey();var W=k;if(W.name==="static"&&(this.qualifiedPropertyName(this.lookahead)||this.match("*"))&&(v=this.lookahead,X=!0,$=this.match("["),this.match("*")?this.nextToken():k=this.parseObjectPropertyKey()),v.type===3&&!this.hasLineTerminator&&v.value==="async"){var D=this.lookahead.value;D!==":"&&D!=="("&&D!=="*"&&(R=!0,v=this.lookahead,k=this.parseObjectPropertyKey(),v.type===3&&v.value==="constructor"&&this.tolerateUnexpectedToken(v,a.Messages.ConstructorIsAsync))}}var z=this.qualifiedPropertyName(this.lookahead);return v.type===3?v.value==="get"&&z?(b="get",$=this.match("["),k=this.parseObjectPropertyKey(),this.context.allowYield=!1,E=this.parseGetterMethod()):v.value==="set"&&z&&(b="set",$=this.match("["),k=this.parseObjectPropertyKey(),E=this.parseSetterMethod()):v.type===7&&v.value==="*"&&z&&(b="init",$=this.match("["),k=this.parseObjectPropertyKey(),E=this.parseGeneratorMethod(),Q=!0),!b&&k&&this.match("(")&&(b="init",E=R?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),Q=!0),b||this.throwUnexpectedToken(this.lookahead),b==="init"&&(b="method"),$||(X&&this.isPropertyKey(k,"prototype")&&this.throwUnexpectedToken(v,a.Messages.StaticPrototype),!X&&this.isPropertyKey(k,"constructor")&&((b!=="method"||!Q||E&&E.generator)&&this.throwUnexpectedToken(v,a.Messages.ConstructorSpecialMethod),m.value?this.throwUnexpectedToken(v,a.Messages.DuplicateConstructor):m.value=!0,b="constructor")),this.finalize(O,new l.MethodDefinition(k,$,E,b,X))},x.prototype.parseClassElementList=function(){var m=[],v={value:!1};for(this.expect("{");!this.match("}");)this.match(";")?this.nextToken():m.push(this.parseClassElement(v));return this.expect("}"),m},x.prototype.parseClassBody=function(){var m=this.createNode(),v=this.parseClassElementList();return this.finalize(m,new l.ClassBody(v))},x.prototype.parseClassDeclaration=function(m){var v=this.createNode(),O=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var b=m&&this.lookahead.type!==3?null:this.parseVariableIdentifier(),k=null;this.matchKeyword("extends")&&(this.nextToken(),k=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var E=this.parseClassBody();return this.context.strict=O,this.finalize(v,new l.ClassDeclaration(b,k,E))},x.prototype.parseClassExpression=function(){var m=this.createNode(),v=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var O=this.lookahead.type===3?this.parseVariableIdentifier():null,b=null;this.matchKeyword("extends")&&(this.nextToken(),b=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var k=this.parseClassBody();return this.context.strict=v,this.finalize(m,new l.ClassExpression(O,b,k))},x.prototype.parseModule=function(){this.context.strict=!0,this.context.isModule=!0,this.scanner.isModule=!0;for(var m=this.createNode(),v=this.parseDirectivePrologues();this.lookahead.type!==2;)v.push(this.parseStatementListItem());return this.finalize(m,new l.Module(v))},x.prototype.parseScript=function(){for(var m=this.createNode(),v=this.parseDirectivePrologues();this.lookahead.type!==2;)v.push(this.parseStatementListItem());return this.finalize(m,new l.Script(v))},x.prototype.parseModuleSpecifier=function(){var m=this.createNode();this.lookahead.type!==8&&this.throwError(a.Messages.InvalidModuleSpecifier);var v=this.nextToken(),O=this.getTokenRaw(v);return this.finalize(m,new l.Literal(v.value,O))},x.prototype.parseImportSpecifier=function(){var m=this.createNode(),v,O;return this.lookahead.type===3?(v=this.parseVariableIdentifier(),O=v,this.matchContextualKeyword("as")&&(this.nextToken(),O=this.parseVariableIdentifier())):(v=this.parseIdentifierName(),O=v,this.matchContextualKeyword("as")?(this.nextToken(),O=this.parseVariableIdentifier()):this.throwUnexpectedToken(this.nextToken())),this.finalize(m,new l.ImportSpecifier(O,v))},x.prototype.parseNamedImports=function(){this.expect("{");for(var m=[];!this.match("}");)m.push(this.parseImportSpecifier()),this.match("}")||this.expect(",");return this.expect("}"),m},x.prototype.parseImportDefaultSpecifier=function(){var m=this.createNode(),v=this.parseIdentifierName();return this.finalize(m,new l.ImportDefaultSpecifier(v))},x.prototype.parseImportNamespaceSpecifier=function(){var m=this.createNode();this.expect("*"),this.matchContextualKeyword("as")||this.throwError(a.Messages.NoAsAfterImportNamespace),this.nextToken();var v=this.parseIdentifierName();return this.finalize(m,new l.ImportNamespaceSpecifier(v))},x.prototype.parseImportDeclaration=function(){this.context.inFunctionBody&&this.throwError(a.Messages.IllegalImportDeclaration);var m=this.createNode();this.expectKeyword("import");var v,O=[];if(this.lookahead.type===8)v=this.parseModuleSpecifier();else{if(this.match("{")?O=O.concat(this.parseNamedImports()):this.match("*")?O.push(this.parseImportNamespaceSpecifier()):this.isIdentifierName(this.lookahead)&&!this.matchKeyword("default")?(O.push(this.parseImportDefaultSpecifier()),this.match(",")&&(this.nextToken(),this.match("*")?O.push(this.parseImportNamespaceSpecifier()):this.match("{")?O=O.concat(this.parseNamedImports()):this.throwUnexpectedToken(this.lookahead))):this.throwUnexpectedToken(this.nextToken()),!this.matchContextualKeyword("from")){var b=this.lookahead.value?a.Messages.UnexpectedToken:a.Messages.MissingFromClause;this.throwError(b,this.lookahead.value)}this.nextToken(),v=this.parseModuleSpecifier()}return this.consumeSemicolon(),this.finalize(m,new l.ImportDeclaration(O,v))},x.prototype.parseExportSpecifier=function(){var m=this.createNode(),v=this.parseIdentifierName(),O=v;return this.matchContextualKeyword("as")&&(this.nextToken(),O=this.parseIdentifierName()),this.finalize(m,new l.ExportSpecifier(v,O))},x.prototype.parseExportDeclaration=function(){this.context.inFunctionBody&&this.throwError(a.Messages.IllegalExportDeclaration);var m=this.createNode();this.expectKeyword("export");var v;if(this.matchKeyword("default"))if(this.nextToken(),this.matchKeyword("function")){var O=this.parseFunctionDeclaration(!0);v=this.finalize(m,new l.ExportDefaultDeclaration(O))}else if(this.matchKeyword("class")){var O=this.parseClassDeclaration(!0);v=this.finalize(m,new l.ExportDefaultDeclaration(O))}else if(this.matchContextualKeyword("async")){var O=this.matchAsyncFunction()?this.parseFunctionDeclaration(!0):this.parseAssignmentExpression();v=this.finalize(m,new l.ExportDefaultDeclaration(O))}else{this.matchContextualKeyword("from")&&this.throwError(a.Messages.UnexpectedToken,this.lookahead.value);var O=this.match("{")?this.parseObjectInitializer():this.match("[")?this.parseArrayInitializer():this.parseAssignmentExpression();this.consumeSemicolon(),v=this.finalize(m,new l.ExportDefaultDeclaration(O))}else if(this.match("*")){if(this.nextToken(),!this.matchContextualKeyword("from")){var b=this.lookahead.value?a.Messages.UnexpectedToken:a.Messages.MissingFromClause;this.throwError(b,this.lookahead.value)}this.nextToken();var k=this.parseModuleSpecifier();this.consumeSemicolon(),v=this.finalize(m,new l.ExportAllDeclaration(k))}else if(this.lookahead.type===4){var O=void 0;switch(this.lookahead.value){case"let":case"const":O=this.parseLexicalDeclaration({inFor:!1});break;case"var":case"class":case"function":O=this.parseStatementListItem();break;default:this.throwUnexpectedToken(this.lookahead)}v=this.finalize(m,new l.ExportNamedDeclaration(O,[],null))}else if(this.matchAsyncFunction()){var O=this.parseFunctionDeclaration();v=this.finalize(m,new l.ExportNamedDeclaration(O,[],null))}else{var E=[],$=null,Q=!1;for(this.expect("{");!this.match("}");)Q=Q||this.matchKeyword("default"),E.push(this.parseExportSpecifier()),this.match("}")||this.expect(",");if(this.expect("}"),this.matchContextualKeyword("from"))this.nextToken(),$=this.parseModuleSpecifier(),this.consumeSemicolon();else if(Q){var b=this.lookahead.value?a.Messages.UnexpectedToken:a.Messages.MissingFromClause;this.throwError(b,this.lookahead.value)}else this.consumeSemicolon();v=this.finalize(m,new l.ExportNamedDeclaration(null,E,$))}return v},x}();n.Parser=g},function(e,n){Object.defineProperty(n,"__esModule",{value:!0});function r(o,s){if(!o)throw new Error("ASSERT: "+s)}n.assert=r},function(e,n){Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function o(){this.errors=[],this.tolerant=!1}return o.prototype.recordError=function(s){this.errors.push(s)},o.prototype.tolerate=function(s){if(this.tolerant)this.recordError(s);else throw s},o.prototype.constructError=function(s,a){var l=new Error(s);try{throw l}catch(u){Object.create&&Object.defineProperty&&(l=Object.create(u),Object.defineProperty(l,"column",{value:a}))}return l},o.prototype.createError=function(s,a,l,u){var c="Line "+a+": "+u,d=this.constructError(c,l);return d.index=s,d.lineNumber=a,d.description=u,d},o.prototype.throwError=function(s,a,l,u){throw this.createError(s,a,l,u)},o.prototype.tolerateError=function(s,a,l,u){var c=this.createError(s,a,l,u);if(this.tolerant)this.recordError(c);else throw c},o}();n.ErrorHandler=r},function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.Messages={BadGetterArity:"Getter must not have any formal parameters",BadSetterArity:"Setter must have exactly one formal parameter",BadSetterRestParameter:"Setter function argument must not be a rest parameter",ConstructorIsAsync:"Class constructor may not be an async method",ConstructorSpecialMethod:"Class constructor may not be an accessor",DeclarationMissingInitializer:"Missing initializer in %0 declaration",DefaultRestParameter:"Unexpected token =",DuplicateBinding:"Duplicate binding %0",DuplicateConstructor:"A class may only have one constructor",DuplicateProtoProperty:"Duplicate __proto__ fields are not allowed in object literals",ForInOfLoopInitializer:"%0 loop variable declaration may not have an initializer",GeneratorInLegacyContext:"Generator declarations are not allowed in legacy contexts",IllegalBreak:"Illegal break statement",IllegalContinue:"Illegal continue statement",IllegalExportDeclaration:"Unexpected token",IllegalImportDeclaration:"Unexpected token",IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list",IllegalReturn:"Illegal return statement",InvalidEscapedReservedWord:"Keyword must not contain escaped characters",InvalidHexEscapeSequence:"Invalid hexadecimal escape sequence",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",InvalidLHSInForLoop:"Invalid left-hand side in for-loop",InvalidModuleSpecifier:"Unexpected token",InvalidRegExp:"Invalid regular expression",LetInLexicalBinding:"let is disallowed as a lexically bound name",MissingFromClause:"Unexpected token",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NewlineAfterThrow:"Illegal newline after throw",NoAsAfterImportNamespace:"Unexpected token",NoCatchOrFinally:"Missing catch or finally after try",ParameterAfterRestParameter:"Rest parameter must be last formal parameter",Redeclaration:"%0 '%1' has already been declared",StaticPrototype:"Classes may not have static property named prototype",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictModeWith:"Strict mode code may not include a with statement",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictReservedWord:"Use of future reserved word in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",TemplateOctalLiteral:"Octal literals are not allowed in template strings.",UnexpectedEOS:"Unexpected end of input",UnexpectedIdentifier:"Unexpected identifier",UnexpectedNumber:"Unexpected number",UnexpectedReserved:"Unexpected reserved word",UnexpectedString:"Unexpected string",UnexpectedTemplate:"Unexpected quasi %0",UnexpectedToken:"Unexpected token %0",UnexpectedTokenIllegal:"Unexpected token ILLEGAL",UnknownLabel:"Undefined label '%0'",UnterminatedRegExp:"Invalid regular expression: missing /"}},function(e,n,r){Object.defineProperty(n,"__esModule",{value:!0});var o=r(9),s=r(4),a=r(11);function l(d){return"0123456789abcdef".indexOf(d.toLowerCase())}function u(d){return"01234567".indexOf(d)}var c=function(){function d(f,g){this.source=f,this.errorHandler=g,this.trackComment=!1,this.isModule=!1,this.length=f.length,this.index=0,this.lineNumber=f.length>0?1:0,this.lineStart=0,this.curlyStack=[]}return d.prototype.saveState=function(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart}},d.prototype.restoreState=function(f){this.index=f.index,this.lineNumber=f.lineNumber,this.lineStart=f.lineStart},d.prototype.eof=function(){return this.index>=this.length},d.prototype.throwUnexpectedToken=function(f){return f===void 0&&(f=a.Messages.UnexpectedTokenIllegal),this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,f)},d.prototype.tolerateUnexpectedToken=function(f){f===void 0&&(f=a.Messages.UnexpectedTokenIllegal),this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,f)},d.prototype.skipSingleLineComment=function(f){var g=[],x,m;for(this.trackComment&&(g=[],x=this.index-f,m={start:{line:this.lineNumber,column:this.index-this.lineStart-f},end:{}});!this.eof();){var v=this.source.charCodeAt(this.index);if(++this.index,s.Character.isLineTerminator(v)){if(this.trackComment){m.end={line:this.lineNumber,column:this.index-this.lineStart-1};var O={multiLine:!1,slice:[x+f,this.index-1],range:[x,this.index-1],loc:m};g.push(O)}return v===13&&this.source.charCodeAt(this.index)===10&&++this.index,++this.lineNumber,this.lineStart=this.index,g}}if(this.trackComment){m.end={line:this.lineNumber,column:this.index-this.lineStart};var O={multiLine:!1,slice:[x+f,this.index],range:[x,this.index],loc:m};g.push(O)}return g},d.prototype.skipMultiLineComment=function(){var f=[],g,x;for(this.trackComment&&(f=[],g=this.index-2,x={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){var m=this.source.charCodeAt(this.index);if(s.Character.isLineTerminator(m))m===13&&this.source.charCodeAt(this.index+1)===10&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(m===42){if(this.source.charCodeAt(this.index+1)===47){if(this.index+=2,this.trackComment){x.end={line:this.lineNumber,column:this.index-this.lineStart};var v={multiLine:!0,slice:[g+2,this.index-2],range:[g,this.index],loc:x};f.push(v)}return f}++this.index}else++this.index}if(this.trackComment){x.end={line:this.lineNumber,column:this.index-this.lineStart};var v={multiLine:!0,slice:[g+2,this.index],range:[g,this.index],loc:x};f.push(v)}return this.tolerateUnexpectedToken(),f},d.prototype.scanComments=function(){var f;this.trackComment&&(f=[]);for(var g=this.index===0;!this.eof();){var x=this.source.charCodeAt(this.index);if(s.Character.isWhiteSpace(x))++this.index;else if(s.Character.isLineTerminator(x))++this.index,x===13&&this.source.charCodeAt(this.index)===10&&++this.index,++this.lineNumber,this.lineStart=this.index,g=!0;else if(x===47)if(x=this.source.charCodeAt(this.index+1),x===47){this.index+=2;var m=this.skipSingleLineComment(2);this.trackComment&&(f=f.concat(m)),g=!0}else if(x===42){this.index+=2;var m=this.skipMultiLineComment();this.trackComment&&(f=f.concat(m))}else break;else if(g&&x===45)if(this.source.charCodeAt(this.index+1)===45&&this.source.charCodeAt(this.index+2)===62){this.index+=3;var m=this.skipSingleLineComment(3);this.trackComment&&(f=f.concat(m))}else break;else if(x===60&&!this.isModule)if(this.source.slice(this.index+1,this.index+4)==="!--"){this.index+=4;var m=this.skipSingleLineComment(4);this.trackComment&&(f=f.concat(m))}else break;else break}return f},d.prototype.isFutureReservedWord=function(f){switch(f){case"enum":case"export":case"import":case"super":return!0;default:return!1}},d.prototype.isStrictModeReservedWord=function(f){switch(f){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}},d.prototype.isRestrictedWord=function(f){return f==="eval"||f==="arguments"},d.prototype.isKeyword=function(f){switch(f.length){case 2:return f==="if"||f==="in"||f==="do";case 3:return f==="var"||f==="for"||f==="new"||f==="try"||f==="let";case 4:return f==="this"||f==="else"||f==="case"||f==="void"||f==="with"||f==="enum";case 5:return f==="while"||f==="break"||f==="catch"||f==="throw"||f==="const"||f==="yield"||f==="class"||f==="super";case 6:return f==="return"||f==="typeof"||f==="delete"||f==="switch"||f==="export"||f==="import";case 7:return f==="default"||f==="finally"||f==="extends";case 8:return f==="function"||f==="continue"||f==="debugger";case 10:return f==="instanceof";default:return!1}},d.prototype.codePointAt=function(f){var g=this.source.charCodeAt(f);if(g>=55296&&g<=56319){var x=this.source.charCodeAt(f+1);if(x>=56320&&x<=57343){var m=g;g=(m-55296)*1024+x-56320+65536}}return g},d.prototype.scanHexEscape=function(f){for(var g=f==="u"?4:2,x=0,m=0;m1114111||f!=="}")&&this.throwUnexpectedToken(),s.Character.fromCodePoint(g)},d.prototype.getIdentifier=function(){for(var f=this.index++;!this.eof();){var g=this.source.charCodeAt(this.index);if(g===92)return this.index=f,this.getComplexIdentifier();if(g>=55296&&g<57343)return this.index=f,this.getComplexIdentifier();if(s.Character.isIdentifierPart(g))++this.index;else break}return this.source.slice(f,this.index)},d.prototype.getComplexIdentifier=function(){var f=this.codePointAt(this.index),g=s.Character.fromCodePoint(f);this.index+=g.length;var x;for(f===92&&(this.source.charCodeAt(this.index)!==117&&this.throwUnexpectedToken(),++this.index,this.source[this.index]==="{"?(++this.index,x=this.scanUnicodeCodePointEscape()):(x=this.scanHexEscape("u"),(x===null||x==="\\"||!s.Character.isIdentifierStart(x.charCodeAt(0)))&&this.throwUnexpectedToken()),g=x);!this.eof()&&(f=this.codePointAt(this.index),!!s.Character.isIdentifierPart(f));)x=s.Character.fromCodePoint(f),g+=x,this.index+=x.length,f===92&&(g=g.substr(0,g.length-1),this.source.charCodeAt(this.index)!==117&&this.throwUnexpectedToken(),++this.index,this.source[this.index]==="{"?(++this.index,x=this.scanUnicodeCodePointEscape()):(x=this.scanHexEscape("u"),(x===null||x==="\\"||!s.Character.isIdentifierPart(x.charCodeAt(0)))&&this.throwUnexpectedToken()),g+=x);return g},d.prototype.octalToDecimal=function(f){var g=f!=="0",x=u(f);return!this.eof()&&s.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(g=!0,x=x*8+u(this.source[this.index++]),"0123".indexOf(f)>=0&&!this.eof()&&s.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(x=x*8+u(this.source[this.index++]))),{code:x,octal:g}},d.prototype.scanIdentifier=function(){var f,g=this.index,x=this.source.charCodeAt(g)===92?this.getComplexIdentifier():this.getIdentifier();if(x.length===1?f=3:this.isKeyword(x)?f=4:x==="null"?f=5:x==="true"||x==="false"?f=1:f=3,f!==3&&g+x.length!==this.index){var m=this.index;this.index=g,this.tolerateUnexpectedToken(a.Messages.InvalidEscapedReservedWord),this.index=m}return{type:f,value:x,lineNumber:this.lineNumber,lineStart:this.lineStart,start:g,end:this.index}},d.prototype.scanPunctuator=function(){var f=this.index,g=this.source[this.index];switch(g){case"(":case"{":g==="{"&&this.curlyStack.push("{"),++this.index;break;case".":++this.index,this.source[this.index]==="."&&this.source[this.index+1]==="."&&(this.index+=2,g="...");break;case"}":++this.index,this.curlyStack.pop();break;case")":case";":case",":case"[":case"]":case":":case"?":case"~":++this.index;break;default:g=this.source.substr(this.index,4),g===">>>="?this.index+=4:(g=g.substr(0,3),g==="==="||g==="!=="||g===">>>"||g==="<<="||g===">>="||g==="**="?this.index+=3:(g=g.substr(0,2),g==="&&"||g==="||"||g==="=="||g==="!="||g==="+="||g==="-="||g==="*="||g==="/="||g==="++"||g==="--"||g==="<<"||g===">>"||g==="&="||g==="|="||g==="^="||g==="%="||g==="<="||g===">="||g==="=>"||g==="**"?this.index+=2:(g=this.source[this.index],"<>=!+-*%&|^/".indexOf(g)>=0&&++this.index)))}return this.index===f&&this.throwUnexpectedToken(),{type:7,value:g,lineNumber:this.lineNumber,lineStart:this.lineStart,start:f,end:this.index}},d.prototype.scanHexLiteral=function(f){for(var g="";!this.eof()&&s.Character.isHexDigit(this.source.charCodeAt(this.index));)g+=this.source[this.index++];return g.length===0&&this.throwUnexpectedToken(),s.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseInt("0x"+g,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:f,end:this.index}},d.prototype.scanBinaryLiteral=function(f){for(var g="",x;!this.eof()&&(x=this.source[this.index],!(x!=="0"&&x!=="1"));)g+=this.source[this.index++];return g.length===0&&this.throwUnexpectedToken(),this.eof()||(x=this.source.charCodeAt(this.index),(s.Character.isIdentifierStart(x)||s.Character.isDecimalDigit(x))&&this.throwUnexpectedToken()),{type:6,value:parseInt(g,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:f,end:this.index}},d.prototype.scanOctalLiteral=function(f,g){var x="",m=!1;for(s.Character.isOctalDigit(f.charCodeAt(0))?(m=!0,x="0"+this.source[this.index++]):++this.index;!this.eof()&&s.Character.isOctalDigit(this.source.charCodeAt(this.index));)x+=this.source[this.index++];return!m&&x.length===0&&this.throwUnexpectedToken(),(s.Character.isIdentifierStart(this.source.charCodeAt(this.index))||s.Character.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:6,value:parseInt(x,8),octal:m,lineNumber:this.lineNumber,lineStart:this.lineStart,start:g,end:this.index}},d.prototype.isImplicitOctalLiteral=function(){for(var f=this.index+1;fi}):void 0,_u="$lit$",Un=`lit$${(Math.random()+"").slice(9)}$`,xm="?"+Un,KO=`<${xm}>`,Pr=document,Hs=()=>Pr.createComment(""),Js=i=>i===null||typeof i!="object"&&typeof i!="function",bm=Array.isArray,t_=i=>bm(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",_h=`[ \f\r]`,ws=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Wf=/-->/g,Uf=/>/g,cr=RegExp(`>|${_h}(?:([^\\s"'>=/]+)(${_h}*=${_h}*(?:[^ -\f\r"'\`<>=]|("|')|))|$)`,"g"),zf=/'/g,jf=/"/g,wm=/^(?:script|style|textarea|title)$/i,Sm=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),Oe=Sm(1),_e=Sm(2),Ks=Symbol.for("lit-noChange"),si=Symbol.for("lit-nothing"),qf=new WeakMap,vr=Pr.createTreeWalker(Pr,129,null,!1);function Cm(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Zf!==void 0?Zf.createHTML(t):t}const e_=(i,t)=>{const e=i.length-1,n=[];let r,o=t===2?"":"",s=ws;for(let a=0;a"?(s=r??ws,d=-1):c[1]===void 0?d=-2:(d=s.lastIndex-c[2].length,u=c[1],s=c[3]===void 0?cr:c[3]==='"'?jf:zf):s===jf||s===zf?s=cr:s===Wf||s===Uf?s=ws:(s=cr,r=void 0);const g=s===cr&&i[a+1].startsWith("/>")?" ":"";o+=s===ws?l+KO:d>=0?(n.push(u),l.slice(0,d)+_u+l.slice(d)+Un+g):l+Un+(d===-2?(n.push(void 0),a):g)}return[Cm(i,o+(i[e]||"")+(t===2?"":"")),n]};class to{constructor({strings:t,_$litType$:e},n){let r;this.parts=[];let o=0,s=0;const a=t.length-1,l=this.parts,[u,c]=e_(t,e);if(this.el=to.createElement(u,n),vr.currentNode=this.el.content,e===2){const d=this.el.content,f=d.firstChild;f.remove(),d.append(...f.childNodes)}for(;(r=vr.nextNode())!==null&&l.length0){r.textContent=as?as.emptyScript:"";for(let g=0;g2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=si}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,n,r){const o=this.strings;let s=!1;if(o===void 0)t=ls(this,t,e,0),s=!Js(t)||t!==this._$AH&&t!==Ks,s&&(this._$AH=t);else{const a=t;let l,u;for(t=o[0],l=0;l{var n,r;const o=(n=e==null?void 0:e.renderBefore)!==null&&n!==void 0?n:t;let s=o._$litPart$;if(s===void 0){const a=(r=e==null?void 0:e.renderBefore)!==null&&r!==void 0?r:null;o._$litPart$=s=new _o(t.insertBefore(Hs(),a),a,void 0,e??{})}return s._$AI(i),s};class we{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,n){[t,e]=hs(this,t,e);let r=[];return this.decompose(0,t,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(e,this.length,r,1),mn.from(r,this.length-(e-t)+n.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=hs(this,t,e);let n=[];return this.decompose(t,e,n,0),mn.from(n,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),n=this.length-this.scanIdentical(t,-1),r=new Ws(this),o=new Ws(t);for(let s=e,a=e;;){if(r.next(s),o.next(s),s=0,r.lineBreak!=o.lineBreak||r.done!=o.done||r.value!=o.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(t=1){return new Ws(this,t)}iterRange(t,e=this.length){return new Pm(this,t,e)}iterLines(t,e){let n;if(t==null)n=this.iter();else{e==null&&(e=this.lines+1);let r=this.line(t).from;n=this.iterRange(r,Math.max(r,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new km(n)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?we.empty:t.length<=32?new Xe(t):mn.from(Xe.split(t,[]))}}class Xe extends we{constructor(t,e=l_(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,n,r){for(let o=0;;o++){let s=this.text[o],a=r+s.length;if((e?n:a)>=t)return new h_(r,a,n,s);r=a+1,n++}}decompose(t,e,n,r){let o=t<=0&&e>=this.length?this:new Xe(Gf(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(r&1){let s=n.pop(),a=Ca(o.text,s.text.slice(),0,o.length);if(a.length<=32)n.push(new Xe(a,s.length+o.length));else{let l=a.length>>1;n.push(new Xe(a.slice(0,l)),new Xe(a.slice(l)))}}else n.push(o)}replace(t,e,n){if(!(n instanceof Xe))return super.replace(t,e,n);[t,e]=hs(this,t,e);let r=Ca(this.text,Ca(n.text,Gf(this.text,0,t)),e),o=this.length+n.length-(e-t);return r.length<=32?new Xe(r,o):mn.from(Xe.split(r,[]),o)}sliceString(t,e=this.length,n=` +\f\r"'\`<>=]|("|')|))|$)`,"g"),zf=/'/g,jf=/"/g,wm=/^(?:script|style|textarea|title)$/i,Sm=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),_e=Sm(1),ve=Sm(2),Ks=Symbol.for("lit-noChange"),si=Symbol.for("lit-nothing"),qf=new WeakMap,vr=Pr.createTreeWalker(Pr,129,null,!1);function Cm(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Zf!==void 0?Zf.createHTML(t):t}const e_=(i,t)=>{const e=i.length-1,n=[];let r,o=t===2?"":"",s=ws;for(let a=0;a"?(s=r??ws,d=-1):c[1]===void 0?d=-2:(d=s.lastIndex-c[2].length,u=c[1],s=c[3]===void 0?cr:c[3]==='"'?jf:zf):s===jf||s===zf?s=cr:s===Wf||s===Uf?s=ws:(s=cr,r=void 0);const g=s===cr&&i[a+1].startsWith("/>")?" ":"";o+=s===ws?l+KO:d>=0?(n.push(u),l.slice(0,d)+_u+l.slice(d)+Un+g):l+Un+(d===-2?(n.push(void 0),a):g)}return[Cm(i,o+(i[e]||"")+(t===2?"":"")),n]};class to{constructor({strings:t,_$litType$:e},n){let r;this.parts=[];let o=0,s=0;const a=t.length-1,l=this.parts,[u,c]=e_(t,e);if(this.el=to.createElement(u,n),vr.currentNode=this.el.content,e===2){const d=this.el.content,f=d.firstChild;f.remove(),d.append(...f.childNodes)}for(;(r=vr.nextNode())!==null&&l.length0){r.textContent=as?as.emptyScript:"";for(let g=0;g2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=si}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,n,r){const o=this.strings;let s=!1;if(o===void 0)t=ls(this,t,e,0),s=!Js(t)||t!==this._$AH&&t!==Ks,s&&(this._$AH=t);else{const a=t;let l,u;for(t=o[0],l=0;l{var n,r;const o=(n=e==null?void 0:e.renderBefore)!==null&&n!==void 0?n:t;let s=o._$litPart$;if(s===void 0){const a=(r=e==null?void 0:e.renderBefore)!==null&&r!==void 0?r:null;o._$litPart$=s=new _o(t.insertBefore(Hs(),a),a,void 0,e??{})}return s._$AI(i),s};class we{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,n){[t,e]=hs(this,t,e);let r=[];return this.decompose(0,t,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(e,this.length,r,1),mn.from(r,this.length-(e-t)+n.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=hs(this,t,e);let n=[];return this.decompose(t,e,n,0),mn.from(n,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),n=this.length-this.scanIdentical(t,-1),r=new Ws(this),o=new Ws(t);for(let s=e,a=e;;){if(r.next(s),o.next(s),s=0,r.lineBreak!=o.lineBreak||r.done!=o.done||r.value!=o.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(t=1){return new Ws(this,t)}iterRange(t,e=this.length){return new Pm(this,t,e)}iterLines(t,e){let n;if(t==null)n=this.iter();else{e==null&&(e=this.lines+1);let r=this.line(t).from;n=this.iterRange(r,Math.max(r,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new km(n)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?we.empty:t.length<=32?new Xe(t):mn.from(Xe.split(t,[]))}}class Xe extends we{constructor(t,e=l_(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,n,r){for(let o=0;;o++){let s=this.text[o],a=r+s.length;if((e?n:a)>=t)return new h_(r,a,n,s);r=a+1,n++}}decompose(t,e,n,r){let o=t<=0&&e>=this.length?this:new Xe(Gf(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(r&1){let s=n.pop(),a=Ca(o.text,s.text.slice(),0,o.length);if(a.length<=32)n.push(new Xe(a,s.length+o.length));else{let l=a.length>>1;n.push(new Xe(a.slice(0,l)),new Xe(a.slice(l)))}}else n.push(o)}replace(t,e,n){if(!(n instanceof Xe))return super.replace(t,e,n);[t,e]=hs(this,t,e);let r=Ca(this.text,Ca(n.text,Gf(this.text,0,t)),e),o=this.length+n.length-(e-t);return r.length<=32?new Xe(r,o):mn.from(Xe.split(r,[]),o)}sliceString(t,e=this.length,n=` `){[t,e]=hs(this,t,e);let r="";for(let o=0,s=0;o<=e&&st&&s&&(r+=n),to&&(r+=a.slice(Math.max(0,t-o),e-o)),o=l+1}return r}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let n=[],r=-1;for(let o of t)n.push(o),r+=o.length+1,n.length==32&&(e.push(new Xe(n,r)),n=[],r=-1);return r>-1&&e.push(new Xe(n,r)),e}}class mn extends we{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let n of t)this.lines+=n.lines}lineInner(t,e,n,r){for(let o=0;;o++){let s=this.children[o],a=r+s.length,l=n+s.lines-1;if((e?l:a)>=t)return s.lineInner(t,e,n,r);r=a+1,n=l+1}}decompose(t,e,n,r){for(let o=0,s=0;s<=e&&o=s){let u=r&((s<=t?1:0)|(l>=e?2:0));s>=t&&l<=e&&!u?n.push(a):a.decompose(t-s,e-s,n,u)}s=l+1}}replace(t,e,n){if([t,e]=hs(this,t,e),n.lines=o&&e<=a){let l=s.replace(t-o,e-o,n),u=this.lines-s.lines+l.lines;if(l.lines>5-1&&l.lines>u>>5+1){let c=this.children.slice();return c[r]=l,new mn(c,this.length-(e-t)+n.length)}return super.replace(o,a,l)}o=a+1}return super.replace(t,e,n)}sliceString(t,e=this.length,n=` `){[t,e]=hs(this,t,e);let r="";for(let o=0,s=0;ot&&o&&(r+=n),ts&&(r+=a.sliceString(t-s,e-s,n)),s=l+1}return r}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof mn))return 0;let n=0,[r,o,s,a]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;r+=e,o+=e){if(r==s||o==a)return n;let l=this.children[r],u=t.children[o];if(l!=u)return n+l.scanIdentical(u,e);n+=l.length+1}}static from(t,e=t.reduce((n,r)=>n+r.length+1,-1)){let n=0;for(let g of t)n+=g.lines;if(n<32){let g=[];for(let x of t)x.flatten(g);return new Xe(g,e)}let r=Math.max(32,n>>5),o=r<<1,s=r>>1,a=[],l=0,u=-1,c=[];function d(g){let x;if(g.lines>o&&g instanceof mn)for(let m of g.children)d(m);else g.lines>s&&(l>s||!l)?(f(),a.push(g)):g instanceof Xe&&l&&(x=c[c.length-1])instanceof Xe&&g.lines+x.lines<=32?(l+=g.lines,u+=g.length+1,c[c.length-1]=new Xe(x.text.concat(g.text),x.length+1+g.length)):(l+g.lines>r&&f(),l+=g.lines,u+=g.length+1,c.push(g))}function f(){l!=0&&(a.push(c.length==1?c[0]:mn.from(c,u)),u=-1,l=c.length=0)}for(let g of t)d(g);return f(),a.length==1?a[0]:new mn(a,e)}}we.empty=new Xe([""],0);function l_(i){let t=-1;for(let e of i)t+=e.length+1;return t}function Ca(i,t,e=0,n=1e9){for(let r=0,o=0,s=!0;o=e&&(l>n&&(a=a.slice(0,n-r)),r0?1:(t instanceof Xe?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],o=this.offsets[n],s=o>>1,a=r instanceof Xe?r.text.length:r.children.length;if(s==(e>0?a:0)){if(n==0)return this.done=!0,this.value="",this;e>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((o&1)==(e>0?0:1)){if(this.offsets[n]+=e,t==0)return this.lineBreak=!0,this.value=` -`,this;t--}else if(r instanceof Xe){let l=r.text[s+(e<0?-1:0)];if(this.offsets[n]+=e,l.length>Math.max(0,t))return this.value=t==0?l:e>0?l.slice(t):l.slice(0,l.length-t),this;t-=l.length}else{let l=r.children[s+(e<0?-1:0)];t>l.length?(t-=l.length,this.offsets[n]+=e):(e<0&&this.offsets[n]--,this.nodes.push(l),this.offsets.push(e>0?1:(l instanceof Xe?l.text.length:l.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class Pm{constructor(t,e,n){this.value="",this.done=!1,this.cursor=new Ws(t,e>n?-1:1),this.pos=e>n?t.length:0,this.from=Math.min(e,n),this.to=Math.max(e,n)}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 n=e<0?this.pos-this.from:this.to-this.pos;t>n&&(t=n),n-=t;let{value:r}=this.cursor.next(t);return this.pos+=(r.length+t)*e,this.value=r.length<=n?r:e<0?r.slice(r.length-n):r.slice(0,n),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 km{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:n,value:r}=this.inner.next(t);return e&&this.afterBreak?(this.value="",this.afterBreak=!1):e?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(we.prototype[Symbol.iterator]=function(){return this.iter()},Ws.prototype[Symbol.iterator]=Pm.prototype[Symbol.iterator]=km.prototype[Symbol.iterator]=function(){return this});class h_{constructor(t,e,n,r){this.from=t,this.to=e,this.number=n,this.text=r}get length(){return this.to-this.from}}function hs(i,t,e){return t=Math.max(0,Math.min(i.length,t)),[t,Math.max(t,Math.min(i.length,e))]}let Vr="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(i=>i?parseInt(i,36):1);for(let i=1;ii)return Vr[t-1]<=i;return!1}function Hf(i){return i>=127462&&i<=127487}const Jf=8205;function gi(i,t,e=!0,n=!0){return(e?Lm:c_)(i,t,n)}function Lm(i,t,e){if(t==i.length)return t;t&&Am(i.charCodeAt(t))&&Em(i.charCodeAt(t-1))&&t--;let n=ai(i,t);for(t+=Yi(n);t=0&&Hf(ai(i,s));)o++,s-=2;if(o%2==0)break;t+=2}else break}return t}function c_(i,t,e){for(;t>0;){let n=Lm(i,t-2,e);if(n=56320&&i<57344}function Em(i){return i>=55296&&i<56320}function ai(i,t){let e=i.charCodeAt(t);if(!Em(e)||t+1==i.length)return e;let n=i.charCodeAt(t+1);return Am(n)?(e-55296<<10)+(n-56320)+65536:e}function Lc(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function Yi(i){return i<65536?1:2}const xu=/\r\n?|\n/;var Je=function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i}(Je||(Je={}));class On{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return o+(t-r);o+=a}else{if(n!=Je.Simple&&u>=t&&(n==Je.TrackDel&&rt||n==Je.TrackBefore&&rt))return null;if(u>t||u==t&&e<0&&!a)return t==r||e<0?o:o+l;o+=l}r=u}if(t>r)throw new RangeError(`Position ${t} is out of range for changeset of length ${r}`);return o}touchesRange(t,e=t){for(let n=0,r=0;n=0&&r<=e&&a>=t)return re?"cover":!0;r=a}return!1}toString(){let t="";for(let e=0;e=0?":"+r:"")}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 On(t)}static create(t){return new On(t)}}class Ge extends On{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 bu(this,(e,n,r,o,s)=>t=t.replace(r,r+(n-e),s),!1),t}mapDesc(t,e=!1){return wu(this,t,e,!0)}invert(t){let e=this.sections.slice(),n=[];for(let r=0,o=0;r=0){e[r]=a,e[r+1]=s;let l=r>>1;for(;n.length0&&qn(n,e,o.text),o.forward(c),a+=c}let u=t[s++];for(;a>1].toJSON()))}return t}static of(t,e,n){let r=[],o=[],s=0,a=null;function l(c=!1){if(!c&&!r.length)return;sf||d<0||f>e)throw new RangeError(`Invalid change range ${d} to ${f} (in doc of length ${e})`);let x=g?typeof g=="string"?we.of(g.split(n||xu)):g:we.empty,m=x.length;if(d==f&&m==0)return;ds&&pi(r,d-s,-1),pi(r,f-d,m),qn(o,r,x),s=f}}return u(t),l(!a),a}static empty(t){return new Ge(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let e=[],n=[];for(let r=0;ra&&typeof s!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)e.push(o[0],0);else{for(;n.length=0&&e<=0&&e==i[r+1]?i[r]+=t:t==0&&i[r]==0?i[r+1]+=e:n?(i[r]+=t,i[r+1]+=e):i.push(t,e)}function qn(i,t,e){if(e.length==0)return;let n=t.length-2>>1;if(n>1])),!(e||s==i.sections.length||i.sections[s+1]<0);)a=i.sections[s++],l=i.sections[s++];t(r,u,o,c,d),r=u,o=c}}}function wu(i,t,e,n=!1){let r=[],o=n?[]:null,s=new eo(i),a=new eo(t);for(let l=-1;;)if(s.ins==-1&&a.ins==-1){let u=Math.min(s.len,a.len);pi(r,u,-1),s.forward(u),a.forward(u)}else if(a.ins>=0&&(s.ins<0||l==s.i||s.off==0&&(a.len=0&&l=0){let u=0,c=s.len;for(;c;)if(a.ins==-1){let d=Math.min(c,a.len);u+=d,c-=d,a.forward(d)}else if(a.ins==0&&a.lenl||s.ins>=0&&s.len>l)&&(a||n.length>u),o.forward2(l),s.forward(l)}}}}class eo{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return e>=t.length?we.empty:t[e]}textBit(t){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length&&!t?we.empty:e[n].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 yr{constructor(t,e,n){this.from=t,this.to=e,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}get goalColumn(){let t=this.flags>>6;return t==16777215?void 0:t}map(t,e=-1){let n,r;return this.empty?n=r=t.mapPos(this.from,e):(n=t.mapPos(this.from,1),r=t.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new yr(n,r,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return yt.range(t,e);let n=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return yt.range(this.anchor,n)}eq(t,e=!1){return this.anchor==t.anchor&&this.head==t.head&&(!e||!this.empty||this.assoc==t.assoc)}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 yt.range(t.anchor,t.head)}static create(t,e,n){return new yr(t,e,n)}}class yt{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:yt.create(this.ranges.map(n=>n.map(t,e)),this.mainIndex)}eq(t,e=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let n=0;nt.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 yt(t.ranges.map(e=>yr.fromJSON(e)),t.main)}static single(t,e=t){return new yt([yt.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 n=0,r=0;rt?8:0)|o)}static normalized(t,e=0){let n=t[e];t.sort((r,o)=>r.from-o.from),e=t.indexOf(n);for(let r=1;ro.head?yt.range(l,a):yt.range(a,l))}}return new yt(t,e)}}function Tm(i,t){for(let e of i.ranges)if(e.to>t)throw new RangeError("Selection points outside of document")}let Ac=0;class Zt{constructor(t,e,n,r,o){this.combine=t,this.compareInput=e,this.compare=n,this.isStatic=r,this.id=Ac++,this.default=t([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(t={}){return new Zt(t.combine||(e=>e),t.compareInput||((e,n)=>e===n),t.compare||(t.combine?(e,n)=>e===n:Ec),!!t.static,t.enables)}of(t){return new Pa([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new Pa(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new Pa(t,this,2,e)}from(t,e){return e||(e=n=>n),this.compute([t],n=>e(n.field(t)))}}function Ec(i,t){return i==t||i.length==t.length&&i.every((e,n)=>e===t[n])}class Pa{constructor(t,e,n,r){this.dependencies=t,this.facet=e,this.type=n,this.value=r,this.id=Ac++}dynamicSlot(t){var e;let n=this.value,r=this.facet.compareInput,o=this.id,s=t[o]>>1,a=this.type==2,l=!1,u=!1,c=[];for(let d of this.dependencies)d=="doc"?l=!0:d=="selection"?u=!0:((e=t[d.id])!==null&&e!==void 0?e:1)&1||c.push(t[d.id]);return{create(d){return d.values[s]=n(d),1},update(d,f){if(l&&f.docChanged||u&&(f.docChanged||f.selection)||Su(d,c)){let g=n(d);if(a?!Kf(g,d.values[s],r):!r(g,d.values[s]))return d.values[s]=g,1}return 0},reconfigure:(d,f)=>{let g,x=f.config.address[o];if(x!=null){let m=Ba(f,x);if(this.dependencies.every(v=>v instanceof Zt?f.facet(v)===d.facet(v):v instanceof ti?f.field(v,!1)==d.field(v,!1):!0)||(a?Kf(g=n(d),m,r):r(g=n(d),m)))return d.values[s]=m,0}else g=n(d);return d.values[s]=g,1}}}}function Kf(i,t,e){if(i.length!=t.length)return!1;for(let n=0;ni[l.id]),r=e.map(l=>l.type),o=n.filter(l=>!(l&1)),s=i[t.id]>>1;function a(l){let u=[];for(let c=0;cn===r),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(td).find(n=>n.field==this);return((e==null?void 0:e.create)||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:n=>(n.values[e]=this.create(n),1),update:(n,r)=>{let o=n.values[e],s=this.updateF(o,r);return this.compareF(o,s)?0:(n.values[e]=s,1)},reconfigure:(n,r)=>r.config.address[this.id]!=null?(n.values[e]=r.field(this),0):(n.values[e]=this.create(n),1)}}init(t){return[this,td.of({field:this,create:t})]}get extension(){return this}}const mr={lowest:4,low:3,default:2,high:1,highest:0};function Ss(i){return t=>new Im(t,i)}const lr={highest:Ss(mr.highest),high:Ss(mr.high),default:Ss(mr.default),low:Ss(mr.low),lowest:Ss(mr.lowest)};class Im{constructor(t,e){this.inner=t,this.prec=e}}class Ll{of(t){return new Cu(this,t)}reconfigure(t){return Ll.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class Cu{constructor(t,e){this.compartment=t,this.inner=e}}class Na{constructor(t,e,n,r,o,s){for(this.base=t,this.compartments=e,this.dynamicSlots=n,this.address=r,this.staticValues=o,this.facets=s,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,e,n){let r=[],o=Object.create(null),s=new Map;for(let f of d_(t,e,s))f instanceof ti?r.push(f):(o[f.facet.id]||(o[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],u=[];for(let f of r)a[f.id]=u.length<<1,u.push(g=>f.slot(g));let c=n==null?void 0:n.config.facets;for(let f in o){let g=o[f],x=g[0].facet,m=c&&c[f]||[];if(g.every(v=>v.type==0))if(a[x.id]=l.length<<1|1,Ec(m,g))l.push(n.facet(x));else{let v=x.combine(g.map(O=>O.value));l.push(n&&x.compare(v,n.facet(x))?n.facet(x):v)}else{for(let v of g)v.type==0?(a[v.id]=l.length<<1|1,l.push(v.value)):(a[v.id]=u.length<<1,u.push(O=>v.dynamicSlot(O)));a[x.id]=u.length<<1,u.push(v=>f_(v,x,g))}}let d=u.map(f=>f(a));return new Na(t,s,d,a,l,o)}}function d_(i,t,e){let n=[[],[],[],[],[]],r=new Map;function o(s,a){let l=r.get(s);if(l!=null){if(l<=a)return;let u=n[l].indexOf(s);u>-1&&n[l].splice(u,1),s instanceof Cu&&e.delete(s.compartment)}if(r.set(s,a),Array.isArray(s))for(let u of s)o(u,a);else if(s instanceof Cu){if(e.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=t.get(s.compartment)||s.inner;e.set(s.compartment,u),o(u,a)}else if(s instanceof Im)o(s.inner,s.prec);else if(s instanceof ti)n[a].push(s),s.provides&&o(s.provides,a);else if(s instanceof Pa)n[a].push(s),s.facet.extensions&&o(s.facet.extensions,mr.default);else{let u=s.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(u,a)}}return o(i,mr.default),n.reduce((s,a)=>s.concat(a))}function Us(i,t){if(t&1)return 2;let e=t>>1,n=i.status[e];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;i.status[e]=4;let r=i.computeSlot(i,i.config.dynamicSlots[e]);return i.status[e]=2|r}function Ba(i,t){return t&1?i.config.staticValues[t>>1]:i.values[t>>1]}const Mm=Zt.define(),Pu=Zt.define({combine:i=>i.some(t=>t),static:!0}),$m=Zt.define({combine:i=>i.length?i[0]:void 0,static:!0}),Qm=Zt.define(),Nm=Zt.define(),Bm=Zt.define(),Fm=Zt.define({combine:i=>i.length?i[0]:!1});class In{constructor(t,e){this.type=t,this.value=e}static define(){return new p_}}class p_{of(t){return new In(this,t)}}class m_{constructor(t){this.map=t}of(t){return new re(this,t)}}class re{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 re(this.type,e)}is(t){return this.type==t}static define(t={}){return new m_(t.map||(e=>e))}static mapEffects(t,e){if(!t.length)return t;let n=[];for(let r of t){let o=r.map(e);o&&n.push(o)}return n}}re.reconfigure=re.define();re.appendConfig=re.define();class Ke{constructor(t,e,n,r,o,s){this.startState=t,this.changes=e,this.selection=n,this.effects=r,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,n&&Tm(n,e.newLength),o.some(a=>a.type==Ke.time)||(this.annotations=o.concat(Ke.time.of(Date.now())))}static create(t,e,n,r,o,s){return new Ke(t,e,n,r,o,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(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(Ke.userEvent);return!!(e&&(e==t||e.length>t.length&&e.slice(0,t.length)==t&&e[t.length]=="."))}}Ke.time=In.define();Ke.userEvent=In.define();Ke.addToHistory=In.define();Ke.remote=In.define();function g_(i,t){let e=[];for(let n=0,r=0;;){let o,s;if(n=i[n]))o=i[n++],s=i[n++];else if(r=0;r--){let o=n[r](i);o instanceof Ke?i=o:Array.isArray(o)&&o.length==1&&o[0]instanceof Ke?i=o[0]:i=Rm(t,Gr(o),!1)}return i}function y_(i){let t=i.startState,e=t.facet(Bm),n=i;for(let r=e.length-1;r>=0;r--){let o=e[r](i);o&&Object.keys(o).length&&(n=Xm(n,ku(t,o,i.changes.newLength),!0))}return n==i?i:Ke.create(t,i.changes,i.selection,n.effects,n.annotations,n.scrollIntoView)}const O_=[];function Gr(i){return i==null?O_:Array.isArray(i)?i:[i]}var Ne=function(i){return i[i.Word=0]="Word",i[i.Space=1]="Space",i[i.Other=2]="Other",i}(Ne||(Ne={}));const __=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Lu;try{Lu=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function x_(i){if(Lu)return Lu.test(i);for(let t=0;t"€"&&(e.toUpperCase()!=e.toLowerCase()||__.test(e)))return!0}return!1}function b_(i){return t=>{if(!/\S/.test(t))return Ne.Space;if(x_(t))return Ne.Word;for(let e=0;e-1)return Ne.Word;return Ne.Other}}class ye{constructor(t,e,n,r,o,s){this.config=t,this.doc=e,this.selection=n,this.values=r,this.status=t.statusTemplate.slice(),this.computeSlot=o,s&&(s._state=this);for(let a=0;ar.set(u,l)),e=null),r.set(a.value.compartment,a.value.extension)):a.is(re.reconfigure)?(e=null,n=a.value):a.is(re.appendConfig)&&(e=null,n=Gr(n).concat(a.value));let o;e?o=t.startState.values.slice():(e=Na.resolve(n,r,this),o=new ye(e,this.doc,this.selection,e.dynamicSlots.map(()=>null),(l,u)=>u.reconfigure(l,this),null).values);let s=t.startState.facet(Pu)?t.newSelection:t.newSelection.asSingle();new ye(e,t.newDoc,s,o,(a,l)=>l.update(a,t),t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:t},range:yt.cursor(e.from+t.length)}))}changeByRange(t){let e=this.selection,n=t(e.ranges[0]),r=this.changes(n.changes),o=[n.range],s=Gr(n.effects);for(let a=1;as.spec.fromJSON(a,l)))}}return ye.create({doc:t.doc,selection:yt.fromJSON(t.selection),extensions:e.extensions?r.concat([e.extensions]):r})}static create(t={}){let e=Na.resolve(t.extensions||[],new Map),n=t.doc instanceof we?t.doc:we.of((t.doc||"").split(e.staticFacet(ye.lineSeparator)||xu)),r=t.selection?t.selection instanceof yt?t.selection:yt.single(t.selection.anchor,t.selection.head):yt.single(0);return Tm(r,n.length),e.staticFacet(Pu)||(r=r.asSingle()),new ye(e,n,r,e.dynamicSlots.map(()=>null),(o,s)=>s.create(o),null)}get tabSize(){return this.facet(ye.tabSize)}get lineBreak(){return this.facet(ye.lineSeparator)||` -`}get readOnly(){return this.facet(Fm)}phrase(t,...e){for(let n of this.facet(ye.phrases))if(Object.prototype.hasOwnProperty.call(n,t)){t=n[t];break}return e.length&&(t=t.replace(/\$(\$|\d*)/g,(n,r)=>{if(r=="$")return"$";let o=+(r||1);return!o||o>e.length?n:e[o-1]})),t}languageDataAt(t,e,n=-1){let r=[];for(let o of this.facet(Mm))for(let s of o(this,e,n))Object.prototype.hasOwnProperty.call(s,t)&&r.push(s[t]);return r}charCategorizer(t){return b_(this.languageDataAt("wordChars",t).join(""))}wordAt(t){let{text:e,from:n,length:r}=this.doc.lineAt(t),o=this.charCategorizer(t),s=t-n,a=t-n;for(;s>0;){let l=gi(e,s,!1);if(o(e.slice(l,s))!=Ne.Word)break;s=l}for(;ai.length?i[0]:4});ye.lineSeparator=$m;ye.readOnly=Fm;ye.phrases=Zt.define({compare(i,t){let e=Object.keys(i),n=Object.keys(t);return e.length==n.length&&e.every(r=>i[r]==t[r])}});ye.languageData=Mm;ye.changeFilter=Qm;ye.transactionFilter=Nm;ye.transactionExtender=Bm;Ll.reconfigure=re.define();function xn(i,t,e={}){let n={};for(let r of i)for(let o of Object.keys(r)){let s=r[o],a=n[o];if(a===void 0)n[o]=s;else if(!(a===s||s===void 0))if(Object.hasOwnProperty.call(e,o))n[o]=e[o](a,s);else throw new Error("Config merge conflict for field "+o)}for(let r in t)n[r]===void 0&&(n[r]=t[r]);return n}class kr{eq(t){return this==t}range(t,e=t){return Au.create(t,e,this)}}kr.prototype.startSide=kr.prototype.endSide=0;kr.prototype.point=!1;kr.prototype.mapMode=Je.TrackDel;let Au=class Ym{constructor(t,e,n){this.from=t,this.to=e,this.value=n}static create(t,e,n){return new Ym(t,e,n)}};function Eu(i,t){return i.from-t.from||i.value.startSide-t.value.startSide}class Dc{constructor(t,e,n,r){this.from=t,this.to=e,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(t,e,n,r=0){let o=n?this.to:this.from;for(let s=r,a=o.length;;){if(s==a)return s;let l=s+a>>1,u=o[l]-t||(n?this.value[l].endSide:this.value[l].startSide)-e;if(l==s)return u>=0?s:a;u>=0?a=l:s=l+1}}between(t,e,n,r){for(let o=this.findIndex(e,-1e9,!0),s=this.findIndex(n,1e9,!1,o);og||f==g&&u.startSide>0&&u.endSide<=0)continue;(g-f||u.endSide-u.startSide)<0||(s<0&&(s=f),u.point&&(a=Math.max(a,g-f)),n.push(u),r.push(f-s),o.push(g-s))}return{mapped:n.length?new Dc(r,o,n,a):null,pos:s}}}class ge{constructor(t,e,n,r){this.chunkPos=t,this.chunk=e,this.nextLayer=n,this.maxPoint=r}static create(t,e,n,r){return new ge(t,e,n,r)}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:n=!1,filterFrom:r=0,filterTo:o=this.length}=t,s=t.filter;if(e.length==0&&!s)return this;if(n&&(e=e.slice().sort(Eu)),this.isEmpty)return e.length?ge.of(e):this;let a=new Zm(this,null,-1).goto(0),l=0,u=[],c=new _n;for(;a.value||l=0){let d=e[l++];c.addInner(d.from,d.to,d.value)||u.push(d)}else a.rangeIndex==1&&a.chunkIndexthis.chunkEnd(a.chunkIndex)||oa.to||o=o&&t<=o+s.length&&s.between(o,t-o,e-o,n)===!1)return}this.nextLayer.between(t,e,n)}}iter(t=0){return io.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return io.from(t).goto(e)}static compare(t,e,n,r,o=-1){let s=t.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=o),a=e.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=o),l=ed(s,a,n),u=new Cs(s,l,o),c=new Cs(a,l,o);n.iterGaps((d,f,g)=>id(u,d,c,f,g,r)),n.empty&&n.length==0&&id(u,0,c,0,0,r)}static eq(t,e,n=0,r){r==null&&(r=1e9-1);let o=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0),s=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0);if(o.length!=s.length)return!1;if(!o.length)return!0;let a=ed(o,s),l=new Cs(o,a,0).goto(n),u=new Cs(s,a,0).goto(n);for(;;){if(l.to!=u.to||!Du(l.active,u.active)||l.point&&(!u.point||!l.point.eq(u.point)))return!1;if(l.to>r)return!0;l.next(),u.next()}}static spans(t,e,n,r,o=-1){let s=new Cs(t,null,o).goto(e),a=e,l=s.openStart;for(;;){let u=Math.min(s.to,n);if(s.point){let c=s.activeForPoint(s.to),d=s.pointFroma&&(r.span(a,u,s.active,l),l=s.openEnd(u));if(s.to>n)return l+(s.point&&s.to>n?1:0);a=s.to,s.next()}}static of(t,e=!1){let n=new _n;for(let r of t instanceof Au?[t]:e?w_(t):t)n.add(r.from,r.to,r.value);return n.finish()}static join(t){if(!t.length)return ge.empty;let e=t[t.length-1];for(let n=t.length-2;n>=0;n--)for(let r=t[n];r!=ge.empty;r=r.nextLayer)e=new ge(r.chunkPos,r.chunk,e,Math.max(r.maxPoint,e.maxPoint));return e}}ge.empty=new ge([],[],null,-1);function w_(i){if(i.length>1)for(let t=i[0],e=1;e0)return i.slice().sort(Eu);t=n}return i}ge.empty.nextLayer=ge.empty;class _n{finishChunk(t){this.chunks.push(new Dc(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=[])}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(t,e,n){this.addInner(t,e,n)||(this.nextLayer||(this.nextLayer=new _n)).add(t,e,n)}addInner(t,e,n){let r=t-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&(t-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<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=n,this.lastFrom=t,this.lastTo=e,this.value.push(n),n.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 n=e.value.length-1;return this.last=e.value[n],this.lastFrom=e.from[n]+t,this.lastTo=e.to[n]+t,!0}finish(){return this.finishInner(ge.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let e=ge.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function ed(i,t,e){let n=new Map;for(let o of i)for(let s=0;s=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=n&&r.push(new Zm(s,e,n,o));return r.length==1?r[0]:new io(r)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let n of this.heap)n.goto(t,e);for(let n=this.heap.length>>1;n>=0;n--)xh(this.heap,n);return this.next(),this}forward(t,e){for(let n of this.heap)n.forward(t,e);for(let n=this.heap.length>>1;n>=0;n--)xh(this.heap,n);(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(),xh(this.heap,0)}}}function xh(i,t){for(let e=i[t];;){let n=(t<<1)+1;if(n>=i.length)break;let r=i[n];if(n+1=0&&(r=i[n+1],n++),e.compare(r)<0)break;i[n]=e,i[t]=r,t=n}}class Cs{constructor(t,e,n){this.minPoint=n,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=io.from(t,e,n)}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){Wo(this.active,t),Wo(this.activeTo,t),Wo(this.activeRank,t),this.minActive=nd(this.active,this.activeTo)}addActive(t){let e=0,{value:n,to:r,rank:o}=this.cursor;for(;e0;)e++;Uo(this.active,e,n),Uo(this.activeTo,e,r),Uo(this.activeRank,e,o),t&&Uo(t,e,this.cursor.from),this.minActive=nd(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let n=this.openStart<0?[]:null;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),n&&Wo(n,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(n),this.cursor.next();else if(e&&this.cursor.to==this.to&&this.cursor.from=0&&n[r]=0&&!(this.activeRank[n]t||this.activeTo[n]==t&&this.active[n].endSide>=this.point.endSide)&&e.push(this.active[n]);return e.reverse()}openEnd(t){let e=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>t;n--)e++;return e}}function id(i,t,e,n,r,o){i.goto(t),e.goto(n);let s=n+r,a=n,l=n-t;for(;;){let u=i.to+l-e.to||i.endSide-e.endSide,c=u<0?i.to+l:e.to,d=Math.min(c,s);if(i.point||e.point?i.point&&e.point&&(i.point==e.point||i.point.eq(e.point))&&Du(i.activeForPoint(i.to),e.activeForPoint(e.to))||o.comparePoint(a,d,i.point,e.point):d>a&&!Du(i.active,e.active)&&o.compareRange(a,d,i.active,e.active),c>s)break;a=c,u<=0&&i.next(),u>=0&&e.next()}}function Du(i,t){if(i.length!=t.length)return!1;for(let e=0;e=t;n--)i[n+1]=i[n];i[t]=e}function nd(i,t){let e=-1,n=1e9;for(let r=0;r=t)return r;if(r==i.length)break;o+=i.charCodeAt(r)==9?e-o%e:1,r=gi(i,r)}return n===!0?-1:i.length}const Iu="ͼ",rd=typeof Symbol>"u"?"__"+Iu:Symbol.for(Iu),Mu=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),sd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ir{constructor(t,e){this.rules=[];let{finish:n}=e||{};function r(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function o(s,a,l,u){let c=[],d=/^@(\w+)\b/.exec(s[0]),f=d&&d[1]=="keyframes";if(d&&a==null)return l.push(s[0]+";");for(let g in a){let x=a[g];if(/&/.test(g))o(g.split(/,\s*/).map(m=>s.map(v=>m.replace(/&/,v))).reduce((m,v)=>m.concat(v)),x,l);else if(x&&typeof x=="object"){if(!d)throw new RangeError("The value of a property ("+g+") should be a primitive value.");o(r(g),x,c,f)}else x!=null&&c.push(g.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+x+";")}(c.length||f)&&l.push((n&&!d&&!u?s.map(n):s).join(", ")+" {"+c.join(" ")+"}")}for(let s in t)o(r(s),t[s],this.rules)}getRules(){return this.rules.join(` +`,this;t--}else if(r instanceof Xe){let l=r.text[s+(e<0?-1:0)];if(this.offsets[n]+=e,l.length>Math.max(0,t))return this.value=t==0?l:e>0?l.slice(t):l.slice(0,l.length-t),this;t-=l.length}else{let l=r.children[s+(e<0?-1:0)];t>l.length?(t-=l.length,this.offsets[n]+=e):(e<0&&this.offsets[n]--,this.nodes.push(l),this.offsets.push(e>0?1:(l instanceof Xe?l.text.length:l.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class Pm{constructor(t,e,n){this.value="",this.done=!1,this.cursor=new Ws(t,e>n?-1:1),this.pos=e>n?t.length:0,this.from=Math.min(e,n),this.to=Math.max(e,n)}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 n=e<0?this.pos-this.from:this.to-this.pos;t>n&&(t=n),n-=t;let{value:r}=this.cursor.next(t);return this.pos+=(r.length+t)*e,this.value=r.length<=n?r:e<0?r.slice(r.length-n):r.slice(0,n),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 km{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:n,value:r}=this.inner.next(t);return e&&this.afterBreak?(this.value="",this.afterBreak=!1):e?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(we.prototype[Symbol.iterator]=function(){return this.iter()},Ws.prototype[Symbol.iterator]=Pm.prototype[Symbol.iterator]=km.prototype[Symbol.iterator]=function(){return this});class h_{constructor(t,e,n,r){this.from=t,this.to=e,this.number=n,this.text=r}get length(){return this.to-this.from}}function hs(i,t,e){return t=Math.max(0,Math.min(i.length,t)),[t,Math.max(t,Math.min(i.length,e))]}let Vr="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(i=>i?parseInt(i,36):1);for(let i=1;ii)return Vr[t-1]<=i;return!1}function Hf(i){return i>=127462&&i<=127487}const Jf=8205;function gi(i,t,e=!0,n=!0){return(e?Lm:c_)(i,t,n)}function Lm(i,t,e){if(t==i.length)return t;t&&Am(i.charCodeAt(t))&&Em(i.charCodeAt(t-1))&&t--;let n=ai(i,t);for(t+=Yi(n);t=0&&Hf(ai(i,s));)o++,s-=2;if(o%2==0)break;t+=2}else break}return t}function c_(i,t,e){for(;t>0;){let n=Lm(i,t-2,e);if(n=56320&&i<57344}function Em(i){return i>=55296&&i<56320}function ai(i,t){let e=i.charCodeAt(t);if(!Em(e)||t+1==i.length)return e;let n=i.charCodeAt(t+1);return Am(n)?(e-55296<<10)+(n-56320)+65536:e}function Lc(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function Yi(i){return i<65536?1:2}const xu=/\r\n?|\n/;var Je=function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i}(Je||(Je={}));class On{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return o+(t-r);o+=a}else{if(n!=Je.Simple&&u>=t&&(n==Je.TrackDel&&rt||n==Je.TrackBefore&&rt))return null;if(u>t||u==t&&e<0&&!a)return t==r||e<0?o:o+l;o+=l}r=u}if(t>r)throw new RangeError(`Position ${t} is out of range for changeset of length ${r}`);return o}touchesRange(t,e=t){for(let n=0,r=0;n=0&&r<=e&&a>=t)return re?"cover":!0;r=a}return!1}toString(){let t="";for(let e=0;e=0?":"+r:"")}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 On(t)}static create(t){return new On(t)}}class Ge extends On{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 bu(this,(e,n,r,o,s)=>t=t.replace(r,r+(n-e),s),!1),t}mapDesc(t,e=!1){return wu(this,t,e,!0)}invert(t){let e=this.sections.slice(),n=[];for(let r=0,o=0;r=0){e[r]=a,e[r+1]=s;let l=r>>1;for(;n.length0&&qn(n,e,o.text),o.forward(c),a+=c}let u=t[s++];for(;a>1].toJSON()))}return t}static of(t,e,n){let r=[],o=[],s=0,a=null;function l(c=!1){if(!c&&!r.length)return;sf||d<0||f>e)throw new RangeError(`Invalid change range ${d} to ${f} (in doc of length ${e})`);let x=g?typeof g=="string"?we.of(g.split(n||xu)):g:we.empty,m=x.length;if(d==f&&m==0)return;ds&&pi(r,d-s,-1),pi(r,f-d,m),qn(o,r,x),s=f}}return u(t),l(!a),a}static empty(t){return new Ge(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let e=[],n=[];for(let r=0;ra&&typeof s!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)e.push(o[0],0);else{for(;n.length=0&&e<=0&&e==i[r+1]?i[r]+=t:t==0&&i[r]==0?i[r+1]+=e:n?(i[r]+=t,i[r+1]+=e):i.push(t,e)}function qn(i,t,e){if(e.length==0)return;let n=t.length-2>>1;if(n>1])),!(e||s==i.sections.length||i.sections[s+1]<0);)a=i.sections[s++],l=i.sections[s++];t(r,u,o,c,d),r=u,o=c}}}function wu(i,t,e,n=!1){let r=[],o=n?[]:null,s=new eo(i),a=new eo(t);for(let l=-1;;)if(s.ins==-1&&a.ins==-1){let u=Math.min(s.len,a.len);pi(r,u,-1),s.forward(u),a.forward(u)}else if(a.ins>=0&&(s.ins<0||l==s.i||s.off==0&&(a.len=0&&l=0){let u=0,c=s.len;for(;c;)if(a.ins==-1){let d=Math.min(c,a.len);u+=d,c-=d,a.forward(d)}else if(a.ins==0&&a.lenl||s.ins>=0&&s.len>l)&&(a||n.length>u),o.forward2(l),s.forward(l)}}}}class eo{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return e>=t.length?we.empty:t[e]}textBit(t){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length&&!t?we.empty:e[n].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 yr{constructor(t,e,n){this.from=t,this.to=e,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}get goalColumn(){let t=this.flags>>6;return t==16777215?void 0:t}map(t,e=-1){let n,r;return this.empty?n=r=t.mapPos(this.from,e):(n=t.mapPos(this.from,1),r=t.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new yr(n,r,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return yt.range(t,e);let n=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return yt.range(this.anchor,n)}eq(t,e=!1){return this.anchor==t.anchor&&this.head==t.head&&(!e||!this.empty||this.assoc==t.assoc)}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 yt.range(t.anchor,t.head)}static create(t,e,n){return new yr(t,e,n)}}class yt{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:yt.create(this.ranges.map(n=>n.map(t,e)),this.mainIndex)}eq(t,e=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let n=0;nt.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 yt(t.ranges.map(e=>yr.fromJSON(e)),t.main)}static single(t,e=t){return new yt([yt.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 n=0,r=0;rt?8:0)|o)}static normalized(t,e=0){let n=t[e];t.sort((r,o)=>r.from-o.from),e=t.indexOf(n);for(let r=1;ro.head?yt.range(l,a):yt.range(a,l))}}return new yt(t,e)}}function Tm(i,t){for(let e of i.ranges)if(e.to>t)throw new RangeError("Selection points outside of document")}let Ac=0;class Zt{constructor(t,e,n,r,o){this.combine=t,this.compareInput=e,this.compare=n,this.isStatic=r,this.id=Ac++,this.default=t([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(t={}){return new Zt(t.combine||(e=>e),t.compareInput||((e,n)=>e===n),t.compare||(t.combine?(e,n)=>e===n:Ec),!!t.static,t.enables)}of(t){return new Pa([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new Pa(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new Pa(t,this,2,e)}from(t,e){return e||(e=n=>n),this.compute([t],n=>e(n.field(t)))}}function Ec(i,t){return i==t||i.length==t.length&&i.every((e,n)=>e===t[n])}class Pa{constructor(t,e,n,r){this.dependencies=t,this.facet=e,this.type=n,this.value=r,this.id=Ac++}dynamicSlot(t){var e;let n=this.value,r=this.facet.compareInput,o=this.id,s=t[o]>>1,a=this.type==2,l=!1,u=!1,c=[];for(let d of this.dependencies)d=="doc"?l=!0:d=="selection"?u=!0:((e=t[d.id])!==null&&e!==void 0?e:1)&1||c.push(t[d.id]);return{create(d){return d.values[s]=n(d),1},update(d,f){if(l&&f.docChanged||u&&(f.docChanged||f.selection)||Su(d,c)){let g=n(d);if(a?!Kf(g,d.values[s],r):!r(g,d.values[s]))return d.values[s]=g,1}return 0},reconfigure:(d,f)=>{let g,x=f.config.address[o];if(x!=null){let m=Ba(f,x);if(this.dependencies.every(v=>v instanceof Zt?f.facet(v)===d.facet(v):v instanceof ti?f.field(v,!1)==d.field(v,!1):!0)||(a?Kf(g=n(d),m,r):r(g=n(d),m)))return d.values[s]=m,0}else g=n(d);return d.values[s]=g,1}}}}function Kf(i,t,e){if(i.length!=t.length)return!1;for(let n=0;ni[l.id]),r=e.map(l=>l.type),o=n.filter(l=>!(l&1)),s=i[t.id]>>1;function a(l){let u=[];for(let c=0;cn===r),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(td).find(n=>n.field==this);return((e==null?void 0:e.create)||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:n=>(n.values[e]=this.create(n),1),update:(n,r)=>{let o=n.values[e],s=this.updateF(o,r);return this.compareF(o,s)?0:(n.values[e]=s,1)},reconfigure:(n,r)=>r.config.address[this.id]!=null?(n.values[e]=r.field(this),0):(n.values[e]=this.create(n),1)}}init(t){return[this,td.of({field:this,create:t})]}get extension(){return this}}const mr={lowest:4,low:3,default:2,high:1,highest:0};function Ss(i){return t=>new Im(t,i)}const lr={highest:Ss(mr.highest),high:Ss(mr.high),default:Ss(mr.default),low:Ss(mr.low),lowest:Ss(mr.lowest)};class Im{constructor(t,e){this.inner=t,this.prec=e}}class Ll{of(t){return new Cu(this,t)}reconfigure(t){return Ll.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class Cu{constructor(t,e){this.compartment=t,this.inner=e}}class Na{constructor(t,e,n,r,o,s){for(this.base=t,this.compartments=e,this.dynamicSlots=n,this.address=r,this.staticValues=o,this.facets=s,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,e,n){let r=[],o=Object.create(null),s=new Map;for(let f of d_(t,e,s))f instanceof ti?r.push(f):(o[f.facet.id]||(o[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],u=[];for(let f of r)a[f.id]=u.length<<1,u.push(g=>f.slot(g));let c=n==null?void 0:n.config.facets;for(let f in o){let g=o[f],x=g[0].facet,m=c&&c[f]||[];if(g.every(v=>v.type==0))if(a[x.id]=l.length<<1|1,Ec(m,g))l.push(n.facet(x));else{let v=x.combine(g.map(O=>O.value));l.push(n&&x.compare(v,n.facet(x))?n.facet(x):v)}else{for(let v of g)v.type==0?(a[v.id]=l.length<<1|1,l.push(v.value)):(a[v.id]=u.length<<1,u.push(O=>v.dynamicSlot(O)));a[x.id]=u.length<<1,u.push(v=>f_(v,x,g))}}let d=u.map(f=>f(a));return new Na(t,s,d,a,l,o)}}function d_(i,t,e){let n=[[],[],[],[],[]],r=new Map;function o(s,a){let l=r.get(s);if(l!=null){if(l<=a)return;let u=n[l].indexOf(s);u>-1&&n[l].splice(u,1),s instanceof Cu&&e.delete(s.compartment)}if(r.set(s,a),Array.isArray(s))for(let u of s)o(u,a);else if(s instanceof Cu){if(e.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=t.get(s.compartment)||s.inner;e.set(s.compartment,u),o(u,a)}else if(s instanceof Im)o(s.inner,s.prec);else if(s instanceof ti)n[a].push(s),s.provides&&o(s.provides,a);else if(s instanceof Pa)n[a].push(s),s.facet.extensions&&o(s.facet.extensions,mr.default);else{let u=s.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(u,a)}}return o(i,mr.default),n.reduce((s,a)=>s.concat(a))}function Us(i,t){if(t&1)return 2;let e=t>>1,n=i.status[e];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;i.status[e]=4;let r=i.computeSlot(i,i.config.dynamicSlots[e]);return i.status[e]=2|r}function Ba(i,t){return t&1?i.config.staticValues[t>>1]:i.values[t>>1]}const Mm=Zt.define(),Pu=Zt.define({combine:i=>i.some(t=>t),static:!0}),$m=Zt.define({combine:i=>i.length?i[0]:void 0,static:!0}),Qm=Zt.define(),Nm=Zt.define(),Bm=Zt.define(),Fm=Zt.define({combine:i=>i.length?i[0]:!1});class In{constructor(t,e){this.type=t,this.value=e}static define(){return new p_}}class p_{of(t){return new In(this,t)}}class m_{constructor(t){this.map=t}of(t){return new re(this,t)}}class re{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 re(this.type,e)}is(t){return this.type==t}static define(t={}){return new m_(t.map||(e=>e))}static mapEffects(t,e){if(!t.length)return t;let n=[];for(let r of t){let o=r.map(e);o&&n.push(o)}return n}}re.reconfigure=re.define();re.appendConfig=re.define();class Ke{constructor(t,e,n,r,o,s){this.startState=t,this.changes=e,this.selection=n,this.effects=r,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,n&&Tm(n,e.newLength),o.some(a=>a.type==Ke.time)||(this.annotations=o.concat(Ke.time.of(Date.now())))}static create(t,e,n,r,o,s){return new Ke(t,e,n,r,o,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(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(Ke.userEvent);return!!(e&&(e==t||e.length>t.length&&e.slice(0,t.length)==t&&e[t.length]=="."))}}Ke.time=In.define();Ke.userEvent=In.define();Ke.addToHistory=In.define();Ke.remote=In.define();function g_(i,t){let e=[];for(let n=0,r=0;;){let o,s;if(n=i[n]))o=i[n++],s=i[n++];else if(r=0;r--){let o=n[r](i);o instanceof Ke?i=o:Array.isArray(o)&&o.length==1&&o[0]instanceof Ke?i=o[0]:i=Rm(t,Gr(o),!1)}return i}function y_(i){let t=i.startState,e=t.facet(Bm),n=i;for(let r=e.length-1;r>=0;r--){let o=e[r](i);o&&Object.keys(o).length&&(n=Xm(n,ku(t,o,i.changes.newLength),!0))}return n==i?i:Ke.create(t,i.changes,i.selection,n.effects,n.annotations,n.scrollIntoView)}const O_=[];function Gr(i){return i==null?O_:Array.isArray(i)?i:[i]}var Ne=function(i){return i[i.Word=0]="Word",i[i.Space=1]="Space",i[i.Other=2]="Other",i}(Ne||(Ne={}));const __=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Lu;try{Lu=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function x_(i){if(Lu)return Lu.test(i);for(let t=0;t"€"&&(e.toUpperCase()!=e.toLowerCase()||__.test(e)))return!0}return!1}function b_(i){return t=>{if(!/\S/.test(t))return Ne.Space;if(x_(t))return Ne.Word;for(let e=0;e-1)return Ne.Word;return Ne.Other}}class Oe{constructor(t,e,n,r,o,s){this.config=t,this.doc=e,this.selection=n,this.values=r,this.status=t.statusTemplate.slice(),this.computeSlot=o,s&&(s._state=this);for(let a=0;ar.set(u,l)),e=null),r.set(a.value.compartment,a.value.extension)):a.is(re.reconfigure)?(e=null,n=a.value):a.is(re.appendConfig)&&(e=null,n=Gr(n).concat(a.value));let o;e?o=t.startState.values.slice():(e=Na.resolve(n,r,this),o=new Oe(e,this.doc,this.selection,e.dynamicSlots.map(()=>null),(l,u)=>u.reconfigure(l,this),null).values);let s=t.startState.facet(Pu)?t.newSelection:t.newSelection.asSingle();new Oe(e,t.newDoc,s,o,(a,l)=>l.update(a,t),t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:t},range:yt.cursor(e.from+t.length)}))}changeByRange(t){let e=this.selection,n=t(e.ranges[0]),r=this.changes(n.changes),o=[n.range],s=Gr(n.effects);for(let a=1;as.spec.fromJSON(a,l)))}}return Oe.create({doc:t.doc,selection:yt.fromJSON(t.selection),extensions:e.extensions?r.concat([e.extensions]):r})}static create(t={}){let e=Na.resolve(t.extensions||[],new Map),n=t.doc instanceof we?t.doc:we.of((t.doc||"").split(e.staticFacet(Oe.lineSeparator)||xu)),r=t.selection?t.selection instanceof yt?t.selection:yt.single(t.selection.anchor,t.selection.head):yt.single(0);return Tm(r,n.length),e.staticFacet(Pu)||(r=r.asSingle()),new Oe(e,n,r,e.dynamicSlots.map(()=>null),(o,s)=>s.create(o),null)}get tabSize(){return this.facet(Oe.tabSize)}get lineBreak(){return this.facet(Oe.lineSeparator)||` +`}get readOnly(){return this.facet(Fm)}phrase(t,...e){for(let n of this.facet(Oe.phrases))if(Object.prototype.hasOwnProperty.call(n,t)){t=n[t];break}return e.length&&(t=t.replace(/\$(\$|\d*)/g,(n,r)=>{if(r=="$")return"$";let o=+(r||1);return!o||o>e.length?n:e[o-1]})),t}languageDataAt(t,e,n=-1){let r=[];for(let o of this.facet(Mm))for(let s of o(this,e,n))Object.prototype.hasOwnProperty.call(s,t)&&r.push(s[t]);return r}charCategorizer(t){return b_(this.languageDataAt("wordChars",t).join(""))}wordAt(t){let{text:e,from:n,length:r}=this.doc.lineAt(t),o=this.charCategorizer(t),s=t-n,a=t-n;for(;s>0;){let l=gi(e,s,!1);if(o(e.slice(l,s))!=Ne.Word)break;s=l}for(;ai.length?i[0]:4});Oe.lineSeparator=$m;Oe.readOnly=Fm;Oe.phrases=Zt.define({compare(i,t){let e=Object.keys(i),n=Object.keys(t);return e.length==n.length&&e.every(r=>i[r]==t[r])}});Oe.languageData=Mm;Oe.changeFilter=Qm;Oe.transactionFilter=Nm;Oe.transactionExtender=Bm;Ll.reconfigure=re.define();function xn(i,t,e={}){let n={};for(let r of i)for(let o of Object.keys(r)){let s=r[o],a=n[o];if(a===void 0)n[o]=s;else if(!(a===s||s===void 0))if(Object.hasOwnProperty.call(e,o))n[o]=e[o](a,s);else throw new Error("Config merge conflict for field "+o)}for(let r in t)n[r]===void 0&&(n[r]=t[r]);return n}class kr{eq(t){return this==t}range(t,e=t){return Au.create(t,e,this)}}kr.prototype.startSide=kr.prototype.endSide=0;kr.prototype.point=!1;kr.prototype.mapMode=Je.TrackDel;let Au=class Ym{constructor(t,e,n){this.from=t,this.to=e,this.value=n}static create(t,e,n){return new Ym(t,e,n)}};function Eu(i,t){return i.from-t.from||i.value.startSide-t.value.startSide}class Dc{constructor(t,e,n,r){this.from=t,this.to=e,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(t,e,n,r=0){let o=n?this.to:this.from;for(let s=r,a=o.length;;){if(s==a)return s;let l=s+a>>1,u=o[l]-t||(n?this.value[l].endSide:this.value[l].startSide)-e;if(l==s)return u>=0?s:a;u>=0?a=l:s=l+1}}between(t,e,n,r){for(let o=this.findIndex(e,-1e9,!0),s=this.findIndex(n,1e9,!1,o);og||f==g&&u.startSide>0&&u.endSide<=0)continue;(g-f||u.endSide-u.startSide)<0||(s<0&&(s=f),u.point&&(a=Math.max(a,g-f)),n.push(u),r.push(f-s),o.push(g-s))}return{mapped:n.length?new Dc(r,o,n,a):null,pos:s}}}class ge{constructor(t,e,n,r){this.chunkPos=t,this.chunk=e,this.nextLayer=n,this.maxPoint=r}static create(t,e,n,r){return new ge(t,e,n,r)}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:n=!1,filterFrom:r=0,filterTo:o=this.length}=t,s=t.filter;if(e.length==0&&!s)return this;if(n&&(e=e.slice().sort(Eu)),this.isEmpty)return e.length?ge.of(e):this;let a=new Zm(this,null,-1).goto(0),l=0,u=[],c=new _n;for(;a.value||l=0){let d=e[l++];c.addInner(d.from,d.to,d.value)||u.push(d)}else a.rangeIndex==1&&a.chunkIndexthis.chunkEnd(a.chunkIndex)||oa.to||o=o&&t<=o+s.length&&s.between(o,t-o,e-o,n)===!1)return}this.nextLayer.between(t,e,n)}}iter(t=0){return io.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return io.from(t).goto(e)}static compare(t,e,n,r,o=-1){let s=t.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=o),a=e.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=o),l=ed(s,a,n),u=new Cs(s,l,o),c=new Cs(a,l,o);n.iterGaps((d,f,g)=>id(u,d,c,f,g,r)),n.empty&&n.length==0&&id(u,0,c,0,0,r)}static eq(t,e,n=0,r){r==null&&(r=1e9-1);let o=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0),s=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0);if(o.length!=s.length)return!1;if(!o.length)return!0;let a=ed(o,s),l=new Cs(o,a,0).goto(n),u=new Cs(s,a,0).goto(n);for(;;){if(l.to!=u.to||!Du(l.active,u.active)||l.point&&(!u.point||!l.point.eq(u.point)))return!1;if(l.to>r)return!0;l.next(),u.next()}}static spans(t,e,n,r,o=-1){let s=new Cs(t,null,o).goto(e),a=e,l=s.openStart;for(;;){let u=Math.min(s.to,n);if(s.point){let c=s.activeForPoint(s.to),d=s.pointFroma&&(r.span(a,u,s.active,l),l=s.openEnd(u));if(s.to>n)return l+(s.point&&s.to>n?1:0);a=s.to,s.next()}}static of(t,e=!1){let n=new _n;for(let r of t instanceof Au?[t]:e?w_(t):t)n.add(r.from,r.to,r.value);return n.finish()}static join(t){if(!t.length)return ge.empty;let e=t[t.length-1];for(let n=t.length-2;n>=0;n--)for(let r=t[n];r!=ge.empty;r=r.nextLayer)e=new ge(r.chunkPos,r.chunk,e,Math.max(r.maxPoint,e.maxPoint));return e}}ge.empty=new ge([],[],null,-1);function w_(i){if(i.length>1)for(let t=i[0],e=1;e0)return i.slice().sort(Eu);t=n}return i}ge.empty.nextLayer=ge.empty;class _n{finishChunk(t){this.chunks.push(new Dc(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=[])}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(t,e,n){this.addInner(t,e,n)||(this.nextLayer||(this.nextLayer=new _n)).add(t,e,n)}addInner(t,e,n){let r=t-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&(t-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<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=n,this.lastFrom=t,this.lastTo=e,this.value.push(n),n.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 n=e.value.length-1;return this.last=e.value[n],this.lastFrom=e.from[n]+t,this.lastTo=e.to[n]+t,!0}finish(){return this.finishInner(ge.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let e=ge.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function ed(i,t,e){let n=new Map;for(let o of i)for(let s=0;s=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=n&&r.push(new Zm(s,e,n,o));return r.length==1?r[0]:new io(r)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let n of this.heap)n.goto(t,e);for(let n=this.heap.length>>1;n>=0;n--)xh(this.heap,n);return this.next(),this}forward(t,e){for(let n of this.heap)n.forward(t,e);for(let n=this.heap.length>>1;n>=0;n--)xh(this.heap,n);(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(),xh(this.heap,0)}}}function xh(i,t){for(let e=i[t];;){let n=(t<<1)+1;if(n>=i.length)break;let r=i[n];if(n+1=0&&(r=i[n+1],n++),e.compare(r)<0)break;i[n]=e,i[t]=r,t=n}}class Cs{constructor(t,e,n){this.minPoint=n,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=io.from(t,e,n)}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){Wo(this.active,t),Wo(this.activeTo,t),Wo(this.activeRank,t),this.minActive=nd(this.active,this.activeTo)}addActive(t){let e=0,{value:n,to:r,rank:o}=this.cursor;for(;e0;)e++;Uo(this.active,e,n),Uo(this.activeTo,e,r),Uo(this.activeRank,e,o),t&&Uo(t,e,this.cursor.from),this.minActive=nd(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let n=this.openStart<0?[]:null;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),n&&Wo(n,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(n),this.cursor.next();else if(e&&this.cursor.to==this.to&&this.cursor.from=0&&n[r]=0&&!(this.activeRank[n]t||this.activeTo[n]==t&&this.active[n].endSide>=this.point.endSide)&&e.push(this.active[n]);return e.reverse()}openEnd(t){let e=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>t;n--)e++;return e}}function id(i,t,e,n,r,o){i.goto(t),e.goto(n);let s=n+r,a=n,l=n-t;for(;;){let u=i.to+l-e.to||i.endSide-e.endSide,c=u<0?i.to+l:e.to,d=Math.min(c,s);if(i.point||e.point?i.point&&e.point&&(i.point==e.point||i.point.eq(e.point))&&Du(i.activeForPoint(i.to),e.activeForPoint(e.to))||o.comparePoint(a,d,i.point,e.point):d>a&&!Du(i.active,e.active)&&o.compareRange(a,d,i.active,e.active),c>s)break;a=c,u<=0&&i.next(),u>=0&&e.next()}}function Du(i,t){if(i.length!=t.length)return!1;for(let e=0;e=t;n--)i[n+1]=i[n];i[t]=e}function nd(i,t){let e=-1,n=1e9;for(let r=0;r=t)return r;if(r==i.length)break;o+=i.charCodeAt(r)==9?e-o%e:1,r=gi(i,r)}return n===!0?-1:i.length}const Iu="ͼ",rd=typeof Symbol>"u"?"__"+Iu:Symbol.for(Iu),Mu=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),sd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ir{constructor(t,e){this.rules=[];let{finish:n}=e||{};function r(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function o(s,a,l,u){let c=[],d=/^@(\w+)\b/.exec(s[0]),f=d&&d[1]=="keyframes";if(d&&a==null)return l.push(s[0]+";");for(let g in a){let x=a[g];if(/&/.test(g))o(g.split(/,\s*/).map(m=>s.map(v=>m.replace(/&/,v))).reduce((m,v)=>m.concat(v)),x,l);else if(x&&typeof x=="object"){if(!d)throw new RangeError("The value of a property ("+g+") should be a primitive value.");o(r(g),x,c,f)}else x!=null&&c.push(g.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+x+";")}(c.length||f)&&l.push((n&&!d&&!u?s.map(n):s).join(", ")+" {"+c.join(" ")+"}")}for(let s in t)o(r(s),t[s],this.rules)}getRules(){return this.rules.join(` `)}static newName(){let t=sd[rd]||1;return sd[rd]=t+1,Iu+t.toString(36)}static mount(t,e,n){let r=t[Mu],o=n&&n.nonce;r?o&&r.setNonce(o):r=new S_(t,o),r.mount(Array.isArray(e)?e:[e])}}let od=new Map;class S_{constructor(t,e){let n=t.ownerDocument||t,r=n.defaultView;if(!t.head&&t.adoptedStyleSheets&&r.CSSStyleSheet){let o=od.get(n);if(o)return t.adoptedStyleSheets=[o.sheet,...t.adoptedStyleSheets],t[Mu]=o;this.sheet=new r.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],od.set(n,this)}else{this.styleTag=n.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);let o=t.head||t;o.insertBefore(this.styleTag,o.firstChild)}this.modules=[],t[Mu]=this}mount(t){let e=this.sheet,n=0,r=0;for(let o=0;o-1&&(this.modules.splice(a,1),r--,a=-1),a==-1){if(this.modules.splice(r++,0,s),e)for(let l=0;l",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},C_=typeof navigator<"u"&&/Mac/.test(navigator.platform),P_=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var li=0;li<10;li++)nr[48+li]=nr[96+li]=String(li);for(var li=1;li<=24;li++)nr[li+111]="F"+li;for(var li=65;li<=90;li++)nr[li]=String.fromCharCode(li+32),no[li]=String.fromCharCode(li);for(var bh in nr)no.hasOwnProperty(bh)||(no[bh]=nr[bh]);function k_(i){var t=C_&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||P_&&i.shiftKey&&i.key&&i.key.length==1||i.key=="Unidentified",e=!t&&i.key||(i.shiftKey?no:nr)[i.keyCode]||i.key||"Unidentified";return e=="Esc"&&(e="Escape"),e=="Del"&&(e="Delete"),e=="Left"&&(e="ArrowLeft"),e=="Up"&&(e="ArrowUp"),e=="Right"&&(e="ArrowRight"),e=="Down"&&(e="ArrowDown"),e}function Fa(i){let t;return i.nodeType==11?t=i.getSelection?i:i.ownerDocument:t=i,t.getSelection()}function $u(i,t){return t?i==t||i.contains(t.nodeType!=1?t.parentNode:t):!1}function L_(i){let t=i.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function ka(i,t){if(!t.anchorNode)return!1;try{return $u(i,t.anchorNode)}catch{return!1}}function ro(i){return i.nodeType==3?Ar(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function zs(i,t,e,n){return e?ad(i,t,e,n,-1)||ad(i,t,e,n,1):!1}function Lr(i){for(var t=0;;t++)if(i=i.previousSibling,!i)return t}function Xa(i){return i.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(i.nodeName)}function ad(i,t,e,n,r){for(;;){if(i==e&&t==n)return!0;if(t==(r<0?0:En(i))){if(i.nodeName=="DIV")return!1;let o=i.parentNode;if(!o||o.nodeType!=1)return!1;t=Lr(i)+(r<0?0:1),i=o}else if(i.nodeType==1){if(i=i.childNodes[t+(r<0?-1:0)],i.nodeType==1&&i.contentEditable=="false")return!1;t=r<0?En(i):0}else return!1}}function En(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function Tc(i,t){let e=t?i.left:i.right;return{left:e,right:e,top:i.top,bottom:i.bottom}}function A_(i){let t=i.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function Wm(i,t){let e=t.width/i.offsetWidth,n=t.height/i.offsetHeight;return(e>.995&&e<1.005||!isFinite(e)||Math.abs(t.width-i.offsetWidth)<1)&&(e=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.height-i.offsetHeight)<1)&&(n=1),{scaleX:e,scaleY:n}}function E_(i,t,e,n,r,o,s,a){let l=i.ownerDocument,u=l.defaultView||window;for(let c=i,d=!1;c&&!d;)if(c.nodeType==1){let f,g=c==l.body,x=1,m=1;if(g)f=A_(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(d=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let b=c.getBoundingClientRect();({scaleX:x,scaleY:m}=Wm(c,b)),f={left:b.left,right:b.left+c.clientWidth*x,top:b.top,bottom:b.top+c.clientHeight*m}}let v=0,O=0;if(r=="nearest")t.top0&&t.bottom>f.bottom+O&&(O=t.bottom-f.bottom+O+s)):t.bottom>f.bottom&&(O=t.bottom-f.bottom+s,e<0&&t.top-O0&&t.right>f.right+v&&(v=t.right-f.right+v+o)):t.right>f.right&&(v=t.right-f.right+o,e<0&&t.lefte.clientHeight||e.scrollWidth>e.clientWidth)return e;e=e.assignedSlot||e.parentNode}else if(e.nodeType==11)e=e.host;else break;return null}class T_{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:n}=t;this.set(e,Math.min(t.anchorOffset,e?En(e):0),n,Math.min(t.focusOffset,n?En(n):0))}set(t,e,n,r){this.anchorNode=t,this.anchorOffset=e,this.focusNode=n,this.focusOffset=r}}let Fr=null;function Um(i){if(i.setActive)return i.setActive();if(Fr)return i.focus(Fr);let t=[];for(let e=i;e&&(t.push(e,e.scrollTop,e.scrollLeft),e!=e.ownerDocument);e=e.parentNode);if(i.focus(Fr==null?{get preventScroll(){return Fr={preventScroll:!0},!0}}:void 0),!Fr){Fr=!1;for(let e=0;eMath.max(1,i.scrollHeight-i.clientHeight-4)}function qm(i,t){for(let e=i,n=t;;){if(e.nodeType==3&&n>0)return{node:e,offset:n};if(e.nodeType==1&&n>0){if(e.contentEditable=="false")return null;e=e.childNodes[n-1],n=En(e)}else if(e.parentNode&&!Xa(e))n=Lr(e),e=e.parentNode;else return null}}function Vm(i,t){for(let e=i,n=t;;){if(e.nodeType==3&&ne)return d.domBoundsAround(t,e,u);if(f>=t&&r==-1&&(r=l,o=u),u>e&&d.dom.parentNode==this.dom){s=l,a=c;break}c=f,u=f+d.breakAfter}return{from:o,to:a<0?n+this.length:a,startDOM:(r?this.children[r-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:s=0?this.children[s].dom:null}}markDirty(t=!1){this.flags|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),e.flags&1)return;e.flags|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.flags&7&&this.markParentsDirty(!0))}setDOM(t){this.dom!=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,n=Ic){this.markDirty();for(let r=t;rthis.pos||t==this.pos&&(e>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function Hm(i,t,e,n,r,o,s,a,l){let{children:u}=i,c=u.length?u[t]:null,d=o.length?o[o.length-1]:null,f=d?d.breakAfter:s;if(!(t==n&&c&&!s&&!f&&o.length<2&&c.merge(e,r,o.length?d:null,e==0,a,l))){if(n0&&(!s&&o.length&&c.merge(e,c.length,o[0],!1,a,0)?c.breakAfter=o.shift().breakAfter:(e2);var Ut={mac:fd||/Mac/.test($i.platform),windows:/Win/.test($i.platform),linux:/Linux|X11/.test($i.platform),ie:Al,ie_version:Km?Qu.documentMode||6:Bu?+Bu[1]:Nu?+Nu[1]:0,gecko:ud,gecko_version:ud?+(/Firefox\/(\d+)/.exec($i.userAgent)||[0,0])[1]:0,chrome:!!wh,chrome_version:wh?+wh[1]:0,ios:fd,android:/Android\b/.test($i.userAgent),webkit:cd,safari:tg,webkit_version:cd?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:Qu.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const $_=256;class en extends Te{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){t.nodeType==3&&this.createDOM(t)}merge(t,e,n){return this.flags&8||n&&(!(n instanceof en)||this.length-(e-t)+n.length>$_||n.flags&8)?!1:(this.text=this.text.slice(0,t)+(n?n.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new en(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=this.flags&8,e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new mi(this.dom,t)}domBoundsAround(t,e,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return Q_(this.dom,t,e)}}class Dn extends Te{constructor(t,e=[],n=0){super(),this.mark=t,this.children=e,this.length=n;for(let r of e)r.setParent(this)}setAttrs(t){if(zm(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}canReuseDOM(t){return super.canReuseDOM(t)&&!((this.flags|t.flags)&8)}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}sync(t,e){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,n,r,o,s){return n&&(!(n instanceof Dn&&n.mark.eq(this.mark))||t&&o<=0||et&&e.push(n=t&&(r=o),n=l,o++}let s=this.length-t;return this.length=t,r>-1&&(this.children.length=r,this.markDirty()),new Dn(this.mark,e,s)}domAtPos(t){return eg(this,t)}coordsAt(t,e){return ng(this,t,e)}}function Q_(i,t,e){let n=i.nodeValue.length;t>n&&(t=n);let r=t,o=t,s=0;t==0&&e<0||t==n&&e>=0?Ut.chrome||Ut.gecko||(t?(r--,s=1):o=0)?0:a.length-1];return Ut.safari&&!s&&l.width==0&&(l=Array.prototype.find.call(a,u=>u.width)||l),s?Tc(l,s<0):l||null}class Vn extends Te{static create(t,e,n){return new Vn(t,e,n)}constructor(t,e,n){super(),this.widget=t,this.length=e,this.side=n,this.prevWidget=null}split(t){let e=Vn.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(t){(!this.dom||!this.widget.updateDOM(this.dom,t))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(t,e,n,r,o,s){return n&&(!(n instanceof Vn)||!this.widget.compare(n.widget)||t>0&&o<=0||e0)?mi.before(this.dom):mi.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let n=this.widget.coordsAt(this.dom,t,e);if(n)return n;let r=this.dom.getClientRects(),o=null;if(!r.length)return null;let s=this.side?this.side<0:t>0;for(let a=s?r.length-1:0;o=r[a],!(t>0?a==0:a==r.length-1||o.top0?mi.before(this.dom):mi.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return we.empty}get isHidden(){return!0}}en.prototype.children=Vn.prototype.children=us.prototype.children=Ic;function eg(i,t){let e=i.dom,{children:n}=i,r=0;for(let o=0;ro&&t0;o--){let s=n[o-1];if(s.dom.parentNode==e)return s.domAtPos(s.length)}for(let o=r;o0&&t instanceof Dn&&r.length&&(n=r[r.length-1])instanceof Dn&&n.mark.eq(t.mark)?ig(n,t.children[0],e-1):(r.push(t),t.setParent(i)),i.length+=t.length}function ng(i,t,e){let n=null,r=-1,o=null,s=-1;function a(u,c){for(let d=0,f=0;d=c&&(g.children.length?a(g,c-f):(!o||o.isHidden&&e>0)&&(x>c||f==x&&g.getSide()>0)?(o=g,s=c-f):(f-1?1:0)!=r.length-(e&&r.indexOf(e)>-1?1:0))return!1;for(let o of n)if(o!=e&&(r.indexOf(o)==-1||i[o]!==t[o]))return!1;return!0}function Xu(i,t,e){let n=!1;if(t)for(let r in t)e&&r in e||(n=!0,r=="style"?i.style.cssText="":i.removeAttribute(r));if(e)for(let r in e)t&&t[r]==e[r]||(n=!0,r=="style"?i.style.cssText=e[r]:i.setAttribute(r,e[r]));return n}function B_(i){let t=Object.create(null);for(let e=0;e0&&this.children[n-1].length==0;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){Mc(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){ig(this,t,e)}addLineDeco(t){let e=t.spec.attributes,n=t.spec.class;e&&(this.attrs=Fu(e,this.attrs||{})),n&&(this.attrs=Fu({class:n},this.attrs||{}))}domAtPos(t){return eg(this,t)}reuseDOM(t){t.nodeName=="DIV"&&(this.setDOM(t),this.flags|=6)}sync(t,e){var n;this.dom?this.flags&4&&(zm(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&&(Xu(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t,e);let r=this.dom.lastChild;for(;r&&Te.get(r)instanceof Dn;)r=r.lastChild;if(!r||!this.length||r.nodeName!="BR"&&((n=Te.get(r))===null||n===void 0?void 0:n.isEditable)==!1&&(!Ut.ios||!this.children.some(o=>o instanceof en))){let o=document.createElement("BR");o.cmIgnore=!0,this.dom.appendChild(o)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let t=0,e;for(let n of this.children){if(!(n instanceof en)||/[^ -~]/.test(n.text))return null;let r=ro(n.dom);if(r.length!=1)return null;t+=r[0].width,e=r[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:e}:null}coordsAt(t,e){let n=ng(this,t,e);if(!this.children.length&&n&&this.parent){let{heightOracle:r}=this.parent.view.viewState,o=n.bottom-n.top;if(Math.abs(o-r.lineHeight)<2&&r.textHeight=e){if(o instanceof je)return o;if(s>e)break}r=s+o.breakAfter}return null}}class Jn extends Te{constructor(t,e,n){super(),this.widget=t,this.length=e,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(t,e,n,r,o,s){return n&&(!(n instanceof Jn)||!this.widget.compare(n.widget)||t>0&&o<=0||e0}}class Mn{eq(t){return!1}updateDOM(t,e){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}}var xi=function(i){return i[i.Text=0]="Text",i[i.WidgetBefore=1]="WidgetBefore",i[i.WidgetAfter=2]="WidgetAfter",i[i.WidgetRange=3]="WidgetRange",i}(xi||(xi={}));class Gt extends kr{constructor(t,e,n,r){super(),this.startSide=t,this.endSide=e,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(t){return new xo(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),n=!!t.block;return e+=n&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new rr(t,e,e,n,t.widget||null,!1)}static replace(t){let e=!!t.block,n,r;if(t.isBlockGap)n=-5e8,r=4e8;else{let{start:o,end:s}=rg(t,e);n=(o?e?-3e8:-1:5e8)-1,r=(s?e?2e8:1:-6e8)+1}return new rr(t,n,r,e,t.widget||null,!0)}static line(t){return new bo(t)}static set(t,e=!1){return ge.of(t,e)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Gt.none=ge.empty;class xo extends Gt{constructor(t){let{start:e,end:n}=rg(t);super(e?-1:5e8,n?1:-6e8,null,t),this.tagName=t.tagName||"span",this.class=t.class||"",this.attrs=t.attributes||null}eq(t){var e,n;return this==t||t instanceof xo&&this.tagName==t.tagName&&(this.class||((e=this.attrs)===null||e===void 0?void 0:e.class))==(t.class||((n=t.attrs)===null||n===void 0?void 0:n.class))&&Mc(this.attrs,t.attrs,"class")}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}xo.prototype.point=!1;class bo extends Gt{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof bo&&this.spec.class==t.spec.class&&Mc(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)}}bo.prototype.mapMode=Je.TrackBefore;bo.prototype.point=!0;class rr extends Gt{constructor(t,e,n,r,o,s){super(e,n,o,t),this.block=r,this.isReplace=s,this.mapMode=r?e<=0?Je.TrackBefore:Je.TrackAfter:Je.TrackDel}get type(){return this.startSide!=this.endSide?xi.WidgetRange:this.startSide<=0?xi.WidgetBefore:xi.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof rr&&F_(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)}}rr.prototype.point=!0;function rg(i,t=!1){let{inclusiveStart:e,inclusiveEnd:n}=i;return e==null&&(e=i.inclusive),n==null&&(n=i.inclusive),{start:e??t,end:n??t}}function F_(i,t){return i==t||!!(i&&t&&i.compare(t))}function Ru(i,t,e,n=0){let r=e.length-1;r>=0&&e[r]+n>=i?e[r]=Math.max(e[r],t):e.push(i,t)}class js{constructor(t,e,n,r){this.doc=t,this.pos=e,this.end=n,this.disallowBlockEffectsFor=r,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],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 Jn&&t.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new je),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(zo(new us(-1),t),t.length),this.pendingBuffer=0)}addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(t&&this.content.length&&this.content[this.content.length-1]instanceof Jn)&&this.getLine()}buildText(t,e,n){for(;t>0;){if(this.textOff==this.text.length){let{value:o,lineBreak:s,done:a}=this.cursor.next(this.skip);if(this.skip=0,a)throw new Error("Ran out of text content when drawing inline views");if(s){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,t--;continue}else this.text=o,this.textOff=0}let r=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-n)),this.getLine().append(zo(new en(this.text.slice(this.textOff,this.textOff+r)),e),n),this.atCursorPos=!0,this.textOff+=r,t-=r,n=0}}span(t,e,n,r){this.buildText(e-t,n,r),this.pos=e,this.openStart<0&&(this.openStart=r)}point(t,e,n,r,o,s){if(this.disallowBlockEffectsFor[s]&&n instanceof rr){if(n.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")}let a=e-t;if(n instanceof rr)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Jn(n.widget||cs.block,a,n));else{let l=Vn.create(n.widget||cs.inline,a,a?0:n.startSide),u=this.atCursorPos&&!l.isEditable&&o<=r.length&&(t0),c=!l.isEditable&&(tr.length||n.startSide<=0),d=this.getLine();this.pendingBuffer==2&&!u&&!l.isEditable&&(this.pendingBuffer=0),this.flushBuffer(r),u&&(d.append(zo(new us(1),r),o),o=r.length+Math.max(0,o-r.length)),d.append(zo(l,r),o),this.atCursorPos=c,this.pendingBuffer=c?tr.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=r.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);a&&(this.textOff+a<=this.text.length?this.textOff+=a:(this.skip+=a-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=o)}static build(t,e,n,r,o){let s=new js(t,e,n,o);return s.openEnd=ge.spans(r,e,n,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function zo(i,t){for(let e of t)i=new Dn(e,[i],i.length);return i}class cs extends Mn{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}get isHidden(){return!0}}cs.inline=new cs("span");cs.block=new cs("div");var Me=function(i){return i[i.LTR=0]="LTR",i[i.RTL=1]="RTL",i}(Me||(Me={}));const Er=Me.LTR,$c=Me.RTL;function sg(i){let t=[];for(let e=0;e=e){if(a.level==n)return s;(o<0||(r!=0?r<0?a.frome:t[o].level>a.level))&&(o=s)}}if(o<0)throw new RangeError("Index out of range");return o}}function ag(i,t){if(i.length!=t.length)return!1;for(let e=0;e=0;m-=3)if(an[m+1]==-g){let v=an[m+2],O=v&2?r:v&4?v&1?o:r:0;O&&(De[d]=De[an[m]]=O),a=m;break}}else{if(an.length==189)break;an[a++]=d,an[a++]=f,an[a++]=l}else if((x=De[d])==2||x==1){let m=x==r;l=m?0:1;for(let v=a-3;v>=0;v-=3){let O=an[v+2];if(O&2)break;if(m)an[v+2]|=2;else{if(O&4)break;an[v+2]|=4}}}}}function U_(i,t,e,n){for(let r=0,o=n;r<=e.length;r++){let s=r?e[r-1].to:i,a=rl;)x==v&&(x=e[--m].from,v=m?e[m-1].to:i),De[--x]=g;l=c}else o=u,l++}}}function Zu(i,t,e,n,r,o,s){let a=n%2?2:1;if(n%2==r%2)for(let l=t,u=0;ll&&s.push(new Gn(l,m.from,g));let v=m.direction==Er!=!(g%2);Wu(i,v?n+1:n,r,m.inner,m.from,m.to,s),l=m.to}x=m.to}else{if(x==e||(c?De[x]!=a:De[x]==a))break;x++}f?Zu(i,l,x,n+1,r,f,s):lt;){let c=!0,d=!1;if(!u||l>o[u-1].to){let m=De[l-1];m!=a&&(c=!1,d=m==16)}let f=!c&&a==1?[]:null,g=c?n:n+1,x=l;t:for(;;)if(u&&x==o[u-1].to){if(d)break t;let m=o[--u];if(!c)for(let v=m.from,O=u;;){if(v==t)break t;if(O&&o[O-1].to==v)v=o[--O].from;else{if(De[v-1]==a)break t;break}}if(f)f.push(m);else{m.toDe.length;)De[De.length]=256;let n=[],r=t==Er?0:1;return Wu(i,r,r,e,0,i.length,n),n}function lg(i){return[new Gn(0,i,0)]}let hg="";function j_(i,t,e,n,r){var o;let s=n.head-i.from,a=Gn.find(t,s,(o=n.bidiLevel)!==null&&o!==void 0?o:-1,n.assoc),l=t[a],u=l.side(r,e);if(s==u){let f=a+=r?1:-1;if(f<0||f>=t.length)return null;l=t[a=f],s=l.side(!r,e),u=l.side(r,e)}let c=gi(i.text,s,l.forward(r,e));(cl.to)&&(c=u),hg=i.text.slice(Math.min(s,c),Math.max(s,c));let d=a==(r?t.length-1:0)?null:t[a+(r?1:-1)];return d&&c==u&&d.level+(r?0:1)i.some(t=>t)}),vg=Zt.define({combine:i=>i.some(t=>t)}),yg=Zt.define();class Jr{constructor(t,e="nearest",n="nearest",r=5,o=5,s=!1){this.range=t,this.y=e,this.x=n,this.yMargin=r,this.xMargin=o,this.isSnapshot=s}map(t){return t.empty?this:new Jr(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new Jr(yt.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const jo=re.define({map:(i,t)=>i.map(t)});function Pi(i,t,e){let n=i.facet(dg);n.length?n[0](t):window.onerror?window.onerror(String(t),e,void 0,void 0,t):e?console.error(e+":",t):console.error(t)}const El=Zt.define({combine:i=>i.length?i[0]:!0});let V_=0;const Qs=Zt.define();class Fe{constructor(t,e,n,r,o){this.id=t,this.create=e,this.domEventHandlers=n,this.domEventObservers=r,this.extension=o(this)}static define(t,e){const{eventHandlers:n,eventObservers:r,provide:o,decorations:s}=e||{};return new Fe(V_++,t,n,r,a=>{let l=[Qs.of(a)];return s&&l.push(so.of(u=>{let c=u.plugin(a);return c?s(c):Gt.none})),o&&l.push(o(a)),l})}static fromClass(t,e){return Fe.define(n=>new t(n),e)}}class Sh{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}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(n){if(Pi(e.state,n,"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){Pi(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(!((e=this.value)===null||e===void 0)&&e.destroy)try{this.value.destroy()}catch(n){Pi(t.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Og=Zt.define(),Qc=Zt.define(),so=Zt.define(),_g=Zt.define(),Nc=Zt.define(),xg=Zt.define();function pd(i,t){let e=i.state.facet(xg);if(!e.length)return e;let n=e.map(o=>o instanceof Function?o(i):o),r=[];return ge.spans(n,t.from,t.to,{point(){},span(o,s,a,l){let u=o-t.from,c=s-t.from,d=r;for(let f=a.length-1;f>=0;f--,l--){let g=a[f].spec.bidiIsolate,x;if(g==null&&(g=q_(t.text,u,c)),l>0&&d.length&&(x=d[d.length-1]).to==u&&x.direction==g)x.to=c,d=x.inner;else{let m={from:u,to:c,direction:g,inner:[]};d.push(m),d=m.inner}}}}),r}const bg=Zt.define();function wg(i){let t=0,e=0,n=0,r=0;for(let o of i.state.facet(bg)){let s=o(i);s&&(s.left!=null&&(t=Math.max(t,s.left)),s.right!=null&&(e=Math.max(e,s.right)),s.top!=null&&(n=Math.max(n,s.top)),s.bottom!=null&&(r=Math.max(r,s.bottom)))}return{left:t,right:e,top:n,bottom:r}}const Ns=Zt.define();class zi{constructor(t,e,n,r){this.fromA=t,this.toA=e,this.fromB=n,this.toB=r}join(t){return new zi(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,n=this;for(;e>0;e--){let r=t[e-1];if(!(r.fromA>n.toA)){if(r.toAc)break;o+=2}if(!l)return n;new zi(l.fromA,l.toA,l.fromB,l.toB).addToSet(n),s=l.toA,a=l.toB}}}class Ra{constructor(t,e,n){this.view=t,this.state=e,this.transactions=n,this.flags=0,this.startState=t.state,this.changes=Ge.empty(this.startState.doc.length);for(let o of n)this.changes=this.changes.compose(o.changes);let r=[];this.changes.iterChangedRanges((o,s,a,l)=>r.push(new zi(o,s,a,l))),this.changedRanges=r}static create(t,e,n){return new Ra(t,e,n)}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}}class md extends Te{get length(){return this.view.state.doc.length}constructor(t){super(),this.view=t,this.decorations=[],this.dynamicDecorationMap=[],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new je],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new zi(0,0,0,t.state.doc.length)],0,null)}update(t){var e;let n=t.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:u,toA:c})=>cthis.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let r=-1;this.view.inputState.composing>=0&&(!((e=this.domChanged)===null||e===void 0)&&e.newSel?r=this.domChanged.newSel.head:!ix(t.changes,this.hasComposition)&&!t.selectionSet&&(r=t.state.selection.main.head));let o=r>-1?H_(this.view,t.changes,r):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:u,to:c}=this.hasComposition;n=new zi(u,c,t.changes.mapPos(u,-1),t.changes.mapPos(c,1)).addToSet(n.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(Ut.ie||Ut.chrome)&&!o&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let s=this.decorations,a=this.updateDeco(),l=tx(s,a,t.changes);return n=zi.extendWithRanges(n,l),!(this.flags&7)&&n.length==0?!1:(this.updateInner(n,t.startState.doc.length,o),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,n);let{observer:r}=this.view;r.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=Ut.chrome||Ut.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,s),this.flags&=-8,s&&(s.written||r.selectionRange.focusNode!=s.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(s=>s.flags&=-9);let o=[];if(this.view.viewport.from||this.view.viewport.to=0?r[s]:null;if(!a)break;let{fromA:l,toA:u,fromB:c,toB:d}=a,f,g,x,m;if(n&&n.range.fromBc){let E=js.build(this.view.state.doc,c,n.range.fromB,this.decorations,this.dynamicDecorationMap),$=js.build(this.view.state.doc,n.range.toB,d,this.decorations,this.dynamicDecorationMap);g=E.breakAtStart,x=E.openStart,m=$.openEnd;let N=this.compositionView(n);$.breakAtStart?N.breakAfter=1:$.content.length&&N.merge(N.length,N.length,$.content[0],!1,$.openStart,0)&&(N.breakAfter=$.content[0].breakAfter,$.content.shift()),E.content.length&&N.merge(0,0,E.content[E.content.length-1],!0,0,E.openEnd)&&E.content.pop(),f=E.content.concat(N).concat($.content)}else({content:f,breakAtStart:g,openStart:x,openEnd:m}=js.build(this.view.state.doc,c,d,this.decorations,this.dynamicDecorationMap));let{i:v,off:O}=o.findPos(u,1),{i:b,off:k}=o.findPos(l,-1);Hm(this,b,k,v,O,f,g,x,m)}n&&this.fixCompositionDOM(n)}compositionView(t){let e=new en(t.text.nodeValue);e.flags|=8;for(let{deco:r}of t.marks)e=new Dn(r,[e],e.length);let n=new je;return n.append(e,0),n}fixCompositionDOM(t){let e=(o,s)=>{s.flags|=8|(s.children.some(l=>l.flags&7)?1:0),this.markedForComposition.add(s);let a=Te.get(o);a&&a!=s&&(a.dom=null),s.setDOM(o)},n=this.childPos(t.range.fromB,1),r=this.children[n.i];e(t.line,r);for(let o=t.marks.length-1;o>=-1;o--)n=r.childPos(n.off,1),r=r.children[n.i],e(o>=0?t.marks[o].node:t.text,r)}updateSelection(t=!1,e=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let n=this.view.root.activeElement,r=n==this.dom,o=!r&&ka(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(r||e||o))return;let s=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(a.anchor)),u=a.empty?l:this.moveToLine(this.domAtPos(a.head));if(Ut.gecko&&a.empty&&!this.hasComposition&&G_(l)){let d=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(d,l.node.childNodes[l.offset]||null)),l=u=new mi(d,0),s=!0}let c=this.view.observer.selectionRange;(s||!c.focusNode||(!zs(l.node,l.offset,c.anchorNode,c.anchorOffset)||!zs(u.node,u.offset,c.focusNode,c.focusOffset))&&!this.suppressWidgetCursorChange(c,a))&&(this.view.observer.ignore(()=>{Ut.android&&Ut.chrome&&this.dom.contains(c.focusNode)&&ex(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let d=Fa(this.view.root);if(d)if(a.empty){if(Ut.gecko){let f=J_(l.node,l.offset);if(f&&f!=3){let g=(f==1?qm:Vm)(l.node,l.offset);g&&(l=new mi(g.node,g.offset))}}d.collapse(l.node,l.offset),a.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=a.bidiLevel)}else if(d.extend){d.collapse(l.node,l.offset);try{d.extend(u.node,u.offset)}catch{}}else{let f=document.createRange();a.anchor>a.head&&([l,u]=[u,l]),f.setEnd(u.node,u.offset),f.setStart(l.node,l.offset),d.removeAllRanges(),d.addRange(f)}o&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(l,u)),this.impreciseAnchor=l.precise?null:new mi(c.anchorNode,c.anchorOffset),this.impreciseHead=u.precise?null:new mi(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&zs(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,n=Fa(t.root),{anchorNode:r,anchorOffset:o}=t.observer.selectionRange;if(!n||!e.empty||!e.assoc||!n.modify)return;let s=je.find(this,e.head);if(!s)return;let a=s.posAtStart;if(e.head==a||e.head==a+s.length)return;let l=this.coordsAt(e.head,-1),u=this.coordsAt(e.head,1);if(!l||!u||l.bottom>u.top)return;let c=this.domAtPos(e.head+e.assoc);n.collapse(c.node,c.offset),n.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let d=t.observer.selectionRange;t.docView.posFromDOM(d.anchorNode,d.anchorOffset)!=e.from&&n.collapse(r,o)}moveToLine(t){let e=this.dom,n;if(t.node!=e)return t;for(let r=t.offset;!n&&r=0;r--){let o=Te.get(e.childNodes[r]);o instanceof je&&(n=o.domAtPos(o.length))}return n?new mi(n.node,n.offset,!0):t}nearest(t){for(let e=t;e;){let n=Te.get(e);if(n&&n.rootView==this)return n;e=e.parentNode}return null}posFromDOM(t,e){let n=this.nearest(t);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(t,e)+n.posAtStart}domAtPos(t){let{i:e,off:n}=this.childCursor().findPos(t,-1);for(;e=0;s--){let a=this.children[s],l=o-a.breakAfter,u=l-a.length;if(lt||a.covers(1))&&(!n||a instanceof je&&!(n instanceof je&&e>=0))&&(n=a,r=u),o=u}return n?n.coordsAt(t-r,e):null}coordsForChar(t){let{i:e,off:n}=this.childPos(t,1),r=this.children[e];if(!(r instanceof je))return null;for(;r.children.length;){let{i:a,off:l}=r.childPos(n,1);for(;;a++){if(a==r.children.length)return null;if((r=r.children[a]).length)break}n=l}if(!(r instanceof en))return null;let o=gi(r.text,n);if(o==n)return null;let s=Ar(r.dom,n,o).getClientRects();for(let a=0;aMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==Me.LTR;for(let u=0,c=0;cr)break;if(u>=n){let g=d.dom.getBoundingClientRect();if(e.push(g.height),s){let x=d.dom.lastChild,m=x?ro(x):[];if(m.length){let v=m[m.length-1],O=l?v.right-g.left:g.right-v.left;O>a&&(a=O,this.minWidth=o,this.minWidthFrom=u,this.minWidthTo=f)}}}u=f+d.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return getComputedStyle(this.children[e].dom).direction=="rtl"?Me.RTL:Me.LTR}measureTextSize(){for(let o of this.children)if(o instanceof je){let s=o.measureTextSize();if(s)return s}let t=document.createElement("div"),e,n,r;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(t);let o=ro(t.firstChild)[0];e=t.getBoundingClientRect().height,n=o?o.width/27:7,r=o?o.height:e,t.remove()}),{lineHeight:e,charWidth:n,textHeight:r}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new Gm(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let n=0,r=0;;r++){let o=r==e.viewports.length?null:e.viewports[r],s=o?o.from-1:this.length;if(s>n){let a=(e.lineBlockAt(s).bottom-e.lineBlockAt(n).top)/this.view.scaleY;t.push(Gt.replace({widget:new gd(a),block:!0,inclusive:!0,isBlockGap:!0}).range(n,s))}if(!o)break;n=o.to+1}return Gt.set(t)}updateDeco(){let t=0,e=this.view.state.facet(so).map(o=>(this.dynamicDecorationMap[t++]=typeof o=="function")?o(this.view):o),n=!1,r=this.view.state.facet(_g).map((o,s)=>{let a=typeof o=="function";return a&&(n=!0),a?o(this.view):o});for(r.length&&(this.dynamicDecorationMap[t++]=n,e.push(ge.join(r))),this.decorations=[...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];te.anchor?-1:1),r;if(!n)return;!e.empty&&(r=this.coordsAt(e.anchor,e.anchor>e.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let o=wg(this.view),s={left:n.left-o.left,top:n.top-o.top,right:n.right+o.right,bottom:n.bottom+o.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;E_(this.view.scrollDOM,s,e.head{nt.from&&(e=!0)}),e}function nx(i,t,e=1){let n=i.charCategorizer(t),r=i.doc.lineAt(t),o=t-r.from;if(r.length==0)return yt.cursor(t);o==0?e=1:o==r.length&&(e=-1);let s=o,a=o;e<0?s=gi(r.text,o,!1):a=gi(r.text,o);let l=n(r.text.slice(s,a));for(;s>0;){let u=gi(r.text,s,!1);if(n(r.text.slice(u,s))!=l)break;s=u}for(;ai?t.left-i:Math.max(0,i-t.right)}function sx(i,t){return t.top>i?t.top-i:Math.max(0,i-t.bottom)}function Ch(i,t){return i.topt.top+1}function vd(i,t){return ti.bottom?{top:i.top,left:i.left,right:i.right,bottom:t}:i}function zu(i,t,e){let n,r,o,s,a=!1,l,u,c,d;for(let x=i.firstChild;x;x=x.nextSibling){let m=ro(x);for(let v=0;vk||s==k&&o>b){n=x,r=O,o=b,s=k;let E=k?e0?v0)}b==0?e>O.bottom&&(!c||c.bottomO.top)&&(u=x,d=O):c&&Ch(c,O)?c=yd(c,O.bottom):d&&Ch(d,O)&&(d=vd(d,O.top))}}if(c&&c.bottom>=e?(n=l,r=c):d&&d.top<=e&&(n=u,r=d),!n)return{node:i,offset:0};let f=Math.max(r.left,Math.min(r.right,t));if(n.nodeType==3)return Od(n,f,e);if(a&&n.contentEditable!="false")return zu(n,f,e);let g=Array.prototype.indexOf.call(i.childNodes,n)+(t>=(r.left+r.right)/2?1:0);return{node:i,offset:g}}function Od(i,t,e){let n=i.nodeValue.length,r=-1,o=1e9,s=0;for(let a=0;ae?c.top-e:e-c.bottom)-1;if(c.left-1<=t&&c.right+1>=t&&d=(c.left+c.right)/2,g=f;if((Ut.chrome||Ut.gecko)&&Ar(i,a).getBoundingClientRect().left==c.right&&(g=!f),d<=0)return{node:i,offset:a+(g?1:0)};r=a+(g?1:0),o=d}}}return{node:i,offset:r>-1?r:s>0?i.nodeValue.length:0}}function Cg(i,t,e,n=-1){var r,o;let s=i.contentDOM.getBoundingClientRect(),a=s.top+i.viewState.paddingTop,l,{docHeight:u}=i.viewState,{x:c,y:d}=t,f=d-a;if(f<0)return 0;if(f>u)return i.state.doc.length;for(let E=i.viewState.heightOracle.textHeight/2,$=!1;l=i.elementAtHeight(f),l.type!=xi.Text;)for(;f=n>0?l.bottom+E:l.top-E,!(f>=0&&f<=u);){if($)return e?null:0;$=!0,n=-n}d=a+f;let g=l.from;if(gi.viewport.to)return i.viewport.to==i.state.doc.length?i.state.doc.length:e?null:_d(i,s,l,c,d);let x=i.dom.ownerDocument,m=i.root.elementFromPoint?i.root:x,v=m.elementFromPoint(c,d);v&&!i.contentDOM.contains(v)&&(v=null),v||(c=Math.max(s.left+1,Math.min(s.right-1,c)),v=m.elementFromPoint(c,d),v&&!i.contentDOM.contains(v)&&(v=null));let O,b=-1;if(v&&((r=i.docView.nearest(v))===null||r===void 0?void 0:r.isEditable)!=!1){if(x.caretPositionFromPoint){let E=x.caretPositionFromPoint(c,d);E&&({offsetNode:O,offset:b}=E)}else if(x.caretRangeFromPoint){let E=x.caretRangeFromPoint(c,d);E&&({startContainer:O,startOffset:b}=E,(!i.contentDOM.contains(O)||Ut.safari&&ox(O,b,c)||Ut.chrome&&ax(O,b,c))&&(O=void 0))}}if(!O||!i.docView.dom.contains(O)){let E=je.find(i.docView,g);if(!E)return f>l.top+l.height/2?l.to:l.from;({node:O,offset:b}=zu(E.dom,c,d))}let k=i.docView.nearest(O);if(!k)return null;if(k.isWidget&&((o=k.dom)===null||o===void 0?void 0:o.nodeType)==1){let E=k.dom.getBoundingClientRect();return t.yi.defaultLineHeight*1.5){let a=i.viewState.heightOracle.textHeight,l=Math.floor((r-e.top-(i.defaultLineHeight-a)*.5)/a);o+=l*i.viewState.heightOracle.lineLength}let s=i.state.sliceDoc(e.from,e.to);return e.from+Tu(s,o,i.state.tabSize)}function ox(i,t,e){let n;if(i.nodeType!=3||t!=(n=i.nodeValue.length))return!1;for(let r=i.nextSibling;r;r=r.nextSibling)if(r.nodeType!=1||r.nodeName!="BR")return!1;return Ar(i,n-1,n).getBoundingClientRect().left>e}function ax(i,t,e){if(t!=0)return!1;for(let r=i;;){let o=r.parentNode;if(!o||o.nodeType!=1||o.firstChild!=r)return!1;if(o.classList.contains("cm-line"))break;r=o}let n=i.nodeType==1?i.getBoundingClientRect():Ar(i,0,Math.max(i.nodeValue.length,1)).getBoundingClientRect();return e-n.left>5}function ju(i,t){let e=i.lineBlockAt(t);if(Array.isArray(e.type)){for(let n of e.type)if(n.to>t||n.to==t&&(n.to==e.to||n.type==xi.Text))return n}return e}function lx(i,t,e,n){let r=ju(i,t.head),o=!n||r.type!=xi.Text||!(i.lineWrapping||r.widgetLineBreaks)?null:i.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head);if(o){let s=i.dom.getBoundingClientRect(),a=i.textDirectionAt(r.from),l=i.posAtCoords({x:e==(a==Me.LTR)?s.right-1:s.left+1,y:(o.top+o.bottom)/2});if(l!=null)return yt.cursor(l,e?-1:1)}return yt.cursor(e?r.to:r.from,e?-1:1)}function xd(i,t,e,n){let r=i.state.doc.lineAt(t.head),o=i.bidiSpans(r),s=i.textDirectionAt(r.from);for(let a=t,l=null;;){let u=j_(r,o,s,a,e),c=hg;if(!u){if(r.number==(e?i.state.doc.lines:1))return a;c=` -`,r=i.state.doc.line(r.number+(e?1:-1)),o=i.bidiSpans(r),u=i.visualLineSide(r,!e)}if(l){if(!l(c))return a}else{if(!n)return u;l=n(c)}a=u}}function hx(i,t,e){let n=i.state.charCategorizer(t),r=n(e);return o=>{let s=n(o);return r==Ne.Space&&(r=s),r==s}}function ux(i,t,e,n){let r=t.head,o=e?1:-1;if(r==(e?i.state.doc.length:0))return yt.cursor(r,t.assoc);let s=t.goalColumn,a,l=i.contentDOM.getBoundingClientRect(),u=i.coordsAtPos(r,t.assoc||-1),c=i.documentTop;if(u)s==null&&(s=u.left-l.left),a=o<0?u.top:u.bottom;else{let g=i.viewState.lineBlockAt(r);s==null&&(s=Math.min(l.right-l.left,i.defaultCharacterWidth*(r-g.from))),a=(o<0?g.top:g.bottom)+c}let d=l.left+s,f=n??i.viewState.heightOracle.textHeight>>1;for(let g=0;;g+=10){let x=a+(f+g)*o,m=Cg(i,{x:d,y:x},!1,o);if(xl.bottom||(o<0?mr)){let v=i.docView.coordsForChar(m),O=!v||x{if(t>o&&tr(i)),e.from,t.head>e.from?-1:1);return n==e.from?e:yt.cursor(n,nnull),Ut.gecko&&kx(t.contentDOM.ownerDocument)}handleEvent(t){!Ox(this.view,t)||this.ignoreDuringComposition(t)||t.type=="keydown"&&this.keydown(t)||this.runHandlers(t.type,t)}runHandlers(t,e){let n=this.handlers[t];if(n){for(let r of n.observers)r(this.view,e);for(let r of n.handlers){if(e.defaultPrevented)break;if(r(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=fx(t),n=this.handlers,r=this.view.contentDOM;for(let o in e)if(o!="scroll"){let s=!e[o].handlers.length,a=n[o];a&&s!=!a.handlers.length&&(r.removeEventListener(o,this.handleEvent),a=null),a||r.addEventListener(o,this.handleEvent,{passive:s})}for(let o in n)o!="scroll"&&!e[o]&&r.removeEventListener(o,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&Date.now()n.keyCode==t.keyCode))&&!t.ctrlKey||dx.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0):(t.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(t){let e=this.pendingIOSKey;return!e||e.key=="Enter"&&t&&t.from0?!0:Ut.safari&&!Ut.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function bd(i,t){return(e,n)=>{try{return t.call(i,n,e)}catch(r){Pi(e.state,r)}}}function fx(i){let t=Object.create(null);function e(n){return t[n]||(t[n]={observers:[],handlers:[]})}for(let n of i){let r=n.spec;if(r&&r.domEventHandlers)for(let o in r.domEventHandlers){let s=r.domEventHandlers[o];s&&e(o).handlers.push(bd(n.value,s))}if(r&&r.domEventObservers)for(let o in r.domEventObservers){let s=r.domEventObservers[o];s&&e(o).observers.push(bd(n.value,s))}}for(let n in nn)e(n).handlers.push(nn[n]);for(let n in ji)e(n).observers.push(ji[n]);return t}const Pg=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],dx="dthko",kg=[16,17,18,20,91,92,224,225],qo=6;function Vo(i){return Math.max(0,i)*.7+8}function px(i,t){return Math.max(Math.abs(i.clientX-t.clientX),Math.abs(i.clientY-t.clientY))}class mx{constructor(t,e,n,r){this.view=t,this.startEvent=e,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParent=D_(t.contentDOM),this.atoms=t.state.facet(Nc).map(s=>s(t));let o=t.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(ye.allowMultipleSelections)&&gx(t,e),this.dragging=yx(t,e)&&Dg(e)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){var e;if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&px(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let n=0,r=0,o=((e=this.scrollParent)===null||e===void 0?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},s=wg(this.view);t.clientX-s.left<=o.left+qo?n=-Vo(o.left-t.clientX):t.clientX+s.right>=o.right-qo&&(n=Vo(t.clientX-o.right)),t.clientY-s.top<=o.top+qo?r=-Vo(o.top-t.clientY):t.clientY+s.bottom>=o.bottom-qo&&(r=Vo(t.clientY-o.bottom)),this.setScrollSpeed(n,r)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(t){let e=null;for(let n=0;nthis.select(this.lastEvent),20)}}function gx(i,t){let e=i.state.facet(ug);return e.length?e[0](t):Ut.mac?t.metaKey:t.ctrlKey}function vx(i,t){let e=i.state.facet(cg);return e.length?e[0](t):Ut.mac?!t.altKey:!t.ctrlKey}function yx(i,t){let{main:e}=i.state.selection;if(e.empty)return!1;let n=Fa(i.root);if(!n||n.rangeCount==0)return!0;let r=n.getRangeAt(0).getClientRects();for(let o=0;o=t.clientX&&s.top<=t.clientY&&s.bottom>=t.clientY)return!0}return!1}function Ox(i,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target,n;e!=i.contentDOM;e=e.parentNode)if(!e||e.nodeType==11||(n=Te.get(e))&&n.ignoreEvent(t))return!1;return!0}const nn=Object.create(null),ji=Object.create(null),Lg=Ut.ie&&Ut.ie_version<15||Ut.ios&&Ut.webkit_version<604;function _x(i){let t=i.dom.parentNode;if(!t)return;let e=t.appendChild(document.createElement("textarea"));e.style.cssText="position: fixed; left: -10000px; top: 10px",e.focus(),setTimeout(()=>{i.focus(),e.remove(),Ag(i,e.value)},50)}function Ag(i,t){let{state:e}=i,n,r=1,o=e.toText(t),s=o.lines==e.selection.ranges.length;if(qu!=null&&e.selection.ranges.every(l=>l.empty)&&qu==o.toString()){let l=-1;n=e.changeByRange(u=>{let c=e.doc.lineAt(u.from);if(c.from==l)return{range:u};l=c.from;let d=e.toText((s?o.line(r++).text:t)+e.lineBreak);return{changes:{from:c.from,insert:d},range:yt.cursor(u.from+d.length)}})}else s?n=e.changeByRange(l=>{let u=o.line(r++);return{changes:{from:l.from,to:l.to,insert:u.text},range:yt.cursor(l.from+u.length)}}):n=e.replaceSelection(o);i.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}ji.scroll=i=>{i.inputState.lastScrollTop=i.scrollDOM.scrollTop,i.inputState.lastScrollLeft=i.scrollDOM.scrollLeft};nn.keydown=(i,t)=>(i.inputState.setSelectionOrigin("select"),t.keyCode==27&&(i.inputState.lastEscPress=Date.now()),!1);ji.touchstart=(i,t)=>{i.inputState.lastTouchTime=Date.now(),i.inputState.setSelectionOrigin("select.pointer")};ji.touchmove=i=>{i.inputState.setSelectionOrigin("select.pointer")};nn.mousedown=(i,t)=>{if(i.observer.flush(),i.inputState.lastTouchTime>Date.now()-2e3)return!1;let e=null;for(let n of i.state.facet(fg))if(e=n(i,t),e)break;if(!e&&t.button==0&&(e=wx(i,t)),e){let n=!i.hasFocus;i.inputState.startMouseSelection(new mx(i,t,e,n)),n&&i.observer.ignore(()=>Um(i.contentDOM));let r=i.inputState.mouseSelection;if(r)return r.start(t),r.dragging===!1}return!1};function wd(i,t,e,n){if(n==1)return yt.cursor(t,e);if(n==2)return nx(i.state,t,e);{let r=je.find(i.docView,t),o=i.state.doc.lineAt(r?r.posAtEnd:t),s=r?r.posAtStart:o.from,a=r?r.posAtEnd:o.to;return ai>=t.top&&i<=t.bottom,Sd=(i,t,e)=>Eg(t,e)&&i>=e.left&&i<=e.right;function xx(i,t,e,n){let r=je.find(i.docView,t);if(!r)return 1;let o=t-r.posAtStart;if(o==0)return 1;if(o==r.length)return-1;let s=r.coordsAt(o,-1);if(s&&Sd(e,n,s))return-1;let a=r.coordsAt(o,1);return a&&Sd(e,n,a)?1:s&&Eg(n,s)?-1:1}function Cd(i,t){let e=i.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:e,bias:xx(i,e,t.clientX,t.clientY)}}const bx=Ut.ie&&Ut.ie_version<=11;let Pd=null,kd=0,Ld=0;function Dg(i){if(!bx)return i.detail;let t=Pd,e=Ld;return Pd=i,Ld=Date.now(),kd=!t||e>Date.now()-400&&Math.abs(t.clientX-i.clientX)<2&&Math.abs(t.clientY-i.clientY)<2?(kd+1)%3:1}function wx(i,t){let e=Cd(i,t),n=Dg(t),r=i.state.selection;return{update(o){o.docChanged&&(e.pos=o.changes.mapPos(e.pos),r=r.map(o.changes))},get(o,s,a){let l=Cd(i,o),u,c=wd(i,l.pos,l.bias,n);if(e.pos!=l.pos&&!s){let d=wd(i,e.pos,e.bias,n),f=Math.min(d.from,c.from),g=Math.max(d.to,c.to);c=f1&&(u=Sx(r,l.pos))?u:a?r.addRange(c):yt.create([c])}}}function Sx(i,t){for(let e=0;e=t)return yt.create(i.ranges.slice(0,e).concat(i.ranges.slice(e+1)),i.mainIndex==e?0:i.mainIndex-(i.mainIndex>e?1:0))}return null}nn.dragstart=(i,t)=>{let{selection:{main:e}}=i.state;if(t.target.draggable){let r=i.docView.nearest(t.target);if(r&&r.isWidget){let o=r.posAtStart,s=o+r.length;(o>=e.to||s<=e.from)&&(e=yt.range(o,s))}}let{inputState:n}=i;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=e,t.dataTransfer&&(t.dataTransfer.setData("Text",i.state.sliceDoc(e.from,e.to)),t.dataTransfer.effectAllowed="copyMove"),!1};nn.dragend=i=>(i.inputState.draggedContent=null,!1);function Ad(i,t,e,n){if(!e)return;let r=i.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:o}=i.inputState,s=n&&o&&vx(i,t)?{from:o.from,to:o.to}:null,a={from:r,insert:e},l=i.state.changes(s?[s,a]:a);i.focus(),i.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:s?"move.drop":"input.drop"}),i.inputState.draggedContent=null}nn.drop=(i,t)=>{if(!t.dataTransfer)return!1;if(i.state.readOnly)return!0;let e=t.dataTransfer.files;if(e&&e.length){let n=Array(e.length),r=0,o=()=>{++r==e.length&&Ad(i,t,n.filter(s=>s!=null).join(i.state.lineBreak),!1)};for(let s=0;s{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(n[s]=a.result),o()},a.readAsText(e[s])}return!0}else{let n=t.dataTransfer.getData("Text");if(n)return Ad(i,t,n,!0),!0}return!1};nn.paste=(i,t)=>{if(i.state.readOnly)return!0;i.observer.flush();let e=Lg?null:t.clipboardData;return e?(Ag(i,e.getData("text/plain")||e.getData("text/uri-list")),!0):(_x(i),!1)};function Cx(i,t){let e=i.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=t,n.focus(),n.selectionEnd=t.length,n.selectionStart=0,setTimeout(()=>{n.remove(),i.focus()},50)}function Px(i){let t=[],e=[],n=!1;for(let r of i.selection.ranges)r.empty||(t.push(i.sliceDoc(r.from,r.to)),e.push(r));if(!t.length){let r=-1;for(let{from:o}of i.selection.ranges){let s=i.doc.lineAt(o);s.number>r&&(t.push(s.text),e.push({from:s.from,to:Math.min(i.doc.length,s.to+1)})),r=s.number}n=!0}return{text:t.join(i.lineBreak),ranges:e,linewise:n}}let qu=null;nn.copy=nn.cut=(i,t)=>{let{text:e,ranges:n,linewise:r}=Px(i.state);if(!e&&!r)return!1;qu=r?e:null,t.type=="cut"&&!i.state.readOnly&&i.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let o=Lg?null:t.clipboardData;return o?(o.clearData(),o.setData("text/plain",e),!0):(Cx(i,e),!1)};const Tg=In.define();function Ig(i,t){let e=[];for(let n of i.facet(mg)){let r=n(i,t);r&&e.push(r)}return e?i.update({effects:e,annotations:Tg.of(!0)}):null}function Mg(i){setTimeout(()=>{let t=i.hasFocus;if(t!=i.inputState.notifiedFocused){let e=Ig(i.state,t);e?i.dispatch(e):i.update([])}},10)}ji.focus=i=>{i.inputState.lastFocusTime=Date.now(),!i.scrollDOM.scrollTop&&(i.inputState.lastScrollTop||i.inputState.lastScrollLeft)&&(i.scrollDOM.scrollTop=i.inputState.lastScrollTop,i.scrollDOM.scrollLeft=i.inputState.lastScrollLeft),Mg(i)};ji.blur=i=>{i.observer.clearSelectionRange(),Mg(i)};ji.compositionstart=ji.compositionupdate=i=>{i.inputState.compositionFirstChange==null&&(i.inputState.compositionFirstChange=!0),i.inputState.composing<0&&(i.inputState.composing=0)};ji.compositionend=i=>{i.inputState.composing=-1,i.inputState.compositionEndedAt=Date.now(),i.inputState.compositionPendingKey=!0,i.inputState.compositionPendingChange=i.observer.pendingRecords().length>0,i.inputState.compositionFirstChange=null,Ut.chrome&&Ut.android?i.observer.flushSoon():i.inputState.compositionPendingChange?Promise.resolve().then(()=>i.observer.flush()):setTimeout(()=>{i.inputState.composing<0&&i.docView.hasComposition&&i.update([])},50)};ji.contextmenu=i=>{i.inputState.lastContextMenu=Date.now()};nn.beforeinput=(i,t)=>{var e;let n;if(Ut.chrome&&Ut.android&&(n=Pg.find(r=>r.inputType==t.inputType))&&(i.observer.delayAndroidKey(n.key,n.keyCode),n.key=="Backspace"||n.key=="Delete")){let r=((e=window.visualViewport)===null||e===void 0?void 0:e.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>r+10&&i.hasFocus&&(i.contentDOM.blur(),i.focus())},100)}return Ut.ios&&t.inputType=="deleteContentForward"&&i.observer.flushSoon(),Ut.safari&&t.inputType=="insertText"&&i.inputState.composing>=0&&setTimeout(()=>ji.compositionend(i,t),20),!1};const Ed=new Set;function kx(i){Ed.has(i)||(Ed.add(i),i.addEventListener("copy",()=>{}),i.addEventListener("cut",()=>{}))}const Dd=["pre-wrap","normal","pre-line","break-spaces"];class Lx{constructor(t){this.lineWrapping=t,this.doc=we.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(t,e){let n=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((e-t-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}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}mustRefreshForWrapping(t){return Dd.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let n=0;n-1,l=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=e,this.charWidth=n,this.textHeight=r,this.lineLength=o,l){this.heightSamples={};for(let u=0;u0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>Aa&&(t.heightChanged=!0),this.height=e)}replace(t,e,n){return bi.of(n)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,n,r){let o=this,s=n.doc;for(let a=r.length-1;a>=0;a--){let{fromA:l,toA:u,fromB:c,toB:d}=r[a],f=o.lineAt(l,Qe.ByPosNoHeight,n.setDoc(e),0,0),g=f.to>=u?f:o.lineAt(u,Qe.ByPosNoHeight,n,0,0);for(d+=g.to-u,u=g.to;a>0&&f.from<=r[a-1].toA;)l=r[a-1].fromA,c=r[a-1].fromB,a--,lo*2){let a=t[e-1];a.break?t.splice(--e,1,a.left,null,a.right):t.splice(--e,1,a.left,a.right),n+=1+a.break,r-=a.size}else if(o>r*2){let a=t[n];a.break?t.splice(n,1,a.left,null,a.right):t.splice(n,1,a.left,a.right),n+=2+a.break,o-=a.size}else break;else if(r=o&&s(this.blockAt(0,n,r,o))}updateHeight(t,e=0,n=!1,r){return r&&r.from<=e&&r.more&&this.setHeight(t,r.heights[r.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ii extends $g{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,n,r){return new gn(r,this.length,n,this.height,this.breaks)}replace(t,e,n){let r=n[0];return n.length==1&&(r instanceof Ii||r instanceof oi&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof oi?r=new Ii(r.length,this.height):r.height=this.height,this.outdated||(r.outdated=!1),r):bi.of(n)}updateHeight(t,e=0,n=!1,r){return r&&r.from<=e&&r.more?this.setHeight(t,r.heights[r.index++]):(n||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class oi extends bi{constructor(t){super(t,0)}heightMetrics(t,e){let n=t.doc.lineAt(e).number,r=t.doc.lineAt(e+this.length).number,o=r-n+1,s,a=0;if(t.lineWrapping){let l=Math.min(this.height,t.lineHeight*o);s=l/o,this.length>o+1&&(a=(this.height-l)/(this.length-o-1))}else s=this.height/o;return{firstLine:n,lastLine:r,perLine:s,perChar:a}}blockAt(t,e,n,r){let{firstLine:o,lastLine:s,perLine:a,perChar:l}=this.heightMetrics(e,r);if(e.lineWrapping){let u=r+(t0){let o=n[n.length-1];o instanceof oi?n[n.length-1]=new oi(o.length+r):n.push(null,new oi(r-1))}if(t>0){let o=n[0];o instanceof oi?n[0]=new oi(t+o.length):n.unshift(new oi(t-1),null)}return bi.of(n)}decomposeLeft(t,e){e.push(new oi(t-1),null)}decomposeRight(t,e){e.push(null,new oi(this.length-t-1))}updateHeight(t,e=0,n=!1,r){let o=e+this.length;if(r&&r.from<=e+this.length&&r.more){let s=[],a=Math.max(e,r.from),l=-1;for(r.from>e&&s.push(new oi(r.from-e-1).updateHeight(t,e));a<=o&&r.more;){let c=t.doc.lineAt(a).length;s.length&&s.push(null);let d=r.heights[r.index++];l==-1?l=d:Math.abs(d-l)>=Aa&&(l=-2);let f=new Ii(c,d);f.outdated=!1,s.push(f),a+=c+1}a<=o&&s.push(null,new oi(o-a).updateHeight(t,a));let u=bi.of(s);return(l<0||Math.abs(u.height-this.height)>=Aa||Math.abs(l-this.heightMetrics(t,e).perLine)>=Aa)&&(t.heightChanged=!0),u}else(n||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Ex extends bi{constructor(t,e,n){super(t.length+e+n.length,t.height+n.height,e|(t.outdated||n.outdated?2:0)),this.left=t,this.right=n,this.size=t.size+n.size}get break(){return this.flags&1}blockAt(t,e,n,r){let o=n+this.left.height;return ta))return u;let c=e==Qe.ByPosNoHeight?Qe.ByPosNoHeight:Qe.ByPos;return l?u.join(this.right.lineAt(a,c,n,s,a)):this.left.lineAt(a,c,n,r,o).join(u)}forEachLine(t,e,n,r,o,s){let a=r+this.left.height,l=o+this.left.length+this.break;if(this.break)t=l&&this.right.forEachLine(t,e,n,a,l,s);else{let u=this.lineAt(l,Qe.ByPos,n,r,o);t=t&&u.from<=e&&s(u),e>u.to&&this.right.forEachLine(u.to+1,e,n,a,l,s)}}replace(t,e,n){let r=this.left.length+this.break;if(ethis.left.length)return this.balanced(this.left,this.right.replace(t-r,e-r,n));let o=[];t>0&&this.decomposeLeft(t,o);let s=o.length;for(let a of n)o.push(a);if(t>0&&Td(o,s-1),e=n&&e.push(null)),t>n&&this.right.decomposeLeft(t-n,e)}decomposeRight(t,e){let n=this.left.length,r=n+this.break;if(t>=r)return this.right.decomposeRight(t-r,e);t2*e.size||e.size>2*t.size?bi.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,n=!1,r){let{left:o,right:s}=this,a=e+o.length+this.break,l=null;return r&&r.from<=e+o.length&&r.more?l=o=o.updateHeight(t,e,n,r):o.updateHeight(t,e,n),r&&r.from<=a+s.length&&r.more?l=s=s.updateHeight(t,a,n,r):s.updateHeight(t,a,n),l?this.balanced(o,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Td(i,t){let e,n;i[t]==null&&(e=i[t-1])instanceof oi&&(n=i[t+1])instanceof oi&&i.splice(t-1,3,new oi(e.length+1+n.length))}const Dx=5;class Bc{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 n=Math.min(e,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof Ii?r.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Ii(n-this.pos,-1)),this.writtenTo=n,e>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,n){if(t=Dx)&&this.addLineDeco(r,o,s)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTot&&this.nodes.push(new Ii(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let n=new oi(e-t);return this.oracle.doc.lineAt(t).to==e&&(n.flags|=4),n}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Ii)return t;let e=new Ii(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,t),r.breaks+=e,this.writtenTo=this.pos=this.pos+n}finish(t){let e=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(e instanceof Ii)&&!this.isCovered?this.nodes.push(new Ii(0,-1)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&d.overflow!="visible"){let f=c.getBoundingClientRect();o=Math.max(o,f.left),s=Math.min(s,f.right),a=Math.max(a,f.top),l=u==i.parentNode?f.bottom:Math.min(l,f.bottom)}u=d.position=="absolute"||d.position=="fixed"?c.offsetParent:c.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:o-e.left,right:Math.max(o,s)-e.left,top:a-(e.top+t),bottom:Math.max(a,l)-(e.top+t)}}function $x(i,t){let e=i.getBoundingClientRect();return{left:0,right:e.right-e.left,top:t,bottom:e.bottom-(e.top+t)}}class kh{constructor(t,e,n){this.from=t,this.to=e,this.size=n}static same(t,e){if(t.length!=e.length)return!1;for(let n=0;ntypeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Lx(e),this.stateDeco=t.facet(so).filter(n=>typeof n!="function"),this.heightMap=bi.empty().applyChanges(this.stateDeco,we.empty,this.heightOracle.setDoc(t.doc),[new zi(0,0,0,t.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Gt.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let n=0;n<=1;n++){let r=n?e.head:e.anchor;if(!t.some(({from:o,to:s})=>r>=o&&r<=s)){let{from:o,to:s}=this.lineBlockAt(r);t.push(new Go(o,s))}}this.viewports=t.sort((n,r)=>n.from-r.from),this.scaler=this.heightMap.height<=7e6?Md:new Fx(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(this.scaler.scale==1?t:Bs(t,this.scaler))})}update(t,e=null){this.state=t.state;let n=this.stateDeco;this.stateDeco=this.state.facet(so).filter(c=>typeof c!="function");let r=t.changedRanges,o=zi.extendWithRanges(r,Tx(n,this.stateDeco,t?t.changes:Ge.empty(this.state.doc.length))),s=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),o),this.heightMap.height!=s&&(t.flags|=2),a?(this.scrollAnchorPos=t.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let l=o.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.headl.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,e));let u=!t.changes.empty||t.flags&2||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),u&&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&&!t.state.facet(vg)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,n=window.getComputedStyle(e),r=this.heightOracle,o=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?Me.RTL:Me.LTR;let s=this.heightOracle.mustRefreshForWrapping(o),a=e.getBoundingClientRect(),l=s||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let u=0,c=0;if(a.width&&a.height){let{scaleX:E,scaleY:$}=Wm(e,a);(E>.005&&Math.abs(this.scaleX-E)>.005||$>.005&&Math.abs(this.scaleY-$)>.005)&&(this.scaleX=E,this.scaleY=$,u|=8,s=l=!0)}let d=(parseInt(n.paddingTop)||0)*this.scaleY,f=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=d||this.paddingBottom!=f)&&(this.paddingTop=d,this.paddingBottom=f,u|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(r.lineWrapping&&(l=!0),this.editorWidth=t.scrollDOM.clientWidth,u|=8);let g=t.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=g&&(this.scrollAnchorHeight=-1,this.scrollTop=g),this.scrolledToBottom=jm(t.scrollDOM);let x=(this.printing?$x:Mx)(e,this.paddingTop),m=x.top-this.pixelViewport.top,v=x.bottom-this.pixelViewport.bottom;this.pixelViewport=x;let O=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(O!=this.inView&&(this.inView=O,O&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let b=a.width;if((this.contentDOMWidth!=b||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=t.scrollDOM.clientHeight,u|=8),l){let E=t.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(E)&&(s=!0),s||r.lineWrapping&&Math.abs(b-this.contentDOMWidth)>r.charWidth){let{lineHeight:$,charWidth:N,textHeight:X}=t.docView.measureTextSize();s=$>0&&r.refresh(o,$,N,X,b/N,E),s&&(t.docView.minWidth=0,u|=8)}m>0&&v>0?c=Math.max(m,v):m<0&&v<0&&(c=Math.min(m,v)),r.heightChanged=!1;for(let $ of this.viewports){let N=$.from==this.viewport.from?E:t.docView.measureVisibleLineHeights($);this.heightMap=(s?bi.empty().applyChanges(this.stateDeco,we.empty,this.heightOracle,[new zi(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(r,0,s,new Ax($.from,N))}r.heightChanged&&(u|=2)}let k=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return k&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(u&2||k)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,t)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let n=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),r=this.heightMap,o=this.heightOracle,{visibleTop:s,visibleBottom:a}=this,l=new Go(r.lineAt(s-n*1e3,Qe.ByHeight,o,0,0).from,r.lineAt(a+(1-n)*1e3,Qe.ByHeight,o,0,0).to);if(e){let{head:u}=e.range;if(ul.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),d=r.lineAt(u,Qe.ByPos,o,0,0),f;e.y=="center"?f=(d.top+d.bottom)/2-c/2:e.y=="start"||e.y=="nearest"&&u=a+Math.max(10,Math.min(n,250)))&&r>s-2*1e3&&o>1,s=r<<1;if(this.defaultTextDirection!=Me.LTR&&!n)return[];let a=[],l=(u,c,d,f)=>{if(c-uu&&vv.from>=d.from&&v.to<=d.to&&Math.abs(v.from-u)v.fromO));if(!m){if(cv.from<=c&&v.to>=c)){let v=e.moveToLineBoundary(yt.cursor(c),!1,!0).head;v>u&&(c=v)}m=new kh(u,c,this.gapSize(d,u,c,f))}a.push(m)};for(let u of this.viewportLines){if(u.lengthu.from&&l(u.from,f,u,c),ge.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];ge.spans(t,this.viewport.from,this.viewport.to,{span(r,o){e.push({from:r,to:o})},point(){}},20);let n=e.length!=this.visibleRanges.length||this.visibleRanges.some((r,o)=>r.from!=e[o].from||r.to!=e[o].to);return this.visibleRanges=e,n?4:0}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||Bs(this.heightMap.lineAt(t,Qe.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return Bs(this.heightMap.lineAt(this.scaler.fromDOM(t),Qe.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return Bs(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Go{constructor(t,e){this.from=t,this.to=e}}function Nx(i,t,e){let n=[],r=i,o=0;return ge.spans(e,i,t,{span(){},point(s,a){s>r&&(n.push({from:r,to:s}),o+=s-r),r=a}},20),r=1)return t[t.length-1].to;let n=Math.floor(i*e);for(let r=0;;r++){let{from:o,to:s}=t[r],a=s-o;if(n<=a)return o+n;n-=a}}function Jo(i,t){let e=0;for(let{from:n,to:r}of i.ranges){if(t<=r){e+=t-n;break}e+=r-n}return e/i.total}function Bx(i,t){for(let e of i)if(t(e))return e}const Md={toDOM(i){return i},fromDOM(i){return i},scale:1};class Fx{constructor(t,e,n){let r=0,o=0,s=0;this.viewports=n.map(({from:a,to:l})=>{let u=e.lineAt(a,Qe.ByPos,t,0,0).top,c=e.lineAt(l,Qe.ByPos,t,0,0).bottom;return r+=c-u,{from:a,to:l,top:u,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(e.height-r);for(let a of this.viewports)a.domTop=s+(a.top-o)*this.scale,s=a.domBottom=a.domTop+(a.bottom-a.top),o=a.bottom}toDOM(t){for(let e=0,n=0,r=0;;e++){let o=eBs(r,t)):i._content)}const Ko=Zt.define({combine:i=>i.join(" ")}),Vu=Zt.define({combine:i=>i.indexOf(!0)>-1}),Gu=ir.newName(),Qg=ir.newName(),Ng=ir.newName(),Bg={"&light":"."+Qg,"&dark":"."+Ng};function Hu(i,t,e){return new ir(t,{finish(n){return/&/.test(n)?n.replace(/&\w*/,r=>{if(r=="&")return i;if(!e||!e[r])throw new RangeError(`Unsupported selector: ${r}`);return e[r]}):i+" "+n}})}const Xx=Hu("."+Gu,{"&":{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,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",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",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".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"}},Bg),Fs="￿";class Rx{constructor(t,e){this.points=t,this.text="",this.lineSeparator=e.facet(ye.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=Fs}readRange(t,e){if(!t)return this;let n=t.parentNode;for(let r=t;;){this.findPointBefore(n,r);let o=this.text.length;this.readNode(r);let s=r.nextSibling;if(s==e)break;let a=Te.get(r),l=Te.get(s);(a&&l?a.breakAfter:(a?a.breakAfter:Xa(r))||Xa(s)&&(r.nodeName!="BR"||r.cmIgnore)&&this.text.length>o)&&this.lineBreak(),r=s}return this.findPointBefore(n,e),this}readTextNode(t){let e=t.nodeValue;for(let n of this.points)n.node==t&&(n.pos=this.text.length+Math.min(n.offset,e.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let o=-1,s=1,a;if(this.lineSeparator?(o=e.indexOf(this.lineSeparator,n),s=this.lineSeparator.length):(a=r.exec(e))&&(o=a.index,s=a[0].length),this.append(e.slice(n,o<0?e.length:o)),o<0)break;if(this.lineBreak(),s>1)for(let l of this.points)l.node==t&&l.pos>this.text.length&&(l.pos-=s-1);n=o+s}}readNode(t){if(t.cmIgnore)return;let e=Te.get(t),n=e&&e.overrideDOMText;if(n!=null){this.findPointInside(t,n.length);for(let r=n.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.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 n of this.points)n.node==t&&t.childNodes[n.offset]==e&&(n.pos=this.text.length)}findPointInside(t,e){for(let n of this.points)(t.nodeType==3?n.node==t:t.contains(n.node))&&(n.pos=this.text.length+(Yx(t,n.node,n.offset)?e:0))}}function Yx(i,t,e){for(;;){if(!t||e-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,n,0))){let a=o||s?[]:zx(t),l=new Rx(a,t.state);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=jx(a,this.bounds.from)}else{let a=t.observer.selectionRange,l=o&&o.node==a.focusNode&&o.offset==a.focusOffset||!$u(t.contentDOM,a.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(a.focusNode,a.focusOffset),u=s&&s.node==a.anchorNode&&s.offset==a.anchorOffset||!$u(t.contentDOM,a.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(a.anchorNode,a.anchorOffset),c=t.viewport;if((Ut.ios||Ut.chrome)&&t.state.selection.main.empty&&l!=u&&(c.from>0||c.toDate.now()-100?i.inputState.lastKeyCode:-1;if(t.bounds){let{from:s,to:a}=t.bounds,l=r.from,u=null;(o===8||Ut.android&&t.text.length=r.from&&e.to<=r.to&&(e.from!=r.from||e.to!=r.to)&&r.to-r.from-(e.to-e.from)<=4?e={from:r.from,to:r.to,insert:i.state.doc.slice(r.from,e.from).append(e.insert).append(i.state.doc.slice(e.to,r.to))}:(Ut.mac||Ut.android)&&e&&e.from==e.to&&e.from==r.head-1&&/^\. ?$/.test(e.insert.toString())&&i.contentDOM.getAttribute("autocorrect")=="off"?(n&&e.insert.length==2&&(n=yt.single(n.main.anchor-1,n.main.head-1)),e={from:r.from,to:r.to,insert:we.of([" "])}):Ut.chrome&&e&&e.from==e.to&&e.from==r.head&&e.insert.toString()==` - `&&i.lineWrapping&&(n&&(n=yt.single(n.main.anchor-1,n.main.head-1)),e={from:r.from,to:r.to,insert:we.of([" "])}),e){if(Ut.ios&&i.inputState.flushIOSKey(e)||Ut.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&i.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Hr(i.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||o==8&&e.insert.lengthr.head)&&Hr(i.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&Hr(i.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let a,l=()=>a||(a=Wx(i,e,n));return i.state.facet(pg).some(u=>u(i,e.from,e.to,s,l))||i.dispatch(l()),!0}else if(n&&!n.main.eq(r)){let s=!1,a="select";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin=="select"&&(s=!0),a=i.inputState.lastSelectionOrigin),i.dispatch({selection:n,scrollIntoView:s,userEvent:a}),!0}else return!1}function Wx(i,t,e){let n,r=i.state,o=r.selection.main;if(t.from>=o.from&&t.to<=o.to&&t.to-t.from>=(o.to-o.from)/3&&(!e||e.main.empty&&e.main.from==t.from+t.insert.length)&&i.inputState.composing<0){let a=o.fromt.to?r.sliceDoc(t.to,o.to):"";n=r.replaceSelection(i.state.toText(a+t.insert.sliceString(0,void 0,i.state.lineBreak)+l))}else{let a=r.changes(t),l=e&&e.main.to<=a.newLength?e.main:void 0;if(r.selection.ranges.length>1&&i.inputState.composing>=0&&t.to<=o.to&&t.to>=o.to-10){let u=i.state.sliceDoc(t.from,t.to),c,d=e&&Sg(i,e.main.head);if(d){let x=t.insert.length-(t.to-t.from);c={from:d.from,to:d.to-x}}else c=i.state.doc.lineAt(o.head);let f=o.to-t.to,g=o.to-o.from;n=r.changeByRange(x=>{if(x.from==o.from&&x.to==o.to)return{changes:a,range:l||x.map(a)};let m=x.to-f,v=m-u.length;if(x.to-x.from!=g||i.state.sliceDoc(v,m)!=u||x.to>=c.from&&x.from<=c.to)return{range:x};let O=r.changes({from:v,to:m,insert:t.insert}),b=x.to-o.to;return{changes:O,range:l?yt.range(Math.max(0,l.anchor+b),Math.max(0,l.head+b)):x.map(O)}})}else n={changes:a,selection:l&&r.selection.replaceRange(l)}}let s="input.type";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,s+=".compose",i.inputState.compositionFirstChange&&(s+=".start",i.inputState.compositionFirstChange=!1)),r.update(n,{userEvent:s,scrollIntoView:!0})}function Ux(i,t,e,n){let r=Math.min(i.length,t.length),o=0;for(;o0&&a>0&&i.charCodeAt(s-1)==t.charCodeAt(a-1);)s--,a--;if(n=="end"){let l=Math.max(0,o-Math.min(s,a));e-=s+l-o}if(s=s?o-e:0;o-=l,a=o+(a-s),s=o}else if(a=a?o-e:0;o-=l,s=o+(s-a),a=o}return{from:o,toA:s,toB:a}}function zx(i){let t=[];if(i.root.activeElement!=i.contentDOM)return t;let{anchorNode:e,anchorOffset:n,focusNode:r,focusOffset:o}=i.observer.selectionRange;return e&&(t.push(new $d(e,n)),(r!=e||o!=n)&&t.push(new $d(r,o))),t}function jx(i,t){if(i.length==0)return null;let e=i[0].pos,n=i.length==2?i[1].pos:e;return e>-1&&n>-1?yt.single(e+t,n+t):null}const qx={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Lh=Ut.ie&&Ut.ie_version<=11;class Vx{constructor(t){this.view=t,this.active=!1,this.selectionRange=new T_,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let n of e)this.queue.push(n);(Ut.ie&&Ut.ie_version<=11||Ut.ios&&t.composing)&&e.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),Lh&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var e;((e=this.view.docView)===null||e===void 0?void 0:e.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){t.type=="change"&&!t.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,n)=>e!=t[n]))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(El)?n.root.activeElement!=this.dom:!ka(n.dom,r))return;let o=r.anchorNode&&n.docView.nearest(r.anchorNode);if(o&&o.ignoreEvent(t)){e||(this.selectionChanged=!1);return}(Ut.ie&&Ut.ie_version<=11||Ut.android&&Ut.chrome)&&!n.state.selection.main.empty&&r.focusNode&&zs(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=Fa(t.root);if(!e)return!1;let n=Ut.safari&&t.root.nodeType==11&&L_(this.dom.ownerDocument)==this.dom&&Gx(this.view,e)||e;if(!n||this.selectionRange.eq(n))return!1;let r=ka(this.dom,n);return r&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let o=this.delayedAndroidKey;o&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=o.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&o.force&&Hr(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,n=-1,r=!1;for(let o of t){let s=this.readMutation(o);s&&(s.typeOver&&(r=!0),e==-1?{from:e,to:n}=s:(e=Math.min(s.from,e),n=Math.max(s.to,n)))}return{from:e,to:n,typeOver:r}}readChange(){let{from:t,to:e,typeOver:n}=this.processRecords(),r=this.selectionChanged&&ka(this.dom,this.selectionRange);if(t<0&&!r)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new Zx(this.view,t,e,n);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let n=this.view.state,r=Fg(this.view,e);return this.view.state==n&&this.view.update([]),r}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.flags|=4),t.type=="childList"){let n=Qd(e,t.previousSibling||t.target.previousSibling,-1),r=Qd(e,t.nextSibling||t.target.nextSibling,1);return{from:n?e.posAfter(n):e.posAtStart,to:r?e.posBefore(r):e.posAtEnd,typeOver:!1}}else return t.type=="characterData"?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener("change",this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener("change",this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var t,e,n;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(e=this.gapIntersection)===null||e===void 0||e.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function Qd(i,t,e){for(;t;){let n=Te.get(t);if(n&&n.parent==i)return n;let r=t.parentNode;t=r!=i.dom?r:e>0?t.nextSibling:t.previousSibling}return null}function Nd(i,t){let e=t.startContainer,n=t.startOffset,r=t.endContainer,o=t.endOffset,s=i.docView.domAtPos(i.state.selection.main.anchor);return zs(s.node,s.offset,r,o)&&([e,n,r,o]=[r,o,e,n]),{anchorNode:e,anchorOffset:n,focusNode:r,focusOffset:o}}function Gx(i,t){if(t.getComposedRanges){let r=t.getComposedRanges(i.root)[0];if(r)return Nd(i,r)}let e=null;function n(r){r.preventDefault(),r.stopImmediatePropagation(),e=r.getTargetRanges()[0]}return i.contentDOM.addEventListener("beforeinput",n,!0),i.dom.ownerDocument.execCommand("indent"),i.contentDOM.removeEventListener("beforeinput",n,!0),e?Nd(i,e):null}class Rt{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}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}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.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:e}=t;this.dispatchTransactions=t.dispatchTransactions||e&&(n=>n.forEach(r=>e(r,this)))||(n=>this.update(n)),this.dispatch=this.dispatch.bind(this),this._root=t.root||I_(t.parent)||document,this.viewState=new Id(t.state||ye.create(t)),t.scrollTo&&t.scrollTo.is(jo)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Qs).map(n=>new Sh(n));for(let n of this.plugins)n.update(this);this.observer=new Vx(this),this.inputState=new cx(this),this.inputState.ensureHandlers(this.plugins),this.docView=new md(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...t){let e=t.length==1&&t[0]instanceof Ke?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}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,n=!1,r,o=this.state;for(let f of t){if(f.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=f.state}if(this.destroyed){this.viewState.state=o;return}let s=this.hasFocus,a=0,l=null;t.some(f=>f.annotation(Tg))?(this.inputState.notifiedFocused=s,a=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,l=Ig(o,s),l||(a=1));let u=this.observer.delayedAndroidKey,c=null;if(u?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(c=null)):this.observer.clear(),o.facet(ye.phrases)!=this.state.facet(ye.phrases))return this.setState(o);r=Ra.create(this,o,t),r.flags|=a;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let f of t){if(d&&(d=d.map(f.changes)),f.scrollIntoView){let{main:g}=f.state.selection;d=new Jr(g.empty?g:yt.cursor(g.head,g.head>g.anchor?-1:1))}for(let g of f.effects)g.is(jo)&&(d=g.value.clip(this.state))}this.viewState.update(r,d),this.bidiCache=Ya.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),e=this.docView.update(r),this.state.facet(Ns)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(e,t.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(Ko)!=r.state.facet(Ko)&&(this.viewState.mustMeasureContent=!0),(e||n||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),e&&this.docViewUpdate(),!r.empty)for(let f of this.state.facet(Uu))try{f(r)}catch(g){Pi(this.state,g,"update listener")}(l||c)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),c&&!Fg(this,c)&&u.force&&Hr(this.contentDOM,u.key,u.keyCode)})}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 n of this.plugins)n.destroy(this);this.viewState=new Id(t),this.plugins=t.facet(Qs).map(n=>new Sh(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new md(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(Qs),n=t.state.facet(Qs);if(e!=n){let r=[];for(let o of n){let s=e.indexOf(o);if(s<0)r.push(new Sh(o));else{let a=this.plugins[s];a.mustUpdate=t,r.push(a)}}for(let o of this.plugins)o.mustUpdate!=t&&o.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=t;for(let r=0;r-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,n=this.scrollDOM,r=n.scrollTop*this.scaleY,{scrollAnchorPos:o,scrollAnchorHeight:s}=this.viewState;Math.abs(r-this.viewState.scrollTop)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(s<0)if(jm(n))o=-1,s=this.viewState.heightMap.height;else{let g=this.viewState.scrollAnchorAt(r);o=g.from,s=g.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];l&4||([this.measureRequests,u]=[u,this.measureRequests]);let c=u.map(g=>{try{return g.read(this)}catch(x){return Pi(this.state,x),Bd}}),d=Ra.create(this,this.state,[]),f=!1;d.flags|=l,e?e.flags|=l:e=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),f=this.docView.update(d),f&&this.docViewUpdate());for(let g=0;g1||x<-1){r=r+x,n.scrollTop=r/this.scaleY,s=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let a of this.state.facet(Uu))a(e)}get themeClasses(){return Gu+" "+(this.state.facet(Vu)?Ng:Qg)+" "+this.state.facet(Ko)}updateAttrs(){let t=Fd(this,Og,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(El)?"true":"false",class:"cm-content",style:`${Ut.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Fd(this,Qc,e);let n=this.observer.ignore(()=>{let r=Xu(this.contentDOM,this.contentAttrs,e),o=Xu(this.dom,this.editorAttrs,t);return r||o});return this.editorAttrs=t,this.contentAttrs=e,n}showAnnouncements(t){let e=!0;for(let n of t)for(let r of n.effects)if(r.is(Rt.announce)){e&&(this.announceDOM.textContent=""),e=!1;let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(Ns);let t=this.state.facet(Rt.cspNonce);ir.mount(this.root,this.styleModules.concat(Xx).reverse(),t?{nonce:t}:void 0)}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=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let e=0;en.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}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,n){return Ph(this,t,xd(this,t,e,n))}moveByGroup(t,e){return Ph(this,t,xd(this,t,e,n=>hx(this,t.head,n)))}visualLineSide(t,e){let n=this.bidiSpans(t),r=this.textDirectionAt(t.from),o=n[e?n.length-1:0];return yt.cursor(o.side(e,r)+t.from,o.forward(!e,r)?1:-1)}moveToLineBoundary(t,e,n=!0){return lx(this,t,e,n)}moveVertically(t,e,n){return Ph(this,t,ux(this,t,e,n))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),Cg(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let n=this.docView.coordsAt(t,e);if(!n||n.left==n.right)return n;let r=this.state.doc.lineAt(t),o=this.bidiSpans(r),s=o[Gn.find(o,t-r.from,-1,e)];return Tc(n,s.dir==Me.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(gg)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Hx)return lg(t.length);let e=this.textDirectionAt(t.from),n;for(let o of this.bidiCache)if(o.from==t.from&&o.dir==e&&(o.fresh||ag(o.isolates,n=pd(this,t))))return o.order;n||(n=pd(this,t));let r=z_(t.text,e,n);return this.bidiCache.push(new Ya(t.from,t.to,e,n,!0,r)),r}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Ut.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Um(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return jo.of(new Jr(typeof t=="number"?yt.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,n=this.viewState.scrollAnchorAt(t);return jo.of(new Jr(yt.cursor(n.from),"start","start",n.top-t,e,!0))}static domEventHandlers(t){return Fe.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return Fe.define(()=>({}),{eventObservers:t})}static theme(t,e){let n=ir.newName(),r=[Ko.of(n),Ns.of(Hu(`.${n}`,t))];return e&&e.dark&&r.push(Vu.of(!0)),r}static baseTheme(t){return lr.lowest(Ns.of(Hu("."+Gu,t,Bg)))}static findFromDOM(t){var e;let n=t.querySelector(".cm-content"),r=n&&Te.get(n)||Te.get(t);return((e=r==null?void 0:r.rootView)===null||e===void 0?void 0:e.view)||null}}Rt.styleModule=Ns;Rt.inputHandler=pg;Rt.scrollHandler=yg;Rt.focusChangeEffect=mg;Rt.perLineTextDirection=gg;Rt.exceptionSink=dg;Rt.updateListener=Uu;Rt.editable=El;Rt.mouseSelectionStyle=fg;Rt.dragMovesSelection=cg;Rt.clickAddsSelectionRange=ug;Rt.decorations=so;Rt.outerDecorations=_g;Rt.atomicRanges=Nc;Rt.bidiIsolatedRanges=xg;Rt.scrollMargins=bg;Rt.darkTheme=Vu;Rt.cspNonce=Zt.define({combine:i=>i.length?i[0]:""});Rt.contentAttributes=Qc;Rt.editorAttributes=Og;Rt.lineWrapping=Rt.contentAttributes.of({class:"cm-lineWrapping"});Rt.announce=re.define();const Hx=4096,Bd={};class Ya{constructor(t,e,n,r,o,s){this.from=t,this.to=e,this.dir=n,this.isolates=r,this.fresh=o,this.order=s}static update(t,e){if(e.empty&&!t.some(o=>o.fresh))return t;let n=[],r=t.length?t[t.length-1].dir:Me.LTR;for(let o=Math.max(0,t.length-10);o=0;r--){let o=n[r],s=typeof o=="function"?o(i):o;s&&Fu(s,e)}return e}const Jx=Ut.mac?"mac":Ut.windows?"win":Ut.linux?"linux":"key";function Kx(i,t){const e=i.split(/-(?!$)/);let n=e[e.length-1];n=="Space"&&(n=" ");let r,o,s,a;for(let l=0;ln.concat(r),[]))),e}function eb(i,t,e){return Rg(Xg(i.state),t,i,e)}let zn=null;const ib=4e3;function nb(i,t=Jx){let e=Object.create(null),n=Object.create(null),r=(s,a)=>{let l=n[s];if(l==null)n[s]=a;else if(l!=a)throw new Error("Key binding "+s+" is used both as a regular binding and as a multi-stroke prefix")},o=(s,a,l,u,c)=>{var d,f;let g=e[s]||(e[s]=Object.create(null)),x=a.split(/ (?!$)/).map(O=>Kx(O,t));for(let O=1;O{let E=zn={view:k,prefix:b,scope:s};return setTimeout(()=>{zn==E&&(zn=null)},ib),!0}]})}let m=x.join(" ");r(m,!1);let v=g[m]||(g[m]={preventDefault:!1,stopPropagation:!1,run:((f=(d=g._any)===null||d===void 0?void 0:d.run)===null||f===void 0?void 0:f.slice())||[]});l&&v.run.push(l),u&&(v.preventDefault=!0),c&&(v.stopPropagation=!0)};for(let s of i){let a=s.scope?s.scope.split(" "):["editor"];if(s.any)for(let u of a){let c=e[u]||(e[u]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let d in c)c[d].run.push(s.any)}let l=s[t]||s.key;if(l)for(let u of a)o(u,l,s.run,s.preventDefault,s.stopPropagation),s.shift&&o(u,"Shift-"+l,s.shift,s.preventDefault,s.stopPropagation)}return e}function Rg(i,t,e,n){let r=k_(t),o=ai(r,0),s=Yi(o)==r.length&&r!=" ",a="",l=!1,u=!1,c=!1;zn&&zn.view==e&&zn.scope==n&&(a=zn.prefix+" ",kg.indexOf(t.keyCode)<0&&(u=!0,zn=null));let d=new Set,f=v=>{if(v){for(let O of v.run)if(!d.has(O)&&(d.add(O),O(e,t)))return v.stopPropagation&&(c=!0),!0;v.preventDefault&&(v.stopPropagation&&(c=!0),u=!0)}return!1},g=i[n],x,m;return g&&(f(g[a+ta(r,t,!s)])?l=!0:s&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Ut.windows&&t.ctrlKey&&t.altKey)&&(x=nr[t.keyCode])&&x!=r?(f(g[a+ta(x,t,!0)])||t.shiftKey&&(m=no[t.keyCode])!=r&&m!=x&&f(g[a+ta(m,t,!1)]))&&(l=!0):s&&t.shiftKey&&f(g[a+ta(r,t,!0)])&&(l=!0),!l&&f(g._any)&&(l=!0)),u&&(l=!0),l&&c&&t.stopPropagation(),l}class So{constructor(t,e,n,r,o){this.className=t,this.left=e,this.top=n,this.width=r,this.height=o}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className!=this.className?!1:(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",this.width!=null&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,n){if(n.empty){let r=t.coordsAtPos(n.head,n.assoc||1);if(!r)return[];let o=Yg(t);return[new So(e,r.left-o.left,r.top-o.top,null,r.bottom-r.top)]}else return rb(t,e,n)}}function Yg(i){let t=i.scrollDOM.getBoundingClientRect();return{left:(i.textDirection==Me.LTR?t.left:t.right-i.scrollDOM.clientWidth*i.scaleX)-i.scrollDOM.scrollLeft*i.scaleX,top:t.top-i.scrollDOM.scrollTop*i.scaleY}}function Rd(i,t,e){let n=yt.cursor(t);return{from:Math.max(e.from,i.moveToLineBoundary(n,!1,!0).from),to:Math.min(e.to,i.moveToLineBoundary(n,!0,!0).from),type:xi.Text}}function rb(i,t,e){if(e.to<=i.viewport.from||e.from>=i.viewport.to)return[];let n=Math.max(e.from,i.viewport.from),r=Math.min(e.to,i.viewport.to),o=i.textDirection==Me.LTR,s=i.contentDOM,a=s.getBoundingClientRect(),l=Yg(i),u=s.querySelector(".cm-line"),c=u&&window.getComputedStyle(u),d=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),f=a.right-(c?parseInt(c.paddingRight):0),g=ju(i,n),x=ju(i,r),m=g.type==xi.Text?g:null,v=x.type==xi.Text?x:null;if(m&&(i.lineWrapping||g.widgetLineBreaks)&&(m=Rd(i,n,m)),v&&(i.lineWrapping||x.widgetLineBreaks)&&(v=Rd(i,r,v)),m&&v&&m.from==v.from)return b(k(e.from,e.to,m));{let $=m?k(e.from,null,m):E(g,!1),N=v?k(null,e.to,v):E(x,!0),X=[];return(m||g).to<(v||x).from-(m&&v?1:0)||g.widgetLineBreaks>1&&$.bottom+i.defaultLineHeight/2Q&&T.from=gt)break;Pt>H&&z(Math.max(pt,H),$==null&&pt<=Q,Math.min(Pt,gt),N==null&&Pt>=U,Et.dir)}if(H=at.to+1,H>=gt)break}return D.length==0&&z(Q,$==null,U,N==null,i.textDirection),{top:R,bottom:W,horizontal:D}}function E($,N){let X=a.top+(N?$.top:$.bottom);return{top:X,bottom:X,horizontal:[]}}}function sb(i,t){return i.constructor==t.constructor&&i.eq(t)}class ob{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Ea)!=t.state.facet(Ea)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}docViewUpdate(t){this.layer.updateOnDocViewUpdate!==!1&&t.requestMeasure(this.measureReq)}setOrder(t){let e=0,n=t.facet(Ea);for(;e!sb(e,this.drawn[n]))){let e=this.dom.firstChild,n=0;for(let r of t)r.update&&e&&r.constructor&&this.drawn[n].constructor&&r.update(e,this.drawn[n])?(e=e.nextSibling,n++):this.dom.insertBefore(r.draw(),e);for(;e;){let r=e.nextSibling;e.remove(),e=r}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Ea=Zt.define();function Zg(i){return[Fe.define(t=>new ob(t,i)),Ea.of(i)]}const Wg=!Ut.ios,oo=Zt.define({combine(i){return xn(i,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})}});function ab(i={}){return[oo.of(i),lb,hb,ub,vg.of(!0)]}function Ug(i){return i.startState.facet(oo)!=i.state.facet(oo)}const lb=Zg({above:!0,markers(i){let{state:t}=i,e=t.facet(oo),n=[];for(let r of t.selection.ranges){let o=r==t.selection.main;if(r.empty?!o||Wg:e.drawRangeCursor){let s=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=r.empty?r:yt.cursor(r.head,r.head>r.anchor?-1:1);for(let l of So.forRange(i,s,a))n.push(l)}}return n},update(i,t){i.transactions.some(n=>n.selection)&&(t.style.animationName=t.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let e=Ug(i);return e&&Yd(i.state,t),i.docChanged||i.selectionSet||e},mount(i,t){Yd(t.state,i)},class:"cm-cursorLayer"});function Yd(i,t){t.style.animationDuration=i.facet(oo).cursorBlinkRate+"ms"}const hb=Zg({above:!1,markers(i){return i.state.selection.ranges.map(t=>t.empty?[]:So.forRange(i,"cm-selectionBackground",t)).reduce((t,e)=>t.concat(e))},update(i,t){return i.docChanged||i.selectionSet||i.viewportChanged||Ug(i)},class:"cm-selectionLayer"}),Ju={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};Wg&&(Ju[".cm-line"].caretColor="transparent !important",Ju[".cm-content"]={caretColor:"transparent !important"});const ub=lr.highest(Rt.theme(Ju)),zg=re.define({map(i,t){return i==null?null:t.mapPos(i)}}),Xs=ti.define({create(){return null},update(i,t){return i!=null&&(i=t.changes.mapPos(i)),t.effects.reduce((e,n)=>n.is(zg)?n.value:e,i)}}),cb=Fe.fromClass(class{constructor(i){this.view=i,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(i){var t;let e=i.state.field(Xs);e==null?this.cursor!=null&&((t=this.cursor)===null||t===void 0||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(i.startState.field(Xs)!=e||i.docChanged||i.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:i}=this,t=i.state.field(Xs),e=t!=null&&i.coordsAtPos(t);if(!e)return null;let n=i.scrollDOM.getBoundingClientRect();return{left:e.left-n.left+i.scrollDOM.scrollLeft*i.scaleX,top:e.top-n.top+i.scrollDOM.scrollTop*i.scaleY,height:e.bottom-e.top}}drawCursor(i){if(this.cursor){let{scaleX:t,scaleY:e}=this.view;i?(this.cursor.style.left=i.left/t+"px",this.cursor.style.top=i.top/e+"px",this.cursor.style.height=i.height/e+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(i){this.view.state.field(Xs)!=i&&this.view.dispatch({effects:zg.of(i)})}},{eventObservers:{dragover(i){this.setDropPos(this.view.posAtCoords({x:i.clientX,y:i.clientY}))},dragleave(i){(i.target==this.view.contentDOM||!this.view.contentDOM.contains(i.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function fb(){return[Xs,cb]}function Zd(i,t,e,n,r){t.lastIndex=0;for(let o=i.iterRange(e,n),s=e,a;!o.next().done;s+=o.value.length)if(!o.lineBreak)for(;a=t.exec(o.value);)r(s+a.index,a)}function db(i,t){let e=i.visibleRanges;if(e.length==1&&e[0].from==i.viewport.from&&e[0].to==i.viewport.to)return e;let n=[];for(let{from:r,to:o}of e)r=Math.max(i.state.doc.lineAt(r).from,r-t),o=Math.min(i.state.doc.lineAt(o).to,o+t),n.length&&n[n.length-1].to>=r?n[n.length-1].to=o:n.push({from:r,to:o});return n}class pb{constructor(t){const{regexp:e,decoration:n,decorate:r,boundary:o,maxLength:s=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,r)this.addMatch=(a,l,u,c)=>r(c,u,u+a[0].length,a,l);else if(typeof n=="function")this.addMatch=(a,l,u,c)=>{let d=n(a,l,u);d&&c(u,u+a[0].length,d)};else if(n)this.addMatch=(a,l,u,c)=>c(u,u+a[0].length,n);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=o,this.maxLength=s}createDeco(t){let e=new _n,n=e.add.bind(e);for(let{from:r,to:o}of db(t,this.maxLength))Zd(t.state.doc,this.regexp,r,o,(s,a)=>this.addMatch(a,t,s,n));return e.finish()}updateDeco(t,e){let n=1e9,r=-1;return t.docChanged&&t.changes.iterChanges((o,s,a,l)=>{l>t.view.viewport.from&&a1e3?this.createDeco(t.view):r>-1?this.updateRange(t.view,e.map(t.changes),n,r):e}updateRange(t,e,n,r){for(let o of t.visibleRanges){let s=Math.max(o.from,n),a=Math.min(o.to,r);if(a>s){let l=t.state.doc.lineAt(s),u=l.tol.from;s--)if(this.boundary.test(l.text[s-1-l.from])){c=s;break}for(;af.push(O.range(m,v));if(l==u)for(this.regexp.lastIndex=c-l.from;(g=this.regexp.exec(l.text))&&g.indexthis.addMatch(v,t,m,x));e=e.update({filterFrom:c,filterTo:d,filter:(m,v)=>md,add:f})}}return e}}const Ku=/x/.unicode!=null?"gu":"g",mb=new RegExp(`[\0-\b ---Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,Ku),gb={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Ah=null;function vb(){var i;if(Ah==null&&typeof document<"u"&&document.body){let t=document.body.style;Ah=((i=t.tabSize)!==null&&i!==void 0?i:t.MozTabSize)!=null}return Ah||!1}const Da=Zt.define({combine(i){let t=xn(i,{render:null,specialChars:mb,addSpecialChars:null});return(t.replaceTabs=!vb())&&(t.specialChars=new RegExp(" |"+t.specialChars.source,Ku)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,Ku)),t}});function yb(i={}){return[Da.of(i),Ob()]}let Wd=null;function Ob(){return Wd||(Wd=Fe.fromClass(class{constructor(i){this.view=i,this.decorations=Gt.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(i.state.facet(Da)),this.decorations=this.decorator.createDeco(i)}makeDecorator(i){return new pb({regexp:i.specialChars,decoration:(t,e,n)=>{let{doc:r}=e.state,o=ai(t[0],0);if(o==9){let s=r.lineAt(n),a=e.state.tabSize,l=gs(s.text,a,n-s.from);return Gt.replace({widget:new wb((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=Gt.replace({widget:new bb(i,o)}))},boundary:i.replaceTabs?void 0:/[^]/})}update(i){let t=i.state.facet(Da);i.startState.facet(Da)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(i.view)):this.decorations=this.decorator.updateDeco(i,this.decorations)}},{decorations:i=>i.decorations}))}const _b="•";function xb(i){return i>=32?_b:i==10?"␤":String.fromCharCode(9216+i)}class bb extends Mn{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=xb(this.code),n=t.state.phrase("Control character")+" "+(gb[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,e);if(r)return r;let o=document.createElement("span");return o.textContent=e,o.title=n,o.setAttribute("aria-label",n),o.className="cm-specialChar",o}ignoreEvent(){return!1}}class wb extends Mn{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent=" ",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}function Sb(){return Pb}const Cb=Gt.line({class:"cm-activeLine"}),Pb=Fe.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.docChanged||i.selectionSet)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let t=-1,e=[];for(let n of i.state.selection.ranges){let r=i.lineBlockAt(n.head);r.from>t&&(e.push(Cb.range(r.from)),t=r.from)}return Gt.set(e)}},{decorations:i=>i.decorations}),tc=2e3;function kb(i,t,e){let n=Math.min(t.line,e.line),r=Math.max(t.line,e.line),o=[];if(t.off>tc||e.off>tc||t.col<0||e.col<0){let s=Math.min(t.off,e.off),a=Math.max(t.off,e.off);for(let l=n;l<=r;l++){let u=i.doc.line(l);u.length<=a&&o.push(yt.range(u.from+s,u.to+a))}}else{let s=Math.min(t.col,e.col),a=Math.max(t.col,e.col);for(let l=n;l<=r;l++){let u=i.doc.line(l),c=Tu(u.text,s,i.tabSize,!0);if(c<0)o.push(yt.cursor(u.to));else{let d=Tu(u.text,a,i.tabSize);o.push(yt.range(u.from+c,u.from+d))}}}return o}function Lb(i,t){let e=i.coordsAtPos(i.viewport.from);return e?Math.round(Math.abs((e.left-t)/i.defaultCharacterWidth)):-1}function Ud(i,t){let e=i.posAtCoords({x:t.clientX,y:t.clientY},!1),n=i.state.doc.lineAt(e),r=e-n.from,o=r>tc?-1:r==n.length?Lb(i,t.clientX):gs(n.text,i.state.tabSize,e-n.from);return{line:n.number,col:o,off:r}}function Ab(i,t){let e=Ud(i,t),n=i.state.selection;return e?{update(r){if(r.docChanged){let o=r.changes.mapPos(r.startState.doc.line(e.line).from),s=r.state.doc.lineAt(o);e={line:s.number,col:e.col,off:Math.min(e.off,s.length)},n=n.map(r.changes)}},get(r,o,s){let a=Ud(i,r);if(!a)return n;let l=kb(i.state,e,a);return l.length?s?yt.create(l.concat(n.ranges)):yt.create(l):n}}:null}function Eb(i){let t=(i==null?void 0:i.eventFilter)||(e=>e.altKey&&e.button==0);return Rt.mouseSelectionStyle.of((e,n)=>t(n)?Ab(e,n):null)}const Db={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},Tb={style:"cursor: crosshair"};function Ib(i={}){let[t,e]=Db[i.key||"Alt"],n=Fe.fromClass(class{constructor(r){this.view=r,this.isDown=!1}set(r){this.isDown!=r&&(this.isDown=r,this.view.update([]))}},{eventObservers:{keydown(r){this.set(r.keyCode==t||e(r))},keyup(r){(r.keyCode==t||!e(r))&&this.set(!1)},mousemove(r){this.set(e(r))}}});return[n,Rt.contentAttributes.of(r=>{var o;return!((o=r.plugin(n))===null||o===void 0)&&o.isDown?Tb:null})]}const Ps="-10000px";class jg{constructor(t,e,n,r){this.facet=e,this.createTooltipView=n,this.removeTooltipView=r,this.input=t.state.facet(e),this.tooltips=this.input.filter(s=>s);let o=null;this.tooltipViews=this.tooltips.map(s=>o=n(s,o))}update(t,e){var n;let r=t.state.facet(this.facet),o=r.filter(l=>l);if(r===this.input){for(let l of this.tooltipViews)l.update&&l.update(t);return!1}let s=[],a=e?[]:null;for(let l=0;le[u]=l),e.length=a.length),this.input=r,this.tooltips=o,this.tooltipViews=s,!0}}function Mb(i){let{win:t}=i;return{top:0,left:0,bottom:t.innerHeight,right:t.innerWidth}}const Eh=Zt.define({combine:i=>{var t,e,n;return{position:Ut.ios?"absolute":((t=i.find(r=>r.position))===null||t===void 0?void 0:t.position)||"fixed",parent:((e=i.find(r=>r.parent))===null||e===void 0?void 0:e.parent)||null,tooltipSpace:((n=i.find(r=>r.tooltipSpace))===null||n===void 0?void 0:n.tooltipSpace)||Mb}}}),zd=new WeakMap,Fc=Fe.fromClass(class{constructor(i){this.view=i,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=i.state.facet(Eh);this.position=t.position,this.parent=t.parent,this.classes=i.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new jg(i,Xc,(e,n)=>this.createTooltip(e,n),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),i.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let i of this.manager.tooltipViews)this.intersectionObserver.observe(i.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(i){i.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(i,this.above);t&&this.observeIntersection();let e=t||i.geometryChanged,n=i.state.facet(Eh);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;e=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.dom);e=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);e&&this.maybeMeasure()}createTooltip(i,t){let e=i.create(this.view),n=t?t.dom:null;if(e.dom.classList.add("cm-tooltip"),i.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",e.dom.insertBefore(r,n)}return e.dom.style.position=this.position,e.dom.style.top=Ps,e.dom.style.left="0px",this.container.insertBefore(e.dom,n),e.mount&&e.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(e.dom),e}destroy(){var i,t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let n of this.manager.tooltipViews)n.dom.remove(),(i=n.destroy)===null||i===void 0||i.call(n);this.parent&&this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let i=this.view.dom.getBoundingClientRect(),t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:r}=this.manager.tooltipViews[0];if(Ut.gecko)n=r.offsetParent!=this.container.ownerDocument.body;else if(r.style.top==Ps&&r.style.left=="0px"){let o=r.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}}if(n||this.position=="absolute")if(this.parent){let r=this.parent.getBoundingClientRect();r.width&&r.height&&(t=r.width/this.parent.offsetWidth,e=r.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);return{editor:i,parent:this.parent?this.container.getBoundingClientRect():i,pos:this.manager.tooltips.map((r,o)=>{let s=this.manager.tooltipViews[o];return s.getCoords?s.getCoords(r.pos):this.view.coordsAtPos(r.pos)}),size:this.manager.tooltipViews.map(({dom:r})=>r.getBoundingClientRect()),space:this.view.state.facet(Eh).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(i){var t;if(i.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{editor:e,space:n,scaleX:r,scaleY:o}=i,s=[];for(let a=0;a=Math.min(e.bottom,n.bottom)||d.rightMath.min(e.right,n.right)+.1){c.style.top=Ps;continue}let g=l.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,x=g?7:0,m=f.right-f.left,v=(t=zd.get(u))!==null&&t!==void 0?t:f.bottom-f.top,O=u.offset||Qb,b=this.view.textDirection==Me.LTR,k=f.width>n.right-n.left?b?n.left:n.right-f.width:b?Math.min(d.left-(g?14:0)+O.x,n.right-m):Math.max(n.left,d.left-m+(g?14:0)-O.x),E=this.above[a];!l.strictSide&&(E?d.top-(f.bottom-f.top)-O.yn.bottom)&&E==n.bottom-d.bottom>d.top-n.top&&(E=this.above[a]=!E);let $=(E?d.top-n.top:n.bottom-d.bottom)-x;if($k&&R.topN&&(N=E?R.top-v-2-x:R.bottom+x+2);if(this.position=="absolute"?(c.style.top=(N-i.parent.top)/o+"px",c.style.left=(k-i.parent.left)/r+"px"):(c.style.top=N/o+"px",c.style.left=k/r+"px"),g){let R=d.left+(b?O.x:-O.x)-(k+14-7);g.style.left=R/r+"px"}u.overlap!==!0&&s.push({left:k,top:N,right:X,bottom:N+v}),c.classList.toggle("cm-tooltip-above",E),c.classList.toggle("cm-tooltip-below",!E),u.positioned&&u.positioned(i.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let i of this.manager.tooltipViews)i.dom.style.top=Ps}},{eventObservers:{scroll(){this.maybeMeasure()}}}),$b=Rt.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Qb={x:0,y:0},Xc=Zt.define({enables:[Fc,$b]}),Za=Zt.define({combine:i=>i.reduce((t,e)=>t.concat(e),[])});class Dl{static create(t){return new Dl(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new jg(t,Za,(e,n)=>this.createHostedView(e,n),e=>e.dom.remove())}createHostedView(t,e){let n=t.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(t){for(let e of this.manager.tooltipViews)e.mount&&e.mount(t);this.mounted=!0}positioned(t){for(let e of this.manager.tooltipViews)e.positioned&&e.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let e of this.manager.tooltipViews)(t=e.destroy)===null||t===void 0||t.call(e)}passProp(t){let e;for(let n of this.manager.tooltipViews){let r=n[t];if(r!==void 0){if(e===void 0)e=r;else if(e!==r)return}}return e}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const Nb=Xc.compute([Za],i=>{let t=i.facet(Za);return t.length===0?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var n;return(n=e.end)!==null&&n!==void 0?n:e.pos})),create:Dl.create,above:t[0].above,arrow:t.some(e=>e.arrow)}});class Bb{constructor(t,e,n,r,o){this.view=t,this.source=e,this.field=n,this.setHover=r,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;ta.bottom||e.xa.right+t.defaultCharacterWidth)return;let l=t.bidiSpans(t.state.doc.lineAt(r)).find(c=>c.from<=r&&c.to>=r),u=l&&l.dir==Me.RTL?-1:1;o=e.x{this.pending==a&&(this.pending=null,l&&!(Array.isArray(l)&&!l.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])}))},l=>Pi(t.state,l,"hover tooltip"))}else s&&!(Array.isArray(s)&&!s.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(s)?s:[s])})}get tooltip(){let t=this.view.plugin(Fc),e=t?t.manager.tooltips.findIndex(n=>n.create==Dl.create):-1;return e>-1?t.manager.tooltipViews[e]:null}mousemove(t){var e,n;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:r,tooltip:o}=this;if(r.length&&o&&!Fb(o.dom,t)||this.pending){let{pos:s}=r[0]||this.pending,a=(n=(e=r[0])===null||e===void 0?void 0:e.end)!==null&&n!==void 0?n:s;(s==a?this.view.posAtCoords(this.lastMove)!=s:!Xb(this.view,s,a,t.clientX,t.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:e}=this;if(e.length){let{tooltip:n}=this;n&&n.dom.contains(t.relatedTarget)?this.watchTooltipLeave(n.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let e=n=>{t.removeEventListener("mouseleave",e),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener("mouseleave",e)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const ea=4;function Fb(i,t){let e=i.getBoundingClientRect();return t.clientX>=e.left-ea&&t.clientX<=e.right+ea&&t.clientY>=e.top-ea&&t.clientY<=e.bottom+ea}function Xb(i,t,e,n,r,o){let s=i.scrollDOM.getBoundingClientRect(),a=i.documentTop+i.documentPadding.top+i.contentHeight;if(s.left>n||s.rightr||Math.min(s.bottom,a)=t&&l<=e}function Rb(i,t={}){let e=re.define(),n=ti.define({create(){return[]},update(r,o){if(r.length&&(t.hideOnChange&&(o.docChanged||o.selection)?r=[]:t.hideOn&&(r=r.filter(s=>!t.hideOn(o,s))),o.docChanged)){let s=[];for(let a of r){let l=o.changes.mapPos(a.pos,-1,Je.TrackDel);if(l!=null){let u=Object.assign(Object.create(null),a);u.pos=l,u.end!=null&&(u.end=o.changes.mapPos(u.end)),s.push(u)}}r=s}for(let s of o.effects)s.is(e)&&(r=s.value),s.is(Yb)&&(r=[]);return r},provide:r=>Za.from(r)});return[n,Fe.define(r=>new Bb(r,i,n,e,t.hoverTime||300)),Nb]}function qg(i,t){let e=i.plugin(Fc);if(!e)return null;let n=e.manager.tooltips.indexOf(t);return n<0?null:e.manager.tooltipViews[n]}const Yb=re.define(),jd=Zt.define({combine(i){let t,e;for(let n of i)t=t||n.topContainer,e=e||n.bottomContainer;return{topContainer:t,bottomContainer:e}}});function ao(i,t){let e=i.plugin(Vg),n=e?e.specs.indexOf(t):-1;return n>-1?e.panels[n]:null}const Vg=Fe.fromClass(class{constructor(i){this.input=i.state.facet(Dr),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(e=>e(i));let t=i.state.facet(jd);this.top=new ia(i,!0,t.topContainer),this.bottom=new ia(i,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(i){let t=i.state.facet(jd);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new ia(i.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new ia(i.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let e=i.state.facet(Dr);if(e!=this.input){let n=e.filter(l=>l),r=[],o=[],s=[],a=[];for(let l of n){let u=this.specs.indexOf(l),c;u<0?(c=l(i.view),a.push(c)):(c=this.panels[u],c.update&&c.update(i)),r.push(c),(c.top?o:s).push(c)}this.specs=n,this.panels=r,this.top.sync(o),this.bottom.sync(s);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let n of this.panels)n.update&&n.update(i)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:i=>Rt.scrollMargins.of(t=>{let e=t.plugin(i);return e&&{top:e.top.scrollMargin(),bottom:e.bottom.scrollMargin()}})});class ia{constructor(t,e,n){this.view=t,this.top=e,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=qd(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=qd(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function qd(i){let t=i.nextSibling;return i.remove(),t}const Dr=Zt.define({enables:Vg});class Tn extends kr{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Tn.prototype.elementClass="";Tn.prototype.toDOM=void 0;Tn.prototype.mapMode=Je.TrackBefore;Tn.prototype.startSide=Tn.prototype.endSide=-1;Tn.prototype.point=!0;const Ta=Zt.define(),Zb={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>ge.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},qs=Zt.define();function Wb(i){return[Gg(),qs.of(Object.assign(Object.assign({},Zb),i))]}const ec=Zt.define({combine:i=>i.some(t=>t)});function Gg(i){let t=[Ub];return i&&i.fixed===!1&&t.push(ec.of(!0)),t}const Ub=Fe.fromClass(class{constructor(i){this.view=i,this.prevViewport=i.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=i.state.facet(qs).map(t=>new Gd(i,t));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!i.state.facet(ec),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),i.scrollDOM.insertBefore(this.dom,i.contentDOM)}update(i){if(this.updateGutters(i)){let t=this.prevViewport,e=i.view.viewport,n=Math.min(t.to,e.to)-Math.max(t.from,e.from);this.syncGutters(n<(e.to-e.from)*.8)}i.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(ec)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=i.view.viewport}syncGutters(i){let t=this.dom.nextSibling;i&&this.dom.remove();let e=ge.iter(this.view.state.facet(Ta),this.view.viewport.from),n=[],r=this.gutters.map(o=>new zb(o,this.view.viewport,-this.view.documentPadding.top));for(let o of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(o.type)){let s=!0;for(let a of o.type)if(a.type==xi.Text&&s){ic(e,n,a.from);for(let l of r)l.line(this.view,a,n);s=!1}else if(a.widget)for(let l of r)l.widget(this.view,a)}else if(o.type==xi.Text){ic(e,n,o.from);for(let s of r)s.line(this.view,o,n)}else if(o.widget)for(let s of r)s.widget(this.view,o);for(let o of r)o.finish();i&&this.view.scrollDOM.insertBefore(this.dom,t)}updateGutters(i){let t=i.startState.facet(qs),e=i.state.facet(qs),n=i.docChanged||i.heightChanged||i.viewportChanged||!ge.eq(i.startState.facet(Ta),i.state.facet(Ta),i.view.viewport.from,i.view.viewport.to);if(t==e)for(let r of this.gutters)r.update(i)&&(n=!0);else{n=!0;let r=[];for(let o of e){let s=t.indexOf(o);s<0?r.push(new Gd(this.view,o)):(this.gutters[s].update(i),r.push(this.gutters[s]))}for(let o of this.gutters)o.dom.remove(),r.indexOf(o)<0&&o.destroy();for(let o of r)this.dom.appendChild(o.dom);this.gutters=r}return n}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove()}},{provide:i=>Rt.scrollMargins.of(t=>{let e=t.plugin(i);return!e||e.gutters.length==0||!e.fixed?null:t.textDirection==Me.LTR?{left:e.dom.offsetWidth*t.scaleX}:{right:e.dom.offsetWidth*t.scaleX}})});function Vd(i){return Array.isArray(i)?i:[i]}function ic(i,t,e){for(;i.value&&i.from<=e;)i.from==e&&t.push(i.value),i.next()}class zb{constructor(t,e,n){this.gutter=t,this.height=n,this.i=0,this.cursor=ge.iter(t.markers,e.from)}addElement(t,e,n){let{gutter:r}=this,o=(e.top-this.height)/t.scaleY,s=e.height/t.scaleY;if(this.i==r.elements.length){let a=new Hg(t,s,o,n);r.elements.push(a),r.dom.appendChild(a.dom)}else r.elements[this.i].update(t,s,o,n);this.height=e.bottom,this.i++}line(t,e,n){let r=[];ic(this.cursor,r,e.from),n.length&&(r=r.concat(n));let o=this.gutter.config.lineMarker(t,e,r);o&&r.unshift(o);let s=this.gutter;r.length==0&&!s.config.renderEmptyElements||this.addElement(t,e,r)}widget(t,e){let n=this.gutter.config.widgetMarker(t,e.widget,e);n&&this.addElement(t,e,[n])}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}}class Gd{constructor(t,e){this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in e.domEventHandlers)this.dom.addEventListener(n,r=>{let o=r.target,s;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let l=o.getBoundingClientRect();s=(l.top+l.bottom)/2}else s=r.clientY;let a=t.lineBlockAtHeight(s-t.documentTop);e.domEventHandlers[n](t,a,r)&&r.preventDefault()});this.markers=Vd(e.markers(t)),e.initialSpacer&&(this.spacer=new Hg(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let e=this.markers;if(this.markers=Vd(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],t);r!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[r])}let n=t.view.viewport;return!ge.eq(this.markers,e,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(t):!1)}destroy(){for(let t of this.elements)t.destroy()}}class Hg{constructor(t,e,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,e,n,r)}update(t,e,n,r){this.height!=e&&(this.height=e,this.dom.style.height=e+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),jb(this.markers,r)||this.setMarkers(t,r)}setMarkers(t,e){let n="cm-gutterElement",r=this.dom.firstChild;for(let o=0,s=0;;){let a=s,l=oo(a,l,u)||s(a,l,u):s}return n}})}});class Dh extends Tn{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function Th(i,t){return i.state.facet(zr).formatNumber(t,i.state)}const Vb=qs.compute([zr],i=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(qb)},lineMarker(t,e,n){return n.some(r=>r.toDOM)?null:new Dh(Th(t,t.state.doc.lineAt(e.from).number))},widgetMarker:()=>null,lineMarkerChange:t=>t.startState.facet(zr)!=t.state.facet(zr),initialSpacer(t){return new Dh(Th(t,Hd(t.state.doc.lines)))},updateSpacer(t,e){let n=Th(e.view,Hd(e.view.state.doc.lines));return n==t.number?t:new Dh(n)},domEventHandlers:i.facet(zr).domEventHandlers}));function Gb(i={}){return[zr.of(i),Gg(),Vb]}function Hd(i){let t=9;for(;t{let t=[],e=-1;for(let n of i.selection.ranges){let r=i.doc.lineAt(n.head).from;r>e&&(e=r,t.push(Hb.range(r)))}return ge.of(t)});function Kb(){return Jb}const Jg=1024;let tw=0;class Ih{constructor(t,e){this.from=t,this.to=e}}class ce{constructor(t={}){this.id=tw++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=Ei.match(t)),e=>{let n=t(e);return n===void 0?null:[this,n]}}}ce.closedBy=new ce({deserialize:i=>i.split(" ")});ce.openedBy=new ce({deserialize:i=>i.split(" ")});ce.group=new ce({deserialize:i=>i.split(" ")});ce.isolate=new ce({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}});ce.contextHash=new ce({perNode:!0});ce.lookAhead=new ce({perNode:!0});ce.mounted=new ce({perNode:!0});class Wa{constructor(t,e,n){this.tree=t,this.overlay=e,this.parser=n}static get(t){return t&&t.props&&t.props[ce.mounted.id]}}const ew=Object.create(null);class Ei{constructor(t,e,n,r=0){this.name=t,this.props=e,this.id=n,this.flags=r}static define(t){let e=t.props&&t.props.length?Object.create(null):ew,n=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),r=new Ei(t.name||"",e,t.id,n);if(t.props){for(let o of t.props)if(Array.isArray(o)||(o=o(r)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[o[0].id]=o[1]}}return r}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let e=this.prop(ce.group);return e?e.indexOf(t)>-1:!1}return this.id==t}static match(t){let e=Object.create(null);for(let n in t)for(let r of n.split(" "))e[r]=t[n];return n=>{for(let r=n.prop(ce.group),o=-1;o<(r?r.length:0);o++){let s=e[o<0?n.name:r[o]];if(s)return s}}}}Ei.none=new Ei("",Object.create(null),0,8);class Rc{constructor(t){this.types=t;for(let e=0;e0;for(let l=this.cursor(s|He.IncludeAnonymous);;){let u=!1;if(l.from<=o&&l.to>=r&&(!a&&l.type.isAnonymous||e(l)!==!1)){if(l.firstChild())continue;u=!0}for(;u&&n&&(a||!l.type.isAnonymous)&&n(l),!l.nextSibling();){if(!l.parent())return;u=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:Wc(Ei.none,this.children,this.positions,0,this.children.length,0,this.length,(e,n,r)=>new Re(this.type,e,n,r,this.propValues),t.makeTree||((e,n,r)=>new Re(Ei.none,e,n,r)))}static build(t){return sw(t)}}Re.empty=new Re(Ei.none,[],[],0);class Yc{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Yc(this.buffer,this.index)}}class sr{constructor(t,e,n){this.buffer=t,this.length=e,this.set=n}get type(){return Ei.none}toString(){let t=[];for(let e=0;e0));l=s[l+3]);return a}slice(t,e,n){let r=this.buffer,o=new Uint16Array(e-t),s=0;for(let a=t,l=0;a=t&&et;case 1:return e<=t&&n>t;case 2:return n>t;case 4:return!0}}function lo(i,t,e,n){for(var r;i.from==i.to||(e<1?i.from>=t:i.from>t)||(e>-1?i.to<=t:i.to0?a.length:-1;t!=u;t+=e){let c=a[t],d=l[t]+s.from;if(Kg(r,n,d,d+c.length)){if(c instanceof sr){if(o&He.ExcludeBuffers)continue;let f=c.findChild(0,c.buffer.length,e,n-d,r);if(f>-1)return new vn(new iw(s,c,t,d),null,f)}else if(o&He.IncludeAnonymous||!c.type.isAnonymous||Zc(c)){let f;if(!(o&He.IgnoreMounts)&&(f=Wa.get(c))&&!f.overlay)return new Ai(f.tree,d,t,s);let g=new Ai(c,d,t,s);return o&He.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(e<0?c.children.length-1:0,e,n,r)}}}if(o&He.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?t=s.index+e:t=e<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,n=0){let r;if(!(n&He.IgnoreOverlays)&&(r=Wa.get(this._tree))&&r.overlay){let o=t-this.from;for(let{from:s,to:a}of r.overlay)if((e>0?s<=o:s=o:a>o))return new Ai(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,n)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Kd(i,t,e,n){let r=i.cursor(),o=[];if(!r.firstChild())return o;if(e!=null){for(let s=!1;!s;)if(s=r.type.is(e),!r.nextSibling())return o}for(;;){if(n!=null&&r.type.is(n))return o;if(r.type.is(t)&&o.push(r.node),!r.nextSibling())return n==null?o:[]}}function nc(i,t,e=t.length-1){for(let n=i.parent;e>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[e]&&t[e]!=n.name)return!1;e--}}return!0}class iw{constructor(t,e,n,r){this.parent=t,this.buffer=e,this.index=n,this.start=r}}class vn extends tv{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,n){super(),this.context=t,this._parent=e,this.index=n,this.type=t.buffer.set.types[t.buffer.buffer[n]]}child(t,e,n){let{buffer:r}=this.context,o=r.findChild(this.index+4,r.buffer[this.index+3],t,e-this.context.start,n);return o<0?null:new vn(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,n=0){if(n&He.ExcludeBuffers)return null;let{buffer:r}=this.context,o=r.findChild(this.index+4,r.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return o<0?null:new vn(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new vn(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new vn(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:n}=this.context,r=this.index+4,o=n.buffer[this.index+3];if(o>r){let s=n.buffer[this.index+1];t.push(n.slice(r,o,s)),e.push(0)}return new Re(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ev(i){if(!i.length)return null;let t=0,e=i[0];for(let o=1;oe.from||s.to=t){let a=new Ai(s.tree,s.overlay[0].from+o.from,-1,o);(r||(r=[n])).push(lo(a,t,e,!1))}}return r?ev(r):n}class rc{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof Ai)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let n=t._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,e){this.index=t;let{start:n,buffer:r}=this.buffer;return this.type=e||r.set.types[r.buffer[t]],this.from=n+r.buffer[t+1],this.to=n+r.buffer[t+2],!0}yield(t){return t?t instanceof Ai?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,n,this.mode));let{buffer:r}=this.buffer,o=r.findChild(this.index+4,r.buffer[this.index+3],t,e-this.buffer.start,n);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,n=this.mode){return this.buffer?n&He.ExcludeBuffers?!1:this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&He.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&He.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:e}=this.buffer,n=this.stack.length-1;if(t<0){let r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(e.findChild(r,this.index,-1,0,4))}else{let r=e.buffer[this.index+3];if(r<(n<0?e.buffer.length:e.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,n,{buffer:r}=this;if(r){if(t>0){if(this.index-1)for(let o=e+t,s=t<0?-1:n._tree.children.length;o!=s;o+=t){let a=n._tree.children[o];if(this.mode&He.IncludeAnonymous||a instanceof sr||!a.type.isAnonymous||Zc(a))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to=0;){for(let s=t;s;s=s._parent)if(s.index==r){if(r==this.index)return s;e=s,n=o+1;break t}r=this.stack[--o]}for(let r=n;r=0;o--){if(o<0)return nc(this.node,t,r);let s=n[e.buffer[this.stack[o]]];if(!s.isAnonymous){if(t[r]&&t[r]!=s.name)return!1;r--}}return!0}}function Zc(i){return i.children.some(t=>t instanceof sr||!t.type.isAnonymous||Zc(t))}function sw(i){var t;let{buffer:e,nodeSet:n,maxBufferLength:r=Jg,reused:o=[],minRepeatType:s=n.types.length}=i,a=Array.isArray(e)?new Yc(e,e.length):e,l=n.types,u=0,c=0;function d($,N,X,R,W,D){let{id:z,start:Q,end:U,size:T}=a,H=c;for(;T<0;)if(a.next(),T==-1){let Pt=o[z];X.push(Pt),R.push(Q-$);return}else if(T==-3){u=z;return}else if(T==-4){c=z;return}else throw new RangeError(`Unrecognized record size: ${T}`);let gt=l[z],at,Et,pt=Q-$;if(U-Q<=r&&(Et=v(a.pos-N,W))){let Pt=new Uint16Array(Et.size-Et.skip),nt=a.pos-Et.size,it=Pt.length;for(;a.pos>nt;)it=O(Et.start,Pt,it);at=new sr(Pt,U-Et.start,n),pt=Et.start-$}else{let Pt=a.pos-T;a.next();let nt=[],it=[],It=z>=s?z:-1,kt=0,xt=U;for(;a.pos>Pt;)It>=0&&a.id==It&&a.size>=0?(a.end<=xt-r&&(x(nt,it,Q,kt,a.end,xt,It,H),kt=nt.length,xt=a.end),a.next()):D>2500?f(Q,Pt,nt,it):d(Q,Pt,nt,it,It,D+1);if(It>=0&&kt>0&&kt-1&&kt>0){let Kt=g(gt);at=Wc(gt,nt,it,0,nt.length,0,U-Q,Kt,Kt)}else at=m(gt,nt,it,U-Q,H-U)}X.push(at),R.push(pt)}function f($,N,X,R){let W=[],D=0,z=-1;for(;a.pos>N;){let{id:Q,start:U,end:T,size:H}=a;if(H>4)a.next();else{if(z>-1&&U=0;T-=3)Q[H++]=W[T],Q[H++]=W[T+1]-U,Q[H++]=W[T+2]-U,Q[H++]=H;X.push(new sr(Q,W[2]-U,n)),R.push(U-$)}}function g($){return(N,X,R)=>{let W=0,D=N.length-1,z,Q;if(D>=0&&(z=N[D])instanceof Re){if(!D&&z.type==$&&z.length==R)return z;(Q=z.prop(ce.lookAhead))&&(W=X[D]+z.length+Q)}return m($,N,X,R,W)}}function x($,N,X,R,W,D,z,Q){let U=[],T=[];for(;$.length>R;)U.push($.pop()),T.push(N.pop()+X-W);$.push(m(n.types[z],U,T,D-W,Q-D)),N.push(W-X)}function m($,N,X,R,W=0,D){if(u){let z=[ce.contextHash,u];D=D?[z].concat(D):[z]}if(W>25){let z=[ce.lookAhead,W];D=D?[z].concat(D):[z]}return new Re($,N,X,R,D)}function v($,N){let X=a.fork(),R=0,W=0,D=0,z=X.end-r,Q={size:0,start:0,skip:0};t:for(let U=X.pos-$;X.pos>U;){let T=X.size;if(X.id==N&&T>=0){Q.size=R,Q.start=W,Q.skip=D,D+=4,R+=4,X.next();continue}let H=X.pos-T;if(T<0||H=s?4:0,at=X.start;for(X.next();X.pos>H;){if(X.size<0)if(X.size==-3)gt+=4;else break t;else X.id>=s&&(gt+=4);X.next()}W=at,R+=T,D+=gt}return(N<0||R==$)&&(Q.size=R,Q.start=W,Q.skip=D),Q.size>4?Q:void 0}function O($,N,X){let{id:R,start:W,end:D,size:z}=a;if(a.next(),z>=0&&R4){let U=a.pos-(z-4);for(;a.pos>U;)X=O($,N,X)}N[--X]=Q,N[--X]=D-$,N[--X]=W-$,N[--X]=R}else z==-3?u=R:z==-4&&(c=R);return X}let b=[],k=[];for(;a.pos>0;)d(i.start||0,i.bufferStart||0,b,k,-1,0);let E=(t=i.length)!==null&&t!==void 0?t:b.length?k[0]+b[0].length:0;return new Re(l[i.topID],b.reverse(),k.reverse(),E)}const tp=new WeakMap;function Ia(i,t){if(!i.isAnonymous||t instanceof sr||t.type!=i)return 1;let e=tp.get(t);if(e==null){e=1;for(let n of t.children){if(n.type!=i||!(n instanceof Re)){e=1;break}e+=Ia(i,n)}tp.set(t,e)}return e}function Wc(i,t,e,n,r,o,s,a,l){let u=0;for(let x=n;x=c)break;N+=X}if(k==E+1){if(N>c){let X=x[E];g(X.children,X.positions,0,X.children.length,m[E]+b);continue}d.push(x[E])}else{let X=m[k-1]+x[k-1].length-$;d.push(Wc(i,x,m,E,k,$,X,null,l))}f.push($+b-o)}}return g(t,e,n,r,0),(a||l)(d,f,s)}class ow{constructor(){this.map=new WeakMap}setBuffer(t,e,n){let r=this.map.get(t);r||this.map.set(t,r=new Map),r.set(e,n)}getBuffer(t,e){let n=this.map.get(t);return n&&n.get(e)}set(t,e){t instanceof vn?this.setBuffer(t.context.buffer,t.index,e):t instanceof Ai&&this.map.set(t.tree,e)}get(t){return t instanceof vn?this.getBuffer(t.context.buffer,t.index):t instanceof Ai?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class wr{constructor(t,e,n,r,o=!1,s=!1){this.from=t,this.to=e,this.tree=n,this.offset=r,this.open=(o?1:0)|(s?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,e=[],n=!1){let r=[new wr(0,t.length,t,0,!1,n)];for(let o of e)o.to>t.length&&r.push(o);return r}static applyChanges(t,e,n=128){if(!e.length)return t;let r=[],o=1,s=t.length?t[0]:null;for(let a=0,l=0,u=0;;a++){let c=a=n)for(;s&&s.from=f.from||d<=f.to||u){let g=Math.max(f.from,l)-u,x=Math.min(f.to,d)-u;f=g>=x?null:new wr(g,x,f.tree,f.offset+u,a>0,!!c)}if(f&&r.push(f),s.to>d)break;s=onew Ih(r.from,r.to)):[new Ih(0,0)]:[new Ih(0,t.length)],this.createParse(t,e||[],n)}parse(t,e,n){let r=this.startParse(t,e,n);for(;;){let o=r.advance();if(o)return o}}}class aw{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}}new ce({perNode:!0});let lw=0;class dn{constructor(t,e,n){this.set=t,this.base=e,this.modified=n,this.id=lw++}static define(t){if(t!=null&&t.base)throw new Error("Can not derive from a modified tag");let e=new dn([],null,[]);if(e.set.push(e),t)for(let n of t.set)e.set.push(n);return e}static defineModifier(){let t=new Ua;return e=>e.modified.indexOf(t)>-1?e:Ua.get(e.base||e,e.modified.concat(t).sort((n,r)=>n.id-r.id))}}let hw=0;class Ua{constructor(){this.instances=[],this.id=hw++}static get(t,e){if(!e.length)return t;let n=e[0].instances.find(a=>a.base==t&&uw(e,a.modified));if(n)return n;let r=[],o=new dn(r,t,e);for(let a of e)a.instances.push(o);let s=cw(e);for(let a of t.set)if(!a.modified.length)for(let l of s)r.push(Ua.get(a,l));return o}}function uw(i,t){return i.length==t.length&&i.every((e,n)=>e==t[n])}function cw(i){let t=[[]];for(let e=0;en.length-e.length)}function nv(i){let t=Object.create(null);for(let e in i){let n=i[e];Array.isArray(n)||(n=[n]);for(let r of e.split(" "))if(r){let o=[],s=2,a=r;for(let d=0;;){if(a=="..."&&d>0&&d+3==r.length){s=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+r);if(o.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),d+=f[0].length,d==r.length)break;let g=r[d++];if(d==r.length&&g=="!"){s=0;break}if(g!="/")throw new RangeError("Invalid path: "+r);a=r.slice(d)}let l=o.length-1,u=o[l];if(!u)throw new RangeError("Invalid path: "+r);let c=new za(n,s,l>0?o.slice(0,l):null);t[u]=c.sort(t[u])}}return rv.add(t)}const rv=new ce;class za{constructor(t,e,n,r){this.tags=t,this.mode=e,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth{let s=r;for(let a of o)for(let l of a.set){let u=e[l.id];if(u){s=s?s+" "+u:u;break}}return s},scope:n}}function fw(i,t){let e=null;for(let n of i){let r=n.style(t);r&&(e=e?e+" "+r:r)}return e}function dw(i,t,e,n=0,r=i.length){let o=new pw(n,Array.isArray(t)?t:[t],e);o.highlightRange(i.cursor(),n,r,"",o.highlighters),o.flush(r)}class pw{constructor(t,e,n){this.at=t,this.highlighters=e,this.span=n,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,n,r,o){let{type:s,from:a,to:l}=t;if(a>=n||l<=e)return;s.isTop&&(o=this.highlighters.filter(g=>!g.scope||g.scope(s)));let u=r,c=mw(t)||za.empty,d=fw(o,c.tags);if(d&&(u&&(u+=" "),u+=d,c.mode==1&&(r+=(r?" ":"")+d)),this.startSpan(Math.max(e,a),u),c.opaque)return;let f=t.tree&&t.tree.prop(ce.mounted);if(f&&f.overlay){let g=t.node.enter(f.overlay[0].from+a,1),x=this.highlighters.filter(v=>!v.scope||v.scope(f.tree.type)),m=t.firstChild();for(let v=0,O=a;;v++){let b=v=k||!t.nextSibling())););if(!b||k>n)break;O=b.to+a,O>e&&(this.highlightRange(g.cursor(),Math.max(e,b.from+a),Math.min(n,O),"",x),this.startSpan(Math.min(n,O),u))}m&&t.parent()}else if(t.firstChild()){f&&(r="");do if(!(t.to<=e)){if(t.from>=n)break;this.highlightRange(t,e,n,r,o),this.startSpan(Math.min(n,t.to),u)}while(t.nextSibling());t.parent()}}}function mw(i){let t=i.type.prop(rv);for(;t&&t.context&&!i.matchContext(t.context);)t=t.next;return t||null}const Nt=dn.define,ra=Nt(),Zn=Nt(),ep=Nt(Zn),ip=Nt(Zn),Wn=Nt(),sa=Nt(Wn),Mh=Nt(Wn),un=Nt(),fr=Nt(un),ln=Nt(),hn=Nt(),sc=Nt(),ks=Nt(sc),oa=Nt(),mt={comment:ra,lineComment:Nt(ra),blockComment:Nt(ra),docComment:Nt(ra),name:Zn,variableName:Nt(Zn),typeName:ep,tagName:Nt(ep),propertyName:ip,attributeName:Nt(ip),className:Nt(Zn),labelName:Nt(Zn),namespace:Nt(Zn),macroName:Nt(Zn),literal:Wn,string:sa,docString:Nt(sa),character:Nt(sa),attributeValue:Nt(sa),number:Mh,integer:Nt(Mh),float:Nt(Mh),bool:Nt(Wn),regexp:Nt(Wn),escape:Nt(Wn),color:Nt(Wn),url:Nt(Wn),keyword:ln,self:Nt(ln),null:Nt(ln),atom:Nt(ln),unit:Nt(ln),modifier:Nt(ln),operatorKeyword:Nt(ln),controlKeyword:Nt(ln),definitionKeyword:Nt(ln),moduleKeyword:Nt(ln),operator:hn,derefOperator:Nt(hn),arithmeticOperator:Nt(hn),logicOperator:Nt(hn),bitwiseOperator:Nt(hn),compareOperator:Nt(hn),updateOperator:Nt(hn),definitionOperator:Nt(hn),typeOperator:Nt(hn),controlOperator:Nt(hn),punctuation:sc,separator:Nt(sc),bracket:ks,angleBracket:Nt(ks),squareBracket:Nt(ks),paren:Nt(ks),brace:Nt(ks),content:un,heading:fr,heading1:Nt(fr),heading2:Nt(fr),heading3:Nt(fr),heading4:Nt(fr),heading5:Nt(fr),heading6:Nt(fr),contentSeparator:Nt(un),list:Nt(un),quote:Nt(un),emphasis:Nt(un),strong:Nt(un),link:Nt(un),monospace:Nt(un),strikethrough:Nt(un),inserted:Nt(),deleted:Nt(),changed:Nt(),invalid:Nt(),meta:oa,documentMeta:Nt(oa),annotation:Nt(oa),processingInstruction:Nt(oa),definition:dn.defineModifier(),constant:dn.defineModifier(),function:dn.defineModifier(),standard:dn.defineModifier(),local:dn.defineModifier(),special:dn.defineModifier()};sv([{tag:mt.link,class:"tok-link"},{tag:mt.heading,class:"tok-heading"},{tag:mt.emphasis,class:"tok-emphasis"},{tag:mt.strong,class:"tok-strong"},{tag:mt.keyword,class:"tok-keyword"},{tag:mt.atom,class:"tok-atom"},{tag:mt.bool,class:"tok-bool"},{tag:mt.url,class:"tok-url"},{tag:mt.labelName,class:"tok-labelName"},{tag:mt.inserted,class:"tok-inserted"},{tag:mt.deleted,class:"tok-deleted"},{tag:mt.literal,class:"tok-literal"},{tag:mt.string,class:"tok-string"},{tag:mt.number,class:"tok-number"},{tag:[mt.regexp,mt.escape,mt.special(mt.string)],class:"tok-string2"},{tag:mt.variableName,class:"tok-variableName"},{tag:mt.local(mt.variableName),class:"tok-variableName tok-local"},{tag:mt.definition(mt.variableName),class:"tok-variableName tok-definition"},{tag:mt.special(mt.variableName),class:"tok-variableName2"},{tag:mt.definition(mt.propertyName),class:"tok-propertyName tok-definition"},{tag:mt.typeName,class:"tok-typeName"},{tag:mt.namespace,class:"tok-namespace"},{tag:mt.className,class:"tok-className"},{tag:mt.macroName,class:"tok-macroName"},{tag:mt.propertyName,class:"tok-propertyName"},{tag:mt.operator,class:"tok-operator"},{tag:mt.comment,class:"tok-comment"},{tag:mt.meta,class:"tok-meta"},{tag:mt.invalid,class:"tok-invalid"},{tag:mt.punctuation,class:"tok-punctuation"}]);var $h;const jr=new ce;function ov(i){return Zt.define({combine:i?t=>t.concat(i):void 0})}const Uc=new ce;class Zi{constructor(t,e,n=[],r=""){this.data=t,this.name=r,ye.prototype.hasOwnProperty("tree")||Object.defineProperty(ye.prototype,"tree",{get(){return Ye(this)}}),this.parser=e,this.extension=[or.of(this),ye.languageData.of((o,s,a)=>{let l=np(o,s,a),u=l.type.prop(jr);if(!u)return[];let c=o.facet(u),d=l.type.prop(Uc);if(d){let f=l.resolve(s-l.from,a);for(let g of d)if(g.test(f,o)){let x=o.facet(g.facet);return g.type=="replace"?x:x.concat(c)}}return c})].concat(n)}isActiveAt(t,e,n=-1){return np(t,e,n).type.prop(jr)==this.data}findRegions(t){let e=t.facet(or);if((e==null?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let n=[],r=(o,s)=>{if(o.prop(jr)==this.data){n.push({from:s,to:s+o.length});return}let a=o.prop(ce.mounted);if(a){if(a.tree.prop(jr)==this.data){if(a.overlay)for(let l of a.overlay)n.push({from:l.from+s,to:l.to+s});else n.push({from:s,to:s+o.length});return}else if(a.overlay){let l=n.length;if(r(a.tree,a.overlay[0].from+s),n.length>l)return}}for(let l=0;ln.isTop?e:void 0)]}),t.name)}configure(t,e){return new ja(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Ye(i){let t=i.field(Zi.state,!1);return t?t.tree:Re.empty}function zc(i,t,e=50){var n;let r=(n=i.field(Zi.state,!1))===null||n===void 0?void 0:n.context;if(!r)return null;let o=r.viewport;r.updateViewport({from:0,to:t});let s=r.isDone(t)||r.work(e,t)?r.tree:null;return r.updateViewport(o),s}class gw{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let n=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-n,e-n)}}let Ls=null;class qa{constructor(t,e,n=[],r,o,s,a,l){this.parser=t,this.state=e,this.fragments=n,this.tree=r,this.treeLen=o,this.viewport=s,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,e,n){return new qa(t,e,[],Re.empty,0,n,[],null)}startParse(){return this.parser.startParse(new gw(this.state.doc),this.fragments)}work(t,e){return e!=null&&e>=this.state.doc.length&&(e=void 0),this.tree!=Re.empty&&this.isDone(e??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof t=="number"){let r=Date.now()+t;t=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),e!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&e=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(e=this.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(wr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Ls;Ls=this;try{return t()}finally{Ls=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=rp(t,e.from,e.to);return t}changes(t,e){let{fragments:n,tree:r,treeLen:o,viewport:s,skipped:a}=this;if(this.takeTree(),!t.empty){let l=[];if(t.iterChangedRanges((u,c,d,f)=>l.push({fromA:u,toA:c,fromB:d,toB:f})),n=wr.applyChanges(n,l),r=Re.empty,o=0,s={from:t.mapPos(s.from,-1),to:t.mapPos(s.to,1)},this.skipped.length){a=[];for(let u of this.skipped){let c=t.mapPos(u.from,1),d=t.mapPos(u.to,-1);ct.from&&(this.fragments=rp(this.fragments,r,o),this.skipped.splice(n--,1))}return this.skipped.length>=e?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends iv{createParse(e,n,r){let o=r[0].from,s=r[r.length-1].to;return{parsedPos:o,advance(){let l=Ls;if(l){for(let u of r)l.tempSkipped.push(u);t&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,t]):t)}return this.parsedPos=s,new Re(Ei.none,[],[],s-o)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&e[0].from==0&&e[0].to>=t}static get(){return Ls}}function rp(i,t,e){return wr.applyChanges(i,[{fromA:t,toA:e,fromB:t,toB:e}])}class fs{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),n=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,n)||e.takeTree(),new fs(e)}static init(t){let e=Math.min(3e3,t.doc.length),n=qa.create(t.facet(or).parser,t,{from:0,to:e});return n.work(20,e)||n.takeTree(),new fs(n)}}Zi.state=ti.define({create:fs.init,update(i,t){for(let e of t.effects)if(e.is(Zi.setState))return e.value;return t.startState.facet(or)!=t.state.facet(or)?fs.init(t.state):i.apply(t)}});let av=i=>{let t=setTimeout(()=>i(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(av=i=>{let t=-1,e=setTimeout(()=>{t=requestIdleCallback(i,{timeout:500-100})},100);return()=>t<0?clearTimeout(e):cancelIdleCallback(t)});const Qh=typeof navigator<"u"&&(!(($h=navigator.scheduling)===null||$h===void 0)&&$h.isInputPending)?()=>navigator.scheduling.isInputPending():null,vw=Fe.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(Zi.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Zi.state);(e.tree!=e.context.tree||!e.context.isDone(t.doc.length))&&(this.working=av(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndr+1e3,l=o.context.work(()=>Qh&&Qh()||Date.now()>s,r+(a?0:1e5));this.chunkBudget-=Date.now()-e,(l||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:Zi.setState.of(new fs(o.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(e=>Pi(this.view.state,e)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),or=Zt.define({combine(i){return i.length?i[0]:null},enables:i=>[Zi.state,vw,Rt.contentAttributes.compute([i],t=>{let e=t.facet(i);return e&&e.name?{"data-language":e.name}:{}})]});class yw{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}const Ow=Zt.define(),Tr=Zt.define({combine:i=>{if(!i.length)return" ";let t=i[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(i[0]));return t}});function Va(i){let t=i.facet(Tr);return t.charCodeAt(0)==9?i.tabSize*t.length:t.length}function ho(i,t){let e="",n=i.tabSize,r=i.facet(Tr)[0];if(r==" "){for(;t>=n;)e+=" ",t-=n;r=" "}for(let o=0;o=t?_w(i,e,t):null}class Tl{constructor(t,e={}){this.state=t,this.options=e,this.unit=Va(t)}lineAt(t,e=1){let n=this.state.doc.lineAt(t),{simulateBreak:r,simulateDoubleBreak:o}=this.options;return r!=null&&r>=n.from&&r<=n.to?o&&r==t?{text:"",from:t}:(e<0?r-1&&(o+=s-this.countColumn(n,n.search(/\S|$/))),o}countColumn(t,e=t.length){return gs(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:n,from:r}=this.lineAt(t,e),o=this.options.overrideIndentation;if(o){let s=o(r);if(s>-1)return s}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const lv=new ce;function _w(i,t,e){let n=t.resolveStack(e),r=n.node.enterUnfinishedNodesBefore(e);if(r!=n.node){let o=[];for(let s=r;s!=n.node;s=s.parent)o.push(s);for(let s=o.length-1;s>=0;s--)n={node:o[s],next:n}}return hv(n,i,e)}function hv(i,t,e){for(let n=i;n;n=n.next){let r=bw(n.node);if(r)return r(qc.create(t,e,n))}return 0}function xw(i){return i.pos==i.options.simulateBreak&&i.options.simulateDoubleBreak}function bw(i){let t=i.type.prop(lv);if(t)return t;let e=i.firstChild,n;if(e&&(n=e.type.prop(ce.closedBy))){let r=i.lastChild,o=r&&n.indexOf(r.name)>-1;return s=>uv(s,!0,1,void 0,o&&!xw(s)?r.from:void 0)}return i.parent==null?ww:null}function ww(){return 0}class qc extends Tl{constructor(t,e,n){super(t.state,t.options),this.base=t,this.pos=e,this.context=n}get node(){return this.context.node}static create(t,e,n){return new qc(t,e,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let e=this.state.doc.lineAt(t.from);for(;;){let n=t.resolve(e.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(Sw(n,t))break;e=this.state.doc.lineAt(n.from)}return this.lineIndent(e.from)}continue(){return hv(this.context.next,this.base,this.pos)}}function Sw(i,t){for(let e=t;e;e=e.parent)if(i==e)return!0;return!1}function Cw(i){let t=i.node,e=t.childAfter(t.from),n=t.lastChild;if(!e)return null;let r=i.options.simulateBreak,o=i.state.doc.lineAt(e.from),s=r==null||r<=o.from?o.to:Math.min(o.to,r);for(let a=e.to;;){let l=t.childAfter(a);if(!l||l==n)return null;if(!l.type.isSkipped)return l.fromuv(n,t,e,i)}function uv(i,t,e,n,r){let o=i.textAfter,s=o.match(/^\s*/)[0].length,a=n&&o.slice(s,s+n.length)==n||r==i.pos+s,l=t?Cw(i):null;return l?a?i.column(l.from):i.column(l.to):i.baseIndent+(a?0:i.unit*e)}const kw=i=>i.baseIndent;function Nh({except:i,units:t=1}={}){return e=>{let n=i&&i.test(e.textAfter);return e.baseIndent+(n?0:t*e.unit)}}const Lw=200;function Aw(){return ye.transactionFilter.of(i=>{if(!i.docChanged||!i.isUserEvent("input.type")&&!i.isUserEvent("input.complete"))return i;let t=i.startState.languageDataAt("indentOnInput",i.startState.selection.main.head);if(!t.length)return i;let e=i.newDoc,{head:n}=i.newSelection.main,r=e.lineAt(n);if(n>r.from+Lw)return i;let o=e.sliceString(r.from,n);if(!t.some(u=>u.test(o)))return i;let{state:s}=i,a=-1,l=[];for(let{head:u}of s.selection.ranges){let c=s.doc.lineAt(u);if(c.from==a)continue;a=c.from;let d=jc(s,c.from);if(d==null)continue;let f=/^\s*/.exec(c.text)[0],g=ho(s,d);f!=g&&l.push({from:c.from,to:c.from+f.length,insert:g})}return l.length?[i,{changes:l,sequential:!0}]:i})}const Ew=Zt.define(),cv=new ce;function Dw(i){let t=i.firstChild,e=i.lastChild;return t&&t.toe)continue;if(o&&a.from=t&&u.to>e&&(o=u)}}return o}function Iw(i){let t=i.lastChild;return t&&t.to==i.to&&t.type.isError}function Ga(i,t,e){for(let n of i.facet(Ew)){let r=n(i,t,e);if(r)return r}return Tw(i,t,e)}function fv(i,t){let e=t.mapPos(i.from,1),n=t.mapPos(i.to,-1);return e>=n?void 0:{from:e,to:n}}const Il=re.define({map:fv}),Co=re.define({map:fv});function dv(i){let t=[];for(let{head:e}of i.state.selection.ranges)t.some(n=>n.from<=e&&n.to>=e)||t.push(i.lineBlockAt(e));return t}const Ir=ti.define({create(){return Gt.none},update(i,t){i=i.map(t.changes);for(let e of t.effects)if(e.is(Il)&&!Mw(i,e.value.from,e.value.to)){let{preparePlaceholder:n}=t.state.facet(Vc),r=n?Gt.replace({widget:new Xw(n(t.state,e.value))}):sp;i=i.update({add:[r.range(e.value.from,e.value.to)]})}else e.is(Co)&&(i=i.update({filter:(n,r)=>e.value.from!=n||e.value.to!=r,filterFrom:e.value.from,filterTo:e.value.to}));if(t.selection){let e=!1,{head:n}=t.selection.main;i.between(n,n,(r,o)=>{rn&&(e=!0)}),e&&(i=i.update({filterFrom:n,filterTo:n,filter:(r,o)=>o<=n||r>=n}))}return i},provide:i=>Rt.decorations.from(i),toJSON(i,t){let e=[];return i.between(0,t.doc.length,(n,r)=>{e.push(n,r)}),e},fromJSON(i){if(!Array.isArray(i)||i.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let e=0;e{(!r||r.from>o)&&(r={from:o,to:s})}),r}function Mw(i,t,e){let n=!1;return i.between(t,t,(r,o)=>{r==t&&o==e&&(n=!0)}),n}function pv(i,t){return i.field(Ir,!1)?t:t.concat(re.appendConfig.of(vv()))}const mv=i=>{for(let t of dv(i)){let e=Ga(i.state,t.from,t.to);if(e)return i.dispatch({effects:pv(i.state,[Il.of(e),gv(i,e)])}),!0}return!1},$w=i=>{if(!i.state.field(Ir,!1))return!1;let t=[];for(let e of dv(i)){let n=Ha(i.state,e.from,e.to);n&&t.push(Co.of(n),gv(i,n,!1))}return t.length&&i.dispatch({effects:t}),t.length>0};function gv(i,t,e=!0){let n=i.state.doc.lineAt(t.from).number,r=i.state.doc.lineAt(t.to).number;return Rt.announce.of(`${i.state.phrase(e?"Folded lines":"Unfolded lines")} ${n} ${i.state.phrase("to")} ${r}.`)}const Qw=i=>{let{state:t}=i,e=[];for(let n=0;n{let t=i.state.field(Ir,!1);if(!t||!t.size)return!1;let e=[];return t.between(0,i.state.doc.length,(n,r)=>{e.push(Co.of({from:n,to:r}))}),i.dispatch({effects:e}),!0},Bw=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:mv},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:$w},{key:"Ctrl-Alt-[",run:Qw},{key:"Ctrl-Alt-]",run:Nw}],Fw={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Vc=Zt.define({combine(i){return xn(i,Fw)}});function vv(i){let t=[Ir,Zw];return i&&t.push(Vc.of(i)),t}function yv(i,t){let{state:e}=i,n=e.facet(Vc),r=s=>{let a=i.lineBlockAt(i.posAtDOM(s.target)),l=Ha(i.state,a.from,a.to);l&&i.dispatch({effects:Co.of(l)}),s.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(i,r,t);let o=document.createElement("span");return o.textContent=n.placeholderText,o.setAttribute("aria-label",e.phrase("folded code")),o.title=e.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=r,o}const sp=Gt.replace({widget:new class extends Mn{toDOM(i){return yv(i,null)}}});class Xw extends Mn{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return yv(t,this.value)}}const Rw={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Bh extends Tn{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}function Yw(i={}){let t=Object.assign(Object.assign({},Rw),i),e=new Bh(t,!0),n=new Bh(t,!1),r=Fe.fromClass(class{constructor(s){this.from=s.viewport.from,this.markers=this.buildMarkers(s)}update(s){(s.docChanged||s.viewportChanged||s.startState.facet(or)!=s.state.facet(or)||s.startState.field(Ir,!1)!=s.state.field(Ir,!1)||Ye(s.startState)!=Ye(s.state)||t.foldingChanged(s))&&(this.markers=this.buildMarkers(s.view))}buildMarkers(s){let a=new _n;for(let l of s.viewportLineBlocks){let u=Ha(s.state,l.from,l.to)?n:Ga(s.state,l.from,l.to)?e:null;u&&a.add(l.from,l.from,u)}return a.finish()}}),{domEventHandlers:o}=t;return[r,Wb({class:"cm-foldGutter",markers(s){var a;return((a=s.plugin(r))===null||a===void 0?void 0:a.markers)||ge.empty},initialSpacer(){return new Bh(t,!1)},domEventHandlers:Object.assign(Object.assign({},o),{click:(s,a,l)=>{if(o.click&&o.click(s,a,l))return!0;let u=Ha(s.state,a.from,a.to);if(u)return s.dispatch({effects:Co.of(u)}),!0;let c=Ga(s.state,a.from,a.to);return c?(s.dispatch({effects:Il.of(c)}),!0):!1}})}),vv()]}const Zw=Rt.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Ml{constructor(t,e){this.specs=t;let n;function r(a){let l=ir.newName();return(n||(n=Object.create(null)))["."+l]=a,l}const o=typeof e.all=="string"?e.all:e.all?r(e.all):void 0,s=e.scope;this.scope=s instanceof Zi?a=>a.prop(jr)==s.data:s?a=>a==s:void 0,this.style=sv(t.map(a=>({tag:a.tag,class:a.class||r(Object.assign({},a,{tag:null}))})),{all:o}).style,this.module=n?new ir(n):null,this.themeType=e.themeType}static define(t,e){return new Ml(t,e||{})}}const oc=Zt.define(),Ov=Zt.define({combine(i){return i.length?[i[0]]:null}});function Fh(i){let t=i.facet(oc);return t.length?t:i.facet(Ov)}function Ww(i,t){let e=[zw],n;return i instanceof Ml&&(i.module&&e.push(Rt.styleModule.of(i.module)),n=i.themeType),t!=null&&t.fallback?e.push(Ov.of(i)):n?e.push(oc.computeN([Rt.darkTheme],r=>r.facet(Rt.darkTheme)==(n=="dark")?[i]:[])):e.push(oc.of(i)),e}class Uw{constructor(t){this.markCache=Object.create(null),this.tree=Ye(t.state),this.decorations=this.buildDeco(t,Fh(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=Ye(t.state),n=Fh(t.state),r=n!=Fh(t.startState),{viewport:o}=t.view,s=t.changes.mapPos(this.decoratedTo,1);e.length=o.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=s):(e!=this.tree||t.viewportChanged||r)&&(this.tree=e,this.decorations=this.buildDeco(t.view,n),this.decoratedTo=o.to)}buildDeco(t,e){if(!e||!this.tree.length)return Gt.none;let n=new _n;for(let{from:r,to:o}of t.visibleRanges)dw(this.tree,e,(s,a,l)=>{n.add(s,a,this.markCache[l]||(this.markCache[l]=Gt.mark({class:l})))},r,o);return n.finish()}}const zw=lr.high(Fe.fromClass(Uw,{decorations:i=>i.decorations})),jw=Ml.define([{tag:mt.meta,color:"#404740"},{tag:mt.link,textDecoration:"underline"},{tag:mt.heading,textDecoration:"underline",fontWeight:"bold"},{tag:mt.emphasis,fontStyle:"italic"},{tag:mt.strong,fontWeight:"bold"},{tag:mt.strikethrough,textDecoration:"line-through"},{tag:mt.keyword,color:"#708"},{tag:[mt.atom,mt.bool,mt.url,mt.contentSeparator,mt.labelName],color:"#219"},{tag:[mt.literal,mt.inserted],color:"#164"},{tag:[mt.string,mt.deleted],color:"#a11"},{tag:[mt.regexp,mt.escape,mt.special(mt.string)],color:"#e40"},{tag:mt.definition(mt.variableName),color:"#00f"},{tag:mt.local(mt.variableName),color:"#30a"},{tag:[mt.typeName,mt.namespace],color:"#085"},{tag:mt.className,color:"#167"},{tag:[mt.special(mt.variableName),mt.macroName],color:"#256"},{tag:mt.definition(mt.propertyName),color:"#00c"},{tag:mt.comment,color:"#940"},{tag:mt.invalid,color:"#f00"}]),qw=Rt.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),_v=1e4,xv="()[]{}",bv=Zt.define({combine(i){return xn(i,{afterCursor:!0,brackets:xv,maxScanDistance:_v,renderMatch:Hw})}}),Vw=Gt.mark({class:"cm-matchingBracket"}),Gw=Gt.mark({class:"cm-nonmatchingBracket"});function Hw(i){let t=[],e=i.matched?Vw:Gw;return t.push(e.range(i.start.from,i.start.to)),i.end&&t.push(e.range(i.end.from,i.end.to)),t}const Jw=ti.define({create(){return Gt.none},update(i,t){if(!t.docChanged&&!t.selection)return i;let e=[],n=t.state.facet(bv);for(let r of t.state.selection.ranges){if(!r.empty)continue;let o=Wi(t.state,r.head,-1,n)||r.head>0&&Wi(t.state,r.head-1,1,n)||n.afterCursor&&(Wi(t.state,r.head,1,n)||r.headRt.decorations.from(i)}),Kw=[Jw,qw];function tS(i={}){return[bv.of(i),Kw]}const eS=new ce;function ac(i,t,e){let n=i.prop(t<0?ce.openedBy:ce.closedBy);if(n)return n;if(i.name.length==1){let r=e.indexOf(i.name);if(r>-1&&r%2==(t<0?1:0))return[e[r+t]]}return null}function lc(i){let t=i.type.prop(eS);return t?t(i.node):i}function Wi(i,t,e,n={}){let r=n.maxScanDistance||_v,o=n.brackets||xv,s=Ye(i),a=s.resolveInner(t,e);for(let l=a;l;l=l.parent){let u=ac(l.type,e,o);if(u&&l.from0?t>=c.from&&tc.from&&t<=c.to))return iS(i,t,e,l,c,u,o)}}return nS(i,t,e,s,a.type,r,o)}function iS(i,t,e,n,r,o,s){let a=n.parent,l={from:r.from,to:r.to},u=0,c=a==null?void 0:a.cursor();if(c&&(e<0?c.childBefore(n.from):c.childAfter(n.to)))do if(e<0?c.to<=n.from:c.from>=n.to){if(u==0&&o.indexOf(c.type.name)>-1&&c.from0)return null;let u={from:e<0?t-1:t,to:e>0?t+1:t},c=i.doc.iterRange(t,e>0?i.doc.length:0),d=0;for(let f=0;!c.next().done&&f<=o;){let g=c.value;e<0&&(f+=g.length);let x=t+f*e;for(let m=e>0?0:g.length-1,v=e>0?g.length:-1;m!=v;m+=e){let O=s.indexOf(g[m]);if(!(O<0||n.resolveInner(x+m,1).type!=r))if(O%2==0==e>0)d++;else{if(d==1)return{start:u,end:{from:x+m,to:x+m+1},matched:O>>1==l>>1};d--}}e>0&&(f+=g.length)}return c.done?{start:u,matched:!1}:null}function op(i,t,e,n=0,r=0){t==null&&(t=i.search(/[^\s\u00a0]/),t==-1&&(t=i.length));let o=r;for(let s=n;s=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pose}eatSpace(){let t=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t}skipToEnd(){this.pos=this.string.length}skipTo(t){let e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0}backUp(t){this.pos-=t}column(){return this.lastColumnPosn?s.toLowerCase():s,o=this.string.substr(this.pos,t.length);return r(o)==r(t)?(e!==!1&&(this.pos+=t.length),!0):null}else{let r=this.string.slice(this.pos).match(t);return r&&r.index>0?null:(r&&e!==!1&&(this.pos+=r[0].length),r)}}current(){return this.string.slice(this.start,this.pos)}}const sS=Object.create(null),ap=[Ei.none],lp=[],hp=Object.create(null),oS=Object.create(null);for(let[i,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])oS[i]=aS(sS,t);function Xh(i,t){lp.indexOf(i)>-1||(lp.push(i),console.warn(t))}function aS(i,t){let e=[];for(let a of t.split(" ")){let l=[];for(let u of a.split(".")){let c=i[u]||mt[u];c?typeof c=="function"?l.length?l=l.map(c):Xh(u,`Modifier ${u} used at start of tag`):l.length?Xh(u,`Tag ${u} used as modifier`):l=Array.isArray(c)?c:[c]:Xh(u,`Unknown highlighting tag ${u}`)}for(let u of l)e.push(u)}if(!e.length)return 0;let n=t.replace(/ /g,"_"),r=n+" "+e.map(a=>a.id),o=hp[r];if(o)return o.id;let s=hp[r]=Ei.define({id:ap.length,name:n,props:[nv({[n]:e})]});return ap.push(s),s.id}Me.RTL,Me.LTR;const lS=i=>{let{state:t}=i,e=t.doc.lineAt(t.selection.main.from),n=Hc(i.state,e.from);return n.line?hS(i):n.block?cS(i):!1};function Gc(i,t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=i(t,e);return r?(n(e.update(r)),!0):!1}}const hS=Gc(pS,0),uS=Gc(wv,0),cS=Gc((i,t)=>wv(i,t,dS(t)),0);function Hc(i,t){let e=i.languageDataAt("commentTokens",t);return e.length?e[0]:{}}const As=50;function fS(i,{open:t,close:e},n,r){let o=i.sliceDoc(n-As,n),s=i.sliceDoc(r,r+As),a=/\s*$/.exec(o)[0].length,l=/^\s*/.exec(s)[0].length,u=o.length-a;if(o.slice(u-t.length,u)==t&&s.slice(l,l+e.length)==e)return{open:{pos:n-a,margin:a&&1},close:{pos:r+l,margin:l&&1}};let c,d;r-n<=2*As?c=d=i.sliceDoc(n,r):(c=i.sliceDoc(n,n+As),d=i.sliceDoc(r-As,r));let f=/^\s*/.exec(c)[0].length,g=/\s*$/.exec(d)[0].length,x=d.length-g-e.length;return c.slice(f,f+t.length)==t&&d.slice(x,x+e.length)==e?{open:{pos:n+f+t.length,margin:/\s/.test(c.charAt(f+t.length))?1:0},close:{pos:r-g-e.length,margin:/\s/.test(d.charAt(x-1))?1:0}}:null}function dS(i){let t=[];for(let e of i.selection.ranges){let n=i.doc.lineAt(e.from),r=e.to<=n.to?n:i.doc.lineAt(e.to),o=t.length-1;o>=0&&t[o].to>n.from?t[o].to=r.to:t.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:r.to})}return t}function wv(i,t,e=t.selection.ranges){let n=e.map(o=>Hc(t,o.from).block);if(!n.every(o=>o))return null;let r=e.map((o,s)=>fS(t,n[s],o.from,o.to));if(i!=2&&!r.every(o=>o))return{changes:t.changes(e.map((o,s)=>r[s]?[]:[{from:o.from,insert:n[s].open+" "},{from:o.to,insert:" "+n[s].close}]))};if(i!=1&&r.some(o=>o)){let o=[];for(let s=0,a;sr&&(o==s||s>d.from)){r=d.from;let f=/^\s*/.exec(d.text)[0].length,g=f==d.length,x=d.text.slice(f,f+u.length)==u?f:-1;fo.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:a,token:l,indent:u,empty:c,single:d}of n)(d||!c)&&o.push({from:a.from+u,insert:l+" "});let s=t.changes(o);return{changes:s,selection:t.selection.map(s,1)}}else if(i!=1&&n.some(o=>o.comment>=0)){let o=[];for(let{line:s,comment:a,token:l}of n)if(a>=0){let u=s.from+a,c=u+l.length;s.text[c-s.from]==" "&&c++,o.push({from:u,to:c})}return{changes:o}}return null}const hc=In.define(),mS=In.define(),gS=Zt.define(),Sv=Zt.define({combine(i){return xn(i,{minDepth:100,newGroupDelay:500,joinToEvent:(t,e)=>e},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,e)=>(n,r)=>t(n,r)||e(n,r)})}});function vS(i){let t=0;return i.iterChangedRanges((e,n)=>t=n),t}const Cv=ti.define({create(){return yn.empty},update(i,t){let e=t.state.facet(Sv),n=t.annotation(hc);if(n){let l=t.docChanged?yt.single(vS(t.changes)):void 0,u=ki.fromTransaction(t,l),c=n.side,d=c==0?i.undone:i.done;return u?d=Ka(d,d.length,e.minDepth,u):d=kv(d,t.startState.selection),new yn(c==0?n.rest:d,c==0?d:n.rest)}let r=t.annotation(mS);if((r=="full"||r=="before")&&(i=i.isolate()),t.annotation(Ke.addToHistory)===!1)return t.changes.empty?i:i.addMapping(t.changes.desc);let o=ki.fromTransaction(t),s=t.annotation(Ke.time),a=t.annotation(Ke.userEvent);return o?i=i.addChanges(o,s,a,e,t):t.selection&&(i=i.addSelection(t.startState.selection,s,a,e.newGroupDelay)),(r=="full"||r=="after")&&(i=i.isolate()),i},toJSON(i){return{done:i.done.map(t=>t.toJSON()),undone:i.undone.map(t=>t.toJSON())}},fromJSON(i){return new yn(i.done.map(ki.fromJSON),i.undone.map(ki.fromJSON))}});function yS(i={}){return[Cv,Sv.of(i),Rt.domEventHandlers({beforeinput(t,e){let n=t.inputType=="historyUndo"?Jc:t.inputType=="historyRedo"?Ja:null;return n?(t.preventDefault(),n(e)):!1}})]}function $l(i,t){return function({state:e,dispatch:n}){if(!t&&e.readOnly)return!1;let r=e.field(Cv,!1);if(!r)return!1;let o=r.pop(i,e,t);return o?(n(o),!0):!1}}const Jc=$l(0,!1),Ja=$l(1,!1),OS=$l(0,!0),_S=$l(1,!0);class ki{constructor(t,e,n,r,o){this.changes=t,this.effects=e,this.mapped=n,this.startSelection=r,this.selectionsAfter=o}setSelAfter(t){return new ki(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,n;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(e=this.mapped)===null||e===void 0?void 0:e.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(t){return new ki(t.changes&&Ge.fromJSON(t.changes),[],t.mapped&&On.fromJSON(t.mapped),t.startSelection&&yt.fromJSON(t.startSelection),t.selectionsAfter.map(yt.fromJSON))}static fromTransaction(t,e){let n=Ui;for(let r of t.startState.facet(gS)){let o=r(t);o.length&&(n=n.concat(o))}return!n.length&&t.changes.empty?null:new ki(t.changes.invert(t.startState.doc),n,void 0,e||t.startState.selection,Ui)}static selection(t){return new ki(void 0,Ui,void 0,void 0,t)}}function Ka(i,t,e,n){let r=t+1>e+20?t-e-1:0,o=i.slice(r,t);return o.push(n),o}function xS(i,t){let e=[],n=!1;return i.iterChangedRanges((r,o)=>e.push(r,o)),t.iterChangedRanges((r,o,s,a)=>{for(let l=0;l=u&&s<=c&&(n=!0)}}),n}function bS(i,t){return i.ranges.length==t.ranges.length&&i.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function Pv(i,t){return i.length?t.length?i.concat(t):i:t}const Ui=[],wS=200;function kv(i,t){if(i.length){let e=i[i.length-1],n=e.selectionsAfter.slice(Math.max(0,e.selectionsAfter.length-wS));return n.length&&n[n.length-1].eq(t)?i:(n.push(t),Ka(i,i.length-1,1e9,e.setSelAfter(n)))}else return[ki.selection([t])]}function SS(i){let t=i[i.length-1],e=i.slice();return e[i.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),e}function Rh(i,t){if(!i.length)return i;let e=i.length,n=Ui;for(;e;){let r=CS(i[e-1],t,n);if(r.changes&&!r.changes.empty||r.effects.length){let o=i.slice(0,e);return o[e-1]=r,o}else t=r.mapped,e--,n=r.selectionsAfter}return n.length?[ki.selection(n)]:Ui}function CS(i,t,e){let n=Pv(i.selectionsAfter.length?i.selectionsAfter.map(a=>a.map(t)):Ui,e);if(!i.changes)return ki.selection(n);let r=i.changes.map(t),o=t.mapDesc(i.changes,!0),s=i.mapped?i.mapped.composeDesc(o):o;return new ki(r,re.mapEffects(i.effects,t),s,i.startSelection.map(o),n)}const PS=/^(input\.type|delete)($|\.)/;class yn{constructor(t,e,n=0,r=void 0){this.done=t,this.undone=e,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new yn(this.done,this.undone):this}addChanges(t,e,n,r,o){let s=this.done,a=s[s.length-1];return a&&a.changes&&!a.changes.empty&&t.changes&&(!n||PS.test(n))&&(!a.selectionsAfter.length&&e-this.prevTime0&&e-this.prevTimee.empty?i.moveByChar(e,t):Ql(e,t))}function yi(i){return i.textDirectionAt(i.state.selection.main.head)==Me.LTR}const tf=i=>Kc(i,!yi(i)),Lv=i=>Kc(i,yi(i)),LS=i=>Kc(i,!1);function Av(i,t){return rn(i,e=>e.empty?i.moveByGroup(e,t):Ql(e,t))}const AS=i=>Av(i,!yi(i)),ES=i=>Av(i,yi(i));function DS(i,t,e){if(t.type.prop(e))return!0;let n=t.to-t.from;return n&&(n>2||/[^\s,.;:]/.test(i.sliceDoc(t.from,t.to)))||t.firstChild}function Nl(i,t,e){let n=Ye(i).resolveInner(t.head),r=e?ce.closedBy:ce.openedBy;for(let l=t.head;;){let u=e?n.childAfter(l):n.childBefore(l);if(!u)break;DS(i,u,r)?n=u:l=e?u.to:u.from}let o=n.type.prop(r),s,a;return o&&(s=e?Wi(i,n.from,1):Wi(i,n.to,-1))&&s.matched?a=e?s.end.to:s.end.from:a=e?n.to:n.from,yt.cursor(a,e?-1:1)}const TS=i=>rn(i,t=>Nl(i.state,t,!yi(i))),IS=i=>rn(i,t=>Nl(i.state,t,yi(i)));function Ev(i,t){return rn(i,e=>{if(!e.empty)return Ql(e,t);let n=i.moveVertically(e,t);return n.head!=e.head?n:i.moveToLineBoundary(e,t)})}const Dv=i=>Ev(i,!1),Tv=i=>Ev(i,!0);function Iv(i){let t=i.scrollDOM.clientHeights.empty?i.moveVertically(s,t,e.height):Ql(s,t));if(r.eq(n.selection))return!1;let o;if(e.selfScroll){let s=i.coordsAtPos(n.selection.main.head),a=i.scrollDOM.getBoundingClientRect(),l=a.top+e.marginTop,u=a.bottom-e.marginBottom;s&&s.top>l&&s.bottomMv(i,!1),uc=i=>Mv(i,!0);function hr(i,t,e){let n=i.lineBlockAt(t.head),r=i.moveToLineBoundary(t,e);if(r.head==t.head&&r.head!=(e?n.to:n.from)&&(r=i.moveToLineBoundary(t,e,!1)),!e&&r.head==n.from&&n.length){let o=/^\s*/.exec(i.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;o&&t.head!=n.from+o&&(r=yt.cursor(n.from+o))}return r}const $v=i=>rn(i,t=>hr(i,t,!0)),Qv=i=>rn(i,t=>hr(i,t,!1)),MS=i=>rn(i,t=>hr(i,t,!yi(i))),$S=i=>rn(i,t=>hr(i,t,yi(i))),QS=i=>rn(i,t=>yt.cursor(i.lineBlockAt(t.head).from,1)),NS=i=>rn(i,t=>yt.cursor(i.lineBlockAt(t.head).to,-1));function BS(i,t,e){let n=!1,r=vs(i.selection,o=>{let s=Wi(i,o.head,-1)||Wi(i,o.head,1)||o.head>0&&Wi(i,o.head-1,1)||o.headBS(i,t,!1);function qi(i,t){let e=vs(i.state.selection,n=>{let r=t(n);return yt.range(n.anchor,r.head,r.goalColumn,r.bidiLevel||void 0)});return e.eq(i.state.selection)?!1:(i.dispatch(bn(i.state,e)),!0)}function Nv(i,t){return qi(i,e=>i.moveByChar(e,t))}const Bv=i=>Nv(i,!yi(i)),Fv=i=>Nv(i,yi(i));function Xv(i,t){return qi(i,e=>i.moveByGroup(e,t))}const XS=i=>Xv(i,!yi(i)),RS=i=>Xv(i,yi(i)),YS=i=>qi(i,t=>Nl(i.state,t,!yi(i))),ZS=i=>qi(i,t=>Nl(i.state,t,yi(i)));function Rv(i,t){return qi(i,e=>i.moveVertically(e,t))}const Yv=i=>Rv(i,!1),Zv=i=>Rv(i,!0);function Wv(i,t){return qi(i,e=>i.moveVertically(e,t,Iv(i).height))}const cp=i=>Wv(i,!1),fp=i=>Wv(i,!0),WS=i=>qi(i,t=>hr(i,t,!0)),US=i=>qi(i,t=>hr(i,t,!1)),zS=i=>qi(i,t=>hr(i,t,!yi(i))),jS=i=>qi(i,t=>hr(i,t,yi(i))),qS=i=>qi(i,t=>yt.cursor(i.lineBlockAt(t.head).from)),VS=i=>qi(i,t=>yt.cursor(i.lineBlockAt(t.head).to)),dp=({state:i,dispatch:t})=>(t(bn(i,{anchor:0})),!0),pp=({state:i,dispatch:t})=>(t(bn(i,{anchor:i.doc.length})),!0),mp=({state:i,dispatch:t})=>(t(bn(i,{anchor:i.selection.main.anchor,head:0})),!0),gp=({state:i,dispatch:t})=>(t(bn(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0),GS=({state:i,dispatch:t})=>(t(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"})),!0),HS=({state:i,dispatch:t})=>{let e=Fl(i).map(({from:n,to:r})=>yt.range(n,Math.min(r+1,i.doc.length)));return t(i.update({selection:yt.create(e),userEvent:"select"})),!0},JS=({state:i,dispatch:t})=>{let e=vs(i.selection,n=>{var r;let o=Ye(i).resolveInner(n.head,1);for(;!(o.from=n.to||o.to>n.to&&o.from<=n.from||!(!((r=o.parent)===null||r===void 0)&&r.parent));)o=o.parent;return yt.range(o.to,o.from)});return t(bn(i,e)),!0},KS=({state:i,dispatch:t})=>{let e=i.selection,n=null;return e.ranges.length>1?n=yt.create([e.main]):e.main.empty||(n=yt.create([yt.cursor(e.main.head)])),n?(t(bn(i,n)),!0):!1};function Bl(i,t){if(i.state.readOnly)return!1;let e="delete.selection",{state:n}=i,r=n.changeByRange(o=>{let{from:s,to:a}=o;if(s==a){let l=t(s);ls&&(e="delete.forward",l=aa(i,l,!0)),s=Math.min(s,l),a=Math.max(a,l)}else s=aa(i,s,!1),a=aa(i,a,!0);return s==a?{range:o}:{changes:{from:s,to:a},range:yt.cursor(s)}});return r.changes.empty?!1:(i.dispatch(n.update(r,{scrollIntoView:!0,userEvent:e,effects:e=="delete.selection"?Rt.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function aa(i,t,e){if(i instanceof Rt)for(let n of i.state.facet(Rt.atomicRanges).map(r=>r(i)))n.between(t,t,(r,o)=>{rt&&(t=e?o:r)});return t}const Uv=(i,t)=>Bl(i,e=>{let{state:n}=i,r=n.doc.lineAt(e),o,s;if(!t&&e>r.from&&eUv(i,!1),zv=i=>Uv(i,!0),jv=(i,t)=>Bl(i,e=>{let n=e,{state:r}=i,o=r.doc.lineAt(n),s=r.charCategorizer(n);for(let a=null;;){if(n==(t?o.to:o.from)){n==e&&o.number!=(t?r.doc.lines:1)&&(n+=t?1:-1);break}let l=gi(o.text,n-o.from,t)+o.from,u=o.text.slice(Math.min(n,l)-o.from,Math.max(n,l)-o.from),c=s(u);if(a!=null&&c!=a)break;(u!=" "||n!=e)&&(a=c),n=l}return n}),qv=i=>jv(i,!1),tC=i=>jv(i,!0),Vv=i=>Bl(i,t=>{let e=i.lineBlockAt(t).to;return tBl(i,t=>{let e=i.lineBlockAt(t).from;return t>e?e:Math.max(0,t-1)}),iC=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let e=i.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:we.of(["",""])},range:yt.cursor(n.from)}));return t(i.update(e,{scrollIntoView:!0,userEvent:"input"})),!0},nC=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let e=i.changeByRange(n=>{if(!n.empty||n.from==0||n.from==i.doc.length)return{range:n};let r=n.from,o=i.doc.lineAt(r),s=r==o.from?r-1:gi(o.text,r-o.from,!1)+o.from,a=r==o.to?r+1:gi(o.text,r-o.from,!0)+o.from;return{changes:{from:s,to:a,insert:i.doc.slice(r,a).append(i.doc.slice(s,r))},range:yt.cursor(a)}});return e.changes.empty?!1:(t(i.update(e,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Fl(i){let t=[],e=-1;for(let n of i.selection.ranges){let r=i.doc.lineAt(n.from),o=i.doc.lineAt(n.to);if(!n.empty&&n.to==o.from&&(o=i.doc.lineAt(n.to-1)),e>=r.number){let s=t[t.length-1];s.to=o.to,s.ranges.push(n)}else t.push({from:r.from,to:o.to,ranges:[n]});e=o.number+1}return t}function Gv(i,t,e){if(i.readOnly)return!1;let n=[],r=[];for(let o of Fl(i)){if(e?o.to==i.doc.length:o.from==0)continue;let s=i.doc.lineAt(e?o.to+1:o.from-1),a=s.length+1;if(e){n.push({from:o.to,to:s.to},{from:o.from,insert:s.text+i.lineBreak});for(let l of o.ranges)r.push(yt.range(Math.min(i.doc.length,l.anchor+a),Math.min(i.doc.length,l.head+a)))}else{n.push({from:s.from,to:o.from},{from:o.to,insert:i.lineBreak+s.text});for(let l of o.ranges)r.push(yt.range(l.anchor-a,l.head-a))}}return n.length?(t(i.update({changes:n,scrollIntoView:!0,selection:yt.create(r,i.selection.mainIndex),userEvent:"move.line"})),!0):!1}const rC=({state:i,dispatch:t})=>Gv(i,t,!1),sC=({state:i,dispatch:t})=>Gv(i,t,!0);function Hv(i,t,e){if(i.readOnly)return!1;let n=[];for(let r of Fl(i))e?n.push({from:r.from,insert:i.doc.slice(r.from,r.to)+i.lineBreak}):n.push({from:r.to,insert:i.lineBreak+i.doc.slice(r.from,r.to)});return t(i.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const oC=({state:i,dispatch:t})=>Hv(i,t,!1),aC=({state:i,dispatch:t})=>Hv(i,t,!0),lC=i=>{if(i.state.readOnly)return!1;let{state:t}=i,e=t.changes(Fl(t).map(({from:r,to:o})=>(r>0?r--:oi.moveVertically(r,!0)).map(e);return i.dispatch({changes:e,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function hC(i,t){if(/\(\)|\[\]|\{\}/.test(i.sliceDoc(t-1,t+1)))return{from:t,to:t};let e=Ye(i).resolveInner(t),n=e.childBefore(t),r=e.childAfter(t),o;return n&&r&&n.to<=t&&r.from>=t&&(o=n.type.prop(ce.closedBy))&&o.indexOf(r.name)>-1&&i.doc.lineAt(n.to).from==i.doc.lineAt(r.from).from&&!/\S/.test(i.sliceDoc(n.to,r.from))?{from:n.to,to:r.from}:null}const Jv=Kv(!1),uC=Kv(!0);function Kv(i){return({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{let{from:o,to:s}=r,a=t.doc.lineAt(o),l=!i&&o==s&&hC(t,o);i&&(o=s=(s<=a.to?a:t.doc.lineAt(s)).to);let u=new Tl(t,{simulateBreak:o,simulateDoubleBreak:!!l}),c=jc(u,o);for(c==null&&(c=gs(/^\s*/.exec(t.doc.lineAt(o).text)[0],t.tabSize));sa.from&&o{let r=[];for(let s=n.from;s<=n.to;){let a=i.doc.lineAt(s);a.number>e&&(n.empty||n.to>a.from)&&(t(a,r,n),e=a.number),s=a.to+1}let o=i.changes(r);return{changes:r,range:yt.range(o.mapPos(n.anchor,1),o.mapPos(n.head,1))}})}const ty=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let e=Object.create(null),n=new Tl(i,{overrideIndentation:o=>{let s=e[o];return s??-1}}),r=ef(i,(o,s,a)=>{let l=jc(n,o.from);if(l==null)return;/\S/.test(o.text)||(l=0);let u=/^\s*/.exec(o.text)[0],c=ho(i,l);(u!=c||a.fromi.readOnly?!1:(t(i.update(ef(i,(e,n)=>{n.push({from:e.from,insert:i.facet(Tr)})}),{userEvent:"input.indent"})),!0),rf=({state:i,dispatch:t})=>i.readOnly?!1:(t(i.update(ef(i,(e,n)=>{let r=/^\s*/.exec(e.text)[0];if(!r)return;let o=gs(r,i.tabSize),s=0,a=ho(i,Math.max(0,o-Va(i)));for(;s({mac:i.key,run:i.run,shift:i.shift}))),dC=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:TS,shift:YS},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:IS,shift:ZS},{key:"Alt-ArrowUp",run:rC},{key:"Shift-Alt-ArrowUp",run:oC},{key:"Alt-ArrowDown",run:sC},{key:"Shift-Alt-ArrowDown",run:aC},{key:"Escape",run:KS},{key:"Mod-Enter",run:uC},{key:"Alt-l",mac:"Ctrl-l",run:HS},{key:"Mod-i",run:JS,preventDefault:!0},{key:"Mod-[",run:rf},{key:"Mod-]",run:nf},{key:"Mod-Alt-\\",run:ty},{key:"Shift-Mod-k",run:lC},{key:"Shift-Mod-\\",run:FS},{key:"Mod-/",run:lS},{key:"Alt-A",run:uS}].concat(fC),pC={key:"Tab",run:nf,shift:rf};function Ie(){var i=arguments[0];typeof i=="string"&&(i=document.createElement(i));var t=1,e=arguments[1];if(e&&typeof e=="object"&&e.nodeType==null&&!Array.isArray(e)){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];typeof r=="string"?i.setAttribute(n,r):r!=null&&(i[n]=r)}t++}for(;ti.normalize("NFKD"):i=>i;class ds{constructor(t,e,n=0,r=t.length,o,s){this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(n,r),this.bufferStart=n,this.normalize=o?a=>o(vp(a)):vp,this.query=this.normalize(e)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return ai(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let e=Lc(t),n=this.bufferStart+this.bufferPos;this.bufferPos+=Yi(t);let r=this.normalize(e);for(let o=0,s=n;;o++){let a=r.charCodeAt(o),l=this.match(a,s);if(o==r.length-1){if(l)return this.value=l,this;break}s==n&&othis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let e=this.matchPos<=this.to&&this.re.exec(this.curLine);if(e){let n=this.curLineStart+e.index,r=n+e[0].length;if(this.matchPos=tl(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,r,e)))return this.value={from:n,to:r,match:e},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=n||r.to<=e){let a=new Kr(e,t.sliceString(e,n));return Yh.set(t,a),a}if(r.from==e&&r.to==n)return r;let{text:o,from:s}=r;return s>e&&(o=t.sliceString(e,s)+o,s=e),r.to=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,e=this.re.exec(this.flat.text);if(e&&!e[0]&&e.index==t&&(this.re.lastIndex=t+1,e=this.re.exec(this.flat.text)),e){let n=this.flat.from+e.index,r=n+e[0].length;if((this.flat.to>=this.to||e.index+e[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,r,e)))return this.value={from:n,to:r,match:e},this.matchPos=tl(this.text,r+(n==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Kr.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(of.prototype[Symbol.iterator]=ny.prototype[Symbol.iterator]=function(){return this});function mC(i){try{return new RegExp(i,sf),!0}catch{return!1}}function tl(i,t){if(t>=i.length)return t;let e=i.lineAt(t),n;for(;t=56320&&n<57344;)t++;return t}function fc(i){let t=Ie("input",{class:"cm-textfield",name:"line"}),e=Ie("form",{class:"cm-gotoLine",onkeydown:r=>{r.keyCode==27?(r.preventDefault(),i.dispatch({effects:el.of(!1)}),i.focus()):r.keyCode==13&&(r.preventDefault(),n())},onsubmit:r=>{r.preventDefault(),n()}},Ie("label",i.state.phrase("Go to line"),": ",t)," ",Ie("button",{class:"cm-button",type:"submit"},i.state.phrase("go")));function n(){let r=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!r)return;let{state:o}=i,s=o.doc.lineAt(o.selection.main.head),[,a,l,u,c]=r,d=u?+u.slice(1):0,f=l?+l:s.number;if(l&&c){let m=f/100;a&&(m=m*(a=="-"?-1:1)+s.number/o.doc.lines),f=Math.round(o.doc.lines*m)}else l&&a&&(f=f*(a=="-"?-1:1)+s.number);let g=o.doc.line(Math.max(1,Math.min(o.doc.lines,f))),x=yt.cursor(g.from+Math.max(0,Math.min(d,g.length)));i.dispatch({effects:[el.of(!1),Rt.scrollIntoView(x.from,{y:"center"})],selection:x}),i.focus()}return{dom:e}}const el=re.define(),yp=ti.define({create(){return!0},update(i,t){for(let e of t.effects)e.is(el)&&(i=e.value);return i},provide:i=>Dr.from(i,t=>t?fc:null)}),gC=i=>{let t=ao(i,fc);if(!t){let e=[el.of(!0)];i.state.field(yp,!1)==null&&e.push(re.appendConfig.of([yp,vC])),i.dispatch({effects:e}),t=ao(i,fc)}return t&&t.dom.querySelector("input").focus(),!0},vC=Rt.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),yC={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},ry=Zt.define({combine(i){return xn(i,yC,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})}});function OC(i){let t=[SC,wC];return i&&t.push(ry.of(i)),t}const _C=Gt.mark({class:"cm-selectionMatch"}),xC=Gt.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Op(i,t,e,n){return(e==0||i(t.sliceDoc(e-1,e))!=Ne.Word)&&(n==t.doc.length||i(t.sliceDoc(n,n+1))!=Ne.Word)}function bC(i,t,e,n){return i(t.sliceDoc(e,e+1))==Ne.Word&&i(t.sliceDoc(n-1,n))==Ne.Word}const wC=Fe.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.selectionSet||i.docChanged||i.viewportChanged)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let t=i.state.facet(ry),{state:e}=i,n=e.selection;if(n.ranges.length>1)return Gt.none;let r=n.main,o,s=null;if(r.empty){if(!t.highlightWordAroundCursor)return Gt.none;let l=e.wordAt(r.head);if(!l)return Gt.none;s=e.charCategorizer(r.head),o=e.sliceDoc(l.from,l.to)}else{let l=r.to-r.from;if(l200)return Gt.none;if(t.wholeWords){if(o=e.sliceDoc(r.from,r.to),s=e.charCategorizer(r.head),!(Op(s,e,r.from,r.to)&&bC(s,e,r.from,r.to)))return Gt.none}else if(o=e.sliceDoc(r.from,r.to).trim(),!o)return Gt.none}let a=[];for(let l of i.visibleRanges){let u=new ds(e.doc,o,l.from,l.to);for(;!u.next().done;){let{from:c,to:d}=u.value;if((!s||Op(s,e,c,d))&&(r.empty&&c<=r.from&&d>=r.to?a.push(xC.range(c,d)):(c>=r.to||d<=r.from)&&a.push(_C.range(c,d)),a.length>t.maxMatches))return Gt.none}}return Gt.set(a)}},{decorations:i=>i.decorations}),SC=Rt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),CC=({state:i,dispatch:t})=>{let{selection:e}=i,n=yt.create(e.ranges.map(r=>i.wordAt(r.head)||yt.cursor(r.head)),e.mainIndex);return n.eq(e)?!1:(t(i.update({selection:n})),!0)};function PC(i,t){let{main:e,ranges:n}=i.selection,r=i.wordAt(e.head),o=r&&r.from==e.from&&r.to==e.to;for(let s=!1,a=new ds(i.doc,t,n[n.length-1].to);;)if(a.next(),a.done){if(s)return null;a=new ds(i.doc,t,0,Math.max(0,n[n.length-1].from-1)),s=!0}else{if(s&&n.some(l=>l.from==a.value.from))continue;if(o){let l=i.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const kC=({state:i,dispatch:t})=>{let{ranges:e}=i.selection;if(e.some(o=>o.from===o.to))return CC({state:i,dispatch:t});let n=i.sliceDoc(e[0].from,e[0].to);if(i.selection.ranges.some(o=>i.sliceDoc(o.from,o.to)!=n))return!1;let r=PC(i,n);return r?(t(i.update({selection:i.selection.addRange(yt.range(r.from,r.to),!1),effects:Rt.scrollIntoView(r.to)})),!0):!1},ys=Zt.define({combine(i){return xn(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new FC(t),scrollToMatch:t=>Rt.scrollIntoView(t)})}});class af{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||mC(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(e,n)=>n=="n"?` -`:n=="r"?"\r":n=="t"?" ":"\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new DC(this):new AC(this)}getCursor(t,e=0,n){let r=t.doc?t:ye.create({doc:t});return n==null&&(n=r.doc.length),this.regexp?Ur(this,r,e,n):Wr(this,r,e,n)}}class sy{constructor(t){this.spec=t}}function Wr(i,t,e,n){return new ds(t.doc,i.unquoted,e,n,i.caseSensitive?void 0:r=>r.toLowerCase(),i.wholeWord?LC(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}function LC(i,t){return(e,n,r,o)=>((o>e||o+r.length=e)return null;r.push(n.value)}return r}highlight(t,e,n,r){let o=Wr(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,t.doc.length));for(;!o.next().done;)r(o.value.from,o.value.to)}}function Ur(i,t,e,n){return new of(t.doc,i.search,{ignoreCase:!i.caseSensitive,test:i.wholeWord?EC(t.charCategorizer(t.selection.main.head)):void 0},e,n)}function il(i,t){return i.slice(gi(i,t,!1),t)}function nl(i,t){return i.slice(t,gi(i,t))}function EC(i){return(t,e,n)=>!n[0].length||(i(il(n.input,n.index))!=Ne.Word||i(nl(n.input,n.index))!=Ne.Word)&&(i(nl(n.input,n.index+n[0].length))!=Ne.Word||i(il(n.input,n.index+n[0].length))!=Ne.Word)}class DC extends sy{nextMatch(t,e,n){let r=Ur(this.spec,t,n,t.doc.length).next();return r.done&&(r=Ur(this.spec,t,0,e).next()),r.done?null:r.value}prevMatchInRange(t,e,n){for(let r=1;;r++){let o=Math.max(e,n-r*1e4),s=Ur(this.spec,t,o,n),a=null;for(;!s.next().done;)a=s.value;if(a&&(o==e||a.from>o+10))return a;if(o==e)return null}}prevMatch(t,e,n){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,n,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,(e,n)=>n=="$"?"$":n=="&"?t.match[0]:n!="0"&&+n=e)return null;r.push(n.value)}return r}highlight(t,e,n,r){let o=Ur(this.spec,t,Math.max(0,e-250),Math.min(n+250,t.doc.length));for(;!o.next().done;)r(o.value.from,o.value.to)}}const ar=re.define(),lf=re.define(),Kn=ti.define({create(i){return new Zh(dc(i).create(),null)},update(i,t){for(let e of t.effects)e.is(ar)?i=new Zh(e.value.create(),i.panel):e.is(lf)&&(i=new Zh(i.query,e.value?hf:null));return i},provide:i=>Dr.from(i,t=>t.panel)});class Zh{constructor(t,e){this.query=t,this.panel=e}}const TC=Gt.mark({class:"cm-searchMatch"}),IC=Gt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),MC=Fe.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(Kn))}update(i){let t=i.state.field(Kn);(t!=i.startState.field(Kn)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:i,panel:t}){if(!t||!i.spec.valid)return Gt.none;let{view:e}=this,n=new _n;for(let r=0,o=e.visibleRanges,s=o.length;ro[r+1].from-2*250;)l=o[++r].to;i.highlight(e.state,a,l,(u,c)=>{let d=e.state.selection.ranges.some(f=>f.from==u&&f.to==c);n.add(u,c,d?IC:TC)})}return n.finish()}},{decorations:i=>i.decorations});function Po(i){return t=>{let e=t.state.field(Kn,!1);return e&&e.query.spec.valid?i(t,e):ly(t)}}const rl=Po((i,{query:t})=>{let{to:e}=i.state.selection.main,n=t.nextMatch(i.state,e,e);if(!n)return!1;let r=yt.single(n.from,n.to),o=i.state.facet(ys);return i.dispatch({selection:r,effects:[uf(i,n),o.scrollToMatch(r.main,i)],userEvent:"select.search"}),ay(i),!0}),sl=Po((i,{query:t})=>{let{state:e}=i,{from:n}=e.selection.main,r=t.prevMatch(e,n,n);if(!r)return!1;let o=yt.single(r.from,r.to),s=i.state.facet(ys);return i.dispatch({selection:o,effects:[uf(i,r),s.scrollToMatch(o.main,i)],userEvent:"select.search"}),ay(i),!0}),$C=Po((i,{query:t})=>{let e=t.matchAll(i.state,1e3);return!e||!e.length?!1:(i.dispatch({selection:yt.create(e.map(n=>yt.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),QC=({state:i,dispatch:t})=>{let e=i.selection;if(e.ranges.length>1||e.main.empty)return!1;let{from:n,to:r}=e.main,o=[],s=0;for(let a=new ds(i.doc,i.sliceDoc(n,r));!a.next().done;){if(o.length>1e3)return!1;a.value.from==n&&(s=o.length),o.push(yt.range(a.value.from,a.value.to))}return t(i.update({selection:yt.create(o,s),userEvent:"select.search.matches"})),!0},_p=Po((i,{query:t})=>{let{state:e}=i,{from:n,to:r}=e.selection.main;if(e.readOnly)return!1;let o=t.nextMatch(e,n,n);if(!o)return!1;let s=[],a,l,u=[];if(o.from==n&&o.to==r&&(l=e.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(e,o.from,o.to),u.push(Rt.announce.of(e.phrase("replaced match on line $",e.doc.lineAt(n).number)+"."))),o){let c=s.length==0||s[0].from>=o.to?0:o.to-o.from-l.length;a=yt.single(o.from-c,o.to-c),u.push(uf(i,o)),u.push(e.facet(ys).scrollToMatch(a.main,i))}return i.dispatch({changes:s,selection:a,effects:u,userEvent:"input.replace"}),!0}),NC=Po((i,{query:t})=>{if(i.state.readOnly)return!1;let e=t.matchAll(i.state,1e9).map(r=>{let{from:o,to:s}=r;return{from:o,to:s,insert:t.getReplacement(r)}});if(!e.length)return!1;let n=i.state.phrase("replaced $ matches",e.length)+".";return i.dispatch({changes:e,effects:Rt.announce.of(n),userEvent:"input.replace.all"}),!0});function hf(i){return i.state.facet(ys).createPanel(i)}function dc(i,t){var e,n,r,o,s;let a=i.selection.main,l=a.empty||a.to>a.from+100?"":i.sliceDoc(a.from,a.to);if(t&&!l)return t;let u=i.facet(ys);return new af({search:((e=t==null?void 0:t.literal)!==null&&e!==void 0?e:u.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=t==null?void 0:t.caseSensitive)!==null&&n!==void 0?n:u.caseSensitive,literal:(r=t==null?void 0:t.literal)!==null&&r!==void 0?r:u.literal,regexp:(o=t==null?void 0:t.regexp)!==null&&o!==void 0?o:u.regexp,wholeWord:(s=t==null?void 0:t.wholeWord)!==null&&s!==void 0?s:u.wholeWord})}function oy(i){let t=ao(i,hf);return t&&t.dom.querySelector("[main-field]")}function ay(i){let t=oy(i);t&&t==i.root.activeElement&&t.select()}const ly=i=>{let t=i.state.field(Kn,!1);if(t&&t.panel){let e=oy(i);if(e&&e!=i.root.activeElement){let n=dc(i.state,t.query.spec);n.valid&&i.dispatch({effects:ar.of(n)}),e.focus(),e.select()}}else i.dispatch({effects:[lf.of(!0),t?ar.of(dc(i.state,t.query.spec)):re.appendConfig.of(RC)]});return!0},hy=i=>{let t=i.state.field(Kn,!1);if(!t||!t.panel)return!1;let e=ao(i,hf);return e&&e.dom.contains(i.root.activeElement)&&i.focus(),i.dispatch({effects:lf.of(!1)}),!0},BC=[{key:"Mod-f",run:ly,scope:"editor search-panel"},{key:"F3",run:rl,shift:sl,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:rl,shift:sl,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:hy,scope:"editor search-panel"},{key:"Mod-Shift-l",run:QC},{key:"Alt-g",run:gC},{key:"Mod-d",run:kC,preventDefault:!0}];class FC{constructor(t){this.view=t;let e=this.query=t.state.field(Kn).query.spec;this.commit=this.commit.bind(this),this.searchField=Ie("input",{value:e.search,placeholder:Di(t,"Find"),"aria-label":Di(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ie("input",{value:e.replace,placeholder:Di(t,"Replace"),"aria-label":Di(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ie("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Ie("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Ie("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit});function n(r,o,s){return Ie("button",{class:"cm-button",name:r,onclick:o,type:"button"},s)}this.dom=Ie("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,n("next",()=>rl(t),[Di(t,"next")]),n("prev",()=>sl(t),[Di(t,"previous")]),n("select",()=>$C(t),[Di(t,"all")]),Ie("label",null,[this.caseField,Di(t,"match case")]),Ie("label",null,[this.reField,Di(t,"regexp")]),Ie("label",null,[this.wordField,Di(t,"by word")]),...t.state.readOnly?[]:[Ie("br"),this.replaceField,n("replace",()=>_p(t),[Di(t,"replace")]),n("replaceAll",()=>NC(t),[Di(t,"replace all")])],Ie("button",{name:"close",onclick:()=>hy(t),"aria-label":Di(t,"close"),type:"button"},["×"])])}commit(){let t=new af({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:ar.of(t)}))}keydown(t){eb(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?sl:rl)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),_p(this.view))}update(t){for(let e of t.transactions)for(let n of e.effects)n.is(ar)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(ys).top}}function Di(i,t){return i.state.phrase(t)}const la=30,ha=/[\s\.,:;?!]/;function uf(i,{from:t,to:e}){let n=i.state.doc.lineAt(t),r=i.state.doc.lineAt(e).to,o=Math.max(n.from,t-la),s=Math.min(r,e+la),a=i.state.sliceDoc(o,s);if(o!=n.from){for(let l=0;la.length-la;l--)if(!ha.test(a[l-1])&&ha.test(a[l])){a=a.slice(0,l);break}}return Rt.announce.of(`${i.state.phrase("current match")}. ${a} ${i.state.phrase("on line")} ${n.number}.`)}const XC=Rt.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),RC=[Kn,lr.low(MC),XC];class uy{constructor(t,e,n){this.state=t,this.pos=e,this.explicit=n,this.abortListeners=[]}tokenBefore(t){let e=Ye(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),n=Math.max(e.from,this.pos-250),r=e.text.slice(n-e.from,this.pos-e.from),o=r.search(fy(t,!1));return o<0?null:{from:n+o,to:this.pos,text:r.slice(o)}}get aborted(){return this.abortListeners==null}addEventListener(t,e){t=="abort"&&this.abortListeners&&this.abortListeners.push(e)}}function xp(i){let t=Object.keys(i).join(""),e=/\w/.test(t);return e&&(t=t.replace(/\w/g,"")),`[${e?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function YC(i){let t=Object.create(null),e=Object.create(null);for(let{label:r}of i){t[r[0]]=!0;for(let o=1;otypeof r=="string"?{label:r}:r),[e,n]=t.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:YC(t);return r=>{let o=r.matchBefore(n);return o||r.explicit?{from:o?o.from:r.pos,options:t,validFor:e}:null}}function ZC(i,t){return e=>{for(let n=Ye(e.state).resolveInner(e.pos,-1);n;n=n.parent){if(i.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return t(e)}}class bp{constructor(t,e,n,r){this.completion=t,this.source=e,this.match=n,this.score=r}}function tr(i){return i.selection.main.from}function fy(i,t){var e;let{source:n}=i,r=t&&n[0]!="^",o=n[n.length-1]!="$";return!r&&!o?i:new RegExp(`${r?"^":""}(?:${n})${o?"$":""}`,(e=i.flags)!==null&&e!==void 0?e:i.ignoreCase?"i":"")}const dy=In.define();function WC(i,t,e,n){let{main:r}=i.selection,o=e-r.from,s=n-r.from;return Object.assign(Object.assign({},i.changeByRange(a=>a!=r&&e!=n&&i.sliceDoc(a.from+o,a.from+s)!=i.sliceDoc(e,n)?{range:a}:{changes:{from:a.from+o,to:n==r.from?a.to:a.from+s,insert:t},range:yt.cursor(a.from+o+t.length)})),{userEvent:"input.complete"})}const wp=new WeakMap;function UC(i){if(!Array.isArray(i))return i;let t=wp.get(i);return t||wp.set(i,t=cy(i)),t}const cf=re.define(),uo=re.define();class zC{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let e=0;e=48&&$<=57||$>=97&&$<=122?2:$>=65&&$<=90?1:0:(N=Lc($))!=N.toLowerCase()?1:N!=N.toUpperCase()?2:0;(!b||X==1&&v||E==0&&X!=0)&&(e[d]==$||n[d]==$&&(f=!0)?s[d++]=b:s.length&&(O=!1)),E=X,b+=Yi($)}return d==l&&s[0]==0&&O?this.result(-100+(f?-200:0),s,t):g==l&&x==0?this.ret(-200-t.length+(m==t.length?0:-100),[0,m]):a>-1?this.ret(-700-t.length,[a,a+this.pattern.length]):g==l?this.ret(-200+-700-t.length,[x,m]):d==l?this.result(-100+(f?-200:0)+-700+(O?0:-1100),s,t):e.length==2?!1:this.result((r[0]?-700:0)+-200+-1100,r,t)}result(t,e,n){let r=[],o=0;for(let s of e){let a=s+(this.astral?Yi(ai(n,s)):1);o&&r[o-1]==s?r[o-1]=a:(r[o++]=s,r[o++]=a)}return this.ret(t-n.length,r)}}const Li=Zt.define({combine(i){return xn(i,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:jC,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>n=>Sp(t(n),e(n)),optionClass:(t,e)=>n=>Sp(t(n),e(n)),addToOptions:(t,e)=>t.concat(e)})}});function Sp(i,t){return i?t?i+" "+t:i:t}function jC(i,t,e,n,r){let o=i.textDirection==Me.RTL,s=o,a=!1,l="top",u,c,d=t.left-r.left,f=r.right-t.right,g=n.right-n.left,x=n.bottom-n.top;if(s&&d=x||m>t.top?u=e.bottom-t.top:(l="bottom",u=t.bottom-e.top)}return{style:`${l}: ${u}px; max-width: ${c}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":s?"left":"right")}}function qC(i){let t=i.addToOptions.slice();return i.icons&&t.push({render(e){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),e.type&&n.classList.add(...e.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),n.setAttribute("aria-hidden","true"),n},position:20}),t.push({render(e,n,r){let o=document.createElement("span");o.className="cm-completionLabel";let s=e.displayLabel||e.label,a=0;for(let l=0;la&&o.appendChild(document.createTextNode(s.slice(a,u)));let d=o.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(s.slice(u,c))),d.className="cm-completionMatchedText",a=c}return ae.position-n.position).map(e=>e.render)}function Cp(i,t,e){if(i<=e)return{from:0,to:i};if(t<0&&(t=0),t<=i>>1){let r=Math.floor(t/e);return{from:r*e,to:(r+1)*e}}let n=Math.floor((i-t)/e);return{from:i-(n+1)*e,to:i-n*e}}class VC{constructor(t,e,n){this.view=t,this.stateField=e,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let r=t.state.field(e),{options:o,selected:s}=r.open,a=t.state.facet(Li);this.optionContent=qC(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=Cp(o.length,s,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",l=>{for(let u=l.target,c;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(c=/-(\d+)$/.exec(u.id))&&+c[1]{let u=t.state.field(this.stateField,!1);u&&u.tooltip&&t.state.facet(Li).closeOnBlur&&l.relatedTarget!=t.contentDOM&&t.dispatch({effects:uo.of(null)})}),this.list=this.dom.appendChild(this.createListBox(o,r.id,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}mount(){this.updateSel()}update(t){var e,n,r;let o=t.state.field(this.stateField),s=t.startState.field(this.stateField);this.updateTooltipClass(t.state),o!=s&&(this.updateSel(),((e=o.open)===null||e===void 0?void 0:e.disabled)!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(!((r=o.open)===null||r===void 0)&&r.disabled)))}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of e.split(" "))n&&this.dom.classList.add(n);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=Cp(e.options.length,e.selected,this.view.state.facet(Li).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,t.id,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})),this.updateSelectedOption(e.selected)){this.destroyInfo();let{completion:n}=e.options[e.selected],{info:r}=n;if(!r)return;let o=typeof r=="string"?document.createTextNode(r):r(n);if(!o)return;"then"in o?o.then(s=>{s&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(s,n)}).catch(s=>Pi(this.view.state,s,"completion info")):this.addInfoPane(o,n)}}addInfoPane(t,e){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",t.nodeType!=null)n.appendChild(t),this.infoDestroy=null;else{let{dom:r,destroy:o}=t;n.appendChild(r),this.infoDestroy=o||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!="LI"||!n.id?r--:r==t?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),e=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected");return e&&HC(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=t.getBoundingClientRect(),o=this.space;if(!o){let s=this.dom.ownerDocument.defaultView||window;o={left:0,top:0,right:s.innerWidth,bottom:s.innerHeight}}return r.top>Math.min(o.bottom,e.bottom)-10||r.bottomn.from||n.from==0))if(o=f,typeof u!="string"&&u.header)r.appendChild(u.header(u));else{let g=r.appendChild(document.createElement("completion-section"));g.textContent=f}}const c=r.appendChild(document.createElement("li"));c.id=e+"-"+s,c.setAttribute("role","option");let d=this.optionClass(a);d&&(c.className=d);for(let f of this.optionContent){let g=f(a,this.view.state,l);g&&c.appendChild(g)}}return n.from&&r.classList.add("cm-completionListIncompleteTop"),n.tonew VC(e,i,t)}function HC(i,t){let e=i.getBoundingClientRect(),n=t.getBoundingClientRect();n.tope.bottom&&(i.scrollTop+=n.bottom-e.bottom)}function Pp(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function JC(i,t){let e=[],n=null,r=l=>{e.push(l);let{section:u}=l.completion;if(u){n||(n=[]);let c=typeof u=="string"?u:u.name;n.some(d=>d.name==c)||n.push(typeof u=="string"?{name:c}:u)}};for(let l of i)if(l.hasResult()){let u=l.result.getMatch;if(l.result.filter===!1)for(let c of l.result.options)r(new bp(c,l.source,u?u(c):[],1e9-e.length));else{let c=new zC(t.sliceDoc(l.from,l.to));for(let d of l.result.options)if(c.match(d.label)){let f=d.displayLabel?u?u(d,c.matched):[]:c.matched;r(new bp(d,l.source,f,c.score+(d.boost||0)))}}}if(n){let l=Object.create(null),u=0,c=(d,f)=>{var g,x;return((g=d.rank)!==null&&g!==void 0?g:1e9)-((x=f.rank)!==null&&x!==void 0?x:1e9)||(d.namec.score-u.score||a(u.completion,c.completion))){let u=l.completion;!s||s.label!=u.label||s.detail!=u.detail||s.type!=null&&u.type!=null&&s.type!=u.type||s.apply!=u.apply||s.boost!=u.boost?o.push(l):Pp(l.completion)>Pp(s)&&(o[o.length-1]=l),s=l.completion}return o}class qr{constructor(t,e,n,r,o,s){this.options=t,this.attrs=e,this.tooltip=n,this.timestamp=r,this.selected=o,this.disabled=s}setSelected(t,e){return t==this.selected||t>=this.options.length?this:new qr(this.options,kp(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,n,r,o){let s=JC(t,e);if(!s.length)return r&&t.some(l=>l.state==1)?new qr(r.options,r.attrs,r.tooltip,r.timestamp,r.selected,!0):null;let a=e.facet(Li).selectOnOpen?0:-1;if(r&&r.selected!=a&&r.selected!=-1){let l=r.options[r.selected].completion;for(let u=0;uu.hasResult()?Math.min(l,u.from):l,1e8),create:GC(Mi,gy),above:o.aboveCursor},r?r.timestamp:Date.now(),a,!1)}map(t){return new qr(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class ol{constructor(t,e,n){this.active=t,this.id=e,this.open=n}static start(){return new ol(eP,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:e}=t,n=e.facet(Li),o=(n.override||e.languageDataAt("autocomplete",tr(e)).map(UC)).map(a=>(this.active.find(u=>u.source==a)||new Ci(a,this.active.some(u=>u.state!=0)?1:0)).update(t,n));o.length==this.active.length&&o.every((a,l)=>a==this.active[l])&&(o=this.active);let s=this.open;s&&t.docChanged&&(s=s.map(t.changes)),t.selection||o.some(a=>a.hasResult()&&t.changes.touchesRange(a.from,a.to))||!KC(o,this.active)?s=qr.build(o,e,this.id,s,n):s&&s.disabled&&!o.some(a=>a.state==1)&&(s=null),!s&&o.every(a=>a.state!=1)&&o.some(a=>a.hasResult())&&(o=o.map(a=>a.hasResult()?new Ci(a.source,0):a));for(let a of t.effects)a.is(my)&&(s=s&&s.setSelected(a.value,this.id));return o==this.active&&s==this.open?this:new ol(o,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:tP}}function KC(i,t){if(i==t)return!0;for(let e=0,n=0;;){for(;e-1&&(e["aria-activedescendant"]=i+"-"+t),e}const eP=[];function pc(i){return i.isUserEvent("input.type")?"input":i.isUserEvent("delete.backward")?"delete":null}class Ci{constructor(t,e,n=-1){this.source=t,this.state=e,this.explicitPos=n}hasResult(){return!1}update(t,e){let n=pc(t),r=this;n?r=r.handleUserEvent(t,n,e):t.docChanged?r=r.handleChange(t):t.selection&&r.state!=0&&(r=new Ci(r.source,0));for(let o of t.effects)if(o.is(cf))r=new Ci(r.source,1,o.value?tr(t.state):-1);else if(o.is(uo))r=new Ci(r.source,0);else if(o.is(py))for(let s of o.value)s.source==r.source&&(r=s);return r}handleUserEvent(t,e,n){return e=="delete"||!n.activateOnTyping?this.map(t.changes):new Ci(this.source,1)}handleChange(t){return t.changes.touchesRange(tr(t.startState))?new Ci(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new Ci(this.source,this.state,t.mapPos(this.explicitPos))}}class ts extends Ci{constructor(t,e,n,r,o){super(t,2,e),this.result=n,this.from=r,this.to=o}hasResult(){return!0}handleUserEvent(t,e,n){var r;let o=t.changes.mapPos(this.from),s=t.changes.mapPos(this.to,1),a=tr(t.state);if((this.explicitPos<0?a<=o:as||e=="delete"&&tr(t.startState)==this.from)return new Ci(this.source,e=="input"&&n.activateOnTyping?1:0);let l=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos),u;return iP(this.result.validFor,t.state,o,s)?new ts(this.source,l,this.result,o,s):this.result.update&&(u=this.result.update(this.result,o,s,new uy(t.state,a,l>=0)))?new ts(this.source,l,u,u.from,(r=u.to)!==null&&r!==void 0?r:tr(t.state)):new Ci(this.source,1,l)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new Ci(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new ts(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}function iP(i,t,e,n){if(!i)return!1;let r=t.sliceDoc(e,n);return typeof i=="function"?i(r,e,n,t):fy(i,!0).test(r)}const py=re.define({map(i,t){return i.map(e=>e.map(t))}}),my=re.define(),Mi=ti.define({create(){return ol.start()},update(i,t){return i.update(t)},provide:i=>[Xc.from(i,t=>t.tooltip),Rt.contentAttributes.from(i,t=>t.attrs)]});function gy(i,t){const e=t.completion.apply||t.completion.label;let n=i.state.field(Mi).active.find(r=>r.source==t.source);return n instanceof ts?(typeof e=="string"?i.dispatch(Object.assign(Object.assign({},WC(i.state,e,n.from,n.to)),{annotations:dy.of(t.completion)})):e(i,t.completion,n.from,n.to),!0):!1}function ua(i,t="option"){return e=>{let n=e.state.field(Mi,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+r*(i?1:-1):i?0:s-1;return a<0?a=t=="page"?0:s-1:a>=s&&(a=t=="page"?s-1:0),e.dispatch({effects:my.of(a)}),!0}}const nP=i=>{let t=i.state.field(Mi,!1);return i.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampi.state.field(Mi,!1)?(i.dispatch({effects:cf.of(!0)}),!0):!1,sP=i=>{let t=i.state.field(Mi,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(i.dispatch({effects:uo.of(null)}),!0)};class oP{constructor(t,e){this.active=t,this.context=e,this.time=Date.now(),this.updates=[],this.done=void 0}}const Lp=50,aP=50,lP=1e3,hP=Fe.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let t of i.state.field(Mi).active)t.state==1&&this.startQuery(t)}update(i){let t=i.state.field(Mi);if(!i.selectionSet&&!i.docChanged&&i.startState.field(Mi)==t)return;let e=i.transactions.some(n=>(n.selection||n.docChanged)&&!pc(n));for(let n=0;naP&&Date.now()-r.time>lP){for(let o of r.context.abortListeners)try{o()}catch(s){Pi(this.view.state,s)}r.context.abortListeners=null,this.running.splice(n--,1)}else r.updates.push(...i.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=t.active.some(n=>n.state==1&&!this.running.some(r=>r.active.source==n.source))?setTimeout(()=>this.startUpdate(),Lp):-1,this.composing!=0)for(let n of i.transactions)pc(n)=="input"?this.composing=2:this.composing==2&&n.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:i}=this.view,t=i.field(Mi);for(let e of t.active)e.state==1&&!this.running.some(n=>n.active.source==e.source)&&this.startQuery(e)}startQuery(i){let{state:t}=this.view,e=tr(t),n=new uy(t,e,i.explicitPos==e),r=new oP(i,n);this.running.push(r),Promise.resolve(i.source(n)).then(o=>{r.context.aborted||(r.done=o||null,this.scheduleAccept())},o=>{this.view.dispatch({effects:uo.of(null)}),Pi(this.view.state,o)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),Lp))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],e=this.view.state.facet(Li);for(let n=0;ns.source==r.active.source);if(o&&o.state==1)if(r.done==null){let s=new Ci(r.active.source,0);for(let a of r.updates)s=s.update(a,e);s.state!=1&&t.push(s)}else this.startQuery(o)}t.length&&this.view.dispatch({effects:py.of(t)})}},{eventHandlers:{blur(i){let t=this.view.state.field(Mi,!1);if(t&&t.tooltip&&this.view.state.facet(Li).closeOnBlur){let e=t.open&&qg(this.view,t.open.tooltip);(!e||!e.dom.contains(i.relatedTarget))&&this.view.dispatch({effects:uo.of(null)})}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:cf.of(!1)}),20),this.composing=0}}}),vy=Rt.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class uP{constructor(t,e,n,r){this.field=t,this.line=e,this.from=n,this.to=r}}class ff{constructor(t,e,n){this.field=t,this.from=e,this.to=n}map(t){let e=t.mapPos(this.from,-1,Je.TrackDel),n=t.mapPos(this.to,1,Je.TrackDel);return e==null||n==null?null:new ff(this.field,e,n)}}class df{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let n=[],r=[e],o=t.doc.lineAt(e),s=/^\s*/.exec(o.text)[0];for(let l of this.lines){if(n.length){let u=s,c=/^\t*/.exec(l)[0].length;for(let d=0;dnew ff(l.field,r[l.line]+l.from,r[l.line]+l.to));return{text:n,ranges:a}}static parse(t){let e=[],n=[],r=[],o;for(let s of t.split(/\r\n?|\n/)){for(;o=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(s);){let a=o[1]?+o[1]:null,l=o[2]||o[3]||"",u=-1;for(let c=0;c=u&&d.field++}r.push(new uP(u,n.length,o.index,o.index+l.length)),s=s.slice(0,o.index)+l+s.slice(o.index+o[0].length)}for(let a;a=/\\([{}])/.exec(s);){s=s.slice(0,a.index)+a[1]+s.slice(a.index+a[0].length);for(let l of r)l.line==n.length&&l.from>a.index&&(l.from--,l.to--)}n.push(s)}return new df(n,r)}}let cP=Gt.widget({widget:new class extends Mn{toDOM(){let i=document.createElement("span");return i.className="cm-snippetFieldPosition",i}ignoreEvent(){return!1}}}),fP=Gt.mark({class:"cm-snippetField"});class Os{constructor(t,e){this.ranges=t,this.active=e,this.deco=Gt.set(t.map(n=>(n.from==n.to?cP:fP).range(n.from,n.to)))}map(t){let e=[];for(let n of this.ranges){let r=n.map(t);if(!r)return null;e.push(r)}return new Os(e,this.active)}selectionInsideField(t){return t.ranges.every(e=>this.ranges.some(n=>n.field==this.active&&n.from<=e.from&&n.to>=e.to))}}const ko=re.define({map(i,t){return i&&i.map(t)}}),dP=re.define(),co=ti.define({create(){return null},update(i,t){for(let e of t.effects){if(e.is(ko))return e.value;if(e.is(dP)&&i)return new Os(i.ranges,e.value)}return i&&t.docChanged&&(i=i.map(t.changes)),i&&t.selection&&!i.selectionInsideField(t.selection)&&(i=null),i},provide:i=>Rt.decorations.from(i,t=>t?t.deco:Gt.none)});function pf(i,t){return yt.create(i.filter(e=>e.field==t).map(e=>yt.range(e.from,e.to)))}function pP(i){let t=df.parse(i);return(e,n,r,o)=>{let{text:s,ranges:a}=t.instantiate(e.state,r),l={changes:{from:r,to:o,insert:we.of(s)},scrollIntoView:!0,annotations:n?dy.of(n):void 0};if(a.length&&(l.selection=pf(a,0)),a.length>1){let u=new Os(a,0),c=l.effects=[ko.of(u)];e.state.field(co,!1)===void 0&&c.push(re.appendConfig.of([co,OP,_P,vy]))}e.dispatch(e.state.update(l))}}function yy(i){return({state:t,dispatch:e})=>{let n=t.field(co,!1);if(!n||i<0&&n.active==0)return!1;let r=n.active+i,o=i>0&&!n.ranges.some(s=>s.field==r+i);return e(t.update({selection:pf(n.ranges,r),effects:ko.of(o?null:new Os(n.ranges,r))})),!0}}const mP=({state:i,dispatch:t})=>i.field(co,!1)?(t(i.update({effects:ko.of(null)})),!0):!1,gP=yy(1),vP=yy(-1),yP=[{key:"Tab",run:gP,shift:vP},{key:"Escape",run:mP}],Ap=Zt.define({combine(i){return i.length?i[0]:yP}}),OP=lr.highest(wo.compute([Ap],i=>i.facet(Ap)));function Si(i,t){return Object.assign(Object.assign({},t),{apply:pP(i)})}const _P=Rt.domEventHandlers({mousedown(i,t){let e=t.state.field(co,!1),n;if(!e||(n=t.posAtCoords({x:i.clientX,y:i.clientY}))==null)return!1;let r=e.ranges.find(o=>o.from<=n&&o.to>=n);return!r||r.field==e.active?!1:(t.dispatch({selection:pf(e.ranges,r.field),effects:ko.of(e.ranges.some(o=>o.field>r.field)?new Os(e.ranges,r.field):null)}),!0)}}),fo={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Or=re.define({map(i,t){let e=t.mapPos(i,-1,Je.TrackAfter);return e??void 0}}),mf=new class extends kr{};mf.startSide=1;mf.endSide=-1;const Oy=ti.define({create(){return ge.empty},update(i,t){if(t.selection){let e=t.state.doc.lineAt(t.selection.main.head).from,n=t.startState.doc.lineAt(t.startState.selection.main.head).from;e!=t.changes.mapPos(n,-1)&&(i=ge.empty)}i=i.map(t.changes);for(let e of t.effects)e.is(Or)&&(i=i.update({add:[mf.range(e.value,e.value+1)]}));return i}});function xP(){return[wP,Oy]}const Wh="()[]{}<>";function _y(i){for(let t=0;t{if((bP?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let r=i.state.selection.main;if(n.length>2||n.length==2&&Yi(ai(n,0))==1||t!=r.from||e!=r.to)return!1;let o=PP(i.state,n);return o?(i.dispatch(o),!0):!1}),SP=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let n=xy(i,i.selection.main.head).brackets||fo.brackets,r=null,o=i.changeByRange(s=>{if(s.empty){let a=kP(i.doc,s.head);for(let l of n)if(l==a&&Xl(i.doc,s.head)==_y(ai(l,0)))return{changes:{from:s.head-l.length,to:s.head+l.length},range:yt.cursor(s.head-l.length)}}return{range:r=s}});return r||t(i.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},CP=[{key:"Backspace",run:SP}];function PP(i,t){let e=xy(i,i.selection.main.head),n=e.brackets||fo.brackets;for(let r of n){let o=_y(ai(r,0));if(t==r)return o==r?EP(i,r,n.indexOf(r+r+r)>-1,e):LP(i,r,o,e.before||fo.before);if(t==o&&by(i,i.selection.main.from))return AP(i,r,o)}return null}function by(i,t){let e=!1;return i.field(Oy).between(0,i.doc.length,n=>{n==t&&(e=!0)}),e}function Xl(i,t){let e=i.sliceString(t,t+2);return e.slice(0,Yi(ai(e,0)))}function kP(i,t){let e=i.sliceString(t-2,t);return Yi(ai(e,0))==e.length?e:e.slice(1)}function LP(i,t,e,n){let r=null,o=i.changeByRange(s=>{if(!s.empty)return{changes:[{insert:t,from:s.from},{insert:e,from:s.to}],effects:Or.of(s.to+t.length),range:yt.range(s.anchor+t.length,s.head+t.length)};let a=Xl(i.doc,s.head);return!a||/\s/.test(a)||n.indexOf(a)>-1?{changes:{insert:t+e,from:s.head},effects:Or.of(s.head+t.length),range:yt.cursor(s.head+t.length)}:{range:r=s}});return r?null:i.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function AP(i,t,e){let n=null,r=i.changeByRange(o=>o.empty&&Xl(i.doc,o.head)==e?{changes:{from:o.head,to:o.head+e.length,insert:e},range:yt.cursor(o.head+e.length)}:n={range:o});return n?null:i.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function EP(i,t,e,n){let r=n.stringPrefixes||fo.stringPrefixes,o=null,s=i.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:t,from:a.to}],effects:Or.of(a.to+t.length),range:yt.range(a.anchor+t.length,a.head+t.length)};let l=a.head,u=Xl(i.doc,l),c;if(u==t){if(Ep(i,l))return{changes:{insert:t+t,from:l},effects:Or.of(l+t.length),range:yt.cursor(l+t.length)};if(by(i,l)){let f=e&&i.sliceDoc(l,l+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:l,to:l+f.length,insert:f},range:yt.cursor(l+f.length)}}}else{if(e&&i.sliceDoc(l-2*t.length,l)==t+t&&(c=Dp(i,l-2*t.length,r))>-1&&Ep(i,c))return{changes:{insert:t+t+t+t,from:l},effects:Or.of(l+t.length),range:yt.cursor(l+t.length)};if(i.charCategorizer(l)(u)!=Ne.Word&&Dp(i,l,r)>-1&&!DP(i,l,t,r))return{changes:{insert:t+t,from:l},effects:Or.of(l+t.length),range:yt.cursor(l+t.length)}}return{range:o=a}});return o?null:i.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Ep(i,t){let e=Ye(i).resolveInner(t+1);return e.parent&&e.from==t}function DP(i,t,e,n){let r=Ye(i).resolveInner(t,-1),o=n.reduce((s,a)=>Math.max(s,a.length),0);for(let s=0;s<5;s++){let a=i.sliceDoc(r.from,Math.min(r.to,r.from+e.length+o)),l=a.indexOf(e);if(!l||l>-1&&n.indexOf(a.slice(0,l))>-1){let c=r.firstChild;for(;c&&c.from==r.from&&c.to-c.from>e.length+l;){if(i.sliceDoc(c.to-e.length,c.to)==e)return!1;c=c.firstChild}return!0}let u=r.to==t&&r.parent;if(!u)break;r=u}return!1}function Dp(i,t,e){let n=i.charCategorizer(t);if(n(i.sliceDoc(t-1,t))!=Ne.Word)return t;for(let r of e){let o=t-r.length;if(i.sliceDoc(o,t)==r&&n(i.sliceDoc(o-1,o))!=Ne.Word)return o}return-1}function TP(i={}){return[Mi,Li.of(i),hP,IP,vy]}const wy=[{key:"Ctrl-Space",run:rP},{key:"Escape",run:sP},{key:"ArrowDown",run:ua(!0)},{key:"ArrowUp",run:ua(!1)},{key:"PageDown",run:ua(!0,"page")},{key:"PageUp",run:ua(!1,"page")},{key:"Enter",run:nP}],IP=lr.highest(wo.computeN([Li],i=>i.facet(Li).defaultKeymap?[wy]:[]));class MP{constructor(t,e,n){this.from=t,this.to=e,this.diagnostic=n}}class gr{constructor(t,e,n){this.diagnostics=t,this.panel=e,this.selected=n}static init(t,e,n){let r=t,o=n.facet(Py).markerFilter;o&&(r=o(r));let s=Gt.set(r.map(a=>a.from==a.to||a.from==a.to-1&&n.doc.lineAt(a.from).to==a.from?Gt.widget({widget:new ZP(a),diagnostic:a}).range(a.from):Gt.mark({attributes:{class:"cm-lintRange cm-lintRange-"+a.severity+(a.markClass?" "+a.markClass:"")},diagnostic:a}).range(a.from,a.to)),!0);return new gr(s,e,ps(s))}}function ps(i,t=null,e=0){let n=null;return i.between(e,1e9,(r,o,{spec:s})=>{if(!(t&&s.diagnostic!=t))return n=new MP(r,o,s.diagnostic),!1}),n}function $P(i,t){let e=i.startState.doc.lineAt(t.pos);return!!(i.effects.some(n=>n.is(Sy))||i.changes.touchesRange(e.from,e.to))}function QP(i,t){return i.field(Qi,!1)?t:t.concat(re.appendConfig.of(zP))}const Sy=re.define(),gf=re.define(),Cy=re.define(),Qi=ti.define({create(){return new gr(Gt.none,null,null)},update(i,t){if(t.docChanged){let e=i.diagnostics.map(t.changes),n=null;if(i.selected){let r=t.changes.mapPos(i.selected.from,1);n=ps(e,i.selected.diagnostic,r)||ps(e,null,r)}i=new gr(e,i.panel,n)}for(let e of t.effects)e.is(Sy)?i=gr.init(e.value,i.panel,t.state):e.is(gf)?i=new gr(i.diagnostics,e.value?Rl.open:null,i.selected):e.is(Cy)&&(i=new gr(i.diagnostics,i.panel,e.value));return i},provide:i=>[Dr.from(i,t=>t.panel),Rt.decorations.from(i,t=>t.diagnostics)]}),NP=Gt.mark({class:"cm-lintRange cm-lintRange-active"});function BP(i,t,e){let{diagnostics:n}=i.state.field(Qi),r=[],o=2e8,s=0;n.between(t-(e<0?1:0),t+(e>0?1:0),(l,u,{spec:c})=>{t>=l&&t<=u&&(l==u||(t>l||e>0)&&(tLy(i,e,!1)))}const XP=i=>{let t=i.state.field(Qi,!1);(!t||!t.panel)&&i.dispatch({effects:QP(i.state,[gf.of(!0)])});let e=ao(i,Rl.open);return e&&e.dom.querySelector(".cm-panel-lint ul").focus(),!0},Tp=i=>{let t=i.state.field(Qi,!1);return!t||!t.panel?!1:(i.dispatch({effects:gf.of(!1)}),!0)},RP=i=>{let t=i.state.field(Qi,!1);if(!t)return!1;let e=i.state.selection.main,n=t.diagnostics.iter(e.to+1);return!n.value&&(n=t.diagnostics.iter(0),!n.value||n.from==e.from&&n.to==e.to)?!1:(i.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)},YP=[{key:"Mod-Shift-m",run:XP,preventDefault:!0},{key:"F8",run:RP}],Py=Zt.define({combine(i){return Object.assign({sources:i.map(t=>t.source)},xn(i.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(t,e)=>t?e?n=>t(n)||e(n):t:e}))}});function ky(i){let t=[];if(i)t:for(let{name:e}of i){for(let n=0;no.toLowerCase()==r.toLowerCase())){t.push(r);continue t}}t.push("")}return t}function Ly(i,t,e){var n;let r=e?ky(t.actions):[];return Ie("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},Ie("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage():t.message),(n=t.actions)===null||n===void 0?void 0:n.map((o,s)=>{let a=!1,l=f=>{if(f.preventDefault(),a)return;a=!0;let g=ps(i.state.field(Qi).diagnostics,t);g&&o.apply(i,g.from,g.to)},{name:u}=o,c=r[s]?u.indexOf(r[s]):-1,d=c<0?u:[u.slice(0,c),Ie("u",u.slice(c,c+1)),u.slice(c+1)];return Ie("button",{type:"button",class:"cm-diagnosticAction",onclick:l,onmousedown:l,"aria-label":` Action: ${u}${c<0?"":` (access key "${r[s]})"`}.`},d)}),t.source&&Ie("div",{class:"cm-diagnosticSource"},t.source))}class ZP extends Mn{constructor(t){super(),this.diagnostic=t}eq(t){return t.diagnostic==this.diagnostic}toDOM(){return Ie("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class Ip{constructor(t,e){this.diagnostic=e,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Ly(t,e,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Rl{constructor(t){this.view=t,this.items=[];let e=r=>{if(r.keyCode==27)Tp(this.view),this.view.focus();else if(r.keyCode==38||r.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(r.keyCode==40||r.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(r.keyCode==36)this.moveSelection(0);else if(r.keyCode==35)this.moveSelection(this.items.length-1);else if(r.keyCode==13)this.view.focus();else if(r.keyCode>=65&&r.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:o}=this.items[this.selectedIndex],s=ky(o.actions);for(let a=0;a{for(let o=0;oTp(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(Qi).selected;if(!t)return-1;for(let e=0;e{let u=-1,c;for(let d=n;dn&&(this.items.splice(n,u-n),r=!0)),e&&c.diagnostic==e.diagnostic?c.dom.hasAttribute("aria-selected")||(c.dom.setAttribute("aria-selected","true"),o=c):c.dom.hasAttribute("aria-selected")&&c.dom.removeAttribute("aria-selected"),n++});n({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:s,panel:a})=>{s.topa.bottom&&(this.list.scrollTop+=s.bottom-a.bottom)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let t=this.list.firstChild;function e(){let n=t;t=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;t!=n.dom;)e();t=n.dom.nextSibling}else this.list.insertBefore(n.dom,t);for(;t;)e()}moveSelection(t){if(this.selectedIndex<0)return;let e=this.view.state.field(Qi),n=ps(e.diagnostics,this.items[t].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:Cy.of(n)})}static open(t){return new Rl(t)}}function WP(i,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(i)}')`}function ca(i){return WP(``,'width="6" height="3"')}const UP=Rt.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:ca("#d11")},".cm-lintRange-warning":{backgroundImage:ca("orange")},".cm-lintRange-info":{backgroundImage:ca("#999")},".cm-lintRange-hint":{backgroundImage:ca("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}}),zP=[Qi,Rt.decorations.compute([Qi],i=>{let{selected:t,panel:e}=i.field(Qi);return!t||!e||t.from==t.to?Gt.none:Gt.set([NP.range(t.from,t.to)])}),Rb(BP,{hideOn:$P}),UP],jP=(()=>[Gb(),Kb(),yb(),yS(),Yw(),ab(),fb(),ye.allowMultipleSelections.of(!0),Aw(),Ww(jw,{fallback:!0}),tS(),xP(),TP(),Eb(),Ib(),Sb(),OC(),wo.of([...CP,...dC,...BC,...kS,...Bw,...wy,...YP])])();class al{constructor(t,e,n,r,o,s,a,l,u,c=0,d){this.p=t,this.stack=e,this.state=n,this.reducePos=r,this.pos=o,this.score=s,this.buffer=a,this.bufferBase=l,this.curContext=u,this.lookAhead=c,this.parent=d}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,n=0){let r=t.parser.context;return new al(t,[],e,n,n,0,[],0,r?new Mp(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let n=t>>19,r=t&65535,{parser:o}=this.p,s=o.dynamicPrecedence(r);if(s&&(this.score+=s),n==0){this.pushState(o.getGoto(this.state,r,!0),this.reducePos),r=2e3&&!(!((e=this.p.parser.nodeSet.types[r])===null||e===void 0)&&e.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(r,l)}storeNode(t,e,n,r=4,o=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&s.buffer[a-4]==0&&s.buffer[a-1]>-1){if(e==n)return;if(s.buffer[a-2]>=e){s.buffer[a-2]=n;return}}}if(!o||this.pos==n)this.buffer.push(t,e,n,r);else{let s=this.buffer.length;if(s>0&&this.buffer[s-4]!=0)for(;s>0&&this.buffer[s-2]>n;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,r>4&&(r-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=n,this.buffer[s+3]=r}}shift(t,e,n){let r=this.pos;if(t&131072)this.pushState(t&65535,this.pos);else if(t&262144)this.pos=n,this.shiftContext(e,r),e<=this.p.parser.maxNode&&this.buffer.push(e,r,n,4);else{let o=t,{parser:s}=this.p;(n>this.pos||e<=s.maxNode)&&(this.pos=n,s.stateFlag(o,1)||(this.reducePos=n)),this.pushState(o,r),this.shiftContext(e,r),e<=s.maxNode&&this.buffer.push(e,r,n,4)}}apply(t,e,n){t&65536?this.reduce(t):this.shift(t,e,n)}useNode(t,e){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=t)&&(this.p.reused.push(t),n++);let r=this.pos;this.reducePos=this.pos=r+t.length,this.pushState(e,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let n=t.buffer.slice(e),r=t.bufferBase+e;for(;t&&r==t.bufferBase;)t=t.parent;return new al(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let n=t<=this.p.parser.maxNode;n&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,n?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new qP(this);;){let n=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(n==0)return!1;if(!(n&65536))return!0;e.reduce(n)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let r=[];for(let o=0,s;ol&1&&a==s)||r.push(e[o],s)}e=r}let n=[];for(let r=0;r>19,r=e&65535,o=this.stack.length-n*3;if(o<0||t.getGoto(this.stack[o],r,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;e=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],n=(r,o)=>{if(!e.includes(r))return e.push(r),t.allActions(r,s=>{if(!(s&393216))if(s&65536){let a=(s>>19)-o;if(a>1){let l=s&65535,u=this.stack.length-a*3;if(u>=0&&t.getGoto(this.stack[u],l,!1)>=0)return a<<19|65536|l}}else{let a=n(s,o+1);if(a!=null)return a}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Mp{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class qP{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,n=t>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=r}}class ll{constructor(t,e,n){this.stack=t,this.pos=e,this.index=n,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new ll(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new ll(this.stack,this.pos,this.index)}}function Rs(i,t=Uint16Array){if(typeof i!="string")return i;let e=null;for(let n=0,r=0;n=92&&s--,s>=34&&s--;let l=s-32;if(l>=46&&(l-=46,a=!0),o+=l,a)break;o*=46}e?e[r++]=o:e=new t(o)}return e}class Ma{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const $p=new Ma;class VP{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=$p,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let n=this.range,r=this.rangeIndex,o=this.pos+t;for(;on.to:o>=n.to;){if(r==this.ranges.length-1)return null;let s=this.ranges[++r];o+=s.from-n.to,n=s}return o}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,n,r;if(e>=0&&e=this.chunk2Pos&&na.to&&(this.chunk2=this.chunk2.slice(0,a.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(t,e=0){let n=e?this.resolveOffset(e,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=$p,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let n="";for(let r of this.ranges){if(r.from>=e)break;r.to>t&&(n+=this.input.read(Math.max(r.from,t),Math.min(r.to,e)))}return n}}class es{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:n}=e.p;Ay(this.data,t,e,this.id,n.data,n.tokenPrecTable)}}es.prototype.contextual=es.prototype.fallback=es.prototype.extend=!1;class mc{constructor(t,e,n){this.precTable=e,this.elseToken=n,this.data=typeof t=="string"?Rs(t):t}token(t,e){let n=t.pos,r=0;for(;;){let o=t.next<0,s=t.resolveOffset(1,1);if(Ay(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(o||r++,s==null)break;t.reset(s,t.token)}r&&(t.reset(n,t.token),t.acceptToken(this.elseToken,r))}}mc.prototype.contextual=es.prototype.fallback=es.prototype.extend=!1;class vf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function Ay(i,t,e,n,r,o){let s=0,a=1<0){let x=i[g];if(l.allows(x)&&(t.token.value==-1||t.token.value==x||GP(x,t.token.value,r,o))){t.acceptToken(x);break}}let c=t.next,d=0,f=i[s+2];if(t.next<0&&f>d&&i[u+f*3-3]==65535&&i[u+f*3-3]==65535){s=i[u+f*3-1];continue t}for(;d>1,x=u+g+(g<<1),m=i[x],v=i[x+1]||65536;if(c=v)d=g+1;else{s=i[x+2],t.advance();continue t}}break}}function Qp(i,t,e){for(let n=t,r;(r=i[n])!=65535;n++)if(r==e)return n-t;return-1}function GP(i,t,e,n){let r=Qp(e,n,t);return r<0||Qp(e,n,i)t)&&!n.type.isError)return e<0?Math.max(0,Math.min(n.to-1,t-25)):Math.min(i.length,Math.max(n.from+1,t+25));if(e<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return e<0?0:i.length}}class HP{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?Np(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?Np(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=s,null;if(o instanceof Re){if(s==t){if(s=Math.max(this.safeFrom,t)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[e]++,this.nextStart=s+o.length}}}class JP{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(n=>new Ma)}getActions(t){let e=0,n=null,{parser:r}=t.p,{tokenizers:o}=r,s=r.stateSlot(t.state,3),a=t.curContext?t.curContext.hash:0,l=0;for(let u=0;ud.end+25&&(l=Math.max(d.lookAhead,l)),d.value!=0)){let f=e;if(d.extended>-1&&(e=this.addActions(t,d.extended,d.end,e)),e=this.addActions(t,d.value,d.end,e),!c.extend&&(n=d,e>f))break}}for(;this.actions.length>e;)this.actions.pop();return l&&t.setLookAhead(l),!n&&t.pos==this.stream.end&&(n=new Ma,n.value=t.p.parser.eofTerm,n.start=n.end=t.pos,e=this.addActions(t,n.value,n.end,e)),this.mainToken=n,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Ma,{pos:n,p:r}=t;return e.start=n,e.end=Math.min(n+1,r.stream.end),e.value=n==r.stream.end?r.parser.eofTerm:0,e}updateCachedToken(t,e,n){let r=this.stream.clipPos(n.pos);if(e.token(this.stream.reset(r,t),n),t.value>-1){let{parser:o}=n.p;for(let s=0;s=0&&n.p.parser.dialect.allows(a>>1)){a&1?t.extended=a>>1:t.value=a>>1;break}}}else t.value=0,t.end=this.stream.clipPos(r+1)}putAction(t,e,n,r){for(let o=0;ot.bufferLength*4?new HP(n,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,n=this.stacks=[],r,o;if(this.bigReductionCount>300&&t.length==1){let[s]=t;for(;s.forceReduce()&&s.stack.length&&s.stack[s.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;se)n.push(a);else{if(this.advanceStack(a,n,t))continue;{r||(r=[],o=[]),r.push(a);let l=this.tokens.getMainToken(a);o.push(l.value,l.end)}}break}}if(!n.length){let s=r&&i2(r);if(s)return Ti&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw Ti&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&r){let s=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,o,n);if(s)return Ti&&console.log("Force-finish "+this.stackID(s)),this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(n.length>s)for(n.sort((a,l)=>l.score-a.score);n.length>s;)n.pop();n.some(a=>a.reducePos>e)&&this.recovering--}else if(n.length>1){t:for(let s=0;s500&&u.buffer.length>500)if((a.score-u.score||a.buffer.length-u.buffer.length)>0)n.splice(l--,1);else{n.splice(s--,1);continue t}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let s=1;s ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let u=t.curContext&&t.curContext.tracker.strict,c=u?t.curContext.hash:0;for(let d=this.fragments.nodeAt(r);d;){let f=this.parser.nodeSet.types[d.type.id]==d.type?o.getGoto(t.state,d.type.id):-1;if(f>-1&&d.length&&(!u||(d.prop(ce.contextHash)||0)==c))return t.useNode(d,f),Ti&&console.log(s+this.stackID(t)+` (via reuse of ${o.getName(d.type.id)})`),!0;if(!(d instanceof Re)||d.children.length==0||d.positions[0]>0)break;let g=d.children[0];if(g instanceof Re&&d.positions[0]==0)d=g;else break}}let a=o.stateSlot(t.state,4);if(a>0)return t.reduce(a),Ti&&console.log(s+this.stackID(t)+` (via always-reduce ${o.getName(a&65535)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let l=this.tokens.getActions(t);for(let u=0;ur?e.push(x):n.push(x)}return!1}advanceFully(t,e){let n=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>n)return Bp(t,e),!0}}runRecovery(t,e,n){let r=null,o=!1;for(let s=0;s ":"";if(a.deadEnd&&(o||(o=!0,a.restart(),Ti&&console.log(c+this.stackID(a)+" (restarted)"),this.advanceFully(a,n))))continue;let d=a.split(),f=c;for(let g=0;d.forceReduce()&&g<10&&(Ti&&console.log(f+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,n));g++)Ti&&(f=this.stackID(d)+" -> ");for(let g of a.recoverByInsert(l))Ti&&console.log(c+this.stackID(g)+" (via recover-insert)"),this.advanceFully(g,n);this.stream.end>a.pos?(u==a.pos&&(u++,l=0),a.recoverByDelete(l,u),Ti&&console.log(c+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),Bp(a,n)):(!r||r.scorei;class e2{constructor(t){this.start=t.start,this.shift=t.shift||zh,this.reduce=t.reduce||zh,this.reuse=t.reuse||zh,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class hl extends iv{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let a=0;at.topRules[a][1]),r=[];for(let a=0;a=0)o(c,l,a[u++]);else{let d=a[u+-c];for(let f=-c;f>0;f--)o(a[u++],l,d);u++}}}this.nodeSet=new Rc(e.map((a,l)=>Ei.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:r[l],top:n.indexOf(l)>-1,error:l==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(l)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=Jg;let s=Rs(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;atypeof a=="number"?new es(s,a):a),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,n){let r=new KP(this,t,e,n);for(let o of this.wrappers)r=o(r,t,e,n);return r}getGoto(t,e,n=!1){let r=this.goto;if(e>=r[0])return-1;for(let o=r[e+1];;){let s=r[o++],a=s&1,l=r[o++];if(a&&n)return l;for(let u=o+(s>>1);o0}validAction(t,e){return!!this.allActions(t,n=>n==e?!0:null)}allActions(t,e){let n=this.stateSlot(t,4),r=n?e(n):void 0;for(let o=this.stateSlot(t,1);r==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=kn(this.data,o+2);else break;r=e(kn(this.data,o+1))}return r}nextStates(t){let e=[];for(let n=this.stateSlot(t,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=kn(this.data,n+2);else break;if(!(this.data[n+2]&1)){let r=this.data[n+1];e.some((o,s)=>s&1&&o==r)||e.push(this.data[n],r)}}return e}configure(t){let e=Object.assign(Object.create(hl.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let n=this.topRules[t.top];if(!n)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=n}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(n=>{let r=t.tokenizers.find(o=>o.from==n);return r?r.to:n})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((n,r)=>{let o=t.specializers.find(a=>a.from==n.external);if(!o)return n;let s=Object.assign(Object.assign({},n),{external:o.to});return e.specializers[r]=Fp(s),s})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),n=e.map(()=>!1);if(t)for(let o of t.split(" ")){let s=e.indexOf(o);s>=0&&(n[s]=!0)}let r=null;for(let o=0;on)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.scorei.external(e,n)<<1|t}return i.get}const n2=304,Xp=1,r2=2,s2=305,o2=307,a2=308,l2=3,h2=4,u2=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],Ey=125,c2=59,Rp=47,f2=42,d2=43,p2=45,m2=new e2({start:!1,shift(i,t){return t==l2||t==h2||t==o2?i:t==a2},strict:!1}),g2=new vf((i,t)=>{let{next:e}=i;(e==Ey||e==-1||t.context)&&i.acceptToken(s2)},{contextual:!0,fallback:!0}),v2=new vf((i,t)=>{let{next:e}=i,n;u2.indexOf(e)>-1||e==Rp&&((n=i.peek(1))==Rp||n==f2)||e!=Ey&&e!=c2&&e!=-1&&!t.context&&i.acceptToken(n2)},{contextual:!0}),y2=new vf((i,t)=>{let{next:e}=i;if((e==d2||e==p2)&&(i.advance(),e==i.next)){i.advance();let n=!t.context&&t.canShift(Xp);i.acceptToken(n?Xp:r2)}},{contextual:!0}),O2=nv({"get set async static":mt.modifier,"for while do if else switch try catch finally return throw break continue default case":mt.controlKeyword,"in of await yield void typeof delete instanceof":mt.operatorKeyword,"let var const function class extends":mt.definitionKeyword,"import export from":mt.moduleKeyword,"with debugger as new":mt.keyword,TemplateString:mt.special(mt.string),super:mt.atom,BooleanLiteral:mt.bool,this:mt.self,null:mt.null,Star:mt.modifier,VariableName:mt.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":mt.function(mt.variableName),VariableDefinition:mt.definition(mt.variableName),Label:mt.labelName,PropertyName:mt.propertyName,PrivatePropertyName:mt.special(mt.propertyName),"CallExpression/MemberExpression/PropertyName":mt.function(mt.propertyName),"FunctionDeclaration/VariableDefinition":mt.function(mt.definition(mt.variableName)),"ClassDeclaration/VariableDefinition":mt.definition(mt.className),PropertyDefinition:mt.definition(mt.propertyName),PrivatePropertyDefinition:mt.definition(mt.special(mt.propertyName)),UpdateOp:mt.updateOperator,"LineComment Hashbang":mt.lineComment,BlockComment:mt.blockComment,Number:mt.number,String:mt.string,Escape:mt.escape,ArithOp:mt.arithmeticOperator,LogicOp:mt.logicOperator,BitOp:mt.bitwiseOperator,CompareOp:mt.compareOperator,RegExp:mt.regexp,Equals:mt.definitionOperator,Arrow:mt.function(mt.punctuation),": Spread":mt.punctuation,"( )":mt.paren,"[ ]":mt.squareBracket,"{ }":mt.brace,"InterpolationStart InterpolationEnd":mt.special(mt.brace),".":mt.derefOperator,", ;":mt.separator,"@":mt.meta,TypeName:mt.typeName,TypeDefinition:mt.definition(mt.typeName),"type enum interface implements namespace module declare":mt.definitionKeyword,"abstract global Privacy readonly override":mt.modifier,"is keyof unique infer":mt.operatorKeyword,JSXAttributeValue:mt.attributeValue,JSXText:mt.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":mt.angleBracket,"JSXIdentifier JSXNameSpacedName":mt.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":mt.attributeName,"JSXBuiltin/JSXIdentifier":mt.standard(mt.tagName)}),_2={__proto__:null,export:16,as:21,from:29,default:32,async:37,function:38,extends:48,this:52,true:60,false:60,null:72,void:76,typeof:80,super:98,new:132,delete:148,yield:157,await:161,class:166,public:223,private:223,protected:223,readonly:225,instanceof:244,satisfies:247,in:248,const:250,import:282,keyof:337,unique:341,infer:347,is:383,abstract:403,implements:405,type:407,let:410,var:412,using:415,interface:421,enum:425,namespace:431,module:433,declare:437,global:441,for:460,of:469,while:472,with:476,do:480,if:484,else:486,switch:490,case:496,try:502,catch:506,finally:510,return:514,throw:518,break:522,continue:526,debugger:530},x2={__proto__:null,async:119,get:121,set:123,declare:183,public:185,private:185,protected:185,static:187,abstract:189,override:191,readonly:197,accessor:199,new:387},b2={__proto__:null,"<":139},w2=hl.deserialize({version:14,states:"$6zO%TQUOOO%[QUOOO'_QWOOP(lOSOOO*zQ(CjO'#CgO+ROpO'#ChO+aO!bO'#ChO+oO07`O'#D[O.QQUO'#DbO.bQUO'#DmO%[QUO'#DwO0fQUO'#EPOOQ(CY'#EX'#EXO1PQSO'#EUOOQO'#Ej'#EjOOQO'#Id'#IdO1XQSO'#GlO1dQSO'#EiO1iQSO'#EiO3kQ(CjO'#JeO6[Q(CjO'#JfO6xQSO'#FXO6}Q#tO'#FpOOQ(CY'#Fa'#FaO7YO&jO'#FaO7hQ,UO'#FwO9OQSO'#FvOOQ(CY'#Jf'#JfOOQ(CW'#Je'#JeO9TQSO'#GpOOQQ'#KQ'#KQO9`QSO'#IQO9eQ(C[O'#IROOQQ'#JR'#JROOQQ'#IV'#IVQ`QUOOO`QUOOO%[QUO'#DoO9mQUO'#D{O9tQUO'#D}O9ZQSO'#GlO9{Q,UO'#CmO:ZQSO'#EhO:fQSO'#EsO:kQ,UO'#F`O;YQSO'#GlOOQO'#KR'#KRO;_QSO'#KRO;mQSO'#GtO;mQSO'#GuO;mQSO'#GwO9ZQSO'#GzO]QSO'#HZO>eQSO'#HaO>eQSO'#HcO`QUO'#HeO>eQSO'#HgO>eQSO'#HjO>jQSO'#HpO>oQ(C]O'#HvO%[QUO'#HxO>zQ(C]O'#HzO?VQ(C]O'#H|O9eQ(C[O'#IOO?bQ(CjO'#CgO@dQWO'#DgQOQSOOO%[QUO'#D}O@zQSO'#EQO9{Q,UO'#EhOAVQSO'#EhOAbQ`O'#F`OOQQ'#Ce'#CeOOQ(CW'#Dl'#DlOOQ(CW'#Ji'#JiO%[QUO'#JiOOQO'#Jm'#JmOOQO'#Ia'#IaOBbQWO'#EaOOQ(CW'#E`'#E`OC^Q(C`O'#EaOChQWO'#ETOOQO'#Jl'#JlOC|QWO'#JmOEZQWO'#ETOChQWO'#EaPEhO?MpO'#C`POOO)CDp)CDpOOOO'#IW'#IWOEsOpO,59SOOQ(CY,59S,59SOOOO'#IX'#IXOFRO!bO,59SO%[QUO'#D^OOOO'#IZ'#IZOFaO07`O,59vOOQ(CY,59v,59vOFoQUO'#I[OGSQSO'#JgOIUQbO'#JgO+}QUO'#JgOI]QSO,59|OIsQSO'#EjOJQQSO'#JuOJ]QSO'#JtOJ]QSO'#JtOJeQSO,5;WOJjQSO'#JsOOQ(CY,5:X,5:XOJqQUO,5:XOLrQ(CjO,5:cOMcQSO,5:kOM|Q(C[O'#JrONTQSO'#JqO9TQSO'#JqONiQSO'#JqONqQSO,5;VONvQSO'#JqO!#OQbO'#JfOOQ(CY'#Cg'#CgO%[QUO'#EPO!#nQ`O,5:pOOQO'#Jn'#JnOOQO-ElOOQQ'#JZ'#JZOOQQ,5>m,5>mOOQQ-ExQ(CjO,5:iOOQO,5@m,5@mO!?iQ,UO,5=WO!?wQ(C[O'#J[O9OQSO'#J[O!@YQ(C[O,59XO!@eQWO,59XO!@mQ,UO,59XO9{Q,UO,59XO!@xQSO,5;TO!AQQSO'#HYO!AcQSO'#KVO%[QUO,5;xO!7cQWO,5;zO!AkQSO,5=sO!ApQSO,5=sO!AuQSO,5=sO9eQ(C[O,5=sO;mQSO,5=cOOQO'#Cs'#CsO!BTQWO,5=`O!B]Q,UO,5=aO!BhQSO,5=cO!BmQ`O,5=fO!BuQSO'#KRO>jQSO'#HPO9ZQSO'#HRO!BzQSO'#HRO9{Q,UO'#HTO!CPQSO'#HTOOQQ,5=i,5=iO!CUQSO'#HUO!C^QSO'#CmO!CcQSO,58}O!CmQSO,58}O!ErQUO,58}OOQQ,58},58}O!FSQ(C[O,58}O%[QUO,58}O!H_QUO'#H]OOQQ'#H^'#H^OOQQ'#H_'#H_O`QUO,5=uO!HuQSO,5=uO`QUO,5={O`QUO,5=}O!HzQSO,5>PO`QUO,5>RO!IPQSO,5>UO!IUQUO,5>[OOQQ,5>b,5>bO%[QUO,5>bO9eQ(C[O,5>dOOQQ,5>f,5>fO!M`QSO,5>fOOQQ,5>h,5>hO!M`QSO,5>hOOQQ,5>j,5>jO!MeQWO'#DYO%[QUO'#JiO!NSQWO'#JiO!NqQWO'#DhO# SQWO'#DhO##eQUO'#DhO##lQSO'#JhO##tQSO,5:RO##yQSO'#EnO#$XQSO'#JvO#$aQSO,5;XO#$fQWO'#DhO#$sQWO'#ESOOQ(CY,5:l,5:lO%[QUO,5:lO#$zQSO,5:lO>jQSO,5;SO!@eQWO,5;SO!@mQ,UO,5;SO9{Q,UO,5;SO#%SQSO,5@TO#%XQ!LQO,5:pOOQO-E<_-E<_O#&_Q(C`O,5:{OChQWO,5:oO#&iQWO,5:oOChQWO,5:{O!@YQ(C[O,5:oOOQ(CW'#Ed'#EdOOQO,5:{,5:{O%[QUO,5:{O#&vQ(C[O,5:{O#'RQ(C[O,5:{O!@eQWO,5:oOOQO,5;R,5;RO#'aQ(C[O,5:{POOO'#IU'#IUP#'uO?MpO,58zPOOO,58z,58zOOOO-EvO+}QUO,5>vOOQO,5>|,5>|O#(aQUO'#I[OOQO-ERQ(CjO1G0yO#?yQ(CjO1G0yO#ByQ$IUO'#CgO#DwQ$IUO1G1[O#EOQ$IUO'#JfO!,YQSO1G1bO#E`Q(CjO,5?SOOQ(CW-EeQSO1G3kO$.VQUO1G3mO$2ZQUO'#HlOOQQ1G3p1G3pO$2hQSO'#HrO>jQSO'#HtOOQQ1G3v1G3vO$2pQUO1G3vO9eQ(C[O1G3|OOQQ1G4O1G4OOOQ(CW'#GX'#GXO9eQ(C[O1G4QO9eQ(C[O1G4SO$6wQSO,5@TO!*SQUO,5;YO9TQSO,5;YO>jQSO,5:SO!*SQUO,5:SO!@eQWO,5:SO$6|Q$IUO,5:SOOQO,5;Y,5;YO$7WQWO'#I]O$7nQSO,5@SOOQ(CY1G/m1G/mO$7vQWO'#IcO$8QQSO,5@bOOQ(CW1G0s1G0sO# SQWO,5:SOOQO'#I`'#I`O$8YQWO,5:nOOQ(CY,5:n,5:nO#$}QSO1G0WOOQ(CY1G0W1G0WO%[QUO1G0WOOQ(CY1G0n1G0nO>jQSO1G0nO!@eQWO1G0nO!@mQ,UO1G0nOOQ(CW1G5o1G5oO!@YQ(C[O1G0ZOOQO1G0g1G0gO%[QUO1G0gO$8aQ(C[O1G0gO$8lQ(C[O1G0gO!@eQWO1G0ZOChQWO1G0ZO$8zQ(C[O1G0gOOQO1G0Z1G0ZO$9`Q(CjO1G0gPOOO-EvO$9|QSO1G5mO$:UQSO1G5zO$:^QbO1G5{O9TQSO,5>|O$:hQ(CjO1G5xO%[QUO1G5xO$:xQ(C[O1G5xO$;ZQSO1G5wO$;ZQSO1G5wO9TQSO1G5wO$;cQSO,5?PO9TQSO,5?POOQO,5?P,5?PO$;wQSO,5?PO$$XQSO,5?POOQO-ExQ(CjO,5WOOQQ,5>W,5>WO%[QUO'#HmO%(ZQSO'#HoOOQQ,5>^,5>^O9TQSO,5>^OOQQ,5>`,5>`OOQQ7+)b7+)bOOQQ7+)h7+)hOOQQ7+)l7+)lOOQQ7+)n7+)nO%(`QWO1G5oO%(tQ$IUO1G0tO%)OQSO1G0tOOQO1G/n1G/nO%)ZQ$IUO1G/nO>jQSO1G/nO!*SQUO'#DhOOQO,5>w,5>wOOQO-E},5>}OOQO-EjQSO7+&YO!@eQWO7+&YOOQO7+%u7+%uO$9`Q(CjO7+&ROOQO7+&R7+&RO%[QUO7+&RO%)eQ(C[O7+&RO!@YQ(C[O7+%uO!@eQWO7+%uO%)pQ(C[O7+&RO%*OQ(CjO7++dO%[QUO7++dO%*`QSO7++cO%*`QSO7++cOOQO1G4k1G4kO9TQSO1G4kO%*hQSO1G4kOOQO7+%z7+%zO#$}QSO<xOOQO-E<[-E<[O%2^QbO,5>yO%[QUO,5>yOOQO-E<]-E<]O%2hQSO1G5qOOQ(CY<XQ$IUO1G0yO%>`Q$IUO1G0yO%@WQ$IUO1G0yO%@kQ(CjO<XOOQQ,5>Z,5>ZO%NUQSO1G3xO9TQSO7+&`O!*SQUO7+&`OOQO7+%Y7+%YO%NZQ$IUO1G5{O>jQSO7+%YOOQ(CY<jQSO<jQSO7+)dO&5rQSO<{AN>{O%[QUOAN?XOOQO<SQSO7++uO%LgQSOANAyOOQQANAyANAyO!&^Q,UOANAyO&>[QSOANAyOOQQANA{ANA{O9eQ(C[OANA{O#MzQSOANA{OOQO'#HW'#HWOOQO7+*e7+*eOOQQG22uG22uOOQQANEPANEPOOQQANEQANEQOOQQANBTANBTO&>dQSOANBTOOQQ<iQSOLD,jO&>qQ$IUO7+'tO&@gQ$IUO7+'vO&B]Q,UOG26|OOQO<YOPZXYZXlZXzZX{ZX}ZX!fZX!gZX!iZX!mZX#YZX#edX#hZX#iZX#jZX#kZX#lZX#mZX#nZX#oZX#pZX#rZX#tZX#vZX#wZX#|ZX(TZX(dZX(kZX(lZX!WZX!XZX~O#zZX~P#@sOP$]OY:YOl9|Oz#yO{#zO}#{O!f:OO!g#wO!i#xO!m$]O#h9zO#i9{O#j9{O#k9{O#l9}O#m:OO#n:OO#o:XO#p:OO#r:PO#t:RO#v:TO#w:UO(TVO(d$ZO(k#|O(l#}O~O#z.iO~P#CQO#Y:ZO#|:ZO#z(YX!X(YX~P! UO_'[a!W'[a'm'[a'k'[a!h'[a!T'[ap'[a!Y'[a%b'[a!b'[a~P!7zOP#giY#gi_#gil#gi{#gi!W#gi!f#gi!g#gi!i#gi!m#gi#h#gi#i#gi#j#gi#k#gi#l#gi#m#gi#n#gi#o#gi#p#gi#r#gi#t#gi#v#gi#w#gi'm#gi(T#gi(d#gi'k#gi!T#gi!h#gip#gi!Y#gi%b#gi!b#gi~P#,gO_#{i!W#{i'm#{i'k#{i!T#{i!h#{ip#{i!Y#{i%b#{i!b#{i~P!7zO$X.nO$Z.nO~O$X.oO$Z.oO~O!b)_O#Y.pO!Y$_X$U$_X$X$_X$Z$_X$b$_X~O!V.qO~O!Y)bO$U.sO$X)aO$Z)aO$b.tO~O!W:VO!X(XX~P#CQO!X.uO~O!b)_O$b(mX~O$b.wO~Or)qO(U)rO(V.zO~O!T/OO~P!&^O!WdX!bdX!hdX!h$tX(ddX~P!/bO!h/UO~P#,gO!W/VO!b#uO(d'gO!h(qX~O!h/[O~O!V*SO'v%`O!h(qP~O#e/^O~O!T$tX!W$tX!b${X~P!/bO!W/_O!T(rX~P#,gO!b/aO~O!T/cO~Ol/gO!b#uO!i%^O(P%RO(d'gO~O'v/iO~O!b+YO~O_%gO!W/mO'm%gO~O!X/oO~P!3`O!^/pO!_/pO'w!lO(W!mO~O}/rO(W!mO~O#U/sO~O'v&QOe'aX!W'aX~O!W*lOe(Qa~Oe/xO~Oz/yO{/yO}/zOhwa(kwa(lwa!Wwa#Ywa~Oewa#zwa~P$ hOz)vO})wOh$ma(k$ma(l$ma!W$ma#Y$ma~Oe$ma#z$ma~P$!^Oz)vO})wOh$oa(k$oa(l$oa!W$oa#Y$oa~Oe$oa#z$oa~P$#PO#e/|O~Oe$}a!W$}a#Y$}a#z$}a~P!0kO!b#uO~O#e0PO~O!W*}O_(va'm(va~Oz#yO{#zO}#{O!g#wO!i#xO(TVOP!oiY!oil!oi!W!oi!f!oi!m!oi#h!oi#i!oi#j!oi#k!oi#l!oi#m!oi#n!oi#o!oi#p!oi#r!oi#t!oi#v!oi#w!oi(d!oi(k!oi(l!oi~O_!oi'm!oi'k!oi!T!oi!h!oip!oi!Y!oi%b!oi!b!oi~P$$nOh.UO!Y'VO%b.TO~Oj0ZO'v0YO~P!1]O!b+YO_(Oa!Y(Oa'm(Oa!W(Oa~O#e0aO~OYZX!WdX!XdX~O!W0bO!X(zX~O!X0dO~OY0eO~O'v+bO'xTO'{UO~O!Y%wO'v%`O^'iX!W'iX~O!W+gO^(ya~O!h0jO~P!7zOY0mO~O^0nO~O#Y0qO~Oh0tO!Y$|O~O(W(tO!X(wP~Oh0}O!Y0zO%b0|O(P%RO~OY1XO!W1VO!X(xX~O!X1YO~O^1[O_%gO'm%gO~O'v#mO'xTO'{UO~O#Y$eO#|$eOP(YXY(YXl(YXz(YX{(YX}(YX!W(YX!f(YX!i(YX!m(YX#h(YX#i(YX#j(YX#k(YX#l(YX#m(YX#n(YX#o(YX#r(YX#t(YX#v(YX#w(YX(T(YX(d(YX(k(YX(l(YX~O#p1_O&S1`O_(YX!g(YX~P$+dO#Y$eO#p1_O&S1`O~O_1bO~P%[O_1dO~O&]1gOP&ZiQ&ZiW&Zi_&Zib&Zic&Zij&Zil&Zim&Zin&Zit&Ziv&Zix&Zi}&Zi!R&Zi!S&Zi!Y&Zi!d&Zi!i&Zi!l&Zi!m&Zi!n&Zi!p&Zi!r&Zi!u&Zi!y&Zi#q&Zi$R&Zi$V&Zi%a&Zi%c&Zi%e&Zi%f&Zi%g&Zi%j&Zi%l&Zi%o&Zi%p&Zi%r&Zi&O&Zi&U&Zi&W&Zi&Y&Zi&[&Zi&_&Zi&e&Zi&k&Zi&m&Zi&o&Zi&q&Zi&s&Zi'k&Zi'v&Zi'x&Zi'{&Zi(T&Zi(c&Zi(p&Zi!X&Zi`&Zi&b&Zi~O`1mO!X1kO&b1lO~P`O!YXO!i1oO~O&i,jOP&diQ&diW&di_&dib&dic&dij&dil&dim&din&dit&div&dix&di}&di!R&di!S&di!Y&di!d&di!i&di!l&di!m&di!n&di!p&di!r&di!u&di!y&di#q&di$R&di$V&di%a&di%c&di%e&di%f&di%g&di%j&di%l&di%o&di%p&di%r&di&O&di&U&di&W&di&Y&di&[&di&_&di&e&di&k&di&m&di&o&di&q&di&s&di'k&di'v&di'x&di'{&di(T&di(c&di(p&di!X&di&]&di`&di&b&di~O!T1uO~O!W![a!X![a~P#CQOm!nO}!oO!V1{O(W!mO!W'PX!X'PX~P@OO!W,zO!X([a~O!W'VX!X'VX~P!7SO!W,}O!X(ja~O!X2SO~P'_O_%gO#Y2]O'm%gO~O_%gO!b#uO#Y2]O'm%gO~O_%gO!b#uO!m2aO#Y2]O'm%gO(d'gO~O_%gO'm%gO~P!7zO!W$aOp$la~O!T'Oi!W'Oi~P!7zO!W'{O!T(Zi~O!W(SO!T(hi~O!T(ii!W(ii~P!7zO!W(fi!h(fi_(fi'm(fi~P!7zO#Y2cO!W(fi!h(fi_(fi'm(fi~O!W(`O!h(ei~O}%aO!Y%bO!y]O#c2hO#d2gO'v%`O~O}%aO!Y%bO#d2gO'v%`O~Oh2oO!Y'VO%b2nO~Oh2oO!Y'VO%b2nO(P%RO~O#ewaPwaYwa_walwa!fwa!gwa!iwa!mwa#hwa#iwa#jwa#kwa#lwa#mwa#nwa#owa#pwa#rwa#twa#vwa#wwa'mwa(Twa(dwa!hwa!Twa'kwapwa!Ywa%bwa!bwa~P$ hO#e$maP$maY$ma_$mal$ma{$ma!f$ma!g$ma!i$ma!m$ma#h$ma#i$ma#j$ma#k$ma#l$ma#m$ma#n$ma#o$ma#p$ma#r$ma#t$ma#v$ma#w$ma'm$ma(T$ma(d$ma!h$ma!T$ma'k$map$ma!Y$ma%b$ma!b$ma~P$!^O#e$oaP$oaY$oa_$oal$oa{$oa!f$oa!g$oa!i$oa!m$oa#h$oa#i$oa#j$oa#k$oa#l$oa#m$oa#n$oa#o$oa#p$oa#r$oa#t$oa#v$oa#w$oa'm$oa(T$oa(d$oa!h$oa!T$oa'k$oap$oa!Y$oa%b$oa!b$oa~P$#PO#e$}aP$}aY$}a_$}al$}a{$}a!W$}a!f$}a!g$}a!i$}a!m$}a#h$}a#i$}a#j$}a#k$}a#l$}a#m$}a#n$}a#o$}a#p$}a#r$}a#t$}a#v$}a#w$}a'm$}a(T$}a(d$}a!h$}a!T$}a'k$}a#Y$}ap$}a!Y$}a%b$}a!b$}a~P#,gO_#]q!W#]q'm#]q'k#]q!T#]q!h#]qp#]q!Y#]q%b#]q!b#]q~P!7zOe'QX!W'QX~P!'vO!W._Oe(^a~O!V2wO!W'RX!h'RX~P%[O!W.bO!h(_a~O!W.bO!h(_a~P!7zO!T2zO~O#z!ka!X!ka~PJxO#z!ca!W!ca!X!ca~P#CQO#z!oa!X!oa~P!:eO#z!qa!X!qa~P!=OO!Y3^O$VfO$`3_O~O!X3cO~Op3dO~P#,gO_$iq!W$iq'm$iq'k$iq!T$iq!h$iqp$iq!Y$iq%b$iq!b$iq~P!7zO!T3eO~P#,gOz)vO})wO(l){Oh%Yi(k%Yi!W%Yi#Y%Yi~Oe%Yi#z%Yi~P$I|Oz)vO})wOh%[i(k%[i(l%[i!W%[i#Y%[i~Oe%[i#z%[i~P$JoO(d$ZO~P#,gO!V3hO'v%`O!W']X!h']X~O!W/VO!h(qa~O!W/VO!b#uO!h(qa~O!W/VO!b#uO(d'gO!h(qa~Oe$vi!W$vi#Y$vi#z$vi~P!0kO!V3pO'v*XO!T'_X!W'_X~P!1YO!W/_O!T(ra~O!W/_O!T(ra~P#,gO!b#uO#p3xO~Ol3{O!b#uO(d'gO~Oe(Ri!W(Ri~P!0kO#Y4OOe(Ri!W(Ri~P!0kO!h4RO~O_$jq!W$jq'm$jq'k$jq!T$jq!h$jqp$jq!Y$jq%b$jq!b$jq~P!7zO!T4VO~O!W4WO!Y(sX~P#,gO!g#wO~P4XO_$tX!Y$tX%VZX'm$tX!W$tX~P!/bO%V4YO_iXhiXziX}iX!YiX'miX(kiX(liX!WiX~O%V4YO~O%c4aO'v+bO'xTO'{UO!W'hX!X'hX~O!W0bO!X(za~OY4eO~O^4fO~O_%gO'm%gO~P#,gO!Y$|O~P#,gO!W4nO#Y4pO!X(wX~O!X4qO~Om!nO}4rO!]!xO!^!uO!_!uO!y9rO!}!pO#O!pO#P!pO#Q!pO#R!pO#U4wO#V!yO'w!lO'xTO'{UO(W!mO(c!sO~O!X4vO~P%$nOh4|O!Y0zO%b4{O~Oh4|O!Y0zO%b4{O(P%RO~O'v#mO!W'gX!X'gX~O!W1VO!X(xa~O'xTO'{UO(W5VO~O^5ZO~O#p5^O&S5_O~PMhO!h5`O~P%[O_5bO~O_5bO~P%[O`1mO!X5gO&b1lO~P`O!b5iO~O!b5kO!W(]i!X(]i!b(]i!i(]i(P(]i~O!W#bi!X#bi~P#CQO#Y5lO!W#bi!X#bi~O!W![i!X![i~P#CQO_%gO#Y5uO'm%gO~O_%gO!b#uO#Y5uO'm%gO~O!W(fq!h(fq_(fq'm(fq~P!7zO!W(`O!h(eq~O}%aO!Y%bO#d5|O'v%`O~O!Y'VO%b6PO~Oh6SO!Y'VO%b6PO~O#e%YiP%YiY%Yi_%Yil%Yi{%Yi!f%Yi!g%Yi!i%Yi!m%Yi#h%Yi#i%Yi#j%Yi#k%Yi#l%Yi#m%Yi#n%Yi#o%Yi#p%Yi#r%Yi#t%Yi#v%Yi#w%Yi'm%Yi(T%Yi(d%Yi!h%Yi!T%Yi'k%Yip%Yi!Y%Yi%b%Yi!b%Yi~P$I|O#e%[iP%[iY%[i_%[il%[i{%[i!f%[i!g%[i!i%[i!m%[i#h%[i#i%[i#j%[i#k%[i#l%[i#m%[i#n%[i#o%[i#p%[i#r%[i#t%[i#v%[i#w%[i'm%[i(T%[i(d%[i!h%[i!T%[i'k%[ip%[i!Y%[i%b%[i!b%[i~P$JoO#e$viP$viY$vi_$vil$vi{$vi!W$vi!f$vi!g$vi!i$vi!m$vi#h$vi#i$vi#j$vi#k$vi#l$vi#m$vi#n$vi#o$vi#p$vi#r$vi#t$vi#v$vi#w$vi'm$vi(T$vi(d$vi!h$vi!T$vi'k$vi#Y$vip$vi!Y$vi%b$vi!b$vi~P#,gOe'Qa!W'Qa~P!0kO!W'Ra!h'Ra~P!7zO!W.bO!h(_i~O#z#]i!W#]i!X#]i~P#CQOP$]Oz#yO{#zO}#{O!g#wO!i#xO!m$]O(TVOY#gil#gi!f#gi#i#gi#j#gi#k#gi#l#gi#m#gi#n#gi#o#gi#p#gi#r#gi#t#gi#v#gi#w#gi#z#gi(d#gi(k#gi(l#gi!W#gi!X#gi~O#h#gi~P%2}O#h9zO~P%2}OP$]Oz#yO{#zO}#{O!g#wO!i#xO!m$]O#h9zO#i9{O#j9{O#k9{O(TVOY#gi!f#gi#l#gi#m#gi#n#gi#o#gi#p#gi#r#gi#t#gi#v#gi#w#gi#z#gi(d#gi(k#gi(l#gi!W#gi!X#gi~Ol#gi~P%5YOl9|O~P%5YOP$]Ol9|Oz#yO{#zO}#{O!g#wO!i#xO!m$]O#h9zO#i9{O#j9{O#k9{O#l9}O(TVO#r#gi#t#gi#v#gi#w#gi#z#gi(d#gi(k#gi(l#gi!W#gi!X#gi~OY#gi!f#gi#m#gi#n#gi#o#gi#p#gi~P%7eOY:YO!f:OO#m:OO#n:OO#o:XO#p:OO~P%7eOP$]OY:YOl9|Oz#yO{#zO}#{O!f:OO!g#wO!i#xO!m$]O#h9zO#i9{O#j9{O#k9{O#l9}O#m:OO#n:OO#o:XO#p:OO#r:PO(TVO#t#gi#v#gi#w#gi#z#gi(d#gi(l#gi!W#gi!X#gi~O(k#gi~P%:PO(k#|O~P%:POP$]OY:YOl9|Oz#yO{#zO}#{O!f:OO!g#wO!i#xO!m$]O#h9zO#i9{O#j9{O#k9{O#l9}O#m:OO#n:OO#o:XO#p:OO#r:PO#t:RO(TVO(k#|O#v#gi#w#gi#z#gi(d#gi!W#gi!X#gi~O(l#gi~P%<[O(l#}O~P%<[OP$]OY:YOl9|Oz#yO{#zO}#{O!f:OO!g#wO!i#xO!m$]O#h9zO#i9{O#j9{O#k9{O#l9}O#m:OO#n:OO#o:XO#p:OO#r:PO#t:RO#v:TO(TVO(k#|O(l#}O~O#w#gi#z#gi(d#gi!W#gi!X#gi~P%>gO_#xy!W#xy'm#xy'k#xy!T#xy!h#xyp#xy!Y#xy%b#xy!b#xy~P!7zOh;mOz)vO})wO(k)yO(l){O~OP#giY#gil#gi{#gi!f#gi!g#gi!i#gi!m#gi#h#gi#i#gi#j#gi#k#gi#l#gi#m#gi#n#gi#o#gi#p#gi#r#gi#t#gi#v#gi#w#gi#z#gi(T#gi(d#gi!W#gi!X#gi~P%A_O!g#wOP(SXY(SXh(SXl(SXz(SX{(SX}(SX!f(SX!i(SX!m(SX#h(SX#i(SX#j(SX#k(SX#l(SX#m(SX#n(SX#o(SX#p(SX#r(SX#t(SX#v(SX#w(SX#z(SX(T(SX(d(SX(k(SX(l(SX!W(SX!X(SX~O#z#{i!W#{i!X#{i~P#CQO#z!oi!X!oi~P$$nO!X6`O~O!W'[a!X'[a~P#CQO!b#uO(d'gO!W']a!h']a~O!W/VO!h(qi~O!W/VO!b#uO!h(qi~Oe$vq!W$vq#Y$vq#z$vq~P!0kO!T'_a!W'_a~P#,gO!b6gO~O!W/_O!T(ri~P#,gO!W/_O!T(ri~O!T6kO~O!b#uO#p6pO~Ol6qO!b#uO(d'gO~O!T6sO~Oe$xq!W$xq#Y$xq#z$xq~P!0kO_$jy!W$jy'm$jy'k$jy!T$jy!h$jyp$jy!Y$jy%b$jy!b$jy~P!7zO!b5kO~O!W4WO!Y(sa~O_#]y!W#]y'm#]y'k#]y!T#]y!h#]yp#]y!Y#]y%b#]y!b#]y~P!7zOY6xO~O!W0bO!X(zi~O^7OO~O(W(tO!W'dX!X'dX~O!W4nO!X(wa~OjkO'v7VO~P.iO!X7YO~P%$nOm!nO}7ZO'xTO'{UO(W!mO(c!sO~O!Y0zO~O!Y0zO%b7]O~Oh7`O!Y0zO%b7]O~OY7eO!W'ga!X'ga~O!W1VO!X(xi~O!h7iO~O!h7jO~O!h7mO~O!h7mO~P%[O_7oO~O!b7pO~O!h7qO~O!W(ii!X(ii~P#CQO_%gO#Y7yO'm%gO~O!W(fy!h(fy_(fy'm(fy~P!7zO!W(`O!h(ey~O!Y'VO%b7|O~O#e$vqP$vqY$vq_$vql$vq{$vq!W$vq!f$vq!g$vq!i$vq!m$vq#h$vq#i$vq#j$vq#k$vq#l$vq#m$vq#n$vq#o$vq#p$vq#r$vq#t$vq#v$vq#w$vq'm$vq(T$vq(d$vq!h$vq!T$vq'k$vq#Y$vqp$vq!Y$vq%b$vq!b$vq~P#,gO#e$xqP$xqY$xq_$xql$xq{$xq!W$xq!f$xq!g$xq!i$xq!m$xq#h$xq#i$xq#j$xq#k$xq#l$xq#m$xq#n$xq#o$xq#p$xq#r$xq#t$xq#v$xq#w$xq'm$xq(T$xq(d$xq!h$xq!T$xq'k$xq#Y$xqp$xq!Y$xq%b$xq!b$xq~P#,gO!W'Ri!h'Ri~P!7zO#z#]q!W#]q!X#]q~P#CQOz/yO{/yO}/zOPwaYwahwalwa!fwa!gwa!iwa!mwa#hwa#iwa#jwa#kwa#lwa#mwa#nwa#owa#pwa#rwa#twa#vwa#wwa#zwa(Twa(dwa(kwa(lwa!Wwa!Xwa~Oz)vO})wOP$maY$mah$mal$ma{$ma!f$ma!g$ma!i$ma!m$ma#h$ma#i$ma#j$ma#k$ma#l$ma#m$ma#n$ma#o$ma#p$ma#r$ma#t$ma#v$ma#w$ma#z$ma(T$ma(d$ma(k$ma(l$ma!W$ma!X$ma~Oz)vO})wOP$oaY$oah$oal$oa{$oa!f$oa!g$oa!i$oa!m$oa#h$oa#i$oa#j$oa#k$oa#l$oa#m$oa#n$oa#o$oa#p$oa#r$oa#t$oa#v$oa#w$oa#z$oa(T$oa(d$oa(k$oa(l$oa!W$oa!X$oa~OP$}aY$}al$}a{$}a!f$}a!g$}a!i$}a!m$}a#h$}a#i$}a#j$}a#k$}a#l$}a#m$}a#n$}a#o$}a#p$}a#r$}a#t$}a#v$}a#w$}a#z$}a(T$}a(d$}a!W$}a!X$}a~P%A_O#z$iq!W$iq!X$iq~P#CQO#z$jq!W$jq!X$jq~P#CQO!X8WO~O#z8XO~P!0kO!b#uO!W']i!h']i~O!b#uO(d'gO!W']i!h']i~O!W/VO!h(qq~O!T'_i!W'_i~P#,gO!W/_O!T(rq~O!T8_O~P#,gO!T8_O~Oe(Ry!W(Ry~P!0kO!W'ba!Y'ba~P#,gO_%Uq!Y%Uq'm%Uq!W%Uq~P#,gOY8dO~O!W0bO!X(zq~O#Y8hO!W'da!X'da~O!W4nO!X(wi~P#CQOPZXYZXlZXzZX{ZX}ZX!TZX!WZX!fZX!gZX!iZX!mZX#YZX#edX#hZX#iZX#jZX#kZX#lZX#mZX#nZX#oZX#pZX#rZX#tZX#vZX#wZX#|ZX(TZX(dZX(kZX(lZX~O!b%SX#p%SX~P&2_O!Y0zO%b8lO~O'xTO'{UO(W8qO~O!W1VO!X(xq~O!h8tO~O!h8uO~O!h8vO~O!h8vO~P%[O#Y8yO!W#by!X#by~O!W#by!X#by~P#CQO!Y'VO%b9OO~O#z#xy!W#xy!X#xy~P#CQOP$viY$vil$vi{$vi!f$vi!g$vi!i$vi!m$vi#h$vi#i$vi#j$vi#k$vi#l$vi#m$vi#n$vi#o$vi#p$vi#r$vi#t$vi#v$vi#w$vi#z$vi(T$vi(d$vi!W$vi!X$vi~P%A_Oz)vO})wO(l){OP%YiY%Yih%Yil%Yi{%Yi!f%Yi!g%Yi!i%Yi!m%Yi#h%Yi#i%Yi#j%Yi#k%Yi#l%Yi#m%Yi#n%Yi#o%Yi#p%Yi#r%Yi#t%Yi#v%Yi#w%Yi#z%Yi(T%Yi(d%Yi(k%Yi!W%Yi!X%Yi~Oz)vO})wOP%[iY%[ih%[il%[i{%[i!f%[i!g%[i!i%[i!m%[i#h%[i#i%[i#j%[i#k%[i#l%[i#m%[i#n%[i#o%[i#p%[i#r%[i#t%[i#v%[i#w%[i#z%[i(T%[i(d%[i(k%[i(l%[i!W%[i!X%[i~O#z$jy!W$jy!X$jy~P#CQO#z#]y!W#]y!X#]y~P#CQO!b#uO!W']q!h']q~O!W/VO!h(qy~O!T'_q!W'_q~P#,gO!T9VO~P#,gO!W0bO!X(zy~O!W4nO!X(wq~O!Y0zO%b9^O~O!h9aO~O!Y'VO%b9fO~OP$vqY$vql$vq{$vq!f$vq!g$vq!i$vq!m$vq#h$vq#i$vq#j$vq#k$vq#l$vq#m$vq#n$vq#o$vq#p$vq#r$vq#t$vq#v$vq#w$vq#z$vq(T$vq(d$vq!W$vq!X$vq~P%A_OP$xqY$xql$xq{$xq!f$xq!g$xq!i$xq!m$xq#h$xq#i$xq#j$xq#k$xq#l$xq#m$xq#n$xq#o$xq#p$xq#r$xq#t$xq#v$xq#w$xq#z$xq(T$xq(d$xq!W$xq!X$xq~P%A_Oe%^!Z!W%^!Z#Y%^!Z#z%^!Z~P!0kO!W'dq!X'dq~P#CQO!W#b!Z!X#b!Z~P#CQO#e%^!ZP%^!ZY%^!Z_%^!Zl%^!Z{%^!Z!W%^!Z!f%^!Z!g%^!Z!i%^!Z!m%^!Z#h%^!Z#i%^!Z#j%^!Z#k%^!Z#l%^!Z#m%^!Z#n%^!Z#o%^!Z#p%^!Z#r%^!Z#t%^!Z#v%^!Z#w%^!Z'm%^!Z(T%^!Z(d%^!Z!h%^!Z!T%^!Z'k%^!Z#Y%^!Zp%^!Z!Y%^!Z%b%^!Z!b%^!Z~P#,gOP%^!ZY%^!Zl%^!Z{%^!Z!f%^!Z!g%^!Z!i%^!Z!m%^!Z#h%^!Z#i%^!Z#j%^!Z#k%^!Z#l%^!Z#m%^!Z#n%^!Z#o%^!Z#p%^!Z#r%^!Z#t%^!Z#v%^!Z#w%^!Z#z%^!Z(T%^!Z(d%^!Z!W%^!Z!X%^!Z~P%A_Op(XX~P1qO'w!lO~P!*SO!TdX!WdX#YdX~P&2_OPZXYZXlZXzZX{ZX}ZX!WZX!WdX!fZX!gZX!iZX!mZX#YZX#YdX#edX#hZX#iZX#jZX#kZX#lZX#mZX#nZX#oZX#pZX#rZX#tZX#vZX#wZX#|ZX(TZX(dZX(kZX(lZX~O!bdX!hZX!hdX(ddX~P&GuOP9qOQ9qOb;bOc!iOjkOl9qOmkOnkOtkOv9qOx9qO}WO!RkO!SkO!YXO!d9tO!iZO!l9qO!m9qO!n9qO!p9uO!r9xO!u!hO$R!kO$VfO'v)UO'xTO'{UO(TVO(c[O(p;`O~O!W:VO!X$la~Oj%SOl$tOm$sOn$sOt%TOv%UOx:]O}${O!Y$|O!d;gO!i$xO#d:cO$R%YO$n:_O$p:aO$s%ZO'v(lO'xTO'{UO(P%RO(T$uO~O#q)]O~P&LkO!XZX!XdX~P&GuO#e9yO~O!b#uO#e9yO~O#Y:ZO~O#p:OO~O#Y:eO!W(iX!X(iX~O#Y:ZO!W(gX!X(gX~O#e:fO~Oe:hO~P!0kO#e:mO~O#e:nO~O!b#uO#e:oO~O!b#uO#e:fO~O#z:pO~P#CQO#e:qO~O#e:rO~O#e:sO~O#e:tO~O#e:uO~O#e:vO~O#z:wO~P!0kO#z:xO~P!0kO$V~!g!}#O#Q#R#U#c#d#o(p$n$p$s%V%a%b%c%j%l%o%p%r%t~'qR$V(p#i!S'o'w#jm#h#klz'p(W'p'v$X$Z$X~",goto:"$'R)OPPPP)PPP)SP)eP*t.xPPPP5YPP5pP;l>sP?WP?WPPP?WP@xP?WP?WP?WP@|PPARPAlPFdPPPFhPPPPFhIiPPPIoJjPFhPLxPPPP! WFhPPPFhPFhP!#fFhP!&z!'|!(VP!(y!(}!(yPPPPP!,Y!'|PP!,v!-pP!0dFhFh!0i!3s!8Y!8Y!wP#@W#@_#@gPPPP#Du#Gl#NT#NW#NZ$ S$ V$ Y$ a$ iPP$ o$ s$!k$#j$#n$$SPP$$W$$^$$bP$$e$$i$$l$%b$%y$&b$&f$&i$&l$&r$&u$&y$&}R!{RoqOXst!Z#c%f&i&k&l&n,b,g1g1jY!uQ'V-S0z4uQ%lvQ%tyQ%{|Q&a!VS&}!e,zQ']!iS'c!r!xS*_$|*dQ+`%uQ+m%}Q,R&ZQ-Q'UQ-['^Q-d'dQ/p*fQ1U,SR:d9u%OdOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&i&k&l&n&r&z'X'i'y'{(R(Y(n(r(v)u*x*|,_,b,g-W-`-n-t.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2w4r4|5^5_5b5u7Z7`7o7yS#p]9r!r)W$[$m'O)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cQ*o%VQ+e%wQ,T&^Q,[&fQ.X:[Q0W+WQ0[+YQ0g+fQ1^,YQ2k.UQ4`0bQ5T1VQ6R2oQ6X:]Q6z4aR8P6S&|kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;ct!nQ!r!u!x!y&}'U'V'c'd'e,z-Q-S-d0z4u4w$^$si#u#w$c$d$x${%W%X%])q)w)z)|)}*U*[*j*k+V+Y+q+t.T._/P/^/_/a/|0q0t0|2n3f3p3x4O4W4Y4{6P6g6p7]7|8X8l9O9^9f:X:Y:^:_:`:a:b:c:i:j:k:l:m:n:q:r:s:t:w:x;`;h;i;l;mQ&O|Q&{!eS'R%b,}Q+e%wQ/{*sQ0g+fQ0l+lQ1],XQ1^,YQ4`0bQ4i0nQ5W1XQ5X1[Q6z4aQ6}4fQ7h5ZQ8g7OR8r7ernOXst!V!Z#c%f&`&i&k&l&n,b,g1g1jR,V&b&v^OPXYstuvwz!Z!`!g!j!o#R#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%f%l%y&b&e&f&i&k&l&n&r&z'X'i'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;b;c[#[WZ#V#Y'O'y!S%cm#g#h#k%^%a(S(^(_(`*z*{*},^,t-r-x-y-z-|1o2g2h5k5|Q%oxQ%syS%x|%}Q&U!TQ'Y!hQ'[!iQ(g#rS*R$x*VS+_%t%uQ+c%wQ+|&XQ,Q&ZS-Z']'^Q.W(hQ/Z*SQ0`+`Q0f+fQ0h+gQ0k+kQ1P+}S1T,R,SQ2X-[Q3g/VQ4_0bQ4c0eQ4h0mQ5S1UQ6d3hQ6y4aQ6|4eQ8c6xR9X8dv$zi#w%W%X%])z)|*U*j*k._/^/|3f4O8X;`;h;i!S%qy!i!t%s%t%u&|'[']'^'b'l*^+_+`,w-Z-[-c/h0`2Q2X2`3zQ+X%oQ+r&RQ+u&SQ,P&ZQ.V(gQ1O+|U1S,Q,R,SQ2p.WQ4}1PS5R1T1UQ7d5S#O;d#u$c$d$x${)q)w)}*[+V+Y+q+t.T/P/_/a0q0t0|2n3p3x4W4Y4{6P6g6p7]7|8l9O9^9f:^:`:b:i:k:m:q:s:w;l;mg;e:X:Y:_:a:c:j:l:n:r:t:xW%Pi%R*l;`S&R!Q&`Q&S!RQ&T!SR+p&P$_%Oi#u#w$c$d$x${%W%X%])q)w)z)|)}*U*[*j*k+V+Y+q+t.T._/P/^/_/a/|0q0t0|2n3f3p3x4O4W4Y4{6P6g6p7]7|8X8l9O9^9f:X:Y:^:_:`:a:b:c:i:j:k:l:m:n:q:r:s:t:w:x;`;h;i;l;mT)r$u)sV*p%V:[:]U'R!e%b,}S(u#y#zQ+j%zS.P(c(dQ0u+vQ4P/yR7S4n&|kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;c$i$`c#X#d%j%k%m'x(O(j(q(y(z({(|(})O)P)Q)R)S)T)V)Y)^)h+T+i,x-g-l-q-s.^.d.h.j.k.l.{/}1v1y2Z2b2v2{2|2}3O3P3Q3R3S3T3U3V3W3X3[3]3b4T4]5n5t5y6V6W6]6^7U7s7w8Q8U8V8{9Z9b9s;VT#SV#T&}kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cQ'P!eR1|,zv!nQ!e!r!u!x!y&}'U'V'c'd'e,z-Q-S-d0z4u4wS*^$|*dS/h*_*fQ/q*gQ0w+xQ3z/pR3}/snqOXst!Z#c%f&i&k&l&n,b,g1g1jQ&p!^Q'm!wS(i#t9yQ+]%rQ+z&UQ+{&WQ-X'ZQ-f'fS.](n:fS0O*x:oQ0^+^Q0y+yQ1n,iQ1p,jQ1x,uQ2V-YQ2Y-^S4U0P:uQ4Z0_S4^0a:vQ5m1zQ5q2WQ5v2_Q6w4[Q7t5oQ7u5rQ7x5wR8x7q$d$_c#X#d%k%m'x(O(j(q(y(z({(|(})O)P)Q)R)S)T)V)Y)^)h+T+i,x-g-l-q-s.^.d.h.k.l.{/}1v1y2Z2b2v2{2|2}3O3P3Q3R3S3T3U3V3W3X3[3]3b4T4]5n5t5y6V6W6]6^7U7s7w8Q8U8V8{9Z9b9s;VS(f#o'`U*i$}(m3ZS+S%j.jQ2l0WQ6O2kQ8O6RR9P8P$d$^c#X#d%k%m'x(O(j(q(y(z({(|(})O)P)Q)R)S)T)V)Y)^)h+T+i,x-g-l-q-s.^.d.h.k.l.{/}1v1y2Z2b2v2{2|2}3O3P3Q3R3S3T3U3V3W3X3[3]3b4T4]5n5t5y6V6W6]6^7U7s7w8Q8U8V8{9Z9b9s;VS(e#o'`S(w#z$_S+R%j.jS.Q(d(fQ.m)XQ0T+SR2i.R&|kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cS#p]9rQ&k!XQ&l!YQ&n![Q&o!]R1f,eQ'W!hQ+U%oQ-V'YS.S(g+XQ2T-UW2m.V.W0V0XQ5p2UU5}2j2l2pS7{6O6QS8}7}8OS9d8|9PQ9l9eR9o9mU!vQ'V-ST4s0z4u!Q_OXZ`st!V!Z#c#g%^%f&`&b&i&k&l&n(`,b,g-y1g1j]!pQ!r'V-S0z4uT#p]9r%Y{OPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&f&i&k&l&n&r&z'X'i'y'{(R(Y(n(r(v)u*x*|+W,_,b,g-W-`-n-t.U.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2o2w4r4|5^5_5b5u6S7Z7`7o7yS(u#y#zS.P(c(d!s:|$[$m'O)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cY!tQ'V-S0z4uQ'b!rS'l!u!xS'n!y4wS-c'c'dQ-e'eR2`-dQ'k!tS([#f1aS-b'b'nQ/Y*RQ/f*^Q2a-eQ3l/ZS3u/g/qQ6c3gS6n3{3}Q8Z6dR8b6qQ#vbQ'j!tS(Z#f1aS(]#l*wQ*y%_Q+Z%pQ+a%vU-a'b'k'nQ-u([Q/X*RQ/e*^Q/k*aQ0]+[Q1Q,OS2^-b-eQ2f-}S3k/Y/ZS3t/f/qQ3w/jQ3y/lQ5P1RQ5x2aQ6b3gQ6f3lS6j3u3}Q6o3|Q7b5QS8Y6c6dQ8^6kQ8`6nQ8o7cQ9T8ZQ9U8_Q9W8bQ9`8pQ9h9VQ;P:zQ;[;TR;];UV!vQ'V-S%YaOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&f&i&k&l&n&r&z'X'i'y'{(R(Y(n(r(v)u*x*|+W,_,b,g-W-`-n-t.U.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2o2w4r4|5^5_5b5u6S7Z7`7o7yS#vz!j!r:y$[$m'O)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cR;P;b%YbOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&f&i&k&l&n&r&z'X'i'y'{(R(Y(n(r(v)u*x*|+W,_,b,g-W-`-n-t.U.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2o2w4r4|5^5_5b5u6S7Z7`7o7yQ%_j!S%py!i!t%s%t%u&|'[']'^'b'l*^+_+`,w-Z-[-c/h0`2Q2X2`3zS%vz!jQ+[%qQ,O&ZW1R,P,Q,R,SU5Q1S1T1US7c5R5SQ8p7d!r:z$[$m'O)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cQ;T;aR;U;b$|eOPXYstuvw!Z!`!g!o#R#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&i&k&l&n&r&z'X'i'{(R(Y(n(r(v)u*x*|+W,_,b,g-W-`-n-t.U.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2o2w4r4|5^5_5b5u6S7Z7`7o7yY#aWZ#V#Y'y!S%cm#g#h#k%^%a(S(^(_(`*z*{*},^,t-r-x-y-z-|1o2g2h5k5|Q,]&f!p:{$[$m)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cR;O'OS'S!e%bR2O,}%OdOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&i&k&l&n&r&z'X'i'y'{(R(Y(n(r(v)u*x*|,_,b,g-W-`-n-t.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2w4r4|5^5_5b5u7Z7`7o7y!r)W$[$m'O)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cQ,[&fQ0W+WQ2k.UQ6R2oR8P6S!f$Uc#X%j'x(O(j(q)Q)R)S)T)Y)^+i-g-l-q-s.^.d.{/}2Z2b2v3X4T4]5t5y6V7w8{9s!T:Q)V)h,x.j1v1y2{3T3U3V3W3[3b5n6W6]6^7U7s8Q8U8V9Z9b;V!b$Wc#X%j'x(O(j(q)S)T)Y)^+i-g-l-q-s.^.d.{/}2Z2b2v3X4T4]5t5y6V7w8{9s!P:S)V)h,x.j1v1y2{3V3W3[3b5n6W6]6^7U7s8Q8U8V9Z9b;V!^$[c#X%j'x(O(j(q)Y)^+i-g-l-q-s.^.d.{/}2Z2b2v3X4T4]5t5y6V7w8{9sQ3f/Tz;c)V)h,x.j1v1y2{3[3b5n6W6]6^7U7s8Q8U8V9Z9b;VQ;h;jR;i;k&|kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cS$nh$oR3_.p'TgOPWXYZhstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m$o%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.p.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cT$jf$pQ$hfS)a$k)eR)m$pT$if$pT)c$k)e'ThOPWXYZhstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m$o%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.p.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cT$nh$oQ$qhR)l$o%YjOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&f&i&k&l&n&r&z'X'i'y'{(R(Y(n(r(v)u*x*|+W,_,b,g-W-`-n-t.U.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2o2w4r4|5^5_5b5u6S7Z7`7o7y!s;a$[$m'O)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;c#clOPXZst!Z!`!o#R#c#n#{$m%f&b&e&f&i&k&l&n&r&z'X(v)j*|+W,_,b,g-W.U.q/z0}1_1`1b1d1g1j1l2o3^4r4|5^5_5b6S7Z7`7ov$}i#w%W%X%])z)|*U*j*k._/^/|3f4O8X;`;h;i#O(m#u$c$d$x${)q)w)}*[+V+Y+q+t.T/P/_/a0q0t0|2n3p3x4W4Y4{6P6g6p7]7|8l9O9^9f:^:`:b:i:k:m:q:s:w;l;mQ*t%ZQ.|)vg3Z:X:Y:_:a:c:j:l:n:r:t:xv$yi#w%W%X%])z)|*U*j*k._/^/|3f4O8X;`;h;iQ*W$zS*a$|*dQ*u%[Q/l*b#O;R#u$c$d$x${)q)w)}*[+V+Y+q+t.T/P/_/a0q0t0|2n3p3x4W4Y4{6P6g6p7]7|8l9O9^9f:^:`:b:i:k:m:q:s:w;l;mf;S:X:Y:_:a:c:j:l:n:r:t:xQ;W;dQ;X;eQ;Y;fR;Z;gv$}i#w%W%X%])z)|*U*j*k._/^/|3f4O8X;`;h;i#O(m#u$c$d$x${)q)w)}*[+V+Y+q+t.T/P/_/a0q0t0|2n3p3x4W4Y4{6P6g6p7]7|8l9O9^9f:^:`:b:i:k:m:q:s:w;l;mg3Z:X:Y:_:a:c:j:l:n:r:t:xnoOXst!Z#c%f&i&k&l&n,b,g1g1jQ*Z${Q,p&uQ,q&wR3o/_$^%Oi#u#w$c$d$x${%W%X%])q)w)z)|)}*U*[*j*k+V+Y+q+t.T._/P/^/_/a/|0q0t0|2n3f3p3x4O4W4Y4{6P6g6p7]7|8X8l9O9^9f:X:Y:^:_:`:a:b:c:i:j:k:l:m:n:q:r:s:t:w:x;`;h;i;l;mQ+s&SQ0s+uQ4l0rR7R4mT*c$|*dS*c$|*dT4t0z4uS/j*`4rT3|/r7ZQ+Z%pQ/k*aQ0]+[Q1Q,OQ5P1RQ7b5QQ8o7cR9`8pn)z$v(o*v/]/t/u2t3m4S6a6r9S;Q;^;_!Y:i(k)[*Q*Y.[.x.}/T/b0U0p0r2s3n3r4k4m6T6U6h6l6t6v8]8a9g;j;k]:j3Y6[8R9Q9R9pp)|$v(o*v/R/]/t/u2t3m4S6a6r9S;Q;^;_![:k(k)[*Q*Y.[.x.}/T/b0U0p0r2q2s3n3r4k4m6T6U6h6l6t6v8]8a9g;j;k_:l3Y6[8R8S9Q9R9prnOXst!V!Z#c%f&`&i&k&l&n,b,g1g1jQ&]!UR,_&frnOXst!V!Z#c%f&`&i&k&l&n,b,g1g1jR&]!UQ+w&TR0o+psnOXst!V!Z#c%f&`&i&k&l&n,b,g1g1jQ0{+|S4z1O1PU7[4x4y4}S8k7^7_S9[8j8mQ9i9]R9n9jQ&d!VR,W&`R5W1XS%x|%}R0h+gQ&i!WR,b&jR,h&oT1h,g1jR,l&pQ,k&pR1q,lQ'p!zR-h'pSsOtQ#cXT%is#cQ!}TR'r!}Q#QUR't#QQ)s$uR.y)sQ#TVR'v#TQ#WWU'|#W'}-oQ'}#XR-o(OQ,{'PR1},{Q.`(oR2u.`Q.c(qS2x.c2yR2y.dQ-S'VR2R-SY!rQ'V-S0z4uR'a!rS#^W%aU(T#^(U-pQ(U#_R-p(PQ-O'SR2P-Ot`OXst!V!Z#c%f&`&b&i&k&l&n,b,g1g1jS#gZ%^U#q`#g-yR-y(`Q(a#iQ-v(]W.O(a-v2d5zQ2d-wR5z2eQ)e$kR.r)eQ$ohR)k$oQ$bcU)Z$b-k:WQ-k9sR:W)hQ/W*RW3i/W3j6e8[U3j/X/Y/ZS6e3k3lR8[6f#o)x$v(k(o)[*Q*Y*q*r*v.Y.Z.[.x.}/R/S/T/]/b/t/u0U0p0r2q2r2s2t3Y3m3n3r4S4k4m6T6U6Y6Z6[6a6h6l6r6t6v8R8S8T8]8a9Q9R9S9g9p;Q;^;_;j;kQ/`*YU3q/`3s6iQ3s/bR6i3rQ*d$|R/n*dQ*m%QR/w*mQ4X0UR6u4XQ+O%dR0S+OQ4o0uS7T4o8iR8i7UQ+y&UR0x+yQ4u0zR7X4uQ1W,TS5U1W7fR7f5WQ0c+cW4b0c4d6{8eQ4d0fQ6{4cR8e6|Q+h%xR0i+hQ1j,gR5f1jYrOXst#cQ&m!ZQ+Q%fQ,a&iQ,c&kQ,d&lQ,f&nQ1e,bS1h,g1jR5e1gQ%hpQ&q!_Q&t!aQ&v!bQ&x!cQ'h!tQ+P%eQ+]%rQ+o&OQ,V&dQ,n&sW-_'b'j'k'nQ-f'fQ/m*cQ0^+^S1Z,W,ZQ1r,mQ1s,pQ1t,qQ2Y-^W2[-a-b-e-gQ4Z0_Q4g0lQ4j0pQ5O1QQ5Y1]Q5d1fU5s2Z2^2aQ5v2_Q6w4[Q7P4iQ7Q4kQ7W4tQ7a5PQ7g5XS7v5t5xQ7x5wQ8f6}Q8n7bQ8s7hQ8z7wQ9Y8gQ9_8oQ9c8{R9k9`Q%ryQ'Z!iQ'f!tU+^%s%t%uQ,u&|U-Y'[']'^S-^'b'lQ/d*^S0_+_+`Q1z,wS2W-Z-[Q2_-cQ3v/hQ4[0`Q5o2QQ5r2XQ5w2`R6m3zS$wi;`R*n%RU%Qi%R;`R/v*lQ$viS(k#u+YQ(o#wS)[$c$dQ*Q$xQ*Y${Q*q%WQ*r%XQ*v%]Q.Y:^Q.Z:`Q.[:bQ.x)qS.})w/PQ/R)zQ/S)|Q/T)}Q/]*UQ/b*[Q/t*jQ/u*kh0U+V.T0|2n4{6P7]7|8l9O9^9fQ0p+qQ0r+tQ2q:iQ2r:kQ2s:mQ2t._S3Y:X:YQ3m/^Q3n/_Q3r/aQ4S/|Q4k0qQ4m0tQ6T:qQ6U:sQ6Y:_Q6Z:aQ6[:cQ6a3fQ6h3pQ6l3xQ6r4OQ6t4WQ6v4YQ8R:nQ8S:jQ8T:lQ8]6gQ8a6pQ9Q:rQ9R:tQ9S8XQ9g:wQ9p:xQ;Q;`Q;^;hQ;_;iQ;j;lR;k;mnpOXst!Z#c%f&i&k&l&n,b,g1g1jQ!fPS#eZ#nQ&s!`U'_!o4r7ZQ'u#RQ(x#{Q)i$mS,Z&b&eQ,`&fQ,m&rQ,r&zQ-U'XQ.f(vQ.v)jQ0Q*|Q0X+WQ1c,_Q2U-WQ2l.UQ3a.qQ4Q/zQ4y0}Q5[1_Q5]1`Q5a1bQ5c1dQ5h1lQ6O2oQ6_3^Q7_4|Q7k5^Q7l5_Q7n5bQ8O6SQ8m7`R8w7o#WcOPXZst!Z!`!o#c#n#{%f&b&e&f&i&k&l&n&r&z'X(v*|+W,_,b,g-W.U/z0}1_1`1b1d1g1j1l2o4r4|5^5_5b6S7Z7`7oQ#XWQ#dYQ%juQ%kvS%mw!gS'x#V'{Q(O#YQ(j#tQ(q#xQ(y$OQ(z$PQ({$QQ(|$RQ(}$SQ)O$TQ)P$UQ)Q$VQ)R$WQ)S$XQ)T$YQ)V$[Q)Y$aQ)^$eW)h$m)j.q3^Q+T%lQ+i%yS,x'O1{Q-g'iS-l'y-nQ-q(RQ-s(YQ.^(nQ.d(rQ.h9qQ.j9tQ.k9uQ.l9xQ.{)uQ/}*xQ1v,sQ1y,vQ2Z-`Q2b-tQ2v.bQ2{9yQ2|9zQ2}9{Q3O9|Q3P9}Q3Q:OQ3R:PQ3S:QQ3T:RQ3U:SQ3V:TQ3W:UQ3X.iQ3[:ZQ3]:dQ3b:VQ4T0PQ4]0aQ5n:eQ5t2]Q5y2cQ6V2wQ6W:fQ6]:hQ6^:oQ7U4pQ7s5lQ7w5uQ8Q:pQ8U:uQ8V:vQ8{7yQ9Z8hQ9b8yQ9s#RR;V;cR#ZWR'Q!eY!tQ'V-S0z4uS&|!e,zQ'b!rS'l!u!xS'n!y4wS,w&}'US-c'c'dQ-e'eQ2Q-QR2`-dR(p#wR(s#xQ!fQT-R'V-S]!qQ!r'V-S0z4uQ#o]R'`9rT#jZ%^S#iZ%^S%dm,^U(]#g#h#kS-w(^(_Q-{(`Q0R*}Q2e-xU2f-y-z-|S5{2g2hR7z5|`#]W#V#Y%a'y(S*z-rr#fZm#g#h#k%^(^(_(`*}-x-y-z-|2g2h5|Q1a,^Q1w,tQ5j1oQ7r5kT:}'O*{T#`W%aS#_W%aS'z#V(SS(P#Y*zS,y'O*{T-m'y-rT'T!e%bQ$kfR)o$pT)d$k)eR3`.pT*T$x*VR*]${Q0V+VQ2j.TQ4x0|Q6Q2nQ7^4{Q7}6PQ8j7]Q8|7|Q9]8lQ9e9OQ9j9^R9m9fnqOXst!Z#c%f&i&k&l&n,b,g1g1jQ&c!VR,V&`tmOXst!U!V!Z#c%f&`&i&k&l&n,b,g1g1jR,^&fT%em,^R0v+vR,U&^Q%||R+n%}R+d%wT&g!W&jT&h!W&jT1i,g1j",nodeNames:"⚠ ArithOp ArithOp LineComment BlockComment Script Hashbang ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:367,context:m2,nodeProps:[["group",-26,7,15,17,63,200,204,208,209,211,214,217,227,229,235,237,239,241,244,250,256,258,260,262,264,266,267,"Statement",-32,11,12,26,29,30,36,46,49,50,52,57,65,73,77,79,81,82,104,105,114,115,132,135,137,138,139,140,142,143,163,164,166,"Expression",-23,25,27,31,35,37,39,167,169,171,172,174,175,176,178,179,180,182,183,184,194,196,198,199,"Type",-3,85,97,103,"ClassItem"],["openedBy",32,"InterpolationStart",51,"[",55,"{",70,"(",144,"JSXStartTag",156,"JSXStartTag JSXStartCloseTag"],["closedBy",34,"InterpolationEnd",45,"]",56,"}",71,")",145,"JSXSelfCloseEndTag JSXEndTag",161,"JSXEndTag"]],propSources:[O2],skippedNodes:[0,3,4,270],repeatNodeCount:33,tokenData:"$Fl(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#8g!R![#:v![!]#Gv!]!^#IS!^!_#J^!_!`#Nu!`!a$#a!a!b$(n!b!c$,m!c!}Er!}#O$-w#O#P$/R#P#Q$4j#Q#R$5t#R#SEr#S#T$7R#T#o$8]#o#p$s#r#s$@P#s$f%Z$f$g+g$g#BYEr#BY#BZ$AZ#BZ$ISEr$IS$I_$AZ$I_$I|Er$I|$I}$Df$I}$JO$Df$JO$JTEr$JT$JU$AZ$JU$KVEr$KV$KW$AZ$KW&FUEr&FU&FV$AZ&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$AZ?HUOEr(n%d_$e&j'yp'|!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$e&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$e&j'|!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU'|!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$e&j'ypOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU'ypOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX'yp'|!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z(CS+rq$e&j'yp'|!b'o(;dOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z(CS.ST'z#S$e&j'p(;dO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c(CS.n_$e&j'yp'|!b'p(;dOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#`/x`$e&j!m$Ip'yp'|!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S1V`#r$Id$e&j'yp'|!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S2d_#r$Id$e&j'yp'|!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$2b3l_'x$(n$e&j'|!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k*r4r_$e&j'|!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k)`5vX$e&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q)`6jT$`#t$e&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c#t6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y#t7bO$`#t#t7eP;=`<%l6y)`7kP;=`<%l5q*r7w]$`#t$e&j'|!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}%W8uZ'|!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p%W9oU$`#t'|!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}%W:UP;=`<%l8p*r:[P;=`<%l4k#%|:hh$e&j'yp'|!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXUS$e&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSUSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWUS'|!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]US$e&j'ypOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWUS'ypOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYUS'yp'|!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%lQ^$e&j!SSOY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@Y!_!}!=y!}#O!Bw#O#P!Dj#P#o!=y#o#p!@Y#p;'S!=y;'S;=`!E[<%lO!=y&n!?Ta$e&j!SSO!^&c!_#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&cS!@_X!SSOY!@YZ!P!@Y!P!Q!@z!Q!}!@Y!}#O!Ac#O#P!Bb#P;'S!@Y;'S;=`!Bq<%lO!@YS!APU!SS#Z#[!@z#]#^!@z#a#b!@z#g#h!@z#i#j!@z#m#n!@zS!AfVOY!AcZ#O!Ac#O#P!A{#P#Q!@Y#Q;'S!Ac;'S;=`!B[<%lO!AcS!BOSOY!AcZ;'S!Ac;'S;=`!B[<%lO!AcS!B_P;=`<%l!AcS!BeSOY!@YZ;'S!@Y;'S;=`!Bq<%lO!@YS!BtP;=`<%l!@Y&n!B|[$e&jOY!BwYZ&cZ!^!Bw!^!_!Ac!_#O!Bw#O#P!Cr#P#Q!=y#Q#o!Bw#o#p!Ac#p;'S!Bw;'S;=`!Dd<%lO!Bw&n!CwX$e&jOY!BwYZ&cZ!^!Bw!^!_!Ac!_#o!Bw#o#p!Ac#p;'S!Bw;'S;=`!Dd<%lO!Bw&n!DgP;=`<%l!Bw&n!DoX$e&jOY!=yYZ&cZ!^!=y!^!_!@Y!_#o!=y#o#p!@Y#p;'S!=y;'S;=`!E[<%lO!=y&n!E_P;=`<%l!=y(Q!Eki$e&j'|!b!SSOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#Z&}#Z#[!Eb#[#]&}#]#^!Eb#^#a&}#a#b!Eb#b#g&}#g#h!Eb#h#i&}#i#j!Eb#j#m&}#m#n!Eb#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!f!GaZ'|!b!SSOY!GYZw!GYwx!@Yx!P!GY!P!Q!HS!Q!}!GY!}#O!Ic#O#P!Bb#P;'S!GY;'S;=`!JZ<%lO!GY!f!HZb'|!b!SSOY'}Zw'}x#O'}#P#Z'}#Z#[!HS#[#]'}#]#^!HS#^#a'}#a#b!HS#b#g'}#g#h!HS#h#i'}#i#j!HS#j#m'}#m#n!HS#n;'S'};'S;=`(f<%lO'}!f!IhX'|!bOY!IcZw!Icwx!Acx#O!Ic#O#P!A{#P#Q!GY#Q;'S!Ic;'S;=`!JT<%lO!Ic!f!JWP;=`<%l!Ic!f!J^P;=`<%l!GY(Q!Jh^$e&j'|!bOY!JaYZ&cZw!Jawx!Bwx!^!Ja!^!_!Ic!_#O!Ja#O#P!Cr#P#Q!Q#V#X%Z#X#Y!4|#Y#b%Z#b#c#Zd$e&j'yp'|!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#?i!R!S#?i!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#?i#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l#?tf$e&j'yp'|!bm$'|OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#?i!R!S#?i!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#?i#S#b%Z#b#c#_2[i]||-1},{term:330,get:i=>x2[i]||-1},{term:68,get:i=>b2[i]||-1}],tokenPrec:12827}),Dy=[Si("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),Si("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),Si("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Si("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Si("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),Si(`try { +`;this.styleTag.textContent=o}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}}var nr={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:"'"},no={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},C_=typeof navigator<"u"&&/Mac/.test(navigator.platform),P_=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var li=0;li<10;li++)nr[48+li]=nr[96+li]=String(li);for(var li=1;li<=24;li++)nr[li+111]="F"+li;for(var li=65;li<=90;li++)nr[li]=String.fromCharCode(li+32),no[li]=String.fromCharCode(li);for(var bh in nr)no.hasOwnProperty(bh)||(no[bh]=nr[bh]);function k_(i){var t=C_&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||P_&&i.shiftKey&&i.key&&i.key.length==1||i.key=="Unidentified",e=!t&&i.key||(i.shiftKey?no:nr)[i.keyCode]||i.key||"Unidentified";return e=="Esc"&&(e="Escape"),e=="Del"&&(e="Delete"),e=="Left"&&(e="ArrowLeft"),e=="Up"&&(e="ArrowUp"),e=="Right"&&(e="ArrowRight"),e=="Down"&&(e="ArrowDown"),e}function Fa(i){let t;return i.nodeType==11?t=i.getSelection?i:i.ownerDocument:t=i,t.getSelection()}function $u(i,t){return t?i==t||i.contains(t.nodeType!=1?t.parentNode:t):!1}function L_(i){let t=i.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function ka(i,t){if(!t.anchorNode)return!1;try{return $u(i,t.anchorNode)}catch{return!1}}function ro(i){return i.nodeType==3?Ar(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function zs(i,t,e,n){return e?ad(i,t,e,n,-1)||ad(i,t,e,n,1):!1}function Lr(i){for(var t=0;;t++)if(i=i.previousSibling,!i)return t}function Xa(i){return i.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(i.nodeName)}function ad(i,t,e,n,r){for(;;){if(i==e&&t==n)return!0;if(t==(r<0?0:En(i))){if(i.nodeName=="DIV")return!1;let o=i.parentNode;if(!o||o.nodeType!=1)return!1;t=Lr(i)+(r<0?0:1),i=o}else if(i.nodeType==1){if(i=i.childNodes[t+(r<0?-1:0)],i.nodeType==1&&i.contentEditable=="false")return!1;t=r<0?En(i):0}else return!1}}function En(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function Tc(i,t){let e=t?i.left:i.right;return{left:e,right:e,top:i.top,bottom:i.bottom}}function A_(i){let t=i.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function Wm(i,t){let e=t.width/i.offsetWidth,n=t.height/i.offsetHeight;return(e>.995&&e<1.005||!isFinite(e)||Math.abs(t.width-i.offsetWidth)<1)&&(e=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.height-i.offsetHeight)<1)&&(n=1),{scaleX:e,scaleY:n}}function E_(i,t,e,n,r,o,s,a){let l=i.ownerDocument,u=l.defaultView||window;for(let c=i,d=!1;c&&!d;)if(c.nodeType==1){let f,g=c==l.body,x=1,m=1;if(g)f=A_(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(d=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let b=c.getBoundingClientRect();({scaleX:x,scaleY:m}=Wm(c,b)),f={left:b.left,right:b.left+c.clientWidth*x,top:b.top,bottom:b.top+c.clientHeight*m}}let v=0,O=0;if(r=="nearest")t.top0&&t.bottom>f.bottom+O&&(O=t.bottom-f.bottom+O+s)):t.bottom>f.bottom&&(O=t.bottom-f.bottom+s,e<0&&t.top-O0&&t.right>f.right+v&&(v=t.right-f.right+v+o)):t.right>f.right&&(v=t.right-f.right+o,e<0&&t.lefte.clientHeight||e.scrollWidth>e.clientWidth)return e;e=e.assignedSlot||e.parentNode}else if(e.nodeType==11)e=e.host;else break;return null}class T_{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:n}=t;this.set(e,Math.min(t.anchorOffset,e?En(e):0),n,Math.min(t.focusOffset,n?En(n):0))}set(t,e,n,r){this.anchorNode=t,this.anchorOffset=e,this.focusNode=n,this.focusOffset=r}}let Fr=null;function Um(i){if(i.setActive)return i.setActive();if(Fr)return i.focus(Fr);let t=[];for(let e=i;e&&(t.push(e,e.scrollTop,e.scrollLeft),e!=e.ownerDocument);e=e.parentNode);if(i.focus(Fr==null?{get preventScroll(){return Fr={preventScroll:!0},!0}}:void 0),!Fr){Fr=!1;for(let e=0;eMath.max(1,i.scrollHeight-i.clientHeight-4)}function qm(i,t){for(let e=i,n=t;;){if(e.nodeType==3&&n>0)return{node:e,offset:n};if(e.nodeType==1&&n>0){if(e.contentEditable=="false")return null;e=e.childNodes[n-1],n=En(e)}else if(e.parentNode&&!Xa(e))n=Lr(e),e=e.parentNode;else return null}}function Vm(i,t){for(let e=i,n=t;;){if(e.nodeType==3&&ne)return d.domBoundsAround(t,e,u);if(f>=t&&r==-1&&(r=l,o=u),u>e&&d.dom.parentNode==this.dom){s=l,a=c;break}c=f,u=f+d.breakAfter}return{from:o,to:a<0?n+this.length:a,startDOM:(r?this.children[r-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:s=0?this.children[s].dom:null}}markDirty(t=!1){this.flags|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),e.flags&1)return;e.flags|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.flags&7&&this.markParentsDirty(!0))}setDOM(t){this.dom!=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,n=Ic){this.markDirty();for(let r=t;rthis.pos||t==this.pos&&(e>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function Hm(i,t,e,n,r,o,s,a,l){let{children:u}=i,c=u.length?u[t]:null,d=o.length?o[o.length-1]:null,f=d?d.breakAfter:s;if(!(t==n&&c&&!s&&!f&&o.length<2&&c.merge(e,r,o.length?d:null,e==0,a,l))){if(n0&&(!s&&o.length&&c.merge(e,c.length,o[0],!1,a,0)?c.breakAfter=o.shift().breakAfter:(e2);var Ut={mac:fd||/Mac/.test($i.platform),windows:/Win/.test($i.platform),linux:/Linux|X11/.test($i.platform),ie:Al,ie_version:Km?Qu.documentMode||6:Bu?+Bu[1]:Nu?+Nu[1]:0,gecko:ud,gecko_version:ud?+(/Firefox\/(\d+)/.exec($i.userAgent)||[0,0])[1]:0,chrome:!!wh,chrome_version:wh?+wh[1]:0,ios:fd,android:/Android\b/.test($i.userAgent),webkit:cd,safari:tg,webkit_version:cd?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:Qu.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const $_=256;class en extends Te{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){t.nodeType==3&&this.createDOM(t)}merge(t,e,n){return this.flags&8||n&&(!(n instanceof en)||this.length-(e-t)+n.length>$_||n.flags&8)?!1:(this.text=this.text.slice(0,t)+(n?n.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new en(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=this.flags&8,e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new mi(this.dom,t)}domBoundsAround(t,e,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return Q_(this.dom,t,e)}}class Dn extends Te{constructor(t,e=[],n=0){super(),this.mark=t,this.children=e,this.length=n;for(let r of e)r.setParent(this)}setAttrs(t){if(zm(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}canReuseDOM(t){return super.canReuseDOM(t)&&!((this.flags|t.flags)&8)}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}sync(t,e){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,n,r,o,s){return n&&(!(n instanceof Dn&&n.mark.eq(this.mark))||t&&o<=0||et&&e.push(n=t&&(r=o),n=l,o++}let s=this.length-t;return this.length=t,r>-1&&(this.children.length=r,this.markDirty()),new Dn(this.mark,e,s)}domAtPos(t){return eg(this,t)}coordsAt(t,e){return ng(this,t,e)}}function Q_(i,t,e){let n=i.nodeValue.length;t>n&&(t=n);let r=t,o=t,s=0;t==0&&e<0||t==n&&e>=0?Ut.chrome||Ut.gecko||(t?(r--,s=1):o=0)?0:a.length-1];return Ut.safari&&!s&&l.width==0&&(l=Array.prototype.find.call(a,u=>u.width)||l),s?Tc(l,s<0):l||null}class Vn extends Te{static create(t,e,n){return new Vn(t,e,n)}constructor(t,e,n){super(),this.widget=t,this.length=e,this.side=n,this.prevWidget=null}split(t){let e=Vn.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(t){(!this.dom||!this.widget.updateDOM(this.dom,t))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(t,e,n,r,o,s){return n&&(!(n instanceof Vn)||!this.widget.compare(n.widget)||t>0&&o<=0||e0)?mi.before(this.dom):mi.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let n=this.widget.coordsAt(this.dom,t,e);if(n)return n;let r=this.dom.getClientRects(),o=null;if(!r.length)return null;let s=this.side?this.side<0:t>0;for(let a=s?r.length-1:0;o=r[a],!(t>0?a==0:a==r.length-1||o.top0?mi.before(this.dom):mi.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return we.empty}get isHidden(){return!0}}en.prototype.children=Vn.prototype.children=us.prototype.children=Ic;function eg(i,t){let e=i.dom,{children:n}=i,r=0;for(let o=0;ro&&t0;o--){let s=n[o-1];if(s.dom.parentNode==e)return s.domAtPos(s.length)}for(let o=r;o0&&t instanceof Dn&&r.length&&(n=r[r.length-1])instanceof Dn&&n.mark.eq(t.mark)?ig(n,t.children[0],e-1):(r.push(t),t.setParent(i)),i.length+=t.length}function ng(i,t,e){let n=null,r=-1,o=null,s=-1;function a(u,c){for(let d=0,f=0;d=c&&(g.children.length?a(g,c-f):(!o||o.isHidden&&e>0)&&(x>c||f==x&&g.getSide()>0)?(o=g,s=c-f):(f-1?1:0)!=r.length-(e&&r.indexOf(e)>-1?1:0))return!1;for(let o of n)if(o!=e&&(r.indexOf(o)==-1||i[o]!==t[o]))return!1;return!0}function Xu(i,t,e){let n=!1;if(t)for(let r in t)e&&r in e||(n=!0,r=="style"?i.style.cssText="":i.removeAttribute(r));if(e)for(let r in e)t&&t[r]==e[r]||(n=!0,r=="style"?i.style.cssText=e[r]:i.setAttribute(r,e[r]));return n}function B_(i){let t=Object.create(null);for(let e=0;e0&&this.children[n-1].length==0;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){Mc(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){ig(this,t,e)}addLineDeco(t){let e=t.spec.attributes,n=t.spec.class;e&&(this.attrs=Fu(e,this.attrs||{})),n&&(this.attrs=Fu({class:n},this.attrs||{}))}domAtPos(t){return eg(this,t)}reuseDOM(t){t.nodeName=="DIV"&&(this.setDOM(t),this.flags|=6)}sync(t,e){var n;this.dom?this.flags&4&&(zm(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&&(Xu(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t,e);let r=this.dom.lastChild;for(;r&&Te.get(r)instanceof Dn;)r=r.lastChild;if(!r||!this.length||r.nodeName!="BR"&&((n=Te.get(r))===null||n===void 0?void 0:n.isEditable)==!1&&(!Ut.ios||!this.children.some(o=>o instanceof en))){let o=document.createElement("BR");o.cmIgnore=!0,this.dom.appendChild(o)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let t=0,e;for(let n of this.children){if(!(n instanceof en)||/[^ -~]/.test(n.text))return null;let r=ro(n.dom);if(r.length!=1)return null;t+=r[0].width,e=r[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:e}:null}coordsAt(t,e){let n=ng(this,t,e);if(!this.children.length&&n&&this.parent){let{heightOracle:r}=this.parent.view.viewState,o=n.bottom-n.top;if(Math.abs(o-r.lineHeight)<2&&r.textHeight=e){if(o instanceof je)return o;if(s>e)break}r=s+o.breakAfter}return null}}class Jn extends Te{constructor(t,e,n){super(),this.widget=t,this.length=e,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(t,e,n,r,o,s){return n&&(!(n instanceof Jn)||!this.widget.compare(n.widget)||t>0&&o<=0||e0}}class Mn{eq(t){return!1}updateDOM(t,e){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}}var xi=function(i){return i[i.Text=0]="Text",i[i.WidgetBefore=1]="WidgetBefore",i[i.WidgetAfter=2]="WidgetAfter",i[i.WidgetRange=3]="WidgetRange",i}(xi||(xi={}));class Gt extends kr{constructor(t,e,n,r){super(),this.startSide=t,this.endSide=e,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(t){return new xo(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),n=!!t.block;return e+=n&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new rr(t,e,e,n,t.widget||null,!1)}static replace(t){let e=!!t.block,n,r;if(t.isBlockGap)n=-5e8,r=4e8;else{let{start:o,end:s}=rg(t,e);n=(o?e?-3e8:-1:5e8)-1,r=(s?e?2e8:1:-6e8)+1}return new rr(t,n,r,e,t.widget||null,!0)}static line(t){return new bo(t)}static set(t,e=!1){return ge.of(t,e)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Gt.none=ge.empty;class xo extends Gt{constructor(t){let{start:e,end:n}=rg(t);super(e?-1:5e8,n?1:-6e8,null,t),this.tagName=t.tagName||"span",this.class=t.class||"",this.attrs=t.attributes||null}eq(t){var e,n;return this==t||t instanceof xo&&this.tagName==t.tagName&&(this.class||((e=this.attrs)===null||e===void 0?void 0:e.class))==(t.class||((n=t.attrs)===null||n===void 0?void 0:n.class))&&Mc(this.attrs,t.attrs,"class")}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}xo.prototype.point=!1;class bo extends Gt{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof bo&&this.spec.class==t.spec.class&&Mc(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)}}bo.prototype.mapMode=Je.TrackBefore;bo.prototype.point=!0;class rr extends Gt{constructor(t,e,n,r,o,s){super(e,n,o,t),this.block=r,this.isReplace=s,this.mapMode=r?e<=0?Je.TrackBefore:Je.TrackAfter:Je.TrackDel}get type(){return this.startSide!=this.endSide?xi.WidgetRange:this.startSide<=0?xi.WidgetBefore:xi.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof rr&&F_(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)}}rr.prototype.point=!0;function rg(i,t=!1){let{inclusiveStart:e,inclusiveEnd:n}=i;return e==null&&(e=i.inclusive),n==null&&(n=i.inclusive),{start:e??t,end:n??t}}function F_(i,t){return i==t||!!(i&&t&&i.compare(t))}function Ru(i,t,e,n=0){let r=e.length-1;r>=0&&e[r]+n>=i?e[r]=Math.max(e[r],t):e.push(i,t)}class js{constructor(t,e,n,r){this.doc=t,this.pos=e,this.end=n,this.disallowBlockEffectsFor=r,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],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 Jn&&t.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new je),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(zo(new us(-1),t),t.length),this.pendingBuffer=0)}addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(t&&this.content.length&&this.content[this.content.length-1]instanceof Jn)&&this.getLine()}buildText(t,e,n){for(;t>0;){if(this.textOff==this.text.length){let{value:o,lineBreak:s,done:a}=this.cursor.next(this.skip);if(this.skip=0,a)throw new Error("Ran out of text content when drawing inline views");if(s){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,t--;continue}else this.text=o,this.textOff=0}let r=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-n)),this.getLine().append(zo(new en(this.text.slice(this.textOff,this.textOff+r)),e),n),this.atCursorPos=!0,this.textOff+=r,t-=r,n=0}}span(t,e,n,r){this.buildText(e-t,n,r),this.pos=e,this.openStart<0&&(this.openStart=r)}point(t,e,n,r,o,s){if(this.disallowBlockEffectsFor[s]&&n instanceof rr){if(n.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")}let a=e-t;if(n instanceof rr)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Jn(n.widget||cs.block,a,n));else{let l=Vn.create(n.widget||cs.inline,a,a?0:n.startSide),u=this.atCursorPos&&!l.isEditable&&o<=r.length&&(t0),c=!l.isEditable&&(tr.length||n.startSide<=0),d=this.getLine();this.pendingBuffer==2&&!u&&!l.isEditable&&(this.pendingBuffer=0),this.flushBuffer(r),u&&(d.append(zo(new us(1),r),o),o=r.length+Math.max(0,o-r.length)),d.append(zo(l,r),o),this.atCursorPos=c,this.pendingBuffer=c?tr.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=r.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);a&&(this.textOff+a<=this.text.length?this.textOff+=a:(this.skip+=a-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=o)}static build(t,e,n,r,o){let s=new js(t,e,n,o);return s.openEnd=ge.spans(r,e,n,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function zo(i,t){for(let e of t)i=new Dn(e,[i],i.length);return i}class cs extends Mn{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}get isHidden(){return!0}}cs.inline=new cs("span");cs.block=new cs("div");var Me=function(i){return i[i.LTR=0]="LTR",i[i.RTL=1]="RTL",i}(Me||(Me={}));const Er=Me.LTR,$c=Me.RTL;function sg(i){let t=[];for(let e=0;e=e){if(a.level==n)return s;(o<0||(r!=0?r<0?a.frome:t[o].level>a.level))&&(o=s)}}if(o<0)throw new RangeError("Index out of range");return o}}function ag(i,t){if(i.length!=t.length)return!1;for(let e=0;e=0;m-=3)if(an[m+1]==-g){let v=an[m+2],O=v&2?r:v&4?v&1?o:r:0;O&&(De[d]=De[an[m]]=O),a=m;break}}else{if(an.length==189)break;an[a++]=d,an[a++]=f,an[a++]=l}else if((x=De[d])==2||x==1){let m=x==r;l=m?0:1;for(let v=a-3;v>=0;v-=3){let O=an[v+2];if(O&2)break;if(m)an[v+2]|=2;else{if(O&4)break;an[v+2]|=4}}}}}function U_(i,t,e,n){for(let r=0,o=n;r<=e.length;r++){let s=r?e[r-1].to:i,a=rl;)x==v&&(x=e[--m].from,v=m?e[m-1].to:i),De[--x]=g;l=c}else o=u,l++}}}function Zu(i,t,e,n,r,o,s){let a=n%2?2:1;if(n%2==r%2)for(let l=t,u=0;ll&&s.push(new Gn(l,m.from,g));let v=m.direction==Er!=!(g%2);Wu(i,v?n+1:n,r,m.inner,m.from,m.to,s),l=m.to}x=m.to}else{if(x==e||(c?De[x]!=a:De[x]==a))break;x++}f?Zu(i,l,x,n+1,r,f,s):lt;){let c=!0,d=!1;if(!u||l>o[u-1].to){let m=De[l-1];m!=a&&(c=!1,d=m==16)}let f=!c&&a==1?[]:null,g=c?n:n+1,x=l;t:for(;;)if(u&&x==o[u-1].to){if(d)break t;let m=o[--u];if(!c)for(let v=m.from,O=u;;){if(v==t)break t;if(O&&o[O-1].to==v)v=o[--O].from;else{if(De[v-1]==a)break t;break}}if(f)f.push(m);else{m.toDe.length;)De[De.length]=256;let n=[],r=t==Er?0:1;return Wu(i,r,r,e,0,i.length,n),n}function lg(i){return[new Gn(0,i,0)]}let hg="";function j_(i,t,e,n,r){var o;let s=n.head-i.from,a=Gn.find(t,s,(o=n.bidiLevel)!==null&&o!==void 0?o:-1,n.assoc),l=t[a],u=l.side(r,e);if(s==u){let f=a+=r?1:-1;if(f<0||f>=t.length)return null;l=t[a=f],s=l.side(!r,e),u=l.side(r,e)}let c=gi(i.text,s,l.forward(r,e));(cl.to)&&(c=u),hg=i.text.slice(Math.min(s,c),Math.max(s,c));let d=a==(r?t.length-1:0)?null:t[a+(r?1:-1)];return d&&c==u&&d.level+(r?0:1)i.some(t=>t)}),vg=Zt.define({combine:i=>i.some(t=>t)}),yg=Zt.define();class Jr{constructor(t,e="nearest",n="nearest",r=5,o=5,s=!1){this.range=t,this.y=e,this.x=n,this.yMargin=r,this.xMargin=o,this.isSnapshot=s}map(t){return t.empty?this:new Jr(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new Jr(yt.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const jo=re.define({map:(i,t)=>i.map(t)});function Pi(i,t,e){let n=i.facet(dg);n.length?n[0](t):window.onerror?window.onerror(String(t),e,void 0,void 0,t):e?console.error(e+":",t):console.error(t)}const El=Zt.define({combine:i=>i.length?i[0]:!0});let V_=0;const Qs=Zt.define();class Fe{constructor(t,e,n,r,o){this.id=t,this.create=e,this.domEventHandlers=n,this.domEventObservers=r,this.extension=o(this)}static define(t,e){const{eventHandlers:n,eventObservers:r,provide:o,decorations:s}=e||{};return new Fe(V_++,t,n,r,a=>{let l=[Qs.of(a)];return s&&l.push(so.of(u=>{let c=u.plugin(a);return c?s(c):Gt.none})),o&&l.push(o(a)),l})}static fromClass(t,e){return Fe.define(n=>new t(n),e)}}class Sh{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}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(n){if(Pi(e.state,n,"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){Pi(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(!((e=this.value)===null||e===void 0)&&e.destroy)try{this.value.destroy()}catch(n){Pi(t.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Og=Zt.define(),Qc=Zt.define(),so=Zt.define(),_g=Zt.define(),Nc=Zt.define(),xg=Zt.define();function pd(i,t){let e=i.state.facet(xg);if(!e.length)return e;let n=e.map(o=>o instanceof Function?o(i):o),r=[];return ge.spans(n,t.from,t.to,{point(){},span(o,s,a,l){let u=o-t.from,c=s-t.from,d=r;for(let f=a.length-1;f>=0;f--,l--){let g=a[f].spec.bidiIsolate,x;if(g==null&&(g=q_(t.text,u,c)),l>0&&d.length&&(x=d[d.length-1]).to==u&&x.direction==g)x.to=c,d=x.inner;else{let m={from:u,to:c,direction:g,inner:[]};d.push(m),d=m.inner}}}}),r}const bg=Zt.define();function wg(i){let t=0,e=0,n=0,r=0;for(let o of i.state.facet(bg)){let s=o(i);s&&(s.left!=null&&(t=Math.max(t,s.left)),s.right!=null&&(e=Math.max(e,s.right)),s.top!=null&&(n=Math.max(n,s.top)),s.bottom!=null&&(r=Math.max(r,s.bottom)))}return{left:t,right:e,top:n,bottom:r}}const Ns=Zt.define();class zi{constructor(t,e,n,r){this.fromA=t,this.toA=e,this.fromB=n,this.toB=r}join(t){return new zi(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,n=this;for(;e>0;e--){let r=t[e-1];if(!(r.fromA>n.toA)){if(r.toAc)break;o+=2}if(!l)return n;new zi(l.fromA,l.toA,l.fromB,l.toB).addToSet(n),s=l.toA,a=l.toB}}}class Ra{constructor(t,e,n){this.view=t,this.state=e,this.transactions=n,this.flags=0,this.startState=t.state,this.changes=Ge.empty(this.startState.doc.length);for(let o of n)this.changes=this.changes.compose(o.changes);let r=[];this.changes.iterChangedRanges((o,s,a,l)=>r.push(new zi(o,s,a,l))),this.changedRanges=r}static create(t,e,n){return new Ra(t,e,n)}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}}class md extends Te{get length(){return this.view.state.doc.length}constructor(t){super(),this.view=t,this.decorations=[],this.dynamicDecorationMap=[],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new je],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new zi(0,0,0,t.state.doc.length)],0,null)}update(t){var e;let n=t.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:u,toA:c})=>cthis.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let r=-1;this.view.inputState.composing>=0&&(!((e=this.domChanged)===null||e===void 0)&&e.newSel?r=this.domChanged.newSel.head:!ix(t.changes,this.hasComposition)&&!t.selectionSet&&(r=t.state.selection.main.head));let o=r>-1?H_(this.view,t.changes,r):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:u,to:c}=this.hasComposition;n=new zi(u,c,t.changes.mapPos(u,-1),t.changes.mapPos(c,1)).addToSet(n.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(Ut.ie||Ut.chrome)&&!o&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let s=this.decorations,a=this.updateDeco(),l=tx(s,a,t.changes);return n=zi.extendWithRanges(n,l),!(this.flags&7)&&n.length==0?!1:(this.updateInner(n,t.startState.doc.length,o),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,n);let{observer:r}=this.view;r.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=Ut.chrome||Ut.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,s),this.flags&=-8,s&&(s.written||r.selectionRange.focusNode!=s.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(s=>s.flags&=-9);let o=[];if(this.view.viewport.from||this.view.viewport.to=0?r[s]:null;if(!a)break;let{fromA:l,toA:u,fromB:c,toB:d}=a,f,g,x,m;if(n&&n.range.fromBc){let E=js.build(this.view.state.doc,c,n.range.fromB,this.decorations,this.dynamicDecorationMap),$=js.build(this.view.state.doc,n.range.toB,d,this.decorations,this.dynamicDecorationMap);g=E.breakAtStart,x=E.openStart,m=$.openEnd;let Q=this.compositionView(n);$.breakAtStart?Q.breakAfter=1:$.content.length&&Q.merge(Q.length,Q.length,$.content[0],!1,$.openStart,0)&&(Q.breakAfter=$.content[0].breakAfter,$.content.shift()),E.content.length&&Q.merge(0,0,E.content[E.content.length-1],!0,0,E.openEnd)&&E.content.pop(),f=E.content.concat(Q).concat($.content)}else({content:f,breakAtStart:g,openStart:x,openEnd:m}=js.build(this.view.state.doc,c,d,this.decorations,this.dynamicDecorationMap));let{i:v,off:O}=o.findPos(u,1),{i:b,off:k}=o.findPos(l,-1);Hm(this,b,k,v,O,f,g,x,m)}n&&this.fixCompositionDOM(n)}compositionView(t){let e=new en(t.text.nodeValue);e.flags|=8;for(let{deco:r}of t.marks)e=new Dn(r,[e],e.length);let n=new je;return n.append(e,0),n}fixCompositionDOM(t){let e=(o,s)=>{s.flags|=8|(s.children.some(l=>l.flags&7)?1:0),this.markedForComposition.add(s);let a=Te.get(o);a&&a!=s&&(a.dom=null),s.setDOM(o)},n=this.childPos(t.range.fromB,1),r=this.children[n.i];e(t.line,r);for(let o=t.marks.length-1;o>=-1;o--)n=r.childPos(n.off,1),r=r.children[n.i],e(o>=0?t.marks[o].node:t.text,r)}updateSelection(t=!1,e=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let n=this.view.root.activeElement,r=n==this.dom,o=!r&&ka(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(r||e||o))return;let s=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(a.anchor)),u=a.empty?l:this.moveToLine(this.domAtPos(a.head));if(Ut.gecko&&a.empty&&!this.hasComposition&&G_(l)){let d=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(d,l.node.childNodes[l.offset]||null)),l=u=new mi(d,0),s=!0}let c=this.view.observer.selectionRange;(s||!c.focusNode||(!zs(l.node,l.offset,c.anchorNode,c.anchorOffset)||!zs(u.node,u.offset,c.focusNode,c.focusOffset))&&!this.suppressWidgetCursorChange(c,a))&&(this.view.observer.ignore(()=>{Ut.android&&Ut.chrome&&this.dom.contains(c.focusNode)&&ex(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let d=Fa(this.view.root);if(d)if(a.empty){if(Ut.gecko){let f=J_(l.node,l.offset);if(f&&f!=3){let g=(f==1?qm:Vm)(l.node,l.offset);g&&(l=new mi(g.node,g.offset))}}d.collapse(l.node,l.offset),a.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=a.bidiLevel)}else if(d.extend){d.collapse(l.node,l.offset);try{d.extend(u.node,u.offset)}catch{}}else{let f=document.createRange();a.anchor>a.head&&([l,u]=[u,l]),f.setEnd(u.node,u.offset),f.setStart(l.node,l.offset),d.removeAllRanges(),d.addRange(f)}o&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(l,u)),this.impreciseAnchor=l.precise?null:new mi(c.anchorNode,c.anchorOffset),this.impreciseHead=u.precise?null:new mi(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&zs(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,n=Fa(t.root),{anchorNode:r,anchorOffset:o}=t.observer.selectionRange;if(!n||!e.empty||!e.assoc||!n.modify)return;let s=je.find(this,e.head);if(!s)return;let a=s.posAtStart;if(e.head==a||e.head==a+s.length)return;let l=this.coordsAt(e.head,-1),u=this.coordsAt(e.head,1);if(!l||!u||l.bottom>u.top)return;let c=this.domAtPos(e.head+e.assoc);n.collapse(c.node,c.offset),n.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let d=t.observer.selectionRange;t.docView.posFromDOM(d.anchorNode,d.anchorOffset)!=e.from&&n.collapse(r,o)}moveToLine(t){let e=this.dom,n;if(t.node!=e)return t;for(let r=t.offset;!n&&r=0;r--){let o=Te.get(e.childNodes[r]);o instanceof je&&(n=o.domAtPos(o.length))}return n?new mi(n.node,n.offset,!0):t}nearest(t){for(let e=t;e;){let n=Te.get(e);if(n&&n.rootView==this)return n;e=e.parentNode}return null}posFromDOM(t,e){let n=this.nearest(t);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(t,e)+n.posAtStart}domAtPos(t){let{i:e,off:n}=this.childCursor().findPos(t,-1);for(;e=0;s--){let a=this.children[s],l=o-a.breakAfter,u=l-a.length;if(lt||a.covers(1))&&(!n||a instanceof je&&!(n instanceof je&&e>=0))&&(n=a,r=u),o=u}return n?n.coordsAt(t-r,e):null}coordsForChar(t){let{i:e,off:n}=this.childPos(t,1),r=this.children[e];if(!(r instanceof je))return null;for(;r.children.length;){let{i:a,off:l}=r.childPos(n,1);for(;;a++){if(a==r.children.length)return null;if((r=r.children[a]).length)break}n=l}if(!(r instanceof en))return null;let o=gi(r.text,n);if(o==n)return null;let s=Ar(r.dom,n,o).getClientRects();for(let a=0;aMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==Me.LTR;for(let u=0,c=0;cr)break;if(u>=n){let g=d.dom.getBoundingClientRect();if(e.push(g.height),s){let x=d.dom.lastChild,m=x?ro(x):[];if(m.length){let v=m[m.length-1],O=l?v.right-g.left:g.right-v.left;O>a&&(a=O,this.minWidth=o,this.minWidthFrom=u,this.minWidthTo=f)}}}u=f+d.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return getComputedStyle(this.children[e].dom).direction=="rtl"?Me.RTL:Me.LTR}measureTextSize(){for(let o of this.children)if(o instanceof je){let s=o.measureTextSize();if(s)return s}let t=document.createElement("div"),e,n,r;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(t);let o=ro(t.firstChild)[0];e=t.getBoundingClientRect().height,n=o?o.width/27:7,r=o?o.height:e,t.remove()}),{lineHeight:e,charWidth:n,textHeight:r}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new Gm(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let n=0,r=0;;r++){let o=r==e.viewports.length?null:e.viewports[r],s=o?o.from-1:this.length;if(s>n){let a=(e.lineBlockAt(s).bottom-e.lineBlockAt(n).top)/this.view.scaleY;t.push(Gt.replace({widget:new gd(a),block:!0,inclusive:!0,isBlockGap:!0}).range(n,s))}if(!o)break;n=o.to+1}return Gt.set(t)}updateDeco(){let t=0,e=this.view.state.facet(so).map(o=>(this.dynamicDecorationMap[t++]=typeof o=="function")?o(this.view):o),n=!1,r=this.view.state.facet(_g).map((o,s)=>{let a=typeof o=="function";return a&&(n=!0),a?o(this.view):o});for(r.length&&(this.dynamicDecorationMap[t++]=n,e.push(ge.join(r))),this.decorations=[...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];te.anchor?-1:1),r;if(!n)return;!e.empty&&(r=this.coordsAt(e.anchor,e.anchor>e.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let o=wg(this.view),s={left:n.left-o.left,top:n.top-o.top,right:n.right+o.right,bottom:n.bottom+o.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;E_(this.view.scrollDOM,s,e.head{nt.from&&(e=!0)}),e}function nx(i,t,e=1){let n=i.charCategorizer(t),r=i.doc.lineAt(t),o=t-r.from;if(r.length==0)return yt.cursor(t);o==0?e=1:o==r.length&&(e=-1);let s=o,a=o;e<0?s=gi(r.text,o,!1):a=gi(r.text,o);let l=n(r.text.slice(s,a));for(;s>0;){let u=gi(r.text,s,!1);if(n(r.text.slice(u,s))!=l)break;s=u}for(;ai?t.left-i:Math.max(0,i-t.right)}function sx(i,t){return t.top>i?t.top-i:Math.max(0,i-t.bottom)}function Ch(i,t){return i.topt.top+1}function vd(i,t){return ti.bottom?{top:i.top,left:i.left,right:i.right,bottom:t}:i}function zu(i,t,e){let n,r,o,s,a=!1,l,u,c,d;for(let x=i.firstChild;x;x=x.nextSibling){let m=ro(x);for(let v=0;vk||s==k&&o>b){n=x,r=O,o=b,s=k;let E=k?e0?v0)}b==0?e>O.bottom&&(!c||c.bottomO.top)&&(u=x,d=O):c&&Ch(c,O)?c=yd(c,O.bottom):d&&Ch(d,O)&&(d=vd(d,O.top))}}if(c&&c.bottom>=e?(n=l,r=c):d&&d.top<=e&&(n=u,r=d),!n)return{node:i,offset:0};let f=Math.max(r.left,Math.min(r.right,t));if(n.nodeType==3)return Od(n,f,e);if(a&&n.contentEditable!="false")return zu(n,f,e);let g=Array.prototype.indexOf.call(i.childNodes,n)+(t>=(r.left+r.right)/2?1:0);return{node:i,offset:g}}function Od(i,t,e){let n=i.nodeValue.length,r=-1,o=1e9,s=0;for(let a=0;ae?c.top-e:e-c.bottom)-1;if(c.left-1<=t&&c.right+1>=t&&d=(c.left+c.right)/2,g=f;if((Ut.chrome||Ut.gecko)&&Ar(i,a).getBoundingClientRect().left==c.right&&(g=!f),d<=0)return{node:i,offset:a+(g?1:0)};r=a+(g?1:0),o=d}}}return{node:i,offset:r>-1?r:s>0?i.nodeValue.length:0}}function Cg(i,t,e,n=-1){var r,o;let s=i.contentDOM.getBoundingClientRect(),a=s.top+i.viewState.paddingTop,l,{docHeight:u}=i.viewState,{x:c,y:d}=t,f=d-a;if(f<0)return 0;if(f>u)return i.state.doc.length;for(let E=i.viewState.heightOracle.textHeight/2,$=!1;l=i.elementAtHeight(f),l.type!=xi.Text;)for(;f=n>0?l.bottom+E:l.top-E,!(f>=0&&f<=u);){if($)return e?null:0;$=!0,n=-n}d=a+f;let g=l.from;if(gi.viewport.to)return i.viewport.to==i.state.doc.length?i.state.doc.length:e?null:_d(i,s,l,c,d);let x=i.dom.ownerDocument,m=i.root.elementFromPoint?i.root:x,v=m.elementFromPoint(c,d);v&&!i.contentDOM.contains(v)&&(v=null),v||(c=Math.max(s.left+1,Math.min(s.right-1,c)),v=m.elementFromPoint(c,d),v&&!i.contentDOM.contains(v)&&(v=null));let O,b=-1;if(v&&((r=i.docView.nearest(v))===null||r===void 0?void 0:r.isEditable)!=!1){if(x.caretPositionFromPoint){let E=x.caretPositionFromPoint(c,d);E&&({offsetNode:O,offset:b}=E)}else if(x.caretRangeFromPoint){let E=x.caretRangeFromPoint(c,d);E&&({startContainer:O,startOffset:b}=E,(!i.contentDOM.contains(O)||Ut.safari&&ox(O,b,c)||Ut.chrome&&ax(O,b,c))&&(O=void 0))}}if(!O||!i.docView.dom.contains(O)){let E=je.find(i.docView,g);if(!E)return f>l.top+l.height/2?l.to:l.from;({node:O,offset:b}=zu(E.dom,c,d))}let k=i.docView.nearest(O);if(!k)return null;if(k.isWidget&&((o=k.dom)===null||o===void 0?void 0:o.nodeType)==1){let E=k.dom.getBoundingClientRect();return t.yi.defaultLineHeight*1.5){let a=i.viewState.heightOracle.textHeight,l=Math.floor((r-e.top-(i.defaultLineHeight-a)*.5)/a);o+=l*i.viewState.heightOracle.lineLength}let s=i.state.sliceDoc(e.from,e.to);return e.from+Tu(s,o,i.state.tabSize)}function ox(i,t,e){let n;if(i.nodeType!=3||t!=(n=i.nodeValue.length))return!1;for(let r=i.nextSibling;r;r=r.nextSibling)if(r.nodeType!=1||r.nodeName!="BR")return!1;return Ar(i,n-1,n).getBoundingClientRect().left>e}function ax(i,t,e){if(t!=0)return!1;for(let r=i;;){let o=r.parentNode;if(!o||o.nodeType!=1||o.firstChild!=r)return!1;if(o.classList.contains("cm-line"))break;r=o}let n=i.nodeType==1?i.getBoundingClientRect():Ar(i,0,Math.max(i.nodeValue.length,1)).getBoundingClientRect();return e-n.left>5}function ju(i,t){let e=i.lineBlockAt(t);if(Array.isArray(e.type)){for(let n of e.type)if(n.to>t||n.to==t&&(n.to==e.to||n.type==xi.Text))return n}return e}function lx(i,t,e,n){let r=ju(i,t.head),o=!n||r.type!=xi.Text||!(i.lineWrapping||r.widgetLineBreaks)?null:i.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head);if(o){let s=i.dom.getBoundingClientRect(),a=i.textDirectionAt(r.from),l=i.posAtCoords({x:e==(a==Me.LTR)?s.right-1:s.left+1,y:(o.top+o.bottom)/2});if(l!=null)return yt.cursor(l,e?-1:1)}return yt.cursor(e?r.to:r.from,e?-1:1)}function xd(i,t,e,n){let r=i.state.doc.lineAt(t.head),o=i.bidiSpans(r),s=i.textDirectionAt(r.from);for(let a=t,l=null;;){let u=j_(r,o,s,a,e),c=hg;if(!u){if(r.number==(e?i.state.doc.lines:1))return a;c=` +`,r=i.state.doc.line(r.number+(e?1:-1)),o=i.bidiSpans(r),u=i.visualLineSide(r,!e)}if(l){if(!l(c))return a}else{if(!n)return u;l=n(c)}a=u}}function hx(i,t,e){let n=i.state.charCategorizer(t),r=n(e);return o=>{let s=n(o);return r==Ne.Space&&(r=s),r==s}}function ux(i,t,e,n){let r=t.head,o=e?1:-1;if(r==(e?i.state.doc.length:0))return yt.cursor(r,t.assoc);let s=t.goalColumn,a,l=i.contentDOM.getBoundingClientRect(),u=i.coordsAtPos(r,t.assoc||-1),c=i.documentTop;if(u)s==null&&(s=u.left-l.left),a=o<0?u.top:u.bottom;else{let g=i.viewState.lineBlockAt(r);s==null&&(s=Math.min(l.right-l.left,i.defaultCharacterWidth*(r-g.from))),a=(o<0?g.top:g.bottom)+c}let d=l.left+s,f=n??i.viewState.heightOracle.textHeight>>1;for(let g=0;;g+=10){let x=a+(f+g)*o,m=Cg(i,{x:d,y:x},!1,o);if(xl.bottom||(o<0?mr)){let v=i.docView.coordsForChar(m),O=!v||x{if(t>o&&tr(i)),e.from,t.head>e.from?-1:1);return n==e.from?e:yt.cursor(n,nnull),Ut.gecko&&kx(t.contentDOM.ownerDocument)}handleEvent(t){!Ox(this.view,t)||this.ignoreDuringComposition(t)||t.type=="keydown"&&this.keydown(t)||this.runHandlers(t.type,t)}runHandlers(t,e){let n=this.handlers[t];if(n){for(let r of n.observers)r(this.view,e);for(let r of n.handlers){if(e.defaultPrevented)break;if(r(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=fx(t),n=this.handlers,r=this.view.contentDOM;for(let o in e)if(o!="scroll"){let s=!e[o].handlers.length,a=n[o];a&&s!=!a.handlers.length&&(r.removeEventListener(o,this.handleEvent),a=null),a||r.addEventListener(o,this.handleEvent,{passive:s})}for(let o in n)o!="scroll"&&!e[o]&&r.removeEventListener(o,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&Date.now()n.keyCode==t.keyCode))&&!t.ctrlKey||dx.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0):(t.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(t){let e=this.pendingIOSKey;return!e||e.key=="Enter"&&t&&t.from0?!0:Ut.safari&&!Ut.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function bd(i,t){return(e,n)=>{try{return t.call(i,n,e)}catch(r){Pi(e.state,r)}}}function fx(i){let t=Object.create(null);function e(n){return t[n]||(t[n]={observers:[],handlers:[]})}for(let n of i){let r=n.spec;if(r&&r.domEventHandlers)for(let o in r.domEventHandlers){let s=r.domEventHandlers[o];s&&e(o).handlers.push(bd(n.value,s))}if(r&&r.domEventObservers)for(let o in r.domEventObservers){let s=r.domEventObservers[o];s&&e(o).observers.push(bd(n.value,s))}}for(let n in nn)e(n).handlers.push(nn[n]);for(let n in ji)e(n).observers.push(ji[n]);return t}const Pg=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],dx="dthko",kg=[16,17,18,20,91,92,224,225],qo=6;function Vo(i){return Math.max(0,i)*.7+8}function px(i,t){return Math.max(Math.abs(i.clientX-t.clientX),Math.abs(i.clientY-t.clientY))}class mx{constructor(t,e,n,r){this.view=t,this.startEvent=e,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParent=D_(t.contentDOM),this.atoms=t.state.facet(Nc).map(s=>s(t));let o=t.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(Oe.allowMultipleSelections)&&gx(t,e),this.dragging=yx(t,e)&&Dg(e)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){var e;if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&px(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let n=0,r=0,o=((e=this.scrollParent)===null||e===void 0?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},s=wg(this.view);t.clientX-s.left<=o.left+qo?n=-Vo(o.left-t.clientX):t.clientX+s.right>=o.right-qo&&(n=Vo(t.clientX-o.right)),t.clientY-s.top<=o.top+qo?r=-Vo(o.top-t.clientY):t.clientY+s.bottom>=o.bottom-qo&&(r=Vo(t.clientY-o.bottom)),this.setScrollSpeed(n,r)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(t){let e=null;for(let n=0;nthis.select(this.lastEvent),20)}}function gx(i,t){let e=i.state.facet(ug);return e.length?e[0](t):Ut.mac?t.metaKey:t.ctrlKey}function vx(i,t){let e=i.state.facet(cg);return e.length?e[0](t):Ut.mac?!t.altKey:!t.ctrlKey}function yx(i,t){let{main:e}=i.state.selection;if(e.empty)return!1;let n=Fa(i.root);if(!n||n.rangeCount==0)return!0;let r=n.getRangeAt(0).getClientRects();for(let o=0;o=t.clientX&&s.top<=t.clientY&&s.bottom>=t.clientY)return!0}return!1}function Ox(i,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target,n;e!=i.contentDOM;e=e.parentNode)if(!e||e.nodeType==11||(n=Te.get(e))&&n.ignoreEvent(t))return!1;return!0}const nn=Object.create(null),ji=Object.create(null),Lg=Ut.ie&&Ut.ie_version<15||Ut.ios&&Ut.webkit_version<604;function _x(i){let t=i.dom.parentNode;if(!t)return;let e=t.appendChild(document.createElement("textarea"));e.style.cssText="position: fixed; left: -10000px; top: 10px",e.focus(),setTimeout(()=>{i.focus(),e.remove(),Ag(i,e.value)},50)}function Ag(i,t){let{state:e}=i,n,r=1,o=e.toText(t),s=o.lines==e.selection.ranges.length;if(qu!=null&&e.selection.ranges.every(l=>l.empty)&&qu==o.toString()){let l=-1;n=e.changeByRange(u=>{let c=e.doc.lineAt(u.from);if(c.from==l)return{range:u};l=c.from;let d=e.toText((s?o.line(r++).text:t)+e.lineBreak);return{changes:{from:c.from,insert:d},range:yt.cursor(u.from+d.length)}})}else s?n=e.changeByRange(l=>{let u=o.line(r++);return{changes:{from:l.from,to:l.to,insert:u.text},range:yt.cursor(l.from+u.length)}}):n=e.replaceSelection(o);i.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}ji.scroll=i=>{i.inputState.lastScrollTop=i.scrollDOM.scrollTop,i.inputState.lastScrollLeft=i.scrollDOM.scrollLeft};nn.keydown=(i,t)=>(i.inputState.setSelectionOrigin("select"),t.keyCode==27&&(i.inputState.lastEscPress=Date.now()),!1);ji.touchstart=(i,t)=>{i.inputState.lastTouchTime=Date.now(),i.inputState.setSelectionOrigin("select.pointer")};ji.touchmove=i=>{i.inputState.setSelectionOrigin("select.pointer")};nn.mousedown=(i,t)=>{if(i.observer.flush(),i.inputState.lastTouchTime>Date.now()-2e3)return!1;let e=null;for(let n of i.state.facet(fg))if(e=n(i,t),e)break;if(!e&&t.button==0&&(e=wx(i,t)),e){let n=!i.hasFocus;i.inputState.startMouseSelection(new mx(i,t,e,n)),n&&i.observer.ignore(()=>Um(i.contentDOM));let r=i.inputState.mouseSelection;if(r)return r.start(t),r.dragging===!1}return!1};function wd(i,t,e,n){if(n==1)return yt.cursor(t,e);if(n==2)return nx(i.state,t,e);{let r=je.find(i.docView,t),o=i.state.doc.lineAt(r?r.posAtEnd:t),s=r?r.posAtStart:o.from,a=r?r.posAtEnd:o.to;return ai>=t.top&&i<=t.bottom,Sd=(i,t,e)=>Eg(t,e)&&i>=e.left&&i<=e.right;function xx(i,t,e,n){let r=je.find(i.docView,t);if(!r)return 1;let o=t-r.posAtStart;if(o==0)return 1;if(o==r.length)return-1;let s=r.coordsAt(o,-1);if(s&&Sd(e,n,s))return-1;let a=r.coordsAt(o,1);return a&&Sd(e,n,a)?1:s&&Eg(n,s)?-1:1}function Cd(i,t){let e=i.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:e,bias:xx(i,e,t.clientX,t.clientY)}}const bx=Ut.ie&&Ut.ie_version<=11;let Pd=null,kd=0,Ld=0;function Dg(i){if(!bx)return i.detail;let t=Pd,e=Ld;return Pd=i,Ld=Date.now(),kd=!t||e>Date.now()-400&&Math.abs(t.clientX-i.clientX)<2&&Math.abs(t.clientY-i.clientY)<2?(kd+1)%3:1}function wx(i,t){let e=Cd(i,t),n=Dg(t),r=i.state.selection;return{update(o){o.docChanged&&(e.pos=o.changes.mapPos(e.pos),r=r.map(o.changes))},get(o,s,a){let l=Cd(i,o),u,c=wd(i,l.pos,l.bias,n);if(e.pos!=l.pos&&!s){let d=wd(i,e.pos,e.bias,n),f=Math.min(d.from,c.from),g=Math.max(d.to,c.to);c=f1&&(u=Sx(r,l.pos))?u:a?r.addRange(c):yt.create([c])}}}function Sx(i,t){for(let e=0;e=t)return yt.create(i.ranges.slice(0,e).concat(i.ranges.slice(e+1)),i.mainIndex==e?0:i.mainIndex-(i.mainIndex>e?1:0))}return null}nn.dragstart=(i,t)=>{let{selection:{main:e}}=i.state;if(t.target.draggable){let r=i.docView.nearest(t.target);if(r&&r.isWidget){let o=r.posAtStart,s=o+r.length;(o>=e.to||s<=e.from)&&(e=yt.range(o,s))}}let{inputState:n}=i;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=e,t.dataTransfer&&(t.dataTransfer.setData("Text",i.state.sliceDoc(e.from,e.to)),t.dataTransfer.effectAllowed="copyMove"),!1};nn.dragend=i=>(i.inputState.draggedContent=null,!1);function Ad(i,t,e,n){if(!e)return;let r=i.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:o}=i.inputState,s=n&&o&&vx(i,t)?{from:o.from,to:o.to}:null,a={from:r,insert:e},l=i.state.changes(s?[s,a]:a);i.focus(),i.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:s?"move.drop":"input.drop"}),i.inputState.draggedContent=null}nn.drop=(i,t)=>{if(!t.dataTransfer)return!1;if(i.state.readOnly)return!0;let e=t.dataTransfer.files;if(e&&e.length){let n=Array(e.length),r=0,o=()=>{++r==e.length&&Ad(i,t,n.filter(s=>s!=null).join(i.state.lineBreak),!1)};for(let s=0;s{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(n[s]=a.result),o()},a.readAsText(e[s])}return!0}else{let n=t.dataTransfer.getData("Text");if(n)return Ad(i,t,n,!0),!0}return!1};nn.paste=(i,t)=>{if(i.state.readOnly)return!0;i.observer.flush();let e=Lg?null:t.clipboardData;return e?(Ag(i,e.getData("text/plain")||e.getData("text/uri-list")),!0):(_x(i),!1)};function Cx(i,t){let e=i.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=t,n.focus(),n.selectionEnd=t.length,n.selectionStart=0,setTimeout(()=>{n.remove(),i.focus()},50)}function Px(i){let t=[],e=[],n=!1;for(let r of i.selection.ranges)r.empty||(t.push(i.sliceDoc(r.from,r.to)),e.push(r));if(!t.length){let r=-1;for(let{from:o}of i.selection.ranges){let s=i.doc.lineAt(o);s.number>r&&(t.push(s.text),e.push({from:s.from,to:Math.min(i.doc.length,s.to+1)})),r=s.number}n=!0}return{text:t.join(i.lineBreak),ranges:e,linewise:n}}let qu=null;nn.copy=nn.cut=(i,t)=>{let{text:e,ranges:n,linewise:r}=Px(i.state);if(!e&&!r)return!1;qu=r?e:null,t.type=="cut"&&!i.state.readOnly&&i.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let o=Lg?null:t.clipboardData;return o?(o.clearData(),o.setData("text/plain",e),!0):(Cx(i,e),!1)};const Tg=In.define();function Ig(i,t){let e=[];for(let n of i.facet(mg)){let r=n(i,t);r&&e.push(r)}return e?i.update({effects:e,annotations:Tg.of(!0)}):null}function Mg(i){setTimeout(()=>{let t=i.hasFocus;if(t!=i.inputState.notifiedFocused){let e=Ig(i.state,t);e?i.dispatch(e):i.update([])}},10)}ji.focus=i=>{i.inputState.lastFocusTime=Date.now(),!i.scrollDOM.scrollTop&&(i.inputState.lastScrollTop||i.inputState.lastScrollLeft)&&(i.scrollDOM.scrollTop=i.inputState.lastScrollTop,i.scrollDOM.scrollLeft=i.inputState.lastScrollLeft),Mg(i)};ji.blur=i=>{i.observer.clearSelectionRange(),Mg(i)};ji.compositionstart=ji.compositionupdate=i=>{i.inputState.compositionFirstChange==null&&(i.inputState.compositionFirstChange=!0),i.inputState.composing<0&&(i.inputState.composing=0)};ji.compositionend=i=>{i.inputState.composing=-1,i.inputState.compositionEndedAt=Date.now(),i.inputState.compositionPendingKey=!0,i.inputState.compositionPendingChange=i.observer.pendingRecords().length>0,i.inputState.compositionFirstChange=null,Ut.chrome&&Ut.android?i.observer.flushSoon():i.inputState.compositionPendingChange?Promise.resolve().then(()=>i.observer.flush()):setTimeout(()=>{i.inputState.composing<0&&i.docView.hasComposition&&i.update([])},50)};ji.contextmenu=i=>{i.inputState.lastContextMenu=Date.now()};nn.beforeinput=(i,t)=>{var e;let n;if(Ut.chrome&&Ut.android&&(n=Pg.find(r=>r.inputType==t.inputType))&&(i.observer.delayAndroidKey(n.key,n.keyCode),n.key=="Backspace"||n.key=="Delete")){let r=((e=window.visualViewport)===null||e===void 0?void 0:e.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>r+10&&i.hasFocus&&(i.contentDOM.blur(),i.focus())},100)}return Ut.ios&&t.inputType=="deleteContentForward"&&i.observer.flushSoon(),Ut.safari&&t.inputType=="insertText"&&i.inputState.composing>=0&&setTimeout(()=>ji.compositionend(i,t),20),!1};const Ed=new Set;function kx(i){Ed.has(i)||(Ed.add(i),i.addEventListener("copy",()=>{}),i.addEventListener("cut",()=>{}))}const Dd=["pre-wrap","normal","pre-line","break-spaces"];class Lx{constructor(t){this.lineWrapping=t,this.doc=we.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(t,e){let n=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((e-t-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}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}mustRefreshForWrapping(t){return Dd.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let n=0;n-1,l=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=e,this.charWidth=n,this.textHeight=r,this.lineLength=o,l){this.heightSamples={};for(let u=0;u0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>Aa&&(t.heightChanged=!0),this.height=e)}replace(t,e,n){return bi.of(n)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,n,r){let o=this,s=n.doc;for(let a=r.length-1;a>=0;a--){let{fromA:l,toA:u,fromB:c,toB:d}=r[a],f=o.lineAt(l,Qe.ByPosNoHeight,n.setDoc(e),0,0),g=f.to>=u?f:o.lineAt(u,Qe.ByPosNoHeight,n,0,0);for(d+=g.to-u,u=g.to;a>0&&f.from<=r[a-1].toA;)l=r[a-1].fromA,c=r[a-1].fromB,a--,lo*2){let a=t[e-1];a.break?t.splice(--e,1,a.left,null,a.right):t.splice(--e,1,a.left,a.right),n+=1+a.break,r-=a.size}else if(o>r*2){let a=t[n];a.break?t.splice(n,1,a.left,null,a.right):t.splice(n,1,a.left,a.right),n+=2+a.break,o-=a.size}else break;else if(r=o&&s(this.blockAt(0,n,r,o))}updateHeight(t,e=0,n=!1,r){return r&&r.from<=e&&r.more&&this.setHeight(t,r.heights[r.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ii extends $g{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,n,r){return new gn(r,this.length,n,this.height,this.breaks)}replace(t,e,n){let r=n[0];return n.length==1&&(r instanceof Ii||r instanceof oi&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof oi?r=new Ii(r.length,this.height):r.height=this.height,this.outdated||(r.outdated=!1),r):bi.of(n)}updateHeight(t,e=0,n=!1,r){return r&&r.from<=e&&r.more?this.setHeight(t,r.heights[r.index++]):(n||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class oi extends bi{constructor(t){super(t,0)}heightMetrics(t,e){let n=t.doc.lineAt(e).number,r=t.doc.lineAt(e+this.length).number,o=r-n+1,s,a=0;if(t.lineWrapping){let l=Math.min(this.height,t.lineHeight*o);s=l/o,this.length>o+1&&(a=(this.height-l)/(this.length-o-1))}else s=this.height/o;return{firstLine:n,lastLine:r,perLine:s,perChar:a}}blockAt(t,e,n,r){let{firstLine:o,lastLine:s,perLine:a,perChar:l}=this.heightMetrics(e,r);if(e.lineWrapping){let u=r+(t0){let o=n[n.length-1];o instanceof oi?n[n.length-1]=new oi(o.length+r):n.push(null,new oi(r-1))}if(t>0){let o=n[0];o instanceof oi?n[0]=new oi(t+o.length):n.unshift(new oi(t-1),null)}return bi.of(n)}decomposeLeft(t,e){e.push(new oi(t-1),null)}decomposeRight(t,e){e.push(null,new oi(this.length-t-1))}updateHeight(t,e=0,n=!1,r){let o=e+this.length;if(r&&r.from<=e+this.length&&r.more){let s=[],a=Math.max(e,r.from),l=-1;for(r.from>e&&s.push(new oi(r.from-e-1).updateHeight(t,e));a<=o&&r.more;){let c=t.doc.lineAt(a).length;s.length&&s.push(null);let d=r.heights[r.index++];l==-1?l=d:Math.abs(d-l)>=Aa&&(l=-2);let f=new Ii(c,d);f.outdated=!1,s.push(f),a+=c+1}a<=o&&s.push(null,new oi(o-a).updateHeight(t,a));let u=bi.of(s);return(l<0||Math.abs(u.height-this.height)>=Aa||Math.abs(l-this.heightMetrics(t,e).perLine)>=Aa)&&(t.heightChanged=!0),u}else(n||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Ex extends bi{constructor(t,e,n){super(t.length+e+n.length,t.height+n.height,e|(t.outdated||n.outdated?2:0)),this.left=t,this.right=n,this.size=t.size+n.size}get break(){return this.flags&1}blockAt(t,e,n,r){let o=n+this.left.height;return ta))return u;let c=e==Qe.ByPosNoHeight?Qe.ByPosNoHeight:Qe.ByPos;return l?u.join(this.right.lineAt(a,c,n,s,a)):this.left.lineAt(a,c,n,r,o).join(u)}forEachLine(t,e,n,r,o,s){let a=r+this.left.height,l=o+this.left.length+this.break;if(this.break)t=l&&this.right.forEachLine(t,e,n,a,l,s);else{let u=this.lineAt(l,Qe.ByPos,n,r,o);t=t&&u.from<=e&&s(u),e>u.to&&this.right.forEachLine(u.to+1,e,n,a,l,s)}}replace(t,e,n){let r=this.left.length+this.break;if(ethis.left.length)return this.balanced(this.left,this.right.replace(t-r,e-r,n));let o=[];t>0&&this.decomposeLeft(t,o);let s=o.length;for(let a of n)o.push(a);if(t>0&&Td(o,s-1),e=n&&e.push(null)),t>n&&this.right.decomposeLeft(t-n,e)}decomposeRight(t,e){let n=this.left.length,r=n+this.break;if(t>=r)return this.right.decomposeRight(t-r,e);t2*e.size||e.size>2*t.size?bi.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,n=!1,r){let{left:o,right:s}=this,a=e+o.length+this.break,l=null;return r&&r.from<=e+o.length&&r.more?l=o=o.updateHeight(t,e,n,r):o.updateHeight(t,e,n),r&&r.from<=a+s.length&&r.more?l=s=s.updateHeight(t,a,n,r):s.updateHeight(t,a,n),l?this.balanced(o,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Td(i,t){let e,n;i[t]==null&&(e=i[t-1])instanceof oi&&(n=i[t+1])instanceof oi&&i.splice(t-1,3,new oi(e.length+1+n.length))}const Dx=5;class Bc{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 n=Math.min(e,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof Ii?r.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Ii(n-this.pos,-1)),this.writtenTo=n,e>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,n){if(t=Dx)&&this.addLineDeco(r,o,s)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTot&&this.nodes.push(new Ii(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let n=new oi(e-t);return this.oracle.doc.lineAt(t).to==e&&(n.flags|=4),n}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Ii)return t;let e=new Ii(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,t),r.breaks+=e,this.writtenTo=this.pos=this.pos+n}finish(t){let e=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(e instanceof Ii)&&!this.isCovered?this.nodes.push(new Ii(0,-1)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&d.overflow!="visible"){let f=c.getBoundingClientRect();o=Math.max(o,f.left),s=Math.min(s,f.right),a=Math.max(a,f.top),l=u==i.parentNode?f.bottom:Math.min(l,f.bottom)}u=d.position=="absolute"||d.position=="fixed"?c.offsetParent:c.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:o-e.left,right:Math.max(o,s)-e.left,top:a-(e.top+t),bottom:Math.max(a,l)-(e.top+t)}}function $x(i,t){let e=i.getBoundingClientRect();return{left:0,right:e.right-e.left,top:t,bottom:e.bottom-(e.top+t)}}class kh{constructor(t,e,n){this.from=t,this.to=e,this.size=n}static same(t,e){if(t.length!=e.length)return!1;for(let n=0;ntypeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Lx(e),this.stateDeco=t.facet(so).filter(n=>typeof n!="function"),this.heightMap=bi.empty().applyChanges(this.stateDeco,we.empty,this.heightOracle.setDoc(t.doc),[new zi(0,0,0,t.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Gt.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let n=0;n<=1;n++){let r=n?e.head:e.anchor;if(!t.some(({from:o,to:s})=>r>=o&&r<=s)){let{from:o,to:s}=this.lineBlockAt(r);t.push(new Go(o,s))}}this.viewports=t.sort((n,r)=>n.from-r.from),this.scaler=this.heightMap.height<=7e6?Md:new Fx(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(this.scaler.scale==1?t:Bs(t,this.scaler))})}update(t,e=null){this.state=t.state;let n=this.stateDeco;this.stateDeco=this.state.facet(so).filter(c=>typeof c!="function");let r=t.changedRanges,o=zi.extendWithRanges(r,Tx(n,this.stateDeco,t?t.changes:Ge.empty(this.state.doc.length))),s=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),o),this.heightMap.height!=s&&(t.flags|=2),a?(this.scrollAnchorPos=t.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let l=o.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.headl.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,e));let u=!t.changes.empty||t.flags&2||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),u&&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&&!t.state.facet(vg)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,n=window.getComputedStyle(e),r=this.heightOracle,o=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?Me.RTL:Me.LTR;let s=this.heightOracle.mustRefreshForWrapping(o),a=e.getBoundingClientRect(),l=s||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let u=0,c=0;if(a.width&&a.height){let{scaleX:E,scaleY:$}=Wm(e,a);(E>.005&&Math.abs(this.scaleX-E)>.005||$>.005&&Math.abs(this.scaleY-$)>.005)&&(this.scaleX=E,this.scaleY=$,u|=8,s=l=!0)}let d=(parseInt(n.paddingTop)||0)*this.scaleY,f=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=d||this.paddingBottom!=f)&&(this.paddingTop=d,this.paddingBottom=f,u|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(r.lineWrapping&&(l=!0),this.editorWidth=t.scrollDOM.clientWidth,u|=8);let g=t.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=g&&(this.scrollAnchorHeight=-1,this.scrollTop=g),this.scrolledToBottom=jm(t.scrollDOM);let x=(this.printing?$x:Mx)(e,this.paddingTop),m=x.top-this.pixelViewport.top,v=x.bottom-this.pixelViewport.bottom;this.pixelViewport=x;let O=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(O!=this.inView&&(this.inView=O,O&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let b=a.width;if((this.contentDOMWidth!=b||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=t.scrollDOM.clientHeight,u|=8),l){let E=t.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(E)&&(s=!0),s||r.lineWrapping&&Math.abs(b-this.contentDOMWidth)>r.charWidth){let{lineHeight:$,charWidth:Q,textHeight:X}=t.docView.measureTextSize();s=$>0&&r.refresh(o,$,Q,X,b/Q,E),s&&(t.docView.minWidth=0,u|=8)}m>0&&v>0?c=Math.max(m,v):m<0&&v<0&&(c=Math.min(m,v)),r.heightChanged=!1;for(let $ of this.viewports){let Q=$.from==this.viewport.from?E:t.docView.measureVisibleLineHeights($);this.heightMap=(s?bi.empty().applyChanges(this.stateDeco,we.empty,this.heightOracle,[new zi(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(r,0,s,new Ax($.from,Q))}r.heightChanged&&(u|=2)}let k=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return k&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(u&2||k)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,t)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let n=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),r=this.heightMap,o=this.heightOracle,{visibleTop:s,visibleBottom:a}=this,l=new Go(r.lineAt(s-n*1e3,Qe.ByHeight,o,0,0).from,r.lineAt(a+(1-n)*1e3,Qe.ByHeight,o,0,0).to);if(e){let{head:u}=e.range;if(ul.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),d=r.lineAt(u,Qe.ByPos,o,0,0),f;e.y=="center"?f=(d.top+d.bottom)/2-c/2:e.y=="start"||e.y=="nearest"&&u=a+Math.max(10,Math.min(n,250)))&&r>s-2*1e3&&o>1,s=r<<1;if(this.defaultTextDirection!=Me.LTR&&!n)return[];let a=[],l=(u,c,d,f)=>{if(c-uu&&vv.from>=d.from&&v.to<=d.to&&Math.abs(v.from-u)v.fromO));if(!m){if(cv.from<=c&&v.to>=c)){let v=e.moveToLineBoundary(yt.cursor(c),!1,!0).head;v>u&&(c=v)}m=new kh(u,c,this.gapSize(d,u,c,f))}a.push(m)};for(let u of this.viewportLines){if(u.lengthu.from&&l(u.from,f,u,c),ge.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];ge.spans(t,this.viewport.from,this.viewport.to,{span(r,o){e.push({from:r,to:o})},point(){}},20);let n=e.length!=this.visibleRanges.length||this.visibleRanges.some((r,o)=>r.from!=e[o].from||r.to!=e[o].to);return this.visibleRanges=e,n?4:0}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||Bs(this.heightMap.lineAt(t,Qe.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return Bs(this.heightMap.lineAt(this.scaler.fromDOM(t),Qe.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return Bs(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Go{constructor(t,e){this.from=t,this.to=e}}function Nx(i,t,e){let n=[],r=i,o=0;return ge.spans(e,i,t,{span(){},point(s,a){s>r&&(n.push({from:r,to:s}),o+=s-r),r=a}},20),r=1)return t[t.length-1].to;let n=Math.floor(i*e);for(let r=0;;r++){let{from:o,to:s}=t[r],a=s-o;if(n<=a)return o+n;n-=a}}function Jo(i,t){let e=0;for(let{from:n,to:r}of i.ranges){if(t<=r){e+=t-n;break}e+=r-n}return e/i.total}function Bx(i,t){for(let e of i)if(t(e))return e}const Md={toDOM(i){return i},fromDOM(i){return i},scale:1};class Fx{constructor(t,e,n){let r=0,o=0,s=0;this.viewports=n.map(({from:a,to:l})=>{let u=e.lineAt(a,Qe.ByPos,t,0,0).top,c=e.lineAt(l,Qe.ByPos,t,0,0).bottom;return r+=c-u,{from:a,to:l,top:u,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(e.height-r);for(let a of this.viewports)a.domTop=s+(a.top-o)*this.scale,s=a.domBottom=a.domTop+(a.bottom-a.top),o=a.bottom}toDOM(t){for(let e=0,n=0,r=0;;e++){let o=eBs(r,t)):i._content)}const Ko=Zt.define({combine:i=>i.join(" ")}),Vu=Zt.define({combine:i=>i.indexOf(!0)>-1}),Gu=ir.newName(),Qg=ir.newName(),Ng=ir.newName(),Bg={"&light":"."+Qg,"&dark":"."+Ng};function Hu(i,t,e){return new ir(t,{finish(n){return/&/.test(n)?n.replace(/&\w*/,r=>{if(r=="&")return i;if(!e||!e[r])throw new RangeError(`Unsupported selector: ${r}`);return e[r]}):i+" "+n}})}const Xx=Hu("."+Gu,{"&":{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,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",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",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".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"}},Bg),Fs="￿";class Rx{constructor(t,e){this.points=t,this.text="",this.lineSeparator=e.facet(Oe.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=Fs}readRange(t,e){if(!t)return this;let n=t.parentNode;for(let r=t;;){this.findPointBefore(n,r);let o=this.text.length;this.readNode(r);let s=r.nextSibling;if(s==e)break;let a=Te.get(r),l=Te.get(s);(a&&l?a.breakAfter:(a?a.breakAfter:Xa(r))||Xa(s)&&(r.nodeName!="BR"||r.cmIgnore)&&this.text.length>o)&&this.lineBreak(),r=s}return this.findPointBefore(n,e),this}readTextNode(t){let e=t.nodeValue;for(let n of this.points)n.node==t&&(n.pos=this.text.length+Math.min(n.offset,e.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let o=-1,s=1,a;if(this.lineSeparator?(o=e.indexOf(this.lineSeparator,n),s=this.lineSeparator.length):(a=r.exec(e))&&(o=a.index,s=a[0].length),this.append(e.slice(n,o<0?e.length:o)),o<0)break;if(this.lineBreak(),s>1)for(let l of this.points)l.node==t&&l.pos>this.text.length&&(l.pos-=s-1);n=o+s}}readNode(t){if(t.cmIgnore)return;let e=Te.get(t),n=e&&e.overrideDOMText;if(n!=null){this.findPointInside(t,n.length);for(let r=n.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.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 n of this.points)n.node==t&&t.childNodes[n.offset]==e&&(n.pos=this.text.length)}findPointInside(t,e){for(let n of this.points)(t.nodeType==3?n.node==t:t.contains(n.node))&&(n.pos=this.text.length+(Yx(t,n.node,n.offset)?e:0))}}function Yx(i,t,e){for(;;){if(!t||e-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,n,0))){let a=o||s?[]:zx(t),l=new Rx(a,t.state);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=jx(a,this.bounds.from)}else{let a=t.observer.selectionRange,l=o&&o.node==a.focusNode&&o.offset==a.focusOffset||!$u(t.contentDOM,a.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(a.focusNode,a.focusOffset),u=s&&s.node==a.anchorNode&&s.offset==a.anchorOffset||!$u(t.contentDOM,a.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(a.anchorNode,a.anchorOffset),c=t.viewport;if((Ut.ios||Ut.chrome)&&t.state.selection.main.empty&&l!=u&&(c.from>0||c.toDate.now()-100?i.inputState.lastKeyCode:-1;if(t.bounds){let{from:s,to:a}=t.bounds,l=r.from,u=null;(o===8||Ut.android&&t.text.length=r.from&&e.to<=r.to&&(e.from!=r.from||e.to!=r.to)&&r.to-r.from-(e.to-e.from)<=4?e={from:r.from,to:r.to,insert:i.state.doc.slice(r.from,e.from).append(e.insert).append(i.state.doc.slice(e.to,r.to))}:(Ut.mac||Ut.android)&&e&&e.from==e.to&&e.from==r.head-1&&/^\. ?$/.test(e.insert.toString())&&i.contentDOM.getAttribute("autocorrect")=="off"?(n&&e.insert.length==2&&(n=yt.single(n.main.anchor-1,n.main.head-1)),e={from:r.from,to:r.to,insert:we.of([" "])}):Ut.chrome&&e&&e.from==e.to&&e.from==r.head&&e.insert.toString()==` + `&&i.lineWrapping&&(n&&(n=yt.single(n.main.anchor-1,n.main.head-1)),e={from:r.from,to:r.to,insert:we.of([" "])}),e){if(Ut.ios&&i.inputState.flushIOSKey(e)||Ut.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&i.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Hr(i.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||o==8&&e.insert.lengthr.head)&&Hr(i.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&Hr(i.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let a,l=()=>a||(a=Wx(i,e,n));return i.state.facet(pg).some(u=>u(i,e.from,e.to,s,l))||i.dispatch(l()),!0}else if(n&&!n.main.eq(r)){let s=!1,a="select";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin=="select"&&(s=!0),a=i.inputState.lastSelectionOrigin),i.dispatch({selection:n,scrollIntoView:s,userEvent:a}),!0}else return!1}function Wx(i,t,e){let n,r=i.state,o=r.selection.main;if(t.from>=o.from&&t.to<=o.to&&t.to-t.from>=(o.to-o.from)/3&&(!e||e.main.empty&&e.main.from==t.from+t.insert.length)&&i.inputState.composing<0){let a=o.fromt.to?r.sliceDoc(t.to,o.to):"";n=r.replaceSelection(i.state.toText(a+t.insert.sliceString(0,void 0,i.state.lineBreak)+l))}else{let a=r.changes(t),l=e&&e.main.to<=a.newLength?e.main:void 0;if(r.selection.ranges.length>1&&i.inputState.composing>=0&&t.to<=o.to&&t.to>=o.to-10){let u=i.state.sliceDoc(t.from,t.to),c,d=e&&Sg(i,e.main.head);if(d){let x=t.insert.length-(t.to-t.from);c={from:d.from,to:d.to-x}}else c=i.state.doc.lineAt(o.head);let f=o.to-t.to,g=o.to-o.from;n=r.changeByRange(x=>{if(x.from==o.from&&x.to==o.to)return{changes:a,range:l||x.map(a)};let m=x.to-f,v=m-u.length;if(x.to-x.from!=g||i.state.sliceDoc(v,m)!=u||x.to>=c.from&&x.from<=c.to)return{range:x};let O=r.changes({from:v,to:m,insert:t.insert}),b=x.to-o.to;return{changes:O,range:l?yt.range(Math.max(0,l.anchor+b),Math.max(0,l.head+b)):x.map(O)}})}else n={changes:a,selection:l&&r.selection.replaceRange(l)}}let s="input.type";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,s+=".compose",i.inputState.compositionFirstChange&&(s+=".start",i.inputState.compositionFirstChange=!1)),r.update(n,{userEvent:s,scrollIntoView:!0})}function Ux(i,t,e,n){let r=Math.min(i.length,t.length),o=0;for(;o0&&a>0&&i.charCodeAt(s-1)==t.charCodeAt(a-1);)s--,a--;if(n=="end"){let l=Math.max(0,o-Math.min(s,a));e-=s+l-o}if(s=s?o-e:0;o-=l,a=o+(a-s),s=o}else if(a=a?o-e:0;o-=l,s=o+(s-a),a=o}return{from:o,toA:s,toB:a}}function zx(i){let t=[];if(i.root.activeElement!=i.contentDOM)return t;let{anchorNode:e,anchorOffset:n,focusNode:r,focusOffset:o}=i.observer.selectionRange;return e&&(t.push(new $d(e,n)),(r!=e||o!=n)&&t.push(new $d(r,o))),t}function jx(i,t){if(i.length==0)return null;let e=i[0].pos,n=i.length==2?i[1].pos:e;return e>-1&&n>-1?yt.single(e+t,n+t):null}const qx={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Lh=Ut.ie&&Ut.ie_version<=11;class Vx{constructor(t){this.view=t,this.active=!1,this.selectionRange=new T_,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let n of e)this.queue.push(n);(Ut.ie&&Ut.ie_version<=11||Ut.ios&&t.composing)&&e.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),Lh&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var e;((e=this.view.docView)===null||e===void 0?void 0:e.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){t.type=="change"&&!t.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,n)=>e!=t[n]))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(El)?n.root.activeElement!=this.dom:!ka(n.dom,r))return;let o=r.anchorNode&&n.docView.nearest(r.anchorNode);if(o&&o.ignoreEvent(t)){e||(this.selectionChanged=!1);return}(Ut.ie&&Ut.ie_version<=11||Ut.android&&Ut.chrome)&&!n.state.selection.main.empty&&r.focusNode&&zs(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=Fa(t.root);if(!e)return!1;let n=Ut.safari&&t.root.nodeType==11&&L_(this.dom.ownerDocument)==this.dom&&Gx(this.view,e)||e;if(!n||this.selectionRange.eq(n))return!1;let r=ka(this.dom,n);return r&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let o=this.delayedAndroidKey;o&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=o.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&o.force&&Hr(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,n=-1,r=!1;for(let o of t){let s=this.readMutation(o);s&&(s.typeOver&&(r=!0),e==-1?{from:e,to:n}=s:(e=Math.min(s.from,e),n=Math.max(s.to,n)))}return{from:e,to:n,typeOver:r}}readChange(){let{from:t,to:e,typeOver:n}=this.processRecords(),r=this.selectionChanged&&ka(this.dom,this.selectionRange);if(t<0&&!r)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new Zx(this.view,t,e,n);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let n=this.view.state,r=Fg(this.view,e);return this.view.state==n&&this.view.update([]),r}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.flags|=4),t.type=="childList"){let n=Qd(e,t.previousSibling||t.target.previousSibling,-1),r=Qd(e,t.nextSibling||t.target.nextSibling,1);return{from:n?e.posAfter(n):e.posAtStart,to:r?e.posBefore(r):e.posAtEnd,typeOver:!1}}else return t.type=="characterData"?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener("change",this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener("change",this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var t,e,n;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(e=this.gapIntersection)===null||e===void 0||e.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function Qd(i,t,e){for(;t;){let n=Te.get(t);if(n&&n.parent==i)return n;let r=t.parentNode;t=r!=i.dom?r:e>0?t.nextSibling:t.previousSibling}return null}function Nd(i,t){let e=t.startContainer,n=t.startOffset,r=t.endContainer,o=t.endOffset,s=i.docView.domAtPos(i.state.selection.main.anchor);return zs(s.node,s.offset,r,o)&&([e,n,r,o]=[r,o,e,n]),{anchorNode:e,anchorOffset:n,focusNode:r,focusOffset:o}}function Gx(i,t){if(t.getComposedRanges){let r=t.getComposedRanges(i.root)[0];if(r)return Nd(i,r)}let e=null;function n(r){r.preventDefault(),r.stopImmediatePropagation(),e=r.getTargetRanges()[0]}return i.contentDOM.addEventListener("beforeinput",n,!0),i.dom.ownerDocument.execCommand("indent"),i.contentDOM.removeEventListener("beforeinput",n,!0),e?Nd(i,e):null}class Rt{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}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}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.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:e}=t;this.dispatchTransactions=t.dispatchTransactions||e&&(n=>n.forEach(r=>e(r,this)))||(n=>this.update(n)),this.dispatch=this.dispatch.bind(this),this._root=t.root||I_(t.parent)||document,this.viewState=new Id(t.state||Oe.create(t)),t.scrollTo&&t.scrollTo.is(jo)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Qs).map(n=>new Sh(n));for(let n of this.plugins)n.update(this);this.observer=new Vx(this),this.inputState=new cx(this),this.inputState.ensureHandlers(this.plugins),this.docView=new md(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...t){let e=t.length==1&&t[0]instanceof Ke?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}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,n=!1,r,o=this.state;for(let f of t){if(f.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=f.state}if(this.destroyed){this.viewState.state=o;return}let s=this.hasFocus,a=0,l=null;t.some(f=>f.annotation(Tg))?(this.inputState.notifiedFocused=s,a=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,l=Ig(o,s),l||(a=1));let u=this.observer.delayedAndroidKey,c=null;if(u?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(c=null)):this.observer.clear(),o.facet(Oe.phrases)!=this.state.facet(Oe.phrases))return this.setState(o);r=Ra.create(this,o,t),r.flags|=a;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let f of t){if(d&&(d=d.map(f.changes)),f.scrollIntoView){let{main:g}=f.state.selection;d=new Jr(g.empty?g:yt.cursor(g.head,g.head>g.anchor?-1:1))}for(let g of f.effects)g.is(jo)&&(d=g.value.clip(this.state))}this.viewState.update(r,d),this.bidiCache=Ya.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),e=this.docView.update(r),this.state.facet(Ns)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(e,t.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(Ko)!=r.state.facet(Ko)&&(this.viewState.mustMeasureContent=!0),(e||n||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),e&&this.docViewUpdate(),!r.empty)for(let f of this.state.facet(Uu))try{f(r)}catch(g){Pi(this.state,g,"update listener")}(l||c)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),c&&!Fg(this,c)&&u.force&&Hr(this.contentDOM,u.key,u.keyCode)})}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 n of this.plugins)n.destroy(this);this.viewState=new Id(t),this.plugins=t.facet(Qs).map(n=>new Sh(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new md(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(Qs),n=t.state.facet(Qs);if(e!=n){let r=[];for(let o of n){let s=e.indexOf(o);if(s<0)r.push(new Sh(o));else{let a=this.plugins[s];a.mustUpdate=t,r.push(a)}}for(let o of this.plugins)o.mustUpdate!=t&&o.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=t;for(let r=0;r-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,n=this.scrollDOM,r=n.scrollTop*this.scaleY,{scrollAnchorPos:o,scrollAnchorHeight:s}=this.viewState;Math.abs(r-this.viewState.scrollTop)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(s<0)if(jm(n))o=-1,s=this.viewState.heightMap.height;else{let g=this.viewState.scrollAnchorAt(r);o=g.from,s=g.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];l&4||([this.measureRequests,u]=[u,this.measureRequests]);let c=u.map(g=>{try{return g.read(this)}catch(x){return Pi(this.state,x),Bd}}),d=Ra.create(this,this.state,[]),f=!1;d.flags|=l,e?e.flags|=l:e=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),f=this.docView.update(d),f&&this.docViewUpdate());for(let g=0;g1||x<-1){r=r+x,n.scrollTop=r/this.scaleY,s=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let a of this.state.facet(Uu))a(e)}get themeClasses(){return Gu+" "+(this.state.facet(Vu)?Ng:Qg)+" "+this.state.facet(Ko)}updateAttrs(){let t=Fd(this,Og,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(El)?"true":"false",class:"cm-content",style:`${Ut.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Fd(this,Qc,e);let n=this.observer.ignore(()=>{let r=Xu(this.contentDOM,this.contentAttrs,e),o=Xu(this.dom,this.editorAttrs,t);return r||o});return this.editorAttrs=t,this.contentAttrs=e,n}showAnnouncements(t){let e=!0;for(let n of t)for(let r of n.effects)if(r.is(Rt.announce)){e&&(this.announceDOM.textContent=""),e=!1;let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(Ns);let t=this.state.facet(Rt.cspNonce);ir.mount(this.root,this.styleModules.concat(Xx).reverse(),t?{nonce:t}:void 0)}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=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let e=0;en.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}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,n){return Ph(this,t,xd(this,t,e,n))}moveByGroup(t,e){return Ph(this,t,xd(this,t,e,n=>hx(this,t.head,n)))}visualLineSide(t,e){let n=this.bidiSpans(t),r=this.textDirectionAt(t.from),o=n[e?n.length-1:0];return yt.cursor(o.side(e,r)+t.from,o.forward(!e,r)?1:-1)}moveToLineBoundary(t,e,n=!0){return lx(this,t,e,n)}moveVertically(t,e,n){return Ph(this,t,ux(this,t,e,n))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),Cg(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let n=this.docView.coordsAt(t,e);if(!n||n.left==n.right)return n;let r=this.state.doc.lineAt(t),o=this.bidiSpans(r),s=o[Gn.find(o,t-r.from,-1,e)];return Tc(n,s.dir==Me.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(gg)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Hx)return lg(t.length);let e=this.textDirectionAt(t.from),n;for(let o of this.bidiCache)if(o.from==t.from&&o.dir==e&&(o.fresh||ag(o.isolates,n=pd(this,t))))return o.order;n||(n=pd(this,t));let r=z_(t.text,e,n);return this.bidiCache.push(new Ya(t.from,t.to,e,n,!0,r)),r}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Ut.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Um(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return jo.of(new Jr(typeof t=="number"?yt.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,n=this.viewState.scrollAnchorAt(t);return jo.of(new Jr(yt.cursor(n.from),"start","start",n.top-t,e,!0))}static domEventHandlers(t){return Fe.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return Fe.define(()=>({}),{eventObservers:t})}static theme(t,e){let n=ir.newName(),r=[Ko.of(n),Ns.of(Hu(`.${n}`,t))];return e&&e.dark&&r.push(Vu.of(!0)),r}static baseTheme(t){return lr.lowest(Ns.of(Hu("."+Gu,t,Bg)))}static findFromDOM(t){var e;let n=t.querySelector(".cm-content"),r=n&&Te.get(n)||Te.get(t);return((e=r==null?void 0:r.rootView)===null||e===void 0?void 0:e.view)||null}}Rt.styleModule=Ns;Rt.inputHandler=pg;Rt.scrollHandler=yg;Rt.focusChangeEffect=mg;Rt.perLineTextDirection=gg;Rt.exceptionSink=dg;Rt.updateListener=Uu;Rt.editable=El;Rt.mouseSelectionStyle=fg;Rt.dragMovesSelection=cg;Rt.clickAddsSelectionRange=ug;Rt.decorations=so;Rt.outerDecorations=_g;Rt.atomicRanges=Nc;Rt.bidiIsolatedRanges=xg;Rt.scrollMargins=bg;Rt.darkTheme=Vu;Rt.cspNonce=Zt.define({combine:i=>i.length?i[0]:""});Rt.contentAttributes=Qc;Rt.editorAttributes=Og;Rt.lineWrapping=Rt.contentAttributes.of({class:"cm-lineWrapping"});Rt.announce=re.define();const Hx=4096,Bd={};class Ya{constructor(t,e,n,r,o,s){this.from=t,this.to=e,this.dir=n,this.isolates=r,this.fresh=o,this.order=s}static update(t,e){if(e.empty&&!t.some(o=>o.fresh))return t;let n=[],r=t.length?t[t.length-1].dir:Me.LTR;for(let o=Math.max(0,t.length-10);o=0;r--){let o=n[r],s=typeof o=="function"?o(i):o;s&&Fu(s,e)}return e}const Jx=Ut.mac?"mac":Ut.windows?"win":Ut.linux?"linux":"key";function Kx(i,t){const e=i.split(/-(?!$)/);let n=e[e.length-1];n=="Space"&&(n=" ");let r,o,s,a;for(let l=0;ln.concat(r),[]))),e}function eb(i,t,e){return Rg(Xg(i.state),t,i,e)}let zn=null;const ib=4e3;function nb(i,t=Jx){let e=Object.create(null),n=Object.create(null),r=(s,a)=>{let l=n[s];if(l==null)n[s]=a;else if(l!=a)throw new Error("Key binding "+s+" is used both as a regular binding and as a multi-stroke prefix")},o=(s,a,l,u,c)=>{var d,f;let g=e[s]||(e[s]=Object.create(null)),x=a.split(/ (?!$)/).map(O=>Kx(O,t));for(let O=1;O{let E=zn={view:k,prefix:b,scope:s};return setTimeout(()=>{zn==E&&(zn=null)},ib),!0}]})}let m=x.join(" ");r(m,!1);let v=g[m]||(g[m]={preventDefault:!1,stopPropagation:!1,run:((f=(d=g._any)===null||d===void 0?void 0:d.run)===null||f===void 0?void 0:f.slice())||[]});l&&v.run.push(l),u&&(v.preventDefault=!0),c&&(v.stopPropagation=!0)};for(let s of i){let a=s.scope?s.scope.split(" "):["editor"];if(s.any)for(let u of a){let c=e[u]||(e[u]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let d in c)c[d].run.push(s.any)}let l=s[t]||s.key;if(l)for(let u of a)o(u,l,s.run,s.preventDefault,s.stopPropagation),s.shift&&o(u,"Shift-"+l,s.shift,s.preventDefault,s.stopPropagation)}return e}function Rg(i,t,e,n){let r=k_(t),o=ai(r,0),s=Yi(o)==r.length&&r!=" ",a="",l=!1,u=!1,c=!1;zn&&zn.view==e&&zn.scope==n&&(a=zn.prefix+" ",kg.indexOf(t.keyCode)<0&&(u=!0,zn=null));let d=new Set,f=v=>{if(v){for(let O of v.run)if(!d.has(O)&&(d.add(O),O(e,t)))return v.stopPropagation&&(c=!0),!0;v.preventDefault&&(v.stopPropagation&&(c=!0),u=!0)}return!1},g=i[n],x,m;return g&&(f(g[a+ta(r,t,!s)])?l=!0:s&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Ut.windows&&t.ctrlKey&&t.altKey)&&(x=nr[t.keyCode])&&x!=r?(f(g[a+ta(x,t,!0)])||t.shiftKey&&(m=no[t.keyCode])!=r&&m!=x&&f(g[a+ta(m,t,!1)]))&&(l=!0):s&&t.shiftKey&&f(g[a+ta(r,t,!0)])&&(l=!0),!l&&f(g._any)&&(l=!0)),u&&(l=!0),l&&c&&t.stopPropagation(),l}class So{constructor(t,e,n,r,o){this.className=t,this.left=e,this.top=n,this.width=r,this.height=o}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className!=this.className?!1:(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",this.width!=null&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,n){if(n.empty){let r=t.coordsAtPos(n.head,n.assoc||1);if(!r)return[];let o=Yg(t);return[new So(e,r.left-o.left,r.top-o.top,null,r.bottom-r.top)]}else return rb(t,e,n)}}function Yg(i){let t=i.scrollDOM.getBoundingClientRect();return{left:(i.textDirection==Me.LTR?t.left:t.right-i.scrollDOM.clientWidth*i.scaleX)-i.scrollDOM.scrollLeft*i.scaleX,top:t.top-i.scrollDOM.scrollTop*i.scaleY}}function Rd(i,t,e){let n=yt.cursor(t);return{from:Math.max(e.from,i.moveToLineBoundary(n,!1,!0).from),to:Math.min(e.to,i.moveToLineBoundary(n,!0,!0).from),type:xi.Text}}function rb(i,t,e){if(e.to<=i.viewport.from||e.from>=i.viewport.to)return[];let n=Math.max(e.from,i.viewport.from),r=Math.min(e.to,i.viewport.to),o=i.textDirection==Me.LTR,s=i.contentDOM,a=s.getBoundingClientRect(),l=Yg(i),u=s.querySelector(".cm-line"),c=u&&window.getComputedStyle(u),d=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),f=a.right-(c?parseInt(c.paddingRight):0),g=ju(i,n),x=ju(i,r),m=g.type==xi.Text?g:null,v=x.type==xi.Text?x:null;if(m&&(i.lineWrapping||g.widgetLineBreaks)&&(m=Rd(i,n,m)),v&&(i.lineWrapping||x.widgetLineBreaks)&&(v=Rd(i,r,v)),m&&v&&m.from==v.from)return b(k(e.from,e.to,m));{let $=m?k(e.from,null,m):E(g,!1),Q=v?k(null,e.to,v):E(x,!0),X=[];return(m||g).to<(v||x).from-(m&&v?1:0)||g.widgetLineBreaks>1&&$.bottom+i.defaultLineHeight/2N&&T.from=gt)break;Pt>H&&z(Math.max(pt,H),$==null&&pt<=N,Math.min(Pt,gt),Q==null&&Pt>=U,Et.dir)}if(H=at.to+1,H>=gt)break}return D.length==0&&z(N,$==null,U,Q==null,i.textDirection),{top:R,bottom:W,horizontal:D}}function E($,Q){let X=a.top+(Q?$.top:$.bottom);return{top:X,bottom:X,horizontal:[]}}}function sb(i,t){return i.constructor==t.constructor&&i.eq(t)}class ob{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Ea)!=t.state.facet(Ea)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}docViewUpdate(t){this.layer.updateOnDocViewUpdate!==!1&&t.requestMeasure(this.measureReq)}setOrder(t){let e=0,n=t.facet(Ea);for(;e!sb(e,this.drawn[n]))){let e=this.dom.firstChild,n=0;for(let r of t)r.update&&e&&r.constructor&&this.drawn[n].constructor&&r.update(e,this.drawn[n])?(e=e.nextSibling,n++):this.dom.insertBefore(r.draw(),e);for(;e;){let r=e.nextSibling;e.remove(),e=r}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Ea=Zt.define();function Zg(i){return[Fe.define(t=>new ob(t,i)),Ea.of(i)]}const Wg=!Ut.ios,oo=Zt.define({combine(i){return xn(i,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})}});function ab(i={}){return[oo.of(i),lb,hb,ub,vg.of(!0)]}function Ug(i){return i.startState.facet(oo)!=i.state.facet(oo)}const lb=Zg({above:!0,markers(i){let{state:t}=i,e=t.facet(oo),n=[];for(let r of t.selection.ranges){let o=r==t.selection.main;if(r.empty?!o||Wg:e.drawRangeCursor){let s=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=r.empty?r:yt.cursor(r.head,r.head>r.anchor?-1:1);for(let l of So.forRange(i,s,a))n.push(l)}}return n},update(i,t){i.transactions.some(n=>n.selection)&&(t.style.animationName=t.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let e=Ug(i);return e&&Yd(i.state,t),i.docChanged||i.selectionSet||e},mount(i,t){Yd(t.state,i)},class:"cm-cursorLayer"});function Yd(i,t){t.style.animationDuration=i.facet(oo).cursorBlinkRate+"ms"}const hb=Zg({above:!1,markers(i){return i.state.selection.ranges.map(t=>t.empty?[]:So.forRange(i,"cm-selectionBackground",t)).reduce((t,e)=>t.concat(e))},update(i,t){return i.docChanged||i.selectionSet||i.viewportChanged||Ug(i)},class:"cm-selectionLayer"}),Ju={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};Wg&&(Ju[".cm-line"].caretColor="transparent !important",Ju[".cm-content"]={caretColor:"transparent !important"});const ub=lr.highest(Rt.theme(Ju)),zg=re.define({map(i,t){return i==null?null:t.mapPos(i)}}),Xs=ti.define({create(){return null},update(i,t){return i!=null&&(i=t.changes.mapPos(i)),t.effects.reduce((e,n)=>n.is(zg)?n.value:e,i)}}),cb=Fe.fromClass(class{constructor(i){this.view=i,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(i){var t;let e=i.state.field(Xs);e==null?this.cursor!=null&&((t=this.cursor)===null||t===void 0||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(i.startState.field(Xs)!=e||i.docChanged||i.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:i}=this,t=i.state.field(Xs),e=t!=null&&i.coordsAtPos(t);if(!e)return null;let n=i.scrollDOM.getBoundingClientRect();return{left:e.left-n.left+i.scrollDOM.scrollLeft*i.scaleX,top:e.top-n.top+i.scrollDOM.scrollTop*i.scaleY,height:e.bottom-e.top}}drawCursor(i){if(this.cursor){let{scaleX:t,scaleY:e}=this.view;i?(this.cursor.style.left=i.left/t+"px",this.cursor.style.top=i.top/e+"px",this.cursor.style.height=i.height/e+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(i){this.view.state.field(Xs)!=i&&this.view.dispatch({effects:zg.of(i)})}},{eventObservers:{dragover(i){this.setDropPos(this.view.posAtCoords({x:i.clientX,y:i.clientY}))},dragleave(i){(i.target==this.view.contentDOM||!this.view.contentDOM.contains(i.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function fb(){return[Xs,cb]}function Zd(i,t,e,n,r){t.lastIndex=0;for(let o=i.iterRange(e,n),s=e,a;!o.next().done;s+=o.value.length)if(!o.lineBreak)for(;a=t.exec(o.value);)r(s+a.index,a)}function db(i,t){let e=i.visibleRanges;if(e.length==1&&e[0].from==i.viewport.from&&e[0].to==i.viewport.to)return e;let n=[];for(let{from:r,to:o}of e)r=Math.max(i.state.doc.lineAt(r).from,r-t),o=Math.min(i.state.doc.lineAt(o).to,o+t),n.length&&n[n.length-1].to>=r?n[n.length-1].to=o:n.push({from:r,to:o});return n}class pb{constructor(t){const{regexp:e,decoration:n,decorate:r,boundary:o,maxLength:s=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,r)this.addMatch=(a,l,u,c)=>r(c,u,u+a[0].length,a,l);else if(typeof n=="function")this.addMatch=(a,l,u,c)=>{let d=n(a,l,u);d&&c(u,u+a[0].length,d)};else if(n)this.addMatch=(a,l,u,c)=>c(u,u+a[0].length,n);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=o,this.maxLength=s}createDeco(t){let e=new _n,n=e.add.bind(e);for(let{from:r,to:o}of db(t,this.maxLength))Zd(t.state.doc,this.regexp,r,o,(s,a)=>this.addMatch(a,t,s,n));return e.finish()}updateDeco(t,e){let n=1e9,r=-1;return t.docChanged&&t.changes.iterChanges((o,s,a,l)=>{l>t.view.viewport.from&&a1e3?this.createDeco(t.view):r>-1?this.updateRange(t.view,e.map(t.changes),n,r):e}updateRange(t,e,n,r){for(let o of t.visibleRanges){let s=Math.max(o.from,n),a=Math.min(o.to,r);if(a>s){let l=t.state.doc.lineAt(s),u=l.tol.from;s--)if(this.boundary.test(l.text[s-1-l.from])){c=s;break}for(;af.push(O.range(m,v));if(l==u)for(this.regexp.lastIndex=c-l.from;(g=this.regexp.exec(l.text))&&g.indexthis.addMatch(v,t,m,x));e=e.update({filterFrom:c,filterTo:d,filter:(m,v)=>md,add:f})}}return e}}const Ku=/x/.unicode!=null?"gu":"g",mb=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,Ku),gb={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Ah=null;function vb(){var i;if(Ah==null&&typeof document<"u"&&document.body){let t=document.body.style;Ah=((i=t.tabSize)!==null&&i!==void 0?i:t.MozTabSize)!=null}return Ah||!1}const Da=Zt.define({combine(i){let t=xn(i,{render:null,specialChars:mb,addSpecialChars:null});return(t.replaceTabs=!vb())&&(t.specialChars=new RegExp(" |"+t.specialChars.source,Ku)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,Ku)),t}});function yb(i={}){return[Da.of(i),Ob()]}let Wd=null;function Ob(){return Wd||(Wd=Fe.fromClass(class{constructor(i){this.view=i,this.decorations=Gt.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(i.state.facet(Da)),this.decorations=this.decorator.createDeco(i)}makeDecorator(i){return new pb({regexp:i.specialChars,decoration:(t,e,n)=>{let{doc:r}=e.state,o=ai(t[0],0);if(o==9){let s=r.lineAt(n),a=e.state.tabSize,l=gs(s.text,a,n-s.from);return Gt.replace({widget:new wb((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=Gt.replace({widget:new bb(i,o)}))},boundary:i.replaceTabs?void 0:/[^]/})}update(i){let t=i.state.facet(Da);i.startState.facet(Da)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(i.view)):this.decorations=this.decorator.updateDeco(i,this.decorations)}},{decorations:i=>i.decorations}))}const _b="•";function xb(i){return i>=32?_b:i==10?"␤":String.fromCharCode(9216+i)}class bb extends Mn{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=xb(this.code),n=t.state.phrase("Control character")+" "+(gb[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,e);if(r)return r;let o=document.createElement("span");return o.textContent=e,o.title=n,o.setAttribute("aria-label",n),o.className="cm-specialChar",o}ignoreEvent(){return!1}}class wb extends Mn{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent=" ",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}function Sb(){return Pb}const Cb=Gt.line({class:"cm-activeLine"}),Pb=Fe.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.docChanged||i.selectionSet)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let t=-1,e=[];for(let n of i.state.selection.ranges){let r=i.lineBlockAt(n.head);r.from>t&&(e.push(Cb.range(r.from)),t=r.from)}return Gt.set(e)}},{decorations:i=>i.decorations}),tc=2e3;function kb(i,t,e){let n=Math.min(t.line,e.line),r=Math.max(t.line,e.line),o=[];if(t.off>tc||e.off>tc||t.col<0||e.col<0){let s=Math.min(t.off,e.off),a=Math.max(t.off,e.off);for(let l=n;l<=r;l++){let u=i.doc.line(l);u.length<=a&&o.push(yt.range(u.from+s,u.to+a))}}else{let s=Math.min(t.col,e.col),a=Math.max(t.col,e.col);for(let l=n;l<=r;l++){let u=i.doc.line(l),c=Tu(u.text,s,i.tabSize,!0);if(c<0)o.push(yt.cursor(u.to));else{let d=Tu(u.text,a,i.tabSize);o.push(yt.range(u.from+c,u.from+d))}}}return o}function Lb(i,t){let e=i.coordsAtPos(i.viewport.from);return e?Math.round(Math.abs((e.left-t)/i.defaultCharacterWidth)):-1}function Ud(i,t){let e=i.posAtCoords({x:t.clientX,y:t.clientY},!1),n=i.state.doc.lineAt(e),r=e-n.from,o=r>tc?-1:r==n.length?Lb(i,t.clientX):gs(n.text,i.state.tabSize,e-n.from);return{line:n.number,col:o,off:r}}function Ab(i,t){let e=Ud(i,t),n=i.state.selection;return e?{update(r){if(r.docChanged){let o=r.changes.mapPos(r.startState.doc.line(e.line).from),s=r.state.doc.lineAt(o);e={line:s.number,col:e.col,off:Math.min(e.off,s.length)},n=n.map(r.changes)}},get(r,o,s){let a=Ud(i,r);if(!a)return n;let l=kb(i.state,e,a);return l.length?s?yt.create(l.concat(n.ranges)):yt.create(l):n}}:null}function Eb(i){let t=(i==null?void 0:i.eventFilter)||(e=>e.altKey&&e.button==0);return Rt.mouseSelectionStyle.of((e,n)=>t(n)?Ab(e,n):null)}const Db={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},Tb={style:"cursor: crosshair"};function Ib(i={}){let[t,e]=Db[i.key||"Alt"],n=Fe.fromClass(class{constructor(r){this.view=r,this.isDown=!1}set(r){this.isDown!=r&&(this.isDown=r,this.view.update([]))}},{eventObservers:{keydown(r){this.set(r.keyCode==t||e(r))},keyup(r){(r.keyCode==t||!e(r))&&this.set(!1)},mousemove(r){this.set(e(r))}}});return[n,Rt.contentAttributes.of(r=>{var o;return!((o=r.plugin(n))===null||o===void 0)&&o.isDown?Tb:null})]}const Ps="-10000px";class jg{constructor(t,e,n,r){this.facet=e,this.createTooltipView=n,this.removeTooltipView=r,this.input=t.state.facet(e),this.tooltips=this.input.filter(s=>s);let o=null;this.tooltipViews=this.tooltips.map(s=>o=n(s,o))}update(t,e){var n;let r=t.state.facet(this.facet),o=r.filter(l=>l);if(r===this.input){for(let l of this.tooltipViews)l.update&&l.update(t);return!1}let s=[],a=e?[]:null;for(let l=0;le[u]=l),e.length=a.length),this.input=r,this.tooltips=o,this.tooltipViews=s,!0}}function Mb(i){let{win:t}=i;return{top:0,left:0,bottom:t.innerHeight,right:t.innerWidth}}const Eh=Zt.define({combine:i=>{var t,e,n;return{position:Ut.ios?"absolute":((t=i.find(r=>r.position))===null||t===void 0?void 0:t.position)||"fixed",parent:((e=i.find(r=>r.parent))===null||e===void 0?void 0:e.parent)||null,tooltipSpace:((n=i.find(r=>r.tooltipSpace))===null||n===void 0?void 0:n.tooltipSpace)||Mb}}}),zd=new WeakMap,Fc=Fe.fromClass(class{constructor(i){this.view=i,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=i.state.facet(Eh);this.position=t.position,this.parent=t.parent,this.classes=i.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new jg(i,Xc,(e,n)=>this.createTooltip(e,n),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),i.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let i of this.manager.tooltipViews)this.intersectionObserver.observe(i.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(i){i.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(i,this.above);t&&this.observeIntersection();let e=t||i.geometryChanged,n=i.state.facet(Eh);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;e=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.dom);e=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);e&&this.maybeMeasure()}createTooltip(i,t){let e=i.create(this.view),n=t?t.dom:null;if(e.dom.classList.add("cm-tooltip"),i.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",e.dom.appendChild(r)}return e.dom.style.position=this.position,e.dom.style.top=Ps,e.dom.style.left="0px",this.container.insertBefore(e.dom,n),e.mount&&e.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(e.dom),e}destroy(){var i,t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let n of this.manager.tooltipViews)n.dom.remove(),(i=n.destroy)===null||i===void 0||i.call(n);this.parent&&this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let i=this.view.dom.getBoundingClientRect(),t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:r}=this.manager.tooltipViews[0];if(Ut.gecko)n=r.offsetParent!=this.container.ownerDocument.body;else if(r.style.top==Ps&&r.style.left=="0px"){let o=r.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}}if(n||this.position=="absolute")if(this.parent){let r=this.parent.getBoundingClientRect();r.width&&r.height&&(t=r.width/this.parent.offsetWidth,e=r.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);return{editor:i,parent:this.parent?this.container.getBoundingClientRect():i,pos:this.manager.tooltips.map((r,o)=>{let s=this.manager.tooltipViews[o];return s.getCoords?s.getCoords(r.pos):this.view.coordsAtPos(r.pos)}),size:this.manager.tooltipViews.map(({dom:r})=>r.getBoundingClientRect()),space:this.view.state.facet(Eh).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(i){var t;if(i.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{editor:e,space:n,scaleX:r,scaleY:o}=i,s=[];for(let a=0;a=Math.min(e.bottom,n.bottom)||d.rightMath.min(e.right,n.right)+.1){c.style.top=Ps;continue}let g=l.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,x=g?7:0,m=f.right-f.left,v=(t=zd.get(u))!==null&&t!==void 0?t:f.bottom-f.top,O=u.offset||Qb,b=this.view.textDirection==Me.LTR,k=f.width>n.right-n.left?b?n.left:n.right-f.width:b?Math.min(d.left-(g?14:0)+O.x,n.right-m):Math.max(n.left,d.left-m+(g?14:0)-O.x),E=this.above[a];!l.strictSide&&(E?d.top-(f.bottom-f.top)-O.yn.bottom)&&E==n.bottom-d.bottom>d.top-n.top&&(E=this.above[a]=!E);let $=(E?d.top-n.top:n.bottom-d.bottom)-x;if($k&&R.topQ&&(Q=E?R.top-v-2-x:R.bottom+x+2);if(this.position=="absolute"?(c.style.top=(Q-i.parent.top)/o+"px",c.style.left=(k-i.parent.left)/r+"px"):(c.style.top=Q/o+"px",c.style.left=k/r+"px"),g){let R=d.left+(b?O.x:-O.x)-(k+14-7);g.style.left=R/r+"px"}u.overlap!==!0&&s.push({left:k,top:Q,right:X,bottom:Q+v}),c.classList.toggle("cm-tooltip-above",E),c.classList.toggle("cm-tooltip-below",!E),u.positioned&&u.positioned(i.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let i of this.manager.tooltipViews)i.dom.style.top=Ps}},{eventObservers:{scroll(){this.maybeMeasure()}}}),$b=Rt.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Qb={x:0,y:0},Xc=Zt.define({enables:[Fc,$b]}),Za=Zt.define({combine:i=>i.reduce((t,e)=>t.concat(e),[])});class Dl{static create(t){return new Dl(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new jg(t,Za,(e,n)=>this.createHostedView(e,n),e=>e.dom.remove())}createHostedView(t,e){let n=t.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(t){for(let e of this.manager.tooltipViews)e.mount&&e.mount(t);this.mounted=!0}positioned(t){for(let e of this.manager.tooltipViews)e.positioned&&e.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let e of this.manager.tooltipViews)(t=e.destroy)===null||t===void 0||t.call(e)}passProp(t){let e;for(let n of this.manager.tooltipViews){let r=n[t];if(r!==void 0){if(e===void 0)e=r;else if(e!==r)return}}return e}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const Nb=Xc.compute([Za],i=>{let t=i.facet(Za);return t.length===0?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var n;return(n=e.end)!==null&&n!==void 0?n:e.pos})),create:Dl.create,above:t[0].above,arrow:t.some(e=>e.arrow)}});class Bb{constructor(t,e,n,r,o){this.view=t,this.source=e,this.field=n,this.setHover=r,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;ta.bottom||e.xa.right+t.defaultCharacterWidth)return;let l=t.bidiSpans(t.state.doc.lineAt(r)).find(c=>c.from<=r&&c.to>=r),u=l&&l.dir==Me.RTL?-1:1;o=e.x{this.pending==a&&(this.pending=null,l&&!(Array.isArray(l)&&!l.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])}))},l=>Pi(t.state,l,"hover tooltip"))}else s&&!(Array.isArray(s)&&!s.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(s)?s:[s])})}get tooltip(){let t=this.view.plugin(Fc),e=t?t.manager.tooltips.findIndex(n=>n.create==Dl.create):-1;return e>-1?t.manager.tooltipViews[e]:null}mousemove(t){var e,n;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:r,tooltip:o}=this;if(r.length&&o&&!Fb(o.dom,t)||this.pending){let{pos:s}=r[0]||this.pending,a=(n=(e=r[0])===null||e===void 0?void 0:e.end)!==null&&n!==void 0?n:s;(s==a?this.view.posAtCoords(this.lastMove)!=s:!Xb(this.view,s,a,t.clientX,t.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:e}=this;if(e.length){let{tooltip:n}=this;n&&n.dom.contains(t.relatedTarget)?this.watchTooltipLeave(n.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let e=n=>{t.removeEventListener("mouseleave",e),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener("mouseleave",e)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const ea=4;function Fb(i,t){let e=i.getBoundingClientRect();return t.clientX>=e.left-ea&&t.clientX<=e.right+ea&&t.clientY>=e.top-ea&&t.clientY<=e.bottom+ea}function Xb(i,t,e,n,r,o){let s=i.scrollDOM.getBoundingClientRect(),a=i.documentTop+i.documentPadding.top+i.contentHeight;if(s.left>n||s.rightr||Math.min(s.bottom,a)=t&&l<=e}function Rb(i,t={}){let e=re.define(),n=ti.define({create(){return[]},update(r,o){if(r.length&&(t.hideOnChange&&(o.docChanged||o.selection)?r=[]:t.hideOn&&(r=r.filter(s=>!t.hideOn(o,s))),o.docChanged)){let s=[];for(let a of r){let l=o.changes.mapPos(a.pos,-1,Je.TrackDel);if(l!=null){let u=Object.assign(Object.create(null),a);u.pos=l,u.end!=null&&(u.end=o.changes.mapPos(u.end)),s.push(u)}}r=s}for(let s of o.effects)s.is(e)&&(r=s.value),s.is(Yb)&&(r=[]);return r},provide:r=>Za.from(r)});return[n,Fe.define(r=>new Bb(r,i,n,e,t.hoverTime||300)),Nb]}function qg(i,t){let e=i.plugin(Fc);if(!e)return null;let n=e.manager.tooltips.indexOf(t);return n<0?null:e.manager.tooltipViews[n]}const Yb=re.define(),jd=Zt.define({combine(i){let t,e;for(let n of i)t=t||n.topContainer,e=e||n.bottomContainer;return{topContainer:t,bottomContainer:e}}});function ao(i,t){let e=i.plugin(Vg),n=e?e.specs.indexOf(t):-1;return n>-1?e.panels[n]:null}const Vg=Fe.fromClass(class{constructor(i){this.input=i.state.facet(Dr),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(e=>e(i));let t=i.state.facet(jd);this.top=new ia(i,!0,t.topContainer),this.bottom=new ia(i,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(i){let t=i.state.facet(jd);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new ia(i.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new ia(i.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let e=i.state.facet(Dr);if(e!=this.input){let n=e.filter(l=>l),r=[],o=[],s=[],a=[];for(let l of n){let u=this.specs.indexOf(l),c;u<0?(c=l(i.view),a.push(c)):(c=this.panels[u],c.update&&c.update(i)),r.push(c),(c.top?o:s).push(c)}this.specs=n,this.panels=r,this.top.sync(o),this.bottom.sync(s);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let n of this.panels)n.update&&n.update(i)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:i=>Rt.scrollMargins.of(t=>{let e=t.plugin(i);return e&&{top:e.top.scrollMargin(),bottom:e.bottom.scrollMargin()}})});class ia{constructor(t,e,n){this.view=t,this.top=e,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=qd(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=qd(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function qd(i){let t=i.nextSibling;return i.remove(),t}const Dr=Zt.define({enables:Vg});class Tn extends kr{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Tn.prototype.elementClass="";Tn.prototype.toDOM=void 0;Tn.prototype.mapMode=Je.TrackBefore;Tn.prototype.startSide=Tn.prototype.endSide=-1;Tn.prototype.point=!0;const Ta=Zt.define(),Zb={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>ge.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},qs=Zt.define();function Wb(i){return[Gg(),qs.of(Object.assign(Object.assign({},Zb),i))]}const ec=Zt.define({combine:i=>i.some(t=>t)});function Gg(i){let t=[Ub];return i&&i.fixed===!1&&t.push(ec.of(!0)),t}const Ub=Fe.fromClass(class{constructor(i){this.view=i,this.prevViewport=i.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=i.state.facet(qs).map(t=>new Gd(i,t));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!i.state.facet(ec),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),i.scrollDOM.insertBefore(this.dom,i.contentDOM)}update(i){if(this.updateGutters(i)){let t=this.prevViewport,e=i.view.viewport,n=Math.min(t.to,e.to)-Math.max(t.from,e.from);this.syncGutters(n<(e.to-e.from)*.8)}i.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(ec)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=i.view.viewport}syncGutters(i){let t=this.dom.nextSibling;i&&this.dom.remove();let e=ge.iter(this.view.state.facet(Ta),this.view.viewport.from),n=[],r=this.gutters.map(o=>new zb(o,this.view.viewport,-this.view.documentPadding.top));for(let o of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(o.type)){let s=!0;for(let a of o.type)if(a.type==xi.Text&&s){ic(e,n,a.from);for(let l of r)l.line(this.view,a,n);s=!1}else if(a.widget)for(let l of r)l.widget(this.view,a)}else if(o.type==xi.Text){ic(e,n,o.from);for(let s of r)s.line(this.view,o,n)}else if(o.widget)for(let s of r)s.widget(this.view,o);for(let o of r)o.finish();i&&this.view.scrollDOM.insertBefore(this.dom,t)}updateGutters(i){let t=i.startState.facet(qs),e=i.state.facet(qs),n=i.docChanged||i.heightChanged||i.viewportChanged||!ge.eq(i.startState.facet(Ta),i.state.facet(Ta),i.view.viewport.from,i.view.viewport.to);if(t==e)for(let r of this.gutters)r.update(i)&&(n=!0);else{n=!0;let r=[];for(let o of e){let s=t.indexOf(o);s<0?r.push(new Gd(this.view,o)):(this.gutters[s].update(i),r.push(this.gutters[s]))}for(let o of this.gutters)o.dom.remove(),r.indexOf(o)<0&&o.destroy();for(let o of r)this.dom.appendChild(o.dom);this.gutters=r}return n}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove()}},{provide:i=>Rt.scrollMargins.of(t=>{let e=t.plugin(i);return!e||e.gutters.length==0||!e.fixed?null:t.textDirection==Me.LTR?{left:e.dom.offsetWidth*t.scaleX}:{right:e.dom.offsetWidth*t.scaleX}})});function Vd(i){return Array.isArray(i)?i:[i]}function ic(i,t,e){for(;i.value&&i.from<=e;)i.from==e&&t.push(i.value),i.next()}class zb{constructor(t,e,n){this.gutter=t,this.height=n,this.i=0,this.cursor=ge.iter(t.markers,e.from)}addElement(t,e,n){let{gutter:r}=this,o=(e.top-this.height)/t.scaleY,s=e.height/t.scaleY;if(this.i==r.elements.length){let a=new Hg(t,s,o,n);r.elements.push(a),r.dom.appendChild(a.dom)}else r.elements[this.i].update(t,s,o,n);this.height=e.bottom,this.i++}line(t,e,n){let r=[];ic(this.cursor,r,e.from),n.length&&(r=r.concat(n));let o=this.gutter.config.lineMarker(t,e,r);o&&r.unshift(o);let s=this.gutter;r.length==0&&!s.config.renderEmptyElements||this.addElement(t,e,r)}widget(t,e){let n=this.gutter.config.widgetMarker(t,e.widget,e);n&&this.addElement(t,e,[n])}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}}class Gd{constructor(t,e){this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in e.domEventHandlers)this.dom.addEventListener(n,r=>{let o=r.target,s;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let l=o.getBoundingClientRect();s=(l.top+l.bottom)/2}else s=r.clientY;let a=t.lineBlockAtHeight(s-t.documentTop);e.domEventHandlers[n](t,a,r)&&r.preventDefault()});this.markers=Vd(e.markers(t)),e.initialSpacer&&(this.spacer=new Hg(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let e=this.markers;if(this.markers=Vd(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],t);r!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[r])}let n=t.view.viewport;return!ge.eq(this.markers,e,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(t):!1)}destroy(){for(let t of this.elements)t.destroy()}}class Hg{constructor(t,e,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,e,n,r)}update(t,e,n,r){this.height!=e&&(this.height=e,this.dom.style.height=e+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),jb(this.markers,r)||this.setMarkers(t,r)}setMarkers(t,e){let n="cm-gutterElement",r=this.dom.firstChild;for(let o=0,s=0;;){let a=s,l=oo(a,l,u)||s(a,l,u):s}return n}})}});class Dh extends Tn{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function Th(i,t){return i.state.facet(zr).formatNumber(t,i.state)}const Vb=qs.compute([zr],i=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(qb)},lineMarker(t,e,n){return n.some(r=>r.toDOM)?null:new Dh(Th(t,t.state.doc.lineAt(e.from).number))},widgetMarker:()=>null,lineMarkerChange:t=>t.startState.facet(zr)!=t.state.facet(zr),initialSpacer(t){return new Dh(Th(t,Hd(t.state.doc.lines)))},updateSpacer(t,e){let n=Th(e.view,Hd(e.view.state.doc.lines));return n==t.number?t:new Dh(n)},domEventHandlers:i.facet(zr).domEventHandlers}));function Gb(i={}){return[zr.of(i),Gg(),Vb]}function Hd(i){let t=9;for(;t{let t=[],e=-1;for(let n of i.selection.ranges){let r=i.doc.lineAt(n.head).from;r>e&&(e=r,t.push(Hb.range(r)))}return ge.of(t)});function Kb(){return Jb}const Jg=1024;let tw=0;class Ih{constructor(t,e){this.from=t,this.to=e}}class ce{constructor(t={}){this.id=tw++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=Ei.match(t)),e=>{let n=t(e);return n===void 0?null:[this,n]}}}ce.closedBy=new ce({deserialize:i=>i.split(" ")});ce.openedBy=new ce({deserialize:i=>i.split(" ")});ce.group=new ce({deserialize:i=>i.split(" ")});ce.isolate=new ce({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}});ce.contextHash=new ce({perNode:!0});ce.lookAhead=new ce({perNode:!0});ce.mounted=new ce({perNode:!0});class Wa{constructor(t,e,n){this.tree=t,this.overlay=e,this.parser=n}static get(t){return t&&t.props&&t.props[ce.mounted.id]}}const ew=Object.create(null);class Ei{constructor(t,e,n,r=0){this.name=t,this.props=e,this.id=n,this.flags=r}static define(t){let e=t.props&&t.props.length?Object.create(null):ew,n=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),r=new Ei(t.name||"",e,t.id,n);if(t.props){for(let o of t.props)if(Array.isArray(o)||(o=o(r)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[o[0].id]=o[1]}}return r}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let e=this.prop(ce.group);return e?e.indexOf(t)>-1:!1}return this.id==t}static match(t){let e=Object.create(null);for(let n in t)for(let r of n.split(" "))e[r]=t[n];return n=>{for(let r=n.prop(ce.group),o=-1;o<(r?r.length:0);o++){let s=e[o<0?n.name:r[o]];if(s)return s}}}}Ei.none=new Ei("",Object.create(null),0,8);class Rc{constructor(t){this.types=t;for(let e=0;e0;for(let l=this.cursor(s|He.IncludeAnonymous);;){let u=!1;if(l.from<=o&&l.to>=r&&(!a&&l.type.isAnonymous||e(l)!==!1)){if(l.firstChild())continue;u=!0}for(;u&&n&&(a||!l.type.isAnonymous)&&n(l),!l.nextSibling();){if(!l.parent())return;u=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:Wc(Ei.none,this.children,this.positions,0,this.children.length,0,this.length,(e,n,r)=>new Re(this.type,e,n,r,this.propValues),t.makeTree||((e,n,r)=>new Re(Ei.none,e,n,r)))}static build(t){return sw(t)}}Re.empty=new Re(Ei.none,[],[],0);class Yc{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Yc(this.buffer,this.index)}}class sr{constructor(t,e,n){this.buffer=t,this.length=e,this.set=n}get type(){return Ei.none}toString(){let t=[];for(let e=0;e0));l=s[l+3]);return a}slice(t,e,n){let r=this.buffer,o=new Uint16Array(e-t),s=0;for(let a=t,l=0;a=t&&et;case 1:return e<=t&&n>t;case 2:return n>t;case 4:return!0}}function lo(i,t,e,n){for(var r;i.from==i.to||(e<1?i.from>=t:i.from>t)||(e>-1?i.to<=t:i.to0?a.length:-1;t!=u;t+=e){let c=a[t],d=l[t]+s.from;if(Kg(r,n,d,d+c.length)){if(c instanceof sr){if(o&He.ExcludeBuffers)continue;let f=c.findChild(0,c.buffer.length,e,n-d,r);if(f>-1)return new vn(new iw(s,c,t,d),null,f)}else if(o&He.IncludeAnonymous||!c.type.isAnonymous||Zc(c)){let f;if(!(o&He.IgnoreMounts)&&(f=Wa.get(c))&&!f.overlay)return new Ai(f.tree,d,t,s);let g=new Ai(c,d,t,s);return o&He.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(e<0?c.children.length-1:0,e,n,r)}}}if(o&He.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?t=s.index+e:t=e<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,n=0){let r;if(!(n&He.IgnoreOverlays)&&(r=Wa.get(this._tree))&&r.overlay){let o=t-this.from;for(let{from:s,to:a}of r.overlay)if((e>0?s<=o:s=o:a>o))return new Ai(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,n)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Kd(i,t,e,n){let r=i.cursor(),o=[];if(!r.firstChild())return o;if(e!=null){for(let s=!1;!s;)if(s=r.type.is(e),!r.nextSibling())return o}for(;;){if(n!=null&&r.type.is(n))return o;if(r.type.is(t)&&o.push(r.node),!r.nextSibling())return n==null?o:[]}}function nc(i,t,e=t.length-1){for(let n=i.parent;e>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[e]&&t[e]!=n.name)return!1;e--}}return!0}class iw{constructor(t,e,n,r){this.parent=t,this.buffer=e,this.index=n,this.start=r}}class vn extends tv{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,n){super(),this.context=t,this._parent=e,this.index=n,this.type=t.buffer.set.types[t.buffer.buffer[n]]}child(t,e,n){let{buffer:r}=this.context,o=r.findChild(this.index+4,r.buffer[this.index+3],t,e-this.context.start,n);return o<0?null:new vn(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,n=0){if(n&He.ExcludeBuffers)return null;let{buffer:r}=this.context,o=r.findChild(this.index+4,r.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return o<0?null:new vn(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new vn(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new vn(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:n}=this.context,r=this.index+4,o=n.buffer[this.index+3];if(o>r){let s=n.buffer[this.index+1];t.push(n.slice(r,o,s)),e.push(0)}return new Re(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ev(i){if(!i.length)return null;let t=0,e=i[0];for(let o=1;oe.from||s.to=t){let a=new Ai(s.tree,s.overlay[0].from+o.from,-1,o);(r||(r=[n])).push(lo(a,t,e,!1))}}return r?ev(r):n}class rc{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof Ai)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let n=t._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,e){this.index=t;let{start:n,buffer:r}=this.buffer;return this.type=e||r.set.types[r.buffer[t]],this.from=n+r.buffer[t+1],this.to=n+r.buffer[t+2],!0}yield(t){return t?t instanceof Ai?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,n,this.mode));let{buffer:r}=this.buffer,o=r.findChild(this.index+4,r.buffer[this.index+3],t,e-this.buffer.start,n);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,n=this.mode){return this.buffer?n&He.ExcludeBuffers?!1:this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&He.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&He.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:e}=this.buffer,n=this.stack.length-1;if(t<0){let r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(e.findChild(r,this.index,-1,0,4))}else{let r=e.buffer[this.index+3];if(r<(n<0?e.buffer.length:e.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,n,{buffer:r}=this;if(r){if(t>0){if(this.index-1)for(let o=e+t,s=t<0?-1:n._tree.children.length;o!=s;o+=t){let a=n._tree.children[o];if(this.mode&He.IncludeAnonymous||a instanceof sr||!a.type.isAnonymous||Zc(a))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to=0;){for(let s=t;s;s=s._parent)if(s.index==r){if(r==this.index)return s;e=s,n=o+1;break t}r=this.stack[--o]}for(let r=n;r=0;o--){if(o<0)return nc(this.node,t,r);let s=n[e.buffer[this.stack[o]]];if(!s.isAnonymous){if(t[r]&&t[r]!=s.name)return!1;r--}}return!0}}function Zc(i){return i.children.some(t=>t instanceof sr||!t.type.isAnonymous||Zc(t))}function sw(i){var t;let{buffer:e,nodeSet:n,maxBufferLength:r=Jg,reused:o=[],minRepeatType:s=n.types.length}=i,a=Array.isArray(e)?new Yc(e,e.length):e,l=n.types,u=0,c=0;function d($,Q,X,R,W,D){let{id:z,start:N,end:U,size:T}=a,H=c;for(;T<0;)if(a.next(),T==-1){let Pt=o[z];X.push(Pt),R.push(N-$);return}else if(T==-3){u=z;return}else if(T==-4){c=z;return}else throw new RangeError(`Unrecognized record size: ${T}`);let gt=l[z],at,Et,pt=N-$;if(U-N<=r&&(Et=v(a.pos-Q,W))){let Pt=new Uint16Array(Et.size-Et.skip),nt=a.pos-Et.size,it=Pt.length;for(;a.pos>nt;)it=O(Et.start,Pt,it);at=new sr(Pt,U-Et.start,n),pt=Et.start-$}else{let Pt=a.pos-T;a.next();let nt=[],it=[],It=z>=s?z:-1,kt=0,xt=U;for(;a.pos>Pt;)It>=0&&a.id==It&&a.size>=0?(a.end<=xt-r&&(x(nt,it,N,kt,a.end,xt,It,H),kt=nt.length,xt=a.end),a.next()):D>2500?f(N,Pt,nt,it):d(N,Pt,nt,it,It,D+1);if(It>=0&&kt>0&&kt-1&&kt>0){let Kt=g(gt);at=Wc(gt,nt,it,0,nt.length,0,U-N,Kt,Kt)}else at=m(gt,nt,it,U-N,H-U)}X.push(at),R.push(pt)}function f($,Q,X,R){let W=[],D=0,z=-1;for(;a.pos>Q;){let{id:N,start:U,end:T,size:H}=a;if(H>4)a.next();else{if(z>-1&&U=0;T-=3)N[H++]=W[T],N[H++]=W[T+1]-U,N[H++]=W[T+2]-U,N[H++]=H;X.push(new sr(N,W[2]-U,n)),R.push(U-$)}}function g($){return(Q,X,R)=>{let W=0,D=Q.length-1,z,N;if(D>=0&&(z=Q[D])instanceof Re){if(!D&&z.type==$&&z.length==R)return z;(N=z.prop(ce.lookAhead))&&(W=X[D]+z.length+N)}return m($,Q,X,R,W)}}function x($,Q,X,R,W,D,z,N){let U=[],T=[];for(;$.length>R;)U.push($.pop()),T.push(Q.pop()+X-W);$.push(m(n.types[z],U,T,D-W,N-D)),Q.push(W-X)}function m($,Q,X,R,W=0,D){if(u){let z=[ce.contextHash,u];D=D?[z].concat(D):[z]}if(W>25){let z=[ce.lookAhead,W];D=D?[z].concat(D):[z]}return new Re($,Q,X,R,D)}function v($,Q){let X=a.fork(),R=0,W=0,D=0,z=X.end-r,N={size:0,start:0,skip:0};t:for(let U=X.pos-$;X.pos>U;){let T=X.size;if(X.id==Q&&T>=0){N.size=R,N.start=W,N.skip=D,D+=4,R+=4,X.next();continue}let H=X.pos-T;if(T<0||H=s?4:0,at=X.start;for(X.next();X.pos>H;){if(X.size<0)if(X.size==-3)gt+=4;else break t;else X.id>=s&&(gt+=4);X.next()}W=at,R+=T,D+=gt}return(Q<0||R==$)&&(N.size=R,N.start=W,N.skip=D),N.size>4?N:void 0}function O($,Q,X){let{id:R,start:W,end:D,size:z}=a;if(a.next(),z>=0&&R4){let U=a.pos-(z-4);for(;a.pos>U;)X=O($,Q,X)}Q[--X]=N,Q[--X]=D-$,Q[--X]=W-$,Q[--X]=R}else z==-3?u=R:z==-4&&(c=R);return X}let b=[],k=[];for(;a.pos>0;)d(i.start||0,i.bufferStart||0,b,k,-1,0);let E=(t=i.length)!==null&&t!==void 0?t:b.length?k[0]+b[0].length:0;return new Re(l[i.topID],b.reverse(),k.reverse(),E)}const tp=new WeakMap;function Ia(i,t){if(!i.isAnonymous||t instanceof sr||t.type!=i)return 1;let e=tp.get(t);if(e==null){e=1;for(let n of t.children){if(n.type!=i||!(n instanceof Re)){e=1;break}e+=Ia(i,n)}tp.set(t,e)}return e}function Wc(i,t,e,n,r,o,s,a,l){let u=0;for(let x=n;x=c)break;Q+=X}if(k==E+1){if(Q>c){let X=x[E];g(X.children,X.positions,0,X.children.length,m[E]+b);continue}d.push(x[E])}else{let X=m[k-1]+x[k-1].length-$;d.push(Wc(i,x,m,E,k,$,X,null,l))}f.push($+b-o)}}return g(t,e,n,r,0),(a||l)(d,f,s)}class ow{constructor(){this.map=new WeakMap}setBuffer(t,e,n){let r=this.map.get(t);r||this.map.set(t,r=new Map),r.set(e,n)}getBuffer(t,e){let n=this.map.get(t);return n&&n.get(e)}set(t,e){t instanceof vn?this.setBuffer(t.context.buffer,t.index,e):t instanceof Ai&&this.map.set(t.tree,e)}get(t){return t instanceof vn?this.getBuffer(t.context.buffer,t.index):t instanceof Ai?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class wr{constructor(t,e,n,r,o=!1,s=!1){this.from=t,this.to=e,this.tree=n,this.offset=r,this.open=(o?1:0)|(s?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,e=[],n=!1){let r=[new wr(0,t.length,t,0,!1,n)];for(let o of e)o.to>t.length&&r.push(o);return r}static applyChanges(t,e,n=128){if(!e.length)return t;let r=[],o=1,s=t.length?t[0]:null;for(let a=0,l=0,u=0;;a++){let c=a=n)for(;s&&s.from=f.from||d<=f.to||u){let g=Math.max(f.from,l)-u,x=Math.min(f.to,d)-u;f=g>=x?null:new wr(g,x,f.tree,f.offset+u,a>0,!!c)}if(f&&r.push(f),s.to>d)break;s=onew Ih(r.from,r.to)):[new Ih(0,0)]:[new Ih(0,t.length)],this.createParse(t,e||[],n)}parse(t,e,n){let r=this.startParse(t,e,n);for(;;){let o=r.advance();if(o)return o}}}class aw{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}}new ce({perNode:!0});let lw=0;class dn{constructor(t,e,n){this.set=t,this.base=e,this.modified=n,this.id=lw++}static define(t){if(t!=null&&t.base)throw new Error("Can not derive from a modified tag");let e=new dn([],null,[]);if(e.set.push(e),t)for(let n of t.set)e.set.push(n);return e}static defineModifier(){let t=new Ua;return e=>e.modified.indexOf(t)>-1?e:Ua.get(e.base||e,e.modified.concat(t).sort((n,r)=>n.id-r.id))}}let hw=0;class Ua{constructor(){this.instances=[],this.id=hw++}static get(t,e){if(!e.length)return t;let n=e[0].instances.find(a=>a.base==t&&uw(e,a.modified));if(n)return n;let r=[],o=new dn(r,t,e);for(let a of e)a.instances.push(o);let s=cw(e);for(let a of t.set)if(!a.modified.length)for(let l of s)r.push(Ua.get(a,l));return o}}function uw(i,t){return i.length==t.length&&i.every((e,n)=>e==t[n])}function cw(i){let t=[[]];for(let e=0;en.length-e.length)}function nv(i){let t=Object.create(null);for(let e in i){let n=i[e];Array.isArray(n)||(n=[n]);for(let r of e.split(" "))if(r){let o=[],s=2,a=r;for(let d=0;;){if(a=="..."&&d>0&&d+3==r.length){s=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+r);if(o.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),d+=f[0].length,d==r.length)break;let g=r[d++];if(d==r.length&&g=="!"){s=0;break}if(g!="/")throw new RangeError("Invalid path: "+r);a=r.slice(d)}let l=o.length-1,u=o[l];if(!u)throw new RangeError("Invalid path: "+r);let c=new za(n,s,l>0?o.slice(0,l):null);t[u]=c.sort(t[u])}}return rv.add(t)}const rv=new ce;class za{constructor(t,e,n,r){this.tags=t,this.mode=e,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth{let s=r;for(let a of o)for(let l of a.set){let u=e[l.id];if(u){s=s?s+" "+u:u;break}}return s},scope:n}}function fw(i,t){let e=null;for(let n of i){let r=n.style(t);r&&(e=e?e+" "+r:r)}return e}function dw(i,t,e,n=0,r=i.length){let o=new pw(n,Array.isArray(t)?t:[t],e);o.highlightRange(i.cursor(),n,r,"",o.highlighters),o.flush(r)}class pw{constructor(t,e,n){this.at=t,this.highlighters=e,this.span=n,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,n,r,o){let{type:s,from:a,to:l}=t;if(a>=n||l<=e)return;s.isTop&&(o=this.highlighters.filter(g=>!g.scope||g.scope(s)));let u=r,c=mw(t)||za.empty,d=fw(o,c.tags);if(d&&(u&&(u+=" "),u+=d,c.mode==1&&(r+=(r?" ":"")+d)),this.startSpan(Math.max(e,a),u),c.opaque)return;let f=t.tree&&t.tree.prop(ce.mounted);if(f&&f.overlay){let g=t.node.enter(f.overlay[0].from+a,1),x=this.highlighters.filter(v=>!v.scope||v.scope(f.tree.type)),m=t.firstChild();for(let v=0,O=a;;v++){let b=v=k||!t.nextSibling())););if(!b||k>n)break;O=b.to+a,O>e&&(this.highlightRange(g.cursor(),Math.max(e,b.from+a),Math.min(n,O),"",x),this.startSpan(Math.min(n,O),u))}m&&t.parent()}else if(t.firstChild()){f&&(r="");do if(!(t.to<=e)){if(t.from>=n)break;this.highlightRange(t,e,n,r,o),this.startSpan(Math.min(n,t.to),u)}while(t.nextSibling());t.parent()}}}function mw(i){let t=i.type.prop(rv);for(;t&&t.context&&!i.matchContext(t.context);)t=t.next;return t||null}const Nt=dn.define,ra=Nt(),Zn=Nt(),ep=Nt(Zn),ip=Nt(Zn),Wn=Nt(),sa=Nt(Wn),Mh=Nt(Wn),un=Nt(),fr=Nt(un),ln=Nt(),hn=Nt(),sc=Nt(),ks=Nt(sc),oa=Nt(),mt={comment:ra,lineComment:Nt(ra),blockComment:Nt(ra),docComment:Nt(ra),name:Zn,variableName:Nt(Zn),typeName:ep,tagName:Nt(ep),propertyName:ip,attributeName:Nt(ip),className:Nt(Zn),labelName:Nt(Zn),namespace:Nt(Zn),macroName:Nt(Zn),literal:Wn,string:sa,docString:Nt(sa),character:Nt(sa),attributeValue:Nt(sa),number:Mh,integer:Nt(Mh),float:Nt(Mh),bool:Nt(Wn),regexp:Nt(Wn),escape:Nt(Wn),color:Nt(Wn),url:Nt(Wn),keyword:ln,self:Nt(ln),null:Nt(ln),atom:Nt(ln),unit:Nt(ln),modifier:Nt(ln),operatorKeyword:Nt(ln),controlKeyword:Nt(ln),definitionKeyword:Nt(ln),moduleKeyword:Nt(ln),operator:hn,derefOperator:Nt(hn),arithmeticOperator:Nt(hn),logicOperator:Nt(hn),bitwiseOperator:Nt(hn),compareOperator:Nt(hn),updateOperator:Nt(hn),definitionOperator:Nt(hn),typeOperator:Nt(hn),controlOperator:Nt(hn),punctuation:sc,separator:Nt(sc),bracket:ks,angleBracket:Nt(ks),squareBracket:Nt(ks),paren:Nt(ks),brace:Nt(ks),content:un,heading:fr,heading1:Nt(fr),heading2:Nt(fr),heading3:Nt(fr),heading4:Nt(fr),heading5:Nt(fr),heading6:Nt(fr),contentSeparator:Nt(un),list:Nt(un),quote:Nt(un),emphasis:Nt(un),strong:Nt(un),link:Nt(un),monospace:Nt(un),strikethrough:Nt(un),inserted:Nt(),deleted:Nt(),changed:Nt(),invalid:Nt(),meta:oa,documentMeta:Nt(oa),annotation:Nt(oa),processingInstruction:Nt(oa),definition:dn.defineModifier(),constant:dn.defineModifier(),function:dn.defineModifier(),standard:dn.defineModifier(),local:dn.defineModifier(),special:dn.defineModifier()};sv([{tag:mt.link,class:"tok-link"},{tag:mt.heading,class:"tok-heading"},{tag:mt.emphasis,class:"tok-emphasis"},{tag:mt.strong,class:"tok-strong"},{tag:mt.keyword,class:"tok-keyword"},{tag:mt.atom,class:"tok-atom"},{tag:mt.bool,class:"tok-bool"},{tag:mt.url,class:"tok-url"},{tag:mt.labelName,class:"tok-labelName"},{tag:mt.inserted,class:"tok-inserted"},{tag:mt.deleted,class:"tok-deleted"},{tag:mt.literal,class:"tok-literal"},{tag:mt.string,class:"tok-string"},{tag:mt.number,class:"tok-number"},{tag:[mt.regexp,mt.escape,mt.special(mt.string)],class:"tok-string2"},{tag:mt.variableName,class:"tok-variableName"},{tag:mt.local(mt.variableName),class:"tok-variableName tok-local"},{tag:mt.definition(mt.variableName),class:"tok-variableName tok-definition"},{tag:mt.special(mt.variableName),class:"tok-variableName2"},{tag:mt.definition(mt.propertyName),class:"tok-propertyName tok-definition"},{tag:mt.typeName,class:"tok-typeName"},{tag:mt.namespace,class:"tok-namespace"},{tag:mt.className,class:"tok-className"},{tag:mt.macroName,class:"tok-macroName"},{tag:mt.propertyName,class:"tok-propertyName"},{tag:mt.operator,class:"tok-operator"},{tag:mt.comment,class:"tok-comment"},{tag:mt.meta,class:"tok-meta"},{tag:mt.invalid,class:"tok-invalid"},{tag:mt.punctuation,class:"tok-punctuation"}]);var $h;const jr=new ce;function ov(i){return Zt.define({combine:i?t=>t.concat(i):void 0})}const Uc=new ce;class Zi{constructor(t,e,n=[],r=""){this.data=t,this.name=r,Oe.prototype.hasOwnProperty("tree")||Object.defineProperty(Oe.prototype,"tree",{get(){return Ye(this)}}),this.parser=e,this.extension=[or.of(this),Oe.languageData.of((o,s,a)=>{let l=np(o,s,a),u=l.type.prop(jr);if(!u)return[];let c=o.facet(u),d=l.type.prop(Uc);if(d){let f=l.resolve(s-l.from,a);for(let g of d)if(g.test(f,o)){let x=o.facet(g.facet);return g.type=="replace"?x:x.concat(c)}}return c})].concat(n)}isActiveAt(t,e,n=-1){return np(t,e,n).type.prop(jr)==this.data}findRegions(t){let e=t.facet(or);if((e==null?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let n=[],r=(o,s)=>{if(o.prop(jr)==this.data){n.push({from:s,to:s+o.length});return}let a=o.prop(ce.mounted);if(a){if(a.tree.prop(jr)==this.data){if(a.overlay)for(let l of a.overlay)n.push({from:l.from+s,to:l.to+s});else n.push({from:s,to:s+o.length});return}else if(a.overlay){let l=n.length;if(r(a.tree,a.overlay[0].from+s),n.length>l)return}}for(let l=0;ln.isTop?e:void 0)]}),t.name)}configure(t,e){return new ja(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Ye(i){let t=i.field(Zi.state,!1);return t?t.tree:Re.empty}function zc(i,t,e=50){var n;let r=(n=i.field(Zi.state,!1))===null||n===void 0?void 0:n.context;if(!r)return null;let o=r.viewport;r.updateViewport({from:0,to:t});let s=r.isDone(t)||r.work(e,t)?r.tree:null;return r.updateViewport(o),s}class gw{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let n=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-n,e-n)}}let Ls=null;class qa{constructor(t,e,n=[],r,o,s,a,l){this.parser=t,this.state=e,this.fragments=n,this.tree=r,this.treeLen=o,this.viewport=s,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,e,n){return new qa(t,e,[],Re.empty,0,n,[],null)}startParse(){return this.parser.startParse(new gw(this.state.doc),this.fragments)}work(t,e){return e!=null&&e>=this.state.doc.length&&(e=void 0),this.tree!=Re.empty&&this.isDone(e??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof t=="number"){let r=Date.now()+t;t=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),e!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&e=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(e=this.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(wr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Ls;Ls=this;try{return t()}finally{Ls=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=rp(t,e.from,e.to);return t}changes(t,e){let{fragments:n,tree:r,treeLen:o,viewport:s,skipped:a}=this;if(this.takeTree(),!t.empty){let l=[];if(t.iterChangedRanges((u,c,d,f)=>l.push({fromA:u,toA:c,fromB:d,toB:f})),n=wr.applyChanges(n,l),r=Re.empty,o=0,s={from:t.mapPos(s.from,-1),to:t.mapPos(s.to,1)},this.skipped.length){a=[];for(let u of this.skipped){let c=t.mapPos(u.from,1),d=t.mapPos(u.to,-1);ct.from&&(this.fragments=rp(this.fragments,r,o),this.skipped.splice(n--,1))}return this.skipped.length>=e?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends iv{createParse(e,n,r){let o=r[0].from,s=r[r.length-1].to;return{parsedPos:o,advance(){let l=Ls;if(l){for(let u of r)l.tempSkipped.push(u);t&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,t]):t)}return this.parsedPos=s,new Re(Ei.none,[],[],s-o)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&e[0].from==0&&e[0].to>=t}static get(){return Ls}}function rp(i,t,e){return wr.applyChanges(i,[{fromA:t,toA:e,fromB:t,toB:e}])}class fs{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),n=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,n)||e.takeTree(),new fs(e)}static init(t){let e=Math.min(3e3,t.doc.length),n=qa.create(t.facet(or).parser,t,{from:0,to:e});return n.work(20,e)||n.takeTree(),new fs(n)}}Zi.state=ti.define({create:fs.init,update(i,t){for(let e of t.effects)if(e.is(Zi.setState))return e.value;return t.startState.facet(or)!=t.state.facet(or)?fs.init(t.state):i.apply(t)}});let av=i=>{let t=setTimeout(()=>i(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(av=i=>{let t=-1,e=setTimeout(()=>{t=requestIdleCallback(i,{timeout:500-100})},100);return()=>t<0?clearTimeout(e):cancelIdleCallback(t)});const Qh=typeof navigator<"u"&&(!(($h=navigator.scheduling)===null||$h===void 0)&&$h.isInputPending)?()=>navigator.scheduling.isInputPending():null,vw=Fe.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(Zi.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Zi.state);(e.tree!=e.context.tree||!e.context.isDone(t.doc.length))&&(this.working=av(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndr+1e3,l=o.context.work(()=>Qh&&Qh()||Date.now()>s,r+(a?0:1e5));this.chunkBudget-=Date.now()-e,(l||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:Zi.setState.of(new fs(o.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(e=>Pi(this.view.state,e)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),or=Zt.define({combine(i){return i.length?i[0]:null},enables:i=>[Zi.state,vw,Rt.contentAttributes.compute([i],t=>{let e=t.facet(i);return e&&e.name?{"data-language":e.name}:{}})]});class yw{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}const Ow=Zt.define(),Tr=Zt.define({combine:i=>{if(!i.length)return" ";let t=i[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(i[0]));return t}});function Va(i){let t=i.facet(Tr);return t.charCodeAt(0)==9?i.tabSize*t.length:t.length}function ho(i,t){let e="",n=i.tabSize,r=i.facet(Tr)[0];if(r==" "){for(;t>=n;)e+=" ",t-=n;r=" "}for(let o=0;o=t?_w(i,e,t):null}class Tl{constructor(t,e={}){this.state=t,this.options=e,this.unit=Va(t)}lineAt(t,e=1){let n=this.state.doc.lineAt(t),{simulateBreak:r,simulateDoubleBreak:o}=this.options;return r!=null&&r>=n.from&&r<=n.to?o&&r==t?{text:"",from:t}:(e<0?r-1&&(o+=s-this.countColumn(n,n.search(/\S|$/))),o}countColumn(t,e=t.length){return gs(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:n,from:r}=this.lineAt(t,e),o=this.options.overrideIndentation;if(o){let s=o(r);if(s>-1)return s}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const lv=new ce;function _w(i,t,e){let n=t.resolveStack(e),r=n.node.enterUnfinishedNodesBefore(e);if(r!=n.node){let o=[];for(let s=r;s!=n.node;s=s.parent)o.push(s);for(let s=o.length-1;s>=0;s--)n={node:o[s],next:n}}return hv(n,i,e)}function hv(i,t,e){for(let n=i;n;n=n.next){let r=bw(n.node);if(r)return r(qc.create(t,e,n))}return 0}function xw(i){return i.pos==i.options.simulateBreak&&i.options.simulateDoubleBreak}function bw(i){let t=i.type.prop(lv);if(t)return t;let e=i.firstChild,n;if(e&&(n=e.type.prop(ce.closedBy))){let r=i.lastChild,o=r&&n.indexOf(r.name)>-1;return s=>uv(s,!0,1,void 0,o&&!xw(s)?r.from:void 0)}return i.parent==null?ww:null}function ww(){return 0}class qc extends Tl{constructor(t,e,n){super(t.state,t.options),this.base=t,this.pos=e,this.context=n}get node(){return this.context.node}static create(t,e,n){return new qc(t,e,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let e=this.state.doc.lineAt(t.from);for(;;){let n=t.resolve(e.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(Sw(n,t))break;e=this.state.doc.lineAt(n.from)}return this.lineIndent(e.from)}continue(){return hv(this.context.next,this.base,this.pos)}}function Sw(i,t){for(let e=t;e;e=e.parent)if(i==e)return!0;return!1}function Cw(i){let t=i.node,e=t.childAfter(t.from),n=t.lastChild;if(!e)return null;let r=i.options.simulateBreak,o=i.state.doc.lineAt(e.from),s=r==null||r<=o.from?o.to:Math.min(o.to,r);for(let a=e.to;;){let l=t.childAfter(a);if(!l||l==n)return null;if(!l.type.isSkipped)return l.fromuv(n,t,e,i)}function uv(i,t,e,n,r){let o=i.textAfter,s=o.match(/^\s*/)[0].length,a=n&&o.slice(s,s+n.length)==n||r==i.pos+s,l=t?Cw(i):null;return l?a?i.column(l.from):i.column(l.to):i.baseIndent+(a?0:i.unit*e)}const kw=i=>i.baseIndent;function Nh({except:i,units:t=1}={}){return e=>{let n=i&&i.test(e.textAfter);return e.baseIndent+(n?0:t*e.unit)}}const Lw=200;function Aw(){return Oe.transactionFilter.of(i=>{if(!i.docChanged||!i.isUserEvent("input.type")&&!i.isUserEvent("input.complete"))return i;let t=i.startState.languageDataAt("indentOnInput",i.startState.selection.main.head);if(!t.length)return i;let e=i.newDoc,{head:n}=i.newSelection.main,r=e.lineAt(n);if(n>r.from+Lw)return i;let o=e.sliceString(r.from,n);if(!t.some(u=>u.test(o)))return i;let{state:s}=i,a=-1,l=[];for(let{head:u}of s.selection.ranges){let c=s.doc.lineAt(u);if(c.from==a)continue;a=c.from;let d=jc(s,c.from);if(d==null)continue;let f=/^\s*/.exec(c.text)[0],g=ho(s,d);f!=g&&l.push({from:c.from,to:c.from+f.length,insert:g})}return l.length?[i,{changes:l,sequential:!0}]:i})}const Ew=Zt.define(),cv=new ce;function Dw(i){let t=i.firstChild,e=i.lastChild;return t&&t.toe)continue;if(o&&a.from=t&&u.to>e&&(o=u)}}return o}function Iw(i){let t=i.lastChild;return t&&t.to==i.to&&t.type.isError}function Ga(i,t,e){for(let n of i.facet(Ew)){let r=n(i,t,e);if(r)return r}return Tw(i,t,e)}function fv(i,t){let e=t.mapPos(i.from,1),n=t.mapPos(i.to,-1);return e>=n?void 0:{from:e,to:n}}const Il=re.define({map:fv}),Co=re.define({map:fv});function dv(i){let t=[];for(let{head:e}of i.state.selection.ranges)t.some(n=>n.from<=e&&n.to>=e)||t.push(i.lineBlockAt(e));return t}const Ir=ti.define({create(){return Gt.none},update(i,t){i=i.map(t.changes);for(let e of t.effects)if(e.is(Il)&&!Mw(i,e.value.from,e.value.to)){let{preparePlaceholder:n}=t.state.facet(Vc),r=n?Gt.replace({widget:new Xw(n(t.state,e.value))}):sp;i=i.update({add:[r.range(e.value.from,e.value.to)]})}else e.is(Co)&&(i=i.update({filter:(n,r)=>e.value.from!=n||e.value.to!=r,filterFrom:e.value.from,filterTo:e.value.to}));if(t.selection){let e=!1,{head:n}=t.selection.main;i.between(n,n,(r,o)=>{rn&&(e=!0)}),e&&(i=i.update({filterFrom:n,filterTo:n,filter:(r,o)=>o<=n||r>=n}))}return i},provide:i=>Rt.decorations.from(i),toJSON(i,t){let e=[];return i.between(0,t.doc.length,(n,r)=>{e.push(n,r)}),e},fromJSON(i){if(!Array.isArray(i)||i.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let e=0;e{(!r||r.from>o)&&(r={from:o,to:s})}),r}function Mw(i,t,e){let n=!1;return i.between(t,t,(r,o)=>{r==t&&o==e&&(n=!0)}),n}function pv(i,t){return i.field(Ir,!1)?t:t.concat(re.appendConfig.of(vv()))}const mv=i=>{for(let t of dv(i)){let e=Ga(i.state,t.from,t.to);if(e)return i.dispatch({effects:pv(i.state,[Il.of(e),gv(i,e)])}),!0}return!1},$w=i=>{if(!i.state.field(Ir,!1))return!1;let t=[];for(let e of dv(i)){let n=Ha(i.state,e.from,e.to);n&&t.push(Co.of(n),gv(i,n,!1))}return t.length&&i.dispatch({effects:t}),t.length>0};function gv(i,t,e=!0){let n=i.state.doc.lineAt(t.from).number,r=i.state.doc.lineAt(t.to).number;return Rt.announce.of(`${i.state.phrase(e?"Folded lines":"Unfolded lines")} ${n} ${i.state.phrase("to")} ${r}.`)}const Qw=i=>{let{state:t}=i,e=[];for(let n=0;n{let t=i.state.field(Ir,!1);if(!t||!t.size)return!1;let e=[];return t.between(0,i.state.doc.length,(n,r)=>{e.push(Co.of({from:n,to:r}))}),i.dispatch({effects:e}),!0},Bw=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:mv},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:$w},{key:"Ctrl-Alt-[",run:Qw},{key:"Ctrl-Alt-]",run:Nw}],Fw={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Vc=Zt.define({combine(i){return xn(i,Fw)}});function vv(i){let t=[Ir,Zw];return i&&t.push(Vc.of(i)),t}function yv(i,t){let{state:e}=i,n=e.facet(Vc),r=s=>{let a=i.lineBlockAt(i.posAtDOM(s.target)),l=Ha(i.state,a.from,a.to);l&&i.dispatch({effects:Co.of(l)}),s.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(i,r,t);let o=document.createElement("span");return o.textContent=n.placeholderText,o.setAttribute("aria-label",e.phrase("folded code")),o.title=e.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=r,o}const sp=Gt.replace({widget:new class extends Mn{toDOM(i){return yv(i,null)}}});class Xw extends Mn{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return yv(t,this.value)}}const Rw={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Bh extends Tn{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}function Yw(i={}){let t=Object.assign(Object.assign({},Rw),i),e=new Bh(t,!0),n=new Bh(t,!1),r=Fe.fromClass(class{constructor(s){this.from=s.viewport.from,this.markers=this.buildMarkers(s)}update(s){(s.docChanged||s.viewportChanged||s.startState.facet(or)!=s.state.facet(or)||s.startState.field(Ir,!1)!=s.state.field(Ir,!1)||Ye(s.startState)!=Ye(s.state)||t.foldingChanged(s))&&(this.markers=this.buildMarkers(s.view))}buildMarkers(s){let a=new _n;for(let l of s.viewportLineBlocks){let u=Ha(s.state,l.from,l.to)?n:Ga(s.state,l.from,l.to)?e:null;u&&a.add(l.from,l.from,u)}return a.finish()}}),{domEventHandlers:o}=t;return[r,Wb({class:"cm-foldGutter",markers(s){var a;return((a=s.plugin(r))===null||a===void 0?void 0:a.markers)||ge.empty},initialSpacer(){return new Bh(t,!1)},domEventHandlers:Object.assign(Object.assign({},o),{click:(s,a,l)=>{if(o.click&&o.click(s,a,l))return!0;let u=Ha(s.state,a.from,a.to);if(u)return s.dispatch({effects:Co.of(u)}),!0;let c=Ga(s.state,a.from,a.to);return c?(s.dispatch({effects:Il.of(c)}),!0):!1}})}),vv()]}const Zw=Rt.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Ml{constructor(t,e){this.specs=t;let n;function r(a){let l=ir.newName();return(n||(n=Object.create(null)))["."+l]=a,l}const o=typeof e.all=="string"?e.all:e.all?r(e.all):void 0,s=e.scope;this.scope=s instanceof Zi?a=>a.prop(jr)==s.data:s?a=>a==s:void 0,this.style=sv(t.map(a=>({tag:a.tag,class:a.class||r(Object.assign({},a,{tag:null}))})),{all:o}).style,this.module=n?new ir(n):null,this.themeType=e.themeType}static define(t,e){return new Ml(t,e||{})}}const oc=Zt.define(),Ov=Zt.define({combine(i){return i.length?[i[0]]:null}});function Fh(i){let t=i.facet(oc);return t.length?t:i.facet(Ov)}function Ww(i,t){let e=[zw],n;return i instanceof Ml&&(i.module&&e.push(Rt.styleModule.of(i.module)),n=i.themeType),t!=null&&t.fallback?e.push(Ov.of(i)):n?e.push(oc.computeN([Rt.darkTheme],r=>r.facet(Rt.darkTheme)==(n=="dark")?[i]:[])):e.push(oc.of(i)),e}class Uw{constructor(t){this.markCache=Object.create(null),this.tree=Ye(t.state),this.decorations=this.buildDeco(t,Fh(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=Ye(t.state),n=Fh(t.state),r=n!=Fh(t.startState),{viewport:o}=t.view,s=t.changes.mapPos(this.decoratedTo,1);e.length=o.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=s):(e!=this.tree||t.viewportChanged||r)&&(this.tree=e,this.decorations=this.buildDeco(t.view,n),this.decoratedTo=o.to)}buildDeco(t,e){if(!e||!this.tree.length)return Gt.none;let n=new _n;for(let{from:r,to:o}of t.visibleRanges)dw(this.tree,e,(s,a,l)=>{n.add(s,a,this.markCache[l]||(this.markCache[l]=Gt.mark({class:l})))},r,o);return n.finish()}}const zw=lr.high(Fe.fromClass(Uw,{decorations:i=>i.decorations})),jw=Ml.define([{tag:mt.meta,color:"#404740"},{tag:mt.link,textDecoration:"underline"},{tag:mt.heading,textDecoration:"underline",fontWeight:"bold"},{tag:mt.emphasis,fontStyle:"italic"},{tag:mt.strong,fontWeight:"bold"},{tag:mt.strikethrough,textDecoration:"line-through"},{tag:mt.keyword,color:"#708"},{tag:[mt.atom,mt.bool,mt.url,mt.contentSeparator,mt.labelName],color:"#219"},{tag:[mt.literal,mt.inserted],color:"#164"},{tag:[mt.string,mt.deleted],color:"#a11"},{tag:[mt.regexp,mt.escape,mt.special(mt.string)],color:"#e40"},{tag:mt.definition(mt.variableName),color:"#00f"},{tag:mt.local(mt.variableName),color:"#30a"},{tag:[mt.typeName,mt.namespace],color:"#085"},{tag:mt.className,color:"#167"},{tag:[mt.special(mt.variableName),mt.macroName],color:"#256"},{tag:mt.definition(mt.propertyName),color:"#00c"},{tag:mt.comment,color:"#940"},{tag:mt.invalid,color:"#f00"}]),qw=Rt.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),_v=1e4,xv="()[]{}",bv=Zt.define({combine(i){return xn(i,{afterCursor:!0,brackets:xv,maxScanDistance:_v,renderMatch:Hw})}}),Vw=Gt.mark({class:"cm-matchingBracket"}),Gw=Gt.mark({class:"cm-nonmatchingBracket"});function Hw(i){let t=[],e=i.matched?Vw:Gw;return t.push(e.range(i.start.from,i.start.to)),i.end&&t.push(e.range(i.end.from,i.end.to)),t}const Jw=ti.define({create(){return Gt.none},update(i,t){if(!t.docChanged&&!t.selection)return i;let e=[],n=t.state.facet(bv);for(let r of t.state.selection.ranges){if(!r.empty)continue;let o=Wi(t.state,r.head,-1,n)||r.head>0&&Wi(t.state,r.head-1,1,n)||n.afterCursor&&(Wi(t.state,r.head,1,n)||r.headRt.decorations.from(i)}),Kw=[Jw,qw];function tS(i={}){return[bv.of(i),Kw]}const eS=new ce;function ac(i,t,e){let n=i.prop(t<0?ce.openedBy:ce.closedBy);if(n)return n;if(i.name.length==1){let r=e.indexOf(i.name);if(r>-1&&r%2==(t<0?1:0))return[e[r+t]]}return null}function lc(i){let t=i.type.prop(eS);return t?t(i.node):i}function Wi(i,t,e,n={}){let r=n.maxScanDistance||_v,o=n.brackets||xv,s=Ye(i),a=s.resolveInner(t,e);for(let l=a;l;l=l.parent){let u=ac(l.type,e,o);if(u&&l.from0?t>=c.from&&tc.from&&t<=c.to))return iS(i,t,e,l,c,u,o)}}return nS(i,t,e,s,a.type,r,o)}function iS(i,t,e,n,r,o,s){let a=n.parent,l={from:r.from,to:r.to},u=0,c=a==null?void 0:a.cursor();if(c&&(e<0?c.childBefore(n.from):c.childAfter(n.to)))do if(e<0?c.to<=n.from:c.from>=n.to){if(u==0&&o.indexOf(c.type.name)>-1&&c.from0)return null;let u={from:e<0?t-1:t,to:e>0?t+1:t},c=i.doc.iterRange(t,e>0?i.doc.length:0),d=0;for(let f=0;!c.next().done&&f<=o;){let g=c.value;e<0&&(f+=g.length);let x=t+f*e;for(let m=e>0?0:g.length-1,v=e>0?g.length:-1;m!=v;m+=e){let O=s.indexOf(g[m]);if(!(O<0||n.resolveInner(x+m,1).type!=r))if(O%2==0==e>0)d++;else{if(d==1)return{start:u,end:{from:x+m,to:x+m+1},matched:O>>1==l>>1};d--}}e>0&&(f+=g.length)}return c.done?{start:u,matched:!1}:null}function op(i,t,e,n=0,r=0){t==null&&(t=i.search(/[^\s\u00a0]/),t==-1&&(t=i.length));let o=r;for(let s=n;s=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pose}eatSpace(){let t=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t}skipToEnd(){this.pos=this.string.length}skipTo(t){let e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0}backUp(t){this.pos-=t}column(){return this.lastColumnPosn?s.toLowerCase():s,o=this.string.substr(this.pos,t.length);return r(o)==r(t)?(e!==!1&&(this.pos+=t.length),!0):null}else{let r=this.string.slice(this.pos).match(t);return r&&r.index>0?null:(r&&e!==!1&&(this.pos+=r[0].length),r)}}current(){return this.string.slice(this.start,this.pos)}}const sS=Object.create(null),ap=[Ei.none],lp=[],hp=Object.create(null),oS=Object.create(null);for(let[i,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])oS[i]=aS(sS,t);function Xh(i,t){lp.indexOf(i)>-1||(lp.push(i),console.warn(t))}function aS(i,t){let e=[];for(let a of t.split(" ")){let l=[];for(let u of a.split(".")){let c=i[u]||mt[u];c?typeof c=="function"?l.length?l=l.map(c):Xh(u,`Modifier ${u} used at start of tag`):l.length?Xh(u,`Tag ${u} used as modifier`):l=Array.isArray(c)?c:[c]:Xh(u,`Unknown highlighting tag ${u}`)}for(let u of l)e.push(u)}if(!e.length)return 0;let n=t.replace(/ /g,"_"),r=n+" "+e.map(a=>a.id),o=hp[r];if(o)return o.id;let s=hp[r]=Ei.define({id:ap.length,name:n,props:[nv({[n]:e})]});return ap.push(s),s.id}Me.RTL,Me.LTR;const lS=i=>{let{state:t}=i,e=t.doc.lineAt(t.selection.main.from),n=Hc(i.state,e.from);return n.line?hS(i):n.block?cS(i):!1};function Gc(i,t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=i(t,e);return r?(n(e.update(r)),!0):!1}}const hS=Gc(pS,0),uS=Gc(wv,0),cS=Gc((i,t)=>wv(i,t,dS(t)),0);function Hc(i,t){let e=i.languageDataAt("commentTokens",t);return e.length?e[0]:{}}const As=50;function fS(i,{open:t,close:e},n,r){let o=i.sliceDoc(n-As,n),s=i.sliceDoc(r,r+As),a=/\s*$/.exec(o)[0].length,l=/^\s*/.exec(s)[0].length,u=o.length-a;if(o.slice(u-t.length,u)==t&&s.slice(l,l+e.length)==e)return{open:{pos:n-a,margin:a&&1},close:{pos:r+l,margin:l&&1}};let c,d;r-n<=2*As?c=d=i.sliceDoc(n,r):(c=i.sliceDoc(n,n+As),d=i.sliceDoc(r-As,r));let f=/^\s*/.exec(c)[0].length,g=/\s*$/.exec(d)[0].length,x=d.length-g-e.length;return c.slice(f,f+t.length)==t&&d.slice(x,x+e.length)==e?{open:{pos:n+f+t.length,margin:/\s/.test(c.charAt(f+t.length))?1:0},close:{pos:r-g-e.length,margin:/\s/.test(d.charAt(x-1))?1:0}}:null}function dS(i){let t=[];for(let e of i.selection.ranges){let n=i.doc.lineAt(e.from),r=e.to<=n.to?n:i.doc.lineAt(e.to),o=t.length-1;o>=0&&t[o].to>n.from?t[o].to=r.to:t.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:r.to})}return t}function wv(i,t,e=t.selection.ranges){let n=e.map(o=>Hc(t,o.from).block);if(!n.every(o=>o))return null;let r=e.map((o,s)=>fS(t,n[s],o.from,o.to));if(i!=2&&!r.every(o=>o))return{changes:t.changes(e.map((o,s)=>r[s]?[]:[{from:o.from,insert:n[s].open+" "},{from:o.to,insert:" "+n[s].close}]))};if(i!=1&&r.some(o=>o)){let o=[];for(let s=0,a;sr&&(o==s||s>d.from)){r=d.from;let f=/^\s*/.exec(d.text)[0].length,g=f==d.length,x=d.text.slice(f,f+u.length)==u?f:-1;fo.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:a,token:l,indent:u,empty:c,single:d}of n)(d||!c)&&o.push({from:a.from+u,insert:l+" "});let s=t.changes(o);return{changes:s,selection:t.selection.map(s,1)}}else if(i!=1&&n.some(o=>o.comment>=0)){let o=[];for(let{line:s,comment:a,token:l}of n)if(a>=0){let u=s.from+a,c=u+l.length;s.text[c-s.from]==" "&&c++,o.push({from:u,to:c})}return{changes:o}}return null}const hc=In.define(),mS=In.define(),gS=Zt.define(),Sv=Zt.define({combine(i){return xn(i,{minDepth:100,newGroupDelay:500,joinToEvent:(t,e)=>e},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,e)=>(n,r)=>t(n,r)||e(n,r)})}});function vS(i){let t=0;return i.iterChangedRanges((e,n)=>t=n),t}const Cv=ti.define({create(){return yn.empty},update(i,t){let e=t.state.facet(Sv),n=t.annotation(hc);if(n){let l=t.docChanged?yt.single(vS(t.changes)):void 0,u=ki.fromTransaction(t,l),c=n.side,d=c==0?i.undone:i.done;return u?d=Ka(d,d.length,e.minDepth,u):d=kv(d,t.startState.selection),new yn(c==0?n.rest:d,c==0?d:n.rest)}let r=t.annotation(mS);if((r=="full"||r=="before")&&(i=i.isolate()),t.annotation(Ke.addToHistory)===!1)return t.changes.empty?i:i.addMapping(t.changes.desc);let o=ki.fromTransaction(t),s=t.annotation(Ke.time),a=t.annotation(Ke.userEvent);return o?i=i.addChanges(o,s,a,e,t):t.selection&&(i=i.addSelection(t.startState.selection,s,a,e.newGroupDelay)),(r=="full"||r=="after")&&(i=i.isolate()),i},toJSON(i){return{done:i.done.map(t=>t.toJSON()),undone:i.undone.map(t=>t.toJSON())}},fromJSON(i){return new yn(i.done.map(ki.fromJSON),i.undone.map(ki.fromJSON))}});function yS(i={}){return[Cv,Sv.of(i),Rt.domEventHandlers({beforeinput(t,e){let n=t.inputType=="historyUndo"?Jc:t.inputType=="historyRedo"?Ja:null;return n?(t.preventDefault(),n(e)):!1}})]}function $l(i,t){return function({state:e,dispatch:n}){if(!t&&e.readOnly)return!1;let r=e.field(Cv,!1);if(!r)return!1;let o=r.pop(i,e,t);return o?(n(o),!0):!1}}const Jc=$l(0,!1),Ja=$l(1,!1),OS=$l(0,!0),_S=$l(1,!0);class ki{constructor(t,e,n,r,o){this.changes=t,this.effects=e,this.mapped=n,this.startSelection=r,this.selectionsAfter=o}setSelAfter(t){return new ki(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,n;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(e=this.mapped)===null||e===void 0?void 0:e.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(t){return new ki(t.changes&&Ge.fromJSON(t.changes),[],t.mapped&&On.fromJSON(t.mapped),t.startSelection&&yt.fromJSON(t.startSelection),t.selectionsAfter.map(yt.fromJSON))}static fromTransaction(t,e){let n=Ui;for(let r of t.startState.facet(gS)){let o=r(t);o.length&&(n=n.concat(o))}return!n.length&&t.changes.empty?null:new ki(t.changes.invert(t.startState.doc),n,void 0,e||t.startState.selection,Ui)}static selection(t){return new ki(void 0,Ui,void 0,void 0,t)}}function Ka(i,t,e,n){let r=t+1>e+20?t-e-1:0,o=i.slice(r,t);return o.push(n),o}function xS(i,t){let e=[],n=!1;return i.iterChangedRanges((r,o)=>e.push(r,o)),t.iterChangedRanges((r,o,s,a)=>{for(let l=0;l=u&&s<=c&&(n=!0)}}),n}function bS(i,t){return i.ranges.length==t.ranges.length&&i.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function Pv(i,t){return i.length?t.length?i.concat(t):i:t}const Ui=[],wS=200;function kv(i,t){if(i.length){let e=i[i.length-1],n=e.selectionsAfter.slice(Math.max(0,e.selectionsAfter.length-wS));return n.length&&n[n.length-1].eq(t)?i:(n.push(t),Ka(i,i.length-1,1e9,e.setSelAfter(n)))}else return[ki.selection([t])]}function SS(i){let t=i[i.length-1],e=i.slice();return e[i.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),e}function Rh(i,t){if(!i.length)return i;let e=i.length,n=Ui;for(;e;){let r=CS(i[e-1],t,n);if(r.changes&&!r.changes.empty||r.effects.length){let o=i.slice(0,e);return o[e-1]=r,o}else t=r.mapped,e--,n=r.selectionsAfter}return n.length?[ki.selection(n)]:Ui}function CS(i,t,e){let n=Pv(i.selectionsAfter.length?i.selectionsAfter.map(a=>a.map(t)):Ui,e);if(!i.changes)return ki.selection(n);let r=i.changes.map(t),o=t.mapDesc(i.changes,!0),s=i.mapped?i.mapped.composeDesc(o):o;return new ki(r,re.mapEffects(i.effects,t),s,i.startSelection.map(o),n)}const PS=/^(input\.type|delete)($|\.)/;class yn{constructor(t,e,n=0,r=void 0){this.done=t,this.undone=e,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new yn(this.done,this.undone):this}addChanges(t,e,n,r,o){let s=this.done,a=s[s.length-1];return a&&a.changes&&!a.changes.empty&&t.changes&&(!n||PS.test(n))&&(!a.selectionsAfter.length&&e-this.prevTime0&&e-this.prevTimee.empty?i.moveByChar(e,t):Ql(e,t))}function yi(i){return i.textDirectionAt(i.state.selection.main.head)==Me.LTR}const tf=i=>Kc(i,!yi(i)),Lv=i=>Kc(i,yi(i)),LS=i=>Kc(i,!1);function Av(i,t){return rn(i,e=>e.empty?i.moveByGroup(e,t):Ql(e,t))}const AS=i=>Av(i,!yi(i)),ES=i=>Av(i,yi(i));function DS(i,t,e){if(t.type.prop(e))return!0;let n=t.to-t.from;return n&&(n>2||/[^\s,.;:]/.test(i.sliceDoc(t.from,t.to)))||t.firstChild}function Nl(i,t,e){let n=Ye(i).resolveInner(t.head),r=e?ce.closedBy:ce.openedBy;for(let l=t.head;;){let u=e?n.childAfter(l):n.childBefore(l);if(!u)break;DS(i,u,r)?n=u:l=e?u.to:u.from}let o=n.type.prop(r),s,a;return o&&(s=e?Wi(i,n.from,1):Wi(i,n.to,-1))&&s.matched?a=e?s.end.to:s.end.from:a=e?n.to:n.from,yt.cursor(a,e?-1:1)}const TS=i=>rn(i,t=>Nl(i.state,t,!yi(i))),IS=i=>rn(i,t=>Nl(i.state,t,yi(i)));function Ev(i,t){return rn(i,e=>{if(!e.empty)return Ql(e,t);let n=i.moveVertically(e,t);return n.head!=e.head?n:i.moveToLineBoundary(e,t)})}const Dv=i=>Ev(i,!1),Tv=i=>Ev(i,!0);function Iv(i){let t=i.scrollDOM.clientHeights.empty?i.moveVertically(s,t,e.height):Ql(s,t));if(r.eq(n.selection))return!1;let o;if(e.selfScroll){let s=i.coordsAtPos(n.selection.main.head),a=i.scrollDOM.getBoundingClientRect(),l=a.top+e.marginTop,u=a.bottom-e.marginBottom;s&&s.top>l&&s.bottomMv(i,!1),uc=i=>Mv(i,!0);function hr(i,t,e){let n=i.lineBlockAt(t.head),r=i.moveToLineBoundary(t,e);if(r.head==t.head&&r.head!=(e?n.to:n.from)&&(r=i.moveToLineBoundary(t,e,!1)),!e&&r.head==n.from&&n.length){let o=/^\s*/.exec(i.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;o&&t.head!=n.from+o&&(r=yt.cursor(n.from+o))}return r}const $v=i=>rn(i,t=>hr(i,t,!0)),Qv=i=>rn(i,t=>hr(i,t,!1)),MS=i=>rn(i,t=>hr(i,t,!yi(i))),$S=i=>rn(i,t=>hr(i,t,yi(i))),QS=i=>rn(i,t=>yt.cursor(i.lineBlockAt(t.head).from,1)),NS=i=>rn(i,t=>yt.cursor(i.lineBlockAt(t.head).to,-1));function BS(i,t,e){let n=!1,r=vs(i.selection,o=>{let s=Wi(i,o.head,-1)||Wi(i,o.head,1)||o.head>0&&Wi(i,o.head-1,1)||o.headBS(i,t,!1);function qi(i,t){let e=vs(i.state.selection,n=>{let r=t(n);return yt.range(n.anchor,r.head,r.goalColumn,r.bidiLevel||void 0)});return e.eq(i.state.selection)?!1:(i.dispatch(bn(i.state,e)),!0)}function Nv(i,t){return qi(i,e=>i.moveByChar(e,t))}const Bv=i=>Nv(i,!yi(i)),Fv=i=>Nv(i,yi(i));function Xv(i,t){return qi(i,e=>i.moveByGroup(e,t))}const XS=i=>Xv(i,!yi(i)),RS=i=>Xv(i,yi(i)),YS=i=>qi(i,t=>Nl(i.state,t,!yi(i))),ZS=i=>qi(i,t=>Nl(i.state,t,yi(i)));function Rv(i,t){return qi(i,e=>i.moveVertically(e,t))}const Yv=i=>Rv(i,!1),Zv=i=>Rv(i,!0);function Wv(i,t){return qi(i,e=>i.moveVertically(e,t,Iv(i).height))}const cp=i=>Wv(i,!1),fp=i=>Wv(i,!0),WS=i=>qi(i,t=>hr(i,t,!0)),US=i=>qi(i,t=>hr(i,t,!1)),zS=i=>qi(i,t=>hr(i,t,!yi(i))),jS=i=>qi(i,t=>hr(i,t,yi(i))),qS=i=>qi(i,t=>yt.cursor(i.lineBlockAt(t.head).from)),VS=i=>qi(i,t=>yt.cursor(i.lineBlockAt(t.head).to)),dp=({state:i,dispatch:t})=>(t(bn(i,{anchor:0})),!0),pp=({state:i,dispatch:t})=>(t(bn(i,{anchor:i.doc.length})),!0),mp=({state:i,dispatch:t})=>(t(bn(i,{anchor:i.selection.main.anchor,head:0})),!0),gp=({state:i,dispatch:t})=>(t(bn(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0),GS=({state:i,dispatch:t})=>(t(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"})),!0),HS=({state:i,dispatch:t})=>{let e=Fl(i).map(({from:n,to:r})=>yt.range(n,Math.min(r+1,i.doc.length)));return t(i.update({selection:yt.create(e),userEvent:"select"})),!0},JS=({state:i,dispatch:t})=>{let e=vs(i.selection,n=>{var r;let o=Ye(i).resolveInner(n.head,1);for(;!(o.from=n.to||o.to>n.to&&o.from<=n.from||!(!((r=o.parent)===null||r===void 0)&&r.parent));)o=o.parent;return yt.range(o.to,o.from)});return t(bn(i,e)),!0},KS=({state:i,dispatch:t})=>{let e=i.selection,n=null;return e.ranges.length>1?n=yt.create([e.main]):e.main.empty||(n=yt.create([yt.cursor(e.main.head)])),n?(t(bn(i,n)),!0):!1};function Bl(i,t){if(i.state.readOnly)return!1;let e="delete.selection",{state:n}=i,r=n.changeByRange(o=>{let{from:s,to:a}=o;if(s==a){let l=t(s);ls&&(e="delete.forward",l=aa(i,l,!0)),s=Math.min(s,l),a=Math.max(a,l)}else s=aa(i,s,!1),a=aa(i,a,!0);return s==a?{range:o}:{changes:{from:s,to:a},range:yt.cursor(s)}});return r.changes.empty?!1:(i.dispatch(n.update(r,{scrollIntoView:!0,userEvent:e,effects:e=="delete.selection"?Rt.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function aa(i,t,e){if(i instanceof Rt)for(let n of i.state.facet(Rt.atomicRanges).map(r=>r(i)))n.between(t,t,(r,o)=>{rt&&(t=e?o:r)});return t}const Uv=(i,t)=>Bl(i,e=>{let{state:n}=i,r=n.doc.lineAt(e),o,s;if(!t&&e>r.from&&eUv(i,!1),zv=i=>Uv(i,!0),jv=(i,t)=>Bl(i,e=>{let n=e,{state:r}=i,o=r.doc.lineAt(n),s=r.charCategorizer(n);for(let a=null;;){if(n==(t?o.to:o.from)){n==e&&o.number!=(t?r.doc.lines:1)&&(n+=t?1:-1);break}let l=gi(o.text,n-o.from,t)+o.from,u=o.text.slice(Math.min(n,l)-o.from,Math.max(n,l)-o.from),c=s(u);if(a!=null&&c!=a)break;(u!=" "||n!=e)&&(a=c),n=l}return n}),qv=i=>jv(i,!1),tC=i=>jv(i,!0),Vv=i=>Bl(i,t=>{let e=i.lineBlockAt(t).to;return tBl(i,t=>{let e=i.lineBlockAt(t).from;return t>e?e:Math.max(0,t-1)}),iC=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let e=i.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:we.of(["",""])},range:yt.cursor(n.from)}));return t(i.update(e,{scrollIntoView:!0,userEvent:"input"})),!0},nC=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let e=i.changeByRange(n=>{if(!n.empty||n.from==0||n.from==i.doc.length)return{range:n};let r=n.from,o=i.doc.lineAt(r),s=r==o.from?r-1:gi(o.text,r-o.from,!1)+o.from,a=r==o.to?r+1:gi(o.text,r-o.from,!0)+o.from;return{changes:{from:s,to:a,insert:i.doc.slice(r,a).append(i.doc.slice(s,r))},range:yt.cursor(a)}});return e.changes.empty?!1:(t(i.update(e,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Fl(i){let t=[],e=-1;for(let n of i.selection.ranges){let r=i.doc.lineAt(n.from),o=i.doc.lineAt(n.to);if(!n.empty&&n.to==o.from&&(o=i.doc.lineAt(n.to-1)),e>=r.number){let s=t[t.length-1];s.to=o.to,s.ranges.push(n)}else t.push({from:r.from,to:o.to,ranges:[n]});e=o.number+1}return t}function Gv(i,t,e){if(i.readOnly)return!1;let n=[],r=[];for(let o of Fl(i)){if(e?o.to==i.doc.length:o.from==0)continue;let s=i.doc.lineAt(e?o.to+1:o.from-1),a=s.length+1;if(e){n.push({from:o.to,to:s.to},{from:o.from,insert:s.text+i.lineBreak});for(let l of o.ranges)r.push(yt.range(Math.min(i.doc.length,l.anchor+a),Math.min(i.doc.length,l.head+a)))}else{n.push({from:s.from,to:o.from},{from:o.to,insert:i.lineBreak+s.text});for(let l of o.ranges)r.push(yt.range(l.anchor-a,l.head-a))}}return n.length?(t(i.update({changes:n,scrollIntoView:!0,selection:yt.create(r,i.selection.mainIndex),userEvent:"move.line"})),!0):!1}const rC=({state:i,dispatch:t})=>Gv(i,t,!1),sC=({state:i,dispatch:t})=>Gv(i,t,!0);function Hv(i,t,e){if(i.readOnly)return!1;let n=[];for(let r of Fl(i))e?n.push({from:r.from,insert:i.doc.slice(r.from,r.to)+i.lineBreak}):n.push({from:r.to,insert:i.lineBreak+i.doc.slice(r.from,r.to)});return t(i.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const oC=({state:i,dispatch:t})=>Hv(i,t,!1),aC=({state:i,dispatch:t})=>Hv(i,t,!0),lC=i=>{if(i.state.readOnly)return!1;let{state:t}=i,e=t.changes(Fl(t).map(({from:r,to:o})=>(r>0?r--:oi.moveVertically(r,!0)).map(e);return i.dispatch({changes:e,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function hC(i,t){if(/\(\)|\[\]|\{\}/.test(i.sliceDoc(t-1,t+1)))return{from:t,to:t};let e=Ye(i).resolveInner(t),n=e.childBefore(t),r=e.childAfter(t),o;return n&&r&&n.to<=t&&r.from>=t&&(o=n.type.prop(ce.closedBy))&&o.indexOf(r.name)>-1&&i.doc.lineAt(n.to).from==i.doc.lineAt(r.from).from&&!/\S/.test(i.sliceDoc(n.to,r.from))?{from:n.to,to:r.from}:null}const Jv=Kv(!1),uC=Kv(!0);function Kv(i){return({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{let{from:o,to:s}=r,a=t.doc.lineAt(o),l=!i&&o==s&&hC(t,o);i&&(o=s=(s<=a.to?a:t.doc.lineAt(s)).to);let u=new Tl(t,{simulateBreak:o,simulateDoubleBreak:!!l}),c=jc(u,o);for(c==null&&(c=gs(/^\s*/.exec(t.doc.lineAt(o).text)[0],t.tabSize));sa.from&&o{let r=[];for(let s=n.from;s<=n.to;){let a=i.doc.lineAt(s);a.number>e&&(n.empty||n.to>a.from)&&(t(a,r,n),e=a.number),s=a.to+1}let o=i.changes(r);return{changes:r,range:yt.range(o.mapPos(n.anchor,1),o.mapPos(n.head,1))}})}const ty=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let e=Object.create(null),n=new Tl(i,{overrideIndentation:o=>{let s=e[o];return s??-1}}),r=ef(i,(o,s,a)=>{let l=jc(n,o.from);if(l==null)return;/\S/.test(o.text)||(l=0);let u=/^\s*/.exec(o.text)[0],c=ho(i,l);(u!=c||a.fromi.readOnly?!1:(t(i.update(ef(i,(e,n)=>{n.push({from:e.from,insert:i.facet(Tr)})}),{userEvent:"input.indent"})),!0),rf=({state:i,dispatch:t})=>i.readOnly?!1:(t(i.update(ef(i,(e,n)=>{let r=/^\s*/.exec(e.text)[0];if(!r)return;let o=gs(r,i.tabSize),s=0,a=ho(i,Math.max(0,o-Va(i)));for(;s({mac:i.key,run:i.run,shift:i.shift}))),dC=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:TS,shift:YS},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:IS,shift:ZS},{key:"Alt-ArrowUp",run:rC},{key:"Shift-Alt-ArrowUp",run:oC},{key:"Alt-ArrowDown",run:sC},{key:"Shift-Alt-ArrowDown",run:aC},{key:"Escape",run:KS},{key:"Mod-Enter",run:uC},{key:"Alt-l",mac:"Ctrl-l",run:HS},{key:"Mod-i",run:JS,preventDefault:!0},{key:"Mod-[",run:rf},{key:"Mod-]",run:nf},{key:"Mod-Alt-\\",run:ty},{key:"Shift-Mod-k",run:lC},{key:"Shift-Mod-\\",run:FS},{key:"Mod-/",run:lS},{key:"Alt-A",run:uS}].concat(fC),pC={key:"Tab",run:nf,shift:rf};function Ie(){var i=arguments[0];typeof i=="string"&&(i=document.createElement(i));var t=1,e=arguments[1];if(e&&typeof e=="object"&&e.nodeType==null&&!Array.isArray(e)){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];typeof r=="string"?i.setAttribute(n,r):r!=null&&(i[n]=r)}t++}for(;ti.normalize("NFKD"):i=>i;class ds{constructor(t,e,n=0,r=t.length,o,s){this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(n,r),this.bufferStart=n,this.normalize=o?a=>o(vp(a)):vp,this.query=this.normalize(e)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return ai(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let e=Lc(t),n=this.bufferStart+this.bufferPos;this.bufferPos+=Yi(t);let r=this.normalize(e);for(let o=0,s=n;;o++){let a=r.charCodeAt(o),l=this.match(a,s);if(o==r.length-1){if(l)return this.value=l,this;break}s==n&&othis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let e=this.matchPos<=this.to&&this.re.exec(this.curLine);if(e){let n=this.curLineStart+e.index,r=n+e[0].length;if(this.matchPos=tl(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,r,e)))return this.value={from:n,to:r,match:e},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=n||r.to<=e){let a=new Kr(e,t.sliceString(e,n));return Yh.set(t,a),a}if(r.from==e&&r.to==n)return r;let{text:o,from:s}=r;return s>e&&(o=t.sliceString(e,s)+o,s=e),r.to=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,e=this.re.exec(this.flat.text);if(e&&!e[0]&&e.index==t&&(this.re.lastIndex=t+1,e=this.re.exec(this.flat.text)),e){let n=this.flat.from+e.index,r=n+e[0].length;if((this.flat.to>=this.to||e.index+e[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,r,e)))return this.value={from:n,to:r,match:e},this.matchPos=tl(this.text,r+(n==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Kr.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(of.prototype[Symbol.iterator]=ny.prototype[Symbol.iterator]=function(){return this});function mC(i){try{return new RegExp(i,sf),!0}catch{return!1}}function tl(i,t){if(t>=i.length)return t;let e=i.lineAt(t),n;for(;t=56320&&n<57344;)t++;return t}function fc(i){let t=Ie("input",{class:"cm-textfield",name:"line"}),e=Ie("form",{class:"cm-gotoLine",onkeydown:r=>{r.keyCode==27?(r.preventDefault(),i.dispatch({effects:el.of(!1)}),i.focus()):r.keyCode==13&&(r.preventDefault(),n())},onsubmit:r=>{r.preventDefault(),n()}},Ie("label",i.state.phrase("Go to line"),": ",t)," ",Ie("button",{class:"cm-button",type:"submit"},i.state.phrase("go")));function n(){let r=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!r)return;let{state:o}=i,s=o.doc.lineAt(o.selection.main.head),[,a,l,u,c]=r,d=u?+u.slice(1):0,f=l?+l:s.number;if(l&&c){let m=f/100;a&&(m=m*(a=="-"?-1:1)+s.number/o.doc.lines),f=Math.round(o.doc.lines*m)}else l&&a&&(f=f*(a=="-"?-1:1)+s.number);let g=o.doc.line(Math.max(1,Math.min(o.doc.lines,f))),x=yt.cursor(g.from+Math.max(0,Math.min(d,g.length)));i.dispatch({effects:[el.of(!1),Rt.scrollIntoView(x.from,{y:"center"})],selection:x}),i.focus()}return{dom:e}}const el=re.define(),yp=ti.define({create(){return!0},update(i,t){for(let e of t.effects)e.is(el)&&(i=e.value);return i},provide:i=>Dr.from(i,t=>t?fc:null)}),gC=i=>{let t=ao(i,fc);if(!t){let e=[el.of(!0)];i.state.field(yp,!1)==null&&e.push(re.appendConfig.of([yp,vC])),i.dispatch({effects:e}),t=ao(i,fc)}return t&&t.dom.querySelector("input").focus(),!0},vC=Rt.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),yC={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},ry=Zt.define({combine(i){return xn(i,yC,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})}});function OC(i){let t=[SC,wC];return i&&t.push(ry.of(i)),t}const _C=Gt.mark({class:"cm-selectionMatch"}),xC=Gt.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Op(i,t,e,n){return(e==0||i(t.sliceDoc(e-1,e))!=Ne.Word)&&(n==t.doc.length||i(t.sliceDoc(n,n+1))!=Ne.Word)}function bC(i,t,e,n){return i(t.sliceDoc(e,e+1))==Ne.Word&&i(t.sliceDoc(n-1,n))==Ne.Word}const wC=Fe.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.selectionSet||i.docChanged||i.viewportChanged)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let t=i.state.facet(ry),{state:e}=i,n=e.selection;if(n.ranges.length>1)return Gt.none;let r=n.main,o,s=null;if(r.empty){if(!t.highlightWordAroundCursor)return Gt.none;let l=e.wordAt(r.head);if(!l)return Gt.none;s=e.charCategorizer(r.head),o=e.sliceDoc(l.from,l.to)}else{let l=r.to-r.from;if(l200)return Gt.none;if(t.wholeWords){if(o=e.sliceDoc(r.from,r.to),s=e.charCategorizer(r.head),!(Op(s,e,r.from,r.to)&&bC(s,e,r.from,r.to)))return Gt.none}else if(o=e.sliceDoc(r.from,r.to).trim(),!o)return Gt.none}let a=[];for(let l of i.visibleRanges){let u=new ds(e.doc,o,l.from,l.to);for(;!u.next().done;){let{from:c,to:d}=u.value;if((!s||Op(s,e,c,d))&&(r.empty&&c<=r.from&&d>=r.to?a.push(xC.range(c,d)):(c>=r.to||d<=r.from)&&a.push(_C.range(c,d)),a.length>t.maxMatches))return Gt.none}}return Gt.set(a)}},{decorations:i=>i.decorations}),SC=Rt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),CC=({state:i,dispatch:t})=>{let{selection:e}=i,n=yt.create(e.ranges.map(r=>i.wordAt(r.head)||yt.cursor(r.head)),e.mainIndex);return n.eq(e)?!1:(t(i.update({selection:n})),!0)};function PC(i,t){let{main:e,ranges:n}=i.selection,r=i.wordAt(e.head),o=r&&r.from==e.from&&r.to==e.to;for(let s=!1,a=new ds(i.doc,t,n[n.length-1].to);;)if(a.next(),a.done){if(s)return null;a=new ds(i.doc,t,0,Math.max(0,n[n.length-1].from-1)),s=!0}else{if(s&&n.some(l=>l.from==a.value.from))continue;if(o){let l=i.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const kC=({state:i,dispatch:t})=>{let{ranges:e}=i.selection;if(e.some(o=>o.from===o.to))return CC({state:i,dispatch:t});let n=i.sliceDoc(e[0].from,e[0].to);if(i.selection.ranges.some(o=>i.sliceDoc(o.from,o.to)!=n))return!1;let r=PC(i,n);return r?(t(i.update({selection:i.selection.addRange(yt.range(r.from,r.to),!1),effects:Rt.scrollIntoView(r.to)})),!0):!1},ys=Zt.define({combine(i){return xn(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new FC(t),scrollToMatch:t=>Rt.scrollIntoView(t)})}});class af{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||mC(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(e,n)=>n=="n"?` +`:n=="r"?"\r":n=="t"?" ":"\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new DC(this):new AC(this)}getCursor(t,e=0,n){let r=t.doc?t:Oe.create({doc:t});return n==null&&(n=r.doc.length),this.regexp?Ur(this,r,e,n):Wr(this,r,e,n)}}class sy{constructor(t){this.spec=t}}function Wr(i,t,e,n){return new ds(t.doc,i.unquoted,e,n,i.caseSensitive?void 0:r=>r.toLowerCase(),i.wholeWord?LC(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}function LC(i,t){return(e,n,r,o)=>((o>e||o+r.length=e)return null;r.push(n.value)}return r}highlight(t,e,n,r){let o=Wr(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,t.doc.length));for(;!o.next().done;)r(o.value.from,o.value.to)}}function Ur(i,t,e,n){return new of(t.doc,i.search,{ignoreCase:!i.caseSensitive,test:i.wholeWord?EC(t.charCategorizer(t.selection.main.head)):void 0},e,n)}function il(i,t){return i.slice(gi(i,t,!1),t)}function nl(i,t){return i.slice(t,gi(i,t))}function EC(i){return(t,e,n)=>!n[0].length||(i(il(n.input,n.index))!=Ne.Word||i(nl(n.input,n.index))!=Ne.Word)&&(i(nl(n.input,n.index+n[0].length))!=Ne.Word||i(il(n.input,n.index+n[0].length))!=Ne.Word)}class DC extends sy{nextMatch(t,e,n){let r=Ur(this.spec,t,n,t.doc.length).next();return r.done&&(r=Ur(this.spec,t,0,e).next()),r.done?null:r.value}prevMatchInRange(t,e,n){for(let r=1;;r++){let o=Math.max(e,n-r*1e4),s=Ur(this.spec,t,o,n),a=null;for(;!s.next().done;)a=s.value;if(a&&(o==e||a.from>o+10))return a;if(o==e)return null}}prevMatch(t,e,n){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,n,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,(e,n)=>n=="$"?"$":n=="&"?t.match[0]:n!="0"&&+n=e)return null;r.push(n.value)}return r}highlight(t,e,n,r){let o=Ur(this.spec,t,Math.max(0,e-250),Math.min(n+250,t.doc.length));for(;!o.next().done;)r(o.value.from,o.value.to)}}const ar=re.define(),lf=re.define(),Kn=ti.define({create(i){return new Zh(dc(i).create(),null)},update(i,t){for(let e of t.effects)e.is(ar)?i=new Zh(e.value.create(),i.panel):e.is(lf)&&(i=new Zh(i.query,e.value?hf:null));return i},provide:i=>Dr.from(i,t=>t.panel)});class Zh{constructor(t,e){this.query=t,this.panel=e}}const TC=Gt.mark({class:"cm-searchMatch"}),IC=Gt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),MC=Fe.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(Kn))}update(i){let t=i.state.field(Kn);(t!=i.startState.field(Kn)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:i,panel:t}){if(!t||!i.spec.valid)return Gt.none;let{view:e}=this,n=new _n;for(let r=0,o=e.visibleRanges,s=o.length;ro[r+1].from-2*250;)l=o[++r].to;i.highlight(e.state,a,l,(u,c)=>{let d=e.state.selection.ranges.some(f=>f.from==u&&f.to==c);n.add(u,c,d?IC:TC)})}return n.finish()}},{decorations:i=>i.decorations});function Po(i){return t=>{let e=t.state.field(Kn,!1);return e&&e.query.spec.valid?i(t,e):ly(t)}}const rl=Po((i,{query:t})=>{let{to:e}=i.state.selection.main,n=t.nextMatch(i.state,e,e);if(!n)return!1;let r=yt.single(n.from,n.to),o=i.state.facet(ys);return i.dispatch({selection:r,effects:[uf(i,n),o.scrollToMatch(r.main,i)],userEvent:"select.search"}),ay(i),!0}),sl=Po((i,{query:t})=>{let{state:e}=i,{from:n}=e.selection.main,r=t.prevMatch(e,n,n);if(!r)return!1;let o=yt.single(r.from,r.to),s=i.state.facet(ys);return i.dispatch({selection:o,effects:[uf(i,r),s.scrollToMatch(o.main,i)],userEvent:"select.search"}),ay(i),!0}),$C=Po((i,{query:t})=>{let e=t.matchAll(i.state,1e3);return!e||!e.length?!1:(i.dispatch({selection:yt.create(e.map(n=>yt.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),QC=({state:i,dispatch:t})=>{let e=i.selection;if(e.ranges.length>1||e.main.empty)return!1;let{from:n,to:r}=e.main,o=[],s=0;for(let a=new ds(i.doc,i.sliceDoc(n,r));!a.next().done;){if(o.length>1e3)return!1;a.value.from==n&&(s=o.length),o.push(yt.range(a.value.from,a.value.to))}return t(i.update({selection:yt.create(o,s),userEvent:"select.search.matches"})),!0},_p=Po((i,{query:t})=>{let{state:e}=i,{from:n,to:r}=e.selection.main;if(e.readOnly)return!1;let o=t.nextMatch(e,n,n);if(!o)return!1;let s=[],a,l,u=[];if(o.from==n&&o.to==r&&(l=e.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(e,o.from,o.to),u.push(Rt.announce.of(e.phrase("replaced match on line $",e.doc.lineAt(n).number)+"."))),o){let c=s.length==0||s[0].from>=o.to?0:o.to-o.from-l.length;a=yt.single(o.from-c,o.to-c),u.push(uf(i,o)),u.push(e.facet(ys).scrollToMatch(a.main,i))}return i.dispatch({changes:s,selection:a,effects:u,userEvent:"input.replace"}),!0}),NC=Po((i,{query:t})=>{if(i.state.readOnly)return!1;let e=t.matchAll(i.state,1e9).map(r=>{let{from:o,to:s}=r;return{from:o,to:s,insert:t.getReplacement(r)}});if(!e.length)return!1;let n=i.state.phrase("replaced $ matches",e.length)+".";return i.dispatch({changes:e,effects:Rt.announce.of(n),userEvent:"input.replace.all"}),!0});function hf(i){return i.state.facet(ys).createPanel(i)}function dc(i,t){var e,n,r,o,s;let a=i.selection.main,l=a.empty||a.to>a.from+100?"":i.sliceDoc(a.from,a.to);if(t&&!l)return t;let u=i.facet(ys);return new af({search:((e=t==null?void 0:t.literal)!==null&&e!==void 0?e:u.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=t==null?void 0:t.caseSensitive)!==null&&n!==void 0?n:u.caseSensitive,literal:(r=t==null?void 0:t.literal)!==null&&r!==void 0?r:u.literal,regexp:(o=t==null?void 0:t.regexp)!==null&&o!==void 0?o:u.regexp,wholeWord:(s=t==null?void 0:t.wholeWord)!==null&&s!==void 0?s:u.wholeWord})}function oy(i){let t=ao(i,hf);return t&&t.dom.querySelector("[main-field]")}function ay(i){let t=oy(i);t&&t==i.root.activeElement&&t.select()}const ly=i=>{let t=i.state.field(Kn,!1);if(t&&t.panel){let e=oy(i);if(e&&e!=i.root.activeElement){let n=dc(i.state,t.query.spec);n.valid&&i.dispatch({effects:ar.of(n)}),e.focus(),e.select()}}else i.dispatch({effects:[lf.of(!0),t?ar.of(dc(i.state,t.query.spec)):re.appendConfig.of(RC)]});return!0},hy=i=>{let t=i.state.field(Kn,!1);if(!t||!t.panel)return!1;let e=ao(i,hf);return e&&e.dom.contains(i.root.activeElement)&&i.focus(),i.dispatch({effects:lf.of(!1)}),!0},BC=[{key:"Mod-f",run:ly,scope:"editor search-panel"},{key:"F3",run:rl,shift:sl,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:rl,shift:sl,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:hy,scope:"editor search-panel"},{key:"Mod-Shift-l",run:QC},{key:"Alt-g",run:gC},{key:"Mod-d",run:kC,preventDefault:!0}];class FC{constructor(t){this.view=t;let e=this.query=t.state.field(Kn).query.spec;this.commit=this.commit.bind(this),this.searchField=Ie("input",{value:e.search,placeholder:Di(t,"Find"),"aria-label":Di(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ie("input",{value:e.replace,placeholder:Di(t,"Replace"),"aria-label":Di(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ie("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Ie("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Ie("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit});function n(r,o,s){return Ie("button",{class:"cm-button",name:r,onclick:o,type:"button"},s)}this.dom=Ie("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,n("next",()=>rl(t),[Di(t,"next")]),n("prev",()=>sl(t),[Di(t,"previous")]),n("select",()=>$C(t),[Di(t,"all")]),Ie("label",null,[this.caseField,Di(t,"match case")]),Ie("label",null,[this.reField,Di(t,"regexp")]),Ie("label",null,[this.wordField,Di(t,"by word")]),...t.state.readOnly?[]:[Ie("br"),this.replaceField,n("replace",()=>_p(t),[Di(t,"replace")]),n("replaceAll",()=>NC(t),[Di(t,"replace all")])],Ie("button",{name:"close",onclick:()=>hy(t),"aria-label":Di(t,"close"),type:"button"},["×"])])}commit(){let t=new af({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:ar.of(t)}))}keydown(t){eb(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?sl:rl)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),_p(this.view))}update(t){for(let e of t.transactions)for(let n of e.effects)n.is(ar)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(ys).top}}function Di(i,t){return i.state.phrase(t)}const la=30,ha=/[\s\.,:;?!]/;function uf(i,{from:t,to:e}){let n=i.state.doc.lineAt(t),r=i.state.doc.lineAt(e).to,o=Math.max(n.from,t-la),s=Math.min(r,e+la),a=i.state.sliceDoc(o,s);if(o!=n.from){for(let l=0;la.length-la;l--)if(!ha.test(a[l-1])&&ha.test(a[l])){a=a.slice(0,l);break}}return Rt.announce.of(`${i.state.phrase("current match")}. ${a} ${i.state.phrase("on line")} ${n.number}.`)}const XC=Rt.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),RC=[Kn,lr.low(MC),XC];class uy{constructor(t,e,n){this.state=t,this.pos=e,this.explicit=n,this.abortListeners=[]}tokenBefore(t){let e=Ye(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),n=Math.max(e.from,this.pos-250),r=e.text.slice(n-e.from,this.pos-e.from),o=r.search(fy(t,!1));return o<0?null:{from:n+o,to:this.pos,text:r.slice(o)}}get aborted(){return this.abortListeners==null}addEventListener(t,e){t=="abort"&&this.abortListeners&&this.abortListeners.push(e)}}function xp(i){let t=Object.keys(i).join(""),e=/\w/.test(t);return e&&(t=t.replace(/\w/g,"")),`[${e?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function YC(i){let t=Object.create(null),e=Object.create(null);for(let{label:r}of i){t[r[0]]=!0;for(let o=1;otypeof r=="string"?{label:r}:r),[e,n]=t.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:YC(t);return r=>{let o=r.matchBefore(n);return o||r.explicit?{from:o?o.from:r.pos,options:t,validFor:e}:null}}function ZC(i,t){return e=>{for(let n=Ye(e.state).resolveInner(e.pos,-1);n;n=n.parent){if(i.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return t(e)}}class bp{constructor(t,e,n,r){this.completion=t,this.source=e,this.match=n,this.score=r}}function tr(i){return i.selection.main.from}function fy(i,t){var e;let{source:n}=i,r=t&&n[0]!="^",o=n[n.length-1]!="$";return!r&&!o?i:new RegExp(`${r?"^":""}(?:${n})${o?"$":""}`,(e=i.flags)!==null&&e!==void 0?e:i.ignoreCase?"i":"")}const dy=In.define();function WC(i,t,e,n){let{main:r}=i.selection,o=e-r.from,s=n-r.from;return Object.assign(Object.assign({},i.changeByRange(a=>a!=r&&e!=n&&i.sliceDoc(a.from+o,a.from+s)!=i.sliceDoc(e,n)?{range:a}:{changes:{from:a.from+o,to:n==r.from?a.to:a.from+s,insert:t},range:yt.cursor(a.from+o+t.length)})),{userEvent:"input.complete"})}const wp=new WeakMap;function UC(i){if(!Array.isArray(i))return i;let t=wp.get(i);return t||wp.set(i,t=cy(i)),t}const cf=re.define(),uo=re.define();class zC{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let e=0;e=48&&$<=57||$>=97&&$<=122?2:$>=65&&$<=90?1:0:(Q=Lc($))!=Q.toLowerCase()?1:Q!=Q.toUpperCase()?2:0;(!b||X==1&&v||E==0&&X!=0)&&(e[d]==$||n[d]==$&&(f=!0)?s[d++]=b:s.length&&(O=!1)),E=X,b+=Yi($)}return d==l&&s[0]==0&&O?this.result(-100+(f?-200:0),s,t):g==l&&x==0?this.ret(-200-t.length+(m==t.length?0:-100),[0,m]):a>-1?this.ret(-700-t.length,[a,a+this.pattern.length]):g==l?this.ret(-200+-700-t.length,[x,m]):d==l?this.result(-100+(f?-200:0)+-700+(O?0:-1100),s,t):e.length==2?!1:this.result((r[0]?-700:0)+-200+-1100,r,t)}result(t,e,n){let r=[],o=0;for(let s of e){let a=s+(this.astral?Yi(ai(n,s)):1);o&&r[o-1]==s?r[o-1]=a:(r[o++]=s,r[o++]=a)}return this.ret(t-n.length,r)}}const Li=Zt.define({combine(i){return xn(i,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:jC,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>n=>Sp(t(n),e(n)),optionClass:(t,e)=>n=>Sp(t(n),e(n)),addToOptions:(t,e)=>t.concat(e)})}});function Sp(i,t){return i?t?i+" "+t:i:t}function jC(i,t,e,n,r){let o=i.textDirection==Me.RTL,s=o,a=!1,l="top",u,c,d=t.left-r.left,f=r.right-t.right,g=n.right-n.left,x=n.bottom-n.top;if(s&&d=x||m>t.top?u=e.bottom-t.top:(l="bottom",u=t.bottom-e.top)}return{style:`${l}: ${u}px; max-width: ${c}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":s?"left":"right")}}function qC(i){let t=i.addToOptions.slice();return i.icons&&t.push({render(e){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),e.type&&n.classList.add(...e.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),n.setAttribute("aria-hidden","true"),n},position:20}),t.push({render(e,n,r){let o=document.createElement("span");o.className="cm-completionLabel";let s=e.displayLabel||e.label,a=0;for(let l=0;la&&o.appendChild(document.createTextNode(s.slice(a,u)));let d=o.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(s.slice(u,c))),d.className="cm-completionMatchedText",a=c}return ae.position-n.position).map(e=>e.render)}function Cp(i,t,e){if(i<=e)return{from:0,to:i};if(t<0&&(t=0),t<=i>>1){let r=Math.floor(t/e);return{from:r*e,to:(r+1)*e}}let n=Math.floor((i-t)/e);return{from:i-(n+1)*e,to:i-n*e}}class VC{constructor(t,e,n){this.view=t,this.stateField=e,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let r=t.state.field(e),{options:o,selected:s}=r.open,a=t.state.facet(Li);this.optionContent=qC(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=Cp(o.length,s,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",l=>{for(let u=l.target,c;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(c=/-(\d+)$/.exec(u.id))&&+c[1]{let u=t.state.field(this.stateField,!1);u&&u.tooltip&&t.state.facet(Li).closeOnBlur&&l.relatedTarget!=t.contentDOM&&t.dispatch({effects:uo.of(null)})}),this.list=this.dom.appendChild(this.createListBox(o,r.id,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}mount(){this.updateSel()}update(t){var e,n,r;let o=t.state.field(this.stateField),s=t.startState.field(this.stateField);this.updateTooltipClass(t.state),o!=s&&(this.updateSel(),((e=o.open)===null||e===void 0?void 0:e.disabled)!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(!((r=o.open)===null||r===void 0)&&r.disabled)))}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of e.split(" "))n&&this.dom.classList.add(n);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=Cp(e.options.length,e.selected,this.view.state.facet(Li).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,t.id,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})),this.updateSelectedOption(e.selected)){this.destroyInfo();let{completion:n}=e.options[e.selected],{info:r}=n;if(!r)return;let o=typeof r=="string"?document.createTextNode(r):r(n);if(!o)return;"then"in o?o.then(s=>{s&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(s,n)}).catch(s=>Pi(this.view.state,s,"completion info")):this.addInfoPane(o,n)}}addInfoPane(t,e){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",t.nodeType!=null)n.appendChild(t),this.infoDestroy=null;else{let{dom:r,destroy:o}=t;n.appendChild(r),this.infoDestroy=o||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!="LI"||!n.id?r--:r==t?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),e=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected");return e&&HC(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=t.getBoundingClientRect(),o=this.space;if(!o){let s=this.dom.ownerDocument.defaultView||window;o={left:0,top:0,right:s.innerWidth,bottom:s.innerHeight}}return r.top>Math.min(o.bottom,e.bottom)-10||r.bottomn.from||n.from==0))if(o=f,typeof u!="string"&&u.header)r.appendChild(u.header(u));else{let g=r.appendChild(document.createElement("completion-section"));g.textContent=f}}const c=r.appendChild(document.createElement("li"));c.id=e+"-"+s,c.setAttribute("role","option");let d=this.optionClass(a);d&&(c.className=d);for(let f of this.optionContent){let g=f(a,this.view.state,l);g&&c.appendChild(g)}}return n.from&&r.classList.add("cm-completionListIncompleteTop"),n.tonew VC(e,i,t)}function HC(i,t){let e=i.getBoundingClientRect(),n=t.getBoundingClientRect();n.tope.bottom&&(i.scrollTop+=n.bottom-e.bottom)}function Pp(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function JC(i,t){let e=[],n=null,r=l=>{e.push(l);let{section:u}=l.completion;if(u){n||(n=[]);let c=typeof u=="string"?u:u.name;n.some(d=>d.name==c)||n.push(typeof u=="string"?{name:c}:u)}};for(let l of i)if(l.hasResult()){let u=l.result.getMatch;if(l.result.filter===!1)for(let c of l.result.options)r(new bp(c,l.source,u?u(c):[],1e9-e.length));else{let c=new zC(t.sliceDoc(l.from,l.to));for(let d of l.result.options)if(c.match(d.label)){let f=d.displayLabel?u?u(d,c.matched):[]:c.matched;r(new bp(d,l.source,f,c.score+(d.boost||0)))}}}if(n){let l=Object.create(null),u=0,c=(d,f)=>{var g,x;return((g=d.rank)!==null&&g!==void 0?g:1e9)-((x=f.rank)!==null&&x!==void 0?x:1e9)||(d.namec.score-u.score||a(u.completion,c.completion))){let u=l.completion;!s||s.label!=u.label||s.detail!=u.detail||s.type!=null&&u.type!=null&&s.type!=u.type||s.apply!=u.apply||s.boost!=u.boost?o.push(l):Pp(l.completion)>Pp(s)&&(o[o.length-1]=l),s=l.completion}return o}class qr{constructor(t,e,n,r,o,s){this.options=t,this.attrs=e,this.tooltip=n,this.timestamp=r,this.selected=o,this.disabled=s}setSelected(t,e){return t==this.selected||t>=this.options.length?this:new qr(this.options,kp(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,n,r,o){let s=JC(t,e);if(!s.length)return r&&t.some(l=>l.state==1)?new qr(r.options,r.attrs,r.tooltip,r.timestamp,r.selected,!0):null;let a=e.facet(Li).selectOnOpen?0:-1;if(r&&r.selected!=a&&r.selected!=-1){let l=r.options[r.selected].completion;for(let u=0;uu.hasResult()?Math.min(l,u.from):l,1e8),create:GC(Mi,gy),above:o.aboveCursor},r?r.timestamp:Date.now(),a,!1)}map(t){return new qr(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class ol{constructor(t,e,n){this.active=t,this.id=e,this.open=n}static start(){return new ol(eP,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:e}=t,n=e.facet(Li),o=(n.override||e.languageDataAt("autocomplete",tr(e)).map(UC)).map(a=>(this.active.find(u=>u.source==a)||new Ci(a,this.active.some(u=>u.state!=0)?1:0)).update(t,n));o.length==this.active.length&&o.every((a,l)=>a==this.active[l])&&(o=this.active);let s=this.open;s&&t.docChanged&&(s=s.map(t.changes)),t.selection||o.some(a=>a.hasResult()&&t.changes.touchesRange(a.from,a.to))||!KC(o,this.active)?s=qr.build(o,e,this.id,s,n):s&&s.disabled&&!o.some(a=>a.state==1)&&(s=null),!s&&o.every(a=>a.state!=1)&&o.some(a=>a.hasResult())&&(o=o.map(a=>a.hasResult()?new Ci(a.source,0):a));for(let a of t.effects)a.is(my)&&(s=s&&s.setSelected(a.value,this.id));return o==this.active&&s==this.open?this:new ol(o,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:tP}}function KC(i,t){if(i==t)return!0;for(let e=0,n=0;;){for(;e-1&&(e["aria-activedescendant"]=i+"-"+t),e}const eP=[];function pc(i){return i.isUserEvent("input.type")?"input":i.isUserEvent("delete.backward")?"delete":null}class Ci{constructor(t,e,n=-1){this.source=t,this.state=e,this.explicitPos=n}hasResult(){return!1}update(t,e){let n=pc(t),r=this;n?r=r.handleUserEvent(t,n,e):t.docChanged?r=r.handleChange(t):t.selection&&r.state!=0&&(r=new Ci(r.source,0));for(let o of t.effects)if(o.is(cf))r=new Ci(r.source,1,o.value?tr(t.state):-1);else if(o.is(uo))r=new Ci(r.source,0);else if(o.is(py))for(let s of o.value)s.source==r.source&&(r=s);return r}handleUserEvent(t,e,n){return e=="delete"||!n.activateOnTyping?this.map(t.changes):new Ci(this.source,1)}handleChange(t){return t.changes.touchesRange(tr(t.startState))?new Ci(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new Ci(this.source,this.state,t.mapPos(this.explicitPos))}}class ts extends Ci{constructor(t,e,n,r,o){super(t,2,e),this.result=n,this.from=r,this.to=o}hasResult(){return!0}handleUserEvent(t,e,n){var r;let o=t.changes.mapPos(this.from),s=t.changes.mapPos(this.to,1),a=tr(t.state);if((this.explicitPos<0?a<=o:as||e=="delete"&&tr(t.startState)==this.from)return new Ci(this.source,e=="input"&&n.activateOnTyping?1:0);let l=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos),u;return iP(this.result.validFor,t.state,o,s)?new ts(this.source,l,this.result,o,s):this.result.update&&(u=this.result.update(this.result,o,s,new uy(t.state,a,l>=0)))?new ts(this.source,l,u,u.from,(r=u.to)!==null&&r!==void 0?r:tr(t.state)):new Ci(this.source,1,l)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new Ci(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new ts(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}function iP(i,t,e,n){if(!i)return!1;let r=t.sliceDoc(e,n);return typeof i=="function"?i(r,e,n,t):fy(i,!0).test(r)}const py=re.define({map(i,t){return i.map(e=>e.map(t))}}),my=re.define(),Mi=ti.define({create(){return ol.start()},update(i,t){return i.update(t)},provide:i=>[Xc.from(i,t=>t.tooltip),Rt.contentAttributes.from(i,t=>t.attrs)]});function gy(i,t){const e=t.completion.apply||t.completion.label;let n=i.state.field(Mi).active.find(r=>r.source==t.source);return n instanceof ts?(typeof e=="string"?i.dispatch(Object.assign(Object.assign({},WC(i.state,e,n.from,n.to)),{annotations:dy.of(t.completion)})):e(i,t.completion,n.from,n.to),!0):!1}function ua(i,t="option"){return e=>{let n=e.state.field(Mi,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+r*(i?1:-1):i?0:s-1;return a<0?a=t=="page"?0:s-1:a>=s&&(a=t=="page"?s-1:0),e.dispatch({effects:my.of(a)}),!0}}const nP=i=>{let t=i.state.field(Mi,!1);return i.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampi.state.field(Mi,!1)?(i.dispatch({effects:cf.of(!0)}),!0):!1,sP=i=>{let t=i.state.field(Mi,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(i.dispatch({effects:uo.of(null)}),!0)};class oP{constructor(t,e){this.active=t,this.context=e,this.time=Date.now(),this.updates=[],this.done=void 0}}const Lp=50,aP=50,lP=1e3,hP=Fe.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let t of i.state.field(Mi).active)t.state==1&&this.startQuery(t)}update(i){let t=i.state.field(Mi);if(!i.selectionSet&&!i.docChanged&&i.startState.field(Mi)==t)return;let e=i.transactions.some(n=>(n.selection||n.docChanged)&&!pc(n));for(let n=0;naP&&Date.now()-r.time>lP){for(let o of r.context.abortListeners)try{o()}catch(s){Pi(this.view.state,s)}r.context.abortListeners=null,this.running.splice(n--,1)}else r.updates.push(...i.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=t.active.some(n=>n.state==1&&!this.running.some(r=>r.active.source==n.source))?setTimeout(()=>this.startUpdate(),Lp):-1,this.composing!=0)for(let n of i.transactions)pc(n)=="input"?this.composing=2:this.composing==2&&n.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:i}=this.view,t=i.field(Mi);for(let e of t.active)e.state==1&&!this.running.some(n=>n.active.source==e.source)&&this.startQuery(e)}startQuery(i){let{state:t}=this.view,e=tr(t),n=new uy(t,e,i.explicitPos==e),r=new oP(i,n);this.running.push(r),Promise.resolve(i.source(n)).then(o=>{r.context.aborted||(r.done=o||null,this.scheduleAccept())},o=>{this.view.dispatch({effects:uo.of(null)}),Pi(this.view.state,o)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),Lp))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],e=this.view.state.facet(Li);for(let n=0;ns.source==r.active.source);if(o&&o.state==1)if(r.done==null){let s=new Ci(r.active.source,0);for(let a of r.updates)s=s.update(a,e);s.state!=1&&t.push(s)}else this.startQuery(o)}t.length&&this.view.dispatch({effects:py.of(t)})}},{eventHandlers:{blur(i){let t=this.view.state.field(Mi,!1);if(t&&t.tooltip&&this.view.state.facet(Li).closeOnBlur){let e=t.open&&qg(this.view,t.open.tooltip);(!e||!e.dom.contains(i.relatedTarget))&&this.view.dispatch({effects:uo.of(null)})}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:cf.of(!1)}),20),this.composing=0}}}),vy=Rt.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class uP{constructor(t,e,n,r){this.field=t,this.line=e,this.from=n,this.to=r}}class ff{constructor(t,e,n){this.field=t,this.from=e,this.to=n}map(t){let e=t.mapPos(this.from,-1,Je.TrackDel),n=t.mapPos(this.to,1,Je.TrackDel);return e==null||n==null?null:new ff(this.field,e,n)}}class df{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let n=[],r=[e],o=t.doc.lineAt(e),s=/^\s*/.exec(o.text)[0];for(let l of this.lines){if(n.length){let u=s,c=/^\t*/.exec(l)[0].length;for(let d=0;dnew ff(l.field,r[l.line]+l.from,r[l.line]+l.to));return{text:n,ranges:a}}static parse(t){let e=[],n=[],r=[],o;for(let s of t.split(/\r\n?|\n/)){for(;o=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(s);){let a=o[1]?+o[1]:null,l=o[2]||o[3]||"",u=-1;for(let c=0;c=u&&d.field++}r.push(new uP(u,n.length,o.index,o.index+l.length)),s=s.slice(0,o.index)+l+s.slice(o.index+o[0].length)}for(let a;a=/\\([{}])/.exec(s);){s=s.slice(0,a.index)+a[1]+s.slice(a.index+a[0].length);for(let l of r)l.line==n.length&&l.from>a.index&&(l.from--,l.to--)}n.push(s)}return new df(n,r)}}let cP=Gt.widget({widget:new class extends Mn{toDOM(){let i=document.createElement("span");return i.className="cm-snippetFieldPosition",i}ignoreEvent(){return!1}}}),fP=Gt.mark({class:"cm-snippetField"});class Os{constructor(t,e){this.ranges=t,this.active=e,this.deco=Gt.set(t.map(n=>(n.from==n.to?cP:fP).range(n.from,n.to)))}map(t){let e=[];for(let n of this.ranges){let r=n.map(t);if(!r)return null;e.push(r)}return new Os(e,this.active)}selectionInsideField(t){return t.ranges.every(e=>this.ranges.some(n=>n.field==this.active&&n.from<=e.from&&n.to>=e.to))}}const ko=re.define({map(i,t){return i&&i.map(t)}}),dP=re.define(),co=ti.define({create(){return null},update(i,t){for(let e of t.effects){if(e.is(ko))return e.value;if(e.is(dP)&&i)return new Os(i.ranges,e.value)}return i&&t.docChanged&&(i=i.map(t.changes)),i&&t.selection&&!i.selectionInsideField(t.selection)&&(i=null),i},provide:i=>Rt.decorations.from(i,t=>t?t.deco:Gt.none)});function pf(i,t){return yt.create(i.filter(e=>e.field==t).map(e=>yt.range(e.from,e.to)))}function pP(i){let t=df.parse(i);return(e,n,r,o)=>{let{text:s,ranges:a}=t.instantiate(e.state,r),l={changes:{from:r,to:o,insert:we.of(s)},scrollIntoView:!0,annotations:n?dy.of(n):void 0};if(a.length&&(l.selection=pf(a,0)),a.length>1){let u=new Os(a,0),c=l.effects=[ko.of(u)];e.state.field(co,!1)===void 0&&c.push(re.appendConfig.of([co,OP,_P,vy]))}e.dispatch(e.state.update(l))}}function yy(i){return({state:t,dispatch:e})=>{let n=t.field(co,!1);if(!n||i<0&&n.active==0)return!1;let r=n.active+i,o=i>0&&!n.ranges.some(s=>s.field==r+i);return e(t.update({selection:pf(n.ranges,r),effects:ko.of(o?null:new Os(n.ranges,r))})),!0}}const mP=({state:i,dispatch:t})=>i.field(co,!1)?(t(i.update({effects:ko.of(null)})),!0):!1,gP=yy(1),vP=yy(-1),yP=[{key:"Tab",run:gP,shift:vP},{key:"Escape",run:mP}],Ap=Zt.define({combine(i){return i.length?i[0]:yP}}),OP=lr.highest(wo.compute([Ap],i=>i.facet(Ap)));function Si(i,t){return Object.assign(Object.assign({},t),{apply:pP(i)})}const _P=Rt.domEventHandlers({mousedown(i,t){let e=t.state.field(co,!1),n;if(!e||(n=t.posAtCoords({x:i.clientX,y:i.clientY}))==null)return!1;let r=e.ranges.find(o=>o.from<=n&&o.to>=n);return!r||r.field==e.active?!1:(t.dispatch({selection:pf(e.ranges,r.field),effects:ko.of(e.ranges.some(o=>o.field>r.field)?new Os(e.ranges,r.field):null)}),!0)}}),fo={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Or=re.define({map(i,t){let e=t.mapPos(i,-1,Je.TrackAfter);return e??void 0}}),mf=new class extends kr{};mf.startSide=1;mf.endSide=-1;const Oy=ti.define({create(){return ge.empty},update(i,t){if(t.selection){let e=t.state.doc.lineAt(t.selection.main.head).from,n=t.startState.doc.lineAt(t.startState.selection.main.head).from;e!=t.changes.mapPos(n,-1)&&(i=ge.empty)}i=i.map(t.changes);for(let e of t.effects)e.is(Or)&&(i=i.update({add:[mf.range(e.value,e.value+1)]}));return i}});function xP(){return[wP,Oy]}const Wh="()[]{}<>";function _y(i){for(let t=0;t{if((bP?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let r=i.state.selection.main;if(n.length>2||n.length==2&&Yi(ai(n,0))==1||t!=r.from||e!=r.to)return!1;let o=PP(i.state,n);return o?(i.dispatch(o),!0):!1}),SP=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let n=xy(i,i.selection.main.head).brackets||fo.brackets,r=null,o=i.changeByRange(s=>{if(s.empty){let a=kP(i.doc,s.head);for(let l of n)if(l==a&&Xl(i.doc,s.head)==_y(ai(l,0)))return{changes:{from:s.head-l.length,to:s.head+l.length},range:yt.cursor(s.head-l.length)}}return{range:r=s}});return r||t(i.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},CP=[{key:"Backspace",run:SP}];function PP(i,t){let e=xy(i,i.selection.main.head),n=e.brackets||fo.brackets;for(let r of n){let o=_y(ai(r,0));if(t==r)return o==r?EP(i,r,n.indexOf(r+r+r)>-1,e):LP(i,r,o,e.before||fo.before);if(t==o&&by(i,i.selection.main.from))return AP(i,r,o)}return null}function by(i,t){let e=!1;return i.field(Oy).between(0,i.doc.length,n=>{n==t&&(e=!0)}),e}function Xl(i,t){let e=i.sliceString(t,t+2);return e.slice(0,Yi(ai(e,0)))}function kP(i,t){let e=i.sliceString(t-2,t);return Yi(ai(e,0))==e.length?e:e.slice(1)}function LP(i,t,e,n){let r=null,o=i.changeByRange(s=>{if(!s.empty)return{changes:[{insert:t,from:s.from},{insert:e,from:s.to}],effects:Or.of(s.to+t.length),range:yt.range(s.anchor+t.length,s.head+t.length)};let a=Xl(i.doc,s.head);return!a||/\s/.test(a)||n.indexOf(a)>-1?{changes:{insert:t+e,from:s.head},effects:Or.of(s.head+t.length),range:yt.cursor(s.head+t.length)}:{range:r=s}});return r?null:i.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function AP(i,t,e){let n=null,r=i.changeByRange(o=>o.empty&&Xl(i.doc,o.head)==e?{changes:{from:o.head,to:o.head+e.length,insert:e},range:yt.cursor(o.head+e.length)}:n={range:o});return n?null:i.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function EP(i,t,e,n){let r=n.stringPrefixes||fo.stringPrefixes,o=null,s=i.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:t,from:a.to}],effects:Or.of(a.to+t.length),range:yt.range(a.anchor+t.length,a.head+t.length)};let l=a.head,u=Xl(i.doc,l),c;if(u==t){if(Ep(i,l))return{changes:{insert:t+t,from:l},effects:Or.of(l+t.length),range:yt.cursor(l+t.length)};if(by(i,l)){let f=e&&i.sliceDoc(l,l+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:l,to:l+f.length,insert:f},range:yt.cursor(l+f.length)}}}else{if(e&&i.sliceDoc(l-2*t.length,l)==t+t&&(c=Dp(i,l-2*t.length,r))>-1&&Ep(i,c))return{changes:{insert:t+t+t+t,from:l},effects:Or.of(l+t.length),range:yt.cursor(l+t.length)};if(i.charCategorizer(l)(u)!=Ne.Word&&Dp(i,l,r)>-1&&!DP(i,l,t,r))return{changes:{insert:t+t,from:l},effects:Or.of(l+t.length),range:yt.cursor(l+t.length)}}return{range:o=a}});return o?null:i.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Ep(i,t){let e=Ye(i).resolveInner(t+1);return e.parent&&e.from==t}function DP(i,t,e,n){let r=Ye(i).resolveInner(t,-1),o=n.reduce((s,a)=>Math.max(s,a.length),0);for(let s=0;s<5;s++){let a=i.sliceDoc(r.from,Math.min(r.to,r.from+e.length+o)),l=a.indexOf(e);if(!l||l>-1&&n.indexOf(a.slice(0,l))>-1){let c=r.firstChild;for(;c&&c.from==r.from&&c.to-c.from>e.length+l;){if(i.sliceDoc(c.to-e.length,c.to)==e)return!1;c=c.firstChild}return!0}let u=r.to==t&&r.parent;if(!u)break;r=u}return!1}function Dp(i,t,e){let n=i.charCategorizer(t);if(n(i.sliceDoc(t-1,t))!=Ne.Word)return t;for(let r of e){let o=t-r.length;if(i.sliceDoc(o,t)==r&&n(i.sliceDoc(o-1,o))!=Ne.Word)return o}return-1}function TP(i={}){return[Mi,Li.of(i),hP,IP,vy]}const wy=[{key:"Ctrl-Space",run:rP},{key:"Escape",run:sP},{key:"ArrowDown",run:ua(!0)},{key:"ArrowUp",run:ua(!1)},{key:"PageDown",run:ua(!0,"page")},{key:"PageUp",run:ua(!1,"page")},{key:"Enter",run:nP}],IP=lr.highest(wo.computeN([Li],i=>i.facet(Li).defaultKeymap?[wy]:[]));class MP{constructor(t,e,n){this.from=t,this.to=e,this.diagnostic=n}}class gr{constructor(t,e,n){this.diagnostics=t,this.panel=e,this.selected=n}static init(t,e,n){let r=t,o=n.facet(Py).markerFilter;o&&(r=o(r));let s=Gt.set(r.map(a=>a.from==a.to||a.from==a.to-1&&n.doc.lineAt(a.from).to==a.from?Gt.widget({widget:new ZP(a),diagnostic:a}).range(a.from):Gt.mark({attributes:{class:"cm-lintRange cm-lintRange-"+a.severity+(a.markClass?" "+a.markClass:"")},diagnostic:a}).range(a.from,a.to)),!0);return new gr(s,e,ps(s))}}function ps(i,t=null,e=0){let n=null;return i.between(e,1e9,(r,o,{spec:s})=>{if(!(t&&s.diagnostic!=t))return n=new MP(r,o,s.diagnostic),!1}),n}function $P(i,t){let e=i.startState.doc.lineAt(t.pos);return!!(i.effects.some(n=>n.is(Sy))||i.changes.touchesRange(e.from,e.to))}function QP(i,t){return i.field(Qi,!1)?t:t.concat(re.appendConfig.of(zP))}const Sy=re.define(),gf=re.define(),Cy=re.define(),Qi=ti.define({create(){return new gr(Gt.none,null,null)},update(i,t){if(t.docChanged){let e=i.diagnostics.map(t.changes),n=null;if(i.selected){let r=t.changes.mapPos(i.selected.from,1);n=ps(e,i.selected.diagnostic,r)||ps(e,null,r)}i=new gr(e,i.panel,n)}for(let e of t.effects)e.is(Sy)?i=gr.init(e.value,i.panel,t.state):e.is(gf)?i=new gr(i.diagnostics,e.value?Rl.open:null,i.selected):e.is(Cy)&&(i=new gr(i.diagnostics,i.panel,e.value));return i},provide:i=>[Dr.from(i,t=>t.panel),Rt.decorations.from(i,t=>t.diagnostics)]}),NP=Gt.mark({class:"cm-lintRange cm-lintRange-active"});function BP(i,t,e){let{diagnostics:n}=i.state.field(Qi),r=[],o=2e8,s=0;n.between(t-(e<0?1:0),t+(e>0?1:0),(l,u,{spec:c})=>{t>=l&&t<=u&&(l==u||(t>l||e>0)&&(tLy(i,e,!1)))}const XP=i=>{let t=i.state.field(Qi,!1);(!t||!t.panel)&&i.dispatch({effects:QP(i.state,[gf.of(!0)])});let e=ao(i,Rl.open);return e&&e.dom.querySelector(".cm-panel-lint ul").focus(),!0},Tp=i=>{let t=i.state.field(Qi,!1);return!t||!t.panel?!1:(i.dispatch({effects:gf.of(!1)}),!0)},RP=i=>{let t=i.state.field(Qi,!1);if(!t)return!1;let e=i.state.selection.main,n=t.diagnostics.iter(e.to+1);return!n.value&&(n=t.diagnostics.iter(0),!n.value||n.from==e.from&&n.to==e.to)?!1:(i.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)},YP=[{key:"Mod-Shift-m",run:XP,preventDefault:!0},{key:"F8",run:RP}],Py=Zt.define({combine(i){return Object.assign({sources:i.map(t=>t.source)},xn(i.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(t,e)=>t?e?n=>t(n)||e(n):t:e}))}});function ky(i){let t=[];if(i)t:for(let{name:e}of i){for(let n=0;no.toLowerCase()==r.toLowerCase())){t.push(r);continue t}}t.push("")}return t}function Ly(i,t,e){var n;let r=e?ky(t.actions):[];return Ie("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},Ie("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage():t.message),(n=t.actions)===null||n===void 0?void 0:n.map((o,s)=>{let a=!1,l=f=>{if(f.preventDefault(),a)return;a=!0;let g=ps(i.state.field(Qi).diagnostics,t);g&&o.apply(i,g.from,g.to)},{name:u}=o,c=r[s]?u.indexOf(r[s]):-1,d=c<0?u:[u.slice(0,c),Ie("u",u.slice(c,c+1)),u.slice(c+1)];return Ie("button",{type:"button",class:"cm-diagnosticAction",onclick:l,onmousedown:l,"aria-label":` Action: ${u}${c<0?"":` (access key "${r[s]})"`}.`},d)}),t.source&&Ie("div",{class:"cm-diagnosticSource"},t.source))}class ZP extends Mn{constructor(t){super(),this.diagnostic=t}eq(t){return t.diagnostic==this.diagnostic}toDOM(){return Ie("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class Ip{constructor(t,e){this.diagnostic=e,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Ly(t,e,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Rl{constructor(t){this.view=t,this.items=[];let e=r=>{if(r.keyCode==27)Tp(this.view),this.view.focus();else if(r.keyCode==38||r.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(r.keyCode==40||r.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(r.keyCode==36)this.moveSelection(0);else if(r.keyCode==35)this.moveSelection(this.items.length-1);else if(r.keyCode==13)this.view.focus();else if(r.keyCode>=65&&r.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:o}=this.items[this.selectedIndex],s=ky(o.actions);for(let a=0;a{for(let o=0;oTp(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(Qi).selected;if(!t)return-1;for(let e=0;e{let u=-1,c;for(let d=n;dn&&(this.items.splice(n,u-n),r=!0)),e&&c.diagnostic==e.diagnostic?c.dom.hasAttribute("aria-selected")||(c.dom.setAttribute("aria-selected","true"),o=c):c.dom.hasAttribute("aria-selected")&&c.dom.removeAttribute("aria-selected"),n++});n({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:s,panel:a})=>{s.topa.bottom&&(this.list.scrollTop+=s.bottom-a.bottom)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let t=this.list.firstChild;function e(){let n=t;t=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;t!=n.dom;)e();t=n.dom.nextSibling}else this.list.insertBefore(n.dom,t);for(;t;)e()}moveSelection(t){if(this.selectedIndex<0)return;let e=this.view.state.field(Qi),n=ps(e.diagnostics,this.items[t].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:Cy.of(n)})}static open(t){return new Rl(t)}}function WP(i,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(i)}')`}function ca(i){return WP(``,'width="6" height="3"')}const UP=Rt.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:ca("#d11")},".cm-lintRange-warning":{backgroundImage:ca("orange")},".cm-lintRange-info":{backgroundImage:ca("#999")},".cm-lintRange-hint":{backgroundImage:ca("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}}),zP=[Qi,Rt.decorations.compute([Qi],i=>{let{selected:t,panel:e}=i.field(Qi);return!t||!e||t.from==t.to?Gt.none:Gt.set([NP.range(t.from,t.to)])}),Rb(BP,{hideOn:$P}),UP],jP=(()=>[Gb(),Kb(),yb(),yS(),Yw(),ab(),fb(),Oe.allowMultipleSelections.of(!0),Aw(),Ww(jw,{fallback:!0}),tS(),xP(),TP(),Eb(),Ib(),Sb(),OC(),wo.of([...CP,...dC,...BC,...kS,...Bw,...wy,...YP])])();class al{constructor(t,e,n,r,o,s,a,l,u,c=0,d){this.p=t,this.stack=e,this.state=n,this.reducePos=r,this.pos=o,this.score=s,this.buffer=a,this.bufferBase=l,this.curContext=u,this.lookAhead=c,this.parent=d}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,n=0){let r=t.parser.context;return new al(t,[],e,n,n,0,[],0,r?new Mp(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let n=t>>19,r=t&65535,{parser:o}=this.p,s=o.dynamicPrecedence(r);if(s&&(this.score+=s),n==0){this.pushState(o.getGoto(this.state,r,!0),this.reducePos),r=2e3&&!(!((e=this.p.parser.nodeSet.types[r])===null||e===void 0)&&e.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(r,l)}storeNode(t,e,n,r=4,o=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&s.buffer[a-4]==0&&s.buffer[a-1]>-1){if(e==n)return;if(s.buffer[a-2]>=e){s.buffer[a-2]=n;return}}}if(!o||this.pos==n)this.buffer.push(t,e,n,r);else{let s=this.buffer.length;if(s>0&&this.buffer[s-4]!=0)for(;s>0&&this.buffer[s-2]>n;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,r>4&&(r-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=n,this.buffer[s+3]=r}}shift(t,e,n){let r=this.pos;if(t&131072)this.pushState(t&65535,this.pos);else if(t&262144)this.pos=n,this.shiftContext(e,r),e<=this.p.parser.maxNode&&this.buffer.push(e,r,n,4);else{let o=t,{parser:s}=this.p;(n>this.pos||e<=s.maxNode)&&(this.pos=n,s.stateFlag(o,1)||(this.reducePos=n)),this.pushState(o,r),this.shiftContext(e,r),e<=s.maxNode&&this.buffer.push(e,r,n,4)}}apply(t,e,n){t&65536?this.reduce(t):this.shift(t,e,n)}useNode(t,e){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=t)&&(this.p.reused.push(t),n++);let r=this.pos;this.reducePos=this.pos=r+t.length,this.pushState(e,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let n=t.buffer.slice(e),r=t.bufferBase+e;for(;t&&r==t.bufferBase;)t=t.parent;return new al(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let n=t<=this.p.parser.maxNode;n&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,n?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new qP(this);;){let n=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(n==0)return!1;if(!(n&65536))return!0;e.reduce(n)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let r=[];for(let o=0,s;ol&1&&a==s)||r.push(e[o],s)}e=r}let n=[];for(let r=0;r>19,r=e&65535,o=this.stack.length-n*3;if(o<0||t.getGoto(this.stack[o],r,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;e=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],n=(r,o)=>{if(!e.includes(r))return e.push(r),t.allActions(r,s=>{if(!(s&393216))if(s&65536){let a=(s>>19)-o;if(a>1){let l=s&65535,u=this.stack.length-a*3;if(u>=0&&t.getGoto(this.stack[u],l,!1)>=0)return a<<19|65536|l}}else{let a=n(s,o+1);if(a!=null)return a}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Mp{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class qP{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,n=t>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=r}}class ll{constructor(t,e,n){this.stack=t,this.pos=e,this.index=n,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new ll(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new ll(this.stack,this.pos,this.index)}}function Rs(i,t=Uint16Array){if(typeof i!="string")return i;let e=null;for(let n=0,r=0;n=92&&s--,s>=34&&s--;let l=s-32;if(l>=46&&(l-=46,a=!0),o+=l,a)break;o*=46}e?e[r++]=o:e=new t(o)}return e}class Ma{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const $p=new Ma;class VP{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=$p,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let n=this.range,r=this.rangeIndex,o=this.pos+t;for(;on.to:o>=n.to;){if(r==this.ranges.length-1)return null;let s=this.ranges[++r];o+=s.from-n.to,n=s}return o}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,n,r;if(e>=0&&e=this.chunk2Pos&&na.to&&(this.chunk2=this.chunk2.slice(0,a.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(t,e=0){let n=e?this.resolveOffset(e,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=$p,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let n="";for(let r of this.ranges){if(r.from>=e)break;r.to>t&&(n+=this.input.read(Math.max(r.from,t),Math.min(r.to,e)))}return n}}class es{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:n}=e.p;Ay(this.data,t,e,this.id,n.data,n.tokenPrecTable)}}es.prototype.contextual=es.prototype.fallback=es.prototype.extend=!1;class mc{constructor(t,e,n){this.precTable=e,this.elseToken=n,this.data=typeof t=="string"?Rs(t):t}token(t,e){let n=t.pos,r=0;for(;;){let o=t.next<0,s=t.resolveOffset(1,1);if(Ay(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(o||r++,s==null)break;t.reset(s,t.token)}r&&(t.reset(n,t.token),t.acceptToken(this.elseToken,r))}}mc.prototype.contextual=es.prototype.fallback=es.prototype.extend=!1;class vf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function Ay(i,t,e,n,r,o){let s=0,a=1<0){let x=i[g];if(l.allows(x)&&(t.token.value==-1||t.token.value==x||GP(x,t.token.value,r,o))){t.acceptToken(x);break}}let c=t.next,d=0,f=i[s+2];if(t.next<0&&f>d&&i[u+f*3-3]==65535&&i[u+f*3-3]==65535){s=i[u+f*3-1];continue t}for(;d>1,x=u+g+(g<<1),m=i[x],v=i[x+1]||65536;if(c=v)d=g+1;else{s=i[x+2],t.advance();continue t}}break}}function Qp(i,t,e){for(let n=t,r;(r=i[n])!=65535;n++)if(r==e)return n-t;return-1}function GP(i,t,e,n){let r=Qp(e,n,t);return r<0||Qp(e,n,i)t)&&!n.type.isError)return e<0?Math.max(0,Math.min(n.to-1,t-25)):Math.min(i.length,Math.max(n.from+1,t+25));if(e<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return e<0?0:i.length}}class HP{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?Np(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?Np(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=s,null;if(o instanceof Re){if(s==t){if(s=Math.max(this.safeFrom,t)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[e]++,this.nextStart=s+o.length}}}class JP{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(n=>new Ma)}getActions(t){let e=0,n=null,{parser:r}=t.p,{tokenizers:o}=r,s=r.stateSlot(t.state,3),a=t.curContext?t.curContext.hash:0,l=0;for(let u=0;ud.end+25&&(l=Math.max(d.lookAhead,l)),d.value!=0)){let f=e;if(d.extended>-1&&(e=this.addActions(t,d.extended,d.end,e)),e=this.addActions(t,d.value,d.end,e),!c.extend&&(n=d,e>f))break}}for(;this.actions.length>e;)this.actions.pop();return l&&t.setLookAhead(l),!n&&t.pos==this.stream.end&&(n=new Ma,n.value=t.p.parser.eofTerm,n.start=n.end=t.pos,e=this.addActions(t,n.value,n.end,e)),this.mainToken=n,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Ma,{pos:n,p:r}=t;return e.start=n,e.end=Math.min(n+1,r.stream.end),e.value=n==r.stream.end?r.parser.eofTerm:0,e}updateCachedToken(t,e,n){let r=this.stream.clipPos(n.pos);if(e.token(this.stream.reset(r,t),n),t.value>-1){let{parser:o}=n.p;for(let s=0;s=0&&n.p.parser.dialect.allows(a>>1)){a&1?t.extended=a>>1:t.value=a>>1;break}}}else t.value=0,t.end=this.stream.clipPos(r+1)}putAction(t,e,n,r){for(let o=0;ot.bufferLength*4?new HP(n,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,n=this.stacks=[],r,o;if(this.bigReductionCount>300&&t.length==1){let[s]=t;for(;s.forceReduce()&&s.stack.length&&s.stack[s.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;se)n.push(a);else{if(this.advanceStack(a,n,t))continue;{r||(r=[],o=[]),r.push(a);let l=this.tokens.getMainToken(a);o.push(l.value,l.end)}}break}}if(!n.length){let s=r&&i2(r);if(s)return Ti&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw Ti&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&r){let s=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,o,n);if(s)return Ti&&console.log("Force-finish "+this.stackID(s)),this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(n.length>s)for(n.sort((a,l)=>l.score-a.score);n.length>s;)n.pop();n.some(a=>a.reducePos>e)&&this.recovering--}else if(n.length>1){t:for(let s=0;s500&&u.buffer.length>500)if((a.score-u.score||a.buffer.length-u.buffer.length)>0)n.splice(l--,1);else{n.splice(s--,1);continue t}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let s=1;s ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let u=t.curContext&&t.curContext.tracker.strict,c=u?t.curContext.hash:0;for(let d=this.fragments.nodeAt(r);d;){let f=this.parser.nodeSet.types[d.type.id]==d.type?o.getGoto(t.state,d.type.id):-1;if(f>-1&&d.length&&(!u||(d.prop(ce.contextHash)||0)==c))return t.useNode(d,f),Ti&&console.log(s+this.stackID(t)+` (via reuse of ${o.getName(d.type.id)})`),!0;if(!(d instanceof Re)||d.children.length==0||d.positions[0]>0)break;let g=d.children[0];if(g instanceof Re&&d.positions[0]==0)d=g;else break}}let a=o.stateSlot(t.state,4);if(a>0)return t.reduce(a),Ti&&console.log(s+this.stackID(t)+` (via always-reduce ${o.getName(a&65535)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let l=this.tokens.getActions(t);for(let u=0;ur?e.push(x):n.push(x)}return!1}advanceFully(t,e){let n=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>n)return Bp(t,e),!0}}runRecovery(t,e,n){let r=null,o=!1;for(let s=0;s ":"";if(a.deadEnd&&(o||(o=!0,a.restart(),Ti&&console.log(c+this.stackID(a)+" (restarted)"),this.advanceFully(a,n))))continue;let d=a.split(),f=c;for(let g=0;d.forceReduce()&&g<10&&(Ti&&console.log(f+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,n));g++)Ti&&(f=this.stackID(d)+" -> ");for(let g of a.recoverByInsert(l))Ti&&console.log(c+this.stackID(g)+" (via recover-insert)"),this.advanceFully(g,n);this.stream.end>a.pos?(u==a.pos&&(u++,l=0),a.recoverByDelete(l,u),Ti&&console.log(c+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),Bp(a,n)):(!r||r.scorei;class e2{constructor(t){this.start=t.start,this.shift=t.shift||zh,this.reduce=t.reduce||zh,this.reuse=t.reuse||zh,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class hl extends iv{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let a=0;at.topRules[a][1]),r=[];for(let a=0;a=0)o(c,l,a[u++]);else{let d=a[u+-c];for(let f=-c;f>0;f--)o(a[u++],l,d);u++}}}this.nodeSet=new Rc(e.map((a,l)=>Ei.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:r[l],top:n.indexOf(l)>-1,error:l==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(l)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=Jg;let s=Rs(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;atypeof a=="number"?new es(s,a):a),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,n){let r=new KP(this,t,e,n);for(let o of this.wrappers)r=o(r,t,e,n);return r}getGoto(t,e,n=!1){let r=this.goto;if(e>=r[0])return-1;for(let o=r[e+1];;){let s=r[o++],a=s&1,l=r[o++];if(a&&n)return l;for(let u=o+(s>>1);o0}validAction(t,e){return!!this.allActions(t,n=>n==e?!0:null)}allActions(t,e){let n=this.stateSlot(t,4),r=n?e(n):void 0;for(let o=this.stateSlot(t,1);r==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=kn(this.data,o+2);else break;r=e(kn(this.data,o+1))}return r}nextStates(t){let e=[];for(let n=this.stateSlot(t,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=kn(this.data,n+2);else break;if(!(this.data[n+2]&1)){let r=this.data[n+1];e.some((o,s)=>s&1&&o==r)||e.push(this.data[n],r)}}return e}configure(t){let e=Object.assign(Object.create(hl.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let n=this.topRules[t.top];if(!n)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=n}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(n=>{let r=t.tokenizers.find(o=>o.from==n);return r?r.to:n})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((n,r)=>{let o=t.specializers.find(a=>a.from==n.external);if(!o)return n;let s=Object.assign(Object.assign({},n),{external:o.to});return e.specializers[r]=Fp(s),s})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),n=e.map(()=>!1);if(t)for(let o of t.split(" ")){let s=e.indexOf(o);s>=0&&(n[s]=!0)}let r=null;for(let o=0;on)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.scorei.external(e,n)<<1|t}return i.get}const n2=304,Xp=1,r2=2,s2=305,o2=307,a2=308,l2=3,h2=4,u2=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],Ey=125,c2=59,Rp=47,f2=42,d2=43,p2=45,m2=new e2({start:!1,shift(i,t){return t==l2||t==h2||t==o2?i:t==a2},strict:!1}),g2=new vf((i,t)=>{let{next:e}=i;(e==Ey||e==-1||t.context)&&i.acceptToken(s2)},{contextual:!0,fallback:!0}),v2=new vf((i,t)=>{let{next:e}=i,n;u2.indexOf(e)>-1||e==Rp&&((n=i.peek(1))==Rp||n==f2)||e!=Ey&&e!=c2&&e!=-1&&!t.context&&i.acceptToken(n2)},{contextual:!0}),y2=new vf((i,t)=>{let{next:e}=i;if((e==d2||e==p2)&&(i.advance(),e==i.next)){i.advance();let n=!t.context&&t.canShift(Xp);i.acceptToken(n?Xp:r2)}},{contextual:!0}),O2=nv({"get set async static":mt.modifier,"for while do if else switch try catch finally return throw break continue default case":mt.controlKeyword,"in of await yield void typeof delete instanceof":mt.operatorKeyword,"let var const function class extends":mt.definitionKeyword,"import export from":mt.moduleKeyword,"with debugger as new":mt.keyword,TemplateString:mt.special(mt.string),super:mt.atom,BooleanLiteral:mt.bool,this:mt.self,null:mt.null,Star:mt.modifier,VariableName:mt.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":mt.function(mt.variableName),VariableDefinition:mt.definition(mt.variableName),Label:mt.labelName,PropertyName:mt.propertyName,PrivatePropertyName:mt.special(mt.propertyName),"CallExpression/MemberExpression/PropertyName":mt.function(mt.propertyName),"FunctionDeclaration/VariableDefinition":mt.function(mt.definition(mt.variableName)),"ClassDeclaration/VariableDefinition":mt.definition(mt.className),PropertyDefinition:mt.definition(mt.propertyName),PrivatePropertyDefinition:mt.definition(mt.special(mt.propertyName)),UpdateOp:mt.updateOperator,"LineComment Hashbang":mt.lineComment,BlockComment:mt.blockComment,Number:mt.number,String:mt.string,Escape:mt.escape,ArithOp:mt.arithmeticOperator,LogicOp:mt.logicOperator,BitOp:mt.bitwiseOperator,CompareOp:mt.compareOperator,RegExp:mt.regexp,Equals:mt.definitionOperator,Arrow:mt.function(mt.punctuation),": Spread":mt.punctuation,"( )":mt.paren,"[ ]":mt.squareBracket,"{ }":mt.brace,"InterpolationStart InterpolationEnd":mt.special(mt.brace),".":mt.derefOperator,", ;":mt.separator,"@":mt.meta,TypeName:mt.typeName,TypeDefinition:mt.definition(mt.typeName),"type enum interface implements namespace module declare":mt.definitionKeyword,"abstract global Privacy readonly override":mt.modifier,"is keyof unique infer":mt.operatorKeyword,JSXAttributeValue:mt.attributeValue,JSXText:mt.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":mt.angleBracket,"JSXIdentifier JSXNameSpacedName":mt.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":mt.attributeName,"JSXBuiltin/JSXIdentifier":mt.standard(mt.tagName)}),_2={__proto__:null,export:16,as:21,from:29,default:32,async:37,function:38,extends:48,this:52,true:60,false:60,null:72,void:76,typeof:80,super:98,new:132,delete:148,yield:157,await:161,class:166,public:223,private:223,protected:223,readonly:225,instanceof:244,satisfies:247,in:248,const:250,import:282,keyof:337,unique:341,infer:347,is:383,abstract:403,implements:405,type:407,let:410,var:412,using:415,interface:421,enum:425,namespace:431,module:433,declare:437,global:441,for:460,of:469,while:472,with:476,do:480,if:484,else:486,switch:490,case:496,try:502,catch:506,finally:510,return:514,throw:518,break:522,continue:526,debugger:530},x2={__proto__:null,async:119,get:121,set:123,declare:183,public:185,private:185,protected:185,static:187,abstract:189,override:191,readonly:197,accessor:199,new:387},b2={__proto__:null,"<":139},w2=hl.deserialize({version:14,states:"$6zO%TQUOOO%[QUOOO'_QWOOP(lOSOOO*zQ(CjO'#CgO+ROpO'#ChO+aO!bO'#ChO+oO07`O'#D[O.QQUO'#DbO.bQUO'#DmO%[QUO'#DwO0fQUO'#EPOOQ(CY'#EX'#EXO1PQSO'#EUOOQO'#Ej'#EjOOQO'#Id'#IdO1XQSO'#GlO1dQSO'#EiO1iQSO'#EiO3kQ(CjO'#JeO6[Q(CjO'#JfO6xQSO'#FXO6}Q#tO'#FpOOQ(CY'#Fa'#FaO7YO&jO'#FaO7hQ,UO'#FwO9OQSO'#FvOOQ(CY'#Jf'#JfOOQ(CW'#Je'#JeO9TQSO'#GpOOQQ'#KQ'#KQO9`QSO'#IQO9eQ(C[O'#IROOQQ'#JR'#JROOQQ'#IV'#IVQ`QUOOO`QUOOO%[QUO'#DoO9mQUO'#D{O9tQUO'#D}O9ZQSO'#GlO9{Q,UO'#CmO:ZQSO'#EhO:fQSO'#EsO:kQ,UO'#F`O;YQSO'#GlOOQO'#KR'#KRO;_QSO'#KRO;mQSO'#GtO;mQSO'#GuO;mQSO'#GwO9ZQSO'#GzO]QSO'#HZO>eQSO'#HaO>eQSO'#HcO`QUO'#HeO>eQSO'#HgO>eQSO'#HjO>jQSO'#HpO>oQ(C]O'#HvO%[QUO'#HxO>zQ(C]O'#HzO?VQ(C]O'#H|O9eQ(C[O'#IOO?bQ(CjO'#CgO@dQWO'#DgQOQSOOO%[QUO'#D}O@zQSO'#EQO9{Q,UO'#EhOAVQSO'#EhOAbQ`O'#F`OOQQ'#Ce'#CeOOQ(CW'#Dl'#DlOOQ(CW'#Ji'#JiO%[QUO'#JiOOQO'#Jm'#JmOOQO'#Ia'#IaOBbQWO'#EaOOQ(CW'#E`'#E`OC^Q(C`O'#EaOChQWO'#ETOOQO'#Jl'#JlOC|QWO'#JmOEZQWO'#ETOChQWO'#EaPEhO?MpO'#C`POOO)CDp)CDpOOOO'#IW'#IWOEsOpO,59SOOQ(CY,59S,59SOOOO'#IX'#IXOFRO!bO,59SO%[QUO'#D^OOOO'#IZ'#IZOFaO07`O,59vOOQ(CY,59v,59vOFoQUO'#I[OGSQSO'#JgOIUQbO'#JgO+}QUO'#JgOI]QSO,59|OIsQSO'#EjOJQQSO'#JuOJ]QSO'#JtOJ]QSO'#JtOJeQSO,5;WOJjQSO'#JsOOQ(CY,5:X,5:XOJqQUO,5:XOLrQ(CjO,5:cOMcQSO,5:kOM|Q(C[O'#JrONTQSO'#JqO9TQSO'#JqONiQSO'#JqONqQSO,5;VONvQSO'#JqO!#OQbO'#JfOOQ(CY'#Cg'#CgO%[QUO'#EPO!#nQ`O,5:pOOQO'#Jn'#JnOOQO-ElOOQQ'#JZ'#JZOOQQ,5>m,5>mOOQQ-ExQ(CjO,5:iOOQO,5@m,5@mO!?iQ,UO,5=WO!?wQ(C[O'#J[O9OQSO'#J[O!@YQ(C[O,59XO!@eQWO,59XO!@mQ,UO,59XO9{Q,UO,59XO!@xQSO,5;TO!AQQSO'#HYO!AcQSO'#KVO%[QUO,5;xO!7cQWO,5;zO!AkQSO,5=sO!ApQSO,5=sO!AuQSO,5=sO9eQ(C[O,5=sO;mQSO,5=cOOQO'#Cs'#CsO!BTQWO,5=`O!B]Q,UO,5=aO!BhQSO,5=cO!BmQ`O,5=fO!BuQSO'#KRO>jQSO'#HPO9ZQSO'#HRO!BzQSO'#HRO9{Q,UO'#HTO!CPQSO'#HTOOQQ,5=i,5=iO!CUQSO'#HUO!C^QSO'#CmO!CcQSO,58}O!CmQSO,58}O!ErQUO,58}OOQQ,58},58}O!FSQ(C[O,58}O%[QUO,58}O!H_QUO'#H]OOQQ'#H^'#H^OOQQ'#H_'#H_O`QUO,5=uO!HuQSO,5=uO`QUO,5={O`QUO,5=}O!HzQSO,5>PO`QUO,5>RO!IPQSO,5>UO!IUQUO,5>[OOQQ,5>b,5>bO%[QUO,5>bO9eQ(C[O,5>dOOQQ,5>f,5>fO!M`QSO,5>fOOQQ,5>h,5>hO!M`QSO,5>hOOQQ,5>j,5>jO!MeQWO'#DYO%[QUO'#JiO!NSQWO'#JiO!NqQWO'#DhO# SQWO'#DhO##eQUO'#DhO##lQSO'#JhO##tQSO,5:RO##yQSO'#EnO#$XQSO'#JvO#$aQSO,5;XO#$fQWO'#DhO#$sQWO'#ESOOQ(CY,5:l,5:lO%[QUO,5:lO#$zQSO,5:lO>jQSO,5;SO!@eQWO,5;SO!@mQ,UO,5;SO9{Q,UO,5;SO#%SQSO,5@TO#%XQ!LQO,5:pOOQO-E<_-E<_O#&_Q(C`O,5:{OChQWO,5:oO#&iQWO,5:oOChQWO,5:{O!@YQ(C[O,5:oOOQ(CW'#Ed'#EdOOQO,5:{,5:{O%[QUO,5:{O#&vQ(C[O,5:{O#'RQ(C[O,5:{O!@eQWO,5:oOOQO,5;R,5;RO#'aQ(C[O,5:{POOO'#IU'#IUP#'uO?MpO,58zPOOO,58z,58zOOOO-EvO+}QUO,5>vOOQO,5>|,5>|O#(aQUO'#I[OOQO-ERQ(CjO1G0yO#?yQ(CjO1G0yO#ByQ$IUO'#CgO#DwQ$IUO1G1[O#EOQ$IUO'#JfO!,YQSO1G1bO#E`Q(CjO,5?SOOQ(CW-EeQSO1G3kO$.VQUO1G3mO$2ZQUO'#HlOOQQ1G3p1G3pO$2hQSO'#HrO>jQSO'#HtOOQQ1G3v1G3vO$2pQUO1G3vO9eQ(C[O1G3|OOQQ1G4O1G4OOOQ(CW'#GX'#GXO9eQ(C[O1G4QO9eQ(C[O1G4SO$6wQSO,5@TO!*SQUO,5;YO9TQSO,5;YO>jQSO,5:SO!*SQUO,5:SO!@eQWO,5:SO$6|Q$IUO,5:SOOQO,5;Y,5;YO$7WQWO'#I]O$7nQSO,5@SOOQ(CY1G/m1G/mO$7vQWO'#IcO$8QQSO,5@bOOQ(CW1G0s1G0sO# SQWO,5:SOOQO'#I`'#I`O$8YQWO,5:nOOQ(CY,5:n,5:nO#$}QSO1G0WOOQ(CY1G0W1G0WO%[QUO1G0WOOQ(CY1G0n1G0nO>jQSO1G0nO!@eQWO1G0nO!@mQ,UO1G0nOOQ(CW1G5o1G5oO!@YQ(C[O1G0ZOOQO1G0g1G0gO%[QUO1G0gO$8aQ(C[O1G0gO$8lQ(C[O1G0gO!@eQWO1G0ZOChQWO1G0ZO$8zQ(C[O1G0gOOQO1G0Z1G0ZO$9`Q(CjO1G0gPOOO-EvO$9|QSO1G5mO$:UQSO1G5zO$:^QbO1G5{O9TQSO,5>|O$:hQ(CjO1G5xO%[QUO1G5xO$:xQ(C[O1G5xO$;ZQSO1G5wO$;ZQSO1G5wO9TQSO1G5wO$;cQSO,5?PO9TQSO,5?POOQO,5?P,5?PO$;wQSO,5?PO$$XQSO,5?POOQO-ExQ(CjO,5WOOQQ,5>W,5>WO%[QUO'#HmO%(ZQSO'#HoOOQQ,5>^,5>^O9TQSO,5>^OOQQ,5>`,5>`OOQQ7+)b7+)bOOQQ7+)h7+)hOOQQ7+)l7+)lOOQQ7+)n7+)nO%(`QWO1G5oO%(tQ$IUO1G0tO%)OQSO1G0tOOQO1G/n1G/nO%)ZQ$IUO1G/nO>jQSO1G/nO!*SQUO'#DhOOQO,5>w,5>wOOQO-E},5>}OOQO-EjQSO7+&YO!@eQWO7+&YOOQO7+%u7+%uO$9`Q(CjO7+&ROOQO7+&R7+&RO%[QUO7+&RO%)eQ(C[O7+&RO!@YQ(C[O7+%uO!@eQWO7+%uO%)pQ(C[O7+&RO%*OQ(CjO7++dO%[QUO7++dO%*`QSO7++cO%*`QSO7++cOOQO1G4k1G4kO9TQSO1G4kO%*hQSO1G4kOOQO7+%z7+%zO#$}QSO<xOOQO-E<[-E<[O%2^QbO,5>yO%[QUO,5>yOOQO-E<]-E<]O%2hQSO1G5qOOQ(CY<XQ$IUO1G0yO%>`Q$IUO1G0yO%@WQ$IUO1G0yO%@kQ(CjO<XOOQQ,5>Z,5>ZO%NUQSO1G3xO9TQSO7+&`O!*SQUO7+&`OOQO7+%Y7+%YO%NZQ$IUO1G5{O>jQSO7+%YOOQ(CY<jQSO<jQSO7+)dO&5rQSO<{AN>{O%[QUOAN?XOOQO<SQSO7++uO%LgQSOANAyOOQQANAyANAyO!&^Q,UOANAyO&>[QSOANAyOOQQANA{ANA{O9eQ(C[OANA{O#MzQSOANA{OOQO'#HW'#HWOOQO7+*e7+*eOOQQG22uG22uOOQQANEPANEPOOQQANEQANEQOOQQANBTANBTO&>dQSOANBTOOQQ<iQSOLD,jO&>qQ$IUO7+'tO&@gQ$IUO7+'vO&B]Q,UOG26|OOQO<YOPZXYZXlZXzZX{ZX}ZX!fZX!gZX!iZX!mZX#YZX#edX#hZX#iZX#jZX#kZX#lZX#mZX#nZX#oZX#pZX#rZX#tZX#vZX#wZX#|ZX(TZX(dZX(kZX(lZX!WZX!XZX~O#zZX~P#@sOP$]OY:YOl9|Oz#yO{#zO}#{O!f:OO!g#wO!i#xO!m$]O#h9zO#i9{O#j9{O#k9{O#l9}O#m:OO#n:OO#o:XO#p:OO#r:PO#t:RO#v:TO#w:UO(TVO(d$ZO(k#|O(l#}O~O#z.iO~P#CQO#Y:ZO#|:ZO#z(YX!X(YX~P! UO_'[a!W'[a'm'[a'k'[a!h'[a!T'[ap'[a!Y'[a%b'[a!b'[a~P!7zOP#giY#gi_#gil#gi{#gi!W#gi!f#gi!g#gi!i#gi!m#gi#h#gi#i#gi#j#gi#k#gi#l#gi#m#gi#n#gi#o#gi#p#gi#r#gi#t#gi#v#gi#w#gi'm#gi(T#gi(d#gi'k#gi!T#gi!h#gip#gi!Y#gi%b#gi!b#gi~P#,gO_#{i!W#{i'm#{i'k#{i!T#{i!h#{ip#{i!Y#{i%b#{i!b#{i~P!7zO$X.nO$Z.nO~O$X.oO$Z.oO~O!b)_O#Y.pO!Y$_X$U$_X$X$_X$Z$_X$b$_X~O!V.qO~O!Y)bO$U.sO$X)aO$Z)aO$b.tO~O!W:VO!X(XX~P#CQO!X.uO~O!b)_O$b(mX~O$b.wO~Or)qO(U)rO(V.zO~O!T/OO~P!&^O!WdX!bdX!hdX!h$tX(ddX~P!/bO!h/UO~P#,gO!W/VO!b#uO(d'gO!h(qX~O!h/[O~O!V*SO'v%`O!h(qP~O#e/^O~O!T$tX!W$tX!b${X~P!/bO!W/_O!T(rX~P#,gO!b/aO~O!T/cO~Ol/gO!b#uO!i%^O(P%RO(d'gO~O'v/iO~O!b+YO~O_%gO!W/mO'm%gO~O!X/oO~P!3`O!^/pO!_/pO'w!lO(W!mO~O}/rO(W!mO~O#U/sO~O'v&QOe'aX!W'aX~O!W*lOe(Qa~Oe/xO~Oz/yO{/yO}/zOhwa(kwa(lwa!Wwa#Ywa~Oewa#zwa~P$ hOz)vO})wOh$ma(k$ma(l$ma!W$ma#Y$ma~Oe$ma#z$ma~P$!^Oz)vO})wOh$oa(k$oa(l$oa!W$oa#Y$oa~Oe$oa#z$oa~P$#PO#e/|O~Oe$}a!W$}a#Y$}a#z$}a~P!0kO!b#uO~O#e0PO~O!W*}O_(va'm(va~Oz#yO{#zO}#{O!g#wO!i#xO(TVOP!oiY!oil!oi!W!oi!f!oi!m!oi#h!oi#i!oi#j!oi#k!oi#l!oi#m!oi#n!oi#o!oi#p!oi#r!oi#t!oi#v!oi#w!oi(d!oi(k!oi(l!oi~O_!oi'm!oi'k!oi!T!oi!h!oip!oi!Y!oi%b!oi!b!oi~P$$nOh.UO!Y'VO%b.TO~Oj0ZO'v0YO~P!1]O!b+YO_(Oa!Y(Oa'm(Oa!W(Oa~O#e0aO~OYZX!WdX!XdX~O!W0bO!X(zX~O!X0dO~OY0eO~O'v+bO'xTO'{UO~O!Y%wO'v%`O^'iX!W'iX~O!W+gO^(ya~O!h0jO~P!7zOY0mO~O^0nO~O#Y0qO~Oh0tO!Y$|O~O(W(tO!X(wP~Oh0}O!Y0zO%b0|O(P%RO~OY1XO!W1VO!X(xX~O!X1YO~O^1[O_%gO'm%gO~O'v#mO'xTO'{UO~O#Y$eO#|$eOP(YXY(YXl(YXz(YX{(YX}(YX!W(YX!f(YX!i(YX!m(YX#h(YX#i(YX#j(YX#k(YX#l(YX#m(YX#n(YX#o(YX#r(YX#t(YX#v(YX#w(YX(T(YX(d(YX(k(YX(l(YX~O#p1_O&S1`O_(YX!g(YX~P$+dO#Y$eO#p1_O&S1`O~O_1bO~P%[O_1dO~O&]1gOP&ZiQ&ZiW&Zi_&Zib&Zic&Zij&Zil&Zim&Zin&Zit&Ziv&Zix&Zi}&Zi!R&Zi!S&Zi!Y&Zi!d&Zi!i&Zi!l&Zi!m&Zi!n&Zi!p&Zi!r&Zi!u&Zi!y&Zi#q&Zi$R&Zi$V&Zi%a&Zi%c&Zi%e&Zi%f&Zi%g&Zi%j&Zi%l&Zi%o&Zi%p&Zi%r&Zi&O&Zi&U&Zi&W&Zi&Y&Zi&[&Zi&_&Zi&e&Zi&k&Zi&m&Zi&o&Zi&q&Zi&s&Zi'k&Zi'v&Zi'x&Zi'{&Zi(T&Zi(c&Zi(p&Zi!X&Zi`&Zi&b&Zi~O`1mO!X1kO&b1lO~P`O!YXO!i1oO~O&i,jOP&diQ&diW&di_&dib&dic&dij&dil&dim&din&dit&div&dix&di}&di!R&di!S&di!Y&di!d&di!i&di!l&di!m&di!n&di!p&di!r&di!u&di!y&di#q&di$R&di$V&di%a&di%c&di%e&di%f&di%g&di%j&di%l&di%o&di%p&di%r&di&O&di&U&di&W&di&Y&di&[&di&_&di&e&di&k&di&m&di&o&di&q&di&s&di'k&di'v&di'x&di'{&di(T&di(c&di(p&di!X&di&]&di`&di&b&di~O!T1uO~O!W![a!X![a~P#CQOm!nO}!oO!V1{O(W!mO!W'PX!X'PX~P@OO!W,zO!X([a~O!W'VX!X'VX~P!7SO!W,}O!X(ja~O!X2SO~P'_O_%gO#Y2]O'm%gO~O_%gO!b#uO#Y2]O'm%gO~O_%gO!b#uO!m2aO#Y2]O'm%gO(d'gO~O_%gO'm%gO~P!7zO!W$aOp$la~O!T'Oi!W'Oi~P!7zO!W'{O!T(Zi~O!W(SO!T(hi~O!T(ii!W(ii~P!7zO!W(fi!h(fi_(fi'm(fi~P!7zO#Y2cO!W(fi!h(fi_(fi'm(fi~O!W(`O!h(ei~O}%aO!Y%bO!y]O#c2hO#d2gO'v%`O~O}%aO!Y%bO#d2gO'v%`O~Oh2oO!Y'VO%b2nO~Oh2oO!Y'VO%b2nO(P%RO~O#ewaPwaYwa_walwa!fwa!gwa!iwa!mwa#hwa#iwa#jwa#kwa#lwa#mwa#nwa#owa#pwa#rwa#twa#vwa#wwa'mwa(Twa(dwa!hwa!Twa'kwapwa!Ywa%bwa!bwa~P$ hO#e$maP$maY$ma_$mal$ma{$ma!f$ma!g$ma!i$ma!m$ma#h$ma#i$ma#j$ma#k$ma#l$ma#m$ma#n$ma#o$ma#p$ma#r$ma#t$ma#v$ma#w$ma'm$ma(T$ma(d$ma!h$ma!T$ma'k$map$ma!Y$ma%b$ma!b$ma~P$!^O#e$oaP$oaY$oa_$oal$oa{$oa!f$oa!g$oa!i$oa!m$oa#h$oa#i$oa#j$oa#k$oa#l$oa#m$oa#n$oa#o$oa#p$oa#r$oa#t$oa#v$oa#w$oa'm$oa(T$oa(d$oa!h$oa!T$oa'k$oap$oa!Y$oa%b$oa!b$oa~P$#PO#e$}aP$}aY$}a_$}al$}a{$}a!W$}a!f$}a!g$}a!i$}a!m$}a#h$}a#i$}a#j$}a#k$}a#l$}a#m$}a#n$}a#o$}a#p$}a#r$}a#t$}a#v$}a#w$}a'm$}a(T$}a(d$}a!h$}a!T$}a'k$}a#Y$}ap$}a!Y$}a%b$}a!b$}a~P#,gO_#]q!W#]q'm#]q'k#]q!T#]q!h#]qp#]q!Y#]q%b#]q!b#]q~P!7zOe'QX!W'QX~P!'vO!W._Oe(^a~O!V2wO!W'RX!h'RX~P%[O!W.bO!h(_a~O!W.bO!h(_a~P!7zO!T2zO~O#z!ka!X!ka~PJxO#z!ca!W!ca!X!ca~P#CQO#z!oa!X!oa~P!:eO#z!qa!X!qa~P!=OO!Y3^O$VfO$`3_O~O!X3cO~Op3dO~P#,gO_$iq!W$iq'm$iq'k$iq!T$iq!h$iqp$iq!Y$iq%b$iq!b$iq~P!7zO!T3eO~P#,gOz)vO})wO(l){Oh%Yi(k%Yi!W%Yi#Y%Yi~Oe%Yi#z%Yi~P$I|Oz)vO})wOh%[i(k%[i(l%[i!W%[i#Y%[i~Oe%[i#z%[i~P$JoO(d$ZO~P#,gO!V3hO'v%`O!W']X!h']X~O!W/VO!h(qa~O!W/VO!b#uO!h(qa~O!W/VO!b#uO(d'gO!h(qa~Oe$vi!W$vi#Y$vi#z$vi~P!0kO!V3pO'v*XO!T'_X!W'_X~P!1YO!W/_O!T(ra~O!W/_O!T(ra~P#,gO!b#uO#p3xO~Ol3{O!b#uO(d'gO~Oe(Ri!W(Ri~P!0kO#Y4OOe(Ri!W(Ri~P!0kO!h4RO~O_$jq!W$jq'm$jq'k$jq!T$jq!h$jqp$jq!Y$jq%b$jq!b$jq~P!7zO!T4VO~O!W4WO!Y(sX~P#,gO!g#wO~P4XO_$tX!Y$tX%VZX'm$tX!W$tX~P!/bO%V4YO_iXhiXziX}iX!YiX'miX(kiX(liX!WiX~O%V4YO~O%c4aO'v+bO'xTO'{UO!W'hX!X'hX~O!W0bO!X(za~OY4eO~O^4fO~O_%gO'm%gO~P#,gO!Y$|O~P#,gO!W4nO#Y4pO!X(wX~O!X4qO~Om!nO}4rO!]!xO!^!uO!_!uO!y9rO!}!pO#O!pO#P!pO#Q!pO#R!pO#U4wO#V!yO'w!lO'xTO'{UO(W!mO(c!sO~O!X4vO~P%$nOh4|O!Y0zO%b4{O~Oh4|O!Y0zO%b4{O(P%RO~O'v#mO!W'gX!X'gX~O!W1VO!X(xa~O'xTO'{UO(W5VO~O^5ZO~O#p5^O&S5_O~PMhO!h5`O~P%[O_5bO~O_5bO~P%[O`1mO!X5gO&b1lO~P`O!b5iO~O!b5kO!W(]i!X(]i!b(]i!i(]i(P(]i~O!W#bi!X#bi~P#CQO#Y5lO!W#bi!X#bi~O!W![i!X![i~P#CQO_%gO#Y5uO'm%gO~O_%gO!b#uO#Y5uO'm%gO~O!W(fq!h(fq_(fq'm(fq~P!7zO!W(`O!h(eq~O}%aO!Y%bO#d5|O'v%`O~O!Y'VO%b6PO~Oh6SO!Y'VO%b6PO~O#e%YiP%YiY%Yi_%Yil%Yi{%Yi!f%Yi!g%Yi!i%Yi!m%Yi#h%Yi#i%Yi#j%Yi#k%Yi#l%Yi#m%Yi#n%Yi#o%Yi#p%Yi#r%Yi#t%Yi#v%Yi#w%Yi'm%Yi(T%Yi(d%Yi!h%Yi!T%Yi'k%Yip%Yi!Y%Yi%b%Yi!b%Yi~P$I|O#e%[iP%[iY%[i_%[il%[i{%[i!f%[i!g%[i!i%[i!m%[i#h%[i#i%[i#j%[i#k%[i#l%[i#m%[i#n%[i#o%[i#p%[i#r%[i#t%[i#v%[i#w%[i'm%[i(T%[i(d%[i!h%[i!T%[i'k%[ip%[i!Y%[i%b%[i!b%[i~P$JoO#e$viP$viY$vi_$vil$vi{$vi!W$vi!f$vi!g$vi!i$vi!m$vi#h$vi#i$vi#j$vi#k$vi#l$vi#m$vi#n$vi#o$vi#p$vi#r$vi#t$vi#v$vi#w$vi'm$vi(T$vi(d$vi!h$vi!T$vi'k$vi#Y$vip$vi!Y$vi%b$vi!b$vi~P#,gOe'Qa!W'Qa~P!0kO!W'Ra!h'Ra~P!7zO!W.bO!h(_i~O#z#]i!W#]i!X#]i~P#CQOP$]Oz#yO{#zO}#{O!g#wO!i#xO!m$]O(TVOY#gil#gi!f#gi#i#gi#j#gi#k#gi#l#gi#m#gi#n#gi#o#gi#p#gi#r#gi#t#gi#v#gi#w#gi#z#gi(d#gi(k#gi(l#gi!W#gi!X#gi~O#h#gi~P%2}O#h9zO~P%2}OP$]Oz#yO{#zO}#{O!g#wO!i#xO!m$]O#h9zO#i9{O#j9{O#k9{O(TVOY#gi!f#gi#l#gi#m#gi#n#gi#o#gi#p#gi#r#gi#t#gi#v#gi#w#gi#z#gi(d#gi(k#gi(l#gi!W#gi!X#gi~Ol#gi~P%5YOl9|O~P%5YOP$]Ol9|Oz#yO{#zO}#{O!g#wO!i#xO!m$]O#h9zO#i9{O#j9{O#k9{O#l9}O(TVO#r#gi#t#gi#v#gi#w#gi#z#gi(d#gi(k#gi(l#gi!W#gi!X#gi~OY#gi!f#gi#m#gi#n#gi#o#gi#p#gi~P%7eOY:YO!f:OO#m:OO#n:OO#o:XO#p:OO~P%7eOP$]OY:YOl9|Oz#yO{#zO}#{O!f:OO!g#wO!i#xO!m$]O#h9zO#i9{O#j9{O#k9{O#l9}O#m:OO#n:OO#o:XO#p:OO#r:PO(TVO#t#gi#v#gi#w#gi#z#gi(d#gi(l#gi!W#gi!X#gi~O(k#gi~P%:PO(k#|O~P%:POP$]OY:YOl9|Oz#yO{#zO}#{O!f:OO!g#wO!i#xO!m$]O#h9zO#i9{O#j9{O#k9{O#l9}O#m:OO#n:OO#o:XO#p:OO#r:PO#t:RO(TVO(k#|O#v#gi#w#gi#z#gi(d#gi!W#gi!X#gi~O(l#gi~P%<[O(l#}O~P%<[OP$]OY:YOl9|Oz#yO{#zO}#{O!f:OO!g#wO!i#xO!m$]O#h9zO#i9{O#j9{O#k9{O#l9}O#m:OO#n:OO#o:XO#p:OO#r:PO#t:RO#v:TO(TVO(k#|O(l#}O~O#w#gi#z#gi(d#gi!W#gi!X#gi~P%>gO_#xy!W#xy'm#xy'k#xy!T#xy!h#xyp#xy!Y#xy%b#xy!b#xy~P!7zOh;mOz)vO})wO(k)yO(l){O~OP#giY#gil#gi{#gi!f#gi!g#gi!i#gi!m#gi#h#gi#i#gi#j#gi#k#gi#l#gi#m#gi#n#gi#o#gi#p#gi#r#gi#t#gi#v#gi#w#gi#z#gi(T#gi(d#gi!W#gi!X#gi~P%A_O!g#wOP(SXY(SXh(SXl(SXz(SX{(SX}(SX!f(SX!i(SX!m(SX#h(SX#i(SX#j(SX#k(SX#l(SX#m(SX#n(SX#o(SX#p(SX#r(SX#t(SX#v(SX#w(SX#z(SX(T(SX(d(SX(k(SX(l(SX!W(SX!X(SX~O#z#{i!W#{i!X#{i~P#CQO#z!oi!X!oi~P$$nO!X6`O~O!W'[a!X'[a~P#CQO!b#uO(d'gO!W']a!h']a~O!W/VO!h(qi~O!W/VO!b#uO!h(qi~Oe$vq!W$vq#Y$vq#z$vq~P!0kO!T'_a!W'_a~P#,gO!b6gO~O!W/_O!T(ri~P#,gO!W/_O!T(ri~O!T6kO~O!b#uO#p6pO~Ol6qO!b#uO(d'gO~O!T6sO~Oe$xq!W$xq#Y$xq#z$xq~P!0kO_$jy!W$jy'm$jy'k$jy!T$jy!h$jyp$jy!Y$jy%b$jy!b$jy~P!7zO!b5kO~O!W4WO!Y(sa~O_#]y!W#]y'm#]y'k#]y!T#]y!h#]yp#]y!Y#]y%b#]y!b#]y~P!7zOY6xO~O!W0bO!X(zi~O^7OO~O(W(tO!W'dX!X'dX~O!W4nO!X(wa~OjkO'v7VO~P.iO!X7YO~P%$nOm!nO}7ZO'xTO'{UO(W!mO(c!sO~O!Y0zO~O!Y0zO%b7]O~Oh7`O!Y0zO%b7]O~OY7eO!W'ga!X'ga~O!W1VO!X(xi~O!h7iO~O!h7jO~O!h7mO~O!h7mO~P%[O_7oO~O!b7pO~O!h7qO~O!W(ii!X(ii~P#CQO_%gO#Y7yO'm%gO~O!W(fy!h(fy_(fy'm(fy~P!7zO!W(`O!h(ey~O!Y'VO%b7|O~O#e$vqP$vqY$vq_$vql$vq{$vq!W$vq!f$vq!g$vq!i$vq!m$vq#h$vq#i$vq#j$vq#k$vq#l$vq#m$vq#n$vq#o$vq#p$vq#r$vq#t$vq#v$vq#w$vq'm$vq(T$vq(d$vq!h$vq!T$vq'k$vq#Y$vqp$vq!Y$vq%b$vq!b$vq~P#,gO#e$xqP$xqY$xq_$xql$xq{$xq!W$xq!f$xq!g$xq!i$xq!m$xq#h$xq#i$xq#j$xq#k$xq#l$xq#m$xq#n$xq#o$xq#p$xq#r$xq#t$xq#v$xq#w$xq'm$xq(T$xq(d$xq!h$xq!T$xq'k$xq#Y$xqp$xq!Y$xq%b$xq!b$xq~P#,gO!W'Ri!h'Ri~P!7zO#z#]q!W#]q!X#]q~P#CQOz/yO{/yO}/zOPwaYwahwalwa!fwa!gwa!iwa!mwa#hwa#iwa#jwa#kwa#lwa#mwa#nwa#owa#pwa#rwa#twa#vwa#wwa#zwa(Twa(dwa(kwa(lwa!Wwa!Xwa~Oz)vO})wOP$maY$mah$mal$ma{$ma!f$ma!g$ma!i$ma!m$ma#h$ma#i$ma#j$ma#k$ma#l$ma#m$ma#n$ma#o$ma#p$ma#r$ma#t$ma#v$ma#w$ma#z$ma(T$ma(d$ma(k$ma(l$ma!W$ma!X$ma~Oz)vO})wOP$oaY$oah$oal$oa{$oa!f$oa!g$oa!i$oa!m$oa#h$oa#i$oa#j$oa#k$oa#l$oa#m$oa#n$oa#o$oa#p$oa#r$oa#t$oa#v$oa#w$oa#z$oa(T$oa(d$oa(k$oa(l$oa!W$oa!X$oa~OP$}aY$}al$}a{$}a!f$}a!g$}a!i$}a!m$}a#h$}a#i$}a#j$}a#k$}a#l$}a#m$}a#n$}a#o$}a#p$}a#r$}a#t$}a#v$}a#w$}a#z$}a(T$}a(d$}a!W$}a!X$}a~P%A_O#z$iq!W$iq!X$iq~P#CQO#z$jq!W$jq!X$jq~P#CQO!X8WO~O#z8XO~P!0kO!b#uO!W']i!h']i~O!b#uO(d'gO!W']i!h']i~O!W/VO!h(qq~O!T'_i!W'_i~P#,gO!W/_O!T(rq~O!T8_O~P#,gO!T8_O~Oe(Ry!W(Ry~P!0kO!W'ba!Y'ba~P#,gO_%Uq!Y%Uq'm%Uq!W%Uq~P#,gOY8dO~O!W0bO!X(zq~O#Y8hO!W'da!X'da~O!W4nO!X(wi~P#CQOPZXYZXlZXzZX{ZX}ZX!TZX!WZX!fZX!gZX!iZX!mZX#YZX#edX#hZX#iZX#jZX#kZX#lZX#mZX#nZX#oZX#pZX#rZX#tZX#vZX#wZX#|ZX(TZX(dZX(kZX(lZX~O!b%SX#p%SX~P&2_O!Y0zO%b8lO~O'xTO'{UO(W8qO~O!W1VO!X(xq~O!h8tO~O!h8uO~O!h8vO~O!h8vO~P%[O#Y8yO!W#by!X#by~O!W#by!X#by~P#CQO!Y'VO%b9OO~O#z#xy!W#xy!X#xy~P#CQOP$viY$vil$vi{$vi!f$vi!g$vi!i$vi!m$vi#h$vi#i$vi#j$vi#k$vi#l$vi#m$vi#n$vi#o$vi#p$vi#r$vi#t$vi#v$vi#w$vi#z$vi(T$vi(d$vi!W$vi!X$vi~P%A_Oz)vO})wO(l){OP%YiY%Yih%Yil%Yi{%Yi!f%Yi!g%Yi!i%Yi!m%Yi#h%Yi#i%Yi#j%Yi#k%Yi#l%Yi#m%Yi#n%Yi#o%Yi#p%Yi#r%Yi#t%Yi#v%Yi#w%Yi#z%Yi(T%Yi(d%Yi(k%Yi!W%Yi!X%Yi~Oz)vO})wOP%[iY%[ih%[il%[i{%[i!f%[i!g%[i!i%[i!m%[i#h%[i#i%[i#j%[i#k%[i#l%[i#m%[i#n%[i#o%[i#p%[i#r%[i#t%[i#v%[i#w%[i#z%[i(T%[i(d%[i(k%[i(l%[i!W%[i!X%[i~O#z$jy!W$jy!X$jy~P#CQO#z#]y!W#]y!X#]y~P#CQO!b#uO!W']q!h']q~O!W/VO!h(qy~O!T'_q!W'_q~P#,gO!T9VO~P#,gO!W0bO!X(zy~O!W4nO!X(wq~O!Y0zO%b9^O~O!h9aO~O!Y'VO%b9fO~OP$vqY$vql$vq{$vq!f$vq!g$vq!i$vq!m$vq#h$vq#i$vq#j$vq#k$vq#l$vq#m$vq#n$vq#o$vq#p$vq#r$vq#t$vq#v$vq#w$vq#z$vq(T$vq(d$vq!W$vq!X$vq~P%A_OP$xqY$xql$xq{$xq!f$xq!g$xq!i$xq!m$xq#h$xq#i$xq#j$xq#k$xq#l$xq#m$xq#n$xq#o$xq#p$xq#r$xq#t$xq#v$xq#w$xq#z$xq(T$xq(d$xq!W$xq!X$xq~P%A_Oe%^!Z!W%^!Z#Y%^!Z#z%^!Z~P!0kO!W'dq!X'dq~P#CQO!W#b!Z!X#b!Z~P#CQO#e%^!ZP%^!ZY%^!Z_%^!Zl%^!Z{%^!Z!W%^!Z!f%^!Z!g%^!Z!i%^!Z!m%^!Z#h%^!Z#i%^!Z#j%^!Z#k%^!Z#l%^!Z#m%^!Z#n%^!Z#o%^!Z#p%^!Z#r%^!Z#t%^!Z#v%^!Z#w%^!Z'm%^!Z(T%^!Z(d%^!Z!h%^!Z!T%^!Z'k%^!Z#Y%^!Zp%^!Z!Y%^!Z%b%^!Z!b%^!Z~P#,gOP%^!ZY%^!Zl%^!Z{%^!Z!f%^!Z!g%^!Z!i%^!Z!m%^!Z#h%^!Z#i%^!Z#j%^!Z#k%^!Z#l%^!Z#m%^!Z#n%^!Z#o%^!Z#p%^!Z#r%^!Z#t%^!Z#v%^!Z#w%^!Z#z%^!Z(T%^!Z(d%^!Z!W%^!Z!X%^!Z~P%A_Op(XX~P1qO'w!lO~P!*SO!TdX!WdX#YdX~P&2_OPZXYZXlZXzZX{ZX}ZX!WZX!WdX!fZX!gZX!iZX!mZX#YZX#YdX#edX#hZX#iZX#jZX#kZX#lZX#mZX#nZX#oZX#pZX#rZX#tZX#vZX#wZX#|ZX(TZX(dZX(kZX(lZX~O!bdX!hZX!hdX(ddX~P&GuOP9qOQ9qOb;bOc!iOjkOl9qOmkOnkOtkOv9qOx9qO}WO!RkO!SkO!YXO!d9tO!iZO!l9qO!m9qO!n9qO!p9uO!r9xO!u!hO$R!kO$VfO'v)UO'xTO'{UO(TVO(c[O(p;`O~O!W:VO!X$la~Oj%SOl$tOm$sOn$sOt%TOv%UOx:]O}${O!Y$|O!d;gO!i$xO#d:cO$R%YO$n:_O$p:aO$s%ZO'v(lO'xTO'{UO(P%RO(T$uO~O#q)]O~P&LkO!XZX!XdX~P&GuO#e9yO~O!b#uO#e9yO~O#Y:ZO~O#p:OO~O#Y:eO!W(iX!X(iX~O#Y:ZO!W(gX!X(gX~O#e:fO~Oe:hO~P!0kO#e:mO~O#e:nO~O!b#uO#e:oO~O!b#uO#e:fO~O#z:pO~P#CQO#e:qO~O#e:rO~O#e:sO~O#e:tO~O#e:uO~O#e:vO~O#z:wO~P!0kO#z:xO~P!0kO$V~!g!}#O#Q#R#U#c#d#o(p$n$p$s%V%a%b%c%j%l%o%p%r%t~'qR$V(p#i!S'o'w#jm#h#klz'p(W'p'v$X$Z$X~",goto:"$'R)OPPPP)PPP)SP)eP*t.xPPPP5YPP5pP;l>sP?WP?WPPP?WP@xP?WP?WP?WP@|PPARPAlPFdPPPFhPPPPFhIiPPPIoJjPFhPLxPPPP! WFhPPPFhPFhP!#fFhP!&z!'|!(VP!(y!(}!(yPPPPP!,Y!'|PP!,v!-pP!0dFhFh!0i!3s!8Y!8Y!wP#@W#@_#@gPPPP#Du#Gl#NT#NW#NZ$ S$ V$ Y$ a$ iPP$ o$ s$!k$#j$#n$$SPP$$W$$^$$bP$$e$$i$$l$%b$%y$&b$&f$&i$&l$&r$&u$&y$&}R!{RoqOXst!Z#c%f&i&k&l&n,b,g1g1jY!uQ'V-S0z4uQ%lvQ%tyQ%{|Q&a!VS&}!e,zQ']!iS'c!r!xS*_$|*dQ+`%uQ+m%}Q,R&ZQ-Q'UQ-['^Q-d'dQ/p*fQ1U,SR:d9u%OdOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&i&k&l&n&r&z'X'i'y'{(R(Y(n(r(v)u*x*|,_,b,g-W-`-n-t.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2w4r4|5^5_5b5u7Z7`7o7yS#p]9r!r)W$[$m'O)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cQ*o%VQ+e%wQ,T&^Q,[&fQ.X:[Q0W+WQ0[+YQ0g+fQ1^,YQ2k.UQ4`0bQ5T1VQ6R2oQ6X:]Q6z4aR8P6S&|kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;ct!nQ!r!u!x!y&}'U'V'c'd'e,z-Q-S-d0z4u4w$^$si#u#w$c$d$x${%W%X%])q)w)z)|)}*U*[*j*k+V+Y+q+t.T._/P/^/_/a/|0q0t0|2n3f3p3x4O4W4Y4{6P6g6p7]7|8X8l9O9^9f:X:Y:^:_:`:a:b:c:i:j:k:l:m:n:q:r:s:t:w:x;`;h;i;l;mQ&O|Q&{!eS'R%b,}Q+e%wQ/{*sQ0g+fQ0l+lQ1],XQ1^,YQ4`0bQ4i0nQ5W1XQ5X1[Q6z4aQ6}4fQ7h5ZQ8g7OR8r7ernOXst!V!Z#c%f&`&i&k&l&n,b,g1g1jR,V&b&v^OPXYstuvwz!Z!`!g!j!o#R#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%f%l%y&b&e&f&i&k&l&n&r&z'X'i'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;b;c[#[WZ#V#Y'O'y!S%cm#g#h#k%^%a(S(^(_(`*z*{*},^,t-r-x-y-z-|1o2g2h5k5|Q%oxQ%syS%x|%}Q&U!TQ'Y!hQ'[!iQ(g#rS*R$x*VS+_%t%uQ+c%wQ+|&XQ,Q&ZS-Z']'^Q.W(hQ/Z*SQ0`+`Q0f+fQ0h+gQ0k+kQ1P+}S1T,R,SQ2X-[Q3g/VQ4_0bQ4c0eQ4h0mQ5S1UQ6d3hQ6y4aQ6|4eQ8c6xR9X8dv$zi#w%W%X%])z)|*U*j*k._/^/|3f4O8X;`;h;i!S%qy!i!t%s%t%u&|'[']'^'b'l*^+_+`,w-Z-[-c/h0`2Q2X2`3zQ+X%oQ+r&RQ+u&SQ,P&ZQ.V(gQ1O+|U1S,Q,R,SQ2p.WQ4}1PS5R1T1UQ7d5S#O;d#u$c$d$x${)q)w)}*[+V+Y+q+t.T/P/_/a0q0t0|2n3p3x4W4Y4{6P6g6p7]7|8l9O9^9f:^:`:b:i:k:m:q:s:w;l;mg;e:X:Y:_:a:c:j:l:n:r:t:xW%Pi%R*l;`S&R!Q&`Q&S!RQ&T!SR+p&P$_%Oi#u#w$c$d$x${%W%X%])q)w)z)|)}*U*[*j*k+V+Y+q+t.T._/P/^/_/a/|0q0t0|2n3f3p3x4O4W4Y4{6P6g6p7]7|8X8l9O9^9f:X:Y:^:_:`:a:b:c:i:j:k:l:m:n:q:r:s:t:w:x;`;h;i;l;mT)r$u)sV*p%V:[:]U'R!e%b,}S(u#y#zQ+j%zS.P(c(dQ0u+vQ4P/yR7S4n&|kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;c$i$`c#X#d%j%k%m'x(O(j(q(y(z({(|(})O)P)Q)R)S)T)V)Y)^)h+T+i,x-g-l-q-s.^.d.h.j.k.l.{/}1v1y2Z2b2v2{2|2}3O3P3Q3R3S3T3U3V3W3X3[3]3b4T4]5n5t5y6V6W6]6^7U7s7w8Q8U8V8{9Z9b9s;VT#SV#T&}kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cQ'P!eR1|,zv!nQ!e!r!u!x!y&}'U'V'c'd'e,z-Q-S-d0z4u4wS*^$|*dS/h*_*fQ/q*gQ0w+xQ3z/pR3}/snqOXst!Z#c%f&i&k&l&n,b,g1g1jQ&p!^Q'm!wS(i#t9yQ+]%rQ+z&UQ+{&WQ-X'ZQ-f'fS.](n:fS0O*x:oQ0^+^Q0y+yQ1n,iQ1p,jQ1x,uQ2V-YQ2Y-^S4U0P:uQ4Z0_S4^0a:vQ5m1zQ5q2WQ5v2_Q6w4[Q7t5oQ7u5rQ7x5wR8x7q$d$_c#X#d%k%m'x(O(j(q(y(z({(|(})O)P)Q)R)S)T)V)Y)^)h+T+i,x-g-l-q-s.^.d.h.k.l.{/}1v1y2Z2b2v2{2|2}3O3P3Q3R3S3T3U3V3W3X3[3]3b4T4]5n5t5y6V6W6]6^7U7s7w8Q8U8V8{9Z9b9s;VS(f#o'`U*i$}(m3ZS+S%j.jQ2l0WQ6O2kQ8O6RR9P8P$d$^c#X#d%k%m'x(O(j(q(y(z({(|(})O)P)Q)R)S)T)V)Y)^)h+T+i,x-g-l-q-s.^.d.h.k.l.{/}1v1y2Z2b2v2{2|2}3O3P3Q3R3S3T3U3V3W3X3[3]3b4T4]5n5t5y6V6W6]6^7U7s7w8Q8U8V8{9Z9b9s;VS(e#o'`S(w#z$_S+R%j.jS.Q(d(fQ.m)XQ0T+SR2i.R&|kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cS#p]9rQ&k!XQ&l!YQ&n![Q&o!]R1f,eQ'W!hQ+U%oQ-V'YS.S(g+XQ2T-UW2m.V.W0V0XQ5p2UU5}2j2l2pS7{6O6QS8}7}8OS9d8|9PQ9l9eR9o9mU!vQ'V-ST4s0z4u!Q_OXZ`st!V!Z#c#g%^%f&`&b&i&k&l&n(`,b,g-y1g1j]!pQ!r'V-S0z4uT#p]9r%Y{OPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&f&i&k&l&n&r&z'X'i'y'{(R(Y(n(r(v)u*x*|+W,_,b,g-W-`-n-t.U.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2o2w4r4|5^5_5b5u6S7Z7`7o7yS(u#y#zS.P(c(d!s:|$[$m'O)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cY!tQ'V-S0z4uQ'b!rS'l!u!xS'n!y4wS-c'c'dQ-e'eR2`-dQ'k!tS([#f1aS-b'b'nQ/Y*RQ/f*^Q2a-eQ3l/ZS3u/g/qQ6c3gS6n3{3}Q8Z6dR8b6qQ#vbQ'j!tS(Z#f1aS(]#l*wQ*y%_Q+Z%pQ+a%vU-a'b'k'nQ-u([Q/X*RQ/e*^Q/k*aQ0]+[Q1Q,OS2^-b-eQ2f-}S3k/Y/ZS3t/f/qQ3w/jQ3y/lQ5P1RQ5x2aQ6b3gQ6f3lS6j3u3}Q6o3|Q7b5QS8Y6c6dQ8^6kQ8`6nQ8o7cQ9T8ZQ9U8_Q9W8bQ9`8pQ9h9VQ;P:zQ;[;TR;];UV!vQ'V-S%YaOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&f&i&k&l&n&r&z'X'i'y'{(R(Y(n(r(v)u*x*|+W,_,b,g-W-`-n-t.U.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2o2w4r4|5^5_5b5u6S7Z7`7o7yS#vz!j!r:y$[$m'O)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cR;P;b%YbOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&f&i&k&l&n&r&z'X'i'y'{(R(Y(n(r(v)u*x*|+W,_,b,g-W-`-n-t.U.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2o2w4r4|5^5_5b5u6S7Z7`7o7yQ%_j!S%py!i!t%s%t%u&|'[']'^'b'l*^+_+`,w-Z-[-c/h0`2Q2X2`3zS%vz!jQ+[%qQ,O&ZW1R,P,Q,R,SU5Q1S1T1US7c5R5SQ8p7d!r:z$[$m'O)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cQ;T;aR;U;b$|eOPXYstuvw!Z!`!g!o#R#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&i&k&l&n&r&z'X'i'{(R(Y(n(r(v)u*x*|+W,_,b,g-W-`-n-t.U.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2o2w4r4|5^5_5b5u6S7Z7`7o7yY#aWZ#V#Y'y!S%cm#g#h#k%^%a(S(^(_(`*z*{*},^,t-r-x-y-z-|1o2g2h5k5|Q,]&f!p:{$[$m)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cR;O'OS'S!e%bR2O,}%OdOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&i&k&l&n&r&z'X'i'y'{(R(Y(n(r(v)u*x*|,_,b,g-W-`-n-t.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2w4r4|5^5_5b5u7Z7`7o7y!r)W$[$m'O)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cQ,[&fQ0W+WQ2k.UQ6R2oR8P6S!f$Uc#X%j'x(O(j(q)Q)R)S)T)Y)^+i-g-l-q-s.^.d.{/}2Z2b2v3X4T4]5t5y6V7w8{9s!T:Q)V)h,x.j1v1y2{3T3U3V3W3[3b5n6W6]6^7U7s8Q8U8V9Z9b;V!b$Wc#X%j'x(O(j(q)S)T)Y)^+i-g-l-q-s.^.d.{/}2Z2b2v3X4T4]5t5y6V7w8{9s!P:S)V)h,x.j1v1y2{3V3W3[3b5n6W6]6^7U7s8Q8U8V9Z9b;V!^$[c#X%j'x(O(j(q)Y)^+i-g-l-q-s.^.d.{/}2Z2b2v3X4T4]5t5y6V7w8{9sQ3f/Tz;c)V)h,x.j1v1y2{3[3b5n6W6]6^7U7s8Q8U8V9Z9b;VQ;h;jR;i;k&|kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cS$nh$oR3_.p'TgOPWXYZhstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m$o%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.p.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cT$jf$pQ$hfS)a$k)eR)m$pT$if$pT)c$k)e'ThOPWXYZhstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m$o%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.p.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cT$nh$oQ$qhR)l$o%YjOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&f&i&k&l&n&r&z'X'i'y'{(R(Y(n(r(v)u*x*|+W,_,b,g-W-`-n-t.U.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2o2w4r4|5^5_5b5u6S7Z7`7o7y!s;a$[$m'O)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;c#clOPXZst!Z!`!o#R#c#n#{$m%f&b&e&f&i&k&l&n&r&z'X(v)j*|+W,_,b,g-W.U.q/z0}1_1`1b1d1g1j1l2o3^4r4|5^5_5b6S7Z7`7ov$}i#w%W%X%])z)|*U*j*k._/^/|3f4O8X;`;h;i#O(m#u$c$d$x${)q)w)}*[+V+Y+q+t.T/P/_/a0q0t0|2n3p3x4W4Y4{6P6g6p7]7|8l9O9^9f:^:`:b:i:k:m:q:s:w;l;mQ*t%ZQ.|)vg3Z:X:Y:_:a:c:j:l:n:r:t:xv$yi#w%W%X%])z)|*U*j*k._/^/|3f4O8X;`;h;iQ*W$zS*a$|*dQ*u%[Q/l*b#O;R#u$c$d$x${)q)w)}*[+V+Y+q+t.T/P/_/a0q0t0|2n3p3x4W4Y4{6P6g6p7]7|8l9O9^9f:^:`:b:i:k:m:q:s:w;l;mf;S:X:Y:_:a:c:j:l:n:r:t:xQ;W;dQ;X;eQ;Y;fR;Z;gv$}i#w%W%X%])z)|*U*j*k._/^/|3f4O8X;`;h;i#O(m#u$c$d$x${)q)w)}*[+V+Y+q+t.T/P/_/a0q0t0|2n3p3x4W4Y4{6P6g6p7]7|8l9O9^9f:^:`:b:i:k:m:q:s:w;l;mg3Z:X:Y:_:a:c:j:l:n:r:t:xnoOXst!Z#c%f&i&k&l&n,b,g1g1jQ*Z${Q,p&uQ,q&wR3o/_$^%Oi#u#w$c$d$x${%W%X%])q)w)z)|)}*U*[*j*k+V+Y+q+t.T._/P/^/_/a/|0q0t0|2n3f3p3x4O4W4Y4{6P6g6p7]7|8X8l9O9^9f:X:Y:^:_:`:a:b:c:i:j:k:l:m:n:q:r:s:t:w:x;`;h;i;l;mQ+s&SQ0s+uQ4l0rR7R4mT*c$|*dS*c$|*dT4t0z4uS/j*`4rT3|/r7ZQ+Z%pQ/k*aQ0]+[Q1Q,OQ5P1RQ7b5QQ8o7cR9`8pn)z$v(o*v/]/t/u2t3m4S6a6r9S;Q;^;_!Y:i(k)[*Q*Y.[.x.}/T/b0U0p0r2s3n3r4k4m6T6U6h6l6t6v8]8a9g;j;k]:j3Y6[8R9Q9R9pp)|$v(o*v/R/]/t/u2t3m4S6a6r9S;Q;^;_![:k(k)[*Q*Y.[.x.}/T/b0U0p0r2q2s3n3r4k4m6T6U6h6l6t6v8]8a9g;j;k_:l3Y6[8R8S9Q9R9prnOXst!V!Z#c%f&`&i&k&l&n,b,g1g1jQ&]!UR,_&frnOXst!V!Z#c%f&`&i&k&l&n,b,g1g1jR&]!UQ+w&TR0o+psnOXst!V!Z#c%f&`&i&k&l&n,b,g1g1jQ0{+|S4z1O1PU7[4x4y4}S8k7^7_S9[8j8mQ9i9]R9n9jQ&d!VR,W&`R5W1XS%x|%}R0h+gQ&i!WR,b&jR,h&oT1h,g1jR,l&pQ,k&pR1q,lQ'p!zR-h'pSsOtQ#cXT%is#cQ!}TR'r!}Q#QUR't#QQ)s$uR.y)sQ#TVR'v#TQ#WWU'|#W'}-oQ'}#XR-o(OQ,{'PR1},{Q.`(oR2u.`Q.c(qS2x.c2yR2y.dQ-S'VR2R-SY!rQ'V-S0z4uR'a!rS#^W%aU(T#^(U-pQ(U#_R-p(PQ-O'SR2P-Ot`OXst!V!Z#c%f&`&b&i&k&l&n,b,g1g1jS#gZ%^U#q`#g-yR-y(`Q(a#iQ-v(]W.O(a-v2d5zQ2d-wR5z2eQ)e$kR.r)eQ$ohR)k$oQ$bcU)Z$b-k:WQ-k9sR:W)hQ/W*RW3i/W3j6e8[U3j/X/Y/ZS6e3k3lR8[6f#o)x$v(k(o)[*Q*Y*q*r*v.Y.Z.[.x.}/R/S/T/]/b/t/u0U0p0r2q2r2s2t3Y3m3n3r4S4k4m6T6U6Y6Z6[6a6h6l6r6t6v8R8S8T8]8a9Q9R9S9g9p;Q;^;_;j;kQ/`*YU3q/`3s6iQ3s/bR6i3rQ*d$|R/n*dQ*m%QR/w*mQ4X0UR6u4XQ+O%dR0S+OQ4o0uS7T4o8iR8i7UQ+y&UR0x+yQ4u0zR7X4uQ1W,TS5U1W7fR7f5WQ0c+cW4b0c4d6{8eQ4d0fQ6{4cR8e6|Q+h%xR0i+hQ1j,gR5f1jYrOXst#cQ&m!ZQ+Q%fQ,a&iQ,c&kQ,d&lQ,f&nQ1e,bS1h,g1jR5e1gQ%hpQ&q!_Q&t!aQ&v!bQ&x!cQ'h!tQ+P%eQ+]%rQ+o&OQ,V&dQ,n&sW-_'b'j'k'nQ-f'fQ/m*cQ0^+^S1Z,W,ZQ1r,mQ1s,pQ1t,qQ2Y-^W2[-a-b-e-gQ4Z0_Q4g0lQ4j0pQ5O1QQ5Y1]Q5d1fU5s2Z2^2aQ5v2_Q6w4[Q7P4iQ7Q4kQ7W4tQ7a5PQ7g5XS7v5t5xQ7x5wQ8f6}Q8n7bQ8s7hQ8z7wQ9Y8gQ9_8oQ9c8{R9k9`Q%ryQ'Z!iQ'f!tU+^%s%t%uQ,u&|U-Y'[']'^S-^'b'lQ/d*^S0_+_+`Q1z,wS2W-Z-[Q2_-cQ3v/hQ4[0`Q5o2QQ5r2XQ5w2`R6m3zS$wi;`R*n%RU%Qi%R;`R/v*lQ$viS(k#u+YQ(o#wS)[$c$dQ*Q$xQ*Y${Q*q%WQ*r%XQ*v%]Q.Y:^Q.Z:`Q.[:bQ.x)qS.})w/PQ/R)zQ/S)|Q/T)}Q/]*UQ/b*[Q/t*jQ/u*kh0U+V.T0|2n4{6P7]7|8l9O9^9fQ0p+qQ0r+tQ2q:iQ2r:kQ2s:mQ2t._S3Y:X:YQ3m/^Q3n/_Q3r/aQ4S/|Q4k0qQ4m0tQ6T:qQ6U:sQ6Y:_Q6Z:aQ6[:cQ6a3fQ6h3pQ6l3xQ6r4OQ6t4WQ6v4YQ8R:nQ8S:jQ8T:lQ8]6gQ8a6pQ9Q:rQ9R:tQ9S8XQ9g:wQ9p:xQ;Q;`Q;^;hQ;_;iQ;j;lR;k;mnpOXst!Z#c%f&i&k&l&n,b,g1g1jQ!fPS#eZ#nQ&s!`U'_!o4r7ZQ'u#RQ(x#{Q)i$mS,Z&b&eQ,`&fQ,m&rQ,r&zQ-U'XQ.f(vQ.v)jQ0Q*|Q0X+WQ1c,_Q2U-WQ2l.UQ3a.qQ4Q/zQ4y0}Q5[1_Q5]1`Q5a1bQ5c1dQ5h1lQ6O2oQ6_3^Q7_4|Q7k5^Q7l5_Q7n5bQ8O6SQ8m7`R8w7o#WcOPXZst!Z!`!o#c#n#{%f&b&e&f&i&k&l&n&r&z'X(v*|+W,_,b,g-W.U/z0}1_1`1b1d1g1j1l2o4r4|5^5_5b6S7Z7`7oQ#XWQ#dYQ%juQ%kvS%mw!gS'x#V'{Q(O#YQ(j#tQ(q#xQ(y$OQ(z$PQ({$QQ(|$RQ(}$SQ)O$TQ)P$UQ)Q$VQ)R$WQ)S$XQ)T$YQ)V$[Q)Y$aQ)^$eW)h$m)j.q3^Q+T%lQ+i%yS,x'O1{Q-g'iS-l'y-nQ-q(RQ-s(YQ.^(nQ.d(rQ.h9qQ.j9tQ.k9uQ.l9xQ.{)uQ/}*xQ1v,sQ1y,vQ2Z-`Q2b-tQ2v.bQ2{9yQ2|9zQ2}9{Q3O9|Q3P9}Q3Q:OQ3R:PQ3S:QQ3T:RQ3U:SQ3V:TQ3W:UQ3X.iQ3[:ZQ3]:dQ3b:VQ4T0PQ4]0aQ5n:eQ5t2]Q5y2cQ6V2wQ6W:fQ6]:hQ6^:oQ7U4pQ7s5lQ7w5uQ8Q:pQ8U:uQ8V:vQ8{7yQ9Z8hQ9b8yQ9s#RR;V;cR#ZWR'Q!eY!tQ'V-S0z4uS&|!e,zQ'b!rS'l!u!xS'n!y4wS,w&}'US-c'c'dQ-e'eQ2Q-QR2`-dR(p#wR(s#xQ!fQT-R'V-S]!qQ!r'V-S0z4uQ#o]R'`9rT#jZ%^S#iZ%^S%dm,^U(]#g#h#kS-w(^(_Q-{(`Q0R*}Q2e-xU2f-y-z-|S5{2g2hR7z5|`#]W#V#Y%a'y(S*z-rr#fZm#g#h#k%^(^(_(`*}-x-y-z-|2g2h5|Q1a,^Q1w,tQ5j1oQ7r5kT:}'O*{T#`W%aS#_W%aS'z#V(SS(P#Y*zS,y'O*{T-m'y-rT'T!e%bQ$kfR)o$pT)d$k)eR3`.pT*T$x*VR*]${Q0V+VQ2j.TQ4x0|Q6Q2nQ7^4{Q7}6PQ8j7]Q8|7|Q9]8lQ9e9OQ9j9^R9m9fnqOXst!Z#c%f&i&k&l&n,b,g1g1jQ&c!VR,V&`tmOXst!U!V!Z#c%f&`&i&k&l&n,b,g1g1jR,^&fT%em,^R0v+vR,U&^Q%||R+n%}R+d%wT&g!W&jT&h!W&jT1i,g1j",nodeNames:"⚠ ArithOp ArithOp LineComment BlockComment Script Hashbang ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:367,context:m2,nodeProps:[["group",-26,7,15,17,63,200,204,208,209,211,214,217,227,229,235,237,239,241,244,250,256,258,260,262,264,266,267,"Statement",-32,11,12,26,29,30,36,46,49,50,52,57,65,73,77,79,81,82,104,105,114,115,132,135,137,138,139,140,142,143,163,164,166,"Expression",-23,25,27,31,35,37,39,167,169,171,172,174,175,176,178,179,180,182,183,184,194,196,198,199,"Type",-3,85,97,103,"ClassItem"],["openedBy",32,"InterpolationStart",51,"[",55,"{",70,"(",144,"JSXStartTag",156,"JSXStartTag JSXStartCloseTag"],["closedBy",34,"InterpolationEnd",45,"]",56,"}",71,")",145,"JSXSelfCloseEndTag JSXEndTag",161,"JSXEndTag"]],propSources:[O2],skippedNodes:[0,3,4,270],repeatNodeCount:33,tokenData:"$Fl(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#8g!R![#:v![!]#Gv!]!^#IS!^!_#J^!_!`#Nu!`!a$#a!a!b$(n!b!c$,m!c!}Er!}#O$-w#O#P$/R#P#Q$4j#Q#R$5t#R#SEr#S#T$7R#T#o$8]#o#p$s#r#s$@P#s$f%Z$f$g+g$g#BYEr#BY#BZ$AZ#BZ$ISEr$IS$I_$AZ$I_$I|Er$I|$I}$Df$I}$JO$Df$JO$JTEr$JT$JU$AZ$JU$KVEr$KV$KW$AZ$KW&FUEr&FU&FV$AZ&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$AZ?HUOEr(n%d_$e&j'yp'|!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$e&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$e&j'|!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU'|!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$e&j'ypOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU'ypOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX'yp'|!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z(CS+rq$e&j'yp'|!b'o(;dOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z(CS.ST'z#S$e&j'p(;dO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c(CS.n_$e&j'yp'|!b'p(;dOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#`/x`$e&j!m$Ip'yp'|!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S1V`#r$Id$e&j'yp'|!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S2d_#r$Id$e&j'yp'|!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$2b3l_'x$(n$e&j'|!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k*r4r_$e&j'|!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k)`5vX$e&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q)`6jT$`#t$e&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c#t6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y#t7bO$`#t#t7eP;=`<%l6y)`7kP;=`<%l5q*r7w]$`#t$e&j'|!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}%W8uZ'|!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p%W9oU$`#t'|!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}%W:UP;=`<%l8p*r:[P;=`<%l4k#%|:hh$e&j'yp'|!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXUS$e&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSUSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWUS'|!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]US$e&j'ypOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWUS'ypOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYUS'yp'|!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%lQ^$e&j!SSOY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@Y!_!}!=y!}#O!Bw#O#P!Dj#P#o!=y#o#p!@Y#p;'S!=y;'S;=`!E[<%lO!=y&n!?Ta$e&j!SSO!^&c!_#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&cS!@_X!SSOY!@YZ!P!@Y!P!Q!@z!Q!}!@Y!}#O!Ac#O#P!Bb#P;'S!@Y;'S;=`!Bq<%lO!@YS!APU!SS#Z#[!@z#]#^!@z#a#b!@z#g#h!@z#i#j!@z#m#n!@zS!AfVOY!AcZ#O!Ac#O#P!A{#P#Q!@Y#Q;'S!Ac;'S;=`!B[<%lO!AcS!BOSOY!AcZ;'S!Ac;'S;=`!B[<%lO!AcS!B_P;=`<%l!AcS!BeSOY!@YZ;'S!@Y;'S;=`!Bq<%lO!@YS!BtP;=`<%l!@Y&n!B|[$e&jOY!BwYZ&cZ!^!Bw!^!_!Ac!_#O!Bw#O#P!Cr#P#Q!=y#Q#o!Bw#o#p!Ac#p;'S!Bw;'S;=`!Dd<%lO!Bw&n!CwX$e&jOY!BwYZ&cZ!^!Bw!^!_!Ac!_#o!Bw#o#p!Ac#p;'S!Bw;'S;=`!Dd<%lO!Bw&n!DgP;=`<%l!Bw&n!DoX$e&jOY!=yYZ&cZ!^!=y!^!_!@Y!_#o!=y#o#p!@Y#p;'S!=y;'S;=`!E[<%lO!=y&n!E_P;=`<%l!=y(Q!Eki$e&j'|!b!SSOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#Z&}#Z#[!Eb#[#]&}#]#^!Eb#^#a&}#a#b!Eb#b#g&}#g#h!Eb#h#i&}#i#j!Eb#j#m&}#m#n!Eb#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!f!GaZ'|!b!SSOY!GYZw!GYwx!@Yx!P!GY!P!Q!HS!Q!}!GY!}#O!Ic#O#P!Bb#P;'S!GY;'S;=`!JZ<%lO!GY!f!HZb'|!b!SSOY'}Zw'}x#O'}#P#Z'}#Z#[!HS#[#]'}#]#^!HS#^#a'}#a#b!HS#b#g'}#g#h!HS#h#i'}#i#j!HS#j#m'}#m#n!HS#n;'S'};'S;=`(f<%lO'}!f!IhX'|!bOY!IcZw!Icwx!Acx#O!Ic#O#P!A{#P#Q!GY#Q;'S!Ic;'S;=`!JT<%lO!Ic!f!JWP;=`<%l!Ic!f!J^P;=`<%l!GY(Q!Jh^$e&j'|!bOY!JaYZ&cZw!Jawx!Bwx!^!Ja!^!_!Ic!_#O!Ja#O#P!Cr#P#Q!Q#V#X%Z#X#Y!4|#Y#b%Z#b#c#Zd$e&j'yp'|!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#?i!R!S#?i!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#?i#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l#?tf$e&j'yp'|!bm$'|OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#?i!R!S#?i!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#?i#S#b%Z#b#c#_2[i]||-1},{term:330,get:i=>x2[i]||-1},{term:68,get:i=>b2[i]||-1}],tokenPrec:12827}),Dy=[Si("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),Si("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),Si("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Si("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Si("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),Si(`try { \${} } catch (\${error}) { \${} @@ -130,19 +130,19 @@ const Ro={Z:"Z",M:"M",L:"L",C:"C",Q:"Q",A:"A",H:"H",V:"V",S:"S",T:"T",z:"Z",m:"m constructor(\${params}) { \${} } -}`,{label:"class",detail:"definition",type:"keyword"}),Si('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Si('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],S2=Dy.concat([Si("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Si("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Si("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),Yp=new ow,Ty=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Es(i){return(t,e)=>{let n=t.node.getChild("VariableDefinition");return n&&e(n,i),!0}}const C2=["FunctionDeclaration"],P2={FunctionDeclaration:Es("function"),ClassDeclaration:Es("class"),ClassExpression:()=>!0,EnumDeclaration:Es("constant"),TypeAliasDeclaration:Es("type"),NamespaceDeclaration:Es("namespace"),VariableDefinition(i,t){i.matchContext(C2)||t(i,"variable")},TypeDefinition(i,t){t(i,"type")},__proto__:null};function Iy(i,t){let e=Yp.get(t);if(e)return e;let n=[],r=!0;function o(s,a){let l=i.sliceString(s.from,s.to);n.push({label:l,type:a})}return t.cursor(He.IncludeAnonymous).iterate(s=>{if(r)r=!1;else if(s.name){let a=P2[s.name];if(a&&a(s,o)||Ty.has(s.name))return!1}else if(s.to-s.from>8192){for(let a of Iy(i,s.node))n.push(a);return!1}}),Yp.set(t,n),n}const Zp=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,My=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function k2(i){let t=Ye(i.state).resolveInner(i.pos,-1);if(My.indexOf(t.name)>-1)return null;let e=t.name=="VariableName"||t.to-t.from<20&&Zp.test(i.state.sliceDoc(t.from,t.to));if(!e&&!i.explicit)return null;let n=[];for(let r=t;r;r=r.parent)Ty.has(r.name)&&(n=n.concat(Iy(i.state.doc,r)));return{options:n,from:e?t.from:i.pos,validFor:Zp}}const Sr=ja.define({name:"javascript",parser:w2.configure({props:[lv.add({IfStatement:Nh({except:/^\s*({|else\b)/}),TryStatement:Nh({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:kw,SwitchBody:i=>{let t=i.textAfter,e=/^\s*\}/.test(t),n=/^\s*(case|default)\b/.test(t);return i.baseIndent+(e?0:n?1:2)*i.unit},Block:Pw({closing:"}"}),ArrowFunction:i=>i.baseIndent+i.unit,"TemplateString BlockComment":()=>null,"Statement Property":Nh({except:/^{/}),JSXElement(i){let t=/^\s*<\//.test(i.textAfter);return i.lineIndent(i.node.from)+(t?0:i.unit)},JSXEscape(i){let t=/\s*\}/.test(i.textAfter);return i.lineIndent(i.node.from)+(t?0:i.unit)},"JSXOpenTag JSXSelfClosingTag"(i){return i.column(i.node.from)+i.unit}}),cv.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Dw,BlockComment(i){return{from:i.from+2,to:i.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),$y={test:i=>/^JSX/.test(i.name),facet:ov({commentTokens:{block:{open:"{/*",close:"*/}"}}})},L2=Sr.configure({dialect:"ts"},"typescript"),A2=Sr.configure({dialect:"jsx",props:[Uc.add(i=>i.isTop?[$y]:void 0)]}),E2=Sr.configure({dialect:"jsx ts",props:[Uc.add(i=>i.isTop?[$y]:void 0)]},"typescript");let Qy=i=>({label:i,type:"keyword"});const Ny="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(Qy),D2=Ny.concat(["declare","implements","private","protected","public"].map(Qy));function T2(i={}){let t=i.jsx?i.typescript?E2:A2:i.typescript?L2:Sr,e=i.typescript?S2.concat(D2):Dy.concat(Ny);return new yw(t,[Sr.data.of({autocomplete:ZC(My,cy(e))}),Sr.data.of({autocomplete:k2}),i.jsx?$2:[]])}function I2(i){for(;;){if(i.name=="JSXOpenTag"||i.name=="JSXSelfClosingTag"||i.name=="JSXFragmentTag")return i;if(i.name=="JSXEscape"||!i.parent)return null;i=i.parent}}function Wp(i,t,e=i.length){for(let n=t==null?void 0:t.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return i.sliceString(n.from,Math.min(n.to,e));return""}const M2=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),$2=Rt.inputHandler.of((i,t,e,n,r)=>{if((M2?i.composing:i.compositionStarted)||i.state.readOnly||t!=e||n!=">"&&n!="/"||!Sr.isActiveAt(i.state,t,-1))return!1;let o=r(),{state:s}=o,a=s.changeByRange(l=>{var u;let{head:c}=l,d=Ye(s).resolveInner(c-1,-1),f;if(d.name=="JSXStartTag"&&(d=d.parent),!(s.doc.sliceString(c-1,c)!=n||d.name=="JSXAttributeValue"&&d.to>c)){if(n==">"&&d.name=="JSXFragmentTag")return{range:l,changes:{from:c,insert:""}};if(n=="/"&&d.name=="JSXStartCloseTag"){let g=d.parent,x=g.parent;if(x&&g.from==c-2&&((f=Wp(s.doc,x.firstChild,c))||((u=x.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let m=`${f}>`;return{range:yt.cursor(c+m.length,-1),changes:{from:c,insert:m}}}}else if(n==">"){let g=I2(d);if(g&&!/^\/?>|^<\//.test(s.doc.sliceString(c,c+2))&&(f=Wp(s.doc,g,c)))return{range:l,changes:{from:c,insert:``}}}}return{range:l}});return a.changes.empty?!1:(i.dispatch([o,s.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function Up(i){let t=new _n;for(let{from:e,to:n}of i.visibleRanges){const r=Ye(i.state),s={from:e,to:n,enter:a=>{if(a.name=="CallExpression"){if(!(i.state.doc.sliceString(a.from,a.from+5)=="path("))return;const u=a.from;a.next(),a.next();const c=Gt.mark({attributes:{"data-path-start":a.from},class:"cm-path-button"});t.add(u,u+4,c)}}};r.iterate(s)}return t.finish()}const Q2=Fe.fromClass(class{constructor(i){this.decorations=Up(i),this.initialized=!1}update(i){(i.docChanged||i.viewportChanged||this.initialized===!1)&&(this.decorations=Up(i.view),this.initialized=!0)}},{decorations:i=>i.decorations});function N2(i){var t=i.Pos;function e(y,w){var C=y.state.vim;if(!C||C.insertMode)return w.head;var L=C.sel.head;if(!L)return w.head;if(!(C.visualBlock&&w.head.line!=L.line))return w.from()==w.anchor&&!w.empty()&&w.head.line==L.line&&w.head.ch!=L.ch?new t(w.head.line,w.head.ch-1):w.head}function n(y,w,C){if(w.line===C.line&&w.ch>=C.ch-1){var L=y.getLine(w.line),I=L.charCodeAt(w.ch);55296<=I&&I<=55551&&(C.ch+=1)}return{start:w,end:C}}var r=[{keys:"",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"g",type:"keyToKey",toKeys:"gk"},{keys:"g",type:"keyToKey",toKeys:"gj"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"",type:"keyToKey",toKeys:"x",context:"normal"},{keys:"",type:"keyToKey",toKeys:"W"},{keys:"",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"",type:"keyToKey",toKeys:"w"},{keys:"",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"",type:"keyToKey",toKeys:"0"},{keys:"",type:"keyToKey",toKeys:"$"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"",type:"keyToKey",toKeys:"i",context:"normal"},{keys:"",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"g$",type:"motion",motion:"moveToEndOfDisplayLine"},{keys:"g^",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"g0",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveToStartOfLine",context:"insert"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"",type:"idle",context:"normal"},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r",type:"action",action:"replace",isEdit:!0},{keys:"@",type:"action",action:"replayMacro"},{keys:"q",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"",type:"action",action:"redo"},{keys:"m",type:"action",action:"setMark"},{keys:'"',type:"action",action:"setRegister"},{keys:"",type:"action",action:"insertRegister",context:"insert",isEdit:!0},{keys:"",type:"action",action:"oneNormalCommand",context:"insert"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a",type:"motion",motion:"textObjectManipulation"},{keys:"i",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],o=r.length,s=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"omap",shortName:"om"},{name:"noremap",shortName:"no"},{name:"nnoremap",shortName:"nn"},{name:"vnoremap",shortName:"vn"},{name:"inoremap",shortName:"ino"},{name:"onoremap",shortName:"ono"},{name:"unmap"},{name:"mapclear",shortName:"mapc"},{name:"nmapclear",shortName:"nmapc"},{name:"vmapclear",shortName:"vmapc"},{name:"imapclear",shortName:"imapc"},{name:"omapclear",shortName:"omapc"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"delete",shortName:"d"},{name:"join",shortName:"j"},{name:"normal",shortName:"norm"},{name:"global",shortName:"g"}];function a(y){y.setOption("disableInput",!0),y.setOption("showCursorWhenSelecting",!1),i.signal(y,"vim-mode-change",{mode:"normal"}),y.on("cursorActivity",wf),Kt(y),i.on(y.getInputField(),"paste",v(y))}function l(y){y.setOption("disableInput",!1),y.off("cursorActivity",wf),i.off(y.getInputField(),"paste",v(y)),y.state.vim=null,_&&clearTimeout(_)}function u(y,w){this==i.keyMap.vim&&(y.options.$customCursor=null,i.rmClass(y.getWrapperElement(),"cm-fat-cursor")),(!w||w.attach!=c)&&l(y)}function c(y,w){this==i.keyMap.vim&&(y.curOp&&(y.curOp.selectionChanged=!0),y.options.$customCursor=e,i.addClass(y.getWrapperElement(),"cm-fat-cursor")),(!w||w.attach!=c)&&a(y)}i.defineOption("vimMode",!1,function(y,w,C){w&&y.getOption("keyMap")!="vim"?y.setOption("keyMap","vim"):!w&&C!=i.Init&&/^vim/.test(y.getOption("keyMap"))&&y.setOption("keyMap","default")});function d(y,w){if(w){if(this[y])return this[y];var C=m(y);if(!C)return!1;var L=te.findKey(w,C);return typeof L=="function"&&i.signal(w,"vim-keypress",C),L}}var f={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A",CapsLock:""},g={Enter:"CR",Backspace:"BS",Delete:"Del",Insert:"Ins"},x={};"Left|Right|Up|Down|End|Home".split("|").concat(Object.keys(g)).forEach(function(y){x[(g[y]||"").toLowerCase()]=x[y.toLowerCase()]=y});function m(y){if(y.charAt(0)=="'")return y.charAt(1);var w=y.split(/-(?!$)/),C=w[w.length-1];if(w.length==1&&w[0].length==1)return!1;if(w.length==2&&w[0]=="Shift"&&C.length==1)return!1;for(var L=!1,I=0;I"):!1}function v(y){var w=y.state.vim;return w.onPasteFn||(w.onPasteFn=function(){w.insertMode||(y.setCursor(pe(y.getCursor(),0,1)),fe.enterInsertMode(y,{},w))}),w.onPasteFn}var O=/[\d]/,b=[i.isWordChar,function(y){return y&&!i.isWordChar(y)&&!/\s/.test(y)}],k=[function(y){return/\S/.test(y)}];function E(y,w){for(var C=[],L=y;L"]),W=[].concat($,N,X,["-",'"',".",":","_","/","+"]),D;try{D=new RegExp("^[\\p{Lu}]$","u")}catch{D=/^[A-Z]$/}function z(y,w){return w>=y.firstLine()&&w<=y.lastLine()}function Q(y){return/^[a-z]$/.test(y)}function U(y){return"()[]{}".indexOf(y)!=-1}function T(y){return O.test(y)}function H(y){return D.test(y)}function gt(y){return/^\s*$/.test(y)}function at(y){return".?!".indexOf(y)!=-1}function Et(y,w){for(var C=0;CC?w=C:w0?1:-1,_t,ct=j.getCursor();do if(w+=vt,tt=I[(y+w)%y],tt&&(_t=tt.find())&&!Ze(ct,_t))break;while(wL)}return tt}function q(j,et){var tt=w,vt=Y(j,et);return w=tt,vt&&vt.find()}return{cachedCursor:void 0,add:M,find:q,move:Y}},kt=function(y){return y?{changes:y.changes,expectCursorActivityForChange:y.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};function xt(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=kt()}xt.prototype={exitMacroRecordMode:function(){var y=Ct.macroModeState;y.onRecordingDone&&y.onRecordingDone(),y.onRecordingDone=void 0,y.isRecording=!1},enterMacroRecordMode:function(y,w){var C=Ct.registerController.getRegister(w);if(C){if(C.clear(),this.latestRegister=w,y.openDialog){var L=Ji("span",{class:"cm-vim-message"},"recording @"+w);this.onRecordingDone=y.openDialog(L,null,{bottom:!0})}this.isRecording=!0}}};function Kt(y){return y.state.vim||(y.state.vim={inputState:new B,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}}),y.state.vim}var Ct;function Wt(){Ct={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:It(),macroModeState:new xt,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new rt({}),searchHistoryController:new bt,exCommandHistoryController:new bt};for(var y in pt){var w=pt[y];w.value=w.defaultValue}}var Yt,te={enterVimMode:a,leaveVimMode:l,buildKeyMap:function(){},getRegisterController:function(){return Ct.registerController},resetVimGlobalState_:Wt,getVimGlobalState_:function(){return Ct},maybeInitVimState_:Kt,suppressErrorLogging:!1,InsertModeKey:dh,map:function(y,w,C){jt.map(y,w,C)},unmap:function(y,w){return jt.unmap(y,w)},noremap:function(y,w,C){jt.map(y,w,C,!0)},mapclear:function(y){var w=r.length,C=o,L=r.slice(0,w-C);if(r=r.slice(w-C),y)for(var I=L.length-1;I>=0;I--){var M=L[I];if(y!==M.context)if(M.context)this._mapCommand(M);else{var Y=["normal","insert","visual"];for(var q in Y)if(Y[q]!==y){var j={};for(var et in M)j[et]=M[et];j.context=Y[q],this._mapCommand(j)}}}},setOption:nt,getOption:it,defineOption:Pt,defineEx:function(y,w,C){if(!w)w=y;else if(y.indexOf(w)!==0)throw new Error('(Vim.defineEx) "'+w+'" is not a prefix of "'+y+'", command not registered');$t[y]=C,jt.commandMap_[w]={name:y,shortName:w,type:"api"}},handleKey:function(y,w,C){var L=this.findKey(y,w,C);if(typeof L=="function")return L()},multiSelectHandleKey:w1,findKey:function(y,w,C){var L=Kt(y);function I(){var et=Ct.macroModeState;if(et.isRecording){if(w=="q")return et.exitMacroRecordMode(),ut(y),!0;C!="mapping"&&Fn(et,w)}}function M(){if(w==""){if(L.visualMode)Ni(y);else if(L.insertMode)ee(y);else return;return ut(y),!0}}function Y(){if(M())return!0;L.inputState.keyBuffer.push(w);var et=L.inputState.keyBuffer.join(""),tt=w.length==1,vt=wt.matchCommand(et,r,L.inputState,"insert"),_t=L.inputState.changeQueue;if(vt.type=="none")return ut(y),!1;if(vt.type=="partial"){if(Yt&&window.clearTimeout(Yt),Yt=tt&&window.setTimeout(function(){L.insertMode&&L.inputState.keyBuffer.length&&ut(y)},it("insertModeEscKeysTimeout")),tt){var ct=y.listSelections();(!_t||_t.removed.length!=ct.length)&&(_t=L.inputState.changeQueue=new ft),_t.inserted+=w;for(var ht=0;ht|./gi,M;M=I.exec(w);){var Y=M[0],q=L.insertMode,j=te.handleKey(y,Y,"mapping");if(!j&&q&&L.insertMode){if(Y[0]=="<"){var tt=Y.toLowerCase().slice(1,-1),et=tt.split("-"),tt=et.pop();if(tt=="lt")Y="<";else if(tt=="space")Y=" ";else if(tt=="cr")Y=` +}`,{label:"class",detail:"definition",type:"keyword"}),Si('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Si('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],S2=Dy.concat([Si("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Si("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Si("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),Yp=new ow,Ty=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Es(i){return(t,e)=>{let n=t.node.getChild("VariableDefinition");return n&&e(n,i),!0}}const C2=["FunctionDeclaration"],P2={FunctionDeclaration:Es("function"),ClassDeclaration:Es("class"),ClassExpression:()=>!0,EnumDeclaration:Es("constant"),TypeAliasDeclaration:Es("type"),NamespaceDeclaration:Es("namespace"),VariableDefinition(i,t){i.matchContext(C2)||t(i,"variable")},TypeDefinition(i,t){t(i,"type")},__proto__:null};function Iy(i,t){let e=Yp.get(t);if(e)return e;let n=[],r=!0;function o(s,a){let l=i.sliceString(s.from,s.to);n.push({label:l,type:a})}return t.cursor(He.IncludeAnonymous).iterate(s=>{if(r)r=!1;else if(s.name){let a=P2[s.name];if(a&&a(s,o)||Ty.has(s.name))return!1}else if(s.to-s.from>8192){for(let a of Iy(i,s.node))n.push(a);return!1}}),Yp.set(t,n),n}const Zp=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,My=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function k2(i){let t=Ye(i.state).resolveInner(i.pos,-1);if(My.indexOf(t.name)>-1)return null;let e=t.name=="VariableName"||t.to-t.from<20&&Zp.test(i.state.sliceDoc(t.from,t.to));if(!e&&!i.explicit)return null;let n=[];for(let r=t;r;r=r.parent)Ty.has(r.name)&&(n=n.concat(Iy(i.state.doc,r)));return{options:n,from:e?t.from:i.pos,validFor:Zp}}const Sr=ja.define({name:"javascript",parser:w2.configure({props:[lv.add({IfStatement:Nh({except:/^\s*({|else\b)/}),TryStatement:Nh({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:kw,SwitchBody:i=>{let t=i.textAfter,e=/^\s*\}/.test(t),n=/^\s*(case|default)\b/.test(t);return i.baseIndent+(e?0:n?1:2)*i.unit},Block:Pw({closing:"}"}),ArrowFunction:i=>i.baseIndent+i.unit,"TemplateString BlockComment":()=>null,"Statement Property":Nh({except:/^{/}),JSXElement(i){let t=/^\s*<\//.test(i.textAfter);return i.lineIndent(i.node.from)+(t?0:i.unit)},JSXEscape(i){let t=/\s*\}/.test(i.textAfter);return i.lineIndent(i.node.from)+(t?0:i.unit)},"JSXOpenTag JSXSelfClosingTag"(i){return i.column(i.node.from)+i.unit}}),cv.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Dw,BlockComment(i){return{from:i.from+2,to:i.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),$y={test:i=>/^JSX/.test(i.name),facet:ov({commentTokens:{block:{open:"{/*",close:"*/}"}}})},L2=Sr.configure({dialect:"ts"},"typescript"),A2=Sr.configure({dialect:"jsx",props:[Uc.add(i=>i.isTop?[$y]:void 0)]}),E2=Sr.configure({dialect:"jsx ts",props:[Uc.add(i=>i.isTop?[$y]:void 0)]},"typescript");let Qy=i=>({label:i,type:"keyword"});const Ny="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(Qy),D2=Ny.concat(["declare","implements","private","protected","public"].map(Qy));function T2(i={}){let t=i.jsx?i.typescript?E2:A2:i.typescript?L2:Sr,e=i.typescript?S2.concat(D2):Dy.concat(Ny);return new yw(t,[Sr.data.of({autocomplete:ZC(My,cy(e))}),Sr.data.of({autocomplete:k2}),i.jsx?$2:[]])}function I2(i){for(;;){if(i.name=="JSXOpenTag"||i.name=="JSXSelfClosingTag"||i.name=="JSXFragmentTag")return i;if(i.name=="JSXEscape"||!i.parent)return null;i=i.parent}}function Wp(i,t,e=i.length){for(let n=t==null?void 0:t.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return i.sliceString(n.from,Math.min(n.to,e));return""}const M2=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),$2=Rt.inputHandler.of((i,t,e,n,r)=>{if((M2?i.composing:i.compositionStarted)||i.state.readOnly||t!=e||n!=">"&&n!="/"||!Sr.isActiveAt(i.state,t,-1))return!1;let o=r(),{state:s}=o,a=s.changeByRange(l=>{var u;let{head:c}=l,d=Ye(s).resolveInner(c-1,-1),f;if(d.name=="JSXStartTag"&&(d=d.parent),!(s.doc.sliceString(c-1,c)!=n||d.name=="JSXAttributeValue"&&d.to>c)){if(n==">"&&d.name=="JSXFragmentTag")return{range:l,changes:{from:c,insert:""}};if(n=="/"&&d.name=="JSXStartCloseTag"){let g=d.parent,x=g.parent;if(x&&g.from==c-2&&((f=Wp(s.doc,x.firstChild,c))||((u=x.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let m=`${f}>`;return{range:yt.cursor(c+m.length,-1),changes:{from:c,insert:m}}}}else if(n==">"){let g=I2(d);if(g&&!/^\/?>|^<\//.test(s.doc.sliceString(c,c+2))&&(f=Wp(s.doc,g,c)))return{range:l,changes:{from:c,insert:``}}}}return{range:l}});return a.changes.empty?!1:(i.dispatch([o,s.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function Up(i){let t=new _n;for(let{from:e,to:n}of i.visibleRanges){const r=Ye(i.state),s={from:e,to:n,enter:a=>{if(a.name=="CallExpression"){if(!(i.state.doc.sliceString(a.from,a.from+5)=="path("))return;const u=a.from;a.next(),a.next();const c=Gt.mark({attributes:{"data-path-start":a.from},class:"cm-path-button"});t.add(u,u+4,c)}}};r.iterate(s)}return t.finish()}const Q2=Fe.fromClass(class{constructor(i){this.decorations=Up(i),this.initialized=!1}update(i){(i.docChanged||i.viewportChanged||this.initialized===!1)&&(this.decorations=Up(i.view),this.initialized=!0)}},{decorations:i=>i.decorations});function N2(i){var t=i.Pos;function e(y,w){var C=y.state.vim;if(!C||C.insertMode)return w.head;var L=C.sel.head;if(!L)return w.head;if(!(C.visualBlock&&w.head.line!=L.line))return w.from()==w.anchor&&!w.empty()&&w.head.line==L.line&&w.head.ch!=L.ch?new t(w.head.line,w.head.ch-1):w.head}function n(y,w,C){if(w.line===C.line&&w.ch>=C.ch-1){var L=y.getLine(w.line),I=L.charCodeAt(w.ch);55296<=I&&I<=55551&&(C.ch+=1)}return{start:w,end:C}}var r=[{keys:"",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"g",type:"keyToKey",toKeys:"gk"},{keys:"g",type:"keyToKey",toKeys:"gj"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"",type:"keyToKey",toKeys:"x",context:"normal"},{keys:"",type:"keyToKey",toKeys:"W"},{keys:"",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"",type:"keyToKey",toKeys:"w"},{keys:"",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"",type:"keyToKey",toKeys:"0"},{keys:"",type:"keyToKey",toKeys:"$"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"",type:"keyToKey",toKeys:"i",context:"normal"},{keys:"",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"g$",type:"motion",motion:"moveToEndOfDisplayLine"},{keys:"g^",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"g0",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveToStartOfLine",context:"insert"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"",type:"idle",context:"normal"},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r",type:"action",action:"replace",isEdit:!0},{keys:"@",type:"action",action:"replayMacro"},{keys:"q",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"",type:"action",action:"redo"},{keys:"m",type:"action",action:"setMark"},{keys:'"',type:"action",action:"setRegister"},{keys:"",type:"action",action:"insertRegister",context:"insert",isEdit:!0},{keys:"",type:"action",action:"oneNormalCommand",context:"insert"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a",type:"motion",motion:"textObjectManipulation"},{keys:"i",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],o=r.length,s=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"omap",shortName:"om"},{name:"noremap",shortName:"no"},{name:"nnoremap",shortName:"nn"},{name:"vnoremap",shortName:"vn"},{name:"inoremap",shortName:"ino"},{name:"onoremap",shortName:"ono"},{name:"unmap"},{name:"mapclear",shortName:"mapc"},{name:"nmapclear",shortName:"nmapc"},{name:"vmapclear",shortName:"vmapc"},{name:"imapclear",shortName:"imapc"},{name:"omapclear",shortName:"omapc"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"delete",shortName:"d"},{name:"join",shortName:"j"},{name:"normal",shortName:"norm"},{name:"global",shortName:"g"}];function a(y){y.setOption("disableInput",!0),y.setOption("showCursorWhenSelecting",!1),i.signal(y,"vim-mode-change",{mode:"normal"}),y.on("cursorActivity",wf),Kt(y),i.on(y.getInputField(),"paste",v(y))}function l(y){y.setOption("disableInput",!1),y.off("cursorActivity",wf),i.off(y.getInputField(),"paste",v(y)),y.state.vim=null,_&&clearTimeout(_)}function u(y,w){this==i.keyMap.vim&&(y.options.$customCursor=null,i.rmClass(y.getWrapperElement(),"cm-fat-cursor")),(!w||w.attach!=c)&&l(y)}function c(y,w){this==i.keyMap.vim&&(y.curOp&&(y.curOp.selectionChanged=!0),y.options.$customCursor=e,i.addClass(y.getWrapperElement(),"cm-fat-cursor")),(!w||w.attach!=c)&&a(y)}i.defineOption("vimMode",!1,function(y,w,C){w&&y.getOption("keyMap")!="vim"?y.setOption("keyMap","vim"):!w&&C!=i.Init&&/^vim/.test(y.getOption("keyMap"))&&y.setOption("keyMap","default")});function d(y,w){if(w){if(this[y])return this[y];var C=m(y);if(!C)return!1;var L=te.findKey(w,C);return typeof L=="function"&&i.signal(w,"vim-keypress",C),L}}var f={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A",CapsLock:""},g={Enter:"CR",Backspace:"BS",Delete:"Del",Insert:"Ins"},x={};"Left|Right|Up|Down|End|Home".split("|").concat(Object.keys(g)).forEach(function(y){x[(g[y]||"").toLowerCase()]=x[y.toLowerCase()]=y});function m(y){if(y.charAt(0)=="'")return y.charAt(1);var w=y.split(/-(?!$)/),C=w[w.length-1];if(w.length==1&&w[0].length==1)return!1;if(w.length==2&&w[0]=="Shift"&&C.length==1)return!1;for(var L=!1,I=0;I"):!1}function v(y){var w=y.state.vim;return w.onPasteFn||(w.onPasteFn=function(){w.insertMode||(y.setCursor(pe(y.getCursor(),0,1)),fe.enterInsertMode(y,{},w))}),w.onPasteFn}var O=/[\d]/,b=[i.isWordChar,function(y){return y&&!i.isWordChar(y)&&!/\s/.test(y)}],k=[function(y){return/\S/.test(y)}];function E(y,w){for(var C=[],L=y;L"]),W=[].concat($,Q,X,["-",'"',".",":","_","/","+"]),D;try{D=new RegExp("^[\\p{Lu}]$","u")}catch{D=/^[A-Z]$/}function z(y,w){return w>=y.firstLine()&&w<=y.lastLine()}function N(y){return/^[a-z]$/.test(y)}function U(y){return"()[]{}".indexOf(y)!=-1}function T(y){return O.test(y)}function H(y){return D.test(y)}function gt(y){return/^\s*$/.test(y)}function at(y){return".?!".indexOf(y)!=-1}function Et(y,w){for(var C=0;CC?w=C:w0?1:-1,_t,ct=j.getCursor();do if(w+=vt,tt=I[(y+w)%y],tt&&(_t=tt.find())&&!Ze(ct,_t))break;while(wL)}return tt}function q(j,et){var tt=w,vt=Y(j,et);return w=tt,vt&&vt.find()}return{cachedCursor:void 0,add:M,find:q,move:Y}},kt=function(y){return y?{changes:y.changes,expectCursorActivityForChange:y.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};function xt(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=kt()}xt.prototype={exitMacroRecordMode:function(){var y=Ct.macroModeState;y.onRecordingDone&&y.onRecordingDone(),y.onRecordingDone=void 0,y.isRecording=!1},enterMacroRecordMode:function(y,w){var C=Ct.registerController.getRegister(w);if(C){if(C.clear(),this.latestRegister=w,y.openDialog){var L=Ji("span",{class:"cm-vim-message"},"recording @"+w);this.onRecordingDone=y.openDialog(L,null,{bottom:!0})}this.isRecording=!0}}};function Kt(y){return y.state.vim||(y.state.vim={inputState:new B,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}}),y.state.vim}var Ct;function Wt(){Ct={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:It(),macroModeState:new xt,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new rt({}),searchHistoryController:new bt,exCommandHistoryController:new bt};for(var y in pt){var w=pt[y];w.value=w.defaultValue}}var Yt,te={enterVimMode:a,leaveVimMode:l,buildKeyMap:function(){},getRegisterController:function(){return Ct.registerController},resetVimGlobalState_:Wt,getVimGlobalState_:function(){return Ct},maybeInitVimState_:Kt,suppressErrorLogging:!1,InsertModeKey:dh,map:function(y,w,C){jt.map(y,w,C)},unmap:function(y,w){return jt.unmap(y,w)},noremap:function(y,w,C){jt.map(y,w,C,!0)},mapclear:function(y){var w=r.length,C=o,L=r.slice(0,w-C);if(r=r.slice(w-C),y)for(var I=L.length-1;I>=0;I--){var M=L[I];if(y!==M.context)if(M.context)this._mapCommand(M);else{var Y=["normal","insert","visual"];for(var q in Y)if(Y[q]!==y){var j={};for(var et in M)j[et]=M[et];j.context=Y[q],this._mapCommand(j)}}}},setOption:nt,getOption:it,defineOption:Pt,defineEx:function(y,w,C){if(!w)w=y;else if(y.indexOf(w)!==0)throw new Error('(Vim.defineEx) "'+w+'" is not a prefix of "'+y+'", command not registered');$t[y]=C,jt.commandMap_[w]={name:y,shortName:w,type:"api"}},handleKey:function(y,w,C){var L=this.findKey(y,w,C);if(typeof L=="function")return L()},multiSelectHandleKey:w1,findKey:function(y,w,C){var L=Kt(y);function I(){var et=Ct.macroModeState;if(et.isRecording){if(w=="q")return et.exitMacroRecordMode(),ut(y),!0;C!="mapping"&&Fn(et,w)}}function M(){if(w==""){if(L.visualMode)Ni(y);else if(L.insertMode)ee(y);else return;return ut(y),!0}}function Y(){if(M())return!0;L.inputState.keyBuffer.push(w);var et=L.inputState.keyBuffer.join(""),tt=w.length==1,vt=wt.matchCommand(et,r,L.inputState,"insert"),_t=L.inputState.changeQueue;if(vt.type=="none")return ut(y),!1;if(vt.type=="partial"){if(Yt&&window.clearTimeout(Yt),Yt=tt&&window.setTimeout(function(){L.insertMode&&L.inputState.keyBuffer.length&&ut(y)},it("insertModeEscKeysTimeout")),tt){var ct=y.listSelections();(!_t||_t.removed.length!=ct.length)&&(_t=L.inputState.changeQueue=new ft),_t.inserted+=w;for(var ht=0;ht|./gi,M;M=I.exec(w);){var Y=M[0],q=L.insertMode,j=te.handleKey(y,Y,"mapping");if(!j&&q&&L.insertMode){if(Y[0]=="<"){var tt=Y.toLowerCase().slice(1,-1),et=tt.split("-"),tt=et.pop();if(tt=="lt")Y="<";else if(tt=="space")Y=" ";else if(tt=="cr")Y=` `;else if(x.hasOwnProperty(tt)){Y=x[tt],kf(y,Y);continue}else Y=Y[0],I.lastIndex=M.index+1}y.replaceSelection(Y)}}}finally{xe=!1,Jt.length=0}}function B(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=null,this.changeQueue=null}B.prototype.pushRepeatDigit=function(y){this.operator?this.motionRepeat=this.motionRepeat.concat(y):this.prefixRepeat=this.prefixRepeat.concat(y)},B.prototype.getRepeat=function(){var y=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(y=1,this.prefixRepeat.length>0&&(y*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(y*=parseInt(this.motionRepeat.join(""),10))),y};function ut(y,w){y.state.vim.inputState=new B,i.signal(y,"vim-command-done",w)}function ft(){this.removed=[],this.inserted=""}function G(y,w,C){this.clear(),this.keyBuffer=[y||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!w,this.blockwise=!!C}G.prototype={setText:function(y,w,C){this.keyBuffer=[y||""],this.linewise=!!w,this.blockwise=!!C},pushText:function(y,w){w&&(this.linewise||this.keyBuffer.push(` `),this.linewise=!0),this.keyBuffer.push(y)},pushInsertModeChanges:function(y){this.insertModeChanges.push(kt(y))},pushSearchQuery:function(y){this.searchQueries.push(y)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}};function V(y,w){var C=Ct.registerController.registers;if(!y||y.length!=1)throw Error("Register name must be 1 character");if(C[y])throw Error("Register already defined "+y);C[y]=w,W.push(y)}function rt(y){this.registers=y,this.unnamedRegister=y['"']=new G,y["."]=new G,y[":"]=new G,y["/"]=new G,y["+"]=new G}rt.prototype={pushText:function(y,w,C,L,I){if(y!=="_"){L&&C.charAt(C.length-1)!==` `&&(C+=` `);var M=this.isValidRegister(y)?this.getRegister(y):null;if(!M){switch(w){case"yank":this.registers[0]=new G(C,L,I);break;case"delete":case"change":C.indexOf(` -`)==-1?this.registers["-"]=new G(C,L):(this.shiftNumericRegisters_(),this.registers[1]=new G(C,L));break}this.unnamedRegister.setText(C,L,I);return}var Y=H(y);Y?M.pushText(C,L):M.setText(C,L,I),y==="+"&&navigator.clipboard.writeText(C),this.unnamedRegister.setText(M.toString(),L)}},getRegister:function(y){return this.isValidRegister(y)?(y=y.toLowerCase(),this.registers[y]||(this.registers[y]=new G),this.registers[y]):this.unnamedRegister},isValidRegister:function(y){return y&&Et(y,W)},shiftNumericRegisters_:function(){for(var y=9;y>=2;y--)this.registers[y]=this.getRegister(""+(y-1))}};function bt(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}bt.prototype={nextMatch:function(y,w){var C=this.historyBuffer,L=w?-1:1;this.initialPrefix===null&&(this.initialPrefix=y);for(var I=this.iterator+L;w?I>=0:I=C.length)return this.iterator=C.length,this.initialPrefix;if(I<0)return y},pushInput:function(y){var w=this.historyBuffer.indexOf(y);w>-1&&this.historyBuffer.splice(w,1),y.length&&this.historyBuffer.push(y)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var wt={matchCommand:function(y,w,C,L){var I=Vi(y,w,L,C);if(!I.full&&!I.partial)return{type:"none"};if(!I.full&&I.partial)return{type:"partial"};for(var M,Y=0;Y"){var j=sn(y);if(!j||j.length>1)return{type:"clear"};C.selectedCharacter=j}return{type:"full",command:M}},processCommand:function(y,w,C){switch(w.inputState.repeatOverride=C.repeatOverride,C.type){case"motion":this.processMotion(y,w,C);break;case"operator":this.processOperator(y,w,C);break;case"operatorMotion":this.processOperatorMotion(y,w,C);break;case"action":this.processAction(y,w,C);break;case"search":this.processSearch(y,w,C);break;case"ex":case"keyToEx":this.processEx(y,w,C);break}},processMotion:function(y,w,C){w.inputState.motion=C.motion,w.inputState.motionArgs=wi(C.motionArgs),this.evalInput(y,w)},processOperator:function(y,w,C){var L=w.inputState;if(L.operator)if(L.operator==C.operator){L.motion="expandToLine",L.motionArgs={linewise:!0},this.evalInput(y,w);return}else ut(y);L.operator=C.operator,L.operatorArgs=wi(C.operatorArgs),C.keys.length>1&&(L.operatorShortcut=C.keys),C.exitVisualBlock&&(w.visualBlock=!1,Qn(y)),w.visualMode&&this.evalInput(y,w)},processOperatorMotion:function(y,w,C){var L=w.visualMode,I=wi(C.operatorMotionArgs);I&&L&&I.visualLine&&(w.visualLine=!0),this.processOperator(y,w,C),L||this.processMotion(y,w,C)},processAction:function(y,w,C){var L=w.inputState,I=L.getRepeat(),M=!!I,Y=wi(C.actionArgs)||{};L.selectedCharacter&&(Y.selectedCharacter=L.selectedCharacter),C.operator&&this.processOperator(y,w,C),C.motion&&this.processMotion(y,w,C),(C.motion||C.operator)&&this.evalInput(y,w),Y.repeat=I||1,Y.repeatIsExplicit=M,Y.registerName=L.registerName,ut(y),w.lastMotion=null,C.isEdit&&this.recordLastEdit(w,L,C),fe[C.action](y,Y,w)},processSearch:function(y,w,C){if(!y.getSearchCursor)return;var L=C.searchArgs.forward,I=C.searchArgs.wholeWordOnly;Bi(y).setReversed(!L);var M=L?"/":"?",Y=Bi(y).getQuery(),q=y.getScrollInfo();function j(At,Ht,ie){Ct.searchHistoryController.pushInput(At),Ct.searchHistoryController.reset();try{h(y,At,Ht,ie)}catch{Pe(y,"Invalid regex: "+At),ut(y);return}wt.processMotion(y,w,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:C.searchArgs.toJumplist}})}function et(At){y.scrollTo(q.left,q.top),j(At,!0,!0);var Ht=Ct.macroModeState;Ht.isRecording&&fh(Ht,At)}function tt(At,Ht,ie){var Vt=i.keyName(At),$e,fi;Vt=="Up"||Vt=="Down"?($e=Vt=="Up",fi=At.target?At.target.selectionEnd:0,Ht=Ct.searchHistoryController.nextMatch(Ht,$e)||"",ie(Ht),fi&&At.target&&(At.target.selectionEnd=At.target.selectionStart=Math.min(fi,At.target.value.length))):Vt!="Left"&&Vt!="Right"&&Vt!="Ctrl"&&Vt!="Alt"&&Vt!="Shift"&&Ct.searchHistoryController.reset();var Be;try{Be=h(y,Ht,!0,!0)}catch{}Be?y.scrollIntoView(A(y,!L,Be),30):(Z(y),y.scrollTo(q.left,q.top))}function vt(At,Ht,ie){var Vt=i.keyName(At);Vt=="Esc"||Vt=="Ctrl-C"||Vt=="Ctrl-["||Vt=="Backspace"&&Ht==""?(Ct.searchHistoryController.pushInput(Ht),Ct.searchHistoryController.reset(),h(y,Y),Z(y),y.scrollTo(q.left,q.top),i.e_stop(At),ut(y),ie(),y.focus()):Vt=="Up"||Vt=="Down"?i.e_stop(At):Vt=="Ctrl-U"&&(i.e_stop(At),ie(""))}switch(C.searchArgs.querySrc){case"prompt":var _t=Ct.macroModeState;if(_t.isPlaying){var Bt=_t.replaySearchQueries.shift();j(Bt,!0,!1)}else Qr(y,{onClose:et,prefix:M,desc:"(JavaScript regexp)",onKeyUp:tt,onKeyDown:vt});break;case"wordUnderCursor":var ct=Mr(y,!1,!1,!1,!0),ht=!0;if(ct||(ct=Mr(y,!1,!1,!1,!1),ht=!1),!ct)return;var Bt=y.getLine(ct.start.line).substring(ct.start.ch,ct.end.ch);ht&&I?Bt="\\b"+Bt+"\\b":Bt=Lt(Bt),Ct.jumpList.cachedCursor=y.getCursor(),y.setCursor(ct.start),j(Bt,!0,!1);break}},processEx:function(y,w,C){function L(M){Ct.exCommandHistoryController.pushInput(M),Ct.exCommandHistoryController.reset(),jt.processCommand(y,M),y.state.vim&&ut(y)}function I(M,Y,q){var j=i.keyName(M),et,tt;(j=="Esc"||j=="Ctrl-C"||j=="Ctrl-["||j=="Backspace"&&Y=="")&&(Ct.exCommandHistoryController.pushInput(Y),Ct.exCommandHistoryController.reset(),i.e_stop(M),ut(y),q(),y.focus()),j=="Up"||j=="Down"?(i.e_stop(M),et=j=="Up",tt=M.target?M.target.selectionEnd:0,Y=Ct.exCommandHistoryController.nextMatch(Y,et)||"",q(Y),tt&&M.target&&(M.target.selectionEnd=M.target.selectionStart=Math.min(tt,M.target.value.length))):j=="Ctrl-U"?(i.e_stop(M),q("")):j!="Left"&&j!="Right"&&j!="Ctrl"&&j!="Alt"&&j!="Shift"&&Ct.exCommandHistoryController.reset()}C.type=="keyToEx"?jt.processCommand(y,C.exArgs.input):w.visualMode?Qr(y,{onClose:L,prefix:":",value:"'<,'>",onKeyDown:I,selectValueOnOpen:!1}):Qr(y,{onClose:L,prefix:":",onKeyDown:I})},evalInput:function(y,w){var C=w.inputState,L=C.motion,I=C.motionArgs||{},M=C.operator,Y=C.operatorArgs||{},q=C.registerName,j=w.sel,et=le(w.visualMode?be(y,j.head):y.getCursor("head")),tt=le(w.visualMode?be(y,j.anchor):y.getCursor("anchor")),vt=le(et),_t=le(tt),ct,ht,Bt;if(M&&this.recordLastEdit(w,C),C.repeatOverride!==void 0?Bt=C.repeatOverride:Bt=C.getRepeat(),Bt>0&&I.explicitRepeat?I.repeatIsExplicit=!0:(I.noRepeat||!I.explicitRepeat&&Bt===0)&&(Bt=1,I.repeatIsExplicit=!1),C.selectedCharacter&&(I.selectedCharacter=Y.selectedCharacter=C.selectedCharacter),I.repeat=Bt,ut(y),L){var At=ot[L](y,et,I,w,C);if(w.lastMotion=ot[L],!At)return;if(I.toJumplist){var Ht=Ct.jumpList,ie=Ht.cachedCursor;ie?(Eo(y,ie,At),delete Ht.cachedCursor):Eo(y,et,At)}At instanceof Array?(ht=At[0],ct=At[1]):ct=At,ct||(ct=le(et)),w.visualMode?(w.visualBlock&&ct.ch===1/0||(ct=be(y,ct,vt)),ht&&(ht=be(y,ht)),ht=ht||_t,j.anchor=ht,j.head=ct,Qn(y),Hi(y,w,"<",Le(ht,ct)?ht:ct),Hi(y,w,">",Le(ht,ct)?ct:ht)):M||(ct=be(y,ct,vt),y.setCursor(ct.line,ct.ch))}if(M){if(Y.lastSel){ht=_t;var Vt=Y.lastSel,$e=Math.abs(Vt.head.line-Vt.anchor.line),fi=Math.abs(Vt.head.ch-Vt.anchor.ch);Vt.visualLine?ct=new t(_t.line+$e,_t.ch):Vt.visualBlock?ct=new t(_t.line+$e,_t.ch+fi):Vt.head.line==Vt.anchor.line?ct=new t(_t.line,_t.ch+fi):ct=new t(_t.line+$e,_t.ch),w.visualMode=!0,w.visualLine=Vt.visualLine,w.visualBlock=Vt.visualBlock,j=w.sel={anchor:ht,head:ct},Qn(y)}else w.visualMode&&(Y.lastSel={anchor:le(j.anchor),head:le(j.head),visualBlock:w.visualBlock,visualLine:w.visualLine});var Be,ni,me,ve,Oi;if(w.visualMode){Be=We(j.head,j.anchor),ni=ui(j.head,j.anchor),me=w.visualLine||Y.linewise,ve=w.visualBlock?"block":me?"line":"char";var Ue=n(y,Be,ni);if(Oi=xs(y,{anchor:Ue.start,head:Ue.end},ve),me){var ze=Oi.ranges;if(ve=="block")for(var Xn=0;Xnq:tt.lineet&&I.line==et?Nn(y,w,C,L,!0):(C.toFirstChar&&(M=Gi(y.getLine(q)),L.lastHPos=M),L.lastHSPos=y.charCoords(new t(q,M),"div").left,new t(q,M))},moveByDisplayLines:function(y,w,C,L){var I=w;switch(L.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:L.lastHSPos=y.charCoords(I,"div").left}var M=C.repeat,Y=y.findPosV(I,C.forward?M:-M,"line",L.lastHSPos);if(Y.hitSide)if(C.forward)var q=y.charCoords(Y,"div"),j={top:q.top+8,left:L.lastHSPos},Y=y.coordsChar(j,"div");else{var et=y.charCoords(new t(y.firstLine(),0),"div");et.left=L.lastHSPos,Y=y.coordsChar(et,"div")}return L.lastHPos=Y.ch,Y},moveByPage:function(y,w,C){var L=w,I=C.repeat;return y.findPosV(L,C.forward?I:-I,"page")},moveByParagraph:function(y,w,C){var L=C.forward?1:-1;return Io(y,w,C.repeat,L)},moveBySentence:function(y,w,C){var L=C.forward?1:-1;return Bn(y,w,C.repeat,L)},moveByScroll:function(y,w,C,L){var I=y.getScrollInfo(),M=null,Y=C.repeat;Y||(Y=I.clientHeight/(2*y.defaultTextHeight()));var q=y.charCoords(w,"local");if(C.repeat=Y,M=ot.moveByDisplayLines(y,w,C,L),!M)return null;var j=y.charCoords(M,"local");return y.scrollTo(null,I.top+j.top-q.top),M},moveByWords:function(y,w,C){return th(y,w,C.repeat,!!C.forward,!!C.wordEnd,!!C.bigWord)},moveTillCharacter:function(y,w,C){var L=C.repeat,I=$r(y,L,C.forward,C.selectedCharacter,w),M=C.forward?-1:1;return Do(M,C),I?(I.ch+=M,I):null},moveToCharacter:function(y,w,C){var L=C.repeat;return Do(0,C),$r(y,L,C.forward,C.selectedCharacter,w)||w},moveToSymbol:function(y,w,C){var L=C.repeat;return Jl(y,L,C.forward,C.selectedCharacter)||w},moveToColumn:function(y,w,C,L){var I=C.repeat;return L.lastHPos=I-1,L.lastHSPos=y.charCoords(w,"div").left,eh(y,I)},moveToEol:function(y,w,C,L){return Nn(y,w,C,L,!1)},moveToFirstNonWhiteSpaceCharacter:function(y,w){var C=w;return new t(C.line,Gi(y.getLine(C.line)))},moveToMatchedSymbol:function(y,w){for(var C=w,L=C.line,I=C.ch,M=y.getLine(L),Y;I"?/[(){}[\]<>]/:/[(){}[\]]/,et=y.findMatchingBracket(new t(L,I),{bracketRegex:j});return et.to}else return C},moveToStartOfLine:function(y,w){return new t(w.line,0)},moveToLineOrEdgeOfDocument:function(y,w,C){var L=C.forward?y.lastLine():y.firstLine();return C.repeatIsExplicit&&(L=C.repeat-y.getOption("firstLineNumber")),new t(L,Gi(y.getLine(L)))},moveToStartOfDisplayLine:function(y){return y.execCommand("goLineLeft"),y.getCursor()},moveToEndOfDisplayLine:function(y){y.execCommand("goLineRight");var w=y.getCursor();return w.sticky=="before"&&w.ch--,w},textObjectManipulation:function(y,w,C,L){var I={"(":")",")":"(","{":"}","}":"{","[":"]","]":"[","<":">",">":"<"},M={"'":!0,'"':!0,"`":!0},Y=C.selectedCharacter;Y=="b"?Y="(":Y=="B"&&(Y="{");var q=!C.textObjectInner,j,et;if(I[Y]){if(et=!0,j=$o(y,w,Y,q),!j){var tt=y.getSearchCursor(new RegExp("\\"+Y,"g"),w);tt.find()&&(j=$o(y,tt.from(),Y,q))}}else if(M[Y])et=!0,j=nh(y,w,Y,q);else if(Y==="W")j=Mr(y,q,!q,!0);else if(Y==="w")j=Mr(y,q,!q,!1);else if(Y==="p")if(j=Io(y,w,C.repeat,0,q),C.linewise=!0,L.visualMode)L.visualLine||(L.visualLine=!0);else{var vt=L.inputState.operatorArgs;vt&&(vt.linewise=!0),j.end.line--}else if(Y==="t")j=Gl(y,w,q);else if(Y==="s"){var _t=y.getLine(w.line);w.ch>0&&at(_t[w.ch])&&(w.ch-=1);var ct=Mo(y,w,C.repeat,1,q),ht=Mo(y,w,C.repeat,-1,q);gt(y.getLine(ht.line)[ht.ch])&>(y.getLine(ct.line)[ct.ch-1])&&(ht={line:ht.line,ch:ht.ch+1}),j={start:ht,end:ct}}return j?y.state.vim.visualMode?zl(y,j.start,j.end,et):[j.start,j.end]:null},repeatLastCharacterSearch:function(y,w,C){var L=Ct.lastCharacterSearch,I=C.repeat,M=C.forward===L.forward,Y=(L.increment?1:0)*(M?-1:1);y.moveH(-Y,"char"),C.inclusive=!!M;var q=$r(y,I,M,L.selectedCharacter);return q?(q.ch+=Y,q):(y.moveH(Y,"char"),w)}};function Dt(y,w){ot[y]=w}function Xt(y,w){for(var C=[],L=0;Ly.lastLine()&&w.linewise&&!vt?y.replaceRange("",tt,q):y.replaceRange("",Y,q),w.linewise&&(vt||(y.setCursor(tt),i.commands.newlineAndIndent(y)),Y.ch=Number.MAX_VALUE),L=Y}Ct.registerController.pushText(w.registerName,"change",I,w.linewise,C.length>1),fe.enterInsertMode(y,{head:L},y.state.vim)},delete:function(y,w,C){var L,I,M=y.state.vim;if(M.visualBlock){I=y.getSelection();var j=Xt("",C.length);y.replaceSelections(j),L=We(C[0].head,C[0].anchor)}else{var Y=C[0].anchor,q=C[0].head;w.linewise&&q.line!=y.firstLine()&&Y.line==y.lastLine()&&Y.line==q.line-1&&(Y.line==y.firstLine()?Y.ch=0:Y=new t(Y.line-1,st(y,Y.line-1))),I=y.getRange(Y,q),y.replaceRange("",Y,q),L=Y,w.linewise&&(L=ot.moveToFirstNonWhiteSpaceCharacter(y,Y))}return Ct.registerController.pushText(w.registerName,"delete",I,w.linewise,M.visualBlock),be(y,L)},indent:function(y,w,C){var L=y.state.vim;if(y.indentMore)for(var I=L.visualMode?w.repeat:1,M=0;Met.top?(j.line+=(q-et.top)/I,j.line=Math.ceil(j.line),y.setCursor(j),et=y.charCoords(j,"local"),y.scrollTo(null,et.top)):y.scrollTo(null,q);else{var tt=q+y.getScrollInfo().clientHeight;tt=I.anchor.line?M=pe(I.head,0,1):M=new t(I.anchor.line,0)}else if(L=="inplace"){if(C.visualMode)return}else L=="lastEdit"&&(M=St(y)||M);y.setOption("disableInput",!1),w&&w.replace?(y.toggleOverwrite(!0),y.setOption("keyMap","vim-replace"),i.signal(y,"vim-mode-change",{mode:"replace"})):(y.toggleOverwrite(!1),y.setOption("keyMap","vim-insert"),i.signal(y,"vim-mode-change",{mode:"insert"})),Ct.macroModeState.isPlaying||(y.on("change",Sn),C.insertEnd&&C.insertEnd.clear(),C.insertEnd=y.setBookmark(M,{insertLeft:!0}),i.on(y.getInputField(),"keydown",Cf)),C.visualMode&&Ni(y),$n(y,M,Y)}},toggleVisualMode:function(y,w,C){var L=w.repeat,I=y.getCursor(),M;if(C.visualMode)C.visualLine^w.linewise||C.visualBlock^w.blockwise?(C.visualLine=!!w.linewise,C.visualBlock=!!w.blockwise,i.signal(y,"vim-mode-change",{mode:"visual",subMode:C.visualLine?"linewise":C.visualBlock?"blockwise":""}),Qn(y)):Ni(y);else{C.visualMode=!0,C.visualLine=!!w.linewise,C.visualBlock=!!w.blockwise,M=be(y,new t(I.line,I.ch+L-1));var Y=n(y,I,M);C.sel={anchor:Y.start,head:Y.end},i.signal(y,"vim-mode-change",{mode:"visual",subMode:C.visualLine?"linewise":C.visualBlock?"blockwise":""}),Qn(y),Hi(y,C,"<",We(I,M)),Hi(y,C,">",ui(I,M))}},reselectLastSelection:function(y,w,C){var L=C.lastSelection;if(C.visualMode&&Ao(y,C),L){var I=L.anchorMark.find(),M=L.headMark.find();if(!I||!M)return;C.sel={anchor:I,head:M},C.visualMode=!0,C.visualLine=L.visualLine,C.visualBlock=L.visualBlock,Qn(y),Hi(y,C,"<",We(I,M)),Hi(y,C,">",ui(I,M)),i.signal(y,"vim-mode-change",{mode:"visual",subMode:C.visualLine?"linewise":C.visualBlock?"blockwise":""})}},joinLines:function(y,w,C){var L,I;if(C.visualMode){if(L=y.getCursor("anchor"),I=y.getCursor("head"),Le(I,L)){var M=I;I=L,L=M}I.ch=st(y,I.line)-1}else{var Y=Math.max(w.repeat,2);L=y.getCursor(),I=be(y,new t(L.line+Y-1,1/0))}for(var q=0,j=L.line;j=2;y--)this.registers[y]=this.getRegister(""+(y-1))}};function bt(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}bt.prototype={nextMatch:function(y,w){var C=this.historyBuffer,L=w?-1:1;this.initialPrefix===null&&(this.initialPrefix=y);for(var I=this.iterator+L;w?I>=0:I=C.length)return this.iterator=C.length,this.initialPrefix;if(I<0)return y},pushInput:function(y){var w=this.historyBuffer.indexOf(y);w>-1&&this.historyBuffer.splice(w,1),y.length&&this.historyBuffer.push(y)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var wt={matchCommand:function(y,w,C,L){var I=Vi(y,w,L,C);if(!I.full&&!I.partial)return{type:"none"};if(!I.full&&I.partial)return{type:"partial"};for(var M,Y=0;Y"){var j=sn(y);if(!j||j.length>1)return{type:"clear"};C.selectedCharacter=j}return{type:"full",command:M}},processCommand:function(y,w,C){switch(w.inputState.repeatOverride=C.repeatOverride,C.type){case"motion":this.processMotion(y,w,C);break;case"operator":this.processOperator(y,w,C);break;case"operatorMotion":this.processOperatorMotion(y,w,C);break;case"action":this.processAction(y,w,C);break;case"search":this.processSearch(y,w,C);break;case"ex":case"keyToEx":this.processEx(y,w,C);break}},processMotion:function(y,w,C){w.inputState.motion=C.motion,w.inputState.motionArgs=wi(C.motionArgs),this.evalInput(y,w)},processOperator:function(y,w,C){var L=w.inputState;if(L.operator)if(L.operator==C.operator){L.motion="expandToLine",L.motionArgs={linewise:!0},this.evalInput(y,w);return}else ut(y);L.operator=C.operator,L.operatorArgs=wi(C.operatorArgs),C.keys.length>1&&(L.operatorShortcut=C.keys),C.exitVisualBlock&&(w.visualBlock=!1,Qn(y)),w.visualMode&&this.evalInput(y,w)},processOperatorMotion:function(y,w,C){var L=w.visualMode,I=wi(C.operatorMotionArgs);I&&L&&I.visualLine&&(w.visualLine=!0),this.processOperator(y,w,C),L||this.processMotion(y,w,C)},processAction:function(y,w,C){var L=w.inputState,I=L.getRepeat(),M=!!I,Y=wi(C.actionArgs)||{};L.selectedCharacter&&(Y.selectedCharacter=L.selectedCharacter),C.operator&&this.processOperator(y,w,C),C.motion&&this.processMotion(y,w,C),(C.motion||C.operator)&&this.evalInput(y,w),Y.repeat=I||1,Y.repeatIsExplicit=M,Y.registerName=L.registerName,ut(y),w.lastMotion=null,C.isEdit&&this.recordLastEdit(w,L,C),fe[C.action](y,Y,w)},processSearch:function(y,w,C){if(!y.getSearchCursor)return;var L=C.searchArgs.forward,I=C.searchArgs.wholeWordOnly;Bi(y).setReversed(!L);var M=L?"/":"?",Y=Bi(y).getQuery(),q=y.getScrollInfo();function j(At,Ht,ie){Ct.searchHistoryController.pushInput(At),Ct.searchHistoryController.reset();try{h(y,At,Ht,ie)}catch{Pe(y,"Invalid regex: "+At),ut(y);return}wt.processMotion(y,w,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:C.searchArgs.toJumplist}})}function et(At){y.scrollTo(q.left,q.top),j(At,!0,!0);var Ht=Ct.macroModeState;Ht.isRecording&&fh(Ht,At)}function tt(At,Ht,ie){var Vt=i.keyName(At),$e,fi;Vt=="Up"||Vt=="Down"?($e=Vt=="Up",fi=At.target?At.target.selectionEnd:0,Ht=Ct.searchHistoryController.nextMatch(Ht,$e)||"",ie(Ht),fi&&At.target&&(At.target.selectionEnd=At.target.selectionStart=Math.min(fi,At.target.value.length))):Vt!="Left"&&Vt!="Right"&&Vt!="Ctrl"&&Vt!="Alt"&&Vt!="Shift"&&Ct.searchHistoryController.reset();var Be;try{Be=h(y,Ht,!0,!0)}catch{}Be?y.scrollIntoView(A(y,!L,Be),30):(Z(y),y.scrollTo(q.left,q.top))}function vt(At,Ht,ie){var Vt=i.keyName(At);Vt=="Esc"||Vt=="Ctrl-C"||Vt=="Ctrl-["||Vt=="Backspace"&&Ht==""?(Ct.searchHistoryController.pushInput(Ht),Ct.searchHistoryController.reset(),h(y,Y),Z(y),y.scrollTo(q.left,q.top),i.e_stop(At),ut(y),ie(),y.focus()):Vt=="Up"||Vt=="Down"?i.e_stop(At):Vt=="Ctrl-U"&&(i.e_stop(At),ie(""))}switch(C.searchArgs.querySrc){case"prompt":var _t=Ct.macroModeState;if(_t.isPlaying){var Bt=_t.replaySearchQueries.shift();j(Bt,!0,!1)}else Qr(y,{onClose:et,prefix:M,desc:"(JavaScript regexp)",onKeyUp:tt,onKeyDown:vt});break;case"wordUnderCursor":var ct=Mr(y,!1,!1,!1,!0),ht=!0;if(ct||(ct=Mr(y,!1,!1,!1,!1),ht=!1),!ct)return;var Bt=y.getLine(ct.start.line).substring(ct.start.ch,ct.end.ch);ht&&I?Bt="\\b"+Bt+"\\b":Bt=Lt(Bt),Ct.jumpList.cachedCursor=y.getCursor(),y.setCursor(ct.start),j(Bt,!0,!1);break}},processEx:function(y,w,C){function L(M){Ct.exCommandHistoryController.pushInput(M),Ct.exCommandHistoryController.reset(),jt.processCommand(y,M),y.state.vim&&ut(y)}function I(M,Y,q){var j=i.keyName(M),et,tt;(j=="Esc"||j=="Ctrl-C"||j=="Ctrl-["||j=="Backspace"&&Y=="")&&(Ct.exCommandHistoryController.pushInput(Y),Ct.exCommandHistoryController.reset(),i.e_stop(M),ut(y),q(),y.focus()),j=="Up"||j=="Down"?(i.e_stop(M),et=j=="Up",tt=M.target?M.target.selectionEnd:0,Y=Ct.exCommandHistoryController.nextMatch(Y,et)||"",q(Y),tt&&M.target&&(M.target.selectionEnd=M.target.selectionStart=Math.min(tt,M.target.value.length))):j=="Ctrl-U"?(i.e_stop(M),q("")):j!="Left"&&j!="Right"&&j!="Ctrl"&&j!="Alt"&&j!="Shift"&&Ct.exCommandHistoryController.reset()}C.type=="keyToEx"?jt.processCommand(y,C.exArgs.input):w.visualMode?Qr(y,{onClose:L,prefix:":",value:"'<,'>",onKeyDown:I,selectValueOnOpen:!1}):Qr(y,{onClose:L,prefix:":",onKeyDown:I})},evalInput:function(y,w){var C=w.inputState,L=C.motion,I=C.motionArgs||{},M=C.operator,Y=C.operatorArgs||{},q=C.registerName,j=w.sel,et=le(w.visualMode?be(y,j.head):y.getCursor("head")),tt=le(w.visualMode?be(y,j.anchor):y.getCursor("anchor")),vt=le(et),_t=le(tt),ct,ht,Bt;if(M&&this.recordLastEdit(w,C),C.repeatOverride!==void 0?Bt=C.repeatOverride:Bt=C.getRepeat(),Bt>0&&I.explicitRepeat?I.repeatIsExplicit=!0:(I.noRepeat||!I.explicitRepeat&&Bt===0)&&(Bt=1,I.repeatIsExplicit=!1),C.selectedCharacter&&(I.selectedCharacter=Y.selectedCharacter=C.selectedCharacter),I.repeat=Bt,ut(y),L){var At=ot[L](y,et,I,w,C);if(w.lastMotion=ot[L],!At)return;if(I.toJumplist){var Ht=Ct.jumpList,ie=Ht.cachedCursor;ie?(Eo(y,ie,At),delete Ht.cachedCursor):Eo(y,et,At)}At instanceof Array?(ht=At[0],ct=At[1]):ct=At,ct||(ct=le(et)),w.visualMode?(w.visualBlock&&ct.ch===1/0||(ct=be(y,ct,vt)),ht&&(ht=be(y,ht)),ht=ht||_t,j.anchor=ht,j.head=ct,Qn(y),Hi(y,w,"<",Le(ht,ct)?ht:ct),Hi(y,w,">",Le(ht,ct)?ct:ht)):M||(ct=be(y,ct,vt),y.setCursor(ct.line,ct.ch))}if(M){if(Y.lastSel){ht=_t;var Vt=Y.lastSel,$e=Math.abs(Vt.head.line-Vt.anchor.line),fi=Math.abs(Vt.head.ch-Vt.anchor.ch);Vt.visualLine?ct=new t(_t.line+$e,_t.ch):Vt.visualBlock?ct=new t(_t.line+$e,_t.ch+fi):Vt.head.line==Vt.anchor.line?ct=new t(_t.line,_t.ch+fi):ct=new t(_t.line+$e,_t.ch),w.visualMode=!0,w.visualLine=Vt.visualLine,w.visualBlock=Vt.visualBlock,j=w.sel={anchor:ht,head:ct},Qn(y)}else w.visualMode&&(Y.lastSel={anchor:le(j.anchor),head:le(j.head),visualBlock:w.visualBlock,visualLine:w.visualLine});var Be,ni,me,ye,Oi;if(w.visualMode){Be=We(j.head,j.anchor),ni=ui(j.head,j.anchor),me=w.visualLine||Y.linewise,ye=w.visualBlock?"block":me?"line":"char";var Ue=n(y,Be,ni);if(Oi=xs(y,{anchor:Ue.start,head:Ue.end},ye),me){var ze=Oi.ranges;if(ye=="block")for(var Xn=0;Xnq:tt.lineet&&I.line==et?Nn(y,w,C,L,!0):(C.toFirstChar&&(M=Gi(y.getLine(q)),L.lastHPos=M),L.lastHSPos=y.charCoords(new t(q,M),"div").left,new t(q,M))},moveByDisplayLines:function(y,w,C,L){var I=w;switch(L.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:L.lastHSPos=y.charCoords(I,"div").left}var M=C.repeat,Y=y.findPosV(I,C.forward?M:-M,"line",L.lastHSPos);if(Y.hitSide)if(C.forward)var q=y.charCoords(Y,"div"),j={top:q.top+8,left:L.lastHSPos},Y=y.coordsChar(j,"div");else{var et=y.charCoords(new t(y.firstLine(),0),"div");et.left=L.lastHSPos,Y=y.coordsChar(et,"div")}return L.lastHPos=Y.ch,Y},moveByPage:function(y,w,C){var L=w,I=C.repeat;return y.findPosV(L,C.forward?I:-I,"page")},moveByParagraph:function(y,w,C){var L=C.forward?1:-1;return Io(y,w,C.repeat,L)},moveBySentence:function(y,w,C){var L=C.forward?1:-1;return Bn(y,w,C.repeat,L)},moveByScroll:function(y,w,C,L){var I=y.getScrollInfo(),M=null,Y=C.repeat;Y||(Y=I.clientHeight/(2*y.defaultTextHeight()));var q=y.charCoords(w,"local");if(C.repeat=Y,M=ot.moveByDisplayLines(y,w,C,L),!M)return null;var j=y.charCoords(M,"local");return y.scrollTo(null,I.top+j.top-q.top),M},moveByWords:function(y,w,C){return th(y,w,C.repeat,!!C.forward,!!C.wordEnd,!!C.bigWord)},moveTillCharacter:function(y,w,C){var L=C.repeat,I=$r(y,L,C.forward,C.selectedCharacter,w),M=C.forward?-1:1;return Do(M,C),I?(I.ch+=M,I):null},moveToCharacter:function(y,w,C){var L=C.repeat;return Do(0,C),$r(y,L,C.forward,C.selectedCharacter,w)||w},moveToSymbol:function(y,w,C){var L=C.repeat;return Jl(y,L,C.forward,C.selectedCharacter)||w},moveToColumn:function(y,w,C,L){var I=C.repeat;return L.lastHPos=I-1,L.lastHSPos=y.charCoords(w,"div").left,eh(y,I)},moveToEol:function(y,w,C,L){return Nn(y,w,C,L,!1)},moveToFirstNonWhiteSpaceCharacter:function(y,w){var C=w;return new t(C.line,Gi(y.getLine(C.line)))},moveToMatchedSymbol:function(y,w){for(var C=w,L=C.line,I=C.ch,M=y.getLine(L),Y;I"?/[(){}[\]<>]/:/[(){}[\]]/,et=y.findMatchingBracket(new t(L,I),{bracketRegex:j});return et.to}else return C},moveToStartOfLine:function(y,w){return new t(w.line,0)},moveToLineOrEdgeOfDocument:function(y,w,C){var L=C.forward?y.lastLine():y.firstLine();return C.repeatIsExplicit&&(L=C.repeat-y.getOption("firstLineNumber")),new t(L,Gi(y.getLine(L)))},moveToStartOfDisplayLine:function(y){return y.execCommand("goLineLeft"),y.getCursor()},moveToEndOfDisplayLine:function(y){y.execCommand("goLineRight");var w=y.getCursor();return w.sticky=="before"&&w.ch--,w},textObjectManipulation:function(y,w,C,L){var I={"(":")",")":"(","{":"}","}":"{","[":"]","]":"[","<":">",">":"<"},M={"'":!0,'"':!0,"`":!0},Y=C.selectedCharacter;Y=="b"?Y="(":Y=="B"&&(Y="{");var q=!C.textObjectInner,j,et;if(I[Y]){if(et=!0,j=$o(y,w,Y,q),!j){var tt=y.getSearchCursor(new RegExp("\\"+Y,"g"),w);tt.find()&&(j=$o(y,tt.from(),Y,q))}}else if(M[Y])et=!0,j=nh(y,w,Y,q);else if(Y==="W")j=Mr(y,q,!q,!0);else if(Y==="w")j=Mr(y,q,!q,!1);else if(Y==="p")if(j=Io(y,w,C.repeat,0,q),C.linewise=!0,L.visualMode)L.visualLine||(L.visualLine=!0);else{var vt=L.inputState.operatorArgs;vt&&(vt.linewise=!0),j.end.line--}else if(Y==="t")j=Gl(y,w,q);else if(Y==="s"){var _t=y.getLine(w.line);w.ch>0&&at(_t[w.ch])&&(w.ch-=1);var ct=Mo(y,w,C.repeat,1,q),ht=Mo(y,w,C.repeat,-1,q);gt(y.getLine(ht.line)[ht.ch])&>(y.getLine(ct.line)[ct.ch-1])&&(ht={line:ht.line,ch:ht.ch+1}),j={start:ht,end:ct}}return j?y.state.vim.visualMode?zl(y,j.start,j.end,et):[j.start,j.end]:null},repeatLastCharacterSearch:function(y,w,C){var L=Ct.lastCharacterSearch,I=C.repeat,M=C.forward===L.forward,Y=(L.increment?1:0)*(M?-1:1);y.moveH(-Y,"char"),C.inclusive=!!M;var q=$r(y,I,M,L.selectedCharacter);return q?(q.ch+=Y,q):(y.moveH(Y,"char"),w)}};function Dt(y,w){ot[y]=w}function Xt(y,w){for(var C=[],L=0;Ly.lastLine()&&w.linewise&&!vt?y.replaceRange("",tt,q):y.replaceRange("",Y,q),w.linewise&&(vt||(y.setCursor(tt),i.commands.newlineAndIndent(y)),Y.ch=Number.MAX_VALUE),L=Y}Ct.registerController.pushText(w.registerName,"change",I,w.linewise,C.length>1),fe.enterInsertMode(y,{head:L},y.state.vim)},delete:function(y,w,C){var L,I,M=y.state.vim;if(M.visualBlock){I=y.getSelection();var j=Xt("",C.length);y.replaceSelections(j),L=We(C[0].head,C[0].anchor)}else{var Y=C[0].anchor,q=C[0].head;w.linewise&&q.line!=y.firstLine()&&Y.line==y.lastLine()&&Y.line==q.line-1&&(Y.line==y.firstLine()?Y.ch=0:Y=new t(Y.line-1,st(y,Y.line-1))),I=y.getRange(Y,q),y.replaceRange("",Y,q),L=Y,w.linewise&&(L=ot.moveToFirstNonWhiteSpaceCharacter(y,Y))}return Ct.registerController.pushText(w.registerName,"delete",I,w.linewise,M.visualBlock),be(y,L)},indent:function(y,w,C){var L=y.state.vim;if(y.indentMore)for(var I=L.visualMode?w.repeat:1,M=0;Met.top?(j.line+=(q-et.top)/I,j.line=Math.ceil(j.line),y.setCursor(j),et=y.charCoords(j,"local"),y.scrollTo(null,et.top)):y.scrollTo(null,q);else{var tt=q+y.getScrollInfo().clientHeight;tt=I.anchor.line?M=pe(I.head,0,1):M=new t(I.anchor.line,0)}else if(L=="inplace"){if(C.visualMode)return}else L=="lastEdit"&&(M=St(y)||M);y.setOption("disableInput",!1),w&&w.replace?(y.toggleOverwrite(!0),y.setOption("keyMap","vim-replace"),i.signal(y,"vim-mode-change",{mode:"replace"})):(y.toggleOverwrite(!1),y.setOption("keyMap","vim-insert"),i.signal(y,"vim-mode-change",{mode:"insert"})),Ct.macroModeState.isPlaying||(y.on("change",Sn),C.insertEnd&&C.insertEnd.clear(),C.insertEnd=y.setBookmark(M,{insertLeft:!0}),i.on(y.getInputField(),"keydown",Cf)),C.visualMode&&Ni(y),$n(y,M,Y)}},toggleVisualMode:function(y,w,C){var L=w.repeat,I=y.getCursor(),M;if(C.visualMode)C.visualLine^w.linewise||C.visualBlock^w.blockwise?(C.visualLine=!!w.linewise,C.visualBlock=!!w.blockwise,i.signal(y,"vim-mode-change",{mode:"visual",subMode:C.visualLine?"linewise":C.visualBlock?"blockwise":""}),Qn(y)):Ni(y);else{C.visualMode=!0,C.visualLine=!!w.linewise,C.visualBlock=!!w.blockwise,M=be(y,new t(I.line,I.ch+L-1));var Y=n(y,I,M);C.sel={anchor:Y.start,head:Y.end},i.signal(y,"vim-mode-change",{mode:"visual",subMode:C.visualLine?"linewise":C.visualBlock?"blockwise":""}),Qn(y),Hi(y,C,"<",We(I,M)),Hi(y,C,">",ui(I,M))}},reselectLastSelection:function(y,w,C){var L=C.lastSelection;if(C.visualMode&&Ao(y,C),L){var I=L.anchorMark.find(),M=L.headMark.find();if(!I||!M)return;C.sel={anchor:I,head:M},C.visualMode=!0,C.visualLine=L.visualLine,C.visualBlock=L.visualBlock,Qn(y),Hi(y,C,"<",We(I,M)),Hi(y,C,">",ui(I,M)),i.signal(y,"vim-mode-change",{mode:"visual",subMode:C.visualLine?"linewise":C.visualBlock?"blockwise":""})}},joinLines:function(y,w,C){var L,I;if(C.visualMode){if(L=y.getCursor("anchor"),I=y.getCursor("head"),Le(I,L)){var M=I;I=L,L=M}I.ch=st(y,I.line)-1}else{var Y=Math.max(w.repeat,2);L=y.getCursor(),I=be(y,new t(L.line+Y-1,1/0))}for(var q=0,j=L.line;j{this.continuePaste(y,w,C,M,L)});else{var I=L.toString();this.continuePaste(y,w,C,I,L)}},continuePaste:function(y,w,C,L,I){var M=le(y.getCursor());if(L){if(w.matchIndent){var Y=y.getOption("tabSize"),q=function(Ue){var ze=Ue.split(" ").length-1,Xn=Ue.split(" ").length-1;return ze*Y+Xn*1},j=y.getLine(y.getCursor().line),et=q(j.match(/^\s*/)[0]),tt=L.replace(/\n$/,""),vt=L!==tt,_t=q(L.match(/^\s*/)[0]),L=tt.replace(/^\s*/gm,function(Ue){var ze=et+(q(Ue)-_t);if(ze<0)return"";if(y.getOption("indentWithTabs")){var Xn=Math.floor(ze/Y);return Array(Xn+1).join(" ")}else return Array(ze+1).join(" ")});L+=vt?` `:""}if(w.repeat>1)var L=Array(w.repeat+1).join(L);var ct=I.linewise,ht=I.blockwise;if(ht){L=L.split(` `),ct&&L.pop();for(var Bt=0;Bty.lastLine()&&y.replaceRange(` -`,new t(me,0));var ve=st(y,me);vej.length&&(M=j.length),Y=new t(I.line,M)}var et=n(y,I,Y);if(I=et.start,Y=et.end,L==` +`,new t(me,0));var ye=st(y,me);yej.length&&(M=j.length),Y=new t(I.line,M)}var et=n(y,I,Y);if(I=et.start,Y=et.end,L==` `)C.visualMode||y.replaceRange("",I,Y),(i.commands.newlineAndIndentContinueComment||i.commands.newlineAndIndent)(y);else{var tt=y.getRange(I,Y);if(tt=tt.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,L),tt=tt.replace(/[^\n]/g,L),C.visualBlock){var vt=new Array(y.getOption("tabSize")+1).join(" ");tt=y.getSelection(),tt=tt.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,L),tt=tt.replace(/\t/g,vt).replace(/[^\n]/g,L).split(` `),y.replaceSelections(tt)}else y.replaceRange(tt,I,Y);C.visualMode?(I=Le(q[0].anchor,q[0].head)?q[0].anchor:q[0].head,y.setCursor(I),Ni(y,!1)):y.setCursor(pe(Y,0,-1))}},incrementNumberToken:function(y,w){for(var C=y.getCursor(),L=y.getLine(C.line),I=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi,M,Y,q,j;(M=I.exec(L))!==null&&(Y=M.index,q=Y+M[0].length,!(C.chj&&(tt=-1),j+=tt,j>q&&(j-=2)}return new t(M,j)}function wi(y){var w={};for(var C in y)y.hasOwnProperty(C)&&(w[C]=y[C]);return w}function pe(y,w,C){return typeof w=="object"&&(C=w.ch,w=w.line),new t(y.line+w,y.ch+C)}function Vi(y,w,C,L){for(var I=L.operator,M,Y=[],q=[],j=xe?w.length-o:0,et=j;et"){var C=w.length-11,L=y.slice(0,C),I=w.slice(0,C);return L==I&&y.length>C?"full":I.indexOf(L)==0?"partial":!1}else return y==w?"full":w.indexOf(y)==0?"partial":!1}function sn(y){var w=/^.*(<[^>]+>)$/.exec(y),C=w?w[1]:y.slice(-1);if(C.length>1)switch(C){case"":C=` `;break;case"":C=" ";break;default:C="";break}return C}function on(y,w,C){return function(){for(var L=0;L2&&(w=We.apply(void 0,Array.prototype.slice.call(arguments,1))),Le(y,w)?y:w}function ui(y,w){return arguments.length>2&&(w=ui.apply(void 0,Array.prototype.slice.call(arguments,1))),Le(y,w)?w:y}function wn(y,w,C){var L=Le(y,w),I=Le(w,C);return L&&I}function st(y,w){return y.getLine(w).length}function dt(y){return y.trim?y.trim():y.replace(/^\s+|\s+$/g,"")}function Lt(y){return y.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function ne(y,w,C){var L=st(y,w),I=new Array(C-L+1).join(" ");y.setCursor(new t(w,L)),y.replaceRange(I,y.getCursor())}function ei(y,w){var C=[],L=y.listSelections(),I=le(y.clipPos(w)),M=!Ze(w,I),Y=y.getCursor("head"),q=_s(L,Y),j=Ze(L[q].head,L[q].anchor),et=L.length-1,tt=et-q>q?et:0,vt=L[tt].anchor,_t=Math.min(vt.line,I.line),ct=Math.max(vt.line,I.line),ht=vt.ch,Bt=I.ch,At=L[tt].head.ch-ht,Ht=Bt-ht;At>0&&Ht<=0?(ht++,M||Bt--):At<0&&Ht>=0?(ht--,j||Bt++):At<0&&Ht==-1&&(ht--,Bt++);for(var ie=_t;ie<=ct;ie++){var Vt={anchor:new t(ie,ht),head:new t(ie,Bt)};C.push(Vt)}return y.setSelections(C),w.ch=Bt,vt.ch=ht,vt}function $n(y,w,C){for(var L=[],I=0;Ij&&(I.line=j),I.ch=st(y,I.line)}return{ranges:[{anchor:M,head:I}],primary:0}}else if(C=="block"){var et=Math.min(M.line,I.line),tt=M.ch,vt=Math.max(M.line,I.line),_t=I.ch;tt<_t?_t+=1:tt+=1;for(var ct=vt-et+1,ht=I.line==et?0:ct-1,Bt=[],At=0;At1)return"Invalid arguments";M=Oi&&"decimal"||Ue&&"hex"||ze&&"octal"}ve[2]&&(Y=new RegExp(ve[2].substr(1,ve[2].length-2),L?"i":""))}}var j=q();if(j){Pe(y,j+": "+w.argString);return}var et=w.line||y.firstLine(),tt=w.lineEnd||w.line||y.lastLine();if(et==tt)return;var vt=new t(et,0),_t=new t(tt,st(y,tt)),ct=y.getRange(vt,_t).split(` -`),ht=Y||(M=="decimal"?/(-?)([\d]+)/:M=="hex"?/(-?)(?:0x)?([0-9a-f]+)/i:M=="octal"?/([0-7]+)/:null),Bt=M=="decimal"?10:M=="hex"?16:M=="octal"?8:null,At=[],Ht=[];if(M||Y)for(var ie=0;ie1)return"Invalid arguments";M=Oi&&"decimal"||Ue&&"hex"||ze&&"octal"}ye[2]&&(Y=new RegExp(ye[2].substr(1,ye[2].length-2),L?"i":""))}}var j=q();if(j){Pe(y,j+": "+w.argString);return}var et=w.line||y.firstLine(),tt=w.lineEnd||w.line||y.lastLine();if(et==tt)return;var vt=new t(et,0),_t=new t(tt,st(y,tt)),ct=y.getRange(vt,_t).split(` +`),ht=Y||(M=="decimal"?/(-?)([\d]+)/:M=="hex"?/(-?)(?:0x)?([0-9a-f]+)/i:M=="octal"?/([0-7]+)/:null),Bt=M=="decimal"?10:M=="hex"?16:M=="octal"?8:null,At=[],Ht=[];if(M||Y)for(var ie=0;ie=et){Pe(y,"Invalid argument: "+w.argString.substring(I));return}for(var tt=0;tt<=et-j;tt++){var vt=String.fromCharCode(j+tt);delete C.marks[vt]}}else{Pe(y,"Invalid argument: "+Y+"-");return}}else delete C.marks[M]}}},jt=new Ot;function ue(y,w,C,L,I,M,Y,q,j){y.state.vim.exMode=!0;var et=!1,tt,vt,_t;function ct(){y.operation(function(){for(;!et;)ht(),At();Ht()})}function ht(){var Vt=y.getRange(M.from(),M.to()),$e=Vt.replace(Y,q),fi=M.to().line;M.replace($e),vt=M.to().line,I+=vt-fi,_t=vt1&&(Pf(y,C,C.insertModeRepeat-1,!0),C.lastEditInputState.repeatOverride=C.insertModeRepeat),delete C.insertModeRepeat,C.insertMode=!1,w||y.setCursor(y.getCursor().line,y.getCursor().ch-1),y.setOption("keyMap","vim"),y.setOption("disableInput",!0),y.toggleOverwrite(!1),I.setText(Y.changes.join("")),i.signal(y,"vim-mode-change",{mode:"normal"}),L.isRecording&&ch(L)}function Se(y){r.unshift(y)}function ci(y,w,C,L,I){var M={keys:y,type:w};M[w]=C,M[w+"Args"]=L;for(var Y in I)M[Y]=I[Y];Se(M)}Pt("insertModeEscKeysTimeout",200,"number"),i.keyMap["vim-insert"]={fallthrough:["default"],attach:c,detach:u,call:d},i.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:c,detach:u};function Fi(y,w,C,L){var I=Ct.registerController.getRegister(L);if(L==":"){I.keyBuffer[0]&&jt.processCommand(y,I.keyBuffer[0]),C.isPlaying=!1;return}var M=I.keyBuffer,Y=0;C.isPlaying=!0,C.replaySearchQueries=I.searchQueries.slice(0);for(var q=0;q|<\w+>|./.exec(j),tt=et[0],j=j.substring(et.index+tt.length),te.handleKey(y,tt,"macro"),w.insertMode){var vt=I.insertModeChanges[Y++].changes;Ct.macroModeState.lastInsertModeChanges.changes=vt,Lf(y,vt,1),ee(y)}C.isPlaying=!1}function Fn(y,w){if(!y.isPlaying){var C=y.latestRegister,L=Ct.registerController.getRegister(C);L&&L.pushText(w)}}function ch(y){if(!y.isPlaying){var w=y.latestRegister,C=Ct.registerController.getRegister(w);C&&C.pushInsertModeChanges&&C.pushInsertModeChanges(y.lastInsertModeChanges)}}function fh(y,w){if(!y.isPlaying){var C=y.latestRegister,L=Ct.registerController.getRegister(C);L&&L.pushSearchQuery&&L.pushSearchQuery(w)}}function Sn(y,w){var C=Ct.macroModeState,L=C.lastInsertModeChanges;if(!C.isPlaying)for(var I=y.state.vim;w;){if(L.expectCursorActivityForChange=!0,L.ignoreCount>1)L.ignoreCount--;else if(w.origin=="+input"||w.origin=="paste"||w.origin===void 0){var M=y.listSelections().length;M>1&&(L.ignoreCount=M);var Y=w.text.join(` +`));return}var ht=0,Bt=function(){if(ht=et){Pe(y,"Invalid argument: "+w.argString.substring(I));return}for(var tt=0;tt<=et-j;tt++){var vt=String.fromCharCode(j+tt);delete C.marks[vt]}}else{Pe(y,"Invalid argument: "+Y+"-");return}}else delete C.marks[M]}}},jt=new Ot;function ue(y,w,C,L,I,M,Y,q,j){y.state.vim.exMode=!0;var et=!1,tt,vt,_t;function ct(){y.operation(function(){for(;!et;)ht(),At();Ht()})}function ht(){var Vt=y.getRange(M.from(),M.to()),$e=Vt.replace(Y,q),fi=M.to().line;M.replace($e),vt=M.to().line,I+=vt-fi,_t=vt1&&(Pf(y,C,C.insertModeRepeat-1,!0),C.lastEditInputState.repeatOverride=C.insertModeRepeat),delete C.insertModeRepeat,C.insertMode=!1,w||y.setCursor(y.getCursor().line,y.getCursor().ch-1),y.setOption("keyMap","vim"),y.setOption("disableInput",!0),y.toggleOverwrite(!1),I.setText(Y.changes.join("")),i.signal(y,"vim-mode-change",{mode:"normal"}),L.isRecording&&ch(L)}function Se(y){r.unshift(y)}function ci(y,w,C,L,I){var M={keys:y,type:w};M[w]=C,M[w+"Args"]=L;for(var Y in I)M[Y]=I[Y];Se(M)}Pt("insertModeEscKeysTimeout",200,"number"),i.keyMap["vim-insert"]={fallthrough:["default"],attach:c,detach:u,call:d},i.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:c,detach:u};function Fi(y,w,C,L){var I=Ct.registerController.getRegister(L);if(L==":"){I.keyBuffer[0]&&jt.processCommand(y,I.keyBuffer[0]),C.isPlaying=!1;return}var M=I.keyBuffer,Y=0;C.isPlaying=!0,C.replaySearchQueries=I.searchQueries.slice(0);for(var q=0;q|<\w+>|./.exec(j),tt=et[0],j=j.substring(et.index+tt.length),te.handleKey(y,tt,"macro"),w.insertMode){var vt=I.insertModeChanges[Y++].changes;Ct.macroModeState.lastInsertModeChanges.changes=vt,Lf(y,vt,1),ee(y)}C.isPlaying=!1}function Fn(y,w){if(!y.isPlaying){var C=y.latestRegister,L=Ct.registerController.getRegister(C);L&&L.pushText(w)}}function ch(y){if(!y.isPlaying){var w=y.latestRegister,C=Ct.registerController.getRegister(w);C&&C.pushInsertModeChanges&&C.pushInsertModeChanges(y.lastInsertModeChanges)}}function fh(y,w){if(!y.isPlaying){var C=y.latestRegister,L=Ct.registerController.getRegister(C);L&&L.pushSearchQuery&&L.pushSearchQuery(w)}}function Sn(y,w){var C=Ct.macroModeState,L=C.lastInsertModeChanges;if(!C.isPlaying)for(var I=y.state.vim;w;){if(L.expectCursorActivityForChange=!0,L.ignoreCount>1)L.ignoreCount--;else if(w.origin=="+input"||w.origin=="paste"||w.origin===void 0){var M=y.listSelections().length;M>1&&(L.ignoreCount=M);var Y=w.text.join(` `);if(L.maybeReset&&(L.changes=[],L.maybeReset=!1),Y)if(y.state.overwrite&&!/\n/.test(Y))L.changes.push([Y]);else{if(Y.length>1){var q=I&&I.insertEnd&&I.insertEnd.find(),j=y.getCursor();if(q&&q.line==j.line){var et=q.ch-j.ch;et>0&&et",ui(L,C))}else w.insertMode||(w.lastHPos=y.getCursor().ch)}function dh(y){this.keyName=y}function Cf(y){var w=Ct.macroModeState,C=w.lastInsertModeChanges,L=i.keyName(y);if(!L)return;function I(){return C.maybeReset&&(C.changes=[],C.maybeReset=!1),C.changes.push(new dh(L)),!0}(L.indexOf("Delete")!=-1||L.indexOf("Backspace")!=-1)&&i.lookupKey(L,"vim-insert",I)}function Pf(y,w,C,L){var I=Ct.macroModeState;I.isPlaying=!0;var M=!!w.lastEditActionCommand,Y=w.inputState;function q(){M?wt.processAction(y,w,w.lastEditActionCommand):wt.evalInput(y,w)}function j(tt){if(I.lastInsertModeChanges.changes.length>0){tt=w.lastEditActionCommand?tt:1;var vt=I.lastInsertModeChanges;Lf(y,vt.changes,tt)}}if(w.inputState=w.lastEditInputState,M&&w.lastEditActionCommand.interlaceInsertRepeat)for(var et=0;et"&&!I.insertMode&&!I.visualMode&&Y&&I.status=="")ut(y);else if(M||!Y||y.inVirtualSelectionMode)L=te.handleKey(y,w,C);else{var q=ph(I),j=I.inputState.changeQueueList||[];y.operation(function(){y.curOp.isVimOp=!0;var et=0;y.forEachSelection(function(){y.state.vim.inputState.changeQueue=j[et];var tt=y.getCursor("head"),vt=y.getCursor("anchor"),_t=Le(tt,vt)?0:-1,ct=Le(tt,vt)?-1:0;tt=pe(tt,0,_t),vt=pe(vt,0,ct),y.state.vim.sel.head=tt,y.state.vim.sel.anchor=vt,L=te.handleKey(y,w,C),y.virtualSelection&&(j[et]=y.state.vim.inputState.changeQueue,y.state.vim=ph(q)),et++}),y.curOp.cursorActivity&&!L&&(y.curOp.cursorActivity=!1),y.state.vim=I,I.inputState.changeQueueList=j,I.inputState.changeQueue=null},!0)}return L&&!I.visualMode&&!I.insert&&I.visualMode!=y.somethingSelected()&&Sf(y,I),L}return Wt(),te}function _i(i,t){var e=t.ch,n=t.line+1;n<1&&(n=1,e=0),n>i.lines&&(n=i.lines,e=Number.MAX_VALUE);var r=i.line(n);return Math.min(r.from+Math.max(0,e),r.to)}function Xi(i,t){let e=i.lineAt(t);return{line:e.number-1,ch:t-e.from}}class ul{constructor(t,e){this.line=t,this.ch=e}}function By(i,t,e){if(i.addEventListener)i.addEventListener(t,e,!1);else{var n=i._handlers||(i._handlers={});n[t]=(n[t]||[]).concat(e)}}function Fy(i,t,e){if(i.removeEventListener)i.removeEventListener(t,e,!1);else{var n=i._handlers,r=n&&n[t];if(r){var o=r.indexOf(e);o>-1&&(n[t]=r.slice(0,o).concat(r.slice(o+1)))}}}function Xy(i,t,...e){var n,r=(n=i._handlers)===null||n===void 0?void 0:n[t];if(r)for(var o=0;o({anchor:Xi(t,e.anchor),head:Xi(t,e.head)}))}setSelections(t,e){var n=this.cm6.state.doc,r=t.map(o=>yt.range(_i(n,o.anchor),_i(n,o.head)));this.cm6.dispatch({selection:yt.create(r,e)})}setSelection(t,e,n){var r=this.cm6.state.doc,o=[yt.range(_i(r,t),_i(r,e))];this.cm6.dispatch({selection:yt.create(o,0)}),n&&n.origin=="*mouse"&&this.onBeforeEndOperation()}getLine(t){var e=this.cm6.state.doc;return t<0||t>=e.lines?"":this.cm6.state.doc.line(t+1).text}getLineHandle(t){return this.$lineHandleChanges||(this.$lineHandleChanges=[]),{row:t,index:this.indexFromPos(new ul(t,0))}}getLineNumber(t){var e=this.$lineHandleChanges;if(!e)return null;for(var n=t.index,r=0;r({from:r.from,to:r.to,insert:t[o]||""}));Ys(this,{changes:n})}getSelection(){return this.getSelections().join(` `)}getSelections(){var t=this.cm6;return t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to))}somethingSelected(){return this.cm6.state.selection.ranges.some(t=>!t.empty)}getInputField(){return this.cm6.contentDOM}clipPos(t){var e=this.cm6.state.doc,n=t.ch,r=t.line+1;r<1&&(r=1,n=0),r>e.lines&&(r=e.lines,n=Number.MAX_VALUE);var o=e.line(r);return n=Math.min(Math.max(0,n),o.to-o.from),new ul(r-1,n)}getValue(){return this.cm6.state.doc.toString()}setValue(t){var e=this.cm6;return e.dispatch({changes:{from:0,to:e.state.doc.length,insert:t},selection:yt.range(0,0)})}focus(){return this.cm6.focus()}blur(){return this.cm6.contentDOM.blur()}defaultTextHeight(){return this.cm6.defaultLineHeight}findMatchingBracket(t){var e=this.cm6.state,n=_i(e.doc,t),r=Wi(e,n+1,-1);return r&&r.end?{to:Xi(e.doc,r.end.from)}:(r=Wi(e,n,1),r&&r.end?{to:Xi(e.doc,r.end.from)}:{to:void 0})}scanForBracket(t,e,n,r){return W2(this,t,e,n,r)}indentLine(t,e){e?this.indentMore():this.indentLess()}indentMore(){nf(this.cm6)}indentLess(){rf(this.cm6)}execCommand(t){t=="indentAuto"?de.commands.indentAuto(this):t=="goLineLeft"?Qv(this.cm6):t=="goLineRight"?($v(this.cm6),LS(this.cm6)):console.log(t+" is not implemented")}setBookmark(t,e){var n=e!=null&&e.insertLeft?1:-1,r=this.indexFromPos(t),o=new j2(this,r,n);return o}addOverlay({query:t}){let e=new af({regexp:!0,search:t.source,caseSensitive:!/i/.test(t.flags)});if(e.valid){e.forVim=!0,this.cm6Query=e;let n=ar.of(e);return this.cm6.dispatch({effects:n}),e}}removeOverlay(t){if(!this.cm6Query)return;this.cm6Query.forVim=!1;let e=ar.of(this.cm6Query);this.cm6.dispatch({effects:e})}getSearchCursor(t,e){var n=this,r=null,o=null;e.ch==null&&(e.ch=Number.MAX_VALUE);var s=_i(n.cm6.state.doc,e),a=t.source.replace(/(\\.|{(?:\d+(?:,\d*)?|,\d+)})|[{}]/g,function(f,g){return g||"\\"+f});function l(f,g=0,x=f.length){return new of(f,a,{ignoreCase:t.ignoreCase},g,x)}function u(f){var g=n.cm6.state.doc;if(f>g.length)return null;let x=l(g,f).next();return x.done?null:x.value}var c=1e4;function d(f,g){var x=n.cm6.state.doc;for(let m=1;;m++){let v=Math.max(f,g-m*c),O=l(x,v,g),b=null;for(;!O.next().done;)b=O.value;if(b&&(v==f||b.from>v+10))return b;if(v==f)return null}}return{findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(f){var g=n.cm6.state.doc;if(f){let x=r?r.from==r.to?r.to-1:r.from:s;r=d(0,x)}else{let x=r?r.from==r.to?r.to+1:r.to:s;r=u(x)}return o=r&&{from:Xi(g,r.from),to:Xi(g,r.to),match:r.match},r&&r.match},from:function(){return o==null?void 0:o.from},to:function(){return o==null?void 0:o.to},replace:function(f){r&&(Ys(n,{changes:{from:r.from,to:r.to,insert:f}}),r.to=r.from+f.length,o&&(o.to=Xi(n.cm6.state.doc,r.to)))}}}findPosV(t,e,n,r){let{cm6:o}=this;const s=o.state.doc;let a=n=="page"?o.dom.clientHeight:0;const l=_i(s,t);let u=yt.range(l,l,r),c=Math.round(Math.abs(e));for(let f=0;f0,a):n=="line"&&(u=o.moveVertically(u,e>0));let d=Xi(s,u.head);return(e<0&&u.head==0&&r!=0&&t.line==0&&t.ch!=0||e>0&&u.head==s.length&&d.ch!=r&&t.line==d.line)&&(d.hitSide=!0),d}charCoords(t,e){var n=this.cm6.contentDOM.getBoundingClientRect(),r=_i(this.cm6.state.doc,t),o=this.cm6.coordsAtPos(r),s=-n.top;return{left:((o==null?void 0:o.left)||0)-n.left,top:((o==null?void 0:o.top)||0)+s,bottom:((o==null?void 0:o.bottom)||0)+s}}coordsChar(t,e){var n=this.cm6.contentDOM.getBoundingClientRect(),r=this.cm6.posAtCoords({x:t.left+n.left,y:t.top+n.top})||0;return Xi(this.cm6.state.doc,r)}getScrollInfo(){var t=this.cm6.scrollDOM;return{left:t.scrollLeft,top:t.scrollTop,height:t.scrollHeight,width:t.scrollWidth,clientHeight:t.clientHeight,clientWidth:t.clientWidth}}scrollTo(t,e){t!=null&&(this.cm6.scrollDOM.scrollLeft=t),e!=null&&(this.cm6.scrollDOM.scrollTop=e)}scrollIntoView(t,e){if(t){var n=this.indexFromPos(t);this.cm6.dispatch({effects:Rt.scrollIntoView(n)})}else this.cm6.dispatch({scrollIntoView:!0,userEvent:"scroll"})}getWrapperElement(){return this.cm6.dom}getMode(){return{name:this.getOption("mode")}}setSize(t,e){this.cm6.dom.style.width=t+4+"px",this.cm6.dom.style.height=e+"px",this.refresh()}refresh(){this.cm6.measure()}destroy(){this.removeOverlay()}getLastEditEnd(){return this.posFromIndex(this.$lastChangeEndOffset)}onChange(t){this.$lineHandleChanges&&this.$lineHandleChanges.push(t);for(let n in this.marks)this.marks[n].update(t.changes);this.virtualSelection&&(this.virtualSelection.ranges=this.virtualSelection.ranges.map(n=>n.map(t.changes)));var e=this.curOp=this.curOp||{};t.changes.iterChanges((n,r,o,s,a)=>{(e.$changeStart==null||e.$changeStart>o)&&(e.$changeStart=o),this.$lastChangeEndOffset=s;var l={text:a.toJSON()};e.lastChange?e.lastChange.next=e.lastChange=l:e.lastChange=e.change=l},!0),e.changeHandlers||(e.changeHandlers=this._handlers.change&&this._handlers.change.slice())}onSelectionChange(){var t=this.curOp=this.curOp||{};t.cursorActivityHandlers||(t.cursorActivityHandlers=this._handlers.cursorActivity&&this._handlers.cursorActivity.slice()),this.curOp.cursorActivity=!0}operation(t){this.curOp||(this.curOp={$d:0}),this.curOp.$d++;try{var e=t()}finally{this.curOp&&(this.curOp.$d--,this.curOp.$d||this.onBeforeEndOperation())}return e}onBeforeEndOperation(){var t=this.curOp,e=!1;t&&(t.change&&zp(t.changeHandlers,this,t.change),t&&t.cursorActivity&&(zp(t.cursorActivityHandlers,this,null),t.isVimOp&&(e=!0)),this.curOp=null),e&&this.scrollIntoView()}moveH(t,e){if(e=="char"){var n=this.getCursor();this.setCursor(n.line,n.ch+t)}}setOption(t,e){switch(t){case"keyMap":this.state.keyMap=e;break}}getOption(t){switch(t){case"firstLineNumber":return 1;case"tabSize":return this.cm6.state.tabSize||4;case"readonly":return this.cm6.state.readOnly;case"indentWithTabs":return this.cm6.state.facet(Tr)==" ";case"indentUnit":return this.cm6.state.facet(Tr).length||2;case"keyMap":return this.state.keyMap||"vim"}}toggleOverwrite(t){this.state.overwrite=t}getTokenTypeAt(t){var e,n=this.indexFromPos(t),r=zc(this.cm6.state,n),o=r==null?void 0:r.resolve(n),s=((e=o==null?void 0:o.type)===null||e===void 0?void 0:e.name)||"";return/comment/i.test(s)?"comment":/string/i.test(s)?"string":""}overWriteSelection(t){var e=this.cm6.state.doc,n=this.cm6.state.selection,r=n.ranges.map(o=>{if(o.empty){var s=o.to1}virtualSelectionMode(){return!!this.virtualSelection}forEachSelection(t){var e=this.cm6.state.selection;this.virtualSelection=yt.create(e.ranges,e.mainIndex);for(var n=0;nYs(i,t)})},indentAuto:function(i){ty(i.cm6)}};de.defineOption=function(i,t,e){};de.isWordChar=function(i){return gc.test(i)};de.keys=F2;de.keyMap={};de.addClass=function(){};de.rmClass=function(){};de.e_preventDefault=function(i){i.preventDefault()};de.e_stop=function(i){var t,e;(t=i==null?void 0:i.stopPropagation)===null||t===void 0||t.call(i),(e=i==null?void 0:i.preventDefault)===null||e===void 0||e.call(i)};de.keyName=function(i){var t=i.key;if(!Ry[t]){t=="Escape"&&(t="Esc"),t==" "&&(t="Space"),t.length>1&&(t=t.replace(/Numpad|Arrow/,"")),t.length==1&&(t=t.toUpperCase());var e="";return i.ctrlKey&&(e+="Ctrl-"),i.altKey&&(e+="Alt-"),(e||t.length>1)&&i.shiftKey&&(e+="Shift-"),e+=t,e}};de.vimKey=function(t){var e=t.key;if(!Ry[e]){e.length>1&&e[0]=="n"&&(e=e.replace("Numpad","")),e=B2[e]||e;var n="";return t.ctrlKey&&(n+="C-"),t.altKey&&(n+="A-"),t.metaKey&&(n+="M-"),de.isMac&&t.altKey&&!t.metaKey&&!t.ctrlKey&&(n=n.slice(2)),(n||e.length>1)&&t.shiftKey&&(n+="S-"),n+=e,n.length>1&&(n="<"+n+">"),n}};de.lookupKey=function(t,e,n){var r=de.keys[t];r&&n(r)};de.on=By;de.off=Fy;de.signal=Xy;de.findMatchingTag=U2;de.findEnclosingTag=z2;function Yy(i,t,e){var n=document.createElement("div");return n.appendChild(t),n}function Zy(i,t){i.state.currentNotificationClose&&i.state.currentNotificationClose(),i.state.currentNotificationClose=t}function X2(i,t,e){Zy(i,a);var n=Yy(i,t,e&&e.bottom),r=!1,o,s=e&&typeof e.duration<"u"?e.duration:5e3;function a(){r||(r=!0,clearTimeout(o),n.remove(),Uy(i,n))}return n.onclick=function(l){l.preventDefault(),a()},Wy(i,n),s&&(o=setTimeout(a,s)),a}function Wy(i,t){var e=i.state.dialog;i.state.dialog=t,t&&e!==t&&(e&&e.contains(document.activeElement)&&i.focus(),e&&e.parentElement?e.parentElement.replaceChild(t,e):e&&e.remove(),de.signal(i,"dialog"))}function Uy(i,t){i.state.dialog==t&&(i.state.dialog=null,de.signal(i,"dialog"))}function R2(i,t,e,n){n||(n={}),Zy(i,void 0);var r=Yy(i,t,n.bottom),o=!1;Wy(i,r);function s(l){if(typeof l=="string")a.value=l;else{if(o)return;o=!0,Uy(i,r),i.state.dialog||i.focus(),n.onClose&&n.onClose(r)}}var a=r.getElementsByTagName("input")[0];return a&&(n.value&&(a.value=n.value,n.selectValueOnOpen!==!1&&a.select()),n.onInput&&de.on(a,"input",function(l){n.onInput(l,a.value,s)}),n.onKeyUp&&de.on(a,"keyup",function(l){n.onKeyUp(l,a.value,s)}),de.on(a,"keydown",function(l){n&&n.onKeyDown&&n.onKeyDown(l,a.value,s)||(l.keyCode==13&&e(a.value),(l.keyCode==27||n.closeOnEnter!==!1&&l.keyCode==13)&&(a.blur(),de.e_stop(l),s()))}),n.closeOnBlur!==!1&&de.on(a,"blur",function(){setTimeout(function(){document.activeElement!==a&&s()})}),a.focus()),s}var Y2={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function Z2(i){return i&&i.bracketRegex||/[(){}[\]]/}function W2(i,t,e,n,r){for(var o=r&&r.maxScanLineLength||1e4,s=r&&r.maxScanLines||1e3,a=[],l=Z2(r),u=e>0?Math.min(t.line+s,i.lastLine()+1):Math.max(i.firstLine()-1,t.line-s),c=t.line;c!=u;c+=e){var d=i.getLine(c);if(d){var f=e>0?0:d.length-1,g=e>0?d.length:-1;if(!(d.length>o))for(c==t.line&&(f=t.ch-(e<0?1:0));f!=g;f+=e){var x=d.charAt(f);if(l.test(x)){var m=Y2[x];if(m&&m.charAt(1)==">"==e>0)a.push(x);else if(a.length)a.pop();else return{pos:new ul(c,f),ch:x}}}}}return c-e==(e>0?i.lastLine():i.firstLine())?!1:null}function U2(i,t){}function z2(i,t){var e,n,r=i.cm6.state,o=i.indexFromPos(t);if(o!e.eq(this.cursors[n]))){let e=this.cursorLayer.children;if(e.length!==t.length){this.cursorLayer.textContent="";for(const n of t)this.cursorLayer.appendChild(n.draw())}else t.forEach((n,r)=>n.adjust(e[r]));this.cursors=t}}destroy(){this.cursorLayer.remove()}}const G2={".cm-vimMode .cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-fat-cursor":{position:"absolute",background:"#ff9696",border:"none",whiteSpace:"pre"},"&:not(.cm-focused) .cm-fat-cursor":{background:"none",outline:"solid 1px #ff9696",color:"transparent !important"}},H2=lr.highest(Rt.theme(G2));function J2(i){let t=i.scrollDOM.getBoundingClientRect();return{left:(i.textDirection==Me.LTR?t.left:t.right-i.scrollDOM.clientWidth)-i.scrollDOM.scrollLeft,top:t.top-i.scrollDOM.scrollTop}}function K2(i,t,e,n){let r=e.head,o=!1,s=1,a=i.state.vim;if(a&&(!a.insertMode||i.state.overwrite)){if(o=!0,a.visualBlock&&!n)return null;e.anchor1&&(r--,u=t.state.sliceDoc(r,r+1));let c=t.coordsAtPos(r,1);if(!c)return null;let d=J2(t),f=t.domAtPos(r),g=f?f.node:t.contentDOM;for(;f&&f.node instanceof HTMLElement;)g=f.node,f={node:f.node.childNodes[f.offset],offset:0};if(!(g instanceof HTMLElement)){if(!g.parentNode)return null;g=g.parentNode}let x=getComputedStyle(g),m=c.left;if(!u||u==` -`||u=="\r")u=" ";else if(u==" "){u=" ";var l=t.coordsAtPos(r+1,-1);l&&(m=l.left-(l.left-c.left)/parseInt(x.tabSize))}else/[\uD800-\uDBFF]/.test(u)&&r{t.state.vim&&(t.state.vim.status=""),this.blockCursor.scheduleRedraw(),this.updateStatus()}),this.cm.on("vim-mode-change",e=>{t.state.vim.mode=e.mode,e.subMode&&(t.state.vim.mode+=" block"),t.state.vim.status="",this.blockCursor.scheduleRedraw(),this.updateClass(),this.updateStatus()}),this.cm.on("dialog",()=>{this.cm.state.statusbar?this.updateStatus():i.dispatch({effects:zy.of(!!this.cm.state.dialog)})}),this.dom=document.createElement("span"),this.dom.style.cssText="position: absolute; right: 10px; top: 1px",this.statusButton=document.createElement("span"),this.statusButton.onclick=e=>{Ds.handleKey(this.cm,"","user"),this.cm.focus()},this.statusButton.style.cssText="cursor: pointer"}update(i){var t;if((i.viewportChanged||i.docChanged)&&this.query&&this.highlight(this.query),i.docChanged&&this.cm.onChange(i),i.selectionSet&&this.cm.onSelectionChange(),i.viewportChanged,this.cm.curOp&&!this.cm.curOp.isVimOp&&this.cm.onBeforeEndOperation(),i.transactions){for(let e of i.transactions)for(let n of e.effects)if(n.is(ar))if(!((t=n.value)===null||t===void 0?void 0:t.forVim))this.highlight(null);else{let o=n.value.create();this.highlight(o)}}this.blockCursor.update(i)}updateClass(){const i=this.cm.state;!i.vim||i.vim.insertMode&&!i.overwrite?this.view.scrollDOM.classList.remove("cm-vimMode"):this.view.scrollDOM.classList.add("cm-vimMode")}updateStatus(){let i=this.cm.state.statusbar,t=this.cm.state.vim;if(!i||!t)return;let e=this.cm.state.dialog;if(e)e.parentElement!=i&&(i.textContent="",i.appendChild(e));else{i.textContent="";var n=(t.mode||"normal").toUpperCase();t.insertModeReturn&&(n+="(C-O)"),this.statusButton.textContent=`--${n}--`,i.appendChild(this.statusButton)}this.dom.textContent=t.status,i.appendChild(this.dom)}destroy(){Ds.leaveVimMode(this.cm),this.updateClass(),this.blockCursor.destroy(),delete this.view.cm}highlight(i){if(this.query=i,!i)return this.decorations=Gt.none;let{view:t}=this,e=new _n;for(let n=0,r=t.visibleRanges,o=r.length;nr[n+1].from-2*ek;)a=r[++n].to;i.highlight(t.state,s,a,(l,u)=>{e.add(l,u,sk)})}return this.decorations=e.finish()}handleKey(i,t){const e=de.vimKey(i),n=this.cm;if(!e)return;let r=n.state.vim;if(!r)return;if(e==""&&!r.insertMode&&!r.visualMode&&this.query){const a=r.searchState_;a&&(n.removeOverlay(a.getOverlay()),a.setOverlay(null))}if(e===""&&!de.isMac&&n.somethingSelected())return this.waitForCopy=!0,!0;r.status=(r.status||"")+e;let s=Ds.multiSelectHandleKey(n,e,"user");return r=n.state.vim,!s&&r.insertMode&&n.state.overwrite&&(i.key&&i.key.length==1&&!/\n/.test(i.key)?(s=!0,n.overWriteSelection(i.key)):i.key=="Backspace"&&(s=!0,de.commands.cursorCharLeft(n))),s&&(de.signal(this.cm,"vim-keypress",e),i.preventDefault(),i.stopPropagation(),this.blockCursor.scheduleRedraw()),this.updateStatus(),!!s}},{eventHandlers:{copy:function(i,t){this.waitForCopy&&(this.waitForCopy=!1,Promise.resolve().then(()=>{var e=this.cm,n=e.state.vim;n&&(n.insertMode?e.setSelection(e.getCursor(),e.getCursor()):e.operation(()=>{e.curOp&&(e.curOp.isVimOp=!0),Ds.handleKey(e,"","user")}))}))},compositionstart:function(i,t){this.useNextTextInput=!0},keypress:function(i,t){this.lastKeydown=="Dead"&&this.handleKey(i,t)},keydown:function(i,t){this.lastKeydown=i.key,this.lastKeydown=="Unidentified"||this.lastKeydown=="Process"||this.lastKeydown=="Dead"?this.useNextTextInput=!0:(this.useNextTextInput=!1,this.handleKey(i,t))}},provide:()=>[Rt.inputHandler.of((i,t,e,n)=>{var r,o,s=uk(i);if(!s)return!1;var a=(r=s.state)===null||r===void 0?void 0:r.vim,l=s.state.vimPlugin;return a&&!a.insertMode&&!(!((o=s.curOp)===null||o===void 0)&&o.isVimOp)?(n==="\0\0"||(n.length==1&&l.useNextTextInput&&l.handleKey({key:n,preventDefault:()=>{},stopPropagation:()=>{}}),rk(i)),!0):!1})],decorations:i=>i.decorations});function rk(i){var t=i.scrollDOM.parentElement;if(t){if(tk){i.contentDOM.textContent="\0\0",i.contentDOM.dispatchEvent(new CustomEvent("compositionend"));return}var e=i.scrollDOM.nextSibling,n=window.getSelection(),r=n&&{anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset};i.scrollDOM.remove(),t.insertBefore(i.scrollDOM,e);try{r&&n&&(n.setPosition(r.anchorNode,r.anchorOffset),r.focusNode&&n.extend(r.focusNode,r.focusOffset))}catch(o){console.error(o)}i.focus(),i.contentDOM.dispatchEvent(new CustomEvent("compositionend"))}}const sk=Gt.mark({class:"cm-searchMatch"}),zy=re.define(),ok=ti.define({create:()=>!1,update(i,t){for(let e of t.effects)e.is(zy)&&(i=e.value);return i},provide:i=>Dr.from(i,t=>t?ak:null)});function ak(i){let t=document.createElement("div");t.className="cm-vim-panel";let e=i.cm;return e.state.dialog&&t.appendChild(e.state.dialog),{top:!1,dom:t}}function lk(i){let t=document.createElement("div");t.className="cm-vim-panel";let e=i.cm;return e.state.statusbar=t,e.state.vimPlugin.updateStatus(),{dom:t}}function hk(i={}){return[ik,nk,H2,i.status?Dr.of(lk):ok]}function uk(i){return i.cm||null}function jy(i,t=!1){const e=t?hk():wo.of([pC]),n=[jP,T2(),e,Tr.of(" "),Q2],r=ye.create({extensions:n}),o=new Rt({state:r,parent:i});return{state:r,view:o,foldRange(){},viewJumpTo:a=>{const l=a.index??o.state.doc.line(a.line).from+a.column;o.dispatch({selection:{anchor:l,head:a.length?l+a.length:l},effects:Rt.scrollIntoView(l,{x:"center",y:"center"})}),o.focus()}}}const ck=["./library/connectors/ESP8266_12E.json","./library/connectors/header_FTDI.json","./library/connectors/power_65mm.json","./library/connectors/ESP32_CAM.json","./library/connectors/USB_A_plug.json","./library/connectors/header_i0.json","./library/connectors/header_serial_reverse.json","./library/connectors/header_4.json","./library/connectors/header_signal.json","./library/connectors/MTA_i0.json","./library/connectors/HM11.json","./library/connectors/header_MFRC522.json","./library/connectors/header_serial_reverse_5V.json","./library/connectors/USB_mini_B.json","./library/connectors/ESC.json","./library/connectors/MTA_PS2.json","./library/connectors/header_APA.json","./library/connectors/MTA_ICP.json","./library/connectors/stereo_2_5mm.json","./library/connectors/header_VL53L1X_3415.json","./library/connectors/Molex_serial.json","./library/connectors/header_SWD_4_1.json","./library/connectors/ESP_01.json","./library/connectors/HCSR04.json","./library/connectors/header_SWD_4_05.json","./library/connectors/ESP32_WROOM.json","./library/connectors/header_serial.json","./library/connectors/header_PDI.json","./library/connectors/I2C4x1v.json","./library/connectors/header_power.json","./library/connectors/MTA_serial.json","./library/connectors/header_LSM6DS33_2736.json","./library/connectors/MTA_2.json","./library/connectors/MTA_3.json","./library/connectors/header_LCD.json","./library/connectors/screw_terminal_2.json","./library/connectors/HCSR501.json","./library/connectors/screw_terminal_i0.json","./library/connectors/header_unipolar_stepper.json","./library/connectors/screw_terminal_power.json","./library/connectors/header_nRF24L01.json","./library/connectors/header_serial_reverse_3V3.json","./library/connectors/MTA_power.json","./library/connectors/MTA_4.json","./library/connectors/RCWL0516.json","./library/connectors/ESP_WROOM_02D.json","./library/connectors/RN4871.json","./library/connectors/header_I2C.json","./library/connectors/header_SWD.json","./library/connectors/header_servo.json","./library/connectors/microSD.json","./library/connectors/header_4H.json","./library/connectors/header_UPDI.json","./library/connectors/I2C4x1i.json","./library/connectors/I2C4x1h.json","./library/connectors/header_ISP.json","./library/connectors/header_NEO_6M.json","./library/connectors/MTA_5.json","./library/connectors/header_6.json","./library/connectors/header_UPDI_reverse.json","./library/connectors/header_bus.json","./library/connectors/TFT8x1v.json","./library/connectors/header_2H.json","./library/connectors/header_ATP.json","./library/switches/button_6mm.json","./library/switches/slide_switch.json","./library/diodes_transistors_regulators_sensors/D_1206.json","./library/diodes_transistors_regulators_sensors/mic_SPM1437.json","./library/diodes_transistors_regulators_sensors/LED_1206.json","./library/diodes_transistors_regulators_sensors/NMOSFET_TO252AA.json","./library/diodes_transistors_regulators_sensors/regulator_SOT223.json","./library/diodes_transistors_regulators_sensors/regulator_SOT23.json","./library/diodes_transistors_regulators_sensors/VL53L1X.json","./library/diodes_transistors_regulators_sensors/H_bridge_SM8.json","./library/diodes_transistors_regulators_sensors/SPG08P4HM4H.json","./library/diodes_transistors_regulators_sensors/Hall_SOT23.json","./library/diodes_transistors_regulators_sensors/VEML6040.json","./library/diodes_transistors_regulators_sensors/phototransistor_1206.json","./library/diodes_transistors_regulators_sensors/LED_RGB.json","./library/diodes_transistors_regulators_sensors/accel_MXD6235M.json","./library/diodes_transistors_regulators_sensors/ADXL343.json","./library/diodes_transistors_regulators_sensors/mic_SPU0414HR5H.json","./library/diodes_transistors_regulators_sensors/D_SOD_123.json","./library/diodes_transistors_regulators_sensors/LED_3014_1100.json","./library/diodes_transistors_regulators_sensors/A4953_SOICN.json","./library/diodes_transistors_regulators_sensors/NMOSFET_SOT23.json","./library/diodes_transistors_regulators_sensors/phototransistor_PLCC2.json","./library/diodes_transistors_regulators_sensors/PMOSFET_SOT23.json","./library/diodes_transistors_regulators_sensors/DRV8428_HTSSOP.json","./library/diodes_transistors_regulators_sensors/CMM4030D261I2STR.json","./library/crystals_and_resonators/XTAL_CSM_7.json","./library/crystals_and_resonators/XTAL_NX5032GA.json","./library/crystals_and_resonators/XTAL_EFOBM.json","./library/discretes/R_0402.json","./library/discretes/ST4EB.json","./library/discretes/C_1206.json","./library/discretes/R_1206.json","./library/discretes/choke.json","./library/discretes/L_1210.json","./library/discretes/C_FND.json","./library/ICs/CBA.json","./library/ICs/SAMD21E.json","./library/ICs/AVRDB28.json","./library/ICs/FT230XS.json","./library/ICs/ATtiny1614.json","./library/ICs/fab.json","./library/ICs/ATtiny44_SOICN.json","./library/ICs/ATxmegaE5_TQFP.json","./library/ICs/op_amp_SOICN.json","./library/ICs/ATtiny45_SOIC.json","./library/ICs/ATmega88_TQFP.json","./library/ICs/SAMD11D.json","./library/ICs/TRC102.json","./library/ICs/ATtiny412.json","./library/ICs/ATmega644_TQFP.json","./library/ICs/op_amp_SOT23_5.json","./library/ICs/SAMD11C.json","./library/ICs/ATtiny3216.json","./library/ICs/xiao_copper.json"];function fk(){const i=new Int32Array(256);for(let t=0;t<256;t++){let e=t;for(let n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;i[t]=e}return i}function dk(i){let t=-1;jh||(jh=fk());for(let e=0;e>>8;return t^-1}let jh;const vc="image/png",yc="image/jpeg",pk="AAlwSFlz",mk="AAAJcEhZ",gk="AAAACXBI",qy="p".charCodeAt(0),Vy="H".charCodeAt(0),Gy="Y".charCodeAt(0),Hy="s".charCodeAt(0);function vk(i,t){const e=i.split(","),n=e[0],r=e[1];let o,s,a=!1;if(n.indexOf(vc)!==-1){o=vc;const x=yk(r);x>=0?(s=Math.ceil((x+28)/3)*4,a=!0):s=33/3*4}n.indexOf(yc)!==-1&&(o=yc,s=18/3*4);const l=r.substring(0,s),u=r.substring(s),c=atob(l),d=new Uint8Array(c.length);for(let x=0;x=4;e--)if(i[e-4]===9&&i[e-3]===qy&&i[e-2]===Vy&&i[e-1]===Gy&&i[e]===Hy)return e-3}function _k(i,t,e,n){if(e===yc)return i[13]=1,i[14]=t>>8,i[15]=t&255,i[16]=t>>8,i[17]=t&255,i;if(e===vc){const r=new Uint8Array(13);t*=39.3701,r[0]=qy,r[1]=Vy,r[2]=Gy,r[3]=Hy,r[4]=t>>>24,r[5]=t>>>16,r[6]=t>>>8,r[7]=t&255,r[8]=r[4],r[9]=r[5],r[10]=r[6],r[11]=r[7],r[12]=1;const o=dk(r),s=new Uint8Array(4);if(s[0]=o>>>24,s[1]=o>>>16,s[2]=o>>>8,s[3]=o&255,n){const a=Ok(i);return i.set(r,a),i.set(s,a+13),i}else{const a=new Uint8Array(4);a[0]=0,a[1]=0,a[2]=0,a[3]=9;const l=new Uint8Array(54);return l.set(i,0),l.set(a,33),l.set(r,37),l.set(s,50),l}}}function xk(i){const t=Jy(i),e=document.createElement("a");e.href=t,e.download=`${i.name===""?"anon":i.name}.svg`,document.body.appendChild(e),e.click(),document.body.removeChild(e)}function Jy(i){const t=new XMLSerializer,e=document.querySelector("svg").cloneNode(!0),n=e.querySelector(".shapes"),r=e.querySelector(".paths"),o=e.querySelector(".background");e.innerHTML="",e.append(o),e.append(n),e.append(r);const s=i.limits.x[1]-i.limits.x[0],a=i.limits.y[1]-i.limits.y[0];e.setAttribute("transform",`scale(1, -1) translate(0, ${-(i.limits.y[0]+i.limits.y[1])})`),e.setAttribute("style",""),e.setAttribute("width",`${s*i.mm_per_unit}mm`),e.setAttribute("height",`${a*i.mm_per_unit}mm`),e.setAttribute("viewBox",`${i.limits.x[0]} ${i.limits.y[0]} ${s} ${a}`),e.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink");const l=t.serializeToString(e);return"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(l)}function Ky(i,t,e=!0){e&&!t.match(/@version\s*:\s*(v[\S]+)/)&&(t=`// @version: ${Mt.version} -${t}`);const n=new Blob([t],{type:"text/plain"});var r=document.createElement("a");r.href=URL.createObjectURL(n),r.download=`${i}`,r.click(),URL.revokeObjectURL(r)}function bk(i,t=1e3){const e=Jy(i),n=(i.limits.x[1]-i.limits.x[0])*i.mm_per_unit,r=(i.limits.y[1]-i.limits.y[0])*i.mm_per_unit,o=25.4;var s=t*n/o,a=t*r/o,l=new Image;l.width=s,l.height=a,l.setAttribute("src",e),l.onload=function(){const u=document.createElement("canvas");u.width=s,u.height=a;var c=u.getContext("2d");c.clearRect(0,0,s,a),c.drawImage(l,0,0,s,a),c.getImageData(0,0,s,a),wk(u,`${i.name===""?"anon":i.name}`)}}function wk(i,t){var e=i.toDataURL("image/png");e=vk(e,1e3);var n=document.createElement("a");n.download=`${t}.png`,n.href=e,n.click()}const Sk=i=>Mt.componentMenu?Oe` +`||u=="\r")u=" ";else if(u==" "){u=" ";var l=t.coordsAtPos(r+1,-1);l&&(m=l.left-(l.left-c.left)/parseInt(x.tabSize))}else/[\uD800-\uDBFF]/.test(u)&&r{t.state.vim&&(t.state.vim.status=""),this.blockCursor.scheduleRedraw(),this.updateStatus()}),this.cm.on("vim-mode-change",e=>{t.state.vim.mode=e.mode,e.subMode&&(t.state.vim.mode+=" block"),t.state.vim.status="",this.blockCursor.scheduleRedraw(),this.updateClass(),this.updateStatus()}),this.cm.on("dialog",()=>{this.cm.state.statusbar?this.updateStatus():i.dispatch({effects:zy.of(!!this.cm.state.dialog)})}),this.dom=document.createElement("span"),this.dom.style.cssText="position: absolute; right: 10px; top: 1px",this.statusButton=document.createElement("span"),this.statusButton.onclick=e=>{Ds.handleKey(this.cm,"","user"),this.cm.focus()},this.statusButton.style.cssText="cursor: pointer"}update(i){var t;if((i.viewportChanged||i.docChanged)&&this.query&&this.highlight(this.query),i.docChanged&&this.cm.onChange(i),i.selectionSet&&this.cm.onSelectionChange(),i.viewportChanged,this.cm.curOp&&!this.cm.curOp.isVimOp&&this.cm.onBeforeEndOperation(),i.transactions){for(let e of i.transactions)for(let n of e.effects)if(n.is(ar))if(!((t=n.value)===null||t===void 0?void 0:t.forVim))this.highlight(null);else{let o=n.value.create();this.highlight(o)}}this.blockCursor.update(i)}updateClass(){const i=this.cm.state;!i.vim||i.vim.insertMode&&!i.overwrite?this.view.scrollDOM.classList.remove("cm-vimMode"):this.view.scrollDOM.classList.add("cm-vimMode")}updateStatus(){let i=this.cm.state.statusbar,t=this.cm.state.vim;if(!i||!t)return;let e=this.cm.state.dialog;if(e)e.parentElement!=i&&(i.textContent="",i.appendChild(e));else{i.textContent="";var n=(t.mode||"normal").toUpperCase();t.insertModeReturn&&(n+="(C-O)"),this.statusButton.textContent=`--${n}--`,i.appendChild(this.statusButton)}this.dom.textContent=t.status,i.appendChild(this.dom)}destroy(){Ds.leaveVimMode(this.cm),this.updateClass(),this.blockCursor.destroy(),delete this.view.cm}highlight(i){if(this.query=i,!i)return this.decorations=Gt.none;let{view:t}=this,e=new _n;for(let n=0,r=t.visibleRanges,o=r.length;nr[n+1].from-2*ek;)a=r[++n].to;i.highlight(t.state,s,a,(l,u)=>{e.add(l,u,sk)})}return this.decorations=e.finish()}handleKey(i,t){const e=de.vimKey(i),n=this.cm;if(!e)return;let r=n.state.vim;if(!r)return;if(e==""&&!r.insertMode&&!r.visualMode&&this.query){const a=r.searchState_;a&&(n.removeOverlay(a.getOverlay()),a.setOverlay(null))}if(e===""&&!de.isMac&&n.somethingSelected())return this.waitForCopy=!0,!0;r.status=(r.status||"")+e;let s=Ds.multiSelectHandleKey(n,e,"user");return r=n.state.vim,!s&&r.insertMode&&n.state.overwrite&&(i.key&&i.key.length==1&&!/\n/.test(i.key)?(s=!0,n.overWriteSelection(i.key)):i.key=="Backspace"&&(s=!0,de.commands.cursorCharLeft(n))),s&&(de.signal(this.cm,"vim-keypress",e),i.preventDefault(),i.stopPropagation(),this.blockCursor.scheduleRedraw()),this.updateStatus(),!!s}},{eventHandlers:{copy:function(i,t){this.waitForCopy&&(this.waitForCopy=!1,Promise.resolve().then(()=>{var e=this.cm,n=e.state.vim;n&&(n.insertMode?e.setSelection(e.getCursor(),e.getCursor()):e.operation(()=>{e.curOp&&(e.curOp.isVimOp=!0),Ds.handleKey(e,"","user")}))}))},compositionstart:function(i,t){this.useNextTextInput=!0},keypress:function(i,t){this.lastKeydown=="Dead"&&this.handleKey(i,t)},keydown:function(i,t){this.lastKeydown=i.key,this.lastKeydown=="Unidentified"||this.lastKeydown=="Process"||this.lastKeydown=="Dead"?this.useNextTextInput=!0:(this.useNextTextInput=!1,this.handleKey(i,t))}},provide:()=>[Rt.inputHandler.of((i,t,e,n)=>{var r,o,s=uk(i);if(!s)return!1;var a=(r=s.state)===null||r===void 0?void 0:r.vim,l=s.state.vimPlugin;return a&&!a.insertMode&&!(!((o=s.curOp)===null||o===void 0)&&o.isVimOp)?(n==="\0\0"||(n.length==1&&l.useNextTextInput&&l.handleKey({key:n,preventDefault:()=>{},stopPropagation:()=>{}}),rk(i)),!0):!1})],decorations:i=>i.decorations});function rk(i){var t=i.scrollDOM.parentElement;if(t){if(tk){i.contentDOM.textContent="\0\0",i.contentDOM.dispatchEvent(new CustomEvent("compositionend"));return}var e=i.scrollDOM.nextSibling,n=window.getSelection(),r=n&&{anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset};i.scrollDOM.remove(),t.insertBefore(i.scrollDOM,e);try{r&&n&&(n.setPosition(r.anchorNode,r.anchorOffset),r.focusNode&&n.extend(r.focusNode,r.focusOffset))}catch(o){console.error(o)}i.focus(),i.contentDOM.dispatchEvent(new CustomEvent("compositionend"))}}const sk=Gt.mark({class:"cm-searchMatch"}),zy=re.define(),ok=ti.define({create:()=>!1,update(i,t){for(let e of t.effects)e.is(zy)&&(i=e.value);return i},provide:i=>Dr.from(i,t=>t?ak:null)});function ak(i){let t=document.createElement("div");t.className="cm-vim-panel";let e=i.cm;return e.state.dialog&&t.appendChild(e.state.dialog),{top:!1,dom:t}}function lk(i){let t=document.createElement("div");t.className="cm-vim-panel";let e=i.cm;return e.state.statusbar=t,e.state.vimPlugin.updateStatus(),{dom:t}}function hk(i={}){return[ik,nk,H2,i.status?Dr.of(lk):ok]}function uk(i){return i.cm||null}function jy(i,t=!1){const e=t?hk():wo.of([pC]),n=[jP,T2(),e,Tr.of(" "),Q2],r=Oe.create({extensions:n}),o=new Rt({state:r,parent:i});return{state:r,view:o,foldRange(){},viewJumpTo:a=>{const l=a.index??o.state.doc.line(a.line).from+a.column;o.dispatch({selection:{anchor:l,head:a.length?l+a.length:l},effects:Rt.scrollIntoView(l,{x:"center",y:"center"})}),o.focus()}}}const ck=["./library/connectors/ESP8266_12E.json","./library/connectors/header_FTDI.json","./library/connectors/power_65mm.json","./library/connectors/ESP32_CAM.json","./library/connectors/USB_A_plug.json","./library/connectors/header_i0.json","./library/connectors/header_serial_reverse.json","./library/connectors/header_4.json","./library/connectors/header_signal.json","./library/connectors/MTA_i0.json","./library/connectors/HM11.json","./library/connectors/header_MFRC522.json","./library/connectors/header_serial_reverse_5V.json","./library/connectors/USB_mini_B.json","./library/connectors/ESC.json","./library/connectors/MTA_PS2.json","./library/connectors/header_APA.json","./library/connectors/MTA_ICP.json","./library/connectors/stereo_2_5mm.json","./library/connectors/header_VL53L1X_3415.json","./library/connectors/Molex_serial.json","./library/connectors/header_SWD_4_1.json","./library/connectors/ESP_01.json","./library/connectors/HCSR04.json","./library/connectors/header_SWD_4_05.json","./library/connectors/ESP32_WROOM.json","./library/connectors/header_serial.json","./library/connectors/header_PDI.json","./library/connectors/I2C4x1v.json","./library/connectors/header_power.json","./library/connectors/MTA_serial.json","./library/connectors/header_LSM6DS33_2736.json","./library/connectors/MTA_2.json","./library/connectors/MTA_3.json","./library/connectors/header_LCD.json","./library/connectors/screw_terminal_2.json","./library/connectors/HCSR501.json","./library/connectors/screw_terminal_i0.json","./library/connectors/header_unipolar_stepper.json","./library/connectors/screw_terminal_power.json","./library/connectors/header_nRF24L01.json","./library/connectors/header_serial_reverse_3V3.json","./library/connectors/MTA_power.json","./library/connectors/MTA_4.json","./library/connectors/RCWL0516.json","./library/connectors/ESP_WROOM_02D.json","./library/connectors/RN4871.json","./library/connectors/header_I2C.json","./library/connectors/header_SWD.json","./library/connectors/header_servo.json","./library/connectors/microSD.json","./library/connectors/header_4H.json","./library/connectors/header_UPDI.json","./library/connectors/I2C4x1i.json","./library/connectors/I2C4x1h.json","./library/connectors/header_ISP.json","./library/connectors/header_NEO_6M.json","./library/connectors/MTA_5.json","./library/connectors/header_6.json","./library/connectors/header_UPDI_reverse.json","./library/connectors/header_bus.json","./library/connectors/TFT8x1v.json","./library/connectors/header_2H.json","./library/connectors/header_ATP.json","./library/switches/button_6mm.json","./library/switches/slide_switch.json","./library/diodes_transistors_regulators_sensors/D_1206.json","./library/diodes_transistors_regulators_sensors/mic_SPM1437.json","./library/diodes_transistors_regulators_sensors/LED_1206.json","./library/diodes_transistors_regulators_sensors/NMOSFET_TO252AA.json","./library/diodes_transistors_regulators_sensors/regulator_SOT223.json","./library/diodes_transistors_regulators_sensors/regulator_SOT23.json","./library/diodes_transistors_regulators_sensors/VL53L1X.json","./library/diodes_transistors_regulators_sensors/H_bridge_SM8.json","./library/diodes_transistors_regulators_sensors/SPG08P4HM4H.json","./library/diodes_transistors_regulators_sensors/Hall_SOT23.json","./library/diodes_transistors_regulators_sensors/VEML6040.json","./library/diodes_transistors_regulators_sensors/phototransistor_1206.json","./library/diodes_transistors_regulators_sensors/LED_RGB.json","./library/diodes_transistors_regulators_sensors/accel_MXD6235M.json","./library/diodes_transistors_regulators_sensors/ADXL343.json","./library/diodes_transistors_regulators_sensors/mic_SPU0414HR5H.json","./library/diodes_transistors_regulators_sensors/D_SOD_123.json","./library/diodes_transistors_regulators_sensors/LED_3014_1100.json","./library/diodes_transistors_regulators_sensors/A4953_SOICN.json","./library/diodes_transistors_regulators_sensors/NMOSFET_SOT23.json","./library/diodes_transistors_regulators_sensors/phototransistor_PLCC2.json","./library/diodes_transistors_regulators_sensors/PMOSFET_SOT23.json","./library/diodes_transistors_regulators_sensors/DRV8428_HTSSOP.json","./library/diodes_transistors_regulators_sensors/CMM4030D261I2STR.json","./library/crystals_and_resonators/XTAL_CSM_7.json","./library/crystals_and_resonators/XTAL_NX5032GA.json","./library/crystals_and_resonators/XTAL_EFOBM.json","./library/discretes/R_0402.json","./library/discretes/ST4EB.json","./library/discretes/C_1206.json","./library/discretes/R_1206.json","./library/discretes/choke.json","./library/discretes/L_1210.json","./library/discretes/C_FND.json","./library/ICs/CBA.json","./library/ICs/SAMD21E.json","./library/ICs/AVRDB28.json","./library/ICs/FT230XS.json","./library/ICs/ATtiny1614.json","./library/ICs/fab.json","./library/ICs/ATtiny44_SOICN.json","./library/ICs/ATxmegaE5_TQFP.json","./library/ICs/op_amp_SOICN.json","./library/ICs/ATtiny45_SOIC.json","./library/ICs/ATmega88_TQFP.json","./library/ICs/SAMD11D.json","./library/ICs/TRC102.json","./library/ICs/ATtiny412.json","./library/ICs/ATmega644_TQFP.json","./library/ICs/op_amp_SOT23_5.json","./library/ICs/SAMD11C.json","./library/ICs/ATtiny3216.json","./library/ICs/xiao_copper.json"];function fk(){const i=new Int32Array(256);for(let t=0;t<256;t++){let e=t;for(let n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;i[t]=e}return i}function dk(i){let t=-1;jh||(jh=fk());for(let e=0;e>>8;return t^-1}let jh;const vc="image/png",yc="image/jpeg",pk="AAlwSFlz",mk="AAAJcEhZ",gk="AAAACXBI",qy="p".charCodeAt(0),Vy="H".charCodeAt(0),Gy="Y".charCodeAt(0),Hy="s".charCodeAt(0);function vk(i,t){const e=i.split(","),n=e[0],r=e[1];let o,s,a=!1;if(n.indexOf(vc)!==-1){o=vc;const x=yk(r);x>=0?(s=Math.ceil((x+28)/3)*4,a=!0):s=33/3*4}n.indexOf(yc)!==-1&&(o=yc,s=18/3*4);const l=r.substring(0,s),u=r.substring(s),c=atob(l),d=new Uint8Array(c.length);for(let x=0;x=4;e--)if(i[e-4]===9&&i[e-3]===qy&&i[e-2]===Vy&&i[e-1]===Gy&&i[e]===Hy)return e-3}function _k(i,t,e,n){if(e===yc)return i[13]=1,i[14]=t>>8,i[15]=t&255,i[16]=t>>8,i[17]=t&255,i;if(e===vc){const r=new Uint8Array(13);t*=39.3701,r[0]=qy,r[1]=Vy,r[2]=Gy,r[3]=Hy,r[4]=t>>>24,r[5]=t>>>16,r[6]=t>>>8,r[7]=t&255,r[8]=r[4],r[9]=r[5],r[10]=r[6],r[11]=r[7],r[12]=1;const o=dk(r),s=new Uint8Array(4);if(s[0]=o>>>24,s[1]=o>>>16,s[2]=o>>>8,s[3]=o&255,n){const a=Ok(i);return i.set(r,a),i.set(s,a+13),i}else{const a=new Uint8Array(4);a[0]=0,a[1]=0,a[2]=0,a[3]=9;const l=new Uint8Array(54);return l.set(i,0),l.set(a,33),l.set(r,37),l.set(s,50),l}}}function xk(i){const t=Jy(i),e=document.createElement("a");e.href=t,e.download=`${i.name===""?"anon":i.name}.svg`,document.body.appendChild(e),e.click(),document.body.removeChild(e)}function Jy(i){const t=new XMLSerializer,e=document.querySelector("svg").cloneNode(!0),n=e.querySelector(".shapes"),r=e.querySelector(".paths"),o=e.querySelector(".background");e.innerHTML="",e.append(o),e.append(n),e.append(r);const s=i.limits.x[1]-i.limits.x[0],a=i.limits.y[1]-i.limits.y[0];e.setAttribute("transform",`scale(1, -1) translate(0, ${-(i.limits.y[0]+i.limits.y[1])})`),e.setAttribute("style",""),e.setAttribute("width",`${s*i.mm_per_unit}mm`),e.setAttribute("height",`${a*i.mm_per_unit}mm`),e.setAttribute("viewBox",`${i.limits.x[0]} ${i.limits.y[0]} ${s} ${a}`),e.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink");const l=t.serializeToString(e);return"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(l)}function Ky(i,t,e=!0){e&&!t.match(/@version\s*:\s*(v[\S]+)/)&&(t=`// @version: ${Mt.version} +${t}`);const n=new Blob([t],{type:"text/plain"});var r=document.createElement("a");r.href=URL.createObjectURL(n),r.download=`${i}`,r.click(),URL.revokeObjectURL(r)}function bk(i,t=1e3){const e=Jy(i),n=(i.limits.x[1]-i.limits.x[0])*i.mm_per_unit,r=(i.limits.y[1]-i.limits.y[0])*i.mm_per_unit,o=25.4;var s=t*n/o,a=t*r/o,l=new Image;l.width=s,l.height=a,l.setAttribute("src",e),l.onload=function(){const u=document.createElement("canvas");u.width=s,u.height=a;var c=u.getContext("2d");c.clearRect(0,0,s,a),c.drawImage(l,0,0,s,a),c.getImageData(0,0,s,a),wk(u,`${i.name===""?"anon":i.name}`)}}function wk(i,t){var e=i.toDataURL("image/png");e=vk(e,1e3);var n=document.createElement("a");n.download=`${t}.png`,n.href=e,n.click()}const Sk=i=>Mt.componentMenu?_e`
@@ -174,18 +174,18 @@ ${t}`);const n=new Blob([t],{type:"text/plain"});var r=document.createElement("a {Mt.componentSearch=t.target.value,Ft("RENDER")}}/>
- ${i.map(t=>{const e=t.slice(10);return!e.toLowerCase().includes(Mt.componentSearch.toLowerCase())&&Mt.componentSearch!==""?"":Oe` + ${i.map(t=>{const e=t.slice(10);return!e.toLowerCase().includes(Mt.componentSearch.toLowerCase())&&Mt.componentSearch!==""?"":_e` `})}
- `:"",Ck=i=>Oe` + `:"",Ck=i=>_e`
{document.querySelector(".layer-list-inner").classList.toggle("hidden"),t.target.classList.toggle("inner-hidden")}}>Layers:
- ${i.layers.map((t,e)=>{const{name:n,visible:r,color:o}=t,l=(()=>i.codemirror.view.state.doc.toString())().slice(i.layersStaticInfo.from,i.layersStaticInfo.to),u=()=>{const g=tn.parse(l,{range:!0}),x=t1(g,{type:"Identifier",name:"layerColors"}).getParent().value.range,m=x[0]+i.layersStaticInfo.from,v=x[1]+i.layersStaticInfo.from;i.codemirror.view.dispatch({changes:{from:m,to:v,insert:Pk(i.layers,3)}}),Ft("HARD_RENDER"),Ft("RUN")},c=g=>{t.color=g.detail.value,u()},d=g=>{t.visible=g.target.checked,[...i.heldKeys].some(m=>m.includes("Shift"))?(i.layers.forEach(m=>{m.visible=!1}),t.visible=g.target.checked,u()):(t.visible=g.target.checked,u())},f=r?Oe` + ${i.layers.map((t,e)=>{const{name:n,visible:r,color:o}=t,l=(()=>i.codemirror.view.state.doc.toString())().slice(i.layersStaticInfo.from,i.layersStaticInfo.to),u=()=>{const g=tn.parse(l,{range:!0}),x=t1(g,{type:"Identifier",name:"layerColors"}).getParent().value.range,m=x[0]+i.layersStaticInfo.from,v=x[1]+i.layersStaticInfo.from;i.codemirror.view.dispatch({changes:{from:m,to:v,insert:Pk(i.layers,3)}}),Ft("HARD_RENDER"),Ft("RUN")},c=g=>{t.color=g.detail.value,u()},d=g=>{t.visible=g.target.checked,[...i.heldKeys].some(m=>m.includes("Shift"))?(i.layers.forEach(m=>{m.visible=!1}),t.visible=g.target.checked,u()):(t.visible=g.target.checked,u())},f=r?_e` - `:"";return Oe` + `:"";return _e`
@@ -215,13 +215,13 @@ ${t}`);const n=new Blob([t],{type:"text/plain"});var r=document.createElement("a `;function Pk(i,t=0){let e=[];return i.forEach(r=>{const{visible:o,name:s,color:a}=r,l=o?`${" ".repeat(t)} "${s}": "${a}",`:`${" ".repeat(t)}/* "${s}": "${a}", */`;e.push(l)}),`{ ${e.join(` `)} -${" ".repeat(Math.max(0,t-1))}}`}function t1(i,t,e=null){if(typeof i!="object"||i===null)return null;Object.defineProperty(i,"getParent",{value:function(){return e},enumerable:!1,writable:!1});let n=!0;for(const r in t)if(i[r]!==t[r]){n=!1;break}if(n)return i;for(const r in i){const o=t1(i[r],t,i);if(o)return o}return null}const kk=({svgView:i},t)=>{const e=o=>_e` +${" ".repeat(Math.max(0,t-1))}}`}function t1(i,t,e=null){if(typeof i!="object"||i===null)return null;Object.defineProperty(i,"getParent",{value:function(){return e},enumerable:!1,writable:!1});let n=!0;for(const r in t)if(i[r]!==t[r]){n=!1;break}if(n)return i;for(const r in i){const o=t1(i[r],t,i);if(o)return o}return null}const kk=({svgView:i},t)=>{const e=o=>ve` - `,[n,r]=t;return Oe` + `,[n,r]=t;return _e`