haori 0.17.2 → 0.18.1

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
@@ -31,11 +31,11 @@ const G = class G {
31
31
  G.devMode = !1;
32
32
  let H = G;
33
33
  const ct = "embedded";
34
- function yt(p) {
34
+ function Et(p) {
35
35
  return p === "embedded" || p === "demo";
36
36
  }
37
37
  function xt(p) {
38
- return p === null ? null : yt(p) ? p : ct;
38
+ return p === null ? null : Et(p) ? p : ct;
39
39
  }
40
40
  const L = class L {
41
41
  /**
@@ -53,7 +53,7 @@ const L = class L {
53
53
  * @return 戻り値はありません。
54
54
  */
55
55
  static setRuntime(t) {
56
- L._runtime = yt(t) ? t : ct;
56
+ L._runtime = Et(t) ? t : ct;
57
57
  }
58
58
  /**
59
59
  * 実行環境からプレフィックスと開発モードかどうかを自動検出します。
@@ -126,11 +126,11 @@ class m {
126
126
  console.error(t, ...e);
127
127
  }
128
128
  }
129
- const Pt = "yyyy/MM/dd HH:mm", It = "en-US", vt = 1e4;
129
+ const kt = "yyyy/MM/dd HH:mm", Pt = "en-US", vt = 1e4;
130
130
  function q(p) {
131
131
  return String(p).padStart(2, "0");
132
132
  }
133
- function At(p, t = Pt) {
133
+ function At(p, t = kt) {
134
134
  if (p == null || p === "")
135
135
  return "";
136
136
  const e = p instanceof Date ? p : new Date(p);
@@ -172,7 +172,7 @@ function St(p, t) {
172
172
  const i = Math.max(0, Math.trunc(t));
173
173
  r.minimumFractionDigits = i, r.maximumFractionDigits = i;
174
174
  }
175
- return new Intl.NumberFormat(It, r).format(e);
175
+ return new Intl.NumberFormat(Pt, r).format(e);
176
176
  }
177
177
  function Tt(p, t, e) {
178
178
  let r, i, n;
@@ -196,18 +196,18 @@ function wt(p, t, e = {}) {
196
196
  Math.max(Math.trunc(Number(t)) || 0, 0),
197
197
  r - 1
198
198
  ), n = Math.max(0, Math.trunc(e.window ?? 2)), s = Math.max(0, Math.trunc(e.boundary ?? 1)), a = /* @__PURE__ */ new Set();
199
- for (let h = 0; h < s && h < r; h += 1)
200
- a.add(h);
201
- for (let h = Math.max(0, r - s); h < r; h += 1)
202
- a.add(h);
203
- for (let h = Math.max(0, i - n); h <= Math.min(r - 1, i + n); h += 1)
204
- a.add(h);
205
- const o = Array.from(a).sort((h, g) => h - g), u = [];
206
- let d = null;
207
- for (const h of o) {
208
- if (d !== null && h - d > 1)
209
- if (h - d === 2) {
210
- const g = d + 1;
199
+ for (let d = 0; d < s && d < r; d += 1)
200
+ a.add(d);
201
+ for (let d = Math.max(0, r - s); d < r; d += 1)
202
+ a.add(d);
203
+ for (let d = Math.max(0, i - n); d <= Math.min(r - 1, i + n); d += 1)
204
+ a.add(d);
205
+ const o = Array.from(a).sort((d, g) => d - g), u = [];
206
+ let c = null;
207
+ for (const d of o) {
208
+ if (c !== null && d - c > 1)
209
+ if (d - c === 2) {
210
+ const g = c + 1;
211
211
  u.push({
212
212
  page: g,
213
213
  label: g + 1,
@@ -217,15 +217,15 @@ function wt(p, t, e = {}) {
217
217
  } else
218
218
  u.push({ page: null, label: "…", active: !1, ellipsis: !0 });
219
219
  u.push({
220
- page: h,
221
- label: h + 1,
222
- active: h === i,
220
+ page: d,
221
+ label: d + 1,
222
+ active: d === i,
223
223
  ellipsis: !1
224
- }), d = h;
224
+ }), c = d;
225
225
  }
226
226
  return u;
227
227
  }
228
- const Ct = /^(\d{4})-(\d{1,2})$/, kt = 1200;
228
+ const It = /^(\d{4})-(\d{1,2})$/, Ct = 1200;
229
229
  function tt(p, t) {
230
230
  const e = Number(p);
231
231
  return Number.isFinite(e) ? Math.trunc(e) : t;
@@ -233,7 +233,7 @@ function tt(p, t) {
233
233
  function at(p, t) {
234
234
  if (typeof p != "string")
235
235
  return "";
236
- const e = Ct.exec(p.trim());
236
+ const e = It.exec(p.trim());
237
237
  if (!e)
238
238
  return "";
239
239
  const r = Number(e[1]), i = Number(e[2]);
@@ -255,7 +255,7 @@ function Dt(p, t) {
255
255
  const r = Bt(t);
256
256
  if (r === "")
257
257
  return [];
258
- const i = Math.min(e, kt), n = [];
258
+ const i = Math.min(e, Ct), n = [];
259
259
  for (let s = 0; s <= i; s += 1) {
260
260
  const a = at(r, -s);
261
261
  n.push({ targetMonth: a, label: a.replace(/-/g, "/") });
@@ -277,11 +277,11 @@ function Rt(p, t) {
277
277
  if (t !== void 0 && Number.isFinite(t))
278
278
  u = Math.max(0, Math.trunc(t));
279
279
  else {
280
- const h = tt(r.numberOfElements, NaN);
281
- u = Number.isFinite(h) ? h : Math.min(s, i - a);
280
+ const d = tt(r.numberOfElements, NaN);
281
+ u = Number.isFinite(d) ? d : Math.min(s, i - a);
282
282
  }
283
- const d = Math.min(a + u, i);
284
- return { start: o, end: Math.max(d, o), total: i, empty: !1 };
283
+ const c = Math.min(a + u, i);
284
+ return { start: o, end: Math.max(c, o), total: i, empty: !1 };
285
285
  }
286
286
  function Nt(p, t, e) {
287
287
  if (!Array.isArray(p) || p.length === 0)
@@ -401,7 +401,7 @@ const $t = Object.freeze({
401
401
  if (this.containsDangerousPatterns(t)) {
402
402
  const o = this.detectDisallowedKeywords(t);
403
403
  if (o.length > 0) {
404
- const u = o.some((d) => d === "function" || d === "return") ? " Statement keywords are not allowed in expressions; use an arrow function such as `x => ({key: value})` instead of `function(x){ return {key: value}; }`." : " These are statement keywords and cannot be used in expressions.";
404
+ const u = o.some((c) => c === "function" || c === "return") ? " Statement keywords are not allowed in expressions; use an arrow function such as `x => ({key: value})` instead of `function(x){ return {key: value}; }`." : " These are statement keywords and cannot be used in expressions.";
405
405
  m.warn(
406
406
  "[Haori]",
407
407
  t,
@@ -444,29 +444,29 @@ const $t = Object.freeze({
444
444
  if (u.compileFailed || u.evaluator === null)
445
445
  return { value: null, unresolvedReference: !1 };
446
446
  try {
447
- const d = [], h = this.wrapBoundValues(s);
447
+ const c = [], d = this.wrapBoundValues(s);
448
448
  return u.bindKeys.forEach((g) => {
449
- d.push(h[g]);
449
+ c.push(d[g]);
450
450
  }), {
451
451
  value: this.withBlockedPropertyAccess(
452
- () => u.evaluator(...d)
452
+ () => u.evaluator(...c)
453
453
  ),
454
454
  unresolvedReference: !1
455
455
  };
456
- } catch (d) {
457
- if (a && d instanceof ReferenceError) {
458
- const g = this.extractMissingIdentifier(d);
456
+ } catch (c) {
457
+ if (a && c instanceof ReferenceError) {
458
+ const g = this.extractMissingIdentifier(c);
459
459
  if (g !== null && this.canRecoverMissingIdentifier(g, s)) {
460
460
  s[g] = void 0;
461
461
  continue;
462
462
  }
463
463
  }
464
- const h = this.detectForbiddenIdentifiers(t);
465
- return h.length > 0 && m.warn(
464
+ const d = this.detectForbiddenIdentifiers(t);
465
+ return d.length > 0 && m.warn(
466
466
  "[Haori]",
467
- "Expression references blocked identifier(s): " + h.join(", ") + ". These are blocked in expressions and evaluate to undefined (often the cause of this error). Use spread {...a, ...b} instead of Object.assign.",
467
+ "Expression references blocked identifier(s): " + d.join(", ") + ". These are blocked in expressions and evaluate to undefined (often the cause of this error). Use spread {...a, ...b} instead of Object.assign.",
468
468
  t
469
- ), m.error("[Haori]", "Expression evaluation error:", t, d), d instanceof ReferenceError ? { value: void 0, unresolvedReference: !0 } : { value: null, unresolvedReference: !1 };
469
+ ), m.error("[Haori]", "Expression evaluation error:", t, c), c instanceof ReferenceError ? { value: void 0, unresolvedReference: !0 } : { value: null, unresolvedReference: !1 };
470
470
  }
471
471
  }
472
472
  return m.error(
@@ -588,12 +588,12 @@ return (${t});`;
588
588
  const r = [];
589
589
  let i = null;
590
590
  for (let n = 0; n < e.length; n++) {
591
- const s = e[n], a = e[n + 1] || null, o = r[r.length - 1] || null, u = e[n - 2] || null, d = e[n - 3] || null;
591
+ const s = e[n], a = e[n + 1] || null, o = r[r.length - 1] || null, u = e[n - 2] || null, c = e[n - 3] || null;
592
592
  if (this.startsObjectKey(
593
593
  o,
594
594
  i,
595
595
  u,
596
- d
596
+ c
597
597
  ) && (s.value === "[" || s.type === "identifier" && this.FORBIDDEN_PROPERTY_NAMES.has(s.value) || s.type === "string" && this.FORBIDDEN_PROPERTY_NAMES.has(
598
598
  this.decodeStringLiteral(s.value)
599
599
  )) || 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(
@@ -610,8 +610,8 @@ return (${t});`;
610
610
  break;
611
611
  }
612
612
  case "[": {
613
- const h = this.startsMemberAccess(i) ? "member" : "array";
614
- r.push(h);
613
+ const d = this.startsMemberAccess(i) ? "member" : "array";
614
+ r.push(d);
615
615
  break;
616
616
  }
617
617
  case "{":
@@ -1216,7 +1216,7 @@ const pt = class pt {
1216
1216
  }
1217
1217
  };
1218
1218
  pt.ASYNC_QUEUE = new dt();
1219
- let P = pt;
1219
+ let k = pt;
1220
1220
  const N = class N {
1221
1221
  /**
1222
1222
  * 集計状態を初期化します。
@@ -1491,7 +1491,7 @@ const Y = class Y {
1491
1491
  return Promise.resolve();
1492
1492
  if (this.parent) {
1493
1493
  const t = this.parent, e = t.skipMutationNodes;
1494
- return P.enqueue(() => {
1494
+ return k.enqueue(() => {
1495
1495
  t.skipMutationNodes = !0, this.target.parentNode === t.getTarget() && t.getTarget().removeChild(this.target), this.mounted = !1;
1496
1496
  }).finally(() => {
1497
1497
  t.skipMutationNodes = e;
@@ -1499,7 +1499,7 @@ const Y = class Y {
1499
1499
  } else {
1500
1500
  const t = this.target.parentNode;
1501
1501
  if (t)
1502
- return P.enqueue(() => {
1502
+ return k.enqueue(() => {
1503
1503
  this.target.parentNode === t && t.removeChild(this.target), this.mounted = !1;
1504
1504
  });
1505
1505
  this.mounted = !1;
@@ -1516,7 +1516,7 @@ const Y = class Y {
1516
1516
  return Promise.resolve();
1517
1517
  if (this.parent) {
1518
1518
  const t = this.parent, e = t.skipMutationNodes;
1519
- return P.enqueue(() => {
1519
+ return k.enqueue(() => {
1520
1520
  t.skipMutationNodes = !0, this.target.parentNode !== t.getTarget() && t.getTarget().appendChild(this.target), this.mounted = !0;
1521
1521
  }).finally(() => {
1522
1522
  t.skipMutationNodes = e;
@@ -1575,8 +1575,8 @@ const Y = class Y {
1575
1575
  }
1576
1576
  };
1577
1577
  Y.FRAGMENT_CACHE = /* @__PURE__ */ new WeakMap();
1578
- let T = Y;
1579
- const W = class W extends T {
1578
+ let w = Y;
1579
+ const W = class W extends w {
1580
1580
  /**
1581
1581
  * エレメントフラグメントのコンストラクタ。
1582
1582
  * アトリビュートや子フラグメントの作成も行います。
@@ -1599,14 +1599,14 @@ const W = class W extends T {
1599
1599
  "month",
1600
1600
  "time",
1601
1601
  "week"
1602
- ], this.children = [], this.attributeMap = /* @__PURE__ */ new Map(), this.bindingData = null, this.bindingWorkChain = Promise.resolve(), this.initialBindAttribute = null, this.derivedBindingData = null, this.bindingDataCache = null, this.descendantBindingDataCache = null, this.visible = !0, this.display = null, this.displayPriority = null, this.template = null, this.listKey = null, this.renderSignature = null, this.eachInputSignature = null, this.deriveSubtreeSignature = null, this.deriveInputSignature = null, this.freshInitializationSkippable = !1, this.value = null, this.skipMutationAttributes = !1, this.skipChangeValue = !1, this.selfWrittenBind = /* @__PURE__ */ new Map(), this.syncValue(), this.initialBindAttribute = t.getAttribute(`${l.prefix}bind`), t.getAttributeNames().forEach((e) => {
1602
+ ], this.children = [], this.attributeMap = /* @__PURE__ */ new Map(), this.bindingData = null, this.bindingWorkChain = Promise.resolve(), this.bindingWorkActive = 0, this.initialBindAttribute = null, this.derivedBindingData = null, this.bindingDataCache = null, this.descendantBindingDataCache = null, this.visible = !0, this.display = null, this.displayPriority = null, this.template = null, this.listKey = null, this.renderSignature = null, this.eachInputSignature = null, this.deriveSubtreeSignature = null, this.deriveInputSignature = null, this.freshInitializationSkippable = !1, this.value = null, this.skipMutationAttributes = !1, this.skipChangeValue = !1, this.selfWrittenBind = /* @__PURE__ */ new Map(), this.syncValue(), this.initialBindAttribute = t.getAttribute(`${l.prefix}bind`), t.getAttributeNames().forEach((e) => {
1603
1603
  const r = t.getAttribute(e);
1604
1604
  if (r !== null && !this.attributeMap.has(e)) {
1605
1605
  const i = new rt(e, r);
1606
1606
  this.attributeMap.set(e, i);
1607
1607
  }
1608
1608
  }), t.childNodes.forEach((e) => {
1609
- const r = T.get(e);
1609
+ const r = w.get(e);
1610
1610
  r.setParent(this), this.children.push(r);
1611
1611
  });
1612
1612
  }
@@ -1767,12 +1767,35 @@ const W = class W extends T {
1767
1767
  * フラグでの「再入即時実行」を行っていましたが、await をまたいで届く**独立した
1768
1768
  * 並行呼出**まで再入扱いしてインライン実行し、`skipMutationAttributes` 中の
1769
1769
  * `data-bind` 書き込みが破棄されて古い値が後勝ちする競合の原因になっていました。
1770
- * 真の再入(data-url-param 等)は呼出側がキューを介さず実行するため、ここでは
1771
- * 一律にチェーンへ積みます。
1770
+ * 真の再入(`data-url-param` の再評価、マネージド `data-fetch` の同一フラグメント
1771
+ * への bind-back)は呼出側が `reentrant=true` でキューを介さず実行するため、
1772
+ * ここでは一律にチェーンへ積みます。
1772
1773
  *
1773
1774
  * @param work 直列化したいバインドデータ更新処理
1774
1775
  * @returns work の完了 Promise
1775
1776
  */
1777
+ /**
1778
+ * このフラグメントのバインドワークが実行中(await をまたぐ期間を含む)かどうかを
1779
+ * 返します。マネージド `data-fetch` の bind-back を reentrant 実行へ切り替えるべきか
1780
+ * の判定に使います。
1781
+ *
1782
+ * @return 実行中なら true
1783
+ */
1784
+ isExecutingBindingWork() {
1785
+ return this.bindingWorkActive > 0;
1786
+ }
1787
+ /**
1788
+ * バインドワークの実行開始を記録します(`Core.setBindingData` の work 開始時に呼ぶ)。
1789
+ */
1790
+ markBindingWorkStart() {
1791
+ this.bindingWorkActive++;
1792
+ }
1793
+ /**
1794
+ * バインドワークの実行終了を記録します(work 完了時に呼ぶ)。
1795
+ */
1796
+ markBindingWorkEnd() {
1797
+ this.bindingWorkActive > 0 && this.bindingWorkActive--;
1798
+ }
1776
1799
  enqueueBindingWork(t) {
1777
1800
  const e = this.bindingWorkChain.then(t, t);
1778
1801
  return this.bindingWorkChain = e.then(
@@ -1965,14 +1988,14 @@ const W = class W extends T {
1965
1988
  if (r instanceof HTMLInputElement && (r.type === "checkbox" || r.type === "radio")) {
1966
1989
  const i = this.getAttribute("value"), n = r.type === "checkbox" && i === "true";
1967
1990
  let s;
1968
- return n ? s = t === !0 || t === "true" : i === "false" ? s = t === !1 : Array.isArray(t) ? s = t.map(String).includes(String(i)) : s = i === String(t), n ? this.value = s : s ? Array.isArray(t) ? this.value = String(i) : this.value = t : this.value = null, r.checked === s ? Promise.resolve() : (this.skipChangeValue = !0, P.enqueue(() => {
1991
+ return n ? s = t === !0 || t === "true" : i === "false" ? s = t === !1 : Array.isArray(t) ? s = t.map(String).includes(String(i)) : s = i === String(t), n ? this.value = s : s ? Array.isArray(t) ? this.value = String(i) : this.value = t : this.value = null, r.checked === s ? Promise.resolve() : (this.skipChangeValue = !0, k.enqueue(() => {
1969
1992
  r.checked = s, e && r.dispatchEvent(new Event("change", { bubbles: !0 }));
1970
1993
  }).finally(() => {
1971
1994
  this.skipChangeValue = !1;
1972
1995
  }));
1973
1996
  } else if (r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement || r instanceof HTMLSelectElement) {
1974
1997
  const i = Array.isArray(t) ? t.join(",") : t;
1975
- return this.value = this.normalizeValueForElement(r, i), this.skipChangeValue = !0, P.enqueue(() => {
1998
+ return this.value = this.normalizeValueForElement(r, i), this.skipChangeValue = !0, k.enqueue(() => {
1976
1999
  r.value = i === null ? "" : String(i), 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 })));
1977
2000
  }).finally(() => {
1978
2001
  this.skipChangeValue = !1;
@@ -2080,7 +2103,7 @@ const W = class W extends T {
2080
2103
  return Promise.resolve();
2081
2104
  this.attributeMap.delete(t), this.skipMutationAttributes = !0;
2082
2105
  const r = this.getTarget();
2083
- return P.enqueue(() => {
2106
+ return k.enqueue(() => {
2084
2107
  r.removeAttribute(t), e !== t && r.removeAttribute(e);
2085
2108
  }).finally(() => {
2086
2109
  this.skipMutationAttributes = !1;
@@ -2104,7 +2127,7 @@ const W = class W extends T {
2104
2127
  if (n) {
2105
2128
  const ot = this.attributeMap.get(t);
2106
2129
  if (ot && (ot.isEvaluate || ot.isForceEvaluation()) && !s.isEvaluate && !s.isForceEvaluation())
2107
- return this.skipMutationAttributes = !0, P.enqueue(() => {
2130
+ return this.skipMutationAttributes = !0, k.enqueue(() => {
2108
2131
  }).finally(() => {
2109
2132
  this.skipMutationAttributes = !1;
2110
2133
  });
@@ -2115,8 +2138,8 @@ const W = class W extends T {
2115
2138
  element: a,
2116
2139
  rawName: t,
2117
2140
  template: r
2118
- }), u = s.isEvaluate || s.isRawEvaluate, d = t === e && W.BOOLEAN_ATTRIBUTES.has(e.toLowerCase()), h = s.isSingleExpression(), g = K.joinEvaluateResults(o.results), E = o.results.length === 1 ? o.results[0] : g, w = !s.isForceEvaluation() && (e !== t || d || h ? o.hasUnresolvedReference || E === null || E === void 0 || E === !1 : u && g === ""), k = s.isForceEvaluation() ? r : h ? E : g, A = i && s.isEvaluate && e === "value" && (a instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(a.type) || a instanceof HTMLTextAreaElement || a instanceof HTMLSelectElement), v = a.getRootNode(), b = A && a === v.activeElement, S = w || k === null || k === !1 ? null : String(k), F = t !== e && a.getAttribute(t) !== r, I = S === null ? a.hasAttribute(e) : a.getAttribute(e) !== S, $ = A && !b && S !== null && a.value !== S, V = e === "checked" && a instanceof HTMLInputElement && (a.type === "checkbox" || a.type === "radio"), C = e === "selected" && a instanceof HTMLOptionElement, Q = v.activeElement, gt = Q !== null && (V && a === Q || C && a.closest("select") === Q), _ = S !== null, mt = V && !gt && a.checked !== _, bt = C && !gt && a.selected !== _;
2119
- return !F && !I && !$ && !mt && !bt ? (A && !b && S !== null && (this.value = this.normalizeValueForElement(a, S)), Promise.resolve()) : (this.skipMutationAttributes = !0, P.enqueue(() => {
2141
+ }), u = s.isEvaluate || s.isRawEvaluate, c = t === e && W.BOOLEAN_ATTRIBUTES.has(e.toLowerCase()), d = s.isSingleExpression(), g = K.joinEvaluateResults(o.results), y = o.results.length === 1 ? o.results[0] : g, T = !s.isForceEvaluation() && (e !== t || c || d ? o.hasUnresolvedReference || y === null || y === void 0 || y === !1 : u && g === ""), P = s.isForceEvaluation() ? r : d ? y : g, A = i && s.isEvaluate && e === "value" && (a instanceof HTMLInputElement && this.INPUT_EVENT_TYPES.includes(a.type) || a instanceof HTMLTextAreaElement || a instanceof HTMLSelectElement), v = a.getRootNode(), b = A && a === v.activeElement, S = T || P === null || P === !1 ? null : String(P), F = t !== e && a.getAttribute(t) !== r, I = S === null ? a.hasAttribute(e) : a.getAttribute(e) !== S, $ = A && !b && S !== null && a.value !== S, V = e === "checked" && a instanceof HTMLInputElement && (a.type === "checkbox" || a.type === "radio"), C = e === "selected" && a instanceof HTMLOptionElement, Q = v.activeElement, gt = Q !== null && (V && a === Q || C && a.closest("select") === Q), _ = S !== null, mt = V && !gt && a.checked !== _, bt = C && !gt && a.selected !== _;
2142
+ return !F && !I && !$ && !mt && !bt ? (A && !b && S !== null && (this.value = this.normalizeValueForElement(a, S)), Promise.resolve()) : (this.skipMutationAttributes = !0, k.enqueue(() => {
2120
2143
  F && a.setAttribute(t, r), S === null ? a.removeAttribute(e) : (I && (a.setAttribute(e, S), e === `${l.prefix}bind` && this.recordSelfWrittenBind(S)), A && !b && (this.value = this.normalizeValueForElement(a, S), $ && (a.value = S))), mt && (a.checked = _), bt && (a.selected = _);
2121
2144
  }).finally(() => {
2122
2145
  this.skipMutationAttributes = !1;
@@ -2133,7 +2156,7 @@ const W = class W extends T {
2133
2156
  return Promise.resolve();
2134
2157
  this.attributeMap.delete(t), this.skipMutationAttributes = !0;
2135
2158
  const e = this.getTarget();
2136
- return P.enqueue(() => {
2159
+ return k.enqueue(() => {
2137
2160
  e.removeAttribute(t);
2138
2161
  }).finally(() => {
2139
2162
  this.skipMutationAttributes = !1;
@@ -2214,7 +2237,7 @@ const W = class W extends T {
2214
2237
  const i = e ? r.nextSibling : r;
2215
2238
  let n = e ? r.nextSibling : r;
2216
2239
  for (; n !== null; ) {
2217
- const s = T.get(n);
2240
+ const s = w.get(n);
2218
2241
  if (s !== null) {
2219
2242
  const a = this.children.indexOf(s);
2220
2243
  if (a !== -1)
@@ -2248,30 +2271,30 @@ const W = class W extends T {
2248
2271
  s && (a = this.children.indexOf(t), e !== null && (o = this.children.indexOf(e)));
2249
2272
  const u = t.getParent();
2250
2273
  u !== null && u.removeChild(t);
2251
- let d = r === void 0 ? e?.getTarget() || null : r;
2274
+ let c = r === void 0 ? e?.getTarget() || null : r;
2252
2275
  if (e === null)
2253
2276
  this.children.push(t);
2254
2277
  else {
2255
2278
  let g;
2256
2279
  if (s ? a !== -1 && a < o ? g = o - 1 : g = o : g = this.children.indexOf(e), g === -1) {
2257
- const E = this.resolveInsertionPointFromDom(
2280
+ const y = this.resolveInsertionPointFromDom(
2258
2281
  e,
2259
2282
  !1
2260
2283
  );
2261
- E === null ? (m.warn(
2284
+ y === null ? (m.warn(
2262
2285
  "[Haori]",
2263
2286
  "Reference child not found in children.",
2264
2287
  e
2265
- ), this.children.push(t)) : (this.children.splice(E.index, 0, t), d = E.referenceNode);
2288
+ ), this.children.push(t)) : (this.children.splice(y.index, 0, t), c = y.referenceNode);
2266
2289
  } else
2267
2290
  this.children.splice(g, 0, t);
2268
2291
  }
2269
2292
  t.setParent(this), t.setMounted(this.mounted);
2270
- const h = this.skipMutationNodes;
2271
- return this.skipMutationNodes = !0, P.enqueue(() => {
2272
- this.target.insertBefore(t.getTarget(), d);
2293
+ const d = this.skipMutationNodes;
2294
+ return this.skipMutationNodes = !0, k.enqueue(() => {
2295
+ this.target.insertBefore(t.getTarget(), c);
2273
2296
  }).finally(() => {
2274
- this.skipMutationNodes = h;
2297
+ this.skipMutationNodes = d;
2275
2298
  });
2276
2299
  }
2277
2300
  /**
@@ -2403,7 +2426,7 @@ W.BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
2403
2426
  "selected"
2404
2427
  ]);
2405
2428
  let M = W;
2406
- class U extends T {
2429
+ class U extends w {
2407
2430
  /**
2408
2431
  * テキストフラグメントのコンストラクタ。
2409
2432
  * 対象テキストノードの内容を初期化します。
@@ -2455,7 +2478,7 @@ class U extends T {
2455
2478
  evaluate() {
2456
2479
  return this.contents.isRawEvaluate && this.parent === null ? Promise.reject(
2457
2480
  new Error("Parent fragment is required for raw evaluation")
2458
- ) : P.enqueue(() => {
2481
+ ) : k.enqueue(() => {
2459
2482
  this.skipMutation = !0;
2460
2483
  let t = this.text;
2461
2484
  this.contents.isRawEvaluate ? t = this.contents.evaluate(
@@ -2481,7 +2504,7 @@ class U extends T {
2481
2504
  });
2482
2505
  }
2483
2506
  }
2484
- class ft extends T {
2507
+ class ft extends w {
2485
2508
  /**
2486
2509
  * コメントフラグメントのコンストラクタ。
2487
2510
  * 対象コメントノードの内容を初期化します。
@@ -2515,7 +2538,7 @@ class ft extends T {
2515
2538
  * @return 更新のPromise
2516
2539
  */
2517
2540
  setContent(t) {
2518
- return this.skipMutation || this.text === t ? Promise.resolve() : (this.text = t, P.enqueue(() => {
2541
+ return this.skipMutation || this.text === t ? Promise.resolve() : (this.text = t, k.enqueue(() => {
2519
2542
  this.skipMutation = !0, this.target.textContent = this.text;
2520
2543
  }).finally(() => {
2521
2544
  this.skipMutation = !1;
@@ -2627,20 +2650,20 @@ const nt = class nt {
2627
2650
  return this.contents.forEach((u) => {
2628
2651
  try {
2629
2652
  if (r(u)) {
2630
- const d = et.measure(
2653
+ const c = et.measure(
2631
2654
  () => z.evaluateDetailed(u.text, t)
2632
- ), h = d.value;
2633
- a += d.durationMs, s.push({
2655
+ ), d = c.value;
2656
+ a += c.durationMs, s.push({
2634
2657
  expression: u.text,
2635
- durationMs: d.durationMs
2636
- }), o = o || h.unresolvedReference, n.push(h.value);
2658
+ durationMs: c.durationMs
2659
+ }), o = o || d.unresolvedReference, n.push(d.value);
2637
2660
  } else
2638
2661
  n.push(u.text);
2639
- } catch (d) {
2662
+ } catch (c) {
2640
2663
  m.error(
2641
2664
  "[Haori]",
2642
2665
  `Error evaluating ${i} expression: ${u.text}`,
2643
- d
2666
+ c
2644
2667
  ), s.push({
2645
2668
  expression: u.text,
2646
2669
  durationMs: 0
@@ -2749,7 +2772,7 @@ class Z {
2749
2772
  * @return すべてのレンダリングが完了したら解決される Promise
2750
2773
  */
2751
2774
  static waitForRenders() {
2752
- return P.waitForIdle();
2775
+ return k.waitForIdle();
2753
2776
  }
2754
2777
  /**
2755
2778
  * 通知ダイアログを表示します。
@@ -2758,7 +2781,7 @@ class Z {
2758
2781
  * @returns 通知が閉じられると解決されるPromise
2759
2782
  */
2760
2783
  static dialog(t) {
2761
- return P.enqueue(() => {
2784
+ return k.enqueue(() => {
2762
2785
  window.alert(t);
2763
2786
  }, !0);
2764
2787
  }
@@ -2786,7 +2809,7 @@ class Z {
2786
2809
  * @returns ユーザーがOKをクリックした場合はtrue、キャンセルした場合はfalseが解決されるPromise
2787
2810
  */
2788
2811
  static confirm(t) {
2789
- return P.enqueue(() => window.confirm(t), !0);
2812
+ return k.enqueue(() => window.confirm(t), !0);
2790
2813
  }
2791
2814
  /**
2792
2815
  * ダイアログを開きます。
@@ -2794,7 +2817,7 @@ class Z {
2794
2817
  * @param element 開くダイアログのHTML要素
2795
2818
  */
2796
2819
  static openDialog(t) {
2797
- return P.enqueue(() => {
2820
+ return k.enqueue(() => {
2798
2821
  t instanceof HTMLDialogElement ? t.showModal() : m.error("[Haori]", "Element is not a dialog: ", t);
2799
2822
  }, !0);
2800
2823
  }
@@ -2804,7 +2827,7 @@ class Z {
2804
2827
  * @param element 閉じるダイアログのHTML要素
2805
2828
  */
2806
2829
  static closeDialog(t) {
2807
- return P.enqueue(() => {
2830
+ return k.enqueue(() => {
2808
2831
  t instanceof HTMLDialogElement ? t.close() : m.error("[Haori]", "Element is not a dialog: ", t);
2809
2832
  }, !0);
2810
2833
  }
@@ -2825,7 +2848,7 @@ class Z {
2825
2848
  * @param level メッセージのレベル(省略可能)
2826
2849
  */
2827
2850
  static addMessage(t, e, r) {
2828
- return P.enqueue(() => {
2851
+ return k.enqueue(() => {
2829
2852
  const i = t instanceof HTMLFormElement ? t : t.parentElement ?? t;
2830
2853
  i.setAttribute("data-message", e), r !== void 0 ? i.setAttribute("data-message-level", r) : i.removeAttribute("data-message-level");
2831
2854
  }, !0);
@@ -2836,7 +2859,7 @@ class Z {
2836
2859
  * @param parent メッセージをクリアする親要素
2837
2860
  */
2838
2861
  static clearMessages(t) {
2839
- return P.enqueue(() => {
2862
+ return k.enqueue(() => {
2840
2863
  t.removeAttribute("data-message"), t.removeAttribute("data-message-level"), t.querySelectorAll("[data-message]").forEach((e) => {
2841
2864
  e.removeAttribute("data-message"), e.removeAttribute("data-message-level");
2842
2865
  });
@@ -2957,13 +2980,13 @@ class Z {
2957
2980
  }
2958
2981
  }
2959
2982
  const Ot = ["addErrorMessage", "clearMessages"];
2960
- function Et() {
2983
+ function yt() {
2961
2984
  const t = globalThis.window?.Haori;
2962
2985
  return Ot.every(
2963
2986
  (r) => typeof t?.[r] == "function"
2964
2987
  ) ? t : Z;
2965
2988
  }
2966
- class y {
2989
+ class E {
2967
2990
  /**
2968
2991
  * フォーム内にある入力エレメントの値をオブジェクトとして取得します。
2969
2992
  * data-form-object属性があると、そのエレメント内の値はオブジェクトとして処理されます。
@@ -2974,7 +2997,7 @@ class y {
2974
2997
  */
2975
2998
  static getValues(t) {
2976
2999
  const e = {};
2977
- return y.getPartValues(t, e);
3000
+ return E.getPartValues(t, e);
2978
3001
  }
2979
3002
  /**
2980
3003
  * フォーム内の各入力エレメントから値を取得し、オブジェクトとして返します。
@@ -2989,7 +3012,7 @@ class y {
2989
3012
  if (r) {
2990
3013
  if (n)
2991
3014
  Array.isArray(e[String(r)]) ? e[String(r)].push(t.getValue()) : e[String(r)] = [t.getValue()];
2992
- else if (y.isGroupedCheckable(t)) {
3015
+ else if (E.isGroupedCheckable(t)) {
2993
3016
  const s = t.getValue(), a = String(r);
2994
3017
  s === null ? a in e || (e[a] = null) : e[a] === null || e[a] === void 0 ? e[a] = s : Array.isArray(e[a]) ? e[a].push(s) : e[a] = [e[a], s];
2995
3018
  } else
@@ -2999,11 +3022,11 @@ class y {
2999
3022
  `Element cannot have both ${l.prefix}form-object and name attributes.`
3000
3023
  );
3001
3024
  for (const s of t.getChildElementFragments())
3002
- y.getPartValues(s, e);
3025
+ E.getPartValues(s, e);
3003
3026
  } else if (i) {
3004
3027
  const s = {};
3005
3028
  for (const a of t.getChildElementFragments())
3006
- y.getPartValues(a, s);
3029
+ E.getPartValues(a, s);
3007
3030
  Object.keys(s).length > 0 && (e[String(i)] = s), n && m.warn(
3008
3031
  "Haori",
3009
3032
  `Element cannot have both ${l.prefix}form-list and ${l.prefix}form-object attributes.`
@@ -3012,12 +3035,12 @@ class y {
3012
3035
  const s = [];
3013
3036
  for (const a of t.getChildElementFragments()) {
3014
3037
  const o = {};
3015
- y.getPartValues(a, o), Object.keys(o).length > 0 && s.push(o);
3038
+ E.getPartValues(a, o), Object.keys(o).length > 0 && s.push(o);
3016
3039
  }
3017
3040
  s.length > 0 && (e[String(n)] = s);
3018
3041
  } else
3019
3042
  for (const s of t.getChildElementFragments())
3020
- y.getPartValues(s, e);
3043
+ E.getPartValues(s, e);
3021
3044
  return e;
3022
3045
  }
3023
3046
  /**
@@ -3030,7 +3053,7 @@ class y {
3030
3053
  * @returns Promise(DOMの更新が完了したら解決される)
3031
3054
  */
3032
3055
  static setValues(t, e, r = !1) {
3033
- return y.setPartValues(t, e, null, r, !0);
3056
+ return E.setPartValues(t, e, null, r, !0);
3034
3057
  }
3035
3058
  /**
3036
3059
  * フォーム内にある入力エレメントに値をイベントなしで設定します。
@@ -3042,7 +3065,7 @@ class y {
3042
3065
  * @returns Promise(DOMの更新が完了したら解決される)
3043
3066
  */
3044
3067
  static syncValues(t, e, r = !1) {
3045
- return y.setPartValues(t, e, null, r, !1);
3068
+ return E.setPartValues(t, e, null, r, !1);
3046
3069
  }
3047
3070
  /**
3048
3071
  * 値による上書きをグループ単位で扱うべき入力要素(boolean 型でない
@@ -3076,56 +3099,56 @@ class y {
3076
3099
  * @returns Promise(DOMの更新が完了したら解決される)
3077
3100
  */
3078
3101
  static setPartValues(t, e, r = null, i = !1, n = !0) {
3079
- const s = [], a = t.getAttribute("name"), o = t.getAttribute(`${l.prefix}form-object`), u = t.getAttribute(`${l.prefix}form-list`), d = t.getAttribute(`${l.prefix}form-detach`);
3102
+ const s = [], a = t.getAttribute("name"), o = t.getAttribute(`${l.prefix}form-object`), u = t.getAttribute(`${l.prefix}form-list`), c = t.getAttribute(`${l.prefix}form-detach`);
3080
3103
  if (a) {
3081
- if (!d || i) {
3082
- const h = e[String(a)];
3083
- u && Array.isArray(h) && r !== null ? s.push(
3084
- y.applyFragmentValue(t, h[r] ?? null, n)
3085
- ) : typeof h > "u" || (Array.isArray(h) && y.isGroupedCheckable(t) || typeof h == "string" || typeof h == "number" || typeof h == "boolean" || h === null ? s.push(
3086
- y.applyFragmentValue(
3104
+ if (!c || i) {
3105
+ const d = e[String(a)];
3106
+ u && Array.isArray(d) && r !== null ? s.push(
3107
+ E.applyFragmentValue(t, d[r] ?? null, n)
3108
+ ) : typeof d > "u" || (Array.isArray(d) && E.isGroupedCheckable(t) || typeof d == "string" || typeof d == "number" || typeof d == "boolean" || d === null ? s.push(
3109
+ E.applyFragmentValue(
3087
3110
  t,
3088
- h,
3111
+ d,
3089
3112
  n
3090
3113
  )
3091
3114
  ) : s.push(
3092
- y.applyFragmentValue(t, String(h), n)
3115
+ E.applyFragmentValue(t, String(d), n)
3093
3116
  ));
3094
3117
  }
3095
3118
  } else if (o) {
3096
- const h = e[String(o)];
3097
- if (h && typeof h == "object")
3119
+ const d = e[String(o)];
3120
+ if (d && typeof d == "object")
3098
3121
  for (const g of t.getChildElementFragments())
3099
3122
  s.push(
3100
- y.setPartValues(
3123
+ E.setPartValues(
3101
3124
  g,
3102
- h,
3125
+ d,
3103
3126
  null,
3104
3127
  i,
3105
3128
  n
3106
3129
  )
3107
3130
  );
3108
3131
  } else if (u) {
3109
- const h = e[String(u)];
3110
- if (Array.isArray(h)) {
3132
+ const d = e[String(u)];
3133
+ if (Array.isArray(d)) {
3111
3134
  const g = t.getChildElementFragments();
3112
- for (let E = 0; E < g.length; E++) {
3113
- const w = g[E];
3114
- h.length > E ? s.push(
3115
- y.setPartValues(
3116
- w,
3117
- h[E],
3118
- E,
3135
+ for (let y = 0; y < g.length; y++) {
3136
+ const T = g[y];
3137
+ d.length > y ? s.push(
3138
+ E.setPartValues(
3139
+ T,
3140
+ d[y],
3141
+ y,
3119
3142
  i,
3120
3143
  n
3121
3144
  )
3122
- ) : s.push(y.setPartValues(w, {}, E, i, n));
3145
+ ) : s.push(E.setPartValues(T, {}, y, i, n));
3123
3146
  }
3124
3147
  }
3125
3148
  } else
3126
- for (const h of t.getChildElementFragments())
3149
+ for (const d of t.getChildElementFragments())
3127
3150
  s.push(
3128
- y.setPartValues(h, e, null, i, n)
3151
+ E.setPartValues(d, e, null, i, n)
3129
3152
  );
3130
3153
  return Promise.all(s).then(() => {
3131
3154
  });
@@ -3138,10 +3161,10 @@ class y {
3138
3161
  * @returns すべての初期化処理が完了するPromise
3139
3162
  */
3140
3163
  static async reset(t) {
3141
- y.clearValues(t), await Promise.all([
3142
- y.clearMessages(t),
3143
- y.clearEachClones(t)
3144
- ]), await P.enqueue(() => {
3164
+ E.clearValues(t), await Promise.all([
3165
+ E.clearMessages(t),
3166
+ E.clearEachClones(t)
3167
+ ]), await k.enqueue(() => {
3145
3168
  const r = t.getTarget();
3146
3169
  if (r instanceof HTMLFormElement)
3147
3170
  r.reset();
@@ -3154,17 +3177,17 @@ class y {
3154
3177
  }
3155
3178
  }
3156
3179
  });
3157
- const e = y.collectBindingTargetForms(t);
3180
+ const e = E.collectBindingTargetForms(t);
3158
3181
  for (const r of e) {
3159
- const i = y.getInitialBindingData(r);
3182
+ const i = E.getInitialBindingData(r);
3160
3183
  i && await x.setBindingData(r.getTarget(), i);
3161
3184
  }
3162
- y.syncValuesFromDom(t);
3185
+ E.syncValuesFromDom(t);
3163
3186
  for (const r of e) {
3164
- const i = y.getInitialBindingData(r);
3187
+ const i = E.getInitialBindingData(r);
3165
3188
  if (r.getRawBindingData() === null && i === null)
3166
3189
  continue;
3167
- const n = y.getValues(r), s = r.getAttribute(`${l.prefix}form-arg`), a = { ...i || {} };
3190
+ const n = E.getValues(r), s = r.getAttribute(`${l.prefix}form-arg`), a = { ...i || {} };
3168
3191
  s ? a[String(s)] = n : Object.assign(a, n), await x.setBindingData(r.getTarget(), a);
3169
3192
  }
3170
3193
  await x.evaluateAll(t);
@@ -3188,7 +3211,7 @@ class y {
3188
3211
  const e = t.getTarget();
3189
3212
  (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) && t.syncValue();
3190
3213
  for (const r of t.getChildElementFragments())
3191
- y.syncValuesFromDom(r);
3214
+ E.syncValuesFromDom(r);
3192
3215
  }
3193
3216
  /**
3194
3217
  * リセット後にバインドデータを更新すべきフォームフラグメントを収集します。
@@ -3204,7 +3227,7 @@ class y {
3204
3227
  e instanceof HTMLFormElement ? r.push(e) : r.push(...Array.from(e.querySelectorAll("form")));
3205
3228
  const i = [];
3206
3229
  for (const n of r) {
3207
- const s = T.get(n);
3230
+ const s = w.get(n);
3208
3231
  s instanceof M && i.push(s);
3209
3232
  }
3210
3233
  return i;
@@ -3241,7 +3264,7 @@ class y {
3241
3264
  static clearValues(t) {
3242
3265
  t.clearValue();
3243
3266
  for (const e of t.getChildElementFragments())
3244
- y.clearValues(e);
3267
+ E.clearValues(e);
3245
3268
  }
3246
3269
  /**
3247
3270
  * フラグメントとその子要素のメッセージをクリアします。
@@ -3250,7 +3273,7 @@ class y {
3250
3273
  * @returns Promise(メッセージのクリアが完了したら解決される)
3251
3274
  */
3252
3275
  static clearMessages(t) {
3253
- return Et().clearMessages(
3276
+ return yt().clearMessages(
3254
3277
  t.getTarget()
3255
3278
  );
3256
3279
  }
@@ -3264,7 +3287,7 @@ class y {
3264
3287
  * @return Promise(メッセージの追加が完了したら解決される)
3265
3288
  */
3266
3289
  static addErrorMessage(t, e, r) {
3267
- return y.addMessage(t, e, r, "error");
3290
+ return E.addMessage(t, e, r, "error");
3268
3291
  }
3269
3292
  /**
3270
3293
  * キーに一致するフラグメントにレベル付きメッセージを追加します。
@@ -3277,9 +3300,9 @@ class y {
3277
3300
  * @return Promise(メッセージの追加が完了したら解決される)
3278
3301
  */
3279
3302
  static addMessage(t, e, r, i) {
3280
- const n = [], s = Et(), a = s.addMessage, o = (d) => typeof a == "function" ? a.call(s, d, r, i) : s.addErrorMessage(d, r), u = y.findFragmentsByKey(t, e);
3281
- return u.forEach((d) => {
3282
- n.push(o(d.getTarget()));
3303
+ const n = [], s = yt(), a = s.addMessage, o = (c) => typeof a == "function" ? a.call(s, c, r, i) : s.addErrorMessage(c, r), u = E.findFragmentsByKey(t, e);
3304
+ return u.forEach((c) => {
3305
+ n.push(o(c.getTarget()));
3283
3306
  }), u.length === 0 && n.push(o(t.getTarget())), Promise.all(n).then(() => {
3284
3307
  });
3285
3308
  }
@@ -3291,7 +3314,7 @@ class y {
3291
3314
  * @returns 一致するフラグメントの配列
3292
3315
  */
3293
3316
  static findFragmentsByKey(t, e) {
3294
- return y.findFragmentByKeyParts(t, e.split("."));
3317
+ return E.findFragmentByKeyParts(t, e.split("."));
3295
3318
  }
3296
3319
  /**
3297
3320
  * 指定されたキーに一致するフラグメントを検索します。
@@ -3305,7 +3328,7 @@ class y {
3305
3328
  const r = [], i = e[0];
3306
3329
  if (e.length == 1 && t.getAttribute("name") === i && r.push(t), t.hasAttribute(`${l.prefix}form-object`))
3307
3330
  e.length > 1 && t.getAttribute(`${l.prefix}form-object`) === i && t.getChildElementFragments().forEach((s) => {
3308
- r.push(...y.findFragmentByKeyParts(s, e.slice(1)));
3331
+ r.push(...E.findFragmentByKeyParts(s, e.slice(1)));
3309
3332
  });
3310
3333
  else if (t.hasAttribute(`${l.prefix}form-list`)) {
3311
3334
  if (e.length > 1) {
@@ -3313,13 +3336,13 @@ class y {
3313
3336
  if (s !== -1 && a !== -1 && s < a) {
3314
3337
  const o = i.substring(0, s);
3315
3338
  if (n === o) {
3316
- const u = i.substring(s + 1, a), d = Number(u);
3317
- if (isNaN(d))
3339
+ const u = i.substring(s + 1, a), c = Number(u);
3340
+ if (isNaN(c))
3318
3341
  m.error("Haori", `Invalid index: ${i}`);
3319
3342
  else {
3320
- const h = t.getChildElementFragments().filter((g) => g.hasAttribute(`${l.prefix}row`));
3321
- d < h.length && r.push(
3322
- ...y.findFragmentByKeyParts(h[d], e.slice(1))
3343
+ const d = t.getChildElementFragments().filter((g) => g.hasAttribute(`${l.prefix}row`));
3344
+ c < d.length && r.push(
3345
+ ...E.findFragmentByKeyParts(d[c], e.slice(1))
3323
3346
  );
3324
3347
  }
3325
3348
  }
@@ -3327,7 +3350,7 @@ class y {
3327
3350
  }
3328
3351
  } else
3329
3352
  t.getChildElementFragments().forEach((n) => {
3330
- r.push(...y.findFragmentByKeyParts(n, e));
3353
+ r.push(...E.findFragmentByKeyParts(n, e));
3331
3354
  });
3332
3355
  return r;
3333
3356
  }
@@ -3432,8 +3455,8 @@ class R {
3432
3455
  static bindChange(t, e, r, i = "other") {
3433
3456
  const n = [], s = new Set(Object.keys(e || {})), a = new Set(Object.keys(r)), o = /* @__PURE__ */ new Set([...s, ...a]);
3434
3457
  for (const u of o) {
3435
- const d = e?.[u], h = r[u];
3436
- d !== h && n.push(u);
3458
+ const c = e?.[u], d = r[u];
3459
+ c !== d && n.push(u);
3437
3460
  }
3438
3461
  R.dispatch(t, "bindchange", {
3439
3462
  previous: e || {},
@@ -3592,7 +3615,7 @@ function Ut(p, t) {
3592
3615
  return null;
3593
3616
  if (!e.includes("{{"))
3594
3617
  return e;
3595
- const r = T.get(p), i = r instanceof M ? r.getBindingData() : {}, n = Lt(e, i);
3618
+ const r = w.get(p), i = r instanceof M ? r.getBindingData() : {}, n = Lt(e, i);
3596
3619
  return n === "" ? null : n;
3597
3620
  }
3598
3621
  function Mt(p) {
@@ -3667,6 +3690,16 @@ function Yt(p, t) {
3667
3690
  });
3668
3691
  }
3669
3692
  const f = class f {
3693
+ /**
3694
+ * コンストラクタ。
3695
+ *
3696
+ * @param arg1 オプションもしくはフラグメント
3697
+ * @param arg2 イベント名
3698
+ * @param domEvent 起点となった DOM イベント
3699
+ */
3700
+ constructor(t, e = null, r = null) {
3701
+ this.reentrantBind = !1, f.isElementFragment(t) ? (this.options = f.buildOptions(t, e), this.eventType = e) : (this.options = t, this.eventType = null), this.domEvent = r;
3702
+ }
3670
3703
  /**
3671
3704
  * イベント属性名を正しく生成します。
3672
3705
  * 例: ("click", "fetch") => "data-click-fetch"
@@ -3857,15 +3890,15 @@ const f = class f {
3857
3890
  );
3858
3891
  if (v) {
3859
3892
  const b = document.body.querySelector(v);
3860
- b !== null ? r.formFragment = y.getFormFragment(
3861
- T.get(b)
3893
+ b !== null ? r.formFragment = E.getFormFragment(
3894
+ w.get(b)
3862
3895
  ) : m.error(
3863
3896
  "Haori",
3864
3897
  `Form element not found: ${v} (${f.attrName(e, "form")})`
3865
3898
  );
3866
3899
  } else
3867
- r.formFragment = y.getFormFragment(t);
3868
- } else (e === "change" || e === "input") && (r.formFragment = y.getFormFragment(t));
3900
+ r.formFragment = E.getFormFragment(t);
3901
+ } else (e === "change" || e === "input") && (r.formFragment = E.getFormFragment(t));
3869
3902
  if (t.hasAttribute(`${l.prefix}${e}-before-run`)) {
3870
3903
  const v = t.getRawAttribute(
3871
3904
  `${l.prefix}${e}-before-run`
@@ -3997,7 +4030,7 @@ ${v}
3997
4030
  if (A) {
3998
4031
  const v = document.body.querySelectorAll(A);
3999
4032
  v.length > 0 ? (r.bindFragments = [], v.forEach((b) => {
4000
- const S = T.get(b);
4033
+ const S = w.get(b);
4001
4034
  S && r.bindFragments.push(S);
4002
4035
  })) : m.error(
4003
4036
  "Haori",
@@ -4009,17 +4042,17 @@ ${v}
4009
4042
  null,
4010
4043
  "arg",
4011
4044
  !0
4012
- ), d = f.attrName(
4045
+ ), c = f.attrName(
4013
4046
  null,
4014
4047
  "bind-arg",
4015
4048
  !0
4016
4049
  );
4017
4050
  e ? t.hasAttribute(o) && (r.bindArg = t.getRawAttribute(o)) : t.hasAttribute(u) ? r.bindArg = t.getRawAttribute(
4018
4051
  u
4019
- ) : t.hasAttribute(d) && (r.bindArg = t.getRawAttribute(d));
4020
- const h = e ? f.attrName(e, "bind-params") : f.attrName(null, "bind-params", !0);
4021
- if (t.hasAttribute(h)) {
4022
- const A = t.getRawAttribute(h);
4052
+ ) : t.hasAttribute(c) && (r.bindArg = t.getRawAttribute(c));
4053
+ const d = e ? f.attrName(e, "bind-params") : f.attrName(null, "bind-params", !0);
4054
+ if (t.hasAttribute(d)) {
4055
+ const A = t.getRawAttribute(d);
4023
4056
  r.bindParams = A.split("&").map((v) => v.trim());
4024
4057
  }
4025
4058
  const g = e ? f.attrName(e, "bind-append") : f.attrName(null, "bind-append", !0);
@@ -4027,13 +4060,13 @@ ${v}
4027
4060
  const A = t.getRawAttribute(g);
4028
4061
  r.bindAppendParams = A.split("&").map((v) => v.trim()).filter(Boolean);
4029
4062
  }
4030
- const E = e ? f.attrName(e, "bind-merge") : f.attrName(null, "bind-merge", !0);
4031
- t.hasAttribute(E) && (r.bindMerge = !0);
4032
- const w = e ? f.attrName(e, "bind-transform") : f.attrName(null, "bind-transform", !0);
4033
- t.hasAttribute(w) && (r.bindTransform = t.getRawAttribute(w));
4034
- const k = e ? f.attrName(e, "copy-params") : null;
4035
- if (k && t.hasAttribute(k)) {
4036
- const A = t.getRawAttribute(k);
4063
+ const y = e ? f.attrName(e, "bind-merge") : f.attrName(null, "bind-merge", !0);
4064
+ t.hasAttribute(y) && (r.bindMerge = !0);
4065
+ const T = e ? f.attrName(e, "bind-transform") : f.attrName(null, "bind-transform", !0);
4066
+ t.hasAttribute(T) && (r.bindTransform = t.getRawAttribute(T));
4067
+ const P = e ? f.attrName(e, "copy-params") : null;
4068
+ if (P && t.hasAttribute(P)) {
4069
+ const A = t.getRawAttribute(P);
4037
4070
  r.copyParams = A.split("&").map((v) => v.trim()).filter(Boolean);
4038
4071
  }
4039
4072
  if (e) {
@@ -4044,7 +4077,7 @@ ${v}
4044
4077
  if (b) {
4045
4078
  const S = document.body.querySelectorAll(b);
4046
4079
  S.length > 0 ? (r.adjustFragments = [], S.forEach((F) => {
4047
- const I = T.get(F);
4080
+ const I = w.get(F);
4048
4081
  I && r.adjustFragments.push(I);
4049
4082
  })) : m.error(
4050
4083
  "Haori",
@@ -4096,14 +4129,14 @@ ${b}
4096
4129
  );
4097
4130
  if (b) {
4098
4131
  const S = document.body.querySelector(b);
4099
- S !== null ? r.historyFormFragment = y.getFormFragment(
4100
- T.get(S)
4132
+ S !== null ? r.historyFormFragment = E.getFormFragment(
4133
+ w.get(S)
4101
4134
  ) : m.error(
4102
4135
  "Haori",
4103
4136
  `Form element not found: ${b} (${f.attrName(e, "history-form")})`
4104
4137
  );
4105
4138
  } else
4106
- r.historyFormFragment = y.getFormFragment(t);
4139
+ r.historyFormFragment = E.getFormFragment(t);
4107
4140
  }
4108
4141
  [
4109
4142
  "reset-before",
@@ -4119,7 +4152,7 @@ ${b}
4119
4152
  return;
4120
4153
  const F = t.getRawAttribute(S), I = [];
4121
4154
  if (F ? (document.body.querySelectorAll(F).forEach((V) => {
4122
- const C = T.get(V);
4155
+ const C = w.get(V);
4123
4156
  C && I.push(C);
4124
4157
  }), I.length === 0 && m.error("Haori", `Element not found: ${F} (${S})`)) : I.push(t), I.length > 0)
4125
4158
  switch (b) {
@@ -4154,7 +4187,7 @@ ${b}
4154
4187
  if (b) {
4155
4188
  const S = document.body.querySelector(b);
4156
4189
  if (S !== null) {
4157
- const F = T.get(S);
4190
+ const F = w.get(S);
4158
4191
  F ? r.copySourceFragment = F : m.error(
4159
4192
  "Haori",
4160
4193
  `Element is not managed by Haori: ${b} (${v})`
@@ -4174,16 +4207,16 @@ ${b}
4174
4207
  );
4175
4208
  if (A) {
4176
4209
  const v = document.body.querySelector(A);
4177
- v !== null ? r.formFragment = y.getFormFragment(
4178
- T.get(v)
4210
+ v !== null ? r.formFragment = E.getFormFragment(
4211
+ w.get(v)
4179
4212
  ) : m.error(
4180
4213
  "Haori",
4181
4214
  `Form element not found: ${A} (${f.attrName(null, "fetch-form", !0)})`
4182
4215
  );
4183
4216
  } else
4184
- r.formFragment = y.getFormFragment(t);
4217
+ r.formFragment = E.getFormFragment(t);
4185
4218
  }
4186
- return n && (!r.bindFragments || r.bindFragments.length === 0) && (r.bindFragments = [t]), r;
4219
+ return n && (!r.bindFragments || r.bindFragments.length === 0) && (r.bindFragments = [t], r.defaultSelfBind = !0), r;
4187
4220
  }
4188
4221
  /**
4189
4222
  * ElementFragment の構造的タイプガード。
@@ -4197,16 +4230,6 @@ ${b}
4197
4230
  const e = t;
4198
4231
  return typeof e.getTarget == "function" && typeof e.getChildElementFragments == "function";
4199
4232
  }
4200
- /**
4201
- * コンストラクタ。
4202
- *
4203
- * @param arg1 オプションもしくはフラグメント
4204
- * @param arg2 イベント名
4205
- * @param domEvent 起点となった DOM イベント
4206
- */
4207
- constructor(t, e = null, r = null) {
4208
- f.isElementFragment(t) ? (this.options = f.buildOptions(t, e), this.eventType = e) : (this.options = t, this.eventType = null), this.domEvent = r;
4209
- }
4210
4233
  /**
4211
4234
  * 非イベント data-fetch の自動再評価用シグネチャを解決します。
4212
4235
  *
@@ -4225,6 +4248,13 @@ ${b}
4225
4248
  return this.runWithResult().then(() => {
4226
4249
  });
4227
4250
  }
4251
+ /**
4252
+ * bind 結果の反映を reentrant(即時実行)で行うよう指定します。マネージド
4253
+ * `data-fetch` の自動再評価から生成した Procedure に対して使います。
4254
+ */
4255
+ markReentrantBind() {
4256
+ this.reentrantBind = !0;
4257
+ }
4228
4258
  /**
4229
4259
  * 一連の処理を実行し、成功したかどうかを返します。
4230
4260
  *
@@ -4246,65 +4276,65 @@ ${b}
4246
4276
  if (Object.keys(this.options).length === 0 || this.options.formFragment && this.validate(this.options.formFragment) === !1)
4247
4277
  return !1;
4248
4278
  if (this.options.runScript) {
4249
- const d = this.options.targetFragment?.getTarget() ?? null;
4279
+ const c = this.options.targetFragment?.getTarget() ?? null;
4250
4280
  try {
4251
4281
  this.options.runScript.call(
4252
- d,
4282
+ c,
4253
4283
  this.domEvent
4254
4284
  ) === !1 && this.domEvent && this.domEvent.preventDefault();
4255
- } catch (h) {
4256
- m.error("Haori", `Run script execution error: ${h}`);
4285
+ } catch (d) {
4286
+ m.error("Haori", `Run script execution error: ${d}`);
4257
4287
  }
4258
4288
  }
4259
4289
  if (!await this.confirm())
4260
4290
  return !1;
4261
4291
  this.options.resetBeforeFragments && this.options.resetBeforeFragments.length > 0 && (await Promise.all(
4262
4292
  this.options.resetBeforeFragments.map(
4263
- (d) => y.reset(d)
4293
+ (c) => E.reset(c)
4264
4294
  )
4265
4295
  ), this.captureHistorySnapshots());
4266
4296
  const r = this.prepareFetchRequest(), i = r.payload;
4267
4297
  let n = r.url, s = r.options;
4268
4298
  if (this.options.beforeCallback) {
4269
- const d = this.options.beforeCallback(
4299
+ const c = this.options.beforeCallback(
4270
4300
  n || null,
4271
4301
  s || null
4272
4302
  );
4273
- if (d != null) {
4274
- if (d === !1 || typeof d == "object" && d.stop)
4303
+ if (c != null) {
4304
+ if (c === !1 || typeof c == "object" && c.stop)
4275
4305
  return !1;
4276
- typeof d == "object" && (n = "fetchUrl" in d ? d.fetchUrl : n, s = "fetchOptions" in d ? d.fetchOptions : s);
4306
+ typeof c == "object" && (n = "fetchUrl" in c ? c.fetchUrl : n, s = "fetchOptions" in c ? c.fetchOptions : s);
4277
4307
  }
4278
4308
  }
4279
4309
  const a = Object.keys(i).length > 0;
4280
4310
  if (n) {
4281
- const d = { ...s || {} }, h = r.requestedMethod, g = r.effectiveMethod, E = r.transportMode === "query-get", w = r.queryString;
4282
- if (E && m.info("Haori demo fetch normalization", {
4311
+ const c = { ...s || {} }, d = r.requestedMethod, g = r.effectiveMethod, y = r.transportMode === "query-get", T = r.queryString;
4312
+ if (y && m.info("Haori demo fetch normalization", {
4283
4313
  runtime: l.runtime,
4284
- requestedMethod: h,
4314
+ requestedMethod: d,
4285
4315
  effectiveMethod: g,
4286
4316
  transportMode: "query-get",
4287
4317
  url: n,
4288
4318
  payload: a ? i : void 0,
4289
- queryString: w
4319
+ queryString: T
4290
4320
  }), this.options.targetFragment && n) {
4291
- const k = performance.now(), A = {
4321
+ const P = performance.now(), A = {
4292
4322
  runtime: l.runtime,
4293
- requestedMethod: h,
4323
+ requestedMethod: d,
4294
4324
  effectiveMethod: g,
4295
- transportMode: E ? "query-get" : "http",
4296
- ...E ? { queryString: w } : {}
4325
+ transportMode: y ? "query-get" : "http",
4326
+ ...y ? { queryString: T } : {}
4297
4327
  };
4298
4328
  return R.fetchStart(
4299
4329
  this.options.targetFragment.getTarget(),
4300
4330
  n,
4301
- d,
4331
+ c,
4302
4332
  a ? i : void 0,
4303
4333
  A
4304
- ), fetch(n, d).then((v) => this.handleFetchResult(
4334
+ ), fetch(n, c).then((v) => this.handleFetchResult(
4305
4335
  v,
4306
4336
  n || void 0,
4307
- k
4337
+ P
4308
4338
  )).catch((v) => {
4309
4339
  throw n && R.fetchError(
4310
4340
  this.options.targetFragment.getTarget(),
@@ -4313,13 +4343,13 @@ ${b}
4313
4343
  ), v;
4314
4344
  });
4315
4345
  }
4316
- return fetch(n, d).then((k) => this.handleFetchResult(k, n || void 0));
4346
+ return fetch(n, c).then((P) => this.handleFetchResult(P, n || void 0));
4317
4347
  }
4318
4348
  if ((!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && a) {
4319
- const d = this.options.formFragment, h = d.getTarget(), g = /* @__PURE__ */ new Set();
4349
+ const c = this.options.formFragment, d = c.getTarget(), g = /* @__PURE__ */ new Set();
4320
4350
  t && t.appliedDisabledAttribute && this.options.targetFragment && g.add(this.options.targetFragment);
4321
- const E = d.getBindingData();
4322
- Object.assign(E, i), await x.setBindingData(h, E, g);
4351
+ const y = c.getBindingData();
4352
+ Object.assign(y, i), await x.setBindingData(d, y, g);
4323
4353
  }
4324
4354
  const o = a ? i : {}, u = new Response(JSON.stringify(o), {
4325
4355
  headers: { "Content-Type": "application/json" }
@@ -4385,7 +4415,7 @@ ${b}
4385
4415
  }
4386
4416
  const n = [];
4387
4417
  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(
4388
- this.options.resetFragments.map((a) => y.reset(a))
4418
+ this.options.resetFragments.map((a) => E.reset(a))
4389
4419
  ), await this.copy();
4390
4420
  const s = [];
4391
4421
  if (this.options.refetchFragments && this.options.refetchFragments.length > 0 && this.options.refetchFragments.forEach((a) => {
@@ -4427,8 +4457,8 @@ ${b}
4427
4457
  return;
4428
4458
  }
4429
4459
  const o = (u) => {
4430
- for (const [d, h] of Object.entries(u))
4431
- h != null && (Array.isArray(h) ? h.forEach((g) => a.searchParams.append(d, String(g))) : typeof h == "object" ? a.searchParams.set(d, JSON.stringify(h)) : a.searchParams.set(d, String(h)));
4460
+ for (const [c, d] of Object.entries(u))
4461
+ d != null && (Array.isArray(d) ? d.forEach((g) => a.searchParams.append(c, String(g))) : typeof d == "object" ? a.searchParams.set(c, JSON.stringify(d)) : a.searchParams.set(c, String(d)));
4432
4462
  };
4433
4463
  i && o(e), n && o(r), history.pushState(
4434
4464
  { [jt]: !0 },
@@ -4444,7 +4474,7 @@ ${b}
4444
4474
  */
4445
4475
  async handleFetchError(t) {
4446
4476
  let e = null;
4447
- this.options.formFragment ? e = this.options.formFragment : this.options.targetFragment && (e = y.getFormFragment(this.options.targetFragment) || this.options.targetFragment);
4477
+ this.options.formFragment ? e = this.options.formFragment : this.options.targetFragment && (e = E.getFormFragment(this.options.targetFragment) || this.options.targetFragment);
4448
4478
  const r = async (s) => {
4449
4479
  const a = e ? e.getTarget() : document.body;
4450
4480
  await ut().addErrorMessage(a, s);
@@ -4457,7 +4487,25 @@ ${b}
4457
4487
  if ((t.headers.get("Content-Type") || "").includes("application/json"))
4458
4488
  try {
4459
4489
  const s = await t.json(), a = [];
4460
- if (s && typeof s == "object") {
4490
+ if (Array.isArray(s)) {
4491
+ const o = /* @__PURE__ */ new Map(), u = [];
4492
+ for (const c of s)
4493
+ if (c && typeof c == "object" && !Array.isArray(c)) {
4494
+ const d = c.key, g = c.message, y = typeof d == "string" && d.length > 0 ? d : null, T = typeof g == "string" ? g : g != null ? String(g) : "";
4495
+ if (T.length === 0)
4496
+ continue;
4497
+ if (y !== null) {
4498
+ const P = o.get(y) ?? [];
4499
+ P.push(T), o.set(y, P);
4500
+ } else
4501
+ u.push(T);
4502
+ } else typeof c == "string" && c.length > 0 && u.push(c);
4503
+ for (const [c, d] of o)
4504
+ a.push({ key: c, message: d.join(`
4505
+ `) });
4506
+ for (const c of u)
4507
+ a.push({ message: c });
4508
+ } else if (s && typeof s == "object") {
4461
4509
  if (typeof s.message == "string" && a.push({ message: s.message }), Array.isArray(s.messages))
4462
4510
  for (const o of s.messages)
4463
4511
  typeof o == "string" && a.push({ message: o });
@@ -4473,7 +4521,7 @@ ${b}
4473
4521
  if (a.length === 0)
4474
4522
  return await r(`${t.status} ${t.statusText}`), i(), !1;
4475
4523
  for (const o of a)
4476
- o.key && e ? await y.addErrorMessage(e, o.key, o.message) : await r(o.message);
4524
+ o.key && e ? await E.addErrorMessage(e, o.key, o.message) : await r(o.message);
4477
4525
  return i(), !1;
4478
4526
  } catch {
4479
4527
  }
@@ -4540,53 +4588,84 @@ ${b}
4540
4588
  * @param response フェッチのレスポンスオブジェクト
4541
4589
  */
4542
4590
  bindResult(t) {
4543
- 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) => {
4591
+ if (!this.options.bindFragments || this.options.bindFragments.length === 0)
4592
+ return Promise.resolve();
4593
+ const e = t.headers.get("Content-Type")?.includes("application/json");
4594
+ return t.text().then((r) => {
4595
+ if (r === "")
4596
+ return;
4597
+ let i = e ? JSON.parse(r) : r;
4544
4598
  if (this.options.bindTransform)
4545
4599
  try {
4546
- r = z.evaluate(this.options.bindTransform, {
4547
- response: r
4600
+ i = z.evaluate(this.options.bindTransform, {
4601
+ response: i
4548
4602
  });
4549
- } catch (n) {
4550
- m.error("Haori", `Invalid bind-transform: ${n}`);
4603
+ } catch (s) {
4604
+ m.error("Haori", `Invalid bind-transform: ${s}`);
4551
4605
  }
4552
4606
  if (this.options.bindParams) {
4553
- const n = {};
4554
- this.options.bindParams.forEach((s) => {
4555
- r && typeof r == "object" && s in r && (n[s] = r[s]);
4556
- }), r = n;
4607
+ const s = {};
4608
+ this.options.bindParams.forEach((a) => {
4609
+ i && typeof i == "object" && a in i && (s[a] = i[a]);
4610
+ }), i = s;
4557
4611
  }
4558
- const i = [];
4612
+ const n = [];
4559
4613
  if (this.options.bindArg)
4560
- this.options.bindFragments.forEach((n) => {
4561
- const s = { ...n.getRawBindingData() ?? {} }, a = this.options.bindArg;
4562
- if (r && typeof r == "object" && !Array.isArray(r)) {
4563
- const o = s[a], u = o && typeof o == "object" && !Array.isArray(o) ? o : {};
4564
- s[a] = this.mergeAppendBindingData(
4565
- n,
4566
- r,
4567
- u
4614
+ this.options.bindFragments.forEach((s) => {
4615
+ const a = { ...s.getRawBindingData() ?? {} }, o = this.options.bindArg;
4616
+ if (i && typeof i == "object" && !Array.isArray(i)) {
4617
+ const u = a[o], c = u && typeof u == "object" && !Array.isArray(u) ? u : {};
4618
+ a[o] = this.mergeAppendBindingData(
4619
+ s,
4620
+ i,
4621
+ c
4568
4622
  );
4569
4623
  } else
4570
- s[a] = r;
4571
- i.push(x.setBindingData(n.getTarget(), s));
4572
- });
4573
- else {
4574
- if (typeof r == "string")
4575
- return m.error("Haori", "string data cannot be bound without a bindArg."), Promise.reject(
4576
- new Error("string data cannot be bound without a bindArg.")
4624
+ a[o] = i;
4625
+ n.push(
4626
+ x.setBindingData(
4627
+ s.getTarget(),
4628
+ a,
4629
+ /* @__PURE__ */ new Set(),
4630
+ // マネージド fetch bind かつ、bind 先が実行中のバインドワークを
4631
+ // 持つ(= 自分自身を await している)ときだけ reentrant(即時実行)に
4632
+ // する。これで自己デッドロックのみを解消し、idle なフラグメントへの
4633
+ // bind は従来どおり FIFO で適用順を保証する。
4634
+ this.reentrantBind && s.isExecutingBindingWork()
4635
+ )
4577
4636
  );
4578
- this.options.bindFragments.forEach((n) => {
4579
- const s = this.mergeAppendBindingData(
4580
- n,
4581
- r
4582
- ), a = this.options.bindMerge ? { ...n.getRawBindingData() ?? {}, ...s } : s;
4583
- i.push(x.setBindingData(n.getTarget(), a));
4584
4637
  });
4585
- }
4586
- return Promise.all(i).then(() => {
4587
- const n = this.options.bindArg ?? null;
4638
+ else if (typeof i == "string") {
4639
+ if (this.options.defaultSelfBind) {
4640
+ m.warn(
4641
+ "Haori",
4642
+ "string data is not bound because no bind target was specified."
4643
+ );
4644
+ return;
4645
+ }
4646
+ return m.error("Haori", "string data cannot be bound without a bindArg."), Promise.reject(
4647
+ new Error("string data cannot be bound without a bindArg.")
4648
+ );
4649
+ } else
4588
4650
  this.options.bindFragments.forEach((s) => {
4589
- R.bindComplete(s.getTarget(), n);
4651
+ const a = this.mergeAppendBindingData(
4652
+ s,
4653
+ i
4654
+ ), o = this.options.bindMerge ? { ...s.getRawBindingData() ?? {}, ...a } : a;
4655
+ n.push(
4656
+ x.setBindingData(
4657
+ s.getTarget(),
4658
+ o,
4659
+ /* @__PURE__ */ new Set(),
4660
+ // 自己デッドロックのみを解消する限定 reentrant(上の bindArg 分岐と同様)。
4661
+ this.reentrantBind && s.isExecutingBindingWork()
4662
+ )
4663
+ );
4664
+ });
4665
+ return Promise.all(n).then(() => {
4666
+ const s = this.options.bindArg ?? null;
4667
+ this.options.bindFragments.forEach((a) => {
4668
+ R.bindComplete(a.getTarget(), s);
4590
4669
  });
4591
4670
  });
4592
4671
  });
@@ -4624,7 +4703,7 @@ ${b}
4624
4703
  * copy のコピー元データを取得します。
4625
4704
  */
4626
4705
  resolveCopySourceData() {
4627
- return this.options.copySourceFragment ? this.options.copySourceFragment.getTarget().tagName === "FORM" ? y.getValues(this.options.copySourceFragment) : { ...this.options.copySourceFragment.getBindingData() } : this.options.formFragment ? y.getValues(this.options.formFragment) : this.options.targetFragment ? { ...this.options.targetFragment.getBindingData() } : {};
4706
+ return this.options.copySourceFragment ? this.options.copySourceFragment.getTarget().tagName === "FORM" ? E.getValues(this.options.copySourceFragment) : { ...this.options.copySourceFragment.getBindingData() } : this.options.formFragment ? E.getValues(this.options.formFragment) : this.options.targetFragment ? { ...this.options.targetFragment.getBindingData() } : {};
4628
4707
  }
4629
4708
  /**
4630
4709
  * data 属性とフォーム値を統合した送信データを作成します。
@@ -4642,7 +4721,7 @@ ${b}
4642
4721
  buildPayloadResolution() {
4643
4722
  const t = {};
4644
4723
  let e = !1;
4645
- if (this.options.formFragment && Object.assign(t, y.getValues(this.options.formFragment)), this.options.data && typeof this.options.data == "object" && Object.assign(t, this.options.data), this.options.targetFragment && this.options.dataAttrName) {
4724
+ if (this.options.formFragment && Object.assign(t, E.getValues(this.options.formFragment)), this.options.data && typeof this.options.data == "object" && Object.assign(t, this.options.data), this.options.targetFragment && this.options.dataAttrName) {
4646
4725
  const r = f.resolveDataAttributeDetailed(
4647
4726
  this.options.targetFragment,
4648
4727
  this.options.dataAttrName
@@ -4688,31 +4767,31 @@ ${b}
4688
4767
  if (n.method = u, u === "GET" || u === "HEAD" || u === "OPTIONS")
4689
4768
  Object.keys(e).length > 0 && (i = Kt(i, e));
4690
4769
  else if (Object.keys(e).length > 0) {
4691
- const h = s.get("Content-Type") || "";
4692
- if (/multipart\/form-data/i.test(h)) {
4770
+ const d = s.get("Content-Type") || "";
4771
+ if (/multipart\/form-data/i.test(d)) {
4693
4772
  s.delete("Content-Type");
4694
4773
  const g = new FormData();
4695
- for (const [E, w] of Object.entries(e))
4696
- w == null ? g.append(E, "") : w instanceof Blob ? g.append(E, w) : Array.isArray(w) ? w.forEach((k) => g.append(E, String(k))) : typeof w == "object" ? g.append(E, JSON.stringify(w)) : g.append(E, String(w));
4774
+ for (const [y, T] of Object.entries(e))
4775
+ T == null ? g.append(y, "") : T instanceof Blob ? g.append(y, T) : Array.isArray(T) ? T.forEach((P) => g.append(y, String(P))) : typeof T == "object" ? g.append(y, JSON.stringify(T)) : g.append(y, String(T));
4697
4776
  n.body = g;
4698
- } else if (/application\/x-www-form-urlencoded/i.test(h)) {
4777
+ } else if (/application\/x-www-form-urlencoded/i.test(d)) {
4699
4778
  const g = new URLSearchParams();
4700
- for (const [E, w] of Object.entries(e))
4701
- w !== void 0 && (w === null ? g.append(E, "") : Array.isArray(w) ? w.forEach((k) => g.append(E, String(k))) : typeof w == "object" ? g.append(E, JSON.stringify(w)) : g.append(E, String(w)));
4779
+ for (const [y, T] of Object.entries(e))
4780
+ T !== void 0 && (T === null ? g.append(y, "") : Array.isArray(T) ? T.forEach((P) => g.append(y, String(P))) : typeof T == "object" ? g.append(y, JSON.stringify(T)) : g.append(y, String(T)));
4702
4781
  n.body = g;
4703
4782
  } else
4704
4783
  s.set("Content-Type", "application/json"), n.body = JSON.stringify(e);
4705
4784
  }
4706
4785
  n.headers = s;
4707
- let d;
4708
- return o && (d = new URL(i, window.location.href).search || void 0, s.delete("Content-Type")), {
4786
+ let c;
4787
+ return o && (c = new URL(i, window.location.href).search || void 0, s.delete("Content-Type")), {
4709
4788
  url: i,
4710
4789
  options: n,
4711
4790
  payload: e,
4712
4791
  hasUnresolvedReference: !1,
4713
4792
  requestedMethod: a,
4714
4793
  effectiveMethod: u,
4715
- queryString: d,
4794
+ queryString: c,
4716
4795
  transportMode: o ? "query-get" : "http",
4717
4796
  signature: Yt(i, n)
4718
4797
  };
@@ -4724,7 +4803,7 @@ ${b}
4724
4803
  this.options.targetFragment && this.options.historyDataAttrName ? this.historyDataSnapshot = f.resolveDataAttribute(
4725
4804
  this.options.targetFragment,
4726
4805
  this.options.historyDataAttrName
4727
- ) : this.historyDataSnapshot = void 0, this.historyFormSnapshot = this.options.historyFormFragment ? y.getValues(this.options.historyFormFragment) : void 0;
4806
+ ) : this.historyDataSnapshot = void 0, this.historyFormSnapshot = this.options.historyFormFragment ? E.getValues(this.options.historyFormFragment) : void 0;
4728
4807
  }
4729
4808
  /**
4730
4809
  * history-data の評価値を取得します。
@@ -4746,7 +4825,7 @@ ${b}
4746
4825
  if (this.historyFormSnapshot !== void 0)
4747
4826
  return this.historyFormSnapshot;
4748
4827
  if (this.options.historyFormFragment)
4749
- return y.getValues(this.options.historyFormFragment);
4828
+ return E.getValues(this.options.historyFormFragment);
4750
4829
  }
4751
4830
  /**
4752
4831
  * copy-params が指定されている場合は include / exclude を考慮して抽出します。
@@ -4814,7 +4893,7 @@ ${b}
4814
4893
  const e = [], r = t.clone();
4815
4894
  return e.push(
4816
4895
  t.getParent().insertAfter(r, t)
4817
- ), e.push(x.evaluateAll(r)), e.push(y.reset(r)), Promise.all(e).then(() => {
4896
+ ), e.push(x.evaluateAll(r)), e.push(E.reset(r)), Promise.all(e).then(() => {
4818
4897
  });
4819
4898
  }
4820
4899
  /**
@@ -4868,7 +4947,7 @@ ${b}
4868
4947
  };
4869
4948
  f.DATA_PLACEHOLDER_REGEX = /\{\{\{([\s\S]+?)\}\}\}|\{\{([\s\S]+?)\}\}/g, f.SINGLE_PLACEHOLDER_REGEX = /^(\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\})$/, f.RUNNING_CLICK_TARGETS = /* @__PURE__ */ new WeakSet();
4870
4949
  let j = f;
4871
- class Xt {
4950
+ class Jt {
4872
4951
  /**
4873
4952
  * URLのクエリパラメータを取得します。
4874
4953
  *
@@ -4881,7 +4960,7 @@ class Xt {
4881
4960
  }), t;
4882
4961
  }
4883
4962
  }
4884
- class Jt {
4963
+ class Xt {
4885
4964
  /**
4886
4965
  * 指定URLから HTML を取得し、body 内の HTML 文字列を返します。
4887
4966
  *
@@ -4920,7 +4999,7 @@ class Jt {
4920
4999
  }
4921
5000
  }
4922
5001
  }
4923
- const c = class c {
5002
+ const h = class h {
4924
5003
  /**
4925
5004
  * 遅延属性かどうか(完全名で判定)を判定します。
4926
5005
  *
@@ -4928,7 +5007,7 @@ const c = class c {
4928
5007
  * @returns 遅延属性かどうか
4929
5008
  */
4930
5009
  static isDeferredAttributeName(t) {
4931
- return c.DEFERRED_ATTRIBUTE_SUFFIXES.some(
5010
+ return h.DEFERRED_ATTRIBUTE_SUFFIXES.some(
4932
5011
  (e) => t === `${l.prefix}${e}`
4933
5012
  );
4934
5013
  }
@@ -4939,7 +5018,7 @@ const c = class c {
4939
5018
  * @returns 除外対象かどうか
4940
5019
  */
4941
5020
  static isEvaluateAllExcludedAttributeName(t) {
4942
- return c.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES.some(
5021
+ return h.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES.some(
4943
5022
  (e) => t === `${l.prefix}${e}`
4944
5023
  );
4945
5024
  }
@@ -4951,7 +5030,7 @@ const c = class c {
4951
5030
  * @returns 再評価する場合は true
4952
5031
  */
4953
5032
  static shouldReevaluateAttribute(t, e) {
4954
- return e !== null && !c.isEvaluateAllExcludedAttributeName(t) && c.ATTRIBUTE_PLACEHOLDER_REGEX.test(e);
5033
+ return e !== null && !h.isEvaluateAllExcludedAttributeName(t) && h.ATTRIBUTE_PLACEHOLDER_REGEX.test(e);
4955
5034
  }
4956
5035
  /**
4957
5036
  * data-attr-* 形式の属性名から実際に更新する属性名を取得します。
@@ -4960,7 +5039,7 @@ const c = class c {
4960
5039
  * @returns 実際の属性名。data-attr-* でない場合は null
4961
5040
  */
4962
5041
  static getAliasedAttributeName(t) {
4963
- const e = `${l.prefix}${c.ATTRIBUTE_ALIAS_SUFFIX}`;
5042
+ const e = `${l.prefix}${h.ATTRIBUTE_ALIAS_SUFFIX}`;
4964
5043
  return !t.startsWith(e) || t.length <= e.length ? null : t.slice(e.length);
4965
5044
  }
4966
5045
  /**
@@ -4971,9 +5050,9 @@ const c = class c {
4971
5050
  * @returns data-attr-* の内部反映なら true
4972
5051
  */
4973
5052
  static isAliasedAttributeReflection(t, e) {
4974
- const r = T.get(t);
5053
+ const r = w.get(t);
4975
5054
  return r instanceof M ? r.hasAttribute(
4976
- `${l.prefix}${c.ATTRIBUTE_ALIAS_SUFFIX}${e}`
5055
+ `${l.prefix}${h.ATTRIBUTE_ALIAS_SUFFIX}${e}`
4977
5056
  ) : !1;
4978
5057
  }
4979
5058
  /**
@@ -4987,8 +5066,8 @@ const c = class c {
4987
5066
  let e = Promise.resolve();
4988
5067
  for (const r of t.getAttributeNames()) {
4989
5068
  const i = t.getRawAttribute(r);
4990
- c.shouldReevaluateAttribute(r, i) && (e = e.then(
4991
- () => c.setAttribute(t.getTarget(), r, i)
5069
+ h.shouldReevaluateAttribute(r, i) && (e = e.then(
5070
+ () => h.setAttribute(t.getTarget(), r, i)
4992
5071
  ));
4993
5072
  }
4994
5073
  return e.then(() => {
@@ -5003,7 +5082,7 @@ const c = class c {
5003
5082
  static reevaluateChildren(t) {
5004
5083
  const e = [];
5005
5084
  return t.getChildren().forEach((r) => {
5006
- r instanceof M ? e.push(c.evaluateAll(r)) : r instanceof U && e.push(c.evaluateText(r));
5085
+ r instanceof M ? e.push(h.evaluateAll(r)) : r instanceof U && e.push(h.evaluateText(r));
5007
5086
  }), Promise.all(e).then(() => {
5008
5087
  });
5009
5088
  }
@@ -5014,7 +5093,7 @@ const c = class c {
5014
5093
  * @returns 再評価状態
5015
5094
  */
5016
5095
  static getReactiveFetchState(t) {
5017
- const e = c.REACTIVE_FETCH_STATES.get(t);
5096
+ const e = h.REACTIVE_FETCH_STATES.get(t);
5018
5097
  if (e)
5019
5098
  return e;
5020
5099
  const r = {
@@ -5022,7 +5101,7 @@ const c = class c {
5022
5101
  running: !1,
5023
5102
  rerunRequested: !1
5024
5103
  };
5025
- return c.REACTIVE_FETCH_STATES.set(t, r), r;
5104
+ return h.REACTIVE_FETCH_STATES.set(t, r), r;
5026
5105
  }
5027
5106
  /**
5028
5107
  * data-import の再評価状態を取得します。
@@ -5031,7 +5110,7 @@ const c = class c {
5031
5110
  * @returns 再評価状態
5032
5111
  */
5033
5112
  static getReactiveImportState(t) {
5034
- const e = c.REACTIVE_IMPORT_STATES.get(t);
5113
+ const e = h.REACTIVE_IMPORT_STATES.get(t);
5035
5114
  if (e)
5036
5115
  return e;
5037
5116
  const r = {
@@ -5039,7 +5118,7 @@ const c = class c {
5039
5118
  running: !1,
5040
5119
  rerunRequested: !1
5041
5120
  };
5042
- return c.REACTIVE_IMPORT_STATES.set(t, r), r;
5121
+ return h.REACTIVE_IMPORT_STATES.set(t, r), r;
5043
5122
  }
5044
5123
  /**
5045
5124
  * bind 更新時に data-fetch / data-import を専用ルートで再評価します。
@@ -5052,9 +5131,9 @@ const c = class c {
5052
5131
  if (e.has(t))
5053
5132
  return Promise.resolve();
5054
5133
  const r = [];
5055
- return t.hasAttribute(`${l.prefix}fetch`) && r.push(c.executeManagedFetch(t)), t.hasAttribute(`${l.prefix}import`) && r.push(c.executeManagedImport(t)), t.getChildren().forEach((i) => {
5134
+ return t.hasAttribute(`${l.prefix}fetch`) && r.push(h.executeManagedFetch(t)), t.hasAttribute(`${l.prefix}import`) && r.push(h.executeManagedImport(t)), t.getChildren().forEach((i) => {
5056
5135
  i instanceof M && r.push(
5057
- c.reevaluateReactiveSpecialAttributes(i, e)
5136
+ h.reevaluateReactiveSpecialAttributes(i, e)
5058
5137
  );
5059
5138
  }), Promise.all(r).then(() => {
5060
5139
  });
@@ -5066,12 +5145,20 @@ const c = class c {
5066
5145
  * @returns 実行完了の Promise
5067
5146
  */
5068
5147
  static executeManagedFetch(t) {
5069
- const e = t.getTarget(), r = c.getReactiveFetchState(e), i = j.resolveAutoFetchSignature(t);
5070
- return r.running ? ((i.hasUnresolvedReference || i.signature !== r.lastSignature) && (r.rerunRequested = !0), Promise.resolve()) : i.hasUnresolvedReference || i.signature === null ? (r.lastSignature = null, Promise.resolve()) : r.lastSignature === i.signature ? Promise.resolve() : (r.lastSignature = i.signature, r.running = !0, new j(t, null).runWithResult().then(() => {
5148
+ const e = t.getTarget(), r = h.getReactiveFetchState(e), i = j.resolveAutoFetchSignature(t);
5149
+ if (r.running)
5150
+ return (i.hasUnresolvedReference || i.signature !== r.lastSignature) && (r.rerunRequested = !0), Promise.resolve();
5151
+ if (i.hasUnresolvedReference || i.signature === null)
5152
+ return r.lastSignature = null, Promise.resolve();
5153
+ if (r.lastSignature === i.signature)
5154
+ return Promise.resolve();
5155
+ r.lastSignature = i.signature, r.running = !0;
5156
+ const n = new j(t, null);
5157
+ return n.markReentrantBind(), n.runWithResult().then(() => {
5071
5158
  }).finally(() => {
5072
5159
  if (r.running = !1, r.rerunRequested)
5073
- return r.rerunRequested = !1, c.executeManagedFetch(t);
5074
- }));
5160
+ return r.rerunRequested = !1, h.executeManagedFetch(t);
5161
+ });
5075
5162
  }
5076
5163
  /**
5077
5164
  * data-import を URL 比較付きで実行します。
@@ -5080,7 +5167,7 @@ const c = class c {
5080
5167
  * @returns 実行完了の Promise
5081
5168
  */
5082
5169
  static executeManagedImport(t) {
5083
- const e = t.getTarget(), r = c.getReactiveImportState(e), i = t.getAttributeEvaluation(
5170
+ const e = t.getTarget(), r = h.getReactiveImportState(e), i = t.getAttributeEvaluation(
5084
5171
  `${l.prefix}import`
5085
5172
  ), n = i && !i.hasUnresolvedReference && typeof i.value == "string" && i.value !== "" ? i.value : null;
5086
5173
  if (r.running)
@@ -5091,16 +5178,16 @@ const c = class c {
5091
5178
  return Promise.resolve();
5092
5179
  r.lastUrl = n, r.running = !0;
5093
5180
  const s = performance.now();
5094
- return e.setAttribute(`${l.prefix}importing`, ""), R.importStart(e, n), Jt.load(n).then((a) => {
5181
+ return e.setAttribute(`${l.prefix}importing`, ""), R.importStart(e, n), Xt.load(n).then((a) => {
5095
5182
  const o = new TextEncoder().encode(a).length;
5096
- return P.enqueue(() => {
5183
+ return k.enqueue(() => {
5097
5184
  e.innerHTML = a;
5098
5185
  }).then(() => {
5099
5186
  if (e.removeAttribute(`${l.prefix}importing`), R.importEnd(e, n, o, s), !document.body.hasAttribute("data-haori-ready")) {
5100
5187
  const u = [];
5101
- return e.childNodes.forEach((d) => {
5102
- const h = T.get(d);
5103
- h instanceof M ? u.push(c.scan(h.getTarget())) : h instanceof U && u.push(c.evaluateText(h));
5188
+ return e.childNodes.forEach((c) => {
5189
+ const d = w.get(c);
5190
+ d instanceof M ? u.push(h.scan(d.getTarget())) : d instanceof U && u.push(h.evaluateText(d));
5104
5191
  }), Promise.all(u).then(() => {
5105
5192
  });
5106
5193
  }
@@ -5109,7 +5196,7 @@ const c = class c {
5109
5196
  e.removeAttribute(`${l.prefix}importing`), R.importError(e, n, a), m.error("[Haori]", "Failed to import HTML:", n, a);
5110
5197
  }).finally(() => {
5111
5198
  if (r.running = !1, r.rerunRequested)
5112
- return r.rerunRequested = !1, c.executeManagedImport(t);
5199
+ return r.rerunRequested = !1, h.executeManagedImport(t);
5113
5200
  });
5114
5201
  }
5115
5202
  /**
@@ -5119,8 +5206,8 @@ const c = class c {
5119
5206
  * @returns Promise (スキャンが完了したときに解決される)
5120
5207
  */
5121
5208
  static scan(t) {
5122
- const e = T.get(t);
5123
- return e ? c.initializeElementFragment(e, !1) : Promise.resolve();
5209
+ const e = w.get(t);
5210
+ return e ? h.initializeElementFragment(e, !1) : Promise.resolve();
5124
5211
  }
5125
5212
  /**
5126
5213
  * 新規 each 行を局所初期化します。
@@ -5130,8 +5217,8 @@ const c = class c {
5130
5217
  * @returns 初期化完了の Promise
5131
5218
  */
5132
5219
  static initializeFreshEachRow(t) {
5133
- return c.initializeElementFragment(t, !0).then(() => {
5134
- c.needsScheduledEvaluateAll(t) && c.scheduleEvaluateAll(t);
5220
+ return h.initializeElementFragment(t, !0).then(() => {
5221
+ h.needsScheduledEvaluateAll(t) && h.scheduleEvaluateAll(t);
5135
5222
  });
5136
5223
  }
5137
5224
  /**
@@ -5142,16 +5229,16 @@ const c = class c {
5142
5229
  * @returns 初期化完了の Promise
5143
5230
  */
5144
5231
  static initializeElementFragment(t, e) {
5145
- return c.syncMountedState(t), e && t.isFreshInitializationSkippable() ? Promise.resolve() : c.initializeElementAttributes(t).then(() => {
5146
- if (c.shouldSkipChildInitialization(t, e)) {
5147
- c.refreshDerivedSubtreeSignature(t);
5232
+ return h.syncMountedState(t), e && t.isFreshInitializationSkippable() ? Promise.resolve() : h.initializeElementAttributes(t).then(() => {
5233
+ if (h.shouldSkipChildInitialization(t, e)) {
5234
+ h.refreshDerivedSubtreeSignature(t);
5148
5235
  return;
5149
5236
  }
5150
5237
  const r = [];
5151
5238
  return t.getChildren().forEach((i) => {
5152
- i instanceof M ? r.push(c.initializeElementFragment(i, e)) : i instanceof U && r.push(c.evaluateText(i));
5239
+ i instanceof M ? r.push(h.initializeElementFragment(i, e)) : i instanceof U && r.push(h.evaluateText(i));
5153
5240
  }), Promise.all(r).then(() => {
5154
- c.refreshDerivedSubtreeSignature(t);
5241
+ h.refreshDerivedSubtreeSignature(t);
5155
5242
  });
5156
5243
  });
5157
5244
  }
@@ -5181,10 +5268,10 @@ const c = class c {
5181
5268
  static initializeElementAttributes(t) {
5182
5269
  let e = Promise.resolve();
5183
5270
  const r = /* @__PURE__ */ new Set();
5184
- for (const i of c.PRIORITY_ATTRIBUTE_SUFFIXES) {
5271
+ for (const i of h.PRIORITY_ATTRIBUTE_SUFFIXES) {
5185
5272
  const n = l.prefix + i;
5186
5273
  t.hasAttribute(n) && (e = e.then(
5187
- () => c.setAttribute(
5274
+ () => h.setAttribute(
5188
5275
  t.getTarget(),
5189
5276
  n,
5190
5277
  t.getRawAttribute(n)
@@ -5192,17 +5279,17 @@ const c = class c {
5192
5279
  ), r.add(n));
5193
5280
  }
5194
5281
  for (const i of t.getAttributeNames()) {
5195
- if (r.has(i) || c.isDeferredAttributeName(i))
5282
+ if (r.has(i) || h.isDeferredAttributeName(i))
5196
5283
  continue;
5197
5284
  const n = t.getRawAttribute(i);
5198
5285
  n !== null && (e = e.then(
5199
- () => c.setAttribute(t.getTarget(), i, n)
5286
+ () => h.setAttribute(t.getTarget(), i, n)
5200
5287
  ));
5201
5288
  }
5202
- for (const i of c.DEFERRED_ATTRIBUTE_SUFFIXES) {
5289
+ for (const i of h.DEFERRED_ATTRIBUTE_SUFFIXES) {
5203
5290
  const n = l.prefix + i;
5204
5291
  t.hasAttribute(n) && (e = e.then(
5205
- () => c.setAttribute(
5292
+ () => h.setAttribute(
5206
5293
  t.getTarget(),
5207
5294
  n,
5208
5295
  t.getRawAttribute(n)
@@ -5221,7 +5308,7 @@ const c = class c {
5221
5308
  */
5222
5309
  static shouldSkipChildInitialization(t, e) {
5223
5310
  const r = t.getAttribute(`${l.prefix}if`);
5224
- return t.hasAttribute(`${l.prefix}if`) && c.isHiddenIfCondition(r) ? !0 : e && t.hasAttribute(`${l.prefix}each`);
5311
+ return t.hasAttribute(`${l.prefix}if`) && h.isHiddenIfCondition(r) ? !0 : e && t.hasAttribute(`${l.prefix}each`);
5225
5312
  }
5226
5313
  /**
5227
5314
  * エレメントに属性を設定します。
@@ -5233,7 +5320,7 @@ const c = class c {
5233
5320
  * @returns Promise (DOM操作が完了したときに解決される)
5234
5321
  */
5235
5322
  static setAttribute(t, e, r, i = !1) {
5236
- const n = T.get(t), s = c.getAliasedAttributeName(e);
5323
+ const n = w.get(t), s = h.getAliasedAttributeName(e);
5237
5324
  if (s !== null)
5238
5325
  return r === null ? n.removeAliasedAttribute(e, s) : n.setAliasedAttribute(
5239
5326
  e,
@@ -5250,16 +5337,16 @@ const c = class c {
5250
5337
  else {
5251
5338
  if (i && n instanceof M && n.consumeSelfWrittenBind(r))
5252
5339
  break;
5253
- n.setBindingData(c.parseDataBind(r));
5340
+ n.setBindingData(h.parseDataBind(r));
5254
5341
  }
5255
5342
  break;
5256
5343
  }
5257
5344
  case `${l.prefix}derive`:
5258
- u = c.createDeriveInputSignature(
5345
+ u = h.createDeriveInputSignature(
5259
5346
  n,
5260
5347
  r,
5261
5348
  n.getRawAttribute(`${l.prefix}derive-name`)
5262
- ), o = c.evaluateDerive(
5349
+ ), o = h.evaluateDerive(
5263
5350
  n,
5264
5351
  r,
5265
5352
  n.getRawAttribute(`${l.prefix}derive-name`)
@@ -5267,11 +5354,11 @@ const c = class c {
5267
5354
  }));
5268
5355
  break;
5269
5356
  case `${l.prefix}derive-name`:
5270
- u = c.createDeriveInputSignature(
5357
+ u = h.createDeriveInputSignature(
5271
5358
  n,
5272
5359
  n.getRawAttribute(`${l.prefix}derive`),
5273
5360
  r
5274
- ), o = c.evaluateDerive(
5361
+ ), o = h.evaluateDerive(
5275
5362
  n,
5276
5363
  n.getRawAttribute(`${l.prefix}derive`),
5277
5364
  r
@@ -5279,33 +5366,33 @@ const c = class c {
5279
5366
  }));
5280
5367
  break;
5281
5368
  case `${l.prefix}if`:
5282
- a.push(c.evaluateIf(n));
5369
+ a.push(h.evaluateIf(n));
5283
5370
  break;
5284
5371
  case `${l.prefix}each`:
5285
- a.push(c.evaluateEach(n));
5372
+ a.push(h.evaluateEach(n));
5286
5373
  break;
5287
5374
  case `${l.prefix}fetch`:
5288
- a.push(c.executeManagedFetch(n));
5375
+ a.push(h.executeManagedFetch(n));
5289
5376
  break;
5290
5377
  case `${l.prefix}import`:
5291
- typeof r == "string" && a.push(c.executeManagedImport(n));
5378
+ typeof r == "string" && a.push(h.executeManagedImport(n));
5292
5379
  break;
5293
5380
  case `${l.prefix}url-param`: {
5294
- const d = n.getAttribute(`${l.prefix}url-arg`), h = Xt.readParams();
5295
- if (d === null)
5296
- a.push(c.setBindingData(t, h, /* @__PURE__ */ new Set(), !0));
5381
+ const c = n.getAttribute(`${l.prefix}url-arg`), d = Jt.readParams();
5382
+ if (c === null)
5383
+ a.push(h.setBindingData(t, d, /* @__PURE__ */ new Set(), !0));
5297
5384
  else {
5298
5385
  const g = n.getRawBindingData() || {};
5299
- g[String(d)] = h, a.push(c.setBindingData(t, g, /* @__PURE__ */ new Set(), !0));
5386
+ g[String(c)] = d, a.push(h.setBindingData(t, g, /* @__PURE__ */ new Set(), !0));
5300
5387
  }
5301
5388
  break;
5302
5389
  }
5303
5390
  }
5304
5391
  return r === null ? a.push(n.removeAttribute(e)) : a.push(n.setAttribute(e, r, i)), Promise.all(a).then(() => {
5305
5392
  if (o !== null)
5306
- return n.setDeriveInputSignature(u), o.then((d) => {
5307
- if (d)
5308
- return c.reevaluateChildren(n);
5393
+ return n.setDeriveInputSignature(u), o.then((c) => {
5394
+ if (c)
5395
+ return h.reevaluateChildren(n);
5309
5396
  });
5310
5397
  }).then(() => {
5311
5398
  });
@@ -5319,22 +5406,27 @@ const c = class c {
5319
5406
  * @returns Promise (DOM操作が完了したときに解決される)
5320
5407
  */
5321
5408
  static setBindingData(t, e, r = /* @__PURE__ */ new Set(), i = !1) {
5322
- const n = T.get(t), s = n.getRawBindingData();
5409
+ const n = w.get(t), s = n.getRawBindingData();
5323
5410
  n.setBindingData(e), R.bindChange(t, s, e, "manual");
5324
5411
  const a = () => {
5412
+ n.markBindingWorkStart();
5325
5413
  const o = n.getRawBindingData() ?? e;
5326
5414
  let u = n.setAttribute(
5327
5415
  `${l.prefix}bind`,
5328
5416
  JSON.stringify(o)
5329
5417
  );
5330
5418
  if (t.tagName === "FORM") {
5331
- const d = n.getAttribute(`${l.prefix}form-arg`), h = d && o[String(d)] && typeof o[String(d)] == "object" && !Array.isArray(o[String(d)]) ? o[String(d)] : d ? {} : o;
5332
- u = u.then(() => y.syncValues(n, h));
5419
+ const c = n.getAttribute(`${l.prefix}form-arg`), d = c && o[String(c)] && typeof o[String(c)] == "object" && !Array.isArray(o[String(c)]) ? o[String(c)] : c ? {} : o;
5420
+ u = u.then(() => E.syncValues(n, d));
5333
5421
  }
5334
- return u = u.then(() => c.evaluateAll(n, r)), u = u.then(
5335
- () => c.reevaluateReactiveSpecialAttributes(n, r)
5336
- ), u.then(() => {
5337
- });
5422
+ return u = u.then(() => h.evaluateAll(n, r)), u = u.then(
5423
+ () => h.reevaluateReactiveSpecialAttributes(n, r)
5424
+ ), u.then(
5425
+ () => n.markBindingWorkEnd(),
5426
+ (c) => {
5427
+ throw n.markBindingWorkEnd(), c;
5428
+ }
5429
+ );
5338
5430
  };
5339
5431
  return i ? a() : n.enqueueBindingWork(a);
5340
5432
  }
@@ -5356,7 +5448,7 @@ const c = class c {
5356
5448
  * `resolved: true` のときは解決済みスコープ(常にオブジェクト)。
5357
5449
  */
5358
5450
  static getBindingData(t, e = {}) {
5359
- const r = T.get(t);
5451
+ const r = w.get(t);
5360
5452
  return r instanceof M ? e.resolved ? r.getBindingData() : r.getRawBindingData() : null;
5361
5453
  }
5362
5454
  /**
@@ -5375,19 +5467,19 @@ const c = class c {
5375
5467
  * @return 解決済みスコープと各キーの由来情報
5376
5468
  */
5377
5469
  static dumpScope(t) {
5378
- const e = T.get(t);
5470
+ const e = w.get(t);
5379
5471
  if (!e)
5380
5472
  return { resolved: {}, sources: {} };
5381
5473
  const r = e.getBindingData(), i = {}, n = (u) => {
5382
- const d = u.getTarget();
5383
- return d.id ? `#${d.id}` : d.tagName.toLowerCase();
5384
- }, s = (u, d, h, g) => {
5474
+ const c = u.getTarget();
5475
+ return c.id ? `#${c.id}` : c.tagName.toLowerCase();
5476
+ }, s = (u, c, d, g) => {
5385
5477
  if (u)
5386
- for (const E of Object.keys(u))
5387
- E in i || (i[E] = {
5388
- value: u[E],
5389
- source: n(d),
5390
- kind: h,
5478
+ for (const y of Object.keys(u))
5479
+ y in i || (i[y] = {
5480
+ value: u[y],
5481
+ source: n(c),
5482
+ kind: d,
5391
5483
  depth: g
5392
5484
  });
5393
5485
  };
@@ -5423,11 +5515,11 @@ const c = class c {
5423
5515
  * @param node 追加するノード
5424
5516
  */
5425
5517
  static addNode(t, e) {
5426
- const r = T.get(t);
5518
+ const r = w.get(t);
5427
5519
  if (r.isSkipMutationNodes())
5428
5520
  return;
5429
- const i = T.get(e.nextSibling), n = T.get(e);
5430
- n && (r.insertBefore(n, i), n instanceof M ? c.scan(n.getTarget()) : n instanceof U && c.evaluateText(n));
5521
+ const i = w.get(e.nextSibling), n = w.get(e);
5522
+ n && (r.insertBefore(n, i), n instanceof M ? h.scan(n.getTarget()) : n instanceof U && h.evaluateText(n));
5431
5523
  }
5432
5524
  /**
5433
5525
  * ノードを親要素から削除します。
@@ -5435,7 +5527,7 @@ const c = class c {
5435
5527
  * @param node 削除するノード
5436
5528
  */
5437
5529
  static removeNode(t) {
5438
- const e = T.get(t);
5530
+ const e = w.get(t);
5439
5531
  if (e) {
5440
5532
  const r = e.getParent();
5441
5533
  if (r && r.isSkipMutationNodes())
@@ -5450,7 +5542,7 @@ const c = class c {
5450
5542
  * @param text 新しいテキスト
5451
5543
  */
5452
5544
  static changeText(t, e) {
5453
- const r = T.get(t);
5545
+ const r = w.get(t);
5454
5546
  r && r.setContent(e);
5455
5547
  }
5456
5548
  /**
@@ -5462,16 +5554,16 @@ const c = class c {
5462
5554
  * @returns Promise (DOM操作が完了したときに解決される)
5463
5555
  */
5464
5556
  static changeValue(t, e) {
5465
- const r = T.get(t);
5557
+ const r = w.get(t);
5466
5558
  if (r.getValue() === e)
5467
5559
  return Promise.resolve();
5468
5560
  const i = [];
5469
5561
  i.push(r.setValue(e));
5470
- const n = c.getFormFragment(r);
5562
+ const n = h.getFormFragment(r);
5471
5563
  if (n) {
5472
- const s = y.getValues(n), a = n.getAttribute(`${l.prefix}form-arg`);
5564
+ const s = E.getValues(n), a = n.getAttribute(`${l.prefix}form-arg`);
5473
5565
  let o;
5474
- a ? (o = n.getRawBindingData(), o || (o = {}), o[String(a)] = s) : o = s, i.push(c.setBindingData(n.getTarget(), o));
5566
+ a ? (o = n.getRawBindingData(), o || (o = {}), o[String(a)] = s) : o = s, i.push(h.setBindingData(n.getTarget(), o));
5475
5567
  }
5476
5568
  return Promise.all(i).then(() => {
5477
5569
  });
@@ -5486,7 +5578,7 @@ const c = class c {
5486
5578
  if (t.getTarget() instanceof HTMLFormElement)
5487
5579
  return t;
5488
5580
  const e = t.getParent();
5489
- return e ? c.getFormFragment(e) : null;
5581
+ return e ? h.getFormFragment(e) : null;
5490
5582
  }
5491
5583
  /**
5492
5584
  * フラグメントとその子要素を評価します。
@@ -5497,21 +5589,21 @@ const c = class c {
5497
5589
  static evaluateAll(t, e = /* @__PURE__ */ new Set()) {
5498
5590
  if (e.has(t))
5499
5591
  return Promise.resolve();
5500
- let r = c.reevaluateInterpolatedAttributes(t);
5592
+ let r = h.reevaluateInterpolatedAttributes(t);
5501
5593
  const i = t.hasAttribute(`${l.prefix}derive`), n = t.hasAttribute(`${l.prefix}if`), s = t.hasAttribute(`${l.prefix}each`), a = t.getRawAttribute(`${l.prefix}derive`), o = t.getRawAttribute(`${l.prefix}derive-name`);
5502
- let u = !1, d = !1, h = null;
5594
+ let u = !1, c = !1, d = null;
5503
5595
  if (!i && t.getDeriveSubtreeSignature() !== null && t.setDeriveSubtreeSignature(null), !i && t.getDeriveInputSignature() !== null && t.setDeriveInputSignature(null), i) {
5504
- const g = c.createDeriveInputSignature(
5596
+ const g = h.createDeriveInputSignature(
5505
5597
  t,
5506
5598
  a,
5507
5599
  o
5508
5600
  );
5509
5601
  g === null ? (t.getDeriveInputSignature() !== null && t.setDeriveInputSignature(null), r = r.then(
5510
- () => c.evaluateDerive(t, a, o).then(
5602
+ () => h.evaluateDerive(t, a, o).then(
5511
5603
  () => {
5512
5604
  }
5513
5605
  )
5514
- )) : t.getDeriveInputSignature() !== g && (r = r.then(() => c.evaluateDerive(
5606
+ )) : t.getDeriveInputSignature() !== g && (r = r.then(() => h.evaluateDerive(
5515
5607
  t,
5516
5608
  a,
5517
5609
  o
@@ -5519,16 +5611,16 @@ const c = class c {
5519
5611
  t.setDeriveInputSignature(g);
5520
5612
  })));
5521
5613
  }
5522
- return n && (r = r.then(() => c.evaluateIf(t))), s ? (t.getDeriveSubtreeSignature() !== null && t.setDeriveSubtreeSignature(null), r.then(() => c.evaluateEach(t))) : n ? (t.getDeriveSubtreeSignature() !== null && t.setDeriveSubtreeSignature(null), r.then(() => {
5614
+ return n && (r = r.then(() => h.evaluateIf(t))), s ? (t.getDeriveSubtreeSignature() !== null && t.setDeriveSubtreeSignature(null), r.then(() => h.evaluateEach(t))) : n ? (t.getDeriveSubtreeSignature() !== null && t.setDeriveSubtreeSignature(null), r.then(() => {
5523
5615
  })) : (i && (r = r.then(() => {
5524
- if (!c.canSkipStableDerivedSubtree(t)) {
5525
- t.setDeriveSubtreeSignature(null), c.logDerivedSubtreeProfileSnapshot(t, "skip-ineligible");
5616
+ if (!h.canSkipStableDerivedSubtree(t)) {
5617
+ t.setDeriveSubtreeSignature(null), h.logDerivedSubtreeProfileSnapshot(t, "skip-ineligible");
5526
5618
  return;
5527
5619
  }
5528
- h = c.createDescendantBindingSignature(
5620
+ d = h.createDescendantBindingSignature(
5529
5621
  t,
5530
5622
  "evaluateAll"
5531
- ), d = !0, u = t.getDeriveSubtreeSignature() !== null && t.getDeriveSubtreeSignature() === h, c.logDerivedSubtreeProfileSnapshot(
5623
+ ), c = !0, u = t.getDeriveSubtreeSignature() !== null && t.getDeriveSubtreeSignature() === d, h.logDerivedSubtreeProfileSnapshot(
5532
5624
  t,
5533
5625
  u ? "skip-hit" : "skip-miss"
5534
5626
  );
@@ -5536,16 +5628,16 @@ const c = class c {
5536
5628
  if (u)
5537
5629
  return;
5538
5630
  const g = [];
5539
- return t.getChildren().forEach((E) => {
5540
- if (E instanceof M) {
5541
- if (c.canSkipUnchangedNestedEach(E))
5631
+ return t.getChildren().forEach((y) => {
5632
+ if (y instanceof M) {
5633
+ if (h.canSkipUnchangedNestedEach(y))
5542
5634
  return;
5543
- g.push(c.evaluateAll(E, e));
5544
- } else E instanceof U && g.push(c.evaluateText(E));
5635
+ g.push(h.evaluateAll(y, e));
5636
+ } else y instanceof U && g.push(h.evaluateText(y));
5545
5637
  }), Promise.all(g).then(() => {
5546
5638
  });
5547
5639
  }).then(() => {
5548
- d && h !== null && t.setDeriveSubtreeSignature(h);
5640
+ c && d !== null && t.setDeriveSubtreeSignature(d);
5549
5641
  }));
5550
5642
  }
5551
5643
  /**
@@ -5573,7 +5665,7 @@ const c = class c {
5573
5665
  const a = {
5574
5666
  [n]: s.value
5575
5667
  };
5576
- return c.createBindingSignature(i) === c.createBindingSignature(a) ? Promise.resolve(!1) : (t.setDerivedBindingData(a), Promise.resolve(!0));
5668
+ return h.createBindingSignature(i) === h.createBindingSignature(a) ? Promise.resolve(!1) : (t.setDerivedBindingData(a), Promise.resolve(!0));
5577
5669
  }
5578
5670
  /**
5579
5671
  * テキストフラグメントを評価します。
@@ -5611,7 +5703,7 @@ const c = class c {
5611
5703
  const e = t.getRawAttribute(`${l.prefix}if`);
5612
5704
  if (typeof e != "string" || e.indexOf("{{") >= 0)
5613
5705
  return;
5614
- const { sources: r } = c.dumpScope(t.getTarget()), i = /* @__PURE__ */ new Set(), n = e.match(/[A-Za-z_$][\w$]*/g) ?? [];
5706
+ const { sources: r } = h.dumpScope(t.getTarget()), i = /* @__PURE__ */ new Set(), n = e.match(/[A-Za-z_$][\w$]*/g) ?? [];
5615
5707
  let s = 0;
5616
5708
  n.forEach((o) => {
5617
5709
  const u = e.indexOf(o, s);
@@ -5638,8 +5730,8 @@ const c = class c {
5638
5730
  */
5639
5731
  static evaluateIf(t) {
5640
5732
  const e = [], r = t.getAttribute(`${l.prefix}if`);
5641
- if (c.isHiddenIfCondition(r))
5642
- H.isEnabled() && c.logFalsyIfDiagnostics(t), e.push(
5733
+ if (h.isHiddenIfCondition(r))
5734
+ H.isEnabled() && h.logFalsyIfDiagnostics(t), e.push(
5643
5735
  t.hide().then(() => {
5644
5736
  R.hide(t.getTarget());
5645
5737
  })
@@ -5648,11 +5740,11 @@ const c = class c {
5648
5740
  const i = t.isVisible(), n = [];
5649
5741
  t.getChildren().forEach((s) => {
5650
5742
  s instanceof M ? n.push(
5651
- s.isMounted() ? c.evaluateAll(s) : c.scan(s.getTarget())
5652
- ) : s instanceof U && n.push(c.evaluateText(s));
5743
+ s.isMounted() ? h.evaluateAll(s) : h.scan(s.getTarget())
5744
+ ) : s instanceof U && n.push(h.evaluateText(s));
5653
5745
  }), e.push(
5654
5746
  t.show().then(() => {
5655
- R.show(t.getTarget()), i || c.triggerLoadOnShow(t);
5747
+ R.show(t.getTarget()), i || h.triggerLoadOnShow(t);
5656
5748
  })
5657
5749
  ), e.push(Promise.all(n).then(() => {
5658
5750
  }));
@@ -5682,8 +5774,8 @@ const c = class c {
5682
5774
  * @return 再入制御状態
5683
5775
  */
5684
5776
  static getEachUpdateState(t) {
5685
- let e = c.EACH_UPDATE_STATES.get(t);
5686
- return e || (e = { running: !1, rerunRequested: !1, settled: null }, c.EACH_UPDATE_STATES.set(t, e)), e;
5777
+ let e = h.EACH_UPDATE_STATES.get(t);
5778
+ return e || (e = { running: !1, rerunRequested: !1, settled: null }, h.EACH_UPDATE_STATES.set(t, e)), e;
5687
5779
  }
5688
5780
  /**
5689
5781
  * each要素を評価します。
@@ -5701,8 +5793,8 @@ const c = class c {
5701
5793
  static evaluateEach(t) {
5702
5794
  if (!t.isVisible() || !t.isMounted())
5703
5795
  return Promise.resolve();
5704
- const e = c.getEachUpdateState(t);
5705
- return e.running ? (e.rerunRequested = !0, e.settled ?? Promise.resolve()) : c.runEachUpdateLoop(t, e);
5796
+ const e = h.getEachUpdateState(t);
5797
+ return e.running ? (e.rerunRequested = !0, e.settled ?? Promise.resolve()) : h.runEachUpdateLoop(t, e);
5706
5798
  }
5707
5799
  /**
5708
5800
  * data-each の差分更新を、再評価要求が無くなるまで直列に繰り返し実行します。
@@ -5718,7 +5810,7 @@ const c = class c {
5718
5810
  const r = (async () => {
5719
5811
  try {
5720
5812
  do
5721
- e.rerunRequested = !1, await c.performEachUpdate(t);
5813
+ e.rerunRequested = !1, await h.performEachUpdate(t);
5722
5814
  while (e.rerunRequested);
5723
5815
  t.getTarget().setAttribute(`${l.prefix}each-done`, "");
5724
5816
  } finally {
@@ -5734,11 +5826,11 @@ const c = class c {
5734
5826
  * @return 差分更新完了の Promise
5735
5827
  */
5736
5828
  static performEachUpdate(t) {
5737
- const e = c.resolveEachItems(t);
5829
+ const e = h.resolveEachItems(t);
5738
5830
  if (e === null)
5739
5831
  return Promise.reject(new Error("Invalid each attribute."));
5740
5832
  let r = t.getTemplate();
5741
- const i = t.getAttribute(`${l.prefix}each-key`), n = c.createBindingSignature({
5833
+ const i = t.getAttribute(`${l.prefix}each-key`), n = h.createBindingSignature({
5742
5834
  key: i ? String(i) : null,
5743
5835
  items: e
5744
5836
  });
@@ -5748,7 +5840,7 @@ const c = class c {
5748
5840
  if (!s && a instanceof M) {
5749
5841
  if (a.hasAttribute(`${l.prefix}each-before`) || a.hasAttribute(`${l.prefix}each-after`))
5750
5842
  return;
5751
- r = a.clone(), c.markFreshInitializationSkippable(r), t.setTemplate(r), s = !0, t.removeChild(a);
5843
+ r = a.clone(), h.markFreshInitializationSkippable(r), t.setTemplate(r), s = !0, t.removeChild(a);
5752
5844
  const o = a.getTarget();
5753
5845
  o.parentNode && o.parentNode.removeChild(o), a.setMounted(!1);
5754
5846
  }
@@ -5758,11 +5850,11 @@ const c = class c {
5758
5850
  (u) => !u.hasAttribute(`${l.prefix}each-before`) && !u.hasAttribute(`${l.prefix}each-after`)
5759
5851
  ).forEach((u) => {
5760
5852
  if (!s) {
5761
- const h = T.get(u);
5762
- h instanceof M && (r = h.clone(), c.markFreshInitializationSkippable(r), t.setTemplate(r), s = !0);
5853
+ const d = w.get(u);
5854
+ d instanceof M && (r = d.clone(), h.markFreshInitializationSkippable(r), t.setTemplate(r), s = !0);
5763
5855
  }
5764
- const d = T.get(u);
5765
- d instanceof M && t.getChildren().includes(d) && (t.removeChild(d), d.setMounted(!1)), u.parentNode && u.parentNode.removeChild(u);
5856
+ const c = w.get(u);
5857
+ c instanceof M && t.getChildren().includes(c) && (t.removeChild(c), c.setMounted(!1)), u.parentNode && u.parentNode.removeChild(u);
5766
5858
  });
5767
5859
  }
5768
5860
  return this.updateDiff(t, e).then(() => {
@@ -5794,12 +5886,12 @@ const c = class c {
5794
5886
  if (!t.hasAttribute(`${l.prefix}each`) || t.getEachInputSignature() === null)
5795
5887
  return !1;
5796
5888
  const e = t.getParent();
5797
- if (e?.closestByAttribute(`${l.prefix}derive`) || e?.closestByAttribute(`${l.prefix}derive-name`) || e?.closestByAttribute(`${l.prefix}if`) || e?.closestByAttribute(`${l.prefix}fetch`) || e?.closestByAttribute(`${l.prefix}import`) || c.hasNonEachDynamicElementState(t))
5889
+ if (e?.closestByAttribute(`${l.prefix}derive`) || e?.closestByAttribute(`${l.prefix}derive-name`) || e?.closestByAttribute(`${l.prefix}if`) || e?.closestByAttribute(`${l.prefix}fetch`) || e?.closestByAttribute(`${l.prefix}import`) || h.hasNonEachDynamicElementState(t))
5798
5890
  return !1;
5799
- const r = c.resolveEachItems(t);
5891
+ const r = h.resolveEachItems(t);
5800
5892
  if (r === null)
5801
5893
  return !1;
5802
- const i = t.getAttribute(`${l.prefix}each-key`), n = c.createBindingSignature({
5894
+ const i = t.getAttribute(`${l.prefix}each-key`), n = h.createBindingSignature({
5803
5895
  key: i ? String(i) : null,
5804
5896
  items: r
5805
5897
  });
@@ -5813,7 +5905,7 @@ const c = class c {
5813
5905
  * @returns 省略可能なら true
5814
5906
  */
5815
5907
  static canSkipStableDerivedSubtree(t) {
5816
- return !t.hasAttribute(`${l.prefix}derive`) || t.hasAttribute(`${l.prefix}if`) || t.hasAttribute(`${l.prefix}each`) || t.hasAttribute(`${l.prefix}fetch`) || t.hasAttribute(`${l.prefix}import`) ? !1 : !c.hasDisallowedDerivedSubtreeDescendant(t);
5908
+ return !t.hasAttribute(`${l.prefix}derive`) || t.hasAttribute(`${l.prefix}if`) || t.hasAttribute(`${l.prefix}each`) || t.hasAttribute(`${l.prefix}fetch`) || t.hasAttribute(`${l.prefix}import`) ? !1 : !h.hasDisallowedDerivedSubtreeDescendant(t);
5817
5909
  }
5818
5910
  /**
5819
5911
  * data-derive subtree skip の初期 PoC で扱わない子孫要素を含むかを返します。
@@ -5822,7 +5914,7 @@ const c = class c {
5822
5914
  * @returns 含むなら true
5823
5915
  */
5824
5916
  static hasDisallowedDerivedSubtreeDescendant(t) {
5825
- return t.getChildren().some((e) => e instanceof M ? e.hasAttribute(`${l.prefix}derive`) || e.hasAttribute(`${l.prefix}derive-name`) || e.hasAttribute(`${l.prefix}fetch`) || e.hasAttribute(`${l.prefix}import`) ? !0 : c.hasDisallowedDerivedSubtreeDescendant(e) : !1);
5917
+ return t.getChildren().some((e) => e instanceof M ? e.hasAttribute(`${l.prefix}derive`) || e.hasAttribute(`${l.prefix}derive-name`) || e.hasAttribute(`${l.prefix}fetch`) || e.hasAttribute(`${l.prefix}import`) ? !0 : h.hasDisallowedDerivedSubtreeDescendant(e) : !1);
5826
5918
  }
5827
5919
  /**
5828
5920
  * data-derive host が子孫要素へ公開している binding の署名を返します。
@@ -5831,7 +5923,7 @@ const c = class c {
5831
5923
  * @returns binding 署名
5832
5924
  */
5833
5925
  static createDescendantBindingSignature(t, e) {
5834
- return c.recordDerivedSubtreeSignatureComputation(t, e), c.createBindingSignature(t.getDescendantBindingData());
5926
+ return h.recordDerivedSubtreeSignatureComputation(t, e), h.createBindingSignature(t.getDescendantBindingData());
5835
5927
  }
5836
5928
  /**
5837
5929
  * data-derive 実行前の入力署名を返します。
@@ -5843,7 +5935,7 @@ const c = class c {
5843
5935
  */
5844
5936
  static createDeriveInputSignature(t, e, r) {
5845
5937
  const i = typeof r == "string" ? r.trim() : "";
5846
- return !e || i === "" ? null : c.createBindingSignature({
5938
+ return !e || i === "" ? null : h.createBindingSignature({
5847
5939
  expression: e,
5848
5940
  name: i,
5849
5941
  scope: t.getBindingData()
@@ -5855,13 +5947,13 @@ const c = class c {
5855
5947
  * @param fragment 対象フラグメント
5856
5948
  */
5857
5949
  static refreshDerivedSubtreeSignature(t) {
5858
- if (!c.canSkipStableDerivedSubtree(t)) {
5859
- t.setDeriveSubtreeSignature(null), c.logDerivedSubtreeProfileSnapshot(t, "skip-ineligible");
5950
+ if (!h.canSkipStableDerivedSubtree(t)) {
5951
+ t.setDeriveSubtreeSignature(null), h.logDerivedSubtreeProfileSnapshot(t, "skip-ineligible");
5860
5952
  return;
5861
5953
  }
5862
5954
  t.setDeriveSubtreeSignature(
5863
- c.createDescendantBindingSignature(t, "refresh")
5864
- ), c.logDerivedSubtreeProfileSnapshot(t, "refresh");
5955
+ h.createDescendantBindingSignature(t, "refresh")
5956
+ ), h.logDerivedSubtreeProfileSnapshot(t, "refresh");
5865
5957
  }
5866
5958
  /**
5867
5959
  * data-derive subtree skip のプロファイルを取得または初期化します。
@@ -5872,11 +5964,11 @@ const c = class c {
5872
5964
  static getOrCreateDerivedSubtreeProfile(t) {
5873
5965
  if (!H.isEnabled() || !t.hasAttribute(`${l.prefix}derive`))
5874
5966
  return null;
5875
- const e = c.DERIVE_SUBTREE_PROFILES.get(t);
5967
+ const e = h.DERIVE_SUBTREE_PROFILES.get(t);
5876
5968
  if (e)
5877
5969
  return e;
5878
5970
  const r = {
5879
- hostId: c.createDerivedSubtreeHostId(t),
5971
+ hostId: h.createDerivedSubtreeHostId(t),
5880
5972
  signatureComputeTotal: 0,
5881
5973
  signatureComputeFromEvaluateAll: 0,
5882
5974
  signatureComputeFromRefresh: 0,
@@ -5884,7 +5976,7 @@ const c = class c {
5884
5976
  skipMissCount: 0,
5885
5977
  skipIneligibleCount: 0
5886
5978
  };
5887
- return c.DERIVE_SUBTREE_PROFILES.set(t, r), r;
5979
+ return h.DERIVE_SUBTREE_PROFILES.set(t, r), r;
5888
5980
  }
5889
5981
  /**
5890
5982
  * data-derive subtree host の識別子を作成します。
@@ -5922,7 +6014,7 @@ const c = class c {
5922
6014
  * @param source 計算元
5923
6015
  */
5924
6016
  static recordDerivedSubtreeSignatureComputation(t, e) {
5925
- const r = c.getOrCreateDerivedSubtreeProfile(t);
6017
+ const r = h.getOrCreateDerivedSubtreeProfile(t);
5926
6018
  if (r !== null) {
5927
6019
  if (r.signatureComputeTotal += 1, e === "refresh") {
5928
6020
  r.signatureComputeFromRefresh += 1;
@@ -5938,7 +6030,7 @@ const c = class c {
5938
6030
  * @param reason ログ理由
5939
6031
  */
5940
6032
  static logDerivedSubtreeProfileSnapshot(t, e) {
5941
- const r = c.getOrCreateDerivedSubtreeProfile(t);
6033
+ const r = h.getOrCreateDerivedSubtreeProfile(t);
5942
6034
  r !== null && (e === "skip-hit" ? r.skipHitCount += 1 : e === "skip-miss" ? r.skipMissCount += 1 : e === "skip-ineligible" && (r.skipIneligibleCount += 1), m.info("[Haori][derive-profile]", {
5943
6035
  reason: e,
5944
6036
  hostId: r.hostId,
@@ -5981,7 +6073,7 @@ const c = class c {
5981
6073
  * @returns subtree 全体を省略可能なら true
5982
6074
  */
5983
6075
  static markFreshInitializationSkippable(t) {
5984
- const e = t.getAttributeNames().some((n) => c.isFreshInitializationDynamicAttribute(t, n)), r = t.getChildren().some((n) => n instanceof M ? !c.markFreshInitializationSkippable(n) : n instanceof U ? n.hasDynamicContent() : !1), i = !e && !r;
6076
+ const e = t.getAttributeNames().some((n) => h.isFreshInitializationDynamicAttribute(t, n)), r = t.getChildren().some((n) => n instanceof M ? !h.markFreshInitializationSkippable(n) : n instanceof U ? n.hasDynamicContent() : !1), i = !e && !r;
5985
6077
  return t.setFreshInitializationSkippable(i), i;
5986
6078
  }
5987
6079
  /**
@@ -6011,35 +6103,35 @@ const c = class c {
6011
6103
  i && (i = String(i));
6012
6104
  const n = t.getAttribute(`${l.prefix}each-key`), s = t.getAttribute(`${l.prefix}each-arg`), a = /* @__PURE__ */ new Map(), o = [];
6013
6105
  e.forEach((b, S) => {
6014
- const F = c.createListKey(
6106
+ const F = h.createListKey(
6015
6107
  b,
6016
6108
  n ? String(n) : null,
6017
6109
  S
6018
6110
  );
6019
6111
  o.push(F), a.set(F, { item: b, itemIndex: S });
6020
6112
  });
6021
- const u = new Set(o), d = [];
6022
- let h = t.getChildren().filter((b) => b instanceof M).filter(
6113
+ const u = new Set(o), c = [];
6114
+ let d = t.getChildren().filter((b) => b instanceof M).filter(
6023
6115
  (b) => !b.hasAttribute(`${l.prefix}each-before`) && !b.hasAttribute(`${l.prefix}each-after`)
6024
6116
  );
6025
- const g = h.map((b) => b.getListKey());
6026
- h = h.filter((b) => u.has(String(b.getListKey())) ? !0 : (d.push(b.remove()), !1));
6027
- const E = h.map((b) => b.getListKey()), w = /* @__PURE__ */ new Map();
6028
- h.forEach((b) => {
6117
+ const g = d.map((b) => b.getListKey());
6118
+ d = d.filter((b) => u.has(String(b.getListKey())) ? !0 : (c.push(b.remove()), !1));
6119
+ const y = d.map((b) => b.getListKey()), T = /* @__PURE__ */ new Map();
6120
+ d.forEach((b) => {
6029
6121
  const S = b.getListKey();
6030
- S !== null && !w.has(S) && w.set(S, b);
6122
+ S !== null && !T.has(S) && T.set(S, b);
6031
6123
  });
6032
- const k = t.getChildElementFragments().slice(), A = k.filter(
6124
+ const P = t.getChildElementFragments().slice(), A = P.filter(
6033
6125
  (b) => b.hasAttribute(`${l.prefix}each-before`)
6034
6126
  ).length;
6035
6127
  let v = Promise.resolve();
6036
6128
  return o.forEach((b, S) => {
6037
6129
  const { item: F, itemIndex: I } = a.get(b);
6038
6130
  let $;
6039
- const V = w.get(b);
6131
+ const V = T.get(b);
6040
6132
  if (V)
6041
6133
  $ = V, v = v.then(
6042
- () => c.updateRowFragment(
6134
+ () => h.updateRowFragment(
6043
6135
  $,
6044
6136
  F,
6045
6137
  i,
@@ -6048,14 +6140,14 @@ const c = class c {
6048
6140
  b
6049
6141
  ).then((C) => {
6050
6142
  if (C)
6051
- return c.evaluateAll($);
6143
+ return h.evaluateAll($);
6052
6144
  })
6053
6145
  );
6054
6146
  else {
6055
6147
  $ = r.clone();
6056
6148
  const C = A + S;
6057
6149
  v = v.then(
6058
- () => c.updateRowFragment(
6150
+ () => h.updateRowFragment(
6059
6151
  $,
6060
6152
  F,
6061
6153
  i,
@@ -6063,17 +6155,17 @@ const c = class c {
6063
6155
  s ? String(s) : null,
6064
6156
  b
6065
6157
  ).then(() => {
6066
- const Q = k[C] ?? null;
6158
+ const Q = P[C] ?? null;
6067
6159
  return t.insertBefore($, Q).then(() => {
6068
- k.splice(C, 0, $);
6069
- }).then(() => c.initializeFreshEachRow($));
6160
+ P.splice(C, 0, $);
6161
+ }).then(() => h.initializeFreshEachRow($));
6070
6162
  })
6071
6163
  );
6072
6164
  }
6073
- }), Promise.all(d).then(() => v).then(() => {
6165
+ }), Promise.all(c).then(() => v).then(() => {
6074
6166
  const b = o.filter(
6075
6167
  (C) => C !== null
6076
- ), S = E.filter(
6168
+ ), S = y.filter(
6077
6169
  (C) => C !== null
6078
6170
  ), F = new Set(S), I = b.filter((C) => !F.has(C)), V = g.filter(
6079
6171
  (C) => C !== null
@@ -6134,7 +6226,7 @@ const c = class c {
6134
6226
  "[Haori]",
6135
6227
  `Primitive value requires '${l.prefix}each-arg' attribute: ${e}`
6136
6228
  ), Promise.resolve(!1);
6137
- const o = a, u = c.createBindingSignature({
6229
+ const o = a, u = h.createBindingSignature({
6138
6230
  listKey: s,
6139
6231
  bindingData: o
6140
6232
  });
@@ -6152,7 +6244,7 @@ const c = class c {
6152
6244
  const r = e.pop();
6153
6245
  if (r.getChildElementFragments().forEach((i) => {
6154
6246
  e.push(i);
6155
- }), r !== t && !r.isMounted() && c.hasMountSensitiveAttribute(r))
6247
+ }), r !== t && !r.isMounted() && h.hasMountSensitiveAttribute(r))
6156
6248
  return !0;
6157
6249
  }
6158
6250
  return !1;
@@ -6195,7 +6287,7 @@ const c = class c {
6195
6287
  if (e.has(t))
6196
6288
  return `[Circular:${e.get(t)}]`;
6197
6289
  const i = `array-${r.value}`;
6198
- return r.value += 1, e.set(t, i), `[${t.map((n) => c.createBindingSignature(n, e, r)).join(",")}]`;
6290
+ return r.value += 1, e.set(t, i), `[${t.map((n) => h.createBindingSignature(n, e, r)).join(",")}]`;
6199
6291
  }
6200
6292
  if (typeof t == "object") {
6201
6293
  if (e.has(t))
@@ -6204,7 +6296,7 @@ const c = class c {
6204
6296
  r.value += 1, e.set(t, i);
6205
6297
  const n = t;
6206
6298
  return `{${Object.keys(n).sort().map(
6207
- (s) => `${JSON.stringify(s)}:${c.createBindingSignature(
6299
+ (s) => `${JSON.stringify(s)}:${h.createBindingSignature(
6208
6300
  n[s],
6209
6301
  e,
6210
6302
  r
@@ -6220,18 +6312,18 @@ const c = class c {
6220
6312
  */
6221
6313
  static scheduleEvaluateAll(t) {
6222
6314
  setTimeout(() => {
6223
- c.evaluateAll(t);
6315
+ h.evaluateAll(t);
6224
6316
  }, 100);
6225
6317
  }
6226
6318
  };
6227
- c.ATTRIBUTE_ALIAS_SUFFIX = "attr-", c.PRIORITY_ATTRIBUTE_SUFFIXES = [
6319
+ h.ATTRIBUTE_ALIAS_SUFFIX = "attr-", h.PRIORITY_ATTRIBUTE_SUFFIXES = [
6228
6320
  "bind",
6229
6321
  "url-param",
6230
6322
  "derive-name",
6231
6323
  "derive",
6232
6324
  "if",
6233
6325
  "each"
6234
- ], c.DEFERRED_ATTRIBUTE_SUFFIXES = ["fetch"], c.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES = [
6326
+ ], h.DEFERRED_ATTRIBUTE_SUFFIXES = ["fetch"], h.EVALUATE_ALL_EXCLUDED_ATTRIBUTE_SUFFIXES = [
6235
6327
  "bind",
6236
6328
  "derive",
6237
6329
  "derive-name",
@@ -6240,9 +6332,9 @@ c.ATTRIBUTE_ALIAS_SUFFIX = "attr-", c.PRIORITY_ATTRIBUTE_SUFFIXES = [
6240
6332
  "fetch",
6241
6333
  "import",
6242
6334
  "url-param"
6243
- ], c.ATTRIBUTE_PLACEHOLDER_REGEX = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/, c.REACTIVE_FETCH_STATES = /* @__PURE__ */ new WeakMap(), c.REACTIVE_IMPORT_STATES = /* @__PURE__ */ new WeakMap(), c.DERIVE_SUBTREE_PROFILES = /* @__PURE__ */ new WeakMap(), c.EACH_UPDATE_STATES = /* @__PURE__ */ new WeakMap();
6244
- let x = c;
6245
- const J = class J {
6335
+ ], h.ATTRIBUTE_PLACEHOLDER_REGEX = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/, h.REACTIVE_FETCH_STATES = /* @__PURE__ */ new WeakMap(), h.REACTIVE_IMPORT_STATES = /* @__PURE__ */ new WeakMap(), h.DERIVE_SUBTREE_PROFILES = /* @__PURE__ */ new WeakMap(), h.EACH_UPDATE_STATES = /* @__PURE__ */ new WeakMap();
6336
+ let x = h;
6337
+ const X = class X {
6246
6338
  /**
6247
6339
  * コンストラクタ。
6248
6340
  *
@@ -6250,11 +6342,11 @@ const J = class J {
6250
6342
  */
6251
6343
  constructor(t = document) {
6252
6344
  this.customEventHandlers = /* @__PURE__ */ new Map(), this.onClick = (e) => this.delegate(e, "click"), this.onChange = (e) => this.delegate(e, "change"), this.onInput = (e) => this.delegate(e, "input"), this.onLoadCapture = (e) => this.delegate(e, "load"), this.onWindowLoad = () => {
6253
- const e = document.documentElement, r = T.get(e);
6345
+ const e = document.documentElement, r = w.get(e);
6254
6346
  r && new j(r, "load").run();
6255
6347
  }, this.onPopstate = (e) => {
6256
6348
  const r = e.state;
6257
- !r || r[J.HISTORY_STATE_KEY] !== !0 || location.reload();
6349
+ !r || r[X.HISTORY_STATE_KEY] !== !0 || location.reload();
6258
6350
  }, this.root = t;
6259
6351
  }
6260
6352
  /**
@@ -6306,7 +6398,7 @@ const J = class J {
6306
6398
  subscribeCustomEvent(t) {
6307
6399
  if (t === null || t === "")
6308
6400
  return;
6309
- if (J.BUILTIN_EVENT_NAMES.has(t)) {
6401
+ if (X.BUILTIN_EVENT_NAMES.has(t)) {
6310
6402
  m.warn(
6311
6403
  "[Haori]",
6312
6404
  `data-on="${t}" は組み込みイベントです。data-${t}-* を使用してください(data-on はカスタムイベント専用)。`
@@ -6329,7 +6421,7 @@ const J = class J {
6329
6421
  this.root.querySelectorAll(`[${this.onAttributeName}]`).forEach((i) => {
6330
6422
  if (i.getAttribute(this.onAttributeName) !== t)
6331
6423
  return;
6332
- const n = T.get(i);
6424
+ const n = w.get(i);
6333
6425
  n instanceof M && new j(n, "on", e).run().catch((s) => {
6334
6426
  m.error("[Haori]", "Procedure execution error:", s);
6335
6427
  });
@@ -6375,7 +6467,7 @@ const J = class J {
6375
6467
  return;
6376
6468
  }
6377
6469
  r.hasAttribute(`${l.prefix}${e}-prevent`) && t.preventDefault();
6378
- const i = T.get(r);
6470
+ const i = w.get(r);
6379
6471
  if (!i)
6380
6472
  return;
6381
6473
  (e === "change" || e === "input") && i instanceof M && i.syncValue();
@@ -6433,13 +6525,13 @@ const J = class J {
6433
6525
  return null;
6434
6526
  }
6435
6527
  };
6436
- J.HISTORY_STATE_KEY = "__haoriHistoryState__", J.BUILTIN_EVENT_NAMES = /* @__PURE__ */ new Set([
6528
+ X.HISTORY_STATE_KEY = "__haoriHistoryState__", X.BUILTIN_EVENT_NAMES = /* @__PURE__ */ new Set([
6437
6529
  "click",
6438
6530
  "change",
6439
6531
  "input",
6440
6532
  "load"
6441
6533
  ]);
6442
- let ht = J;
6534
+ let ht = X;
6443
6535
  const D = class D {
6444
6536
  /**
6445
6537
  * ノードが現在の Window に属する HTMLElement かどうかを判定します。
@@ -6459,7 +6551,7 @@ const D = class D {
6459
6551
  }));
6460
6552
  }
6461
6553
  static syncElement(t) {
6462
- const e = D.registrations.get(t), r = T.get(t);
6554
+ const e = D.registrations.get(t), r = w.get(t);
6463
6555
  if (!r || !D.shouldObserve(r)) {
6464
6556
  e && (e.observer.disconnect(), D.registrations.delete(t));
6465
6557
  return;
@@ -6477,10 +6569,10 @@ const D = class D {
6477
6569
  e && (e.observer.disconnect(), D.registrations.delete(t));
6478
6570
  const o = new IntersectionObserver(
6479
6571
  (u) => {
6480
- const d = D.registrations.get(t);
6481
- d && u.forEach((h) => {
6482
- !h.isIntersecting || d.running || D.isDisabled(d.fragment) || (d.running = !0, new j(d.fragment, "intersect").runWithResult().then((g) => {
6483
- g && d.once && (d.observer.disconnect(), D.registrations.delete(t));
6572
+ const c = D.registrations.get(t);
6573
+ c && u.forEach((d) => {
6574
+ !d.isIntersecting || c.running || D.isDisabled(c.fragment) || (c.running = !0, new j(c.fragment, "intersect").runWithResult().then((g) => {
6575
+ g && c.once && (c.observer.disconnect(), D.registrations.delete(t));
6484
6576
  }).catch((g) => {
6485
6577
  m.error(
6486
6578
  "[Haori]",
@@ -6567,7 +6659,7 @@ D.CONFIG_KEYS = /* @__PURE__ */ new Set([
6567
6659
  "disabled",
6568
6660
  "once"
6569
6661
  ]), D.registrations = /* @__PURE__ */ new Map();
6570
- let X = D;
6662
+ let J = D;
6571
6663
  const O = class O {
6572
6664
  /**
6573
6665
  * 既存の MutationObserver をすべて停止します。
@@ -6589,7 +6681,7 @@ const O = class O {
6589
6681
  x.scan(document.head),
6590
6682
  x.scan(document.body)
6591
6683
  ]), [e, r] = t;
6592
- e.status !== "fulfilled" && m.error("[Haori]", "Failed to build head fragment:", e.reason), r.status !== "fulfilled" && m.error("[Haori]", "Failed to build body fragment:", r.reason), await P.wait(), document.body.setAttribute("data-haori-ready", ""), O.observe(document.head), O.observe(document.body), new ht().start(), X.syncTree(document.body);
6684
+ e.status !== "fulfilled" && m.error("[Haori]", "Failed to build head fragment:", e.reason), r.status !== "fulfilled" && m.error("[Haori]", "Failed to build body fragment:", r.reason), await k.wait(), document.body.setAttribute("data-haori-ready", ""), O.observe(document.head), O.observe(document.body), new ht().start(), J.syncTree(document.body);
6593
6685
  }
6594
6686
  /**
6595
6687
  * 指定された要素を監視します。
@@ -6613,14 +6705,14 @@ const O = class O {
6613
6705
  i.attributeName,
6614
6706
  n.getAttribute(i.attributeName),
6615
6707
  !0
6616
- ), X.syncElement(n);
6708
+ ), J.syncElement(n);
6617
6709
  break;
6618
6710
  }
6619
6711
  case "childList": {
6620
6712
  Array.from(i.removedNodes).forEach((n) => {
6621
- X.cleanupTree(n), x.removeNode(n);
6713
+ J.cleanupTree(n), x.removeNode(n);
6622
6714
  }), Array.from(i.addedNodes).forEach((n) => {
6623
- n.parentElement instanceof Element && (x.addNode(n.parentElement, n), X.syncTree(n));
6715
+ n.parentElement instanceof Element && (x.addNode(n.parentElement, n), J.syncTree(n));
6624
6716
  });
6625
6717
  break;
6626
6718
  }
@@ -6651,15 +6743,15 @@ const O = class O {
6651
6743
  O._initialized = !1, O._mutationObservers = [];
6652
6744
  let it = O;
6653
6745
  document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", it.init) : it.init();
6654
- const Qt = () => Z.waitForRenders(), Zt = "0.17.2";
6746
+ const Qt = () => Z.waitForRenders(), Zt = "0.18.0";
6655
6747
  export {
6656
6748
  x as Core,
6657
6749
  l as Env,
6658
- y as Form,
6659
- T as Fragment,
6750
+ E as Form,
6751
+ w as Fragment,
6660
6752
  Z as Haori,
6661
6753
  m as Log,
6662
- P as Queue,
6754
+ k as Queue,
6663
6755
  Z as default,
6664
6756
  Zt as version,
6665
6757
  Qt as waitForRenders