haori 0.4.4 → 0.4.5

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.
package/dist/haori.es.js CHANGED
@@ -30,12 +30,12 @@ const O = class O {
30
30
  };
31
31
  O.devMode = !1;
32
32
  let B = O;
33
- const Y = "embedded";
34
- function tt(F) {
33
+ const z = "embedded";
34
+ function rt(F) {
35
35
  return F === "embedded" || F === "demo";
36
36
  }
37
- function et(F) {
38
- return F === null ? null : tt(F) ? F : Y;
37
+ function it(F) {
38
+ return F === null ? null : rt(F) ? F : z;
39
39
  }
40
40
  const D = class D {
41
41
  /**
@@ -53,7 +53,7 @@ const D = class D {
53
53
  * @return 戻り値はありません。
54
54
  */
55
55
  static setRuntime(t) {
56
- D._runtime = tt(t) ? t : Y;
56
+ D._runtime = rt(t) ? t : z;
57
57
  }
58
58
  /**
59
59
  * 実行環境からプレフィックスと開発モードかどうかを自動検出します。
@@ -67,7 +67,7 @@ const D = class D {
67
67
  if (t instanceof HTMLScriptElement) {
68
68
  const r = t.getAttribute("data-prefix") || D._prefix;
69
69
  D._prefix = r.endsWith("-") ? r : r + "-";
70
- const i = et(
70
+ const i = it(
71
71
  t.getAttribute("data-runtime")
72
72
  );
73
73
  i !== null && (D._runtime = i);
@@ -94,10 +94,10 @@ const D = class D {
94
94
  return D._prefix;
95
95
  }
96
96
  };
97
- D._prefix = "data-", D._runtime = Y;
98
- let l = D;
99
- document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", l.detect) : l.detect();
100
- class f {
97
+ D._prefix = "data-", D._runtime = z;
98
+ let c = D;
99
+ document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", c.detect) : c.detect();
100
+ class d {
101
101
  /**
102
102
  * 開発モードでのみコンソールに情報を出力します。
103
103
  *
@@ -126,7 +126,7 @@ class f {
126
126
  console.error(t, ...e);
127
127
  }
128
128
  }
129
- class rt {
129
+ class st {
130
130
  constructor() {
131
131
  this.MAX_BUDGET = 8, this.queue = [], this.processing = !1;
132
132
  }
@@ -139,16 +139,16 @@ class rt {
139
139
  */
140
140
  enqueue(t, e = !1) {
141
141
  let r, i;
142
- const s = new Promise((a, o) => {
142
+ const n = new Promise((a, o) => {
143
143
  r = a, i = o;
144
- }), n = {
144
+ }), s = {
145
145
  task: t,
146
146
  timestamp: performance.now(),
147
- promise: s,
147
+ promise: n,
148
148
  resolve: r,
149
149
  reject: i
150
150
  };
151
- return e ? this.queue.unshift(n) : this.queue.push(n), this.scheduleProcessing(), s;
151
+ return e ? this.queue.unshift(s) : this.queue.push(s), this.scheduleProcessing(), n;
152
152
  }
153
153
  /**
154
154
  * キューを処理します。
@@ -168,13 +168,13 @@ class rt {
168
168
  const r = await e.task();
169
169
  e.resolve(r);
170
170
  } catch (r) {
171
- e.reject(r), f.error("[Haori]", `Task ${e.timestamp} failed:`, r);
171
+ e.reject(r), d.error("[Haori]", `Task ${e.timestamp} failed:`, r);
172
172
  }
173
173
  if (performance.now() - t > this.MAX_BUDGET)
174
174
  break;
175
175
  }
176
176
  } catch (t) {
177
- f.error("[Haori]", "Error processing queue:", t);
177
+ d.error("[Haori]", "Error processing queue:", t);
178
178
  } finally {
179
179
  this.processing = !1, this.queue.length > 0 && this.scheduleProcessing();
180
180
  }
@@ -202,7 +202,7 @@ class rt {
202
202
  t.length > 0 && await Promise.allSettled(t);
203
203
  }
204
204
  }
205
- const Q = class Q {
205
+ const _ = class _ {
206
206
  /**
207
207
  * タスクをキューに追加します。
208
208
  *
@@ -220,16 +220,16 @@ const Q = class Q {
220
220
  return this.ASYNC_QUEUE.wait();
221
221
  }
222
222
  };
223
- Q.ASYNC_QUEUE = new rt();
224
- let P = Q;
225
- class X {
223
+ _.ASYNC_QUEUE = new st();
224
+ let P = _;
225
+ class J {
226
226
  /**
227
227
  * 実行モードを取得します。
228
228
  *
229
229
  * @return 実行モード。
230
230
  */
231
231
  static get runtime() {
232
- return l.runtime;
232
+ return c.runtime;
233
233
  }
234
234
  /**
235
235
  * 実行モードを設定します。
@@ -238,7 +238,7 @@ class X {
238
238
  * @return 戻り値はありません。
239
239
  */
240
240
  static setRuntime(t) {
241
- l.setRuntime(t);
241
+ c.setRuntime(t);
242
242
  }
243
243
  /**
244
244
  * 通知ダイアログを表示します。
@@ -284,7 +284,7 @@ class X {
284
284
  */
285
285
  static openDialog(t) {
286
286
  return P.enqueue(() => {
287
- t instanceof HTMLDialogElement ? t.showModal() : f.error("[Haori]", "Element is not a dialog: ", t);
287
+ t instanceof HTMLDialogElement ? t.showModal() : d.error("[Haori]", "Element is not a dialog: ", t);
288
288
  }, !0);
289
289
  }
290
290
  /**
@@ -294,7 +294,7 @@ class X {
294
294
  */
295
295
  static closeDialog(t) {
296
296
  return P.enqueue(() => {
297
- t instanceof HTMLDialogElement ? t.close() : f.error("[Haori]", "Element is not a dialog: ", t);
297
+ t instanceof HTMLDialogElement ? t.close() : d.error("[Haori]", "Element is not a dialog: ", t);
298
298
  }, !0);
299
299
  }
300
300
  /**
@@ -304,7 +304,7 @@ class X {
304
304
  * @param message エラーメッセージ
305
305
  */
306
306
  static addErrorMessage(t, e) {
307
- return X.addMessage(t, e, "error");
307
+ return J.addMessage(t, e, "error");
308
308
  }
309
309
  /**
310
310
  * メッセージをレベル付きで追加します。
@@ -332,12 +332,12 @@ class X {
332
332
  }, !0);
333
333
  }
334
334
  }
335
- const it = ["addErrorMessage", "clearMessages"];
336
- function _() {
335
+ const nt = ["addErrorMessage", "clearMessages"];
336
+ function et() {
337
337
  const t = globalThis.window?.Haori;
338
- return it.every(
338
+ return nt.every(
339
339
  (r) => typeof t?.[r] == "function"
340
- ) ? t : X;
340
+ ) ? t : J;
341
341
  }
342
342
  class b {
343
343
  /**
@@ -361,32 +361,32 @@ class b {
361
361
  * @returns values と同じオブジェクト
362
362
  */
363
363
  static getPartValues(t, e) {
364
- const r = t.getAttribute("name"), i = t.getAttribute(`${l.prefix}form-object`), s = t.getAttribute(`${l.prefix}form-list`);
364
+ const r = t.getAttribute("name"), i = t.getAttribute(`${c.prefix}form-object`), n = t.getAttribute(`${c.prefix}form-list`);
365
365
  if (r) {
366
- s ? Array.isArray(e[String(r)]) ? e[String(r)].push(t.getValue()) : e[String(r)] = [t.getValue()] : e[String(r)] = t.getValue(), i && f.warn(
366
+ n ? Array.isArray(e[String(r)]) ? e[String(r)].push(t.getValue()) : e[String(r)] = [t.getValue()] : e[String(r)] = t.getValue(), i && d.warn(
367
367
  "Haori",
368
- `Element cannot have both ${l.prefix}form-object and name attributes.`
368
+ `Element cannot have both ${c.prefix}form-object and name attributes.`
369
369
  );
370
- for (const n of t.getChildElementFragments())
371
- b.getPartValues(n, e);
370
+ for (const s of t.getChildElementFragments())
371
+ b.getPartValues(s, e);
372
372
  } else if (i) {
373
- const n = {};
373
+ const s = {};
374
374
  for (const a of t.getChildElementFragments())
375
- b.getPartValues(a, n);
376
- Object.keys(n).length > 0 && (e[String(i)] = n), s && f.warn(
375
+ b.getPartValues(a, s);
376
+ Object.keys(s).length > 0 && (e[String(i)] = s), n && d.warn(
377
377
  "Haori",
378
- `Element cannot have both ${l.prefix}form-list and ${l.prefix}form-object attributes.`
378
+ `Element cannot have both ${c.prefix}form-list and ${c.prefix}form-object attributes.`
379
379
  );
380
- } else if (s) {
381
- const n = [];
380
+ } else if (n) {
381
+ const s = [];
382
382
  for (const a of t.getChildElementFragments()) {
383
383
  const o = {};
384
- b.getPartValues(a, o), Object.keys(o).length > 0 && n.push(o);
384
+ b.getPartValues(a, o), Object.keys(o).length > 0 && s.push(o);
385
385
  }
386
- n.length > 0 && (e[String(s)] = n);
386
+ s.length > 0 && (e[String(n)] = s);
387
387
  } else
388
- for (const n of t.getChildElementFragments())
389
- b.getPartValues(n, e);
388
+ for (const s of t.getChildElementFragments())
389
+ b.getPartValues(s, e);
390
390
  return e;
391
391
  }
392
392
  /**
@@ -433,53 +433,53 @@ class b {
433
433
  * @param force data-form-detach属性があるエレメントにも値を反映するかどうか
434
434
  * @returns Promise(DOMの更新が完了したら解決される)
435
435
  */
436
- static setPartValues(t, e, r = null, i = !1, s = !0) {
437
- const n = [], a = t.getAttribute("name"), o = t.getAttribute(`${l.prefix}form-object`), d = t.getAttribute(`${l.prefix}form-list`), m = t.getAttribute(`${l.prefix}form-detach`);
436
+ static setPartValues(t, e, r = null, i = !1, n = !0) {
437
+ const s = [], a = t.getAttribute("name"), o = t.getAttribute(`${c.prefix}form-object`), u = t.getAttribute(`${c.prefix}form-list`), m = t.getAttribute(`${c.prefix}form-detach`);
438
438
  if (a) {
439
439
  if (!m || i) {
440
440
  const y = e[String(a)];
441
- d && Array.isArray(y) && r !== null ? n.push(
442
- b.applyFragmentValue(t, y[r] ?? null, s)
443
- ) : typeof y > "u" || (typeof y == "string" || typeof y == "number" || typeof y == "boolean" || y === null ? n.push(b.applyFragmentValue(t, y, s)) : n.push(
444
- b.applyFragmentValue(t, String(y), s)
441
+ u && Array.isArray(y) && r !== null ? s.push(
442
+ b.applyFragmentValue(t, y[r] ?? null, n)
443
+ ) : typeof y > "u" || (typeof y == "string" || typeof y == "number" || typeof y == "boolean" || y === null ? s.push(b.applyFragmentValue(t, y, n)) : s.push(
444
+ b.applyFragmentValue(t, String(y), n)
445
445
  ));
446
446
  }
447
447
  } else if (o) {
448
448
  const y = e[String(o)];
449
449
  if (y && typeof y == "object")
450
450
  for (const E of t.getChildElementFragments())
451
- n.push(
451
+ s.push(
452
452
  b.setPartValues(
453
453
  E,
454
454
  y,
455
455
  null,
456
456
  i,
457
- s
457
+ n
458
458
  )
459
459
  );
460
- } else if (d) {
461
- const y = e[String(d)];
460
+ } else if (u) {
461
+ const y = e[String(u)];
462
462
  if (Array.isArray(y)) {
463
463
  const E = t.getChildElementFragments();
464
464
  for (let S = 0; S < E.length; S++) {
465
- const u = E[S];
466
- y.length > S ? n.push(
465
+ const h = E[S];
466
+ y.length > S ? s.push(
467
467
  b.setPartValues(
468
- u,
468
+ h,
469
469
  y[S],
470
470
  S,
471
471
  i,
472
- s
472
+ n
473
473
  )
474
- ) : n.push(b.setPartValues(u, {}, S, i, s));
474
+ ) : s.push(b.setPartValues(h, {}, S, i, n));
475
475
  }
476
476
  }
477
477
  } else
478
478
  for (const y of t.getChildElementFragments())
479
- n.push(
480
- b.setPartValues(y, e, null, i, s)
479
+ s.push(
480
+ b.setPartValues(y, e, null, i, n)
481
481
  );
482
- return Promise.all(n).then(() => {
482
+ return Promise.all(s).then(() => {
483
483
  });
484
484
  }
485
485
  /**
@@ -500,11 +500,11 @@ class b {
500
500
  else {
501
501
  const r = e.parentElement;
502
502
  if (r) {
503
- const i = e.nextElementSibling, s = document.createElement("form");
504
- s.appendChild(e), s.reset(), r.insertBefore(e, i);
503
+ const i = e.nextElementSibling, n = document.createElement("form");
504
+ n.appendChild(e), n.reset(), r.insertBefore(e, i);
505
505
  }
506
506
  }
507
- }), await x.evaluateAll(t);
507
+ }), await R.evaluateAll(t);
508
508
  }
509
509
  /**
510
510
  * data-each によって生成された複製(テンプレート以外)を削除します。
@@ -513,20 +513,20 @@ class b {
513
513
  * 対象エレメント自体は削除しません。
514
514
  */
515
515
  static clearEachClones(t) {
516
- const e = [], r = (s) => {
517
- if (s.hasAttribute(`${l.prefix}each`))
518
- for (const n of s.getChildElementFragments()) {
519
- const a = n.hasAttribute(`${l.prefix}each-before`), o = n.hasAttribute(`${l.prefix}each-after`);
520
- !a && !o && e.push(n.remove());
516
+ const e = [], r = (n) => {
517
+ if (n.hasAttribute(`${c.prefix}each`))
518
+ for (const s of n.getChildElementFragments()) {
519
+ const a = s.hasAttribute(`${c.prefix}each-before`), o = s.hasAttribute(`${c.prefix}each-after`);
520
+ !a && !o && e.push(s.remove());
521
521
  }
522
- }, i = (s) => {
523
- r(s);
524
- for (const n of s.getChildElementFragments())
525
- i(n);
522
+ }, i = (n) => {
523
+ r(n);
524
+ for (const s of n.getChildElementFragments())
525
+ i(s);
526
526
  };
527
527
  r(t);
528
- for (const s of t.getChildElementFragments())
529
- i(s);
528
+ for (const n of t.getChildElementFragments())
529
+ i(n);
530
530
  return Promise.all(e).then(() => {
531
531
  });
532
532
  }
@@ -547,7 +547,7 @@ class b {
547
547
  * @returns Promise(メッセージのクリアが完了したら解決される)
548
548
  */
549
549
  static clearMessages(t) {
550
- return _().clearMessages(
550
+ return et().clearMessages(
551
551
  t.getTarget()
552
552
  );
553
553
  }
@@ -574,10 +574,10 @@ class b {
574
574
  * @return Promise(メッセージの追加が完了したら解決される)
575
575
  */
576
576
  static addMessage(t, e, r, i) {
577
- const s = [], n = _(), a = n.addMessage, o = (m) => typeof a == "function" ? a.call(n, m, r, i) : n.addErrorMessage(m, r), d = b.findFragmentsByKey(t, e);
578
- return d.forEach((m) => {
579
- s.push(o(m.getTarget()));
580
- }), d.length === 0 && s.push(o(t.getTarget())), Promise.all(s).then(() => {
577
+ const n = [], s = et(), a = s.addMessage, o = (m) => typeof a == "function" ? a.call(s, m, r, i) : s.addErrorMessage(m, r), u = b.findFragmentsByKey(t, e);
578
+ return u.forEach((m) => {
579
+ n.push(o(m.getTarget()));
580
+ }), u.length === 0 && n.push(o(t.getTarget())), Promise.all(n).then(() => {
581
581
  });
582
582
  }
583
583
  /**
@@ -600,21 +600,21 @@ class b {
600
600
  */
601
601
  static findFragmentByKeyParts(t, e) {
602
602
  const r = [], i = e[0];
603
- if (e.length == 1 && t.getAttribute("name") === i && r.push(t), t.hasAttribute(`${l.prefix}form-object`))
604
- e.length > 1 && t.getAttribute(`${l.prefix}form-object`) === i && t.getChildElementFragments().forEach((n) => {
605
- r.push(...b.findFragmentByKeyParts(n, e.slice(1)));
603
+ if (e.length == 1 && t.getAttribute("name") === i && r.push(t), t.hasAttribute(`${c.prefix}form-object`))
604
+ e.length > 1 && t.getAttribute(`${c.prefix}form-object`) === i && t.getChildElementFragments().forEach((s) => {
605
+ r.push(...b.findFragmentByKeyParts(s, e.slice(1)));
606
606
  });
607
- else if (t.hasAttribute(`${l.prefix}form-list`)) {
607
+ else if (t.hasAttribute(`${c.prefix}form-list`)) {
608
608
  if (e.length > 1) {
609
- const s = t.getAttribute(`${l.prefix}form-list`), n = i.lastIndexOf("["), a = i.lastIndexOf("]");
610
- if (n !== -1 && a !== -1 && n < a) {
611
- const o = i.substring(0, n);
612
- if (s === o) {
613
- const d = i.substring(n + 1, a), m = Number(d);
609
+ const n = t.getAttribute(`${c.prefix}form-list`), s = i.lastIndexOf("["), a = i.lastIndexOf("]");
610
+ if (s !== -1 && a !== -1 && s < a) {
611
+ const o = i.substring(0, s);
612
+ if (n === o) {
613
+ const u = i.substring(s + 1, a), m = Number(u);
614
614
  if (isNaN(m))
615
- f.error("Haori", `Invalid index: ${i}`);
615
+ d.error("Haori", `Invalid index: ${i}`);
616
616
  else {
617
- const y = t.getChildElementFragments().filter((E) => E.hasAttribute(`${l.prefix}row`));
617
+ const y = t.getChildElementFragments().filter((E) => E.hasAttribute(`${c.prefix}row`));
618
618
  m < y.length && r.push(
619
619
  ...b.findFragmentByKeyParts(y[m], e.slice(1))
620
620
  );
@@ -623,8 +623,8 @@ class b {
623
623
  }
624
624
  }
625
625
  } else
626
- t.getChildElementFragments().forEach((s) => {
627
- r.push(...b.findFragmentByKeyParts(s, e));
626
+ t.getChildElementFragments().forEach((n) => {
627
+ r.push(...b.findFragmentByKeyParts(n, e));
628
628
  });
629
629
  return r;
630
630
  }
@@ -686,28 +686,28 @@ const M = class M {
686
686
  */
687
687
  static evaluate(t, e = {}) {
688
688
  if (t.trim() === "")
689
- return f.warn("[Haori]", t, "Expression is empty"), null;
689
+ return d.warn("[Haori]", t, "Expression is empty"), null;
690
690
  if (this.containsDangerousPatterns(t))
691
- return f.warn("[Haori]", t, "Expression contains dangerous patterns"), null;
691
+ return d.warn("[Haori]", t, "Expression contains dangerous patterns"), null;
692
692
  if (this.containsForbiddenKeys(e))
693
- return f.warn("[Haori]", e, "Binded values contain forbidden keys"), null;
693
+ return d.warn("[Haori]", e, "Binded values contain forbidden keys"), null;
694
694
  if (this.containsForbiddenBindingValues(e))
695
- return f.warn(
695
+ return d.warn(
696
696
  "[Haori]",
697
697
  e,
698
698
  "Binded values contain forbidden values"
699
699
  ), null;
700
- const r = Object.keys(e).filter((n) => !this.FORBIDDEN_BINDING_NAMES.has(n)).sort(), i = `${t}:${r.join(",")}`;
701
- let s = this.EXPRESSION_CACHE.get(i);
702
- if (!s) {
703
- const n = this.buildAssignments(r), a = n ? `"use strict";
704
- ${n};
700
+ const r = Object.keys(e).filter((s) => !this.FORBIDDEN_BINDING_NAMES.has(s)).sort(), i = `${t}:${r.join(",")}`;
701
+ let n = this.EXPRESSION_CACHE.get(i);
702
+ if (!n) {
703
+ const s = this.buildAssignments(r), a = s ? `"use strict";
704
+ ${s};
705
705
  return (${t});` : `"use strict";
706
706
  return (${t});`;
707
707
  try {
708
- s = new Function(...r, a), this.EXPRESSION_CACHE.set(i, s);
708
+ n = new Function(...r, a), this.EXPRESSION_CACHE.set(i, n);
709
709
  } catch (o) {
710
- return f.error(
710
+ return d.error(
711
711
  "[Haori]",
712
712
  "Failed to compile expression:",
713
713
  t,
@@ -716,12 +716,12 @@ return (${t});`;
716
716
  }
717
717
  }
718
718
  try {
719
- const n = [], a = this.wrapBoundValues(e);
719
+ const s = [], a = this.wrapBoundValues(e);
720
720
  return r.forEach((o) => {
721
- n.push(a[o]);
722
- }), this.withBlockedPropertyAccess(() => s(...n));
723
- } catch (n) {
724
- return f.error("[Haori]", "Expression evaluation error:", t, n), n instanceof ReferenceError ? void 0 : null;
721
+ s.push(a[o]);
722
+ }), this.withBlockedPropertyAccess(() => n(...s));
723
+ } catch (s) {
724
+ return d.error("[Haori]", "Expression evaluation error:", t, s), s instanceof ReferenceError ? void 0 : null;
725
725
  }
726
726
  }
727
727
  /**
@@ -752,13 +752,13 @@ return (${t});`;
752
752
  return !1;
753
753
  const r = [];
754
754
  let i = null;
755
- for (let s = 0; s < e.length; s++) {
756
- const n = e[s], a = e[s + 1] || null, o = r[r.length - 1] || null;
757
- if (n.type === "identifier" && (this.DISALLOWED_KEYWORDS.has(n.value) || this.STRICT_FORBIDDEN_NAMES.includes(n.value) || (i?.value === "." || i?.value === "?.") && this.FORBIDDEN_PROPERTY_NAMES.has(n.value)) || o === "member" && n.value !== "]" && n.type === "string" && this.FORBIDDEN_PROPERTY_NAMES.has(
758
- this.decodeStringLiteral(n.value)
759
- ) || n.value === "." && a?.type !== "identifier" || n.value === "?." && a?.type !== "identifier" && a?.value !== "[" && a?.value !== "(")
755
+ for (let n = 0; n < e.length; n++) {
756
+ const s = e[n], a = e[n + 1] || null, o = r[r.length - 1] || null;
757
+ if (s.type === "identifier" && (this.DISALLOWED_KEYWORDS.has(s.value) || this.STRICT_FORBIDDEN_NAMES.includes(s.value) || (i?.value === "." || i?.value === "?.") && this.FORBIDDEN_PROPERTY_NAMES.has(s.value)) || o === "member" && s.value !== "]" && s.type === "string" && this.FORBIDDEN_PROPERTY_NAMES.has(
758
+ this.decodeStringLiteral(s.value)
759
+ ) || s.value === "." && a?.type !== "identifier" || s.value === "?." && a?.type !== "identifier" && a?.value !== "[" && a?.value !== "(")
760
760
  return !1;
761
- switch (n.value) {
761
+ switch (s.value) {
762
762
  case "(":
763
763
  r.push("paren");
764
764
  break;
@@ -768,8 +768,8 @@ return (${t});`;
768
768
  break;
769
769
  }
770
770
  case "[": {
771
- const d = this.startsMemberAccess(i) ? "member" : "array";
772
- r.push(d);
771
+ const u = this.startsMemberAccess(i) ? "member" : "array";
772
+ r.push(u);
773
773
  break;
774
774
  }
775
775
  case "]": {
@@ -778,7 +778,7 @@ return (${t});`;
778
778
  break;
779
779
  }
780
780
  }
781
- i = n;
781
+ i = s;
782
782
  }
783
783
  return r.length === 0;
784
784
  }
@@ -819,41 +819,41 @@ return (${t});`;
819
819
  ">",
820
820
  "<"
821
821
  ]);
822
- let s = 0;
823
- for (; s < t.length; ) {
824
- const n = t[s];
825
- if (/\s/.test(n)) {
826
- s += 1;
822
+ let n = 0;
823
+ for (; n < t.length; ) {
824
+ const s = t[n];
825
+ if (/\s/.test(s)) {
826
+ n += 1;
827
827
  continue;
828
828
  }
829
- if (n === "/" && (t[s + 1] === "/" || t[s + 1] === "*"))
829
+ if (s === "/" && (t[n + 1] === "/" || t[n + 1] === "*"))
830
830
  return null;
831
- if (n === '"' || n === "'") {
832
- const o = this.readStringToken(t, s);
831
+ if (s === '"' || s === "'") {
832
+ const o = this.readStringToken(t, n);
833
833
  if (o === null)
834
834
  return null;
835
- e.push(o.token), s = o.nextIndex;
835
+ e.push(o.token), n = o.nextIndex;
836
836
  continue;
837
837
  }
838
838
  const a = r.find(
839
- (o) => t.startsWith(o, s)
839
+ (o) => t.startsWith(o, n)
840
840
  );
841
841
  if (a) {
842
- e.push({ type: "operator", value: a, position: s }), s += a.length;
842
+ e.push({ type: "operator", value: a, position: n }), n += a.length;
843
843
  continue;
844
844
  }
845
- if (/[0-9]/.test(n)) {
846
- const o = this.readNumberToken(t, s);
847
- e.push(o.token), s = o.nextIndex;
845
+ if (/[0-9]/.test(s)) {
846
+ const o = this.readNumberToken(t, n);
847
+ e.push(o.token), n = o.nextIndex;
848
848
  continue;
849
849
  }
850
- if (/[A-Za-z_$]/.test(n)) {
851
- const o = this.readIdentifierToken(t, s);
852
- e.push(o.token), s = o.nextIndex;
850
+ if (/[A-Za-z_$]/.test(s)) {
851
+ const o = this.readIdentifierToken(t, n);
852
+ e.push(o.token), n = o.nextIndex;
853
853
  continue;
854
854
  }
855
- if (i.has(n)) {
856
- e.push({ type: "operator", value: n, position: s }), s += 1;
855
+ if (i.has(s)) {
856
+ e.push({ type: "operator", value: s, position: n }), n += 1;
857
857
  continue;
858
858
  }
859
859
  return null;
@@ -871,12 +871,12 @@ return (${t});`;
871
871
  const r = t[e];
872
872
  let i = e + 1;
873
873
  for (; i < t.length; ) {
874
- const s = t[i];
875
- if (s === "\\") {
874
+ const n = t[i];
875
+ if (n === "\\") {
876
876
  i += 2;
877
877
  continue;
878
878
  }
879
- if (s === r)
879
+ if (n === r)
880
880
  return {
881
881
  token: {
882
882
  type: "string",
@@ -984,8 +984,8 @@ return (${t});`;
984
984
  */
985
985
  static wrapBoundValues(t) {
986
986
  const e = /* @__PURE__ */ new WeakMap(), r = {};
987
- return Object.entries(t).forEach(([i, s]) => {
988
- r[i] = this.wrapBoundValue(s, e);
987
+ return Object.entries(t).forEach(([i, n]) => {
988
+ r[i] = this.wrapBoundValue(n, e);
989
989
  }), r;
990
990
  }
991
991
  /**
@@ -1001,39 +1001,39 @@ return (${t});`;
1001
1001
  const r = t, i = e.get(r);
1002
1002
  if (i !== void 0)
1003
1003
  return i;
1004
- const s = new Proxy(r, {
1005
- get: (n, a, o) => {
1004
+ const n = new Proxy(r, {
1005
+ get: (s, a, o) => {
1006
1006
  if (typeof a == "string" && this.FORBIDDEN_PROPERTY_NAMES.has(a))
1007
1007
  return;
1008
- const d = Reflect.get(n, a, o);
1009
- return typeof a == "symbol" ? d : this.wrapBoundValue(
1010
- d,
1008
+ const u = Reflect.get(s, a, o);
1009
+ return typeof a == "symbol" ? u : this.wrapBoundValue(
1010
+ u,
1011
1011
  e
1012
1012
  );
1013
1013
  },
1014
- has: (n, a) => typeof a == "string" && this.FORBIDDEN_PROPERTY_NAMES.has(a) ? !1 : Reflect.has(n, a),
1015
- getOwnPropertyDescriptor: (n, a) => {
1014
+ has: (s, a) => typeof a == "string" && this.FORBIDDEN_PROPERTY_NAMES.has(a) ? !1 : Reflect.has(s, a),
1015
+ getOwnPropertyDescriptor: (s, a) => {
1016
1016
  if (!(typeof a == "string" && this.FORBIDDEN_PROPERTY_NAMES.has(a)))
1017
- return Reflect.getOwnPropertyDescriptor(n, a);
1017
+ return Reflect.getOwnPropertyDescriptor(s, a);
1018
1018
  },
1019
- apply: (n, a, o) => {
1020
- const d = Reflect.apply(
1021
- n,
1019
+ apply: (s, a, o) => {
1020
+ const u = Reflect.apply(
1021
+ s,
1022
1022
  a,
1023
1023
  o
1024
1024
  );
1025
- return this.isIteratorLike(d) ? d : this.wrapBoundValue(d, e);
1025
+ return this.isIteratorLike(u) ? u : this.wrapBoundValue(u, e);
1026
1026
  },
1027
- construct: (n, a, o) => this.wrapBoundValue(
1027
+ construct: (s, a, o) => this.wrapBoundValue(
1028
1028
  Reflect.construct(
1029
- n,
1029
+ s,
1030
1030
  a,
1031
1031
  o
1032
1032
  ),
1033
1033
  e
1034
1034
  )
1035
1035
  });
1036
- return e.set(r, s), s;
1036
+ return e.set(r, n), n;
1037
1037
  }
1038
1038
  /**
1039
1039
  * Proxy ラップ対象の値かどうかを判定します。
@@ -1066,8 +1066,8 @@ return (${t});`;
1066
1066
  ...i,
1067
1067
  descriptor: Object.getOwnPropertyDescriptor(i.target, i.property)
1068
1068
  })).filter((i) => i.descriptor?.configurable === !0);
1069
- r.forEach(({ target: i, property: s }) => {
1070
- Object.defineProperty(i, s, {
1069
+ r.forEach(({ target: i, property: n }) => {
1070
+ Object.defineProperty(i, n, {
1071
1071
  configurable: !0,
1072
1072
  enumerable: !1,
1073
1073
  get: () => {
@@ -1079,8 +1079,8 @@ return (${t});`;
1079
1079
  try {
1080
1080
  return t();
1081
1081
  } finally {
1082
- r.forEach(({ target: i, property: s, descriptor: n }) => {
1083
- n !== void 0 && Object.defineProperty(i, s, n);
1082
+ r.forEach(({ target: i, property: n, descriptor: s }) => {
1083
+ s !== void 0 && Object.defineProperty(i, n, s);
1084
1084
  });
1085
1085
  }
1086
1086
  }
@@ -1231,16 +1231,16 @@ const C = class C {
1231
1231
  let e;
1232
1232
  switch (t.nodeType) {
1233
1233
  case Node.ELEMENT_NODE:
1234
- e = new R(t);
1234
+ e = new x(t);
1235
1235
  break;
1236
1236
  case Node.TEXT_NODE:
1237
1237
  e = new H(t);
1238
1238
  break;
1239
1239
  case Node.COMMENT_NODE:
1240
- e = new z(t);
1240
+ e = new Z(t);
1241
1241
  break;
1242
1242
  default:
1243
- return f.warn("[Haori]", "Unsupported node type:", t.nodeType), null;
1243
+ return d.warn("[Haori]", "Unsupported node type:", t.nodeType), null;
1244
1244
  }
1245
1245
  return e;
1246
1246
  }
@@ -1347,7 +1347,7 @@ const C = class C {
1347
1347
  };
1348
1348
  C.FRAGMENT_CACHE = /* @__PURE__ */ new WeakMap();
1349
1349
  let T = C;
1350
- class R extends T {
1350
+ class x extends T {
1351
1351
  /**
1352
1352
  * エレメントフラグメントのコンストラクタ。
1353
1353
  * アトリビュートや子フラグメントの作成も行います。
@@ -1396,7 +1396,7 @@ class R extends T {
1396
1396
  */
1397
1397
  getChildElementFragments() {
1398
1398
  return this.children.filter(
1399
- (t) => t instanceof R
1399
+ (t) => t instanceof x
1400
1400
  );
1401
1401
  }
1402
1402
  /**
@@ -1417,7 +1417,7 @@ class R extends T {
1417
1417
  removeChild(t) {
1418
1418
  const e = this.children.indexOf(t);
1419
1419
  if (e < 0) {
1420
- f.warn("[Haori]", "Child fragment not found.", t);
1420
+ d.warn("[Haori]", "Child fragment not found.", t);
1421
1421
  return;
1422
1422
  }
1423
1423
  this.children.splice(e, 1), t.setParent(null);
@@ -1428,7 +1428,7 @@ class R extends T {
1428
1428
  * @returns クローンされたフラグメント
1429
1429
  */
1430
1430
  clone() {
1431
- const t = new R(
1431
+ const t = new x(
1432
1432
  this.target.cloneNode(!1)
1433
1433
  );
1434
1434
  return this.attributeMap.forEach((e, r) => {
@@ -1496,7 +1496,7 @@ class R extends T {
1496
1496
  */
1497
1497
  clearBindingDataCache() {
1498
1498
  this.bindingDataCache = null, this.children.forEach((t) => {
1499
- t instanceof R && t.clearBindingDataCache();
1499
+ t instanceof x && t.clearBindingDataCache();
1500
1500
  });
1501
1501
  }
1502
1502
  /**
@@ -1564,10 +1564,10 @@ class R extends T {
1564
1564
  return Promise.resolve();
1565
1565
  const r = this.getTarget();
1566
1566
  if (r instanceof HTMLInputElement && (r.type === "checkbox" || r.type === "radio")) {
1567
- const i = this.getAttribute("value"), s = r.type === "checkbox" && i === "true";
1568
- let n;
1569
- return s ? n = t === !0 || t === "true" : i === "false" ? n = t === !1 : n = i === String(t), this.value = s ? n : n ? t : null, r.checked === n ? Promise.resolve() : (this.skipChangeValue = !0, P.enqueue(() => {
1570
- r.checked = n, e && r.dispatchEvent(new Event("change", { bubbles: !0 }));
1567
+ const i = this.getAttribute("value"), n = r.type === "checkbox" && i === "true";
1568
+ let s;
1569
+ return n ? s = t === !0 || t === "true" : i === "false" ? s = t === !1 : s = i === String(t), this.value = n ? s : s ? t : null, r.checked === s ? Promise.resolve() : (this.skipChangeValue = !0, P.enqueue(() => {
1570
+ r.checked = s, e && r.dispatchEvent(new Event("change", { bubbles: !0 }));
1571
1571
  }).finally(() => {
1572
1572
  this.skipChangeValue = !1;
1573
1573
  }));
@@ -1575,7 +1575,7 @@ class R extends T {
1575
1575
  r.value = t === null ? "" : String(t), e && ((r instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(r.type) || r instanceof HTMLTextAreaElement) && r.dispatchEvent(new Event("input", { bubbles: !0 })), r.dispatchEvent(new Event("change", { bubbles: !0 })));
1576
1576
  }).finally(() => {
1577
1577
  this.skipChangeValue = !1;
1578
- })) : (f.warn(
1578
+ })) : (d.warn(
1579
1579
  "[Haori]",
1580
1580
  "setValue is not supported for this element type.",
1581
1581
  r
@@ -1671,15 +1671,15 @@ class R extends T {
1671
1671
  return Promise.resolve();
1672
1672
  if (r === null)
1673
1673
  return t === e ? this.removeAttribute(t) : this.removeAliasedAttribute(t, e);
1674
- const s = new U(t, r);
1675
- this.attributeMap.set(t, s), this.skipMutationAttributes = !0;
1676
- const n = this.getTarget(), a = s.isForceEvaluation() ? r : this.getAttribute(t);
1674
+ const n = new U(t, r);
1675
+ this.attributeMap.set(t, n), this.skipMutationAttributes = !0;
1676
+ const s = this.getTarget(), a = n.isForceEvaluation() ? r : this.getAttribute(t);
1677
1677
  return P.enqueue(() => {
1678
- if (n.getAttribute(t) !== r && n.setAttribute(t, r), a === null || a === !1)
1679
- n.removeAttribute(e);
1678
+ if (s.getAttribute(t) !== r && s.setAttribute(t, r), a === null || a === !1)
1679
+ s.removeAttribute(e);
1680
1680
  else {
1681
1681
  const o = String(a);
1682
- n.getAttribute(e) !== o && n.setAttribute(e, o), i && s.isEvaluate && e === "value" && (n instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(n.type) || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement) && (this.value = o, n.value !== o && (n.value = o));
1682
+ s.getAttribute(e) !== o && s.setAttribute(e, o), i && n.isEvaluate && e === "value" && (s instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(s.type) || s instanceof HTMLTextAreaElement || s instanceof HTMLSelectElement) && (this.value = o, s.value !== o && (s.value = o));
1683
1683
  }
1684
1684
  }).finally(() => {
1685
1685
  this.skipMutationAttributes = !1;
@@ -1714,7 +1714,7 @@ class R extends T {
1714
1714
  if (e === void 0)
1715
1715
  return null;
1716
1716
  const r = e.evaluate(this.getBindingData());
1717
- return r.length === 1 ? r[0] : $.joinEvaluateResults(r);
1717
+ return r.length === 1 ? r[0] : L.joinEvaluateResults(r);
1718
1718
  }
1719
1719
  /**
1720
1720
  * 属性の生の値を取得します。
@@ -1755,15 +1755,15 @@ class R extends T {
1755
1755
  if (r.parentNode !== this.target)
1756
1756
  return null;
1757
1757
  const i = e ? r.nextSibling : r;
1758
- let s = e ? r.nextSibling : r;
1759
- for (; s !== null; ) {
1760
- const n = T.get(s);
1761
- if (n !== null) {
1762
- const a = this.children.indexOf(n);
1758
+ let n = e ? r.nextSibling : r;
1759
+ for (; n !== null; ) {
1760
+ const s = T.get(n);
1761
+ if (s !== null) {
1762
+ const a = this.children.indexOf(s);
1763
1763
  if (a !== -1)
1764
1764
  return { index: a, referenceNode: i };
1765
1765
  }
1766
- s = s.nextSibling;
1766
+ n = n.nextSibling;
1767
1767
  }
1768
1768
  return { index: this.children.length, referenceNode: i };
1769
1769
  }
@@ -1779,29 +1779,29 @@ class R extends T {
1779
1779
  if (this.skipMutationNodes)
1780
1780
  return Promise.resolve();
1781
1781
  if (t === this)
1782
- return f.error("[Haori]", "Cannot insert element as child of itself"), Promise.reject(new Error("Self-insertion not allowed"));
1782
+ return d.error("[Haori]", "Cannot insert element as child of itself"), Promise.reject(new Error("Self-insertion not allowed"));
1783
1783
  const i = /* @__PURE__ */ new Set();
1784
- let s = this.parent;
1785
- for (; s; )
1786
- i.add(s), s = s.getParent();
1784
+ let n = this.parent;
1785
+ for (; n; )
1786
+ i.add(n), n = n.getParent();
1787
1787
  if (i.has(t))
1788
- return f.error("[Haori]", "Cannot create circular reference"), Promise.reject(new Error("Circular reference detected"));
1789
- const n = t.getParent() === this;
1788
+ return d.error("[Haori]", "Cannot create circular reference"), Promise.reject(new Error("Circular reference detected"));
1789
+ const s = t.getParent() === this;
1790
1790
  let a = -1, o = -1;
1791
- n && (a = this.children.indexOf(t), e !== null && (o = this.children.indexOf(e)));
1792
- const d = t.getParent();
1793
- d !== null && d.removeChild(t);
1791
+ s && (a = this.children.indexOf(t), e !== null && (o = this.children.indexOf(e)));
1792
+ const u = t.getParent();
1793
+ u !== null && u.removeChild(t);
1794
1794
  let m = r === void 0 ? e?.getTarget() || null : r;
1795
1795
  if (e === null)
1796
1796
  this.children.push(t);
1797
1797
  else {
1798
1798
  let E;
1799
- if (n ? a !== -1 && a < o ? E = o - 1 : E = o : E = this.children.indexOf(e), E === -1) {
1799
+ if (s ? a !== -1 && a < o ? E = o - 1 : E = o : E = this.children.indexOf(e), E === -1) {
1800
1800
  const S = this.resolveInsertionPointFromDom(
1801
1801
  e,
1802
1802
  !1
1803
1803
  );
1804
- S === null ? (f.warn(
1804
+ S === null ? (d.warn(
1805
1805
  "[Haori]",
1806
1806
  "Reference child not found in children.",
1807
1807
  e
@@ -1833,7 +1833,7 @@ class R extends T {
1833
1833
  e,
1834
1834
  !0
1835
1835
  );
1836
- return i === null ? (f.warn(
1836
+ return i === null ? (d.warn(
1837
1837
  "[Haori]",
1838
1838
  "Reference child not found in children.",
1839
1839
  e
@@ -1885,7 +1885,7 @@ class R extends T {
1885
1885
  * @returns エレメントの非表示のPromise
1886
1886
  */
1887
1887
  hide() {
1888
- return this.visible = !1, this.display = this.getTarget().style.display, this.getTarget().style.display = "none", this.getTarget().setAttribute(`${l.prefix}if-false`, ""), Promise.resolve();
1888
+ return this.visible = !1, this.display = this.getTarget().style.display, this.getTarget().style.display = "none", this.getTarget().setAttribute(`${c.prefix}if-false`, ""), Promise.resolve();
1889
1889
  }
1890
1890
  /**
1891
1891
  * エレメントを表示します。
@@ -1893,7 +1893,7 @@ class R extends T {
1893
1893
  * @return エレメントの表示のPromise
1894
1894
  */
1895
1895
  show() {
1896
- return this.getTarget().style.display = this.display ?? "", this.getTarget().removeAttribute(`${l.prefix}if-false`), this.visible = !0, Promise.resolve();
1896
+ return this.getTarget().style.display = this.display ?? "", this.getTarget().removeAttribute(`${c.prefix}if-false`), this.visible = !0, Promise.resolve();
1897
1897
  }
1898
1898
  /**
1899
1899
  * 指定した属性名を持つ最も近い親要素を返します。
@@ -1917,7 +1917,7 @@ class H extends T {
1917
1917
  * @param target 対象テキストノード
1918
1918
  */
1919
1919
  constructor(t) {
1920
- super(t), this.skipMutation = !1, this.text = t.textContent || "", this.contents = new $(this.text);
1920
+ super(t), this.skipMutation = !1, this.text = t.textContent || "", this.contents = new L(this.text);
1921
1921
  }
1922
1922
  /**
1923
1923
  * フラグメントをクローンします。
@@ -1943,7 +1943,7 @@ class H extends T {
1943
1943
  * @returns 更新のPromise
1944
1944
  */
1945
1945
  setContent(t) {
1946
- return this.skipMutation || this.text === t ? Promise.resolve() : (this.text = t, this.contents = new $(t), this.evaluate());
1946
+ return this.skipMutation || this.text === t ? Promise.resolve() : (this.text = t, this.contents = new L(t), this.evaluate());
1947
1947
  }
1948
1948
  /**
1949
1949
  * フラグメントを評価します。
@@ -1956,7 +1956,7 @@ class H extends T {
1956
1956
  ) : P.enqueue(() => {
1957
1957
  this.skipMutation = !0, this.contents.isRawEvaluate ? this.parent.getTarget().innerHTML = this.contents.evaluate(
1958
1958
  this.parent.getBindingData()
1959
- )[0] : this.contents.isEvaluate ? this.target.textContent = $.joinEvaluateResults(
1959
+ )[0] : this.contents.isEvaluate ? this.target.textContent = L.joinEvaluateResults(
1960
1960
  this.contents.evaluate(this.parent.getBindingData())
1961
1961
  ) : this.target.textContent = this.text;
1962
1962
  }).finally(() => {
@@ -1964,7 +1964,7 @@ class H extends T {
1964
1964
  });
1965
1965
  }
1966
1966
  }
1967
- class z extends T {
1967
+ class Z extends T {
1968
1968
  /**
1969
1969
  * コメントフラグメントのコンストラクタ。
1970
1970
  * 対象コメントノードの内容を初期化します。
@@ -1980,7 +1980,7 @@ class z extends T {
1980
1980
  * @returns クローンされたフラグメント
1981
1981
  */
1982
1982
  clone() {
1983
- const t = new z(this.target.cloneNode(!0));
1983
+ const t = new Z(this.target.cloneNode(!0));
1984
1984
  return t.mounted = !1, t.text = this.text, t;
1985
1985
  }
1986
1986
  /**
@@ -2005,7 +2005,7 @@ class z extends T {
2005
2005
  }));
2006
2006
  }
2007
2007
  }
2008
- const G = class G {
2008
+ const K = class K {
2009
2009
  /**
2010
2010
  * コンストラクタ。
2011
2011
  *
@@ -2013,26 +2013,26 @@ const G = class G {
2013
2013
  */
2014
2014
  constructor(t) {
2015
2015
  this.contents = [], this.isEvaluate = !1, this.isRawEvaluate = !1, this.value = t;
2016
- const e = [...t.matchAll(G.PLACEHOLDER_REGEX)];
2017
- let r = 0, i = !1, s = !1;
2018
- for (const n of e) {
2019
- n.index > r && this.contents.push({
2020
- text: t.slice(r, n.index),
2016
+ const e = [...t.matchAll(K.PLACEHOLDER_REGEX)];
2017
+ let r = 0, i = !1, n = !1;
2018
+ for (const s of e) {
2019
+ s.index > r && this.contents.push({
2020
+ text: t.slice(r, s.index),
2021
2021
  type: 0
2022
2022
  /* TEXT */
2023
2023
  });
2024
2024
  const a = {
2025
- text: n[1] ?? n[2],
2026
- type: n[1] ? 2 : 1
2025
+ text: s[1] ?? s[2],
2026
+ type: s[1] ? 2 : 1
2027
2027
  /* EXPRESSION */
2028
2028
  };
2029
- i = !0, s = s || a.type === 2, this.contents.push(a), r = n.index + n[0].length;
2029
+ i = !0, n = n || a.type === 2, this.contents.push(a), r = s.index + s[0].length;
2030
2030
  }
2031
2031
  r < t.length && this.contents.push({
2032
2032
  text: t.slice(r),
2033
2033
  type: 0
2034
2034
  /* TEXT */
2035
- }), this.isEvaluate = i, this.isRawEvaluate = s, this.checkRawExpressions();
2035
+ }), this.isEvaluate = i, this.isRawEvaluate = n, this.checkRawExpressions();
2036
2036
  }
2037
2037
  /**
2038
2038
  * 評価結果を結合して文字列にします。
@@ -2056,7 +2056,7 @@ const G = class G {
2056
2056
  */
2057
2057
  checkRawExpressions() {
2058
2058
  for (let t = 0; t < this.contents.length; t++)
2059
- this.contents[t].type === 2 && this.contents.length > 1 && (f.error(
2059
+ this.contents[t].type === 2 && this.contents.length > 1 && (d.error(
2060
2060
  "[Haori]",
2061
2061
  "Raw expressions are not allowed in multi-content expressions."
2062
2062
  ), this.contents[t].type = 1);
@@ -2079,7 +2079,7 @@ const G = class G {
2079
2079
  } else
2080
2080
  e.push(r.text);
2081
2081
  } catch (i) {
2082
- f.error(
2082
+ d.error(
2083
2083
  "[Haori]",
2084
2084
  `Error evaluating text expression: ${r.text}`,
2085
2085
  i
@@ -2088,9 +2088,9 @@ const G = class G {
2088
2088
  }), e;
2089
2089
  }
2090
2090
  };
2091
- G.PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g;
2092
- let $ = G;
2093
- const K = class K extends $ {
2091
+ K.PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g;
2092
+ let L = K;
2093
+ const G = class G extends L {
2094
2094
  /**
2095
2095
  * コンストラクタ。
2096
2096
  *
@@ -2098,7 +2098,7 @@ const K = class K extends $ {
2098
2098
  * @param text 属性値
2099
2099
  */
2100
2100
  constructor(t, e) {
2101
- super(e), this.forceEvaluation = K.FORCE_EVALUATION_ATTRIBUTES.includes(t);
2101
+ super(e), this.forceEvaluation = G.FORCE_EVALUATION_ATTRIBUTES.includes(t);
2102
2102
  }
2103
2103
  /**
2104
2104
  * 強制評価フラグを取得します。
@@ -2126,26 +2126,26 @@ const K = class K extends $ {
2126
2126
  } else
2127
2127
  e.push(r.text);
2128
2128
  } catch (i) {
2129
- f.error(
2129
+ d.error(
2130
2130
  "[Haori]",
2131
2131
  `Error evaluating attribute expression: ${r.text}`,
2132
2132
  i
2133
2133
  ), e.push("");
2134
2134
  }
2135
- }), this.forceEvaluation && e.length > 1 ? (f.error(
2135
+ }), this.forceEvaluation && e.length > 1 ? (d.error(
2136
2136
  "[Haori]",
2137
2137
  "each or if expressions must have a single content.",
2138
2138
  e
2139
2139
  ), [e[0]]) : e;
2140
2140
  }
2141
2141
  };
2142
- K.FORCE_EVALUATION_ATTRIBUTES = [
2142
+ G.FORCE_EVALUATION_ATTRIBUTES = [
2143
2143
  "data-if",
2144
2144
  "hor-if",
2145
2145
  "data-each",
2146
2146
  "hor-each"
2147
2147
  ];
2148
- let U = K;
2148
+ let U = G;
2149
2149
  class w {
2150
2150
  /**
2151
2151
  * カスタムイベントを発火します。
@@ -2156,13 +2156,13 @@ class w {
2156
2156
  * @param options イベントオプション
2157
2157
  */
2158
2158
  static dispatch(t, e, r, i) {
2159
- const s = new CustomEvent(`haori:${e}`, {
2159
+ const n = new CustomEvent(`haori:${e}`, {
2160
2160
  bubbles: i?.bubbles ?? !0,
2161
2161
  cancelable: i?.cancelable ?? !1,
2162
2162
  composed: i?.composed ?? !0,
2163
2163
  detail: r
2164
2164
  });
2165
- return t.dispatchEvent(s);
2165
+ return t.dispatchEvent(n);
2166
2166
  }
2167
2167
  /**
2168
2168
  * readyイベントを発火します。
@@ -2226,15 +2226,15 @@ class w {
2226
2226
  * @param reason 変更理由
2227
2227
  */
2228
2228
  static bindChange(t, e, r, i = "other") {
2229
- const s = [], n = new Set(Object.keys(e || {})), a = new Set(Object.keys(r)), o = /* @__PURE__ */ new Set([...n, ...a]);
2230
- for (const d of o) {
2231
- const m = e?.[d], y = r[d];
2232
- m !== y && s.push(d);
2229
+ const n = [], s = new Set(Object.keys(e || {})), a = new Set(Object.keys(r)), o = /* @__PURE__ */ new Set([...s, ...a]);
2230
+ for (const u of o) {
2231
+ const m = e?.[u], y = r[u];
2232
+ m !== y && n.push(u);
2233
2233
  }
2234
2234
  w.dispatch(t, "bindchange", {
2235
2235
  previous: e || {},
2236
2236
  next: r,
2237
- changedKeys: s,
2237
+ changedKeys: n,
2238
2238
  reason: i
2239
2239
  });
2240
2240
  }
@@ -2312,13 +2312,13 @@ class w {
2312
2312
  * @param metadata runtime とメソッド変換情報。
2313
2313
  * @return 戻り値はありません。
2314
2314
  */
2315
- static fetchStart(t, e, r, i, s) {
2315
+ static fetchStart(t, e, r, i, n) {
2316
2316
  w.dispatch(t, "fetchstart", {
2317
2317
  url: e,
2318
2318
  options: r || {},
2319
2319
  payload: i,
2320
2320
  startedAt: performance.now(),
2321
- ...s
2321
+ ...n
2322
2322
  });
2323
2323
  }
2324
2324
  /**
@@ -2345,44 +2345,44 @@ class w {
2345
2345
  * @param status HTTPステータス(存在する場合)
2346
2346
  * @param startedAt 開始時刻(存在する場合)
2347
2347
  */
2348
- static fetchError(t, e, r, i, s) {
2348
+ static fetchError(t, e, r, i, n) {
2349
2349
  w.dispatch(t, "fetcherror", {
2350
2350
  url: e,
2351
2351
  status: i,
2352
2352
  error: r,
2353
- durationMs: s ? performance.now() - s : void 0
2353
+ durationMs: n ? performance.now() - n : void 0
2354
2354
  });
2355
2355
  }
2356
2356
  }
2357
- const st = [
2357
+ const at = [
2358
2358
  "addErrorMessage",
2359
2359
  "closeDialog",
2360
2360
  "confirm",
2361
2361
  "dialog",
2362
2362
  "openDialog",
2363
2363
  "toast"
2364
- ];
2365
- function W() {
2364
+ ], ot = "__haoriHistoryState__";
2365
+ function Y() {
2366
2366
  const t = globalThis.window?.Haori;
2367
- return st.every(
2367
+ return at.every(
2368
2368
  (r) => typeof t?.[r] == "function"
2369
- ) ? t : X;
2369
+ ) ? t : J;
2370
2370
  }
2371
- const nt = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
2372
- function at(F) {
2373
- return nt.has(F.toUpperCase());
2371
+ const lt = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
2372
+ function ct(F) {
2373
+ return lt.has(F.toUpperCase());
2374
2374
  }
2375
- function ot(F, t) {
2375
+ function ut(F, t) {
2376
2376
  for (const [e, r] of Object.entries(t))
2377
2377
  r !== void 0 && (r === null ? F.append(e, "") : Array.isArray(r) ? r.forEach((i) => {
2378
2378
  F.append(e, String(i));
2379
2379
  }) : typeof r == "object" || typeof r == "function" ? F.append(e, JSON.stringify(r)) : F.append(e, String(r)));
2380
2380
  }
2381
- function lt(F, t) {
2381
+ function ht(F, t) {
2382
2382
  const e = new URL(F, window.location.href), r = new URLSearchParams(e.search);
2383
- return ot(r, t), e.search = r.toString(), e.toString();
2383
+ return ut(r, t), e.search = r.toString(), e.toString();
2384
2384
  }
2385
- const c = class c {
2385
+ const l = class l {
2386
2386
  /**
2387
2387
  * イベント属性名を正しく生成します。
2388
2388
  * 例: ("click", "fetch") => "data-click-fetch"
@@ -2391,7 +2391,7 @@ const c = class c {
2391
2391
  * 非イベント変種が "data-fetch-xxx" として存在するものについては、event が null の場合にそちらを返します。
2392
2392
  */
2393
2393
  static attrName(t, e, r = !1) {
2394
- return t ? `${l.prefix}${t}-${e}` : r ? `${l.prefix}fetch-${e}` : `${l.prefix}${e}`;
2394
+ return t ? `${c.prefix}${t}-${e}` : r ? `${c.prefix}fetch-${e}` : `${c.prefix}${e}`;
2395
2395
  }
2396
2396
  /**
2397
2397
  * data 属性のテンプレート式評価結果を URLSearchParams 向けに組み立てます。
@@ -2402,13 +2402,13 @@ const c = class c {
2402
2402
  */
2403
2403
  static resolveDataParamString(t, e) {
2404
2404
  return t.replace(
2405
- c.DATA_PLACEHOLDER_REGEX,
2406
- (r, i, s) => {
2407
- const n = j.evaluate(
2408
- i ?? s ?? "",
2405
+ l.DATA_PLACEHOLDER_REGEX,
2406
+ (r, i, n) => {
2407
+ const s = j.evaluate(
2408
+ i ?? n ?? "",
2409
2409
  e
2410
2410
  );
2411
- return n == null || Number.isNaN(n) ? "" : encodeURIComponent(typeof n == "object" ? JSON.stringify(n) : String(n));
2411
+ return s == null || Number.isNaN(s) ? "" : encodeURIComponent(typeof s == "object" ? JSON.stringify(s) : String(s));
2412
2412
  }
2413
2413
  );
2414
2414
  }
@@ -2421,17 +2421,17 @@ const c = class c {
2421
2421
  */
2422
2422
  static isJsonStringContext(t, e) {
2423
2423
  let r = !1, i = !1;
2424
- for (let s = 0; s < e; s += 1) {
2425
- const n = t[s];
2424
+ for (let n = 0; n < e; n += 1) {
2425
+ const s = t[n];
2426
2426
  if (i) {
2427
2427
  i = !1;
2428
2428
  continue;
2429
2429
  }
2430
- if (n === "\\") {
2430
+ if (s === "\\") {
2431
2431
  i = !0;
2432
2432
  continue;
2433
2433
  }
2434
- n === '"' && (r = !r);
2434
+ s === '"' && (r = !r);
2435
2435
  }
2436
2436
  return r;
2437
2437
  }
@@ -2459,7 +2459,7 @@ const c = class c {
2459
2459
  static stringifyJsonTemplateStringContent(t) {
2460
2460
  if (t == null || Number.isNaN(t))
2461
2461
  return "";
2462
- const e = typeof t == "object" ? c.stringifyJsonTemplateValue(t) : String(t);
2462
+ const e = typeof t == "object" ? l.stringifyJsonTemplateValue(t) : String(t);
2463
2463
  return JSON.stringify(e).slice(1, -1);
2464
2464
  }
2465
2465
  /**
@@ -2471,13 +2471,13 @@ const c = class c {
2471
2471
  */
2472
2472
  static resolveDataJsonString(t, e) {
2473
2473
  return t.replace(
2474
- c.DATA_PLACEHOLDER_REGEX,
2475
- (r, i, s, n) => {
2474
+ l.DATA_PLACEHOLDER_REGEX,
2475
+ (r, i, n, s) => {
2476
2476
  const a = j.evaluate(
2477
- i ?? s ?? "",
2477
+ i ?? n ?? "",
2478
2478
  e
2479
2479
  );
2480
- return c.isJsonStringContext(t, n) ? c.stringifyJsonTemplateStringContent(a) : c.stringifyJsonTemplateValue(a);
2480
+ return l.isJsonStringContext(t, s) ? l.stringifyJsonTemplateStringContent(a) : l.stringifyJsonTemplateValue(a);
2481
2481
  }
2482
2482
  );
2483
2483
  }
@@ -2494,14 +2494,14 @@ const c = class c {
2494
2494
  return i;
2495
2495
  if (typeof i != "string" || r === null)
2496
2496
  return null;
2497
- const s = r.trim();
2498
- return c.SINGLE_PLACEHOLDER_REGEX.test(s) ? x.parseDataBind(i) : s.startsWith("{") || s.startsWith("[") ? x.parseDataBind(
2499
- c.resolveDataJsonString(
2497
+ const n = r.trim();
2498
+ return l.SINGLE_PLACEHOLDER_REGEX.test(n) ? R.parseDataBind(i) : n.startsWith("{") || n.startsWith("[") ? R.parseDataBind(
2499
+ l.resolveDataJsonString(
2500
2500
  r,
2501
2501
  t.getBindingData()
2502
2502
  )
2503
- ) : x.parseDataBind(
2504
- c.resolveDataParamString(r, t.getBindingData())
2503
+ ) : R.parseDataBind(
2504
+ l.resolveDataParamString(r, t.getBindingData())
2505
2505
  );
2506
2506
  }
2507
2507
  /**
@@ -2516,30 +2516,30 @@ const c = class c {
2516
2516
  targetFragment: t
2517
2517
  };
2518
2518
  if (e) {
2519
- if (t.hasAttribute(c.attrName(e, "validate")) && (r.valid = !0), t.hasAttribute(c.attrName(e, "confirm")) && (r.confirmMessage = t.getAttribute(
2520
- c.attrName(e, "confirm")
2519
+ if (t.hasAttribute(l.attrName(e, "validate")) && (r.valid = !0), t.hasAttribute(l.attrName(e, "confirm")) && (r.confirmMessage = t.getAttribute(
2520
+ l.attrName(e, "confirm")
2521
2521
  ).replace(/\\n/g, `
2522
- `)), t.hasAttribute(c.attrName(e, "data")) && (r.data = c.resolveDataAttribute(
2522
+ `)), t.hasAttribute(l.attrName(e, "data")) && (r.data = l.resolveDataAttribute(
2523
2523
  t,
2524
- c.attrName(e, "data")
2525
- )), t.hasAttribute(c.attrName(e, "form"))) {
2526
- const u = t.getRawAttribute(
2527
- c.attrName(e, "form")
2524
+ l.attrName(e, "data")
2525
+ )), t.hasAttribute(l.attrName(e, "form"))) {
2526
+ const h = t.getRawAttribute(
2527
+ l.attrName(e, "form")
2528
2528
  );
2529
- if (u) {
2530
- const h = document.body.querySelector(u);
2531
- h !== null ? r.formFragment = b.getFormFragment(
2532
- T.get(h)
2533
- ) : f.error(
2529
+ if (h) {
2530
+ const f = document.body.querySelector(h);
2531
+ f !== null ? r.formFragment = b.getFormFragment(
2532
+ T.get(f)
2533
+ ) : d.error(
2534
2534
  "Haori",
2535
- `Form element not found: ${u} (${c.attrName(e, "form")})`
2535
+ `Form element not found: ${h} (${l.attrName(e, "form")})`
2536
2536
  );
2537
2537
  } else
2538
2538
  r.formFragment = b.getFormFragment(t);
2539
2539
  } else e === "change" && (r.formFragment = b.getFormFragment(t));
2540
- if (t.hasAttribute(`${l.prefix}${e}-before-run`)) {
2541
- const u = t.getRawAttribute(
2542
- `${l.prefix}${e}-before-run`
2540
+ if (t.hasAttribute(`${c.prefix}${e}-before-run`)) {
2541
+ const h = t.getRawAttribute(
2542
+ `${c.prefix}${e}-before-run`
2543
2543
  );
2544
2544
  try {
2545
2545
  r.beforeCallback = new Function(
@@ -2547,211 +2547,213 @@ const c = class c {
2547
2547
  "fetchOptions",
2548
2548
  `
2549
2549
  "use strict";
2550
- ${u}
2550
+ ${h}
2551
2551
  `
2552
2552
  );
2553
- } catch (h) {
2554
- f.error("Haori", `Invalid before script: ${h}`);
2553
+ } catch (f) {
2554
+ d.error("Haori", `Invalid before script: ${f}`);
2555
2555
  }
2556
2556
  }
2557
2557
  }
2558
- const i = c.attrName(e, "fetch"), s = t.hasAttribute(i);
2559
- s && (r.fetchUrl = t.getAttribute(i));
2560
- const n = {};
2558
+ const i = l.attrName(e, "fetch"), n = t.hasAttribute(i);
2559
+ n && (r.fetchUrl = t.getAttribute(i));
2560
+ const s = {};
2561
2561
  if (e) {
2562
- const u = c.attrName(e, "fetch-method");
2563
- t.hasAttribute(u) && (n.method = t.getAttribute(
2564
- u
2562
+ const h = l.attrName(e, "fetch-method");
2563
+ t.hasAttribute(h) && (s.method = t.getAttribute(
2564
+ h
2565
2565
  ));
2566
2566
  } else {
2567
- const u = c.attrName(null, "method", !0);
2568
- t.hasAttribute(u) && (n.method = t.getAttribute(
2569
- u
2567
+ const h = l.attrName(null, "method", !0);
2568
+ t.hasAttribute(h) && (s.method = t.getAttribute(
2569
+ h
2570
2570
  ));
2571
2571
  }
2572
2572
  if (e) {
2573
- const u = c.attrName(e, "fetch-headers");
2574
- if (t.hasAttribute(u)) {
2575
- const h = t.getRawAttribute(
2576
- u
2573
+ const h = l.attrName(e, "fetch-headers");
2574
+ if (t.hasAttribute(h)) {
2575
+ const f = t.getRawAttribute(
2576
+ h
2577
2577
  );
2578
2578
  try {
2579
- n.headers = x.parseDataBind(h);
2579
+ s.headers = R.parseDataBind(f);
2580
2580
  } catch (g) {
2581
- f.error("Haori", `Invalid fetch headers: ${g}`);
2581
+ d.error("Haori", `Invalid fetch headers: ${g}`);
2582
2582
  }
2583
2583
  }
2584
2584
  } else {
2585
- const u = c.attrName(
2585
+ const h = l.attrName(
2586
2586
  null,
2587
2587
  "headers",
2588
2588
  !0
2589
2589
  );
2590
- if (t.hasAttribute(u)) {
2591
- const h = t.getRawAttribute(
2592
- u
2590
+ if (t.hasAttribute(h)) {
2591
+ const f = t.getRawAttribute(
2592
+ h
2593
2593
  );
2594
2594
  try {
2595
- n.headers = x.parseDataBind(h);
2595
+ s.headers = R.parseDataBind(f);
2596
2596
  } catch (g) {
2597
- f.error("Haori", `Invalid fetch headers: ${g}`);
2597
+ d.error("Haori", `Invalid fetch headers: ${g}`);
2598
2598
  }
2599
2599
  }
2600
2600
  }
2601
2601
  if (e) {
2602
- const u = c.attrName(
2602
+ const h = l.attrName(
2603
2603
  e,
2604
2604
  "fetch-content-type"
2605
2605
  );
2606
- if (t.hasAttribute(u))
2607
- n.headers = {
2608
- ...n.headers,
2609
- "Content-Type": t.getAttribute(u)
2606
+ if (t.hasAttribute(h))
2607
+ s.headers = {
2608
+ ...s.headers,
2609
+ "Content-Type": t.getAttribute(h)
2610
2610
  };
2611
- else if (n.method && n.method !== "GET" && n.method !== "HEAD" && n.method !== "OPTIONS") {
2612
- let h = !1;
2613
- n.headers && typeof n.headers == "object" && (h = "Content-Type" in n.headers), h || (n.headers = {
2614
- ...n.headers,
2611
+ else if (s.method && s.method !== "GET" && s.method !== "HEAD" && s.method !== "OPTIONS") {
2612
+ let f = !1;
2613
+ s.headers && typeof s.headers == "object" && (f = "Content-Type" in s.headers), f || (s.headers = {
2614
+ ...s.headers,
2615
2615
  "Content-Type": "application/json"
2616
2616
  });
2617
- } else n.method && (n.method === "GET" || n.method === "HEAD" || n.method === "OPTIONS") && (n.headers = {
2618
- ...n.headers,
2617
+ } else s.method && (s.method === "GET" || s.method === "HEAD" || s.method === "OPTIONS") && (s.headers = {
2618
+ ...s.headers,
2619
2619
  "Content-Type": "application/x-www-form-urlencoded"
2620
2620
  });
2621
2621
  } else {
2622
- const u = c.attrName(
2622
+ const h = l.attrName(
2623
2623
  null,
2624
2624
  "content-type",
2625
2625
  !0
2626
2626
  );
2627
- if (t.hasAttribute(u))
2628
- n.headers = {
2629
- ...n.headers,
2630
- "Content-Type": t.getAttribute(u)
2627
+ if (t.hasAttribute(h))
2628
+ s.headers = {
2629
+ ...s.headers,
2630
+ "Content-Type": t.getAttribute(h)
2631
2631
  };
2632
- else if (n.method && n.method !== "GET" && n.method !== "HEAD" && n.method !== "OPTIONS") {
2633
- let h = !1;
2634
- n.headers && typeof n.headers == "object" && (h = "Content-Type" in n.headers), h || (n.headers = {
2635
- ...n.headers,
2632
+ else if (s.method && s.method !== "GET" && s.method !== "HEAD" && s.method !== "OPTIONS") {
2633
+ let f = !1;
2634
+ s.headers && typeof s.headers == "object" && (f = "Content-Type" in s.headers), f || (s.headers = {
2635
+ ...s.headers,
2636
2636
  "Content-Type": "application/json"
2637
2637
  });
2638
- } else n.method && (n.method === "GET" || n.method === "HEAD" || n.method === "OPTIONS") && (n.headers = {
2639
- ...n.headers,
2638
+ } else s.method && (s.method === "GET" || s.method === "HEAD" || s.method === "OPTIONS") && (s.headers = {
2639
+ ...s.headers,
2640
2640
  "Content-Type": "application/x-www-form-urlencoded"
2641
2641
  });
2642
2642
  }
2643
- Object.keys(n).length > 0 && (r.fetchOptions = n);
2644
- const a = e ? c.attrName(e, "bind") : c.attrName(null, "bind", !0);
2643
+ Object.keys(s).length > 0 && (r.fetchOptions = s);
2644
+ const a = e ? l.attrName(e, "bind") : l.attrName(null, "bind", !0);
2645
2645
  if (t.hasAttribute(a)) {
2646
- const u = t.getRawAttribute(a);
2647
- if (u) {
2648
- const h = document.body.querySelectorAll(u);
2649
- h.length > 0 ? (r.bindFragments = [], h.forEach((g) => {
2646
+ const h = t.getRawAttribute(a);
2647
+ if (h) {
2648
+ const f = document.body.querySelectorAll(h);
2649
+ f.length > 0 ? (r.bindFragments = [], f.forEach((g) => {
2650
2650
  const A = T.get(g);
2651
2651
  A && r.bindFragments.push(A);
2652
- })) : f.error(
2652
+ })) : d.error(
2653
2653
  "Haori",
2654
- `Bind element not found: ${u} (${a})`
2654
+ `Bind element not found: ${h} (${a})`
2655
2655
  );
2656
2656
  }
2657
2657
  }
2658
- const o = c.attrName(e, "bind-arg"), d = c.attrName(
2658
+ const o = l.attrName(e, "bind-arg"), u = l.attrName(
2659
2659
  null,
2660
2660
  "arg",
2661
2661
  !0
2662
- ), m = c.attrName(
2662
+ ), m = l.attrName(
2663
2663
  null,
2664
2664
  "bind-arg",
2665
2665
  !0
2666
2666
  );
2667
- e ? t.hasAttribute(o) && (r.bindArg = t.getRawAttribute(o)) : t.hasAttribute(d) ? r.bindArg = t.getRawAttribute(
2668
- d
2667
+ e ? t.hasAttribute(o) && (r.bindArg = t.getRawAttribute(o)) : t.hasAttribute(u) ? r.bindArg = t.getRawAttribute(
2668
+ u
2669
2669
  ) : t.hasAttribute(m) && (r.bindArg = t.getRawAttribute(m));
2670
- const y = e ? c.attrName(e, "bind-params") : c.attrName(null, "bind-params", !0);
2670
+ const y = e ? l.attrName(e, "bind-params") : l.attrName(null, "bind-params", !0);
2671
2671
  if (t.hasAttribute(y)) {
2672
- const u = t.getRawAttribute(y);
2673
- r.bindParams = u.split("&").map((h) => h.trim());
2672
+ const h = t.getRawAttribute(y);
2673
+ r.bindParams = h.split("&").map((f) => f.trim());
2674
2674
  }
2675
- const E = e ? c.attrName(e, "bind-append") : c.attrName(null, "bind-append", !0);
2675
+ const E = e ? l.attrName(e, "bind-append") : l.attrName(null, "bind-append", !0);
2676
2676
  if (t.hasAttribute(E)) {
2677
- const u = t.getRawAttribute(E);
2678
- r.bindAppendParams = u.split("&").map((h) => h.trim()).filter(Boolean);
2677
+ const h = t.getRawAttribute(E);
2678
+ r.bindAppendParams = h.split("&").map((f) => f.trim()).filter(Boolean);
2679
2679
  }
2680
- const S = e ? c.attrName(e, "copy-params") : null;
2680
+ const S = e ? l.attrName(e, "copy-params") : null;
2681
2681
  if (S && t.hasAttribute(S)) {
2682
- const u = t.getRawAttribute(
2682
+ const h = t.getRawAttribute(
2683
2683
  S
2684
2684
  );
2685
- r.copyParams = u.split("&").map((h) => h.trim()).filter(Boolean);
2685
+ r.copyParams = h.split("&").map((f) => f.trim()).filter(Boolean);
2686
2686
  }
2687
2687
  if (e) {
2688
- if (t.hasAttribute(c.attrName(e, "adjust"))) {
2689
- const h = t.getRawAttribute(
2690
- c.attrName(e, "adjust")
2688
+ if (t.hasAttribute(l.attrName(e, "adjust"))) {
2689
+ const f = t.getRawAttribute(
2690
+ l.attrName(e, "adjust")
2691
2691
  );
2692
- if (h) {
2693
- const g = document.body.querySelectorAll(h);
2692
+ if (f) {
2693
+ const g = document.body.querySelectorAll(f);
2694
2694
  g.length > 0 ? (r.adjustFragments = [], g.forEach((A) => {
2695
2695
  const v = T.get(A);
2696
2696
  v && r.adjustFragments.push(v);
2697
- })) : f.error(
2697
+ })) : d.error(
2698
2698
  "Haori",
2699
- `Adjust element not found: ${h} (${c.attrName(e, "adjust")})`
2699
+ `Adjust element not found: ${f} (${l.attrName(e, "adjust")})`
2700
2700
  );
2701
2701
  }
2702
- if (t.hasAttribute(c.attrName(e, "adjust-value"))) {
2702
+ if (t.hasAttribute(l.attrName(e, "adjust-value"))) {
2703
2703
  const g = t.getRawAttribute(
2704
- c.attrName(e, "adjust-value")
2704
+ l.attrName(e, "adjust-value")
2705
2705
  ), A = Number(g);
2706
2706
  isNaN(A) || (r.adjustValue = A);
2707
2707
  }
2708
2708
  }
2709
- if (t.hasAttribute(c.attrName(e, "row-add")) && (r.rowAdd = !0), t.hasAttribute(c.attrName(e, "row-remove")) && (r.rowRemove = !0), t.hasAttribute(c.attrName(e, "row-prev")) && (r.rowMovePrev = !0), t.hasAttribute(c.attrName(e, "row-next")) && (r.rowMoveNext = !0), t.hasAttribute(`${l.prefix}${e}-after-run`)) {
2710
- const h = t.getRawAttribute(
2711
- `${l.prefix}${e}-after-run`
2709
+ if (t.hasAttribute(l.attrName(e, "row-add")) && (r.rowAdd = !0), t.hasAttribute(l.attrName(e, "row-remove")) && (r.rowRemove = !0), t.hasAttribute(l.attrName(e, "row-prev")) && (r.rowMovePrev = !0), t.hasAttribute(l.attrName(e, "row-next")) && (r.rowMoveNext = !0), t.hasAttribute(`${c.prefix}${e}-after-run`)) {
2710
+ const f = t.getRawAttribute(
2711
+ `${c.prefix}${e}-after-run`
2712
2712
  );
2713
2713
  try {
2714
2714
  r.afterCallback = new Function(
2715
2715
  "response",
2716
2716
  `
2717
2717
  "use strict";
2718
- ${h}
2718
+ ${f}
2719
2719
  `
2720
2720
  );
2721
2721
  } catch (g) {
2722
- f.error("Haori", `Invalid after script: ${g}`);
2722
+ d.error("Haori", `Invalid after script: ${g}`);
2723
2723
  }
2724
2724
  }
2725
- if (t.hasAttribute(c.attrName(e, "dialog")) && (r.dialogMessage = t.getAttribute(
2726
- c.attrName(e, "dialog")
2725
+ if (t.hasAttribute(l.attrName(e, "dialog")) && (r.dialogMessage = t.getAttribute(
2726
+ l.attrName(e, "dialog")
2727
2727
  ).replace(/\\n/g, `
2728
- `)), t.hasAttribute(c.attrName(e, "toast"))) {
2728
+ `)), t.hasAttribute(l.attrName(e, "toast"))) {
2729
2729
  r.toastMessage = t.getAttribute(
2730
- c.attrName(e, "toast")
2730
+ l.attrName(e, "toast")
2731
2731
  );
2732
- const h = t.getRawAttribute(
2733
- c.attrName(e, "toast-level")
2734
- ), A = ["info", "warning", "error", "success"].includes(h);
2735
- r.toastLevel = A ? h : null;
2732
+ const f = t.getRawAttribute(
2733
+ l.attrName(e, "toast-level")
2734
+ ), A = ["info", "warning", "error", "success"].includes(f);
2735
+ r.toastLevel = A ? f : null;
2736
2736
  }
2737
- if (t.hasAttribute(c.attrName(e, "redirect")) && (r.redirectUrl = t.getAttribute(
2738
- c.attrName(e, "redirect")
2739
- )), t.hasAttribute(c.attrName(e, "history")) && (r.historyUrl = t.getAttribute(
2740
- c.attrName(e, "history")
2741
- )), t.hasAttribute(c.attrName(e, "history-data")) && (r.historyData = c.resolveDataAttribute(
2737
+ if (t.hasAttribute(l.attrName(e, "redirect")) && (r.redirectUrl = t.getAttribute(
2738
+ l.attrName(e, "redirect")
2739
+ )), t.hasAttribute(l.attrName(e, "scroll-error")) && (r.scrollOnError = !0), t.hasAttribute(l.attrName(e, "scroll")) && (r.scrollTarget = t.getAttribute(
2740
+ l.attrName(e, "scroll")
2741
+ )), t.hasAttribute(l.attrName(e, "history")) && (r.historyUrl = t.getAttribute(
2742
+ l.attrName(e, "history")
2743
+ )), t.hasAttribute(l.attrName(e, "history-data")) && (r.historyData = l.resolveDataAttribute(
2742
2744
  t,
2743
- c.attrName(e, "history-data")
2744
- )), t.hasAttribute(c.attrName(e, "history-form"))) {
2745
- const h = t.getRawAttribute(
2746
- c.attrName(e, "history-form")
2745
+ l.attrName(e, "history-data")
2746
+ )), t.hasAttribute(l.attrName(e, "history-form"))) {
2747
+ const f = t.getRawAttribute(
2748
+ l.attrName(e, "history-form")
2747
2749
  );
2748
- if (h) {
2749
- const g = document.body.querySelector(h);
2750
+ if (f) {
2751
+ const g = document.body.querySelector(f);
2750
2752
  g !== null ? r.historyFormFragment = b.getFormFragment(
2751
2753
  T.get(g)
2752
- ) : f.error(
2754
+ ) : d.error(
2753
2755
  "Haori",
2754
- `Form element not found: ${h} (${c.attrName(e, "history-form")})`
2756
+ `Form element not found: ${f} (${l.attrName(e, "history-form")})`
2755
2757
  );
2756
2758
  } else
2757
2759
  r.historyFormFragment = b.getFormFragment(t);
@@ -2763,16 +2765,16 @@ ${h}
2763
2765
  "copy",
2764
2766
  "open",
2765
2767
  "close"
2766
- ].forEach((h) => {
2767
- const g = c.attrName(e, h);
2768
+ ].forEach((f) => {
2769
+ const g = l.attrName(e, f);
2768
2770
  if (!t.hasAttribute(g))
2769
2771
  return;
2770
2772
  const A = t.getRawAttribute(g), v = [];
2771
- if (A ? (document.body.querySelectorAll(A).forEach((J) => {
2772
- const Z = T.get(J);
2773
- Z && v.push(Z);
2774
- }), v.length === 0 && f.error("Haori", `Element not found: ${A} (${g})`)) : v.push(t), v.length > 0)
2775
- switch (h) {
2773
+ if (A ? (document.body.querySelectorAll(A).forEach((W) => {
2774
+ const tt = T.get(W);
2775
+ tt && v.push(tt);
2776
+ }), v.length === 0 && d.error("Haori", `Element not found: ${A} (${g})`)) : v.push(t), v.length > 0)
2777
+ switch (f) {
2776
2778
  case "reset":
2777
2779
  r.resetFragments = v;
2778
2780
  break;
@@ -2794,25 +2796,25 @@ ${h}
2794
2796
  }
2795
2797
  });
2796
2798
  }
2797
- if (!e && (t.hasAttribute(c.attrName(null, "data", !0)) && (r.data = c.resolveDataAttribute(
2799
+ if (!e && (t.hasAttribute(l.attrName(null, "data", !0)) && (r.data = l.resolveDataAttribute(
2798
2800
  t,
2799
- c.attrName(null, "data", !0)
2800
- )), t.hasAttribute(c.attrName(null, "form", !0)))) {
2801
- const u = t.getRawAttribute(
2802
- c.attrName(null, "form", !0)
2801
+ l.attrName(null, "data", !0)
2802
+ )), t.hasAttribute(l.attrName(null, "form", !0)))) {
2803
+ const h = t.getRawAttribute(
2804
+ l.attrName(null, "form", !0)
2803
2805
  );
2804
- if (u) {
2805
- const h = document.body.querySelector(u);
2806
- h !== null ? r.formFragment = b.getFormFragment(
2807
- T.get(h)
2808
- ) : f.error(
2806
+ if (h) {
2807
+ const f = document.body.querySelector(h);
2808
+ f !== null ? r.formFragment = b.getFormFragment(
2809
+ T.get(f)
2810
+ ) : d.error(
2809
2811
  "Haori",
2810
- `Form element not found: ${u} (${c.attrName(null, "fetch-form", !0)})`
2812
+ `Form element not found: ${h} (${l.attrName(null, "fetch-form", !0)})`
2811
2813
  );
2812
2814
  } else
2813
2815
  r.formFragment = b.getFormFragment(t);
2814
2816
  }
2815
- return s && (!r.bindFragments || r.bindFragments.length === 0) && (r.bindFragments = [t]), r;
2817
+ return n && (!r.bindFragments || r.bindFragments.length === 0) && (r.bindFragments = [t]), r;
2816
2818
  }
2817
2819
  /**
2818
2820
  * ElementFragment の構造的タイプガード。
@@ -2833,7 +2835,7 @@ ${h}
2833
2835
  * @param arg2 イベント名
2834
2836
  */
2835
2837
  constructor(t, e = null) {
2836
- c.isElementFragment(t) ? this.options = c.buildOptions(t, e) : this.options = t;
2838
+ l.isElementFragment(t) ? this.options = l.buildOptions(t, e) : this.options = t;
2837
2839
  }
2838
2840
  /**
2839
2841
  * 一連の処理を実行します。オプションが空の場合は即座にresolveされます。
@@ -2878,42 +2880,42 @@ ${h}
2878
2880
  Object.assign(i, o);
2879
2881
  }
2880
2882
  this.options.data && typeof this.options.data == "object" && Object.assign(i, this.options.data);
2881
- const s = Object.keys(i).length > 0;
2883
+ const n = Object.keys(i).length > 0;
2882
2884
  if (e) {
2883
- const o = { ...r || {} }, d = new Headers(
2885
+ const o = { ...r || {} }, u = new Headers(
2884
2886
  o.headers || void 0
2885
- ), m = (o.method || "GET").toUpperCase(), y = l.runtime === "demo" && !at(m), E = y ? "GET" : m;
2887
+ ), m = (o.method || "GET").toUpperCase(), y = c.runtime === "demo" && !ct(m), E = y ? "GET" : m;
2886
2888
  if (o.method = E, E === "GET" || E === "HEAD" || E === "OPTIONS")
2887
- s && (e = lt(e, i));
2888
- else if (s) {
2889
- const u = d.get("Content-Type") || "";
2890
- if (/multipart\/form-data/i.test(u)) {
2891
- d.delete("Content-Type");
2892
- const h = new FormData();
2889
+ n && (e = ht(e, i));
2890
+ else if (n) {
2891
+ const h = u.get("Content-Type") || "";
2892
+ if (/multipart\/form-data/i.test(h)) {
2893
+ u.delete("Content-Type");
2894
+ const f = new FormData();
2893
2895
  for (const [g, A] of Object.entries(i))
2894
- A == null ? h.append(g, "") : A instanceof Blob ? h.append(g, A) : Array.isArray(A) ? A.forEach((v) => h.append(g, String(v))) : typeof A == "object" ? h.append(g, JSON.stringify(A)) : h.append(g, String(A));
2895
- o.body = h;
2896
- } else if (/application\/x-www-form-urlencoded/i.test(u)) {
2897
- const h = new URLSearchParams();
2896
+ A == null ? f.append(g, "") : A instanceof Blob ? f.append(g, A) : Array.isArray(A) ? A.forEach((v) => f.append(g, String(v))) : typeof A == "object" ? f.append(g, JSON.stringify(A)) : f.append(g, String(A));
2897
+ o.body = f;
2898
+ } else if (/application\/x-www-form-urlencoded/i.test(h)) {
2899
+ const f = new URLSearchParams();
2898
2900
  for (const [g, A] of Object.entries(i))
2899
- A !== void 0 && (A === null ? h.append(g, "") : Array.isArray(A) ? A.forEach((v) => h.append(g, String(v))) : typeof A == "object" ? h.append(g, JSON.stringify(A)) : h.append(g, String(A)));
2900
- o.body = h;
2901
+ A !== void 0 && (A === null ? f.append(g, "") : Array.isArray(A) ? A.forEach((v) => f.append(g, String(v))) : typeof A == "object" ? f.append(g, JSON.stringify(A)) : f.append(g, String(A)));
2902
+ o.body = f;
2901
2903
  } else
2902
- d.set("Content-Type", "application/json"), o.body = JSON.stringify(i);
2904
+ u.set("Content-Type", "application/json"), o.body = JSON.stringify(i);
2903
2905
  }
2904
- o.headers = d;
2906
+ o.headers = u;
2905
2907
  let S;
2906
- if (y && (S = e && new URL(e, window.location.href).search || void 0, d.delete("Content-Type"), f.info("Haori demo fetch normalization", {
2907
- runtime: l.runtime,
2908
+ if (y && (S = e && new URL(e, window.location.href).search || void 0, u.delete("Content-Type"), d.info("Haori demo fetch normalization", {
2909
+ runtime: c.runtime,
2908
2910
  requestedMethod: m,
2909
2911
  effectiveMethod: E,
2910
2912
  transportMode: "query-get",
2911
2913
  url: e,
2912
- payload: s ? i : void 0,
2914
+ payload: n ? i : void 0,
2913
2915
  queryString: S
2914
2916
  })), this.options.targetFragment && e) {
2915
- const u = performance.now(), h = {
2916
- runtime: l.runtime,
2917
+ const h = performance.now(), f = {
2918
+ runtime: c.runtime,
2917
2919
  requestedMethod: m,
2918
2920
  effectiveMethod: E,
2919
2921
  transportMode: y ? "query-get" : "http",
@@ -2923,12 +2925,12 @@ ${h}
2923
2925
  this.options.targetFragment.getTarget(),
2924
2926
  e,
2925
2927
  o,
2926
- s ? i : void 0,
2927
- h
2928
+ n ? i : void 0,
2929
+ f
2928
2930
  ), fetch(e, o).then((g) => this.handleFetchResult(
2929
2931
  g,
2930
2932
  e || void 0,
2931
- u
2933
+ h
2932
2934
  )).catch((g) => {
2933
2935
  throw e && w.fetchError(
2934
2936
  this.options.targetFragment.getTarget(),
@@ -2937,18 +2939,18 @@ ${h}
2937
2939
  ), g;
2938
2940
  });
2939
2941
  }
2940
- return fetch(e, o).then((u) => this.handleFetchResult(u, e || void 0));
2942
+ return fetch(e, o).then((h) => this.handleFetchResult(h, e || void 0));
2941
2943
  }
2942
- if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && s) {
2943
- const o = this.options.formFragment, d = o.getTarget();
2944
- d.setAttribute(
2945
- `${l.prefix}bind`,
2944
+ if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && n) {
2945
+ const o = this.options.formFragment, u = o.getTarget();
2946
+ u.setAttribute(
2947
+ `${c.prefix}bind`,
2946
2948
  JSON.stringify(i)
2947
2949
  );
2948
2950
  const m = o.getBindingData();
2949
- Object.assign(m, i), await x.setBindingData(d, m);
2951
+ Object.assign(m, i), await R.setBindingData(u, m);
2950
2952
  }
2951
- const n = s ? i : {}, a = new Response(JSON.stringify(n), {
2953
+ const s = n ? i : {}, a = new Response(JSON.stringify(s), {
2952
2954
  headers: { "Content-Type": "application/json" }
2953
2955
  });
2954
2956
  return this.handleFetchResult(a);
@@ -2957,7 +2959,7 @@ ${h}
2957
2959
  * フェッチ後の処理を実行します。
2958
2960
  */
2959
2961
  async handleFetchResult(t, e, r) {
2960
- const i = W();
2962
+ const i = Y();
2961
2963
  if (!t.ok)
2962
2964
  return this.options.targetFragment && e && w.fetchError(
2963
2965
  this.options.targetFragment.getTarget(),
@@ -2979,13 +2981,13 @@ ${h}
2979
2981
  typeof a == "object" && "response" in a && (t = "response" in a ? a.response : t);
2980
2982
  }
2981
2983
  }
2982
- const s = [];
2983
- s.push(this.bindResult(t)), s.push(this.adjust()), s.push(this.addRow()), s.push(this.removeRow()), s.push(this.movePrevRow()), s.push(this.moveNextRow()), await Promise.all(s), this.options.resetFragments && this.options.resetFragments.length > 0 && await Promise.all(
2984
+ const n = [];
2985
+ n.push(this.bindResult(t)), n.push(this.adjust()), n.push(this.addRow()), n.push(this.removeRow()), n.push(this.movePrevRow()), n.push(this.moveNextRow()), await Promise.all(n), this.options.resetFragments && this.options.resetFragments.length > 0 && await Promise.all(
2984
2986
  this.options.resetFragments.map((a) => b.reset(a))
2985
2987
  ), await this.copy();
2986
- const n = [];
2988
+ const s = [];
2987
2989
  return this.options.refetchFragments && this.options.refetchFragments.length > 0 && this.options.refetchFragments.forEach((a) => {
2988
- n.push(new c(a, null).run());
2990
+ s.push(new l(a, null).run());
2989
2991
  }), this.options.clickFragments && this.options.clickFragments.length > 0 && this.options.clickFragments.forEach((a) => {
2990
2992
  const o = a.getTarget();
2991
2993
  typeof o.click == "function" ? o.click() : o.dispatchEvent(
@@ -2993,14 +2995,14 @@ ${h}
2993
2995
  );
2994
2996
  }), this.options.openFragments && this.options.openFragments.length > 0 && this.options.openFragments.forEach((a) => {
2995
2997
  const o = a.getTarget();
2996
- o instanceof HTMLElement ? n.push(i.openDialog(o)) : f.error("Haori", "Element is not an HTML element: ", o);
2998
+ o instanceof HTMLElement ? s.push(i.openDialog(o)) : d.error("Haori", "Element is not an HTML element: ", o);
2997
2999
  }), this.options.closeFragments && this.options.closeFragments.length > 0 && this.options.closeFragments.forEach((a) => {
2998
3000
  const o = a.getTarget();
2999
- o instanceof HTMLElement ? n.push(i.closeDialog(o)) : f.error("Haori", "Element is not an HTML element: ", o);
3000
- }), await Promise.all(n), this.options.dialogMessage && await i.dialog(this.options.dialogMessage), this.options.toastMessage && await i.toast(
3001
+ o instanceof HTMLElement ? s.push(i.closeDialog(o)) : d.error("Haori", "Element is not an HTML element: ", o);
3002
+ }), await Promise.all(s), this.options.dialogMessage && await i.dialog(this.options.dialogMessage), this.options.toastMessage && await i.toast(
3001
3003
  this.options.toastMessage,
3002
3004
  this.options.toastLevel ?? "info"
3003
- ), this.pushHistory(), this.options.redirectUrl && (window.location.href = this.options.redirectUrl), !0;
3005
+ ), this.pushHistory(), this.options.scrollTarget && document.querySelector(this.options.scrollTarget)?.scrollIntoView({ behavior: "smooth", block: "nearest" }), this.options.redirectUrl && (window.location.href = this.options.redirectUrl), !0;
3004
3006
  }
3005
3007
  /**
3006
3008
  * history.pushState を実行します。
@@ -3013,26 +3015,30 @@ ${h}
3013
3015
  const t = this.options.historyUrl !== void 0 && this.options.historyUrl !== null, e = this.options.historyData !== void 0 && this.options.historyData !== null, r = this.options.historyFormFragment !== void 0 && this.options.historyFormFragment !== null;
3014
3016
  if (!(!t && !e && !r))
3015
3017
  try {
3016
- const i = t ? this.options.historyUrl : window.location.pathname, s = new URL(i, window.location.href);
3017
- if (s.origin !== window.location.origin) {
3018
- const a = "history.pushState: cross-origin URL is not allowed: " + s.toString();
3019
- f.error(
3018
+ const i = t ? this.options.historyUrl : window.location.pathname, n = new URL(i, window.location.href);
3019
+ if (n.origin !== window.location.origin) {
3020
+ const a = "history.pushState: cross-origin URL is not allowed: " + n.toString();
3021
+ d.error(
3020
3022
  "Haori",
3021
3023
  a
3022
3024
  );
3023
3025
  return;
3024
3026
  }
3025
- const n = (a) => {
3026
- for (const [o, d] of Object.entries(a))
3027
- d != null && (Array.isArray(d) ? d.forEach((m) => s.searchParams.append(o, String(m))) : typeof d == "object" ? s.searchParams.set(o, JSON.stringify(d)) : s.searchParams.set(o, String(d)));
3027
+ const s = (a) => {
3028
+ for (const [o, u] of Object.entries(a))
3029
+ u != null && (Array.isArray(u) ? u.forEach((m) => n.searchParams.append(o, String(m))) : typeof u == "object" ? n.searchParams.set(o, JSON.stringify(u)) : n.searchParams.set(o, String(u)));
3028
3030
  };
3029
- e && n(this.options.historyData), r && n(
3031
+ e && s(this.options.historyData), r && s(
3030
3032
  b.getValues(
3031
3033
  this.options.historyFormFragment
3032
3034
  )
3033
- ), history.pushState({}, "", s.toString());
3035
+ ), history.pushState(
3036
+ { [ot]: !0 },
3037
+ "",
3038
+ n.toString()
3039
+ );
3034
3040
  } catch (i) {
3035
- f.error("Haori", `history.pushState failed: ${i}`);
3041
+ d.error("Haori", `history.pushState failed: ${i}`);
3036
3042
  }
3037
3043
  }
3038
3044
  /**
@@ -3042,30 +3048,35 @@ ${h}
3042
3048
  let e = null;
3043
3049
  this.options.formFragment ? e = this.options.formFragment : this.options.targetFragment && (e = b.getFormFragment(this.options.targetFragment) || this.options.targetFragment);
3044
3050
  const r = async (s) => {
3045
- const n = e ? e.getTarget() : document.body;
3046
- await W().addErrorMessage(n, s);
3051
+ const a = e ? e.getTarget() : document.body;
3052
+ await Y().addErrorMessage(a, s);
3053
+ }, i = () => {
3054
+ if (!this.options.scrollOnError)
3055
+ return;
3056
+ const s = e ? e.getTarget() : document.body;
3057
+ (s.getAttribute("data-message-level") === "error" ? s : s.parentElement?.getAttribute("data-message-level") === "error" ? s.parentElement : s.querySelector('[data-message-level="error"]'))?.scrollIntoView({ behavior: "smooth", block: "nearest" });
3047
3058
  };
3048
3059
  if ((t.headers.get("Content-Type") || "").includes("application/json"))
3049
3060
  try {
3050
- const s = await t.json(), n = [];
3061
+ const s = await t.json(), a = [];
3051
3062
  if (s && typeof s == "object") {
3052
- if (typeof s.message == "string" && n.push({ message: s.message }), Array.isArray(s.messages))
3053
- for (const a of s.messages)
3054
- typeof a == "string" && n.push({ message: a });
3063
+ if (typeof s.message == "string" && a.push({ message: s.message }), Array.isArray(s.messages))
3064
+ for (const o of s.messages)
3065
+ typeof o == "string" && a.push({ message: o });
3055
3066
  if (s.errors && typeof s.errors == "object")
3056
- for (const [a, o] of Object.entries(s.errors))
3057
- Array.isArray(o) ? n.push({ key: a, message: o.join(`
3058
- `) }) : typeof o == "string" ? n.push({ key: a, message: o }) : o != null && n.push({ key: a, message: String(o) });
3059
- if (n.length === 0)
3060
- for (const [a, o] of Object.entries(s))
3061
- a === "message" || a === "messages" || a === "errors" || (Array.isArray(o) ? n.push({ key: a, message: o.join(`
3062
- `) }) : typeof o == "string" && n.push({ key: a, message: o }));
3067
+ for (const [o, u] of Object.entries(s.errors))
3068
+ Array.isArray(u) ? a.push({ key: o, message: u.join(`
3069
+ `) }) : typeof u == "string" ? a.push({ key: o, message: u }) : u != null && a.push({ key: o, message: String(u) });
3070
+ if (a.length === 0)
3071
+ for (const [o, u] of Object.entries(s))
3072
+ o === "message" || o === "messages" || o === "errors" || (Array.isArray(u) ? a.push({ key: o, message: u.join(`
3073
+ `) }) : typeof u == "string" && a.push({ key: o, message: u }));
3063
3074
  }
3064
- if (n.length === 0)
3065
- return await r(`${t.status} ${t.statusText}`), !1;
3066
- for (const a of n)
3067
- a.key && e ? await b.addErrorMessage(e, a.key, a.message) : await r(a.message);
3068
- return !1;
3075
+ if (a.length === 0)
3076
+ return await r(`${t.status} ${t.statusText}`), i(), !1;
3077
+ for (const o of a)
3078
+ o.key && e ? await b.addErrorMessage(e, o.key, o.message) : await r(o.message);
3079
+ return i(), !1;
3069
3080
  } catch {
3070
3081
  }
3071
3082
  try {
@@ -3074,7 +3085,7 @@ ${h}
3074
3085
  } catch {
3075
3086
  await r(`${t.status} ${t.statusText}`);
3076
3087
  }
3077
- return !1;
3088
+ return i(), !1;
3078
3089
  }
3079
3090
  /**
3080
3091
  * 対象のフラグメント以下の入力要素に対してバリデーションを実行します。
@@ -3086,21 +3097,34 @@ ${h}
3086
3097
  validate(t) {
3087
3098
  if (this.options.valid !== !0)
3088
3099
  return !0;
3089
- const e = t.getTarget();
3090
- let r = this.validateOne(t);
3091
- return r || e.focus(), t.getChildElementFragments().reverse().forEach((i) => {
3092
- r &&= this.validate(i);
3093
- }), r;
3100
+ const e = this.findFirstInvalid(t);
3101
+ return e === null ? !0 : (e.reportValidity(), e.focus(), this.options.scrollOnError && e.scrollIntoView({ behavior: "smooth", block: "nearest" }), !1);
3094
3102
  }
3095
3103
  /**
3096
- * 対象のフラグメントに対してバリデーションを実行します。
3104
+ * 対象フラグメント以下で DOM 順の最上部にある invalid 要素を返します。
3105
+ * 副作用のない checkValidity のみを使用し、検出のみを行います。
3097
3106
  *
3098
3107
  * @param fragment 対象のフラグメント
3099
- * @returns バリデーション結果(true: 成功, false: 失敗)
3108
+ * @returns 最初の invalid 要素、なければ null
3109
+ */
3110
+ findFirstInvalid(t) {
3111
+ let e = null;
3112
+ for (const r of t.getChildElementFragments().reverse()) {
3113
+ const i = this.findFirstInvalid(r);
3114
+ i !== null && (e = i);
3115
+ }
3116
+ return this.checkOne(t) ? e : t.getTarget();
3117
+ }
3118
+ /**
3119
+ * 対象のフラグメントに対して、副作用なく有効性を検査します。
3120
+ * reportValidity は使わず checkValidity のみ呼び出します。
3121
+ *
3122
+ * @param fragment 対象のフラグメント
3123
+ * @returns 有効なら true、無効なら false
3100
3124
  */
3101
- validateOne(t) {
3125
+ checkOne(t) {
3102
3126
  const e = t.getTarget();
3103
- return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement ? e.reportValidity() : !0;
3127
+ return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement ? e.checkValidity() : !0;
3104
3128
  }
3105
3129
  /**
3106
3130
  * 確認メッセージを表示し、ユーザーの確認を求めます。
@@ -3110,7 +3134,7 @@ ${h}
3110
3134
  */
3111
3135
  confirm() {
3112
3136
  const t = this.options.confirmMessage;
3113
- return t == null ? Promise.resolve(!0) : W().confirm(t);
3137
+ return t == null ? Promise.resolve(!0) : Y().confirm(t);
3114
3138
  }
3115
3139
  /**
3116
3140
  * 結果データを対象のフラグメントにバインドします。
@@ -3120,40 +3144,40 @@ ${h}
3120
3144
  bindResult(t) {
3121
3145
  return !this.options.bindFragments || this.options.bindFragments.length === 0 ? Promise.resolve() : (t.headers.get("Content-Type")?.includes("application/json") ? t.json() : t.text()).then((r) => {
3122
3146
  if (this.options.bindParams) {
3123
- const s = {};
3124
- this.options.bindParams.forEach((n) => {
3125
- r && typeof r == "object" && n in r && (s[n] = r[n]);
3126
- }), r = s;
3147
+ const n = {};
3148
+ this.options.bindParams.forEach((s) => {
3149
+ r && typeof r == "object" && s in r && (n[s] = r[s]);
3150
+ }), r = n;
3127
3151
  }
3128
3152
  const i = [];
3129
3153
  if (this.options.bindArg)
3130
- this.options.bindFragments.forEach((s) => {
3131
- const n = s.getBindingData(), a = this.options.bindArg;
3154
+ this.options.bindFragments.forEach((n) => {
3155
+ const s = n.getBindingData(), a = this.options.bindArg;
3132
3156
  if (r && typeof r == "object" && !Array.isArray(r)) {
3133
- const o = n[a], d = o && typeof o == "object" && !Array.isArray(o) ? o : {};
3134
- n[a] = this.mergeAppendBindingData(
3135
- s,
3157
+ const o = s[a], u = o && typeof o == "object" && !Array.isArray(o) ? o : {};
3158
+ s[a] = this.mergeAppendBindingData(
3159
+ n,
3136
3160
  r,
3137
- d
3161
+ u
3138
3162
  );
3139
3163
  } else
3140
- n[a] = r;
3141
- i.push(x.setBindingData(s.getTarget(), n));
3164
+ s[a] = r;
3165
+ i.push(R.setBindingData(n.getTarget(), s));
3142
3166
  });
3143
3167
  else {
3144
3168
  if (typeof r == "string")
3145
- return f.error("Haori", "string data cannot be bound without a bindArg."), Promise.reject(
3169
+ return d.error("Haori", "string data cannot be bound without a bindArg."), Promise.reject(
3146
3170
  new Error("string data cannot be bound without a bindArg.")
3147
3171
  );
3148
- this.options.bindFragments.forEach((s) => {
3149
- const n = this.mergeAppendBindingData(
3150
- s,
3172
+ this.options.bindFragments.forEach((n) => {
3173
+ const s = this.mergeAppendBindingData(
3174
+ n,
3151
3175
  r
3152
3176
  );
3153
3177
  i.push(
3154
- x.setBindingData(
3155
- s.getTarget(),
3156
- n
3178
+ R.setBindingData(
3179
+ n.getTarget(),
3180
+ s
3157
3181
  )
3158
3182
  );
3159
3183
  });
@@ -3168,10 +3192,10 @@ ${h}
3168
3192
  mergeAppendBindingData(t, e, r = t.getBindingData()) {
3169
3193
  if (!this.options.bindAppendParams || this.options.bindAppendParams.length === 0)
3170
3194
  return e;
3171
- const i = { ...e }, s = r;
3172
- for (const n of this.options.bindAppendParams) {
3173
- const a = i[n], o = s[n];
3174
- Array.isArray(o) && Array.isArray(a) && (i[n] = o.concat(a));
3195
+ const i = { ...e }, n = r;
3196
+ for (const s of this.options.bindAppendParams) {
3197
+ const a = i[s], o = n[s];
3198
+ Array.isArray(o) && Array.isArray(a) && (i[s] = o.concat(a));
3175
3199
  }
3176
3200
  return i;
3177
3201
  }
@@ -3182,11 +3206,11 @@ ${h}
3182
3206
  if (!this.options.copyFragments || this.options.copyFragments.length === 0)
3183
3207
  return Promise.resolve();
3184
3208
  const t = this.resolveCopySourceData(), e = this.pickCopyData(t), r = this.options.copyFragments.map((i) => {
3185
- const s = {
3209
+ const n = {
3186
3210
  ...i.getBindingData(),
3187
3211
  ...e
3188
3212
  };
3189
- return x.setBindingData(i.getTarget(), s);
3213
+ return R.setBindingData(i.getTarget(), n);
3190
3214
  });
3191
3215
  return Promise.all(r).then(() => {
3192
3216
  });
@@ -3218,8 +3242,8 @@ ${h}
3218
3242
  for (const r of this.options.adjustFragments) {
3219
3243
  let i = r.getValue();
3220
3244
  (i == null || i === "") && (i = "0");
3221
- let s = Number(i);
3222
- isNaN(s) && (s = 0), s += t, e.push(r.setValue(String(s)));
3245
+ let n = Number(i);
3246
+ isNaN(n) && (n = 0), n += t, e.push(r.setValue(String(n)));
3223
3247
  }
3224
3248
  return Promise.all(e).then(() => {
3225
3249
  });
@@ -3231,11 +3255,11 @@ ${h}
3231
3255
  */
3232
3256
  getRowFragment() {
3233
3257
  if (!this.options.targetFragment)
3234
- return f.error("Haori", "Target fragment is not specified for row operation."), null;
3258
+ return d.error("Haori", "Target fragment is not specified for row operation."), null;
3235
3259
  const t = this.options.targetFragment.closestByAttribute(
3236
- `${l.prefix}row`
3260
+ `${c.prefix}row`
3237
3261
  );
3238
- return t || (f.error("Haori", "Row fragment not found."), null);
3262
+ return t || (d.error("Haori", "Row fragment not found."), null);
3239
3263
  }
3240
3264
  /**
3241
3265
  * 行を追加します。
@@ -3251,7 +3275,7 @@ ${h}
3251
3275
  const e = [], r = t.clone();
3252
3276
  return e.push(
3253
3277
  t.getParent().insertAfter(r, t)
3254
- ), e.push(x.evaluateAll(r)), e.push(b.reset(r)), Promise.all(e).then(() => {
3278
+ ), e.push(R.evaluateAll(r)), e.push(b.reset(r)), Promise.all(e).then(() => {
3255
3279
  });
3256
3280
  }
3257
3281
  /**
@@ -3266,7 +3290,7 @@ ${h}
3266
3290
  if (!t)
3267
3291
  return Promise.reject(new Error("Row fragment not found."));
3268
3292
  const e = t.getParent();
3269
- return e && e.getChildElementFragments().filter((i) => !i.hasAttribute(`${l.prefix}each-before`) && !i.hasAttribute(`${l.prefix}each-after`)).length <= 1 ? Promise.resolve() : t.remove();
3293
+ return e && e.getChildElementFragments().filter((i) => !i.hasAttribute(`${c.prefix}each-before`) && !i.hasAttribute(`${c.prefix}each-after`)).length <= 1 ? Promise.resolve() : t.remove();
3270
3294
  }
3271
3295
  /**
3272
3296
  * 前の行へ移動します。
@@ -3303,9 +3327,9 @@ ${h}
3303
3327
  return r ? r.insertAfter(t, e) : Promise.resolve();
3304
3328
  }
3305
3329
  };
3306
- c.DATA_PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g, c.SINGLE_PLACEHOLDER_REGEX = /^(\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\})$/;
3307
- let V = c;
3308
- class ut {
3330
+ l.DATA_PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g, l.SINGLE_PLACEHOLDER_REGEX = /^(\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\})$/;
3331
+ let V = l;
3332
+ class ft {
3309
3333
  /**
3310
3334
  * URLのクエリパラメータを取得します。
3311
3335
  *
@@ -3313,12 +3337,12 @@ class ut {
3313
3337
  */
3314
3338
  static readParams() {
3315
3339
  const t = {}, e = window.location.search;
3316
- return new URLSearchParams(e).forEach((i, s) => {
3317
- t[s] = i;
3340
+ return new URLSearchParams(e).forEach((i, n) => {
3341
+ t[n] = i;
3318
3342
  }), t;
3319
3343
  }
3320
3344
  }
3321
- class ct {
3345
+ class dt {
3322
3346
  /**
3323
3347
  * 指定URLから HTML を取得し、body 内の HTML 文字列を返します。
3324
3348
  *
@@ -3335,24 +3359,24 @@ class ct {
3335
3359
  let r;
3336
3360
  try {
3337
3361
  r = await fetch(t, e);
3338
- } catch (s) {
3339
- throw f.error("[Haori]", "Failed to fetch import source:", t, s), new Error(`Failed to fetch: ${t}`);
3362
+ } catch (n) {
3363
+ throw d.error("[Haori]", "Failed to fetch import source:", t, n), new Error(`Failed to fetch: ${t}`);
3340
3364
  }
3341
3365
  if (!r.ok) {
3342
- const s = `${r.status} ${r.statusText}`;
3343
- throw f.error("[Haori]", "Import HTTP error:", t, s), new Error(`Failed to load ${t}: ${s}`);
3366
+ const n = `${r.status} ${r.statusText}`;
3367
+ throw d.error("[Haori]", "Import HTTP error:", t, n), new Error(`Failed to load ${t}: ${n}`);
3344
3368
  }
3345
3369
  let i;
3346
3370
  try {
3347
3371
  i = await r.text();
3348
- } catch (s) {
3349
- throw f.error("[Haori]", "Failed to read response text:", t, s), new Error(`Failed to read response from: ${t}`);
3372
+ } catch (n) {
3373
+ throw d.error("[Haori]", "Failed to read response text:", t, n), new Error(`Failed to read response from: ${t}`);
3350
3374
  }
3351
3375
  try {
3352
- const n = new DOMParser().parseFromString(i, "text/html");
3353
- return n && n.body ? n.body.innerHTML : (f.warn("[Haori]", "No body found in imported document:", t), i);
3354
- } catch (s) {
3355
- return f.error("[Haori]", "Failed to parse imported HTML:", t, s), i;
3376
+ const s = new DOMParser().parseFromString(i, "text/html");
3377
+ return s && s.body ? s.body.innerHTML : (d.warn("[Haori]", "No body found in imported document:", t), i);
3378
+ } catch (n) {
3379
+ return d.error("[Haori]", "Failed to parse imported HTML:", t, n), i;
3356
3380
  }
3357
3381
  }
3358
3382
  }
@@ -3365,7 +3389,7 @@ const p = class p {
3365
3389
  */
3366
3390
  static isDeferredAttributeName(t) {
3367
3391
  return p.DEFERRED_ATTRIBUTE_SUFFIXES.some(
3368
- (e) => t === `${l.prefix}${e}`
3392
+ (e) => t === `${c.prefix}${e}`
3369
3393
  );
3370
3394
  }
3371
3395
  /**
@@ -3376,7 +3400,7 @@ const p = class p {
3376
3400
  */
3377
3401
  static isEvaluateAllExcludedAttributeName(t) {
3378
3402
  return p.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES.some(
3379
- (e) => t === `${l.prefix}${e}`
3403
+ (e) => t === `${c.prefix}${e}`
3380
3404
  );
3381
3405
  }
3382
3406
  /**
@@ -3396,7 +3420,7 @@ const p = class p {
3396
3420
  * @returns 実際の属性名。data-attr-* でない場合は null
3397
3421
  */
3398
3422
  static getAliasedAttributeName(t) {
3399
- const e = `${l.prefix}${p.ATTRIBUTE_ALIAS_SUFFIX}`;
3423
+ const e = `${c.prefix}${p.ATTRIBUTE_ALIAS_SUFFIX}`;
3400
3424
  return !t.startsWith(e) || t.length <= e.length ? null : t.slice(e.length);
3401
3425
  }
3402
3426
  /**
@@ -3408,8 +3432,8 @@ const p = class p {
3408
3432
  */
3409
3433
  static isAliasedAttributeReflection(t, e) {
3410
3434
  const r = T.get(t);
3411
- return r instanceof R ? r.hasAttribute(
3412
- `${l.prefix}${p.ATTRIBUTE_ALIAS_SUFFIX}${e}`
3435
+ return r instanceof x ? r.hasAttribute(
3436
+ `${c.prefix}${p.ATTRIBUTE_ALIAS_SUFFIX}${e}`
3413
3437
  ) : !1;
3414
3438
  }
3415
3439
  /**
@@ -3443,39 +3467,39 @@ const p = class p {
3443
3467
  t.parentNode && (T.get(t.parentNode)?.isMounted() || document.body.contains(t) ? e.setMounted(!0) : e.setMounted(!1));
3444
3468
  let r = Promise.resolve();
3445
3469
  const i = /* @__PURE__ */ new Set();
3446
- for (const s of p.PRIORITY_ATTRIBUTE_SUFFIXES) {
3447
- const n = l.prefix + s;
3448
- e.hasAttribute(n) && (r = r.then(
3470
+ for (const n of p.PRIORITY_ATTRIBUTE_SUFFIXES) {
3471
+ const s = c.prefix + n;
3472
+ e.hasAttribute(s) && (r = r.then(
3449
3473
  () => p.setAttribute(
3450
3474
  e.getTarget(),
3451
- n,
3452
- e.getRawAttribute(n)
3475
+ s,
3476
+ e.getRawAttribute(s)
3453
3477
  )
3454
- ), i.add(n));
3478
+ ), i.add(s));
3455
3479
  }
3456
- for (const s of e.getAttributeNames()) {
3457
- if (i.has(s) || p.isDeferredAttributeName(s))
3480
+ for (const n of e.getAttributeNames()) {
3481
+ if (i.has(n) || p.isDeferredAttributeName(n))
3458
3482
  continue;
3459
- const n = e.getRawAttribute(s);
3460
- n !== null && (r = r.then(
3461
- () => p.setAttribute(e.getTarget(), s, n)
3483
+ const s = e.getRawAttribute(n);
3484
+ s !== null && (r = r.then(
3485
+ () => p.setAttribute(e.getTarget(), n, s)
3462
3486
  ));
3463
3487
  }
3464
- for (const s of p.DEFERRED_ATTRIBUTE_SUFFIXES) {
3465
- const n = l.prefix + s;
3466
- e.hasAttribute(n) && (r = r.then(
3488
+ for (const n of p.DEFERRED_ATTRIBUTE_SUFFIXES) {
3489
+ const s = c.prefix + n;
3490
+ e.hasAttribute(s) && (r = r.then(
3467
3491
  () => p.setAttribute(
3468
3492
  e.getTarget(),
3469
- n,
3470
- e.getRawAttribute(n)
3493
+ s,
3494
+ e.getRawAttribute(s)
3471
3495
  )
3472
- ), i.add(n));
3496
+ ), i.add(s));
3473
3497
  }
3474
3498
  return r.then(() => {
3475
- const s = [];
3476
- return e.getChildren().forEach((n) => {
3477
- n instanceof R ? s.push(p.scan(n.getTarget())) : n instanceof H && s.push(p.evaluateText(n));
3478
- }), Promise.all(s).then(() => {
3499
+ const n = [];
3500
+ return e.getChildren().forEach((s) => {
3501
+ s instanceof x ? n.push(p.scan(s.getTarget())) : s instanceof H && n.push(p.evaluateText(s));
3502
+ }), Promise.all(n).then(() => {
3479
3503
  });
3480
3504
  }).then(() => {
3481
3505
  });
@@ -3490,57 +3514,57 @@ const p = class p {
3490
3514
  * @returns Promise (DOM操作が完了したときに解決される)
3491
3515
  */
3492
3516
  static setAttribute(t, e, r) {
3493
- const i = T.get(t), s = p.getAliasedAttributeName(e);
3494
- if (s !== null)
3495
- return r === null ? i.removeAliasedAttribute(e, s) : i.setAliasedAttribute(e, s, r);
3496
- const n = [];
3517
+ const i = T.get(t), n = p.getAliasedAttributeName(e);
3518
+ if (n !== null)
3519
+ return r === null ? i.removeAliasedAttribute(e, n) : i.setAliasedAttribute(e, n, r);
3520
+ const s = [];
3497
3521
  switch (e) {
3498
- case `${l.prefix}bind`: {
3522
+ case `${c.prefix}bind`: {
3499
3523
  r === null ? (i.clearBindingDataCache(), i.setBindingData({})) : i.setBindingData(p.parseDataBind(r));
3500
3524
  break;
3501
3525
  }
3502
- case `${l.prefix}if`:
3503
- n.push(p.evaluateIf(i));
3526
+ case `${c.prefix}if`:
3527
+ s.push(p.evaluateIf(i));
3504
3528
  break;
3505
- case `${l.prefix}each`:
3506
- n.push(p.evaluateEach(i));
3529
+ case `${c.prefix}each`:
3530
+ s.push(p.evaluateEach(i));
3507
3531
  break;
3508
- case `${l.prefix}fetch`:
3509
- n.push(
3532
+ case `${c.prefix}fetch`:
3533
+ s.push(
3510
3534
  new V(i, null).run().then(() => {
3511
3535
  })
3512
3536
  );
3513
3537
  break;
3514
- case `${l.prefix}import`: {
3538
+ case `${c.prefix}import`: {
3515
3539
  if (typeof r == "string") {
3516
3540
  const a = i.getTarget(), o = performance.now();
3517
- w.importStart(a, r), n.push(
3518
- ct.load(r).then((d) => {
3519
- const m = new TextEncoder().encode(d).length;
3541
+ w.importStart(a, r), s.push(
3542
+ dt.load(r).then((u) => {
3543
+ const m = new TextEncoder().encode(u).length;
3520
3544
  return P.enqueue(() => {
3521
- a.innerHTML = d;
3545
+ a.innerHTML = u;
3522
3546
  }).then(() => {
3523
3547
  w.importEnd(a, r, m, o);
3524
3548
  });
3525
- }).catch((d) => {
3526
- w.importError(a, r, d), f.error("[Haori]", "Failed to import HTML:", r, d);
3549
+ }).catch((u) => {
3550
+ w.importError(a, r, u), d.error("[Haori]", "Failed to import HTML:", r, u);
3527
3551
  })
3528
3552
  );
3529
3553
  }
3530
3554
  break;
3531
3555
  }
3532
- case `${l.prefix}url-param`: {
3533
- const a = i.getAttribute(`${l.prefix}url-arg`), o = ut.readParams();
3556
+ case `${c.prefix}url-param`: {
3557
+ const a = i.getAttribute(`${c.prefix}url-arg`), o = ft.readParams();
3534
3558
  if (a === null)
3535
- n.push(p.setBindingData(t, o));
3559
+ s.push(p.setBindingData(t, o));
3536
3560
  else {
3537
- const d = i.getRawBindingData() || {};
3538
- d[String(a)] = o, n.push(p.setBindingData(t, d));
3561
+ const u = i.getRawBindingData() || {};
3562
+ u[String(a)] = o, s.push(p.setBindingData(t, u));
3539
3563
  }
3540
3564
  break;
3541
3565
  }
3542
3566
  }
3543
- return r === null ? n.push(i.removeAttribute(e)) : n.push(i.setAttribute(e, r)), Promise.all(n).then(() => {
3567
+ return r === null ? s.push(i.removeAttribute(e)) : s.push(i.setAttribute(e, r)), Promise.all(s).then(() => {
3544
3568
  });
3545
3569
  }
3546
3570
  /**
@@ -3554,15 +3578,15 @@ const p = class p {
3554
3578
  static setBindingData(t, e) {
3555
3579
  const r = T.get(t), i = r.getRawBindingData();
3556
3580
  r.setBindingData(e);
3557
- let s = r.setAttribute(
3558
- `${l.prefix}bind`,
3581
+ let n = r.setAttribute(
3582
+ `${c.prefix}bind`,
3559
3583
  JSON.stringify(e)
3560
3584
  );
3561
3585
  if (t.tagName === "FORM") {
3562
- const n = r.getAttribute(`${l.prefix}form-arg`), a = n && e[String(n)] && typeof e[String(n)] == "object" && !Array.isArray(e[String(n)]) ? e[String(n)] : n ? {} : e;
3563
- s = s.then(() => b.syncValues(r, a));
3586
+ const s = r.getAttribute(`${c.prefix}form-arg`), a = s && e[String(s)] && typeof e[String(s)] == "object" && !Array.isArray(e[String(s)]) ? e[String(s)] : s ? {} : e;
3587
+ n = n.then(() => b.syncValues(r, a));
3564
3588
  }
3565
- return s = s.then(() => p.evaluateAll(r)), w.bindChange(t, i, e, "manual"), s.then(() => {
3589
+ return n = n.then(() => p.evaluateAll(r)), w.bindChange(t, i, e, "manual"), n.then(() => {
3566
3590
  });
3567
3591
  }
3568
3592
  /**
@@ -3576,12 +3600,12 @@ const p = class p {
3576
3600
  try {
3577
3601
  return JSON.parse(t);
3578
3602
  } catch (e) {
3579
- return f.error("[Haori]", "Invalid JSON in data-bind:", e), {};
3603
+ return d.error("[Haori]", "Invalid JSON in data-bind:", e), {};
3580
3604
  }
3581
3605
  else {
3582
3606
  const e = new URLSearchParams(t), r = {};
3583
- for (const [i, s] of e.entries())
3584
- r[i] !== void 0 ? Array.isArray(r[i]) ? r[i].push(s) : r[i] = [r[i], s] : r[i] = s;
3607
+ for (const [i, n] of e.entries())
3608
+ r[i] !== void 0 ? Array.isArray(r[i]) ? r[i].push(n) : r[i] = [r[i], n] : r[i] = n;
3585
3609
  return r;
3586
3610
  }
3587
3611
  }
@@ -3595,8 +3619,8 @@ const p = class p {
3595
3619
  const r = T.get(t);
3596
3620
  if (r.isSkipMutationNodes())
3597
3621
  return;
3598
- const i = T.get(e.nextSibling), s = T.get(e);
3599
- s && (r.insertBefore(s, i), s instanceof R ? p.scan(s.getTarget()) : s instanceof H && p.evaluateText(s));
3622
+ const i = T.get(e.nextSibling), n = T.get(e);
3623
+ n && (r.insertBefore(n, i), n instanceof x ? p.scan(n.getTarget()) : n instanceof H && p.evaluateText(n));
3600
3624
  }
3601
3625
  /**
3602
3626
  * ノードを親要素から削除します。
@@ -3636,11 +3660,11 @@ const p = class p {
3636
3660
  return Promise.resolve();
3637
3661
  const i = [];
3638
3662
  i.push(r.setValue(e));
3639
- const s = p.getFormFragment(r);
3640
- if (s) {
3641
- const n = b.getValues(s), a = s.getAttribute(`${l.prefix}form-arg`);
3663
+ const n = p.getFormFragment(r);
3664
+ if (n) {
3665
+ const s = b.getValues(n), a = n.getAttribute(`${c.prefix}form-arg`);
3642
3666
  let o;
3643
- a ? (o = s.getRawBindingData(), o || (o = {}), o[String(a)] = n) : o = n, i.push(p.setBindingData(s.getTarget(), o));
3667
+ a ? (o = n.getRawBindingData(), o || (o = {}), o[String(a)] = s) : o = s, i.push(p.setBindingData(n.getTarget(), o));
3644
3668
  }
3645
3669
  return Promise.all(i).then(() => {
3646
3670
  });
@@ -3665,14 +3689,14 @@ const p = class p {
3665
3689
  */
3666
3690
  static evaluateAll(t) {
3667
3691
  const e = [];
3668
- return e.push(p.reevaluateInterpolatedAttributes(t)), t.hasAttribute(`${l.prefix}if`) && e.push(p.evaluateIf(t)), t.hasAttribute(`${l.prefix}each`) ? Promise.all(e).then(() => p.evaluateEach(t)).then(() => {
3692
+ return e.push(p.reevaluateInterpolatedAttributes(t)), t.hasAttribute(`${c.prefix}if`) && e.push(p.evaluateIf(t)), t.hasAttribute(`${c.prefix}each`) ? Promise.all(e).then(() => p.evaluateEach(t)).then(() => {
3669
3693
  const r = [];
3670
3694
  return t.getChildren().forEach((i) => {
3671
- i instanceof R ? r.push(p.evaluateAll(i)) : i instanceof H && r.push(p.evaluateText(i));
3695
+ i instanceof x ? r.push(p.evaluateAll(i)) : i instanceof H && r.push(p.evaluateText(i));
3672
3696
  }), Promise.all(r).then(() => {
3673
3697
  });
3674
3698
  }) : (t.getChildren().forEach((r) => {
3675
- r instanceof R ? e.push(p.evaluateAll(r)) : r instanceof H && e.push(p.evaluateText(r));
3699
+ r instanceof x ? e.push(p.evaluateAll(r)) : r instanceof H && e.push(p.evaluateText(r));
3676
3700
  }), Promise.all(e).then(() => {
3677
3701
  }));
3678
3702
  }
@@ -3693,7 +3717,7 @@ const p = class p {
3693
3717
  * @return Promise (DOM操作が完了したときに解決される)
3694
3718
  */
3695
3719
  static evaluateIf(t) {
3696
- const e = [], r = t.getAttribute(`${l.prefix}if`);
3720
+ const e = [], r = t.getAttribute(`${c.prefix}if`);
3697
3721
  return r === !1 || r === void 0 || r === null || Number.isNaN(r) ? t.isVisible() && e.push(
3698
3722
  t.hide().then(() => {
3699
3723
  w.hide(t.getTarget());
@@ -3717,20 +3741,20 @@ const p = class p {
3717
3741
  let e = t.getTemplate();
3718
3742
  if (e === null) {
3719
3743
  let i = !1;
3720
- t.getChildren().forEach((n) => {
3721
- if (!i && n instanceof R) {
3722
- if (n.hasAttribute(`${l.prefix}each-before`) || n.hasAttribute(`${l.prefix}each-after`))
3744
+ t.getChildren().forEach((s) => {
3745
+ if (!i && s instanceof x) {
3746
+ if (s.hasAttribute(`${c.prefix}each-before`) || s.hasAttribute(`${c.prefix}each-after`))
3723
3747
  return;
3724
- e = n.clone(), t.setTemplate(e), i = !0, t.removeChild(n);
3725
- const a = n.getTarget();
3726
- a.parentNode && a.parentNode.removeChild(a), n.setMounted(!1);
3748
+ e = s.clone(), t.setTemplate(e), i = !0, t.removeChild(s);
3749
+ const a = s.getTarget();
3750
+ a.parentNode && a.parentNode.removeChild(a), s.setMounted(!1);
3727
3751
  }
3728
3752
  });
3729
- const s = t.getAttribute(`${l.prefix}each`);
3730
- return Array.isArray(s) ? this.updateDiff(t, s) : (f.error("[Haori]", "Invalid each attribute:", s), Promise.reject(new Error("Invalid each attribute.")));
3753
+ const n = t.getAttribute(`${c.prefix}each`);
3754
+ return Array.isArray(n) ? this.updateDiff(t, n) : (d.error("[Haori]", "Invalid each attribute:", n), Promise.reject(new Error("Invalid each attribute.")));
3731
3755
  }
3732
- const r = t.getAttribute(`${l.prefix}each`);
3733
- return Array.isArray(r) ? this.updateDiff(t, r) : (f.error("[Haori]", "Invalid each attribute:", r), Promise.reject(new Error("Invalid each attribute.")));
3756
+ const r = t.getAttribute(`${c.prefix}each`);
3757
+ return Array.isArray(r) ? this.updateDiff(t, r) : (d.error("[Haori]", "Invalid each attribute:", r), Promise.reject(new Error("Invalid each attribute.")));
3734
3758
  }
3735
3759
  /**
3736
3760
  * 差分を更新します。
@@ -3741,27 +3765,27 @@ const p = class p {
3741
3765
  static updateDiff(t, e) {
3742
3766
  const r = t.getTemplate();
3743
3767
  if (r === null)
3744
- return f.error("[Haori]", "Template is not set for each element."), Promise.resolve();
3745
- let i = t.getAttribute(`${l.prefix}each-index`);
3768
+ return d.error("[Haori]", "Template is not set for each element."), Promise.resolve();
3769
+ let i = t.getAttribute(`${c.prefix}each-index`);
3746
3770
  i && (i = String(i));
3747
- const s = t.getAttribute(`${l.prefix}each-key`), n = t.getAttribute(`${l.prefix}each-arg`), a = /* @__PURE__ */ new Map(), o = [];
3748
- e.forEach((u, h) => {
3771
+ const n = t.getAttribute(`${c.prefix}each-key`), s = t.getAttribute(`${c.prefix}each-arg`), a = /* @__PURE__ */ new Map(), o = [];
3772
+ e.forEach((h, f) => {
3749
3773
  const g = p.createListKey(
3750
- u,
3751
- s ? String(s) : null,
3752
- h
3774
+ h,
3775
+ n ? String(n) : null,
3776
+ f
3753
3777
  );
3754
- o.push(g), a.set(g, { item: u, itemIndex: h });
3778
+ o.push(g), a.set(g, { item: h, itemIndex: f });
3755
3779
  });
3756
- const d = [];
3757
- let m = t.getChildren().filter((u) => u instanceof R).filter(
3758
- (u) => !u.hasAttribute(`${l.prefix}each-before`) && !u.hasAttribute(`${l.prefix}each-after`)
3780
+ const u = [];
3781
+ let m = t.getChildren().filter((h) => h instanceof x).filter(
3782
+ (h) => !h.hasAttribute(`${c.prefix}each-before`) && !h.hasAttribute(`${c.prefix}each-after`)
3759
3783
  );
3760
- m = m.filter((u) => o.indexOf(String(u.getListKey())) === -1 ? (d.push(u.remove()), !1) : !0);
3761
- const y = m.map((u) => u.getListKey()), E = t.getChildren().filter((u) => u instanceof R).filter((u) => u.hasAttribute(`${l.prefix}each-before`)).length;
3784
+ m = m.filter((h) => o.indexOf(String(h.getListKey())) === -1 ? (u.push(h.remove()), !1) : !0);
3785
+ const y = m.map((h) => h.getListKey()), E = t.getChildren().filter((h) => h instanceof x).filter((h) => h.hasAttribute(`${c.prefix}each-before`)).length;
3762
3786
  let S = Promise.resolve();
3763
- return o.forEach((u, h) => {
3764
- const g = y.indexOf(u), { item: A, itemIndex: v } = a.get(u);
3787
+ return o.forEach((h, f) => {
3788
+ const g = y.indexOf(h), { item: A, itemIndex: v } = a.get(h);
3765
3789
  let k;
3766
3790
  if (g !== -1)
3767
3791
  k = m[g], S = S.then(
@@ -3770,44 +3794,44 @@ const p = class p {
3770
3794
  A,
3771
3795
  i,
3772
3796
  v,
3773
- n ? String(n) : null,
3774
- u
3797
+ s ? String(s) : null,
3798
+ h
3775
3799
  ).then(() => p.evaluateAll(k))
3776
3800
  );
3777
3801
  else {
3778
3802
  k = r.clone();
3779
- const J = E + h;
3803
+ const W = E + f;
3780
3804
  S = S.then(
3781
3805
  () => p.updateRowFragment(
3782
3806
  k,
3783
3807
  A,
3784
3808
  i,
3785
3809
  v,
3786
- n ? String(n) : null,
3787
- u
3810
+ s ? String(s) : null,
3811
+ h
3788
3812
  ).then(
3789
3813
  () => t.insertBefore(
3790
3814
  k,
3791
- t.getChildren()[J] || null
3815
+ t.getChildren()[W] || null
3792
3816
  ).then(() => p.evaluateAll(k))
3793
3817
  )
3794
3818
  );
3795
3819
  }
3796
- }), Promise.all(d).then(() => S).then(() => {
3797
- const u = o.filter(
3820
+ }), Promise.all(u).then(() => S).then(() => {
3821
+ const h = o.filter(
3798
3822
  (v) => v !== null
3799
- ), h = y.filter(
3823
+ ), f = y.filter(
3800
3824
  (v) => v !== null
3801
- ), g = u.filter(
3825
+ ), g = h.filter(
3826
+ (v) => !f.includes(v)
3827
+ ), A = f.filter(
3802
3828
  (v) => !h.includes(v)
3803
- ), A = h.filter(
3804
- (v) => !u.includes(v)
3805
3829
  );
3806
3830
  w.eachUpdate(
3807
3831
  t.getTarget(),
3808
3832
  g,
3809
3833
  A,
3810
- u
3834
+ h
3811
3835
  );
3812
3836
  });
3813
3837
  }
@@ -3823,8 +3847,8 @@ const p = class p {
3823
3847
  let i;
3824
3848
  if (typeof t == "object" && t !== null)
3825
3849
  if (e) {
3826
- const s = t[e];
3827
- s == null ? i = `__index_${r}` : typeof s == "object" ? i = JSON.stringify(s) : i = String(s);
3850
+ const n = t[e];
3851
+ n == null ? i = `__index_${r}` : typeof n == "object" ? i = JSON.stringify(n) : i = String(n);
3828
3852
  } else
3829
3853
  i = `__index_${r}`;
3830
3854
  else
@@ -3842,22 +3866,22 @@ const p = class p {
3842
3866
  * @param listKey リストキー
3843
3867
  * @returns 行メタデータの更新完了 Promise
3844
3868
  */
3845
- static updateRowFragment(t, e, r, i, s, n) {
3869
+ static updateRowFragment(t, e, r, i, n, s) {
3846
3870
  let a = e;
3847
3871
  if (typeof e == "object" && e !== null)
3848
- a = { ...e }, r && (a[r] = i), s && (a = {
3849
- [s]: a
3872
+ a = { ...e }, r && (a[r] = i), n && (a = {
3873
+ [n]: a
3850
3874
  });
3851
- else if (s)
3875
+ else if (n)
3852
3876
  a = {
3853
- [s]: e
3877
+ [n]: e
3854
3878
  }, r && (a[r] = i);
3855
3879
  else
3856
- return f.error(
3880
+ return d.error(
3857
3881
  "[Haori]",
3858
- `Primitive value requires '${l.prefix}each-arg' attribute: ${e}`
3882
+ `Primitive value requires '${c.prefix}each-arg' attribute: ${e}`
3859
3883
  ), Promise.resolve();
3860
- return t.setListKey(n), t.setBindingData(a), t.setAttribute(`${l.prefix}row`, n);
3884
+ return t.setListKey(s), t.setBindingData(a), t.setAttribute(`${c.prefix}row`, s);
3861
3885
  }
3862
3886
  };
3863
3887
  p.ATTRIBUTE_ALIAS_SUFFIX = "attr-", p.PRIORITY_ATTRIBUTE_SUFFIXES = ["bind", "if", "each"], p.DEFERRED_ATTRIBUTE_SUFFIXES = ["fetch", "url-param"], p.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES = [
@@ -3868,8 +3892,8 @@ p.ATTRIBUTE_ALIAS_SUFFIX = "attr-", p.PRIORITY_ATTRIBUTE_SUFFIXES = ["bind", "if
3868
3892
  "import",
3869
3893
  "url-param"
3870
3894
  ], p.ATTRIBUTE_PLACEHOLDER_REGEX = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/;
3871
- let x = p;
3872
- class ht {
3895
+ let R = p;
3896
+ const X = class X {
3873
3897
  /**
3874
3898
  * コンストラクタ。
3875
3899
  *
@@ -3879,20 +3903,23 @@ class ht {
3879
3903
  this.onClick = (e) => this.delegate(e, "click"), this.onChange = (e) => this.delegate(e, "change"), this.onLoadCapture = (e) => this.delegate(e, "load"), this.onWindowLoad = () => {
3880
3904
  const e = document.documentElement, r = T.get(e);
3881
3905
  r && new V(r, "load").run();
3906
+ }, this.onPopstate = (e) => {
3907
+ const r = e.state;
3908
+ !r || r[X.HISTORY_STATE_KEY] !== !0 || location.reload();
3882
3909
  }, this.root = t;
3883
3910
  }
3884
3911
  /**
3885
3912
  * イベントリスナーの登録を開始します。
3886
- * クリック、変更、ロードイベントを監視し、対応するProcedureを実行します。
3913
+ * クリック、変更、ロード、popstate イベントを監視し、対応するProcedureを実行します。
3887
3914
  */
3888
3915
  start() {
3889
- this.root.addEventListener("click", this.onClick), this.root.addEventListener("change", this.onChange), this.root.addEventListener("load", this.onLoadCapture, !0), window.addEventListener("load", this.onWindowLoad, { once: !0 });
3916
+ this.root.addEventListener("click", this.onClick), this.root.addEventListener("change", this.onChange), this.root.addEventListener("load", this.onLoadCapture, !0), window.addEventListener("load", this.onWindowLoad, { once: !0 }), window.addEventListener("popstate", this.onPopstate);
3890
3917
  }
3891
3918
  /**
3892
3919
  * イベントリスナーの登録を停止します。
3893
3920
  */
3894
3921
  stop() {
3895
- this.root.removeEventListener("click", this.onClick), this.root.removeEventListener("change", this.onChange), this.root.removeEventListener("load", this.onLoadCapture, !0), window.removeEventListener("load", this.onWindowLoad);
3922
+ this.root.removeEventListener("click", this.onClick), this.root.removeEventListener("change", this.onChange), this.root.removeEventListener("load", this.onLoadCapture, !0), window.removeEventListener("load", this.onWindowLoad), window.removeEventListener("popstate", this.onPopstate);
3896
3923
  }
3897
3924
  /**
3898
3925
  * イベントを処理し、対応するProcedureを実行します。
@@ -3905,8 +3932,8 @@ class ht {
3905
3932
  if (!r)
3906
3933
  return;
3907
3934
  const i = T.get(r);
3908
- i && (e === "change" && i instanceof R && i.syncValue(), new V(i, e).run().catch((s) => {
3909
- f.error("[Haori]", "Procedure execution error:", s);
3935
+ i && (e === "change" && i instanceof x && i.syncValue(), new V(i, e).run().catch((n) => {
3936
+ d.error("[Haori]", "Procedure execution error:", n);
3910
3937
  }));
3911
3938
  }
3912
3939
  /**
@@ -3918,7 +3945,9 @@ class ht {
3918
3945
  getElementFromTarget(t) {
3919
3946
  return t ? t instanceof HTMLElement ? t : t instanceof Node ? t.parentElement : null : null;
3920
3947
  }
3921
- }
3948
+ };
3949
+ X.HISTORY_STATE_KEY = "__haoriHistoryState__";
3950
+ let Q = X;
3922
3951
  const N = class N {
3923
3952
  static syncTree(t) {
3924
3953
  (t instanceof Element || t instanceof DocumentFragment) && (t instanceof HTMLElement && N.syncElement(t), t.querySelectorAll("*").forEach((e) => {
@@ -3933,23 +3962,23 @@ const N = class N {
3933
3962
  }
3934
3963
  if (typeof IntersectionObserver > "u")
3935
3964
  return;
3936
- const i = N.resolveRoot(r), s = N.resolveRootMargin(r), n = N.resolveThreshold(r), a = r.hasAttribute(`${l.prefix}intersect-once`);
3937
- if (e && e.observer.root === i && e.observer.rootMargin === s && N.sameThreshold(
3965
+ const i = N.resolveRoot(r), n = N.resolveRootMargin(r), s = N.resolveThreshold(r), a = r.hasAttribute(`${c.prefix}intersect-once`);
3966
+ if (e && e.observer.root === i && e.observer.rootMargin === n && N.sameThreshold(
3938
3967
  e.observer.thresholds,
3939
- n
3968
+ s
3940
3969
  ) && e.once === a) {
3941
3970
  e.fragment = r;
3942
3971
  return;
3943
3972
  }
3944
3973
  e && (e.observer.disconnect(), N.registrations.delete(t));
3945
3974
  const o = new IntersectionObserver(
3946
- (d) => {
3975
+ (u) => {
3947
3976
  const m = N.registrations.get(t);
3948
- m && d.forEach((y) => {
3977
+ m && u.forEach((y) => {
3949
3978
  !y.isIntersecting || m.running || N.isDisabled(m.fragment) || (m.running = !0, new V(m.fragment, "intersect").runWithResult().then((E) => {
3950
3979
  E && m.once && (m.observer.disconnect(), N.registrations.delete(t));
3951
3980
  }).catch((E) => {
3952
- f.error(
3981
+ d.error(
3953
3982
  "[Haori]",
3954
3983
  "Intersect procedure execution error:",
3955
3984
  E
@@ -3962,8 +3991,8 @@ const N = class N {
3962
3991
  },
3963
3992
  {
3964
3993
  root: i,
3965
- rootMargin: s,
3966
- threshold: n
3994
+ rootMargin: n,
3995
+ threshold: s
3967
3996
  }
3968
3997
  );
3969
3998
  o.observe(t), N.registrations.set(t, {
@@ -3990,32 +4019,32 @@ const N = class N {
3990
4019
  }
3991
4020
  static shouldObserve(t) {
3992
4021
  return t.getAttributeNames().some((e) => {
3993
- if (!e.startsWith(`${l.prefix}intersect-`))
4022
+ if (!e.startsWith(`${c.prefix}intersect-`))
3994
4023
  return !1;
3995
- const r = e.slice(`${l.prefix}intersect-`.length);
4024
+ const r = e.slice(`${c.prefix}intersect-`.length);
3996
4025
  return !N.CONFIG_KEYS.has(r);
3997
4026
  });
3998
4027
  }
3999
4028
  static resolveRoot(t) {
4000
- const e = `${l.prefix}intersect-root`;
4029
+ const e = `${c.prefix}intersect-root`;
4001
4030
  if (!t.hasAttribute(e))
4002
4031
  return null;
4003
4032
  const r = t.getAttribute(e);
4004
4033
  if (typeof r != "string" || r.trim() === "")
4005
4034
  return null;
4006
4035
  const i = document.querySelector(r);
4007
- return i instanceof HTMLElement ? i : (f.error("[Haori]", `Intersect root element not found: ${r}`), null);
4036
+ return i instanceof HTMLElement ? i : (d.error("[Haori]", `Intersect root element not found: ${r}`), null);
4008
4037
  }
4009
4038
  static resolveRootMargin(t) {
4010
- const e = `${l.prefix}intersect-root-margin`, r = t.getAttribute(e);
4039
+ const e = `${c.prefix}intersect-root-margin`, r = t.getAttribute(e);
4011
4040
  return r === null || r === !1 || r === "" ? "0px" : String(r);
4012
4041
  }
4013
4042
  static resolveThreshold(t) {
4014
- const e = `${l.prefix}intersect-threshold`, r = t.getAttribute(e), i = typeof r == "number" ? r : Number.parseFloat(String(r ?? 0));
4043
+ const e = `${c.prefix}intersect-threshold`, r = t.getAttribute(e), i = typeof r == "number" ? r : Number.parseFloat(String(r ?? 0));
4015
4044
  return Number.isNaN(i) ? 0 : Math.min(1, Math.max(0, i));
4016
4045
  }
4017
4046
  static isDisabled(t) {
4018
- const e = `${l.prefix}intersect-disabled`, r = t.getAttribute(e);
4047
+ const e = `${c.prefix}intersect-disabled`, r = t.getAttribute(e);
4019
4048
  if (r === null || r === !1)
4020
4049
  return !1;
4021
4050
  if (typeof r == "boolean")
@@ -4034,7 +4063,7 @@ N.CONFIG_KEYS = /* @__PURE__ */ new Set([
4034
4063
  "disabled",
4035
4064
  "once"
4036
4065
  ]), N.registrations = /* @__PURE__ */ new Map();
4037
- let L = N;
4066
+ let $ = N;
4038
4067
  const I = class I {
4039
4068
  /**
4040
4069
  * 初期化メソッド。
@@ -4045,10 +4074,10 @@ const I = class I {
4045
4074
  return;
4046
4075
  I._initialized = !0;
4047
4076
  const t = await Promise.allSettled([
4048
- x.scan(document.head),
4049
- x.scan(document.body)
4077
+ R.scan(document.head),
4078
+ R.scan(document.body)
4050
4079
  ]), [e, r] = t;
4051
- e.status !== "fulfilled" && f.error("[Haori]", "Failed to build head fragment:", e.reason), r.status !== "fulfilled" && f.error("[Haori]", "Failed to build body fragment:", r.reason), I.observe(document.head), I.observe(document.body), new ht().start(), L.syncTree(document.body);
4080
+ e.status !== "fulfilled" && d.error("[Haori]", "Failed to build head fragment:", e.reason), r.status !== "fulfilled" && d.error("[Haori]", "Failed to build body fragment:", r.reason), I.observe(document.head), I.observe(document.body), new Q().start(), $.syncTree(document.body);
4052
4081
  }
4053
4082
  /**
4054
4083
  * 指定された要素を監視します。
@@ -4061,45 +4090,45 @@ const I = class I {
4061
4090
  try {
4062
4091
  switch (i.type) {
4063
4092
  case "attributes": {
4064
- f.info(
4093
+ d.info(
4065
4094
  "[Haori]",
4066
4095
  "Attribute changed:",
4067
4096
  i.target,
4068
4097
  i.attributeName
4069
4098
  );
4070
- const s = i.target;
4071
- if (i.attributeName && x.isAliasedAttributeReflection(
4072
- s,
4099
+ const n = i.target;
4100
+ if (i.attributeName && R.isAliasedAttributeReflection(
4101
+ n,
4073
4102
  i.attributeName
4074
4103
  ))
4075
4104
  break;
4076
- x.setAttribute(
4077
- s,
4105
+ R.setAttribute(
4106
+ n,
4078
4107
  i.attributeName,
4079
- s.getAttribute(i.attributeName)
4080
- ), L.syncElement(s);
4108
+ n.getAttribute(i.attributeName)
4109
+ ), $.syncElement(n);
4081
4110
  break;
4082
4111
  }
4083
4112
  case "childList": {
4084
- f.info(
4113
+ d.info(
4085
4114
  "[Haori]",
4086
4115
  "Child list changed:",
4087
- Array.from(i.removedNodes).map((s) => s.nodeName),
4088
- Array.from(i.addedNodes).map((s) => s.nodeName)
4089
- ), Array.from(i.removedNodes).forEach((s) => {
4090
- L.cleanupTree(s), x.removeNode(s);
4091
- }), Array.from(i.addedNodes).forEach((s) => {
4092
- s.parentElement instanceof HTMLElement && (x.addNode(s.parentElement, s), L.syncTree(s));
4116
+ Array.from(i.removedNodes).map((n) => n.nodeName),
4117
+ Array.from(i.addedNodes).map((n) => n.nodeName)
4118
+ ), Array.from(i.removedNodes).forEach((n) => {
4119
+ $.cleanupTree(n), R.removeNode(n);
4120
+ }), Array.from(i.addedNodes).forEach((n) => {
4121
+ n.parentElement instanceof HTMLElement && (R.addNode(n.parentElement, n), $.syncTree(n));
4093
4122
  });
4094
4123
  break;
4095
4124
  }
4096
4125
  case "characterData": {
4097
- f.info(
4126
+ d.info(
4098
4127
  "[Haori]",
4099
4128
  "Character data changed:",
4100
4129
  i.target,
4101
4130
  i.target.textContent
4102
- ), i.target instanceof Text || i.target instanceof Comment ? x.changeText(i.target, i.target.textContent) : f.warn(
4131
+ ), i.target instanceof Text || i.target instanceof Comment ? R.changeText(i.target, i.target.textContent) : d.warn(
4103
4132
  "[Haori]",
4104
4133
  "Unsupported character data type:",
4105
4134
  i.target
@@ -4107,33 +4136,33 @@ const I = class I {
4107
4136
  break;
4108
4137
  }
4109
4138
  default:
4110
- f.warn("[Haori]", "Unknown mutation type:", i.type);
4139
+ d.warn("[Haori]", "Unknown mutation type:", i.type);
4111
4140
  continue;
4112
4141
  }
4113
- } catch (s) {
4114
- f.error("[Haori]", "Error processing mutation:", s);
4142
+ } catch (n) {
4143
+ d.error("[Haori]", "Error processing mutation:", n);
4115
4144
  }
4116
4145
  }).observe(t, {
4117
4146
  childList: !0,
4118
4147
  subtree: !0,
4119
4148
  attributes: !0,
4120
4149
  characterData: !0
4121
- }), f.info("[Haori]", "Observer initialized for", t);
4150
+ }), d.info("[Haori]", "Observer initialized for", t);
4122
4151
  }
4123
4152
  };
4124
4153
  I._initialized = !1;
4125
4154
  let q = I;
4126
4155
  document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", q.init) : q.init();
4127
- const ft = "0.4.3";
4156
+ const pt = "0.4.3";
4128
4157
  export {
4129
- x as Core,
4130
- l as Env,
4158
+ R as Core,
4159
+ c as Env,
4131
4160
  b as Form,
4132
4161
  T as Fragment,
4133
- X as Haori,
4134
- f as Log,
4162
+ J as Haori,
4163
+ d as Log,
4135
4164
  P as Queue,
4136
- X as default,
4137
- ft as version
4165
+ J as default,
4166
+ pt as version
4138
4167
  };
4139
4168
  //# sourceMappingURL=haori.es.js.map