@webority/ui-elements 0.85.1 → 0.86.0

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.
Files changed (92) hide show
  1. package/dist/{WuiAutocomplete-DpPpa4FC.js → WuiAutocomplete-CVTtzE8O.js} +1 -1
  2. package/dist/{WuiCodeBlock-DIPE7V93.js → WuiCodeBlock-DsSayJ8U.js} +1 -1
  3. package/dist/{WuiCommandPalette-BROO_xyP.js → WuiCommandPalette-CBg6i4WJ.js} +1 -1
  4. package/dist/{WuiCommentThread-DqKktFs2.js → WuiCommentThread-CfOeJvxg.js} +1 -1
  5. package/dist/{WuiConsentBanner-BDeCCk6b.js → WuiConsentBanner-DMWHSFsl.js} +1 -1
  6. package/dist/{WuiCountrySelect-8zZAl6bH.js → WuiCountrySelect-BHHVP7lK.js} +1 -1
  7. package/dist/{WuiDatePicker-CEabNb5D.js → WuiDatePicker-BQn1d_RD.js} +1 -1
  8. package/dist/{WuiDateRange-CshFgseR.js → WuiDateRange-la8pKreY.js} +1 -1
  9. package/dist/{WuiInlineEdit-BkzYdhpE.js → WuiInlineEdit-CpyX_apm.js} +1 -1
  10. package/dist/{WuiLightbox-D6aI_3tH.js → WuiLightbox-B4dopmSI.js} +1 -1
  11. package/dist/WuiMarkdown-C2flvSIt.js +4 -0
  12. package/dist/{WuiMentionInput-DWuua2rm.js → WuiMentionInput-ix9Wljhc.js} +1 -1
  13. package/dist/{WuiMultiSelect-C1XQnhfW.js → WuiMultiSelect-D9PgSeYk.js} +1 -1
  14. package/dist/{WuiNotificationCenter-D8z-xECD.js → WuiNotificationCenter-DDSPUlD7.js} +1 -1
  15. package/dist/{WuiPhone-BwFv7s0F.js → WuiPhone-CUwTgWQV.js} +1 -1
  16. package/dist/WuiRollingNumber-C85kOshZ.js +1 -0
  17. package/dist/{WuiSelect-1nRsHfEt.js → WuiSelect-mCt7_AzU.js} +1 -1
  18. package/dist/{WuiTagInput-hAQ14Wgk.js → WuiTagInput-Dh7bbhJr.js} +1 -1
  19. package/dist/{WuiTimePicker-DXljDDxI.js → WuiTimePicker-Ct7kghAZ.js} +1 -1
  20. package/dist/{WuiTree-B7TFIZWp.js → WuiTree-y0l3zwAg.js} +1 -1
  21. package/dist/WuiWizardStep-C9fh4xOu.js +1 -0
  22. package/dist/elements/autocomplete.js +1 -1
  23. package/dist/elements/code-block.js +1 -1
  24. package/dist/elements/command-palette.js +1 -1
  25. package/dist/elements/comment-thread.js +1 -1
  26. package/dist/elements/consent-banner.js +1 -1
  27. package/dist/elements/country-select.js +1 -1
  28. package/dist/elements/date-range.js +1 -1
  29. package/dist/elements/datepicker.js +1 -1
  30. package/dist/elements/inline-edit.js +1 -1
  31. package/dist/elements/kanban.js +1 -1
  32. package/dist/elements/lightbox.js +1 -1
  33. package/dist/elements/markdown.js +1 -1
  34. package/dist/elements/mention-input.js +1 -1
  35. package/dist/elements/multiselect.js +1 -1
  36. package/dist/elements/notification-center.js +1 -1
  37. package/dist/elements/phone.js +1 -1
  38. package/dist/elements/rolling-number.js +1 -1
  39. package/dist/elements/select.js +1 -1
  40. package/dist/elements/taginput.js +1 -1
  41. package/dist/elements/timepicker.js +1 -1
  42. package/dist/elements/tree.js +1 -1
  43. package/dist/elements/wizard.js +1 -1
  44. package/dist/{fileViewerImage-Bcsaoyei.js → fileViewerImage-_A5O4Prg.js} +1 -1
  45. package/dist/{fileViewerMedia-B2kIU6tb.js → fileViewerMedia-Cbw07F8S.js} +1 -1
  46. package/dist/{fileViewerPdf-DuRqS6OC.js → fileViewerPdf-vDzO8lfR.js} +1 -1
  47. package/dist/fileViewerUi-Ct9zwiaF.js +1 -0
  48. package/dist/helpers.js +1 -1
  49. package/dist/iconGlyphs.g-BNrdQ7It.js +1 -0
  50. package/dist/{kanban-CxpZlQDL.js → kanban-DRF61Mib.js} +1 -1
  51. package/dist/{optionLabel-Bd3vP-XI.js → optionLabel-Bul5mgul.js} +1 -1
  52. package/dist/ui-chat-core.js +1 -1
  53. package/dist/ui-chat.global.js +2 -2
  54. package/dist/ui-chat.js +2 -2
  55. package/dist/ui-consent-banner.global.js +1 -1
  56. package/dist/ui-elements/autocomplete.global.js +1 -1
  57. package/dist/ui-elements/carousel.global.js +1 -1
  58. package/dist/ui-elements/code-block.global.js +1 -1
  59. package/dist/ui-elements/command-palette.global.js +1 -1
  60. package/dist/ui-elements/comment-thread.global.js +1 -1
  61. package/dist/ui-elements/consent-banner.global.js +1 -1
  62. package/dist/ui-elements/context-menu.global.js +1 -1
  63. package/dist/ui-elements/date-range.global.js +1 -1
  64. package/dist/ui-elements/drawer.global.js +1 -1
  65. package/dist/ui-elements/image-crop.global.js +1 -1
  66. package/dist/ui-elements/inline-edit.global.js +1 -1
  67. package/dist/ui-elements/kanban.global.js +1 -1
  68. package/dist/ui-elements/lightbox.global.js +1 -1
  69. package/dist/ui-elements/markdown.global.js +2 -2
  70. package/dist/ui-elements/menubar.global.js +1 -1
  71. package/dist/ui-elements/multiselect.global.js +1 -1
  72. package/dist/ui-elements/phone.global.js +1 -1
  73. package/dist/ui-elements/resizable.global.js +1 -1
  74. package/dist/ui-elements/slider.global.js +1 -1
  75. package/dist/ui-elements/sortable.global.js +1 -1
  76. package/dist/ui-elements/status-icon.global.js +1 -1
  77. package/dist/ui-elements/taginput.global.js +1 -1
  78. package/dist/ui-elements/timepicker.global.js +1 -1
  79. package/dist/ui-elements/tour.global.js +1 -1
  80. package/dist/ui-elements/tree.global.js +1 -1
  81. package/dist/ui-elements/wizard.global.js +1 -1
  82. package/dist/ui-elements.global.js +3 -3
  83. package/dist/ui-elements.js +1 -1
  84. package/dist/ui-file-viewer.global.js +1 -1
  85. package/dist/ui-file-viewer.js +1 -1
  86. package/dist/{wuiHttp-Cu7OPWr2.js → wuiHttp-DJ1oIvtB.js} +1 -1
  87. package/package.json +1 -1
  88. package/dist/WuiMarkdown-DZ5CMeCz.js +0 -4
  89. package/dist/WuiRollingNumber-fiD54wsj.js +0 -1
  90. package/dist/WuiWizardStep-D46JBR4c.js +0 -1
  91. package/dist/fileViewerUi-CmfISSyD.js +0 -1
  92. package/dist/iconGlyphs.g-Bk8AzmSO.js +0 -1
@@ -1 +1 @@
1
- import{t as e}from"./elementBase-DV9IZZCu.js";import{n as t,t as n}from"./devWarn-DXdRWZs3.js";import{m as r,s as i,t as a}from"./formatters-BAE__8ye.js";import{c as o,o as s}from"./wuiHttp-Cu7OPWr2.js";var c=`wui-remote-modal`,l=`wui-remote-drawer`,u=Object.freeze({sm:360,md:480,lg:640}),d=`wui-modal-fullscreen`,f=Object.freeze({sm:380,md:440,lg:640,xl:880}),p=Object.freeze({loading:`Loading`,close:`Close`,retry:`Try again`,errorTitle:`This could not be loaded`,forbidden:`You do not have access to this.`,client:`It may have been moved or deleted.`,server:`Something went wrong on our side. Try again in a moment.`,network:`Could not reach the server. Check your connection and try again.`,submitFailed:`Your changes were not saved.`,invalid:`Some fields need attention.`}),m=`a[href],button:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,h=`input:not([type="hidden"]):not([disabled]),select:not([disabled]),textarea:not([disabled]),[contenteditable="true"]`,g=`[aria-invalid="true"], .is-invalid, .input-validation-error`,_=`.wui-error-summary, [data-wui-form-errors], .validation-summary-errors, [data-valmsg-summary]`,v=`[data-wui-modal-content]`,ee=`<button type="button" class="wui-modal-close" data-bs-dismiss="modal" aria-label="Close"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18M6 6l12 12"></path></svg></button>`,te=new WeakMap,ne=new WeakSet,y=()=>Object.assign(Error(`The remote modal load was aborted.`),{name:`AbortError`}),re=e=>{let t=window.bootstrap?.Modal;if(!t)throw Error(`WUI.modal.load(${String(e)}): Bootstrap's bundle (window.bootstrap) is not loaded on this page.`);return t},b=e=>{let t=document.createElement(`span`);return t.textContent=e??``,t.innerHTML};function x(e){if(e==null||e===``)return null;if(e===`fullscreen`)return{fullscreen:!0};if(Object.hasOwn(f,e))return{px:f[e]};let t=typeof e==`number`?e:/^\d+$/.test(String(e))?Number(e):NaN;if(Number.isInteger(t)&&t>0)return{px:t};throw TypeError(`Unsupported modal size "${String(e)}". Use sm, md, lg, xl, fullscreen or a px number.`)}var ie=e=>{if(e.classList.contains(`wui-modal-fullscreen`))return{fullscreen:!0};let t=Number.parseInt(e.style.getPropertyValue(`--wui-modal-max-width`),10);return{px:t>0?t:f.md}},S=(e,t)=>{e.classList.toggle(d,!!t.fullscreen),t.fullscreen?e.style.removeProperty(`--wui-modal-max-width`):e.style.setProperty(`--wui-modal-max-width`,`${t.px}px`)},ae=[`center`,`top`];function oe(e){if(Object.hasOwn(u,e??``))return{px:u[e]};let t=x(e);if(t?.fullscreen||e===`xl`)throw TypeError(`Unsupported drawer size "${String(e)}". Use sm, md, lg or a px number.`);return t}var C=e=>e.container===`drawer`,se=(e,t)=>C(e)?oe(t):x(t);function ce(e=`modal`){let t=e===`drawer`,n=t?l:c,r=document.getElementById(n);return r||(r=document.createElement(`div`),r.id=n,r.className=t?`modal fade wui-modal-shell wui-remote-drawer`:`modal fade wui-modal-shell`,r.tabIndex=-1,r.setAttribute(`aria-hidden`,`true`),r.setAttribute(`role`,`dialog`),r.setAttribute(`aria-modal`,`true`),r.style.setProperty(`--wui-modal-max-width`,`${t?u.md:f.md}px`),r.innerHTML=t?`<div class="modal-dialog wui-remote-drawer-dialog"><div class="modal-content wui-modal"></div></div>`:`<div class="modal-dialog modal-dialog-centered wui-rb-dialog"><div class="modal-content wui-modal"></div></div>`,document.body.appendChild(r),r)}var le=e=>`<div class="wui-modal-header"><div class="wui-modal-heading"><div class="wui-modal-headtext"><div class="wui-modal-title">${b(e)}</div></div></div>${ee}</div>`,ue=e=>`<div class="modal-content wui-modal" aria-busy="true">${le(e)}<div class="wui-modal-body"><div class="wui-modal-loading" role="status"><span class="visually-hidden">${b(p.loading)}</span><div class="skeleton wui-modal-skeleton"></div><div class="skeleton wui-modal-skeleton"></div><div class="skeleton wui-modal-skeleton wui-modal-skeleton--short"></div></div></div></div>`,de=(e,t)=>`<div class="modal-content wui-modal" data-wui-modal-error="${b(t)}">${le(e)}<div class="wui-modal-body"><div class="wui-modal-state" role="alert"><p class="wui-modal-state-title">${b(p.errorTitle)}</p><p class="wui-modal-state-text">${b(p[t]||p.server)}</p><div class="wui-modal-state-actions"><button type="button" class="btn btn-secondary" data-bs-dismiss="modal">${b(p.close)}</button><button type="button" class="btn btn-primary" data-wui-modal-retry>${b(p.retry)}</button></div></div></div></div>`,w=e=>{let t=document.createElement(`template`);return t.innerHTML=e,t.content.querySelector(`.modal-content`)},T=e=>e.shell.querySelector(`.modal-content`);function fe(e){if(!e)return;e.dispatchEvent(new CustomEvent(`wui:teardown`,{bubbles:!0}));let t=window.bootstrap,n=[t?.Tooltip,t?.Popover,t?.Dropdown].filter(e=>e?.getInstance);for(let t of[e,...e.querySelectorAll(`*`)])for(let e of n)e.getInstance(t)?.dispose()}function E(e,t){let n=T(e),r=n?pe(n):new Map;fe(n),n?n.replaceWith(t):e.shell.querySelector(`.modal-dialog`).appendChild(t),me(t,r),window.WUI?.refresh?.()}var D=`input[type="file"][name]`;function pe(e){let t=new Map;for(let n of e.querySelectorAll(D))n.files.length>0&&t.set(n.name,[...n.files]);return t}function me(e,t){if(!(t.size===0||typeof DataTransfer>`u`))for(let n of e.querySelectorAll(D)){let e=t.get(n.name);if(!e)continue;let r=new DataTransfer;for(let t of e)r.items.add(t);n.files=r.files,n.dispatchEvent(new Event(`change`,{bubbles:!0}))}}var O=e=>e.shell.classList.contains(`show`);function k(e,t,n=!1){let r=t&&e.querySelector(g),i=r?r.matches(m)?r:r.querySelector(m)||r:null;if(!i&&n)i=e.querySelector(`[data-autofocus]`)||e.querySelector(h)||e.querySelector(`.wui-modal-close`);else if(!i){let t=[...e.querySelectorAll(m)];i=e.querySelector(`[data-autofocus]`)||t.find(e=>!e.classList.contains(`wui-modal-close`))||t[0]||e}i?.focus?.()}function he(e,t){let n=[...e.querySelectorAll(m)].filter(e=>e.getClientRects().length>0&&getComputedStyle(e).visibility!==`hidden`);if(!n.length){t.preventDefault(),e.focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;!e.contains(a)||a===e?(t.preventDefault(),(t.shiftKey?i:r).focus()):t.shiftKey&&a===r?(t.preventDefault(),i.focus()):!t.shiftKey&&a===i&&(t.preventDefault(),r.focus())}function ge(e,t){let n=e.shell.querySelector(`[data-wui-modal-live]`);n||(n=document.createElement(`div`),n.className=`visually-hidden`,n.setAttribute(`aria-live`,`assertive`),n.setAttribute(`data-wui-modal-live`,``),e.shell.querySelector(`.modal-dialog`).appendChild(n)),n.textContent=``,n.textContent=t}var _e=e=>{let t=e.shell.querySelector(`[data-wui-modal-live]`);t&&(t.textContent=``)},ve=(e,t,n)=>e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}));function A(e,t,n,r){let i={...r,container:e.container};ve(t,`wui:modal:${n}`,i),C(e)&&ve(t,`wui:drawer:${n}`,i)}function ye(e){let t=te.get(e);return t||(t={shell:e,container:e.classList.contains(`wui-remote-drawer`)?`drawer`:`modal`,queue:s(),defaultSize:ie(e),defaultLabel:e.getAttribute(`aria-label`),placeholder:T({shell:e})?.outerHTML||`<div class="modal-content wui-modal"></div>`,remoteUrl:e.getAttribute(`data-wui-remote-url`),cache:e.getAttribute(`data-wui-remote-cache`)===`true`,loadedUrl:null,session:null},te.set(e,t),e.addEventListener(`submit`,e=>Ae(t,e)),e.addEventListener(`click`,e=>{!e.target.closest?.(`[data-wui-modal-retry]`)||!t.session||(e.preventDefault(),N(t,t.session))}),e.addEventListener(`hidden.bs.modal`,n=>{n.target===e&&xe(t)}),e.addEventListener(`shown.bs.modal`,n=>{let r=T(t);n.target===e&&t.session&&r?.matches(v)&&!r.contains(document.activeElement)&&k(r,!1,C(t))}),t.remoteUrl&&e.addEventListener(`show.bs.modal`,n=>{n.target===e&&Se(t,n)}),t)}function be(e,t,n){e.session&&(e.queue.abort(),e.session.resolveClosed({status:`dismissed`,detail:{replaced:!0}}));let r,i=new Promise(e=>{r=e}),a={url:t,method:(n.method||`GET`).toUpperCase(),body:n.body,options:n,trigger:n.trigger||null,explicitSize:null,closing:null,resolveClosed:r,handle:null};return a.handle={el:e.shell,closed:i,close:()=>j(e,a,`dismissed`,null),reload:()=>N(e,a)},e.session=a,a}function j(e,t,n,r){e.session===t&&(t.closing={status:n,detail:r},window.bootstrap?.Modal?.getOrCreateInstance(e.shell).hide())}function xe(e){let t=e.session;if(e.queue.abort(),e.session=null,_e(e),t){let{status:n,detail:r}=t.closing||{status:`dismissed`,detail:null};t.resolveClosed({status:n,detail:r}),A(e,e.shell,`closed`,{status:n,url:t.url});let i=document.activeElement;t.trigger?.isConnected&&(!i||i===document.body||e.shell.contains(i))&&t.trigger.focus?.()}e.cache||(E(e,w(e.placeholder)),e.loadedUrl=null,S(e.shell,e.defaultSize),e.defaultLabel?e.shell.setAttribute(`aria-label`,e.defaultLabel):e.shell.removeAttribute(`aria-label`))}function Se(e,t){let n=t.relatedTarget instanceof Element?t.relatedTarget:null,r=n?.getAttribute(`data-wui-url`)||e.remoteUrl,i=be(e,r,{trigger:n});i.explicitSize=M(e,n?.getAttribute(`data-wui-size`)),i.explicitSize&&S(e.shell,i.explicitSize),!(e.cache&&e.loadedUrl===r)&&(e.loadedUrl&&E(e,w(e.placeholder)),N(e,i,{keepPlaceholder:!0}))}function M(e,t){try{return se(e,t)}catch(e){return n(e),null}}async function N(e,t,{keepPlaceholder:n=!1}={}){n||E(e,w(ue(t.options.title||P(e))));let r=await e.queue.run(t.url,{method:t.method,body:t.body,navigate:t.options.navigate});if(e.session!==t||r.kind===`aborted`||r.kind===`stale`)return`aborted`;if(r.kind===`session`)return`session`;if((r.kind===`ok`||r.kind===`validation`)&&F(e,t,r.html,!1))return e.loadedUrl=t.url,A(e,e.shell,`loaded`,{url:t.url,handle:t.handle}),`loaded`;let i=r.kind===`ok`||r.kind===`validation`?`server`:r.kind;return E(e,w(de(t.options.title||P(e),i))),O(e)&&k(T(e),!1,C(e)),A(e,e.shell,`error`,{url:t.url,kind:i,status:r.status}),`error`}var P=e=>T(e)?.querySelector(`.wui-modal-title`)?.textContent||e.shell.getAttribute(`aria-label`)||``,Ce=`/_content/Webority.Ui.Razor/js/`,we=e=>new URL(e,window.location.href).pathname.includes(Ce);function Te(e){if([...document.scripts].some(t=>t.getAttribute(`src`)===e))return;let t=document.createElement(`script`);t.src=e,document.head.appendChild(t)}function F(e,r,i,a){let o=document.createElement(`template`);o.innerHTML=i;let s=!1;for(let e of o.content.querySelectorAll(`script`)){if(e.getAttribute(`type`)===`application/json`)continue;let t=e.getAttribute(`src`);e.remove(),t&&we(t)?Te(t):s=!0}s&&t(`WUI.modal: ${r.url} returned a fragment with script; it was removed. Keep page behaviour in the page.`);let c=o.content.querySelector(v);if(!c)return n(`WUI.modal: ${r.url} did not answer with an <app-modal-content> fragment.`),!1;E(e,c),a||_e(e),S(e.shell,r.explicitSize||M(e,c.getAttribute(`data-wui-size`))||e.defaultSize);let l=c.getAttribute(`data-wui-title`);return l&&e.shell.setAttribute(`aria-label`,l),O(e)&&k(c,a,C(e)),!0}var Ee=`button[type="submit"], button:not([type]), input[type="submit"], input[type="image"]`;function De(e,t,n){let r=[...e.elements].filter(e=>e.matches(Ee));if(n){e.setAttribute(`data-wui-submitting`,``);let n=t&&r.includes(t)?t:r[0];for(let e of r)e.toggleAttribute(`data-wui-was-disabled`,e.disabled),e.disabled=!0;n&&(n.classList.add(`is-loading`),n.setAttribute(`aria-busy`,`true`),n.tagName===`BUTTON`&&n.insertAdjacentHTML(`afterbegin`,`<span class="spinner-border spinner-border-sm me-2" aria-hidden="true" data-wui-submit-spinner></span>`));return}e.removeAttribute(`data-wui-submitting`);for(let e of r)e.disabled=e.hasAttribute(`data-wui-was-disabled`),e.removeAttribute(`data-wui-was-disabled`),e.classList.remove(`is-loading`),e.removeAttribute(`aria-busy`),e.querySelector(`[data-wui-submit-spinner]`)?.remove()}function Oe(e,t,n){let r=t.closest(`.wui-modal-body`)||t;r.querySelector(`[data-wui-modal-submit-error]`)?.remove();let i=document.createElement(`div`);i.className=`alert alert-danger wui-modal-submit-error`,i.setAttribute(`role`,`alert`),i.setAttribute(`data-wui-modal-submit-error`,``),i.textContent=`${p.submitFailed} ${p[n]||p.server}`,r.prepend(i),ge(e,i.textContent)}var ke=(e,t)=>{let n=new URL(e,window.location.href);for(let[e,r]of t)typeof r==`string`&&n.searchParams.append(e,r);return n.origin===window.location.origin?n.pathname+n.search:n.href};async function Ae(e,t){let n=t.target,r=e.session;if(!(n instanceof HTMLFormElement)||!r||n.hasAttribute(`data-wui-native`)||!n.closest(v)||(t.preventDefault(),n.hasAttribute(`data-wui-submitting`)))return;let i=t.submitter||null,a=i?.getAttribute(`formaction`)||n.getAttribute(`action`)||r.url,o=(i?.getAttribute(`formmethod`)||n.getAttribute(`method`)||`GET`).toUpperCase(),s=new FormData(n);i?.name&&!s.has(i.name)&&s.append(i.name,i.value);let c=o===`GET`;De(n,i,!0);let l=await e.queue.run(c?ke(a,s):a,{method:o,body:c?void 0:s,navigate:r.options.navigate});if(e.session===r){if(n.isConnected&&De(n,i,!1),l.kind===`ok`&&l.result===`success`){je(e,r,l);return}if(!(l.kind===`aborted`||l.kind===`stale`||l.kind===`session`)){if(l.kind===`validation`&&F(e,r,l.html,!0)){let t=T(e).querySelector(_)?.textContent.replace(/\s+/g,` `).trim();ge(e,t||p.invalid);return}l.kind===`ok`&&l.html&&F(e,r,l.html,!1)||Oe(e,n,l.kind===`ok`||l.kind===`validation`?`server`:l.kind)}}}function je(e,t,n){let r=n.message,i=n.redirect||null,a={url:t.url,trigger:t.trigger,handle:t.handle,message:r,redirect:i,data:n.data??null,container:e.container};if(r&&window.WUI?.toast?.(r,{variant:`success`}),A(e,t.trigger?.isConnected?t.trigger:document,`success`,a),t.options.onSuccess?.(a,t.handle),i&&(t.options.navigate||(e=>window.location.assign(e)))(i),n.next&&!i){t.url=n.next,t.method=`GET`,t.body=void 0,N(e,t);return}if(n.keepOpen){n.html&&F(e,t,n.html,!1);return}j(e,t,`success`,a)}function Me(e){let t=e.target.closest?.(`[data-wui-modal], [data-wui-drawer]`);if(t&&!(t.matches(`a[href]`)&&(e.ctrlKey||e.metaKey||e.shiftKey||e.button!==0))){if(e.preventDefault(),!t.hasAttribute(`data-wui-modal`)){Fe(t.getAttribute(`data-wui-drawer`),{size:t.getAttribute(`data-wui-drawer-size`)||void 0,title:t.getAttribute(`data-wui-title`)||void 0,trigger:t}).catch(e=>{e?.name!==`AbortError`&&n(e)});return}I(t.getAttribute(`data-wui-modal`),{size:t.getAttribute(`data-wui-size`)||void 0,title:t.getAttribute(`data-wui-title`)||void 0,trigger:t}).catch(e=>{e?.name!==`AbortError`&&n(e)})}}function Ne(e){if(e.key!==`Tab`||e.defaultPrevented)return;let t=e.currentTarget.querySelectorAll(`.modal.show`),n=t[t.length-1];n&&he(n,e)}function Pe(e=document){let t=e.ownerDocument||e;ne.has(t)||(ne.add(t),t.addEventListener(`click`,Me),t.addEventListener(`keydown`,Ne));let n=[...e.querySelectorAll?.(`.modal[data-wui-remote-url]`)||[]];e.matches?.(`.modal[data-wui-remote-url]`)&&n.unshift(e);for(let e of n)ye(e)}function I(e,t={}){try{if(!e)throw TypeError(`WUI.modal.load: a fragment url is required.`);let n=re(e),r=t.container===`drawer`,i=r?oe(t.size):x(t.size),a=t.placement||`center`;if(!ae.includes(a))throw TypeError(`WUI.modal.load: unsupported placement "${a}". Use center or top.`);if(t.signal?.aborted)return Promise.reject(y());let o=ce(r?`drawer`:`modal`);Pe(document);let s=ye(o),c=O(s),l=be(s,e,t);l.explicitSize=i,S(o,i||s.defaultSize),r||o.querySelector(`.modal-dialog`).classList.toggle(`modal-dialog-centered`,a===`center`),t.title&&o.setAttribute(`aria-label`,t.title),c||(n.getInstance(o)?.dispose(),n.getOrCreateInstance(o,{backdrop:!t.staticBackdrop||`static`,keyboard:!t.staticBackdrop}));let u=c?Promise.resolve():new Promise(e=>o.addEventListener(`shown.bs.modal`,()=>e(),{once:!0})),d=N(s,l);c||n.getOrCreateInstance(o).show();let f=new Promise((e,n)=>{t.signal?.addEventListener(`abort`,()=>{s.session===l&&(s.queue.abort(),j(s,l,`dismissed`,{aborted:!0})),n(y())},{once:!0})}),p=Promise.all([u,d]).then(([,t])=>{if(t===`aborted`)throw y();if(t===`session`)throw Error(`WUI.modal.load(${e}): the session expired; the browser is signing in again.`);return l.handle});return Promise.race([p,f])}catch(e){return Promise.reject(e)}}function Fe(e,t={}){return I(e,{...t,container:`drawer`,placement:void 0})}var Ie=Object.freeze([`neutral`,`primary`,`info`,`success`,`warning`,`danger`]),L=Object.freeze([`number`,`currency`,`compact`]),Le=`wui-kanban:`,Re=`(max-width: 767.98px)`,ze=400,Be=6,R=Object.freeze({help:`Press Space to pick up the card. Use the Left and Right arrow keys to choose a column, then Space to drop it, or Escape to cancel.`,empty:`Nothing here`,collapse:e=>`Collapse ${e}`,expand:e=>`Expand ${e}`,lifted:(e,t)=>`Picked up ${e} in ${t}. Use the Left and Right arrow keys to choose a column.`,over:(e,t)=>`${e}, ${t===1?`1 card`:`${t} cards`}. Drop allowed.`,overSource:e=>`${e}, where the card started.`,overRefused:(e,t)=>`${e}. ${t}`,dropHere:(e,t)=>`Drop here to move ${e} to ${t}.`,refused:(e,t)=>`Cards in ${e} cannot move to ${t}.`,moved:(e,t)=>`Moved ${e} to ${t}.`,saving:(e,t)=>`Moving ${e} to ${t}.`,cancelled:e=>`${e} was not moved.`,rolledBack:(e,t)=>`${e} went back to ${t}.`,locked:e=>`${e} cannot be moved.`,more:e=>`Show ${e} more`,fewer:`Show fewer`,swipeHint:`Swipe sideways or tap a column`,busy:`This card is still saving. Try again in a moment.`,failed:Object.freeze({forbidden:`You do not have permission to move this card.`,client:`This card could not be moved. Refresh the board and try again.`,validation:`This card could not be moved. Refresh the board and try again.`,server:`Something went wrong on our side, so the card went back. Try again in a moment.`,network:`Could not reach the server, so the card went back. Check your connection and try again.`})}),z=`[data-wui-column]`,B=`[data-wui-body]`,V=`[data-wui-card]`,Ve=`[data-wui-count]`,He=`[data-wui-summary]`,Ue=`[data-wui-empty]`,We=`[data-wui-drop-note]`,Ge=`[data-wui-live]`,Ke=`[data-wui-help]`,H=`[data-wui-switch]`,qe=`[data-wui-scroller]`,Je=`[data-wui-collapse]`,Ye=`[data-wui-more]`,Xe=`data-wui-visible-limit`,U=`data-wui-overflow`,Ze=`input, select, textarea, [contenteditable=""], [contenteditable="true"], [data-wui-no-drag]`,W=48,G=16,K=e=>e.getAttribute(`data-wui-column`),q=e=>e.getAttribute(`data-wui-card`),J=e=>e.hidden||e.hasAttribute(`hidden`),Qe=e=>J(e)||e.hasAttribute(U);function $e(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:Number(e);if(!Number.isInteger(t)||t<1)throw TypeError(`Unsupported kanban visible limit "${String(e)}". Use a whole number of 1 or more.`);return t}function et(e,t,n,r){let i=new Set;if(t==null||n)return i;let a=0;for(let n of e)r.has(n)||(a<t?a++:i.add(n));return i}function Y(e){let t=(e.getAttribute(`aria-label`)||e.textContent||``).replace(/\s+/g,` `).trim();return t.length>80?`${t.slice(0,79)}…`:t||q(e)||`Card`}function X(e){return e?`${Le}${e}`:null}function Z(e,t=globalThis.localStorage){let n=X(e);if(!n||!t)return{};try{let e=JSON.parse(t.getItem(n)||`null`);return e&&typeof e.collapsed==`object`&&e.collapsed?e.collapsed:{}}catch{return{}}}function tt(e,t,n,r=globalThis.localStorage){let i=X(e);if(!i||!r)return;let a={...Z(e,r),[t]:!!n};try{r.setItem(i,JSON.stringify({collapsed:a}))}catch{}}function nt(e,t){if(!L.includes(e))throw TypeError(`Unsupported kanban summary format "${String(e)}". Use ${L.join(`, `)}.`);if(t!=null&&t!==``&&!i.includes(t))throw TypeError(`Unsupported kanban summary unit "${String(t)}". Use ${i.join(`, `)}.`);return e===`currency`?{style:`currency`,unit:t||`rupees`}:e===`compact`?{style:`compact`,currency:a[0],unit:t||`rupees`}:{style:`number`,decimals:0}}function Q(e){let t=0;for(let n of e){if(n==null||n===``)continue;let e=typeof n==`number`?n:Number(n);Number.isFinite(e)&&(t+=e)}return t}var $=(e,t)=>{e&&window.WUI?.toast?.(e,{variant:t})},rt=class extends e{constructor(){super(),this._wired=!1,this._filter=null,this._expanded=new Set,this._revealed=new Set,this._press=null,this._drag=null,this._kbd=null,this._suppressClick=!1,this._observer=null,this._refreshQueued=!1,this._scrollTimer=0,this._onPointerMove=e=>this._pointerMove(e),this._onPointerUp=e=>this._pointerUp(e),this._onPointerCancel=()=>this._endPointer(!1),this._onDocKeyDown=e=>{e.key===`Escape`&&this._drag&&(e.preventDefault(),this._endPointer(!1))},this._onScroll=()=>{clearTimeout(this._scrollTimer),this._scrollTimer=setTimeout(()=>this._syncSwitcherFromScroll(),80)}}_controlled(){return this.hasAttribute(`controlled`)}connectedCallback(){if(!this._wired){this._wired=!0,this.addEventListener(`pointerdown`,e=>this._pointerDown(e)),this.addEventListener(`keydown`,e=>this._keyDown(e)),this.addEventListener(`click`,e=>this._click(e),!0),this.addEventListener(`dragstart`,e=>{e.target.closest?.(V)&&e.preventDefault()}),this.addEventListener(`touchmove`,e=>{this._drag&&e.preventDefault()},{passive:!1}),this._scroller()?.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._restoreCollapsed();for(let e of this._allCards())this._prepareCard(e);if(typeof MutationObserver==`function`){this._observer=new MutationObserver(e=>{for(let t of e)for(let e of t.addedNodes)e.nodeType===1&&e.matches(V)&&this._prepareCard(e);this._queueRefresh()});for(let e of this.querySelectorAll(B))this._observer.observe(e,{childList:!0})}this.refresh()}}disconnectedCallback(){this._endPointer(!1),this._observer?.disconnect(),this._observer=null,this._scroller()?.removeEventListener(`scroll`,this._onScroll),clearTimeout(this._scrollTimer),this._wired=!1}setFilter(e){if(e!=null&&typeof e!=`function`)throw TypeError(`wui-kanban setFilter: pass a function or null.`);if(this._filter=e,!e)for(let e of this._allCards())e.hidden=!1;this.refresh()}refresh(){if(this._controlled())return;this._refreshQueued=!1;let e=this._summaryFormat();for(let t of this._columns()){let n=K(t),i=$e(t.getAttribute(Xe)),a=[],o=[];for(let e of this._cardsIn(t)){if(this._filter&&(e.hidden=this._filter(e)===!1),J(e)){e.removeAttribute(U);continue}a.push(e),o.push(e.getAttribute(`data-wui-value`))}let s=this._expanded.has(n),c=et(a.map(q),i,s,this._revealed);for(let e of a)e.toggleAttribute(U,c.has(q(e)));let l=String(a.length);for(let e of this._countsOf(t))e.textContent!==l&&(e.textContent=l);let u=t.querySelector(Ue);if(u&&(u.hidden=a.length>0),e){let n=t.querySelector(He);n&&(n.textContent=r(Q(o),e))}let d=t.querySelector(Ye);if(d){d.hidden=i==null||(s?a.length<=i:c.size===0),d.setAttribute(`aria-expanded`,s?`true`:`false`);let e=s?R.fewer:R.more(c.size);d.textContent!==e&&(d.textContent=e)}}}moveCard(e,t,n){let r=this._cardByKey(e);if(!r)throw Error(`wui-kanban moveCard: no card "${String(e)}" on this board.`);if(!this._columnByKey(t))throw Error(`wui-kanban moveCard: no column "${String(t)}" on this board.`);return this._commit(r,t,n)}_columns(){return[...this.querySelectorAll(z)]}_columnByKey(e){return this._columns().find(t=>K(t)===e)||null}_columnOf(e){return e.closest(z)}_titleOf(e){return(e.querySelector(`.wui-kanban-title`)?.textContent||K(e)||``).replace(/\s+/g,` `).trim()}_bodyOf(e){return e.querySelector(B)}_cardsIn(e){let t=this._bodyOf(e);return t?[...t.children].filter(e=>e.matches(V)):[]}_visibleCardsIn(e){return this._cardsIn(e).filter(e=>!Qe(e))}_allCards(){return[...this.querySelectorAll(`${B} > ${V}`)]}_cardByKey(e){return this._allCards().find(t=>q(t)===e)||null}_countsOf(e){let t=K(e),n=[...this.querySelectorAll(H)].filter(e=>e.getAttribute(`data-wui-switch`)===t);return[...e.querySelectorAll(Ve),...n.flatMap(e=>[...e.querySelectorAll(Ve)])]}_scroller(){return this.querySelector(qe)}_summaryFormat(){let e=this.getAttribute(`summary-format`);return e?nt(e,this.getAttribute(`summary-unit`)):null}_queueRefresh(){this._refreshQueued||(this._refreshQueued=!0,queueMicrotask(()=>{this._refreshQueued&&this.refresh()}))}_prepareCard(e){let t=this.querySelector(Ke);t?.id&&!e.hasAttribute(`aria-describedby`)&&e.setAttribute(`aria-describedby`,t.id),e.hasAttribute(`tabindex`)||(e.tabIndex=0)}_announce(e){let t=this.querySelector(Ge);!t||!e||(t.textContent=``,t.textContent=e)}_fire(e,t,n=!1){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,cancelable:n,detail:t}))}_canLift(e){let t=Y(e),n=this.hasAttribute(`readonly`);return n||e.hasAttribute(`data-wui-locked`)?(this._announce(R.locked(t)),this._fire(`wui:kanban:locked`,{key:q(e),card:e,reason:n?`readonly`:`locked`},!0),!1):e.getAttribute(`aria-busy`)===`true`?(this._announce(R.busy),$(R.busy,`info`),!1):!0}_check(e,t,n){if(t===n)return{ok:!1,source:!0,reason:null};let r=this._columnByKey(t),i=this._columnByKey(n),a=R.refused(r?this._titleOf(r):t,i?this._titleOf(i):n),o=i?.getAttribute(`data-accept-from`);if(o!=null&&!o.split(/\s+/).filter(Boolean).includes(t))return{ok:!1,reason:a};if(typeof this.accept==`function`){let r=this.accept(e,t,n);if(r===!1)return{ok:!1,reason:a};if(typeof r==`string`&&r)return{ok:!1,reason:r}}return{ok:!0,reason:null}}_markTargets(e,t){let n=Y(e),r=new Map;for(let i of this._columns()){let a=K(i),o=this._check(e,t,a);r.set(a,o),i.setAttribute(`data-wui-drop`,o.source?`source`:o.ok?`ok`:`refused`);let s=i.querySelector(We);s&&!o.source&&(s.textContent=o.ok?R.dropHere(n,this._titleOf(i)):o.reason,s.hidden=!1)}return r}_clearTargets(){for(let e of this._columns()){e.removeAttribute(`data-wui-drop`),e.removeAttribute(`data-wui-over`),e.removeAttribute(`data-wui-target`);let t=e.querySelector(We);t&&(t.hidden=!0,t.textContent=``)}}async _commit(e,t,n){let r=this._columnOf(e),i=K(r),a=this._columnByKey(t),s=Y(e);if(i===t||!this._canLift(e))return!1;let c=this._check(e,i,t);if(!c.ok)return this._announce(c.reason),$(c.reason,`info`),!1;let l=this._cardsIn(a),u=Number.isInteger(n)?Math.max(0,Math.min(n,l.length)):l.length,d={key:q(e),card:e,from:i,to:t,index:u},f=e.contains(document.activeElement);if(this._controlled())return this._fire(`wui:kanban:move`,d),this._announce(R.moved(s,this._titleOf(a))),f&&this._refocusSoon(d.key),!0;if(!this._fire(`wui:kanban:move`,d,!0))return!1;let p=a.hasAttribute(Xe)&&!this._revealed.has(d.key);p&&this._revealed.add(d.key);let m={parent:e.parentNode,next:e.nextSibling,column:r,revealed:p};this._bodyOf(a).insertBefore(e,l[u]||null),f&&this._focusMoved(e),this.refresh();let h=a.getAttribute(`data-wui-step`);if(h)return this._runStep(e,d,m,h,a.getAttribute(`data-wui-step-size`));let g=this.getAttribute(`move-url`);if(!g)return this._announce(R.moved(s,this._titleOf(a))),this._fire(`wui:kanban:moved`,{...d,result:null}),!0;this._lock(e,!0),this._announce(R.saving(s,this._titleOf(a)));let _=await o(g,{method:`POST`,body:new URLSearchParams({card:d.key,from:i,to:t,index:String(u)})});if(this._lock(e,!1),_.kind===`session`)return!1;if(_.ok){let t=this._applyFragment(_.html)||e;return $(_.message,`success`),this._announce(R.moved(Y(t),this._titleOf(a))),this._fire(`wui:kanban:moved`,{...d,card:t,result:_}),!0}return this._rollback(e,m),_.kind!==`aborted`&&$(_.message||R.failed[_.kind]||R.failed.server,`danger`),this._fire(`wui:kanban:failed`,{...d,kind:_.kind,status:_.status,message:_.message}),!1}async _runStep(e,t,n,r,i){let a=Y(e),s=this._columnByKey(t.to),c=new URLSearchParams({card:t.key,from:t.from,to:t.to}).toString(),l=r+(r.includes(`?`)?`&`:`?`)+c;this._lock(e,!0);let u;try{u=await(await I(l,{trigger:e,size:i||void 0})).closed}catch(r){return this._lock(e,!1),this._rollback(e,n),r?.name!==`AbortError`&&$(R.failed.server,`danger`),this._fire(`wui:kanban:failed`,{...t,kind:`step`,status:0,message:r?.message??null}),!1}if(u?.status!==`success`)return this._lock(e,!1),this._rollback(e,n),this._announce(R.cancelled(a)),this._fire(`wui:kanban:failed`,{...t,kind:`dismissed`,status:0,message:null}),!1;let d=e,f=this.getAttribute(`card-url`);if(f){let n=await o(`${f}${f.includes(`?`)?`&`:`?`}${new URLSearchParams({card:t.key})}`);n.ok&&(d=this._applyFragment(n.html)||e)}return this._lock(d,!1),this._announce(R.moved(Y(d),this._titleOf(s))),this._fire(`wui:kanban:moved`,{...t,card:d,result:u}),!0}_lock(e,t){t?(e.setAttribute(`aria-busy`,`true`),e.setAttribute(`data-wui-saving`,``)):(e.removeAttribute(`aria-busy`),e.removeAttribute(`data-wui-saving`))}_rollback(e,t){let n=e.contains(document.activeElement),r=t.next&&t.next.parentNode===t.parent?t.next:null;t.revealed&&this._revealed.delete(q(e)),t.parent.insertBefore(e,r),n&&e.focus(),this.refresh(),this._announce(R.rolledBack(Y(e),this._titleOf(t.column)))}_applyFragment(e){if(!e)return null;let n=document.createElement(`template`);n.innerHTML=e;for(let e of n.content.querySelectorAll(`script`))t(`[@webority/ui-elements] A kanban fragment carried a script tag; it was removed, not run.`),e.remove();let r=null;for(let e of[...n.content.querySelectorAll(V)]){if(e.closest(`template`))continue;let t=this._cardByKey(q(e));if(!t)continue;let n=t.contains(document.activeElement);t.dispatchEvent(new CustomEvent(`wui:teardown`,{bubbles:!0})),t.hidden&&(e.hidden=!0),t.replaceWith(e),this._prepareCard(e),n&&e.focus(),r??=e}for(let e of n.content.querySelectorAll(`template[data-wui-kanban-summary]`))this._columnByKey(e.getAttribute(`data-wui-kanban-summary`))?.querySelector(He)?.replaceChildren(e.content.cloneNode(!0));return this.refresh(),window.WUI?.refresh?.(),r}_refocusSoon(e){let t=()=>{let t=this._cardByKey(e);t&&this._focusMoved(t)};typeof requestAnimationFrame==`function`?requestAnimationFrame(t):setTimeout(t,0)}_focusMoved(e){e.focus({preventScroll:!0}),e.scrollIntoView?.({block:`nearest`})}_pointerDown(e){if(e.button!==0||e.isPrimary===!1||this._drag||this._kbd)return;let t=e.target.closest?.(V);if(!t||!this.contains(t)||e.target.closest(Ze))return;let n={card:t,id:e.pointerId,x:e.clientX,y:e.clientY,type:e.pointerType,timer:0};this._press=n,e.pointerType===`touch`&&(n.timer=setTimeout(()=>{this._press===n&&this._startDrag(n,n.x,n.y)},400)),window.addEventListener(`pointermove`,this._onPointerMove),window.addEventListener(`pointerup`,this._onPointerUp),window.addEventListener(`pointercancel`,this._onPointerCancel)}_pointerMove(e){let t=this._press;if(!(!t||e.pointerId!==t.id)){if(!this._drag){if(!(Math.hypot(e.clientX-t.x,e.clientY-t.y)>6))return;if(t.type===`touch`){this._endPointer(!1);return}if(this._startDrag(t,e.clientX,e.clientY),!this._drag)return}this._dragTo(e.clientX,e.clientY)}}_pointerUp(e){!this._press||e.pointerId!==this._press.id||this._endPointer(!!this._drag)}_startDrag(e,t,n){let r=e.card;if(!this._canLift(r)){this._endPointer(!1);return}let i=K(this._columnOf(r)),a=r.getBoundingClientRect(),o=r.cloneNode(!0);for(let e of[o,...o.querySelectorAll(`[id]`)])e.removeAttribute(`id`);o.removeAttribute(`data-wui-card`),o.removeAttribute(`tabindex`),o.setAttribute(`aria-hidden`,`true`),o.classList.add(`wui-kanban-ghost`),o.style.width=`${a.width}px`,this.appendChild(o),r.setAttribute(`data-wui-dragging`,``),this.setAttribute(`data-wui-dragging`,``),this._drag={card:r,from:i,ghost:o,dx:t-a.left,dy:n-a.top,over:null,verdicts:this._markTargets(r,i)},this._announce(R.lifted(Y(r),this._titleOf(this._columnOf(r)))),document.addEventListener(`keydown`,this._onDocKeyDown),this._dragTo(t,n)}_dragTo(e,t){let n=this._drag;n.x=e,n.y=t,n.ghost.style.transform=`translate(${e-n.dx}px, ${t-n.dy}px)`;let r=this._columnAt(e,t);r!==n.over&&(n.over?.removeAttribute(`data-wui-over`),r?.setAttribute(`data-wui-over`,``),n.over=r),this._autoScroll(e,t,r)}_columnAt(e,t){for(let n of this._columns()){let r=n.getBoundingClientRect();if(e>=r.left&&e<=r.right&&t>=r.top&&t<=r.bottom)return n}return null}_indexAt(e,t){let n=this._visibleCardsIn(e).filter(e=>e!==this._drag?.card).find(e=>{let n=e.getBoundingClientRect();return t<n.top+n.height/2}),r=this._cardsIn(e).filter(e=>e!==this._drag?.card);return n?r.indexOf(n):r.length}_autoScroll(e,t,n){let r=this._scroller();if(r){let t=r.getBoundingClientRect();t.width>0&&(e<t.left+W?r.scrollBy?.({left:-16}):e>t.right-W&&r.scrollBy?.({left:G}))}if(n&&this._scrollColumn(n,t))return;let i=window.innerHeight||0;i>0&&(t<W?window.scrollBy?.({top:-16}):t>i-W&&window.scrollBy?.({top:G}))}_scrollColumn(e,t){let n=this._bodyOf(e);if(!n||e.hasAttribute(`data-collapsed`)||n.scrollHeight<=n.clientHeight)return!1;let r=n.getBoundingClientRect();return t<r.top+W&&n.scrollTop>0?(n.scrollBy?.({top:-16}),!0):t>r.bottom-W&&n.scrollTop+n.clientHeight<n.scrollHeight-1?(n.scrollBy?.({top:G}),!0):!1}_endPointer(e){let t=this._press,n=this._drag;if(t&&clearTimeout(t.timer),this._press=null,this._drag=null,window.removeEventListener(`pointermove`,this._onPointerMove),window.removeEventListener(`pointerup`,this._onPointerUp),window.removeEventListener(`pointercancel`,this._onPointerCancel),document.removeEventListener(`keydown`,this._onDocKeyDown),!n)return;n.ghost.remove(),n.card.removeAttribute(`data-wui-dragging`),this.removeAttribute(`data-wui-dragging`),this._suppressClick=!0,setTimeout(()=>{this._suppressClick=!1},0);let r=n.over;if(this._clearTargets(),!e||!r){this._announce(R.cancelled(Y(n.card)));return}let i=K(r),a=n.verdicts.get(i);if(a?.source){this._announce(R.cancelled(Y(n.card)));return}if(!a?.ok){this._announce(a?.reason),$(a?.reason,`info`);return}this._commit(n.card,i,this._indexAt(r,n.y))}_click(e){if(this._suppressClick&&e.target.closest?.(V)){e.preventDefault(),e.stopPropagation(),this._suppressClick=!1;return}let t=e.target.closest?.(Je);if(t&&this.contains(t)){let e=t.closest(z);e&&this._setCollapsed(e,!e.hasAttribute(`data-collapsed`),!0);return}let n=e.target.closest?.(Ye);if(n&&this.contains(n)){this._controlled()||this._toggleMore(n.closest(z));return}let r=e.target.closest?.(H);r&&this.contains(r)&&this._showColumn(r.getAttribute(`data-wui-switch`))}_keyDown(e){if(this._kbd){this._liftedKey(e);return}let t=e.target;if(!t.matches?.(V)||!this.contains(t))return;let n=this._columnOf(t);switch(e.key){case` `:case`Spacebar`:{if(e.preventDefault(),!this._canLift(t))return;let r=K(n),i=this._columns();this._kbd={card:t,from:r,target:i.indexOf(n),verdicts:this._markTargets(t,r)},t.setAttribute(`data-wui-lifted`,``),this.setAttribute(`data-wui-dragging`,``),n.setAttribute(`data-wui-target`,``),this._announce(R.lifted(Y(t),this._titleOf(n)));return}case`ArrowDown`:case`ArrowUp`:{let r=this._visibleCardsIn(n),i=r[r.indexOf(t)+(e.key===`ArrowDown`?1:-1)];i&&(e.preventDefault(),i.focus());return}case`ArrowLeft`:case`ArrowRight`:{let t=this._columns(),r=e.key===`ArrowRight`?1:-1;for(let i=t.indexOf(n)+r;i>=0&&i<t.length;i+=r){let n=this._visibleCardsIn(t[i])[0];if(n&&!t[i].hasAttribute(`data-collapsed`)){e.preventDefault(),n.focus();return}}return}default:}}_liftedKey(e){let t=this._kbd,n=this._columns();switch(e.key){case`ArrowLeft`:case`ArrowRight`:{e.preventDefault();let r=t.target+(e.key===`ArrowRight`?1:-1);if(r<0||r>=n.length)return;n[t.target]?.removeAttribute(`data-wui-target`),t.target=r;let i=n[r];i.setAttribute(`data-wui-target`,``),this._showColumn(K(i),!1);let a=t.verdicts.get(K(i)),o=this._titleOf(i);this._announce(a.source?R.overSource(o):a.ok?R.over(o,this._cardsIn(i).filter(e=>!J(e)).length):R.overRefused(o,a.reason));return}case` `:case`Spacebar`:case`Enter`:{e.preventDefault();let r=n[t.target],i=K(r),a=t.verdicts.get(i);if(!a.source&&!a.ok){this._announce(a.reason);return}this._endKeyboard(),a.source?this._announce(R.cancelled(Y(t.card))):this._commit(t.card,i);return}case`Escape`:case`Tab`:e.key===`Escape`&&e.preventDefault(),this._endKeyboard(),this._showColumn(t.from,!1),this._announce(R.cancelled(Y(t.card)));return;default:}}_endKeyboard(){let e=this._kbd;this._kbd=null,e&&(e.card.removeAttribute(`data-wui-lifted`),this.removeAttribute(`data-wui-dragging`),this._clearTargets())}_restoreCollapsed(){let e=Z(this.getAttribute(`board-id`));for(let t of this._columns()){let n=K(t);t.hasAttribute(`data-collapsible`)&&Object.hasOwn(e,n)&&this._setCollapsed(t,e[n],!1)}}_setCollapsed(e,t,n){let r=K(e);e.toggleAttribute(`data-collapsed`,t);let i=this._titleOf(e);for(let n of e.querySelectorAll(Je))n.setAttribute(`aria-expanded`,t?`false`:`true`),n.setAttribute(`aria-label`,t?R.expand(i):R.collapse(i));n&&(tt(this.getAttribute(`board-id`),r,t),this._fire(`wui:kanban:collapse`,{column:r,collapsed:t}))}_toggleMore(e){if(!e)return;let t=K(e);if(this._expanded.delete(t))for(let t of this._cardsIn(e))this._revealed.delete(q(t));else this._expanded.add(t);this.refresh()}_isPhone(){return typeof matchMedia==`function`&&matchMedia(`(max-width: 767.98px)`).matches}_showColumn(e,t=!0){for(let t of this.querySelectorAll(H))t.getAttribute(`data-wui-switch`)===e?t.setAttribute(`aria-current`,`true`):t.removeAttribute(`aria-current`);let n=this._columnByKey(e),r=this._scroller();if(!n||!r||!t&&!this._isPhone())return;let i=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches;r.scrollTo?.({left:n.offsetLeft-r.offsetLeft,behavior:i?`auto`:`smooth`})}_syncSwitcherFromScroll(){let e=this._scroller();if(!e||!this._isPhone())return;let t=e.clientWidth||1,n=this._columns()[Math.round(e.scrollLeft/t)];if(n)for(let e of this.querySelectorAll(H))e.getAttribute(`data-wui-switch`)===K(n)?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`)}};export{f as _,L as a,I as b,rt as c,X as d,nt as f,tt as g,Q as h,Le as i,Y as l,Z as m,ze as n,R as o,$e as p,Re as r,Ie as s,Be as t,et as u,Pe as v,Fe as y};
1
+ import{t as e}from"./elementBase-DV9IZZCu.js";import{n as t,t as n}from"./devWarn-DXdRWZs3.js";import{m as r,s as i,t as a}from"./formatters-BAE__8ye.js";import{c as o,o as s}from"./wuiHttp-DJ1oIvtB.js";var c=`wui-remote-modal`,l=`wui-remote-drawer`,u=Object.freeze({sm:360,md:480,lg:640}),d=`wui-modal-fullscreen`,f=Object.freeze({sm:380,md:440,lg:640,xl:880}),p=Object.freeze({loading:`Loading`,close:`Close`,retry:`Try again`,errorTitle:`This could not be loaded`,forbidden:`You do not have access to this.`,client:`It may have been moved or deleted.`,server:`Something went wrong on our side. Try again in a moment.`,network:`Could not reach the server. Check your connection and try again.`,submitFailed:`Your changes were not saved.`,invalid:`Some fields need attention.`}),m=`a[href],button:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,h=`input:not([type="hidden"]):not([disabled]),select:not([disabled]),textarea:not([disabled]),[contenteditable="true"]`,g=`[aria-invalid="true"], .is-invalid, .input-validation-error`,_=`.wui-error-summary, [data-wui-form-errors], .validation-summary-errors, [data-valmsg-summary]`,v=`[data-wui-modal-content]`,ee=`<button type="button" class="wui-modal-close" data-bs-dismiss="modal" aria-label="Close"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18M6 6l12 12"></path></svg></button>`,te=new WeakMap,ne=new WeakSet,y=()=>Object.assign(Error(`The remote modal load was aborted.`),{name:`AbortError`}),re=e=>{let t=window.bootstrap?.Modal;if(!t)throw Error(`WUI.modal.load(${String(e)}): Bootstrap's bundle (window.bootstrap) is not loaded on this page.`);return t},b=e=>{let t=document.createElement(`span`);return t.textContent=e??``,t.innerHTML};function x(e){if(e==null||e===``)return null;if(e===`fullscreen`)return{fullscreen:!0};if(Object.hasOwn(f,e))return{px:f[e]};let t=typeof e==`number`?e:/^\d+$/.test(String(e))?Number(e):NaN;if(Number.isInteger(t)&&t>0)return{px:t};throw TypeError(`Unsupported modal size "${String(e)}". Use sm, md, lg, xl, fullscreen or a px number.`)}var ie=e=>{if(e.classList.contains(`wui-modal-fullscreen`))return{fullscreen:!0};let t=Number.parseInt(e.style.getPropertyValue(`--wui-modal-max-width`),10);return{px:t>0?t:f.md}},S=(e,t)=>{e.classList.toggle(d,!!t.fullscreen),t.fullscreen?e.style.removeProperty(`--wui-modal-max-width`):e.style.setProperty(`--wui-modal-max-width`,`${t.px}px`)},ae=[`center`,`top`];function oe(e){if(Object.hasOwn(u,e??``))return{px:u[e]};let t=x(e);if(t?.fullscreen||e===`xl`)throw TypeError(`Unsupported drawer size "${String(e)}". Use sm, md, lg or a px number.`);return t}var C=e=>e.container===`drawer`,se=(e,t)=>C(e)?oe(t):x(t);function ce(e=`modal`){let t=e===`drawer`,n=t?l:c,r=document.getElementById(n);return r||(r=document.createElement(`div`),r.id=n,r.className=t?`modal fade wui-modal-shell wui-remote-drawer`:`modal fade wui-modal-shell`,r.tabIndex=-1,r.setAttribute(`aria-hidden`,`true`),r.setAttribute(`role`,`dialog`),r.setAttribute(`aria-modal`,`true`),r.style.setProperty(`--wui-modal-max-width`,`${t?u.md:f.md}px`),r.innerHTML=t?`<div class="modal-dialog wui-remote-drawer-dialog"><div class="modal-content wui-modal"></div></div>`:`<div class="modal-dialog modal-dialog-centered wui-rb-dialog"><div class="modal-content wui-modal"></div></div>`,document.body.appendChild(r),r)}var le=e=>`<div class="wui-modal-header"><div class="wui-modal-heading"><div class="wui-modal-headtext"><div class="wui-modal-title">${b(e)}</div></div></div>${ee}</div>`,ue=e=>`<div class="modal-content wui-modal" aria-busy="true">${le(e)}<div class="wui-modal-body"><div class="wui-modal-loading" role="status"><span class="visually-hidden">${b(p.loading)}</span><div class="skeleton wui-modal-skeleton"></div><div class="skeleton wui-modal-skeleton"></div><div class="skeleton wui-modal-skeleton wui-modal-skeleton--short"></div></div></div></div>`,de=(e,t)=>`<div class="modal-content wui-modal" data-wui-modal-error="${b(t)}">${le(e)}<div class="wui-modal-body"><div class="wui-modal-state" role="alert"><p class="wui-modal-state-title">${b(p.errorTitle)}</p><p class="wui-modal-state-text">${b(p[t]||p.server)}</p><div class="wui-modal-state-actions"><button type="button" class="btn btn-secondary" data-bs-dismiss="modal">${b(p.close)}</button><button type="button" class="btn btn-primary" data-wui-modal-retry>${b(p.retry)}</button></div></div></div></div>`,w=e=>{let t=document.createElement(`template`);return t.innerHTML=e,t.content.querySelector(`.modal-content`)},T=e=>e.shell.querySelector(`.modal-content`);function fe(e){if(!e)return;e.dispatchEvent(new CustomEvent(`wui:teardown`,{bubbles:!0}));let t=window.bootstrap,n=[t?.Tooltip,t?.Popover,t?.Dropdown].filter(e=>e?.getInstance);for(let t of[e,...e.querySelectorAll(`*`)])for(let e of n)e.getInstance(t)?.dispose()}function E(e,t){let n=T(e),r=n?pe(n):new Map;fe(n),n?n.replaceWith(t):e.shell.querySelector(`.modal-dialog`).appendChild(t),me(t,r),window.WUI?.refresh?.()}var D=`input[type="file"][name]`;function pe(e){let t=new Map;for(let n of e.querySelectorAll(D))n.files.length>0&&t.set(n.name,[...n.files]);return t}function me(e,t){if(!(t.size===0||typeof DataTransfer>`u`))for(let n of e.querySelectorAll(D)){let e=t.get(n.name);if(!e)continue;let r=new DataTransfer;for(let t of e)r.items.add(t);n.files=r.files,n.dispatchEvent(new Event(`change`,{bubbles:!0}))}}var O=e=>e.shell.classList.contains(`show`);function k(e,t,n=!1){let r=t&&e.querySelector(g),i=r?r.matches(m)?r:r.querySelector(m)||r:null;if(!i&&n)i=e.querySelector(`[data-autofocus]`)||e.querySelector(h)||e.querySelector(`.wui-modal-close`);else if(!i){let t=[...e.querySelectorAll(m)];i=e.querySelector(`[data-autofocus]`)||t.find(e=>!e.classList.contains(`wui-modal-close`))||t[0]||e}i?.focus?.()}function he(e,t){let n=[...e.querySelectorAll(m)].filter(e=>e.getClientRects().length>0&&getComputedStyle(e).visibility!==`hidden`);if(!n.length){t.preventDefault(),e.focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;!e.contains(a)||a===e?(t.preventDefault(),(t.shiftKey?i:r).focus()):t.shiftKey&&a===r?(t.preventDefault(),i.focus()):!t.shiftKey&&a===i&&(t.preventDefault(),r.focus())}function ge(e,t){let n=e.shell.querySelector(`[data-wui-modal-live]`);n||(n=document.createElement(`div`),n.className=`visually-hidden`,n.setAttribute(`aria-live`,`assertive`),n.setAttribute(`data-wui-modal-live`,``),e.shell.querySelector(`.modal-dialog`).appendChild(n)),n.textContent=``,n.textContent=t}var _e=e=>{let t=e.shell.querySelector(`[data-wui-modal-live]`);t&&(t.textContent=``)},ve=(e,t,n)=>e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}));function A(e,t,n,r){let i={...r,container:e.container};ve(t,`wui:modal:${n}`,i),C(e)&&ve(t,`wui:drawer:${n}`,i)}function ye(e){let t=te.get(e);return t||(t={shell:e,container:e.classList.contains(`wui-remote-drawer`)?`drawer`:`modal`,queue:s(),defaultSize:ie(e),defaultLabel:e.getAttribute(`aria-label`),placeholder:T({shell:e})?.outerHTML||`<div class="modal-content wui-modal"></div>`,remoteUrl:e.getAttribute(`data-wui-remote-url`),cache:e.getAttribute(`data-wui-remote-cache`)===`true`,loadedUrl:null,session:null},te.set(e,t),e.addEventListener(`submit`,e=>Ae(t,e)),e.addEventListener(`click`,e=>{!e.target.closest?.(`[data-wui-modal-retry]`)||!t.session||(e.preventDefault(),N(t,t.session))}),e.addEventListener(`hidden.bs.modal`,n=>{n.target===e&&xe(t)}),e.addEventListener(`shown.bs.modal`,n=>{let r=T(t);n.target===e&&t.session&&r?.matches(v)&&!r.contains(document.activeElement)&&k(r,!1,C(t))}),t.remoteUrl&&e.addEventListener(`show.bs.modal`,n=>{n.target===e&&Se(t,n)}),t)}function be(e,t,n){e.session&&(e.queue.abort(),e.session.resolveClosed({status:`dismissed`,detail:{replaced:!0}}));let r,i=new Promise(e=>{r=e}),a={url:t,method:(n.method||`GET`).toUpperCase(),body:n.body,options:n,trigger:n.trigger||null,explicitSize:null,closing:null,resolveClosed:r,handle:null};return a.handle={el:e.shell,closed:i,close:()=>j(e,a,`dismissed`,null),reload:()=>N(e,a)},e.session=a,a}function j(e,t,n,r){e.session===t&&(t.closing={status:n,detail:r},window.bootstrap?.Modal?.getOrCreateInstance(e.shell).hide())}function xe(e){let t=e.session;if(e.queue.abort(),e.session=null,_e(e),t){let{status:n,detail:r}=t.closing||{status:`dismissed`,detail:null};t.resolveClosed({status:n,detail:r}),A(e,e.shell,`closed`,{status:n,url:t.url});let i=document.activeElement;t.trigger?.isConnected&&(!i||i===document.body||e.shell.contains(i))&&t.trigger.focus?.()}e.cache||(E(e,w(e.placeholder)),e.loadedUrl=null,S(e.shell,e.defaultSize),e.defaultLabel?e.shell.setAttribute(`aria-label`,e.defaultLabel):e.shell.removeAttribute(`aria-label`))}function Se(e,t){let n=t.relatedTarget instanceof Element?t.relatedTarget:null,r=n?.getAttribute(`data-wui-url`)||e.remoteUrl,i=be(e,r,{trigger:n});i.explicitSize=M(e,n?.getAttribute(`data-wui-size`)),i.explicitSize&&S(e.shell,i.explicitSize),!(e.cache&&e.loadedUrl===r)&&(e.loadedUrl&&E(e,w(e.placeholder)),N(e,i,{keepPlaceholder:!0}))}function M(e,t){try{return se(e,t)}catch(e){return n(e),null}}async function N(e,t,{keepPlaceholder:n=!1}={}){n||E(e,w(ue(t.options.title||P(e))));let r=await e.queue.run(t.url,{method:t.method,body:t.body,navigate:t.options.navigate});if(e.session!==t||r.kind===`aborted`||r.kind===`stale`)return`aborted`;if(r.kind===`session`)return`session`;if((r.kind===`ok`||r.kind===`validation`)&&F(e,t,r.html,!1))return e.loadedUrl=t.url,A(e,e.shell,`loaded`,{url:t.url,handle:t.handle}),`loaded`;let i=r.kind===`ok`||r.kind===`validation`?`server`:r.kind;return E(e,w(de(t.options.title||P(e),i))),O(e)&&k(T(e),!1,C(e)),A(e,e.shell,`error`,{url:t.url,kind:i,status:r.status}),`error`}var P=e=>T(e)?.querySelector(`.wui-modal-title`)?.textContent||e.shell.getAttribute(`aria-label`)||``,Ce=`/_content/Webority.Ui.Razor/js/`,we=e=>new URL(e,window.location.href).pathname.includes(Ce);function Te(e){if([...document.scripts].some(t=>t.getAttribute(`src`)===e))return;let t=document.createElement(`script`);t.src=e,document.head.appendChild(t)}function F(e,r,i,a){let o=document.createElement(`template`);o.innerHTML=i;let s=!1;for(let e of o.content.querySelectorAll(`script`)){if(e.getAttribute(`type`)===`application/json`)continue;let t=e.getAttribute(`src`);e.remove(),t&&we(t)?Te(t):s=!0}s&&t(`WUI.modal: ${r.url} returned a fragment with script; it was removed. Keep page behaviour in the page.`);let c=o.content.querySelector(v);if(!c)return n(`WUI.modal: ${r.url} did not answer with an <app-modal-content> fragment.`),!1;E(e,c),a||_e(e),S(e.shell,r.explicitSize||M(e,c.getAttribute(`data-wui-size`))||e.defaultSize);let l=c.getAttribute(`data-wui-title`);return l&&e.shell.setAttribute(`aria-label`,l),O(e)&&k(c,a,C(e)),!0}var Ee=`button[type="submit"], button:not([type]), input[type="submit"], input[type="image"]`;function De(e,t,n){let r=[...e.elements].filter(e=>e.matches(Ee));if(n){e.setAttribute(`data-wui-submitting`,``);let n=t&&r.includes(t)?t:r[0];for(let e of r)e.toggleAttribute(`data-wui-was-disabled`,e.disabled),e.disabled=!0;n&&(n.classList.add(`is-loading`),n.setAttribute(`aria-busy`,`true`),n.tagName===`BUTTON`&&n.insertAdjacentHTML(`afterbegin`,`<span class="spinner-border spinner-border-sm me-2" aria-hidden="true" data-wui-submit-spinner></span>`));return}e.removeAttribute(`data-wui-submitting`);for(let e of r)e.disabled=e.hasAttribute(`data-wui-was-disabled`),e.removeAttribute(`data-wui-was-disabled`),e.classList.remove(`is-loading`),e.removeAttribute(`aria-busy`),e.querySelector(`[data-wui-submit-spinner]`)?.remove()}function Oe(e,t,n){let r=t.closest(`.wui-modal-body`)||t;r.querySelector(`[data-wui-modal-submit-error]`)?.remove();let i=document.createElement(`div`);i.className=`alert alert-danger wui-modal-submit-error`,i.setAttribute(`role`,`alert`),i.setAttribute(`data-wui-modal-submit-error`,``),i.textContent=`${p.submitFailed} ${p[n]||p.server}`,r.prepend(i),ge(e,i.textContent)}var ke=(e,t)=>{let n=new URL(e,window.location.href);for(let[e,r]of t)typeof r==`string`&&n.searchParams.append(e,r);return n.origin===window.location.origin?n.pathname+n.search:n.href};async function Ae(e,t){let n=t.target,r=e.session;if(!(n instanceof HTMLFormElement)||!r||n.hasAttribute(`data-wui-native`)||!n.closest(v)||(t.preventDefault(),n.hasAttribute(`data-wui-submitting`)))return;let i=t.submitter||null,a=i?.getAttribute(`formaction`)||n.getAttribute(`action`)||r.url,o=(i?.getAttribute(`formmethod`)||n.getAttribute(`method`)||`GET`).toUpperCase(),s=new FormData(n);i?.name&&!s.has(i.name)&&s.append(i.name,i.value);let c=o===`GET`;De(n,i,!0);let l=await e.queue.run(c?ke(a,s):a,{method:o,body:c?void 0:s,navigate:r.options.navigate});if(e.session===r){if(n.isConnected&&De(n,i,!1),l.kind===`ok`&&l.result===`success`){je(e,r,l);return}if(!(l.kind===`aborted`||l.kind===`stale`||l.kind===`session`)){if(l.kind===`validation`&&F(e,r,l.html,!0)){let t=T(e).querySelector(_)?.textContent.replace(/\s+/g,` `).trim();ge(e,t||p.invalid);return}l.kind===`ok`&&l.html&&F(e,r,l.html,!1)||Oe(e,n,l.kind===`ok`||l.kind===`validation`?`server`:l.kind)}}}function je(e,t,n){let r=n.message,i=n.redirect||null,a={url:t.url,trigger:t.trigger,handle:t.handle,message:r,redirect:i,data:n.data??null,container:e.container};if(r&&window.WUI?.toast?.(r,{variant:`success`}),A(e,t.trigger?.isConnected?t.trigger:document,`success`,a),t.options.onSuccess?.(a,t.handle),i&&(t.options.navigate||(e=>window.location.assign(e)))(i),n.next&&!i){t.url=n.next,t.method=`GET`,t.body=void 0,N(e,t);return}if(n.keepOpen){n.html&&F(e,t,n.html,!1);return}j(e,t,`success`,a)}function Me(e){let t=e.target.closest?.(`[data-wui-modal], [data-wui-drawer]`);if(t&&!(t.matches(`a[href]`)&&(e.ctrlKey||e.metaKey||e.shiftKey||e.button!==0))){if(e.preventDefault(),!t.hasAttribute(`data-wui-modal`)){Fe(t.getAttribute(`data-wui-drawer`),{size:t.getAttribute(`data-wui-drawer-size`)||void 0,title:t.getAttribute(`data-wui-title`)||void 0,trigger:t}).catch(e=>{e?.name!==`AbortError`&&n(e)});return}I(t.getAttribute(`data-wui-modal`),{size:t.getAttribute(`data-wui-size`)||void 0,title:t.getAttribute(`data-wui-title`)||void 0,trigger:t}).catch(e=>{e?.name!==`AbortError`&&n(e)})}}function Ne(e){if(e.key!==`Tab`||e.defaultPrevented)return;let t=e.currentTarget.querySelectorAll(`.modal.show`),n=t[t.length-1];n&&he(n,e)}function Pe(e=document){let t=e.ownerDocument||e;ne.has(t)||(ne.add(t),t.addEventListener(`click`,Me),t.addEventListener(`keydown`,Ne));let n=[...e.querySelectorAll?.(`.modal[data-wui-remote-url]`)||[]];e.matches?.(`.modal[data-wui-remote-url]`)&&n.unshift(e);for(let e of n)ye(e)}function I(e,t={}){try{if(!e)throw TypeError(`WUI.modal.load: a fragment url is required.`);let n=re(e),r=t.container===`drawer`,i=r?oe(t.size):x(t.size),a=t.placement||`center`;if(!ae.includes(a))throw TypeError(`WUI.modal.load: unsupported placement "${a}". Use center or top.`);if(t.signal?.aborted)return Promise.reject(y());let o=ce(r?`drawer`:`modal`);Pe(document);let s=ye(o),c=O(s),l=be(s,e,t);l.explicitSize=i,S(o,i||s.defaultSize),r||o.querySelector(`.modal-dialog`).classList.toggle(`modal-dialog-centered`,a===`center`),t.title&&o.setAttribute(`aria-label`,t.title),c||(n.getInstance(o)?.dispose(),n.getOrCreateInstance(o,{backdrop:!t.staticBackdrop||`static`,keyboard:!t.staticBackdrop}));let u=c?Promise.resolve():new Promise(e=>o.addEventListener(`shown.bs.modal`,()=>e(),{once:!0})),d=N(s,l);c||n.getOrCreateInstance(o).show();let f=new Promise((e,n)=>{t.signal?.addEventListener(`abort`,()=>{s.session===l&&(s.queue.abort(),j(s,l,`dismissed`,{aborted:!0})),n(y())},{once:!0})}),p=Promise.all([u,d]).then(([,t])=>{if(t===`aborted`)throw y();if(t===`session`)throw Error(`WUI.modal.load(${e}): the session expired; the browser is signing in again.`);return l.handle});return Promise.race([p,f])}catch(e){return Promise.reject(e)}}function Fe(e,t={}){return I(e,{...t,container:`drawer`,placement:void 0})}var Ie=Object.freeze([`neutral`,`primary`,`info`,`success`,`warning`,`danger`]),L=Object.freeze([`number`,`currency`,`compact`]),Le=`wui-kanban:`,Re=`(max-width: 767.98px)`,ze=400,Be=6,R=Object.freeze({help:`Press Space to pick up the card. Use the Left and Right arrow keys to choose a column, then Space to drop it, or Escape to cancel.`,empty:`Nothing here`,collapse:e=>`Collapse ${e}`,expand:e=>`Expand ${e}`,lifted:(e,t)=>`Picked up ${e} in ${t}. Use the Left and Right arrow keys to choose a column.`,over:(e,t)=>`${e}, ${t===1?`1 card`:`${t} cards`}. Drop allowed.`,overSource:e=>`${e}, where the card started.`,overRefused:(e,t)=>`${e}. ${t}`,dropHere:(e,t)=>`Drop here to move ${e} to ${t}.`,refused:(e,t)=>`Cards in ${e} cannot move to ${t}.`,moved:(e,t)=>`Moved ${e} to ${t}.`,saving:(e,t)=>`Moving ${e} to ${t}.`,cancelled:e=>`${e} was not moved.`,rolledBack:(e,t)=>`${e} went back to ${t}.`,locked:e=>`${e} cannot be moved.`,more:e=>`Show ${e} more`,fewer:`Show fewer`,swipeHint:`Swipe sideways or tap a column`,busy:`This card is still saving. Try again in a moment.`,failed:Object.freeze({forbidden:`You do not have permission to move this card.`,client:`This card could not be moved. Refresh the board and try again.`,validation:`This card could not be moved. Refresh the board and try again.`,server:`Something went wrong on our side, so the card went back. Try again in a moment.`,network:`Could not reach the server, so the card went back. Check your connection and try again.`})}),z=`[data-wui-column]`,B=`[data-wui-body]`,V=`[data-wui-card]`,Ve=`[data-wui-count]`,He=`[data-wui-summary]`,Ue=`[data-wui-empty]`,We=`[data-wui-drop-note]`,Ge=`[data-wui-live]`,Ke=`[data-wui-help]`,H=`[data-wui-switch]`,qe=`[data-wui-scroller]`,Je=`[data-wui-collapse]`,Ye=`[data-wui-more]`,Xe=`data-wui-visible-limit`,U=`data-wui-overflow`,Ze=`input, select, textarea, [contenteditable=""], [contenteditable="true"], [data-wui-no-drag]`,W=48,G=16,K=e=>e.getAttribute(`data-wui-column`),q=e=>e.getAttribute(`data-wui-card`),J=e=>e.hidden||e.hasAttribute(`hidden`),Qe=e=>J(e)||e.hasAttribute(U);function $e(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:Number(e);if(!Number.isInteger(t)||t<1)throw TypeError(`Unsupported kanban visible limit "${String(e)}". Use a whole number of 1 or more.`);return t}function et(e,t,n,r){let i=new Set;if(t==null||n)return i;let a=0;for(let n of e)r.has(n)||(a<t?a++:i.add(n));return i}function Y(e){let t=(e.getAttribute(`aria-label`)||e.textContent||``).replace(/\s+/g,` `).trim();return t.length>80?`${t.slice(0,79)}…`:t||q(e)||`Card`}function X(e){return e?`${Le}${e}`:null}function Z(e,t=globalThis.localStorage){let n=X(e);if(!n||!t)return{};try{let e=JSON.parse(t.getItem(n)||`null`);return e&&typeof e.collapsed==`object`&&e.collapsed?e.collapsed:{}}catch{return{}}}function tt(e,t,n,r=globalThis.localStorage){let i=X(e);if(!i||!r)return;let a={...Z(e,r),[t]:!!n};try{r.setItem(i,JSON.stringify({collapsed:a}))}catch{}}function nt(e,t){if(!L.includes(e))throw TypeError(`Unsupported kanban summary format "${String(e)}". Use ${L.join(`, `)}.`);if(t!=null&&t!==``&&!i.includes(t))throw TypeError(`Unsupported kanban summary unit "${String(t)}". Use ${i.join(`, `)}.`);return e===`currency`?{style:`currency`,unit:t||`rupees`}:e===`compact`?{style:`compact`,currency:a[0],unit:t||`rupees`}:{style:`number`,decimals:0}}function Q(e){let t=0;for(let n of e){if(n==null||n===``)continue;let e=typeof n==`number`?n:Number(n);Number.isFinite(e)&&(t+=e)}return t}var $=(e,t)=>{e&&window.WUI?.toast?.(e,{variant:t})},rt=class extends e{constructor(){super(),this._wired=!1,this._filter=null,this._expanded=new Set,this._revealed=new Set,this._press=null,this._drag=null,this._kbd=null,this._suppressClick=!1,this._observer=null,this._refreshQueued=!1,this._scrollTimer=0,this._onPointerMove=e=>this._pointerMove(e),this._onPointerUp=e=>this._pointerUp(e),this._onPointerCancel=()=>this._endPointer(!1),this._onDocKeyDown=e=>{e.key===`Escape`&&this._drag&&(e.preventDefault(),this._endPointer(!1))},this._onScroll=()=>{clearTimeout(this._scrollTimer),this._scrollTimer=setTimeout(()=>this._syncSwitcherFromScroll(),80)}}_controlled(){return this.hasAttribute(`controlled`)}connectedCallback(){if(!this._wired){this._wired=!0,this.addEventListener(`pointerdown`,e=>this._pointerDown(e)),this.addEventListener(`keydown`,e=>this._keyDown(e)),this.addEventListener(`click`,e=>this._click(e),!0),this.addEventListener(`dragstart`,e=>{e.target.closest?.(V)&&e.preventDefault()}),this.addEventListener(`touchmove`,e=>{this._drag&&e.preventDefault()},{passive:!1}),this._scroller()?.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._restoreCollapsed();for(let e of this._allCards())this._prepareCard(e);if(typeof MutationObserver==`function`){this._observer=new MutationObserver(e=>{for(let t of e)for(let e of t.addedNodes)e.nodeType===1&&e.matches(V)&&this._prepareCard(e);this._queueRefresh()});for(let e of this.querySelectorAll(B))this._observer.observe(e,{childList:!0})}this.refresh()}}disconnectedCallback(){this._endPointer(!1),this._observer?.disconnect(),this._observer=null,this._scroller()?.removeEventListener(`scroll`,this._onScroll),clearTimeout(this._scrollTimer),this._wired=!1}setFilter(e){if(e!=null&&typeof e!=`function`)throw TypeError(`wui-kanban setFilter: pass a function or null.`);if(this._filter=e,!e)for(let e of this._allCards())e.hidden=!1;this.refresh()}refresh(){if(this._controlled())return;this._refreshQueued=!1;let e=this._summaryFormat();for(let t of this._columns()){let n=K(t),i=$e(t.getAttribute(Xe)),a=[],o=[];for(let e of this._cardsIn(t)){if(this._filter&&(e.hidden=this._filter(e)===!1),J(e)){e.removeAttribute(U);continue}a.push(e),o.push(e.getAttribute(`data-wui-value`))}let s=this._expanded.has(n),c=et(a.map(q),i,s,this._revealed);for(let e of a)e.toggleAttribute(U,c.has(q(e)));let l=String(a.length);for(let e of this._countsOf(t))e.textContent!==l&&(e.textContent=l);let u=t.querySelector(Ue);if(u&&(u.hidden=a.length>0),e){let n=t.querySelector(He);n&&(n.textContent=r(Q(o),e))}let d=t.querySelector(Ye);if(d){d.hidden=i==null||(s?a.length<=i:c.size===0),d.setAttribute(`aria-expanded`,s?`true`:`false`);let e=s?R.fewer:R.more(c.size);d.textContent!==e&&(d.textContent=e)}}}moveCard(e,t,n){let r=this._cardByKey(e);if(!r)throw Error(`wui-kanban moveCard: no card "${String(e)}" on this board.`);if(!this._columnByKey(t))throw Error(`wui-kanban moveCard: no column "${String(t)}" on this board.`);return this._commit(r,t,n)}_columns(){return[...this.querySelectorAll(z)]}_columnByKey(e){return this._columns().find(t=>K(t)===e)||null}_columnOf(e){return e.closest(z)}_titleOf(e){return(e.querySelector(`.wui-kanban-title`)?.textContent||K(e)||``).replace(/\s+/g,` `).trim()}_bodyOf(e){return e.querySelector(B)}_cardsIn(e){let t=this._bodyOf(e);return t?[...t.children].filter(e=>e.matches(V)):[]}_visibleCardsIn(e){return this._cardsIn(e).filter(e=>!Qe(e))}_allCards(){return[...this.querySelectorAll(`${B} > ${V}`)]}_cardByKey(e){return this._allCards().find(t=>q(t)===e)||null}_countsOf(e){let t=K(e),n=[...this.querySelectorAll(H)].filter(e=>e.getAttribute(`data-wui-switch`)===t);return[...e.querySelectorAll(Ve),...n.flatMap(e=>[...e.querySelectorAll(Ve)])]}_scroller(){return this.querySelector(qe)}_summaryFormat(){let e=this.getAttribute(`summary-format`);return e?nt(e,this.getAttribute(`summary-unit`)):null}_queueRefresh(){this._refreshQueued||(this._refreshQueued=!0,queueMicrotask(()=>{this._refreshQueued&&this.refresh()}))}_prepareCard(e){let t=this.querySelector(Ke);t?.id&&!e.hasAttribute(`aria-describedby`)&&e.setAttribute(`aria-describedby`,t.id),e.hasAttribute(`tabindex`)||(e.tabIndex=0)}_announce(e){let t=this.querySelector(Ge);!t||!e||(t.textContent=``,t.textContent=e)}_fire(e,t,n=!1){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,cancelable:n,detail:t}))}_canLift(e){let t=Y(e),n=this.hasAttribute(`readonly`);return n||e.hasAttribute(`data-wui-locked`)?(this._announce(R.locked(t)),this._fire(`wui:kanban:locked`,{key:q(e),card:e,reason:n?`readonly`:`locked`},!0),!1):e.getAttribute(`aria-busy`)===`true`?(this._announce(R.busy),$(R.busy,`info`),!1):!0}_check(e,t,n){if(t===n)return{ok:!1,source:!0,reason:null};let r=this._columnByKey(t),i=this._columnByKey(n),a=R.refused(r?this._titleOf(r):t,i?this._titleOf(i):n),o=i?.getAttribute(`data-accept-from`);if(o!=null&&!o.split(/\s+/).filter(Boolean).includes(t))return{ok:!1,reason:a};if(typeof this.accept==`function`){let r=this.accept(e,t,n);if(r===!1)return{ok:!1,reason:a};if(typeof r==`string`&&r)return{ok:!1,reason:r}}return{ok:!0,reason:null}}_markTargets(e,t){let n=Y(e),r=new Map;for(let i of this._columns()){let a=K(i),o=this._check(e,t,a);r.set(a,o),i.setAttribute(`data-wui-drop`,o.source?`source`:o.ok?`ok`:`refused`);let s=i.querySelector(We);s&&!o.source&&(s.textContent=o.ok?R.dropHere(n,this._titleOf(i)):o.reason,s.hidden=!1)}return r}_clearTargets(){for(let e of this._columns()){e.removeAttribute(`data-wui-drop`),e.removeAttribute(`data-wui-over`),e.removeAttribute(`data-wui-target`);let t=e.querySelector(We);t&&(t.hidden=!0,t.textContent=``)}}async _commit(e,t,n){let r=this._columnOf(e),i=K(r),a=this._columnByKey(t),s=Y(e);if(i===t||!this._canLift(e))return!1;let c=this._check(e,i,t);if(!c.ok)return this._announce(c.reason),$(c.reason,`info`),!1;let l=this._cardsIn(a),u=Number.isInteger(n)?Math.max(0,Math.min(n,l.length)):l.length,d={key:q(e),card:e,from:i,to:t,index:u},f=e.contains(document.activeElement);if(this._controlled())return this._fire(`wui:kanban:move`,d),this._announce(R.moved(s,this._titleOf(a))),f&&this._refocusSoon(d.key),!0;if(!this._fire(`wui:kanban:move`,d,!0))return!1;let p=a.hasAttribute(Xe)&&!this._revealed.has(d.key);p&&this._revealed.add(d.key);let m={parent:e.parentNode,next:e.nextSibling,column:r,revealed:p};this._bodyOf(a).insertBefore(e,l[u]||null),f&&this._focusMoved(e),this.refresh();let h=a.getAttribute(`data-wui-step`);if(h)return this._runStep(e,d,m,h,a.getAttribute(`data-wui-step-size`));let g=this.getAttribute(`move-url`);if(!g)return this._announce(R.moved(s,this._titleOf(a))),this._fire(`wui:kanban:moved`,{...d,result:null}),!0;this._lock(e,!0),this._announce(R.saving(s,this._titleOf(a)));let _=await o(g,{method:`POST`,body:new URLSearchParams({card:d.key,from:i,to:t,index:String(u)})});if(this._lock(e,!1),_.kind===`session`)return!1;if(_.ok){let t=this._applyFragment(_.html)||e;return $(_.message,`success`),this._announce(R.moved(Y(t),this._titleOf(a))),this._fire(`wui:kanban:moved`,{...d,card:t,result:_}),!0}return this._rollback(e,m),_.kind!==`aborted`&&$(_.message||R.failed[_.kind]||R.failed.server,`danger`),this._fire(`wui:kanban:failed`,{...d,kind:_.kind,status:_.status,message:_.message}),!1}async _runStep(e,t,n,r,i){let a=Y(e),s=this._columnByKey(t.to),c=new URLSearchParams({card:t.key,from:t.from,to:t.to}).toString(),l=r+(r.includes(`?`)?`&`:`?`)+c;this._lock(e,!0);let u;try{u=await(await I(l,{trigger:e,size:i||void 0})).closed}catch(r){return this._lock(e,!1),this._rollback(e,n),r?.name!==`AbortError`&&$(R.failed.server,`danger`),this._fire(`wui:kanban:failed`,{...t,kind:`step`,status:0,message:r?.message??null}),!1}if(u?.status!==`success`)return this._lock(e,!1),this._rollback(e,n),this._announce(R.cancelled(a)),this._fire(`wui:kanban:failed`,{...t,kind:`dismissed`,status:0,message:null}),!1;let d=e,f=this.getAttribute(`card-url`);if(f){let n=await o(`${f}${f.includes(`?`)?`&`:`?`}${new URLSearchParams({card:t.key})}`);n.ok&&(d=this._applyFragment(n.html)||e)}return this._lock(d,!1),this._announce(R.moved(Y(d),this._titleOf(s))),this._fire(`wui:kanban:moved`,{...t,card:d,result:u}),!0}_lock(e,t){t?(e.setAttribute(`aria-busy`,`true`),e.setAttribute(`data-wui-saving`,``)):(e.removeAttribute(`aria-busy`),e.removeAttribute(`data-wui-saving`))}_rollback(e,t){let n=e.contains(document.activeElement),r=t.next&&t.next.parentNode===t.parent?t.next:null;t.revealed&&this._revealed.delete(q(e)),t.parent.insertBefore(e,r),n&&e.focus(),this.refresh(),this._announce(R.rolledBack(Y(e),this._titleOf(t.column)))}_applyFragment(e){if(!e)return null;let n=document.createElement(`template`);n.innerHTML=e;for(let e of n.content.querySelectorAll(`script`))t(`[@webority/ui-elements] A kanban fragment carried a script tag; it was removed, not run.`),e.remove();let r=null;for(let e of[...n.content.querySelectorAll(V)]){if(e.closest(`template`))continue;let t=this._cardByKey(q(e));if(!t)continue;let n=t.contains(document.activeElement);t.dispatchEvent(new CustomEvent(`wui:teardown`,{bubbles:!0})),t.hidden&&(e.hidden=!0),t.replaceWith(e),this._prepareCard(e),n&&e.focus(),r??=e}for(let e of n.content.querySelectorAll(`template[data-wui-kanban-summary]`))this._columnByKey(e.getAttribute(`data-wui-kanban-summary`))?.querySelector(He)?.replaceChildren(e.content.cloneNode(!0));return this.refresh(),window.WUI?.refresh?.(),r}_refocusSoon(e){let t=()=>{let t=this._cardByKey(e);t&&this._focusMoved(t)};typeof requestAnimationFrame==`function`?requestAnimationFrame(t):setTimeout(t,0)}_focusMoved(e){e.focus({preventScroll:!0}),e.scrollIntoView?.({block:`nearest`})}_pointerDown(e){if(e.button!==0||e.isPrimary===!1||this._drag||this._kbd)return;let t=e.target.closest?.(V);if(!t||!this.contains(t)||e.target.closest(Ze))return;let n={card:t,id:e.pointerId,x:e.clientX,y:e.clientY,type:e.pointerType,timer:0};this._press=n,e.pointerType===`touch`&&(n.timer=setTimeout(()=>{this._press===n&&this._startDrag(n,n.x,n.y)},400)),window.addEventListener(`pointermove`,this._onPointerMove),window.addEventListener(`pointerup`,this._onPointerUp),window.addEventListener(`pointercancel`,this._onPointerCancel)}_pointerMove(e){let t=this._press;if(!(!t||e.pointerId!==t.id)){if(!this._drag){if(!(Math.hypot(e.clientX-t.x,e.clientY-t.y)>6))return;if(t.type===`touch`){this._endPointer(!1);return}if(this._startDrag(t,e.clientX,e.clientY),!this._drag)return}this._dragTo(e.clientX,e.clientY)}}_pointerUp(e){!this._press||e.pointerId!==this._press.id||this._endPointer(!!this._drag)}_startDrag(e,t,n){let r=e.card;if(!this._canLift(r)){this._endPointer(!1);return}let i=K(this._columnOf(r)),a=r.getBoundingClientRect(),o=r.cloneNode(!0);for(let e of[o,...o.querySelectorAll(`[id]`)])e.removeAttribute(`id`);o.removeAttribute(`data-wui-card`),o.removeAttribute(`tabindex`),o.setAttribute(`aria-hidden`,`true`),o.classList.add(`wui-kanban-ghost`),o.style.width=`${a.width}px`,this.appendChild(o),r.setAttribute(`data-wui-dragging`,``),this.setAttribute(`data-wui-dragging`,``),this._drag={card:r,from:i,ghost:o,dx:t-a.left,dy:n-a.top,over:null,verdicts:this._markTargets(r,i)},this._announce(R.lifted(Y(r),this._titleOf(this._columnOf(r)))),document.addEventListener(`keydown`,this._onDocKeyDown),this._dragTo(t,n)}_dragTo(e,t){let n=this._drag;n.x=e,n.y=t,n.ghost.style.transform=`translate(${e-n.dx}px, ${t-n.dy}px)`;let r=this._columnAt(e,t);r!==n.over&&(n.over?.removeAttribute(`data-wui-over`),r?.setAttribute(`data-wui-over`,``),n.over=r),this._autoScroll(e,t,r)}_columnAt(e,t){for(let n of this._columns()){let r=n.getBoundingClientRect();if(e>=r.left&&e<=r.right&&t>=r.top&&t<=r.bottom)return n}return null}_indexAt(e,t){let n=this._visibleCardsIn(e).filter(e=>e!==this._drag?.card).find(e=>{let n=e.getBoundingClientRect();return t<n.top+n.height/2}),r=this._cardsIn(e).filter(e=>e!==this._drag?.card);return n?r.indexOf(n):r.length}_autoScroll(e,t,n){let r=this._scroller();if(r){let t=r.getBoundingClientRect();t.width>0&&(e<t.left+W?r.scrollBy?.({left:-16}):e>t.right-W&&r.scrollBy?.({left:G}))}if(n&&this._scrollColumn(n,t))return;let i=window.innerHeight||0;i>0&&(t<W?window.scrollBy?.({top:-16}):t>i-W&&window.scrollBy?.({top:G}))}_scrollColumn(e,t){let n=this._bodyOf(e);if(!n||e.hasAttribute(`data-collapsed`)||n.scrollHeight<=n.clientHeight)return!1;let r=n.getBoundingClientRect();return t<r.top+W&&n.scrollTop>0?(n.scrollBy?.({top:-16}),!0):t>r.bottom-W&&n.scrollTop+n.clientHeight<n.scrollHeight-1?(n.scrollBy?.({top:G}),!0):!1}_endPointer(e){let t=this._press,n=this._drag;if(t&&clearTimeout(t.timer),this._press=null,this._drag=null,window.removeEventListener(`pointermove`,this._onPointerMove),window.removeEventListener(`pointerup`,this._onPointerUp),window.removeEventListener(`pointercancel`,this._onPointerCancel),document.removeEventListener(`keydown`,this._onDocKeyDown),!n)return;n.ghost.remove(),n.card.removeAttribute(`data-wui-dragging`),this.removeAttribute(`data-wui-dragging`),this._suppressClick=!0,setTimeout(()=>{this._suppressClick=!1},0);let r=n.over;if(this._clearTargets(),!e||!r){this._announce(R.cancelled(Y(n.card)));return}let i=K(r),a=n.verdicts.get(i);if(a?.source){this._announce(R.cancelled(Y(n.card)));return}if(!a?.ok){this._announce(a?.reason),$(a?.reason,`info`);return}this._commit(n.card,i,this._indexAt(r,n.y))}_click(e){if(this._suppressClick&&e.target.closest?.(V)){e.preventDefault(),e.stopPropagation(),this._suppressClick=!1;return}let t=e.target.closest?.(Je);if(t&&this.contains(t)){let e=t.closest(z);e&&this._setCollapsed(e,!e.hasAttribute(`data-collapsed`),!0);return}let n=e.target.closest?.(Ye);if(n&&this.contains(n)){this._controlled()||this._toggleMore(n.closest(z));return}let r=e.target.closest?.(H);r&&this.contains(r)&&this._showColumn(r.getAttribute(`data-wui-switch`))}_keyDown(e){if(this._kbd){this._liftedKey(e);return}let t=e.target;if(!t.matches?.(V)||!this.contains(t))return;let n=this._columnOf(t);switch(e.key){case` `:case`Spacebar`:{if(e.preventDefault(),!this._canLift(t))return;let r=K(n),i=this._columns();this._kbd={card:t,from:r,target:i.indexOf(n),verdicts:this._markTargets(t,r)},t.setAttribute(`data-wui-lifted`,``),this.setAttribute(`data-wui-dragging`,``),n.setAttribute(`data-wui-target`,``),this._announce(R.lifted(Y(t),this._titleOf(n)));return}case`ArrowDown`:case`ArrowUp`:{let r=this._visibleCardsIn(n),i=r[r.indexOf(t)+(e.key===`ArrowDown`?1:-1)];i&&(e.preventDefault(),i.focus());return}case`ArrowLeft`:case`ArrowRight`:{let t=this._columns(),r=e.key===`ArrowRight`?1:-1;for(let i=t.indexOf(n)+r;i>=0&&i<t.length;i+=r){let n=this._visibleCardsIn(t[i])[0];if(n&&!t[i].hasAttribute(`data-collapsed`)){e.preventDefault(),n.focus();return}}return}default:}}_liftedKey(e){let t=this._kbd,n=this._columns();switch(e.key){case`ArrowLeft`:case`ArrowRight`:{e.preventDefault();let r=t.target+(e.key===`ArrowRight`?1:-1);if(r<0||r>=n.length)return;n[t.target]?.removeAttribute(`data-wui-target`),t.target=r;let i=n[r];i.setAttribute(`data-wui-target`,``),this._showColumn(K(i),!1);let a=t.verdicts.get(K(i)),o=this._titleOf(i);this._announce(a.source?R.overSource(o):a.ok?R.over(o,this._cardsIn(i).filter(e=>!J(e)).length):R.overRefused(o,a.reason));return}case` `:case`Spacebar`:case`Enter`:{e.preventDefault();let r=n[t.target],i=K(r),a=t.verdicts.get(i);if(!a.source&&!a.ok){this._announce(a.reason);return}this._endKeyboard(),a.source?this._announce(R.cancelled(Y(t.card))):this._commit(t.card,i);return}case`Escape`:case`Tab`:e.key===`Escape`&&e.preventDefault(),this._endKeyboard(),this._showColumn(t.from,!1),this._announce(R.cancelled(Y(t.card)));return;default:}}_endKeyboard(){let e=this._kbd;this._kbd=null,e&&(e.card.removeAttribute(`data-wui-lifted`),this.removeAttribute(`data-wui-dragging`),this._clearTargets())}_restoreCollapsed(){let e=Z(this.getAttribute(`board-id`));for(let t of this._columns()){let n=K(t);t.hasAttribute(`data-collapsible`)&&Object.hasOwn(e,n)&&this._setCollapsed(t,e[n],!1)}}_setCollapsed(e,t,n){let r=K(e);e.toggleAttribute(`data-collapsed`,t);let i=this._titleOf(e);for(let n of e.querySelectorAll(Je))n.setAttribute(`aria-expanded`,t?`false`:`true`),n.setAttribute(`aria-label`,t?R.expand(i):R.collapse(i));n&&(tt(this.getAttribute(`board-id`),r,t),this._fire(`wui:kanban:collapse`,{column:r,collapsed:t}))}_toggleMore(e){if(!e)return;let t=K(e);if(this._expanded.delete(t))for(let t of this._cardsIn(e))this._revealed.delete(q(t));else this._expanded.add(t);this.refresh()}_isPhone(){return typeof matchMedia==`function`&&matchMedia(`(max-width: 767.98px)`).matches}_showColumn(e,t=!0){for(let t of this.querySelectorAll(H))t.getAttribute(`data-wui-switch`)===e?t.setAttribute(`aria-current`,`true`):t.removeAttribute(`aria-current`);let n=this._columnByKey(e),r=this._scroller();if(!n||!r||!t&&!this._isPhone())return;let i=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches;r.scrollTo?.({left:n.offsetLeft-r.offsetLeft,behavior:i?`auto`:`smooth`})}_syncSwitcherFromScroll(){let e=this._scroller();if(!e||!this._isPhone())return;let t=e.clientWidth||1,n=this._columns()[Math.round(e.scrollLeft/t)];if(n)for(let e of this.querySelectorAll(H))e.getAttribute(`data-wui-switch`)===K(n)?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`)}};export{f as _,L as a,I as b,rt as c,X as d,nt as f,tt as g,Q as h,Le as i,Y as l,Z as m,ze as n,R as o,$e as p,Re as r,Ie as s,Be as t,et as u,Pe as v,Fe as y};
@@ -1 +1 @@
1
- import{t as e}from"./iconGlyphs.g-Bk8AzmSO.js";var t=Symbol(`wui.trustedHtml`),n=e=>({...e,[t]:!0}),r=e=>String(e??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`),i=t=>{if(!t)return``;let n=String(t).toLowerCase().replace(/[^a-z0-9-]/g,``);return n?e(n):``},a=e=>`wui-flag wui-flag-${e}`,o=e=>{let t=String(e??``).toLowerCase();return/^[a-z]{2}$/.test(t)?`<span class="${a(t)}" aria-hidden="true"></span>`:``},s=e=>{if(e==null)return``;let n=e[t]?String(e.label??``):r(e.label),a=o(e.flag)+i(e.icon);return a?`<span class="wui-opt-label">${a}${n}</span>`:n},c=e=>String(e??``).replace(/<[^>]*>/g,``),l=new WeakMap,u=e=>{if(e==null)return``;if(!e[t])return c(e.label);let n=l.get(e);if(n&&n.label===e.label)return n.text;let r=document.createElement(`template`);r.innerHTML=String(e.label??``);let i=r.content.textContent;return l.set(e,{label:e.label,text:i}),i};export{c as a,u as i,r as n,n as o,s as r,t};
1
+ import{t as e}from"./iconGlyphs.g-BNrdQ7It.js";var t=Symbol(`wui.trustedHtml`),n=e=>({...e,[t]:!0}),r=e=>String(e??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`),i=t=>{if(!t)return``;let n=String(t).toLowerCase().replace(/[^a-z0-9-]/g,``);return n?e(n):``},a=e=>`wui-flag wui-flag-${e}`,o=e=>{let t=String(e??``).toLowerCase();return/^[a-z]{2}$/.test(t)?`<span class="${a(t)}" aria-hidden="true"></span>`:``},s=e=>{if(e==null)return``;let n=e[t]?String(e.label??``):r(e.label),a=o(e.flag)+i(e.icon);return a?`<span class="wui-opt-label">${a}${n}</span>`:n},c=e=>String(e??``).replace(/<[^>]*>/g,``),l=new WeakMap,u=e=>{if(e==null)return``;if(!e[t])return c(e.label);let n=l.get(e);if(n&&n.label===e.label)return n.text;let r=document.createElement(`template`);r.innerHTML=String(e.label??``);let i=r.content.textContent;return l.set(e,{label:e.label,text:i}),i};export{c as a,u as i,r as n,n as o,s as r,t};
@@ -7,4 +7,4 @@ function e(e){let t=``;function n(t){let n=`message`,r=[];for(let e of t.split(`
7
7
  `);t=r.pop();for(let e of r)n(e)},end(){let e=t.replace(/\r$/,``);t=``,e.trim()&&n(e)}}}var t=`Something went wrong. Please try again.`,n=class extends Error{constructor(e,t,n,r=null){super(t),this.name=`ChatApiError`,this.code=e,this.status=n,this.resetsAtUtc=r}};function r(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return null}return e??null}function i(e,t){return t?.aborted||e?.code===`ERR_CANCELED`||e?.name===`CanceledError`||e?.name===`AbortError`}function a(e,a){if(e instanceof n)return e;if(i(e,a))return new n(`aborted`,`The request was cancelled.`);let o=e?.response;if(!o)return new n(`network`,t);let s=r(o.data),c=typeof s?.code==`string`&&s.code?s.code:`unknown`,l=typeof s?.message==`string`&&s.message?s.message:t,u=typeof s?.resetsAtUtc==`string`?s.resetsAtUtc:null;return new n(c,l,o.status,u)}async function o(e){try{return(await e()).data}catch(e){throw a(e)}}function s(e){let t=e?.event?.target;if(!(!t||typeof t.responseText!=`string`)&&!(typeof t.status==`number`&&(t.status<200||t.status>=300)))return t.responseText}function c(r,{base:i}){if(typeof i!=`string`||i.trim()===``)throw TypeError(`createChatClient needs a base path, e.g. { base: "/api/assistant" }.`);let c=i.replace(/\/+$/,``),l=e=>`${c}/conversations/${encodeURIComponent(e)}`;async function u({message:i,conversationId:o,pageContext:l},{signal:u,onEvent:d}={}){let f=null,p=null,m=e(({name:e,data:t})=>{f||p||(e===`done`?f=t:e===`error`?p=t:(e===`delta`||e===`reset`||e===`tool`||e===`actions`)&&d?.(e,t))}),h=0,g=e=>{typeof e!=`string`||e.length<=h||(m.push(e.slice(h)),h=e.length)},_={message:i};o&&(_.conversationId=o),l!=null&&(_.pageContext=l);let v;try{v=await r.post(`${c}/chat`,_,{responseType:`text`,headers:{Accept:`text/event-stream`},signal:u,onDownloadProgress:e=>g(s(e))})}catch(e){throw a(e,u)}if(g(v.data),m.end(),p)throw new n(p.code||`unknown`,p.message||t);if(!f)throw new n(`invalid-response`,t,v.status);return f}return{sendMessage:u,getAllowance:()=>o(()=>r.get(`${c}/allowance`)),listConversations:({skip:e,take:t}={})=>{let n=new URLSearchParams;e!=null&&n.append(`skip`,String(e)),t!=null&&n.append(`take`,String(t));let i=n.toString();return o(()=>r.get(`${c}/conversations${i?`?${i}`:``}`))},getConversation:e=>o(()=>r.get(l(e))),deleteConversation:async e=>{await o(()=>r.delete(l(e)))},rateMessage:async(e,t,{rating:n,note:i})=>{let a=typeof i==`string`?i.trim():``;await o(()=>r.put(`${l(e)}/messages/${encodeURIComponent(t)}/rating`,{rating:n,note:a||null}))}}}var l=Object.freeze({launcher:`Ask the assistant`,panelTitle:`Assistant`,newChat:`New chat`,close:`Close`,thread:`Conversation`,you:`You`,assistant:`Assistant`,thinking:`Thinking`,emptyTitle:`How can I help?`,emptyText:`Ask a question about what you see on this page.`,composer:`Your question`,placeholder:`Ask a question`,send:`Send`,composerHint:`Press Enter to send, Shift and Enter for a new line.`,allowance:e=>e===0?`You have no questions left today.`:e===1?`You have 1 question left today.`:`You have ${e} questions left today.`,disclaimer:`Answers are written by AI and can be wrong. Check anything important.`,loadingConversation:`Loading the conversation`,rateUp:`Helpful`,rateDown:`Not helpful`,rated:`Thanks for the feedback.`,ratingNote:`What was wrong with this answer?`,ratingNoteHint:`Optional.`,ratingNoteSend:`Send`,ratingNoteSkip:`Skip`,ratingFailed:`Your rating did not save. Please try again.`,actionRaiseTicket:`New support ticket`,actionReply:e=>`Reply on ${e}`,actionReopen:e=>`Reopen ${e}`,actionNote:`Nothing is sent until you confirm.`,actionConfirm:`Confirm`,actionDismiss:`Not now`,actionDismissed:`Not sent.`,actionExpired:`This request expired and was not sent. Ask again if you still need it.`,actionFailed:`We could not send this. Please try again.`,actionDone:`Done.`,actionDoneRaiseTicket:e=>`Ticket ${e} raised.`,actionDoneReply:e=>`Your reply was added to ${e}.`,actionDoneReopen:e=>`${e} is open again.`,viewTicket:`View ticket`,conversations:`Past chats`,conversationsEmptyTitle:`No past chats`,conversationsEmptyText:`Your conversations with the assistant show here.`,untitled:`Untitled chat`,deleteConversation:`Delete chat`,deleteConfirmTitle:`Delete this chat?`,deleteConfirmMessage:`The conversation is removed for good.`,deleteConfirm:`Delete`,deleteFailed:`We could not delete this chat. Please try again.`,cancel:`Cancel`,loadMore:`Show more`,loadFailed:`We could not load your chats. Please try again.`,retry:`Try again`});function u(e){return e?{...l,...e}:l}var d=/^[a-z][a-z0-9+.-]*:[a-z0-9_-]+\/[a-z0-9_.~-]+$/i,f=/^\s*```/,p=/^\s*[-*+]\s+(.*)$/,m=/^\s*(\d{1,9})[.)]\s+(.*)$/,h=/^\s{0,3}#{1,6}\s+(.*?)\s*#*\s*$/,g=/^\s*([-*_])(\s*\1){2,}\s*$/,_=/^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)*\|?\s*$/,v=e=>e.includes(`|`);function y(e){let t=e.trim();return t.startsWith(`|`)&&(t=t.slice(1)),t.endsWith(`|`)&&(t=t.slice(0,-1)),t.split(`|`).map(e=>e.trim())}function b(e,t){return v(e[t])&&t+1<e.length&&_.test(e[t+1])}function x(e,t){let n=e[t];return f.test(n)||p.test(n)||m.test(n)||h.test(n)||g.test(n)||b(e,t)}function S(e){let t=String(e??``).replace(/\r\n?/g,`
8
8
  `).split(`
9
9
  `),n=[],r=0;for(;r<t.length;){let e=t[r];if(!e.trim()){r+=1;continue}if(f.test(e)){let e=[];for(r+=1;r<t.length&&!f.test(t[r]);)e.push(t[r]),r+=1;r+=1,n.push({type:`code`,text:e.join(`
10
- `)});continue}if(b(t,r)){let i=y(e),a=[];for(r+=2;r<t.length&&t[r].trim()&&v(t[r]);)a.push(y(t[r])),r+=1;n.push({type:`table`,header:i,rows:a});continue}if(g.test(e)){n.push({type:`rule`}),r+=1;continue}let i=h.exec(e);if(i){n.push({type:`heading`,text:i[1]}),r+=1;continue}let a=m.exec(e);if(a||p.test(e)){let e=!!a,i=e?m:p,o=[];for(;r<t.length&&t[r].trim();){let n=i.exec(t[r]);if(n)o.push(e?n[2]:n[1]);else if(x(t,r))break;else o[o.length-1]+=` ${t[r].trim()}`;r+=1}n.push({type:`list`,ordered:e,start:e?Number(a[1]):1,items:o});continue}let o=[e];for(r+=1;r<t.length&&t[r].trim()&&!x(t,r);)o.push(t[r]),r+=1;n.push({type:`paragraph`,lines:o})}return n.map((e,t)=>({...e,key:t}))}var C=e=>!!e&&/[\p{L}\p{N}]/u.test(e);function w(e,t,n){let r=e.indexOf(n,t);for(;r!==-1;){let i=e.slice(t,r),a=n.length===1&&(e[r+1]===n||e[r-1]===n),o=n[0]===`_`&&C(e[r+n.length]);if(i.trim()&&!/^\s/.test(i)&&!/\s$/.test(i)&&!a&&!o)return r;r=e.indexOf(n,r+1)}return-1}function T(e){let t=[],n=``,r=()=>{n&&t.push({type:`text`,text:n}),n=``},i=0;for(;i<e.length;){let a=e[i];if(a==="`"){let n=e.indexOf("`",i+1);if(n>i+1){r(),t.push({type:`code`,text:e.slice(i+1,n)}),i=n+1;continue}}if((a===`*`||a===`_`)&&e[i+1]===a){let o=a+a,s=w(e,i+2,o);if(s!==-1&&!(a===`_`&&C(e[i-1]))){r(),t.push({type:`strong`,children:T(e.slice(i+2,s))}),i=s+2;continue}n+=o,i+=2;continue}if(a===`*`||a===`_`){let n=w(e,i+1,a);if(n!==-1&&!(a===`_`&&C(e[i-1]))){r(),t.push({type:`em`,children:T(e.slice(i+1,n))}),i=n+1;continue}}if(a===`[`){let n=/^\[([^\]\n]+)\]\(([^)\s]+)\)/.exec(e.slice(i));if(n){r(),t.push({type:`link`,href:n[2],children:T(n[1])}),i+=n[0].length;continue}}n+=a,i+=1}return r(),t.map((e,t)=>({...e,key:t}))}function E(e,t){if(!t||!d.test(e))return null;let n=t(e);return typeof n==`string`&&n.startsWith(`/`)&&!n.startsWith(`//`)?n:null}export{n as ChatApiError,l as DEFAULT_CHAT_LABELS,c as createChatClient,e as createSseParser,E as linkRoute,u as mergeLabels,S as parseBlocks,T as parseInline};
10
+ `)});continue}if(b(t,r)){let i=y(e),a=[];for(r+=2;r<t.length&&t[r].trim()&&v(t[r]);)a.push(y(t[r])),r+=1;n.push({type:`table`,header:i,rows:a});continue}if(g.test(e)){n.push({type:`rule`}),r+=1;continue}let i=h.exec(e);if(i){n.push({type:`heading`,text:i[1]}),r+=1;continue}let a=m.exec(e);if(a||p.test(e)){let e=!!a,i=e?m:p,o=[];for(;r<t.length&&t[r].trim();){let n=i.exec(t[r]);if(n)o.push(e?n[2]:n[1]);else if(x(t,r))break;else o[o.length-1]+=` ${t[r].trim()}`;r+=1}n.push({type:`list`,ordered:e,start:e?Number(a[1]):1,items:o});continue}let o=[e];for(r+=1;r<t.length&&t[r].trim()&&!x(t,r);)o.push(t[r]),r+=1;n.push({type:`paragraph`,lines:o})}return n.map((e,t)=>({...e,key:t}))}var C=e=>!!e&&/[\p{L}\p{N}]/u.test(e);function w(e,t,n){let r=e.indexOf(n,t);for(;r!==-1;){let i=e.slice(t,r),a=n.length===1&&(e[r+1]===n||e[r-1]===n),o=n[0]===`_`&&C(e[r+n.length]);if(i.trim()&&!/^\s/.test(i)&&!/\s$/.test(i)&&!a&&!o)return r;r=e.indexOf(n,r+1)}return-1}function T(e){let t=[],n=``,r=()=>{n&&t.push({type:`text`,text:n}),n=``},i=0;for(;i<e.length;){let a=e[i];if(a==="`"){let n=e.indexOf("`",i+1);if(n>i+1){r(),t.push({type:`code`,text:e.slice(i+1,n)}),i=n+1;continue}}if((a===`*`||a===`_`)&&e[i+1]===a){let o=a+a,s=w(e,i+2,o);if(s!==-1&&!(a===`_`&&C(e[i-1]))){r(),t.push({type:`strong`,children:T(e.slice(i+2,s))}),i=s+2;continue}n+=o,i+=2;continue}if(a===`*`||a===`_`){let n=w(e,i+1,a);if(n!==-1&&!(a===`_`&&C(e[i-1]))){r(),t.push({type:`em`,children:T(e.slice(i+1,n))}),i=n+1;continue}}if(a===`[`){let n=/^\[([^\]\n]+)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/.exec(e.slice(i));if(n){r(),t.push({type:`link`,href:n[2],children:T(n[1])}),i+=n[0].length;continue}}n+=a,i+=1}return r(),t.map((e,t)=>({...e,key:t}))}function E(e,t){if(!t||!d.test(e))return null;let n=t(e);return typeof n==`string`&&n.startsWith(`/`)&&!n.startsWith(`//`)?n:null}export{n as ChatApiError,l as DEFAULT_CHAT_LABELS,c as createChatClient,e as createSseParser,E as linkRoute,u as mergeLabels,S as parseBlocks,T as parseInline};