image-salon-sdk 1.0.40 → 1.0.41

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 +1,3 @@
1
- export declare const imageUploadReq: (mimeType: string) => Promise<any>;
1
+ import { RpcOptions } from '@protobuf-ts/runtime-rpc/build/types/rpc-options';
2
+
3
+ export declare const imageUploadReq: (mimeType: string, options: RpcOptions) => Promise<any>;
@@ -239,7 +239,7 @@ class Tn {
239
239
  return e;
240
240
  }
241
241
  }
242
- class P extends Tn {
242
+ class K extends Tn {
243
243
  /**
244
244
  * Create instance from a `string`, `number` or `bigint`.
245
245
  */
@@ -263,7 +263,7 @@ class P extends Tn {
263
263
  throw new Error("signed value for ulong");
264
264
  if (e > v.UMAX)
265
265
  throw new Error("ulong too large");
266
- return v.V.setBigUint64(0, e, !0), new P(v.V.getInt32(0, !0), v.V.getInt32(4, !0));
266
+ return v.V.setBigUint64(0, e, !0), new K(v.V.getInt32(0, !0), v.V.getInt32(4, !0));
267
267
  }
268
268
  else
269
269
  switch (typeof e) {
@@ -275,7 +275,7 @@ class P extends Tn {
275
275
  let [t, n, r] = Ln(e);
276
276
  if (t)
277
277
  throw new Error("signed value for ulong");
278
- return new P(n, r);
278
+ return new K(n, r);
279
279
  case "number":
280
280
  if (e == 0)
281
281
  return this.ZERO;
@@ -283,7 +283,7 @@ class P extends Tn {
283
283
  throw new Error("number is no integer");
284
284
  if (e < 0)
285
285
  throw new Error("signed value for ulong");
286
- return new P(e, e / ot);
286
+ return new K(e, e / ot);
287
287
  }
288
288
  throw new Error("unknown value " + typeof e);
289
289
  }
@@ -300,7 +300,7 @@ class P extends Tn {
300
300
  return An(v), v.V.setInt32(0, this.lo, !0), v.V.setInt32(4, this.hi, !0), v.V.getBigUint64(0, !0);
301
301
  }
302
302
  }
303
- P.ZERO = new P(0, 0);
303
+ K.ZERO = new K(0, 0);
304
304
  class R extends Tn {
305
305
  /**
306
306
  * Create instance from a `string`, `number` or `bigint`.
@@ -468,7 +468,7 @@ class gi {
468
468
  * Read a `uint64` field, an unsigned 64-bit varint.
469
469
  */
470
470
  uint64() {
471
- return new P(...this.varint64());
471
+ return new K(...this.varint64());
472
472
  }
473
473
  /**
474
474
  * Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint.
@@ -500,7 +500,7 @@ class gi {
500
500
  * Read a `fixed64` field, an unsigned, fixed-length 64 bit integer.
501
501
  */
502
502
  fixed64() {
503
- return new P(this.sfixed32(), this.sfixed32());
503
+ return new K(this.sfixed32(), this.sfixed32());
504
504
  }
505
505
  /**
506
506
  * Read a `fixed64` field, a signed, fixed-length 64-bit integer.
@@ -697,7 +697,7 @@ class Ni {
697
697
  * Write a `fixed64` value, an unsigned, fixed-length 64 bit integer.
698
698
  */
699
699
  fixed64(e) {
700
- let t = new Uint8Array(8), n = new DataView(t.buffer), r = P.from(e);
700
+ let t = new Uint8Array(8), n = new DataView(t.buffer), r = K.from(e);
701
701
  return n.setInt32(0, r.lo, !0), n.setInt32(4, r.hi, !0), this.raw(t);
702
702
  }
703
703
  /**
@@ -718,7 +718,7 @@ class Ni {
718
718
  * Write a `uint64` value, an unsigned 64-bit varint.
719
719
  */
720
720
  uint64(e) {
721
- let t = P.from(e);
721
+ let t = K.from(e);
722
722
  return gt(t.lo, t.hi, this.buf), this;
723
723
  }
724
724
  }
@@ -1158,10 +1158,10 @@ class Bi {
1158
1158
  case u.FIXED64:
1159
1159
  case u.UINT64:
1160
1160
  if (e === null)
1161
- return re(P.ZERO, n);
1161
+ return re(K.ZERO, n);
1162
1162
  if (typeof e != "number" && typeof e != "string")
1163
1163
  break;
1164
- return re(P.from(e), n);
1164
+ return re(K.from(e), n);
1165
1165
  case u.BOOL:
1166
1166
  if (e === null)
1167
1167
  return !1;
@@ -1331,7 +1331,7 @@ class xi {
1331
1331
  case u.UINT64:
1332
1332
  case u.FIXED64:
1333
1333
  k(typeof t == "number" || typeof t == "string" || typeof t == "bigint");
1334
- let a = P.from(t);
1334
+ let a = K.from(t);
1335
1335
  return a.isZero() && !o ? void 0 : a.toString();
1336
1336
  case u.INT64:
1337
1337
  case u.SFIXED64:
@@ -1350,7 +1350,7 @@ function At(i, e = ue.STRING) {
1350
1350
  return !1;
1351
1351
  case u.UINT64:
1352
1352
  case u.FIXED64:
1353
- return re(P.ZERO, e);
1353
+ return re(K.ZERO, e);
1354
1354
  case u.INT64:
1355
1355
  case u.SFIXED64:
1356
1356
  case u.SINT64:
@@ -1651,10 +1651,10 @@ class Oi {
1651
1651
  o = s || R.from(t).isZero(), r = "int64";
1652
1652
  break;
1653
1653
  case u.UINT64:
1654
- o = s || P.from(t).isZero(), r = "uint64";
1654
+ o = s || K.from(t).isZero(), r = "uint64";
1655
1655
  break;
1656
1656
  case u.FIXED64:
1657
- o = s || P.from(t).isZero(), n = m.Bit64, r = "fixed64";
1657
+ o = s || K.from(t).isZero(), n = m.Bit64, r = "fixed64";
1658
1658
  break;
1659
1659
  case u.BYTES:
1660
1660
  o = s || !t.byteLength, n = m.LengthDelimited, r = "bytes";
@@ -2563,9 +2563,9 @@ class Gi {
2563
2563
  signal: (o = n.abort) !== null && o !== void 0 ? o : null
2564
2564
  // node-fetch@3.0.0-beta.9 rejects `undefined`
2565
2565
  })).then((E) => {
2566
- let [b, U, K] = It(E);
2567
- if (L.resolve(K), b != null && b !== f.OK)
2568
- throw new T(U ?? f[b], f[b], K);
2566
+ let [b, U, X] = It(E);
2567
+ if (L.resolve(X), b != null && b !== f.OK)
2568
+ throw new T(U ?? f[b], f[b], X);
2569
2569
  return b != null && (A = {
2570
2570
  code: f[b],
2571
2571
  detail: U ?? f[b]
@@ -2579,10 +2579,10 @@ class Gi {
2579
2579
  B.notifyMessage(e.O.fromBinary(U, l.binaryOptions)), $ = !1;
2580
2580
  break;
2581
2581
  case se.TRAILER:
2582
- let K, ee;
2583
- [K, ee, q] = hn(U), A = {
2584
- code: f[K],
2585
- detail: ee ?? f[K]
2582
+ let X, ee;
2583
+ [X, ee, q] = hn(U), A = {
2584
+ code: f[X],
2585
+ detail: ee ?? f[X]
2586
2586
  };
2587
2587
  break;
2588
2588
  }
@@ -2610,9 +2610,9 @@ class Gi {
2610
2610
  signal: (o = n.abort) !== null && o !== void 0 ? o : null
2611
2611
  // node-fetch@3.0.0-beta.9 rejects `undefined`
2612
2612
  })).then((E) => {
2613
- let [b, U, K] = It(E);
2614
- if (L.resolve(K), b != null && b !== f.OK)
2615
- throw new T(U ?? f[b], f[b], K);
2613
+ let [b, U, X] = It(E);
2614
+ if (L.resolve(X), b != null && b !== f.OK)
2615
+ throw new T(U ?? f[b], f[b], X);
2616
2616
  return b != null && (A = {
2617
2617
  code: f[b],
2618
2618
  detail: U ?? f[b]
@@ -2628,10 +2628,10 @@ class Gi {
2628
2628
  B = e.O.fromBinary(U, l.binaryOptions);
2629
2629
  break;
2630
2630
  case se.TRAILER:
2631
- let K, ee;
2632
- [K, ee, q] = hn(U), A = {
2633
- code: f[K],
2634
- detail: ee ?? f[K]
2631
+ let X, ee;
2632
+ [X, ee, q] = hn(U), A = {
2633
+ code: f[X],
2634
+ detail: ee ?? f[X]
2635
2635
  };
2636
2636
  break;
2637
2637
  }
@@ -4371,29 +4371,30 @@ class jr {
4371
4371
  return ie("unary", this._transport, n, r, e);
4372
4372
  }
4373
4373
  }
4374
- const Zr = async (i) => {
4375
- var r;
4376
- const e = (r = window.ImageSalonSDK) == null ? void 0 : r.grpcConfig, t = new jr(e), n = Wn.create();
4374
+ const Zr = async (i, e) => {
4375
+ var s;
4376
+ const t = (s = window.ImageSalonSDK) == null ? void 0 : s.grpcConfig, n = new jr(t), r = Wn.create();
4377
4377
  try {
4378
- return n.mimeType = i, await t.upload(
4379
- n
4378
+ return r.mimeType = i, await n.upload(
4379
+ r,
4380
+ e
4380
4381
  );
4381
- } catch (s) {
4382
- throw s;
4382
+ } catch (o) {
4383
+ throw o;
4383
4384
  }
4384
- }, En = async (i, e) => {
4385
+ }, En = async (i, e, t) => {
4385
4386
  try {
4386
- const t = qr(i, e), r = (await Zr(e == null ? void 0 : e.type)).response.url;
4387
- return await fetch(r, {
4387
+ const n = qr(i, e), s = (await Zr(e == null ? void 0 : e.type, t)).response.url;
4388
+ return await fetch(s, {
4388
4389
  method: "PUT",
4389
4390
  headers: {
4390
4391
  "Content-Type": e == null ? void 0 : e.type,
4391
4392
  "x-amz-acl": "public-read"
4392
4393
  },
4393
- body: t
4394
- }), r == null ? void 0 : r.split("?")[0];
4395
- } catch (t) {
4396
- throw t;
4394
+ body: n
4395
+ }), s == null ? void 0 : s.split("?")[0];
4396
+ } catch (n) {
4397
+ throw n;
4397
4398
  }
4398
4399
  }, qr = (i, e) => {
4399
4400
  const t = e.type.split("/")[0];
@@ -4404,7 +4405,7 @@ const Zr = async (i) => {
4404
4405
  s[o] = r.charCodeAt(o);
4405
4406
  return s;
4406
4407
  };
4407
- var ke, M, S, fe, O, H, ae, G, xe, me, le, ne, Ne, Re, Fe, Le, ge, _e, ce, de, Ae, Ie, we, Me, ze, X, ye, Ge, ct, Je, j, Ve, Te, Ye, He, $e, We;
4408
+ var ke, M, S, fe, O, H, ae, G, xe, me, le, ne, Ne, Re, Fe, Le, ge, _e, ce, de, Ae, Ie, we, Me, ze, P, ye, Ge, ct, Je, j, Ve, Te, Ye, He, $e, We;
4408
4409
  class Xr {
4409
4410
  constructor(e) {
4410
4411
  C(this, ke);
@@ -4432,7 +4433,7 @@ class Xr {
4432
4433
  C(this, we);
4433
4434
  C(this, Me);
4434
4435
  C(this, ze);
4435
- C(this, X);
4436
+ C(this, P);
4436
4437
  C(this, ye);
4437
4438
  C(this, Ge, !1);
4438
4439
  C(this, ct);
@@ -4480,7 +4481,7 @@ class Xr {
4480
4481
  }), d(this, ke).appendChild(r);
4481
4482
  }
4482
4483
  async _grpcOptionInitializer() {
4483
- p(this, X, await Rr(
4484
+ p(this, P, await Rr(
4484
4485
  d(this, ze),
4485
4486
  d(this, Ye)
4486
4487
  ));
@@ -4669,7 +4670,7 @@ class Xr {
4669
4670
  p(this, ae, !0), this._renderUserUploading();
4670
4671
  try {
4671
4672
  this._renderImagePreview(e, t.name);
4672
- const n = await En(e, t);
4673
+ const n = await En(e, t, d(this, P));
4673
4674
  await this._uploadForUser(n, t);
4674
4675
  } catch {
4675
4676
  this._renderUserToast(
@@ -4685,7 +4686,7 @@ class Xr {
4685
4686
  const r = await hr(
4686
4687
  e,
4687
4688
  he[bn((n = t.type) == null ? void 0 : n.split("/")[0])],
4688
- d(this, X)
4689
+ d(this, P)
4689
4690
  );
4690
4691
  p(this, Ve, r == null ? void 0 : r.response), d(this, Re).call(this);
4691
4692
  } catch (r) {
@@ -4885,8 +4886,8 @@ class Xr {
4885
4886
  $.append(W, A);
4886
4887
  const q = z("", "action-option rename"), Q = I("Rename", ""), E = mn();
4887
4888
  q.append(E, Q);
4888
- const b = z("", "action-option delete"), U = I("Delete", ""), K = wn();
4889
- b.append(K, U);
4889
+ const b = z("", "action-option delete"), U = I("Delete", ""), X = wn();
4890
+ b.append(X, U);
4890
4891
  const ee = e.name.split(".")[0], jn = e.name.split(".")[1], Zn = Ke[e.type], xt = y("edit-form-wrapper"), _t = y("move-form-wrapper"), Ot = y("preview-details-container"), Ut = y("preview-details-wrapper"), Dt = y(
4891
4892
  "preview-option-image-wrapper"
4892
4893
  ), St = y("preview-option-wrapper"), Rt = y("preview-option-wrapper"), Mt = y(
@@ -5263,13 +5264,13 @@ class Xr {
5263
5264
  var n, r;
5264
5265
  p(this, ae, !0), this._updateSelectedImageListContainerUI();
5265
5266
  try {
5266
- const s = await En(e, t), o = await dr(
5267
+ const s = await En(e, t, d(this, P)), o = await dr(
5267
5268
  t == null ? void 0 : t.name,
5268
5269
  "",
5269
5270
  s,
5270
5271
  he[bn((n = t.type) == null ? void 0 : n.split("/")[0])],
5271
5272
  (r = d(this, ne)) == null ? void 0 : r.name,
5272
- d(this, X)
5273
+ d(this, P)
5273
5274
  );
5274
5275
  d(this, H).unshift(o == null ? void 0 : o.response), this._renderToastContainer(
5275
5276
  "File Uploaded Successfully",
@@ -5298,7 +5299,7 @@ class Xr {
5298
5299
  t.proxyUrl,
5299
5300
  t.type,
5300
5301
  d(this, Te),
5301
- d(this, X)
5302
+ d(this, P)
5302
5303
  ), r = d(this, H).find(
5303
5304
  (s) => s.key === n.response.key
5304
5305
  );
@@ -5320,7 +5321,7 @@ class Xr {
5320
5321
  async _deleteFile(e) {
5321
5322
  D.updateUploadBtn(!0);
5322
5323
  try {
5323
- await mr(e, d(this, X)), p(this, H, d(this, H).filter((t) => e !== t.key)), this._renderToastContainer(
5324
+ await mr(e, d(this, P)), p(this, H, d(this, H).filter((t) => e !== t.key)), this._renderToastContainer(
5324
5325
  "File Deleted Successfully",
5325
5326
  "success",
5326
5327
  d(this, M)
@@ -5342,7 +5343,7 @@ class Xr {
5342
5343
  e,
5343
5344
  (n = d(this, ne)) == null ? void 0 : n.name,
5344
5345
  "",
5345
- d(this, X)
5346
+ d(this, P)
5346
5347
  );
5347
5348
  p(this, O, []), p(this, H, []);
5348
5349
  const s = Sr(d(this, le), r == null ? void 0 : r.response);
@@ -5377,7 +5378,7 @@ class Xr {
5377
5378
  e,
5378
5379
  d(this, de),
5379
5380
  20,
5380
- d(this, X)
5381
+ d(this, P)
5381
5382
  ), o = (t = s.response) == null ? void 0 : t.files;
5382
5383
  d(this, H).push(...o), p(this, de, (n = s.response) == null ? void 0 : n.nextCursor), p(this, Ae, (r = s.response) == null ? void 0 : r.hasMore);
5383
5384
  } catch {
@@ -5396,7 +5397,7 @@ class Xr {
5396
5397
  var e, t;
5397
5398
  p(this, G, !0), p(this, xe, !0), this._updateSelectedImageListContainerUI(), this._updateFolderListContainer(), this._removeToastContainer();
5398
5399
  try {
5399
- const r = (await kr("", 100, d(this, X))).response.folder, s = Dr(r);
5400
+ const r = (await kr("", 100, d(this, P))).response.folder, s = Dr(r);
5400
5401
  p(this, me, (e = s[0]) == null ? void 0 : e.name), this._fetchFilesFromFolder((t = s[0]) == null ? void 0 : t.name), p(this, ne, s[0]), p(this, le, s);
5401
5402
  } catch {
5402
5403
  p(this, G, !1), this._renderToastContainer(
@@ -5416,7 +5417,7 @@ class Xr {
5416
5417
  e,
5417
5418
  d(this, de),
5418
5419
  10,
5419
- d(this, X)
5420
+ d(this, P)
5420
5421
  ), s = (t = r.response) == null ? void 0 : t.items;
5421
5422
  d(this, H).push(...s), p(this, de, (n = r.response) == null ? void 0 : n.nextPageCursor);
5422
5423
  } catch {
@@ -5437,7 +5438,7 @@ class Xr {
5437
5438
  e,
5438
5439
  t.nestedFolderName,
5439
5440
  t.createdBy,
5440
- d(this, X)
5441
+ d(this, P)
5441
5442
  );
5442
5443
  } catch {
5443
5444
  throw this._renderToastContainer(
@@ -5452,7 +5453,7 @@ class Xr {
5452
5453
  async _deleteFolder(e) {
5453
5454
  D.updateUploadBtn(!0);
5454
5455
  try {
5455
- await Lr(e, d(this, X)), p(this, le, d(this, le).filter((t) => t.key !== e)), this._renderToastContainer(
5456
+ await Lr(e, d(this, P)), p(this, le, d(this, le).filter((t) => t.key !== e)), this._renderToastContainer(
5456
5457
  "Folder Deleted Successfully",
5457
5458
  "success",
5458
5459
  d(this, M)
@@ -5509,7 +5510,7 @@ class Xr {
5509
5510
  this.updateWindowObject({ grpcConfig: r });
5510
5511
  }
5511
5512
  }
5512
- ke = new WeakMap(), M = new WeakMap(), S = new WeakMap(), fe = new WeakMap(), O = new WeakMap(), H = new WeakMap(), ae = new WeakMap(), G = new WeakMap(), xe = new WeakMap(), me = new WeakMap(), le = new WeakMap(), ne = new WeakMap(), Ne = new WeakMap(), Re = new WeakMap(), Fe = new WeakMap(), Le = new WeakMap(), ge = new WeakMap(), _e = new WeakMap(), ce = new WeakMap(), de = new WeakMap(), Ae = new WeakMap(), Ie = new WeakMap(), we = new WeakMap(), Me = new WeakMap(), ze = new WeakMap(), X = new WeakMap(), ye = new WeakMap(), Ge = new WeakMap(), ct = new WeakMap(), Je = new WeakMap(), j = new WeakMap(), Ve = new WeakMap(), Te = new WeakMap(), Ye = new WeakMap(), He = new WeakMap(), $e = new WeakMap(), We = new WeakMap();
5513
+ ke = new WeakMap(), M = new WeakMap(), S = new WeakMap(), fe = new WeakMap(), O = new WeakMap(), H = new WeakMap(), ae = new WeakMap(), G = new WeakMap(), xe = new WeakMap(), me = new WeakMap(), le = new WeakMap(), ne = new WeakMap(), Ne = new WeakMap(), Re = new WeakMap(), Fe = new WeakMap(), Le = new WeakMap(), ge = new WeakMap(), _e = new WeakMap(), ce = new WeakMap(), de = new WeakMap(), Ae = new WeakMap(), Ie = new WeakMap(), we = new WeakMap(), Me = new WeakMap(), ze = new WeakMap(), P = new WeakMap(), ye = new WeakMap(), Ge = new WeakMap(), ct = new WeakMap(), Je = new WeakMap(), j = new WeakMap(), Ve = new WeakMap(), Te = new WeakMap(), Ye = new WeakMap(), He = new WeakMap(), $e = new WeakMap(), We = new WeakMap();
5513
5514
  export {
5514
5515
  Xr as default
5515
5516
  };
@@ -1,8 +1,8 @@
1
1
  import './style.css';
2
- (function(L,x){typeof exports=="object"&&typeof module<"u"?module.exports=x():typeof define=="function"&&define.amd?define(x):(L=typeof globalThis<"u"?globalThis:L||self,L.ImageSalonSdk=x())})(this,function(){"use strict";var qr=Object.defineProperty;var Wn=L=>{throw TypeError(L)};var Pr=(L,x,_)=>x in L?qr(L,x,{enumerable:!0,configurable:!0,writable:!0,value:_}):L[x]=_;var U=(L,x,_)=>Pr(L,typeof x!="symbol"?x+"":x,_),jn=(L,x,_)=>x.has(L)||Wn("Cannot "+_);var d=(L,x,_)=>(jn(L,x,"read from private field"),_?_.call(L):x.get(L)),C=(L,x,_)=>x.has(L)?Wn("Cannot add the same private member more than once"):x instanceof WeakSet?x.add(L):x.set(L,_),p=(L,x,_,_e)=>(jn(L,x,"write to private field"),_e?_e.call(L,_):x.set(L,_),_);var ge,oe,Re,Fe,W,V,we,D,j,ue,Q,Oe,ye,pe,ae,Le,Me,Ae,Ie,be,Ue,fe,me,Te,ve,Ce,Ve,Je,J,Ee,Ye,pt,Qe,q,He,Be,et,$e,We,je;function L(i){let e=typeof i;if(e=="object"){if(Array.isArray(i))return"array";if(i===null)return"null"}return e}function x(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)}let _="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),_e=[];for(let i=0;i<_.length;i++)_e[_[i].charCodeAt(0)]=i;_e[45]=_.indexOf("+"),_e[95]=_.indexOf("/");function Ot(i){let e=i.length*3/4;i[i.length-2]=="="?e-=2:i[i.length-1]=="="&&(e-=1);let t=new Uint8Array(e),n=0,r=0,s,o=0;for(let a=0;a<i.length;a++){if(s=_e[i.charCodeAt(a)],s===void 0)switch(i[a]){case"=":r=0;case`
2
+ (function(L,x){typeof exports=="object"&&typeof module<"u"?module.exports=x():typeof define=="function"&&define.amd?define(x):(L=typeof globalThis<"u"?globalThis:L||self,L.ImageSalonSdk=x())})(this,function(){"use strict";var qr=Object.defineProperty;var Wn=L=>{throw TypeError(L)};var Pr=(L,x,_)=>x in L?qr(L,x,{enumerable:!0,configurable:!0,writable:!0,value:_}):L[x]=_;var U=(L,x,_)=>Pr(L,typeof x!="symbol"?x+"":x,_),jn=(L,x,_)=>x.has(L)||Wn("Cannot "+_);var d=(L,x,_)=>(jn(L,x,"read from private field"),_?_.call(L):x.get(L)),C=(L,x,_)=>x.has(L)?Wn("Cannot add the same private member more than once"):x instanceof WeakSet?x.add(L):x.set(L,_),p=(L,x,_,_e)=>(jn(L,x,"write to private field"),_e?_e.call(L,_):x.set(L,_),_);var ge,oe,Re,Fe,W,V,we,D,j,ue,Q,Oe,ye,pe,ae,Le,Me,Ae,Ie,be,Ue,fe,me,Te,ve,Ce,Ve,Je,z,Ee,Ye,pt,Qe,q,He,Be,et,$e,We,je;function L(i){let e=typeof i;if(e=="object"){if(Array.isArray(i))return"array";if(i===null)return"null"}return e}function x(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)}let _="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),_e=[];for(let i=0;i<_.length;i++)_e[_[i].charCodeAt(0)]=i;_e[45]=_.indexOf("+"),_e[95]=_.indexOf("/");function Ot(i){let e=i.length*3/4;i[i.length-2]=="="?e-=2:i[i.length-1]=="="&&(e-=1);let t=new Uint8Array(e),n=0,r=0,s,o=0;for(let a=0;a<i.length;a++){if(s=_e[i.charCodeAt(a)],s===void 0)switch(i[a]){case"=":r=0;case`
3
3
  `:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(r){case 0:o=s,r=1;break;case 1:t[n++]=o<<2|(s&48)>>4,o=s,r=2;break;case 2:t[n++]=(o&15)<<4|(s&60)>>2,o=s,r=3;break;case 3:t[n++]=(o&3)<<6|s,r=0;break}}if(r==1)throw Error("invalid base64 string.");return t.subarray(0,n)}function Ut(i){let e="",t=0,n,r=0;for(let s=0;s<i.length;s++)switch(n=i[s],t){case 0:e+=_[n>>2],r=(n&3)<<4,t=1;break;case 1:e+=_[r|n>>4],r=(n&15)<<2,t=2;break;case 2:e+=_[r|n>>6],e+=_[n&63],t=0;break}return t&&(e+=_[r],e+="=",t==1&&(e+="=")),e}var k;(function(i){i.symbol=Symbol.for("protobuf-ts/unknown"),i.onRead=(t,n,r,s,o)=>{(e(n)?n[i.symbol]:n[i.symbol]=[]).push({no:r,wireType:s,data:o})},i.onWrite=(t,n,r)=>{for(let{no:s,wireType:o,data:a}of i.list(n))r.tag(s,o).raw(a)},i.list=(t,n)=>{if(e(t)){let r=t[i.symbol];return n?r.filter(s=>s.no==n):r}return[]},i.last=(t,n)=>i.list(t,n).slice(-1)[0];const e=t=>t&&Array.isArray(t[i.symbol])})(k||(k={}));function Zn(i,e){return Object.assign(Object.assign({},i),e)}var m;(function(i){i[i.Varint=0]="Varint",i[i.Bit64=1]="Bit64",i[i.LengthDelimited=2]="LengthDelimited",i[i.StartGroup=3]="StartGroup",i[i.EndGroup=4]="EndGroup",i[i.Bit32=5]="Bit32"})(m||(m={}));function qn(){let i=0,e=0;for(let n=0;n<28;n+=7){let r=this.buf[this.pos++];if(i|=(r&127)<<n,!(r&128))return this.assertBounds(),[i,e]}let t=this.buf[this.pos++];if(i|=(t&15)<<28,e=(t&112)>>4,!(t&128))return this.assertBounds(),[i,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(),[i,e]}throw new Error("invalid varint")}function mt(i,e,t){for(let s=0;s<28;s=s+7){const o=i>>>s,a=!(!(o>>>7)&&e==0),l=(a?o|128:o)&255;if(t.push(l),!a)return}const n=i>>>28&15|(e&7)<<4,r=!!(e>>3);if(t.push((r?n|128:n)&255),!!r){for(let s=3;s<31;s=s+7){const o=e>>>s,a=!!(o>>>7),l=(a?o|128:o)&255;if(t.push(l),!a)return}t.push(e>>>31&1)}}const nt=65536*65536;function Dt(i){let e=i[0]=="-";e&&(i=i.slice(1));const t=1e6;let n=0,r=0;function s(o,a){const l=Number(i.slice(o,a));r*=t,n=n*t+l,n>=nt&&(r=r+(n/nt|0),n=n%nt)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),[e,n,r]}function gt(i,e){if(e>>>0<=2097151)return""+(nt*e+(i>>>0));let t=i&16777215,n=(i>>>24|e<<8)>>>0&16777215,r=e>>16&65535,s=t+n*6777216+r*6710656,o=n+r*8147497,a=r*2,l=1e7;s>=l&&(o+=Math.floor(s/l),s%=l),o>=l&&(a+=Math.floor(o/l),o%=l);function c(h,g){let w=h?String(h):"";return g?"0000000".slice(w.length)+w:w}return c(a,0)+c(o,a)+c(s,1)}function St(i,e){if(i>=0){for(;i>127;)e.push(i&127|128),i=i>>>7;e.push(i)}else{for(let t=0;t<9;t++)e.push(i&127|128),i=i>>7;e.push(1)}}function Pn(){let i=this.buf[this.pos++],e=i&127;if(!(i&128))return this.assertBounds(),e;if(i=this.buf[this.pos++],e|=(i&127)<<7,!(i&128))return this.assertBounds(),e;if(i=this.buf[this.pos++],e|=(i&127)<<14,!(i&128))return this.assertBounds(),e;if(i=this.buf[this.pos++],e|=(i&127)<<21,!(i&128))return this.assertBounds(),e;i=this.buf[this.pos++],e|=(i&15)<<28;for(let t=5;i&128&&t<10;t++)i=this.buf[this.pos++];if(i&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}let A;function Kn(){const i=new DataView(new ArrayBuffer(8));A=globalThis.BigInt!==void 0&&typeof i.getBigInt64=="function"&&typeof i.getBigUint64=="function"&&typeof i.setBigInt64=="function"&&typeof i.setBigUint64=="function"?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:i}:void 0}Kn();function Rt(i){if(!i)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}const Mt=/^-?[0-9]+$/,it=4294967296,rt=2147483648;class Vt{constructor(e,t){this.lo=e|0,this.hi=t|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*it+(this.lo>>>0);if(!Number.isSafeInteger(e))throw new Error("cannot convert to safe number");return e}}class X extends Vt{static from(e){if(A)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=A.C(e);case"number":if(e===0)return this.ZERO;e=A.C(e);case"bigint":if(!e)return this.ZERO;if(e<A.UMIN)throw new Error("signed value for ulong");if(e>A.UMAX)throw new Error("ulong too large");return A.V.setBigUint64(0,e,!0),new X(A.V.getInt32(0,!0),A.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!Mt.test(e))throw new Error("string is no integer");let[t,n,r]=Dt(e);if(t)throw new Error("signed value for ulong");return new X(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 X(e,e/it)}throw new Error("unknown value "+typeof e)}toString(){return A?this.toBigInt().toString():gt(this.lo,this.hi)}toBigInt(){return Rt(A),A.V.setInt32(0,this.lo,!0),A.V.setInt32(4,this.hi,!0),A.V.getBigUint64(0,!0)}}X.ZERO=new X(0,0);class R extends Vt{static from(e){if(A)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=A.C(e);case"number":if(e===0)return this.ZERO;e=A.C(e);case"bigint":if(!e)return this.ZERO;if(e<A.MIN)throw new Error("signed long too small");if(e>A.MAX)throw new Error("signed long too large");return A.V.setBigInt64(0,e,!0),new R(A.V.getInt32(0,!0),A.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!Mt.test(e))throw new Error("string is no integer");let[t,n,r]=Dt(e);if(t){if(r>rt||r==rt&&n!=0)throw new Error("signed long too small")}else if(r>=rt)throw new Error("signed long too large");let s=new R(n,r);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 R(e,e/it):new R(-e,-e/it).negate()}throw new Error("unknown value "+typeof e)}isNegative(){return(this.hi&rt)!==0}negate(){let e=~this.hi,t=this.lo;return t?t=~t+1:e+=1,new R(t,e)}toString(){if(A)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return"-"+gt(e.lo,e.hi)}return gt(this.lo,this.hi)}toBigInt(){return Rt(A),A.V.setInt32(0,this.lo,!0),A.V.setInt32(4,this.hi,!0),A.V.getBigInt64(0,!0)}}R.ZERO=new R(0,0);const Ht={readUnknownField:!0,readerFactory:i=>new zn(i)};function Xn(i){return i?Object.assign(Object.assign({},Ht),i):Ht}class zn{constructor(e,t){this.varint64=qn,this.uint32=Pn,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 m.Varint:for(;this.buf[this.pos++]&128;);break;case m.Bit64:this.pos+=4;case m.Bit32:this.pos+=4;break;case m.LengthDelimited:let n=this.uint32();this.pos+=n;break;case m.StartGroup:let r;for(;(r=this.tag()[1])!==m.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 R(...this.varint64())}uint64(){return new X(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,new R(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 X(this.sfixed32(),this.sfixed32())}sfixed64(){return new R(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 N(i,e){if(!i)throw new Error(e)}const Gn=34028234663852886e22,Jn=-34028234663852886e22,Yn=4294967295,Qn=2147483647,ei=-2147483648;function Ke(i){if(typeof i!="number")throw new Error("invalid int 32: "+typeof i);if(!Number.isInteger(i)||i>Qn||i<ei)throw new Error("invalid int 32: "+i)}function st(i){if(typeof i!="number")throw new Error("invalid uint 32: "+typeof i);if(!Number.isInteger(i)||i>Yn||i<0)throw new Error("invalid uint 32: "+i)}function wt(i){if(typeof i!="number")throw new Error("invalid float 32: "+typeof i);if(Number.isFinite(i)&&(i>Gn||i<Jn))throw new Error("invalid float 32: "+i)}const $t={writeUnknownFields:!0,writerFactory:()=>new ni};function ti(i){return i?Object.assign(Object.assign({},$t),i):$t}class ni{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(st(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return Ke(e),St(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){wt(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){st(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){Ke(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return Ke(e),e=(e<<1^e>>31)>>>0,St(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=R.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=X.from(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=R.from(e);return mt(t.lo,t.hi,this.buf),this}sint64(e){let t=R.from(e),n=t.hi>>31,r=t.lo<<1^n,s=(t.hi<<1|t.lo>>>31)^n;return mt(r,s,this.buf),this}uint64(e){let t=X.from(e);return mt(t.lo,t.hi,this.buf),this}}const Wt={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},jt={ignoreUnknownFields:!1};function ii(i){return i?Object.assign(Object.assign({},jt),i):jt}function ri(i){return i?Object.assign(Object.assign({},Wt),i):Wt}function si(i,e){var t,n;let r=Object.assign(Object.assign({},i),e);return r.typeRegistry=[...(t=i==null?void 0:i.typeRegistry)!==null&&t!==void 0?t:[],...(n=e==null?void 0:e.typeRegistry)!==null&&n!==void 0?n:[]],r}const Zt=Symbol.for("protobuf-ts/message-type");function yt(i){let e=!1;const t=[];for(let n=0;n<i.length;n++){let r=i.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 u;(function(i){i[i.DOUBLE=1]="DOUBLE",i[i.FLOAT=2]="FLOAT",i[i.INT64=3]="INT64",i[i.UINT64=4]="UINT64",i[i.INT32=5]="INT32",i[i.FIXED64=6]="FIXED64",i[i.FIXED32=7]="FIXED32",i[i.BOOL=8]="BOOL",i[i.STRING=9]="STRING",i[i.BYTES=12]="BYTES",i[i.UINT32=13]="UINT32",i[i.SFIXED32=15]="SFIXED32",i[i.SFIXED64=16]="SFIXED64",i[i.SINT32=17]="SINT32",i[i.SINT64=18]="SINT64"})(u||(u={}));var de;(function(i){i[i.BIGINT=0]="BIGINT",i[i.STRING=1]="STRING",i[i.NUMBER=2]="NUMBER"})(de||(de={}));var ot;(function(i){i[i.NO=0]="NO",i[i.PACKED=1]="PACKED",i[i.UNPACKED=2]="UNPACKED"})(ot||(ot={}));function oi(i){var e,t,n,r;return i.localName=(e=i.localName)!==null&&e!==void 0?e:yt(i.name),i.jsonName=(t=i.jsonName)!==null&&t!==void 0?t:yt(i.name),i.repeat=(n=i.repeat)!==null&&n!==void 0?n:ot.NO,i.opt=(r=i.opt)!==null&&r!==void 0?r:i.repeat||i.oneof?!1:i.kind=="message",i}function ai(i){if(typeof i!="object"||i===null||!i.hasOwnProperty("oneofKind"))return!1;switch(typeof i.oneofKind){case"string":return i[i.oneofKind]===void 0?!1:Object.keys(i).length==2;case"undefined":return Object.keys(i).length==1;default:return!1}}class li{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),s=this.data;if(r.length<s.req.length||s.req.some(o=>!r.includes(o))||!n&&r.some(o=>!s.known.includes(o)))return!1;if(t<1)return!0;for(const o of s.oneofs){const a=e[o];if(!ai(a))return!1;if(a.oneofKind===void 0)continue;const l=this.fields.find(c=>c.localName===a.oneofKind);if(!l||!this.field(a[a.oneofKind],l,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 s=t.repeat;switch(t.kind){case"scalar":return e===void 0?t.opt:s?this.scalars(e,t.T,r,t.L):this.scalar(e,t.T,t.L);case"enum":return e===void 0?t.opt:s?this.scalars(e,u.INT32,r):this.scalar(e,u.INT32);case"message":return e===void 0?!0:s?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),u.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 s=0;s<e.length&&s<r;s++)if(!t.isAssignable(e[s],r-1))return!1}else for(let s=0;s<e.length&&s<r;s++)if(!t.is(e[s],r-1))return!1;return!0}scalar(e,t,n){let r=typeof e;switch(t){case u.UINT64:case u.FIXED64:case u.INT64:case u.SFIXED64:case u.SINT64:switch(n){case de.BIGINT:return r=="bigint";case de.NUMBER:return r=="number"&&!isNaN(e);default:return r=="string"}case u.BOOL:return r=="boolean";case u.STRING:return r=="string";case u.BYTES:return e instanceof Uint8Array;case u.DOUBLE:case u.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 s=0;s<e.length&&s<n;s++)if(!this.scalar(e[s],t,r))return!1}return!0}mapKeys(e,t,n){let r=Object.keys(e);switch(t){case u.INT32:case u.FIXED32:case u.SFIXED32:case u.SINT32:case u.UINT32:return this.scalars(r.slice(0,n).map(s=>parseInt(s)),t,n);case u.BOOL:return this.scalars(r.slice(0,n).map(s=>s=="true"?!0:s=="false"?!1:s),t,n);default:return this.scalars(r,t,n,de.STRING)}}}function ne(i,e){switch(e){case de.BIGINT:return i.toBigInt();case de.NUMBER:return i.toNumber();default:return i.toString()}}class ci{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=L(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[s,o]of Object.entries(e)){const a=this.fMap[s];if(!a){if(!n.ignoreUnknownFields)throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${s}`);continue}const l=a.localName;let c;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),c=t[a.oneof]={oneofKind:l}}else c=t;if(a.kind=="map"){if(o===null)continue;this.assert(x(o),a.name,o);const h=c[l];for(const[g,w]of Object.entries(o)){this.assert(w!==null,a.name+" map value",null);let v;switch(a.V.kind){case"message":v=a.V.T().internalJsonRead(w,n);break;case"enum":if(v=this.enum(a.V.T(),w,a.name,n.ignoreUnknownFields),v===!1)continue;break;case"scalar":v=this.scalar(w,a.V.T,a.V.L,a.name);break}this.assert(v!==void 0,a.name+" map value",w);let O=g;a.K==u.BOOL&&(O=O=="true"?!0:O=="false"?!1:O),O=this.scalar(O,a.K,de.STRING,a.name).toString(),h[O]=v}}else if(a.repeat){if(o===null)continue;this.assert(Array.isArray(o),a.name,o);const h=c[l];for(const g of o){this.assert(g!==null,a.name,null);let w;switch(a.kind){case"message":w=a.T().internalJsonRead(g,n);break;case"enum":if(w=this.enum(a.T(),g,a.name,n.ignoreUnknownFields),w===!1)continue;break;case"scalar":w=this.scalar(g,a.T,a.L,a.name);break}this.assert(w!==void 0,a.name,o),h.push(w)}}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}c[l]=a.T().internalJsonRead(o,n,c[l]);break;case"enum":let h=this.enum(a.T(),o,a.name,n.ignoreUnknownFields);if(h===!1)continue;c[l]=h;break;case"scalar":c[l]=this.scalar(o,a.T,a.L,a.name);break}}}enum(e,t,n,r){if(e[0]=="google.protobuf.NullValue"&&N(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 N(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 o=e[1][s];return typeof o>"u"&&r?!1:(N(typeof o=="number",`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} has no value for "${t}".`),o)}N(!1,`Unable to parse field ${this.info.typeName}#${n}, cannot parse enum value from ${typeof t}".`)}scalar(e,t,n,r){let s;try{switch(t){case u.DOUBLE:case u.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 o=Number(e);if(Number.isNaN(o)){s="not a number";break}if(!Number.isFinite(o)){s="too large or small";break}return t==u.FLOAT&&wt(o),o;case u.INT32:case u.FIXED32:case u.SFIXED32:case u.SINT32:case u.UINT32:if(e===null)return 0;let a;if(typeof e=="number"?a=e:e===""?s="empty string":typeof e=="string"&&(e.trim().length!==e.length?s="extra whitespace":a=Number(e)),a===void 0)break;return t==u.UINT32?st(a):Ke(a),a;case u.INT64:case u.SFIXED64:case u.SINT64:if(e===null)return ne(R.ZERO,n);if(typeof e!="number"&&typeof e!="string")break;return ne(R.from(e),n);case u.FIXED64:case u.UINT64:if(e===null)return ne(X.ZERO,n);if(typeof e!="number"&&typeof e!="string")break;return ne(X.from(e),n);case u.BOOL:if(e===null)return!1;if(typeof e!="boolean")break;return e;case u.STRING:if(e===null)return"";if(typeof e!="string"){s="extra whitespace";break}try{encodeURIComponent(e)}catch(l){l="invalid UTF8";break}return e;case u.BYTES:if(e===null||e==="")return new Uint8Array(0);if(typeof e!="string")break;return Ot(e)}}catch(o){s=o.message}this.assert(!1,r+(s?" - "+s:""),e)}}class di{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}write(e,t){const n={},r=e;for(const s of this.fields){if(!s.oneof){let c=this.field(s,r[s.localName],t);c!==void 0&&(n[t.useProtoFieldName?s.name:s.jsonName]=c);continue}const o=r[s.oneof];if(o.oneofKind!==s.localName)continue;const a=s.kind=="scalar"||s.kind=="enum"?Object.assign(Object.assign({},t),{emitDefaultValues:!0}):t;let l=this.field(s,o[s.localName],a);N(l!==void 0),n[t.useProtoFieldName?s.name:s.jsonName]=l}return n}field(e,t,n){let r;if(e.kind=="map"){N(typeof t=="object"&&t!==null);const s={};switch(e.V.kind){case"scalar":for(const[l,c]of Object.entries(t)){const h=this.scalar(e.V.T,c,e.name,!1,!0);N(h!==void 0),s[l.toString()]=h}break;case"message":const o=e.V.T();for(const[l,c]of Object.entries(t)){const h=this.message(o,c,e.name,n);N(h!==void 0),s[l.toString()]=h}break;case"enum":const a=e.V.T();for(const[l,c]of Object.entries(t)){N(c===void 0||typeof c=="number");const h=this.enum(a,c,e.name,!1,!0,n.enumAsInteger);N(h!==void 0),s[l.toString()]=h}break}(n.emitDefaultValues||Object.keys(s).length>0)&&(r=s)}else if(e.repeat){N(Array.isArray(t));const s=[];switch(e.kind){case"scalar":for(let l=0;l<t.length;l++){const c=this.scalar(e.T,t[l],e.name,e.opt,!0);N(c!==void 0),s.push(c)}break;case"enum":const o=e.T();for(let l=0;l<t.length;l++){N(t[l]===void 0||typeof t[l]=="number");const c=this.enum(o,t[l],e.name,e.opt,!0,n.enumAsInteger);N(c!==void 0),s.push(c)}break;case"message":const a=e.T();for(let l=0;l<t.length;l++){const c=this.message(a,t[l],e.name,n);N(c!==void 0),s.push(c)}break}(n.emitDefaultValues||s.length>0||n.emitDefaultValues)&&(r=s)}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,s,o){if(e[0]=="google.protobuf.NullValue")return!s&&!r?void 0:null;if(t===void 0){N(r);return}if(!(t===0&&!s&&!r))return N(typeof t=="number"),N(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,s){if(t===void 0){N(r);return}const o=s||r;switch(e){case u.INT32:case u.SFIXED32:case u.SINT32:return t===0?o?0:void 0:(Ke(t),t);case u.FIXED32:case u.UINT32:return t===0?o?0:void 0:(st(t),t);case u.FLOAT:wt(t);case u.DOUBLE:return t===0?o?0:void 0:(N(typeof t=="number"),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t);case u.STRING:return t===""?o?"":void 0:(N(typeof t=="string"),t);case u.BOOL:return t===!1?o?!1:void 0:(N(typeof t=="boolean"),t);case u.UINT64:case u.FIXED64:N(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let a=X.from(t);return a.isZero()&&!o?void 0:a.toString();case u.INT64:case u.SFIXED64:case u.SINT64:N(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let l=R.from(t);return l.isZero()&&!o?void 0:l.toString();case u.BYTES:return N(t instanceof Uint8Array),t.byteLength?Ut(t):o?"":void 0}}}function bt(i,e=de.STRING){switch(i){case u.BOOL:return!1;case u.UINT64:case u.FIXED64:return ne(X.ZERO,e);case u.INT64:case u.SFIXED64:case u.SINT64:return ne(R.ZERO,e);case u.DOUBLE:case u.FLOAT:return 0;case u.BYTES:return new Uint8Array(0);case u.STRING:return"";default:return 0}}class hi{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 s=r===void 0?e.len:e.pos+r;for(;e.pos<s;){const[o,a]=e.tag(),l=this.fieldNoToField.get(o);if(!l){let w=n.readUnknownField;if(w=="throw")throw new Error(`Unknown field ${o} (wire type ${a}) for ${this.info.typeName}`);let v=e.skip(a);w!==!1&&(w===!0?k.onRead:w)(this.info.typeName,t,o,a,v);continue}let c=t,h=l.repeat,g=l.localName;switch(l.oneof&&(c=c[l.oneof],c.oneofKind!==g&&(c=t[l.oneof]={oneofKind:g})),l.kind){case"scalar":case"enum":let w=l.kind=="enum"?u.INT32:l.T,v=l.kind=="scalar"?l.L:void 0;if(h){let B=c[g];if(a==m.LengthDelimited&&w!=u.STRING&&w!=u.BYTES){let K=e.uint32()+e.pos;for(;e.pos<K;)B.push(this.scalar(e,w,v))}else B.push(this.scalar(e,w,v))}else c[g]=this.scalar(e,w,v);break;case"message":if(h){let B=c[g],K=l.T().internalBinaryRead(e,e.uint32(),n);B.push(K)}else c[g]=l.T().internalBinaryRead(e,e.uint32(),n,c[g]);break;case"map":let[O,P]=this.mapEntry(l,e,n);c[g][O]=P;break}}}mapEntry(e,t,n){let r=t.uint32(),s=t.pos+r,o,a;for(;t.pos<s;){let[l,c]=t.tag();switch(l){case 1:e.K==u.BOOL?o=t.bool().toString():o=this.scalar(t,e.K,de.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 ${l} (wire type ${c}) in map entry for ${this.info.typeName}#${e.name}`)}}if(o===void 0){let l=bt(e.K);o=e.K==u.BOOL?l.toString():l}if(a===void 0)switch(e.V.kind){case"scalar":a=bt(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 u.INT32:return e.int32();case u.STRING:return e.string();case u.BOOL:return e.bool();case u.DOUBLE:return e.double();case u.FLOAT:return e.float();case u.INT64:return ne(e.int64(),n);case u.UINT64:return ne(e.uint64(),n);case u.FIXED64:return ne(e.fixed64(),n);case u.FIXED32:return e.fixed32();case u.BYTES:return e.bytes();case u.UINT32:return e.uint32();case u.SFIXED32:return e.sfixed32();case u.SFIXED64:return ne(e.sfixed64(),n);case u.SINT32:return e.sint32();case u.SINT64:return ne(e.sint64(),n)}}}class ui{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 o,a,l=s.repeat,c=s.localName;if(s.oneof){const h=e[s.oneof];if(h.oneofKind!==c)continue;o=h[c],a=!0}else o=e[c],a=!1;switch(s.kind){case"scalar":case"enum":let h=s.kind=="enum"?u.INT32:s.T;if(l)if(N(Array.isArray(o)),l==ot.PACKED)this.packed(t,h,s.no,o);else for(const g of o)this.scalar(t,h,s.no,g,!0);else o===void 0?N(s.opt):this.scalar(t,h,s.no,o,a||s.opt);break;case"message":if(l){N(Array.isArray(o));for(const g of o)this.message(t,n,s.T(),s.no,g)}else this.message(t,n,s.T(),s.no,o);break;case"map":N(typeof o=="object"&&o!==null);for(const[g,w]of Object.entries(o))this.mapEntry(t,n,s,g,w);break}}let r=n.writeUnknownFields;r!==!1&&(r===!0?k.onWrite:r)(this.info.typeName,e,t)}mapEntry(e,t,n,r,s){e.tag(n.no,m.LengthDelimited),e.fork();let o=r;switch(n.K){case u.INT32:case u.FIXED32:case u.UINT32:case u.SFIXED32:case u.SINT32:o=Number.parseInt(r);break;case u.BOOL:N(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,s,!0);break;case"enum":this.scalar(e,u.INT32,2,s,!0);break;case"message":this.message(e,t,n.V.T(),2,s);break}e.join()}message(e,t,n,r,s){s!==void 0&&(n.internalBinaryWrite(s,e.tag(r,m.LengthDelimited).fork(),t),e.join())}scalar(e,t,n,r,s){let[o,a,l]=this.scalarInfo(t,r);(!l||s)&&(e.tag(n,o),e[a](r))}packed(e,t,n,r){if(!r.length)return;N(t!==u.BYTES&&t!==u.STRING),e.tag(n,m.LengthDelimited),e.fork();let[,s]=this.scalarInfo(t);for(let o=0;o<r.length;o++)e[s](r[o]);e.join()}scalarInfo(e,t){let n=m.Varint,r,s=t===void 0,o=t===0;switch(e){case u.INT32:r="int32";break;case u.STRING:o=s||!t.length,n=m.LengthDelimited,r="string";break;case u.BOOL:o=t===!1,r="bool";break;case u.UINT32:r="uint32";break;case u.DOUBLE:n=m.Bit64,r="double";break;case u.FLOAT:n=m.Bit32,r="float";break;case u.INT64:o=s||R.from(t).isZero(),r="int64";break;case u.UINT64:o=s||X.from(t).isZero(),r="uint64";break;case u.FIXED64:o=s||X.from(t).isZero(),n=m.Bit64,r="fixed64";break;case u.BYTES:o=s||!t.byteLength,n=m.LengthDelimited,r="bytes";break;case u.FIXED32:n=m.Bit32,r="fixed32";break;case u.SFIXED32:n=m.Bit32,r="sfixed32";break;case u.SFIXED64:o=s||R.from(t).isZero(),n=m.Bit64,r="sfixed64";break;case u.SINT32:r="sint32";break;case u.SINT64:o=s||R.from(t).isZero(),r="sint64";break}return[n,r,s||o]}}function pi(i){const e=i.messagePrototype?Object.create(i.messagePrototype):Object.defineProperty({},Zt,{value:i});for(let t of i.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]=bt(t.T,t.L);break;case"enum":e[n]=0;break;case"map":e[n]={};break}}return e}function $(i,e,t){let n,r=t,s;for(let o of i.fields){let a=o.localName;if(o.oneof){const l=r[o.oneof];if((l==null?void 0:l.oneofKind)==null)continue;if(n=l[a],s=e[o.oneof],s.oneofKind=l.oneofKind,n==null){delete s[a];continue}}else if(n=r[a],s=e,n==null)continue;switch(o.repeat&&(s[a].length=n.length),o.kind){case"scalar":case"enum":if(o.repeat)for(let c=0;c<n.length;c++)s[a][c]=n[c];else s[a]=n;break;case"message":let l=o.T();if(o.repeat)for(let c=0;c<n.length;c++)s[a][c]=l.create(n[c]);else s[a]===void 0?s[a]=l.create(n):l.mergePartial(s[a],n);break;case"map":switch(o.V.kind){case"scalar":case"enum":Object.assign(s[a],n);break;case"message":let c=o.V.T();for(let h of Object.keys(n))s[a][h]=c.create(n[h]);break}break}}}function fi(i,e,t){if(e===t)return!0;if(!e||!t)return!1;for(let n of i.fields){let r=n.localName,s=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"?u.INT32:n.T;if(!(n.repeat?Pt(a,s,o):qt(a,s,o)))return!1;break;case"map":if(!(n.V.kind=="message"?Kt(n.V.T(),at(s),at(o)):Pt(n.V.kind=="enum"?u.INT32:n.V.T,at(s),at(o))))return!1;break;case"message":let l=n.T();if(!(n.repeat?Kt(l,s,o):l.equals(s,o)))return!1;break}}return!0}const at=Object.values;function qt(i,e,t){if(e===t)return!0;if(i!==u.BYTES)return!1;let n=e,r=t;if(n.length!==r.length)return!1;for(let s=0;s<n.length;s++)if(n[s]!=r[s])return!1;return!0}function Pt(i,e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!qt(i,e[n],t[n]))return!1;return!0}function Kt(i,e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!i.equals(e[n],t[n]))return!1;return!0}const mi=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({}));class Z{constructor(e,t,n){this.defaultCheckDepth=16,this.typeName=e,this.fields=t.map(oi),this.options=n??{},this.messagePrototype=Object.create(null,Object.assign(Object.assign({},mi),{[Zt]:{value:this}})),this.refTypeCheck=new li(this),this.refJsonReader=new ci(this),this.refJsonWriter=new di(this),this.refBinReader=new hi(this),this.refBinWriter=new ui(this)}create(e){let t=pi(this);return e!==void 0&&$(this,t,e),t}clone(e){let t=this.create();return $(this,t,e),t}equals(e,t){return fi(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){$(this,e,t)}fromBinary(e,t){let n=Xn(t);return this.internalBinaryRead(n.readerFactory(e),e.byteLength,n)}fromJson(e,t){return this.internalJsonRead(e,ii(t))}fromJsonString(e,t){let n=JSON.parse(e);return this.fromJson(n,t)}toJson(e,t){return this.internalJsonWrite(e,ri(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=ti(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 ${L(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 s=r??this.create();return this.refBinReader.read(e,s,n,t),s}}function gi(i,e){var t,n,r;let s=i;return s.service=e,s.localName=(t=s.localName)!==null&&t!==void 0?t:yt(s.name),s.serverStreaming=!!s.serverStreaming,s.clientStreaming=!!s.clientStreaming,s.options=(n=s.options)!==null&&n!==void 0?n:{},s.idempotency=(r=s.idempotency)!==null&&r!==void 0?r:void 0,s}class Ct{constructor(e,t,n){this.typeName=e,this.methods=t.map(r=>gi(r,this)),this.options=n??{}}}class I 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
4
  `)}}function wi(i,e){if(!e)return i;let t={};lt(i,t),lt(e,t);for(let n of Object.keys(e)){let r=e[n];switch(n){case"jsonOptions":t.jsonOptions=si(i.jsonOptions,t.jsonOptions);break;case"binaryOptions":t.binaryOptions=Zn(i.binaryOptions,t.binaryOptions);break;case"meta":t.meta={},lt(i.meta,t.meta),lt(e.meta,t.meta);break;case"interceptors":t.interceptors=i.interceptors?i.interceptors.concat(r):r.concat();break}}return t}function lt(i,e){if(!i)return;let t=e;for(let[n,r]of Object.entries(i))r instanceof Date?t[n]=new Date(r.getTime()):Array.isArray(r)?t[n]=r.concat():t[n]=r}var ee;(function(i){i[i.PENDING=0]="PENDING",i[i.REJECTED=1]="REJECTED",i[i.RESOLVED=2]="RESOLVED"})(ee||(ee={}));class ke{constructor(e=!0){this._state=ee.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!==ee.PENDING)throw new Error(`cannot resolve ${ee[this.state].toLowerCase()}`);this._resolve(e),this._state=ee.RESOLVED}reject(e){if(this.state!==ee.PENDING)throw new Error(`cannot reject ${ee[this.state].toLowerCase()}`);this._reject(e),this._state=ee.REJECTED}resolvePending(e){this._state===ee.PENDING&&this.resolve(e)}rejectPending(e){this._state===ee.PENDING&&this.reject(e)}}class yi{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){N((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){N(!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){N(!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(){N(!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;N(e,"bad state"),N(!e.p,"iterator contract broken");let t=e.q.shift();return t?"value"in t?Promise.resolve(t):Promise.reject(t):(e.p=new ke,e.p.promise)}}}pushIt(e){let t=this._itState;if(t)if(t.p){const n=t.p;N(n.state==ee.PENDING,"iterator contract broken"),"value"in e?n.resolve(e):n.reject(e),delete t.p}else t.q.push(e)}}var bi=function(i,e,t,n){function r(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(h){try{c(n.next(h))}catch(g){o(g)}}function l(h){try{c(n.throw(h))}catch(g){o(g)}}function c(h){h.done?s(h.value):r(h.value).then(a,l)}c((n=n.apply(i,e||[])).next())})};class Ci{constructor(e,t,n,r,s,o,a){this.method=e,this.requestHeaders=t,this.request=n,this.headers=r,this.response=s,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,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 Ei=function(i,e,t,n){function r(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(h){try{c(n.next(h))}catch(g){o(g)}}function l(h){try{c(n.throw(h))}catch(g){o(g)}}function c(h){h.done?s(h.value):r(h.value).then(a,l)}c((n=n.apply(i,e||[])).next())})};class ki{constructor(e,t,n,r,s,o,a){this.method=e,this.requestHeaders=t,this.request=n,this.headers=r,this.responses=s,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 Ei(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 ie(i,e,t,n,r){var s;{let o=(a,l,c)=>e.unary(a,l,c);for(const a of((s=n.interceptors)!==null&&s!==void 0?s:[]).filter(l=>l.interceptUnary).reverse()){const l=o;o=(c,h,g)=>a.interceptUnary(l,c,h,g)}return o(t,r,n)}}var f;(function(i){i[i.OK=0]="OK",i[i.CANCELLED=1]="CANCELLED",i[i.UNKNOWN=2]="UNKNOWN",i[i.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",i[i.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",i[i.NOT_FOUND=5]="NOT_FOUND",i[i.ALREADY_EXISTS=6]="ALREADY_EXISTS",i[i.PERMISSION_DENIED=7]="PERMISSION_DENIED",i[i.UNAUTHENTICATED=16]="UNAUTHENTICATED",i[i.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",i[i.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",i[i.ABORTED=10]="ABORTED",i[i.OUT_OF_RANGE=11]="OUT_OF_RANGE",i[i.UNIMPLEMENTED=12]="UNIMPLEMENTED",i[i.INTERNAL=13]="INTERNAL",i[i.UNAVAILABLE=14]="UNAVAILABLE",i[i.DATA_LOSS=15]="DATA_LOSS"})(f||(f={}));var Ni=function(i,e,t,n){function r(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(h){try{c(n.next(h))}catch(g){o(g)}}function l(h){try{c(n.throw(h))}catch(g){o(g)}}function c(h){h.done?s(h.value):r(h.value).then(a,l)}c((n=n.apply(i,e||[])).next())})};function Xt(i,e,t,n,r){if(n)for(let[s,o]of Object.entries(n))if(typeof o=="string")i.append(s,o);else for(let a of o)i.append(s,a);if(i.set("Content-Type",e==="text"?"application/grpc-web-text":"application/grpc-web+proto"),e=="text"&&i.set("Accept","application/grpc-web-text"),i.set("X-Grpc-Web","1"),typeof t=="number"){if(t<=0)throw new I(`timeout ${t} ms exceeded`,f[f.DEADLINE_EXCEEDED]);i.set("grpc-timeout",`${t}m`)}else if(t){const s=t.getTime(),o=Date.now();if(s<=o)throw new I(`deadline ${t} exceeded`,f[f.DEADLINE_EXCEEDED]);i.set("grpc-timeout",`${s-o}m`)}return i}function zt(i,e){let t=new Uint8Array(5+i.length);t[0]=re.DATA;for(let n=i.length,r=4;r>0;r--)t[r]=n%256,n>>>=8;return t.set(i,5),e==="binary"?t:Ut(t)}function Et(i,e,t){if(arguments.length===1){let l=i,c;try{c=l.type}catch{}switch(c){case"error":case"opaque":case"opaqueredirect":throw new I(`fetch response type ${l.type}`,f[f.UNKNOWN])}return Et(Ii(l.headers),l.status,l.statusText)}let n=i,r=e>=200&&e<300,s=en(n),[o,a]=Qt(n);return(o===void 0||o===f.OK)&&!r&&(o=Ti(e),a=t),[o,a,s]}function Gt(i){let e=Ai(i),[t,n]=Qt(e),r=en(e);return[t??f.OK,n,r]}var re;(function(i){i[i.DATA=0]="DATA",i[i.TRAILER=128]="TRAILER"})(re||(re={}));function Jt(i,e,t){return Ni(this,void 0,void 0,function*(){let n,r="",s=new Uint8Array(0),o=Li(e);if(Fi(i)){let a=i.getReader();n={next:()=>a.read()}}else n=i[Symbol.asyncIterator]();for(;;){let a=yield n.next();if(a.value!==void 0){if(o==="text"){for(let c=0;c<a.value.length;c++)r+=String.fromCharCode(a.value[c]);let l=r.length-r.length%4;if(l===0)continue;s=Yt(s,Ot(r.substring(0,l))),r=r.substring(l)}else s=Yt(s,a.value);for(;s.length>=5&&s[0]===re.DATA;){let l=0;for(let c=1;c<5;c++)l=(l<<8)+s[c];if(s.length-5>=l)t(re.DATA,s.subarray(5,5+l)),s=s.subarray(5+l);else break}}if(a.done){if(s.length===0)break;if(s[0]!==re.TRAILER||s.length<5)throw new I("premature EOF",f[f.DATA_LOSS]);t(re.TRAILER,s.subarray(5));break}}})}const Fi=i=>typeof i.getReader=="function";function Yt(i,e){let t=new Uint8Array(i.length+e.length);return t.set(i),t.set(e,i.length),t}function Li(i){switch(i){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 I("missing response content type",f[f.INTERNAL]);default:throw new I("unexpected response content type: "+i,f[f.INTERNAL])}}function Qt(i){let e,t,n=i["grpc-message"];if(n!==void 0){if(Array.isArray(n))return[f.INTERNAL,"invalid grpc-web message"];t=n}let r=i["grpc-status"];if(r!==void 0){if(Array.isArray(r))return[f.INTERNAL,"invalid grpc-web status"];if(e=parseInt(r,10),f[e]===void 0)return[f.INTERNAL,"invalid grpc-web status"]}return[e,t]}function en(i){let e={};for(let[t,n]of Object.entries(i))switch(t){case"grpc-message":case"grpc-status":case"content-type":break;default:e[t]=n}return e}function Ai(i){let e={};for(let t of String.fromCharCode.apply(String,i).trim().split(`\r
5
- `)){if(t=="")continue;let[n,...r]=t.split(":");const s=r.join(":").trim();n=n.trim();let o=e[n];typeof o=="string"?e[n]=[o,s]:Array.isArray(o)?o.push(s):e[n]=s}return e}function Ii(i){let e={};return i.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 Ti(i){switch(i){case 200:return f.OK;case 400:return f.INVALID_ARGUMENT;case 401:return f.UNAUTHENTICATED;case 403:return f.PERMISSION_DENIED;case 404:return f.NOT_FOUND;case 409:return f.ABORTED;case 412:return f.FAILED_PRECONDITION;case 429:return f.RESOURCE_EXHAUSTED;case 499:return f.CANCELLED;case 500:return f.UNKNOWN;case 501:return f.UNIMPLEMENTED;case 503:return f.UNAVAILABLE;case 504:return f.DEADLINE_EXCEEDED;default:return f.UNKNOWN}}class vi{constructor(e){this.defaultOptions=e}mergeOptions(e){return wi(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 I("Client streaming is not supported by grpc-web",f[f.UNIMPLEMENTED]);throw t.methodName=e.name,t.serviceName=e.service.typeName,t}duplex(e){const t=new I("Duplex streaming is not supported by grpc-web",f[f.UNIMPLEMENTED]);throw t.methodName=e.name,t.serviceName=e.service.typeName,t}serverStreaming(e,t,n){var r,s,o,a;let l=n,c=(r=l.format)!==null&&r!==void 0?r:"text",h=(s=l.fetchInit)!==null&&s!==void 0?s:{},g=this.makeUrl(e,l),w=e.I.toBinary(t,l.binaryOptions),v=new ke,O=new yi,P=!0,B,K=new ke,z,le=new ke;return globalThis.fetch(g,Object.assign(Object.assign({},h),{method:"POST",headers:Xt(new globalThis.Headers,c,l.timeout,l.meta),body:zt(w,c),signal:(o=n.abort)!==null&&o!==void 0?o:null})).then(E=>{let[b,H,G]=Et(E);if(v.resolve(G),b!=null&&b!==f.OK)throw new I(H??f[b],f[b],G);return b!=null&&(B={code:f[b],detail:H??f[b]}),E}).then(E=>{if(!E.body)throw new I("missing response body",f[f.INTERNAL]);return Jt(E.body,E.headers.get("content-type"),(b,H)=>{switch(b){case re.DATA:O.notifyMessage(e.O.fromBinary(H,l.binaryOptions)),P=!1;break;case re.TRAILER:let G,ce;[G,ce,z]=Gt(H),B={code:f[G],detail:ce??f[G]};break}})}).then(()=>{if(!z&&!P)throw new I("missing trailers",f[f.DATA_LOSS]);if(!B)throw new I("missing status",f[f.INTERNAL]);if(B.code!=="OK")throw new I(B.detail,B.code,z);O.notifyComplete(),K.resolve(B),le.resolve(z||{})}).catch(E=>{let b;E instanceof I?b=E:E instanceof Error&&E.name==="AbortError"?b=new I(E.message,f[f.CANCELLED]):b=new I(E instanceof Error?E.message:""+E,f[f.INTERNAL]),b.methodName=e.name,b.serviceName=e.service.typeName,v.rejectPending(b),O.notifyError(b),K.rejectPending(b),le.rejectPending(b)}),new ki(e,(a=l.meta)!==null&&a!==void 0?a:{},t,v.promise,O,K.promise,le.promise)}unary(e,t,n){var r,s,o,a;let l=n,c=(r=l.format)!==null&&r!==void 0?r:"text",h=(s=l.fetchInit)!==null&&s!==void 0?s:{},g=this.makeUrl(e,l),w=e.I.toBinary(t,l.binaryOptions),v=new ke,O,P=new ke,B,K=new ke,z,le=new ke;return globalThis.fetch(g,Object.assign(Object.assign({},h),{method:"POST",headers:Xt(new globalThis.Headers,c,l.timeout,l.meta),body:zt(w,c),signal:(o=n.abort)!==null&&o!==void 0?o:null})).then(E=>{let[b,H,G]=Et(E);if(v.resolve(G),b!=null&&b!==f.OK)throw new I(H??f[b],f[b],G);return b!=null&&(B={code:f[b],detail:H??f[b]}),E}).then(E=>{if(!E.body)throw new I("missing response body",f[f.INTERNAL]);return Jt(E.body,E.headers.get("content-type"),(b,H)=>{switch(b){case re.DATA:if(O)throw new I("unary call received 2nd message",f[f.DATA_LOSS]);O=e.O.fromBinary(H,l.binaryOptions);break;case re.TRAILER:let G,ce;[G,ce,z]=Gt(H),B={code:f[G],detail:ce??f[G]};break}})}).then(()=>{if(!z&&O)throw new I("missing trailers",f[f.DATA_LOSS]);if(!B)throw new I("missing status",f[f.INTERNAL]);if(!O&&B.code==="OK")throw new I("expected error status",f[f.DATA_LOSS]);if(!O)throw new I(B.detail,B.code,z);if(P.resolve(O),B.code!=="OK")throw new I(B.detail,B.code,z);K.resolve(B),le.resolve(z||{})}).catch(E=>{let b;E instanceof I?b=E:E instanceof Error&&E.name==="AbortError"?b=new I(E.message,f[f.CANCELLED]):b=new I(E instanceof Error?E.message:""+E,f[f.INTERNAL]),b.methodName=e.name,b.serviceName=e.service.typeName,v.rejectPending(b),P.rejectPending(b),K.rejectPending(b),le.rejectPending(b)}),new Ci(e,(a=l.meta)!==null&&a!==void 0?a:{},t,v.promise,P.promise,K.promise,le.promise)}}var ct=(i=>(i[i.IMAGE=0]="IMAGE",i[i.AUDIO=1]="AUDIO",i[i.VIDEO=2]="VIDEO",i[i.ALL=3]="ALL",i[i.FOLDER=4]="FOLDER",i))(ct||{});class Bi extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.searchValue=e.string();break;case 2:s.cursor=e.string();break;case 3:s.limit=e.int32();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.searchValue!==""&&t.tag(1,m.LengthDelimited).string(e.searchValue),e.cursor!==""&&t.tag(2,m.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(3,m.Varint).int32(e.limit);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const tn=new Bi;class xi extends Z{constructor(){super("com.hamropatro.grpc.cms.SearchResult",[{no:1,name:"items",kind:"message",repeat:1,T:()=>se},{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.items.push(se.internalBinaryRead(e,e.uint32(),n));break;case 2:s.nextPageCursor=e.string();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){for(let s=0;s<e.items.length;s++)se.internalBinaryWrite(e.items[s],t.tag(1,m.LengthDelimited).fork(),n).join();e.nextPageCursor!==""&&t.tag(2,m.LengthDelimited).string(e.nextPageCursor);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const _i=new xi;class Oi extends Z{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",ct]},{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){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 c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.name!==""&&t.tag(1,m.LengthDelimited).string(e.name),e.folderName!==""&&t.tag(2,m.LengthDelimited).string(e.folderName),e.nestedFolderName!==""&&t.tag(3,m.LengthDelimited).string(e.nestedFolderName),e.url!==""&&t.tag(4,m.LengthDelimited).string(e.url),e.type!==0&&t.tag(5,m.Varint).int32(e.type),e.extension!==""&&t.tag(6,m.LengthDelimited).string(e.extension);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const nn=new Oi;class Ui extends Z{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",ct]},{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.url=e.string();break;case 2:s.type=e.int32();break;case 3:s.extension=e.string();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.url!==""&&t.tag(1,m.LengthDelimited).string(e.url),e.type!==0&&t.tag(2,m.Varint).int32(e.type),e.extension!==""&&t.tag(3,m.LengthDelimited).string(e.extension);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const rn=new Ui;class Di extends Z{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",ct]},{no:9,name:"metadata",kind:"message",T:()=>kt}])}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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){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=kt.internalBinaryRead(e,e.uint32(),n,s.metadata);break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,m.LengthDelimited).string(e.key),e.name!==""&&t.tag(2,m.LengthDelimited).string(e.name),e.folderName!==""&&t.tag(3,m.LengthDelimited).string(e.folderName),e.nestedFolderName!==""&&t.tag(4,m.LengthDelimited).string(e.nestedFolderName),e.url!==""&&t.tag(5,m.LengthDelimited).string(e.url),e.thumborUrl!==""&&t.tag(6,m.LengthDelimited).string(e.thumborUrl),e.proxyUrl!==""&&t.tag(7,m.LengthDelimited).string(e.proxyUrl),e.type!==0&&t.tag(8,m.Varint).int32(e.type),e.metadata&&kt.internalBinaryWrite(e.metadata,t.tag(9,m.LengthDelimited).fork(),n).join();let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const se=new Di;class Si extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){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 c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.height!==0&&t.tag(1,m.Varint).int32(e.height),e.width!==0&&t.tag(2,m.Varint).int32(e.width),e.backgroundColor!==""&&t.tag(3,m.LengthDelimited).string(e.backgroundColor),e.aspectRatio!==0&&t.tag(4,m.Bit64).double(e.aspectRatio);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const kt=new Si;class Ri extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.key=e.string();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,m.LengthDelimited).string(e.key);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const sn=new Ri;class Mi extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.isDeleted=e.bool();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.isDeleted!==!1&&t.tag(1,m.Varint).bool(e.isDeleted);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const Vi=new Mi;class Hi extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.folderName=e.string();break;case 2:s.cursor=e.string();break;case 3:s.limit=e.int32();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.folderName!==""&&t.tag(1,m.LengthDelimited).string(e.folderName),e.cursor!==""&&t.tag(2,m.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(3,m.Varint).int32(e.limit);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const on=new Hi;class $i extends Z{constructor(){super("com.hamropatro.grpc.cms.GetFilesByFolderResponse",[{no:1,name:"files",kind:"message",repeat:1,T:()=>se},{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.files.push(se.internalBinaryRead(e,e.uint32(),n));break;case 2:s.nextCursor=e.string();break;case 3:s.hasMore=e.bool();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){for(let s=0;s<e.files.length;s++)se.internalBinaryWrite(e.files[s],t.tag(1,m.LengthDelimited).fork(),n).join();e.nextCursor!==""&&t.tag(2,m.LengthDelimited).string(e.nextCursor),e.hasMore!==!1&&t.tag(3,m.Varint).bool(e.hasMore);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const Wi=new $i,Nt=new Ct("com.hamropatro.grpc.cms.FileService",[{name:"createFile",options:{},I:nn,O:se},{name:"updateFile",options:{},I:se,O:se},{name:"deleteFile",options:{},I:sn,O:Vi},{name:"getFilesByFolder",options:{},I:on,O:Wi},{name:"createUserFile",options:{},I:rn,O:se},{name:"search",options:{},I:tn,O:_i}]);class Se{constructor(e){U(this,"typeName",Nt.typeName);U(this,"methods",Nt.methods);U(this,"options",Nt.options);this._transport=e}createFile(e,t){const n=this.methods[0],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}updateFile(e,t){const n=this.methods[1],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}deleteFile(e,t){const n=this.methods[2],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}getFilesByFolder(e,t){const n=this.methods[3],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}createUserFile(e,t){const n=this.methods[4],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}search(e,t){const n=this.methods[5],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}}const ji=async(i,e,t,n,r,s)=>{var o;try{const a=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,l=new Se(a),c=nn.create();return c.name=i,c.nestedFolderName=e,c.url=t,c.type=n,c.folderName=r,await l.createFile(c,s)}catch(a){throw a}},Zi=async(i,e,t)=>{var n;try{const r=(n=window.ImageSalonSDK)==null?void 0:n.grpcConfig,s=new Se(r),o=rn.create();return o.url=i,o.type=e,await s.createUserFile(o,t)}catch(r){throw r}},qi=async(i,e,t,n)=>{var r;try{const s=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,o=new Se(s),a=on.create();return a.folderName=i,a.cursor=e,a.limit=t,await o.getFilesByFolder(a,n)}catch(s){throw s}},Pi=async(i,e,t=20,n)=>{var r;try{const s=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,o=new Se(s),a=tn.create();return a.searchValue=i,a.cursor=e,a.limit=t,await o.search(a,n)}catch(s){throw s}},Ki=async(i,e,t,n,r,s,o,a,l)=>{var c;try{const h=(c=window.ImageSalonSDK)==null?void 0:c.grpcConfig,g=new Se(h),w=se.create();return w.key=i,w.name=e,w.nestedFolderName=t,w.url=n,w.thumborUrl=r,w.proxyUrl=s,w.type=o,w.folderName=a,await g.updateFile(w,l)}catch(h){throw h}},Xi=async(i,e)=>{var t;try{const n=(t=window.ImageSalonSDK)==null?void 0:t.grpcConfig,r=new Se(n),s=sn.create();return s.key=i,await r.deleteFile(s,e)}catch(n){throw n}};class zi extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.key=e.string();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,m.LengthDelimited).string(e.key);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const an=new zi;class Gi extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.name=e.string();break;case 2:s.nestedFolderName=e.string();break;case 3:s.createdBy=e.string();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.name!==""&&t.tag(1,m.LengthDelimited).string(e.name),e.nestedFolderName!==""&&t.tag(2,m.LengthDelimited).string(e.nestedFolderName),e.createdBy!==""&&t.tag(3,m.LengthDelimited).string(e.createdBy);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const ln=new Gi;class Ji extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.cursor=e.string();break;case 2:s.limit=e.int32();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.cursor!==""&&t.tag(1,m.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(2,m.Varint).int32(e.limit);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const cn=new Ji;class Yi extends Z{constructor(){super("com.hamropatro.grpc.cms.GetAllFoldersResponse",[{no:1,name:"folder",kind:"message",repeat:1,T:()=>Ne},{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.folder.push(Ne.internalBinaryRead(e,e.uint32(),n));break;case 2:s.nextCursor=e.string();break;case 3:s.hasMore=e.bool();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){for(let s=0;s<e.folder.length;s++)Ne.internalBinaryWrite(e.folder[s],t.tag(1,m.LengthDelimited).fork(),n).join();e.nextCursor!==""&&t.tag(2,m.LengthDelimited).string(e.nextCursor),e.hasMore!==!1&&t.tag(3,m.Varint).bool(e.hasMore);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const Qi=new Yi;class er extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){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 c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,m.LengthDelimited).string(e.key),e.name!==""&&t.tag(2,m.LengthDelimited).string(e.name),e.nestedFolderName!==""&&t.tag(3,m.LengthDelimited).string(e.nestedFolderName),e.createdBy!==""&&t.tag(4,m.LengthDelimited).string(e.createdBy);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const Ne=new er,Ft=new Ct("com.hamropatro.grpc.cms.FolderService",[{name:"createFolder",options:{},I:ln,O:Ne},{name:"getFolders",options:{},I:cn,O:Qi},{name:"updateFolder",options:{},I:Ne,O:Ne},{name:"deleteFolder",options:{},I:an,O:Ne}]);class dt{constructor(e){U(this,"typeName",Ft.typeName);U(this,"methods",Ft.methods);U(this,"options",Ft.options);this._transport=e}createFolder(e,t){const n=this.methods[0],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}getFolders(e,t){const n=this.methods[1],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}updateFolder(e,t){const n=this.methods[2],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}deleteFolder(e,t){const n=this.methods[3],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}}const tr=async(i,e=20,t)=>{var o;const n=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,r=new dt(n),s=cn.create();try{return s.cursor=i,s.limit=e,await r.getFolders(s,t)}catch(a){throw a}},nr=async(i,e,t,n)=>{var r;try{const s=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,o=new dt(s),a=ln.create();return a.name=i,a.nestedFolderName=e,a.createdBy=t,await o.createFolder(a,n)}catch(s){throw s}},ir=async(i,e,t,n,r)=>{var s;try{const o=(s=window.ImageSalonSDK)==null?void 0:s.grpcConfig,a=new dt(o),l=Ne.create();return l.name=e,l.key=i,l.nestedFolderName=t,l.createdBy=n,await a.updateFolder(l,r)}catch(o){throw o}},rr=async(i,e)=>{var t;try{const n=(t=window.ImageSalonSDK)==null?void 0:t.grpcConfig,r=new dt(n),s=an.create();return s.key=i,await r.deleteFolder(s,e)}catch(n){throw n}},Lt=(i,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",i||"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 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 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(s),n.appendChild(o),n};function dn(){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("height","24px"),i.setAttribute("width","24px"),i.setAttribute("viewBox","0 -960 960 960"),i.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"),i.appendChild(e),i}function sr(){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("width","12"),i.setAttribute("height","12"),i.setAttribute("viewBox","0 0 24 24"),i.setAttribute("fill","none"),i.setAttribute("stroke","currentColor"),i.setAttribute("stroke-width","2"),i.setAttribute("stroke-linecap","round"),i.setAttribute("stroke-linejoin","round"),i.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"),i.appendChild(e),i.appendChild(t),i.appendChild(n),i.appendChild(r),document.body.appendChild(i),i}const or=()=>{const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("width","20"),i.setAttribute("height","20"),i.setAttribute("viewBox","0 0 24 24"),i.setAttribute("fill","none"),i.setAttribute("stroke","currentColor"),i.setAttribute("stroke-width","2"),i.setAttribute("stroke-linecap","round"),i.setAttribute("stroke-linejoin","round"),i.classList.add("lucide","lucide-circle-check-big");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d","M21.801 10A10 10 0 1 1 17 3.335");const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d","m9 11 3 3L22 4"),i.appendChild(e),i.appendChild(t),i};function At(i="#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",i);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 hn(){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("width","16"),i.setAttribute("height","16"),i.setAttribute("viewBox","0 0 24 24"),i.setAttribute("fill","none"),i.setAttribute("stroke","#2c96f8"),i.setAttribute("stroke-width","2"),i.setAttribute("stroke-linecap","round"),i.setAttribute("stroke-linejoin","round"),i.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"),i.appendChild(e),i.appendChild(t),document.body.appendChild(i),i}function Xe(){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/folder"),i.setAttribute("x","0px"),i.setAttribute("y","0px"),i.setAttribute("width","24"),i.setAttribute("height","24"),i.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"),i.appendChild(e),i.appendChild(t),i}function ar(){const i="http://www.w3.org/2000/svg",e=document.createElementNS(i,"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(i,"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(i,"circle");n.setAttribute("cx","9"),n.setAttribute("cy","9"),n.setAttribute("r","2");const r=document.createElementNS(i,"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 lr(){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("height","24px"),i.setAttribute("viewBox","0 -960 960 960"),i.setAttribute("width","24px"),i.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"),i.appendChild(e),i}function un(){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("fill","none"),i.setAttribute("width","20"),i.setAttribute("height","20"),i.setAttribute("viewBox","0 0 24 24"),i.setAttribute("stroke-width","1.5"),i.setAttribute("stroke","currentColor"),i.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"),i.appendChild(e),i}function cr(){const i="http://www.w3.org/2000/svg",e=document.createElementNS(i,"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(i,"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(i,"circle");return n.setAttribute("cx","12"),n.setAttribute("cy","12"),n.setAttribute("r","3"),e.appendChild(n),document.body.appendChild(e),e}function dr(){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("height","24px"),i.setAttribute("width","24px"),i.setAttribute("viewBox","0 0 30 30"),i.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"),i.appendChild(e),i}function pn(){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("width","16"),i.setAttribute("height","16"),i.setAttribute("viewBox","0 0 24 24"),i.setAttribute("fill","none"),i.setAttribute("stroke","#f14b4b"),i.setAttribute("stroke-width","2"),i.setAttribute("stroke-linecap","round"),i.setAttribute("stroke-linejoin","round"),i.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 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"),i.appendChild(e),i.appendChild(t),i.appendChild(n),i.appendChild(r),i.appendChild(s),document.body.appendChild(i),i}function It(){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("width","24"),i.setAttribute("height","24"),i.setAttribute("viewBox","0 0 24 24"),i.setAttribute("fill","none"),i.setAttribute("stroke","currentColor"),i.setAttribute("stroke-width","2"),i.setAttribute("stroke-linecap","round"),i.setAttribute("stroke-linejoin","round"),i.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"),i.appendChild(e),i.appendChild(t),i.appendChild(n),i}function hr(){const i="http://www.w3.org/2000/svg",e=document.createElementNS(i,"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(i,"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(i,"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 F(i,e,t,n,r){let s=document.createElement(i);return e&&(s.className+=e),t&&(s.style.cssText=t),n&&(s.textContent=n),r&&r.appendChild(s),s}class ur{constructor(){C(this,ge);C(this,oe);C(this,Re,"#fff");p(this,ge,document.createElementNS("http://www.w3.org/2000/svg","svg")),d(this,ge).setAttribute("viewBox","25 25 50 50"),d(this,ge).classList.add("loader-svg"),p(this,oe,document.createElementNS("http://www.w3.org/2000/svg","circle")),d(this,oe).setAttribute("r","20"),d(this,oe).setAttribute("cy","50"),d(this,oe).setAttribute("cx","50"),d(this,oe).setAttribute("stroke",d(this,Re)),d(this,oe).classList.add("loader-circle"),d(this,ge).appendChild(d(this,oe))}show(e,t){t&&(p(this,Re,t),d(this,oe).setAttribute("stroke",d(this,Re))),e.appendChild(d(this,ge))}hide(){d(this,ge).remove()}}ge=new WeakMap,oe=new WeakMap,Re=new WeakMap;const fn=new ur,ht=document.body;class mn{constructor(){U(this,"main");U(this,"dialogContainer");U(this,"dialog");U(this,"dialogBackdrop");U(this,"dialogContent");U(this,"dialogHeader");U(this,"dialogBody");U(this,"dialogFooter");U(this,"confirmButton");U(this,"cancelButton");U(this,"confirmCallback");U(this,"cancelCallback");this.main=F("div"),this.dialog=F("div"),this.confirmCallback=void 0,this.cancelCallback=void 0}_init(e){this.main=F("div","dialog-presentation","","",ht),this.main.setAttribute("role","presentation"),this.dialogContainer=F("div","dialog-container","","",this.main),this.dialogBackdrop=F("div","dialog-backdrop","","",this.dialogContainer),this.dialog=F("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=F("div","dialog-content","","",this.dialog),e!=null&&e.dialogContentStyle&&Object.assign(this.dialogContent.style,e.dialogContentStyle),this.confirmButton=F("button","dialog-btn confirm","","",this.dialogFooter),this.confirmButton.type="button",this.cancelButton=F("button","dialog-btn cancel","","",this.dialogFooter),this.cancelButton.type="button",e.showCloseBtn){const n=F("button","dialog-close-btn","","",this.dialogContent);n.appendChild(At()),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",ht.style.overflow="hidden",this.confirmButton.textContent=e.confirmButtonText||"Upload",this.cancelButton.textContent=e.cancelButtonText||"Cancel",ht.classList.add("dialog-visible"),new Promise(n=>{const r=s=>()=>{this.hide(),n(s==="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=F("div","dialog-header","","",this.dialogContent),!e.header)this.dialogHeader.innerHTML="";else if(typeof e.header=="string"){const t=F("h4","dialog-header-text","","",this.dialogHeader);t.textContent=e.header}else this.dialogHeader.innerHTML="",this.dialogHeader.appendChild(e.header)}_setBody(e){this.dialogBody=F("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=F("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||ht.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?(fn.show(this.confirmButton),this.confirmButton.disabled=!0):(fn.hide(),this.confirmButton.disabled=!1)}}const ut=new mn,M=new mn;class pr{constructor(){U(this,"main");U(this,"dialogBody");this.main=F("div"),this.dialogBody=F("div"),this.hide()}show(e){this.main=F("div","popover","","",e.mainContainer),this.dialogBody=F("div","popover-body","","",this.main),this.main.id=e.divId,this.dialogBody.append(e.content)}hide(){this.main.remove()}}const te=new pr;var he=(i=>(i[i.IMAGE=0]="IMAGE",i[i.AUDIO=1]="AUDIO",i[i.VIDEO=2]="VIDEO",i[i.ALL=3]="ALL",i[i.FOLDER=4]="FOLDER",i))(he||{});const ze={0:"IMAGE",1:"AUDIO",2:"VIDEO",3:"ALL",4:"FOLDER"};function gn(i){switch(i){case"image":return ze[he.IMAGE];case"video":return ze[he.VIDEO];case"audio":return ze[he.AUDIO];default:return ze[he.ALL]}}function fr(i){const e={};i.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 i.reduce((r,s)=>(s.nestedFolderName||r.push(t(e[s.key])),r),[])}function mr(i,e){const t=n=>{if(n.key===e.nestedFolderName)return n.children[e.key]={...e,children:{}},!0;for(const r in n.children){const s=n.children[r];if(t(s))return!0}return!1};for(const n of i)if(t(n))break;return i}const gr=async(i,e)=>{let t;try{i&&(t={Authorization:i,"app-id":e==="production"?"hamropatro":"hamropatro-android"})}catch(r){if(r)throw r}return{meta:t}};function y(i,e){const t=document.createElement("div");return i&&(t.className=i),e&&(t.id=e),t}function Ge(i,e,t){const n=document.createElement("p");return e&&(n.className=e),t&&(n.id=t),i&&(n.textContent=i),n}function T(i,e){const t=document.createElement("span");return e&&(t.className=e),i&&(t.textContent=i),t}function wn(i,e,t,n){const r=document.createElement("img");return e&&(r.className=e),r.src=i,r}function wr(i,e,t){const n=document.createElement("video"),r=document.createElement("source");return n.className=e,r.src=i,n.appendChild(r),n}function yr(i,e,t){const n=document.createElement("audio"),r=document.createElement("source");return n.className=e,n.controls=!0,r.src=i,n.appendChild(r),n}function Y(i,e,t,n,r){const s=document.createElement("button");return e&&(s.className=e),t&&(s.id=t),i&&(s.textContent=i),r&&(s.innerHTML=r),s.disabled=n,s}function Tt(i,e,t){const n=document.createElement("input");return n.className=e,n.defaultValue=t,i&&(n.type=i),n}class br extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.mimeType=e.string();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.mimeType!==""&&t.tag(1,m.LengthDelimited).string(e.mimeType);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const yn=new br;class Cr extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.key=e.string();break;case 2:s.url=e.string();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,m.LengthDelimited).string(e.key),e.url!==""&&t.tag(2,m.LengthDelimited).string(e.url);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const Er=new Cr,vt=new Ct("com.hamropatro.grpc.cms.ImageUploadService",[{name:"Upload",options:{},I:yn,O:Er}]);class kr{constructor(e){U(this,"typeName",vt.typeName);U(this,"methods",vt.methods);U(this,"options",vt.options);this._transport=e}upload(e,t){const n=this.methods[0],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}}const Nr=async i=>{var r;const e=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,t=new kr(e),n=yn.create();try{return n.mimeType=i,await t.upload(n)}catch(s){throw s}},bn=async(i,e)=>{try{const t=Fr(i,e),r=(await Nr(e==null?void 0:e.type)).response.url;return await fetch(r,{method:"PUT",headers:{"Content-Type":e==null?void 0:e.type,"x-amz-acl":"public-read"},body:t}),r==null?void 0:r.split("?")[0]}catch(t){throw t}},Fr=(i,e)=>{const t=e.type.split("/")[0];let n="";t==="video"?n=i==null?void 0:i.replace(/^data:video\/\w+;base64,/,""):t==="image"?n=i==null?void 0:i.replace(/^data:image\/\w+;base64,/,""):t==="audio"&&(n=i==null?void 0:i.replace(/^data:audio\/\w+;base64,/,""));const r=atob(n),s=new Uint8Array(r.length);for(let o=0;o<r.length;o++)s[o]=r.charCodeAt(o);return s};class Lr{constructor(e){C(this,Fe);C(this,W);C(this,V);C(this,we);C(this,D,[]);C(this,j,[]);C(this,ue);C(this,Q);C(this,Oe);C(this,ye);C(this,pe,[]);C(this,ae);C(this,Le);C(this,Me);C(this,Ae);C(this,Ie);C(this,be);C(this,Ue);C(this,fe);C(this,me);C(this,Te);C(this,ve);C(this,Ce);C(this,Ve);C(this,Je);C(this,J);C(this,Ee);C(this,Ye,!1);C(this,pt);C(this,Qe);C(this,q);C(this,He);C(this,Be);C(this,et);C(this,$e);C(this,We);C(this,je);p(this,Qe,e.isAdmin),p(this,ue,!1),p(this,Me,e.handleUpload.bind(this)),p(this,Je,e.accessToken),this._grpcOptionInitializer(),this._init(e).then(()=>{p(this,Ye,!0),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){return this._isAdminOptions(e)?(p(this,Q,!1),p(this,Oe,!1),p(this,Ae,0),p(this,me,""),p(this,Ce,!1),p(this,et,e.mode),p(this,Te,!1),p(this,Be,""),p(this,Ee,null),this._removeToastContainer(),this._renderAdminView(e)):(p(this,He,""),p(this,ye,e==null?void 0:e.folderName),p(this,$e,e.restrictedFileSize),p(this,We,e==null?void 0:e.localizedFileRestrictedMessage),p(this,je,e==null?void 0:e.localizedErrorMessage),this._removeUserToast(),this._renderUserView(e))}_renderAdminView(e){if(!d(this,Ye))return;const{parentContainerId:t}=e;if(e.isAdmin===!0)var{buttonProps:n}=e;p(this,Fe,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 s=document.createElement("span");s.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(s,o),n!=null&&n.buttonStyle&&Object.assign(r.style,n==null?void 0:n.buttonStyle),r.addEventListener("click",()=>{this._selectedImageContainer()}),d(this,Fe).appendChild(r)}async _grpcOptionInitializer(){p(this,J,await gr(d(this,Je),d(this,et)))}_selectedImageContainer(){var g;p(this,Le,Y(`Save (${(g=d(this,D))==null?void 0:g.length})`,"dialog-btn confirm")),p(this,Ie,y("folder-container")),p(this,be,y("folder-list-wrapper")),this._fetchAllFolders();const e=Y("Cancel","dialog-btn cancel");Y("","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",()=>{ut.hide(),p(this,D,[]),p(this,j,[])}),p(this,W,y("browse-container"));const n=y();n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="space-between",n.style.padding="10px 20px";const r=Ge("Folders","folder-title"),s=Y("","add-folder-btn");s.append(un()),this._createUpdateFolderDialog(s,"create"),n.append(r,s),d(this,Ie).append(n,d(this,be));const o=this._renderSearchField(),a=this._createBrowseMoreContainer(),l=this._createBrowseImageMain(),c=y("footer");e.onclick=()=>{ut.hide(),p(this,j,[]),p(this,D,[])},d(this,Le).onclick=()=>{d(this,Me).call(this),ut.hide(),p(this,D,[]),p(this,j,[])},c.append(e,d(this,Le));const h=y("container-right-main");h.append(o,a,l,c),d(this,W).append(d(this,Ie),h),ut.show({content:d(this,W)})}_renderUserView(e){const{parentContainerId:t,restrictedFileSize:n,imagePreview:r}=e;p(this,Fe,document.getElementById(t)),p(this,q,F("div","user-view-container"));const s=y("user-view-browse-wrapper"),o=F("span","","","Drag & Drop or "),a=this._renderUserViewBrowseButton(),l=F("p","","margin-block: 0px; font-size:14px");if(l.append(o,a),n){const c=F("p","","margin-block: 0px; font-size: 13px; color: #777",`Max File size: ${n}MB`);s.append(It(),l,c)}else s.append(It(),l);return this._setupDragAndDrop(d(this,q)),d(this,q).append(s),r&&this._renderImagePreview(r),d(this,Fe).appendChild(d(this,q)),d(this,Fe)}_setupDragAndDrop(e){if(!e)return;["dragenter","dragover","dragleave","drop"].forEach(n=>{d(this,q).addEventListener(n,r=>{r.preventDefault(),r.stopPropagation()},!1)}),["dragenter","dragover"].forEach(n=>{d(this,q).addEventListener(n,()=>{d(this,q).classList.add("highlight")},!1)}),["dragleave","drop"].forEach(n=>{d(this,q).addEventListener(n,()=>{d(this,q).classList.remove("highlight")},!1)}),d(this,q).addEventListener("drop",n=>{var s;let r=(s=n.dataTransfer)==null?void 0:s.files[0];r&&this._handleDroppedFile(r)},!1)}_renderImagePreview(e,t){var l;const n=document.getElementById("user-image-preview");n&&n.remove();const r=F("div","user-image-preview");r.id="user-image-preview";const s=F("img","","max-width: 230px;max-height:250px;object-fit:cover;");s.src=e,s.alt=t||"";const o=F("div","","width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; padding: 4px; position: absolute; top: -10px; right: -10px; background: #c10007; border-radius: 50%;z-index:1"),a=At();a.style.fill="#fff",o==null||o.appendChild(a),o.addEventListener("click",()=>{var c;(c=d(this,q))==null||c.removeChild(r),this._removeUserToast()}),r==null||r.append(s,o),(l=d(this,q))==null||l.append(r)}_handleDroppedFile(e){this._readFileAsBase64(e)}_readFileAsBase64(e){const t=d(this,$e)*1024*1024;if(e.size>t){this._renderUserToast(d(this,We)?d(this,We):`File size must be less than ${d(this,$e)}MB.`);return}this._removeUserToast();const n=new FileReader;n.readAsDataURL(e),n.onload=()=>{this._userViewUploadAndAddSelectedImageList(n.result,e)},n.onerror=()=>{console.error("Error reading file:",n.error)}}_renderUserToast(e){const t=F("div","","display:flex;align-items:center;gap:5px;");t.id="user-toast-container";const n=F("p","","color:#ee3f3f;margin-block:0px;font-size:14px;padding-top:3px");n.textContent=e;const r=Lt();r.style.width="15px",r.style.height="15px",t.append(r,n),d(this,q).firstChild.appendChild(t)}_removeUserToast(){const e=document.getElementById("user-toast-container");e&&e.remove()}_renderUserViewBrowseButton(){const e=Tt("file");e.style.display="none",e.setAttribute("multiple","true"),e.setAttribute("accept","image/*");const t=F("a","user-upload-btn","","Click to upload");return t.classList.add("user-upload-btn"),t.role="button",t.addEventListener("click",()=>e.click()),e.addEventListener("change",()=>{const n=e.files[0];n&&this._readFileAsBase64(n),e.value=""}),t}_renderUserUploading(){const e=F("div","","margin-top:10px;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=F("div","linear-loader");e.appendChild(t),d(this,q).append(e)}_removeUserUploading(){const e=document.getElementById("user-uploading");e&&e.remove()}async _userViewUploadAndAddSelectedImageList(e,t){p(this,ue,!0),this._renderUserUploading();try{this._renderImagePreview(e,t.name);const n=await bn(e,t);await this._uploadForUser(n,t)}catch{this._renderUserToast(d(this,je)?d(this,je):"Error uploading. Please try again later.")}finally{p(this,ue,!1),this._removeUserUploading()}}async _uploadForUser(e,t){var n;try{const r=await Zi(e,he[gn((n=t.type)==null?void 0:n.split("/")[0])],d(this,J));p(this,He,r==null?void 0:r.response),d(this,Me).call(this)}catch(r){throw Error(r)}}_createAllAndSelectedTab(e){const t=y("select-options"),n=Ge("Browse","select"),r=Ge("Selected","select","selected-images-tab");n.classList.add("selected"),[n,r].forEach((o,a)=>{o.addEventListener("click",()=>{var l;p(this,Ae,a),(l=document.querySelector(".select.selected"))==null||l.classList.remove("selected"),o.classList.add("selected"),this._updateSelectedImageListContainerUI()})}),t.append(n,r),e.appendChild(t)}_renderUploadButton(){const e=Tt("file");e.style.display="none",e.setAttribute("multiple","true"),e.setAttribute("accept","image/*,video/*,audio/*,.gif"),p(this,we,document.createElement("button")),d(this,we).className="browse-more-btn";const t=document.createElement("span");return t.textContent="Upload",d(this,we).append(It(),t),d(this,we).type="button",d(this,we).addEventListener("click",()=>e.click()),e.addEventListener("change",()=>{const n=e.files;Object.values(n).forEach(r=>{const s=new FileReader;s.readAsDataURL(r),s.onload=async()=>{await this._uploadAndAddSelectedImageList(s.result,r)}}),e.value=""}),d(this,we)}_renderCreateFolderBtn(){const e=document.createElement("button");e.className="create-folder-btn";const t=document.createElement("span");return t.textContent="Create",e.append(un(),t),this._createUpdateFolderDialog(e,"create"),e}_renderSearchField(){let e;const t=y("search-browse-container"),n=y("search-input-wrapper","search-input-wrapper");p(this,ve,Tt("search")),d(this,ve).value="",d(this,ve).addEventListener("input",s=>{p(this,j,[]);const o=s.target;e&&clearTimeout(e),e=setTimeout(()=>{if(!o.value){p(this,me,""),p(this,Te,!1),p(this,Ce,!1),this._fetchFilesFromFolder(d(this,ye));return}p(this,Ce,!0),p(this,Ve,o.value),this._search(d(this,Ve))},750)}),d(this,ve).setAttribute("placeholder","Search");const r=dr();return r.style.position="absolute",r.style.top="50%",r.style.left="5%",r.style.transform="translate(-5%, -50%)",n.append(r,d(this,ve)),t.append(n),t}_createBrowseMoreContainer(){p(this,Ue,y("browse-more-btn-container")),this._createAllAndSelectedTab(d(this,Ue));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),d(this,Ue).appendChild(n),d(this,Ue)}_createBrowseImageMain(){const e=y("browse-image-main");return p(this,V,y("selected-image-container")),d(this,V).addEventListener("scroll",()=>{const t=d(this,V).clientHeight,n=d(this,V).scrollTop,r=d(this,V).scrollHeight;t+n>=r-5&&d(this,Te)&&(d(this,Ce)?this._search(d(this,Ve)):this._fetchFilesFromFolder(d(this,ye)))}),e.appendChild(d(this,V)),e}_renderFetchingSkeletonUI(){for(let e=0;e<20;e++){const t=y("skeleton");t.innerHTML="",d(this,V).append(t)}}_renderEmptyImageContainer(){if(d(this,Q)||d(this,ue))return;const e=y(),t=y(),n=document.createElement("p");d(this,Ce)&&d(this,Ae)===0?(t.innerHTML=`
5
+ `)){if(t=="")continue;let[n,...r]=t.split(":");const s=r.join(":").trim();n=n.trim();let o=e[n];typeof o=="string"?e[n]=[o,s]:Array.isArray(o)?o.push(s):e[n]=s}return e}function Ii(i){let e={};return i.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 Ti(i){switch(i){case 200:return f.OK;case 400:return f.INVALID_ARGUMENT;case 401:return f.UNAUTHENTICATED;case 403:return f.PERMISSION_DENIED;case 404:return f.NOT_FOUND;case 409:return f.ABORTED;case 412:return f.FAILED_PRECONDITION;case 429:return f.RESOURCE_EXHAUSTED;case 499:return f.CANCELLED;case 500:return f.UNKNOWN;case 501:return f.UNIMPLEMENTED;case 503:return f.UNAVAILABLE;case 504:return f.DEADLINE_EXCEEDED;default:return f.UNKNOWN}}class vi{constructor(e){this.defaultOptions=e}mergeOptions(e){return wi(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 I("Client streaming is not supported by grpc-web",f[f.UNIMPLEMENTED]);throw t.methodName=e.name,t.serviceName=e.service.typeName,t}duplex(e){const t=new I("Duplex streaming is not supported by grpc-web",f[f.UNIMPLEMENTED]);throw t.methodName=e.name,t.serviceName=e.service.typeName,t}serverStreaming(e,t,n){var r,s,o,a;let l=n,c=(r=l.format)!==null&&r!==void 0?r:"text",h=(s=l.fetchInit)!==null&&s!==void 0?s:{},g=this.makeUrl(e,l),w=e.I.toBinary(t,l.binaryOptions),v=new ke,O=new yi,P=!0,B,K=new ke,G,le=new ke;return globalThis.fetch(g,Object.assign(Object.assign({},h),{method:"POST",headers:Xt(new globalThis.Headers,c,l.timeout,l.meta),body:zt(w,c),signal:(o=n.abort)!==null&&o!==void 0?o:null})).then(E=>{let[b,H,J]=Et(E);if(v.resolve(J),b!=null&&b!==f.OK)throw new I(H??f[b],f[b],J);return b!=null&&(B={code:f[b],detail:H??f[b]}),E}).then(E=>{if(!E.body)throw new I("missing response body",f[f.INTERNAL]);return Jt(E.body,E.headers.get("content-type"),(b,H)=>{switch(b){case re.DATA:O.notifyMessage(e.O.fromBinary(H,l.binaryOptions)),P=!1;break;case re.TRAILER:let J,ce;[J,ce,G]=Gt(H),B={code:f[J],detail:ce??f[J]};break}})}).then(()=>{if(!G&&!P)throw new I("missing trailers",f[f.DATA_LOSS]);if(!B)throw new I("missing status",f[f.INTERNAL]);if(B.code!=="OK")throw new I(B.detail,B.code,G);O.notifyComplete(),K.resolve(B),le.resolve(G||{})}).catch(E=>{let b;E instanceof I?b=E:E instanceof Error&&E.name==="AbortError"?b=new I(E.message,f[f.CANCELLED]):b=new I(E instanceof Error?E.message:""+E,f[f.INTERNAL]),b.methodName=e.name,b.serviceName=e.service.typeName,v.rejectPending(b),O.notifyError(b),K.rejectPending(b),le.rejectPending(b)}),new ki(e,(a=l.meta)!==null&&a!==void 0?a:{},t,v.promise,O,K.promise,le.promise)}unary(e,t,n){var r,s,o,a;let l=n,c=(r=l.format)!==null&&r!==void 0?r:"text",h=(s=l.fetchInit)!==null&&s!==void 0?s:{},g=this.makeUrl(e,l),w=e.I.toBinary(t,l.binaryOptions),v=new ke,O,P=new ke,B,K=new ke,G,le=new ke;return globalThis.fetch(g,Object.assign(Object.assign({},h),{method:"POST",headers:Xt(new globalThis.Headers,c,l.timeout,l.meta),body:zt(w,c),signal:(o=n.abort)!==null&&o!==void 0?o:null})).then(E=>{let[b,H,J]=Et(E);if(v.resolve(J),b!=null&&b!==f.OK)throw new I(H??f[b],f[b],J);return b!=null&&(B={code:f[b],detail:H??f[b]}),E}).then(E=>{if(!E.body)throw new I("missing response body",f[f.INTERNAL]);return Jt(E.body,E.headers.get("content-type"),(b,H)=>{switch(b){case re.DATA:if(O)throw new I("unary call received 2nd message",f[f.DATA_LOSS]);O=e.O.fromBinary(H,l.binaryOptions);break;case re.TRAILER:let J,ce;[J,ce,G]=Gt(H),B={code:f[J],detail:ce??f[J]};break}})}).then(()=>{if(!G&&O)throw new I("missing trailers",f[f.DATA_LOSS]);if(!B)throw new I("missing status",f[f.INTERNAL]);if(!O&&B.code==="OK")throw new I("expected error status",f[f.DATA_LOSS]);if(!O)throw new I(B.detail,B.code,G);if(P.resolve(O),B.code!=="OK")throw new I(B.detail,B.code,G);K.resolve(B),le.resolve(G||{})}).catch(E=>{let b;E instanceof I?b=E:E instanceof Error&&E.name==="AbortError"?b=new I(E.message,f[f.CANCELLED]):b=new I(E instanceof Error?E.message:""+E,f[f.INTERNAL]),b.methodName=e.name,b.serviceName=e.service.typeName,v.rejectPending(b),P.rejectPending(b),K.rejectPending(b),le.rejectPending(b)}),new Ci(e,(a=l.meta)!==null&&a!==void 0?a:{},t,v.promise,P.promise,K.promise,le.promise)}}var ct=(i=>(i[i.IMAGE=0]="IMAGE",i[i.AUDIO=1]="AUDIO",i[i.VIDEO=2]="VIDEO",i[i.ALL=3]="ALL",i[i.FOLDER=4]="FOLDER",i))(ct||{});class Bi extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.searchValue=e.string();break;case 2:s.cursor=e.string();break;case 3:s.limit=e.int32();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.searchValue!==""&&t.tag(1,m.LengthDelimited).string(e.searchValue),e.cursor!==""&&t.tag(2,m.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(3,m.Varint).int32(e.limit);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const tn=new Bi;class xi extends Z{constructor(){super("com.hamropatro.grpc.cms.SearchResult",[{no:1,name:"items",kind:"message",repeat:1,T:()=>se},{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.items.push(se.internalBinaryRead(e,e.uint32(),n));break;case 2:s.nextPageCursor=e.string();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){for(let s=0;s<e.items.length;s++)se.internalBinaryWrite(e.items[s],t.tag(1,m.LengthDelimited).fork(),n).join();e.nextPageCursor!==""&&t.tag(2,m.LengthDelimited).string(e.nextPageCursor);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const _i=new xi;class Oi extends Z{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",ct]},{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){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 c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.name!==""&&t.tag(1,m.LengthDelimited).string(e.name),e.folderName!==""&&t.tag(2,m.LengthDelimited).string(e.folderName),e.nestedFolderName!==""&&t.tag(3,m.LengthDelimited).string(e.nestedFolderName),e.url!==""&&t.tag(4,m.LengthDelimited).string(e.url),e.type!==0&&t.tag(5,m.Varint).int32(e.type),e.extension!==""&&t.tag(6,m.LengthDelimited).string(e.extension);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const nn=new Oi;class Ui extends Z{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",ct]},{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.url=e.string();break;case 2:s.type=e.int32();break;case 3:s.extension=e.string();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.url!==""&&t.tag(1,m.LengthDelimited).string(e.url),e.type!==0&&t.tag(2,m.Varint).int32(e.type),e.extension!==""&&t.tag(3,m.LengthDelimited).string(e.extension);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const rn=new Ui;class Di extends Z{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",ct]},{no:9,name:"metadata",kind:"message",T:()=>kt}])}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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){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=kt.internalBinaryRead(e,e.uint32(),n,s.metadata);break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,m.LengthDelimited).string(e.key),e.name!==""&&t.tag(2,m.LengthDelimited).string(e.name),e.folderName!==""&&t.tag(3,m.LengthDelimited).string(e.folderName),e.nestedFolderName!==""&&t.tag(4,m.LengthDelimited).string(e.nestedFolderName),e.url!==""&&t.tag(5,m.LengthDelimited).string(e.url),e.thumborUrl!==""&&t.tag(6,m.LengthDelimited).string(e.thumborUrl),e.proxyUrl!==""&&t.tag(7,m.LengthDelimited).string(e.proxyUrl),e.type!==0&&t.tag(8,m.Varint).int32(e.type),e.metadata&&kt.internalBinaryWrite(e.metadata,t.tag(9,m.LengthDelimited).fork(),n).join();let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const se=new Di;class Si extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){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 c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.height!==0&&t.tag(1,m.Varint).int32(e.height),e.width!==0&&t.tag(2,m.Varint).int32(e.width),e.backgroundColor!==""&&t.tag(3,m.LengthDelimited).string(e.backgroundColor),e.aspectRatio!==0&&t.tag(4,m.Bit64).double(e.aspectRatio);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const kt=new Si;class Ri extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.key=e.string();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,m.LengthDelimited).string(e.key);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const sn=new Ri;class Mi extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.isDeleted=e.bool();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.isDeleted!==!1&&t.tag(1,m.Varint).bool(e.isDeleted);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const Vi=new Mi;class Hi extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.folderName=e.string();break;case 2:s.cursor=e.string();break;case 3:s.limit=e.int32();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.folderName!==""&&t.tag(1,m.LengthDelimited).string(e.folderName),e.cursor!==""&&t.tag(2,m.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(3,m.Varint).int32(e.limit);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const on=new Hi;class $i extends Z{constructor(){super("com.hamropatro.grpc.cms.GetFilesByFolderResponse",[{no:1,name:"files",kind:"message",repeat:1,T:()=>se},{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.files.push(se.internalBinaryRead(e,e.uint32(),n));break;case 2:s.nextCursor=e.string();break;case 3:s.hasMore=e.bool();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){for(let s=0;s<e.files.length;s++)se.internalBinaryWrite(e.files[s],t.tag(1,m.LengthDelimited).fork(),n).join();e.nextCursor!==""&&t.tag(2,m.LengthDelimited).string(e.nextCursor),e.hasMore!==!1&&t.tag(3,m.Varint).bool(e.hasMore);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const Wi=new $i,Nt=new Ct("com.hamropatro.grpc.cms.FileService",[{name:"createFile",options:{},I:nn,O:se},{name:"updateFile",options:{},I:se,O:se},{name:"deleteFile",options:{},I:sn,O:Vi},{name:"getFilesByFolder",options:{},I:on,O:Wi},{name:"createUserFile",options:{},I:rn,O:se},{name:"search",options:{},I:tn,O:_i}]);class Se{constructor(e){U(this,"typeName",Nt.typeName);U(this,"methods",Nt.methods);U(this,"options",Nt.options);this._transport=e}createFile(e,t){const n=this.methods[0],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}updateFile(e,t){const n=this.methods[1],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}deleteFile(e,t){const n=this.methods[2],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}getFilesByFolder(e,t){const n=this.methods[3],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}createUserFile(e,t){const n=this.methods[4],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}search(e,t){const n=this.methods[5],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}}const ji=async(i,e,t,n,r,s)=>{var o;try{const a=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,l=new Se(a),c=nn.create();return c.name=i,c.nestedFolderName=e,c.url=t,c.type=n,c.folderName=r,await l.createFile(c,s)}catch(a){throw a}},Zi=async(i,e,t)=>{var n;try{const r=(n=window.ImageSalonSDK)==null?void 0:n.grpcConfig,s=new Se(r),o=rn.create();return o.url=i,o.type=e,await s.createUserFile(o,t)}catch(r){throw r}},qi=async(i,e,t,n)=>{var r;try{const s=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,o=new Se(s),a=on.create();return a.folderName=i,a.cursor=e,a.limit=t,await o.getFilesByFolder(a,n)}catch(s){throw s}},Pi=async(i,e,t=20,n)=>{var r;try{const s=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,o=new Se(s),a=tn.create();return a.searchValue=i,a.cursor=e,a.limit=t,await o.search(a,n)}catch(s){throw s}},Ki=async(i,e,t,n,r,s,o,a,l)=>{var c;try{const h=(c=window.ImageSalonSDK)==null?void 0:c.grpcConfig,g=new Se(h),w=se.create();return w.key=i,w.name=e,w.nestedFolderName=t,w.url=n,w.thumborUrl=r,w.proxyUrl=s,w.type=o,w.folderName=a,await g.updateFile(w,l)}catch(h){throw h}},Xi=async(i,e)=>{var t;try{const n=(t=window.ImageSalonSDK)==null?void 0:t.grpcConfig,r=new Se(n),s=sn.create();return s.key=i,await r.deleteFile(s,e)}catch(n){throw n}};class zi extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.key=e.string();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,m.LengthDelimited).string(e.key);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const an=new zi;class Gi extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.name=e.string();break;case 2:s.nestedFolderName=e.string();break;case 3:s.createdBy=e.string();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.name!==""&&t.tag(1,m.LengthDelimited).string(e.name),e.nestedFolderName!==""&&t.tag(2,m.LengthDelimited).string(e.nestedFolderName),e.createdBy!==""&&t.tag(3,m.LengthDelimited).string(e.createdBy);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const ln=new Gi;class Ji extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.cursor=e.string();break;case 2:s.limit=e.int32();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.cursor!==""&&t.tag(1,m.LengthDelimited).string(e.cursor),e.limit!==0&&t.tag(2,m.Varint).int32(e.limit);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const cn=new Ji;class Yi extends Z{constructor(){super("com.hamropatro.grpc.cms.GetAllFoldersResponse",[{no:1,name:"folder",kind:"message",repeat:1,T:()=>Ne},{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.folder.push(Ne.internalBinaryRead(e,e.uint32(),n));break;case 2:s.nextCursor=e.string();break;case 3:s.hasMore=e.bool();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){for(let s=0;s<e.folder.length;s++)Ne.internalBinaryWrite(e.folder[s],t.tag(1,m.LengthDelimited).fork(),n).join();e.nextCursor!==""&&t.tag(2,m.LengthDelimited).string(e.nextCursor),e.hasMore!==!1&&t.tag(3,m.Varint).bool(e.hasMore);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const Qi=new Yi;class er extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){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 c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,m.LengthDelimited).string(e.key),e.name!==""&&t.tag(2,m.LengthDelimited).string(e.name),e.nestedFolderName!==""&&t.tag(3,m.LengthDelimited).string(e.nestedFolderName),e.createdBy!==""&&t.tag(4,m.LengthDelimited).string(e.createdBy);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const Ne=new er,Ft=new Ct("com.hamropatro.grpc.cms.FolderService",[{name:"createFolder",options:{},I:ln,O:Ne},{name:"getFolders",options:{},I:cn,O:Qi},{name:"updateFolder",options:{},I:Ne,O:Ne},{name:"deleteFolder",options:{},I:an,O:Ne}]);class dt{constructor(e){U(this,"typeName",Ft.typeName);U(this,"methods",Ft.methods);U(this,"options",Ft.options);this._transport=e}createFolder(e,t){const n=this.methods[0],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}getFolders(e,t){const n=this.methods[1],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}updateFolder(e,t){const n=this.methods[2],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}deleteFolder(e,t){const n=this.methods[3],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}}const tr=async(i,e=20,t)=>{var o;const n=(o=window.ImageSalonSDK)==null?void 0:o.grpcConfig,r=new dt(n),s=cn.create();try{return s.cursor=i,s.limit=e,await r.getFolders(s,t)}catch(a){throw a}},nr=async(i,e,t,n)=>{var r;try{const s=(r=window.ImageSalonSDK)==null?void 0:r.grpcConfig,o=new dt(s),a=ln.create();return a.name=i,a.nestedFolderName=e,a.createdBy=t,await o.createFolder(a,n)}catch(s){throw s}},ir=async(i,e,t,n,r)=>{var s;try{const o=(s=window.ImageSalonSDK)==null?void 0:s.grpcConfig,a=new dt(o),l=Ne.create();return l.name=e,l.key=i,l.nestedFolderName=t,l.createdBy=n,await a.updateFolder(l,r)}catch(o){throw o}},rr=async(i,e)=>{var t;try{const n=(t=window.ImageSalonSDK)==null?void 0:t.grpcConfig,r=new dt(n),s=an.create();return s.key=i,await r.deleteFolder(s,e)}catch(n){throw n}},Lt=(i,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",i||"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 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 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(s),n.appendChild(o),n};function dn(){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("height","24px"),i.setAttribute("width","24px"),i.setAttribute("viewBox","0 -960 960 960"),i.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"),i.appendChild(e),i}function sr(){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("width","12"),i.setAttribute("height","12"),i.setAttribute("viewBox","0 0 24 24"),i.setAttribute("fill","none"),i.setAttribute("stroke","currentColor"),i.setAttribute("stroke-width","2"),i.setAttribute("stroke-linecap","round"),i.setAttribute("stroke-linejoin","round"),i.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"),i.appendChild(e),i.appendChild(t),i.appendChild(n),i.appendChild(r),document.body.appendChild(i),i}const or=()=>{const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("width","20"),i.setAttribute("height","20"),i.setAttribute("viewBox","0 0 24 24"),i.setAttribute("fill","none"),i.setAttribute("stroke","currentColor"),i.setAttribute("stroke-width","2"),i.setAttribute("stroke-linecap","round"),i.setAttribute("stroke-linejoin","round"),i.classList.add("lucide","lucide-circle-check-big");const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("d","M21.801 10A10 10 0 1 1 17 3.335");const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d","m9 11 3 3L22 4"),i.appendChild(e),i.appendChild(t),i};function At(i="#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",i);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 hn(){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("width","16"),i.setAttribute("height","16"),i.setAttribute("viewBox","0 0 24 24"),i.setAttribute("fill","none"),i.setAttribute("stroke","#2c96f8"),i.setAttribute("stroke-width","2"),i.setAttribute("stroke-linecap","round"),i.setAttribute("stroke-linejoin","round"),i.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"),i.appendChild(e),i.appendChild(t),document.body.appendChild(i),i}function Xe(){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/folder"),i.setAttribute("x","0px"),i.setAttribute("y","0px"),i.setAttribute("width","24"),i.setAttribute("height","24"),i.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"),i.appendChild(e),i.appendChild(t),i}function ar(){const i="http://www.w3.org/2000/svg",e=document.createElementNS(i,"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(i,"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(i,"circle");n.setAttribute("cx","9"),n.setAttribute("cy","9"),n.setAttribute("r","2");const r=document.createElementNS(i,"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 lr(){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("height","24px"),i.setAttribute("viewBox","0 -960 960 960"),i.setAttribute("width","24px"),i.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"),i.appendChild(e),i}function un(){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("fill","none"),i.setAttribute("width","20"),i.setAttribute("height","20"),i.setAttribute("viewBox","0 0 24 24"),i.setAttribute("stroke-width","1.5"),i.setAttribute("stroke","currentColor"),i.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"),i.appendChild(e),i}function cr(){const i="http://www.w3.org/2000/svg",e=document.createElementNS(i,"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(i,"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(i,"circle");return n.setAttribute("cx","12"),n.setAttribute("cy","12"),n.setAttribute("r","3"),e.appendChild(n),document.body.appendChild(e),e}function dr(){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("height","24px"),i.setAttribute("width","24px"),i.setAttribute("viewBox","0 0 30 30"),i.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"),i.appendChild(e),i}function pn(){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("width","16"),i.setAttribute("height","16"),i.setAttribute("viewBox","0 0 24 24"),i.setAttribute("fill","none"),i.setAttribute("stroke","#f14b4b"),i.setAttribute("stroke-width","2"),i.setAttribute("stroke-linecap","round"),i.setAttribute("stroke-linejoin","round"),i.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 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"),i.appendChild(e),i.appendChild(t),i.appendChild(n),i.appendChild(r),i.appendChild(s),document.body.appendChild(i),i}function It(){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("width","24"),i.setAttribute("height","24"),i.setAttribute("viewBox","0 0 24 24"),i.setAttribute("fill","none"),i.setAttribute("stroke","currentColor"),i.setAttribute("stroke-width","2"),i.setAttribute("stroke-linecap","round"),i.setAttribute("stroke-linejoin","round"),i.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"),i.appendChild(e),i.appendChild(t),i.appendChild(n),i}function hr(){const i="http://www.w3.org/2000/svg",e=document.createElementNS(i,"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(i,"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(i,"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 F(i,e,t,n,r){let s=document.createElement(i);return e&&(s.className+=e),t&&(s.style.cssText=t),n&&(s.textContent=n),r&&r.appendChild(s),s}class ur{constructor(){C(this,ge);C(this,oe);C(this,Re,"#fff");p(this,ge,document.createElementNS("http://www.w3.org/2000/svg","svg")),d(this,ge).setAttribute("viewBox","25 25 50 50"),d(this,ge).classList.add("loader-svg"),p(this,oe,document.createElementNS("http://www.w3.org/2000/svg","circle")),d(this,oe).setAttribute("r","20"),d(this,oe).setAttribute("cy","50"),d(this,oe).setAttribute("cx","50"),d(this,oe).setAttribute("stroke",d(this,Re)),d(this,oe).classList.add("loader-circle"),d(this,ge).appendChild(d(this,oe))}show(e,t){t&&(p(this,Re,t),d(this,oe).setAttribute("stroke",d(this,Re))),e.appendChild(d(this,ge))}hide(){d(this,ge).remove()}}ge=new WeakMap,oe=new WeakMap,Re=new WeakMap;const fn=new ur,ht=document.body;class mn{constructor(){U(this,"main");U(this,"dialogContainer");U(this,"dialog");U(this,"dialogBackdrop");U(this,"dialogContent");U(this,"dialogHeader");U(this,"dialogBody");U(this,"dialogFooter");U(this,"confirmButton");U(this,"cancelButton");U(this,"confirmCallback");U(this,"cancelCallback");this.main=F("div"),this.dialog=F("div"),this.confirmCallback=void 0,this.cancelCallback=void 0}_init(e){this.main=F("div","dialog-presentation","","",ht),this.main.setAttribute("role","presentation"),this.dialogContainer=F("div","dialog-container","","",this.main),this.dialogBackdrop=F("div","dialog-backdrop","","",this.dialogContainer),this.dialog=F("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=F("div","dialog-content","","",this.dialog),e!=null&&e.dialogContentStyle&&Object.assign(this.dialogContent.style,e.dialogContentStyle),this.confirmButton=F("button","dialog-btn confirm","","",this.dialogFooter),this.confirmButton.type="button",this.cancelButton=F("button","dialog-btn cancel","","",this.dialogFooter),this.cancelButton.type="button",e.showCloseBtn){const n=F("button","dialog-close-btn","","",this.dialogContent);n.appendChild(At()),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",ht.style.overflow="hidden",this.confirmButton.textContent=e.confirmButtonText||"Upload",this.cancelButton.textContent=e.cancelButtonText||"Cancel",ht.classList.add("dialog-visible"),new Promise(n=>{const r=s=>()=>{this.hide(),n(s==="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=F("div","dialog-header","","",this.dialogContent),!e.header)this.dialogHeader.innerHTML="";else if(typeof e.header=="string"){const t=F("h4","dialog-header-text","","",this.dialogHeader);t.textContent=e.header}else this.dialogHeader.innerHTML="",this.dialogHeader.appendChild(e.header)}_setBody(e){this.dialogBody=F("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=F("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||ht.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?(fn.show(this.confirmButton),this.confirmButton.disabled=!0):(fn.hide(),this.confirmButton.disabled=!1)}}const ut=new mn,M=new mn;class pr{constructor(){U(this,"main");U(this,"dialogBody");this.main=F("div"),this.dialogBody=F("div"),this.hide()}show(e){this.main=F("div","popover","","",e.mainContainer),this.dialogBody=F("div","popover-body","","",this.main),this.main.id=e.divId,this.dialogBody.append(e.content)}hide(){this.main.remove()}}const te=new pr;var he=(i=>(i[i.IMAGE=0]="IMAGE",i[i.AUDIO=1]="AUDIO",i[i.VIDEO=2]="VIDEO",i[i.ALL=3]="ALL",i[i.FOLDER=4]="FOLDER",i))(he||{});const ze={0:"IMAGE",1:"AUDIO",2:"VIDEO",3:"ALL",4:"FOLDER"};function gn(i){switch(i){case"image":return ze[he.IMAGE];case"video":return ze[he.VIDEO];case"audio":return ze[he.AUDIO];default:return ze[he.ALL]}}function fr(i){const e={};i.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 i.reduce((r,s)=>(s.nestedFolderName||r.push(t(e[s.key])),r),[])}function mr(i,e){const t=n=>{if(n.key===e.nestedFolderName)return n.children[e.key]={...e,children:{}},!0;for(const r in n.children){const s=n.children[r];if(t(s))return!0}return!1};for(const n of i)if(t(n))break;return i}const gr=async(i,e)=>{let t;try{i&&(t={Authorization:i,"app-id":e==="production"?"hamropatro":"hamropatro-android"})}catch(r){if(r)throw r}return{meta:t}};function y(i,e){const t=document.createElement("div");return i&&(t.className=i),e&&(t.id=e),t}function Ge(i,e,t){const n=document.createElement("p");return e&&(n.className=e),t&&(n.id=t),i&&(n.textContent=i),n}function T(i,e){const t=document.createElement("span");return e&&(t.className=e),i&&(t.textContent=i),t}function wn(i,e,t,n){const r=document.createElement("img");return e&&(r.className=e),r.src=i,r}function wr(i,e,t){const n=document.createElement("video"),r=document.createElement("source");return n.className=e,r.src=i,n.appendChild(r),n}function yr(i,e,t){const n=document.createElement("audio"),r=document.createElement("source");return n.className=e,n.controls=!0,r.src=i,n.appendChild(r),n}function Y(i,e,t,n,r){const s=document.createElement("button");return e&&(s.className=e),t&&(s.id=t),i&&(s.textContent=i),r&&(s.innerHTML=r),s.disabled=n,s}function Tt(i,e,t){const n=document.createElement("input");return n.className=e,n.defaultValue=t,i&&(n.type=i),n}class br extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.mimeType=e.string();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.mimeType!==""&&t.tag(1,m.LengthDelimited).string(e.mimeType);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const yn=new br;class Cr extends Z{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&&$(this,t,e),t}internalBinaryRead(e,t,n,r){let s=r??this.create(),o=e.pos+t;for(;e.pos<o;){let[a,l]=e.tag();switch(a){case 1:s.key=e.string();break;case 2:s.url=e.string();break;default:let c=n.readUnknownField;if(c==="throw")throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);let h=e.skip(l);c!==!1&&(c===!0?k.onRead:c)(this.typeName,s,a,l,h)}}return s}internalBinaryWrite(e,t,n){e.key!==""&&t.tag(1,m.LengthDelimited).string(e.key),e.url!==""&&t.tag(2,m.LengthDelimited).string(e.url);let r=n.writeUnknownFields;return r!==!1&&(r==!0?k.onWrite:r)(this.typeName,e,t),t}}const Er=new Cr,vt=new Ct("com.hamropatro.grpc.cms.ImageUploadService",[{name:"Upload",options:{},I:yn,O:Er}]);class kr{constructor(e){U(this,"typeName",vt.typeName);U(this,"methods",vt.methods);U(this,"options",vt.options);this._transport=e}upload(e,t){const n=this.methods[0],r=this._transport.mergeOptions(t);return ie("unary",this._transport,n,r,e)}}const Nr=async(i,e)=>{var s;const t=(s=window.ImageSalonSDK)==null?void 0:s.grpcConfig,n=new kr(t),r=yn.create();try{return r.mimeType=i,await n.upload(r,e)}catch(o){throw o}},bn=async(i,e,t)=>{try{const n=Fr(i,e),s=(await Nr(e==null?void 0:e.type,t)).response.url;return await fetch(s,{method:"PUT",headers:{"Content-Type":e==null?void 0:e.type,"x-amz-acl":"public-read"},body:n}),s==null?void 0:s.split("?")[0]}catch(n){throw n}},Fr=(i,e)=>{const t=e.type.split("/")[0];let n="";t==="video"?n=i==null?void 0:i.replace(/^data:video\/\w+;base64,/,""):t==="image"?n=i==null?void 0:i.replace(/^data:image\/\w+;base64,/,""):t==="audio"&&(n=i==null?void 0:i.replace(/^data:audio\/\w+;base64,/,""));const r=atob(n),s=new Uint8Array(r.length);for(let o=0;o<r.length;o++)s[o]=r.charCodeAt(o);return s};class Lr{constructor(e){C(this,Fe);C(this,W);C(this,V);C(this,we);C(this,D,[]);C(this,j,[]);C(this,ue);C(this,Q);C(this,Oe);C(this,ye);C(this,pe,[]);C(this,ae);C(this,Le);C(this,Me);C(this,Ae);C(this,Ie);C(this,be);C(this,Ue);C(this,fe);C(this,me);C(this,Te);C(this,ve);C(this,Ce);C(this,Ve);C(this,Je);C(this,z);C(this,Ee);C(this,Ye,!1);C(this,pt);C(this,Qe);C(this,q);C(this,He);C(this,Be);C(this,et);C(this,$e);C(this,We);C(this,je);p(this,Qe,e.isAdmin),p(this,ue,!1),p(this,Me,e.handleUpload.bind(this)),p(this,Je,e.accessToken),this._grpcOptionInitializer(),this._init(e).then(()=>{p(this,Ye,!0),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){return this._isAdminOptions(e)?(p(this,Q,!1),p(this,Oe,!1),p(this,Ae,0),p(this,me,""),p(this,Ce,!1),p(this,et,e.mode),p(this,Te,!1),p(this,Be,""),p(this,Ee,null),this._removeToastContainer(),this._renderAdminView(e)):(p(this,He,""),p(this,ye,e==null?void 0:e.folderName),p(this,$e,e.restrictedFileSize),p(this,We,e==null?void 0:e.localizedFileRestrictedMessage),p(this,je,e==null?void 0:e.localizedErrorMessage),this._removeUserToast(),this._renderUserView(e))}_renderAdminView(e){if(!d(this,Ye))return;const{parentContainerId:t}=e;if(e.isAdmin===!0)var{buttonProps:n}=e;p(this,Fe,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 s=document.createElement("span");s.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(s,o),n!=null&&n.buttonStyle&&Object.assign(r.style,n==null?void 0:n.buttonStyle),r.addEventListener("click",()=>{this._selectedImageContainer()}),d(this,Fe).appendChild(r)}async _grpcOptionInitializer(){p(this,z,await gr(d(this,Je),d(this,et)))}_selectedImageContainer(){var g;p(this,Le,Y(`Save (${(g=d(this,D))==null?void 0:g.length})`,"dialog-btn confirm")),p(this,Ie,y("folder-container")),p(this,be,y("folder-list-wrapper")),this._fetchAllFolders();const e=Y("Cancel","dialog-btn cancel");Y("","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",()=>{ut.hide(),p(this,D,[]),p(this,j,[])}),p(this,W,y("browse-container"));const n=y();n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="space-between",n.style.padding="10px 20px";const r=Ge("Folders","folder-title"),s=Y("","add-folder-btn");s.append(un()),this._createUpdateFolderDialog(s,"create"),n.append(r,s),d(this,Ie).append(n,d(this,be));const o=this._renderSearchField(),a=this._createBrowseMoreContainer(),l=this._createBrowseImageMain(),c=y("footer");e.onclick=()=>{ut.hide(),p(this,j,[]),p(this,D,[])},d(this,Le).onclick=()=>{d(this,Me).call(this),ut.hide(),p(this,D,[]),p(this,j,[])},c.append(e,d(this,Le));const h=y("container-right-main");h.append(o,a,l,c),d(this,W).append(d(this,Ie),h),ut.show({content:d(this,W)})}_renderUserView(e){const{parentContainerId:t,restrictedFileSize:n,imagePreview:r}=e;p(this,Fe,document.getElementById(t)),p(this,q,F("div","user-view-container"));const s=y("user-view-browse-wrapper"),o=F("span","","","Drag & Drop or "),a=this._renderUserViewBrowseButton(),l=F("p","","margin-block: 0px; font-size:14px");if(l.append(o,a),n){const c=F("p","","margin-block: 0px; font-size: 13px; color: #777",`Max File size: ${n}MB`);s.append(It(),l,c)}else s.append(It(),l);return this._setupDragAndDrop(d(this,q)),d(this,q).append(s),r&&this._renderImagePreview(r),d(this,Fe).appendChild(d(this,q)),d(this,Fe)}_setupDragAndDrop(e){if(!e)return;["dragenter","dragover","dragleave","drop"].forEach(n=>{d(this,q).addEventListener(n,r=>{r.preventDefault(),r.stopPropagation()},!1)}),["dragenter","dragover"].forEach(n=>{d(this,q).addEventListener(n,()=>{d(this,q).classList.add("highlight")},!1)}),["dragleave","drop"].forEach(n=>{d(this,q).addEventListener(n,()=>{d(this,q).classList.remove("highlight")},!1)}),d(this,q).addEventListener("drop",n=>{var s;let r=(s=n.dataTransfer)==null?void 0:s.files[0];r&&this._handleDroppedFile(r)},!1)}_renderImagePreview(e,t){var l;const n=document.getElementById("user-image-preview");n&&n.remove();const r=F("div","user-image-preview");r.id="user-image-preview";const s=F("img","","max-width: 230px;max-height:250px;object-fit:cover;");s.src=e,s.alt=t||"";const o=F("div","","width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; padding: 4px; position: absolute; top: -10px; right: -10px; background: #c10007; border-radius: 50%;z-index:1"),a=At();a.style.fill="#fff",o==null||o.appendChild(a),o.addEventListener("click",()=>{var c;(c=d(this,q))==null||c.removeChild(r),this._removeUserToast()}),r==null||r.append(s,o),(l=d(this,q))==null||l.append(r)}_handleDroppedFile(e){this._readFileAsBase64(e)}_readFileAsBase64(e){const t=d(this,$e)*1024*1024;if(e.size>t){this._renderUserToast(d(this,We)?d(this,We):`File size must be less than ${d(this,$e)}MB.`);return}this._removeUserToast();const n=new FileReader;n.readAsDataURL(e),n.onload=()=>{this._userViewUploadAndAddSelectedImageList(n.result,e)},n.onerror=()=>{console.error("Error reading file:",n.error)}}_renderUserToast(e){const t=F("div","","display:flex;align-items:center;gap:5px;");t.id="user-toast-container";const n=F("p","","color:#ee3f3f;margin-block:0px;font-size:14px;padding-top:3px");n.textContent=e;const r=Lt();r.style.width="15px",r.style.height="15px",t.append(r,n),d(this,q).firstChild.appendChild(t)}_removeUserToast(){const e=document.getElementById("user-toast-container");e&&e.remove()}_renderUserViewBrowseButton(){const e=Tt("file");e.style.display="none",e.setAttribute("multiple","true"),e.setAttribute("accept","image/*");const t=F("a","user-upload-btn","","Click to upload");return t.classList.add("user-upload-btn"),t.role="button",t.addEventListener("click",()=>e.click()),e.addEventListener("change",()=>{const n=e.files[0];n&&this._readFileAsBase64(n),e.value=""}),t}_renderUserUploading(){const e=F("div","","margin-top:10px;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=F("div","linear-loader");e.appendChild(t),d(this,q).append(e)}_removeUserUploading(){const e=document.getElementById("user-uploading");e&&e.remove()}async _userViewUploadAndAddSelectedImageList(e,t){p(this,ue,!0),this._renderUserUploading();try{this._renderImagePreview(e,t.name);const n=await bn(e,t,d(this,z));await this._uploadForUser(n,t)}catch{this._renderUserToast(d(this,je)?d(this,je):"Error uploading. Please try again later.")}finally{p(this,ue,!1),this._removeUserUploading()}}async _uploadForUser(e,t){var n;try{const r=await Zi(e,he[gn((n=t.type)==null?void 0:n.split("/")[0])],d(this,z));p(this,He,r==null?void 0:r.response),d(this,Me).call(this)}catch(r){throw Error(r)}}_createAllAndSelectedTab(e){const t=y("select-options"),n=Ge("Browse","select"),r=Ge("Selected","select","selected-images-tab");n.classList.add("selected"),[n,r].forEach((o,a)=>{o.addEventListener("click",()=>{var l;p(this,Ae,a),(l=document.querySelector(".select.selected"))==null||l.classList.remove("selected"),o.classList.add("selected"),this._updateSelectedImageListContainerUI()})}),t.append(n,r),e.appendChild(t)}_renderUploadButton(){const e=Tt("file");e.style.display="none",e.setAttribute("multiple","true"),e.setAttribute("accept","image/*,video/*,audio/*,.gif"),p(this,we,document.createElement("button")),d(this,we).className="browse-more-btn";const t=document.createElement("span");return t.textContent="Upload",d(this,we).append(It(),t),d(this,we).type="button",d(this,we).addEventListener("click",()=>e.click()),e.addEventListener("change",()=>{const n=e.files;Object.values(n).forEach(r=>{const s=new FileReader;s.readAsDataURL(r),s.onload=async()=>{await this._uploadAndAddSelectedImageList(s.result,r)}}),e.value=""}),d(this,we)}_renderCreateFolderBtn(){const e=document.createElement("button");e.className="create-folder-btn";const t=document.createElement("span");return t.textContent="Create",e.append(un(),t),this._createUpdateFolderDialog(e,"create"),e}_renderSearchField(){let e;const t=y("search-browse-container"),n=y("search-input-wrapper","search-input-wrapper");p(this,ve,Tt("search")),d(this,ve).value="",d(this,ve).addEventListener("input",s=>{p(this,j,[]);const o=s.target;e&&clearTimeout(e),e=setTimeout(()=>{if(!o.value){p(this,me,""),p(this,Te,!1),p(this,Ce,!1),this._fetchFilesFromFolder(d(this,ye));return}p(this,Ce,!0),p(this,Ve,o.value),this._search(d(this,Ve))},750)}),d(this,ve).setAttribute("placeholder","Search");const r=dr();return r.style.position="absolute",r.style.top="50%",r.style.left="5%",r.style.transform="translate(-5%, -50%)",n.append(r,d(this,ve)),t.append(n),t}_createBrowseMoreContainer(){p(this,Ue,y("browse-more-btn-container")),this._createAllAndSelectedTab(d(this,Ue));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),d(this,Ue).appendChild(n),d(this,Ue)}_createBrowseImageMain(){const e=y("browse-image-main");return p(this,V,y("selected-image-container")),d(this,V).addEventListener("scroll",()=>{const t=d(this,V).clientHeight,n=d(this,V).scrollTop,r=d(this,V).scrollHeight;t+n>=r-5&&d(this,Te)&&(d(this,Ce)?this._search(d(this,Ve)):this._fetchFilesFromFolder(d(this,ye)))}),e.appendChild(d(this,V)),e}_renderFetchingSkeletonUI(){for(let e=0;e<20;e++){const t=y("skeleton");t.innerHTML="",d(this,V).append(t)}}_renderEmptyImageContainer(){if(d(this,Q)||d(this,ue))return;const e=y(),t=y(),n=document.createElement("p");d(this,Ce)&&d(this,Ae)===0?(t.innerHTML=`
6
6
  <svg width="300" height="300" viewBox="0 0 1000 1000" fill="none" xmlns="http://www.w3.org/2000/svg">
7
7
  <g clip-path="url(#clip0_2304_257)">
8
8
  <path d="M564.829 772.4H336.658V948.386H564.829V772.4Z" fill="#EBEBEB"/>
@@ -86,4 +86,4 @@ import './style.css';
86
86
  </clipPath>
87
87
  </defs>
88
88
  </svg>
89
- `,n.textContent="Looks Empty!"),e.append(t,n),d(this,V).appendChild(e)}_renderLoadingUI(){const e=y("skeleton");e.innerHTML="",d(this,V).appendChild(e)}_fileCardBody(e){var Mn,Vn,Hn,$n;const t=y("selected-image-content"),n=y("selected-image-top-bar"),r=Y("","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,o;(e==null?void 0:e.type)===he.IMAGE&&(s=wn(e==null?void 0:e.url,"selected-image"),o=ar()),(e==null?void 0:e.type)===he.VIDEO&&(s=wr(e==null?void 0:e.url,"uploaded-video"),o=hr()),(e==null?void 0:e.type)===he.AUDIO&&(s=yr(e==null?void 0:e.url,"uploaded-audio"),o=sr());const a=y("selected-image-wrapper");a.setAttribute("data-key",e==null?void 0:e.key);const l=Ge(e==null?void 0:e.name,"selected-image-name"),c=T("","selected-image-type");c.append(o),n.append(c,r);const h=y();h.style.marginTop="10px",h.style.display="flex",h.style.justifyContent="space-between",h.style.alignItems="center",h.append(l),t.append(n,s),a.append(t,h);const g=y("action-wrapper"),w=Y("","action-option preview"),v=T("Preview",""),O=cr();w.append(O,v);const P=Y("","action-option move"),B=T("Move",""),K=lr();P.append(K,B);const z=Y("","action-option rename"),le=T("Rename",""),E=hn();z.append(E,le);const b=Y("","action-option delete"),H=T("Delete",""),G=pn();b.append(G,H);const ce=e.name.split(".")[0],Ar=e.name.split(".")[1],Ir=ze[e.type],Cn=y("edit-form-wrapper"),En=y("move-form-wrapper"),kn=y("preview-details-container"),Nn=y("preview-details-wrapper"),Fn=y("preview-option-image-wrapper"),Ln=y("preview-option-wrapper"),An=y("preview-option-wrapper"),In=y("preview-option-wrapper"),Tn=y("preview-option-wrapper"),vn=y("preview-option-wrapper"),Bn=y("preview-option-wrapper"),xn=y("preview-option-wrapper"),Tr=wn(e.url,"preview-option-image");Fn.append(Tr);const vr=T("File name","preview-title"),_n=y("preview-option-name");_n.innerHTML=e.name,Ln.append(vr,_n);const Br=T("Folder name","preview-title"),xr=T(e.folderName,"preview-option-name");An.append(Br,xr);const _r=T("File Extension","preview-title"),Or=T(Ar,"preview-option-name extension");In.append(_r,Or);const Ur=T("File type","preview-title"),Dr=T(Ir,"preview-option-name");Tn.append(Ur,Dr);const Sr=T("Dimension","preview-title"),Rr=T(`${(Mn=e==null?void 0:e.metadata)==null?void 0:Mn.width} * ${(Vn=e==null?void 0:e.metadata)==null?void 0:Vn.height}`,"preview-option-name");vn.append(Sr,Rr);const Mr=T("URL","preview-title"),Vr=T(e.url,"preview-option-name url");Bn.append(Mr,Vr);const Hr=T("Parent folder","preview-title"),$r=T(e.nestedFolderName,"preview-option-name");xn.append(Hr,$r),Nn.append(An,Ln,In,Tn,((Hn=e==null?void 0:e.metadata)==null?void 0:Hn.width)>0&&(($n=e==null?void 0:e.metadata)==null?void 0:$n.height)>0?vn:"",Bn,e.nestedFolderName?xn:""),kn.append(Fn,Nn);const On=y("form-control"),ft=document.createElement("input");On.appendChild(ft),ft.classList.add("input-field"),ft.value=e.name;const Un=y("form-control"),Wr=T("Current Folder:","input-label"),Bt=y("folder-field current");Bt.textContent=e.folderName,Bt.prepend(Xe()),Un.append(Wr,Bt);const Dn=y("form-control"),Ze=y();Ze.style.width="100%",Ze.style.display="flex",Ze.style.alignItems="center",Ze.style.justifyContent="space-between";const jr=T("Suggested Folder List:","input-label"),De=T();De.style.display="flex",De.style.alignItems="center",De.style.gap="5px",De.style.fontSize="14px",De.textContent="Move the file in selected folder",De.appendChild(Lt("14px","14px","#333")),Ze.append(jr,De);const tt=y();tt.style.width="100%",tt.style.maxHeight="250px",tt.style.overflowY="auto";const xt=document.createElement("ul");xt.className="folders",tt.append(xt),Dn.append(Ze,tt),d(this,pe).forEach(S=>{const Pe=this._renderEditFolderListContainer(S);xt.appendChild(Pe)});const Sn=y("form-control"),Zr=T("Destination Folder:","input-label"),Rn=y("folder-field source","source-folder-wrapper"),_t=document.createElement("span");_t.id="source-folder-name",_t.textContent=d(this,Be)?d(this,Be):e.folderName,Rn.append(Xe(),_t);let qe="";Sn.append(Zr,Rn),ft.onchange=S=>{qe=S.target.value},qe=qe!==""?qe:e.name,Cn.append(On),En.append(Un,Dn,Sn),g.append(w,P,z,b),w.onclick=S=>{S.stopPropagation(),te.hide(),M.show({content:kn,header:ce,dialogContentStyle:{minWidth:"60rem",padding:"10px"},showCloseBtn:!0})},P.onclick=S=>{S.stopPropagation(),te.hide(),M.show({content:En,header:`Move "${e.name}"`,confirmButtonText:"Move",dialogContentStyle:{minWidth:"35rem",padding:"10px"},showCloseBtn:!0,showFooter:!0,onCancel:()=>{M.hide()},onConfirm:()=>{this._updateFile(qe,e)}})},z.onclick=S=>{S.stopPropagation(),te.hide(),M.show({content:Cn,header:"Rename",confirmButtonText:"Update",dialogContentStyle:{padding:"10px"},showCloseBtn:!0,showFooter:!0,onCancel:()=>{M.hide()},onConfirm:()=>{this._updateFile(qe,e)}})},b.onclick=S=>{S.stopPropagation(),te.hide(),M.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",S=>{S.stopPropagation(),te.hide(),te.show({content:g,mainContainer:n,divId:e.key}),p(this,Ee,e.key)}),s.addEventListener("click",()=>{const S=d(this,D).findIndex(xe=>(xe==null?void 0:xe.key)===(e==null?void 0:e.key));if(t.classList.contains("checked"))t.classList.remove("checked"),S!==-1&&(d(this,D).splice(S,1),d(this,Ae)===1&&a.remove());else{if(d(this,pt))d(this,D).push(e);else{const xe=document.querySelector(".selected-image-wrapper .checked");xe==null||xe.classList.remove("checked"),p(this,D,[e])}t.classList.add("checked")}this._updateContent()}),document.addEventListener("click",S=>{const Pe=document.querySelector(`#${d(this,Ee)}`);Pe&&(S.composedPath().includes(Pe)||te.hide())}),d(this,D).findIndex(S=>(S==null?void 0:S.key)===(e==null?void 0:e.key))!==-1?(t.classList.add("checked"),d(this,Ce)?d(this,V).prepend(a):d(this,V).appendChild(a)):d(this,V).appendChild(a)}_renderImageCard(e){this._fileCardBody(e)}_renderImageListContainer(){var e,t;((e=d(this,j))==null?void 0:e.length)>0&&((t=d(this,j))==null||t.forEach(n=>{this._renderImageCard(n)}))}_renderSelectedImageListContainer(){var e;((e=d(this,D))==null?void 0:e.length)>0&&d(this,D).forEach(t=>{this._renderImageCard(t)})}_renderFolderListLoadingUI(){const e=document.createElement("div");e.style.paddingInline="20px";for(let t=0;t<4;t++){const n=y("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"),s=document.createElement("span");if(s.className="folder-name",s.textContent=e==null?void 0:e.name,r.appendChild(Xe()),n.append(r,s),t.append(n),e.children&&Object.keys(e.children).length>0){const a=document.createElement("button");a.classList.add("expand-icon"),a.appendChild(dn()),n.prepend(a);const l=document.createElement("ul");l.className="folders nested",t.appendChild(l),a.addEventListener("click",c=>{c.stopPropagation(),t.classList.toggle("active"),l.classList.toggle("visible")}),Object.values(e.children).forEach((c,h)=>{const g=this._renderFolderListContainer(c);l.appendChild(g)})}if(e.nestedFolderName){const a=Y("","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>'),l=y("action-wrapper"),c=Y("","action-option edit"),h=T("Edit",""),g=hn();c.append(g,h);const w=y("edit-form-wrapper"),v=y("name-field-wrapper"),O=T("Name","input-label"),P=document.createElement("input");P.classList.add("input-field"),P.value=e.name,P.onchange=E=>{E.target.value},v.append(O,P),w.append(v);const B={key:e.key,name:e.name,nestedFolderName:e.nestedFolderName,createdBy:e.createdBy};this._createUpdateFolderDialog(c,"update",B);const K=Y("","action-option delete"),z=T("Delete",""),le=pn();K.append(le,z),l.append(c,K),K.onclick=E=>{E.stopPropagation(),te.hide(),M.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",E=>{E.stopPropagation();const b=document.querySelector(`#${e.key}`);p(this,Ee,null),d(this,Ee)===e.key&&b!==null?te.hide():(te.hide(),te.show({content:l,mainContainer:n,divId:e.key}),p(this,Ee,e.key))}),n.appendChild(a)}return t.addEventListener("click",a=>{var l;a.stopPropagation(),p(this,ae,e),p(this,ye,e==null?void 0:e.name),p(this,D,[]),p(this,j,[]),p(this,me,""),p(this,Te,!1),(l=document.querySelector(".folder.selected"))==null||l.classList.remove("selected"),t.classList.add("selected"),this._fetchFilesFromFolder(e.name)}),((o=d(this,ae))==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"),s=document.createElement("span");if(s.className="folder-name",s.textContent=e==null?void 0:e.name,r.appendChild(Xe()),n.append(r,s),t.append(n),e.children&&Object.keys(e.children).length>0){const a=document.createElement("button");a.classList.add("expand-icon"),a.appendChild(dn()),n.prepend(a);const l=document.createElement("ul");l.className="folders nested",t.appendChild(l),a.addEventListener("click",c=>{c.stopPropagation(),t.classList.toggle("active"),l.classList.toggle("visible")}),Object.values(e.children).forEach(c=>{const h=this._renderEditFolderListContainer(c);l.appendChild(h)})}return t.addEventListener("click",a=>{var c;a.stopPropagation(),p(this,Be,e==null?void 0:e.name);const l=document.querySelector("#source-folder-name");l.textContent="",l.textContent=e==null?void 0:e.name,(c=document.querySelector(".folder-move.selected"))==null||c.classList.remove("selected"),t.classList.add("selected")}),((o=d(this,ae))==null?void 0:o.key)===(e==null?void 0:e.key)&&t.classList.add("selected"),t}_updateFolderListContainer(){if(d(this,Ie))if(d(this,be).innerHTML="",d(this,Oe)){const e=this._renderFolderListLoadingUI();d(this,be).appendChild(e)}else{const e=document.createElement("ul");e.className="folders",d(this,be).appendChild(e),d(this,pe).forEach(t=>{const n=this._renderFolderListContainer(t);e.appendChild(n)}),d(this,Ie).appendChild(d(this,be))}}_renderToastContainer(e,t,n){this._removeToastContainer(),p(this,fe,document.createElement("div")),d(this,fe).className=`message-container ${t}`;const r=Ge(e,"message"),s=t==="success"?or():Lt(),o=Y("");o.style.cursor="pointer",o.style.border="0",o.style.outline="none",o.style.background="transparent",o.appendChild(At(t==="error"?"#ee3f3f":"#4caf50")),o.setAttribute("fill",t==="error"?"#ee3f3f":"#4caf50"),o.onclick=()=>this._removeToastContainer(),d(this,fe).append(s,r,o),n.appendChild(d(this,fe)),setTimeout(()=>{this._removeToastContainer()},5e3)}_removeToastContainer(){d(this,fe)&&(d(this,fe).remove(),p(this,fe,null))}_updateSelectedImageListContainerUI(){var t,n;if(!d(this,V))return;d(this,V).innerHTML="",d(this,Q)&&this._renderFetchingSkeletonUI(),d(this,ue)&&this._renderLoadingUI();const e=document.getElementById("search-input-wrapper");d(this,Ae)===0?(e&&(e.style.visibility="visible"),((t=d(this,j))==null?void 0:t.length)===0&&!d(this,Q)?(d(this,V).classList.add("no-selected-image-container"),this._renderEmptyImageContainer()):(d(this,V).classList.remove("no-selected-image-container"),this._renderImageListContainer())):(e&&(e.style.visibility="hidden"),((n=d(this,D))==null?void 0:n.length)===0?(d(this,V).classList.add("no-selected-image-container"),this._renderEmptyImageContainer()):(d(this,V).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=d(this,D))==null?void 0:t.length})`),d(this,Le).textContent=`Save (${(n=d(this,D))==null?void 0:n.length})`,d(this,Le).disabled=((r=d(this,D))==null?void 0:r.length)===0}async _uploadAndAddSelectedImageList(e,t){var n,r;p(this,ue,!0),this._updateSelectedImageListContainerUI();try{const s=await bn(e,t),o=await ji(t==null?void 0:t.name,"",s,he[gn((n=t.type)==null?void 0:n.split("/")[0])],(r=d(this,ae))==null?void 0:r.name,d(this,J));d(this,j).unshift(o==null?void 0:o.response),this._renderToastContainer("File Uploaded Successfully","success",d(this,W))}catch{this._renderToastContainer("Something went wrong while uploading file. Please try again later.","error",d(this,W))}finally{p(this,ue,!1),this._updateSelectedImageListContainerUI()}}async _updateFile(e,t){M.updateUploadBtn(!0);try{const n=await Ki(t.key,e,t.nestedFolderName,t.url,t.thumborUrl,t.proxyUrl,t.type,d(this,Be),d(this,J)),r=d(this,j).find(s=>s.key===n.response.key);r.name=e,this._fetchFilesFromFolder(d(this,ae).name),p(this,j,[]),p(this,D,[]),this._renderToastContainer("File Updated Successfully","success",d(this,W))}catch{this._renderToastContainer("Something went wrong while updating the file. Please try again later.","error",d(this,W))}finally{M.updateUploadBtn(!1),M.hide(),this._updateSelectedImageListContainerUI()}}async _deleteFile(e){M.updateUploadBtn(!0);try{await Xi(e,d(this,J)),p(this,j,d(this,j).filter(t=>e!==t.key)),this._renderToastContainer("File Deleted Successfully","success",d(this,W))}catch{this._renderToastContainer("Something went wrong while deleting the file. Please try again later.","error",d(this,W))}finally{M.updateUploadBtn(!1),M.hide(),this._updateSelectedImageListContainerUI()}}async _createFolder(e,t=2){var n;try{const r=await nr(e,(n=d(this,ae))==null?void 0:n.name,"",d(this,J));p(this,D,[]),p(this,j,[]);const s=mr(d(this,pe),r==null?void 0:r.response);p(this,pe,s),p(this,ye,e),p(this,ae,{...r==null?void 0:r.response,children:{}}),this._fetchFilesFromFolder(e),this._renderToastContainer(`Folder ${e} created successfully`,"success",d(this,W))}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",d(this,W)),new Error(`Error creating folder "${e}". Either folder already exist or failed to create folder`)}finally{this._updateFolderListContainer()}}async _upload(){return d(this,Qe)?d(this,D):d(this,He)}async _fetchFilesFromFolder(e){var t,n,r;p(this,Q,!0),this._updateSelectedImageListContainerUI();try{const s=await qi(e,d(this,me),20,d(this,J)),o=(t=s.response)==null?void 0:t.files;d(this,j).push(...o),p(this,me,(n=s.response)==null?void 0:n.nextCursor),p(this,Te,(r=s.response)==null?void 0:r.hasMore)}catch{throw this._renderToastContainer("Error while fetching files from folder"+e,"error",d(this,W)),new Error("Something went wrong. Error while fetching files from folder"+e)}finally{p(this,Q,!1),this._updateSelectedImageListContainerUI()}}async _fetchAllFolders(){var e,t;p(this,Q,!0),p(this,Oe,!0),this._updateSelectedImageListContainerUI(),this._updateFolderListContainer(),this._removeToastContainer();try{const r=(await tr("",100,d(this,J))).response.folder,s=fr(r);p(this,ye,(e=s[0])==null?void 0:e.name),this._fetchFilesFromFolder((t=s[0])==null?void 0:t.name),p(this,ae,s[0]),p(this,pe,s)}catch{p(this,Q,!1),this._renderToastContainer("Folder not found. Please create a folder or try again later","error",d(this,W))}finally{p(this,Oe,!1),this._updateFolderListContainer()}}async _search(e){var t,n;p(this,Q,!0),this._updateSelectedImageListContainerUI(),this._removeToastContainer();try{const r=await Pi(e,d(this,me),10,d(this,J)),s=(t=r.response)==null?void 0:t.items;d(this,j).push(...s),p(this,me,(n=r.response)==null?void 0:n.nextPageCursor)}catch{this._renderToastContainer("Error while searching files","error",d(this,W))}finally{p(this,Q,!1),this._updateSelectedImageListContainerUI()}}async _updateFolder(e,t){M.updateUploadBtn(!0);try{const n=await ir(t.key,e,t.nestedFolderName,t.createdBy,d(this,J))}catch{throw this._renderToastContainer("Something went wrong while updating the folder. Please try again later.","error",d(this,W)),new Error("Error updating the folder ")}finally{M.updateUploadBtn(!1),M.hide(),this._updateFolderListContainer()}}async _deleteFolder(e){M.updateUploadBtn(!0);try{await rr(e,d(this,J)),p(this,pe,d(this,pe).filter(t=>t.key!==e)),this._renderToastContainer("Folder Deleted Successfully","success",d(this,W))}catch{throw this._renderToastContainer("Something went wrong while deleting the folder. Please try again later.","error",d(this,W)),new Error("Error deleting the folder ")}finally{M.updateUploadBtn(!1),M.hide(),this._updateFolderListContainer()}}_createUpdateFolderDialog(e,t,n){e.addEventListener("click",r=>{r.stopPropagation(),te.hide();let s;const o=y("edit-form-wrapper"),a=y("form-control"),l=T("Folder Name","input-label"),c=y();c.style.position="relative";const h=document.createElement("input");h.style.paddingLeft="40px";const g=T();g.appendChild(Xe()),g.style.position="absolute",g.style.top="50%",g.style.left="5%",g.style.transform="translate(-40%, -40%)",h.classList.add("input-field"),c.append(h,g),t==="update"&&(h.value=n.name),h.onchange=w=>{s=w.target.value},a.append(l,c),o.append(a),M.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(s):this._updateFolder(s,n),M.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 vi({baseUrl:n});this.updateWindowObject({grpcConfig:r})}}return Fe=new WeakMap,W=new WeakMap,V=new WeakMap,we=new WeakMap,D=new WeakMap,j=new WeakMap,ue=new WeakMap,Q=new WeakMap,Oe=new WeakMap,ye=new WeakMap,pe=new WeakMap,ae=new WeakMap,Le=new WeakMap,Me=new WeakMap,Ae=new WeakMap,Ie=new WeakMap,be=new WeakMap,Ue=new WeakMap,fe=new WeakMap,me=new WeakMap,Te=new WeakMap,ve=new WeakMap,Ce=new WeakMap,Ve=new WeakMap,Je=new WeakMap,J=new WeakMap,Ee=new WeakMap,Ye=new WeakMap,pt=new WeakMap,Qe=new WeakMap,q=new WeakMap,He=new WeakMap,Be=new WeakMap,et=new WeakMap,$e=new WeakMap,We=new WeakMap,je=new WeakMap,Lr});
89
+ `,n.textContent="Looks Empty!"),e.append(t,n),d(this,V).appendChild(e)}_renderLoadingUI(){const e=y("skeleton");e.innerHTML="",d(this,V).appendChild(e)}_fileCardBody(e){var Mn,Vn,Hn,$n;const t=y("selected-image-content"),n=y("selected-image-top-bar"),r=Y("","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,o;(e==null?void 0:e.type)===he.IMAGE&&(s=wn(e==null?void 0:e.url,"selected-image"),o=ar()),(e==null?void 0:e.type)===he.VIDEO&&(s=wr(e==null?void 0:e.url,"uploaded-video"),o=hr()),(e==null?void 0:e.type)===he.AUDIO&&(s=yr(e==null?void 0:e.url,"uploaded-audio"),o=sr());const a=y("selected-image-wrapper");a.setAttribute("data-key",e==null?void 0:e.key);const l=Ge(e==null?void 0:e.name,"selected-image-name"),c=T("","selected-image-type");c.append(o),n.append(c,r);const h=y();h.style.marginTop="10px",h.style.display="flex",h.style.justifyContent="space-between",h.style.alignItems="center",h.append(l),t.append(n,s),a.append(t,h);const g=y("action-wrapper"),w=Y("","action-option preview"),v=T("Preview",""),O=cr();w.append(O,v);const P=Y("","action-option move"),B=T("Move",""),K=lr();P.append(K,B);const G=Y("","action-option rename"),le=T("Rename",""),E=hn();G.append(E,le);const b=Y("","action-option delete"),H=T("Delete",""),J=pn();b.append(J,H);const ce=e.name.split(".")[0],Ar=e.name.split(".")[1],Ir=ze[e.type],Cn=y("edit-form-wrapper"),En=y("move-form-wrapper"),kn=y("preview-details-container"),Nn=y("preview-details-wrapper"),Fn=y("preview-option-image-wrapper"),Ln=y("preview-option-wrapper"),An=y("preview-option-wrapper"),In=y("preview-option-wrapper"),Tn=y("preview-option-wrapper"),vn=y("preview-option-wrapper"),Bn=y("preview-option-wrapper"),xn=y("preview-option-wrapper"),Tr=wn(e.url,"preview-option-image");Fn.append(Tr);const vr=T("File name","preview-title"),_n=y("preview-option-name");_n.innerHTML=e.name,Ln.append(vr,_n);const Br=T("Folder name","preview-title"),xr=T(e.folderName,"preview-option-name");An.append(Br,xr);const _r=T("File Extension","preview-title"),Or=T(Ar,"preview-option-name extension");In.append(_r,Or);const Ur=T("File type","preview-title"),Dr=T(Ir,"preview-option-name");Tn.append(Ur,Dr);const Sr=T("Dimension","preview-title"),Rr=T(`${(Mn=e==null?void 0:e.metadata)==null?void 0:Mn.width} * ${(Vn=e==null?void 0:e.metadata)==null?void 0:Vn.height}`,"preview-option-name");vn.append(Sr,Rr);const Mr=T("URL","preview-title"),Vr=T(e.url,"preview-option-name url");Bn.append(Mr,Vr);const Hr=T("Parent folder","preview-title"),$r=T(e.nestedFolderName,"preview-option-name");xn.append(Hr,$r),Nn.append(An,Ln,In,Tn,((Hn=e==null?void 0:e.metadata)==null?void 0:Hn.width)>0&&(($n=e==null?void 0:e.metadata)==null?void 0:$n.height)>0?vn:"",Bn,e.nestedFolderName?xn:""),kn.append(Fn,Nn);const On=y("form-control"),ft=document.createElement("input");On.appendChild(ft),ft.classList.add("input-field"),ft.value=e.name;const Un=y("form-control"),Wr=T("Current Folder:","input-label"),Bt=y("folder-field current");Bt.textContent=e.folderName,Bt.prepend(Xe()),Un.append(Wr,Bt);const Dn=y("form-control"),Ze=y();Ze.style.width="100%",Ze.style.display="flex",Ze.style.alignItems="center",Ze.style.justifyContent="space-between";const jr=T("Suggested Folder List:","input-label"),De=T();De.style.display="flex",De.style.alignItems="center",De.style.gap="5px",De.style.fontSize="14px",De.textContent="Move the file in selected folder",De.appendChild(Lt("14px","14px","#333")),Ze.append(jr,De);const tt=y();tt.style.width="100%",tt.style.maxHeight="250px",tt.style.overflowY="auto";const xt=document.createElement("ul");xt.className="folders",tt.append(xt),Dn.append(Ze,tt),d(this,pe).forEach(S=>{const Pe=this._renderEditFolderListContainer(S);xt.appendChild(Pe)});const Sn=y("form-control"),Zr=T("Destination Folder:","input-label"),Rn=y("folder-field source","source-folder-wrapper"),_t=document.createElement("span");_t.id="source-folder-name",_t.textContent=d(this,Be)?d(this,Be):e.folderName,Rn.append(Xe(),_t);let qe="";Sn.append(Zr,Rn),ft.onchange=S=>{qe=S.target.value},qe=qe!==""?qe:e.name,Cn.append(On),En.append(Un,Dn,Sn),g.append(w,P,G,b),w.onclick=S=>{S.stopPropagation(),te.hide(),M.show({content:kn,header:ce,dialogContentStyle:{minWidth:"60rem",padding:"10px"},showCloseBtn:!0})},P.onclick=S=>{S.stopPropagation(),te.hide(),M.show({content:En,header:`Move "${e.name}"`,confirmButtonText:"Move",dialogContentStyle:{minWidth:"35rem",padding:"10px"},showCloseBtn:!0,showFooter:!0,onCancel:()=>{M.hide()},onConfirm:()=>{this._updateFile(qe,e)}})},G.onclick=S=>{S.stopPropagation(),te.hide(),M.show({content:Cn,header:"Rename",confirmButtonText:"Update",dialogContentStyle:{padding:"10px"},showCloseBtn:!0,showFooter:!0,onCancel:()=>{M.hide()},onConfirm:()=>{this._updateFile(qe,e)}})},b.onclick=S=>{S.stopPropagation(),te.hide(),M.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",S=>{S.stopPropagation(),te.hide(),te.show({content:g,mainContainer:n,divId:e.key}),p(this,Ee,e.key)}),s.addEventListener("click",()=>{const S=d(this,D).findIndex(xe=>(xe==null?void 0:xe.key)===(e==null?void 0:e.key));if(t.classList.contains("checked"))t.classList.remove("checked"),S!==-1&&(d(this,D).splice(S,1),d(this,Ae)===1&&a.remove());else{if(d(this,pt))d(this,D).push(e);else{const xe=document.querySelector(".selected-image-wrapper .checked");xe==null||xe.classList.remove("checked"),p(this,D,[e])}t.classList.add("checked")}this._updateContent()}),document.addEventListener("click",S=>{const Pe=document.querySelector(`#${d(this,Ee)}`);Pe&&(S.composedPath().includes(Pe)||te.hide())}),d(this,D).findIndex(S=>(S==null?void 0:S.key)===(e==null?void 0:e.key))!==-1?(t.classList.add("checked"),d(this,Ce)?d(this,V).prepend(a):d(this,V).appendChild(a)):d(this,V).appendChild(a)}_renderImageCard(e){this._fileCardBody(e)}_renderImageListContainer(){var e,t;((e=d(this,j))==null?void 0:e.length)>0&&((t=d(this,j))==null||t.forEach(n=>{this._renderImageCard(n)}))}_renderSelectedImageListContainer(){var e;((e=d(this,D))==null?void 0:e.length)>0&&d(this,D).forEach(t=>{this._renderImageCard(t)})}_renderFolderListLoadingUI(){const e=document.createElement("div");e.style.paddingInline="20px";for(let t=0;t<4;t++){const n=y("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"),s=document.createElement("span");if(s.className="folder-name",s.textContent=e==null?void 0:e.name,r.appendChild(Xe()),n.append(r,s),t.append(n),e.children&&Object.keys(e.children).length>0){const a=document.createElement("button");a.classList.add("expand-icon"),a.appendChild(dn()),n.prepend(a);const l=document.createElement("ul");l.className="folders nested",t.appendChild(l),a.addEventListener("click",c=>{c.stopPropagation(),t.classList.toggle("active"),l.classList.toggle("visible")}),Object.values(e.children).forEach((c,h)=>{const g=this._renderFolderListContainer(c);l.appendChild(g)})}if(e.nestedFolderName){const a=Y("","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>'),l=y("action-wrapper"),c=Y("","action-option edit"),h=T("Edit",""),g=hn();c.append(g,h);const w=y("edit-form-wrapper"),v=y("name-field-wrapper"),O=T("Name","input-label"),P=document.createElement("input");P.classList.add("input-field"),P.value=e.name,P.onchange=E=>{E.target.value},v.append(O,P),w.append(v);const B={key:e.key,name:e.name,nestedFolderName:e.nestedFolderName,createdBy:e.createdBy};this._createUpdateFolderDialog(c,"update",B);const K=Y("","action-option delete"),G=T("Delete",""),le=pn();K.append(le,G),l.append(c,K),K.onclick=E=>{E.stopPropagation(),te.hide(),M.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",E=>{E.stopPropagation();const b=document.querySelector(`#${e.key}`);p(this,Ee,null),d(this,Ee)===e.key&&b!==null?te.hide():(te.hide(),te.show({content:l,mainContainer:n,divId:e.key}),p(this,Ee,e.key))}),n.appendChild(a)}return t.addEventListener("click",a=>{var l;a.stopPropagation(),p(this,ae,e),p(this,ye,e==null?void 0:e.name),p(this,D,[]),p(this,j,[]),p(this,me,""),p(this,Te,!1),(l=document.querySelector(".folder.selected"))==null||l.classList.remove("selected"),t.classList.add("selected"),this._fetchFilesFromFolder(e.name)}),((o=d(this,ae))==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"),s=document.createElement("span");if(s.className="folder-name",s.textContent=e==null?void 0:e.name,r.appendChild(Xe()),n.append(r,s),t.append(n),e.children&&Object.keys(e.children).length>0){const a=document.createElement("button");a.classList.add("expand-icon"),a.appendChild(dn()),n.prepend(a);const l=document.createElement("ul");l.className="folders nested",t.appendChild(l),a.addEventListener("click",c=>{c.stopPropagation(),t.classList.toggle("active"),l.classList.toggle("visible")}),Object.values(e.children).forEach(c=>{const h=this._renderEditFolderListContainer(c);l.appendChild(h)})}return t.addEventListener("click",a=>{var c;a.stopPropagation(),p(this,Be,e==null?void 0:e.name);const l=document.querySelector("#source-folder-name");l.textContent="",l.textContent=e==null?void 0:e.name,(c=document.querySelector(".folder-move.selected"))==null||c.classList.remove("selected"),t.classList.add("selected")}),((o=d(this,ae))==null?void 0:o.key)===(e==null?void 0:e.key)&&t.classList.add("selected"),t}_updateFolderListContainer(){if(d(this,Ie))if(d(this,be).innerHTML="",d(this,Oe)){const e=this._renderFolderListLoadingUI();d(this,be).appendChild(e)}else{const e=document.createElement("ul");e.className="folders",d(this,be).appendChild(e),d(this,pe).forEach(t=>{const n=this._renderFolderListContainer(t);e.appendChild(n)}),d(this,Ie).appendChild(d(this,be))}}_renderToastContainer(e,t,n){this._removeToastContainer(),p(this,fe,document.createElement("div")),d(this,fe).className=`message-container ${t}`;const r=Ge(e,"message"),s=t==="success"?or():Lt(),o=Y("");o.style.cursor="pointer",o.style.border="0",o.style.outline="none",o.style.background="transparent",o.appendChild(At(t==="error"?"#ee3f3f":"#4caf50")),o.setAttribute("fill",t==="error"?"#ee3f3f":"#4caf50"),o.onclick=()=>this._removeToastContainer(),d(this,fe).append(s,r,o),n.appendChild(d(this,fe)),setTimeout(()=>{this._removeToastContainer()},5e3)}_removeToastContainer(){d(this,fe)&&(d(this,fe).remove(),p(this,fe,null))}_updateSelectedImageListContainerUI(){var t,n;if(!d(this,V))return;d(this,V).innerHTML="",d(this,Q)&&this._renderFetchingSkeletonUI(),d(this,ue)&&this._renderLoadingUI();const e=document.getElementById("search-input-wrapper");d(this,Ae)===0?(e&&(e.style.visibility="visible"),((t=d(this,j))==null?void 0:t.length)===0&&!d(this,Q)?(d(this,V).classList.add("no-selected-image-container"),this._renderEmptyImageContainer()):(d(this,V).classList.remove("no-selected-image-container"),this._renderImageListContainer())):(e&&(e.style.visibility="hidden"),((n=d(this,D))==null?void 0:n.length)===0?(d(this,V).classList.add("no-selected-image-container"),this._renderEmptyImageContainer()):(d(this,V).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=d(this,D))==null?void 0:t.length})`),d(this,Le).textContent=`Save (${(n=d(this,D))==null?void 0:n.length})`,d(this,Le).disabled=((r=d(this,D))==null?void 0:r.length)===0}async _uploadAndAddSelectedImageList(e,t){var n,r;p(this,ue,!0),this._updateSelectedImageListContainerUI();try{const s=await bn(e,t,d(this,z)),o=await ji(t==null?void 0:t.name,"",s,he[gn((n=t.type)==null?void 0:n.split("/")[0])],(r=d(this,ae))==null?void 0:r.name,d(this,z));d(this,j).unshift(o==null?void 0:o.response),this._renderToastContainer("File Uploaded Successfully","success",d(this,W))}catch{this._renderToastContainer("Something went wrong while uploading file. Please try again later.","error",d(this,W))}finally{p(this,ue,!1),this._updateSelectedImageListContainerUI()}}async _updateFile(e,t){M.updateUploadBtn(!0);try{const n=await Ki(t.key,e,t.nestedFolderName,t.url,t.thumborUrl,t.proxyUrl,t.type,d(this,Be),d(this,z)),r=d(this,j).find(s=>s.key===n.response.key);r.name=e,this._fetchFilesFromFolder(d(this,ae).name),p(this,j,[]),p(this,D,[]),this._renderToastContainer("File Updated Successfully","success",d(this,W))}catch{this._renderToastContainer("Something went wrong while updating the file. Please try again later.","error",d(this,W))}finally{M.updateUploadBtn(!1),M.hide(),this._updateSelectedImageListContainerUI()}}async _deleteFile(e){M.updateUploadBtn(!0);try{await Xi(e,d(this,z)),p(this,j,d(this,j).filter(t=>e!==t.key)),this._renderToastContainer("File Deleted Successfully","success",d(this,W))}catch{this._renderToastContainer("Something went wrong while deleting the file. Please try again later.","error",d(this,W))}finally{M.updateUploadBtn(!1),M.hide(),this._updateSelectedImageListContainerUI()}}async _createFolder(e,t=2){var n;try{const r=await nr(e,(n=d(this,ae))==null?void 0:n.name,"",d(this,z));p(this,D,[]),p(this,j,[]);const s=mr(d(this,pe),r==null?void 0:r.response);p(this,pe,s),p(this,ye,e),p(this,ae,{...r==null?void 0:r.response,children:{}}),this._fetchFilesFromFolder(e),this._renderToastContainer(`Folder ${e} created successfully`,"success",d(this,W))}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",d(this,W)),new Error(`Error creating folder "${e}". Either folder already exist or failed to create folder`)}finally{this._updateFolderListContainer()}}async _upload(){return d(this,Qe)?d(this,D):d(this,He)}async _fetchFilesFromFolder(e){var t,n,r;p(this,Q,!0),this._updateSelectedImageListContainerUI();try{const s=await qi(e,d(this,me),20,d(this,z)),o=(t=s.response)==null?void 0:t.files;d(this,j).push(...o),p(this,me,(n=s.response)==null?void 0:n.nextCursor),p(this,Te,(r=s.response)==null?void 0:r.hasMore)}catch{throw this._renderToastContainer("Error while fetching files from folder"+e,"error",d(this,W)),new Error("Something went wrong. Error while fetching files from folder"+e)}finally{p(this,Q,!1),this._updateSelectedImageListContainerUI()}}async _fetchAllFolders(){var e,t;p(this,Q,!0),p(this,Oe,!0),this._updateSelectedImageListContainerUI(),this._updateFolderListContainer(),this._removeToastContainer();try{const r=(await tr("",100,d(this,z))).response.folder,s=fr(r);p(this,ye,(e=s[0])==null?void 0:e.name),this._fetchFilesFromFolder((t=s[0])==null?void 0:t.name),p(this,ae,s[0]),p(this,pe,s)}catch{p(this,Q,!1),this._renderToastContainer("Folder not found. Please create a folder or try again later","error",d(this,W))}finally{p(this,Oe,!1),this._updateFolderListContainer()}}async _search(e){var t,n;p(this,Q,!0),this._updateSelectedImageListContainerUI(),this._removeToastContainer();try{const r=await Pi(e,d(this,me),10,d(this,z)),s=(t=r.response)==null?void 0:t.items;d(this,j).push(...s),p(this,me,(n=r.response)==null?void 0:n.nextPageCursor)}catch{this._renderToastContainer("Error while searching files","error",d(this,W))}finally{p(this,Q,!1),this._updateSelectedImageListContainerUI()}}async _updateFolder(e,t){M.updateUploadBtn(!0);try{const n=await ir(t.key,e,t.nestedFolderName,t.createdBy,d(this,z))}catch{throw this._renderToastContainer("Something went wrong while updating the folder. Please try again later.","error",d(this,W)),new Error("Error updating the folder ")}finally{M.updateUploadBtn(!1),M.hide(),this._updateFolderListContainer()}}async _deleteFolder(e){M.updateUploadBtn(!0);try{await rr(e,d(this,z)),p(this,pe,d(this,pe).filter(t=>t.key!==e)),this._renderToastContainer("Folder Deleted Successfully","success",d(this,W))}catch{throw this._renderToastContainer("Something went wrong while deleting the folder. Please try again later.","error",d(this,W)),new Error("Error deleting the folder ")}finally{M.updateUploadBtn(!1),M.hide(),this._updateFolderListContainer()}}_createUpdateFolderDialog(e,t,n){e.addEventListener("click",r=>{r.stopPropagation(),te.hide();let s;const o=y("edit-form-wrapper"),a=y("form-control"),l=T("Folder Name","input-label"),c=y();c.style.position="relative";const h=document.createElement("input");h.style.paddingLeft="40px";const g=T();g.appendChild(Xe()),g.style.position="absolute",g.style.top="50%",g.style.left="5%",g.style.transform="translate(-40%, -40%)",h.classList.add("input-field"),c.append(h,g),t==="update"&&(h.value=n.name),h.onchange=w=>{s=w.target.value},a.append(l,c),o.append(a),M.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(s):this._updateFolder(s,n),M.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 vi({baseUrl:n});this.updateWindowObject({grpcConfig:r})}}return Fe=new WeakMap,W=new WeakMap,V=new WeakMap,we=new WeakMap,D=new WeakMap,j=new WeakMap,ue=new WeakMap,Q=new WeakMap,Oe=new WeakMap,ye=new WeakMap,pe=new WeakMap,ae=new WeakMap,Le=new WeakMap,Me=new WeakMap,Ae=new WeakMap,Ie=new WeakMap,be=new WeakMap,Ue=new WeakMap,fe=new WeakMap,me=new WeakMap,Te=new WeakMap,ve=new WeakMap,Ce=new WeakMap,Ve=new WeakMap,Je=new WeakMap,z=new WeakMap,Ee=new WeakMap,Ye=new WeakMap,pt=new WeakMap,Qe=new WeakMap,q=new WeakMap,He=new WeakMap,Be=new WeakMap,et=new WeakMap,$e=new WeakMap,We=new WeakMap,je=new WeakMap,Lr});
@@ -1 +1,3 @@
1
- export declare const uploadImageUtils: (reader: string | ArrayBuffer | null, file: File) => Promise<any>;
1
+ import { RpcOptions } from '@protobuf-ts/runtime-rpc/build/types/rpc-options';
2
+
3
+ export declare const uploadImageUtils: (reader: string | ArrayBuffer | null, file: File, options: RpcOptions) => Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "image-salon-sdk",
3
- "version": "1.0.40",
3
+ "version": "1.0.41",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "files": [