image-salon-sdk 1.0.65 → 1.0.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  import './style.css';
2
- (function(Ce,Ie){typeof exports=="object"&&typeof module<"u"?module.exports=Ie():typeof define=="function"&&define.amd?define(Ie):(Ce=typeof globalThis<"u"?globalThis:Ce||self,Ce.ImageSalonSdk=Ie())})(this,function(){"use strict";var js=Object.defineProperty;var oi=Ce=>{throw TypeError(Ce)};var qs=(Ce,Ie,Ne)=>Ie in Ce?js(Ce,Ie,{enumerable:!0,configurable:!0,writable:!0,value:Ne}):Ce[Ie]=Ne;var Be=(Ce,Ie,Ne)=>qs(Ce,typeof Ie!="symbol"?Ie+"":Ie,Ne),ai=(Ce,Ie,Ne)=>Ie.has(Ce)||oi("Cannot "+Ne);var F=(Ce,Ie,Ne)=>(ai(Ce,Ie,"read from private field"),Ne?Ne.call(Ce):Ie.get(Ce)),ce=(Ce,Ie,Ne)=>Ie.has(Ce)?oi("Cannot add the same private member more than once"):Ie instanceof WeakSet?Ie.add(Ce):Ie.set(Ce,Ne),G=(Ce,Ie,Ne,Xt)=>(ai(Ce,Ie,"write to private field"),Xt?Xt.call(Ce,Ne):Ie.set(Ce,Ne),Ne);var Lt,wt,sn,Dt,He,We,xt,Oe,ze,yt,ot,Gt,Mt,vt,bt,Vt,on,fr,Ht,Wt,Ut,Jt,At,kt,Pt,$t,_t,an,vn,Ge,Bt,An,$n,kn,It,ln,Zt,cn,dn,hn,un,fn,In,Fn,pn,Ft,mn,Zn;function Ce(r){let e=typeof r;if(e=="object"){if(Array.isArray(r))return"array";if(r===null)return"null"}return e}function Ie(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}let Ne="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Xt=[];for(let r=0;r<Ne.length;r++)Xt[Ne[r].charCodeAt(0)]=r;Xt[45]=Ne.indexOf("+"),Xt[95]=Ne.indexOf("/");function gr(r){let e=r.length*3/4;r[r.length-2]=="="?e-=2:r[r.length-1]=="="&&(e-=1);let t=new Uint8Array(e),n=0,i=0,s,d=0;for(let u=0;u<r.length;u++){if(s=Xt[r.charCodeAt(u)],s===void 0)switch(r[u]){case"=":i=0;case`
3
- `:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(i){case 0:d=s,i=1;break;case 1:t[n++]=d<<2|(s&48)>>4,d=s,i=2;break;case 2:t[n++]=(d&15)<<4|(s&60)>>2,d=s,i=3;break;case 3:t[n++]=(d&3)<<6|s,i=0;break}}if(i==1)throw Error("invalid base64 string.");return t.subarray(0,n)}function wr(r){let e="",t=0,n,i=0;for(let s=0;s<r.length;s++)switch(n=r[s],t){case 0:e+=Ne[n>>2],i=(n&3)<<4,t=1;break;case 1:e+=Ne[i|n>>4],i=(n&15)<<2,t=2;break;case 2:e+=Ne[i|n>>6],e+=Ne[n&63],t=0;break}return t&&(e+=Ne[i],e+="=",t==1&&(e+="=")),e}var ue;(function(r){r.symbol=Symbol.for("protobuf-ts/unknown"),r.onRead=(t,n,i,s,d)=>{(e(n)?n[r.symbol]:n[r.symbol]=[]).push({no:i,wireType:s,data:d})},r.onWrite=(t,n,i)=>{for(let{no:s,wireType:d,data:u}of r.list(n))i.tag(s,d).raw(u)},r.list=(t,n)=>{if(e(t)){let i=t[r.symbol];return n?i.filter(s=>s.no==n):i}return[]},r.last=(t,n)=>r.list(t,n).slice(-1)[0];const e=t=>t&&Array.isArray(t[r.symbol])})(ue||(ue={}));function li(r,e){return Object.assign(Object.assign({},r),e)}var te;(function(r){r[r.Varint=0]="Varint",r[r.Bit64=1]="Bit64",r[r.LengthDelimited=2]="LengthDelimited",r[r.StartGroup=3]="StartGroup",r[r.EndGroup=4]="EndGroup",r[r.Bit32=5]="Bit32"})(te||(te={}));function ci(){let r=0,e=0;for(let n=0;n<28;n+=7){let i=this.buf[this.pos++];if(r|=(i&127)<<n,!(i&128))return this.assertBounds(),[r,e]}let t=this.buf[this.pos++];if(r|=(t&15)<<28,e=(t&112)>>4,!(t&128))return this.assertBounds(),[r,e];for(let n=3;n<=31;n+=7){let i=this.buf[this.pos++];if(e|=(i&127)<<n,!(i&128))return this.assertBounds(),[r,e]}throw new Error("invalid varint")}function Xn(r,e,t){for(let s=0;s<28;s=s+7){const d=r>>>s,u=!(!(d>>>7)&&e==0),g=(u?d|128:d)&255;if(t.push(g),!u)return}const n=r>>>28&15|(e&7)<<4,i=!!(e>>3);if(t.push((i?n|128:n)&255),!!i){for(let s=3;s<31;s=s+7){const d=e>>>s,u=!!(d>>>7),g=(u?d|128:d)&255;if(t.push(g),!u)return}t.push(e>>>31&1)}}const _n=65536*65536;function yr(r){let e=r[0]=="-";e&&(r=r.slice(1));const t=1e6;let n=0,i=0;function s(d,u){const g=Number(r.slice(d,u));i*=t,n=n*t+g,n>=_n&&(i=i+(n/_n|0),n=n%_n)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),[e,n,i]}function Gn(r,e){if(e>>>0<=2097151)return""+(_n*e+(r>>>0));let t=r&16777215,n=(r>>>24|e<<8)>>>0&16777215,i=e>>16&65535,s=t+n*6777216+i*6710656,d=n+i*8147497,u=i*2,g=1e7;s>=g&&(d+=Math.floor(s/g),s%=g),d>=g&&(u+=Math.floor(d/g),d%=g);function v(V,ne){let ie=V?String(V):"";return ne?"0000000".slice(ie.length)+ie:ie}return v(u,0)+v(d,u)+v(s,1)}function br(r,e){if(r>=0){for(;r>127;)e.push(r&127|128),r=r>>>7;e.push(r)}else{for(let t=0;t<9;t++)e.push(r&127|128),r=r>>7;e.push(1)}}function di(){let r=this.buf[this.pos++],e=r&127;if(!(r&128))return this.assertBounds(),e;if(r=this.buf[this.pos++],e|=(r&127)<<7,!(r&128))return this.assertBounds(),e;if(r=this.buf[this.pos++],e|=(r&127)<<14,!(r&128))return this.assertBounds(),e;if(r=this.buf[this.pos++],e|=(r&127)<<21,!(r&128))return this.assertBounds(),e;r=this.buf[this.pos++],e|=(r&15)<<28;for(let t=5;r&128&&t<10;t++)r=this.buf[this.pos++];if(r&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}let Ee;function hi(){const r=new DataView(new ArrayBuffer(8));Ee=globalThis.BigInt!==void 0&&typeof r.getBigInt64=="function"&&typeof r.getBigUint64=="function"&&typeof r.setBigInt64=="function"&&typeof r.setBigUint64=="function"?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:r}:void 0}hi();function Cr(r){if(!r)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}const Er=/^-?[0-9]+$/,Bn=4294967296,On=2147483648;class vr{constructor(e,t){this.lo=e|0,this.hi=t|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*Bn+(this.lo>>>0);if(!Number.isSafeInteger(e))throw new Error("cannot convert to safe number");return e}}class Qe extends vr{static from(e){if(Ee)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=Ee.C(e);case"number":if(e===0)return this.ZERO;e=Ee.C(e);case"bigint":if(!e)return this.ZERO;if(e<Ee.UMIN)throw new Error("signed value for ulong");if(e>Ee.UMAX)throw new Error("ulong too large");return Ee.V.setBigUint64(0,e,!0),new Qe(Ee.V.getInt32(0,!0),Ee.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!Er.test(e))throw new Error("string is no integer");let[t,n,i]=yr(e);if(t)throw new Error("signed value for ulong");return new Qe(n,i);case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");if(e<0)throw new Error("signed value for ulong");return new Qe(e,e/Bn)}throw new Error("unknown value "+typeof e)}toString(){return Ee?this.toBigInt().toString():Gn(this.lo,this.hi)}toBigInt(){return Cr(Ee),Ee.V.setInt32(0,this.lo,!0),Ee.V.setInt32(4,this.hi,!0),Ee.V.getBigUint64(0,!0)}}Qe.ZERO=new Qe(0,0);class Me extends vr{static from(e){if(Ee)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=Ee.C(e);case"number":if(e===0)return this.ZERO;e=Ee.C(e);case"bigint":if(!e)return this.ZERO;if(e<Ee.MIN)throw new Error("signed long too small");if(e>Ee.MAX)throw new Error("signed long too large");return Ee.V.setBigInt64(0,e,!0),new Me(Ee.V.getInt32(0,!0),Ee.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!Er.test(e))throw new Error("string is no integer");let[t,n,i]=yr(e);if(t){if(i>On||i==On&&n!=0)throw new Error("signed long too small")}else if(i>=On)throw new Error("signed long too large");let s=new Me(n,i);return t?s.negate():s;case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");return e>0?new Me(e,e/Bn):new Me(-e,-e/Bn).negate()}throw new Error("unknown value "+typeof e)}isNegative(){return(this.hi&On)!==0}negate(){let e=~this.hi,t=this.lo;return t?t=~t+1:e+=1,new Me(t,e)}toString(){if(Ee)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return"-"+Gn(e.lo,e.hi)}return Gn(this.lo,this.hi)}toBigInt(){return Cr(Ee),Ee.V.setInt32(0,this.lo,!0),Ee.V.setInt32(4,this.hi,!0),Ee.V.getBigInt64(0,!0)}}Me.ZERO=new Me(0,0);const Ar={readUnknownField:!0,readerFactory:r=>new fi(r)};function ui(r){return r?Object.assign(Object.assign({},Ar),r):Ar}class fi{constructor(e,t){this.varint64=ci,this.uint32=di,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t??new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw new Error("illegal tag: field no "+t+" wire type "+n);return[t,n]}skip(e){let t=this.pos;switch(e){case te.Varint:for(;this.buf[this.pos++]&128;);break;case te.Bit64:this.pos+=4;case te.Bit32:this.pos+=4;break;case te.LengthDelimited:let n=this.uint32();this.pos+=n;break;case te.StartGroup:let i;for(;(i=this.tag()[1])!==te.EndGroup;)this.skip(i);break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(t,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return new Me(...this.varint64())}uint64(){return new Qe(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,new Me(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return new Qe(this.sfixed32(),this.sfixed32())}sfixed64(){return new Me(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}}function fe(r,e){if(!r)throw new Error(e)}const pi=34028234663852886e22,mi=-34028234663852886e22,gi=4294967295,wi=2147483647,yi=-2147483648;function yn(r){if(typeof r!="number")throw new Error("invalid int 32: "+typeof r);if(!Number.isInteger(r)||r>wi||r<yi)throw new Error("invalid int 32: "+r)}function Sn(r){if(typeof r!="number")throw new Error("invalid uint 32: "+typeof r);if(!Number.isInteger(r)||r>gi||r<0)throw new Error("invalid uint 32: "+r)}function Jn(r){if(typeof r!="number")throw new Error("invalid float 32: "+typeof r);if(Number.isFinite(r)&&(r>pi||r<mi))throw new Error("invalid float 32: "+r)}const kr={writeUnknownFields:!0,writerFactory:()=>new Ci};function bi(r){return r?Object.assign(Object.assign({},kr),r):kr}class Ci{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let i=0;i<this.chunks.length;i++)e+=this.chunks[i].length;let t=new Uint8Array(e),n=0;for(let i=0;i<this.chunks.length;i++)t.set(this.chunks[i],n),n+=this.chunks[i].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(Sn(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return yn(e),br(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){Jn(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){Sn(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){yn(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return yn(e),e=(e<<1^e>>31)>>>0,br(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),i=Me.from(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),i=Qe.from(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(t)}int64(e){let t=Me.from(e);return Xn(t.lo,t.hi,this.buf),this}sint64(e){let t=Me.from(e),n=t.hi>>31,i=t.lo<<1^n,s=(t.hi<<1|t.lo>>>31)^n;return Xn(i,s,this.buf),this}uint64(e){let t=Qe.from(e);return Xn(t.lo,t.hi,this.buf),this}}const Ir={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},Fr={ignoreUnknownFields:!1};function Ei(r){return r?Object.assign(Object.assign({},Fr),r):Fr}function vi(r){return r?Object.assign(Object.assign({},Ir),r):Ir}function Ai(r,e){var t,n;let i=Object.assign(Object.assign({},r),e);return i.typeRegistry=[...(t=r==null?void 0:r.typeRegistry)!==null&&t!==void 0?t:[],...(n=e==null?void 0:e.typeRegistry)!==null&&n!==void 0?n:[]],i}const Nr=Symbol.for("protobuf-ts/message-type");function Yn(r){let e=!1;const t=[];for(let n=0;n<r.length;n++){let i=r.charAt(n);i=="_"?e=!0:/\d/.test(i)?(t.push(i),e=!0):e?(t.push(i.toUpperCase()),e=!1):n==0?t.push(i.toLowerCase()):t.push(i)}return t.join("")}var $;(function(r){r[r.DOUBLE=1]="DOUBLE",r[r.FLOAT=2]="FLOAT",r[r.INT64=3]="INT64",r[r.UINT64=4]="UINT64",r[r.INT32=5]="INT32",r[r.FIXED64=6]="FIXED64",r[r.FIXED32=7]="FIXED32",r[r.BOOL=8]="BOOL",r[r.STRING=9]="STRING",r[r.BYTES=12]="BYTES",r[r.UINT32=13]="UINT32",r[r.SFIXED32=15]="SFIXED32",r[r.SFIXED64=16]="SFIXED64",r[r.SINT32=17]="SINT32",r[r.SINT64=18]="SINT64"})($||($={}));var Et;(function(r){r[r.BIGINT=0]="BIGINT",r[r.STRING=1]="STRING",r[r.NUMBER=2]="NUMBER"})(Et||(Et={}));var Rn;(function(r){r[r.NO=0]="NO",r[r.PACKED=1]="PACKED",r[r.UNPACKED=2]="UNPACKED"})(Rn||(Rn={}));function ki(r){var e,t,n,i;return r.localName=(e=r.localName)!==null&&e!==void 0?e:Yn(r.name),r.jsonName=(t=r.jsonName)!==null&&t!==void 0?t:Yn(r.name),r.repeat=(n=r.repeat)!==null&&n!==void 0?n:Rn.NO,r.opt=(i=r.opt)!==null&&i!==void 0?i:r.repeat||r.oneof?!1:r.kind=="message",r}function Ii(r){if(typeof r!="object"||r===null||!r.hasOwnProperty("oneofKind"))return!1;switch(typeof r.oneofKind){case"string":return r[r.oneofKind]===void 0?!1:Object.keys(r).length==2;case"undefined":return Object.keys(r).length==1;default:return!1}}class Fi{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}prepare(){if(this.data)return;const e=[],t=[],n=[];for(let i of this.fields)if(i.oneof)n.includes(i.oneof)||(n.push(i.oneof),e.push(i.oneof),t.push(i.oneof));else switch(t.push(i.localName),i.kind){case"scalar":case"enum":(!i.opt||i.repeat)&&e.push(i.localName);break;case"message":i.repeat&&e.push(i.localName);break;case"map":e.push(i.localName);break}this.data={req:e,known:t,oneofs:Object.values(n)}}is(e,t,n=!1){if(t<0)return!0;if(e==null||typeof e!="object")return!1;this.prepare();let i=Object.keys(e),s=this.data;if(i.length<s.req.length||s.req.some(d=>!i.includes(d))||!n&&i.some(d=>!s.known.includes(d)))return!1;if(t<1)return!0;for(const d of s.oneofs){const u=e[d];if(!Ii(u))return!1;if(u.oneofKind===void 0)continue;const g=this.fields.find(v=>v.localName===u.oneofKind);if(!g||!this.field(u[u.oneofKind],g,n,t))return!1}for(const d of this.fields)if(d.oneof===void 0&&!this.field(e[d.localName],d,n,t))return!1;return!0}field(e,t,n,i){let s=t.repeat;switch(t.kind){case"scalar":return e===void 0?t.opt:s?this.scalars(e,t.T,i,t.L):this.scalar(e,t.T,t.L);case"enum":return e===void 0?t.opt:s?this.scalars(e,$.INT32,i):this.scalar(e,$.INT32);case"message":return e===void 0?!0:s?this.messages(e,t.T(),n,i):this.message(e,t.T(),n,i);case"map":if(typeof e!="object"||e===null)return!1;if(i<2)return!0;if(!this.mapKeys(e,t.K,i))return!1;switch(t.V.kind){case"scalar":return this.scalars(Object.values(e),t.V.T,i,t.V.L);case"enum":return this.scalars(Object.values(e),$.INT32,i);case"message":return this.messages(Object.values(e),t.V.T(),n,i)}break}return!0}message(e,t,n,i){return n?t.isAssignable(e,i):t.is(e,i)}messages(e,t,n,i){if(!Array.isArray(e))return!1;if(i<2)return!0;if(n){for(let s=0;s<e.length&&s<i;s++)if(!t.isAssignable(e[s],i-1))return!1}else for(let s=0;s<e.length&&s<i;s++)if(!t.is(e[s],i-1))return!1;return!0}scalar(e,t,n){let i=typeof e;switch(t){case $.UINT64:case $.FIXED64:case $.INT64:case $.SFIXED64:case $.SINT64:switch(n){case Et.BIGINT:return i=="bigint";case Et.NUMBER:return i=="number"&&!isNaN(e);default:return i=="string"}case $.BOOL:return i=="boolean";case $.STRING:return i=="string";case $.BYTES:return e instanceof Uint8Array;case $.DOUBLE:case $.FLOAT:return i=="number"&&!isNaN(e);default:return i=="number"&&Number.isInteger(e)}}scalars(e,t,n,i){if(!Array.isArray(e))return!1;if(n<2)return!0;if(Array.isArray(e)){for(let s=0;s<e.length&&s<n;s++)if(!this.scalar(e[s],t,i))return!1}return!0}mapKeys(e,t,n){let i=Object.keys(e);switch(t){case $.INT32:case $.FIXED32:case $.SFIXED32:case $.SINT32:case $.UINT32:return this.scalars(i.slice(0,n).map(s=>parseInt(s)),t,n);case $.BOOL:return this.scalars(i.slice(0,n).map(s=>s=="true"?!0:s=="false"?!1:s),t,n);default:return this.scalars(i,t,n,Et.STRING)}}}function ft(r,e){switch(e){case Et.BIGINT:return r.toBigInt();case Et.NUMBER:return r.toNumber();default:return r.toString()}}class Ni{constructor(e){this.info=e}prepare(){var e;if(this.fMap===void 0){this.fMap={};const t=(e=this.info.fields)!==null&&e!==void 0?e:[];for(const n of t)this.fMap[n.name]=n,this.fMap[n.jsonName]=n,this.fMap[n.localName]=n}}assert(e,t,n){if(!e){let i=Ce(n);throw(i=="number"||i=="boolean")&&(i=n.toString()),new Error(`Cannot parse JSON ${i} for ${this.info.typeName}#${t}`)}}read(e,t,n){this.prepare();const i=[];for(const[s,d]of Object.entries(e)){const u=this.fMap[s];if(!u){if(!n.ignoreUnknownFields)throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${s}`);continue}const g=u.localName;let v;if(u.oneof){if(d===null&&(u.kind!=="enum"||u.T()[0]!=="google.protobuf.NullValue"))continue;if(i.includes(u.oneof))throw new Error(`Multiple members of the oneof group "${u.oneof}" of ${this.info.typeName} are present in JSON.`);i.push(u.oneof),v=t[u.oneof]={oneofKind:g}}else v=t;if(u.kind=="map"){if(d===null)continue;this.assert(Ie(d),u.name,d);const V=v[g];for(const[ne,ie]of Object.entries(d)){this.assert(ie!==null,u.name+" map value",null);let he;switch(u.V.kind){case"message":he=u.V.T().internalJsonRead(ie,n);break;case"enum":if(he=this.enum(u.V.T(),ie,u.name,n.ignoreUnknownFields),he===!1)continue;break;case"scalar":he=this.scalar(ie,u.V.T,u.V.L,u.name);break}this.assert(he!==void 0,u.name+" map value",ie);let we=ne;u.K==$.BOOL&&(we=we=="true"?!0:we=="false"?!1:we),we=this.scalar(we,u.K,Et.STRING,u.name).toString(),V[we]=he}}else if(u.repeat){if(d===null)continue;this.assert(Array.isArray(d),u.name,d);const V=v[g];for(const ne of d){this.assert(ne!==null,u.name,null);let ie;switch(u.kind){case"message":ie=u.T().internalJsonRead(ne,n);break;case"enum":if(ie=this.enum(u.T(),ne,u.name,n.ignoreUnknownFields),ie===!1)continue;break;case"scalar":ie=this.scalar(ne,u.T,u.L,u.name);break}this.assert(ie!==void 0,u.name,d),V.push(ie)}}else switch(u.kind){case"message":if(d===null&&u.T().typeName!="google.protobuf.Value"){this.assert(u.oneof===void 0,u.name+" (oneof member)",null);continue}v[g]=u.T().internalJsonRead(d,n,v[g]);break;case"enum":let V=this.enum(u.T(),d,u.name,n.ignoreUnknownFields);if(V===!1)continue;v[g]=V;break;case"scalar":v[g]=this.scalar(d,u.T,u.L,u.name);break}}}enum(e,t,n,i){if(e[0]=="google.protobuf.NullValue"&&fe(t===null||t==="NULL_VALUE",`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} only accepts null.`),t===null)return 0;switch(typeof t){case"number":return fe(Number.isInteger(t),`Unable to parse field ${this.info.typeName}#${n}, enum can only be integral number, got ${t}.`),t;case"string":let s=t;e[2]&&t.substring(0,e[2].length)===e[2]&&(s=t.substring(e[2].length));let d=e[1][s];return typeof d>"u"&&i?!1:(fe(typeof d=="number",`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} has no value for "${t}".`),d)}fe(!1,`Unable to parse field ${this.info.typeName}#${n}, cannot parse enum value from ${typeof t}".`)}scalar(e,t,n,i){let s;try{switch(t){case $.DOUBLE:case $.FLOAT:if(e===null)return 0;if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""){s="empty string";break}if(typeof e=="string"&&e.trim().length!==e.length){s="extra whitespace";break}if(typeof e!="string"&&typeof e!="number")break;let d=Number(e);if(Number.isNaN(d)){s="not a number";break}if(!Number.isFinite(d)){s="too large or small";break}return t==$.FLOAT&&Jn(d),d;case $.INT32:case $.FIXED32:case $.SFIXED32:case $.SINT32:case $.UINT32:if(e===null)return 0;let u;if(typeof e=="number"?u=e:e===""?s="empty string":typeof e=="string"&&(e.trim().length!==e.length?s="extra whitespace":u=Number(e)),u===void 0)break;return t==$.UINT32?Sn(u):yn(u),u;case $.INT64:case $.SFIXED64:case $.SINT64:if(e===null)return ft(Me.ZERO,n);if(typeof e!="number"&&typeof e!="string")break;return ft(Me.from(e),n);case $.FIXED64:case $.UINT64:if(e===null)return ft(Qe.ZERO,n);if(typeof e!="number"&&typeof e!="string")break;return ft(Qe.from(e),n);case $.BOOL:if(e===null)return!1;if(typeof e!="boolean")break;return e;case $.STRING:if(e===null)return"";if(typeof e!="string"){s="extra whitespace";break}try{encodeURIComponent(e)}catch(g){g="invalid UTF8";break}return e;case $.BYTES:if(e===null||e==="")return new Uint8Array(0);if(typeof e!="string")break;return gr(e)}}catch(d){s=d.message}this.assert(!1,i+(s?" - "+s:""),e)}}class Ti{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}write(e,t){const n={},i=e;for(const s of this.fields){if(!s.oneof){let v=this.field(s,i[s.localName],t);v!==void 0&&(n[t.useProtoFieldName?s.name:s.jsonName]=v);continue}const d=i[s.oneof];if(d.oneofKind!==s.localName)continue;const u=s.kind=="scalar"||s.kind=="enum"?Object.assign(Object.assign({},t),{emitDefaultValues:!0}):t;let g=this.field(s,d[s.localName],u);fe(g!==void 0),n[t.useProtoFieldName?s.name:s.jsonName]=g}return n}field(e,t,n){let i;if(e.kind=="map"){fe(typeof t=="object"&&t!==null);const s={};switch(e.V.kind){case"scalar":for(const[g,v]of Object.entries(t)){const V=this.scalar(e.V.T,v,e.name,!1,!0);fe(V!==void 0),s[g.toString()]=V}break;case"message":const d=e.V.T();for(const[g,v]of Object.entries(t)){const V=this.message(d,v,e.name,n);fe(V!==void 0),s[g.toString()]=V}break;case"enum":const u=e.V.T();for(const[g,v]of Object.entries(t)){fe(v===void 0||typeof v=="number");const V=this.enum(u,v,e.name,!1,!0,n.enumAsInteger);fe(V!==void 0),s[g.toString()]=V}break}(n.emitDefaultValues||Object.keys(s).length>0)&&(i=s)}else if(e.repeat){fe(Array.isArray(t));const s=[];switch(e.kind){case"scalar":for(let g=0;g<t.length;g++){const v=this.scalar(e.T,t[g],e.name,e.opt,!0);fe(v!==void 0),s.push(v)}break;case"enum":const d=e.T();for(let g=0;g<t.length;g++){fe(t[g]===void 0||typeof t[g]=="number");const v=this.enum(d,t[g],e.name,e.opt,!0,n.enumAsInteger);fe(v!==void 0),s.push(v)}break;case"message":const u=e.T();for(let g=0;g<t.length;g++){const v=this.message(u,t[g],e.name,n);fe(v!==void 0),s.push(v)}break}(n.emitDefaultValues||s.length>0||n.emitDefaultValues)&&(i=s)}else switch(e.kind){case"scalar":i=this.scalar(e.T,t,e.name,e.opt,n.emitDefaultValues);break;case"enum":i=this.enum(e.T(),t,e.name,e.opt,n.emitDefaultValues,n.enumAsInteger);break;case"message":i=this.message(e.T(),t,e.name,n);break}return i}enum(e,t,n,i,s,d){if(e[0]=="google.protobuf.NullValue")return!s&&!i?void 0:null;if(t===void 0){fe(i);return}if(!(t===0&&!s&&!i))return fe(typeof t=="number"),fe(Number.isInteger(t)),d||!e[1].hasOwnProperty(t)?t:e[2]?e[2]+e[1][t]:e[1][t]}message(e,t,n,i){return t===void 0?i.emitDefaultValues?null:void 0:e.internalJsonWrite(t,i)}scalar(e,t,n,i,s){if(t===void 0){fe(i);return}const d=s||i;switch(e){case $.INT32:case $.SFIXED32:case $.SINT32:return t===0?d?0:void 0:(yn(t),t);case $.FIXED32:case $.UINT32:return t===0?d?0:void 0:(Sn(t),t);case $.FLOAT:Jn(t);case $.DOUBLE:return t===0?d?0:void 0:(fe(typeof t=="number"),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t);case $.STRING:return t===""?d?"":void 0:(fe(typeof t=="string"),t);case $.BOOL:return t===!1?d?!1:void 0:(fe(typeof t=="boolean"),t);case $.UINT64:case $.FIXED64:fe(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let u=Qe.from(t);return u.isZero()&&!d?void 0:u.toString();case $.INT64:case $.SFIXED64:case $.SINT64:fe(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let g=Me.from(t);return g.isZero()&&!d?void 0:g.toString();case $.BYTES:return fe(t instanceof Uint8Array),t.byteLength?wr(t):d?"":void 0}}}function Qn(r,e=Et.STRING){switch(r){case $.BOOL:return!1;case $.UINT64:case $.FIXED64:return ft(Qe.ZERO,e);case $.INT64:case $.SFIXED64:case $.SINT64:return ft(Me.ZERO,e);case $.DOUBLE:case $.FLOAT:return 0;case $.BYTES:return new Uint8Array(0);case $.STRING:return"";default:return 0}}class Li{constructor(e){this.info=e}prepare(){var e;if(!this.fieldNoToField){const t=(e=this.info.fields)!==null&&e!==void 0?e:[];this.fieldNoToField=new Map(t.map(n=>[n.no,n]))}}read(e,t,n,i){this.prepare();const s=i===void 0?e.len:e.pos+i;for(;e.pos<s;){const[d,u]=e.tag(),g=this.fieldNoToField.get(d);if(!g){let ie=n.readUnknownField;if(ie=="throw")throw new Error(`Unknown field ${d} (wire type ${u}) for ${this.info.typeName}`);let he=e.skip(u);ie!==!1&&(ie===!0?ue.onRead:ie)(this.info.typeName,t,d,u,he);continue}let v=t,V=g.repeat,ne=g.localName;switch(g.oneof&&(v=v[g.oneof],v.oneofKind!==ne&&(v=t[g.oneof]={oneofKind:ne})),g.kind){case"scalar":case"enum":let ie=g.kind=="enum"?$.INT32:g.T,he=g.kind=="scalar"?g.L:void 0;if(V){let me=v[ne];if(u==te.LengthDelimited&&ie!=$.STRING&&ie!=$.BYTES){let be=e.uint32()+e.pos;for(;e.pos<be;)me.push(this.scalar(e,ie,he))}else me.push(this.scalar(e,ie,he))}else v[ne]=this.scalar(e,ie,he);break;case"message":if(V){let me=v[ne],be=g.T().internalBinaryRead(e,e.uint32(),n);me.push(be)}else v[ne]=g.T().internalBinaryRead(e,e.uint32(),n,v[ne]);break;case"map":let[we,Ue]=this.mapEntry(g,e,n);v[ne][we]=Ue;break}}}mapEntry(e,t,n){let i=t.uint32(),s=t.pos+i,d,u;for(;t.pos<s;){let[g,v]=t.tag();switch(g){case 1:e.K==$.BOOL?d=t.bool().toString():d=this.scalar(t,e.K,Et.STRING);break;case 2:switch(e.V.kind){case"scalar":u=this.scalar(t,e.V.T,e.V.L);break;case"enum":u=t.int32();break;case"message":u=e.V.T().internalBinaryRead(t,t.uint32(),n);break}break;default:throw new Error(`Unknown field ${g} (wire type ${v}) in map entry for ${this.info.typeName}#${e.name}`)}}if(d===void 0){let g=Qn(e.K);d=e.K==$.BOOL?g.toString():g}if(u===void 0)switch(e.V.kind){case"scalar":u=Qn(e.V.T,e.V.L);break;case"enum":u=0;break;case"message":u=e.V.T().create();break}return[d,u]}scalar(e,t,n){switch(t){case $.INT32:return e.int32();case $.STRING:return e.string();case $.BOOL:return e.bool();case $.DOUBLE:return e.double();case $.FLOAT:return e.float();case $.INT64:return ft(e.int64(),n);case $.UINT64:return ft(e.uint64(),n);case $.FIXED64:return ft(e.fixed64(),n);case $.FIXED32:return e.fixed32();case $.BYTES:return e.bytes();case $.UINT32:return e.uint32();case $.SFIXED32:return e.sfixed32();case $.SFIXED64:return ft(e.sfixed64(),n);case $.SINT32:return e.sint32();case $.SINT64:return ft(e.sint64(),n)}}}class xi{constructor(e){this.info=e}prepare(){if(!this.fields){const e=this.info.fields?this.info.fields.concat():[];this.fields=e.sort((t,n)=>t.no-n.no)}}write(e,t,n){this.prepare();for(const s of this.fields){let d,u,g=s.repeat,v=s.localName;if(s.oneof){const V=e[s.oneof];if(V.oneofKind!==v)continue;d=V[v],u=!0}else d=e[v],u=!1;switch(s.kind){case"scalar":case"enum":let V=s.kind=="enum"?$.INT32:s.T;if(g)if(fe(Array.isArray(d)),g==Rn.PACKED)this.packed(t,V,s.no,d);else for(const ne of d)this.scalar(t,V,s.no,ne,!0);else d===void 0?fe(s.opt):this.scalar(t,V,s.no,d,u||s.opt);break;case"message":if(g){fe(Array.isArray(d));for(const ne of d)this.message(t,n,s.T(),s.no,ne)}else this.message(t,n,s.T(),s.no,d);break;case"map":fe(typeof d=="object"&&d!==null);for(const[ne,ie]of Object.entries(d))this.mapEntry(t,n,s,ne,ie);break}}let i=n.writeUnknownFields;i!==!1&&(i===!0?ue.onWrite:i)(this.info.typeName,e,t)}mapEntry(e,t,n,i,s){e.tag(n.no,te.LengthDelimited),e.fork();let d=i;switch(n.K){case $.INT32:case $.FIXED32:case $.UINT32:case $.SFIXED32:case $.SINT32:d=Number.parseInt(i);break;case $.BOOL:fe(i=="true"||i=="false"),d=i=="true";break}switch(this.scalar(e,n.K,1,d,!0),n.V.kind){case"scalar":this.scalar(e,n.V.T,2,s,!0);break;case"enum":this.scalar(e,$.INT32,2,s,!0);break;case"message":this.message(e,t,n.V.T(),2,s);break}e.join()}message(e,t,n,i,s){s!==void 0&&(n.internalBinaryWrite(s,e.tag(i,te.LengthDelimited).fork(),t),e.join())}scalar(e,t,n,i,s){let[d,u,g]=this.scalarInfo(t,i);(!g||s)&&(e.tag(n,d),e[u](i))}packed(e,t,n,i){if(!i.length)return;fe(t!==$.BYTES&&t!==$.STRING),e.tag(n,te.LengthDelimited),e.fork();let[,s]=this.scalarInfo(t);for(let d=0;d<i.length;d++)e[s](i[d]);e.join()}scalarInfo(e,t){let n=te.Varint,i,s=t===void 0,d=t===0;switch(e){case $.INT32:i="int32";break;case $.STRING:d=s||!t.length,n=te.LengthDelimited,i="string";break;case $.BOOL:d=t===!1,i="bool";break;case $.UINT32:i="uint32";break;case $.DOUBLE:n=te.Bit64,i="double";break;case $.FLOAT:n=te.Bit32,i="float";break;case $.INT64:d=s||Me.from(t).isZero(),i="int64";break;case $.UINT64:d=s||Qe.from(t).isZero(),i="uint64";break;case $.FIXED64:d=s||Qe.from(t).isZero(),n=te.Bit64,i="fixed64";break;case $.BYTES:d=s||!t.byteLength,n=te.LengthDelimited,i="bytes";break;case $.FIXED32:n=te.Bit32,i="fixed32";break;case $.SFIXED32:n=te.Bit32,i="sfixed32";break;case $.SFIXED64:d=s||Me.from(t).isZero(),n=te.Bit64,i="sfixed64";break;case $.SINT32:i="sint32";break;case $.SINT64:d=s||Me.from(t).isZero(),i="sint64";break}return[n,i,s||d]}}function Ui(r){const e=r.messagePrototype?Object.create(r.messagePrototype):Object.defineProperty({},Nr,{value:r});for(let t of r.fields){let n=t.localName;if(!t.opt)if(t.oneof)e[t.oneof]={oneofKind:void 0};else if(t.repeat)e[n]=[];else switch(t.kind){case"scalar":e[n]=Qn(t.T,t.L);break;case"enum":e[n]=0;break;case"map":e[n]={};break}}return e}function $e(r,e,t){let n,i=t,s;for(let d of r.fields){let u=d.localName;if(d.oneof){const g=i[d.oneof];if((g==null?void 0:g.oneofKind)==null)continue;if(n=g[u],s=e[d.oneof],s.oneofKind=g.oneofKind,n==null){delete s[u];continue}}else if(n=i[u],s=e,n==null)continue;switch(d.repeat&&(s[u].length=n.length),d.kind){case"scalar":case"enum":if(d.repeat)for(let v=0;v<n.length;v++)s[u][v]=n[v];else s[u]=n;break;case"message":let g=d.T();if(d.repeat)for(let v=0;v<n.length;v++)s[u][v]=g.create(n[v]);else s[u]===void 0?s[u]=g.create(n):g.mergePartial(s[u],n);break;case"map":switch(d.V.kind){case"scalar":case"enum":Object.assign(s[u],n);break;case"message":let v=d.V.T();for(let V of Object.keys(n))s[u][V]=v.create(n[V]);break}break}}}function _i(r,e,t){if(e===t)return!0;if(!e||!t)return!1;for(let n of r.fields){let i=n.localName,s=n.oneof?e[n.oneof][i]:e[i],d=n.oneof?t[n.oneof][i]:t[i];switch(n.kind){case"enum":case"scalar":let u=n.kind=="enum"?$.INT32:n.T;if(!(n.repeat?Lr(u,s,d):Tr(u,s,d)))return!1;break;case"map":if(!(n.V.kind=="message"?xr(n.V.T(),Dn(s),Dn(d)):Lr(n.V.kind=="enum"?$.INT32:n.V.T,Dn(s),Dn(d))))return!1;break;case"message":let g=n.T();if(!(n.repeat?xr(g,s,d):g.equals(s,d)))return!1;break}}return!0}const Dn=Object.values;function Tr(r,e,t){if(e===t)return!0;if(r!==$.BYTES)return!1;let n=e,i=t;if(n.length!==i.length)return!1;for(let s=0;s<n.length;s++)if(n[s]!=i[s])return!1;return!0}function Lr(r,e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Tr(r,e[n],t[n]))return!1;return!0}function xr(r,e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!r.equals(e[n],t[n]))return!1;return!0}const Bi=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({}));class Je{constructor(e,t,n){this.defaultCheckDepth=16,this.typeName=e,this.fields=t.map(ki),this.options=n??{},this.messagePrototype=Object.create(null,Object.assign(Object.assign({},Bi),{[Nr]:{value:this}})),this.refTypeCheck=new Fi(this),this.refJsonReader=new Ni(this),this.refJsonWriter=new Ti(this),this.refBinReader=new Li(this),this.refBinWriter=new xi(this)}create(e){let t=Ui(this);return e!==void 0&&$e(this,t,e),t}clone(e){let t=this.create();return $e(this,t,e),t}equals(e,t){return _i(this,e,t)}is(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!1)}isAssignable(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!0)}mergePartial(e,t){$e(this,e,t)}fromBinary(e,t){let n=ui(t);return this.internalBinaryRead(n.readerFactory(e),e.byteLength,n)}fromJson(e,t){return this.internalJsonRead(e,Ei(t))}fromJsonString(e,t){let n=JSON.parse(e);return this.fromJson(n,t)}toJson(e,t){return this.internalJsonWrite(e,vi(t))}toJsonString(e,t){var n;let i=this.toJson(e,t);return JSON.stringify(i,null,(n=t==null?void 0:t.prettySpaces)!==null&&n!==void 0?n:0)}toBinary(e,t){let n=bi(t);return this.internalBinaryWrite(e,n.writerFactory(),n).finish()}internalJsonRead(e,t,n){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){let i=n??this.create();return this.refJsonReader.read(e,i,t),i}throw new Error(`Unable to parse message ${this.typeName} from JSON ${Ce(e)}.`)}internalJsonWrite(e,t){return this.refJsonWriter.write(e,t)}internalBinaryWrite(e,t,n){return this.refBinWriter.write(e,t,n),t}internalBinaryRead(e,t,n,i){let s=i??this.create();return this.refBinReader.read(e,s,n,t),s}}function Oi(r,e){var t,n,i;let s=r;return s.service=e,s.localName=(t=s.localName)!==null&&t!==void 0?t:Yn(s.name),s.serverStreaming=!!s.serverStreaming,s.clientStreaming=!!s.clientStreaming,s.options=(n=s.options)!==null&&n!==void 0?n:{},s.idempotency=(i=s.idempotency)!==null&&i!==void 0?i:void 0,s}class er{constructor(e,t,n){this.typeName=e,this.methods=t.map(i=>Oi(i,this)),this.options=n??{}}}class ve extends Error{constructor(e,t="UNKNOWN",n){super(e),this.name="RpcError",Object.setPrototypeOf(this,new.target.prototype),this.code=t,this.meta=n??{}}toString(){const e=[this.name+": "+this.message];this.code&&(e.push(""),e.push("Code: "+this.code)),this.serviceName&&this.methodName&&e.push("Method: "+this.serviceName+"/"+this.methodName);let t=Object.entries(this.meta);if(t.length){e.push(""),e.push("Meta:");for(let[n,i]of t)e.push(` ${n}: ${i}`)}return e.join(`
4
- `)}}function Si(r,e){if(!e)return r;let t={};Mn(r,t),Mn(e,t);for(let n of Object.keys(e)){let i=e[n];switch(n){case"jsonOptions":t.jsonOptions=Ai(r.jsonOptions,t.jsonOptions);break;case"binaryOptions":t.binaryOptions=li(r.binaryOptions,t.binaryOptions);break;case"meta":t.meta={},Mn(r.meta,t.meta),Mn(e.meta,t.meta);break;case"interceptors":t.interceptors=r.interceptors?r.interceptors.concat(i):i.concat();break}}return t}function Mn(r,e){if(!r)return;let t=e;for(let[n,i]of Object.entries(r))i instanceof Date?t[n]=new Date(i.getTime()):Array.isArray(i)?t[n]=i.concat():t[n]=i}var ct;(function(r){r[r.PENDING=0]="PENDING",r[r.REJECTED=1]="REJECTED",r[r.RESOLVED=2]="RESOLVED"})(ct||(ct={}));class St{constructor(e=!0){this._state=ct.PENDING,this._promise=new Promise((t,n)=>{this._resolve=t,this._reject=n}),e&&this._promise.catch(t=>{})}get state(){return this._state}get promise(){return this._promise}resolve(e){if(this.state!==ct.PENDING)throw new Error(`cannot resolve ${ct[this.state].toLowerCase()}`);this._resolve(e),this._state=ct.RESOLVED}reject(e){if(this.state!==ct.PENDING)throw new Error(`cannot reject ${ct[this.state].toLowerCase()}`);this._reject(e),this._state=ct.REJECTED}resolvePending(e){this._state===ct.PENDING&&this.resolve(e)}rejectPending(e){this._state===ct.PENDING&&this.reject(e)}}class Ri{constructor(){this._lis={nxt:[],msg:[],err:[],cmp:[]},this._closed=!1}onNext(e){return this.addLis(e,this._lis.nxt)}onMessage(e){return this.addLis(e,this._lis.msg)}onError(e){return this.addLis(e,this._lis.err)}onComplete(e){return this.addLis(e,this._lis.cmp)}addLis(e,t){return t.push(e),()=>{let n=t.indexOf(e);n>=0&&t.splice(n,1)}}clearLis(){for(let e of Object.values(this._lis))e.splice(0,e.length)}get closed(){return this._closed!==!1}notifyNext(e,t,n){fe((e?1:0)+(t?1:0)+(n?1:0)<=1,"only one emission at a time"),e&&this.notifyMessage(e),t&&this.notifyError(t),n&&this.notifyComplete()}notifyMessage(e){fe(!this.closed,"stream is closed"),this.pushIt({value:e,done:!1}),this._lis.msg.forEach(t=>t(e)),this._lis.nxt.forEach(t=>t(e,void 0,!1))}notifyError(e){fe(!this.closed,"stream is closed"),this._closed=e,this.pushIt(e),this._lis.err.forEach(t=>t(e)),this._lis.nxt.forEach(t=>t(void 0,e,!1)),this.clearLis()}notifyComplete(){fe(!this.closed,"stream is closed"),this._closed=!0,this.pushIt({value:null,done:!0}),this._lis.cmp.forEach(e=>e()),this._lis.nxt.forEach(e=>e(void 0,void 0,!0)),this.clearLis()}[Symbol.asyncIterator](){return this._itState||(this._itState={q:[]}),this._closed===!0?this.pushIt({value:null,done:!0}):this._closed!==!1&&this.pushIt(this._closed),{next:()=>{let e=this._itState;fe(e,"bad state"),fe(!e.p,"iterator contract broken");let t=e.q.shift();return t?"value"in t?Promise.resolve(t):Promise.reject(t):(e.p=new St,e.p.promise)}}}pushIt(e){let t=this._itState;if(t)if(t.p){const n=t.p;fe(n.state==ct.PENDING,"iterator contract broken"),"value"in e?n.resolve(e):n.reject(e),delete t.p}else t.q.push(e)}}var Di=function(r,e,t,n){function i(s){return s instanceof t?s:new t(function(d){d(s)})}return new(t||(t=Promise))(function(s,d){function u(V){try{v(n.next(V))}catch(ne){d(ne)}}function g(V){try{v(n.throw(V))}catch(ne){d(ne)}}function v(V){V.done?s(V.value):i(V.value).then(u,g)}v((n=n.apply(r,e||[])).next())})};class Mi{constructor(e,t,n,i,s,d,u){this.method=e,this.requestHeaders=t,this.request=n,this.headers=i,this.response=s,this.status=d,this.trailers=u}then(e,t){return this.promiseFinished().then(n=>e?Promise.resolve(e(n)):n,n=>t?Promise.resolve(t(n)):Promise.reject(n))}promiseFinished(){return Di(this,void 0,void 0,function*(){let[e,t,n,i]=yield Promise.all([this.headers,this.response,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,request:this.request,headers:e,response:t,status:n,trailers:i}})}}var Vi=function(r,e,t,n){function i(s){return s instanceof t?s:new t(function(d){d(s)})}return new(t||(t=Promise))(function(s,d){function u(V){try{v(n.next(V))}catch(ne){d(ne)}}function g(V){try{v(n.throw(V))}catch(ne){d(ne)}}function v(V){V.done?s(V.value):i(V.value).then(u,g)}v((n=n.apply(r,e||[])).next())})};class Hi{constructor(e,t,n,i,s,d,u){this.method=e,this.requestHeaders=t,this.request=n,this.headers=i,this.responses=s,this.status=d,this.trailers=u}then(e,t){return this.promiseFinished().then(n=>e?Promise.resolve(e(n)):n,n=>t?Promise.resolve(t(n)):Promise.reject(n))}promiseFinished(){return Vi(this,void 0,void 0,function*(){let[e,t,n]=yield Promise.all([this.headers,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,request:this.request,headers:e,status:t,trailers:n}})}}function dt(r,e,t,n,i){var s;{let d=(u,g,v)=>e.unary(u,g,v);for(const u of((s=n.interceptors)!==null&&s!==void 0?s:[]).filter(g=>g.interceptUnary).reverse()){const g=d;d=(v,V,ne)=>u.interceptUnary(g,v,V,ne)}return d(t,i,n)}}var ee;(function(r){r[r.OK=0]="OK",r[r.CANCELLED=1]="CANCELLED",r[r.UNKNOWN=2]="UNKNOWN",r[r.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",r[r.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",r[r.NOT_FOUND=5]="NOT_FOUND",r[r.ALREADY_EXISTS=6]="ALREADY_EXISTS",r[r.PERMISSION_DENIED=7]="PERMISSION_DENIED",r[r.UNAUTHENTICATED=16]="UNAUTHENTICATED",r[r.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",r[r.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",r[r.ABORTED=10]="ABORTED",r[r.OUT_OF_RANGE=11]="OUT_OF_RANGE",r[r.UNIMPLEMENTED=12]="UNIMPLEMENTED",r[r.INTERNAL=13]="INTERNAL",r[r.UNAVAILABLE=14]="UNAVAILABLE",r[r.DATA_LOSS=15]="DATA_LOSS"})(ee||(ee={}));var Wi=function(r,e,t,n){function i(s){return s instanceof t?s:new t(function(d){d(s)})}return new(t||(t=Promise))(function(s,d){function u(V){try{v(n.next(V))}catch(ne){d(ne)}}function g(V){try{v(n.throw(V))}catch(ne){d(ne)}}function v(V){V.done?s(V.value):i(V.value).then(u,g)}v((n=n.apply(r,e||[])).next())})};function Ur(r,e,t,n,i){if(n)for(let[s,d]of Object.entries(n))if(typeof d=="string")r.append(s,d);else for(let u of d)r.append(s,u);if(r.set("Content-Type",e==="text"?"application/grpc-web-text":"application/grpc-web+proto"),e=="text"&&r.set("Accept","application/grpc-web-text"),r.set("X-Grpc-Web","1"),typeof t=="number"){if(t<=0)throw new ve(`timeout ${t} ms exceeded`,ee[ee.DEADLINE_EXCEEDED]);r.set("grpc-timeout",`${t}m`)}else if(t){const s=t.getTime(),d=Date.now();if(s<=d)throw new ve(`deadline ${t} exceeded`,ee[ee.DEADLINE_EXCEEDED]);r.set("grpc-timeout",`${s-d}m`)}return r}function _r(r,e){let t=new Uint8Array(5+r.length);t[0]=pt.DATA;for(let n=r.length,i=4;i>0;i--)t[i]=n%256,n>>>=8;return t.set(r,5),e==="binary"?t:wr(t)}function tr(r,e,t){if(arguments.length===1){let g=r,v;try{v=g.type}catch{}switch(v){case"error":case"opaque":case"opaqueredirect":throw new ve(`fetch response type ${g.type}`,ee[ee.UNKNOWN])}return tr(ji(g.headers),g.status,g.statusText)}let n=r,i=e>=200&&e<300,s=Dr(n),[d,u]=Rr(n);return(d===void 0||d===ee.OK)&&!i&&(d=qi(e),u=t),[d,u,s]}function Br(r){let e=Zi(r),[t,n]=Rr(e),i=Dr(e);return[t??ee.OK,n,i]}var pt;(function(r){r[r.DATA=0]="DATA",r[r.TRAILER=128]="TRAILER"})(pt||(pt={}));function Or(r,e,t){return Wi(this,void 0,void 0,function*(){let n,i="",s=new Uint8Array(0),d=$i(e);if(Pi(r)){let u=r.getReader();n={next:()=>u.read()}}else n=r[Symbol.asyncIterator]();for(;;){let u=yield n.next();if(u.value!==void 0){if(d==="text"){for(let v=0;v<u.value.length;v++)i+=String.fromCharCode(u.value[v]);let g=i.length-i.length%4;if(g===0)continue;s=Sr(s,gr(i.substring(0,g))),i=i.substring(g)}else s=Sr(s,u.value);for(;s.length>=5&&s[0]===pt.DATA;){let g=0;for(let v=1;v<5;v++)g=(g<<8)+s[v];if(s.length-5>=g)t(pt.DATA,s.subarray(5,5+g)),s=s.subarray(5+g);else break}}if(u.done){if(s.length===0)break;if(s[0]!==pt.TRAILER||s.length<5)throw new ve("premature EOF",ee[ee.DATA_LOSS]);t(pt.TRAILER,s.subarray(5));break}}})}const Pi=r=>typeof r.getReader=="function";function Sr(r,e){let t=new Uint8Array(r.length+e.length);return t.set(r),t.set(e,r.length),t}function $i(r){switch(r){case"application/grpc-web-text":case"application/grpc-web-text+proto":return"text";case"application/grpc-web":case"application/grpc-web+proto":return"binary";case void 0:case null:throw new ve("missing response content type",ee[ee.INTERNAL]);default:throw new ve("unexpected response content type: "+r,ee[ee.INTERNAL])}}function Rr(r){let e,t,n=r["grpc-message"];if(n!==void 0){if(Array.isArray(n))return[ee.INTERNAL,"invalid grpc-web message"];t=n}let i=r["grpc-status"];if(i!==void 0){if(Array.isArray(i))return[ee.INTERNAL,"invalid grpc-web status"];if(e=parseInt(i,10),ee[e]===void 0)return[ee.INTERNAL,"invalid grpc-web status"]}return[e,t]}function Dr(r){let e={};for(let[t,n]of Object.entries(r))switch(t){case"grpc-message":case"grpc-status":case"content-type":break;default:e[t]=n}return e}function Zi(r){let e={};for(let t of String.fromCharCode.apply(String,r).trim().split(`\r
5
- `)){if(t=="")continue;let[n,...i]=t.split(":");const s=i.join(":").trim();n=n.trim();let d=e[n];typeof d=="string"?e[n]=[d,s]:Array.isArray(d)?d.push(s):e[n]=s}return e}function ji(r){let e={};return r.forEach((t,n)=>{let i=e[n];typeof i=="string"?e[n]=[i,t]:Array.isArray(i)?i.push(t):e[n]=t}),e}function qi(r){switch(r){case 200:return ee.OK;case 400:return ee.INVALID_ARGUMENT;case 401:return ee.UNAUTHENTICATED;case 403:return ee.PERMISSION_DENIED;case 404:return ee.NOT_FOUND;case 409:return ee.ABORTED;case 412:return ee.FAILED_PRECONDITION;case 429:return ee.RESOURCE_EXHAUSTED;case 499:return ee.CANCELLED;case 500:return ee.UNKNOWN;case 501:return ee.UNIMPLEMENTED;case 503:return ee.UNAVAILABLE;case 504:return ee.DEADLINE_EXCEEDED;default:return ee.UNKNOWN}}class zi{constructor(e){this.defaultOptions=e}mergeOptions(e){return Si(this.defaultOptions,e)}makeUrl(e,t){let n=t.baseUrl;return n.endsWith("/")&&(n=n.substring(0,n.length-1)),`${n}/${e.service.typeName}/${e.name}`}clientStreaming(e){const t=new ve("Client streaming is not supported by grpc-web",ee[ee.UNIMPLEMENTED]);throw t.methodName=e.name,t.serviceName=e.service.typeName,t}duplex(e){const t=new ve("Duplex streaming is not supported by grpc-web",ee[ee.UNIMPLEMENTED]);throw t.methodName=e.name,t.serviceName=e.service.typeName,t}serverStreaming(e,t,n){var i,s,d,u;let g=n,v=(i=g.format)!==null&&i!==void 0?i:"text",V=(s=g.fetchInit)!==null&&s!==void 0?s:{},ne=this.makeUrl(e,g),ie=e.I.toBinary(t,g.binaryOptions),he=new St,we=new Ri,Ue=!0,me,be=new St,Se,et=new St;return globalThis.fetch(ne,Object.assign(Object.assign({},V),{method:"POST",headers:Ur(new globalThis.Headers,v,g.timeout,g.meta),body:_r(ie,v),signal:(d=n.abort)!==null&&d!==void 0?d:null})).then(de=>{let[oe,Fe,Ze]=tr(de);if(he.resolve(Ze),oe!=null&&oe!==ee.OK)throw new ve(Fe??ee[oe],ee[oe],Ze);return oe!=null&&(me={code:ee[oe],detail:Fe??ee[oe]}),de}).then(de=>{if(!de.body)throw new ve("missing response body",ee[ee.INTERNAL]);return Or(de.body,de.headers.get("content-type"),(oe,Fe)=>{switch(oe){case pt.DATA:we.notifyMessage(e.O.fromBinary(Fe,g.binaryOptions)),Ue=!1;break;case pt.TRAILER:let Ze,Re;[Ze,Re,Se]=Br(Fe),me={code:ee[Ze],detail:Re??ee[Ze]};break}})}).then(()=>{if(!Se&&!Ue)throw new ve("missing trailers",ee[ee.DATA_LOSS]);if(!me)throw new ve("missing status",ee[ee.INTERNAL]);if(me.code!=="OK")throw new ve(me.detail,me.code,Se);we.notifyComplete(),be.resolve(me),et.resolve(Se||{})}).catch(de=>{let oe;de instanceof ve?oe=de:de instanceof Error&&de.name==="AbortError"?oe=new ve(de.message,ee[ee.CANCELLED]):oe=new ve(de instanceof Error?de.message:""+de,ee[ee.INTERNAL]),oe.methodName=e.name,oe.serviceName=e.service.typeName,he.rejectPending(oe),we.notifyError(oe),be.rejectPending(oe),et.rejectPending(oe)}),new Hi(e,(u=g.meta)!==null&&u!==void 0?u:{},t,he.promise,we,be.promise,et.promise)}unary(e,t,n){var i,s,d,u;let g=n,v=(i=g.format)!==null&&i!==void 0?i:"text",V=(s=g.fetchInit)!==null&&s!==void 0?s:{},ne=this.makeUrl(e,g),ie=e.I.toBinary(t,g.binaryOptions),he=new St,we,Ue=new St,me,be=new St,Se,et=new St;return globalThis.fetch(ne,Object.assign(Object.assign({},V),{method:"POST",headers:Ur(new globalThis.Headers,v,g.timeout,g.meta),body:_r(ie,v),signal:(d=n.abort)!==null&&d!==void 0?d:null})).then(de=>{let[oe,Fe,Ze]=tr(de);if(he.resolve(Ze),oe!=null&&oe!==ee.OK)throw new ve(Fe??ee[oe],ee[oe],Ze);return oe!=null&&(me={code:ee[oe],detail:Fe??ee[oe]}),de}).then(de=>{if(!de.body)throw new ve("missing response body",ee[ee.INTERNAL]);return Or(de.body,de.headers.get("content-type"),(oe,Fe)=>{switch(oe){case pt.DATA:if(we)throw new ve("unary call received 2nd message",ee[ee.DATA_LOSS]);we=e.O.fromBinary(Fe,g.binaryOptions);break;case pt.TRAILER:let Ze,Re;[Ze,Re,Se]=Br(Fe),me={code:ee[Ze],detail:Re??ee[Ze]};break}})}).then(()=>{if(!Se&&we)throw new ve("missing trailers",ee[ee.DATA_LOSS]);if(!me)throw new ve("missing status",ee[ee.INTERNAL]);if(!we&&me.code==="OK")throw new ve("expected error status",ee[ee.DATA_LOSS]);if(!we)throw new ve(me.detail,me.code,Se);if(Ue.resolve(we),me.code!=="OK")throw new ve(me.detail,me.code,Se);be.resolve(me),et.resolve(Se||{})}).catch(de=>{let oe;de instanceof ve?oe=de:de instanceof Error&&de.name==="AbortError"?oe=new ve(de.message,ee[ee.CANCELLED]):oe=new ve(de instanceof Error?de.message:""+de,ee[ee.INTERNAL]),oe.methodName=e.name,oe.serviceName=e.service.typeName,he.rejectPending(oe),Ue.rejectPending(oe),be.rejectPending(oe),et.rejectPending(oe)}),new Mi(e,(u=g.meta)!==null&&u!==void 0?u:{},t,he.promise,Ue.promise,be.promise,et.promise)}}var Vn=(r=>(r[r.IMAGE=0]="IMAGE",r[r.AUDIO=1]="AUDIO",r[r.VIDEO=2]="VIDEO",r[r.ALL=3]="ALL",r[r.FOLDER=4]="FOLDER",r))(Vn||{});class Ki extends Je{constructor(){super("com.hamropatro.grpc.cms.SearchRequest",[{no:1,name:"search_value",kind:"scalar",T:9},{no:2,name:"cursor",kind:"scalar",T:9},{no:3,name:"limit",kind:"scalar",T:5}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.searchValue="",t.cursor="",t.limit=0,e!==void 0&&$e(this,t,e),t}internalBinaryRead(e,t,n,i){let s=i??this.create(),d=e.pos+t;for(;e.pos<d;){let[u,g]=e.tag();switch(u){case 1:s.searchValue=e.string();break;case 2:s.cursor=e.string();break;case 3:s.limit=e.int32();break;default:let v=n.readUnknownField;if(v==="throw")throw new globalThis.Error(`Unknown field ${u} (wire type ${g}) for ${this.typeName}`);let V=e.skip(g);v!==!1&&(v===!0?ue.onRead:v)(this.typeName,s,u,g,V)}}return s}internalBinaryWrite(e,t,n){e.searchValue!==""&&t.tag(1,te.LengthDelimited).string(e.searchValue),e.cursor!==""&&t.tag(2,te.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(3,te.Varint).int32(e.limit);let i=n.writeUnknownFields;return i!==!1&&(i==!0?ue.onWrite:i)(this.typeName,e,t),t}}const Mr=new Ki;class Xi extends Je{constructor(){super("com.hamropatro.grpc.cms.SearchResult",[{no:1,name:"items",kind:"message",repeat:1,T:()=>mt},{no:2,name:"next_page_cursor",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.items=[],t.nextPageCursor="",e!==void 0&&$e(this,t,e),t}internalBinaryRead(e,t,n,i){let s=i??this.create(),d=e.pos+t;for(;e.pos<d;){let[u,g]=e.tag();switch(u){case 1:s.items.push(mt.internalBinaryRead(e,e.uint32(),n));break;case 2:s.nextPageCursor=e.string();break;default:let v=n.readUnknownField;if(v==="throw")throw new globalThis.Error(`Unknown field ${u} (wire type ${g}) for ${this.typeName}`);let V=e.skip(g);v!==!1&&(v===!0?ue.onRead:v)(this.typeName,s,u,g,V)}}return s}internalBinaryWrite(e,t,n){for(let s=0;s<e.items.length;s++)mt.internalBinaryWrite(e.items[s],t.tag(1,te.LengthDelimited).fork(),n).join();e.nextPageCursor!==""&&t.tag(2,te.LengthDelimited).string(e.nextPageCursor);let i=n.writeUnknownFields;return i!==!1&&(i==!0?ue.onWrite:i)(this.typeName,e,t),t}}const Gi=new Xi;class Ji extends Je{constructor(){super("com.hamropatro.grpc.cms.CreateFileRequest",[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"folder_name",kind:"scalar",T:9},{no:3,name:"nested_folder_name",kind:"scalar",T:9},{no:4,name:"url",kind:"scalar",T:9},{no:5,name:"type",kind:"enum",T:()=>["com.hamropatro.grpc.cms.FileType",Vn]},{no:6,name:"extension",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.name="",t.folderName="",t.nestedFolderName="",t.url="",t.type=0,t.extension="",e!==void 0&&$e(this,t,e),t}internalBinaryRead(e,t,n,i){let s=i??this.create(),d=e.pos+t;for(;e.pos<d;){let[u,g]=e.tag();switch(u){case 1:s.name=e.string();break;case 2:s.folderName=e.string();break;case 3:s.nestedFolderName=e.string();break;case 4:s.url=e.string();break;case 5:s.type=e.int32();break;case 6:s.extension=e.string();break;default:let v=n.readUnknownField;if(v==="throw")throw new globalThis.Error(`Unknown field ${u} (wire type ${g}) for ${this.typeName}`);let V=e.skip(g);v!==!1&&(v===!0?ue.onRead:v)(this.typeName,s,u,g,V)}}return s}internalBinaryWrite(e,t,n){e.name!==""&&t.tag(1,te.LengthDelimited).string(e.name),e.folderName!==""&&t.tag(2,te.LengthDelimited).string(e.folderName),e.nestedFolderName!==""&&t.tag(3,te.LengthDelimited).string(e.nestedFolderName),e.url!==""&&t.tag(4,te.LengthDelimited).string(e.url),e.type!==0&&t.tag(5,te.Varint).int32(e.type),e.extension!==""&&t.tag(6,te.LengthDelimited).string(e.extension);let i=n.writeUnknownFields;return i!==!1&&(i==!0?ue.onWrite:i)(this.typeName,e,t),t}}const Vr=new Ji;class Yi extends Je{constructor(){super("com.hamropatro.grpc.cms.CreateUserFileRequest",[{no:1,name:"url",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:()=>["com.hamropatro.grpc.cms.FileType",Vn]},{no:3,name:"extension",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.url="",t.type=0,t.extension="",e!==void 0&&$e(this,t,e),t}internalBinaryRead(e,t,n,i){let s=i??this.create(),d=e.pos+t;for(;e.pos<d;){let[u,g]=e.tag();switch(u){case 1:s.url=e.string();break;case 2:s.type=e.int32();break;case 3:s.extension=e.string();break;default:let v=n.readUnknownField;if(v==="throw")throw new globalThis.Error(`Unknown field ${u} (wire type ${g}) for ${this.typeName}`);let V=e.skip(g);v!==!1&&(v===!0?ue.onRead:v)(this.typeName,s,u,g,V)}}return s}internalBinaryWrite(e,t,n){e.url!==""&&t.tag(1,te.LengthDelimited).string(e.url),e.type!==0&&t.tag(2,te.Varint).int32(e.type),e.extension!==""&&t.tag(3,te.LengthDelimited).string(e.extension);let i=n.writeUnknownFields;return i!==!1&&(i==!0?ue.onWrite:i)(this.typeName,e,t),t}}const Hr=new Yi;class Qi extends Je{constructor(){super("com.hamropatro.grpc.cms.File",[{no:1,name:"key",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"folder_name",kind:"scalar",T:9},{no:4,name:"nested_folder_name",kind:"scalar",T:9},{no:5,name:"url",kind:"scalar",T:9},{no:6,name:"thumbor_url",kind:"scalar",T:9},{no:7,name:"proxy_url",kind:"scalar",T:9},{no:8,name:"type",kind:"enum",T:()=>["com.hamropatro.grpc.cms.FileType",Vn]},{no:9,name:"metadata",kind:"message",T:()=>nr}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",t.name="",t.folderName="",t.nestedFolderName="",t.url="",t.thumborUrl="",t.proxyUrl="",t.type=0,e!==void 0&&$e(this,t,e),t}internalBinaryRead(e,t,n,i){let s=i??this.create(),d=e.pos+t;for(;e.pos<d;){let[u,g]=e.tag();switch(u){case 1:s.key=e.string();break;case 2:s.name=e.string();break;case 3:s.folderName=e.string();break;case 4:s.nestedFolderName=e.string();break;case 5:s.url=e.string();break;case 6:s.thumborUrl=e.string();break;case 7:s.proxyUrl=e.string();break;case 8:s.type=e.int32();break;case 9:s.metadata=nr.internalBinaryRead(e,e.uint32(),n,s.metadata);break;default:let v=n.readUnknownField;if(v==="throw")throw new globalThis.Error(`Unknown field ${u} (wire type ${g}) for ${this.typeName}`);let V=e.skip(g);v!==!1&&(v===!0?ue.onRead:v)(this.typeName,s,u,g,V)}}return s}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,te.LengthDelimited).string(e.key),e.name!==""&&t.tag(2,te.LengthDelimited).string(e.name),e.folderName!==""&&t.tag(3,te.LengthDelimited).string(e.folderName),e.nestedFolderName!==""&&t.tag(4,te.LengthDelimited).string(e.nestedFolderName),e.url!==""&&t.tag(5,te.LengthDelimited).string(e.url),e.thumborUrl!==""&&t.tag(6,te.LengthDelimited).string(e.thumborUrl),e.proxyUrl!==""&&t.tag(7,te.LengthDelimited).string(e.proxyUrl),e.type!==0&&t.tag(8,te.Varint).int32(e.type),e.metadata&&nr.internalBinaryWrite(e.metadata,t.tag(9,te.LengthDelimited).fork(),n).join();let i=n.writeUnknownFields;return i!==!1&&(i==!0?ue.onWrite:i)(this.typeName,e,t),t}}const mt=new Qi;class es extends Je{constructor(){super("com.hamropatro.grpc.cms.FileMetadata",[{no:1,name:"height",kind:"scalar",T:5},{no:2,name:"width",kind:"scalar",T:5},{no:3,name:"background_color",kind:"scalar",T:9},{no:4,name:"aspect_ratio",kind:"scalar",T:1}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.height=0,t.width=0,t.backgroundColor="",t.aspectRatio=0,e!==void 0&&$e(this,t,e),t}internalBinaryRead(e,t,n,i){let s=i??this.create(),d=e.pos+t;for(;e.pos<d;){let[u,g]=e.tag();switch(u){case 1:s.height=e.int32();break;case 2:s.width=e.int32();break;case 3:s.backgroundColor=e.string();break;case 4:s.aspectRatio=e.double();break;default:let v=n.readUnknownField;if(v==="throw")throw new globalThis.Error(`Unknown field ${u} (wire type ${g}) for ${this.typeName}`);let V=e.skip(g);v!==!1&&(v===!0?ue.onRead:v)(this.typeName,s,u,g,V)}}return s}internalBinaryWrite(e,t,n){e.height!==0&&t.tag(1,te.Varint).int32(e.height),e.width!==0&&t.tag(2,te.Varint).int32(e.width),e.backgroundColor!==""&&t.tag(3,te.LengthDelimited).string(e.backgroundColor),e.aspectRatio!==0&&t.tag(4,te.Bit64).double(e.aspectRatio);let i=n.writeUnknownFields;return i!==!1&&(i==!0?ue.onWrite:i)(this.typeName,e,t),t}}const nr=new es;class ts extends Je{constructor(){super("com.hamropatro.grpc.cms.DeleteFileRequest",[{no:1,name:"key",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",e!==void 0&&$e(this,t,e),t}internalBinaryRead(e,t,n,i){let s=i??this.create(),d=e.pos+t;for(;e.pos<d;){let[u,g]=e.tag();switch(u){case 1:s.key=e.string();break;default:let v=n.readUnknownField;if(v==="throw")throw new globalThis.Error(`Unknown field ${u} (wire type ${g}) for ${this.typeName}`);let V=e.skip(g);v!==!1&&(v===!0?ue.onRead:v)(this.typeName,s,u,g,V)}}return s}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,te.LengthDelimited).string(e.key);let i=n.writeUnknownFields;return i!==!1&&(i==!0?ue.onWrite:i)(this.typeName,e,t),t}}const Wr=new ts;class ns extends Je{constructor(){super("com.hamropatro.grpc.cms.DeleteFileResponse",[{no:1,name:"is_deleted",kind:"scalar",T:8}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.isDeleted=!1,e!==void 0&&$e(this,t,e),t}internalBinaryRead(e,t,n,i){let s=i??this.create(),d=e.pos+t;for(;e.pos<d;){let[u,g]=e.tag();switch(u){case 1:s.isDeleted=e.bool();break;default:let v=n.readUnknownField;if(v==="throw")throw new globalThis.Error(`Unknown field ${u} (wire type ${g}) for ${this.typeName}`);let V=e.skip(g);v!==!1&&(v===!0?ue.onRead:v)(this.typeName,s,u,g,V)}}return s}internalBinaryWrite(e,t,n){e.isDeleted!==!1&&t.tag(1,te.Varint).bool(e.isDeleted);let i=n.writeUnknownFields;return i!==!1&&(i==!0?ue.onWrite:i)(this.typeName,e,t),t}}const rs=new ns;class is extends Je{constructor(){super("com.hamropatro.grpc.cms.GetFilesByFolderRequest",[{no:1,name:"folder_name",kind:"scalar",T:9},{no:2,name:"cursor",kind:"scalar",T:9},{no:3,name:"limit",kind:"scalar",T:5}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.folderName="",t.cursor="",t.limit=0,e!==void 0&&$e(this,t,e),t}internalBinaryRead(e,t,n,i){let s=i??this.create(),d=e.pos+t;for(;e.pos<d;){let[u,g]=e.tag();switch(u){case 1:s.folderName=e.string();break;case 2:s.cursor=e.string();break;case 3:s.limit=e.int32();break;default:let v=n.readUnknownField;if(v==="throw")throw new globalThis.Error(`Unknown field ${u} (wire type ${g}) for ${this.typeName}`);let V=e.skip(g);v!==!1&&(v===!0?ue.onRead:v)(this.typeName,s,u,g,V)}}return s}internalBinaryWrite(e,t,n){e.folderName!==""&&t.tag(1,te.LengthDelimited).string(e.folderName),e.cursor!==""&&t.tag(2,te.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(3,te.Varint).int32(e.limit);let i=n.writeUnknownFields;return i!==!1&&(i==!0?ue.onWrite:i)(this.typeName,e,t),t}}const Pr=new is;class ss extends Je{constructor(){super("com.hamropatro.grpc.cms.GetFilesByFolderResponse",[{no:1,name:"files",kind:"message",repeat:1,T:()=>mt},{no:2,name:"next_cursor",kind:"scalar",T:9},{no:3,name:"has_more",kind:"scalar",T:8}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.files=[],t.nextCursor="",t.hasMore=!1,e!==void 0&&$e(this,t,e),t}internalBinaryRead(e,t,n,i){let s=i??this.create(),d=e.pos+t;for(;e.pos<d;){let[u,g]=e.tag();switch(u){case 1:s.files.push(mt.internalBinaryRead(e,e.uint32(),n));break;case 2:s.nextCursor=e.string();break;case 3:s.hasMore=e.bool();break;default:let v=n.readUnknownField;if(v==="throw")throw new globalThis.Error(`Unknown field ${u} (wire type ${g}) for ${this.typeName}`);let V=e.skip(g);v!==!1&&(v===!0?ue.onRead:v)(this.typeName,s,u,g,V)}}return s}internalBinaryWrite(e,t,n){for(let s=0;s<e.files.length;s++)mt.internalBinaryWrite(e.files[s],t.tag(1,te.LengthDelimited).fork(),n).join();e.nextCursor!==""&&t.tag(2,te.LengthDelimited).string(e.nextCursor),e.hasMore!==!1&&t.tag(3,te.Varint).bool(e.hasMore);let i=n.writeUnknownFields;return i!==!1&&(i==!0?ue.onWrite:i)(this.typeName,e,t),t}}const os=new ss,rr=new er("com.hamropatro.grpc.cms.FileService",[{name:"createFile",options:{},I:Vr,O:mt},{name:"updateFile",options:{},I:mt,O:mt},{name:"deleteFile",options:{},I:Wr,O:rs},{name:"getFilesByFolder",options:{},I:Pr,O:os},{name:"createUserFile",options:{},I:Hr,O:mt},{name:"search",options:{},I:Mr,O:Gi}]);class rn{constructor(e){Be(this,"typeName",rr.typeName);Be(this,"methods",rr.methods);Be(this,"options",rr.options);this._transport=e}createFile(e,t){const n=this.methods[0],i=this._transport.mergeOptions(t);return dt("unary",this._transport,n,i,e)}updateFile(e,t){const n=this.methods[1],i=this._transport.mergeOptions(t);return dt("unary",this._transport,n,i,e)}deleteFile(e,t){const n=this.methods[2],i=this._transport.mergeOptions(t);return dt("unary",this._transport,n,i,e)}getFilesByFolder(e,t){const n=this.methods[3],i=this._transport.mergeOptions(t);return dt("unary",this._transport,n,i,e)}createUserFile(e,t){const n=this.methods[4],i=this._transport.mergeOptions(t);return dt("unary",this._transport,n,i,e)}search(e,t){const n=this.methods[5],i=this._transport.mergeOptions(t);return dt("unary",this._transport,n,i,e)}}const as=async(r,e,t,n,i,s)=>{var d;try{const u=(d=window.ImageSalonSDK)==null?void 0:d.grpcConfig,g=new rn(u),v=Vr.create();return v.name=r,v.nestedFolderName=e,v.url=t,v.type=n,v.folderName=i,await g.createFile(v,s)}catch(u){throw u}},$r=async(r,e,t)=>{var n;try{const i=(n=window.ImageSalonSDK)==null?void 0:n.grpcConfig,s=new rn(i),d=Hr.create();return d.url=r,d.type=e,await s.createUserFile(d,t)}catch(i){throw i}},ls=async(r,e,t,n)=>{var i;try{const s=(i=window.ImageSalonSDK)==null?void 0:i.grpcConfig,d=new rn(s),u=Pr.create();return u.folderName=r,u.cursor=e,u.limit=t,await d.getFilesByFolder(u,n)}catch(s){throw s}},cs=async(r,e,t=20,n)=>{var i;try{const s=(i=window.ImageSalonSDK)==null?void 0:i.grpcConfig,d=new rn(s),u=Mr.create();return u.searchValue=r,u.cursor=e,u.limit=t,await d.search(u,n)}catch(s){throw s}},ds=async(r,e,t,n,i,s,d,u,g)=>{var v;try{const V=(v=window.ImageSalonSDK)==null?void 0:v.grpcConfig,ne=new rn(V),ie=mt.create();return ie.key=r,ie.name=e,ie.nestedFolderName=t,ie.url=n,ie.thumborUrl=i,ie.proxyUrl=s,ie.type=d,ie.folderName=u,await ne.updateFile(ie,g)}catch(V){throw V}},hs=async(r,e)=>{var t;try{const n=(t=window.ImageSalonSDK)==null?void 0:t.grpcConfig,i=new rn(n),s=Wr.create();return s.key=r,await i.deleteFile(s,e)}catch(n){throw n}};class us extends Je{constructor(){super("com.hamropatro.grpc.cms.DeleteFolderRequest",[{no:1,name:"key",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",e!==void 0&&$e(this,t,e),t}internalBinaryRead(e,t,n,i){let s=i??this.create(),d=e.pos+t;for(;e.pos<d;){let[u,g]=e.tag();switch(u){case 1:s.key=e.string();break;default:let v=n.readUnknownField;if(v==="throw")throw new globalThis.Error(`Unknown field ${u} (wire type ${g}) for ${this.typeName}`);let V=e.skip(g);v!==!1&&(v===!0?ue.onRead:v)(this.typeName,s,u,g,V)}}return s}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,te.LengthDelimited).string(e.key);let i=n.writeUnknownFields;return i!==!1&&(i==!0?ue.onWrite:i)(this.typeName,e,t),t}}const Zr=new us;class fs extends Je{constructor(){super("com.hamropatro.grpc.cms.CreateFolderRequest",[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"nested_folder_name",kind:"scalar",T:9},{no:3,name:"created_by",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.name="",t.nestedFolderName="",t.createdBy="",e!==void 0&&$e(this,t,e),t}internalBinaryRead(e,t,n,i){let s=i??this.create(),d=e.pos+t;for(;e.pos<d;){let[u,g]=e.tag();switch(u){case 1:s.name=e.string();break;case 2:s.nestedFolderName=e.string();break;case 3:s.createdBy=e.string();break;default:let v=n.readUnknownField;if(v==="throw")throw new globalThis.Error(`Unknown field ${u} (wire type ${g}) for ${this.typeName}`);let V=e.skip(g);v!==!1&&(v===!0?ue.onRead:v)(this.typeName,s,u,g,V)}}return s}internalBinaryWrite(e,t,n){e.name!==""&&t.tag(1,te.LengthDelimited).string(e.name),e.nestedFolderName!==""&&t.tag(2,te.LengthDelimited).string(e.nestedFolderName),e.createdBy!==""&&t.tag(3,te.LengthDelimited).string(e.createdBy);let i=n.writeUnknownFields;return i!==!1&&(i==!0?ue.onWrite:i)(this.typeName,e,t),t}}const jr=new fs;class ps extends Je{constructor(){super("com.hamropatro.grpc.cms.GetAllFoldersRequest",[{no:1,name:"cursor",kind:"scalar",T:9},{no:2,name:"limit",kind:"scalar",T:5}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.cursor="",t.limit=0,e!==void 0&&$e(this,t,e),t}internalBinaryRead(e,t,n,i){let s=i??this.create(),d=e.pos+t;for(;e.pos<d;){let[u,g]=e.tag();switch(u){case 1:s.cursor=e.string();break;case 2:s.limit=e.int32();break;default:let v=n.readUnknownField;if(v==="throw")throw new globalThis.Error(`Unknown field ${u} (wire type ${g}) for ${this.typeName}`);let V=e.skip(g);v!==!1&&(v===!0?ue.onRead:v)(this.typeName,s,u,g,V)}}return s}internalBinaryWrite(e,t,n){e.cursor!==""&&t.tag(1,te.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(2,te.Varint).int32(e.limit);let i=n.writeUnknownFields;return i!==!1&&(i==!0?ue.onWrite:i)(this.typeName,e,t),t}}const qr=new ps;class ms extends Je{constructor(){super("com.hamropatro.grpc.cms.GetAllFoldersResponse",[{no:1,name:"folder",kind:"message",repeat:1,T:()=>Rt},{no:2,name:"next_cursor",kind:"scalar",T:9},{no:3,name:"has_more",kind:"scalar",T:8}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.folder=[],t.nextCursor="",t.hasMore=!1,e!==void 0&&$e(this,t,e),t}internalBinaryRead(e,t,n,i){let s=i??this.create(),d=e.pos+t;for(;e.pos<d;){let[u,g]=e.tag();switch(u){case 1:s.folder.push(Rt.internalBinaryRead(e,e.uint32(),n));break;case 2:s.nextCursor=e.string();break;case 3:s.hasMore=e.bool();break;default:let v=n.readUnknownField;if(v==="throw")throw new globalThis.Error(`Unknown field ${u} (wire type ${g}) for ${this.typeName}`);let V=e.skip(g);v!==!1&&(v===!0?ue.onRead:v)(this.typeName,s,u,g,V)}}return s}internalBinaryWrite(e,t,n){for(let s=0;s<e.folder.length;s++)Rt.internalBinaryWrite(e.folder[s],t.tag(1,te.LengthDelimited).fork(),n).join();e.nextCursor!==""&&t.tag(2,te.LengthDelimited).string(e.nextCursor),e.hasMore!==!1&&t.tag(3,te.Varint).bool(e.hasMore);let i=n.writeUnknownFields;return i!==!1&&(i==!0?ue.onWrite:i)(this.typeName,e,t),t}}const gs=new ms;class ws extends Je{constructor(){super("com.hamropatro.grpc.cms.Folder",[{no:1,name:"key",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"nested_folder_name",kind:"scalar",T:9},{no:4,name:"created_by",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",t.name="",t.nestedFolderName="",t.createdBy="",e!==void 0&&$e(this,t,e),t}internalBinaryRead(e,t,n,i){let s=i??this.create(),d=e.pos+t;for(;e.pos<d;){let[u,g]=e.tag();switch(u){case 1:s.key=e.string();break;case 2:s.name=e.string();break;case 3:s.nestedFolderName=e.string();break;case 4:s.createdBy=e.string();break;default:let v=n.readUnknownField;if(v==="throw")throw new globalThis.Error(`Unknown field ${u} (wire type ${g}) for ${this.typeName}`);let V=e.skip(g);v!==!1&&(v===!0?ue.onRead:v)(this.typeName,s,u,g,V)}}return s}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,te.LengthDelimited).string(e.key),e.name!==""&&t.tag(2,te.LengthDelimited).string(e.name),e.nestedFolderName!==""&&t.tag(3,te.LengthDelimited).string(e.nestedFolderName),e.createdBy!==""&&t.tag(4,te.LengthDelimited).string(e.createdBy);let i=n.writeUnknownFields;return i!==!1&&(i==!0?ue.onWrite:i)(this.typeName,e,t),t}}const Rt=new ws,ir=new er("com.hamropatro.grpc.cms.FolderService",[{name:"createFolder",options:{},I:jr,O:Rt},{name:"getFolders",options:{},I:qr,O:gs},{name:"updateFolder",options:{},I:Rt,O:Rt},{name:"deleteFolder",options:{},I:Zr,O:Rt}]);class Hn{constructor(e){Be(this,"typeName",ir.typeName);Be(this,"methods",ir.methods);Be(this,"options",ir.options);this._transport=e}createFolder(e,t){const n=this.methods[0],i=this._transport.mergeOptions(t);return dt("unary",this._transport,n,i,e)}getFolders(e,t){const n=this.methods[1],i=this._transport.mergeOptions(t);return dt("unary",this._transport,n,i,e)}updateFolder(e,t){const n=this.methods[2],i=this._transport.mergeOptions(t);return dt("unary",this._transport,n,i,e)}deleteFolder(e,t){const n=this.methods[3],i=this._transport.mergeOptions(t);return dt("unary",this._transport,n,i,e)}}const ys=async(r,e=20,t)=>{var d;const n=(d=window.ImageSalonSDK)==null?void 0:d.grpcConfig,i=new Hn(n),s=qr.create();try{return s.cursor=r,s.limit=e,await i.getFolders(s,t)}catch(u){throw u}},bs=async(r,e,t,n)=>{var i;try{const s=(i=window.ImageSalonSDK)==null?void 0:i.grpcConfig,d=new Hn(s),u=jr.create();return u.name=r,u.nestedFolderName=e,u.createdBy=t,await d.createFolder(u,n)}catch(s){throw s}},Cs=async(r,e,t,n,i)=>{var s;try{const d=(s=window.ImageSalonSDK)==null?void 0:s.grpcConfig,u=new Hn(d),g=Rt.create();return g.name=e,g.key=r,g.nestedFolderName=t,g.createdBy=n,await u.updateFolder(g,i)}catch(d){throw d}},Es=async(r,e)=>{var t;try{const n=(t=window.ImageSalonSDK)==null?void 0:t.grpcConfig,i=new Hn(n),s=Zr.create();return s.key=r,await i.deleteFolder(s,e)}catch(n){throw n}},sr=(r,e,t)=>{const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.setAttribute("width",r||"20"),n.setAttribute("height",e||"20"),n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("fill","none"),n.setAttribute("stroke",t||"#ee3f3f"),n.setAttribute("stroke-width","2"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),n.classList.add("lucide","lucide-circle-alert");const i=document.createElementNS("http://www.w3.org/2000/svg","circle");i.setAttribute("cx","12"),i.setAttribute("cy","12"),i.setAttribute("r","10");const s=document.createElementNS("http://www.w3.org/2000/svg","line");s.setAttribute("x1","12"),s.setAttribute("x2","12"),s.setAttribute("y1","8"),s.setAttribute("y2","12");const d=document.createElementNS("http://www.w3.org/2000/svg","line");return d.setAttribute("x1","12"),d.setAttribute("x2","12.01"),d.setAttribute("y1","16"),d.setAttribute("y2","16"),n.appendChild(i),n.appendChild(s),n.appendChild(d),n};function zr(){const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("height","24px"),r.setAttribute("width","24px"),r.setAttribute("viewBox","0 -960 960 960"),r.setAttribute("fill","#333");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"),r.appendChild(e),r}function vs(){const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("width","12"),r.setAttribute("height","12"),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("fill","none"),r.setAttribute("stroke","currentColor"),r.setAttribute("stroke-width","2"),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),r.classList.add("lucide","lucide-music-4");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d","M9 18V5l12-2v13");const t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d","m9 9 12-2");const n=document.createElementNS("http://www.w3.org/2000/svg","circle");n.setAttribute("cx","6"),n.setAttribute("cy","18"),n.setAttribute("r","3");const i=document.createElementNS("http://www.w3.org/2000/svg","circle");return i.setAttribute("cx","18"),i.setAttribute("cy","16"),i.setAttribute("r","3"),r.appendChild(e),r.appendChild(t),r.appendChild(n),r.appendChild(i),document.body.appendChild(r),r}const Kr=r=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("width","20"),e.setAttribute("height","20"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.setAttribute("stroke",r||"currentColor"),e.setAttribute("stroke-width","2"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.classList.add("lucide","lucide-circle-check-big");const t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d","M21.801 10A10 10 0 1 1 17 3.335");const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","m9 11 3 3L22 4"),e.appendChild(t),e.appendChild(n),e};function or(r="#333"){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("x","0px"),e.setAttribute("y","0px"),e.setAttribute("width","18"),e.setAttribute("height","18"),e.setAttribute("viewBox","0 0 50 50"),e.setAttribute("fill",r);const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d","M 9.15625 6.3125 L 6.3125 9.15625 L 22.15625 25 L 6.21875 40.96875 L 9.03125 43.78125 L 25 27.84375 L 40.9375 43.78125 L 43.78125 40.9375 L 27.84375 25 L 43.6875 9.15625 L 40.84375 6.3125 L 25 22.15625 Z"),e.appendChild(t),e}function Xr(){const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("width","16"),r.setAttribute("height","16"),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("fill","none"),r.setAttribute("stroke","#2c96f8"),r.setAttribute("stroke-width","2"),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),r.classList.add("lucide","lucide-pencil");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d","M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z");const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d","m15 5 4 4"),r.appendChild(e),r.appendChild(t),document.body.appendChild(r),r}function bn(){const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("xmlns","http://www.w3.org/2000/folder"),r.setAttribute("x","0px"),r.setAttribute("y","0px"),r.setAttribute("width","24"),r.setAttribute("height","24"),r.setAttribute("viewBox","0 0 48 48");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("fill","#FFA000"),e.setAttribute("d","M40,12H22l-4-4H8c-2.2,0-4,1.8-4,4v8h40v-4C44,13.8,42.2,12,40,12z");const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("fill","#FFCA28"),t.setAttribute("d","M40,12H8c-2.2,0-4,1.8-4,4v20c0,2.2,1.8,4,4,4h32c2.2,0,4-1.8,4-4V16C44,13.8,42.2,12,40,12z"),r.appendChild(e),r.appendChild(t),r}function As(){const r="http://www.w3.org/2000/svg",e=document.createElementNS(r,"svg");e.setAttribute("width","12"),e.setAttribute("height","12"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","3"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.classList.add("lucide","lucide-image");const t=document.createElementNS(r,"rect");t.setAttribute("width","18"),t.setAttribute("height","18"),t.setAttribute("x","3"),t.setAttribute("y","3"),t.setAttribute("rx","2"),t.setAttribute("ry","2");const n=document.createElementNS(r,"circle");n.setAttribute("cx","9"),n.setAttribute("cy","9"),n.setAttribute("r","2");const i=document.createElementNS(r,"path");return i.setAttribute("d","m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"),e.appendChild(t),e.appendChild(n),e.appendChild(i),document.body.appendChild(e),e}function ks(){const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("height","24px"),r.setAttribute("viewBox","0 -960 960 960"),r.setAttribute("width","24px"),r.setAttribute("fill","currentColor");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","m488-400-65 65 56 56 161-161-161-161-56 56 65 65H320v80h168ZM160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640v400q0 33-23.5 56.5T800-160H160Zm0-80h640v-400H447l-80-80H160v480Zm0 0v-480 480Z"),r.appendChild(e),r}function Gr(){const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("fill","none"),r.setAttribute("width","20"),r.setAttribute("height","20"),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("stroke-width","1.5"),r.setAttribute("stroke","currentColor"),r.setAttribute("class","size-2");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.setAttribute("d","M12 4.5v15m7.5-7.5h-15"),r.appendChild(e),r}function Is(){const r="http://www.w3.org/2000/svg",e=document.createElementNS(r,"svg");e.setAttribute("width","16"),e.setAttribute("height","16"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","2"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.classList.add("lucide","lucide-eye");const t=document.createElementNS(r,"path");t.setAttribute("d","M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"),e.appendChild(t);const n=document.createElementNS(r,"circle");return n.setAttribute("cx","12"),n.setAttribute("cy","12"),n.setAttribute("r","3"),e.appendChild(n),document.body.appendChild(e),e}function Fs(){const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("height","24px"),r.setAttribute("width","24px"),r.setAttribute("viewBox","0 0 30 30"),r.setAttribute("fill","#999");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M 13 3 C 7.4889971 3 3 7.4889971 3 13 C 3 18.511003 7.4889971 23 13 23 C 15.396508 23 17.597385 22.148986 19.322266 20.736328 L 25.292969 26.707031 A 1.0001 1.0001 0 1 0 26.707031 25.292969 L 20.736328 19.322266 C 22.148986 17.597385 23 15.396508 23 13 C 23 7.4889971 18.511003 3 13 3 z M 13 5 C 17.430123 5 21 8.5698774 21 13 C 21 17.430123 17.430123 21 13 21 C 8.5698774 21 5 17.430123 5 13 C 5 8.5698774 8.5698774 5 13 5 z"),r.appendChild(e),r}function Jr(){const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("width","16"),r.setAttribute("height","16"),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("fill","none"),r.setAttribute("stroke","#f14b4b"),r.setAttribute("stroke-width","2"),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),r.classList.add("lucide","lucide-trash-2");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d","M3 6h18");const t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d","M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6");const n=document.createElementNS("http://www.w3.org/2000/svg","path");n.setAttribute("d","M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2");const i=document.createElementNS("http://www.w3.org/2000/svg","line");i.setAttribute("x1","10"),i.setAttribute("x2","10"),i.setAttribute("y1","11"),i.setAttribute("y2","17");const s=document.createElementNS("http://www.w3.org/2000/svg","line");return s.setAttribute("x1","14"),s.setAttribute("x2","14"),s.setAttribute("y1","11"),s.setAttribute("y2","17"),r.appendChild(e),r.appendChild(t),r.appendChild(n),r.appendChild(i),r.appendChild(s),document.body.appendChild(r),r}function ar(){const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("width","24"),r.setAttribute("height","24"),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("fill","none"),r.setAttribute("stroke","currentColor"),r.setAttribute("stroke-width","2"),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),r.classList.add("lucide","lucide-upload");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d","M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4");const t=document.createElementNS("http://www.w3.org/2000/svg","polyline");t.setAttribute("points","17 8 12 3 7 8");const n=document.createElementNS("http://www.w3.org/2000/svg","line");return n.setAttribute("x1","12"),n.setAttribute("x2","12"),n.setAttribute("y1","3"),n.setAttribute("y2","15"),r.appendChild(e),r.appendChild(t),r.appendChild(n),r}function Ns(){const r="http://www.w3.org/2000/svg",e=document.createElementNS(r,"svg");e.setAttribute("width","12"),e.setAttribute("height","12"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","3"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.classList.add("lucide","lucide-video");const t=document.createElementNS(r,"path");t.setAttribute("d","m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5");const n=document.createElementNS(r,"rect");return n.setAttribute("x","2"),n.setAttribute("y","6"),n.setAttribute("width","14"),n.setAttribute("height","12"),n.setAttribute("rx","2"),e.appendChild(t),e.appendChild(n),document.body.appendChild(e),e}function pe(r,e,t,n,i){let s=document.createElement(r);return e&&(s.className+=e),t&&(s.style.cssText=t),n&&(s.textContent=n),i&&i.appendChild(s),s}class Ts{constructor(){ce(this,Lt);ce(this,wt);ce(this,sn,"#fff");G(this,Lt,document.createElementNS("http://www.w3.org/2000/svg","svg")),F(this,Lt).setAttribute("viewBox","25 25 50 50"),F(this,Lt).classList.add("loader-svg"),G(this,wt,document.createElementNS("http://www.w3.org/2000/svg","circle")),F(this,wt).setAttribute("r","20"),F(this,wt).setAttribute("cy","50"),F(this,wt).setAttribute("cx","50"),F(this,wt).setAttribute("stroke",F(this,sn)),F(this,wt).classList.add("loader-circle"),F(this,Lt).appendChild(F(this,wt))}show(e,t){t&&(G(this,sn,t),F(this,wt).setAttribute("stroke",F(this,sn))),e.appendChild(F(this,Lt))}hide(){F(this,Lt).remove()}}Lt=new WeakMap,wt=new WeakMap,sn=new WeakMap;const Yr=new Ts,Wn=document.body;class Qr{constructor(){Be(this,"main");Be(this,"dialogContainer");Be(this,"dialog");Be(this,"dialogBackdrop");Be(this,"dialogContent");Be(this,"dialogHeader");Be(this,"dialogBody");Be(this,"dialogFooter");Be(this,"confirmButton");Be(this,"cancelButton");Be(this,"confirmCallback");Be(this,"cancelCallback");this.main=pe("div"),this.dialog=pe("div"),this.confirmCallback=void 0,this.cancelCallback=void 0}_init(e){this.main=pe("div","dialog-presentation","","",Wn),this.main.setAttribute("role","presentation"),this.dialogContainer=pe("div","dialog-container","","",this.main),this.dialogBackdrop=pe("div","dialog-backdrop","","",this.dialogContainer),this.dialog=pe("div","dialog","","",this.dialogContainer),this.dialog.setAttribute("tabIndex","-1");const t=document.activeElement;if(t&&t!==document.body&&(t.blur(),this.dialog.focus()),this.dialog.className="dialog",this.dialogContent=pe("div","dialog-content","","",this.dialog),e!=null&&e.dialogContentStyle&&Object.assign(this.dialogContent.style,e.dialogContentStyle),this.confirmButton=pe("button","dialog-btn confirm","","",this.dialogFooter),this.confirmButton.type="button",this.cancelButton=pe("button","dialog-btn cancel","","",this.dialogFooter),this.cancelButton.type="button",e.showCloseBtn){const n=pe("button","dialog-close-btn","","",this.dialogContent);n.appendChild(or()),n.onclick=()=>this.hide()}return e.header&&this._setHeader(e),this._setBody(e),this._setFooter(e),this.confirmButton.textContent=e.confirmButtonText||"Upload",this.cancelButton.textContent=e.cancelButtonText||"Cancel",Wn.style.overflow="hidden",this.confirmButton.textContent=e.confirmButtonText||"Upload",this.cancelButton.textContent=e.cancelButtonText||"Cancel",Wn.classList.add("dialog-visible"),new Promise(n=>{const i=s=>()=>{this.hide(),n(s==="confirm")};this.confirmCallback=e.onConfirm||i("confirm"),this.confirmButton.addEventListener("click",this.confirmCallback),this.cancelCallback=e.onCancel||i("cancel"),this.cancelButton.addEventListener("click",this.cancelCallback)})}_setHeader(e){if(this.dialogHeader=pe("div","dialog-header","","",this.dialogContent),!e.header)this.dialogHeader.innerHTML="";else if(typeof e.header=="string"){const t=pe("h4","dialog-header-text","","",this.dialogHeader);t.textContent=e.header}else this.dialogHeader.innerHTML="",this.dialogHeader.appendChild(e.header)}_setBody(e){this.dialogBody=pe("div","dialog-body","","",this.dialogContent),typeof e.content=="string"?this.dialogBody.innerHTML=e.content:(this.dialogBody.innerHTML="",this.dialogBody.appendChild(e.content))}_setFooter(e){this.dialogFooter=pe("div","dialog-footer","","",this.dialogContent),e.showFooter?this.dialogFooter.append(this.cancelButton,this.confirmButton):(this.dialogFooter.innerHTML="",this.dialogFooter.remove())}show(e){this._init(e),setTimeout(()=>{this.dialogContainer.style.opacity="1",this.dialog.style.transform="scale(1)",this.dialog.style.transition="transform 150ms ease-in",this.dialog.style.opacity="1",this.dialogBackdrop.style.opacity="1"},150)}hide(){this.main||Wn.style.removeProperty("overflow"),this.dialog.style.transform="scale(0.8)",this.dialog.style.transition="transform 150ms ease-out",this.dialogBackdrop.style.opacity="0",setTimeout(()=>{this.dialogContainer.style.opacity="0",this.dialog.style.opacity="0",this.dialogContent.style.opacity="0",this.main.remove()},150)}updateUploadBtn(e){e?(Yr.show(this.confirmButton),this.confirmButton.disabled=!0):(Yr.hide(),this.confirmButton.disabled=!1)}}const Pn=new Qr,Ve=new Qr;class Ls{constructor(){Be(this,"main");Be(this,"dialogBody");this.main=pe("div"),this.dialogBody=pe("div"),this.hide()}show(e){this.main=pe("div","popover","","",e.mainContainer),this.dialogBody=pe("div","popover-body","","",this.main),this.main.id=e.divId,this.dialogBody.append(e.content)}hide(){this.main.remove()}}const ht=new Ls;var gt=(r=>(r[r.IMAGE=0]="IMAGE",r[r.AUDIO=1]="AUDIO",r[r.VIDEO=2]="VIDEO",r[r.ALL=3]="ALL",r[r.FOLDER=4]="FOLDER",r))(gt||{});const Cn={0:"IMAGE",1:"AUDIO",2:"VIDEO",3:"ALL",4:"FOLDER"};function lr(r){switch(r){case"image":return Cn[gt.IMAGE];case"video":return Cn[gt.VIDEO];case"audio":return Cn[gt.AUDIO];default:return Cn[gt.ALL]}}function xs(r){const e={};r.forEach(i=>{e[i.key]={...i,children:{}}});const t=i=>(Object.values(e).filter(d=>d.nestedFolderName==i.key).forEach(d=>{i.children[d.key]=t(d)}),i);return r.reduce((i,s)=>(s.nestedFolderName||i.push(t(e[s.key])),i),[])}function Us(r,e){const t=n=>{if(n.key===e.nestedFolderName)return n.children[e.key]={...e,children:{}},!0;for(const i in n.children){const s=n.children[i];if(t(s))return!0}return!1};for(const n of r)if(t(n))break;return r}const _s=async(r,e)=>{let t;try{r&&(t={Authorization:r,"app-id":e==="production"?"hamropatro":"hamropatro-android"})}catch(i){if(i)throw i}return{meta:t}};function le(r,e){const t=document.createElement("div");return r&&(t.className=r),e&&(t.id=e),t}function En(r,e,t){const n=document.createElement("p");return e&&(n.className=e),t&&(n.id=t),r&&(n.textContent=r),n}function Ae(r,e){const t=document.createElement("span");return e&&(t.className=e),r&&(t.textContent=r),t}function ei(r,e,t,n){const i=document.createElement("img");return e&&(i.className=e),i.src=r,i}function Bs(r,e,t){const n=document.createElement("video"),i=document.createElement("source");return n.className=e,i.src=r,n.appendChild(i),n}function Os(r,e,t){const n=document.createElement("audio"),i=document.createElement("source");return n.className=e,n.controls=!0,i.src=r,n.appendChild(i),n}function st(r,e,t,n,i){const s=document.createElement("button");return e&&(s.className=e),t&&(s.id=t),r&&(s.textContent=r),i&&(s.innerHTML=i),s.disabled=n,s}function cr(r,e,t){const n=document.createElement("input");return n.className=e,n.defaultValue=t,r&&(n.type=r),n}(function(r,e){typeof exports=="object"&&typeof module<"u"?module.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis<"u"?globalThis:r||self).imageCompression=e()})(void 0,function(){function r(P,Z){return Z.forEach(function(J){J&&typeof J!="string"&&!Array.isArray(J)&&Object.keys(J).forEach(function(E){if(E!=="default"&&!(E in P)){var o=Object.getOwnPropertyDescriptor(J,E);Object.defineProperty(P,E,o.get?o:{enumerable:!0,get:function(){return J[E]}})}})}),Object.freeze(P)}function e(P,Z){return new Promise(function(J,E){let o;return t(P).then(function(a){try{return o=a,J(new Blob([Z.slice(0,2),o,Z.slice(2)],{type:"image/jpeg"}))}catch(C){return E(C)}},E)})}const t=P=>new Promise((Z,J)=>{const E=new FileReader;E.addEventListener("load",({target:{result:o}})=>{const a=new DataView(o);let C=0;if(a.getUint16(C)!==65496)return J("not a valid JPEG");for(C+=2;;){const p=a.getUint16(C);if(p===65498)break;const I=a.getUint16(C+2);if(p===65505&&a.getUint32(C+4)===1165519206){const U=C+10;let c;switch(a.getUint16(U)){case 18761:c=!0;break;case 19789:c=!1;break;default:return J("TIFF header contains invalid endian")}if(a.getUint16(U+2,c)!==42)return J("TIFF header contains invalid version");const h=a.getUint32(U+4,c),l=U+h+2+12*a.getUint16(U+h,c);for(let m=U+h+2;m<l;m+=12)if(a.getUint16(m,c)==274){if(a.getUint16(m+2,c)!==3)return J("Orientation data type is invalid");if(a.getUint32(m+4,c)!==1)return J("Orientation data count is invalid");a.setUint16(m+8,1,c);break}return Z(o.slice(C,C+2+I))}C+=2+I}return Z(new Blob)}),E.readAsArrayBuffer(P)});var n={};(function(P){var Z,J,E={};P.exports=E,E.parse=function(o,a){for(var C=E.bin.readUshort,p=E.bin.readUint,I=0,U={},c=new Uint8Array(o),h=c.length-4;p(c,h)!=101010256;)h--;I=h,I+=4;var l=C(c,I+=4);C(c,I+=2);var m=p(c,I+=2),A=p(c,I+=4);I+=4,I=A;for(var O=0;O<l;O++){p(c,I),I+=4,I+=4,I+=4,p(c,I+=4),m=p(c,I+=4);var H=p(c,I+=4),x=C(c,I+=4),X=C(c,I+2),j=C(c,I+4);I+=6;var M=p(c,I+=8);I+=4,I+=x+X+j,E._readLocal(c,M,U,m,H,a)}return U},E._readLocal=function(o,a,C,p,I,U){var c=E.bin.readUshort,h=E.bin.readUint;h(o,a),c(o,a+=4),c(o,a+=2);var l=c(o,a+=2);h(o,a+=2),h(o,a+=4),a+=4;var m=c(o,a+=8),A=c(o,a+=2);a+=2;var O=E.bin.readUTF8(o,a,m);if(a+=m,a+=A,U)C[O]={size:I,csize:p};else{var H=new Uint8Array(o.buffer,a);if(l==0)C[O]=new Uint8Array(H.buffer.slice(a,a+p));else{if(l!=8)throw"unknown compression method: "+l;var x=new Uint8Array(I);E.inflateRaw(H,x),C[O]=x}}},E.inflateRaw=function(o,a){return E.F.inflate(o,a)},E.inflate=function(o,a){return o[0],o[1],E.inflateRaw(new Uint8Array(o.buffer,o.byteOffset+2,o.length-6),a)},E.deflate=function(o,a){a==null&&(a={level:6});var C=0,p=new Uint8Array(50+Math.floor(1.1*o.length));p[C]=120,p[C+1]=156,C+=2,C=E.F.deflateRaw(o,p,C,a.level);var I=E.adler(o,0,o.length);return p[C+0]=I>>>24&255,p[C+1]=I>>>16&255,p[C+2]=I>>>8&255,p[C+3]=I>>>0&255,new Uint8Array(p.buffer,0,C+4)},E.deflateRaw=function(o,a){a==null&&(a={level:6});var C=new Uint8Array(50+Math.floor(1.1*o.length)),p=E.F.deflateRaw(o,C,p,a.level);return new Uint8Array(C.buffer,0,p)},E.encode=function(o,a){a==null&&(a=!1);var C=0,p=E.bin.writeUint,I=E.bin.writeUshort,U={};for(var c in o){var h=!E._noNeed(c)&&!a,l=o[c],m=E.crc.crc(l,0,l.length);U[c]={cpr:h,usize:l.length,crc:m,file:h?E.deflateRaw(l):l}}for(var c in U)C+=U[c].file.length+30+46+2*E.bin.sizeUTF8(c);C+=22;var A=new Uint8Array(C),O=0,H=[];for(var c in U){var x=U[c];H.push(O),O=E._writeHeader(A,O,c,x,0)}var X=0,j=O;for(var c in U)x=U[c],H.push(O),O=E._writeHeader(A,O,c,x,1,H[X++]);var M=O-j;return p(A,O,101010256),O+=4,I(A,O+=4,X),I(A,O+=2,X),p(A,O+=2,M),p(A,O+=4,j),O+=4,O+=2,A.buffer},E._noNeed=function(o){var a=o.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(a)!=-1},E._writeHeader=function(o,a,C,p,I,U){var c=E.bin.writeUint,h=E.bin.writeUshort,l=p.file;return c(o,a,I==0?67324752:33639248),a+=4,I==1&&(a+=2),h(o,a,20),h(o,a+=2,0),h(o,a+=2,p.cpr?8:0),c(o,a+=2,0),c(o,a+=4,p.crc),c(o,a+=4,l.length),c(o,a+=4,p.usize),h(o,a+=4,E.bin.sizeUTF8(C)),h(o,a+=2,0),a+=2,I==1&&(a+=2,a+=2,c(o,a+=6,U),a+=4),a+=E.bin.writeUTF8(o,a,C),I==0&&(o.set(l,a),a+=l.length),a},E.crc={table:function(){for(var o=new Uint32Array(256),a=0;a<256;a++){for(var C=a,p=0;p<8;p++)1&C?C=3988292384^C>>>1:C>>>=1;o[a]=C}return o}(),update:function(o,a,C,p){for(var I=0;I<p;I++)o=E.crc.table[255&(o^a[C+I])]^o>>>8;return o},crc:function(o,a,C){return 4294967295^E.crc.update(4294967295,o,a,C)}},E.adler=function(o,a,C){for(var p=1,I=0,U=a,c=a+C;U<c;){for(var h=Math.min(U+5552,c);U<h;)I+=p+=o[U++];p%=65521,I%=65521}return I<<16|p},E.bin={readUshort:function(o,a){return o[a]|o[a+1]<<8},writeUshort:function(o,a,C){o[a]=255&C,o[a+1]=C>>8&255},readUint:function(o,a){return 16777216*o[a+3]+(o[a+2]<<16|o[a+1]<<8|o[a])},writeUint:function(o,a,C){o[a]=255&C,o[a+1]=C>>8&255,o[a+2]=C>>16&255,o[a+3]=C>>24&255},readASCII:function(o,a,C){for(var p="",I=0;I<C;I++)p+=String.fromCharCode(o[a+I]);return p},writeASCII:function(o,a,C){for(var p=0;p<C.length;p++)o[a+p]=C.charCodeAt(p)},pad:function(o){return o.length<2?"0"+o:o},readUTF8:function(o,a,C){for(var p,I="",U=0;U<C;U++)I+="%"+E.bin.pad(o[a+U].toString(16));try{p=decodeURIComponent(I)}catch{return E.bin.readASCII(o,a,C)}return p},writeUTF8:function(o,a,C){for(var p=C.length,I=0,U=0;U<p;U++){var c=C.charCodeAt(U);if(!(4294967168&c))o[a+I]=c,I++;else if(!(4294965248&c))o[a+I]=192|c>>6,o[a+I+1]=128|c>>0&63,I+=2;else if(!(4294901760&c))o[a+I]=224|c>>12,o[a+I+1]=128|c>>6&63,o[a+I+2]=128|c>>0&63,I+=3;else{if(4292870144&c)throw"e";o[a+I]=240|c>>18,o[a+I+1]=128|c>>12&63,o[a+I+2]=128|c>>6&63,o[a+I+3]=128|c>>0&63,I+=4}}return I},sizeUTF8:function(o){for(var a=o.length,C=0,p=0;p<a;p++){var I=o.charCodeAt(p);if(!(4294967168&I))C++;else if(!(4294965248&I))C+=2;else if(!(4294901760&I))C+=3;else{if(4292870144&I)throw"e";C+=4}}return C}},E.F={},E.F.deflateRaw=function(o,a,C,p){var I=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][p],U=E.F.U,c=E.F._goodIndex;E.F._hash;var h=E.F._putsE,l=0,m=C<<3,A=0,O=o.length;if(p==0){for(;l<O;)h(a,m,l+(_=Math.min(65535,O-l))==O?1:0),m=E.F._copyExact(o,l,_,a,m+8),l+=_;return m>>>3}var H=U.lits,x=U.strt,X=U.prev,j=0,M=0,z=0,k=0,W=0,y=0;for(O>2&&(x[y=E.F._hash(o,0)]=0),l=0;l<O;l++){if(W=y,l+1<O-2){y=E.F._hash(o,l+1);var w=l+1&32767;X[w]=x[y],x[y]=w}if(A<=l){(j>14e3||M>26697)&&O-l>100&&(A<l&&(H[j]=l-A,j+=2,A=l),m=E.F._writeBlock(l==O-1||A==O?1:0,H,j,k,o,z,l-z,a,m),j=M=k=0,z=l);var N=0;l<O-2&&(N=E.F._bestMatch(o,l,X,W,Math.min(I[2],O-l),I[3]));var _=N>>>16,L=65535&N;if(N!=0){L=65535&N;var B=c(_=N>>>16,U.of0);U.lhst[257+B]++;var T=c(L,U.df0);U.dhst[T]++,k+=U.exb[B]+U.dxb[T],H[j]=_<<23|l-A,H[j+1]=L<<16|B<<8|T,j+=2,A=l+_}else U.lhst[o[l]]++;M++}}for(z==l&&o.length!=0||(A<l&&(H[j]=l-A,j+=2,A=l),m=E.F._writeBlock(1,H,j,k,o,z,l-z,a,m),j=0,M=0,j=M=k=0,z=l);7&m;)m++;return m>>>3},E.F._bestMatch=function(o,a,C,p,I,U){var c=32767&a,h=C[c],l=c-h+32768&32767;if(h==c||p!=E.F._hash(o,a-l))return 0;for(var m=0,A=0,O=Math.min(32767,a);l<=O&&--U!=0&&h!=c;){if(m==0||o[a+m]==o[a+m-l]){var H=E.F._howLong(o,a,l);if(H>m){if(A=l,(m=H)>=I)break;l+2<H&&(H=l+2);for(var x=0,X=0;X<H-2;X++){var j=a-l+X+32768&32767,M=j-C[j]+32768&32767;M>x&&(x=M,h=j)}}}l+=(c=h)-(h=C[c])+32768&32767}return m<<16|A},E.F._howLong=function(o,a,C){if(o[a]!=o[a-C]||o[a+1]!=o[a+1-C]||o[a+2]!=o[a+2-C])return 0;var p=a,I=Math.min(o.length,a+258);for(a+=3;a<I&&o[a]==o[a-C];)a++;return a-p},E.F._hash=function(o,a){return(o[a]<<8|o[a+1])+(o[a+2]<<4)&65535},E.saved=0,E.F._writeBlock=function(o,a,C,p,I,U,c,h,l){var m,A,O,H,x,X,j,M,z,k=E.F.U,W=E.F._putsF,y=E.F._putsE;k.lhst[256]++,A=(m=E.F.getTrees())[0],O=m[1],H=m[2],x=m[3],X=m[4],j=m[5],M=m[6],z=m[7];var w=32+(l+3&7?8-(l+3&7):0)+(c<<3),N=p+E.F.contSize(k.fltree,k.lhst)+E.F.contSize(k.fdtree,k.dhst),_=p+E.F.contSize(k.ltree,k.lhst)+E.F.contSize(k.dtree,k.dhst);_+=14+3*j+E.F.contSize(k.itree,k.ihst)+(2*k.ihst[16]+3*k.ihst[17]+7*k.ihst[18]);for(var L=0;L<286;L++)k.lhst[L]=0;for(L=0;L<30;L++)k.dhst[L]=0;for(L=0;L<19;L++)k.ihst[L]=0;var B=w<N&&w<_?0:N<_?1:2;if(W(h,l,o),W(h,l+1,B),l+=3,B==0){for(;7&l;)l++;l=E.F._copyExact(I,U,c,h,l)}else{var T,R;if(B==1&&(T=k.fltree,R=k.fdtree),B==2){E.F.makeCodes(k.ltree,A),E.F.revCodes(k.ltree,A),E.F.makeCodes(k.dtree,O),E.F.revCodes(k.dtree,O),E.F.makeCodes(k.itree,H),E.F.revCodes(k.itree,H),T=k.ltree,R=k.dtree,y(h,l,x-257),y(h,l+=5,X-1),y(h,l+=5,j-4),l+=4;for(var b=0;b<j;b++)y(h,l+3*b,k.itree[1+(k.ordr[b]<<1)]);l+=3*j,l=E.F._codeTiny(M,k.itree,h,l),l=E.F._codeTiny(z,k.itree,h,l)}for(var f=U,q=0;q<C;q+=2){for(var S=a[q],K=S>>>23,se=f+(8388607&S);f<se;)l=E.F._writeLit(I[f++],T,h,l);if(K!=0){var Q=a[q+1],re=Q>>16,Y=Q>>8&255,D=255&Q;y(h,l=E.F._writeLit(257+Y,T,h,l),K-k.of0[Y]),l+=k.exb[Y],W(h,l=E.F._writeLit(D,R,h,l),re-k.df0[D]),l+=k.dxb[D],f+=K}}l=E.F._writeLit(256,T,h,l)}return l},E.F._copyExact=function(o,a,C,p,I){var U=I>>>3;return p[U]=C,p[U+1]=C>>>8,p[U+2]=255-p[U],p[U+3]=255-p[U+1],U+=4,p.set(new Uint8Array(o.buffer,a,C),U),I+(C+4<<3)},E.F.getTrees=function(){for(var o=E.F.U,a=E.F._hufTree(o.lhst,o.ltree,15),C=E.F._hufTree(o.dhst,o.dtree,15),p=[],I=E.F._lenCodes(o.ltree,p),U=[],c=E.F._lenCodes(o.dtree,U),h=0;h<p.length;h+=2)o.ihst[p[h]]++;for(h=0;h<U.length;h+=2)o.ihst[U[h]]++;for(var l=E.F._hufTree(o.ihst,o.itree,7),m=19;m>4&&o.itree[1+(o.ordr[m-1]<<1)]==0;)m--;return[a,C,l,I,c,m,p,U]},E.F.getSecond=function(o){for(var a=[],C=0;C<o.length;C+=2)a.push(o[C+1]);return a},E.F.nonZero=function(o){for(var a="",C=0;C<o.length;C+=2)o[C+1]!=0&&(a+=(C>>1)+",");return a},E.F.contSize=function(o,a){for(var C=0,p=0;p<a.length;p++)C+=a[p]*o[1+(p<<1)];return C},E.F._codeTiny=function(o,a,C,p){for(var I=0;I<o.length;I+=2){var U=o[I],c=o[I+1];p=E.F._writeLit(U,a,C,p);var h=U==16?2:U==17?3:7;U>15&&(E.F._putsE(C,p,c,h),p+=h)}return p},E.F._lenCodes=function(o,a){for(var C=o.length;C!=2&&o[C-1]==0;)C-=2;for(var p=0;p<C;p+=2){var I=o[p+1],U=p+3<C?o[p+3]:-1,c=p+5<C?o[p+5]:-1,h=p==0?-1:o[p-1];if(I==0&&U==I&&c==I){for(var l=p+5;l+2<C&&o[l+2]==I;)l+=2;(m=Math.min(l+1-p>>>1,138))<11?a.push(17,m-3):a.push(18,m-11),p+=2*m-2}else if(I==h&&U==I&&c==I){for(l=p+5;l+2<C&&o[l+2]==I;)l+=2;var m=Math.min(l+1-p>>>1,6);a.push(16,m-3),p+=2*m-2}else a.push(I,0)}return C>>>1},E.F._hufTree=function(o,a,C){var p=[],I=o.length,U=a.length,c=0;for(c=0;c<U;c+=2)a[c]=0,a[c+1]=0;for(c=0;c<I;c++)o[c]!=0&&p.push({lit:c,f:o[c]});var h=p.length,l=p.slice(0);if(h==0)return 0;if(h==1){var m=p[0].lit;return l=m==0?1:0,a[1+(m<<1)]=1,a[1+(l<<1)]=1,1}p.sort(function(M,z){return M.f-z.f});var A=p[0],O=p[1],H=0,x=1,X=2;for(p[0]={lit:-1,f:A.f+O.f,l:A,r:O,d:0};x!=h-1;)A=H!=x&&(X==h||p[H].f<p[X].f)?p[H++]:p[X++],O=H!=x&&(X==h||p[H].f<p[X].f)?p[H++]:p[X++],p[x++]={lit:-1,f:A.f+O.f,l:A,r:O};var j=E.F.setDepth(p[x-1],0);for(j>C&&(E.F.restrictDepth(l,C,j),j=C),c=0;c<h;c++)a[1+(l[c].lit<<1)]=l[c].d;return j},E.F.setDepth=function(o,a){return o.lit!=-1?(o.d=a,a):Math.max(E.F.setDepth(o.l,a+1),E.F.setDepth(o.r,a+1))},E.F.restrictDepth=function(o,a,C){var p=0,I=1<<C-a,U=0;for(o.sort(function(h,l){return l.d==h.d?h.f-l.f:l.d-h.d}),p=0;p<o.length&&o[p].d>a;p++){var c=o[p].d;o[p].d=a,U+=I-(1<<C-c)}for(U>>>=C-a;U>0;)(c=o[p].d)<a?(o[p].d++,U-=1<<a-c-1):p++;for(;p>=0;p--)o[p].d==a&&U<0&&(o[p].d--,U++);U!=0&&console.log("debt left")},E.F._goodIndex=function(o,a){var C=0;return a[16|C]<=o&&(C|=16),a[8|C]<=o&&(C|=8),a[4|C]<=o&&(C|=4),a[2|C]<=o&&(C|=2),a[1|C]<=o&&(C|=1),C},E.F._writeLit=function(o,a,C,p){return E.F._putsF(C,p,a[o<<1]),p+a[1+(o<<1)]},E.F.inflate=function(o,a){var C=Uint8Array;if(o[0]==3&&o[1]==0)return a||new C(0);var p=E.F,I=p._bitsF,U=p._bitsE,c=p._decodeTiny,h=p.makeCodes,l=p.codes2map,m=p._get17,A=p.U,O=a==null;O&&(a=new C(o.length>>>2<<3));for(var H,x,X=0,j=0,M=0,z=0,k=0,W=0,y=0,w=0,N=0;X==0;)if(X=I(o,N,1),j=I(o,N+1,2),N+=3,j!=0){if(O&&(a=E.F._check(a,w+(1<<17))),j==1&&(H=A.flmap,x=A.fdmap,W=511,y=31),j==2){M=U(o,N,5)+257,z=U(o,N+5,5)+1,k=U(o,N+10,4)+4,N+=14;for(var _=0;_<38;_+=2)A.itree[_]=0,A.itree[_+1]=0;var L=1;for(_=0;_<k;_++){var B=U(o,N+3*_,3);A.itree[1+(A.ordr[_]<<1)]=B,B>L&&(L=B)}N+=3*k,h(A.itree,L),l(A.itree,L,A.imap),H=A.lmap,x=A.dmap,N=c(A.imap,(1<<L)-1,M+z,o,N,A.ttree);var T=p._copyOut(A.ttree,0,M,A.ltree);W=(1<<T)-1;var R=p._copyOut(A.ttree,M,z,A.dtree);y=(1<<R)-1,h(A.ltree,T),l(A.ltree,T,H),h(A.dtree,R),l(A.dtree,R,x)}for(;;){var b=H[m(o,N)&W];N+=15&b;var f=b>>>4;if(!(f>>>8))a[w++]=f;else{if(f==256)break;var q=w+f-254;if(f>264){var S=A.ldef[f-257];q=w+(S>>>3)+U(o,N,7&S),N+=7&S}var K=x[m(o,N)&y];N+=15&K;var se=K>>>4,Q=A.ddef[se],re=(Q>>>4)+I(o,N,15&Q);for(N+=15&Q,O&&(a=E.F._check(a,w+(1<<17)));w<q;)a[w]=a[w++-re],a[w]=a[w++-re],a[w]=a[w++-re],a[w]=a[w++-re];w=q}}}else{7&N&&(N+=8-(7&N));var Y=4+(N>>>3),D=o[Y-4]|o[Y-3]<<8;O&&(a=E.F._check(a,w+D)),a.set(new C(o.buffer,o.byteOffset+Y,D),w),N=Y+D<<3,w+=D}return a.length==w?a:a.slice(0,w)},E.F._check=function(o,a){var C=o.length;if(a<=C)return o;var p=new Uint8Array(Math.max(C<<1,a));return p.set(o,0),p},E.F._decodeTiny=function(o,a,C,p,I,U){for(var c=E.F._bitsE,h=E.F._get17,l=0;l<C;){var m=o[h(p,I)&a];I+=15&m;var A=m>>>4;if(A<=15)U[l]=A,l++;else{var O=0,H=0;A==16?(H=3+c(p,I,2),I+=2,O=U[l-1]):A==17?(H=3+c(p,I,3),I+=3):A==18&&(H=11+c(p,I,7),I+=7);for(var x=l+H;l<x;)U[l]=O,l++}}return I},E.F._copyOut=function(o,a,C,p){for(var I=0,U=0,c=p.length>>>1;U<C;){var h=o[U+a];p[U<<1]=0,p[1+(U<<1)]=h,h>I&&(I=h),U++}for(;U<c;)p[U<<1]=0,p[1+(U<<1)]=0,U++;return I},E.F.makeCodes=function(o,a){for(var C,p,I,U,c=E.F.U,h=o.length,l=c.bl_count,m=0;m<=a;m++)l[m]=0;for(m=1;m<h;m+=2)l[o[m]]++;var A=c.next_code;for(C=0,l[0]=0,p=1;p<=a;p++)C=C+l[p-1]<<1,A[p]=C;for(I=0;I<h;I+=2)(U=o[I+1])!=0&&(o[I]=A[U],A[U]++)},E.F.codes2map=function(o,a,C){for(var p=o.length,I=E.F.U.rev15,U=0;U<p;U+=2)if(o[U+1]!=0)for(var c=U>>1,h=o[U+1],l=c<<4|h,m=a-h,A=o[U]<<m,O=A+(1<<m);A!=O;)C[I[A]>>>15-a]=l,A++},E.F.revCodes=function(o,a){for(var C=E.F.U.rev15,p=15-a,I=0;I<o.length;I+=2){var U=o[I]<<a-o[I+1];o[I]=C[U]>>>p}},E.F._putsE=function(o,a,C){C<<=7&a;var p=a>>>3;o[p]|=C,o[p+1]|=C>>>8},E.F._putsF=function(o,a,C){C<<=7&a;var p=a>>>3;o[p]|=C,o[p+1]|=C>>>8,o[p+2]|=C>>>16},E.F._bitsE=function(o,a,C){return(o[a>>>3]|o[1+(a>>>3)]<<8)>>>(7&a)&(1<<C)-1},E.F._bitsF=function(o,a,C){return(o[a>>>3]|o[1+(a>>>3)]<<8|o[2+(a>>>3)]<<16)>>>(7&a)&(1<<C)-1},E.F._get17=function(o,a){return(o[a>>>3]|o[1+(a>>>3)]<<8|o[2+(a>>>3)]<<16)>>>(7&a)},E.F._get25=function(o,a){return(o[a>>>3]|o[1+(a>>>3)]<<8|o[2+(a>>>3)]<<16|o[3+(a>>>3)]<<24)>>>(7&a)},E.F.U=(Z=Uint16Array,J=Uint32Array,{next_code:new Z(16),bl_count:new Z(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[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,0,0,0],ldef:new Z(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[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,0,0],ddef:new J(32),flmap:new Z(512),fltree:[],fdmap:new Z(32),fdtree:[],lmap:new Z(32768),ltree:[],ttree:[],dmap:new Z(32768),dtree:[],imap:new Z(512),itree:[],rev15:new Z(32768),lhst:new J(286),dhst:new J(30),ihst:new J(19),lits:new J(15e3),strt:new Z(65536),prev:new Z(32768)}),function(){for(var o=E.F.U,a=0;a<32768;a++){var C=a;C=(4278255360&(C=(4042322160&(C=(3435973836&(C=(2863311530&C)>>>1|(1431655765&C)<<1))>>>2|(858993459&C)<<2))>>>4|(252645135&C)<<4))>>>8|(16711935&C)<<8,o.rev15[a]=(C>>>16|C<<16)>>>17}function p(I,U,c){for(;U--!=0;)I.push(0,c)}for(a=0;a<32;a++)o.ldef[a]=o.of0[a]<<3|o.exb[a],o.ddef[a]=o.df0[a]<<4|o.dxb[a];p(o.fltree,144,8),p(o.fltree,112,9),p(o.fltree,24,7),p(o.fltree,8,8),E.F.makeCodes(o.fltree,9),E.F.codes2map(o.fltree,9,o.flmap),E.F.revCodes(o.fltree,9),p(o.fdtree,32,5),E.F.makeCodes(o.fdtree,5),E.F.codes2map(o.fdtree,5,o.fdmap),E.F.revCodes(o.fdtree,5),p(o.itree,19,0),p(o.ltree,286,0),p(o.dtree,30,0),p(o.ttree,320,0)}()})({get exports(){return n},set exports(P){n=P}});var i=r({__proto__:null,default:n},[n]);const s=function(){var P={nextZero(c,h){for(;c[h]!=0;)h++;return h},readUshort:(c,h)=>c[h]<<8|c[h+1],writeUshort(c,h,l){c[h]=l>>8&255,c[h+1]=255&l},readUint:(c,h)=>16777216*c[h]+(c[h+1]<<16|c[h+2]<<8|c[h+3]),writeUint(c,h,l){c[h]=l>>24&255,c[h+1]=l>>16&255,c[h+2]=l>>8&255,c[h+3]=255&l},readASCII(c,h,l){let m="";for(let A=0;A<l;A++)m+=String.fromCharCode(c[h+A]);return m},writeASCII(c,h,l){for(let m=0;m<l.length;m++)c[h+m]=l.charCodeAt(m)},readBytes(c,h,l){const m=[];for(let A=0;A<l;A++)m.push(c[h+A]);return m},pad:c=>c.length<2?`0${c}`:c,readUTF8(c,h,l){let m,A="";for(let O=0;O<l;O++)A+=`%${P.pad(c[h+O].toString(16))}`;try{m=decodeURIComponent(A)}catch{return P.readASCII(c,h,l)}return m}};function Z(c,h,l,m){const A=h*l,O=a(m),H=Math.ceil(h*O/8),x=new Uint8Array(4*A),X=new Uint32Array(x.buffer),{ctype:j}=m,{depth:M}=m,z=P.readUshort;if(j==6){const S=A<<2;if(M==8)for(var k=0;k<S;k+=4)x[k]=c[k],x[k+1]=c[k+1],x[k+2]=c[k+2],x[k+3]=c[k+3];if(M==16)for(k=0;k<S;k++)x[k]=c[k<<1]}else if(j==2){const S=m.tabs.tRNS;if(S==null){if(M==8)for(k=0;k<A;k++){var W=3*k;X[k]=255<<24|c[W+2]<<16|c[W+1]<<8|c[W]}if(M==16)for(k=0;k<A;k++)W=6*k,X[k]=255<<24|c[W+4]<<16|c[W+2]<<8|c[W]}else{var y=S[0];const K=S[1],se=S[2];if(M==8)for(k=0;k<A;k++){var w=k<<2;W=3*k,X[k]=255<<24|c[W+2]<<16|c[W+1]<<8|c[W],c[W]==y&&c[W+1]==K&&c[W+2]==se&&(x[w+3]=0)}if(M==16)for(k=0;k<A;k++)w=k<<2,W=6*k,X[k]=255<<24|c[W+4]<<16|c[W+2]<<8|c[W],z(c,W)==y&&z(c,W+2)==K&&z(c,W+4)==se&&(x[w+3]=0)}}else if(j==3){const S=m.tabs.PLTE,K=m.tabs.tRNS,se=K?K.length:0;if(M==1)for(var N=0;N<l;N++){var _=N*H,L=N*h;for(k=0;k<h;k++){w=L+k<<2;var B=3*(T=c[_+(k>>3)]>>7-((7&k)<<0)&1);x[w]=S[B],x[w+1]=S[B+1],x[w+2]=S[B+2],x[w+3]=T<se?K[T]:255}}if(M==2)for(N=0;N<l;N++)for(_=N*H,L=N*h,k=0;k<h;k++)w=L+k<<2,B=3*(T=c[_+(k>>2)]>>6-((3&k)<<1)&3),x[w]=S[B],x[w+1]=S[B+1],x[w+2]=S[B+2],x[w+3]=T<se?K[T]:255;if(M==4)for(N=0;N<l;N++)for(_=N*H,L=N*h,k=0;k<h;k++)w=L+k<<2,B=3*(T=c[_+(k>>1)]>>4-((1&k)<<2)&15),x[w]=S[B],x[w+1]=S[B+1],x[w+2]=S[B+2],x[w+3]=T<se?K[T]:255;if(M==8)for(k=0;k<A;k++){var T;w=k<<2,B=3*(T=c[k]),x[w]=S[B],x[w+1]=S[B+1],x[w+2]=S[B+2],x[w+3]=T<se?K[T]:255}}else if(j==4){if(M==8)for(k=0;k<A;k++){w=k<<2;var R=c[b=k<<1];x[w]=R,x[w+1]=R,x[w+2]=R,x[w+3]=c[b+1]}if(M==16)for(k=0;k<A;k++){var b;w=k<<2,R=c[b=k<<2],x[w]=R,x[w+1]=R,x[w+2]=R,x[w+3]=c[b+2]}}else if(j==0)for(y=m.tabs.tRNS?m.tabs.tRNS:-1,N=0;N<l;N++){const S=N*H,K=N*h;if(M==1)for(var f=0;f<h;f++){var q=(R=255*(c[S+(f>>>3)]>>>7-(7&f)&1))==255*y?0:255;X[K+f]=q<<24|R<<16|R<<8|R}else if(M==2)for(f=0;f<h;f++)q=(R=85*(c[S+(f>>>2)]>>>6-((3&f)<<1)&3))==85*y?0:255,X[K+f]=q<<24|R<<16|R<<8|R;else if(M==4)for(f=0;f<h;f++)q=(R=17*(c[S+(f>>>1)]>>>4-((1&f)<<2)&15))==17*y?0:255,X[K+f]=q<<24|R<<16|R<<8|R;else if(M==8)for(f=0;f<h;f++)q=(R=c[S+f])==y?0:255,X[K+f]=q<<24|R<<16|R<<8|R;else if(M==16)for(f=0;f<h;f++)R=c[S+(f<<1)],q=z(c,S+(f<<1))==y?0:255,X[K+f]=q<<24|R<<16|R<<8|R}return x}function J(c,h,l,m){const A=a(c),O=Math.ceil(l*A/8),H=new Uint8Array((O+1+c.interlace)*m);return h=c.tabs.CgBI?o(h,H):E(h,H),c.interlace==0?h=C(h,c,0,l,m):c.interlace==1&&(h=function(X,j){const M=j.width,z=j.height,k=a(j),W=k>>3,y=Math.ceil(M*k/8),w=new Uint8Array(z*y);let N=0;const _=[0,0,4,0,2,0,1],L=[0,4,0,2,0,1,0],B=[8,8,8,4,4,2,2],T=[8,8,4,4,2,2,1];let R=0;for(;R<7;){const f=B[R],q=T[R];let S=0,K=0,se=_[R];for(;se<z;)se+=f,K++;let Q=L[R];for(;Q<M;)Q+=q,S++;const re=Math.ceil(S*k/8);C(X,j,N,S,K);let Y=0,D=_[R];for(;D<z;){let ae=L[R],ge=N+Y*re<<3;for(;ae<M;){var b;if(k==1&&(b=(b=X[ge>>3])>>7-(7&ge)&1,w[D*y+(ae>>3)]|=b<<7-((7&ae)<<0)),k==2&&(b=(b=X[ge>>3])>>6-(7&ge)&3,w[D*y+(ae>>2)]|=b<<6-((3&ae)<<1)),k==4&&(b=(b=X[ge>>3])>>4-(7&ge)&15,w[D*y+(ae>>1)]|=b<<4-((1&ae)<<2)),k>=8){const ke=D*y+ae*W;for(let ye=0;ye<W;ye++)w[ke+ye]=X[(ge>>3)+ye]}ge+=k,ae+=q}Y++,D+=f}S*K!=0&&(N+=K*(1+re)),R+=1}return w}(h,c)),h}function E(c,h){return o(new Uint8Array(c.buffer,2,c.length-6),h)}var o=function(){const c={H:{}};return c.H.N=function(h,l){const m=Uint8Array;let A,O,H=0,x=0,X=0,j=0,M=0,z=0,k=0,W=0,y=0;if(h[0]==3&&h[1]==0)return l||new m(0);const w=c.H,N=w.b,_=w.e,L=w.R,B=w.n,T=w.A,R=w.Z,b=w.m,f=l==null;for(f&&(l=new m(h.length>>>2<<5));H==0;)if(H=N(h,y,1),x=N(h,y+1,2),y+=3,x!=0){if(f&&(l=c.H.W(l,W+(1<<17))),x==1&&(A=b.J,O=b.h,z=511,k=31),x==2){X=_(h,y,5)+257,j=_(h,y+5,5)+1,M=_(h,y+10,4)+4,y+=14;let S=1;for(var q=0;q<38;q+=2)b.Q[q]=0,b.Q[q+1]=0;for(q=0;q<M;q++){const Q=_(h,y+3*q,3);b.Q[1+(b.X[q]<<1)]=Q,Q>S&&(S=Q)}y+=3*M,B(b.Q,S),T(b.Q,S,b.u),A=b.w,O=b.d,y=L(b.u,(1<<S)-1,X+j,h,y,b.v);const K=w.V(b.v,0,X,b.C);z=(1<<K)-1;const se=w.V(b.v,X,j,b.D);k=(1<<se)-1,B(b.C,K),T(b.C,K,A),B(b.D,se),T(b.D,se,O)}for(;;){const S=A[R(h,y)&z];y+=15&S;const K=S>>>4;if(!(K>>>8))l[W++]=K;else{if(K==256)break;{let se=W+K-254;if(K>264){const ae=b.q[K-257];se=W+(ae>>>3)+_(h,y,7&ae),y+=7&ae}const Q=O[R(h,y)&k];y+=15&Q;const re=Q>>>4,Y=b.c[re],D=(Y>>>4)+N(h,y,15&Y);for(y+=15&Y;W<se;)l[W]=l[W++-D],l[W]=l[W++-D],l[W]=l[W++-D],l[W]=l[W++-D];W=se}}}}else{7&y&&(y+=8-(7&y));const S=4+(y>>>3),K=h[S-4]|h[S-3]<<8;f&&(l=c.H.W(l,W+K)),l.set(new m(h.buffer,h.byteOffset+S,K),W),y=S+K<<3,W+=K}return l.length==W?l:l.slice(0,W)},c.H.W=function(h,l){const m=h.length;if(l<=m)return h;const A=new Uint8Array(m<<1);return A.set(h,0),A},c.H.R=function(h,l,m,A,O,H){const x=c.H.e,X=c.H.Z;let j=0;for(;j<m;){const M=h[X(A,O)&l];O+=15&M;const z=M>>>4;if(z<=15)H[j]=z,j++;else{let k=0,W=0;z==16?(W=3+x(A,O,2),O+=2,k=H[j-1]):z==17?(W=3+x(A,O,3),O+=3):z==18&&(W=11+x(A,O,7),O+=7);const y=j+W;for(;j<y;)H[j]=k,j++}}return O},c.H.V=function(h,l,m,A){let O=0,H=0;const x=A.length>>>1;for(;H<m;){const X=h[H+l];A[H<<1]=0,A[1+(H<<1)]=X,X>O&&(O=X),H++}for(;H<x;)A[H<<1]=0,A[1+(H<<1)]=0,H++;return O},c.H.n=function(h,l){const m=c.H.m,A=h.length;let O,H,x,X;const j=m.j;for(var M=0;M<=l;M++)j[M]=0;for(M=1;M<A;M+=2)j[h[M]]++;const z=m.K;for(O=0,j[0]=0,H=1;H<=l;H++)O=O+j[H-1]<<1,z[H]=O;for(x=0;x<A;x+=2)X=h[x+1],X!=0&&(h[x]=z[X],z[X]++)},c.H.A=function(h,l,m){const A=h.length,O=c.H.m.r;for(let H=0;H<A;H+=2)if(h[H+1]!=0){const x=H>>1,X=h[H+1],j=x<<4|X,M=l-X;let z=h[H]<<M;const k=z+(1<<M);for(;z!=k;)m[O[z]>>>15-l]=j,z++}},c.H.l=function(h,l){const m=c.H.m.r,A=15-l;for(let O=0;O<h.length;O+=2){const H=h[O]<<l-h[O+1];h[O]=m[H]>>>A}},c.H.M=function(h,l,m){m<<=7&l;const A=l>>>3;h[A]|=m,h[A+1]|=m>>>8},c.H.I=function(h,l,m){m<<=7&l;const A=l>>>3;h[A]|=m,h[A+1]|=m>>>8,h[A+2]|=m>>>16},c.H.e=function(h,l,m){return(h[l>>>3]|h[1+(l>>>3)]<<8)>>>(7&l)&(1<<m)-1},c.H.b=function(h,l,m){return(h[l>>>3]|h[1+(l>>>3)]<<8|h[2+(l>>>3)]<<16)>>>(7&l)&(1<<m)-1},c.H.Z=function(h,l){return(h[l>>>3]|h[1+(l>>>3)]<<8|h[2+(l>>>3)]<<16)>>>(7&l)},c.H.i=function(h,l){return(h[l>>>3]|h[1+(l>>>3)]<<8|h[2+(l>>>3)]<<16|h[3+(l>>>3)]<<24)>>>(7&l)},c.H.m=function(){const h=Uint16Array,l=Uint32Array;return{K:new h(16),j:new h(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[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,0,0,0],q:new h(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[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,0,0],c:new l(32),J:new h(512),_:[],h:new h(32),$:[],w:new h(32768),C:[],v:[],d:new h(32768),D:[],u:new h(512),Q:[],r:new h(32768),s:new l(286),Y:new l(30),a:new l(19),t:new l(15e3),k:new h(65536),g:new h(32768)}}(),function(){const h=c.H.m;for(var l=0;l<32768;l++){let A=l;A=(2863311530&A)>>>1|(1431655765&A)<<1,A=(3435973836&A)>>>2|(858993459&A)<<2,A=(4042322160&A)>>>4|(252645135&A)<<4,A=(4278255360&A)>>>8|(16711935&A)<<8,h.r[l]=(A>>>16|A<<16)>>>17}function m(A,O,H){for(;O--!=0;)A.push(0,H)}for(l=0;l<32;l++)h.q[l]=h.S[l]<<3|h.T[l],h.c[l]=h.p[l]<<4|h.z[l];m(h._,144,8),m(h._,112,9),m(h._,24,7),m(h._,8,8),c.H.n(h._,9),c.H.A(h._,9,h.J),c.H.l(h._,9),m(h.$,32,5),c.H.n(h.$,5),c.H.A(h.$,5,h.h),c.H.l(h.$,5),m(h.Q,19,0),m(h.C,286,0),m(h.D,30,0),m(h.v,320,0)}(),c.H.N}();function a(c){return[1,null,3,1,2,null,4][c.ctype]*c.depth}function C(c,h,l,m,A){let O=a(h);const H=Math.ceil(m*O/8);let x,X;O=Math.ceil(O/8);let j=c[l],M=0;if(j>1&&(c[l]=[0,0,1][j-2]),j==3)for(M=O;M<H;M++)c[M+1]=c[M+1]+(c[M+1-O]>>>1)&255;for(let z=0;z<A;z++)if(x=l+z*H,X=x+z+1,j=c[X-1],M=0,j==0)for(;M<H;M++)c[x+M]=c[X+M];else if(j==1){for(;M<O;M++)c[x+M]=c[X+M];for(;M<H;M++)c[x+M]=c[X+M]+c[x+M-O]}else if(j==2)for(;M<H;M++)c[x+M]=c[X+M]+c[x+M-H];else if(j==3){for(;M<O;M++)c[x+M]=c[X+M]+(c[x+M-H]>>>1);for(;M<H;M++)c[x+M]=c[X+M]+(c[x+M-H]+c[x+M-O]>>>1)}else{for(;M<O;M++)c[x+M]=c[X+M]+p(0,c[x+M-H],0);for(;M<H;M++)c[x+M]=c[X+M]+p(c[x+M-O],c[x+M-H],c[x+M-O-H])}return c}function p(c,h,l){const m=c+h-l,A=m-c,O=m-h,H=m-l;return A*A<=O*O&&A*A<=H*H?c:O*O<=H*H?h:l}function I(c,h,l){l.width=P.readUint(c,h),h+=4,l.height=P.readUint(c,h),h+=4,l.depth=c[h],h++,l.ctype=c[h],h++,l.compress=c[h],h++,l.filter=c[h],h++,l.interlace=c[h],h++}function U(c,h,l,m,A,O,H,x,X){const j=Math.min(h,A),M=Math.min(l,O);let z=0,k=0;for(let R=0;R<M;R++)for(let b=0;b<j;b++)if(H>=0&&x>=0?(z=R*h+b<<2,k=(x+R)*A+H+b<<2):(z=(-x+R)*h-H+b<<2,k=R*A+b<<2),X==0)m[k]=c[z],m[k+1]=c[z+1],m[k+2]=c[z+2],m[k+3]=c[z+3];else if(X==1){var W=c[z+3]*.00392156862745098,y=c[z]*W,w=c[z+1]*W,N=c[z+2]*W,_=m[k+3]*(1/255),L=m[k]*_,B=m[k+1]*_,T=m[k+2]*_;const f=1-W,q=W+_*f,S=q==0?0:1/q;m[k+3]=255*q,m[k+0]=(y+L*f)*S,m[k+1]=(w+B*f)*S,m[k+2]=(N+T*f)*S}else if(X==2)W=c[z+3],y=c[z],w=c[z+1],N=c[z+2],_=m[k+3],L=m[k],B=m[k+1],T=m[k+2],W==_&&y==L&&w==B&&N==T?(m[k]=0,m[k+1]=0,m[k+2]=0,m[k+3]=0):(m[k]=y,m[k+1]=w,m[k+2]=N,m[k+3]=W);else if(X==3){if(W=c[z+3],y=c[z],w=c[z+1],N=c[z+2],_=m[k+3],L=m[k],B=m[k+1],T=m[k+2],W==_&&y==L&&w==B&&N==T)continue;if(W<220&&_>20)return!1}return!0}return{decode:function(h){const l=new Uint8Array(h);let m=8;const A=P,O=A.readUshort,H=A.readUint,x={tabs:{},frames:[]},X=new Uint8Array(l.length);let j,M=0,z=0;const k=[137,80,78,71,13,10,26,10];for(var W=0;W<8;W++)if(l[W]!=k[W])throw"The input is not a PNG file!";for(;m<l.length;){const R=A.readUint(l,m);m+=4;const b=A.readASCII(l,m,4);if(m+=4,b=="IHDR")I(l,m,x);else if(b=="iCCP"){for(var y=m;l[y]!=0;)y++;A.readASCII(l,m,y-m),l[y+1];const f=l.slice(y+2,m+R);let q=null;try{q=E(f)}catch{q=o(f)}x.tabs[b]=q}else if(b=="CgBI")x.tabs[b]=l.slice(m,m+4);else if(b=="IDAT"){for(W=0;W<R;W++)X[M+W]=l[m+W];M+=R}else if(b=="acTL")x.tabs[b]={num_frames:H(l,m),num_plays:H(l,m+4)},j=new Uint8Array(l.length);else if(b=="fcTL"){z!=0&&((T=x.frames[x.frames.length-1]).data=J(x,j.slice(0,z),T.rect.width,T.rect.height),z=0);const f={x:H(l,m+12),y:H(l,m+16),width:H(l,m+4),height:H(l,m+8)};let q=O(l,m+22);q=O(l,m+20)/(q==0?100:q);const S={rect:f,delay:Math.round(1e3*q),dispose:l[m+24],blend:l[m+25]};x.frames.push(S)}else if(b=="fdAT"){for(W=0;W<R-4;W++)j[z+W]=l[m+W+4];z+=R-4}else if(b=="pHYs")x.tabs[b]=[A.readUint(l,m),A.readUint(l,m+4),l[m+8]];else if(b=="cHRM")for(x.tabs[b]=[],W=0;W<8;W++)x.tabs[b].push(A.readUint(l,m+4*W));else if(b=="tEXt"||b=="zTXt"){x.tabs[b]==null&&(x.tabs[b]={});var w=A.nextZero(l,m),N=A.readASCII(l,m,w-m),_=m+R-w-1;if(b=="tEXt")B=A.readASCII(l,w+1,_);else{var L=E(l.slice(w+2,w+2+_));B=A.readUTF8(L,0,L.length)}x.tabs[b][N]=B}else if(b=="iTXt"){x.tabs[b]==null&&(x.tabs[b]={}),w=0,y=m,w=A.nextZero(l,y),N=A.readASCII(l,y,w-y);const f=l[y=w+1];var B;l[y+1],y+=2,w=A.nextZero(l,y),A.readASCII(l,y,w-y),y=w+1,w=A.nextZero(l,y),A.readUTF8(l,y,w-y),_=R-((y=w+1)-m),f==0?B=A.readUTF8(l,y,_):(L=E(l.slice(y,y+_)),B=A.readUTF8(L,0,L.length)),x.tabs[b][N]=B}else if(b=="PLTE")x.tabs[b]=A.readBytes(l,m,R);else if(b=="hIST"){const f=x.tabs.PLTE.length/3;for(x.tabs[b]=[],W=0;W<f;W++)x.tabs[b].push(O(l,m+2*W))}else if(b=="tRNS")x.ctype==3?x.tabs[b]=A.readBytes(l,m,R):x.ctype==0?x.tabs[b]=O(l,m):x.ctype==2&&(x.tabs[b]=[O(l,m),O(l,m+2),O(l,m+4)]);else if(b=="gAMA")x.tabs[b]=A.readUint(l,m)/1e5;else if(b=="sRGB")x.tabs[b]=l[m];else if(b=="bKGD")x.ctype==0||x.ctype==4?x.tabs[b]=[O(l,m)]:x.ctype==2||x.ctype==6?x.tabs[b]=[O(l,m),O(l,m+2),O(l,m+4)]:x.ctype==3&&(x.tabs[b]=l[m]);else if(b=="IEND")break;m+=R,A.readUint(l,m),m+=4}var T;return z!=0&&((T=x.frames[x.frames.length-1]).data=J(x,j.slice(0,z),T.rect.width,T.rect.height)),x.data=J(x,X,x.width,x.height),delete x.compress,delete x.interlace,delete x.filter,x},toRGBA8:function(h){const l=h.width,m=h.height;if(h.tabs.acTL==null)return[Z(h.data,l,m,h).buffer];const A=[];h.frames[0].data==null&&(h.frames[0].data=h.data);const O=l*m*4,H=new Uint8Array(O),x=new Uint8Array(O),X=new Uint8Array(O);for(let M=0;M<h.frames.length;M++){const z=h.frames[M],k=z.rect.x,W=z.rect.y,y=z.rect.width,w=z.rect.height,N=Z(z.data,y,w,h);if(M!=0)for(var j=0;j<O;j++)X[j]=H[j];if(z.blend==0?U(N,y,w,H,l,m,k,W,0):z.blend==1&&U(N,y,w,H,l,m,k,W,1),A.push(H.buffer.slice(0)),z.dispose!=0){if(z.dispose==1)U(x,y,w,H,l,m,k,W,0);else if(z.dispose==2)for(j=0;j<O;j++)H[j]=X[j]}}return A},_paeth:p,_copyTile:U,_bin:P}}();(function(){const{_copyTile:P}=s,{_bin:Z}=s,J=s._paeth;var E={table:function(){const y=new Uint32Array(256);for(let w=0;w<256;w++){let N=w;for(let _=0;_<8;_++)1&N?N=3988292384^N>>>1:N>>>=1;y[w]=N}return y}(),update(y,w,N,_){for(let L=0;L<_;L++)y=E.table[255&(y^w[N+L])]^y>>>8;return y},crc:(y,w,N)=>4294967295^E.update(4294967295,y,w,N)};function o(y,w,N,_){w[N]+=y[0]*_>>4,w[N+1]+=y[1]*_>>4,w[N+2]+=y[2]*_>>4,w[N+3]+=y[3]*_>>4}function a(y){return Math.max(0,Math.min(255,y))}function C(y,w){const N=y[0]-w[0],_=y[1]-w[1],L=y[2]-w[2],B=y[3]-w[3];return N*N+_*_+L*L+B*B}function p(y,w,N,_,L,B,T){T==null&&(T=1);const R=_.length,b=[];for(var f=0;f<R;f++){const D=_[f];b.push([D>>>0&255,D>>>8&255,D>>>16&255,D>>>24&255])}for(f=0;f<R;f++){let D=4294967295;for(var q=0,S=0;S<R;S++){var K=C(b[f],b[S]);S!=f&&K<D&&(D=K,q=S)}}const se=new Uint32Array(L.buffer),Q=new Int16Array(w*N*4),re=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(f=0;f<re.length;f++)re[f]=255*((re[f]+.5)/16-.5);for(let D=0;D<N;D++)for(let ae=0;ae<w;ae++){var Y;f=4*(D*w+ae),T!=2?Y=[a(y[f]+Q[f]),a(y[f+1]+Q[f+1]),a(y[f+2]+Q[f+2]),a(y[f+3]+Q[f+3])]:(K=re[4*(3&D)+(3&ae)],Y=[a(y[f]+K),a(y[f+1]+K),a(y[f+2]+K),a(y[f+3]+K)]),q=0;let ge=16777215;for(S=0;S<R;S++){const Te=C(Y,b[S]);Te<ge&&(ge=Te,q=S)}const ke=b[q],ye=[Y[0]-ke[0],Y[1]-ke[1],Y[2]-ke[2],Y[3]-ke[3]];T==1&&(ae!=w-1&&o(ye,Q,f+4,7),D!=N-1&&(ae!=0&&o(ye,Q,f+4*w-4,3),o(ye,Q,f+4*w,5),ae!=w-1&&o(ye,Q,f+4*w+4,1))),B[f>>2]=q,se[f>>2]=_[q]}}function I(y,w,N,_,L){L==null&&(L={});const{crc:B}=E,T=Z.writeUint,R=Z.writeUshort,b=Z.writeASCII;let f=8;const q=y.frames.length>1;let S,K=!1,se=33+(q?20:0);if(L.sRGB!=null&&(se+=13),L.pHYs!=null&&(se+=21),L.iCCP!=null&&(S=pako.deflate(L.iCCP),se+=21+S.length+4),y.ctype==3){for(var Q=y.plte.length,re=0;re<Q;re++)y.plte[re]>>>24!=255&&(K=!0);se+=8+3*Q+4+(K?8+1*Q+4:0)}for(var Y=0;Y<y.frames.length;Y++)q&&(se+=38),se+=(ke=y.frames[Y]).cimg.length+12,Y!=0&&(se+=4);se+=12;const D=new Uint8Array(se),ae=[137,80,78,71,13,10,26,10];for(re=0;re<8;re++)D[re]=ae[re];if(T(D,f,13),f+=4,b(D,f,"IHDR"),f+=4,T(D,f,w),f+=4,T(D,f,N),f+=4,D[f]=y.depth,f++,D[f]=y.ctype,f++,D[f]=0,f++,D[f]=0,f++,D[f]=0,f++,T(D,f,B(D,f-17,17)),f+=4,L.sRGB!=null&&(T(D,f,1),f+=4,b(D,f,"sRGB"),f+=4,D[f]=L.sRGB,f++,T(D,f,B(D,f-5,5)),f+=4),L.iCCP!=null){const ye=13+S.length;T(D,f,ye),f+=4,b(D,f,"iCCP"),f+=4,b(D,f,"ICC profile"),f+=11,f+=2,D.set(S,f),f+=S.length,T(D,f,B(D,f-(ye+4),ye+4)),f+=4}if(L.pHYs!=null&&(T(D,f,9),f+=4,b(D,f,"pHYs"),f+=4,T(D,f,L.pHYs[0]),f+=4,T(D,f,L.pHYs[1]),f+=4,D[f]=L.pHYs[2],f++,T(D,f,B(D,f-13,13)),f+=4),q&&(T(D,f,8),f+=4,b(D,f,"acTL"),f+=4,T(D,f,y.frames.length),f+=4,T(D,f,L.loop!=null?L.loop:0),f+=4,T(D,f,B(D,f-12,12)),f+=4),y.ctype==3){for(T(D,f,3*(Q=y.plte.length)),f+=4,b(D,f,"PLTE"),f+=4,re=0;re<Q;re++){const ye=3*re,Te=y.plte[re],Pe=255&Te,Xe=Te>>>8&255,Yt=Te>>>16&255;D[f+ye+0]=Pe,D[f+ye+1]=Xe,D[f+ye+2]=Yt}if(f+=3*Q,T(D,f,B(D,f-3*Q-4,3*Q+4)),f+=4,K){for(T(D,f,Q),f+=4,b(D,f,"tRNS"),f+=4,re=0;re<Q;re++)D[f+re]=y.plte[re]>>>24&255;f+=Q,T(D,f,B(D,f-Q-4,Q+4)),f+=4}}let ge=0;for(Y=0;Y<y.frames.length;Y++){var ke=y.frames[Y];q&&(T(D,f,26),f+=4,b(D,f,"fcTL"),f+=4,T(D,f,ge++),f+=4,T(D,f,ke.rect.width),f+=4,T(D,f,ke.rect.height),f+=4,T(D,f,ke.rect.x),f+=4,T(D,f,ke.rect.y),f+=4,R(D,f,_[Y]),f+=2,R(D,f,1e3),f+=2,D[f]=ke.dispose,f++,D[f]=ke.blend,f++,T(D,f,B(D,f-30,30)),f+=4);const ye=ke.cimg;T(D,f,(Q=ye.length)+(Y==0?0:4)),f+=4;const Te=f;b(D,f,Y==0?"IDAT":"fdAT"),f+=4,Y!=0&&(T(D,f,ge++),f+=4),D.set(ye,f),f+=Q,T(D,f,B(D,Te,f-Te)),f+=4}return T(D,f,0),f+=4,b(D,f,"IEND"),f+=4,T(D,f,B(D,f-4,4)),f+=4,D.buffer}function U(y,w,N){for(let _=0;_<y.frames.length;_++){const L=y.frames[_];L.rect.width;const B=L.rect.height,T=new Uint8Array(B*L.bpl+B);L.cimg=m(L.img,B,L.bpp,L.bpl,T,w,N)}}function c(y,w,N,_,L){const B=L[0],T=L[1],R=L[2],b=L[3],f=L[4],q=L[5];let S=6,K=8,se=255;for(var Q=0;Q<y.length;Q++){const tt=new Uint8Array(y[Q]);for(var re=tt.length,Y=0;Y<re;Y+=4)se&=tt[Y+3]}const D=se!=255,ae=function(_e,Le,Ye,rt,je,at){const qe=[];for(var xe=0;xe<_e.length;xe++){const it=new Uint8Array(_e[xe]),Ct=new Uint32Array(it.buffer);var lt;let ut=0,Ot=0,Tt=Le,en=Ye,pr=rt?1:0;if(xe!=0){const $s=at||rt||xe==1||qe[xe-2].dispose!=0?1:2;let mr=0,ii=1e9;for(let xn=0;xn<$s;xn++){var qt=new Uint8Array(_e[xe-1-xn]);const Zs=new Uint32Array(_e[xe-1-xn]);let zt=Le,Kt=Ye,wn=-1,Un=-1;for(let tn=0;tn<Ye;tn++)for(let nn=0;nn<Le;nn++)Ct[nt=tn*Le+nn]!=Zs[nt]&&(nn<zt&&(zt=nn),nn>wn&&(wn=nn),tn<Kt&&(Kt=tn),tn>Un&&(Un=tn));wn==-1&&(zt=Kt=wn=Un=0),je&&((1&zt)==1&&zt--,(1&Kt)==1&&Kt--);const si=(wn-zt+1)*(Un-Kt+1);si<ii&&(ii=si,mr=xn,ut=zt,Ot=Kt,Tt=wn-zt+1,en=Un-Kt+1)}qt=new Uint8Array(_e[xe-1-mr]),mr==1&&(qe[xe-1].dispose=2),lt=new Uint8Array(Tt*en*4),P(qt,Le,Ye,lt,Tt,en,-ut,-Ot,0),pr=P(it,Le,Ye,lt,Tt,en,-ut,-Ot,3)?1:0,pr==1?l(it,Le,Ye,lt,{x:ut,y:Ot,width:Tt,height:en}):P(it,Le,Ye,lt,Tt,en,-ut,-Ot,0)}else lt=it.slice(0);qe.push({rect:{x:ut,y:Ot,width:Tt,height:en},img:lt,blend:pr,dispose:0})}if(rt)for(xe=0;xe<qe.length;xe++){if((Qt=qe[xe]).blend==1)continue;const it=Qt.rect,Ct=qe[xe-1].rect,ut=Math.min(it.x,Ct.x),Ot=Math.min(it.y,Ct.y),Tt={x:ut,y:Ot,width:Math.max(it.x+it.width,Ct.x+Ct.width)-ut,height:Math.max(it.y+it.height,Ct.y+Ct.height)-Ot};qe[xe-1].dispose=1,xe-1!=0&&h(_e,Le,Ye,qe,xe-1,Tt,je),h(_e,Le,Ye,qe,xe,Tt,je)}let Kn=0;if(_e.length!=1)for(var nt=0;nt<qe.length;nt++){var Qt;Kn+=(Qt=qe[nt]).rect.width*Qt.rect.height}return qe}(y,w,N,B,T,R),ge={},ke=[],ye=[];if(_!=0){const tt=[];for(Y=0;Y<ae.length;Y++)tt.push(ae[Y].img.buffer);const _e=function(je){let at=0;for(var qe=0;qe<je.length;qe++)at+=je[qe].byteLength;const xe=new Uint8Array(at);let lt=0;for(qe=0;qe<je.length;qe++){const qt=new Uint8Array(je[qe]),Kn=qt.length;for(let nt=0;nt<Kn;nt+=4){let Qt=qt[nt],it=qt[nt+1],Ct=qt[nt+2];const ut=qt[nt+3];ut==0&&(Qt=it=Ct=0),xe[lt+nt]=Qt,xe[lt+nt+1]=it,xe[lt+nt+2]=Ct,xe[lt+nt+3]=ut}lt+=Kn}return xe.buffer}(tt),Le=O(_e,_);for(Y=0;Y<Le.plte.length;Y++)ke.push(Le.plte[Y].est.rgba);let Ye=0;for(Y=0;Y<ae.length;Y++){const rt=(Pe=ae[Y]).img.length;var Te=new Uint8Array(Le.inds.buffer,Ye>>2,rt>>2);ye.push(Te);const je=new Uint8Array(Le.abuf,Ye,rt);q&&p(Pe.img,Pe.rect.width,Pe.rect.height,ke,je,Te),Pe.img.set(je),Ye+=rt}}else for(Q=0;Q<ae.length;Q++){var Pe=ae[Q];const tt=new Uint32Array(Pe.img.buffer);var Xe=Pe.rect.width;for(re=tt.length,Te=new Uint8Array(re),ye.push(Te),Y=0;Y<re;Y++){const _e=tt[Y];if(Y!=0&&_e==tt[Y-1])Te[Y]=Te[Y-1];else if(Y>Xe&&_e==tt[Y-Xe])Te[Y]=Te[Y-Xe];else{let Le=ge[_e];if(Le==null&&(ge[_e]=Le=ke.length,ke.push(_e),ke.length>=300))break;Te[Y]=Le}}}const Yt=ke.length;for(Yt<=256&&f==0&&(K=Yt<=2?1:Yt<=4?2:Yt<=16?4:8,K=Math.max(K,b)),Q=0;Q<ae.length;Q++){(Pe=ae[Q]).rect.x,Pe.rect.y,Xe=Pe.rect.width;const tt=Pe.rect.height;let _e=Pe.img;new Uint32Array(_e.buffer);let Le=4*Xe,Ye=4;if(Yt<=256&&f==0){Le=Math.ceil(K*Xe/8);var Nt=new Uint8Array(Le*tt);const rt=ye[Q];for(let je=0;je<tt;je++){Y=je*Le;const at=je*Xe;if(K==8)for(var De=0;De<Xe;De++)Nt[Y+De]=rt[at+De];else if(K==4)for(De=0;De<Xe;De++)Nt[Y+(De>>1)]|=rt[at+De]<<4-4*(1&De);else if(K==2)for(De=0;De<Xe;De++)Nt[Y+(De>>2)]|=rt[at+De]<<6-2*(3&De);else if(K==1)for(De=0;De<Xe;De++)Nt[Y+(De>>3)]|=rt[at+De]<<7-1*(7&De)}_e=Nt,S=3,Ye=1}else if(D==0&&ae.length==1){Nt=new Uint8Array(Xe*tt*3);const rt=Xe*tt;for(Y=0;Y<rt;Y++){const je=3*Y,at=4*Y;Nt[je]=_e[at],Nt[je+1]=_e[at+1],Nt[je+2]=_e[at+2]}_e=Nt,S=2,Ye=3,Le=3*Xe}Pe.img=_e,Pe.bpl=Le,Pe.bpp=Ye}return{ctype:S,depth:K,plte:ke,frames:ae}}function h(y,w,N,_,L,B,T){const R=Uint8Array,b=Uint32Array,f=new R(y[L-1]),q=new b(y[L-1]),S=L+1<y.length?new R(y[L+1]):null,K=new R(y[L]),se=new b(K.buffer);let Q=w,re=N,Y=-1,D=-1;for(let ge=0;ge<B.height;ge++)for(let ke=0;ke<B.width;ke++){const ye=B.x+ke,Te=B.y+ge,Pe=Te*w+ye,Xe=se[Pe];Xe==0||_[L-1].dispose==0&&q[Pe]==Xe&&(S==null||S[4*Pe+3]!=0)||(ye<Q&&(Q=ye),ye>Y&&(Y=ye),Te<re&&(re=Te),Te>D&&(D=Te))}Y==-1&&(Q=re=Y=D=0),T&&((1&Q)==1&&Q--,(1&re)==1&&re--),B={x:Q,y:re,width:Y-Q+1,height:D-re+1};const ae=_[L];ae.rect=B,ae.blend=1,ae.img=new Uint8Array(B.width*B.height*4),_[L-1].dispose==0?(P(f,w,N,ae.img,B.width,B.height,-B.x,-B.y,0),l(K,w,N,ae.img,B)):P(K,w,N,ae.img,B.width,B.height,-B.x,-B.y,0)}function l(y,w,N,_,L){P(y,w,N,_,L.width,L.height,-L.x,-L.y,2)}function m(y,w,N,_,L,B,T){const R=[];let b,f=[0,1,2,3,4];B!=-1?f=[B]:(w*_>5e5||N==1)&&(f=[0]),T&&(b={level:0});const q=i;for(var S=0;S<f.length;S++){for(let Q=0;Q<w;Q++)A(L,y,Q,_,N,f[S]);R.push(q.deflate(L,b))}let K,se=1e9;for(S=0;S<R.length;S++)R[S].length<se&&(K=S,se=R[S].length);return R[K]}function A(y,w,N,_,L,B){const T=N*_;let R=T+N;if(y[R]=B,R++,B==0)if(_<500)for(var b=0;b<_;b++)y[R+b]=w[T+b];else y.set(new Uint8Array(w.buffer,T,_),R);else if(B==1){for(b=0;b<L;b++)y[R+b]=w[T+b];for(b=L;b<_;b++)y[R+b]=w[T+b]-w[T+b-L]+256&255}else if(N==0){for(b=0;b<L;b++)y[R+b]=w[T+b];if(B==2)for(b=L;b<_;b++)y[R+b]=w[T+b];if(B==3)for(b=L;b<_;b++)y[R+b]=w[T+b]-(w[T+b-L]>>1)+256&255;if(B==4)for(b=L;b<_;b++)y[R+b]=w[T+b]-J(w[T+b-L],0,0)+256&255}else{if(B==2)for(b=0;b<_;b++)y[R+b]=w[T+b]+256-w[T+b-_]&255;if(B==3){for(b=0;b<L;b++)y[R+b]=w[T+b]+256-(w[T+b-_]>>1)&255;for(b=L;b<_;b++)y[R+b]=w[T+b]+256-(w[T+b-_]+w[T+b-L]>>1)&255}if(B==4){for(b=0;b<L;b++)y[R+b]=w[T+b]+256-J(0,w[T+b-_],0)&255;for(b=L;b<_;b++)y[R+b]=w[T+b]+256-J(w[T+b-L],w[T+b-_],w[T+b-L-_])&255}}}function O(y,w){const N=new Uint8Array(y),_=N.slice(0),L=new Uint32Array(_.buffer),B=H(_,w),T=B[0],R=B[1],b=N.length,f=new Uint8Array(b>>2);let q;if(N.length<2e7)for(var S=0;S<b;S+=4)q=x(T,K=N[S]*(1/255),se=N[S+1]*(1/255),Q=N[S+2]*(1/255),re=N[S+3]*(1/255)),f[S>>2]=q.ind,L[S>>2]=q.est.rgba;else for(S=0;S<b;S+=4){var K=N[S]*.00392156862745098,se=N[S+1]*(1/255),Q=N[S+2]*(1/255),re=N[S+3]*(1/255);for(q=T;q.left;)q=X(q.est,K,se,Q,re)<=0?q.left:q.right;f[S>>2]=q.ind,L[S>>2]=q.est.rgba}return{abuf:_.buffer,inds:f,plte:R}}function H(y,w,N){N==null&&(N=1e-4);const _=new Uint32Array(y.buffer),L={i0:0,i1:y.length,bst:null,est:null,tdst:0,left:null,right:null};L.bst=z(y,L.i0,L.i1),L.est=k(L.bst);const B=[L];for(;B.length<w;){let R=0,b=0;for(var T=0;T<B.length;T++)B[T].est.L>R&&(R=B[T].est.L,b=T);if(R<N)break;const f=B[b],q=j(y,_,f.i0,f.i1,f.est.e,f.est.eMq255);if(f.i0>=q||f.i1<=q){f.est.L=0;continue}const S={i0:f.i0,i1:q,bst:null,est:null,tdst:0,left:null,right:null};S.bst=z(y,S.i0,S.i1),S.est=k(S.bst);const K={i0:q,i1:f.i1,bst:null,est:null,tdst:0,left:null,right:null};for(K.bst={R:[],m:[],N:f.bst.N-S.bst.N},T=0;T<16;T++)K.bst.R[T]=f.bst.R[T]-S.bst.R[T];for(T=0;T<4;T++)K.bst.m[T]=f.bst.m[T]-S.bst.m[T];K.est=k(K.bst),f.left=S,f.right=K,B[b]=S,B.push(K)}for(B.sort((R,b)=>b.bst.N-R.bst.N),T=0;T<B.length;T++)B[T].ind=T;return[L,B]}function x(y,w,N,_,L){if(y.left==null)return y.tdst=function(S,K,se,Q,re){const Y=K-S[0],D=se-S[1],ae=Q-S[2],ge=re-S[3];return Y*Y+D*D+ae*ae+ge*ge}(y.est.q,w,N,_,L),y;const B=X(y.est,w,N,_,L);let T=y.left,R=y.right;B>0&&(T=y.right,R=y.left);const b=x(T,w,N,_,L);if(b.tdst<=B*B)return b;const f=x(R,w,N,_,L);return f.tdst<b.tdst?f:b}function X(y,w,N,_,L){const{e:B}=y;return B[0]*w+B[1]*N+B[2]*_+B[3]*L-y.eMq}function j(y,w,N,_,L,B){for(_-=4;N<_;){for(;M(y,N,L)<=B;)N+=4;for(;M(y,_,L)>B;)_-=4;if(N>=_)break;const T=w[N>>2];w[N>>2]=w[_>>2],w[_>>2]=T,N+=4,_-=4}for(;M(y,N,L)>B;)N-=4;return N+4}function M(y,w,N){return y[w]*N[0]+y[w+1]*N[1]+y[w+2]*N[2]+y[w+3]*N[3]}function z(y,w,N){const _=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],L=[0,0,0,0],B=N-w>>2;for(let T=w;T<N;T+=4){const R=y[T]*.00392156862745098,b=y[T+1]*(1/255),f=y[T+2]*(1/255),q=y[T+3]*(1/255);L[0]+=R,L[1]+=b,L[2]+=f,L[3]+=q,_[0]+=R*R,_[1]+=R*b,_[2]+=R*f,_[3]+=R*q,_[5]+=b*b,_[6]+=b*f,_[7]+=b*q,_[10]+=f*f,_[11]+=f*q,_[15]+=q*q}return _[4]=_[1],_[8]=_[2],_[9]=_[6],_[12]=_[3],_[13]=_[7],_[14]=_[11],{R:_,m:L,N:B}}function k(y){const{R:w}=y,{m:N}=y,{N:_}=y,L=N[0],B=N[1],T=N[2],R=N[3],b=_==0?0:1/_,f=[w[0]-L*L*b,w[1]-L*B*b,w[2]-L*T*b,w[3]-L*R*b,w[4]-B*L*b,w[5]-B*B*b,w[6]-B*T*b,w[7]-B*R*b,w[8]-T*L*b,w[9]-T*B*b,w[10]-T*T*b,w[11]-T*R*b,w[12]-R*L*b,w[13]-R*B*b,w[14]-R*T*b,w[15]-R*R*b],q=f,S=W;let K=[Math.random(),Math.random(),Math.random(),Math.random()],se=0,Q=0;if(_!=0)for(let Y=0;Y<16&&(K=S.multVec(q,K),Q=Math.sqrt(S.dot(K,K)),K=S.sml(1/Q,K),!(Y!=0&&Math.abs(Q-se)<1e-9));Y++)se=Q;const re=[L*b,B*b,T*b,R*b];return{Cov:f,q:re,e:K,L:se,eMq255:S.dot(S.sml(255,re),K),eMq:S.dot(K,re),rgba:(Math.round(255*re[3])<<24|Math.round(255*re[2])<<16|Math.round(255*re[1])<<8|Math.round(255*re[0])<<0)>>>0}}var W={multVec:(y,w)=>[y[0]*w[0]+y[1]*w[1]+y[2]*w[2]+y[3]*w[3],y[4]*w[0]+y[5]*w[1]+y[6]*w[2]+y[7]*w[3],y[8]*w[0]+y[9]*w[1]+y[10]*w[2]+y[11]*w[3],y[12]*w[0]+y[13]*w[1]+y[14]*w[2]+y[15]*w[3]],dot:(y,w)=>y[0]*w[0]+y[1]*w[1]+y[2]*w[2]+y[3]*w[3],sml:(y,w)=>[y*w[0],y*w[1],y*w[2],y*w[3]]};s.encode=function(w,N,_,L,B,T,R){L==null&&(L=0),R==null&&(R=!1);const b=c(w,N,_,L,[!1,!1,!1,0,R,!1]);return U(b,-1),I(b,N,_,B,T)},s.encodeLL=function(w,N,_,L,B,T,R,b){const f={ctype:0+(L==1?0:2)+(B==0?0:4),depth:T,frames:[]},q=(L+B)*T,S=q*N;for(let K=0;K<w.length;K++)f.frames.push({rect:{x:0,y:0,width:N,height:_},img:new Uint8Array(w[K]),blend:0,dispose:1,bpp:Math.ceil(q/8),bpl:Math.ceil(S/8)});return U(f,0,!0),I(f,N,_,R,b)},s.encode.compress=c,s.encode.dither=p,s.quantize=O,s.quantize.getKDtree=H,s.quantize.getNearest=x})();const d={toArrayBuffer(P,Z){const J=P.width,E=P.height,o=J<<2,a=P.getContext("2d").getImageData(0,0,J,E),C=new Uint32Array(a.data.buffer),p=(32*J+31)/32<<2,I=p*E,U=122+I,c=new ArrayBuffer(U),h=new DataView(c),l=1<<20;let m,A,O,H,x=l,X=0,j=0,M=0;function z(y){h.setUint16(j,y,!0),j+=2}function k(y){h.setUint32(j,y,!0),j+=4}function W(y){j+=y}z(19778),k(U),W(4),k(122),k(108),k(J),k(-E>>>0),z(1),z(32),k(3),k(I),k(2835),k(2835),W(8),k(16711680),k(65280),k(255),k(4278190080),k(1466527264),function y(){for(;X<E&&x>0;){for(H=122+X*p,m=0;m<o;)x--,A=C[M++],O=A>>>24,h.setUint32(H+m,A<<8|O),m+=4;X++}M<C.length?(x=l,setTimeout(y,d._dly)):Z(c)}()},toBlob(P,Z){this.toArrayBuffer(P,J=>{Z(new Blob([J],{type:"image/bmp"}))})},_dly:9};var u={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},g={[u.CHROME]:16384,[u.FIREFOX]:11180,[u.DESKTOP_SAFARI]:16384,[u.IE]:8192,[u.IOS]:4096,[u.ETC]:8192};const v=typeof window<"u",V=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,ne=v&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),ie=(v||V)&&(ne&&ne.getOriginalSymbol(window,"File")||typeof File<"u"&&File),he=(v||V)&&(ne&&ne.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function we(P,Z,J=Date.now()){return new Promise(E=>{const o=P.split(","),a=o[0].match(/:(.*?);/)[1],C=globalThis.atob(o[1]);let p=C.length;const I=new Uint8Array(p);for(;p--;)I[p]=C.charCodeAt(p);const U=new Blob([I],{type:a});U.name=Z,U.lastModified=J,E(U)})}function Ue(P){return new Promise((Z,J)=>{const E=new he;E.onload=()=>Z(E.result),E.onerror=o=>J(o),E.readAsDataURL(P)})}function me(P){return new Promise((Z,J)=>{const E=new Image;E.onload=()=>Z(E),E.onerror=o=>J(o),E.src=P})}function be(){if(be.cachedResult!==void 0)return be.cachedResult;let P=u.ETC;const{userAgent:Z}=navigator;return/Chrom(e|ium)/i.test(Z)?P=u.CHROME:/iP(ad|od|hone)/i.test(Z)&&/WebKit/i.test(Z)?P=u.IOS:/Safari/i.test(Z)?P=u.DESKTOP_SAFARI:/Firefox/i.test(Z)?P=u.FIREFOX:(/MSIE/i.test(Z)||document.documentMode)&&(P=u.IE),be.cachedResult=P,be.cachedResult}function Se(P,Z){const J=be(),E=g[J];let o=P,a=Z,C=o*a;const p=o>a?a/o:o/a;for(;C>E*E;){const I=(E+o)/2,U=(E+a)/2;I<U?(a=U,o=U*p):(a=I*p,o=I),C=o*a}return{width:o,height:a}}function et(P,Z){let J,E;try{if(J=new OffscreenCanvas(P,Z),E=J.getContext("2d"),E===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{J=document.createElement("canvas"),E=J.getContext("2d")}return J.width=P,J.height=Z,[J,E]}function de(P,Z){const{width:J,height:E}=Se(P.width,P.height),[o,a]=et(J,E);return Z&&/jpe?g/.test(Z)&&(a.fillStyle="white",a.fillRect(0,0,o.width,o.height)),a.drawImage(P,0,0,o.width,o.height),o}function oe(){return oe.cachedResult!==void 0||(oe.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),oe.cachedResult}function Fe(P,Z={}){return new Promise(function(J,E){let o,a;var C=function(){try{return a=de(o,Z.fileType||P.type),J([o,a])}catch(I){return E(I)}},p=function(I){try{var U=function(c){try{throw c}catch(h){return E(h)}};try{let c;return Ue(P).then(function(h){try{return c=h,me(c).then(function(l){try{return o=l,function(){try{return C()}catch(m){return E(m)}}()}catch(m){return U(m)}},U)}catch(l){return U(l)}},U)}catch(c){U(c)}}catch(c){return E(c)}};try{if(oe()||[u.DESKTOP_SAFARI,u.MOBILE_SAFARI].includes(be()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(P).then(function(I){try{return o=I,C()}catch{return p()}},p)}catch{p()}})}function Ze(P,Z,J,E,o=1){return new Promise(function(a,C){let p;if(Z==="image/png"){let U,c,h;return U=P.getContext("2d"),{data:c}=U.getImageData(0,0,P.width,P.height),h=s.encode([c.buffer],P.width,P.height,4096*o),p=new Blob([h],{type:Z}),p.name=J,p.lastModified=E,I.call(this)}{let U=function(){return I.call(this)};if(Z==="image/bmp")return new Promise(c=>d.toBlob(P,c)).then((function(c){try{return p=c,p.name=J,p.lastModified=E,U.call(this)}catch(h){return C(h)}}).bind(this),C);{let c=function(){return U.call(this)};if(typeof OffscreenCanvas=="function"&&P instanceof OffscreenCanvas)return P.convertToBlob({type:Z,quality:o}).then((function(h){try{return p=h,p.name=J,p.lastModified=E,c.call(this)}catch(l){return C(l)}}).bind(this),C);{let h;return h=P.toDataURL(Z,o),we(h,J,E).then((function(l){try{return p=l,c.call(this)}catch(m){return C(m)}}).bind(this),C)}}}function I(){return a(p)}})}function Re(P){P.width=0,P.height=0}function jt(){return new Promise(function(P,Z){let J,E,o,a;return jt.cachedResult!==void 0?P(jt.cachedResult):we("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then(function(C){try{return J=C,Fe(J).then(function(p){try{return E=p[1],Ze(E,J.type,J.name,J.lastModified).then(function(I){try{return o=I,Re(E),Fe(o).then(function(U){try{return a=U[0],jt.cachedResult=a.width===1&&a.height===2,P(jt.cachedResult)}catch(c){return Z(c)}},Z)}catch(U){return Z(U)}},Z)}catch(I){return Z(I)}},Z)}catch(p){return Z(p)}},Z)})}function jn(P){return new Promise((Z,J)=>{const E=new he;E.onload=o=>{const a=new DataView(o.target.result);if(a.getUint16(0,!1)!=65496)return Z(-2);const C=a.byteLength;let p=2;for(;p<C;){if(a.getUint16(p+2,!1)<=8)return Z(-1);const I=a.getUint16(p,!1);if(p+=2,I==65505){if(a.getUint32(p+=2,!1)!=1165519206)return Z(-1);const U=a.getUint16(p+=6,!1)==18761;p+=a.getUint32(p+4,U);const c=a.getUint16(p,U);p+=2;for(let h=0;h<c;h++)if(a.getUint16(p+12*h,U)==274)return Z(a.getUint16(p+12*h+8,U))}else{if((65280&I)!=65280)break;p+=a.getUint16(p,!1)}}return Z(-1)},E.onerror=o=>J(o),E.readAsArrayBuffer(P)})}function Nn(P,Z){const{width:J}=P,{height:E}=P,{maxWidthOrHeight:o}=Z;let a,C=P;return isFinite(o)&&(J>o||E>o)&&([C,a]=et(J,E),J>E?(C.width=o,C.height=E/J*o):(C.width=J/E*o,C.height=o),a.drawImage(P,0,0,C.width,C.height),Re(P)),C}function Tn(P,Z){const{width:J}=P,{height:E}=P,[o,a]=et(J,E);switch(Z>4&&Z<9?(o.width=E,o.height=J):(o.width=J,o.height=E),Z){case 2:a.transform(-1,0,0,1,J,0);break;case 3:a.transform(-1,0,0,-1,J,E);break;case 4:a.transform(1,0,0,-1,0,E);break;case 5:a.transform(0,1,1,0,0,0);break;case 6:a.transform(0,1,-1,0,E,0);break;case 7:a.transform(0,-1,-1,0,E,J);break;case 8:a.transform(0,-1,1,0,0,J)}return a.drawImage(P,0,0,J,E),Re(P),o}function Ln(P,Z,J=0){return new Promise(function(E,o){let a,C,p,I,U,c,h,l,m,A,O,H,x,X,j,M,z,k,W,y;function w(_=5){if(Z.signal&&Z.signal.aborted)throw Z.signal.reason;a+=_,Z.onProgress(Math.min(a,100))}function N(_){if(Z.signal&&Z.signal.aborted)throw Z.signal.reason;a=Math.min(Math.max(_,a),100),Z.onProgress(a)}return a=J,C=Z.maxIteration||10,p=1024*Z.maxSizeMB*1024,w(),Fe(P,Z).then((function(_){try{return[,I]=_,w(),U=Nn(I,Z),w(),new Promise(function(L,B){var T;if(!(T=Z.exifOrientation))return jn(P).then((function(b){try{return T=b,R.call(this)}catch(f){return B(f)}}).bind(this),B);function R(){return L(T)}return R.call(this)}).then((function(L){try{return c=L,w(),jt().then((function(B){try{return h=B?U:Tn(U,c),w(),l=Z.initialQuality||1,m=Z.fileType||P.type,Ze(h,m,P.name,P.lastModified,l).then((function(T){try{{let b=function(){if(C--&&(j>p||j>x)){let q,S;return q=y?.95*W.width:W.width,S=y?.95*W.height:W.height,[z,k]=et(q,S),k.drawImage(W,0,0,q,S),l*=m==="image/png"?.85:.95,Ze(z,m,P.name,P.lastModified,l).then(function(K){try{return M=K,Re(W),W=z,j=M.size,N(Math.min(99,Math.floor((X-j)/(X-p)*100))),b}catch(se){return o(se)}},o)}return[1]},f=function(){return Re(W),Re(z),Re(U),Re(h),Re(I),N(100),E(M)};if(A=T,w(),O=A.size>p,H=A.size>P.size,!O&&!H)return N(100),E(A);var R;return x=P.size,X=A.size,j=X,W=h,y=!Z.alwaysKeepResolution&&O,(R=(function(q){for(;q;){if(q.then)return void q.then(R,o);try{if(q.pop){if(q.length)return q.pop()?f.call(this):q;q=b}else q=q.call(this)}catch(S){return o(S)}}}).bind(this))(b)}}catch(b){return o(b)}}).bind(this),o)}catch(T){return o(T)}}).bind(this),o)}catch(B){return o(B)}}).bind(this),o)}catch(L){return o(L)}}).bind(this),o)})}const qn=`
2
+ (function(ne,le){typeof exports=="object"&&typeof module<"u"?module.exports=le():typeof define=="function"&&define.amd?define(le):(ne=typeof globalThis<"u"?globalThis:ne||self,ne.ImageSalonSdk=le())})(this,function(){"use strict";var zs=Object.defineProperty;var ei=ne=>{throw TypeError(ne)};var Xs=(ne,le,he)=>le in ne?zs(ne,le,{enumerable:!0,configurable:!0,writable:!0,value:he}):ne[le]=he;var pe=(ne,le,he)=>Xs(ne,typeof le!="symbol"?le+"":le,he),ti=(ne,le,he)=>le.has(ne)||ei("Cannot "+he);var E=(ne,le,he)=>(ti(ne,le,"read from private field"),he?he.call(ne):le.get(ne)),z=(ne,le,he)=>le.has(ne)?ei("Cannot add the same private member more than once"):le instanceof WeakSet?le.add(ne):le.set(ne,he),H=(ne,le,he,Ot)=>(ti(ne,le,"write to private field"),Ot?Ot.call(ne,he):le.set(ne,he),he);var gt,et,Pt,At,Ae,ke,wt,we,Ie,tt,je,Dt,kt,ot,nt,Ft,Wt,Qn,Nt,It,yt,Mt,at,lt,Tt,Lt,bt,jt,on,Se,Ct,an,Un,ln,ct,qt,Ut,xt,Zt,Kt,zt,Xt,cn,dn,Gt,dt,Jt;function ne(s){let e=typeof s;if(e=="object"){if(Array.isArray(s))return"array";if(s===null)return"null"}return e}function le(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}let he="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Ot=[];for(let s=0;s<he.length;s++)Ot[he[s].charCodeAt(0)]=s;Ot[45]=he.indexOf("+"),Ot[95]=he.indexOf("/");function Yn(s){let e=s.length*3/4;s[s.length-2]=="="?e-=2:s[s.length-1]=="="&&(e-=1);let t=new Uint8Array(e),n=0,r=0,i,o=0;for(let a=0;a<s.length;a++){if(i=Ot[s.charCodeAt(a)],i===void 0)switch(s[a]){case"=":r=0;case`
3
+ `:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(r){case 0:o=i,r=1;break;case 1:t[n++]=o<<2|(i&48)>>4,o=i,r=2;break;case 2:t[n++]=(o&15)<<4|(i&60)>>2,o=i,r=3;break;case 3:t[n++]=(o&3)<<6|i,r=0;break}}if(r==1)throw Error("invalid base64 string.");return t.subarray(0,n)}function er(s){let e="",t=0,n,r=0;for(let i=0;i<s.length;i++)switch(n=s[i],t){case 0:e+=he[n>>2],r=(n&3)<<4,t=1;break;case 1:e+=he[r|n>>4],r=(n&15)<<2,t=2;break;case 2:e+=he[r|n>>6],e+=he[n&63],t=0;break}return t&&(e+=he[r],e+="=",t==1&&(e+="=")),e}var G;(function(s){s.symbol=Symbol.for("protobuf-ts/unknown"),s.onRead=(t,n,r,i,o)=>{(e(n)?n[s.symbol]:n[s.symbol]=[]).push({no:r,wireType:i,data:o})},s.onWrite=(t,n,r)=>{for(let{no:i,wireType:o,data:a}of s.list(n))r.tag(i,o).raw(a)},s.list=(t,n)=>{if(e(t)){let r=t[s.symbol];return n?r.filter(i=>i.no==n):r}return[]},s.last=(t,n)=>s.list(t,n).slice(-1)[0];const e=t=>t&&Array.isArray(t[s.symbol])})(G||(G={}));function ni(s,e){return Object.assign(Object.assign({},s),e)}var j;(function(s){s[s.Varint=0]="Varint",s[s.Bit64=1]="Bit64",s[s.LengthDelimited=2]="LengthDelimited",s[s.StartGroup=3]="StartGroup",s[s.EndGroup=4]="EndGroup",s[s.Bit32=5]="Bit32"})(j||(j={}));function ri(){let s=0,e=0;for(let n=0;n<28;n+=7){let r=this.buf[this.pos++];if(s|=(r&127)<<n,!(r&128))return this.assertBounds(),[s,e]}let t=this.buf[this.pos++];if(s|=(t&15)<<28,e=(t&112)>>4,!(t&128))return this.assertBounds(),[s,e];for(let n=3;n<=31;n+=7){let r=this.buf[this.pos++];if(e|=(r&127)<<n,!(r&128))return this.assertBounds(),[s,e]}throw new Error("invalid varint")}function _n(s,e,t){for(let i=0;i<28;i=i+7){const o=s>>>i,a=!(!(o>>>7)&&e==0),c=(a?o|128:o)&255;if(t.push(c),!a)return}const n=s>>>28&15|(e&7)<<4,r=!!(e>>3);if(t.push((r?n|128:n)&255),!!r){for(let i=3;i<31;i=i+7){const o=e>>>i,a=!!(o>>>7),c=(a?o|128:o)&255;if(t.push(c),!a)return}t.push(e>>>31&1)}}const un=65536*65536;function tr(s){let e=s[0]=="-";e&&(s=s.slice(1));const t=1e6;let n=0,r=0;function i(o,a){const c=Number(s.slice(o,a));r*=t,n=n*t+c,n>=un&&(r=r+(n/un|0),n=n%un)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),[e,n,r]}function Bn(s,e){if(e>>>0<=2097151)return""+(un*e+(s>>>0));let t=s&16777215,n=(s>>>24|e<<8)>>>0&16777215,r=e>>16&65535,i=t+n*6777216+r*6710656,o=n+r*8147497,a=r*2,c=1e7;i>=c&&(o+=Math.floor(i/c),i%=c),o>=c&&(a+=Math.floor(o/c),o%=c);function d(l,u){let h=l?String(l):"";return u?"0000000".slice(h.length)+h:h}return d(a,0)+d(o,a)+d(i,1)}function nr(s,e){if(s>=0){for(;s>127;)e.push(s&127|128),s=s>>>7;e.push(s)}else{for(let t=0;t<9;t++)e.push(s&127|128),s=s>>7;e.push(1)}}function ii(){let s=this.buf[this.pos++],e=s&127;if(!(s&128))return this.assertBounds(),e;if(s=this.buf[this.pos++],e|=(s&127)<<7,!(s&128))return this.assertBounds(),e;if(s=this.buf[this.pos++],e|=(s&127)<<14,!(s&128))return this.assertBounds(),e;if(s=this.buf[this.pos++],e|=(s&127)<<21,!(s&128))return this.assertBounds(),e;s=this.buf[this.pos++],e|=(s&15)<<28;for(let t=5;s&128&&t<10;t++)s=this.buf[this.pos++];if(s&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}let ie;function si(){const s=new DataView(new ArrayBuffer(8));ie=globalThis.BigInt!==void 0&&typeof s.getBigInt64=="function"&&typeof s.getBigUint64=="function"&&typeof s.setBigInt64=="function"&&typeof s.setBigUint64=="function"?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:s}:void 0}si();function rr(s){if(!s)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}const ir=/^-?[0-9]+$/,fn=4294967296,pn=2147483648;class sr{constructor(e,t){this.lo=e|0,this.hi=t|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*fn+(this.lo>>>0);if(!Number.isSafeInteger(e))throw new Error("cannot convert to safe number");return e}}class Be extends sr{static from(e){if(ie)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=ie.C(e);case"number":if(e===0)return this.ZERO;e=ie.C(e);case"bigint":if(!e)return this.ZERO;if(e<ie.UMIN)throw new Error("signed value for ulong");if(e>ie.UMAX)throw new Error("ulong too large");return ie.V.setBigUint64(0,e,!0),new Be(ie.V.getInt32(0,!0),ie.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!ir.test(e))throw new Error("string is no integer");let[t,n,r]=tr(e);if(t)throw new Error("signed value for ulong");return new Be(n,r);case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");if(e<0)throw new Error("signed value for ulong");return new Be(e,e/fn)}throw new Error("unknown value "+typeof e)}toString(){return ie?this.toBigInt().toString():Bn(this.lo,this.hi)}toBigInt(){return rr(ie),ie.V.setInt32(0,this.lo,!0),ie.V.setInt32(4,this.hi,!0),ie.V.getBigUint64(0,!0)}}Be.ZERO=new Be(0,0);class Ce extends sr{static from(e){if(ie)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=ie.C(e);case"number":if(e===0)return this.ZERO;e=ie.C(e);case"bigint":if(!e)return this.ZERO;if(e<ie.MIN)throw new Error("signed long too small");if(e>ie.MAX)throw new Error("signed long too large");return ie.V.setBigInt64(0,e,!0),new Ce(ie.V.getInt32(0,!0),ie.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!ir.test(e))throw new Error("string is no integer");let[t,n,r]=tr(e);if(t){if(r>pn||r==pn&&n!=0)throw new Error("signed long too small")}else if(r>=pn)throw new Error("signed long too large");let i=new Ce(n,r);return t?i.negate():i;case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");return e>0?new Ce(e,e/fn):new Ce(-e,-e/fn).negate()}throw new Error("unknown value "+typeof e)}isNegative(){return(this.hi&pn)!==0}negate(){let e=~this.hi,t=this.lo;return t?t=~t+1:e+=1,new Ce(t,e)}toString(){if(ie)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return"-"+Bn(e.lo,e.hi)}return Bn(this.lo,this.hi)}toBigInt(){return rr(ie),ie.V.setInt32(0,this.lo,!0),ie.V.setInt32(4,this.hi,!0),ie.V.getBigInt64(0,!0)}}Ce.ZERO=new Ce(0,0);const or={readUnknownField:!0,readerFactory:s=>new ai(s)};function oi(s){return s?Object.assign(Object.assign({},or),s):or}class ai{constructor(e,t){this.varint64=ri,this.uint32=ii,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t??new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw new Error("illegal tag: field no "+t+" wire type "+n);return[t,n]}skip(e){let t=this.pos;switch(e){case j.Varint:for(;this.buf[this.pos++]&128;);break;case j.Bit64:this.pos+=4;case j.Bit32:this.pos+=4;break;case j.LengthDelimited:let n=this.uint32();this.pos+=n;break;case j.StartGroup:let r;for(;(r=this.tag()[1])!==j.EndGroup;)this.skip(r);break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(t,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return new Ce(...this.varint64())}uint64(){return new Be(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,new Ce(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return new Be(this.sfixed32(),this.sfixed32())}sfixed64(){return new Ce(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}}function J(s,e){if(!s)throw new Error(e)}const li=34028234663852886e22,ci=-34028234663852886e22,di=4294967295,hi=2147483647,ui=-2147483648;function tn(s){if(typeof s!="number")throw new Error("invalid int 32: "+typeof s);if(!Number.isInteger(s)||s>hi||s<ui)throw new Error("invalid int 32: "+s)}function mn(s){if(typeof s!="number")throw new Error("invalid uint 32: "+typeof s);if(!Number.isInteger(s)||s>di||s<0)throw new Error("invalid uint 32: "+s)}function On(s){if(typeof s!="number")throw new Error("invalid float 32: "+typeof s);if(Number.isFinite(s)&&(s>li||s<ci))throw new Error("invalid float 32: "+s)}const ar={writeUnknownFields:!0,writerFactory:()=>new pi};function fi(s){return s?Object.assign(Object.assign({},ar),s):ar}class pi{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let r=0;r<this.chunks.length;r++)e+=this.chunks[r].length;let t=new Uint8Array(e),n=0;for(let r=0;r<this.chunks.length;r++)t.set(this.chunks[r],n),n+=this.chunks[r].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(mn(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return tn(e),nr(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){On(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){mn(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){tn(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return tn(e),e=(e<<1^e>>31)>>>0,nr(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=Ce.from(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=Be.from(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=Ce.from(e);return _n(t.lo,t.hi,this.buf),this}sint64(e){let t=Ce.from(e),n=t.hi>>31,r=t.lo<<1^n,i=(t.hi<<1|t.lo>>>31)^n;return _n(r,i,this.buf),this}uint64(e){let t=Be.from(e);return _n(t.lo,t.hi,this.buf),this}}const lr={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},cr={ignoreUnknownFields:!1};function mi(s){return s?Object.assign(Object.assign({},cr),s):cr}function gi(s){return s?Object.assign(Object.assign({},lr),s):lr}function wi(s,e){var t,n;let r=Object.assign(Object.assign({},s),e);return r.typeRegistry=[...(t=s==null?void 0:s.typeRegistry)!==null&&t!==void 0?t:[],...(n=e==null?void 0:e.typeRegistry)!==null&&n!==void 0?n:[]],r}const dr=Symbol.for("protobuf-ts/message-type");function Sn(s){let e=!1;const t=[];for(let n=0;n<s.length;n++){let r=s.charAt(n);r=="_"?e=!0:/\d/.test(r)?(t.push(r),e=!0):e?(t.push(r.toUpperCase()),e=!1):n==0?t.push(r.toLowerCase()):t.push(r)}return t.join("")}var D;(function(s){s[s.DOUBLE=1]="DOUBLE",s[s.FLOAT=2]="FLOAT",s[s.INT64=3]="INT64",s[s.UINT64=4]="UINT64",s[s.INT32=5]="INT32",s[s.FIXED64=6]="FIXED64",s[s.FIXED32=7]="FIXED32",s[s.BOOL=8]="BOOL",s[s.STRING=9]="STRING",s[s.BYTES=12]="BYTES",s[s.UINT32=13]="UINT32",s[s.SFIXED32=15]="SFIXED32",s[s.SFIXED64=16]="SFIXED64",s[s.SINT32=17]="SINT32",s[s.SINT64=18]="SINT64"})(D||(D={}));var it;(function(s){s[s.BIGINT=0]="BIGINT",s[s.STRING=1]="STRING",s[s.NUMBER=2]="NUMBER"})(it||(it={}));var gn;(function(s){s[s.NO=0]="NO",s[s.PACKED=1]="PACKED",s[s.UNPACKED=2]="UNPACKED"})(gn||(gn={}));function yi(s){var e,t,n,r;return s.localName=(e=s.localName)!==null&&e!==void 0?e:Sn(s.name),s.jsonName=(t=s.jsonName)!==null&&t!==void 0?t:Sn(s.name),s.repeat=(n=s.repeat)!==null&&n!==void 0?n:gn.NO,s.opt=(r=s.opt)!==null&&r!==void 0?r:s.repeat||s.oneof?!1:s.kind=="message",s}function bi(s){if(typeof s!="object"||s===null||!s.hasOwnProperty("oneofKind"))return!1;switch(typeof s.oneofKind){case"string":return s[s.oneofKind]===void 0?!1:Object.keys(s).length==2;case"undefined":return Object.keys(s).length==1;default:return!1}}class Ci{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}prepare(){if(this.data)return;const e=[],t=[],n=[];for(let r of this.fields)if(r.oneof)n.includes(r.oneof)||(n.push(r.oneof),e.push(r.oneof),t.push(r.oneof));else switch(t.push(r.localName),r.kind){case"scalar":case"enum":(!r.opt||r.repeat)&&e.push(r.localName);break;case"message":r.repeat&&e.push(r.localName);break;case"map":e.push(r.localName);break}this.data={req:e,known:t,oneofs:Object.values(n)}}is(e,t,n=!1){if(t<0)return!0;if(e==null||typeof e!="object")return!1;this.prepare();let r=Object.keys(e),i=this.data;if(r.length<i.req.length||i.req.some(o=>!r.includes(o))||!n&&r.some(o=>!i.known.includes(o)))return!1;if(t<1)return!0;for(const o of i.oneofs){const a=e[o];if(!bi(a))return!1;if(a.oneofKind===void 0)continue;const c=this.fields.find(d=>d.localName===a.oneofKind);if(!c||!this.field(a[a.oneofKind],c,n,t))return!1}for(const o of this.fields)if(o.oneof===void 0&&!this.field(e[o.localName],o,n,t))return!1;return!0}field(e,t,n,r){let i=t.repeat;switch(t.kind){case"scalar":return e===void 0?t.opt:i?this.scalars(e,t.T,r,t.L):this.scalar(e,t.T,t.L);case"enum":return e===void 0?t.opt:i?this.scalars(e,D.INT32,r):this.scalar(e,D.INT32);case"message":return e===void 0?!0:i?this.messages(e,t.T(),n,r):this.message(e,t.T(),n,r);case"map":if(typeof e!="object"||e===null)return!1;if(r<2)return!0;if(!this.mapKeys(e,t.K,r))return!1;switch(t.V.kind){case"scalar":return this.scalars(Object.values(e),t.V.T,r,t.V.L);case"enum":return this.scalars(Object.values(e),D.INT32,r);case"message":return this.messages(Object.values(e),t.V.T(),n,r)}break}return!0}message(e,t,n,r){return n?t.isAssignable(e,r):t.is(e,r)}messages(e,t,n,r){if(!Array.isArray(e))return!1;if(r<2)return!0;if(n){for(let i=0;i<e.length&&i<r;i++)if(!t.isAssignable(e[i],r-1))return!1}else for(let i=0;i<e.length&&i<r;i++)if(!t.is(e[i],r-1))return!1;return!0}scalar(e,t,n){let r=typeof e;switch(t){case D.UINT64:case D.FIXED64:case D.INT64:case D.SFIXED64:case D.SINT64:switch(n){case it.BIGINT:return r=="bigint";case it.NUMBER:return r=="number"&&!isNaN(e);default:return r=="string"}case D.BOOL:return r=="boolean";case D.STRING:return r=="string";case D.BYTES:return e instanceof Uint8Array;case D.DOUBLE:case D.FLOAT:return r=="number"&&!isNaN(e);default:return r=="number"&&Number.isInteger(e)}}scalars(e,t,n,r){if(!Array.isArray(e))return!1;if(n<2)return!0;if(Array.isArray(e)){for(let i=0;i<e.length&&i<n;i++)if(!this.scalar(e[i],t,r))return!1}return!0}mapKeys(e,t,n){let r=Object.keys(e);switch(t){case D.INT32:case D.FIXED32:case D.SFIXED32:case D.SINT32:case D.UINT32:return this.scalars(r.slice(0,n).map(i=>parseInt(i)),t,n);case D.BOOL:return this.scalars(r.slice(0,n).map(i=>i=="true"?!0:i=="false"?!1:i),t,n);default:return this.scalars(r,t,n,it.STRING)}}}function Xe(s,e){switch(e){case it.BIGINT:return s.toBigInt();case it.NUMBER:return s.toNumber();default:return s.toString()}}class Ei{constructor(e){this.info=e}prepare(){var e;if(this.fMap===void 0){this.fMap={};const t=(e=this.info.fields)!==null&&e!==void 0?e:[];for(const n of t)this.fMap[n.name]=n,this.fMap[n.jsonName]=n,this.fMap[n.localName]=n}}assert(e,t,n){if(!e){let r=ne(n);throw(r=="number"||r=="boolean")&&(r=n.toString()),new Error(`Cannot parse JSON ${r} for ${this.info.typeName}#${t}`)}}read(e,t,n){this.prepare();const r=[];for(const[i,o]of Object.entries(e)){const a=this.fMap[i];if(!a){if(!n.ignoreUnknownFields)throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${i}`);continue}const c=a.localName;let d;if(a.oneof){if(o===null&&(a.kind!=="enum"||a.T()[0]!=="google.protobuf.NullValue"))continue;if(r.includes(a.oneof))throw new Error(`Multiple members of the oneof group "${a.oneof}" of ${this.info.typeName} are present in JSON.`);r.push(a.oneof),d=t[a.oneof]={oneofKind:c}}else d=t;if(a.kind=="map"){if(o===null)continue;this.assert(le(o),a.name,o);const l=d[c];for(const[u,h]of Object.entries(o)){this.assert(h!==null,a.name+" map value",null);let f;switch(a.V.kind){case"message":f=a.V.T().internalJsonRead(h,n);break;case"enum":if(f=this.enum(a.V.T(),h,a.name,n.ignoreUnknownFields),f===!1)continue;break;case"scalar":f=this.scalar(h,a.V.T,a.V.L,a.name);break}this.assert(f!==void 0,a.name+" map value",h);let y=u;a.K==D.BOOL&&(y=y=="true"?!0:y=="false"?!1:y),y=this.scalar(y,a.K,it.STRING,a.name).toString(),l[y]=f}}else if(a.repeat){if(o===null)continue;this.assert(Array.isArray(o),a.name,o);const l=d[c];for(const u of o){this.assert(u!==null,a.name,null);let h;switch(a.kind){case"message":h=a.T().internalJsonRead(u,n);break;case"enum":if(h=this.enum(a.T(),u,a.name,n.ignoreUnknownFields),h===!1)continue;break;case"scalar":h=this.scalar(u,a.T,a.L,a.name);break}this.assert(h!==void 0,a.name,o),l.push(h)}}else switch(a.kind){case"message":if(o===null&&a.T().typeName!="google.protobuf.Value"){this.assert(a.oneof===void 0,a.name+" (oneof member)",null);continue}d[c]=a.T().internalJsonRead(o,n,d[c]);break;case"enum":let l=this.enum(a.T(),o,a.name,n.ignoreUnknownFields);if(l===!1)continue;d[c]=l;break;case"scalar":d[c]=this.scalar(o,a.T,a.L,a.name);break}}}enum(e,t,n,r){if(e[0]=="google.protobuf.NullValue"&&J(t===null||t==="NULL_VALUE",`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} only accepts null.`),t===null)return 0;switch(typeof t){case"number":return J(Number.isInteger(t),`Unable to parse field ${this.info.typeName}#${n}, enum can only be integral number, got ${t}.`),t;case"string":let i=t;e[2]&&t.substring(0,e[2].length)===e[2]&&(i=t.substring(e[2].length));let o=e[1][i];return typeof o>"u"&&r?!1:(J(typeof o=="number",`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} has no value for "${t}".`),o)}J(!1,`Unable to parse field ${this.info.typeName}#${n}, cannot parse enum value from ${typeof t}".`)}scalar(e,t,n,r){let i;try{switch(t){case D.DOUBLE:case D.FLOAT:if(e===null)return 0;if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""){i="empty string";break}if(typeof e=="string"&&e.trim().length!==e.length){i="extra whitespace";break}if(typeof e!="string"&&typeof e!="number")break;let o=Number(e);if(Number.isNaN(o)){i="not a number";break}if(!Number.isFinite(o)){i="too large or small";break}return t==D.FLOAT&&On(o),o;case D.INT32:case D.FIXED32:case D.SFIXED32:case D.SINT32:case D.UINT32:if(e===null)return 0;let a;if(typeof e=="number"?a=e:e===""?i="empty string":typeof e=="string"&&(e.trim().length!==e.length?i="extra whitespace":a=Number(e)),a===void 0)break;return t==D.UINT32?mn(a):tn(a),a;case D.INT64:case D.SFIXED64:case D.SINT64:if(e===null)return Xe(Ce.ZERO,n);if(typeof e!="number"&&typeof e!="string")break;return Xe(Ce.from(e),n);case D.FIXED64:case D.UINT64:if(e===null)return Xe(Be.ZERO,n);if(typeof e!="number"&&typeof e!="string")break;return Xe(Be.from(e),n);case D.BOOL:if(e===null)return!1;if(typeof e!="boolean")break;return e;case D.STRING:if(e===null)return"";if(typeof e!="string"){i="extra whitespace";break}try{encodeURIComponent(e)}catch(c){c="invalid UTF8";break}return e;case D.BYTES:if(e===null||e==="")return new Uint8Array(0);if(typeof e!="string")break;return Yn(e)}}catch(o){i=o.message}this.assert(!1,r+(i?" - "+i:""),e)}}class vi{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}write(e,t){const n={},r=e;for(const i of this.fields){if(!i.oneof){let d=this.field(i,r[i.localName],t);d!==void 0&&(n[t.useProtoFieldName?i.name:i.jsonName]=d);continue}const o=r[i.oneof];if(o.oneofKind!==i.localName)continue;const a=i.kind=="scalar"||i.kind=="enum"?Object.assign(Object.assign({},t),{emitDefaultValues:!0}):t;let c=this.field(i,o[i.localName],a);J(c!==void 0),n[t.useProtoFieldName?i.name:i.jsonName]=c}return n}field(e,t,n){let r;if(e.kind=="map"){J(typeof t=="object"&&t!==null);const i={};switch(e.V.kind){case"scalar":for(const[c,d]of Object.entries(t)){const l=this.scalar(e.V.T,d,e.name,!1,!0);J(l!==void 0),i[c.toString()]=l}break;case"message":const o=e.V.T();for(const[c,d]of Object.entries(t)){const l=this.message(o,d,e.name,n);J(l!==void 0),i[c.toString()]=l}break;case"enum":const a=e.V.T();for(const[c,d]of Object.entries(t)){J(d===void 0||typeof d=="number");const l=this.enum(a,d,e.name,!1,!0,n.enumAsInteger);J(l!==void 0),i[c.toString()]=l}break}(n.emitDefaultValues||Object.keys(i).length>0)&&(r=i)}else if(e.repeat){J(Array.isArray(t));const i=[];switch(e.kind){case"scalar":for(let c=0;c<t.length;c++){const d=this.scalar(e.T,t[c],e.name,e.opt,!0);J(d!==void 0),i.push(d)}break;case"enum":const o=e.T();for(let c=0;c<t.length;c++){J(t[c]===void 0||typeof t[c]=="number");const d=this.enum(o,t[c],e.name,e.opt,!0,n.enumAsInteger);J(d!==void 0),i.push(d)}break;case"message":const a=e.T();for(let c=0;c<t.length;c++){const d=this.message(a,t[c],e.name,n);J(d!==void 0),i.push(d)}break}(n.emitDefaultValues||i.length>0||n.emitDefaultValues)&&(r=i)}else switch(e.kind){case"scalar":r=this.scalar(e.T,t,e.name,e.opt,n.emitDefaultValues);break;case"enum":r=this.enum(e.T(),t,e.name,e.opt,n.emitDefaultValues,n.enumAsInteger);break;case"message":r=this.message(e.T(),t,e.name,n);break}return r}enum(e,t,n,r,i,o){if(e[0]=="google.protobuf.NullValue")return!i&&!r?void 0:null;if(t===void 0){J(r);return}if(!(t===0&&!i&&!r))return J(typeof t=="number"),J(Number.isInteger(t)),o||!e[1].hasOwnProperty(t)?t:e[2]?e[2]+e[1][t]:e[1][t]}message(e,t,n,r){return t===void 0?r.emitDefaultValues?null:void 0:e.internalJsonWrite(t,r)}scalar(e,t,n,r,i){if(t===void 0){J(r);return}const o=i||r;switch(e){case D.INT32:case D.SFIXED32:case D.SINT32:return t===0?o?0:void 0:(tn(t),t);case D.FIXED32:case D.UINT32:return t===0?o?0:void 0:(mn(t),t);case D.FLOAT:On(t);case D.DOUBLE:return t===0?o?0:void 0:(J(typeof t=="number"),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t);case D.STRING:return t===""?o?"":void 0:(J(typeof t=="string"),t);case D.BOOL:return t===!1?o?!1:void 0:(J(typeof t=="boolean"),t);case D.UINT64:case D.FIXED64:J(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let a=Be.from(t);return a.isZero()&&!o?void 0:a.toString();case D.INT64:case D.SFIXED64:case D.SINT64:J(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let c=Ce.from(t);return c.isZero()&&!o?void 0:c.toString();case D.BYTES:return J(t instanceof Uint8Array),t.byteLength?er(t):o?"":void 0}}}function Rn(s,e=it.STRING){switch(s){case D.BOOL:return!1;case D.UINT64:case D.FIXED64:return Xe(Be.ZERO,e);case D.INT64:case D.SFIXED64:case D.SINT64:return Xe(Ce.ZERO,e);case D.DOUBLE:case D.FLOAT:return 0;case D.BYTES:return new Uint8Array(0);case D.STRING:return"";default:return 0}}class Ai{constructor(e){this.info=e}prepare(){var e;if(!this.fieldNoToField){const t=(e=this.info.fields)!==null&&e!==void 0?e:[];this.fieldNoToField=new Map(t.map(n=>[n.no,n]))}}read(e,t,n,r){this.prepare();const i=r===void 0?e.len:e.pos+r;for(;e.pos<i;){const[o,a]=e.tag(),c=this.fieldNoToField.get(o);if(!c){let h=n.readUnknownField;if(h=="throw")throw new Error(`Unknown field ${o} (wire type ${a}) for ${this.info.typeName}`);let f=e.skip(a);h!==!1&&(h===!0?G.onRead:h)(this.info.typeName,t,o,a,f);continue}let d=t,l=c.repeat,u=c.localName;switch(c.oneof&&(d=d[c.oneof],d.oneofKind!==u&&(d=t[c.oneof]={oneofKind:u})),c.kind){case"scalar":case"enum":let h=c.kind=="enum"?D.INT32:c.T,f=c.kind=="scalar"?c.L:void 0;if(l){let T=d[u];if(a==j.LengthDelimited&&h!=D.STRING&&h!=D.BYTES){let C=e.uint32()+e.pos;for(;e.pos<C;)T.push(this.scalar(e,h,f))}else T.push(this.scalar(e,h,f))}else d[u]=this.scalar(e,h,f);break;case"message":if(l){let T=d[u],C=c.T().internalBinaryRead(e,e.uint32(),n);T.push(C)}else d[u]=c.T().internalBinaryRead(e,e.uint32(),n,d[u]);break;case"map":let[y,k]=this.mapEntry(c,e,n);d[u][y]=k;break}}}mapEntry(e,t,n){let r=t.uint32(),i=t.pos+r,o,a;for(;t.pos<i;){let[c,d]=t.tag();switch(c){case 1:e.K==D.BOOL?o=t.bool().toString():o=this.scalar(t,e.K,it.STRING);break;case 2:switch(e.V.kind){case"scalar":a=this.scalar(t,e.V.T,e.V.L);break;case"enum":a=t.int32();break;case"message":a=e.V.T().internalBinaryRead(t,t.uint32(),n);break}break;default:throw new Error(`Unknown field ${c} (wire type ${d}) in map entry for ${this.info.typeName}#${e.name}`)}}if(o===void 0){let c=Rn(e.K);o=e.K==D.BOOL?c.toString():c}if(a===void 0)switch(e.V.kind){case"scalar":a=Rn(e.V.T,e.V.L);break;case"enum":a=0;break;case"message":a=e.V.T().create();break}return[o,a]}scalar(e,t,n){switch(t){case D.INT32:return e.int32();case D.STRING:return e.string();case D.BOOL:return e.bool();case D.DOUBLE:return e.double();case D.FLOAT:return e.float();case D.INT64:return Xe(e.int64(),n);case D.UINT64:return Xe(e.uint64(),n);case D.FIXED64:return Xe(e.fixed64(),n);case D.FIXED32:return e.fixed32();case D.BYTES:return e.bytes();case D.UINT32:return e.uint32();case D.SFIXED32:return e.sfixed32();case D.SFIXED64:return Xe(e.sfixed64(),n);case D.SINT32:return e.sint32();case D.SINT64:return Xe(e.sint64(),n)}}}class ki{constructor(e){this.info=e}prepare(){if(!this.fields){const e=this.info.fields?this.info.fields.concat():[];this.fields=e.sort((t,n)=>t.no-n.no)}}write(e,t,n){this.prepare();for(const i of this.fields){let o,a,c=i.repeat,d=i.localName;if(i.oneof){const l=e[i.oneof];if(l.oneofKind!==d)continue;o=l[d],a=!0}else o=e[d],a=!1;switch(i.kind){case"scalar":case"enum":let l=i.kind=="enum"?D.INT32:i.T;if(c)if(J(Array.isArray(o)),c==gn.PACKED)this.packed(t,l,i.no,o);else for(const u of o)this.scalar(t,l,i.no,u,!0);else o===void 0?J(i.opt):this.scalar(t,l,i.no,o,a||i.opt);break;case"message":if(c){J(Array.isArray(o));for(const u of o)this.message(t,n,i.T(),i.no,u)}else this.message(t,n,i.T(),i.no,o);break;case"map":J(typeof o=="object"&&o!==null);for(const[u,h]of Object.entries(o))this.mapEntry(t,n,i,u,h);break}}let r=n.writeUnknownFields;r!==!1&&(r===!0?G.onWrite:r)(this.info.typeName,e,t)}mapEntry(e,t,n,r,i){e.tag(n.no,j.LengthDelimited),e.fork();let o=r;switch(n.K){case D.INT32:case D.FIXED32:case D.UINT32:case D.SFIXED32:case D.SINT32:o=Number.parseInt(r);break;case D.BOOL:J(r=="true"||r=="false"),o=r=="true";break}switch(this.scalar(e,n.K,1,o,!0),n.V.kind){case"scalar":this.scalar(e,n.V.T,2,i,!0);break;case"enum":this.scalar(e,D.INT32,2,i,!0);break;case"message":this.message(e,t,n.V.T(),2,i);break}e.join()}message(e,t,n,r,i){i!==void 0&&(n.internalBinaryWrite(i,e.tag(r,j.LengthDelimited).fork(),t),e.join())}scalar(e,t,n,r,i){let[o,a,c]=this.scalarInfo(t,r);(!c||i)&&(e.tag(n,o),e[a](r))}packed(e,t,n,r){if(!r.length)return;J(t!==D.BYTES&&t!==D.STRING),e.tag(n,j.LengthDelimited),e.fork();let[,i]=this.scalarInfo(t);for(let o=0;o<r.length;o++)e[i](r[o]);e.join()}scalarInfo(e,t){let n=j.Varint,r,i=t===void 0,o=t===0;switch(e){case D.INT32:r="int32";break;case D.STRING:o=i||!t.length,n=j.LengthDelimited,r="string";break;case D.BOOL:o=t===!1,r="bool";break;case D.UINT32:r="uint32";break;case D.DOUBLE:n=j.Bit64,r="double";break;case D.FLOAT:n=j.Bit32,r="float";break;case D.INT64:o=i||Ce.from(t).isZero(),r="int64";break;case D.UINT64:o=i||Be.from(t).isZero(),r="uint64";break;case D.FIXED64:o=i||Be.from(t).isZero(),n=j.Bit64,r="fixed64";break;case D.BYTES:o=i||!t.byteLength,n=j.LengthDelimited,r="bytes";break;case D.FIXED32:n=j.Bit32,r="fixed32";break;case D.SFIXED32:n=j.Bit32,r="sfixed32";break;case D.SFIXED64:o=i||Ce.from(t).isZero(),n=j.Bit64,r="sfixed64";break;case D.SINT32:r="sint32";break;case D.SINT64:o=i||Ce.from(t).isZero(),r="sint64";break}return[n,r,i||o]}}function Fi(s){const e=s.messagePrototype?Object.create(s.messagePrototype):Object.defineProperty({},dr,{value:s});for(let t of s.fields){let n=t.localName;if(!t.opt)if(t.oneof)e[t.oneof]={oneofKind:void 0};else if(t.repeat)e[n]=[];else switch(t.kind){case"scalar":e[n]=Rn(t.T,t.L);break;case"enum":e[n]=0;break;case"map":e[n]={};break}}return e}function Ee(s,e,t){let n,r=t,i;for(let o of s.fields){let a=o.localName;if(o.oneof){const c=r[o.oneof];if((c==null?void 0:c.oneofKind)==null)continue;if(n=c[a],i=e[o.oneof],i.oneofKind=c.oneofKind,n==null){delete i[a];continue}}else if(n=r[a],i=e,n==null)continue;switch(o.repeat&&(i[a].length=n.length),o.kind){case"scalar":case"enum":if(o.repeat)for(let d=0;d<n.length;d++)i[a][d]=n[d];else i[a]=n;break;case"message":let c=o.T();if(o.repeat)for(let d=0;d<n.length;d++)i[a][d]=c.create(n[d]);else i[a]===void 0?i[a]=c.create(n):c.mergePartial(i[a],n);break;case"map":switch(o.V.kind){case"scalar":case"enum":Object.assign(i[a],n);break;case"message":let d=o.V.T();for(let l of Object.keys(n))i[a][l]=d.create(n[l]);break}break}}}function Ni(s,e,t){if(e===t)return!0;if(!e||!t)return!1;for(let n of s.fields){let r=n.localName,i=n.oneof?e[n.oneof][r]:e[r],o=n.oneof?t[n.oneof][r]:t[r];switch(n.kind){case"enum":case"scalar":let a=n.kind=="enum"?D.INT32:n.T;if(!(n.repeat?ur(a,i,o):hr(a,i,o)))return!1;break;case"map":if(!(n.V.kind=="message"?fr(n.V.T(),wn(i),wn(o)):ur(n.V.kind=="enum"?D.INT32:n.V.T,wn(i),wn(o))))return!1;break;case"message":let c=n.T();if(!(n.repeat?fr(c,i,o):c.equals(i,o)))return!1;break}}return!0}const wn=Object.values;function hr(s,e,t){if(e===t)return!0;if(s!==D.BYTES)return!1;let n=e,r=t;if(n.length!==r.length)return!1;for(let i=0;i<n.length;i++)if(n[i]!=r[i])return!1;return!0}function ur(s,e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!hr(s,e[n],t[n]))return!1;return!0}function fr(s,e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!s.equals(e[n],t[n]))return!1;return!0}const Ii=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({}));class Te{constructor(e,t,n){this.defaultCheckDepth=16,this.typeName=e,this.fields=t.map(yi),this.options=n??{},this.messagePrototype=Object.create(null,Object.assign(Object.assign({},Ii),{[dr]:{value:this}})),this.refTypeCheck=new Ci(this),this.refJsonReader=new Ei(this),this.refJsonWriter=new vi(this),this.refBinReader=new Ai(this),this.refBinWriter=new ki(this)}create(e){let t=Fi(this);return e!==void 0&&Ee(this,t,e),t}clone(e){let t=this.create();return Ee(this,t,e),t}equals(e,t){return Ni(this,e,t)}is(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!1)}isAssignable(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!0)}mergePartial(e,t){Ee(this,e,t)}fromBinary(e,t){let n=oi(t);return this.internalBinaryRead(n.readerFactory(e),e.byteLength,n)}fromJson(e,t){return this.internalJsonRead(e,mi(t))}fromJsonString(e,t){let n=JSON.parse(e);return this.fromJson(n,t)}toJson(e,t){return this.internalJsonWrite(e,gi(t))}toJsonString(e,t){var n;let r=this.toJson(e,t);return JSON.stringify(r,null,(n=t==null?void 0:t.prettySpaces)!==null&&n!==void 0?n:0)}toBinary(e,t){let n=fi(t);return this.internalBinaryWrite(e,n.writerFactory(),n).finish()}internalJsonRead(e,t,n){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){let r=n??this.create();return this.refJsonReader.read(e,r,t),r}throw new Error(`Unable to parse message ${this.typeName} from JSON ${ne(e)}.`)}internalJsonWrite(e,t){return this.refJsonWriter.write(e,t)}internalBinaryWrite(e,t,n){return this.refBinWriter.write(e,t,n),t}internalBinaryRead(e,t,n,r){let i=r??this.create();return this.refBinReader.read(e,i,n,t),i}}function Ti(s,e){var t,n,r;let i=s;return i.service=e,i.localName=(t=i.localName)!==null&&t!==void 0?t:Sn(i.name),i.serverStreaming=!!i.serverStreaming,i.clientStreaming=!!i.clientStreaming,i.options=(n=i.options)!==null&&n!==void 0?n:{},i.idempotency=(r=i.idempotency)!==null&&r!==void 0?r:void 0,i}class Dn{constructor(e,t,n){this.typeName=e,this.methods=t.map(r=>Ti(r,this)),this.options=n??{}}}class se extends Error{constructor(e,t="UNKNOWN",n){super(e),this.name="RpcError",Object.setPrototypeOf(this,new.target.prototype),this.code=t,this.meta=n??{}}toString(){const e=[this.name+": "+this.message];this.code&&(e.push(""),e.push("Code: "+this.code)),this.serviceName&&this.methodName&&e.push("Method: "+this.serviceName+"/"+this.methodName);let t=Object.entries(this.meta);if(t.length){e.push(""),e.push("Meta:");for(let[n,r]of t)e.push(` ${n}: ${r}`)}return e.join(`
4
+ `)}}function Li(s,e){if(!e)return s;let t={};yn(s,t),yn(e,t);for(let n of Object.keys(e)){let r=e[n];switch(n){case"jsonOptions":t.jsonOptions=wi(s.jsonOptions,t.jsonOptions);break;case"binaryOptions":t.binaryOptions=ni(s.binaryOptions,t.binaryOptions);break;case"meta":t.meta={},yn(s.meta,t.meta),yn(e.meta,t.meta);break;case"interceptors":t.interceptors=s.interceptors?s.interceptors.concat(r):r.concat();break}}return t}function yn(s,e){if(!s)return;let t=e;for(let[n,r]of Object.entries(s))r instanceof Date?t[n]=new Date(r.getTime()):Array.isArray(r)?t[n]=r.concat():t[n]=r}var qe;(function(s){s[s.PENDING=0]="PENDING",s[s.REJECTED=1]="REJECTED",s[s.RESOLVED=2]="RESOLVED"})(qe||(qe={}));class vt{constructor(e=!0){this._state=qe.PENDING,this._promise=new Promise((t,n)=>{this._resolve=t,this._reject=n}),e&&this._promise.catch(t=>{})}get state(){return this._state}get promise(){return this._promise}resolve(e){if(this.state!==qe.PENDING)throw new Error(`cannot resolve ${qe[this.state].toLowerCase()}`);this._resolve(e),this._state=qe.RESOLVED}reject(e){if(this.state!==qe.PENDING)throw new Error(`cannot reject ${qe[this.state].toLowerCase()}`);this._reject(e),this._state=qe.REJECTED}resolvePending(e){this._state===qe.PENDING&&this.resolve(e)}rejectPending(e){this._state===qe.PENDING&&this.reject(e)}}class Ui{constructor(){this._lis={nxt:[],msg:[],err:[],cmp:[]},this._closed=!1}onNext(e){return this.addLis(e,this._lis.nxt)}onMessage(e){return this.addLis(e,this._lis.msg)}onError(e){return this.addLis(e,this._lis.err)}onComplete(e){return this.addLis(e,this._lis.cmp)}addLis(e,t){return t.push(e),()=>{let n=t.indexOf(e);n>=0&&t.splice(n,1)}}clearLis(){for(let e of Object.values(this._lis))e.splice(0,e.length)}get closed(){return this._closed!==!1}notifyNext(e,t,n){J((e?1:0)+(t?1:0)+(n?1:0)<=1,"only one emission at a time"),e&&this.notifyMessage(e),t&&this.notifyError(t),n&&this.notifyComplete()}notifyMessage(e){J(!this.closed,"stream is closed"),this.pushIt({value:e,done:!1}),this._lis.msg.forEach(t=>t(e)),this._lis.nxt.forEach(t=>t(e,void 0,!1))}notifyError(e){J(!this.closed,"stream is closed"),this._closed=e,this.pushIt(e),this._lis.err.forEach(t=>t(e)),this._lis.nxt.forEach(t=>t(void 0,e,!1)),this.clearLis()}notifyComplete(){J(!this.closed,"stream is closed"),this._closed=!0,this.pushIt({value:null,done:!0}),this._lis.cmp.forEach(e=>e()),this._lis.nxt.forEach(e=>e(void 0,void 0,!0)),this.clearLis()}[Symbol.asyncIterator](){return this._itState||(this._itState={q:[]}),this._closed===!0?this.pushIt({value:null,done:!0}):this._closed!==!1&&this.pushIt(this._closed),{next:()=>{let e=this._itState;J(e,"bad state"),J(!e.p,"iterator contract broken");let t=e.q.shift();return t?"value"in t?Promise.resolve(t):Promise.reject(t):(e.p=new vt,e.p.promise)}}}pushIt(e){let t=this._itState;if(t)if(t.p){const n=t.p;J(n.state==qe.PENDING,"iterator contract broken"),"value"in e?n.resolve(e):n.reject(e),delete t.p}else t.q.push(e)}}var xi=function(s,e,t,n){function r(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(l){try{d(n.next(l))}catch(u){o(u)}}function c(l){try{d(n.throw(l))}catch(u){o(u)}}function d(l){l.done?i(l.value):r(l.value).then(a,c)}d((n=n.apply(s,e||[])).next())})};class _i{constructor(e,t,n,r,i,o,a){this.method=e,this.requestHeaders=t,this.request=n,this.headers=r,this.response=i,this.status=o,this.trailers=a}then(e,t){return this.promiseFinished().then(n=>e?Promise.resolve(e(n)):n,n=>t?Promise.resolve(t(n)):Promise.reject(n))}promiseFinished(){return xi(this,void 0,void 0,function*(){let[e,t,n,r]=yield Promise.all([this.headers,this.response,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,request:this.request,headers:e,response:t,status:n,trailers:r}})}}var Bi=function(s,e,t,n){function r(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(l){try{d(n.next(l))}catch(u){o(u)}}function c(l){try{d(n.throw(l))}catch(u){o(u)}}function d(l){l.done?i(l.value):r(l.value).then(a,c)}d((n=n.apply(s,e||[])).next())})};class Oi{constructor(e,t,n,r,i,o,a){this.method=e,this.requestHeaders=t,this.request=n,this.headers=r,this.responses=i,this.status=o,this.trailers=a}then(e,t){return this.promiseFinished().then(n=>e?Promise.resolve(e(n)):n,n=>t?Promise.resolve(t(n)):Promise.reject(n))}promiseFinished(){return Bi(this,void 0,void 0,function*(){let[e,t,n]=yield Promise.all([this.headers,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,request:this.request,headers:e,status:t,trailers:n}})}}function Pe(s,e,t,n,r){var i;{let o=(a,c,d)=>e.unary(a,c,d);for(const a of((i=n.interceptors)!==null&&i!==void 0?i:[]).filter(c=>c.interceptUnary).reverse()){const c=o;o=(d,l,u)=>a.interceptUnary(c,d,l,u)}return o(t,r,n)}}var W;(function(s){s[s.OK=0]="OK",s[s.CANCELLED=1]="CANCELLED",s[s.UNKNOWN=2]="UNKNOWN",s[s.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",s[s.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",s[s.NOT_FOUND=5]="NOT_FOUND",s[s.ALREADY_EXISTS=6]="ALREADY_EXISTS",s[s.PERMISSION_DENIED=7]="PERMISSION_DENIED",s[s.UNAUTHENTICATED=16]="UNAUTHENTICATED",s[s.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",s[s.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",s[s.ABORTED=10]="ABORTED",s[s.OUT_OF_RANGE=11]="OUT_OF_RANGE",s[s.UNIMPLEMENTED=12]="UNIMPLEMENTED",s[s.INTERNAL=13]="INTERNAL",s[s.UNAVAILABLE=14]="UNAVAILABLE",s[s.DATA_LOSS=15]="DATA_LOSS"})(W||(W={}));var Si=function(s,e,t,n){function r(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(l){try{d(n.next(l))}catch(u){o(u)}}function c(l){try{d(n.throw(l))}catch(u){o(u)}}function d(l){l.done?i(l.value):r(l.value).then(a,c)}d((n=n.apply(s,e||[])).next())})};function pr(s,e,t,n,r){if(n)for(let[i,o]of Object.entries(n))if(typeof o=="string")s.append(i,o);else for(let a of o)s.append(i,a);if(s.set("Content-Type",e==="text"?"application/grpc-web-text":"application/grpc-web+proto"),e=="text"&&s.set("Accept","application/grpc-web-text"),s.set("X-Grpc-Web","1"),typeof t=="number"){if(t<=0)throw new se(`timeout ${t} ms exceeded`,W[W.DEADLINE_EXCEEDED]);s.set("grpc-timeout",`${t}m`)}else if(t){const i=t.getTime(),o=Date.now();if(i<=o)throw new se(`deadline ${t} exceeded`,W[W.DEADLINE_EXCEEDED]);s.set("grpc-timeout",`${i-o}m`)}return s}function mr(s,e){let t=new Uint8Array(5+s.length);t[0]=Ge.DATA;for(let n=s.length,r=4;r>0;r--)t[r]=n%256,n>>>=8;return t.set(s,5),e==="binary"?t:er(t)}function Mn(s,e,t){if(arguments.length===1){let c=s,d;try{d=c.type}catch{}switch(d){case"error":case"opaque":case"opaqueredirect":throw new se(`fetch response type ${c.type}`,W[W.UNKNOWN])}return Mn(Vi(c.headers),c.status,c.statusText)}let n=s,r=e>=200&&e<300,i=Cr(n),[o,a]=br(n);return(o===void 0||o===W.OK)&&!r&&(o=Hi(e),a=t),[o,a,i]}function gr(s){let e=Mi(s),[t,n]=br(e),r=Cr(e);return[t??W.OK,n,r]}var Ge;(function(s){s[s.DATA=0]="DATA",s[s.TRAILER=128]="TRAILER"})(Ge||(Ge={}));function wr(s,e,t){return Si(this,void 0,void 0,function*(){let n,r="",i=new Uint8Array(0),o=Di(e);if(Ri(s)){let a=s.getReader();n={next:()=>a.read()}}else n=s[Symbol.asyncIterator]();for(;;){let a=yield n.next();if(a.value!==void 0){if(o==="text"){for(let d=0;d<a.value.length;d++)r+=String.fromCharCode(a.value[d]);let c=r.length-r.length%4;if(c===0)continue;i=yr(i,Yn(r.substring(0,c))),r=r.substring(c)}else i=yr(i,a.value);for(;i.length>=5&&i[0]===Ge.DATA;){let c=0;for(let d=1;d<5;d++)c=(c<<8)+i[d];if(i.length-5>=c)t(Ge.DATA,i.subarray(5,5+c)),i=i.subarray(5+c);else break}}if(a.done){if(i.length===0)break;if(i[0]!==Ge.TRAILER||i.length<5)throw new se("premature EOF",W[W.DATA_LOSS]);t(Ge.TRAILER,i.subarray(5));break}}})}const Ri=s=>typeof s.getReader=="function";function yr(s,e){let t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function Di(s){switch(s){case"application/grpc-web-text":case"application/grpc-web-text+proto":return"text";case"application/grpc-web":case"application/grpc-web+proto":return"binary";case void 0:case null:throw new se("missing response content type",W[W.INTERNAL]);default:throw new se("unexpected response content type: "+s,W[W.INTERNAL])}}function br(s){let e,t,n=s["grpc-message"];if(n!==void 0){if(Array.isArray(n))return[W.INTERNAL,"invalid grpc-web message"];t=n}let r=s["grpc-status"];if(r!==void 0){if(Array.isArray(r))return[W.INTERNAL,"invalid grpc-web status"];if(e=parseInt(r,10),W[e]===void 0)return[W.INTERNAL,"invalid grpc-web status"]}return[e,t]}function Cr(s){let e={};for(let[t,n]of Object.entries(s))switch(t){case"grpc-message":case"grpc-status":case"content-type":break;default:e[t]=n}return e}function Mi(s){let e={};for(let t of String.fromCharCode.apply(String,s).trim().split(`\r
5
+ `)){if(t=="")continue;let[n,...r]=t.split(":");const i=r.join(":").trim();n=n.trim();let o=e[n];typeof o=="string"?e[n]=[o,i]:Array.isArray(o)?o.push(i):e[n]=i}return e}function Vi(s){let e={};return s.forEach((t,n)=>{let r=e[n];typeof r=="string"?e[n]=[r,t]:Array.isArray(r)?r.push(t):e[n]=t}),e}function Hi(s){switch(s){case 200:return W.OK;case 400:return W.INVALID_ARGUMENT;case 401:return W.UNAUTHENTICATED;case 403:return W.PERMISSION_DENIED;case 404:return W.NOT_FOUND;case 409:return W.ABORTED;case 412:return W.FAILED_PRECONDITION;case 429:return W.RESOURCE_EXHAUSTED;case 499:return W.CANCELLED;case 500:return W.UNKNOWN;case 501:return W.UNIMPLEMENTED;case 503:return W.UNAVAILABLE;case 504:return W.DEADLINE_EXCEEDED;default:return W.UNKNOWN}}class $i{constructor(e){this.defaultOptions=e}mergeOptions(e){return Li(this.defaultOptions,e)}makeUrl(e,t){let n=t.baseUrl;return n.endsWith("/")&&(n=n.substring(0,n.length-1)),`${n}/${e.service.typeName}/${e.name}`}clientStreaming(e){const t=new se("Client streaming is not supported by grpc-web",W[W.UNIMPLEMENTED]);throw t.methodName=e.name,t.serviceName=e.service.typeName,t}duplex(e){const t=new se("Duplex streaming is not supported by grpc-web",W[W.UNIMPLEMENTED]);throw t.methodName=e.name,t.serviceName=e.service.typeName,t}serverStreaming(e,t,n){var r,i,o,a;let c=n,d=(r=c.format)!==null&&r!==void 0?r:"text",l=(i=c.fetchInit)!==null&&i!==void 0?i:{},u=this.makeUrl(e,c),h=e.I.toBinary(t,c.binaryOptions),f=new vt,y=new Ui,k=!0,T,C=new vt,R,O=new vt;return globalThis.fetch(u,Object.assign(Object.assign({},l),{method:"POST",headers:pr(new globalThis.Headers,d,c.timeout,c.meta),body:mr(h,d),signal:(o=n.abort)!==null&&o!==void 0?o:null})).then(F=>{let[U,b,B]=Mn(F);if(f.resolve(B),U!=null&&U!==W.OK)throw new se(b??W[U],W[U],B);return U!=null&&(T={code:W[U],detail:b??W[U]}),F}).then(F=>{if(!F.body)throw new se("missing response body",W[W.INTERNAL]);return wr(F.body,F.headers.get("content-type"),(U,b)=>{switch(U){case Ge.DATA:y.notifyMessage(e.O.fromBinary(b,c.binaryOptions)),k=!1;break;case Ge.TRAILER:let B,m;[B,m,R]=gr(b),T={code:W[B],detail:m??W[B]};break}})}).then(()=>{if(!R&&!k)throw new se("missing trailers",W[W.DATA_LOSS]);if(!T)throw new se("missing status",W[W.INTERNAL]);if(T.code!=="OK")throw new se(T.detail,T.code,R);y.notifyComplete(),C.resolve(T),O.resolve(R||{})}).catch(F=>{let U;F instanceof se?U=F:F instanceof Error&&F.name==="AbortError"?U=new se(F.message,W[W.CANCELLED]):U=new se(F instanceof Error?F.message:""+F,W[W.INTERNAL]),U.methodName=e.name,U.serviceName=e.service.typeName,f.rejectPending(U),y.notifyError(U),C.rejectPending(U),O.rejectPending(U)}),new Oi(e,(a=c.meta)!==null&&a!==void 0?a:{},t,f.promise,y,C.promise,O.promise)}unary(e,t,n){var r,i,o,a;let c=n,d=(r=c.format)!==null&&r!==void 0?r:"text",l=(i=c.fetchInit)!==null&&i!==void 0?i:{},u=this.makeUrl(e,c),h=e.I.toBinary(t,c.binaryOptions),f=new vt,y,k=new vt,T,C=new vt,R,O=new vt;return globalThis.fetch(u,Object.assign(Object.assign({},l),{method:"POST",headers:pr(new globalThis.Headers,d,c.timeout,c.meta),body:mr(h,d),signal:(o=n.abort)!==null&&o!==void 0?o:null})).then(F=>{let[U,b,B]=Mn(F);if(f.resolve(B),U!=null&&U!==W.OK)throw new se(b??W[U],W[U],B);return U!=null&&(T={code:W[U],detail:b??W[U]}),F}).then(F=>{if(!F.body)throw new se("missing response body",W[W.INTERNAL]);return wr(F.body,F.headers.get("content-type"),(U,b)=>{switch(U){case Ge.DATA:if(y)throw new se("unary call received 2nd message",W[W.DATA_LOSS]);y=e.O.fromBinary(b,c.binaryOptions);break;case Ge.TRAILER:let B,m;[B,m,R]=gr(b),T={code:W[B],detail:m??W[B]};break}})}).then(()=>{if(!R&&y)throw new se("missing trailers",W[W.DATA_LOSS]);if(!T)throw new se("missing status",W[W.INTERNAL]);if(!y&&T.code==="OK")throw new se("expected error status",W[W.DATA_LOSS]);if(!y)throw new se(T.detail,T.code,R);if(k.resolve(y),T.code!=="OK")throw new se(T.detail,T.code,R);C.resolve(T),O.resolve(R||{})}).catch(F=>{let U;F instanceof se?U=F:F instanceof Error&&F.name==="AbortError"?U=new se(F.message,W[W.CANCELLED]):U=new se(F instanceof Error?F.message:""+F,W[W.INTERNAL]),U.methodName=e.name,U.serviceName=e.service.typeName,f.rejectPending(U),k.rejectPending(U),C.rejectPending(U),O.rejectPending(U)}),new _i(e,(a=c.meta)!==null&&a!==void 0?a:{},t,f.promise,k.promise,C.promise,O.promise)}}var bn=(s=>(s[s.IMAGE=0]="IMAGE",s[s.AUDIO=1]="AUDIO",s[s.VIDEO=2]="VIDEO",s[s.ALL=3]="ALL",s[s.FOLDER=4]="FOLDER",s))(bn||{});class Pi extends Te{constructor(){super("com.hamropatro.grpc.common.SearchRequest",[{no:1,name:"search_value",kind:"scalar",T:9},{no:2,name:"cursor",kind:"scalar",T:9},{no:3,name:"limit",kind:"scalar",T:5}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.searchValue="",t.cursor="",t.limit=0,e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.searchValue=e.string();break;case 2:i.cursor=e.string();break;case 3:i.limit=e.int32();break;default:let d=n.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.searchValue!==""&&t.tag(1,j.LengthDelimited).string(e.searchValue),e.cursor!==""&&t.tag(2,j.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(3,j.Varint).int32(e.limit);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Er=new Pi;class Wi extends Te{constructor(){super("com.hamropatro.grpc.common.SearchResult",[{no:1,name:"items",kind:"message",repeat:1,T:()=>Je},{no:2,name:"next_page_cursor",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.items=[],t.nextPageCursor="",e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.items.push(Je.internalBinaryRead(e,e.uint32(),n));break;case 2:i.nextPageCursor=e.string();break;default:let d=n.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){for(let i=0;i<e.items.length;i++)Je.internalBinaryWrite(e.items[i],t.tag(1,j.LengthDelimited).fork(),n).join();e.nextPageCursor!==""&&t.tag(2,j.LengthDelimited).string(e.nextPageCursor);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const ji=new Wi;class qi extends Te{constructor(){super("com.hamropatro.grpc.common.CreateFileRequest",[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"folder_name",kind:"scalar",T:9},{no:3,name:"nested_folder_name",kind:"scalar",T:9},{no:4,name:"url",kind:"scalar",T:9},{no:5,name:"type",kind:"enum",T:()=>["com.hamropatro.grpc.common.FileType",bn]},{no:6,name:"extension",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.name="",t.folderName="",t.nestedFolderName="",t.url="",t.type=0,t.extension="",e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.name=e.string();break;case 2:i.folderName=e.string();break;case 3:i.nestedFolderName=e.string();break;case 4:i.url=e.string();break;case 5:i.type=e.int32();break;case 6:i.extension=e.string();break;default:let d=n.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.name!==""&&t.tag(1,j.LengthDelimited).string(e.name),e.folderName!==""&&t.tag(2,j.LengthDelimited).string(e.folderName),e.nestedFolderName!==""&&t.tag(3,j.LengthDelimited).string(e.nestedFolderName),e.url!==""&&t.tag(4,j.LengthDelimited).string(e.url),e.type!==0&&t.tag(5,j.Varint).int32(e.type),e.extension!==""&&t.tag(6,j.LengthDelimited).string(e.extension);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const vr=new qi;class Zi extends Te{constructor(){super("com.hamropatro.grpc.common.CreateUserFileRequest",[{no:1,name:"url",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:()=>["com.hamropatro.grpc.common.FileType",bn]},{no:3,name:"extension",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.url="",t.type=0,t.extension="",e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.url=e.string();break;case 2:i.type=e.int32();break;case 3:i.extension=e.string();break;default:let d=n.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.url!==""&&t.tag(1,j.LengthDelimited).string(e.url),e.type!==0&&t.tag(2,j.Varint).int32(e.type),e.extension!==""&&t.tag(3,j.LengthDelimited).string(e.extension);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Vn=new Zi;class Ki extends Te{constructor(){super("com.hamropatro.grpc.common.File",[{no:1,name:"key",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"folder_name",kind:"scalar",T:9},{no:4,name:"nested_folder_name",kind:"scalar",T:9},{no:5,name:"url",kind:"scalar",T:9},{no:6,name:"thumbor_url",kind:"scalar",T:9},{no:7,name:"proxy_url",kind:"scalar",T:9},{no:8,name:"type",kind:"enum",T:()=>["com.hamropatro.grpc.common.FileType",bn]},{no:9,name:"metadata",kind:"message",T:()=>Hn}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",t.name="",t.folderName="",t.nestedFolderName="",t.url="",t.thumborUrl="",t.proxyUrl="",t.type=0,e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.key=e.string();break;case 2:i.name=e.string();break;case 3:i.folderName=e.string();break;case 4:i.nestedFolderName=e.string();break;case 5:i.url=e.string();break;case 6:i.thumborUrl=e.string();break;case 7:i.proxyUrl=e.string();break;case 8:i.type=e.int32();break;case 9:i.metadata=Hn.internalBinaryRead(e,e.uint32(),n,i.metadata);break;default:let d=n.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,j.LengthDelimited).string(e.key),e.name!==""&&t.tag(2,j.LengthDelimited).string(e.name),e.folderName!==""&&t.tag(3,j.LengthDelimited).string(e.folderName),e.nestedFolderName!==""&&t.tag(4,j.LengthDelimited).string(e.nestedFolderName),e.url!==""&&t.tag(5,j.LengthDelimited).string(e.url),e.thumborUrl!==""&&t.tag(6,j.LengthDelimited).string(e.thumborUrl),e.proxyUrl!==""&&t.tag(7,j.LengthDelimited).string(e.proxyUrl),e.type!==0&&t.tag(8,j.Varint).int32(e.type),e.metadata&&Hn.internalBinaryWrite(e.metadata,t.tag(9,j.LengthDelimited).fork(),n).join();let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Je=new Ki;class zi extends Te{constructor(){super("com.hamropatro.grpc.common.FileMetadata",[{no:1,name:"height",kind:"scalar",T:5},{no:2,name:"width",kind:"scalar",T:5},{no:3,name:"background_color",kind:"scalar",T:9},{no:4,name:"aspect_ratio",kind:"scalar",T:1}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.height=0,t.width=0,t.backgroundColor="",t.aspectRatio=0,e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.height=e.int32();break;case 2:i.width=e.int32();break;case 3:i.backgroundColor=e.string();break;case 4:i.aspectRatio=e.double();break;default:let d=n.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.height!==0&&t.tag(1,j.Varint).int32(e.height),e.width!==0&&t.tag(2,j.Varint).int32(e.width),e.backgroundColor!==""&&t.tag(3,j.LengthDelimited).string(e.backgroundColor),e.aspectRatio!==0&&t.tag(4,j.Bit64).double(e.aspectRatio);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Hn=new zi;class Xi extends Te{constructor(){super("com.hamropatro.grpc.common.DeleteFileRequest",[{no:1,name:"key",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.key=e.string();break;default:let d=n.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,j.LengthDelimited).string(e.key);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Ar=new Xi;class Gi extends Te{constructor(){super("com.hamropatro.grpc.common.DeleteFileResponse",[{no:1,name:"is_deleted",kind:"scalar",T:8}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.isDeleted=!1,e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.isDeleted=e.bool();break;default:let d=n.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.isDeleted!==!1&&t.tag(1,j.Varint).bool(e.isDeleted);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Ji=new Gi;class Qi extends Te{constructor(){super("com.hamropatro.grpc.common.GetFilesByFolderRequest",[{no:1,name:"folder_name",kind:"scalar",T:9},{no:2,name:"cursor",kind:"scalar",T:9},{no:3,name:"limit",kind:"scalar",T:5}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.folderName="",t.cursor="",t.limit=0,e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.folderName=e.string();break;case 2:i.cursor=e.string();break;case 3:i.limit=e.int32();break;default:let d=n.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.folderName!==""&&t.tag(1,j.LengthDelimited).string(e.folderName),e.cursor!==""&&t.tag(2,j.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(3,j.Varint).int32(e.limit);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const kr=new Qi;class Yi extends Te{constructor(){super("com.hamropatro.grpc.common.GetFilesByFolderResponse",[{no:1,name:"files",kind:"message",repeat:1,T:()=>Je},{no:2,name:"next_cursor",kind:"scalar",T:9},{no:3,name:"has_more",kind:"scalar",T:8}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.files=[],t.nextCursor="",t.hasMore=!1,e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.files.push(Je.internalBinaryRead(e,e.uint32(),n));break;case 2:i.nextCursor=e.string();break;case 3:i.hasMore=e.bool();break;default:let d=n.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){for(let i=0;i<e.files.length;i++)Je.internalBinaryWrite(e.files[i],t.tag(1,j.LengthDelimited).fork(),n).join();e.nextCursor!==""&&t.tag(2,j.LengthDelimited).string(e.nextCursor),e.hasMore!==!1&&t.tag(3,j.Varint).bool(e.hasMore);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const es=new Yi,$n=new Dn("com.hamropatro.grpc.common.FileService",[{name:"createFile",options:{},I:vr,O:Je},{name:"updateFile",options:{},I:Je,O:Je},{name:"deleteFile",options:{},I:Ar,O:Ji},{name:"getFilesByFolder",options:{},I:kr,O:es},{name:"createUserFile",options:{},I:Vn,O:Je},{name:"search",options:{},I:Er,O:ji}]);class St{constructor(e){pe(this,"typeName",$n.typeName);pe(this,"methods",$n.methods);pe(this,"options",$n.options);this._transport=e}createFile(e,t){const n=this.methods[0],r=this._transport.mergeOptions(t);return Pe("unary",this._transport,n,r,e)}updateFile(e,t){const n=this.methods[1],r=this._transport.mergeOptions(t);return Pe("unary",this._transport,n,r,e)}deleteFile(e,t){const n=this.methods[2],r=this._transport.mergeOptions(t);return Pe("unary",this._transport,n,r,e)}getFilesByFolder(e,t){const n=this.methods[3],r=this._transport.mergeOptions(t);return Pe("unary",this._transport,n,r,e)}createUserFile(e,t){const n=this.methods[4],r=this._transport.mergeOptions(t);return Pe("unary",this._transport,n,r,e)}search(e,t){const n=this.methods[5],r=this._transport.mergeOptions(t);return Pe("unary",this._transport,n,r,e)}}const ts=async(s,e,t,n,r,i)=>{var o;try{const a=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,c=new St(a),d=vr.create();return d.name=s,d.nestedFolderName=e,d.url=t,d.type=n,d.folderName=r,await c.createFile(d,i)}catch(a){throw a}},ns=async(s,e,t)=>{var n;try{const r=(n=window.ImageSalonSDK)==null?void 0:n.grpcConfig,i=new St(r),o=Vn.create();return o.url=s,o.type=e,await i.createUserFile(o,t)}catch(r){throw r}},rs=async(s,e,t,n)=>{var r;try{let i;try{t&&(i={Authorization:t,"app-id":n==="production"?"hamropatro":"hamropatro-android"})}catch(u){if(u)throw u}const o={meta:i},a=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,c=new St(a),d=Vn.create();return d.url=s,d.type=e,await c.createUserFile(d,o)}catch(i){throw i}},is=async(s,e,t,n)=>{var r;try{const i=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,o=new St(i),a=kr.create();return a.folderName=s,a.cursor=e,a.limit=t,await o.getFilesByFolder(a,n)}catch(i){throw i}},ss=async(s,e,t=20,n)=>{var r;try{const i=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,o=new St(i),a=Er.create();return a.searchValue=s,a.cursor=e,a.limit=t,await o.search(a,n)}catch(i){throw i}},os=async(s,e,t,n,r,i,o,a,c)=>{var d;try{const l=(d=window.ImageSalonSDK)==null?void 0:d.grpcConfig,u=new St(l),h=Je.create();return h.key=s,h.name=e,h.nestedFolderName=t,h.url=n,h.thumborUrl=r,h.proxyUrl=i,h.type=o,h.folderName=a,await u.updateFile(h,c)}catch(l){throw l}},as=async(s,e)=>{var t;try{const n=(t=window.ImageSalonSDK)==null?void 0:t.grpcConfig,r=new St(n),i=Ar.create();return i.key=s,await r.deleteFile(i,e)}catch(n){throw n}};class ls extends Te{constructor(){super("com.hamropatro.grpc.common.DeleteFolderRequest",[{no:1,name:"key",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.key=e.string();break;default:let d=n.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,j.LengthDelimited).string(e.key);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Fr=new ls;class cs extends Te{constructor(){super("com.hamropatro.grpc.common.CreateFolderRequest",[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"nested_folder_name",kind:"scalar",T:9},{no:3,name:"created_by",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.name="",t.nestedFolderName="",t.createdBy="",e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.name=e.string();break;case 2:i.nestedFolderName=e.string();break;case 3:i.createdBy=e.string();break;default:let d=n.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.name!==""&&t.tag(1,j.LengthDelimited).string(e.name),e.nestedFolderName!==""&&t.tag(2,j.LengthDelimited).string(e.nestedFolderName),e.createdBy!==""&&t.tag(3,j.LengthDelimited).string(e.createdBy);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Nr=new cs;class ds extends Te{constructor(){super("com.hamropatro.grpc.common.GetAllFoldersRequest",[{no:1,name:"cursor",kind:"scalar",T:9},{no:2,name:"limit",kind:"scalar",T:5}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.cursor="",t.limit=0,e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.cursor=e.string();break;case 2:i.limit=e.int32();break;default:let d=n.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.cursor!==""&&t.tag(1,j.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(2,j.Varint).int32(e.limit);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Ir=new ds;class hs extends Te{constructor(){super("com.hamropatro.grpc.common.GetAllFoldersResponse",[{no:1,name:"folder",kind:"message",repeat:1,T:()=>mt},{no:2,name:"next_cursor",kind:"scalar",T:9},{no:3,name:"has_more",kind:"scalar",T:8}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.folder=[],t.nextCursor="",t.hasMore=!1,e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.folder.push(mt.internalBinaryRead(e,e.uint32(),n));break;case 2:i.nextCursor=e.string();break;case 3:i.hasMore=e.bool();break;default:let d=n.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){for(let i=0;i<e.folder.length;i++)mt.internalBinaryWrite(e.folder[i],t.tag(1,j.LengthDelimited).fork(),n).join();e.nextCursor!==""&&t.tag(2,j.LengthDelimited).string(e.nextCursor),e.hasMore!==!1&&t.tag(3,j.Varint).bool(e.hasMore);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const us=new hs;class fs extends Te{constructor(){super("com.hamropatro.grpc.common.Folder",[{no:1,name:"key",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"nested_folder_name",kind:"scalar",T:9},{no:4,name:"created_by",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",t.name="",t.nestedFolderName="",t.createdBy="",e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.key=e.string();break;case 2:i.name=e.string();break;case 3:i.nestedFolderName=e.string();break;case 4:i.createdBy=e.string();break;default:let d=n.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,j.LengthDelimited).string(e.key),e.name!==""&&t.tag(2,j.LengthDelimited).string(e.name),e.nestedFolderName!==""&&t.tag(3,j.LengthDelimited).string(e.nestedFolderName),e.createdBy!==""&&t.tag(4,j.LengthDelimited).string(e.createdBy);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const mt=new fs;class ps extends Te{constructor(){super("com.hamropatro.grpc.common.ChangeNestedFolderRequest",[{no:1,name:"folder_key",kind:"scalar",T:9},{no:2,name:"nested_folder_name",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.folderKey="",t.nestedFolderName="",e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.folderKey=e.string();break;case 2:i.nestedFolderName=e.string();break;default:let d=n.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.folderKey!==""&&t.tag(1,j.LengthDelimited).string(e.folderKey),e.nestedFolderName!==""&&t.tag(2,j.LengthDelimited).string(e.nestedFolderName);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const ms=new ps,Pn=new Dn("com.hamropatro.grpc.common.FolderService",[{name:"createFolder",options:{},I:Nr,O:mt},{name:"getFolders",options:{},I:Ir,O:us},{name:"updateFolder",options:{},I:mt,O:mt},{name:"deleteFolder",options:{},I:Fr,O:mt},{name:"ChangeNestedFolderName",options:{},I:ms,O:mt}]);class Cn{constructor(e){pe(this,"typeName",Pn.typeName);pe(this,"methods",Pn.methods);pe(this,"options",Pn.options);this._transport=e}createFolder(e,t){const n=this.methods[0],r=this._transport.mergeOptions(t);return Pe("unary",this._transport,n,r,e)}getFolders(e,t){const n=this.methods[1],r=this._transport.mergeOptions(t);return Pe("unary",this._transport,n,r,e)}updateFolder(e,t){const n=this.methods[2],r=this._transport.mergeOptions(t);return Pe("unary",this._transport,n,r,e)}deleteFolder(e,t){const n=this.methods[3],r=this._transport.mergeOptions(t);return Pe("unary",this._transport,n,r,e)}changeNestedFolderName(e,t){const n=this.methods[4],r=this._transport.mergeOptions(t);return Pe("unary",this._transport,n,r,e)}}const gs=async(s,e=20,t)=>{var o;const n=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,r=new Cn(n),i=Ir.create();try{return i.cursor=s,i.limit=e,await r.getFolders(i,t)}catch(a){throw a}},ws=async(s,e,t,n)=>{var r;try{const i=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,o=new Cn(i),a=Nr.create();return a.name=s,a.nestedFolderName=e,a.createdBy=t,await o.createFolder(a,n)}catch(i){throw i}},ys=async(s,e,t,n,r)=>{var i;try{const o=(i=window.ImageSalonSDK)==null?void 0:i.grpcConfig,a=new Cn(o),c=mt.create();return c.name=e,c.key=s,c.nestedFolderName=t,c.createdBy=n,await a.updateFolder(c,r)}catch(o){throw o}},bs=async(s,e)=>{var t;try{const n=(t=window.ImageSalonSDK)==null?void 0:t.grpcConfig,r=new Cn(n),i=Fr.create();return i.key=s,await r.deleteFolder(i,e)}catch(n){throw n}},Wn=(s,e,t)=>{const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.setAttribute("width",s||"20"),n.setAttribute("height",e||"20"),n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("fill","none"),n.setAttribute("stroke",t||"#ee3f3f"),n.setAttribute("stroke-width","2"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),n.classList.add("lucide","lucide-circle-alert");const r=document.createElementNS("http://www.w3.org/2000/svg","circle");r.setAttribute("cx","12"),r.setAttribute("cy","12"),r.setAttribute("r","10");const i=document.createElementNS("http://www.w3.org/2000/svg","line");i.setAttribute("x1","12"),i.setAttribute("x2","12"),i.setAttribute("y1","8"),i.setAttribute("y2","12");const o=document.createElementNS("http://www.w3.org/2000/svg","line");return o.setAttribute("x1","12"),o.setAttribute("x2","12.01"),o.setAttribute("y1","16"),o.setAttribute("y2","16"),n.appendChild(r),n.appendChild(i),n.appendChild(o),n};function Tr(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("height","24px"),s.setAttribute("width","24px"),s.setAttribute("viewBox","0 -960 960 960"),s.setAttribute("fill","#333");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"),s.appendChild(e),s}function Cs(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width","12"),s.setAttribute("height","12"),s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("fill","none"),s.setAttribute("stroke","currentColor"),s.setAttribute("stroke-width","2"),s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),s.classList.add("lucide","lucide-music-4");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d","M9 18V5l12-2v13");const t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d","m9 9 12-2");const n=document.createElementNS("http://www.w3.org/2000/svg","circle");n.setAttribute("cx","6"),n.setAttribute("cy","18"),n.setAttribute("r","3");const r=document.createElementNS("http://www.w3.org/2000/svg","circle");return r.setAttribute("cx","18"),r.setAttribute("cy","16"),r.setAttribute("r","3"),s.appendChild(e),s.appendChild(t),s.appendChild(n),s.appendChild(r),document.body.appendChild(s),s}const Lr=s=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("width","20"),e.setAttribute("height","20"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.setAttribute("stroke",s||"currentColor"),e.setAttribute("stroke-width","2"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.classList.add("lucide","lucide-circle-check-big");const t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d","M21.801 10A10 10 0 1 1 17 3.335");const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d","m9 11 3 3L22 4"),e.appendChild(t),e.appendChild(n),e};function jn(s="#333"){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("x","0px"),e.setAttribute("y","0px"),e.setAttribute("width","18"),e.setAttribute("height","18"),e.setAttribute("viewBox","0 0 50 50"),e.setAttribute("fill",s);const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d","M 9.15625 6.3125 L 6.3125 9.15625 L 22.15625 25 L 6.21875 40.96875 L 9.03125 43.78125 L 25 27.84375 L 40.9375 43.78125 L 43.78125 40.9375 L 27.84375 25 L 43.6875 9.15625 L 40.84375 6.3125 L 25 22.15625 Z"),e.appendChild(t),e}function Ur(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width","16"),s.setAttribute("height","16"),s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("fill","none"),s.setAttribute("stroke","#2c96f8"),s.setAttribute("stroke-width","2"),s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),s.classList.add("lucide","lucide-pencil");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d","M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z");const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d","m15 5 4 4"),s.appendChild(e),s.appendChild(t),document.body.appendChild(s),s}function nn(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/folder"),s.setAttribute("x","0px"),s.setAttribute("y","0px"),s.setAttribute("width","24"),s.setAttribute("height","24"),s.setAttribute("viewBox","0 0 48 48");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("fill","#FFA000"),e.setAttribute("d","M40,12H22l-4-4H8c-2.2,0-4,1.8-4,4v8h40v-4C44,13.8,42.2,12,40,12z");const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("fill","#FFCA28"),t.setAttribute("d","M40,12H8c-2.2,0-4,1.8-4,4v20c0,2.2,1.8,4,4,4h32c2.2,0,4-1.8,4-4V16C44,13.8,42.2,12,40,12z"),s.appendChild(e),s.appendChild(t),s}function Es(){const s="http://www.w3.org/2000/svg",e=document.createElementNS(s,"svg");e.setAttribute("width","12"),e.setAttribute("height","12"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","3"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.classList.add("lucide","lucide-image");const t=document.createElementNS(s,"rect");t.setAttribute("width","18"),t.setAttribute("height","18"),t.setAttribute("x","3"),t.setAttribute("y","3"),t.setAttribute("rx","2"),t.setAttribute("ry","2");const n=document.createElementNS(s,"circle");n.setAttribute("cx","9"),n.setAttribute("cy","9"),n.setAttribute("r","2");const r=document.createElementNS(s,"path");return r.setAttribute("d","m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"),e.appendChild(t),e.appendChild(n),e.appendChild(r),document.body.appendChild(e),e}function vs(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("height","24px"),s.setAttribute("viewBox","0 -960 960 960"),s.setAttribute("width","24px"),s.setAttribute("fill","currentColor");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","m488-400-65 65 56 56 161-161-161-161-56 56 65 65H320v80h168ZM160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640v400q0 33-23.5 56.5T800-160H160Zm0-80h640v-400H447l-80-80H160v480Zm0 0v-480 480Z"),s.appendChild(e),s}function xr(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("fill","none"),s.setAttribute("width","20"),s.setAttribute("height","20"),s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("stroke-width","1.5"),s.setAttribute("stroke","currentColor"),s.setAttribute("class","size-2");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.setAttribute("d","M12 4.5v15m7.5-7.5h-15"),s.appendChild(e),s}function As(){const s="http://www.w3.org/2000/svg",e=document.createElementNS(s,"svg");e.setAttribute("width","16"),e.setAttribute("height","16"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","2"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.classList.add("lucide","lucide-eye");const t=document.createElementNS(s,"path");t.setAttribute("d","M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"),e.appendChild(t);const n=document.createElementNS(s,"circle");return n.setAttribute("cx","12"),n.setAttribute("cy","12"),n.setAttribute("r","3"),e.appendChild(n),document.body.appendChild(e),e}function ks(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("height","24px"),s.setAttribute("width","24px"),s.setAttribute("viewBox","0 0 30 30"),s.setAttribute("fill","#999");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d","M 13 3 C 7.4889971 3 3 7.4889971 3 13 C 3 18.511003 7.4889971 23 13 23 C 15.396508 23 17.597385 22.148986 19.322266 20.736328 L 25.292969 26.707031 A 1.0001 1.0001 0 1 0 26.707031 25.292969 L 20.736328 19.322266 C 22.148986 17.597385 23 15.396508 23 13 C 23 7.4889971 18.511003 3 13 3 z M 13 5 C 17.430123 5 21 8.5698774 21 13 C 21 17.430123 17.430123 21 13 21 C 8.5698774 21 5 17.430123 5 13 C 5 8.5698774 8.5698774 5 13 5 z"),s.appendChild(e),s}function _r(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width","16"),s.setAttribute("height","16"),s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("fill","none"),s.setAttribute("stroke","#f14b4b"),s.setAttribute("stroke-width","2"),s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),s.classList.add("lucide","lucide-trash-2");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d","M3 6h18");const t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d","M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6");const n=document.createElementNS("http://www.w3.org/2000/svg","path");n.setAttribute("d","M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2");const r=document.createElementNS("http://www.w3.org/2000/svg","line");r.setAttribute("x1","10"),r.setAttribute("x2","10"),r.setAttribute("y1","11"),r.setAttribute("y2","17");const i=document.createElementNS("http://www.w3.org/2000/svg","line");return i.setAttribute("x1","14"),i.setAttribute("x2","14"),i.setAttribute("y1","11"),i.setAttribute("y2","17"),s.appendChild(e),s.appendChild(t),s.appendChild(n),s.appendChild(r),s.appendChild(i),document.body.appendChild(s),s}function qn(){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width","24"),s.setAttribute("height","24"),s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("fill","none"),s.setAttribute("stroke","currentColor"),s.setAttribute("stroke-width","2"),s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),s.classList.add("lucide","lucide-upload");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d","M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4");const t=document.createElementNS("http://www.w3.org/2000/svg","polyline");t.setAttribute("points","17 8 12 3 7 8");const n=document.createElementNS("http://www.w3.org/2000/svg","line");return n.setAttribute("x1","12"),n.setAttribute("x2","12"),n.setAttribute("y1","3"),n.setAttribute("y2","15"),s.appendChild(e),s.appendChild(t),s.appendChild(n),s}function Fs(){const s="http://www.w3.org/2000/svg",e=document.createElementNS(s,"svg");e.setAttribute("width","12"),e.setAttribute("height","12"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","3"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round"),e.classList.add("lucide","lucide-video");const t=document.createElementNS(s,"path");t.setAttribute("d","m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5");const n=document.createElementNS(s,"rect");return n.setAttribute("x","2"),n.setAttribute("y","6"),n.setAttribute("width","14"),n.setAttribute("height","12"),n.setAttribute("rx","2"),e.appendChild(t),e.appendChild(n),document.body.appendChild(e),e}function Q(s,e,t,n,r){let i=document.createElement(s);return e&&(i.className+=e),t&&(i.style.cssText=t),n&&(i.textContent=n),r&&r.appendChild(i),i}class Ns{constructor(){z(this,gt);z(this,et);z(this,Pt,"#fff");H(this,gt,document.createElementNS("http://www.w3.org/2000/svg","svg")),E(this,gt).setAttribute("viewBox","25 25 50 50"),E(this,gt).classList.add("loader-svg"),H(this,et,document.createElementNS("http://www.w3.org/2000/svg","circle")),E(this,et).setAttribute("r","20"),E(this,et).setAttribute("cy","50"),E(this,et).setAttribute("cx","50"),E(this,et).setAttribute("stroke",E(this,Pt)),E(this,et).classList.add("loader-circle"),E(this,gt).appendChild(E(this,et))}show(e,t){t&&(H(this,Pt,t),E(this,et).setAttribute("stroke",E(this,Pt))),e.appendChild(E(this,gt))}hide(){E(this,gt).remove()}}gt=new WeakMap,et=new WeakMap,Pt=new WeakMap;const Br=new Ns,En=document.body;class Or{constructor(){pe(this,"main");pe(this,"dialogContainer");pe(this,"dialog");pe(this,"dialogBackdrop");pe(this,"dialogContent");pe(this,"dialogHeader");pe(this,"dialogBody");pe(this,"dialogFooter");pe(this,"confirmButton");pe(this,"cancelButton");pe(this,"confirmCallback");pe(this,"cancelCallback");this.main=Q("div"),this.dialog=Q("div"),this.confirmCallback=void 0,this.cancelCallback=void 0}_init(e){this.main=Q("div","dialog-presentation","","",En),this.main.setAttribute("role","presentation"),this.dialogContainer=Q("div","dialog-container","","",this.main),this.dialogBackdrop=Q("div","dialog-backdrop","","",this.dialogContainer),this.dialog=Q("div","dialog","","",this.dialogContainer),this.dialog.setAttribute("tabIndex","-1");const t=document.activeElement;if(t&&t!==document.body&&(t.blur(),this.dialog.focus()),this.dialog.className="dialog",this.dialogContent=Q("div","dialog-content","","",this.dialog),e!=null&&e.dialogContentStyle&&Object.assign(this.dialogContent.style,e.dialogContentStyle),this.confirmButton=Q("button","dialog-btn confirm","","",this.dialogFooter),this.confirmButton.type="button",this.cancelButton=Q("button","dialog-btn cancel","","",this.dialogFooter),this.cancelButton.type="button",e.showCloseBtn){const n=Q("button","dialog-close-btn","","",this.dialogContent);n.appendChild(jn()),n.onclick=()=>this.hide()}return e.header&&this._setHeader(e),this._setBody(e),this._setFooter(e),this.confirmButton.textContent=e.confirmButtonText||"Upload",this.cancelButton.textContent=e.cancelButtonText||"Cancel",En.style.overflow="hidden",this.confirmButton.textContent=e.confirmButtonText||"Upload",this.cancelButton.textContent=e.cancelButtonText||"Cancel",En.classList.add("dialog-visible"),new Promise(n=>{const r=i=>()=>{this.hide(),n(i==="confirm")};this.confirmCallback=e.onConfirm||r("confirm"),this.confirmButton.addEventListener("click",this.confirmCallback),this.cancelCallback=e.onCancel||r("cancel"),this.cancelButton.addEventListener("click",this.cancelCallback)})}_setHeader(e){if(this.dialogHeader=Q("div","dialog-header","","",this.dialogContent),!e.header)this.dialogHeader.innerHTML="";else if(typeof e.header=="string"){const t=Q("h4","dialog-header-text","","",this.dialogHeader);t.textContent=e.header}else this.dialogHeader.innerHTML="",this.dialogHeader.appendChild(e.header)}_setBody(e){this.dialogBody=Q("div","dialog-body","","",this.dialogContent),typeof e.content=="string"?this.dialogBody.innerHTML=e.content:(this.dialogBody.innerHTML="",this.dialogBody.appendChild(e.content))}_setFooter(e){this.dialogFooter=Q("div","dialog-footer","","",this.dialogContent),e.showFooter?this.dialogFooter.append(this.cancelButton,this.confirmButton):(this.dialogFooter.innerHTML="",this.dialogFooter.remove())}show(e){this._init(e),setTimeout(()=>{this.dialogContainer.style.opacity="1",this.dialog.style.transform="scale(1)",this.dialog.style.transition="transform 150ms ease-in",this.dialog.style.opacity="1",this.dialogBackdrop.style.opacity="1"},150)}hide(){this.main||En.style.removeProperty("overflow"),this.dialog.style.transform="scale(0.8)",this.dialog.style.transition="transform 150ms ease-out",this.dialogBackdrop.style.opacity="0",setTimeout(()=>{this.dialogContainer.style.opacity="0",this.dialog.style.opacity="0",this.dialogContent.style.opacity="0",this.main.remove()},150)}updateUploadBtn(e){e?(Br.show(this.confirmButton),this.confirmButton.disabled=!0):(Br.hide(),this.confirmButton.disabled=!1)}}const vn=new Or,ve=new Or;class Is{constructor(){pe(this,"main");pe(this,"dialogBody");this.main=Q("div"),this.dialogBody=Q("div"),this.hide()}show(e){this.main=Q("div","popover","","",e.mainContainer),this.dialogBody=Q("div","popover-body","","",this.main),this.main.id=e.divId,this.dialogBody.append(e.content)}hide(){this.main.remove()}}const Ze=new Is;var Qe=(s=>(s[s.IMAGE=0]="IMAGE",s[s.AUDIO=1]="AUDIO",s[s.VIDEO=2]="VIDEO",s[s.ALL=3]="ALL",s[s.FOLDER=4]="FOLDER",s))(Qe||{});const rn={0:"IMAGE",1:"AUDIO",2:"VIDEO",3:"ALL",4:"FOLDER"};function Zn(s){switch(s){case"image":return rn[Qe.IMAGE];case"video":return rn[Qe.VIDEO];case"audio":return rn[Qe.AUDIO];default:return rn[Qe.ALL]}}function Ts(s){const e={};s.forEach(r=>{e[r.key]={...r,children:{}}});const t=r=>(Object.values(e).filter(o=>o.nestedFolderName==r.key).forEach(o=>{r.children[o.key]=t(o)}),r);return s.reduce((r,i)=>(i.nestedFolderName||r.push(t(e[i.key])),r),[])}function Ls(s,e){const t=n=>{if(n.key===e.nestedFolderName)return n.children[e.key]={...e,children:{}},!0;for(const r in n.children){const i=n.children[r];if(t(i))return!0}return!1};for(const n of s)if(t(n))break;return s}const Us=async(s,e)=>{let t;try{s&&(t={Authorization:s,"app-id":e==="production"?"hamropatro":"hamropatro-android"})}catch(r){if(r)throw r}return{meta:t}};function K(s,e){const t=document.createElement("div");return s&&(t.className=s),e&&(t.id=e),t}function sn(s,e,t){const n=document.createElement("p");return e&&(n.className=e),t&&(n.id=t),s&&(n.textContent=s),n}function oe(s,e){const t=document.createElement("span");return e&&(t.className=e),s&&(t.textContent=s),t}function Sr(s,e,t,n){const r=document.createElement("img");return e&&(r.className=e),r.src=s,r}function xs(s,e,t){const n=document.createElement("video"),r=document.createElement("source");return n.className=e,r.src=s,n.appendChild(r),n}function _s(s,e,t){const n=document.createElement("audio"),r=document.createElement("source");return n.className=e,n.controls=!0,r.src=s,n.appendChild(r),n}function We(s,e,t,n,r){const i=document.createElement("button");return e&&(i.className=e),t&&(i.id=t),s&&(i.textContent=s),r&&(i.innerHTML=r),i.disabled=n,i}function Kn(s,e,t){const n=document.createElement("input");return n.className=e,n.defaultValue=t,s&&(n.type=s),n}function Bs(s,e){return e.forEach(function(t){t&&typeof t!="string"&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if(n!=="default"&&!(n in s)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(s,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(s)}function Rr(s,e){return new Promise(function(t,n){let r;return Os(s).then(function(i){try{return r=i,t(new Blob([e.slice(0,2),r,e.slice(2)],{type:"image/jpeg"}))}catch(o){return n(o)}},n)})}const Os=s=>new Promise((e,t)=>{const n=new FileReader;n.addEventListener("load",({target:{result:r}})=>{const i=new DataView(r);let o=0;if(i.getUint16(o)!==65496)return t("not a valid JPEG");for(o+=2;;){const a=i.getUint16(o);if(a===65498)break;const c=i.getUint16(o+2);if(a===65505&&i.getUint32(o+4)===1165519206){const d=o+10;let l;switch(i.getUint16(d)){case 18761:l=!0;break;case 19789:l=!1;break;default:return t("TIFF header contains invalid endian")}if(i.getUint16(d+2,l)!==42)return t("TIFF header contains invalid version");const u=i.getUint32(d+4,l),h=d+u+2+12*i.getUint16(d+u,l);for(let f=d+u+2;f<h;f+=12)if(i.getUint16(f,l)==274){if(i.getUint16(f+2,l)!==3)return t("Orientation data type is invalid");if(i.getUint32(f+4,l)!==1)return t("Orientation data count is invalid");i.setUint16(f+8,1,l);break}return e(r.slice(o,o+2+c))}o+=2+c}return e(new Blob)}),n.readAsArrayBuffer(s)});var An={},Ss={get exports(){return An},set exports(s){An=s}};(function(s){var e,t,n={};Ss.exports=n,n.parse=function(r,i){for(var o=n.bin.readUshort,a=n.bin.readUint,c=0,d={},l=new Uint8Array(r),u=l.length-4;a(l,u)!=101010256;)u--;c=u,c+=4;var h=o(l,c+=4);o(l,c+=2);var f=a(l,c+=2),y=a(l,c+=4);c+=4,c=y;for(var k=0;k<h;k++){a(l,c),c+=4,c+=4,c+=4,a(l,c+=4),f=a(l,c+=4);var T=a(l,c+=4),C=o(l,c+=4),R=o(l,c+2),O=o(l,c+4);c+=6;var F=a(l,c+=8);c+=4,c+=C+R+O,n._readLocal(l,F,d,f,T,i)}return d},n._readLocal=function(r,i,o,a,c,d){var l=n.bin.readUshort,u=n.bin.readUint;u(r,i),l(r,i+=4),l(r,i+=2);var h=l(r,i+=2);u(r,i+=2),u(r,i+=4),i+=4;var f=l(r,i+=8),y=l(r,i+=2);i+=2;var k=n.bin.readUTF8(r,i,f);if(i+=f,i+=y,d)o[k]={size:c,csize:a};else{var T=new Uint8Array(r.buffer,i);if(h==0)o[k]=new Uint8Array(T.buffer.slice(i,i+a));else{if(h!=8)throw"unknown compression method: "+h;var C=new Uint8Array(c);n.inflateRaw(T,C),o[k]=C}}},n.inflateRaw=function(r,i){return n.F.inflate(r,i)},n.inflate=function(r,i){return r[0],r[1],n.inflateRaw(new Uint8Array(r.buffer,r.byteOffset+2,r.length-6),i)},n.deflate=function(r,i){i==null&&(i={level:6});var o=0,a=new Uint8Array(50+Math.floor(1.1*r.length));a[o]=120,a[o+1]=156,o+=2,o=n.F.deflateRaw(r,a,o,i.level);var c=n.adler(r,0,r.length);return a[o+0]=c>>>24&255,a[o+1]=c>>>16&255,a[o+2]=c>>>8&255,a[o+3]=c>>>0&255,new Uint8Array(a.buffer,0,o+4)},n.deflateRaw=function(r,i){i==null&&(i={level:6});var o=new Uint8Array(50+Math.floor(1.1*r.length)),a=n.F.deflateRaw(r,o,a,i.level);return new Uint8Array(o.buffer,0,a)},n.encode=function(r,i){i==null&&(i=!1);var o=0,a=n.bin.writeUint,c=n.bin.writeUshort,d={};for(var l in r){var u=!n._noNeed(l)&&!i,h=r[l],f=n.crc.crc(h,0,h.length);d[l]={cpr:u,usize:h.length,crc:f,file:u?n.deflateRaw(h):h}}for(var l in d)o+=d[l].file.length+30+46+2*n.bin.sizeUTF8(l);o+=22;var y=new Uint8Array(o),k=0,T=[];for(var l in d){var C=d[l];T.push(k),k=n._writeHeader(y,k,l,C,0)}var R=0,O=k;for(var l in d)C=d[l],T.push(k),k=n._writeHeader(y,k,l,C,1,T[R++]);var F=k-O;return a(y,k,101010256),k+=4,c(y,k+=4,R),c(y,k+=2,R),a(y,k+=2,F),a(y,k+=4,O),k+=4,k+=2,y.buffer},n._noNeed=function(r){var i=r.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(i)!=-1},n._writeHeader=function(r,i,o,a,c,d){var l=n.bin.writeUint,u=n.bin.writeUshort,h=a.file;return l(r,i,c==0?67324752:33639248),i+=4,c==1&&(i+=2),u(r,i,20),u(r,i+=2,0),u(r,i+=2,a.cpr?8:0),l(r,i+=2,0),l(r,i+=4,a.crc),l(r,i+=4,h.length),l(r,i+=4,a.usize),u(r,i+=4,n.bin.sizeUTF8(o)),u(r,i+=2,0),i+=2,c==1&&(i+=2,i+=2,l(r,i+=6,d),i+=4),i+=n.bin.writeUTF8(r,i,o),c==0&&(r.set(h,i),i+=h.length),i},n.crc={table:function(){for(var r=new Uint32Array(256),i=0;i<256;i++){for(var o=i,a=0;a<8;a++)1&o?o=3988292384^o>>>1:o>>>=1;r[i]=o}return r}(),update:function(r,i,o,a){for(var c=0;c<a;c++)r=n.crc.table[255&(r^i[o+c])]^r>>>8;return r},crc:function(r,i,o){return 4294967295^n.crc.update(4294967295,r,i,o)}},n.adler=function(r,i,o){for(var a=1,c=0,d=i,l=i+o;d<l;){for(var u=Math.min(d+5552,l);d<u;)c+=a+=r[d++];a%=65521,c%=65521}return c<<16|a},n.bin={readUshort:function(r,i){return r[i]|r[i+1]<<8},writeUshort:function(r,i,o){r[i]=255&o,r[i+1]=o>>8&255},readUint:function(r,i){return 16777216*r[i+3]+(r[i+2]<<16|r[i+1]<<8|r[i])},writeUint:function(r,i,o){r[i]=255&o,r[i+1]=o>>8&255,r[i+2]=o>>16&255,r[i+3]=o>>24&255},readASCII:function(r,i,o){for(var a="",c=0;c<o;c++)a+=String.fromCharCode(r[i+c]);return a},writeASCII:function(r,i,o){for(var a=0;a<o.length;a++)r[i+a]=o.charCodeAt(a)},pad:function(r){return r.length<2?"0"+r:r},readUTF8:function(r,i,o){for(var a,c="",d=0;d<o;d++)c+="%"+n.bin.pad(r[i+d].toString(16));try{a=decodeURIComponent(c)}catch{return n.bin.readASCII(r,i,o)}return a},writeUTF8:function(r,i,o){for(var a=o.length,c=0,d=0;d<a;d++){var l=o.charCodeAt(d);if(!(4294967168&l))r[i+c]=l,c++;else if(!(4294965248&l))r[i+c]=192|l>>6,r[i+c+1]=128|l>>0&63,c+=2;else if(!(4294901760&l))r[i+c]=224|l>>12,r[i+c+1]=128|l>>6&63,r[i+c+2]=128|l>>0&63,c+=3;else{if(4292870144&l)throw"e";r[i+c]=240|l>>18,r[i+c+1]=128|l>>12&63,r[i+c+2]=128|l>>6&63,r[i+c+3]=128|l>>0&63,c+=4}}return c},sizeUTF8:function(r){for(var i=r.length,o=0,a=0;a<i;a++){var c=r.charCodeAt(a);if(!(4294967168&c))o++;else if(!(4294965248&c))o+=2;else if(!(4294901760&c))o+=3;else{if(4292870144&c)throw"e";o+=4}}return o}},n.F={},n.F.deflateRaw=function(r,i,o,a){var c=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][a],d=n.F.U,l=n.F._goodIndex;n.F._hash;var u=n.F._putsE,h=0,f=o<<3,y=0,k=r.length;if(a==0){for(;h<k;)u(i,f,h+(I=Math.min(65535,k-h))==k?1:0),f=n.F._copyExact(r,h,I,i,f+8),h+=I;return f>>>3}var T=d.lits,C=d.strt,R=d.prev,O=0,F=0,U=0,b=0,B=0,m=0;for(k>2&&(C[m=n.F._hash(r,0)]=0),h=0;h<k;h++){if(B=m,h+1<k-2){m=n.F._hash(r,h+1);var g=h+1&32767;R[g]=C[m],C[m]=g}if(y<=h){(O>14e3||F>26697)&&k-h>100&&(y<h&&(T[O]=h-y,O+=2,y=h),f=n.F._writeBlock(h==k-1||y==k?1:0,T,O,b,r,U,h-U,i,f),O=F=b=0,U=h);var A=0;h<k-2&&(A=n.F._bestMatch(r,h,R,B,Math.min(c[2],k-h),c[3]));var I=A>>>16,N=65535&A;if(A!=0){N=65535&A;var L=l(I=A>>>16,d.of0);d.lhst[257+L]++;var v=l(N,d.df0);d.dhst[v]++,b+=d.exb[L]+d.dxb[v],T[O]=I<<23|h-y,T[O+1]=N<<16|L<<8|v,O+=2,y=h+I}else d.lhst[r[h]]++;F++}}for(U==h&&r.length!=0||(y<h&&(T[O]=h-y,O+=2,y=h),f=n.F._writeBlock(1,T,O,b,r,U,h-U,i,f),O=0,F=0,O=F=b=0,U=h);7&f;)f++;return f>>>3},n.F._bestMatch=function(r,i,o,a,c,d){var l=32767&i,u=o[l],h=l-u+32768&32767;if(u==l||a!=n.F._hash(r,i-h))return 0;for(var f=0,y=0,k=Math.min(32767,i);h<=k&&--d!=0&&u!=l;){if(f==0||r[i+f]==r[i+f-h]){var T=n.F._howLong(r,i,h);if(T>f){if(y=h,(f=T)>=c)break;h+2<T&&(T=h+2);for(var C=0,R=0;R<T-2;R++){var O=i-h+R+32768&32767,F=O-o[O]+32768&32767;F>C&&(C=F,u=O)}}}h+=(l=u)-(u=o[l])+32768&32767}return f<<16|y},n.F._howLong=function(r,i,o){if(r[i]!=r[i-o]||r[i+1]!=r[i+1-o]||r[i+2]!=r[i+2-o])return 0;var a=i,c=Math.min(r.length,i+258);for(i+=3;i<c&&r[i]==r[i-o];)i++;return i-a},n.F._hash=function(r,i){return(r[i]<<8|r[i+1])+(r[i+2]<<4)&65535},n.saved=0,n.F._writeBlock=function(r,i,o,a,c,d,l,u,h){var f,y,k,T,C,R,O,F,U,b=n.F.U,B=n.F._putsF,m=n.F._putsE;b.lhst[256]++,y=(f=n.F.getTrees())[0],k=f[1],T=f[2],C=f[3],R=f[4],O=f[5],F=f[6],U=f[7];var g=32+(h+3&7?8-(h+3&7):0)+(l<<3),A=a+n.F.contSize(b.fltree,b.lhst)+n.F.contSize(b.fdtree,b.dhst),I=a+n.F.contSize(b.ltree,b.lhst)+n.F.contSize(b.dtree,b.dhst);I+=14+3*O+n.F.contSize(b.itree,b.ihst)+(2*b.ihst[16]+3*b.ihst[17]+7*b.ihst[18]);for(var N=0;N<286;N++)b.lhst[N]=0;for(N=0;N<30;N++)b.dhst[N]=0;for(N=0;N<19;N++)b.ihst[N]=0;var L=g<A&&g<I?0:A<I?1:2;if(B(u,h,r),B(u,h+1,L),h+=3,L==0){for(;7&h;)h++;h=n.F._copyExact(c,d,l,u,h)}else{var v,_;if(L==1&&(v=b.fltree,_=b.fdtree),L==2){n.F.makeCodes(b.ltree,y),n.F.revCodes(b.ltree,y),n.F.makeCodes(b.dtree,k),n.F.revCodes(b.dtree,k),n.F.makeCodes(b.itree,T),n.F.revCodes(b.itree,T),v=b.ltree,_=b.dtree,m(u,h,C-257),m(u,h+=5,R-1),m(u,h+=5,O-4),h+=4;for(var w=0;w<O;w++)m(u,h+3*w,b.itree[1+(b.ordr[w]<<1)]);h+=3*O,h=n.F._codeTiny(F,b.itree,u,h),h=n.F._codeTiny(U,b.itree,u,h)}for(var p=d,M=0;M<o;M+=2){for(var x=i[M],V=x>>>23,Z=p+(8388607&x);p<Z;)h=n.F._writeLit(c[p++],v,u,h);if(V!=0){var P=i[M+1],q=P>>16,$=P>>8&255,S=255&P;m(u,h=n.F._writeLit(257+$,v,u,h),V-b.of0[$]),h+=b.exb[$],B(u,h=n.F._writeLit(S,_,u,h),q-b.df0[S]),h+=b.dxb[S],p+=V}}h=n.F._writeLit(256,v,u,h)}return h},n.F._copyExact=function(r,i,o,a,c){var d=c>>>3;return a[d]=o,a[d+1]=o>>>8,a[d+2]=255-a[d],a[d+3]=255-a[d+1],d+=4,a.set(new Uint8Array(r.buffer,i,o),d),c+(o+4<<3)},n.F.getTrees=function(){for(var r=n.F.U,i=n.F._hufTree(r.lhst,r.ltree,15),o=n.F._hufTree(r.dhst,r.dtree,15),a=[],c=n.F._lenCodes(r.ltree,a),d=[],l=n.F._lenCodes(r.dtree,d),u=0;u<a.length;u+=2)r.ihst[a[u]]++;for(u=0;u<d.length;u+=2)r.ihst[d[u]]++;for(var h=n.F._hufTree(r.ihst,r.itree,7),f=19;f>4&&r.itree[1+(r.ordr[f-1]<<1)]==0;)f--;return[i,o,h,c,l,f,a,d]},n.F.getSecond=function(r){for(var i=[],o=0;o<r.length;o+=2)i.push(r[o+1]);return i},n.F.nonZero=function(r){for(var i="",o=0;o<r.length;o+=2)r[o+1]!=0&&(i+=(o>>1)+",");return i},n.F.contSize=function(r,i){for(var o=0,a=0;a<i.length;a++)o+=i[a]*r[1+(a<<1)];return o},n.F._codeTiny=function(r,i,o,a){for(var c=0;c<r.length;c+=2){var d=r[c],l=r[c+1];a=n.F._writeLit(d,i,o,a);var u=d==16?2:d==17?3:7;d>15&&(n.F._putsE(o,a,l,u),a+=u)}return a},n.F._lenCodes=function(r,i){for(var o=r.length;o!=2&&r[o-1]==0;)o-=2;for(var a=0;a<o;a+=2){var c=r[a+1],d=a+3<o?r[a+3]:-1,l=a+5<o?r[a+5]:-1,u=a==0?-1:r[a-1];if(c==0&&d==c&&l==c){for(var h=a+5;h+2<o&&r[h+2]==c;)h+=2;(f=Math.min(h+1-a>>>1,138))<11?i.push(17,f-3):i.push(18,f-11),a+=2*f-2}else if(c==u&&d==c&&l==c){for(h=a+5;h+2<o&&r[h+2]==c;)h+=2;var f=Math.min(h+1-a>>>1,6);i.push(16,f-3),a+=2*f-2}else i.push(c,0)}return o>>>1},n.F._hufTree=function(r,i,o){var a=[],c=r.length,d=i.length,l=0;for(l=0;l<d;l+=2)i[l]=0,i[l+1]=0;for(l=0;l<c;l++)r[l]!=0&&a.push({lit:l,f:r[l]});var u=a.length,h=a.slice(0);if(u==0)return 0;if(u==1){var f=a[0].lit;return h=f==0?1:0,i[1+(f<<1)]=1,i[1+(h<<1)]=1,1}a.sort(function(F,U){return F.f-U.f});var y=a[0],k=a[1],T=0,C=1,R=2;for(a[0]={lit:-1,f:y.f+k.f,l:y,r:k,d:0};C!=u-1;)y=T!=C&&(R==u||a[T].f<a[R].f)?a[T++]:a[R++],k=T!=C&&(R==u||a[T].f<a[R].f)?a[T++]:a[R++],a[C++]={lit:-1,f:y.f+k.f,l:y,r:k};var O=n.F.setDepth(a[C-1],0);for(O>o&&(n.F.restrictDepth(h,o,O),O=o),l=0;l<u;l++)i[1+(h[l].lit<<1)]=h[l].d;return O},n.F.setDepth=function(r,i){return r.lit!=-1?(r.d=i,i):Math.max(n.F.setDepth(r.l,i+1),n.F.setDepth(r.r,i+1))},n.F.restrictDepth=function(r,i,o){var a=0,c=1<<o-i,d=0;for(r.sort(function(u,h){return h.d==u.d?u.f-h.f:h.d-u.d}),a=0;a<r.length&&r[a].d>i;a++){var l=r[a].d;r[a].d=i,d+=c-(1<<o-l)}for(d>>>=o-i;d>0;)(l=r[a].d)<i?(r[a].d++,d-=1<<i-l-1):a++;for(;a>=0;a--)r[a].d==i&&d<0&&(r[a].d--,d++);d!=0&&console.log("debt left")},n.F._goodIndex=function(r,i){var o=0;return i[16|o]<=r&&(o|=16),i[8|o]<=r&&(o|=8),i[4|o]<=r&&(o|=4),i[2|o]<=r&&(o|=2),i[1|o]<=r&&(o|=1),o},n.F._writeLit=function(r,i,o,a){return n.F._putsF(o,a,i[r<<1]),a+i[1+(r<<1)]},n.F.inflate=function(r,i){var o=Uint8Array;if(r[0]==3&&r[1]==0)return i||new o(0);var a=n.F,c=a._bitsF,d=a._bitsE,l=a._decodeTiny,u=a.makeCodes,h=a.codes2map,f=a._get17,y=a.U,k=i==null;k&&(i=new o(r.length>>>2<<3));for(var T,C,R=0,O=0,F=0,U=0,b=0,B=0,m=0,g=0,A=0;R==0;)if(R=c(r,A,1),O=c(r,A+1,2),A+=3,O!=0){if(k&&(i=n.F._check(i,g+(1<<17))),O==1&&(T=y.flmap,C=y.fdmap,B=511,m=31),O==2){F=d(r,A,5)+257,U=d(r,A+5,5)+1,b=d(r,A+10,4)+4,A+=14;for(var I=0;I<38;I+=2)y.itree[I]=0,y.itree[I+1]=0;var N=1;for(I=0;I<b;I++){var L=d(r,A+3*I,3);y.itree[1+(y.ordr[I]<<1)]=L,L>N&&(N=L)}A+=3*b,u(y.itree,N),h(y.itree,N,y.imap),T=y.lmap,C=y.dmap,A=l(y.imap,(1<<N)-1,F+U,r,A,y.ttree);var v=a._copyOut(y.ttree,0,F,y.ltree);B=(1<<v)-1;var _=a._copyOut(y.ttree,F,U,y.dtree);m=(1<<_)-1,u(y.ltree,v),h(y.ltree,v,T),u(y.dtree,_),h(y.dtree,_,C)}for(;;){var w=T[f(r,A)&B];A+=15&w;var p=w>>>4;if(!(p>>>8))i[g++]=p;else{if(p==256)break;var M=g+p-254;if(p>264){var x=y.ldef[p-257];M=g+(x>>>3)+d(r,A,7&x),A+=7&x}var V=C[f(r,A)&m];A+=15&V;var Z=V>>>4,P=y.ddef[Z],q=(P>>>4)+c(r,A,15&P);for(A+=15&P,k&&(i=n.F._check(i,g+(1<<17)));g<M;)i[g]=i[g++-q],i[g]=i[g++-q],i[g]=i[g++-q],i[g]=i[g++-q];g=M}}}else{7&A&&(A+=8-(7&A));var $=4+(A>>>3),S=r[$-4]|r[$-3]<<8;k&&(i=n.F._check(i,g+S)),i.set(new o(r.buffer,r.byteOffset+$,S),g),A=$+S<<3,g+=S}return i.length==g?i:i.slice(0,g)},n.F._check=function(r,i){var o=r.length;if(i<=o)return r;var a=new Uint8Array(Math.max(o<<1,i));return a.set(r,0),a},n.F._decodeTiny=function(r,i,o,a,c,d){for(var l=n.F._bitsE,u=n.F._get17,h=0;h<o;){var f=r[u(a,c)&i];c+=15&f;var y=f>>>4;if(y<=15)d[h]=y,h++;else{var k=0,T=0;y==16?(T=3+l(a,c,2),c+=2,k=d[h-1]):y==17?(T=3+l(a,c,3),c+=3):y==18&&(T=11+l(a,c,7),c+=7);for(var C=h+T;h<C;)d[h]=k,h++}}return c},n.F._copyOut=function(r,i,o,a){for(var c=0,d=0,l=a.length>>>1;d<o;){var u=r[d+i];a[d<<1]=0,a[1+(d<<1)]=u,u>c&&(c=u),d++}for(;d<l;)a[d<<1]=0,a[1+(d<<1)]=0,d++;return c},n.F.makeCodes=function(r,i){for(var o,a,c,d,l=n.F.U,u=r.length,h=l.bl_count,f=0;f<=i;f++)h[f]=0;for(f=1;f<u;f+=2)h[r[f]]++;var y=l.next_code;for(o=0,h[0]=0,a=1;a<=i;a++)o=o+h[a-1]<<1,y[a]=o;for(c=0;c<u;c+=2)(d=r[c+1])!=0&&(r[c]=y[d],y[d]++)},n.F.codes2map=function(r,i,o){for(var a=r.length,c=n.F.U.rev15,d=0;d<a;d+=2)if(r[d+1]!=0)for(var l=d>>1,u=r[d+1],h=l<<4|u,f=i-u,y=r[d]<<f,k=y+(1<<f);y!=k;)o[c[y]>>>15-i]=h,y++},n.F.revCodes=function(r,i){for(var o=n.F.U.rev15,a=15-i,c=0;c<r.length;c+=2){var d=r[c]<<i-r[c+1];r[c]=o[d]>>>a}},n.F._putsE=function(r,i,o){o<<=7&i;var a=i>>>3;r[a]|=o,r[a+1]|=o>>>8},n.F._putsF=function(r,i,o){o<<=7&i;var a=i>>>3;r[a]|=o,r[a+1]|=o>>>8,r[a+2]|=o>>>16},n.F._bitsE=function(r,i,o){return(r[i>>>3]|r[1+(i>>>3)]<<8)>>>(7&i)&(1<<o)-1},n.F._bitsF=function(r,i,o){return(r[i>>>3]|r[1+(i>>>3)]<<8|r[2+(i>>>3)]<<16)>>>(7&i)&(1<<o)-1},n.F._get17=function(r,i){return(r[i>>>3]|r[1+(i>>>3)]<<8|r[2+(i>>>3)]<<16)>>>(7&i)},n.F._get25=function(r,i){return(r[i>>>3]|r[1+(i>>>3)]<<8|r[2+(i>>>3)]<<16|r[3+(i>>>3)]<<24)>>>(7&i)},n.F.U=(e=Uint16Array,t=Uint32Array,{next_code:new e(16),bl_count:new e(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[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,0,0,0],ldef:new e(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[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,0,0],ddef:new t(32),flmap:new e(512),fltree:[],fdmap:new e(32),fdtree:[],lmap:new e(32768),ltree:[],ttree:[],dmap:new e(32768),dtree:[],imap:new e(512),itree:[],rev15:new e(32768),lhst:new t(286),dhst:new t(30),ihst:new t(19),lits:new t(15e3),strt:new e(65536),prev:new e(32768)}),function(){for(var r=n.F.U,i=0;i<32768;i++){var o=i;o=(4278255360&(o=(4042322160&(o=(3435973836&(o=(2863311530&o)>>>1|(1431655765&o)<<1))>>>2|(858993459&o)<<2))>>>4|(252645135&o)<<4))>>>8|(16711935&o)<<8,r.rev15[i]=(o>>>16|o<<16)>>>17}function a(c,d,l){for(;d--!=0;)c.push(0,l)}for(i=0;i<32;i++)r.ldef[i]=r.of0[i]<<3|r.exb[i],r.ddef[i]=r.df0[i]<<4|r.dxb[i];a(r.fltree,144,8),a(r.fltree,112,9),a(r.fltree,24,7),a(r.fltree,8,8),n.F.makeCodes(r.fltree,9),n.F.codes2map(r.fltree,9,r.flmap),n.F.revCodes(r.fltree,9),a(r.fdtree,32,5),n.F.makeCodes(r.fdtree,5),n.F.codes2map(r.fdtree,5,r.fdmap),n.F.revCodes(r.fdtree,5),a(r.itree,19,0),a(r.ltree,286,0),a(r.dtree,30,0),a(r.ttree,320,0)}()})();var Rs=Bs({__proto__:null,default:An},[An]);const Ye=function(){var s={nextZero(l,u){for(;l[u]!=0;)u++;return u},readUshort:(l,u)=>l[u]<<8|l[u+1],writeUshort(l,u,h){l[u]=h>>8&255,l[u+1]=255&h},readUint:(l,u)=>16777216*l[u]+(l[u+1]<<16|l[u+2]<<8|l[u+3]),writeUint(l,u,h){l[u]=h>>24&255,l[u+1]=h>>16&255,l[u+2]=h>>8&255,l[u+3]=255&h},readASCII(l,u,h){let f="";for(let y=0;y<h;y++)f+=String.fromCharCode(l[u+y]);return f},writeASCII(l,u,h){for(let f=0;f<h.length;f++)l[u+f]=h.charCodeAt(f)},readBytes(l,u,h){const f=[];for(let y=0;y<h;y++)f.push(l[u+y]);return f},pad:l=>l.length<2?`0${l}`:l,readUTF8(l,u,h){let f,y="";for(let k=0;k<h;k++)y+=`%${s.pad(l[u+k].toString(16))}`;try{f=decodeURIComponent(y)}catch{return s.readASCII(l,u,h)}return f}};function e(l,u,h,f){const y=u*h,k=i(f),T=Math.ceil(u*k/8),C=new Uint8Array(4*y),R=new Uint32Array(C.buffer),{ctype:O}=f,{depth:F}=f,U=s.readUshort;if(O==6){const x=y<<2;if(F==8)for(var b=0;b<x;b+=4)C[b]=l[b],C[b+1]=l[b+1],C[b+2]=l[b+2],C[b+3]=l[b+3];if(F==16)for(b=0;b<x;b++)C[b]=l[b<<1]}else if(O==2){const x=f.tabs.tRNS;if(x==null){if(F==8)for(b=0;b<y;b++){var B=3*b;R[b]=255<<24|l[B+2]<<16|l[B+1]<<8|l[B]}if(F==16)for(b=0;b<y;b++)B=6*b,R[b]=255<<24|l[B+4]<<16|l[B+2]<<8|l[B]}else{var m=x[0];const V=x[1],Z=x[2];if(F==8)for(b=0;b<y;b++){var g=b<<2;B=3*b,R[b]=255<<24|l[B+2]<<16|l[B+1]<<8|l[B],l[B]==m&&l[B+1]==V&&l[B+2]==Z&&(C[g+3]=0)}if(F==16)for(b=0;b<y;b++)g=b<<2,B=6*b,R[b]=255<<24|l[B+4]<<16|l[B+2]<<8|l[B],U(l,B)==m&&U(l,B+2)==V&&U(l,B+4)==Z&&(C[g+3]=0)}}else if(O==3){const x=f.tabs.PLTE,V=f.tabs.tRNS,Z=V?V.length:0;if(F==1)for(var A=0;A<h;A++){var I=A*T,N=A*u;for(b=0;b<u;b++){g=N+b<<2;var L=3*(v=l[I+(b>>3)]>>7-((7&b)<<0)&1);C[g]=x[L],C[g+1]=x[L+1],C[g+2]=x[L+2],C[g+3]=v<Z?V[v]:255}}if(F==2)for(A=0;A<h;A++)for(I=A*T,N=A*u,b=0;b<u;b++)g=N+b<<2,L=3*(v=l[I+(b>>2)]>>6-((3&b)<<1)&3),C[g]=x[L],C[g+1]=x[L+1],C[g+2]=x[L+2],C[g+3]=v<Z?V[v]:255;if(F==4)for(A=0;A<h;A++)for(I=A*T,N=A*u,b=0;b<u;b++)g=N+b<<2,L=3*(v=l[I+(b>>1)]>>4-((1&b)<<2)&15),C[g]=x[L],C[g+1]=x[L+1],C[g+2]=x[L+2],C[g+3]=v<Z?V[v]:255;if(F==8)for(b=0;b<y;b++){var v;g=b<<2,L=3*(v=l[b]),C[g]=x[L],C[g+1]=x[L+1],C[g+2]=x[L+2],C[g+3]=v<Z?V[v]:255}}else if(O==4){if(F==8)for(b=0;b<y;b++){g=b<<2;var _=l[w=b<<1];C[g]=_,C[g+1]=_,C[g+2]=_,C[g+3]=l[w+1]}if(F==16)for(b=0;b<y;b++){var w;g=b<<2,_=l[w=b<<2],C[g]=_,C[g+1]=_,C[g+2]=_,C[g+3]=l[w+2]}}else if(O==0)for(m=f.tabs.tRNS?f.tabs.tRNS:-1,A=0;A<h;A++){const x=A*T,V=A*u;if(F==1)for(var p=0;p<u;p++){var M=(_=255*(l[x+(p>>>3)]>>>7-(7&p)&1))==255*m?0:255;R[V+p]=M<<24|_<<16|_<<8|_}else if(F==2)for(p=0;p<u;p++)M=(_=85*(l[x+(p>>>2)]>>>6-((3&p)<<1)&3))==85*m?0:255,R[V+p]=M<<24|_<<16|_<<8|_;else if(F==4)for(p=0;p<u;p++)M=(_=17*(l[x+(p>>>1)]>>>4-((1&p)<<2)&15))==17*m?0:255,R[V+p]=M<<24|_<<16|_<<8|_;else if(F==8)for(p=0;p<u;p++)M=(_=l[x+p])==m?0:255,R[V+p]=M<<24|_<<16|_<<8|_;else if(F==16)for(p=0;p<u;p++)_=l[x+(p<<1)],M=U(l,x+(p<<1))==m?0:255,R[V+p]=M<<24|_<<16|_<<8|_}return C}function t(l,u,h,f){const y=i(l),k=Math.ceil(h*y/8),T=new Uint8Array((k+1+l.interlace)*f);return u=l.tabs.CgBI?r(u,T):n(u,T),l.interlace==0?u=o(u,l,0,h,f):l.interlace==1&&(u=function(R,O){const F=O.width,U=O.height,b=i(O),B=b>>3,m=Math.ceil(F*b/8),g=new Uint8Array(U*m);let A=0;const I=[0,0,4,0,2,0,1],N=[0,4,0,2,0,1,0],L=[8,8,8,4,4,2,2],v=[8,8,4,4,2,2,1];let _=0;for(;_<7;){const p=L[_],M=v[_];let x=0,V=0,Z=I[_];for(;Z<U;)Z+=p,V++;let P=N[_];for(;P<F;)P+=M,x++;const q=Math.ceil(x*b/8);o(R,O,A,x,V);let $=0,S=I[_];for(;S<U;){let X=N[_],ce=A+$*q<<3;for(;X<F;){var w;if(b==1&&(w=(w=R[ce>>3])>>7-(7&ce)&1,g[S*m+(X>>3)]|=w<<7-((7&X)<<0)),b==2&&(w=(w=R[ce>>3])>>6-(7&ce)&3,g[S*m+(X>>2)]|=w<<6-((3&X)<<1)),b==4&&(w=(w=R[ce>>3])>>4-(7&ce)&15,g[S*m+(X>>1)]|=w<<4-((1&X)<<2)),b>=8){const te=S*m+X*B;for(let Y=0;Y<B;Y++)g[te+Y]=R[(ce>>3)+Y]}ce+=b,X+=M}$++,S+=p}x*V!=0&&(A+=V*(1+q)),_+=1}return g}(u,l)),u}function n(l,u){return r(new Uint8Array(l.buffer,2,l.length-6),u)}var r=function(){const l={H:{}};return l.H.N=function(u,h){const f=Uint8Array;let y,k,T=0,C=0,R=0,O=0,F=0,U=0,b=0,B=0,m=0;if(u[0]==3&&u[1]==0)return h||new f(0);const g=l.H,A=g.b,I=g.e,N=g.R,L=g.n,v=g.A,_=g.Z,w=g.m,p=h==null;for(p&&(h=new f(u.length>>>2<<5));T==0;)if(T=A(u,m,1),C=A(u,m+1,2),m+=3,C!=0){if(p&&(h=l.H.W(h,B+(1<<17))),C==1&&(y=w.J,k=w.h,U=511,b=31),C==2){R=I(u,m,5)+257,O=I(u,m+5,5)+1,F=I(u,m+10,4)+4,m+=14;let x=1;for(var M=0;M<38;M+=2)w.Q[M]=0,w.Q[M+1]=0;for(M=0;M<F;M++){const P=I(u,m+3*M,3);w.Q[1+(w.X[M]<<1)]=P,P>x&&(x=P)}m+=3*F,L(w.Q,x),v(w.Q,x,w.u),y=w.w,k=w.d,m=N(w.u,(1<<x)-1,R+O,u,m,w.v);const V=g.V(w.v,0,R,w.C);U=(1<<V)-1;const Z=g.V(w.v,R,O,w.D);b=(1<<Z)-1,L(w.C,V),v(w.C,V,y),L(w.D,Z),v(w.D,Z,k)}for(;;){const x=y[_(u,m)&U];m+=15&x;const V=x>>>4;if(!(V>>>8))h[B++]=V;else{if(V==256)break;{let Z=B+V-254;if(V>264){const X=w.q[V-257];Z=B+(X>>>3)+I(u,m,7&X),m+=7&X}const P=k[_(u,m)&b];m+=15&P;const q=P>>>4,$=w.c[q],S=($>>>4)+A(u,m,15&$);for(m+=15&$;B<Z;)h[B]=h[B++-S],h[B]=h[B++-S],h[B]=h[B++-S],h[B]=h[B++-S];B=Z}}}}else{7&m&&(m+=8-(7&m));const x=4+(m>>>3),V=u[x-4]|u[x-3]<<8;p&&(h=l.H.W(h,B+V)),h.set(new f(u.buffer,u.byteOffset+x,V),B),m=x+V<<3,B+=V}return h.length==B?h:h.slice(0,B)},l.H.W=function(u,h){const f=u.length;if(h<=f)return u;const y=new Uint8Array(f<<1);return y.set(u,0),y},l.H.R=function(u,h,f,y,k,T){const C=l.H.e,R=l.H.Z;let O=0;for(;O<f;){const F=u[R(y,k)&h];k+=15&F;const U=F>>>4;if(U<=15)T[O]=U,O++;else{let b=0,B=0;U==16?(B=3+C(y,k,2),k+=2,b=T[O-1]):U==17?(B=3+C(y,k,3),k+=3):U==18&&(B=11+C(y,k,7),k+=7);const m=O+B;for(;O<m;)T[O]=b,O++}}return k},l.H.V=function(u,h,f,y){let k=0,T=0;const C=y.length>>>1;for(;T<f;){const R=u[T+h];y[T<<1]=0,y[1+(T<<1)]=R,R>k&&(k=R),T++}for(;T<C;)y[T<<1]=0,y[1+(T<<1)]=0,T++;return k},l.H.n=function(u,h){const f=l.H.m,y=u.length;let k,T,C,R;const O=f.j;for(var F=0;F<=h;F++)O[F]=0;for(F=1;F<y;F+=2)O[u[F]]++;const U=f.K;for(k=0,O[0]=0,T=1;T<=h;T++)k=k+O[T-1]<<1,U[T]=k;for(C=0;C<y;C+=2)R=u[C+1],R!=0&&(u[C]=U[R],U[R]++)},l.H.A=function(u,h,f){const y=u.length,k=l.H.m.r;for(let T=0;T<y;T+=2)if(u[T+1]!=0){const C=T>>1,R=u[T+1],O=C<<4|R,F=h-R;let U=u[T]<<F;const b=U+(1<<F);for(;U!=b;)f[k[U]>>>15-h]=O,U++}},l.H.l=function(u,h){const f=l.H.m.r,y=15-h;for(let k=0;k<u.length;k+=2){const T=u[k]<<h-u[k+1];u[k]=f[T]>>>y}},l.H.M=function(u,h,f){f<<=7&h;const y=h>>>3;u[y]|=f,u[y+1]|=f>>>8},l.H.I=function(u,h,f){f<<=7&h;const y=h>>>3;u[y]|=f,u[y+1]|=f>>>8,u[y+2]|=f>>>16},l.H.e=function(u,h,f){return(u[h>>>3]|u[1+(h>>>3)]<<8)>>>(7&h)&(1<<f)-1},l.H.b=function(u,h,f){return(u[h>>>3]|u[1+(h>>>3)]<<8|u[2+(h>>>3)]<<16)>>>(7&h)&(1<<f)-1},l.H.Z=function(u,h){return(u[h>>>3]|u[1+(h>>>3)]<<8|u[2+(h>>>3)]<<16)>>>(7&h)},l.H.i=function(u,h){return(u[h>>>3]|u[1+(h>>>3)]<<8|u[2+(h>>>3)]<<16|u[3+(h>>>3)]<<24)>>>(7&h)},l.H.m=function(){const u=Uint16Array,h=Uint32Array;return{K:new u(16),j:new u(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[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,0,0,0],q:new u(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[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,0,0],c:new h(32),J:new u(512),_:[],h:new u(32),$:[],w:new u(32768),C:[],v:[],d:new u(32768),D:[],u:new u(512),Q:[],r:new u(32768),s:new h(286),Y:new h(30),a:new h(19),t:new h(15e3),k:new u(65536),g:new u(32768)}}(),function(){const u=l.H.m;for(var h=0;h<32768;h++){let y=h;y=(2863311530&y)>>>1|(1431655765&y)<<1,y=(3435973836&y)>>>2|(858993459&y)<<2,y=(4042322160&y)>>>4|(252645135&y)<<4,y=(4278255360&y)>>>8|(16711935&y)<<8,u.r[h]=(y>>>16|y<<16)>>>17}function f(y,k,T){for(;k--!=0;)y.push(0,T)}for(h=0;h<32;h++)u.q[h]=u.S[h]<<3|u.T[h],u.c[h]=u.p[h]<<4|u.z[h];f(u._,144,8),f(u._,112,9),f(u._,24,7),f(u._,8,8),l.H.n(u._,9),l.H.A(u._,9,u.J),l.H.l(u._,9),f(u.$,32,5),l.H.n(u.$,5),l.H.A(u.$,5,u.h),l.H.l(u.$,5),f(u.Q,19,0),f(u.C,286,0),f(u.D,30,0),f(u.v,320,0)}(),l.H.N}();function i(l){return[1,null,3,1,2,null,4][l.ctype]*l.depth}function o(l,u,h,f,y){let k=i(u);const T=Math.ceil(f*k/8);let C,R;k=Math.ceil(k/8);let O=l[h],F=0;if(O>1&&(l[h]=[0,0,1][O-2]),O==3)for(F=k;F<T;F++)l[F+1]=l[F+1]+(l[F+1-k]>>>1)&255;for(let U=0;U<y;U++)if(C=h+U*T,R=C+U+1,O=l[R-1],F=0,O==0)for(;F<T;F++)l[C+F]=l[R+F];else if(O==1){for(;F<k;F++)l[C+F]=l[R+F];for(;F<T;F++)l[C+F]=l[R+F]+l[C+F-k]}else if(O==2)for(;F<T;F++)l[C+F]=l[R+F]+l[C+F-T];else if(O==3){for(;F<k;F++)l[C+F]=l[R+F]+(l[C+F-T]>>>1);for(;F<T;F++)l[C+F]=l[R+F]+(l[C+F-T]+l[C+F-k]>>>1)}else{for(;F<k;F++)l[C+F]=l[R+F]+a(0,l[C+F-T],0);for(;F<T;F++)l[C+F]=l[R+F]+a(l[C+F-k],l[C+F-T],l[C+F-k-T])}return l}function a(l,u,h){const f=l+u-h,y=f-l,k=f-u,T=f-h;return y*y<=k*k&&y*y<=T*T?l:k*k<=T*T?u:h}function c(l,u,h){h.width=s.readUint(l,u),u+=4,h.height=s.readUint(l,u),u+=4,h.depth=l[u],u++,h.ctype=l[u],u++,h.compress=l[u],u++,h.filter=l[u],u++,h.interlace=l[u],u++}function d(l,u,h,f,y,k,T,C,R){const O=Math.min(u,y),F=Math.min(h,k);let U=0,b=0;for(let _=0;_<F;_++)for(let w=0;w<O;w++)if(T>=0&&C>=0?(U=_*u+w<<2,b=(C+_)*y+T+w<<2):(U=(-C+_)*u-T+w<<2,b=_*y+w<<2),R==0)f[b]=l[U],f[b+1]=l[U+1],f[b+2]=l[U+2],f[b+3]=l[U+3];else if(R==1){var B=l[U+3]*.00392156862745098,m=l[U]*B,g=l[U+1]*B,A=l[U+2]*B,I=f[b+3]*(1/255),N=f[b]*I,L=f[b+1]*I,v=f[b+2]*I;const p=1-B,M=B+I*p,x=M==0?0:1/M;f[b+3]=255*M,f[b+0]=(m+N*p)*x,f[b+1]=(g+L*p)*x,f[b+2]=(A+v*p)*x}else if(R==2)B=l[U+3],m=l[U],g=l[U+1],A=l[U+2],I=f[b+3],N=f[b],L=f[b+1],v=f[b+2],B==I&&m==N&&g==L&&A==v?(f[b]=0,f[b+1]=0,f[b+2]=0,f[b+3]=0):(f[b]=m,f[b+1]=g,f[b+2]=A,f[b+3]=B);else if(R==3){if(B=l[U+3],m=l[U],g=l[U+1],A=l[U+2],I=f[b+3],N=f[b],L=f[b+1],v=f[b+2],B==I&&m==N&&g==L&&A==v)continue;if(B<220&&I>20)return!1}return!0}return{decode:function(u){const h=new Uint8Array(u);let f=8;const y=s,k=y.readUshort,T=y.readUint,C={tabs:{},frames:[]},R=new Uint8Array(h.length);let O,F=0,U=0;const b=[137,80,78,71,13,10,26,10];for(var B=0;B<8;B++)if(h[B]!=b[B])throw"The input is not a PNG file!";for(;f<h.length;){const _=y.readUint(h,f);f+=4;const w=y.readASCII(h,f,4);if(f+=4,w=="IHDR")c(h,f,C);else if(w=="iCCP"){for(var m=f;h[m]!=0;)m++;y.readASCII(h,f,m-f),h[m+1];const p=h.slice(m+2,f+_);let M=null;try{M=n(p)}catch{M=r(p)}C.tabs[w]=M}else if(w=="CgBI")C.tabs[w]=h.slice(f,f+4);else if(w=="IDAT"){for(B=0;B<_;B++)R[F+B]=h[f+B];F+=_}else if(w=="acTL")C.tabs[w]={num_frames:T(h,f),num_plays:T(h,f+4)},O=new Uint8Array(h.length);else if(w=="fcTL"){U!=0&&((v=C.frames[C.frames.length-1]).data=t(C,O.slice(0,U),v.rect.width,v.rect.height),U=0);const p={x:T(h,f+12),y:T(h,f+16),width:T(h,f+4),height:T(h,f+8)};let M=k(h,f+22);M=k(h,f+20)/(M==0?100:M);const x={rect:p,delay:Math.round(1e3*M),dispose:h[f+24],blend:h[f+25]};C.frames.push(x)}else if(w=="fdAT"){for(B=0;B<_-4;B++)O[U+B]=h[f+B+4];U+=_-4}else if(w=="pHYs")C.tabs[w]=[y.readUint(h,f),y.readUint(h,f+4),h[f+8]];else if(w=="cHRM")for(C.tabs[w]=[],B=0;B<8;B++)C.tabs[w].push(y.readUint(h,f+4*B));else if(w=="tEXt"||w=="zTXt"){C.tabs[w]==null&&(C.tabs[w]={});var g=y.nextZero(h,f),A=y.readASCII(h,f,g-f),I=f+_-g-1;if(w=="tEXt")L=y.readASCII(h,g+1,I);else{var N=n(h.slice(g+2,g+2+I));L=y.readUTF8(N,0,N.length)}C.tabs[w][A]=L}else if(w=="iTXt"){C.tabs[w]==null&&(C.tabs[w]={}),g=0,m=f,g=y.nextZero(h,m),A=y.readASCII(h,m,g-m);const p=h[m=g+1];var L;h[m+1],m+=2,g=y.nextZero(h,m),y.readASCII(h,m,g-m),m=g+1,g=y.nextZero(h,m),y.readUTF8(h,m,g-m),I=_-((m=g+1)-f),p==0?L=y.readUTF8(h,m,I):(N=n(h.slice(m,m+I)),L=y.readUTF8(N,0,N.length)),C.tabs[w][A]=L}else if(w=="PLTE")C.tabs[w]=y.readBytes(h,f,_);else if(w=="hIST"){const p=C.tabs.PLTE.length/3;for(C.tabs[w]=[],B=0;B<p;B++)C.tabs[w].push(k(h,f+2*B))}else if(w=="tRNS")C.ctype==3?C.tabs[w]=y.readBytes(h,f,_):C.ctype==0?C.tabs[w]=k(h,f):C.ctype==2&&(C.tabs[w]=[k(h,f),k(h,f+2),k(h,f+4)]);else if(w=="gAMA")C.tabs[w]=y.readUint(h,f)/1e5;else if(w=="sRGB")C.tabs[w]=h[f];else if(w=="bKGD")C.ctype==0||C.ctype==4?C.tabs[w]=[k(h,f)]:C.ctype==2||C.ctype==6?C.tabs[w]=[k(h,f),k(h,f+2),k(h,f+4)]:C.ctype==3&&(C.tabs[w]=h[f]);else if(w=="IEND")break;f+=_,y.readUint(h,f),f+=4}var v;return U!=0&&((v=C.frames[C.frames.length-1]).data=t(C,O.slice(0,U),v.rect.width,v.rect.height)),C.data=t(C,R,C.width,C.height),delete C.compress,delete C.interlace,delete C.filter,C},toRGBA8:function(u){const h=u.width,f=u.height;if(u.tabs.acTL==null)return[e(u.data,h,f,u).buffer];const y=[];u.frames[0].data==null&&(u.frames[0].data=u.data);const k=h*f*4,T=new Uint8Array(k),C=new Uint8Array(k),R=new Uint8Array(k);for(let F=0;F<u.frames.length;F++){const U=u.frames[F],b=U.rect.x,B=U.rect.y,m=U.rect.width,g=U.rect.height,A=e(U.data,m,g,u);if(F!=0)for(var O=0;O<k;O++)R[O]=T[O];if(U.blend==0?d(A,m,g,T,h,f,b,B,0):U.blend==1&&d(A,m,g,T,h,f,b,B,1),y.push(T.buffer.slice(0)),U.dispose!=0){if(U.dispose==1)d(C,m,g,T,h,f,b,B,0);else if(U.dispose==2)for(O=0;O<k;O++)T[O]=R[O]}}return y},_paeth:a,_copyTile:d,_bin:s}}();(function(){const{_copyTile:s}=Ye,{_bin:e}=Ye,t=Ye._paeth;var n={table:function(){const m=new Uint32Array(256);for(let g=0;g<256;g++){let A=g;for(let I=0;I<8;I++)1&A?A=3988292384^A>>>1:A>>>=1;m[g]=A}return m}(),update(m,g,A,I){for(let N=0;N<I;N++)m=n.table[255&(m^g[A+N])]^m>>>8;return m},crc:(m,g,A)=>4294967295^n.update(4294967295,m,g,A)};function r(m,g,A,I){g[A]+=m[0]*I>>4,g[A+1]+=m[1]*I>>4,g[A+2]+=m[2]*I>>4,g[A+3]+=m[3]*I>>4}function i(m){return Math.max(0,Math.min(255,m))}function o(m,g){const A=m[0]-g[0],I=m[1]-g[1],N=m[2]-g[2],L=m[3]-g[3];return A*A+I*I+N*N+L*L}function a(m,g,A,I,N,L,v){v==null&&(v=1);const _=I.length,w=[];for(var p=0;p<_;p++){const S=I[p];w.push([S>>>0&255,S>>>8&255,S>>>16&255,S>>>24&255])}for(p=0;p<_;p++){let S=4294967295;for(var M=0,x=0;x<_;x++){var V=o(w[p],w[x]);x!=p&&V<S&&(S=V,M=x)}}const Z=new Uint32Array(N.buffer),P=new Int16Array(g*A*4),q=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(p=0;p<q.length;p++)q[p]=255*((q[p]+.5)/16-.5);for(let S=0;S<A;S++)for(let X=0;X<g;X++){var $;p=4*(S*g+X),v!=2?$=[i(m[p]+P[p]),i(m[p+1]+P[p+1]),i(m[p+2]+P[p+2]),i(m[p+3]+P[p+3])]:(V=q[4*(3&S)+(3&X)],$=[i(m[p]+V),i(m[p+1]+V),i(m[p+2]+V),i(m[p+3]+V)]),M=0;let ce=16777215;for(x=0;x<_;x++){const ae=o($,w[x]);ae<ce&&(ce=ae,M=x)}const te=w[M],Y=[$[0]-te[0],$[1]-te[1],$[2]-te[2],$[3]-te[3]];v==1&&(X!=g-1&&r(Y,P,p+4,7),S!=A-1&&(X!=0&&r(Y,P,p+4*g-4,3),r(Y,P,p+4*g,5),X!=g-1&&r(Y,P,p+4*g+4,1))),L[p>>2]=M,Z[p>>2]=I[M]}}function c(m,g,A,I,N){N==null&&(N={});const{crc:L}=n,v=e.writeUint,_=e.writeUshort,w=e.writeASCII;let p=8;const M=m.frames.length>1;let x,V=!1,Z=33+(M?20:0);if(N.sRGB!=null&&(Z+=13),N.pHYs!=null&&(Z+=21),N.iCCP!=null&&(x=pako.deflate(N.iCCP),Z+=21+x.length+4),m.ctype==3){for(var P=m.plte.length,q=0;q<P;q++)m.plte[q]>>>24!=255&&(V=!0);Z+=8+3*P+4+(V?8+1*P+4:0)}for(var $=0;$<m.frames.length;$++)M&&(Z+=38),Z+=(te=m.frames[$]).cimg.length+12,$!=0&&(Z+=4);Z+=12;const S=new Uint8Array(Z),X=[137,80,78,71,13,10,26,10];for(q=0;q<8;q++)S[q]=X[q];if(v(S,p,13),p+=4,w(S,p,"IHDR"),p+=4,v(S,p,g),p+=4,v(S,p,A),p+=4,S[p]=m.depth,p++,S[p]=m.ctype,p++,S[p]=0,p++,S[p]=0,p++,S[p]=0,p++,v(S,p,L(S,p-17,17)),p+=4,N.sRGB!=null&&(v(S,p,1),p+=4,w(S,p,"sRGB"),p+=4,S[p]=N.sRGB,p++,v(S,p,L(S,p-5,5)),p+=4),N.iCCP!=null){const Y=13+x.length;v(S,p,Y),p+=4,w(S,p,"iCCP"),p+=4,w(S,p,"ICC profile"),p+=11,p+=2,S.set(x,p),p+=x.length,v(S,p,L(S,p-(Y+4),Y+4)),p+=4}if(N.pHYs!=null&&(v(S,p,9),p+=4,w(S,p,"pHYs"),p+=4,v(S,p,N.pHYs[0]),p+=4,v(S,p,N.pHYs[1]),p+=4,S[p]=N.pHYs[2],p++,v(S,p,L(S,p-13,13)),p+=4),M&&(v(S,p,8),p+=4,w(S,p,"acTL"),p+=4,v(S,p,m.frames.length),p+=4,v(S,p,N.loop!=null?N.loop:0),p+=4,v(S,p,L(S,p-12,12)),p+=4),m.ctype==3){for(v(S,p,3*(P=m.plte.length)),p+=4,w(S,p,"PLTE"),p+=4,q=0;q<P;q++){const Y=3*q,ae=m.plte[q],me=255&ae,Fe=ae>>>8&255,Et=ae>>>16&255;S[p+Y+0]=me,S[p+Y+1]=Fe,S[p+Y+2]=Et}if(p+=3*P,v(S,p,L(S,p-3*P-4,3*P+4)),p+=4,V){for(v(S,p,P),p+=4,w(S,p,"tRNS"),p+=4,q=0;q<P;q++)S[p+q]=m.plte[q]>>>24&255;p+=P,v(S,p,L(S,p-P-4,P+4)),p+=4}}let ce=0;for($=0;$<m.frames.length;$++){var te=m.frames[$];M&&(v(S,p,26),p+=4,w(S,p,"fcTL"),p+=4,v(S,p,ce++),p+=4,v(S,p,te.rect.width),p+=4,v(S,p,te.rect.height),p+=4,v(S,p,te.rect.x),p+=4,v(S,p,te.rect.y),p+=4,_(S,p,I[$]),p+=2,_(S,p,1e3),p+=2,S[p]=te.dispose,p++,S[p]=te.blend,p++,v(S,p,L(S,p-30,30)),p+=4);const Y=te.cimg;v(S,p,(P=Y.length)+($==0?0:4)),p+=4;const ae=p;w(S,p,$==0?"IDAT":"fdAT"),p+=4,$!=0&&(v(S,p,ce++),p+=4),S.set(Y,p),p+=P,v(S,p,L(S,ae,p-ae)),p+=4}return v(S,p,0),p+=4,w(S,p,"IEND"),p+=4,v(S,p,L(S,p-4,4)),p+=4,S.buffer}function d(m,g,A){for(let I=0;I<m.frames.length;I++){const N=m.frames[I];N.rect.width;const L=N.rect.height,v=new Uint8Array(L*N.bpl+L);N.cimg=f(N.img,L,N.bpp,N.bpl,v,g,A)}}function l(m,g,A,I,N){const L=N[0],v=N[1],_=N[2],w=N[3],p=N[4],M=N[5];let x=6,V=8,Z=255;for(var P=0;P<m.length;P++){const Le=new Uint8Array(m[P]);for(var q=Le.length,$=0;$<q;$+=4)Z&=Le[$+3]}const S=Z!=255,X=function(de,re,ye,Ue,be,xe){const ge=[];for(var ee=0;ee<de.length;ee++){const _e=new Uint8Array(de[ee]),$e=new Uint32Array(_e.buffer);var Ve;let De=0,Me=0,rt=re,ft=ye,Qt=Ue?1:0;if(ee!=0){const xn=xe||Ue||ee==1||ge[ee-2].dispose!=0?1:2;let Yt=0,ue=1e9;for(let ze=0;ze<xn;ze++){var Re=new Uint8Array(de[ee-1-ze]);const pt=new Uint32Array(de[ee-1-ze]);let _t=re,Bt=ye,en=-1,hn=-1;for(let Vt=0;Vt<ye;Vt++)for(let Ht=0;Ht<re;Ht++)$e[Ne=Vt*re+Ht]!=pt[Ne]&&(Ht<_t&&(_t=Ht),Ht>en&&(en=Ht),Vt<Bt&&(Bt=Vt),Vt>hn&&(hn=Vt));en==-1&&(_t=Bt=en=hn=0),be&&((1&_t)==1&&_t--,(1&Bt)==1&&Bt--);const Yr=(en-_t+1)*(hn-Bt+1);Yr<ue&&(ue=Yr,Yt=ze,De=_t,Me=Bt,rt=en-_t+1,ft=hn-Bt+1)}Re=new Uint8Array(de[ee-1-Yt]),Yt==1&&(ge[ee-1].dispose=2),Ve=new Uint8Array(rt*ft*4),s(Re,re,ye,Ve,rt,ft,-De,-Me,0),Qt=s(_e,re,ye,Ve,rt,ft,-De,-Me,3)?1:0,Qt==1?h(_e,re,ye,Ve,{x:De,y:Me,width:rt,height:ft}):s(_e,re,ye,Ve,rt,ft,-De,-Me,0)}else Ve=_e.slice(0);ge.push({rect:{x:De,y:Me,width:rt,height:ft},img:Ve,blend:Qt,dispose:0})}if(Ue)for(ee=0;ee<ge.length;ee++){if((ut=ge[ee]).blend==1)continue;const _e=ut.rect,$e=ge[ee-1].rect,De=Math.min(_e.x,$e.x),Me=Math.min(_e.y,$e.y),rt={x:De,y:Me,width:Math.max(_e.x+_e.width,$e.x+$e.width)-De,height:Math.max(_e.y+_e.height,$e.y+$e.height)-Me};ge[ee-1].dispose=1,ee-1!=0&&u(de,re,ye,ge,ee-1,rt,be),u(de,re,ye,ge,ee,rt,be)}let ht=0;if(de.length!=1)for(var Ne=0;Ne<ge.length;Ne++){var ut;ht+=(ut=ge[Ne]).rect.width*ut.rect.height}return ge}(m,g,A,L,v,_),ce={},te=[],Y=[];if(I!=0){const Le=[];for($=0;$<X.length;$++)Le.push(X[$].img.buffer);const de=function(be){let xe=0;for(var ge=0;ge<be.length;ge++)xe+=be[ge].byteLength;const ee=new Uint8Array(xe);let Ve=0;for(ge=0;ge<be.length;ge++){const Re=new Uint8Array(be[ge]),ht=Re.length;for(let Ne=0;Ne<ht;Ne+=4){let ut=Re[Ne],_e=Re[Ne+1],$e=Re[Ne+2];const De=Re[Ne+3];De==0&&(ut=_e=$e=0),ee[Ve+Ne]=ut,ee[Ve+Ne+1]=_e,ee[Ve+Ne+2]=$e,ee[Ve+Ne+3]=De}Ve+=ht}return ee.buffer}(Le),re=k(de,I);for($=0;$<re.plte.length;$++)te.push(re.plte[$].est.rgba);let ye=0;for($=0;$<X.length;$++){const Ue=(me=X[$]).img.length;var ae=new Uint8Array(re.inds.buffer,ye>>2,Ue>>2);Y.push(ae);const be=new Uint8Array(re.abuf,ye,Ue);M&&a(me.img,me.rect.width,me.rect.height,te,be,ae),me.img.set(be),ye+=Ue}}else for(P=0;P<X.length;P++){var me=X[P];const Le=new Uint32Array(me.img.buffer);var Fe=me.rect.width;for(q=Le.length,ae=new Uint8Array(q),Y.push(ae),$=0;$<q;$++){const de=Le[$];if($!=0&&de==Le[$-1])ae[$]=ae[$-1];else if($>Fe&&de==Le[$-Fe])ae[$]=ae[$-Fe];else{let re=ce[de];if(re==null&&(ce[de]=re=te.length,te.push(de),te.length>=300))break;ae[$]=re}}}const Et=te.length;for(Et<=256&&p==0&&(V=Et<=2?1:Et<=4?2:Et<=16?4:8,V=Math.max(V,w)),P=0;P<X.length;P++){(me=X[P]).rect.x,me.rect.y,Fe=me.rect.width;const Le=me.rect.height;let de=me.img;new Uint32Array(de.buffer);let re=4*Fe,ye=4;if(Et<=256&&p==0){re=Math.ceil(V*Fe/8);var Ke=new Uint8Array(re*Le);const Ue=Y[P];for(let be=0;be<Le;be++){$=be*re;const xe=be*Fe;if(V==8)for(var fe=0;fe<Fe;fe++)Ke[$+fe]=Ue[xe+fe];else if(V==4)for(fe=0;fe<Fe;fe++)Ke[$+(fe>>1)]|=Ue[xe+fe]<<4-4*(1&fe);else if(V==2)for(fe=0;fe<Fe;fe++)Ke[$+(fe>>2)]|=Ue[xe+fe]<<6-2*(3&fe);else if(V==1)for(fe=0;fe<Fe;fe++)Ke[$+(fe>>3)]|=Ue[xe+fe]<<7-1*(7&fe)}de=Ke,x=3,ye=1}else if(S==0&&X.length==1){Ke=new Uint8Array(Fe*Le*3);const Ue=Fe*Le;for($=0;$<Ue;$++){const be=3*$,xe=4*$;Ke[be]=de[xe],Ke[be+1]=de[xe+1],Ke[be+2]=de[xe+2]}de=Ke,x=2,ye=3,re=3*Fe}me.img=de,me.bpl=re,me.bpp=ye}return{ctype:x,depth:V,plte:te,frames:X}}function u(m,g,A,I,N,L,v){const _=Uint8Array,w=Uint32Array,p=new _(m[N-1]),M=new w(m[N-1]),x=N+1<m.length?new _(m[N+1]):null,V=new _(m[N]),Z=new w(V.buffer);let P=g,q=A,$=-1,S=-1;for(let ce=0;ce<L.height;ce++)for(let te=0;te<L.width;te++){const Y=L.x+te,ae=L.y+ce,me=ae*g+Y,Fe=Z[me];Fe==0||I[N-1].dispose==0&&M[me]==Fe&&(x==null||x[4*me+3]!=0)||(Y<P&&(P=Y),Y>$&&($=Y),ae<q&&(q=ae),ae>S&&(S=ae))}$==-1&&(P=q=$=S=0),v&&((1&P)==1&&P--,(1&q)==1&&q--),L={x:P,y:q,width:$-P+1,height:S-q+1};const X=I[N];X.rect=L,X.blend=1,X.img=new Uint8Array(L.width*L.height*4),I[N-1].dispose==0?(s(p,g,A,X.img,L.width,L.height,-L.x,-L.y,0),h(V,g,A,X.img,L)):s(V,g,A,X.img,L.width,L.height,-L.x,-L.y,0)}function h(m,g,A,I,N){s(m,g,A,I,N.width,N.height,-N.x,-N.y,2)}function f(m,g,A,I,N,L,v){const _=[];let w,p=[0,1,2,3,4];L!=-1?p=[L]:(g*I>5e5||A==1)&&(p=[0]),v&&(w={level:0});const M=Rs;for(var x=0;x<p.length;x++){for(let P=0;P<g;P++)y(N,m,P,I,A,p[x]);_.push(M.deflate(N,w))}let V,Z=1e9;for(x=0;x<_.length;x++)_[x].length<Z&&(V=x,Z=_[x].length);return _[V]}function y(m,g,A,I,N,L){const v=A*I;let _=v+A;if(m[_]=L,_++,L==0)if(I<500)for(var w=0;w<I;w++)m[_+w]=g[v+w];else m.set(new Uint8Array(g.buffer,v,I),_);else if(L==1){for(w=0;w<N;w++)m[_+w]=g[v+w];for(w=N;w<I;w++)m[_+w]=g[v+w]-g[v+w-N]+256&255}else if(A==0){for(w=0;w<N;w++)m[_+w]=g[v+w];if(L==2)for(w=N;w<I;w++)m[_+w]=g[v+w];if(L==3)for(w=N;w<I;w++)m[_+w]=g[v+w]-(g[v+w-N]>>1)+256&255;if(L==4)for(w=N;w<I;w++)m[_+w]=g[v+w]-t(g[v+w-N],0,0)+256&255}else{if(L==2)for(w=0;w<I;w++)m[_+w]=g[v+w]+256-g[v+w-I]&255;if(L==3){for(w=0;w<N;w++)m[_+w]=g[v+w]+256-(g[v+w-I]>>1)&255;for(w=N;w<I;w++)m[_+w]=g[v+w]+256-(g[v+w-I]+g[v+w-N]>>1)&255}if(L==4){for(w=0;w<N;w++)m[_+w]=g[v+w]+256-t(0,g[v+w-I],0)&255;for(w=N;w<I;w++)m[_+w]=g[v+w]+256-t(g[v+w-N],g[v+w-I],g[v+w-N-I])&255}}}function k(m,g){const A=new Uint8Array(m),I=A.slice(0),N=new Uint32Array(I.buffer),L=T(I,g),v=L[0],_=L[1],w=A.length,p=new Uint8Array(w>>2);let M;if(A.length<2e7)for(var x=0;x<w;x+=4)M=C(v,V=A[x]*(1/255),Z=A[x+1]*(1/255),P=A[x+2]*(1/255),q=A[x+3]*(1/255)),p[x>>2]=M.ind,N[x>>2]=M.est.rgba;else for(x=0;x<w;x+=4){var V=A[x]*.00392156862745098,Z=A[x+1]*(1/255),P=A[x+2]*(1/255),q=A[x+3]*(1/255);for(M=v;M.left;)M=R(M.est,V,Z,P,q)<=0?M.left:M.right;p[x>>2]=M.ind,N[x>>2]=M.est.rgba}return{abuf:I.buffer,inds:p,plte:_}}function T(m,g,A){A==null&&(A=1e-4);const I=new Uint32Array(m.buffer),N={i0:0,i1:m.length,bst:null,est:null,tdst:0,left:null,right:null};N.bst=U(m,N.i0,N.i1),N.est=b(N.bst);const L=[N];for(;L.length<g;){let _=0,w=0;for(var v=0;v<L.length;v++)L[v].est.L>_&&(_=L[v].est.L,w=v);if(_<A)break;const p=L[w],M=O(m,I,p.i0,p.i1,p.est.e,p.est.eMq255);if(p.i0>=M||p.i1<=M){p.est.L=0;continue}const x={i0:p.i0,i1:M,bst:null,est:null,tdst:0,left:null,right:null};x.bst=U(m,x.i0,x.i1),x.est=b(x.bst);const V={i0:M,i1:p.i1,bst:null,est:null,tdst:0,left:null,right:null};for(V.bst={R:[],m:[],N:p.bst.N-x.bst.N},v=0;v<16;v++)V.bst.R[v]=p.bst.R[v]-x.bst.R[v];for(v=0;v<4;v++)V.bst.m[v]=p.bst.m[v]-x.bst.m[v];V.est=b(V.bst),p.left=x,p.right=V,L[w]=x,L.push(V)}for(L.sort((_,w)=>w.bst.N-_.bst.N),v=0;v<L.length;v++)L[v].ind=v;return[N,L]}function C(m,g,A,I,N){if(m.left==null)return m.tdst=function(x,V,Z,P,q){const $=V-x[0],S=Z-x[1],X=P-x[2],ce=q-x[3];return $*$+S*S+X*X+ce*ce}(m.est.q,g,A,I,N),m;const L=R(m.est,g,A,I,N);let v=m.left,_=m.right;L>0&&(v=m.right,_=m.left);const w=C(v,g,A,I,N);if(w.tdst<=L*L)return w;const p=C(_,g,A,I,N);return p.tdst<w.tdst?p:w}function R(m,g,A,I,N){const{e:L}=m;return L[0]*g+L[1]*A+L[2]*I+L[3]*N-m.eMq}function O(m,g,A,I,N,L){for(I-=4;A<I;){for(;F(m,A,N)<=L;)A+=4;for(;F(m,I,N)>L;)I-=4;if(A>=I)break;const v=g[A>>2];g[A>>2]=g[I>>2],g[I>>2]=v,A+=4,I-=4}for(;F(m,A,N)>L;)A-=4;return A+4}function F(m,g,A){return m[g]*A[0]+m[g+1]*A[1]+m[g+2]*A[2]+m[g+3]*A[3]}function U(m,g,A){const I=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],N=[0,0,0,0],L=A-g>>2;for(let v=g;v<A;v+=4){const _=m[v]*.00392156862745098,w=m[v+1]*(1/255),p=m[v+2]*(1/255),M=m[v+3]*(1/255);N[0]+=_,N[1]+=w,N[2]+=p,N[3]+=M,I[0]+=_*_,I[1]+=_*w,I[2]+=_*p,I[3]+=_*M,I[5]+=w*w,I[6]+=w*p,I[7]+=w*M,I[10]+=p*p,I[11]+=p*M,I[15]+=M*M}return I[4]=I[1],I[8]=I[2],I[9]=I[6],I[12]=I[3],I[13]=I[7],I[14]=I[11],{R:I,m:N,N:L}}function b(m){const{R:g}=m,{m:A}=m,{N:I}=m,N=A[0],L=A[1],v=A[2],_=A[3],w=I==0?0:1/I,p=[g[0]-N*N*w,g[1]-N*L*w,g[2]-N*v*w,g[3]-N*_*w,g[4]-L*N*w,g[5]-L*L*w,g[6]-L*v*w,g[7]-L*_*w,g[8]-v*N*w,g[9]-v*L*w,g[10]-v*v*w,g[11]-v*_*w,g[12]-_*N*w,g[13]-_*L*w,g[14]-_*v*w,g[15]-_*_*w],M=p,x=B;let V=[Math.random(),Math.random(),Math.random(),Math.random()],Z=0,P=0;if(I!=0)for(let $=0;$<16&&(V=x.multVec(M,V),P=Math.sqrt(x.dot(V,V)),V=x.sml(1/P,V),!($!=0&&Math.abs(P-Z)<1e-9));$++)Z=P;const q=[N*w,L*w,v*w,_*w];return{Cov:p,q,e:V,L:Z,eMq255:x.dot(x.sml(255,q),V),eMq:x.dot(V,q),rgba:(Math.round(255*q[3])<<24|Math.round(255*q[2])<<16|Math.round(255*q[1])<<8|Math.round(255*q[0])<<0)>>>0}}var B={multVec:(m,g)=>[m[0]*g[0]+m[1]*g[1]+m[2]*g[2]+m[3]*g[3],m[4]*g[0]+m[5]*g[1]+m[6]*g[2]+m[7]*g[3],m[8]*g[0]+m[9]*g[1]+m[10]*g[2]+m[11]*g[3],m[12]*g[0]+m[13]*g[1]+m[14]*g[2]+m[15]*g[3]],dot:(m,g)=>m[0]*g[0]+m[1]*g[1]+m[2]*g[2]+m[3]*g[3],sml:(m,g)=>[m*g[0],m*g[1],m*g[2],m*g[3]]};Ye.encode=function(g,A,I,N,L,v,_){N==null&&(N=0),_==null&&(_=!1);const w=l(g,A,I,N,[!1,!1,!1,0,_,!1]);return d(w,-1),c(w,A,I,L,v)},Ye.encodeLL=function(g,A,I,N,L,v,_,w){const p={ctype:0+(N==1?0:2)+(L==0?0:4),depth:v,frames:[]},M=(N+L)*v,x=M*A;for(let V=0;V<g.length;V++)p.frames.push({rect:{x:0,y:0,width:A,height:I},img:new Uint8Array(g[V]),blend:0,dispose:1,bpp:Math.ceil(M/8),bpl:Math.ceil(x/8)});return d(p,0,!0),c(p,A,I,_,w)},Ye.encode.compress=l,Ye.encode.dither=a,Ye.quantize=k,Ye.quantize.getKDtree=T,Ye.quantize.getNearest=C})();const Dr={toArrayBuffer(s,e){const t=s.width,n=s.height,r=t<<2,i=s.getContext("2d").getImageData(0,0,t,n),o=new Uint32Array(i.data.buffer),a=(32*t+31)/32<<2,c=a*n,d=122+c,l=new ArrayBuffer(d),u=new DataView(l),h=1<<20;let f,y,k,T,C=h,R=0,O=0,F=0;function U(m){u.setUint16(O,m,!0),O+=2}function b(m){u.setUint32(O,m,!0),O+=4}function B(m){O+=m}U(19778),b(d),B(4),b(122),b(108),b(t),b(-n>>>0),U(1),U(32),b(3),b(c),b(2835),b(2835),B(8),b(16711680),b(65280),b(255),b(4278190080),b(1466527264),function m(){for(;R<n&&C>0;){for(T=122+R*a,f=0;f<r;)C--,y=o[F++],k=y>>>24,u.setUint32(T+f,y<<8|k),f+=4;R++}F<o.length?(C=h,setTimeout(m,Dr._dly)):e(l)}()},toBlob(s,e){this.toArrayBuffer(s,t=>{e(new Blob([t],{type:"image/bmp"}))})},_dly:9};var He={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},Ds={[He.CHROME]:16384,[He.FIREFOX]:11180,[He.DESKTOP_SAFARI]:16384,[He.IE]:8192,[He.IOS]:4096,[He.ETC]:8192};const zn=typeof window<"u",Mr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,kn=zn&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),Ms=(zn||Mr)&&(kn&&kn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Vr=(zn||Mr)&&(kn&&kn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function Xn(s,e,t=Date.now()){return new Promise(n=>{const r=s.split(","),i=r[0].match(/:(.*?);/)[1],o=globalThis.atob(r[1]);let a=o.length;const c=new Uint8Array(a);for(;a--;)c[a]=o.charCodeAt(a);const d=new Blob([c],{type:i});d.name=e,d.lastModified=t,n(d)})}function Hr(s){return new Promise((e,t)=>{const n=new Vr;n.onload=()=>e(n.result),n.onerror=r=>t(r),n.readAsDataURL(s)})}function $r(s){return new Promise((e,t)=>{const n=new Image;n.onload=()=>e(n),n.onerror=r=>t(r),n.src=s})}function Rt(){if(Rt.cachedResult!==void 0)return Rt.cachedResult;let s=He.ETC;const{userAgent:e}=navigator;return/Chrom(e|ium)/i.test(e)?s=He.CHROME:/iP(ad|od|hone)/i.test(e)&&/WebKit/i.test(e)?s=He.IOS:/Safari/i.test(e)?s=He.DESKTOP_SAFARI:/Firefox/i.test(e)?s=He.FIREFOX:(/MSIE/i.test(e)||document.documentMode)&&(s=He.IE),Rt.cachedResult=s,Rt.cachedResult}function Pr(s,e){const t=Rt(),n=Ds[t];let r=s,i=e,o=r*i;const a=r>i?i/r:r/i;for(;o>n*n;){const c=(n+r)/2,d=(n+i)/2;c<d?(i=d,r=d*a):(i=c*a,r=c),o=r*i}return{width:r,height:i}}function Fn(s,e){let t,n;try{if(t=new OffscreenCanvas(s,e),n=t.getContext("2d"),n===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{t=document.createElement("canvas"),n=t.getContext("2d")}return t.width=s,t.height=e,[t,n]}function Wr(s,e){const{width:t,height:n}=Pr(s.width,s.height),[r,i]=Fn(t,n);return e&&/jpe?g/.test(e)&&(i.fillStyle="white",i.fillRect(0,0,r.width,r.height)),i.drawImage(s,0,0,r.width,r.height),r}function Nn(){return Nn.cachedResult!==void 0||(Nn.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),Nn.cachedResult}function In(s,e={}){return new Promise(function(t,n){let r,i;var o=function(){try{return i=Wr(r,e.fileType||s.type),t([r,i])}catch(c){return n(c)}},a=function(c){try{var d=function(l){try{throw l}catch(u){return n(u)}};try{let l;return Hr(s).then(function(u){try{return l=u,$r(l).then(function(h){try{return r=h,function(){try{return o()}catch(f){return n(f)}}()}catch(f){return d(f)}},d)}catch(h){return d(h)}},d)}catch(l){d(l)}}catch(l){return n(l)}};try{if(Nn()||[He.DESKTOP_SAFARI,He.MOBILE_SAFARI].includes(Rt()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(s).then(function(c){try{return r=c,o()}catch{return a()}},a)}catch{a()}})}function Tn(s,e,t,n,r=1){return new Promise(function(i,o){let a;if(e==="image/png"){let d,l,u;return d=s.getContext("2d"),{data:l}=d.getImageData(0,0,s.width,s.height),u=Ye.encode([l.buffer],s.width,s.height,4096*r),a=new Blob([u],{type:e}),a.name=t,a.lastModified=n,c.call(this)}{let d=function(){return c.call(this)};if(e==="image/bmp")return new Promise(l=>Dr.toBlob(s,l)).then((function(l){try{return a=l,a.name=t,a.lastModified=n,d.call(this)}catch(u){return o(u)}}).bind(this),o);{let l=function(){return d.call(this)};if(typeof OffscreenCanvas=="function"&&s instanceof OffscreenCanvas)return s.convertToBlob({type:e,quality:r}).then((function(u){try{return a=u,a.name=t,a.lastModified=n,l.call(this)}catch(h){return o(h)}}).bind(this),o);{let u;return u=s.toDataURL(e,r),Xn(u,t,n).then((function(h){try{return a=h,l.call(this)}catch(f){return o(f)}}).bind(this),o)}}}function c(){return i(a)}})}function st(s){s.width=0,s.height=0}function $t(){return new Promise(function(s,e){let t,n,r,i;return $t.cachedResult!==void 0?s($t.cachedResult):Xn("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then(function(o){try{return t=o,In(t).then(function(a){try{return n=a[1],Tn(n,t.type,t.name,t.lastModified).then(function(c){try{return r=c,st(n),In(r).then(function(d){try{return i=d[0],$t.cachedResult=i.width===1&&i.height===2,s($t.cachedResult)}catch(l){return e(l)}},e)}catch(d){return e(d)}},e)}catch(c){return e(c)}},e)}catch(a){return e(a)}},e)})}function jr(s){return new Promise((e,t)=>{const n=new Vr;n.onload=r=>{const i=new DataView(r.target.result);if(i.getUint16(0,!1)!=65496)return e(-2);const o=i.byteLength;let a=2;for(;a<o;){if(i.getUint16(a+2,!1)<=8)return e(-1);const c=i.getUint16(a,!1);if(a+=2,c==65505){if(i.getUint32(a+=2,!1)!=1165519206)return e(-1);const d=i.getUint16(a+=6,!1)==18761;a+=i.getUint32(a+4,d);const l=i.getUint16(a,d);a+=2;for(let u=0;u<l;u++)if(i.getUint16(a+12*u,d)==274)return e(i.getUint16(a+12*u+8,d))}else{if((65280&c)!=65280)break;a+=i.getUint16(a,!1)}}return e(-1)},n.onerror=r=>t(r),n.readAsArrayBuffer(s)})}function qr(s,e){const{width:t}=s,{height:n}=s,{maxWidthOrHeight:r}=e;let i,o=s;return isFinite(r)&&(t>r||n>r)&&([o,i]=Fn(t,n),t>n?(o.width=r,o.height=n/t*r):(o.width=t/n*r,o.height=r),i.drawImage(s,0,0,o.width,o.height),st(s)),o}function Zr(s,e){const{width:t}=s,{height:n}=s,[r,i]=Fn(t,n);switch(e>4&&e<9?(r.width=n,r.height=t):(r.width=t,r.height=n),e){case 2:i.transform(-1,0,0,1,t,0);break;case 3:i.transform(-1,0,0,-1,t,n);break;case 4:i.transform(1,0,0,-1,0,n);break;case 5:i.transform(0,1,1,0,0,0);break;case 6:i.transform(0,1,-1,0,n,0);break;case 7:i.transform(0,-1,-1,0,n,t);break;case 8:i.transform(0,-1,1,0,0,t)}return i.drawImage(s,0,0,t,n),st(s),r}function Kr(s,e,t=0){return new Promise(function(n,r){let i,o,a,c,d,l,u,h,f,y,k,T,C,R,O,F,U,b,B,m;function g(I=5){if(e.signal&&e.signal.aborted)throw e.signal.reason;i+=I,e.onProgress(Math.min(i,100))}function A(I){if(e.signal&&e.signal.aborted)throw e.signal.reason;i=Math.min(Math.max(I,i),100),e.onProgress(i)}return i=t,o=e.maxIteration||10,a=1024*e.maxSizeMB*1024,g(),In(s,e).then((function(I){try{return[,c]=I,g(),d=qr(c,e),g(),new Promise(function(N,L){var v;if(!(v=e.exifOrientation))return jr(s).then((function(w){try{return v=w,_.call(this)}catch(p){return L(p)}}).bind(this),L);function _(){return N(v)}return _.call(this)}).then((function(N){try{return l=N,g(),$t().then((function(L){try{return u=L?d:Zr(d,l),g(),h=e.initialQuality||1,f=e.fileType||s.type,Tn(u,f,s.name,s.lastModified,h).then((function(v){try{{let w=function(){if(o--&&(O>a||O>C)){let M,x;return M=m?.95*B.width:B.width,x=m?.95*B.height:B.height,[U,b]=Fn(M,x),b.drawImage(B,0,0,M,x),h*=f==="image/png"?.85:.95,Tn(U,f,s.name,s.lastModified,h).then(function(V){try{return F=V,st(B),B=U,O=F.size,A(Math.min(99,Math.floor((R-O)/(R-a)*100))),w}catch(Z){return r(Z)}},r)}return[1]},p=function(){return st(B),st(U),st(d),st(u),st(c),A(100),n(F)};if(y=v,g(),k=y.size>a,T=y.size>s.size,!k&&!T)return A(100),n(y);var _;return C=s.size,R=y.size,O=R,B=u,m=!e.alwaysKeepResolution&&k,(_=(function(M){for(;M;){if(M.then)return void M.then(_,r);try{if(M.pop){if(M.length)return M.pop()?p.call(this):M;M=w}else M=M.call(this)}catch(x){return r(x)}}}).bind(this))(w)}}catch(w){return r(w)}}).bind(this),r)}catch(v){return r(v)}}).bind(this),r)}catch(L){return r(L)}}).bind(this),r)}catch(N){return r(N)}}).bind(this),r)})}const Vs=`
6
6
  let scriptImported = false
7
7
  self.addEventListener('message', async (e) => {
8
8
  const { file, id, imageCompressionLibUrl, options } = e.data
@@ -21,19 +21,19 @@ self.addEventListener('message', async (e) => {
21
21
  self.postMessage({ error: e.message + '\\n' + e.stack, id })
22
22
  }
23
23
  })
24
- `;let gn;function zn(P,Z){return new Promise((J,E)=>{gn||(gn=function(C){const p=[];return p.push(C),URL.createObjectURL(new Blob(p))}(qn));const o=new Worker(gn);o.addEventListener("message",function(C){if(Z.signal&&Z.signal.aborted)o.terminate();else if(C.data.progress===void 0){if(C.data.error)return E(new Error(C.data.error)),void o.terminate();J(C.data.file),o.terminate()}else Z.onProgress(C.data.progress)}),o.addEventListener("error",E),Z.signal&&Z.signal.addEventListener("abort",()=>{E(Z.signal.reason),o.terminate()}),o.postMessage({file:P,imageCompressionLibUrl:Z.libURL,options:{...Z,onProgress:void 0,signal:void 0}})})}function Ke(P,Z){return new Promise(function(J,E){let o,a,C,p,I,U;if(o={...Z},C=0,{onProgress:p}=o,o.maxSizeMB=o.maxSizeMB||Number.POSITIVE_INFINITY,I=typeof o.useWebWorker!="boolean"||o.useWebWorker,delete o.useWebWorker,o.onProgress=m=>{C=m,typeof p=="function"&&p(C)},!(P instanceof Blob||P instanceof ie))return E(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(P.type))return E(new Error("The file given is not an image"));if(U=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!I||typeof Worker!="function"||U)return Ln(P,o).then((function(m){try{return a=m,l.call(this)}catch(A){return E(A)}}).bind(this),E);var c=(function(){try{return l.call(this)}catch(m){return E(m)}}).bind(this),h=function(m){try{return Ln(P,o).then(function(A){try{return a=A,c()}catch(O){return E(O)}},E)}catch(A){return E(A)}};try{return o.libURL=o.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.1/dist/browser-image-compression.js",zn(P,o).then(function(m){try{return a=m,c()}catch{return h()}},h)}catch{h()}function l(){try{a.name=P.name,a.lastModified=P.lastModified}catch{}try{o.preserveExif&&P.type==="image/jpeg"&&(!o.fileType||o.fileType&&o.fileType===P.type)&&(a=e(P,a))}catch{}return J(a)}})}return Ke.getDataUrlFromFile=Ue,Ke.getFilefromDataUrl=we,Ke.loadImage=me,Ke.drawImageInCanvas=de,Ke.drawFileInCanvas=Fe,Ke.canvasToFile=Ze,Ke.getExifOrientation=jn,Ke.handleMaxWidthOrHeight=Nn,Ke.followExifOrientation=Tn,Ke.cleanupCanvasMemory=Re,Ke.isAutoOrientationInBrowser=jt,Ke.approximateBelowMaximumCanvasSizeOfBrowser=Se,Ke.copyExifWithoutOrientation=e,Ke.getBrowserName=be,Ke.version="2.0.1",Ke}),console.log("window",typeof window),typeof window<"u"&&console.log("I am here 3597"),window.imageCompression=imageCompression;const Ss=imageCompression;class Rs extends Je{constructor(){super("com.hamropatro.grpc.cms.ImageUploadRequest",[{no:1,name:"mime_type",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.mimeType="",e!==void 0&&$e(this,t,e),t}internalBinaryRead(e,t,n,i){let s=i??this.create(),d=e.pos+t;for(;e.pos<d;){let[u,g]=e.tag();switch(u){case 1:s.mimeType=e.string();break;default:let v=n.readUnknownField;if(v==="throw")throw new globalThis.Error(`Unknown field ${u} (wire type ${g}) for ${this.typeName}`);let V=e.skip(g);v!==!1&&(v===!0?ue.onRead:v)(this.typeName,s,u,g,V)}}return s}internalBinaryWrite(e,t,n){e.mimeType!==""&&t.tag(1,te.LengthDelimited).string(e.mimeType);let i=n.writeUnknownFields;return i!==!1&&(i==!0?ue.onWrite:i)(this.typeName,e,t),t}}const dr=new Rs;class Ds extends Je{constructor(){super("com.hamropatro.grpc.cms.ImageUploadResponse",[{no:1,name:"key",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",t.url="",e!==void 0&&$e(this,t,e),t}internalBinaryRead(e,t,n,i){let s=i??this.create(),d=e.pos+t;for(;e.pos<d;){let[u,g]=e.tag();switch(u){case 1:s.key=e.string();break;case 2:s.url=e.string();break;default:let v=n.readUnknownField;if(v==="throw")throw new globalThis.Error(`Unknown field ${u} (wire type ${g}) for ${this.typeName}`);let V=e.skip(g);v!==!1&&(v===!0?ue.onRead:v)(this.typeName,s,u,g,V)}}return s}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,te.LengthDelimited).string(e.key),e.url!==""&&t.tag(2,te.LengthDelimited).string(e.url);let i=n.writeUnknownFields;return i!==!1&&(i==!0?ue.onWrite:i)(this.typeName,e,t),t}}const ti=new Ds,hr=new er("com.hamropatro.grpc.cms.ImageUploadService",[{name:"Upload",options:{},I:dr,O:ti},{name:"UploadUserImage",options:{},I:dr,O:ti}]);class Ms{constructor(e){Be(this,"typeName",hr.typeName);Be(this,"methods",hr.methods);Be(this,"options",hr.options);this._transport=e}upload(e,t){const n=this.methods[0],i=this._transport.mergeOptions(t);return dt("unary",this._transport,n,i,e)}uploadUserImage(e,t){const n=this.methods[1],i=this._transport.mergeOptions(t);return dt("unary",this._transport,n,i,e)}}const Vs=async(r,e,t=!0)=>{var d;const n=(d=window.ImageSalonSDK)==null?void 0:d.grpcConfig,i=new Ms(n),s=dr.create();try{return s.mimeType=r,t?await i.upload(s,e):await i.uploadUserImage(s,e)}catch(u){throw u}},ur=async(r,e,t,n=!0)=>{try{const i=Hs(r,e),d=(await Vs(e==null?void 0:e.type,t,n)).response.url;return await fetch(d,{method:"PUT",headers:{"Content-Type":e==null?void 0:e.type,"x-amz-acl":"public-read"},body:i}),d==null?void 0:d.split("?")[0]}catch(i){throw i}},Hs=(r,e)=>{const t=e.type.split("/")[0];let n="";t==="video"?n=r==null?void 0:r.replace(/^data:video\/\w+;base64,/,""):t==="image"?n=r==null?void 0:r.replace(/^data:image\/\w+;base64,/,""):t==="audio"&&(n=r==null?void 0:r.replace(/^data:audio\/\w+;base64,/,""));const i=atob(n),s=new Uint8Array(i.length);for(let d=0;d<i.length;d++)s[d]=i.charCodeAt(d);return s};async function ni(r){const e={maxSizeMB:2,useWebWorker:!0,libURL:"/workers/browser-image-compression.js",alwaysKeepResolution:!0};try{return await Ss(r,e)}catch(t){throw t}}class ri{constructor(e){ce(this,Dt);ce(this,He);ce(this,We);ce(this,xt);ce(this,Oe,[]);ce(this,ze,[]);ce(this,yt);ce(this,ot);ce(this,Gt);ce(this,Mt);ce(this,vt,[]);ce(this,bt);ce(this,Vt);ce(this,on);ce(this,fr);ce(this,Ht);ce(this,Wt);ce(this,Ut);ce(this,Jt);ce(this,At);ce(this,kt);ce(this,Pt);ce(this,$t);ce(this,_t);ce(this,an);ce(this,vn);ce(this,Ge);ce(this,Bt);ce(this,An,!1);ce(this,$n);ce(this,kn);ce(this,It);ce(this,ln);ce(this,Zt);ce(this,cn);ce(this,dn);ce(this,hn);ce(this,un);ce(this,fn);ce(this,In);ce(this,Fn);ce(this,pn);ce(this,Ft);ce(this,mn);ce(this,Zn);G(this,kn,e.isAdmin),G(this,yt,!1),e.handleUpload&&G(this,on,e.handleUpload.bind(this)),G(this,vn,e.accessToken),G(this,cn,e==null?void 0:e.mode),this._grpcOptionInitializer(),this._init(e).then(()=>{G(this,An,!0),e!=null&&e.parentContainerId&&this._renderView(e),this.updateWindowObject({initialized:!0}),this._initializeGrpcConfig(e.mode,e.endPoint)})}async _init(e){try{const{mode:t}=e;this.updateWindowObject({mode:t})}catch{throw Error("Initialization failed")}}_isAdminOptions(e){return e.isAdmin===!0}_renderView(e){var t,n,i,s;return this._isAdminOptions(e)?(G(this,ot,!1),G(this,Gt,!1),G(this,Ht,0),G(this,kt,""),G(this,_t,!1),G(this,cn,e.mode),G(this,Pt,!1),G(this,Zt,""),G(this,Bt,null),this._removeToastContainer(),this._renderAdminView(e)):(G(this,ln,""),G(this,dn,e==null?void 0:e.restrictedFileSize),G(this,hn,e==null?void 0:e.localizedFileRestrictedMessage),G(this,fn,e==null?void 0:e.localizedSuccessMessage),G(this,un,e==null?void 0:e.localizedErrorMessage),G(this,Ft,e==null?void 0:e.imagePreviewWidth),G(this,mn,e==null?void 0:e.imagePreviewHeight),G(this,In,(t=e==null?void 0:e.removeImageConfirm)==null?void 0:t.bind(this)),G(this,Fn,(n=e==null?void 0:e.removeImagePreviewCB)==null?void 0:n.bind(this)),G(this,pn,(i=e==null?void 0:e.getUploadingState)==null?void 0:i.bind(this)),G(this,Zn,(s=e==null?void 0:e.handleUploadFromSource)==null?void 0:s.bind(this)),this._removeUserToast(),this._renderUserView(e))}_renderAdminView(e){if(!F(this,An))return;const{parentContainerId:t}=e;if(e.isAdmin===!0)var{buttonProps:n}=e;G(this,Dt,document.getElementById(t));const i=document.createElement("button");i.className=n!=null&&n.buttonClass?n==null?void 0:n.buttonClass:"browse-image-button",i.addEventListener("focus",()=>{i.blur()});const s=document.createElement("span");s.textContent=n!=null&&n.buttonText?n==null?void 0:n.buttonText:"Browse Files";const d=document.createElement("span");d.innerHTML=n!=null&&n.buttonIcon?n==null?void 0:n.buttonIcon:"",i.type="button",i.append(s,d),n!=null&&n.buttonStyle&&Object.assign(i.style,n==null?void 0:n.buttonStyle),i.addEventListener("click",()=>{this._selectedImageContainer()}),F(this,Dt).appendChild(i)}async _grpcOptionInitializer(){G(this,Ge,await _s(F(this,vn),F(this,cn)))}_selectedImageContainer(){var ne;G(this,Vt,st(`Save (${(ne=F(this,Oe))==null?void 0:ne.length})`,"dialog-btn confirm")),G(this,Wt,le("folder-container")),G(this,Ut,le("folder-list-wrapper")),this._fetchAllFolders();const e=st("Cancel","dialog-btn cancel");st("","dialog-modal-close-btn","",!1,'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="24" height="24" viewBox="0 0 50 50"> <path d="M 9.15625 6.3125 L 6.3125 9.15625 L 22.15625 25 L 6.21875 40.96875 L 9.03125 43.78125 L 25 27.84375 L 40.9375 43.78125 L 43.78125 40.9375 L 27.84375 25 L 43.6875 9.15625 L 40.84375 6.3125 L 25 22.15625 Z"></path> </svg>').addEventListener("click",()=>{Pn.hide(),G(this,Oe,[]),G(this,ze,[])}),G(this,He,le("browse-container"));const n=le();n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="space-between",n.style.padding="10px 20px";const i=En("Folders","folder-title"),s=st("","add-folder-btn");s.append(Gr()),this._createUpdateFolderDialog(s,"create"),n.append(i,s),F(this,Wt).append(n,F(this,Ut));const d=this._renderSearchField(),u=this._createBrowseMoreContainer(),g=this._createBrowseImageMain(),v=le("footer");e.onclick=()=>{Pn.hide(),G(this,ze,[]),G(this,Oe,[])},F(this,Vt).onclick=()=>{F(this,on).call(this),Pn.hide(),G(this,Oe,[]),G(this,ze,[])},v.append(e,F(this,Vt));const V=le("container-right-main");V.append(d,u,g,v),F(this,He).append(F(this,Wt),V),Pn.show({content:F(this,He)})}_renderUserView(e){const{parentContainerId:t,restrictedFileSize:n,imagePreview:i}=e;G(this,Dt,document.getElementById(t)),G(this,It,pe("div","user-view-container"));const s=le("user-view-browse-wrapper","user-view-browse-wrapper"),d=pe("span","","",""),u=this._renderUserViewBrowseButton(),g=pe("p","","margin-block: 0px; font-size:14px");if(g.append(d,u),n){const v=pe("p","","margin-block: 0px; font-size: 13px; color: #777",`Max File size: ${n}MB`);s.append(ar(),g,v)}else s.append(ar(),g);return F(this,It).append(s),i&&this._renderImagePreview(i,"",s,!0),F(this,Dt).appendChild(F(this,It)),F(this,Dt)}_renderImagePreview(e,t,n,i=!1){var me;const s=document.getElementById("user-view-browse-wrapper"),d=s||n;d&&(d.style.display="none");const u=document.getElementById("user-image-preview");u&&u.remove();const g=pe("div","user-image-preview");g.id="user-image-preview";const v=this._renderImageLoadingContainer();g.appendChild(v);const V=pe("img","",`max-width: ${F(this,Ft)?F(this,Ft):230}px;max-height:${F(this,mn)?F(this,mn):250}px;object-fit:cover;`);V.src=e,V.alt=t||"";const ne=this._renderImageErrorContainer();g.appendChild(ne),V.onload=()=>{he.style.display="none",v.style.display="none",v.remove(),ne.style.display="none",ne.remove(),V.style.display="block",he.style.display=i?"flex":"none"},V.onerror=be=>{v.style.display="none",v.remove(),ne.style.display="flex",V.style.display="none",he.style.display="none"};const ie=ne.querySelector("#retry-image-btn");ie==null||ie.addEventListener("click",()=>{v.style.display="flex",ne.style.display="none",he.style.display="none",V.src=e});const he=pe("div","","width: 18px; height: 18px; display:none; cursor:pointer; align-items: center; justify-content: center; padding: 4px; position: absolute; top: -5px; right: -5px; background: #c10007; border-radius: 50%;z-index:1");he.id="remove-preview-btn";const we=or();we.style.fill="#fff",he==null||he.appendChild(we),he.addEventListener("click",()=>{F(this,In).call(this)});const Ue=pe("button","","display:none");Ue.id="image-preview-hidden-btn",Ue.addEventListener("click",be=>{var Se;be.preventDefault(),be.stopPropagation(),(Se=F(this,It))==null||Se.removeChild(g),F(this,Fn).call(this),this._removeUserToast(),d&&(d.style.display="flex")}),g==null||g.append(V,he,Ue),(me=F(this,It))==null||me.append(g)}_renderImageErrorContainer(){const e=pe("div","","display: none; text-align: center;");return e.innerHTML=`
24
+ `;let Gn;function Hs(s,e){return new Promise((t,n)=>{Gn||(Gn=function(o){const a=[];return a.push(o),URL.createObjectURL(new Blob(a))}(Vs));const r=new Worker(Gn);r.addEventListener("message",function(o){if(e.signal&&e.signal.aborted)r.terminate();else if(o.data.progress===void 0){if(o.data.error)return n(new Error(o.data.error)),void r.terminate();t(o.data.file),r.terminate()}else e.onProgress(o.data.progress)}),r.addEventListener("error",n),e.signal&&e.signal.addEventListener("abort",()=>{n(e.signal.reason),r.terminate()}),r.postMessage({file:s,imageCompressionLibUrl:e.libURL,options:{...e,onProgress:void 0,signal:void 0}})})}function Oe(s,e){return new Promise(function(t,n){let r,i,o,a,c,d;if(r={...e},o=0,{onProgress:a}=r,r.maxSizeMB=r.maxSizeMB||Number.POSITIVE_INFINITY,c=typeof r.useWebWorker!="boolean"||r.useWebWorker,delete r.useWebWorker,r.onProgress=f=>{o=f,typeof a=="function"&&a(o)},!(s instanceof Blob||s instanceof Ms))return n(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(s.type))return n(new Error("The file given is not an image"));if(d=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!c||typeof Worker!="function"||d)return Kr(s,r).then((function(f){try{return i=f,h.call(this)}catch(y){return n(y)}}).bind(this),n);var l=(function(){try{return h.call(this)}catch(f){return n(f)}}).bind(this),u=function(f){try{return Kr(s,r).then(function(y){try{return i=y,l()}catch(k){return n(k)}},n)}catch(y){return n(y)}};try{return r.libURL=r.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",Hs(s,r).then(function(f){try{return i=f,l()}catch{return u()}},u)}catch{u()}function h(){try{i.name=s.name,i.lastModified=s.lastModified}catch{}try{r.preserveExif&&s.type==="image/jpeg"&&(!r.fileType||r.fileType&&r.fileType===s.type)&&(i=Rr(s,i))}catch{}return t(i)}})}Oe.getDataUrlFromFile=Hr,Oe.getFilefromDataUrl=Xn,Oe.loadImage=$r,Oe.drawImageInCanvas=Wr,Oe.drawFileInCanvas=In,Oe.canvasToFile=Tn,Oe.getExifOrientation=jr,Oe.handleMaxWidthOrHeight=qr,Oe.followExifOrientation=Zr,Oe.cleanupCanvasMemory=st,Oe.isAutoOrientationInBrowser=$t,Oe.approximateBelowMaximumCanvasSizeOfBrowser=Pr,Oe.copyExifWithoutOrientation=Rr,Oe.getBrowserName=Rt,Oe.version="2.0.2";class $s extends Te{constructor(){super("com.hamropatro.grpc.common.ImageUploadRequest",[{no:1,name:"mime_type",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.mimeType="",e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.mimeType=e.string();break;default:let d=n.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.mimeType!==""&&t.tag(1,j.LengthDelimited).string(e.mimeType);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const Ln=new $s;class Ps extends Te{constructor(){super("com.hamropatro.grpc.common.ImageUploadResponse",[{no:1,name:"key",kind:"scalar",T:9},{no:2,name:"uploadUrl",kind:"scalar",T:9},{no:3,name:"access_url",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.key="",t.uploadUrl="",t.accessUrl="",e!==void 0&&Ee(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,c]=e.tag();switch(a){case 1:i.key=e.string();break;case 2:i.uploadUrl=e.string();break;case 3:i.accessUrl=e.string();break;default:let d=n.readUnknownField;if(d==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${c}) for ${this.typeName}`);let l=e.skip(c);d!==!1&&(d===!0?G.onRead:d)(this.typeName,i,a,c,l)}}return i}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,j.LengthDelimited).string(e.key),e.uploadUrl!==""&&t.tag(2,j.LengthDelimited).string(e.uploadUrl),e.accessUrl!==""&&t.tag(3,j.LengthDelimited).string(e.accessUrl);let r=n.writeUnknownFields;return r!==!1&&(r==!0?G.onWrite:r)(this.typeName,e,t),t}}const zr=new Ps,Jn=new Dn("com.hamropatro.grpc.common.ImageUploadService",[{name:"Upload",options:{},I:Ln,O:zr},{name:"UploadUserImage",options:{},I:Ln,O:zr}]);class Xr{constructor(e){pe(this,"typeName",Jn.typeName);pe(this,"methods",Jn.methods);pe(this,"options",Jn.options);this._transport=e}upload(e,t){const n=this.methods[0],r=this._transport.mergeOptions(t);return Pe("unary",this._transport,n,r,e)}uploadUserImage(e,t){const n=this.methods[1],r=this._transport.mergeOptions(t);return Pe("unary",this._transport,n,r,e)}}const Ws=async(s,e,t=!0)=>{var o;const n=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,r=new Xr(n),i=Ln.create();try{return i.mimeType=s,t?await r.upload(i,e):await r.uploadUserImage(i,e)}catch(a){throw a}},js=async(s,e,t=!0,n)=>{var d;let r;try{e&&(r={Authorization:e,"app-id":n==="production"?"hamropatro":"hamropatro-android"})}catch(l){if(l)throw l}const i={meta:r},o=(d=window.ImageSalonSDK)==null?void 0:d.grpcConfig,a=new Xr(o),c=Ln.create();try{c.mimeType=s;const l=t;return await a.uploadUserImage(c,i),l}catch(l){throw l}},Gr=async(s,e,t,n=!0)=>{var r,i;try{const o=await Ws(e==null?void 0:e.type,t,n),a=(r=o.response)==null?void 0:r.uploadUrl,c=(i=o==null?void 0:o.response)==null?void 0:i.accessUrl;return await Jr(s,a,e),c}catch(o){throw o}},Jr=async(s,e,t)=>{const n=Zs(s,t);try{await fetch(e,{method:"PUT",headers:{"Content-Type":t==null?void 0:t.type},body:n})}catch(r){throw r}},qs=async(s,e,t,n=!1,r)=>{var i,o;try{const a=await js(e==null?void 0:e.type,t,n,r),c=(i=a.response)==null?void 0:i.uploadUrl,d=(o=a==null?void 0:a.response)==null?void 0:o.accessUrl;return await Jr(s,c,e),d}catch(a){throw a}},Zs=(s,e)=>{const t=e.type.split("/")[0];let n="";t==="video"?n=s==null?void 0:s.replace(/^data:video\/\w+;base64,/,""):t==="image"?n=s==null?void 0:s.replace(/^data:image\/\w+;base64,/,""):t==="audio"&&(n=s==null?void 0:s.replace(/^data:audio\/\w+;base64,/,""));const r=atob(n),i=new Uint8Array(r.length);for(let o=0;o<r.length;o++)i[o]=r.charCodeAt(o);return i};async function Qr(s){const e={maxSizeMB:2,useWebWorker:!1,alwaysKeepResolution:!0};try{return await Oe(s,e)}catch(t){throw t}}class Ks{constructor(e){z(this,At);z(this,Ae);z(this,ke);z(this,wt);z(this,we,[]);z(this,Ie,[]);z(this,tt);z(this,je);z(this,Dt);z(this,kt);z(this,ot,[]);z(this,nt);z(this,Ft);z(this,Wt);z(this,Qn);z(this,Nt);z(this,It);z(this,yt);z(this,Mt);z(this,at);z(this,lt);z(this,Tt);z(this,Lt);z(this,bt);z(this,jt);z(this,on);z(this,Se);z(this,Ct);z(this,an,!1);z(this,Un);z(this,ln);z(this,ct);z(this,qt);z(this,Ut);z(this,xt);z(this,Zt);z(this,Kt);z(this,zt);z(this,Xt);z(this,cn);z(this,dn);z(this,Gt);z(this,dt);z(this,Jt);H(this,ln,e.isAdmin),H(this,tt,!1),H(this,xt,e==null?void 0:e.mode),e.handleUpload&&H(this,Wt,e.handleUpload.bind(this)),e!=null&&e.accessToken&&(H(this,on,e.accessToken),this._grpcOptionInitializer()),this._init(e).then(()=>{H(this,an,!0),e!=null&&e.parentContainerId&&this._renderView(e),this.updateWindowObject({initialized:!0}),this._initializeGrpcConfig(e.mode,e.endPoint)})}async _init(e){try{const{mode:t}=e;this.updateWindowObject({mode:t})}catch{throw Error("Initialization failed")}}_isAdminOptions(e){return e.isAdmin===!0}_renderView(e){var t,n,r;return this._isAdminOptions(e)?(H(this,je,!1),H(this,Dt,!1),H(this,Nt,0),H(this,lt,""),H(this,bt,!1),H(this,xt,e.mode),H(this,Tt,!1),H(this,Ut,""),H(this,Ct,null),this._removeToastContainer(),this._renderAdminView(e)):(H(this,qt,""),H(this,Zt,e==null?void 0:e.restrictedFileSize),H(this,Kt,e==null?void 0:e.localizedFileRestrictedMessage),H(this,Xt,e==null?void 0:e.localizedSuccessMessage),H(this,zt,e==null?void 0:e.localizedErrorMessage),H(this,dt,e==null?void 0:e.imagePreviewWidth),H(this,Jt,e==null?void 0:e.imagePreviewHeight),H(this,cn,(t=e==null?void 0:e.removeImageConfirm)==null?void 0:t.bind(this)),H(this,dn,(n=e==null?void 0:e.removeImagePreviewCB)==null?void 0:n.bind(this)),H(this,Gt,(r=e==null?void 0:e.getUploadingState)==null?void 0:r.bind(this)),this._removeUserToast(),this._renderUserView(e))}_renderAdminView(e){if(!E(this,an))return;const{parentContainerId:t}=e;if(e.isAdmin===!0)var{buttonProps:n}=e;H(this,At,document.getElementById(t));const r=document.createElement("button");r.className=n!=null&&n.buttonClass?n==null?void 0:n.buttonClass:"browse-image-button",r.addEventListener("focus",()=>{r.blur()});const i=document.createElement("span");i.textContent=n!=null&&n.buttonText?n==null?void 0:n.buttonText:"Browse Files";const o=document.createElement("span");o.innerHTML=n!=null&&n.buttonIcon?n==null?void 0:n.buttonIcon:"",r.type="button",r.append(i,o),n!=null&&n.buttonStyle&&Object.assign(r.style,n==null?void 0:n.buttonStyle),r.addEventListener("click",()=>{this._selectedImageContainer()}),E(this,At).appendChild(r)}async _grpcOptionInitializer(){H(this,Se,await Us(E(this,on),E(this,xt)))}_selectedImageContainer(){var u;H(this,Ft,We(`Save (${(u=E(this,we))==null?void 0:u.length})`,"dialog-btn confirm")),H(this,It,K("folder-container")),H(this,yt,K("folder-list-wrapper")),this._fetchAllFolders();const e=We("Cancel","dialog-btn cancel");We("","dialog-modal-close-btn","",!1,'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="24" height="24" viewBox="0 0 50 50"> <path d="M 9.15625 6.3125 L 6.3125 9.15625 L 22.15625 25 L 6.21875 40.96875 L 9.03125 43.78125 L 25 27.84375 L 40.9375 43.78125 L 43.78125 40.9375 L 27.84375 25 L 43.6875 9.15625 L 40.84375 6.3125 L 25 22.15625 Z"></path> </svg>').addEventListener("click",()=>{vn.hide(),H(this,we,[]),H(this,Ie,[])}),H(this,Ae,K("browse-container"));const n=K();n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="space-between",n.style.padding="10px 20px";const r=sn("Folders","folder-title"),i=We("","add-folder-btn");i.append(xr()),this._createUpdateFolderDialog(i,"create"),n.append(r,i),E(this,It).append(n,E(this,yt));const o=this._renderSearchField(),a=this._createBrowseMoreContainer(),c=this._createBrowseImageMain(),d=K("footer");e.onclick=()=>{vn.hide(),H(this,Ie,[]),H(this,we,[])},E(this,Ft).onclick=()=>{E(this,Wt).call(this),vn.hide(),H(this,we,[]),H(this,Ie,[])},d.append(e,E(this,Ft));const l=K("container-right-main");l.append(o,a,c,d),E(this,Ae).append(E(this,It),l),vn.show({content:E(this,Ae)})}_renderUserView(e){const{parentContainerId:t,restrictedFileSize:n,imagePreview:r}=e;H(this,At,document.getElementById(t)),H(this,ct,Q("div","user-view-container"));const i=K("user-view-browse-wrapper","user-view-browse-wrapper"),o=Q("span","","",""),a=this._renderUserViewBrowseButton(),c=Q("p","","margin-block: 0px; font-size:14px");if(c.append(o,a),n){const d=Q("p","","margin-block: 0px; font-size: 13px; color: #777",`Max File size: ${n}MB`);i.append(qn(),c,d)}else i.append(qn(),c);return E(this,ct).append(i),r&&this._renderImagePreview(r,"",i,!0),E(this,At).appendChild(E(this,ct)),E(this,At)}_renderImagePreview(e,t,n,r=!1){var T;const i=document.getElementById("user-view-browse-wrapper"),o=i||n;o&&(o.style.display="none");const a=document.getElementById("user-image-preview");a&&a.remove();const c=Q("div","user-image-preview");c.id="user-image-preview";const d=this._renderImageLoadingContainer();c.appendChild(d);const l=Q("img","",`max-width: ${E(this,dt)?E(this,dt):230}px;max-height:${E(this,Jt)?E(this,Jt):250}px;object-fit:cover;`);l.src=e,l.alt=t||"";const u=this._renderImageErrorContainer();c.appendChild(u),l.onload=()=>{f.style.display="none",d.style.display="none",d.remove(),u.style.display="none",u.remove(),l.style.display="block",f.style.display=r?"flex":"none"},l.onerror=C=>{d.style.display="none",d.remove(),u.style.display="flex",l.style.display="none",f.style.display="none"};const h=u.querySelector("#retry-image-btn");h==null||h.addEventListener("click",()=>{d.style.display="flex",u.style.display="none",f.style.display="none",l.src=e});const f=Q("div","","width: 18px; height: 18px; display:none; cursor:pointer; align-items: center; justify-content: center; padding: 4px; position: absolute; top: -5px; right: -5px; background: #c10007; border-radius: 50%;z-index:1");f.id="remove-preview-btn";const y=jn();y.style.fill="#fff",f==null||f.appendChild(y),f.addEventListener("click",()=>{E(this,cn).call(this)});const k=Q("button","","display:none");k.id="image-preview-hidden-btn",k.addEventListener("click",C=>{var R;C.preventDefault(),C.stopPropagation(),(R=E(this,ct))==null||R.removeChild(c),E(this,dn).call(this),this._removeUserToast(),o&&(o.style.display="flex")}),c==null||c.append(l,f,k),(T=E(this,ct))==null||T.append(c)}_renderImageErrorContainer(){const e=Q("div","","display: none; text-align: center;");return e.innerHTML=`
25
25
  <div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%;">
26
26
  <p style="color: #c10007;margin-block:0px;">Failed to load image</p>
27
27
  <button type="button" id="retry-image-btn" style="margin-top: 10px; padding: 5px 10px; background: #3498db; color: white; border: none; border-radius: 4px; cursor: pointer;">
28
28
  Retry
29
29
  </button>
30
30
  </div>
31
- `,e}_renderImageLoadingContainer(){const e=pe("div","image-loader");return e.innerHTML=`
31
+ `,e}_renderImageLoadingContainer(){const e=Q("div","image-loader");return e.innerHTML=`
32
32
  <div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%;">
33
33
  <div style="width: 20px; height: 20px; border: 3px solid #f3f3f3; border-top: 3px solid #3498db; border-radius: 50%; animation: spin 1s linear infinite;"></div>
34
34
  <p style="margin-top: 10px;">Loading...</p>
35
35
  </div>
36
- `,e}_renderRemovePreviewBtn(){const e=document.getElementById("remove-preview-btn");e&&(e.style.display="flex")}async _readFileAsBase64(e){const t=F(this,dn)*1024*1024;if(e.size>t){this._renderUserToast(F(this,hn)?F(this,hn):`File size must be less than ${F(this,dn)}MB.`,"error");return}G(this,yt,!0),F(this,pn).call(this,!0);try{const n=await ni(e);this._removeUserToast();const i=new FileReader;i.readAsDataURL(n),i.onload=()=>{this._userViewUploadAndAddSelectedImageList(i.result,e)},i.onerror=()=>{console.error("Error reading file:",i.error)}}catch(n){this._renderUserToast(n==null?void 0:n.message,"error")}}_renderUserToast(e,t="success"){const n=pe("div","","display:flex;align-items:center;gap:5px;margin-top:5px;");n.id="user-toast-container";const i=pe("p","","margin-block:0px;font-size:14px;padding-top:3px");i.textContent=e,i.style.color=t==="success"?"#4caf50":"#ee3f3f";const s=t==="success"?Kr("#4caf50"):sr();s.style.width="15px",s.style.height="15px",n.append(s,i),F(this,It).appendChild(n)}_removeUserToast(){const e=document.getElementById("user-toast-container");e&&e.remove()}_renderUserViewBrowseButton(){const e=cr("file");e.style.display="none",e.setAttribute("multiple","true"),e.setAttribute("accept","image/*");const t=pe("a","user-upload-btn","","Click to upload");return t.classList.add("user-upload-btn"),t.role="button",t.addEventListener("click",()=>{this._removeUserToast(),e.click()}),e.addEventListener("change",()=>{const n=e.files[0];n&&this._readFileAsBase64(n),e.value=""}),t}_renderUserUploading(){const e=pe("div","","margin-top:5px;margin-bottom:8px;display:flex;flex-direction:column;align-items:center;gap:5px;font-weight:600;font-size:14px");e.id="user-uploading",e.innerHTML="Uploading...";const t=pe("div","linear-loader",`width:${F(this,Ft)?F(this,Ft):230}px;max-width:${F(this,Ft)?F(this,Ft):230}px`);e.appendChild(t),F(this,It).append(e)}_removeUserUploading(){const e=document.getElementById("user-uploading");e&&e.remove()}async _userViewUploadAndAddSelectedImageList(e,t){this._renderUserUploading();try{this._renderImagePreview(e,t.name);const n=await ur(e,t,F(this,Ge),!1);await this._uploadForUser(n,t),F(this,fn)&&this._renderUserToast(F(this,fn),"success")}catch{this._renderUserToast(F(this,un)?F(this,un):"Error uploading. Please try again later.","error")}finally{G(this,yt,!1),F(this,pn).call(this,!1),this._removeUserUploading(),this._renderRemovePreviewBtn()}}async _uploadForUser(e,t){var n;try{const i=await $r(e,gt[lr((n=t.type)==null?void 0:n.split("/")[0])],F(this,Ge));G(this,ln,i==null?void 0:i.response),F(this,on).call(this)}catch(i){throw Error(i)}}_createAllAndSelectedTab(e){const t=le("select-options"),n=En("Browse","select"),i=En("Selected","select","selected-images-tab");n.classList.add("selected"),[n,i].forEach((d,u)=>{d.addEventListener("click",()=>{var g;G(this,Ht,u),(g=document.querySelector(".select.selected"))==null||g.classList.remove("selected"),d.classList.add("selected"),this._updateSelectedImageListContainerUI()})}),t.append(n,i),e.appendChild(t)}_renderUploadButton(){const e=cr("file");e.style.display="none",e.setAttribute("multiple","true"),e.setAttribute("accept","image/*,video/*,audio/*,.gif"),G(this,xt,document.createElement("button")),F(this,xt).className="browse-more-btn";const t=document.createElement("span");return t.textContent="Upload",F(this,xt).append(ar(),t),F(this,xt).type="button",F(this,xt).addEventListener("click",()=>e.click()),e.addEventListener("change",async()=>{const n=e.files[0];try{G(this,yt,!0);const i=new FileReader;i.readAsDataURL(n),i.onload=async()=>{await this._uploadAndAddSelectedImageList(i.result,n)}}catch(i){this._renderToastContainer(i,"error",F(this,He))}e.value=""}),F(this,xt)}_renderCreateFolderBtn(){const e=document.createElement("button");e.className="create-folder-btn";const t=document.createElement("span");return t.textContent="Create",e.append(Gr(),t),this._createUpdateFolderDialog(e,"create"),e}_renderSearchField(){let e;const t=le("search-browse-container"),n=le("search-input-wrapper","search-input-wrapper");G(this,$t,cr("search")),F(this,$t).value="",F(this,$t).addEventListener("input",s=>{G(this,ze,[]);const d=s.target;e&&clearTimeout(e),e=setTimeout(()=>{if(!d.value){G(this,kt,""),G(this,Pt,!1),G(this,_t,!1),this._fetchFilesFromFolder(F(this,Mt));return}G(this,_t,!0),G(this,an,d.value),this._search(F(this,an))},750)}),F(this,$t).setAttribute("placeholder","Search");const i=Fs();return i.style.position="absolute",i.style.top="50%",i.style.left="5%",i.style.transform="translate(-5%, -50%)",n.append(i,F(this,$t)),t.append(n),t}_createBrowseMoreContainer(){G(this,Jt,le("browse-more-btn-container")),this._createAllAndSelectedTab(F(this,Jt));const e=this._renderUploadButton(),t=this._renderCreateFolderBtn(),n=document.createElement("div");return n.style.display="flex",n.style.alignItems="center",n.style.gap="10px",n.append(e,t),F(this,Jt).appendChild(n),F(this,Jt)}_createBrowseImageMain(){const e=le("browse-image-main");return G(this,We,le("selected-image-container")),F(this,We).addEventListener("scroll",()=>{const t=F(this,We).clientHeight,n=F(this,We).scrollTop,i=F(this,We).scrollHeight;t+n>=i-5&&F(this,Pt)&&(F(this,_t)?this._search(F(this,an)):this._fetchFilesFromFolder(F(this,Mt)))}),e.appendChild(F(this,We)),e}_renderFetchingSkeletonUI(){for(let e=0;e<20;e++){const t=le("skeleton");t.innerHTML="",F(this,We).append(t)}}_renderEmptyImageContainer(){if(F(this,ot)||F(this,yt))return;const e=le(),t=le(),n=document.createElement("p");F(this,_t)&&F(this,Ht)===0?(t.innerHTML=`
36
+ `,e}_renderRemovePreviewBtn(){const e=document.getElementById("remove-preview-btn");e&&(e.style.display="flex")}async _readFileAsBase64(e){const t=E(this,Zt)*1024*1024;if(e.size>t){this._renderUserToast(E(this,Kt)?E(this,Kt):`File size must be less than ${E(this,Zt)}MB.`,"error");return}H(this,tt,!0),E(this,Gt).call(this,!0);try{const n=await Qr(e);this._removeUserToast();const r=new FileReader;r.readAsDataURL(n),r.onload=()=>{this._userViewUploadAndAddSelectedImageList(r.result,e)},r.onerror=()=>{console.error("Error reading file:",r.error)}}catch(n){this._renderUserToast(n==null?void 0:n.message,"error")}}_renderUserToast(e,t="success"){const n=Q("div","","display:flex;align-items:center;gap:5px;margin-top:5px;");n.id="user-toast-container";const r=Q("p","","margin-block:0px;font-size:14px;padding-top:3px");r.textContent=e,r.style.color=t==="success"?"#4caf50":"#ee3f3f";const i=t==="success"?Lr("#4caf50"):Wn();i.style.width="15px",i.style.height="15px",n.append(i,r),E(this,ct).appendChild(n)}_removeUserToast(){const e=document.getElementById("user-toast-container");e&&e.remove()}_renderUserViewBrowseButton(){const e=Kn("file");e.style.display="none",e.setAttribute("multiple","true"),e.setAttribute("accept","image/*");const t=Q("a","user-upload-btn","","Click to upload");return t.classList.add("user-upload-btn"),t.role="button",t.addEventListener("click",()=>{this._removeUserToast(),e.click()}),e.addEventListener("change",()=>{const n=e.files[0];n&&this._readFileAsBase64(n),e.value=""}),t}_renderUserUploading(){const e=Q("div","","margin-top:5px;margin-bottom:8px;display:flex;flex-direction:column;align-items:center;gap:5px;font-weight:600;font-size:14px");e.id="user-uploading",e.innerHTML="Uploading...";const t=Q("div","linear-loader",`width:${E(this,dt)?E(this,dt):230}px;max-width:${E(this,dt)?E(this,dt):230}px`);e.appendChild(t),E(this,ct).append(e)}_removeUserUploading(){const e=document.getElementById("user-uploading");e&&e.remove()}async _userViewUploadAndAddSelectedImageList(e,t){this._renderUserUploading();try{this._renderImagePreview(e,t.name);const n=await Gr(e,t,E(this,Se),!1);await this._uploadForUser(n,t),E(this,Xt)&&this._renderUserToast(E(this,Xt),"success")}catch{this._renderUserToast(E(this,zt)?E(this,zt):"Error uploading. Please try again later.","error")}finally{H(this,tt,!1),E(this,Gt).call(this,!1),this._removeUserUploading(),this._renderRemovePreviewBtn()}}async _uploadForUser(e,t){var n;try{const r=await ns(e,Qe[Zn((n=t.type)==null?void 0:n.split("/")[0])],E(this,Se));H(this,qt,r==null?void 0:r.response),E(this,Wt).call(this)}catch(r){throw Error(r)}}_createAllAndSelectedTab(e){const t=K("select-options"),n=sn("Browse","select"),r=sn("Selected","select","selected-images-tab");n.classList.add("selected"),[n,r].forEach((o,a)=>{o.addEventListener("click",()=>{var c;H(this,Nt,a),(c=document.querySelector(".select.selected"))==null||c.classList.remove("selected"),o.classList.add("selected"),this._updateSelectedImageListContainerUI()})}),t.append(n,r),e.appendChild(t)}_renderUploadButton(){const e=Kn("file");e.style.display="none",e.setAttribute("multiple","true"),e.setAttribute("accept","image/*,video/*,audio/*,.gif"),H(this,wt,document.createElement("button")),E(this,wt).className="browse-more-btn";const t=document.createElement("span");return t.textContent="Upload",E(this,wt).append(qn(),t),E(this,wt).type="button",E(this,wt).addEventListener("click",()=>e.click()),e.addEventListener("change",async()=>{const n=e.files[0];try{H(this,tt,!0);const r=new FileReader;r.readAsDataURL(n),r.onload=async()=>{await this._uploadAndAddSelectedImageList(r.result,n)}}catch(r){this._renderToastContainer(r,"error",E(this,Ae))}e.value=""}),E(this,wt)}_renderCreateFolderBtn(){const e=document.createElement("button");e.className="create-folder-btn";const t=document.createElement("span");return t.textContent="Create",e.append(xr(),t),this._createUpdateFolderDialog(e,"create"),e}_renderSearchField(){let e;const t=K("search-browse-container"),n=K("search-input-wrapper","search-input-wrapper");H(this,Lt,Kn("search")),E(this,Lt).value="",E(this,Lt).addEventListener("input",i=>{H(this,Ie,[]);const o=i.target;e&&clearTimeout(e),e=setTimeout(()=>{if(!o.value){H(this,lt,""),H(this,Tt,!1),H(this,bt,!1),this._fetchFilesFromFolder(E(this,kt));return}H(this,bt,!0),H(this,jt,o.value),this._search(E(this,jt))},750)}),E(this,Lt).setAttribute("placeholder","Search");const r=ks();return r.style.position="absolute",r.style.top="50%",r.style.left="5%",r.style.transform="translate(-5%, -50%)",n.append(r,E(this,Lt)),t.append(n),t}_createBrowseMoreContainer(){H(this,Mt,K("browse-more-btn-container")),this._createAllAndSelectedTab(E(this,Mt));const e=this._renderUploadButton(),t=this._renderCreateFolderBtn(),n=document.createElement("div");return n.style.display="flex",n.style.alignItems="center",n.style.gap="10px",n.append(e,t),E(this,Mt).appendChild(n),E(this,Mt)}_createBrowseImageMain(){const e=K("browse-image-main");return H(this,ke,K("selected-image-container")),E(this,ke).addEventListener("scroll",()=>{const t=E(this,ke).clientHeight,n=E(this,ke).scrollTop,r=E(this,ke).scrollHeight;t+n>=r-5&&E(this,Tt)&&(E(this,bt)?this._search(E(this,jt)):this._fetchFilesFromFolder(E(this,kt)))}),e.appendChild(E(this,ke)),e}_renderFetchingSkeletonUI(){for(let e=0;e<20;e++){const t=K("skeleton");t.innerHTML="",E(this,ke).append(t)}}_renderEmptyImageContainer(){if(E(this,je)||E(this,tt))return;const e=K(),t=K(),n=document.createElement("p");E(this,bt)&&E(this,Nt)===0?(t.innerHTML=`
37
37
  <svg width="300" height="300" viewBox="0 0 1000 1000" fill="none" xmlns="http://www.w3.org/2000/svg">
38
38
  <g clip-path="url(#clip0_2304_257)">
39
39
  <path d="M564.829 772.4H336.658V948.386H564.829V772.4Z" fill="#EBEBEB"/>
@@ -117,4 +117,4 @@ self.addEventListener('message', async (e) => {
117
117
  </clipPath>
118
118
  </defs>
119
119
  </svg>
120
- `,n.textContent="Looks Empty!"),e.append(t,n),F(this,We).appendChild(e)}_renderLoadingUI(){const e=le("skeleton");e.innerHTML="",F(this,We).appendChild(e)}_fileCardBody(e){var se,Q,re,Y;const t=le("selected-image-content"),n=le("selected-image-top-bar"),i=st("","selected-image-btn","",!1,'<svg width="20px" height="20px" viewBox="0 0 20 20" focusable="false" fill="currentColor"><path fill="none" d="M0 0h20v20H0V0z"></path><path d="M10 6c.82 0 1.5-.68 1.5-1.5S10.82 3 10 3s-1.5.67-1.5 1.5S9.18 6 10 6zm0 5.5c.82 0 1.5-.68 1.5-1.5s-.68-1.5-1.5-1.5-1.5.68-1.5 1.5.68 1.5 1.5 1.5zm0 5.5c.82 0 1.5-.67 1.5-1.5 0-.82-.68-1.5-1.5-1.5s-1.5.68-1.5 1.5c0 .83.68 1.5 1.5 1.5z"></path></svg>');let s,d;(e==null?void 0:e.type)===gt.IMAGE&&(s=ei(e==null?void 0:e.url,"selected-image"),d=As()),(e==null?void 0:e.type)===gt.VIDEO&&(s=Bs(e==null?void 0:e.url,"uploaded-video"),d=Ns()),(e==null?void 0:e.type)===gt.AUDIO&&(s=Os(e==null?void 0:e.url,"uploaded-audio"),d=vs());const u=le("selected-image-wrapper");u.setAttribute("data-key",e==null?void 0:e.key);const g=En(e==null?void 0:e.name,"selected-image-name"),v=Ae("","selected-image-type");v.append(d),n.append(v,i);const V=le();V.style.marginTop="10px",V.style.display="flex",V.style.justifyContent="space-between",V.style.alignItems="center",V.append(g),t.append(n,s),u.append(t,V);const ne=le("action-wrapper"),ie=st("","action-option preview"),he=Ae("Preview",""),we=Is();ie.append(we,he);const Ue=st("","action-option move"),me=Ae("Move",""),be=ks();Ue.append(be,me);const Se=st("","action-option rename"),et=Ae("Rename",""),de=Xr();Se.append(de,et);const oe=st("","action-option delete"),Fe=Ae("Delete",""),Ze=Jr();oe.append(Ze,Fe);const Re=e.name.split(".")[0],jt=e.name.split(".")[1],jn=Cn[e.type],Nn=le("edit-form-wrapper"),Tn=le("move-form-wrapper"),Ln=le("preview-details-container"),qn=le("preview-details-wrapper"),gn=le("preview-option-image-wrapper"),zn=le("preview-option-wrapper"),Ke=le("preview-option-wrapper"),P=le("preview-option-wrapper"),Z=le("preview-option-wrapper"),J=le("preview-option-wrapper"),E=le("preview-option-wrapper"),o=le("preview-option-wrapper"),a=ei(e.url,"preview-option-image");gn.append(a);const C=Ae("File name","preview-title"),p=le("preview-option-name");p.innerHTML=e.name,zn.append(C,p);const I=Ae("Folder name","preview-title"),U=Ae(e.folderName,"preview-option-name");Ke.append(I,U);const c=Ae("File Extension","preview-title"),h=Ae(jt,"preview-option-name extension");P.append(c,h);const l=Ae("File type","preview-title"),m=Ae(jn,"preview-option-name");Z.append(l,m);const A=Ae("Dimension","preview-title"),O=Ae(`${(se=e==null?void 0:e.metadata)==null?void 0:se.width} * ${(Q=e==null?void 0:e.metadata)==null?void 0:Q.height}`,"preview-option-name");J.append(A,O);const H=Ae("URL","preview-title"),x=Ae(e.url,"preview-option-name url");E.append(H,x);const X=Ae("Parent folder","preview-title"),j=Ae(e.nestedFolderName,"preview-option-name");o.append(X,j),qn.append(Ke,zn,P,Z,((re=e==null?void 0:e.metadata)==null?void 0:re.width)>0&&((Y=e==null?void 0:e.metadata)==null?void 0:Y.height)>0?J:"",E,e.nestedFolderName?o:""),Ln.append(gn,qn);const M=le("form-control"),z=document.createElement("input");M.appendChild(z),z.classList.add("input-field"),z.value=e.name;const k=le("form-control"),W=Ae("Current Folder:","input-label"),y=le("folder-field current");y.textContent=e.folderName,y.prepend(bn()),k.append(W,y);const w=le("form-control"),N=le();N.style.width="100%",N.style.display="flex",N.style.alignItems="center",N.style.justifyContent="space-between";const _=Ae("Suggested Folder List:","input-label"),L=Ae();L.style.display="flex",L.style.alignItems="center",L.style.gap="5px",L.style.fontSize="14px",L.textContent="Move the file in selected folder",L.appendChild(sr("14px","14px","#333")),N.append(_,L);const B=le();B.style.width="100%",B.style.maxHeight="250px",B.style.overflowY="auto";const T=document.createElement("ul");T.className="folders",B.append(T),w.append(N,B),F(this,vt).forEach(D=>{const ae=this._renderEditFolderListContainer(D);T.appendChild(ae)});const R=le("form-control"),b=Ae("Destination Folder:","input-label"),f=le("folder-field source","source-folder-wrapper"),q=document.createElement("span");q.id="source-folder-name",q.textContent=F(this,Zt)?F(this,Zt):e.folderName,f.append(bn(),q);let S="";R.append(b,f),z.onchange=D=>{S=D.target.value},S=S!==""?S:e.name,Nn.append(M),Tn.append(k,w,R),ne.append(ie,Ue,Se,oe),ie.onclick=D=>{D.stopPropagation(),ht.hide(),Ve.show({content:Ln,header:Re,dialogContentStyle:{minWidth:"60rem",padding:"10px"},showCloseBtn:!0})},Ue.onclick=D=>{D.stopPropagation(),ht.hide(),Ve.show({content:Tn,header:`Move "${e.name}"`,confirmButtonText:"Move",dialogContentStyle:{minWidth:"35rem",padding:"10px"},showCloseBtn:!0,showFooter:!0,onCancel:()=>{Ve.hide()},onConfirm:()=>{this._updateFile(S,e)}})},Se.onclick=D=>{D.stopPropagation(),ht.hide(),Ve.show({content:Nn,header:"Rename",confirmButtonText:"Update",dialogContentStyle:{padding:"10px"},showCloseBtn:!0,showFooter:!0,onCancel:()=>{Ve.hide()},onConfirm:()=>{this._updateFile(S,e)}})},oe.onclick=D=>{D.stopPropagation(),ht.hide(),Ve.show({content:"",dialogContentStyle:{minWidth:"32rem",padding:"10px"},header:`Are you sure you want to delete the file "${e.name}"?`,showFooter:!0,confirmButtonText:"Yes",cancelButtonText:"No",onConfirm:()=>{this._deleteFile(e.key)}})},i.addEventListener("click",D=>{D.stopPropagation(),ht.hide(),ht.show({content:ne,mainContainer:n,divId:e.key}),G(this,Bt,e.key)}),s.addEventListener("click",()=>{const D=F(this,Oe).findIndex(ge=>(ge==null?void 0:ge.key)===(e==null?void 0:e.key));if(t.classList.contains("checked"))t.classList.remove("checked"),D!==-1&&(F(this,Oe).splice(D,1),F(this,Ht)===1&&u.remove());else{if(F(this,$n))F(this,Oe).push(e);else{const ge=document.querySelector(".selected-image-wrapper .checked");ge==null||ge.classList.remove("checked"),G(this,Oe,[e])}t.classList.add("checked")}this._updateContent()}),document.addEventListener("click",D=>{const ae=document.querySelector(`#${F(this,Bt)}`);ae&&(D.composedPath().includes(ae)||ht.hide())}),F(this,Oe).findIndex(D=>(D==null?void 0:D.key)===(e==null?void 0:e.key))!==-1?(t.classList.add("checked"),F(this,_t)?F(this,We).prepend(u):F(this,We).appendChild(u)):F(this,We).appendChild(u)}_renderImageCard(e){this._fileCardBody(e)}_renderImageListContainer(){var e,t;((e=F(this,ze))==null?void 0:e.length)>0&&((t=F(this,ze))==null||t.forEach(n=>{this._renderImageCard(n)}))}_renderSelectedImageListContainer(){var e;((e=F(this,Oe))==null?void 0:e.length)>0&&F(this,Oe).forEach(t=>{this._renderImageCard(t)})}_renderFolderListLoadingUI(){const e=document.createElement("div");e.style.paddingInline="20px";for(let t=0;t<4;t++){const n=le("skeleton");n.className="skeleton folder",n.innerHTML="",e.appendChild(n)}return e}_renderFolderListContainer(e){var d;const t=document.createElement("li");t.className="folder";const n=document.createElement("div");n.style.position="relative",n.style.display="flex",n.style.alignItems="center",n.style.gap="2px";const i=document.createElement("span"),s=document.createElement("span");if(s.className="folder-name",s.textContent=e==null?void 0:e.name,i.appendChild(bn()),n.append(i,s),t.append(n),e.children&&Object.keys(e.children).length>0){const u=document.createElement("button");u.classList.add("expand-icon"),u.appendChild(zr()),n.prepend(u);const g=document.createElement("ul");g.className="folders nested",t.appendChild(g),u.addEventListener("click",v=>{v.stopPropagation(),t.classList.toggle("active"),g.classList.toggle("visible")}),Object.values(e.children).forEach((v,V)=>{const ne=this._renderFolderListContainer(v);g.appendChild(ne)})}if(e.nestedFolderName){const u=st("","folder-option-btn","moveToInputField.disabled",!1,'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-ellipsis"><circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/></svg>'),g=le("action-wrapper"),v=st("","action-option edit"),V=Ae("Edit",""),ne=Xr();v.append(ne,V);const ie=le("edit-form-wrapper"),he=le("name-field-wrapper"),we=Ae("Name","input-label"),Ue=document.createElement("input");Ue.classList.add("input-field"),Ue.value=e.name,Ue.onchange=de=>{de.target.value},he.append(we,Ue),ie.append(he);const me={key:e.key,name:e.name,nestedFolderName:e.nestedFolderName,createdBy:e.createdBy};this._createUpdateFolderDialog(v,"update",me);const be=st("","action-option delete"),Se=Ae("Delete",""),et=Jr();be.append(et,Se),g.append(v,be),be.onclick=de=>{de.stopPropagation(),ht.hide(),Ve.show({content:"",dialogContentStyle:{minWidth:"32rem",padding:"10px"},header:`Are you sure you want to delete the folder "${e==null?void 0:e.name}"?`,showFooter:!0,confirmButtonText:"Yes",cancelButtonText:"No",onConfirm:()=>{this._deleteFolder(e.key)}})},u.addEventListener("click",de=>{de.stopPropagation();const oe=document.querySelector(`#${e.key}`);G(this,Bt,null),F(this,Bt)===e.key&&oe!==null?ht.hide():(ht.hide(),ht.show({content:g,mainContainer:n,divId:e.key}),G(this,Bt,e.key))}),n.appendChild(u)}return t.addEventListener("click",u=>{var g;u.stopPropagation(),G(this,bt,e),G(this,Mt,e==null?void 0:e.name),G(this,Oe,[]),G(this,ze,[]),G(this,kt,""),G(this,Pt,!1),(g=document.querySelector(".folder.selected"))==null||g.classList.remove("selected"),t.classList.add("selected"),this._fetchFilesFromFolder(e.name)}),((d=F(this,bt))==null?void 0:d.key)===(e==null?void 0:e.key)&&t.classList.add("selected"),t}_renderEditFolderListContainer(e){var d;const t=document.createElement("li");t.className="folder-move";const n=document.createElement("div");n.style.position="relative",n.style.display="flex",n.style.alignItems="center",n.style.gap="2px";const i=document.createElement("span"),s=document.createElement("span");if(s.className="folder-name",s.textContent=e==null?void 0:e.name,i.appendChild(bn()),n.append(i,s),t.append(n),e.children&&Object.keys(e.children).length>0){const u=document.createElement("button");u.classList.add("expand-icon"),u.appendChild(zr()),n.prepend(u);const g=document.createElement("ul");g.className="folders nested",t.appendChild(g),u.addEventListener("click",v=>{v.stopPropagation(),t.classList.toggle("active"),g.classList.toggle("visible")}),Object.values(e.children).forEach(v=>{const V=this._renderEditFolderListContainer(v);g.appendChild(V)})}return t.addEventListener("click",u=>{var v;u.stopPropagation(),G(this,Zt,e==null?void 0:e.name);const g=document.querySelector("#source-folder-name");g.textContent="",g.textContent=e==null?void 0:e.name,(v=document.querySelector(".folder-move.selected"))==null||v.classList.remove("selected"),t.classList.add("selected")}),((d=F(this,bt))==null?void 0:d.key)===(e==null?void 0:e.key)&&t.classList.add("selected"),t}_updateFolderListContainer(){if(F(this,Wt))if(F(this,Ut).innerHTML="",F(this,Gt)){const e=this._renderFolderListLoadingUI();F(this,Ut).appendChild(e)}else{const e=document.createElement("ul");e.className="folders",F(this,Ut).appendChild(e),F(this,vt).forEach(t=>{const n=this._renderFolderListContainer(t);e.appendChild(n)}),F(this,Wt).appendChild(F(this,Ut))}}_renderToastContainer(e,t,n){this._removeToastContainer(),G(this,At,document.createElement("div")),F(this,At).className=`message-container ${t}`;const i=En(e,"message"),s=t==="success"?Kr():sr(),d=st("");d.style.cursor="pointer",d.style.border="0",d.style.outline="none",d.style.background="transparent",d.appendChild(or(t==="error"?"#ee3f3f":"#4caf50")),d.setAttribute("fill",t==="error"?"#ee3f3f":"#4caf50"),d.onclick=()=>this._removeToastContainer(),F(this,At).append(s,i,d),n.appendChild(F(this,At)),setTimeout(()=>{this._removeToastContainer()},5e3)}_removeToastContainer(){F(this,At)&&(F(this,At).remove(),G(this,At,null))}_updateSelectedImageListContainerUI(){var t,n;if(!F(this,We))return;F(this,We).innerHTML="",F(this,yt)&&this._renderLoadingUI(),F(this,ot)&&this._renderFetchingSkeletonUI();const e=document.getElementById("search-input-wrapper");F(this,Ht)===0?(e&&(e.style.visibility="visible"),((t=F(this,ze))==null?void 0:t.length)===0&&!F(this,ot)?(F(this,We).classList.add("no-selected-image-container"),this._renderEmptyImageContainer()):(F(this,We).classList.remove("no-selected-image-container"),this._renderImageListContainer())):(e&&(e.style.visibility="hidden"),((n=F(this,Oe))==null?void 0:n.length)===0?(F(this,We).classList.add("no-selected-image-container"),this._renderEmptyImageContainer()):(F(this,We).classList.remove("no-selected-image-container"),this._renderSelectedImageListContainer())),this._updateContent()}_updateContent(){var t,n,i;const e=document.getElementById("selected-images-tab");e&&(e.textContent=`Selected (${(t=F(this,Oe))==null?void 0:t.length})`),F(this,Vt).textContent=`Save (${(n=F(this,Oe))==null?void 0:n.length})`,F(this,Vt).disabled=((i=F(this,Oe))==null?void 0:i.length)===0}async _uploadAndAddSelectedImageList(e,t){var n,i;this._updateSelectedImageListContainerUI();try{const s=await ur(e,t,F(this,Ge)),d=await as(t==null?void 0:t.name,"",s,gt[lr((n=t.type)==null?void 0:n.split("/")[0])],(i=F(this,bt))==null?void 0:i.name,F(this,Ge));F(this,ze).unshift(d==null?void 0:d.response),this._renderToastContainer("File Uploaded Successfully","success",F(this,He))}catch{this._renderToastContainer("Something went wrong while uploading file. Please try again later.","error",F(this,He))}finally{G(this,yt,!1),this._updateSelectedImageListContainerUI()}}async _updateFile(e,t){Ve.updateUploadBtn(!0);try{const n=await ds(t.key,e,t.nestedFolderName,t.url,t.thumborUrl,t.proxyUrl,t.type,F(this,Zt),F(this,Ge)),i=F(this,ze).find(s=>s.key===n.response.key);i.name=e,this._fetchFilesFromFolder(F(this,bt).name),G(this,ze,[]),G(this,Oe,[]),this._renderToastContainer("File Updated Successfully","success",F(this,He))}catch{this._renderToastContainer("Something went wrong while updating the file. Please try again later.","error",F(this,He))}finally{Ve.updateUploadBtn(!1),Ve.hide(),this._updateSelectedImageListContainerUI()}}async _deleteFile(e){Ve.updateUploadBtn(!0);try{await hs(e,F(this,Ge)),G(this,ze,F(this,ze).filter(t=>e!==t.key)),this._renderToastContainer("File Deleted Successfully","success",F(this,He))}catch{this._renderToastContainer("Something went wrong while deleting the file. Please try again later.","error",F(this,He))}finally{Ve.updateUploadBtn(!1),Ve.hide(),this._updateSelectedImageListContainerUI()}}async _createFolder(e,t=2){var n;try{const i=await bs(e,(n=F(this,bt))==null?void 0:n.name,"",F(this,Ge));G(this,Oe,[]),G(this,ze,[]);const s=Us(F(this,vt),i==null?void 0:i.response);G(this,vt,s),G(this,Mt,e),G(this,bt,{...i==null?void 0:i.response,children:{}}),this._fetchFilesFromFolder(e),this._renderToastContainer(`Folder ${e} created successfully`,"success",F(this,He))}catch{if(t>1)this._createFolder(e,--t);else throw this._renderToastContainer(`Error creating folder "${e}". Either folder already exist or failed to create folder`,"error",F(this,He)),new Error(`Error creating folder "${e}". Either folder already exist or failed to create folder`)}finally{this._updateFolderListContainer()}}async _upload(){return F(this,kn)?F(this,Oe):F(this,ln)}async _uploadFromSource(e){this._removeUserToast();try{const t=await ni(e);return await new Promise((i,s)=>{const d=new FileReader;d.onload=async()=>{var u;try{const g=await ur(d.result,t,F(this,Ge),!1),v=await $r(g,gt[lr((u=t.type)==null?void 0:u.split("/")[0])],F(this,Ge));i(v)}catch(g){s(g)}},d.onerror=()=>s(d.error),d.readAsDataURL(t)})}catch(t){throw t}}_uploadingState(){return F(this,yt)}async _fetchFilesFromFolder(e){var t,n,i;G(this,ot,!0),this._updateSelectedImageListContainerUI();try{const s=await ls(e,F(this,kt),20,F(this,Ge)),d=(t=s.response)==null?void 0:t.files;F(this,ze).push(...d),G(this,kt,(n=s.response)==null?void 0:n.nextCursor),G(this,Pt,(i=s.response)==null?void 0:i.hasMore)}catch{throw this._renderToastContainer("Error while fetching files from folder"+e,"error",F(this,He)),new Error("Something went wrong. Error while fetching files from folder"+e)}finally{G(this,ot,!1),this._updateSelectedImageListContainerUI()}}async _fetchAllFolders(){var e,t;G(this,ot,!0),G(this,Gt,!0),this._updateSelectedImageListContainerUI(),this._updateFolderListContainer(),this._removeToastContainer();try{const i=(await ys("",100,F(this,Ge))).response.folder,s=xs(i);G(this,Mt,(e=s[0])==null?void 0:e.name),this._fetchFilesFromFolder((t=s[0])==null?void 0:t.name),G(this,bt,s[0]),G(this,vt,s)}catch{G(this,ot,!1),this._renderToastContainer("Folder not found. Please create a folder or try again later","error",F(this,He))}finally{G(this,Gt,!1),this._updateFolderListContainer()}}async _search(e){var t,n;G(this,ot,!0),this._updateSelectedImageListContainerUI(),this._removeToastContainer();try{const i=await cs(e,F(this,kt),10,F(this,Ge)),s=(t=i.response)==null?void 0:t.items;F(this,ze).push(...s),G(this,kt,(n=i.response)==null?void 0:n.nextPageCursor)}catch{this._renderToastContainer("Error while searching files","error",F(this,He))}finally{G(this,ot,!1),this._updateSelectedImageListContainerUI()}}async _updateFolder(e,t){Ve.updateUploadBtn(!0);try{const n=await Cs(t.key,e,t.nestedFolderName,t.createdBy,F(this,Ge))}catch{throw this._renderToastContainer("Something went wrong while updating the folder. Please try again later.","error",F(this,He)),new Error("Error updating the folder ")}finally{Ve.updateUploadBtn(!1),Ve.hide(),this._updateFolderListContainer()}}async _deleteFolder(e){Ve.updateUploadBtn(!0);try{await Es(e,F(this,Ge)),G(this,vt,F(this,vt).filter(t=>t.key!==e)),this._renderToastContainer("Folder Deleted Successfully","success",F(this,He))}catch{throw this._renderToastContainer("Something went wrong while deleting the folder. Please try again later.","error",F(this,He)),new Error("Error deleting the folder ")}finally{Ve.updateUploadBtn(!1),Ve.hide(),this._updateFolderListContainer()}}_createUpdateFolderDialog(e,t,n){e.addEventListener("click",i=>{i.stopPropagation(),ht.hide();let s;const d=le("edit-form-wrapper"),u=le("form-control"),g=Ae("Folder Name","input-label"),v=le();v.style.position="relative";const V=document.createElement("input");V.style.paddingLeft="40px";const ne=Ae();ne.appendChild(bn()),ne.style.position="absolute",ne.style.top="50%",ne.style.left="5%",ne.style.transform="translate(-40%, -40%)",V.classList.add("input-field"),v.append(V,ne),t==="update"&&(V.value=n.name),V.onchange=ie=>{s=ie.target.value},u.append(g,v),d.append(u),Ve.show({content:d,header:t==="update"?"Update Folder":"Create Folder",confirmButtonText:t==="create"?"Save":"Update",dialogContentStyle:{minWidth:"35rem",padding:"10px"},showFooter:!0,showCloseBtn:!0,onConfirm:()=>{t==="create"?this._createFolder(s):this._updateFolder(s,n),Ve.hide()}})})}updateWindowObject(e){window.ImageSalonSDK={...window.ImageSalonSDK,...e}}_initializeGrpcConfig(e,t){let n="https://hamro-cms-backend-grpc.hamrostack.com";t&&(e==="production"||e==="development")?n=t:e==="production"&&(n="https://page-api-grpc.hamropatro.com");const i=new zi({baseUrl:n});this.updateWindowObject({grpcConfig:i})}}Dt=new WeakMap,He=new WeakMap,We=new WeakMap,xt=new WeakMap,Oe=new WeakMap,ze=new WeakMap,yt=new WeakMap,ot=new WeakMap,Gt=new WeakMap,Mt=new WeakMap,vt=new WeakMap,bt=new WeakMap,Vt=new WeakMap,on=new WeakMap,fr=new WeakMap,Ht=new WeakMap,Wt=new WeakMap,Ut=new WeakMap,Jt=new WeakMap,At=new WeakMap,kt=new WeakMap,Pt=new WeakMap,$t=new WeakMap,_t=new WeakMap,an=new WeakMap,vn=new WeakMap,Ge=new WeakMap,Bt=new WeakMap,An=new WeakMap,$n=new WeakMap,kn=new WeakMap,It=new WeakMap,ln=new WeakMap,Zt=new WeakMap,cn=new WeakMap,dn=new WeakMap,hn=new WeakMap,un=new WeakMap,fn=new WeakMap,In=new WeakMap,Fn=new WeakMap,pn=new WeakMap,Ft=new WeakMap,mn=new WeakMap,Zn=new WeakMap;const Ws=new ri({parentContainerId:"app",handleUpload:()=>{Ps()},accessToken:"mBearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJtaW5pLWFwcC1zZXJ2aWNlIiwic3ViIjoiZW5ma0JmQ0tqQ2U4S2t1VGRmZXZoMVV6QW1MMiIsImlhdCI6MTc0Mzc4NDg5NSwiZXhwIjoxNzQzOTU3Njk1LCJhcHBJZCI6ImhhbXJvcGF0cm8tYW5kcm9pZCIsIm1pbmlBcHBJZCI6IjNhM2NhYWIwLTJmYzItMTFlZi1iNDQ4LWU2OGRhNmVmOWU4MCIsInByb2ZpbGVJbWFnZSI6Imh0dHBzOi8vbGgzLmdvb2dsZXVzZXJjb250ZW50LmNvbS9hL0FMbTV3dTNuZFpxZEVTcVZiajNmd1FHbV80bkFDTDlubzJJT19tTFA1eFY3PXM5Ni1jIiwiZGlzcGxheU5hbWUiOiJOaXJhaiBMYW1hIiwiZW1haWwiOiJubGFtYUBoYW1yb3BhdHJvLmNvbSIsInBob25lTnVtYmVyIjoiIiwiYWRtaW4iOnRydWUsImJ1c2luZXNzIjpbIjIxNzBlMjEwLTJjOTUtMTFlZi1iNDQ4LWU2OGRhNmVmOWU4MDowIiwiM2EzY2FhYjAtMmZjMi0xMWVmLWI0NDgtZTY4ZGE2ZWY5ZTgwOjEiLCIxYTM1NGY4MC03NDAzLTExZWYtOGU5Ni1iNjk4ZjZiMWJlNzU6MSIsIjg0ZDUzYWU4LTgyYTQtNDJjZi05MzkwLWExYTJiZmY4Yjk5YzoxIl0sInN1c3BlbmRlZCI6ZmFsc2UsInZlcmlmaWVkIjpmYWxzZX0.5LeXJKPz8fXcIvkv-peE5AolVVAuWsWw7ZU2f6kBCPQ",mode:"development",isAdmin:!0}),Ps=()=>{Ws._upload().then(r=>console.log("res",r))};return ri});
120
+ `,n.textContent="Looks Empty!"),e.append(t,n),E(this,ke).appendChild(e)}_renderLoadingUI(){const e=K("skeleton");e.innerHTML="",E(this,ke).appendChild(e)}_fileCardBody(e){var ft,Qt,xn,Yt;const t=K("selected-image-content"),n=K("selected-image-top-bar"),r=We("","selected-image-btn","",!1,'<svg width="20px" height="20px" viewBox="0 0 20 20" focusable="false" fill="currentColor"><path fill="none" d="M0 0h20v20H0V0z"></path><path d="M10 6c.82 0 1.5-.68 1.5-1.5S10.82 3 10 3s-1.5.67-1.5 1.5S9.18 6 10 6zm0 5.5c.82 0 1.5-.68 1.5-1.5s-.68-1.5-1.5-1.5-1.5.68-1.5 1.5.68 1.5 1.5 1.5zm0 5.5c.82 0 1.5-.67 1.5-1.5 0-.82-.68-1.5-1.5-1.5s-1.5.68-1.5 1.5c0 .83.68 1.5 1.5 1.5z"></path></svg>');let i,o;(e==null?void 0:e.type)===Qe.IMAGE&&(i=Sr(e==null?void 0:e.url,"selected-image"),o=Es()),(e==null?void 0:e.type)===Qe.VIDEO&&(i=xs(e==null?void 0:e.url,"uploaded-video"),o=Fs()),(e==null?void 0:e.type)===Qe.AUDIO&&(i=_s(e==null?void 0:e.url,"uploaded-audio"),o=Cs());const a=K("selected-image-wrapper");a.setAttribute("data-key",e==null?void 0:e.key);const c=sn(e==null?void 0:e.name,"selected-image-name"),d=oe("","selected-image-type");d.append(o),n.append(d,r);const l=K();l.style.marginTop="10px",l.style.display="flex",l.style.justifyContent="space-between",l.style.alignItems="center",l.append(c),t.append(n,i),a.append(t,l);const u=K("action-wrapper"),h=We("","action-option preview"),f=oe("Preview",""),y=As();h.append(y,f);const k=We("","action-option move"),T=oe("Move",""),C=vs();k.append(C,T);const R=We("","action-option rename"),O=oe("Rename",""),F=Ur();R.append(F,O);const U=We("","action-option delete"),b=oe("Delete",""),B=_r();U.append(B,b);const m=e.name.split(".")[0],g=e.name.split(".")[1],A=rn[e.type],I=K("edit-form-wrapper"),N=K("move-form-wrapper"),L=K("preview-details-container"),v=K("preview-details-wrapper"),_=K("preview-option-image-wrapper"),w=K("preview-option-wrapper"),p=K("preview-option-wrapper"),M=K("preview-option-wrapper"),x=K("preview-option-wrapper"),V=K("preview-option-wrapper"),Z=K("preview-option-wrapper"),P=K("preview-option-wrapper"),q=Sr(e.url,"preview-option-image");_.append(q);const $=oe("File name","preview-title"),S=K("preview-option-name");S.innerHTML=e.name,w.append($,S);const X=oe("Folder name","preview-title"),ce=oe(e.folderName,"preview-option-name");p.append(X,ce);const te=oe("File Extension","preview-title"),Y=oe(g,"preview-option-name extension");M.append(te,Y);const ae=oe("File type","preview-title"),me=oe(A,"preview-option-name");x.append(ae,me);const Fe=oe("Dimension","preview-title"),Et=oe(`${(ft=e==null?void 0:e.metadata)==null?void 0:ft.width} * ${(Qt=e==null?void 0:e.metadata)==null?void 0:Qt.height}`,"preview-option-name");V.append(Fe,Et);const Ke=oe("URL","preview-title"),fe=oe(e.url,"preview-option-name url");Z.append(Ke,fe);const Le=oe("Parent folder","preview-title"),de=oe(e.nestedFolderName,"preview-option-name");P.append(Le,de),v.append(p,w,M,x,((xn=e==null?void 0:e.metadata)==null?void 0:xn.width)>0&&((Yt=e==null?void 0:e.metadata)==null?void 0:Yt.height)>0?V:"",Z,e.nestedFolderName?P:""),L.append(_,v);const re=K("form-control"),ye=document.createElement("input");re.appendChild(ye),ye.classList.add("input-field"),ye.value=e.name;const Ue=K("form-control"),be=oe("Current Folder:","input-label"),xe=K("folder-field current");xe.textContent=e.folderName,xe.prepend(nn()),Ue.append(be,xe);const ge=K("form-control"),ee=K();ee.style.width="100%",ee.style.display="flex",ee.style.alignItems="center",ee.style.justifyContent="space-between";const Ve=oe("Suggested Folder List:","input-label"),Re=oe();Re.style.display="flex",Re.style.alignItems="center",Re.style.gap="5px",Re.style.fontSize="14px",Re.textContent="Move the file in selected folder",Re.appendChild(Wn("14px","14px","#333")),ee.append(Ve,Re);const ht=K();ht.style.width="100%",ht.style.maxHeight="250px",ht.style.overflowY="auto";const Ne=document.createElement("ul");Ne.className="folders",ht.append(Ne),ge.append(ee,ht),E(this,ot).forEach(ue=>{const ze=this._renderEditFolderListContainer(ue);Ne.appendChild(ze)});const ut=K("form-control"),_e=oe("Destination Folder:","input-label"),$e=K("folder-field source","source-folder-wrapper"),De=document.createElement("span");De.id="source-folder-name",De.textContent=E(this,Ut)?E(this,Ut):e.folderName,$e.append(nn(),De);let Me="";ut.append(_e,$e),ye.onchange=ue=>{Me=ue.target.value},Me=Me!==""?Me:e.name,I.append(re),N.append(Ue,ge,ut),u.append(h,k,R,U),h.onclick=ue=>{ue.stopPropagation(),Ze.hide(),ve.show({content:L,header:m,dialogContentStyle:{minWidth:"60rem",padding:"10px"},showCloseBtn:!0})},k.onclick=ue=>{ue.stopPropagation(),Ze.hide(),ve.show({content:N,header:`Move "${e.name}"`,confirmButtonText:"Move",dialogContentStyle:{minWidth:"35rem",padding:"10px"},showCloseBtn:!0,showFooter:!0,onCancel:()=>{ve.hide()},onConfirm:()=>{this._updateFile(Me,e)}})},R.onclick=ue=>{ue.stopPropagation(),Ze.hide(),ve.show({content:I,header:"Rename",confirmButtonText:"Update",dialogContentStyle:{padding:"10px"},showCloseBtn:!0,showFooter:!0,onCancel:()=>{ve.hide()},onConfirm:()=>{this._updateFile(Me,e)}})},U.onclick=ue=>{ue.stopPropagation(),Ze.hide(),ve.show({content:"",dialogContentStyle:{minWidth:"32rem",padding:"10px"},header:`Are you sure you want to delete the file "${e.name}"?`,showFooter:!0,confirmButtonText:"Yes",cancelButtonText:"No",onConfirm:()=>{this._deleteFile(e.key)}})},r.addEventListener("click",ue=>{ue.stopPropagation(),Ze.hide(),Ze.show({content:u,mainContainer:n,divId:e.key}),H(this,Ct,e.key)}),i.addEventListener("click",()=>{const ue=E(this,we).findIndex(pt=>(pt==null?void 0:pt.key)===(e==null?void 0:e.key));if(t.classList.contains("checked"))t.classList.remove("checked"),ue!==-1&&(E(this,we).splice(ue,1),E(this,Nt)===1&&a.remove());else{if(E(this,Un))E(this,we).push(e);else{const pt=document.querySelector(".selected-image-wrapper .checked");pt==null||pt.classList.remove("checked"),H(this,we,[e])}t.classList.add("checked")}this._updateContent()}),document.addEventListener("click",ue=>{const ze=document.querySelector(`#${E(this,Ct)}`);ze&&(ue.composedPath().includes(ze)||Ze.hide())}),E(this,we).findIndex(ue=>(ue==null?void 0:ue.key)===(e==null?void 0:e.key))!==-1?(t.classList.add("checked"),E(this,bt)?E(this,ke).prepend(a):E(this,ke).appendChild(a)):E(this,ke).appendChild(a)}_renderImageCard(e){this._fileCardBody(e)}_renderImageListContainer(){var e,t;((e=E(this,Ie))==null?void 0:e.length)>0&&((t=E(this,Ie))==null||t.forEach(n=>{this._renderImageCard(n)}))}_renderSelectedImageListContainer(){var e;((e=E(this,we))==null?void 0:e.length)>0&&E(this,we).forEach(t=>{this._renderImageCard(t)})}_renderFolderListLoadingUI(){const e=document.createElement("div");e.style.paddingInline="20px";for(let t=0;t<4;t++){const n=K("skeleton");n.className="skeleton folder",n.innerHTML="",e.appendChild(n)}return e}_renderFolderListContainer(e){var o;const t=document.createElement("li");t.className="folder";const n=document.createElement("div");n.style.position="relative",n.style.display="flex",n.style.alignItems="center",n.style.gap="2px";const r=document.createElement("span"),i=document.createElement("span");if(i.className="folder-name",i.textContent=e==null?void 0:e.name,r.appendChild(nn()),n.append(r,i),t.append(n),e.children&&Object.keys(e.children).length>0){const a=document.createElement("button");a.classList.add("expand-icon"),a.appendChild(Tr()),n.prepend(a);const c=document.createElement("ul");c.className="folders nested",t.appendChild(c),a.addEventListener("click",d=>{d.stopPropagation(),t.classList.toggle("active"),c.classList.toggle("visible")}),Object.values(e.children).forEach((d,l)=>{const u=this._renderFolderListContainer(d);c.appendChild(u)})}if(e.nestedFolderName){const a=We("","folder-option-btn","moveToInputField.disabled",!1,'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-ellipsis"><circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/></svg>'),c=K("action-wrapper"),d=We("","action-option edit"),l=oe("Edit",""),u=Ur();d.append(u,l);const h=K("edit-form-wrapper"),f=K("name-field-wrapper"),y=oe("Name","input-label"),k=document.createElement("input");k.classList.add("input-field"),k.value=e.name,k.onchange=F=>{F.target.value},f.append(y,k),h.append(f);const T={key:e.key,name:e.name,nestedFolderName:e.nestedFolderName,createdBy:e.createdBy};this._createUpdateFolderDialog(d,"update",T);const C=We("","action-option delete"),R=oe("Delete",""),O=_r();C.append(O,R),c.append(d,C),C.onclick=F=>{F.stopPropagation(),Ze.hide(),ve.show({content:"",dialogContentStyle:{minWidth:"32rem",padding:"10px"},header:`Are you sure you want to delete the folder "${e==null?void 0:e.name}"?`,showFooter:!0,confirmButtonText:"Yes",cancelButtonText:"No",onConfirm:()=>{this._deleteFolder(e.key)}})},a.addEventListener("click",F=>{F.stopPropagation();const U=document.querySelector(`#${e.key}`);H(this,Ct,null),E(this,Ct)===e.key&&U!==null?Ze.hide():(Ze.hide(),Ze.show({content:c,mainContainer:n,divId:e.key}),H(this,Ct,e.key))}),n.appendChild(a)}return t.addEventListener("click",a=>{var c;a.stopPropagation(),H(this,nt,e),H(this,kt,e==null?void 0:e.name),H(this,we,[]),H(this,Ie,[]),H(this,lt,""),H(this,Tt,!1),(c=document.querySelector(".folder.selected"))==null||c.classList.remove("selected"),t.classList.add("selected"),this._fetchFilesFromFolder(e.name)}),((o=E(this,nt))==null?void 0:o.key)===(e==null?void 0:e.key)&&t.classList.add("selected"),t}_renderEditFolderListContainer(e){var o;const t=document.createElement("li");t.className="folder-move";const n=document.createElement("div");n.style.position="relative",n.style.display="flex",n.style.alignItems="center",n.style.gap="2px";const r=document.createElement("span"),i=document.createElement("span");if(i.className="folder-name",i.textContent=e==null?void 0:e.name,r.appendChild(nn()),n.append(r,i),t.append(n),e.children&&Object.keys(e.children).length>0){const a=document.createElement("button");a.classList.add("expand-icon"),a.appendChild(Tr()),n.prepend(a);const c=document.createElement("ul");c.className="folders nested",t.appendChild(c),a.addEventListener("click",d=>{d.stopPropagation(),t.classList.toggle("active"),c.classList.toggle("visible")}),Object.values(e.children).forEach(d=>{const l=this._renderEditFolderListContainer(d);c.appendChild(l)})}return t.addEventListener("click",a=>{var d;a.stopPropagation(),H(this,Ut,e==null?void 0:e.name);const c=document.querySelector("#source-folder-name");c.textContent="",c.textContent=e==null?void 0:e.name,(d=document.querySelector(".folder-move.selected"))==null||d.classList.remove("selected"),t.classList.add("selected")}),((o=E(this,nt))==null?void 0:o.key)===(e==null?void 0:e.key)&&t.classList.add("selected"),t}_updateFolderListContainer(){if(E(this,It))if(E(this,yt).innerHTML="",E(this,Dt)){const e=this._renderFolderListLoadingUI();E(this,yt).appendChild(e)}else{const e=document.createElement("ul");e.className="folders",E(this,yt).appendChild(e),E(this,ot).forEach(t=>{const n=this._renderFolderListContainer(t);e.appendChild(n)}),E(this,It).appendChild(E(this,yt))}}_renderToastContainer(e,t,n){this._removeToastContainer(),H(this,at,document.createElement("div")),E(this,at).className=`message-container ${t}`;const r=sn(e,"message"),i=t==="success"?Lr():Wn(),o=We("");o.style.cursor="pointer",o.style.border="0",o.style.outline="none",o.style.background="transparent",o.appendChild(jn(t==="error"?"#ee3f3f":"#4caf50")),o.setAttribute("fill",t==="error"?"#ee3f3f":"#4caf50"),o.onclick=()=>this._removeToastContainer(),E(this,at).append(i,r,o),n.appendChild(E(this,at)),setTimeout(()=>{this._removeToastContainer()},5e3)}_removeToastContainer(){E(this,at)&&(E(this,at).remove(),H(this,at,null))}_updateSelectedImageListContainerUI(){var t,n;if(!E(this,ke))return;E(this,ke).innerHTML="",E(this,tt)&&this._renderLoadingUI(),E(this,je)&&this._renderFetchingSkeletonUI();const e=document.getElementById("search-input-wrapper");E(this,Nt)===0?(e&&(e.style.visibility="visible"),((t=E(this,Ie))==null?void 0:t.length)===0&&!E(this,je)?(E(this,ke).classList.add("no-selected-image-container"),this._renderEmptyImageContainer()):(E(this,ke).classList.remove("no-selected-image-container"),this._renderImageListContainer())):(e&&(e.style.visibility="hidden"),((n=E(this,we))==null?void 0:n.length)===0?(E(this,ke).classList.add("no-selected-image-container"),this._renderEmptyImageContainer()):(E(this,ke).classList.remove("no-selected-image-container"),this._renderSelectedImageListContainer())),this._updateContent()}_updateContent(){var t,n,r;const e=document.getElementById("selected-images-tab");e&&(e.textContent=`Selected (${(t=E(this,we))==null?void 0:t.length})`),E(this,Ft).textContent=`Save (${(n=E(this,we))==null?void 0:n.length})`,E(this,Ft).disabled=((r=E(this,we))==null?void 0:r.length)===0}async _uploadAndAddSelectedImageList(e,t){var n,r;this._updateSelectedImageListContainerUI();try{const i=await Gr(e,t,E(this,Se)),o=await ts(t==null?void 0:t.name,"",i,Qe[Zn((n=t.type)==null?void 0:n.split("/")[0])],(r=E(this,nt))==null?void 0:r.name,E(this,Se));E(this,Ie).unshift(o==null?void 0:o.response),this._renderToastContainer("File Uploaded Successfully","success",E(this,Ae))}catch{this._renderToastContainer("Something went wrong while uploading file. Please try again later.","error",E(this,Ae))}finally{H(this,tt,!1),this._updateSelectedImageListContainerUI()}}async _updateFile(e,t){ve.updateUploadBtn(!0);try{const n=await os(t.key,e,t.nestedFolderName,t.url,t.thumborUrl,t.proxyUrl,t.type,E(this,Ut),E(this,Se)),r=E(this,Ie).find(i=>i.key===n.response.key);r.name=e,this._fetchFilesFromFolder(E(this,nt).name),H(this,Ie,[]),H(this,we,[]),this._renderToastContainer("File Updated Successfully","success",E(this,Ae))}catch{this._renderToastContainer("Something went wrong while updating the file. Please try again later.","error",E(this,Ae))}finally{ve.updateUploadBtn(!1),ve.hide(),this._updateSelectedImageListContainerUI()}}async _deleteFile(e){ve.updateUploadBtn(!0);try{await as(e,E(this,Se)),H(this,Ie,E(this,Ie).filter(t=>e!==t.key)),this._renderToastContainer("File Deleted Successfully","success",E(this,Ae))}catch{this._renderToastContainer("Something went wrong while deleting the file. Please try again later.","error",E(this,Ae))}finally{ve.updateUploadBtn(!1),ve.hide(),this._updateSelectedImageListContainerUI()}}async _createFolder(e,t=2){var n;try{const r=await ws(e,(n=E(this,nt))==null?void 0:n.name,"",E(this,Se));H(this,we,[]),H(this,Ie,[]);const i=Ls(E(this,ot),r==null?void 0:r.response);H(this,ot,i),H(this,kt,e),H(this,nt,{...r==null?void 0:r.response,children:{}}),this._fetchFilesFromFolder(e),this._renderToastContainer(`Folder ${e} created successfully`,"success",E(this,Ae))}catch{if(t>1)this._createFolder(e,--t);else throw this._renderToastContainer(`Error creating folder "${e}". Either folder already exist or failed to create folder`,"error",E(this,Ae)),new Error(`Error creating folder "${e}". Either folder already exist or failed to create folder`)}finally{this._updateFolderListContainer()}}async _upload(){return E(this,ln)?E(this,we):E(this,qt)}async _uploadFromSource(e,t){this._removeUserToast();try{const n=await Qr(e);return await new Promise((i,o)=>{const a=new FileReader;a.onload=async()=>{var c;try{const d=await qs(a.result,n,t,!1,E(this,xt)),l=await rs(d,Qe[Zn((c=n.type)==null?void 0:c.split("/")[0])],t,E(this,xt));i(l)}catch(d){o(d)}},a.onerror=()=>o(a.error),a.readAsDataURL(n)})}catch(n){throw n}}_uploadingState(){return E(this,tt)}async _fetchFilesFromFolder(e){var t,n,r;H(this,je,!0),this._updateSelectedImageListContainerUI();try{const i=await is(e,E(this,lt),20,E(this,Se)),o=(t=i.response)==null?void 0:t.files;E(this,Ie).push(...o),H(this,lt,(n=i.response)==null?void 0:n.nextCursor),H(this,Tt,(r=i.response)==null?void 0:r.hasMore)}catch{throw this._renderToastContainer("Error while fetching files from folder"+e,"error",E(this,Ae)),new Error("Something went wrong. Error while fetching files from folder"+e)}finally{H(this,je,!1),this._updateSelectedImageListContainerUI()}}async _fetchAllFolders(){var e,t;H(this,je,!0),H(this,Dt,!0),this._updateSelectedImageListContainerUI(),this._updateFolderListContainer(),this._removeToastContainer();try{const r=(await gs("",200,E(this,Se))).response.folder,i=Ts(r);H(this,kt,(e=i[0])==null?void 0:e.name),this._fetchFilesFromFolder((t=i[0])==null?void 0:t.name),H(this,nt,i[0]),H(this,ot,i)}catch{H(this,je,!1),this._renderToastContainer("Folder not found. Please create a folder or try again later","error",E(this,Ae))}finally{H(this,Dt,!1),this._updateFolderListContainer()}}async _search(e){var t,n;H(this,je,!0),this._updateSelectedImageListContainerUI(),this._removeToastContainer();try{const r=await ss(e,E(this,lt),10,E(this,Se)),i=(t=r.response)==null?void 0:t.items;E(this,Ie).push(...i),H(this,lt,(n=r.response)==null?void 0:n.nextPageCursor)}catch{this._renderToastContainer("Error while searching files","error",E(this,Ae))}finally{H(this,je,!1),this._updateSelectedImageListContainerUI()}}async _updateFolder(e,t){ve.updateUploadBtn(!0);try{const n=await ys(t.key,e,t.nestedFolderName,t.createdBy,E(this,Se))}catch{throw this._renderToastContainer("Something went wrong while updating the folder. Please try again later.","error",E(this,Ae)),new Error("Error updating the folder ")}finally{ve.updateUploadBtn(!1),ve.hide(),this._updateFolderListContainer()}}async _deleteFolder(e){ve.updateUploadBtn(!0);try{await bs(e,E(this,Se)),H(this,ot,E(this,ot).filter(t=>t.key!==e)),this._renderToastContainer("Folder Deleted Successfully","success",E(this,Ae))}catch{throw this._renderToastContainer("Something went wrong while deleting the folder. Please try again later.","error",E(this,Ae)),new Error("Error deleting the folder ")}finally{ve.updateUploadBtn(!1),ve.hide(),this._updateFolderListContainer()}}_createUpdateFolderDialog(e,t,n){e.addEventListener("click",r=>{r.stopPropagation(),Ze.hide();let i;const o=K("edit-form-wrapper"),a=K("form-control"),c=oe("Folder Name","input-label"),d=K();d.style.position="relative";const l=document.createElement("input");l.style.paddingLeft="40px";const u=oe();u.appendChild(nn()),u.style.position="absolute",u.style.top="50%",u.style.left="5%",u.style.transform="translate(-40%, -40%)",l.classList.add("input-field"),d.append(l,u),t==="update"&&(l.value=n.name),l.onchange=h=>{i=h.target.value},a.append(c,d),o.append(a),ve.show({content:o,header:t==="update"?"Update Folder":"Create Folder",confirmButtonText:t==="create"?"Save":"Update",dialogContentStyle:{minWidth:"35rem",padding:"10px"},showFooter:!0,showCloseBtn:!0,onConfirm:()=>{t==="create"?this._createFolder(i):this._updateFolder(i,n),ve.hide()}})})}updateWindowObject(e){window.ImageSalonSDK={...window.ImageSalonSDK,...e}}_initializeGrpcConfig(e,t){let n="https://hamro-cms-backend-grpc.hamrostack.com";t&&(e==="production"||e==="development")?n=t:e==="production"&&(n="https://page-api-grpc.hamropatro.com");const r=new $i({baseUrl:n});this.updateWindowObject({grpcConfig:r})}}return At=new WeakMap,Ae=new WeakMap,ke=new WeakMap,wt=new WeakMap,we=new WeakMap,Ie=new WeakMap,tt=new WeakMap,je=new WeakMap,Dt=new WeakMap,kt=new WeakMap,ot=new WeakMap,nt=new WeakMap,Ft=new WeakMap,Wt=new WeakMap,Qn=new WeakMap,Nt=new WeakMap,It=new WeakMap,yt=new WeakMap,Mt=new WeakMap,at=new WeakMap,lt=new WeakMap,Tt=new WeakMap,Lt=new WeakMap,bt=new WeakMap,jt=new WeakMap,on=new WeakMap,Se=new WeakMap,Ct=new WeakMap,an=new WeakMap,Un=new WeakMap,ln=new WeakMap,ct=new WeakMap,qt=new WeakMap,Ut=new WeakMap,xt=new WeakMap,Zt=new WeakMap,Kt=new WeakMap,zt=new WeakMap,Xt=new WeakMap,cn=new WeakMap,dn=new WeakMap,Gt=new WeakMap,dt=new WeakMap,Jt=new WeakMap,Ks});