@singlebase/elements 0.6.0 → 0.7.0

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.
Files changed (44) hide show
  1. package/dist/{authui-display-CKfGK5va.js → authui-display-BM_F3-5e.js} +473 -499
  2. package/dist/authui-display-BM_F3-5e.js.map +1 -0
  3. package/dist/{authui-display-aWNht0cW.cjs → authui-display-CMVHTNFz.cjs} +51 -51
  4. package/dist/authui-display-CMVHTNFz.cjs.map +1 -0
  5. package/dist/authui.cjs +1 -1
  6. package/dist/authui.js +2 -2
  7. package/dist/{chat-CEh6RygY.js → chat-BH_3e1jT.js} +793 -653
  8. package/dist/chat-BH_3e1jT.js.map +1 -0
  9. package/dist/{chat-C-gsskho.cjs → chat-ezUmd9II.cjs} +310 -287
  10. package/dist/chat-ezUmd9II.cjs.map +1 -0
  11. package/dist/chat-messages.d.ts +8 -1
  12. package/dist/chat.cjs +1 -1
  13. package/dist/chat.d.ts +1 -1
  14. package/dist/chat.js +1 -1
  15. package/dist/elements/authui.d.ts +0 -4
  16. package/dist/elements/chat.d.ts +46 -8
  17. package/dist/elements/uploader.d.ts +0 -6
  18. package/dist/files-4T62wkwj.cjs +77 -0
  19. package/dist/files-4T62wkwj.cjs.map +1 -0
  20. package/dist/{files-DDJWPzZW.js → files-DS-H-3yN.js} +56 -57
  21. package/dist/files-DS-H-3yN.js.map +1 -0
  22. package/dist/index.cjs +1 -1
  23. package/dist/index.js +4 -4
  24. package/dist/messages.d.ts +0 -2
  25. package/dist/singlebase-elements.min.js +2004 -1917
  26. package/dist/singlebase-elements.min.js.map +1 -1
  27. package/dist/upload-messages.d.ts +0 -1
  28. package/dist/{uploader-660JIgIN.cjs → uploader-COP8PkJ6.cjs} +7 -7
  29. package/dist/uploader-COP8PkJ6.cjs.map +1 -0
  30. package/dist/{uploader-vfczkX51.js → uploader-tdMU9Gxv.js} +235 -262
  31. package/dist/uploader-tdMU9Gxv.js.map +1 -0
  32. package/dist/uploader.cjs +1 -1
  33. package/dist/uploader.js +2 -2
  34. package/dist/utils/branding.d.ts +5 -5
  35. package/package.json +3 -3
  36. package/dist/authui-display-CKfGK5va.js.map +0 -1
  37. package/dist/authui-display-aWNht0cW.cjs.map +0 -1
  38. package/dist/chat-C-gsskho.cjs.map +0 -1
  39. package/dist/chat-CEh6RygY.js.map +0 -1
  40. package/dist/files-DDJWPzZW.js.map +0 -1
  41. package/dist/files-DyxcjZsx.cjs +0 -75
  42. package/dist/files-DyxcjZsx.cjs.map +0 -1
  43. package/dist/uploader-660JIgIN.cjs.map +0 -1
  44. package/dist/uploader-vfczkX51.js.map +0 -1
@@ -1,13 +1,13 @@
1
- var ge = (r) => {
1
+ var fe = (r) => {
2
2
  throw TypeError(r);
3
3
  };
4
- var he = (r, e, t) => e.has(r) || ge("Cannot " + t);
5
- var d = (r, e, t) => (he(r, e, "read from private field"), t ? t.call(r) : e.get(r)), l = (r, e, t) => e.has(r) ? ge("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), c = (r, e, t, i) => (he(r, e, "write to private field"), i ? i.call(r, t) : e.set(r, t), t);
6
- import { css as ye, LitElement as Me, nothing as x, html as u } from "lit";
7
- import { property as b, state as te, customElement as Ce } from "lit/decorators.js";
8
- import { getDefaultClient as Te } from "@singlebase/core";
9
- import { t as je, b as Fe, r as Oe, f as de, a as v, c as De, p as le, e as ie, g as Ee, h as Le, i as Ae, j as Ne, k as Pe } from "./files-DDJWPzZW.js";
10
- const Re = ye`
4
+ var be = (r, e, t) => e.has(r) || fe("Cannot " + t);
5
+ var l = (r, e, t) => (be(r, e, "read from private field"), t ? t.call(r) : e.get(r)), d = (r, e, t) => e.has(r) ? fe("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), c = (r, e, t, i) => (be(r, e, "write to private field"), i ? i.call(r, t) : e.set(r, t), t);
6
+ import { css as xe, LitElement as Ue, nothing as x, html as u } from "lit";
7
+ import { property as b, state as Q, customElement as Se } from "lit/decorators.js";
8
+ import { getDefaultClient as Me } from "@singlebase/core";
9
+ import { t as Ce, b as je, r as Fe, f as oe, a as v, c as Oe, p as ne, e as te, g as De, h as Ee, i as Le, j as Te, k as Ae } from "./files-DS-H-3yN.js";
10
+ const Ne = xe`
11
11
  /* ── layout primitives ───────────────────────────────────── */
12
12
  .stack {
13
13
  display: flex;
@@ -984,7 +984,7 @@ const Re = ye`
984
984
  font-style: italic;
985
985
  }
986
986
  `;
987
- function Be(r, e, t) {
987
+ function Pe(r, e, t) {
988
988
  if (!r || !e) return null;
989
989
  let i;
990
990
  try {
@@ -992,32 +992,32 @@ function Be(r, e, t) {
992
992
  } catch {
993
993
  return null;
994
994
  }
995
- let n;
995
+ let o;
996
996
  try {
997
- n = new URL(r, i.href);
997
+ o = new URL(r, i.href);
998
998
  } catch {
999
999
  return t == null || t(`"${r}" is not a valid URL`), null;
1000
1000
  }
1001
- return n.protocol !== "http:" && n.protocol !== "https:" ? (t == null || t(`refusing redirect to unsupported scheme "${n.protocol}"`), null) : n.origin !== i.origin ? (t == null || t(`refusing cross-origin redirect to ${n.origin}; same-origin only`), null) : n.href === i.href ? null : n.href;
1001
+ return o.protocol !== "http:" && o.protocol !== "https:" ? (t == null || t(`refusing redirect to unsupported scheme "${o.protocol}"`), null) : o.origin !== i.origin ? (t == null || t(`refusing cross-origin redirect to ${o.origin}; same-origin only`), null) : o.href === i.href ? null : o.href;
1002
1002
  }
1003
- const we = { pages: null, encrypted: null }, me = 16 * 1024 * 1024, Ge = 2 * 1024 * 1024, Ie = 40, _e = 4 * 1024 * 1024, ke = /* @__PURE__ */ new Set(["docx", "pptx", "xlsx"]);
1004
- async function Ke(r, e) {
1003
+ const ve = { pages: null, encrypted: null }, ge = 16 * 1024 * 1024, Re = 2 * 1024 * 1024, Be = 40, Ge = 4 * 1024 * 1024, ye = /* @__PURE__ */ new Set(["docx", "pptx", "xlsx"]);
1004
+ async function Ie(r, e) {
1005
1005
  try {
1006
- if (e === "pdf") return await Ve(r);
1007
- if (ke.has(e)) return await He(r, e);
1006
+ if (e === "pdf") return await Ke(r);
1007
+ if (ye.has(e)) return await Ve(r, e);
1008
1008
  } catch {
1009
1009
  }
1010
- return we;
1010
+ return ve;
1011
1011
  }
1012
- function qe(r) {
1013
- return r === "pdf" || ke.has(r);
1012
+ function _e(r) {
1013
+ return r === "pdf" || ye.has(r);
1014
1014
  }
1015
- async function Ve(r) {
1016
- const e = await ae(r.slice(0, me)), t = r.size > me ? await ae(r.slice(Math.max(0, r.size - Ge))) : null, i = se(e) + (t ? se(t) : ""), n = /\/Encrypt[\s/<>\]]/.test(i);
1017
- let g = ze(i);
1018
- return g === null && (g = await Ye(e)), { pages: g, encrypted: n };
1015
+ async function Ke(r) {
1016
+ const e = await re(r.slice(0, ge)), t = r.size > ge ? await re(r.slice(Math.max(0, r.size - Re))) : null, i = ie(e) + (t ? ie(t) : ""), o = /\/Encrypt[\s/<>\]]/.test(i);
1017
+ let g = we(i);
1018
+ return g === null && (g = await qe(e)), { pages: g, encrypted: o };
1019
1019
  }
1020
- function ze(r) {
1020
+ function we(r) {
1021
1021
  if (/\/Type\s*\/Pages/.test(r)) {
1022
1022
  let t = 0;
1023
1023
  for (const i of r.matchAll(/\/Count\s+(\d+)/g))
@@ -1027,80 +1027,80 @@ function ze(r) {
1027
1027
  const e = r.match(/\/Type\s*\/Page[^s]/g);
1028
1028
  return e != null && e.length ? e.length : null;
1029
1029
  }
1030
- async function Ye(r) {
1030
+ async function qe(r) {
1031
1031
  if (typeof DecompressionStream > "u") return null;
1032
- const e = se(r);
1032
+ const e = ie(r);
1033
1033
  let t = "", i = 0;
1034
- for (const n of e.matchAll(/stream\r?\n/g)) {
1035
- if (i >= Ie || t.length >= _e) break;
1036
- const g = n.index + n[0].length;
1034
+ for (const o of e.matchAll(/stream\r?\n/g)) {
1035
+ if (i >= Be || t.length >= Ge) break;
1036
+ const g = o.index + o[0].length;
1037
1037
  let s = e.indexOf("endstream", g);
1038
1038
  if (s < 0) break;
1039
1039
  for (; s > g && (e[s - 1] === `
1040
1040
  ` || e[s - 1] === "\r"); ) s -= 1;
1041
1041
  i += 1;
1042
1042
  try {
1043
- const a = await $e(r.subarray(g, s), "deflate");
1044
- t += se(a);
1043
+ const a = await ke(r.subarray(g, s), "deflate");
1044
+ t += ie(a);
1045
1045
  } catch {
1046
1046
  }
1047
1047
  }
1048
- return t ? ze(t) : null;
1048
+ return t ? we(t) : null;
1049
1049
  }
1050
- async function He(r, e) {
1051
- const t = await ae(r.slice(0, 8));
1052
- if (Je(t)) return { pages: null, encrypted: !0 };
1053
- if (t[0] !== 80 || t[1] !== 75) return we;
1054
- const i = await Xe(r, "docProps/app.xml");
1050
+ async function Ve(r, e) {
1051
+ const t = await re(r.slice(0, 8));
1052
+ if (Ye(t)) return { pages: null, encrypted: !0 };
1053
+ if (t[0] !== 80 || t[1] !== 75) return ve;
1054
+ const i = await He(r, "docProps/app.xml");
1055
1055
  if (!i) return { pages: null, encrypted: !1 };
1056
- const n = e === "pptx" ? "Slides" : "Pages", g = new TextDecoder().decode(i).match(new RegExp(`<${n}>(\\d+)</${n}>`));
1056
+ const o = e === "pptx" ? "Slides" : "Pages", g = new TextDecoder().decode(i).match(new RegExp(`<${o}>(\\d+)</${o}>`));
1057
1057
  return { pages: g ? Number(g[1]) : null, encrypted: !1 };
1058
1058
  }
1059
- function Je(r) {
1059
+ function Ye(r) {
1060
1060
  return [208, 207, 17, 224, 161, 177, 26, 225].every((t, i) => r[i] === t);
1061
1061
  }
1062
- async function Xe(r, e) {
1062
+ async function He(r, e) {
1063
1063
  const t = Math.min(r.size, 66e3), i = new DataView(await r.slice(r.size - t).arrayBuffer());
1064
- let n = -1;
1064
+ let o = -1;
1065
1065
  for (let h = i.byteLength - 22; h >= 0; h--)
1066
1066
  if (i.getUint32(h, !0) === 101010256) {
1067
- n = h;
1067
+ o = h;
1068
1068
  break;
1069
1069
  }
1070
- if (n < 0) return null;
1071
- const g = i.getUint32(n + 12, !0), s = i.getUint32(n + 16, !0);
1070
+ if (o < 0) return null;
1071
+ const g = i.getUint32(o + 12, !0), s = i.getUint32(o + 16, !0);
1072
1072
  if (!g || s === 4294967295) return null;
1073
1073
  const a = new DataView(await r.slice(s, s + g).arrayBuffer()), m = new TextDecoder();
1074
1074
  let f = 0;
1075
1075
  for (; f + 46 <= a.byteLength && a.getUint32(f, !0) === 33639248; ) {
1076
- const h = a.getUint16(f + 10, !0), re = a.getUint32(f + 20, !0), y = a.getUint16(f + 28, !0), ne = a.getUint16(f + 30, !0), Se = a.getUint16(f + 32, !0), oe = a.getUint32(f + 42, !0);
1076
+ const h = a.getUint16(f + 10, !0), ee = a.getUint32(f + 20, !0), y = a.getUint16(f + 28, !0), ae = a.getUint16(f + 30, !0), $e = a.getUint16(f + 32, !0), se = a.getUint32(f + 42, !0);
1077
1077
  if (m.decode(new Uint8Array(a.buffer, a.byteOffset + f + 46, y)) === e) {
1078
- const ue = new DataView(await r.slice(oe, oe + 30).arrayBuffer()), fe = oe + 30 + ue.getUint16(26, !0) + ue.getUint16(28, !0), be = await ae(r.slice(fe, fe + re));
1079
- return h === 0 ? be : h === 8 && typeof DecompressionStream < "u" ? await $e(be, "deflate-raw") : null;
1078
+ const ce = new DataView(await r.slice(se, se + 30).arrayBuffer()), pe = se + 30 + ce.getUint16(26, !0) + ce.getUint16(28, !0), ue = await re(r.slice(pe, pe + ee));
1079
+ return h === 0 ? ue : h === 8 && typeof DecompressionStream < "u" ? await ke(ue, "deflate-raw") : null;
1080
1080
  }
1081
- f += 46 + y + ne + Se;
1081
+ f += 46 + y + ae + $e;
1082
1082
  }
1083
1083
  return null;
1084
1084
  }
1085
- async function ae(r) {
1085
+ async function re(r) {
1086
1086
  return new Uint8Array(await r.arrayBuffer());
1087
1087
  }
1088
- async function $e(r, e) {
1088
+ async function ke(r, e) {
1089
1089
  const t = new Blob([r]).stream().pipeThrough(new DecompressionStream(e));
1090
1090
  return new Uint8Array(await new Response(t).arrayBuffer());
1091
1091
  }
1092
- function se(r) {
1092
+ function ie(r) {
1093
1093
  let e = "";
1094
1094
  for (let i = 0; i < r.length; i += 32768)
1095
1095
  e += String.fromCharCode(...r.subarray(i, i + 32768));
1096
1096
  return e;
1097
1097
  }
1098
- var Ue = Object.defineProperty, We = Object.getOwnPropertyDescriptor, Ze = (r, e, t) => e in r ? Ue(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, p = (r, e, t, i) => {
1099
- for (var n = i > 1 ? void 0 : i ? We(e, t) : e, g = r.length - 1, s; g >= 0; g--)
1100
- (s = r[g]) && (n = (i ? s(e, t, n) : s(n)) || n);
1101
- return i && n && Ue(e, t, n), n;
1102
- }, Qe = (r, e, t) => Ze(r, e + "", t);
1103
- const ce = {
1098
+ var ze = Object.defineProperty, Je = Object.getOwnPropertyDescriptor, Xe = (r, e, t) => e in r ? ze(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, p = (r, e, t, i) => {
1099
+ for (var o = i > 1 ? void 0 : i ? Je(e, t) : e, g = r.length - 1, s; g >= 0; g--)
1100
+ (s = r[g]) && (o = (i ? s(e, t, o) : s(o)) || o);
1101
+ return i && o && ze(e, t, o), o;
1102
+ }, We = (r, e, t) => Xe(r, e + "", t);
1103
+ const le = {
1104
1104
  fromAttribute: (r) => {
1105
1105
  if (!r) return {};
1106
1106
  try {
@@ -1111,17 +1111,15 @@ const ce = {
1111
1111
  }
1112
1112
  },
1113
1113
  toAttribute: (r) => JSON.stringify(r ?? {})
1114
- }, pe = {
1114
+ }, de = {
1115
1115
  fromAttribute: (r) => r === null ? !0 : r !== "false",
1116
1116
  toAttribute: (r) => r ? null : "false"
1117
- }, xe = [
1117
+ }, he = [
1118
1118
  "view",
1119
1119
  "dropzone",
1120
1120
  "allowRename",
1121
1121
  "autoUpload",
1122
1122
  "branding",
1123
- "brandingText",
1124
- "brandingUrl",
1125
1123
  "logoUrl",
1126
1124
  "logoText",
1127
1125
  "heading",
@@ -1143,248 +1141,234 @@ const ce = {
1143
1141
  "onComplete",
1144
1142
  "onError"
1145
1143
  ];
1146
- var k, z, $, U, S, M, C, T, j, F, O, D, E, L, A, N, P, R, B, G, I, _, K, q, V, Y, H, J, X, W, Z, Q, ee, ve;
1147
- let o = (ve = class extends Me {
1144
+ var k, z, $, U, S, M, C, j, F, O, D, E, L, T, A, N, P, R, B, G, I, _, K, q, V, Y, H, J, X, W, Z, me;
1145
+ let n = (me = class extends Ue {
1148
1146
  constructor() {
1149
1147
  super(...arguments);
1150
- l(this, k, null);
1151
- l(this, z, {});
1152
- l(this, $);
1153
- l(this, U);
1154
- l(this, S);
1155
- l(this, M, "full");
1156
- l(this, C, !0);
1157
- l(this, T, !0);
1158
- l(this, j, !1);
1159
- l(this, F, !0);
1160
- l(this, O, "");
1161
- l(this, D, "");
1162
- l(this, E, "");
1163
- l(this, L, "");
1164
- l(this, A, "");
1165
- l(this, N, "");
1166
- l(this, P, 10);
1167
- l(this, R, "25MB");
1168
- l(this, B, 0);
1169
- l(this, G, "");
1170
- l(this, I, {});
1171
- l(this, _, "default");
1172
- l(this, K, {});
1173
- l(this, q, {});
1174
- l(this, V, !1);
1175
- l(this, Y, "");
1176
- l(this, H, null);
1177
- l(this, J, null);
1178
- l(this, X, []);
1179
- l(this, W, "");
1180
- l(this, Z, !1);
1181
- l(this, Q, !1);
1182
- l(this, ee, "");
1148
+ d(this, k, null);
1149
+ d(this, z, {});
1150
+ d(this, $);
1151
+ d(this, U);
1152
+ d(this, S);
1153
+ d(this, M, "full");
1154
+ d(this, C, !0);
1155
+ d(this, j, !0);
1156
+ d(this, F, !1);
1157
+ d(this, O, !0);
1158
+ d(this, D, "");
1159
+ d(this, E, "");
1160
+ d(this, L, "");
1161
+ d(this, T, "");
1162
+ d(this, A, 10);
1163
+ d(this, N, "25MB");
1164
+ d(this, P, 0);
1165
+ d(this, R, "");
1166
+ d(this, B, {});
1167
+ d(this, G, "default");
1168
+ d(this, I, {});
1169
+ d(this, _, {});
1170
+ d(this, K, !1);
1171
+ d(this, q, "");
1172
+ d(this, V, null);
1173
+ d(this, Y, null);
1174
+ d(this, H, []);
1175
+ d(this, J, "");
1176
+ d(this, X, !1);
1177
+ d(this, W, !1);
1178
+ d(this, Z, "");
1183
1179
  }
1184
1180
  get client() {
1185
- return d(this, k);
1181
+ return l(this, k);
1186
1182
  }
1187
1183
  set client(e) {
1188
1184
  c(this, k, e);
1189
1185
  }
1190
1186
  get messages() {
1191
- return d(this, z);
1187
+ return l(this, z);
1192
1188
  }
1193
1189
  set messages(e) {
1194
1190
  c(this, z, e);
1195
1191
  }
1196
1192
  get theme() {
1197
- return d(this, $);
1193
+ return l(this, $);
1198
1194
  }
1199
1195
  set theme(e) {
1200
1196
  c(this, $, e);
1201
1197
  }
1202
1198
  get density() {
1203
- return d(this, U);
1199
+ return l(this, U);
1204
1200
  }
1205
1201
  set density(e) {
1206
1202
  c(this, U, e);
1207
1203
  }
1208
1204
  get radius() {
1209
- return d(this, S);
1205
+ return l(this, S);
1210
1206
  }
1211
1207
  set radius(e) {
1212
1208
  c(this, S, e);
1213
1209
  }
1214
1210
  get view() {
1215
- return d(this, M);
1211
+ return l(this, M);
1216
1212
  }
1217
1213
  set view(e) {
1218
1214
  c(this, M, e);
1219
1215
  }
1220
1216
  get dropzone() {
1221
- return d(this, C);
1217
+ return l(this, C);
1222
1218
  }
1223
1219
  set dropzone(e) {
1224
1220
  c(this, C, e);
1225
1221
  }
1226
1222
  get allowRename() {
1227
- return d(this, T);
1223
+ return l(this, j);
1228
1224
  }
1229
1225
  set allowRename(e) {
1230
- c(this, T, e);
1226
+ c(this, j, e);
1231
1227
  }
1232
1228
  get autoUpload() {
1233
- return d(this, j);
1229
+ return l(this, F);
1234
1230
  }
1235
1231
  set autoUpload(e) {
1236
- c(this, j, e);
1232
+ c(this, F, e);
1237
1233
  }
1238
1234
  get branding() {
1239
- return d(this, F);
1235
+ return l(this, O);
1240
1236
  }
1241
1237
  set branding(e) {
1242
- c(this, F, e);
1243
- }
1244
- get brandingText() {
1245
- return d(this, O);
1246
- }
1247
- set brandingText(e) {
1248
1238
  c(this, O, e);
1249
1239
  }
1250
- get brandingUrl() {
1251
- return d(this, D);
1252
- }
1253
- set brandingUrl(e) {
1254
- c(this, D, e);
1255
- }
1256
1240
  get logoUrl() {
1257
- return d(this, E);
1241
+ return l(this, D);
1258
1242
  }
1259
1243
  set logoUrl(e) {
1260
- c(this, E, e);
1244
+ c(this, D, e);
1261
1245
  }
1262
1246
  get logoText() {
1263
- return d(this, L);
1247
+ return l(this, E);
1264
1248
  }
1265
1249
  set logoText(e) {
1266
- c(this, L, e);
1250
+ c(this, E, e);
1267
1251
  }
1268
1252
  get heading() {
1269
- return d(this, A);
1253
+ return l(this, L);
1270
1254
  }
1271
1255
  set heading(e) {
1272
- c(this, A, e);
1256
+ c(this, L, e);
1273
1257
  }
1274
1258
  get description() {
1275
- return d(this, N);
1259
+ return l(this, T);
1276
1260
  }
1277
1261
  set description(e) {
1278
- c(this, N, e);
1262
+ c(this, T, e);
1279
1263
  }
1280
1264
  get maxFiles() {
1281
- return d(this, P);
1265
+ return l(this, A);
1282
1266
  }
1283
1267
  set maxFiles(e) {
1284
- c(this, P, e);
1268
+ c(this, A, e);
1285
1269
  }
1286
1270
  get maxSize() {
1287
- return d(this, R);
1271
+ return l(this, N);
1288
1272
  }
1289
1273
  set maxSize(e) {
1290
- c(this, R, e);
1274
+ c(this, N, e);
1291
1275
  }
1292
1276
  get minSize() {
1293
- return d(this, B);
1277
+ return l(this, P);
1294
1278
  }
1295
1279
  set minSize(e) {
1296
- c(this, B, e);
1280
+ c(this, P, e);
1297
1281
  }
1298
1282
  get accept() {
1299
- return d(this, G);
1283
+ return l(this, R);
1300
1284
  }
1301
1285
  set accept(e) {
1302
- c(this, G, e);
1286
+ c(this, R, e);
1303
1287
  }
1304
1288
  get rules() {
1305
- return d(this, I);
1289
+ return l(this, B);
1306
1290
  }
1307
1291
  set rules(e) {
1308
- c(this, I, e);
1292
+ c(this, B, e);
1309
1293
  }
1310
1294
  get bucket() {
1311
- return d(this, _);
1295
+ return l(this, G);
1312
1296
  }
1313
1297
  set bucket(e) {
1314
- c(this, _, e);
1298
+ c(this, G, e);
1315
1299
  }
1316
1300
  get metadata() {
1317
- return d(this, K);
1301
+ return l(this, I);
1318
1302
  }
1319
1303
  set metadata(e) {
1320
- c(this, K, e);
1304
+ c(this, I, e);
1321
1305
  }
1322
1306
  get options() {
1323
- return d(this, q);
1307
+ return l(this, _);
1324
1308
  }
1325
1309
  set options(e) {
1326
- c(this, q, e);
1310
+ c(this, _, e);
1327
1311
  }
1328
1312
  get publicRead() {
1329
- return d(this, V);
1313
+ return l(this, K);
1330
1314
  }
1331
1315
  set publicRead(e) {
1332
- c(this, V, e);
1316
+ c(this, K, e);
1333
1317
  }
1334
1318
  get redirectUrl() {
1335
- return d(this, Y);
1319
+ return l(this, q);
1336
1320
  }
1337
1321
  set redirectUrl(e) {
1338
- c(this, Y, e);
1322
+ c(this, q, e);
1339
1323
  }
1340
1324
  get onComplete() {
1341
- return d(this, H);
1325
+ return l(this, V);
1342
1326
  }
1343
1327
  set onComplete(e) {
1344
- c(this, H, e);
1328
+ c(this, V, e);
1345
1329
  }
1346
1330
  get onError() {
1347
- return d(this, J);
1331
+ return l(this, Y);
1348
1332
  }
1349
1333
  set onError(e) {
1350
- c(this, J, e);
1334
+ c(this, Y, e);
1351
1335
  }
1352
1336
  get items() {
1353
- return d(this, X);
1337
+ return l(this, H);
1354
1338
  }
1355
1339
  set items(e) {
1356
- c(this, X, e);
1340
+ c(this, H, e);
1357
1341
  }
1358
1342
  get notice() {
1359
- return d(this, W);
1343
+ return l(this, J);
1360
1344
  }
1361
1345
  set notice(e) {
1362
- c(this, W, e);
1346
+ c(this, J, e);
1363
1347
  }
1364
1348
  get busy() {
1365
- return d(this, Z);
1349
+ return l(this, X);
1366
1350
  }
1367
1351
  set busy(e) {
1368
- c(this, Z, e);
1352
+ c(this, X, e);
1369
1353
  }
1370
1354
  get dragging() {
1371
- return d(this, Q);
1355
+ return l(this, W);
1372
1356
  }
1373
1357
  set dragging(e) {
1374
- c(this, Q, e);
1358
+ c(this, W, e);
1375
1359
  }
1376
1360
  get editing() {
1377
- return d(this, ee);
1361
+ return l(this, Z);
1378
1362
  }
1379
1363
  set editing(e) {
1380
- c(this, ee, e);
1364
+ c(this, Z, e);
1381
1365
  }
1382
1366
  get msg() {
1383
- return Oe(this.messages);
1367
+ return Fe(this.messages);
1384
1368
  }
1385
1369
  /** An explicit `.client`, else the page default. */
1386
1370
  get resolvedClient() {
1387
- return this.client ?? Te() ?? null;
1371
+ return this.client ?? Me() ?? null;
1388
1372
  }
1389
1373
  /** The staging list, for host code that wants to inspect or persist it. */
1390
1374
  get files() {
@@ -1410,7 +1394,7 @@ let o = (ve = class extends Me {
1410
1394
  */
1411
1395
  set config(e) {
1412
1396
  const t = this;
1413
- for (const i of xe)
1397
+ for (const i of he)
1414
1398
  e && i in e && (t[i] = e[i]);
1415
1399
  }
1416
1400
  /**
@@ -1422,7 +1406,7 @@ let o = (ve = class extends Me {
1422
1406
  }
1423
1407
  get config() {
1424
1408
  const e = this;
1425
- return Object.fromEntries(xe.map((t) => [t, e[t]]));
1409
+ return Object.fromEntries(he.map((t) => [t, e[t]]));
1426
1410
  }
1427
1411
  /** Drops every staged file and any notice. */
1428
1412
  clear() {
@@ -1446,12 +1430,12 @@ let o = (ve = class extends Me {
1446
1430
  for (const s of e)
1447
1431
  s.status = "uploading", s.percent = 0, s.error = "";
1448
1432
  this.items = [...this.items];
1449
- const i = /* @__PURE__ */ new Map(), n = e.map((s) => {
1433
+ const i = /* @__PURE__ */ new Map(), o = e.map((s) => {
1450
1434
  const a = { file: s.file, filename: s.file.name };
1451
1435
  return this.bucket && (a.bucket = this.bucket), this.publicRead && (a.publicRead = !0), s.name !== s.file.name && (a.newName = s.name), Object.keys(this.metadata ?? {}).length && (a.metadata = { ...this.metadata }), Object.keys(this.options ?? {}).length && (a.options = { ...this.options }), i.set(a, s), a;
1452
1436
  });
1453
1437
  try {
1454
- const s = await t.files.upload(n, {
1438
+ const s = await t.files.upload(o, {
1455
1439
  onProgress: (f) => {
1456
1440
  const h = i.get(f.input);
1457
1441
  h && (h.percent = f.percent, this.items = [...this.items], this.emit("singlebase-upload-progress", { file: h, percent: this.percent }));
@@ -1471,7 +1455,7 @@ let o = (ve = class extends Me {
1471
1455
  } catch (s) {
1472
1456
  for (const a of e)
1473
1457
  a.status = "error", a.error = "";
1474
- this.items = [...this.items], this.fail(tt(s) || this.msg.errUpload);
1458
+ this.items = [...this.items], this.fail(Qe(s) || this.msg.errUpload);
1475
1459
  } finally {
1476
1460
  this.busy = !1;
1477
1461
  }
@@ -1479,10 +1463,10 @@ let o = (ve = class extends Me {
1479
1463
  // ── staging ───────────────────────────────────────────────
1480
1464
  /** The rule for this filename's extension, if the host set one. */
1481
1465
  ruleFor(e) {
1482
- const t = de(e);
1466
+ const t = oe(e);
1483
1467
  if (!t) return null;
1484
- for (const [i, n] of Object.entries(this.rules ?? {}))
1485
- if (i.toLowerCase().replace(/^\./, "") === t) return n;
1468
+ for (const [i, o] of Object.entries(this.rules ?? {}))
1469
+ if (i.toLowerCase().replace(/^\./, "") === t) return o;
1486
1470
  return null;
1487
1471
  }
1488
1472
  async add(e) {
@@ -1490,33 +1474,33 @@ let o = (ve = class extends Me {
1490
1474
  const a = this.items.filter((m) => m.status === "done" || m.status === "error");
1491
1475
  a.forEach(w), this.items = this.items.filter((m) => !a.includes(m));
1492
1476
  }
1493
- const t = this.maxFiles > 0 ? this.maxFiles : Number.POSITIVE_INFINITY, i = [...this.items], n = i.length, g = [];
1477
+ const t = this.maxFiles > 0 ? this.maxFiles : Number.POSITIVE_INFINITY, i = [...this.items], o = i.length, g = [];
1494
1478
  let s = "";
1495
1479
  for (const a of Array.from(e)) {
1496
1480
  if (i.length >= t) {
1497
1481
  s = v(this.msg.errTooMany, { max: t });
1498
1482
  break;
1499
1483
  }
1500
- if (this.accept && !De(this.accept, a.name, a.type)) {
1484
+ if (this.accept && !Oe(this.accept, a.name, a.type)) {
1501
1485
  s = v(this.msg.errType, { name: a.name });
1502
1486
  continue;
1503
1487
  }
1504
- const m = this.ruleFor(a.name), f = le((m == null ? void 0 : m.maxSize) ?? this.maxSize), h = le((m == null ? void 0 : m.minSize) ?? this.minSize);
1488
+ const m = this.ruleFor(a.name), f = ne((m == null ? void 0 : m.maxSize) ?? this.maxSize), h = ne((m == null ? void 0 : m.minSize) ?? this.minSize);
1505
1489
  if (f && a.size > f) {
1506
- s = v(this.msg.errTooLarge, { name: a.name, size: ie(f) });
1490
+ s = v(this.msg.errTooLarge, { name: a.name, size: te(f) });
1507
1491
  continue;
1508
1492
  }
1509
1493
  if (h && a.size < h) {
1510
- s = v(this.msg.errTooSmall, { name: a.name, size: ie(h) });
1494
+ s = v(this.msg.errTooSmall, { name: a.name, size: te(h) });
1511
1495
  continue;
1512
1496
  }
1513
- const re = Ee(a);
1514
- if (i.some((ne) => ne.key === re)) {
1497
+ const ee = De(a);
1498
+ if (i.some((ae) => ae.key === ee)) {
1515
1499
  s = v(this.msg.errDuplicate, { name: a.name });
1516
1500
  continue;
1517
1501
  }
1518
1502
  const y = {
1519
- key: re,
1503
+ key: ee,
1520
1504
  file: a,
1521
1505
  name: a.name,
1522
1506
  // Reading bytes takes a moment, so the row appears immediately as
@@ -1527,16 +1511,16 @@ let o = (ve = class extends Me {
1527
1511
  record: null,
1528
1512
  pages: null,
1529
1513
  encrypted: null,
1530
- preview: et(a)
1514
+ preview: Ze(a)
1531
1515
  };
1532
1516
  i.push(y), g.push(y);
1533
1517
  }
1534
- this.notice = s, s && this.emit("singlebase-upload-rejected", { message: s }), i.length !== n && (this.items = i, this.emit("singlebase-upload-selected", { files: this.items }), await Promise.all(
1518
+ this.notice = s, s && this.emit("singlebase-upload-rejected", { message: s }), i.length !== o && (this.items = i, this.emit("singlebase-upload-selected", { files: this.items }), await Promise.all(
1535
1519
  g.filter((a) => a.status === "checking").map((a) => this.inspect(a, this.ruleFor(a.file.name)))
1536
1520
  ), (this.autoUpload || this.view === "button") && this.upload());
1537
1521
  }
1538
1522
  needsInspection(e, t) {
1539
- return !e || !qe(de(t)) ? !1 : e.maxPages !== void 0 || e.allowProtected === !1;
1523
+ return !e || !_e(oe(t)) ? !1 : e.maxPages !== void 0 || e.allowProtected === !1;
1540
1524
  }
1541
1525
  /**
1542
1526
  * Reads the file and applies the rule. A fact the reader could not
@@ -1544,21 +1528,21 @@ let o = (ve = class extends Me {
1544
1528
  * the page rule simply doesn't apply to that file.
1545
1529
  */
1546
1530
  async inspect(e, t) {
1547
- const i = await Ke(e.file, de(e.file.name));
1531
+ const i = await Ie(e.file, oe(e.file.name));
1548
1532
  e.pages = i.pages, e.encrypted = i.encrypted;
1549
- let n = "";
1550
- t.allowProtected === !1 && i.encrypted === !0 ? n = v(this.msg.errProtected, { name: e.name }) : t.maxPages && i.pages !== null && i.pages > t.maxPages && (n = v(this.msg.errTooManyPages, {
1533
+ let o = "";
1534
+ t.allowProtected === !1 && i.encrypted === !0 ? o = v(this.msg.errProtected, { name: e.name }) : t.maxPages && i.pages !== null && i.pages > t.maxPages && (o = v(this.msg.errTooManyPages, {
1551
1535
  name: e.name,
1552
1536
  pages: i.pages,
1553
1537
  max: t.maxPages
1554
- })), n ? (w(e), this.items = this.items.filter((g) => g !== e), this.notice = n, this.emit("singlebase-upload-rejected", { message: n })) : (e.status = "ready", this.items = [...this.items]);
1538
+ })), o ? (w(e), this.items = this.items.filter((g) => g !== e), this.notice = o, this.emit("singlebase-upload-rejected", { message: o })) : (e.status = "ready", this.items = [...this.items]);
1555
1539
  }
1556
1540
  /** Drops one staged file. Named for the row action, not Element.remove(). */
1557
1541
  removeItem(e) {
1558
1542
  this.items.filter((t) => t.key === e).forEach(w), this.items = this.items.filter((t) => t.key !== e), this.notice = "";
1559
1543
  }
1560
1544
  commitRename(e, t) {
1561
- e.name = Le(e.file.name, t), this.editing = "", this.items = [...this.items];
1545
+ e.name = Ee(e.file.name, t), this.editing = "", this.items = [...this.items];
1562
1546
  }
1563
1547
  fail(e) {
1564
1548
  var t;
@@ -1569,7 +1553,7 @@ let o = (ve = class extends Me {
1569
1553
  }
1570
1554
  redirect() {
1571
1555
  if (!this.redirectUrl || typeof location > "u") return;
1572
- const e = Be(
1556
+ const e = Pe(
1573
1557
  this.redirectUrl,
1574
1558
  location.href,
1575
1559
  (t) => console.warn(`[singlebase-uploader] ${t}`)
@@ -1606,7 +1590,7 @@ let o = (ve = class extends Me {
1606
1590
  return this.items.filter((e) => e.status === "ready" || e.status === "error").length;
1607
1591
  }
1608
1592
  get hint() {
1609
- const e = Ae(this.accept), t = le(this.maxSize), i = t ? v(this.msg.hintUpTo, { size: ie(t) }) : "";
1593
+ const e = Le(this.accept), t = ne(this.maxSize), i = t ? v(this.msg.hintUpTo, { size: te(t) }) : "";
1610
1594
  return [e, i].filter(Boolean).join(" · ");
1611
1595
  }
1612
1596
  renderInput() {
@@ -1627,12 +1611,7 @@ let o = (ve = class extends Me {
1627
1611
  />` : this.logoText ? u`<div class="brand-mark" part="logo">${this.logoText}</div>` : x;
1628
1612
  }
1629
1613
  renderBranding() {
1630
- return Ne(
1631
- this.branding,
1632
- this.brandingText,
1633
- this.msg.brandingLabel,
1634
- this.brandingUrl
1635
- );
1614
+ return Te(this.branding, "Files");
1636
1615
  }
1637
1616
  renderNotice() {
1638
1617
  return this.notice ? u`<div class="banner" role="alert" part="error">${this.notice}</div>` : x;
@@ -1645,7 +1624,7 @@ let o = (ve = class extends Me {
1645
1624
  </div>`;
1646
1625
  }
1647
1626
  renderStatus(e) {
1648
- const t = ie(e.file.size);
1627
+ const t = te(e.file.size);
1649
1628
  if (e.status === "checking") return `${t} · ${this.msg.checking}`;
1650
1629
  if (e.status === "uploading") return `${t} · ${this.msg.uploading}`;
1651
1630
  if (e.status === "done") return `${t} · ${this.msg.uploaded}`;
@@ -1658,7 +1637,7 @@ let o = (ve = class extends Me {
1658
1637
  const t = this.allowRename && e.status === "ready";
1659
1638
  return e.status === "uploading" || e.status, u`<div class="row" part="file">
1660
1639
  <div class="chip" part="file-type">
1661
- ${e.preview ? u`<img class="thumb" src=${e.preview} alt="" part="preview" />` : Pe(e.name) || "FILE"}
1640
+ ${e.preview ? u`<img class="thumb" src=${e.preview} alt="" part="preview" />` : Ae(e.name) || "FILE"}
1662
1641
  </div>
1663
1642
  <div class="meta">
1664
1643
  ${this.editing === e.key ? u`<input
@@ -1780,12 +1759,12 @@ let o = (ve = class extends Me {
1780
1759
  render() {
1781
1760
  return u`${this.renderInput()}${this.view === "button" ? this.renderButton() : this.view === "compact" ? this.renderCompact() : this.renderFull()}`;
1782
1761
  }
1783
- }, k = new WeakMap(), z = new WeakMap(), $ = new WeakMap(), U = new WeakMap(), S = new WeakMap(), M = new WeakMap(), C = new WeakMap(), T = new WeakMap(), j = new WeakMap(), F = new WeakMap(), O = new WeakMap(), D = new WeakMap(), E = new WeakMap(), L = new WeakMap(), A = new WeakMap(), N = new WeakMap(), P = new WeakMap(), R = new WeakMap(), B = new WeakMap(), G = new WeakMap(), I = new WeakMap(), _ = new WeakMap(), K = new WeakMap(), q = new WeakMap(), V = new WeakMap(), Y = new WeakMap(), H = new WeakMap(), J = new WeakMap(), X = new WeakMap(), W = new WeakMap(), Z = new WeakMap(), Q = new WeakMap(), ee = new WeakMap(), ve);
1784
- Qe(o, "styles", [
1762
+ }, k = new WeakMap(), z = new WeakMap(), $ = new WeakMap(), U = new WeakMap(), S = new WeakMap(), M = new WeakMap(), C = new WeakMap(), j = new WeakMap(), F = new WeakMap(), O = new WeakMap(), D = new WeakMap(), E = new WeakMap(), L = new WeakMap(), T = new WeakMap(), A = new WeakMap(), N = new WeakMap(), P = new WeakMap(), R = new WeakMap(), B = new WeakMap(), G = new WeakMap(), I = new WeakMap(), _ = new WeakMap(), K = new WeakMap(), q = new WeakMap(), V = new WeakMap(), Y = new WeakMap(), H = new WeakMap(), J = new WeakMap(), X = new WeakMap(), W = new WeakMap(), Z = new WeakMap(), me);
1763
+ We(n, "styles", [
1764
+ Ce,
1765
+ Ne,
1785
1766
  je,
1786
- Re,
1787
- Fe,
1788
- ye`
1767
+ xe`
1789
1768
  .card {
1790
1769
  display: flex;
1791
1770
  flex-direction: column;
@@ -2040,120 +2019,114 @@ Qe(o, "styles", [
2040
2019
  ]);
2041
2020
  p([
2042
2021
  b({ attribute: !1 })
2043
- ], o.prototype, "client", 1);
2022
+ ], n.prototype, "client", 1);
2044
2023
  p([
2045
2024
  b({ attribute: !1 })
2046
- ], o.prototype, "messages", 1);
2025
+ ], n.prototype, "messages", 1);
2047
2026
  p([
2048
2027
  b({ reflect: !0 })
2049
- ], o.prototype, "theme", 1);
2028
+ ], n.prototype, "theme", 1);
2050
2029
  p([
2051
2030
  b({ reflect: !0 })
2052
- ], o.prototype, "density", 1);
2031
+ ], n.prototype, "density", 1);
2053
2032
  p([
2054
2033
  b({ reflect: !0 })
2055
- ], o.prototype, "radius", 1);
2034
+ ], n.prototype, "radius", 1);
2056
2035
  p([
2057
2036
  b({ reflect: !0 })
2058
- ], o.prototype, "view", 1);
2037
+ ], n.prototype, "view", 1);
2059
2038
  p([
2060
- b({ converter: pe })
2061
- ], o.prototype, "dropzone", 1);
2039
+ b({ converter: de })
2040
+ ], n.prototype, "dropzone", 1);
2062
2041
  p([
2063
- b({ converter: pe, attribute: "allow-rename" })
2064
- ], o.prototype, "allowRename", 1);
2042
+ b({ converter: de, attribute: "allow-rename" })
2043
+ ], n.prototype, "allowRename", 1);
2065
2044
  p([
2066
2045
  b({ type: Boolean, attribute: "auto-upload" })
2067
- ], o.prototype, "autoUpload", 1);
2068
- p([
2069
- b({ converter: pe })
2070
- ], o.prototype, "branding", 1);
2071
- p([
2072
- b({ attribute: "branding-text" })
2073
- ], o.prototype, "brandingText", 1);
2046
+ ], n.prototype, "autoUpload", 1);
2074
2047
  p([
2075
- b({ attribute: "branding-url" })
2076
- ], o.prototype, "brandingUrl", 1);
2048
+ b({ converter: de })
2049
+ ], n.prototype, "branding", 1);
2077
2050
  p([
2078
2051
  b({ attribute: "logo-url" })
2079
- ], o.prototype, "logoUrl", 1);
2052
+ ], n.prototype, "logoUrl", 1);
2080
2053
  p([
2081
2054
  b({ attribute: "logo-text" })
2082
- ], o.prototype, "logoText", 1);
2055
+ ], n.prototype, "logoText", 1);
2083
2056
  p([
2084
2057
  b()
2085
- ], o.prototype, "heading", 1);
2058
+ ], n.prototype, "heading", 1);
2086
2059
  p([
2087
2060
  b()
2088
- ], o.prototype, "description", 1);
2061
+ ], n.prototype, "description", 1);
2089
2062
  p([
2090
2063
  b({ type: Number, attribute: "max-files" })
2091
- ], o.prototype, "maxFiles", 1);
2064
+ ], n.prototype, "maxFiles", 1);
2092
2065
  p([
2093
2066
  b({ attribute: "max-size" })
2094
- ], o.prototype, "maxSize", 1);
2067
+ ], n.prototype, "maxSize", 1);
2095
2068
  p([
2096
2069
  b({ attribute: "min-size" })
2097
- ], o.prototype, "minSize", 1);
2070
+ ], n.prototype, "minSize", 1);
2098
2071
  p([
2099
2072
  b()
2100
- ], o.prototype, "accept", 1);
2073
+ ], n.prototype, "accept", 1);
2101
2074
  p([
2102
- b({ converter: ce })
2103
- ], o.prototype, "rules", 1);
2075
+ b({ converter: le })
2076
+ ], n.prototype, "rules", 1);
2104
2077
  p([
2105
2078
  b()
2106
- ], o.prototype, "bucket", 1);
2079
+ ], n.prototype, "bucket", 1);
2107
2080
  p([
2108
- b({ converter: ce })
2109
- ], o.prototype, "metadata", 1);
2081
+ b({ converter: le })
2082
+ ], n.prototype, "metadata", 1);
2110
2083
  p([
2111
- b({ converter: ce })
2112
- ], o.prototype, "options", 1);
2084
+ b({ converter: le })
2085
+ ], n.prototype, "options", 1);
2113
2086
  p([
2114
2087
  b({ type: Boolean, attribute: "public-read" })
2115
- ], o.prototype, "publicRead", 1);
2088
+ ], n.prototype, "publicRead", 1);
2116
2089
  p([
2117
2090
  b({ attribute: "redirect-url" })
2118
- ], o.prototype, "redirectUrl", 1);
2091
+ ], n.prototype, "redirectUrl", 1);
2119
2092
  p([
2120
2093
  b({ attribute: !1 })
2121
- ], o.prototype, "onComplete", 1);
2094
+ ], n.prototype, "onComplete", 1);
2122
2095
  p([
2123
2096
  b({ attribute: !1 })
2124
- ], o.prototype, "onError", 1);
2097
+ ], n.prototype, "onError", 1);
2125
2098
  p([
2126
- te()
2127
- ], o.prototype, "items", 1);
2099
+ Q()
2100
+ ], n.prototype, "items", 1);
2128
2101
  p([
2129
- te()
2130
- ], o.prototype, "notice", 1);
2102
+ Q()
2103
+ ], n.prototype, "notice", 1);
2131
2104
  p([
2132
- te()
2133
- ], o.prototype, "busy", 1);
2105
+ Q()
2106
+ ], n.prototype, "busy", 1);
2134
2107
  p([
2135
- te()
2136
- ], o.prototype, "dragging", 1);
2108
+ Q()
2109
+ ], n.prototype, "dragging", 1);
2137
2110
  p([
2138
- te()
2139
- ], o.prototype, "editing", 1);
2140
- o = p([
2141
- Ce("singlebase-uploader")
2142
- ], o);
2143
- function et(r) {
2111
+ Q()
2112
+ ], n.prototype, "editing", 1);
2113
+ n = p([
2114
+ Se("singlebase-uploader")
2115
+ ], n);
2116
+ function Ze(r) {
2144
2117
  return !r.type.startsWith("image/") || typeof URL.createObjectURL != "function" ? "" : URL.createObjectURL(r);
2145
2118
  }
2146
2119
  function w(r) {
2147
2120
  r.preview && URL.revokeObjectURL(r.preview);
2148
2121
  }
2149
- function tt(r) {
2122
+ function Qe(r) {
2150
2123
  return r instanceof Error ? r.message : "";
2151
2124
  }
2152
2125
  export {
2153
- o as S,
2154
- qe as a,
2155
- Ke as i,
2156
- Be as r,
2157
- Re as s
2126
+ n as S,
2127
+ _e as a,
2128
+ Ie as i,
2129
+ Pe as r,
2130
+ Ne as s
2158
2131
  };
2159
- //# sourceMappingURL=uploader-vfczkX51.js.map
2132
+ //# sourceMappingURL=uploader-tdMU9Gxv.js.map