haori-bootstrap 0.5.63 → 0.5.65

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.63
5
+ Version: 0.5.65
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.59.5/dist/haori.iife.js"></script>
44
+ <script src="https://cdn.jsdelivr.net/npm/haori@0.61.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.63/dist/haori-bootstrap.iife.js"></script>
46
+ <script src="https://cdn.jsdelivr.net/npm/haori-bootstrap@0.5.65/dist/haori-bootstrap.iife.js"></script>
47
47
  ```
48
48
 
49
49
  IIFE 版は、window.Haori と window.bootstrap が利用可能な場合に自動で有効化されます。
@@ -76,8 +76,8 @@ 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) | 管理対象エラーメッセージの追加。入力欄・`button`・`a`・子要素を持てない要素(`img` など)には要素の直後へ、それ以外には要素の中の先頭へ出します。 | Promise<void> |
80
- | addMessage(target, message, level?) | レベル付き管理対象メッセージを追加(`'error'` \| `'success'` \| `'warning'` \| `'info'`)。再呼び出し時は Bootstrap 検証クラス(`is-invalid` / `is-valid`)も切り替わります。 | Promise<void> |
79
+ | addErrorMessage(target, message) | 管理対象エラーメッセージの追加。入力欄・`button`・`a`・子要素を持てない要素(`img` など)には要素の直後へ、それ以外には要素の中の先頭へ出します。全体エラーの枠と `is-invalid` を付けた入力欄には `data-message-level="error"` を付けるため、コアの `data-{event}-scroll-error` がそこへスクロールします(コア 0.60.0 以降)。メッセージを消すと外れます。 | Promise<void> |
80
+ | addMessage(target, message, level?) | レベル付き管理対象メッセージを追加(`'error'` \| `'success'` \| `'warning'` \| `'info'`)。再呼び出し時は Bootstrap 検証クラス(`is-invalid` / `is-valid`)も切り替わります。`'error'` のときは `addErrorMessage` と同じく `data-message-level="error"` を付け、それ以外のレベルでは外します。 | Promise<void> |
81
81
  | clearMessages(parentOrTarget) | 管理対象メッセージのみ削除 | Promise<void> |
82
82
  | install(options) | Bootstrap 対応 Haori を再適用し、runtime を含めて設定を上書き | void |
83
83
  | uninstall() | 元の Haori 実装を復元 | void |
@@ -317,12 +317,12 @@ push 後に、そのタグから GitHub Release を published にします。公
317
317
  次回 patch リリースの例:
318
318
 
319
319
  ```bash
320
- # version が 0.5.64 になる
320
+ # version が 0.5.66 になる
321
321
  npm version patch
322
322
  git push origin main --follow-tags
323
323
  ```
324
324
 
325
- その後、push 済みタグの GitHub Release を作成して published にします。例として次回は `0.5.64` タグになります。
325
+ その後、push 済みタグの GitHub Release を作成して published にします。例として次回は `0.5.66` タグになります。
326
326
 
327
327
  自動公開:
328
328
 
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.63
5
+ Version: 0.5.65
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.59.5/dist/haori.iife.js"></script>
44
+ <script src="https://cdn.jsdelivr.net/npm/haori@0.61.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.63/dist/haori-bootstrap.iife.js"></script>
46
+ <script src="https://cdn.jsdelivr.net/npm/haori-bootstrap@0.5.65/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,8 +76,8 @@ 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. 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
- | 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> |
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. The error alert and every field marked `is-invalid` also get `data-message-level="error"`, so the core's `data-{event}-scroll-error` scrolls to them (core 0.60.0 or later); clearing the messages removes it. | Promise<void> |
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. With `'error'` it adds `data-message-level="error"` like `addErrorMessage`; other levels remove it. | 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 |
83
83
  | uninstall() | Restore the original Haori implementation | void |
@@ -314,15 +314,15 @@ git push origin main --follow-tags
314
314
 
315
315
  After pushing, publish a GitHub Release from the generated version tag. The release workflow then publishes the package and uploads `dist.zip` automatically.
316
316
 
317
- Example next patch release after `0.5.63`:
317
+ Example next patch release after `0.5.65`:
318
318
 
319
319
  ```bash
320
- # version becomes 0.5.64
320
+ # version becomes 0.5.66
321
321
  npm version patch
322
322
  git push origin main --follow-tags
323
323
  ```
324
324
 
325
- Create and publish the GitHub Release for the pushed tag such as `0.5.64`.
325
+ Create and publish the GitHub Release for the pushed tag such as `0.5.66`.
326
326
 
327
327
  Release automation:
328
328
 
@@ -1,3 +1,3 @@
1
- var HaoriBootstrap=(function(E){"use strict";function te(e){return typeof e=="function"}function ne(e){return te(e?.Modal)?e?.Modal:void 0}function oe(e){return te(e?.Toast)?e?.Toast:void 0}function k(e){return!!ne(e)}function je(e){return!!oe(e)}function H(e,t,n){const o=ne(n);if(o)return typeof o.getOrCreateInstance=="function"?o.getOrCreateInstance(e,t):new o(e,t)}function Je(e,t,n){const o=oe(n);if(o)return typeof o.getOrCreateInstance=="function"?o.getOrCreateInstance(e,t):new o(e,t)}const Xe="data-haori-dialog",Qe="data-haori-confirm",Ye="data-haori-dialog-title",re="data-haori-dialog-ok",se="data-haori-confirm-ok",ie="data-haori-confirm-cancel",Ze="OK",et="Cancel";let tt=0;function ae(){return{backdrop:"static",keyboard:!1}}function le(e,t){if(t.dialogContainerSelector){const n=e.querySelector(t.dialogContainerSelector);if(n)return n}return e.body}function ce(e,t,n,o){const r=o.dialogTitle,s=e.createElement("div");s.className="modal fade",s.tabIndex=-1,s.setAttribute(n?Qe:Xe,"true"),s.setAttribute("aria-hidden","true");const a=e.createElement("div");a.className="modal-dialog modal-dialog-centered";const l=e.createElement("div");if(l.className="modal-content",r){const b=`haori-dialog-title-${++tt}`,N=e.createElement("div");N.className="modal-header";const w=e.createElement("h5");w.className="modal-title",w.id=b,w.setAttribute(Ye,"true"),w.textContent=r,N.appendChild(w),l.appendChild(N),s.setAttribute("aria-labelledby",b)}const f=e.createElement("div");f.className="modal-body";const c=e.createElement("p");c.className="mb-0",c.style.whiteSpace="pre-line",c.textContent=t,f.appendChild(c);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(ie,"true"),b.textContent=o.dialogCancelLabel??et,m.appendChild(b)}const d=e.createElement("button");return d.type="button",d.className="btn btn-primary",d.setAttribute(n?se:re,"true"),d.textContent=o.dialogOkLabel??Ze,m.appendChild(d),l.append(f,m),a.appendChild(l),s.appendChild(a),s}function de(e){let t=!1,n=!1;return{requestClose:o=>{t||(t=!0,o?.(),n&&e.hide())},handleShown:()=>{n=!0,t&&e.hide()}}}function nt(e,t){const n=globalThis.document,o=ce(n,e,!1,t);le(n,t).appendChild(o);const r=H(o,ae(),t.bootstrap);return r?new Promise((s,a)=>{const l=()=>{o.removeEventListener("shown.bs.modal",m),o.removeEventListener("hidden.bs.modal",f),o.remove(),r.dispose?.(),s()},f=()=>{l()},c=de(r),m=c.handleShown;o.querySelector(`[${re}]`)?.addEventListener("click",()=>{c.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?.(),a(b)}}):(o.remove(),Promise.reject(new Error("Bootstrap Modal is unavailable.")))}function ot(e,t){const n=globalThis.document,o=ce(n,e,!0,t);le(n,t).appendChild(o);const r=H(o,ae(),t.bootstrap);return r?new Promise((s,a)=>{let l=!1;const f=()=>{o.removeEventListener("shown.bs.modal",d),o.removeEventListener("hidden.bs.modal",c),o.remove(),r.dispose?.(),s(l)},c=()=>{f()},m=de(r),d=m.handleShown,b=o.querySelector(`[${se}]`),N=o.querySelector(`[${ie}]`);b?.addEventListener("click",()=>{m.requestClose(()=>{l=!0})}),N?.addEventListener("click",()=>{m.requestClose(()=>{l=!1})}),o.addEventListener("shown.bs.modal",d),o.addEventListener("hidden.bs.modal",c,{once:!0});try{r.show()}catch(w){o.removeEventListener("shown.bs.modal",d),o.removeEventListener("hidden.bs.modal",c),o.remove(),r.dispose?.(),a(w)}}):(o.remove(),Promise.reject(new Error("Bootstrap Modal is unavailable.")))}const p="data-haori-owned",h="data-haori-message-container",C="data-haori-invalid-target",S="data-haori-valid-target",rt=new Set(["button","a","area","br","col","embed","hr","img","source","track","wbr"]);function y(e){return e instanceof HTMLInputElement&&(e.type==="checkbox"||e.type==="radio")}function g(e){return e instanceof HTMLInputElement&&e.type==="radio"}function M(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement}function W(e){return rt.has(e.localName)}function ue(e){const t=e.nextElementSibling;return t instanceof HTMLElement&&t.getAttribute(h)==="true"?t:void 0}function R(e){return Array.from(e.children).find(t=>t instanceof HTMLElement&&t.getAttribute(h)==="true")}function fe(e,t){const n=e.createElement("div");return n.setAttribute(p,"true"),n.textContent=t,n}function me(e){return W(e)?ue(e):R(e)}function be(e,t){e.insertAdjacentElement(W(e)?"afterend":"afterbegin",t)}function I(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 st(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 z(e){const n=I(e).map(o=>o.closest(".form-check")).filter(o=>o instanceof HTMLElement);if(n.length>1){const o=st(n);if(o&&!n.includes(o))return o}return D(e)}function D(e){const t=e.closest(".form-check");return t instanceof HTMLElement?t:void 0}function he(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(p,"true"),n.setAttribute(h,"true"),e.insertAdjacentElement("afterend",n),n}function it(e){const t=g(e)?z(e):D(e);if(!t)return he(e);const n=R(t);if(n)return n;const o=document.createElement("div");return o.className="invalid-feedback d-block",o.setAttribute(p,"true"),o.setAttribute(h,"true"),t.appendChild(o),o}function at(e){const t=me(e);if(t)return t;const n=document.createElement("div");return n.className="alert alert-danger",n.setAttribute("role","alert"),n.setAttribute(p,"true"),n.setAttribute(h,"true"),be(e,n),n}function A(e){e.getAttribute(C)==="true"&&(e.classList.remove("is-invalid"),e.removeAttribute(C))}function T(e){e.getAttribute(S)==="true"&&(e.classList.remove("is-valid"),e.removeAttribute(S))}function Ee(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 ve(e){(g(e)?I(e):[e]).forEach(n=>{n.classList.add("is-invalid"),n.setAttribute(C,"true")})}function lt(e){(g(e)?I(e):[e]).forEach(n=>{A(n)})}function pe(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(p,"true"),o.setAttribute(h,"true"),e.insertAdjacentElement("afterend",o),o}function ct(e,t){const n=g(e)?z(e):D(e);if(!n)return pe(e,t);const o=R(n);if(o)return o.className=_(t),o;const r=document.createElement("div");return r.className=_(t),r.setAttribute(p,"true"),r.setAttribute(h,"true"),n.appendChild(r),r}function dt(e,t){const n=me(e);if(n)return n.className=Ee(t),n;const o=document.createElement("div");return o.className=Ee(t),o.setAttribute("role","alert"),o.setAttribute(p,"true"),o.setAttribute(h,"true"),be(e,o),o}function ut(e,t){return(y(e)?it(e):M(e)?he(e):at(e)).appendChild(fe(document,t)),y(e)?ve(e):M(e)&&(e.classList.add("is-invalid"),e.setAttribute(C,"true")),Promise.resolve()}function ft(e,t,n){if((y(e)?ct(e,n):M(e)?pe(e,n):dt(e,n)).appendChild(fe(document,t)),y(e)){const r=g(e)?I(e):[e];n==="success"?r.forEach(s=>{A(s),s.classList.add("is-valid"),s.setAttribute(S,"true")}):!n||n==="error"?(r.forEach(s=>T(s)),ve(e)):r.forEach(s=>{T(s),A(s)})}else M(e)&&(n==="success"?(A(e),e.classList.add("is-valid"),e.setAttribute(S,"true")):!n||n==="error"?(T(e),e.classList.add("is-invalid"),e.setAttribute(C,"true")):(T(e),A(e)));return Promise.resolve()}function ge(e){if(y(e)){const r=g(e)?z(e):D(e);(r?R(r):void 0)?.remove(),lt(e),(g(e)?I(e):[e]).forEach(l=>T(l))}else if(M(e)){const r=e.nextElementSibling;r instanceof HTMLElement&&r.getAttribute(h)==="true"&&r.remove(),A(e),T(e)}else W(e)&&ue(e)?.remove();return e.querySelectorAll(`[${h}="true"]`).forEach(r=>{r.remove()}),e.querySelectorAll(`[${C}="true"]`).forEach(r=>{A(r)}),e.querySelectorAll(`[${S}="true"]`).forEach(r=>{T(r)}),Promise.resolve()}const G=new WeakSet,mt="data-haori-dismiss-lock",K=new WeakSet;let B=null,V=new WeakMap,v=null,j=!1;const bt=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map(e=>`${e}:not([tabindex^="-"])`).join(",");let P=!1,J;function Ae(e){return Array.from(e.ownerDocument.querySelectorAll(".modal.show")).filter(t=>t!==e)}function ht(e){return Array.from(e.querySelectorAll(bt)).filter(t=>!t.hasAttribute("disabled")&&!t.classList.contains("disabled")&&(typeof t.checkVisibility!="function"||t.checkVisibility({visibilityProperty:!0})))}const Te=e=>{const t=e.target;if(t instanceof HTMLElement&&(B=t),!v||!(t instanceof Element)||v.contains(t))return;const n=ht(v);n.length===0?v.focus():j?n[n.length-1].focus():n[0].focus()},we=e=>{e instanceof KeyboardEvent&&e.key==="Tab"&&(j=e.shiftKey)},Ce=e=>{if(!(e.target instanceof HTMLElement))return;const t=e.target;G.add(t),v=null,B&&V.set(t,B)},Le=e=>{if(!(e.target instanceof HTMLElement))return;const t=e.target;G.delete(t),t.getAttribute("data-bs-focus")!=="false"&&Ae(t).length>0&&!t.contains(t.ownerDocument.activeElement)&&t.focus()},Se=e=>{if(!(e.target instanceof HTMLElement))return;const t=e.target,n=V.get(t),o=Ae(t);if(o.length===0){v=null;return}t.ownerDocument.body.classList.add("modal-open");const r=o[o.length-1];v=r.getAttribute("data-bs-focus")==="false"?null:r;const s=t.ownerDocument.activeElement;o.some(a=>a.contains(s))||n&&o.some(a=>a.contains(n))&&(n.focus(),t.ownerDocument.activeElement===n)||r.focus()},ye=e=>{const t=e.target;t instanceof HTMLElement&&t.hasAttribute(mt)&&!K.has(t)&&e.preventDefault()};function Me(e,t){K.add(e);try{t.hide()}finally{K.delete(e)}}function Et(e=document){P||(P=!0,J=e,e.addEventListener("focusin",Te),e.addEventListener("keydown",we),e.addEventListener("show.bs.modal",Ce),e.addEventListener("shown.bs.modal",Le),e.addEventListener("hide.bs.modal",ye),e.addEventListener("hidden.bs.modal",Se))}function vt(e=J??document){P&&(P=!1,e.removeEventListener("focusin",Te),e.removeEventListener("keydown",we),e.removeEventListener("show.bs.modal",Ce),e.removeEventListener("shown.bs.modal",Le),e.removeEventListener("hide.bs.modal",ye),e.removeEventListener("hidden.bs.modal",Se),J=void 0,B=null,V=new WeakMap,v=null,j=!1)}function Ie(e){return e.classList.contains("modal")?e:e.closest(".modal")}function Ne(e){e.tabIndex<0&&(e.tabIndex=-1),e.hasAttribute("aria-hidden")||e.setAttribute("aria-hidden","true")}function pt(e,t){const n=Ie(e);if(!n)return Promise.reject(new Error('No ancestor ".modal" element was found for the target.'));Ne(n),ge(n);const o=H(n,void 0,t.bootstrap);return o?(o.show(),Promise.resolve()):Promise.reject(new Error("Bootstrap Modal is unavailable."))}function gt(e,t){const n=Ie(e);if(!n)return Promise.reject(new Error('No ancestor ".modal" element was found for the target.'));Ne(n);const o=H(n,void 0,t.bootstrap);return o?G.has(n)?(n.addEventListener("shown.bs.modal",()=>{Me(n,o)},{once:!0}),Promise.resolve()):(Me(n,o),Promise.resolve()):Promise.reject(new Error("Bootstrap Modal is unavailable."))}const ke="data-haori-toast-container",At="data-haori-toast",Tt="data-haori-toast-level",wt="data-haori-toast-accent",Ct="data-haori-toast-dismiss",He={"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 Lt(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 St(e,t){if(t.toastContainerSelector){const n=e.querySelector(t.toastContainerSelector);if(n)return n}return e.body}function yt(e,t){const n=St(e,t),o=He[t.toastPosition??"bottom-end"],r=n.querySelector(`[${ke}="true"]`);if(r){const a=Object.values(He).flatMap(l=>l.split(" "));return r.classList.remove(...a),r.classList.add(...o.split(" ")),r}const s=e.createElement("div");return s.className=`toast-container position-fixed ${o} p-3`,s.setAttribute(ke,"true"),n.appendChild(s),s}function Mt(e,t,n){const o=globalThis.document,r=Lt(t),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(At,"true"),s.setAttribute(Tt,r.level);const a=o.createElement("div");a.className="d-flex align-items-stretch";const l=o.createElement("div");l.className=`flex-shrink-0 rounded-start ${r.accentClassName}`,l.style.width="0.375rem",l.setAttribute(wt,"true");const f=o.createElement("div");f.className="toast-body",f.style.whiteSpace="pre-line",f.textContent=e;const c=o.createElement("button");c.type="button",c.className="btn-close me-2 m-auto flex-shrink-0",c.setAttribute("aria-label","Close"),c.setAttribute(Ct,"true"),a.appendChild(l),a.appendChild(f),a.appendChild(c),s.appendChild(a),yt(o,n).appendChild(s);const m=n.toastDelay!==void 0?{delay:n.toastDelay}:void 0,d=Je(s,m,n.bootstrap);if(!d)return s.remove(),Promise.reject(new Error("Bootstrap Toast is unavailable."));c.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 L(e){return e?String(e).replace(/\\n/g,`
2
- `):""}function Re(){return globalThis.window}function X(e){return Promise.resolve(e).then(()=>{})}function O(e){const t=u.originalHaori?.[e];return typeof t=="function"?t:void 0}function x(e){console.warn(`[haori-bootstrap] ${e} skipped because Bootstrap support is unavailable.`)}function De(e){const t=L(e),n=O("dialog");if(n)return X(n(t));const o=Re();return u.options.fallbackToNative&&typeof o?.alert=="function"?(o.alert(t),Promise.resolve()):(x("dialog"),Promise.resolve())}function _e(e){const t=L(e),n=O("confirm");if(n)return Promise.resolve(n(t)).then(r=>!!r);const o=Re();return u.options.fallbackToNative&&typeof o?.confirm=="function"?Promise.resolve(o.confirm(t)):(x("confirm"),Promise.resolve(!1))}function Be(e,t){const n=L(e),o=O("toast");return o?X(o(n,t)):(x("toast"),Promise.resolve())}function q(e,t){const n=O(e);return n?X(n(t)):(x(e),Promise.resolve())}function It(e){u=e}class Pe{static dialog(t){const n=L(t);return k(u.options.bootstrap)?nt(n,u.options).catch(()=>De(n)):De(n)}static confirm(t){const n=L(t);return k(u.options.bootstrap)?ot(n,u.options).catch(()=>_e(n)):_e(n)}static toast(t,n){const o=L(t);return je(u.options.bootstrap)?Mt(o,n,u.options).catch(()=>Be(o,n)):Be(o,n)}static openDialog(t){return k(u.options.bootstrap)?pt(t,u.options).catch(()=>q("openDialog",t)):q("openDialog",t)}static closeDialog(t){return k(u.options.bootstrap)?gt(t,u.options).catch(()=>q("closeDialog",t)):q("closeDialog",t)}static addErrorMessage(t,n){return ut(t,n)}static addMessage(t,n,o){return ft(t,n,o)}static clearMessages(t){return ge(t)}}const Nt="haori-bootstrap:collapse:",$="data-haori-persist";let F=!1,U,Q;function Oe(e){return Nt+e}function kt(e){try{const t=window.sessionStorage.getItem(Oe(e));return t==="shown"||t==="hidden"?t:void 0}catch{return}}function Ht(e,t){try{window.sessionStorage.setItem(Oe(e),t)}catch{}}function xe(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(s=>{s.setAttribute("aria-expanded",t?"true":"false"),s.classList.toggle("collapsed",!t)})}function qe(e){const t=e.getAttribute($);if(!t)return;const n=kt(t);if(!n)return;const o=e.classList.contains("show");n==="shown"&&!o?(e.classList.add("show"),xe(e,!0)):n==="hidden"&&o&&(e.classList.remove("show"),xe(e,!1))}function $e(e){e instanceof HTMLElement&&e.hasAttribute($)&&qe(e),e.querySelectorAll(`[${$}]`).forEach(qe)}function Fe(e,t){const n=e.target;if(!(n instanceof HTMLElement))return;const o=n.getAttribute($);o&&Ht(o,t)}const Ue=e=>Fe(e,"shown"),We=e=>Fe(e,"hidden");function Rt(e=document){if(F)return;F=!0,Q=e,e.addEventListener("shown.bs.collapse",Ue),e.addEventListener("hidden.bs.collapse",We);const t=()=>{$e(e),U=new MutationObserver(n=>{for(const o of n)o.addedNodes.forEach(r=>{r instanceof HTMLElement&&$e(r)})}),e.body&&U.observe(e.body,{childList:!0,subtree:!0})};e.body?t():e.addEventListener("DOMContentLoaded",t,{once:!0})}function Dt(e=Q??document){F&&(F=!1,e.removeEventListener("shown.bs.collapse",Ue),e.removeEventListener("hidden.bs.collapse",We),U?.disconnect(),U=void 0,Q=void 0)}const _t=[{attribute:"dialog-ok-label",apply:(e,t)=>{e.dialogOkLabel=t}},{attribute:"dialog-cancel-label",apply:(e,t)=>{e.dialogCancelLabel=t}}],Bt=typeof document<"u"&&document.currentScript instanceof HTMLScriptElement?document.currentScript:null;function Y(e,t){const n=e?.getAttribute(t)??null;if(!(n===null||n.trim()===""))return n}function Pt(e=typeof document>"u"?null:document,t=Bt){const n={};for(const{attribute:o,apply:r}of _t){const s=Y(t,`data-${o}`)??Y(e?.documentElement??null,`data-haori-${o}`)??Y(e?.body??null,`data-haori-${o}`);s!==void 0&&r(n,s)}return n}const Z={fallbackToNative:!0},ze=new Set(["dialog","confirm","toast","openDialog","closeDialog","addErrorMessage","addMessage","clearMessages"]);function Ot(e){const t=Pe;return new Proxy(e,{get(n,o,r){return typeof o=="string"&&ze.has(o)?t[o]:Reflect.get(n,o,r)},has(n,o){return typeof o=="string"&&ze.has(o)?!0:Reflect.has(n,o)}})}const i={installed:!1,options:Z};function ee(){return globalThis.window}function xt(e,t){const n=Pt();return{bootstrap:e.bootstrap??t?.bootstrap,fallbackToNative:e.fallbackToNative??Z.fallbackToNative,runtime:e.runtime??i.options.runtime??t?.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??n.dialogOkLabel,dialogCancelLabel:e.dialogCancelLabel??i.options.dialogCancelLabel??n.dialogCancelLabel,toastPosition:e.toastPosition??i.options.toastPosition,toastDelay:e.toastDelay??i.options.toastDelay}}function Ge(e=ee()){return!!(e?.Haori&&e.bootstrap)}function Ke(e={}){const t=ee();if(!t?.Haori)throw new Error("window.Haori is required before calling install().");if(i.originalHaori||(i.originalHaori=t.Haori,i.originalRuntime=t.Haori.runtime),i.options=xt(e,t),i.options.runtime){const n=i.originalHaori??t.Haori;typeof n.setRuntime=="function"?n.setRuntime(i.options.runtime):console.warn("[haori-bootstrap] Haori.setRuntime が利用できません。runtime 設定は無視されます。")}It({originalHaori:i.originalHaori,options:i.options}),t.Haori=Ot(i.originalHaori),Rt(),Et(),i.installed=!0}function qt(){const e=ee();if(!e||!i.originalHaori)return;const t=i.originalHaori;typeof t.setRuntime=="function"?t.setRuntime(i.originalRuntime):t.runtime=i.originalRuntime,e.Haori=i.originalHaori,Dt(),vt(),i.installed=!1,i.originalHaori=void 0,i.originalRuntime=void 0,i.options=Z}function $t(){return i.installed}const Ve="__haoriJsBootstrapAutoEnabled__";function Ft(){return globalThis.window}function Ut(e){return!!e[Ve]}function Wt(e){e[Ve]=!0}function zt(){const e=Ft();if(!(!e||Ut(e))){if(!Ge(e)){console.warn("[haori-bootstrap] Auto-enable skipped because window.Haori or window.bootstrap is missing.");return}try{Ke({bootstrap:e.bootstrap}),Wt(e)}catch(t){console.warn("[haori-bootstrap] Auto-enable failed.",t)}}}zt();const Gt="0.5.63";return E.BootstrapHaori=Pe,E.hasAutoEnablePrerequisites=Ge,E.install=Ke,E.isInstalled=$t,E.uninstall=qt,E.version=Gt,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"}),E})({});
1
+ var HaoriBootstrap=(function(E){"use strict";function oe(e){return typeof e=="function"}function re(e){return oe(e?.Modal)?e?.Modal:void 0}function se(e){return oe(e?.Toast)?e?.Toast:void 0}function N(e){return!!re(e)}function Qe(e){return!!se(e)}function H(e,t,n){const o=re(n);if(o)return typeof o.getOrCreateInstance=="function"?o.getOrCreateInstance(e,t):new o(e,t)}function Ye(e,t,n){const o=se(n);if(o)return typeof o.getOrCreateInstance=="function"?o.getOrCreateInstance(e,t):new o(e,t)}const Ze="data-haori-dialog",et="data-haori-confirm",tt="data-haori-dialog-title",ie="data-haori-dialog-ok",ae="data-haori-confirm-ok",le="data-haori-confirm-cancel",nt="OK",ot="Cancel";let rt=0;function ce(){return{backdrop:"static",keyboard:!1}}function de(e,t){if(t.dialogContainerSelector){const n=e.querySelector(t.dialogContainerSelector);if(n)return n}return e.body}function ue(e,t,n,o){const r=o.dialogTitle,s=e.createElement("div");s.className="modal fade",s.tabIndex=-1,s.setAttribute(n?et:Ze,"true"),s.setAttribute("aria-hidden","true");const a=e.createElement("div");a.className="modal-dialog modal-dialog-centered";const l=e.createElement("div");if(l.className="modal-content",r){const b=`haori-dialog-title-${++rt}`,k=e.createElement("div");k.className="modal-header";const w=e.createElement("h5");w.className="modal-title",w.id=b,w.setAttribute(tt,"true"),w.textContent=r,k.appendChild(w),l.appendChild(k),s.setAttribute("aria-labelledby",b)}const f=e.createElement("div");f.className="modal-body";const c=e.createElement("p");c.className="mb-0",c.style.whiteSpace="pre-line",c.textContent=t,f.appendChild(c);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(le,"true"),b.textContent=o.dialogCancelLabel??ot,m.appendChild(b)}const d=e.createElement("button");return d.type="button",d.className="btn btn-primary",d.setAttribute(n?ae:ie,"true"),d.textContent=o.dialogOkLabel??nt,m.appendChild(d),l.append(f,m),a.appendChild(l),s.appendChild(a),s}function fe(e){let t=!1,n=!1;return{requestClose:o=>{t||(t=!0,o?.(),n&&e.hide())},handleShown:()=>{n=!0,t&&e.hide()}}}function st(e,t){const n=globalThis.document,o=ue(n,e,!1,t);de(n,t).appendChild(o);const r=H(o,ce(),t.bootstrap);return r?new Promise((s,a)=>{const l=()=>{o.removeEventListener("shown.bs.modal",m),o.removeEventListener("hidden.bs.modal",f),o.remove(),r.dispose?.(),s()},f=()=>{l()},c=fe(r),m=c.handleShown;o.querySelector(`[${ie}]`)?.addEventListener("click",()=>{c.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?.(),a(b)}}):(o.remove(),Promise.reject(new Error("Bootstrap Modal is unavailable.")))}function it(e,t){const n=globalThis.document,o=ue(n,e,!0,t);de(n,t).appendChild(o);const r=H(o,ce(),t.bootstrap);return r?new Promise((s,a)=>{let l=!1;const f=()=>{o.removeEventListener("shown.bs.modal",d),o.removeEventListener("hidden.bs.modal",c),o.remove(),r.dispose?.(),s(l)},c=()=>{f()},m=fe(r),d=m.handleShown,b=o.querySelector(`[${ae}]`),k=o.querySelector(`[${le}]`);b?.addEventListener("click",()=>{m.requestClose(()=>{l=!0})}),k?.addEventListener("click",()=>{m.requestClose(()=>{l=!1})}),o.addEventListener("shown.bs.modal",d),o.addEventListener("hidden.bs.modal",c,{once:!0});try{r.show()}catch(w){o.removeEventListener("shown.bs.modal",d),o.removeEventListener("hidden.bs.modal",c),o.remove(),r.dispose?.(),a(w)}}):(o.remove(),Promise.reject(new Error("Bootstrap Modal is unavailable.")))}const p="data-haori-owned",h="data-haori-message-container",R="data-haori-invalid-target",L="data-haori-valid-target",S="data-message-level",at=new Set(["button","a","area","br","col","embed","hr","img","source","track","wbr"]);function y(e){return e instanceof HTMLInputElement&&(e.type==="checkbox"||e.type==="radio")}function g(e){return e instanceof HTMLInputElement&&e.type==="radio"}function M(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement}function z(e){return at.has(e.localName)}function me(e){const t=e.nextElementSibling;return t instanceof HTMLElement&&t.getAttribute(h)==="true"?t:void 0}function B(e){return Array.from(e.children).find(t=>t instanceof HTMLElement&&t.getAttribute(h)==="true")}function be(e,t){const n=e.createElement("div");return n.setAttribute(p,"true"),n.textContent=t,n}function he(e){return z(e)?me(e):B(e)}function Ee(e,t){e.insertAdjacentElement(z(e)?"afterend":"afterbegin",t)}function I(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 lt(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 G(e){const n=I(e).map(o=>o.closest(".form-check")).filter(o=>o instanceof HTMLElement);if(n.length>1){const o=lt(n);if(o&&!n.includes(o))return o}return D(e)}function D(e){const t=e.closest(".form-check");return t instanceof HTMLElement?t:void 0}function ve(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(p,"true"),n.setAttribute(h,"true"),e.insertAdjacentElement("afterend",n),n}function ct(e){const t=g(e)?G(e):D(e);if(!t)return ve(e);const n=B(t);if(n)return n;const o=document.createElement("div");return o.className="invalid-feedback d-block",o.setAttribute(p,"true"),o.setAttribute(h,"true"),t.appendChild(o),o}function dt(e){const t=he(e);if(t)return t;const n=document.createElement("div");return n.className="alert alert-danger",n.setAttribute(S,"error"),n.setAttribute("role","alert"),n.setAttribute(p,"true"),n.setAttribute(h,"true"),Ee(e,n),n}function K(e){e.classList.add("is-invalid"),e.setAttribute(R,"true"),e.setAttribute(S,"error")}function A(e){e.getAttribute(R)==="true"&&(e.classList.remove("is-invalid"),e.removeAttribute(R),e.removeAttribute(S))}function T(e){e.getAttribute(L)==="true"&&(e.classList.remove("is-valid"),e.removeAttribute(L))}function pe(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 ge(e,t){t==="success"||t==="warning"||t==="info"?e.removeAttribute(S):e.setAttribute(S,"error")}function _(e){return e==="success"?"valid-feedback d-block":"invalid-feedback d-block"}function Ae(e){(g(e)?I(e):[e]).forEach(n=>{K(n)})}function ut(e){(g(e)?I(e):[e]).forEach(n=>{A(n)})}function Te(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(p,"true"),o.setAttribute(h,"true"),e.insertAdjacentElement("afterend",o),o}function ft(e,t){const n=g(e)?G(e):D(e);if(!n)return Te(e,t);const o=B(n);if(o)return o.className=_(t),o;const r=document.createElement("div");return r.className=_(t),r.setAttribute(p,"true"),r.setAttribute(h,"true"),n.appendChild(r),r}function mt(e,t){const n=he(e);if(n)return n.className=pe(t),ge(n,t),n;const o=document.createElement("div");return o.className=pe(t),ge(o,t),o.setAttribute("role","alert"),o.setAttribute(p,"true"),o.setAttribute(h,"true"),Ee(e,o),o}function bt(e,t){return(y(e)?ct(e):M(e)?ve(e):dt(e)).appendChild(be(document,t)),y(e)?Ae(e):M(e)&&K(e),Promise.resolve()}function ht(e,t,n){if((y(e)?ft(e,n):M(e)?Te(e,n):mt(e,n)).appendChild(be(document,t)),y(e)){const r=g(e)?I(e):[e];n==="success"?r.forEach(s=>{A(s),s.classList.add("is-valid"),s.setAttribute(L,"true")}):!n||n==="error"?(r.forEach(s=>T(s)),Ae(e)):r.forEach(s=>{T(s),A(s)})}else M(e)&&(n==="success"?(A(e),e.classList.add("is-valid"),e.setAttribute(L,"true")):!n||n==="error"?(T(e),K(e)):(T(e),A(e)));return Promise.resolve()}function we(e){if(y(e)){const r=g(e)?G(e):D(e);(r?B(r):void 0)?.remove(),ut(e),(g(e)?I(e):[e]).forEach(l=>T(l))}else if(M(e)){const r=e.nextElementSibling;r instanceof HTMLElement&&r.getAttribute(h)==="true"&&r.remove(),A(e),T(e)}else z(e)&&me(e)?.remove();return e.querySelectorAll(`[${h}="true"]`).forEach(r=>{r.remove()}),e.querySelectorAll(`[${R}="true"]`).forEach(r=>{A(r)}),e.querySelectorAll(`[${L}="true"]`).forEach(r=>{T(r)}),Promise.resolve()}const V=new WeakSet,Et="data-haori-dismiss-lock",j=new WeakSet;let P=null,J=new WeakMap,v=null,X=!1;const vt=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map(e=>`${e}:not([tabindex^="-"])`).join(",");let O=!1,Q;function Ce(e){return Array.from(e.ownerDocument.querySelectorAll(".modal.show")).filter(t=>t!==e)}function pt(e){return Array.from(e.querySelectorAll(vt)).filter(t=>!t.hasAttribute("disabled")&&!t.classList.contains("disabled")&&(typeof t.checkVisibility!="function"||t.checkVisibility({visibilityProperty:!0})))}const Le=e=>{const t=e.target;if(t instanceof HTMLElement&&(P=t),!v||!(t instanceof Element)||v.contains(t))return;const n=pt(v);n.length===0?v.focus():X?n[n.length-1].focus():n[0].focus()},Se=e=>{e instanceof KeyboardEvent&&e.key==="Tab"&&(X=e.shiftKey)},ye=e=>{if(!(e.target instanceof HTMLElement))return;const t=e.target;V.add(t),v=null,P&&J.set(t,P)},Me=e=>{if(!(e.target instanceof HTMLElement))return;const t=e.target;V.delete(t),t.getAttribute("data-bs-focus")!=="false"&&Ce(t).length>0&&!t.contains(t.ownerDocument.activeElement)&&t.focus()},Ie=e=>{if(!(e.target instanceof HTMLElement))return;const t=e.target,n=J.get(t),o=Ce(t);if(o.length===0){v=null;return}t.ownerDocument.body.classList.add("modal-open");const r=o[o.length-1];v=r.getAttribute("data-bs-focus")==="false"?null:r;const s=t.ownerDocument.activeElement;o.some(a=>a.contains(s))||n&&o.some(a=>a.contains(n))&&(n.focus(),t.ownerDocument.activeElement===n)||r.focus()},ke=e=>{const t=e.target;t instanceof HTMLElement&&t.hasAttribute(Et)&&!j.has(t)&&e.preventDefault()};function Ne(e,t){j.add(e);try{t.hide()}finally{j.delete(e)}}function gt(e=document){O||(O=!0,Q=e,e.addEventListener("focusin",Le),e.addEventListener("keydown",Se),e.addEventListener("show.bs.modal",ye),e.addEventListener("shown.bs.modal",Me),e.addEventListener("hide.bs.modal",ke),e.addEventListener("hidden.bs.modal",Ie))}function At(e=Q??document){O&&(O=!1,e.removeEventListener("focusin",Le),e.removeEventListener("keydown",Se),e.removeEventListener("show.bs.modal",ye),e.removeEventListener("shown.bs.modal",Me),e.removeEventListener("hide.bs.modal",ke),e.removeEventListener("hidden.bs.modal",Ie),Q=void 0,P=null,J=new WeakMap,v=null,X=!1)}function He(e){return e.classList.contains("modal")?e:e.closest(".modal")}function Re(e){e.tabIndex<0&&(e.tabIndex=-1),e.hasAttribute("aria-hidden")||e.setAttribute("aria-hidden","true")}function Tt(e,t){const n=He(e);if(!n)return Promise.reject(new Error('No ancestor ".modal" element was found for the target.'));Re(n),we(n);const o=H(n,void 0,t.bootstrap);return o?(o.show(),Promise.resolve()):Promise.reject(new Error("Bootstrap Modal is unavailable."))}function wt(e,t){const n=He(e);if(!n)return Promise.reject(new Error('No ancestor ".modal" element was found for the target.'));Re(n);const o=H(n,void 0,t.bootstrap);return o?V.has(n)?(n.addEventListener("shown.bs.modal",()=>{Ne(n,o)},{once:!0}),Promise.resolve()):(Ne(n,o),Promise.resolve()):Promise.reject(new Error("Bootstrap Modal is unavailable."))}const Be="data-haori-toast-container",Ct="data-haori-toast",Lt="data-haori-toast-level",St="data-haori-toast-accent",yt="data-haori-toast-dismiss",De={"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 Mt(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 It(e,t){if(t.toastContainerSelector){const n=e.querySelector(t.toastContainerSelector);if(n)return n}return e.body}function kt(e,t){const n=It(e,t),o=De[t.toastPosition??"bottom-end"],r=n.querySelector(`[${Be}="true"]`);if(r){const a=Object.values(De).flatMap(l=>l.split(" "));return r.classList.remove(...a),r.classList.add(...o.split(" ")),r}const s=e.createElement("div");return s.className=`toast-container position-fixed ${o} p-3`,s.setAttribute(Be,"true"),n.appendChild(s),s}function Nt(e,t,n){const o=globalThis.document,r=Mt(t),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(Ct,"true"),s.setAttribute(Lt,r.level);const a=o.createElement("div");a.className="d-flex align-items-stretch";const l=o.createElement("div");l.className=`flex-shrink-0 rounded-start ${r.accentClassName}`,l.style.width="0.375rem",l.setAttribute(St,"true");const f=o.createElement("div");f.className="toast-body",f.style.whiteSpace="pre-line",f.textContent=e;const c=o.createElement("button");c.type="button",c.className="btn-close me-2 m-auto flex-shrink-0",c.setAttribute("aria-label","Close"),c.setAttribute(yt,"true"),a.appendChild(l),a.appendChild(f),a.appendChild(c),s.appendChild(a),kt(o,n).appendChild(s);const m=n.toastDelay!==void 0?{delay:n.toastDelay}:void 0,d=Ye(s,m,n.bootstrap);if(!d)return s.remove(),Promise.reject(new Error("Bootstrap Toast is unavailable."));c.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 C(e){return e?String(e).replace(/\\n/g,`
2
+ `):""}function _e(){return globalThis.window}function Y(e){return Promise.resolve(e).then(()=>{})}function x(e){const t=u.originalHaori?.[e];return typeof t=="function"?t:void 0}function q(e){console.warn(`[haori-bootstrap] ${e} skipped because Bootstrap support is unavailable.`)}function Pe(e){const t=C(e),n=x("dialog");if(n)return Y(n(t));const o=_e();return u.options.fallbackToNative&&typeof o?.alert=="function"?(o.alert(t),Promise.resolve()):(q("dialog"),Promise.resolve())}function Oe(e){const t=C(e),n=x("confirm");if(n)return Promise.resolve(n(t)).then(r=>!!r);const o=_e();return u.options.fallbackToNative&&typeof o?.confirm=="function"?Promise.resolve(o.confirm(t)):(q("confirm"),Promise.resolve(!1))}function xe(e,t){const n=C(e),o=x("toast");return o?Y(o(n,t)):(q("toast"),Promise.resolve())}function U(e,t){const n=x(e);return n?Y(n(t)):(q(e),Promise.resolve())}function Ht(e){u=e}class qe{static dialog(t){const n=C(t);return N(u.options.bootstrap)?st(n,u.options).catch(()=>Pe(n)):Pe(n)}static confirm(t){const n=C(t);return N(u.options.bootstrap)?it(n,u.options).catch(()=>Oe(n)):Oe(n)}static toast(t,n){const o=C(t);return Qe(u.options.bootstrap)?Nt(o,n,u.options).catch(()=>xe(o,n)):xe(o,n)}static openDialog(t){return N(u.options.bootstrap)?Tt(t,u.options).catch(()=>U("openDialog",t)):U("openDialog",t)}static closeDialog(t){return N(u.options.bootstrap)?wt(t,u.options).catch(()=>U("closeDialog",t)):U("closeDialog",t)}static addErrorMessage(t,n){return bt(t,n)}static addMessage(t,n,o){return ht(t,n,o)}static clearMessages(t){return we(t)}}const Rt="haori-bootstrap:collapse:",$="data-haori-persist";let F=!1,W,Z;function Ue(e){return Rt+e}function Bt(e){try{const t=window.sessionStorage.getItem(Ue(e));return t==="shown"||t==="hidden"?t:void 0}catch{return}}function Dt(e,t){try{window.sessionStorage.setItem(Ue(e),t)}catch{}}function $e(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(s=>{s.setAttribute("aria-expanded",t?"true":"false"),s.classList.toggle("collapsed",!t)})}function Fe(e){const t=e.getAttribute($);if(!t)return;const n=Bt(t);if(!n)return;const o=e.classList.contains("show");n==="shown"&&!o?(e.classList.add("show"),$e(e,!0)):n==="hidden"&&o&&(e.classList.remove("show"),$e(e,!1))}function We(e){e instanceof HTMLElement&&e.hasAttribute($)&&Fe(e),e.querySelectorAll(`[${$}]`).forEach(Fe)}function ze(e,t){const n=e.target;if(!(n instanceof HTMLElement))return;const o=n.getAttribute($);o&&Dt(o,t)}const Ge=e=>ze(e,"shown"),Ke=e=>ze(e,"hidden");function _t(e=document){if(F)return;F=!0,Z=e,e.addEventListener("shown.bs.collapse",Ge),e.addEventListener("hidden.bs.collapse",Ke);const t=()=>{We(e),W=new MutationObserver(n=>{for(const o of n)o.addedNodes.forEach(r=>{r instanceof HTMLElement&&We(r)})}),e.body&&W.observe(e.body,{childList:!0,subtree:!0})};e.body?t():e.addEventListener("DOMContentLoaded",t,{once:!0})}function Pt(e=Z??document){F&&(F=!1,e.removeEventListener("shown.bs.collapse",Ge),e.removeEventListener("hidden.bs.collapse",Ke),W?.disconnect(),W=void 0,Z=void 0)}const Ot=[{attribute:"dialog-ok-label",apply:(e,t)=>{e.dialogOkLabel=t}},{attribute:"dialog-cancel-label",apply:(e,t)=>{e.dialogCancelLabel=t}}],xt=typeof document<"u"&&document.currentScript instanceof HTMLScriptElement?document.currentScript:null;function ee(e,t){const n=e?.getAttribute(t)??null;if(!(n===null||n.trim()===""))return n}function qt(e=typeof document>"u"?null:document,t=xt){const n={};for(const{attribute:o,apply:r}of Ot){const s=ee(t,`data-${o}`)??ee(e?.documentElement??null,`data-haori-${o}`)??ee(e?.body??null,`data-haori-${o}`);s!==void 0&&r(n,s)}return n}const te={fallbackToNative:!0},Ve=new Set(["dialog","confirm","toast","openDialog","closeDialog","addErrorMessage","addMessage","clearMessages"]);function Ut(e){const t=qe;return new Proxy(e,{get(n,o,r){return typeof o=="string"&&Ve.has(o)?t[o]:Reflect.get(n,o,r)},has(n,o){return typeof o=="string"&&Ve.has(o)?!0:Reflect.has(n,o)}})}const i={installed:!1,options:te};function ne(){return globalThis.window}function $t(e,t){const n=qt();return{bootstrap:e.bootstrap??t?.bootstrap,fallbackToNative:e.fallbackToNative??te.fallbackToNative,runtime:e.runtime??i.options.runtime??t?.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??n.dialogOkLabel,dialogCancelLabel:e.dialogCancelLabel??i.options.dialogCancelLabel??n.dialogCancelLabel,toastPosition:e.toastPosition??i.options.toastPosition,toastDelay:e.toastDelay??i.options.toastDelay}}function je(e=ne()){return!!(e?.Haori&&e.bootstrap)}function Je(e={}){const t=ne();if(!t?.Haori)throw new Error("window.Haori is required before calling install().");if(i.originalHaori||(i.originalHaori=t.Haori,i.originalRuntime=t.Haori.runtime),i.options=$t(e,t),i.options.runtime){const n=i.originalHaori??t.Haori;typeof n.setRuntime=="function"?n.setRuntime(i.options.runtime):console.warn("[haori-bootstrap] Haori.setRuntime が利用できません。runtime 設定は無視されます。")}Ht({originalHaori:i.originalHaori,options:i.options}),t.Haori=Ut(i.originalHaori),_t(),gt(),i.installed=!0}function Ft(){const e=ne();if(!e||!i.originalHaori)return;const t=i.originalHaori;typeof t.setRuntime=="function"?t.setRuntime(i.originalRuntime):t.runtime=i.originalRuntime,e.Haori=i.originalHaori,Pt(),At(),i.installed=!1,i.originalHaori=void 0,i.originalRuntime=void 0,i.options=te}function Wt(){return i.installed}const Xe="__haoriJsBootstrapAutoEnabled__";function zt(){return globalThis.window}function Gt(e){return!!e[Xe]}function Kt(e){e[Xe]=!0}function Vt(){const e=zt();if(!(!e||Gt(e))){if(!je(e)){console.warn("[haori-bootstrap] Auto-enable skipped because window.Haori or window.bootstrap is missing.");return}try{Je({bootstrap:e.bootstrap}),Kt(e)}catch(t){console.warn("[haori-bootstrap] Auto-enable failed.",t)}}}Vt();const jt="0.5.65";return E.BootstrapHaori=qe,E.hasAutoEnablePrerequisites=je,E.install=Je,E.isInstalled=Wt,E.uninstall=Ft,E.version=jt,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"}),E})({});
3
3
  //# sourceMappingURL=haori-bootstrap.iife.js.map