haori-bootstrap 0.3.1 → 0.3.2

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,77 +1,77 @@
1
- function V(e) {
2
- return typeof e == "function";
3
- }
4
1
  function j(e) {
5
- return V(e?.Modal) ? e?.Modal : void 0;
2
+ return typeof e == "function";
6
3
  }
7
4
  function K(e) {
8
- return V(e?.Toast) ? e?.Toast : void 0;
5
+ return j(e?.Modal) ? e?.Modal : void 0;
9
6
  }
10
- function M(e) {
11
- return !!j(e);
7
+ function J(e) {
8
+ return j(e?.Toast) ? e?.Toast : void 0;
12
9
  }
13
- function se(e) {
10
+ function y(e) {
14
11
  return !!K(e);
15
12
  }
16
- function B(e, o, t) {
17
- const n = j(t);
13
+ function ae(e) {
14
+ return !!J(e);
15
+ }
16
+ function H(e, t, o) {
17
+ const n = K(o);
18
18
  if (n)
19
- return typeof n.getOrCreateInstance == "function" ? n.getOrCreateInstance(e, o) : new n(e, o);
19
+ return typeof n.getOrCreateInstance == "function" ? n.getOrCreateInstance(e, t) : new n(e, t);
20
20
  }
21
- function ae(e, o, t) {
22
- const n = K(t);
21
+ function ce(e, t, o) {
22
+ const n = J(o);
23
23
  if (n)
24
- return typeof n.getOrCreateInstance == "function" ? n.getOrCreateInstance(e, o) : new n(e, o);
24
+ return typeof n.getOrCreateInstance == "function" ? n.getOrCreateInstance(e, t) : new n(e, t);
25
25
  }
26
- const ce = "data-haori-bootstrap-dialog", w = "data-haori-bootstrap-action", le = "data-haori-bootstrap-dialog-title";
27
- let ue = 0;
28
- function J() {
26
+ const le = "data-haori-bootstrap-dialog", w = "data-haori-bootstrap-action", ue = "data-haori-bootstrap-dialog-title";
27
+ let de = 0;
28
+ function Q() {
29
29
  return {
30
30
  backdrop: "static",
31
31
  keyboard: !1
32
32
  };
33
33
  }
34
- function Q(e, o) {
35
- if (o.dialogContainerSelector) {
36
- const t = e.querySelector(
37
- o.dialogContainerSelector
34
+ function X(e, t) {
35
+ if (t.dialogContainerSelector) {
36
+ const o = e.querySelector(
37
+ t.dialogContainerSelector
38
38
  );
39
- if (t)
40
- return t;
39
+ if (o)
40
+ return o;
41
41
  }
42
42
  return e.body;
43
43
  }
44
- function X(e, o, t, n) {
44
+ function Y(e, t, o, n) {
45
45
  const r = e.createElement("div");
46
- r.className = "modal fade", r.tabIndex = -1, r.setAttribute(ce, "true"), r.setAttribute("aria-hidden", "true");
46
+ r.className = "modal fade", r.tabIndex = -1, r.setAttribute(le, "true"), r.setAttribute("aria-hidden", "true");
47
47
  const i = e.createElement("div");
48
48
  i.className = "modal-dialog modal-dialog-centered";
49
49
  const c = e.createElement("div");
50
50
  if (c.className = "modal-content", n) {
51
- const u = `haori-dialog-title-${++ue}`, p = e.createElement("div");
51
+ const u = `haori-dialog-title-${++de}`, p = e.createElement("div");
52
52
  p.className = "modal-header";
53
53
  const g = e.createElement("h5");
54
- g.className = "modal-title", g.id = u, g.setAttribute(le, "true"), g.textContent = n, p.appendChild(g), c.appendChild(p), r.setAttribute("aria-labelledby", u);
54
+ g.className = "modal-title", g.id = u, g.setAttribute(ue, "true"), g.textContent = n, p.appendChild(g), c.appendChild(p), r.setAttribute("aria-labelledby", u);
55
55
  }
56
56
  const a = e.createElement("div");
57
57
  a.className = "modal-body";
58
58
  const d = e.createElement("p");
59
- d.className = "mb-0", d.style.whiteSpace = "pre-line", d.textContent = o, a.appendChild(d);
59
+ d.className = "mb-0", d.style.whiteSpace = "pre-line", d.textContent = t, a.appendChild(d);
60
60
  const l = e.createElement("div");
61
- if (l.className = "modal-footer", t) {
61
+ if (l.className = "modal-footer", o) {
62
62
  const u = e.createElement("button");
63
63
  u.type = "button", u.className = "btn btn-secondary", u.setAttribute(w, "cancel"), u.textContent = "Cancel", l.appendChild(u);
64
64
  }
65
65
  const m = e.createElement("button");
66
66
  return m.type = "button", m.className = "btn btn-primary", m.setAttribute(w, "ok"), m.textContent = "OK", l.appendChild(m), c.append(a, l), i.appendChild(c), r.appendChild(i), r;
67
67
  }
68
- function de(e, o) {
69
- const t = globalThis.document, n = X(t, e, !1, o.dialogTitle);
70
- Q(t, o).appendChild(n);
71
- const r = B(
68
+ function fe(e, t) {
69
+ const o = globalThis.document, n = Y(o, e, !1, t.dialogTitle);
70
+ X(o, t).appendChild(n);
71
+ const r = H(
72
72
  n,
73
- J(),
74
- o.bootstrap
73
+ Q(),
74
+ t.bootstrap
75
75
  );
76
76
  return r ? new Promise((i, c) => {
77
77
  const a = () => {
@@ -93,13 +93,13 @@ function de(e, o) {
93
93
  }
94
94
  }) : (n.remove(), Promise.reject(new Error("Bootstrap Modal is unavailable.")));
95
95
  }
96
- function fe(e, o) {
97
- const t = globalThis.document, n = X(t, e, !0, o.dialogTitle);
98
- Q(t, o).appendChild(n);
99
- const r = B(
96
+ function me(e, t) {
97
+ const o = globalThis.document, n = Y(o, e, !0, t.dialogTitle);
98
+ X(o, t).appendChild(n);
99
+ const r = H(
100
100
  n,
101
- J(),
102
- o.bootstrap
101
+ Q(),
102
+ t.bootstrap
103
103
  );
104
104
  return r ? new Promise((i, c) => {
105
105
  let a = !1;
@@ -130,7 +130,7 @@ function fe(e, o) {
130
130
  }
131
131
  }) : (n.remove(), Promise.reject(new Error("Bootstrap Modal is unavailable.")));
132
132
  }
133
- const T = "data-haori-bootstrap-owned", b = "data-haori-bootstrap-message-container", C = "data-haori-bootstrap-invalid-target", y = "data-haori-bootstrap-valid-target";
133
+ const T = "data-haori-bootstrap-owned", b = "data-haori-bootstrap-message-container", C = "data-haori-bootstrap-invalid-target", M = "data-haori-bootstrap-valid-target";
134
134
  function S(e) {
135
135
  return e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio");
136
136
  }
@@ -140,81 +140,81 @@ function v(e) {
140
140
  function I(e) {
141
141
  return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement;
142
142
  }
143
- function H(e) {
143
+ function B(e) {
144
144
  return Array.from(e.children).find(
145
- (o) => o instanceof HTMLElement && o.getAttribute(b) === "true"
145
+ (t) => t instanceof HTMLElement && t.getAttribute(b) === "true"
146
146
  );
147
147
  }
148
- function Y(e, o) {
149
- const t = e.createElement("div");
150
- return t.setAttribute(T, "true"), t.textContent = o, t;
148
+ function Z(e, t) {
149
+ const o = e.createElement("div");
150
+ return o.setAttribute(T, "true"), o.textContent = t, o;
151
151
  }
152
- function Z(e) {
153
- return H(e);
152
+ function ee(e) {
153
+ return B(e);
154
154
  }
155
155
  function N(e) {
156
156
  if (e.name) {
157
- const o = e.form ?? e.ownerDocument, t = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e.name) : e.name.replace(/(["\\])/g, "\\$1"), n = Array.from(
158
- o.querySelectorAll(`input[type="radio"][name="${t}"]`)
157
+ const t = e.form ?? e.ownerDocument, o = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e.name) : e.name.replace(/(["\\])/g, "\\$1"), n = Array.from(
158
+ t.querySelectorAll(`input[type="radio"][name="${o}"]`)
159
159
  );
160
160
  if (n.length > 0)
161
161
  return n;
162
162
  }
163
163
  return [e];
164
164
  }
165
- function me(e) {
166
- const [o, ...t] = e;
167
- if (!o)
165
+ function be(e) {
166
+ const [t, ...o] = e;
167
+ if (!t)
168
168
  return;
169
- let n = o;
169
+ let n = t;
170
170
  for (; n; ) {
171
- if (t.every((r) => n?.contains(r)))
171
+ if (o.every((r) => n?.contains(r)))
172
172
  return n;
173
173
  n = n.parentElement;
174
174
  }
175
175
  }
176
- function _(e) {
177
- const t = N(e).map((n) => n.closest(".form-check")).filter((n) => n instanceof HTMLElement);
178
- if (t.length > 1) {
179
- const n = me(t);
180
- if (n && !t.includes(n))
176
+ function P(e) {
177
+ const o = N(e).map((n) => n.closest(".form-check")).filter((n) => n instanceof HTMLElement);
178
+ if (o.length > 1) {
179
+ const n = be(o);
180
+ if (n && !o.includes(n))
181
181
  return n;
182
182
  }
183
183
  return x(e);
184
184
  }
185
185
  function x(e) {
186
- const o = e.closest(".form-check");
187
- return o instanceof HTMLElement ? o : void 0;
188
- }
189
- function ee(e) {
190
- const o = e.nextElementSibling;
191
- if (o instanceof HTMLElement && o.getAttribute(b) === "true")
192
- return o;
193
- const t = document.createElement("div");
194
- return t.className = "invalid-feedback d-block", t.setAttribute(T, "true"), t.setAttribute(b, "true"), e.insertAdjacentElement("afterend", t), t;
186
+ const t = e.closest(".form-check");
187
+ return t instanceof HTMLElement ? t : void 0;
195
188
  }
196
- function be(e) {
197
- const o = v(e) ? _(e) : x(e);
198
- if (!o)
199
- return ee(e);
200
- const t = H(o);
201
- if (t)
189
+ function te(e) {
190
+ const t = e.nextElementSibling;
191
+ if (t instanceof HTMLElement && t.getAttribute(b) === "true")
202
192
  return t;
203
- const n = document.createElement("div");
204
- return n.className = "invalid-feedback d-block", n.setAttribute(T, "true"), n.setAttribute(b, "true"), o.appendChild(n), n;
193
+ const o = document.createElement("div");
194
+ return o.className = "invalid-feedback d-block", o.setAttribute(T, "true"), o.setAttribute(b, "true"), e.insertAdjacentElement("afterend", o), o;
205
195
  }
206
196
  function pe(e) {
207
- const o = Z(e);
197
+ const t = v(e) ? P(e) : x(e);
198
+ if (!t)
199
+ return te(e);
200
+ const o = B(t);
208
201
  if (o)
209
202
  return o;
210
- const t = document.createElement("div");
211
- return t.className = "alert alert-danger", t.setAttribute("role", "alert"), t.setAttribute(T, "true"), t.setAttribute(b, "true"), e.insertAdjacentElement("afterbegin", t), t;
203
+ const n = document.createElement("div");
204
+ return n.className = "invalid-feedback d-block", n.setAttribute(T, "true"), n.setAttribute(b, "true"), t.appendChild(n), n;
205
+ }
206
+ function he(e) {
207
+ const t = ee(e);
208
+ if (t)
209
+ return t;
210
+ const o = document.createElement("div");
211
+ return o.className = "alert alert-danger", o.setAttribute("role", "alert"), o.setAttribute(T, "true"), o.setAttribute(b, "true"), e.insertAdjacentElement("afterbegin", o), o;
212
212
  }
213
213
  function h(e) {
214
214
  e.getAttribute(C) === "true" && (e.classList.remove("is-invalid"), e.removeAttribute(C));
215
215
  }
216
216
  function E(e) {
217
- e.getAttribute(y) === "true" && (e.classList.remove("is-valid"), e.removeAttribute(y));
217
+ e.getAttribute(M) === "true" && (e.classList.remove("is-valid"), e.removeAttribute(M));
218
218
  }
219
219
  function q(e) {
220
220
  switch (e) {
@@ -231,58 +231,58 @@ function q(e) {
231
231
  function L(e) {
232
232
  return e === "success" ? "valid-feedback d-block" : "invalid-feedback d-block";
233
233
  }
234
- function te(e) {
235
- (v(e) ? N(e) : [e]).forEach((t) => {
236
- t.classList.add("is-invalid"), t.setAttribute(C, "true");
234
+ function oe(e) {
235
+ (v(e) ? N(e) : [e]).forEach((o) => {
236
+ o.classList.add("is-invalid"), o.setAttribute(C, "true");
237
237
  });
238
238
  }
239
- function he(e) {
240
- (v(e) ? N(e) : [e]).forEach((t) => {
241
- h(t);
239
+ function Ee(e) {
240
+ (v(e) ? N(e) : [e]).forEach((o) => {
241
+ h(o);
242
242
  });
243
243
  }
244
- function oe(e, o) {
245
- const t = e.nextElementSibling;
246
- if (t instanceof HTMLElement && t.getAttribute(b) === "true")
247
- return t.className = L(o), t;
244
+ function ne(e, t) {
245
+ const o = e.nextElementSibling;
246
+ if (o instanceof HTMLElement && o.getAttribute(b) === "true")
247
+ return o.className = L(t), o;
248
248
  const n = document.createElement("div");
249
- return n.className = L(o), n.setAttribute(T, "true"), n.setAttribute(b, "true"), e.insertAdjacentElement("afterend", n), n;
249
+ return n.className = L(t), n.setAttribute(T, "true"), n.setAttribute(b, "true"), e.insertAdjacentElement("afterend", n), n;
250
250
  }
251
- function Ee(e, o) {
252
- const t = v(e) ? _(e) : x(e);
253
- if (!t)
254
- return oe(e, o);
255
- const n = H(t);
251
+ function ve(e, t) {
252
+ const o = v(e) ? P(e) : x(e);
253
+ if (!o)
254
+ return ne(e, t);
255
+ const n = B(o);
256
256
  if (n)
257
- return n.className = L(o), n;
257
+ return n.className = L(t), n;
258
258
  const r = document.createElement("div");
259
- return r.className = L(o), r.setAttribute(T, "true"), r.setAttribute(b, "true"), t.appendChild(r), r;
259
+ return r.className = L(t), r.setAttribute(T, "true"), r.setAttribute(b, "true"), o.appendChild(r), r;
260
260
  }
261
- function ve(e, o) {
262
- const t = Z(e);
263
- if (t)
264
- return t.className = q(o), t;
261
+ function Te(e, t) {
262
+ const o = ee(e);
263
+ if (o)
264
+ return o.className = q(t), o;
265
265
  const n = document.createElement("div");
266
- return n.className = q(o), n.setAttribute("role", "alert"), n.setAttribute(T, "true"), n.setAttribute(b, "true"), e.insertAdjacentElement("afterbegin", n), n;
266
+ return n.className = q(t), n.setAttribute("role", "alert"), n.setAttribute(T, "true"), n.setAttribute(b, "true"), e.insertAdjacentElement("afterbegin", n), n;
267
267
  }
268
- function Te(e, o) {
269
- return (S(e) ? be(e) : I(e) ? ee(e) : pe(e)).appendChild(Y(document, o)), S(e) ? te(e) : I(e) && (e.classList.add("is-invalid"), e.setAttribute(C, "true")), Promise.resolve();
268
+ function Ae(e, t) {
269
+ return (S(e) ? pe(e) : I(e) ? te(e) : he(e)).appendChild(Z(document, t)), S(e) ? oe(e) : I(e) && (e.classList.add("is-invalid"), e.setAttribute(C, "true")), Promise.resolve();
270
270
  }
271
- function Ae(e, o, t) {
272
- if ((S(e) ? Ee(e, t) : I(e) ? oe(e, t) : ve(e, t)).appendChild(Y(document, o)), S(e)) {
271
+ function Ce(e, t, o) {
272
+ if ((S(e) ? ve(e, o) : I(e) ? ne(e, o) : Te(e, o)).appendChild(Z(document, t)), S(e)) {
273
273
  const r = v(e) ? N(e) : [e];
274
- t === "success" ? r.forEach((i) => {
275
- h(i), i.classList.add("is-valid"), i.setAttribute(y, "true");
276
- }) : !t || t === "error" ? (r.forEach((i) => E(i)), te(e)) : r.forEach((i) => {
274
+ o === "success" ? r.forEach((i) => {
275
+ h(i), i.classList.add("is-valid"), i.setAttribute(M, "true");
276
+ }) : !o || o === "error" ? (r.forEach((i) => E(i)), oe(e)) : r.forEach((i) => {
277
277
  E(i), h(i);
278
278
  });
279
- } else I(e) && (t === "success" ? (h(e), e.classList.add("is-valid"), e.setAttribute(y, "true")) : !t || t === "error" ? (E(e), e.classList.add("is-invalid"), e.setAttribute(C, "true")) : (E(e), h(e)));
279
+ } else I(e) && (o === "success" ? (h(e), e.classList.add("is-valid"), e.setAttribute(M, "true")) : !o || o === "error" ? (E(e), e.classList.add("is-invalid"), e.setAttribute(C, "true")) : (E(e), h(e)));
280
280
  return Promise.resolve();
281
281
  }
282
- function Ce(e) {
282
+ function ge(e) {
283
283
  if (S(e)) {
284
- const r = v(e) ? _(e) : x(e);
285
- (r ? H(r) : void 0)?.remove(), he(e), (v(e) ? N(e) : [e]).forEach((a) => E(a));
284
+ const r = v(e) ? P(e) : x(e);
285
+ (r ? B(r) : void 0)?.remove(), Ee(e), (v(e) ? N(e) : [e]).forEach((a) => E(a));
286
286
  } else if (I(e)) {
287
287
  const r = e.nextElementSibling;
288
288
  r instanceof HTMLElement && r.getAttribute(b) === "true" && r.remove(), h(e), E(e);
@@ -296,25 +296,25 @@ function Ce(e) {
296
296
  ).forEach((r) => {
297
297
  h(r);
298
298
  }), e.querySelectorAll(
299
- `[${y}="true"]`
299
+ `[${M}="true"]`
300
300
  ).forEach((r) => {
301
301
  E(r);
302
302
  }), Promise.resolve();
303
303
  }
304
- function ne(e) {
304
+ function re(e) {
305
305
  e.classList.contains("modal") || e.classList.add("modal"), e.tabIndex < 0 && (e.tabIndex = -1), e.hasAttribute("aria-hidden") || e.setAttribute("aria-hidden", "true");
306
306
  }
307
- function ge(e, o) {
308
- ne(e);
309
- const t = B(e, void 0, o.bootstrap);
310
- return t ? (t.show(), Promise.resolve()) : Promise.reject(new Error("Bootstrap Modal is unavailable."));
307
+ function we(e, t) {
308
+ re(e);
309
+ const o = H(e, void 0, t.bootstrap);
310
+ return o ? (o.show(), Promise.resolve()) : Promise.reject(new Error("Bootstrap Modal is unavailable."));
311
311
  }
312
- function we(e, o) {
313
- ne(e);
314
- const t = B(e, void 0, o.bootstrap);
315
- return t ? (t.hide(), Promise.resolve()) : Promise.reject(new Error("Bootstrap Modal is unavailable."));
312
+ function Me(e, t) {
313
+ re(e);
314
+ const o = H(e, void 0, t.bootstrap);
315
+ return o ? (o.hide(), Promise.resolve()) : Promise.reject(new Error("Bootstrap Modal is unavailable."));
316
316
  }
317
- const F = "data-haori-bootstrap-toast-container", ye = "data-haori-bootstrap-toast", Se = "data-haori-bootstrap-toast-accent", Ie = "data-haori-bootstrap-toast-dismiss", z = {
317
+ const F = "data-haori-bootstrap-toast-container", Se = "data-haori-bootstrap-toast", Ie = "data-haori-bootstrap-toast-accent", Ne = "data-haori-bootstrap-toast-dismiss", z = {
318
318
  "top-start": "top-0 start-0",
319
319
  "top-center": "top-0 start-50 translate-middle-x",
320
320
  "top-end": "top-0 end-0",
@@ -322,7 +322,7 @@ const F = "data-haori-bootstrap-toast-container", ye = "data-haori-bootstrap-toa
322
322
  "bottom-center": "bottom-0 start-50 translate-middle-x",
323
323
  "bottom-end": "bottom-0 end-0"
324
324
  };
325
- function Ne(e) {
325
+ function ye(e) {
326
326
  switch (e) {
327
327
  case "success":
328
328
  return { accentClassName: "bg-success" };
@@ -334,16 +334,16 @@ function Ne(e) {
334
334
  return { accentClassName: "bg-info" };
335
335
  }
336
336
  }
337
- function Me(e, o) {
338
- if (o.toastContainerSelector) {
339
- const t = e.querySelector(o.toastContainerSelector);
340
- if (t)
341
- return t;
337
+ function ke(e, t) {
338
+ if (t.toastContainerSelector) {
339
+ const o = e.querySelector(t.toastContainerSelector);
340
+ if (o)
341
+ return o;
342
342
  }
343
343
  return e.body;
344
344
  }
345
- function ke(e, o) {
346
- const t = Me(e, o), n = z[o.toastPosition ?? "bottom-end"], r = t.querySelector(
345
+ function Le(e, t) {
346
+ const o = ke(e, t), n = z[t.toastPosition ?? "bottom-end"], r = o.querySelector(
347
347
  `[${F}="true"]`
348
348
  );
349
349
  if (r) {
@@ -351,20 +351,20 @@ function ke(e, o) {
351
351
  return r.classList.remove(...c), r.classList.add(...n.split(" ")), r;
352
352
  }
353
353
  const i = e.createElement("div");
354
- return i.className = `toast-container position-fixed ${n} p-3`, i.setAttribute(F, "true"), t.appendChild(i), i;
354
+ return i.className = `toast-container position-fixed ${n} p-3`, i.setAttribute(F, "true"), o.appendChild(i), i;
355
355
  }
356
- function Le(e, o, t) {
357
- const n = globalThis.document, r = Ne(o), i = n.createElement("div");
358
- i.className = "toast border bg-body text-body shadow-sm", i.setAttribute("role", "status"), i.setAttribute("aria-live", "polite"), i.setAttribute("aria-atomic", "true"), i.setAttribute(ye, "true");
356
+ function He(e, t, o) {
357
+ const n = globalThis.document, r = ye(t), i = n.createElement("div");
358
+ i.className = "toast border bg-body text-body shadow-sm", i.setAttribute("role", "status"), i.setAttribute("aria-live", "polite"), i.setAttribute("aria-atomic", "true"), i.setAttribute(Se, "true");
359
359
  const c = n.createElement("div");
360
360
  c.className = "d-flex align-items-stretch";
361
361
  const a = n.createElement("div");
362
- a.className = `flex-shrink-0 rounded-start ${r.accentClassName}`, a.style.width = "0.375rem", a.setAttribute(Se, "true");
362
+ a.className = `flex-shrink-0 rounded-start ${r.accentClassName}`, a.style.width = "0.375rem", a.setAttribute(Ie, "true");
363
363
  const d = n.createElement("div");
364
364
  d.className = "toast-body", d.style.whiteSpace = "pre-line", d.textContent = e;
365
365
  const l = n.createElement("button");
366
- l.type = "button", l.className = "btn-close me-2 m-auto flex-shrink-0", l.setAttribute("aria-label", "Close"), l.setAttribute(Ie, "true"), c.appendChild(a), c.appendChild(d), c.appendChild(l), i.appendChild(c), ke(n, t).appendChild(i);
367
- const m = t.toastDelay !== void 0 ? { delay: t.toastDelay } : void 0, u = ae(i, m, t.bootstrap);
366
+ l.type = "button", l.className = "btn-close me-2 m-auto flex-shrink-0", l.setAttribute("aria-label", "Close"), l.setAttribute(Ne, "true"), c.appendChild(a), c.appendChild(d), c.appendChild(l), i.appendChild(c), Le(n, o).appendChild(i);
367
+ const m = o.toastDelay !== void 0 ? { delay: o.toastDelay } : void 0, u = ce(i, m, o.bootstrap);
368
368
  if (!u)
369
369
  return i.remove(), Promise.reject(new Error("Bootstrap Toast is unavailable."));
370
370
  l.addEventListener("click", () => {
@@ -392,57 +392,57 @@ function A(e) {
392
392
  return e.replace(/\\n/g, `
393
393
  `);
394
394
  }
395
- function re() {
395
+ function ie() {
396
396
  return globalThis.window;
397
397
  }
398
- function D(e) {
398
+ function _(e) {
399
399
  return Promise.resolve(e).then(() => {
400
400
  });
401
401
  }
402
- function P(e) {
403
- const o = f.originalHaori?.[e];
404
- return typeof o == "function" ? o : void 0;
405
- }
406
402
  function R(e) {
407
- console.warn(`[haori-bootstrap] ${e} skipped because Bootstrap support is unavailable.`);
403
+ const t = f.originalHaori?.[e];
404
+ return typeof t == "function" ? t : void 0;
408
405
  }
409
- function W(e) {
410
- const o = A(e), t = P("dialog");
411
- if (t)
412
- return D(t(o));
413
- const n = re();
414
- return f.options.fallbackToNative && typeof n?.alert == "function" ? (n.alert(o), Promise.resolve()) : (R("dialog"), Promise.resolve());
406
+ function D(e) {
407
+ console.warn(`[haori-bootstrap] ${e} skipped because Bootstrap support is unavailable.`);
415
408
  }
416
409
  function O(e) {
417
- const o = A(e), t = P("confirm");
418
- if (t)
419
- return Promise.resolve(t(o)).then(
410
+ const t = A(e), o = R("dialog");
411
+ if (o)
412
+ return _(o(t));
413
+ const n = ie();
414
+ return f.options.fallbackToNative && typeof n?.alert == "function" ? (n.alert(t), Promise.resolve()) : (D("dialog"), Promise.resolve());
415
+ }
416
+ function W(e) {
417
+ const t = A(e), o = R("confirm");
418
+ if (o)
419
+ return Promise.resolve(o(t)).then(
420
420
  (r) => !!r
421
421
  );
422
- const n = re();
423
- return f.options.fallbackToNative && typeof n?.confirm == "function" ? Promise.resolve(n.confirm(o)) : (R("confirm"), Promise.resolve(!1));
422
+ const n = ie();
423
+ return f.options.fallbackToNative && typeof n?.confirm == "function" ? Promise.resolve(n.confirm(t)) : (D("confirm"), Promise.resolve(!1));
424
424
  }
425
- function G(e, o) {
426
- const t = A(e), n = P("toast");
427
- return n ? D(n(t, o)) : (R("toast"), Promise.resolve());
425
+ function G(e, t) {
426
+ const o = A(e), n = R("toast");
427
+ return n ? _(n(o, t)) : (D("toast"), Promise.resolve());
428
428
  }
429
- function k(e, o) {
430
- const t = P(e);
431
- return t ? D(t(o)) : (R(e), Promise.resolve());
429
+ function k(e, t) {
430
+ const o = R(e);
431
+ return o ? _(o(t)) : (D(e), Promise.resolve());
432
432
  }
433
- function He(e) {
433
+ function xe(e) {
434
434
  f = e;
435
435
  }
436
- class xe {
436
+ class Re {
437
437
  /**
438
438
  * 情報表示ダイアログを表示する。
439
439
  *
440
440
  * @param message 表示するメッセージ。
441
441
  * @return 完了時に解決される Promise。
442
442
  */
443
- static dialog(o) {
444
- const t = A(o);
445
- return M(f.options.bootstrap) ? de(t, f.options).catch(() => W(t)) : W(t);
443
+ static dialog(t) {
444
+ const o = A(t);
445
+ return y(f.options.bootstrap) ? fe(o, f.options).catch(() => O(o)) : O(o);
446
446
  }
447
447
  /**
448
448
  * 確認ダイアログを表示する。
@@ -450,9 +450,9 @@ class xe {
450
450
  * @param message 表示するメッセージ。
451
451
  * @return OK のみ true を返す Promise。
452
452
  */
453
- static confirm(o) {
454
- const t = A(o);
455
- return M(f.options.bootstrap) ? fe(t, f.options).catch(() => O(t)) : O(t);
453
+ static confirm(t) {
454
+ const o = A(t);
455
+ return y(f.options.bootstrap) ? me(o, f.options).catch(() => W(o)) : W(o);
456
456
  }
457
457
  /**
458
458
  * トースト通知を表示する。
@@ -461,11 +461,11 @@ class xe {
461
461
  * @param level 通知レベル。
462
462
  * @return 完了時に解決される Promise。
463
463
  */
464
- static toast(o, t) {
465
- const n = A(o);
466
- return se(f.options.bootstrap) ? Le(n, t, f.options).catch(
467
- () => G(n, t)
468
- ) : G(n, t);
464
+ static toast(t, o) {
465
+ const n = A(t);
466
+ return ae(f.options.bootstrap) ? He(n, o, f.options).catch(
467
+ () => G(n, o)
468
+ ) : G(n, o);
469
469
  }
470
470
  /**
471
471
  * 任意のダイアログ要素を開く。
@@ -473,10 +473,10 @@ class xe {
473
473
  * @param element 開く対象の要素。
474
474
  * @return 完了時に解決される Promise。
475
475
  */
476
- static openDialog(o) {
477
- return M(f.options.bootstrap) ? ge(o, f.options).catch(
478
- () => k("openDialog", o)
479
- ) : k("openDialog", o);
476
+ static openDialog(t) {
477
+ return y(f.options.bootstrap) ? we(t, f.options).catch(
478
+ () => k("openDialog", t)
479
+ ) : k("openDialog", t);
480
480
  }
481
481
  /**
482
482
  * 任意のダイアログ要素を閉じる。
@@ -484,10 +484,10 @@ class xe {
484
484
  * @param element 閉じる対象の要素。
485
485
  * @return 完了時に解決される Promise。
486
486
  */
487
- static closeDialog(o) {
488
- return M(f.options.bootstrap) ? we(o, f.options).catch(
489
- () => k("closeDialog", o)
490
- ) : k("closeDialog", o);
487
+ static closeDialog(t) {
488
+ return y(f.options.bootstrap) ? Me(t, f.options).catch(
489
+ () => k("closeDialog", t)
490
+ ) : k("closeDialog", t);
491
491
  }
492
492
  /**
493
493
  * 管理対象のエラーメッセージを追加する。
@@ -496,8 +496,8 @@ class xe {
496
496
  * @param message 表示するメッセージ。
497
497
  * @return 完了時に解決される Promise。
498
498
  */
499
- static addErrorMessage(o, t) {
500
- return Te(o, t);
499
+ static addErrorMessage(t, o) {
500
+ return Ae(t, o);
501
501
  }
502
502
  /**
503
503
  * 管理対象のメッセージをレベル付きで追加する。
@@ -507,8 +507,8 @@ class xe {
507
507
  * @param level メッセージレベル (error / success / warning / info)。省略時は error。
508
508
  * @return 完了時に解決される Promise。
509
509
  */
510
- static addMessage(o, t, n) {
511
- return Ae(o, t, n);
510
+ static addMessage(t, o, n) {
511
+ return Ce(t, o, n);
512
512
  }
513
513
  /**
514
514
  * 管理対象のメッセージを削除する。
@@ -516,24 +516,45 @@ class xe {
516
516
  * @param parentOrTarget 削除対象の親要素または対象要素。
517
517
  * @return 完了時に解決される Promise。
518
518
  */
519
- static clearMessages(o) {
520
- return Ce(o);
519
+ static clearMessages(t) {
520
+ return ge(t);
521
521
  }
522
522
  }
523
523
  const $ = {
524
524
  fallbackToNative: !0
525
- }, s = {
525
+ }, V = /* @__PURE__ */ new Set([
526
+ "dialog",
527
+ "confirm",
528
+ "toast",
529
+ "openDialog",
530
+ "closeDialog",
531
+ "addErrorMessage",
532
+ "addMessage",
533
+ "clearMessages"
534
+ ]);
535
+ function De(e) {
536
+ const t = Re;
537
+ return new Proxy(e, {
538
+ get(o, n, r) {
539
+ return typeof n == "string" && V.has(n) ? t[n] : Reflect.get(o, n, r);
540
+ },
541
+ has(o, n) {
542
+ return typeof n == "string" && V.has(n) ? !0 : Reflect.has(o, n);
543
+ }
544
+ });
545
+ }
546
+ const s = {
526
547
  installed: !1,
527
548
  options: $
528
549
  };
529
550
  function U() {
530
551
  return globalThis.window;
531
552
  }
532
- function Pe(e, o) {
553
+ function Pe(e, t) {
533
554
  return {
534
- bootstrap: e.bootstrap ?? o?.bootstrap,
555
+ bootstrap: e.bootstrap ?? t?.bootstrap,
535
556
  fallbackToNative: e.fallbackToNative ?? $.fallbackToNative,
536
- runtime: e.runtime ?? s.options.runtime ?? o?.Haori?.runtime,
557
+ runtime: e.runtime ?? s.options.runtime ?? t?.Haori?.runtime,
537
558
  toastContainerSelector: e.toastContainerSelector ?? s.options.toastContainerSelector,
538
559
  dialogContainerSelector: e.dialogContainerSelector ?? s.options.dialogContainerSelector,
539
560
  dialogTitle: e.dialogTitle ?? s.options.dialogTitle,
@@ -541,65 +562,68 @@ function Pe(e, o) {
541
562
  toastDelay: e.toastDelay ?? s.options.toastDelay
542
563
  };
543
564
  }
544
- function Re(e = U()) {
565
+ function _e(e = U()) {
545
566
  return !!(e?.Haori && e.bootstrap);
546
567
  }
547
- function _e(e = {}) {
548
- const o = U();
549
- if (!o?.Haori)
568
+ function $e(e = {}) {
569
+ const t = U();
570
+ if (!t?.Haori)
550
571
  throw new Error("window.Haori is required before calling install().");
551
- if (s.originalHaori || (s.originalHaori = o.Haori, s.originalRuntime = o.Haori.runtime), s.options = Pe(e, o), s.options.runtime) {
552
- const t = s.originalHaori ?? o.Haori;
553
- typeof t.setRuntime == "function" ? t.setRuntime(s.options.runtime) : console.warn(
572
+ if (s.originalHaori || (s.originalHaori = t.Haori, s.originalRuntime = t.Haori.runtime), s.options = Pe(e, t), s.options.runtime) {
573
+ const o = s.originalHaori ?? t.Haori;
574
+ typeof o.setRuntime == "function" ? o.setRuntime(s.options.runtime) : console.warn(
554
575
  "[haori-bootstrap] Haori.setRuntime が利用できません。runtime 設定は無視されます。"
555
576
  );
556
577
  }
557
- He({
578
+ xe({
558
579
  originalHaori: s.originalHaori,
559
580
  options: s.options
560
- }), o.Haori = xe, s.installed = !0;
581
+ }), t.Haori = De(s.originalHaori), s.installed = !0;
561
582
  }
562
- function Fe() {
583
+ function Oe() {
563
584
  const e = U();
564
- !e || !s.originalHaori || (s.originalHaori.runtime = s.originalRuntime, e.Haori = s.originalHaori, s.installed = !1, s.originalHaori = void 0, s.originalRuntime = void 0, s.options = $);
585
+ if (!e || !s.originalHaori)
586
+ return;
587
+ const t = s.originalHaori;
588
+ typeof t.setRuntime == "function" ? t.setRuntime(s.originalRuntime) : t.runtime = s.originalRuntime, e.Haori = s.originalHaori, s.installed = !1, s.originalHaori = void 0, s.originalRuntime = void 0, s.options = $;
565
589
  }
566
- function ze() {
590
+ function We() {
567
591
  return s.installed;
568
592
  }
569
- const ie = "__haoriJsBootstrapAutoEnabled__";
570
- function De() {
593
+ const se = "__haoriJsBootstrapAutoEnabled__";
594
+ function Ue() {
571
595
  return globalThis.window;
572
596
  }
573
- function $e(e) {
574
- return !!e[ie];
597
+ function qe(e) {
598
+ return !!e[se];
575
599
  }
576
- function Ue(e) {
577
- e[ie] = !0;
600
+ function Fe(e) {
601
+ e[se] = !0;
578
602
  }
579
- function qe() {
580
- const e = De();
581
- if (!(!e || $e(e))) {
582
- if (!Re(e)) {
603
+ function ze() {
604
+ const e = Ue();
605
+ if (!(!e || qe(e))) {
606
+ if (!_e(e)) {
583
607
  console.warn(
584
608
  "[haori-bootstrap] Auto-enable skipped because window.Haori or window.bootstrap is missing."
585
609
  );
586
610
  return;
587
611
  }
588
612
  try {
589
- _e({ bootstrap: e.bootstrap }), Ue(e);
590
- } catch (o) {
591
- console.warn("[haori-bootstrap] Auto-enable failed.", o);
613
+ $e({ bootstrap: e.bootstrap }), Fe(e);
614
+ } catch (t) {
615
+ console.warn("[haori-bootstrap] Auto-enable failed.", t);
592
616
  }
593
617
  }
594
618
  }
595
- qe();
596
- const We = "0.3.1";
619
+ ze();
620
+ const Ge = "0.3.2";
597
621
  export {
598
- xe as BootstrapHaori,
599
- Re as hasAutoEnablePrerequisites,
600
- _e as install,
601
- ze as isInstalled,
602
- Fe as uninstall,
603
- We as version
622
+ Re as BootstrapHaori,
623
+ _e as hasAutoEnablePrerequisites,
624
+ $e as install,
625
+ We as isInstalled,
626
+ Oe as uninstall,
627
+ Ge as version
604
628
  };
605
629
  //# sourceMappingURL=haori-bootstrap.js.map