haori-bootstrap 0.5.56 → 0.5.57

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/README.ja.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Haori.js Bootstrap は、Haori.js 向けの Bootstrap ベース UI 拡張ライブラリです。
4
4
 
5
- Version: 0.5.56
5
+ Version: 0.5.57
6
6
 
7
7
  ## 概要
8
8
 
@@ -41,9 +41,9 @@ npm install haori-bootstrap
41
41
  rel="stylesheet"
42
42
  href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css"
43
43
  />
44
- <script src="https://cdn.jsdelivr.net/npm/haori@0.58.0/dist/haori.iife.js"></script>
44
+ <script src="https://cdn.jsdelivr.net/npm/haori@0.59.0/dist/haori.iife.js"></script>
45
45
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js"></script>
46
- <script src="https://cdn.jsdelivr.net/npm/haori-bootstrap@0.5.56/dist/haori-bootstrap.iife.js"></script>
46
+ <script src="https://cdn.jsdelivr.net/npm/haori-bootstrap@0.5.57/dist/haori-bootstrap.iife.js"></script>
47
47
  ```
48
48
 
49
49
  IIFE 版は、window.Haori と window.bootstrap が利用可能な場合に自動で有効化されます。
@@ -76,7 +76,7 @@ install({
76
76
  | toast(message, level) | トースト通知 | Promise<void> |
77
77
  | openDialog(element) | 対象の Modal を開く(`.modal` 自身またはその子孫を渡す。非 `.modal` の場合は祖先方向で最も近い `.modal` に解決)。表示前に対象 Modal 配下の管理メッセージと `is-invalid` / `is-valid` 状態をクリアするため、再表示時はクリーンな状態で開く。 | Promise<void> |
78
78
  | closeDialog(element) | 対象の Modal を閉じる(`.modal` 自身またはその子孫を渡す。非 `.modal` の場合は祖先方向で最も近い `.modal` に解決)。表示アニメーション中に呼んだ場合は、表示完了を待ってから閉じる | Promise<void> |
79
- | addErrorMessage(target, message) | 管理対象エラーメッセージの追加 | Promise<void> |
79
+ | addErrorMessage(target, message) | 管理対象エラーメッセージの追加。入力欄・`button`・`a`・子要素を持てない要素(`img` など)には要素の直後へ、それ以外には要素の中の先頭へ出します。 | Promise<void> |
80
80
  | addMessage(target, message, level?) | レベル付き管理対象メッセージを追加(`'error'` \| `'success'` \| `'warning'` \| `'info'`)。再呼び出し時は Bootstrap 検証クラス(`is-invalid` / `is-valid`)も切り替わります。 | Promise<void> |
81
81
  | clearMessages(parentOrTarget) | 管理対象メッセージのみ削除 | Promise<void> |
82
82
  | install(options) | Bootstrap 対応 Haori を再適用し、runtime を含めて設定を上書き | void |
@@ -304,12 +304,12 @@ push 後に、そのタグから GitHub Release を published にします。公
304
304
  次回 patch リリースの例:
305
305
 
306
306
  ```bash
307
- # version が 0.5.57 になる
307
+ # version が 0.5.58 になる
308
308
  npm version patch
309
309
  git push origin main --follow-tags
310
310
  ```
311
311
 
312
- その後、push 済みタグの GitHub Release を作成して published にします。例として次回は `0.5.57` タグになります。
312
+ その後、push 済みタグの GitHub Release を作成して published にします。例として次回は `0.5.58` タグになります。
313
313
 
314
314
  自動公開:
315
315
 
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Haori.js Bootstrap is a Bootstrap-based UI extension library for Haori.js.
4
4
 
5
- Version: 0.5.56
5
+ Version: 0.5.57
6
6
 
7
7
  ## Overview
8
8
 
@@ -41,9 +41,9 @@ Load dependencies in this order for browser direct loading:
41
41
  rel="stylesheet"
42
42
  href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css"
43
43
  />
44
- <script src="https://cdn.jsdelivr.net/npm/haori@0.58.0/dist/haori.iife.js"></script>
44
+ <script src="https://cdn.jsdelivr.net/npm/haori@0.59.0/dist/haori.iife.js"></script>
45
45
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js"></script>
46
- <script src="https://cdn.jsdelivr.net/npm/haori-bootstrap@0.5.56/dist/haori-bootstrap.iife.js"></script>
46
+ <script src="https://cdn.jsdelivr.net/npm/haori-bootstrap@0.5.57/dist/haori-bootstrap.iife.js"></script>
47
47
  ```
48
48
 
49
49
  The IIFE build auto-enables when both window.Haori and window.bootstrap are available.
@@ -76,7 +76,7 @@ install({
76
76
  | toast(message, level) | Toast notification | Promise<void> |
77
77
  | openDialog(element) | Open the target's modal (pass the `.modal` itself or a descendant; a non-`.modal` element resolves to its nearest ancestor `.modal`). Managed messages and `is-invalid` / `is-valid` state under the modal are cleared before it is shown, so a reopened form starts clean. | Promise<void> |
78
78
  | closeDialog(element) | Close the target's modal (pass the `.modal` itself or a descendant; a non-`.modal` element resolves to its nearest ancestor `.modal`). When called during the show animation, it waits for the animation to finish and then closes | Promise<void> |
79
- | addErrorMessage(target, message) | Append managed error messages | Promise<void> |
79
+ | addErrorMessage(target, message) | Append managed error messages. Form controls, `button`, `a`, and elements that cannot have children (such as `img`) get them right after the element; other elements get them as their first child. | Promise<void> |
80
80
  | addMessage(target, message, level?) | Append a level-aware managed message (`'error'` \| `'success'` \| `'warning'` \| `'info'`). Switches Bootstrap validation classes (`is-invalid` / `is-valid`) on re-call. | Promise<void> |
81
81
  | clearMessages(parentOrTarget) | Remove only managed messages | Promise<void> |
82
82
  | install(options) | Re-apply Bootstrap-backed Haori with overridden options, including runtime | void |
@@ -301,15 +301,15 @@ git push origin main --follow-tags
301
301
 
302
302
  After pushing, publish a GitHub Release from the generated version tag. The release workflow then publishes the package and uploads `dist.zip` automatically.
303
303
 
304
- Example next patch release after `0.5.56`:
304
+ Example next patch release after `0.5.57`:
305
305
 
306
306
  ```bash
307
- # version becomes 0.5.57
307
+ # version becomes 0.5.58
308
308
  npm version patch
309
309
  git push origin main --follow-tags
310
310
  ```
311
311
 
312
- Create and publish the GitHub Release for the pushed tag such as `0.5.57`.
312
+ Create and publish the GitHub Release for the pushed tag such as `0.5.58`.
313
313
 
314
314
  Release automation:
315
315
 
@@ -1,3 +1,3 @@
1
- var HaoriBootstrap=(function(E){"use strict";function X(e){return typeof e=="function"}function Q(e){return X(e?.Modal)?e?.Modal:void 0}function Y(e){return X(e?.Toast)?e?.Toast:void 0}function N(e){return!!Q(e)}function Oe(e){return!!Y(e)}function H(e,n,t){const o=Q(t);if(o)return typeof o.getOrCreateInstance=="function"?o.getOrCreateInstance(e,n):new o(e,n)}function xe(e,n,t){const o=Y(t);if(o)return typeof o.getOrCreateInstance=="function"?o.getOrCreateInstance(e,n):new o(e,n)}const qe="data-haori-dialog",$e="data-haori-confirm",Ue="data-haori-dialog-title",Z="data-haori-dialog-ok",ee="data-haori-confirm-ok",te="data-haori-confirm-cancel",Fe="OK",We="Cancel";let ze=0;function ne(){return{backdrop:"static",keyboard:!1}}function oe(e,n){if(n.dialogContainerSelector){const t=e.querySelector(n.dialogContainerSelector);if(t)return t}return e.body}function re(e,n,t,o){const r=o.dialogTitle,s=e.createElement("div");s.className="modal fade",s.tabIndex=-1,s.setAttribute(t?$e:qe,"true"),s.setAttribute("aria-hidden","true");const c=e.createElement("div");c.className="modal-dialog modal-dialog-centered";const a=e.createElement("div");if(a.className="modal-content",r){const b=`haori-dialog-title-${++ze}`,I=e.createElement("div");I.className="modal-header";const A=e.createElement("h5");A.className="modal-title",A.id=b,A.setAttribute(Ue,"true"),A.textContent=r,I.appendChild(A),a.appendChild(I),s.setAttribute("aria-labelledby",b)}const f=e.createElement("div");f.className="modal-body";const l=e.createElement("p");l.className="mb-0",l.style.whiteSpace="pre-line",l.textContent=n,f.appendChild(l);const m=e.createElement("div");if(m.className="modal-footer",t){const b=e.createElement("button");b.type="button",b.className="btn btn-secondary",b.setAttribute(te,"true"),b.textContent=o.dialogCancelLabel??We,m.appendChild(b)}const d=e.createElement("button");return d.type="button",d.className="btn btn-primary",d.setAttribute(t?ee:Z,"true"),d.textContent=o.dialogOkLabel??Fe,m.appendChild(d),a.append(f,m),c.appendChild(a),s.appendChild(c),s}function se(e){let n=!1,t=!1;return{requestClose:o=>{n||(n=!0,o?.(),t&&e.hide())},handleShown:()=>{t=!0,n&&e.hide()}}}function Ge(e,n){const t=globalThis.document,o=re(t,e,!1,n);oe(t,n).appendChild(o);const r=H(o,ne(),n.bootstrap);return r?new Promise((s,c)=>{const a=()=>{o.removeEventListener("shown.bs.modal",m),o.removeEventListener("hidden.bs.modal",f),o.remove(),r.dispose?.(),s()},f=()=>{a()},l=se(r),m=l.handleShown;o.querySelector(`[${Z}]`)?.addEventListener("click",()=>{l.requestClose()}),o.addEventListener("shown.bs.modal",m),o.addEventListener("hidden.bs.modal",f,{once:!0});try{r.show()}catch(b){o.removeEventListener("shown.bs.modal",m),o.removeEventListener("hidden.bs.modal",f),o.remove(),r.dispose?.(),c(b)}}):(o.remove(),Promise.reject(new Error("Bootstrap Modal is unavailable.")))}function Ke(e,n){const t=globalThis.document,o=re(t,e,!0,n);oe(t,n).appendChild(o);const r=H(o,ne(),n.bootstrap);return r?new Promise((s,c)=>{let a=!1;const f=()=>{o.removeEventListener("shown.bs.modal",d),o.removeEventListener("hidden.bs.modal",l),o.remove(),r.dispose?.(),s(a)},l=()=>{f()},m=se(r),d=m.handleShown,b=o.querySelector(`[${ee}]`),I=o.querySelector(`[${te}]`);b?.addEventListener("click",()=>{m.requestClose(()=>{a=!0})}),I?.addEventListener("click",()=>{m.requestClose(()=>{a=!1})}),o.addEventListener("shown.bs.modal",d),o.addEventListener("hidden.bs.modal",l,{once:!0});try{r.show()}catch(A){o.removeEventListener("shown.bs.modal",d),o.removeEventListener("hidden.bs.modal",l),o.remove(),r.dispose?.(),c(A)}}):(o.remove(),Promise.reject(new Error("Bootstrap Modal is unavailable.")))}const v="data-haori-owned",h="data-haori-message-container",C="data-haori-invalid-target",L="data-haori-valid-target";function S(e){return e instanceof HTMLInputElement&&(e.type==="checkbox"||e.type==="radio")}function p(e){return e instanceof HTMLInputElement&&e.type==="radio"}function M(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement}function k(e){return Array.from(e.children).find(n=>n instanceof HTMLElement&&n.getAttribute(h)==="true")}function ie(e,n){const t=e.createElement("div");return t.setAttribute(v,"true"),t.textContent=n,t}function ae(e){return k(e)}function y(e){if(e.name){const n=e.form??e.ownerDocument,t=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e.name):e.name.replace(/(["\\])/g,"\\$1"),o=Array.from(n.querySelectorAll(`input[type="radio"][name="${t}"]`));if(o.length>0)return o}return[e]}function Ve(e){const[n,...t]=e;if(!n)return;let o=n;for(;o;){if(t.every(r=>o?.contains(r)))return o;o=o.parentElement}}function U(e){const t=y(e).map(o=>o.closest(".form-check")).filter(o=>o instanceof HTMLElement);if(t.length>1){const o=Ve(t);if(o&&!t.includes(o))return o}return R(e)}function R(e){const n=e.closest(".form-check");return n instanceof HTMLElement?n:void 0}function le(e){const n=e.nextElementSibling;if(n instanceof HTMLElement&&n.getAttribute(h)==="true")return n;const t=document.createElement("div");return t.className="invalid-feedback d-block",t.setAttribute(v,"true"),t.setAttribute(h,"true"),e.insertAdjacentElement("afterend",t),t}function je(e){const n=p(e)?U(e):R(e);if(!n)return le(e);const t=k(n);if(t)return t;const o=document.createElement("div");return o.className="invalid-feedback d-block",o.setAttribute(v,"true"),o.setAttribute(h,"true"),n.appendChild(o),o}function Je(e){const n=ae(e);if(n)return n;const t=document.createElement("div");return t.className="alert alert-danger",t.setAttribute("role","alert"),t.setAttribute(v,"true"),t.setAttribute(h,"true"),e.insertAdjacentElement("afterbegin",t),t}function g(e){e.getAttribute(C)==="true"&&(e.classList.remove("is-invalid"),e.removeAttribute(C))}function T(e){e.getAttribute(L)==="true"&&(e.classList.remove("is-valid"),e.removeAttribute(L))}function ce(e){switch(e){case"success":return"alert alert-success";case"warning":return"alert alert-warning";case"info":return"alert alert-info";default:return"alert alert-danger"}}function _(e){return e==="success"?"valid-feedback d-block":"invalid-feedback d-block"}function de(e){(p(e)?y(e):[e]).forEach(t=>{t.classList.add("is-invalid"),t.setAttribute(C,"true")})}function Xe(e){(p(e)?y(e):[e]).forEach(t=>{g(t)})}function ue(e,n){const t=e.nextElementSibling;if(t instanceof HTMLElement&&t.getAttribute(h)==="true")return t.className=_(n),t;const o=document.createElement("div");return o.className=_(n),o.setAttribute(v,"true"),o.setAttribute(h,"true"),e.insertAdjacentElement("afterend",o),o}function Qe(e,n){const t=p(e)?U(e):R(e);if(!t)return ue(e,n);const o=k(t);if(o)return o.className=_(n),o;const r=document.createElement("div");return r.className=_(n),r.setAttribute(v,"true"),r.setAttribute(h,"true"),t.appendChild(r),r}function Ye(e,n){const t=ae(e);if(t)return t.className=ce(n),t;const o=document.createElement("div");return o.className=ce(n),o.setAttribute("role","alert"),o.setAttribute(v,"true"),o.setAttribute(h,"true"),e.insertAdjacentElement("afterbegin",o),o}function Ze(e,n){return(S(e)?je(e):M(e)?le(e):Je(e)).appendChild(ie(document,n)),S(e)?de(e):M(e)&&(e.classList.add("is-invalid"),e.setAttribute(C,"true")),Promise.resolve()}function et(e,n,t){if((S(e)?Qe(e,t):M(e)?ue(e,t):Ye(e,t)).appendChild(ie(document,n)),S(e)){const r=p(e)?y(e):[e];t==="success"?r.forEach(s=>{g(s),s.classList.add("is-valid"),s.setAttribute(L,"true")}):!t||t==="error"?(r.forEach(s=>T(s)),de(e)):r.forEach(s=>{T(s),g(s)})}else M(e)&&(t==="success"?(g(e),e.classList.add("is-valid"),e.setAttribute(L,"true")):!t||t==="error"?(T(e),e.classList.add("is-invalid"),e.setAttribute(C,"true")):(T(e),g(e)));return Promise.resolve()}function fe(e){if(S(e)){const r=p(e)?U(e):R(e);(r?k(r):void 0)?.remove(),Xe(e),(p(e)?y(e):[e]).forEach(a=>T(a))}else if(M(e)){const r=e.nextElementSibling;r instanceof HTMLElement&&r.getAttribute(h)==="true"&&r.remove(),g(e),T(e)}return e.querySelectorAll(`[${h}="true"]`).forEach(r=>{r.remove()}),e.querySelectorAll(`[${C}="true"]`).forEach(r=>{g(r)}),e.querySelectorAll(`[${L}="true"]`).forEach(r=>{T(r)}),Promise.resolve()}const F=new WeakSet,tt="data-haori-dismiss-lock",W=new WeakSet;let B=!1,z;const me=e=>{e.target instanceof HTMLElement&&F.add(e.target)},be=e=>{e.target instanceof HTMLElement&&F.delete(e.target)},he=e=>{const n=e.target;n instanceof HTMLElement&&n.hasAttribute(tt)&&!W.has(n)&&e.preventDefault()};function Ee(e,n){W.add(e);try{n.hide()}finally{W.delete(e)}}function nt(e=document){B||(B=!0,z=e,e.addEventListener("show.bs.modal",me),e.addEventListener("shown.bs.modal",be),e.addEventListener("hide.bs.modal",he))}function ot(e=z??document){B&&(B=!1,e.removeEventListener("show.bs.modal",me),e.removeEventListener("shown.bs.modal",be),e.removeEventListener("hide.bs.modal",he),z=void 0)}function ve(e){return e.classList.contains("modal")?e:e.closest(".modal")}function pe(e){e.tabIndex<0&&(e.tabIndex=-1),e.hasAttribute("aria-hidden")||e.setAttribute("aria-hidden","true")}function rt(e,n){const t=ve(e);if(!t)return Promise.reject(new Error('No ancestor ".modal" element was found for the target.'));pe(t),fe(t);const o=H(t,void 0,n.bootstrap);return o?(o.show(),Promise.resolve()):Promise.reject(new Error("Bootstrap Modal is unavailable."))}function st(e,n){const t=ve(e);if(!t)return Promise.reject(new Error('No ancestor ".modal" element was found for the target.'));pe(t);const o=H(t,void 0,n.bootstrap);return o?F.has(t)?(t.addEventListener("shown.bs.modal",()=>{Ee(t,o)},{once:!0}),Promise.resolve()):(Ee(t,o),Promise.resolve()):Promise.reject(new Error("Bootstrap Modal is unavailable."))}const ge="data-haori-toast-container",it="data-haori-toast",at="data-haori-toast-level",lt="data-haori-toast-accent",ct="data-haori-toast-dismiss",Te={"top-start":"top-0 start-0","top-center":"top-0 start-50 translate-middle-x","top-end":"top-0 end-0","bottom-start":"bottom-0 start-0","bottom-center":"bottom-0 start-50 translate-middle-x","bottom-end":"bottom-0 end-0"};function dt(e){switch(e){case"success":return{accentClassName:"bg-success",level:"success"};case"warning":return{accentClassName:"bg-warning",level:"warning"};case"error":return{accentClassName:"bg-danger",level:"error"};default:return{accentClassName:"bg-info",level:"info"}}}function ut(e,n){if(n.toastContainerSelector){const t=e.querySelector(n.toastContainerSelector);if(t)return t}return e.body}function ft(e,n){const t=ut(e,n),o=Te[n.toastPosition??"bottom-end"],r=t.querySelector(`[${ge}="true"]`);if(r){const c=Object.values(Te).flatMap(a=>a.split(" "));return r.classList.remove(...c),r.classList.add(...o.split(" ")),r}const s=e.createElement("div");return s.className=`toast-container position-fixed ${o} p-3`,s.setAttribute(ge,"true"),t.appendChild(s),s}function mt(e,n,t){const o=globalThis.document,r=dt(n),s=o.createElement("div");s.className="toast border bg-body text-body shadow-sm",s.setAttribute("role","status"),s.setAttribute("aria-live","polite"),s.setAttribute("aria-atomic","true"),s.setAttribute(it,"true"),s.setAttribute(at,r.level);const c=o.createElement("div");c.className="d-flex align-items-stretch";const a=o.createElement("div");a.className=`flex-shrink-0 rounded-start ${r.accentClassName}`,a.style.width="0.375rem",a.setAttribute(lt,"true");const f=o.createElement("div");f.className="toast-body",f.style.whiteSpace="pre-line",f.textContent=e;const l=o.createElement("button");l.type="button",l.className="btn-close me-2 m-auto flex-shrink-0",l.setAttribute("aria-label","Close"),l.setAttribute(ct,"true"),c.appendChild(a),c.appendChild(f),c.appendChild(l),s.appendChild(c),ft(o,t).appendChild(s);const m=t.toastDelay!==void 0?{delay:t.toastDelay}:void 0,d=xe(s,m,t.bootstrap);if(!d)return s.remove(),Promise.reject(new Error("Bootstrap Toast is unavailable."));l.addEventListener("click",()=>{d.hide?.()}),s.addEventListener("hidden.bs.toast",()=>{s.remove(),d.dispose?.()},{once:!0});try{return d.show(),Promise.resolve()}catch(b){return s.remove(),d.dispose?.(),Promise.reject(b)}}let u={options:{fallbackToNative:!0}};function w(e){return e?String(e).replace(/\\n/g,`
2
- `):""}function Ae(){return globalThis.window}function G(e){return Promise.resolve(e).then(()=>{})}function D(e){const n=u.originalHaori?.[e];return typeof n=="function"?n:void 0}function P(e){console.warn(`[haori-bootstrap] ${e} skipped because Bootstrap support is unavailable.`)}function Ce(e){const n=w(e),t=D("dialog");if(t)return G(t(n));const o=Ae();return u.options.fallbackToNative&&typeof o?.alert=="function"?(o.alert(n),Promise.resolve()):(P("dialog"),Promise.resolve())}function we(e){const n=w(e),t=D("confirm");if(t)return Promise.resolve(t(n)).then(r=>!!r);const o=Ae();return u.options.fallbackToNative&&typeof o?.confirm=="function"?Promise.resolve(o.confirm(n)):(P("confirm"),Promise.resolve(!1))}function Le(e,n){const t=w(e),o=D("toast");return o?G(o(t,n)):(P("toast"),Promise.resolve())}function O(e,n){const t=D(e);return t?G(t(n)):(P(e),Promise.resolve())}function bt(e){u=e}class Se{static dialog(n){const t=w(n);return N(u.options.bootstrap)?Ge(t,u.options).catch(()=>Ce(t)):Ce(t)}static confirm(n){const t=w(n);return N(u.options.bootstrap)?Ke(t,u.options).catch(()=>we(t)):we(t)}static toast(n,t){const o=w(n);return Oe(u.options.bootstrap)?mt(o,t,u.options).catch(()=>Le(o,t)):Le(o,t)}static openDialog(n){return N(u.options.bootstrap)?rt(n,u.options).catch(()=>O("openDialog",n)):O("openDialog",n)}static closeDialog(n){return N(u.options.bootstrap)?st(n,u.options).catch(()=>O("closeDialog",n)):O("closeDialog",n)}static addErrorMessage(n,t){return Ze(n,t)}static addMessage(n,t,o){return et(n,t,o)}static clearMessages(n){return fe(n)}}const ht="haori-bootstrap:collapse:",x="data-haori-persist";let q=!1,$,K;function Me(e){return ht+e}function Et(e){try{const n=window.sessionStorage.getItem(Me(e));return n==="shown"||n==="hidden"?n:void 0}catch{return}}function vt(e,n){try{window.sessionStorage.setItem(Me(e),n)}catch{}}function ye(e,n){const t=e.id,o=[`[data-bs-toggle="collapse"][data-bs-target="#${t}"]`];if(t&&o.push(`[data-bs-toggle="collapse"][href="#${t}"]`),!t)return;e.ownerDocument.querySelectorAll(o.join(",")).forEach(s=>{s.setAttribute("aria-expanded",n?"true":"false"),s.classList.toggle("collapsed",!n)})}function Ie(e){const n=e.getAttribute(x);if(!n)return;const t=Et(n);if(!t)return;const o=e.classList.contains("show");t==="shown"&&!o?(e.classList.add("show"),ye(e,!0)):t==="hidden"&&o&&(e.classList.remove("show"),ye(e,!1))}function Ne(e){e instanceof HTMLElement&&e.hasAttribute(x)&&Ie(e),e.querySelectorAll(`[${x}]`).forEach(Ie)}function He(e,n){const t=e.target;if(!(t instanceof HTMLElement))return;const o=t.getAttribute(x);o&&vt(o,n)}const ke=e=>He(e,"shown"),Re=e=>He(e,"hidden");function pt(e=document){if(q)return;q=!0,K=e,e.addEventListener("shown.bs.collapse",ke),e.addEventListener("hidden.bs.collapse",Re);const n=()=>{Ne(e),$=new MutationObserver(t=>{for(const o of t)o.addedNodes.forEach(r=>{r instanceof HTMLElement&&Ne(r)})}),e.body&&$.observe(e.body,{childList:!0,subtree:!0})};e.body?n():e.addEventListener("DOMContentLoaded",n,{once:!0})}function gt(e=K??document){q&&(q=!1,e.removeEventListener("shown.bs.collapse",ke),e.removeEventListener("hidden.bs.collapse",Re),$?.disconnect(),$=void 0,K=void 0)}const Tt=[{attribute:"dialog-ok-label",apply:(e,n)=>{e.dialogOkLabel=n}},{attribute:"dialog-cancel-label",apply:(e,n)=>{e.dialogCancelLabel=n}}],At=typeof document<"u"&&document.currentScript instanceof HTMLScriptElement?document.currentScript:null;function V(e,n){const t=e?.getAttribute(n)??null;if(!(t===null||t.trim()===""))return t}function Ct(e=typeof document>"u"?null:document,n=At){const t={};for(const{attribute:o,apply:r}of Tt){const s=V(n,`data-${o}`)??V(e?.documentElement??null,`data-haori-${o}`)??V(e?.body??null,`data-haori-${o}`);s!==void 0&&r(t,s)}return t}const j={fallbackToNative:!0},_e=new Set(["dialog","confirm","toast","openDialog","closeDialog","addErrorMessage","addMessage","clearMessages"]);function wt(e){const n=Se;return new Proxy(e,{get(t,o,r){return typeof o=="string"&&_e.has(o)?n[o]:Reflect.get(t,o,r)},has(t,o){return typeof o=="string"&&_e.has(o)?!0:Reflect.has(t,o)}})}const i={installed:!1,options:j};function J(){return globalThis.window}function Lt(e,n){const t=Ct();return{bootstrap:e.bootstrap??n?.bootstrap,fallbackToNative:e.fallbackToNative??j.fallbackToNative,runtime:e.runtime??i.options.runtime??n?.Haori?.runtime,toastContainerSelector:e.toastContainerSelector??i.options.toastContainerSelector,dialogContainerSelector:e.dialogContainerSelector??i.options.dialogContainerSelector,dialogTitle:e.dialogTitle??i.options.dialogTitle,dialogOkLabel:e.dialogOkLabel??i.options.dialogOkLabel??t.dialogOkLabel,dialogCancelLabel:e.dialogCancelLabel??i.options.dialogCancelLabel??t.dialogCancelLabel,toastPosition:e.toastPosition??i.options.toastPosition,toastDelay:e.toastDelay??i.options.toastDelay}}function Be(e=J()){return!!(e?.Haori&&e.bootstrap)}function De(e={}){const n=J();if(!n?.Haori)throw new Error("window.Haori is required before calling install().");if(i.originalHaori||(i.originalHaori=n.Haori,i.originalRuntime=n.Haori.runtime),i.options=Lt(e,n),i.options.runtime){const t=i.originalHaori??n.Haori;typeof t.setRuntime=="function"?t.setRuntime(i.options.runtime):console.warn("[haori-bootstrap] Haori.setRuntime が利用できません。runtime 設定は無視されます。")}bt({originalHaori:i.originalHaori,options:i.options}),n.Haori=wt(i.originalHaori),pt(),nt(),i.installed=!0}function St(){const e=J();if(!e||!i.originalHaori)return;const n=i.originalHaori;typeof n.setRuntime=="function"?n.setRuntime(i.originalRuntime):n.runtime=i.originalRuntime,e.Haori=i.originalHaori,gt(),ot(),i.installed=!1,i.originalHaori=void 0,i.originalRuntime=void 0,i.options=j}function Mt(){return i.installed}const Pe="__haoriJsBootstrapAutoEnabled__";function yt(){return globalThis.window}function It(e){return!!e[Pe]}function Nt(e){e[Pe]=!0}function Ht(){const e=yt();if(!(!e||It(e))){if(!Be(e)){console.warn("[haori-bootstrap] Auto-enable skipped because window.Haori or window.bootstrap is missing.");return}try{De({bootstrap:e.bootstrap}),Nt(e)}catch(n){console.warn("[haori-bootstrap] Auto-enable failed.",n)}}}Ht();const kt="0.5.56";return E.BootstrapHaori=Se,E.hasAutoEnablePrerequisites=Be,E.install=De,E.isInstalled=Mt,E.uninstall=St,E.version=kt,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"}),E})({});
1
+ var HaoriBootstrap=(function(E){"use strict";function Q(e){return typeof e=="function"}function Y(e){return Q(e?.Modal)?e?.Modal:void 0}function Z(e){return Q(e?.Toast)?e?.Toast:void 0}function N(e){return!!Y(e)}function $e(e){return!!Z(e)}function k(e,t,n){const o=Y(n);if(o)return typeof o.getOrCreateInstance=="function"?o.getOrCreateInstance(e,t):new o(e,t)}function Ue(e,t,n){const o=Z(n);if(o)return typeof o.getOrCreateInstance=="function"?o.getOrCreateInstance(e,t):new o(e,t)}const Fe="data-haori-dialog",We="data-haori-confirm",ze="data-haori-dialog-title",ee="data-haori-dialog-ok",te="data-haori-confirm-ok",ne="data-haori-confirm-cancel",Ge="OK",Ke="Cancel";let Ve=0;function oe(){return{backdrop:"static",keyboard:!1}}function re(e,t){if(t.dialogContainerSelector){const n=e.querySelector(t.dialogContainerSelector);if(n)return n}return e.body}function ie(e,t,n,o){const r=o.dialogTitle,i=e.createElement("div");i.className="modal fade",i.tabIndex=-1,i.setAttribute(n?We:Fe,"true"),i.setAttribute("aria-hidden","true");const c=e.createElement("div");c.className="modal-dialog modal-dialog-centered";const a=e.createElement("div");if(a.className="modal-content",r){const b=`haori-dialog-title-${++Ve}`,I=e.createElement("div");I.className="modal-header";const g=e.createElement("h5");g.className="modal-title",g.id=b,g.setAttribute(ze,"true"),g.textContent=r,I.appendChild(g),a.appendChild(I),i.setAttribute("aria-labelledby",b)}const f=e.createElement("div");f.className="modal-body";const l=e.createElement("p");l.className="mb-0",l.style.whiteSpace="pre-line",l.textContent=t,f.appendChild(l);const m=e.createElement("div");if(m.className="modal-footer",n){const b=e.createElement("button");b.type="button",b.className="btn btn-secondary",b.setAttribute(ne,"true"),b.textContent=o.dialogCancelLabel??Ke,m.appendChild(b)}const d=e.createElement("button");return d.type="button",d.className="btn btn-primary",d.setAttribute(n?te:ee,"true"),d.textContent=o.dialogOkLabel??Ge,m.appendChild(d),a.append(f,m),c.appendChild(a),i.appendChild(c),i}function se(e){let t=!1,n=!1;return{requestClose:o=>{t||(t=!0,o?.(),n&&e.hide())},handleShown:()=>{n=!0,t&&e.hide()}}}function je(e,t){const n=globalThis.document,o=ie(n,e,!1,t);re(n,t).appendChild(o);const r=k(o,oe(),t.bootstrap);return r?new Promise((i,c)=>{const a=()=>{o.removeEventListener("shown.bs.modal",m),o.removeEventListener("hidden.bs.modal",f),o.remove(),r.dispose?.(),i()},f=()=>{a()},l=se(r),m=l.handleShown;o.querySelector(`[${ee}]`)?.addEventListener("click",()=>{l.requestClose()}),o.addEventListener("shown.bs.modal",m),o.addEventListener("hidden.bs.modal",f,{once:!0});try{r.show()}catch(b){o.removeEventListener("shown.bs.modal",m),o.removeEventListener("hidden.bs.modal",f),o.remove(),r.dispose?.(),c(b)}}):(o.remove(),Promise.reject(new Error("Bootstrap Modal is unavailable.")))}function Je(e,t){const n=globalThis.document,o=ie(n,e,!0,t);re(n,t).appendChild(o);const r=k(o,oe(),t.bootstrap);return r?new Promise((i,c)=>{let a=!1;const f=()=>{o.removeEventListener("shown.bs.modal",d),o.removeEventListener("hidden.bs.modal",l),o.remove(),r.dispose?.(),i(a)},l=()=>{f()},m=se(r),d=m.handleShown,b=o.querySelector(`[${te}]`),I=o.querySelector(`[${ne}]`);b?.addEventListener("click",()=>{m.requestClose(()=>{a=!0})}),I?.addEventListener("click",()=>{m.requestClose(()=>{a=!1})}),o.addEventListener("shown.bs.modal",d),o.addEventListener("hidden.bs.modal",l,{once:!0});try{r.show()}catch(g){o.removeEventListener("shown.bs.modal",d),o.removeEventListener("hidden.bs.modal",l),o.remove(),r.dispose?.(),c(g)}}):(o.remove(),Promise.reject(new Error("Bootstrap Modal is unavailable.")))}const v="data-haori-owned",h="data-haori-message-container",C="data-haori-invalid-target",L="data-haori-valid-target",Xe=new Set(["button","a","area","br","col","embed","hr","img","source","track","wbr"]);function S(e){return e instanceof HTMLInputElement&&(e.type==="checkbox"||e.type==="radio")}function p(e){return e instanceof HTMLInputElement&&e.type==="radio"}function M(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement}function U(e){return Xe.has(e.localName)}function ae(e){const t=e.nextElementSibling;return t instanceof HTMLElement&&t.getAttribute(h)==="true"?t:void 0}function H(e){return Array.from(e.children).find(t=>t instanceof HTMLElement&&t.getAttribute(h)==="true")}function le(e,t){const n=e.createElement("div");return n.setAttribute(v,"true"),n.textContent=t,n}function ce(e){return U(e)?ae(e):H(e)}function de(e,t){e.insertAdjacentElement(U(e)?"afterend":"afterbegin",t)}function y(e){if(e.name){const t=e.form??e.ownerDocument,n=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e.name):e.name.replace(/(["\\])/g,"\\$1"),o=Array.from(t.querySelectorAll(`input[type="radio"][name="${n}"]`));if(o.length>0)return o}return[e]}function Qe(e){const[t,...n]=e;if(!t)return;let o=t;for(;o;){if(n.every(r=>o?.contains(r)))return o;o=o.parentElement}}function F(e){const n=y(e).map(o=>o.closest(".form-check")).filter(o=>o instanceof HTMLElement);if(n.length>1){const o=Qe(n);if(o&&!n.includes(o))return o}return R(e)}function R(e){const t=e.closest(".form-check");return t instanceof HTMLElement?t:void 0}function ue(e){const t=e.nextElementSibling;if(t instanceof HTMLElement&&t.getAttribute(h)==="true")return t;const n=document.createElement("div");return n.className="invalid-feedback d-block",n.setAttribute(v,"true"),n.setAttribute(h,"true"),e.insertAdjacentElement("afterend",n),n}function Ye(e){const t=p(e)?F(e):R(e);if(!t)return ue(e);const n=H(t);if(n)return n;const o=document.createElement("div");return o.className="invalid-feedback d-block",o.setAttribute(v,"true"),o.setAttribute(h,"true"),t.appendChild(o),o}function Ze(e){const t=ce(e);if(t)return t;const n=document.createElement("div");return n.className="alert alert-danger",n.setAttribute("role","alert"),n.setAttribute(v,"true"),n.setAttribute(h,"true"),de(e,n),n}function T(e){e.getAttribute(C)==="true"&&(e.classList.remove("is-invalid"),e.removeAttribute(C))}function A(e){e.getAttribute(L)==="true"&&(e.classList.remove("is-valid"),e.removeAttribute(L))}function fe(e){switch(e){case"success":return"alert alert-success";case"warning":return"alert alert-warning";case"info":return"alert alert-info";default:return"alert alert-danger"}}function _(e){return e==="success"?"valid-feedback d-block":"invalid-feedback d-block"}function me(e){(p(e)?y(e):[e]).forEach(n=>{n.classList.add("is-invalid"),n.setAttribute(C,"true")})}function et(e){(p(e)?y(e):[e]).forEach(n=>{T(n)})}function be(e,t){const n=e.nextElementSibling;if(n instanceof HTMLElement&&n.getAttribute(h)==="true")return n.className=_(t),n;const o=document.createElement("div");return o.className=_(t),o.setAttribute(v,"true"),o.setAttribute(h,"true"),e.insertAdjacentElement("afterend",o),o}function tt(e,t){const n=p(e)?F(e):R(e);if(!n)return be(e,t);const o=H(n);if(o)return o.className=_(t),o;const r=document.createElement("div");return r.className=_(t),r.setAttribute(v,"true"),r.setAttribute(h,"true"),n.appendChild(r),r}function nt(e,t){const n=ce(e);if(n)return n.className=fe(t),n;const o=document.createElement("div");return o.className=fe(t),o.setAttribute("role","alert"),o.setAttribute(v,"true"),o.setAttribute(h,"true"),de(e,o),o}function ot(e,t){return(S(e)?Ye(e):M(e)?ue(e):Ze(e)).appendChild(le(document,t)),S(e)?me(e):M(e)&&(e.classList.add("is-invalid"),e.setAttribute(C,"true")),Promise.resolve()}function rt(e,t,n){if((S(e)?tt(e,n):M(e)?be(e,n):nt(e,n)).appendChild(le(document,t)),S(e)){const r=p(e)?y(e):[e];n==="success"?r.forEach(i=>{T(i),i.classList.add("is-valid"),i.setAttribute(L,"true")}):!n||n==="error"?(r.forEach(i=>A(i)),me(e)):r.forEach(i=>{A(i),T(i)})}else M(e)&&(n==="success"?(T(e),e.classList.add("is-valid"),e.setAttribute(L,"true")):!n||n==="error"?(A(e),e.classList.add("is-invalid"),e.setAttribute(C,"true")):(A(e),T(e)));return Promise.resolve()}function he(e){if(S(e)){const r=p(e)?F(e):R(e);(r?H(r):void 0)?.remove(),et(e),(p(e)?y(e):[e]).forEach(a=>A(a))}else if(M(e)){const r=e.nextElementSibling;r instanceof HTMLElement&&r.getAttribute(h)==="true"&&r.remove(),T(e),A(e)}else U(e)&&ae(e)?.remove();return e.querySelectorAll(`[${h}="true"]`).forEach(r=>{r.remove()}),e.querySelectorAll(`[${C}="true"]`).forEach(r=>{T(r)}),e.querySelectorAll(`[${L}="true"]`).forEach(r=>{A(r)}),Promise.resolve()}const W=new WeakSet,it="data-haori-dismiss-lock",z=new WeakSet;let B=!1,G;const Ee=e=>{e.target instanceof HTMLElement&&W.add(e.target)},ve=e=>{e.target instanceof HTMLElement&&W.delete(e.target)},pe=e=>{const t=e.target;t instanceof HTMLElement&&t.hasAttribute(it)&&!z.has(t)&&e.preventDefault()};function Te(e,t){z.add(e);try{t.hide()}finally{z.delete(e)}}function st(e=document){B||(B=!0,G=e,e.addEventListener("show.bs.modal",Ee),e.addEventListener("shown.bs.modal",ve),e.addEventListener("hide.bs.modal",pe))}function at(e=G??document){B&&(B=!1,e.removeEventListener("show.bs.modal",Ee),e.removeEventListener("shown.bs.modal",ve),e.removeEventListener("hide.bs.modal",pe),G=void 0)}function Ae(e){return e.classList.contains("modal")?e:e.closest(".modal")}function ge(e){e.tabIndex<0&&(e.tabIndex=-1),e.hasAttribute("aria-hidden")||e.setAttribute("aria-hidden","true")}function lt(e,t){const n=Ae(e);if(!n)return Promise.reject(new Error('No ancestor ".modal" element was found for the target.'));ge(n),he(n);const o=k(n,void 0,t.bootstrap);return o?(o.show(),Promise.resolve()):Promise.reject(new Error("Bootstrap Modal is unavailable."))}function ct(e,t){const n=Ae(e);if(!n)return Promise.reject(new Error('No ancestor ".modal" element was found for the target.'));ge(n);const o=k(n,void 0,t.bootstrap);return o?W.has(n)?(n.addEventListener("shown.bs.modal",()=>{Te(n,o)},{once:!0}),Promise.resolve()):(Te(n,o),Promise.resolve()):Promise.reject(new Error("Bootstrap Modal is unavailable."))}const Ce="data-haori-toast-container",dt="data-haori-toast",ut="data-haori-toast-level",ft="data-haori-toast-accent",mt="data-haori-toast-dismiss",we={"top-start":"top-0 start-0","top-center":"top-0 start-50 translate-middle-x","top-end":"top-0 end-0","bottom-start":"bottom-0 start-0","bottom-center":"bottom-0 start-50 translate-middle-x","bottom-end":"bottom-0 end-0"};function bt(e){switch(e){case"success":return{accentClassName:"bg-success",level:"success"};case"warning":return{accentClassName:"bg-warning",level:"warning"};case"error":return{accentClassName:"bg-danger",level:"error"};default:return{accentClassName:"bg-info",level:"info"}}}function ht(e,t){if(t.toastContainerSelector){const n=e.querySelector(t.toastContainerSelector);if(n)return n}return e.body}function Et(e,t){const n=ht(e,t),o=we[t.toastPosition??"bottom-end"],r=n.querySelector(`[${Ce}="true"]`);if(r){const c=Object.values(we).flatMap(a=>a.split(" "));return r.classList.remove(...c),r.classList.add(...o.split(" ")),r}const i=e.createElement("div");return i.className=`toast-container position-fixed ${o} p-3`,i.setAttribute(Ce,"true"),n.appendChild(i),i}function vt(e,t,n){const o=globalThis.document,r=bt(t),i=o.createElement("div");i.className="toast border bg-body text-body shadow-sm",i.setAttribute("role","status"),i.setAttribute("aria-live","polite"),i.setAttribute("aria-atomic","true"),i.setAttribute(dt,"true"),i.setAttribute(ut,r.level);const c=o.createElement("div");c.className="d-flex align-items-stretch";const a=o.createElement("div");a.className=`flex-shrink-0 rounded-start ${r.accentClassName}`,a.style.width="0.375rem",a.setAttribute(ft,"true");const f=o.createElement("div");f.className="toast-body",f.style.whiteSpace="pre-line",f.textContent=e;const l=o.createElement("button");l.type="button",l.className="btn-close me-2 m-auto flex-shrink-0",l.setAttribute("aria-label","Close"),l.setAttribute(mt,"true"),c.appendChild(a),c.appendChild(f),c.appendChild(l),i.appendChild(c),Et(o,n).appendChild(i);const m=n.toastDelay!==void 0?{delay:n.toastDelay}:void 0,d=Ue(i,m,n.bootstrap);if(!d)return i.remove(),Promise.reject(new Error("Bootstrap Toast is unavailable."));l.addEventListener("click",()=>{d.hide?.()}),i.addEventListener("hidden.bs.toast",()=>{i.remove(),d.dispose?.()},{once:!0});try{return d.show(),Promise.resolve()}catch(b){return i.remove(),d.dispose?.(),Promise.reject(b)}}let u={options:{fallbackToNative:!0}};function w(e){return e?String(e).replace(/\\n/g,`
2
+ `):""}function Le(){return globalThis.window}function K(e){return Promise.resolve(e).then(()=>{})}function D(e){const t=u.originalHaori?.[e];return typeof t=="function"?t:void 0}function P(e){console.warn(`[haori-bootstrap] ${e} skipped because Bootstrap support is unavailable.`)}function Se(e){const t=w(e),n=D("dialog");if(n)return K(n(t));const o=Le();return u.options.fallbackToNative&&typeof o?.alert=="function"?(o.alert(t),Promise.resolve()):(P("dialog"),Promise.resolve())}function Me(e){const t=w(e),n=D("confirm");if(n)return Promise.resolve(n(t)).then(r=>!!r);const o=Le();return u.options.fallbackToNative&&typeof o?.confirm=="function"?Promise.resolve(o.confirm(t)):(P("confirm"),Promise.resolve(!1))}function ye(e,t){const n=w(e),o=D("toast");return o?K(o(n,t)):(P("toast"),Promise.resolve())}function x(e,t){const n=D(e);return n?K(n(t)):(P(e),Promise.resolve())}function pt(e){u=e}class Ie{static dialog(t){const n=w(t);return N(u.options.bootstrap)?je(n,u.options).catch(()=>Se(n)):Se(n)}static confirm(t){const n=w(t);return N(u.options.bootstrap)?Je(n,u.options).catch(()=>Me(n)):Me(n)}static toast(t,n){const o=w(t);return $e(u.options.bootstrap)?vt(o,n,u.options).catch(()=>ye(o,n)):ye(o,n)}static openDialog(t){return N(u.options.bootstrap)?lt(t,u.options).catch(()=>x("openDialog",t)):x("openDialog",t)}static closeDialog(t){return N(u.options.bootstrap)?ct(t,u.options).catch(()=>x("closeDialog",t)):x("closeDialog",t)}static addErrorMessage(t,n){return ot(t,n)}static addMessage(t,n,o){return rt(t,n,o)}static clearMessages(t){return he(t)}}const Tt="haori-bootstrap:collapse:",O="data-haori-persist";let q=!1,$,V;function Ne(e){return Tt+e}function At(e){try{const t=window.sessionStorage.getItem(Ne(e));return t==="shown"||t==="hidden"?t:void 0}catch{return}}function gt(e,t){try{window.sessionStorage.setItem(Ne(e),t)}catch{}}function ke(e,t){const n=e.id,o=[`[data-bs-toggle="collapse"][data-bs-target="#${n}"]`];if(n&&o.push(`[data-bs-toggle="collapse"][href="#${n}"]`),!n)return;e.ownerDocument.querySelectorAll(o.join(",")).forEach(i=>{i.setAttribute("aria-expanded",t?"true":"false"),i.classList.toggle("collapsed",!t)})}function He(e){const t=e.getAttribute(O);if(!t)return;const n=At(t);if(!n)return;const o=e.classList.contains("show");n==="shown"&&!o?(e.classList.add("show"),ke(e,!0)):n==="hidden"&&o&&(e.classList.remove("show"),ke(e,!1))}function Re(e){e instanceof HTMLElement&&e.hasAttribute(O)&&He(e),e.querySelectorAll(`[${O}]`).forEach(He)}function _e(e,t){const n=e.target;if(!(n instanceof HTMLElement))return;const o=n.getAttribute(O);o&&gt(o,t)}const Be=e=>_e(e,"shown"),De=e=>_e(e,"hidden");function Ct(e=document){if(q)return;q=!0,V=e,e.addEventListener("shown.bs.collapse",Be),e.addEventListener("hidden.bs.collapse",De);const t=()=>{Re(e),$=new MutationObserver(n=>{for(const o of n)o.addedNodes.forEach(r=>{r instanceof HTMLElement&&Re(r)})}),e.body&&$.observe(e.body,{childList:!0,subtree:!0})};e.body?t():e.addEventListener("DOMContentLoaded",t,{once:!0})}function wt(e=V??document){q&&(q=!1,e.removeEventListener("shown.bs.collapse",Be),e.removeEventListener("hidden.bs.collapse",De),$?.disconnect(),$=void 0,V=void 0)}const Lt=[{attribute:"dialog-ok-label",apply:(e,t)=>{e.dialogOkLabel=t}},{attribute:"dialog-cancel-label",apply:(e,t)=>{e.dialogCancelLabel=t}}],St=typeof document<"u"&&document.currentScript instanceof HTMLScriptElement?document.currentScript:null;function j(e,t){const n=e?.getAttribute(t)??null;if(!(n===null||n.trim()===""))return n}function Mt(e=typeof document>"u"?null:document,t=St){const n={};for(const{attribute:o,apply:r}of Lt){const i=j(t,`data-${o}`)??j(e?.documentElement??null,`data-haori-${o}`)??j(e?.body??null,`data-haori-${o}`);i!==void 0&&r(n,i)}return n}const J={fallbackToNative:!0},Pe=new Set(["dialog","confirm","toast","openDialog","closeDialog","addErrorMessage","addMessage","clearMessages"]);function yt(e){const t=Ie;return new Proxy(e,{get(n,o,r){return typeof o=="string"&&Pe.has(o)?t[o]:Reflect.get(n,o,r)},has(n,o){return typeof o=="string"&&Pe.has(o)?!0:Reflect.has(n,o)}})}const s={installed:!1,options:J};function X(){return globalThis.window}function It(e,t){const n=Mt();return{bootstrap:e.bootstrap??t?.bootstrap,fallbackToNative:e.fallbackToNative??J.fallbackToNative,runtime:e.runtime??s.options.runtime??t?.Haori?.runtime,toastContainerSelector:e.toastContainerSelector??s.options.toastContainerSelector,dialogContainerSelector:e.dialogContainerSelector??s.options.dialogContainerSelector,dialogTitle:e.dialogTitle??s.options.dialogTitle,dialogOkLabel:e.dialogOkLabel??s.options.dialogOkLabel??n.dialogOkLabel,dialogCancelLabel:e.dialogCancelLabel??s.options.dialogCancelLabel??n.dialogCancelLabel,toastPosition:e.toastPosition??s.options.toastPosition,toastDelay:e.toastDelay??s.options.toastDelay}}function xe(e=X()){return!!(e?.Haori&&e.bootstrap)}function Oe(e={}){const t=X();if(!t?.Haori)throw new Error("window.Haori is required before calling install().");if(s.originalHaori||(s.originalHaori=t.Haori,s.originalRuntime=t.Haori.runtime),s.options=It(e,t),s.options.runtime){const n=s.originalHaori??t.Haori;typeof n.setRuntime=="function"?n.setRuntime(s.options.runtime):console.warn("[haori-bootstrap] Haori.setRuntime が利用できません。runtime 設定は無視されます。")}pt({originalHaori:s.originalHaori,options:s.options}),t.Haori=yt(s.originalHaori),Ct(),st(),s.installed=!0}function Nt(){const e=X();if(!e||!s.originalHaori)return;const t=s.originalHaori;typeof t.setRuntime=="function"?t.setRuntime(s.originalRuntime):t.runtime=s.originalRuntime,e.Haori=s.originalHaori,wt(),at(),s.installed=!1,s.originalHaori=void 0,s.originalRuntime=void 0,s.options=J}function kt(){return s.installed}const qe="__haoriJsBootstrapAutoEnabled__";function Ht(){return globalThis.window}function Rt(e){return!!e[qe]}function _t(e){e[qe]=!0}function Bt(){const e=Ht();if(!(!e||Rt(e))){if(!xe(e)){console.warn("[haori-bootstrap] Auto-enable skipped because window.Haori or window.bootstrap is missing.");return}try{Oe({bootstrap:e.bootstrap}),_t(e)}catch(t){console.warn("[haori-bootstrap] Auto-enable failed.",t)}}}Bt();const Dt="0.5.57";return E.BootstrapHaori=Ie,E.hasAutoEnablePrerequisites=xe,E.install=Oe,E.isInstalled=kt,E.uninstall=Nt,E.version=Dt,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"}),E})({});
3
3
  //# sourceMappingURL=haori-bootstrap.iife.js.map