From caeef579c1a878cd7f7e2ec316150d84c8cee879 Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Sat, 24 Jan 2026 13:08:59 +0800 Subject: [PATCH] updated sdui --- embd_res/kcpp_sdui.embd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/embd_res/kcpp_sdui.embd b/embd_res/kcpp_sdui.embd index c0e2cc451..939f8fb77 100644 --- a/embd_res/kcpp_sdui.embd +++ b/embd_res/kcpp_sdui.embd @@ -70,7 +70,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE */(function(e,t){(function(n){e.exports=n()})(function(){return function n(r,i,l){function v(u,h){if(!i[u]){if(!r[u]){var c=typeof Ql=="function"&&Ql;if(!h&&c)return c(u,!0);if(o)return o(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var s=i[u]={exports:{}};r[u][0].call(s.exports,function(d){var g=r[u][1][d];return v(g||d)},s,s.exports,n,r,i,l)}return i[u].exports}for(var o=typeof Ql=="function"&&Ql,a=0;a>2,s=(3&u)<<4|h>>4,d=1<_?(15&h)<<2|c>>6:64,g=2<_?63&c:64,m.push(o.charAt(f)+o.charAt(s)+o.charAt(d)+o.charAt(g));return m.join("")},i.decode=function(a){var u,h,c,f,s,d,g=0,m=0,y="data:";if(a.substr(0,y.length)===y)throw new Error("Invalid base64 input, it looks like a data url.");var b,_=3*(a=a.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(a.charAt(a.length-1)===o.charAt(64)&&_--,a.charAt(a.length-2)===o.charAt(64)&&_--,_%1!=0)throw new Error("Invalid base64 input, bad content length.");for(b=v.uint8array?new Uint8Array(0|_):new Array(0|_);g>4,h=(15&f)<<4|(s=o.indexOf(a.charAt(g++)))>>2,c=(3&s)<<6|(d=o.indexOf(a.charAt(g++))),b[m++]=u,s!==64&&(b[m++]=h),d!==64&&(b[m++]=c);return b}},{"./support":30,"./utils":32}],2:[function(n,r,i){var l=n("./external"),v=n("./stream/DataWorker"),o=n("./stream/Crc32Probe"),a=n("./stream/DataLengthProbe");function u(h,c,f,s,d){this.compressedSize=h,this.uncompressedSize=c,this.crc32=f,this.compression=s,this.compressedContent=d}u.prototype={getContentWorker:function(){var h=new v(l.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),c=this;return h.on("end",function(){if(this.streamInfo.data_length!==c.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),h},getCompressedWorker:function(){return new v(l.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(h,c,f){return h.pipe(new o).pipe(new a("uncompressedSize")).pipe(c.compressWorker(f)).pipe(new a("compressedSize")).withStreamInfo("compression",c)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,i){var l=n("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new l("STORE compression")},uncompressWorker:function(){return new l("STORE decompression")}},i.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,i){var l=n("./utils"),v=function(){for(var o,a=[],u=0;u<256;u++){o=u;for(var h=0;h<8;h++)o=1&o?3988292384^o>>>1:o>>>1;a[u]=o}return a}();r.exports=function(o,a){return o!==void 0&&o.length?l.getTypeOf(o)!=="string"?function(u,h,c,f){var s=v,d=f+c;u^=-1;for(var g=f;g>>8^s[255&(u^h[g])];return-1^u}(0|a,o,o.length,0):function(u,h,c,f){var s=v,d=f+c;u^=-1;for(var g=f;g>>8^s[255&(u^h.charCodeAt(g))];return-1^u}(0|a,o,o.length,0):0}},{"./utils":32}],5:[function(n,r,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(n,r,i){var l=null;l=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:l}},{lie:37}],7:[function(n,r,i){var l=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",v=n("pako"),o=n("./utils"),a=n("./stream/GenericWorker"),u=l?"uint8array":"array";function h(c,f){a.call(this,"FlateWorker/"+c),this._pako=null,this._pakoAction=c,this._pakoOptions=f,this.meta={}}i.magic="\b\0",o.inherits(h,a),h.prototype.processChunk=function(c){this.meta=c.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(u,c.data),!1)},h.prototype.flush=function(){a.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new v[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var c=this;this._pako.onData=function(f){c.push({data:f,meta:c.meta})}},i.compressWorker=function(c){return new h("Deflate",c)},i.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,i){function l(s,d){var g,m="";for(g=0;g>>=8;return m}function v(s,d,g,m,y,b){var _,w,S=s.file,x=s.compression,T=b!==u.utf8encode,O=o.transformTo("string",b(S.name)),A=o.transformTo("string",u.utf8encode(S.name)),D=S.comment,N=o.transformTo("string",b(D)),R=o.transformTo("string",u.utf8encode(D)),B=A.length!==S.name.length,E=R.length!==D.length,U="",ne="",Q="",ue=S.dir,I=S.date,z={crc32:0,compressedSize:0,uncompressedSize:0};d&&!g||(z.crc32=s.crc32,z.compressedSize=s.compressedSize,z.uncompressedSize=s.uncompressedSize);var M=0;d&&(M|=8),T||!B&&!E||(M|=2048);var L=0,J=0;ue&&(L|=16),y==="UNIX"?(J=798,L|=function(P,q){var Z=P;return P||(Z=q?16893:33204),(65535&Z)<<16}(S.unixPermissions,ue)):(J=20,L|=function(P){return 63&(P||0)}(S.dosPermissions)),_=I.getUTCHours(),_<<=6,_|=I.getUTCMinutes(),_<<=5,_|=I.getUTCSeconds()/2,w=I.getUTCFullYear()-1980,w<<=4,w|=I.getUTCMonth()+1,w<<=5,w|=I.getUTCDate(),B&&(ne=l(1,1)+l(h(O),4)+A,U+="up"+l(ne.length,2)+ne),E&&(Q=l(1,1)+l(h(N),4)+R,U+="uc"+l(Q.length,2)+Q);var V="";return V+=` \0`,V+=l(M,2),V+=x.magic,V+=l(_,2),V+=l(w,2),V+=l(z.crc32,4),V+=l(z.compressedSize,4),V+=l(z.uncompressedSize,4),V+=l(O.length,2),V+=l(U.length,2),{fileRecord:c.LOCAL_FILE_HEADER+V+O+U,dirRecord:c.CENTRAL_FILE_HEADER+l(J,2)+V+l(N.length,2)+"\0\0\0\0"+l(L,4)+l(m,4)+O+U+N}}var o=n("../utils"),a=n("../stream/GenericWorker"),u=n("../utf8"),h=n("../crc32"),c=n("../signature");function f(s,d,g,m){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=d,this.zipPlatform=g,this.encodeFileName=m,this.streamFiles=s,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(f,a),f.prototype.push=function(s){var d=s.meta.percent||0,g=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(s):(this.bytesWritten+=s.data.length,a.prototype.push.call(this,{data:s.data,meta:{currentFile:this.currentFile,percent:g?(d+100*(g-m-1))/g:100}}))},f.prototype.openedSource=function(s){this.currentSourceOffset=this.bytesWritten,this.currentFile=s.file.name;var d=this.streamFiles&&!s.file.dir;if(d){var g=v(s,d,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(s){this.accumulate=!1;var d=this.streamFiles&&!s.file.dir,g=v(s,d,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),d)this.push({data:function(m){return c.DATA_DESCRIPTOR+l(m.crc32,4)+l(m.compressedSize,4)+l(m.uncompressedSize,4)}(s),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var s=this.bytesWritten,d=0;d=this.index;a--)u=(u<<8)+this.byteAt(a);return this.index+=o,u},readString:function(o){return l.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},r.exports=v},{"../utils":32}],19:[function(n,r,i){var l=n("./Uint8ArrayReader");function v(o){l.call(this,o)}n("../utils").inherits(v,l),v.prototype.readData=function(o){this.checkOffset(o);var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},r.exports=v},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,i){var l=n("./DataReader");function v(o){l.call(this,o)}n("../utils").inherits(v,l),v.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},v.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},v.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},v.prototype.readData=function(o){this.checkOffset(o);var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},r.exports=v},{"../utils":32,"./DataReader":18}],21:[function(n,r,i){var l=n("./ArrayReader");function v(o){l.call(this,o)}n("../utils").inherits(v,l),v.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var a=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},r.exports=v},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,i){var l=n("../utils"),v=n("../support"),o=n("./ArrayReader"),a=n("./StringReader"),u=n("./NodeBufferReader"),h=n("./Uint8ArrayReader");r.exports=function(c){var f=l.getTypeOf(c);return l.checkSupport(f),f!=="string"||v.uint8array?f==="nodebuffer"?new u(c):v.uint8array?new h(l.transformTo("uint8array",c)):new o(l.transformTo("array",c)):new a(c)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,i){var l=n("./GenericWorker"),v=n("../utils");function o(a){l.call(this,"ConvertWorker to "+a),this.destType=a}v.inherits(o,l),o.prototype.processChunk=function(a){this.push({data:v.transformTo(this.destType,a.data),meta:a.meta})},r.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,i){var l=n("./GenericWorker"),v=n("../crc32");function o(){l.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(o,l),o.prototype.processChunk=function(a){this.streamInfo.crc32=v(a.data,this.streamInfo.crc32||0),this.push(a)},r.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,i){var l=n("../utils"),v=n("./GenericWorker");function o(a){v.call(this,"DataLengthProbe for "+a),this.propName=a,this.withStreamInfo(a,0)}l.inherits(o,v),o.prototype.processChunk=function(a){if(a){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+a.data.length}v.prototype.processChunk.call(this,a)},r.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,i){var l=n("../utils"),v=n("./GenericWorker");function o(a){v.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,a.then(function(h){u.dataIsReady=!0,u.data=h,u.max=h&&h.length||0,u.type=l.getTypeOf(h),u.isPaused||u._tickAndRepeat()},function(h){u.error(h)})}l.inherits(o,v),o.prototype.cleanUp=function(){v.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!v.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,l.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(l.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var a=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":a=this.data.substring(this.index,u);break;case"uint8array":a=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":a=this.data.slice(this.index,u)}return this.index=u,this.push({data:a,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,i){function l(v){this.name=v||"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}l.prototype={push:function(v){this.emit("data",v)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(v){this.emit("error",v)}return!0},error:function(v){return!this.isFinished&&(this.isPaused?this.generatedError=v:(this.isFinished=!0,this.emit("error",v),this.previous&&this.previous.error(v),this.cleanUp()),!0)},on:function(v,o){return this._listeners[v].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(v,o){if(this._listeners[v])for(var a=0;a "+v:v}},r.exports=l},{}],29:[function(n,r,i){var l=n("../utils"),v=n("./ConvertWorker"),o=n("./GenericWorker"),a=n("../base64"),u=n("../support"),h=n("../external"),c=null;if(u.nodestream)try{c=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(d,g){return new h.Promise(function(m,y){var b=[],_=d._internalType,w=d._outputType,S=d._mimeType;d.on("data",function(x,T){b.push(x),g&&g(T)}).on("error",function(x){b=[],y(x)}).on("end",function(){try{var x=function(T,O,A){switch(T){case"blob":return l.newBlob(l.transformTo("arraybuffer",O),A);case"base64":return a.encode(O);default:return l.transformTo(T,O)}}(w,function(T,O){var A,D=0,N=null,R=0;for(A=0;A"u")i.blob=!1;else{var l=new ArrayBuffer(0);try{i.blob=new Blob([l],{type:"application/zip"}).size===0}catch{try{var v=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);v.append(l),i.blob=v.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!n("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,i){for(var l=n("./utils"),v=n("./support"),o=n("./nodejsUtils"),a=n("./stream/GenericWorker"),u=new Array(256),h=0;h<256;h++)u[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;u[254]=u[254]=1;function c(){a.call(this,"utf-8 decode"),this.leftOver=null}function f(){a.call(this,"utf-8 encode")}i.utf8encode=function(s){return v.nodebuffer?o.newBufferFrom(s,"utf-8"):function(d){var g,m,y,b,_,w=d.length,S=0;for(b=0;b>>6:(m<65536?g[_++]=224|m>>>12:(g[_++]=240|m>>>18,g[_++]=128|m>>>12&63),g[_++]=128|m>>>6&63),g[_++]=128|63&m);return g}(s)},i.utf8decode=function(s){return v.nodebuffer?l.transformTo("nodebuffer",s).toString("utf-8"):function(d){var g,m,y,b,_=d.length,w=new Array(2*_);for(g=m=0;g<_;)if((y=d[g++])<128)w[m++]=y;else if(4<(b=u[y]))w[m++]=65533,g+=b-1;else{for(y&=b===2?31:b===3?15:7;1>10&1023,w[m++]=56320|1023&y)}return w.length!==m&&(w.subarray?w=w.subarray(0,m):w.length=m),l.applyFromCharCode(w)}(s=l.transformTo(v.uint8array?"uint8array":"array",s))},l.inherits(c,a),c.prototype.processChunk=function(s){var d=l.transformTo(v.uint8array?"uint8array":"array",s.data);if(this.leftOver&&this.leftOver.length){if(v.uint8array){var g=d;(d=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),d.set(g,this.leftOver.length)}else d=this.leftOver.concat(d);this.leftOver=null}var m=function(b,_){var w;for((_=_||b.length)>b.length&&(_=b.length),w=_-1;0<=w&&(192&b[w])==128;)w--;return w<0||w===0?_:w+u[b[w]]>_?w:_}(d),y=d;m!==d.length&&(v.uint8array?(y=d.subarray(0,m),this.leftOver=d.subarray(m,d.length)):(y=d.slice(0,m),this.leftOver=d.slice(m,d.length))),this.push({data:i.utf8decode(y),meta:s.meta})},c.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=c,l.inherits(f,a),f.prototype.processChunk=function(s){this.push({data:i.utf8encode(s.data),meta:s.meta})},i.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,i){var l=n("./support"),v=n("./base64"),o=n("./nodejsUtils"),a=n("./external");function u(g){return g}function h(g,m){for(var y=0;y>8;this.dir=!!(16&this.externalFileAttributes),s==0&&(this.dosPermissions=63&this.externalFileAttributes),s==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var s=l(this.extraFields[1].value);this.uncompressedSize===v.MAX_VALUE_32BITS&&(this.uncompressedSize=s.readInt(8)),this.compressedSize===v.MAX_VALUE_32BITS&&(this.compressedSize=s.readInt(8)),this.localHeaderOffset===v.MAX_VALUE_32BITS&&(this.localHeaderOffset=s.readInt(8)),this.diskNumberStart===v.MAX_VALUE_32BITS&&(this.diskNumberStart=s.readInt(4))}},readExtraFields:function(s){var d,g,m,y=s.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});s.index+4>>6:(s<65536?f[m++]=224|s>>>12:(f[m++]=240|s>>>18,f[m++]=128|s>>>12&63),f[m++]=128|s>>>6&63),f[m++]=128|63&s);return f},i.buf2binstring=function(c){return h(c,c.length)},i.binstring2buf=function(c){for(var f=new l.Buf8(c.length),s=0,d=f.length;s>10&1023,b[d++]=56320|1023&g)}return h(b,d)},i.utf8border=function(c,f){var s;for((f=f||c.length)>c.length&&(f=c.length),s=f-1;0<=s&&(192&c[s])==128;)s--;return s<0||s===0?f:s+a[c[s]]>f?s:f}},{"./common":41}],43:[function(n,r,i){r.exports=function(l,v,o,a){for(var u=65535&l|0,h=l>>>16&65535|0,c=0;o!==0;){for(o-=c=2e3>>1:v>>>1;o[a]=v}return o}();r.exports=function(v,o,a,u){var h=l,c=u+a;v^=-1;for(var f=u;f>>8^h[255&(v^o[f])];return-1^v}},{}],46:[function(n,r,i){var l,v=n("../utils/common"),o=n("./trees"),a=n("./adler32"),u=n("./crc32"),h=n("./messages"),c=0,f=4,s=0,d=-2,g=-1,m=4,y=2,b=8,_=9,w=286,S=30,x=19,T=2*w+1,O=15,A=3,D=258,N=D+A+1,R=42,B=113,E=1,U=2,ne=3,Q=4;function ue(k,X){return k.msg=h[X],X}function I(k){return(k<<1)-(4k.avail_out&&(W=k.avail_out),W!==0&&(v.arraySet(k.output,X.pending_buf,X.pending_out,W,k.next_out),k.next_out+=W,X.pending_out+=W,k.total_out+=W,k.avail_out-=W,X.pending-=W,X.pending===0&&(X.pending_out=0))}function L(k,X){o._tr_flush_block(k,0<=k.block_start?k.block_start:-1,k.strstart-k.block_start,X),k.block_start=k.strstart,M(k.strm)}function J(k,X){k.pending_buf[k.pending++]=X}function V(k,X){k.pending_buf[k.pending++]=X>>>8&255,k.pending_buf[k.pending++]=255&X}function P(k,X){var W,$,F=k.max_chain_length,K=k.strstart,de=k.prev_length,oe=k.nice_match,G=k.strstart>k.w_size-N?k.strstart-(k.w_size-N):0,me=k.window,ae=k.w_mask,te=k.prev,be=k.strstart+D,Ce=me[K+de-1],xe=me[K+de];k.prev_length>=k.good_match&&(F>>=2),oe>k.lookahead&&(oe=k.lookahead);do if(me[(W=X)+de]===xe&&me[W+de-1]===Ce&&me[W]===me[K]&&me[++W]===me[K+1]){K+=2,W++;do;while(me[++K]===me[++W]&&me[++K]===me[++W]&&me[++K]===me[++W]&&me[++K]===me[++W]&&me[++K]===me[++W]&&me[++K]===me[++W]&&me[++K]===me[++W]&&me[++K]===me[++W]&&KG&&--F!=0);return de<=k.lookahead?de:k.lookahead}function q(k){var X,W,$,F,K,de,oe,G,me,ae,te=k.w_size;do{if(F=k.window_size-k.lookahead-k.strstart,k.strstart>=te+(te-N)){for(v.arraySet(k.window,k.window,te,te,0),k.match_start-=te,k.strstart-=te,k.block_start-=te,X=W=k.hash_size;$=k.head[--X],k.head[X]=te<=$?$-te:0,--W;);for(X=W=te;$=k.prev[--X],k.prev[X]=te<=$?$-te:0,--W;);F+=te}if(k.strm.avail_in===0)break;if(de=k.strm,oe=k.window,G=k.strstart+k.lookahead,me=F,ae=void 0,ae=de.avail_in,me=A)for(K=k.strstart-k.insert,k.ins_h=k.window[K],k.ins_h=(k.ins_h<=A&&(k.ins_h=(k.ins_h<=A)if($=o._tr_tally(k,k.strstart-k.match_start,k.match_length-A),k.lookahead-=k.match_length,k.match_length<=k.max_lazy_match&&k.lookahead>=A){for(k.match_length--;k.strstart++,k.ins_h=(k.ins_h<=A&&(k.ins_h=(k.ins_h<=A&&k.match_length<=k.prev_length){for(F=k.strstart+k.lookahead-A,$=o._tr_tally(k,k.strstart-1-k.prev_match,k.prev_length-A),k.lookahead-=k.prev_length-1,k.prev_length-=2;++k.strstart<=F&&(k.ins_h=(k.ins_h<k.pending_buf_size-5&&(W=k.pending_buf_size-5);;){if(k.lookahead<=1){if(q(k),k.lookahead===0&&X===c)return E;if(k.lookahead===0)break}k.strstart+=k.lookahead,k.lookahead=0;var $=k.block_start+W;if((k.strstart===0||k.strstart>=$)&&(k.lookahead=k.strstart-$,k.strstart=$,L(k,!1),k.strm.avail_out===0)||k.strstart-k.block_start>=k.w_size-N&&(L(k,!1),k.strm.avail_out===0))return E}return k.insert=0,X===f?(L(k,!0),k.strm.avail_out===0?ne:Q):(k.strstart>k.block_start&&(L(k,!1),k.strm.avail_out),E)}),new he(4,4,8,4,Z),new he(4,5,16,8,Z),new he(4,6,32,32,Z),new he(4,4,16,16,ie),new he(8,16,32,32,ie),new he(8,16,128,128,ie),new he(8,32,128,256,ie),new he(32,128,258,1024,ie),new he(32,258,258,4096,ie)],i.deflateInit=function(k,X){return Y(k,X,b,15,8,0)},i.deflateInit2=Y,i.deflateReset=H,i.deflateResetKeep=ye,i.deflateSetHeader=function(k,X){return k&&k.state?k.state.wrap!==2?d:(k.state.gzhead=X,s):d},i.deflate=function(k,X){var W,$,F,K;if(!k||!k.state||5>8&255),J($,$.gzhead.time>>16&255),J($,$.gzhead.time>>24&255),J($,$.level===9?2:2<=$.strategy||$.level<2?4:0),J($,255&$.gzhead.os),$.gzhead.extra&&$.gzhead.extra.length&&(J($,255&$.gzhead.extra.length),J($,$.gzhead.extra.length>>8&255)),$.gzhead.hcrc&&(k.adler=u(k.adler,$.pending_buf,$.pending,0)),$.gzindex=0,$.status=69):(J($,0),J($,0),J($,0),J($,0),J($,0),J($,$.level===9?2:2<=$.strategy||$.level<2?4:0),J($,3),$.status=B);else{var de=b+($.w_bits-8<<4)<<8;de|=(2<=$.strategy||$.level<2?0:$.level<6?1:$.level===6?2:3)<<6,$.strstart!==0&&(de|=32),de+=31-de%31,$.status=B,V($,de),$.strstart!==0&&(V($,k.adler>>>16),V($,65535&k.adler)),k.adler=1}if($.status===69)if($.gzhead.extra){for(F=$.pending;$.gzindex<(65535&$.gzhead.extra.length)&&($.pending!==$.pending_buf_size||($.gzhead.hcrc&&$.pending>F&&(k.adler=u(k.adler,$.pending_buf,$.pending-F,F)),M(k),F=$.pending,$.pending!==$.pending_buf_size));)J($,255&$.gzhead.extra[$.gzindex]),$.gzindex++;$.gzhead.hcrc&&$.pending>F&&(k.adler=u(k.adler,$.pending_buf,$.pending-F,F)),$.gzindex===$.gzhead.extra.length&&($.gzindex=0,$.status=73)}else $.status=73;if($.status===73)if($.gzhead.name){F=$.pending;do{if($.pending===$.pending_buf_size&&($.gzhead.hcrc&&$.pending>F&&(k.adler=u(k.adler,$.pending_buf,$.pending-F,F)),M(k),F=$.pending,$.pending===$.pending_buf_size)){K=1;break}K=$.gzindex<$.gzhead.name.length?255&$.gzhead.name.charCodeAt($.gzindex++):0,J($,K)}while(K!==0);$.gzhead.hcrc&&$.pending>F&&(k.adler=u(k.adler,$.pending_buf,$.pending-F,F)),K===0&&($.gzindex=0,$.status=91)}else $.status=91;if($.status===91)if($.gzhead.comment){F=$.pending;do{if($.pending===$.pending_buf_size&&($.gzhead.hcrc&&$.pending>F&&(k.adler=u(k.adler,$.pending_buf,$.pending-F,F)),M(k),F=$.pending,$.pending===$.pending_buf_size)){K=1;break}K=$.gzindex<$.gzhead.comment.length?255&$.gzhead.comment.charCodeAt($.gzindex++):0,J($,K)}while(K!==0);$.gzhead.hcrc&&$.pending>F&&(k.adler=u(k.adler,$.pending_buf,$.pending-F,F)),K===0&&($.status=103)}else $.status=103;if($.status===103&&($.gzhead.hcrc?($.pending+2>$.pending_buf_size&&M(k),$.pending+2<=$.pending_buf_size&&(J($,255&k.adler),J($,k.adler>>8&255),k.adler=0,$.status=B)):$.status=B),$.pending!==0){if(M(k),k.avail_out===0)return $.last_flush=-1,s}else if(k.avail_in===0&&I(X)<=I(W)&&X!==f)return ue(k,-5);if($.status===666&&k.avail_in!==0)return ue(k,-5);if(k.avail_in!==0||$.lookahead!==0||X!==c&&$.status!==666){var oe=$.strategy===2?function(G,me){for(var ae;;){if(G.lookahead===0&&(q(G),G.lookahead===0)){if(me===c)return E;break}if(G.match_length=0,ae=o._tr_tally(G,0,G.window[G.strstart]),G.lookahead--,G.strstart++,ae&&(L(G,!1),G.strm.avail_out===0))return E}return G.insert=0,me===f?(L(G,!0),G.strm.avail_out===0?ne:Q):G.last_lit&&(L(G,!1),G.strm.avail_out===0)?E:U}($,X):$.strategy===3?function(G,me){for(var ae,te,be,Ce,xe=G.window;;){if(G.lookahead<=D){if(q(G),G.lookahead<=D&&me===c)return E;if(G.lookahead===0)break}if(G.match_length=0,G.lookahead>=A&&0G.lookahead&&(G.match_length=G.lookahead)}if(G.match_length>=A?(ae=o._tr_tally(G,1,G.match_length-A),G.lookahead-=G.match_length,G.strstart+=G.match_length,G.match_length=0):(ae=o._tr_tally(G,0,G.window[G.strstart]),G.lookahead--,G.strstart++),ae&&(L(G,!1),G.strm.avail_out===0))return E}return G.insert=0,me===f?(L(G,!0),G.strm.avail_out===0?ne:Q):G.last_lit&&(L(G,!1),G.strm.avail_out===0)?E:U}($,X):l[$.level].func($,X);if(oe!==ne&&oe!==Q||($.status=666),oe===E||oe===ne)return k.avail_out===0&&($.last_flush=-1),s;if(oe===U&&(X===1?o._tr_align($):X!==5&&(o._tr_stored_block($,0,0,!1),X===3&&(z($.head),$.lookahead===0&&($.strstart=0,$.block_start=0,$.insert=0))),M(k),k.avail_out===0))return $.last_flush=-1,s}return X!==f?s:$.wrap<=0?1:($.wrap===2?(J($,255&k.adler),J($,k.adler>>8&255),J($,k.adler>>16&255),J($,k.adler>>24&255),J($,255&k.total_in),J($,k.total_in>>8&255),J($,k.total_in>>16&255),J($,k.total_in>>24&255)):(V($,k.adler>>>16),V($,65535&k.adler)),M(k),0<$.wrap&&($.wrap=-$.wrap),$.pending!==0?s:1)},i.deflateEnd=function(k){var X;return k&&k.state?(X=k.state.status)!==R&&X!==69&&X!==73&&X!==91&&X!==103&&X!==B&&X!==666?ue(k,d):(k.state=null,X===B?ue(k,-3):s):d},i.deflateSetDictionary=function(k,X){var W,$,F,K,de,oe,G,me,ae=X.length;if(!k||!k.state||(K=(W=k.state).wrap)===2||K===1&&W.status!==R||W.lookahead)return d;for(K===1&&(k.adler=a(k.adler,X,ae,0)),W.wrap=0,ae>=W.w_size&&(K===0&&(z(W.head),W.strstart=0,W.block_start=0,W.insert=0),me=new v.Buf8(W.w_size),v.arraySet(me,X,ae-W.w_size,W.w_size,0),X=me,ae=W.w_size),de=k.avail_in,oe=k.next_in,G=k.input,k.avail_in=ae,k.next_in=0,k.input=X,q(W);W.lookahead>=A;){for($=W.strstart,F=W.lookahead-(A-1);W.ins_h=(W.ins_h<>>=A=O>>>24,_-=A,(A=O>>>16&255)===0)U[h++]=65535&O;else{if(!(16&A)){if((64&A)==0){O=w[(65535&O)+(b&(1<>>=A,_-=A),_<15&&(b+=E[a++]<<_,_+=8,b+=E[a++]<<_,_+=8),O=S[b&T];n:for(;;){if(b>>>=A=O>>>24,_-=A,!(16&(A=O>>>16&255))){if((64&A)==0){O=S[(65535&O)+(b&(1<>>=A,_-=A,(A=h-c)>3,b&=(1<<(_-=D<<3))-1,l.next_in=a,l.next_out=h,l.avail_in=a>>24&255)+(R>>>8&65280)+((65280&R)<<8)+((255&R)<<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 l.Buf16(320),this.work=new l.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(R){var B;return R&&R.state?(B=R.state,R.total_in=R.total_out=B.total=0,R.msg="",B.wrap&&(R.adler=1&B.wrap),B.mode=d,B.last=0,B.havedict=0,B.dmax=32768,B.head=null,B.hold=0,B.bits=0,B.lencode=B.lendyn=new l.Buf32(g),B.distcode=B.distdyn=new l.Buf32(m),B.sane=1,B.back=-1,f):s}function w(R){var B;return R&&R.state?((B=R.state).wsize=0,B.whave=0,B.wnext=0,_(R)):s}function S(R,B){var E,U;return R&&R.state?(U=R.state,B<0?(E=0,B=-B):(E=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15=Q.wsize?(l.arraySet(Q.window,B,E-Q.wsize,Q.wsize,0),Q.wnext=0,Q.whave=Q.wsize):(U<(ne=Q.wsize-Q.wnext)&&(ne=U),l.arraySet(Q.window,B,E-U,ne,Q.wnext),(U-=ne)?(l.arraySet(Q.window,B,E-U,U,0),Q.wnext=U,Q.whave=Q.wsize):(Q.wnext+=ne,Q.wnext===Q.wsize&&(Q.wnext=0),Q.whave>>8&255,E.check=o(E.check,K,2,0),L=M=0,E.mode=2;break}if(E.flags=0,E.head&&(E.head.done=!1),!(1&E.wrap)||(((255&M)<<8)+(M>>8))%31){R.msg="incorrect header check",E.mode=30;break}if((15&M)!=8){R.msg="unknown compression method",E.mode=30;break}if(L-=4,k=8+(15&(M>>>=4)),E.wbits===0)E.wbits=k;else if(k>E.wbits){R.msg="invalid window size",E.mode=30;break}E.dmax=1<>8&1),512&E.flags&&(K[0]=255&M,K[1]=M>>>8&255,E.check=o(E.check,K,2,0)),L=M=0,E.mode=3;case 3:for(;L<32;){if(I===0)break e;I--,M+=U[Q++]<>>8&255,K[2]=M>>>16&255,K[3]=M>>>24&255,E.check=o(E.check,K,4,0)),L=M=0,E.mode=4;case 4:for(;L<16;){if(I===0)break e;I--,M+=U[Q++]<>8),512&E.flags&&(K[0]=255&M,K[1]=M>>>8&255,E.check=o(E.check,K,2,0)),L=M=0,E.mode=5;case 5:if(1024&E.flags){for(;L<16;){if(I===0)break e;I--,M+=U[Q++]<>>8&255,E.check=o(E.check,K,2,0)),L=M=0}else E.head&&(E.head.extra=null);E.mode=6;case 6:if(1024&E.flags&&(I<(P=E.length)&&(P=I),P&&(E.head&&(k=E.head.extra_len-E.length,E.head.extra||(E.head.extra=new Array(E.head.extra_len)),l.arraySet(E.head.extra,U,Q,P,k)),512&E.flags&&(E.check=o(E.check,U,P,Q)),I-=P,Q+=P,E.length-=P),E.length))break e;E.length=0,E.mode=7;case 7:if(2048&E.flags){if(I===0)break e;for(P=0;k=U[Q+P++],E.head&&k&&E.length<65536&&(E.head.name+=String.fromCharCode(k)),k&&P>9&1,E.head.done=!0),R.adler=E.check=0,E.mode=12;break;case 10:for(;L<32;){if(I===0)break e;I--,M+=U[Q++]<>>=7&L,L-=7&L,E.mode=27;break}for(;L<3;){if(I===0)break e;I--,M+=U[Q++]<>>=1)){case 0:E.mode=14;break;case 1:if(D(E),E.mode=20,B!==6)break;M>>>=2,L-=2;break e;case 2:E.mode=17;break;case 3:R.msg="invalid block type",E.mode=30}M>>>=2,L-=2;break;case 14:for(M>>>=7&L,L-=7&L;L<32;){if(I===0)break e;I--,M+=U[Q++]<>>16^65535)){R.msg="invalid stored block lengths",E.mode=30;break}if(E.length=65535&M,L=M=0,E.mode=15,B===6)break e;case 15:E.mode=16;case 16:if(P=E.length){if(I>>=5,L-=5,E.ndist=1+(31&M),M>>>=5,L-=5,E.ncode=4+(15&M),M>>>=4,L-=4,286>>=3,L-=3}for(;E.have<19;)E.lens[de[E.have++]]=0;if(E.lencode=E.lendyn,E.lenbits=7,W={bits:E.lenbits},X=u(0,E.lens,0,19,E.lencode,0,E.work,W),E.lenbits=W.bits,X){R.msg="invalid code lengths set",E.mode=30;break}E.have=0,E.mode=19;case 19:for(;E.have>>16&255,ge=65535&F,!((ie=F>>>24)<=L);){if(I===0)break e;I--,M+=U[Q++]<>>=ie,L-=ie,E.lens[E.have++]=ge;else{if(ge===16){for($=ie+2;L<$;){if(I===0)break e;I--,M+=U[Q++]<>>=ie,L-=ie,E.have===0){R.msg="invalid bit length repeat",E.mode=30;break}k=E.lens[E.have-1],P=3+(3&M),M>>>=2,L-=2}else if(ge===17){for($=ie+3;L<$;){if(I===0)break e;I--,M+=U[Q++]<>>=ie)),M>>>=3,L-=3}else{for($=ie+7;L<$;){if(I===0)break e;I--,M+=U[Q++]<>>=ie)),M>>>=7,L-=7}if(E.have+P>E.nlen+E.ndist){R.msg="invalid bit length repeat",E.mode=30;break}for(;P--;)E.lens[E.have++]=k}}if(E.mode===30)break;if(E.lens[256]===0){R.msg="invalid code -- missing end-of-block",E.mode=30;break}if(E.lenbits=9,W={bits:E.lenbits},X=u(h,E.lens,0,E.nlen,E.lencode,0,E.work,W),E.lenbits=W.bits,X){R.msg="invalid literal/lengths set",E.mode=30;break}if(E.distbits=6,E.distcode=E.distdyn,W={bits:E.distbits},X=u(c,E.lens,E.nlen,E.ndist,E.distcode,0,E.work,W),E.distbits=W.bits,X){R.msg="invalid distances set",E.mode=30;break}if(E.mode=20,B===6)break e;case 20:E.mode=21;case 21:if(6<=I&&258<=z){R.next_out=ue,R.avail_out=z,R.next_in=Q,R.avail_in=I,E.hold=M,E.bits=L,a(R,V),ue=R.next_out,ne=R.output,z=R.avail_out,Q=R.next_in,U=R.input,I=R.avail_in,M=E.hold,L=E.bits,E.mode===12&&(E.back=-1);break}for(E.back=0;he=(F=E.lencode[M&(1<>>16&255,ge=65535&F,!((ie=F>>>24)<=L);){if(I===0)break e;I--,M+=U[Q++]<>ye)])>>>16&255,ge=65535&F,!(ye+(ie=F>>>24)<=L);){if(I===0)break e;I--,M+=U[Q++]<>>=ye,L-=ye,E.back+=ye}if(M>>>=ie,L-=ie,E.back+=ie,E.length=ge,he===0){E.mode=26;break}if(32&he){E.back=-1,E.mode=12;break}if(64&he){R.msg="invalid literal/length code",E.mode=30;break}E.extra=15&he,E.mode=22;case 22:if(E.extra){for($=E.extra;L<$;){if(I===0)break e;I--,M+=U[Q++]<>>=E.extra,L-=E.extra,E.back+=E.extra}E.was=E.length,E.mode=23;case 23:for(;he=(F=E.distcode[M&(1<>>16&255,ge=65535&F,!((ie=F>>>24)<=L);){if(I===0)break e;I--,M+=U[Q++]<>ye)])>>>16&255,ge=65535&F,!(ye+(ie=F>>>24)<=L);){if(I===0)break e;I--,M+=U[Q++]<>>=ye,L-=ye,E.back+=ye}if(M>>>=ie,L-=ie,E.back+=ie,64&he){R.msg="invalid distance code",E.mode=30;break}E.offset=ge,E.extra=15&he,E.mode=24;case 24:if(E.extra){for($=E.extra;L<$;){if(I===0)break e;I--,M+=U[Q++]<>>=E.extra,L-=E.extra,E.back+=E.extra}if(E.offset>E.dmax){R.msg="invalid distance too far back",E.mode=30;break}E.mode=25;case 25:if(z===0)break e;if(P=V-z,E.offset>P){if((P=E.offset-P)>E.whave&&E.sane){R.msg="invalid distance too far back",E.mode=30;break}q=P>E.wnext?(P-=E.wnext,E.wsize-P):E.wnext-P,P>E.length&&(P=E.length),Z=E.window}else Z=ne,q=ue-E.offset,P=E.length;for(zT?(A=q[Z+m[B]],L[J+m[B]]):(A=96,0),b=1<>ue)+(_-=b)]=O<<24|A<<16|D|0,_!==0;);for(b=1<>=1;if(b!==0?(M&=b-1,M+=b):M=0,B++,--V[R]==0){if(R===U)break;R=c[f+m[B]]}if(ne>>7)]}function J(F,K){F.pending_buf[F.pending++]=255&K,F.pending_buf[F.pending++]=K>>>8&255}function V(F,K,de){F.bi_valid>y-de?(F.bi_buf|=K<>y-F.bi_valid,F.bi_valid+=de-y):(F.bi_buf|=K<>>=1,de<<=1,0<--K;);return de>>>1}function Z(F,K,de){var oe,G,me=new Array(m+1),ae=0;for(oe=1;oe<=m;oe++)me[oe]=ae=ae+de[oe-1]<<1;for(G=0;G<=K;G++){var te=F[2*G+1];te!==0&&(F[2*G]=q(me[te]++,te))}}function ie(F){var K;for(K=0;K>1;1<=de;de--)ye(F,me,de);for(G=be;de=F.heap[1],F.heap[1]=F.heap[F.heap_len--],ye(F,me,1),oe=F.heap[1],F.heap[--F.heap_max]=de,F.heap[--F.heap_max]=oe,me[2*G]=me[2*de]+me[2*oe],F.depth[G]=(F.depth[de]>=F.depth[oe]?F.depth[de]:F.depth[oe])+1,me[2*de+1]=me[2*oe+1]=G,F.heap[1]=G++,ye(F,me,1),2<=F.heap_len;);F.heap[--F.heap_max]=F.heap[1],function(xe,Ie){var ve,Se,Me,Le,ot,pt,st=Ie.dyn_tree,Xt=Ie.max_code,Jt=Ie.stat_desc.static_tree,Or=Ie.stat_desc.has_stree,mn=Ie.stat_desc.extra_bits,xn=Ie.stat_desc.extra_base,ut=Ie.stat_desc.max_length,Qt=0;for(Le=0;Le<=m;Le++)xe.bl_count[Le]=0;for(st[2*xe.heap[xe.heap_max]+1]=0,ve=xe.heap_max+1;ve>=7;G>>=1)if(1&Ce&&te.dyn_ltree[2*be]!==0)return v;if(te.dyn_ltree[18]!==0||te.dyn_ltree[20]!==0||te.dyn_ltree[26]!==0)return o;for(be=32;be>>3,(me=F.static_len+3+7>>>3)<=G&&(G=me)):G=me=de+5,de+4<=G&&K!==-1?$(F,K,de,oe):F.strategy===4||me===G?(V(F,2+(oe?1:0),3),H(F,N,R)):(V(F,4+(oe?1:0),3),function(te,be,Ce,xe){var Ie;for(V(te,be-257,5),V(te,Ce-1,5),V(te,xe-4,4),Ie=0;Ie>>8&255,F.pending_buf[F.d_buf+2*F.last_lit+1]=255&K,F.pending_buf[F.l_buf+F.last_lit]=255&de,F.last_lit++,K===0?F.dyn_ltree[2*de]++:(F.matches++,K--,F.dyn_ltree[2*(E[de]+c+1)]++,F.dyn_dtree[2*L(K)]++),F.last_lit===F.lit_bufsize-1},i._tr_align=function(F){V(F,2,3),P(F,_,N),function(K){K.bi_valid===16?(J(K,K.bi_buf),K.bi_buf=0,K.bi_valid=0):8<=K.bi_valid&&(K.pending_buf[K.pending++]=255&K.bi_buf,K.bi_buf>>=8,K.bi_valid-=8)}(F)}},{"../utils/common":41}],53:[function(n,r,i){r.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(n,r,i){(function(l){(function(v,o){if(!v.setImmediate){var a,u,h,c,f=1,s={},d=!1,g=v.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(v);m=m&&m.setTimeout?m:v,a={}.toString.call(v.process)==="[object process]"?function(w){process.nextTick(function(){b(w)})}:function(){if(v.postMessage&&!v.importScripts){var w=!0,S=v.onmessage;return v.onmessage=function(){w=!1},v.postMessage("","*"),v.onmessage=S,w}}()?(c="setImmediate$"+Math.random()+"$",v.addEventListener?v.addEventListener("message",_,!1):v.attachEvent("onmessage",_),function(w){v.postMessage(c+w,"*")}):v.MessageChannel?((h=new MessageChannel).port1.onmessage=function(w){b(w.data)},function(w){h.port2.postMessage(w)}):g&&"onreadystatechange"in g.createElement("script")?(u=g.documentElement,function(w){var S=g.createElement("script");S.onreadystatechange=function(){b(w),S.onreadystatechange=null,u.removeChild(S),S=null},u.appendChild(S)}):function(w){setTimeout(b,0,w)},m.setImmediate=function(w){typeof w!="function"&&(w=new Function(""+w));for(var S=new Array(arguments.length-1),x=0;x"u"?l===void 0?this:l:self)}).call(this,typeof Hl<"u"?Hl:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(jw);var ih=function(e,t){return ih=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},ih(e,t)};function Gp(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");ih(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function iU(e,t,n,r){function i(l){return l instanceof n?l:new n(function(v){v(l)})}return new(n||(n=Promise))(function(l,v){function o(h){try{u(r.next(h))}catch(c){v(c)}}function a(h){try{u(r.throw(h))}catch(c){v(c)}}function u(h){h.done?l(h.value):i(h.value).then(o,a)}u((r=r.apply(e,t||[])).next())})}function Vw(e,t){var n={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},r,i,l,v;return v={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function o(u){return function(h){return a([u,h])}}function a(u){if(r)throw new TypeError("Generator is already executing.");for(;v&&(v=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(l=u[0]&2?i.return:u[0]?i.throw||((l=i.return)&&l.call(i),0):i.next)&&!(l=l.call(i,u[1])).done)return l;switch(i=0,l&&(u=[u[0]&2,l.value]),u[0]){case 0:case 1:l=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(l=n.trys,!(l=l.length>0&&l[l.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!l||u[1]>l[0]&&u[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ac(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,l=[],v;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)l.push(i.value)}catch(o){v={error:o}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(v)throw v.error}}return l}function oc(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,l;r1||o(f,s)})})}function o(f,s){try{a(r[f](s))}catch(d){c(l[0][3],d)}}function a(f){f.value instanceof no?Promise.resolve(f.value.v).then(u,h):c(l[0][2],f)}function u(f){o("next",f)}function h(f){o("throw",f)}function c(f,s){f(s),l.shift(),l.length&&o(l[0][0],l[0][1])}}function oU(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Qs=="function"?Qs(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(l){n[l]=e[l]&&function(v){return new Promise(function(o,a){v=e[l](v),i(o,a,v.done,v.value)})}}function i(l,v,o,a){Promise.resolve(a).then(function(u){l({value:u,done:o})},v)}}function Zt(e){return typeof e=="function"}function sU(e){var t=function(r){Error.call(r),r.stack=new Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var Af=sU(function(e){return function(n){e(this),this.message=n?n.length+` errors occurred during unsubscription: `+n.map(function(r,i){return i+1+") "+r.toString()}).join(` - `):"",this.name="UnsubscriptionError",this.errors=n}});function T0(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var qp=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,i,l;if(!this.closed){this.closed=!0;var v=this._parentage;if(v)if(this._parentage=null,Array.isArray(v))try{for(var o=Qs(v),a=o.next();!a.done;a=o.next()){var u=a.value;u.remove(this)}}catch(g){t={error:g}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}else v.remove(this);var h=this.initialTeardown;if(Zt(h))try{h()}catch(g){l=g instanceof Af?g.errors:[g]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var f=Qs(c),s=f.next();!s.done;s=f.next()){var d=s.value;try{k0(d)}catch(g){l=l!=null?l:[],g instanceof Af?l=oc(oc([],ac(l)),ac(g.errors)):l.push(g)}}}catch(g){r={error:g}}finally{try{s&&!s.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}}if(l)throw new Af(l)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)k0(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&T0(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&T0(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();qp.EMPTY;function Uw(e){return e instanceof qp||e&&"closed"in e&&Zt(e.remove)&&Zt(e.add)&&Zt(e.unsubscribe)}function k0(e){Zt(e)?e():e.unsubscribe()}var Vc={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},ah={setTimeout:function(e,t){for(var n=[],r=2;rn.value=i,error:t==null?void 0:t.onError});return DU(()=>{r.unsubscribe()}),n}function BU(e,t,n){const r=se(n==null?void 0:n.initialValue),i=Kp(e);let l=i.subscribe({next:v=>r.value=v,error:n==null?void 0:n.onError});return ke(t,()=>{l.unsubscribe(),l=i.subscribe({next:v=>r.value=v,error:n==null?void 0:n.onError})}),ti(()=>{l.unsubscribe()}),r}const wa=Co("outputs",()=>{const e=$U(LU(Kp(()=>Lt.outputs.count())),{initialValue:0}),t=se(1),n=Pn("sortOutputsBy","Oldest"),r=Pn("currentImagesLayout","dynamic"),i=se("all"),l=BU(()=>{const s=Gt();let d;return i.value==="all"?d=Lt.outputs:i.value==="favourited"?d=Lt.outputs.where("starred").equals(1):i.value==="unfavourited"?d=Lt.outputs.where("starred").equals(0):d=Lt.outputs.where("rated").equals(0),n.value==="Newest"&&(d=d.reverse()),s.pageless==="Enabled"?d.toArray():d.offset((t.value-1)*s.pageSize).limit(s.pageSize).toArray()},[Cn(Gt(),"pageless"),Cn(Gt(),"pageSize"),t,n,i],{initialValue:[]});async function v(){if(navigator.storage&&navigator.storage.persist){const s=await navigator.storage.persist();console.log(`Persisted storage granted: ${s}`)}}async function o(){const s=localStorage.getItem("outputs");!s||(a(JSON.parse(s)),localStorage.removeItem("outputs"))}v(),o();async function a(s){const d=s.map(y=>{const{id:b,..._}=y;return _}),g=JSON.parse(JSON.stringify(d));console.log("Inserting outputs into database",g);const m=await Lt.outputs.bulkAdd(g,void 0,{allKeys:!0});return Lt.outputs.bulkGet(m)}async function u(s){const d=$t();if(!s.raw)return;if(!s.raw.type.includes("zip")){d.raiseError("Uploaded file needs to be a ZIP!",!1);return}const{files:g}=await jw.exports.loadAsync(s.raw);let m=0,y=0;Ri({message:"Loading images...",type:"info"});const b=[];for(const[w,S]of Object.entries(g)){const x=w.split("."),T=x.slice(-1).join("."),O=x.slice(0,-1).join(".");(T==="webp"||T==="png"||T==="gif"||T==="jpg"||T==="jpeg")&&b.push(new Promise(A=>{S.async("base64").then(async D=>{if(!g[O+".json"])return y++,A(null);const N=JSON.parse(await g[O+".json"].async("text"));m++,A({id:-1,image:`data:image/webp;base64,${D}`,...N,rated:N.rated?1:0,starred:N.starred?1:0})}).catch(D=>(d.raiseError(`Error while importing image: ${D}`,!1),y++,A(null)))}))}const _=await Promise.all(b);a(_.filter(w=>w!==null)),Ri({message:`Successfully imported ${m}/${m+y} images!`,type:"success"})}async function h(s){const d=await Lt.outputs.get(s);return Lt.outputs.update(s,{starred:d!=null&&d.starred?0:1})}function c(s){return Lt.outputs.delete(s)}async function f(s){const d=$t();return d.selected=[],d.multiSelect=!1,s===await Lt.outputs.toCollection().primaryKeys()?Lt.outputs.clear():Lt.outputs.bulkDelete(s)}return{outputsLength:e,sortBy:n,filterBy:i,currentPage:t,currentOutputs:l,currentLayout:r,deleteOutput:c,deleteMultipleOutputs:f,toggleStarred:h,pushOutputs:a,importFromZip:u}}),$t=Co("ui",()=>{const e=se(!1),t=se([]),n=se(["1"]),r=se(-1),i=se(!1),l=se(!1);function v(f,s){console.error(f),Ri({type:"error",message:f,duration:s?0:void 0,showClose:s})}function o(f,s){console.warn(f),Ri({type:"warning",message:f,duration:s?0:void 0,showClose:s})}function a(){e.value=!e.value,!e.value&&(t.value=[])}function u(f){if(t.value.includes(f)){const s=t.value.indexOf(f);t.value.splice(s,1),t.value.length===0&&(e.value=!1);return}t.value.push(f)}async function h(){const f=wa(),s=Gt(),d=f.currentOutputs.findIndex(m=>m.id===r.value),g=f.currentOutputs[d+1];if(g){r.value=g.id;return}if(f.currentPage<=Math.floor(f.outputsLength/s.pageSize)){const m=f.sortBy==="Newest"?await Lt.outputs.where(":id").below(r.value).last():await Lt.outputs.where(":id").above(r.value).first();f.currentPage++,r.value=(m==null?void 0:m.id)||r.value;return}}async function c(){const f=wa(),s=f.currentOutputs.findIndex(g=>g.id===r.value),d=f.currentOutputs[s-1];if(f.currentPage>1&&!d){const g=f.sortBy==="Oldest"?await Lt.outputs.where(":id").below(r.value).last():await Lt.outputs.where(":id").above(r.value).first();f.currentPage--,r.value=(g==null?void 0:g.id)||r.value;return}if(d){r.value=d.id;return}}return{multiSelect:e,selected:t,activeCollapse:n,activeModal:r,showGeneratorBadge:i,showGeneratedImages:l,raiseError:v,raiseWarning:o,toggleMultiSelect:a,toggleSelection:u,openModalToRight:h,openModalToLeft:c}}),Yt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},FU={},zU={viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},NU=re("circle",{cy:"12",cx:"12",r:"12",stroke:"currentColor"},null,-1),jU=[NU];function VU(e,t){return j(),ce("svg",zU,jU)}const UU=Yt(FU,[["render",VU]]),Wo=Ee({__name:"MainMenuItem",props:{index:null,isMobile:{type:Boolean}},setup(e){return(t,n)=>(j(),we(C(Ep),{index:e.index},{default:pe(()=>[Te(t.$slots,"icon"),e.isMobile?_e("",!0):Te(t.$slots,"title",{key:0})]),_:3},8,["index"]))}});const HU="modulepreload",WU=function(e,t){return new URL(e,t).href},P0={},If=function(t,n,r){if(!n||n.length===0)return t();const i=document.getElementsByTagName("link");return Promise.all(n.map(l=>{if(l=WU(l,r),l in P0)return;P0[l]=!0;const v=l.endsWith(".css"),o=v?'[rel="stylesheet"]':"";if(!!r)for(let h=i.length-1;h>=0;h--){const c=i[h];if(c.href===l&&(!v||c.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${o}`))return;const u=document.createElement("link");if(u.rel=v?"stylesheet":HU,v||(u.as="script",u.crossOrigin=""),u.href=l,document.head.appendChild(u),v)return new Promise((h,c)=>{u.addEventListener("load",h),u.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${l}`)))})})).then(()=>t())};const YU={},XU={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},KU=re("path",{d:"M7 14c-1.66 0-3 1.34-3 3c0 1.31-1.16 2-2 2c.92 1.22 2.49 2 4 2c2.21 0 4-1.79 4-4c0-1.66-1.34-3-3-3zm13.71-9.37l-1.34-1.34a.996.996 0 0 0-1.41 0L9 12.25L11.75 15l8.96-8.96a.996.996 0 0 0 0-1.41z",fill:"currentColor"},null,-1),GU=[KU];function qU(e,t){return j(),ce("svg",XU,GU)}const a2=Yt(YU,[["render",qU]]),ZU={},JU={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 32 32"},QU=re("path",{d:"M24 14a5.99 5.99 0 0 0-4.885 9.471L14 28.586L15.414 30l5.115-5.115A5.997 5.997 0 1 0 24 14zm0 10a4 4 0 1 1 4-4a4.005 4.005 0 0 1-4 4z",fill:"currentColor"},null,-1),eH=re("path",{d:"M17 12a3 3 0 1 0-3-3a3.003 3.003 0 0 0 3 3zm0-4a1 1 0 1 1-1 1a1 1 0 0 1 1-1z",fill:"currentColor"},null,-1),tH=re("path",{d:"M12 24H4v-6.003L9 13l5.586 5.586L16 17.168l-5.586-5.585a2 2 0 0 0-2.828 0L4 15.168V4h20v6h2V4a2.002 2.002 0 0 0-2-2H4a2.002 2.002 0 0 0-2 2v20a2.002 2.002 0 0 0 2 2h8z",fill:"currentColor"},null,-1),nH=[QU,eH,tH];function rH(e,t){return j(),ce("svg",JU,nH)}const iH=Yt(ZU,[["render",rH]]);function o2(){const e=se("..."),t=setInterval(()=>{e.value=e.value.length>=3?"":".".repeat(e.value.length+1)},1e3);return ti(()=>{clearInterval(t)}),{ellipsis:e}}const s2=e=>(Jr("data-v-dc223229"),e=e(),Qr(),e),aH={style:{"text-align":"center"}},oH=s2(()=>re("br",null,null,-1)),sH={class:"gen-text"},lH={key:0},uH={key:1},cH=s2(()=>re("br",null,null,-1)),fH=Ee({__name:"ImageProgress",props:{generated:null,total:null,elapsed:null},emits:["showGenerated"],setup(e){const{ellipsis:t}=o2();return(n,r)=>{var i,l;return j(),ce("div",aH,[le(C(nw),{type:"circle",percentage:100*((i=e.generated)!=null?i:0)/((l=e.total)!=null?l:1),width:200},{default:pe(()=>[re("span",null,Ae(e.generated)+" / "+Ae(e.total),1),oH]),_:1},8,["percentage"]),re("div",sH,[e.generated===e.total?(j(),ce("span",lH,"All done!")):(j(),ce("span",uH,[Ne("Generating"+Ae(C(t))+Ae("\xA0".repeat(3-C(t).length)),1),cH,re("sup",null,Ae(e.elapsed),1)]))]),e.generated?(j(),ce("div",{key:0,onClick:r[0]||(r[0]=v=>n.$emit("showGenerated")),class:"view-images"},[re("span",null,"View image"+Ae(e.total===1?"":"s"),1),le(C(De),null,{default:pe(()=>[le(C(EO))]),_:1})])):_e("",!0)])}}});const dH=Yt(fH,[["__scopeId","data-v-dc223229"]]);const hH={style:{width:"200px"}},pH=Ee({__name:"InfoTooltip",props:{info:null,size:null,trigger:null},setup(e){return(t,n)=>(j(),we(C(kr),{trigger:e.trigger},{content:pe(()=>[re("div",hH,[Te(t.$slots,"default",{},()=>[Ne(Ae(e.info),1)])])]),default:pe(()=>[le(C(De),{size:e.size},{default:pe(()=>[le(C(Wh))]),_:1},8,["size"])]),_:3},8,["trigger"]))}}),mH={key:0,class:"align-vertical",style:{"margin-left":"5px"}},gH=Ee({__name:"FormLabel",props:{label:null,info:null,labelStyle:null},setup(e){return(t,n)=>(j(),ce("span",{class:"align-vertical",style:Fe(e.labelStyle||"height: 100%;")},[Te(t.$slots,"default",{},()=>[Ne(Ae(e.label),1)],!0),e.info?(j(),ce("div",mH,[le(pH,{info:e.info,size:15},null,8,["info"])])):_e("",!0)],4))}});const xl=Yt(gH,[["__scopeId","data-v-ec7e7ec1"]]),vH={key:0,style:{width:"100%"}},yH={key:1,style:{display:"flex","flex-direction":"column",gap:"8px",width:"100%"}},En=Ee({__name:"FormSlider",props:{label:null,modelValue:null,prop:null,min:null,max:null,step:null,info:null,disabled:{type:Boolean},labelStyle:null,multiple:{type:Boolean}},emits:["update:modelValue","change","onAdd","onRemove"],setup(e,{emit:t}){const n=e,i=up(lp).smallerOrEqual("md");function l(h,c){var s;if(n.multiple&&Array.isArray(n.modelValue)){c=c||0;const d=(s=Array.isArray(h)?h[0]:h)!=null?s:n.min;let g=n.modelValue;g[c]=d,t("update:modelValue",g),t("change",g);return}const f=h!=null?h:n.min;t("update:modelValue",f),t("change",f)}function v(){if(!n.multiple||!Array.isArray(n.modelValue))return;const h=n.min;t("update:modelValue",[...n.modelValue,h]),t("onAdd",h)}function o(){if(!n.multiple||!Array.isArray(n.modelValue))return;const h=n.modelValue,c=h.pop();t("update:modelValue",h),t("onRemove",c)}const a=ee(()=>n.multiple&&Array.isArray(n.modelValue)?Array.from(Array(n.modelValue.length).keys()):[]),u=ee(()=>Array.isArray(n.modelValue)?n.modelValue[0]:n.modelValue);return(h,c)=>(j(),we(C(xi),{prop:e.prop},{label:pe(()=>[le(xl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[Te(h.$slots,"label",{},()=>[Ne(Ae(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[!e.multiple||!Array.isArray(e.modelValue)?(j(),ce("div",vH,[C(i)?_e("",!0):(j(),we(C(i0),{key:0,"model-value":C(u),min:e.min,max:e.max,step:e.step,onInput:l,disabled:e.disabled,"show-input":""},null,8,["model-value","min","max","step","disabled"])),C(i)?(j(),we(C(Ld),{key:1,"model-value":C(u),min:e.min,max:e.max,step:e.step,onChange:l,disabled:e.disabled},null,8,["model-value","min","max","step","disabled"])):_e("",!0)])):(j(),ce("div",yH,[(j(!0),ce(ze,null,Dt(C(a),f=>(j(),ce("div",{key:f},[C(i)?_e("",!0):(j(),we(C(i0),{key:0,"model-value":e.modelValue[f],min:e.min,max:e.max,step:e.step,onInput:s=>l(s,f),disabled:e.disabled,"show-input":""},null,8,["model-value","min","max","step","onInput","disabled"])),C(i)?(j(),we(C(Ld),{key:1,"model-value":e.modelValue[f],min:e.min,max:e.max,step:e.step,onChange:s=>l(s,f),disabled:e.disabled},null,8,["model-value","min","max","step","onChange","disabled"])):_e("",!0)]))),128)),re("div",null,[le(C(lt),{icon:C(Xh),onClick:c[0]||(c[0]=()=>v())},null,8,["icon"]),le(C(lt),{icon:C(Qb),onClick:c[1]||(c[1]=()=>o()),disabled:C(a).length<=1},null,8,["icon","disabled"])])])),Te(h.$slots,"inline")]),_:3},8,["prop"]))}});const Au=Ee({__name:"FormSelect",props:{label:null,modelValue:null,prop:null,options:null,multiple:{type:Boolean},info:null,filterable:{type:Boolean},labelStyle:null,placement:null},emits:["update:modelValue","change"],setup(e,{emit:t}){function n(r){t("update:modelValue",r),t("change",r)}return(r,i)=>(j(),we(C(xi),{prop:e.prop},{label:pe(()=>[le(xl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[Te(r.$slots,"label",{},()=>[Ne(Ae(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[le(C(ew),{"model-value":e.modelValue,filterable:e.filterable,multiple:e.multiple,placement:e.placement,onChange:n,placeholder:"Select"},{default:pe(()=>[(j(!0),ce(ze,null,Dt(e.options,l=>(j(),we(C(tw),{key:l,label:l.label!==void 0?l.label:l,value:l.value!==void 0?l.value:l,disabled:l.disabled!==void 0?l.disabled:!1},null,8,["label","value","disabled"]))),128))]),_:1},8,["model-value","filterable","multiple","placement"]),Te(r.$slots,"inline")]),_:3},8,["prop"]))}}),sh=Ee({__name:"FormInput",props:{label:null,modelValue:null,prop:null,type:null,resize:null,placeholder:null,autosize:{type:[Boolean,Object]},info:null,labelStyle:null,change:null,clearable:{type:Boolean},clearIcon:null},emits:["update:modelValue","focus","blur"],setup(e,{emit:t}){const n=e;function r(i){t("update:modelValue",i),n.change&&n.change(i)}return(i,l)=>(j(),we(C(xi),{prop:e.prop},{label:pe(()=>[le(xl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[Te(i.$slots,"label",{},()=>[Ne(Ae(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[le(C(La),{"model-value":e.modelValue,autosize:e.autosize,resize:e.resize,onInput:r,type:e.type,placeholder:e.placeholder,clearable:e.clearable,"clear-icon":e.clearIcon,onFocus:l[0]||(l[0]=v=>i.$emit("focus")),onBlur:l[1]||(l[1]=v=>i.$emit("blur"))},{append:pe(()=>[Te(i.$slots,"append")]),_:3},8,["model-value","autosize","resize","type","placeholder","clearable","clear-icon"]),Te(i.$slots,"inline")]),_:3},8,["prop"]))}});const Yo=Ee({__name:"FormSwitch",props:{label:null,modelValue:{type:Boolean},prop:null,disabled:{type:Boolean},disabledText:null,defaultValue:{type:Boolean},info:null,labelStyle:null,change:null},emits:["update:modelValue"],setup(e,{emit:t}){const n=e;function r(i){const l=!!i;t("update:modelValue",l),n.change&&n.change(l)}return Zy(()=>{n.disabled&&n.defaultValue!==void 0&&t("update:modelValue",n.defaultValue)}),(i,l)=>(j(),we(C(xi),{prop:e.prop},{label:pe(()=>[le(xl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[Te(i.$slots,"label",{},()=>[Ne(Ae(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[e.disabledText&&e.disabled?(j(),we(C(kr),{key:0,content:e.disabledText,placement:"top",enterable:!1,"hide-after":100},{default:pe(()=>[le(C(a0),{disabled:e.disabled,"model-value":e.modelValue,onChange:r},null,8,["disabled","model-value"])]),_:1},8,["content"])):(j(),we(C(a0),{key:1,disabled:e.disabled,"model-value":e.modelValue,onChange:r},null,8,["disabled","model-value"])),Te(i.$slots,"inline")]),_:3},8,["prop"]))}}),bH=e=>(Jr("data-v-cf07eac2"),e=e(),Qr(),e),_H=bH(()=>re("div",null,"Prompt",-1)),wH=Ee({__name:"FormPromptInput",setup(e){const t=en();return(n,r)=>(j(),we(sh,{prop:"prompt",modelValue:C(t).prompt,"onUpdate:modelValue":r[0]||(r[0]=i=>C(t).prompt=i),autosize:{minRows:2,maxRows:15},resize:"vertical",type:"textarea",placeholder:"Enter prompt here","label-position":"top","label-style":"justify-content: space-between; width: 100%;"},{label:pe(()=>[_H]),_:1},8,["modelValue"]))}});const CH=Yt(wH,[["__scopeId","data-v-cf07eac2"]]);const SH=e=>(Jr("data-v-274da5ab"),e=e(),Qr(),e),xH={style:{position:"relative",height:"100%",width:"100%"}},TH=SH(()=>re("span",null,"Back to generation status",-1)),kH={class:"carousel-container"},EH=["src"],OH={class:"carousel-footer"},AH={style:{display:"flex","justify-content":"center"}},PH={style:{"white-space":"nowrap"}},IH=Ee({__name:"GeneratedCarousel",setup(e){const t=en(),n=$t(),r=Gt(),i=se(0);function l(o){i.value=o,console.log(t.outputs[i.value])}function v(o){t.outputs.splice(t.outputs.findIndex(a=>a.output.id===o),1)}return(o,a)=>(j(),ce("div",xH,[C(t).generating?(j(),ce("div",{key:0,class:"back-to-generation",onClick:a[0]||(a[0]=u=>C(n).showGeneratedImages=!1)},[le(C(De),null,{default:pe(()=>[le(C(Kb))]),_:1}),TH])):_e("",!0),re("div",kH,[le(C(i$),{class:"carousel",autoplay:C(r).autoCarousel==="Enabled",trigger:"click","indicator-position":"outside",onChange:l},{default:pe(()=>[(j(!0),ce(ze,null,Dt(C(t).outputs,(u,h)=>(j(),we(C(a$),{key:h,style:{display:"flex","justify-content":"center"}},{default:pe(()=>[u.type==="video"?(j(),ce("video",{key:0,src:u.output.image,controls:"",style:{"max-width":"100%",height:"100%"}},null,8,EH)):_e("",!0),u.type==="image"?(j(),we(C(Tp),{key:1,src:u.output.image,style:{width:"100%",height:"100%"},fit:"scale-down",onClick:()=>C(n).activeModal=u.output.id},null,8,["src","onClick"])):_e("",!0)]),_:2},1024))),128))]),_:1},8,["autoplay"])]),re("div",OH,[le(C(FB)),re("div",AH,[le(C(c1),null,{default:pe(()=>[re("div",PH,[le(K2,{imageData:C(t).outputs[i.value].output,"on-delete":v},null,8,["imageData"])])]),_:1})])])]))}});const MH=Yt(IH,[["__scopeId","data-v-274da5ab"]]);var Jn={};const LH={},RH=Object.freeze(Object.defineProperty({__proto__:null,default:LH},Symbol.toStringTag,{value:"Module"})),Mf=FD(RH);(function(e){/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */var t=t||{version:"5.2.4"};if(e.fabric=t,typeof document<"u"&&typeof window<"u")document instanceof(typeof HTMLDocument<"u"?HTMLDocument:Document)?t.document=document:t.document=document.implementation.createHTMLDocument(""),t.window=window;else{var n=Mf,r=new n.JSDOM(decodeURIComponent("%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E"),{features:{FetchExternalResources:["img"]},resources:"usable"}).window;t.document=r.document,t.jsdomImplForWrapper=Mf.implForWrapper,t.nodeCanvas=Mf.Canvas,t.window=r,DOMParser=t.window.DOMParser}t.isTouchSupported="ontouchstart"in t.window||"ontouchstart"in t.document||t.window&&t.window.navigator&&t.window.navigator.maxTouchPoints>0,t.isLikelyNode=typeof Buffer<"u"&&typeof window>"u",t.SHARED_ATTRIBUTES=["display","transform","fill","fill-opacity","fill-rule","opacity","stroke","stroke-dasharray","stroke-linecap","stroke-dashoffset","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","id","paint-order","vector-effect","instantiated_by_use","clip-path"],t.DPI=96,t.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",t.commaWsp="(?:\\s+,?\\s*|,\\s*)",t.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/ig,t.reNonWord=/[ \n\.,;!\?\-]/,t.fontPaths={},t.iMatrix=[1,0,0,1,0,0],t.svgNS="http://www.w3.org/2000/svg",t.perfLimitSizeTotal=2097152,t.maxCacheSideLimit=4096,t.minCacheSideLimit=256,t.charWidthsCache={},t.textureSize=2048,t.disableStyleCopyPaste=!1,t.enableGLFiltering=!0,t.devicePixelRatio=t.window.devicePixelRatio||t.window.webkitDevicePixelRatio||t.window.mozDevicePixelRatio||1,t.browserShadowBlurConstant=1,t.arcToSegmentsCache={},t.boundsOfCurveCache={},t.cachesBoundsOfCurve=!0,t.forceGLPutImageData=!1,t.initFilterBackend=function(){if(t.enableGLFiltering&&t.isWebglSupported&&t.isWebglSupported(t.textureSize))return console.log("max texture size: "+t.maxTextureSize),new t.WebglFilterBackend({tileSize:t.textureSize});if(t.Canvas2dFilterBackend)return new t.Canvas2dFilterBackend},typeof document<"u"&&typeof window<"u"&&(window.fabric=t),function(){function o(s,d){if(!!this.__eventListeners[s]){var g=this.__eventListeners[s];d?g[g.indexOf(d)]=!1:t.util.array.fill(g,!1)}}function a(s,d){if(this.__eventListeners||(this.__eventListeners={}),arguments.length===1)for(var g in s)this.on(g,s[g]);else this.__eventListeners[s]||(this.__eventListeners[s]=[]),this.__eventListeners[s].push(d);return this}function u(s,d){var g=function(){d.apply(this,arguments),this.off(s,g)}.bind(this);this.on(s,g)}function h(s,d){if(arguments.length===1)for(var g in s)u.call(this,g,s[g]);else u.call(this,s,d);return this}function c(s,d){if(!this.__eventListeners)return this;if(arguments.length===0)for(s in this.__eventListeners)o.call(this,s);else if(arguments.length===1&&typeof arguments[0]=="object")for(var g in s)o.call(this,g,s[g]);else o.call(this,s,d);return this}function f(s,d){if(!this.__eventListeners)return this;var g=this.__eventListeners[s];if(!g)return this;for(var m=0,y=g.length;m"u"?this._objects.concat():this._objects.filter(function(a){return a.type===o})},item:function(o){return this._objects[o]},isEmpty:function(){return this._objects.length===0},size:function(){return this._objects.length},contains:function(o,a){return this._objects.indexOf(o)>-1?!0:a?this._objects.some(function(u){return typeof u.contains=="function"&&u.contains(o,!0)}):!1},complexity:function(){return this._objects.reduce(function(o,a){return o+=a.complexity?a.complexity():0,o},0)}},t.CommonMethods={_setOptions:function(o){for(var a in o)this.set(a,o[a])},_initGradient:function(o,a){o&&o.colorStops&&!(o instanceof t.Gradient)&&this.set(a,new t.Gradient(o))},_initPattern:function(o,a,u){o&&o.source&&!(o instanceof t.Pattern)?this.set(a,new t.Pattern(o,u)):u&&u()},_setObject:function(o){for(var a in o)this._set(a,o[a])},set:function(o,a){return typeof o=="object"?this._setObject(o):this._set(o,a),this},_set:function(o,a){this[o]=a},toggle:function(o){var a=this.get(o);return typeof a=="boolean"&&this.set(o,!a),this},get:function(o){return this[o]}},function(o){var a=Math.sqrt,u=Math.atan2,h=Math.pow,c=Math.PI/180,f=Math.PI/2;t.util={cos:function(s){if(s===0)return 1;s<0&&(s=-s);var d=s/f;switch(d){case 1:case 3:return 0;case 2:return-1}return Math.cos(s)},sin:function(s){if(s===0)return 0;var d=s/f,g=1;switch(s<0&&(g=-1),d){case 1:return g;case 2:return 0;case 3:return-g}return Math.sin(s)},removeFromArray:function(s,d){var g=s.indexOf(d);return g!==-1&&s.splice(g,1),s},getRandomInt:function(s,d){return Math.floor(Math.random()*(d-s+1))+s},degreesToRadians:function(s){return s*c},radiansToDegrees:function(s){return s/c},rotatePoint:function(s,d,g){var m=new t.Point(s.x-d.x,s.y-d.y),y=t.util.rotateVector(m,g);return new t.Point(y.x,y.y).addEquals(d)},rotateVector:function(s,d){var g=t.util.sin(d),m=t.util.cos(d),y=s.x*m-s.y*g,b=s.x*g+s.y*m;return{x:y,y:b}},createVector:function(s,d){return new t.Point(d.x-s.x,d.y-s.y)},calcAngleBetweenVectors:function(s,d){return Math.acos((s.x*d.x+s.y*d.y)/(Math.hypot(s.x,s.y)*Math.hypot(d.x,d.y)))},getHatVector:function(s){return new t.Point(s.x,s.y).multiply(1/Math.hypot(s.x,s.y))},getBisector:function(s,d,g){var m=t.util.createVector(s,d),y=t.util.createVector(s,g),b=t.util.calcAngleBetweenVectors(m,y),_=t.util.calcAngleBetweenVectors(t.util.rotateVector(m,b),y),w=b*(_===0?1:-1)/2;return{vector:t.util.getHatVector(t.util.rotateVector(m,w)),angle:b}},projectStrokeOnPoints:function(s,d,g){var m=[],y=d.strokeWidth/2,b=d.strokeUniform?new t.Point(1/d.scaleX,1/d.scaleY):new t.Point(1,1),_=function(w){var S=y/Math.hypot(w.x,w.y);return new t.Point(w.x*S*b.x,w.y*S*b.y)};return s.length<=1||s.forEach(function(w,S){var x=new t.Point(w.x,w.y),T,O;S===0?(O=s[S+1],T=g?_(t.util.createVector(O,x)).addEquals(x):s[s.length-1]):S===s.length-1?(T=s[S-1],O=g?_(t.util.createVector(T,x)).addEquals(x):s[0]):(T=s[S-1],O=s[S+1]);var A=t.util.getBisector(x,T,O),D=A.vector,N=A.angle,R,B;if(d.strokeLineJoin==="miter"&&(R=-y/Math.sin(N/2),B=new t.Point(D.x*R*b.x,D.y*R*b.y),Math.hypot(B.x,B.y)/y<=d.strokeMiterLimit)){m.push(x.add(B)),m.push(x.subtract(B));return}R=-y*Math.SQRT2,B=new t.Point(D.x*R*b.x,D.y*R*b.y),m.push(x.add(B)),m.push(x.subtract(B))}),m},transformPoint:function(s,d,g){return g?new t.Point(d[0]*s.x+d[2]*s.y,d[1]*s.x+d[3]*s.y):new t.Point(d[0]*s.x+d[2]*s.y+d[4],d[1]*s.x+d[3]*s.y+d[5])},makeBoundingBoxFromPoints:function(s,d){if(d)for(var g=0;g"u"?1:s.scaleX,g=typeof s.scaleY>"u"?1:s.scaleY,m=[s.flipX?-d:d,0,0,s.flipY?-g:g,0,0],y=t.util.multiplyTransformMatrices,b=t.util.degreesToRadians;return s.skewX&&(m=y(m,[1,0,Math.tan(b(s.skewX)),1],!0)),s.skewY&&(m=y(m,[1,Math.tan(b(s.skewY)),0,1],!0)),m},composeMatrix:function(s){var d=[1,0,0,1,s.translateX||0,s.translateY||0],g=t.util.multiplyTransformMatrices;return s.angle&&(d=g(d,t.util.calcRotateMatrix(s))),(s.scaleX!==1||s.scaleY!==1||s.skewX||s.skewY||s.flipX||s.flipY)&&(d=g(d,t.util.calcDimensionsMatrix(s))),d},resetObjectTransform:function(s){s.scaleX=1,s.scaleY=1,s.skewX=0,s.skewY=0,s.flipX=!1,s.flipY=!1,s.rotate(0)},saveObjectTransform:function(s){return{scaleX:s.scaleX,scaleY:s.scaleY,skewX:s.skewX,skewY:s.skewY,angle:s.angle,left:s.left,flipX:s.flipX,flipY:s.flipY,top:s.top}},isTransparent:function(s,d,g,m){m>0&&(d>m?d-=m:d=0,g>m?g-=m:g=0);var y=!0,b,_,w=s.getImageData(d,g,m*2||1,m*2||1),S=w.data.length;for(b=3;bn.value=i,error:t==null?void 0:t.onError});return DU(()=>{r.unsubscribe()}),n}function BU(e,t,n){const r=se(n==null?void 0:n.initialValue),i=Kp(e);let l=i.subscribe({next:v=>r.value=v,error:n==null?void 0:n.onError});return ke(t,()=>{l.unsubscribe(),l=i.subscribe({next:v=>r.value=v,error:n==null?void 0:n.onError})}),ti(()=>{l.unsubscribe()}),r}const wa=Co("outputs",()=>{const e=$U(LU(Kp(()=>Lt.outputs.count())),{initialValue:0}),t=se(1),n=Pn("sortOutputsBy","Oldest"),r=Pn("currentImagesLayout","dynamic"),i=se("all"),l=BU(()=>{const s=Gt();let d;return i.value==="all"?d=Lt.outputs:i.value==="favourited"?d=Lt.outputs.where("starred").equals(1):i.value==="unfavourited"?d=Lt.outputs.where("starred").equals(0):d=Lt.outputs.where("rated").equals(0),n.value==="Newest"&&(d=d.reverse()),s.pageless==="Enabled"?d.toArray():d.offset((t.value-1)*s.pageSize).limit(s.pageSize).toArray()},[Cn(Gt(),"pageless"),Cn(Gt(),"pageSize"),t,n,i],{initialValue:[]});async function v(){if(navigator.storage&&navigator.storage.persist){const s=await navigator.storage.persist();console.log(`Persisted storage granted: ${s}`)}}async function o(){const s=localStorage.getItem("outputs");!s||(a(JSON.parse(s)),localStorage.removeItem("outputs"))}v(),o();async function a(s){const d=s.map(y=>{const{id:b,..._}=y;return _}),g=JSON.parse(JSON.stringify(d));console.log("Inserting outputs into database",g);const m=await Lt.outputs.bulkAdd(g,void 0,{allKeys:!0});return Lt.outputs.bulkGet(m)}async function u(s){const d=$t();if(!s.raw)return;if(!s.raw.type.includes("zip")){d.raiseError("Uploaded file needs to be a ZIP!",!1);return}const{files:g}=await jw.exports.loadAsync(s.raw);let m=0,y=0;Ri({message:"Loading images...",type:"info"});const b=[];for(const[w,S]of Object.entries(g)){const x=w.split("."),T=x.slice(-1).join("."),O=x.slice(0,-1).join(".");(T==="webp"||T==="png"||T==="gif"||T==="jpg"||T==="jpeg")&&b.push(new Promise(A=>{S.async("base64").then(async D=>{if(!g[O+".json"])return y++,A(null);const N=JSON.parse(await g[O+".json"].async("text"));m++,A({id:-1,image:`data:image/webp;base64,${D}`,...N,rated:N.rated?1:0,starred:N.starred?1:0})}).catch(D=>(d.raiseError(`Error while importing image: ${D}`,!1),y++,A(null)))}))}const _=await Promise.all(b);a(_.filter(w=>w!==null)),Ri({message:`Successfully imported ${m}/${m+y} images!`,type:"success"})}async function h(s){const d=await Lt.outputs.get(s);return Lt.outputs.update(s,{starred:d!=null&&d.starred?0:1})}function c(s){return Lt.outputs.delete(s)}async function f(s){const d=$t();return d.selected=[],d.multiSelect=!1,s===await Lt.outputs.toCollection().primaryKeys()?Lt.outputs.clear():Lt.outputs.bulkDelete(s)}return{outputsLength:e,sortBy:n,filterBy:i,currentPage:t,currentOutputs:l,currentLayout:r,deleteOutput:c,deleteMultipleOutputs:f,toggleStarred:h,pushOutputs:a,importFromZip:u}}),$t=Co("ui",()=>{const e=se(!1),t=se([]),n=se(["1"]),r=se(-1),i=se(!1),l=se(!1);function v(f,s){console.error(f),Ri({type:"error",message:f,duration:s?0:void 0,showClose:s})}function o(f,s){console.warn(f),Ri({type:"warning",message:f,duration:s?0:void 0,showClose:s})}function a(){e.value=!e.value,!e.value&&(t.value=[])}function u(f){if(t.value.includes(f)){const s=t.value.indexOf(f);t.value.splice(s,1),t.value.length===0&&(e.value=!1);return}t.value.push(f)}async function h(){const f=wa(),s=Gt(),d=f.currentOutputs.findIndex(m=>m.id===r.value),g=f.currentOutputs[d+1];if(g){r.value=g.id;return}if(f.currentPage<=Math.floor(f.outputsLength/s.pageSize)){const m=f.sortBy==="Newest"?await Lt.outputs.where(":id").below(r.value).last():await Lt.outputs.where(":id").above(r.value).first();f.currentPage++,r.value=(m==null?void 0:m.id)||r.value;return}}async function c(){const f=wa(),s=f.currentOutputs.findIndex(g=>g.id===r.value),d=f.currentOutputs[s-1];if(f.currentPage>1&&!d){const g=f.sortBy==="Oldest"?await Lt.outputs.where(":id").below(r.value).last():await Lt.outputs.where(":id").above(r.value).first();f.currentPage--,r.value=(g==null?void 0:g.id)||r.value;return}if(d){r.value=d.id;return}}return{multiSelect:e,selected:t,activeCollapse:n,activeModal:r,showGeneratorBadge:i,showGeneratedImages:l,raiseError:v,raiseWarning:o,toggleMultiSelect:a,toggleSelection:u,openModalToRight:h,openModalToLeft:c}}),Yt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},FU={},zU={viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},NU=re("circle",{cy:"12",cx:"12",r:"12",stroke:"currentColor"},null,-1),jU=[NU];function VU(e,t){return j(),ce("svg",zU,jU)}const UU=Yt(FU,[["render",VU]]),Wo=Ee({__name:"MainMenuItem",props:{index:null,isMobile:{type:Boolean}},setup(e){return(t,n)=>(j(),we(C(Ep),{index:e.index},{default:pe(()=>[Te(t.$slots,"icon"),e.isMobile?_e("",!0):Te(t.$slots,"title",{key:0})]),_:3},8,["index"]))}});const HU="modulepreload",WU=function(e,t){return new URL(e,t).href},P0={},If=function(t,n,r){if(!n||n.length===0)return t();const i=document.getElementsByTagName("link");return Promise.all(n.map(l=>{if(l=WU(l,r),l in P0)return;P0[l]=!0;const v=l.endsWith(".css"),o=v?'[rel="stylesheet"]':"";if(!!r)for(let h=i.length-1;h>=0;h--){const c=i[h];if(c.href===l&&(!v||c.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${o}`))return;const u=document.createElement("link");if(u.rel=v?"stylesheet":HU,v||(u.as="script",u.crossOrigin=""),u.href=l,document.head.appendChild(u),v)return new Promise((h,c)=>{u.addEventListener("load",h),u.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${l}`)))})})).then(()=>t())};const YU={},XU={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},KU=re("path",{d:"M7 14c-1.66 0-3 1.34-3 3c0 1.31-1.16 2-2 2c.92 1.22 2.49 2 4 2c2.21 0 4-1.79 4-4c0-1.66-1.34-3-3-3zm13.71-9.37l-1.34-1.34a.996.996 0 0 0-1.41 0L9 12.25L11.75 15l8.96-8.96a.996.996 0 0 0 0-1.41z",fill:"currentColor"},null,-1),GU=[KU];function qU(e,t){return j(),ce("svg",XU,GU)}const a2=Yt(YU,[["render",qU]]),ZU={},JU={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 32 32"},QU=re("path",{d:"M24 14a5.99 5.99 0 0 0-4.885 9.471L14 28.586L15.414 30l5.115-5.115A5.997 5.997 0 1 0 24 14zm0 10a4 4 0 1 1 4-4a4.005 4.005 0 0 1-4 4z",fill:"currentColor"},null,-1),eH=re("path",{d:"M17 12a3 3 0 1 0-3-3a3.003 3.003 0 0 0 3 3zm0-4a1 1 0 1 1-1 1a1 1 0 0 1 1-1z",fill:"currentColor"},null,-1),tH=re("path",{d:"M12 24H4v-6.003L9 13l5.586 5.586L16 17.168l-5.586-5.585a2 2 0 0 0-2.828 0L4 15.168V4h20v6h2V4a2.002 2.002 0 0 0-2-2H4a2.002 2.002 0 0 0-2 2v20a2.002 2.002 0 0 0 2 2h8z",fill:"currentColor"},null,-1),nH=[QU,eH,tH];function rH(e,t){return j(),ce("svg",JU,nH)}const iH=Yt(ZU,[["render",rH]]);function o2(){const e=se("..."),t=setInterval(()=>{e.value=e.value.length>=3?"":".".repeat(e.value.length+1)},1e3);return ti(()=>{clearInterval(t)}),{ellipsis:e}}const s2=e=>(Jr("data-v-dc223229"),e=e(),Qr(),e),aH={style:{"text-align":"center"}},oH=s2(()=>re("br",null,null,-1)),sH={class:"gen-text"},lH={key:0},uH={key:1},cH=s2(()=>re("br",null,null,-1)),fH=Ee({__name:"ImageProgress",props:{generated:null,total:null,elapsed:null},emits:["showGenerated"],setup(e){const{ellipsis:t}=o2();return(n,r)=>{var i,l;return j(),ce("div",aH,[le(C(nw),{type:"circle",percentage:100*((i=e.generated)!=null?i:0)/((l=e.total)!=null?l:1),width:200},{default:pe(()=>[re("span",null,Ae(e.generated)+" / "+Ae(e.total),1),oH]),_:1},8,["percentage"]),re("div",sH,[e.generated===e.total?(j(),ce("span",lH,"All done!")):(j(),ce("span",uH,[Ne("Generating"+Ae(C(t))+Ae("\xA0".repeat(3-C(t).length)),1),cH,re("sup",null,Ae(e.elapsed),1)]))]),e.generated?(j(),ce("div",{key:0,onClick:r[0]||(r[0]=v=>n.$emit("showGenerated")),class:"view-images"},[re("span",null,"View image"+Ae(e.total===1?"":"s"),1),le(C(De),null,{default:pe(()=>[le(C(EO))]),_:1})])):_e("",!0)])}}});const dH=Yt(fH,[["__scopeId","data-v-dc223229"]]);const hH={style:{width:"200px"}},pH=Ee({__name:"InfoTooltip",props:{info:null,size:null,trigger:null},setup(e){return(t,n)=>(j(),we(C(kr),{trigger:e.trigger},{content:pe(()=>[re("div",hH,[Te(t.$slots,"default",{},()=>[Ne(Ae(e.info),1)])])]),default:pe(()=>[le(C(De),{size:e.size},{default:pe(()=>[le(C(Wh))]),_:1},8,["size"])]),_:3},8,["trigger"]))}}),mH={key:0,class:"align-vertical",style:{"margin-left":"5px"}},gH=Ee({__name:"FormLabel",props:{label:null,info:null,labelStyle:null},setup(e){return(t,n)=>(j(),ce("span",{class:"align-vertical",style:Fe(e.labelStyle||"height: 100%;")},[Te(t.$slots,"default",{},()=>[Ne(Ae(e.label),1)],!0),e.info?(j(),ce("div",mH,[le(pH,{info:e.info,size:15},null,8,["info"])])):_e("",!0)],4))}});const xl=Yt(gH,[["__scopeId","data-v-ec7e7ec1"]]),vH={key:0,style:{width:"100%"}},yH={key:1,style:{display:"flex","flex-direction":"column",gap:"8px",width:"100%"}},En=Ee({__name:"FormSlider",props:{label:null,modelValue:null,prop:null,min:null,max:null,step:null,info:null,disabled:{type:Boolean},labelStyle:null,multiple:{type:Boolean}},emits:["update:modelValue","change","onAdd","onRemove"],setup(e,{emit:t}){const n=e,i=up(lp).smallerOrEqual("md");function l(h,c){var s;if(n.multiple&&Array.isArray(n.modelValue)){c=c||0;const d=(s=Array.isArray(h)?h[0]:h)!=null?s:n.min;let g=n.modelValue;g[c]=d,t("update:modelValue",g),t("change",g);return}const f=h!=null?h:n.min;t("update:modelValue",f),t("change",f)}function v(){if(!n.multiple||!Array.isArray(n.modelValue))return;const h=n.min;t("update:modelValue",[...n.modelValue,h]),t("onAdd",h)}function o(){if(!n.multiple||!Array.isArray(n.modelValue))return;const h=n.modelValue,c=h.pop();t("update:modelValue",h),t("onRemove",c)}const a=ee(()=>n.multiple&&Array.isArray(n.modelValue)?Array.from(Array(n.modelValue.length).keys()):[]),u=ee(()=>Array.isArray(n.modelValue)?n.modelValue[0]:n.modelValue);return(h,c)=>(j(),we(C(xi),{prop:e.prop},{label:pe(()=>[le(xl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[Te(h.$slots,"label",{},()=>[Ne(Ae(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[!e.multiple||!Array.isArray(e.modelValue)?(j(),ce("div",vH,[C(i)?_e("",!0):(j(),we(C(i0),{key:0,"model-value":C(u),min:e.min,max:e.max,step:e.step,onInput:l,disabled:e.disabled,"show-input":""},null,8,["model-value","min","max","step","disabled"])),C(i)?(j(),we(C(Ld),{key:1,"model-value":C(u),min:e.min,max:e.max,step:e.step,onChange:l,disabled:e.disabled},null,8,["model-value","min","max","step","disabled"])):_e("",!0)])):(j(),ce("div",yH,[(j(!0),ce(ze,null,Dt(C(a),f=>(j(),ce("div",{key:f},[C(i)?_e("",!0):(j(),we(C(i0),{key:0,"model-value":e.modelValue[f],min:e.min,max:e.max,step:e.step,onInput:s=>l(s,f),disabled:e.disabled,"show-input":""},null,8,["model-value","min","max","step","onInput","disabled"])),C(i)?(j(),we(C(Ld),{key:1,"model-value":e.modelValue[f],min:e.min,max:e.max,step:e.step,onChange:s=>l(s,f),disabled:e.disabled},null,8,["model-value","min","max","step","onChange","disabled"])):_e("",!0)]))),128)),re("div",null,[le(C(lt),{icon:C(Xh),onClick:c[0]||(c[0]=()=>v())},null,8,["icon"]),le(C(lt),{icon:C(Qb),onClick:c[1]||(c[1]=()=>o()),disabled:C(a).length<=1},null,8,["icon","disabled"])])])),Te(h.$slots,"inline")]),_:3},8,["prop"]))}});const Au=Ee({__name:"FormSelect",props:{label:null,modelValue:null,prop:null,options:null,multiple:{type:Boolean},info:null,filterable:{type:Boolean},labelStyle:null,placement:null},emits:["update:modelValue","change"],setup(e,{emit:t}){function n(r){t("update:modelValue",r),t("change",r)}return(r,i)=>(j(),we(C(xi),{prop:e.prop},{label:pe(()=>[le(xl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[Te(r.$slots,"label",{},()=>[Ne(Ae(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[le(C(ew),{"model-value":e.modelValue,filterable:e.filterable,multiple:e.multiple,placement:e.placement,onChange:n,placeholder:"Select"},{default:pe(()=>[(j(!0),ce(ze,null,Dt(e.options,l=>(j(),we(C(tw),{key:l,label:l.label!==void 0?l.label:l,value:l.value!==void 0?l.value:l,disabled:l.disabled!==void 0?l.disabled:!1},null,8,["label","value","disabled"]))),128))]),_:1},8,["model-value","filterable","multiple","placement"]),Te(r.$slots,"inline")]),_:3},8,["prop"]))}}),sh=Ee({__name:"FormInput",props:{label:null,modelValue:null,prop:null,type:null,resize:null,placeholder:null,autosize:{type:[Boolean,Object]},info:null,labelStyle:null,change:null,clearable:{type:Boolean},clearIcon:null},emits:["update:modelValue","focus","blur"],setup(e,{emit:t}){const n=e;function r(i){t("update:modelValue",i),n.change&&n.change(i)}return(i,l)=>(j(),we(C(xi),{prop:e.prop},{label:pe(()=>[le(xl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[Te(i.$slots,"label",{},()=>[Ne(Ae(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[le(C(La),{"model-value":e.modelValue,autosize:e.autosize,resize:e.resize,onInput:r,type:e.type,placeholder:e.placeholder,clearable:e.clearable,"clear-icon":e.clearIcon,onFocus:l[0]||(l[0]=v=>i.$emit("focus")),onBlur:l[1]||(l[1]=v=>i.$emit("blur"))},{append:pe(()=>[Te(i.$slots,"append")]),_:3},8,["model-value","autosize","resize","type","placeholder","clearable","clear-icon"]),Te(i.$slots,"inline")]),_:3},8,["prop"]))}});const Yo=Ee({__name:"FormSwitch",props:{label:null,modelValue:{type:Boolean},prop:null,disabled:{type:Boolean},disabledText:null,defaultValue:{type:Boolean},info:null,labelStyle:null,change:null},emits:["update:modelValue"],setup(e,{emit:t}){const n=e;function r(i){const l=!!i;t("update:modelValue",l),n.change&&n.change(l)}return Zy(()=>{n.disabled&&n.defaultValue!==void 0&&t("update:modelValue",n.defaultValue)}),(i,l)=>(j(),we(C(xi),{prop:e.prop},{label:pe(()=>[le(xl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[Te(i.$slots,"label",{},()=>[Ne(Ae(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[e.disabledText&&e.disabled?(j(),we(C(kr),{key:0,content:e.disabledText,placement:"top",enterable:!1,"hide-after":100},{default:pe(()=>[le(C(a0),{disabled:e.disabled,"model-value":e.modelValue,onChange:r},null,8,["disabled","model-value"])]),_:1},8,["content"])):(j(),we(C(a0),{key:1,disabled:e.disabled,"model-value":e.modelValue,onChange:r},null,8,["disabled","model-value"])),Te(i.$slots,"inline")]),_:3},8,["prop"]))}}),bH=e=>(Jr("data-v-cf07eac2"),e=e(),Qr(),e),_H=bH(()=>re("div",null,"Prompt",-1)),wH=Ee({__name:"FormPromptInput",setup(e){const t=en();return(n,r)=>(j(),we(sh,{prop:"prompt",modelValue:C(t).prompt,"onUpdate:modelValue":r[0]||(r[0]=i=>C(t).prompt=i),autosize:{minRows:2,maxRows:15},resize:"vertical",type:"textarea",placeholder:"Enter prompt here","label-position":"top","label-style":"justify-content: space-between; width: 100%;"},{label:pe(()=>[_H]),_:1},8,["modelValue"]))}});const CH=Yt(wH,[["__scopeId","data-v-cf07eac2"]]);const SH=e=>(Jr("data-v-a260b725"),e=e(),Qr(),e),xH={style:{position:"relative",height:"100%",width:"100%"}},TH=SH(()=>re("span",null,"Back to generation status",-1)),kH={class:"carousel-container"},EH=["src"],OH={class:"carousel-footer"},AH={style:{display:"flex","justify-content":"center"}},PH={style:{"white-space":"nowrap"}},IH=Ee({__name:"GeneratedCarousel",setup(e){const t=en(),n=$t(),r=Gt(),i=se(0);function l(o){i.value=o,console.log(t.outputs[i.value])}function v(o){t.outputs.splice(t.outputs.findIndex(a=>a.output.id===o),1)}return(o,a)=>(j(),ce("div",xH,[C(t).generating?(j(),ce("div",{key:0,class:"back-to-generation",onClick:a[0]||(a[0]=u=>C(n).showGeneratedImages=!1)},[le(C(De),null,{default:pe(()=>[le(C(Kb))]),_:1}),TH])):_e("",!0),re("div",kH,[le(C(i$),{class:"carousel",autoplay:C(r).autoCarousel==="Enabled",trigger:"click","indicator-position":"outside",onChange:l},{default:pe(()=>[(j(!0),ce(ze,null,Dt(C(t).outputs,(u,h)=>(j(),we(C(a$),{key:h,style:{display:"flex","justify-content":"center"}},{default:pe(()=>[u.type==="video"?(j(),ce("video",{key:0,src:u.output.image,controls:"",style:{"max-width":"100%",height:"100%"}},null,8,EH)):_e("",!0),u.type==="image"?(j(),we(C(Tp),{key:1,src:u.output.image,style:{width:"100%",height:"100%"},fit:"scale-down",onClick:()=>C(n).activeModal=u.output.id},null,8,["src","onClick"])):_e("",!0)]),_:2},1024))),128))]),_:1},8,["autoplay"])]),re("div",OH,[le(C(FB)),re("div",AH,[le(C(c1),null,{default:pe(()=>[re("div",PH,[le(K2,{imageData:C(t).outputs[i.value].output,"on-delete":v,"show-dismiss":!0},null,8,["imageData"])])]),_:1})])])]))}});const MH=Yt(IH,[["__scopeId","data-v-a260b725"]]);var Jn={};const LH={},RH=Object.freeze(Object.defineProperty({__proto__:null,default:LH},Symbol.toStringTag,{value:"Module"})),Mf=FD(RH);(function(e){/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */var t=t||{version:"5.2.4"};if(e.fabric=t,typeof document<"u"&&typeof window<"u")document instanceof(typeof HTMLDocument<"u"?HTMLDocument:Document)?t.document=document:t.document=document.implementation.createHTMLDocument(""),t.window=window;else{var n=Mf,r=new n.JSDOM(decodeURIComponent("%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E"),{features:{FetchExternalResources:["img"]},resources:"usable"}).window;t.document=r.document,t.jsdomImplForWrapper=Mf.implForWrapper,t.nodeCanvas=Mf.Canvas,t.window=r,DOMParser=t.window.DOMParser}t.isTouchSupported="ontouchstart"in t.window||"ontouchstart"in t.document||t.window&&t.window.navigator&&t.window.navigator.maxTouchPoints>0,t.isLikelyNode=typeof Buffer<"u"&&typeof window>"u",t.SHARED_ATTRIBUTES=["display","transform","fill","fill-opacity","fill-rule","opacity","stroke","stroke-dasharray","stroke-linecap","stroke-dashoffset","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","id","paint-order","vector-effect","instantiated_by_use","clip-path"],t.DPI=96,t.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",t.commaWsp="(?:\\s+,?\\s*|,\\s*)",t.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/ig,t.reNonWord=/[ \n\.,;!\?\-]/,t.fontPaths={},t.iMatrix=[1,0,0,1,0,0],t.svgNS="http://www.w3.org/2000/svg",t.perfLimitSizeTotal=2097152,t.maxCacheSideLimit=4096,t.minCacheSideLimit=256,t.charWidthsCache={},t.textureSize=2048,t.disableStyleCopyPaste=!1,t.enableGLFiltering=!0,t.devicePixelRatio=t.window.devicePixelRatio||t.window.webkitDevicePixelRatio||t.window.mozDevicePixelRatio||1,t.browserShadowBlurConstant=1,t.arcToSegmentsCache={},t.boundsOfCurveCache={},t.cachesBoundsOfCurve=!0,t.forceGLPutImageData=!1,t.initFilterBackend=function(){if(t.enableGLFiltering&&t.isWebglSupported&&t.isWebglSupported(t.textureSize))return console.log("max texture size: "+t.maxTextureSize),new t.WebglFilterBackend({tileSize:t.textureSize});if(t.Canvas2dFilterBackend)return new t.Canvas2dFilterBackend},typeof document<"u"&&typeof window<"u"&&(window.fabric=t),function(){function o(s,d){if(!!this.__eventListeners[s]){var g=this.__eventListeners[s];d?g[g.indexOf(d)]=!1:t.util.array.fill(g,!1)}}function a(s,d){if(this.__eventListeners||(this.__eventListeners={}),arguments.length===1)for(var g in s)this.on(g,s[g]);else this.__eventListeners[s]||(this.__eventListeners[s]=[]),this.__eventListeners[s].push(d);return this}function u(s,d){var g=function(){d.apply(this,arguments),this.off(s,g)}.bind(this);this.on(s,g)}function h(s,d){if(arguments.length===1)for(var g in s)u.call(this,g,s[g]);else u.call(this,s,d);return this}function c(s,d){if(!this.__eventListeners)return this;if(arguments.length===0)for(s in this.__eventListeners)o.call(this,s);else if(arguments.length===1&&typeof arguments[0]=="object")for(var g in s)o.call(this,g,s[g]);else o.call(this,s,d);return this}function f(s,d){if(!this.__eventListeners)return this;var g=this.__eventListeners[s];if(!g)return this;for(var m=0,y=g.length;m"u"?this._objects.concat():this._objects.filter(function(a){return a.type===o})},item:function(o){return this._objects[o]},isEmpty:function(){return this._objects.length===0},size:function(){return this._objects.length},contains:function(o,a){return this._objects.indexOf(o)>-1?!0:a?this._objects.some(function(u){return typeof u.contains=="function"&&u.contains(o,!0)}):!1},complexity:function(){return this._objects.reduce(function(o,a){return o+=a.complexity?a.complexity():0,o},0)}},t.CommonMethods={_setOptions:function(o){for(var a in o)this.set(a,o[a])},_initGradient:function(o,a){o&&o.colorStops&&!(o instanceof t.Gradient)&&this.set(a,new t.Gradient(o))},_initPattern:function(o,a,u){o&&o.source&&!(o instanceof t.Pattern)?this.set(a,new t.Pattern(o,u)):u&&u()},_setObject:function(o){for(var a in o)this._set(a,o[a])},set:function(o,a){return typeof o=="object"?this._setObject(o):this._set(o,a),this},_set:function(o,a){this[o]=a},toggle:function(o){var a=this.get(o);return typeof a=="boolean"&&this.set(o,!a),this},get:function(o){return this[o]}},function(o){var a=Math.sqrt,u=Math.atan2,h=Math.pow,c=Math.PI/180,f=Math.PI/2;t.util={cos:function(s){if(s===0)return 1;s<0&&(s=-s);var d=s/f;switch(d){case 1:case 3:return 0;case 2:return-1}return Math.cos(s)},sin:function(s){if(s===0)return 0;var d=s/f,g=1;switch(s<0&&(g=-1),d){case 1:return g;case 2:return 0;case 3:return-g}return Math.sin(s)},removeFromArray:function(s,d){var g=s.indexOf(d);return g!==-1&&s.splice(g,1),s},getRandomInt:function(s,d){return Math.floor(Math.random()*(d-s+1))+s},degreesToRadians:function(s){return s*c},radiansToDegrees:function(s){return s/c},rotatePoint:function(s,d,g){var m=new t.Point(s.x-d.x,s.y-d.y),y=t.util.rotateVector(m,g);return new t.Point(y.x,y.y).addEquals(d)},rotateVector:function(s,d){var g=t.util.sin(d),m=t.util.cos(d),y=s.x*m-s.y*g,b=s.x*g+s.y*m;return{x:y,y:b}},createVector:function(s,d){return new t.Point(d.x-s.x,d.y-s.y)},calcAngleBetweenVectors:function(s,d){return Math.acos((s.x*d.x+s.y*d.y)/(Math.hypot(s.x,s.y)*Math.hypot(d.x,d.y)))},getHatVector:function(s){return new t.Point(s.x,s.y).multiply(1/Math.hypot(s.x,s.y))},getBisector:function(s,d,g){var m=t.util.createVector(s,d),y=t.util.createVector(s,g),b=t.util.calcAngleBetweenVectors(m,y),_=t.util.calcAngleBetweenVectors(t.util.rotateVector(m,b),y),w=b*(_===0?1:-1)/2;return{vector:t.util.getHatVector(t.util.rotateVector(m,w)),angle:b}},projectStrokeOnPoints:function(s,d,g){var m=[],y=d.strokeWidth/2,b=d.strokeUniform?new t.Point(1/d.scaleX,1/d.scaleY):new t.Point(1,1),_=function(w){var S=y/Math.hypot(w.x,w.y);return new t.Point(w.x*S*b.x,w.y*S*b.y)};return s.length<=1||s.forEach(function(w,S){var x=new t.Point(w.x,w.y),T,O;S===0?(O=s[S+1],T=g?_(t.util.createVector(O,x)).addEquals(x):s[s.length-1]):S===s.length-1?(T=s[S-1],O=g?_(t.util.createVector(T,x)).addEquals(x):s[0]):(T=s[S-1],O=s[S+1]);var A=t.util.getBisector(x,T,O),D=A.vector,N=A.angle,R,B;if(d.strokeLineJoin==="miter"&&(R=-y/Math.sin(N/2),B=new t.Point(D.x*R*b.x,D.y*R*b.y),Math.hypot(B.x,B.y)/y<=d.strokeMiterLimit)){m.push(x.add(B)),m.push(x.subtract(B));return}R=-y*Math.SQRT2,B=new t.Point(D.x*R*b.x,D.y*R*b.y),m.push(x.add(B)),m.push(x.subtract(B))}),m},transformPoint:function(s,d,g){return g?new t.Point(d[0]*s.x+d[2]*s.y,d[1]*s.x+d[3]*s.y):new t.Point(d[0]*s.x+d[2]*s.y+d[4],d[1]*s.x+d[3]*s.y+d[5])},makeBoundingBoxFromPoints:function(s,d){if(d)for(var g=0;g"u"?1:s.scaleX,g=typeof s.scaleY>"u"?1:s.scaleY,m=[s.flipX?-d:d,0,0,s.flipY?-g:g,0,0],y=t.util.multiplyTransformMatrices,b=t.util.degreesToRadians;return s.skewX&&(m=y(m,[1,0,Math.tan(b(s.skewX)),1],!0)),s.skewY&&(m=y(m,[1,Math.tan(b(s.skewY)),0,1],!0)),m},composeMatrix:function(s){var d=[1,0,0,1,s.translateX||0,s.translateY||0],g=t.util.multiplyTransformMatrices;return s.angle&&(d=g(d,t.util.calcRotateMatrix(s))),(s.scaleX!==1||s.scaleY!==1||s.skewX||s.skewY||s.flipX||s.flipY)&&(d=g(d,t.util.calcDimensionsMatrix(s))),d},resetObjectTransform:function(s){s.scaleX=1,s.scaleY=1,s.skewX=0,s.skewY=0,s.flipX=!1,s.flipY=!1,s.rotate(0)},saveObjectTransform:function(s){return{scaleX:s.scaleX,scaleY:s.scaleY,skewX:s.skewX,skewY:s.skewY,angle:s.angle,left:s.left,flipX:s.flipX,flipY:s.flipY,top:s.top}},isTransparent:function(s,d,g,m){m>0&&(d>m?d-=m:d=0,g>m?g-=m:g=0);var y=!0,b,_,w=s.getImageData(d,g,m*2||1,m*2||1),S=w.data.length;for(b=3;b0?be-=2*q:V===1&&be<0&&(be+=2*q);for(var Ce=Math.ceil(Math.abs(be/q*2)),xe=[],Ie=be/Ce,ve=8/3*Math.sin(Ie/4)*Math.sin(Ie/4)/Math.sin(Ie/2),Se=te+Ie,Me=0;Me=J?V-J:2*Math.PI-(J-V)}function s(I,z,M,L,J,V,P,q){var Z;if(t.cachesBoundsOfCurve&&(Z=o.call(arguments),t.boundsOfCurveCache[Z]))return t.boundsOfCurveCache[Z];var ie=Math.sqrt,he=Math.min,ge=Math.max,ye=Math.abs,H=[],Y=[[],[]],k,X,W,$,F,K,de,oe;X=6*I-12*M+6*J,k=-3*I+9*M-9*J+3*P,W=3*M-3*I;for(var G=0;G<2;++G){if(G>0&&(X=6*z-12*L+6*V,k=-3*z+9*L-9*V+3*q,W=3*L-3*z),ye(k)<1e-12){if(ye(X)<1e-12)continue;$=-W/X,0<$&&$<1&&H.push($);continue}de=X*X-4*W*k,!(de<0)&&(oe=ie(de),F=(-X+oe)/(2*k),01e-4;)P=J(M),he=M,q=m(V.x,V.y,P.x,P.y),q+L>z?(M-=Z,Z/=2):(V=P,M+=Z,L+=q);return P.angle=ie(he),P}function E(I){for(var z=0,M=I.length,L,J=0,V=0,P=0,q=0,Z=[],ie,he,ge,ye=0;ye0&&Lde)for(var G=1,me=k.length;G2;for(z=z||0,ie&&(q=I[2].xI[L-2].x?1:J.x===I[L-2].x?0:-1,Z=J.y>I[L-2].y?1:J.y===I[L-2].y?0:-1),M.push(["L",J.x+q*z,J.y+Z*z]),M}function ue(I,z,M){return M&&(z=t.util.multiplyTransformMatrices(z,[1,0,0,1,-M.x,-M.y])),I.map(function(L){for(var J=L.slice(0),V={},P=1;P=m})}function h(s,d){return f(s,d,function(g,m){return g/g,">")}function h(f){var s=0,d,g=[];for(s=0,d;s57343)return f.charAt(s);if(55296<=d&&d<=56319){if(f.length<=s+1)throw"High surrogate without following low surrogate";var g=f.charCodeAt(s+1);if(56320>g||g>57343)throw"High surrogate without following low surrogate";return f.charAt(s)+f.charAt(s+1)}if(s===0)throw"Low surrogate without preceding high surrogate";var m=f.charCodeAt(s-1);if(55296>m||m>56319)throw"Low surrogate without preceding high surrogate";return!1}t.util.string={camelize:o,capitalize:a,escapeXml:u,graphemeSplit:h}}(),function(){var o=Array.prototype.slice,a=function(){},u=function(){for(var d in{toString:1})if(d==="toString")return!1;return!0}(),h=function(d,g,m){for(var y in g)y in d.prototype&&typeof d.prototype[y]=="function"&&(g[y]+"").indexOf("callSuper")>-1?d.prototype[y]=function(b){return function(){var _=this.constructor.superclass;this.constructor.superclass=m;var w=g[b].apply(this,arguments);if(this.constructor.superclass=_,b!=="initialize")return w}}(y):d.prototype[y]=g[y],u&&(g.toString!==Object.prototype.toString&&(d.prototype.toString=g.toString),g.valueOf!==Object.prototype.valueOf&&(d.prototype.valueOf=g.valueOf))};function c(){}function f(d){for(var g=null,m=this;m.constructor.superclass;){var y=m.constructor.superclass.prototype[d];if(m[d]!==y){g=y;break}m=m.constructor.superclass.prototype}return g?arguments.length>1?g.apply(this,o.call(arguments,1)):g.call(this):console.log("tried to callSuper "+d+", method not found in prototype chain",this)}function s(){var d=null,g=o.call(arguments,0);typeof g[0]=="function"&&(d=g.shift());function m(){this.initialize.apply(this,arguments)}m.superclass=d,m.subclasses=[],d&&(c.prototype=d.prototype,m.prototype=new c,d.subclasses.push(m));for(var y=0,b=g.length;y-1||h.pointerType==="touch"}}(),function(){function o(s,d){var g=s.style;if(!g)return s;if(typeof d=="string")return s.style.cssText+=";"+d,d.indexOf("opacity")>-1?f(s,d.match(/opacity:\s*(\d?\.?\d*)/)[1]):s;for(var m in d)if(m==="opacity")f(s,d[m]);else{var y=m==="float"||m==="cssFloat"?typeof g.styleFloat>"u"?"cssFloat":"styleFloat":m;g.setProperty(y,d[m])}return s}var a=t.document.createElement("div"),u=typeof a.style.opacity=="string",h=typeof a.style.filter=="string",c=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,f=function(s){return s};u?f=function(s,d){return s.style.opacity=d,s}:h&&(f=function(s,d){var g=s.style;return s.currentStyle&&!s.currentStyle.hasLayout&&(g.zoom=1),c.test(g.filter)?(d=d>=.9999?"":"alpha(opacity="+d*100+")",g.filter=g.filter.replace(c,d)):g.filter+=" alpha(opacity="+d*100+")",s}),t.util.setStyle=o}(),function(){var o=Array.prototype.slice;function a(w){return typeof w=="string"?t.document.getElementById(w):w}var u,h=function(w){return o.call(w,0)};try{u=h(t.document.childNodes)instanceof Array}catch{}u||(h=function(w){for(var S=new Array(w.length),x=w.length;x--;)S[x]=w[x];return S});function c(w,S){var x=t.document.createElement(w);for(var T in S)T==="class"?x.className=S[T]:T==="for"?x.htmlFor=S[T]:x.setAttribute(T,S[T]);return x}function f(w,S){w&&(" "+w.className+" ").indexOf(" "+S+" ")===-1&&(w.className+=(w.className?" ":"")+S)}function s(w,S,x){return typeof S=="string"&&(S=c(S,x)),w.parentNode&&w.parentNode.replaceChild(S,w),S.appendChild(w),S}function d(w){for(var S=0,x=0,T=t.document.documentElement,O=t.document.body||{scrollLeft:0,scrollTop:0};w&&(w.parentNode||w.host)&&(w=w.parentNode||w.host,w===t.document?(S=O.scrollLeft||T.scrollLeft||0,x=O.scrollTop||T.scrollTop||0):(S+=w.scrollLeft||0,x+=w.scrollTop||0),!(w.nodeType===1&&w.style.position==="fixed")););return{left:S,top:x}}function g(w){var S,x=w&&w.ownerDocument,T={left:0,top:0},O={left:0,top:0},A,D={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!x)return O;for(var N in D)O[D[N]]+=parseInt(m(w,N),10)||0;return S=x.documentElement,typeof w.getBoundingClientRect<"u"&&(T=w.getBoundingClientRect()),A=d(w),{left:T.left+A.left-(S.clientLeft||0)+O.left,top:T.top+A.top-(S.clientTop||0)+O.top}}var m;t.document.defaultView&&t.document.defaultView.getComputedStyle?m=function(w,S){var x=t.document.defaultView.getComputedStyle(w,null);return x?x[S]:void 0}:m=function(w,S){var x=w.style[S];return!x&&w.currentStyle&&(x=w.currentStyle[S]),x},function(){var w=t.document.documentElement.style,S="userSelect"in w?"userSelect":"MozUserSelect"in w?"MozUserSelect":"WebkitUserSelect"in w?"WebkitUserSelect":"KhtmlUserSelect"in w?"KhtmlUserSelect":"";function x(O){return typeof O.onselectstart<"u"&&(O.onselectstart=t.util.falseFunction),S?O.style[S]="none":typeof O.unselectable=="string"&&(O.unselectable="on"),O}function T(O){return typeof O.onselectstart<"u"&&(O.onselectstart=null),S?O.style[S]="":typeof O.unselectable=="string"&&(O.unselectable=""),O}t.util.makeElementUnselectable=x,t.util.makeElementSelectable=T}();function y(w){var S=t.jsdomImplForWrapper(w);return S._canvas||S._image}function b(w){if(!!t.isLikelyNode){var S=t.jsdomImplForWrapper(w);S&&(S._image=null,S._canvas=null,S._currentSrc=null,S._attributes=null,S._classList=null)}}function _(w,S){w.imageSmoothingEnabled=w.imageSmoothingEnabled||w.webkitImageSmoothingEnabled||w.mozImageSmoothingEnabled||w.msImageSmoothingEnabled||w.oImageSmoothingEnabled,w.imageSmoothingEnabled=S}t.util.setImageSmoothing=_,t.util.getById=a,t.util.toArray=h,t.util.addClass=f,t.util.makeElement=c,t.util.wrapElement=s,t.util.getScrollLeftTop=d,t.util.getElementOffset=g,t.util.getNodeCanvas=y,t.util.cleanUpJsdomNode=b}(),function(){function o(h,c){return h+(/\?/.test(h)?"&":"?")+c}function a(){}function u(h,c){c||(c={});var f=c.method?c.method.toUpperCase():"GET",s=c.onComplete||function(){},d=new t.window.XMLHttpRequest,g=c.body||c.parameters;return d.onreadystatechange=function(){d.readyState===4&&(s(d),d.onreadystatechange=a)},f==="GET"&&(g=null,typeof c.parameters=="string"&&(h=o(h,c.parameters))),d.open(f,h,!0),(f==="POST"||f==="PUT")&&d.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),d.send(g),d}t.util.request=u}(),t.log=console.log,t.warn=console.warn,function(){var o=t.util.object.extend,a=t.util.object.clone,u=[];t.util.object.extend(u,{cancelAll:function(){var y=this.splice(0);return y.forEach(function(b){b.cancel()}),y},cancelByCanvas:function(y){if(!y)return[];var b=this.filter(function(_){return typeof _.target=="object"&&_.target.canvas===y});return b.forEach(function(_){_.cancel()}),b},cancelByTarget:function(y){var b=this.findAnimationsByTarget(y);return b.forEach(function(_){_.cancel()}),b},findAnimationIndex:function(y){return this.indexOf(this.findAnimation(y))},findAnimation:function(y){return this.find(function(b){return b.cancel===y})},findAnimationsByTarget:function(y){return y?this.filter(function(b){return b.target===y}):[]}});function h(){return!1}function c(y,b,_,w){return-_*Math.cos(y/w*(Math.PI/2))+_+b}function f(y){y||(y={});var b=!1,_,w=function(){var S=t.runningAnimations.indexOf(_);return S>-1&&t.runningAnimations.splice(S,1)[0]};return _=o(a(y),{cancel:function(){return b=!0,w()},currentValue:"startValue"in y?y.startValue:0,completionRate:0,durationRate:0}),t.runningAnimations.push(_),g(function(S){var x=S||+new Date,T=y.duration||500,O=x+T,A,D=y.onChange||h,N=y.abort||h,R=y.onComplete||h,B=y.easing||c,E="startValue"in y?y.startValue.length>0:!1,U="startValue"in y?y.startValue:0,ne="endValue"in y?y.endValue:100,Q=y.byValue||(E?U.map(function(ue,I){return ne[I]-U[I]}):ne-U);y.onStart&&y.onStart(),function ue(I){A=I||+new Date;var z=A>O?T:A-x,M=z/T,L=E?U.map(function(V,P){return B(z,U[P],Q[P],T)}):B(z,U,Q,T),J=Math.abs(E?(L[0]-U[0])/Q[0]:(L-U)/Q);if(_.currentValue=E?L.slice():L,_.completionRate=J,_.durationRate=M,!b){if(N(L,J,M)){w();return}if(A>O){_.currentValue=E?ne.slice():ne,_.completionRate=1,_.durationRate=1,D(E?ne.slice():ne,1,1),R(ne,1,1),w();return}else D(L,J,M),g(ue)}}(x)}),_.cancel}var s=t.window.requestAnimationFrame||t.window.webkitRequestAnimationFrame||t.window.mozRequestAnimationFrame||t.window.oRequestAnimationFrame||t.window.msRequestAnimationFrame||function(y){return t.window.setTimeout(y,1e3/60)},d=t.window.cancelAnimationFrame||t.window.clearTimeout;function g(){return s.apply(t.window,arguments)}function m(){return d.apply(t.window,arguments)}t.util.animate=f,t.util.requestAnimFrame=g,t.util.cancelAnimFrame=m,t.runningAnimations=u}(),function(){function o(u,h,c){var f="rgba("+parseInt(u[0]+c*(h[0]-u[0]),10)+","+parseInt(u[1]+c*(h[1]-u[1]),10)+","+parseInt(u[2]+c*(h[2]-u[2]),10);return f+=","+(u&&h?parseFloat(u[3]+c*(h[3]-u[3])):1),f+=")",f}function a(u,h,c,f){var s=new t.Color(u).getSource(),d=new t.Color(h).getSource(),g=f.onComplete,m=f.onChange;return f=f||{},t.util.animate(t.util.object.extend(f,{duration:c||500,startValue:s,endValue:d,byValue:d,easing:function(y,b,_,w){var S=f.colorEasing?f.colorEasing(y,w):1-Math.cos(y/w*(Math.PI/2));return o(b,_,S)},onComplete:function(y,b,_){if(g)return g(o(d,d,0),b,_)},onChange:function(y,b,_){if(m){if(Array.isArray(y))return m(o(y,y,0),b,_);m(y,b,_)}}}))}t.util.animateColor=a}(),function(){function o(I,z,M,L){return I-1&&ye>-1&&ye-1)&&(P="stroke")}else{if(V==="href"||V==="xlink:href"||V==="font")return P;if(V==="imageSmoothing")return P==="optimizeQuality";he=ie?P.map(f):f(P,Z)}}return!ie&&isNaN(he)?P:he}function O(V){return new RegExp("^("+V.join("|")+")\\b","i")}function A(V){for(var P in _)if(!(typeof V[_[P]]>"u"||V[P]==="")){if(typeof V[P]>"u"){if(!a.Object.prototype[P])continue;V[P]=a.Object.prototype[P]}if(V[P].indexOf("url(")!==0){var q=new a.Color(V[P]);V[P]=q.setAlpha(c(q.getAlpha()*V[_[P]],2)).toRgba()}}return V}function D(V,P){var q,Z=[],ie,he,ge;for(he=0,ge=P.length;he1;)ae.shift(),te=a.util.multiplyTransformMatrices(te,ae[0]);return te}}();function N(V,P){var q,Z;V.replace(/;\s*$/,"").split(";").forEach(function(ie){var he=ie.split(":");q=he[0].trim().toLowerCase(),Z=he[1].trim(),P[q]=Z})}function R(V,P){var q,Z;for(var ie in V)typeof V[ie]>"u"||(q=ie.toLowerCase(),Z=V[ie],P[q]=Z)}function B(V,P){var q={};for(var Z in a.cssRules[P])if(E(V,Z.split(" ")))for(var ie in a.cssRules[P][Z])q[ie]=a.cssRules[P][Z][ie];return q}function E(V,P){var q,Z=!0;return q=ne(V,P.pop()),q&&P.length&&(Z=U(V,P)),q&&Z&&P.length===0}function U(V,P){for(var q,Z=!0;V.parentNode&&V.parentNode.nodeType===1&&P.length;)Z&&(q=P.pop()),V=V.parentNode,Z=ne(V,q);return P.length===0}function ne(V,P){var q=V.nodeName,Z=V.getAttribute("class"),ie=V.getAttribute("id"),he,ge;if(he=new RegExp("^"+q,"i"),P=P.replace(he,""),ie&&P.length&&(he=new RegExp("#"+ie+"(?![a-zA-Z\\-]+)","i"),P=P.replace(he,"")),Z&&P.length)for(Z=Z.split(" "),ge=Z.length;ge--;)he=new RegExp("\\."+Z[ge]+"(?![a-zA-Z\\-]+)","i"),P=P.replace(he,"");return P.length===0}function Q(V,P){var q;if(V.getElementById&&(q=V.getElementById(P)),q)return q;var Z,ie,he,ge=V.getElementsByTagName("*");for(ie=0,he=ge.length;ieZ?Z:q),F.meetOrSlice==="slice"&&(Z=q=q>Z?q:Z),ae=G.width-ge*q,te=G.height-ye*q,F.alignX==="Mid"&&(ae/=2),F.alignY==="Mid"&&(te/=2),F.alignX==="Min"&&(ae=0),F.alignY==="Min"&&(te=0)),q===1&&Z===1&&ie===0&&he===0&&W===0&&$===0)return G;if((W||$)&&V.parentNode.nodeName!=="#document"&&(me=" translate("+f(W)+" "+f($)+") "),H=me+" matrix("+q+" 0 0 "+Z+" "+(ie*q+ae)+" "+(he*Z+te)+") ",V.nodeName==="svg"){for(Y=V.ownerDocument.createElementNS(a.svgNS,"g");V.firstChild;)Y.appendChild(V.firstChild);V.appendChild(Y)}else Y=V,Y.removeAttribute("x"),Y.removeAttribute("y"),H=Y.getAttribute("transform")+H;return Y.setAttribute("transform",H),G}function M(V,P){for(;V&&(V=V.parentNode);)if(V.nodeName&&P.test(V.nodeName.replace("svg:",""))&&!V.getAttribute("instantiated_by_use"))return!0;return!1}a.parseSVGDocument=function(V,P,q,Z){if(!!V){ue(V);var ie=a.Object.__uid++,he,ge,ye=z(V),H=a.util.toArray(V.getElementsByTagName("*"));if(ye.crossOrigin=Z&&Z.crossOrigin,ye.svgUid=ie,H.length===0&&a.isLikelyNode){H=V.selectNodes('//*[name(.)!="svg"]');var Y=[];for(he=0,ge=H.length;he"u"&&(q=V.getAttribute("svgUid")),V.parentNode&&a.svgValidParentsRegEx.test(V.parentNode.nodeName)&&(ie=a.parseAttributes(V.parentNode,P,q));var ye=P.reduce(function(F,K){return Z=V.getAttribute(K),Z&&(F[K]=Z),F},{}),H=u(B(V,q),a.parseStyleAttribute(V));ye=u(ye,H),H[S]&&V.setAttribute(S,H[S]),he=ge=ie.fontSize||a.Text.DEFAULT_SVG_FONT_SIZE,ye[w]&&(ye[w]=he=f(ye[w],ge));var Y,k,X={};for(var W in ye)Y=x(W),k=T(Y,ye[W],ie,he),X[Y]=k;X&&X.font&&a.parseFontDeclaration(X.font,X);var $=u(ie,X);return a.svgValidParentsRegEx.test(V.nodeName)?$:A($)}},parseElements:function(V,P,q,Z,ie){new a.ElementsParser(V,P,q,Z,ie).parse()},parseStyleAttribute:function(V){var P={},q=V.getAttribute("style");return q&&(typeof q=="string"?N(q,P):R(q,P)),P},parsePointsAttribute:function(V){if(!V)return null;V=V.replace(/,/g," ").trim(),V=V.split(/\s+/);var P=[],q,Z;for(q=0,Z=V.length;qh.x&&this.y>h.y},gte:function(h){return this.x>=h.x&&this.y>=h.y},lerp:function(h,c){return typeof c>"u"&&(c=.5),c=Math.max(Math.min(1,c),0),new u(this.x+(h.x-this.x)*c,this.y+(h.y-this.y)*c)},distanceFrom:function(h){var c=this.x-h.x,f=this.y-h.y;return Math.sqrt(c*c+f*f)},midPointFrom:function(h){return this.lerp(h)},min:function(h){return new u(Math.min(this.x,h.x),Math.min(this.y,h.y))},max:function(h){return new u(Math.max(this.x,h.x),Math.max(this.y,h.y))},toString:function(){return this.x+","+this.y},setXY:function(h,c){return this.x=h,this.y=c,this},setX:function(h){return this.x=h,this},setY:function(h){return this.y=h,this},setFromPoint:function(h){return this.x=h.x,this.y=h.y,this},swap:function(h){var c=this.x,f=this.y;this.x=h.x,this.y=h.y,h.x=c,h.y=f},clone:function(){return new u(this.x,this.y)}}}(e),function(o){var a=o.fabric||(o.fabric={});if(a.Intersection){a.warn("fabric.Intersection is already defined");return}function u(h){this.status=h,this.points=[]}a.Intersection=u,a.Intersection.prototype={constructor:u,appendPoint:function(h){return this.points.push(h),this},appendPoints:function(h){return this.points=this.points.concat(h),this}},a.Intersection.intersectLineLine=function(h,c,f,s){var d,g=(s.x-f.x)*(h.y-f.y)-(s.y-f.y)*(h.x-f.x),m=(c.x-h.x)*(h.y-f.y)-(c.y-h.y)*(h.x-f.x),y=(s.y-f.y)*(c.x-h.x)-(s.x-f.x)*(c.y-h.y);if(y!==0){var b=g/y,_=m/y;0<=b&&b<=1&&0<=_&&_<=1?(d=new u("Intersection"),d.appendPoint(new a.Point(h.x+b*(c.x-h.x),h.y+b*(c.y-h.y)))):d=new u}else g===0||m===0?d=new u("Coincident"):d=new u("Parallel");return d},a.Intersection.intersectLinePolygon=function(h,c,f){var s=new u,d=f.length,g,m,y,b;for(b=0;b0&&(s.status="Intersection"),s},a.Intersection.intersectPolygonPolygon=function(h,c){var f=new u,s=h.length,d;for(d=0;d0&&(f.status="Intersection"),f},a.Intersection.intersectPolygonRectangle=function(h,c,f){var s=c.min(f),d=c.max(f),g=new a.Point(d.x,s.y),m=new a.Point(s.x,d.y),y=u.intersectLinePolygon(s,g,h),b=u.intersectLinePolygon(g,d,h),_=u.intersectLinePolygon(d,m,h),w=u.intersectLinePolygon(m,s,h),S=new u;return S.appendPoints(y.points),S.appendPoints(b.points),S.appendPoints(_.points),S.appendPoints(w.points),S.points.length>0&&(S.status="Intersection"),S}}(e),function(o){var a=o.fabric||(o.fabric={});if(a.Color){a.warn("fabric.Color is already defined.");return}function u(c){c?this._tryParsingColor(c):this.setSource([0,0,0,1])}a.Color=u,a.Color.prototype={_tryParsingColor:function(c){var f;c in u.colorNameMap&&(c=u.colorNameMap[c]),c==="transparent"&&(f=[255,255,255,0]),f||(f=u.sourceFromHex(c)),f||(f=u.sourceFromRgb(c)),f||(f=u.sourceFromHsl(c)),f||(f=[0,0,0,1]),f&&this.setSource(f)},_rgbToHsl:function(c,f,s){c/=255,f/=255,s/=255;var d,g,m,y=a.util.array.max([c,f,s]),b=a.util.array.min([c,f,s]);if(m=(y+b)/2,y===b)d=g=0;else{var _=y-b;switch(g=m>.5?_/(2-y-b):_/(y+b),y){case c:d=(f-s)/_+(f1&&(s-=1),s<1/6?c+(f-c)*6*s:s<1/2?f:s<2/3?c+(f-c)*(2/3-s)*6:c}a.Color.fromRgb=function(c){return u.fromSource(u.sourceFromRgb(c))},a.Color.sourceFromRgb=function(c){var f=c.match(u.reRGBa);if(f){var s=parseInt(f[1],10)/(/%$/.test(f[1])?100:1)*(/%$/.test(f[1])?255:1),d=parseInt(f[2],10)/(/%$/.test(f[2])?100:1)*(/%$/.test(f[2])?255:1),g=parseInt(f[3],10)/(/%$/.test(f[3])?100:1)*(/%$/.test(f[3])?255:1);return[parseInt(s,10),parseInt(d,10),parseInt(g,10),f[4]?parseFloat(f[4]):1]}},a.Color.fromRgba=u.fromRgb,a.Color.fromHsl=function(c){return u.fromSource(u.sourceFromHsl(c))},a.Color.sourceFromHsl=function(c){var f=c.match(u.reHSLa);if(!!f){var s=(parseFloat(f[1])%360+360)%360/360,d=parseFloat(f[2])/(/%$/.test(f[2])?100:1),g=parseFloat(f[3])/(/%$/.test(f[3])?100:1),m,y,b;if(d===0)m=y=b=g;else{var _=g<=.5?g*(d+1):g+d-g*d,w=g*2-_;m=h(w,_,s+1/3),y=h(w,_,s),b=h(w,_,s-1/3)}return[Math.round(m*255),Math.round(y*255),Math.round(b*255),f[4]?parseFloat(f[4]):1]}},a.Color.fromHsla=u.fromHsl,a.Color.fromHex=function(c){return u.fromSource(u.sourceFromHex(c))},a.Color.sourceFromHex=function(c){if(c.match(u.reHex)){var f=c.slice(c.indexOf("#")+1),s=f.length===3||f.length===4,d=f.length===8||f.length===4,g=s?f.charAt(0)+f.charAt(0):f.substring(0,2),m=s?f.charAt(1)+f.charAt(1):f.substring(2,4),y=s?f.charAt(2)+f.charAt(2):f.substring(4,6),b=d?s?f.charAt(3)+f.charAt(3):f.substring(6,8):"FF";return[parseInt(g,16),parseInt(m,16),parseInt(y,16),parseFloat((parseInt(b,16)/255).toFixed(2))]}},a.Color.fromSource=function(c){var f=new u;return f.setSource(c),f}}(e),function(o){var a=o.fabric||(o.fabric={}),u=["e","se","s","sw","w","nw","n","ne","e"],h=["ns","nesw","ew","nwse"],c={},f="left",s="top",d="right",g="bottom",m="center",y={top:g,bottom:s,left:d,right:f,center:m},b=a.util.radiansToDegrees,_=Math.sign||function(Y){return(Y>0)-(Y<0)||+Y};function w(Y,k){var X=Y.angle+b(Math.atan2(k.y,k.x))+360;return Math.round(X%360/45)}function S(Y,k){var X=k.transform.target,W=X.canvas,$=a.util.object.clone(k);$.target=X,W&&W.fire("object:"+Y,$),X.fire(Y,k)}function x(Y,k){var X=k.canvas,W=X.uniScaleKey,$=Y[W];return X.uniformScaling&&!$||!X.uniformScaling&&$}function T(Y){return Y.originX===m&&Y.originY===m}function O(Y,k,X){var W=Y.lockScalingX,$=Y.lockScalingY;return!!(W&&$||!k&&(W||$)&&X||W&&k==="x"||$&&k==="y")}function A(Y,k,X){var W="not-allowed",$=x(Y,X),F="";if(k.x!==0&&k.y===0?F="x":k.x===0&&k.y!==0&&(F="y"),O(X,F,$))return W;var K=w(X,k);return u[K]+"-resize"}function D(Y,k,X){var W="not-allowed";if(k.x!==0&&X.lockSkewingY||k.y!==0&&X.lockSkewingX)return W;var $=w(X,k)%4;return h[$]+"-resize"}function N(Y,k,X){return Y[X.canvas.altActionKey]?c.skewCursorStyleHandler(Y,k,X):c.scaleCursorStyleHandler(Y,k,X)}function R(Y,k,X){var W=Y[X.canvas.altActionKey];if(k.x===0)return W?"skewX":"scaleY";if(k.y===0)return W?"skewY":"scaleX"}function B(Y,k,X){return X.lockRotation?"not-allowed":k.cursorStyle}function E(Y,k,X,W){return{e:Y,transform:k,pointer:{x:X,y:W}}}function U(Y){return function(k,X,W,$){var F=X.target,K=F.getCenterPoint(),de=F.translateToOriginPoint(K,X.originX,X.originY),oe=Y(k,X,W,$);return F.setPositionByOrigin(de,X.originX,X.originY),oe}}function ne(Y,k){return function(X,W,$,F){var K=k(X,W,$,F);return K&&S(Y,E(X,W,$,F)),K}}function Q(Y,k,X,W,$){var F=Y.target,K=F.controls[Y.corner],de=F.canvas.getZoom(),oe=F.padding/de,G=F.toLocalPoint(new a.Point(W,$),k,X);return G.x>=oe&&(G.x-=oe),G.x<=-oe&&(G.x+=oe),G.y>=oe&&(G.y-=oe),G.y<=oe&&(G.y+=oe),G.x-=K.offsetX,G.y-=K.offsetY,G}function ue(Y){return Y.flipX!==Y.flipY}function I(Y,k,X,W,$){if(Y[k]!==0){var F=Y._getTransformedDimensions()[W],K=$/F*Y[X];Y.set(X,K)}}function z(Y,k,X,W){var $=k.target,F=$._getTransformedDimensions(0,$.skewY),K=Q(k,k.originX,k.originY,X,W),de=Math.abs(K.x*2)-F.x,oe=$.skewX,G;de<2?G=0:(G=b(Math.atan2(de/$.scaleX,F.y/$.scaleY)),k.originX===f&&k.originY===g&&(G=-G),k.originX===d&&k.originY===s&&(G=-G),ue($)&&(G=-G));var me=oe!==G;if(me){var ae=$._getTransformedDimensions().y;$.set("skewX",G),I($,"skewY","scaleY","y",ae)}return me}function M(Y,k,X,W){var $=k.target,F=$._getTransformedDimensions($.skewX,0),K=Q(k,k.originX,k.originY,X,W),de=Math.abs(K.y*2)-F.y,oe=$.skewY,G;de<2?G=0:(G=b(Math.atan2(de/$.scaleY,F.x/$.scaleX)),k.originX===f&&k.originY===g&&(G=-G),k.originX===d&&k.originY===s&&(G=-G),ue($)&&(G=-G));var me=oe!==G;if(me){var ae=$._getTransformedDimensions().x;$.set("skewY",G),I($,"skewX","scaleX","x",ae)}return me}function L(Y,k,X,W){var $=k.target,F=$.skewX,K,de=k.originY;if($.lockSkewingX)return!1;if(F===0){var oe=Q(k,m,m,X,W);oe.x>0?K=f:K=d}else F>0&&(K=de===s?f:d),F<0&&(K=de===s?d:f),ue($)&&(K=K===f?d:f);k.originX=K;var G=ne("skewing",U(z));return G(Y,k,X,W)}function J(Y,k,X,W){var $=k.target,F=$.skewY,K,de=k.originX;if($.lockSkewingY)return!1;if(F===0){var oe=Q(k,m,m,X,W);oe.y>0?K=s:K=g}else F>0&&(K=de===f?s:g),F<0&&(K=de===f?g:s),ue($)&&(K=K===s?g:s);k.originY=K;var G=ne("skewing",U(M));return G(Y,k,X,W)}function V(Y,k,X,W){var $=k,F=$.target,K=F.translateToOriginPoint(F.getCenterPoint(),$.originX,$.originY);if(F.lockRotation)return!1;var de=Math.atan2($.ey-K.y,$.ex-K.x),oe=Math.atan2(W-K.y,X-K.x),G=b(oe-de+$.theta),me=!0;if(F.snapAngle>0){var ae=F.snapAngle,te=F.snapThreshold||ae,be=Math.ceil(G/ae)*ae,Ce=Math.floor(G/ae)*ae;Math.abs(G-Ce)_?(A=b,s.scale(1,_/b),O=g*b/_):_>b?(A=_,s.scale(b/_,1),T=d*_/b):A=b,s.lineWidth=1,s.beginPath(),s.arc(T,O,A/2,0,2*Math.PI,!1),s[S](),x&&s.stroke(),s.restore()}function f(s,d,g,m,y){m=m||{};var b=this.sizeX||m.cornerSize||y.cornerSize,_=this.sizeY||m.cornerSize||y.cornerSize,w=typeof m.transparentCorners<"u"?m.transparentCorners:y.transparentCorners,S=w?"stroke":"fill",x=!w&&(m.cornerStrokeColor||y.cornerStrokeColor),T=b/2,O=_/2;s.save(),s.fillStyle=m.cornerColor||y.cornerColor,s.strokeStyle=m.cornerStrokeColor||y.cornerStrokeColor,s.lineWidth=1,s.translate(d,g),s.rotate(u(y.angle)),s[S+"Rect"](-T,-O,b,_),x&&s.strokeRect(-T,-O,b,_),s.restore()}h.renderCircleControl=c,h.renderSquareControl=f}(e),function(o){var a=o.fabric||(o.fabric={});function u(h){for(var c in h)this[c]=h[c]}a.Control=u,a.Control.prototype={visible:!0,actionName:"scale",angle:0,x:0,y:0,offsetX:0,offsetY:0,sizeX:null,sizeY:null,touchSizeX:null,touchSizeY:null,cursorStyle:"crosshair",withConnection:!1,actionHandler:function(){},mouseDownHandler:function(){},mouseUpHandler:function(){},getActionHandler:function(){return this.actionHandler},getMouseDownHandler:function(){return this.mouseDownHandler},getMouseUpHandler:function(){return this.mouseUpHandler},cursorStyleHandler:function(h,c){return c.cursorStyle},getActionName:function(h,c){return c.actionName},getVisibility:function(h,c){var f=h._controlsVisibility;return f&&typeof f[c]<"u"?f[c]:this.visible},setVisibility:function(h){this.visible=h},positionHandler:function(h,c){var f=a.util.transformPoint({x:this.x*h.x+this.offsetX,y:this.y*h.y+this.offsetY},c);return f},calcCornerCoords:function(h,c,f,s,d){var g,m,y,b,_=d?this.touchSizeX:this.sizeX,w=d?this.touchSizeY:this.sizeY;if(_&&w&&_!==w){var S=Math.atan2(w,_),x=Math.sqrt(_*_+w*w)/2,T=S-a.util.degreesToRadians(h),O=Math.PI/2-S-a.util.degreesToRadians(h);g=x*a.util.cos(T),m=x*a.util.sin(T),y=x*a.util.cos(O),b=x*a.util.sin(O)}else{var A=_&&w?_:c;x=A*.7071067812;var T=a.util.degreesToRadians(45-h);g=y=x*a.util.cos(T),m=b=x*a.util.sin(T)}return{tl:{x:f-b,y:s-y},tr:{x:f+g,y:s-m},bl:{x:f-g,y:s+m},br:{x:f+b,y:s+y}}},render:function(h,c,f,s,d){switch(s=s||{},s.cornerStyle||d.cornerStyle){case"circle":a.controlsUtils.renderCircleControl.call(this,h,c,f,s,d);break;default:a.controlsUtils.renderSquareControl.call(this,h,c,f,s,d)}}}}(e),function(){function o(f,s){var d=f.getAttribute("style"),g=f.getAttribute("offset")||0,m,y,b,_;if(g=parseFloat(g)/(/%$/.test(g)?100:1),g=g<0?0:g>1?1:g,d){var w=d.split(/\s*;\s*/);for(w[w.length-1]===""&&w.pop(),_=w.length;_--;){var S=w[_].split(/\s*:\s*/),x=S[0].trim(),T=S[1].trim();x==="stop-color"?m=T:x==="stop-opacity"&&(b=T)}}return m||(m=f.getAttribute("stop-color")||"rgb(0,0,0)"),b||(b=f.getAttribute("stop-opacity")),m=new t.Color(m),y=m.getAlpha(),b=isNaN(parseFloat(b))?1:parseFloat(b),b*=y*s,{offset:g,color:m.toRgb(),opacity:b}}function a(f){return{x1:f.getAttribute("x1")||0,y1:f.getAttribute("y1")||0,x2:f.getAttribute("x2")||"100%",y2:f.getAttribute("y2")||0}}function u(f){return{x1:f.getAttribute("fx")||f.getAttribute("cx")||"50%",y1:f.getAttribute("fy")||f.getAttribute("cy")||"50%",r1:0,x2:f.getAttribute("cx")||"50%",y2:f.getAttribute("cy")||"50%",r2:f.getAttribute("r")||"50%"}}var h=t.util.object.clone;t.Gradient=t.util.createClass({offsetX:0,offsetY:0,gradientTransform:null,gradientUnits:"pixels",type:"linear",initialize:function(f){f||(f={}),f.coords||(f.coords={});var s,d=this;Object.keys(f).forEach(function(g){d[g]=f[g]}),this.id?this.id+="_"+t.Object.__uid++:this.id=t.Object.__uid++,s={x1:f.coords.x1||0,y1:f.coords.y1||0,x2:f.coords.x2||0,y2:f.coords.y2||0},this.type==="radial"&&(s.r1=f.coords.r1||0,s.r2=f.coords.r2||0),this.coords=s,this.colorStops=f.colorStops.slice()},addColorStop:function(f){for(var s in f){var d=new t.Color(f[s]);this.colorStops.push({offset:parseFloat(s),color:d.toRgb(),opacity:d.getAlpha()})}return this},toObject:function(f){var s={type:this.type,coords:this.coords,colorStops:this.colorStops,offsetX:this.offsetX,offsetY:this.offsetY,gradientUnits:this.gradientUnits,gradientTransform:this.gradientTransform?this.gradientTransform.concat():this.gradientTransform};return t.util.populateWithProperties(this,s,f),s},toSVG:function(f,y){var d=h(this.coords,!0),g,m,y=y||{},b,_,w=h(this.colorStops,!0),S=d.r1>d.r2,x=this.gradientTransform?this.gradientTransform.concat():t.iMatrix.concat(),T=-this.offsetX,O=-this.offsetY,A=!!y.additionalTransform,D=this.gradientUnits==="pixels"?"userSpaceOnUse":"objectBoundingBox";if(w.sort(function(U,ne){return U.offset-ne.offset}),D==="objectBoundingBox"?(T/=f.width,O/=f.height):(T+=f.width/2,O+=f.height/2),f.type==="path"&&this.gradientUnits!=="percentage"&&(T-=f.pathOffset.x,O-=f.pathOffset.y),x[4]-=T,x[5]-=O,_='id="SVGID_'+this.id+'" gradientUnits="'+D+'"',_+=' gradientTransform="'+(A?y.additionalTransform+" ":"")+t.util.matrixToSVG(x)+'" ',this.type==="linear"?b=[" `]:this.type==="radial"&&(b=[" @@ -506,9 +506,9 @@ gl_FragColor.rgb *= color.a; `?(s++,f[s]=0):f[s]++;f[0]>0&&(this.insertCharStyleObject(c.lineIndex,c.charIndex,f[0],h),h=h&&h.slice(f[0]+1)),s&&this.insertNewlineStyleObject(c.lineIndex,c.charIndex+f[0],s);for(var d=1;d0?this.insertCharStyleObject(c.lineIndex+d,0,f[d],h):h&&this.styles[c.lineIndex+d]&&h[0]&&(this.styles[c.lineIndex+d][0]=h[0]),h=h&&h.slice(f[d]+1);f[d]>0&&this.insertCharStyleObject(c.lineIndex+d,0,f[d],h)},setSelectionStartEndWithShift:function(a,u,h){h<=a?(u===a?this._selectionDirection="left":this._selectionDirection==="right"&&(this._selectionDirection="left",this.selectionEnd=a),this.selectionStart=h):h>a&&ha?this.selectionStart=a:this.selectionStart<0&&(this.selectionStart=0),this.selectionEnd>a?this.selectionEnd=a:this.selectionEnd<0&&(this.selectionEnd=0)}})}(),t.util.object.extend(t.IText.prototype,{initDoubleClickSimulation:function(){this.__lastClickTime=+new Date,this.__lastLastClickTime=+new Date,this.__lastPointer={},this.on("mousedown",this.onMouseDown)},onMouseDown:function(o){if(!!this.canvas){this.__newClickTime=+new Date;var a=o.pointer;this.isTripleClick(a)&&(this.fire("tripleclick",o),this._stopEvent(o.e)),this.__lastLastClickTime=this.__lastClickTime,this.__lastClickTime=this.__newClickTime,this.__lastPointer=a,this.__lastIsEditing=this.isEditing,this.__lastSelected=this.selected}},isTripleClick:function(o){return this.__newClickTime-this.__lastClickTime<500&&this.__lastClickTime-this.__lastLastClickTime<500&&this.__lastPointer.x===o.x&&this.__lastPointer.y===o.y},_stopEvent:function(o){o.preventDefault&&o.preventDefault(),o.stopPropagation&&o.stopPropagation()},initCursorSelectionHandlers:function(){this.initMousedownHandler(),this.initMouseupHandler(),this.initClicks()},doubleClickHandler:function(o){!this.isEditing||this.selectWord(this.getSelectionStartFromPointer(o.e))},tripleClickHandler:function(o){!this.isEditing||this.selectLine(this.getSelectionStartFromPointer(o.e))},initClicks:function(){this.on("mousedblclick",this.doubleClickHandler),this.on("tripleclick",this.tripleClickHandler)},_mouseDownHandler:function(o){!this.canvas||!this.editable||o.e.button&&o.e.button!==1||(this.__isMousedown=!0,this.selected&&(this.inCompositionMode=!1,this.setCursorByClick(o.e)),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()))},_mouseDownHandlerBefore:function(o){!this.canvas||!this.editable||o.e.button&&o.e.button!==1||(this.selected=this===this.canvas._activeObject)},initMousedownHandler:function(){this.on("mousedown",this._mouseDownHandler),this.on("mousedown:before",this._mouseDownHandlerBefore)},initMouseupHandler:function(){this.on("mouseup",this.mouseUpHandler)},mouseUpHandler:function(o){if(this.__isMousedown=!1,!(!this.editable||this.group||o.transform&&o.transform.actionPerformed||o.e.button&&o.e.button!==1)){if(this.canvas){var a=this.canvas._activeObject;if(a&&a!==this)return}this.__lastSelected&&!this.__corner?(this.selected=!1,this.__lastSelected=!1,this.enterEditing(o.e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection()):this.selected=!0}},setCursorByClick:function(o){var a=this.getSelectionStartFromPointer(o),u=this.selectionStart,h=this.selectionEnd;o.shiftKey?this.setSelectionStartEndWithShift(u,h,a):(this.selectionStart=a,this.selectionEnd=a),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())},getSelectionStartFromPointer:function(o){for(var a=this.getLocalPointer(o),u=0,h=0,c=0,f=0,s=0,d,g,m=0,y=this._textLines.length;m0&&(f+=this._textLines[m-1].length+this.missingNewlineOffset(m-1));d=this._getLineLeftOffset(s),h=d*this.scaleX,g=this._textLines[s],this.direction==="rtl"&&(a.x=this.width*this.scaleX-a.x+h);for(var b=0,_=g.length;b<_&&(u=h,h+=this.__charBounds[s][b].kernedWidth*this.scaleX,h<=a.x);b++)f++;return this._getNewSelectionStartFromOffset(a,u,h,f,_)},_getNewSelectionStartFromOffset:function(o,a,u,h,c){var f=o.x-a,s=u-o.x,d=s>f||s<0?0:1,g=h+d;return this.flipX&&(g=c-g),g>this._text.length&&(g=this._text.length),g}}),t.util.object.extend(t.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=t.document.createElement("textarea"),this.hiddenTextarea.setAttribute("autocapitalize","off"),this.hiddenTextarea.setAttribute("autocorrect","off"),this.hiddenTextarea.setAttribute("autocomplete","off"),this.hiddenTextarea.setAttribute("spellcheck","false"),this.hiddenTextarea.setAttribute("data-fabric-hiddentextarea",""),this.hiddenTextarea.setAttribute("wrap","off");var o=this._calcTextareaPosition();this.hiddenTextarea.style.cssText="position: absolute; top: "+o.top+"; left: "+o.left+"; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; padding\uFF70top: "+o.fontSize+";",this.hiddenTextareaContainer?this.hiddenTextareaContainer.appendChild(this.hiddenTextarea):t.document.body.appendChild(this.hiddenTextarea),t.util.addListener(this.hiddenTextarea,"keydown",this.onKeyDown.bind(this)),t.util.addListener(this.hiddenTextarea,"keyup",this.onKeyUp.bind(this)),t.util.addListener(this.hiddenTextarea,"input",this.onInput.bind(this)),t.util.addListener(this.hiddenTextarea,"copy",this.copy.bind(this)),t.util.addListener(this.hiddenTextarea,"cut",this.copy.bind(this)),t.util.addListener(this.hiddenTextarea,"paste",this.paste.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionstart",this.onCompositionStart.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionupdate",this.onCompositionUpdate.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionend",this.onCompositionEnd.bind(this)),!this._clickHandlerInitialized&&this.canvas&&(t.util.addListener(this.canvas.upperCanvasEl,"click",this.onClick.bind(this)),this._clickHandlerInitialized=!0)},keysMap:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorRight",36:"moveCursorLeft",37:"moveCursorLeft",38:"moveCursorUp",39:"moveCursorRight",40:"moveCursorDown"},keysMapRtl:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorLeft",36:"moveCursorRight",37:"moveCursorRight",38:"moveCursorUp",39:"moveCursorLeft",40:"moveCursorDown"},ctrlKeysMapUp:{67:"copy",88:"cut"},ctrlKeysMapDown:{65:"selectAll"},onClick:function(){this.hiddenTextarea&&this.hiddenTextarea.focus()},onKeyDown:function(o){if(!!this.isEditing){var a=this.direction==="rtl"?this.keysMapRtl:this.keysMap;if(o.keyCode in a)this[a[o.keyCode]](o);else if(o.keyCode in this.ctrlKeysMapDown&&(o.ctrlKey||o.metaKey))this[this.ctrlKeysMapDown[o.keyCode]](o);else return;o.stopImmediatePropagation(),o.preventDefault(),o.keyCode>=33&&o.keyCode<=40?(this.inCompositionMode=!1,this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}},onKeyUp:function(o){if(!this.isEditing||this._copyDone||this.inCompositionMode){this._copyDone=!1;return}if(o.keyCode in this.ctrlKeysMapUp&&(o.ctrlKey||o.metaKey))this[this.ctrlKeysMapUp[o.keyCode]](o);else return;o.stopImmediatePropagation(),o.preventDefault(),this.canvas&&this.canvas.requestRenderAll()},onInput:function(o){var a=this.fromPaste;if(this.fromPaste=!1,o&&o.stopPropagation(),!!this.isEditing){var u=this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,h=this._text.length,c=u.length,f,s,d=c-h,g=this.selectionStart,m=this.selectionEnd,y=g!==m,b,_,w;if(this.hiddenTextarea.value===""){this.styles={},this.updateFromTextArea(),this.fire("changed"),this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll());return}var S=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value),x=g>S.selectionStart;y?(f=this._text.slice(g,m),d+=m-g):c0&&(h=this.__charBounds[o][a-1],u+=h.left+h.width),u},getDownCursorOffset:function(o,a){var u=this._getSelectionForOffset(o,a),h=this.get2DCursorLocation(u),c=h.lineIndex;if(c===this._textLines.length-1||o.metaKey||o.keyCode===34)return this._text.length-u;var f=h.charIndex,s=this._getWidthBeforeCursor(c,f),d=this._getIndexOnLine(c+1,s),g=this._textLines[c].slice(f);return g.length+d+1+this.missingNewlineOffset(c)},_getSelectionForOffset:function(o,a){return o.shiftKey&&this.selectionStart!==this.selectionEnd&&a?this.selectionEnd:this.selectionStart},getUpCursorOffset:function(o,a){var u=this._getSelectionForOffset(o,a),h=this.get2DCursorLocation(u),c=h.lineIndex;if(c===0||o.metaKey||o.keyCode===33)return-u;var f=h.charIndex,s=this._getWidthBeforeCursor(c,f),d=this._getIndexOnLine(c-1,s),g=this._textLines[c].slice(0,f),m=this.missingNewlineOffset(c-1);return-this._textLines[c-1].length+d-g.length+(1-m)},_getIndexOnLine:function(o,a){for(var u=this._textLines[o],h=this._getLineLeftOffset(o),c=h,f=0,s,d,g=0,m=u.length;ga){d=!0;var y=c-s,b=c,_=Math.abs(y-a),w=Math.abs(b-a);f=w<_?g:g-1;break}return d||(f=u.length-1),f},moveCursorDown:function(o){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorUpOrDown("Down",o)},moveCursorUp:function(o){this.selectionStart===0&&this.selectionEnd===0||this._moveCursorUpOrDown("Up",o)},_moveCursorUpOrDown:function(o,a){var u="get"+o+"CursorOffset",h=this[u](a,this._selectionDirection==="right");a.shiftKey?this.moveCursorWithShift(h):this.moveCursorWithoutShift(h),h!==0&&(this.setSelectionInBoundaries(),this.abortCursorAnimation(),this._currentCursorOpacity=1,this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorWithShift:function(o){var a=this._selectionDirection==="left"?this.selectionStart+o:this.selectionEnd+o;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,a),o!==0},moveCursorWithoutShift:function(o){return o<0?(this.selectionStart+=o,this.selectionEnd=this.selectionStart):(this.selectionEnd+=o,this.selectionStart=this.selectionEnd),o!==0},moveCursorLeft:function(o){this.selectionStart===0&&this.selectionEnd===0||this._moveCursorLeftOrRight("Left",o)},_move:function(o,a,u){var h;if(o.altKey)h=this["findWordBoundary"+u](this[a]);else if(o.metaKey||o.keyCode===35||o.keyCode===36)h=this["findLineBoundary"+u](this[a]);else return this[a]+=u==="Left"?-1:1,!0;if(typeof h<"u"&&this[a]!==h)return this[a]=h,!0},_moveLeft:function(o,a){return this._move(o,a,"Left")},_moveRight:function(o,a){return this._move(o,a,"Right")},moveCursorLeftWithoutShift:function(o){var a=!0;return this._selectionDirection="left",this.selectionEnd===this.selectionStart&&this.selectionStart!==0&&(a=this._moveLeft(o,"selectionStart")),this.selectionEnd=this.selectionStart,a},moveCursorLeftWithShift:function(o){if(this._selectionDirection==="right"&&this.selectionStart!==this.selectionEnd)return this._moveLeft(o,"selectionEnd");if(this.selectionStart!==0)return this._selectionDirection="left",this._moveLeft(o,"selectionStart")},moveCursorRight:function(o){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight("Right",o)},_moveCursorLeftOrRight:function(o,a){var u="moveCursor"+o+"With";this._currentCursorOpacity=1,a.shiftKey?u+="Shift":u+="outShift",this[u](a)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorRightWithShift:function(o){if(this._selectionDirection==="left"&&this.selectionStart!==this.selectionEnd)return this._moveRight(o,"selectionStart");if(this.selectionEnd!==this._text.length)return this._selectionDirection="right",this._moveRight(o,"selectionEnd")},moveCursorRightWithoutShift:function(o){var a=!0;return this._selectionDirection="right",this.selectionStart===this.selectionEnd?(a=this._moveRight(o,"selectionStart"),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,a},removeChars:function(o,a){typeof a>"u"&&(a=o+1),this.removeStyleFromTo(o,a),this._text.splice(o,a-o),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()},insertChars:function(o,a,u,h){typeof h>"u"&&(h=u),h>u&&this.removeStyleFromTo(u,h);var c=t.util.string.graphemeSplit(o);this.insertNewStyleBlock(c,u,a),this._text=[].concat(this._text.slice(0,u),c,this._text.slice(h)),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()}}),function(){var o=t.util.toFixed,a=/ +/g;t.util.object.extend(t.Text.prototype,{_toSVG:function(){var u=this._getSVGLeftTopOffsets(),h=this._getSVGTextAndBg(u.textTop,u.textLeft);return this._wrapSVGTextAndBg(h)},toSVG:function(u){return this._createBaseSVGMarkup(this._toSVG(),{reviver:u,noStyle:!0,withShadow:!0})},_getSVGLeftTopOffsets:function(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}},_wrapSVGTextAndBg:function(u){var h=!0,c=this.getSvgTextDecoration(this);return[u.textBgRects.join(""),' ",u.textSpans.join(""),` `]},_getSVGTextAndBg:function(u,h){var c=[],f=[],s=u,d;this._setSVGBg(f);for(var g=0,m=this._textLines.length;g",t.util.string.escapeXml(u),""].join("")},_setSVGTextLineText:function(u,h,c,f){var s=this.getHeightOfLine(h),d=this.textAlign.indexOf("justify")!==-1,g,m,y="",b,_,w=0,S=this._textLines[h],x;f+=s*(1-this._fontSizeFraction)/this.lineHeight;for(var T=0,O=S.length-1;T<=O;T++)x=T===O||this.charSpacing,y+=S[T],b=this.__charBounds[h][T],w===0?(c+=b.kernedWidth-b.width,w+=b.width):w+=b.kernedWidth,d&&!x&&this._reSpaceAndTab.test(S[T])&&(x=!0),x||(g=g||this.getCompleteStyleDeclaration(h,T),m=this.getCompleteStyleDeclaration(h,T+1),x=t.util.hasStyleChanged(g,m,!0)),x&&(_=this._getStyleDeclaration(h,T)||{},u.push(this._createTextCharSpan(y,_,c,f)),y="",g=m,c+=w,w=0)},_pushTextBgRect:function(u,h,c,f,s,d){var g=t.Object.NUM_FRACTION_DIGITS;u.push(" `)},_setSVGTextLineBg:function(u,h,c,f){for(var s=this._textLines[h],d=this.getHeightOfLine(h)/this.lineHeight,g=0,m=0,y,b,_=this.getValueOfPropertyAt(h,0,"textBackgroundColor"),w=0,S=s.length;wthis.width&&this._set("width",this.dynamicMinWidth),this.textAlign.indexOf("justify")!==-1&&this.enlargeSpaces(),this.height=this.calcTextHeight(),this.saveState({propertySet:"_dimensionAffectingProps"}))},_generateStyleMap:function(u){for(var h=0,c=0,f=0,s={},d=0;d0?(c=0,f++,h++):!this.splitByGrapheme&&this._reSpaceAndTab.test(u.graphemeText[f])&&d>0&&(c++,f++),s[d]={line:h,offset:c},f+=u.graphemeLines[d].length,c+=u.graphemeLines[d].length;return s},styleHas:function(u,h){if(this._styleMap&&!this.isWrapping){var c=this._styleMap[h];c&&(h=c.line)}return a.Text.prototype.styleHas.call(this,u,h)},isEmptyStyles:function(u){if(!this.styles)return!0;var h=0,c=u+1,f,s,d=!1,g=this._styleMap[u],m=this._styleMap[u+1];g&&(u=g.line,h=g.offset),m&&(c=m.line,d=c===u,f=m.offset),s=typeof u>"u"?this.styles:{line:this.styles[u]};for(var y in s)for(var b in s[y])if(b>=h&&(!d||bc&&!O?(g.push(m),m=[],s=S,O=!0):s+=A,!O&&!d&&m.push(w),m=m.concat(b),x=d?0:this._measureWord([w],h,_),_++,O=!1,S>T&&(T=S);return N&&g.push(m),T+D>this.dynamicMinWidth&&(this.dynamicMinWidth=T-A+D),g},isEndOfWrapping:function(u){return!this._styleMap[u+1]||this._styleMap[u+1].line!==this._styleMap[u].line},missingNewlineOffset:function(u){return this.splitByGrapheme?this.isEndOfWrapping(u)?1:0:1},_splitTextIntoLines:function(u){for(var h=a.Text.prototype._splitTextIntoLines.call(this,u),c=this._wrapText(h.lines,this.width),f=new Array(c.length),s=0;s{const e=()=>({canvas:void 0,brush:void 0,visibleImageLayer:void 0,imageLayer:void 0,visibleDrawLayer:void 0,drawLayer:void 0,cropPreviewLayer:void 0,maskPathColor:"",maskBackgroundColor:"",imageScale:1,undoHistory:[],redoHistory:[],drawing:!1}),t=se({...e(),maskPathColor:"white",maskBackgroundColor:"black"}),n=se({...e(),maskPathColor:"black",maskBackgroundColor:"white"}),r=ee(()=>en().generatorType==="Inpainting"),i=ee(()=>r.value?t.value:n.value),l=ee(()=>en().currentImageProps),v=ee({get:()=>i.value.drawing&&!r.value,set:z=>i.value.drawing=z}),o=se(512),a=se(512),u=se(!1),h=se(30),c=se(!1),f=new Jn.fabric.Circle({radius:h.value,left:0,originX:"center",originY:"center",angle:0,fill:"",stroke:"red",strokeWidth:3,opacity:0}),s=se("Erase"),d=se("rgb(0, 0, 0, 1)");function g(){!i.value.canvas||i.value.canvas.renderAll()}function m(){u.value=!u.value,s.value=u.value?"Draw":"Erase"}function y(z=null){!i.value.canvas||(i.value.brush=i.value.canvas.freeDrawingBrush,i.value.brush.color=z||i.value.brush.color,i.value.brush.width=h.value)}async function b({history:z,erase:M=!1,draw:L=!1}={}){if(!z||!i.value.drawLayer||!i.value.visibleDrawLayer||!i.value.imageLayer||!i.value.visibleImageLayer||!i.value.canvas)return;z.path.selectable=!1,z.path.opacity=1,z.drawPath=await Q(z.path),z.visibleDrawPath=await Q(z.path),M?(z.visibleDrawPath.globalCompositeOperation="destination-out",z.drawPath.stroke=i.value.maskBackgroundColor):(z.visibleDrawPath.globalCompositeOperation="source-over",z.drawPath.stroke=L?d.value:i.value.maskPathColor);let J=await Q(z.drawPath);J=J.scale(i.value.imageScale),J.left=J.left+z.drawPath.left*(i.value.imageScale-1),J.top=J.top+z.drawPath.top*(i.value.imageScale-1),L?(i.value.imageLayer.add(J),i.value.visibleImageLayer.addWithUpdate(z.visibleDrawPath)):(i.value.drawLayer.add(J),i.value.visibleDrawLayer.addWithUpdate(z.visibleDrawPath)),i.value.canvas.remove(z.path),g()}function _(){if(i.value.undoHistory.length===0)return;const z=i.value.undoHistory.pop();b({history:z,erase:!1,draw:v.value}),i.value.redoHistory.push(z)}function w(){if(i.value.redoHistory.length===0||!i.value.drawLayer||!i.value.visibleDrawLayer||!i.value.imageLayer||!i.value.visibleImageLayer||!i.value.canvas)return;const z=i.value.redoHistory.pop();i.value.undoHistory.push(z),v.value?(i.value.imageLayer.remove(z.drawPath),i.value.visibleImageLayer.remove(z.visibleDrawPath)):(i.value.drawLayer.remove(z.drawPath),i.value.visibleDrawLayer.remove(z.visibleDrawPath)),delete z.drawPath,delete z.visibleDrawPath,g()}function S(z){i.value.canvas=new Jn.fabric.Canvas(z,{isDrawingMode:!1,width:o.value,height:a.value,backgroundColor:"white"}),i.value.canvas.selection=!1,i.value.canvas.freeDrawingCursor="crosshair",y(i.value.maskPathColor),i.value.canvas.on("mouse:move",I),i.value.canvas.on("path:created",ue),g()}function x(z,M,L,J){let V=J,P=J;return M>L?(z.scaleToWidth(J),V=J*(a.value/o.value)):(z.scaleToHeight(J),P=J*(o.value/a.value)),{newHeight:V,newWidth:P}}function T(z){const M=en();if(E(),z.selectable=!1,o.value=z.width,a.value=z.height,o.value>M.maxDimensions||a.value>M.maxDimensions){const{newHeight:J,newWidth:V}=x(z,o.value,a.value,M.maxDimensions);o.value=V,a.value=J}if(o.value{o.value>a.value?i.value.imageScale=o.value/L:i.value.imageScale=a.value/L,i.value.imageLayer=R({image:J,layerHeight:J.height,layerWidth:J.width})}),z.cloneAsImage(J=>{if(!i.value.canvas)return;if(o.value!==L||a.value!==L){const{newHeight:q,newWidth:Z}=x(J,o.value,a.value,L);o.value=Z,a.value=q}i.value.canvas.setWidth(o.value),i.value.canvas.setHeight(a.value),i.value.canvas.isDrawingMode=!0,i.value.visibleDrawLayer=B(),i.value.visibleImageLayer=B({image:J}),i.value.drawLayer=R();const V=o.value*i.value.imageScale,P=a.value*i.value.imageScale;M.params.width=V-V%64,M.params.height=P-P%64,i.value.visibleDrawLayer.set("opacity",.8),i.value.canvas.add(i.value.visibleImageLayer),i.value.canvas.add(i.value.visibleDrawLayer),i.value.canvas.add(f),c.value=!0,D(),O()})}function O(){const z=en();if(!i.value.imageLayer||!i.value.drawLayer)return;const M=i.value.imageLayer.getCenter().left-z.params.width/2,L=z.params.width,J=i.value.imageLayer.getCenter().top-z.params.height/2,V=z.params.height,P={format:"jpeg",quality:1,left:M,top:J,width:L,height:V};l.value.sourceImage=i.value.imageLayer.toDataURL(P),l.value.maskImage=i.value.redoHistory.length===0||v.value?void 0:i.value.drawLayer.toDataURL(P).split(",")[1]}let A;function D(){if(!i.value.canvas)return;const z=en();i.value.cropPreviewLayer&&(i.value.canvas.remove(i.value.cropPreviewLayer),i.value.cropPreviewLayer=void 0),c.value&&(i.value.cropPreviewLayer=B({layerWidth:z.params.width/i.value.imageScale,layerHeight:z.params.height/i.value.imageScale,fill:"rgba(100, 0, 0, 0.5)"}),i.value.canvas.centerObject(i.value.cropPreviewLayer),i.value.canvas.add(i.value.cropPreviewLayer),A&&clearTimeout(A),A=setTimeout(()=>{c.value=!1,D(),A=void 0},5e3))}function N(z,M){const L="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+P///38ACfsD/QVDRcoAAAAASUVORK5CYII=";Jn.fabric.Image.fromURL(L,J=>{J.set({height:z,width:M});const V=J.toDataURL({format:"png"});l.value.sourceImage=V,v.value=!0,T(J)})}function R({image:z,layerWidth:M,layerHeight:L}={}){const J=new Jn.fabric.Canvas(null);return J.selection=!1,J.backgroundColor=i.value.maskBackgroundColor,J.setHeight(L||a.value),J.setWidth(M||o.value),z&&J.add(z),J}function B({image:z,layerWidth:M,layerHeight:L,fill:J,abosolute:V}={}){const P=z||new Jn.fabric.Rect({width:M||o.value,height:L||a.value,left:0,top:0,fill:J||"transparent",absolutePositioned:V||!0,selectable:!1});return new Jn.fabric.Group([P],{selectable:!1,absolutePositioned:V||!0})}function E(){!i.value.canvas||(i.value.visibleImageLayer&&(i.value.canvas.remove(i.value.visibleImageLayer),i.value.visibleImageLayer=void 0),i.value.visibleDrawLayer&&(i.value.canvas.remove(i.value.visibleDrawLayer),i.value.visibleDrawLayer=void 0),i.value.imageLayer=void 0,i.value.drawLayer=void 0,i.value.redoHistory=[],i.value.undoHistory=[],i.value.canvas.isDrawingMode=!1)}function U(){if(!!i.value.canvas){if(i.value.visibleDrawLayer&&(i.value.canvas.remove(i.value.visibleDrawLayer),i.value.visibleDrawLayer=void 0),v.value){const z=en();N(z.params.height||512,z.params.width||512)}i.value.drawLayer=void 0,i.value.redoHistory=[],i.value.undoHistory=[],i.value.visibleDrawLayer=B(),i.value.drawLayer=R(),i.value.visibleDrawLayer.set("opacity",.8),i.value.canvas.add(i.value.visibleDrawLayer)}}function ne(){var M;O();const z=document.createElement("a");if(v.value){z.href="data:image/png;base64,"+((M=l.value.sourceImage)==null?void 0:M.split(",")[1]),z.download="image_drawing.png",z.click();return}z.href="data:image/png;base64,"+l.value.maskImage,z.download="image_mask.png",z.click()}async function Q(z){return new Promise((M,L)=>{try{z.clone(M)}catch(J){L(J)}})}async function ue(z){const M={path:z.path};b({history:M,erase:u.value,draw:v.value}),i.value.redoHistory.push(M)}function I(z){if(!i.value.canvas)return;const M=i.value.canvas.getPointer(z.e);f.left=M.x,f.top=M.y,f.opacity=.8,u.value?(f.set("strokeWidth",3),f.set("fill",""),y("red")):(f.set("strokeWidth",0),v.value?(f.set("fill",d.value),y(d.value)):(f.set("fill","white"),y("white"))),f.set("radius",h.value/2),g()}return{showCropPreview:c,erasing:u,switchToolText:s,brushSize:h,drawColor:d,drawing:v,imageProps:i,updateCropPreview:D,createNewCanvas:S,downloadMask:ne,resetCanvas:E,resetDrawing:U,flipErase:m,undoAction:w,redoAction:_,newImage:T,newBlankImage:N,setBrush:y,saveImages:O}});const DH={},$H={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 20 20"},BH=re("g",{fill:"none"},[re("path",{d:"M11.197 2.44a1.5 1.5 0 0 1 2.121 0l4.243 4.242a1.5 1.5 0 0 1 0 2.121L9.364 17H14.5a.5.5 0 0 1 0 1H7.82a1.496 1.496 0 0 1-1.14-.437L2.437 13.32a1.5 1.5 0 0 1 0-2.121l8.76-8.76zm1.414.706a.5.5 0 0 0-.707 0L5.538 9.512l4.95 4.95l6.366-6.366a.5.5 0 0 0 0-.707L12.61 3.146zM9.781 15.17l-4.95-4.95l-1.687 1.687a.5.5 0 0 0 0 .707l4.243 4.243a.5.5 0 0 0 .707 0l1.687-1.687z",fill:"currentColor"})],-1),FH=[BH];function zH(e,t){return j(),ce("svg",$H,FH)}const NH=Yt(DH,[["render",zH]]);async function jH(e,t){const n=document.createElement("canvas"),r=n.getContext("2d"),i=new Image;return i.src=e,await new Promise(v=>i.onload=v),n.width=i.width,n.height=i.height,r==null||r.drawImage(i,0,0),n.toDataURL(t)}async function VH(e,t){const n=e.split(";base64,"),r=t!=null?t:n[0].split(":")[1],i=window.atob(r===n[0].split(":")[1]?n[1]:(await jH(e,r)).split(",")[1]),l=new Uint8Array(i.length);for(let v=0;v{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=i=>n(i),r.readAsDataURL(e)})}const em=e=>(Jr("data-v-d200c279"),e=e(),Qr(),e),UH=em(()=>re("div",null,[Ne("Drop file here OR "),re("em",null,"click to upload")],-1)),HH={key:0},WH=em(()=>re("div",{class:"center-horizontal",style:{"margin-top":"5px"}},"OR",-1)),YH={class:"canvas-container"},XH=em(()=>re("canvas",{id:"canvas"},null,-1)),KH={class:"action-buttons",style:{left:"10px",right:"unset"}},GH={class:"action-buttons"},qH=Ee({__name:"CustomCanvas",setup(e){const t=en(),n=$t(),r=ys(),i=se();async function l(o){if(!o.raw.type.includes("image")){n.raiseError("Uploaded file needs to be a image!",!1),i.value.clearFiles();return}const a=await l2(o.raw);t.currentImageProps.sourceImage=a,r.drawing=!1,Jn.fabric.Image.fromURL(a,r.newImage)}function v(){t.currentImageProps.sourceImage="",r.resetCanvas()}return qe(()=>{r.createNewCanvas("canvas"),t.currentImageProps.sourceImage&&Jn.fabric.Image.fromURL(t.currentImageProps.sourceImage,r.newImage)}),(o,a)=>(j(),ce(ze,null,[C(t).currentImageProps.sourceImage?_e("",!0):(j(),we(C(Pp),{key:0,drag:"",ref_key:"upload",ref:i,"auto-upload":!1,onChange:l,limit:1,multiple:""},{tip:pe(()=>[C(t).generatorType==="Img2Img"?(j(),ce("div",HH,[WH,re("div",{class:"center-both",style:{cursor:"pointer","text-decoration":"underline","font-size":"1rem"},onClick:a[0]||(a[0]=u=>C(r).newBlankImage(C(t).params.height||512,C(t).params.width||512))},[le(C(De),{size:20,style:{"margin-right":"2px"}},{default:pe(()=>[le(a2)]),_:1}),Ne("draw something")])])):_e("",!0)]),default:pe(()=>[le(C(De),{size:100},{default:pe(()=>[le(C(Kh))]),_:1}),UH]),_:1},512)),gt(re("div",null,[re("div",YH,[XH,re("div",KH,[le(C(lt),{onClick:a[1]||(a[1]=u=>C(r).undoAction()),icon:C(e_),plain:"",disabled:C(r).imageProps.redoHistory.length===0},null,8,["icon","disabled"]),le(C(lt),{onClick:a[2]||(a[2]=u=>C(r).redoAction()),icon:C(t_),plain:"",disabled:C(r).imageProps.undoHistory.length===0},null,8,["icon","disabled"])]),re("div",GH,[le(C(lt),{onClick:a[3]||(a[3]=u=>C(r).resetDrawing()),icon:C(wr),plain:""},null,8,["icon"]),le(C(lt),{onClick:v,icon:C(Ec),plain:""},null,8,["icon"]),le(C(lt),{onClick:a[4]||(a[4]=u=>C(r).downloadMask()),icon:C(Ls),plain:""},null,8,["icon"]),le(C(lt),{onClick:a[5]||(a[5]=u=>C(r).flipErase()),icon:C(r).erasing?C(DE):NH,plain:""},null,8,["icon"]),C(r).drawing?(j(),we(C(mB),{key:0,modelValue:C(r).drawColor,"onUpdate:modelValue":a[6]||(a[6]=u=>C(r).drawColor=u),"show-alpha":""},null,8,["modelValue"])):_e("",!0)]),le(C(xp),{"label-width":"110px",style:{"margin-top":"10px"}},{default:pe(()=>[le(En,{style:{"margin-bottom":"5px"},label:"Brush Size",prop:"brushSize",modelValue:C(r).brushSize,"onUpdate:modelValue":a[7]||(a[7]=u=>C(r).brushSize=u),min:10,max:100,step:10,change:C(r).setBrush},null,8,["modelValue","change"])]),_:1})])],512),[[Rt,C(t).currentImageProps.sourceImage]])],64))}});const I0=Yt(qH,[["__scopeId","data-v-d200c279"]]),ZH={class:"centerIcons"},JH={class:"stackedIcons"},QH=Ee({__name:"StackedIcon",props:{iconOne:null,iconTwo:null,size:null},setup(e){const t=e;return dx(n=>({"2ad037ca":e.size+"px"})),(n,r)=>(j(),ce("div",ZH,[re("div",JH,[le(C(De),{class:"firstIcon",size:e.size},{default:pe(()=>[(j(),we(_t(t.iconOne)))]),_:1},8,["size"]),le(C(De),{class:"secondIcon",size:e.size},{default:pe(()=>[(j(),we(_t(t.iconTwo)))]),_:1},8,["size"])])]))}});const eW=Yt(QH,[["__scopeId","data-v-74586a39"]]),tW={key:1,style:{width:"40px"}},nu=Ee({__name:"GeneratorMenuItem",props:{index:null,iconOne:null,iconTwo:null,isMobile:{type:Boolean}},setup(e){const t=e;return(n,r)=>(j(),we(C(kr),{content:e.index,placement:e.isMobile?"bottom":"right",enterable:!1,"hide-after":100},{default:pe(()=>[le(C(Ep),{index:e.index,style:{height:"60px",display:"flex","justify-content":"center"}},{default:pe(()=>[e.iconTwo?(j(),we(eW,{key:0,iconOne:e.iconOne,iconTwo:e.iconTwo,size:40},null,8,["iconOne","iconTwo"])):(j(),ce("div",tW,[le(C(De),{style:{width:"35px"},size:40},{default:pe(()=>[(j(),we(_t(t.iconOne)))]),_:1})]))]),_:1},8,["index"])]),_:1},8,["content","placement"]))}});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const nW=4,M0=0,L0=1,rW=2;function Lo(e){let t=e.length;for(;--t>=0;)e[t]=0}const iW=0,u2=1,aW=2,oW=3,sW=258,tm=29,Tl=256,el=Tl+1+tm,ro=30,nm=19,c2=2*el+1,oa=15,Lf=16,lW=7,rm=256,f2=16,d2=17,h2=18,lh=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Pu=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),uW=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),p2=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),cW=512,Fr=new Array((el+2)*2);Lo(Fr);const bs=new Array(ro*2);Lo(bs);const tl=new Array(cW);Lo(tl);const nl=new Array(sW-oW+1);Lo(nl);const im=new Array(tm);Lo(im);const sc=new Array(ro);Lo(sc);function Rf(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let m2,g2,v2;function Df(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const y2=e=>e<256?tl[e]:tl[256+(e>>>7)],rl=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},yn=(e,t,n)=>{e.bi_valid>Lf-n?(e.bi_buf|=t<>Lf-e.bi_valid,e.bi_valid+=n-Lf):(e.bi_buf|=t<{yn(e,n[t*2],n[t*2+1])},b2=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},fW=e=>{e.bi_valid===16?(rl(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},dW=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,l=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,a=t.stat_desc.max_length;let u,h,c,f,s,d,g=0;for(f=0;f<=oa;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;ua&&(f=a,g++),n[h*2+1]=f,!(h>r)&&(e.bl_count[f]++,s=0,h>=o&&(s=v[h-o]),d=n[h*2],e.opt_len+=d*(f+s),l&&(e.static_len+=d*(i[h*2+1]+s)));if(g!==0){do{for(f=a-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[a]--,g-=2}while(g>0);for(f=a;f!==0;f--)for(h=e.bl_count[f];h!==0;)c=e.heap[--u],!(c>r)&&(n[c*2+1]!==f&&(e.opt_len+=(f-n[c*2+1])*n[c*2],n[c*2+1]=f),h--)}},_2=(e,t,n)=>{const r=new Array(oa+1);let i=0,l,v;for(l=1;l<=oa;l++)i=i+n[l-1]<<1,r[l]=i;for(v=0;v<=t;v++){let o=e[v*2+1];o!==0&&(e[v*2]=b2(r[o]++,o))}},hW=()=>{let e,t,n,r,i;const l=new Array(oa+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?rl(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},R0=(e,t,n,r)=>{const i=t*2,l=n*2;return e[i]{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i{let r,i,l=0,v,o;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+l++]&255,r+=(e.pending_buf[e.sym_buf+l++]&255)<<8,i=e.pending_buf[e.sym_buf+l++],r===0?mr(e,i,t):(v=nl[i],mr(e,v+Tl+1,t),o=lh[v],o!==0&&(i-=im[v],yn(e,i,o)),r--,v=y2(r),mr(e,v,n),o=Pu[v],o!==0&&(r-=sc[v],yn(e,r,o)));while(l{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,l=t.stat_desc.elems;let v,o,a=-1,u;for(e.heap_len=0,e.heap_max=c2,v=0;v>1;v>=1;v--)$f(e,n,v);u=l;do v=e.heap[1],e.heap[1]=e.heap[e.heap_len--],$f(e,n,1),o=e.heap[1],e.heap[--e.heap_max]=v,e.heap[--e.heap_max]=o,n[u*2]=n[v*2]+n[o*2],e.depth[u]=(e.depth[v]>=e.depth[o]?e.depth[v]:e.depth[o])+1,n[v*2+1]=n[o*2+1]=u,e.heap[1]=u++,$f(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],dW(e,t),_2(n,a,e.bl_count)},$0=(e,t,n)=>{let r,i=-1,l,v=t[0*2+1],o=0,a=7,u=4;for(v===0&&(a=138,u=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)l=v,v=t[(r+1)*2+1],!(++o{let r,i=-1,l,v=t[0*2+1],o=0,a=7,u=4;for(v===0&&(a=138,u=3),r=0;r<=n;r++)if(l=v,v=t[(r+1)*2+1],!(++o{let t;for($0(e,e.dyn_ltree,e.l_desc.max_code),$0(e,e.dyn_dtree,e.d_desc.max_code),uh(e,e.bl_desc),t=nm-1;t>=3&&e.bl_tree[p2[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},mW=(e,t,n,r)=>{let i;for(yn(e,t-257,5),yn(e,n-1,5),yn(e,r-4,4),i=0;i{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return M0;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return L0;for(n=32;n{F0||(hW(),F0=!0),e.l_desc=new Df(e.dyn_ltree,m2),e.d_desc=new Df(e.dyn_dtree,g2),e.bl_desc=new Df(e.bl_tree,v2),e.bi_buf=0,e.bi_valid=0,w2(e)},S2=(e,t,n,r)=>{yn(e,(iW<<1)+(r?1:0),3),C2(e),rl(e,n),rl(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},yW=e=>{yn(e,u2<<1,3),mr(e,rm,Fr),fW(e)},bW=(e,t,n,r)=>{let i,l,v=0;e.level>0?(e.strm.data_type===rW&&(e.strm.data_type=gW(e)),uh(e,e.l_desc),uh(e,e.d_desc),v=pW(e),i=e.opt_len+3+7>>>3,l=e.static_len+3+7>>>3,l<=i&&(i=l)):i=l=n+5,n+4<=i&&t!==-1?S2(e,t,n,r):e.strategy===nW||l===i?(yn(e,(u2<<1)+(r?1:0),3),D0(e,Fr,bs)):(yn(e,(aW<<1)+(r?1:0),3),mW(e,e.l_desc.max_code+1,e.d_desc.max_code+1,v+1),D0(e,e.dyn_ltree,e.dyn_dtree)),w2(e),r&&C2(e)},_W=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(nl[n]+Tl+1)*2]++,e.dyn_dtree[y2(t)*2]++),e.sym_next===e.sym_end);var wW=vW,CW=S2,SW=bW,xW=_W,TW=yW,kW={_tr_init:wW,_tr_stored_block:CW,_tr_flush_block:SW,_tr_tally:xW,_tr_align:TW};const EW=(e,t,n,r)=>{let i=e&65535|0,l=e>>>16&65535|0,v=0;for(;n!==0;){v=n>2e3?2e3:n,n-=v;do i=i+t[r++]|0,l=l+i|0;while(--v);i%=65521,l%=65521}return i|l<<16|0};var il=EW;const OW=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},AW=new Uint32Array(OW()),PW=(e,t,n,r)=>{const i=AW,l=r+n;e^=-1;for(let v=r;v>>8^i[(e^t[v])&255];return e^-1};var Vt=PW,Ca={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Ro={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:IW,_tr_stored_block:ch,_tr_flush_block:MW,_tr_tally:Ti,_tr_align:LW}=kW,{Z_NO_FLUSH:ki,Z_PARTIAL_FLUSH:RW,Z_FULL_FLUSH:DW,Z_FINISH:jn,Z_BLOCK:z0,Z_OK:Kt,Z_STREAM_END:N0,Z_STREAM_ERROR:br,Z_DATA_ERROR:$W,Z_BUF_ERROR:Bf,Z_DEFAULT_COMPRESSION:BW,Z_FILTERED:FW,Z_HUFFMAN_ONLY:ru,Z_RLE:zW,Z_FIXED:NW,Z_DEFAULT_STRATEGY:jW,Z_UNKNOWN:VW,Z_DEFLATED:Uc}=Ro,UW=9,HW=15,WW=8,YW=29,XW=256,fh=XW+1+YW,KW=30,GW=19,qW=2*fh+1,ZW=15,nt=3,wi=258,_r=wi+nt+1,JW=32,bo=42,am=57,dh=69,hh=73,ph=91,mh=103,sa=113,es=666,dn=1,Do=2,Sa=3,$o=4,QW=3,la=(e,t)=>(e.msg=Ca[t],t),j0=e=>e*2-(e>4?9:0),yi=e=>{let t=e.length;for(;--t>=0;)e[t]=0},eY=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)};let tY=(e,t,n)=>(t<{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},Ln=(e,t)=>{MW(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,On(e.strm)},dt=(e,t)=>{e.pending_buf[e.pending++]=t},Xo=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},gh=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=il(e.adler,t,i,n):e.state.wrap===2&&(e.adler=Vt(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},x2=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,l,v=e.prev_length,o=e.nice_match;const a=e.strstart>e.w_size-_r?e.strstart-(e.w_size-_r):0,u=e.window,h=e.w_mask,c=e.prev,f=e.strstart+wi;let s=u[r+v-1],d=u[r+v];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do if(i=t,!(u[i+v]!==d||u[i+v-1]!==s||u[i]!==u[r]||u[++i]!==u[r+1])){r+=2,i++;do;while(u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&rv){if(e.match_start=t,v=l,l>=o)break;s=u[r+v-1],d=u[r+v]}}while((t=c[t&h])>a&&--n!==0);return v<=e.lookahead?v:e.lookahead},_o=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-_r)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),eY(e),r+=t),e.strm.avail_in===0)break;if(n=gh(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=nt)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Ei(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Ei(e,e.ins_h,e.window[i+nt-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,l,v=0,o=e.strm.avail_in;do{if(r=65535,l=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>l&&(r=l),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,On(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(gh(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(v===0);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_waterl&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,l+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),l>e.strm.avail_in&&(l=e.strm.avail_in),l&&(gh(e.strm,e.window,e.strstart,l),e.strstart+=l,e.insert+=l>e.w_size-e.insert?e.w_size-e.insert:l),e.high_water>3,l=e.pending_buf_size-l>65535?65535:e.pending_buf_size-l,n=l>e.w_size?e.w_size:l,i=e.strstart-e.block_start,(i>=n||(i||t===jn)&&t!==ki&&e.strm.avail_in===0&&i<=l)&&(r=i>l?l:i,v=t===jn&&e.strm.avail_in===0&&r===i?1:0,ch(e,e.block_start,r,v),e.block_start+=r,On(e.strm)),v?Sa:dn)},Ff=(e,t)=>{let n,r;for(;;){if(e.lookahead<_r){if(_o(e),e.lookahead<_r&&t===ki)return dn;if(e.lookahead===0)break}if(n=0,e.lookahead>=nt&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+nt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-_r&&(e.match_length=x2(e,n)),e.match_length>=nt)if(r=Ti(e,e.strstart-e.match_start,e.match_length-nt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=nt){e.match_length--;do e.strstart++,e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+nt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+1]);else r=Ti(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Ln(e,!1),e.strm.avail_out===0))return dn}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead<_r){if(_o(e),e.lookahead<_r&&t===ki)return dn;if(e.lookahead===0)break}if(n=0,e.lookahead>=nt&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+nt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=nt-1,n!==0&&e.prev_length4096)&&(e.match_length=nt-1)),e.prev_length>=nt&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-nt,r=Ti(e,e.strstart-1-e.prev_match,e.prev_length-nt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+nt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=nt-1,e.strstart++,r&&(Ln(e,!1),e.strm.avail_out===0))return dn}else if(e.match_available){if(r=Ti(e,0,e.window[e.strstart-1]),r&&Ln(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return dn}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Ti(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let n,r,i,l;const v=e.window;for(;;){if(e.lookahead<=wi){if(_o(e),e.lookahead<=wi&&t===ki)return dn;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=nt&&e.strstart>0&&(i=e.strstart-1,r=v[i],r===v[++i]&&r===v[++i]&&r===v[++i])){l=e.strstart+wi;do;while(r===v[++i]&&r===v[++i]&&r===v[++i]&&r===v[++i]&&r===v[++i]&&r===v[++i]&&r===v[++i]&&r===v[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=nt?(n=Ti(e,1,e.match_length-nt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Ti(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Ln(e,!1),e.strm.avail_out===0))return dn}return e.insert=0,t===jn?(Ln(e,!0),e.strm.avail_out===0?Sa:$o):e.sym_next&&(Ln(e,!1),e.strm.avail_out===0)?dn:Do},rY=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(_o(e),e.lookahead===0)){if(t===ki)return dn;break}if(e.match_length=0,n=Ti(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Ln(e,!1),e.strm.avail_out===0))return dn}return e.insert=0,t===jn?(Ln(e,!0),e.strm.avail_out===0?Sa:$o):e.sym_next&&(Ln(e,!1),e.strm.avail_out===0)?dn:Do};function fr(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const ts=[new fr(0,0,0,0,T2),new fr(4,4,8,4,Ff),new fr(4,5,16,8,Ff),new fr(4,6,32,32,Ff),new fr(4,4,16,16,Ua),new fr(8,16,32,32,Ua),new fr(8,16,128,128,Ua),new fr(8,32,128,256,Ua),new fr(32,128,258,1024,Ua),new fr(32,258,258,4096,Ua)],iY=e=>{e.window_size=2*e.w_size,yi(e.head),e.max_lazy_match=ts[e.level].max_lazy,e.good_match=ts[e.level].good_length,e.nice_match=ts[e.level].nice_length,e.max_chain_length=ts[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=nt-1,e.match_available=0,e.ins_h=0};function aY(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Uc,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(qW*2),this.dyn_dtree=new Uint16Array((2*KW+1)*2),this.bl_tree=new Uint16Array((2*GW+1)*2),yi(this.dyn_ltree),yi(this.dyn_dtree),yi(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(ZW+1),this.heap=new Uint16Array(2*fh+1),yi(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*fh+1),yi(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const kl=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==bo&&t.status!==am&&t.status!==dh&&t.status!==hh&&t.status!==ph&&t.status!==mh&&t.status!==sa&&t.status!==es?1:0},k2=e=>{if(kl(e))return la(e,br);e.total_in=e.total_out=0,e.data_type=VW;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?am:t.wrap?bo:sa,e.adler=t.wrap===2?0:1,t.last_flush=-2,IW(t),Kt},E2=e=>{const t=k2(e);return t===Kt&&iY(e.state),t},oY=(e,t)=>kl(e)||e.state.wrap!==2?br:(e.state.gzhead=t,Kt),O2=(e,t,n,r,i,l)=>{if(!e)return br;let v=1;if(t===BW&&(t=6),r<0?(v=0,r=-r):r>15&&(v=2,r-=16),i<1||i>UW||n!==Uc||r<8||r>15||t<0||t>9||l<0||l>NW||r===8&&v!==1)return la(e,br);r===8&&(r=9);const o=new aY;return e.state=o,o.strm=e,o.status=bo,o.wrap=v,o.gzhead=null,o.w_bits=r,o.w_size=1<O2(e,t,Uc,HW,WW,jW),lY=(e,t)=>{if(kl(e)||t>z0||t<0)return e?la(e,br):br;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===es&&t!==jn)return la(e,e.avail_out===0?Bf:br);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(On(e),e.avail_out===0)return n.last_flush=-1,Kt}else if(e.avail_in===0&&j0(t)<=j0(r)&&t!==jn)return la(e,Bf);if(n.status===es&&e.avail_in!==0)return la(e,Bf);if(n.status===bo&&n.wrap===0&&(n.status=sa),n.status===bo){let i=Uc+(n.w_bits-8<<4)<<8,l=-1;if(n.strategy>=ru||n.level<2?l=0:n.level<6?l=1:n.level===6?l=2:l=3,i|=l<<6,n.strstart!==0&&(i|=JW),i+=31-i%31,Xo(n,i),n.strstart!==0&&(Xo(n,e.adler>>>16),Xo(n,e.adler&65535)),e.adler=1,n.status=sa,On(e),n.pending!==0)return n.last_flush=-1,Kt}if(n.status===am){if(e.adler=0,dt(n,31),dt(n,139),dt(n,8),n.gzhead)dt(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),dt(n,n.gzhead.time&255),dt(n,n.gzhead.time>>8&255),dt(n,n.gzhead.time>>16&255),dt(n,n.gzhead.time>>24&255),dt(n,n.level===9?2:n.strategy>=ru||n.level<2?4:0),dt(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(dt(n,n.gzhead.extra.length&255),dt(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Vt(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=dh;else if(dt(n,0),dt(n,0),dt(n,0),dt(n,0),dt(n,0),dt(n,n.level===9?2:n.strategy>=ru||n.level<2?4:0),dt(n,QW),n.status=sa,On(e),n.pending!==0)return n.last_flush=-1,Kt}if(n.status===dh){if(n.gzhead.extra){let i=n.pending,l=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+l>n.pending_buf_size;){let o=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+o),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=o,On(e),n.pending!==0)return n.last_flush=-1,Kt;i=0,l-=o}let v=new Uint8Array(n.gzhead.extra);n.pending_buf.set(v.subarray(n.gzindex,n.gzindex+l),n.pending),n.pending+=l,n.gzhead.hcrc&&n.pending>i&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=hh}if(n.status===hh){if(n.gzhead.name){let i=n.pending,l;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),On(e),n.pending!==0)return n.last_flush=-1,Kt;i=0}n.gzindexi&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=ph}if(n.status===ph){if(n.gzhead.comment){let i=n.pending,l;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),On(e),n.pending!==0)return n.last_flush=-1,Kt;i=0}n.gzindexi&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i))}n.status=mh}if(n.status===mh){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(On(e),n.pending!==0))return n.last_flush=-1,Kt;dt(n,e.adler&255),dt(n,e.adler>>8&255),e.adler=0}if(n.status=sa,On(e),n.pending!==0)return n.last_flush=-1,Kt}if(e.avail_in!==0||n.lookahead!==0||t!==ki&&n.status!==es){let i=n.level===0?T2(n,t):n.strategy===ru?rY(n,t):n.strategy===zW?nY(n,t):ts[n.level].func(n,t);if((i===Sa||i===$o)&&(n.status=es),i===dn||i===Sa)return e.avail_out===0&&(n.last_flush=-1),Kt;if(i===Do&&(t===RW?LW(n):t!==z0&&(ch(n,0,0,!1),t===DW&&(yi(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),On(e),e.avail_out===0))return n.last_flush=-1,Kt}return t!==jn?Kt:n.wrap<=0?N0:(n.wrap===2?(dt(n,e.adler&255),dt(n,e.adler>>8&255),dt(n,e.adler>>16&255),dt(n,e.adler>>24&255),dt(n,e.total_in&255),dt(n,e.total_in>>8&255),dt(n,e.total_in>>16&255),dt(n,e.total_in>>24&255)):(Xo(n,e.adler>>>16),Xo(n,e.adler&65535)),On(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Kt:N0)},uY=e=>{if(kl(e))return br;const t=e.state.status;return e.state=null,t===sa?la(e,$W):Kt},cY=(e,t)=>{let n=t.length;if(kl(e))return br;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==bo||r.lookahead)return br;if(i===1&&(e.adler=il(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(yi(r.head),r.strstart=0,r.block_start=0,r.insert=0);let a=new Uint8Array(r.w_size);a.set(t.subarray(n-r.w_size,n),0),t=a,n=r.w_size}const l=e.avail_in,v=e.next_in,o=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,_o(r);r.lookahead>=nt;){let a=r.strstart,u=r.lookahead-(nt-1);do r.ins_h=Ei(r,r.ins_h,r.window[a+nt-1]),r.prev[a&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=a,a++;while(--u);r.strstart=a,r.lookahead=nt-1,_o(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=nt-1,r.match_available=0,e.next_in=v,e.input=o,e.avail_in=l,r.wrap=i,Kt};var fY=sY,dY=O2,hY=E2,pY=k2,mY=oY,gY=lY,vY=uY,yY=cY,bY="pako deflate (from Nodeca project)",_s={deflateInit:fY,deflateInit2:dY,deflateReset:hY,deflateResetKeep:pY,deflateSetHeader:mY,deflate:gY,deflateEnd:vY,deflateSetDictionary:yY,deflateInfo:bY};const _Y=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var wY=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(!!n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)_Y(n,r)&&(e[r]=n[r])}}return e},CY=e=>{let t=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;al[254]=al[254]=1;var SY=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,l,v=e.length,o=0;for(i=0;i>>6,t[l++]=128|n&63):n<65536?(t[l++]=224|n>>>12,t[l++]=128|n>>>6&63,t[l++]=128|n&63):(t[l++]=240|n>>>18,t[l++]=128|n>>>12&63,t[l++]=128|n>>>6&63,t[l++]=128|n&63);return t};const xY=(e,t)=>{if(t<65534&&e.subarray&&A2)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const l=new Array(n*2);for(i=0,r=0;r4){l[i++]=65533,r+=o-1;continue}for(v&=o===2?31:o===3?15:7;o>1&&r1){l[i++]=65533;continue}v<65536?l[i++]=v:(v-=65536,l[i++]=55296|v>>10&1023,l[i++]=56320|v&1023)}return xY(l,i)},kY=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+al[e[n]]>t?n:t},ol={string2buf:SY,buf2string:TY,utf8border:kY};function EY(){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}var P2=EY;const I2=Object.prototype.toString,{Z_NO_FLUSH:OY,Z_SYNC_FLUSH:AY,Z_FULL_FLUSH:PY,Z_FINISH:IY,Z_OK:lc,Z_STREAM_END:MY,Z_DEFAULT_COMPRESSION:LY,Z_DEFAULT_STRATEGY:RY,Z_DEFLATED:DY}=Ro;function El(e){this.options=Hc.assign({level:LY,method:DY,chunkSize:16384,windowBits:15,memLevel:8,strategy:RY},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new P2,this.strm.avail_out=0;let n=_s.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==lc)throw new Error(Ca[n]);if(t.header&&_s.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=ol.string2buf(t.dictionary):I2.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=_s.deflateSetDictionary(this.strm,r),n!==lc)throw new Error(Ca[n]);this._dict_set=!0}}El.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,l;if(this.ended)return!1;for(t===~~t?l=t:l=t===!0?IY:OY,typeof e=="string"?n.input=ol.string2buf(e):I2.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(l===AY||l===PY)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=_s.deflate(n,l),i===MY)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=_s.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===lc;if(n.avail_out===0){this.onData(n.output);continue}if(l>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};El.prototype.onData=function(e){this.chunks.push(e)};El.prototype.onEnd=function(e){e===lc&&(this.result=Hc.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function om(e,t){const n=new El(t);if(n.push(e,!0),n.err)throw n.msg||Ca[n.err];return n.result}function $Y(e,t){return t=t||{},t.raw=!0,om(e,t)}function BY(e,t){return t=t||{},t.gzip=!0,om(e,t)}var FY=El,zY=om,NY=$Y,jY=BY,VY=Ro,UY={Deflate:FY,deflate:zY,deflateRaw:NY,gzip:jY,constants:VY};const iu=16209,HY=16191;var WY=function(t,n){let r,i,l,v,o,a,u,h,c,f,s,d,g,m,y,b,_,w,S,x,T,O,A,D;const N=t.state;r=t.next_in,A=t.input,i=r+(t.avail_in-5),l=t.next_out,D=t.output,v=l-(n-t.avail_out),o=l+(t.avail_out-257),a=N.dmax,u=N.wsize,h=N.whave,c=N.wnext,f=N.window,s=N.hold,d=N.bits,g=N.lencode,m=N.distcode,y=(1<>>24,s>>>=w,d-=w,w=_>>>16&255,w===0)D[l++]=_&65535;else if(w&16){S=_&65535,w&=15,w&&(d>>=w,d-=w),d<15&&(s+=A[r++]<>>24,s>>>=w,d-=w,w=_>>>16&255,w&16){if(x=_&65535,w&=15,da){t.msg="invalid distance too far back",N.mode=iu;break e}if(s>>>=w,d-=w,w=l-v,x>w){if(w=x-w,w>h&&N.sane){t.msg="invalid distance too far back",N.mode=iu;break e}if(T=0,O=f,c===0){if(T+=u-w,w2;)D[l++]=O[T++],D[l++]=O[T++],D[l++]=O[T++],S-=3;S&&(D[l++]=O[T++],S>1&&(D[l++]=O[T++]))}else{T=l-x;do D[l++]=D[T++],D[l++]=D[T++],D[l++]=D[T++],S-=3;while(S>2);S&&(D[l++]=D[T++],S>1&&(D[l++]=D[T++]))}}else if((w&64)===0){_=m[(_&65535)+(s&(1<>3,r-=S,d-=S<<3,s&=(1<{const a=o.bits;let u=0,h=0,c=0,f=0,s=0,d=0,g=0,m=0,y=0,b=0,_,w,S,x,T,O=null,A;const D=new Uint16Array(Ha+1),N=new Uint16Array(Ha+1);let R=null,B,E,U;for(u=0;u<=Ha;u++)D[u]=0;for(h=0;h=1&&D[f]===0;f--);if(s>f&&(s=f),f===0)return i[l++]=1<<24|64<<16|0,i[l++]=1<<24|64<<16|0,o.bits=1,0;for(c=1;c0&&(e===H0||f!==1))return-1;for(N[1]=0,u=1;uV0||e===W0&&y>U0)return 1;for(;;){B=u-g,v[h]+1=A?(E=R[v[h]-A],U=O[v[h]-A]):(E=32+64,U=0),_=1<>g)+w]=B<<24|E<<16|U|0;while(w!==0);for(_=1<>=1;if(_!==0?(b&=_-1,b+=_):b=0,h++,--D[u]===0){if(u===f)break;u=t[n+v[h]]}if(u>s&&(b&x)!==S){for(g===0&&(g=s),T+=c,d=u-g,m=1<V0||e===W0&&y>U0)return 1;S=b&x,i[S]=s<<24|d<<16|T-l|0}}return b!==0&&(i[T+b]=u-g<<24|64<<16|0),o.bits=s,0};var ws=qY;const ZY=0,M2=1,L2=2,{Z_FINISH:Y0,Z_BLOCK:JY,Z_TREES:au,Z_OK:xa,Z_STREAM_END:QY,Z_NEED_DICT:eX,Z_STREAM_ERROR:Xn,Z_DATA_ERROR:R2,Z_MEM_ERROR:D2,Z_BUF_ERROR:tX,Z_DEFLATED:X0}=Ro,Wc=16180,K0=16181,G0=16182,q0=16183,Z0=16184,J0=16185,Q0=16186,ey=16187,ty=16188,ny=16189,uc=16190,Mr=16191,Nf=16192,ry=16193,jf=16194,iy=16195,ay=16196,oy=16197,sy=16198,ou=16199,su=16200,ly=16201,uy=16202,cy=16203,fy=16204,dy=16205,Vf=16206,hy=16207,py=16208,It=16209,$2=16210,B2=16211,nX=852,rX=592,iX=15,aX=iX,my=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function oX(){this.strm=null,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 Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Da=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.modeB2?1:0},F2=e=>{if(Da(e))return Xn;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Wc,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(nX),t.distcode=t.distdyn=new Int32Array(rX),t.sane=1,t.back=-1,xa},z2=e=>{if(Da(e))return Xn;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,F2(e)},N2=(e,t)=>{let n;if(Da(e))return Xn;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Xn:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,z2(e))},j2=(e,t)=>{if(!e)return Xn;const n=new oX;e.state=n,n.strm=e,n.window=null,n.mode=Wc;const r=N2(e,t);return r!==xa&&(e.state=null),r},sX=e=>j2(e,aX);let gy=!0,Uf,Hf;const lX=e=>{if(gy){Uf=new Int32Array(512),Hf=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(ws(M2,e.lens,0,288,Uf,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;ws(L2,e.lens,0,32,Hf,0,e.work,{bits:5}),gy=!1}e.lencode=Uf,e.lenbits=9,e.distcode=Hf,e.distbits=5},V2=(e,t,n,r)=>{let i;const l=e.state;return l.window===null&&(l.wsize=1<=l.wsize?(l.window.set(t.subarray(n-l.wsize,n),0),l.wnext=0,l.whave=l.wsize):(i=l.wsize-l.wnext,i>r&&(i=r),l.window.set(t.subarray(n-r,n-r+i),l.wnext),r-=i,r?(l.window.set(t.subarray(n-r,n),0),l.wnext=r,l.whave=l.wsize):(l.wnext+=i,l.wnext===l.wsize&&(l.wnext=0),l.whave{let n,r,i,l,v,o,a,u,h,c,f,s,d,g,m=0,y,b,_,w,S,x,T,O;const A=new Uint8Array(4);let D,N;const R=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Da(e)||!e.output||!e.input&&e.avail_in!==0)return Xn;n=e.state,n.mode===Mr&&(n.mode=Nf),v=e.next_out,i=e.output,a=e.avail_out,l=e.next_in,r=e.input,o=e.avail_in,u=n.hold,h=n.bits,c=o,f=a,O=xa;e:for(;;)switch(n.mode){case Wc:if(n.wrap===0){n.mode=Nf;break}for(;h<16;){if(o===0)break e;o--,u+=r[l++]<>>8&255,n.check=Vt(n.check,A,2,0),u=0,h=0,n.mode=K0;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=It;break}if((u&15)!==X0){e.msg="unknown compression method",n.mode=It;break}if(u>>>=4,h-=4,T=(u&15)+8,n.wbits===0&&(n.wbits=T),T>15||T>n.wbits){e.msg="invalid window size",n.mode=It;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(A[0]=u&255,A[1]=u>>>8&255,n.check=Vt(n.check,A,2,0)),u=0,h=0,n.mode=G0;case G0:for(;h<32;){if(o===0)break e;o--,u+=r[l++]<>>8&255,A[2]=u>>>16&255,A[3]=u>>>24&255,n.check=Vt(n.check,A,4,0)),u=0,h=0,n.mode=q0;case q0:for(;h<16;){if(o===0)break e;o--,u+=r[l++]<>8),n.flags&512&&n.wrap&4&&(A[0]=u&255,A[1]=u>>>8&255,n.check=Vt(n.check,A,2,0)),u=0,h=0,n.mode=Z0;case Z0:if(n.flags&1024){for(;h<16;){if(o===0)break e;o--,u+=r[l++]<>>8&255,n.check=Vt(n.check,A,2,0)),u=0,h=0}else n.head&&(n.head.extra=null);n.mode=J0;case J0:if(n.flags&1024&&(s=n.length,s>o&&(s=o),s&&(n.head&&(T=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(l,l+s),T)),n.flags&512&&n.wrap&4&&(n.check=Vt(n.check,r,s,l)),o-=s,l+=s,n.length-=s),n.length))break e;n.length=0,n.mode=Q0;case Q0:if(n.flags&2048){if(o===0)break e;s=0;do T=r[l+s++],n.head&&T&&n.length<65536&&(n.head.name+=String.fromCharCode(T));while(T&&s>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Mr;break;case ny:for(;h<32;){if(o===0)break e;o--,u+=r[l++]<>>=h&7,h-=h&7,n.mode=Vf;break}for(;h<3;){if(o===0)break e;o--,u+=r[l++]<>>=1,h-=1,u&3){case 0:n.mode=ry;break;case 1:if(lX(n),n.mode=ou,t===au){u>>>=2,h-=2;break e}break;case 2:n.mode=ay;break;case 3:e.msg="invalid block type",n.mode=It}u>>>=2,h-=2;break;case ry:for(u>>>=h&7,h-=h&7;h<32;){if(o===0)break e;o--,u+=r[l++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=It;break}if(n.length=u&65535,u=0,h=0,n.mode=jf,t===au)break e;case jf:n.mode=iy;case iy:if(s=n.length,s){if(s>o&&(s=o),s>a&&(s=a),s===0)break e;i.set(r.subarray(l,l+s),v),o-=s,l+=s,a-=s,v+=s,n.length-=s;break}n.mode=Mr;break;case ay:for(;h<14;){if(o===0)break e;o--,u+=r[l++]<>>=5,h-=5,n.ndist=(u&31)+1,u>>>=5,h-=5,n.ncode=(u&15)+4,u>>>=4,h-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=It;break}n.have=0,n.mode=oy;case oy:for(;n.have>>=3,h-=3}for(;n.have<19;)n.lens[R[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,D={bits:n.lenbits},O=ws(ZY,n.lens,0,19,n.lencode,0,n.work,D),n.lenbits=D.bits,O){e.msg="invalid code lengths set",n.mode=It;break}n.have=0,n.mode=sy;case sy:for(;n.have>>24,b=m>>>16&255,_=m&65535,!(y<=h);){if(o===0)break e;o--,u+=r[l++]<>>=y,h-=y,n.lens[n.have++]=_;else{if(_===16){for(N=y+2;h>>=y,h-=y,n.have===0){e.msg="invalid bit length repeat",n.mode=It;break}T=n.lens[n.have-1],s=3+(u&3),u>>>=2,h-=2}else if(_===17){for(N=y+3;h>>=y,h-=y,T=0,s=3+(u&7),u>>>=3,h-=3}else{for(N=y+7;h>>=y,h-=y,T=0,s=11+(u&127),u>>>=7,h-=7}if(n.have+s>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=It;break}for(;s--;)n.lens[n.have++]=T}}if(n.mode===It)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=It;break}if(n.lenbits=9,D={bits:n.lenbits},O=ws(M2,n.lens,0,n.nlen,n.lencode,0,n.work,D),n.lenbits=D.bits,O){e.msg="invalid literal/lengths set",n.mode=It;break}if(n.distbits=6,n.distcode=n.distdyn,D={bits:n.distbits},O=ws(L2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,D),n.distbits=D.bits,O){e.msg="invalid distances set",n.mode=It;break}if(n.mode=ou,t===au)break e;case ou:n.mode=su;case su:if(o>=6&&a>=258){e.next_out=v,e.avail_out=a,e.next_in=l,e.avail_in=o,n.hold=u,n.bits=h,WY(e,f),v=e.next_out,i=e.output,a=e.avail_out,l=e.next_in,r=e.input,o=e.avail_in,u=n.hold,h=n.bits,n.mode===Mr&&(n.back=-1);break}for(n.back=0;m=n.lencode[u&(1<>>24,b=m>>>16&255,_=m&65535,!(y<=h);){if(o===0)break e;o--,u+=r[l++]<>w)],y=m>>>24,b=m>>>16&255,_=m&65535,!(w+y<=h);){if(o===0)break e;o--,u+=r[l++]<>>=w,h-=w,n.back+=w}if(u>>>=y,h-=y,n.back+=y,n.length=_,b===0){n.mode=dy;break}if(b&32){n.back=-1,n.mode=Mr;break}if(b&64){e.msg="invalid literal/length code",n.mode=It;break}n.extra=b&15,n.mode=ly;case ly:if(n.extra){for(N=n.extra;h>>=n.extra,h-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=uy;case uy:for(;m=n.distcode[u&(1<>>24,b=m>>>16&255,_=m&65535,!(y<=h);){if(o===0)break e;o--,u+=r[l++]<>w)],y=m>>>24,b=m>>>16&255,_=m&65535,!(w+y<=h);){if(o===0)break e;o--,u+=r[l++]<>>=w,h-=w,n.back+=w}if(u>>>=y,h-=y,n.back+=y,b&64){e.msg="invalid distance code",n.mode=It;break}n.offset=_,n.extra=b&15,n.mode=cy;case cy:if(n.extra){for(N=n.extra;h>>=n.extra,h-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=It;break}n.mode=fy;case fy:if(a===0)break e;if(s=f-a,n.offset>s){if(s=n.offset-s,s>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=It;break}s>n.wnext?(s-=n.wnext,d=n.wsize-s):d=n.wnext-s,s>n.length&&(s=n.length),g=n.window}else g=i,d=v-n.offset,s=n.length;s>a&&(s=a),a-=s,n.length-=s;do i[v++]=g[d++];while(--s);n.length===0&&(n.mode=su);break;case dy:if(a===0)break e;i[v++]=n.length,a--,n.mode=su;break;case Vf:if(n.wrap){for(;h<32;){if(o===0)break e;o--,u|=r[l++]<{if(Da(e))return Xn;let t=e.state;return t.window&&(t.window=null),e.state=null,xa},fX=(e,t)=>{if(Da(e))return Xn;const n=e.state;return(n.wrap&2)===0?Xn:(n.head=t,t.done=!1,xa)},dX=(e,t)=>{const n=t.length;let r,i,l;return Da(e)||(r=e.state,r.wrap!==0&&r.mode!==uc)?Xn:r.mode===uc&&(i=1,i=il(i,t,n,0),i!==r.check)?R2:(l=V2(e,t,n,n),l?(r.mode=$2,D2):(r.havedict=1,xa))};var hX=z2,pX=N2,mX=F2,gX=sX,vX=j2,yX=uX,bX=cX,_X=fX,wX=dX,CX="pako inflate (from Nodeca project)",zr={inflateReset:hX,inflateReset2:pX,inflateResetKeep:mX,inflateInit:gX,inflateInit2:vX,inflate:yX,inflateEnd:bX,inflateGetHeader:_X,inflateSetDictionary:wX,inflateInfo:CX};function SX(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var xX=SX;const U2=Object.prototype.toString,{Z_NO_FLUSH:TX,Z_FINISH:kX,Z_OK:sl,Z_STREAM_END:Wf,Z_NEED_DICT:Yf,Z_STREAM_ERROR:EX,Z_DATA_ERROR:vy,Z_MEM_ERROR:OX}=Ro;function Ol(e){this.options=Hc.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new P2,this.strm.avail_out=0;let n=zr.inflateInit2(this.strm,t.windowBits);if(n!==sl)throw new Error(Ca[n]);if(this.header=new xX,zr.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=ol.string2buf(t.dictionary):U2.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=zr.inflateSetDictionary(this.strm,t.dictionary),n!==sl)))throw new Error(Ca[n])}Ol.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let l,v,o;if(this.ended)return!1;for(t===~~t?v=t:v=t===!0?kX:TX,U2.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),l=zr.inflate(n,v),l===Yf&&i&&(l=zr.inflateSetDictionary(n,i),l===sl?l=zr.inflate(n,v):l===vy&&(l=Yf));n.avail_in>0&&l===Wf&&n.state.wrap>0&&e[n.next_in]!==0;)zr.inflateReset(n),l=zr.inflate(n,v);switch(l){case EX:case vy:case Yf:case OX:return this.onEnd(l),this.ended=!0,!1}if(o=n.avail_out,n.next_out&&(n.avail_out===0||l===Wf))if(this.options.to==="string"){let a=ol.utf8border(n.output,n.next_out),u=n.next_out-a,h=ol.buf2string(n.output,a);n.next_out=u,n.avail_out=r-u,u&&n.output.set(n.output.subarray(a,a+u),0),this.onData(h)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(l===sl&&o===0)){if(l===Wf)return l=zr.inflateEnd(this.strm),this.onEnd(l),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};Ol.prototype.onData=function(e){this.chunks.push(e)};Ol.prototype.onEnd=function(e){e===sl&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Hc.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function sm(e,t){const n=new Ol(t);if(n.push(e),n.err)throw n.msg||Ca[n.err];return n.result}function AX(e,t){return t=t||{},t.raw=!0,sm(e,t)}var PX=Ol,IX=sm,MX=AX,LX=sm,RX=Ro,DX={Inflate:PX,inflate:IX,inflateRaw:MX,ungzip:LX,constants:RX};const{Deflate:MG,deflate:LG,deflateRaw:$X,gzip:RG}=UY,{Inflate:DG,inflate:$G,inflateRaw:BX,ungzip:BG}=DX;var FX=$X,zX=BX;function yy(e){const t=new Map;for(const n of e){const[r,i]=n.split("="),l=decodeURIComponent(i);t.set(r,l)}return t}const NX=function(){if(!window.location.search.includes("?"))return;const t=window.location.search.replace("?","").split("&");let n=yy(t);if(console.log("URL params:",n),n.get("share")){const l=zX(new Uint8Array(atob(n.get("share")).split("").map(v=>v.charCodeAt(0))),{to:"string"});if(!l){$t().raiseError("Error when trying to decode share parameter!",!1);return}n=yy(l.split("&")),console.log("Share URL params:",n)}const r={id:-1,image:"",prompt:n.get("prompt")||"",sampler_name:n.get("sampler_name")||"k_euler",seed:Number(n.get("seed"))||-1,steps:Number(n.get("steps")||20),cfg_scale:Number(n.get("cfg_scale")||5),height:Number(n.get("height")||512),width:Number(n.get("width")||512),clip_skip:Number(n.get("clip_skip")||0),frames:Number(n.get("frames")||1),scheduler:n.get("scheduler")||"default"};en().generateText2Img(r,!1)},jX=10;function vh(e,t,n,r,i=l=>$t().raiseError(l,!1)){if(e.status===n&&t)return!0;if(!t.message)return i(`${r}: Got response code ${e.status}`);if(!t.errors)return i(`${r}: ${t.message}`);const l=Object.entries(t.errors).map(v=>`${v[0]} - ${v[1]}`).join(" | ");return i(`${r}: ${t.message} (${l})`)}const VX=Co("interrogate",()=>{const e=se({}),t=se(!1);async function n(v){$t().raiseError(v,!1),t.value=!1,e.value={}}async function r(){const v=Gt(),{source_image:o}=e.value;if(!o)return n("Failed to get interrogation ID: No image supplied.");t.value=!0;const a=await fetch(`${v.baseURL.length===0?".":v.baseURL}/sdapi/v1/interrogate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:o.split(",")[1],model:"clip"})}),u=await a.json();!vh(a,u,200,"Failed to get interrogation",n)||(e.value.id=u.id,e.value.status=u.caption)}function i(){e.value={},t.value=!1}function l(){return e.value.status||!1}return{currentInterrogation:e,interrogating:t,interrogateImage:r,getFormStatus:l,resetInterrogation:i}}),lm=e=>(Jr("data-v-db184ac6"),e=e(),Qr(),e),UX={key:0,style:{"margin-top":"16px"}},HX=lm(()=>re("div",null,[Ne("Drop file here OR "),re("em",null,"click to upload")],-1)),WX={key:1,style:{"margin-top":"16px"}},YX={key:2},XX={style:{"margin-top":"8px"}},KX=lm(()=>re("h2",{style:{margin:"16px 0 8px 0"}},"Interrogation Results",-1)),GX={key:0},qX=lm(()=>re("h3",null,"Caption",-1)),ZX={key:0},JX={key:1},QX=Ee({__name:"InterrogationView",setup(e){const t=VX(),n=en(),r=$t(),i=se();async function l(u){if(i.value.clearFiles(),!u.raw.type.includes("image")){r.raiseError("Uploaded file needs to be a image!",!1);return}const h=await l2(u.raw);t.currentInterrogation.source_image=h,t.interrogateImage()}function v(){n.generateText2Img({prompt:o.value})}const o=ee(()=>t.getFormStatus()),{ellipsis:a}=o2();return(u,h)=>C(t).currentInterrogation.source_image?C(t).currentInterrogation.status?(j(),ce("div",YX,[re("div",XX,[le(C(lt),{icon:C(mg),onClick:C(t).resetInterrogation},{default:pe(()=>[Ne("New Interrogation")]),_:1},8,["icon","onClick"]),C(o)?(j(),we(C(lt),{key:0,icon:C(mg),onClick:v,disabled:!C(o)},{default:pe(()=>[Ne("Text2Img (Caption)")]),_:1},8,["icon","disabled"])):_e("",!0)]),KX,le(C(Tp),{src:C(t).currentInterrogation.source_image,alt:"Uploaded Image"},null,8,["src"]),C(o)?(j(),ce("div",GX,[qX,C(o)?(j(),ce("div",JX,[re("strong",null,Ae(C(o)),1)])):(j(),ce("div",ZX,"Processing"+Ae(C(a)),1))])):_e("",!0)])):(j(),ce("div",WX,[re("strong",null,"Uploading image"+Ae(C(a)),1)])):(j(),ce("div",UX,[re("div",null,[le(C(Pp),{onChange:l,"auto-upload":!1,limit:1,class:"interrogation-upload",ref_key:"upload",ref:i,multiple:"",drag:""},{default:pe(()=>[le(C(De),{size:100},{default:pe(()=>[le(C(Kh))]),_:1}),HX]),_:1},512)])]))}});const eK=Yt(QX,[["__scopeId","data-v-db184ac6"]]);function tK(e,t,n){if(e===0)return"0"+(t?"s":"seconds");if(e==null)return"?";const r=Math.floor(e/86400),i=Math.floor(e%86400/3600),l=Math.floor(e%86400%3600/60),v=Math.floor(e%86400%3600%60),o=r>0?r+(t?"d":"days"):"",a=i>0?i+(t?"h":"hours"):"",u=l>0?l+(t?"m":"minutes"):"",h=v>0?v+(t?"s":"seconds"):"",c=[];return n!=null&&n.days&&c.push(o),n!=null&&n.hours&&c.push(a),n!=null&&n.minutes&&c.push(u),n!=null&&n.seconds&&c.push(h),c.join(" ")}const nK={class:"form"},rK={key:0,style:{"padding-bottom":"50px"}},iK=re("h1",{style:{margin:"0"}},"Interrogation",-1),aK=re("div",null,"Interrogate images to get their predicted descriptions.",-1),oK={class:"sidebar"},sK=re("span",{style:{height:"100%","font-size":"14px"}},[Ne("Reference Image: "),re("br"),Ne("(Photomaker/Kontext) ")],-1),lK=re("h3",{style:{margin:"16px 0 4px 0"}},"Multi Select",-1),uK={class:"main"},cK={class:"image center-horizontal"},fK={key:0},dK=Ee({__name:"GenerateView",setup(e){const n=up(lp).smallerOrEqual("md"),r=en(),i=$t(),l=ys(),v=Gt();let o=[];const a=Qg(async()=>{if(o.length===0)try{o=(await(await fetch(`${v.baseURL.length===0?".":v.baseURL}/sdapi/v1/samplers`)).json()).map(b=>b.name)}catch{o=[]}return o.length===0?[]:f(o)});let u=[];const h=Qg(async()=>{if(u.length===0)try{u=(await(await fetch(`${v.baseURL.length===0?".":v.baseURL}/sdapi/v1/schedulers`)).json()).map(b=>b.name)}catch{u=[]}return u.length===0?[]:s(u)}),c=Ct({prompt:[{required:!0,message:"Please input prompt",trigger:"change"}]});function f(b){return!r.params||!r.params.sampler_name||b.indexOf(r.params.sampler_name)===-1&&(r.params.sampler_name=b[0]),b}function s(b){return!r.params||!r.params.scheduler||b.indexOf(r.params.scheduler)===-1&&(r.params.scheduler=b[0]),b}function d(b){return"Elapsed: "+tK(b,!0,{days:!0,hours:!0,minutes:!0,seconds:!0})}function g(){r.validGeneratorTypes.includes(r.generatorType)||(i.showGeneratorBadge=!1)}function m(b){r.generatorType=b,g(),console.log(b)}function y(){l.showCropPreview=!0,l.updateCropPreview()}return g(),NX(),(b,_)=>(j(),ce(ze,null,[le(C(Z1),{"default-active":C(r).generatorType,collapse:!0,onSelect:m,mode:C(n)?"horizontal":"vertical",class:fe(C(n)?"mobile-generator-types":"generator-types"),style:Fe(C(n)?"overflow-x: auto":"")},{default:pe(()=>[le(nu,{index:"Text2Img","icon-one":C(nE),"icon-two":C(Fl),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),le(nu,{index:"Img2Img","icon-one":C(Fl),"icon-two":C(Fl),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),le(nu,{index:"Inpainting","icon-one":a2,"icon-two":C(Fl),isMobile:C(n)},null,8,["icon-two","isMobile"]),le(nu,{index:"Interrogation","icon-one":iH,isMobile:C(n)},null,8,["isMobile"])]),_:1},8,["default-active","mode","class","style"]),re("div",nK,[C(r).generatorType==="Interrogation"?(j(),ce("div",rK,[iK,aK,le(eK)])):(j(),we(C(xp),{key:1,"label-position":"left","label-width":"140px",model:C(r),class:"container",rules:c,onSubmit:_[29]||(_[29]=Ze(()=>{},["prevent"]))},{default:pe(()=>[re("div",oK,[le(C(H$),{modelValue:C(i).activeCollapse,"onUpdate:modelValue":_[24]||(_[24]=w=>C(i).activeCollapse=w),style:{"margin-bottom":"24px"}},{default:pe(()=>[le(C(W$),{title:"Generation Options",name:"1"},{default:pe(()=>[le(CH),le(sh,{label:"Negative Prompt",prop:"negativePrompt",modelValue:C(r).negativePrompt,"onUpdate:modelValue":_[0]||(_[0]=w=>C(r).negativePrompt=w),autosize:{maxRows:15},resize:"vertical",type:"textarea",placeholder:"Enter negative prompt here",info:"What to exclude from the image. Not working? Try increasing the guidance.","label-position":"top"},null,8,["modelValue"]),le(sh,{label:"Seed",prop:"seed",modelValue:C(r).params.seed,"onUpdate:modelValue":_[2]||(_[2]=w=>C(r).params.seed=w),placeholder:"Enter seed here",clearable:"","clear-icon":C(Wk)},{append:pe(()=>[le(C(kr),{content:"Randomize!",placement:"top"},{default:pe(()=>[le(C(lt),{icon:C(C3),onClick:_[1]||(_[1]=()=>C(r).params.seed=C(H2)())},null,8,["icon"])]),_:1})]),_:1},8,["modelValue","clear-icon"]),C(r).multiSelect.sampler.enabled?(j(),we(Au,{key:0,label:"Sampler(s)",prop:"samplers",modelValue:C(r).multiSelect.sampler.selected,"onUpdate:modelValue":_[3]||(_[3]=w=>C(r).multiSelect.sampler.selected=w),options:C(a),info:"Multi-select enabled. Heun and DPM2 double generation time per step, but converge twice as fast.",multiple:""},null,8,["modelValue","options"])):(j(),we(Au,{key:1,label:"Sampler",prop:"sampler",modelValue:C(r).params.sampler_name,"onUpdate:modelValue":_[4]||(_[4]=w=>C(r).params.sampler_name=w),options:C(a),info:"Heun and DPM2 double generation time per step, but converge twice as fast."},null,8,["modelValue","options"])),le(En,{label:"Batch Size",prop:"batchSize",modelValue:C(r).params.n,"onUpdate:modelValue":_[5]||(_[5]=w=>C(r).params.n=w),min:C(r).minImages,max:C(r).maxImages},null,8,["modelValue","min","max"]),C(r).multiSelect.steps.enabled?(j(),we(En,{key:2,label:"Steps(s)",prop:"multiSteps",modelValue:C(r).multiSelect.steps.selected,"onUpdate:modelValue":_[6]||(_[6]=w=>C(r).multiSelect.steps.selected=w),min:C(r).minSteps,max:C(r).maxSteps,info:"Multi-select enabled. Keep step count between 30 to 50 for optimal generation times. Coherence typically peaks between 60 and 90 steps, with a trade-off in speed.",multiple:""},null,8,["modelValue","min","max"])):(j(),we(En,{key:3,label:"Steps",prop:"steps",modelValue:C(r).params.steps,"onUpdate:modelValue":_[7]||(_[7]=w=>C(r).params.steps=w),min:C(r).minSteps,max:C(r).maxSteps,info:"Keep step count between 30 to 50 for optimal generation times. Coherence typically peaks between 60 and 90 steps, with a trade-off in speed."},null,8,["modelValue","min","max"])),le(En,{label:"Width",prop:"width",modelValue:C(r).params.width,"onUpdate:modelValue":_[8]||(_[8]=w=>C(r).params.width=w),min:C(r).minDimensions,max:C(r).maxDimensions,step:64,change:y},null,8,["modelValue","min","max"]),le(En,{label:"Height",prop:"height",modelValue:C(r).params.height,"onUpdate:modelValue":_[9]||(_[9]=w=>C(r).params.height=w),min:C(r).minDimensions,max:C(r).maxDimensions,step:64,change:y},null,8,["modelValue","min","max"]),C(r).multiSelect.guidance.enabled?(j(),we(En,{key:4,label:"Guidance(s)",prop:"cfgScales",modelValue:C(r).multiSelect.guidance.selected,"onUpdate:modelValue":_[10]||(_[10]=w=>C(r).multiSelect.guidance.selected=w),min:C(r).minCfgScale,max:C(r).maxCfgScale,info:"Multi-select enabled. Higher values will make the AI respect your prompt more. Lower values allow the AI to be more creative.",multiple:""},null,8,["modelValue","min","max"])):(j(),we(En,{key:5,label:"Guidance",prop:"cfgScale",modelValue:C(r).params.cfg_scale,"onUpdate:modelValue":_[11]||(_[11]=w=>C(r).params.cfg_scale=w),min:C(r).minCfgScale,max:C(r).maxCfgScale,step:.5,info:"Higher values will make the AI respect your prompt more. Lower values allow the AI to be more creative."},null,8,["modelValue","min","max","step"])),C(r).multiSelect.clipSkip.enabled?(j(),we(En,{key:6,label:"CLIP Skip(s)",prop:"clipSkips",modelValue:C(r).multiSelect.clipSkip.selected,"onUpdate:modelValue":_[12]||(_[12]=w=>C(r).multiSelect.clipSkip.selected=w),min:C(r).minClipSkip,max:C(r).maxClipSkip,info:"Multi-select enabled. Last layers of CLIP to ignore. For most situations this can be left alone.",multiple:""},null,8,["modelValue","min","max"])):(j(),we(En,{key:7,label:"CLIP Skip",prop:"clipSkip",modelValue:C(r).params.clip_skip,"onUpdate:modelValue":_[13]||(_[13]=w=>C(r).params.clip_skip=w),min:C(r).minClipSkip,max:C(r).maxClipSkip,info:"Last layers of CLIP to ignore. For most situations this can be left alone."},null,8,["modelValue","min","max"])),C(r).sourceGeneratorTypes.includes(C(r).generatorType)?(j(),we(En,{key:8,label:"Init Strength",prop:"denoise",modelValue:C(r).params.denoising_strength,"onUpdate:modelValue":_[14]||(_[14]=w=>C(r).params.denoising_strength=w),min:C(r).minDenoise,max:C(r).maxDenoise,step:.01,info:"The final image will diverge from the starting image at higher values."},null,8,["modelValue","min","max","step"])):_e("",!0),le(En,{label:"Video Frames",prop:"frames",modelValue:C(r).params.frames,"onUpdate:modelValue":_[15]||(_[15]=w=>C(r).params.frames=w),min:C(r).minFrames,max:C(r).maxFrames,info:"Number of consecutive video frames to generate (Video models only). Max 80 frames, about 5 seconds of video."},null,8,["modelValue","min","max"]),le(Au,{label:"Scheduler",prop:"scheduler",modelValue:C(r).params.scheduler,"onUpdate:modelValue":_[16]||(_[16]=w=>C(r).params.scheduler=w),options:C(h),info:"Experimental! KoboldCpp only, allows you to use a different scheduler. Leave as default otherwise."},null,8,["modelValue","options"]),re("div",null,[sK,re("input",{class:"el-button",type:"file",id:"extra_image_input",onChange:_[17]||(_[17]=w=>C(r).setExtraImage(w)),accept:"image/*",multiple:""},null,32),re("button",{onClick:_[18]||(_[18]=w=>C(r).clearExtraImage()),class:"el-button"},"Clear Image"),le(C(n0),null,{default:pe(()=>[le(C(Uo),{span:C(n)?24:12},{default:pe(()=>[le(Yo,{label:"ESRGAN Upscale",prop:"enable_hr",modelValue:C(r).params.enable_hr,"onUpdate:modelValue":_[19]||(_[19]=w=>C(r).params.enable_hr=w),info:"Enable upscale with ESRGAN."},null,8,["modelValue"])]),_:1},8,["span"])]),_:1})]),lK,le(C(n0),null,{default:pe(()=>[le(C(Uo),{span:C(n)?24:12},{default:pe(()=>[le(Yo,{label:"Multi Sampler",prop:"multiSamplerSwitch",modelValue:C(r).multiSelect.sampler.enabled,"onUpdate:modelValue":_[20]||(_[20]=w=>C(r).multiSelect.sampler.enabled=w)},null,8,["modelValue"])]),_:1},8,["span"]),le(C(Uo),{span:C(n)?24:12},{default:pe(()=>[le(Yo,{label:"Multi Guidance",prop:"multiGuidanceSwitch",modelValue:C(r).multiSelect.guidance.enabled,"onUpdate:modelValue":_[21]||(_[21]=w=>C(r).multiSelect.guidance.enabled=w)},null,8,["modelValue"])]),_:1},8,["span"]),le(C(Uo),{span:C(n)?24:12},{default:pe(()=>[le(Yo,{label:"Multi CLIP Skip",prop:"multiClipSkipSwitch",modelValue:C(r).multiSelect.clipSkip.enabled,"onUpdate:modelValue":_[22]||(_[22]=w=>C(r).multiSelect.clipSkip.enabled=w)},null,8,["modelValue"])]),_:1},8,["span"]),le(C(Uo),{span:C(n)?24:12},{default:pe(()=>[le(Yo,{label:"Multi Steps",prop:"multiStepsSwitch",modelValue:C(r).multiSelect.steps.enabled,"onUpdate:modelValue":_[23]||(_[23]=w=>C(r).multiSelect.steps.enabled=w)},null,8,["modelValue"])]),_:1},8,["span"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),re("div",uK,[le(C(lt),{onClick:_[25]||(_[25]=()=>{C(r).cancelled=!0,C(r).generating=!1,C(r).resetStore()}),class:"reset-btn"},{default:pe(()=>[Ne("Reset")]),_:1}),le(C(lt),{type:"primary",class:"generate-cancel-btn",style:Fe(C(r).generating?"width: 55%;":""),onClick:_[26]||(_[26]=()=>C(r).generateImage(C(r).generatorType))},{default:pe(()=>[re("span",null," Generate "+Ae(C(r).totalImageCount)+" image"+Ae(C(r).totalImageCount===1?"":"s"),1)]),_:1},8,["style"]),C(r).generating?(j(),we(C(lt),{key:0,type:"danger",class:"generate-cancel-btn",style:{width:"25%"},disabled:C(r).cancelled,onClick:_[27]||(_[27]=()=>{C(r).cancelled=!0,C(r).generating=!1,C(r).clearQueue()})},{default:pe(()=>[Ne("Cancel all")]),_:1},8,["disabled"])):_e("",!0)]),re("div",cK,[le(C(YD),{class:"center-both generated-image"},{default:pe(()=>[!C(r).generating&&C(r).outputs.length==0?(j(),ce("div",fK,[/Inpainting/.test(C(r).generatorType)?(j(),we(I0,{key:0})):_e("",!0),/Img2Img/.test(C(r).generatorType)?(j(),we(I0,{key:1})):_e("",!0)])):_e("",!0),!C(i).showGeneratedImages&&C(r).generating?(j(),we(dH,{key:1,generated:C(r).outputs.length,total:C(r).queue.length,elapsed:d(C(r).timer.seconds),onShowGenerated:_[28]||(_[28]=w=>C(i).showGeneratedImages=!0)},null,8,["generated","total","elapsed"])):_e("",!0),C(i).showGeneratedImages&&C(r).outputs.length!==0?(j(),we(MH,{key:2})):_e("",!0)]),_:1})])]),_:1},8,["model","rules"]))])],64))}});const Cs=BT({history:eT("./"),routes:[{path:"/",name:"generate",component:dK},{path:"/images",name:"images",component:()=>If(()=>Promise.resolve().then(()=>uG),void 0,import.meta.url)},{path:"/about",name:"about",component:()=>If(()=>Promise.resolve().then(()=>CG),void 0,import.meta.url)},{path:"/options",name:"options",component:()=>If(()=>Promise.resolve().then(()=>PG),void 0,import.meta.url)},{path:"/return",name:"return",redirect:e=>(window.location.href=window.location.pathname.endsWith("/")?"..":".","/")}]});function Xf(){return{steps:20,n:1,sampler_name:"Euler",width:512,height:512,cfg_scale:5,clip_skip:0,seed:-1,denoising_strength:.6,frames:1,enable_hr:!1,scheduler:"default"}}function H2(){return Math.floor(Math.random()*9999999)+1}const en=Co("generator",()=>{const e=["Text2Img","Img2Img","Inpainting"],t=["Img2Img","Inpainting"],n=se("Text2Img"),r=se(""),i=Pn("promptHistory",[]),l=se(""),v=Pn("negativeLibrary",[]),o=se(Xf()),a=se({interval:0,seconds:0}),u=se({sampler:{name:"Sampler",enabled:!1,selected:[o.value.sampler_name],noneMessage:"Failed to generate: No sampler selected.",mapToParam:te=>te.sampler_name},steps:{name:"Steps",enabled:!1,selected:[o.value.steps],noneMessage:"Failed to generate: No steps selected.",mapToParam:te=>te.steps},guidance:{name:"CFG Scale",enabled:!1,selected:[o.value.cfg_scale],noneMessage:"Failed to generate: No guidance selected.",mapToParam:te=>te.cfg_scale},clipSkip:{name:"Clip Skip",enabled:!1,selected:[o.value.clip_skip],noneMessage:"Failed to generate: No CLIP Skip selected.",mapToParam:te=>te.clip_skip}}),h=()=>({sourceProcessing:void 0,sourceImage:void 0,maskImage:void 0}),c=se({...h(),sourceProcessing:"inpainting"}),f=se({...h(),sourceProcessing:"img2img"}),s=te=>te==="Inpainting"?c.value:te==="Img2Img"?f.value:h(),d=ee(()=>s(n.value)),g=se(""),m=se(!1),y=se(!1),b=se([]),_=se([]),w=se(64),S=ee(()=>Gt().allowLargerParams==="Enabled"?3072:1024),x=se(1),T=se(20),O=se(1),A=ee(()=>Gt().allowLargerParams==="Enabled"?150:50),D=se(1),N=se(24),R=se(.1),B=se(1),E=se(0),U=se(10),ne=se(1),Q=se(80),ue=(te,be,Ce)=>Array.from({length:(be-te+1)/Ce},(xe,Ie)=>(Ie+te)*Ce),I=se(ue(E.value,U.value,1)),z=se(ue(D.value,N.value,.5)),M=ee(()=>{const te=(Me,Le,ot=1)=>Me*(Le.enabled?Le.selected.length:ot),Ce=o.value.n*Y().length,xe=te(Ce,u.value.sampler),Ie=te(xe,u.value.steps),ve=te(Ie,u.value.guidance);return te(ve,u.value.clipSkip)});function L(){return o.value=Xf(),c.value=h(),f.value=h(),b.value=[],$t().showGeneratedImages=!1,J(),!0}function J(){_.value=[]}function V(){b.value=[]}async function P(te){if(!e.includes(te))return[];if(r.value==="")return Z("Failed to generate: No prompt submitted.");for(const ut of Object.values(u.value))if(ut.enabled&&ut.selected.length===0)return Z(ut.noneMessage);const be=ys(),Ce=$t();be.saveImages();const{sourceImage:xe,maskImage:Ie,sourceProcessing:ve}=s(te);K(r.value);const Se=[],Me=(ut,Qt)=>ut.enabled?ut.selected:Qt,Le=Y(),ot=Me(u.value.guidance,[o.value.cfg_scale]),pt=Me(u.value.steps,[o.value.steps]),st=Me(u.value.clipSkip,[o.value.clip_skip]),Xt=Me(u.value.sampler,[o.value.sampler_name]),Jt=[await W()];for(const ut of ot)for(const Qt of pt)for(const G2 of st)for(const cm of Le){const fm=cm.split(" ### ");for(const q2 of Xt){let Il=parseInt(o.value.seed.toString());(isNaN(Il)||Il<0)&&(Il=H2());for(let Xc=0;Xc0&&(Fn.params.extra_images=G),Gt().alsoRequestAvi==="Enabled"&&Fn.params.frames&&Fn.params.frames>1&&(Fn.params.video_output_type=2),Se.push(Fn)}}}let Or=!1;m.value||(Or=!0,b.value=[]),m.value=!0,Ce.showGeneratedImages=!1;let xn=_.value.filter(ut=>!ut.gathered&&!ut.failed).length;for(let ut=0;ut{a.value.seconds++},1e3);!_.value.every(ut=>ut.gathered||ut.failed)&&!y.value;){const ut=_.value.find(Qt=>!Qt.gathered&&!Qt.failed);if(!ut)break;ut.gathered=!0;try{const Qt=await k(ut.params);if(!Qt){ut.failed=!0;continue}q([{...Qt,...ut}])}catch(Qt){ut.failed=!0,console.error("Error fetching image:",Qt)}}}async function q(te){const be=wa();console.log(te);const Ce=await Promise.all(te.map(async ve=>{const Se=ve.images[0],Le=!!ve.animated?"gif":"png",ot=ve.extra_data?`data:video/avi;base64,${ve.extra_data}`:"";return{id:-1,image:`data:image/${Le};base64,${Se}`,prompt:ve.prompt,clip_skip:ve.params.clip_skip,modelName:ve.models[0],seed:ve.params.seed,steps:ve.params.steps,sampler_name:ve.params.sampler_name,cfg_scale:ve.params.cfg_scale,width:ve.params.width,height:ve.params.height,frames:ve.params.frames,scheduler:ve.params.scheduler,extra_avi:ot,enable_hr:ve.params.enable_hr}})),xe=await be.pushOutputs(Ce),Ie=0;return b.value=[...xe.map(ve=>({type:"image",index:Ie,output:ve})),...b.value].sort((ve,Se)=>ve.index-Se.index),b.value.length===_.value.length&&(_.value=[],m.value=!1,$t().showGeneratedImages=!0,clearInterval(a.value.interval),a.value.interval=0,a.value.seconds=0),Ce}async function Z(te){const be=$t();return te&&be.raiseError(te,!1),[]}function ie(te,be,Ce,xe){return be<=Ce?be:($t().raiseWarning(`This image was generated using the 'Larger Values' option. Setting '${te}' to its default value instead of ${be}.`,!0),xe)}function he(te,be=!0){const Ce=Xf();if(n.value="Text2Img",u.value.guidance.enabled=!1,u.value.sampler.enabled=!1,Cs.push("/"),be&&(te.width=te.width||Ce.width,te.height=te.height||Ce.height),te.prompt){const xe=te.prompt.split(" ### ");r.value=xe[0],l.value=xe[1]||""}te.sampler_name&&(o.value.sampler_name=te.sampler_name),te.steps&&(o.value.steps=ie("steps",te.steps,A.value,Ce.steps)),te.cfg_scale&&(o.value.cfg_scale=te.cfg_scale),te.width&&(o.value.width=ie("width",te.width,S.value,Ce.width)),te.height&&(o.value.height=ie("height",te.height,S.value,Ce.height)),te.seed&&(o.value.seed=te.seed),te.clip_skip&&(o.value.clip_skip=ie("clip_skip",te.clip_skip,U.value,Ce.clip_skip)),te.scheduler&&(o.value.scheduler=te.scheduler),te.frames&&(o.value.frames=ie("frames",te.frames,Q.value,Ce.frames))}function ge(te){const be=ys();n.value="Img2Img",f.value.sourceImage=te,be.drawing=!1,b.value=[],Cs.push("/"),Jn.fabric.Image.fromURL(te,be.newImage)}function ye(te){const be=ys();b.value=[],c.value.sourceImage=te,n.value="Inpainting",Cs.push("/"),Jn.fabric.Image.fromURL(te,be.newImage)}function H(){return l.value===""?r.value:`${r.value} ### ${l.value}`}function Y(){const te=H(),be=te.match(/\{(.*?)\}/g)||[];if(be.length===0)return[te];let Ce=[];return be.forEach(xe=>{const Ie=[],ve=xe.replace("{","").replace("}","").split("|");Ce.length===0?ve.forEach(Se=>{const Me=te.replace(xe,Se);Ie.push(Me)}):Ce.forEach(Se=>{ve.forEach(Me=>{const Le=Se.replace(xe,Me);Ie.push(Le)})}),Ce=[...Ie]}),Ce}async function k(te){const be=Gt();try{const Ce=await fetch(`${be.baseURL.length===0?".":be.baseURL}/sdapi/v1/${te.init_images.length>0?"img":"txt"}2img`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)}),xe=await Ce.json();return vh(Ce,xe,200,"Failed to fetch",X)?xe:!1}catch{return!1}}function X(te){return $t().raiseError(te,!1),y.value=!1,b.value=[],!1}async function W(){const te=Gt(),be=await fetch(`${te.baseURL.length===0?".":te.baseURL}/sdapi/v1/sd-models`),Ce=await be.json();if(!!vh(be,Ce,200,"Failed to get available models"))return Ce.length===0?"(No model loaded)":Ce[0].model_name}function $(te){v.value.indexOf(te)===-1&&(v.value=[...v.value,te])}function F(te){v.value=v.value.filter(be=>be!=te)}function K(te){if(i.value.findIndex(be=>be.prompt===te)===-1){if(i.value.length>=10+i.value.filter(be=>be.starred).length){const be=i.value.filter(xe=>!xe.starred),Ce=i.value.findIndex(xe=>xe===be[be.length-1]);i.value.splice(Ce,1)}i.value=[...i.value,{starred:!1,timestamp:Date.now(),prompt:te}]}}function de(te){i.value=i.value.filter(be=>be.prompt!=te&&be!=te)}function oe(){return!1}var G=[];function me(te){let be=te.target;if(G=[],be.files.length>0)for(let Ce=0;Cenew DataView(new ArrayBuffer(e)),$a=e=>new Uint8Array(e.buffer||e),qa=e=>new TextEncoder().encode(String(e));function hK(e,t){if(t===void 0||t instanceof Date||(t=new Date(t)),e instanceof File)return{t:t||new Date(e.lastModified),o:e.stream()};if(e instanceof Response)return{t:t||new Date(e.headers.get("Last-Modified")||Date.now()),o:e.body};if(t===void 0)t=new Date;else if(isNaN(t))throw new Error("Invalid modification date.");if(typeof e=="string")return{t,o:qa(e)};if(e instanceof Blob)return{t,o:e.stream()};if(e instanceof Uint8Array||e instanceof ReadableStream)return{t,o:e};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{t,o:$a(e)};if(Symbol.asyncIterator in e)return{t,o:W2(e)};throw new TypeError("Unsupported input format.")}function W2(e){const t="next"in e?e:e[Symbol.asyncIterator]();return new ReadableStream({async pull(n){let r=0;for(;n.desiredSize>r;){const i=await t.next();if(!i.value){n.close();break}{const l=pK(i.value);n.enqueue(l),r+=l.byteLength}}}})}function pK(e){return typeof e=="string"?qa(e):e instanceof Uint8Array?e:$a(e)}function mK(e,t,n){if(t===void 0||t instanceof Uint8Array||(t=qa(t)),e instanceof File)return{i:t||qa(e.name),A:e.size};if(e instanceof Response){const r=e.headers.get("content-disposition"),i=r&&r.match(/;\s*filename\*?=["']?(.*?)["']?$/i),l=i&&i[1]||new URL(e.url).pathname.split("/").pop(),v=l&&decodeURIComponent(l),o=n||+e.headers.get("content-length");return{i:t||qa(v),A:o}}if(!t||t.length===0)throw new Error("The file must have a name.");return typeof e=="string"?{i:t,A:qa(e).length}:e instanceof Blob?{i:t,A:e.size}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?{i:t,A:e.byteLength}:{i:t,A:n}}var gK=new WebAssembly.Instance(new WebAssembly.Module(Uint8Array.from(atob("AGFzbQEAAAABCgJgAABgAn9/AXwDAwIAAQUDAQACBwkCAW0CAAFjAAEIAQAKlQECSQEDfwNAIAEhAEEAIQIDQCAAQQF2IABBAXFBoIbi7X5scyEAIAJBAWoiAkEIRw0ACyABQQJ0IAA2AgAgAUEBaiIBQYACRw0ACwtJAQF/IAFBf3MhAUGAgAQhAkGAgAQgAGohAANAIAFB/wFxIAItAABzQQJ0KAIAIAFBCHZzIQEgAkEBaiICIABJDQALIAFBf3O4Cw"),e=>e.charCodeAt(0)))),{c:vK,m:yK}=gK.exports,bK=$a(yK).subarray(65536);function by(e,t=0){for(const n of function*(r){for(;r.length>65536;)yield r.subarray(0,65536),r=r.subarray(65536);r.length&&(yield r)}(e))bK.set(n),t=vK(n.length,t);return t}function Y2(e,t,n=0){const r=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,i=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;t.setUint16(n,r,1),t.setUint16(n+2,i,1)}function _K(e){const t=Yc(30);return t.setUint32(0,1347093252),t.setUint32(4,335546368),Y2(e.t,t,10),t.setUint16(26,e.i.length,1),$a(t)}async function*wK(e){let{o:t}=e;if("then"in t&&(t=await t),t instanceof Uint8Array)yield t,e.u=by(t,0),e.A=t.length;else{e.A=0;const n=t.getReader();for(;;){const{value:r,done:i}=await n.read();if(i)break;e.u=by(r,e.u),e.A+=r.length,yield r}}}function CK(e){const t=Yc(16);return t.setUint32(0,1347094280),t.setUint32(4,e.u,1),t.setUint32(8,e.A,1),t.setUint32(12,e.A,1),$a(t)}function SK(e,t){const n=Yc(46);return n.setUint32(0,1347092738),n.setUint32(4,352523264),n.setUint16(8,2048),Y2(e.t,n,12),n.setUint32(16,e.u,1),n.setUint32(20,e.A,1),n.setUint32(24,e.A,1),n.setUint16(28,e.i.length,1),n.setUint16(40,33204,1),n.setUint32(42,t,1),$a(n)}function xK(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified]]}function TK(e,t={}){const n={"Content-Type":"application/zip","Content-Disposition":"attachment"};return Number.isInteger(t.length)&&t.length>0&&(n["Content-Length"]=t.length),t.metadata&&(n["Content-Length"]=p(t.metadata)),new Response(W2(async function*(r){const i=[];let l=0,v=0;for await(const u of r)yield _K(u),yield u.i,yield*wK(u),yield CK(u),i.push(SK(u,l)),i.push(u.i),v++,l+=46+u.i.length+u.A;let o=0;for(const u of i)yield u,o+=u.length;const a=Yc(22);a.setUint32(0,1347093766),a.setUint16(8,v,1),a.setUint16(10,v,1),a.setUint32(12,o,1),a.setUint32(16,l,1),yield $a(a)}(async function*(r){for await(const i of r){const[l,v]=xK(i);yield Object.assign(hK(...v),mK(...l))}}(e))),{headers:n})}async function X2(e,t=!0,n){const r=Gt();t&&Ri({message:`Downloading ${e.length} image(s)...`,type:"info"});const i=[];for(let o=0;o]/g,"").substring(0,128).trimEnd();let s=r.imageDownloadType;u.startsWith("data:image/gif")&&(s="GIF"),s==="PNG"?i.push({name:f+".png",input:await aa(u,"image/png")}):s==="JPG"?i.push({name:f+".jpg",input:await aa(u,"image/jpeg")}):s==="GIF"?i.push({name:f+".gif",input:await aa(u,"image/gif")}):i.push({name:f+".webp",input:await aa(u,"image/webp")}),i.push({name:f+".json",input:JSON.stringify(c,void 0,4)}),n&&n()}const l=await TK(i).blob(),v=document.createElement("a");v.href=URL.createObjectURL(l),v.download="sdui_images.zip",v.click()}async function kK(e,t){const n=Gt(),r=document.createElement("a");let i,l=n.imageDownloadType;e.startsWith("data:image/gif")&&(l="GIF"),l==="PNG"?(i=await aa(e,"image/png"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".png"):l==="JPG"?(i=await aa(e,"image/jpeg"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".jpg"):l==="GIF"?(i=await aa(e,"image/gif"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".gif"):(r.href=e,r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".webp"),r.click(),i&&URL.revokeObjectURL(r.href)}const K2=Ee({__name:"ImageActions",props:{imageData:null,onDelete:null},setup(e){const t=e,n=en(),r=wa(),i=()=>{uw.confirm("This action will permanently delete this image. Continue?","Warning",{confirmButtonText:"OK",cancelButtonText:"Cancel",type:"warning"}).then(()=>{r.deleteOutput(t.imageData.id),t.onDelete!==void 0&&t.onDelete(t.imageData.id),Ri({type:"success",message:"Deleted Image"})})},l=()=>{en().clearOutputs(),$t().showGeneratedImages=!1,en().clearQueue()};async function v(o){const a=window.location.origin,u={prompt:o.prompt,width:o.width?o.width:void 0,height:o.height?o.height:void 0,steps:o.steps,cfg_scale:o.cfg_scale,sampler_name:o.sampler_name,model_name:o.modelName,seed:o.seed,clip_skip:o.clip_skip,frames:o.frames,scheduler:o.scheduler,extra_avi:o.extra_avi,enable_hr:o.enable_hr},h=window.location.pathname.replace("images","");let c=`${a}${h}?share=`,f="",s="";for(const[g,m]of Object.entries(u)){if(!m)continue;let y=m;typeof m=="string"?y=encodeURIComponent(m):Array.isArray(m)&&(y=JSON.stringify(m)),f+=`${s}${g}=${y}`,s="&"}c+=btoa(String.fromCharCode.apply(null,Array.from(FX(f)))),await navigator.clipboard.writeText(c),Ri({type:"success",message:"Copied shareable link to clipboard"})}return(o,a)=>(j(),ce(ze,null,[le(C(lt),{onClick:i,type:"danger",size:"small",icon:C(Ec),plain:""},{default:pe(()=>[Ne("Delete")]),_:1},8,["icon"]),le(C(lt),{onClick:a[0]||(a[0]=u=>C(kK)(e.imageData.image,`${e.imageData.seed}-${e.imageData.prompt}`)),type:"success",size:"small",icon:C(Ls),plain:""},{default:pe(()=>[Ne("Download")]),_:1},8,["icon"]),e.imageData.starred?_e("",!0):(j(),we(C(lt),{key:0,onClick:a[1]||(a[1]=u=>C(r).toggleStarred(e.imageData.id)),type:"warning",size:"small",icon:C(qO),plain:""},{default:pe(()=>[Ne("Star")]),_:1},8,["icon"])),e.imageData.starred?(j(),we(C(lt),{key:1,onClick:a[2]||(a[2]=u=>C(r).toggleStarred(e.imageData.id)),type:"warning",size:"small",icon:C(n_),plain:""},{default:pe(()=>[Ne("Unstar")]),_:1},8,["icon"])):_e("",!0),le(C(lt),{onClick:a[3]||(a[3]=u=>C(n).generateText2Img(e.imageData)),type:"success",size:"small",plain:""},{default:pe(()=>[Ne("Txt2img")]),_:1}),le(C(lt),{onClick:a[4]||(a[4]=u=>C(n).generateImg2Img(e.imageData.image)),type:"success",size:"small",plain:""},{default:pe(()=>[Ne("Img2img")]),_:1}),le(C(lt),{onClick:a[5]||(a[5]=u=>C(n).generateInpainting(e.imageData.image)),type:"success",size:"small",plain:""},{default:pe(()=>[Ne("Inpaint")]),_:1}),le(C(lt),{onClick:a[6]||(a[6]=u=>l()),type:"success",size:"small",plain:""},{default:pe(()=>[Ne("Dismiss")]),_:1}),le(C(lt),{onClick:a[7]||(a[7]=u=>v(e.imageData)),type:"success",icon:C(f3),size:"small",plain:""},{default:pe(()=>[Ne("Share")]),_:1},8,["icon"])],64))}}),EK={class:"main-output",style:{position:"relative",display:"flex","align-items":"center","justify-content":"center"}},OK=["src"],AK={style:{"font-size":"18px","font-weight":"500"}},PK={style:{"font-family":"'Segoe UI', Tahoma, Geneva, Verdana, sans-serif","letter-spacing":"0.025em"}},IK={key:0},MK=["onClick"],LK=Ee({__name:"ImageDialog",setup(e){const t=wa(),n=$t(),r=se();jI(r,{onSwipeEnd(a,u){u==="RIGHT"&&n.openModalToLeft(),u==="LEFT"&&n.openModalToRight()}});const i=ee({get(){return n.activeModal!==-1},set(){n.activeModal=-1}}),l=se(t.currentOutputs[0]);ke(()=>n.activeModal,async()=>{const a=t.currentOutputs.find(u=>u.id===n.activeModal);if(a)return l.value=a;l.value=await Lt.outputs.get(n.activeModal)||t.currentOutputs[0]});function v(){i.value=!1}function o(){var g,m;if(!((g=l.value)!=null&&g.extra_avi))return;const a=l.value.extra_avi.split(",")[1];if(!a)return;const u=atob(a),h=u.length,c=new Uint8Array(h);for(let y=0;y{var h;return j(),we(C(LB),{"model-value":C(i),width:(h=l.value)==null?void 0:h.width,class:"image-viewer",onClosed:v,"align-center":""},{footer:pe(()=>[le(K2,{"image-data":l.value,"on-delete":v},null,8,["image-data"])]),default:pe(()=>{var c,f,s,d;return[re("div",{class:"main-output-container",ref_key:"target",ref:r},[re("div",EK,[(c=l.value)!=null&&c.image?(j(),ce("img",{key:0,src:l.value.image,alt:"Output image",style:{"max-width":"100%","max-height":"100%","object-fit":"contain"}},null,8,OK)):_e("",!0)])],512),re("div",AK,Ae(((f=l.value.prompt)==null?void 0:f.split("###")[0])||"Unknown Creation"),1),re("div",PK,[re("div",null,"Negative Prompt: "+Ae(((s=l.value.prompt)==null?void 0:s.split("###")[1])||"None"),1),re("span",null,"Model: "+Ae(l.value.modelName||"Unknown")+" - ",1),re("span",null,"Sampler: "+Ae(l.value.sampler_name||"Unknown")+" - ",1),re("span",null,"Seed: "+Ae(l.value.seed||"Unknown")+" - ",1),re("span",null,"Steps: "+Ae(l.value.steps||"Unknown")+" - ",1),re("span",null,"CFG Scale: "+Ae(l.value.cfg_scale||"Unknown")+" - ",1),re("span",null,"Clip Skip: "+Ae((d=l.value.clip_skip)!=null?d:"Unknown")+" - ",1),re("span",null,"Dimensions: "+Ae(l.value.width||"???")+"x"+Ae(l.value.height||"???")+" - ",1),re("span",null,"Frames: "+Ae(l.value.frames||"1"),1),l.value.extra_avi?(j(),ce("span",IK,[Ne(" - "),re("a",{href:"#",onClick:Ze(o,["prevent"]),style:{cursor:"pointer",color:"var(--el-color-primary)"}},"[Download AVI]",8,MK)])):_e("",!0)])]}),_:1},8,["model-value","width"])}}});const RK=e=>(Jr("data-v-8f4d2380"),e=e(),Qr(),e),DK=RK(()=>re("div",{style:{"font-size":"20px"}},"Stable UI",-1)),$K={class:"generator-icons"},BK=Ee({__name:"App",setup(e){const n=up(lp).smallerOrEqual("md"),r=$t();Gt();const i=zT(),l=se();return ke(()=>i.path,v=>{l.value&&l.value.open(v)}),(v,o)=>(j(),ce(ze,null,[re("div",{class:fe({"menu-container":!C(n)})},[le(C(Z1),{"default-active":C(i).path,mode:"horizontal",router:!0,ellipsis:!C(n),class:fe(C(n)?"mobile-menu":"menu"),ref_key:"menuRef",ref:l},{default:pe(()=>[C(n)?_e("",!0):(j(),we(C(Ep),{key:0,class:"remove-item-styling center-vertical"},{title:pe(()=>[DK]),_:1})),le(Wo,{isMobile:C(n),index:"/"},{icon:pe(()=>[re("div",$K,[le(C(De),null,{default:pe(()=>[le(C(q3))]),_:1}),C(r).showGeneratorBadge?(j(),we(C(De),{key:0,class:"generator-badge",size:10},{default:pe(()=>[le(UU)]),_:1})):_e("",!0)])]),title:pe(()=>[Ne("Generate")]),_:1},8,["isMobile"]),le(Wo,{isMobile:C(n),index:"/images"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(O3))]),_:1})]),title:pe(()=>[Ne("Images")]),_:1},8,["isMobile"]),le(Wo,{isMobile:C(n),index:"/about"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(Jb))]),_:1})]),title:pe(()=>[Ne("About")]),_:1},8,["isMobile"]),le(Wo,{isMobile:C(n),index:"/options"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(s4))]),_:1})]),title:pe(()=>[Ne("Options")]),_:1},8,["isMobile"]),le(Wo,{isMobile:C(n),index:"/return"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(Kb))]),_:1})]),title:pe(()=>[Ne("Return to Lite")]),_:1},8,["isMobile"])]),_:1},8,["default-active","ellipsis","class"])],2),re("div",{class:fe({view:!C(n)})},[le(C(Xb))],2),le(LK)],64))}});const FK=Yt(BK,[["__scopeId","data-v-8f4d2380"]]);const um=Ax(FK);um.use(Mx());um.use(Cs);um.mount("#app");Cs.replace("/");window.addEventListener("beforeunload",e=>{en().generating&&(e.preventDefault(),e.returnValue="")});const zK={key:1,class:"image-action"},NK=Ee({__name:"CustomImage",props:{imageData:null},setup(e){const t=e,n=$t(),r=se(null);bI(r,n.toggleMultiSelect,{modifiers:{prevent:!0}});const i=se(!1);NI(r,([{isIntersecting:v}])=>{v&&(i.value=v)},{rootMargin:"500px"});const l=ee(()=>n.selected.includes(t.imageData.id));return(v,o)=>(j(),ce("div",{class:"relative",ref_key:"containerRef",ref:r},[i.value?(j(),we(C(Tp),{key:0,class:"thumbnail",src:e.imageData.image,onClick:o[0]||(o[0]=a=>C(n).activeModal=e.imageData.id),fit:"cover",loading:"lazy",style:Fe(`${C(l)&&"opacity: 0.5"}`)},null,8,["src","style"])):_e("",!0),i.value?(j(),ce("div",zK,[e.imageData.starred?(j(),we(C(De),{key:0,class:"starred-icon",size:35,color:"var(--el-color-warning)"},{default:pe(()=>[le(C(n_))]),_:1})):_e("",!0),C(n).multiSelect?(j(),ce("div",{key:1,class:"select-container",onClick:o[1]||(o[1]=a=>C(n).toggleSelection(e.imageData.id))},[le(C(De),{class:"select-icon",size:35,color:`rgba(255, 255, 255, ${C(l)?"1":"0.5"})`},{default:pe(()=>[C(l)?_e("",!0):(j(),we(C(fl),{key:0})),C(l)?(j(),we(C(qb),{key:1})):_e("",!0)]),_:1},8,["color"])])):_e("",!0)])):_e("",!0)],512))}});const _y=Yt(NK,[["__scopeId","data-v-b9569bbd"]]);const jK={},VK={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024"},UK=re("path",{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-696 72h136v656H184V184zm656 656H384V384h456v456zM384 320V184h456v136H384z",fill:"currentColor"},null,-1),HK=[UK];function WK(e,t){return j(),ce("svg",VK,HK)}const YK=Yt(jK,[["render",WK]]),XK=e=>(Jr("data-v-301360a8"),e=e(),Qr(),e),KK={class:"images-top-bar"},GK={class:"options"},qK=["onClick"],ZK=["onClick"],JK=["onClick"],QK={key:1,class:"center-both",style:{gap:"12px"}},eG={key:2},tG=XK(()=>re("em",{style:{"font-size":"14px"}},"(long press to select multiple images)",-1)),nG=[tG],rG={key:0},iG={key:0,style:{display:"flex",gap:"8px"}},aG={key:1,class:"images"},oG={key:1},sG=Ee({__name:"ImagesView",setup(e){const{width:t}=qI(),n=wa(),r=Gt(),i=$t();function l(){i.selected=i.selected.filter(f=>!n.currentOutputs.map(s=>s.id).includes(f)),i.selected=[...i.selected,...n.currentOutputs.map(f=>f.id)],i.multiSelect=!0}async function v(){const f=await Lt.outputs.toCollection().primaryKeys();i.selected=f,i.multiSelect=!0}function o(){i.selected=i.selected.filter(f=>!n.currentOutputs.map(s=>s.id).includes(f)),i.selected.length===0&&(i.multiSelect=!1)}function a(){i.selected=[],i.multiSelect=!1}const u=()=>{uw.confirm(`This action will permanently delete ${i.selected.length} images. Continue?`,"Warning",{confirmButtonText:"OK",cancelButtonText:"Cancel",type:"warning"}).then(()=>{n.deleteMultipleOutputs(i.selected)})};ev(["a","A","ArrowLeft"],i.openModalToLeft),ev(["d","D","ArrowRight"],i.openModalToRight);async function h(){X2(i.selected)}const c=ee(()=>{let f=2;t.value>1440?f=6:t.value>1280?f=5:t.value>768?f=4:t.value>480&&(f=3);const s=[];for(let d=0;d(j(),ce(ze,null,[re("div",KK,[re("div",GK,[le(C(Xl),{placement:"bottom",title:"Sort By",trigger:"click",width:200,transition:"none","hide-after":0},{reference:pe(()=>[le(C(lt),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[le(C(zO))]),_:1})]),_:1})]),default:pe(()=>[(j(),ce(ze,null,Dt(["Newest","Oldest"],d=>re("div",{key:d,onClick:()=>C(n).sortBy=d,class:fe(`el-select-dropdown__item ${C(n).sortBy===d?"selected":""}`)},Ae(d),11,qK)),64))]),_:1}),le(C(Xl),{placement:"bottom",title:"Filter By",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[le(C(lt),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[le(C(jE))]),_:1})]),_:1})]),default:pe(()=>[(j(),ce(ze,null,Dt(["all","favourited","unfavourited","unrated"],d=>re("div",{key:d,onClick:()=>C(n).filterBy=d,class:fe(`el-select-dropdown__item ${C(n).filterBy===d?"selected":""}`)},Ae(C(n).filterBy===d?"Showing":"Show")+" "+Ae(d),11,ZK)),64))]),_:1}),le(C(Xl),{placement:"bottom",title:"Image Layout",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[le(C(lt),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[le(YK)]),_:1})]),_:1})]),default:pe(()=>[(j(),ce(ze,null,Dt([{label:"Square Grid",value:"grid"},{label:"Dynamic Layout",value:"dynamic"}],d=>re("div",{key:d.value,onClick:()=>C(n).currentLayout=d.value,class:fe(`el-select-dropdown__item ${C(n).currentLayout===d.value?"selected":""}`)},Ae(d.label),11,JK)),64))]),_:1}),le(C(Xl),{placement:"bottom",title:"Selection",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[le(C(lt),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[C(i).multiSelect?(j(),we(C(qb),{key:0})):(j(),we(C(fl),{key:1}))]),_:1})]),_:1})]),default:pe(()=>[C(i).multiSelect?(j(),ce("div",{key:0,class:"el-select-dropdown__item selected",onClick:s[0]||(s[0]=(...d)=>C(i).toggleMultiSelect&&C(i).toggleMultiSelect(...d))},"Disable multi-select")):(j(),ce("div",{key:1,class:"el-select-dropdown__item",onClick:s[1]||(s[1]=(...d)=>C(i).toggleMultiSelect&&C(i).toggleMultiSelect(...d))},"Enable multi-select")),C(i).selected.length>0?(j(),ce("div",{key:2,class:"el-select-dropdown__item selected",onClick:a},"Deselect All")):(j(),ce("div",{key:3,class:"el-select-dropdown__item",onClick:v},"Select All")),C(i).selected.every(d=>!C(n).currentOutputs.map(g=>g.id).includes(d))?(j(),ce("div",{key:5,class:"el-select-dropdown__item",onClick:l},"Select Page")):(j(),ce("div",{key:4,class:"el-select-dropdown__item selected",onClick:o},"Deselect Page"))]),_:1})]),C(r).pageless==="Disabled"?(j(),we(C(r9),{key:0,layout:"prev, pager, next",total:C(n).outputsLength,"page-size":C(r).pageSize,"current-page":C(n).currentPage,"onUpdate:currentPage":s[2]||(s[2]=d=>C(n).currentPage=d),"hide-on-single-page":""},null,8,["total","page-size","current-page"])):_e("",!0),C(i).multiSelect?(j(),ce("div",QK,[re("div",null,Ae(C(i).selected.length)+" selected",1),le(C(lt),{type:"danger",onClick:u,icon:C(Ec),plain:""},{default:pe(()=>[Ne("Delete")]),_:1},8,["icon"]),le(C(lt),{type:"success",onClick:h,icon:C(Ls),plain:"",style:{margin:"0"}},{default:pe(()=>[Ne("Download")]),_:1},8,["icon"])])):(j(),ce("div",eG,nG))]),C(n).outputsLength!=0?(j(),ce("div",rG,[C(n).currentLayout==="dynamic"?(j(),ce("div",iG,[(j(!0),ce(ze,null,Dt(C(c),(d,g)=>(j(),ce("div",{key:g,style:{flex:"1 1 0%"}},[(j(!0),ce(ze,null,Dt(d,m=>(j(),we(_y,{key:m.id,"image-data":m,style:{"margin-bottom":"8px"}},null,8,["image-data"]))),128))]))),128))])):_e("",!0),C(n).currentLayout==="grid"?(j(),ce("div",aG,[(j(!0),ce(ze,null,Dt(C(n).currentOutputs,d=>(j(),we(_y,{key:d.id,"image-data":d,style:{width:"200px",height:"200px"}},null,8,["image-data"]))),128))])):_e("",!0)])):_e("",!0),C(n).outputsLength==0?(j(),ce("div",oG,[le(C(kF),{description:"No Images Found"})])):_e("",!0)],64))}});const lG=Yt(sG,[["__scopeId","data-v-301360a8"]]),uG=Object.freeze(Object.defineProperty({__proto__:null,default:lG},Symbol.toStringTag,{value:"Module"})),cG=["href"],fG=Ee({__name:"BaseLink",props:{href:null,router:{type:Boolean}},setup(e){return(t,n)=>{const r=ht("router-link");return j(),ce(ze,null,[e.router?_e("",!0):(j(),ce("a",{key:0,target:"_blank",rel:"noreferrer noopener",href:e.href},[Te(t.$slots,"default",{},void 0,!0)],8,cG)),e.router?(j(),we(r,{key:1,to:e.href},{default:pe(()=>[Te(t.$slots,"default",{},void 0,!0)]),_:3},8,["to"])):_e("",!0)],64)}}});const dG=Yt(fG,[["__scopeId","data-v-17b53b7d"]]),Al=e=>(Jr("data-v-ecc278c5"),e=e(),Qr(),e),hG={class:"about"},pG={class:"about-content"},mG=Al(()=>re("h1",{style:{"margin-top":"0"}},"Stable UI",-1)),gG=Al(()=>re("div",null,[Ne("This tool was originally a front-end for the AI Horde and has since been converted for local generations with the A1111 API, such as in "),re("a",{href:"https://github.com/LostRuins/koboldcpp"},"KoboldCpp"),Ne(".")],-1)),vG=Al(()=>re("br",null,null,-1)),yG=Al(()=>re("div",null,"If you want to help improve this tool, you can find the currently maintained source code from this modified version on https://github.com/LostRuins/stable-ui and https://github.com/henk717/stable-ui, which is based off https://github.com/ayunami2000/stable-ui, which derives from the original AI Horde version on https://github.com/aqualxx/stable-ui (Original author aqualxx#5004). Feel free to contribute!",-1)),bG=Al(()=>re("br",null,null,-1)),_G=Ee({__name:"AboutView",setup(e){return(t,n)=>(j(),ce("div",hG,[re("div",pG,[mG,gG,vG,yG,bG,re("div",null,[Ne("You can find the KoboldAI community and authors of this fork on the "),le(dG,{href:"https://koboldai.org/discord"},{default:pe(()=>[Ne("KoboldAI Discord")]),_:1})])])]))}});const wG=Yt(_G,[["__scopeId","data-v-ecc278c5"]]),CG=Object.freeze(Object.defineProperty({__proto__:null,default:wG},Symbol.toStringTag,{value:"Module"}));const Ko=Ee({__name:"FormRadio",props:{label:null,modelValue:null,prop:null,useBoolean:{type:Boolean},options:null,disabled:{type:Boolean},info:null,labelStyle:null,change:null},emits:["update:modelValue"],setup(e,{emit:t}){const n=e;function r(l){if(n.useBoolean&&l==="Enabled"?t("update:modelValue",!0):n.useBoolean&&l==="Disabled"?t("update:modelValue",!1):t("update:modelValue",l),!!n.change)return n.useBoolean&&l==="Enabled"?n.change(!0):n.useBoolean&&l==="Disabled"?n.change(!1):n.change(l)}const i=ee(()=>n.useBoolean?n.modelValue===!0?"Enabled":n.modelValue===!1?"Disabled":n.modelValue:n.modelValue);return(l,v)=>(j(),we(C(xi),{prop:e.prop},{label:pe(()=>[le(xl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[Te(l.$slots,"label",{},()=>[Ne(Ae(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[le(C(_$),{disabled:e.disabled,"model-value":C(i),onChange:r},{default:pe(()=>[(j(!0),ce(ze,null,Dt(e.options,o=>(j(),we(C(w$),{key:o,label:o},null,8,["label"]))),128))]),_:1},8,["disabled","model-value"]),Te(l.$slots,"inline")]),_:3},8,["prop"]))}}),Pl=e=>(Jr("data-v-b37ed090"),e=e(),Qr(),e),SG=Pl(()=>re("h1",null,"Options",-1)),xG=Pl(()=>re("h2",null,"Generation Options",-1)),TG=Pl(()=>re("h2",null,"Image Options",-1)),kG=Pl(()=>re("div",null,[Ne("Drop file here OR "),re("em",null,"click to upload")],-1)),EG=Pl(()=>re("h2",null,"General Options",-1)),OG=Ee({__name:"OptionsView",setup(e){const t=Gt(),n=wa(),r=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"auto",label:"Auto"}],i=se([]),l=se(),v=se(!1),o=se(0);async function a(h){n.importFromZip(h),l.value.clearFiles()}async function u(){Ri({message:`Downloading ${n.outputsLength} image(s)... (this may take a while)`,type:"info"}),v.value=!0,o.value=0;const h=await Lt.outputs.toCollection().primaryKeys();await X2(h,!1,()=>{o.value++}),v.value=!1,o.value=0}return(h,c)=>(j(),ce(ze,null,[SG,le(C(xp),{"label-position":"top",model:C(t).options,onSubmit:c[9]||(c[9]=Ze(()=>{},["prevent"]))},{default:pe(()=>[le(C(Ej),{type:"border-card",style:{"min-height":"50vh"}},{default:pe(()=>[le(C(wf),{label:"\u{1F5A8}\uFE0F Generation"},{default:pe(()=>[xG,le(C(xi),{label:"Base URL"},{default:pe(()=>[le(C(La),{class:"apikey",prop:"baseURL",modelValue:C(t).baseURL,"onUpdate:modelValue":c[0]||(c[0]=f=>C(t).baseURL=f)},null,8,["modelValue"])]),_:1}),le(Ko,{label:"Allow Larger Params",prop:"pageless",modelValue:C(t).allowLargerParams,"onUpdate:modelValue":c[1]||(c[1]=f=>C(t).allowLargerParams=f),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(Ko,{label:"Video Gen: Request AVI download",prop:"pageless",modelValue:C(t).alsoRequestAvi,"onUpdate:modelValue":c[2]||(c[2]=f=>C(t).alsoRequestAvi=f),options:["Enabled","Disabled"]},null,8,["modelValue"])]),_:1}),le(C(wf),{label:"\u{1F4F7} Images"},{default:pe(()=>[TG,le(En,{label:"Images Per Page",prop:"pageSize",modelValue:C(t).pageSize,"onUpdate:modelValue":c[3]||(c[3]=f=>C(t).pageSize=f),min:10,max:50,step:5,disabled:C(t).pageless==="Enabled"},null,8,["modelValue","disabled"]),le(Ko,{label:"Pageless Format",prop:"pageless",modelValue:C(t).pageless,"onUpdate:modelValue":c[4]||(c[4]=f=>C(t).pageless=f),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(Ko,{label:"Carousel Auto Cycle",prop:"autoCarousel",modelValue:C(t).autoCarousel,"onUpdate:modelValue":c[5]||(c[5]=f=>C(t).autoCarousel=f),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(Ko,{label:"Image Download Format",prop:"downloadType",modelValue:C(t).imageDownloadType,"onUpdate:modelValue":c[6]||(c[6]=f=>C(t).imageDownloadType=f),options:["PNG","JPG","WEBP","GIF"]},null,8,["modelValue"]),le(C(xi),{label:"Export Images (ZIP File)"},{default:pe(()=>[v.value?(j(),we(C(lt),{key:1,icon:C(Ls),disabled:""},{default:pe(()=>[Ne("Downloading... ("+Ae(o.value)+" / "+Ae(C(n).outputsLength)+" image(s))",1)]),_:1},8,["icon"])):(j(),we(C(lt),{key:0,icon:C(Ls),onClick:c[7]||(c[7]=f=>u())},{default:pe(()=>[Ne("Download "+Ae(C(n).outputsLength)+" image(s)",1)]),_:1},8,["icon"]))]),_:1}),le(C(xi),{label:"Import Images (ZIP File)"},{default:pe(()=>[le(C(Pp),{drag:"",ref_key:"upload",ref:l,"auto-upload":!1,onChange:a,"file-list":i.value,limit:1,multiple:""},{default:pe(()=>[le(C(De),{size:100},{default:pe(()=>[le(C(Kh))]),_:1}),kG]),_:1},8,["file-list"])]),_:1})]),_:1}),le(C(wf),{label:"\u2699\uFE0F General"},{default:pe(()=>[EG,le(Au,{label:"Color Scheme",prop:"colorScheme",modelValue:C(t).options.colorMode,"onUpdate:modelValue":c[8]||(c[8]=f=>C(t).options.colorMode=f),options:r},null,8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["model"])],64))}});const AG=Yt(OG,[["__scopeId","data-v-b37ed090"]]),PG=Object.freeze(Object.defineProperty({__proto__:null,default:AG},Symbol.toStringTag,{value:"Module"})); +`&&d>0?(c=0,f++,h++):!this.splitByGrapheme&&this._reSpaceAndTab.test(u.graphemeText[f])&&d>0&&(c++,f++),s[d]={line:h,offset:c},f+=u.graphemeLines[d].length,c+=u.graphemeLines[d].length;return s},styleHas:function(u,h){if(this._styleMap&&!this.isWrapping){var c=this._styleMap[h];c&&(h=c.line)}return a.Text.prototype.styleHas.call(this,u,h)},isEmptyStyles:function(u){if(!this.styles)return!0;var h=0,c=u+1,f,s,d=!1,g=this._styleMap[u],m=this._styleMap[u+1];g&&(u=g.line,h=g.offset),m&&(c=m.line,d=c===u,f=m.offset),s=typeof u>"u"?this.styles:{line:this.styles[u]};for(var y in s)for(var b in s[y])if(b>=h&&(!d||bc&&!O?(g.push(m),m=[],s=S,O=!0):s+=A,!O&&!d&&m.push(w),m=m.concat(b),x=d?0:this._measureWord([w],h,_),_++,O=!1,S>T&&(T=S);return N&&g.push(m),T+D>this.dynamicMinWidth&&(this.dynamicMinWidth=T-A+D),g},isEndOfWrapping:function(u){return!this._styleMap[u+1]||this._styleMap[u+1].line!==this._styleMap[u].line},missingNewlineOffset:function(u){return this.splitByGrapheme?this.isEndOfWrapping(u)?1:0:1},_splitTextIntoLines:function(u){for(var h=a.Text.prototype._splitTextIntoLines.call(this,u),c=this._wrapText(h.lines,this.width),f=new Array(c.length),s=0;s{const e=()=>({canvas:void 0,brush:void 0,visibleImageLayer:void 0,imageLayer:void 0,visibleDrawLayer:void 0,drawLayer:void 0,cropPreviewLayer:void 0,maskPathColor:"",maskBackgroundColor:"",imageScale:1,undoHistory:[],redoHistory:[],drawing:!1}),t=se({...e(),maskPathColor:"white",maskBackgroundColor:"black"}),n=se({...e(),maskPathColor:"black",maskBackgroundColor:"white"}),r=ee(()=>en().generatorType==="Inpainting"),i=ee(()=>r.value?t.value:n.value),l=ee(()=>en().currentImageProps),v=ee({get:()=>i.value.drawing&&!r.value,set:z=>i.value.drawing=z}),o=se(512),a=se(512),u=se(!1),h=se(30),c=se(!1),f=new Jn.fabric.Circle({radius:h.value,left:0,originX:"center",originY:"center",angle:0,fill:"",stroke:"red",strokeWidth:3,opacity:0}),s=se("Erase"),d=se("rgb(0, 0, 0, 1)");function g(){!i.value.canvas||i.value.canvas.renderAll()}function m(){u.value=!u.value,s.value=u.value?"Draw":"Erase"}function y(z=null){!i.value.canvas||(i.value.brush=i.value.canvas.freeDrawingBrush,i.value.brush.color=z||i.value.brush.color,i.value.brush.width=h.value)}async function b({history:z,erase:M=!1,draw:L=!1}={}){if(!z||!i.value.drawLayer||!i.value.visibleDrawLayer||!i.value.imageLayer||!i.value.visibleImageLayer||!i.value.canvas)return;z.path.selectable=!1,z.path.opacity=1,z.drawPath=await Q(z.path),z.visibleDrawPath=await Q(z.path),M?(z.visibleDrawPath.globalCompositeOperation="destination-out",z.drawPath.stroke=i.value.maskBackgroundColor):(z.visibleDrawPath.globalCompositeOperation="source-over",z.drawPath.stroke=L?d.value:i.value.maskPathColor);let J=await Q(z.drawPath);J=J.scale(i.value.imageScale),J.left=J.left+z.drawPath.left*(i.value.imageScale-1),J.top=J.top+z.drawPath.top*(i.value.imageScale-1),L?(i.value.imageLayer.add(J),i.value.visibleImageLayer.addWithUpdate(z.visibleDrawPath)):(i.value.drawLayer.add(J),i.value.visibleDrawLayer.addWithUpdate(z.visibleDrawPath)),i.value.canvas.remove(z.path),g()}function _(){if(i.value.undoHistory.length===0)return;const z=i.value.undoHistory.pop();b({history:z,erase:!1,draw:v.value}),i.value.redoHistory.push(z)}function w(){if(i.value.redoHistory.length===0||!i.value.drawLayer||!i.value.visibleDrawLayer||!i.value.imageLayer||!i.value.visibleImageLayer||!i.value.canvas)return;const z=i.value.redoHistory.pop();i.value.undoHistory.push(z),v.value?(i.value.imageLayer.remove(z.drawPath),i.value.visibleImageLayer.remove(z.visibleDrawPath)):(i.value.drawLayer.remove(z.drawPath),i.value.visibleDrawLayer.remove(z.visibleDrawPath)),delete z.drawPath,delete z.visibleDrawPath,g()}function S(z){i.value.canvas=new Jn.fabric.Canvas(z,{isDrawingMode:!1,width:o.value,height:a.value,backgroundColor:"white"}),i.value.canvas.selection=!1,i.value.canvas.freeDrawingCursor="crosshair",y(i.value.maskPathColor),i.value.canvas.on("mouse:move",I),i.value.canvas.on("path:created",ue),g()}function x(z,M,L,J){let V=J,P=J;return M>L?(z.scaleToWidth(J),V=J*(a.value/o.value)):(z.scaleToHeight(J),P=J*(o.value/a.value)),{newHeight:V,newWidth:P}}function T(z){const M=en();if(E(),z.selectable=!1,o.value=z.width,a.value=z.height,o.value>M.maxDimensions||a.value>M.maxDimensions){const{newHeight:J,newWidth:V}=x(z,o.value,a.value,M.maxDimensions);o.value=V,a.value=J}if(o.value{o.value>a.value?i.value.imageScale=o.value/L:i.value.imageScale=a.value/L,i.value.imageLayer=R({image:J,layerHeight:J.height,layerWidth:J.width})}),z.cloneAsImage(J=>{if(!i.value.canvas)return;if(o.value!==L||a.value!==L){const{newHeight:q,newWidth:Z}=x(J,o.value,a.value,L);o.value=Z,a.value=q}i.value.canvas.setWidth(o.value),i.value.canvas.setHeight(a.value),i.value.canvas.isDrawingMode=!0,i.value.visibleDrawLayer=B(),i.value.visibleImageLayer=B({image:J}),i.value.drawLayer=R();const V=o.value*i.value.imageScale,P=a.value*i.value.imageScale;M.params.width=V-V%64,M.params.height=P-P%64,i.value.visibleDrawLayer.set("opacity",.8),i.value.canvas.add(i.value.visibleImageLayer),i.value.canvas.add(i.value.visibleDrawLayer),i.value.canvas.add(f),c.value=!0,D(),O()})}function O(){const z=en();if(!i.value.imageLayer||!i.value.drawLayer)return;const M=i.value.imageLayer.getCenter().left-z.params.width/2,L=z.params.width,J=i.value.imageLayer.getCenter().top-z.params.height/2,V=z.params.height,P={format:"jpeg",quality:1,left:M,top:J,width:L,height:V};l.value.sourceImage=i.value.imageLayer.toDataURL(P),l.value.maskImage=i.value.redoHistory.length===0||v.value?void 0:i.value.drawLayer.toDataURL(P).split(",")[1]}let A;function D(){if(!i.value.canvas)return;const z=en();i.value.cropPreviewLayer&&(i.value.canvas.remove(i.value.cropPreviewLayer),i.value.cropPreviewLayer=void 0),c.value&&(i.value.cropPreviewLayer=B({layerWidth:z.params.width/i.value.imageScale,layerHeight:z.params.height/i.value.imageScale,fill:"rgba(100, 0, 0, 0.5)"}),i.value.canvas.centerObject(i.value.cropPreviewLayer),i.value.canvas.add(i.value.cropPreviewLayer),A&&clearTimeout(A),A=setTimeout(()=>{c.value=!1,D(),A=void 0},5e3))}function N(z,M){const L="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+P///38ACfsD/QVDRcoAAAAASUVORK5CYII=";Jn.fabric.Image.fromURL(L,J=>{J.set({height:z,width:M});const V=J.toDataURL({format:"png"});l.value.sourceImage=V,v.value=!0,T(J)})}function R({image:z,layerWidth:M,layerHeight:L}={}){const J=new Jn.fabric.Canvas(null);return J.selection=!1,J.backgroundColor=i.value.maskBackgroundColor,J.setHeight(L||a.value),J.setWidth(M||o.value),z&&J.add(z),J}function B({image:z,layerWidth:M,layerHeight:L,fill:J,abosolute:V}={}){const P=z||new Jn.fabric.Rect({width:M||o.value,height:L||a.value,left:0,top:0,fill:J||"transparent",absolutePositioned:V||!0,selectable:!1});return new Jn.fabric.Group([P],{selectable:!1,absolutePositioned:V||!0})}function E(){!i.value.canvas||(i.value.visibleImageLayer&&(i.value.canvas.remove(i.value.visibleImageLayer),i.value.visibleImageLayer=void 0),i.value.visibleDrawLayer&&(i.value.canvas.remove(i.value.visibleDrawLayer),i.value.visibleDrawLayer=void 0),i.value.imageLayer=void 0,i.value.drawLayer=void 0,i.value.redoHistory=[],i.value.undoHistory=[],i.value.canvas.isDrawingMode=!1)}function U(){if(!!i.value.canvas){if(i.value.visibleDrawLayer&&(i.value.canvas.remove(i.value.visibleDrawLayer),i.value.visibleDrawLayer=void 0),v.value){const z=en();N(z.params.height||512,z.params.width||512)}i.value.drawLayer=void 0,i.value.redoHistory=[],i.value.undoHistory=[],i.value.visibleDrawLayer=B(),i.value.drawLayer=R(),i.value.visibleDrawLayer.set("opacity",.8),i.value.canvas.add(i.value.visibleDrawLayer)}}function ne(){var M;O();const z=document.createElement("a");if(v.value){z.href="data:image/png;base64,"+((M=l.value.sourceImage)==null?void 0:M.split(",")[1]),z.download="image_drawing.png",z.click();return}z.href="data:image/png;base64,"+l.value.maskImage,z.download="image_mask.png",z.click()}async function Q(z){return new Promise((M,L)=>{try{z.clone(M)}catch(J){L(J)}})}async function ue(z){const M={path:z.path};b({history:M,erase:u.value,draw:v.value}),i.value.redoHistory.push(M)}function I(z){if(!i.value.canvas)return;const M=i.value.canvas.getPointer(z.e);f.left=M.x,f.top=M.y,f.opacity=.8,u.value?(f.set("strokeWidth",3),f.set("fill",""),y("red")):(f.set("strokeWidth",0),v.value?(f.set("fill",d.value),y(d.value)):(f.set("fill","white"),y("white"))),f.set("radius",h.value/2),g()}return{showCropPreview:c,erasing:u,switchToolText:s,brushSize:h,drawColor:d,drawing:v,imageProps:i,updateCropPreview:D,createNewCanvas:S,downloadMask:ne,resetCanvas:E,resetDrawing:U,flipErase:m,undoAction:w,redoAction:_,newImage:T,newBlankImage:N,setBrush:y,saveImages:O}});const DH={},$H={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 20 20"},BH=re("g",{fill:"none"},[re("path",{d:"M11.197 2.44a1.5 1.5 0 0 1 2.121 0l4.243 4.242a1.5 1.5 0 0 1 0 2.121L9.364 17H14.5a.5.5 0 0 1 0 1H7.82a1.496 1.496 0 0 1-1.14-.437L2.437 13.32a1.5 1.5 0 0 1 0-2.121l8.76-8.76zm1.414.706a.5.5 0 0 0-.707 0L5.538 9.512l4.95 4.95l6.366-6.366a.5.5 0 0 0 0-.707L12.61 3.146zM9.781 15.17l-4.95-4.95l-1.687 1.687a.5.5 0 0 0 0 .707l4.243 4.243a.5.5 0 0 0 .707 0l1.687-1.687z",fill:"currentColor"})],-1),FH=[BH];function zH(e,t){return j(),ce("svg",$H,FH)}const NH=Yt(DH,[["render",zH]]);async function jH(e,t){const n=document.createElement("canvas"),r=n.getContext("2d"),i=new Image;return i.src=e,await new Promise(v=>i.onload=v),n.width=i.width,n.height=i.height,r==null||r.drawImage(i,0,0),n.toDataURL(t)}async function VH(e,t){const n=e.split(";base64,"),r=t!=null?t:n[0].split(":")[1],i=window.atob(r===n[0].split(":")[1]?n[1]:(await jH(e,r)).split(",")[1]),l=new Uint8Array(i.length);for(let v=0;v{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=i=>n(i),r.readAsDataURL(e)})}const em=e=>(Jr("data-v-d200c279"),e=e(),Qr(),e),UH=em(()=>re("div",null,[Ne("Drop file here OR "),re("em",null,"click to upload")],-1)),HH={key:0},WH=em(()=>re("div",{class:"center-horizontal",style:{"margin-top":"5px"}},"OR",-1)),YH={class:"canvas-container"},XH=em(()=>re("canvas",{id:"canvas"},null,-1)),KH={class:"action-buttons",style:{left:"10px",right:"unset"}},GH={class:"action-buttons"},qH=Ee({__name:"CustomCanvas",setup(e){const t=en(),n=$t(),r=ys(),i=se();async function l(o){if(!o.raw.type.includes("image")){n.raiseError("Uploaded file needs to be a image!",!1),i.value.clearFiles();return}const a=await l2(o.raw);t.currentImageProps.sourceImage=a,r.drawing=!1,Jn.fabric.Image.fromURL(a,r.newImage)}function v(){t.currentImageProps.sourceImage="",r.resetCanvas()}return qe(()=>{r.createNewCanvas("canvas"),t.currentImageProps.sourceImage&&Jn.fabric.Image.fromURL(t.currentImageProps.sourceImage,r.newImage)}),(o,a)=>(j(),ce(ze,null,[C(t).currentImageProps.sourceImage?_e("",!0):(j(),we(C(Pp),{key:0,drag:"",ref_key:"upload",ref:i,"auto-upload":!1,onChange:l,limit:1,multiple:""},{tip:pe(()=>[C(t).generatorType==="Img2Img"?(j(),ce("div",HH,[WH,re("div",{class:"center-both",style:{cursor:"pointer","text-decoration":"underline","font-size":"1rem"},onClick:a[0]||(a[0]=u=>C(r).newBlankImage(C(t).params.height||512,C(t).params.width||512))},[le(C(De),{size:20,style:{"margin-right":"2px"}},{default:pe(()=>[le(a2)]),_:1}),Ne("draw something")])])):_e("",!0)]),default:pe(()=>[le(C(De),{size:100},{default:pe(()=>[le(C(Kh))]),_:1}),UH]),_:1},512)),gt(re("div",null,[re("div",YH,[XH,re("div",KH,[le(C(lt),{onClick:a[1]||(a[1]=u=>C(r).undoAction()),icon:C(e_),plain:"",disabled:C(r).imageProps.redoHistory.length===0},null,8,["icon","disabled"]),le(C(lt),{onClick:a[2]||(a[2]=u=>C(r).redoAction()),icon:C(t_),plain:"",disabled:C(r).imageProps.undoHistory.length===0},null,8,["icon","disabled"])]),re("div",GH,[le(C(lt),{onClick:a[3]||(a[3]=u=>C(r).resetDrawing()),icon:C(wr),plain:""},null,8,["icon"]),le(C(lt),{onClick:v,icon:C(Ec),plain:""},null,8,["icon"]),le(C(lt),{onClick:a[4]||(a[4]=u=>C(r).downloadMask()),icon:C(Ls),plain:""},null,8,["icon"]),le(C(lt),{onClick:a[5]||(a[5]=u=>C(r).flipErase()),icon:C(r).erasing?C(DE):NH,plain:""},null,8,["icon"]),C(r).drawing?(j(),we(C(mB),{key:0,modelValue:C(r).drawColor,"onUpdate:modelValue":a[6]||(a[6]=u=>C(r).drawColor=u),"show-alpha":""},null,8,["modelValue"])):_e("",!0)]),le(C(xp),{"label-width":"110px",style:{"margin-top":"10px"}},{default:pe(()=>[le(En,{style:{"margin-bottom":"5px"},label:"Brush Size",prop:"brushSize",modelValue:C(r).brushSize,"onUpdate:modelValue":a[7]||(a[7]=u=>C(r).brushSize=u),min:10,max:100,step:10,change:C(r).setBrush},null,8,["modelValue","change"])]),_:1})])],512),[[Rt,C(t).currentImageProps.sourceImage]])],64))}});const I0=Yt(qH,[["__scopeId","data-v-d200c279"]]),ZH={class:"centerIcons"},JH={class:"stackedIcons"},QH=Ee({__name:"StackedIcon",props:{iconOne:null,iconTwo:null,size:null},setup(e){const t=e;return dx(n=>({"2ad037ca":e.size+"px"})),(n,r)=>(j(),ce("div",ZH,[re("div",JH,[le(C(De),{class:"firstIcon",size:e.size},{default:pe(()=>[(j(),we(_t(t.iconOne)))]),_:1},8,["size"]),le(C(De),{class:"secondIcon",size:e.size},{default:pe(()=>[(j(),we(_t(t.iconTwo)))]),_:1},8,["size"])])]))}});const eW=Yt(QH,[["__scopeId","data-v-74586a39"]]),tW={key:1,style:{width:"40px"}},nu=Ee({__name:"GeneratorMenuItem",props:{index:null,iconOne:null,iconTwo:null,isMobile:{type:Boolean}},setup(e){const t=e;return(n,r)=>(j(),we(C(kr),{content:e.index,placement:e.isMobile?"bottom":"right",enterable:!1,"hide-after":100},{default:pe(()=>[le(C(Ep),{index:e.index,style:{height:"60px",display:"flex","justify-content":"center"}},{default:pe(()=>[e.iconTwo?(j(),we(eW,{key:0,iconOne:e.iconOne,iconTwo:e.iconTwo,size:40},null,8,["iconOne","iconTwo"])):(j(),ce("div",tW,[le(C(De),{style:{width:"35px"},size:40},{default:pe(()=>[(j(),we(_t(t.iconOne)))]),_:1})]))]),_:1},8,["index"])]),_:1},8,["content","placement"]))}});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const nW=4,M0=0,L0=1,rW=2;function Lo(e){let t=e.length;for(;--t>=0;)e[t]=0}const iW=0,u2=1,aW=2,oW=3,sW=258,tm=29,Tl=256,el=Tl+1+tm,ro=30,nm=19,c2=2*el+1,oa=15,Lf=16,lW=7,rm=256,f2=16,d2=17,h2=18,lh=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Pu=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),uW=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),p2=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),cW=512,Fr=new Array((el+2)*2);Lo(Fr);const bs=new Array(ro*2);Lo(bs);const tl=new Array(cW);Lo(tl);const nl=new Array(sW-oW+1);Lo(nl);const im=new Array(tm);Lo(im);const sc=new Array(ro);Lo(sc);function Rf(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let m2,g2,v2;function Df(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const y2=e=>e<256?tl[e]:tl[256+(e>>>7)],rl=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},yn=(e,t,n)=>{e.bi_valid>Lf-n?(e.bi_buf|=t<>Lf-e.bi_valid,e.bi_valid+=n-Lf):(e.bi_buf|=t<{yn(e,n[t*2],n[t*2+1])},b2=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},fW=e=>{e.bi_valid===16?(rl(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},dW=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,l=t.stat_desc.has_stree,v=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,a=t.stat_desc.max_length;let u,h,c,f,s,d,g=0;for(f=0;f<=oa;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;ua&&(f=a,g++),n[h*2+1]=f,!(h>r)&&(e.bl_count[f]++,s=0,h>=o&&(s=v[h-o]),d=n[h*2],e.opt_len+=d*(f+s),l&&(e.static_len+=d*(i[h*2+1]+s)));if(g!==0){do{for(f=a-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[a]--,g-=2}while(g>0);for(f=a;f!==0;f--)for(h=e.bl_count[f];h!==0;)c=e.heap[--u],!(c>r)&&(n[c*2+1]!==f&&(e.opt_len+=(f-n[c*2+1])*n[c*2],n[c*2+1]=f),h--)}},_2=(e,t,n)=>{const r=new Array(oa+1);let i=0,l,v;for(l=1;l<=oa;l++)i=i+n[l-1]<<1,r[l]=i;for(v=0;v<=t;v++){let o=e[v*2+1];o!==0&&(e[v*2]=b2(r[o]++,o))}},hW=()=>{let e,t,n,r,i;const l=new Array(oa+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?rl(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},R0=(e,t,n,r)=>{const i=t*2,l=n*2;return e[i]{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i{let r,i,l=0,v,o;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+l++]&255,r+=(e.pending_buf[e.sym_buf+l++]&255)<<8,i=e.pending_buf[e.sym_buf+l++],r===0?mr(e,i,t):(v=nl[i],mr(e,v+Tl+1,t),o=lh[v],o!==0&&(i-=im[v],yn(e,i,o)),r--,v=y2(r),mr(e,v,n),o=Pu[v],o!==0&&(r-=sc[v],yn(e,r,o)));while(l{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,l=t.stat_desc.elems;let v,o,a=-1,u;for(e.heap_len=0,e.heap_max=c2,v=0;v>1;v>=1;v--)$f(e,n,v);u=l;do v=e.heap[1],e.heap[1]=e.heap[e.heap_len--],$f(e,n,1),o=e.heap[1],e.heap[--e.heap_max]=v,e.heap[--e.heap_max]=o,n[u*2]=n[v*2]+n[o*2],e.depth[u]=(e.depth[v]>=e.depth[o]?e.depth[v]:e.depth[o])+1,n[v*2+1]=n[o*2+1]=u,e.heap[1]=u++,$f(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],dW(e,t),_2(n,a,e.bl_count)},$0=(e,t,n)=>{let r,i=-1,l,v=t[0*2+1],o=0,a=7,u=4;for(v===0&&(a=138,u=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)l=v,v=t[(r+1)*2+1],!(++o{let r,i=-1,l,v=t[0*2+1],o=0,a=7,u=4;for(v===0&&(a=138,u=3),r=0;r<=n;r++)if(l=v,v=t[(r+1)*2+1],!(++o{let t;for($0(e,e.dyn_ltree,e.l_desc.max_code),$0(e,e.dyn_dtree,e.d_desc.max_code),uh(e,e.bl_desc),t=nm-1;t>=3&&e.bl_tree[p2[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},mW=(e,t,n,r)=>{let i;for(yn(e,t-257,5),yn(e,n-1,5),yn(e,r-4,4),i=0;i{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return M0;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return L0;for(n=32;n{F0||(hW(),F0=!0),e.l_desc=new Df(e.dyn_ltree,m2),e.d_desc=new Df(e.dyn_dtree,g2),e.bl_desc=new Df(e.bl_tree,v2),e.bi_buf=0,e.bi_valid=0,w2(e)},S2=(e,t,n,r)=>{yn(e,(iW<<1)+(r?1:0),3),C2(e),rl(e,n),rl(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},yW=e=>{yn(e,u2<<1,3),mr(e,rm,Fr),fW(e)},bW=(e,t,n,r)=>{let i,l,v=0;e.level>0?(e.strm.data_type===rW&&(e.strm.data_type=gW(e)),uh(e,e.l_desc),uh(e,e.d_desc),v=pW(e),i=e.opt_len+3+7>>>3,l=e.static_len+3+7>>>3,l<=i&&(i=l)):i=l=n+5,n+4<=i&&t!==-1?S2(e,t,n,r):e.strategy===nW||l===i?(yn(e,(u2<<1)+(r?1:0),3),D0(e,Fr,bs)):(yn(e,(aW<<1)+(r?1:0),3),mW(e,e.l_desc.max_code+1,e.d_desc.max_code+1,v+1),D0(e,e.dyn_ltree,e.dyn_dtree)),w2(e),r&&C2(e)},_W=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(nl[n]+Tl+1)*2]++,e.dyn_dtree[y2(t)*2]++),e.sym_next===e.sym_end);var wW=vW,CW=S2,SW=bW,xW=_W,TW=yW,kW={_tr_init:wW,_tr_stored_block:CW,_tr_flush_block:SW,_tr_tally:xW,_tr_align:TW};const EW=(e,t,n,r)=>{let i=e&65535|0,l=e>>>16&65535|0,v=0;for(;n!==0;){v=n>2e3?2e3:n,n-=v;do i=i+t[r++]|0,l=l+i|0;while(--v);i%=65521,l%=65521}return i|l<<16|0};var il=EW;const OW=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},AW=new Uint32Array(OW()),PW=(e,t,n,r)=>{const i=AW,l=r+n;e^=-1;for(let v=r;v>>8^i[(e^t[v])&255];return e^-1};var Vt=PW,Ca={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Ro={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:IW,_tr_stored_block:ch,_tr_flush_block:MW,_tr_tally:Ti,_tr_align:LW}=kW,{Z_NO_FLUSH:ki,Z_PARTIAL_FLUSH:RW,Z_FULL_FLUSH:DW,Z_FINISH:jn,Z_BLOCK:z0,Z_OK:Kt,Z_STREAM_END:N0,Z_STREAM_ERROR:br,Z_DATA_ERROR:$W,Z_BUF_ERROR:Bf,Z_DEFAULT_COMPRESSION:BW,Z_FILTERED:FW,Z_HUFFMAN_ONLY:ru,Z_RLE:zW,Z_FIXED:NW,Z_DEFAULT_STRATEGY:jW,Z_UNKNOWN:VW,Z_DEFLATED:Uc}=Ro,UW=9,HW=15,WW=8,YW=29,XW=256,fh=XW+1+YW,KW=30,GW=19,qW=2*fh+1,ZW=15,nt=3,wi=258,_r=wi+nt+1,JW=32,bo=42,am=57,dh=69,hh=73,ph=91,mh=103,sa=113,es=666,dn=1,Do=2,Sa=3,$o=4,QW=3,la=(e,t)=>(e.msg=Ca[t],t),j0=e=>e*2-(e>4?9:0),yi=e=>{let t=e.length;for(;--t>=0;)e[t]=0},eY=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)};let tY=(e,t,n)=>(t<{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},Ln=(e,t)=>{MW(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,On(e.strm)},dt=(e,t)=>{e.pending_buf[e.pending++]=t},Xo=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},gh=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=il(e.adler,t,i,n):e.state.wrap===2&&(e.adler=Vt(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},x2=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,l,v=e.prev_length,o=e.nice_match;const a=e.strstart>e.w_size-_r?e.strstart-(e.w_size-_r):0,u=e.window,h=e.w_mask,c=e.prev,f=e.strstart+wi;let s=u[r+v-1],d=u[r+v];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do if(i=t,!(u[i+v]!==d||u[i+v-1]!==s||u[i]!==u[r]||u[++i]!==u[r+1])){r+=2,i++;do;while(u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&rv){if(e.match_start=t,v=l,l>=o)break;s=u[r+v-1],d=u[r+v]}}while((t=c[t&h])>a&&--n!==0);return v<=e.lookahead?v:e.lookahead},_o=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-_r)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),eY(e),r+=t),e.strm.avail_in===0)break;if(n=gh(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=nt)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Ei(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Ei(e,e.ins_h,e.window[i+nt-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,l,v=0,o=e.strm.avail_in;do{if(r=65535,l=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>l&&(r=l),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,On(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(gh(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(v===0);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_waterl&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,l+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),l>e.strm.avail_in&&(l=e.strm.avail_in),l&&(gh(e.strm,e.window,e.strstart,l),e.strstart+=l,e.insert+=l>e.w_size-e.insert?e.w_size-e.insert:l),e.high_water>3,l=e.pending_buf_size-l>65535?65535:e.pending_buf_size-l,n=l>e.w_size?e.w_size:l,i=e.strstart-e.block_start,(i>=n||(i||t===jn)&&t!==ki&&e.strm.avail_in===0&&i<=l)&&(r=i>l?l:i,v=t===jn&&e.strm.avail_in===0&&r===i?1:0,ch(e,e.block_start,r,v),e.block_start+=r,On(e.strm)),v?Sa:dn)},Ff=(e,t)=>{let n,r;for(;;){if(e.lookahead<_r){if(_o(e),e.lookahead<_r&&t===ki)return dn;if(e.lookahead===0)break}if(n=0,e.lookahead>=nt&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+nt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-_r&&(e.match_length=x2(e,n)),e.match_length>=nt)if(r=Ti(e,e.strstart-e.match_start,e.match_length-nt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=nt){e.match_length--;do e.strstart++,e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+nt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+1]);else r=Ti(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Ln(e,!1),e.strm.avail_out===0))return dn}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead<_r){if(_o(e),e.lookahead<_r&&t===ki)return dn;if(e.lookahead===0)break}if(n=0,e.lookahead>=nt&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+nt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=nt-1,n!==0&&e.prev_length4096)&&(e.match_length=nt-1)),e.prev_length>=nt&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-nt,r=Ti(e,e.strstart-1-e.prev_match,e.prev_length-nt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+nt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=nt-1,e.strstart++,r&&(Ln(e,!1),e.strm.avail_out===0))return dn}else if(e.match_available){if(r=Ti(e,0,e.window[e.strstart-1]),r&&Ln(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return dn}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Ti(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let n,r,i,l;const v=e.window;for(;;){if(e.lookahead<=wi){if(_o(e),e.lookahead<=wi&&t===ki)return dn;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=nt&&e.strstart>0&&(i=e.strstart-1,r=v[i],r===v[++i]&&r===v[++i]&&r===v[++i])){l=e.strstart+wi;do;while(r===v[++i]&&r===v[++i]&&r===v[++i]&&r===v[++i]&&r===v[++i]&&r===v[++i]&&r===v[++i]&&r===v[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=nt?(n=Ti(e,1,e.match_length-nt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Ti(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Ln(e,!1),e.strm.avail_out===0))return dn}return e.insert=0,t===jn?(Ln(e,!0),e.strm.avail_out===0?Sa:$o):e.sym_next&&(Ln(e,!1),e.strm.avail_out===0)?dn:Do},rY=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(_o(e),e.lookahead===0)){if(t===ki)return dn;break}if(e.match_length=0,n=Ti(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Ln(e,!1),e.strm.avail_out===0))return dn}return e.insert=0,t===jn?(Ln(e,!0),e.strm.avail_out===0?Sa:$o):e.sym_next&&(Ln(e,!1),e.strm.avail_out===0)?dn:Do};function fr(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const ts=[new fr(0,0,0,0,T2),new fr(4,4,8,4,Ff),new fr(4,5,16,8,Ff),new fr(4,6,32,32,Ff),new fr(4,4,16,16,Ua),new fr(8,16,32,32,Ua),new fr(8,16,128,128,Ua),new fr(8,32,128,256,Ua),new fr(32,128,258,1024,Ua),new fr(32,258,258,4096,Ua)],iY=e=>{e.window_size=2*e.w_size,yi(e.head),e.max_lazy_match=ts[e.level].max_lazy,e.good_match=ts[e.level].good_length,e.nice_match=ts[e.level].nice_length,e.max_chain_length=ts[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=nt-1,e.match_available=0,e.ins_h=0};function aY(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Uc,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(qW*2),this.dyn_dtree=new Uint16Array((2*KW+1)*2),this.bl_tree=new Uint16Array((2*GW+1)*2),yi(this.dyn_ltree),yi(this.dyn_dtree),yi(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(ZW+1),this.heap=new Uint16Array(2*fh+1),yi(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*fh+1),yi(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const kl=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==bo&&t.status!==am&&t.status!==dh&&t.status!==hh&&t.status!==ph&&t.status!==mh&&t.status!==sa&&t.status!==es?1:0},k2=e=>{if(kl(e))return la(e,br);e.total_in=e.total_out=0,e.data_type=VW;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?am:t.wrap?bo:sa,e.adler=t.wrap===2?0:1,t.last_flush=-2,IW(t),Kt},E2=e=>{const t=k2(e);return t===Kt&&iY(e.state),t},oY=(e,t)=>kl(e)||e.state.wrap!==2?br:(e.state.gzhead=t,Kt),O2=(e,t,n,r,i,l)=>{if(!e)return br;let v=1;if(t===BW&&(t=6),r<0?(v=0,r=-r):r>15&&(v=2,r-=16),i<1||i>UW||n!==Uc||r<8||r>15||t<0||t>9||l<0||l>NW||r===8&&v!==1)return la(e,br);r===8&&(r=9);const o=new aY;return e.state=o,o.strm=e,o.status=bo,o.wrap=v,o.gzhead=null,o.w_bits=r,o.w_size=1<O2(e,t,Uc,HW,WW,jW),lY=(e,t)=>{if(kl(e)||t>z0||t<0)return e?la(e,br):br;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===es&&t!==jn)return la(e,e.avail_out===0?Bf:br);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(On(e),e.avail_out===0)return n.last_flush=-1,Kt}else if(e.avail_in===0&&j0(t)<=j0(r)&&t!==jn)return la(e,Bf);if(n.status===es&&e.avail_in!==0)return la(e,Bf);if(n.status===bo&&n.wrap===0&&(n.status=sa),n.status===bo){let i=Uc+(n.w_bits-8<<4)<<8,l=-1;if(n.strategy>=ru||n.level<2?l=0:n.level<6?l=1:n.level===6?l=2:l=3,i|=l<<6,n.strstart!==0&&(i|=JW),i+=31-i%31,Xo(n,i),n.strstart!==0&&(Xo(n,e.adler>>>16),Xo(n,e.adler&65535)),e.adler=1,n.status=sa,On(e),n.pending!==0)return n.last_flush=-1,Kt}if(n.status===am){if(e.adler=0,dt(n,31),dt(n,139),dt(n,8),n.gzhead)dt(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),dt(n,n.gzhead.time&255),dt(n,n.gzhead.time>>8&255),dt(n,n.gzhead.time>>16&255),dt(n,n.gzhead.time>>24&255),dt(n,n.level===9?2:n.strategy>=ru||n.level<2?4:0),dt(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(dt(n,n.gzhead.extra.length&255),dt(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Vt(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=dh;else if(dt(n,0),dt(n,0),dt(n,0),dt(n,0),dt(n,0),dt(n,n.level===9?2:n.strategy>=ru||n.level<2?4:0),dt(n,QW),n.status=sa,On(e),n.pending!==0)return n.last_flush=-1,Kt}if(n.status===dh){if(n.gzhead.extra){let i=n.pending,l=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+l>n.pending_buf_size;){let o=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+o),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=o,On(e),n.pending!==0)return n.last_flush=-1,Kt;i=0,l-=o}let v=new Uint8Array(n.gzhead.extra);n.pending_buf.set(v.subarray(n.gzindex,n.gzindex+l),n.pending),n.pending+=l,n.gzhead.hcrc&&n.pending>i&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=hh}if(n.status===hh){if(n.gzhead.name){let i=n.pending,l;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),On(e),n.pending!==0)return n.last_flush=-1,Kt;i=0}n.gzindexi&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=ph}if(n.status===ph){if(n.gzhead.comment){let i=n.pending,l;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),On(e),n.pending!==0)return n.last_flush=-1,Kt;i=0}n.gzindexi&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i))}n.status=mh}if(n.status===mh){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(On(e),n.pending!==0))return n.last_flush=-1,Kt;dt(n,e.adler&255),dt(n,e.adler>>8&255),e.adler=0}if(n.status=sa,On(e),n.pending!==0)return n.last_flush=-1,Kt}if(e.avail_in!==0||n.lookahead!==0||t!==ki&&n.status!==es){let i=n.level===0?T2(n,t):n.strategy===ru?rY(n,t):n.strategy===zW?nY(n,t):ts[n.level].func(n,t);if((i===Sa||i===$o)&&(n.status=es),i===dn||i===Sa)return e.avail_out===0&&(n.last_flush=-1),Kt;if(i===Do&&(t===RW?LW(n):t!==z0&&(ch(n,0,0,!1),t===DW&&(yi(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),On(e),e.avail_out===0))return n.last_flush=-1,Kt}return t!==jn?Kt:n.wrap<=0?N0:(n.wrap===2?(dt(n,e.adler&255),dt(n,e.adler>>8&255),dt(n,e.adler>>16&255),dt(n,e.adler>>24&255),dt(n,e.total_in&255),dt(n,e.total_in>>8&255),dt(n,e.total_in>>16&255),dt(n,e.total_in>>24&255)):(Xo(n,e.adler>>>16),Xo(n,e.adler&65535)),On(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Kt:N0)},uY=e=>{if(kl(e))return br;const t=e.state.status;return e.state=null,t===sa?la(e,$W):Kt},cY=(e,t)=>{let n=t.length;if(kl(e))return br;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==bo||r.lookahead)return br;if(i===1&&(e.adler=il(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(yi(r.head),r.strstart=0,r.block_start=0,r.insert=0);let a=new Uint8Array(r.w_size);a.set(t.subarray(n-r.w_size,n),0),t=a,n=r.w_size}const l=e.avail_in,v=e.next_in,o=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,_o(r);r.lookahead>=nt;){let a=r.strstart,u=r.lookahead-(nt-1);do r.ins_h=Ei(r,r.ins_h,r.window[a+nt-1]),r.prev[a&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=a,a++;while(--u);r.strstart=a,r.lookahead=nt-1,_o(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=nt-1,r.match_available=0,e.next_in=v,e.input=o,e.avail_in=l,r.wrap=i,Kt};var fY=sY,dY=O2,hY=E2,pY=k2,mY=oY,gY=lY,vY=uY,yY=cY,bY="pako deflate (from Nodeca project)",_s={deflateInit:fY,deflateInit2:dY,deflateReset:hY,deflateResetKeep:pY,deflateSetHeader:mY,deflate:gY,deflateEnd:vY,deflateSetDictionary:yY,deflateInfo:bY};const _Y=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var wY=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(!!n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)_Y(n,r)&&(e[r]=n[r])}}return e},CY=e=>{let t=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;al[254]=al[254]=1;var SY=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,l,v=e.length,o=0;for(i=0;i>>6,t[l++]=128|n&63):n<65536?(t[l++]=224|n>>>12,t[l++]=128|n>>>6&63,t[l++]=128|n&63):(t[l++]=240|n>>>18,t[l++]=128|n>>>12&63,t[l++]=128|n>>>6&63,t[l++]=128|n&63);return t};const xY=(e,t)=>{if(t<65534&&e.subarray&&A2)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const l=new Array(n*2);for(i=0,r=0;r4){l[i++]=65533,r+=o-1;continue}for(v&=o===2?31:o===3?15:7;o>1&&r1){l[i++]=65533;continue}v<65536?l[i++]=v:(v-=65536,l[i++]=55296|v>>10&1023,l[i++]=56320|v&1023)}return xY(l,i)},kY=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+al[e[n]]>t?n:t},ol={string2buf:SY,buf2string:TY,utf8border:kY};function EY(){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}var P2=EY;const I2=Object.prototype.toString,{Z_NO_FLUSH:OY,Z_SYNC_FLUSH:AY,Z_FULL_FLUSH:PY,Z_FINISH:IY,Z_OK:lc,Z_STREAM_END:MY,Z_DEFAULT_COMPRESSION:LY,Z_DEFAULT_STRATEGY:RY,Z_DEFLATED:DY}=Ro;function El(e){this.options=Hc.assign({level:LY,method:DY,chunkSize:16384,windowBits:15,memLevel:8,strategy:RY},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new P2,this.strm.avail_out=0;let n=_s.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==lc)throw new Error(Ca[n]);if(t.header&&_s.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=ol.string2buf(t.dictionary):I2.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=_s.deflateSetDictionary(this.strm,r),n!==lc)throw new Error(Ca[n]);this._dict_set=!0}}El.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,l;if(this.ended)return!1;for(t===~~t?l=t:l=t===!0?IY:OY,typeof e=="string"?n.input=ol.string2buf(e):I2.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(l===AY||l===PY)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=_s.deflate(n,l),i===MY)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=_s.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===lc;if(n.avail_out===0){this.onData(n.output);continue}if(l>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};El.prototype.onData=function(e){this.chunks.push(e)};El.prototype.onEnd=function(e){e===lc&&(this.result=Hc.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function om(e,t){const n=new El(t);if(n.push(e,!0),n.err)throw n.msg||Ca[n.err];return n.result}function $Y(e,t){return t=t||{},t.raw=!0,om(e,t)}function BY(e,t){return t=t||{},t.gzip=!0,om(e,t)}var FY=El,zY=om,NY=$Y,jY=BY,VY=Ro,UY={Deflate:FY,deflate:zY,deflateRaw:NY,gzip:jY,constants:VY};const iu=16209,HY=16191;var WY=function(t,n){let r,i,l,v,o,a,u,h,c,f,s,d,g,m,y,b,_,w,S,x,T,O,A,D;const N=t.state;r=t.next_in,A=t.input,i=r+(t.avail_in-5),l=t.next_out,D=t.output,v=l-(n-t.avail_out),o=l+(t.avail_out-257),a=N.dmax,u=N.wsize,h=N.whave,c=N.wnext,f=N.window,s=N.hold,d=N.bits,g=N.lencode,m=N.distcode,y=(1<>>24,s>>>=w,d-=w,w=_>>>16&255,w===0)D[l++]=_&65535;else if(w&16){S=_&65535,w&=15,w&&(d>>=w,d-=w),d<15&&(s+=A[r++]<>>24,s>>>=w,d-=w,w=_>>>16&255,w&16){if(x=_&65535,w&=15,da){t.msg="invalid distance too far back",N.mode=iu;break e}if(s>>>=w,d-=w,w=l-v,x>w){if(w=x-w,w>h&&N.sane){t.msg="invalid distance too far back",N.mode=iu;break e}if(T=0,O=f,c===0){if(T+=u-w,w2;)D[l++]=O[T++],D[l++]=O[T++],D[l++]=O[T++],S-=3;S&&(D[l++]=O[T++],S>1&&(D[l++]=O[T++]))}else{T=l-x;do D[l++]=D[T++],D[l++]=D[T++],D[l++]=D[T++],S-=3;while(S>2);S&&(D[l++]=D[T++],S>1&&(D[l++]=D[T++]))}}else if((w&64)===0){_=m[(_&65535)+(s&(1<>3,r-=S,d-=S<<3,s&=(1<{const a=o.bits;let u=0,h=0,c=0,f=0,s=0,d=0,g=0,m=0,y=0,b=0,_,w,S,x,T,O=null,A;const D=new Uint16Array(Ha+1),N=new Uint16Array(Ha+1);let R=null,B,E,U;for(u=0;u<=Ha;u++)D[u]=0;for(h=0;h=1&&D[f]===0;f--);if(s>f&&(s=f),f===0)return i[l++]=1<<24|64<<16|0,i[l++]=1<<24|64<<16|0,o.bits=1,0;for(c=1;c0&&(e===H0||f!==1))return-1;for(N[1]=0,u=1;uV0||e===W0&&y>U0)return 1;for(;;){B=u-g,v[h]+1=A?(E=R[v[h]-A],U=O[v[h]-A]):(E=32+64,U=0),_=1<>g)+w]=B<<24|E<<16|U|0;while(w!==0);for(_=1<>=1;if(_!==0?(b&=_-1,b+=_):b=0,h++,--D[u]===0){if(u===f)break;u=t[n+v[h]]}if(u>s&&(b&x)!==S){for(g===0&&(g=s),T+=c,d=u-g,m=1<V0||e===W0&&y>U0)return 1;S=b&x,i[S]=s<<24|d<<16|T-l|0}}return b!==0&&(i[T+b]=u-g<<24|64<<16|0),o.bits=s,0};var ws=qY;const ZY=0,M2=1,L2=2,{Z_FINISH:Y0,Z_BLOCK:JY,Z_TREES:au,Z_OK:xa,Z_STREAM_END:QY,Z_NEED_DICT:eX,Z_STREAM_ERROR:Xn,Z_DATA_ERROR:R2,Z_MEM_ERROR:D2,Z_BUF_ERROR:tX,Z_DEFLATED:X0}=Ro,Wc=16180,K0=16181,G0=16182,q0=16183,Z0=16184,J0=16185,Q0=16186,ey=16187,ty=16188,ny=16189,uc=16190,Mr=16191,Nf=16192,ry=16193,jf=16194,iy=16195,ay=16196,oy=16197,sy=16198,ou=16199,su=16200,ly=16201,uy=16202,cy=16203,fy=16204,dy=16205,Vf=16206,hy=16207,py=16208,It=16209,$2=16210,B2=16211,nX=852,rX=592,iX=15,aX=iX,my=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function oX(){this.strm=null,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 Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Da=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.modeB2?1:0},F2=e=>{if(Da(e))return Xn;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Wc,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(nX),t.distcode=t.distdyn=new Int32Array(rX),t.sane=1,t.back=-1,xa},z2=e=>{if(Da(e))return Xn;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,F2(e)},N2=(e,t)=>{let n;if(Da(e))return Xn;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Xn:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,z2(e))},j2=(e,t)=>{if(!e)return Xn;const n=new oX;e.state=n,n.strm=e,n.window=null,n.mode=Wc;const r=N2(e,t);return r!==xa&&(e.state=null),r},sX=e=>j2(e,aX);let gy=!0,Uf,Hf;const lX=e=>{if(gy){Uf=new Int32Array(512),Hf=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(ws(M2,e.lens,0,288,Uf,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;ws(L2,e.lens,0,32,Hf,0,e.work,{bits:5}),gy=!1}e.lencode=Uf,e.lenbits=9,e.distcode=Hf,e.distbits=5},V2=(e,t,n,r)=>{let i;const l=e.state;return l.window===null&&(l.wsize=1<=l.wsize?(l.window.set(t.subarray(n-l.wsize,n),0),l.wnext=0,l.whave=l.wsize):(i=l.wsize-l.wnext,i>r&&(i=r),l.window.set(t.subarray(n-r,n-r+i),l.wnext),r-=i,r?(l.window.set(t.subarray(n-r,n),0),l.wnext=r,l.whave=l.wsize):(l.wnext+=i,l.wnext===l.wsize&&(l.wnext=0),l.whave{let n,r,i,l,v,o,a,u,h,c,f,s,d,g,m=0,y,b,_,w,S,x,T,O;const A=new Uint8Array(4);let D,N;const R=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Da(e)||!e.output||!e.input&&e.avail_in!==0)return Xn;n=e.state,n.mode===Mr&&(n.mode=Nf),v=e.next_out,i=e.output,a=e.avail_out,l=e.next_in,r=e.input,o=e.avail_in,u=n.hold,h=n.bits,c=o,f=a,O=xa;e:for(;;)switch(n.mode){case Wc:if(n.wrap===0){n.mode=Nf;break}for(;h<16;){if(o===0)break e;o--,u+=r[l++]<>>8&255,n.check=Vt(n.check,A,2,0),u=0,h=0,n.mode=K0;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=It;break}if((u&15)!==X0){e.msg="unknown compression method",n.mode=It;break}if(u>>>=4,h-=4,T=(u&15)+8,n.wbits===0&&(n.wbits=T),T>15||T>n.wbits){e.msg="invalid window size",n.mode=It;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(A[0]=u&255,A[1]=u>>>8&255,n.check=Vt(n.check,A,2,0)),u=0,h=0,n.mode=G0;case G0:for(;h<32;){if(o===0)break e;o--,u+=r[l++]<>>8&255,A[2]=u>>>16&255,A[3]=u>>>24&255,n.check=Vt(n.check,A,4,0)),u=0,h=0,n.mode=q0;case q0:for(;h<16;){if(o===0)break e;o--,u+=r[l++]<>8),n.flags&512&&n.wrap&4&&(A[0]=u&255,A[1]=u>>>8&255,n.check=Vt(n.check,A,2,0)),u=0,h=0,n.mode=Z0;case Z0:if(n.flags&1024){for(;h<16;){if(o===0)break e;o--,u+=r[l++]<>>8&255,n.check=Vt(n.check,A,2,0)),u=0,h=0}else n.head&&(n.head.extra=null);n.mode=J0;case J0:if(n.flags&1024&&(s=n.length,s>o&&(s=o),s&&(n.head&&(T=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(l,l+s),T)),n.flags&512&&n.wrap&4&&(n.check=Vt(n.check,r,s,l)),o-=s,l+=s,n.length-=s),n.length))break e;n.length=0,n.mode=Q0;case Q0:if(n.flags&2048){if(o===0)break e;s=0;do T=r[l+s++],n.head&&T&&n.length<65536&&(n.head.name+=String.fromCharCode(T));while(T&&s>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Mr;break;case ny:for(;h<32;){if(o===0)break e;o--,u+=r[l++]<>>=h&7,h-=h&7,n.mode=Vf;break}for(;h<3;){if(o===0)break e;o--,u+=r[l++]<>>=1,h-=1,u&3){case 0:n.mode=ry;break;case 1:if(lX(n),n.mode=ou,t===au){u>>>=2,h-=2;break e}break;case 2:n.mode=ay;break;case 3:e.msg="invalid block type",n.mode=It}u>>>=2,h-=2;break;case ry:for(u>>>=h&7,h-=h&7;h<32;){if(o===0)break e;o--,u+=r[l++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=It;break}if(n.length=u&65535,u=0,h=0,n.mode=jf,t===au)break e;case jf:n.mode=iy;case iy:if(s=n.length,s){if(s>o&&(s=o),s>a&&(s=a),s===0)break e;i.set(r.subarray(l,l+s),v),o-=s,l+=s,a-=s,v+=s,n.length-=s;break}n.mode=Mr;break;case ay:for(;h<14;){if(o===0)break e;o--,u+=r[l++]<>>=5,h-=5,n.ndist=(u&31)+1,u>>>=5,h-=5,n.ncode=(u&15)+4,u>>>=4,h-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=It;break}n.have=0,n.mode=oy;case oy:for(;n.have>>=3,h-=3}for(;n.have<19;)n.lens[R[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,D={bits:n.lenbits},O=ws(ZY,n.lens,0,19,n.lencode,0,n.work,D),n.lenbits=D.bits,O){e.msg="invalid code lengths set",n.mode=It;break}n.have=0,n.mode=sy;case sy:for(;n.have>>24,b=m>>>16&255,_=m&65535,!(y<=h);){if(o===0)break e;o--,u+=r[l++]<>>=y,h-=y,n.lens[n.have++]=_;else{if(_===16){for(N=y+2;h>>=y,h-=y,n.have===0){e.msg="invalid bit length repeat",n.mode=It;break}T=n.lens[n.have-1],s=3+(u&3),u>>>=2,h-=2}else if(_===17){for(N=y+3;h>>=y,h-=y,T=0,s=3+(u&7),u>>>=3,h-=3}else{for(N=y+7;h>>=y,h-=y,T=0,s=11+(u&127),u>>>=7,h-=7}if(n.have+s>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=It;break}for(;s--;)n.lens[n.have++]=T}}if(n.mode===It)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=It;break}if(n.lenbits=9,D={bits:n.lenbits},O=ws(M2,n.lens,0,n.nlen,n.lencode,0,n.work,D),n.lenbits=D.bits,O){e.msg="invalid literal/lengths set",n.mode=It;break}if(n.distbits=6,n.distcode=n.distdyn,D={bits:n.distbits},O=ws(L2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,D),n.distbits=D.bits,O){e.msg="invalid distances set",n.mode=It;break}if(n.mode=ou,t===au)break e;case ou:n.mode=su;case su:if(o>=6&&a>=258){e.next_out=v,e.avail_out=a,e.next_in=l,e.avail_in=o,n.hold=u,n.bits=h,WY(e,f),v=e.next_out,i=e.output,a=e.avail_out,l=e.next_in,r=e.input,o=e.avail_in,u=n.hold,h=n.bits,n.mode===Mr&&(n.back=-1);break}for(n.back=0;m=n.lencode[u&(1<>>24,b=m>>>16&255,_=m&65535,!(y<=h);){if(o===0)break e;o--,u+=r[l++]<>w)],y=m>>>24,b=m>>>16&255,_=m&65535,!(w+y<=h);){if(o===0)break e;o--,u+=r[l++]<>>=w,h-=w,n.back+=w}if(u>>>=y,h-=y,n.back+=y,n.length=_,b===0){n.mode=dy;break}if(b&32){n.back=-1,n.mode=Mr;break}if(b&64){e.msg="invalid literal/length code",n.mode=It;break}n.extra=b&15,n.mode=ly;case ly:if(n.extra){for(N=n.extra;h>>=n.extra,h-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=uy;case uy:for(;m=n.distcode[u&(1<>>24,b=m>>>16&255,_=m&65535,!(y<=h);){if(o===0)break e;o--,u+=r[l++]<>w)],y=m>>>24,b=m>>>16&255,_=m&65535,!(w+y<=h);){if(o===0)break e;o--,u+=r[l++]<>>=w,h-=w,n.back+=w}if(u>>>=y,h-=y,n.back+=y,b&64){e.msg="invalid distance code",n.mode=It;break}n.offset=_,n.extra=b&15,n.mode=cy;case cy:if(n.extra){for(N=n.extra;h>>=n.extra,h-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=It;break}n.mode=fy;case fy:if(a===0)break e;if(s=f-a,n.offset>s){if(s=n.offset-s,s>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=It;break}s>n.wnext?(s-=n.wnext,d=n.wsize-s):d=n.wnext-s,s>n.length&&(s=n.length),g=n.window}else g=i,d=v-n.offset,s=n.length;s>a&&(s=a),a-=s,n.length-=s;do i[v++]=g[d++];while(--s);n.length===0&&(n.mode=su);break;case dy:if(a===0)break e;i[v++]=n.length,a--,n.mode=su;break;case Vf:if(n.wrap){for(;h<32;){if(o===0)break e;o--,u|=r[l++]<{if(Da(e))return Xn;let t=e.state;return t.window&&(t.window=null),e.state=null,xa},fX=(e,t)=>{if(Da(e))return Xn;const n=e.state;return(n.wrap&2)===0?Xn:(n.head=t,t.done=!1,xa)},dX=(e,t)=>{const n=t.length;let r,i,l;return Da(e)||(r=e.state,r.wrap!==0&&r.mode!==uc)?Xn:r.mode===uc&&(i=1,i=il(i,t,n,0),i!==r.check)?R2:(l=V2(e,t,n,n),l?(r.mode=$2,D2):(r.havedict=1,xa))};var hX=z2,pX=N2,mX=F2,gX=sX,vX=j2,yX=uX,bX=cX,_X=fX,wX=dX,CX="pako inflate (from Nodeca project)",zr={inflateReset:hX,inflateReset2:pX,inflateResetKeep:mX,inflateInit:gX,inflateInit2:vX,inflate:yX,inflateEnd:bX,inflateGetHeader:_X,inflateSetDictionary:wX,inflateInfo:CX};function SX(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var xX=SX;const U2=Object.prototype.toString,{Z_NO_FLUSH:TX,Z_FINISH:kX,Z_OK:sl,Z_STREAM_END:Wf,Z_NEED_DICT:Yf,Z_STREAM_ERROR:EX,Z_DATA_ERROR:vy,Z_MEM_ERROR:OX}=Ro;function Ol(e){this.options=Hc.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new P2,this.strm.avail_out=0;let n=zr.inflateInit2(this.strm,t.windowBits);if(n!==sl)throw new Error(Ca[n]);if(this.header=new xX,zr.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=ol.string2buf(t.dictionary):U2.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=zr.inflateSetDictionary(this.strm,t.dictionary),n!==sl)))throw new Error(Ca[n])}Ol.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let l,v,o;if(this.ended)return!1;for(t===~~t?v=t:v=t===!0?kX:TX,U2.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),l=zr.inflate(n,v),l===Yf&&i&&(l=zr.inflateSetDictionary(n,i),l===sl?l=zr.inflate(n,v):l===vy&&(l=Yf));n.avail_in>0&&l===Wf&&n.state.wrap>0&&e[n.next_in]!==0;)zr.inflateReset(n),l=zr.inflate(n,v);switch(l){case EX:case vy:case Yf:case OX:return this.onEnd(l),this.ended=!0,!1}if(o=n.avail_out,n.next_out&&(n.avail_out===0||l===Wf))if(this.options.to==="string"){let a=ol.utf8border(n.output,n.next_out),u=n.next_out-a,h=ol.buf2string(n.output,a);n.next_out=u,n.avail_out=r-u,u&&n.output.set(n.output.subarray(a,a+u),0),this.onData(h)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(l===sl&&o===0)){if(l===Wf)return l=zr.inflateEnd(this.strm),this.onEnd(l),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};Ol.prototype.onData=function(e){this.chunks.push(e)};Ol.prototype.onEnd=function(e){e===sl&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Hc.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function sm(e,t){const n=new Ol(t);if(n.push(e),n.err)throw n.msg||Ca[n.err];return n.result}function AX(e,t){return t=t||{},t.raw=!0,sm(e,t)}var PX=Ol,IX=sm,MX=AX,LX=sm,RX=Ro,DX={Inflate:PX,inflate:IX,inflateRaw:MX,ungzip:LX,constants:RX};const{Deflate:MG,deflate:LG,deflateRaw:$X,gzip:RG}=UY,{Inflate:DG,inflate:$G,inflateRaw:BX,ungzip:BG}=DX;var FX=$X,zX=BX;function yy(e){const t=new Map;for(const n of e){const[r,i]=n.split("="),l=decodeURIComponent(i);t.set(r,l)}return t}const NX=function(){if(!window.location.search.includes("?"))return;const t=window.location.search.replace("?","").split("&");let n=yy(t);if(console.log("URL params:",n),n.get("share")){const l=zX(new Uint8Array(atob(n.get("share")).split("").map(v=>v.charCodeAt(0))),{to:"string"});if(!l){$t().raiseError("Error when trying to decode share parameter!",!1);return}n=yy(l.split("&")),console.log("Share URL params:",n)}const r={id:-1,image:"",prompt:n.get("prompt")||"",sampler_name:n.get("sampler_name")||"k_euler",seed:Number(n.get("seed"))||-1,steps:Number(n.get("steps")||20),cfg_scale:Number(n.get("cfg_scale")||5),height:Number(n.get("height")||512),width:Number(n.get("width")||512),clip_skip:Number(n.get("clip_skip")||0),frames:Number(n.get("frames")||1),scheduler:n.get("scheduler")||"default"};en().generateText2Img(r,!1)},jX=10;function vh(e,t,n,r,i=l=>$t().raiseError(l,!1)){if(e.status===n&&t)return!0;if(!t.message)return i(`${r}: Got response code ${e.status}`);if(!t.errors)return i(`${r}: ${t.message}`);const l=Object.entries(t.errors).map(v=>`${v[0]} - ${v[1]}`).join(" | ");return i(`${r}: ${t.message} (${l})`)}const VX=Co("interrogate",()=>{const e=se({}),t=se(!1);async function n(v){$t().raiseError(v,!1),t.value=!1,e.value={}}async function r(){const v=Gt(),{source_image:o}=e.value;if(!o)return n("Failed to get interrogation ID: No image supplied.");t.value=!0;const a=await fetch(`${v.baseURL.length===0?".":v.baseURL}/sdapi/v1/interrogate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:o.split(",")[1],model:"clip"})}),u=await a.json();!vh(a,u,200,"Failed to get interrogation",n)||(e.value.id=u.id,e.value.status=u.caption)}function i(){e.value={},t.value=!1}function l(){return e.value.status||!1}return{currentInterrogation:e,interrogating:t,interrogateImage:r,getFormStatus:l,resetInterrogation:i}}),lm=e=>(Jr("data-v-db184ac6"),e=e(),Qr(),e),UX={key:0,style:{"margin-top":"16px"}},HX=lm(()=>re("div",null,[Ne("Drop file here OR "),re("em",null,"click to upload")],-1)),WX={key:1,style:{"margin-top":"16px"}},YX={key:2},XX={style:{"margin-top":"8px"}},KX=lm(()=>re("h2",{style:{margin:"16px 0 8px 0"}},"Interrogation Results",-1)),GX={key:0},qX=lm(()=>re("h3",null,"Caption",-1)),ZX={key:0},JX={key:1},QX=Ee({__name:"InterrogationView",setup(e){const t=VX(),n=en(),r=$t(),i=se();async function l(u){if(i.value.clearFiles(),!u.raw.type.includes("image")){r.raiseError("Uploaded file needs to be a image!",!1);return}const h=await l2(u.raw);t.currentInterrogation.source_image=h,t.interrogateImage()}function v(){n.generateText2Img({prompt:o.value})}const o=ee(()=>t.getFormStatus()),{ellipsis:a}=o2();return(u,h)=>C(t).currentInterrogation.source_image?C(t).currentInterrogation.status?(j(),ce("div",YX,[re("div",XX,[le(C(lt),{icon:C(mg),onClick:C(t).resetInterrogation},{default:pe(()=>[Ne("New Interrogation")]),_:1},8,["icon","onClick"]),C(o)?(j(),we(C(lt),{key:0,icon:C(mg),onClick:v,disabled:!C(o)},{default:pe(()=>[Ne("Text2Img (Caption)")]),_:1},8,["icon","disabled"])):_e("",!0)]),KX,le(C(Tp),{src:C(t).currentInterrogation.source_image,alt:"Uploaded Image"},null,8,["src"]),C(o)?(j(),ce("div",GX,[qX,C(o)?(j(),ce("div",JX,[re("strong",null,Ae(C(o)),1)])):(j(),ce("div",ZX,"Processing"+Ae(C(a)),1))])):_e("",!0)])):(j(),ce("div",WX,[re("strong",null,"Uploading image"+Ae(C(a)),1)])):(j(),ce("div",UX,[re("div",null,[le(C(Pp),{onChange:l,"auto-upload":!1,limit:1,class:"interrogation-upload",ref_key:"upload",ref:i,multiple:"",drag:""},{default:pe(()=>[le(C(De),{size:100},{default:pe(()=>[le(C(Kh))]),_:1}),HX]),_:1},512)])]))}});const eK=Yt(QX,[["__scopeId","data-v-db184ac6"]]);function tK(e,t,n){if(e===0)return"0"+(t?"s":"seconds");if(e==null)return"?";const r=Math.floor(e/86400),i=Math.floor(e%86400/3600),l=Math.floor(e%86400%3600/60),v=Math.floor(e%86400%3600%60),o=r>0?r+(t?"d":"days"):"",a=i>0?i+(t?"h":"hours"):"",u=l>0?l+(t?"m":"minutes"):"",h=v>0?v+(t?"s":"seconds"):"",c=[];return n!=null&&n.days&&c.push(o),n!=null&&n.hours&&c.push(a),n!=null&&n.minutes&&c.push(u),n!=null&&n.seconds&&c.push(h),c.join(" ")}const nK={class:"form"},rK={key:0,style:{"padding-bottom":"50px"}},iK=re("h1",{style:{margin:"0"}},"Interrogation",-1),aK=re("div",null,"Interrogate images to get their predicted descriptions.",-1),oK={class:"sidebar"},sK=re("span",{style:{height:"100%","font-size":"14px"}},[Ne("Reference Image: "),re("br"),Ne("(Photomaker/Kontext) ")],-1),lK=re("h3",{style:{margin:"16px 0 4px 0"}},"Multi Select",-1),uK={class:"main"},cK={class:"image center-horizontal"},fK={key:0},dK=Ee({__name:"GenerateView",setup(e){const n=up(lp).smallerOrEqual("md"),r=en(),i=$t(),l=ys(),v=Gt();let o=[];const a=Qg(async()=>{if(o.length===0)try{o=(await(await fetch(`${v.baseURL.length===0?".":v.baseURL}/sdapi/v1/samplers`)).json()).map(b=>b.name)}catch{o=[]}return o.length===0?[]:f(o)});let u=[];const h=Qg(async()=>{if(u.length===0)try{u=(await(await fetch(`${v.baseURL.length===0?".":v.baseURL}/sdapi/v1/schedulers`)).json()).map(b=>b.name)}catch{u=[]}return u.length===0?[]:s(u)}),c=Ct({prompt:[{required:!0,message:"Please input prompt",trigger:"change"}]});function f(b){return!r.params||!r.params.sampler_name||b.indexOf(r.params.sampler_name)===-1&&(r.params.sampler_name=b[0]),b}function s(b){return!r.params||!r.params.scheduler||b.indexOf(r.params.scheduler)===-1&&(r.params.scheduler=b[0]),b}function d(b){return"Elapsed: "+tK(b,!0,{days:!0,hours:!0,minutes:!0,seconds:!0})}function g(){r.validGeneratorTypes.includes(r.generatorType)||(i.showGeneratorBadge=!1)}function m(b){r.generatorType=b,g(),console.log(b)}function y(){l.showCropPreview=!0,l.updateCropPreview()}return g(),NX(),(b,_)=>(j(),ce(ze,null,[le(C(Z1),{"default-active":C(r).generatorType,collapse:!0,onSelect:m,mode:C(n)?"horizontal":"vertical",class:fe(C(n)?"mobile-generator-types":"generator-types"),style:Fe(C(n)?"overflow-x: auto":"")},{default:pe(()=>[le(nu,{index:"Text2Img","icon-one":C(nE),"icon-two":C(Fl),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),le(nu,{index:"Img2Img","icon-one":C(Fl),"icon-two":C(Fl),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),le(nu,{index:"Inpainting","icon-one":a2,"icon-two":C(Fl),isMobile:C(n)},null,8,["icon-two","isMobile"]),le(nu,{index:"Interrogation","icon-one":iH,isMobile:C(n)},null,8,["isMobile"])]),_:1},8,["default-active","mode","class","style"]),re("div",nK,[C(r).generatorType==="Interrogation"?(j(),ce("div",rK,[iK,aK,le(eK)])):(j(),we(C(xp),{key:1,"label-position":"left","label-width":"140px",model:C(r),class:"container",rules:c,onSubmit:_[29]||(_[29]=Ze(()=>{},["prevent"]))},{default:pe(()=>[re("div",oK,[le(C(H$),{modelValue:C(i).activeCollapse,"onUpdate:modelValue":_[24]||(_[24]=w=>C(i).activeCollapse=w),style:{"margin-bottom":"24px"}},{default:pe(()=>[le(C(W$),{title:"Generation Options",name:"1"},{default:pe(()=>[le(CH),le(sh,{label:"Negative Prompt",prop:"negativePrompt",modelValue:C(r).negativePrompt,"onUpdate:modelValue":_[0]||(_[0]=w=>C(r).negativePrompt=w),autosize:{maxRows:15},resize:"vertical",type:"textarea",placeholder:"Enter negative prompt here",info:"What to exclude from the image. Not working? Try increasing the guidance.","label-position":"top"},null,8,["modelValue"]),le(sh,{label:"Seed",prop:"seed",modelValue:C(r).params.seed,"onUpdate:modelValue":_[2]||(_[2]=w=>C(r).params.seed=w),placeholder:"Enter seed here",clearable:"","clear-icon":C(Wk)},{append:pe(()=>[le(C(kr),{content:"Randomize!",placement:"top"},{default:pe(()=>[le(C(lt),{icon:C(C3),onClick:_[1]||(_[1]=()=>C(r).params.seed=C(H2)())},null,8,["icon"])]),_:1})]),_:1},8,["modelValue","clear-icon"]),C(r).multiSelect.sampler.enabled?(j(),we(Au,{key:0,label:"Sampler(s)",prop:"samplers",modelValue:C(r).multiSelect.sampler.selected,"onUpdate:modelValue":_[3]||(_[3]=w=>C(r).multiSelect.sampler.selected=w),options:C(a),info:"Multi-select enabled. Heun and DPM2 double generation time per step, but converge twice as fast.",multiple:""},null,8,["modelValue","options"])):(j(),we(Au,{key:1,label:"Sampler",prop:"sampler",modelValue:C(r).params.sampler_name,"onUpdate:modelValue":_[4]||(_[4]=w=>C(r).params.sampler_name=w),options:C(a),info:"Heun and DPM2 double generation time per step, but converge twice as fast."},null,8,["modelValue","options"])),le(En,{label:"Batch Size",prop:"batchSize",modelValue:C(r).params.n,"onUpdate:modelValue":_[5]||(_[5]=w=>C(r).params.n=w),min:C(r).minImages,max:C(r).maxImages},null,8,["modelValue","min","max"]),C(r).multiSelect.steps.enabled?(j(),we(En,{key:2,label:"Steps(s)",prop:"multiSteps",modelValue:C(r).multiSelect.steps.selected,"onUpdate:modelValue":_[6]||(_[6]=w=>C(r).multiSelect.steps.selected=w),min:C(r).minSteps,max:C(r).maxSteps,info:"Multi-select enabled. Keep step count between 30 to 50 for optimal generation times. Coherence typically peaks between 60 and 90 steps, with a trade-off in speed.",multiple:""},null,8,["modelValue","min","max"])):(j(),we(En,{key:3,label:"Steps",prop:"steps",modelValue:C(r).params.steps,"onUpdate:modelValue":_[7]||(_[7]=w=>C(r).params.steps=w),min:C(r).minSteps,max:C(r).maxSteps,info:"Keep step count between 30 to 50 for optimal generation times. Coherence typically peaks between 60 and 90 steps, with a trade-off in speed."},null,8,["modelValue","min","max"])),le(En,{label:"Width",prop:"width",modelValue:C(r).params.width,"onUpdate:modelValue":_[8]||(_[8]=w=>C(r).params.width=w),min:C(r).minDimensions,max:C(r).maxDimensions,step:64,change:y},null,8,["modelValue","min","max"]),le(En,{label:"Height",prop:"height",modelValue:C(r).params.height,"onUpdate:modelValue":_[9]||(_[9]=w=>C(r).params.height=w),min:C(r).minDimensions,max:C(r).maxDimensions,step:64,change:y},null,8,["modelValue","min","max"]),C(r).multiSelect.guidance.enabled?(j(),we(En,{key:4,label:"Guidance(s)",prop:"cfgScales",modelValue:C(r).multiSelect.guidance.selected,"onUpdate:modelValue":_[10]||(_[10]=w=>C(r).multiSelect.guidance.selected=w),min:C(r).minCfgScale,max:C(r).maxCfgScale,info:"Multi-select enabled. Higher values will make the AI respect your prompt more. Lower values allow the AI to be more creative.",multiple:""},null,8,["modelValue","min","max"])):(j(),we(En,{key:5,label:"Guidance",prop:"cfgScale",modelValue:C(r).params.cfg_scale,"onUpdate:modelValue":_[11]||(_[11]=w=>C(r).params.cfg_scale=w),min:C(r).minCfgScale,max:C(r).maxCfgScale,step:.5,info:"Higher values will make the AI respect your prompt more. Lower values allow the AI to be more creative."},null,8,["modelValue","min","max","step"])),C(r).multiSelect.clipSkip.enabled?(j(),we(En,{key:6,label:"CLIP Skip(s)",prop:"clipSkips",modelValue:C(r).multiSelect.clipSkip.selected,"onUpdate:modelValue":_[12]||(_[12]=w=>C(r).multiSelect.clipSkip.selected=w),min:C(r).minClipSkip,max:C(r).maxClipSkip,info:"Multi-select enabled. Last layers of CLIP to ignore. For most situations this can be left alone.",multiple:""},null,8,["modelValue","min","max"])):(j(),we(En,{key:7,label:"CLIP Skip",prop:"clipSkip",modelValue:C(r).params.clip_skip,"onUpdate:modelValue":_[13]||(_[13]=w=>C(r).params.clip_skip=w),min:C(r).minClipSkip,max:C(r).maxClipSkip,info:"Last layers of CLIP to ignore. For most situations this can be left alone."},null,8,["modelValue","min","max"])),C(r).sourceGeneratorTypes.includes(C(r).generatorType)?(j(),we(En,{key:8,label:"Init Strength",prop:"denoise",modelValue:C(r).params.denoising_strength,"onUpdate:modelValue":_[14]||(_[14]=w=>C(r).params.denoising_strength=w),min:C(r).minDenoise,max:C(r).maxDenoise,step:.01,info:"The final image will diverge from the starting image at higher values."},null,8,["modelValue","min","max","step"])):_e("",!0),le(En,{label:"Video Frames",prop:"frames",modelValue:C(r).params.frames,"onUpdate:modelValue":_[15]||(_[15]=w=>C(r).params.frames=w),min:C(r).minFrames,max:C(r).maxFrames,info:"Number of consecutive video frames to generate (Video models only). Max 80 frames, about 5 seconds of video."},null,8,["modelValue","min","max"]),le(Au,{label:"Scheduler",prop:"scheduler",modelValue:C(r).params.scheduler,"onUpdate:modelValue":_[16]||(_[16]=w=>C(r).params.scheduler=w),options:C(h),info:"Experimental! KoboldCpp only, allows you to use a different scheduler. Leave as default otherwise."},null,8,["modelValue","options"]),re("div",null,[sK,re("input",{class:"el-button",type:"file",id:"extra_image_input",onChange:_[17]||(_[17]=w=>C(r).setExtraImage(w)),accept:"image/*",multiple:""},null,32),re("button",{onClick:_[18]||(_[18]=w=>C(r).clearExtraImage()),class:"el-button"},"Clear Image"),le(C(n0),null,{default:pe(()=>[le(C(Uo),{span:C(n)?24:12},{default:pe(()=>[le(Yo,{label:"ESRGAN Upscale",prop:"enable_hr",modelValue:C(r).params.enable_hr,"onUpdate:modelValue":_[19]||(_[19]=w=>C(r).params.enable_hr=w),info:"Enable upscale with ESRGAN."},null,8,["modelValue"])]),_:1},8,["span"])]),_:1})]),lK,le(C(n0),null,{default:pe(()=>[le(C(Uo),{span:C(n)?24:12},{default:pe(()=>[le(Yo,{label:"Multi Sampler",prop:"multiSamplerSwitch",modelValue:C(r).multiSelect.sampler.enabled,"onUpdate:modelValue":_[20]||(_[20]=w=>C(r).multiSelect.sampler.enabled=w)},null,8,["modelValue"])]),_:1},8,["span"]),le(C(Uo),{span:C(n)?24:12},{default:pe(()=>[le(Yo,{label:"Multi Guidance",prop:"multiGuidanceSwitch",modelValue:C(r).multiSelect.guidance.enabled,"onUpdate:modelValue":_[21]||(_[21]=w=>C(r).multiSelect.guidance.enabled=w)},null,8,["modelValue"])]),_:1},8,["span"]),le(C(Uo),{span:C(n)?24:12},{default:pe(()=>[le(Yo,{label:"Multi CLIP Skip",prop:"multiClipSkipSwitch",modelValue:C(r).multiSelect.clipSkip.enabled,"onUpdate:modelValue":_[22]||(_[22]=w=>C(r).multiSelect.clipSkip.enabled=w)},null,8,["modelValue"])]),_:1},8,["span"]),le(C(Uo),{span:C(n)?24:12},{default:pe(()=>[le(Yo,{label:"Multi Steps",prop:"multiStepsSwitch",modelValue:C(r).multiSelect.steps.enabled,"onUpdate:modelValue":_[23]||(_[23]=w=>C(r).multiSelect.steps.enabled=w)},null,8,["modelValue"])]),_:1},8,["span"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),re("div",uK,[le(C(lt),{onClick:_[25]||(_[25]=()=>{C(r).cancelled=!0,C(r).generating=!1,C(r).resetStore()}),class:"reset-btn"},{default:pe(()=>[Ne("Reset")]),_:1}),le(C(lt),{type:"primary",class:"generate-cancel-btn",style:Fe(C(r).generating?"width: 55%;":""),onClick:_[26]||(_[26]=()=>C(r).generateImage(C(r).generatorType))},{default:pe(()=>[re("span",null," Generate "+Ae(C(r).totalImageCount)+" image"+Ae(C(r).totalImageCount===1?"":"s"),1)]),_:1},8,["style"]),C(r).generating?(j(),we(C(lt),{key:0,type:"danger",class:"generate-cancel-btn",style:{width:"25%"},disabled:C(r).cancelled,onClick:_[27]||(_[27]=()=>{C(r).cancelled=!0,C(r).generating=!1,C(r).clearQueue()})},{default:pe(()=>[Ne("Cancel all")]),_:1},8,["disabled"])):_e("",!0)]),re("div",cK,[le(C(YD),{class:"center-both generated-image"},{default:pe(()=>[!C(r).generating&&C(r).outputs.length==0?(j(),ce("div",fK,[/Inpainting/.test(C(r).generatorType)?(j(),we(I0,{key:0})):_e("",!0),/Img2Img/.test(C(r).generatorType)?(j(),we(I0,{key:1})):_e("",!0)])):_e("",!0),!C(i).showGeneratedImages&&C(r).generating?(j(),we(dH,{key:1,generated:C(r).outputs.length,total:C(r).queue.length,elapsed:d(C(r).timer.seconds),onShowGenerated:_[28]||(_[28]=w=>C(i).showGeneratedImages=!0)},null,8,["generated","total","elapsed"])):_e("",!0),C(i).showGeneratedImages&&C(r).outputs.length!==0?(j(),we(MH,{key:2})):_e("",!0)]),_:1})])]),_:1},8,["model","rules"]))])],64))}});const Cs=BT({history:eT("./"),routes:[{path:"/",name:"generate",component:dK},{path:"/images",name:"images",component:()=>If(()=>Promise.resolve().then(()=>uG),void 0,import.meta.url)},{path:"/about",name:"about",component:()=>If(()=>Promise.resolve().then(()=>CG),void 0,import.meta.url)},{path:"/options",name:"options",component:()=>If(()=>Promise.resolve().then(()=>PG),void 0,import.meta.url)},{path:"/return",name:"return",redirect:e=>(window.location.href=window.location.pathname.endsWith("/")?"..":".","/")}]});function Xf(){return{steps:20,n:1,sampler_name:"Euler",width:512,height:512,cfg_scale:5,clip_skip:0,seed:-1,denoising_strength:.6,frames:1,enable_hr:!1,scheduler:"default"}}function H2(){return Math.floor(Math.random()*9999999)+1}const en=Co("generator",()=>{const e=["Text2Img","Img2Img","Inpainting"],t=["Img2Img","Inpainting"],n=se("Text2Img"),r=se(""),i=Pn("promptHistory",[]),l=se(""),v=Pn("negativeLibrary",[]),o=se(Xf()),a=se({interval:0,seconds:0}),u=se({sampler:{name:"Sampler",enabled:!1,selected:[o.value.sampler_name],noneMessage:"Failed to generate: No sampler selected.",mapToParam:te=>te.sampler_name},steps:{name:"Steps",enabled:!1,selected:[o.value.steps],noneMessage:"Failed to generate: No steps selected.",mapToParam:te=>te.steps},guidance:{name:"CFG Scale",enabled:!1,selected:[o.value.cfg_scale],noneMessage:"Failed to generate: No guidance selected.",mapToParam:te=>te.cfg_scale},clipSkip:{name:"Clip Skip",enabled:!1,selected:[o.value.clip_skip],noneMessage:"Failed to generate: No CLIP Skip selected.",mapToParam:te=>te.clip_skip}}),h=()=>({sourceProcessing:void 0,sourceImage:void 0,maskImage:void 0}),c=se({...h(),sourceProcessing:"inpainting"}),f=se({...h(),sourceProcessing:"img2img"}),s=te=>te==="Inpainting"?c.value:te==="Img2Img"?f.value:h(),d=ee(()=>s(n.value)),g=se(""),m=se(!1),y=se(!1),b=se([]),_=se([]),w=se(64),S=ee(()=>Gt().allowLargerParams==="Enabled"?3072:1024),x=se(1),T=se(20),O=se(1),A=ee(()=>Gt().allowLargerParams==="Enabled"?150:50),D=se(1),N=se(24),R=se(.1),B=se(1),E=se(0),U=se(10),ne=se(1),Q=se(80),ue=(te,be,Ce)=>Array.from({length:(be-te+1)/Ce},(xe,Ie)=>(Ie+te)*Ce),I=se(ue(E.value,U.value,1)),z=se(ue(D.value,N.value,.5)),M=ee(()=>{const te=(Me,Le,ot=1)=>Me*(Le.enabled?Le.selected.length:ot),Ce=o.value.n*Y().length,xe=te(Ce,u.value.sampler),Ie=te(xe,u.value.steps),ve=te(Ie,u.value.guidance);return te(ve,u.value.clipSkip)});function L(){return o.value=Xf(),c.value=h(),f.value=h(),b.value=[],$t().showGeneratedImages=!1,J(),!0}function J(){_.value=[]}function V(){b.value=[]}async function P(te){if(!e.includes(te))return[];if(r.value==="")return Z("Failed to generate: No prompt submitted.");for(const ut of Object.values(u.value))if(ut.enabled&&ut.selected.length===0)return Z(ut.noneMessage);const be=ys(),Ce=$t();be.saveImages();const{sourceImage:xe,maskImage:Ie,sourceProcessing:ve}=s(te);K(r.value);const Se=[],Me=(ut,Qt)=>ut.enabled?ut.selected:Qt,Le=Y(),ot=Me(u.value.guidance,[o.value.cfg_scale]),pt=Me(u.value.steps,[o.value.steps]),st=Me(u.value.clipSkip,[o.value.clip_skip]),Xt=Me(u.value.sampler,[o.value.sampler_name]),Jt=[await W()];for(const ut of ot)for(const Qt of pt)for(const G2 of st)for(const cm of Le){const fm=cm.split(" ### ");for(const q2 of Xt){let Il=parseInt(o.value.seed.toString());(isNaN(Il)||Il<0)&&(Il=H2());for(let Xc=0;Xc0&&(Fn.params.extra_images=G),Gt().alsoRequestAvi==="Enabled"&&Fn.params.frames&&Fn.params.frames>1&&(Fn.params.video_output_type=2),Se.push(Fn)}}}let Or=!1;m.value||(Or=!0,b.value=[]),m.value=!0,Ce.showGeneratedImages=!1;let xn=_.value.filter(ut=>!ut.gathered&&!ut.failed).length;for(let ut=0;ut{a.value.seconds++},1e3);!_.value.every(ut=>ut.gathered||ut.failed)&&!y.value;){const ut=_.value.find(Qt=>!Qt.gathered&&!Qt.failed);if(!ut)break;ut.gathered=!0;try{const Qt=await k(ut.params);if(!Qt){ut.failed=!0;continue}q([{...Qt,...ut}])}catch(Qt){ut.failed=!0,console.error("Error fetching image:",Qt)}}}async function q(te){const be=wa();console.log(te);const Ce=await Promise.all(te.map(async ve=>{const Se=ve.images[0],Le=!!ve.animated?"gif":"png",ot=ve.extra_data?`data:video/avi;base64,${ve.extra_data}`:"";return{id:-1,image:`data:image/${Le};base64,${Se}`,prompt:ve.prompt,clip_skip:ve.params.clip_skip,modelName:ve.models[0],seed:ve.params.seed,steps:ve.params.steps,sampler_name:ve.params.sampler_name,cfg_scale:ve.params.cfg_scale,width:ve.params.width,height:ve.params.height,frames:ve.params.frames,scheduler:ve.params.scheduler,extra_avi:ot,enable_hr:ve.params.enable_hr}})),xe=await be.pushOutputs(Ce),Ie=0;return b.value=[...xe.map(ve=>({type:"image",index:Ie,output:ve})),...b.value].sort((ve,Se)=>ve.index-Se.index),b.value.length===_.value.length&&(_.value=[],m.value=!1,$t().showGeneratedImages=!0,clearInterval(a.value.interval),a.value.interval=0,a.value.seconds=0),Ce}async function Z(te){const be=$t();return te&&be.raiseError(te,!1),[]}function ie(te,be,Ce,xe){return be<=Ce?be:($t().raiseWarning(`This image was generated using the 'Larger Values' option. Setting '${te}' to its default value instead of ${be}.`,!0),xe)}function he(te,be=!0){const Ce=Xf();if(n.value="Text2Img",u.value.guidance.enabled=!1,u.value.sampler.enabled=!1,Cs.push("/"),be&&(te.width=te.width||Ce.width,te.height=te.height||Ce.height),te.prompt){const xe=te.prompt.split(" ### ");r.value=xe[0],l.value=xe[1]||""}te.sampler_name&&(o.value.sampler_name=te.sampler_name),te.steps&&(o.value.steps=ie("steps",te.steps,A.value,Ce.steps)),te.cfg_scale&&(o.value.cfg_scale=te.cfg_scale),te.width&&(o.value.width=ie("width",te.width,S.value,Ce.width)),te.height&&(o.value.height=ie("height",te.height,S.value,Ce.height)),te.seed&&(o.value.seed=te.seed),te.clip_skip&&(o.value.clip_skip=ie("clip_skip",te.clip_skip,U.value,Ce.clip_skip)),te.scheduler&&(o.value.scheduler=te.scheduler),te.frames&&(o.value.frames=ie("frames",te.frames,Q.value,Ce.frames))}function ge(te){const be=ys();n.value="Img2Img",f.value.sourceImage=te,be.drawing=!1,b.value=[],Cs.push("/"),Jn.fabric.Image.fromURL(te,be.newImage)}function ye(te){const be=ys();b.value=[],c.value.sourceImage=te,n.value="Inpainting",Cs.push("/"),Jn.fabric.Image.fromURL(te,be.newImage)}function H(){return l.value===""?r.value:`${r.value} ### ${l.value}`}function Y(){const te=H(),be=te.match(/\{(.*?)\}/g)||[];if(be.length===0)return[te];let Ce=[];return be.forEach(xe=>{const Ie=[],ve=xe.replace("{","").replace("}","").split("|");Ce.length===0?ve.forEach(Se=>{const Me=te.replace(xe,Se);Ie.push(Me)}):Ce.forEach(Se=>{ve.forEach(Me=>{const Le=Se.replace(xe,Me);Ie.push(Le)})}),Ce=[...Ie]}),Ce}async function k(te){const be=Gt();try{const Ce=await fetch(`${be.baseURL.length===0?".":be.baseURL}/sdapi/v1/${te.init_images.length>0?"img":"txt"}2img`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)}),xe=await Ce.json();return vh(Ce,xe,200,"Failed to fetch",X)?xe:!1}catch{return!1}}function X(te){return $t().raiseError(te,!1),y.value=!1,b.value=[],!1}async function W(){const te=Gt(),be=await fetch(`${te.baseURL.length===0?".":te.baseURL}/sdapi/v1/sd-models`),Ce=await be.json();if(!!vh(be,Ce,200,"Failed to get available models"))return Ce.length===0?"(No model loaded)":Ce[0].model_name}function $(te){v.value.indexOf(te)===-1&&(v.value=[...v.value,te])}function F(te){v.value=v.value.filter(be=>be!=te)}function K(te){if(i.value.findIndex(be=>be.prompt===te)===-1){if(i.value.length>=10+i.value.filter(be=>be.starred).length){const be=i.value.filter(xe=>!xe.starred),Ce=i.value.findIndex(xe=>xe===be[be.length-1]);i.value.splice(Ce,1)}i.value=[...i.value,{starred:!1,timestamp:Date.now(),prompt:te}]}}function de(te){i.value=i.value.filter(be=>be.prompt!=te&&be!=te)}function oe(){return!1}var G=[];function me(te){let be=te.target;if(G=[],be.files.length>0)for(let Ce=0;Cenew DataView(new ArrayBuffer(e)),$a=e=>new Uint8Array(e.buffer||e),qa=e=>new TextEncoder().encode(String(e));function hK(e,t){if(t===void 0||t instanceof Date||(t=new Date(t)),e instanceof File)return{t:t||new Date(e.lastModified),o:e.stream()};if(e instanceof Response)return{t:t||new Date(e.headers.get("Last-Modified")||Date.now()),o:e.body};if(t===void 0)t=new Date;else if(isNaN(t))throw new Error("Invalid modification date.");if(typeof e=="string")return{t,o:qa(e)};if(e instanceof Blob)return{t,o:e.stream()};if(e instanceof Uint8Array||e instanceof ReadableStream)return{t,o:e};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{t,o:$a(e)};if(Symbol.asyncIterator in e)return{t,o:W2(e)};throw new TypeError("Unsupported input format.")}function W2(e){const t="next"in e?e:e[Symbol.asyncIterator]();return new ReadableStream({async pull(n){let r=0;for(;n.desiredSize>r;){const i=await t.next();if(!i.value){n.close();break}{const l=pK(i.value);n.enqueue(l),r+=l.byteLength}}}})}function pK(e){return typeof e=="string"?qa(e):e instanceof Uint8Array?e:$a(e)}function mK(e,t,n){if(t===void 0||t instanceof Uint8Array||(t=qa(t)),e instanceof File)return{i:t||qa(e.name),A:e.size};if(e instanceof Response){const r=e.headers.get("content-disposition"),i=r&&r.match(/;\s*filename\*?=["']?(.*?)["']?$/i),l=i&&i[1]||new URL(e.url).pathname.split("/").pop(),v=l&&decodeURIComponent(l),o=n||+e.headers.get("content-length");return{i:t||qa(v),A:o}}if(!t||t.length===0)throw new Error("The file must have a name.");return typeof e=="string"?{i:t,A:qa(e).length}:e instanceof Blob?{i:t,A:e.size}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?{i:t,A:e.byteLength}:{i:t,A:n}}var gK=new WebAssembly.Instance(new WebAssembly.Module(Uint8Array.from(atob("AGFzbQEAAAABCgJgAABgAn9/AXwDAwIAAQUDAQACBwkCAW0CAAFjAAEIAQAKlQECSQEDfwNAIAEhAEEAIQIDQCAAQQF2IABBAXFBoIbi7X5scyEAIAJBAWoiAkEIRw0ACyABQQJ0IAA2AgAgAUEBaiIBQYACRw0ACwtJAQF/IAFBf3MhAUGAgAQhAkGAgAQgAGohAANAIAFB/wFxIAItAABzQQJ0KAIAIAFBCHZzIQEgAkEBaiICIABJDQALIAFBf3O4Cw"),e=>e.charCodeAt(0)))),{c:vK,m:yK}=gK.exports,bK=$a(yK).subarray(65536);function by(e,t=0){for(const n of function*(r){for(;r.length>65536;)yield r.subarray(0,65536),r=r.subarray(65536);r.length&&(yield r)}(e))bK.set(n),t=vK(n.length,t);return t}function Y2(e,t,n=0){const r=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,i=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;t.setUint16(n,r,1),t.setUint16(n+2,i,1)}function _K(e){const t=Yc(30);return t.setUint32(0,1347093252),t.setUint32(4,335546368),Y2(e.t,t,10),t.setUint16(26,e.i.length,1),$a(t)}async function*wK(e){let{o:t}=e;if("then"in t&&(t=await t),t instanceof Uint8Array)yield t,e.u=by(t,0),e.A=t.length;else{e.A=0;const n=t.getReader();for(;;){const{value:r,done:i}=await n.read();if(i)break;e.u=by(r,e.u),e.A+=r.length,yield r}}}function CK(e){const t=Yc(16);return t.setUint32(0,1347094280),t.setUint32(4,e.u,1),t.setUint32(8,e.A,1),t.setUint32(12,e.A,1),$a(t)}function SK(e,t){const n=Yc(46);return n.setUint32(0,1347092738),n.setUint32(4,352523264),n.setUint16(8,2048),Y2(e.t,n,12),n.setUint32(16,e.u,1),n.setUint32(20,e.A,1),n.setUint32(24,e.A,1),n.setUint16(28,e.i.length,1),n.setUint16(40,33204,1),n.setUint32(42,t,1),$a(n)}function xK(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified]]}function TK(e,t={}){const n={"Content-Type":"application/zip","Content-Disposition":"attachment"};return Number.isInteger(t.length)&&t.length>0&&(n["Content-Length"]=t.length),t.metadata&&(n["Content-Length"]=p(t.metadata)),new Response(W2(async function*(r){const i=[];let l=0,v=0;for await(const u of r)yield _K(u),yield u.i,yield*wK(u),yield CK(u),i.push(SK(u,l)),i.push(u.i),v++,l+=46+u.i.length+u.A;let o=0;for(const u of i)yield u,o+=u.length;const a=Yc(22);a.setUint32(0,1347093766),a.setUint16(8,v,1),a.setUint16(10,v,1),a.setUint32(12,o,1),a.setUint32(16,l,1),yield $a(a)}(async function*(r){for await(const i of r){const[l,v]=xK(i);yield Object.assign(hK(...v),mK(...l))}}(e))),{headers:n})}async function X2(e,t=!0,n){const r=Gt();t&&Ri({message:`Downloading ${e.length} image(s)...`,type:"info"});const i=[];for(let o=0;o]/g,"").substring(0,128).trimEnd();let s=r.imageDownloadType;u.startsWith("data:image/gif")&&(s="GIF"),s==="PNG"?i.push({name:f+".png",input:await aa(u,"image/png")}):s==="JPG"?i.push({name:f+".jpg",input:await aa(u,"image/jpeg")}):s==="GIF"?i.push({name:f+".gif",input:await aa(u,"image/gif")}):i.push({name:f+".webp",input:await aa(u,"image/webp")}),i.push({name:f+".json",input:JSON.stringify(c,void 0,4)}),n&&n()}const l=await TK(i).blob(),v=document.createElement("a");v.href=URL.createObjectURL(l),v.download="sdui_images.zip",v.click()}async function kK(e,t){const n=Gt(),r=document.createElement("a");let i,l=n.imageDownloadType;e.startsWith("data:image/gif")&&(l="GIF"),l==="PNG"?(i=await aa(e,"image/png"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".png"):l==="JPG"?(i=await aa(e,"image/jpeg"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".jpg"):l==="GIF"?(i=await aa(e,"image/gif"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".gif"):(r.href=e,r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".webp"),r.click(),i&&URL.revokeObjectURL(r.href)}const K2=Ee({__name:"ImageActions",props:{imageData:null,onDelete:null,showDismiss:{type:Boolean}},setup(e){const t=e,n=en(),r=wa(),i=()=>{uw.confirm("This action will permanently delete this image. Continue?","Warning",{confirmButtonText:"OK",cancelButtonText:"Cancel",type:"warning"}).then(()=>{r.deleteOutput(t.imageData.id),t.onDelete!==void 0&&t.onDelete(t.imageData.id),Ri({type:"success",message:"Deleted Image"})})},l=()=>{en().clearOutputs(),$t().showGeneratedImages=!1,en().clearQueue()};async function v(o){const a=window.location.origin,u={prompt:o.prompt,width:o.width?o.width:void 0,height:o.height?o.height:void 0,steps:o.steps,cfg_scale:o.cfg_scale,sampler_name:o.sampler_name,model_name:o.modelName,seed:o.seed,clip_skip:o.clip_skip,frames:o.frames,scheduler:o.scheduler,extra_avi:o.extra_avi,enable_hr:o.enable_hr},h=window.location.pathname.replace("images","");let c=`${a}${h}?share=`,f="",s="";for(const[g,m]of Object.entries(u)){if(!m)continue;let y=m;typeof m=="string"?y=encodeURIComponent(m):Array.isArray(m)&&(y=JSON.stringify(m)),f+=`${s}${g}=${y}`,s="&"}c+=btoa(String.fromCharCode.apply(null,Array.from(FX(f)))),await navigator.clipboard.writeText(c),Ri({type:"success",message:"Copied shareable link to clipboard"})}return(o,a)=>(j(),ce(ze,null,[le(C(lt),{onClick:i,type:"danger",size:"small",icon:C(Ec),plain:""},{default:pe(()=>[Ne("Delete")]),_:1},8,["icon"]),le(C(lt),{onClick:a[0]||(a[0]=u=>C(kK)(e.imageData.image,`${e.imageData.seed}-${e.imageData.prompt}`)),type:"success",size:"small",icon:C(Ls),plain:""},{default:pe(()=>[Ne("Download")]),_:1},8,["icon"]),e.imageData.starred?_e("",!0):(j(),we(C(lt),{key:0,onClick:a[1]||(a[1]=u=>C(r).toggleStarred(e.imageData.id)),type:"warning",size:"small",icon:C(qO),plain:""},{default:pe(()=>[Ne("Star")]),_:1},8,["icon"])),e.imageData.starred?(j(),we(C(lt),{key:1,onClick:a[2]||(a[2]=u=>C(r).toggleStarred(e.imageData.id)),type:"warning",size:"small",icon:C(n_),plain:""},{default:pe(()=>[Ne("Unstar")]),_:1},8,["icon"])):_e("",!0),le(C(lt),{onClick:a[3]||(a[3]=u=>C(n).generateText2Img(e.imageData)),type:"success",size:"small",plain:""},{default:pe(()=>[Ne("Txt2img")]),_:1}),le(C(lt),{onClick:a[4]||(a[4]=u=>C(n).generateImg2Img(e.imageData.image)),type:"success",size:"small",plain:""},{default:pe(()=>[Ne("Img2img")]),_:1}),le(C(lt),{onClick:a[5]||(a[5]=u=>C(n).generateInpainting(e.imageData.image)),type:"success",size:"small",plain:""},{default:pe(()=>[Ne("Inpaint")]),_:1}),e.showDismiss?(j(),we(C(lt),{key:2,onClick:a[6]||(a[6]=u=>l()),type:"success",size:"small",plain:""},{default:pe(()=>[Ne("Dismiss")]),_:1})):_e("",!0),le(C(lt),{onClick:a[7]||(a[7]=u=>v(e.imageData)),type:"success",icon:C(f3),size:"small",plain:""},{default:pe(()=>[Ne("Share")]),_:1},8,["icon"])],64))}}),EK={class:"main-output",style:{position:"relative",display:"flex","align-items":"center","justify-content":"center"}},OK=["src"],AK={style:{"font-size":"18px","font-weight":"500"}},PK={style:{"font-family":"'Segoe UI', Tahoma, Geneva, Verdana, sans-serif","letter-spacing":"0.025em"}},IK={key:0},MK=["onClick"],LK=Ee({__name:"ImageDialog",setup(e){const t=wa(),n=$t(),r=se();jI(r,{onSwipeEnd(a,u){u==="RIGHT"&&n.openModalToLeft(),u==="LEFT"&&n.openModalToRight()}});const i=ee({get(){return n.activeModal!==-1},set(){n.activeModal=-1}}),l=se(t.currentOutputs[0]);ke(()=>n.activeModal,async()=>{const a=t.currentOutputs.find(u=>u.id===n.activeModal);if(a)return l.value=a;l.value=await Lt.outputs.get(n.activeModal)||t.currentOutputs[0]});function v(){i.value=!1}function o(){var g,m;if(!((g=l.value)!=null&&g.extra_avi))return;const a=l.value.extra_avi.split(",")[1];if(!a)return;const u=atob(a),h=u.length,c=new Uint8Array(h);for(let y=0;y{var h;return j(),we(C(LB),{"model-value":C(i),width:(h=l.value)==null?void 0:h.width,class:"image-viewer",onClosed:v,"align-center":""},{footer:pe(()=>[le(K2,{"image-data":l.value,"on-delete":v},null,8,["image-data"])]),default:pe(()=>{var c,f,s,d;return[re("div",{class:"main-output-container",ref_key:"target",ref:r},[re("div",EK,[(c=l.value)!=null&&c.image?(j(),ce("img",{key:0,src:l.value.image,alt:"Output image",style:{"max-width":"100%","max-height":"100%","object-fit":"contain"}},null,8,OK)):_e("",!0)])],512),re("div",AK,Ae(((f=l.value.prompt)==null?void 0:f.split("###")[0])||"Unknown Creation"),1),re("div",PK,[re("div",null,"Negative Prompt: "+Ae(((s=l.value.prompt)==null?void 0:s.split("###")[1])||"None"),1),re("span",null,"Model: "+Ae(l.value.modelName||"Unknown")+" - ",1),re("span",null,"Sampler: "+Ae(l.value.sampler_name||"Unknown")+" - ",1),re("span",null,"Seed: "+Ae(l.value.seed||"Unknown")+" - ",1),re("span",null,"Steps: "+Ae(l.value.steps||"Unknown")+" - ",1),re("span",null,"CFG Scale: "+Ae(l.value.cfg_scale||"Unknown")+" - ",1),re("span",null,"Clip Skip: "+Ae((d=l.value.clip_skip)!=null?d:"Unknown")+" - ",1),re("span",null,"Dimensions: "+Ae(l.value.width||"???")+"x"+Ae(l.value.height||"???")+" - ",1),re("span",null,"Frames: "+Ae(l.value.frames||"1"),1),l.value.extra_avi?(j(),ce("span",IK,[Ne(" - "),re("a",{href:"#",onClick:Ze(o,["prevent"]),style:{cursor:"pointer",color:"var(--el-color-primary)"}},"[Download AVI]",8,MK)])):_e("",!0)])]}),_:1},8,["model-value","width"])}}});const RK=e=>(Jr("data-v-8f4d2380"),e=e(),Qr(),e),DK=RK(()=>re("div",{style:{"font-size":"20px"}},"Stable UI",-1)),$K={class:"generator-icons"},BK=Ee({__name:"App",setup(e){const n=up(lp).smallerOrEqual("md"),r=$t();Gt();const i=zT(),l=se();return ke(()=>i.path,v=>{l.value&&l.value.open(v)}),(v,o)=>(j(),ce(ze,null,[re("div",{class:fe({"menu-container":!C(n)})},[le(C(Z1),{"default-active":C(i).path,mode:"horizontal",router:!0,ellipsis:!C(n),class:fe(C(n)?"mobile-menu":"menu"),ref_key:"menuRef",ref:l},{default:pe(()=>[C(n)?_e("",!0):(j(),we(C(Ep),{key:0,class:"remove-item-styling center-vertical"},{title:pe(()=>[DK]),_:1})),le(Wo,{isMobile:C(n),index:"/"},{icon:pe(()=>[re("div",$K,[le(C(De),null,{default:pe(()=>[le(C(q3))]),_:1}),C(r).showGeneratorBadge?(j(),we(C(De),{key:0,class:"generator-badge",size:10},{default:pe(()=>[le(UU)]),_:1})):_e("",!0)])]),title:pe(()=>[Ne("Generate")]),_:1},8,["isMobile"]),le(Wo,{isMobile:C(n),index:"/images"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(O3))]),_:1})]),title:pe(()=>[Ne("Images")]),_:1},8,["isMobile"]),le(Wo,{isMobile:C(n),index:"/about"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(Jb))]),_:1})]),title:pe(()=>[Ne("About")]),_:1},8,["isMobile"]),le(Wo,{isMobile:C(n),index:"/options"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(s4))]),_:1})]),title:pe(()=>[Ne("Options")]),_:1},8,["isMobile"]),le(Wo,{isMobile:C(n),index:"/return"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(Kb))]),_:1})]),title:pe(()=>[Ne("Return to Lite")]),_:1},8,["isMobile"])]),_:1},8,["default-active","ellipsis","class"])],2),re("div",{class:fe({view:!C(n)})},[le(C(Xb))],2),le(LK)],64))}});const FK=Yt(BK,[["__scopeId","data-v-8f4d2380"]]);const um=Ax(FK);um.use(Mx());um.use(Cs);um.mount("#app");Cs.replace("/");window.addEventListener("beforeunload",e=>{en().generating&&(e.preventDefault(),e.returnValue="")});const zK={key:1,class:"image-action"},NK=Ee({__name:"CustomImage",props:{imageData:null},setup(e){const t=e,n=$t(),r=se(null);bI(r,n.toggleMultiSelect,{modifiers:{prevent:!0}});const i=se(!1);NI(r,([{isIntersecting:v}])=>{v&&(i.value=v)},{rootMargin:"500px"});const l=ee(()=>n.selected.includes(t.imageData.id));return(v,o)=>(j(),ce("div",{class:"relative",ref_key:"containerRef",ref:r},[i.value?(j(),we(C(Tp),{key:0,class:"thumbnail",src:e.imageData.image,onClick:o[0]||(o[0]=a=>C(n).activeModal=e.imageData.id),fit:"cover",loading:"lazy",style:Fe(`${C(l)&&"opacity: 0.5"}`)},null,8,["src","style"])):_e("",!0),i.value?(j(),ce("div",zK,[e.imageData.starred?(j(),we(C(De),{key:0,class:"starred-icon",size:35,color:"var(--el-color-warning)"},{default:pe(()=>[le(C(n_))]),_:1})):_e("",!0),C(n).multiSelect?(j(),ce("div",{key:1,class:"select-container",onClick:o[1]||(o[1]=a=>C(n).toggleSelection(e.imageData.id))},[le(C(De),{class:"select-icon",size:35,color:`rgba(255, 255, 255, ${C(l)?"1":"0.5"})`},{default:pe(()=>[C(l)?_e("",!0):(j(),we(C(fl),{key:0})),C(l)?(j(),we(C(qb),{key:1})):_e("",!0)]),_:1},8,["color"])])):_e("",!0)])):_e("",!0)],512))}});const _y=Yt(NK,[["__scopeId","data-v-b9569bbd"]]);const jK={},VK={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024"},UK=re("path",{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-696 72h136v656H184V184zm656 656H384V384h456v456zM384 320V184h456v136H384z",fill:"currentColor"},null,-1),HK=[UK];function WK(e,t){return j(),ce("svg",VK,HK)}const YK=Yt(jK,[["render",WK]]),XK=e=>(Jr("data-v-301360a8"),e=e(),Qr(),e),KK={class:"images-top-bar"},GK={class:"options"},qK=["onClick"],ZK=["onClick"],JK=["onClick"],QK={key:1,class:"center-both",style:{gap:"12px"}},eG={key:2},tG=XK(()=>re("em",{style:{"font-size":"14px"}},"(long press to select multiple images)",-1)),nG=[tG],rG={key:0},iG={key:0,style:{display:"flex",gap:"8px"}},aG={key:1,class:"images"},oG={key:1},sG=Ee({__name:"ImagesView",setup(e){const{width:t}=qI(),n=wa(),r=Gt(),i=$t();function l(){i.selected=i.selected.filter(f=>!n.currentOutputs.map(s=>s.id).includes(f)),i.selected=[...i.selected,...n.currentOutputs.map(f=>f.id)],i.multiSelect=!0}async function v(){const f=await Lt.outputs.toCollection().primaryKeys();i.selected=f,i.multiSelect=!0}function o(){i.selected=i.selected.filter(f=>!n.currentOutputs.map(s=>s.id).includes(f)),i.selected.length===0&&(i.multiSelect=!1)}function a(){i.selected=[],i.multiSelect=!1}const u=()=>{uw.confirm(`This action will permanently delete ${i.selected.length} images. Continue?`,"Warning",{confirmButtonText:"OK",cancelButtonText:"Cancel",type:"warning"}).then(()=>{n.deleteMultipleOutputs(i.selected)})};ev(["a","A","ArrowLeft"],i.openModalToLeft),ev(["d","D","ArrowRight"],i.openModalToRight);async function h(){X2(i.selected)}const c=ee(()=>{let f=2;t.value>1440?f=6:t.value>1280?f=5:t.value>768?f=4:t.value>480&&(f=3);const s=[];for(let d=0;d(j(),ce(ze,null,[re("div",KK,[re("div",GK,[le(C(Xl),{placement:"bottom",title:"Sort By",trigger:"click",width:200,transition:"none","hide-after":0},{reference:pe(()=>[le(C(lt),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[le(C(zO))]),_:1})]),_:1})]),default:pe(()=>[(j(),ce(ze,null,Dt(["Newest","Oldest"],d=>re("div",{key:d,onClick:()=>C(n).sortBy=d,class:fe(`el-select-dropdown__item ${C(n).sortBy===d?"selected":""}`)},Ae(d),11,qK)),64))]),_:1}),le(C(Xl),{placement:"bottom",title:"Filter By",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[le(C(lt),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[le(C(jE))]),_:1})]),_:1})]),default:pe(()=>[(j(),ce(ze,null,Dt(["all","favourited","unfavourited","unrated"],d=>re("div",{key:d,onClick:()=>C(n).filterBy=d,class:fe(`el-select-dropdown__item ${C(n).filterBy===d?"selected":""}`)},Ae(C(n).filterBy===d?"Showing":"Show")+" "+Ae(d),11,ZK)),64))]),_:1}),le(C(Xl),{placement:"bottom",title:"Image Layout",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[le(C(lt),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[le(YK)]),_:1})]),_:1})]),default:pe(()=>[(j(),ce(ze,null,Dt([{label:"Square Grid",value:"grid"},{label:"Dynamic Layout",value:"dynamic"}],d=>re("div",{key:d.value,onClick:()=>C(n).currentLayout=d.value,class:fe(`el-select-dropdown__item ${C(n).currentLayout===d.value?"selected":""}`)},Ae(d.label),11,JK)),64))]),_:1}),le(C(Xl),{placement:"bottom",title:"Selection",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[le(C(lt),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[C(i).multiSelect?(j(),we(C(qb),{key:0})):(j(),we(C(fl),{key:1}))]),_:1})]),_:1})]),default:pe(()=>[C(i).multiSelect?(j(),ce("div",{key:0,class:"el-select-dropdown__item selected",onClick:s[0]||(s[0]=(...d)=>C(i).toggleMultiSelect&&C(i).toggleMultiSelect(...d))},"Disable multi-select")):(j(),ce("div",{key:1,class:"el-select-dropdown__item",onClick:s[1]||(s[1]=(...d)=>C(i).toggleMultiSelect&&C(i).toggleMultiSelect(...d))},"Enable multi-select")),C(i).selected.length>0?(j(),ce("div",{key:2,class:"el-select-dropdown__item selected",onClick:a},"Deselect All")):(j(),ce("div",{key:3,class:"el-select-dropdown__item",onClick:v},"Select All")),C(i).selected.every(d=>!C(n).currentOutputs.map(g=>g.id).includes(d))?(j(),ce("div",{key:5,class:"el-select-dropdown__item",onClick:l},"Select Page")):(j(),ce("div",{key:4,class:"el-select-dropdown__item selected",onClick:o},"Deselect Page"))]),_:1})]),C(r).pageless==="Disabled"?(j(),we(C(r9),{key:0,layout:"prev, pager, next",total:C(n).outputsLength,"page-size":C(r).pageSize,"current-page":C(n).currentPage,"onUpdate:currentPage":s[2]||(s[2]=d=>C(n).currentPage=d),"hide-on-single-page":""},null,8,["total","page-size","current-page"])):_e("",!0),C(i).multiSelect?(j(),ce("div",QK,[re("div",null,Ae(C(i).selected.length)+" selected",1),le(C(lt),{type:"danger",onClick:u,icon:C(Ec),plain:""},{default:pe(()=>[Ne("Delete")]),_:1},8,["icon"]),le(C(lt),{type:"success",onClick:h,icon:C(Ls),plain:"",style:{margin:"0"}},{default:pe(()=>[Ne("Download")]),_:1},8,["icon"])])):(j(),ce("div",eG,nG))]),C(n).outputsLength!=0?(j(),ce("div",rG,[C(n).currentLayout==="dynamic"?(j(),ce("div",iG,[(j(!0),ce(ze,null,Dt(C(c),(d,g)=>(j(),ce("div",{key:g,style:{flex:"1 1 0%"}},[(j(!0),ce(ze,null,Dt(d,m=>(j(),we(_y,{key:m.id,"image-data":m,style:{"margin-bottom":"8px"}},null,8,["image-data"]))),128))]))),128))])):_e("",!0),C(n).currentLayout==="grid"?(j(),ce("div",aG,[(j(!0),ce(ze,null,Dt(C(n).currentOutputs,d=>(j(),we(_y,{key:d.id,"image-data":d,style:{width:"200px",height:"200px"}},null,8,["image-data"]))),128))])):_e("",!0)])):_e("",!0),C(n).outputsLength==0?(j(),ce("div",oG,[le(C(kF),{description:"No Images Found"})])):_e("",!0)],64))}});const lG=Yt(sG,[["__scopeId","data-v-301360a8"]]),uG=Object.freeze(Object.defineProperty({__proto__:null,default:lG},Symbol.toStringTag,{value:"Module"})),cG=["href"],fG=Ee({__name:"BaseLink",props:{href:null,router:{type:Boolean}},setup(e){return(t,n)=>{const r=ht("router-link");return j(),ce(ze,null,[e.router?_e("",!0):(j(),ce("a",{key:0,target:"_blank",rel:"noreferrer noopener",href:e.href},[Te(t.$slots,"default",{},void 0,!0)],8,cG)),e.router?(j(),we(r,{key:1,to:e.href},{default:pe(()=>[Te(t.$slots,"default",{},void 0,!0)]),_:3},8,["to"])):_e("",!0)],64)}}});const dG=Yt(fG,[["__scopeId","data-v-17b53b7d"]]),Al=e=>(Jr("data-v-ecc278c5"),e=e(),Qr(),e),hG={class:"about"},pG={class:"about-content"},mG=Al(()=>re("h1",{style:{"margin-top":"0"}},"Stable UI",-1)),gG=Al(()=>re("div",null,[Ne("This tool was originally a front-end for the AI Horde and has since been converted for local generations with the A1111 API, such as in "),re("a",{href:"https://github.com/LostRuins/koboldcpp"},"KoboldCpp"),Ne(".")],-1)),vG=Al(()=>re("br",null,null,-1)),yG=Al(()=>re("div",null,"If you want to help improve this tool, you can find the currently maintained source code from this modified version on https://github.com/LostRuins/stable-ui and https://github.com/henk717/stable-ui, which is based off https://github.com/ayunami2000/stable-ui, which derives from the original AI Horde version on https://github.com/aqualxx/stable-ui (Original author aqualxx#5004). Feel free to contribute!",-1)),bG=Al(()=>re("br",null,null,-1)),_G=Ee({__name:"AboutView",setup(e){return(t,n)=>(j(),ce("div",hG,[re("div",pG,[mG,gG,vG,yG,bG,re("div",null,[Ne("You can find the KoboldAI community and authors of this fork on the "),le(dG,{href:"https://koboldai.org/discord"},{default:pe(()=>[Ne("KoboldAI Discord")]),_:1})])])]))}});const wG=Yt(_G,[["__scopeId","data-v-ecc278c5"]]),CG=Object.freeze(Object.defineProperty({__proto__:null,default:wG},Symbol.toStringTag,{value:"Module"}));const Ko=Ee({__name:"FormRadio",props:{label:null,modelValue:null,prop:null,useBoolean:{type:Boolean},options:null,disabled:{type:Boolean},info:null,labelStyle:null,change:null},emits:["update:modelValue"],setup(e,{emit:t}){const n=e;function r(l){if(n.useBoolean&&l==="Enabled"?t("update:modelValue",!0):n.useBoolean&&l==="Disabled"?t("update:modelValue",!1):t("update:modelValue",l),!!n.change)return n.useBoolean&&l==="Enabled"?n.change(!0):n.useBoolean&&l==="Disabled"?n.change(!1):n.change(l)}const i=ee(()=>n.useBoolean?n.modelValue===!0?"Enabled":n.modelValue===!1?"Disabled":n.modelValue:n.modelValue);return(l,v)=>(j(),we(C(xi),{prop:e.prop},{label:pe(()=>[le(xl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[Te(l.$slots,"label",{},()=>[Ne(Ae(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[le(C(_$),{disabled:e.disabled,"model-value":C(i),onChange:r},{default:pe(()=>[(j(!0),ce(ze,null,Dt(e.options,o=>(j(),we(C(w$),{key:o,label:o},null,8,["label"]))),128))]),_:1},8,["disabled","model-value"]),Te(l.$slots,"inline")]),_:3},8,["prop"]))}}),Pl=e=>(Jr("data-v-b37ed090"),e=e(),Qr(),e),SG=Pl(()=>re("h1",null,"Options",-1)),xG=Pl(()=>re("h2",null,"Generation Options",-1)),TG=Pl(()=>re("h2",null,"Image Options",-1)),kG=Pl(()=>re("div",null,[Ne("Drop file here OR "),re("em",null,"click to upload")],-1)),EG=Pl(()=>re("h2",null,"General Options",-1)),OG=Ee({__name:"OptionsView",setup(e){const t=Gt(),n=wa(),r=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"auto",label:"Auto"}],i=se([]),l=se(),v=se(!1),o=se(0);async function a(h){n.importFromZip(h),l.value.clearFiles()}async function u(){Ri({message:`Downloading ${n.outputsLength} image(s)... (this may take a while)`,type:"info"}),v.value=!0,o.value=0;const h=await Lt.outputs.toCollection().primaryKeys();await X2(h,!1,()=>{o.value++}),v.value=!1,o.value=0}return(h,c)=>(j(),ce(ze,null,[SG,le(C(xp),{"label-position":"top",model:C(t).options,onSubmit:c[9]||(c[9]=Ze(()=>{},["prevent"]))},{default:pe(()=>[le(C(Ej),{type:"border-card",style:{"min-height":"50vh"}},{default:pe(()=>[le(C(wf),{label:"\u{1F5A8}\uFE0F Generation"},{default:pe(()=>[xG,le(C(xi),{label:"Base URL"},{default:pe(()=>[le(C(La),{class:"apikey",prop:"baseURL",modelValue:C(t).baseURL,"onUpdate:modelValue":c[0]||(c[0]=f=>C(t).baseURL=f)},null,8,["modelValue"])]),_:1}),le(Ko,{label:"Allow Larger Params",prop:"pageless",modelValue:C(t).allowLargerParams,"onUpdate:modelValue":c[1]||(c[1]=f=>C(t).allowLargerParams=f),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(Ko,{label:"Video Gen: Request AVI download",prop:"pageless",modelValue:C(t).alsoRequestAvi,"onUpdate:modelValue":c[2]||(c[2]=f=>C(t).alsoRequestAvi=f),options:["Enabled","Disabled"]},null,8,["modelValue"])]),_:1}),le(C(wf),{label:"\u{1F4F7} Images"},{default:pe(()=>[TG,le(En,{label:"Images Per Page",prop:"pageSize",modelValue:C(t).pageSize,"onUpdate:modelValue":c[3]||(c[3]=f=>C(t).pageSize=f),min:10,max:50,step:5,disabled:C(t).pageless==="Enabled"},null,8,["modelValue","disabled"]),le(Ko,{label:"Pageless Format",prop:"pageless",modelValue:C(t).pageless,"onUpdate:modelValue":c[4]||(c[4]=f=>C(t).pageless=f),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(Ko,{label:"Carousel Auto Cycle",prop:"autoCarousel",modelValue:C(t).autoCarousel,"onUpdate:modelValue":c[5]||(c[5]=f=>C(t).autoCarousel=f),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(Ko,{label:"Image Download Format",prop:"downloadType",modelValue:C(t).imageDownloadType,"onUpdate:modelValue":c[6]||(c[6]=f=>C(t).imageDownloadType=f),options:["PNG","JPG","WEBP","GIF"]},null,8,["modelValue"]),le(C(xi),{label:"Export Images (ZIP File)"},{default:pe(()=>[v.value?(j(),we(C(lt),{key:1,icon:C(Ls),disabled:""},{default:pe(()=>[Ne("Downloading... ("+Ae(o.value)+" / "+Ae(C(n).outputsLength)+" image(s))",1)]),_:1},8,["icon"])):(j(),we(C(lt),{key:0,icon:C(Ls),onClick:c[7]||(c[7]=f=>u())},{default:pe(()=>[Ne("Download "+Ae(C(n).outputsLength)+" image(s)",1)]),_:1},8,["icon"]))]),_:1}),le(C(xi),{label:"Import Images (ZIP File)"},{default:pe(()=>[le(C(Pp),{drag:"",ref_key:"upload",ref:l,"auto-upload":!1,onChange:a,"file-list":i.value,limit:1,multiple:""},{default:pe(()=>[le(C(De),{size:100},{default:pe(()=>[le(C(Kh))]),_:1}),kG]),_:1},8,["file-list"])]),_:1})]),_:1}),le(C(wf),{label:"\u2699\uFE0F General"},{default:pe(()=>[EG,le(Au,{label:"Color Scheme",prop:"colorScheme",modelValue:C(t).options.colorMode,"onUpdate:modelValue":c[8]||(c[8]=f=>C(t).options.colorMode=f),options:r},null,8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["model"])],64))}});const AG=Yt(OG,[["__scopeId","data-v-b37ed090"]]),PG=Object.freeze(Object.defineProperty({__proto__:null,default:AG},Symbol.toStringTag,{value:"Module"})); -